// Decompiled with JetBrains decompiler // Type: Terraria.Main // Assembly: Terraria, Version=1.4.0.5, Culture=neutral, PublicKeyToken=null // MVID: 67F9E73E-0A81-4937-A22C-5515CD405A83 // Assembly location: C:\Users\mikeyisbaeyt\Downloads\depotdownloader-2.4.5\depots\105601\6707058\Terraria.exe using Microsoft.Win32; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using ReLogic.Content; using ReLogic.Content.Sources; using ReLogic.Graphics; using ReLogic.Localization.IME; using ReLogic.OS; using ReLogic.Peripherals.RGB; using ReLogic.Utilities; using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Drawing; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.InteropServices; using System.Text; using System.Threading; using System.Threading.Tasks; using System.Windows.Forms; using Terraria.Achievements; using Terraria.Audio; using Terraria.Chat; using Terraria.Cinematics; using Terraria.DataStructures; using Terraria.Enums; using Terraria.GameContent; using Terraria.GameContent.Achievements; using Terraria.GameContent.Ambience; using Terraria.GameContent.Bestiary; using Terraria.GameContent.Creative; using Terraria.GameContent.Drawing; using Terraria.GameContent.Events; using Terraria.GameContent.Golf; using Terraria.GameContent.ItemDropRules; using Terraria.GameContent.Liquid; using Terraria.GameContent.NetModules; using Terraria.GameContent.Skies; using Terraria.GameContent.UI; using Terraria.GameContent.UI.BigProgressBar; using Terraria.GameContent.UI.Chat; using Terraria.GameContent.UI.States; using Terraria.GameInput; using Terraria.Graphics; using Terraria.Graphics.Capture; using Terraria.Graphics.Effects; using Terraria.Graphics.Light; using Terraria.Graphics.Renderers; using Terraria.Graphics.Shaders; using Terraria.ID; using Terraria.Initializers; using Terraria.IO; using Terraria.Localization; using Terraria.Map; using Terraria.Net; using Terraria.ObjectData; using Terraria.Social; using Terraria.UI; using Terraria.UI.Chat; using Terraria.UI.Gamepad; using Terraria.Utilities; using Terraria.WorldBuilding; namespace Terraria { public class Main : Game { private const string versionStringBecauseTheyreTheSame = "v1.4.0.5"; public const int curRelease = 230; public const string assemblyVersionNumber = "1.4.0.5"; public const string copyrightText = "Copyright © 2020 Re-Logic"; public const ulong WorldGeneratorVersion = 987842478081; public static Dictionary MinimapFrames = new Dictionary(); public static MinimapFrame ActiveMinimapFrame; public static Dictionary PlayerResourcesSets = new Dictionary(); public static IPlayerResourcesDisplaySet ActivePlayerResourcesSet; public static int mapDelay = 2; public const string TerrariaSaveFolderPath = "Terraria"; public static IAssetRepository Assets; public static AssetSourceController AssetSourceController; private volatile bool _musicLoaded; private volatile bool _artLoaded; private volatile bool _begunMainAsyncLoad; public static int CurrentDrawnEntityShader; public static Entity CurrentDrawnEntity; private static bool _WeGameReqExit = false; public static float ForcedMinimumZoom = 1f; public static SpriteViewMatrix GameViewMatrix; public static SpriteViewMatrix BackgroundViewMatrix; private static Matrix _currentWantedZoomMatrix; private static Matrix _uiScaleMatrix; private static float _uiScaleWanted = 1f; private static float _uiScaleUsed = 1f; public static float GameZoomTarget = 1f; public static bool LightingEveryFrame = true; public static bool SettingsUnlock_WorldEvil; public static bool SettingsEnabled_MinersWobble = true; public static bool SettingBlockGamepadsEntirely; public static bool SettingDontScaleMainMenuUp; public static bool SettingsEnabled_OpaqueBoxBehindTooltips = true; public static bool SettingMusicReplayDelayEnabled = false; public static bool HidePassword; public static bool ReversedUpDownArmorSetBonuses; public static Microsoft.Xna.Framework.Color MouseBorderColor = new Microsoft.Xna.Framework.Color(64, 64, 64, 64); public static bool MouseShowBuildingGrid; public static bool AllowUnfocusedInputOnGamepad; public static bool InvisibleCursorForGamepad = true; public static bool GamepadDisableCursorItemIconInner = true; public static bool GamepadDisableInstructionsDisplay; public static bool CrouchingEnabled = false; private static GameNotificationType _flashNotificationType = GameNotificationType.All; public static float MouseBuildingGridAlpha; public static bool CaptureModeDisabled = false; public bool unityMouseOver; public static Main instance; public static ChromaEngine Chroma; public static ChromaHotkeyPainter ChromaPainter; public static World ActiveWorld = new World(); public static Camera Camera = new Camera(); public static IPlayerRenderer PlayerRenderer = (IPlayerRenderer) new LegacyPlayerRenderer(); public static IPlayerRenderer PotionOfReturnRenderer = (IPlayerRenderer) new ReturnGatePlayerRenderer(); public static MapHeadRenderer MapPlayerRenderer = new MapHeadRenderer(); public static NPCHeadRenderer TownNPCHeadRenderer = (NPCHeadRenderer) null; public static NPCHeadRenderer BossNPCHeadRenderer = (NPCHeadRenderer) null; public static string versionNumber = "v1.4.0.5"; public static string versionNumber2 = "v1.4.0.5"; public static string SavePath = Program.LaunchParameters.ContainsKey("-savedirectory") ? Program.LaunchParameters["-savedirectory"] : Platform.Get().GetStoragePath("Terraria"); public static bool AnnouncementBoxDisabled; public static int AnnouncementBoxRange = -1; public static string AutogenSeedName; private static GameModeData _currentGameModeInfo = GameModeData.NormalMode; public static Dictionary RegisterdGameModes = new Dictionary() { { 0, GameModeData.NormalMode }, { 1, GameModeData.ExpertMode }, { 2, GameModeData.MasterMode }, { 3, GameModeData.CreativeMode } }; private static bool? _overrideForExpertMode = new bool?(); private static bool? _overrideForMasterMode = new bool?(); public static bool drunkWorld = false; public static bool getGoodWorld = false; public static Vector2 destroyerHB = new Vector2(0.0f, 0.0f); public static FavoritesFile LocalFavoriteData = new FavoritesFile(Main.SavePath + "/favorites.json", false); public static FavoritesFile CloudFavoritesData = new FavoritesFile("/favorites.json", true); public static FileMetadata WorldFileMetadata; public static FileMetadata MapFileMetadata; public static PingMapLayer Pings = new PingMapLayer(); public static MapIconOverlay MapIcons = new MapIconOverlay().AddLayer((IMapLayer) new SpawnMapLayer()).AddLayer((IMapLayer) new TeleportPylonsMapLayer()).AddLayer((IMapLayer) Main.Pings); public static CreativeUI CreativeMenu = new CreativeUI(); private static Vector2 _lastPingMousePosition = Vector2.Zero; private static double _lastPingMouseDownTime = 0.0; private AchievementManager _achievements; private AchievementAdvisor _achievementAdvisor; public static BigProgressBarSystem BigBossProgressBar = new BigProgressBarSystem(); public static UserInterface MenuUI = new UserInterface(); public static UserInterface InGameUI = new UserInterface(); private static Main.OnPlayerSelected _pendingCharacterSelect; public static bool drawBackGore; public static ulong LobbyId = 0; private static Microsoft.Xna.Framework.Color[] _mapColorCacheArray = new Microsoft.Xna.Framework.Color[30000]; public WaterfallManager waterfallManager; public static WorldSections sectionManager; public static bool ServerSideCharacter; public static string clientUUID; public static bool ContentLoaded = false; private static int toolTipDistance = 6; public static float GlobalTimeWrappedHourly; public static bool GlobalTimerPaused = false; public static GameTime gameTimeCache = new GameTime(); public static ulong TileFrameSeed = (ulong) Guid.NewGuid().GetHashCode(); private static ulong _drawCycleCounter; public static ContentManager ShaderContentManager; public static Ref ScreenShaderRef = new Ref(); public static Ref PixelShaderRef = new Ref(); public static Ref TileShaderRef = new Ref(); public static Ref VertexPixelShaderRef = new Ref(); public static int WaveQuality = 3; public static bool UseStormEffects = true; public static bool UseHeatDistortion = true; public static int npcStreamSpeed = 30; public static int musicError; public static bool dedServFPS; public static int dedServCount1; public static int dedServCount2; public static bool superFast = false; public const int offLimitBorderTiles = 40; public const int maxItemTypes = 5045; public const int maxProjectileTypes = 950; public const int maxNPCTypes = 663; public const int maxTileSets = 623; public const int maxWallTypes = 316; public const int maxBuffTypes = 323; public const int maxGlowMasks = 301; public const int maxExtras = 212; public const int maxGoreTypes = 1269; public const int maxMusic = 89; public const int MaxBannerTypes = 289; public const int numArmorHead = 266; public const int numArmorBody = 235; public const int numArmorLegs = 218; public const int numAccHandsOn = 22; public const int numAccHandsOff = 14; public const int numAccNeck = 11; public const int numAccBack = 30; public const int numAccFront = 9; public const int numAccShoes = 25; public const int numAccWaist = 17; public const int numAccShield = 10; public const int numAccFace = 16; public const int numAccBalloon = 18; public const int maxWings = 47; public const int maxBackgrounds = 298; public const int MaxShopIDs = 100; private static float cameraLerp; private static int cameraLerpTimer; private static int cameraLerpTimeToggle; private static bool cameraGamePadLerp; public static Vector2[] OffsetsNPCOffhand = new Vector2[5] { new Vector2(14f, 34f), new Vector2(14f, 32f), new Vector2(14f, 26f), new Vector2(14f, 22f), new Vector2(14f, 18f) }; public static Vector2[] OffsetsPlayerOffhand = new Vector2[20] { new Vector2(14f, 20f), new Vector2(14f, 20f), new Vector2(14f, 20f), new Vector2(14f, 18f), new Vector2(14f, 20f), new Vector2(16f, 4f), new Vector2(16f, 16f), new Vector2(18f, 14f), new Vector2(18f, 14f), new Vector2(18f, 14f), new Vector2(16f, 16f), new Vector2(16f, 16f), new Vector2(16f, 16f), new Vector2(16f, 16f), new Vector2(14f, 14f), new Vector2(14f, 14f), new Vector2(12f, 14f), new Vector2(14f, 16f), new Vector2(16f, 16f), new Vector2(16f, 16f) }; public static Vector2[] OffsetsPlayerOnhand = new Vector2[20] { new Vector2(6f, 19f), new Vector2(5f, 10f), new Vector2(12f, 10f), new Vector2(13f, 17f), new Vector2(12f, 19f), new Vector2(5f, 10f), new Vector2(7f, 17f), new Vector2(6f, 16f), new Vector2(6f, 16f), new Vector2(6f, 16f), new Vector2(6f, 17f), new Vector2(7f, 17f), new Vector2(7f, 17f), new Vector2(7f, 17f), new Vector2(8f, 17f), new Vector2(9f, 16f), new Vector2(9f, 12f), new Vector2(8f, 17f), new Vector2(7f, 17f), new Vector2(7f, 17f) }; public static Vector2[] OffsetsPlayerHeadgear = new Vector2[20] { new Vector2(0.0f, 2f), new Vector2(0.0f, 2f), new Vector2(0.0f, 2f), new Vector2(0.0f, 2f), new Vector2(0.0f, 2f), new Vector2(0.0f, 2f), new Vector2(0.0f, 2f), new Vector2(0.0f, 0.0f), new Vector2(0.0f, 0.0f), new Vector2(0.0f, 0.0f), new Vector2(0.0f, 2f), new Vector2(0.0f, 2f), new Vector2(0.0f, 2f), new Vector2(0.0f, 2f), new Vector2(0.0f, 0.0f), new Vector2(0.0f, 0.0f), new Vector2(0.0f, 0.0f), new Vector2(0.0f, 2f), new Vector2(0.0f, 2f), new Vector2(0.0f, 2f) }; public static Vector2 CurrentPan = Vector2.Zero; public static float sunCircle; public static int BlackFadeIn; public static bool noWindowBorder = false; public static RasterizerState Rasterizer = RasterizerState.CullCounterClockwise; private string _cachedTitle; public static int undergroundBackground; public static int oldUndergroundBackground; public static bool skipMenu = false; public static bool verboseNetplay = false; public static bool stopTimeOuts = false; public static bool showSpam = false; public static bool showItemOwner = false; public static bool[] townNPCCanSpawn = new bool[663]; public static int musicBox2 = -1; public static byte HealthBarDrawSettings = 1; public static bool runningCollectorsEdition; public static float wFrCounter; public static float wFrame; public static float upTimer; public static float upTimerMax; public static float upTimerMaxDelay; public static bool drawDiag; public static bool drawRelease; public static bool drawBetterDebug; public static bool betterDebugRelease; public static bool renderNow; public static bool drawToScreen; public static bool targetSet; public static int mouseX; public static int mouseY; public static int lastMouseX; public static int lastMouseY; private static ConcurrentQueue _mainThreadActions = new ConcurrentQueue(); public static bool mouseLeft; public static bool mouseRight; public static bool isMouseLeftConsumedByUI = false; public static float essScale = 1f; public static int essDir = -1; public static float[] cloudBGX = new float[2]; public static float cloudBGAlpha; public static float cloudBGActive; public static int[] cloudBG = new int[2]{ 112, 113 }; public static int[] treeMntBGSet1 = new int[2]; public static int[] treeMntBGSet2 = new int[2]; public static int[] treeMntBGSet3 = new int[2]; public static int[] treeMntBGSet4 = new int[2]; public static int[] treeBGSet1 = new int[3]; public static int[] treeBGSet2 = new int[3]; public static int[] treeBGSet3 = new int[3]; public static int[] treeBGSet4 = new int[3]; public static int[] corruptBG = new int[3]; public static int[] jungleBG = new int[3]; public static int[] snowMntBG = new int[2]; public static int[] snowBG = new int[3]; public static int[] hallowBG = new int[3]; public static int[] crimsonBG = new int[3]; public static int[] desertBG = new int[3]; public static int[] mushroomBG = new int[3]; public static int oceanBG; public static int[] underworldBG = new int[5]; public static int[] treeX = new int[4]; public static int[] treeStyle = new int[4]; public static int[] caveBackX = new int[4]; public static int[] caveBackStyle = new int[4]; public static int iceBackStyle; public static int hellBackStyle; public static int jungleBackStyle; public static string debugWords = ""; public static bool gamePad = false; public static bool xMas; public static bool halloween; public static bool forceXMasForToday; public static bool forceHalloweenForToday; public static bool DisableIntenseVisualEffects = false; public static int snowDust = 0; public static bool changeTheTitle; public static bool hairWindow; public static bool clothesWindow; public static bool ingameOptionsWindow = false; public static bool inFancyUI = false; public static int keyCount; public static string[] keyString = new string[10]; public static int[] keyInt = new int[10]; public static byte gFade; public static float gFader; public static byte gFadeDir = 1; public static bool shouldDrawNetDiagnosticsUI; public static INetDiagnosticsUI ActiveNetDiagnosticsUI = (INetDiagnosticsUI) new NetDiagnosticsUI(); public static IMultiplayerClosePlayersOverlay ActiveClosePlayersTeamOverlay = (IMultiplayerClosePlayersOverlay) new NewMultiplayerClosePlayersOverlay(); public static double UpdateTimeAccumulator; public static bool drawSkip; public static int fpsCount; public static Stopwatch fpsTimer = new Stopwatch(); public bool gammaTest; private const bool USE_ASYNC_LOAD = true; private static bool _isAsyncLoadComplete; public static bool showSplash = true; public static bool ignoreErrors = true; public static string defaultIP = ""; public static int dayRate = 1; public static int desiredWorldTilesUpdateRate = 1; public static int maxScreenW = 1920; public static int maxScreenH = 1200; public static int minScreenW = 800; public static int minScreenH = 600; public static float iS = 1f; public static bool render; public static int qaStyle; public static int buffScanAreaWidth = (Main.maxScreenW + 800) / 16 - 1; public static int buffScanAreaHeight = (Main.maxScreenH + 800) / 16 - 1; public static float musicPitch = 0.0f; public static bool[] projHostile = new bool[950]; public static bool[] projHook = new bool[950]; public static bool[] pvpBuff = new bool[323]; public static bool[] persistentBuff = new bool[323]; public static bool[] vanityPet = new bool[323]; public static bool[] lightPet = new bool[323]; public static bool[] meleeBuff = new bool[323]; public static bool[] debuff = new bool[323]; public static bool[] buffNoSave = new bool[323]; public static bool[] buffNoTimeDisplay = new bool[323]; public static bool[] buffDoubleApply = new bool[323]; public static int maxMP = 10; public static string[] recentWorld = new string[Main.maxMP]; public static string[] recentIP = new string[Main.maxMP]; public static int[] recentPort = new int[Main.maxMP]; public static bool shortRender = true; public static bool BackgroundEnabled = true; public static int instantBGTransitionCounter = 2; public static int bgDelay; public static int bgStyle; private const int BG_STYLES_COUNT = 14; public static float[] bgAlphaFrontLayer = new float[14]; public static float[] bgAlphaFarBackLayer = new float[14]; public static int[] bgFrame = new int[14]; public static int[] bgFrameCounter = new int[14]; public static int EquipPage; public static int EquipPageSelected; public int mouseNPCIndex = -1; public int mouseNPCType = -1; public static int wofNPCIndex = -1; public static int wofDrawAreaTop; public static int wofDrawAreaBottom; public static int wofDrawFrameIndex; public static int offScreenRange = 200; private RenderTarget2D backWaterTarget; public static RenderTarget2D waterTarget; private RenderTarget2D tileTarget; private RenderTarget2D blackTarget; private RenderTarget2D tile2Target; private RenderTarget2D wallTarget; private RenderTarget2D backgroundTarget; public static RenderTarget2D screenTarget; public static RenderTarget2D screenTargetSwap; public static int maxMapUpdates = 250000; public static bool refreshMap; public static int loadMapLastX; public static bool loadMapLock; public static bool loadMap; public static bool mapReady; public static int textureMaxWidth = 2000; public static int textureMaxHeight = 1800; public static bool updateMap; public static int mapMinX = 0; public static int mapMaxX = 0; public static int mapMinY; public static int mapMaxY; public static int mapTimeMax = 30; public static int mapTime = Main.mapTimeMax; public static bool clearMap; public static int mapTargetX = 5; public static int mapTargetY = 2; private RenderTarget2D[,] mapTarget = new RenderTarget2D[Main.mapTargetX, Main.mapTargetY]; private RenderTarget2D mapSectionTexture; public static bool[,] initMap = new bool[Main.mapTargetX, Main.mapTargetY]; public static bool[,] mapWasContentLost = new bool[Main.mapTargetX, Main.mapTargetY]; public const int numInfoIcons = 13; public static Microsoft.Xna.Framework.Color OurFavoriteColor = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, 231, 69); public static bool mapInit; public static bool mapEnabled = true; public static int mapStyle = 1; public static float grabMapX; public static float grabMapY; public static int miniMapX; public static int miniMapY; public static int miniMapWidth; public static int miniMapHeight; public static float mapMinimapDefaultScale = 1.05f; public static float mapMinimapScale = Main.mapMinimapDefaultScale; public static float mapMinimapAlpha = 1f; public static float mapOverlayScale = 2.5f; public static float mapOverlayAlpha = 0.35f; public static bool mapFullscreen; public static bool resetMapFull; public static float mapFullscreenScale = 4f; public static Vector2 mapFullscreenPos = new Vector2(-1f, -1f); private static bool IsEnginePreloaded; private static bool IsEngineLoaded; private static uint _gameUpdateCount; public static bool SkipAssemblyLoad; private int firstTileX; private int lastTileX; private int firstTileY; private int lastTileY; private double bgParallax; private int bgStartX; private int bgLoops; private int bgStartY; private int bgLoopsY; private int bgTopY; public static int renderCount = 99; private const int MF_BYPOSITION = 1024; public static GraphicsDeviceManager graphics; public static SpriteBatch spriteBatch; public static TileBatch tileBatch; public static BasicDebugDrawer DebugDrawer; public static SamplerState SamplerStateForCursor = SamplerState.LinearClamp; public static GenerationProgress AutogenProgress = new GenerationProgress(); private static Process tServer; private static Stopwatch saveTime = new Stopwatch(); public static KeyboardState keyState; public static KeyboardState oldKeyState; public static Microsoft.Xna.Framework.Color mcColor = new Microsoft.Xna.Framework.Color(1f, 0.6f, 0.0f); public static Microsoft.Xna.Framework.Color hcColor = new Microsoft.Xna.Framework.Color(1f, 0.15f, 0.1f); public static Microsoft.Xna.Framework.Color creativeModeColor = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.HotPink, Microsoft.Xna.Framework.Color.White, 0.1f); public static Microsoft.Xna.Framework.Color highVersionColor = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, 0); public static Microsoft.Xna.Framework.Color errorColor = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, 0, 0); public static bool craftingHide; public static bool armorHide; public static float craftingAlpha = 1f; public static float armorAlpha = 1f; public static float[] buffAlpha = new float[323]; public static bool hardMode; public float chestLootScale = 1f; public bool chestLootHover; public float chestStackScale = 1f; public bool chestStackHover; public float chestDepositScale = 1f; public bool chestDepositHover; public float chestRenameScale = 1f; public bool chestRenameHover; public float chestCancelScale = 1f; public bool chestCancelHover; public static Vector2 sceneWaterPos = Vector2.Zero; public static Vector2 sceneTilePos = Vector2.Zero; public static Vector2 sceneTile2Pos = Vector2.Zero; public static Vector2 sceneWallPos = Vector2.Zero; public static Vector2 sceneBackgroundPos = Vector2.Zero; public static bool maxQ = true; public static float gfxQuality = 1f; public static float gfxRate = 0.01f; public int DiscoStyle; public static int DiscoR = (int) byte.MaxValue; public static int DiscoB; public static int DiscoG; public static int teamCooldown; public static int teamCooldownLen = 300; public static bool gamePaused; public static bool gameInactive; public static int updatesCountedForFPS; public static int drawsCountedForFPS; public static int uCount; public static int updateRate; public static int frameRate; public static bool RGBRelease; public static bool qRelease = false; public static bool netRelease; public static bool frameRelease; public static bool showFrameRate = false; public static int magmaBGFrame; public static int magmaBGFrameCounter; public static int saveTimer = 0; public static bool autoJoin; public static bool serverStarting = false; public static float leftWorld = 0.0f; public static float rightWorld = 134400f; public static float topWorld = 0.0f; public static float bottomWorld = 38400f; public static int maxTilesX = (int) Main.rightWorld / 16 + 1; public static int maxTilesY = (int) Main.bottomWorld / 16 + 1; public const int sectionWidth = 200; public const int sectionHeight = 150; public static int maxSectionsX = Main.maxTilesX / 200; public static int maxSectionsY = Main.maxTilesY / 150; public const int maxDust = 6000; public static int maxDustToDraw = 6000; public const int maxCombatText = 100; public const int maxItemText = 20; public const int maxPlayers = 255; public static int maxNetPlayers = (int) byte.MaxValue; public const int maxChests = 8000; public const int maxItems = 400; public const int maxProjectiles = 1000; public const int maxNPCs = 200; private static UICharacterSelect _characterSelectMenu = new UICharacterSelect(); private static UIWorldSelect _worldSelectMenu = new UIWorldSelect(); public static UIManageControls ManageControlsMenu = new UIManageControls(); public static UIAchievementsMenu AchievementsMenu = new UIAchievementsMenu(); public static int maxRain = 750; public static int slimeWarningTime; public static int slimeWarningDelay = 420; public static float slimeRainNPCSlots = 0.65f; public static bool[] slimeRainNPC = new bool[663]; public static double slimeRainTime; public static bool slimeRain; public static int slimeRainKillCount; private const double slimeRainMaxTime = 54000.0; private const double slimeRainMinTime = 32400.0; private const double slimeRainMaxDelay = 604800.0; private const double slimeRainMinDelay = 302400.0; private const double slimeRainChance = 1728000.0; public const int maxGore = 600; public const int InventoryItemSlotsStart = 0; public const int InventoryItemSlotsCount = 50; public const int InventoryCoinSlotsStart = 50; public const int InventoryCoinSlotsCount = 4; public const int InventoryAmmoSlotsStart = 54; public const int InventoryAmmoSlotsCount = 4; public const int InventorySlotsTotal = 58; public int invBottom = 210; public const int maxLiquidTypes = 13; public static float cameraX; public static bool drewLava; public static float[] liquidAlpha = new float[13]; public static int waterStyle; public static int WorldRollingBackupsCountToKeep = 2; private static bool TOWMusicUnlocked = false; private static bool swapMusic = false; public static float caveParallax = 0.88f; public static int dungeonX; public static int dungeonY; public static Terraria.Liquid[] liquid = new Terraria.Liquid[Terraria.Liquid.maxLiquid]; public static LiquidBuffer[] liquidBuffer = new LiquidBuffer[50000]; public static bool dedServ; public static int spamCount = 0; public static int curMusic; public static int dayMusic; public static int ugMusic; public int newMusic; public static bool showItemText = true; public static bool autoSave = true; public static bool validateSaves = true; public static bool bannerMouseOver; public static string buffString = ""; public static string libPath = ""; public static int lo; public static int LogoA = (int) byte.MaxValue; public static int LogoB; public static bool LogoT; public static string statusText = ""; public static string worldName = ""; public static int worldID; public static int background; public static int caveBackground = 0; public static float ugBackTransition; public static Microsoft.Xna.Framework.Color tileColor; public static double worldSurface; public static double rockLayer; public static Microsoft.Xna.Framework.Color[] teamColor = new Microsoft.Xna.Framework.Color[6]; public const double dayLength = 54000.0; public const double nightLength = 32400.0; public static bool dayTime = true; public static double time = 13500.0; public static double timeForVisualEffects; public static int moonPhase; public static short sunModY; public static short moonModY; public static bool alreadyGrabbingSunOrMoon; public static bool bloodMoon; public static bool pumpkinMoon; public static bool snowMoon; public static float cloudAlpha; public static float maxRaining; public static float oldMaxRaining; public static int rainTime; public static bool raining; public static bool eclipse; public static float eclipseLight; public static int checkForSpawns; public static int helpText; public static int BartenderHelpTextIndex = 0; public static bool autoGen; public static bool autoPause = false; public static int[] projFrames = new int[950]; public static bool[] projPet = new bool[950]; public static float demonTorch = 1f; public static int demonTorchDir = 1; public static float martianLight = 1f; public static int martianLightDir = 1; public static float masterColor = 1f; public static int masterColorDir = 1; public static bool placementPreview = true; public static SceneMetrics SceneMetrics; public const int maxStars = 400; public static int numStars; public const int maxStarTypes = 4; public const int maxClouds = 200; public const int maxCloudTypes = 37; public static int weatherCounter; public static int numClouds = 200; public static int numCloudsTemp = Main.numClouds; public static float windSpeedCurrent; public static float windSpeedTarget; public static int windCounter; public static int extremeWindCounter; public static bool windPhysics = false; public static float windPhysicsStrength = 0.1f; public static bool SettingsEnabled_TilesSwayInWind = true; public static Cloud[] cloud = new Cloud[200]; public static bool resetClouds = true; public static float SmoothedMushroomLightInfluence; public static int fadeCounter; public static float invAlpha = 1f; public static float invDir = 1f; [ThreadStatic] public static UnifiedRandom rand; public static bool allChestStackHover; public static bool inventorySortMouseOver; public static float GraveyardVisualIntensity; public const int maxMoons = 9; public static int moonType = 0; public const int numTileColors = 32; public const int numTreeStyles = 31; public const int numberOfHairstyles = 162; public const int maxHairStyles = 162; public const int maxCharSelectHair = 51; public const int maxHairOfStylistDefault = 123; public static bool UseExperimentalFeatures; public static string DefaultSeed = ""; public static AudioEngine engine; public static SoundBank soundBank; public static WaveBank waveBank; public static Cue[] music = new Cue[89]; public static bool[] musicNoCrossFade = new bool[89]; public static float[] musicFade = new float[89]; public static float musicVolume = 1f; public static float ambientVolume = 1f; public static float soundVolume = 1f; public static ServerMode MenuServerMode = ServerMode.Lobby | ServerMode.FriendsCanJoin; public static bool[] tileLighted = new bool[623]; public static bool[] tileMergeDirt = new bool[623]; public static bool[] tileCut = new bool[623]; public static bool[] tileAlch = new bool[623]; public static int[] tileShine = new int[623]; public static bool[] tileShine2 = new bool[623]; public static bool[] wallHouse = new bool[316]; public static bool[] wallDungeon = new bool[316]; public static bool[] wallLight = new bool[316]; public static int[] wallBlend = new int[316]; public static bool[] tileStone = new bool[623]; public static bool[] tileAxe = new bool[623]; public static bool[] tileHammer = new bool[623]; public static bool[] tileWaterDeath = new bool[623]; public static bool[] tileLavaDeath = new bool[623]; public static bool[] tileTable = new bool[623]; public static bool[] tileBlockLight = new bool[623]; public static bool[] tileNoSunLight = new bool[623]; public static bool[] tileDungeon = new bool[623]; public static bool[] tileSpelunker = new bool[623]; public static bool[] tileSolidTop = new bool[623]; public static bool[] tileSolid = new bool[623]; public static bool[] tileBouncy = new bool[623]; public static short[] tileOreFinderPriority = new short[623]; public static byte[] tileLargeFrames = new byte[623]; public static byte[] wallLargeFrames = new byte[316]; public static bool[] tileRope = new bool[623]; public static bool[] tileBrick = new bool[623]; public static bool[] tileMoss = new bool[623]; public static bool[] tileNoAttach = new bool[623]; public static bool[] tileNoFail = new bool[623]; public static bool[] tileCracked = new bool[623]; public static bool[] tileObsidianKill = new bool[623]; public static bool[] tileFrameImportant = new bool[623]; public static bool[] tilePile = new bool[623]; public static bool[] tileBlendAll = new bool[623]; public static short[] tileGlowMask = new short[623]; public static bool[] tileContainer = new bool[623]; public static bool[] tileSign = new bool[623]; public static bool[][] tileMerge = new bool[623][]; public static int cageFrames = 25; public static bool critterCage; public static int[] bunnyCageFrame = new int[Main.cageFrames]; public static int[] bunnyCageFrameCounter = new int[Main.cageFrames]; public static int[] squirrelCageFrame = new int[Main.cageFrames]; public static int[] squirrelCageFrameCounter = new int[Main.cageFrames]; public static int[] squirrelCageFrameOrange = new int[Main.cageFrames]; public static int[] squirrelCageFrameCounterOrange = new int[Main.cageFrames]; public static int[] mallardCageFrame = new int[Main.cageFrames]; public static int[] mallardCageFrameCounter = new int[Main.cageFrames]; public static int[] duckCageFrame = new int[Main.cageFrames]; public static int[] duckCageFrameCounter = new int[Main.cageFrames]; public static int[] grebeCageFrame = new int[Main.cageFrames]; public static int[] grebeCageFrameCounter = new int[Main.cageFrames]; public static int[] seagullCageFrame = new int[Main.cageFrames]; public static int[] seagullCageFrameCounter = new int[Main.cageFrames]; public static int[] birdCageFrame = new int[Main.cageFrames]; public static int[] birdCageFrameCounter = new int[Main.cageFrames]; public static int[] redBirdCageFrame = new int[Main.cageFrames]; public static int[] redBirdCageFrameCounter = new int[Main.cageFrames]; public static int[] blueBirdCageFrame = new int[Main.cageFrames]; public static int[] blueBirdCageFrameCounter = new int[Main.cageFrames]; public static byte[,] butterflyCageMode = new byte[9, Main.cageFrames]; public static int[,] butterflyCageFrame = new int[9, Main.cageFrames]; public static int[,] butterflyCageFrameCounter = new int[9, Main.cageFrames]; public static int[,] dragonflyJarFrameCounter = new int[7, Main.cageFrames]; public static int[,] dragonflyJarFrame = new int[7, Main.cageFrames]; public static int[,] scorpionCageFrame = new int[2, Main.cageFrames]; public static int[,] scorpionCageFrameCounter = new int[2, Main.cageFrames]; public static int[] snailCageFrame = new int[Main.cageFrames]; public static int[] snailCageFrameCounter = new int[Main.cageFrames]; public static int[] snail2CageFrame = new int[Main.cageFrames]; public static int[] snail2CageFrameCounter = new int[Main.cageFrames]; public static byte[] fishBowlFrameMode = new byte[Main.cageFrames]; public static int[] fishBowlFrame = new int[Main.cageFrames]; public static int[] fishBowlFrameCounter = new int[Main.cageFrames]; public static int[] lavaFishBowlFrame = new int[Main.cageFrames]; public static int[] lavaFishBowlFrameCounter = new int[Main.cageFrames]; public static int[] frogCageFrame = new int[Main.cageFrames]; public static int[] frogCageFrameCounter = new int[Main.cageFrames]; public static int[] mouseCageFrame = new int[Main.cageFrames]; public static int[] mouseCageFrameCounter = new int[Main.cageFrames]; public static int[] turtleCageFrame = new int[Main.cageFrames]; public static int[] turtleCageFrameCounter = new int[Main.cageFrames]; public static int[] fairyJarFrame = new int[Main.cageFrames]; public static int[] fairyJarFrameCounter = new int[Main.cageFrames]; public static byte[,] jellyfishCageMode = new byte[3, Main.cageFrames]; public static int[,] jellyfishCageFrame = new int[3, Main.cageFrames]; public static int[,] jellyfishCageFrameCounter = new int[3, Main.cageFrames]; public static int[] wormCageFrame = new int[Main.cageFrames]; public static int[] wormCageFrameCounter = new int[Main.cageFrames]; public static int[] maggotCageFrame = new int[Main.cageFrames]; public static int[] maggotCageFrameCounter = new int[Main.cageFrames]; public static int[] ratCageFrame = new int[Main.cageFrames]; public static int[] ratCageFrameCounter = new int[Main.cageFrames]; public static int[] ladybugCageFrame = new int[Main.cageFrames]; public static int[] ladybugCageFrameCounter = new int[Main.cageFrames]; public static int[] penguinCageFrame = new int[Main.cageFrames]; public static int[] penguinCageFrameCounter = new int[Main.cageFrames]; public static int[] waterStriderCageFrame = new int[Main.cageFrames]; public static int[] waterStriderCageFrameCounter = new int[Main.cageFrames]; public static int[] seahorseCageFrame = new int[Main.cageFrames]; public static int[] seahorseCageFrameCounter = new int[Main.cageFrames]; public static int[,] slugCageFrame = new int[3, Main.cageFrames]; public static int[,] slugCageFrameCounter = new int[3, Main.cageFrames]; public static int[] owlCageFrame = new int[Main.cageFrames]; public static int[] owlCageFrameCounter = new int[Main.cageFrames]; public static int[] grasshopperCageFrame = new int[Main.cageFrames]; public static int[] grasshopperCageFrameCounter = new int[Main.cageFrames]; public static bool[] tileSand = new bool[623]; public static bool[] tileFlame = new bool[623]; public static bool[] npcCatchable = new bool[663]; public static int[] tileFrame = new int[623]; public static int[] tileFrameCounter = new int[623]; public static byte[] wallFrame = new byte[316]; public static byte[] wallFrameCounter = new byte[316]; public static int[] backgroundWidth = new int[298]; public static int[] backgroundHeight = new int[298]; public static HairstyleUnlocksHelper Hairstyles = new HairstyleUnlocksHelper(); public static bool tilesLoaded = false; public static WorldMap Map = new WorldMap(Main.maxTilesX, Main.maxTilesY); public static Tile[,] tile = new Tile[Main.maxTilesX, Main.maxTilesY]; public static Dust[] dust = new Dust[6001]; public static Star[] star = new Star[400]; public static Item[] item = new Item[401]; public static int[] timeItemSlotCannotBeReusedFor = new int[401]; public static NPC[] npc = new NPC[201]; public static Gore[] gore = new Gore[601]; public static Rain[] rain = new Rain[Main.maxRain + 1]; public static Projectile[] projectile = new Projectile[1001]; public static int[,] projectileIdentity = new int[256, 1001]; public static CombatText[] combatText = new CombatText[100]; public static PopupText[] popupText = new PopupText[20]; public static Chest[] chest = new Chest[8000]; public static Sign[] sign = new Sign[1000]; public static int[] itemFrame = new int[401]; public static int[] itemFrameCounter = new int[401]; public static DrawAnimation[] itemAnimations = new DrawAnimation[5045]; private static DrawAnimation _coinOnWorldAnimation = (DrawAnimation) new DrawAnimationVertical(6, 8); private static DrawAnimation _monkStaffT3OnWorldAnimation = (DrawAnimation) new DrawAnimationVertical(5, 3); public static List itemAnimationsRegistered = new List(); public static Vector2 screenPosition; public static Vector2 screenLastPosition; public static int screenWidth = 1152; public static int screenHeight = 864; public static bool screenMaximized = true; public static bool screenBorderless = true; public static int screenBorderlessPendingResizes; public static int teamNamePlateDistance = 2000; public static int multiplayerNPCSmoothingRange = 300; public static bool Setting_UseReducedMaxLiquids = false; public static int PlayerOverheadChatMessageDisplayTime = 400; public static object CurrentInputTextTakerOverride; public static bool drawingPlayerChat; public static bool chatRelease; public static string chatText = ""; public static bool inputTextEnter; public static bool inputTextEscape; 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 }; public static byte mouseTextColor; public static int mouseTextColorChange = 1; public static bool mouseLeftRelease; public static bool mouseRightRelease; public static bool playerInventory; public static int stackSplit; public static bool preventStackSplitReset; public static int stackCounter; public static int stackDelay = 7; public static int superFastStack; public static Item mouseItem = new Item(); public static Item guideItem = new Item(); public static Item reforgeItem = new Item(); public static float inventoryScale = 0.75f; public static bool hasFocus; public static Microsoft.Xna.Framework.Point rulerLineDisplayValues = new Microsoft.Xna.Framework.Point(); public static bool recFastScroll; public static bool recBigList; public static int recStart; public static Recipe[] recipe = new Recipe[Recipe.maxRecipes]; public static int[] availableRecipe = new int[Recipe.maxRecipes]; public static float[] availableRecipeY = new float[Recipe.maxRecipes]; public static int numAvailableRecipes; public static int focusRecipe; public static int myPlayer; public static Player[] player = new Player[256]; public static Player[] playerVisualClone = new Player[256]; public static bool[] countsAsHostForGameplay = new bool[256]; public static int spawnTileX; public static int spawnTileY; public static bool npcChatRelease; public static bool editSign; public static bool editChest; public static bool blockInput = false; public static string blockKey = Microsoft.Xna.Framework.Input.Keys.None.ToString(); public static string defaultChestName = string.Empty; public static string npcChatText = ""; public static bool npcChatFocus1; public static bool npcChatFocus2; public static bool npcChatFocus3; public static bool npcChatFocus4; public static int oldNPCShop; public static int npcChatCornerItem; public Chest[] shop = new Chest[100]; public static ItemShopSellbackHelper shopSellbackHelper = new ItemShopSellbackHelper(); public static int[] travelShop = new int[40]; public static List anglerWhoFinishedToday = new List(); public static bool anglerQuestFinished; public static int anglerQuest; public static int[] anglerQuestItemNetIDs = new int[41] { 2450, 2451, 2452, 2453, 2454, 2455, 2456, 2457, 2458, 2459, 2460, 2461, 2462, 2463, 2464, 2465, 2466, 2467, 2468, 2469, 2470, 2471, 2472, 2473, 2474, 2475, 2476, 2477, 2478, 2479, 2480, 2481, 2482, 2483, 2484, 2485, 2486, 2487, 2488, 4393, 4394 }; public static AmbienceServer AmbienceServer; public static ItemDropDatabase ItemDropsDB; public static BestiaryDatabase BestiaryDB; public static ItemDropResolver ItemDropSolver; public static BestiaryUnlocksTracker BestiaryTracker; public static UIBestiaryTest BestiaryUI; public static TeleportPylonsSystem PylonSystem; public static ShopHelper ShopHelper; public static GolfState LocalGolfState = new GolfState(); public static bool Support4K = true; public static float MinimumZoomComparerX = 1920f; public static float MinimumZoomComparerY = 1200f; private static int _renderTargetMaxSize = 2048; private static GraphicsProfile _selectedGraphicsProfile = GraphicsProfile.Reach; private static GraphicsProfile _currentGraphicsProfile = GraphicsProfile.Reach; public static int LogicCheckScreenWidth = 1920; public static int LogicCheckScreenHeight = 1200; private static Main.WorldPreparationState _worldPreparationState = Main.WorldPreparationState.AwaitingData; public static float temporaryGUIScaleSlider = -1f; public static bool temporaryGUIScaleSliderUpdate = false; public static bool InGuideCraftMenu; public static bool InReforgeMenu; public static Item HoverItem = new Item(); private static int backSpaceCount; private static float backSpaceRate; public static string motd = ""; public static bool toggleFullscreen; public static int numDisplayModes; public static int[] displayWidth = new int[99]; public static int[] displayHeight = new int[99]; public static bool gameMenu = true; public static bool menuBGChangedDay = false; public static bool menuBGChangedNight = false; public static bool lockMenuBGChange = false; private static int maxLoadPlayer = 1000; private static int maxLoadWorld = 1000; public static List PlayerList = new List(); public static PlayerFileData ActivePlayerFileData = new PlayerFileData(); public static Player PendingPlayer = (Player) null; public static List WorldList = new List(); public static WorldFileData ActiveWorldFileData = new WorldFileData(); public static string WorldPath = Path.Combine(Main.SavePath, "Worlds"); public static string CloudWorldPath = "worlds"; public static string PlayerPath = Path.Combine(Main.SavePath, "Players"); public static string CloudPlayerPath = "players"; public static Preferences Configuration = new Preferences(Main.SavePath + Path.DirectorySeparatorChar.ToString() + "config.json"); public static Preferences InputProfiles = new Preferences(Main.SavePath + Path.DirectorySeparatorChar.ToString() + "input profiles.json"); public static KeyboardState inputText; public static KeyboardState oldInputText; public static int PendingResolutionWidth = 800; public static int PendingResolutionHeight = 600; public static bool PendingBorderlessState; public static int invasionType; public static double invasionX; public static int invasionSize; public static int invasionDelay; public static int invasionWarn; public static int invasionSizeStart; public static bool invasionProgressNearInvasion; public static int invasionProgressMode = 2; public static int invasionProgressIcon; public static int invasionProgress; public static int invasionProgressMax; public static int invasionProgressWave; public static int invasionProgressDisplayLeft; public static float invasionProgressAlpha; public static bool HasInteractibleObjectThatIsNotATile = false; public int currentNPCShowingChatBubble = -1; public static int[] npcFrameCount = new int[663] { 1, 2, 2, 3, 6, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 25, 23, 25, 21, 15, 26, 2, 10, 1, 16, 16, 16, 3, 1, 15, 3, 1, 3, 1, 1, 21, 25, 1, 1, 1, 3, 3, 15, 3, 7, 7, 6, 5, 6, 5, 3, 3, 23, 6, 3, 6, 6, 2, 5, 6, 5, 7, 7, 4, 5, 8, 1, 5, 1, 2, 4, 16, 5, 4, 4, 15, 16, 16, 16, 2, 4, 6, 6, 18, 16, 1, 1, 1, 1, 1, 1, 4, 3, 1, 1, 1, 1, 1, 1, 5, 6, 7, 16, 1, 1, 25, 23, 12, 20, 21, 1, 2, 2, 3, 6, 1, 1, 1, 15, 4, 11, 1, 23, 6, 6, 3, 1, 2, 2, 1, 3, 4, 1, 2, 1, 4, 2, 1, 15, 3, 25, 4, 5, 7, 3, 2, 12, 12, 4, 4, 4, 8, 8, 13, 5, 6, 4, 15, 23, 3, 15, 8, 5, 4, 13, 15, 12, 4, 14, 14, 3, 2, 5, 3, 2, 3, 23, 5, 14, 16, 5, 2, 2, 12, 3, 3, 3, 3, 2, 2, 2, 2, 2, 7, 14, 15, 16, 8, 3, 15, 15, 16, 2, 3, 20, 25, 23, 26, 4, 4, 16, 16, 20, 20, 20, 2, 2, 2, 2, 8, 12, 3, 4, 2, 4, 25, 26, 26, 6, 3, 3, 3, 3, 3, 3, 4, 4, 5, 4, 6, 7, 15, 4, 7, 6, 1, 1, 2, 4, 3, 5, 3, 3, 3, 4, 5, 6, 4, 2, 1, 8, 4, 4, 1, 8, 1, 4, 15, 15, 15, 15, 15, 15, 16, 15, 15, 15, 15, 15, 3, 3, 3, 3, 3, 3, 16, 3, 6, 12, 21, 21, 20, 16, 15, 15, 5, 5, 6, 6, 5, 2, 7, 2, 6, 6, 6, 6, 6, 15, 15, 15, 15, 15, 11, 4, 2, 2, 3, 3, 3, 16, 15, 16, 10, 14, 12, 1, 10, 8, 3, 3, 2, 2, 2, 2, 7, 15, 15, 15, 6, 3, 10, 10, 6, 9, 8, 9, 8, 20, 10, 6, 23, 1, 4, 24, 2, 4, 6, 6, 13, 15, 15, 15, 15, 4, 4, 26, 23, 8, 2, 4, 4, 4, 4, 2, 2, 4, 12, 12, 9, 9, 9, 1, 9, 11, 2, 2, 9, 5, 6, 4, 18, 8, 11, 1, 4, 5, 8, 4, 1, 1, 1, 1, 4, 2, 5, 4, 11, 5, 11, 1, 1, 1, 10, 10, 15, 8, 17, 6, 6, 1, 12, 12, 13, 15, 9, 5, 10, 7, 7, 7, 7, 7, 7, 7, 4, 4, 16, 16, 25, 5, 7, 3, 13, 2, 6, 2, 19, 19, 19, 20, 26, 3, 1, 1, 1, 1, 1, 16, 21, 9, 16, 7, 6, 18, 13, 20, 12, 12, 20, 6, 14, 14, 14, 14, 6, 1, 3, 25, 19, 20, 22, 2, 4, 4, 4, 11, 9, 8, 1, 9, 1, 8, 8, 12, 12, 11, 11, 11, 11, 11, 11, 11, 11, 11, 1, 6, 9, 1, 1, 1, 1, 1, 1, 4, 1, 10, 1, 8, 4, 1, 5, 8, 8, 8, 8, 9, 9, 5, 4, 8, 16, 8, 2, 3, 3, 6, 6, 7, 13, 4, 4, 4, 4, 1, 1, 1, 8, 25, 11, 14, 14, 14, 17, 17, 17, 5, 5, 5, 14, 14, 14, 9, 9, 9, 9, 17, 17, 16, 16, 18, 18, 10, 10, 10, 10, 4, 1, 6, 9, 6, 4, 4, 4, 14, 4, 25, 13, 3, 7, 6, 6, 1, 4, 4, 4, 4, 4, 4, 4, 15, 15, 8, 8, 2, 6, 15, 15, 6, 13, 5, 5, 7, 5, 14, 14, 4, 6, 21, 1, 1, 1, 11, 12, 6, 6, 17, 6, 16, 21, 16, 23, 5, 16, 2, 28, 28, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 3, 4, 6, 27, 16, 2, 2, 4, 3, 4 }; public static Dictionary npcLifeBytes = new Dictionary(); public static bool mouseExit; public static float exitScale = 0.8f; public static bool mouseReforge; public static float reforgeScale = 0.8f; public static Player clientPlayer = new Player(); public static string getIP = Main.defaultIP; public static string getPort = Convert.ToString(Netplay.ListenPort); public static bool menuMultiplayer; public static bool menuServer; public static int netMode; private static int _targetNetMode; private static bool _hasPendingNetmodeChange; public const int MaxTimeout = 120; public static int netPlayCounter; public static int lastNPCUpdate; public static int lastItemUpdate; public static int maxNPCUpdates = 5; public static int maxItemUpdates = 5; public static string cUp = "W"; public static string cLeft = "A"; public static string cDown = "S"; public static string cRight = "D"; public static string cJump = "Space"; public static string cThrowItem = "T"; public static string cHeal = "H"; public static string cMana = "J"; public static string cBuff = "B"; public static string cHook = "E"; public static string cTorch = "LeftShift"; public static string cInv = "Escape"; public static string cSmart = "LeftControl"; public static string cMount = "R"; public static string cFavoriteKey = "LeftAlt"; public static bool cSmartCursorModeIsToggleAndNotHold = true; public static bool SmartCursorEnabled = false; public static bool SmartCursorShowing = false; public static int SmartCursorX; public static int SmartCursorY; public static bool SmartInteractShowingGenuine; public static bool SmartInteractShowingFake; public static int SmartInteractX; public static int SmartInteractY; public static int SmartInteractNPC; public static int SmartInteractProj; public static bool SmartInteractPotionOfReturn; public static List SmartInteractTileCoords = new List(); public static List SmartInteractTileCoordsSelected = new List(); public static int TileInteractionLX = -1; public static int TileInteractionLY = -1; public static int TileInteractionHX = -1; public static int TileInteractionHY = -1; public static int cursorOverride = -1; public static int signHover = -1; public static string cMapZoomIn = "Add"; public static string cMapZoomOut = "Subtract"; public static string cMapAlphaUp = "PageUp"; public static string cMapAlphaDown = "PageDown"; public static string cMapFull = "M"; public static string cMapStyle = "Tab"; public static Microsoft.Xna.Framework.Input.Keys FavoriteKey = Microsoft.Xna.Framework.Input.Keys.LeftAlt; public static ColorSlidersSet mouseColorSlider = new ColorSlidersSet(); public static ColorSlidersSet mouseBorderColorSlider = new ColorSlidersSet(); public static Microsoft.Xna.Framework.Color mouseColor = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, 50, 95); public static Microsoft.Xna.Framework.Color cursorColor = Microsoft.Xna.Framework.Color.White; public static int cursorColorDirection = 1; public static float cursorAlpha; public static float cursorScale; public static bool signBubble; public static int signX = 0; public static int signY = 0; public static bool hideUI; public static bool releaseUI; public static int FrameSkipMode = 2; public static bool terrariasFixedTiming = true; private int splashCounter; public List DrawCacheNPCsMoonMoon = new List(200); public List DrawCacheNPCsOverPlayers = new List(200); public List DrawCacheNPCProjectiles = new List(200); public List DrawCacheNPCsBehindNonSolidTiles = new List(200); public List DrawCacheProjsBehindNPCsAndTiles = new List(1000); public List DrawCacheProjsBehindNPCs = new List(1000); public List DrawCacheProjsBehindProjectiles = new List(1000); public List DrawCacheProjsOverWiresUI = new List(1000); public List DrawCacheProjsOverPlayers = new List(1000); public List DrawCacheFirstFractals = new List(1000); public static ParticleRenderer ParticleSystem_World_OverPlayers = new ParticleRenderer(); public static ParticleRenderer ParticleSystem_World_BehindPlayers = new ParticleRenderer(); private static WindowStateController _windowMover; public static AnchoredEntitiesCollection sittingManager; public static AnchoredEntitiesCollection sleepingManager; private static bool shouldSetDefaultUIScale = true; private static float newDefaultUIScale = 0.0f; private static bool startFullscreen = false; public static string oldStatusText = ""; public static string autoGenFileLocation = (string) null; public static bool autoShutdown; private uint previousExecutionState; public static int sundialCooldown; public static bool fastForwardTime; private static Stopwatch splashTimer = new Stopwatch(); private IEnumerator _gameContentLoadProcess; private int _musicReplayDelay; public static bool _shouldUseWindyDayMusic = false; public static bool _shouldUseStormMusic = false; private int lastMusicPlayed = -1; private bool playOldTile; private static float _minWind = 0.34f; private static float _maxWind = 0.4f; private static float _minRain = 0.4f; private static float _maxRain = 0.5f; public static float ambientWaterfallX = -1f; public static float ambientWaterfallY = -1f; public static float ambientWaterfallStrength = 0.0f; public static float ambientLavafallX = -1f; public static float ambientLavafallY = -1f; public static float ambientLavafallStrength = 0.0f; public static float ambientLavaX = -1f; public static float ambientLavaY = -1f; public static float ambientLavaStrength; public static int ambientCounter; private static bool _isWaterfallMusicPlaying = false; private static bool _isLavafallMusicPlaying = false; public static IChatMonitor chatMonitor = (IChatMonitor) new RemadeChatMonitor(); public static int ProjectileUpdateLoopIndex = -1; public static GameTipsDisplay gameTips; private Stopwatch _worldUpdateTimeTester = new Stopwatch(); public SpelunkerProjectileHelper SpelunkerProjectileHelper = new SpelunkerProjectileHelper(); public ChumBucketProjectileHelper ChumBucketProjectileHelper = new ChumBucketProjectileHelper(); public static int weatherVaneBobframe = 0; private float logoRotation; private float logoRotationDirection = -1f; private float logoRotationSpeed = 1f; private float logoScale = 1f; private float logoScaleDirection = 1f; private float logoScaleSpeed = 1f; private static int maxMenuItems = 16; private float[] menuItemScale = new float[Main.maxMenuItems]; private int focusMenu = -1; private int selectedMenu = -1; private int selectedMenu2 = -1; public static int selectedPlayer = 0; public static int selectedWorld; public static int menuMode; public static int menuSkip; private static bool _needsLanguageSelect = true; private static Item tooltipPrefixComparisonItem = new Item(); private Main.MouseTextCache _mouseTextCache; public int textBlinkerCount; public int textBlinkerState; public static string newWorldName = ""; private static int[] specX = new int[1000]; private static int[] specY = new int[1000]; public TilePaintSystemV2 TilePaintSystem; public TileDrawing TilesRenderer; public WallDrawing WallsRenderer; private AmbientWindSystem _ambientWindSys = new AmbientWindSystem(); private List _playersThatDrawBehindNPCs = new List((int) byte.MaxValue); private List _playersThatDrawAfterProjectiles = new List((int) byte.MaxValue); private List _voidLensData = new List(); private List _voidLensDataSillouette = new List(); private List _voidLensDataSillouette2 = new List(); private Main.TextDisplayCache _textDisplayCache = new Main.TextDisplayCache(); private List _occupantsListToDrawNPCHouses = new List(); private List _npcsWithBannersToDraw = new List(); private bool _imeToggle; private List _npcTypesThatAlreadyDrewAHead = new List(); private int[] _npcIndexWhoHoldsHeadIndex = new int[45]; private static List _requiredObjecsForCraftingText = new List(); private static bool _preventCraftingBecauseClickWasUsedToChangeFocusedRecipe; private static int _currentRecipeBeingCrafted = -1; private static bool hidePVPIcons = false; public static bool HoveringOverAnNPC; public static string hoverItemName = ""; public static Microsoft.Xna.Framework.Color inventoryBack = new Microsoft.Xna.Framework.Color(220, 220, 220, 220); public static bool mouseText; private static int mH; private static int rare; public static int hairStart; private static int oldHairStyle; private static Microsoft.Xna.Framework.Color oldHairColor; public static int selClothes; private static Microsoft.Xna.Framework.Color[] oldClothesColor = new Microsoft.Xna.Framework.Color[6]; private static int oldClothesStyle; public static int interactedDresserTopLeftX; public static int interactedDresserTopLeftY; public static Player dresserInterfaceDummy; private bool _needToSetupDrawInterfaceLayers = true; private List _gameInterfaceLayers; private static GameTime _drawInterfaceGameTime; private static bool _settingsButtonIsPushedToSide; private static bool _MouseOversCanClear; private static Vector2 _itemIconCacheScreenPosition; private static int _itemIconCacheSelectedItemID; private static int _itemIconCacheTime; private static bool _cannotDrawAccessoriesHorizontally = false; public static Microsoft.Xna.Framework.Color selColor = Microsoft.Xna.Framework.Color.White; public static int focusColor; public static int colorDelay; public static int setKey = -1; public static int bgScroll; public static bool autoPass; public static int menuFocus = 0; public static float hBar = -1f; public static float sBar = -1f; public static float lBar = 1f; public static float aBar = 1f; private int grabColorSlider; public static bool blockMouse; private static bool _blockFancyUIWhileLoading; private bool[] menuWide = new bool[100]; public static float GamepadCursorAlpha = 0.0f; private bool _needsMenuUIRecalculation; public static float MenuXMovement = 0.0f; private float _splashFrameCount; private bool quickSplash; private float hellBlackBoxBottom; public static float MapScale = 1f; private static int _minimapTopRightAnchorOffsetTowardsLeft = 52; private static int _minimapTopRightAnchorOffsetTowardsBottom = 90; public static bool cancelWormHole = false; private static VertexColors _glowPaintColors = new VertexColors(Microsoft.Xna.Framework.Color.White); protected List> DrawWiresSpecialTiles = new List>(); public static float lightning; private static float lightningDecay = 1f; private static float lightningSpeed = 0.0f; private static int thunderDelay; public static int thunderDistance; private static string[] MonolithFilterNames = new string[5] { "MonolithVortex", "MonolithNebula", "MonolithStardust", "MonolithSolar", "MonolithMoonLord" }; private static string[] MonolithSkyNames = new string[5] { "MonolithVortex", "MonolithNebula", "MonolithStardust", "MonolithSolar", "MonolithMoonLord" }; private static float backgroundLayerTransitionSpeed = 0.05f; public static float atmo; private static float bgScale = 1f; private static int bgWidthScaled = (int) (1024.0 * (double) Main.bgScale); public static Microsoft.Xna.Framework.Color ColorOfTheSkies; private static Microsoft.Xna.Framework.Color ColorOfSurfaceBackgroundsBase = Microsoft.Xna.Framework.Color.White; private static Microsoft.Xna.Framework.Color ColorOfSurfaceBackgroundsModified = Microsoft.Xna.Framework.Color.White; private float screenOff; private float scAdj; private float cTop; private bool _isDrawingOrUpdating; public static List ContentThatNeedsRenderTargets = new List(); private static string _oldNetplayStatusText; private static TextSnippet[] _netplayStatusTextSnippets; public static int ladyBugRainBoost = 0; private static bool _canShowMeteorFall; public static Vector2 ViewPosition => Main.screenPosition + Main.GameViewMatrix.Translation; public static Vector2 ViewSize => new Vector2((float) Main.screenWidth, (float) Main.screenHeight) / Main.GameViewMatrix.Zoom; public static Matrix CurrentWantedZoomMatrix => Main._currentWantedZoomMatrix; public static void SetRecommendedZoomContext(Matrix matrix) => Main._currentWantedZoomMatrix = matrix; public static Matrix UIScaleMatrix => Main._uiScaleMatrix; public static float UIScaleWanted => Main._uiScaleWanted; public static float UIScale { get => Main._uiScaleUsed; set { Main._uiScaleWanted = value; float uiScaleMax = Main.instance.UIScaleMax; if ((double) value > (double) uiScaleMax) value = uiScaleMax; Main._uiScaleUsed = value; Main._uiScaleMatrix = Matrix.CreateScale(value, value, 1f); } } public float UIScaleMax => Math.Max(1f, Math.Min((float) PlayerInput.RealScreenWidth / 800f, (float) PlayerInput.RealScreenHeight / 600f)); public static bool RenderTargetsRequired => (double) Main.GameZoomTarget > 1.0 || (double) Main.GameViewMatrix.TransformationMatrix.M11 > 1.0; public static bool IsItRaining => (double) Main.cloudAlpha > 0.0; public static bool ThickMouse => Main.MouseBorderColor != Microsoft.Xna.Framework.Color.Transparent; public static bool GamepadDisableCursorItemIcon => PlayerInput.UsingGamepad && Main.GamepadDisableCursorItemIconInner; public static void FindAnnouncementBoxStatus() { Main.AnnouncementBoxDisabled = Program.LaunchParameters.ContainsKey("-disableannouncementbox"); string s; int result; if (!Program.LaunchParameters.TryGetValue("-announcementboxrange", out s) || !int.TryParse(s, out result)) return; Main.AnnouncementBoxRange = result; } public static GameModeData GameModeInfo => Main._currentGameModeInfo; public static int GameMode { get => Main.ActiveWorldFileData == null ? 0 : Main.ActiveWorldFileData.GameMode; set { GameModeData gameModeData; if (Main.ActiveWorldFileData == null || !Main.RegisterdGameModes.TryGetValue(value, out gameModeData)) return; Main.ActiveWorldFileData.GameMode = value; Main._currentGameModeInfo = gameModeData; } } public static bool masterMode { get { if (Main.ActiveWorldFileData == null) return false; return Main._overrideForMasterMode.HasValue ? Main._overrideForMasterMode.Value : Main._currentGameModeInfo.IsMasterMode; } } public static bool expertMode { get { if (Main.ActiveWorldFileData == null) return false; return Main._overrideForExpertMode.HasValue ? Main._overrideForExpertMode.Value : Main._currentGameModeInfo.IsExpertMode; } } public static AchievementManager Achievements => Main.instance._achievements; public static AchievementAdvisor AchievementAdvisor => Main.instance._achievementAdvisor; public static ulong UnpausedUpdateSeed { get; private set; } public static Effect screenShader => Main.ScreenShaderRef.Value; public static Effect pixelShader => Main.PixelShaderRef.Value; public static Effect vertexPixelShader => Main.VertexPixelShaderRef.Value; public static Effect tileShader => Main.TileShaderRef.Value; public static void SetCameraLerp(float lerp, int time) { Main.cameraLerp = lerp; Main.cameraLerpTimer = 0; Main.cameraLerpTimeToggle = time; Main.cameraGamePadLerp = false; } public static void SetCameraGamepadLerp(float lerp) { double cameraLerp = (double) Main.cameraLerp; } [Obsolete("Transform is deprecated. Please use GameViewMatrix & GUIViewMatrix")] public static Matrix Transform => Main.GameViewMatrix.TransformationMatrix; public static Vector2 MouseScreen => new Vector2((float) Main.mouseX, (float) Main.mouseY); public static Vector2 MouseWorld { get { Vector2 vector2 = Main.MouseScreen + Main.screenPosition; if ((double) Main.player[Main.myPlayer].gravDir == -1.0) vector2.Y = Main.screenPosition.Y + (float) Main.screenHeight - (float) Main.mouseY; return vector2; } } public static Vector2 ReverseGravitySupport(Vector2 pos, float height = 0.0f) { if ((double) Main.player[Main.myPlayer].gravDir != -1.0) return pos; pos.Y = (float) Main.screenHeight - pos.Y - height; return pos; } public static Microsoft.Xna.Framework.Point ReverseGravitySupport(Microsoft.Xna.Framework.Point pos, int height = 0) { if ((double) Main.player[Main.myPlayer].gravDir != -1.0) return pos; pos.Y = Main.screenHeight - pos.Y - height; return pos; } public static Microsoft.Xna.Framework.Rectangle ReverseGravitySupport(Microsoft.Xna.Framework.Rectangle box) { if ((double) Main.player[Main.myPlayer].gravDir != -1.0) return box; box.Y = Main.screenHeight - box.Y - box.Height; return box; } public void SetMouseNPC(int index, int type) { this.mouseNPCIndex = index; this.mouseNPCType = type; } public void SetMouseNPC_ToHousingQuery() => this.SetMouseNPC(-1, 0); public static event Action OnEnginePreload; public static event Action OnResolutionChanged; public static event Action OnEngineLoad; public static uint GameUpdateCount => Main._gameUpdateCount; public static event Action OnTickForThirdPartySoftwareOnly; public static event Action OnTickForInternalCodeOnly; public static event Action OnPreDraw; public static event Action OnPostDraw; public static event Action OnPostFullscreenMapDraw; public static event Action OnRenderTargetsReleased; public static event ResolutionChangeEvent OnRenderTargetsInitialized; [DllImport("User32")] private static extern int RemoveMenu(IntPtr hMenu, int nPosition, int wFlags); [DllImport("User32")] private static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert); [DllImport("User32")] private static extern int GetMenuItemCount(IntPtr hWnd); [DllImport("kernel32.dll")] public static extern IntPtr LoadLibrary(string dllToLoad); public static SamplerState DefaultSamplerState => !Main.drawToScreen ? SamplerState.PointClamp : SamplerState.LinearClamp; public static int UnderworldLayer => Main.maxTilesY - 200; public static MoonPhase GetMoonPhase() => (MoonPhase) Main.moonPhase; public static float WindForVisuals => Main.windSpeedCurrent; public static Vector2 DrawPlayerItemPos(float gravdir, int itemtype) { float num = 10f; Main.instance.LoadItem(itemtype); Vector2 vector2 = new Vector2((float) (TextureAssets.Item[itemtype].Width() / 2), (float) (TextureAssets.Item[itemtype].Height() / 2)); if (itemtype == 95) { num = 6f; vector2.Y += 2f * gravdir; } else if (itemtype == 1295) num = 4f; else if (itemtype == 3611) num = 2f; else if (itemtype == 3350) num = 2f; else if (itemtype == 2624) num = 4f; else if (itemtype == 3018) num = 2f; else if (itemtype == 3007) { num = 4f; vector2.Y -= 1f * gravdir; } else if (itemtype == 3107) { num = 4f; vector2.Y += 2f * gravdir; } else if (itemtype == 3008) { num = -7f; vector2.Y += 2f * gravdir; } else if (itemtype == 1255) { num = 6f; vector2.Y += 0.0f * gravdir; } else if (itemtype == 2269) { num = 2f; vector2.Y += 2f * gravdir; } else if (itemtype == 1265) { num = -8f; vector2.Y += 4f * gravdir; } else if (itemtype == 2272) { num = 0.0f; vector2.Y += 4f * gravdir; } else if (itemtype == 3029) num = 4f; else if (itemtype == 4381) num = 4f; else if (itemtype == 2796) { num = -28f; vector2.Y += 2f * gravdir; } else if (itemtype == 2797) num = 0.0f; else if (itemtype == 2610) num = 0.0f; else if (itemtype == 2623) { num = -30f; vector2.Y -= 4f * gravdir; } else if (itemtype == 3546) { num = -14f; vector2.Y -= 6f * gravdir; } else if (itemtype == 1835) { num = -2f; vector2.Y += 2f * gravdir; } else if (itemtype == 2624) num = -4f; else if (itemtype == 3859) num = -2f; else if (itemtype == 2888) num = 6f; else if (itemtype == 2223) { num = 2f; vector2.Y -= 2f * gravdir; } else if (itemtype == 1782) { num = 0.0f; vector2.Y += 4f * gravdir; } else if (itemtype == 1929) { num = 0.0f; vector2.Y += 2f * gravdir; } else if (itemtype == 2270) num = -4f; else if (itemtype == 1784) { num = 0.0f; vector2.Y += 4f * gravdir; } else if (itemtype == 1000) { num = 6f; vector2.Y += 0.0f * gravdir; } else if (itemtype == 1178) { num = 4f; vector2.Y += 0.0f * gravdir; } else if (itemtype == 1319) { num = 0.0f; vector2.Y += 0.0f * gravdir; } else if (itemtype == 1297) { num = -8f; vector2.Y += 0.0f * gravdir; } else if (itemtype == 1121) { num = 6f; vector2.Y -= 2f * gravdir; } else if (itemtype == 1314) num = 2f; else if (itemtype == 1258) { num = 2f; vector2.Y -= 2f * gravdir; } else if (itemtype == 1155) { num = -10f; vector2.Y -= 2f * gravdir; } else if (itemtype == 1156) num = -2f; else if (itemtype == 4703) { num = -3f; vector2.Y -= 2f * gravdir; } else if (itemtype == 96) { num = -8f; vector2.Y += 2f * gravdir; } else if (itemtype == 1870) { num = -8f; vector2.Y += 2f * gravdir; } else if (itemtype == 1260) { num = -8f; vector2.Y += 2f * gravdir; } else if (itemtype == 1254) { num = -6f; vector2.Y += 2f * gravdir; } else if (itemtype == 98) { num = -5f; vector2.Y -= 2f * gravdir; } else if (itemtype == 534) { num = -2f; vector2.Y += 1f * gravdir; } else if (itemtype == 679) { num = 0.0f; vector2.Y += 2f * gravdir; } else if (itemtype == 964) { num = 0.0f; vector2.Y += 0.0f * gravdir; } else if (itemtype == 533) { num = -7f; vector2.Y -= 2f * gravdir; } else if (itemtype == 1553) { num = -10f; vector2.Y -= 2f * gravdir; } else if (itemtype == 506) { num = 0.0f; vector2.Y -= 2f * gravdir; } else if (itemtype == 1910) { num = 0.0f; vector2.Y -= 2f * gravdir; } else if (itemtype == 494 || itemtype == 508) { num = -2f; } else { switch (itemtype) { case 434: num = 0.0f; vector2.Y -= 2f * gravdir; break; case 514: num = 0.0f; vector2.Y += 3f * gravdir; break; default: if (itemtype == 435 || itemtype == 436 || itemtype == 481 || itemtype == 578 || itemtype == 1187 || itemtype == 1194 || itemtype == 1201 || itemtype == 1229) { num = -2f; vector2.Y -= 2f * gravdir; break; } switch (itemtype) { case 126: num = 4f; vector2.Y += 4f * gravdir; break; case (int) sbyte.MaxValue: num = 4f; vector2.Y += 2f * gravdir; break; case 157: num = 6f; vector2.Y += 2f * gravdir; break; case 160: num = -8f; break; case 197: num = -5f; vector2.Y += 4f * gravdir; break; case 800: num = 4f; vector2.Y += 2f * gravdir; break; case 4060: num = -2f; vector2.Y += 4f * gravdir; break; default: if (itemtype == 164 || itemtype == 219) { num = 0.0f; vector2.Y += 2f * gravdir; break; } if (itemtype == 165 || itemtype == 272) { num = 4f; vector2.Y += 4f * gravdir; break; } switch (itemtype) { case 266: num = 0.0f; vector2.Y += 2f * gravdir; break; case 281: num = 6f; vector2.Y -= 6f * gravdir; break; case 682: num = 4f; break; case 758: num -= 20f; vector2.Y += 0.0f * gravdir; break; case 759: num -= 18f; vector2.Y += 2f * gravdir; break; case 760: num -= 12f; vector2.Y += 2f * gravdir; break; case 779: num = 0.0f; vector2.Y += 2f * gravdir; break; case 905: num = -5f; vector2.Y += 0.0f * gravdir; break; case 930: num = 4f; vector2.Y += 2f * gravdir; break; case 986: num = 6f; vector2.Y -= 10f * gravdir; break; case 1946: num -= 12f; vector2.Y += 2f * gravdir; break; case 3788: num = 2f; vector2.Y += 2f * gravdir; break; case 3870: num = 4f; vector2.Y += 4f * gravdir; break; case 4953: num = -4f; break; } break; } break; } } vector2.X = num; return vector2; } public static void SetupTileMerge() { int length = 623; Main.tileMerge = new bool[length][]; for (int index = 0; index < Main.tileMerge.Length; ++index) Main.tileMerge[index] = new bool[length]; } public static void RegisterItemAnimation(int index, DrawAnimation animation) { if (!Main.itemAnimationsRegistered.Contains(index)) Main.itemAnimationsRegistered.Add(index); Main.itemAnimations[index] = animation; } public static void InitializeItemAnimations() { for (int index = 0; index < Main.itemAnimations.Length; ++index) Main.itemAnimations[index] = (DrawAnimation) null; Main.itemAnimationsRegistered.Clear(); Main.RegisterItemAnimation(3581, (DrawAnimation) new DrawAnimationVertical(4, 4)); Main.RegisterItemAnimation(3580, (DrawAnimation) new DrawAnimationVertical(6, 4)); Main.RegisterItemAnimation(75, (DrawAnimation) new DrawAnimationVertical(5, 8) { PingPong = true }); Main.RegisterItemAnimation(575, (DrawAnimation) new DrawAnimationVertical(6, 4)); Main.RegisterItemAnimation(547, (DrawAnimation) new DrawAnimationVertical(6, 4)); Main.RegisterItemAnimation(520, (DrawAnimation) new DrawAnimationVertical(6, 4)); Main.RegisterItemAnimation(548, (DrawAnimation) new DrawAnimationVertical(6, 4)); Main.RegisterItemAnimation(521, (DrawAnimation) new DrawAnimationVertical(6, 4)); Main.RegisterItemAnimation(549, (DrawAnimation) new DrawAnimationVertical(6, 4)); Main.RegisterItemAnimation(3453, (DrawAnimation) new DrawAnimationVertical(6, 4)); Main.RegisterItemAnimation(3454, (DrawAnimation) new DrawAnimationVertical(6, 4)); Main.RegisterItemAnimation(3455, (DrawAnimation) new DrawAnimationVertical(6, 4)); Main.RegisterItemAnimation(4068, (DrawAnimation) new DrawAnimationVertical(6, 4) { NotActuallyAnimating = true }); Main.RegisterItemAnimation(4069, (DrawAnimation) new DrawAnimationVertical(6, 4) { NotActuallyAnimating = true }); Main.RegisterItemAnimation(4070, (DrawAnimation) new DrawAnimationVertical(6, 4) { NotActuallyAnimating = true }); for (int index = 0; index < ItemID.Sets.IsFood.Length; ++index) { if (ItemID.Sets.IsFood[index]) Main.RegisterItemAnimation(index, (DrawAnimation) new DrawAnimationVertical(int.MaxValue, 3)); } } public static Player LocalPlayer => Main.player[Main.myPlayer]; public static CreativeUnlocksTracker LocalPlayerCreativeTracker => Main.player[Main.myPlayer].creativeTracker; public static int npcShop { get; private set; } public static void SetGraphicsProfile(GraphicsProfile profile) { if (Main._currentGraphicsProfile == profile) return; Main._selectedGraphicsProfile = profile; Main.SetGraphicsProfileInternal(); } private static void SetGraphicsProfileInternal() { Main._currentGraphicsProfile = Main._selectedGraphicsProfile; Main.graphics.GraphicsProfile = Main._selectedGraphicsProfile; switch (Main._selectedGraphicsProfile) { case GraphicsProfile.Reach: Main.maxScreenW = 1920; Main.maxScreenH = 1200; Main._renderTargetMaxSize = 2048; break; case GraphicsProfile.HiDef: Main.maxScreenW = 4096; Main.maxScreenH = 4096; Main._renderTargetMaxSize = 4096; Main.TrySupporting8K(); break; } try { Main.graphics.ApplyChanges(); } catch (NoSuitableGraphicsDeviceException ex) { if (Main._currentGraphicsProfile == GraphicsProfile.HiDef) { Main._selectedGraphicsProfile = GraphicsProfile.Reach; Main.SetGraphicsProfileInternal(); } } Main.instance.EnsureRenderTargetContent(); } private static void TrySupporting8K() { if (!Platform.IsWindows) return; Main.instance.ReleaseTargets(); System.Type type = Assembly.GetAssembly(typeof (GraphicsProfile)).GetType("Microsoft.Xna.Framework.Graphics.ProfileCapabilities", true); if (!(type != (System.Type) null)) return; FieldInfo field1 = type.GetField("MaxTextureSize", BindingFlags.Instance | BindingFlags.NonPublic); FieldInfo field2 = type.GetField("HiDef", BindingFlags.Static | BindingFlags.NonPublic); if (!(field1 != (FieldInfo) null) || !(field2 != (FieldInfo) null)) return; field1.SetValue(field2.GetValue((object) null), (object) 8192); } public static void AnglerQuestSwap() { if (Main.netMode == 1) return; Main.anglerWhoFinishedToday.Clear(); Main.anglerQuestFinished = false; bool flag1 = NPC.downedBoss1 || NPC.downedBoss2 || NPC.downedBoss3 || Main.hardMode || NPC.downedSlimeKing || NPC.downedQueenBee; bool flag2 = true; while (flag2) { flag2 = false; Main.anglerQuest = Main.rand.Next(Main.anglerQuestItemNetIDs.Length); int anglerQuestItemNetId = Main.anglerQuestItemNetIDs[Main.anglerQuest]; if (anglerQuestItemNetId == 2454 && (!Main.hardMode || WorldGen.crimson)) flag2 = true; if (anglerQuestItemNetId == 2457 && WorldGen.crimson) flag2 = true; if (anglerQuestItemNetId == 2462 && !Main.hardMode) flag2 = true; if (anglerQuestItemNetId == 2463 && (!Main.hardMode || !WorldGen.crimson)) flag2 = true; if (anglerQuestItemNetId == 2465 && !Main.hardMode) flag2 = true; if (anglerQuestItemNetId == 2468 && !Main.hardMode) flag2 = true; if (anglerQuestItemNetId == 2471 && !Main.hardMode) flag2 = true; if (anglerQuestItemNetId == 2473 && !Main.hardMode) flag2 = true; if (anglerQuestItemNetId == 2477 && !WorldGen.crimson) flag2 = true; if (anglerQuestItemNetId == 2480 && !Main.hardMode) flag2 = true; if (anglerQuestItemNetId == 2483 && !Main.hardMode) flag2 = true; if (anglerQuestItemNetId == 2484 && !Main.hardMode) flag2 = true; if (anglerQuestItemNetId == 2485 && WorldGen.crimson) flag2 = true; if ((anglerQuestItemNetId == 2476 || anglerQuestItemNetId == 2453 || anglerQuestItemNetId == 2473) && !flag1) flag2 = true; } NetMessage.SendAnglerQuest(-1); } public static string playerPathName => Main.ActivePlayerFileData.Path; public static string worldPathName => Main.ActiveWorldFileData.Path; public static bool HasSmartInteractTarget => Main.SmartInteractNPC != -1 || Main.SmartInteractX != -1 && Main.SmartInteractY != -1 || Main.SmartInteractProj != -1; public void UpdateParticleSystems() { Main.ParticleSystem_World_OverPlayers.Update(); Main.ParticleSystem_World_BehindPlayers.Update(); } public static void TrySetPreparationState(Main.WorldPreparationState state) { if (state != Main.WorldPreparationState.ProcessingData) return; Main._worldPreparationState = state; } public static void UpdateWorldPreparationState() { if (Main.netMode != 1) { Main._worldPreparationState = Main.WorldPreparationState.Ready; } else { if (Main.netMode == 1 && Main.gameMenu && Main._worldPreparationState == Main.WorldPreparationState.Ready) Main._worldPreparationState = Main.WorldPreparationState.AwaitingData; if (Main.netMode != 1 || Main._worldPreparationState != Main.WorldPreparationState.ProcessingData) return; Main._worldPreparationState = Main.WorldPreparationState.Ready; Main.gameMenu = false; Main.FixUIScale(); ChatHelper.ShowCachedMessages(); ChatHelper.ClearDelayedMessagesCache(); } } public static bool InSmartCursorHighlightArea(int x, int y, out bool actuallySelected) { actuallySelected = Main.SmartInteractTileCoordsSelected.Contains(new Microsoft.Xna.Framework.Point(x, y)); return !Main.hideUI && Collision.InTileBounds(x, y, Main.TileInteractionLX, Main.TileInteractionLY, Main.TileInteractionHX, Main.TileInteractionHY) && Main.SmartInteractTileCoords.Contains(new Microsoft.Xna.Framework.Point(x, y)); } public static void LoadWorlds() { Main.WorldList.Clear(); if (!Utils.TryCreatingDirectory(Main.WorldPath)) return; string[] files = Directory.GetFiles(Main.WorldPath, "*.wld"); int num = Math.Min(files.Length, Main.maxLoadWorld); for (int index = 0; index < num; ++index) { WorldFileData allMetadata = WorldFile.GetAllMetadata(files[index], false); if (allMetadata != null) Main.WorldList.Add(allMetadata); else Main.WorldList.Add(WorldFileData.FromInvalidWorld(files[index], false)); } if (SocialAPI.Cloud != null) { foreach (string str in SocialAPI.Cloud.GetFiles().Where((Func) (path => path.StartsWith(Main.CloudWorldPath, StringComparison.CurrentCultureIgnoreCase) && path.EndsWith(".wld", StringComparison.CurrentCultureIgnoreCase)))) { WorldFileData allMetadata = WorldFile.GetAllMetadata(str, true); if (allMetadata != null) Main.WorldList.Add(allMetadata); else Main.WorldList.Add(WorldFileData.FromInvalidWorld(str, true)); } } Main.WorldList.Sort(new Comparison(Main.WorldListSortMethod)); } private static int WorldListSortMethod(WorldFileData data1, WorldFileData data2) => data1.Name.CompareTo(data2.Name); public static void LoadPlayers() { Main.PlayerList.Clear(); if (!Utils.TryCreatingDirectory(Main.PlayerPath)) return; string[] files = Directory.GetFiles(Main.PlayerPath, "*.plr"); int num = Math.Min(Main.maxLoadPlayer, files.Length); for (int index = 0; index < num; ++index) { PlayerFileData fileData = Player.GetFileData(files[index], false); if (fileData != null) Main.PlayerList.Add(fileData); } if (SocialAPI.Cloud != null) { foreach (string file in SocialAPI.Cloud.GetFiles().Where((Func) (path => path.StartsWith(Main.CloudPlayerPath, StringComparison.CurrentCultureIgnoreCase) && path.EndsWith(".plr", StringComparison.CurrentCultureIgnoreCase)))) { PlayerFileData fileData = Player.GetFileData(file, true); if (fileData != null) Main.PlayerList.Add(fileData); } } Main.PlayerList.Sort(new Comparison(Main.PlayerListSortMethod)); } private static int PlayerListSortMethod(PlayerFileData data1, PlayerFileData data2) => data1.Name.CompareTo(data2.Name); protected void OpenRecent() { try { if (!File.Exists(Main.SavePath + Path.DirectorySeparatorChar.ToString() + "servers.dat")) return; using (FileStream fileStream = new FileStream(Main.SavePath + Path.DirectorySeparatorChar.ToString() + "servers.dat", FileMode.Open)) { using (BinaryReader binaryReader = new BinaryReader((Stream) fileStream)) { binaryReader.ReadInt32(); for (int index = 0; index < 10; ++index) { Main.recentWorld[index] = binaryReader.ReadString(); Main.recentIP[index] = binaryReader.ReadString(); Main.recentPort[index] = binaryReader.ReadInt32(); } } } } catch { } } public static void SaveRecent() { Utils.TryCreatingDirectory(Main.SavePath); try { File.SetAttributes(Main.SavePath + Path.DirectorySeparatorChar.ToString() + "servers.dat", FileAttributes.Normal); } catch { } try { using (FileStream fileStream = new FileStream(Main.SavePath + Path.DirectorySeparatorChar.ToString() + "servers.dat", FileMode.Create)) { using (BinaryWriter binaryWriter = new BinaryWriter((Stream) fileStream)) { binaryWriter.Write(230); for (int index = 0; index < 10; ++index) { binaryWriter.Write(Main.recentWorld[index]); binaryWriter.Write(Main.recentIP[index]); binaryWriter.Write(Main.recentPort[index]); } } } } catch { } } public static bool SaveSettings() { Main.Configuration.Clear(); Main.Configuration.Put("ResetDefaultUIScale", (object) false); Main.Configuration.Put("SmartCursorToggle", (object) Main.cSmartCursorModeIsToggleAndNotHold); Main.Configuration.Put("MapEnabled", (object) Main.mapEnabled); Main.Configuration.Put("InvasionBarMode", (object) Main.invasionProgressMode); Main.Configuration.Put("AutoSave", (object) Main.autoSave); Main.Configuration.Put("AutoPause", (object) Main.autoPause); Main.Configuration.Put("Language", (object) Language.ActiveCulture.Name); Main.Configuration.Put("PlacementPreview", (object) Main.placementPreview); Main.Configuration.Put("GoreVisualsAllowed", (object) ChildSafety.Disabled); Main.Configuration.Put("WorldRollbacksToKeep", (object) Main.WorldRollingBackupsCountToKeep); Main.Configuration.Put("TeamNameplateDistance", (object) Main.teamNamePlateDistance); Main.Configuration.Put("MultiplayerNPCSmoothingRange", (object) Main.multiplayerNPCSmoothingRange); Main.Configuration.Put("VolumeSound", (object) Main.soundVolume); Main.Configuration.Put("VolumeAmbient", (object) Main.ambientVolume); Main.Configuration.Put("VolumeMusic", (object) Main.musicVolume); Main.Configuration.Put("UnlockMusicSwap", (object) Main.TOWMusicUnlocked); Main.Configuration.Put("UseExperimentalFeatures", (object) Main.UseExperimentalFeatures); Main.Configuration.Put("Fullscreen", (object) Main.graphics.IsFullScreen); Main.Configuration.Put("WindowMaximized", (object) Main.screenMaximized); Main.Configuration.Put("WindowBorderless", (object) Main.screenBorderless); Main.Configuration.Put("DisplayWidth", (object) Main.graphics.PreferredBackBufferWidth); Main.Configuration.Put("DisplayHeight", (object) Main.graphics.PreferredBackBufferHeight); Main.Configuration.Put("GraphicsQuality", (object) Main.qaStyle); Main.Configuration.Put("BackgroundEnabled", (object) Main.BackgroundEnabled); Main.Configuration.Put("FrameSkipMode", (object) Main.FrameSkipMode); Main.Configuration.Put("LightingMode", (object) Lighting.Mode); Main.Configuration.Put("BackgroundParallax", (object) Main.bgScroll); Main.Configuration.Put("ShowItemText", (object) Main.showItemText); Main.Configuration.Put("LastLaunchedVersion", (object) 230); Main.Configuration.Put("ClientUUID", (object) Main.clientUUID); Main.Configuration.Put("UseSmartCursorForCommonBlocks", (object) Player.SmartCursorSettings.SmartBlocksEnabled); Main.Configuration.Put("UseSmartAxeAfterSmartPickaxe", (object) Player.SmartCursorSettings.SmartAxeAfterPickaxe); Main.Configuration.Put("DisableLeftShiftTrashCan", (object) ItemSlot.Options.DisableLeftShiftTrashCan); Main.Configuration.Put("HighlightNewItems", (object) ItemSlot.Options.HighlightNewItems); Main.Configuration.Put("HidePasswords", (object) Main.HidePassword); Main.Configuration.Put("ReverseUpDownForArmorSetBonuses", (object) Main.ReversedUpDownArmorSetBonuses); Main.Configuration.Put("MouseShowBuildingGrid", (object) Main.MouseShowBuildingGrid); Main.Configuration.Put("AllowUnfocusedInputOnGamepad", (object) Main.AllowUnfocusedInputOnGamepad); Main.Configuration.Put("LockOnPriority", (object) LockOnHelper.UseMode); Main.Configuration.Put("InvisibleCursorForGamepad", (object) Main.InvisibleCursorForGamepad); Main.Configuration.Put("GamepadDisableInstructionsDisplay", (object) Main.GamepadDisableInstructionsDisplay); Main.Configuration.Put("SettingsUnlock_WorldEvil", (object) Main.SettingsUnlock_WorldEvil); Main.Configuration.Put("SettingsEnabled_MinersWobble", (object) Main.SettingsEnabled_MinersWobble); Main.Configuration.Put("SettingBlockGamepadsEntirely", (object) Main.SettingBlockGamepadsEntirely); Main.Configuration.Put("SettingsEnabled_OpaqueBoxBehindTooltips", (object) Main.SettingsEnabled_OpaqueBoxBehindTooltips); Main.Configuration.Put("SettingDontScaleMainMenuUp", (object) Main.SettingDontScaleMainMenuUp); Main.Configuration.Put("SettingsEnabled_TilesSwayInWind", (object) Main.SettingsEnabled_TilesSwayInWind); Main.Configuration.Put("UseStormEffect", (object) Main.UseStormEffects); Main.Configuration.Put("UseHeatDistortion", (object) Main.UseHeatDistortion); Main.Configuration.Put("WaveQuality", (object) Main.WaveQuality); Main.Configuration.Put("Support4K", (object) Main.Support4K); Main.Configuration.Put("MouseColor", (object) new Dictionary() { { "R", Main.mouseColor.R }, { "G", Main.mouseColor.G }, { "B", Main.mouseColor.B } }); Main.Configuration.Put("MouseBorderColor", (object) new Dictionary() { { "R", Main.MouseBorderColor.R }, { "G", Main.MouseBorderColor.G }, { "B", Main.MouseBorderColor.B }, { "A", Main.MouseBorderColor.A } }); Main.Configuration.Put("QuickLaunch", (object) Main.SkipAssemblyLoad); Main.Configuration.Put("Zoom", (object) Main.GameZoomTarget); Main.Configuration.Put("UIScale", (object) Main._uiScaleWanted); Main.Configuration.Put("MapScale", (object) Main.MapScale); if (Main.AssetSourceController != null) Main.Configuration.Put("ResourcePacks", (object) Main.AssetSourceController.ActiveResourcePackList.ToJson()); Main.Configuration.Put("FlashIconForEvents", (object) Enum.GetName(typeof (GameNotificationType), (object) Main._flashNotificationType)); Main.Configuration.Put("Display", (object) Main._windowMover.ScreenDeviceName); Main.Configuration.Put("DisplayScreen", (object) Main._windowMover.ScreenDeviceName); Main.Configuration.Put("ThrottleWhenInactive", (object) (Main.instance.InactiveSleepTime != TimeSpan.Zero)); Main.Configuration.Put("DoorAutoOpeningMode", (object) DoorOpeningHelper.PreferenceSettings); Main.Configuration.Put("WaterfallDrawLimit", (object) Main.instance.waterfallManager.maxWaterfallCount); Main.Configuration.Put("DisableIntenseVisualEffects", (object) Main.DisableIntenseVisualEffects); return Main.Configuration.Save() && PlayerInput.Save(); } protected void CheckBunny() { try { RegistryKey subKey = Registry.CurrentUser.CreateSubKey("Software\\Terraria"); if (subKey == null || subKey.GetValue("Bunny") == null || !(subKey.GetValue("Bunny").ToString() == "1")) return; Main.runningCollectorsEdition = true; } catch { Main.runningCollectorsEdition = false; } } private static void TryPickingDefaultUIScale(float displayHeight) { if (!Main.shouldSetDefaultUIScale) return; Main.newDefaultUIScale = (float) ((double) displayHeight / 1080.0 * 1.10000002384186); Main.shouldSetDefaultUIScale = false; Main.Configuration.Put("UIScale", (object) Main.newDefaultUIScale); Main.Configuration.Save(); } protected void LoadSettings() { if (File.Exists(Main.SavePath + Path.DirectorySeparatorChar.ToString() + "config.dat")) { this.OpenLegacySettings(); if (!Main.SaveSettings()) return; File.Delete(Main.SavePath + Path.DirectorySeparatorChar.ToString() + "config.dat"); } else { Main.Configuration.Load(); int currentValue1 = 0; Main.Configuration.Get("LastLaunchedVersion", ref currentValue1); bool flag = false; if (currentValue1 < 219) flag = true; if (!flag) { Main.Configuration.Get("ResetDefaultUIScale", ref Main.shouldSetDefaultUIScale); Main.Configuration.Get("Fullscreen", ref Main.startFullscreen); Main.Configuration.Get("WindowMaximized", ref Main.screenMaximized); Main.Configuration.Get("WindowBorderless", ref Main.screenBorderless); } Main.PendingBorderlessState = Main.screenBorderless; Main.screenBorderlessPendingResizes = Main.screenBorderless ? 6 : 0; if (!Main.startFullscreen) { int preferredBackBufferWidth = Main.graphics.PreferredBackBufferWidth; int backBufferHeight = Main.graphics.PreferredBackBufferHeight; Main.Configuration.Get("DisplayWidth", ref preferredBackBufferWidth); Main.Configuration.Get("DisplayHeight", ref backBufferHeight); if (Main.PendingBorderlessState) Main.screenBorderlessPendingResizes = 1; Main.SetDisplayMode(preferredBackBufferWidth, backBufferHeight, false); Main.TryPickingDefaultUIScale((float) backBufferHeight); } Main.Configuration.Get("SmartCursorToggle", ref Main.cSmartCursorModeIsToggleAndNotHold); Main.Configuration.Get("MapEnabled", ref Main.mapEnabled); Main.Configuration.Get("InvasionBarMode", ref Main.invasionProgressMode); Main.Configuration.Get("AutoSave", ref Main.autoSave); Main.Configuration.Get("AutoPause", ref Main.autoPause); Main._needsLanguageSelect = !Main.Configuration.Contains("Language"); string str = Main.Configuration.Get("Language", "en-US"); int result1 = 0; if (int.TryParse(str, out result1)) { LanguageManager.Instance.SetLanguage(result1); this.SetTitle(); } else { LanguageManager.Instance.SetLanguage(str); this.SetTitle(); } Main.Configuration.Get("PlacementPreview", ref Main.placementPreview); Main.Configuration.Get("GoreVisualsAllowed", ref ChildSafety.Disabled); Main.Configuration.Get("DisableIntenseVisualEffects", ref Main.DisableIntenseVisualEffects); if (!flag) { Main.Configuration.Get("VolumeSound", ref Main.soundVolume); Main.Configuration.Get("VolumeAmbient", ref Main.ambientVolume); Main.Configuration.Get("VolumeMusic", ref Main.musicVolume); } Main.Configuration.Get("KeyFavoriteModifier", ref Main.cFavoriteKey); Microsoft.Xna.Framework.Input.Keys result2; if (Enum.TryParse(Main.cFavoriteKey, out result2)) Main.FavoriteKey = result2; if (!flag) { Main.Configuration.Get("GraphicsQuality", ref Main.qaStyle); Main.Configuration.Get("BackgroundEnabled", ref Main.BackgroundEnabled); } if (Main.Configuration.GetAllKeys().Contains("FrameSkip")) { bool currentValue2 = false; Main.Configuration.Get("FrameSkip", ref currentValue2); Main.terrariasFixedTiming = !currentValue2; Main.FrameSkipMode = !Main.terrariasFixedTiming ? 1 : 2; } Main.Configuration.Get("FrameSkipMode", ref Main.FrameSkipMode); if (Main.FrameSkipMode < 0) Main.FrameSkipMode = 0; if (Main.FrameSkipMode > 2) Main.FrameSkipMode = 2; int mode = (int) Lighting.Mode; if (!flag) Main.Configuration.Get("LightingMode", ref mode); Lighting.Mode = (LightMode) mode; Main.Configuration.Get("UnlockMusicSwap", ref Main.TOWMusicUnlocked); Main.Configuration.Get("Parallax", ref Main.caveParallax); Main.bgScroll = (int) ((1.0 - (double) Main.caveParallax) * 500.0); Main.Configuration.Get("BackgroundParallax", ref Main.bgScroll); Main.caveParallax = (float) (1.0 - (double) Main.bgScroll / 500.0); Main.Configuration.Get("ShowItemText", ref Main.showItemText); Main.Configuration.Get("ClientUUID", ref Main.clientUUID); Main.Configuration.Get("UseSmartCursorForCommonBlocks", ref Player.SmartCursorSettings.SmartBlocksEnabled); Main.Configuration.Get("UseSmartAxeAfterSmartPickaxe", ref Player.SmartCursorSettings.SmartAxeAfterPickaxe); if (!flag) Main.Configuration.Get("DisableLeftShiftTrashCan", ref ItemSlot.Options.DisableLeftShiftTrashCan); Main.Configuration.Get("HidePasswords", ref Main.HidePassword); Main.Configuration.Get("HighlightNewItems", ref ItemSlot.Options.HighlightNewItems); Main.Configuration.Get("ReverseUpDownForArmorSetBonuses", ref Main.ReversedUpDownArmorSetBonuses); Main.Configuration.Get("MouseShowBuildingGrid", ref Main.MouseShowBuildingGrid); Main.Configuration.Get("AllowUnfocusedInputOnGamepad", ref Main.AllowUnfocusedInputOnGamepad); Main.Configuration.Get("GamepadDisableInstructionsDisplay", ref Main.GamepadDisableInstructionsDisplay); Main.Configuration.Get("SettingDontScaleMainMenuUp", ref Main.SettingDontScaleMainMenuUp); Main.Configuration.Get("WorldRollbacksToKeep", ref Main.WorldRollingBackupsCountToKeep); Main.Configuration.Get("TeamNameplateDistance", ref Main.teamNamePlateDistance); if (currentValue1 < 230) Main.Configuration.Get("MultiplayerNPCSmoothingRange", ref Main.multiplayerNPCSmoothingRange); Main.Configuration.Get("UseStormEffect", ref Main.UseStormEffects); Main.Configuration.Get("UseHeatDistortion", ref Main.UseHeatDistortion); Main.Configuration.Get("WaveQuality", ref Main.WaveQuality); if (Main.WaveQuality > 3) Main.WaveQuality = 3; if (Main.WaveQuality < 0) Main.WaveQuality = 0; Dictionary currentValue3 = new Dictionary(); Main.Configuration.Get>("MouseColor", ref currentValue3); byte num; if (currentValue3.TryGetValue("R", out num)) Main.mouseColor.R = num; if (currentValue3.TryGetValue("G", out num)) Main.mouseColor.G = num; if (currentValue3.TryGetValue("B", out num)) Main.mouseColor.B = num; currentValue3.Clear(); Main.Configuration.Get>("MouseBorderColor", ref currentValue3); if (currentValue3.TryGetValue("R", out num)) Main.MouseBorderColor.R = num; if (currentValue3.TryGetValue("G", out num)) Main.MouseBorderColor.G = num; if (currentValue3.TryGetValue("B", out num)) Main.MouseBorderColor.B = num; if (currentValue3.TryGetValue("A", out num)) Main.MouseBorderColor.A = num; Main.Configuration.Get("QuickLaunch", ref Main.SkipAssemblyLoad); if (!flag) Main.GameZoomTarget = Main.Configuration.Get("Zoom", 1f); if (!flag) Main.UIScale = Main.Configuration.Get("UIScale", Platform.Get().GetScaling()); if ((double) Main.newDefaultUIScale > 0.0) { Main.UIScale = Main.newDefaultUIScale; Main.newDefaultUIScale = 0.0f; } Main.MapScale = MathHelper.Clamp(Main.Configuration.Get("MapScale", 1f), 0.5f, 1f); int currentValue4 = -1; Main.Configuration.Get("LockOnPriority", ref currentValue4); if (currentValue4 < 0) currentValue4 = 0; if (currentValue4 > 2) currentValue4 = 2; LockOnHelper.UseMode = (LockOnHelper.LockOnMode) currentValue4; if (LockOnHelper.UseMode == LockOnHelper.LockOnMode.FocusTarget) LockOnHelper.UseMode = LockOnHelper.LockOnMode.ThreeDS; Main.Configuration.Get("InvisibleCursorForGamepad", ref Main.InvisibleCursorForGamepad); GameNotificationType result3; if (Enum.TryParse(Main.Configuration.Get("FlashIconForEvents", "All"), out result3)) Main._flashNotificationType = result3; if (!flag) { string screenDeviceName = Main.Configuration.Get("DisplayScreen", ""); Main._windowMover.TryMovingToScreen(screenDeviceName); this.InactiveSleepTime = TimeSpan.FromMilliseconds(Main.Configuration.Get("ThrottleWhenInactive", true) ? 20.0 : 0.0); } Form form = (Form) Control.FromHandle(Main.instance.Window.Handle); if (Main.screenBorderless) Main.SetBorderlessFormStyle(form); else if (Main.screenMaximized) { form.WindowState = FormWindowState.Maximized; form.FormBorderStyle = FormBorderStyle.Sizable; } else form.FormBorderStyle = FormBorderStyle.Sizable; Control.FromHandle(Main.instance.Window.Handle).BringToFront(); if (!flag) Main.Configuration.Get("Support4K", ref Main.Support4K); Main.Configuration.Get("UseExperimentalFeatures", ref Main.UseExperimentalFeatures); Main.Configuration.Get("SettingsUnlock_WorldEvil", ref Main.SettingsUnlock_WorldEvil); Main.Configuration.Get("SettingsEnabled_MinersWobble", ref Main.SettingsEnabled_MinersWobble); Main.Configuration.Get("SettingBlockGamepadsEntirely", ref Main.SettingBlockGamepadsEntirely); Main.Configuration.Get("SettingsEnabled_OpaqueBoxBehindTooltips", ref Main.SettingsEnabled_OpaqueBoxBehindTooltips); Main.Configuration.Get("SettingsEnabled_TilesSwayInWind", ref Main.SettingsEnabled_TilesSwayInWind); int preferenceSettings = (int) DoorOpeningHelper.PreferenceSettings; Main.Configuration.Get("DoorAutoOpeningMode", ref preferenceSettings); DoorOpeningHelper.PreferenceSettings = (DoorOpeningHelper.DoorAutoOpeningPreference) preferenceSettings; if (currentValue1 <= 147) Main.terrariasFixedTiming = !Main.terrariasFixedTiming; if (currentValue1 <= 162) { bool currentValue5 = false; uint currentValue6 = 0; Main.Configuration.Get("ThickMouseEdges", ref currentValue5); if (currentValue5) { Main.Configuration.Get("ThickMouseEdgesPackedColor", ref currentValue6); Main.MouseBorderColor.PackedValue = currentValue6; Main.mouseColor.R = Main.Configuration.Get("MouseColorR", Main.mouseColor.R); Main.mouseColor.G = Main.Configuration.Get("MouseColorG", Main.mouseColor.G); Main.mouseColor.B = Main.Configuration.Get("MouseColorB", Main.mouseColor.B); } } if (currentValue1 <= 162) { Main.Configuration.Get("KeyUp", ref Main.cUp); Main.Configuration.Get("KeyDown", ref Main.cDown); Main.Configuration.Get("KeyLeft", ref Main.cLeft); Main.Configuration.Get("KeyRight", ref Main.cRight); Main.Configuration.Get("KeyJump", ref Main.cJump); Main.Configuration.Get("KeyThrowItem", ref Main.cThrowItem); Main.Configuration.Get("KeyInventory", ref Main.cInv); Main.Configuration.Get("KeyQuickHeal", ref Main.cHeal); Main.Configuration.Get("KeyQuickMana", ref Main.cMana); Main.Configuration.Get("KeyQuickBuff", ref Main.cBuff); Main.Configuration.Get("KeyUseHook", ref Main.cHook); Main.Configuration.Get("KeyAutoSelect", ref Main.cTorch); Main.Configuration.Get("KeySmartCursor", ref Main.cSmart); Main.Configuration.Get("KeyMount", ref Main.cMount); Main.Configuration.Get("KeyMapStyle", ref Main.cMapStyle); Main.Configuration.Get("KeyFullscreenMap", ref Main.cMapFull); Main.Configuration.Get("KeyMapZoomIn", ref Main.cMapZoomIn); Main.Configuration.Get("KeyMapZoomOut", ref Main.cMapZoomOut); Main.Configuration.Get("KeyMapAlphaUp", ref Main.cMapAlphaUp); Main.Configuration.Get("KeyMapAlphaDown", ref Main.cMapAlphaDown); PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["Up"] = new List() { Main.cUp }; PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["Down"] = new List() { Main.cDown }; PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["Left"] = new List() { Main.cLeft }; PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["Right"] = new List() { Main.cRight }; PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["Jump"] = new List() { Main.cJump }; PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["Throw"] = new List() { Main.cThrowItem }; PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["Inventory"] = new List() { Main.cInv }; PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["QuickHeal"] = new List() { Main.cHeal }; PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["QuickMana"] = new List() { Main.cMana }; PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["QuickBuff"] = new List() { Main.cBuff }; PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["Grapple"] = new List() { Main.cHook }; PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["SmartSelect"] = new List() { Main.cTorch }; PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["SmartCursor"] = new List() { Main.cSmart }; PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["QuickMount"] = new List() { Main.cMount }; PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["MapStyle"] = new List() { Main.cMapStyle }; PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["MapFull"] = new List() { Main.cMapFull }; PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["MapZoomIn"] = new List() { Main.cMapZoomIn }; PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["MapZoomOut"] = new List() { Main.cMapZoomOut }; PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["MapAlphaUp"] = new List() { Main.cMapAlphaUp }; PlayerInput.CurrentProfile.InputModes[InputMode.Keyboard].KeyStatus["MapAlphaDown"] = new List() { Main.cMapAlphaDown }; } PlayerInput.Load(); if (currentValue1 < 165) { try { PlayerInput.ManageVersion_1_3(); } catch (Exception ex) { } } Main.mouseColorSlider.SetHSL(Main.mouseColor); Main.mouseBorderColorSlider.SetHSL(Main.MouseBorderColor); Main.mouseBorderColorSlider.Alpha = (float) Main.MouseBorderColor.A / (float) byte.MaxValue; if (currentValue1 == 230) return; Main.SaveSettings(); } } protected void OpenLegacySettings() { try { if (!File.Exists(Main.SavePath + Path.DirectorySeparatorChar.ToString() + "config.dat")) return; using (FileStream fileStream = new FileStream(Main.SavePath + Path.DirectorySeparatorChar.ToString() + "config.dat", FileMode.Open)) { using (BinaryReader binaryReader = new BinaryReader((Stream) fileStream)) { int num1 = binaryReader.ReadInt32(); if (num1 >= 68) { if (num1 >= 67) Main.clientUUID = binaryReader.ReadString(); bool fullscreen = binaryReader.ReadBoolean(); Main.mouseColor.R = binaryReader.ReadByte(); Main.mouseColor.G = binaryReader.ReadByte(); Main.mouseColor.B = binaryReader.ReadByte(); Main.soundVolume = binaryReader.ReadSingle(); if (num1 >= 90) Main.ambientVolume = binaryReader.ReadSingle(); Main.musicVolume = binaryReader.ReadSingle(); Main.cUp = binaryReader.ReadString(); Main.cDown = binaryReader.ReadString(); Main.cLeft = binaryReader.ReadString(); Main.cRight = binaryReader.ReadString(); Main.cJump = binaryReader.ReadString(); Main.cThrowItem = binaryReader.ReadString(); if (num1 >= 1) Main.cInv = binaryReader.ReadString(); if (num1 >= 12) { Main.cHeal = binaryReader.ReadString(); Main.cMana = binaryReader.ReadString(); Main.cBuff = binaryReader.ReadString(); } if (num1 >= 13) Main.cHook = binaryReader.ReadString(); Main.caveParallax = binaryReader.ReadSingle(); if (num1 >= 2) Main.terrariasFixedTiming = binaryReader.ReadBoolean(); if (num1 >= 91 && binaryReader.ReadBoolean()) ((Form) Control.FromHandle(this.Window.Handle)).WindowState = FormWindowState.Maximized; if (num1 >= 4) Main.SetDisplayMode(binaryReader.ReadInt32(), binaryReader.ReadInt32(), fullscreen); if (num1 >= 8) Main.autoSave = binaryReader.ReadBoolean(); if (num1 >= 9) Main.autoPause = binaryReader.ReadBoolean(); if (num1 >= 19) Main.showItemText = binaryReader.ReadBoolean(); if (num1 >= 30) { Main.cTorch = binaryReader.ReadString(); Lighting.Mode = (LightMode) binaryReader.ReadByte(); Main.qaStyle = (int) binaryReader.ReadByte(); } if (num1 >= 37) Main.BackgroundEnabled = binaryReader.ReadBoolean(); if (num1 >= 39) { byte num2 = binaryReader.ReadByte(); Main._needsLanguageSelect = num2 == (byte) 0; LanguageManager.Instance.SetLanguage((int) num2); } if (num1 >= 46) { Main.mapEnabled = binaryReader.ReadBoolean(); Main.cMapStyle = binaryReader.ReadString(); Main.cMapFull = binaryReader.ReadString(); Main.cMapZoomIn = binaryReader.ReadString(); Main.cMapZoomOut = binaryReader.ReadString(); Main.cMapAlphaUp = binaryReader.ReadString(); Main.cMapAlphaDown = binaryReader.ReadString(); } if (num1 >= 89) binaryReader.ReadInt32(); if (num1 >= 100) { Main.cSmart = binaryReader.ReadString(); Main.cSmartCursorModeIsToggleAndNotHold = binaryReader.ReadBoolean(); } if (num1 >= 107) Main.invasionProgressMode = (int) binaryReader.ReadByte(); if (num1 >= 111) Main.placementPreview = binaryReader.ReadBoolean(); if (num1 >= 111) Main.placementPreview = binaryReader.ReadBoolean(); Main.SetFullScreen(fullscreen); } binaryReader.Close(); } } } catch { } } private static void ErasePlayer(int i) { try { FileUtilities.Delete(Main.PlayerList[i].Path, Main.PlayerList[i].IsCloudSave); FileUtilities.Delete(Main.PlayerList[i].Path + ".bak", Main.PlayerList[i].IsCloudSave); } catch { } try { string path = Main.PlayerList[i].Path.Substring(0, Main.PlayerList[i].Path.Length - 4); if (path.Substring(path.Length - 1) != "." && path.Substring(path.Length - 1) != "\\" && Directory.Exists(path)) Directory.Delete(path, true); Main.LoadPlayers(); } catch { } } private static void EraseWorld(int i) { try { if (!Main.WorldList[i].IsCloudSave) { FileOperationAPIWrapper.MoveToRecycleBin(Main.WorldList[i].Path); FileOperationAPIWrapper.MoveToRecycleBin(Main.WorldList[i].Path + ".bak"); } else if (SocialAPI.Cloud != null) SocialAPI.Cloud.Delete(Main.WorldList[i].Path); Main.LoadWorlds(); } catch { } } public static string GetPlayerPathFromName(string playerName, bool cloudSave) { char[] invalidFileNameChars = Path.GetInvalidFileNameChars(); string str1 = ""; playerName = playerName.Replace(".", "_"); playerName = playerName.Replace("*", "_"); for (int index = 0; index < playerName.Length; ++index) { char ch1 = playerName[index]; char ch2 = !((IEnumerable) invalidFileNameChars).Contains(ch1) ? (ch1 != ' ' ? ch1 : '_') : '-'; str1 += ch2.ToString(); } string str2 = cloudSave ? Main.CloudPlayerPath : Main.PlayerPath; if (FileUtilities.GetFullPath(str2 + Path.DirectorySeparatorChar.ToString() + str1 + ".plr", cloudSave).StartsWith("\\\\.\\", StringComparison.Ordinal)) str1 += "_"; string str3 = str2; char directorySeparatorChar = Path.DirectorySeparatorChar; string str4 = directorySeparatorChar.ToString(); string str5 = str1; if (FileUtilities.Exists(str3 + str4 + str5 + ".plr", cloudSave)) { int num = 2; while (true) { object[] objArray = new object[5] { (object) str2, null, null, null, null }; directorySeparatorChar = Path.DirectorySeparatorChar; objArray[1] = (object) directorySeparatorChar.ToString(); objArray[2] = (object) str1; objArray[3] = (object) num; objArray[4] = (object) ".plr"; if (FileUtilities.Exists(string.Concat(objArray), cloudSave)) ++num; else break; } str1 += (string) (object) num; } string str6 = str2; directorySeparatorChar = Path.DirectorySeparatorChar; string str7 = directorySeparatorChar.ToString(); string str8 = str1; return str6 + str7 + str8 + ".plr"; } public static string GetWorldPathFromName(string worldName, bool cloudSave) { char[] invalidFileNameChars = Path.GetInvalidFileNameChars(); string str1 = worldName; string str2 = ""; for (int index = 0; index < str1.Length; ++index) { char ch1 = str1[index]; char ch2 = !((IEnumerable) invalidFileNameChars).Contains(ch1) ? (ch1 != ' ' ? ch1 : '_') : '-'; str2 += ch2.ToString(); } string str3 = str2.Replace(".", "_").Replace("*", "_"); string str4 = cloudSave ? Main.CloudWorldPath : Main.WorldPath; if (FileUtilities.GetFullPath(str4 + Path.DirectorySeparatorChar.ToString() + str3 + ".wld", cloudSave).StartsWith("\\\\.\\", StringComparison.Ordinal)) str3 += "_"; string str5 = str4; char directorySeparatorChar = Path.DirectorySeparatorChar; string str6 = directorySeparatorChar.ToString(); string str7 = str3; if (FileUtilities.Exists(str5 + str6 + str7 + ".wld", cloudSave)) { int num = 2; while (true) { object[] objArray = new object[5] { (object) str4, null, null, null, null }; directorySeparatorChar = Path.DirectorySeparatorChar; objArray[1] = (object) directorySeparatorChar.ToString(); objArray[2] = (object) str3; objArray[3] = (object) num; objArray[4] = (object) ".wld"; if (FileUtilities.Exists(string.Concat(objArray), cloudSave)) ++num; else break; } str3 += (string) (object) num; } string str8 = str4; directorySeparatorChar = Path.DirectorySeparatorChar; string str9 = directorySeparatorChar.ToString(); string str10 = str3; return str8 + str9 + str10 + ".wld"; } public void setServerWorldRollbacks(string rollBacksToKeep) => Main.WorldRollingBackupsCountToKeep = Convert.ToInt32(rollBacksToKeep); public void autoCreate(string worldSize) { if (worldSize == "0") Main.autoGen = false; else if (worldSize == "1") { Main.maxTilesX = 4200; Main.maxTilesY = 1200; Main.autoGen = true; } else if (worldSize == "2") { Main.maxTilesX = 6300; Main.maxTilesY = 1800; Main.autoGen = true; } else { if (!(worldSize == "3")) return; Main.maxTilesX = 8400; Main.maxTilesY = 2400; Main.autoGen = true; } } public void NewMOTD(string newMOTD) => Main.motd = newMOTD; public static string ConvertToSafeArgument(string arg) => Uri.EscapeDataString(arg); public static string ConvertFromSafeArgument(string arg) => Uri.UnescapeDataString(arg); public void LoadDedConfig(string configPath) { if (!File.Exists(configPath)) return; using (StreamReader streamReader = new StreamReader(configPath)) { string line; while ((line = streamReader.ReadLine()) != null) { try { if (line.Length > 6 && line.Substring(0, 6).ToLower() == "world=") { string str = line.Substring(6); Main.autoGenFileLocation = str; Main.ActiveWorldFileData = WorldFile.GetAllMetadata(Platform.Get().ExpandPathVariables(str), false); } if (line.Length > 5 && line.Substring(0, 5).ToLower() == "port=") { string str = line.Substring(5); try { Netplay.ListenPort = Convert.ToInt32(str); } catch { } } if (line.Length > 11 && line.Substring(0, 21).ToLower() == "worldrollbackstokeep=") { string str = line.Substring(21); try { Main.WorldRollingBackupsCountToKeep = Convert.ToInt32(str); } catch { } } if (line.Length > 11 && line.Substring(0, 11).ToLower() == "maxplayers=") { string str = line.Substring(11); try { Main.maxNetPlayers = Convert.ToInt32(str); } catch { } } if (line.Length > 11 && line.Substring(0, 9).ToLower() == "priority=" && !Program.LaunchParameters.ContainsKey("-forcepriority")) { string str = line.Substring(9); try { int int32 = Convert.ToInt32(str); switch (int32) { case 0: case 1: case 2: case 3: case 4: case 5: Process currentProcess = Process.GetCurrentProcess(); if (int32 == 0) { currentProcess.PriorityClass = ProcessPriorityClass.RealTime; break; } if (int32 == 1) { currentProcess.PriorityClass = ProcessPriorityClass.High; break; } if (int32 == 2) { currentProcess.PriorityClass = ProcessPriorityClass.AboveNormal; break; } if (int32 == 3) { currentProcess.PriorityClass = ProcessPriorityClass.Normal; break; } if (int32 == 4) { currentProcess.PriorityClass = ProcessPriorityClass.BelowNormal; break; } if (int32 == 5) { currentProcess.PriorityClass = ProcessPriorityClass.Idle; break; } break; } } catch { } } if (line.Length > 9 && line.Substring(0, 9).ToLower() == "password=") Netplay.ServerPassword = Main.ConvertFromSafeArgument(line.Substring(9)); if (line.Length > 5 && line.Substring(0, 5).ToLower() == "motd=") Main.motd = line.Substring(5); if (line.Length > 5 && line.Substring(0, 5).ToLower() == "lang=") { string str = line.Substring(5); LanguageManager.Instance.SetLanguage(Convert.ToInt32(str)); } if (line.Length > 5 && line.Substring(0, 5).ToLower() == "language=") { string cultureName = line.Substring(9); LanguageManager.Instance.SetLanguage(cultureName); } if (line.Length >= 10 && line.Substring(0, 10).ToLower() == "worldpath=") { string str = line.Substring(10); Main.WorldPath = Platform.Get().ExpandPathVariables(str); } if (line.Length >= 10 && line.Substring(0, 10).ToLower() == "worldname=") Main.worldName = line.Substring(10); if (line.Length >= 5 && line.Substring(0, 5).ToLower() == "seed=") Main.AutogenSeedName = line.Substring(5); if (line.Length > 8 && line.Substring(0, 8).ToLower() == "banlist=") { string str = line.Substring(8); Netplay.BanFilePath = Platform.Get().ExpandPathVariables(str); } if (line.Length > 11 && line.Substring(0, 11).ToLower() == "difficulty=") { string str = line.Substring(11); if (str == "0") Main.GameMode = 0; else if (str == "1") Main.GameMode = 1; else if (str == "2") Main.GameMode = 2; else if (str == "3") Main.GameMode = 3; } if (line.Length > 11 && line.Substring(0, 11).ToLower() == "autocreate=") { string str = line.Substring(11); if (str == "0") Main.autoGen = false; else if (str == "1") { Main.maxTilesX = 4200; Main.maxTilesY = 1200; Main.autoGen = true; } else if (str == "2") { Main.maxTilesX = 6300; Main.maxTilesY = 1800; Main.autoGen = true; } else if (str == "3") { Main.maxTilesX = 8400; Main.maxTilesY = 2400; Main.autoGen = true; } } if (line.Length > 7 && line.Substring(0, 7).ToLower() == "secure=" && line.Substring(7) == "1") Netplay.SpamCheck = true; if (line.Length > 5 && line.Substring(0, 5).ToLower() == "upnp=" && line.Substring(5) != "1") Netplay.UseUPNP = false; string str1 = "slowliquids="; if (line.Length > str1.Length && line.Substring(0, str1.Length).ToLower() == str1 && line.Substring(str1.Length) == "1") Main.Setting_UseReducedMaxLiquids = true; if (line.Length > 10 && line.Substring(0, 10).ToLower() == "npcstream=") { string str2 = line.Substring(10); try { Main.npcStreamSpeed = Convert.ToInt32(str2); } catch { } } CreativePowerManager.TryListingPermissionsFrom(line); } catch { } } } } public void SetNetPlayers(int mPlayers) => Main.maxNetPlayers = mPlayers; public void SetWorld(string world, bool cloud) => Main.ActiveWorldFileData = WorldFile.GetAllMetadata(world, cloud); public void SetWorldName(string world) => Main.worldName = world; public void EnableAutoShutdown() => Main.autoShutdown = true; [DllImport("user32.dll")] public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); [DllImport("user32.dll")] private static extern bool ShowWindow(IntPtr hWnd, int nCmdShow); public void AutoPass() => Main.autoPass = true; public void AutoJoin(string IP) { Main.defaultIP = IP; Main.getIP = IP; Netplay.SetRemoteIP(Main.defaultIP); Main.autoJoin = true; } public void AutoHost() { Main.menuMultiplayer = true; Main.menuServer = true; Main.ClearPendingPlayerSelectCallbacks(); Main.menuMode = 1; } public void loadLib(string path) { Main.libPath = path; Main.LoadLibrary(Main.libPath); } public void NeverSleep() => this.previousExecutionState = Main.NativeMethods.SetThreadExecutionState(2147483649U); public void YouCanSleepNow() { if (this.previousExecutionState == 0U) return; int num = (int) Main.NativeMethods.SetThreadExecutionState(this.previousExecutionState); } public void DedServ() { this.NeverSleep(); Main.rand = new UnifiedRandom(); if (Main.autoShutdown) { string lpWindowName = "terraria" + (object) Main.rand.Next(int.MaxValue); Console.Title = lpWindowName; IntPtr window = Main.FindWindow((string) null, lpWindowName); if (window != IntPtr.Zero) Main.ShowWindow(window, 0); } else Console.Title = "Terraria Server " + Main.versionNumber2; Main.dedServ = true; Main.showSplash = false; this.Initialize(); label_126: if (Main.worldPathName != null) goto label_127; label_5: bool flag1 = true; while (flag1) { Main.LoadWorlds(); Console.WriteLine(Language.GetTextValue("CLI.Server", (object) Main.versionNumber2)); Console.WriteLine(""); for (int index = 0; index < Main.WorldList.Count; ++index) Console.WriteLine((index + 1).ToString() + "\t\t" + Main.WorldList[index].Name); string textValue1 = Language.GetTextValue("CLI.NewWorld_Command"); string textValue2 = Language.GetTextValue("CLI.DeleteWorld_Example"); int num1 = (Math.Max(Main.newWorldName.Length, textValue2.Length) + 1) / 8 + 1; string str1 = textValue1 + new string('\t', num1 - textValue1.Length / 8) + Language.GetTextValue("CLI.NewWorld_Description"); string str2 = textValue2 + new string('\t', num1 - textValue2.Length / 8) + Language.GetTextValue("CLI.DeleteWorld_Description"); Console.WriteLine(str1); Console.WriteLine(str2); Console.WriteLine(""); Console.Write(Language.GetTextValue("CLI.ChooseWorld")); string str3 = Console.ReadLine() ?? ""; try { Console.Clear(); } catch { } if (str3.StartsWith(Language.GetTextValue("CLI.DeleteWorld_Command") + " ")) { try { int length = Language.GetTextValue("CLI.DeleteWorld_Command").Length; int num2 = Convert.ToInt32(str3.Substring(length + 1)) - 1; if (num2 < Main.WorldList.Count) { Console.WriteLine(Language.GetTextValue("CLI.Server", (object) Main.versionNumber2)); Console.WriteLine(""); Console.WriteLine(Language.GetTextValue("CLI.DeleteConfirmation", (object) Main.WorldList[num2].Name)); Console.Write("({0}/{1}): ", (object) Language.GetTextValue("CLI.ShortYes"), (object) Language.GetTextValue("CLI.ShortNo")); if (Console.ReadLine().ToLower() == Language.GetTextValue("CLI.ShortYes").ToLower()) Main.EraseWorld(num2); } } catch { } try { Console.Clear(); } catch { } } else { if (!(str3 == "n")) { if (!(str3 == "N")) { try { int index = Convert.ToInt32(str3) - 1; if (index >= 0) { if (index < Main.WorldList.Count) { bool flag2 = true; while (flag2) { Console.WriteLine(Language.GetTextValue("CLI.Server", (object) Main.versionNumber2)); Console.WriteLine(""); Console.Write(Language.GetTextValue("CLI.SetInitialMaxPlayers")); string str4 = Console.ReadLine(); try { if (str4 == "") str4 = "16"; int int32 = Convert.ToInt32(str4); if (int32 <= (int) byte.MaxValue && int32 >= 1) { Main.maxNetPlayers = int32; flag2 = false; } flag2 = false; } catch { } try { Console.Clear(); } catch { } } bool flag3 = true; while (flag3) { Console.WriteLine(Language.GetTextValue("CLI.Server", (object) Main.versionNumber2)); Console.WriteLine(""); Console.Write(Language.GetTextValue("CLI.SetInitialPort")); string str5 = Console.ReadLine(); try { if (str5 == "") str5 = "7777"; int int32 = Convert.ToInt32(str5); if (int32 <= (int) ushort.MaxValue) { Netplay.ListenPort = int32; flag3 = false; } } catch { } try { Console.Clear(); } catch { } } bool flag4 = true; while (flag4) { Console.WriteLine(Language.GetTextValue("CLI.Server", (object) Main.versionNumber2)); Console.WriteLine(""); Console.Write(Language.GetTextValue("CLI.AutomaticPortForward", (object) Language.GetTextValue("CLI.ShortYes"), (object) Language.GetTextValue("CLI.ShortNo"))); string str6 = Console.ReadLine(); try { if (str6 == "" || str6.ToLower() == Language.GetTextValue("CLI.ShortYes").ToLower() || str6.ToLower() == Language.GetTextValue("CLI.Yes").ToLower()) { Netplay.UseUPNP = true; flag4 = false; } else { if (!(str6.ToLower() == Language.GetTextValue("CLI.ShortNo").ToLower())) { if (!(str6.ToLower() == Language.GetTextValue("CLI.No").ToLower())) goto label_117; } Netplay.UseUPNP = false; flag4 = false; } } catch { } label_117: try { Console.Clear(); } catch { } } Console.WriteLine(Language.GetTextValue("CLI.Server", (object) Main.versionNumber2)); Console.WriteLine(""); Console.Write(Language.GetTextValue("CLI.EnterServerPassword")); Netplay.ServerPassword = Console.ReadLine(); Main.ActiveWorldFileData = Main.WorldList[index]; flag1 = false; try { Console.Clear(); continue; } catch { continue; } } else continue; } else continue; } catch { continue; } } } bool flag5 = true; while (flag5) { Console.WriteLine(Language.GetTextValue("CLI.Server", (object) Main.versionNumber2)); Console.WriteLine(""); Console.WriteLine("1\t" + Language.GetTextValue("UI.WorldSizeSmall")); Console.WriteLine("2\t" + Language.GetTextValue("UI.WorldSizeMedium")); Console.WriteLine("3\t" + Language.GetTextValue("UI.WorldSizeLarge")); Console.WriteLine(""); Console.Write(Language.GetTextValue("CLI.ChooseSize")); string str7 = Console.ReadLine(); try { switch (Convert.ToInt32(str7)) { case 1: Main.maxTilesX = 4200; Main.maxTilesY = 1200; flag5 = false; break; case 2: Main.maxTilesX = 6400; Main.maxTilesY = 1800; flag5 = false; break; case 3: Main.maxTilesX = 8400; Main.maxTilesY = 2400; flag5 = false; break; } } catch { } try { Console.Clear(); } catch { } } bool flag6 = true; while (flag6) { Console.WriteLine(Language.GetTextValue("CLI.Server", (object) Main.versionNumber2)); Console.WriteLine(""); Console.WriteLine("1\t" + Language.GetTextValue("UI.Normal")); Console.WriteLine("2\t" + Language.GetTextValue("UI.Expert")); Console.WriteLine("3\t" + Language.GetTextValue("UI.Master")); Console.WriteLine("4\t" + Language.GetTextValue("UI.Creative")); Console.WriteLine(""); Console.Write(Language.GetTextValue("CLI.ChooseDifficulty")); string str8 = Console.ReadLine(); try { switch (Convert.ToInt32(str8)) { case 1: Main.GameMode = 0; flag6 = false; break; case 2: Main.GameMode = 1; flag6 = false; break; case 3: Main.GameMode = 2; flag6 = false; break; case 4: Main.GameMode = 3; flag6 = false; break; } } catch { } try { Console.Clear(); } catch { } } if (Main.SettingsUnlock_WorldEvil) { bool flag7 = true; while (flag7) { Console.WriteLine(Language.GetTextValue("CLI.Server", (object) Main.versionNumber2)); Console.WriteLine(""); Console.WriteLine("1\t" + Language.GetTextValue("CLI.Random")); Console.WriteLine("2\t" + Language.GetTextValue("CLI.Corrupt")); Console.WriteLine("3\t" + Language.GetTextValue("CLI.Crimson")); Console.WriteLine(""); Console.Write(Language.GetTextValue("CLI.ChooseEvil")); string str9 = Console.ReadLine(); try { switch (Convert.ToInt32(str9)) { case 1: WorldGen.WorldGenParam_Evil = -1; flag7 = false; break; case 2: WorldGen.WorldGenParam_Evil = 0; flag7 = false; break; case 3: WorldGen.WorldGenParam_Evil = 1; flag7 = false; break; } } catch { } try { Console.Clear(); } catch { } } } bool flag8 = true; while (flag8) { Console.WriteLine(Language.GetTextValue("CLI.Server", (object) Main.versionNumber2)); Console.WriteLine(""); Console.Write(Language.GetTextValue("CLI.EnterWorldName")); Main.newWorldName = Console.ReadLine(); if (Main.newWorldName != "" && Main.newWorldName != " " && Main.newWorldName != null) flag8 = false; try { Console.Clear(); } catch { } } string str10 = ""; bool flag9 = true; while (flag9) { Console.WriteLine(Language.GetTextValue("CLI.Server", (object) Main.versionNumber2)); Console.WriteLine(""); Console.Write(Language.GetTextValue("CLI.EnterSeed")); str10 = Console.ReadLine(); if (str10 != null) flag9 = false; else str10 = ""; try { Console.Clear(); } catch { } } Main.worldName = Main.newWorldName; Main.ActiveWorldFileData = WorldFile.CreateMetadata(Main.worldName, SocialAPI.Cloud != null && SocialAPI.Cloud.EnabledByDefault, Main.GameMode); string seedText = str10.Trim(); if (seedText.Length == 0) Main.ActiveWorldFileData.SetSeedToRandom(); else Main.ActiveWorldFileData.SetSeed(seedText); Main.menuMode = 10; GenerationProgress progress = new GenerationProgress(); Task newWorld = WorldGen.CreateNewWorld(progress); while (Main.menuMode == 10) { if (Main.oldStatusText != Main.statusText && !WorldGen.drunkWorldGen) { Main.oldStatusText = Main.statusText; Console.WriteLine(Main.statusText); } } try { Console.Clear(); } catch { } while (!newWorld.IsCompleted) { Main.statusText = string.Format("{0:0.0%} - " + progress.Message + " - {1:0.0%}", (object) progress.TotalProgress, (object) progress.Value); if (Main.oldStatusText != Main.statusText) { Main.oldStatusText = Main.statusText; Console.WriteLine(Main.statusText); } } } } goto label_126; label_127: if (!(Main.worldPathName == "")) { try { Console.Clear(); } catch { } Task task = WorldGen.serverLoadWorld(); Console.WriteLine(Language.GetTextValue("CLI.Server", (object) Main.versionNumber)); Console.WriteLine(""); while (!task.IsCompleted) { if (WorldFile.LastThrownLoadException == null) { if ((double) Main.AutogenProgress.TotalProgress != 0.0) Main.statusText = string.Format("{0:0.0%} - " + Main.AutogenProgress.Message + " - {1:0.0%}", (object) Main.AutogenProgress.TotalProgress, (object) Main.AutogenProgress.Value); if (Main.oldStatusText != Main.statusText) { Main.oldStatusText = Main.statusText; Console.WriteLine(Main.statusText); } } } try { if (WorldFile.LastThrownLoadException == null) Console.Clear(); } catch { } if (WorldGen.loadFailed || !WorldGen.loadSuccess) { Main.WriteFancyWorldLoadErrorToConsole(); if (!Main.autoShutdown) Console.ReadKey(); this.YouCanSleepNow(); } else { Console.WriteLine(Language.GetTextValue("CLI.Server", (object) Main.versionNumber)); Console.WriteLine(""); Console.WriteLine(Language.GetTextValue("CLI.ListeningOnPort", (object) Netplay.ListenPort)); Console.WriteLine(Language.GetTextValue("CLI.HelpHint")); Console.WriteLine(""); Console.Title = "Terraria Server: " + Main.worldName; Stopwatch stopwatch = new Stopwatch(); if (!Main.autoShutdown) Main.startDedInput(); stopwatch.Start(); double num3 = 50.0 / 3.0; double num4 = 0.0; int num5 = 0; new Stopwatch().Start(); Netplay.StartServer(); Main.gameMenu = false; while (!Netplay.Disconnect) { TimeSpan elapsed = stopwatch.Elapsed; double totalMilliseconds = elapsed.TotalMilliseconds; if (totalMilliseconds + num4 >= num3) { ++num5; num4 += totalMilliseconds - num3; stopwatch.Reset(); stopwatch.Start(); if (Main.oldStatusText != Main.statusText) { Main.oldStatusText = Main.statusText; Console.WriteLine(Main.statusText); } if (Netplay.HasClients) this.Update(new GameTime()); else if (Main.saveTime.IsRunning) Main.saveTime.Stop(); if (Main.OnTickForThirdPartySoftwareOnly != null) Main.OnTickForThirdPartySoftwareOnly(); elapsed = stopwatch.Elapsed; double num6 = elapsed.TotalMilliseconds + num4; if (num6 < num3) { int num7 = (int) (num3 - num6) - 1; if (num7 > 1) { Thread.Sleep(num7 - 1); if (!Netplay.HasClients) { num4 = 0.0; Thread.Sleep(10); } } } } Thread.Sleep(0); } this.YouCanSleepNow(); } } else goto label_5; } private static void WriteFancyWorldLoadErrorToConsole() { Console.WriteLine(); Console.WriteLine(WorldFile.LastThrownLoadException.ToString()); } public static void startDedInput() => new Thread(new ThreadStart(Main.startDedInputCallBack)) { IsBackground = true, Name = "Server Input Thread" }.Start(); public static void startDedInputCallBack() { while (!Netplay.Disconnect) { Console.Write(": "); string str1 = Console.ReadLine(); string str2 = str1; string lower1 = str1.ToLower(); try { if (lower1 == Language.GetTextValue("CLI.Help_Command")) { Console.WriteLine(Language.GetTextValue("CLI.AvailableCommands")); Console.WriteLine(""); List stringList = new List() { "Help", "Playing", "Clear", "Exit", "ExitNoSave", "Save", "Kick", "Ban", "Password", "SetPassword", "Version", "Time", "Port", "MaxPlayers", "Say", "MOTD", "SetMOTD", "Dawn", "Noon", "Dusk", "Midnight", "Settle", "Seed" }; int num1 = 0; for (int index = 0; index < stringList.Count; ++index) { string str3 = Language.Exists("CLI." + stringList[index] + "_Example") ? Language.GetTextValue("CLI." + stringList[index] + "_Example") : Language.GetTextValue("CLI." + stringList[index] + "_Command"); if (str3.Length > num1) num1 = str3.Length; } int num2 = (num1 + 1) / 8; for (int index = 0; index < stringList.Count; ++index) { string str4 = Language.Exists("CLI." + stringList[index] + "_Example") ? Language.GetTextValue("CLI." + stringList[index] + "_Example") : Language.GetTextValue("CLI." + stringList[index] + "_Command"); Console.WriteLine(str4 + new string('\t', num2 - str4.Length / 8) + Language.GetTextValue("CLI." + stringList[index] + "_Description")); } } else if (lower1 == Language.GetTextValue("CLI.Settle_Command")) { if (!Terraria.Liquid.panicMode) Terraria.Liquid.StartPanic(); else Console.WriteLine(Language.GetTextValue("CLI.WaterIsAlreadySettling")); } else if (lower1 == Language.GetTextValue("CLI.Dawn_Command")) { Main.dayTime = true; Main.time = 0.0; NetMessage.SendData(7); } else if (lower1 == Language.GetTextValue("CLI.Dusk_Command")) { Main.dayTime = false; Main.time = 0.0; NetMessage.SendData(7); } else if (lower1 == Language.GetTextValue("CLI.Noon_Command")) { Main.dayTime = true; Main.time = 27000.0; NetMessage.SendData(7); } else if (lower1 == Language.GetTextValue("CLI.Midnight_Command")) { Main.dayTime = false; Main.time = 16200.0; NetMessage.SendData(7); } else if (lower1 == Language.GetTextValue("CLI.ExitNoSave_Command")) Netplay.Disconnect = true; else if (lower1 == Language.GetTextValue("CLI.Exit_Command")) { WorldFile.SaveWorld(); Netplay.Disconnect = true; SocialAPI.Shutdown(); } else if (lower1 == Language.GetTextValue("CLI.FPS_Command")) { if (!Main.dedServFPS) { Main.dedServFPS = true; Main.fpsTimer.Reset(); } else { Main.dedServCount1 = 0; Main.dedServCount2 = 0; Main.dedServFPS = false; } } else if (lower1 == Language.GetTextValue("CLI.Save_Command")) WorldFile.SaveWorld(); else if (lower1 == Language.GetTextValue("CLI.Time_Command")) { string textValue = Language.GetTextValue("GameUI.TimeAtMorning"); double time = Main.time; if (!Main.dayTime) time += 54000.0; double num3 = time / 86400.0 * 24.0 - 7.5 - 12.0; if (num3 < 0.0) num3 += 24.0; if (num3 >= 12.0) textValue = Language.GetTextValue("GameUI.TimePastMorning"); int num4 = (int) num3; double num5 = (double) (int) ((num3 - (double) num4) * 60.0); string str5 = string.Concat((object) num5); if (num5 < 10.0) str5 = "0" + str5; if (num4 > 12) num4 -= 12; if (num4 == 0) num4 = 12; Console.WriteLine(Language.GetTextValue("CLI.Time", (object) (num4.ToString() + ":" + str5 + " " + textValue))); } else if (lower1 == Language.GetTextValue("CLI.MaxPlayers_Command")) Console.WriteLine(Language.GetTextValue("CLI.PlayerLimit", (object) Main.maxNetPlayers)); else if (lower1 == Language.GetTextValue("CLI.Port_Command")) Console.WriteLine(Language.GetTextValue("CLI.Port", (object) Netplay.ListenPort)); else if (lower1 == Language.GetTextValue("CLI.Version_Command")) Console.WriteLine(Language.GetTextValue("CLI.Server", (object) Main.versionNumber)); else if (lower1 == Language.GetTextValue("CLI.Clear_Command")) { try { Console.Clear(); } catch { } } else if (lower1 == Language.GetTextValue("CLI.Playing_Command")) { int num = 0; for (int index = 0; index < (int) byte.MaxValue; ++index) { if (Main.player[index].active) { ++num; Console.WriteLine(Main.player[index].name + " (" + (object) Netplay.Clients[index].Socket.GetRemoteAddress() + ")"); } } switch (num) { case 0: Console.WriteLine(Language.GetTextValue("CLI.NoPlayers")); continue; case 1: Console.WriteLine(Language.GetTextValue("CLI.OnePlayerConnected")); continue; default: Console.WriteLine(Language.GetTextValue("CLI.PlayersConnected", (object) num)); continue; } } else if (!(lower1 == "")) { if (lower1 == Language.GetTextValue("CLI.MOTD_Command")) { if (Main.motd == "") Console.WriteLine(Language.GetTextValue("CLI.NoMOTD", (object) Main.worldName)); else Console.WriteLine(Language.GetTextValue("CLI.MOTD", (object) Main.motd)); } else if (lower1.StartsWith(Language.GetTextValue("CLI.SetMOTD_Command") + " ")) Main.motd = str2.Substring(Language.GetTextValue("CLI.SetMOTD_Command").Length + 1); else if (lower1 == Language.GetTextValue("CLI.Password_Command")) { if (Netplay.ServerPassword == "") Console.WriteLine(Language.GetTextValue("CLI.NoPassword")); else Console.WriteLine(Language.GetTextValue("CLI.Password", (object) Netplay.ServerPassword)); } else if (lower1.StartsWith(Language.GetTextValue("CLI.SetPassword_Command") + " ")) { string str6 = str2.Substring(Language.GetTextValue("CLI.SetPassword_Command").Length + 1); if (str6 == "") { Netplay.ServerPassword = ""; Console.WriteLine(Language.GetTextValue("CLI.PasswordDisabled")); } else { Netplay.ServerPassword = str6; Console.WriteLine(Language.GetTextValue("CLI.PasswordSet", (object) Netplay.ServerPassword)); } } else if (lower1 == Language.GetTextValue("CLI.Say_Command")) Console.WriteLine(Language.GetTextValue("CLI.Say_Usage")); else if (lower1.StartsWith(Language.GetTextValue("CLI.Say_Command") + " ")) { int length = Language.GetTextValue("CLI.Say_Command").Length; if (lower1.Length <= length + 1) { Console.WriteLine(Language.GetTextValue("CLI.Say_Usage")); } else { string str7 = str2.Substring(length + 1); Console.WriteLine(Language.GetTextValue("CLI.ServerMessage", (object) str7)); ChatHelper.BroadcastChatMessage(NetworkText.FromKey("CLI.ServerMessage", (object) str7), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, 240, 20)); } } else if (lower1 == Language.GetTextValue("CLI.Kick_Command")) Console.WriteLine(Language.GetTextValue("CLI.Kick_Usage")); else if (lower1.StartsWith(Language.GetTextValue("CLI.Kick_Command") + " ")) { int length = Language.GetTextValue("CLI.Kick_Command").Length; if (lower1.Length <= length + 1) { Console.WriteLine(Language.GetTextValue("CLI.Kick_Usage")); } else { string lower2 = lower1.Substring(length + 1).ToLower(); for (int remoteClient = 0; remoteClient < (int) byte.MaxValue; ++remoteClient) { if (Main.player[remoteClient].active && Main.player[remoteClient].name.ToLower() == lower2) NetMessage.SendData(2, remoteClient, text: NetworkText.FromKey("CLI.KickMessage")); } } } else if (lower1 == Language.GetTextValue("CLI.Seed_Command")) { if (Main.ActiveWorldFileData == null || !Main.ActiveWorldFileData.HasValidSeed) Console.WriteLine(Language.GetTextValue("CLI.NoValidSeed")); else Console.WriteLine(Language.GetTextValue("CLI.DisplaySeed", (object) Main.ActiveWorldFileData.GetFullSeedText())); } else if (lower1 == Language.GetTextValue("CLI.Ban_Command")) Console.WriteLine(Language.GetTextValue("CLI.Ban_Usage")); else if (lower1.StartsWith(Language.GetTextValue("CLI.Ban_Command") + " ")) { int length = Language.GetTextValue("CLI.Ban_Command").Length; if (lower1.Length <= length + 1) { Console.WriteLine(Language.GetTextValue("CLI.Ban_Usage")); } else { string lower3 = lower1.Substring(4).ToLower(); for (int index = 0; index < (int) byte.MaxValue; ++index) { if (Main.player[index].active && Main.player[index].name.ToLower() == lower3) { Netplay.AddBan(index); NetMessage.SendData(2, index, text: NetworkText.FromKey("CLI.BanMessage")); } } } } else Console.WriteLine(Language.GetTextValue("CLI.InvalidCommand")); } } catch { Console.WriteLine(Language.GetTextValue("CLI.InvalidCommand")); } } } public static void Sundialing() { if (Main.sundialCooldown != 0) return; if (Main.netMode == 1) { NetMessage.SendData(51, number: Main.myPlayer, number2: 3f); } else { Main.fastForwardTime = true; Main.sundialCooldown = 8; NetMessage.SendData(7); } } public static void UpdateTimeRate() { if (Main.fastForwardTime) { Main.dayRate = 60; Main.desiredWorldTilesUpdateRate = 1; } else { int num1 = CreativePowerManager.Instance.GetPower().Enabled ? 1 : 0; int targetTimeRate = CreativePowerManager.Instance.GetPower().TargetTimeRate; bool flag = Main.CurrentFrameFlags.SleepingPlayersCount == Main.CurrentFrameFlags.ActivePlayersCount && Main.CurrentFrameFlags.SleepingPlayersCount > 0; int num2 = targetTimeRate; if (!Main.gameMenu & flag) num2 *= 5; if (num1 != 0) num2 = 0; Main.dayRate = num2; Main.desiredWorldTilesUpdateRate = num2; } } public Main() { Main.instance = this; Main.UnpausedUpdateSeed = (ulong) Guid.NewGuid().GetHashCode(); Main.Configuration.Load(); Main.graphics = new GraphicsDeviceManager(this as Game); this.Content.RootDirectory = "Content"; } private static void SetDisplayMonitor() { Main.Configuration.Get("Display", ""); Main.graphics.PreparingDeviceSettings += new EventHandler(Main.SetMonitorOnce); } private static void SetMonitorOnce(object sender, PreparingDeviceSettingsEventArgs e) { string displayName = Main.Configuration.Get("Display", ""); GraphicsAdapter graphicsAdapter = GraphicsAdapter.Adapters.Where((Func) (adapter => adapter.DeviceName == displayName)).FirstOrDefault(); if (graphicsAdapter != null) e.GraphicsDeviceInformation.Adapter = graphicsAdapter; Main.graphics.PreparingDeviceSettings -= new EventHandler(Main.SetMonitorOnce); } protected void SetTitle() { this._cachedTitle = Lang.GetRandomGameTitle(); Platform.Get().SetUnicodeTitle(this.Window, this._cachedTitle); } private static void SetTileValue() { Main.tileOreFinderPriority[28] = (short) 100; Main.tileOreFinderPriority[407] = (short) 150; Main.tileOreFinderPriority[404] = (short) 150; Main.tileOreFinderPriority[7] = (short) 200; Main.tileOreFinderPriority[166] = (short) 210; Main.tileOreFinderPriority[6] = (short) 220; Main.tileOreFinderPriority[167] = (short) 230; Main.tileOreFinderPriority[9] = (short) 240; Main.tileOreFinderPriority[168] = (short) 250; Main.tileOreFinderPriority[8] = (short) 260; Main.tileOreFinderPriority[169] = (short) 270; Main.tileOreFinderPriority[22] = (short) 300; Main.tileOreFinderPriority[204] = (short) 310; Main.tileOreFinderPriority[37] = (short) 400; Main.tileOreFinderPriority[21] = (short) 500; Main.tileOreFinderPriority[467] = (short) 500; Main.tileOreFinderPriority[441] = (short) 500; Main.tileOreFinderPriority[468] = (short) 500; Main.tileOreFinderPriority[107] = (short) 600; Main.tileOreFinderPriority[221] = (short) 610; Main.tileOreFinderPriority[108] = (short) 620; Main.tileOreFinderPriority[222] = (short) 630; Main.tileOreFinderPriority[111] = (short) 640; Main.tileOreFinderPriority[223] = (short) 650; Main.tileOreFinderPriority[211] = (short) 700; Main.tileOreFinderPriority[227] = (short) 750; Main.tileOreFinderPriority[12] = (short) 800; Main.tileOreFinderPriority[236] = (short) 810; } private static void ResetGameCounter() => Main._gameUpdateCount = 0U; protected override void Initialize() { Main.musicFade[50] = 1f; for (int index = 0; index < 10; ++index) { Main.recentWorld[index] = ""; Main.recentIP[index] = ""; Main.recentPort[index] = 0; } if (Main.rand == null) Main.rand = new UnifiedRandom((int) DateTime.Now.Ticks); this.SetTitle(); Main.lo = Main.rand.Next(6); this.waterfallManager = new WaterfallManager(); Main._windowMover = new WindowStateController(); Main.sittingManager = new AnchoredEntitiesCollection(); Main.sleepingManager = new AnchoredEntitiesCollection(); Main.gameTips = new GameTipsDisplay(); if (Main.player[Main.myPlayer] == null) Main.player[Main.myPlayer] = new Player(); ContentSamples.Initialize(); PlayerInput.Initialize(); Main.player[Main.myPlayer] = new Player(); WorldGen.Hooks.OnWorldLoad += (Action) (() => { Main.AmbienceServer = new AmbienceServer(); Main.LocalGolfState = new GolfState(); Lighting.Clear(); }); PlayerInput.OnActionableInput += (Action) (() => { if (Main.LocalGolfState == null) return; Main.LocalGolfState.CancelBallTracking(); }); Main.SceneMetrics = new SceneMetrics(Main.ActiveWorld); TimeLogger.Initialize(); this.LoadContent_TryEnteringHiDef(); this.ClientInitialize(); base.Initialize(); } private void Initialize_AlmostEverything() { this.TilePaintSystem = new TilePaintSystemV2(); this.TilesRenderer = new TileDrawing(this.TilePaintSystem); this.WallsRenderer = new WallDrawing(this.TilePaintSystem); CreativePowerManager.Initialize(); Main.LocalFavoriteData.Load(); Main.CloudFavoritesData.Load(); this.Initialize_Entities(); Main.FindAnnouncementBoxStatus(); CustomCurrencyManager.Initialize(); WingStatsInitializer.Load(); TileObjectData.Initialize(); Animation.Initialize(); Chest.Initialize(); Wiring.Initialize(); Framing.Initialize(); ItemRarity.Initialize(); TileEntity.InitializeAll(); Projectile.InitializeStaticThings(); TorchID.Initialize(); Main.InitializeItemAnimations(); BestiaryDatabase database1 = new BestiaryDatabase(); new BestiaryDatabaseNPCsPopulator().Populate(database1); Main.BestiaryDB = database1; ContentSamples.RebuildBestiarySortingIDsByBestiaryDatabaseContents(database1); Main.BestiaryTracker = new BestiaryUnlocksTracker(); ItemDropDatabase database2 = new ItemDropDatabase(); database2.Populate(); Main.ItemDropsDB = database2; database1.Merge(Main.ItemDropsDB); Main.PylonSystem = new TeleportPylonsSystem(); Main.ItemDropSolver = new ItemDropResolver(database2); Main.ShopHelper = new ShopHelper(); CreativeItemSacrificesCatalog.Instance.Initialize(); Main.BestiaryUI = new UIBestiaryTest(Main.BestiaryDB); Main.ContentThatNeedsRenderTargets.Add((INeedRenderTargetContent) Main.MapPlayerRenderer); Lighting.Initialize(); MapHelper.Initialize(); WorldGen.RandomizeBackgrounds(Main.rand); if (Main.treeBGSet1[0] == 173) WorldGen.RandomizeBackgrounds(Main.rand); if (Main.treeBGSet1[0] == 173) WorldGen.RandomizeBackgrounds(Main.rand); WorldGen.RandomizeCaveBackgrounds(); WorldGen.Hooks.Initialize(); WorldGen.Hooks.OnWorldLoad += new Action(Main.ResetGameCounter); Main.bgAlphaFrontLayer[0] = 1f; Main.bgAlphaFarBackLayer[0] = 1f; this.invBottom = 258; Main.Initialize_TileAndNPCData1(); Main.Initialize_TileAndNPCData2(); Main.Initialize_Items(); for (int index = 0; index < Recipe.maxRecipes; ++index) { Main.recipe[index] = new Recipe(); Main.availableRecipeY[index] = (float) (65 * index); } Recipe.SetupRecipes(); ContentSamples.FixItemsAfterRecipesAreAdded(); for (int index = 0; index < Terraria.Liquid.maxLiquid; ++index) Main.liquid[index] = new Terraria.Liquid(); for (int index = 0; index < 50000; ++index) Main.liquidBuffer[index] = new LiquidBuffer(); this.shop[0] = new Chest(); Chest.SetupTravelShop(); for (int type = 1; type < 100; ++type) { this.shop[type] = new Chest(); this.shop[type].SetupShop(type); } Main.teamColor[0] = Microsoft.Xna.Framework.Color.White; Main.teamColor[1] = new Microsoft.Xna.Framework.Color(218, 59, 59); Main.teamColor[2] = new Microsoft.Xna.Framework.Color(59, 218, 85); Main.teamColor[3] = new Microsoft.Xna.Framework.Color(59, 149, 218); Main.teamColor[4] = new Microsoft.Xna.Framework.Color(242, 221, 100); Main.teamColor[5] = new Microsoft.Xna.Framework.Color(224, 100, 242); for (int Type = 1; Type < 950; ++Type) { Projectile projectile = new Projectile(); projectile.SetDefaults(Type); if (projectile.hostile) Main.projHostile[Type] = true; if (projectile.aiStyle == 7) Main.projHook[Type] = true; } Netplay.Initialize(); NetworkInitializer.Load(); ChatInitializer.Load(); if (Main.menuMode == 1) Main.LoadPlayers(); if (Main.skipMenu) { WorldGen.clearWorld(); Main.gameMenu = false; Main.LoadPlayers(); Main.PlayerList[0].SetAsActive(); Main.LoadWorlds(); WorldGen.GenerateWorld(new UnifiedRandom().Next()); WorldGen.EveryTileFrame(); Main.player[Main.myPlayer].Spawn(PlayerSpawnContext.SpawningIntoWorld); Main.ActivePlayerFileData.StartPlayTimer(); Player.Hooks.EnterWorld(Main.myPlayer); } else { IntPtr systemMenu = Main.GetSystemMenu(this.Window.Handle, false); Main.RemoveMenu(systemMenu, Main.GetMenuItemCount(systemMenu) - 1, 1024); } SoundID.FillAccessMap(); Star.SpawnStars(); ItemSorting.SetupWhiteLists(); } private void Initialize_Entities() { for (int index = 0; index < Main.maxMenuItems; ++index) this.menuItemScale[index] = 0.8f; for (int index = 0; index < 6001; ++index) { Main.dust[index] = new Dust(); Main.dust[index].dustIndex = index; } for (int index = 0; index < 401; ++index) Main.item[index] = new Item(); for (int index = 0; index < 201; ++index) { Main.npc[index] = new NPC(); Main.npc[index].whoAmI = index; } for (int index = 0; index < 256; ++index) Main.player[index] = new Player(); for (int index = 0; index < 1001; ++index) Main.projectile[index] = new Projectile(); for (int index = 0; index < 601; ++index) Main.gore[index] = new Gore(); for (int index = 0; index < Main.maxRain + 1; ++index) Main.rain[index] = new Rain(); for (int index = 0; index < 200; ++index) Main.cloud[index] = new Cloud(); for (int index = 0; index < 100; ++index) Main.combatText[index] = new CombatText(); for (int index = 0; index < 20; ++index) Main.popupText[index] = new PopupText(); } private static void Initialize_Items() { for (int Type = 0; Type < 5045; ++Type) { Item obj = new Item(); obj.SetDefaults(Type); if (obj.headSlot > 0) Item.headType[obj.headSlot] = obj.type; if (obj.bodySlot > 0) Item.bodyType[obj.bodySlot] = obj.type; if (obj.legSlot > 0) Item.legType[obj.legSlot] = obj.type; switch (obj.type) { case 683: case 723: case 726: case 739: case 740: case 741: case 742: case 743: case 744: case 788: case 1296: case 1308: case 1326: case 1444: case 1445: case 1446: case 1801: case 1930: case 1931: case 2188: case 2750: case 3006: case 3051: case 3209: case 3210: case 3377: case 3476: case 3569: case 3571: case 3787: case 3852: case 3870: case 4062: Item.staff[obj.type] = true; break; case 1827: case 3245: Item.claw[obj.type] = true; break; } } } private static void Initialize_TileAndNPCData2() { Main.critterCage = true; for (int index = 0; index < 3600; ++index) Main.AnimateTiles_CritterCages(); Main.critterCage = false; Main.tileBlockLight[549] = true; Main.tileBrick[477] = true; Main.tileSolid[477] = true; Main.tileBlockLight[477] = true; Main.tileBrick[492] = true; Main.tileSolid[492] = true; Main.tileBlockLight[492] = true; Main.tileBrick[1] = true; Main.tileBrick[54] = true; Main.tileBrick[118] = true; Main.tileBrick[119] = true; Main.tileBrick[120] = true; Main.tileBrick[121] = true; Main.tileBrick[122] = true; Main.tileBrick[140] = true; Main.tileBrick[148] = true; Main.tileBrick[150] = true; Main.tileBrick[151] = true; Main.tileBrick[152] = true; Main.tileBrick[30] = true; Main.tileBrick[38] = true; Main.tileBrick[39] = true; Main.tileBrick[41] = true; Main.tileBrick[43] = true; Main.tileBrick[44] = true; Main.tileBrick[481] = true; Main.tileBrick[482] = true; Main.tileBrick[483] = true; Main.tileBrick[45] = true; Main.tileBrick[46] = true; Main.tileBrick[47] = true; Main.tileBrick[75] = true; Main.tileBrick[76] = true; Main.tileBrick[160] = true; Main.tileBrick[2] = true; Main.tileBrick[199] = true; Main.tileBrick[23] = true; Main.tileBrick[60] = true; Main.tileBrick[70] = true; Main.tileBrick[109] = true; Main.tileBrick[53] = true; Main.tileBrick[116] = true; Main.tileBrick[234] = true; Main.tileBrick[112] = true; Main.tileBrick[147] = true; Main.tileBrick[153] = true; Main.tileBrick[154] = true; Main.tileBrick[155] = true; Main.tileBrick[156] = true; Main.tileBrick[157] = true; Main.tileBrick[158] = true; Main.tileBrick[159] = true; Main.tileBrick[273] = true; Main.tileBrick[274] = true; Main.tileMergeDirt[202] = true; Main.tileBrick[202] = true; Main.tileSolid[202] = true; Main.tileBlockLight[202] = true; Main.tileMergeDirt[498] = true; Main.tileBrick[161] = true; Main.tileBlockLight[161] = true; Main.tileBlockLight[163] = true; Main.tileBlockLight[164] = true; Main.tileSolid[188] = true; Main.tileBlockLight[188] = true; Main.tileBrick[188] = true; Main.tileMergeDirt[188] = true; Main.tileBrick[179] = true; Main.tileSolid[179] = true; Main.tileBlockLight[179] = true; Main.tileMoss[179] = true; Main.tileBrick[381] = true; Main.tileSolid[381] = true; Main.tileBlockLight[381] = true; Main.tileMoss[381] = true; Main.tileBrick[534] = true; Main.tileSolid[534] = true; Main.tileBlockLight[534] = true; Main.tileMoss[534] = true; Main.tileBrick[536] = true; Main.tileSolid[536] = true; Main.tileBlockLight[536] = true; Main.tileMoss[536] = true; Main.tileBrick[539] = true; Main.tileSolid[539] = true; Main.tileBlockLight[539] = true; Main.tileMoss[539] = true; Main.tileBrick[180] = true; Main.tileSolid[180] = true; Main.tileBlockLight[180] = true; Main.tileMoss[180] = true; Main.tileBrick[181] = true; Main.tileSolid[181] = true; Main.tileBlockLight[181] = true; Main.tileMoss[181] = true; Main.tileBrick[182] = true; Main.tileSolid[182] = true; Main.tileBlockLight[182] = true; Main.tileMoss[182] = true; Main.tileBrick[183] = true; Main.tileSolid[183] = true; Main.tileBlockLight[183] = true; Main.tileMoss[183] = true; Main.tileBrick[512] = true; Main.tileSolid[512] = true; Main.tileBlockLight[512] = true; Main.tileBrick[513] = true; Main.tileSolid[513] = true; Main.tileBlockLight[513] = true; Main.tileBrick[514] = true; Main.tileSolid[514] = true; Main.tileBlockLight[514] = true; Main.tileBrick[515] = true; Main.tileSolid[515] = true; Main.tileBlockLight[515] = true; Main.tileBrick[516] = true; Main.tileSolid[516] = true; Main.tileBlockLight[516] = true; Main.tileBrick[517] = true; Main.tileSolid[517] = true; Main.tileBlockLight[517] = true; Main.tileLighted[517] = true; Main.tileBrick[535] = true; Main.tileSolid[535] = true; Main.tileBlockLight[535] = true; Main.tileLighted[535] = true; Main.tileBrick[537] = true; Main.tileSolid[537] = true; Main.tileBlockLight[537] = true; Main.tileLighted[537] = true; Main.tileBrick[540] = true; Main.tileSolid[540] = true; Main.tileBlockLight[540] = true; Main.tileLighted[540] = true; Main.tileLighted[592] = true; Main.tileMergeDirt[177] = true; Main.tileMergeDirt[190] = true; Main.tileSolid[196] = true; Main.tileSolid[197] = true; Main.tileMergeDirt[197] = true; Main.tileBlockLight[197] = true; Main.tileNoSunLight[197] = true; Main.tileBrick[175] = true; Main.tileSolid[175] = true; Main.tileBlockLight[175] = true; Main.tileBrick[176] = true; Main.tileSolid[176] = true; Main.tileBlockLight[176] = true; Main.tileBrick[177] = true; Main.tileSolid[177] = true; Main.tileBlockLight[177] = true; Main.tileBrick[225] = true; Main.tileBrick[229] = true; Main.tileShine[221] = 925; Main.tileShine[222] = 875; Main.tileShine[223] = 825; Main.tileShine2[221] = true; Main.tileShine2[222] = true; Main.tileShine2[223] = true; Main.tileMergeDirt[175] = true; Main.tileMergeDirt[176] = true; Main.tileMergeDirt[177] = true; Main.tileMergeDirt[208] = true; Main.tileBrick[162] = true; Main.tileSolid[162] = true; Main.tileBlockLight[162] = false; Main.tileBrick[163] = true; Main.tileSolid[163] = true; Main.tileBrick[164] = true; Main.tileSolid[164] = true; Main.tileShine2[6] = true; Main.tileShine2[7] = true; Main.tileShine2[8] = true; Main.tileShine2[9] = true; Main.tileShine2[166] = true; Main.tileShine2[167] = true; Main.tileShine2[168] = true; Main.tileShine2[169] = true; Main.tileShine2[12] = true; Main.tileShine2[21] = true; Main.tileShine2[467] = true; Main.tileShine2[441] = true; Main.tileShine2[468] = true; Main.tileShine2[22] = true; Main.tileShine2[25] = true; Main.tileShine2[45] = true; Main.tileShine2[46] = true; Main.tileShine2[47] = true; Main.tileShine2[63] = true; Main.tileShine2[64] = true; Main.tileShine2[65] = true; Main.tileShine2[66] = true; Main.tileShine2[67] = true; Main.tileShine2[68] = true; Main.tileShine2[566] = true; Main.tileShine2[107] = true; Main.tileShine2[108] = true; Main.tileShine2[111] = true; Main.tileShine2[121] = true; Main.tileShine2[122] = true; Main.tileShine2[117] = true; Main.tileShine2[211] = true; Main.tileShine[129] = 300; Main.tileNoFail[81] = true; Main.tileCracked[481] = true; Main.tileCracked[482] = true; Main.tileCracked[483] = true; Main.tileNoFail[481] = true; Main.tileNoFail[482] = true; Main.tileNoFail[483] = true; Main.tileNoFail[330] = true; Main.tileNoFail[331] = true; Main.tileNoFail[332] = true; Main.tileNoFail[333] = true; Main.tileNoFail[254] = true; Main.tileNoFail[324] = true; Main.tileNoFail[129] = true; Main.tileNoFail[192] = true; Main.tileHammer[26] = true; Main.tileHammer[31] = true; Main.tileAxe[5] = true; Main.tileAxe[72] = true; Main.tileAxe[80] = true; Main.tileAxe[488] = true; Main.tileAxe[323] = true; Main.tileAxe[596] = true; Main.tileAxe[616] = true; Main.tileAxe[589] = true; Main.tileAxe[584] = true; Main.tileAxe[588] = true; Main.tileAxe[586] = true; Main.tileAxe[587] = true; Main.tileAxe[585] = true; Main.tileAxe[583] = true; Main.tileBrick[59] = true; Main.tileBrick[234] = true; Main.tileSolid[234] = true; Main.tileMergeDirt[234] = true; Main.tileSand[53] = true; Main.tileSand[112] = true; Main.tileSand[116] = true; Main.tileSand[234] = true; Main.tileFrameImportant[571] = true; Main.tileLavaDeath[571] = true; Main.tileFrameImportant[579] = true; Main.tileLavaDeath[579] = true; Main.tileFrameImportant[591] = true; Main.tileLavaDeath[591] = true; Main.tileFrameImportant[592] = true; Main.tileLavaDeath[592] = false; Main.tileFrameImportant[538] = true; Main.tileLavaDeath[538] = true; Main.tileFrameImportant[544] = true; Main.tileLavaDeath[544] = true; Main.tileFrameImportant[550] = true; Main.tileLavaDeath[550] = true; Main.tileFrameImportant[551] = true; Main.tileLavaDeath[551] = true; Main.tileFrameImportant[533] = true; Main.tileLavaDeath[533] = true; Main.tileFrameImportant[553] = true; Main.tileLavaDeath[553] = true; Main.tileFrameImportant[554] = true; Main.tileLavaDeath[554] = true; Main.tileFrameImportant[555] = true; Main.tileLavaDeath[555] = true; Main.tileFrameImportant[556] = true; Main.tileLavaDeath[556] = true; Main.tileFrameImportant[558] = true; Main.tileLavaDeath[558] = true; Main.tileFrameImportant[559] = true; Main.tileLavaDeath[559] = true; Main.tileFrameImportant[599] = true; Main.tileLavaDeath[599] = true; Main.tileFrameImportant[600] = true; Main.tileLavaDeath[600] = true; Main.tileFrameImportant[601] = true; Main.tileLavaDeath[601] = true; Main.tileFrameImportant[602] = true; Main.tileLavaDeath[602] = true; Main.tileFrameImportant[603] = true; Main.tileLavaDeath[603] = true; Main.tileFrameImportant[604] = true; Main.tileLavaDeath[604] = true; Main.tileFrameImportant[605] = true; Main.tileLavaDeath[605] = true; Main.tileFrameImportant[606] = true; Main.tileLavaDeath[606] = true; Main.tileFrameImportant[607] = true; Main.tileLavaDeath[607] = true; Main.tileFrameImportant[608] = true; Main.tileLavaDeath[608] = true; Main.tileFrameImportant[609] = true; Main.tileLavaDeath[609] = true; Main.tileFrameImportant[610] = true; Main.tileLavaDeath[610] = true; Main.tileFrameImportant[611] = true; Main.tileLavaDeath[611] = true; Main.tileFrameImportant[612] = true; Main.tileLavaDeath[612] = true; Main.tileFrameImportant[568] = true; Main.tileNoAttach[568] = true; Main.tileLavaDeath[568] = true; Main.tileLighted[568] = true; Main.tileFrameImportant[569] = true; Main.tileNoAttach[569] = true; Main.tileLavaDeath[569] = true; Main.tileLighted[569] = true; Main.tileFrameImportant[570] = true; Main.tileNoAttach[570] = true; Main.tileLavaDeath[570] = true; Main.tileLighted[570] = true; Main.tileFrameImportant[580] = true; Main.tileNoAttach[580] = true; Main.tileLavaDeath[580] = true; Main.tileLighted[580] = true; Main.tileFrameImportant[582] = true; Main.tileLavaDeath[582] = true; Main.tileLighted[582] = true; Main.tileFrameImportant[619] = true; Main.tileLavaDeath[619] = true; Main.tileLighted[619] = true; Main.tileFrameImportant[620] = true; Main.tileNoAttach[620] = true; Main.tileLavaDeath[620] = true; Main.tileLighted[620] = true; Main.tileFrameImportant[572] = true; Main.tileNoAttach[572] = true; Main.tileLavaDeath[572] = true; Main.tileLighted[572] = true; Main.tileFrameImportant[560] = true; Main.tileLavaDeath[560] = true; Main.tileFrameImportant[564] = true; Main.tileNoAttach[564] = true; Main.tileLavaDeath[564] = true; Main.tileLighted[564] = true; Main.tileFrameImportant[567] = true; Main.tileLavaDeath[567] = true; Main.tileFrameImportant[565] = true; Main.tileNoAttach[565] = true; Main.tileLavaDeath[565] = true; Main.tileFrameImportant[593] = true; Main.tileNoAttach[593] = true; Main.tileLavaDeath[593] = false; Main.tileLighted[593] = true; Main.tileFrameImportant[594] = true; Main.tileNoAttach[594] = true; Main.tileLavaDeath[594] = false; Main.tileLighted[594] = true; Main.tileLighted[548] = true; Main.tileLighted[613] = true; Main.tileLighted[614] = true; Main.tileFrameImportant[518] = true; Main.tileCut[518] = true; Main.tileNoFail[518] = true; Main.tileFrameImportant[519] = true; Main.tileCut[519] = true; Main.tileNoFail[519] = true; Main.tileLighted[519] = true; Main.tileFrameImportant[549] = true; Main.tileCut[549] = true; Main.tileNoFail[549] = true; Main.tileFrameImportant[529] = true; Main.tileCut[529] = true; Main.tileNoFail[529] = true; Main.tileLavaDeath[529] = true; Main.tileFrameImportant[530] = true; Main.tileNoFail[530] = true; Main.tileLavaDeath[530] = true; Main.tileFrameImportant[233] = true; Main.tileFrameImportant[485] = true; Main.tileLighted[215] = true; Main.tileFrameImportant[227] = true; Main.tileFrameImportant[228] = true; Main.tileFrameImportant[231] = true; Main.tileCut[231] = true; Main.tileFrameImportant[216] = true; Main.tileFrameImportant[217] = true; Main.tileFrameImportant[218] = true; Main.tileFrameImportant[219] = true; Main.tileFrameImportant[220] = true; Main.tileFrameImportant[338] = true; Main.tileFrameImportant[453] = true; Main.tileFrameImportant[456] = true; Main.tileFrameImportant[165] = true; Main.tileFrameImportant[209] = true; Main.tileFrameImportant[215] = true; Main.tileFrameImportant[210] = true; Main.tileFrameImportant[212] = true; Main.tileFrameImportant[207] = true; Main.tileFrameImportant[178] = true; Main.tileFrameImportant[184] = true; Main.tileFrameImportant[185] = true; Main.tileFrameImportant[186] = true; Main.tileFrameImportant[187] = true; Main.tileFrameImportant[173] = true; Main.tileFrameImportant[174] = true; Main.tileLighted[173] = true; Main.tileLighted[174] = true; Main.tileFrameImportant[139] = true; Main.tileLighted[160] = true; Main.tileLighted[149] = true; Main.tileFrameImportant[149] = true; Main.tileFrameImportant[142] = true; Main.tileFrameImportant[143] = true; Main.tileFrameImportant[144] = true; Main.tileStone[131] = true; Main.tileFrameImportant[136] = true; Main.tileFrameImportant[137] = true; Main.tileFrameImportant[138] = true; Main.tileFrameImportant[484] = true; Main.tileLavaDeath[484] = true; Main.tileNoFail[484] = true; Main.tileBlockLight[137] = true; Main.tileSolid[137] = true; Main.tileBlockLight[160] = true; Main.tileSolid[160] = true; Main.tileMergeDirt[160] = true; Main.tileBlockLight[161] = true; Main.tileSolid[161] = true; Main.tileBlockLight[145] = true; Main.tileSolid[145] = true; Main.tileMergeDirt[145] = true; Main.tileBlockLight[146] = true; Main.tileSolid[146] = true; Main.tileMergeDirt[146] = true; Main.tileBlockLight[147] = true; Main.tileSolid[147] = true; Main.tileBlockLight[148] = true; Main.tileSolid[148] = true; Main.tileMergeDirt[148] = true; Main.tileSolid[138] = true; Main.tileSolid[484] = true; Main.tileCut[484] = true; Main.tileBlockLight[140] = true; Main.tileSolid[140] = true; Main.tileBlockLight[151] = true; Main.tileSolid[151] = true; Main.tileMergeDirt[151] = true; Main.tileBlockLight[152] = true; Main.tileSolid[152] = true; Main.tileMergeDirt[152] = true; Main.tileBlockLight[153] = true; Main.tileSolid[153] = true; Main.tileMergeDirt[153] = true; Main.tileBlockLight[154] = true; Main.tileSolid[154] = true; Main.tileMergeDirt[154] = true; Main.tileBlockLight[155] = true; Main.tileSolid[155] = true; Main.tileMergeDirt[155] = true; Main.tileBlockLight[156] = true; Main.tileSolid[156] = true; Main.tileMergeDirt[156] = true; Main.tileMergeDirt[150] = true; Main.tileBlockLight[157] = true; Main.tileSolid[157] = true; Main.tileMergeDirt[157] = true; Main.tileBlockLight[158] = true; Main.tileSolid[158] = true; Main.tileMergeDirt[158] = true; Main.tileBlockLight[159] = true; Main.tileSolid[159] = true; Main.tileMergeDirt[159] = true; Main.tileFrameImportant[320] = true; Main.tileFrameImportant[49] = true; Main.tileShine[22] = 1150; Main.tileShine[6] = 1150; Main.tileShine[7] = 1100; Main.tileShine[8] = 1000; Main.tileShine[9] = 1050; Main.tileShine[166] = 1125; Main.tileShine[167] = 1075; Main.tileShine[168] = 1025; Main.tileShine[169] = 975; Main.tileShine[617] = 400; Main.tileShine[178] = 500; Main.tileShine2[178] = true; Main.tileShine[12] = 300; Main.tileShine[21] = 1200; Main.tileShine[467] = 1200; Main.tileShine[441] = 1200; Main.tileShine[468] = 1200; Main.tileShine[63] = 900; Main.tileShine[64] = 900; Main.tileShine[65] = 900; Main.tileShine[66] = 900; Main.tileShine[67] = 900; Main.tileShine[68] = 900; Main.tileShine[566] = 900; Main.tileShine[45] = 1900; Main.tileShine[46] = 2000; Main.tileShine[47] = 2100; Main.tileShine[122] = 1800; Main.tileShine[121] = 1850; Main.tileShine[125] = 600; Main.tileShine[109] = 9000; Main.tileShine[110] = 9000; Main.tileShine[116] = 9000; Main.tileShine[117] = 9000; Main.tileShine[118] = 8000; Main.tileShine[107] = 950; Main.tileShine[108] = 900; Main.tileShine[111] = 850; Main.tileShine[211] = 500; Main.tileLighted[4] = true; Main.tileLighted[17] = true; Main.tileLighted[133] = true; Main.tileLighted[31] = true; Main.tileLighted[33] = true; Main.tileLighted[34] = true; Main.tileLighted[35] = true; Main.tileLighted[37] = true; Main.tileLighted[42] = true; Main.tileLighted[49] = true; Main.tileLighted[58] = true; Main.tileLighted[61] = true; Main.tileLighted[70] = true; Main.tileLighted[71] = true; Main.tileLighted[72] = true; Main.tileLighted[76] = true; Main.tileLighted[77] = true; Main.tileLighted[19] = true; Main.tileLighted[22] = true; Main.tileLighted[26] = true; Main.tileLighted[83] = true; Main.tileLighted[84] = true; Main.tileLighted[92] = true; Main.tileLighted[93] = true; Main.tileLighted[95] = true; Main.tileLighted[98] = true; Main.tileLighted[100] = true; Main.tileLighted[109] = true; Main.tileLighted[125] = true; Main.tileLighted[126] = true; Main.tileLighted[129] = true; Main.tileLighted[140] = true; Main.tileLighted[270] = true; Main.tileLighted[271] = true; Main.tileLighted[581] = true; Main.tileLighted[578] = true; Main.tileMergeDirt[1] = true; Main.tileMergeDirt[6] = true; Main.tileMergeDirt[7] = true; Main.tileMergeDirt[8] = true; Main.tileMergeDirt[9] = true; Main.tileMergeDirt[166] = true; Main.tileMergeDirt[167] = true; Main.tileMergeDirt[168] = true; Main.tileMergeDirt[169] = true; Main.tileMergeDirt[22] = true; Main.tileMergeDirt[25] = true; Main.tileMergeDirt[30] = true; Main.tileMergeDirt[37] = true; Main.tileMergeDirt[38] = true; Main.tileMergeDirt[40] = true; Main.tileMergeDirt[53] = true; Main.tileMergeDirt[56] = true; Main.tileMergeDirt[107] = true; Main.tileMergeDirt[108] = true; Main.tileMergeDirt[111] = true; Main.tileMergeDirt[112] = true; Main.tileMergeDirt[116] = true; Main.tileMergeDirt[117] = true; Main.tileMergeDirt[123] = true; Main.tileMergeDirt[140] = true; Main.tileMergeDirt[39] = true; Main.tileMergeDirt[122] = true; Main.tileMergeDirt[121] = true; Main.tileMergeDirt[120] = true; Main.tileMergeDirt[119] = true; Main.tileMergeDirt[118] = true; Main.tileMergeDirt[47] = true; Main.tileMergeDirt[46] = true; Main.tileMergeDirt[45] = true; Main.tileMergeDirt[41] = true; Main.tileMergeDirt[43] = true; Main.tileMergeDirt[44] = true; Main.tileMergeDirt[481] = true; Main.tileMergeDirt[482] = true; Main.tileMergeDirt[483] = true; Main.tileFrameImportant[380] = true; Main.tileFrameImportant[201] = true; Main.tileFrameImportant[3] = true; Main.tileFrameImportant[4] = true; Main.tileFrameImportant[5] = true; Main.tileFrameImportant[10] = true; Main.tileFrameImportant[11] = true; Main.tileFrameImportant[12] = true; Main.tileFrameImportant[13] = true; Main.tileFrameImportant[14] = true; Main.tileFrameImportant[469] = true; Main.tileFrameImportant[486] = true; Main.tileFrameImportant[488] = true; Main.tileFrameImportant[487] = true; Main.tileFrameImportant[489] = true; Main.tileFrameImportant[490] = true; Main.tileFrameImportant[15] = true; Main.tileFrameImportant[497] = true; Main.tileFrameImportant[16] = true; Main.tileFrameImportant[17] = true; Main.tileFrameImportant[18] = true; Main.tileFrameImportant[19] = true; Main.tileFrameImportant[20] = true; Main.tileFrameImportant[21] = true; Main.tileFrameImportant[467] = true; Main.tileFrameImportant[441] = true; Main.tileFrameImportant[468] = true; Main.tileFrameImportant[24] = true; Main.tileFrameImportant[26] = true; Main.tileFrameImportant[27] = true; Main.tileFrameImportant[28] = true; Main.tileFrameImportant[29] = true; Main.tileFrameImportant[31] = true; Main.tileFrameImportant[33] = true; Main.tileFrameImportant[34] = true; Main.tileFrameImportant[35] = true; Main.tileFrameImportant[42] = true; Main.tileFrameImportant[50] = true; Main.tileFrameImportant[55] = true; Main.tileFrameImportant[61] = true; Main.tileFrameImportant[71] = true; Main.tileFrameImportant[72] = true; Main.tileFrameImportant[73] = true; Main.tileFrameImportant[74] = true; Main.tileFrameImportant[77] = true; Main.tileFrameImportant[78] = true; Main.tileFrameImportant[79] = true; Main.tileFrameImportant[81] = true; Main.tileFrameImportant[82] = true; Main.tileFrameImportant[83] = true; Main.tileFrameImportant[84] = true; Main.tileFrameImportant[85] = true; Main.tileFrameImportant[86] = true; Main.tileFrameImportant[87] = true; Main.tileFrameImportant[88] = true; Main.tileFrameImportant[89] = true; Main.tileFrameImportant[90] = true; Main.tileFrameImportant[91] = true; Main.tileFrameImportant[92] = true; Main.tileFrameImportant[93] = true; Main.tileFrameImportant[94] = true; Main.tileFrameImportant[95] = true; Main.tileFrameImportant[96] = true; Main.tileFrameImportant[97] = true; Main.tileFrameImportant[98] = true; Main.tileFrameImportant[99] = true; Main.tileFrameImportant[101] = true; Main.tileFrameImportant[102] = true; Main.tileFrameImportant[103] = true; Main.tileFrameImportant[104] = true; Main.tileFrameImportant[105] = true; Main.tileFrameImportant[100] = true; Main.tileFrameImportant[106] = true; Main.tileFrameImportant[110] = true; Main.tileFrameImportant[113] = true; Main.tileFrameImportant[114] = true; Main.tileFrameImportant[125] = true; Main.tileFrameImportant[287] = true; Main.tileFrameImportant[126] = true; Main.tileFrameImportant[128] = true; Main.tileFrameImportant[129] = true; Main.tileFrameImportant[132] = true; Main.tileFrameImportant[133] = true; Main.tileFrameImportant[134] = true; Main.tileFrameImportant[135] = true; Main.tileFrameImportant[172] = true; Main.tileFrameImportant[319] = true; Main.tileFrameImportant[323] = true; Main.tileFrameImportant[335] = true; Main.tileFrameImportant[337] = true; Main.tileFrameImportant[349] = true; Main.tileFrameImportant[376] = true; Main.tileFrameImportant[378] = true; Main.tileFrameImportant[425] = true; Main.tileFrameImportant[465] = true; Main.tileFrameImportant[506] = true; Main.tileFrameImportant[510] = true; Main.tileFrameImportant[511] = true; Main.tileFrameImportant[531] = true; Main.tileFrameImportant[545] = true; Main.tileFrameImportant[547] = true; Main.tileFrameImportant[548] = true; Main.tileFrameImportant[552] = true; Main.tileFrameImportant[573] = true; Main.tileFrameImportant[613] = true; Main.tileFrameImportant[614] = true; Main.tileFrameImportant[621] = true; Main.tileFrameImportant[622] = true; Main.tileFrameImportant[141] = true; Main.tileFrameImportant[270] = true; Main.tileFrameImportant[271] = true; Main.tileFrameImportant[581] = true; Main.tileFrameImportant[314] = true; Main.tileSolidTop[376] = true; Main.tileTable[376] = true; Main.tileTable[380] = true; Main.tileFrameImportant[583] = true; Main.tileFrameImportant[584] = true; Main.tileFrameImportant[585] = true; Main.tileFrameImportant[586] = true; Main.tileFrameImportant[587] = true; Main.tileFrameImportant[588] = true; Main.tileFrameImportant[589] = true; Main.tileFrameImportant[590] = true; Main.tileNoAttach[590] = true; Main.tileFrameImportant[595] = true; Main.tileNoAttach[595] = true; Main.tileFrameImportant[596] = true; Main.tileFrameImportant[615] = true; Main.tileNoAttach[615] = true; Main.tileFrameImportant[616] = true; Main.tileCut[201] = true; Main.tileCut[3] = true; Main.tileCut[24] = true; Main.tileCut[28] = true; Main.tileCut[32] = true; Main.tileCut[51] = true; Main.tileCut[52] = true; Main.tileCut[61] = true; Main.tileCut[62] = true; Main.tileCut[69] = true; Main.tileCut[71] = true; Main.tileCut[73] = true; Main.tileCut[74] = true; Main.tileCut[82] = true; Main.tileCut[83] = true; Main.tileCut[84] = true; Main.tileCut[110] = true; Main.tileCut[113] = true; Main.tileCut[115] = true; Main.tileCut[184] = true; Main.tileCut[205] = true; Main.tileCut[352] = true; Main.tileCut[382] = true; Main.tileCut[528] = true; Main.tileLighted[528] = true; Main.tileCut[444] = true; Main.tileCut[485] = true; Main.tileAlch[82] = true; Main.tileAlch[83] = true; Main.tileAlch[84] = true; Main.tileSolid[(int) sbyte.MaxValue] = true; Main.tileSolid[130] = true; Main.tileBlockLight[130] = true; Main.tileBlockLight[131] = true; Main.tileNoAttach[232] = true; Main.tileSolid[107] = true; Main.tileBlockLight[107] = true; Main.tileSolid[108] = true; Main.tileBlockLight[108] = true; Main.tileSolid[111] = true; Main.tileBlockLight[111] = true; Main.tileSolid[109] = true; Main.tileBlockLight[109] = true; Main.tileSolid[110] = false; Main.tileNoAttach[110] = true; Main.tileNoFail[110] = true; Main.tileSolid[112] = true; Main.tileBlockLight[112] = true; Main.tileSolid[116] = true; Main.tileBlockLight[116] = true; Main.tileBrick[117] = true; Main.tileBrick[25] = true; Main.tileBrick[203] = true; Main.tileSolid[117] = true; Main.tileBlockLight[117] = true; Main.tileSolid[123] = true; Main.tileBlockLight[123] = true; Main.tileNoFail[165] = true; Main.tileNoFail[184] = true; Main.tileNoFail[185] = true; Main.tileNoFail[186] = true; Main.tileNoFail[187] = true; Main.tileSolid[118] = true; Main.tileBlockLight[118] = true; Main.tileSolid[119] = true; Main.tileBlockLight[119] = true; Main.tileSolid[120] = true; Main.tileBlockLight[120] = true; Main.tileSolid[121] = true; Main.tileBlockLight[121] = true; Main.tileSolid[122] = true; Main.tileBlockLight[122] = true; Main.tileSolid[150] = true; Main.tileBlockLight[150] = true; Main.tileBlockLight[115] = true; Main.tileSolid[199] = true; Main.tileBlockLight[199] = true; Main.tileNoFail[162] = true; Main.tileSolid[0] = true; Main.tileBlockLight[0] = true; Main.tileSolid[1] = true; Main.tileBlockLight[1] = true; Main.tileSolid[2] = true; Main.tileBlockLight[2] = true; Main.tileSolid[3] = false; Main.tileNoAttach[3] = true; Main.tileNoFail[3] = true; Main.tileNoFail[201] = true; Main.tileSolid[4] = false; Main.tileNoAttach[4] = true; Main.tileNoFail[4] = true; Main.tileNoFail[24] = true; Main.tileSolid[5] = false; Main.tileSolid[6] = true; Main.tileBlockLight[6] = true; Main.tileSolid[7] = true; Main.tileBlockLight[7] = true; Main.tileSolid[8] = true; Main.tileBlockLight[8] = true; Main.tileSolid[9] = true; Main.tileBlockLight[9] = true; Main.tileSolid[166] = true; Main.tileBlockLight[166] = true; Main.tileSolid[167] = true; Main.tileBlockLight[167] = true; Main.tileSolid[168] = true; Main.tileBlockLight[168] = true; Main.tileSolid[169] = true; Main.tileBlockLight[169] = true; Main.tileBlockLight[10] = true; Main.tileSolid[10] = true; Main.tileNoAttach[10] = true; Main.tileBlockLight[10] = true; Main.tileSolid[11] = false; Main.tileSolidTop[19] = true; Main.tileSolid[19] = true; Main.tileSolid[22] = true; Main.tileSolid[23] = true; Main.tileSolid[25] = true; Main.tileSolid[30] = true; Main.tileNoFail[32] = true; Main.tileBlockLight[32] = true; Main.tileNoFail[352] = true; Main.tileBlockLight[352] = true; Main.tileSolid[37] = true; Main.tileBlockLight[37] = true; Main.tileSolid[38] = true; Main.tileBlockLight[38] = true; Main.tileSolid[39] = true; Main.tileBlockLight[39] = true; Main.tileSolid[40] = true; Main.tileBlockLight[40] = true; Main.tileSolid[41] = true; Main.tileBlockLight[41] = true; Main.tileSolid[43] = true; Main.tileBlockLight[43] = true; Main.tileSolid[44] = true; Main.tileBlockLight[44] = true; Main.tileSolid[481] = true; Main.tileBlockLight[481] = true; Main.tileSolid[482] = true; Main.tileBlockLight[482] = true; Main.tileSolid[483] = true; Main.tileBlockLight[483] = true; Main.tileSolid[45] = true; Main.tileBlockLight[45] = true; Main.tileSolid[46] = true; Main.tileBlockLight[46] = true; Main.tileSolid[47] = true; Main.tileBlockLight[47] = true; Main.tileSolid[48] = true; Main.tileSolid[53] = true; Main.tileBlockLight[53] = true; Main.tileSolid[54] = true; Main.tileBlockLight[52] = true; Main.tileBlockLight[205] = true; Main.tileSolid[56] = true; Main.tileBlockLight[56] = true; Main.tileSolid[57] = true; Main.tileBlockLight[57] = true; Main.tileSolid[58] = true; Main.tileBlockLight[58] = true; Main.tileBlockLight[382] = true; Main.tileSolid[59] = true; Main.tileBlockLight[59] = true; Main.tileSolid[60] = true; Main.tileBlockLight[60] = true; Main.tileSolid[63] = true; Main.tileBlockLight[63] = true; Main.tileStone[63] = true; Main.tileStone[130] = true; Main.tileSolid[64] = true; Main.tileBlockLight[64] = true; Main.tileStone[64] = true; Main.tileSolid[65] = true; Main.tileBlockLight[65] = true; Main.tileStone[65] = true; Main.tileSolid[66] = true; Main.tileBlockLight[66] = true; Main.tileStone[66] = true; Main.tileSolid[67] = true; Main.tileBlockLight[67] = true; Main.tileStone[67] = true; Main.tileSolid[68] = true; Main.tileBlockLight[68] = true; Main.tileStone[68] = true; Main.tileSolid[566] = true; Main.tileBlockLight[566] = true; Main.tileStone[566] = true; Main.tileSolid[75] = true; Main.tileBlockLight[75] = true; Main.tileSolid[76] = true; Main.tileBlockLight[76] = true; Main.tileSolid[70] = true; Main.tileBlockLight[70] = true; Main.tileNoFail[50] = true; Main.tileNoAttach[50] = true; Main.tileDungeon[41] = true; Main.tileDungeon[43] = true; Main.tileDungeon[44] = true; Main.tileBlockLight[30] = true; Main.tileBlockLight[25] = true; Main.tileBlockLight[23] = true; Main.tileBlockLight[22] = true; Main.tileBlockLight[62] = true; Main.tileSolidTop[18] = true; Main.tileSolidTop[14] = true; Main.tileSolidTop[469] = true; Main.tileSolidTop[16] = true; Main.tileSolidTop[134] = true; Main.tileSolidTop[114] = true; Main.tileNoAttach[20] = true; Main.tileNoAttach[19] = true; Main.tileNoAttach[13] = true; Main.tileNoAttach[14] = true; Main.tileNoAttach[469] = true; Main.tileNoAttach[486] = true; Main.tileNoAttach[488] = true; Main.tileNoAttach[487] = true; Main.tileNoAttach[489] = true; Main.tileNoAttach[490] = true; Main.tileNoAttach[15] = true; Main.tileNoAttach[497] = true; Main.tileNoAttach[16] = true; Main.tileNoAttach[134] = true; Main.tileNoAttach[17] = true; Main.tileNoAttach[18] = true; Main.tileNoAttach[21] = true; Main.tileNoAttach[467] = true; Main.tileNoAttach[441] = true; Main.tileNoAttach[468] = true; Main.tileNoAttach[27] = true; Main.tileNoAttach[114] = true; Main.tileTable[14] = true; Main.tileTable[469] = true; Main.tileTable[18] = true; Main.tileTable[19] = true; Main.tileTable[114] = true; Main.tileNoAttach[86] = true; Main.tileNoAttach[87] = true; Main.tileNoAttach[88] = true; Main.tileNoAttach[89] = true; Main.tileNoAttach[90] = true; Main.tileTable[101] = true; Main.tileNoAttach[101] = true; Main.tileNoAttach[102] = true; Main.tileNoAttach[94] = true; Main.tileNoAttach[95] = true; Main.tileNoAttach[96] = true; Main.tileNoAttach[97] = true; Main.tileNoAttach[98] = true; Main.tileNoAttach[99] = true; Main.tileTable[87] = true; Main.tileTable[88] = true; Main.tileSolidTop[87] = true; Main.tileSolidTop[88] = true; Main.tileSolidTop[101] = true; Main.tileNoAttach[91] = true; Main.tileNoAttach[92] = true; Main.tileNoAttach[93] = true; Main.tileLighted[190] = true; Main.tileBlockLight[192] = true; Main.tileWaterDeath[215] = true; Main.tileWaterDeath[4] = true; Main.tileWaterDeath[51] = true; Main.tileWaterDeath[93] = true; Main.tileWaterDeath[98] = true; Main.tileWaterDeath[552] = true; Main.tileLavaDeath[3] = true; Main.tileLavaDeath[5] = true; Main.tileLavaDeath[10] = true; Main.tileLavaDeath[11] = true; Main.tileLavaDeath[12] = true; Main.tileLavaDeath[13] = true; Main.tileLavaDeath[14] = true; Main.tileLavaDeath[469] = true; Main.tileLavaDeath[486] = true; Main.tileLavaDeath[488] = true; Main.tileLavaDeath[487] = true; Main.tileLavaDeath[489] = true; Main.tileLavaDeath[490] = true; Main.tileLavaDeath[15] = true; Main.tileLavaDeath[497] = true; Main.tileLavaDeath[16] = true; Main.tileLavaDeath[17] = true; Main.tileLavaDeath[18] = true; Main.tileLavaDeath[19] = true; Main.tileLavaDeath[20] = true; Main.tileLavaDeath[24] = true; Main.tileLavaDeath[27] = true; Main.tileLavaDeath[28] = true; Main.tileLavaDeath[29] = true; Main.tileLavaDeath[32] = true; Main.tileLavaDeath[33] = true; Main.tileLavaDeath[34] = true; Main.tileLavaDeath[35] = true; Main.tileLavaDeath[36] = true; Main.tileLavaDeath[42] = true; Main.tileLavaDeath[49] = true; Main.tileLavaDeath[50] = true; Main.tileLavaDeath[51] = true; Main.tileLavaDeath[52] = true; Main.tileLavaDeath[55] = true; Main.tileLavaDeath[61] = true; Main.tileLavaDeath[62] = true; Main.tileLavaDeath[69] = true; Main.tileLavaDeath[71] = true; Main.tileLavaDeath[72] = true; Main.tileLavaDeath[73] = true; Main.tileLavaDeath[74] = true; Main.tileLavaDeath[79] = true; Main.tileLavaDeath[80] = true; Main.tileLavaDeath[81] = true; Main.tileLavaDeath[86] = true; Main.tileLavaDeath[87] = true; Main.tileLavaDeath[88] = true; Main.tileLavaDeath[89] = true; Main.tileLavaDeath[90] = true; Main.tileLavaDeath[91] = true; Main.tileLavaDeath[92] = true; Main.tileLavaDeath[93] = true; Main.tileLavaDeath[94] = true; Main.tileLavaDeath[95] = true; Main.tileLavaDeath[96] = true; Main.tileLavaDeath[97] = true; Main.tileLavaDeath[98] = true; Main.tileLavaDeath[100] = true; Main.tileLavaDeath[101] = true; Main.tileLavaDeath[102] = true; Main.tileLavaDeath[103] = true; Main.tileLavaDeath[104] = true; Main.tileLavaDeath[106] = true; Main.tileLavaDeath[110] = true; Main.tileLavaDeath[113] = true; Main.tileLavaDeath[115] = true; Main.tileLavaDeath[125] = true; Main.tileLavaDeath[126] = true; Main.tileLavaDeath[128] = true; Main.tileLavaDeath[149] = true; Main.tileLavaDeath[172] = true; Main.tileLavaDeath[173] = true; Main.tileLavaDeath[174] = true; Main.tileLavaDeath[184] = true; Main.tileLavaDeath[201] = true; Main.tileLavaDeath[205] = true; Main.tileLavaDeath[201] = true; Main.tileLavaDeath[209] = true; Main.tileLavaDeath[210] = true; Main.tileLavaDeath[212] = true; Main.tileLavaDeath[213] = true; Main.tileLavaDeath[353] = true; Main.tileLavaDeath[214] = true; Main.tileLavaDeath[215] = true; Main.tileLavaDeath[216] = true; Main.tileLavaDeath[217] = true; Main.tileLavaDeath[218] = true; Main.tileLavaDeath[219] = true; Main.tileLavaDeath[220] = true; Main.tileLavaDeath[227] = true; Main.tileLavaDeath[228] = true; Main.tileLavaDeath[233] = true; Main.tileLavaDeath[236] = true; Main.tileLavaDeath[238] = true; Main.tileLavaDeath[240] = true; Main.tileLavaDeath[241] = true; Main.tileLavaDeath[242] = true; Main.tileLavaDeath[243] = true; Main.tileLavaDeath[244] = true; Main.tileLavaDeath[245] = true; Main.tileLavaDeath[246] = true; Main.tileLavaDeath[247] = true; Main.tileLavaDeath[254] = true; Main.tileLavaDeath[269] = true; Main.tileLavaDeath[270] = true; Main.tileLavaDeath[271] = true; Main.tileLavaDeath[581] = true; Main.tileLavaDeath[275] = true; Main.tileLavaDeath[413] = true; Main.tileLavaDeath[276] = true; Main.tileLavaDeath[277] = true; Main.tileLavaDeath[278] = true; Main.tileLavaDeath[279] = true; Main.tileLavaDeath[280] = true; Main.tileLavaDeath[281] = true; Main.tileLavaDeath[282] = true; Main.tileLavaDeath[283] = true; Main.tileLavaDeath[285] = true; Main.tileLavaDeath[286] = true; Main.tileLavaDeath[287] = true; Main.tileLavaDeath[288] = true; Main.tileLavaDeath[289] = true; Main.tileLavaDeath[290] = true; Main.tileLavaDeath[291] = true; Main.tileLavaDeath[292] = true; Main.tileLavaDeath[293] = true; Main.tileLavaDeath[294] = true; Main.tileLavaDeath[295] = true; Main.tileLavaDeath[296] = true; Main.tileLavaDeath[297] = true; Main.tileLavaDeath[298] = true; Main.tileLavaDeath[299] = true; Main.tileLavaDeath[300] = true; Main.tileLavaDeath[301] = true; Main.tileLavaDeath[302] = true; Main.tileLavaDeath[303] = true; Main.tileLavaDeath[304] = true; Main.tileLavaDeath[305] = true; Main.tileLavaDeath[306] = true; Main.tileLavaDeath[307] = true; Main.tileLavaDeath[308] = true; Main.tileLavaDeath[309] = true; Main.tileLavaDeath[310] = true; Main.tileLavaDeath[532] = true; Main.tileLavaDeath[316] = true; Main.tileLavaDeath[317] = true; Main.tileLavaDeath[318] = true; Main.tileLavaDeath[319] = true; Main.tileLavaDeath[354] = true; Main.tileLavaDeath[355] = true; Main.tileLavaDeath[499] = true; Main.tileLavaDeath[323] = true; Main.tileLavaDeath[335] = true; Main.tileLavaDeath[338] = true; Main.tileLavaDeath[339] = true; Main.tileLavaDeath[528] = true; Main.tileLavaDeath[352] = true; Main.tileLavaDeath[382] = true; Main.tileLavaDeath[425] = true; Main.tileLavaDeath[453] = true; Main.tileLavaDeath[456] = true; Main.tileLavaDeath[463] = true; Main.tileLavaDeath[464] = true; Main.tileLavaDeath[465] = true; Main.tileLavaDeath[485] = true; Main.tileLavaDeath[511] = true; Main.tileLavaDeath[510] = true; Main.tileLavaDeath[547] = true; Main.tileLavaDeath[548] = true; Main.tileLavaDeath[552] = true; Main.tileLavaDeath[573] = true; Main.tileLavaDeath[621] = true; Main.tileLavaDeath[622] = true; Main.tileLighted[316] = true; Main.tileLighted[317] = true; Main.tileLighted[318] = true; Main.tileFrameImportant[493] = true; Main.tileLavaDeath[493] = true; for (int index = 0; index < 623; ++index) { if (Main.tileLavaDeath[index]) Main.tileObsidianKill[index] = true; } Main.tileObsidianKill[546] = true; Main.tileObsidianKill[77] = true; Main.tileObsidianKill[78] = true; Main.tileObsidianKill[82] = true; Main.tileObsidianKill[83] = true; Main.tileObsidianKill[84] = true; Main.tileObsidianKill[85] = true; Main.tileObsidianKill[105] = true; Main.tileObsidianKill[129] = true; Main.tileObsidianKill[132] = true; Main.tileObsidianKill[133] = true; Main.tileObsidianKill[134] = true; Main.tileObsidianKill[135] = true; Main.tileObsidianKill[136] = true; Main.tileObsidianKill[139] = true; Main.tileObsidianKill[165] = true; Main.tileObsidianKill[178] = true; Main.tileObsidianKill[185] = true; Main.tileObsidianKill[186] = true; Main.tileObsidianKill[187] = true; Main.tileObsidianKill[231] = true; Main.tileObsidianKill[337] = true; Main.tileObsidianKill[349] = true; Main.tileObsidianKill[506] = true; Main.tileObsidianKill[314] = true; Main.tileSolid[384] = true; Main.tileBlockLight[384] = true; Main.tileNoFail[384] = true; Main.tileFrameImportant[395] = true; Main.tileLavaDeath[395] = true; Main.tileFrameImportant[520] = true; Main.tileLavaDeath[520] = true; Main.tileLavaDeath[471] = true; Main.tileFrameImportant[405] = true; Main.tileLavaDeath[405] = true; Main.tileSolidTop[405] = true; Main.tileTable[405] = true; Main.tileLighted[405] = true; Main.tileWaterDeath[405] = true; Main.tileFrameImportant[406] = true; Main.tileLavaDeath[406] = true; Main.tileFrameImportant[452] = true; Main.tileLavaDeath[452] = true; Main.tileFrameImportant[411] = true; Main.tileLavaDeath[411] = false; Main.tileFrameImportant[457] = true; Main.tileLavaDeath[457] = true; Main.tileFrameImportant[462] = true; Main.tileFrameImportant[454] = true; Main.tileLavaDeath[454] = true; Main.tileCut[454] = true; Main.tileFrameImportant[494] = true; Main.tileLavaDeath[494] = true; Main.tileFrameImportant[455] = true; Main.tileFrameImportant[412] = true; for (int index = 0; index < 316; ++index) Main.wallBlend[index] = index != 20 ? (index != 19 ? (index != 18 ? (index != 17 ? (index == 16 || index == 59 || index == 261 ? 2 : (index == 1 || index >= 48 && index <= 53 ? 1 : index)) : 7) : 8) : 9) : 14; Main.wallBlend[65] = 63; Main.wallBlend[66] = 63; Main.wallBlend[68] = 63; Main.wallBlend[67] = 64; Main.wallBlend[80] = 74; Main.wallBlend[81] = 77; Main.wallBlend[94] = 7; Main.wallBlend[95] = 7; Main.wallBlend[100] = 7; Main.wallBlend[101] = 7; Main.wallBlend[96] = 8; Main.wallBlend[97] = 8; Main.wallBlend[102] = 8; Main.wallBlend[103] = 8; Main.wallBlend[98] = 9; Main.wallBlend[99] = 9; Main.wallBlend[104] = 9; Main.wallBlend[105] = 9; Main.tileNoFail[24] = true; Main.tileNoFail[3] = true; Main.tileNoFail[52] = true; Main.tileNoFail[62] = true; Main.tileNoFail[32] = true; Main.tileNoFail[61] = true; Main.tileNoFail[69] = true; Main.tileNoFail[73] = true; Main.tileNoFail[74] = true; Main.tileNoFail[82] = true; Main.tileNoFail[83] = true; Main.tileNoFail[84] = true; Main.tileNoFail[110] = true; Main.tileNoFail[113] = true; Main.tileNoFail[115] = true; Main.tileNoFail[165] = true; Main.tileNoFail[184] = true; Main.tileNoFail[201] = true; Main.tileNoFail[205] = true; Main.tileNoFail[227] = true; Main.tileNoFail[233] = true; Main.tileNoFail[352] = true; Main.tileNoFail[382] = true; Main.tileNoFail[528] = true; Main.tileNoFail[485] = true; Main.tileFrameImportant[387] = true; Main.tileSolid[387] = true; Main.tileBlockLight[387] = true; Main.tileNoAttach[387] = true; Main.tileLavaDeath[387] = true; Main.tileFrameImportant[386] = true; Main.tileLavaDeath[386] = true; Main.tileNoSunLight[386] = true; Main.tileFrameImportant[388] = true; Main.tileSolid[388] = true; Main.tileBlockLight[388] = true; Main.tileNoAttach[388] = true; Main.tileLavaDeath[388] = true; Main.tileFrameImportant[389] = true; Main.tileLavaDeath[389] = true; Main.tileNoSunLight[389] = true; for (int index = 0; index < 623; ++index) { if (Main.tileSolid[index]) Main.tileNoSunLight[index] = true; Main.tileFrame[index] = 0; Main.tileFrameCounter[index] = 0; } Main.tileNoSunLight[546] = false; Main.tileNoSunLight[379] = false; Main.tileNoSunLight[54] = false; Main.tileNoSunLight[328] = false; Main.tileNoSunLight[459] = false; Main.tileNoSunLight[19] = false; Main.tileNoSunLight[11] = true; Main.tileNoSunLight[189] = false; Main.tileNoSunLight[196] = false; Main.tileNoSunLight[48] = false; Main.tileNoSunLight[232] = false; Main.tileNoSunLight[460] = false; Main.tileNoSunLight[541] = false; Main.tileNoSunLight[388] = false; } private static void Initialize_TileAndNPCData1() { for (int index = 0; index < 623; ++index) Main.tileGlowMask[index] = (short) -1; for (int index = 0; index < 950; ++index) Main.projFrames[index] = 1; Main.projFrames[736] = 3; Main.projFrames[737] = 3; Main.projFrames[738] = 3; Main.projFrames[779] = 4; Main.projFrames[783] = 4; Main.projFrames[862] = 4; Main.projFrames[863] = 4; Main.projFrames[820] = 4; Main.projFrames[916] = 6; Main.projFrames[34] = 6; Main.projFrames[706] = 8; Main.projFrames[712] = 8; Main.projFrames[663] = 7; Main.projFrames[665] = 9; Main.projFrames[667] = 9; Main.projFrames[677] = 6; Main.projFrames[678] = 6; Main.projFrames[679] = 6; Main.projFrames[688] = 6; Main.projFrames[689] = 6; Main.projFrames[690] = 8; Main.projFrames[691] = 4; Main.projFrames[692] = 4; Main.projFrames[693] = 4; Main.projFrames[694] = 4; Main.projFrames[695] = 4; Main.projFrames[696] = 5; Main.projFrames[700] = 4; Main.projFrames[643] = 8; Main.projFrames[566] = 4; Main.projFrames[565] = 4; Main.projFrames[525] = 5; Main.projFrames[519] = 4; Main.projFrames[509] = 2; Main.projFrames[485] = 5; Main.projFrames[492] = 8; Main.projFrames[500] = 4; Main.projFrames[499] = 12; Main.projFrames[518] = 4; Main.projFrames[585] = 4; Main.projFrames[593] = 4; Main.projFrames[595] = 28; Main.projFrames[735] = 28; Main.projFrames[596] = 4; Main.projFrames[612] = 5; Main.projFrames[613] = 4; Main.projFrames[614] = 4; Main.projFrames[615] = 7; Main.projFrames[623] = 19; Main.projFrames[633] = 5; Main.projFrames[645] = 7; Main.projFrames[650] = 4; Main.projFrames[652] = 6; Main.projFrames[659] = 4; Main.projFrames[714] = 7; Main.projFrames[734] = 8; Main.projFrames[755] = 5; Main.projFrames[759] = 5; Main.projFrames[765] = 10; Main.projFrames[384] = 6; Main.projFrames[385] = 3; Main.projFrames[386] = 6; Main.projFrames[390] = 11; Main.projFrames[391] = 11; Main.projFrames[392] = 11; Main.projFrames[393] = 15; Main.projFrames[394] = 15; Main.projFrames[395] = 15; Main.projFrames[398] = 10; Main.projFrames[407] = 6; Main.projFrames[408] = 2; Main.projFrames[409] = 3; Main.projFrames[387] = 3; Main.projFrames[388] = 3; Main.projFrames[334] = 11; Main.projFrames[324] = 10; Main.projFrames[351] = 2; Main.projFrames[349] = 5; Main.projFrames[423] = 4; Main.projFrames[435] = 4; Main.projFrames[682] = 4; Main.projFrames[436] = 4; Main.projFrames[439] = 6; Main.projFrames[443] = 4; Main.projFrames[447] = 4; Main.projFrames[448] = 3; Main.projFrames[450] = 5; Main.projFrames[454] = 2; Main.projFrames[456] = 4; Main.projFrames[459] = 3; Main.projFrames[462] = 5; Main.projFrames[465] = 4; Main.projFrames[467] = 4; Main.projFrames[468] = 4; Main.projFrames[533] = 21; Main.projFrames[535] = 12; Main.projFrames[539] = 4; Main.projFrames[575] = 4; Main.projFrames[574] = 2; Main.projFrames[634] = 4; Main.projFrames[635] = 4; Main.projFrames[709] = 3; Main.projFrames[353] = 14; Main.projFrames[346] = 2; Main.projFrames[347] = 2; Main.projFrames[335] = 4; Main.projFrames[344] = 3; Main.projFrames[337] = 5; Main.projFrames[317] = 8; Main.projFrames[321] = 3; Main.projFrames[308] = 10; Main.projFrames[316] = 4; Main.projFrames[275] = 2; Main.projFrames[276] = 2; Main.projFrames[254] = 5; Main.projFrames[307] = 2; Main.projFrames[72] = 4; Main.projFrames[86] = 4; Main.projFrames[87] = 4; Main.projFrames[102] = 2; Main.projFrames[111] = 8; Main.projFrames[112] = 3; Main.projFrames[(int) sbyte.MaxValue] = 16; Main.projFrames[175] = 2; Main.projFrames[181] = 4; Main.projFrames[189] = 4; Main.projFrames[191] = 18; Main.projFrames[192] = 18; Main.projFrames[193] = 18; Main.projFrames[194] = 18; Main.projFrames[190] = 4; Main.projFrames[198] = 4; Main.projFrames[199] = 8; Main.projFrames[200] = 10; Main.projFrames[206] = 5; Main.projFrames[208] = 5; Main.projFrames[209] = 12; Main.projFrames[210] = 12; Main.projFrames[211] = 10; Main.projFrames[221] = 3; Main.projFrames[237] = 4; Main.projFrames[238] = 6; Main.projFrames[221] = 3; Main.projFrames[228] = 5; Main.projFrames[229] = 4; Main.projFrames[236] = 13; Main.projFrames[243] = 4; Main.projFrames[244] = 6; Main.projFrames[249] = 5; Main.projFrames[252] = 4; Main.projFrames[266] = 6; Main.projFrames[268] = 8; Main.projFrames[269] = 7; Main.projFrames[270] = 3; Main.projFrames[313] = 12; Main.projFrames[314] = 13; Main.projFrames[319] = 11; Main.projFrames[373] = 3; Main.projFrames[375] = 8; Main.projFrames[377] = 9; Main.projFrames[379] = 4; Main.projFrames[380] = 4; Main.projFrames[601] = 2; Main.projFrames[602] = 4; Main.projFrames[703] = 8; Main.projFrames[701] = 3; Main.projFrames[702] = 4; Main.projFrames[732] = 4; Main.projFrames[731] = 4; Main.projFrames[758] = 24; Main.projFrames[766] = 4; Main.projFrames[767] = 4; Main.projFrames[768] = 4; Main.projFrames[769] = 4; Main.projFrames[770] = 4; Main.projFrames[774] = 8; Main.projFrames[773] = 4; Main.projFrames[815] = 10; Main.projFrames[816] = 17; Main.projFrames[817] = 18; Main.projFrames[821] = 23; Main.projFrames[824] = 4; Main.projFrames[825] = 26; Main.projFrames[826] = 3; Main.projFrames[828] = 2; Main.projFrames[829] = 2; Main.projFrames[831] = 6; Main.projFrames[833] = 10; Main.projFrames[834] = 12; Main.projFrames[835] = 12; Main.projFrames[836] = 4; Main.projFrames[837] = 3; Main.projFrames[839] = 4; Main.projFrames[840] = 4; Main.projFrames[851] = 4; Main.projFrames[853] = 4; Main.projFrames[854] = 19; Main.projFrames[855] = 4; Main.projFrames[858] = 14; Main.projFrames[859] = 24; Main.projFrames[860] = 14; Main.projFrames[861] = 4; Main.projFrames[864] = 2; Main.projFrames[866] = 4; Main.projFrames[870] = 4; Main.projFrames[875] = 11; Main.projFrames[881] = 12; Main.projFrames[882] = 20; Main.projFrames[883] = 3; Main.projFrames[884] = 14; Main.projFrames[885] = 10; Main.projFrames[886] = 8; Main.projFrames[887] = 3; Main.projFrames[888] = 36; Main.projFrames[889] = 11; Main.projFrames[890] = 12; Main.projFrames[891] = 15; Main.projFrames[892] = 6; Main.projFrames[893] = 4; Main.projFrames[894] = 8; Main.projFrames[895] = 6; Main.projFrames[896] = 16; Main.projFrames[897] = 11; Main.projFrames[898] = 16; Main.projFrames[899] = 14; Main.projFrames[900] = 14; Main.projFrames[901] = 12; Main.projFrames[908] = 12; Main.projFrames[909] = 6; Main.projFrames[920] = 3; Main.projFrames[934] = 12; Main.projFrames[880] = 8; Main.projFrames[929] = 8; Main.projPet[492] = true; Main.projPet[499] = true; Main.projPet[653] = true; Main.projPet[701] = true; Main.projPet[703] = true; Main.projPet[702] = true; Main.projPet[764] = true; Main.projPet[765] = true; Main.projPet[319] = true; Main.projPet[334] = true; Main.projPet[324] = true; Main.projPet[266] = true; Main.projPet[313] = true; Main.projPet[314] = true; Main.projPet[317] = true; Main.projPet[175] = true; Main.projPet[111] = true; Main.projPet[112] = true; Main.projPet[(int) sbyte.MaxValue] = true; Main.projPet[191] = true; Main.projPet[192] = true; Main.projPet[193] = true; Main.projPet[194] = true; Main.projPet[197] = true; Main.projPet[198] = true; Main.projPet[199] = true; Main.projPet[200] = true; Main.projPet[208] = true; Main.projPet[209] = true; Main.projPet[210] = true; Main.projPet[211] = true; Main.projPet[236] = true; Main.projPet[268] = true; Main.projPet[269] = true; Main.projPet[353] = true; Main.projPet[373] = true; Main.projPet[375] = true; Main.projPet[380] = true; Main.projPet[387] = true; Main.projPet[388] = true; Main.projPet[390] = true; Main.projPet[391] = true; Main.projPet[392] = true; Main.projPet[393] = true; Main.projPet[394] = true; Main.projPet[395] = true; Main.projPet[398] = true; Main.projPet[407] = true; Main.projPet[423] = true; Main.projPet[533] = true; Main.projPet[613] = true; Main.projPet[623] = true; Main.projPet[625] = true; Main.projPet[626] = true; Main.projPet[627] = true; Main.projPet[628] = true; Main.projPet[755] = true; Main.projPet[758] = true; Main.projPet[759] = true; Main.projPet[774] = true; Main.projPet[815] = true; Main.projPet[816] = true; Main.projPet[817] = true; Main.projPet[821] = true; Main.projPet[825] = true; Main.projPet[831] = true; Main.projPet[833] = true; Main.projPet[834] = true; Main.projPet[835] = true; Main.projPet[854] = true; Main.projPet[858] = true; Main.projPet[859] = true; Main.projPet[860] = true; Main.projPet[864] = true; Main.projPet[875] = true; Main.projPet[946] = true; Main.projPet[881] = true; Main.projPet[882] = true; Main.projPet[883] = true; Main.projPet[884] = true; Main.projPet[885] = true; Main.projPet[886] = true; Main.projPet[887] = true; Main.projPet[888] = true; Main.projPet[889] = true; Main.projPet[890] = true; Main.projPet[891] = true; Main.projPet[892] = true; Main.projPet[893] = true; Main.projPet[894] = true; Main.projPet[895] = true; Main.projPet[896] = true; Main.projPet[897] = true; Main.projPet[898] = true; Main.projPet[899] = true; Main.projPet[900] = true; Main.projPet[901] = true; Main.projPet[934] = true; Main.tileLighted[237] = true; Main.tileLighted[27] = true; Main.tileLighted[381] = true; Main.tileLighted[534] = true; Main.tileLighted[536] = true; Main.tileLighted[539] = true; Main.tileLighted[184] = true; Main.tileLighted[463] = true; Main.tileLighted[491] = true; Main.slimeRainNPC[1] = true; Main.debuff[158] = true; Main.debuff[160] = true; Main.debuff[20] = true; Main.debuff[21] = true; Main.debuff[22] = true; Main.debuff[23] = true; Main.debuff[24] = true; Main.debuff[25] = true; Main.debuff[28] = true; Main.debuff[30] = true; Main.debuff[31] = true; Main.debuff[32] = true; Main.debuff[33] = true; Main.debuff[34] = true; Main.debuff[35] = true; Main.debuff[36] = true; Main.debuff[37] = true; Main.debuff[38] = true; Main.debuff[39] = true; Main.debuff[44] = true; Main.debuff[46] = true; Main.debuff[47] = true; Main.debuff[67] = true; Main.debuff[68] = true; Main.debuff[69] = true; Main.debuff[70] = true; Main.debuff[80] = true; Main.debuff[86] = true; Main.debuff[87] = true; Main.debuff[88] = true; Main.debuff[89] = true; Main.debuff[94] = true; Main.debuff[103] = true; Main.debuff[119] = true; Main.debuff[120] = true; Main.debuff[137] = true; Main.debuff[145] = true; Main.debuff[146] = true; Main.debuff[147] = true; Main.debuff[148] = true; Main.debuff[149] = true; Main.debuff[156] = true; Main.debuff[157] = true; Main.debuff[163] = true; Main.debuff[164] = true; Main.debuff[144] = true; Main.debuff[194] = true; Main.debuff[195] = true; Main.debuff[196] = true; Main.debuff[197] = true; Main.debuff[199] = true; Main.debuff[215] = true; Main.debuff[320] = true; Main.debuff[321] = true; Main.pvpBuff[20] = true; Main.pvpBuff[24] = true; Main.pvpBuff[31] = true; Main.pvpBuff[39] = true; Main.pvpBuff[44] = true; Main.pvpBuff[20] = true; Main.pvpBuff[69] = true; Main.pvpBuff[103] = true; Main.pvpBuff[119] = true; Main.pvpBuff[120] = true; Main.pvpBuff[137] = true; Main.pvpBuff[320] = true; Main.meleeBuff[71] = true; Main.meleeBuff[73] = true; Main.meleeBuff[74] = true; Main.meleeBuff[75] = true; Main.meleeBuff[76] = true; Main.meleeBuff[77] = true; Main.meleeBuff[78] = true; Main.meleeBuff[79] = true; Main.buffNoSave[20] = true; Main.buffNoSave[22] = true; Main.buffNoSave[23] = true; Main.buffNoSave[24] = true; Main.buffNoSave[28] = true; Main.buffNoSave[30] = true; Main.buffNoSave[31] = true; Main.buffNoSave[34] = true; Main.buffNoSave[35] = true; Main.buffNoSave[37] = true; Main.buffNoSave[38] = true; Main.buffNoSave[39] = true; Main.buffNoSave[43] = true; Main.buffNoSave[44] = true; Main.buffNoSave[46] = true; Main.buffNoSave[47] = true; Main.buffNoSave[48] = true; Main.buffNoSave[58] = true; Main.buffNoSave[59] = true; Main.buffNoSave[60] = true; Main.buffNoSave[62] = true; Main.buffNoSave[63] = true; Main.buffNoSave[64] = true; Main.buffNoSave[67] = true; Main.buffNoSave[68] = true; Main.buffNoSave[69] = true; Main.buffNoSave[70] = true; Main.buffNoSave[72] = true; Main.buffNoSave[80] = true; Main.buffNoSave[87] = true; Main.buffNoSave[158] = true; Main.buffNoSave[146] = true; Main.buffNoSave[147] = true; Main.buffNoSave[215] = true; Main.buffNoSave[88] = true; Main.buffNoSave[89] = true; Main.buffNoSave[94] = true; Main.buffNoSave[95] = true; Main.buffNoSave[96] = true; Main.buffNoSave[97] = true; Main.buffNoSave[98] = true; Main.buffNoSave[99] = true; Main.buffNoSave[100] = true; Main.buffNoSave[103] = true; Main.buffNoSave[118] = true; Main.buffNoSave[138] = true; Main.buffNoSave[167] = true; Main.buffNoSave[166] = true; Main.buffNoSave[184] = true; Main.buffNoSave[185] = true; Main.buffNoSave[211] = true; Main.buffNoSave[210] = true; Main.buffNoSave[119] = true; Main.buffNoSave[120] = true; Main.buffNoSave[90] = true; Main.buffNoSave[125] = true; Main.buffNoSave[126] = true; Main.buffNoSave[128] = true; Main.buffNoSave[129] = true; Main.buffNoSave[130] = true; Main.buffNoSave[131] = true; Main.buffNoSave[132] = true; Main.buffNoSave[133] = true; Main.buffNoSave[134] = true; Main.buffNoSave[135] = true; Main.buffNoSave[139] = true; Main.buffNoSave[140] = true; Main.buffNoSave[141] = true; Main.buffNoSave[142] = true; Main.buffNoSave[143] = true; Main.buffNoSave[137] = true; Main.buffNoSave[144] = true; Main.buffNoSave[161] = true; Main.buffNoSave[162] = true; Main.buffNoSave[163] = true; Main.buffNoSave[164] = true; Main.buffNoSave[168] = true; Main.buffNoSave[170] = true; Main.buffNoSave[171] = true; Main.buffNoSave[172] = true; Main.buffNoSave[182] = true; Main.buffNoSave[187] = true; Main.buffNoSave[188] = true; Main.buffNoSave[193] = true; Main.buffNoSave[194] = true; Main.buffNoSave[195] = true; Main.buffNoSave[196] = true; Main.buffNoSave[197] = true; Main.buffNoSave[198] = true; Main.buffNoSave[199] = true; Main.buffNoSave[205] = true; Main.buffNoSave[212] = true; Main.buffNoSave[213] = true; Main.buffNoSave[214] = true; Main.buffNoSave[230] = true; Main.buffNoSave[263] = true; Main.buffNoSave[265] = true; Main.buffNoSave[271] = true; Main.buffNoSave[322] = true; Main.buffNoSave[275] = true; Main.buffNoSave[276] = true; Main.buffNoSave[277] = true; Main.buffNoSave[278] = true; Main.buffNoSave[279] = true; Main.buffNoSave[280] = true; Main.buffNoSave[281] = true; Main.buffNoSave[282] = true; Main.buffNoSave[283] = true; Main.buffNoSave[305] = true; Main.buffNoSave[318] = true; Main.buffNoSave[320] = true; Main.buffNoSave[321] = true; for (int index = 173; index <= 181; ++index) Main.buffNoSave[index] = true; Main.buffNoTimeDisplay[19] = true; Main.buffNoTimeDisplay[27] = true; Main.buffNoTimeDisplay[28] = true; Main.buffNoTimeDisplay[34] = true; Main.buffNoTimeDisplay[37] = true; Main.buffNoTimeDisplay[38] = true; Main.buffNoTimeDisplay[40] = true; Main.buffNoTimeDisplay[41] = true; Main.buffNoTimeDisplay[42] = true; Main.buffNoTimeDisplay[43] = true; Main.buffNoTimeDisplay[45] = true; Main.buffNoTimeDisplay[49] = true; Main.buffNoTimeDisplay[60] = true; Main.buffNoTimeDisplay[62] = true; Main.buffNoTimeDisplay[64] = true; Main.buffNoTimeDisplay[68] = true; Main.buffNoTimeDisplay[81] = true; Main.buffNoTimeDisplay[82] = true; Main.buffNoTimeDisplay[83] = true; Main.buffNoTimeDisplay[90] = true; Main.buffNoTimeDisplay[95] = true; Main.buffNoTimeDisplay[96] = true; Main.buffNoTimeDisplay[97] = true; Main.buffNoTimeDisplay[98] = true; Main.buffNoTimeDisplay[99] = true; Main.buffNoTimeDisplay[100] = true; Main.buffNoTimeDisplay[101] = true; Main.buffNoTimeDisplay[102] = true; Main.buffNoTimeDisplay[118] = true; Main.buffNoTimeDisplay[138] = true; Main.buffNoTimeDisplay[167] = true; Main.buffNoTimeDisplay[166] = true; Main.buffNoTimeDisplay[184] = true; Main.buffNoTimeDisplay[185] = true; Main.buffNoTimeDisplay[211] = true; Main.buffNoTimeDisplay[210] = true; Main.buffNoTimeDisplay[125] = true; Main.buffNoTimeDisplay[126] = true; Main.buffNoTimeDisplay[128] = true; Main.buffNoTimeDisplay[129] = true; Main.buffNoTimeDisplay[130] = true; Main.buffNoTimeDisplay[131] = true; Main.buffNoTimeDisplay[132] = true; Main.buffNoTimeDisplay[133] = true; Main.buffNoTimeDisplay[134] = true; Main.buffNoTimeDisplay[135] = true; Main.buffNoTimeDisplay[136] = true; Main.buffNoTimeDisplay[139] = true; Main.buffNoTimeDisplay[140] = true; Main.buffNoTimeDisplay[141] = true; Main.buffNoTimeDisplay[142] = true; Main.buffNoTimeDisplay[143] = true; Main.buffNoTimeDisplay[137] = true; Main.buffNoTimeDisplay[200] = true; Main.buffNoTimeDisplay[202] = true; Main.buffNoTimeDisplay[201] = true; Main.buffNoTimeDisplay[161] = true; Main.buffNoTimeDisplay[162] = true; Main.buffNoTimeDisplay[163] = true; Main.buffNoTimeDisplay[168] = true; Main.buffNoTimeDisplay[170] = true; Main.buffNoTimeDisplay[171] = true; Main.buffNoTimeDisplay[172] = true; Main.buffNoTimeDisplay[182] = true; Main.buffNoTimeDisplay[165] = true; Main.buffNoTimeDisplay[186] = true; Main.buffNoTimeDisplay[187] = true; Main.buffNoTimeDisplay[188] = true; Main.buffNoTimeDisplay[193] = true; Main.buffNoTimeDisplay[199] = true; Main.buffNoTimeDisplay[212] = true; Main.buffNoTimeDisplay[213] = true; Main.buffNoTimeDisplay[214] = true; Main.buffNoTimeDisplay[216] = true; Main.buffNoTimeDisplay[217] = true; Main.buffNoTimeDisplay[219] = true; Main.buffNoTimeDisplay[230] = true; Main.buffNoTimeDisplay[258] = true; Main.buffNoTimeDisplay[259] = true; Main.buffNoTimeDisplay[260] = true; Main.buffNoTimeDisplay[261] = true; Main.buffNoTimeDisplay[262] = true; Main.buffNoTimeDisplay[263] = true; Main.buffNoTimeDisplay[264] = true; Main.buffNoTimeDisplay[265] = true; Main.buffNoTimeDisplay[266] = true; Main.buffNoTimeDisplay[267] = true; Main.buffNoTimeDisplay[268] = true; Main.buffNoTimeDisplay[271] = true; Main.buffNoTimeDisplay[322] = true; Main.buffNoTimeDisplay[274] = true; Main.buffNoTimeDisplay[275] = true; Main.buffNoTimeDisplay[276] = true; Main.buffNoTimeDisplay[277] = true; Main.buffNoTimeDisplay[278] = true; Main.buffNoTimeDisplay[279] = true; Main.buffNoTimeDisplay[280] = true; Main.buffNoTimeDisplay[281] = true; Main.buffNoTimeDisplay[282] = true; Main.buffNoTimeDisplay[283] = true; Main.buffNoTimeDisplay[284] = true; Main.buffNoTimeDisplay[285] = true; Main.buffNoTimeDisplay[286] = true; Main.buffNoTimeDisplay[287] = true; Main.buffNoTimeDisplay[288] = true; Main.buffNoTimeDisplay[289] = true; Main.buffNoTimeDisplay[290] = true; Main.buffNoTimeDisplay[291] = true; Main.buffNoTimeDisplay[292] = true; Main.buffNoTimeDisplay[293] = true; Main.buffNoTimeDisplay[294] = true; Main.buffNoTimeDisplay[295] = true; Main.buffNoTimeDisplay[296] = true; Main.buffNoTimeDisplay[297] = true; Main.buffNoTimeDisplay[298] = true; Main.buffNoTimeDisplay[299] = true; Main.buffNoTimeDisplay[300] = true; Main.buffNoTimeDisplay[301] = true; Main.buffNoTimeDisplay[302] = true; Main.buffNoTimeDisplay[303] = true; Main.buffNoTimeDisplay[304] = true; Main.buffNoTimeDisplay[305] = true; Main.buffNoTimeDisplay[317] = true; Main.buffNoTimeDisplay[318] = true; Main.buffNoTimeDisplay[320] = true; Main.persistentBuff[71] = true; Main.persistentBuff[73] = true; Main.persistentBuff[74] = true; Main.persistentBuff[75] = true; Main.persistentBuff[76] = true; Main.persistentBuff[77] = true; Main.persistentBuff[78] = true; Main.persistentBuff[79] = true; for (int index = 0; index < BuffID.Sets.BasicMountData.Length; ++index) { if (BuffID.Sets.BasicMountData[index] != null) { Main.buffNoTimeDisplay[index] = true; Main.buffNoSave[index] = true; } } Main.vanityPet[40] = true; Main.vanityPet[41] = true; Main.vanityPet[42] = true; Main.vanityPet[45] = true; Main.vanityPet[50] = true; Main.vanityPet[51] = true; Main.vanityPet[52] = true; Main.vanityPet[53] = true; Main.vanityPet[54] = true; Main.vanityPet[55] = true; Main.vanityPet[56] = true; Main.vanityPet[61] = true; Main.vanityPet[154] = true; Main.vanityPet[65] = true; Main.vanityPet[66] = true; Main.vanityPet[81] = true; Main.vanityPet[82] = true; Main.vanityPet[84] = true; Main.vanityPet[85] = true; Main.vanityPet[91] = true; Main.vanityPet[92] = true; Main.vanityPet[(int) sbyte.MaxValue] = true; Main.vanityPet[136] = true; Main.vanityPet[191] = true; Main.vanityPet[202] = true; Main.vanityPet[200] = true; Main.vanityPet[218] = true; Main.vanityPet[219] = true; Main.vanityPet[217] = true; Main.vanityPet[258] = true; Main.vanityPet[259] = true; Main.vanityPet[260] = true; Main.vanityPet[261] = true; Main.vanityPet[262] = true; Main.vanityPet[264] = true; Main.vanityPet[266] = true; Main.vanityPet[267] = true; Main.vanityPet[268] = true; Main.vanityPet[274] = true; Main.vanityPet[284] = true; Main.vanityPet[285] = true; Main.vanityPet[286] = true; Main.vanityPet[287] = true; Main.vanityPet[288] = true; Main.vanityPet[289] = true; Main.vanityPet[290] = true; Main.vanityPet[291] = true; Main.vanityPet[292] = true; Main.vanityPet[293] = true; Main.vanityPet[295] = true; Main.vanityPet[296] = true; Main.vanityPet[297] = true; Main.vanityPet[300] = true; Main.vanityPet[301] = true; Main.vanityPet[302] = true; Main.vanityPet[303] = true; Main.vanityPet[304] = true; Main.vanityPet[317] = true; Main.lightPet[19] = true; Main.lightPet[155] = true; Main.lightPet[27] = true; Main.lightPet[101] = true; Main.lightPet[102] = true; Main.lightPet[57] = true; Main.lightPet[190] = true; Main.lightPet[152] = true; Main.lightPet[201] = true; Main.lightPet[294] = true; Main.lightPet[298] = true; Main.lightPet[299] = true; Main.tileFlame[4] = true; Main.tileFlame[33] = true; Main.tileFlame[34] = true; Main.tileFlame[35] = true; Main.tileFlame[42] = true; Main.tileFlame[49] = true; Main.tileFlame[93] = true; Main.tileFlame[98] = true; Main.tileFlame[100] = true; Main.tileFlame[173] = true; Main.tileFlame[174] = true; Main.tileFlame[372] = true; Main.tileRope[213] = true; Main.tileRope[214] = true; Main.tileRope[353] = true; Main.tileRope[365] = true; Main.tileRope[366] = true; Main.tileRope[504] = true; Main.tileRope[449] = true; Main.tileRope[450] = true; Main.tileRope[451] = true; Main.tilePile[330] = true; Main.tilePile[331] = true; Main.tilePile[332] = true; Main.tilePile[333] = true; for (int index = 0; index < 663; ++index) Main.npcCatchable[index] = false; Main.npcCatchable[46] = true; Main.npcCatchable[55] = true; Main.npcCatchable[74] = true; Main.npcCatchable[148] = true; Main.npcCatchable[149] = true; Main.npcCatchable[297] = true; Main.npcCatchable[298] = true; Main.npcCatchable[299] = true; Main.npcCatchable[300] = true; Main.npcCatchable[355] = true; Main.npcCatchable[356] = true; Main.npcCatchable[357] = true; Main.npcCatchable[358] = true; Main.npcCatchable[359] = true; Main.npcCatchable[360] = true; Main.npcCatchable[361] = true; Main.npcCatchable[362] = true; Main.npcCatchable[363] = true; Main.npcCatchable[364] = true; Main.npcCatchable[365] = true; Main.npcCatchable[366] = true; Main.npcCatchable[367] = true; Main.npcCatchable[374] = true; Main.npcCatchable[377] = true; Main.npcCatchable[539] = true; Main.npcCatchable[538] = true; Main.npcCatchable[484] = true; Main.npcCatchable[485] = true; Main.npcCatchable[486] = true; Main.npcCatchable[487] = true; Main.npcCatchable[583] = true; Main.npcCatchable[584] = true; Main.npcCatchable[585] = true; Main.npcCatchable[592] = true; Main.npcCatchable[593] = true; Main.npcCatchable[595] = true; Main.npcCatchable[596] = true; Main.npcCatchable[597] = true; Main.npcCatchable[598] = true; Main.npcCatchable[599] = true; Main.npcCatchable[600] = true; Main.npcCatchable[601] = true; Main.npcCatchable[604] = true; Main.npcCatchable[605] = true; Main.npcCatchable[602] = true; Main.npcCatchable[603] = true; Main.npcCatchable[606] = true; Main.npcCatchable[607] = true; Main.npcCatchable[608] = true; Main.npcCatchable[609] = true; Main.npcCatchable[610] = true; Main.npcCatchable[611] = true; Main.npcCatchable[612] = true; Main.npcCatchable[613] = true; Main.npcCatchable[614] = true; Main.npcCatchable[616] = true; Main.npcCatchable[617] = true; Main.npcCatchable[626] = true; Main.npcCatchable[627] = true; Main.npcCatchable[639] = true; Main.npcCatchable[640] = true; Main.npcCatchable[641] = true; Main.npcCatchable[642] = true; Main.npcCatchable[643] = true; Main.npcCatchable[644] = true; Main.npcCatchable[645] = true; Main.npcCatchable[646] = true; Main.npcCatchable[647] = true; Main.npcCatchable[648] = true; Main.npcCatchable[649] = true; Main.npcCatchable[650] = true; Main.npcCatchable[651] = true; Main.npcCatchable[652] = true; Main.npcCatchable[653] = true; Main.npcCatchable[654] = true; Main.npcCatchable[655] = true; Main.npcCatchable[661] = true; for (int index = 442; index <= 448; ++index) Main.npcCatchable[index] = true; Main.SetTileValue(); Main.tileSpelunker[6] = true; Main.tileSpelunker[7] = true; Main.tileSpelunker[8] = true; Main.tileSpelunker[9] = true; Main.tileSpelunker[12] = true; Main.tileSpelunker[21] = true; Main.tileSpelunker[467] = true; Main.tileSpelunker[441] = true; Main.tileSpelunker[468] = true; Main.tileSpelunker[28] = true; Main.tileSpelunker[107] = true; Main.tileSpelunker[108] = true; Main.tileSpelunker[111] = true; Main.tileSpelunker[63] = true; Main.tileSpelunker[64] = true; Main.tileSpelunker[65] = true; Main.tileSpelunker[66] = true; Main.tileSpelunker[67] = true; Main.tileSpelunker[68] = true; Main.tileSpelunker[566] = true; Main.tileSpelunker[166] = true; Main.tileSpelunker[167] = true; Main.tileSpelunker[168] = true; Main.tileSpelunker[169] = true; Main.tileSpelunker[178] = true; Main.tileSpelunker[211] = true; Main.tileSpelunker[221] = true; Main.tileSpelunker[222] = true; Main.tileSpelunker[223] = true; Main.tileSpelunker[236] = true; Main.tileSpelunker[37] = true; Main.tileSpelunker[407] = true; Main.tileSpelunker[227] = true; Main.tileSpelunker[84] = true; Main.tileSpelunker[83] = true; Main.tileSpelunker[404] = true; Main.SetupTileMerge(); Main.tileSolid[379] = true; Main.tileMergeDirt[249] = true; Main.tileBrick[268] = true; Main.tileBrick[262] = true; Main.tileBrick[267] = true; Main.tileBrick[265] = true; Main.tileBrick[266] = true; Main.tileBrick[264] = true; Main.tileBrick[263] = true; Main.tileSolid[371] = true; Main.tileMergeDirt[371] = true; Main.tileBlockLight[371] = true; Main.tileBouncy[371] = true; Main.tileBouncy[448] = true; Main.tileBouncy[446] = true; Main.tileBouncy[447] = true; Main.tileFrameImportant[377] = true; Main.tileFrameImportant[373] = true; Main.tileFrameImportant[375] = true; Main.tileFrameImportant[374] = true; Main.tileFrameImportant[461] = true; Main.tileLighted[372] = true; Main.tileFrameImportant[372] = true; Main.tileWaterDeath[372] = true; Main.tileLavaDeath[372] = true; Main.tileSolid[357] = true; Main.tileBrick[357] = true; Main.tileBrick[311] = true; Main.tileSolid[408] = true; Main.tileMergeDirt[408] = true; Main.tileBrick[408] = true; Main.tileSolid[409] = true; Main.tileBrick[409] = true; Main.tileSolid[415] = true; Main.tileBrick[415] = true; Main.tileLighted[415] = true; Main.tileSolid[416] = true; Main.tileBrick[416] = true; Main.tileLighted[416] = true; Main.tileSolid[417] = true; Main.tileBrick[417] = true; Main.tileLighted[417] = true; Main.tileSolid[418] = true; Main.tileBrick[418] = true; Main.tileLighted[418] = true; Main.tileSolid[498] = true; Main.tileBrick[498] = true; Main.tileBlockLight[498] = true; Main.tileBrick[37] = true; Main.tileBrick[117] = true; Main.tileBrick[25] = true; Main.tileBrick[203] = true; Main.tileSolid[232] = true; Main.tileSolid[311] = true; Main.tileSolid[312] = true; Main.tileSolid[313] = true; Main.tileMergeDirt[311] = true; Main.tileSolid[315] = true; Main.tileMergeDirt[315] = true; Main.tileSolid[321] = true; Main.tileSolid[322] = true; Main.tileBlockLight[321] = true; Main.tileBlockLight[322] = true; Main.tileMergeDirt[321] = true; Main.tileMergeDirt[322] = true; Main.tileBrick[321] = true; Main.tileBrick[322] = true; Main.tileShine[239] = 1100; Main.tileSolid[239] = true; Main.tileSolidTop[239] = true; Main.tileSolid[380] = true; Main.tileSolidTop[380] = true; Main.tileFrameImportant[358] = true; Main.tileFrameImportant[359] = true; Main.tileFrameImportant[360] = true; Main.tileFrameImportant[361] = true; Main.tileFrameImportant[362] = true; Main.tileFrameImportant[363] = true; Main.tileFrameImportant[364] = true; Main.tileFrameImportant[391] = true; Main.tileLighted[391] = true; Main.tileFrameImportant[392] = true; Main.tileFrameImportant[393] = true; Main.tileFrameImportant[394] = true; Main.tileFrameImportant[542] = true; Main.tileFrameImportant[505] = true; Main.tileFrameImportant[521] = true; Main.tileFrameImportant[522] = true; Main.tileFrameImportant[523] = true; Main.tileFrameImportant[524] = true; Main.tileFrameImportant[525] = true; Main.tileFrameImportant[526] = true; Main.tileFrameImportant[527] = true; Main.tileFrameImportant[543] = true; Main.tileFrameImportant[568] = true; Main.tileFrameImportant[569] = true; Main.tileFrameImportant[570] = true; Main.tileFrameImportant[598] = true; Main.tileFrameImportant[356] = true; Main.tileFrameImportant[334] = true; Main.tileFrameImportant[440] = true; Main.tileFrameImportant[471] = true; Main.tileFrameImportant[300] = true; Main.tileFrameImportant[301] = true; Main.tileFrameImportant[302] = true; Main.tileFrameImportant[303] = true; Main.tileFrameImportant[304] = true; Main.tileFrameImportant[305] = true; Main.tileFrameImportant[306] = true; Main.tileFrameImportant[307] = true; Main.tileFrameImportant[308] = true; Main.tileFrameImportant[354] = true; Main.tileLighted[354] = true; Main.tileFrameImportant[499] = true; Main.tileFrameImportant[355] = true; Main.tileFrameImportant[324] = true; Main.tileObsidianKill[324] = true; Main.tileLavaDeath[324] = true; Main.tileFrameImportant[463] = true; Main.tileFrameImportant[491] = true; Main.tileFrameImportant[464] = true; Main.tileFrameImportant[466] = true; Main.tileFrameImportant[419] = true; Main.tileFrameImportant[442] = true; Main.tileFrameImportant[443] = true; Main.tileFrameImportant[444] = true; Main.tileFrameImportant[420] = true; Main.tileFrameImportant[423] = true; Main.tileFrameImportant[424] = true; Main.tileFrameImportant[428] = true; Main.tileFrameImportant[520] = true; Main.tileFrameImportant[429] = true; Main.tileFrameImportant[445] = true; Main.tileFrameImportant[476] = true; Main.tileFrameImportant[283] = true; Main.tileFrameImportant[288] = true; Main.tileFrameImportant[289] = true; Main.tileFrameImportant[290] = true; Main.tileFrameImportant[291] = true; Main.tileFrameImportant[292] = true; Main.tileFrameImportant[293] = true; Main.tileFrameImportant[294] = true; Main.tileFrameImportant[295] = true; Main.tileFrameImportant[296] = true; Main.tileFrameImportant[297] = true; Main.tileFrameImportant[316] = true; Main.tileFrameImportant[317] = true; Main.tileFrameImportant[318] = true; Main.tileLargeFrames[284] = (byte) 1; Main.wallHouse[224] = true; Main.wallLargeFrames[224] = (byte) 2; Main.wallHouse[60] = true; Main.wallHouse[225] = true; Main.wallHouse[226] = true; Main.wallHouse[227] = true; Main.wallHouse[231] = true; Main.wallHouse[232] = true; Main.wallHouse[233] = true; Main.wallHouse[235] = true; Main.wallHouse[234] = true; Main.wallHouse[312] = true; Main.wallHouse[313] = true; Main.wallHouse[237] = true; Main.wallHouse[238] = true; Main.wallHouse[239] = true; Main.wallHouse[240] = true; Main.tileLargeFrames[409] = (byte) 2; Main.tileFrameImportant[410] = true; Main.tileFrameImportant[480] = true; Main.tileFrameImportant[509] = true; Main.wallHouse[173] = true; Main.wallHouse[183] = true; Main.wallHouse[179] = true; Main.wallLargeFrames[179] = (byte) 1; Main.tileSolid[367] = true; Main.tileBlockLight[367] = true; Main.tileMergeDirt[367] = true; Main.tileSolid[357] = true; Main.tileBlockLight[357] = true; Main.tileLargeFrames[357] = (byte) 1; Main.tileBlendAll[357] = true; Main.wallHouse[184] = true; Main.wallHouse[181] = true; Main.tileSolid[368] = true; Main.tileBlockLight[368] = true; Main.tileMergeDirt[368] = true; Main.tileSolid[369] = true; Main.tileBlockLight[369] = true; Main.tileBrick[369] = true; Main.tileMergeDirt[369] = true; Main.wallHouse[186] = true; Main.tileLargeFrames[325] = (byte) 1; Main.tileSolid[325] = true; Main.tileBlockLight[325] = true; Main.wallLargeFrames[146] = (byte) 1; Main.wallLargeFrames[147] = (byte) 1; Main.wallLargeFrames[167] = (byte) 1; Main.wallLargeFrames[185] = (byte) 2; Main.wallLargeFrames[274] = (byte) 2; Main.tileSolid[460] = true; Main.tileSolid[326] = true; Main.tileBlockLight[326] = true; Main.tileBrick[326] = true; Main.tileSolid[458] = true; Main.tileBlockLight[458] = true; Main.tileBrick[458] = true; Main.tileSolid[459] = true; Main.tileBrick[459] = true; Main.tileSolid[327] = true; Main.tileBlockLight[327] = true; Main.tileBrick[327] = true; Main.tileSolid[345] = true; Main.tileBlockLight[345] = true; Main.tileBrick[345] = true; Main.tileLighted[327] = true; Main.tileSolid[328] = true; Main.tileBrick[328] = true; Main.tileSolid[329] = true; Main.tileBrick[329] = true; Main.tileBlockLight[329] = true; Main.tileSolid[507] = true; Main.tileBlockLight[507] = true; Main.tileBrick[507] = true; Main.tileSolid[508] = true; Main.tileBlockLight[508] = true; Main.tileBrick[508] = true; Main.tileLighted[336] = true; Main.tileLighted[340] = true; Main.tileLighted[341] = true; Main.tileLighted[342] = true; Main.tileLighted[343] = true; Main.tileLighted[344] = true; Main.tileLighted[349] = true; Main.tileLighted[598] = true; Main.tileSolid[421] = true; Main.tileBlockLight[421] = true; Main.tileSolid[422] = true; Main.tileBlockLight[422] = true; Main.tileSolid[426] = true; Main.tileBlockLight[426] = true; Main.tileSolid[430] = true; Main.tileBlockLight[430] = true; Main.tileSolid[431] = true; Main.tileBlockLight[431] = true; Main.tileSolid[432] = true; Main.tileBlockLight[432] = true; Main.tileSolid[433] = true; Main.tileBlockLight[433] = true; Main.tileSolid[434] = true; Main.tileBlockLight[434] = true; Main.tileSolid[446] = true; Main.tileSolid[447] = true; Main.tileSolid[448] = true; Main.tileFrameImportant[427] = true; Main.tileSolidTop[427] = true; Main.tileSolid[427] = true; Main.tileNoAttach[427] = true; Main.tileTable[427] = true; Main.tileLavaDeath[427] = true; Main.tileNoSunLight[427] = false; Main.tileSolid[476] = true; for (int index = 435; index <= 439; ++index) { Main.tileFrameImportant[index] = true; Main.tileSolidTop[index] = true; Main.tileSolid[index] = true; Main.tileNoAttach[index] = true; Main.tileTable[index] = true; Main.tileLavaDeath[index] = true; Main.tileNoSunLight[index] = false; } Main.tileSolid[284] = true; Main.tileBlockLight[284] = true; Main.tileSolid[346] = true; Main.tileBlockLight[346] = true; Main.tileLighted[346] = true; Main.tileShine[346] = 2000; Main.tileShine2[346] = true; Main.tileBrick[346] = true; Main.tileMergeDirt[346] = true; Main.tileSolid[347] = true; Main.tileBlockLight[347] = true; Main.tileLighted[347] = true; Main.tileShine[347] = 1900; Main.tileShine2[347] = true; Main.tileBrick[347] = true; Main.tileMergeDirt[347] = true; Main.tileSolid[348] = true; Main.tileBlockLight[348] = true; Main.tileLighted[348] = true; Main.tileShine[348] = 1800; Main.tileShine2[348] = true; Main.tileBrick[348] = true; Main.tileMergeDirt[348] = true; Main.tileSolid[350] = true; Main.tileBlockLight[350] = true; Main.tileLighted[350] = true; Main.tileBrick[350] = true; Main.tileMergeDirt[350] = true; Main.tileGlowMask[350] = (short) 94; Main.tileGlowMask[390] = (short) 130; Main.tileGlowMask[381] = (short) 126; Main.tileGlowMask[517] = (short) 258; Main.tileGlowMask[534] = (short) 259; Main.tileGlowMask[535] = (short) 260; Main.tileGlowMask[536] = (short) 261; Main.tileGlowMask[537] = (short) 262; Main.tileGlowMask[539] = (short) 263; Main.tileGlowMask[540] = (short) 264; Main.tileGlowMask[370] = (short) 111; Main.tileGlowMask[429] = (short) 214; Main.tileGlowMask[209] = (short) 215; Main.tileGlowMask[445] = (short) 214; Main.tileGlowMask[129] = (short) -2; Main.tileLighted[429] = true; Main.tileLighted[209] = true; Main.tileGlowMask[410] = (short) 201; Main.tileGlowMask[509] = (short) 265; Main.tileSolid[370] = true; Main.tileBlockLight[370] = true; Main.tileLighted[370] = true; Main.tileShine[370] = 1900; Main.tileShine2[370] = true; Main.tileBrick[370] = true; Main.tileMergeDirt[370] = true; Main.tileContainer[21] = true; Main.tileContainer[467] = true; Main.tileContainer[88] = true; Main.tileContainer[470] = true; Main.tileContainer[475] = true; Main.tileSign[55] = true; Main.tileSign[85] = true; Main.tileSign[425] = true; Main.tileSign[573] = true; Main.tileSolid[383] = true; Main.tileBrick[383] = true; Main.tileBlockLight[383] = true; Main.tileSolid[385] = true; Main.tileBrick[385] = true; Main.tileBlockLight[385] = true; Main.tileSolid[472] = true; Main.tileBrick[472] = true; Main.tileMergeDirt[472] = true; Main.tileBlockLight[472] = true; Main.tileSolid[473] = true; Main.tileBrick[473] = true; Main.tileMergeDirt[473] = true; Main.tileBlockLight[473] = true; Main.tileSolid[500] = true; Main.tileBrick[500] = true; Main.tileLighted[500] = true; Main.tileMergeDirt[500] = true; Main.tileBlockLight[500] = true; Main.tileSolid[501] = true; Main.tileBrick[501] = true; Main.tileLighted[501] = true; Main.tileMergeDirt[501] = true; Main.tileBlockLight[501] = true; Main.tileSolid[502] = true; Main.tileBrick[502] = true; Main.tileLighted[502] = true; Main.tileMergeDirt[502] = true; Main.tileBlockLight[502] = true; Main.tileSolid[503] = true; Main.tileBrick[503] = true; Main.tileLighted[503] = true; Main.tileMergeDirt[503] = true; Main.tileBlockLight[503] = true; Main.tileSolid[541] = true; Main.tileBlockLight[541] = false; Main.tileSolid[546] = true; Main.tileBlockLight[546] = false; Main.tileSolid[557] = true; Main.tileBlockLight[557] = true; Main.tileSolid[474] = true; Main.tileBrick[474] = true; Main.tileMergeDirt[474] = true; Main.tileBlockLight[474] = true; Main.tileSolid[478] = true; Main.tileBrick[478] = true; Main.tileMergeDirt[478] = true; Main.tileBlockLight[478] = true; Main.tileSolid[479] = true; Main.tileBrick[479] = true; Main.tileMergeDirt[479] = true; Main.tileBlockLight[479] = true; Main.tileSolid[562] = true; Main.tileBrick[562] = true; Main.tileBlockLight[562] = true; Main.tileMergeDirt[562] = true; Main.tileSolid[563] = true; Main.tileBrick[563] = true; Main.tileBlockLight[563] = true; Main.tileMergeDirt[563] = true; Main.tileSolid[496] = true; Main.tileBrick[496] = true; Main.tileMergeDirt[496] = true; Main.tileBlockLight[496] = true; Main.tileSolid[495] = true; Main.tileBrick[495] = true; Main.tileMergeDirt[495] = true; Main.tileBlockLight[495] = true; Main.tileSolid[396] = true; Main.tileBlockLight[396] = true; Main.tileSolid[397] = true; Main.tileBlockLight[397] = true; Main.tileSolid[399] = true; Main.tileBlockLight[399] = true; Main.tileSolid[401] = true; Main.tileBlockLight[401] = true; Main.tileSolid[398] = true; Main.tileBlockLight[398] = true; Main.tileSolid[400] = true; Main.tileBlockLight[400] = true; Main.tileSolid[402] = true; Main.tileBlockLight[402] = true; Main.tileSolid[403] = true; Main.tileBlockLight[403] = true; Main.tileSolid[404] = true; Main.tileBlockLight[404] = true; Main.tileSolid[407] = true; Main.tileBlockLight[407] = true; Main.tileShine2[407] = true; Main.tileShine[407] = 1000; Main.tileFrameImportant[36] = true; Main.tileFrameImportant[275] = true; Main.tileFrameImportant[276] = true; Main.tileFrameImportant[277] = true; Main.tileFrameImportant[278] = true; Main.tileFrameImportant[279] = true; Main.tileFrameImportant[280] = true; Main.tileFrameImportant[281] = true; Main.tileFrameImportant[282] = true; Main.tileFrameImportant[285] = true; Main.tileFrameImportant[286] = true; Main.tileFrameImportant[414] = true; Main.tileFrameImportant[413] = true; Main.tileFrameImportant[309] = true; Main.tileFrameImportant[310] = true; Main.tileFrameImportant[339] = true; Main.tileFrameImportant[532] = true; Main.tileLighted[286] = true; Main.tileLighted[302] = true; Main.tileFrameImportant[298] = true; Main.tileFrameImportant[299] = true; Main.tileSolid[170] = true; Main.tileBlockLight[170] = true; Main.tileFrameImportant[171] = true; Main.tileLighted[171] = true; Main.tileFrameImportant[247] = true; Main.tileFrameImportant[245] = true; Main.tileFrameImportant[246] = true; Main.tileFrameImportant[239] = true; Main.tileFrameImportant[240] = true; Main.tileFrameImportant[241] = true; Main.tileFrameImportant[242] = true; Main.tileFrameImportant[243] = true; Main.tileFrameImportant[244] = true; Main.tileFrameImportant[254] = true; Main.tileSolid[221] = true; Main.tileBlockLight[221] = true; Main.tileMergeDirt[221] = true; Main.tileLighted[96] = true; Main.tileMergeDirt[250] = true; Main.tileSolid[272] = true; Main.tileBlockLight[272] = true; Main.tileSolid[229] = true; Main.tileBlockLight[229] = true; Main.tileMergeDirt[229] = true; Main.tileSolid[230] = true; Main.tileBlockLight[230] = true; Main.tileMergeDirt[230] = true; Main.tileSolid[222] = true; Main.tileBlockLight[222] = true; Main.tileMergeDirt[222] = true; Main.tileSolid[223] = true; Main.tileBlockLight[223] = true; Main.tileMergeDirt[223] = true; Main.tileSolid[224] = true; Main.tileBlockLight[224] = true; Main.tileFrameImportant[237] = true; Main.tileFrameImportant[238] = true; Main.tileSolid[225] = true; Main.tileBlockLight[225] = true; Main.tileBrick[225] = true; Main.tileSolid[226] = true; Main.tileBlockLight[226] = true; Main.tileBrick[226] = true; Main.tileSolid[235] = true; Main.tileBlockLight[235] = true; Main.tileFrameImportant[235] = true; Main.tileLighted[238] = true; Main.tileCut[254] = true; Main.tileFrameImportant[236] = true; Main.tileCut[236] = true; Main.tileSolid[191] = true; Main.tileBrick[191] = true; Main.tileBlockLight[191] = true; Main.tileSolid[211] = true; Main.tileBlockLight[211] = true; Main.tileSolid[208] = true; Main.tileBrick[208] = true; Main.tileBlockLight[208] = true; Main.tileSolid[192] = true; Main.tileBlockLight[192] = true; Main.tileSolid[193] = true; Main.tileBrick[193] = true; Main.tileBlockLight[193] = true; Main.tileMergeDirt[193] = true; Main.tileSolid[194] = true; Main.tileBrick[194] = true; Main.tileBlockLight[194] = true; Main.tileSolid[195] = true; Main.tileBrick[195] = true; Main.tileMergeDirt[195] = true; Main.tileBlockLight[195] = true; Main.tileBlockLight[200] = true; Main.tileSolid[200] = true; Main.tileBrick[200] = true; Main.tileBlockLight[203] = true; Main.tileSolid[203] = true; Main.tileMergeDirt[203] = true; Main.tileBlockLight[204] = true; Main.tileSolid[204] = true; Main.tileMergeDirt[204] = true; Main.tileBlockLight[165] = true; Main.tileShine2[147] = true; Main.tileShine2[161] = true; Main.tileShine2[163] = true; Main.tileShine2[164] = true; Main.tileSolid[189] = true; Main.tileBlockLight[51] = true; Main.tileLighted[204] = true; Main.tileShine[204] = 1150; Main.tileShine2[204] = true; Main.tileSolid[190] = true; Main.tileBlockLight[190] = true; Main.tileBrick[190] = true; Main.tileSolid[198] = true; Main.tileMergeDirt[198] = true; Main.tileBrick[198] = true; Main.tileBlockLight[198] = true; Main.tileSolid[206] = true; Main.tileBlockLight[206] = true; Main.tileMergeDirt[206] = true; Main.tileBrick[206] = true; Main.tileBlockLight[234] = true; Main.tileSolid[248] = true; Main.tileSolid[249] = true; Main.tileSolid[250] = true; Main.tileBrick[248] = true; Main.tileBrick[249] = true; Main.tileBrick[250] = true; Main.tileSolid[251] = true; Main.tileSolid[252] = true; Main.tileBrick[252] = true; Main.tileSolid[253] = true; Main.tileBrick[253] = true; Main.tileMergeDirt[251] = true; Main.tileMergeDirt[252] = true; Main.tileMergeDirt[253] = true; Main.tileBlockLight[251] = true; Main.tileBlockLight[252] = true; Main.tileBlockLight[253] = true; Main.tileBlockLight[248] = true; Main.tileBlockLight[249] = true; Main.tileBlockLight[250] = true; Main.tileLargeFrames[273] = (byte) 1; Main.tileSolid[273] = true; Main.tileBlockLight[273] = true; Main.tileLargeFrames[274] = (byte) 1; Main.tileSolid[274] = true; Main.tileBlockLight[274] = true; Main.tileLargeFrames[618] = (byte) 1; Main.tileSolid[618] = true; Main.tileBlockLight[618] = true; for (int maxValue = (int) byte.MaxValue; maxValue <= 268; ++maxValue) { Main.tileSolid[maxValue] = true; if (maxValue > 261) { Main.tileLighted[maxValue] = true; Main.tileShine2[maxValue] = true; } } Main.tileFrameImportant[269] = true; Main.tileFrameImportant[470] = true; Main.tileFrameImportant[475] = true; Main.tileFrameImportant[390] = true; Main.tileFrameImportant[597] = true; Main.tileLighted[597] = true; Main.tileNoAttach[390] = true; Main.tileLavaDeath[390] = true; Main.tileLighted[390] = true; Main.tileFrameImportant[617] = true; Main.wallHouse[168] = true; Main.wallHouse[169] = true; Main.wallHouse[142] = true; Main.wallHouse[143] = true; Main.wallHouse[144] = true; Main.wallHouse[149] = true; Main.wallHouse[151] = true; Main.wallHouse[150] = true; Main.wallHouse[152] = true; Main.wallHouse[145] = true; Main.wallHouse[148] = true; Main.wallHouse[175] = true; Main.wallHouse[176] = true; Main.wallHouse[182] = true; for (int index = 153; index < 167; ++index) Main.wallHouse[index] = true; Main.wallHouse[146] = true; Main.wallHouse[147] = true; Main.wallHouse[149] = true; Main.wallHouse[167] = true; Main.wallHouse[168] = true; Main.wallHouse[133] = true; Main.wallHouse[134] = true; Main.wallHouse[135] = true; Main.wallHouse[136] = true; Main.wallHouse[137] = true; Main.wallHouse[75] = true; Main.wallHouse[76] = true; Main.wallHouse[78] = true; Main.wallHouse[82] = true; Main.wallHouse[77] = true; Main.wallHouse[1] = true; Main.wallHouse[4] = true; Main.wallHouse[5] = true; Main.wallHouse[6] = true; Main.wallHouse[10] = true; Main.wallHouse[11] = true; Main.wallHouse[12] = true; Main.wallHouse[16] = true; Main.wallHouse[17] = true; Main.wallHouse[18] = true; Main.wallHouse[19] = true; Main.wallHouse[20] = true; Main.wallHouse[21] = true; Main.wallHouse[22] = true; Main.wallHouse[23] = true; Main.wallHouse[24] = true; Main.wallHouse[25] = true; Main.wallHouse[26] = true; Main.wallHouse[27] = true; Main.wallHouse[29] = true; Main.wallHouse[30] = true; Main.wallHouse[31] = true; Main.wallHouse[32] = true; Main.wallHouse[33] = true; Main.wallHouse[34] = true; Main.wallHouse[35] = true; Main.wallHouse[36] = true; Main.wallHouse[37] = true; Main.wallHouse[38] = true; Main.wallHouse[39] = true; Main.wallHouse[41] = true; Main.wallHouse[42] = true; Main.wallHouse[43] = true; Main.wallHouse[44] = true; Main.wallHouse[45] = true; Main.wallHouse[46] = true; Main.wallHouse[47] = true; Main.wallHouse[66] = true; Main.wallHouse[67] = true; Main.wallHouse[68] = true; Main.wallHouse[72] = true; Main.wallHouse[73] = true; Main.wallHouse[107] = true; Main.wallHouse[106] = true; Main.wallHouse[245] = true; Main.wallHouse[315] = true; Main.wallHouse[109] = true; Main.wallHouse[110] = true; Main.wallHouse[111] = true; Main.wallHouse[112] = true; Main.wallHouse[113] = true; Main.wallHouse[114] = true; Main.wallHouse[115] = true; Main.wallHouse[116] = true; Main.wallHouse[117] = true; Main.wallHouse[118] = true; Main.wallHouse[119] = true; Main.wallHouse[120] = true; Main.wallHouse[121] = true; Main.wallHouse[122] = true; Main.wallHouse[123] = true; Main.wallHouse[124] = true; Main.wallHouse[125] = true; Main.wallHouse[108] = true; Main.wallHouse[100] = true; Main.wallHouse[101] = true; Main.wallHouse[102] = true; Main.wallHouse[103] = true; Main.wallHouse[104] = true; Main.wallHouse[105] = true; Main.wallHouse[84] = true; Main.wallHouse[74] = true; Main.wallHouse[241] = true; Main.wallHouse[85] = true; Main.wallHouse[88] = true; Main.wallHouse[89] = true; Main.wallHouse[90] = true; Main.wallHouse[91] = true; Main.wallHouse[92] = true; Main.wallHouse[93] = true; Main.wallHouse[126] = true; Main.wallHouse[(int) sbyte.MaxValue] = true; Main.wallHouse[128] = true; Main.wallHouse[129] = true; Main.wallHouse[130] = true; Main.wallHouse[131] = true; Main.wallHouse[132] = true; Main.wallHouse[138] = true; Main.wallHouse[139] = true; Main.wallHouse[140] = true; Main.wallHouse[141] = true; Main.wallHouse[177] = true; Main.wallHouse[172] = true; Main.wallHouse[242] = true; Main.wallHouse[243] = true; Main.wallHouse[174] = true; Main.wallHouse[223] = true; Main.wallHouse[230] = true; Main.wallHouse[228] = true; Main.wallHouse[229] = true; Main.wallHouse[236] = true; Main.wallHouse[246] = true; Main.wallHouse[247] = true; Main.wallHouse[248] = true; Main.wallHouse[249] = true; Main.wallHouse[250] = true; Main.wallHouse[251] = true; Main.wallHouse[252] = true; Main.wallHouse[253] = true; Main.wallHouse[254] = true; Main.wallHouse[(int) byte.MaxValue] = true; Main.wallHouse[314] = true; Main.wallHouse[256] = true; Main.wallHouse[257] = true; Main.wallHouse[258] = true; Main.wallHouse[259] = true; Main.wallHouse[260] = true; Main.wallHouse[261] = true; Main.wallHouse[262] = true; Main.wallHouse[263] = true; Main.wallHouse[264] = true; Main.wallHouse[265] = true; Main.wallHouse[266] = true; Main.wallHouse[267] = true; Main.wallHouse[268] = true; Main.wallHouse[269] = true; Main.wallHouse[270] = true; Main.wallHouse[271] = true; Main.wallHouse[272] = true; Main.wallHouse[273] = true; Main.wallHouse[274] = true; Main.wallHouse[275] = true; Main.wallHouse[276] = true; Main.wallHouse[277] = true; Main.wallHouse[278] = true; Main.wallHouse[279] = true; Main.wallHouse[280] = true; Main.wallHouse[281] = true; Main.wallHouse[282] = true; Main.wallHouse[283] = true; Main.wallHouse[284] = true; Main.wallHouse[285] = true; Main.wallHouse[286] = true; Main.wallHouse[287] = true; Main.wallHouse[288] = true; Main.wallHouse[289] = true; Main.wallHouse[290] = true; Main.wallHouse[291] = true; Main.wallHouse[292] = true; Main.wallHouse[293] = true; Main.wallHouse[294] = true; Main.wallHouse[295] = true; Main.wallHouse[296] = true; Main.wallHouse[297] = true; Main.wallHouse[298] = true; Main.wallHouse[299] = true; Main.wallHouse[300] = true; Main.wallHouse[301] = true; Main.wallHouse[302] = true; Main.wallHouse[303] = true; Main.wallHouse[304] = true; Main.wallHouse[305] = true; Main.wallHouse[306] = true; Main.wallHouse[307] = true; Main.wallHouse[308] = true; Main.wallHouse[309] = true; Main.wallHouse[310] = true; Main.wallHouse[311] = true; Main.wallLight[0] = true; Main.wallLight[21] = true; Main.wallLight[106] = true; Main.wallLight[107] = true; Main.wallLight[138] = true; Main.wallLight[140] = true; Main.wallLight[141] = true; Main.wallLight[139] = true; Main.wallLight[145] = true; Main.wallLight[150] = true; Main.wallLight[152] = true; Main.wallLight[245] = true; Main.wallLight[315] = true; Main.wallLight[168] = true; for (int index = 0; index < 316; ++index) Main.wallDungeon[index] = false; Main.wallDungeon[7] = true; Main.wallDungeon[8] = true; Main.wallDungeon[9] = true; Main.wallDungeon[94] = true; Main.wallDungeon[95] = true; Main.wallDungeon[96] = true; Main.wallDungeon[97] = true; Main.wallDungeon[98] = true; Main.wallDungeon[99] = true; } private void ClientInitialize() { MessageBuffer.OnTileChangeReceived += new TileChangeReceivedEvent(this.OnTileChangeEvent); LanguageManager.Instance.OnLanguageChanged += (LanguageChangeCallback) (languageManager => ItemTooltip.InvalidateTooltips()); PlayerInput.OnBindingChange += new Action(ItemTooltip.InvalidateTooltips); Main.clientUUID = Guid.NewGuid().ToString(); FilterManager scene = Terraria.Graphics.Effects.Filters.Scene; ((Platform) Platform.Current).InitializeClientServices(this.Window.Handle); Platform.Get().AddKeyListener((Action) (keyStroke => { if (Main.keyCount >= 10) return; Main.keyInt[Main.keyCount] = (int) keyStroke; Main.keyString[Main.keyCount] = keyStroke.ToString() ?? ""; ++Main.keyCount; })); this.Window.AllowUserResizing = true; this.LoadSettings(); Main.SetDisplayMonitor(); if (Main.screenWidth > GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width) Main.screenWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width; if (Main.screenHeight > GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height) Main.screenHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height; Main.graphics.ApplyChanges(); if (Main.OnResolutionChanged != null) Main.OnResolutionChanged(new Vector2((float) Main.screenWidth, (float) Main.screenHeight)); this.CheckBunny(); this.GraphicsDevice.DeviceLost += new EventHandler(this.GraphicsDeviceLost); this.GraphicsDevice.DeviceReset += new EventHandler(this.GraphicsDeviceLost); this.GraphicsDevice.DeviceResetting += new EventHandler(this.GraphicsDeviceLost); if (Main._needsLanguageSelect) Main.menuMode = 1212; this._achievements = new AchievementManager(); this._achievementAdvisor = new AchievementAdvisor(); this.OpenRecent(); UILinksInitializer.Load(); Main.Chroma = new ChromaEngine(); Main.ChromaPainter = new ChromaHotkeyPainter(); Main.ChromaPainter.CollectBoundKeys(); Main.CacheSupportedDisplaySizes(); if (Main.autoJoin) { Main.LoadPlayers(); Main.menuMode = 1; Main.menuMultiplayer = true; } Main.fpsTimer.Start(); } private static void CacheSupportedDisplaySizes() { Main.numDisplayModes = 0; foreach (DisplayMode supportedDisplayMode in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes) { if (supportedDisplayMode.Width >= Main.minScreenW && supportedDisplayMode.Height >= Main.minScreenH && supportedDisplayMode.Width <= Main.maxScreenW && supportedDisplayMode.Height <= Main.maxScreenH) { bool flag = true; for (int index = 0; index < Main.numDisplayModes; ++index) { if (supportedDisplayMode.Width == Main.displayWidth[index] && supportedDisplayMode.Height == Main.displayHeight[index]) { flag = false; break; } } if (flag) { Main.displayHeight[Main.numDisplayModes] = supportedDisplayMode.Height; Main.displayWidth[Main.numDisplayModes] = supportedDisplayMode.Width; ++Main.numDisplayModes; } } } } public static void LoadTestLog(string logname) { } private void OnceFailedLoadingAnAsset(string assetPath, Exception e) => FancyErrorPrinter.ShowFailedToLoadAssetError(e, assetPath); protected override void LoadContent() { SoundEngine.Initialize(); if (XnaExtensions.Get((System.IServiceProvider) this.Services) == null) AssetInitializer.CreateAssetServices(this.Services); Main.Assets = XnaExtensions.Get((System.IServiceProvider) this.Services); // ISSUE: method pointer Main.Assets.AssetLoadFailHandler = new FailedToLoadAssetCustomAction((object) this, __methodptr(OnceFailedLoadingAnAsset)); this.mapSectionTexture = new RenderTarget2D(this.GraphicsDevice, 200, 150); Main.ShaderContentManager = new ContentManager(this.Content.ServiceProvider, this.Content.RootDirectory); Main.PixelShaderRef.Value = Main.ShaderContentManager.Load("PixelShader"); Main.VertexPixelShaderRef.Value = Main.ShaderContentManager.Load("PixelShader"); Main.TileShaderRef.Value = Main.ShaderContentManager.Load("TileShader"); Main.ScreenShaderRef.Value = Main.ShaderContentManager.Load("ScreenShader"); Main.spriteBatch = new SpriteBatch(this.GraphicsDevice); Main.tileBatch = new TileBatch(this.GraphicsDevice); Main.DebugDrawer = new BasicDebugDrawer(this.GraphicsDevice); Main.GameViewMatrix = new SpriteViewMatrix(this.GraphicsDevice); Main.BackgroundViewMatrix = new SpriteViewMatrix(this.GraphicsDevice); Main.AssetSourceController = new AssetSourceController(Main.Assets, (IEnumerable) new IContentSource[1] { (IContentSource) new XnaContentSource(this.Content.RootDirectory) }); VanillaContentValidator.Instance = new VanillaContentValidator("Terraria.IO.Data.ResourcePacksDefaultInfo.tsv"); Main.AssetSourceController.UseResourcePacks(AssetInitializer.CreateResourcePackList((System.IServiceProvider) this.Services)); AssetInitializer.LoadSplashAssets(true); ChromaInitializer.Load(); this._gameContentLoadProcess = this.LoadContent_Deferred(); } private void LoadContent_TryEnteringHiDef() { Main.Configuration.Load(); Main.Configuration.Get("UseExperimentalFeatures", ref Main.UseExperimentalFeatures); Main.Configuration.Get("Support4K", ref Main.Support4K); bool flag = Main.Support4K && this.GraphicsDevice.Adapter.IsProfileSupported(GraphicsProfile.HiDef); if (GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width <= 1920 && GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height <= 1200) flag = false; if (!(Main.Support4K & flag) || this.GraphicsDevice.GraphicsProfile == GraphicsProfile.HiDef) return; Main.SetGraphicsProfile(GraphicsProfile.HiDef); } protected IEnumerator LoadContent_Deferred() { yield return (object) null; AssetInitializer.LoadAssetsWhileInInitialBlackScreen(); yield return (object) null; bool doneLoadingMusic = false; IEnumerator musicLoadProcedure = this.LoadMusic_InSteps(); while (!doneLoadingMusic) { try { if (!musicLoadProcedure.MoveNext()) doneLoadingMusic = true; } catch { doneLoadingMusic = true; Main.musicVolume = 0.0f; Main.soundVolume = 0.0f; } yield return (object) null; } this._musicLoaded = true; Main.splashTimer.Start(); yield return (object) null; this._begunMainAsyncLoad = true; AssetInitializer.Load(true); this._artLoaded = true; Main.TownNPCHeadRenderer = new NPCHeadRenderer(TextureAssets.NpcHead); Main.ContentThatNeedsRenderTargets.Add((INeedRenderTargetContent) Main.TownNPCHeadRenderer); Main.BossNPCHeadRenderer = new NPCHeadRenderer(TextureAssets.NpcHeadBoss); Main.ContentThatNeedsRenderTargets.Add((INeedRenderTargetContent) Main.BossNPCHeadRenderer); } private void TickLoadProcess() => this._gameContentLoadProcess.MoveNext(); private void LoadContent_Music() => ((ThreadStart) (() => { try { this.LoadMusic(); } catch { Main.musicVolume = 0.0f; Main.soundVolume = 0.0f; } this._musicLoaded = true; Main.splashTimer.Start(); }))(); private static void PostContentLoadInitialize() { LiquidRenderer.LoadContent(); AchievementInitializer.Load(); Main.AchievementAdvisor.Initialize(); DyeInitializer.Load(); ScreenEffectInitializer.Load(); InGameNotificationsTracker.Initialize(); Main.moonType = Main.rand.Next(9); Main.windSpeedCurrent = (float) Main.rand.Next(-800, 801) * (1f / 1000f); Main.windSpeedTarget = Main.windSpeedCurrent; Main.numClouds = Main.rand.Next(200); Mount.Initialize(); Minecart.Initialize(); Main.CacheSupportedDisplaySizes(); ContentSamples.RebuildItemCreativeSortingIDsAfterRecipesAreSetUp(); ContentSamples.CommonlyUsedContentSamples.PrepareAfterEverythingElseLoaded(); } private void LoadMusic() { if (!SoundEngine.IsAudioSupported) return; Main.engine = new AudioEngine("Content\\TerrariaMusic.xgs"); Main.soundBank = new SoundBank(Main.engine, "Content\\Sound Bank.xsb"); Main.waveBank = new WaveBank(Main.engine, "Content\\Wave Bank.xwb"); for (int index = 1; index < 89; ++index) Main.music[index] = Main.soundBank.GetCue("Music_" + (object) index); } private IEnumerator LoadMusic_InSteps() { Main.engine = new AudioEngine("Content\\TerrariaMusic.xgs"); Main.soundBank = new SoundBank(Main.engine, "Content\\Sound Bank.xsb"); Main.waveBank = new WaveBank(Main.engine, "Content\\Wave Bank.xwb"); yield return (object) null; for (int i = 1; i < 89; ++i) { Main.music[i] = Main.soundBank.GetCue("Music_" + (object) i); yield return (object) null; } } protected override void UnloadContent() { } public static void CheckForMoonEventsStartingTemporarySeasons() { if (Main.netMode == 1) return; int num1 = Main.forceHalloweenForToday ? 1 : 0; bool forceXmasForToday = Main.forceXMasForToday; Main.forceXMasForToday = false; Main.forceHalloweenForToday = false; int waveNumber = NPC.waveNumber; double waveKills = (double) NPC.waveKills; if (Main.pumpkinMoon && waveNumber >= 15) Main.forceHalloweenForToday = true; if (Main.snowMoon && waveNumber >= 20) Main.forceXMasForToday = true; Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(50, (int) byte.MaxValue, 130); int num2 = Main.forceHalloweenForToday ? 1 : 0; if (num1 != num2) WorldGen.BroadcastText(NetworkText.FromKey(Main.forceHalloweenForToday ? "Misc.StartedVictoryHalloween" : "Misc.EndedVictoryHalloween"), color); if (forceXmasForToday == Main.forceXMasForToday) return; WorldGen.BroadcastText(NetworkText.FromKey(Main.forceXMasForToday ? "Misc.StartedVictoryXmas" : "Misc.EndedVictoryXmas"), color); } public static void stopMoonEvent() { int waveNumber = NPC.waveNumber; double waveKills = (double) NPC.waveKills; if (Main.pumpkinMoon) { Main.pumpkinMoon = false; if (Main.netMode != 1) { NPC.waveKills = 0.0f; NPC.waveNumber = 0; } } if (!Main.snowMoon) return; Main.snowMoon = false; if (Main.netMode == 1) return; NPC.waveKills = 0.0f; NPC.waveNumber = 0; } public static void startPumpkinMoon() { Main.pumpkinMoon = true; Main.snowMoon = false; Main.bloodMoon = false; Main.invasionProgress = -1; Main.invasionProgressDisplayLeft = 0; Main.invasionProgressAlpha = 0.0f; Main.invasionProgressIcon = 0; if (Main.netMode == 1) return; NPC.waveKills = 0.0f; NPC.waveNumber = 1; NetworkText invasionWaveText = Lang.GetInvasionWaveText(1, (short) 305); if (Main.netMode == 0) { Main.NewText(invasionWaveText.ToString(), (byte) 175, (byte) 75); } else { if (Main.netMode != 2) return; ChatHelper.BroadcastChatMessage(invasionWaveText, new Microsoft.Xna.Framework.Color(175, 75, (int) byte.MaxValue)); } } public static void startSnowMoon() { Main.snowMoon = true; Main.pumpkinMoon = false; Main.bloodMoon = false; Main.invasionProgress = -1; Main.invasionProgressDisplayLeft = 0; Main.invasionProgressAlpha = 0.0f; Main.invasionProgressIcon = 0; if (Main.netMode == 1) return; NPC.waveKills = 0.0f; NPC.waveNumber = 1; NetworkText invasionWaveText = Lang.GetInvasionWaveText(1, (short) 338, (short) 342); if (Main.netMode == 0) { Main.NewText(invasionWaveText.ToString(), (byte) 175, (byte) 75); } else { if (Main.netMode != 2) return; ChatHelper.BroadcastChatMessage(invasionWaveText, new Microsoft.Xna.Framework.Color(175, 75, (int) byte.MaxValue)); } } protected void UpdateAudio() { if (!SoundEngine.IsAudioSupported || !this._musicLoaded) return; if (!Main.showSplash) SoundEngine.Update(); if ((double) Main.musicVolume == 0.0) Main.curMusic = 0; try { if (Main.dedServ) return; bool isActive = this.IsActive; if (!isActive) { for (int index = 0; index < Main.music.Length; ++index) { if (Main.music[index] != null && !Main.music[index].IsPaused && Main.music[index].IsPlaying) { if ((double) Main.musicFade[index] > 0.0) { try { Main.music[index].Pause(); } catch (Exception ex) { } } } } SoundEngine.StopAmbientSounds(); } else { for (int index = 0; index < Main.music.Length; ++index) { if (Main.music[index] != null && Main.music[index].IsPaused) { if ((double) Main.musicFade[index] > 0.0) { try { Main.music[index].Resume(); } catch (Exception ex) { } } } } } if (Main.drunkWorld) Main.TOWMusicUnlocked = true; if (Main.gameMenu) Main.swapMusic = false; if (Main.swapMusic) { if (Main.drunkWorld) this.UpdateAudio_DecideOnNewMusic(); else this.UpdateAudio_DecideOnTOWMusic(); } else if (!Main.gameMenu && Main.drunkWorld) this.UpdateAudio_DecideOnTOWMusic(); else this.UpdateAudio_DecideOnNewMusic(); if (Main.gameMenu || (double) Main.musicVolume == 0.0) { Main.musicBox2 = -1; Main.SceneMetrics.ActiveMusicBox = -1; } if (Main.musicBox2 >= 0) Main.SceneMetrics.ActiveMusicBox = Main.musicBox2; if (Main.SceneMetrics.ActiveMusicBox >= 0) { if (Main.SceneMetrics.ActiveMusicBox == 0) this.newMusic = 1; if (Main.SceneMetrics.ActiveMusicBox == 1) this.newMusic = 2; if (Main.SceneMetrics.ActiveMusicBox == 2) this.newMusic = 3; if (Main.SceneMetrics.ActiveMusicBox == 4) this.newMusic = 4; if (Main.SceneMetrics.ActiveMusicBox == 5) this.newMusic = 5; if (Main.SceneMetrics.ActiveMusicBox == 3) this.newMusic = 6; if (Main.SceneMetrics.ActiveMusicBox == 6) this.newMusic = 7; if (Main.SceneMetrics.ActiveMusicBox == 7) this.newMusic = 8; if (Main.SceneMetrics.ActiveMusicBox == 9) this.newMusic = 9; if (Main.SceneMetrics.ActiveMusicBox == 8) this.newMusic = 10; if (Main.SceneMetrics.ActiveMusicBox == 11) this.newMusic = 11; if (Main.SceneMetrics.ActiveMusicBox == 10) this.newMusic = 12; if (Main.SceneMetrics.ActiveMusicBox == 12) this.newMusic = 13; if (Main.SceneMetrics.ActiveMusicBox == 13) this.newMusic = 14; if (Main.SceneMetrics.ActiveMusicBox == 14) this.newMusic = 15; if (Main.SceneMetrics.ActiveMusicBox == 15) this.newMusic = 16; if (Main.SceneMetrics.ActiveMusicBox == 16) this.newMusic = 17; if (Main.SceneMetrics.ActiveMusicBox == 17) this.newMusic = 18; if (Main.SceneMetrics.ActiveMusicBox == 18) this.newMusic = 19; if (Main.SceneMetrics.ActiveMusicBox == 19) this.newMusic = 20; if (Main.SceneMetrics.ActiveMusicBox == 20) this.newMusic = 21; if (Main.SceneMetrics.ActiveMusicBox == 21) this.newMusic = 22; if (Main.SceneMetrics.ActiveMusicBox == 22) this.newMusic = 23; if (Main.SceneMetrics.ActiveMusicBox == 23) this.newMusic = 24; if (Main.SceneMetrics.ActiveMusicBox == 24) this.newMusic = 25; if (Main.SceneMetrics.ActiveMusicBox == 25) this.newMusic = 26; if (Main.SceneMetrics.ActiveMusicBox == 26) this.newMusic = 27; if (Main.SceneMetrics.ActiveMusicBox == 27) this.newMusic = 29; if (Main.SceneMetrics.ActiveMusicBox == 28) this.newMusic = 30; if (Main.SceneMetrics.ActiveMusicBox == 29) this.newMusic = 31; if (Main.SceneMetrics.ActiveMusicBox == 30) this.newMusic = 32; if (Main.SceneMetrics.ActiveMusicBox == 31) this.newMusic = 33; if (Main.SceneMetrics.ActiveMusicBox == 32) this.newMusic = 38; if (Main.SceneMetrics.ActiveMusicBox == 33) this.newMusic = 37; if (Main.SceneMetrics.ActiveMusicBox == 34) this.newMusic = 35; if (Main.SceneMetrics.ActiveMusicBox == 35) this.newMusic = 36; if (Main.SceneMetrics.ActiveMusicBox == 36) this.newMusic = 34; if (Main.SceneMetrics.ActiveMusicBox == 37) this.newMusic = 39; if (Main.SceneMetrics.ActiveMusicBox == 38) this.newMusic = 40; if (Main.SceneMetrics.ActiveMusicBox == 39) this.newMusic = 41; if (Main.SceneMetrics.ActiveMusicBox == 40) this.newMusic = 44; if (Main.SceneMetrics.ActiveMusicBox == 41) this.newMusic = 48; if (Main.SceneMetrics.ActiveMusicBox == 42) this.newMusic = 42; if (Main.SceneMetrics.ActiveMusicBox == 43) this.newMusic = 43; if (Main.SceneMetrics.ActiveMusicBox == 44) this.newMusic = 46; if (Main.SceneMetrics.ActiveMusicBox == 45) this.newMusic = 47; if (Main.SceneMetrics.ActiveMusicBox == 46) this.newMusic = 49; if (Main.SceneMetrics.ActiveMusicBox == 47) this.newMusic = 51; if (Main.SceneMetrics.ActiveMusicBox == 48) this.newMusic = 52; if (Main.SceneMetrics.ActiveMusicBox == 49) this.newMusic = 53; if (Main.SceneMetrics.ActiveMusicBox == 50) this.newMusic = 54; if (Main.SceneMetrics.ActiveMusicBox == 51) this.newMusic = 55; if (Main.SceneMetrics.ActiveMusicBox == 52) this.newMusic = 56; if (Main.SceneMetrics.ActiveMusicBox == 53) this.newMusic = 57; if (Main.SceneMetrics.ActiveMusicBox == 54) this.newMusic = 58; if (Main.SceneMetrics.ActiveMusicBox == 55) this.newMusic = 59; if (Main.SceneMetrics.ActiveMusicBox == 56) this.newMusic = 60; if (Main.SceneMetrics.ActiveMusicBox == 57) this.newMusic = 61; if (Main.SceneMetrics.ActiveMusicBox == 58) this.newMusic = 62; if (Main.SceneMetrics.ActiveMusicBox == 59) this.newMusic = 63; if (Main.SceneMetrics.ActiveMusicBox == 60) this.newMusic = 64; if (Main.SceneMetrics.ActiveMusicBox == 61) this.newMusic = 65; if (Main.SceneMetrics.ActiveMusicBox == 62) this.newMusic = 66; if (Main.SceneMetrics.ActiveMusicBox == 63) this.newMusic = 67; if (Main.SceneMetrics.ActiveMusicBox == 64) this.newMusic = 68; if (Main.SceneMetrics.ActiveMusicBox == 65) this.newMusic = 69; if (Main.SceneMetrics.ActiveMusicBox == 66) this.newMusic = 70; if (Main.SceneMetrics.ActiveMusicBox == 67) this.newMusic = 71; if (Main.SceneMetrics.ActiveMusicBox == 68) this.newMusic = 72; if (Main.SceneMetrics.ActiveMusicBox == 69) this.newMusic = 73; if (Main.SceneMetrics.ActiveMusicBox == 70) this.newMusic = 74; if (Main.SceneMetrics.ActiveMusicBox == 71) this.newMusic = 75; if (Main.SceneMetrics.ActiveMusicBox == 72) this.newMusic = 76; if (Main.SceneMetrics.ActiveMusicBox == 73) this.newMusic = 77; if (Main.SceneMetrics.ActiveMusicBox == 74) this.newMusic = 78; if (Main.SceneMetrics.ActiveMusicBox == 75) this.newMusic = 79; if (Main.SceneMetrics.ActiveMusicBox == 76) this.newMusic = 80; if (Main.SceneMetrics.ActiveMusicBox == 77) this.newMusic = 81; if (Main.SceneMetrics.ActiveMusicBox == 78) this.newMusic = 82; if (Main.SceneMetrics.ActiveMusicBox == 79) this.newMusic = 83; if (Main.SceneMetrics.ActiveMusicBox == 80) this.newMusic = 84; if (Main.SceneMetrics.ActiveMusicBox == 81) this.newMusic = 85; if (Main.SceneMetrics.ActiveMusicBox == 82) this.newMusic = 86; if (Main.SceneMetrics.ActiveMusicBox == 83) this.newMusic = 87; if (Main.SceneMetrics.ActiveMusicBox == 84) this.newMusic = 88; } if (Main.curMusic != this.newMusic) this._musicReplayDelay = 0; if (this._musicReplayDelay > 0) --this._musicReplayDelay; Main.curMusic = this.newMusic; float num1 = 1f; if (NPC.MoonLordCountdown > 0) { float num2 = (float) NPC.MoonLordCountdown / 3600f; float amount = num2 * num2; if (NPC.MoonLordCountdown > 720) { num1 = MathHelper.Lerp(0.0f, 1f, amount); } else { num1 = 0.0f; Main.curMusic = 0; } if (NPC.MoonLordCountdown == 1 && Main.curMusic >= 1 && Main.curMusic < 89) Main.musicFade[Main.curMusic] = 0.0f; } for (int index = 1; index < 89; ++index) { float num3 = Main.musicFade[index] * Main.musicVolume * num1; if (index >= 62 && index <= 88) num3 *= 0.9f; else if (index == 52) { num3 *= 1.15f; if ((double) num3 > 1.0) num3 = 1f; } if (index == 28) { float num4 = 0.5f; float num5 = (float) ((double) Main.cloudAlpha / 9.0 * 10.0 * (double) num4 + (1.0 - (double) num4)); if ((double) num5 > 1.0) num5 = 1f; if (Main.gameMenu) num5 = 0.0f; float num6 = num5 * (float) Math.Pow((double) Main.atmo, 4.0); if ((double) Main.cloudAlpha > 0.0 && (double) Main.player[Main.myPlayer].position.Y < Main.worldSurface * 16.0 + (double) (Main.screenHeight / 2) && !Main.player[Main.myPlayer].ZoneSnow) { if ((double) Main.ambientVolume == 0.0 || (double) num6 == 0.0) { if (Main.music[index].IsPlaying) Main.music[index].Stop(AudioStopOptions.Immediate); } else if (!Main.music[index].IsPlaying) { Main.music[index] = Main.soundBank.GetCue("Music_" + (object) index); Main.music[index].Play(); Main.music[index].SetVariable("Volume", Main.musicFade[index] * Main.ambientVolume * num6); } else if (Main.music[index].IsPaused && this.IsActive) { Main.music[index].Resume(); } else { Main.musicFade[index] += 0.005f; if ((double) Main.musicFade[index] > 1.0) Main.musicFade[index] = 1f; Main.music[index].SetVariable("Volume", Main.musicFade[index] * Main.ambientVolume * num6); } } else if (Main.music[index].IsPlaying) { if ((double) Main.musicFade[index] > 0.0) Main.musicFade[index] -= 0.005f; if ((double) Main.musicFade[index] <= 0.0) { Main.musicFade[index] -= 0.0f; Main.music[index].Stop(AudioStopOptions.Immediate); } else Main.music[index].SetVariable("Volume", Main.musicFade[index] * Main.ambientVolume * num6); } else Main.musicFade[index] = 0.0f; } else if (index == 45) { float num7 = 0.7f; float num8 = (float) ((double) Math.Abs(Main.windSpeedCurrent) * (double) num7 + (1.0 - (double) num7)); if ((double) num8 > 1.0) num8 = 1f; float num9 = num8 * 0.9f; float num10 = 20f; float num11 = num9 * (float) Math.Pow((double) Main.atmo, 4.0); if (!Main.gameMenu && (double) Math.Abs(Main.windSpeedCurrent) >= (double) num10 / 50.0 && (double) Main.player[Main.myPlayer].position.Y < Main.worldSurface * 16.0 + (double) (Main.screenHeight / 2)) { if ((double) Main.ambientVolume == 0.0 || (double) num11 == 0.0) { if (Main.music[index].IsPlaying) Main.music[index].Stop(AudioStopOptions.Immediate); } else if (!Main.music[index].IsPlaying) { Main.music[index] = Main.soundBank.GetCue("Music_" + (object) index); Main.music[index].Play(); Main.music[index].SetVariable("Volume", Main.musicFade[index] * Main.ambientVolume * num11); } else if (Main.music[index].IsPaused && this.IsActive) { Main.music[index].Resume(); } else { Main.musicFade[index] += 0.005f; if ((double) Main.musicFade[index] > 1.0) Main.musicFade[index] = 1f; Main.music[index].SetVariable("Volume", Main.musicFade[index] * Main.ambientVolume * num11); } } else if (Main.music[index].IsPlaying) { if ((double) Main.musicFade[index] > 0.0) Main.musicFade[index] -= 0.005f; if ((double) Main.musicFade[index] <= 0.0) { Main.musicFade[index] -= 0.0f; Main.music[index].Stop(AudioStopOptions.Immediate); } else Main.music[index].SetVariable("Volume", Main.musicFade[index] * Main.ambientVolume * num11); } else Main.musicFade[index] = 0.0f; } else if (index == Main.curMusic) { if (!Main.music[index].IsPlaying & isActive) { if (this._musicReplayDelay == 0) { if (Main.SettingMusicReplayDelayEnabled) this._musicReplayDelay = Main.rand.Next(14400, 21601); Main.music[index].Stop(AudioStopOptions.Immediate); Main.music[index] = Main.soundBank.GetCue("Music_" + (object) index); Main.music[index].SetVariable("Volume", num3); Main.music[index].Play(); } } else { Main.musicFade[index] += 0.005f; if ((double) Main.musicFade[index] > 1.0) Main.musicFade[index] = 1f; Main.music[index].SetVariable("Volume", num3); } } else if (Main.music[index].IsPlaying || !Main.music[index].IsStopped) { if ((double) Main.musicFade[Main.curMusic] > 0.25) Main.musicFade[index] -= 0.005f; else if (Main.curMusic == 0) Main.musicFade[index] = 0.0f; if ((double) Main.musicFade[index] <= 0.0) { Main.musicFade[index] = 0.0f; Main.music[index].SetVariable("Volume", 0.0f); Main.music[index].Stop(AudioStopOptions.Immediate); } else Main.music[index].SetVariable("Volume", num3); } else Main.musicFade[index] = 0.0f; } if (Main.musicError <= 0) return; --Main.musicError; } catch { ++Main.musicError; if (Main.musicError < 100) return; Main.musicError = 0; Main.musicVolume = 0.0f; } } public static bool IsItAHappyWindyDay => Main._shouldUseWindyDayMusic; public static bool IsItStorming => Main._shouldUseStormMusic; public static bool WindyEnoughForKiteDrops => (double) Math.Abs(Main.windSpeedTarget) >= (double) Main._maxWind; private void UpdateAudio_DecideOnTOWMusic() { bool flag1 = false; bool flag2 = false; bool flag3 = false; bool flag4 = false; bool flag5 = false; bool flag6 = false; bool flag7 = false; bool flag8 = false; bool flag9 = false; bool flag10 = false; bool flag11 = false; bool flag12 = false; bool flag13 = false; bool flag14 = false; bool flag15 = false; if (!Main.showSplash) { Microsoft.Xna.Framework.Rectangle rectangle1 = new Microsoft.Xna.Framework.Rectangle((int) Main.screenPosition.X, (int) Main.screenPosition.Y, Main.screenWidth, Main.screenHeight); for (int index = 0; index < 200; ++index) { if (Main.npc[index].active) { int num1 = 5000; int num2 = 0; switch (Main.npc[index].type) { case 13: case 14: case 15: num2 = 1; break; case 26: case 27: case 28: case 29: case 111: case 471: num2 = 11; break; case 113: case 114: num2 = 3; break; case 125: case 126: num2 = 2; break; case (int) sbyte.MaxValue: case 134: num2 = 2; break; case 143: case 144: case 145: num2 = 11; break; case 212: case 213: case 214: case 215: case 216: case 491: num2 = 8; break; case 222: num2 = 1; break; case 245: num2 = 2; break; case 262: case 263: case 264: num2 = 6; break; case 266: num2 = 1; break; case 370: num2 = 15; break; case 381: case 382: case 383: case 385: case 386: case 388: case 389: case 390: case 391: case 395: case 520: num2 = 9; break; case 398: num2 = 7; break; case 422: case 493: case 507: case 517: num2 = 10; break; case 438: if ((double) Main.npc[index].ai[1] == 1.0) { num1 = 1600; num2 = 2; break; } break; case 439: num2 = 2; break; case 636: num2 = 14; break; case 657: num2 = 13; break; } if (NPCID.Sets.BelongsToInvasionOldOnesArmy[Main.npc[index].type]) num2 = 12; if (num2 == 0 && Main.npc[index].boss) num2 = 1; if (num2 != 0) { Microsoft.Xna.Framework.Rectangle rectangle2 = new Microsoft.Xna.Framework.Rectangle((int) ((double) Main.npc[index].position.X + (double) (Main.npc[index].width / 2)) - num1, (int) ((double) Main.npc[index].position.Y + (double) (Main.npc[index].height / 2)) - num1, num1 * 2, num1 * 2); if (rectangle1.Intersects(rectangle2)) { switch (num2) { case 1: flag1 = true; goto label_49; case 2: flag2 = true; goto label_49; case 3: flag3 = true; goto label_49; case 4: flag4 = true; goto label_49; case 5: flag5 = true; goto label_49; case 6: flag6 = true; goto label_49; case 7: flag7 = true; goto label_49; case 8: flag8 = true; goto label_49; case 9: flag9 = true; goto label_49; case 10: flag10 = true; goto label_49; case 11: flag11 = true; goto label_49; case 12: flag12 = true; goto label_49; case 13: flag13 = true; goto label_49; case 14: flag14 = true; goto label_49; case 15: flag15 = true; goto label_49; default: goto label_49; } } } } } } label_49: double num3 = ((double) Main.screenPosition.X + (double) (Main.screenWidth / 2)) / 16.0; if ((double) Main.musicVolume == 0.0) { this.newMusic = 0; } else { float num4 = (float) (Main.maxTilesX / 4200); float num5 = num4 * num4; float num6 = (float) ((((double) Main.screenPosition.Y + (double) (Main.screenHeight / 2)) / 16.0 - (65.0 + 10.0 * (double) num5)) / (Main.worldSurface / 5.0)); if (flag7) this.newMusic = 84; else if (flag9) this.newMusic = 82; else if (flag10) this.newMusic = 83; else if (flag6) this.newMusic = 85; else if (flag14) this.newMusic = 80; else if (flag15) this.newMusic = 80; else if (flag2) this.newMusic = 80; else if (flag1) this.newMusic = 81; else if (flag3) this.newMusic = 87; else if (flag4) this.newMusic = 81; else if (flag5) this.newMusic = 81; else if (flag13) this.newMusic = 80; else if (flag8) this.newMusic = 82; else if (flag11) this.newMusic = 82; else if (flag12) this.newMusic = 82; else if (Main.eclipse && (double) Main.player[Main.myPlayer].position.Y < Main.worldSurface * 16.0 + (double) (Main.screenHeight / 2)) this.newMusic = 79; else if (Main.player[Main.myPlayer].ZoneSandstorm) this.newMusic = 66; else if ((double) Main.player[Main.myPlayer].position.Y > (double) (Main.UnderworldLayer * 16)) this.newMusic = 71; else if ((double) num6 < 1.0) this.newMusic = 70; else if (Main.tile[(int) ((double) Main.player[Main.myPlayer].Center.X / 16.0), (int) ((double) Main.player[Main.myPlayer].Center.Y / 16.0)].wall == (ushort) 87) this.newMusic = 69; else if (Main.player[Main.myPlayer].ZoneDungeon) this.newMusic = 69; else if (Main.bgStyle == 9 && (double) Main.player[Main.myPlayer].position.Y < Main.worldSurface * 16.0 + (double) (Main.screenHeight / 2) || Main.undergroundBackground == 2) this.newMusic = 68; else if (Main.player[Main.myPlayer].ZoneCorrupt) this.newMusic = !Main.player[Main.myPlayer].ZoneCrimson || Main.SceneMetrics.BloodTileCount <= Main.SceneMetrics.EvilTileCount ? ((double) Main.player[Main.myPlayer].position.Y <= Main.worldSurface * 16.0 + (double) (Main.screenHeight / 2) ? 73 : 74) : ((double) Main.player[Main.myPlayer].position.Y <= Main.worldSurface * 16.0 + (double) (Main.screenHeight / 2) ? 75 : 76); else if (Main.player[Main.myPlayer].ZoneCrimson) this.newMusic = (double) Main.player[Main.myPlayer].position.Y <= Main.worldSurface * 16.0 + (double) (Main.screenHeight / 2) ? 75 : 76; else if (Main.player[Main.myPlayer].ZoneMeteor) this.newMusic = 79; else if (Main.player[Main.myPlayer].ZoneGraveyard) this.newMusic = 79; else if (Main.player[Main.myPlayer].ZoneJungle) this.newMusic = 86; else if (Main.player[Main.myPlayer].ZoneSnow) this.newMusic = (double) Main.player[Main.myPlayer].position.Y <= Main.worldSurface * 16.0 + (double) (Main.screenHeight / 2) ? 72 : 77; else if ((double) Main.player[Main.myPlayer].position.Y >= Main.worldSurface * 16.0 + (double) (Main.screenHeight / 2) && !WorldGen.oceanDepths((int) ((double) Main.screenPosition.X + (double) (Main.screenWidth / 2)) / 16, (int) ((double) Main.screenPosition.Y + (double) (Main.screenHeight / 2)) / 16)) this.newMusic = !Main.player[Main.myPlayer].ZoneHallow ? (!Main.player[Main.myPlayer].ZoneUndergroundDesert ? 65 : 66) : 78; else if (Main.dayTime && Main.player[Main.myPlayer].ZoneHallow) this.newMusic = (double) Main.cloudAlpha <= 0.0 || Main.gameMenu ? 88 : 62; else if (Main._shouldUseStormMusic) this.newMusic = !Main.bloodMoon ? 62 : 79; else if (WorldGen.oceanDepths((int) ((double) Main.screenPosition.X + (double) (Main.screenWidth / 2)) / 16, (int) ((double) Main.screenPosition.Y + (double) (Main.screenHeight / 2)) / 16)) this.newMusic = !Main.bloodMoon ? 67 : 79; else if (Main.player[Main.myPlayer].ZoneDesert) this.newMusic = 66; else if (Main.dayTime) this.newMusic = (double) Main.cloudAlpha <= 0.0 || Main.gameMenu ? 63 : 62; else if (!Main.dayTime) this.newMusic = !Main.bloodMoon ? ((double) Main.cloudAlpha <= 0.0 || Main.gameMenu ? 64 : 64) : 79; if ((double) Main.screenPosition.Y / 16.0 < Main.worldSurface + 10.0 && Main.pumpkinMoon) this.newMusic = 82; if ((double) Main.screenPosition.Y / 16.0 >= Main.worldSurface + 10.0 || !Main.snowMoon) return; this.newMusic = 82; } } private void UpdateAudio_DecideOnNewMusic() { bool flag1 = false; bool flag2 = false; bool flag3 = false; bool flag4 = false; bool flag5 = false; bool flag6 = false; bool flag7 = false; bool flag8 = false; bool flag9 = false; bool flag10 = false; bool flag11 = false; bool flag12 = false; bool flag13 = false; bool flag14 = false; bool flag15 = false; bool flag16 = (double) Main.LocalPlayer.townNPCs > 2.0; bool slimeRain = Main.slimeRain; float num1 = 0.0f; for (int index = 0; index < 89; ++index) { if ((double) Main.musicFade[index] > (double) num1) { num1 = Main.musicFade[index]; if ((double) num1 == 1.0) this.lastMusicPlayed = index; } } if (this.lastMusicPlayed == 50) Main.musicNoCrossFade[51] = true; if (!Main.showSplash) { Microsoft.Xna.Framework.Rectangle rectangle1 = new Microsoft.Xna.Framework.Rectangle((int) Main.screenPosition.X, (int) Main.screenPosition.Y, Main.screenWidth, Main.screenHeight); for (int index = 0; index < 200; ++index) { if (Main.npc[index].active) { int num2 = 5000; int num3 = 0; switch (Main.npc[index].type) { case 13: case 14: case 15: num3 = 1; break; case 26: case 27: case 28: case 29: case 111: case 471: num3 = 11; break; case 113: case 114: case 125: case 126: num3 = 2; break; case 134: case 143: case 144: case 145: case 266: num3 = 3; break; case 212: case 213: case 214: case 215: case 216: case 491: num3 = 8; break; case 222: num3 = 5; break; case 245: num3 = 4; break; case 262: case 263: case 264: num3 = 6; break; case 370: num3 = 15; break; case 381: case 382: case 383: case 385: case 386: case 388: case 389: case 390: case 391: case 395: case 520: num3 = 9; break; case 398: num3 = 7; break; case 422: case 493: case 507: case 517: num3 = 10; break; case 438: if ((double) Main.npc[index].ai[1] == 1.0) { num2 = 1600; num3 = 4; break; } break; case 439: num3 = 4; break; case 636: num3 = 14; break; case 657: num3 = 13; break; } if (NPCID.Sets.BelongsToInvasionOldOnesArmy[Main.npc[index].type]) num3 = 12; if (num3 == 0 && Main.npc[index].boss) num3 = 1; if (num3 != 0) { Microsoft.Xna.Framework.Rectangle rectangle2 = new Microsoft.Xna.Framework.Rectangle((int) ((double) Main.npc[index].position.X + (double) (Main.npc[index].width / 2)) - num2, (int) ((double) Main.npc[index].position.Y + (double) (Main.npc[index].height / 2)) - num2, num2 * 2, num2 * 2); if (rectangle1.Intersects(rectangle2)) { switch (num3) { case 1: flag1 = true; goto label_56; case 2: flag2 = true; goto label_56; case 3: flag3 = true; goto label_56; case 4: flag4 = true; goto label_56; case 5: flag5 = true; goto label_56; case 6: flag6 = true; goto label_56; case 7: flag7 = true; goto label_56; case 8: flag8 = true; goto label_56; case 9: flag9 = true; goto label_56; case 10: flag10 = true; goto label_56; case 11: flag11 = true; goto label_56; case 12: flag12 = true; goto label_56; case 13: flag13 = true; goto label_56; case 14: flag14 = true; goto label_56; case 15: flag15 = true; goto label_56; default: goto label_56; } } } } } } label_56: double num4 = ((double) Main.screenPosition.X + (double) (Main.screenWidth / 2)) / 16.0; if ((double) Main.musicVolume == 0.0) this.newMusic = 0; else if (Main.gameMenu) { if (Main.netMode != 2) { if (WorldGen.drunkWorldGen) this.newMusic = 60; else if (this.playOldTile) this.newMusic = 6; else if (!Main._isAsyncLoadComplete) { this.newMusic = 50; } else { if (Main.music[50].IsPlaying) return; this.newMusic = 51; if (!Main.musicNoCrossFade[51]) return; Main.musicFade[51] = 1f; } } else this.newMusic = 0; } else { float num5 = (float) (Main.maxTilesX / 4200); float num6 = num5 * num5; float num7 = (float) ((((double) Main.screenPosition.Y + (double) (Main.screenHeight / 2)) / 16.0 - (65.0 + 10.0 * (double) num6)) / (Main.worldSurface / 5.0)); if (Main.player[Main.myPlayer].happyFunTorchTime) this.newMusic = 13; else if (flag7) this.newMusic = 38; else if (flag9) this.newMusic = 37; else if (flag10) this.newMusic = 34; else if (flag6) this.newMusic = 24; else if (flag14) this.newMusic = 57; else if (flag15) this.newMusic = 58; else if (flag2) this.newMusic = 12; else if (flag1) this.newMusic = 5; else if (flag3) this.newMusic = 13; else if (flag4) this.newMusic = 17; else if (flag5) this.newMusic = 25; else if (flag13) this.newMusic = 56; else if (flag8) this.newMusic = 35; else if (flag11) this.newMusic = 39; else if (flag12) this.newMusic = 41; else if (Main.eclipse && (double) Main.player[Main.myPlayer].position.Y < Main.worldSurface * 16.0 + (double) (Main.screenHeight / 2)) this.newMusic = 27; else if (slimeRain && !Main.player[Main.myPlayer].ZoneGraveyard && (!Main.bloodMoon || Main.dayTime) && (double) Main.player[Main.myPlayer].position.Y < Main.worldSurface * 16.0 + (double) (Main.screenHeight / 2)) this.newMusic = 48; else if (flag16 && Main.dayTime && ((double) Main.cloudAlpha == 0.0 && !Main._shouldUseWindyDayMusic || (double) Main.player[Main.myPlayer].position.Y >= Main.worldSurface * 16.0 + (double) (Main.screenHeight / 2)) && !Main.player[Main.myPlayer].ZoneGraveyard) this.newMusic = 46; else if (flag16 && !Main.dayTime && (!Main.bloodMoon && (double) Main.cloudAlpha == 0.0 || (double) Main.player[Main.myPlayer].position.Y >= Main.worldSurface * 16.0 + (double) (Main.screenHeight / 2)) && !Main.player[Main.myPlayer].ZoneGraveyard) this.newMusic = 47; else if (Main.player[Main.myPlayer].ZoneSandstorm) this.newMusic = 40; else if ((double) Main.player[Main.myPlayer].position.Y > (double) (Main.UnderworldLayer * 16)) this.newMusic = 36; else if ((double) num7 < 1.0) this.newMusic = Main.dayTime ? 42 : 15; else if (Main.tile[(int) ((double) Main.player[Main.myPlayer].Center.X / 16.0), (int) ((double) Main.player[Main.myPlayer].Center.Y / 16.0)].wall == (ushort) 87) this.newMusic = 26; else if (Main.player[Main.myPlayer].ZoneDungeon) this.newMusic = 23; else if (Main.bgStyle == 9 && (double) Main.player[Main.myPlayer].position.Y < Main.worldSurface * 16.0 + (double) (Main.screenHeight / 2) || Main.undergroundBackground == 2) this.newMusic = 29; else if (Main.player[Main.myPlayer].ZoneCorrupt) this.newMusic = !Main.player[Main.myPlayer].ZoneCrimson || Main.SceneMetrics.BloodTileCount <= Main.SceneMetrics.EvilTileCount ? ((double) Main.player[Main.myPlayer].position.Y <= Main.worldSurface * 16.0 + (double) (Main.screenHeight / 2) ? 8 : 10) : ((double) Main.player[Main.myPlayer].position.Y <= Main.worldSurface * 16.0 + (double) (Main.screenHeight / 2) ? 16 : 33); else if (Main.player[Main.myPlayer].ZoneCrimson) this.newMusic = (double) Main.player[Main.myPlayer].position.Y <= Main.worldSurface * 16.0 + (double) (Main.screenHeight / 2) ? 16 : 33; else if (Main.player[Main.myPlayer].ZoneMeteor) this.newMusic = 2; else if (Main.player[Main.myPlayer].ZoneGraveyard) this.newMusic = 53; else if (Main.player[Main.myPlayer].ZoneJungle) this.newMusic = (double) Main.player[Main.myPlayer].position.Y <= Main.rockLayer * 16.0 + (double) (Main.screenHeight / 2) ? (this.newMusic != 54 || (double) Main.player[Main.myPlayer].position.Y <= (Main.rockLayer - 50.0) * 16.0 + (double) (Main.screenHeight / 2) ? (!Main._shouldUseStormMusic || (double) Main.player[Main.myPlayer].position.Y >= Main.worldSurface * 16.0 + (double) (Main.screenHeight / 2) ? (!Main.dayTime ? 55 : 7) : 52) : 54) : 54; else if (Main.player[Main.myPlayer].ZoneSnow) this.newMusic = (double) Main.player[Main.myPlayer].position.Y <= Main.worldSurface * 16.0 + (double) (Main.screenHeight / 2) ? 14 : 20; else if ((double) Main.player[Main.myPlayer].position.Y >= Main.worldSurface * 16.0 + (double) (Main.screenHeight / 2) && !WorldGen.oceanDepths((int) ((double) Main.screenPosition.X + (double) (Main.screenWidth / 2)) / 16, (int) ((double) Main.screenPosition.Y + (double) (Main.screenHeight / 2)) / 16)) { if (Main.player[Main.myPlayer].ZoneHallow) this.newMusic = 11; else if (Main.player[Main.myPlayer].ZoneUndergroundDesert) { this.newMusic = (double) Main.player[Main.myPlayer].position.Y < Main.worldSurface * 16.0 + (double) (Main.screenHeight / 2) ? 21 : 61; } else { if (Main.ugMusic == 0) Main.ugMusic = 4; if (!Main.music[4].IsPlaying && !Main.music[31].IsPlaying) { if ((double) Main.musicFade[4] == 1.0) Main.musicFade[31] = 1f; if ((double) Main.musicFade[31] == 1.0) Main.musicFade[4] = 1f; switch (Main.rand.Next(2)) { case 0: Main.ugMusic = 4; Main.musicFade[31] = 0.0f; break; case 1: Main.ugMusic = 31; Main.musicFade[4] = 0.0f; break; } } this.newMusic = Main.ugMusic; } } else if (Main.dayTime && Main.player[Main.myPlayer].ZoneHallow) this.newMusic = !Main._shouldUseStormMusic ? ((double) Main.cloudAlpha <= 0.0 || Main.gameMenu ? (!Main._shouldUseWindyDayMusic ? 9 : 44) : 19) : 52; else if (Main._shouldUseStormMusic) this.newMusic = !Main.bloodMoon ? 52 : 2; else if (WorldGen.oceanDepths((int) ((double) Main.screenPosition.X + (double) (Main.screenWidth / 2)) / 16, (int) ((double) Main.screenPosition.Y + (double) (Main.screenHeight / 2)) / 16)) this.newMusic = !Main.bloodMoon ? (!flag16 ? (Main.dayTime ? 22 : 43) : (!Main.dayTime ? 47 : 46)) : 2; else if (Main.player[Main.myPlayer].ZoneDesert) { if ((double) Main.player[Main.myPlayer].position.Y >= Main.worldSurface * 16.0) { int x = (int) ((double) Main.player[Main.myPlayer].Center.X / 16.0); int y = (int) ((double) Main.player[Main.myPlayer].Center.Y / 16.0); this.newMusic = !WorldGen.InWorld(x, y) || !WallID.Sets.Conversion.Sandstone[(int) Main.tile[x, y].wall] && !WallID.Sets.Conversion.HardenedSand[(int) Main.tile[x, y].wall] ? 21 : 61; } else this.newMusic = 21; } else if (Main.dayTime) { if ((double) Main.cloudAlpha > 0.0 && !Main.gameMenu) { this.newMusic = Main.time >= 10800.0 ? 19 : 59; } else { if (Main.dayMusic == 0) Main.dayMusic = 1; if (!Main.music[1].IsPlaying && !Main.music[18].IsPlaying) Main.dayMusic = Main.rand.Next(2) != 0 ? 18 : 1; this.newMusic = Main.dayMusic; if (Main._shouldUseWindyDayMusic) this.newMusic = 44; } } else if (!Main.dayTime) this.newMusic = !Main.bloodMoon ? ((double) Main.cloudAlpha <= 0.0 || Main.gameMenu ? 3 : 19) : 2; if ((double) Main.screenPosition.Y / 16.0 < Main.worldSurface + 10.0 && Main.pumpkinMoon) this.newMusic = 30; if ((double) Main.screenPosition.Y / 16.0 >= Main.worldSurface + 10.0 || !Main.snowMoon) return; this.newMusic = 32; } } private void UpdateWindyDayState() { if ((double) Main.cloudAlpha == 0.0) { Main._shouldUseStormMusic = false; if (Main.time < 10800.0 || Main.time > 43200.0 || !Main.dayTime) { Main._shouldUseWindyDayMusic = false; } else { if ((double) Math.Abs(Main.windSpeedTarget) < (double) Main._minWind) Main._shouldUseWindyDayMusic = false; if ((double) Math.Abs(Main.windSpeedTarget) < (double) Main._maxWind) return; Main._shouldUseWindyDayMusic = true; } } else { if ((double) Main.cloudAlpha < (double) Main._minRain || (double) Math.Abs(Main.windSpeedTarget) < (double) Main._minWind) Main._shouldUseStormMusic = false; else if ((double) Main.cloudAlpha >= (double) Main._maxRain && (double) Math.Abs(Main.windSpeedTarget) >= (double) Main._maxWind) Main._shouldUseStormMusic = true; Main._shouldUseWindyDayMusic = false; } } public static void snowing() { Vector2 scaledSize = Main.Camera.ScaledSize; Vector2 scaledPosition = Main.Camera.ScaledPosition; if (Main.gamePaused || Main.SceneMetrics.SnowTileCount <= 0 || (double) Main.player[Main.myPlayer].position.Y >= Main.worldSurface * 16.0) return; float num1 = (float) Main.SceneMetrics.SnowTileCount / (float) SceneMetrics.SnowTileMax; float num2 = num1 * num1; float num3 = num2 * num2; int num4 = (int) ((double) (int) (500.0 * (double) (Main.Camera.ScaledSize.X / (float) Main.maxScreenW)) * (1.0 + 2.0 * (double) Main.cloudAlpha)); float num5 = (float) (1.0 + 50.0 * (double) Main.cloudAlpha); for (int index1 = 0; (double) index1 < (double) num5; ++index1) { try { if ((double) Main.snowDust >= (double) num4 * ((double) Main.gfxQuality / 2.0 + 0.5) + (double) num4 * 0.100000001490116) break; if ((double) Main.rand.NextFloat() < (double) num3) { int num6 = Main.rand.Next((int) scaledSize.X + 1500) - 750; int num7 = (int) scaledPosition.Y - Main.rand.Next(50); if ((double) Main.player[Main.myPlayer].velocity.Y > 0.0) num7 -= (int) Main.player[Main.myPlayer].velocity.Y; if (Main.rand.Next(5) == 0) num6 = Main.rand.Next(500) - 500; else if (Main.rand.Next(5) == 0) num6 = Main.rand.Next(500) + (int) scaledSize.X; if (num6 < 0 || (double) num6 > (double) scaledSize.X) num7 += Main.rand.Next((int) ((double) scaledSize.Y * 0.8)) + (int) ((double) scaledSize.Y * 0.1); int num8 = num6 + (int) scaledPosition.X; int x = num8 / 16; int y = num7 / 16; if (WorldGen.InWorld(x, y)) { if (Main.tile[x, y] != null) { if (!Main.tile[x, y].nactive()) { if (Main.tile[x, y].wall == (ushort) 0) { int index2 = Dust.NewDust(new Vector2((float) num8, (float) num7), 10, 10, 76); Main.dust[index2].scale += Main.cloudAlpha * 0.2f; Main.dust[index2].velocity.Y = (float) (3.0 + (double) Main.rand.Next(30) * 0.100000001490116); Main.dust[index2].velocity.Y *= Main.dust[index2].scale; if (!Main.raining) { Main.dust[index2].velocity.X = Main.windSpeedCurrent + (float) Main.rand.Next(-10, 10) * 0.1f; Main.dust[index2].velocity.X += Main.windSpeedCurrent * 15f; } else { Main.dust[index2].velocity.X = (float) (Math.Sqrt((double) Math.Abs(Main.windSpeedCurrent)) * (double) Math.Sign(Main.windSpeedCurrent) * ((double) Main.cloudAlpha + 0.5) * 10.0 + (double) Main.rand.NextFloat() * 0.200000002980232 - 0.100000001490116); Main.dust[index2].velocity.Y *= 0.5f; } Main.dust[index2].velocity.Y *= (float) (1.0 + 0.300000011920929 * (double) Main.cloudAlpha); Main.dust[index2].scale += Main.cloudAlpha * 0.2f; Main.dust[index2].velocity *= (float) (1.0 + (double) Main.cloudAlpha * 0.5); } } } } } } catch { } } } public static void checkXMas() { DateTime now = DateTime.Now; int day = now.Day; int month = now.Month; Main.xMas = day >= 15 && month == 12; if (!Main.forceXMasForToday) return; Main.xMas = true; } public static void checkHalloween() { DateTime now = DateTime.Now; int day = now.Day; int month = now.Month; Main.halloween = day >= 10 && month == 10 || day <= 1 && month == 11; if (!Main.forceHalloweenForToday) return; Main.halloween = true; } public void updateCloudLayer() { switch (Main.netMode) { case 0: if (Main.gameMenu) return; break; case 1: return; } int num1 = 86400; int minValue = num1 / 24; float num2 = Math.Max(1f, (float) (1.0 + 4.0 * (double) Main.cloudAlpha)); if ((double) Main.cloudBGActive > 0.0) { if ((double) Main.cloudBGActive > 1.0) Main.cloudBGActive -= (float) Main.dayRate / num2; if ((double) Main.cloudBGActive < 1.0) Main.cloudBGActive = 1f; if ((double) Main.cloudBGActive != 1.0 || Main.rand.Next((int) ((double) (minValue * 2 / Math.Max(Main.dayRate, 1)) * (double) num2)) != 0) return; Main.cloudBGActive = (float) -Main.rand.Next(minValue * 4, num1 * 4); if (Main.netMode != 2) return; NetMessage.SendData(7); } else { if ((double) Main.cloudBGActive < 0.0) { Main.cloudBGActive += (float) Main.dayRate * num2; if (Main.raining) Main.cloudBGActive += (float) (2 * Main.dayRate) * num2; } if ((double) Main.cloudBGActive > 0.0) Main.cloudBGActive = 0.0f; if ((double) Main.cloudBGActive == 0.0 && Main.rand.Next((int) ((double) (minValue * 12 / (Main.dayRate == 0 ? 1 : Main.dayRate)) / (double) num2)) == 0) { Main.cloudBGActive = (float) Main.rand.Next(minValue * 3, num1 * 2); if (Main.netMode != 2) return; NetMessage.SendData(7); } else { if (!Main.IsItStorming) return; Main.cloudBGActive = (float) Main.rand.Next(minValue, minValue * 4); if (Main.netMode != 2) return; NetMessage.SendData(7); } } } public static void TeleportEffect( Microsoft.Xna.Framework.Rectangle effectRect, int Style, int extraInfo = 0, float dustCountMult = 1f, TeleportationSide side = TeleportationSide.Entry, Vector2 otherPosition = default (Vector2)) { switch (Style) { case 0: SoundEngine.PlaySound(SoundID.Item6, effectRect.X + effectRect.Width / 2, effectRect.Y + effectRect.Height / 2); int num1 = (int) ((double) (effectRect.Width * effectRect.Height / 5) * (double) dustCountMult); for (int index1 = 0; index1 < num1; ++index1) { int index2 = Dust.NewDust(new Vector2((float) effectRect.X, (float) effectRect.Y), effectRect.Width, effectRect.Height, 159); Main.dust[index2].scale = (float) Main.rand.Next(20, 70) * 0.01f; if (index1 < 10) Main.dust[index2].scale += 0.25f; if (index1 < 5) Main.dust[index2].scale += 0.25f; } break; case 1: SoundEngine.PlaySound(SoundID.Item8, effectRect.X + effectRect.Width / 2, effectRect.Y + effectRect.Height / 2); int num2 = (int) ((double) (effectRect.Width * effectRect.Height / 5) * (double) dustCountMult); for (int index3 = 0; index3 < num2; ++index3) { int index4 = Dust.NewDust(new Vector2((float) effectRect.X, (float) effectRect.Y), effectRect.Width, effectRect.Height, 164); Main.dust[index4].scale = (float) Main.rand.Next(20, 70) * 0.01f; if (index3 < 10) Main.dust[index4].scale += 0.25f; if (index3 < 5) Main.dust[index4].scale += 0.25f; } break; case 2: int num3 = (int) (50.0 * (double) dustCountMult); for (int index = 0; index < num3; ++index) Main.dust[Dust.NewDust(new Vector2((float) effectRect.X, (float) effectRect.Y), effectRect.Width, effectRect.Height, 58, Alpha: 150, newColor: Microsoft.Xna.Framework.Color.GhostWhite, Scale: 1.2f)].velocity *= 0.5f; break; case 3: SoundEngine.PlaySound(SoundID.Item6, effectRect.X + effectRect.Width / 2, effectRect.Y + effectRect.Height / 2); int num4 = (int) (50.0 * (double) dustCountMult); for (int index5 = 0; index5 < num4; ++index5) { int index6 = Dust.NewDust(new Vector2((float) effectRect.X, (float) effectRect.Y), effectRect.Width, effectRect.Height, 180); Main.dust[index6].noGravity = true; for (int index7 = 0; index7 < 5; ++index7) { if (Main.rand.Next(3) == 0) Main.dust[index6].velocity *= 0.75f; } if (Main.rand.Next(3) == 0) { Main.dust[index6].velocity *= 2f; Main.dust[index6].scale *= 1.2f; } if (Main.rand.Next(3) == 0) { Main.dust[index6].velocity *= 2f; Main.dust[index6].scale *= 1.2f; } if (Main.rand.Next(2) == 0) { Main.dust[index6].fadeIn = (float) Main.rand.Next(75, 100) * 0.01f; Main.dust[index6].scale = (float) Main.rand.Next(25, 75) * 0.01f; } Main.dust[index6].scale *= 0.8f; } break; case 4: SoundEngine.PlaySound(SoundID.Item8, effectRect.X + effectRect.Width / 2, effectRect.Y + effectRect.Height / 2); int num5 = (int) ((double) (effectRect.Width * effectRect.Height / 5) * (double) dustCountMult); for (int index = 0; index < num5; ++index) { Dust dust = Main.dust[Dust.NewDust(effectRect.TopLeft(), effectRect.Width, effectRect.Height, 263)]; dust.color = PortalHelper.GetPortalColor(extraInfo); dust.noLight = true; dust.noGravity = true; dust.scale = 1.2f; dust.fadeIn = 0.4f; dust.color.A = byte.MaxValue; } break; case 5: Vector2 Position1 = effectRect.TopLeft(); int num6 = (int) (100.0 * (double) dustCountMult); for (int index = 0; index < num6; ++index) { Dust dust = Dust.NewDustDirect(Position1, effectRect.Width, effectRect.Height + 24, Dust.dustWater()); dust.velocity.Y *= 0.0f; dust.velocity.Y -= 3.5f; dust.velocity.X *= 1.5f; dust.scale = 0.8f; dust.alpha = 130; dust.noGravity = true; dust.fadeIn = 1.2f; } SoundEngine.PlaySound(19, effectRect.Center.ToVector2(), 0); break; case 7: Vector2 Position2 = effectRect.TopLeft(); int num7 = (int) (50.0 * (double) dustCountMult); for (int index = 0; index < num7; ++index) { Dust dust = Dust.NewDustDirect(Position2, effectRect.Width, effectRect.Height + 24, 35); dust.velocity.Y *= 0.0f; dust.velocity.Y -= 3.5f; dust.velocity.X *= 1.5f; dust.scale = 0.8f; dust.alpha = 130; dust.noGravity = true; dust.fadeIn = 1.2f; } SoundEngine.PlaySound(SoundID.Item8, effectRect.Center.ToVector2()); break; case 9: effectRect.Inflate(15, 15); int num8 = (int) (100.0 * (double) dustCountMult); for (int index = 0; index < num8; ++index) TeleportPylonsSystem.SpawnInWorldDust(extraInfo, effectRect); SoundEngine.PlaySound(SoundID.Item6, effectRect.Center.X, effectRect.Center.Y); break; case 10: effectRect.Inflate(15, 15); int num9 = (int) (60.0 * (double) dustCountMult); Vector2 vector2 = otherPosition - effectRect.TopLeft(); for (int index = 0; index < num9; ++index) { float num10 = 0.4f + Main.rand.NextFloat(); float num11 = 0.4f + Main.rand.NextFloat(); Microsoft.Xna.Framework.Color rgb = Main.hslToRgb((float) (0.660000026226044 + (double) Main.rand.NextFloat() * 0.239999994635582), 1f, 0.5f); Dust rf = Dust.NewDustDirect(effectRect.TopLeft(), effectRect.Width, effectRect.Height, 267, Alpha: ((int) sbyte.MaxValue), newColor: rgb); rf.scale = (float) Main.rand.Next(20, 70) * 0.01f; if (index < 10) rf.scale += 0.25f; if (index < 5) rf.scale += 0.25f; if ((double) index < (double) num9 * 0.800000011920929) rf.velocity += vector2 * 0.1f * Main.rand.NextFloat(); rf.noGravity = true; rf.noLight = true; rf.scale = num11; rf.fadeIn = num10; if (rf.dustIndex != 6000) { Dust dust = Dust.CloneDust(rf); dust.scale *= 0.65f; dust.fadeIn *= 0.65f; dust.color = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue); } } SoundEngine.PlaySound(SoundID.Item8, effectRect.Center.X, effectRect.Center.Y); break; } } public static void Ambience() { ++Main.ambientCounter; if (Main.ambientCounter < 15) return; Main.ambientCounter = 0; Microsoft.Xna.Framework.Point point = Main.LocalPlayer.Center.ToPoint(); if ((double) Main.ambientWaterfallStrength > 0.0) { SoundEngine.PlaySound(34, (int) Main.ambientWaterfallX, (int) Main.ambientWaterfallY, (int) Main.ambientWaterfallStrength); Main._isWaterfallMusicPlaying = true; } else { if (Main._isWaterfallMusicPlaying) SoundEngine.PlaySound(34, point.X, point.Y, 0); Main._isWaterfallMusicPlaying = false; } float num1 = Math.Abs(Main.ambientLavaX - (Main.screenPosition.X + (float) (Main.screenWidth / 2))) + Math.Abs(Main.ambientLavaY - (Main.screenPosition.Y + (float) (Main.screenHeight / 2))); double num2 = (double) Math.Abs(Main.ambientLavafallX - (Main.screenPosition.X + (float) (Main.screenWidth / 2))) + (double) Math.Abs(Main.ambientLavafallY - (Main.screenPosition.Y + (float) (Main.screenHeight / 2))); float num3 = Main.ambientLavaX; float num4 = Main.ambientLavaY; double num5 = (double) num1; if (num2 < num5) { num3 = Main.ambientLavafallX; num4 = Main.ambientLavafallY; } float num6 = Main.ambientLavafallStrength + Main.ambientLavaStrength; if ((double) Main.ambientLavafallStrength > 0.0) { SoundEngine.PlaySound(35, (int) num3, (int) num4, (int) num6); Main._isLavafallMusicPlaying = true; } else { if (Main._isLavafallMusicPlaying) SoundEngine.PlaySound(35, point.X, point.Y, 0); Main._isLavafallMusicPlaying = false; } } public static void AnimateTiles_CritterCages() { if (!Main.critterCage) return; for (int index = 0; index < Main.cageFrames; ++index) { if (Main.bunnyCageFrame[index] == 0) { ++Main.bunnyCageFrameCounter[index]; if (Main.bunnyCageFrameCounter[index] > Main.rand.Next(30, 900)) { if (Main.rand.Next(3) != 0) { int num = Main.rand.Next(7); Main.bunnyCageFrame[index] = num != 0 ? (num > 2 ? 1 : 2) : 4; } Main.bunnyCageFrameCounter[index] = 0; } } else if (Main.bunnyCageFrame[index] == 1) { ++Main.bunnyCageFrameCounter[index]; if (Main.bunnyCageFrameCounter[index] >= 10) { Main.bunnyCageFrameCounter[index] = 0; Main.bunnyCageFrame[index] = 0; } } else if (Main.bunnyCageFrame[index] >= 2 && Main.bunnyCageFrame[index] <= 3) { ++Main.bunnyCageFrameCounter[index]; if (Main.bunnyCageFrameCounter[index] >= 10) { Main.bunnyCageFrameCounter[index] = 0; ++Main.bunnyCageFrame[index]; } if (Main.bunnyCageFrame[index] > 3) Main.bunnyCageFrame[index] = 0; } else if (Main.bunnyCageFrame[index] >= 4 && Main.bunnyCageFrame[index] <= 10) { ++Main.bunnyCageFrameCounter[index]; if (Main.bunnyCageFrameCounter[index] >= 5) { Main.bunnyCageFrameCounter[index] = 0; ++Main.bunnyCageFrame[index]; } } else if (Main.bunnyCageFrame[index] == 11) { ++Main.bunnyCageFrameCounter[index]; if (Main.bunnyCageFrameCounter[index] > Main.rand.Next(30, 900)) { if (Main.rand.Next(3) != 0) Main.bunnyCageFrame[index] = Main.rand.Next(7) != 0 ? 12 : 13; Main.bunnyCageFrameCounter[index] = 0; } } else if (Main.bunnyCageFrame[index] == 12) { ++Main.bunnyCageFrameCounter[index]; if (Main.bunnyCageFrameCounter[index] >= 10) { Main.bunnyCageFrameCounter[index] = 0; Main.bunnyCageFrame[index] = 11; } } else if (Main.bunnyCageFrame[index] >= 13) { ++Main.bunnyCageFrameCounter[index]; if (Main.bunnyCageFrameCounter[index] >= 5) { Main.bunnyCageFrameCounter[index] = 0; ++Main.bunnyCageFrame[index]; } if (Main.bunnyCageFrame[index] > 21) Main.bunnyCageFrame[index] = 0; } } for (int index = 0; index < Main.cageFrames; ++index) { if (Main.squirrelCageFrame[index] == 0) { ++Main.squirrelCageFrameCounter[index]; if (Main.squirrelCageFrameCounter[index] > Main.rand.Next(30, 900)) { if (Main.rand.Next(3) != 0) { int num = Main.rand.Next(7); Main.squirrelCageFrame[index] = num != 0 ? (num > 2 ? 1 : 2) : 4; } Main.squirrelCageFrameCounter[index] = 0; } } else if (Main.squirrelCageFrame[index] == 1) { ++Main.squirrelCageFrameCounter[index]; if (Main.squirrelCageFrameCounter[index] >= 10) { Main.squirrelCageFrameCounter[index] = 0; Main.squirrelCageFrame[index] = 0; } } else if (Main.squirrelCageFrame[index] >= 2 && Main.squirrelCageFrame[index] <= 3) { ++Main.squirrelCageFrameCounter[index]; if (Main.squirrelCageFrameCounter[index] >= 5) { Main.squirrelCageFrameCounter[index] = 0; ++Main.squirrelCageFrame[index]; } if (Main.squirrelCageFrame[index] > 3) Main.squirrelCageFrame[index] = Main.rand.Next(5) != 0 ? 2 : 0; } else if (Main.squirrelCageFrame[index] >= 4 && Main.squirrelCageFrame[index] <= 8) { ++Main.squirrelCageFrameCounter[index]; if (Main.squirrelCageFrameCounter[index] >= 5) { Main.squirrelCageFrameCounter[index] = 0; ++Main.squirrelCageFrame[index]; } } else if (Main.squirrelCageFrame[index] == 9) { ++Main.squirrelCageFrameCounter[index]; if (Main.squirrelCageFrameCounter[index] > Main.rand.Next(30, 900)) { if (Main.rand.Next(3) != 0) { int num = Main.rand.Next(7); Main.squirrelCageFrame[index] = num != 0 ? (num > 2 ? 10 : 11) : 13; } Main.squirrelCageFrameCounter[index] = 0; } } else if (Main.squirrelCageFrame[index] == 10) { ++Main.squirrelCageFrameCounter[index]; if (Main.squirrelCageFrameCounter[index] >= 10) { Main.squirrelCageFrameCounter[index] = 0; Main.squirrelCageFrame[index] = 9; } } else if (Main.squirrelCageFrame[index] == 11 || Main.squirrelCageFrame[index] == 12) { ++Main.squirrelCageFrameCounter[index]; if (Main.squirrelCageFrameCounter[index] >= 5) { ++Main.squirrelCageFrame[index]; if (Main.squirrelCageFrame[index] > 12) Main.squirrelCageFrame[index] = Main.rand.Next(5) == 0 ? 9 : 11; Main.squirrelCageFrameCounter[index] = 0; } } else if (Main.squirrelCageFrame[index] >= 13) { ++Main.squirrelCageFrameCounter[index]; if (Main.squirrelCageFrameCounter[index] >= 5) { Main.squirrelCageFrameCounter[index] = 0; ++Main.squirrelCageFrame[index]; } if (Main.squirrelCageFrame[index] > 17) Main.squirrelCageFrame[index] = 0; } } for (int index = 0; index < Main.cageFrames; ++index) { if (Main.squirrelCageFrameOrange[index] == 0) { ++Main.squirrelCageFrameCounterOrange[index]; if (Main.squirrelCageFrameCounterOrange[index] > Main.rand.Next(30, 900)) { if (Main.rand.Next(3) != 0) { int num = Main.rand.Next(7); Main.squirrelCageFrameOrange[index] = num != 0 ? (num > 2 ? 1 : 2) : 4; } Main.squirrelCageFrameCounterOrange[index] = 0; } } else if (Main.squirrelCageFrameOrange[index] == 1) { ++Main.squirrelCageFrameCounterOrange[index]; if (Main.squirrelCageFrameCounterOrange[index] >= 10) { Main.squirrelCageFrameCounterOrange[index] = 0; Main.squirrelCageFrameOrange[index] = 0; } } else if (Main.squirrelCageFrameOrange[index] >= 2 && Main.squirrelCageFrameOrange[index] <= 3) { ++Main.squirrelCageFrameCounterOrange[index]; if (Main.squirrelCageFrameCounterOrange[index] >= 5) { Main.squirrelCageFrameCounterOrange[index] = 0; ++Main.squirrelCageFrameOrange[index]; } if (Main.squirrelCageFrameOrange[index] > 3) Main.squirrelCageFrameOrange[index] = Main.rand.Next(5) != 0 ? 2 : 0; } else if (Main.squirrelCageFrameOrange[index] >= 4 && Main.squirrelCageFrameOrange[index] <= 8) { ++Main.squirrelCageFrameCounterOrange[index]; if (Main.squirrelCageFrameCounterOrange[index] >= 5) { Main.squirrelCageFrameCounterOrange[index] = 0; ++Main.squirrelCageFrameOrange[index]; } } else if (Main.squirrelCageFrameOrange[index] == 9) { ++Main.squirrelCageFrameCounterOrange[index]; if (Main.squirrelCageFrameCounterOrange[index] > Main.rand.Next(30, 900)) { if (Main.rand.Next(3) != 0) { int num = Main.rand.Next(7); Main.squirrelCageFrameOrange[index] = num != 0 ? (num > 2 ? 10 : 11) : 13; } Main.squirrelCageFrameCounterOrange[index] = 0; } } else if (Main.squirrelCageFrameOrange[index] == 10) { ++Main.squirrelCageFrameCounterOrange[index]; if (Main.squirrelCageFrameCounterOrange[index] >= 10) { Main.squirrelCageFrameCounterOrange[index] = 0; Main.squirrelCageFrameOrange[index] = 9; } } else if (Main.squirrelCageFrameOrange[index] == 11 || Main.squirrelCageFrameOrange[index] == 12) { ++Main.squirrelCageFrameCounterOrange[index]; if (Main.squirrelCageFrameCounterOrange[index] >= 5) { ++Main.squirrelCageFrameOrange[index]; if (Main.squirrelCageFrameOrange[index] > 12) Main.squirrelCageFrameOrange[index] = Main.rand.Next(5) == 0 ? 9 : 11; Main.squirrelCageFrameCounterOrange[index] = 0; } } else if (Main.squirrelCageFrameOrange[index] >= 13) { ++Main.squirrelCageFrameCounterOrange[index]; if (Main.squirrelCageFrameCounterOrange[index] >= 5) { Main.squirrelCageFrameCounterOrange[index] = 0; ++Main.squirrelCageFrameOrange[index]; } if (Main.squirrelCageFrameOrange[index] > 17) Main.squirrelCageFrameOrange[index] = 0; } } for (int index = 0; index < Main.cageFrames; ++index) { if (Main.mallardCageFrame[index] == 0 || Main.mallardCageFrame[index] == 4) { ++Main.mallardCageFrameCounter[index]; if (Main.mallardCageFrameCounter[index] > Main.rand.Next(45, 2700)) { if (Main.mallardCageFrame[index] == 0 && Main.rand.Next(3) != 0 || Main.mallardCageFrame[index] == 4 && Main.rand.Next(5) == 0) Main.mallardCageFrame[index] = Main.rand.Next(6) != 0 ? (Main.rand.Next(3) != 0 ? 1 : (Main.mallardCageFrame[index] != 4 ? 4 : 0)) : 5; Main.mallardCageFrameCounter[index] = 0; } } else if (Main.mallardCageFrame[index] >= 1 && Main.mallardCageFrame[index] <= 3) { ++Main.mallardCageFrameCounter[index]; if (Main.mallardCageFrameCounter[index] >= 5) { Main.mallardCageFrameCounter[index] = 0; ++Main.mallardCageFrame[index]; } if (Main.mallardCageFrame[index] > 3) Main.mallardCageFrame[index] = Main.rand.Next(5) != 0 ? 1 : 0; } else if (Main.mallardCageFrame[index] >= 5 && Main.mallardCageFrame[index] <= 11) { ++Main.mallardCageFrameCounter[index]; if (Main.mallardCageFrameCounter[index] >= 5) { Main.mallardCageFrameCounter[index] = 0; ++Main.mallardCageFrame[index]; } } else if (Main.mallardCageFrame[index] == 12 || Main.mallardCageFrame[index] == 16) { ++Main.mallardCageFrameCounter[index]; if (Main.mallardCageFrameCounter[index] > Main.rand.Next(45, 2700)) { if (Main.mallardCageFrame[index] == 12 && Main.rand.Next(3) != 0 || Main.mallardCageFrame[index] == 16 && Main.rand.Next(5) == 0) Main.mallardCageFrame[index] = Main.rand.Next(6) != 0 ? (Main.rand.Next(3) != 0 ? 13 : (Main.mallardCageFrame[index] != 16 ? 16 : 12)) : 17; Main.mallardCageFrameCounter[index] = 0; } } else if (Main.mallardCageFrame[index] >= 13 && Main.mallardCageFrame[index] <= 15) { ++Main.mallardCageFrameCounter[index]; if (Main.mallardCageFrameCounter[index] >= 5) { ++Main.mallardCageFrame[index]; if (Main.mallardCageFrame[index] > 15) Main.mallardCageFrame[index] = Main.rand.Next(5) == 0 ? 13 : 12; Main.mallardCageFrameCounter[index] = 0; } } else if (Main.mallardCageFrame[index] >= 17) { ++Main.mallardCageFrameCounter[index]; if (Main.mallardCageFrameCounter[index] >= 5) { Main.mallardCageFrameCounter[index] = 0; ++Main.mallardCageFrame[index]; } if (Main.mallardCageFrame[index] > 23) Main.mallardCageFrame[index] = 0; } } for (int index = 0; index < Main.cageFrames; ++index) { if (Main.duckCageFrame[index] == 0 || Main.duckCageFrame[index] == 4) { ++Main.duckCageFrameCounter[index]; if (Main.duckCageFrameCounter[index] > Main.rand.Next(45, 2700)) { if (Main.duckCageFrame[index] == 0 && Main.rand.Next(3) != 0 || Main.duckCageFrame[index] == 4 && Main.rand.Next(5) == 0) Main.duckCageFrame[index] = Main.rand.Next(6) != 0 ? (Main.rand.Next(3) != 0 ? 1 : (Main.duckCageFrame[index] != 4 ? 4 : 0)) : 5; Main.duckCageFrameCounter[index] = 0; } } else if (Main.duckCageFrame[index] >= 1 && Main.duckCageFrame[index] <= 3) { ++Main.duckCageFrameCounter[index]; if (Main.duckCageFrameCounter[index] >= 5) { Main.duckCageFrameCounter[index] = 0; ++Main.duckCageFrame[index]; } if (Main.duckCageFrame[index] > 3) Main.duckCageFrame[index] = Main.rand.Next(5) != 0 ? 1 : 0; } else if (Main.duckCageFrame[index] >= 5 && Main.duckCageFrame[index] <= 11) { ++Main.duckCageFrameCounter[index]; if (Main.duckCageFrameCounter[index] >= 5) { Main.duckCageFrameCounter[index] = 0; ++Main.duckCageFrame[index]; } } else if (Main.duckCageFrame[index] == 12 || Main.duckCageFrame[index] == 16) { ++Main.duckCageFrameCounter[index]; if (Main.duckCageFrameCounter[index] > Main.rand.Next(45, 2700)) { if (Main.duckCageFrame[index] == 12 && Main.rand.Next(3) != 0 || Main.duckCageFrame[index] == 16 && Main.rand.Next(5) == 0) Main.duckCageFrame[index] = Main.rand.Next(6) != 0 ? (Main.rand.Next(3) != 0 ? 13 : (Main.duckCageFrame[index] != 16 ? 16 : 12)) : 17; Main.duckCageFrameCounter[index] = 0; } } else if (Main.duckCageFrame[index] >= 13 && Main.duckCageFrame[index] <= 15) { ++Main.duckCageFrameCounter[index]; if (Main.duckCageFrameCounter[index] >= 5) { ++Main.duckCageFrame[index]; if (Main.duckCageFrame[index] > 15) Main.duckCageFrame[index] = Main.rand.Next(5) == 0 ? 13 : 12; Main.duckCageFrameCounter[index] = 0; } } else if (Main.duckCageFrame[index] >= 17) { ++Main.duckCageFrameCounter[index]; if (Main.duckCageFrameCounter[index] >= 5) { Main.duckCageFrameCounter[index] = 0; ++Main.duckCageFrame[index]; } if (Main.duckCageFrame[index] > 23) Main.duckCageFrame[index] = 0; } } for (int index = 0; index < Main.cageFrames; ++index) { ++Main.grebeCageFrameCounter[index]; bool flag = Main.grebeCageFrame[index] == 0 || Main.grebeCageFrame[index] == 7; int num1 = Main.grebeCageFrame[index] == 16 ? 1 : (Main.grebeCageFrame[index] == 20 ? 1 : 0); int num2 = 5; if (flag) num2 = Main.rand.Next(300, 400); if (num1 != 0) num2 = Main.rand.Next(480, 600); if (Main.grebeCageFrameCounter[index] >= num2) { Main.grebeCageFrameCounter[index] = 0; if (Main.grebeCageFrame[index] >= 25 && Main.grebeCageFrame[index] <= 27) { ++Main.grebeCageFrame[index]; if (Main.grebeCageFrame[index] > 27) Main.grebeCageFrame[index] = Main.rand.Next(5) != 0 ? 25 : 7; } else if (Main.grebeCageFrame[index] >= 22 && Main.grebeCageFrame[index] <= 24) { ++Main.grebeCageFrame[index]; if (Main.grebeCageFrame[index] > 24) Main.grebeCageFrame[index] = Main.rand.Next(5) != 0 ? 22 : 0; } else if (Main.grebeCageFrame[index] == 0 && Main.rand.Next(3) == 0) Main.grebeCageFrame[index] = Main.rand.Next(2) == 0 ? 22 : 14; else if (Main.grebeCageFrame[index] == 7 && Main.rand.Next(3) == 0) Main.grebeCageFrame[index] = Main.rand.Next(2) == 0 ? 25 : 18; else if (Main.grebeCageFrame[index] == 13 || Main.grebeCageFrame[index] == 17) Main.grebeCageFrame[index] = 0; else if (Main.grebeCageFrame[index] == 21) Main.grebeCageFrame[index] = 7; else ++Main.grebeCageFrame[index]; } } for (int index = 0; index < Main.cageFrames; ++index) { ++Main.seagullCageFrameCounter[index]; bool flag1 = Main.seagullCageFrame[index] == 0 || Main.seagullCageFrame[index] == 14; bool flag2 = Main.seagullCageFrame[index] >= 15 && Main.seagullCageFrame[index] <= 18; int num3 = Main.seagullCageFrame[index] < 9 ? 0 : (Main.seagullCageFrame[index] <= 13 ? 1 : 0); int num4 = 6; if (flag1) num4 = Main.rand.Next(180, 250); if (flag2) num4 = 66; if (num3 != 0) num4 = 78; if (Main.seagullCageFrameCounter[index] >= num4) { Main.seagullCageFrameCounter[index] = 0; if (Main.seagullCageFrame[index] == 0 && Main.rand.Next(3) == 0) Main.seagullCageFrame[index] = 9; else if (Main.seagullCageFrame[index] == 14) Main.seagullCageFrame[index] = Main.rand.Next(2) != 0 ? 19 : 15; else if (Main.seagullCageFrame[index] == 9) Main.seagullCageFrame[index] = 0; else if (Main.seagullCageFrame[index] == 8 || Main.seagullCageFrame[index] == 15) { Main.seagullCageFrame[index] = 14; } else { ++Main.seagullCageFrame[index]; if (Main.seagullCageFrame[index] > 26) Main.seagullCageFrame[index] = 0; } } else if (Main.seagullCageFrame[index] >= 15 && Main.seagullCageFrame[index] <= 18) { int num5 = Main.seagullCageFrameCounter[index] % 66; Main.seagullCageFrame[index] = num5 <= 60 ? (num5 <= 54 ? (num5 <= 48 ? (num5 <= 42 ? (num5 <= 36 ? (num5 <= 30 ? (num5 <= 24 ? (num5 <= 18 ? (num5 <= 12 ? (num5 <= 6 ? 15 : 16) : 17) : 18) : 17) : 16) : 17) : 18) : 17) : 16) : 15; } else if (Main.seagullCageFrame[index] >= 9 && Main.seagullCageFrame[index] <= 13) { int num6 = Main.seagullCageFrameCounter[index] % 78; Main.seagullCageFrame[index] = num6 <= 72 ? (num6 <= 66 ? (num6 <= 60 ? (num6 <= 54 ? (num6 <= 48 ? (num6 <= 42 ? (num6 <= 36 ? (num6 <= 30 ? (num6 <= 24 ? (num6 <= 18 ? (num6 <= 12 ? (num6 <= 6 ? 9 : 10) : 11) : 12) : 13) : 12) : 11) : 12) : 13) : 12) : 11) : 10) : 9; } } for (int index = 0; index < Main.cageFrames; ++index) { if (Main.birdCageFrame[index] == 0) { ++Main.birdCageFrameCounter[index]; if (Main.birdCageFrameCounter[index] > Main.rand.Next(30, 2700)) { if (Main.rand.Next(3) != 0) Main.birdCageFrame[index] = Main.rand.Next(3) == 0 ? 1 : 2; Main.birdCageFrameCounter[index] = 0; } } else if (Main.birdCageFrame[index] == 1) { ++Main.birdCageFrameCounter[index]; if (Main.birdCageFrameCounter[index] > Main.rand.Next(900, 18000) && Main.rand.Next(3) == 0) { Main.birdCageFrameCounter[index] = 0; Main.birdCageFrame[index] = 0; } } else if (Main.birdCageFrame[index] >= 2 && Main.birdCageFrame[index] <= 5) { ++Main.birdCageFrameCounter[index]; if (Main.birdCageFrameCounter[index] >= 5) { Main.birdCageFrameCounter[index] = 0; if (Main.birdCageFrame[index] == 3 && Main.rand.Next(3) == 0) Main.birdCageFrame[index] = 13; else ++Main.birdCageFrame[index]; } } else if (Main.birdCageFrame[index] == 6) { ++Main.birdCageFrameCounter[index]; if (Main.birdCageFrameCounter[index] > Main.rand.Next(45, 2700)) { if (Main.rand.Next(3) != 0) { if (Main.rand.Next(6) == 0) Main.birdCageFrame[index] = 7; else if (Main.rand.Next(6) == 0) Main.birdCageFrame[index] = 11; } Main.birdCageFrameCounter[index] = 0; } } else if (Main.birdCageFrame[index] >= 7 && Main.birdCageFrame[index] <= 10) { ++Main.birdCageFrameCounter[index]; if (Main.birdCageFrameCounter[index] >= 5) { ++Main.birdCageFrame[index]; if (Main.birdCageFrame[index] > 10) Main.birdCageFrame[index] = 0; Main.birdCageFrameCounter[index] = 0; } } else if (Main.birdCageFrame[index] >= 11 && Main.birdCageFrame[index] <= 13) { ++Main.birdCageFrameCounter[index]; if (Main.birdCageFrameCounter[index] >= 5) { ++Main.birdCageFrame[index]; Main.birdCageFrameCounter[index] = 0; } } else if (Main.birdCageFrame[index] == 14) { ++Main.birdCageFrameCounter[index]; if (Main.birdCageFrameCounter[index] > Main.rand.Next(5, 600)) { Main.birdCageFrame[index] = Main.rand.Next(20) != 0 ? (Main.rand.Next(20) != 0 ? 15 : 4) : 16; Main.birdCageFrameCounter[index] = 0; } } else if (Main.birdCageFrame[index] == 15) { ++Main.birdCageFrameCounter[index]; if (Main.birdCageFrameCounter[index] >= 10) { Main.birdCageFrameCounter[index] = 0; Main.birdCageFrame[index] = 14; } } else if (Main.birdCageFrame[index] >= 16 && Main.birdCageFrame[index] <= 18) { ++Main.birdCageFrameCounter[index]; if (Main.birdCageFrameCounter[index] >= 5) { ++Main.birdCageFrame[index]; if (Main.birdCageFrame[index] > 18) Main.birdCageFrame[index] = 0; Main.birdCageFrameCounter[index] = 0; } } } for (int index = 0; index < Main.cageFrames; ++index) { if (Main.blueBirdCageFrame[index] == 0) { ++Main.blueBirdCageFrameCounter[index]; if (Main.blueBirdCageFrameCounter[index] > Main.rand.Next(30, 2700)) { if (Main.rand.Next(3) != 0) Main.blueBirdCageFrame[index] = Main.rand.Next(3) == 0 ? 1 : 2; Main.blueBirdCageFrameCounter[index] = 0; } } else if (Main.blueBirdCageFrame[index] == 1) { ++Main.blueBirdCageFrameCounter[index]; if (Main.blueBirdCageFrameCounter[index] > Main.rand.Next(900, 18000) && Main.rand.Next(3) == 0) { Main.blueBirdCageFrameCounter[index] = 0; Main.blueBirdCageFrame[index] = 0; } } else if (Main.blueBirdCageFrame[index] >= 2 && Main.blueBirdCageFrame[index] <= 5) { ++Main.blueBirdCageFrameCounter[index]; if (Main.blueBirdCageFrameCounter[index] >= 5) { Main.blueBirdCageFrameCounter[index] = 0; if (Main.blueBirdCageFrame[index] == 3 && Main.rand.Next(3) == 0) Main.blueBirdCageFrame[index] = 13; else ++Main.blueBirdCageFrame[index]; } } else if (Main.blueBirdCageFrame[index] == 6) { ++Main.blueBirdCageFrameCounter[index]; if (Main.blueBirdCageFrameCounter[index] > Main.rand.Next(45, 2700)) { if (Main.rand.Next(3) != 0) { if (Main.rand.Next(6) == 0) Main.blueBirdCageFrame[index] = 7; else if (Main.rand.Next(6) == 0) Main.blueBirdCageFrame[index] = 11; } Main.blueBirdCageFrameCounter[index] = 0; } } else if (Main.blueBirdCageFrame[index] >= 7 && Main.blueBirdCageFrame[index] <= 10) { ++Main.blueBirdCageFrameCounter[index]; if (Main.blueBirdCageFrameCounter[index] >= 5) { ++Main.blueBirdCageFrame[index]; if (Main.blueBirdCageFrame[index] > 10) Main.blueBirdCageFrame[index] = 0; Main.blueBirdCageFrameCounter[index] = 0; } } else if (Main.blueBirdCageFrame[index] >= 11 && Main.blueBirdCageFrame[index] <= 13) { ++Main.blueBirdCageFrameCounter[index]; if (Main.blueBirdCageFrameCounter[index] >= 5) { ++Main.blueBirdCageFrame[index]; Main.blueBirdCageFrameCounter[index] = 0; } } else if (Main.blueBirdCageFrame[index] == 14) { ++Main.blueBirdCageFrameCounter[index]; if (Main.blueBirdCageFrameCounter[index] > Main.rand.Next(5, 600)) { Main.blueBirdCageFrame[index] = Main.rand.Next(20) != 0 ? (Main.rand.Next(20) != 0 ? 15 : 4) : 16; Main.blueBirdCageFrameCounter[index] = 0; } } else if (Main.blueBirdCageFrame[index] == 15) { ++Main.blueBirdCageFrameCounter[index]; if (Main.blueBirdCageFrameCounter[index] >= 10) { Main.blueBirdCageFrameCounter[index] = 0; Main.blueBirdCageFrame[index] = 14; } } else if (Main.blueBirdCageFrame[index] >= 16 && Main.blueBirdCageFrame[index] <= 18) { ++Main.blueBirdCageFrameCounter[index]; if (Main.blueBirdCageFrameCounter[index] >= 5) { ++Main.blueBirdCageFrame[index]; if (Main.blueBirdCageFrame[index] > 18) Main.blueBirdCageFrame[index] = 0; Main.blueBirdCageFrameCounter[index] = 0; } } } for (int index = 0; index < Main.cageFrames; ++index) { if (Main.redBirdCageFrame[index] == 0) { ++Main.redBirdCageFrameCounter[index]; if (Main.redBirdCageFrameCounter[index] > Main.rand.Next(30, 2700)) { if (Main.rand.Next(3) != 0) Main.redBirdCageFrame[index] = Main.rand.Next(3) == 0 ? 1 : 2; Main.redBirdCageFrameCounter[index] = 0; } } else if (Main.redBirdCageFrame[index] == 1) { ++Main.redBirdCageFrameCounter[index]; if (Main.redBirdCageFrameCounter[index] > Main.rand.Next(900, 18000) && Main.rand.Next(3) == 0) { Main.redBirdCageFrameCounter[index] = 0; Main.redBirdCageFrame[index] = 0; } } else if (Main.redBirdCageFrame[index] >= 2 && Main.redBirdCageFrame[index] <= 5) { ++Main.redBirdCageFrameCounter[index]; if (Main.redBirdCageFrameCounter[index] >= 5) { Main.redBirdCageFrameCounter[index] = 0; if (Main.redBirdCageFrame[index] == 3 && Main.rand.Next(3) == 0) Main.redBirdCageFrame[index] = 13; else ++Main.redBirdCageFrame[index]; } } else if (Main.redBirdCageFrame[index] == 6) { ++Main.redBirdCageFrameCounter[index]; if (Main.redBirdCageFrameCounter[index] > Main.rand.Next(45, 2700)) { if (Main.rand.Next(3) != 0) { if (Main.rand.Next(6) == 0) Main.redBirdCageFrame[index] = 7; else if (Main.rand.Next(6) == 0) Main.redBirdCageFrame[index] = 11; } Main.redBirdCageFrameCounter[index] = 0; } } else if (Main.redBirdCageFrame[index] >= 7 && Main.redBirdCageFrame[index] <= 10) { ++Main.redBirdCageFrameCounter[index]; if (Main.redBirdCageFrameCounter[index] >= 5) { ++Main.redBirdCageFrame[index]; if (Main.redBirdCageFrame[index] > 10) Main.redBirdCageFrame[index] = 0; Main.redBirdCageFrameCounter[index] = 0; } } else if (Main.redBirdCageFrame[index] >= 11 && Main.redBirdCageFrame[index] <= 13) { ++Main.redBirdCageFrameCounter[index]; if (Main.redBirdCageFrameCounter[index] >= 5) { ++Main.redBirdCageFrame[index]; Main.redBirdCageFrameCounter[index] = 0; } } else if (Main.redBirdCageFrame[index] == 14) { ++Main.redBirdCageFrameCounter[index]; if (Main.redBirdCageFrameCounter[index] > Main.rand.Next(5, 600)) { Main.redBirdCageFrame[index] = Main.rand.Next(20) != 0 ? (Main.rand.Next(20) != 0 ? 15 : 4) : 16; Main.redBirdCageFrameCounter[index] = 0; } } else if (Main.redBirdCageFrame[index] == 15) { ++Main.redBirdCageFrameCounter[index]; if (Main.redBirdCageFrameCounter[index] >= 10) { Main.redBirdCageFrameCounter[index] = 0; Main.redBirdCageFrame[index] = 14; } } else if (Main.redBirdCageFrame[index] >= 16 && Main.redBirdCageFrame[index] <= 18) { ++Main.redBirdCageFrameCounter[index]; if (Main.redBirdCageFrameCounter[index] >= 5) { ++Main.redBirdCageFrame[index]; if (Main.redBirdCageFrame[index] > 18) Main.redBirdCageFrame[index] = 0; Main.redBirdCageFrameCounter[index] = 0; } } } for (int index1 = 0; index1 < 2; ++index1) { for (int index2 = 0; index2 < Main.cageFrames; ++index2) { if (Main.scorpionCageFrame[index1, index2] == 0 || Main.scorpionCageFrame[index1, index2] == 7) { ++Main.scorpionCageFrameCounter[index1, index2]; if (Main.scorpionCageFrameCounter[index1, index2] > Main.rand.Next(30, 3600)) { if (Main.scorpionCageFrame[index1, index2] == 7) Main.scorpionCageFrame[index1, index2] = 0; else if (Main.rand.Next(3) == 0) Main.scorpionCageFrame[index1, index2] = Main.rand.Next(7) != 0 ? (Main.rand.Next(4) != 0 ? (Main.rand.Next(3) != 0 ? 14 : 7) : 8) : 1; Main.scorpionCageFrameCounter[index1, index2] = 0; } } else if (Main.scorpionCageFrame[index1, index2] >= 1 && Main.scorpionCageFrame[index1, index2] <= 2) { ++Main.scorpionCageFrameCounter[index1, index2]; if (Main.scorpionCageFrameCounter[index1, index2] >= 10) { Main.scorpionCageFrameCounter[index1, index2] = 0; ++Main.scorpionCageFrame[index1, index2]; } } else if (Main.scorpionCageFrame[index1, index2] >= 8 && Main.scorpionCageFrame[index1, index2] <= 10) { ++Main.scorpionCageFrameCounter[index1, index2]; if (Main.scorpionCageFrameCounter[index1, index2] >= 10) { Main.scorpionCageFrameCounter[index1, index2] = 0; ++Main.scorpionCageFrame[index1, index2]; } } else if (Main.scorpionCageFrame[index1, index2] == 11) { ++Main.scorpionCageFrameCounter[index1, index2]; if (Main.scorpionCageFrameCounter[index1, index2] > Main.rand.Next(45, 5400)) { if (Main.rand.Next(6) == 0) Main.scorpionCageFrame[index1, index2] = 12; Main.scorpionCageFrameCounter[index1, index2] = 0; } } else if (Main.scorpionCageFrame[index1, index2] >= 12 && Main.scorpionCageFrame[index1, index2] <= 13) { ++Main.scorpionCageFrameCounter[index1, index2]; if (Main.scorpionCageFrameCounter[index1, index2] >= 10) { Main.scorpionCageFrameCounter[index1, index2] = 0; ++Main.scorpionCageFrame[index1, index2]; if (Main.scorpionCageFrame[index1, index2] > 13) Main.scorpionCageFrame[index1, index2] = 0; } } else if (Main.scorpionCageFrame[index1, index2] >= 14 && Main.scorpionCageFrame[index1, index2] <= 15) { ++Main.scorpionCageFrameCounter[index1, index2]; if (Main.scorpionCageFrameCounter[index1, index2] >= 5) { Main.scorpionCageFrameCounter[index1, index2] = 0; ++Main.scorpionCageFrame[index1, index2]; if (Main.scorpionCageFrame[index1, index2] > 15) Main.scorpionCageFrame[index1, index2] = 14; if (Main.rand.Next(5) == 0) Main.scorpionCageFrame[index1, index2] = 0; } } else if (Main.scorpionCageFrame[index1, index2] == 4 || Main.scorpionCageFrame[index1, index2] == 3) { ++Main.scorpionCageFrameCounter[index1, index2]; if (Main.scorpionCageFrameCounter[index1, index2] > Main.rand.Next(30, 3600)) { if (Main.scorpionCageFrame[index1, index2] == 3) Main.scorpionCageFrame[index1, index2] = 4; else if (Main.rand.Next(3) == 0) Main.scorpionCageFrame[index1, index2] = Main.rand.Next(5) != 0 ? (Main.rand.Next(3) != 0 ? 16 : 3) : 5; Main.scorpionCageFrameCounter[index1, index2] = 0; } } else if (Main.scorpionCageFrame[index1, index2] >= 5 && Main.scorpionCageFrame[index1, index2] <= 6) { ++Main.scorpionCageFrameCounter[index1, index2]; if (Main.scorpionCageFrameCounter[index1, index2] >= 10) { Main.scorpionCageFrameCounter[index1, index2] = 0; ++Main.scorpionCageFrame[index1, index2]; if (Main.scorpionCageFrame[index1, index2] > 7) Main.scorpionCageFrame[index1, index2] = 0; } } else if (Main.scorpionCageFrame[index1, index2] >= 16 && Main.scorpionCageFrame[index1, index2] <= 17) { ++Main.scorpionCageFrameCounter[index1, index2]; if (Main.scorpionCageFrameCounter[index1, index2] >= 5) { Main.scorpionCageFrameCounter[index1, index2] = 0; ++Main.scorpionCageFrame[index1, index2]; if (Main.scorpionCageFrame[index1, index2] > 17) Main.scorpionCageFrame[index1, index2] = 16; if (Main.rand.Next(5) == 0) Main.scorpionCageFrame[index1, index2] = 4; } } } } for (int index = 0; index < Main.cageFrames; ++index) { if (Main.penguinCageFrame[index] == 0) { ++Main.penguinCageFrameCounter[index]; if (Main.penguinCageFrameCounter[index] > Main.rand.Next(30, 1800)) { if (Main.rand.Next(2) == 0) Main.penguinCageFrame[index] = Main.rand.Next(10) != 0 ? (Main.rand.Next(7) != 0 ? (Main.rand.Next(3) != 0 ? 1 : 2) : 15) : 4; Main.penguinCageFrameCounter[index] = 0; } } else if (Main.penguinCageFrame[index] == 1) { ++Main.penguinCageFrameCounter[index]; if (Main.penguinCageFrameCounter[index] >= 10) { Main.penguinCageFrameCounter[index] = 0; Main.penguinCageFrame[index] = 0; } } else if (Main.penguinCageFrame[index] >= 2 && Main.penguinCageFrame[index] <= 3) { ++Main.penguinCageFrameCounter[index]; if (Main.penguinCageFrameCounter[index] >= 5) { Main.penguinCageFrameCounter[index] = 0; ++Main.penguinCageFrame[index]; if (Main.penguinCageFrame[index] > 3) Main.penguinCageFrame[index] = Main.rand.Next(3) != 0 ? 2 : 0; } } else if (Main.penguinCageFrame[index] >= 4 && Main.penguinCageFrame[index] <= 6) { ++Main.penguinCageFrameCounter[index]; if (Main.penguinCageFrameCounter[index] >= 10) { Main.penguinCageFrameCounter[index] = 0; ++Main.penguinCageFrame[index]; } } else if (Main.penguinCageFrame[index] == 15) { ++Main.penguinCageFrameCounter[index]; if (Main.penguinCageFrameCounter[index] > Main.rand.Next(10, 1800)) { if (Main.rand.Next(2) == 0) Main.penguinCageFrame[index] = 0; Main.penguinCageFrameCounter[index] = 0; } } else if (Main.penguinCageFrame[index] == 8) { ++Main.penguinCageFrameCounter[index]; if (Main.penguinCageFrameCounter[index] > Main.rand.Next(30, 3600)) { if (Main.rand.Next(2) == 0) Main.penguinCageFrame[index] = Main.rand.Next(10) != 0 ? (Main.rand.Next(7) != 0 ? (Main.rand.Next(3) != 0 ? 9 : 10) : 7) : 12; Main.penguinCageFrameCounter[index] = 0; } } else if (Main.penguinCageFrame[index] == 9) { ++Main.penguinCageFrameCounter[index]; if (Main.penguinCageFrameCounter[index] >= 10) { Main.penguinCageFrameCounter[index] = 0; Main.penguinCageFrame[index] = 8; } } else if (Main.penguinCageFrame[index] >= 10 && Main.penguinCageFrame[index] <= 11) { ++Main.penguinCageFrameCounter[index]; if (Main.penguinCageFrameCounter[index] >= 5) { Main.penguinCageFrameCounter[index] = 0; ++Main.penguinCageFrame[index]; if (Main.penguinCageFrame[index] > 3) Main.penguinCageFrame[index] = Main.rand.Next(3) != 0 ? 10 : 8; } } else if (Main.penguinCageFrame[index] >= 12 && Main.penguinCageFrame[index] <= 14) { ++Main.penguinCageFrameCounter[index]; if (Main.penguinCageFrameCounter[index] >= 10) { Main.penguinCageFrameCounter[index] = 0; ++Main.penguinCageFrame[index]; } } else if (Main.penguinCageFrame[index] == 7) { ++Main.penguinCageFrameCounter[index]; if (Main.penguinCageFrameCounter[index] > Main.rand.Next(10, 3600)) { if (Main.rand.Next(2) == 0) Main.penguinCageFrame[index] = 8; Main.penguinCageFrameCounter[index] = 0; } } } for (int index = 0; index < Main.cageFrames; ++index) { ++Main.turtleCageFrameCounter[index]; int num7 = Main.turtleCageFrame[index] == 0 || Main.turtleCageFrame[index] == 15 ? 1 : (Main.turtleCageFrame[index] == 31 ? 1 : 0); int num8 = 8; if (num7 != 0) num8 = Main.rand.Next(180, 250); if (Main.turtleCageFrameCounter[index] >= num8) { Main.turtleCageFrameCounter[index] = 0; if (Main.turtleCageFrame[index] == 29) Main.turtleCageFrame[index] = 0; else if (Main.turtleCageFrame[index] == 15 && Main.rand.Next(3) == 0) { Main.turtleCageFrame[index] = 30; } else { ++Main.turtleCageFrame[index]; if (Main.turtleCageFrame[index] > 32) Main.turtleCageFrame[index] = 15; } } } for (int index = 0; index < Main.cageFrames; ++index) { ++Main.seahorseCageFrameCounter[index]; bool flag3 = Main.seahorseCageFrame[index] == 0 || Main.seahorseCageFrame[index] == 13; int num9 = Main.seahorseCageFrame[index] == 4 || Main.seahorseCageFrame[index] == 9 || Main.seahorseCageFrame[index] == 17 ? 1 : (Main.seahorseCageFrame[index] == 22 ? 1 : 0); bool flag4 = Main.seahorseCageFrame[index] >= 25; int num10 = 7; if (flag3) num10 = Main.rand.Next(220, 340); if (num9 != 0) num10 = 10; if (flag4) num10 = 6; if (Main.seahorseCageFrameCounter[index] >= num10) { Main.seahorseCageFrameCounter[index] = 0; if (Main.seahorseCageFrame[index] == 0 && Main.rand.Next(2) == 0) Main.seahorseCageFrame[index] = 25; else if (Main.seahorseCageFrame[index] == 24) { Main.seahorseCageFrame[index] = 0; } else { ++Main.seahorseCageFrame[index]; if (Main.seahorseCageFrame[index] > 33) Main.seahorseCageFrame[index] = 0; } } } Main.UpdateOwlCageFrames(); for (int index = 0; index < Main.cageFrames; ++index) { if (Main.snailCageFrame[index] >= 0 && Main.snailCageFrame[index] <= 13) { ++Main.snailCageFrameCounter[index]; if (Main.snailCageFrameCounter[index] > Main.rand.Next(45, 3600)) { if (Main.snailCageFrame[index] == 8 && Main.rand.Next(2) == 0) Main.snailCageFrame[index] = 14; else if (Main.snailCageFrame[index] == 1 && Main.rand.Next(3) == 0) Main.snailCageFrame[index] = 19; else if (Main.snailCageFrame[index] == 1 && Main.rand.Next(3) == 0) { Main.snailCageFrame[index] = 20; } else { ++Main.snailCageFrame[index]; if (Main.snailCageFrame[index] > 13) Main.snailCageFrame[index] = 0; } Main.snailCageFrameCounter[index] = 0; } } else if (Main.snailCageFrame[index] >= 14 && Main.snailCageFrame[index] <= 18) { ++Main.snailCageFrameCounter[index]; if (Main.snailCageFrameCounter[index] >= 5) { Main.snailCageFrameCounter[index] = 0; ++Main.snailCageFrame[index]; } if (Main.snailCageFrame[index] > 18) Main.snailCageFrame[index] = 20; } else if (Main.snailCageFrame[index] == 19 || Main.snailCageFrame[index] == 20) { ++Main.snailCageFrameCounter[index]; if (Main.snailCageFrameCounter[index] > Main.rand.Next(60, 7200)) { Main.snailCageFrameCounter[index] = 0; if (Main.rand.Next(4) == 0) Main.snailCageFrame[index] = Main.rand.Next(3) != 0 ? (Main.snailCageFrame[index] != 19 ? 19 : 20) : 2; } } } for (int index = 0; index < Main.cageFrames; ++index) { if (Main.snail2CageFrame[index] >= 0 && Main.snail2CageFrame[index] <= 13) { ++Main.snail2CageFrameCounter[index]; if (Main.snail2CageFrameCounter[index] > Main.rand.Next(30, 2700)) { if (Main.snail2CageFrame[index] == 8 && Main.rand.Next(2) == 0) Main.snail2CageFrame[index] = 14; else if (Main.snail2CageFrame[index] == 1 && Main.rand.Next(3) == 0) Main.snail2CageFrame[index] = 19; else if (Main.snail2CageFrame[index] == 1 && Main.rand.Next(3) == 0) { Main.snail2CageFrame[index] = 20; } else { ++Main.snail2CageFrame[index]; if (Main.snail2CageFrame[index] > 13) Main.snail2CageFrame[index] = 0; } Main.snail2CageFrameCounter[index] = 0; } } else if (Main.snail2CageFrame[index] >= 14 && Main.snail2CageFrame[index] <= 18) { ++Main.snail2CageFrameCounter[index]; if (Main.snail2CageFrameCounter[index] >= 5) { Main.snail2CageFrameCounter[index] = 0; ++Main.snail2CageFrame[index]; } if (Main.snail2CageFrame[index] > 18) Main.snail2CageFrame[index] = 20; } else if (Main.snail2CageFrame[index] == 19 || Main.snail2CageFrame[index] == 20) { ++Main.snail2CageFrameCounter[index]; if (Main.snail2CageFrameCounter[index] > Main.rand.Next(45, 5400)) { Main.snail2CageFrameCounter[index] = 0; if (Main.rand.Next(4) == 0) Main.snail2CageFrame[index] = Main.rand.Next(3) != 0 ? (Main.snail2CageFrame[index] != 19 ? 19 : 20) : 2; } } } for (int index = 0; index < Main.cageFrames; ++index) { if (Main.frogCageFrame[index] == 0) { ++Main.frogCageFrameCounter[index]; if (Main.frogCageFrameCounter[index] > Main.rand.Next(45, 3600)) { Main.frogCageFrame[index] = Main.rand.Next(10) != 0 ? 12 : 1; Main.frogCageFrameCounter[index] = 0; } } else if (Main.frogCageFrame[index] >= 1 && Main.frogCageFrame[index] <= 5) { ++Main.frogCageFrameCounter[index]; if (Main.frogCageFrameCounter[index] >= 5) { ++Main.frogCageFrame[index]; Main.frogCageFrameCounter[index] = 0; } } else if (Main.frogCageFrame[index] >= 12 && Main.frogCageFrame[index] <= 17) { ++Main.frogCageFrameCounter[index]; if (Main.frogCageFrameCounter[index] >= 5) { Main.frogCageFrameCounter[index] = 0; ++Main.frogCageFrame[index]; } if (Main.frogCageFrame[index] > 17) Main.frogCageFrame[index] = Main.rand.Next(3) != 0 ? 12 : 0; } else if (Main.frogCageFrame[index] == 6) { ++Main.frogCageFrameCounter[index]; if (Main.frogCageFrameCounter[index] > Main.rand.Next(45, 3600)) { Main.frogCageFrame[index] = Main.rand.Next(10) != 0 ? 18 : 7; Main.frogCageFrameCounter[index] = 0; } } else if (Main.frogCageFrame[index] >= 7 && Main.frogCageFrame[index] <= 11) { ++Main.frogCageFrameCounter[index]; if (Main.frogCageFrameCounter[index] >= 5) { ++Main.frogCageFrame[index]; Main.frogCageFrameCounter[index] = 0; if (Main.frogCageFrame[index] > 11) Main.frogCageFrame[index] = 0; } } else if (Main.frogCageFrame[index] >= 18 && Main.frogCageFrame[index] <= 23) { ++Main.frogCageFrameCounter[index]; if (Main.frogCageFrameCounter[index] >= 5) { Main.frogCageFrameCounter[index] = 0; ++Main.frogCageFrame[index]; } if (Main.frogCageFrame[index] > 17) Main.frogCageFrame[index] = Main.rand.Next(3) != 0 ? 18 : 6; } } for (int index = 0; index < Main.cageFrames; ++index) { if (Main.mouseCageFrame[index] >= 0 && Main.mouseCageFrame[index] <= 1) { ++Main.mouseCageFrameCounter[index]; if (Main.mouseCageFrameCounter[index] >= 5) { ++Main.mouseCageFrame[index]; if (Main.mouseCageFrame[index] > 1) Main.mouseCageFrame[index] = 0; Main.mouseCageFrameCounter[index] = 0; if (Main.rand.Next(15) == 0) Main.mouseCageFrame[index] = 4; } } else if (Main.mouseCageFrame[index] >= 4 && Main.mouseCageFrame[index] <= 7) { ++Main.mouseCageFrameCounter[index]; if (Main.mouseCageFrameCounter[index] >= 5) { Main.mouseCageFrameCounter[index] = 0; ++Main.mouseCageFrame[index]; } if (Main.mouseCageFrame[index] > 7) Main.mouseCageFrame[index] = 2; } else if (Main.mouseCageFrame[index] >= 2 && Main.mouseCageFrame[index] <= 3) { ++Main.mouseCageFrameCounter[index]; if (Main.mouseCageFrameCounter[index] >= 5) { ++Main.mouseCageFrame[index]; if (Main.mouseCageFrame[index] > 3) Main.mouseCageFrame[index] = 2; Main.mouseCageFrameCounter[index] = 0; if (Main.rand.Next(15) == 0) Main.mouseCageFrame[index] = 8; else if (Main.rand.Next(15) == 0) Main.mouseCageFrame[index] = 12; } } else if (Main.mouseCageFrame[index] >= 8 && Main.mouseCageFrame[index] <= 11) { ++Main.mouseCageFrameCounter[index]; if (Main.mouseCageFrameCounter[index] >= 5) { Main.mouseCageFrameCounter[index] = 0; ++Main.mouseCageFrame[index]; } if (Main.mouseCageFrame[index] > 11) Main.mouseCageFrame[index] = 0; } else if (Main.mouseCageFrame[index] >= 12 && Main.mouseCageFrame[index] <= 13) { ++Main.mouseCageFrameCounter[index]; if (Main.mouseCageFrameCounter[index] >= 5) { Main.mouseCageFrameCounter[index] = 0; ++Main.mouseCageFrame[index]; } } else if (Main.mouseCageFrame[index] >= 14 && Main.mouseCageFrame[index] <= 17) { ++Main.mouseCageFrameCounter[index]; if (Main.mouseCageFrameCounter[index] >= 5) { Main.mouseCageFrameCounter[index] = 0; ++Main.mouseCageFrame[index]; if (Main.mouseCageFrame[index] > 17 && Main.rand.Next(20) != 0) Main.mouseCageFrame[index] = 14; } } else if (Main.mouseCageFrame[index] >= 18 && Main.mouseCageFrame[index] <= 19) { ++Main.mouseCageFrameCounter[index]; if (Main.mouseCageFrameCounter[index] >= 5) { Main.mouseCageFrameCounter[index] = 0; ++Main.mouseCageFrame[index]; if (Main.mouseCageFrame[index] > 19) Main.mouseCageFrame[index] = 0; } } } for (int index = 0; index < Main.cageFrames; ++index) { ++Main.wormCageFrameCounter[index]; if (Main.wormCageFrameCounter[index] >= Main.rand.Next(30, 91)) { Main.wormCageFrameCounter[index] = 0; if (Main.rand.Next(4) == 0) { ++Main.wormCageFrame[index]; if (Main.wormCageFrame[index] == 9 && Main.rand.Next(2) == 0) Main.wormCageFrame[index] = 0; if (Main.wormCageFrame[index] > 18) Main.wormCageFrame[index] = Main.rand.Next(2) != 0 ? 0 : 9; } } } int num11 = 0; for (int index3 = 0; index3 < 3; ++index3) { switch (index3) { case 0: num11 = 24; break; case 1: num11 = 31; break; case 2: num11 = 34; break; } for (int index4 = 0; index4 < Main.cageFrames; ++index4) { if (++Main.slugCageFrameCounter[index3, index4] >= Main.rand.Next(5, 15)) { Main.slugCageFrameCounter[index3, index4] = 0; if (++Main.slugCageFrame[index3, index4] >= num11) Main.slugCageFrame[index3, index4] = 0; } } } for (int index = 0; index < Main.cageFrames; ++index) { if (Main.grasshopperCageFrame[index] >= 0 && Main.grasshopperCageFrame[index] <= 1) { ++Main.grasshopperCageFrameCounter[index]; if (Main.grasshopperCageFrameCounter[index] >= 5) { ++Main.grasshopperCageFrame[index]; if (Main.grasshopperCageFrame[index] > 1) Main.grasshopperCageFrame[index] = 0; Main.grasshopperCageFrameCounter[index] = 0; if (Main.rand.Next(15) == 0) Main.grasshopperCageFrame[index] = 2; } } else if (Main.grasshopperCageFrame[index] >= 2 && Main.grasshopperCageFrame[index] <= 5) { ++Main.grasshopperCageFrameCounter[index]; if (Main.grasshopperCageFrameCounter[index] >= 5) { Main.grasshopperCageFrameCounter[index] = 0; ++Main.grasshopperCageFrame[index]; } if (Main.grasshopperCageFrame[index] > 5) Main.grasshopperCageFrame[index] = 6; } else if (Main.grasshopperCageFrame[index] >= 6 && Main.grasshopperCageFrame[index] <= 7) { ++Main.grasshopperCageFrameCounter[index]; if (Main.grasshopperCageFrameCounter[index] >= 5) { ++Main.grasshopperCageFrame[index]; if (Main.grasshopperCageFrame[index] > 7) Main.grasshopperCageFrame[index] = 6; Main.grasshopperCageFrameCounter[index] = 0; if (Main.rand.Next(15) == 0) Main.grasshopperCageFrame[index] = 8; } } else if (Main.grasshopperCageFrame[index] >= 8 && Main.grasshopperCageFrame[index] <= 11) { ++Main.grasshopperCageFrameCounter[index]; if (Main.grasshopperCageFrameCounter[index] >= 5) { Main.grasshopperCageFrameCounter[index] = 0; ++Main.grasshopperCageFrame[index]; } if (Main.grasshopperCageFrame[index] > 11) Main.grasshopperCageFrame[index] = 0; } } for (int index = 0; index < Main.cageFrames; ++index) { ++Main.maggotCageFrameCounter[index]; int num12 = Main.maggotCageFrame[index] == 0 || Main.maggotCageFrame[index] == 6 ? 1 : (Main.maggotCageFrame[index] == 18 ? 1 : 0); int num13 = 8; if (num12 != 0) num13 = Main.rand.Next(100, 140); if (Main.maggotCageFrameCounter[index] >= num13) { Main.maggotCageFrameCounter[index] = 0; if (Main.maggotCageFrame[index] == 0) Main.maggotCageFrame[index] = Main.rand.Next(3) != 0 ? 1 : 13; else if (Main.maggotCageFrame[index] == 12) { Main.maggotCageFrame[index] = 0; } else { ++Main.maggotCageFrame[index]; if (Main.maggotCageFrame[index] > 23) Main.maggotCageFrame[index] = 6; } } } for (int index = 0; index < Main.cageFrames; ++index) { ++Main.ladybugCageFrameCounter[index]; bool flag = Main.ladybugCageFrame[index] == 3 || Main.ladybugCageFrame[index] == 7 || Main.ladybugCageFrame[index] >= 17; int num14 = Main.rand.Next(10, 12); if (Main.ladybugCageFrame[index] == 18) num14 = Main.rand.Next(160, 241); else if (flag) num14 = Main.rand.Next(198, 206); else if (Main.ladybugCageFrame[index] >= 8 && Main.ladybugCageFrame[index] <= 16) num14 = 5; if (Main.ladybugCageFrameCounter[index] >= num14) { Main.ladybugCageFrameCounter[index] = 0; if (Main.ladybugCageFrame[index] < 18) { if ((Main.ladybugCageFrame[index] == 2 || Main.ladybugCageFrame[index] == 5) && Main.rand.Next(3) == 0) Main.ladybugCageFrame[index] = 17; else if (Main.ladybugCageFrame[index] == 3 || Main.ladybugCageFrame[index] == 12) { switch (Main.rand.Next(3)) { case 0: case 1: Main.ladybugCageFrame[index] = 4; continue; case 2: Main.ladybugCageFrame[index] = 13; continue; default: continue; } } else if (Main.ladybugCageFrame[index] == 7 || Main.ladybugCageFrame[index] == 16) { switch (Main.rand.Next(3)) { case 0: case 1: Main.ladybugCageFrame[index] = 0; continue; case 2: Main.ladybugCageFrame[index] = 8; continue; default: continue; } } else ++Main.ladybugCageFrame[index]; } else Main.ladybugCageFrame[index] = Main.rand.Next(2) == 0 ? 13 : 4; } } for (int index = 0; index < Main.cageFrames; ++index) { ++Main.ratCageFrameCounter[index]; bool flag5 = Main.ratCageFrame[index] == 0 || Main.ratCageFrame[index] == 4; int num15 = Main.ratCageFrame[index] == 8 || Main.ratCageFrame[index] == 9 || Main.ratCageFrame[index] == 10 ? 1 : (Main.ratCageFrame[index] == 11 ? 1 : 0); bool flag6 = Main.ratCageFrame[index] > 11; int num16 = 5; if (flag5) num16 = Main.rand.Next(40, 70); if (num15 != 0) num16 = Main.rand.Next(70, 110); if (flag6) num16 = 180; if (Main.ratCageFrameCounter[index] >= num16) { Main.ratCageFrameCounter[index] = 0; if (Main.ratCageFrame[index] == 0 && Main.rand.Next(2) == 0) Main.ratCageFrame[index] = Main.rand.Next(3) == 0 ? 8 : 12; else if (Main.ratCageFrame[index] == 4 && Main.rand.Next(2) == 0) Main.ratCageFrame[index] = 10; else if (Main.ratCageFrame[index] == 7 || Main.ratCageFrame[index] == 9 || Main.ratCageFrame[index] == 12) Main.ratCageFrame[index] = 0; else if (Main.ratCageFrame[index] == 11) { Main.ratCageFrame[index] = 4; } else { ++Main.ratCageFrame[index]; if (Main.ratCageFrame[index] > 16) Main.ratCageFrame[index] = 0; } } else if (Main.ratCageFrame[index] > 11) { int num17 = Main.ratCageFrameCounter[index] % 90; Main.ratCageFrame[index] = num17 <= 80 ? (num17 <= 70 ? (num17 <= 60 ? (num17 <= 50 ? (num17 <= 40 ? (num17 <= 30 ? (num17 <= 20 ? (num17 <= 10 ? 12 : 13) : 14) : 15) : 16) : 15) : 14) : 13) : 12; } else if (Main.ratCageFrameCounter[index] % 10 == 0) { if (Main.ratCageFrame[index] == 8 || Main.ratCageFrame[index] == 10) ++Main.ratCageFrame[index]; else if (Main.ratCageFrame[index] == 9 || Main.ratCageFrame[index] == 11) --Main.ratCageFrame[index]; } } for (int index = 0; index < Main.cageFrames; ++index) { ++Main.waterStriderCageFrameCounter[index]; bool flag = Main.waterStriderCageFrame[index] == 0 || Main.waterStriderCageFrame[index] == 8; int num18 = Main.waterStriderCageFrame[index] == 17 ? 1 : (Main.waterStriderCageFrame[index] == 20 ? 1 : 0); int num19 = 5; if (flag) num19 = Main.rand.Next(110, 210); if (num18 != 0) num19 = Main.rand.Next(150, 260); if (Main.waterStriderCageFrameCounter[index] >= num19) { Main.waterStriderCageFrameCounter[index] = 0; if (Main.waterStriderCageFrame[index] == 0 && Main.rand.Next(2) == 0) Main.waterStriderCageFrame[index] = 16; else if (Main.waterStriderCageFrame[index] == 8 && Main.rand.Next(2) == 0) Main.waterStriderCageFrame[index] = 19; else if (Main.waterStriderCageFrame[index] == 15 || Main.waterStriderCageFrame[index] == 18) { Main.waterStriderCageFrame[index] = 0; } else { ++Main.waterStriderCageFrame[index]; if (Main.waterStriderCageFrame[index] > 21) Main.waterStriderCageFrame[index] = 8; } } } ++Main.fairyJarFrameCounter[0]; if (Main.fairyJarFrameCounter[0] > 5) { Main.fairyJarFrameCounter[0] = 0; ++Main.fairyJarFrame[0]; if (Main.fairyJarFrame[0] > 11) Main.fairyJarFrame[0] = 0; } for (int index = 1; index < Main.cageFrames; ++index) { int num20 = Main.fairyJarFrame[0] + index % 12; if (index % 2 == 0) ++num20; if (index % 5 == 0) ++num20; if (index % 8 == 0) ++num20; while (num20 >= 12) num20 -= 12; Main.fairyJarFrame[index] = num20; } for (int index = 0; index < Main.cageFrames; ++index) { byte num21 = 5; if (Main.fishBowlFrameMode[index] == (byte) 1) { if (Main.rand.Next(900) == 0) Main.fishBowlFrameMode[index] = (byte) Main.rand.Next((int) num21); ++Main.fishBowlFrameCounter[index]; if (Main.fishBowlFrameCounter[index] >= 5) { Main.fishBowlFrameCounter[index] = 0; if (Main.fishBowlFrame[index] == 10) { if (Main.rand.Next(20) == 0) { Main.fishBowlFrame[index] = 11; Main.fishBowlFrameMode[index] = (byte) 0; } else Main.fishBowlFrame[index] = 1; } else ++Main.fishBowlFrame[index]; } } else if (Main.fishBowlFrameMode[index] == (byte) 2) { if (Main.rand.Next(3600) == 0) Main.fishBowlFrameMode[index] = (byte) Main.rand.Next((int) num21); ++Main.fishBowlFrameCounter[index]; if (Main.fishBowlFrameCounter[index] >= 20) { Main.fishBowlFrameCounter[index] = 0; if (Main.fishBowlFrame[index] == 10) { if (Main.rand.Next(20) == 0) { Main.fishBowlFrame[index] = 11; Main.fishBowlFrameMode[index] = (byte) 0; } else Main.fishBowlFrame[index] = 1; } else ++Main.fishBowlFrame[index]; } } else if (Main.fishBowlFrameMode[index] == (byte) 3) { if (Main.rand.Next(3600) == 0) Main.fishBowlFrameMode[index] = (byte) Main.rand.Next((int) num21); ++Main.fishBowlFrameCounter[index]; if (Main.fishBowlFrameCounter[index] >= Main.rand.Next(5, 3600)) { Main.fishBowlFrameCounter[index] = 0; if (Main.fishBowlFrame[index] == 10) { if (Main.rand.Next(20) == 0) { Main.fishBowlFrame[index] = 11; Main.fishBowlFrameMode[index] = (byte) 0; } else Main.fishBowlFrame[index] = 1; } else ++Main.fishBowlFrame[index]; } } else if (Main.fishBowlFrame[index] <= 10) { if (Main.rand.Next(3600) == 0) Main.fishBowlFrameMode[index] = (byte) Main.rand.Next((int) num21); ++Main.fishBowlFrameCounter[index]; if (Main.fishBowlFrameCounter[index] >= 10) { Main.fishBowlFrameCounter[index] = 0; if (Main.fishBowlFrame[index] == 10) Main.fishBowlFrame[index] = Main.rand.Next(12) != 0 ? 1 : 11; else ++Main.fishBowlFrame[index]; } } else if (Main.fishBowlFrame[index] == 12 || Main.fishBowlFrame[index] == 13) { ++Main.fishBowlFrameCounter[index]; if (Main.fishBowlFrameCounter[index] >= 10) { Main.fishBowlFrameCounter[index] = 0; ++Main.fishBowlFrame[index]; if (Main.fishBowlFrame[index] > 13) Main.fishBowlFrame[index] = Main.rand.Next(20) != 0 ? 12 : 14; } } else if (Main.fishBowlFrame[index] >= 11) { ++Main.fishBowlFrameCounter[index]; if (Main.fishBowlFrameCounter[index] >= 10) { Main.fishBowlFrameCounter[index] = 0; ++Main.fishBowlFrame[index]; if (Main.fishBowlFrame[index] > 16) Main.fishBowlFrame[index] = 4; } } } for (int index = 0; index < Main.cageFrames; ++index) { ++Main.lavaFishBowlFrameCounter[index]; if (Main.lavaFishBowlFrameCounter[index] > 4 + Main.rand.Next(3)) { Main.lavaFishBowlFrameCounter[index] = 0; ++Main.lavaFishBowlFrame[index]; if (Main.lavaFishBowlFrame[index] > 26) Main.lavaFishBowlFrame[index] = 0; } } for (int index5 = 0; index5 < 9; ++index5) { for (int index6 = 0; index6 < Main.cageFrames; ++index6) { ++Main.butterflyCageFrameCounter[index5, index6]; if (Main.rand.Next(3600) == 0) { Main.butterflyCageMode[index5, index6] = (byte) Main.rand.Next(5); if (Main.rand.Next(2) == 0) Main.butterflyCageMode[index5, index6] += (byte) 10; } int num22 = Main.rand.Next(3, 16); if (Main.butterflyCageMode[index5, index6] == (byte) 1 || Main.butterflyCageMode[index5, index6] == (byte) 11) num22 = 3; if (Main.butterflyCageMode[index5, index6] == (byte) 2 || Main.butterflyCageMode[index5, index6] == (byte) 12) num22 = 5; if (Main.butterflyCageMode[index5, index6] == (byte) 3 || Main.butterflyCageMode[index5, index6] == (byte) 13) num22 = 10; if (Main.butterflyCageMode[index5, index6] == (byte) 4 || Main.butterflyCageMode[index5, index6] == (byte) 14) num22 = 15; if (Main.butterflyCageMode[index5, index6] >= (byte) 10) { if (Main.butterflyCageFrame[index5, index6] <= 7) { if (Main.butterflyCageFrameCounter[index5, index6] >= num22) { Main.butterflyCageFrameCounter[index5, index6] = 0; --Main.butterflyCageFrame[index5, index6]; if (Main.butterflyCageFrame[index5, index6] < 0) Main.butterflyCageFrame[index5, index6] = 7; if (Main.butterflyCageFrame[index5, index6] == 1 || Main.butterflyCageFrame[index5, index6] == 4 || Main.butterflyCageFrame[index5, index6] == 6) { if (Main.rand.Next(20) == 0) Main.butterflyCageFrame[index5, index6] += 8; else if (Main.rand.Next(6) == 0) { if (Main.butterflyCageMode[index5, index6] >= (byte) 10) Main.butterflyCageMode[index5, index6] -= (byte) 10; else Main.butterflyCageMode[index5, index6] += (byte) 10; } } } } else if (Main.butterflyCageFrameCounter[index5, index6] >= num22) { Main.butterflyCageFrameCounter[index5, index6] = 0; --Main.butterflyCageFrame[index5, index6]; if (Main.butterflyCageFrame[index5, index6] < 8) Main.butterflyCageFrame[index5, index6] = 14; if (Main.butterflyCageFrame[index5, index6] == 9 || Main.butterflyCageFrame[index5, index6] == 12 || Main.butterflyCageFrame[index5, index6] == 14) { if (Main.rand.Next(20) == 0) Main.butterflyCageFrame[index5, index6] -= 8; else if (Main.rand.Next(6) == 0) { if (Main.butterflyCageMode[index5, index6] >= (byte) 10) Main.butterflyCageMode[index5, index6] -= (byte) 10; else Main.butterflyCageMode[index5, index6] += (byte) 10; } } } } else if (Main.butterflyCageFrame[index5, index6] <= 7) { if (Main.butterflyCageFrameCounter[index5, index6] >= num22) { Main.butterflyCageFrameCounter[index5, index6] = 0; ++Main.butterflyCageFrame[index5, index6]; if (Main.butterflyCageFrame[index5, index6] > 7) Main.butterflyCageFrame[index5, index6] = 0; if ((Main.butterflyCageFrame[index5, index6] == 1 || Main.butterflyCageFrame[index5, index6] == 4 || Main.butterflyCageFrame[index5, index6] == 6) && Main.rand.Next(10) == 0) Main.butterflyCageFrame[index5, index6] += 8; } } else if (Main.butterflyCageFrameCounter[index5, index6] >= num22) { Main.butterflyCageFrameCounter[index5, index6] = 0; ++Main.butterflyCageFrame[index5, index6]; if (Main.butterflyCageFrame[index5, index6] > 15) Main.butterflyCageFrame[index5, index6] = 8; if ((Main.butterflyCageFrame[index5, index6] == 9 || Main.butterflyCageFrame[index5, index6] == 12 || Main.butterflyCageFrame[index5, index6] == 14) && Main.rand.Next(10) == 0) Main.butterflyCageFrame[index5, index6] -= 8; } } } Main.UpdateDragonflyJarFrames(); for (int index7 = 0; index7 < 3; ++index7) { for (int index8 = 0; index8 < Main.cageFrames; ++index8) { ++Main.jellyfishCageFrameCounter[index7, index8]; if (Main.jellyfishCageMode[index7, index8] == (byte) 0 && Main.rand.Next(1800) == 0) Main.jellyfishCageMode[index7, index8] = (byte) 1; if (Main.jellyfishCageMode[index7, index8] == (byte) 2 && Main.rand.Next(60) == 0) Main.jellyfishCageMode[index7, index8] = (byte) 3; int num23 = 1; if (Main.jellyfishCageMode[index7, index8] == (byte) 0) num23 = Main.rand.Next(10, 20); if (Main.jellyfishCageMode[index7, index8] == (byte) 1) num23 = Main.rand.Next(15, 25); if (Main.jellyfishCageMode[index7, index8] == (byte) 2) num23 = Main.rand.Next(4, 9); if (Main.jellyfishCageMode[index7, index8] == (byte) 3) num23 = Main.rand.Next(15, 25); if (Main.jellyfishCageMode[index7, index8] == (byte) 0 && Main.jellyfishCageFrame[index7, index8] <= 3 && Main.jellyfishCageFrameCounter[index7, index8] >= num23) { Main.jellyfishCageFrameCounter[index7, index8] = 0; ++Main.jellyfishCageFrame[index7, index8]; if (Main.jellyfishCageFrame[index7, index8] >= 4) Main.jellyfishCageFrame[index7, index8] = 0; } if (Main.jellyfishCageMode[index7, index8] == (byte) 1 && Main.jellyfishCageFrame[index7, index8] <= 7 && Main.jellyfishCageFrameCounter[index7, index8] >= num23) { Main.jellyfishCageFrameCounter[index7, index8] = 0; ++Main.jellyfishCageFrame[index7, index8]; if (Main.jellyfishCageFrame[index7, index8] >= 7) Main.jellyfishCageMode[index7, index8] = (byte) 2; } if (Main.jellyfishCageMode[index7, index8] == (byte) 2 && Main.jellyfishCageFrame[index7, index8] <= 9 && Main.jellyfishCageFrameCounter[index7, index8] >= num23) { Main.jellyfishCageFrameCounter[index7, index8] = 0; ++Main.jellyfishCageFrame[index7, index8]; if (Main.jellyfishCageFrame[index7, index8] >= 9) Main.jellyfishCageFrame[index7, index8] = 7; } if (Main.jellyfishCageMode[index7, index8] == (byte) 3 && Main.jellyfishCageFrame[index7, index8] <= 10 && Main.jellyfishCageFrameCounter[index7, index8] >= num23) { Main.jellyfishCageFrameCounter[index7, index8] = 0; ++Main.jellyfishCageFrame[index7, index8]; if (Main.jellyfishCageFrame[index7, index8] >= 10) { Main.jellyfishCageFrame[index7, index8] = 3; Main.jellyfishCageMode[index7, index8] = (byte) 0; } } } } } private static void UpdateOwlCageFrames() { for (int style = 0; style < Main.cageFrames; ++style) Main.UpdateOwlCageFrame(Main.owlCageFrame, Main.owlCageFrameCounter, style); } private static void UpdateDragonflyJarFrames() { for (int style = 0; style < Main.dragonflyJarFrameCounter.GetLength(0); ++style) { for (int variation = 0; variation < Main.cageFrames; ++variation) Main.UpdateDragonflyJarFrame(Main.dragonflyJarFrame, Main.dragonflyJarFrameCounter, style, variation); } } private static void UpdateOwlCageFrame(int[] frames, int[] frameCounters, int style) { if (frameCounters[style] % 40 != 0 || Main.rand.Next(80) == 0) ++frameCounters[style]; if ((frameCounters[style] + 1) % 40 == 39) frameCounters[style] = 40 * Main.rand.Next(4); int num1 = frameCounters[style] % 40 / 10; int num2 = frameCounters[style] / 40; int num3 = 0; switch (num2) { case 0: if (num1 == 3) num1 = 1; num3 = num1; break; case 1: if (num1 == 3) num1 = 1; num3 = 0; if (num1 != 0) { num3 = 8 - num1; break; } break; case 2: num3 = 0; if (num1 != 0) { num3 = 7 + num1; break; } break; case 3: num3 = 0; if (num1 != 0) { num3 = 11 + num1; break; } break; } frames[style] = num3; } private static void UpdateDragonflyJarFrame( int[,] frames, int[,] frameCounters, int style, int variation) { ++frameCounters[style, variation]; switch (frames[style, variation]) { case 0: if (frameCounters[style, variation] < 300 || Main.rand.Next(60) != 0) break; frameCounters[style, variation] = 0; frames[style, variation] = Main.rand.NextFromList(1, 5, 9); break; case 1: case 5: case 9: if (frameCounters[style, variation] >= 100) { frameCounters[style, variation] = 0; if (frames[style, variation] == 1) { frames[style, variation] = Main.rand.NextFromList(0, 5, 5, 9, 9); break; } frames[style, variation] = 1; break; } if (frameCounters[style, variation] < 6) break; frameCounters[style, variation] = 0; ++frames[style, variation]; break; case 2: case 3: case 4: case 6: case 7: case 8: case 10: case 11: case 12: int num1 = frames[style, variation] - 1; int num2 = num1 % 4 - 1; int num3 = frameCounters[style, variation] / 4 % 4; if (num3 > 2) num3 = 4 - num3; int num4 = num1 - num2 + 1 + num3; frames[style, variation] = num4; if (frameCounters[style, variation] < 40 || Main.rand.Next(30) != 0) break; frameCounters[style, variation] = 100; frames[style, variation] = num1 - num2 + 1 - 1; break; } } public static void DoUpdate_AnimateItemIcons() { for (int index1 = 0; index1 < Main.itemAnimationsRegistered.Count; ++index1) { int index2 = Main.itemAnimationsRegistered[index1]; if (Main.itemAnimations[index2] != null) Main.itemAnimations[index2].Update(); } } public static void QueueMainThreadAction(Action action) => Main._mainThreadActions.Enqueue(action); private static void ConsumeAllMainThreadActions() { Action result; while (Main._mainThreadActions.TryDequeue(out result)) result(); } protected override void Update(GameTime gameTime) { if (!Main.IsEnginePreloaded) { Main.IsEnginePreloaded = true; if (Main.OnEnginePreload != null) Main.OnEnginePreload(); } if (!this._isDrawingOrUpdating) { this._isDrawingOrUpdating = true; this.DoUpdate(gameTime); CinematicManager.Instance.Update(gameTime); switch (Main.netMode) { case 1: Netplay.Connection.Socket.SendQueuedPackets(); break; case 2: for (int index = 0; index < 256; ++index) { if (Netplay.Clients[index].Socket != null) Netplay.Clients[index].Socket.SendQueuedPackets(); } break; } this._isDrawingOrUpdating = false; } Main.ConsumeAllMainThreadActions(); if (!Main._WeGameReqExit) return; this.QuitGame(); } public void UpdateViewZoomKeys() { if (Main.inFancyUI) return; float num = 0.01f; if (PlayerInput.Triggers.Current.ViewZoomIn) Main.GameZoomTarget = Utils.Clamp(Main.GameZoomTarget + num, 1f, 2f); if (!PlayerInput.Triggers.Current.ViewZoomOut) return; Main.GameZoomTarget = Utils.Clamp(Main.GameZoomTarget - num, 1f, 2f); } public static void NotifyOfEvent(GameNotificationType type) { if (Main.instance.IsActive || !Main._flashNotificationType.HasFlag((Enum) type)) return; Main.QueueMainThreadAction((Action) (() => Platform.Get().StartFlashingIcon(Main.instance.Window))); } protected void DoUpdate(GameTime gameTime) { Main.gameTimeCache = gameTime; if (Main.showSplash) { this.UpdateAudio(); } else { PartySky.MultipleSkyWorkaroundFix = true; Main.LocalPlayer.cursorItemIconReversed = false; TimeSpan timeSpan; if (!Main.GlobalTimerPaused) { timeSpan = gameTime.TotalGameTime; Main.GlobalTimeWrappedHourly = (float) (timeSpan.TotalSeconds % 3600.0); } Main._overrideForExpertMode = new bool?(); Main._overrideForMasterMode = new bool?(); if (!Main.gameMenu && Main._currentGameModeInfo.IsJourneyMode) { CreativePowers.DifficultySliderPower power = CreativePowerManager.Instance.GetPower(); if (power.GetIsUnlocked()) { if ((double) power.StrengthMultiplierToGiveNPCs >= 2.0) Main._overrideForExpertMode = new bool?(true); if ((double) power.StrengthMultiplierToGiveNPCs >= 3.0) Main._overrideForMasterMode = new bool?(true); } } Main.UpdateWorldPreparationState(); if (Player.BlockInteractionWithProjectiles > 0 && !Main.mouseRight && Main.mouseRightRelease) --Player.BlockInteractionWithProjectiles; PlayerInput.SetZoom_UI(); if (!Main.gameMenu || Main.menuMode != 888) Main.MenuUI.SetState((UIState) null); else Main.InGameUI.SetState((UIState) null); Main.CurrentInputTextTakerOverride = (object) null; Main.AchievementAdvisor.Update(); PlayerInput.SetZoom_Unscaled(); Main.MouseOversTryToClear(); PlayerInput.ResetInputsOnActiveStateChange(); if (Main.OnTickForThirdPartySoftwareOnly != null) Main.OnTickForThirdPartySoftwareOnly(); if (Main._hasPendingNetmodeChange) { Main.netMode = Main._targetNetMode; Main._hasPendingNetmodeChange = false; } if (CaptureManager.Instance.IsCapturing) return; if (Main.ActivePlayerFileData != null) Main.ActivePlayerFileData.UpdatePlayTimer(); Netplay.Update(); Main.gameInactive = !this.IsActive; if (Main.changeTheTitle) { Main.changeTheTitle = false; this.SetTitle(); } this._worldUpdateTimeTester.Restart(); if (!WorldGen.gen) WorldGen.destroyObject = false; if (Main.gameMenu) Main.mapFullscreen = false; Main.UpdateSettingUnlocks(); if (Main.dedServ) { if (Main.dedServFPS) { ++Main.updatesCountedForFPS; if (!Main.fpsTimer.IsRunning) Main.fpsTimer.Restart(); if (Main.fpsTimer.ElapsedMilliseconds >= 1000L) { Main.dedServCount1 += Main.updatesCountedForFPS; ++Main.dedServCount2; float num = (float) Main.dedServCount1 / (float) Main.dedServCount2; Console.WriteLine(Main.updatesCountedForFPS.ToString() + " (" + (object) num + ")"); Main.updatesCountedForFPS = 0; Main.fpsTimer.Restart(); } } else { if (Main.fpsTimer.IsRunning) Main.fpsTimer.Stop(); Main.updatesCountedForFPS = 0; } } Main.DoUpdate_AutoSave(); if (!Main.dedServ) { Main.Chroma.Update(Main.GlobalTimeWrappedHourly); if (Main.superFast) { this.IsFixedTimeStep = false; Main.graphics.SynchronizeWithVerticalRetrace = false; } else { if (Main.FrameSkipMode == 0 || Main.FrameSkipMode == 2) { if (this.IsActive) this.IsFixedTimeStep = false; else this.IsFixedTimeStep = true; } else { this.IsFixedTimeStep = true; Main.graphics.SynchronizeWithVerticalRetrace = true; } Main.graphics.SynchronizeWithVerticalRetrace = true; } if (Main.showSplash) return; ++Main.updatesCountedForFPS; if (Main.fpsTimer.ElapsedMilliseconds >= 1000L) { if ((double) Main.fpsCount >= 30.0 + 30.0 * (double) Main.gfxQuality) { Main.gfxQuality += Main.gfxRate; Main.gfxRate += 0.005f; } else if ((double) Main.fpsCount < 29.0 + 30.0 * (double) Main.gfxQuality) { Main.gfxRate = 0.01f; Main.gfxQuality -= 0.1f; } if ((double) Main.gfxQuality < 0.0) Main.gfxQuality = 0.0f; if ((double) Main.gfxQuality > 1.0) Main.gfxQuality = 1f; if (Main.maxQ && this.IsActive) { Main.gfxQuality = 1f; Main.maxQ = false; } Main.updateRate = Main.uCount; Main.frameRate = Main.fpsCount; Main.fpsCount = 0; Main.fpsTimer.Restart(); Main.updatesCountedForFPS = 0; Main.drawsCountedForFPS = 0; Main.uCount = 0; Main.mapTimeMax = (double) Main.gfxQuality >= 0.800000011920929 ? 0 : (int) ((1.0 - (double) Main.gfxQuality) * 60.0); } if (Main.FrameSkipMode == 0 || Main.FrameSkipMode == 2) { double updateTimeAccumulator = Main.UpdateTimeAccumulator; timeSpan = gameTime.ElapsedGameTime; double totalSeconds = timeSpan.TotalSeconds; Main.UpdateTimeAccumulator = updateTimeAccumulator + totalSeconds; if (Main.UpdateTimeAccumulator < 0.0166666675359011 && !Main.superFast) { if (Main.FrameSkipMode != 2) return; Main.instance.SuppressDraw(); return; } gameTime = new GameTime(gameTime.TotalGameTime, new TimeSpan(166666L)); Main.UpdateTimeAccumulator -= 0.0166666675359011; Main.UpdateTimeAccumulator = Math.Min(Main.UpdateTimeAccumulator, 0.0166666675359011); } ++Main.uCount; Main.drawSkip = false; PlayerInput.SetZoom_UI(); Main.UpdateUIStates(gameTime); PlayerInput.SetZoom_Unscaled(); Terraria.Graphics.Effects.Filters.Scene.Update(gameTime); Overlays.Scene.Update(gameTime); LiquidRenderer.Instance.Update(gameTime); this.UpdateAudio(); InGameNotificationsTracker.Update(); ItemSlot.UpdateInterface(); if (Main.teamCooldown > 0) --Main.teamCooldown; Main.DoUpdate_AnimateBackgrounds(); Animation.UpdateAll(); switch (Main.qaStyle) { case 1: Main.gfxQuality = 1f; break; case 2: Main.gfxQuality = 0.5f; break; case 3: Main.gfxQuality = 0.0f; break; } Main.maxDustToDraw = (int) (6000.0 * ((double) Main.gfxQuality * 0.699999988079071 + 0.300000011920929)); if ((double) Main.gfxQuality < 0.9) Main.maxDustToDraw = (int) ((double) Main.maxDustToDraw * (double) Main.gfxQuality); if (Main.maxDustToDraw < 1000) Main.maxDustToDraw = 1000; Gore.goreTime = (int) (600.0 * (double) Main.gfxQuality); if (!WorldGen.gen) { Terraria.Liquid.cycles = (int) (17.0 - 10.0 * (double) Main.gfxQuality); Terraria.Liquid.curMaxLiquid = (int) ((double) Terraria.Liquid.maxLiquid * 0.25 + (double) Terraria.Liquid.maxLiquid * 0.75 * (double) Main.gfxQuality); if (Main.Setting_UseReducedMaxLiquids) Terraria.Liquid.curMaxLiquid = (int) (2500.0 + 2500.0 * (double) Main.gfxQuality); } if (Main.superFast) { Main.graphics.SynchronizeWithVerticalRetrace = false; Main.drawSkip = false; } LegacyLighting.RenderPhases = (double) Main.gfxQuality >= 0.2 ? ((double) Main.gfxQuality >= 0.4 ? ((double) Main.gfxQuality >= 0.6 ? ((double) Main.gfxQuality >= 0.8 ? 4 : 5) : 6) : 7) : 8; if (!WorldGen.gen && Terraria.Liquid.quickSettle) { Terraria.Liquid.curMaxLiquid = Terraria.Liquid.maxLiquid; if (Main.Setting_UseReducedMaxLiquids) Terraria.Liquid.curMaxLiquid = 5000; Terraria.Liquid.cycles = 1; } if (WorldGen.drunkWorldGen) { if (!Main.gameMenu) { WorldGen.drunkWorldGen = false; this.logoRotation = 0.0f; this.logoRotationSpeed = 0.0f; this.logoScale = 1f; } } else if (Main.gameMenu && (double) Math.Abs(this.logoRotationSpeed) > 1000.0) { this.logoRotation = 0.0f; this.logoRotationSpeed = 0.0f; this.logoScale = 1f; } Main.UpdateOldNPCShop(); Main.hasFocus = this.IsActive; Main.hasFocus |= Form.ActiveForm == Control.FromHandle(this.Window.Handle) as Form; if (!this.IsActive && Main.netMode == 0) { if (!Platform.IsOSX) this.IsMouseVisible = true; if (Main.netMode != 2 && Main.myPlayer >= 0) Main.player[Main.myPlayer].delayUseItem = true; Main.mouseLeftRelease = false; Main.mouseRightRelease = false; if (Main.gameMenu) Main.UpdateMenu(); Main.gamePaused = true; return; } if (!Platform.IsOSX) this.IsMouseVisible = false; SkyManager.Instance.Update(gameTime); if (!Main.gamePaused) EmoteBubble.UpdateAll(); ScreenObstruction.Update(); ScreenDarkness.Update(); MoonlordDeathDrama.Update(); Main.DoUpdate_AnimateCursorColors(); Main.DoUpdate_AnimateTileGlows(); this.DoUpdate_AnimateDiscoRGB(); Main.DoUpdate_AnimateVisualPlayerAura(); this.DoUpdate_AnimateWaterfalls(); Main.DoUpdate_AnimateWalls(); Main.AnimateTiles(); Main.DoUpdate_AnimateItemIcons(); Main.DoUpdate_F10_ToggleFPS(); Main.DoUpdate_F9_ToggleLighting(); Main.DoUpdate_F8_ToggleNetDiagnostics(); Main.DoUpdate_F7_ToggleGraphicsDiagnostics(); Main.DoUpdate_F11_ToggleUI(); Main.DoUpdate_AltEnter_ToggleFullscreen(); this.DoUpdate_HandleInput(); Main.DoUpdate_HandleChat(); Main.DoUpdate_Enter_ToggleChat(); if (Main.gameMenu) { Main.UpdateMenu(); if (Main.netMode != 2) return; Main.gamePaused = false; } Main.CheckInvasionProgressDisplay(); } this.UpdateWindyDayState(); if (Main.netMode == 2) Main.cloudAlpha = Main.maxRaining; bool isActive = this.IsActive; if (Main.netMode == 1) Main.TrySyncingMyPlayer(); if (Main.CanPauseGame()) { Main.DoUpdate_WhilePaused(); Main.gamePaused = true; } else { Main.gamePaused = false; if (Main.OnTickForInternalCodeOnly != null) Main.OnTickForInternalCodeOnly(); if (Main.netMode != 1 && !Main.gameMenu && !Main.gamePaused && Main.AmbienceServer != null) Main.AmbienceServer.Update(); WorldGen.BackgroundsCache.UpdateFlashValues(); if (Main.LocalGolfState != null) Main.LocalGolfState.Update(); if ((isActive || Main.netMode == 1) && (double) Main.cloudAlpha > 0.0) Rain.MakeRain(); if (Main.netMode != 1) this.updateCloudLayer(); for (int index = 0; index < Main.dayRate; ++index) this.UpdateWeather(gameTime); if (++Main.timeForVisualEffects >= 216000.0) Main.timeForVisualEffects = 0.0; Main.UnpausedUpdateSeed = Utils.RandomNextSeed(Main.UnpausedUpdateSeed); Main.Ambience(); if (Main.netMode != 2) { try { Main.snowing(); } catch { if (!Main.ignoreErrors) throw; } Sandstorm.EmitDust(); } if (!Main.dedServ && (double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0 && Main.netMode != 2) { Star.UpdateStars(); Cloud.UpdateClouds(); } PortalHelper.UpdatePortalPoints(); if (this.ShouldUpdateEntities()) this.DoUpdateInWorld(this._worldUpdateTimeTester); if (Main.netMode != 2) Main.ChromaPainter.Update(); base.Update(gameTime); } } } private static bool CanPauseGame() { bool flag = false; if (Main.netMode == 0) flag = ((flag | Main.ingameOptionsWindow ? 1 : 0) | (!Main.autoPause ? 0 : (Main.playerInventory || Main.LocalPlayer.sign >= 0 ? 1 : (Main.InGameUI.IsVisible ? 1 : 0)))) != 0; return flag; } private static void DoUpdate_WhilePaused() { if (!Main.drawingPlayerChat && !Main.editSign && !Main.editChest && !Main.blockInput) { Main.player[Main.myPlayer].controlInv = PlayerInput.Triggers.Current.Inventory; if (Main.player[Main.myPlayer].controlInv) { if (Main.player[Main.myPlayer].releaseInventory) Main.player[Main.myPlayer].ToggleInv(); Main.player[Main.myPlayer].releaseInventory = false; } else Main.player[Main.myPlayer].releaseInventory = true; } if (Main.playerInventory) { Recipe.GetThroughDelayedFindRecipes(); int num1 = PlayerInput.ScrollWheelDelta / 120; bool flag = true; if (Main.recBigList) { int num2 = 42; int y = 340; int x = 310; PlayerInput.SetZoom_UI(); int num3 = (Main.screenWidth - x - 280) / num2; int num4 = (Main.screenHeight - y - 20) / num2; if (new Microsoft.Xna.Framework.Rectangle(x, y, num3 * num2, num4 * num2).Contains(Main.MouseScreen.ToPoint())) { int num5 = Math.Sign(num1); for (; num1 != 0; num1 -= num5) { if (num1 < 0) { Main.recStart -= num3; if (Main.recStart < 0) Main.recStart = 0; } else { Main.recStart += num3; SoundEngine.PlaySound(12); if (Main.recStart > Main.numAvailableRecipes - num3) Main.recStart = Main.numAvailableRecipes - num3; } } } PlayerInput.SetZoom_World(); } if (flag) { Main.focusRecipe += num1; if (Main.focusRecipe > Main.numAvailableRecipes - 1) Main.focusRecipe = Main.numAvailableRecipes - 1; if (Main.focusRecipe < 0) Main.focusRecipe = 0; } Main.player[Main.myPlayer].dropItemCheck(); } Main.player[Main.myPlayer].head = Main.player[Main.myPlayer].armor[0].headSlot; Main.player[Main.myPlayer].body = Main.player[Main.myPlayer].armor[1].bodySlot; Main.player[Main.myPlayer].legs = Main.player[Main.myPlayer].armor[2].legSlot; if (!Main.player[Main.myPlayer].hostile) { if (Main.player[Main.myPlayer].armor[10].headSlot >= 0) Main.player[Main.myPlayer].head = Main.player[Main.myPlayer].armor[10].headSlot; if (Main.player[Main.myPlayer].armor[11].bodySlot >= 0) Main.player[Main.myPlayer].body = Main.player[Main.myPlayer].armor[11].bodySlot; if (Main.player[Main.myPlayer].armor[12].legSlot >= 0) Main.player[Main.myPlayer].legs = Main.player[Main.myPlayer].armor[12].legSlot; } if (Main.editSign) { if (Main.player[Main.myPlayer].sign == -1) Main.editSign = false; else Main.InputTextSign(); } else if (Main.editChest && Main.player[Main.myPlayer].chest == -1) Main.editChest = false; Player.tileTargetX = (int) (((double) Main.mouseX + (double) Main.screenPosition.X) / 16.0); Player.tileTargetY = (int) (((double) Main.mouseY + (double) Main.screenPosition.Y) / 16.0); Main.player[Main.myPlayer].LookForTileInteractions(); Main.player[Main.myPlayer].lastChest = Main.player[Main.myPlayer].chest; if (!Main.playerInventory) return; Main.player[Main.myPlayer].AdjTiles(); } private static void UpdateUIStates(GameTime gameTime) { if (Main.MenuUI != null) Main.MenuUI.Update(gameTime); if (Main.InGameUI != null) Main.InGameUI.Update(gameTime); Main.CreativeMenu.Update(gameTime); Main.BigBossProgressBar.Update(); } private void DoDebugFunctions() { } private void PreUpdateAllProjectiles() { this.SpelunkerProjectileHelper.OnPreUpdateAllProjectiles(); this.ChumBucketProjectileHelper.OnPreUpdateAllProjectiles(); } private void PostUpdateAllProjectiles() { } private static void TrySyncingMyPlayer() { Player clientPlayer = Main.clientPlayer; bool flag1 = false; for (int index = 0; index < 59; ++index) { if (Main.player[Main.myPlayer].inventory[index].IsNotTheSameAs(clientPlayer.inventory[index])) { flag1 = true; NetMessage.SendData(5, number: Main.myPlayer, number2: ((float) index), number3: ((float) Main.player[Main.myPlayer].inventory[index].prefix)); } } for (int index = 0; index < Main.player[Main.myPlayer].armor.Length; ++index) { if (Main.player[Main.myPlayer].armor[index].IsNotTheSameAs(clientPlayer.armor[index])) { flag1 = true; NetMessage.SendData(5, number: Main.myPlayer, number2: ((float) (59 + index)), number3: ((float) Main.player[Main.myPlayer].armor[index].prefix)); } } for (int index = 0; index < Main.player[Main.myPlayer].miscEquips.Length; ++index) { if (Main.player[Main.myPlayer].miscEquips[index].IsNotTheSameAs(clientPlayer.miscEquips[index])) { flag1 = true; NetMessage.SendData(5, number: Main.myPlayer, number2: ((float) (58 + Main.player[Main.myPlayer].armor.Length + Main.player[Main.myPlayer].dye.Length + 1 + index)), number3: ((float) Main.player[Main.myPlayer].miscEquips[index].prefix)); } } for (int index = 0; index < Main.player[Main.myPlayer].miscDyes.Length; ++index) { if (Main.player[Main.myPlayer].miscDyes[index].IsNotTheSameAs(clientPlayer.miscDyes[index])) { flag1 = true; NetMessage.SendData(5, number: Main.myPlayer, number2: ((float) (58 + Main.player[Main.myPlayer].armor.Length + Main.player[Main.myPlayer].dye.Length + Main.player[Main.myPlayer].miscEquips.Length + 1 + index)), number3: ((float) Main.player[Main.myPlayer].miscDyes[index].prefix)); } } for (int index = 0; index < Main.player[Main.myPlayer].bank.item.Length; ++index) { if (Main.player[Main.myPlayer].bank.item[index].IsNotTheSameAs(clientPlayer.bank.item[index])) { flag1 = true; NetMessage.SendData(5, number: Main.myPlayer, number2: ((float) (58 + Main.player[Main.myPlayer].armor.Length + Main.player[Main.myPlayer].dye.Length + Main.player[Main.myPlayer].miscEquips.Length + Main.player[Main.myPlayer].miscDyes.Length + 1 + index)), number3: ((float) Main.player[Main.myPlayer].bank.item[index].prefix)); } } for (int index = 0; index < Main.player[Main.myPlayer].bank2.item.Length; ++index) { if (Main.player[Main.myPlayer].bank2.item[index].IsNotTheSameAs(clientPlayer.bank2.item[index])) { flag1 = true; NetMessage.SendData(5, number: Main.myPlayer, number2: ((float) (58 + Main.player[Main.myPlayer].armor.Length + Main.player[Main.myPlayer].dye.Length + Main.player[Main.myPlayer].miscEquips.Length + Main.player[Main.myPlayer].miscDyes.Length + Main.player[Main.myPlayer].bank.item.Length + 1 + index)), number3: ((float) Main.player[Main.myPlayer].bank2.item[index].prefix)); } } if (Main.player[Main.myPlayer].trashItem.IsNotTheSameAs(clientPlayer.trashItem)) { flag1 = true; NetMessage.SendData(5, number: Main.myPlayer, number2: ((float) (58 + Main.player[Main.myPlayer].armor.Length + Main.player[Main.myPlayer].dye.Length + Main.player[Main.myPlayer].miscEquips.Length + Main.player[Main.myPlayer].miscDyes.Length + Main.player[Main.myPlayer].bank.item.Length + Main.player[Main.myPlayer].bank2.item.Length + 1)), number3: ((float) Main.player[Main.myPlayer].trashItem.prefix)); } for (int index = 0; index < Main.player[Main.myPlayer].bank3.item.Length; ++index) { if (Main.player[Main.myPlayer].bank3.item[index].IsNotTheSameAs(clientPlayer.bank3.item[index])) { flag1 = true; NetMessage.SendData(5, number: Main.myPlayer, number2: ((float) (58 + Main.player[Main.myPlayer].armor.Length + Main.player[Main.myPlayer].dye.Length + Main.player[Main.myPlayer].miscEquips.Length + Main.player[Main.myPlayer].miscDyes.Length + Main.player[Main.myPlayer].bank.item.Length + Main.player[Main.myPlayer].bank2.item.Length + 2 + index)), number3: ((float) Main.player[Main.myPlayer].bank3.item[index].prefix)); } } for (int index = 0; index < Main.player[Main.myPlayer].bank4.item.Length; ++index) { if (Main.player[Main.myPlayer].bank4.item[index].IsNotTheSameAs(clientPlayer.bank4.item[index])) { flag1 = true; NetMessage.SendData(5, number: Main.myPlayer, number2: ((float) (58 + Main.player[Main.myPlayer].armor.Length + Main.player[Main.myPlayer].dye.Length + Main.player[Main.myPlayer].miscEquips.Length + Main.player[Main.myPlayer].miscDyes.Length + Main.player[Main.myPlayer].bank.item.Length + Main.player[Main.myPlayer].bank2.item.Length + Main.player[Main.myPlayer].bank3.item.Length + 2 + index)), number3: ((float) Main.player[Main.myPlayer].bank4.item[index].prefix)); } } for (int index = 0; index < Main.player[Main.myPlayer].dye.Length; ++index) { if (Main.player[Main.myPlayer].dye[index].IsNotTheSameAs(clientPlayer.dye[index])) { flag1 = true; NetMessage.SendData(5, number: Main.myPlayer, number2: ((float) (58 + Main.player[Main.myPlayer].armor.Length + 1 + index)), number3: ((float) Main.player[Main.myPlayer].dye[index].prefix)); } } if (Main.player[Main.myPlayer].chest != clientPlayer.chest && Main.player[Main.myPlayer].chest < 0 && clientPlayer.chest >= 0) { if (Main.player[Main.myPlayer].editedChestName) { if (Main.chest[clientPlayer.chest] != null) NetMessage.SendData(33, text: NetworkText.FromLiteral(Main.chest[clientPlayer.chest].name), number: Main.player[Main.myPlayer].chest, number2: 1f); else NetMessage.SendData(33, number: Main.player[Main.myPlayer].chest); Main.player[Main.myPlayer].editedChestName = false; } else NetMessage.SendData(33, number: Main.player[Main.myPlayer].chest); } if (Main.player[Main.myPlayer].talkNPC != clientPlayer.talkNPC) NetMessage.SendData(40, number: Main.myPlayer); if (Main.LocalPlayer.tileEntityAnchor.interactEntityID != clientPlayer.tileEntityAnchor.interactEntityID && Main.LocalPlayer.tileEntityAnchor.interactEntityID < 0) NetMessage.SendData(122, number: -1, number2: ((float) Main.myPlayer)); bool flag2 = false; if ((int) (byte) Main.player[Main.myPlayer].zone1 != (int) (byte) clientPlayer.zone1) flag2 = true; if ((int) (byte) Main.player[Main.myPlayer].zone2 != (int) (byte) clientPlayer.zone2) flag2 = true; if ((int) (byte) Main.player[Main.myPlayer].zone3 != (int) (byte) clientPlayer.zone3) flag2 = true; if ((int) (byte) Main.player[Main.myPlayer].zone4 != (int) (byte) clientPlayer.zone4) flag2 = true; if (flag2) NetMessage.SendData(36, number: Main.myPlayer); if (Main.player[Main.myPlayer].statLife != clientPlayer.statLife || Main.player[Main.myPlayer].statLifeMax != clientPlayer.statLifeMax) Main.player[Main.myPlayer].netLife = true; if (Main.player[Main.myPlayer].netLifeTime > 0) --Main.player[Main.myPlayer].netLifeTime; else if (Main.player[Main.myPlayer].netLife) { Main.player[Main.myPlayer].netLife = false; Main.player[Main.myPlayer].netLifeTime = 60; NetMessage.SendData(16, number: Main.myPlayer); } if (Main.player[Main.myPlayer].statMana != clientPlayer.statMana || Main.player[Main.myPlayer].statManaMax != clientPlayer.statManaMax) Main.player[Main.myPlayer].netMana = true; if (Main.player[Main.myPlayer].netManaTime > 0) --Main.player[Main.myPlayer].netManaTime; else if (Main.player[Main.myPlayer].netMana) { Main.player[Main.myPlayer].netMana = false; Main.player[Main.myPlayer].netManaTime = 60; NetMessage.SendData(42, number: Main.myPlayer); } bool flag3 = false; for (int index = 0; index < 22; ++index) { if (Main.player[Main.myPlayer].buffType[index] != clientPlayer.buffType[index]) flag3 = true; } if (flag3) { NetMessage.SendData(50, number: Main.myPlayer); NetMessage.SendData(13, number: Main.myPlayer); } bool flag4 = false; if (Main.player[Main.myPlayer].MinionRestTargetPoint != clientPlayer.MinionRestTargetPoint) flag4 = true; if (flag4) NetMessage.SendData(99, number: Main.myPlayer); bool flag5 = false; if (Main.player[Main.myPlayer].MinionAttackTargetNPC != clientPlayer.MinionAttackTargetNPC) flag5 = true; if (flag5) NetMessage.SendData(115, number: Main.myPlayer); if (clientPlayer.shieldRaised != Main.player[Main.myPlayer].shieldRaised) NetMessage.SendData(13, number: Main.myPlayer); if (flag1) NetMessage.SendData(138); Main.clientPlayer = (Player) Main.player[Main.myPlayer].clientClone(); } public bool ShouldUpdateEntities() => Main._worldPreparationState == Main.WorldPreparationState.Ready; private void DoUpdateInWorld(Stopwatch sw) { this.UpdateParticleSystems(); Main.tileSolid[379] = false; int num1 = 0; int num2 = 0; Main.sittingManager.ClearPlayerAnchors(); Main.sleepingManager.ClearPlayerAnchors(); for (int i = 0; i < (int) byte.MaxValue; ++i) { try { Main.player[i].Update(i); if (Main.player[i].active) { ++num1; if (Main.player[i].sleeping.FullyFallenAsleep) ++num2; } } catch { if (!Main.ignoreErrors) throw; } } Main.CurrentFrameFlags.ActivePlayersCount = num1; Main.CurrentFrameFlags.SleepingPlayersCount = num2; if (Main.netMode != 2) { int player = Main.myPlayer; if (Main.player[player].creativeGodMode) { Main.player[player].statLife = Main.player[player].statLifeMax2; Main.player[player].statMana = Main.player[player].statManaMax2; Main.player[player].breath = Main.player[player].breathMax; } } ++Main._gameUpdateCount; NPC.RevengeManager.Update(); if (Main.netMode != 1) { try { NPC.SpawnNPC(); } catch { } } if (Main.netMode != 1) PressurePlateHelper.Update(); for (int index = 0; index < (int) byte.MaxValue; ++index) { Main.player[index].nearbyActiveNPCs = 0.0f; Main.player[index].townNPCs = 0.0f; } Main.CheckBossIndexes(); Main.sittingManager.ClearNPCAnchors(); Main.sleepingManager.ClearNPCAnchors(); NPC.taxCollector = false; NPC.ClearFoundActiveNPCs(); NPC.UpdateFoundActiveNPCs(); FixExploitManEaters.Update(); if (Main.netMode != 1) Main.BestiaryTracker.Sights.ScanWorldForFinds(); bool flag = false; if (NPC.offSetDelayTime > 0) --NPC.offSetDelayTime; for (int i = 0; i < 200; ++i) { if (Main.ignoreErrors) { try { Main.npc[i].UpdateNPC(i); if (Main.npc[i].active) { if (!Main.npc[i].boss) { if (!NPCID.Sets.DangerThatPreventsOtherDangers[Main.npc[i].type]) continue; } flag = true; } } catch (Exception ex) { Main.npc[i] = new NPC(); } } else Main.npc[i].UpdateNPC(i); } Main.CurrentFrameFlags.AnyActiveBossNPC = flag; for (int index = 0; index < 600; ++index) { if (Main.ignoreErrors) { try { Main.gore[index].Update(); } catch { Main.gore[index] = new Gore(); } } else Main.gore[index].Update(); } LockOnHelper.SetUP(); Main.CurrentFrameFlags.HadAnActiveInteractibleProjectile = false; this.PreUpdateAllProjectiles(); for (int i = 0; i < 1000; ++i) { Main.ProjectileUpdateLoopIndex = i; if (Main.ignoreErrors) { try { Main.projectile[i].Update(i); } catch { Main.projectile[i] = new Projectile(); } } else Main.projectile[i].Update(i); } Main.ProjectileUpdateLoopIndex = -1; this.PostUpdateAllProjectiles(); LockOnHelper.SetDOWN(); Item.numberOfNewItems = 0; for (int i = 0; i < 400; ++i) { if (Main.ignoreErrors) { try { Main.item[i].UpdateItem(i); } catch { Main.item[i] = new Item(); } } else Main.item[i].UpdateItem(i); } if (Main.ignoreErrors) { try { Dust.UpdateDust(); } catch { for (int index = 0; index < 6000; ++index) { Main.dust[index] = new Dust(); Main.dust[index].dustIndex = index; } } } else Dust.UpdateDust(); if (Main.netMode != 2) { CombatText.UpdateCombatText(); PopupText.UpdateItemText(); } if (Main.ignoreErrors) { try { Main.UpdateTime(); } catch { Main.checkForSpawns = 0; } } else Main.UpdateTime(); Main.tileSolid[379] = true; if (Main.gameMenu && Main.netMode != 2) return; if (Main.netMode != 1) { if (Main.ignoreErrors) { try { WorldGen.UpdateWorld(); Main.UpdateInvasion(); } catch { } } else { WorldGen.UpdateWorld(); Main.UpdateInvasion(); } } if (Main.ignoreErrors) { try { if (Main.netMode == 2) Main.UpdateServer(); if (Main.netMode == 1) Main.UpdateClient(); } catch { int netMode = Main.netMode; } } else { if (Main.netMode == 2) Main.UpdateServer(); if (Main.netMode == 1) Main.UpdateClient(); } Main.chatMonitor.Update(); Main.upTimer = (float) sw.Elapsed.TotalMilliseconds; if ((double) Main.upTimerMaxDelay > 0.0) --Main.upTimerMaxDelay; else Main.upTimerMax = 0.0f; if ((double) Main.upTimer > (double) Main.upTimerMax) { Main.upTimerMax = Main.upTimer; Main.upTimerMaxDelay = 400f; } Chest.UpdateChestFrames(); this._ambientWindSys.Update(); this.TilesRenderer.Update(); if ((double) Main.cameraLerp <= 0.0) return; ++Main.cameraLerpTimer; if (Main.cameraLerpTimer >= Main.cameraLerpTimeToggle) Main.cameraLerp += (float) ((Main.cameraLerpTimer - Main.cameraLerpTimeToggle) / 3 + 1) * (1f / 1000f); if ((double) Main.cameraLerp <= 1.0) return; Main.cameraLerp = 1f; } private static void CheckBossIndexes() { if (!Main.IsNPCActiveAndOneOfTypes(Main.wofNPCIndex, 113)) Main.wofNPCIndex = -1; if (!Main.IsNPCActiveAndOneOfTypes(NPC.golemBoss, 245)) NPC.golemBoss = -1; if (!Main.IsNPCActiveAndOneOfTypes(NPC.plantBoss, 262)) NPC.plantBoss = -1; if (Main.IsNPCActiveAndOneOfTypes(NPC.crimsonBoss, 266)) return; NPC.crimsonBoss = -1; } private static bool IsNPCActiveAndOneOfTypes(int npcIndex, params int[] types) { if (npcIndex < 0) return false; NPC npc = Main.npc[npcIndex]; if (!npc.active) return false; for (int index = 0; index < types.Length; ++index) { if (npc.type == types[index]) return true; } return false; } private static void UpdateOldNPCShop() { if (Main.npcShop == Main.oldNPCShop) return; Main.oldNPCShop = Main.npcShop; Main.shopSellbackHelper.Clear(); } private static void DoUpdate_AnimateCursorColors() { Main.CursorColor(); Main.mouseTextColor += (byte) Main.mouseTextColorChange; if (Main.mouseTextColor >= byte.MaxValue) Main.mouseTextColorChange = -1; if (Main.mouseTextColor <= (byte) 190) Main.mouseTextColorChange = 1; Main.masterColor += (float) Main.masterColorDir * 0.05f; if ((double) Main.masterColor > 1.0) { Main.masterColor = 1f; Main.masterColorDir = -1; } if ((double) Main.masterColor >= 0.0) return; Main.masterColor = 0.0f; Main.masterColorDir = 1; } private static void DoUpdate_AnimateTileGlows() { Main.demonTorch += (float) Main.demonTorchDir * 0.01f; if ((double) Main.demonTorch > 1.0) { Main.demonTorch = 1f; Main.demonTorchDir = -1; } if ((double) Main.demonTorch < 0.0) { Main.demonTorch = 0.0f; Main.demonTorchDir = 1; } Main.martianLight += (float) Main.martianLightDir * 0.015f; if ((double) Main.martianLight > 1.0) { Main.martianLight = 1f; Main.martianLightDir = -1; } if ((double) Main.martianLight >= 0.0) return; Main.martianLight = 0.0f; Main.martianLightDir = 1; } private static void DoUpdate_Enter_ToggleChat() { if (((!Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Enter) ? 0 : (Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftAlt) ? 0 : (!Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.RightAlt) ? 1 : 0))) == 0 ? 0 : (Main.hasFocus ? 1 : 0)) != 0) { if (Main.chatRelease && !Main.drawingPlayerChat && !Main.editSign && !Main.editChest && !Main.gameMenu && !Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Escape)) { SoundEngine.PlaySound(10); Main.OpenPlayerChat(); Main.chatText = ""; } Main.chatRelease = false; } else Main.chatRelease = true; } public static void OpenPlayerChat() { if (Main.CurrentInputTextTakerOverride != null) return; Main.drawingPlayerChat = true; Main.clrInput(); } public static void ClosePlayerChat() { Main.drawingPlayerChat = false; PlayerInput.WritingText = true; Main.player[Main.myPlayer].releaseHook = false; Main.player[Main.myPlayer].releaseThrow = false; } private static void DoUpdate_HandleChat() { if (Main.CurrentInputTextTakerOverride != null) { Main.drawingPlayerChat = false; } else { if (Main.editSign) Main.drawingPlayerChat = false; if (PlayerInput.UsingGamepad) Main.drawingPlayerChat = false; if (!Main.drawingPlayerChat) { Main.chatMonitor.ResetOffset(); } else { int linesOffset = 0; if (Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Up)) linesOffset = 1; else if (Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Down)) linesOffset = -1; Main.chatMonitor.Offset(linesOffset); if (Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Escape)) Main.drawingPlayerChat = false; string chatText = Main.chatText; Main.chatText = Main.GetInputText(Main.chatText); int num1 = (int) ((double) Main.screenWidth * (1.0 / (double) Main.UIScale)) - 330; if (chatText != Main.chatText) { for (float x = ChatManager.GetStringSize(FontAssets.MouseText.Value, Main.chatText, Vector2.One).X; (double) x > (double) num1; x = ChatManager.GetStringSize(FontAssets.MouseText.Value, Main.chatText, Vector2.One).X) { int num2 = Math.Max(0, (int) ((double) x - (double) num1) / 100); Main.chatText = Main.chatText.Substring(0, Main.chatText.Length - 1 - num2); } } if (chatText != Main.chatText) SoundEngine.PlaySound(12); if (!Main.inputTextEnter || !Main.chatRelease) return; if (Main.chatText != "") { ChatMessage outgoingMessage = ChatManager.Commands.CreateOutgoingMessage(Main.chatText); switch (Main.netMode) { case 0: ChatManager.Commands.ProcessIncomingMessage(outgoingMessage, Main.myPlayer); break; case 1: ChatHelper.SendChatMessageFromClient(outgoingMessage); break; } } Main.chatText = ""; Main.ClosePlayerChat(); Main.chatRelease = false; SoundEngine.PlaySound(11); } } } private void DoUpdate_HandleInput() { PlayerInput.UpdateInput(); this.UpdateViewZoomKeys(); PlayerInput.SetZoom_Unscaled(); UILinkPointNavigator.Update(); PlayerInput.CacheMousePositionForZoom(); PlayerInput.SetZoom_MouseInWorld(); Main.oldKeyState = Main.keyState; Main.keyState = Keyboard.GetState(); } private static void DoUpdate_AltEnter_ToggleFullscreen() { if ((Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftAlt) || Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.RightAlt)) && Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Enter) && Main.hasFocus) { if (Main.toggleFullscreen) { Main.ToggleFullScreen(); Main.chatRelease = false; } Main.toggleFullscreen = false; } else Main.toggleFullscreen = true; } private static void DoUpdate_F11_ToggleUI() { if (Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.F11)) { if (Main.releaseUI) { Main.hideUI = !Main.hideUI; SoundEngine.PlaySound(12); } Main.releaseUI = false; } else Main.releaseUI = true; } private static void DoUpdate_F7_ToggleGraphicsDiagnostics() { if (Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.F7) && !Main.drawingPlayerChat && !Main.editSign && !Main.editChest) { if (Main.drawRelease) { SoundEngine.PlaySound(12); if (Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftAlt) || Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.RightAlt)) TimeLogger.Start(); else Main.drawDiag = !Main.drawDiag; } Main.drawRelease = false; } else Main.drawRelease = true; } private static void DoUpdate_F8_ToggleNetDiagnostics() { if (Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.F8) && !Main.drawingPlayerChat && !Main.editSign && !Main.editChest) { if (Main.netRelease) { SoundEngine.PlaySound(12); Main.shouldDrawNetDiagnosticsUI = !Main.shouldDrawNetDiagnosticsUI; } Main.netRelease = false; } else Main.netRelease = true; } private static void DoUpdate_F9_ToggleLighting() { if (Main.keyState.PressingShift() && Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.F9) && !Main.drawingPlayerChat && !Main.editSign && !Main.editChest) { if (Main.RGBRelease) { SoundEngine.PlaySound(12); Lighting.NextLightMode(); } Main.RGBRelease = false; } else Main.RGBRelease = true; } private static void DoUpdate_F10_ToggleFPS() { if (Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.F10) && !Main.drawingPlayerChat && !Main.editSign && !Main.editChest) { if (Main.frameRelease) { SoundEngine.PlaySound(12); Main.showFrameRate = !Main.showFrameRate; } Main.frameRelease = false; } else Main.frameRelease = true; } private static void AnimateTiles() { ++Main.tileFrameCounter[12]; if (Main.tileFrameCounter[12] > 5) { Main.tileFrameCounter[12] = 0; ++Main.tileFrame[12]; if (Main.tileFrame[12] >= 10) Main.tileFrame[12] = 0; } ++Main.tileFrameCounter[17]; if (Main.tileFrameCounter[17] > 5) { Main.tileFrameCounter[17] = 0; ++Main.tileFrame[17]; if (Main.tileFrame[17] >= 12) Main.tileFrame[17] = 0; } if (++Main.tileFrameCounter[133] >= 4) { Main.tileFrameCounter[133] = 0; if (++Main.tileFrame[133] >= 6) Main.tileFrame[133] = 0; } ++Main.tileFrameCounter[31]; if (Main.tileFrameCounter[31] > 10) { Main.tileFrameCounter[31] = 0; ++Main.tileFrame[31]; if (Main.tileFrame[31] > 1) Main.tileFrame[31] = 0; } ++Main.tileFrameCounter[77]; if (Main.tileFrameCounter[77] > 5) { Main.tileFrameCounter[77] = 0; ++Main.tileFrame[77]; if (Main.tileFrame[77] >= 12) Main.tileFrame[77] = 0; } ++Main.tileFrameCounter[106]; if (Main.tileFrameCounter[106] > 4) { Main.tileFrameCounter[106] = 0; ++Main.tileFrame[106]; if (Main.tileFrame[106] >= 2) Main.tileFrame[106] = 0; } ++Main.tileFrameCounter[207]; if (Main.tileFrameCounter[207] > 4) { Main.tileFrameCounter[207] = 0; ++Main.tileFrame[207]; if (Main.tileFrame[207] >= 6) Main.tileFrame[207] = 0; } ++Main.tileFrameCounter[215]; if (Main.tileFrameCounter[215] >= 4) { Main.tileFrameCounter[215] = 0; ++Main.tileFrame[215]; if (Main.tileFrame[215] >= 8) Main.tileFrame[215] = 0; } ++Main.tileFrameCounter[592]; if (Main.tileFrameCounter[592] >= 5) { Main.tileFrameCounter[592] = 0; ++Main.tileFrame[592]; if (Main.tileFrame[592] >= 8) Main.tileFrame[592] = 0; } ++Main.tileFrameCounter[217]; if (Main.tileFrameCounter[217] > 4) { Main.tileFrameCounter[217] = 0; ++Main.tileFrame[217]; if (Main.tileFrame[217] >= 5) Main.tileFrame[217] = 0; } ++Main.tileFrameCounter[218]; if (Main.tileFrameCounter[218] > 4) { Main.tileFrameCounter[218] = 0; ++Main.tileFrame[218]; if (Main.tileFrame[218] >= 2) Main.tileFrame[218] = 0; } ++Main.tileFrameCounter[219]; if (Main.tileFrameCounter[219] > 4) { Main.tileFrameCounter[219] = 0; ++Main.tileFrame[219]; if (Main.tileFrame[219] >= 10) Main.tileFrame[219] = 0; } ++Main.tileFrameCounter[220]; if (Main.tileFrameCounter[220] > 4) { Main.tileFrameCounter[220] = 0; ++Main.tileFrame[220]; if (Main.tileFrame[220] >= 4) Main.tileFrame[220] = 0; } ++Main.tileFrameCounter[231]; if (Main.tileFrameCounter[231] > 16) { Main.tileFrameCounter[231] = 0; ++Main.tileFrame[231]; if (Main.tileFrame[231] >= 7) Main.tileFrame[231] = 0; } ++Main.tileFrameCounter[235]; if (Main.tileFrameCounter[235] > 20) { Main.tileFrameCounter[235] = 0; ++Main.tileFrame[235]; if (Main.tileFrame[235] >= 4) Main.tileFrame[235] = 0; Main.tileLighted[235] = Main.tileFrame[235] > 1; } ++Main.tileFrameCounter[238]; if (Main.tileFrameCounter[238] > 20) { Main.tileFrameCounter[238] = 0; ++Main.tileFrame[238]; if (Main.tileFrame[238] >= 4) Main.tileFrame[238] = 0; } ++Main.tileFrameCounter[243]; if (Main.tileFrameCounter[243] > 4) { Main.tileFrameCounter[243] = 0; ++Main.tileFrame[243]; if (Main.tileFrame[243] >= 6) Main.tileFrame[243] = 0; } ++Main.tileFrameCounter[244]; if (Main.tileFrameCounter[244] > 4) { Main.tileFrameCounter[244] = 0; ++Main.tileFrame[244]; if (Main.tileFrame[244] >= 6) Main.tileFrame[244] = 0; } ++Main.tileFrameCounter[247]; if (Main.tileFrameCounter[247] > 4) { Main.tileFrameCounter[247] = 0; ++Main.tileFrame[247]; if (Main.tileFrame[247] > 7) Main.tileFrame[247] = 0; } ++Main.tileFrameCounter[96]; if (Main.tileFrameCounter[96] > 4) { Main.tileFrameCounter[96] = 0; ++Main.tileFrame[96]; if (Main.tileFrame[96] > 3) Main.tileFrame[96] = 0; } ++Main.tileFrameCounter[171]; if (Main.tileFrameCounter[171] > 16) { Main.tileFrameCounter[171] = 0; ++Main.tileFrame[171]; if (Main.tileFrame[171] > 3) Main.tileFrame[171] = 0; } ++Main.tileFrameCounter[270]; if (Main.tileFrameCounter[270] > 8) { Main.tileFrameCounter[270] = 0; ++Main.tileFrame[270]; if (Main.tileFrame[270] > 5) Main.tileFrame[270] = 0; } Main.tileFrame[271] = Main.tileFrame[270]; Main.tileFrame[581] = Main.tileFrame[270]; ++Main.tileFrameCounter[272]; if (Main.tileFrameCounter[272] >= 10) { Main.tileFrameCounter[272] = 0; ++Main.tileFrame[272]; if (Main.tileFrame[272] > 1) Main.tileFrame[272] = 0; } ++Main.tileFrameCounter[300]; if (Main.tileFrameCounter[300] >= 5) { Main.tileFrameCounter[300] = 0; ++Main.tileFrame[300]; if (Main.tileFrame[300] > 6) Main.tileFrame[300] = 0; } ++Main.tileFrameCounter[301]; if (Main.tileFrameCounter[301] >= 5) { Main.tileFrameCounter[301] = 0; ++Main.tileFrame[301]; if (Main.tileFrame[301] > 7) Main.tileFrame[301] = 0; } ++Main.tileFrameCounter[302]; if (Main.tileFrameCounter[302] >= 5) { Main.tileFrameCounter[302] = 0; ++Main.tileFrame[302]; if (Main.tileFrame[302] > 3) Main.tileFrame[302] = 0; } ++Main.tileFrameCounter[303]; if (Main.tileFrameCounter[303] >= 5) { Main.tileFrameCounter[303] = 0; ++Main.tileFrame[303]; if (Main.tileFrame[303] > 4) Main.tileFrame[303] = 0; } ++Main.tileFrameCounter[305]; if (Main.tileFrameCounter[305] >= 5) { Main.tileFrameCounter[305] = 0; ++Main.tileFrame[305]; if (Main.tileFrame[305] > 11) Main.tileFrame[305] = 0; } ++Main.tileFrameCounter[306]; if (Main.tileFrameCounter[306] >= 5) { Main.tileFrameCounter[306] = 0; ++Main.tileFrame[306]; if (Main.tileFrame[306] > 11) Main.tileFrame[306] = 0; } ++Main.tileFrameCounter[307]; if (Main.tileFrameCounter[307] >= 5) { Main.tileFrameCounter[307] = 0; ++Main.tileFrame[307]; if (Main.tileFrame[307] > 1) Main.tileFrame[307] = 0; } ++Main.tileFrameCounter[308]; if (Main.tileFrameCounter[308] >= 5) { Main.tileFrameCounter[308] = 0; ++Main.tileFrame[308]; if (Main.tileFrame[308] > 7) Main.tileFrame[308] = 0; } ++Main.tileFrameCounter[314]; if (Main.tileFrameCounter[314] >= 10) { Main.tileFrameCounter[314] = 0; ++Main.tileFrame[314]; if (Main.tileFrame[314] > 4) Main.tileFrame[314] = 0; } ++Main.tileFrameCounter[326]; if (Main.tileFrameCounter[326] >= 5) { Main.tileFrameCounter[326] = 0; ++Main.tileFrame[326]; if (Main.tileFrame[326] > 7) Main.tileFrame[326] = 0; } ++Main.tileFrameCounter[327]; if (Main.tileFrameCounter[327] >= 10) { Main.tileFrameCounter[327] = 0; ++Main.tileFrame[327]; if (Main.tileFrame[327] > 7) Main.tileFrame[327] = 0; } ++Main.tileFrameCounter[345]; if (Main.tileFrameCounter[345] >= 10) { Main.tileFrameCounter[345] = 0; ++Main.tileFrame[345]; if (Main.tileFrame[345] > 7) Main.tileFrame[345] = 0; } ++Main.tileFrameCounter[458]; if (Main.tileFrameCounter[458] >= 10) { Main.tileFrameCounter[458] = 0; ++Main.tileFrame[458]; if (Main.tileFrame[458] > 7) Main.tileFrame[458] = 0; } ++Main.tileFrameCounter[459]; if (Main.tileFrameCounter[459] >= 10) { Main.tileFrameCounter[459] = 0; ++Main.tileFrame[459]; if (Main.tileFrame[459] > 7) Main.tileFrame[459] = 0; } ++Main.tileFrameCounter[336]; if (Main.tileFrameCounter[336] >= 5) { Main.tileFrameCounter[336] = 0; ++Main.tileFrame[336]; if (Main.tileFrame[336] > 3) Main.tileFrame[336] = 0; } ++Main.tileFrameCounter[328]; if (Main.tileFrameCounter[328] >= 5) { Main.tileFrameCounter[328] = 0; ++Main.tileFrame[328]; if (Main.tileFrame[328] > 7) Main.tileFrame[328] = 0; } ++Main.tileFrameCounter[329]; if (Main.tileFrameCounter[329] >= 5) { Main.tileFrameCounter[329] = 0; ++Main.tileFrame[329]; if (Main.tileFrame[329] > 7) Main.tileFrame[329] = 0; } int num1 = 20; if (++Main.tileFrameCounter[507] >= num1 * 8) Main.tileFrameCounter[507] = 0; if (++Main.tileFrameCounter[508] >= num1 * 8) Main.tileFrameCounter[508] = 0; for (int index = 340; index <= 344; ++index) { ++Main.tileFrameCounter[index]; if (Main.tileFrameCounter[index] >= 5) { Main.tileFrameCounter[index] = 0; ++Main.tileFrame[index]; if (Main.tileFrame[index] > 3) Main.tileFrame[index] = 0; } } ++Main.tileFrameCounter[351]; if (Main.tileFrameCounter[351] >= 5) { Main.tileFrameCounter[351] = 0; ++Main.tileFrame[351]; if (Main.tileFrame[351] > 2) Main.tileFrame[351] = 0; } ++Main.tileFrameCounter[354]; if (Main.tileFrameCounter[354] >= 5) { Main.tileFrameCounter[354] = 0; ++Main.tileFrame[354]; if (Main.tileFrame[354] >= 8) Main.tileFrame[354] = 0; } Main.tileFrame[355] = Main.tileFrame[354]; ++Main.tileFrameCounter[377]; if (Main.tileFrameCounter[377] >= 5) { Main.tileFrameCounter[377] = 0; ++Main.tileFrame[377]; if (Main.tileFrame[377] >= 4) Main.tileFrame[377] = 0; } ++Main.tileFrameCounter[379]; if (Main.tileFrameCounter[379] >= 10) { Main.tileFrameCounter[379] = 0; ++Main.tileFrame[379]; if (Main.tileFrame[379] >= 4) Main.tileFrame[379] = 0; } if (++Main.tileFrameCounter[390] >= 8) { Main.tileFrameCounter[390] = 0; if (++Main.tileFrame[390] >= 7) Main.tileFrame[390] = 0; } if (++Main.tileFrameCounter[228] >= 5) { Main.tileFrameCounter[228] = 0; if (++Main.tileFrame[228] >= 3) Main.tileFrame[228] = 0; } if (++Main.tileFrameCounter[405] >= 5) { Main.tileFrameCounter[405] = 0; if (++Main.tileFrame[405] >= 8) Main.tileFrame[405] = 0; } if (++Main.tileFrameCounter[406] >= 8) { Main.tileFrameCounter[406] = 0; if (++Main.tileFrame[406] >= 6) Main.tileFrame[406] = 0; } if (++Main.tileFrameCounter[452] >= 5) { Main.tileFrameCounter[452] = 0; if (++Main.tileFrame[452] >= 15) Main.tileFrame[452] = 0; } if (++Main.tileFrameCounter[455] >= 5) { Main.tileFrameCounter[455] = 0; if (++Main.tileFrame[455] >= 6) Main.tileFrame[455] = 0; } if (++Main.tileFrameCounter[499] >= 5) { Main.tileFrameCounter[499] = 0; if (++Main.tileFrame[499] >= 8) Main.tileFrame[499] = 0; } if (++Main.tileFrameCounter[129] >= 8) { Main.tileFrameCounter[129] = 0; if (++Main.tileFrame[129] >= 6) Main.tileFrame[129] = 0; } Main.tileFrameCounter[453] += WorldGen.gen ? 0 : Main.rand.Next(3); if (++Main.tileFrameCounter[453] >= 60) Main.tileFrameCounter[453] = 0; if (++Main.tileFrame[412] >= 240) Main.tileFrame[412] = 0; Main.tileFrameCounter[456] += WorldGen.gen ? 0 : Main.rand.Next(3); if (++Main.tileFrameCounter[456] >= 80) Main.tileFrameCounter[456] = 0; if (++Main.tileFrame[456] >= 240) Main.tileFrame[456] = 0; if (++Main.tileFrameCounter[410] >= 8) { Main.tileFrameCounter[410] = 0; if (++Main.tileFrame[410] >= 8) Main.tileFrame[410] = 0; } if (++Main.tileFrameCounter[480] >= 8) { Main.tileFrameCounter[480] = 0; if (++Main.tileFrame[480] >= 8) Main.tileFrame[480] = 0; } if (++Main.tileFrameCounter[509] >= 8) { Main.tileFrameCounter[509] = 0; if (++Main.tileFrame[509] >= 8) Main.tileFrame[509] = 0; } if (++Main.tileFrameCounter[421] >= 4) { Main.tileFrameCounter[421] = 0; if (++Main.tileFrame[421] >= 4) Main.tileFrame[421] = 0; } if (++Main.tileFrameCounter[422] >= 4) { Main.tileFrameCounter[422] = 0; if (--Main.tileFrame[422] < 0) Main.tileFrame[422] = 3; } if (++Main.tileFrameCounter[463] >= 10) { Main.tileFrameCounter[463] = 0; if (++Main.tileFrame[463] >= 6) Main.tileFrame[463] = 0; } if (++Main.tileFrameCounter[464] >= 5) { Main.tileFrameCounter[464] = 0; if (++Main.tileFrame[464] >= 23) Main.tileFrame[464] = 0; } if (++Main.tileFrameCounter[485] >= 20) Main.tileFrameCounter[485] = 0; if (++Main.tileFrameCounter[491] >= 40) Main.tileFrameCounter[491] = 0; if (++Main.tileFrameCounter[564] >= 5) { Main.tileFrameCounter[564] = 0; ++Main.tileFrame[564]; if (Main.tileFrame[564] >= 36) Main.tileFrame[564] = 0; } if (++Main.tileFrameCounter[593] >= 5) { Main.tileFrameCounter[593] = 0; ++Main.tileFrame[593]; if (Main.tileFrame[593] >= 9) Main.tileFrame[593] = 5; } if (++Main.tileFrameCounter[594] >= 5) { Main.tileFrameCounter[594] = 0; ++Main.tileFrame[594]; if (Main.tileFrame[594] >= 9) Main.tileFrame[594] = 5; } if (++Main.tileFrameCounter[614] >= 5) { Main.tileFrameCounter[614] = 0; ++Main.tileFrame[614]; if (Main.tileFrame[614] >= 6) Main.tileFrame[614] = 0; } if (++Main.tileFrameCounter[565] >= 4) { Main.tileFrameCounter[565] = 0; ++Main.tileFrame[565]; if (Main.tileFrame[565] >= 5) Main.tileFrame[565] = 0; } if (++Main.tileFrameCounter[572] >= 8) { Main.tileFrameCounter[572] = 0; if (++Main.tileFrame[572] >= 6) Main.tileFrame[572] = 0; } if (++Main.tileFrameCounter[597] >= 64) Main.tileFrameCounter[597] = 0; int num2 = (int) MathHelper.Clamp((float) Math.Floor((double) Math.Abs(Main.WindForVisuals) * 10.0) * (float) Math.Sign(Main.WindForVisuals), -5f, 5f); Main.tileFrameCounter[489] += num2; Main.tileFrameCounter[489] %= 320; if (Main.tileFrameCounter[489] < 0) Main.tileFrameCounter[489] += 320; Main.AnimateTiles_WeatherVane(); int num3 = (int) MathHelper.Clamp((float) Math.Floor((double) Math.Abs(Main.WindForVisuals) * 10.0) * (float) Math.Sign(Main.WindForVisuals), -5f, 5f); Main.tileFrameCounter[493] += num3; Main.tileFrameCounter[493] %= 120; if (Main.tileFrameCounter[493] < 0) Main.tileFrameCounter[493] += 120; Main.AnimateTiles_CritterCages(); } private static void AnimateTiles_WeatherVane() { int num1 = Math.Sign(Main.WindForVisuals); int num2 = (int) MathHelper.Clamp((float) Math.Floor((double) Math.Abs(Main.WindForVisuals) * 10.0), -5f, 5f); int num3 = 6; Main.tileFrameCounter[490] += num2; if (Main.tileFrameCounter[490] < num3) return; Main.tileFrameCounter[490] -= num3 * Main.tileFrameCounter[490]; if ((Main.tileFrame[490] != 0 || num1 != -1 ? (Main.tileFrame[490] != 6 ? 0 : (num1 == 1 ? 1 : 0)) : 1) == 0) { if (++Main.tileFrame[490] < 12) return; Main.tileFrame[490] = 0; Main.weatherVaneBobframe = 0; } else { if ((double) Main.rand.NextFloat() >= (double) Math.Abs(Main.WindForVisuals) * 0.5 || ++Main.weatherVaneBobframe != 8) return; Main.weatherVaneBobframe = 0; } } private static void DoUpdate_AnimateWalls() { ++Main.wallFrameCounter[136]; if (Main.wallFrameCounter[136] >= (byte) 5) { Main.wallFrameCounter[136] = (byte) 0; ++Main.wallFrame[136]; if (Main.wallFrame[136] > (byte) 7) Main.wallFrame[136] = (byte) 0; } ++Main.wallFrameCounter[137]; if (Main.wallFrameCounter[137] >= (byte) 10) { Main.wallFrameCounter[137] = (byte) 0; ++Main.wallFrame[137]; if (Main.wallFrame[137] > (byte) 7) Main.wallFrame[137] = (byte) 0; } int index1 = 226; ++Main.wallFrameCounter[index1]; if (Main.wallFrameCounter[index1] >= (byte) 10) { Main.wallFrameCounter[index1] = (byte) 0; ++Main.wallFrame[index1]; if (Main.wallFrame[index1] > (byte) 7) Main.wallFrame[index1] = (byte) 0; } int index2 = 227; ++Main.wallFrameCounter[index2]; if (Main.wallFrameCounter[index2] >= (byte) 5) { Main.wallFrameCounter[index2] = (byte) 0; ++Main.wallFrame[index2]; if (Main.wallFrame[index2] > (byte) 7) Main.wallFrame[index2] = (byte) 0; } int index3 = 225; ++Main.wallFrameCounter[index3]; if (Main.wallFrameCounter[index3] >= (byte) 5) { Main.wallFrameCounter[index3] = (byte) 0; ++Main.wallFrame[index3]; if (Main.wallFrame[index3] > (byte) 1) Main.wallFrame[index3] = (byte) 0; } ++Main.wallFrameCounter[172]; if (Main.wallFrameCounter[172] >= (byte) 10) { Main.wallFrameCounter[172] = (byte) 0; ++Main.wallFrame[172]; if (Main.wallFrame[172] > (byte) 7) Main.wallFrame[172] = (byte) 0; } ++Main.wallFrameCounter[168]; if (Main.wallFrameCounter[168] >= (byte) 5) { Main.wallFrameCounter[168] = (byte) 0; ++Main.wallFrame[168]; if (Main.wallFrame[168] > (byte) 7) Main.wallFrame[168] = (byte) 0; } ++Main.wallFrameCounter[169]; if (Main.wallFrameCounter[169] >= (byte) 5) { Main.wallFrameCounter[169] = (byte) 0; ++Main.wallFrame[169]; if (Main.wallFrame[169] > (byte) 7) Main.wallFrame[169] = (byte) 0; } int num1 = 20; if ((int) ++Main.wallFrameCounter[242] >= num1 * 8) Main.wallFrameCounter[242] = (byte) 0; if ((int) ++Main.wallFrameCounter[243] >= num1 * 8) Main.wallFrameCounter[243] = (byte) 0; ++Main.wallFrameCounter[144]; int num2 = 5; int num3 = 10; if ((int) Main.wallFrameCounter[144] < num2) Main.wallFrame[144] = (byte) 0; else if ((int) Main.wallFrameCounter[144] < num2) Main.wallFrame[144] = (byte) 1; else if ((int) Main.wallFrameCounter[144] < num2 * 2) Main.wallFrame[144] = (byte) 2; else if ((int) Main.wallFrameCounter[144] < num2 * 3) Main.wallFrame[144] = (byte) 3; else if ((int) Main.wallFrameCounter[144] < num2 * 4) Main.wallFrame[144] = (byte) 4; else if ((int) Main.wallFrameCounter[144] < num2 * 5) Main.wallFrame[144] = (byte) 5; else if ((int) Main.wallFrameCounter[144] < num2 * 6) Main.wallFrame[144] = (byte) 6; else if ((int) Main.wallFrameCounter[144] < num2 * 7) Main.wallFrame[144] = (byte) 7; else if ((int) Main.wallFrameCounter[144] < num2 * (8 + num3)) Main.wallFrame[144] = (byte) 8; else if ((int) Main.wallFrameCounter[144] < num2 * (9 + num3)) Main.wallFrame[144] = (byte) 7; else if ((int) Main.wallFrameCounter[144] < num2 * (10 + num3)) Main.wallFrame[144] = (byte) 6; else if ((int) Main.wallFrameCounter[144] < num2 * (11 + num3)) Main.wallFrame[144] = (byte) 5; else if ((int) Main.wallFrameCounter[144] < num2 * (12 + num3)) Main.wallFrame[144] = (byte) 4; else if ((int) Main.wallFrameCounter[144] < num2 * (13 + num3)) Main.wallFrame[144] = (byte) 3; else if ((int) Main.wallFrameCounter[144] < num2 * (14 + num3)) Main.wallFrame[144] = (byte) 2; else if ((int) Main.wallFrameCounter[144] < num2 * (15 + num3)) { Main.wallFrame[144] = (byte) 1; } else { Main.wallFrame[144] = (byte) 0; if ((int) Main.wallFrameCounter[144] <= num2 * (16 + num3 * 2)) return; Main.wallFrameCounter[144] = (byte) 0; } } private void DoUpdate_AnimateWaterfalls() { Main.wFrCounter += Main.windSpeedCurrent * 2f; if ((double) Main.wFrCounter > 4.0) { Main.wFrCounter = 0.0f; ++Main.wFrame; } if ((double) Main.wFrCounter < 0.0) { Main.wFrCounter = 4f; --Main.wFrame; } if ((double) Main.wFrame > 16.0) Main.wFrame = 1f; if ((double) Main.wFrame < 1.0) Main.wFrame = 16f; this.waterfallManager.UpdateFrame(); } private static void DoUpdate_AnimateVisualPlayerAura() { if (Main.gFadeDir == (byte) 1) { Main.gFader += 0.1f; Main.gFade = (byte) Main.gFader; if (Main.gFade <= (byte) 150) return; Main.gFadeDir = (byte) 0; } else { Main.gFader -= 0.1f; Main.gFade = (byte) Main.gFader; if (Main.gFade >= (byte) 100) return; Main.gFadeDir = (byte) 1; } } private void DoUpdate_AnimateDiscoRGB() { int num = 7; if (this.DiscoStyle == 0) { Main.DiscoG += num; if (Main.DiscoG >= (int) byte.MaxValue) { Main.DiscoG = (int) byte.MaxValue; ++this.DiscoStyle; } } if (this.DiscoStyle == 1) { Main.DiscoR -= num; if (Main.DiscoR <= 0) { Main.DiscoR = 0; ++this.DiscoStyle; } } if (this.DiscoStyle == 2) { Main.DiscoB += num; if (Main.DiscoB >= (int) byte.MaxValue) { Main.DiscoB = (int) byte.MaxValue; ++this.DiscoStyle; } } if (this.DiscoStyle == 3) { Main.DiscoG -= num; if (Main.DiscoG <= 0) { Main.DiscoG = 0; ++this.DiscoStyle; } } if (this.DiscoStyle == 4) { Main.DiscoR += num; if (Main.DiscoR >= (int) byte.MaxValue) { Main.DiscoR = (int) byte.MaxValue; ++this.DiscoStyle; } } if (this.DiscoStyle != 5) return; Main.DiscoB -= num; if (Main.DiscoB > 0) return; Main.DiscoB = 0; this.DiscoStyle = 0; } private static void DoUpdate_AnimateBackgrounds() { Main.DoUpdate_AnimateBackgrounds_UpdateForest(0, Main.treeMntBGSet1); Main.DoUpdate_AnimateBackgrounds_UpdateForest(10, Main.treeMntBGSet2); Main.DoUpdate_AnimateBackgrounds_UpdateForest(11, Main.treeMntBGSet3); Main.DoUpdate_AnimateBackgrounds_UpdateForest(12, Main.treeMntBGSet4); } private static void DoUpdate_AnimateBackgrounds_UpdateForest(int bgIndex, int[] bgSet) { if (bgSet[1] == 94 || bgSet[1] >= 114 && bgSet[1] <= 116) { ++Main.bgFrameCounter[bgIndex]; if (Main.bgFrameCounter[bgIndex] >= 6) { Main.bgFrameCounter[bgIndex] = 0; ++Main.bgFrame[bgIndex]; if (Main.bgFrame[bgIndex] >= 4) Main.bgFrame[bgIndex] = 0; } bgSet[1] = Main.bgFrame[bgIndex] != 0 ? (Main.bgFrame[bgIndex] != 1 ? (Main.bgFrame[bgIndex] != 2 ? 116 : 115) : 114) : 94; bgSet[0] = Main.bgFrame[bgIndex] != 0 ? (Main.bgFrame[bgIndex] != 1 ? (Main.bgFrame[bgIndex] != 2 ? 170 : 169) : 168) : 93; } if (bgSet[1] < 180 || bgSet[1] > 183) return; ++Main.bgFrameCounter[bgIndex]; if (Main.bgFrameCounter[bgIndex] >= 6) { Main.bgFrameCounter[bgIndex] = 0; ++Main.bgFrame[bgIndex]; if (Main.bgFrame[bgIndex] >= 4) Main.bgFrame[bgIndex] = 0; } if (Main.bgFrame[bgIndex] == 0) bgSet[1] = 180; else if (Main.bgFrame[bgIndex] == 1) bgSet[1] = 181; else if (Main.bgFrame[bgIndex] == 2) bgSet[1] = 182; else bgSet[1] = 183; } private static void DoUpdate_AutoSave() { if (!Main.gameMenu && Main.netMode == 1) { if (!Main.saveTime.IsRunning) Main.saveTime.Start(); if (Main.saveTime.ElapsedMilliseconds <= 300000L) return; Main.saveTime.Reset(); WorldGen.saveToonWhilePlaying(); } else if (!Main.gameMenu && (Main.autoSave || Main.netMode == 2)) { if (!Main.saveTime.IsRunning) Main.saveTime.Start(); if (Main.saveTime.ElapsedMilliseconds <= 600000L) return; Main.saveTime.Reset(); if (Main.netMode != 2) WorldGen.saveToonWhilePlaying(); WorldGen.saveAndPlay(); } else { if (!Main.saveTime.IsRunning) return; Main.saveTime.Stop(); } } private static void UpdateSettingUnlocks() { if (Main.netMode == 2 || Main.dedServ || !Main.hardMode || Main.SettingsUnlock_WorldEvil) return; Main.SettingsUnlock_WorldEvil = true; Main.SaveSettings(); } public static void InputTextSign() { if (IngameFancyUI.CanShowVirtualKeyboard(1) && UIVirtualKeyboard.KeyboardContext == 1) return; PlayerInput.WritingText = true; Main.instance.HandleIME(); Main.npcChatText = Main.GetInputText(Main.npcChatText, true); if (Main.inputTextEnter) { byte[] bytes = new byte[1]{ (byte) 10 }; Main.npcChatText += Encoding.ASCII.GetString(bytes); } else { if (!Main.inputTextEscape) return; Main.InputTextSignCancel(); } } public static void InputTextChest() { if (IngameFancyUI.CanShowVirtualKeyboard(2) && UIVirtualKeyboard.KeyboardContext == 2) return; Main.npcChatText = Main.GetInputText(Main.npcChatText); if (Main.inputTextEnter) { ChestUI.RenameChestSubmit(Main.player[Main.myPlayer]); } else { if (!Main.inputTextEscape) return; ChestUI.RenameChestCancel(); } } public static void InputTextSignCancel() { SoundEngine.PlaySound(12); Main.editSign = false; Main.blockKey = Microsoft.Xna.Framework.Input.Keys.Escape.ToString(); UIVirtualKeyboard.CacheCancelledInput(1); Main.npcChatText = Main.sign[Main.player[Main.myPlayer].sign].text; } private static void UpdateMenu() { if (WorldGen.drunkWorldGen) { Main.screenPosition.X -= 20f; if (WorldGen.drunkWorldGenText) { Main.numClouds = Main.rand.Next(100, 200); Main.statusText = string.Concat((object) Main.rand.Next(999999999)); for (int index = 0; index < 3; ++index) { if (Main.rand.Next(2) == 0) Main.statusText += (string) (object) Main.rand.Next(999999999); } } } Main.gamePaused = false; Main.thunderDelay = 0; Main.lightning = 0.0f; Main.lightningSpeed = 0.0f; Main.GraveyardVisualIntensity = 0.0f; InGameNotificationsTracker.Clear(); Main.playerInventory = false; Main.exitScale = 0.8f; switch (Main.netMode) { case 0: if ((!Main.instance.IsActive ? 0 : (Main.hasFocus ? 1 : 0)) != 0 && !Main.dayTime && (Main.rand.Next(12) == 0 || WorldGen.drunkWorldGen)) { int index = Main.rand.Next(Main.numStars); if (Main.star[index] != null && !Main.star[index].hidden && !Main.star[index].falling) Main.star[index].Fall(); } if (Main.gameMenu) { if (WorldGen.gen) Main.lockMenuBGChange = true; else if (Main.menuMode == 0) Main.lockMenuBGChange = false; if (!Main.lockMenuBGChange) { if (Main.dayTime) Main.menuBGChangedDay = false; else if (!Main.menuBGChangedDay && Main.time >= 16200.0) { Main.menuBGChangedDay = true; int corruptBg = WorldGen.corruptBG; WorldGen.RandomizeBackgrounds(Main.rand); if (Main.treeBGSet1[0] == 173) WorldGen.RandomizeBackgrounds(Main.rand); if (Main.treeBGSet1[0] == 173) WorldGen.RandomizeBackgrounds(Main.rand); WorldGen.setBG(1, corruptBg); } if (!Main.dayTime) Main.menuBGChangedNight = false; else if (!Main.menuBGChangedNight && Main.time >= 27000.0) { Main.moonType = Main.rand.Next(9); Main.menuBGChangedNight = true; int treeBg1 = WorldGen.treeBG1; WorldGen.RandomizeBackgrounds(Main.rand); WorldGen.setBG(0, treeBg1); } } else { Main.menuBGChangedDay = true; Main.menuBGChangedNight = true; } } if (Main.alreadyGrabbingSunOrMoon) break; if (WorldGen.drunkWorldGen) { Main.time -= 6.0; if (Main.dayTime) Main.time -= 1000.0; if (Main.time < 0.0) { Main.time = 32400.0; Main.dayTime = false; } } else if (Main.dayTime) Main.time += 576.0 / 17.0; else Main.time += 216.0 / 7.0; if (!Main.dayTime) { if (Main.time <= 32400.0) break; Main.bloodMoon = false; Main.time = 0.0; Main.dayTime = true; ++Main.moonPhase; if (Main.moonPhase < 7) break; Main.moonPhase = 0; break; } if (Main.time <= 54000.0) break; Main.time = 0.0; Main.dayTime = false; break; case 1: Main.UpdateTime(); break; } } public static void clrInput() => Main.keyCount = 0; [DllImport("user32.dll", CharSet = CharSet.Auto)] public static extern short GetKeyState(int keyCode); public static string GetInputText(string oldString, bool allowMultiLine = false) { if (!Main.hasFocus) return oldString; Main.inputTextEnter = false; Main.inputTextEscape = false; string str1 = oldString; string newKeys = ""; if (str1 == null) str1 = ""; bool flag1 = false; if (Main.inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftControl) || Main.inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.RightControl)) { if (Main.inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Z) && !Main.oldInputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Z)) str1 = ""; else if (Main.inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.X) && !Main.oldInputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.X)) { Platform.Get().Value = oldString; str1 = ""; } else if (Main.inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.C) && !Main.oldInputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.C) || Main.inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Insert) && !Main.oldInputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Insert)) Platform.Get().Value = oldString; else if (Main.inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.V) && !Main.oldInputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.V)) newKeys = Main.PasteTextIn(allowMultiLine, newKeys); } else { if (Main.inputText.PressingShift()) { if (Main.inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Delete) && !Main.oldInputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Delete)) { Platform.Get().Value = oldString; str1 = ""; } if (Main.inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Insert) && !Main.oldInputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Insert)) newKeys = Main.PasteTextIn(allowMultiLine, newKeys); } for (int index = 0; index < Main.keyCount; ++index) { int num = Main.keyInt[index]; string str2 = Main.keyString[index]; switch (num) { case 13: Main.inputTextEnter = true; break; case 27: Main.inputTextEscape = true; break; default: if (num >= 32 && num != (int) sbyte.MaxValue) { newKeys += str2; break; } break; } } } Main.keyCount = 0; string text = str1 + newKeys; Main.oldInputText = Main.inputText; Main.inputText = Keyboard.GetState(); Microsoft.Xna.Framework.Input.Keys[] pressedKeys1 = Main.inputText.GetPressedKeys(); Microsoft.Xna.Framework.Input.Keys[] pressedKeys2 = Main.oldInputText.GetPressedKeys(); if (Main.inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Back) && Main.oldInputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Back)) { Main.backSpaceRate -= 0.05f; if ((double) Main.backSpaceRate < 0.0) Main.backSpaceRate = 0.0f; if (Main.backSpaceCount <= 0) { Main.backSpaceCount = (int) Math.Round((double) Main.backSpaceRate); flag1 = true; } --Main.backSpaceCount; } else { Main.backSpaceRate = 7f; Main.backSpaceCount = 15; } for (int index1 = 0; index1 < pressedKeys1.Length; ++index1) { bool flag2 = true; for (int index2 = 0; index2 < pressedKeys2.Length; ++index2) { if (pressedKeys1[index1] == pressedKeys2[index2]) flag2 = false; } if (string.Concat((object) pressedKeys1[index1]) == "Back" && flag2 | flag1 && text.Length > 0) { TextSnippet[] array = ChatManager.ParseMessage(text, Microsoft.Xna.Framework.Color.White).ToArray(); text = !array[array.Length - 1].DeleteWhole ? text.Substring(0, text.Length - 1) : text.Substring(0, text.Length - array[array.Length - 1].TextOriginal.Length); } } return text; } private static string PasteTextIn(bool allowMultiLine, string newKeys) { newKeys = !allowMultiLine ? newKeys + Platform.Get().Value : newKeys + Platform.Get().MultiLineValue; return newKeys; } public void MouseTextHackZoom(string text, string buffTooltip = null) => this.MouseTextHackZoom(text, 0, buffTooltip: buffTooltip); public void MouseTextHackZoom(string text, int itemRarity, byte diff = 0, string buffTooltip = null) => this.MouseText(text, buffTooltip, itemRarity, diff); 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) { this.MouseText(cursorText, (string) null, rare, diff, hackedMouseX, hackedMouseY, hackedScreenWidth, hackedScreenHeight, pushWidthX, true); } 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) { this.MouseText(cursorText, (string) null, rare, diff, hackedMouseX, hackedMouseY, hackedScreenWidth, hackedScreenHeight, pushWidthX); } 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) { if (this._mouseTextCache.noOverride) return; this._mouseTextCache = new Main.MouseTextCache() { noOverride = noOverride, isValid = true, cursorText = cursorText, rare = rare, diff = diff, X = hackedMouseX, Y = hackedMouseY, hackedScreenWidth = hackedScreenWidth, hackedScreenHeight = hackedScreenHeight, buffTooltip = buffTooltip }; } private void MouseTextInner(Main.MouseTextCache info) { string cursorText = info.cursorText; int rare = info.rare; byte diff = info.diff; int x = info.X; int y = info.Y; int hackedScreenWidth = info.hackedScreenWidth; int hackedScreenHeight = info.hackedScreenHeight; if (this.mouseNPCType > -1 || cursorText == null) return; int X = Main.mouseX + 14; int Y = Main.mouseY + 14; if (x != -1 && y != -1) { X = x + 10; Y = y + 10; } if (Main.ThickMouse) { X += 6; Y += 6; } if (!Main.mouseItem.IsAir) X += 34; Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor); if (Main.HoverItem.type > 0) { this.MouseText_DrawItemTooltip(info, rare, diff, X, Y); } else { if (info.buffTooltip != null && info.buffTooltip != "") this.MouseText_DrawBuffTooltip(info.buffTooltip, ref X, ref Y); Vector2 vector2 = FontAssets.MouseText.Value.MeasureString(cursorText); if (hackedScreenHeight != -1 && hackedScreenWidth != -1) { if ((double) X + (double) vector2.X + 4.0 > (double) hackedScreenWidth) X = (int) ((double) hackedScreenWidth - (double) vector2.X - 4.0); if ((double) Y + (double) vector2.Y + 4.0 > (double) hackedScreenHeight) Y = (int) ((double) hackedScreenHeight - (double) vector2.Y - 4.0); } else { if ((double) X + (double) vector2.X + 4.0 > (double) Main.screenWidth) X = (int) ((double) Main.screenWidth - (double) vector2.X - 4.0); if ((double) Y + (double) vector2.Y + 4.0 > (double) Main.screenHeight) Y = (int) ((double) Main.screenHeight - (double) vector2.Y - 4.0); } float num = (float) Main.mouseTextColor / (float) byte.MaxValue; Microsoft.Xna.Framework.Color baseColor = new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor); if (rare == -13) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) byte.MaxValue * (double) num), (int) (byte) ((double) Main.masterColor * 200.0 * (double) num), 0, (int) Main.mouseTextColor); if (rare == -11) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) byte.MaxValue * (double) num), (int) (byte) (175.0 * (double) num), (int) (byte) (0.0 * (double) num), (int) Main.mouseTextColor); if (rare == -10) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) (65.0 * (double) num), (int) (byte) ((double) byte.MaxValue * (double) num), (int) (byte) (110.0 * (double) num), (int) Main.mouseTextColor); if (rare == -1) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) (130.0 * (double) num), (int) (byte) (130.0 * (double) num), (int) (byte) (130.0 * (double) num), (int) Main.mouseTextColor); if (rare == 1) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) (150.0 * (double) num), (int) (byte) (150.0 * (double) num), (int) (byte) ((double) byte.MaxValue * (double) num), (int) Main.mouseTextColor); if (rare == 2) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) (150.0 * (double) num), (int) (byte) ((double) byte.MaxValue * (double) num), (int) (byte) (150.0 * (double) num), (int) Main.mouseTextColor); if (rare == 3) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) byte.MaxValue * (double) num), (int) (byte) (200.0 * (double) num), (int) (byte) (150.0 * (double) num), (int) Main.mouseTextColor); if (rare == 4) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) byte.MaxValue * (double) num), (int) (byte) (150.0 * (double) num), (int) (byte) (150.0 * (double) num), (int) Main.mouseTextColor); if (rare == 5) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) byte.MaxValue * (double) num), (int) (byte) (150.0 * (double) num), (int) (byte) ((double) byte.MaxValue * (double) num), (int) Main.mouseTextColor); if (rare == 6) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) (210.0 * (double) num), (int) (byte) (160.0 * (double) num), (int) (byte) ((double) byte.MaxValue * (double) num), (int) Main.mouseTextColor); if (rare == 7) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) (150.0 * (double) num), (int) (byte) ((double) byte.MaxValue * (double) num), (int) (byte) (10.0 * (double) num), (int) Main.mouseTextColor); if (rare == 8) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) byte.MaxValue * (double) num), (int) (byte) ((double) byte.MaxValue * (double) num), (int) (byte) (10.0 * (double) num), (int) Main.mouseTextColor); if (rare == 9) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) (5.0 * (double) num), (int) (byte) (200.0 * (double) num), (int) (byte) ((double) byte.MaxValue * (double) num), (int) Main.mouseTextColor); if (rare == 10) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) byte.MaxValue * (double) num), (int) (byte) (40.0 * (double) num), (int) (byte) (100.0 * (double) num), (int) Main.mouseTextColor); if (rare >= 11) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) (180.0 * (double) num), (int) (byte) (40.0 * (double) num), (int) (byte) ((double) byte.MaxValue * (double) num), (int) Main.mouseTextColor); if (Main.HoverItem.expert || rare == -12) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) Main.DiscoR * (double) num), (int) (byte) ((double) Main.DiscoG * (double) num), (int) (byte) ((double) Main.DiscoB * (double) num), (int) Main.mouseTextColor); if (diff == (byte) 1) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) Main.mcColor.R * (double) num), (int) (byte) ((double) Main.mcColor.G * (double) num), (int) (byte) ((double) Main.mcColor.B * (double) num), (int) Main.mouseTextColor); if (diff == (byte) 2) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) Main.hcColor.R * (double) num), (int) (byte) ((double) Main.hcColor.G * (double) num), (int) (byte) ((double) Main.hcColor.B * (double) num), (int) Main.mouseTextColor); ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, FontAssets.MouseText.Value, cursorText, new Vector2((float) X, (float) Y), baseColor, 0.0f, Vector2.Zero, Vector2.One); } } private void MouseText_DrawItemTooltip( Main.MouseTextCache info, int rare, byte diff, int X, int Y) { bool boxBehindTooltips = Main.SettingsEnabled_OpaqueBoxBehindTooltips; Microsoft.Xna.Framework.Color color1 = new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor); Item hoverItem = Main.HoverItem; int yoyoLogo = -1; int researchLine = -1; rare = hoverItem.rare; float knockBack = hoverItem.knockBack; float num1 = 1f; if (hoverItem.melee && Main.player[Main.myPlayer].kbGlove) ++num1; if (Main.player[Main.myPlayer].kbBuff) num1 += 0.5f; if ((double) num1 != 1.0) hoverItem.knockBack *= num1; if (hoverItem.ranged && Main.player[Main.myPlayer].shroomiteStealth) hoverItem.knockBack *= (float) (1.0 + (1.0 - (double) Main.player[Main.myPlayer].stealth) * 0.5); int length = 30; int index1 = 1; string[] strArray = new string[length]; bool[] preFixLine = new bool[length]; bool[] badPreFixLine = new bool[length]; for (int index2 = 0; index2 < length; ++index2) { preFixLine[index2] = false; badPreFixLine[index2] = false; } Main.MouseText_DrawItemTooltip_GetLinesInfo(Main.HoverItem, ref yoyoLogo, ref researchLine, knockBack, ref index1, strArray, preFixLine, badPreFixLine); float num2 = (float) Main.mouseTextColor / (float) byte.MaxValue; int mouseTextColor = (int) Main.mouseTextColor; if (Main.npcShop > 0 && hoverItem.value >= 0 && (hoverItem.type < 71 || hoverItem.type > 74)) { int calcForSelling; int calcForBuying; Main.LocalPlayer.GetItemExpectedPrice(hoverItem, out calcForSelling, out calcForBuying); int price = hoverItem.isAShopItem || hoverItem.buyOnce ? calcForBuying : calcForSelling; if (hoverItem.shopSpecialCurrency != -1) { CustomCurrencyManager.GetPriceText(hoverItem.shopSpecialCurrency, strArray, ref index1, price); color1 = new Microsoft.Xna.Framework.Color((int) (byte) ((double) byte.MaxValue * (double) num2), (int) (byte) ((double) byte.MaxValue * (double) num2), (int) (byte) ((double) byte.MaxValue * (double) num2), mouseTextColor); } else if (price > 0) { string str = ""; int num3 = 0; int num4 = 0; int num5 = 0; int num6 = 0; int num7 = price * hoverItem.stack; if (!hoverItem.buy) { int num8 = price / 5; if (num8 < 1) num8 = 1; int num9 = num8; num7 = num8 * hoverItem.stack; int amount = Main.shopSellbackHelper.GetAmount(hoverItem); if (amount > 0) num7 += (-num9 + calcForBuying) * Math.Min(amount, hoverItem.stack); } if (num7 < 1) num7 = 1; if (num7 >= 1000000) { num3 = num7 / 1000000; num7 -= num3 * 1000000; } if (num7 >= 10000) { num4 = num7 / 10000; num7 -= num4 * 10000; } if (num7 >= 100) { num5 = num7 / 100; num7 -= num5 * 100; } if (num7 >= 1) num6 = num7; if (num3 > 0) str = str + (object) num3 + " " + Lang.inter[15].Value + " "; if (num4 > 0) str = str + (object) num4 + " " + Lang.inter[16].Value + " "; if (num5 > 0) str = str + (object) num5 + " " + Lang.inter[17].Value + " "; if (num6 > 0) str = str + (object) num6 + " " + Lang.inter[18].Value + " "; strArray[index1] = hoverItem.buy ? Lang.tip[50].Value + " " + str : Lang.tip[49].Value + " " + str; ++index1; if (num3 > 0) color1 = new Microsoft.Xna.Framework.Color((int) (byte) (220.0 * (double) num2), (int) (byte) (220.0 * (double) num2), (int) (byte) (198.0 * (double) num2), mouseTextColor); else if (num4 > 0) color1 = new Microsoft.Xna.Framework.Color((int) (byte) (224.0 * (double) num2), (int) (byte) (201.0 * (double) num2), (int) (byte) (92.0 * (double) num2), mouseTextColor); else if (num5 > 0) color1 = new Microsoft.Xna.Framework.Color((int) (byte) (181.0 * (double) num2), (int) (byte) (192.0 * (double) num2), (int) (byte) (193.0 * (double) num2), mouseTextColor); else if (num6 > 0) color1 = new Microsoft.Xna.Framework.Color((int) (byte) (246.0 * (double) num2), (int) (byte) (138.0 * (double) num2), (int) (byte) (96.0 * (double) num2), mouseTextColor); } else if (hoverItem.type != 3817) { strArray[index1] = Lang.tip[51].Value; ++index1; color1 = new Microsoft.Xna.Framework.Color((int) (byte) (120.0 * (double) num2), (int) (byte) (120.0 * (double) num2), (int) (byte) (120.0 * (double) num2), mouseTextColor); } } Vector2 zero = Vector2.Zero; int num10 = 0; for (int index3 = 0; index3 < index1; ++index3) { Vector2 stringSize = ChatManager.GetStringSize(FontAssets.MouseText.Value, strArray[index3], Vector2.One); if ((double) stringSize.X > (double) zero.X) zero.X = stringSize.X; zero.Y += stringSize.Y + (float) num10; } if (yoyoLogo != -1) zero.Y += 24f; X += Main.toolTipDistance; Y += Main.toolTipDistance; int num11 = 4; if (boxBehindTooltips) { X += 8; Y += 2; num11 = 18; } int screenWidth = Main.screenWidth; int screenHeight = Main.screenHeight; if ((double) X + (double) zero.X + (double) num11 > (double) screenWidth) X = (int) ((double) screenWidth - (double) zero.X - (double) num11); if ((double) Y + (double) zero.Y + (double) num11 > (double) screenHeight) Y = (int) ((double) screenHeight - (double) zero.Y - (double) num11); int num12 = 0; float num13 = (float) Main.mouseTextColor / (float) byte.MaxValue; if (boxBehindTooltips) { MathHelper.Lerp(num13, 1f, 1f); int num14 = 14; int num15 = 9; Utils.DrawInvBG(Main.spriteBatch, new Microsoft.Xna.Framework.Rectangle(X - num14, Y - num15, (int) zero.X + num14 * 2, (int) zero.Y + num15 + num15 / 2), new Microsoft.Xna.Framework.Color(23, 25, 81, (int) byte.MaxValue) * 0.925f); } for (int index4 = 0; index4 < index1; ++index4) { if (index4 == yoyoLogo) { float num16 = 1f; int num17 = (int) ((double) Main.mouseTextColor * (double) num16); Microsoft.Xna.Framework.Color color2 = Microsoft.Xna.Framework.Color.Black; for (int index5 = 0; index5 < 5; ++index5) { int num18 = X; int num19 = Y + num12; if (index5 == 4) color2 = new Microsoft.Xna.Framework.Color(num17, num17, num17, num17); if (index5 == 0) --num18; else if (index5 == 1) ++num18; else if (index5 == 2) --num19; else if (index5 == 3) ++num19; Main.spriteBatch.Draw(TextureAssets.OneDropLogo.Value, new Vector2((float) num18, (float) num19), new Microsoft.Xna.Framework.Rectangle?(), color2, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } } else { Microsoft.Xna.Framework.Color baseColor = Microsoft.Xna.Framework.Color.Black; baseColor = new Microsoft.Xna.Framework.Color(num2, num2, num2, num2); if (index4 == 0) { if (rare == -13) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) byte.MaxValue * (double) num2), (int) (byte) ((double) Main.masterColor * 200.0 * (double) num2), 0, mouseTextColor); if (rare == -11) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) byte.MaxValue * (double) num2), (int) (byte) (175.0 * (double) num2), (int) (byte) (0.0 * (double) num2), mouseTextColor); if (rare == -1) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) (130.0 * (double) num2), (int) (byte) (130.0 * (double) num2), (int) (byte) (130.0 * (double) num2), mouseTextColor); if (rare == 1) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) (150.0 * (double) num2), (int) (byte) (150.0 * (double) num2), (int) (byte) ((double) byte.MaxValue * (double) num2), mouseTextColor); if (rare == 2) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) (150.0 * (double) num2), (int) (byte) ((double) byte.MaxValue * (double) num2), (int) (byte) (150.0 * (double) num2), mouseTextColor); if (rare == 3) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) byte.MaxValue * (double) num2), (int) (byte) (200.0 * (double) num2), (int) (byte) (150.0 * (double) num2), mouseTextColor); if (rare == 4) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) byte.MaxValue * (double) num2), (int) (byte) (150.0 * (double) num2), (int) (byte) (150.0 * (double) num2), mouseTextColor); if (rare == 5) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) byte.MaxValue * (double) num2), (int) (byte) (150.0 * (double) num2), (int) (byte) ((double) byte.MaxValue * (double) num2), mouseTextColor); if (rare == 6) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) (210.0 * (double) num2), (int) (byte) (160.0 * (double) num2), (int) (byte) ((double) byte.MaxValue * (double) num2), mouseTextColor); if (rare == 7) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) (150.0 * (double) num2), (int) (byte) ((double) byte.MaxValue * (double) num2), (int) (byte) (10.0 * (double) num2), mouseTextColor); if (rare == 8) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) byte.MaxValue * (double) num2), (int) (byte) ((double) byte.MaxValue * (double) num2), (int) (byte) (10.0 * (double) num2), mouseTextColor); if (rare == 9) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) (5.0 * (double) num2), (int) (byte) (200.0 * (double) num2), (int) (byte) ((double) byte.MaxValue * (double) num2), mouseTextColor); if (rare == 10) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) byte.MaxValue * (double) num2), (int) (byte) (40.0 * (double) num2), (int) (byte) (100.0 * (double) num2), mouseTextColor); if (rare >= 11) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) (180.0 * (double) num2), (int) (byte) (40.0 * (double) num2), (int) (byte) ((double) byte.MaxValue * (double) num2), mouseTextColor); if (diff == (byte) 1) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) Main.mcColor.R * (double) num2), (int) (byte) ((double) Main.mcColor.G * (double) num2), (int) (byte) ((double) Main.mcColor.B * (double) num2), mouseTextColor); if (diff == (byte) 2) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) Main.hcColor.R * (double) num2), (int) (byte) ((double) Main.hcColor.G * (double) num2), (int) (byte) ((double) Main.hcColor.B * (double) num2), mouseTextColor); if (hoverItem.expert || rare == -12) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) Main.DiscoR * (double) num2), (int) (byte) ((double) Main.DiscoG * (double) num2), (int) (byte) ((double) Main.DiscoB * (double) num2), mouseTextColor); } else if (preFixLine[index4]) baseColor = !badPreFixLine[index4] ? new Microsoft.Xna.Framework.Color((int) (byte) (120.0 * (double) num2), (int) (byte) (190.0 * (double) num2), (int) (byte) (120.0 * (double) num2), mouseTextColor) : new Microsoft.Xna.Framework.Color((int) (byte) (190.0 * (double) num2), (int) (byte) (120.0 * (double) num2), (int) (byte) (120.0 * (double) num2), mouseTextColor); else if (index4 == index1 - 1) baseColor = color1; if (index4 == researchLine) baseColor = Colors.JourneyMode; ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, FontAssets.MouseText.Value, strArray[index4], new Vector2((float) X, (float) (Y + num12)), baseColor, 0.0f, Vector2.Zero, Vector2.One); } num12 += (int) ((double) FontAssets.MouseText.Value.MeasureString(strArray[index4]).Y + (double) num10); } } public static void MouseText_DrawItemTooltip_GetLinesInfo( Item item, ref int yoyoLogo, ref int researchLine, float oldKB, ref int numLines, string[] toolTipLine, bool[] preFixLine, bool[] badPreFixLine) { Item obj1 = item; toolTipLine[0] = obj1.HoverName; if (obj1.favorited) { toolTipLine[numLines++] = Lang.tip[56].Value; toolTipLine[numLines++] = Lang.tip[57].Value; if (Main.LocalPlayer.chest != -1) { Item[] chestinv; ChestUI.GetContainerUsageInfo(out bool _, out chestinv); if (ChestUI.IsBlockedFromTransferIntoChest(obj1, chestinv)) toolTipLine[numLines++] = Language.GetTextValue("UI.ItemCannotBePlacedInsideItself"); } } if (obj1.social) { toolTipLine[numLines] = Lang.tip[0].Value; ++numLines; toolTipLine[numLines] = Lang.tip[1].Value; ++numLines; } else { if (obj1.damage > 0 && (!obj1.notAmmo || obj1.useStyle != 0) && (obj1.type < 71 || obj1.type > 74 || Main.player[Main.myPlayer].HasItem(905))) { float num1 = 5E-06f; int num2 = (int) ((double) obj1.damage * (double) ItemID.Sets.ToolTipDamageMultiplier[obj1.type]); if (obj1.melee) { toolTipLine[numLines] = string.Concat((object) (int) ((double) Main.player[Main.myPlayer].meleeDamage * (double) num2 + (double) num1)); // ISSUE: explicit reference operation ^ref toolTipLine[numLines] += Lang.tip[2].Value; } else if (obj1.ranged) { float num3 = (float) num2 * Main.player[Main.myPlayer].rangedDamage; if (obj1.useAmmo == AmmoID.Arrow || obj1.useAmmo == AmmoID.Stake) { num3 *= Main.player[Main.myPlayer].arrowDamage; if (Main.player[Main.myPlayer].archery) num3 *= 1.2f; } if (obj1.useAmmo == AmmoID.Bullet || obj1.useAmmo == AmmoID.CandyCorn) num3 *= Main.player[Main.myPlayer].bulletDamage; if (obj1.useAmmo == AmmoID.Rocket || obj1.useAmmo == AmmoID.StyngerBolt || obj1.useAmmo == AmmoID.JackOLantern || obj1.useAmmo == AmmoID.NailFriendly) num3 *= Main.player[Main.myPlayer].rocketDamage; toolTipLine[numLines] = string.Concat((object) (int) ((double) num3 + (double) num1)); // ISSUE: explicit reference operation ^ref toolTipLine[numLines] += Lang.tip[3].Value; } else if (obj1.magic) { toolTipLine[numLines] = string.Concat((object) (int) ((double) Main.player[Main.myPlayer].magicDamage * (double) num2 + (double) num1)); // ISSUE: explicit reference operation ^ref toolTipLine[numLines] += Lang.tip[4].Value; } else if (obj1.summon) { toolTipLine[numLines] = string.Concat((object) (int) ((double) Main.player[Main.myPlayer].minionDamage * (double) num2 + (double) num1)); // ISSUE: explicit reference operation ^ref toolTipLine[numLines] += Lang.tip[53].Value; } else { toolTipLine[numLines] = string.Concat((object) num2); // ISSUE: explicit reference operation ^ref toolTipLine[numLines] += Lang.tip[55].Value; } ++numLines; if (obj1.melee) { int num4 = Main.player[Main.myPlayer].meleeCrit - Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].crit + obj1.crit; toolTipLine[numLines] = num4.ToString() + Lang.tip[5].Value; ++numLines; } else if (obj1.ranged) { int num5 = Main.player[Main.myPlayer].rangedCrit - Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].crit + obj1.crit; toolTipLine[numLines] = num5.ToString() + Lang.tip[5].Value; ++numLines; } else if (obj1.magic) { int num6 = Main.player[Main.myPlayer].magicCrit - Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].crit + obj1.crit; toolTipLine[numLines] = num6.ToString() + Lang.tip[5].Value; ++numLines; } if (obj1.useStyle != 0 && !obj1.summon) { toolTipLine[numLines] = obj1.useAnimation > 8 ? (obj1.useAnimation > 20 ? (obj1.useAnimation > 25 ? (obj1.useAnimation > 30 ? (obj1.useAnimation > 35 ? (obj1.useAnimation > 45 ? (obj1.useAnimation > 55 ? Lang.tip[13].Value : Lang.tip[12].Value) : Lang.tip[11].Value) : Lang.tip[10].Value) : Lang.tip[9].Value) : Lang.tip[8].Value) : Lang.tip[7].Value) : Lang.tip[6].Value; ++numLines; } float num7 = obj1.knockBack; if (obj1.summon) num7 += Main.player[Main.myPlayer].minionKB; if (Main.player[Main.myPlayer].magicQuiver && obj1.useAmmo == AmmoID.Arrow || obj1.useAmmo == AmmoID.Stake) num7 = (float) (int) ((double) num7 * 1.10000002384186); if (Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type == 3106 && obj1.type == 3106) num7 += num7 * (1f - Main.player[Main.myPlayer].stealth); toolTipLine[numLines] = (double) num7 != 0.0 ? ((double) num7 > 1.5 ? ((double) num7 > 3.0 ? ((double) num7 > 4.0 ? ((double) num7 > 6.0 ? ((double) num7 > 7.0 ? ((double) num7 > 9.0 ? ((double) num7 > 11.0 ? Lang.tip[22].Value : Lang.tip[21].Value) : Lang.tip[20].Value) : Lang.tip[19].Value) : Lang.tip[18].Value) : Lang.tip[17].Value) : Lang.tip[16].Value) : Lang.tip[15].Value) : Lang.tip[14].Value; ++numLines; } if (obj1.fishingPole > 0) { toolTipLine[numLines] = Language.GetTextValue("GameUI.PrecentFishingPower", (object) obj1.fishingPole); ++numLines; toolTipLine[numLines] = Language.GetTextValue("GameUI.BaitRequired"); ++numLines; } if (obj1.bait > 0) { toolTipLine[numLines] = Language.GetTextValue("GameUI.BaitPower", (object) obj1.bait); ++numLines; } if (obj1.headSlot > 0 || obj1.bodySlot > 0 || obj1.legSlot > 0 || obj1.accessory || Main.projHook[obj1.shoot] || obj1.mountType != -1 || obj1.buffType > 0 && (Main.lightPet[obj1.buffType] || Main.vanityPet[obj1.buffType])) { toolTipLine[numLines] = obj1.type != 854 && obj1.type != 3035 || Main.npcShop <= 0 ? Lang.tip[23].Value : Lang.tip[60].Value; ++numLines; } if (obj1.tileWand > 0) { toolTipLine[numLines] = Lang.tip[52].Value + Lang.GetItemNameValue(obj1.tileWand); ++numLines; } if (obj1.questItem) { toolTipLine[numLines] = Lang.inter[65].Value; ++numLines; } if (obj1.vanity) { toolTipLine[numLines] = Lang.tip[24].Value; ++numLines; } if (!obj1.vanity && obj1.FitsAccessoryVanitySlot) { toolTipLine[numLines] = Language.GetText("Misc.CanBePlacedInVanity").Value; ++numLines; } if (obj1.defense > 0) { toolTipLine[numLines] = obj1.defense.ToString() + Lang.tip[25].Value; ++numLines; } if (obj1.pick > 0) { toolTipLine[numLines] = obj1.pick.ToString() + Lang.tip[26].Value; ++numLines; } if (obj1.axe > 0) { toolTipLine[numLines] = (obj1.axe * 5).ToString() + Lang.tip[27].Value; ++numLines; } if (obj1.hammer > 0) { toolTipLine[numLines] = obj1.hammer.ToString() + Lang.tip[28].Value; ++numLines; } if (obj1.tileBoost != 0) { int tileBoost = obj1.tileBoost; toolTipLine[numLines] = tileBoost <= 0 ? tileBoost.ToString() + Lang.tip[54].Value : "+" + (object) tileBoost + Lang.tip[54].Value; ++numLines; } if (obj1.healLife > 0) { toolTipLine[numLines] = Language.GetTextValue("CommonItemTooltip.RestoresLife", (object) obj1.healLife); ++numLines; } if (obj1.healMana > 0) { toolTipLine[numLines] = Language.GetTextValue("CommonItemTooltip.RestoresMana", (object) obj1.healMana); ++numLines; } if (obj1.mana > 0 && (obj1.type != (int) sbyte.MaxValue || !Main.player[Main.myPlayer].spaceGun)) { toolTipLine[numLines] = Language.GetTextValue("CommonItemTooltip.UsesMana", (object) (int) ((double) obj1.mana * (double) Main.player[Main.myPlayer].manaCost)); ++numLines; } if (obj1.createWall > 0 || obj1.createTile > -1) { if (obj1.type != 213 && obj1.tileWand < 1) { toolTipLine[numLines] = Lang.tip[33].Value; ++numLines; } } else if (obj1.ammo > 0 && !obj1.notAmmo) { toolTipLine[numLines] = Lang.tip[34].Value; ++numLines; } else if (obj1.consumable) { toolTipLine[numLines] = Lang.tip[35].Value; ++numLines; } if (obj1.material) { toolTipLine[numLines] = Lang.tip[36].Value; ++numLines; } if (obj1.ToolTip != null) { for (int line = 0; line < obj1.ToolTip.Lines; ++line) { if (line == 0 && ItemID.Sets.UsesCursedByPlanteraTooltip[obj1.type] && !NPC.downedPlantBoss) { toolTipLine[numLines] = Lang.tip[59].Value; ++numLines; } else { toolTipLine[numLines] = obj1.ToolTip.GetLine(line); ++numLines; } } } if ((obj1.type == 3818 || obj1.type == 3819 || obj1.type == 3820 || obj1.type == 3824 || obj1.type == 3825 || obj1.type == 3826 || obj1.type == 3829 || obj1.type == 3830 || obj1.type == 3831 || obj1.type == 3832 || obj1.type == 3833 || obj1.type == 3834) && !Main.player[Main.myPlayer].downedDD2EventAnyDifficulty) { toolTipLine[numLines] = Lang.misc[104].Value; ++numLines; } if (obj1.buffType > 0 && BuffID.Sets.IsWellFed[obj1.buffType] && Main.expertMode) { toolTipLine[numLines] = Lang.misc[40].Value; ++numLines; } if (obj1.buffTime > 0) { string str = obj1.buffTime / 60 < 60 ? Language.GetTextValue("CommonItemTooltip.SecondDuration", (object) Math.Round((double) obj1.buffTime / 60.0)) : Language.GetTextValue("CommonItemTooltip.MinuteDuration", (object) Math.Round((double) (obj1.buffTime / 60) / 60.0)); toolTipLine[numLines] = str; ++numLines; } if (obj1.type == 3262 || obj1.type == 3282 || obj1.type == 3283 || obj1.type == 3284 || obj1.type == 3285 || obj1.type == 3286 || obj1.type == 3316 || obj1.type == 3315 || obj1.type == 3317 || obj1.type == 3291 || obj1.type == 3389) { toolTipLine[numLines] = " "; yoyoLogo = numLines; ++numLines; } if (obj1.prefix > (byte) 0) { Item obj2 = Main.tooltipPrefixComparisonItem; if (obj2 == null || obj2.netID != obj1.netID) { obj2 = new Item(); obj2.netDefaults(obj1.netID); } if (obj2.damage != obj1.damage) { double num = Math.Round(((double) obj1.damage - (double) obj2.damage) / (double) obj2.damage * 100.0); toolTipLine[numLines] = num <= 0.0 ? num.ToString() + Lang.tip[39].Value : "+" + (object) num + Lang.tip[39].Value; if (num < 0.0) badPreFixLine[numLines] = true; preFixLine[numLines] = true; ++numLines; } if (obj2.useAnimation != obj1.useAnimation) { double num = Math.Round(((double) obj1.useAnimation - (double) obj2.useAnimation) / (double) obj2.useAnimation * 100.0) * -1.0; toolTipLine[numLines] = num <= 0.0 ? num.ToString() + Lang.tip[40].Value : "+" + (object) num + Lang.tip[40].Value; if (num < 0.0) badPreFixLine[numLines] = true; preFixLine[numLines] = true; ++numLines; } if (obj2.crit != obj1.crit) { double num = (double) obj1.crit - (double) obj2.crit; toolTipLine[numLines] = num <= 0.0 ? num.ToString() + Lang.tip[41].Value : "+" + (object) num + Lang.tip[41].Value; if (num < 0.0) badPreFixLine[numLines] = true; preFixLine[numLines] = true; ++numLines; } if (obj2.mana != obj1.mana) { double num = Math.Round(((double) obj1.mana - (double) obj2.mana) / (double) obj2.mana * 100.0); toolTipLine[numLines] = num <= 0.0 ? num.ToString() + Lang.tip[42].Value : "+" + (object) num + Lang.tip[42].Value; if (num > 0.0) badPreFixLine[numLines] = true; preFixLine[numLines] = true; ++numLines; } if ((double) obj2.scale != (double) obj1.scale) { double num = Math.Round(((double) obj1.scale - (double) obj2.scale) / (double) obj2.scale * 100.0); toolTipLine[numLines] = num <= 0.0 ? num.ToString() + Lang.tip[43].Value : "+" + (object) num + Lang.tip[43].Value; if (num < 0.0) badPreFixLine[numLines] = true; preFixLine[numLines] = true; ++numLines; } if ((double) obj2.shootSpeed != (double) obj1.shootSpeed) { double num = Math.Round(((double) obj1.shootSpeed - (double) obj2.shootSpeed) / (double) obj2.shootSpeed * 100.0); toolTipLine[numLines] = num <= 0.0 ? num.ToString() + Lang.tip[44].Value : "+" + (object) num + Lang.tip[44].Value; if (num < 0.0) badPreFixLine[numLines] = true; preFixLine[numLines] = true; ++numLines; } if ((double) obj2.knockBack != (double) oldKB) { double num = Math.Round(((double) oldKB - (double) obj2.knockBack) / (double) obj2.knockBack * 100.0); toolTipLine[numLines] = num <= 0.0 ? num.ToString() + Lang.tip[45].Value : "+" + (object) num + Lang.tip[45].Value; if (num < 0.0) badPreFixLine[numLines] = true; preFixLine[numLines] = true; ++numLines; } if (obj1.prefix == (byte) 62) { toolTipLine[numLines] = "+1" + Lang.tip[25].Value; preFixLine[numLines] = true; ++numLines; } if (obj1.prefix == (byte) 63) { toolTipLine[numLines] = "+2" + Lang.tip[25].Value; preFixLine[numLines] = true; ++numLines; } if (obj1.prefix == (byte) 64) { toolTipLine[numLines] = "+3" + Lang.tip[25].Value; preFixLine[numLines] = true; ++numLines; } if (obj1.prefix == (byte) 65) { toolTipLine[numLines] = "+4" + Lang.tip[25].Value; preFixLine[numLines] = true; ++numLines; } if (obj1.prefix == (byte) 66) { toolTipLine[numLines] = "+20 " + Lang.tip[31].Value; preFixLine[numLines] = true; ++numLines; } if (obj1.prefix == (byte) 67) { toolTipLine[numLines] = "+2" + Lang.tip[5].Value; preFixLine[numLines] = true; ++numLines; } if (obj1.prefix == (byte) 68) { toolTipLine[numLines] = "+4" + Lang.tip[5].Value; preFixLine[numLines] = true; ++numLines; } if (obj1.prefix == (byte) 69) { toolTipLine[numLines] = "+1" + Lang.tip[39].Value; preFixLine[numLines] = true; ++numLines; } if (obj1.prefix == (byte) 70) { toolTipLine[numLines] = "+2" + Lang.tip[39].Value; preFixLine[numLines] = true; ++numLines; } if (obj1.prefix == (byte) 71) { toolTipLine[numLines] = "+3" + Lang.tip[39].Value; preFixLine[numLines] = true; ++numLines; } if (obj1.prefix == (byte) 72) { toolTipLine[numLines] = "+4" + Lang.tip[39].Value; preFixLine[numLines] = true; ++numLines; } if (obj1.prefix == (byte) 73) { toolTipLine[numLines] = "+1" + Lang.tip[46].Value; preFixLine[numLines] = true; ++numLines; } if (obj1.prefix == (byte) 74) { toolTipLine[numLines] = "+2" + Lang.tip[46].Value; preFixLine[numLines] = true; ++numLines; } if (obj1.prefix == (byte) 75) { toolTipLine[numLines] = "+3" + Lang.tip[46].Value; preFixLine[numLines] = true; ++numLines; } if (obj1.prefix == (byte) 76) { toolTipLine[numLines] = "+4" + Lang.tip[46].Value; preFixLine[numLines] = true; ++numLines; } if (obj1.prefix == (byte) 77) { toolTipLine[numLines] = "+1" + Lang.tip[47].Value; preFixLine[numLines] = true; ++numLines; } if (obj1.prefix == (byte) 78) { toolTipLine[numLines] = "+2" + Lang.tip[47].Value; preFixLine[numLines] = true; ++numLines; } if (obj1.prefix == (byte) 79) { toolTipLine[numLines] = "+3" + Lang.tip[47].Value; preFixLine[numLines] = true; ++numLines; } if (obj1.prefix == (byte) 80) { toolTipLine[numLines] = "+4" + Lang.tip[47].Value; preFixLine[numLines] = true; ++numLines; } } if (obj1.wornArmor && Main.player[Main.myPlayer].setBonus != "") { toolTipLine[numLines] = Lang.tip[48].Value + " " + Main.player[Main.myPlayer].setBonus; ++numLines; } } if (obj1.expert) { toolTipLine[numLines] = Language.GetTextValue("GameUI.Expert"); ++numLines; } if (obj1.rare == -13) { toolTipLine[numLines] = Language.GetTextValue("GameUI.Master"); ++numLines; } int amountNeeded; if ((obj1.tooltipContext == 0 || obj1.tooltipContext == 2 || obj1.tooltipContext == 1 || obj1.tooltipContext == 3 || obj1.tooltipContext == 4 || obj1.tooltipContext == 15 ? 1 : (obj1.tooltipContext == 6 ? 1 : 0)) != 0 && Main.LocalPlayer.difficulty == (byte) 3 && CreativeItemSacrificesCatalog.Instance.TryGetSacrificeCountCapToUnlockInfiniteItems(obj1.type, out amountNeeded)) { int sacrificeCount = Main.LocalPlayerCreativeTracker.ItemSacrifices.GetSacrificeCount(obj1.type); if (amountNeeded - sacrificeCount > 0) { toolTipLine[numLines] = Language.GetTextValue("CommonItemTooltip.CreativeSacrificeNeeded", (object) (amountNeeded - sacrificeCount)); researchLine = numLines; ++numLines; } } string bestiaryNotes = obj1.BestiaryNotes; if (string.IsNullOrWhiteSpace(bestiaryNotes)) return; string str1 = bestiaryNotes; char[] chArray = new char[1]{ '\n' }; foreach (string str2 in str1.Split(chArray)) toolTipLine[numLines++] = str2; } private void MouseText_DrawBuffTooltip(string buffString, ref int X, ref int Y) { Microsoft.Xna.Framework.Point p = new Microsoft.Xna.Framework.Point(X, Y); int num1 = 220; int num2 = 72; int num3 = -1; float num4 = 1f; List vector2List = new List(); Vector2 vector2_1 = FontAssets.MouseText.Value.MeasureString(buffString); vector2List.Add(vector2_1); int num5 = (int) ((double) (Main.screenHeight - Y - 24 - num2) * (double) num4) / 20; if (num5 < 1) num5 = 1; if (Main.bannerMouseOver) { int num6 = 0; for (int index1 = 0; index1 < 289; ++index1) { if (Item.BannerToNPC(index1) != 0 && Main.player[Main.myPlayer].HasNPCBannerBuff(index1)) { ++num6; string npcNameValue = Lang.GetNPCNameValue(Item.BannerToNPC(index1)); Vector2 vector2_2 = FontAssets.MouseText.Value.MeasureString(npcNameValue); int num7 = X; int num8 = Y + (int) vector2_2.Y + num6 * 20 + 10; int num9 = 0; int num10 = num6 / num5; for (int index2 = 0; index2 < num10; ++index2) { ++num9; num7 += num1; num8 -= num5 * 20; } if ((double) (num7 - 24 - num1) > (double) Main.screenWidth * (double) num4) { num3 = num6; break; } vector2List.Add(new Vector2((float) num7, (float) num8) + vector2_2 - p.ToVector2()); } } } Vector2 zero = Vector2.Zero; foreach (Vector2 vector2_3 in vector2List) { if ((double) zero.X < (double) vector2_3.X) zero.X = vector2_3.X; if ((double) zero.Y < (double) vector2_3.Y) zero.Y = vector2_3.Y; } if ((double) X + (double) zero.X + 24.0 > (double) Main.screenWidth * (double) num4) X = (int) ((double) Main.screenWidth * (double) num4 - (double) zero.X - 24.0); if ((double) Y + (double) zero.Y + 4.0 > (double) Main.screenHeight * (double) num4) Y = (int) ((double) Main.screenHeight * (double) num4 - (double) zero.Y - 4.0); for (int index = 0; index < 5; ++index) { int num11 = X; int num12 = Y + (int) FontAssets.MouseText.Value.MeasureString(buffString).Y; Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.Black; if (index == 0) num11 -= 2; else if (index == 1) num11 += 2; else if (index == 2) num12 -= 2; else if (index == 3) num12 += 2; else color = new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, buffString, new Vector2((float) num11, (float) num12), color, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (!Main.bannerMouseOver) return; int num13 = 0; for (int index3 = 0; index3 < 289; ++index3) { if (Item.BannerToNPC(index3) != 0 && Main.player[Main.myPlayer].HasNPCBannerBuff(index3)) { ++num13; bool flag = false; for (int index4 = 0; index4 < 5; ++index4) { int num14 = X; int num15 = Y + (int) vector2_1.Y + num13 * 20 + 10; int num16 = (num13 - 1) / num5; int num17 = num14 + num1 * num16; int num18 = num15 - num5 * 20 * num16; string str = Lang.GetNPCNameValue(Item.BannerToNPC(index3)); if (num3 == num13) { str = Language.GetTextValue("UI.Ellipsis"); flag = true; } Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.Black; switch (index4) { case 0: num17 -= 2; break; case 1: num17 += 2; break; case 2: num18 -= 2; break; case 3: num18 += 2; break; default: float num19 = (float) Main.mouseTextColor / (float) byte.MaxValue; color = new Microsoft.Xna.Framework.Color((int) (byte) (80.0 * (double) num19), (int) (byte) ((double) byte.MaxValue * (double) num19), (int) (byte) (120.0 * (double) num19), (int) Main.mouseTextColor); break; } DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, str, new Vector2((float) num17, (float) num18), color, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (flag) break; } } } protected void DrawFPS() { if (!Main.showFrameRate) return; string str = string.Concat((object) Main.frameRate) + " (" + (object) (Terraria.Liquid.numLiquid + LiquidBuffer.numLiquidBuffer) + ")" + " (" + (object) (int) ((double) Main.gfxQuality * 100.0) + "%)" + " " + Main.debugWords; int num = 4; if (!Main.gameMenu) num = Main.screenHeight - 24; Vector2 vector2_1 = new Vector2(4f, (float) num); Vector2 vector2_2 = new Vector2(0.0f, 0.0f); Vector2 vector2_3 = FontAssets.MouseText.Value.MeasureString(str); if (PlayerInput.UsingGamepad && !Main.gameMenu) vector2_1.X = (float) (Main.screenWidth - 4) - vector2_3.X; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, str, vector2_1, new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor), 0.0f, vector2_2, 1f, SpriteEffects.None, 0.0f); } public static void DrawGamepadInstructions() { if (Main.drawingPlayerChat) return; string text = PlayerInput.ComposeInstructionsForGamepad(); if (Main.GamepadDisableInstructionsDisplay || text.Length <= 0 || Main.player[Main.myPlayer].dead && !Main.gameMenu) return; float num1 = 35f; float num2 = 1f; Vector2 baseScale = new Vector2(num2); if (Main.gameMenu) num1 = 55f; Vector2 stringSize = ChatManager.GetStringSize(FontAssets.MouseText.Value, text, new Vector2(1f)); float t2 = num2; Utils.Swap(ref GlyphTagHandler.GlyphsScale, ref t2); ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, FontAssets.MouseText.Value, text, new Vector2(12f, (float) Main.screenHeight - num1) - stringSize * new Vector2(0.0f, 0.0f), Microsoft.Xna.Framework.Color.White, 0.0f, Vector2.Zero, baseScale, spread: (num2 * 2f)); Utils.Swap(ref GlyphTagHandler.GlyphsScale, ref t2); } public static Microsoft.Xna.Framework.Color shine(Microsoft.Xna.Framework.Color newColor, int type) { int num1 = (int) newColor.R; int g = (int) newColor.G; int b = (int) newColor.B; float num2 = 0.6f; int num3; int num4; switch (type) { case 25: num1 = (int) ((double) newColor.R * 0.949999988079071); num3 = (int) ((double) newColor.G * 0.850000023841858); num4 = (int) ((double) newColor.B * 1.1); break; case 117: num1 = (int) ((double) newColor.R * 1.10000002384186); num3 = (int) ((double) newColor.G * 1.0); num4 = (int) ((double) newColor.B * 1.2); break; case 147: case 161: num1 = (int) ((double) newColor.R * 1.10000002384186); num3 = (int) ((double) newColor.G * 1.12000000476837); num4 = (int) ((double) newColor.B * 1.15); break; case 163: num1 = (int) ((double) newColor.R * 1.04999995231628); num3 = (int) ((double) newColor.G * 1.10000002384186); num4 = (int) ((double) newColor.B * 1.15); break; case 164: num1 = (int) ((double) newColor.R * 1.10000002384186); num3 = (int) ((double) newColor.G * 1.10000002384186); num4 = (int) ((double) newColor.B * 1.2); break; case 178: float num5 = 0.5f; num1 = (int) ((double) newColor.R * (1.0 + (double) num5)); num3 = (int) ((double) newColor.G * (1.0 + (double) num5)); num4 = (int) ((double) newColor.B * (1.0 + (double) num5)); break; case 185: case 186: float num6 = 0.3f; num1 = (int) ((double) newColor.R * (1.0 + (double) num6)); num3 = (int) ((double) newColor.G * (1.0 + (double) num6)); num4 = (int) ((double) newColor.B * (1.0 + (double) num6)); break; case 204: float num7 = (float) (0.300000011920929 + (double) Main.mouseTextColor / 300.0); int r = (int) ((double) newColor.R * (1.29999995231628 * (double) num7)); if (r > (int) byte.MaxValue) r = (int) byte.MaxValue; return new Microsoft.Xna.Framework.Color(r, g, b, (int) byte.MaxValue); case 211: float num8 = (float) (0.300000011920929 + (double) Main.mouseTextColor / 300.0); num3 = (int) ((double) newColor.G * (1.5 * (double) num8)); num4 = (int) ((double) newColor.B * (1.10000002384186 * (double) num8)); break; case 262: case 263: case 264: case 265: case 266: case 267: case 268: num4 = b + 100; num1 += 100; num3 = g + 100; break; default: num1 = (int) ((double) newColor.R * (1.0 + (double) num2)); num3 = (int) ((double) newColor.G * (1.0 + (double) num2)); num4 = (int) ((double) newColor.B * (1.0 + (double) num2)); break; } if (num1 > (int) byte.MaxValue) num1 = (int) byte.MaxValue; if (num3 > (int) byte.MaxValue) num3 = (int) byte.MaxValue; if (num4 > (int) byte.MaxValue) num4 = (int) byte.MaxValue; newColor.R = (byte) num1; newColor.G = (byte) num3; newColor.B = (byte) num4; return new Microsoft.Xna.Framework.Color((int) (byte) num1, (int) (byte) num3, (int) (byte) num4, (int) newColor.A); } public static void shine(ref Vector3 newColor, int type) { float num1 = 0.6f; switch (type) { case 25: newColor.X *= 0.95f; newColor.Y *= 0.85f; newColor.Z *= 1.1f; break; case 117: newColor.X *= 1.1f; newColor.Z *= 1.2f; break; case 147: case 161: newColor.X *= 1.1f; newColor.Y *= 1.12f; newColor.Z *= 1.15f; break; case 163: newColor.X *= 1.05f; newColor.Y *= 1.1f; newColor.Z *= 1.15f; break; case 164: newColor.X *= 1.1f; newColor.Y *= 1.1f; newColor.Z *= 1.2f; break; case 178: float num2 = 0.5f; newColor.X *= 1f + num2; newColor.Y *= 1f + num2; newColor.Z *= 1f + num2; break; case 185: case 186: float num3 = 0.3f; newColor.X *= 1f + num3; newColor.Y *= 1f + num3; newColor.Z *= 1f + num3; break; case 204: float num4 = (float) (0.300000011920929 + (double) Main.mouseTextColor / 300.0); newColor.X *= 1.3f * num4; break; case 211: float num5 = (float) (0.300000011920929 + (double) Main.mouseTextColor / 300.0); newColor.Y *= 1.5f * num5; newColor.Z *= 1.1f * num5; break; case 262: case 263: case 264: case 265: case 266: case 267: case 268: newColor.X += 0.39f; newColor.Y += 0.39f; newColor.Z += 0.39f; break; default: newColor.X *= 1f + num1; newColor.Y *= 1f + num1; newColor.Z *= 1f + num1; break; } } private void DrawTileEntities(bool solidLayer, bool overRenderTargets, bool intoRenderTargets) => this.TilesRenderer.PostDrawTiles(solidLayer, overRenderTargets, intoRenderTargets); public void ClearCachedTileDraws() { this.TilesRenderer.ClearCachedTileDraws(false); this.TilesRenderer.ClearCachedTileDraws(true); } public static bool IsTileSpelunkable(Tile t) => Main.IsTileSpelunkable(t.type, t.frameX, t.frameY); public static bool IsTileSpelunkable(ushort typeCache, short tileFrameX, short tileFrameY) => Main.tileSpelunker[(int) typeCache] || typeCache == (ushort) 185 && tileFrameY == (short) 18 && tileFrameX >= (short) 576 && tileFrameX <= (short) 882 || typeCache == (ushort) 186 && tileFrameX >= (short) 864 && tileFrameX <= (short) 1170; protected void DrawTiles( bool solidLayer, bool forRenderTargets, bool intoRenderTargets, int waterStyleOverride = -1) { this.TilesRenderer.Draw(solidLayer, forRenderTargets, intoRenderTargets, waterStyleOverride); } protected void DrawGoreBehind() { for (int index = 0; index < 600; ++index) { if (Main.gore[index].active && Main.gore[index].type > 0) { bool flag = false; if ((Main.gore[index].type >= 706 && Main.gore[index].type <= 717 || Main.gore[index].type == 943 || Main.gore[index].type == 1147 || Main.gore[index].type >= 1160 && Main.gore[index].type <= 1162) && (Main.gore[index].frame < (byte) 7 || Main.gore[index].frame > (byte) 9)) flag = true; if (flag) { this.LoadGore(Main.gore[index].type); if (Main.gore[index].Frame.ColumnCount > (byte) 1 || Main.gore[index].Frame.RowCount > (byte) 1) { Microsoft.Xna.Framework.Rectangle sourceRectangle = Main.gore[index].Frame.GetSourceRectangle(TextureAssets.Gore[Main.gore[index].type].Value); Microsoft.Xna.Framework.Color alpha = Main.gore[index].GetAlpha(Lighting.GetColor((int) ((double) Main.gore[index].position.X + (double) sourceRectangle.Width * 0.5) / 16, (int) (((double) Main.gore[index].position.Y + (double) sourceRectangle.Height * 0.5) / 16.0))); Main.spriteBatch.Draw(TextureAssets.Gore[Main.gore[index].type].Value, new Vector2(Main.gore[index].position.X - Main.screenPosition.X + (float) (sourceRectangle.Width / 2), (float) ((double) Main.gore[index].position.Y - (double) Main.screenPosition.Y + (double) (sourceRectangle.Height / 2) - 2.0)), new Microsoft.Xna.Framework.Rectangle?(sourceRectangle), alpha, Main.gore[index].rotation, new Vector2((float) (sourceRectangle.Width / 2), (float) (sourceRectangle.Height / 2)), Main.gore[index].scale, SpriteEffects.None, 0.0f); } else { Microsoft.Xna.Framework.Color alpha = Main.gore[index].GetAlpha(Lighting.GetColor((int) ((double) Main.gore[index].position.X + (double) TextureAssets.Gore[Main.gore[index].type].Width() * 0.5) / 16, (int) (((double) Main.gore[index].position.Y + (double) TextureAssets.Gore[Main.gore[index].type].Height() * 0.5) / 16.0))); Main.spriteBatch.Draw(TextureAssets.Gore[Main.gore[index].type].Value, new Vector2(Main.gore[index].position.X - Main.screenPosition.X + (float) (TextureAssets.Gore[Main.gore[index].type].Width() / 2), Main.gore[index].position.Y - Main.screenPosition.Y + (float) (TextureAssets.Gore[Main.gore[index].type].Height() / 2)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Gore[Main.gore[index].type].Width(), TextureAssets.Gore[Main.gore[index].type].Height())), alpha, Main.gore[index].rotation, new Vector2((float) (TextureAssets.Gore[Main.gore[index].type].Width() / 2), (float) (TextureAssets.Gore[Main.gore[index].type].Height() / 2)), Main.gore[index].scale, SpriteEffects.None, 0.0f); } } } } } protected void DrawGore() { Main.drawBackGore = false; for (int index = 0; index < 600; ++index) { if (Main.gore[index].active && Main.gore[index].type > 0) { if ((Main.gore[index].type >= 706 && Main.gore[index].type <= 717 || Main.gore[index].type == 943 || Main.gore[index].type == 1147 || Main.gore[index].type >= 1160 && Main.gore[index].type <= 1162) && (Main.gore[index].frame < (byte) 7 || Main.gore[index].frame > (byte) 9)) { Main.drawBackGore = true; } else { this.LoadGore(Main.gore[index].type); if (Main.gore[index].Frame.ColumnCount > (byte) 1 || Main.gore[index].Frame.RowCount > (byte) 1) { Microsoft.Xna.Framework.Rectangle sourceRectangle = Main.gore[index].Frame.GetSourceRectangle(TextureAssets.Gore[Main.gore[index].type].Value); Vector2 vector2 = new Vector2(0.0f, 0.0f); if (Main.gore[index].type == 1217) vector2.Y += 4f; Microsoft.Xna.Framework.Color alpha = Main.gore[index].GetAlpha(Lighting.GetColor((int) ((double) Main.gore[index].position.X + (double) sourceRectangle.Width * 0.5) / 16, (int) (((double) Main.gore[index].position.Y + (double) sourceRectangle.Height * 0.5) / 16.0))); Main.spriteBatch.Draw(TextureAssets.Gore[Main.gore[index].type].Value, new Vector2(Main.gore[index].position.X - Main.screenPosition.X + (float) (sourceRectangle.Width / 2), (float) ((double) Main.gore[index].position.Y - (double) Main.screenPosition.Y + (double) (sourceRectangle.Height / 2) - 2.0)) + vector2, new Microsoft.Xna.Framework.Rectangle?(sourceRectangle), alpha, Main.gore[index].rotation, new Vector2((float) (sourceRectangle.Width / 2), (float) (sourceRectangle.Height / 2)), Main.gore[index].scale, SpriteEffects.None, 0.0f); } else { Microsoft.Xna.Framework.Color alpha = Main.gore[index].GetAlpha(Lighting.GetColor((int) ((double) Main.gore[index].position.X + (double) TextureAssets.Gore[Main.gore[index].type].Width() * 0.5) / 16, (int) (((double) Main.gore[index].position.Y + (double) TextureAssets.Gore[Main.gore[index].type].Height() * 0.5) / 16.0))); Main.spriteBatch.Draw(TextureAssets.Gore[Main.gore[index].type].Value, new Vector2(Main.gore[index].position.X - Main.screenPosition.X + (float) (TextureAssets.Gore[Main.gore[index].type].Width() / 2), Main.gore[index].position.Y - Main.screenPosition.Y + (float) (TextureAssets.Gore[Main.gore[index].type].Height() / 2)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Gore[Main.gore[index].type].Width(), TextureAssets.Gore[Main.gore[index].type].Height())), alpha, Main.gore[index].rotation, new Vector2((float) (TextureAssets.Gore[Main.gore[index].type].Width() / 2), (float) (TextureAssets.Gore[Main.gore[index].type].Height() / 2)), Main.gore[index].scale, SpriteEffects.None, 0.0f); } } } } TimeLogger.DetailedDrawTime(24); } public void DrawHealthBar( float X, float Y, int Health, int MaxHealth, float alpha, float scale = 1f, bool noFlip = false) { if (Health <= 0) return; float num1 = (float) Health / (float) MaxHealth; if ((double) num1 > 1.0) num1 = 1f; int num2 = (int) (36.0 * (double) num1); float num3 = X - 18f * scale; float num4 = Y; if ((double) Main.player[Main.myPlayer].gravDir == -1.0 && !noFlip) { float num5 = num4 - Main.screenPosition.Y; num4 = Main.screenPosition.Y + (float) Main.screenHeight - num5; } float num6 = 0.0f; float maxValue = (float) byte.MaxValue; float num7 = num1 - 0.1f; float num8; float num9; if ((double) num7 > 0.5) { num8 = (float) byte.MaxValue; num9 = (float) ((double) byte.MaxValue * (1.0 - (double) num7) * 2.0); } else { num8 = (float) ((double) byte.MaxValue * (double) num7 * 2.0); num9 = (float) byte.MaxValue; } float num10 = 0.95f; float num11 = num9 * alpha * num10; float num12 = num8 * alpha * num10; float num13 = maxValue * alpha * num10; if ((double) num11 < 0.0) num11 = 0.0f; if ((double) num11 > (double) byte.MaxValue) num11 = (float) byte.MaxValue; if ((double) num12 < 0.0) num12 = 0.0f; if ((double) num12 > (double) byte.MaxValue) num12 = (float) byte.MaxValue; if ((double) num13 < 0.0) num13 = 0.0f; if ((double) num13 > (double) byte.MaxValue) num13 = (float) byte.MaxValue; Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color((int) (byte) num11, (int) (byte) num12, (int) (byte) num6, (int) (byte) num13); if (num2 < 3) num2 = 3; if (num2 < 34) { if (num2 < 36) Main.spriteBatch.Draw(TextureAssets.Hb2.Value, new Vector2((float) ((double) num3 - (double) Main.screenPosition.X + (double) num2 * (double) scale), num4 - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(2, 0, 2, TextureAssets.Hb2.Height())), color, 0.0f, new Vector2(0.0f, 0.0f), scale, SpriteEffects.None, 0.0f); if (num2 < 34) Main.spriteBatch.Draw(TextureAssets.Hb2.Value, new Vector2((float) ((double) num3 - (double) Main.screenPosition.X + (double) (num2 + 2) * (double) scale), num4 - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(num2 + 2, 0, 36 - num2 - 2, TextureAssets.Hb2.Height())), color, 0.0f, new Vector2(0.0f, 0.0f), scale, SpriteEffects.None, 0.0f); if (num2 > 2) Main.spriteBatch.Draw(TextureAssets.Hb1.Value, new Vector2(num3 - Main.screenPosition.X, num4 - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, num2 - 2, TextureAssets.Hb1.Height())), color, 0.0f, new Vector2(0.0f, 0.0f), scale, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.Hb1.Value, new Vector2((float) ((double) num3 - (double) Main.screenPosition.X + (double) (num2 - 2) * (double) scale), num4 - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(32, 0, 2, TextureAssets.Hb1.Height())), color, 0.0f, new Vector2(0.0f, 0.0f), scale, SpriteEffects.None, 0.0f); } else { if (num2 < 36) Main.spriteBatch.Draw(TextureAssets.Hb2.Value, new Vector2((float) ((double) num3 - (double) Main.screenPosition.X + (double) num2 * (double) scale), num4 - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(num2, 0, 36 - num2, TextureAssets.Hb2.Height())), color, 0.0f, new Vector2(0.0f, 0.0f), scale, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.Hb1.Value, new Vector2(num3 - Main.screenPosition.X, num4 - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, num2, TextureAssets.Hb1.Height())), color, 0.0f, new Vector2(0.0f, 0.0f), scale, SpriteEffects.None, 0.0f); } } public static float NPCAddHeight(NPC theNPC) { float num = 0.0f; if (theNPC.type == 125) num = 30f; else if (theNPC.type == 54) num = 2f; else if (theNPC.type == 205) num = 8f; else if (theNPC.type == 182) num = 24f; else if (theNPC.type == 178) num = 2f; else if (theNPC.type == 126) num = 30f; else if (theNPC.type == 6 || theNPC.type == 173) num = 26f; else if (theNPC.type == 94) num = 14f; else if (theNPC.type == 7 || theNPC.type == 8 || theNPC.type == 9) num = 13f; else if (theNPC.type == 98 || theNPC.type == 99 || theNPC.type == 100) num = 13f; else if (theNPC.type == 95 || theNPC.type == 96 || theNPC.type == 97) num = 13f; else if (theNPC.type == 10 || theNPC.type == 11 || theNPC.type == 12) num = 8f; else if (theNPC.type == 13 || theNPC.type == 14 || theNPC.type == 15) num = 26f; else if (theNPC.type == 175) num = 4f; else if (theNPC.type == 520) num = 2f; else if (theNPC.type >= 412 && theNPC.type <= 414) num = 18f; else if (theNPC.type == 48) num = 32f; else if (theNPC.type == 49 || theNPC.type == 51) num = 4f; else if (theNPC.type == 60) num = 10f; else if (theNPC.type == 62 || theNPC.type == 66 || theNPC.type == 156) num = 14f; else if (theNPC.type == 63 || theNPC.type == 64 || theNPC.type == 103) num = 4f; else if (theNPC.type == 65) num = 5f; else if (theNPC.type == 69) num = 4f; else if (theNPC.type == 70) num = -4f; else if (theNPC.type == 72) num = -2f; else if (theNPC.type == 83 || theNPC.type == 84) num = 20f; else if (theNPC.type == 150 || theNPC.type == 151 || theNPC.type == 158) num = 10f; else if (theNPC.type == 152) num = 6f; else if (theNPC.type == 153 || theNPC.type == 154) num = 2f; else if (theNPC.type == 165 || theNPC.type == 237 || theNPC.type == 238 || theNPC.type == 240 || theNPC.type == 531) num = 10f; else if (theNPC.type == 39 || theNPC.type == 40 || theNPC.type == 41) num = 26f; else if (theNPC.type >= 87 && theNPC.type <= 92) num = 56f; else if (theNPC.type >= 134 && theNPC.type <= 136) num = 30f; else if (theNPC.type == 169) num = 8f; else if (theNPC.type == 174) num = 6f; else if (theNPC.type == 369) num = 2f; else if (theNPC.type == 376) num = 6f; else if (theNPC.type == 579) num = -2f; else if (theNPC.type == 613 || theNPC.type == 612) num = 2f; switch (theNPC.type) { case 269: case 270: case 271: case 274: case 277: num -= 2f; break; } if (theNPC.townNPC && (double) theNPC.ai[0] == 5.0) { num -= 4f; if (theNPC.type == 637 || theNPC.type == 656) num -= 10f; } return num * theNPC.scale; } protected void DrawProjectiles() { PlayerInput.SetZoom_MouseInWorld(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, (Effect) null, Main.Transform); int num = 0; Main.CurrentDrawnEntity = (Entity) null; Main.CurrentDrawnEntityShader = 0; if (Main.ignoreErrors) { for (int i = 0; i < 1000; ++i) { if (Main.projectile[i].active && Main.projectile[i].type > 0 && !Main.projectile[i].hide) { ++num; try { this.DrawProj(i); } catch (Exception ex) { TimeLogger.DrawException(ex); Main.projectile[i].active = false; } } } } else { for (int i = 0; i < 1000; ++i) { if (Main.projectile[i].active && Main.projectile[i].type > 0 && !Main.projectile[i].hide) this.DrawProj(i); } } Main.CurrentDrawnEntity = (Entity) null; Main.CurrentDrawnEntityShader = 0; Main.spriteBatch.End(); TimeLogger.DetailedDrawTime(20); } public static int GetProjectileDesiredShader(int i) { int num = 0; if (Main.projectile[i].minion && Main.projectile[i].owner != (int) byte.MaxValue) num = Main.player[Main.projectile[i].owner].cMinion; if (Main.projHook[Main.projectile[i].type] && Main.projectile[i].owner != (int) byte.MaxValue) num = Main.player[Main.projectile[i].owner].cGrapple; if (Main.projPet[Main.projectile[i].type] && !Main.projectile[i].minion && Main.projectile[i].owner != (int) byte.MaxValue && Main.projectile[i].damage == 0 && !ProjectileID.Sets.LightPet[Main.projectile[i].type]) num = Main.player[Main.projectile[i].owner].cPet; if (!Main.projectile[i].minion && Main.projectile[i].owner != (int) byte.MaxValue && Main.projectile[i].damage == 0 && ProjectileID.Sets.LightPet[Main.projectile[i].type]) num = Main.player[Main.projectile[i].owner].cLight; if (Main.projectile[i].type == 623 && Main.projectile[i].owner != (int) byte.MaxValue) num = Main.player[Main.projectile[i].owner].cPet; return num; } private void RefreshPlayerDrawOrder() { this._playersThatDrawBehindNPCs.Clear(); this._playersThatDrawAfterProjectiles.Clear(); if (Main.gameMenu) return; for (int index = 0; index < (int) byte.MaxValue; ++index) { Player player = Main.player[index]; if (index != Main.myPlayer && player.active && !player.outOfRange) { if (player.isLockedToATile) this._playersThatDrawBehindNPCs.Add(player); else this._playersThatDrawAfterProjectiles.Add(player); } } Player localPlayer = Main.LocalPlayer; if (localPlayer.isLockedToATile) this._playersThatDrawBehindNPCs.Add(localPlayer); else this._playersThatDrawAfterProjectiles.Add(localPlayer); } protected void DrawPlayers_BehindNPCs() { Main.PotionOfReturnRenderer.DrawPlayers(Main.Camera, this._playersThatDrawBehindNPCs.Where((Func) (p => p.PotionOfReturnOriginalUsePosition.HasValue))); Main.PlayerRenderer.DrawPlayers(Main.Camera, (IEnumerable) this._playersThatDrawBehindNPCs); } protected void DrawPlayers_AfterProjectiles() { Main.PotionOfReturnRenderer.DrawPlayers(Main.Camera, this._playersThatDrawAfterProjectiles.Where((Func) (p => p.PotionOfReturnOriginalUsePosition.HasValue))); Main.PlayerRenderer.DrawPlayers(Main.Camera, (IEnumerable) this._playersThatDrawAfterProjectiles); } protected void DrawElderEye( SpriteBatch spriteBatch, Vector2 worldPosition, float opacity, float scale, int frameNumber, Microsoft.Xna.Framework.Color passedColor) { Texture2D texture2D = TextureAssets.Extra[78].Value; Vector2 origin = new Vector2(68f, 94f); Microsoft.Xna.Framework.Rectangle rectangle = texture2D.Frame(verticalFrames: 8, frameY: frameNumber); Vector2 position = worldPosition - Main.screenPosition; passedColor *= opacity; spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(rectangle), passedColor, 0.0f, origin, scale, SpriteEffects.None, 0.0f); } protected void DrawNPCs(bool behindTiles = false) { bool flag1 = false; Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) Main.screenPosition.X - 800, (int) Main.screenPosition.Y - 800, Main.screenWidth + 1600, Main.screenHeight + 1600); for (int iNPCIndex = 199; iNPCIndex >= 0; --iNPCIndex) { try { if (Main.npc[iNPCIndex].active) { if (Main.npc[iNPCIndex].type > 0) { if (Main.npc[iNPCIndex].type < 663) { if (!Main.npc[iNPCIndex].hide) { NPC npc1 = Main.npc[iNPCIndex]; npc1.position = npc1.position + Main.npc[iNPCIndex].netOffset; if (Main.npc[iNPCIndex].behindTiles == behindTiles) { if (Main.npc[iNPCIndex].type == 125 || Main.npc[iNPCIndex].type == 126) { if (!flag1) { flag1 = true; for (int index = 0; index < 200; ++index) { if (Main.npc[index].active && iNPCIndex != index && (Main.npc[index].type == 125 || Main.npc[index].type == 126)) { float num1 = Main.npc[index].position.X + (float) Main.npc[index].width * 0.5f; float num2 = Main.npc[index].position.Y + (float) Main.npc[index].height * 0.5f; Vector2 vector2 = new Vector2(Main.npc[iNPCIndex].position.X + (float) Main.npc[iNPCIndex].width * 0.5f, Main.npc[iNPCIndex].position.Y + (float) Main.npc[iNPCIndex].height * 0.5f); float num3 = num1 - vector2.X; float num4 = num2 - vector2.Y; float rotation = (float) Math.Atan2((double) num4, (double) num3) - 1.57f; bool flag2 = true; if (Math.Sqrt((double) num3 * (double) num3 + (double) num4 * (double) num4) > 2000.0) flag2 = false; while (flag2) { float num5 = (float) Math.Sqrt((double) num3 * (double) num3 + (double) num4 * (double) num4); if ((double) num5 < 40.0) { flag2 = false; } else { float num6 = (float) TextureAssets.Chain12.Height() / num5; float num7 = num3 * num6; float num8 = num4 * num6; vector2.X += num7; vector2.Y += num8; num3 = num1 - vector2.X; num4 = num2 - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.spriteBatch.Draw(TextureAssets.Chain12.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(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, 0.0f); } } } } } } else if (Main.npc[iNPCIndex].type == 263 && Main.npc[iNPCIndex].aiStyle == 52 && NPC.plantBoss >= 0) { Vector2 vector2 = new Vector2(Main.npc[iNPCIndex].position.X + (float) (Main.npc[iNPCIndex].width / 2), Main.npc[iNPCIndex].position.Y + (float) (Main.npc[iNPCIndex].height / 2)); float num9 = Main.npc[NPC.plantBoss].Center.X - vector2.X; float num10 = Main.npc[NPC.plantBoss].Center.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num10, (double) num9) - 1.57f; bool flag3 = true; while (flag3) { int height = 16; int num11 = 32; float num12 = (float) Math.Sqrt((double) num9 * (double) num9 + (double) num10 * (double) num10); if ((double) num12 < (double) num11) { height = (int) num12 - num11 + height; flag3 = false; } float num13 = (float) height / num12; float num14 = num9 * num13; float num15 = num10 * num13; vector2.X += num14; vector2.Y += num15; num9 = Main.npc[NPC.plantBoss].Center.X - vector2.X + Main.npc[NPC.plantBoss].netOffset.X; num10 = Main.npc[NPC.plantBoss].Center.Y - vector2.Y + Main.npc[NPC.plantBoss].netOffset.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.spriteBatch.Draw(TextureAssets.Chain26.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain26.Width(), height)), color, rotation, new Vector2((float) TextureAssets.Chain26.Width() * 0.5f, (float) TextureAssets.Chain26.Height() * 0.5f), 1f, SpriteEffects.None, 0.0f); } } else if (Main.npc[iNPCIndex].type == 264 && Main.npc[iNPCIndex].aiStyle == 53 && NPC.plantBoss >= 0) { int index = NPC.plantBoss; if ((double) Main.npc[iNPCIndex].ai[3] > 0.0) index = (int) Main.npc[iNPCIndex].ai[3] - 1; Vector2 vector2 = new Vector2(Main.npc[iNPCIndex].position.X + (float) (Main.npc[iNPCIndex].width / 2), Main.npc[iNPCIndex].position.Y + (float) (Main.npc[iNPCIndex].height / 2)); float num16 = Main.npc[index].Center.X - vector2.X; float num17 = Main.npc[index].Center.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num17, (double) num16) - 1.57f; bool flag4 = true; while (flag4) { int height = 16; int num18 = 32; float num19 = (float) Math.Sqrt((double) num16 * (double) num16 + (double) num17 * (double) num17); if ((double) num19 < (double) num18) { height = (int) num19 - num18 + height; flag4 = false; } float num20 = (float) height / num19; float num21 = num16 * num20; float num22 = num17 * num20; vector2.X += num21; vector2.Y += num22; num16 = Main.npc[index].Center.X - vector2.X + Main.npc[index].netOffset.X; num17 = Main.npc[index].Center.Y - vector2.Y + Main.npc[index].netOffset.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.spriteBatch.Draw(TextureAssets.Chain27.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain27.Width(), height)), color, rotation, new Vector2((float) TextureAssets.Chain27.Width() * 0.5f, (float) TextureAssets.Chain27.Height() * 0.5f), 1f, SpriteEffects.None, 0.0f); } } if (NPCID.Sets.MustAlwaysDraw[Main.npc[iNPCIndex].type] || rectangle.Intersects(new Microsoft.Xna.Framework.Rectangle((int) Main.npc[iNPCIndex].position.X, (int) Main.npc[iNPCIndex].position.Y, Main.npc[iNPCIndex].width, Main.npc[iNPCIndex].height))) { this.DrawNPCCheckAlt(Main.npc[iNPCIndex]); this.DrawNPC(iNPCIndex, behindTiles); } } NPC npc2 = Main.npc[iNPCIndex]; npc2.position = npc2.position - Main.npc[iNPCIndex].netOffset; } } } } } catch { Main.npc[iNPCIndex].active = false; } } } protected void DrawNPCCheckAlt(NPC n) { ITownNPCProfile profile; if (!TownNPCProfiles.Instance.GetProfile(n.type, out profile)) return; TextureAssets.Npc[n.type] = profile.GetTextureNPCShouldUse(n); } protected void DrawNPC(int iNPCIndex, bool behindTiles) { NPC rCurrentNPC = Main.npc[iNPCIndex]; Vector2 screenPosition = Main.screenPosition; this.DrawNPCDirect(Main.spriteBatch, rCurrentNPC, behindTiles, screenPosition); } public void DrawNPCDirect_QueenSlimeWings( NPC rCurrentNPC, SpriteBatch mySpriteBatch, Vector2 screenPos, Vector2 drawCenter, Microsoft.Xna.Framework.Color originColor) { Texture2D texture2D = TextureAssets.Extra[185].Value; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: 4, frameY: ((int) rCurrentNPC.localAI[3] / 6)); float scale = 0.8f; for (int index = 0; index < 2; ++index) { float x = 1f; float num1 = 0.0f; SpriteEffects effects = SpriteEffects.None; if (index == 1) { x = 0.0f; num1 = (float) (-(double) num1 + 2.0); effects = SpriteEffects.FlipHorizontally; } Vector2 origin = r.Size() * new Vector2(x, 0.5f); Vector2 vector2 = new Vector2(drawCenter.X + num1, drawCenter.Y); if ((double) rCurrentNPC.rotation != 0.0) vector2 = vector2.RotatedBy((double) rCurrentNPC.rotation, rCurrentNPC.Bottom); vector2 -= screenPos; float num2 = MathHelper.Clamp(rCurrentNPC.velocity.Y, -6f, 6f) * -0.1f; if (index == 0) num2 *= -1f; mySpriteBatch.Draw(texture2D, vector2, new Microsoft.Xna.Framework.Rectangle?(r), originColor, rCurrentNPC.rotation + num2, origin, scale, effects, 0.0f); } } public void DrawNPCDirect( SpriteBatch mySpriteBatch, NPC rCurrentNPC, bool behindTiles, Vector2 screenPos) { int type = rCurrentNPC.type; rCurrentNPC.SetFrameSize(); Vector3 vector3; if (rCurrentNPC.realLife == -1 && rCurrentNPC.life >= rCurrentNPC.lifeMax && !rCurrentNPC.boss) { vector3 = 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(); bool flag1 = (double) vector3.Length() > 0.432500004768372; bool flag2 = false; if (LockOnHelper.AimedTarget == rCurrentNPC) flag2 = true; else if ((double) rCurrentNPC.Distance(Main.player[Main.myPlayer].Center) < 350.0 & flag1) flag2 = true; if (flag2 && rCurrentNPC.lifeMax < 5) flag2 = false; if (flag2 && rCurrentNPC.aiStyle == 25 && (double) rCurrentNPC.ai[0] == 0.0) flag2 = false; rCurrentNPC.nameOver = !flag2 ? MathHelper.Clamp(rCurrentNPC.nameOver - 0.025f, 0.0f, 1f) : MathHelper.Clamp(rCurrentNPC.nameOver + 0.025f, 0.0f, 1f); } else rCurrentNPC.nameOver = MathHelper.Clamp(rCurrentNPC.nameOver - 0.025f, 0.0f, 1f); if (type == 1 && (double) rCurrentNPC.ai[0] == -999.0) return; if (type == 101) { bool flag3 = true; Vector2 vector2 = new Vector2(rCurrentNPC.position.X + (float) (rCurrentNPC.width / 2), rCurrentNPC.position.Y + (float) (rCurrentNPC.height / 2)); float num1 = (float) ((double) rCurrentNPC.ai[0] * 16.0 + 8.0) - vector2.X; float num2 = (float) ((double) rCurrentNPC.ai[1] * 16.0 + 8.0) - vector2.Y; float rotation = (float) Math.Atan2((double) num2, (double) num1) - 1.57f; bool flag4 = true; while (flag4) { float scale = 0.75f; int height = 28; float num3 = (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); if ((double) num3 < 28.0 * (double) scale) { height = (int) num3 - 40 + 28; flag4 = false; } float num4 = 20f * scale / num3; float num5 = num1 * num4; float num6 = num2 * num4; vector2.X += num5; vector2.Y += num6; num1 = (float) ((double) rCurrentNPC.ai[0] * 16.0 + 8.0) - vector2.X; num2 = (float) ((double) rCurrentNPC.ai[1] * 16.0 + 8.0) - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); if (rCurrentNPC.IsABestiaryIconDummy) color = rCurrentNPC.GetBestiaryEntryColor(); if (!flag3) { flag3 = true; mySpriteBatch.Draw(TextureAssets.Chain10.Value, new Vector2(vector2.X - screenPos.X, vector2.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle?(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), scale, SpriteEffects.None, 0.0f); } else { flag3 = false; mySpriteBatch.Draw(TextureAssets.Chain11.Value, new Vector2(vector2.X - screenPos.X, vector2.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle?(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), scale, SpriteEffects.None, 0.0f); } } } else if (rCurrentNPC.aiStyle == 13) { Vector2 vector2 = new Vector2(rCurrentNPC.position.X + (float) (rCurrentNPC.width / 2), rCurrentNPC.position.Y + (float) (rCurrentNPC.height / 2)); float num7 = (float) ((double) rCurrentNPC.ai[0] * 16.0 + 8.0) - vector2.X; float num8 = (float) ((double) rCurrentNPC.ai[1] * 16.0 + 8.0) - vector2.Y; float rotation = (float) Math.Atan2((double) num8, (double) num7) - 1.57f; bool flag = true; while (flag) { int height = 28; int num9 = 40; if (type == 259 || type == 260) { num9 = 20; height = 12; } float num10 = (float) Math.Sqrt((double) num7 * (double) num7 + (double) num8 * (double) num8); if ((double) num10 < (double) num9) { height = (int) num10 - num9 + height; flag = false; } float num11 = (float) height / num10; float num12 = num7 * num11; float num13 = num8 * num11; vector2.X += num12; vector2.Y += num13; num7 = (float) ((double) rCurrentNPC.ai[0] * 16.0 + 8.0) - vector2.X; num8 = (float) ((double) rCurrentNPC.ai[1] * 16.0 + 8.0) - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); if (rCurrentNPC.IsABestiaryIconDummy) color = rCurrentNPC.GetBestiaryEntryColor(); if (type == 259 || type == 260) { color.B = byte.MaxValue; if (color.R < (byte) 100) color.R = (byte) 100; if (color.G < (byte) 150) color.G = (byte) 150; } switch (type) { case 56: mySpriteBatch.Draw(TextureAssets.Chain5.Value, new Vector2(vector2.X - screenPos.X, vector2.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle?(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), 1f, SpriteEffects.None, 0.0f); continue; case 175: mySpriteBatch.Draw(TextureAssets.Chain14.Value, new Vector2(vector2.X - screenPos.X, vector2.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain14.Width(), height)), color, rotation, new Vector2((float) TextureAssets.Chain14.Width() * 0.5f, (float) TextureAssets.Chain14.Height() * 0.5f), 1f, SpriteEffects.None, 0.0f); continue; case 259: mySpriteBatch.Draw(TextureAssets.Chain24.Value, new Vector2(vector2.X - screenPos.X, vector2.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain24.Width(), height)), color, rotation, new Vector2((float) TextureAssets.Chain24.Width() * 0.5f, (float) TextureAssets.Chain24.Height() * 0.5f), 1f, SpriteEffects.None, 0.0f); continue; case 260: mySpriteBatch.Draw(TextureAssets.Chain25.Value, new Vector2(vector2.X - screenPos.X, vector2.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain25.Width(), height)), color, rotation, new Vector2((float) TextureAssets.Chain25.Width() * 0.5f, (float) TextureAssets.Chain25.Height() * 0.5f), 1f, SpriteEffects.None, 0.0f); continue; default: mySpriteBatch.Draw(TextureAssets.Chain4.Value, new Vector2(vector2.X - screenPos.X, vector2.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle?(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), 1f, SpriteEffects.None, 0.0f); continue; } } } if (type == 327) { float rotation = 0.0f; Vector2 vector2 = new Vector2(rCurrentNPC.Center.X, rCurrentNPC.Center.Y + 80f); int num = (int) rCurrentNPC.localAI[1]; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); mySpriteBatch.Draw(TextureAssets.PumpkingCloak.Value, new Vector2(vector2.X - screenPos.X, vector2.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, TextureAssets.PumpkingCloak.Height() / 5 * num, TextureAssets.PumpkingCloak.Width(), TextureAssets.PumpkingCloak.Height() / 5)), color, rotation, new Vector2((float) TextureAssets.PumpkingCloak.Width() * 0.5f, (float) ((double) TextureAssets.PumpkingCloak.Height() * 0.5 / 5.0)), 1f, SpriteEffects.None, 0.0f); } if (type == 328) { Vector2 vector2 = new Vector2((float) ((double) rCurrentNPC.position.X + (double) rCurrentNPC.width * 0.5 - 5.0 * (double) rCurrentNPC.ai[0]), rCurrentNPC.position.Y + 20f); for (int index = 0; index < 2; ++index) { float num14 = Main.npc[(int) rCurrentNPC.ai[1]].position.X + (float) (Main.npc[(int) rCurrentNPC.ai[1]].width / 2) - vector2.X; float num15 = (float) ((double) Main.npc[(int) rCurrentNPC.ai[1]].position.Y + (double) (Main.npc[(int) rCurrentNPC.ai[1]].height / 2) - 30.0) - vector2.Y; float num16; float num17; float num18; if (index == 0) { num16 = num14 - 200f * rCurrentNPC.ai[0]; num17 = num15 + 130f; num18 = 92f / (float) Math.Sqrt((double) num16 * (double) num16 + (double) num17 * (double) num17); vector2.X += num16 * num18; vector2.Y += num17 * num18; } else { num16 = num14 - 50f * rCurrentNPC.ai[0]; num17 = num15 + 80f; num18 = 60f / (float) Math.Sqrt((double) num16 * (double) num16 + (double) num17 * (double) num17); vector2.X += num16 * num18; vector2.Y += num17 * num18; } float rotation = (float) Math.Atan2((double) num17, (double) num16) - 1.57f; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); mySpriteBatch.Draw(TextureAssets.PumpkingArm.Value, new Vector2(vector2.X - screenPos.X, vector2.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.PumpkingArm.Width(), TextureAssets.PumpkingArm.Height())), color, rotation, new Vector2((float) TextureAssets.PumpkingArm.Width() * 0.5f, (float) TextureAssets.PumpkingArm.Height() * 0.5f), 1f, SpriteEffects.None, 0.0f); if (index == 0) { vector2.X += (float) ((double) num16 * (double) num18 / 2.0); vector2.Y += (float) ((double) num17 * (double) num18 / 2.0); } } } if (type == 36) { Vector2 vector2 = new Vector2((float) ((double) rCurrentNPC.position.X + (double) rCurrentNPC.width * 0.5 - 5.0 * (double) rCurrentNPC.ai[0]), rCurrentNPC.position.Y + 20f); for (int index1 = 0; index1 < 2; ++index1) { float num19 = Main.npc[(int) rCurrentNPC.ai[1]].position.X + (float) (Main.npc[(int) rCurrentNPC.ai[1]].width / 2) - vector2.X; float num20 = Main.npc[(int) rCurrentNPC.ai[1]].position.Y + (float) (Main.npc[(int) rCurrentNPC.ai[1]].height / 2) - vector2.Y; float num21; float num22; float num23; if (index1 == 0) { num21 = num19 - 200f * rCurrentNPC.ai[0]; num22 = num20 + 130f; num23 = 92f / (float) Math.Sqrt((double) num21 * (double) num21 + (double) num22 * (double) num22); vector2.X += num21 * num23; vector2.Y += num22 * num23; } else { num21 = num19 - 50f * rCurrentNPC.ai[0]; num22 = num20 + 80f; num23 = 60f / (float) Math.Sqrt((double) num21 * (double) num21 + (double) num22 * (double) num22); vector2.X += num21 * num23; vector2.Y += num22 * num23; } float rotation = (float) Math.Atan2((double) num22, (double) num21) - 1.57f; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); mySpriteBatch.Draw(TextureAssets.BoneArm.Value, new Vector2(vector2.X - screenPos.X, vector2.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.BoneArm.Width(), TextureAssets.BoneArm.Height())), color, rotation, new Vector2((float) TextureAssets.BoneArm.Width() * 0.5f, (float) TextureAssets.BoneArm.Height() * 0.5f), 1f, SpriteEffects.None, 0.0f); if (index1 == 0) { vector2.X += (float) ((double) num21 * (double) num23 / 2.0); vector2.Y += (float) ((double) num22 * (double) num23 / 2.0); } else if (this.IsActive) { vector2.X += (float) ((double) num21 * (double) num23 - 16.0); vector2.Y += (float) ((double) num22 * (double) num23 - 6.0); int index2 = Dust.NewDust(new Vector2(vector2.X, vector2.Y), 30, 10, 5, num21 * 0.02f, num22 * 0.02f, Scale: 2f); Main.dust[index2].noGravity = true; } } } if (rCurrentNPC.aiStyle == 47) { float scale = 1f; Vector2 vector2 = new Vector2(rCurrentNPC.Center.X, rCurrentNPC.Center.Y); Vector2 center = rCurrentNPC.Center; if (NPC.golemBoss != -1) center = Main.npc[NPC.golemBoss].Center; float num24 = center.X - vector2.X; float num25 = center.Y - vector2.Y - 7f; float num26 = type != 247 ? num24 + 66f : num24 - 70f; if (Main.getGoodWorld) { if (type == 247) num26 += 40f; else num26 -= 40f; scale = 0.5f; } float rotation = (float) Math.Atan2((double) num25, (double) num26) - 1.57f; bool flag = true; while (flag) { float num27 = (float) Math.Sqrt((double) num26 * (double) num26 + (double) num25 * (double) num25); if ((double) num27 < 16.0) { flag = false; } else { float num28 = 16f * scale / num27; float num29 = num26 * num28; float num30 = num25 * num28; vector2.X += num29; vector2.Y += num30; float num31 = center.X - vector2.X; num25 = center.Y - vector2.Y - 7f; num26 = type != 247 ? num31 + 66f : num31 - 70f; if (Main.getGoodWorld) { num25 += 8f; if (type == 247) num26 += 40f; else num26 -= 40f; scale = 0.5f; } Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); mySpriteBatch.Draw(TextureAssets.Chain21.Value, new Vector2(vector2.X - screenPos.X, vector2.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain21.Width(), TextureAssets.Chain21.Height())), color, rotation, new Vector2((float) TextureAssets.Chain21.Width() * 0.5f, (float) TextureAssets.Chain21.Height() * 0.5f), scale, SpriteEffects.None, 0.0f); } } } if (rCurrentNPC.aiStyle >= 33 && rCurrentNPC.aiStyle <= 36) { Vector2 vector2 = new Vector2((float) ((double) rCurrentNPC.position.X + (double) rCurrentNPC.width * 0.5 - 5.0 * (double) rCurrentNPC.ai[0]), rCurrentNPC.position.Y + 20f); for (int index3 = 0; index3 < 2; ++index3) { float num32 = Main.npc[(int) rCurrentNPC.ai[1]].position.X + (float) (Main.npc[(int) rCurrentNPC.ai[1]].width / 2) - vector2.X; float num33 = Main.npc[(int) rCurrentNPC.ai[1]].position.Y + (float) (Main.npc[(int) rCurrentNPC.ai[1]].height / 2) - vector2.Y; float num34; float num35; float num36; if (index3 == 0) { num34 = num32 - 200f * rCurrentNPC.ai[0]; num35 = num33 + 130f; num36 = 92f / (float) Math.Sqrt((double) num34 * (double) num34 + (double) num35 * (double) num35); vector2.X += num34 * num36; vector2.Y += num35 * num36; } else { num34 = num32 - 50f * rCurrentNPC.ai[0]; num35 = num33 + 80f; num36 = 60f / (float) Math.Sqrt((double) num34 * (double) num34 + (double) num35 * (double) num35); vector2.X += num34 * num36; vector2.Y += num35 * num36; } float rotation = (float) Math.Atan2((double) num35, (double) num34) - 1.57f; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); mySpriteBatch.Draw(TextureAssets.BoneArm2.Value, new Vector2(vector2.X - screenPos.X, vector2.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.BoneArm.Width(), TextureAssets.BoneArm.Height())), color, rotation, new Vector2((float) TextureAssets.BoneArm.Width() * 0.5f, (float) TextureAssets.BoneArm.Height() * 0.5f), 1f, SpriteEffects.None, 0.0f); if (index3 == 0) { vector2.X += (float) ((double) num34 * (double) num36 / 2.0); vector2.Y += (float) ((double) num35 * (double) num36 / 2.0); } else if (this.IsActive) { vector2.X += (float) ((double) num34 * (double) num36 - 16.0); vector2.Y += (float) ((double) num35 * (double) num36 - 6.0); int index4 = Dust.NewDust(new Vector2(vector2.X, vector2.Y), 30, 10, 6, num34 * 0.02f, num35 * 0.02f, Scale: 2.5f); Main.dust[index4].noGravity = true; } } } if (rCurrentNPC.aiStyle == 20) { Vector2 vector2 = new Vector2(rCurrentNPC.position.X + (float) (rCurrentNPC.width / 2), rCurrentNPC.position.Y + (float) (rCurrentNPC.height / 2)); float num37 = rCurrentNPC.ai[1] - vector2.X; float num38 = rCurrentNPC.ai[2] - vector2.Y; float rotation = (float) Math.Atan2((double) num38, (double) num37) - 1.57f; rCurrentNPC.rotation = rotation; bool flag = true; while (flag) { int height = 12; float num39 = (float) Math.Sqrt((double) num37 * (double) num37 + (double) num38 * (double) num38); if ((double) num39 < 20.0) { height = (int) num39 - 20 + 12; flag = false; } float num40 = 12f / num39; float num41 = num37 * num40; float num42 = num38 * num40; vector2.X += num41; vector2.Y += num42; num37 = rCurrentNPC.ai[1] - vector2.X; num38 = rCurrentNPC.ai[2] - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); mySpriteBatch.Draw(TextureAssets.Chain.Value, new Vector2(vector2.X - screenPos.X, vector2.Y - screenPos.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain.Width(), height)), color, rotation, new Vector2((float) TextureAssets.Chain.Width() * 0.5f, (float) TextureAssets.Chain.Height() * 0.5f), 1f, SpriteEffects.None, 0.0f); } mySpriteBatch.Draw(TextureAssets.SpikeBase.Value, new Vector2(rCurrentNPC.ai[1] - screenPos.X, rCurrentNPC.ai[2] - screenPos.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.SpikeBase.Width(), TextureAssets.SpikeBase.Height())), Lighting.GetColor((int) rCurrentNPC.ai[1] / 16, (int) ((double) rCurrentNPC.ai[2] / 16.0)), rotation - 0.75f, new Vector2((float) TextureAssets.SpikeBase.Width() * 0.5f, (float) TextureAssets.SpikeBase.Height() * 0.5f), 1f, SpriteEffects.None, 0.0f); } Microsoft.Xna.Framework.Color npcColor1 = 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)); if (rCurrentNPC.IsABestiaryIconDummy) npcColor1 = rCurrentNPC.GetBestiaryEntryColor(); if (type >= 277 && type <= 280) { if (npcColor1.R < byte.MaxValue) npcColor1.R = byte.MaxValue; if (npcColor1.G < (byte) 175) npcColor1.G = (byte) 175; } if (type == -4) { int r1 = (int) npcColor1.R; int g1 = (int) npcColor1.G; int b1 = (int) npcColor1.B; int r2 = r1 * 2; if (r2 > (int) byte.MaxValue) r2 = (int) byte.MaxValue; int g2 = g1 * 2; if (g2 > (int) byte.MaxValue) g2 = (int) byte.MaxValue; int b2 = b1 * 2; if (b2 > (int) byte.MaxValue) b2 = (int) byte.MaxValue; npcColor1 = new Microsoft.Xna.Framework.Color(r2, g2, b2); } if (behindTiles && type != 113 && type != 114) { int num43 = (int) (((double) rCurrentNPC.position.X - 8.0) / 16.0); int num44 = (int) (((double) rCurrentNPC.position.X + (double) rCurrentNPC.width + 8.0) / 16.0); int num45 = (int) (((double) rCurrentNPC.position.Y - 8.0) / 16.0); int num46 = (int) (((double) rCurrentNPC.position.Y + (double) rCurrentNPC.height + 8.0) / 16.0); for (int x = num43; x <= num44; ++x) { for (int y = num45; y <= num46; ++y) { if ((double) Lighting.Brightness(x, y) == 0.0) npcColor1 = Microsoft.Xna.Framework.Color.Black; } } } Microsoft.Xna.Framework.Color npcColor2 = rCurrentNPC.GetNPCColorTintedByBuffs(npcColor1); if (type == 50) { Vector2 zero = Vector2.Zero; float num = 0.0f; zero.Y -= rCurrentNPC.velocity.Y; zero.X -= rCurrentNPC.velocity.X * 2f; float rotation = num + rCurrentNPC.velocity.X * 0.05f; if (rCurrentNPC.frame.Y == 120) zero.Y += 2f; if (rCurrentNPC.frame.Y == 360) zero.Y -= 2f; if (rCurrentNPC.frame.Y == 480) zero.Y -= 6f; 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?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Ninja.Width(), TextureAssets.Ninja.Height())), npcColor2, rotation, new Vector2((float) (TextureAssets.Ninja.Width() / 2), (float) (TextureAssets.Ninja.Height() / 2)), 1f, SpriteEffects.None, 0.0f); } if (type == 71) { Vector2 zero = Vector2.Zero; float num = 0.0f; zero.Y -= rCurrentNPC.velocity.Y * 0.3f; zero.X -= rCurrentNPC.velocity.X * 0.6f; float rotation = num + rCurrentNPC.velocity.X * 0.09f; if (rCurrentNPC.frame.Y == 120) zero.Y += 2f; if (rCurrentNPC.frame.Y == 360) zero.Y -= 2f; if (rCurrentNPC.frame.Y == 480) zero.Y -= 6f; Main.instance.LoadItem(327); mySpriteBatch.Draw(TextureAssets.Item[327].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?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Item[327].Width(), TextureAssets.Item[327].Height())), npcColor2, rotation, new Vector2((float) (TextureAssets.Item[327].Width() / 2), (float) (TextureAssets.Item[327].Height() / 2)), 1f, SpriteEffects.None, 0.0f); } if (type == 69) mySpriteBatch.Draw(TextureAssets.AntLion.Value, new Vector2(rCurrentNPC.position.X - screenPos.X + (float) (rCurrentNPC.width / 2), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height + 14.0)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.AntLion.Width(), TextureAssets.AntLion.Height())), npcColor2, (float) (-(double) rCurrentNPC.rotation * 0.300000011920929), new Vector2((float) (TextureAssets.AntLion.Width() / 2), (float) (TextureAssets.AntLion.Height() / 2)), 1f, SpriteEffects.None, 0.0f); if (type == 1 && (double) rCurrentNPC.ai[1] > 0.0) Main.DrawNPC_SlimeItem(rCurrentNPC, type, npcColor2, 0.0f); float addY = 0.0f; float addHeight = Main.NPCAddHeight(rCurrentNPC); Vector2 halfSize = new Vector2((float) (TextureAssets.Npc[type].Width() / 2), (float) (TextureAssets.Npc[type].Height() / Main.npcFrameCount[type] / 2)); if (type == 108 || type == 124 || type == 625) { addY = 2f; } else { switch (type) { case 357: addY = rCurrentNPC.localAI[0]; break; case 467: addY = 7f; break; case 477: addHeight = 22f; break; case 478: addY -= 2f; break; case 483: addY = 14f; break; case 484: addY = 2f; break; case 490: addY = 4f; break; case 537: addY = 2f; break; case 581: addY = -6f; break; case 606: addY -= 2f; break; default: if (type == 612 || type == 613) { addY -= 2f; break; } if (type == 469 && (double) rCurrentNPC.ai[2] == 1.0) { addY = 14f; break; } switch (type) { case 4: halfSize = new Vector2(55f, 107f); break; case 125: halfSize = new Vector2(55f, 107f); break; case 126: halfSize = new Vector2(55f, 107f); break; default: if (type == 626 || type == 627) { if (rCurrentNPC.wet) { addY = -2f; halfSize = rCurrentNPC.frame.Size() * new Vector2(0.5f, 0.5f) + new Vector2(0.0f, -4f); break; } addY = 2f; break; } if (type == 63 || type == 64 || type == 103) { halfSize.Y += 4f; break; } switch (type) { case 69: halfSize.Y += 8f; break; case 262: halfSize.Y = 77f; addHeight += 26f; break; case 264: halfSize.Y = 21f; addHeight += 2f; break; case 266: addHeight += 50f; break; case 268: addHeight += 16f; break; case 288: addHeight += 6f; break; } break; } break; } } if (rCurrentNPC.aiStyle == 10 || type == 72) npcColor2 = Microsoft.Xna.Framework.Color.White; SpriteEffects spriteEffects = SpriteEffects.None; if (rCurrentNPC.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; if (type == 124 && (double) rCurrentNPC.localAI[0] == 0.0) { int num = 0; if (rCurrentNPC.frame.Y > 56) num += 4; int index = num + rCurrentNPC.frame.Y / 56; if (index >= Main.OffsetsPlayerHeadgear.Length) index = 0; float y = Main.OffsetsPlayerHeadgear[index].Y; this.LoadProjectile(582); Texture2D texture2D = TextureAssets.Projectile[582].Value; Vector2 position = rCurrentNPC.Center - screenPos - new Vector2((float) texture2D.Width, (float) (texture2D.Height / Main.npcFrameCount[type])) * rCurrentNPC.scale / 2f + new Vector2(0.0f, addY + addHeight + rCurrentNPC.gfxOffY + y) + new Vector2((float) (-rCurrentNPC.spriteDirection * 2), -2f); mySpriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(), rCurrentNPC.GetAlpha(npcColor2), rCurrentNPC.rotation, texture2D.Size() * new Vector2(0.0f, 0.5f), rCurrentNPC.scale, spriteEffects, 0.0f); } if (type == 427 || type == 426 || type == 428 || type == 581 || type == 521 || type == 523 || type == 541 || type >= 542 && type <= 545 || 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) { Texture2D texture = TextureAssets.Npc[type].Value; Microsoft.Xna.Framework.Color secondColor = Microsoft.Xna.Framework.Color.White; float amount1 = 0.0f; float amount2 = 0.0f; int num47 = 0; int num48 = 0; int num49 = 1; int num50 = 15; int num51 = 0; float scale1 = rCurrentNPC.scale; float num52 = rCurrentNPC.scale; int num53 = 0; float t1 = 0.0f; float num54 = 0.0f; float num55 = 0.0f; Microsoft.Xna.Framework.Color newColor1 = npcColor2; Vector2 origin1 = halfSize; switch (type) { case 426: num53 = 4; num54 = 4f; t1 = (float) (Math.Cos((double) Main.GlobalTimeWrappedHourly % 1.20000004768372 / 1.20000004768372 * 6.28318548202515) / 2.0 + 0.5); secondColor = Microsoft.Xna.Framework.Color.Turquoise; amount1 = 0.5f; num47 = 6; num48 = 2; num50 = num47; break; case 427: num47 = 8; num48 = 2; num50 = num47 * 3; break; case 521: num47 = 10; num48 = 2; num50 = num47; num51 = 1; num52 = 0.3f; break; case 523: num53 = 3; num54 = 10f * rCurrentNPC.scale; amount1 = 0.5f; amount2 = 0.8f; secondColor = Microsoft.Xna.Framework.Color.HotPink; secondColor.A = (byte) 128; num55 = rCurrentNPC.localAI[0]; t1 = rCurrentNPC.localAI[1]; break; case 541: num53 = 4; num54 = 6f; t1 = (float) (Math.Cos((double) Main.GlobalTimeWrappedHourly % 2.40000009536743 / 2.40000009536743 * 6.28318548202515) / 2.0 + 0.5); secondColor = Microsoft.Xna.Framework.Color.Gold; amount1 = 0.5f; break; case 542: case 543: case 544: case 545: num47 = 6; num48 = 3; num50 = num47 * 2; break; case 546: num47 = 8; num48 = 2; num50 = num47 * 3; break; case 552: case 553: case 554: case 555: case 556: case 557: case 561: case 562: case 563: case 568: case 569: case 570: case 571: case 572: case 573: num47 = 0; if (type == 561 || type == 562 || type == 563) addHeight = -8f; if (type == 555 || type == 556 || type == 557) addHeight = -5f; if (type == 572 || type == 573) addHeight = -4f; if (type == 570 || type == 571) { spriteEffects ^= SpriteEffects.FlipHorizontally; addHeight = -2f; } if (type == 568 || type == 569) { spriteEffects ^= SpriteEffects.FlipHorizontally; addHeight = -3f; num53 = 4; num54 = 4f; t1 = (float) (Math.Cos((double) Main.GlobalTimeWrappedHourly % 1.5 / 1.5 * 6.28318548202515) / 6.0 + 0.75); secondColor = Microsoft.Xna.Framework.Color.HotPink; secondColor.A = (byte) 127; amount1 = 0.5f; } if ((double) rCurrentNPC.localAI[3] < 60.0) { float num56 = rCurrentNPC.localAI[3] / 60f; num53 = 3; t1 = (float) (1.0 - (double) num56 * (double) num56); num54 = 8f; secondColor = new Microsoft.Xna.Framework.Color((int) sbyte.MaxValue, 0, (int) byte.MaxValue, 0); amount2 = 1f; newColor1 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, newColor1, num56 * num56); break; } break; case 558: case 559: case 560: case 574: case 575: if ((double) rCurrentNPC.ai[0] != 2.0) { num47 = 0; break; } num47 = 6; num48 = 2; num50 = num47 * 3; num51 = 1; break; case 566: case 567: case 578: num47 = 0; addHeight = -2f; break; case 581: num47 = 6; num48 = 2; num50 = num47 * 3; break; case 618: float num57 = 90f; float num58 = 180f; if ((double) rCurrentNPC.ai[0] == 1.0 && (double) rCurrentNPC.ai[1] < (double) num57) { int num59 = 3; float num60 = num57 / (float) num59; double num61 = (double) rCurrentNPC.ai[1] % (double) num60 / (double) num60; num53 = 6; num54 = 15f; t1 = (float) (num61 * 0.800000011920929 + 0.200000002980232); } if ((double) rCurrentNPC.ai[0] == 3.0 && (double) rCurrentNPC.ai[1] < (double) num58) { int num62 = 1; float num63 = num58 / (float) num62; float num64 = rCurrentNPC.ai[1] % num63 / num63; num53 = 4; num54 = 25f; t1 = num64; Vector2 vector2 = rCurrentNPC.scale * new Vector2(1f, (float) (0.5 + (double) num64 * 0.75)); Texture2D texture2D = TextureAssets.Extra[59].Value; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(); Vector2 origin2 = r.Size() * new Vector2(0.5f, 0.5f); for (int index = 0; index < num53; ++index) { Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.White * (float) ((double) Utils.GetLerpValue(0.0f, 0.5f, t1, false) * (double) Utils.GetLerpValue(1f, 0.5f, t1, false) * 0.25); color.A = (byte) 0; color.G = (byte) 0; color.B = (byte) 0; float num65 = (float) ((double) index / (double) num53 * 6.28318548202515) + rCurrentNPC.rotation + num55; Vector2 position = rCurrentNPC.Center + num65.ToRotationVector2() * num54 * t1 - screenPos - new Vector2((float) texture.Width, (float) (texture.Height / Main.npcFrameCount[type])) * rCurrentNPC.scale / 2f + (halfSize * rCurrentNPC.scale + new Vector2(0.0f, addY + addHeight + rCurrentNPC.gfxOffY)); mySpriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(r), color, num65, origin2, vector2 * 1.8f, spriteEffects, 0.0f); } for (int index = 0; index < num53; ++index) { Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.White * (float) ((double) Utils.GetLerpValue(0.0f, 0.5f, t1, false) * (double) Utils.GetLerpValue(1f, 0.5f, t1, false) * 0.25); color.A = (byte) 0; float num66 = (float) ((double) index / (double) num53 * 6.28318548202515) + rCurrentNPC.rotation + num55; Vector2 position = rCurrentNPC.Center + num66.ToRotationVector2() * num54 * t1 - screenPos - new Vector2((float) texture.Width, (float) (texture.Height / Main.npcFrameCount[type])) * rCurrentNPC.scale / 2f + (halfSize * rCurrentNPC.scale + new Vector2(0.0f, addY + addHeight + rCurrentNPC.gfxOffY)); mySpriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(r), color, num66, origin2, vector2 * 1.5f, spriteEffects, 0.0f); } break; } break; case 620: addHeight = -9f; origin1 = rCurrentNPC.frame.Size() * new Vector2(0.5f, 0.5f) + new Vector2((float) (-4 * rCurrentNPC.spriteDirection), 0.0f); num53 = 4; num54 = 6f; t1 = (float) (Math.Cos((double) Main.GlobalTimeWrappedHourly % 2.40000009536743 / 2.40000009536743 * 6.28318548202515) / 2.0 + 0.5); secondColor = Microsoft.Xna.Framework.Color.Gold; amount1 = 0.5f; num47 = 6; num48 = 2; num50 = num47 * 3; num51 = 1; break; case 661: num53 = 6; num54 = 6f; t1 = MathHelper.Max((float) (Math.Cos((double) Main.GlobalTimeWrappedHourly % 2.40000009536743 / 2.40000009536743 * 6.28318548202515) / 2.0 + 0.5), Utils.GetLerpValue(0.0f, 60f, rCurrentNPC.ai[2], true)); amount1 = 0.5f; break; } for (int index = num49; index < num47; index += num48) { ref Vector2 local = ref rCurrentNPC.oldPos[index]; Microsoft.Xna.Framework.Color newColor2 = Microsoft.Xna.Framework.Color.Lerp(newColor1, secondColor, amount1); Microsoft.Xna.Framework.Color color = rCurrentNPC.GetAlpha(newColor2) * ((float) (num47 - index) / (float) num50); double rotation = (double) rCurrentNPC.rotation; if (num51 == 1) { double num67 = (double) rCurrentNPC.oldRot[index]; } float scale2 = MathHelper.Lerp(scale1, num52, (float) (1.0 - (double) (num47 - index) / (double) num50)); Vector2 position = rCurrentNPC.oldPos[index] + new Vector2((float) rCurrentNPC.width, (float) rCurrentNPC.height) / 2f - screenPos - new Vector2((float) texture.Width, (float) (texture.Height / Main.npcFrameCount[type])) * rCurrentNPC.scale / 2f + (halfSize * rCurrentNPC.scale + new Vector2(0.0f, addY + addHeight + rCurrentNPC.gfxOffY)); mySpriteBatch.Draw(texture, position, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), color, rCurrentNPC.rotation, halfSize, scale2, spriteEffects, 0.0f); } for (int index = 0; index < num53; ++index) { Microsoft.Xna.Framework.Color newColor3 = Microsoft.Xna.Framework.Color.Lerp(npcColor2, secondColor, amount1); Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.Lerp(rCurrentNPC.GetAlpha(newColor3), secondColor, amount2) * (1f - t1); Vector2 position = rCurrentNPC.Center + ((float) ((double) index / (double) num53 * 6.28318548202515) + rCurrentNPC.rotation + num55).ToRotationVector2() * num54 * t1 - screenPos - new Vector2((float) texture.Width, (float) (texture.Height / Main.npcFrameCount[type])) * rCurrentNPC.scale / 2f + (halfSize * rCurrentNPC.scale + new Vector2(0.0f, addY + addHeight + rCurrentNPC.gfxOffY)); mySpriteBatch.Draw(texture, position, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), color, rCurrentNPC.rotation, origin1, rCurrentNPC.scale, spriteEffects, 0.0f); } Vector2 position1 = rCurrentNPC.Center - screenPos - new Vector2((float) texture.Width, (float) (texture.Height / Main.npcFrameCount[type])) * rCurrentNPC.scale / 2f + (halfSize * rCurrentNPC.scale + new Vector2(0.0f, addY + addHeight + rCurrentNPC.gfxOffY)); mySpriteBatch.Draw(texture, position1, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), rCurrentNPC.GetAlpha(newColor1), rCurrentNPC.rotation, origin1, rCurrentNPC.scale, spriteEffects, 0.0f); if (type == 427) mySpriteBatch.Draw(TextureAssets.GlowMask[152].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); else if (type == 426) mySpriteBatch.Draw(TextureAssets.GlowMask[153].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(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, 0.0f); if (type == 541) { Microsoft.Xna.Framework.Color color1 = new Microsoft.Xna.Framework.Color((int) sbyte.MaxValue - rCurrentNPC.alpha, (int) sbyte.MaxValue - rCurrentNPC.alpha, (int) sbyte.MaxValue - rCurrentNPC.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Gold); for (int index = 0; index < num53; ++index) { Microsoft.Xna.Framework.Color newColor4 = color1; Microsoft.Xna.Framework.Color color2 = rCurrentNPC.GetAlpha(newColor4) * (1f - t1); Vector2 position2 = rCurrentNPC.Center + ((float) ((double) index / (double) num53 * 6.28318548202515) + rCurrentNPC.rotation + num55).ToRotationVector2() * (float) (4.0 * (double) t1 + 2.0) - screenPos - new Vector2((float) texture.Width, (float) (texture.Height / Main.npcFrameCount[type])) * rCurrentNPC.scale / 2f + (halfSize * rCurrentNPC.scale + new Vector2(0.0f, addY + addHeight + rCurrentNPC.gfxOffY)); mySpriteBatch.Draw(TextureAssets.GlowMask[216].Value, position2, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), color2, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } mySpriteBatch.Draw(TextureAssets.GlowMask[216].Value, position1, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), color1, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } if (type == 661) { num55 = MathHelper.Lerp(0.0f, 3f, Utils.GetLerpValue(0.0f, 60f, rCurrentNPC.ai[2], true)); for (int index = 0; index < num53; ++index) { Microsoft.Xna.Framework.Color newColor5 = new Microsoft.Xna.Framework.Color((int) sbyte.MaxValue - rCurrentNPC.alpha, (int) sbyte.MaxValue - rCurrentNPC.alpha, (int) sbyte.MaxValue - rCurrentNPC.alpha, 0).MultiplyRGBA(Main.hslToRgb((float) (((double) Main.GlobalTimeWrappedHourly + (double) index / (double) num53) % 1.0), 1f, 0.5f)); Microsoft.Xna.Framework.Color color = rCurrentNPC.GetAlpha(newColor5) * (float) (1.0 - (double) t1 * 0.5); color.A = (byte) 0; float num68 = 2f + rCurrentNPC.ai[2]; Vector2 position3 = rCurrentNPC.Center + ((float) ((double) index / (double) num53 * 6.28318548202515) + rCurrentNPC.rotation + num55).ToRotationVector2() * (float) ((double) num68 * (double) t1 + 2.0) - screenPos - new Vector2((float) texture.Width, (float) (texture.Height / Main.npcFrameCount[type])) * rCurrentNPC.scale / 2f + (halfSize * rCurrentNPC.scale + new Vector2(0.0f, addY + addHeight + rCurrentNPC.gfxOffY)); mySpriteBatch.Draw(texture, position3, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), color, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } mySpriteBatch.Draw(texture, position1, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0) * 0.1f, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } if ((type == 568 || type == 569) && (double) rCurrentNPC.localAI[3] >= 60.0) { Microsoft.Xna.Framework.Color color3 = new Microsoft.Xna.Framework.Color((int) sbyte.MaxValue - rCurrentNPC.alpha, (int) sbyte.MaxValue - rCurrentNPC.alpha, (int) sbyte.MaxValue - rCurrentNPC.alpha, 0).MultiplyRGBA(secondColor); for (int index = 0; index < num53; ++index) { Microsoft.Xna.Framework.Color newColor6 = color3; Microsoft.Xna.Framework.Color color4 = rCurrentNPC.GetAlpha(newColor6) * (1f - t1); Vector2 position4 = rCurrentNPC.Center + ((float) ((double) index / (double) num53 * 6.28318548202515) + rCurrentNPC.rotation + num55).ToRotationVector2() * (float) (4.0 * (double) t1 + 2.0) - screenPos - new Vector2((float) texture.Width, (float) (texture.Height / Main.npcFrameCount[type])) * rCurrentNPC.scale / 2f + (halfSize * rCurrentNPC.scale + new Vector2(0.0f, addY + addHeight + rCurrentNPC.gfxOffY)); mySpriteBatch.Draw(TextureAssets.GlowMask[224].Value, position4, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), color4, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } mySpriteBatch.Draw(TextureAssets.GlowMask[224].Value, position1, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), color3, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); float t2 = rCurrentNPC.localAI[0]; if ((double) t2 > 0.0) { Microsoft.Xna.Framework.Color color5 = new Microsoft.Xna.Framework.Color(180, 90, (int) byte.MaxValue, (int) (byte) ((Math.Cos((double) t2 * 6.28318548202515 / 60.0) * 0.5 + 0.5) * 32.0 + 0.0)) * 0.75f; float num69 = 1f; if ((double) t2 < 60.0) { float lerpValue = Utils.GetLerpValue(0.0f, 60f, t2, false); color5 *= lerpValue; num69 = MathHelper.Lerp(1f, 0.5f, (float) (1.0 - (double) lerpValue * (double) lerpValue)); } Texture2D texture2D = TextureAssets.Extra[89].Value; Vector2 origin3 = texture2D.Size() / 2f; Vector2 scale3 = new Vector2(num69); float num70 = t2 * ((float) Math.PI / 750f); float num71 = 1.570796f; scale3.Y *= 1f; scale3.X *= 1f; for (float num72 = 0.0f; (double) num72 < 16.0; ++num72) { float f = num70 + (float) (6.28318548202515 * ((double) num72 / 16.0)); Vector2 position5 = rCurrentNPC.Center - screenPos + f.ToRotationVector2() * 400f * num69; mySpriteBatch.Draw(texture2D, position5, new Microsoft.Xna.Framework.Rectangle?(), color5, f + 1.570796f + num71, origin3, scale3, SpriteEffects.None, 0.0f); } } } if (type == 546) mySpriteBatch.Draw(TextureAssets.Extra[76].Value, position1, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 200), MathHelper.Clamp(rCurrentNPC.velocity.X * 0.1f, -0.3926991f, 0.3926991f), halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); if ((type == 566 || type == 567) && (double) rCurrentNPC.localAI[3] >= 115.0) { int frameY = (int) ((double) Main.GlobalTimeWrappedHourly % 0.5 / 0.5 * 4.0); Texture2D texture2D = TextureAssets.Extra[80].Value; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: 4, frameY: frameY); Vector2 vector2 = new Vector2((float) (rCurrentNPC.spriteDirection * 8), -26f) * rCurrentNPC.scale; int num73 = rCurrentNPC.frame.Y / rCurrentNPC.frame.Height; int num74 = 0; switch (num73) { case 0: num74 = 6; break; case 1: num74 = 4; break; case 2: num74 = 2; break; case 3: num74 = 6; break; case 4: num74 = 8; break; case 5: num74 = 6; break; case 6: num74 = 4; break; case 7: num74 = 6; break; case 8: num74 = 2; break; } Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 130); vector2.Y += (float) num74; mySpriteBatch.Draw(texture2D, position1 + vector2 * rCurrentNPC.scale, new Microsoft.Xna.Framework.Rectangle?(r), color, MathHelper.Clamp(rCurrentNPC.velocity.X * 0.1f, -0.3926991f, 0.3926991f), r.Size() / 2f, rCurrentNPC.scale * 0.7f, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); } if (type != 618) return; mySpriteBatch.Draw(TextureAssets.Extra[129].Value, position1, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), rCurrentNPC.GetAlpha(newColor1), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } else { switch (type) { case 551: Texture2D texture1 = TextureAssets.Npc[type].Value; Vector2 position6 = rCurrentNPC.Center - screenPos; Microsoft.Xna.Framework.Rectangle frame1 = rCurrentNPC.frame; Vector2 vector2_1 = frame1.Size() / 2f; SpriteEffects effects1 = spriteEffects ^ SpriteEffects.FlipHorizontally; float rotation1 = rCurrentNPC.rotation; Microsoft.Xna.Framework.Color color6 = npcColor2; Microsoft.Xna.Framework.Color color7 = Microsoft.Xna.Framework.Color.Lerp(color6, Microsoft.Xna.Framework.Color.White, 0.6f); color7.A = (byte) 66; Vector2 vector2_2 = new Vector2(171f, 44f); Vector2 vector2_3 = new Vector2(230f, 52f); Vector2 origin4 = Vector2.Lerp(vector2_2, vector2_3, 0.5f) + new Vector2(-50f, 30f); int num75 = (int) rCurrentNPC.localAI[0] / 4; Vector2 spinningpoint1 = vector2_2 - origin4; Vector2 spinningpoint2 = vector2_3 - origin4; Texture2D texture2D1 = TextureAssets.Extra[82].Value; if (effects1.HasFlag((Enum) SpriteEffects.FlipHorizontally)) spinningpoint2.X *= -1f; Microsoft.Xna.Framework.Rectangle rectangle1 = texture2D1.Frame(2, 5, num75 / 5, num75 % 5); Vector2 origin5 = new Vector2(16f, 176f); if (effects1.HasFlag((Enum) SpriteEffects.FlipHorizontally)) origin5.X = (float) rectangle1.Width - origin5.X; if (effects1.HasFlag((Enum) SpriteEffects.FlipHorizontally)) origin4.X = (float) frame1.Width - origin4.X; Texture2D texture2D2 = TextureAssets.Extra[81].Value; if (effects1.HasFlag((Enum) SpriteEffects.FlipHorizontally)) spinningpoint1.X *= -1f; Microsoft.Xna.Framework.Rectangle rectangle2 = texture2D2.Frame(2, 5, num75 / 5, num75 % 5); Vector2 origin6 = new Vector2(215f, 170f); if (effects1.HasFlag((Enum) SpriteEffects.FlipHorizontally)) origin6.X = (float) rectangle2.Width - origin6.X; if ((double) Utils.GetLerpValue(0.0f, 30f, rCurrentNPC.localAI[1], true) == 1.0) Utils.GetLerpValue(60f, 30f, rCurrentNPC.localAI[1], true); float num76 = 2f; Vector2 vector2_4 = rCurrentNPC.Size / 2f - screenPos; int num77 = -3; int num78 = 0; byte num79 = 2; for (int index = 9; index > num78; index += num77) { Vector2 position7 = rCurrentNPC.oldPos[index] + vector2_4; float rotation2 = rCurrentNPC.oldRot[index]; Microsoft.Xna.Framework.Color color8 = color6 * (float) (1.0 - (double) index / 10.0) * 0.35f; color8.A /= num79; mySpriteBatch.Draw(texture2D1, position7 + spinningpoint2.RotatedBy((double) rotation2), new Microsoft.Xna.Framework.Rectangle?(rectangle1), color8, rotation2, origin5, 1f, effects1, 0.0f); mySpriteBatch.Draw(texture1, position7, new Microsoft.Xna.Framework.Rectangle?(frame1), color8, rotation2, origin4, 1f, effects1, 0.0f); mySpriteBatch.Draw(texture2D2, position7 + spinningpoint1.RotatedBy((double) rotation2), new Microsoft.Xna.Framework.Rectangle?(rectangle2), color8, rotation2, origin6, 1f, effects1, 0.0f); } mySpriteBatch.Draw(texture2D1, position6 + spinningpoint2.RotatedBy((double) rotation1), new Microsoft.Xna.Framework.Rectangle?(rectangle1), color6, rotation1, origin5, 1f, effects1, 0.0f); mySpriteBatch.Draw(texture1, position6, new Microsoft.Xna.Framework.Rectangle?(frame1), color6, rotation1, origin4, 1f, effects1, 0.0f); mySpriteBatch.Draw(TextureAssets.GlowMask[226].Value, position6, new Microsoft.Xna.Framework.Rectangle?(frame1), color7 * (float) (0.699999988079071 + 0.300000011920929 * (double) num76), rotation1, origin4, 1f, effects1, 0.0f); mySpriteBatch.Draw(texture2D2, position6 + spinningpoint1.RotatedBy((double) rotation1), new Microsoft.Xna.Framework.Rectangle?(rectangle2), color6, rotation1, origin6, 1f, effects1, 0.0f); break; case 657: Texture2D texture2D3 = TextureAssets.Npc[type].Value; Vector2 vector2_5 = rCurrentNPC.Bottom - screenPos; vector2_5.Y += 2f; int num80 = Main.npcFrameCount[rCurrentNPC.type]; int num81 = rCurrentNPC.frame.Y / rCurrentNPC.frame.Height; Microsoft.Xna.Framework.Rectangle r3 = texture2D3.Frame(2, 16, num81 / num80, num81 % num80); r3.Inflate(0, -2); Vector2 origin7 = r3.Size() * new Vector2(0.5f, 1f); Microsoft.Xna.Framework.Color color9 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.White, npcColor2, 0.5f); if (rCurrentNPC.life <= rCurrentNPC.lifeMax / 2) this.DrawNPCDirect_QueenSlimeWings(rCurrentNPC, mySpriteBatch, screenPos, rCurrentNPC.Center, color9); Texture2D texture2D4 = TextureAssets.Extra[186].Value; Microsoft.Xna.Framework.Rectangle r4 = texture2D4.Frame(); Vector2 origin8 = r4.Size() * new Vector2(0.5f, 0.5f); Vector2 spinningpoint3 = new Vector2(rCurrentNPC.Center.X, rCurrentNPC.Center.Y); float num82 = 0.0f; switch (num81) { case 1: case 6: num82 -= 10f; break; case 3: case 5: num82 += 10f; break; case 4: case 12: case 13: case 14: case 15: num82 += 18f; break; case 7: case 8: num82 -= 14f; break; case 9: num82 -= 16f; break; case 10: num82 -= 18f; break; case 11: num82 += 20f; break; case 20: num82 -= 14f; break; case 21: case 23: num82 -= 18f; break; case 22: num82 -= 22f; break; } spinningpoint3.Y += num82; if ((double) rCurrentNPC.rotation != 0.0) spinningpoint3 = spinningpoint3.RotatedBy((double) rCurrentNPC.rotation, rCurrentNPC.Bottom); Vector2 position8 = spinningpoint3 - screenPos; if (!rCurrentNPC.IsABestiaryIconDummy) { mySpriteBatch.End(); mySpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullNone, (Effect) null, Main.Transform); } GameShaders.Misc["QueenSlime"].Apply(new DrawData?()); if ((double) rCurrentNPC.ai[0] == 4.0 && (double) rCurrentNPC.velocity.Y != 0.0) { float num83 = 1f; if ((double) rCurrentNPC.ai[2] == 1.0) num83 = 6f; for (int index = 7; index >= 0; --index) { float num84 = (float) (1.0 - (double) index / 8.0); Vector2 vector2_6 = rCurrentNPC.oldPos[index] + new Vector2((float) rCurrentNPC.width * 0.5f, (float) rCurrentNPC.height); Vector2 position9 = vector2_6 - (rCurrentNPC.Bottom - Vector2.Lerp(vector2_6, rCurrentNPC.Bottom, 0.75f)) * num83 - screenPos; Microsoft.Xna.Framework.Color color10 = color9 * num84; mySpriteBatch.Draw(texture2D3, position9, new Microsoft.Xna.Framework.Rectangle?(r3), color10, rCurrentNPC.rotation, origin7, rCurrentNPC.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); } } if (!rCurrentNPC.IsABestiaryIconDummy) { mySpriteBatch.End(); mySpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, (Effect) null, Main.Transform); } Main.pixelShader.CurrentTechnique.Passes[0].Apply(); mySpriteBatch.Draw(texture2D4, position8, new Microsoft.Xna.Framework.Rectangle?(r4), color9, rCurrentNPC.rotation, origin8, 1f, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); GameShaders.Misc["QueenSlime"].Apply(new DrawData?()); if (!rCurrentNPC.IsABestiaryIconDummy) { mySpriteBatch.End(); mySpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullNone, (Effect) null, Main.Transform); } DrawData drawData1 = new DrawData(texture2D3, vector2_5, new Microsoft.Xna.Framework.Rectangle?(r3), rCurrentNPC.GetAlpha(color9), rCurrentNPC.rotation, origin7, rCurrentNPC.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0); GameShaders.Misc["QueenSlime"].Apply(new DrawData?(drawData1)); drawData1.Draw(mySpriteBatch); Main.pixelShader.CurrentTechnique.Passes[0].Apply(); if (!rCurrentNPC.IsABestiaryIconDummy) { mySpriteBatch.End(); mySpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, (Effect) null, Main.Transform); } Texture2D texture2D5 = TextureAssets.Extra[177].Value; Microsoft.Xna.Framework.Rectangle r5 = texture2D5.Frame(); Vector2 origin9 = r5.Size() * new Vector2(0.5f, 0.5f); vector2_5 = new Vector2(rCurrentNPC.Center.X, (float) ((double) rCurrentNPC.Top.Y - (double) r5.Bottom + 44.0)); float num85 = 0.0f; switch (num81) { case 1: num85 -= 10f; break; case 3: case 5: case 6: num85 += 10f; break; case 4: case 12: case 13: case 14: case 15: num85 += 18f; break; case 7: case 8: num85 -= 14f; break; case 9: num85 -= 16f; break; case 10: num85 -= 18f; break; case 11: num85 += 20f; break; case 20: num85 -= 14f; break; case 21: case 23: num85 -= 18f; break; case 22: num85 -= 22f; break; } vector2_5.Y += num85; if ((double) rCurrentNPC.rotation != 0.0) vector2_5 = vector2_5.RotatedBy((double) rCurrentNPC.rotation, rCurrentNPC.Bottom); Vector2 position10 = vector2_5 - screenPos; mySpriteBatch.Draw(texture2D5, position10, new Microsoft.Xna.Framework.Rectangle?(r5), color9, rCurrentNPC.rotation, origin9, 1f, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); break; default: if (type == 576 || type == 577) { Texture2D texture2D6 = TextureAssets.Npc[type].Value; Vector2 position11 = rCurrentNPC.Bottom - screenPos; Microsoft.Xna.Framework.Rectangle r6 = texture2D6.Frame(5, 10, rCurrentNPC.frame.Y / 10, rCurrentNPC.frame.Y % 10); Vector2 origin10 = r6.Size() * new Vector2(0.5f, 1f); origin10.Y -= 4f; int num86 = 94; origin10.X = rCurrentNPC.spriteDirection != 1 ? (float) (r6.Width - num86) : (float) num86; Microsoft.Xna.Framework.Color color11 = Microsoft.Xna.Framework.Color.White; float amount3 = 0.0f; float amount4 = 0.0f; int num87 = 0; float num88 = 0.0f; Microsoft.Xna.Framework.Color newColor7 = npcColor2; if ((double) rCurrentNPC.localAI[3] < 60.0) { float num89 = rCurrentNPC.localAI[3] / 60f; num87 = 3; num88 = (float) (1.0 - (double) num89 * (double) num89); color11 = new Microsoft.Xna.Framework.Color((int) sbyte.MaxValue, 0, (int) byte.MaxValue, 0); amount4 = 1f; newColor7 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, newColor7, num89 * num89); } for (int index = 0; index < num87; ++index) { Microsoft.Xna.Framework.Color newColor8 = Microsoft.Xna.Framework.Color.Lerp(npcColor2, color11, amount3); Microsoft.Xna.Framework.Color color12 = Microsoft.Xna.Framework.Color.Lerp(rCurrentNPC.GetAlpha(newColor8), color11, amount4) * (1f - num88); Vector2 position12 = position11 - new Vector2((float) texture2D6.Width, (float) (texture2D6.Height / Main.npcFrameCount[type])) * rCurrentNPC.scale / 2f + (halfSize * rCurrentNPC.scale + new Vector2(0.0f, addY + addHeight + rCurrentNPC.gfxOffY)); mySpriteBatch.Draw(texture2D6, position12, new Microsoft.Xna.Framework.Rectangle?(r6), color12, rCurrentNPC.rotation, origin10, rCurrentNPC.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); } mySpriteBatch.Draw(texture2D6, position11, new Microsoft.Xna.Framework.Rectangle?(r6), rCurrentNPC.GetAlpha(newColor7), rCurrentNPC.rotation, origin10, rCurrentNPC.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); break; } if (type == 594) { Texture2D texture2D7 = TextureAssets.Npc[type].Value; Vector2 position13 = rCurrentNPC.Top - screenPos; Microsoft.Xna.Framework.Rectangle r7 = texture2D7.Frame(8, frameX: rCurrentNPC.frame.Y); Microsoft.Xna.Framework.Rectangle rectangle3 = texture2D7.Frame(8); Vector2 origin11 = r7.Size() * new Vector2(0.5f, 0.0f); Microsoft.Xna.Framework.Color color13 = npcColor2; float scale = 1f; NPC slaveNpc = rCurrentNPC.AI_113_WindyBalloon_GetSlaveNPC(); if (slaveNpc != null) { scale = slaveNpc.scale; if ((double) slaveNpc.ai[1] > 0.0) Main.DrawNPC_SlimeItem(slaveNpc, slaveNpc.type, color13, rCurrentNPC.rotation); mySpriteBatch.Draw(texture2D7, position13, new Microsoft.Xna.Framework.Rectangle?(rectangle3), slaveNpc.GetAlpha(color13), rCurrentNPC.rotation, origin11, scale, spriteEffects, 0.0f); mySpriteBatch.Draw(texture2D7, position13, new Microsoft.Xna.Framework.Rectangle?(rectangle3), slaveNpc.GetColor(color13), rCurrentNPC.rotation, origin11, scale, spriteEffects, 0.0f); } mySpriteBatch.Draw(texture2D7, position13, new Microsoft.Xna.Framework.Rectangle?(r7), rCurrentNPC.GetAlpha(color13), rCurrentNPC.rotation, origin11, scale, spriteEffects, 0.0f); break; } if (type == 564 || type == 565) { Texture2D texture2D8 = TextureAssets.Npc[type].Value; Vector2 position14 = rCurrentNPC.Bottom - screenPos; Microsoft.Xna.Framework.Rectangle r8 = texture2D8.Frame(5, 9, rCurrentNPC.frame.Y / 9, rCurrentNPC.frame.Y % 9); Vector2 origin12 = r8.Size() * new Vector2(0.5f, 1f); origin12.Y -= 10f; int num90 = 52; origin12.X = rCurrentNPC.spriteDirection != 1 ? (float) (r8.Width - num90) : (float) num90; Microsoft.Xna.Framework.Color color14 = Microsoft.Xna.Framework.Color.White; float amount5 = 0.0f; float amount6 = 0.0f; int num91 = 0; float num92 = 0.0f; float num93 = 0.0f; Microsoft.Xna.Framework.Color newColor9 = npcColor2; if ((double) rCurrentNPC.localAI[3] < 60.0) { float num94 = rCurrentNPC.localAI[3] / 60f; num91 = 3; num92 = (float) (1.0 - (double) num94 * (double) num94); num93 = 8f; color14 = new Microsoft.Xna.Framework.Color((int) sbyte.MaxValue, 0, (int) byte.MaxValue, 0); amount6 = 1f; newColor9 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, newColor9, num94 * num94); } for (int index = 0; index < num91; ++index) { Microsoft.Xna.Framework.Color newColor10 = Microsoft.Xna.Framework.Color.Lerp(npcColor2, color14, amount5); Microsoft.Xna.Framework.Color color15 = Microsoft.Xna.Framework.Color.Lerp(rCurrentNPC.GetAlpha(newColor10), color14, amount6) * (1f - num92); Vector2 position15 = position14 - new Vector2((float) texture2D8.Width, (float) (texture2D8.Height / Main.npcFrameCount[type])) * rCurrentNPC.scale / 2f + (halfSize * rCurrentNPC.scale + new Vector2(0.0f, addY + addHeight + rCurrentNPC.gfxOffY)) + ((float) ((double) index / (double) num91 * 6.28318548202515)).ToRotationVector2() * num93 * num92; mySpriteBatch.Draw(texture2D8, position15, new Microsoft.Xna.Framework.Rectangle?(r8), color15, rCurrentNPC.rotation, origin12, rCurrentNPC.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); } Microsoft.Xna.Framework.Color alpha = rCurrentNPC.GetAlpha(newColor9); int num95 = 4; float num96 = 4f; float num97 = (float) (0.625 + Math.Sin((double) Main.GlobalTimeWrappedHourly * 6.28318548202515 * 0.75 + 3.14159274101257) * 0.125); for (int index = 0; index < num95; ++index) { Microsoft.Xna.Framework.Color color16 = alpha * (1f - num97); Vector2 position16 = position14 - new Vector2((float) texture2D8.Width, (float) (texture2D8.Height / Main.npcFrameCount[type])) * rCurrentNPC.scale / 2f + (halfSize * rCurrentNPC.scale + new Vector2(0.0f, addY + addHeight + rCurrentNPC.gfxOffY)) + ((float) ((double) index / (double) num95 * 6.28318548202515)).ToRotationVector2() * num96 * num97; mySpriteBatch.Draw(texture2D8, position16, new Microsoft.Xna.Framework.Rectangle?(r8), color16, rCurrentNPC.rotation, origin12, rCurrentNPC.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); } mySpriteBatch.Draw(texture2D8, position14, new Microsoft.Xna.Framework.Rectangle?(r8), alpha, rCurrentNPC.rotation, origin12, rCurrentNPC.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); if ((double) rCurrentNPC.Opacity <= 0.0) break; Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; white.A /= (byte) 2; white *= rCurrentNPC.Opacity; mySpriteBatch.Draw(TextureAssets.GlowMask[225].Value, position14, new Microsoft.Xna.Framework.Rectangle?(r8), white, rCurrentNPC.rotation, origin12, rCurrentNPC.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); int num98 = 4; float num99 = 4f; float num100 = (float) (0.5 + Math.Sin((double) Main.GlobalTimeWrappedHourly * 6.28318548202515 * 0.75) * 0.5); for (int index = 0; index < num98; ++index) { Microsoft.Xna.Framework.Color color17 = white * 0.35f * (1f - num100); Vector2 position17 = position14 - new Vector2((float) texture2D8.Width, (float) (texture2D8.Height / Main.npcFrameCount[type])) * rCurrentNPC.scale / 2f + (halfSize * rCurrentNPC.scale + new Vector2(0.0f, addY + addHeight + rCurrentNPC.gfxOffY)) + ((float) ((double) index / (double) num98 * 6.28318548202515)).ToRotationVector2() * num99 * num100; mySpriteBatch.Draw(TextureAssets.GlowMask[225].Value, position17, new Microsoft.Xna.Framework.Rectangle?(r8), color17, rCurrentNPC.rotation, origin12, rCurrentNPC.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); } break; } if (type == 548) { Texture2D texture2D9 = TextureAssets.Npc[type].Value; Vector2 position18 = rCurrentNPC.Bottom - screenPos; Microsoft.Xna.Framework.Rectangle r9 = texture2D9.Frame(); Vector2 origin13 = r9.Size() / 2f; origin13.Y += 30f; origin13.Y += 8f; --origin13.X; Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; float amount7 = 0.0f; float amount8 = 0.0f; int num101 = 0; float num102 = 0.0f; float num103 = 0.0f; Microsoft.Xna.Framework.Color newColor11 = npcColor2; for (int index = 0; index < num101; ++index) { Microsoft.Xna.Framework.Color newColor12 = Microsoft.Xna.Framework.Color.Lerp(npcColor2, white, amount7); Microsoft.Xna.Framework.Color color18 = Microsoft.Xna.Framework.Color.Lerp(rCurrentNPC.GetAlpha(newColor12), white, amount8) * (1f - num102); Vector2 position19 = position18 - new Vector2((float) texture2D9.Width, (float) (texture2D9.Height / Main.npcFrameCount[type])) * rCurrentNPC.scale / 2f + (halfSize * rCurrentNPC.scale + new Vector2(0.0f, addY + addHeight + rCurrentNPC.gfxOffY)) + ((float) ((double) index / (double) num101 * 6.28318548202515)).ToRotationVector2() * num103 * num102; mySpriteBatch.Draw(texture2D9, position19, new Microsoft.Xna.Framework.Rectangle?(r9), color18, rCurrentNPC.rotation, origin13, rCurrentNPC.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); } Microsoft.Xna.Framework.Color alpha = rCurrentNPC.GetAlpha(newColor11); int num104 = 4; float num105 = 4f; float num106 = (float) (0.625 + Math.Sin((double) Main.GlobalTimeWrappedHourly * 6.28318548202515 * 0.75 + 3.14159274101257) * 0.125); for (int index = 0; index < num104; ++index) { Microsoft.Xna.Framework.Color color19 = alpha; color19.A = (byte) 0; Microsoft.Xna.Framework.Color color20 = color19 * (1f - num106); Vector2 position20 = position18 - new Vector2((float) texture2D9.Width, (float) (texture2D9.Height / Main.npcFrameCount[type])) * rCurrentNPC.scale / 2f + (halfSize * rCurrentNPC.scale + new Vector2(0.0f, addY + addHeight + rCurrentNPC.gfxOffY)) + ((float) ((double) index / (double) num104 * 6.28318548202515)).ToRotationVector2() * num105 * num106; mySpriteBatch.Draw(texture2D9, position20, new Microsoft.Xna.Framework.Rectangle?(r9), color20, rCurrentNPC.rotation, origin13, rCurrentNPC.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); } mySpriteBatch.Draw(texture2D9, position18, new Microsoft.Xna.Framework.Rectangle?(r9), alpha, rCurrentNPC.rotation, origin13, rCurrentNPC.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); if ((double) rCurrentNPC.ai[1] == 2.0) { float num107 = Math.Min(1f, rCurrentNPC.ai[0] / 120f); mySpriteBatch.Draw(texture2D9, position18, new Microsoft.Xna.Framework.Rectangle?(r9), new Microsoft.Xna.Framework.Color(1f, 1f, 1f, 0.0f) * num107, rCurrentNPC.rotation, origin13, rCurrentNPC.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); float progress = MathHelper.Clamp(rCurrentNPC.ai[0] / 450f, 0.0f, 1f); if (!Terraria.Graphics.Effects.Filters.Scene["CrystalWin"].IsActive()) Terraria.Graphics.Effects.Filters.Scene.Activate("CrystalWin", rCurrentNPC.Center); else Terraria.Graphics.Effects.Filters.Scene["CrystalWin"].GetShader().UseProgress(progress); Terraria.Graphics.Effects.Filters.Scene["CrystalWin"].GetShader().UseTargetPosition(rCurrentNPC.Center); } int num108 = 4; float num109 = 4f; float num110 = (float) (0.625 + Math.Sin((double) Main.GlobalTimeWrappedHourly * 6.28318548202515 * 0.75) * 0.125); for (int index = 0; index < num108; ++index) { Microsoft.Xna.Framework.Color color21 = alpha; color21.A = (byte) 0; Microsoft.Xna.Framework.Color color22 = color21 * 0.3f * (1f - num110); Vector2 position21 = position18 - new Vector2((float) texture2D9.Width, (float) (texture2D9.Height / Main.npcFrameCount[type])) * rCurrentNPC.scale / 2f + (halfSize * rCurrentNPC.scale + new Vector2(0.0f, addY + addHeight + rCurrentNPC.gfxOffY)) + ((float) ((double) index / (double) num108 * 6.28318548202515)).ToRotationVector2() * num109 * num110; mySpriteBatch.Draw(texture2D9, position21, new Microsoft.Xna.Framework.Rectangle?(r9), color22, rCurrentNPC.rotation, origin13, rCurrentNPC.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); } if (rCurrentNPC.alpha >= (int) byte.MaxValue) break; float num111 = (float) ((double) Main.GlobalTimeWrappedHourly % 3.0 / 3.0); float num112 = num111; if ((double) num112 > 0.5) num112 = 1f - num111; if ((double) num112 < 0.0) num112 = 0.0f; float num113 = (float) (((double) num111 + 0.5) % 1.0); float num114 = num113; if ((double) num114 > 0.5) num114 = 1f - num113; if ((double) num114 < 0.0) num114 = 0.0f; Texture2D texture2D10 = TextureAssets.GlowMask[239].Value; Microsoft.Xna.Framework.Rectangle r10 = texture2D10.Frame(); origin13 = r10.Size() / 2f; Vector2 position22 = position18 + new Vector2(0.0f, -40f); Microsoft.Xna.Framework.Color color23 = new Microsoft.Xna.Framework.Color(140, 50, (int) byte.MaxValue, 0) * 0.6f; mySpriteBatch.Draw(texture2D10, position22, new Microsoft.Xna.Framework.Rectangle?(r10), color23, rCurrentNPC.rotation, origin13, rCurrentNPC.scale * 0.75f, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); float num115 = (float) (1.0 + (double) num111 * 0.75); mySpriteBatch.Draw(texture2D10, position22, new Microsoft.Xna.Framework.Rectangle?(r10), color23 * num112, rCurrentNPC.rotation, origin13, rCurrentNPC.scale * 0.75f * num115, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); float num116 = (float) (1.0 + (double) num113 * 0.75); mySpriteBatch.Draw(texture2D10, position22, new Microsoft.Xna.Framework.Rectangle?(r10), color23 * num114, rCurrentNPC.rotation, origin13, rCurrentNPC.scale * 0.75f * num116, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); Texture2D texture2D11 = TextureAssets.Extra[89].Value; Microsoft.Xna.Framework.Rectangle r11 = texture2D11.Frame(); origin13 = r11.Size() / 2f; Vector2 scale = new Vector2(0.75f, 1f + num116) * 1.5f; float num117 = (float) (1.0 + (double) num113 * 0.75); if (rCurrentNPC.dontTakeDamageFromHostiles) scale.Y *= 0.6f; position22.Y -= 6f; mySpriteBatch.Draw(texture2D11, position22, new Microsoft.Xna.Framework.Rectangle?(r11), color23 * num114, rCurrentNPC.rotation + 1.570796f, origin13, scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); mySpriteBatch.Draw(texture2D11, position22, new Microsoft.Xna.Framework.Rectangle?(r11), Microsoft.Xna.Framework.Color.Lerp(color23, Microsoft.Xna.Framework.Color.White, 0.5f), rCurrentNPC.rotation + 1.570796f, origin13, 1.5f, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); break; } if (type == 371 || type >= 454 && type <= 459 || type >= 621 && type <= 623) { Texture2D texture2 = TextureAssets.Npc[type].Value; Vector2 position23 = rCurrentNPC.Center - screenPos - new Vector2((float) texture2.Width, (float) (texture2.Height / Main.npcFrameCount[type])) * rCurrentNPC.scale / 2f + (halfSize * rCurrentNPC.scale + new Vector2(0.0f, addY + addHeight + rCurrentNPC.gfxOffY)); mySpriteBatch.Draw(texture2, position23, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), rCurrentNPC.GetAlpha(npcColor2), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; } switch (type) { case 549: Texture2D texture3 = TextureAssets.Npc[type].Value; Vector2 position24 = rCurrentNPC.Center - screenPos; Microsoft.Xna.Framework.Rectangle frame2 = rCurrentNPC.frame; Vector2 origin14 = new Vector2(70f, (float) sbyte.MaxValue); origin14.Y += 8f; Vector2 scale4 = new Vector2(rCurrentNPC.scale); float t3 = rCurrentNPC.localAI[0]; if ((double) t3 < 120.0) scale4 *= (float) ((double) t3 / 240.0 + 0.5); Microsoft.Xna.Framework.Color alpha1 = rCurrentNPC.GetAlpha(npcColor2); float lerpValue1 = Utils.GetLerpValue(0.0f, 120f, t3, true); float num118 = MathHelper.Lerp(32f, 0.0f, lerpValue1); Microsoft.Xna.Framework.Color color24 = alpha1; color24.A = (byte) MathHelper.Lerp((float) color24.A, 0.0f, lerpValue1); Microsoft.Xna.Framework.Color color25 = color24 * lerpValue1; if ((double) t3 >= 120.0) color25 = alpha1; mySpriteBatch.Draw(texture3, position24, new Microsoft.Xna.Framework.Rectangle?(frame2), color25, rCurrentNPC.rotation, origin14, scale4, spriteEffects, 0.0f); float y1 = ((float) ((((double) rCurrentNPC.ai[0] + 54.0) % 180.0 - 120.0) / 180.0 * 2.0 * 6.28318548202515)).ToRotationVector2().Y; if ((double) t3 >= 120.0) { num118 = y1 * 0.0f; color25.A = (byte) ((double) color25.A * 0.5); color25 *= (float) ((double) y1 / 2.0 + 0.5); float num119 = 1f; for (float num120 = 0.0f; (double) num120 < (double) num119; ++num120) mySpriteBatch.Draw(texture3, position24 + (6.283185f / num119 * num120).ToRotationVector2() * num118, new Microsoft.Xna.Framework.Rectangle?(frame2), color25, rCurrentNPC.rotation, origin14, scale4, spriteEffects, 0.0f); } float t4 = (float) ((double) rCurrentNPC.ai[0] / 180.0 - 0.759999990463257); if ((double) t4 < 0.0) ++t4; float amount9 = 0.0f; float scale5 = 0.0f; float from1 = 0.6f; float to1 = 0.8f; if ((double) t4 >= (double) from1 && (double) t4 <= (double) to1) { amount9 = Utils.GetLerpValue(from1, to1, t4, false); scale5 = MathHelper.Lerp(0.75f, 0.85f, amount9); } float from2 = to1; float to2 = from2 + 0.13f; if ((double) t4 >= (double) from2 && (double) t4 <= (double) to2) { amount9 = 1f - Utils.GetLerpValue(from2, to2, t4, false); scale5 = MathHelper.Lerp(1.3f, 0.85f, amount9); } Vector2 vector2_7 = new Vector2(0.0f, -150f); int frameNumber = frame2.Y / frame2.Height; float num121 = MathHelper.Clamp((float) (((double) t3 - 100.0) / 40.0), 0.0f, 1f); this.DrawElderEye(mySpriteBatch, rCurrentNPC.Center + vector2_7, 0.75f * num121, 0.75f, frameNumber, Microsoft.Xna.Framework.Color.White); this.DrawElderEye(mySpriteBatch, rCurrentNPC.Center + vector2_7, 0.75f * num121, 0.75f, frameNumber, new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue) * (float) ((double) y1 / 2.0 + 0.5)); if ((double) amount9 > 0.0 && (double) scale5 > 0.0) this.DrawElderEye(mySpriteBatch, rCurrentNPC.Center + vector2_7, amount9 * 0.5f, scale5, frameNumber, new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue)); if ((double) t3 >= 120.0) return; float num122 = (float) (6.28318548202515 * (double) lerpValue1 * Math.Pow((double) lerpValue1, 2.0) * 2.0) + lerpValue1; color25.A = (byte) ((double) alpha1.A * Math.Pow((double) lerpValue1, 2.0) * 0.5); float num123 = 3f; for (float num124 = 0.0f; (double) num124 < (double) num123; ++num124) mySpriteBatch.Draw(texture3, position24 + (num122 + 6.283185f / num123 * num124).ToRotationVector2() * num118, new Microsoft.Xna.Framework.Rectangle?(frame2), color25, rCurrentNPC.rotation, origin14, scale4, spriteEffects, 0.0f); return; case 636: Main.DrawNPCDirect_HallowBoss(mySpriteBatch, rCurrentNPC, ref screenPos, type, ref npcColor2, ref halfSize, spriteEffects); return; default: if (type == 493 || type == 507 || type == 422 || type == 517) { Texture2D texture4 = TextureAssets.Npc[type].Value; Vector2 vector2_8 = rCurrentNPC.Center - screenPos; Vector2 vector2_9 = vector2_8 - new Vector2(300f, 310f); Vector2 position25 = vector2_8 - new Vector2((float) texture4.Width, (float) (texture4.Height / Main.npcFrameCount[type])) * rCurrentNPC.scale / 2f + (halfSize * rCurrentNPC.scale + new Vector2(0.0f, addY + addHeight + rCurrentNPC.gfxOffY)); mySpriteBatch.Draw(texture4, position25, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), rCurrentNPC.GetAlpha(npcColor2), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); switch (type) { case 422: Texture2D texture5 = TextureAssets.GlowMask[149].Value; vector3 = rCurrentNPC.GetAlpha(npcColor2).ToVector3() - new Vector3(0.5f); float num125 = (float) (4.0 + (double) vector3.Length() * 4.0); for (int index = 0; index < 4; ++index) mySpriteBatch.Draw(texture5, position25 + rCurrentNPC.velocity.RotatedBy((double) index * 1.57079637050629) * num125, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color(64, 64, 64, 0) * rCurrentNPC.Opacity, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 493: Texture2D texture6 = TextureAssets.GlowMask[132].Value; vector3 = rCurrentNPC.GetAlpha(npcColor2).ToVector3() - new Vector3(0.5f); float num126 = (float) (4.0 + (double) vector3.Length() * 4.0); for (int index = 0; index < 4; ++index) mySpriteBatch.Draw(texture6, position25 + rCurrentNPC.velocity.RotatedBy((double) index * 1.57079637050629) * num126, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color(64, 64, 64, 0) * rCurrentNPC.Opacity, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 507: Texture2D texture7 = TextureAssets.GlowMask[143].Value; vector3 = rCurrentNPC.GetAlpha(npcColor2).ToVector3() - new Vector3(0.5f); float num127 = (float) (4.0 + (double) vector3.Length() * 4.0); for (int index = 0; index < 4; ++index) mySpriteBatch.Draw(texture7, position25 + rCurrentNPC.velocity.RotatedBy((double) index * 1.57079637050629) * num127, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color(64, 64, 64, 0) * rCurrentNPC.Opacity, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 517: Texture2D texture8 = TextureAssets.GlowMask[162].Value; vector3 = rCurrentNPC.GetAlpha(npcColor2).ToVector3() - new Vector3(0.5f); float num128 = (float) (2.0 + (double) vector3.Length() * 9.0); for (int index = 0; index < 4; ++index) mySpriteBatch.Draw(texture8, position25 + rCurrentNPC.velocity.RotatedBy((double) index * 1.57079637050629) * num128 + Vector2.UnitX * 2f, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color(64, 64, 64, 0) * rCurrentNPC.Opacity, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; } int num129 = 0; string key = ""; if (type <= 493) { if (type != 422) { if (type == 493) { num129 = NPC.ShieldStrengthTowerStardust; key = "Stardust"; } } else { num129 = NPC.ShieldStrengthTowerVortex; key = "Vortex"; } } else if (type != 507) { if (type == 517) { num129 = NPC.ShieldStrengthTowerSolar; key = "Solar"; } } else { num129 = NPC.ShieldStrengthTowerNebula; key = "Nebula"; } float num130 = (float) num129 / (float) NPC.ShieldStrengthTowerMax; if (rCurrentNPC.IsABestiaryIconDummy) return; if (num129 > 0) { mySpriteBatch.End(); mySpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.Default, RasterizerState.CullNone, (Effect) null, Main.Transform); float num131 = 0.0f; if ((double) rCurrentNPC.ai[3] > 0.0 && (double) rCurrentNPC.ai[3] <= 30.0) num131 = (float) (1.0 - (double) rCurrentNPC.ai[3] / 30.0); Terraria.Graphics.Effects.Filters.Scene[key].GetShader().UseIntensity(1f + num131).UseProgress(0.0f); DrawData drawData2 = new DrawData(Main.Assets.Request("Images/Misc/Perlin", (AssetRequestMode) 1).Value, vector2_9 + new Vector2(300f, 300f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 600, 600)), Microsoft.Xna.Framework.Color.White * (float) ((double) num130 * 0.800000011920929 + 0.200000002980232), rCurrentNPC.rotation, new Vector2(300f, 300f), rCurrentNPC.scale * (float) (1.0 + (double) num131 * 0.0500000007450581), spriteEffects, 0); GameShaders.Misc["ForceField"].UseColor(new Vector3((float) (1.0 + (double) num131 * 0.5))); GameShaders.Misc["ForceField"].Apply(new DrawData?(drawData2)); drawData2.Draw(mySpriteBatch); mySpriteBatch.End(); mySpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, (Effect) null, Main.Transform); return; } if ((double) rCurrentNPC.ai[3] > 0.0) { mySpriteBatch.End(); mySpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.Default, RasterizerState.CullNone, (Effect) null, Main.Transform); float progress = rCurrentNPC.ai[3] / 120f; float num132 = Math.Min(rCurrentNPC.ai[3] / 30f, 1f); Terraria.Graphics.Effects.Filters.Scene[key].GetShader().UseIntensity(Math.Min(5f, 15f * progress) + 1f).UseProgress(progress); DrawData drawData3 = new DrawData(Main.Assets.Request("Images/Misc/Perlin", (AssetRequestMode) 1).Value, vector2_9 + new Vector2(300f, 300f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 600, 600)), new Microsoft.Xna.Framework.Color(new Vector4(1f - (float) Math.Sqrt((double) num132))), rCurrentNPC.rotation, new Vector2(300f, 300f), rCurrentNPC.scale * (1f + num132), spriteEffects, 0); GameShaders.Misc["ForceField"].UseColor(new Vector3(2f)); GameShaders.Misc["ForceField"].Apply(new DrawData?(drawData3)); drawData3.Draw(mySpriteBatch); mySpriteBatch.End(); mySpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, (Effect) null, Main.Transform); return; } Terraria.Graphics.Effects.Filters.Scene[key].GetShader().UseIntensity(0.0f).UseProgress(0.0f); return; } switch (type) { case 402: this.LoadNPC(403); this.LoadNPC(404); NPC npc1 = rCurrentNPC; Texture2D texture2D12 = TextureAssets.Npc[npc1.type].Value; Vector2 position26 = npc1.Center - screenPos - new Vector2((float) texture2D12.Width, (float) (texture2D12.Height / Main.npcFrameCount[npc1.type])) * npc1.scale / 2f + (halfSize * npc1.scale + new Vector2(0.0f, addY + addHeight + npc1.gfxOffY)); int num133 = 0; float num134 = (float) (2.0 / (double) npc1.oldPos.Length * 0.699999988079071); for (int index = npc1.oldPos.Length - 1; (double) index >= 1.0; index -= 2) { Texture2D texture9 = num133 != 0 ? TextureAssets.Npc[403].Value : TextureAssets.Npc[404].Value; mySpriteBatch.Draw(texture9, position26 + npc1.oldPos[index] - npc1.position, new Microsoft.Xna.Framework.Rectangle?(), npc1.GetAlpha(npcColor2) * (float) (0.800000011920929 - (double) num134 * (double) index / 2.0), npc1.oldRot[index], halfSize, npc1.scale, spriteEffects, 0.0f); Texture2D texture10 = num133 != 0 ? TextureAssets.GlowMask[133].Value : TextureAssets.GlowMask[134].Value; mySpriteBatch.Draw(texture10, position26 + npc1.oldPos[index] - npc1.position, new Microsoft.Xna.Framework.Rectangle?(), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0) * (float) (1.0 - (double) num134 * (double) index / 2.0), npc1.oldRot[index], halfSize, npc1.scale, spriteEffects, 0.0f); ++num133; } Texture2D texture11 = TextureAssets.Npc[npc1.type].Value; mySpriteBatch.Draw(texture11, position26, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), rCurrentNPC.GetAlpha(npcColor2), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); Texture2D texture12 = TextureAssets.GlowMask[135].Value; mySpriteBatch.Draw(texture12, position26, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); return; case 488: return; case 519: NPC npc2 = rCurrentNPC; Texture2D texture2D13 = TextureAssets.Npc[npc2.type].Value; Vector2 position27 = npc2.Center - screenPos - new Vector2((float) texture2D13.Width, (float) (texture2D13.Height / Main.npcFrameCount[npc2.type])) * npc2.scale / 2f + (halfSize * npc2.scale + new Vector2(0.0f, addY + addHeight + npc2.gfxOffY)); Texture2D texture13 = TextureAssets.Npc[npc2.type].Value; mySpriteBatch.Draw(texture13, position27, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), rCurrentNPC.GetAlpha(npcColor2), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); int num135 = 0; float num136 = (float) (1.0 / (double) npc2.oldPos.Length * 0.699999988079071); for (int index = npc2.oldPos.Length - 1; (double) index >= 0.0; --index) { float amount10 = (float) (npc2.oldPos.Length - index) / (float) npc2.oldPos.Length; Microsoft.Xna.Framework.Color color26 = Microsoft.Xna.Framework.Color.Pink * (float) (1.0 - (double) num136 * (double) index / 1.0); color26.A = (byte) ((double) color26.A * (1.0 - (double) amount10)); mySpriteBatch.Draw(texture13, position27 + npc2.oldPos[index] - npc2.position, new Microsoft.Xna.Framework.Rectangle?(), color26, npc2.oldRot[index], halfSize, npc2.scale * MathHelper.Lerp(0.3f, 1.1f, amount10), spriteEffects, 0.0f); ++num135; } return; case 522: NPC npc3 = rCurrentNPC; Texture2D texture14 = TextureAssets.Npc[npc3.type].Value; Vector2 position28 = npc3.Center - screenPos - new Vector2((float) texture14.Width, (float) (texture14.Height / Main.npcFrameCount[npc3.type])) * npc3.scale / 2f + (halfSize * npc3.scale + new Vector2(0.0f, addY + addHeight + npc3.gfxOffY)); int num137 = 0; float num138 = (float) (1.0 / (double) npc3.oldPos.Length * 1.10000002384186); for (int index = npc3.oldPos.Length - 1; (double) index >= 0.0; --index) { float amount11 = (float) (npc3.oldPos.Length - index) / (float) npc3.oldPos.Length; Microsoft.Xna.Framework.Color color27 = Microsoft.Xna.Framework.Color.White * (float) (1.0 - (double) num138 * (double) index / 1.0); color27.A = (byte) ((double) color27.A * (1.0 - (double) amount11)); mySpriteBatch.Draw(texture14, position28 + npc3.oldPos[index] - npc3.position, new Microsoft.Xna.Framework.Rectangle?(), color27, npc3.oldRot[index], halfSize, npc3.scale * MathHelper.Lerp(0.8f, 0.3f, amount11), spriteEffects, 0.0f); ++num137; } Texture2D texture2D14 = TextureAssets.Extra[57].Value; mySpriteBatch.Draw(texture2D14, position28, new Microsoft.Xna.Framework.Rectangle?(), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), 0.0f, texture2D14.Size() / 2f, rCurrentNPC.scale, spriteEffects, 0.0f); return; default: if (type == 370 || type == 372 || type == 373) { Texture2D texture15 = TextureAssets.Npc[type].Value; Microsoft.Xna.Framework.Color color28 = Microsoft.Xna.Framework.Color.White; float amount12 = 0.0f; bool flag = type == 370 && (double) rCurrentNPC.ai[0] > 4.0; int num139 = type != 370 ? 0 : ((double) rCurrentNPC.ai[0] > 9.0 ? 1 : 0); int num140 = 120; int num141 = 60; Microsoft.Xna.Framework.Color color29 = npcColor2; if (num139 != 0) npcColor2 = Main.buffColor(npcColor2, 0.4f, 0.8f, 0.4f, 1f); else if (flag) npcColor2 = Main.buffColor(npcColor2, 0.5f, 0.7f, 0.5f, 1f); else if (type == 370 && (double) rCurrentNPC.ai[0] == 4.0 && (double) rCurrentNPC.ai[2] > (double) num140) { float num142 = (rCurrentNPC.ai[2] - (float) num140) / (float) num141; npcColor2 = Main.buffColor(npcColor2, (float) (1.0 - 0.5 * (double) num142), (float) (1.0 - 0.300000011920929 * (double) num142), (float) (1.0 - 0.5 * (double) num142), 1f); } int num143 = 10; int num144 = 2; if (type == 370) { if ((double) rCurrentNPC.ai[0] == -1.0) num143 = 0; if ((double) rCurrentNPC.ai[0] == 0.0 || (double) rCurrentNPC.ai[0] == 5.0 || (double) rCurrentNPC.ai[0] == 10.0) num143 = 7; if ((double) rCurrentNPC.ai[0] == 1.0) { color28 = Microsoft.Xna.Framework.Color.Blue; amount12 = 0.5f; } else color29 = npcColor2; } else if ((type == 372 || type == 373) && (double) rCurrentNPC.ai[0] == 1.0) { color28 = Microsoft.Xna.Framework.Color.Blue; amount12 = 0.5f; } for (int index = 1; index < num143; index += num144) { ref Vector2 local = ref rCurrentNPC.oldPos[index]; Microsoft.Xna.Framework.Color newColor = Microsoft.Xna.Framework.Color.Lerp(color29, color28, amount12); Microsoft.Xna.Framework.Color color30 = rCurrentNPC.GetAlpha(newColor) * ((float) (num143 - index) / 15f); Vector2 position29 = rCurrentNPC.oldPos[index] + new Vector2((float) rCurrentNPC.width, (float) rCurrentNPC.height) / 2f - screenPos - new Vector2((float) texture15.Width, (float) (texture15.Height / Main.npcFrameCount[type])) * rCurrentNPC.scale / 2f + (halfSize * rCurrentNPC.scale + new Vector2(0.0f, addY + addHeight + rCurrentNPC.gfxOffY)); mySpriteBatch.Draw(texture15, position29, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), color30, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } int num145 = 0; float num146 = 0.0f; float num147 = 0.0f; if (type == 370) { if ((double) rCurrentNPC.ai[0] == -1.0) num145 = 0; if ((double) rCurrentNPC.ai[0] == 3.0 || (double) rCurrentNPC.ai[0] == 8.0) { int num148 = 60; int num149 = 30; if ((double) rCurrentNPC.ai[2] > (double) num148) { num145 = 6; num146 = (1f - (float) Math.Cos(((double) rCurrentNPC.ai[2] - (double) num148) / (double) num149 * 6.28318548202515)) / 3f; num147 = 40f; } } if ((double) rCurrentNPC.ai[0] == 4.0 && (double) rCurrentNPC.ai[2] > (double) num140) { num145 = 6; num146 = (1f - (float) Math.Cos(((double) rCurrentNPC.ai[2] - (double) num140) / (double) num141 * 6.28318548202515)) / 3f; num147 = 60f; } if ((double) rCurrentNPC.ai[0] == 9.0 && (double) rCurrentNPC.ai[2] > (double) num140) { num145 = 6; num146 = (1f - (float) Math.Cos(((double) rCurrentNPC.ai[2] - (double) num140) / (double) num141 * 6.28318548202515)) / 3f; num147 = 60f; } if ((double) rCurrentNPC.ai[0] == 12.0) { num145 = 6; num146 = (1f - (float) Math.Cos((double) rCurrentNPC.ai[2] / 30.0 * 6.28318548202515)) / 3f; num147 = 20f; } } for (int index = 0; index < num145; ++index) { Microsoft.Xna.Framework.Color newColor = Microsoft.Xna.Framework.Color.Lerp(npcColor2, color28, amount12); Microsoft.Xna.Framework.Color color31 = rCurrentNPC.GetAlpha(newColor) * (1f - num146); Vector2 position30 = rCurrentNPC.Center + ((float) ((double) index / (double) num145 * 6.28318548202515) + rCurrentNPC.rotation).ToRotationVector2() * num147 * num146 - screenPos - new Vector2((float) texture15.Width, (float) (texture15.Height / Main.npcFrameCount[type])) * rCurrentNPC.scale / 2f + (halfSize * rCurrentNPC.scale + new Vector2(0.0f, addY + addHeight + rCurrentNPC.gfxOffY)); mySpriteBatch.Draw(texture15, position30, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), color31, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } Vector2 position31 = rCurrentNPC.Center - screenPos - new Vector2((float) texture15.Width, (float) (texture15.Height / Main.npcFrameCount[type])) * rCurrentNPC.scale / 2f + (halfSize * rCurrentNPC.scale + new Vector2(0.0f, addY + addHeight + rCurrentNPC.gfxOffY)); mySpriteBatch.Draw(texture15, position31, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), rCurrentNPC.GetAlpha(npcColor2), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); if (type != 370 || (double) rCurrentNPC.ai[0] < 4.0) return; Texture2D texture16 = TextureAssets.DukeFishron.Value; Microsoft.Xna.Framework.Color color32 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.White, Microsoft.Xna.Framework.Color.Yellow, 0.5f); Microsoft.Xna.Framework.Color yellow = Microsoft.Xna.Framework.Color.Yellow; float amount13 = 1f; float num150 = 0.5f; float num151 = 10f; int num152 = 1; if ((double) rCurrentNPC.ai[0] == 4.0) { float num153 = (rCurrentNPC.ai[2] - (float) num140) / (float) num141; yellow *= num153; color32 *= num153; } if ((double) rCurrentNPC.ai[0] == 12.0) { float num154 = rCurrentNPC.ai[2] / 30f; if ((double) num154 > 0.5) num154 = 1f - num154; float num155 = 1f - num154 * 2f; yellow *= num155; color32 *= num155; } for (int index = 1; index < num143; index += num152) { ref Vector2 local = ref rCurrentNPC.oldPos[index]; Microsoft.Xna.Framework.Color color33 = Microsoft.Xna.Framework.Color.Lerp(color32, yellow, amount13) * ((float) (num143 - index) / 15f); Vector2 position32 = rCurrentNPC.oldPos[index] + new Vector2((float) rCurrentNPC.width, (float) rCurrentNPC.height) / 2f - screenPos - new Vector2((float) texture16.Width, (float) (texture16.Height / Main.npcFrameCount[type])) * rCurrentNPC.scale / 2f + (halfSize * rCurrentNPC.scale + new Vector2(0.0f, addY + addHeight + rCurrentNPC.gfxOffY)); mySpriteBatch.Draw(texture16, position32, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), color33, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } for (int index = 1; index < num145; ++index) { Microsoft.Xna.Framework.Color newColor = Microsoft.Xna.Framework.Color.Lerp(color32, yellow, amount13); Microsoft.Xna.Framework.Color color34 = rCurrentNPC.GetAlpha(newColor) * (1f - num150); Vector2 position33 = rCurrentNPC.Center + ((float) ((double) index / (double) num145 * 6.28318548202515) + rCurrentNPC.rotation).ToRotationVector2() * num151 * num150 - screenPos - new Vector2((float) texture16.Width, (float) (texture16.Height / Main.npcFrameCount[type])) * rCurrentNPC.scale / 2f + (halfSize * rCurrentNPC.scale + new Vector2(0.0f, addY + addHeight + rCurrentNPC.gfxOffY)); mySpriteBatch.Draw(texture16, position33, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), color34, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } mySpriteBatch.Draw(texture16, position31, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), color32, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); return; } if (type == 439 || type == 440) { int num156 = rCurrentNPC.frame.Y / (TextureAssets.Npc[type].Height() / Main.npcFrameCount[type]); Texture2D texture17 = TextureAssets.Npc[type].Value; Texture2D texture2D15 = TextureAssets.Extra[30].Value; Microsoft.Xna.Framework.Rectangle r12 = texture2D15.Frame(); r12.Height /= 2; if (num156 >= 4) r12.Y += r12.Height; Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; float amount14 = 0.0f; Microsoft.Xna.Framework.Color color35 = npcColor2; int num157 = 0; int num158 = 0; int num159 = 0; if ((double) rCurrentNPC.ai[0] == -1.0) { if ((double) rCurrentNPC.ai[1] >= 320.0 && (double) rCurrentNPC.ai[1] < 960.0) { white = Microsoft.Xna.Framework.Color.White; amount14 = 0.5f; num157 = 6; num158 = 2; num159 = 1; } } else if ((double) rCurrentNPC.ai[0] == 1.0) { white = Microsoft.Xna.Framework.Color.White; amount14 = 0.5f; num157 = 4; num158 = 2; num159 = 1; } else color35 = npcColor2; for (int index = num159; index < num157; index += num158) { ref Vector2 local = ref rCurrentNPC.oldPos[index]; Microsoft.Xna.Framework.Color color36 = color35; color36 = Microsoft.Xna.Framework.Color.Lerp(color36, white, amount14); color36 = rCurrentNPC.GetAlpha(color36); color36 *= (float) (num157 - index) / (float) num157; color36.A = (byte) 100; Vector2 position34 = rCurrentNPC.oldPos[index] + new Vector2((float) rCurrentNPC.width, (float) rCurrentNPC.height) / 2f - screenPos - r12.Size() * rCurrentNPC.scale / 2f + (halfSize * rCurrentNPC.scale + new Vector2(0.0f, addY + addHeight + rCurrentNPC.gfxOffY)); mySpriteBatch.Draw(texture2D15, position34, new Microsoft.Xna.Framework.Rectangle?(r12), color36, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } int num160 = 0; float num161 = 0.0f; float num162 = 0.0f; if ((double) rCurrentNPC.ai[0] == 5.0 && (double) rCurrentNPC.ai[1] >= 0.0 && (double) rCurrentNPC.ai[1] < 30.0) { num160 = 4; num161 = (1f - (float) Math.Cos(((double) rCurrentNPC.ai[1] - 0.0) / 30.0 * 3.14159274101257)) / 2f; num162 = 70f; } for (int index = 0; index < num160; ++index) { Microsoft.Xna.Framework.Color newColor = Microsoft.Xna.Framework.Color.Lerp(npcColor2, white, amount14); Microsoft.Xna.Framework.Color color37 = rCurrentNPC.GetAlpha(newColor) * (1f - num161); Vector2 position35 = rCurrentNPC.Center + ((float) ((double) index / (double) num160 * 6.28318548202515) + rCurrentNPC.rotation).ToRotationVector2() * num162 * num161 - screenPos - new Vector2((float) texture17.Width, (float) (texture17.Height / Main.npcFrameCount[type])) * rCurrentNPC.scale / 2f + (halfSize * rCurrentNPC.scale + new Vector2(0.0f, addY + addHeight + rCurrentNPC.gfxOffY)); mySpriteBatch.Draw(texture2D15, position35, new Microsoft.Xna.Framework.Rectangle?(r12), color37, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } Vector2 position36 = rCurrentNPC.Center - screenPos - new Vector2((float) texture17.Width, (float) (texture17.Height / Main.npcFrameCount[type])) * rCurrentNPC.scale / 2f + (halfSize * rCurrentNPC.scale + new Vector2(0.0f, addY + addHeight + rCurrentNPC.gfxOffY)); mySpriteBatch.Draw(texture17, position36, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), rCurrentNPC.GetAlpha(npcColor2), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); return; } if (type == 392 || type == 393 || type == 394 || type == 395) { Texture2D texture18 = TextureAssets.Npc[type].Value; Vector2 position37 = (rCurrentNPC.Center - screenPos + Vector2.UnitY * rCurrentNPC.gfxOffY).Floor(); float num163 = 0.0f; if (type == 393) num163 = -8f; mySpriteBatch.Draw(texture18, position37, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), rCurrentNPC.GetAlpha(npcColor2), rCurrentNPC.rotation, halfSize + Vector2.UnitY * num163, rCurrentNPC.scale, spriteEffects, 0.0f); if (type == 392) mySpriteBatch.Draw(TextureAssets.GlowMask[48].Value, position37, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color(200, 200, 200, 0), rCurrentNPC.rotation, halfSize + Vector2.UnitY * num163, rCurrentNPC.scale, spriteEffects, 0.0f); if (type == 395) mySpriteBatch.Draw(TextureAssets.GlowMask[49].Value, position37, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color(200, 200, 200, 0), rCurrentNPC.rotation, halfSize + Vector2.UnitY * num163, rCurrentNPC.scale, spriteEffects, 0.0f); if (type != 394) return; mySpriteBatch.Draw(TextureAssets.GlowMask[50].Value, position37, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color(200, 200, 200, 0), rCurrentNPC.rotation, halfSize + Vector2.UnitY * num163, rCurrentNPC.scale, spriteEffects, 0.0f); return; } if (type == 83 || type == 84 || type == 179) { mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), Microsoft.Xna.Framework.Color.White, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); return; } if (type >= 87 && type <= 92) { Microsoft.Xna.Framework.Color alpha2 = rCurrentNPC.GetAlpha(npcColor2); byte num164 = (byte) (((int) Main.tileColor.R + (int) Main.tileColor.G + (int) Main.tileColor.B) / 3); if ((int) alpha2.R < (int) num164) alpha2.R = num164; if ((int) alpha2.G < (int) num164) alpha2.G = num164; if ((int) alpha2.B < (int) num164) alpha2.B = num164; mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), alpha2, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); return; } switch (type) { case 94: for (int index = 1; index < 6; index += 2) { ref Vector2 local = ref rCurrentNPC.oldPos[index]; Microsoft.Xna.Framework.Color alpha3 = rCurrentNPC.GetAlpha(npcColor2); alpha3.R = (byte) ((int) alpha3.R * (10 - index) / 15); alpha3.G = (byte) ((int) alpha3.G * (10 - index) / 15); alpha3.B = (byte) ((int) alpha3.B * (10 - index) / 15); alpha3.A = (byte) ((int) alpha3.A * (10 - index) / 15); mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2((float) ((double) rCurrentNPC.oldPos[index].X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.oldPos[index].Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), alpha3, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } break; case 384: return; case 396: Texture2D texture19 = TextureAssets.Npc[type].Value; Vector2 origin15 = new Vector2(191f, 130f); Texture2D texture20 = TextureAssets.Extra[18].Value; Texture2D texture21 = TextureAssets.Extra[19].Value; Vector2 origin16 = new Vector2(19f, 34f); Vector2 vector2_10 = new Vector2(27f, 59f); Vector2 vector2_11 = new Vector2(0.0f, 0.0f); Texture2D texture2D16 = TextureAssets.Extra[25].Value; Vector2 vector2_12 = new Vector2(0.0f, 214f).RotatedBy((double) rCurrentNPC.rotation); Microsoft.Xna.Framework.Rectangle r13 = texture2D16.Frame(); r13.Height /= 3; r13.Y += r13.Height * (int) ((double) rCurrentNPC.localAI[2] / 7.0); Texture2D texture2D17 = TextureAssets.Extra[29].Value; Vector2 vector2_13 = new Vector2(0.0f, 4f).RotatedBy((double) rCurrentNPC.rotation); Microsoft.Xna.Framework.Rectangle r14 = texture2D17.Frame(); r14.Height /= 4; r14.Y += r14.Height * (int) ((double) rCurrentNPC.localAI[3] / 5.0); Texture2D texture2D18 = TextureAssets.Extra[26].Value; Microsoft.Xna.Framework.Rectangle rectangle4 = texture2D18.Frame(); rectangle4.Height /= 4; Vector2 center1 = Main.npc[(int) rCurrentNPC.ai[3]].Center; Microsoft.Xna.Framework.Point tileCoordinates1 = rCurrentNPC.Center.ToTileCoordinates(); Microsoft.Xna.Framework.Color alpha4 = rCurrentNPC.GetAlpha(Microsoft.Xna.Framework.Color.Lerp(Lighting.GetColor(tileCoordinates1.X, tileCoordinates1.Y), Microsoft.Xna.Framework.Color.White, 0.3f)); if ((double) rCurrentNPC.ai[0] < 0.0) { int num165 = (int) rCurrentNPC.ai[1] / 8; rectangle4.Y += rectangle4.Height * num165; mySpriteBatch.Draw(texture2D18, rCurrentNPC.Center - screenPos, new Microsoft.Xna.Framework.Rectangle?(rectangle4), alpha4, rCurrentNPC.rotation, origin16 + new Vector2(4f, 4f), 1f, spriteEffects, 0.0f); } else { mySpriteBatch.Draw(texture20, rCurrentNPC.Center - screenPos, new Microsoft.Xna.Framework.Rectangle?(), alpha4, rCurrentNPC.rotation, origin16, 1f, spriteEffects, 0.0f); Vector2 vector2_14 = Utils.Vector2FromElipse(rCurrentNPC.localAI[0].ToRotationVector2(), vector2_10 * rCurrentNPC.localAI[1]); mySpriteBatch.Draw(texture21, rCurrentNPC.Center - screenPos + vector2_14 + vector2_11, new Microsoft.Xna.Framework.Rectangle?(), alpha4, rCurrentNPC.rotation, new Vector2((float) texture21.Width, (float) texture21.Height) / 2f, 1f, SpriteEffects.None, 0.0f); } mySpriteBatch.Draw(texture19, rCurrentNPC.Center - screenPos, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), alpha4, rCurrentNPC.rotation, origin15, 1f, spriteEffects, 0.0f); mySpriteBatch.Draw(texture2D17, (rCurrentNPC.Center - screenPos + vector2_13).Floor(), new Microsoft.Xna.Framework.Rectangle?(r14), alpha4, rCurrentNPC.rotation, r14.Size() / 2f, 1f, spriteEffects, 0.0f); mySpriteBatch.Draw(texture2D16, (rCurrentNPC.Center - screenPos + vector2_12).Floor(), new Microsoft.Xna.Framework.Rectangle?(r13), alpha4, rCurrentNPC.rotation, r13.Size() / 2f, 1f, spriteEffects, 0.0f); return; case 397: Texture2D texture22 = TextureAssets.Npc[type].Value; float num166 = 0.5f; Vector2 vector2_15 = new Vector2(220f, -60f); Vector2 vector2_16 = new Vector2(0.0f, 76f); Texture2D texture23 = TextureAssets.Extra[15].Value; Vector2 vector2_17 = new Vector2(60f, 30f); float num167 = 340f; Vector2 center2 = Main.npc[(int) rCurrentNPC.ai[3]].Center; Microsoft.Xna.Framework.Point tileCoordinates2 = rCurrentNPC.Center.ToTileCoordinates(); Microsoft.Xna.Framework.Color alpha5 = rCurrentNPC.GetAlpha(Microsoft.Xna.Framework.Color.Lerp(Lighting.GetColor(tileCoordinates2.X, tileCoordinates2.Y), Microsoft.Xna.Framework.Color.White, 0.3f)); bool flag5 = (double) rCurrentNPC.ai[2] == 0.0; Vector2 vector2_18 = new Vector2(flag5 ? -1f : 1f, 1f); Vector2 origin17 = new Vector2(120f, 180f); if (!flag5) origin17.X = (float) texture22.Width - origin17.X; Texture2D texture24 = TextureAssets.Extra[17].Value; Texture2D texture25 = TextureAssets.Extra[19].Value; Vector2 origin18 = new Vector2(26f, 42f); if (!flag5) origin18.X = (float) texture24.Width - origin18.X; Vector2 vector2_19 = new Vector2(30f, 66f); Vector2 vector2_20 = new Vector2((float) (1.0 * -(double) vector2_18.X), 3f); Texture2D texture2D19 = TextureAssets.Extra[26].Value; Microsoft.Xna.Framework.Rectangle rectangle5 = texture2D19.Frame(); rectangle5.Height /= 4; Vector2 vector2_21 = vector2_15 * vector2_18; Vector2 vector2_22 = center2 + vector2_21; Vector2 vector2_23 = rCurrentNPC.Center + vector2_16; Vector2 vector2_24 = vector2_23; Vector2 v1 = (vector2_22 - vector2_24) * (1f - num166); Vector2 origin19 = vector2_17; if (!flag5) origin19.X = (float) texture23.Width - origin19.X; float num168 = (float) Math.Acos((double) v1.Length() / (double) num167) * -vector2_18.X; mySpriteBatch.Draw(texture23, vector2_23 - screenPos, new Microsoft.Xna.Framework.Rectangle?(), alpha5, (float) ((double) v1.ToRotation() + (double) num168 - 1.57079637050629), origin19, 1f, spriteEffects, 0.0f); if ((double) rCurrentNPC.ai[0] == -2.0) { int num169 = (int) rCurrentNPC.ai[1] / 8; rectangle5.Y += rectangle5.Height * num169; mySpriteBatch.Draw(texture2D19, rCurrentNPC.Center - screenPos, new Microsoft.Xna.Framework.Rectangle?(rectangle5), alpha5, 0.0f, origin18 - new Vector2(4f, 4f), 1f, spriteEffects, 0.0f); } else { mySpriteBatch.Draw(texture24, rCurrentNPC.Center - screenPos, new Microsoft.Xna.Framework.Rectangle?(), alpha5, 0.0f, origin18, 1f, spriteEffects, 0.0f); Vector2 vector2_25 = Utils.Vector2FromElipse(rCurrentNPC.localAI[0].ToRotationVector2(), vector2_19 * rCurrentNPC.localAI[1]); mySpriteBatch.Draw(texture25, rCurrentNPC.Center - screenPos + vector2_25 + vector2_20, new Microsoft.Xna.Framework.Rectangle?(), alpha5, 0.0f, new Vector2((float) texture25.Width, (float) texture25.Height) / 2f, 1f, SpriteEffects.None, 0.0f); } mySpriteBatch.Draw(texture22, rCurrentNPC.Center - screenPos, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), alpha5, 0.0f, origin17, 1f, spriteEffects, 0.0f); return; case 398: bool flag6 = false; Texture2D texture26 = TextureAssets.Npc[type].Value; Texture2D texture27 = TextureAssets.Extra[16].Value; Texture2D texture28 = TextureAssets.Extra[14].Value; float y2 = 340f; float num170 = 0.5f; Vector2 vector2_26 = new Vector2(220f, -60f); Vector2 vector2_27 = new Vector2(76f, 66f); Texture2D texture29 = TextureAssets.Extra[13].Value; Vector2 origin20 = new Vector2((float) texture29.Width, 278f); Vector2 origin21 = new Vector2(0.0f, 278f); Vector2 vector2_28 = new Vector2(0.0f, 76f); Vector2 center3 = rCurrentNPC.Center; Microsoft.Xna.Framework.Point tileCoordinates3 = (rCurrentNPC.Center + new Vector2(0.0f, -150f)).ToTileCoordinates(); Microsoft.Xna.Framework.Color alpha6 = rCurrentNPC.GetAlpha(Microsoft.Xna.Framework.Color.Lerp(Lighting.GetColor(tileCoordinates3.X, tileCoordinates3.Y), Microsoft.Xna.Framework.Color.White, 0.3f)); for (int index5 = 0; index5 < 2; ++index5) { bool flag7 = index5 == 0; Vector2 vector2_29 = new Vector2(flag7 ? -1f : 1f, 1f); int index6 = -1; for (int index7 = 0; index7 < 200; ++index7) { if (Main.npc[index7].active && Main.npc[index7].type == 397 && (double) Main.npc[index7].ai[2] == (double) index5 && (double) Main.npc[index7].ai[3] == (double) rCurrentNPC.whoAmI) { index6 = index7; break; } } if (index6 != -1) { Vector2 Position = center3 + vector2_26 * vector2_29; Vector2 v2 = (Main.npc[index6].Center + vector2_28 - Position) * num170; if (flag6) Main.dust[Dust.NewDust(Position + v2, 0, 0, 6)].noGravity = true; float num171 = (float) Math.Acos((double) v2.Length() / (double) y2) * -vector2_29.X; SpriteEffects effects2 = flag7 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; Vector2 origin22 = vector2_27; if (!flag7) origin22.X = (float) texture28.Width - origin22.X; mySpriteBatch.Draw(texture28, Position - screenPos, new Microsoft.Xna.Framework.Rectangle?(), alpha6, (float) ((double) v2.ToRotation() - (double) num171 - 1.57079637050629), origin22, 1f, effects2, 0.0f); if (flag6) Main.dust[Dust.NewDust(Position, 0, 0, 6)].noGravity = true; if (flag6) Main.dust[Dust.NewDust(center3, 0, 0, 6)].noGravity = true; if (flag6) Main.dust[Dust.NewDust(Position + new Vector2(0.0f, y2).RotatedBy((double) v2.ToRotation() - (double) num171 - 1.57079637050629), 0, 0, 6)].noGravity = true; } } mySpriteBatch.Draw(texture29, center3 - screenPos, new Microsoft.Xna.Framework.Rectangle?(), alpha6, 0.0f, origin20, 1f, SpriteEffects.None, 0.0f); mySpriteBatch.Draw(texture29, center3 - screenPos, new Microsoft.Xna.Framework.Rectangle?(), alpha6, 0.0f, origin21, 1f, SpriteEffects.FlipHorizontally, 0.0f); mySpriteBatch.Draw(texture27, center3 - screenPos, new Microsoft.Xna.Framework.Rectangle?(), alpha6, 0.0f, new Vector2(112f, 101f), 1f, SpriteEffects.None, 0.0f); mySpriteBatch.Draw(texture26, center3 - screenPos, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), alpha6, 0.0f, rCurrentNPC.frame.Size() / 2f, 1f, SpriteEffects.None, 0.0f); return; case 399: Texture2D texture30 = TextureAssets.Npc[type].Value; (rCurrentNPC.position - screenPos + Vector2.UnitY * rCurrentNPC.gfxOffY).Floor(); float num172 = 5f; for (int index8 = 0; (double) index8 < (double) num172; ++index8) { float num173 = (float) (1.0 - ((double) Main.GlobalTimeWrappedHourly + (double) index8) % (double) num172 / (double) num172); Microsoft.Xna.Framework.Color color38 = Microsoft.Xna.Framework.Color.LimeGreen; if ((double) rCurrentNPC.ai[0] == 1.0) color38 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.LimeGreen, Microsoft.Xna.Framework.Color.Red, MathHelper.Clamp(rCurrentNPC.ai[1] / 20f, 0.0f, 1f)); if ((double) rCurrentNPC.ai[0] == 2.0) color38 = Microsoft.Xna.Framework.Color.Red; Microsoft.Xna.Framework.Color color39 = color38 * (1f - num173); color39.A = (byte) 0; for (int index9 = 0; index9 < 2; ++index9) mySpriteBatch.Draw(TextureAssets.Extra[27].Value, rCurrentNPC.Center - screenPos + Vector2.UnitY * (float) ((double) rCurrentNPC.gfxOffY - 4.0 + 6.0), new Microsoft.Xna.Framework.Rectangle?(), color39, 1.570796f, new Vector2(10f, 48f), num173 * 4f, SpriteEffects.None, 0.0f); } mySpriteBatch.Draw(texture30, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), rCurrentNPC.GetAlpha(npcColor2), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); Texture2D texture31 = TextureAssets.GlowMask[100].Value; mySpriteBatch.Draw(texture31, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color((int) sbyte.MaxValue - rCurrentNPC.alpha / 2, (int) sbyte.MaxValue - rCurrentNPC.alpha / 2, (int) sbyte.MaxValue - rCurrentNPC.alpha / 2, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); Texture2D texture2D20 = TextureAssets.Extra[20].Value; Microsoft.Xna.Framework.Rectangle rectangle6 = texture2D20.Frame(verticalFrames: 4, frameY: ((int) rCurrentNPC.ai[0] + 1)); Vector2 position38 = new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) texture2D20.Width * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale + (double) addHeight + (double) addY + (double) rCurrentNPC.gfxOffY + 18.0 + 6.0)); mySpriteBatch.Draw(texture2D20, position38, new Microsoft.Xna.Framework.Rectangle?(rectangle6), rCurrentNPC.GetAlpha(npcColor2), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); Texture2D texture32 = TextureAssets.GlowMask[101].Value; mySpriteBatch.Draw(texture32, position38, new Microsoft.Xna.Framework.Rectangle?(rectangle6), new Microsoft.Xna.Framework.Color((int) sbyte.MaxValue - rCurrentNPC.alpha / 2, (int) sbyte.MaxValue - rCurrentNPC.alpha / 2, (int) sbyte.MaxValue - rCurrentNPC.alpha / 2, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); return; case 400: Texture2D texture33 = TextureAssets.Npc[type].Value; Texture2D texture2D21 = TextureAssets.Extra[19].Value; Vector2 origin23 = new Vector2(40f, 40f); Vector2 vector2_30 = new Vector2(30f, 30f); Vector2 center4 = rCurrentNPC.Center; Microsoft.Xna.Framework.Point tileCoordinates4 = rCurrentNPC.Center.ToTileCoordinates(); Microsoft.Xna.Framework.Color alpha7 = rCurrentNPC.GetAlpha(Microsoft.Xna.Framework.Color.Lerp(Lighting.GetColor(tileCoordinates4.X, tileCoordinates4.Y), Microsoft.Xna.Framework.Color.White, 0.3f)); mySpriteBatch.Draw(texture33, rCurrentNPC.Center - screenPos, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), alpha7, rCurrentNPC.rotation, origin23, 1f, spriteEffects, 0.0f); Vector2 vector2_31 = Utils.Vector2FromElipse(rCurrentNPC.localAI[0].ToRotationVector2(), vector2_30 * rCurrentNPC.localAI[1]); mySpriteBatch.Draw(texture2D21, rCurrentNPC.Center - screenPos + vector2_31, new Microsoft.Xna.Framework.Rectangle?(), alpha7, rCurrentNPC.rotation, texture2D21.Size() / 2f, rCurrentNPC.localAI[2], SpriteEffects.None, 0.0f); return; case 416: int index10 = -1; int index11 = (int) rCurrentNPC.ai[0]; Vector2 position39 = rCurrentNPC.position; Vector2 spinningpoint4 = Vector2.Zero; if (Main.npc[index11].active && Main.npc[index11].type == 415) index10 = index11; if (index10 != -1) { Vector2 position40 = rCurrentNPC.position; rCurrentNPC.Bottom = Main.npc[index10].Bottom; position39 = rCurrentNPC.position; rCurrentNPC.position = position40; rCurrentNPC.gfxOffY = Main.npc[index10].gfxOffY; spinningpoint4 = Main.npc[index10].velocity; } Microsoft.Xna.Framework.Rectangle frame3 = rCurrentNPC.frame; mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2((float) ((double) position39.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) position39.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame3), rCurrentNPC.GetAlpha(npcColor2), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); if (rCurrentNPC.color != new Microsoft.Xna.Framework.Color()) mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2((float) ((double) position39.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) position39.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame3), rCurrentNPC.GetColor(npcColor2), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); mySpriteBatch.Draw(TextureAssets.GlowMask[156].Value, position39 + rCurrentNPC.Size * new Vector2(0.5f, 1f) - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); vector3 = rCurrentNPC.GetAlpha(npcColor2).ToVector3() - new Vector3(0.5f); float num174 = (float) (0.5 + (double) vector3.Length() * 0.5); for (int index12 = 0; index12 < 4; ++index12) mySpriteBatch.Draw(TextureAssets.GlowMask[156].Value, position39 + rCurrentNPC.Size * new Vector2(0.5f, 1f) - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY) + spinningpoint4.RotatedBy((double) index12 * 1.57079637050629) * num174, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color(64, 64, 64, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); return; case 491: NPC npc4 = rCurrentNPC; Texture2D texture34 = TextureAssets.Npc[npc4.type].Value; Microsoft.Xna.Framework.Rectangle frame4 = npc4.frame; Vector2 origin24 = frame4.OriginFlip(new Vector2(208f, 460f), spriteEffects); Vector2 position41 = npc4.Center - screenPos; Vector2 vector2_32 = new Vector2(spriteEffects.HasFlag((Enum) SpriteEffects.FlipHorizontally) ? -1f : 1f, 1f); Microsoft.Xna.Framework.Color alpha8 = npc4.GetAlpha(npcColor2); mySpriteBatch.Draw(texture34, position41, new Microsoft.Xna.Framework.Rectangle?(frame4), alpha8, npc4.rotation, origin24, npc4.scale, spriteEffects, 0.0f); int num175 = (int) npc4.localAI[3] / 8; Texture2D texture2D22 = TextureAssets.Extra[40].Value; Microsoft.Xna.Framework.Rectangle r15 = texture2D22.Frame(verticalFrames: 4, frameY: (num175 % 4)); Vector2 origin25 = r15.Size() * new Vector2(0.5f, 1f); mySpriteBatch.Draw(texture2D22, position41 + (new Vector2(102f, -384f) * vector2_32).RotatedBy((double) npc4.rotation), new Microsoft.Xna.Framework.Rectangle?(r15), alpha8, npc4.rotation, origin25, npc4.scale, spriteEffects, 0.0f); Texture2D texture2D23 = TextureAssets.Extra[41].Value; Microsoft.Xna.Framework.Rectangle r16 = texture2D23.Frame(verticalFrames: 8, frameY: (num175 % 8)); Vector2 origin26 = r16.Size() * new Vector2(0.5f, 0.0f) + new Vector2(0.0f, 10f); for (int index13 = 0; index13 < 5; ++index13) mySpriteBatch.Draw(texture2D23, position41 + (new Vector2((float) (34 * index13 - 96), 40f) * vector2_32).RotatedBy((double) npc4.rotation), new Microsoft.Xna.Framework.Rectangle?(r16), alpha8, npc4.rotation, origin26, npc4.scale, spriteEffects, 0.0f); Texture2D texture2D24 = TextureAssets.Extra[42].Value; Microsoft.Xna.Framework.Rectangle r17 = texture2D24.Frame(verticalFrames: 4, frameY: (num175 % 4)); Vector2 origin27 = r17.Size() * new Vector2(0.5f, 0.0f); for (int index14 = 0; index14 < 2; ++index14) mySpriteBatch.Draw(texture2D24, position41 + (new Vector2((float) (158 - 106 * index14), -302f) * vector2_32).RotatedBy((double) npc4.rotation), new Microsoft.Xna.Framework.Rectangle?(r17), alpha8, npc4.rotation, origin27, npc4.scale, spriteEffects, 0.0f); Texture2D texture2D25 = TextureAssets.Extra[43].Value; Microsoft.Xna.Framework.Rectangle r18 = texture2D25.Frame(verticalFrames: 4, frameY: (num175 % 4)); Vector2 origin28 = r18.Size() * new Vector2(0.5f, 0.0f); for (int index15 = 0; index15 < 2; ++index15) mySpriteBatch.Draw(texture2D25, position41 + (new Vector2((float) (42 - 178 * index15), -444f) * vector2_32).RotatedBy((double) npc4.rotation), new Microsoft.Xna.Framework.Rectangle?(r18), alpha8, npc4.rotation, origin28, npc4.scale, spriteEffects, 0.0f); Texture2D texture2D26 = TextureAssets.Extra[44].Value; Microsoft.Xna.Framework.Rectangle r19 = texture2D26.Frame(verticalFrames: 4, frameY: (num175 % 4)); Vector2 origin29 = r19.Size() * new Vector2(0.5f, 0.0f); mySpriteBatch.Draw(texture2D26, position41 + (new Vector2(-134f, -302f) * vector2_32).RotatedBy((double) npc4.rotation), new Microsoft.Xna.Framework.Rectangle?(r19), alpha8, npc4.rotation, origin29, npc4.scale, spriteEffects, 0.0f); Texture2D texture2D27 = TextureAssets.Extra[45].Value; Microsoft.Xna.Framework.Rectangle r20 = texture2D27.Frame(verticalFrames: 4, frameY: ((2 + num175) % 4)); Vector2 origin30 = r20.Size() * new Vector2(0.5f, 0.0f); mySpriteBatch.Draw(texture2D27, position41 + (new Vector2(-60f, -330f) * vector2_32).RotatedBy((double) npc4.rotation), new Microsoft.Xna.Framework.Rectangle?(r20), alpha8, npc4.rotation, origin30, npc4.scale, spriteEffects, 0.0f); this.LoadNPC(492); if (!TextureAssets.Npc[492].IsLoaded) return; Texture2D texture2D28 = TextureAssets.Npc[492].Value; Microsoft.Xna.Framework.Rectangle r21 = texture2D28.Frame(verticalFrames: 9); Vector2 origin31 = r21.Size() * new Vector2(0.5f, 0.0f) + new Vector2(0.0f, 10f); for (int index16 = 0; index16 < 4; ++index16) { int index17 = (int) npc4.ai[index16]; if (index17 >= 0) { r21.Y = Main.npc[index17].frame.Y; mySpriteBatch.Draw(texture2D28, position41 + (new Vector2((float) (68 * index16 - 122), -20f) * vector2_32).RotatedBy((double) npc4.rotation), new Microsoft.Xna.Framework.Rectangle?(r21), alpha8, npc4.rotation, origin31, npc4.scale, spriteEffects, 0.0f); } } return; } if (type == 125 || type == 126 || type == (int) sbyte.MaxValue || type == 128 || type == 129 || type == 130 || type == 131 || type == 139 || type == 140) { for (int index18 = 9; index18 >= 0; index18 -= 2) { ref Vector2 local = ref rCurrentNPC.oldPos[index18]; Microsoft.Xna.Framework.Color alpha9 = rCurrentNPC.GetAlpha(npcColor2); alpha9.R = (byte) ((int) alpha9.R * (10 - index18) / 20); alpha9.G = (byte) ((int) alpha9.G * (10 - index18) / 20); alpha9.B = (byte) ((int) alpha9.B * (10 - index18) / 20); alpha9.A = (byte) ((int) alpha9.A * (10 - index18) / 20); mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2((float) ((double) rCurrentNPC.oldPos[index18].X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.oldPos[index18].Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), alpha9, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } } if (type == 417 && (double) rCurrentNPC.ai[0] >= 6.0 && (double) rCurrentNPC.ai[0] <= 6.0) { for (int index19 = 5; index19 >= 0; --index19) { ref Vector2 local = ref rCurrentNPC.oldPos[index19]; Microsoft.Xna.Framework.Color alpha10 = rCurrentNPC.GetAlpha(npcColor2); alpha10.R = (byte) ((int) alpha10.R * (10 - index19) / 20); alpha10.G = (byte) ((int) alpha10.G * (10 - index19) / 20); alpha10.B = (byte) ((int) alpha10.B * (10 - index19) / 20); alpha10.A = (byte) ((int) alpha10.A * (10 - index19) / 20); mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2((float) ((double) rCurrentNPC.oldPos[index19].X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.oldPos[index19].Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), alpha10, rCurrentNPC.oldRot[index19], halfSize, MathHelper.Lerp(0.5f, 1f, (float) ((5.0 - (double) index19) / 6.0)), spriteEffects, 0.0f); } } if (type == 419 && (double) rCurrentNPC.ai[2] <= -9.0) { int num176 = TextureAssets.GlowMask[154].Height() / Main.npcFrameCount[type]; int num177 = rCurrentNPC.frame.Y / num176; for (int index20 = 6; index20 >= 0; --index20) { ref Vector2 local = ref rCurrentNPC.oldPos[index20]; Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; white.R = (byte) ((int) byte.MaxValue * (10 - index20) / 20); white.G = (byte) ((int) byte.MaxValue * (10 - index20) / 20); white.B = (byte) ((int) byte.MaxValue * (10 - index20) / 20); white.A = (byte) 0; Microsoft.Xna.Framework.Rectangle frame5 = rCurrentNPC.frame; int num178 = (num177 - 3 - index20) % 3; if (num178 < 0) num178 += 3; int num179 = num178 + 5; frame5.Y = num176 * num179; mySpriteBatch.Draw(TextureAssets.GlowMask[154].Value, new Vector2((float) ((double) rCurrentNPC.oldPos[index20].X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.oldPos[index20].Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(frame5), white, rCurrentNPC.oldRot[index20], halfSize, MathHelper.Lerp(0.75f, 1.2f, (float) ((10.0 - (double) index20) / 10.0)), spriteEffects, 0.0f); } } if (type == 418 && ((double) rCurrentNPC.ai[0] == 2.0 || (double) rCurrentNPC.ai[0] == 4.0)) { Texture2D texture2D29 = TextureAssets.Extra[55].Value; Vector2 origin32 = new Vector2((float) (texture2D29.Width / 2), (float) (texture2D29.Height / 8 + 14)); int num180 = (int) rCurrentNPC.ai[1] / 2; float num181 = -1.570796f * (float) rCurrentNPC.spriteDirection; float amount15 = rCurrentNPC.ai[1] / 45f; if ((double) amount15 > 1.0) amount15 = 1f; int num182 = num180 % 4; for (int index21 = 6; index21 >= 0; --index21) { ref Vector2 local = ref rCurrentNPC.oldPos[index21]; Microsoft.Xna.Framework.Color color40 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Gold, Microsoft.Xna.Framework.Color.OrangeRed, amount15); color40 = Microsoft.Xna.Framework.Color.Lerp(color40, Microsoft.Xna.Framework.Color.Blue, (float) index21 / 12f); color40.A = (byte) (64.0 * (double) amount15); color40.R = (byte) ((int) color40.R * (10 - index21) / 20); color40.G = (byte) ((int) color40.G * (10 - index21) / 20); color40.B = (byte) ((int) color40.B * (10 - index21) / 20); color40.A = (byte) ((int) color40.A * (10 - index21) / 20); color40 *= amount15; int frameY = (num182 - index21) % 4; if (frameY < 0) frameY += 4; Microsoft.Xna.Framework.Rectangle rectangle7 = texture2D29.Frame(verticalFrames: 4, frameY: frameY); mySpriteBatch.Draw(texture2D29, new Vector2((float) ((double) rCurrentNPC.oldPos[index21].X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.oldPos[index21].Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(rectangle7), color40, rCurrentNPC.oldRot[index21] + num181, origin32, MathHelper.Lerp(0.1f, 1.2f, (float) ((10.0 - (double) index21) / 10.0)), spriteEffects, 0.0f); } } if (type == 516) { int num183 = TextureAssets.Npc[type].Height() / Main.npcFrameCount[type]; int num184 = rCurrentNPC.frame.Y / num183; for (int index22 = 6; index22 >= 0; --index22) { ref Vector2 local = ref rCurrentNPC.oldPos[index22]; Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; white.R = (byte) ((int) byte.MaxValue * (10 - index22) / 20); white.G = (byte) ((int) byte.MaxValue * (10 - index22) / 20); white.B = (byte) ((int) byte.MaxValue * (10 - index22) / 20); white.A = (byte) ((int) byte.MaxValue * (10 - index22) / 20); Microsoft.Xna.Framework.Color color41 = Microsoft.Xna.Framework.Color.Lerp(white, Microsoft.Xna.Framework.Color.Transparent, (float) index22 / 6f); Microsoft.Xna.Framework.Rectangle frame6 = rCurrentNPC.frame; int num185 = (num184 - 4 - index22) % 4; if (num185 < 0) num185 += 4; frame6.Y = num183 * num185; mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2((float) ((double) rCurrentNPC.oldPos[index22].X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.oldPos[index22].Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(frame6), color41, rCurrentNPC.rotation, halfSize, MathHelper.Lerp(0.35f, 1.2f, (float) ((10.0 - (double) index22) / 10.0)), spriteEffects, 0.0f); } } if (rCurrentNPC.type == 390 && rCurrentNPC.IsABestiaryIconDummy) { this.LoadNPC(391); Texture2D texture2D30 = TextureAssets.Npc[391].Value; Microsoft.Xna.Framework.Rectangle rectangle8 = texture2D30.Frame(verticalFrames: Main.npcFrameCount[391], frameY: ((int) rCurrentNPC.localAI[3])); Vector2 vector2_33 = new Vector2((float) (-rCurrentNPC.width - 8), 10f); mySpriteBatch.Draw(texture2D30, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY) + vector2_33, new Microsoft.Xna.Framework.Rectangle?(rectangle8), rCurrentNPC.GetAlpha(npcColor2), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } Microsoft.Xna.Framework.Rectangle frame7 = rCurrentNPC.frame; if (type == 182 || type == 289) frame7.Height -= 2; if ((uint) (type - 420) > 1U && (uint) (type - 423) > 1U) { if (type == 662) { float num186 = (float) (4.0 + 2.0 * Math.Cos(6.28318548202515 * (double) Main.GlobalTimeWrappedHourly)); Vector2 spinningpoint5 = Vector2.UnitX * num186; Microsoft.Xna.Framework.Color color42 = Microsoft.Xna.Framework.Color.Cyan * (num186 / 12f) * 0.4f; color42.A /= (byte) 4; for (float num187 = 0.9f; (double) num187 >= 0.0; num187 -= 0.125f) { Vector2 vector2_34 = rCurrentNPC.position - rCurrentNPC.velocity * 10f * num187; mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2((float) ((double) vector2_34.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) vector2_34.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame7), color42 * (1f - num187), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } for (float num188 = 0.0f; (double) num188 < 6.28318548202515; num188 += 1.570796f) { Vector2 vector2_35 = rCurrentNPC.position + spinningpoint5.RotatedBy((double) num188); mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2((float) ((double) vector2_35.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) vector2_35.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame7), color42, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } } } else { float num189 = (float) (9.0 + 3.0 * Math.Cos(6.28318548202515 * (double) Main.GlobalTimeWrappedHourly)); Vector2 spinningpoint6 = Vector2.UnitX * num189; Microsoft.Xna.Framework.Color color43 = Microsoft.Xna.Framework.Color.Teal * (num189 / 12f) * 0.8f; color43.A /= (byte) 2; for (float num190 = 0.0f; (double) num190 < 6.28318548202515; num190 += 1.570796f) { Vector2 vector2_36 = rCurrentNPC.position + spinningpoint6.RotatedBy((double) num190); mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2((float) ((double) vector2_36.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) vector2_36.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame7), color43, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } } if (rCurrentNPC.aiStyle == 7) this.DrawNPCExtras(rCurrentNPC, true, addHeight, addY, npcColor2, halfSize, spriteEffects, screenPos); if (type == 346 && (double) rCurrentNPC.life < (double) rCurrentNPC.lifeMax * 0.5) { mySpriteBatch.Draw(TextureAssets.SantaTank.Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame7), rCurrentNPC.GetAlpha(npcColor2), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } else { switch (type) { case 356: --frame7.Height; mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame7), rCurrentNPC.GetAlpha(npcColor2), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 360: float num191 = 0.0f; if ((double) rCurrentNPC.ai[2] == 0.0) { if ((double) rCurrentNPC.rotation == 3.14000010490417 || (double) rCurrentNPC.rotation == -3.14000010490417) addHeight = 2f; if (rCurrentNPC.direction < 0 && ((double) rCurrentNPC.rotation == 1.57000005245209 || (double) rCurrentNPC.rotation == 4.71000003814697)) num191 = 1f; if (rCurrentNPC.direction > 0 && ((double) rCurrentNPC.rotation == 1.57000005245209 || (double) rCurrentNPC.rotation == 4.71000003814697)) num191 = -1f; } mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale) + num191, (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame7), rCurrentNPC.GetAlpha(npcColor2), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 655: float num192 = 0.0f; if ((double) rCurrentNPC.ai[2] == 0.0) { if ((double) rCurrentNPC.rotation == 3.14000010490417 || (double) rCurrentNPC.rotation == -3.14000010490417) addHeight = 2f; if (rCurrentNPC.direction < 0 && ((double) rCurrentNPC.rotation == 1.57000005245209 || (double) rCurrentNPC.rotation == 4.71000003814697)) num192 = 1f; if (rCurrentNPC.direction > 0 && ((double) rCurrentNPC.rotation == 1.57000005245209 || (double) rCurrentNPC.rotation == 4.71000003814697)) num192 = -1f; } mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale) + num192, (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame7), rCurrentNPC.GetAlpha(Microsoft.Xna.Framework.Color.Orange), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; default: if (type == 266 && rCurrentNPC.life < rCurrentNPC.lifeMax && (Main.expertMode || Main.getGoodWorld)) { Microsoft.Xna.Framework.Color alpha11 = rCurrentNPC.GetAlpha(npcColor2); float num193 = (float) (1.0 - (double) rCurrentNPC.life / (double) rCurrentNPC.lifeMax); float num194 = num193 * num193; if (Main.getGoodWorld) num194 = 1f; alpha11.R = (byte) ((double) alpha11.R * (double) num194); alpha11.G = (byte) ((double) alpha11.G * (double) num194); alpha11.B = (byte) ((double) alpha11.B * (double) num194); alpha11.A = (byte) ((double) alpha11.A * (double) num194); for (int index23 = 0; index23 < 4; ++index23) { Vector2 position42 = rCurrentNPC.position; float num195 = Math.Abs(rCurrentNPC.Center.X - Main.player[Main.myPlayer].Center.X); float num196 = Math.Abs(rCurrentNPC.Center.Y - Main.player[Main.myPlayer].Center.Y); position42.X = index23 == 0 || index23 == 2 ? Main.player[Main.myPlayer].Center.X + num195 : Main.player[Main.myPlayer].Center.X - num195; position42.X -= (float) (rCurrentNPC.width / 2); position42.Y = index23 == 0 || index23 == 1 ? Main.player[Main.myPlayer].Center.Y + num196 : Main.player[Main.myPlayer].Center.Y - num196; position42.Y -= (float) (rCurrentNPC.height / 2); mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2((float) ((double) position42.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) position42.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame7), alpha11, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame7), rCurrentNPC.GetAlpha(npcColor2), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; } if (type == 421 && (double) rCurrentNPC.ai[0] == 5.0) { Player player = Main.player[rCurrentNPC.target]; if ((double) player.gravDir == -1.0) spriteEffects |= SpriteEffects.FlipVertically; mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2((float) (player.direction * 4), player.gfxOffY) + ((double) player.gravDir == 1.0 ? player.Top : player.Bottom) - screenPos, new Microsoft.Xna.Framework.Rectangle?(frame7), rCurrentNPC.GetAlpha(npcColor2), rCurrentNPC.rotation, frame7.Size() / 2f, rCurrentNPC.scale, spriteEffects, 0.0f); mySpriteBatch.Draw(TextureAssets.GlowMask[146].Value, new Vector2((float) (player.direction * 4), player.gfxOffY) + ((double) player.gravDir == 1.0 ? player.Top : player.Bottom) - screenPos, new Microsoft.Xna.Framework.Rectangle?(frame7), rCurrentNPC.GetAlpha(npcColor2), rCurrentNPC.rotation, frame7.Size() / 2f, rCurrentNPC.scale, spriteEffects, 0.0f); break; } if (type == 518) { Vector2 vector2_37 = new Vector2(-10f, 0.0f); mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame7), rCurrentNPC.GetAlpha(npcColor2), rCurrentNPC.rotation, halfSize + vector2_37, rCurrentNPC.scale, spriteEffects, 0.0f); if (rCurrentNPC.color != new Microsoft.Xna.Framework.Color()) { mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame7), rCurrentNPC.GetColor(npcColor2), rCurrentNPC.rotation, halfSize + vector2_37, rCurrentNPC.scale, spriteEffects, 0.0f); break; } break; } mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame7), rCurrentNPC.GetAlpha(npcColor2), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); if (rCurrentNPC.color != new Microsoft.Xna.Framework.Color()) { mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame7), rCurrentNPC.GetColor(npcColor2), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; } break; } } if (rCurrentNPC.confused) mySpriteBatch.Draw(TextureAssets.Confuse.Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale + (double) addHeight + (double) addY - (double) TextureAssets.Confuse.Height() - 20.0)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Confuse.Width(), TextureAssets.Confuse.Height())), new Microsoft.Xna.Framework.Color(250, 250, 250, 70), rCurrentNPC.velocity.X * -0.05f, new Vector2((float) (TextureAssets.Confuse.Width() / 2), (float) (TextureAssets.Confuse.Height() / 2)), Main.essScale + 0.2f, SpriteEffects.None, 0.0f); if (type >= 639 && type <= 645) mySpriteBatch.Draw(TextureAssets.GlowMask[286].Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame7), rCurrentNPC.GetAlpha(Microsoft.Xna.Framework.Color.White), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); if (type >= 646 && type <= 652) mySpriteBatch.Draw(TextureAssets.GlowMask[287].Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame7), rCurrentNPC.GetAlpha(Microsoft.Xna.Framework.Color.White), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); if (type >= 134 && type <= 136 && npcColor2 != Microsoft.Xna.Framework.Color.Black) { mySpriteBatch.Draw(TextureAssets.Dest[type - 134].Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0) * (float) (1.0 - (double) rCurrentNPC.alpha / (double) byte.MaxValue), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } else { switch (type) { case 120: for (int index24 = 1; index24 < rCurrentNPC.oldPos.Length; ++index24) { ref Vector2 local = ref rCurrentNPC.oldPos[index24]; mySpriteBatch.Draw(TextureAssets.Chaos.Value, new Vector2((float) ((double) rCurrentNPC.oldPos[index24].X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.oldPos[index24].Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color() { R = (byte) (150 * (10 - index24) / 15), G = (byte) (100 * (10 - index24) / 15), B = (byte) (150 * (10 - index24) / 15), A = (byte) (50 * (10 - index24) / 15) }, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } break; case 125: mySpriteBatch.Draw(TextureAssets.EyeLaser.Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case (int) sbyte.MaxValue: mySpriteBatch.Draw(TextureAssets.BoneEyes.Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color(200, 200, 200, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 131: mySpriteBatch.Draw(TextureAssets.BoneLaser.Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color(200, 200, 200, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 139: mySpriteBatch.Draw(TextureAssets.Probe.Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; default: if (type == 137 || type == 138) { for (int index25 = 1; index25 < rCurrentNPC.oldPos.Length; ++index25) { ref Vector2 local = ref rCurrentNPC.oldPos[index25]; mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2((float) ((double) rCurrentNPC.oldPos[index25].X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.oldPos[index25].Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color() { R = (byte) (150 * (10 - index25) / 15), G = (byte) (100 * (10 - index25) / 15), B = (byte) (150 * (10 - index25) / 15), A = (byte) (50 * (10 - index25) / 15) }, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } break; } switch (type) { case 82: mySpriteBatch.Draw(TextureAssets.WraithEye.Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), Microsoft.Xna.Framework.Color.White, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); for (int index26 = 1; index26 < 10; ++index26) { Microsoft.Xna.Framework.Color color44 = new Microsoft.Xna.Framework.Color(110 - index26 * 10, 110 - index26 * 10, 110 - index26 * 10, 110 - index26 * 10); mySpriteBatch.Draw(TextureAssets.WraithEye.Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight) - rCurrentNPC.velocity * (float) index26 * 0.5f, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), color44, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } break; case 253: mySpriteBatch.Draw(TextureAssets.ReaperEye.Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 3.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), Microsoft.Xna.Framework.Color.White, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); for (int index27 = 1; index27 < 20; ++index27) { Microsoft.Xna.Framework.Color color45 = new Microsoft.Xna.Framework.Color(210 - index27 * 20, 210 - index27 * 20, 210 - index27 * 20, 210 - index27 * 20); mySpriteBatch.Draw(TextureAssets.ReaperEye.Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 3.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight) - rCurrentNPC.velocity * (float) index27 * 0.5f, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), color45, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } break; case 325: mySpriteBatch.Draw(TextureAssets.TreeFace.Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), Microsoft.Xna.Framework.Color.White, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); for (int index28 = 1; index28 < 10; ++index28) { Microsoft.Xna.Framework.Color color46 = new Microsoft.Xna.Framework.Color(110 - index28 * 10, 110 - index28 * 10, 110 - index28 * 10, 110 - index28 * 10); Vector2 vector2_38 = new Vector2((float) Main.rand.Next(-10, 11) * 0.2f, (float) Main.rand.Next(-10, 11) * 0.2f); mySpriteBatch.Draw(TextureAssets.TreeFace.Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight) + vector2_38, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), color46, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } break; case 327: mySpriteBatch.Draw(TextureAssets.PumpkingFace.Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), Microsoft.Xna.Framework.Color.White, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); for (int index29 = 1; index29 < 10; ++index29) { Microsoft.Xna.Framework.Color color47 = new Microsoft.Xna.Framework.Color(110 - index29 * 10, 110 - index29 * 10, 110 - index29 * 10, 110 - index29 * 10); Vector2 vector2_39 = new Vector2((float) Main.rand.Next(-10, 11) * 0.2f, (float) Main.rand.Next(-10, 11) * 0.2f); mySpriteBatch.Draw(TextureAssets.PumpkingFace.Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight) + vector2_39, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), color47, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } break; case 345: mySpriteBatch.Draw(TextureAssets.IceQueen.Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), Microsoft.Xna.Framework.Color.White, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); for (int index30 = 1; index30 < 5; ++index30) { Microsoft.Xna.Framework.Color color48 = new Microsoft.Xna.Framework.Color(100 - index30 * 10, 100 - index30 * 10, 100 - index30 * 10, 100 - index30 * 10); mySpriteBatch.Draw(TextureAssets.IceQueen.Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight) - rCurrentNPC.velocity * (float) index30 * 0.2f, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), color48, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } break; case 355: mySpriteBatch.Draw(TextureAssets.Firefly.Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 358: mySpriteBatch.Draw(TextureAssets.Lightningbug.Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 653: mySpriteBatch.Draw(TextureAssets.GlowMask[288].Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 3.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 654: mySpriteBatch.Draw(TextureAssets.GlowMask[290].Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; default: if (type == 245 && rCurrentNPC.alpha == 0 && !Main.getGoodWorld) { Microsoft.Xna.Framework.Color color49 = new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, 0); mySpriteBatch.Draw(TextureAssets.Golem[3].Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame7), color49, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; } if (type == 246 && !Main.getGoodWorld) { Microsoft.Xna.Framework.Color color50 = new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, 0); if (rCurrentNPC.frame.Y < 222) { mySpriteBatch.Draw(TextureAssets.Golem[1].Value, new Vector2((float) ((double) rCurrentNPC.Center.X - (double) screenPos.X - 20.0), (float) ((double) rCurrentNPC.Center.Y - (double) screenPos.Y - 27.0)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Golem[1].Width(), TextureAssets.Golem[1].Height() / 2)), color50, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); Microsoft.Xna.Framework.Rectangle rectangle9 = frame7; rectangle9.Y = 0; mySpriteBatch.Draw(TextureAssets.Extra[107].Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle9), color50, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; } if (rCurrentNPC.frame.Y < 444) { mySpriteBatch.Draw(TextureAssets.Golem[2].Value, new Vector2((float) ((double) rCurrentNPC.Center.X - (double) screenPos.X + 26.0), (float) ((double) rCurrentNPC.Center.Y - (double) screenPos.Y - 28.0)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Golem[2].Width(), TextureAssets.Golem[2].Height() / 4)), color50, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); break; } mySpriteBatch.Draw(TextureAssets.Golem[2].Value, new Vector2((float) ((double) rCurrentNPC.Center.X - (double) screenPos.X - 38.0), (float) ((double) rCurrentNPC.Center.Y - (double) screenPos.Y - 28.0)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, TextureAssets.Golem[2].Height() / 2, TextureAssets.Golem[2].Width(), TextureAssets.Golem[2].Height() / 4)), color50, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); break; } if (type == 249 && !Main.getGoodWorld) { Microsoft.Xna.Framework.Color color51 = new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, 0); mySpriteBatch.Draw(TextureAssets.Golem[1].Value, new Vector2((float) ((double) rCurrentNPC.Center.X - (double) screenPos.X - 20.0), (float) ((double) rCurrentNPC.Center.Y - (double) screenPos.Y - 47.0)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Golem[1].Width(), TextureAssets.Golem[1].Height() / 2)), color51, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); int num197 = (int) rCurrentNPC.frameCounter / 4; Texture2D texture2D31 = TextureAssets.Extra[106].Value; Microsoft.Xna.Framework.Rectangle rectangle10 = texture2D31.Frame(verticalFrames: 8); Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; rectangle10.Y += rectangle10.Height * 2 * num197 + frame7.Y; mySpriteBatch.Draw(texture2D31, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle10), color51, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); Texture2D texture35 = TextureAssets.Extra[107].Value; Microsoft.Xna.Framework.Rectangle rectangle11 = frame7; mySpriteBatch.Draw(texture35, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle11), color51, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; } switch (type) { case 381: Vector2 zero1 = Vector2.Zero; Vector2 origin33 = Vector2.Zero; int num198 = TextureAssets.Npc[type].Height() / Main.npcFrameCount[type]; int num199 = rCurrentNPC.frame.Y / num198; Microsoft.Xna.Framework.Rectangle rectangle12 = new Microsoft.Xna.Framework.Rectangle(0, 0, 32, 42); switch (num199) { case 0: zero1 += new Vector2(8f, 32f); break; case 1: zero1 += new Vector2(6f, 72f); break; case 2: zero1 += new Vector2(8f, 126f); break; case 3: zero1 += new Vector2(6f, 174f); break; case 4: zero1 += new Vector2(6f, 224f); break; case 5: zero1 += new Vector2(8f, 272f); break; case 6: zero1 += new Vector2(10f, 318f); break; case 7: zero1 += new Vector2(14f, 366f); break; case 8: zero1 += new Vector2(10f, 414f); break; } zero1.Y -= (float) (num198 * num199); Vector2 vector2_40 = zero1 - halfSize; int num200 = 2; if ((double) rCurrentNPC.ai[2] > 0.0) num200 = (int) rCurrentNPC.ai[2] - 1; if ((double) rCurrentNPC.velocity.Y != 0.0) num200 = 3; rectangle12.Y += 44 * num200; switch (num200) { case 0: origin33 = new Vector2(10f, 18f); break; case 1: origin33 = new Vector2(8f, 20f); break; case 2: origin33 = new Vector2(8f, 20f); break; case 3: origin33 = new Vector2(8f, 20f); break; case 4: origin33 = new Vector2(6f, 18f); break; } if (spriteEffects.HasFlag((Enum) SpriteEffects.FlipHorizontally)) { vector2_40.X *= -1f; origin33.X = (float) rectangle12.Width - origin33.X; } Vector2 position43 = vector2_40 + rCurrentNPC.Center - screenPos; position43.Y += rCurrentNPC.gfxOffY; mySpriteBatch.Draw(TextureAssets.Extra[0].Value, position43, new Microsoft.Xna.Framework.Rectangle?(rectangle12), npcColor2, rCurrentNPC.rotation, origin33, rCurrentNPC.scale, spriteEffects, 0.0f); mySpriteBatch.Draw(TextureAssets.GlowMask[24].Value, position43, new Microsoft.Xna.Framework.Rectangle?(rectangle12), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), rCurrentNPC.rotation, origin33, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 382: Vector2 zero2 = Vector2.Zero; Vector2 origin34 = Vector2.Zero; int num201 = TextureAssets.Npc[type].Height() / Main.npcFrameCount[type]; int num202 = rCurrentNPC.frame.Y / num201; Microsoft.Xna.Framework.Rectangle rectangle13 = new Microsoft.Xna.Framework.Rectangle(0, 0, 30, 42); switch (num202) { case 0: zero2 += new Vector2(8f, 30f); break; case 1: zero2 += new Vector2(6f, 68f); break; case 2: zero2 += new Vector2(8f, 120f); break; case 3: zero2 += new Vector2(6f, 166f); break; case 4: zero2 += new Vector2(6f, 214f); break; case 5: zero2 += new Vector2(8f, 260f); break; case 6: zero2 += new Vector2(14f, 304f); break; case 7: zero2 += new Vector2(14f, 350f); break; case 8: zero2 += new Vector2(10f, 396f); break; } zero2.Y -= (float) (num201 * num202); Vector2 vector2_41 = zero2 - halfSize; int num203 = 2; if ((double) rCurrentNPC.ai[2] > 0.0) num203 = (int) rCurrentNPC.ai[2] - 1; if ((double) rCurrentNPC.velocity.Y != 0.0) num203 = 3; rectangle13.Y += 44 * num203; switch (num203) { case 0: origin34 = new Vector2(10f, 18f); break; case 1: origin34 = new Vector2(8f, 20f); break; case 2: origin34 = new Vector2(8f, 20f); break; case 3: origin34 = new Vector2(8f, 20f); break; case 4: origin34 = new Vector2(6f, 18f); break; } if (spriteEffects.HasFlag((Enum) SpriteEffects.FlipHorizontally)) { vector2_41.X *= -1f; origin34.X = (float) rectangle13.Width - origin34.X; } Vector2 position44 = vector2_41 + rCurrentNPC.Center - screenPos; position44.Y += rCurrentNPC.gfxOffY; mySpriteBatch.Draw(TextureAssets.Extra[1].Value, position44, new Microsoft.Xna.Framework.Rectangle?(rectangle13), npcColor2, rCurrentNPC.rotation, origin34, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 383: mySpriteBatch.Draw(TextureAssets.GlowMask[11].Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame7), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); if ((double) rCurrentNPC.ai[2] != 0.0 && Main.npc[(int) rCurrentNPC.ai[2] - 1].active && Main.npc[(int) rCurrentNPC.ai[2] - 1].type == 384) { double num204 = (double) rCurrentNPC.ai[2]; mySpriteBatch.Draw(TextureAssets.Npc[384].Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(), new Microsoft.Xna.Framework.Color(100, 100, 100, 0), rCurrentNPC.rotation, new Vector2((float) TextureAssets.Npc[384].Width(), (float) TextureAssets.Npc[384].Height()) / 2f, rCurrentNPC.scale, spriteEffects, 0.0f); break; } break; case 386: mySpriteBatch.Draw(TextureAssets.GlowMask[31].Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame7), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 387: Microsoft.Xna.Framework.Color color52 = new Microsoft.Xna.Framework.Color(1f, 1f, 1f, 1f) * 0.75f; if ((double) rCurrentNPC.ai[0] > 0.0) { float amount16 = (float) (((double) rCurrentNPC.ai[0] + 1.0) / 60.0); color52 = Microsoft.Xna.Framework.Color.Lerp(color52, Microsoft.Xna.Framework.Color.White, amount16); color52.A = (byte) MathHelper.Lerp((float) color52.A, 0.0f, amount16); } Microsoft.Xna.Framework.Color color53 = color52 * (float) (((double) byte.MaxValue - (double) rCurrentNPC.alpha) / (double) byte.MaxValue); mySpriteBatch.Draw(TextureAssets.GlowMask[32].Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame7), color53, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 388: mySpriteBatch.Draw(TextureAssets.GlowMask[33].Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame7), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 389: mySpriteBatch.Draw(TextureAssets.GlowMask[34].Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame7), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 520: mySpriteBatch.Draw(TextureAssets.GlowMask[164].Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame7), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); Vector2 zero3 = Vector2.Zero; Vector2 origin35 = new Vector2(4f, 4f); int num205 = TextureAssets.Npc[type].Height() / Main.npcFrameCount[type]; int num206 = rCurrentNPC.frame.Y / num205; if (spriteEffects.HasFlag((Enum) SpriteEffects.FlipHorizontally)) { zero3.X *= -1f; origin35.X = (float) TextureAssets.Extra[56].Width() - origin35.X; } Vector2 position45 = zero3 + (rCurrentNPC.Top + new Vector2(0.0f, 20f)) - screenPos; position45.Y += rCurrentNPC.gfxOffY; float rotation3 = rCurrentNPC.localAI[3]; if (spriteEffects.HasFlag((Enum) SpriteEffects.FlipHorizontally)) rotation3 += 3.141593f; mySpriteBatch.Draw(TextureAssets.Extra[56].Value, position45, new Microsoft.Xna.Framework.Rectangle?(), npcColor2, rotation3, origin35, rCurrentNPC.scale, spriteEffects, 0.0f); mySpriteBatch.Draw(TextureAssets.GlowMask[165].Value, position45, new Microsoft.Xna.Framework.Rectangle?(), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), rotation3, origin35, rCurrentNPC.scale, spriteEffects, 0.0f); break; default: if (type == 4 && (double) rCurrentNPC.ai[1] >= 4.0 && (double) rCurrentNPC.ai[0] == 3.0) { for (int index31 = 1; index31 < rCurrentNPC.oldPos.Length; ++index31) { ref Vector2 local = ref rCurrentNPC.oldPos[index31]; Microsoft.Xna.Framework.Color color54 = npcColor2; color54.R = (byte) (0.5 * (double) color54.R * (double) (10 - index31) / 20.0); color54.G = (byte) (0.5 * (double) color54.G * (double) (10 - index31) / 20.0); color54.B = (byte) (0.5 * (double) color54.B * (double) (10 - index31) / 20.0); color54.A = (byte) (0.5 * (double) color54.A * (double) (10 - index31) / 20.0); mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2((float) ((double) rCurrentNPC.oldPos[index31].X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.oldPos[index31].Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), color54, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } break; } if (type == 437) { Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; white.A = (byte) 200; mySpriteBatch.Draw(TextureAssets.GlowMask[109].Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame7), white, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); mySpriteBatch.Draw(TextureAssets.GlowMask[108].Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + addY + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(), white, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; } if (type == 471 && (double) rCurrentNPC.ai[3] < 0.0) { for (int index32 = 1; index32 < rCurrentNPC.oldPos.Length; ++index32) { ref Vector2 local = ref rCurrentNPC.oldPos[index32]; Microsoft.Xna.Framework.Color color55 = npcColor2; color55.R = (byte) (0.5 * (double) color55.R * (double) (10 - index32) / 20.0); color55.G = (byte) (0.5 * (double) color55.G * (double) (10 - index32) / 20.0); color55.B = (byte) (0.5 * (double) color55.B * (double) (10 - index32) / 20.0); color55.A = (byte) (0.5 * (double) color55.A * (double) (10 - index32) / 20.0); mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2((float) ((double) rCurrentNPC.oldPos[index32].X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.oldPos[index32].Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), color55, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } break; } if (type == 477 && (double) rCurrentNPC.velocity.Length() > 9.0) { for (int index33 = 1; index33 < rCurrentNPC.oldPos.Length; ++index33) { ref Vector2 local = ref rCurrentNPC.oldPos[index33]; Microsoft.Xna.Framework.Color color56 = npcColor2; color56.R = (byte) (0.5 * (double) color56.R * (double) (10 - index33) / 20.0); color56.G = (byte) (0.5 * (double) color56.G * (double) (10 - index33) / 20.0); color56.B = (byte) (0.5 * (double) color56.B * (double) (10 - index33) / 20.0); color56.A = (byte) (0.5 * (double) color56.A * (double) (10 - index33) / 20.0); Microsoft.Xna.Framework.Rectangle frame8 = rCurrentNPC.frame; int num207 = TextureAssets.Npc[type].Height() / Main.npcFrameCount[type]; frame8.Y -= num207 * index33; while (frame8.Y < 0) frame8.Y += num207 * Main.npcFrameCount[type]; mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2((float) ((double) rCurrentNPC.oldPos[index33].X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.oldPos[index33].Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(frame8), color56, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } break; } break; } break; } break; } } if (type == 479 && (double) rCurrentNPC.velocity.Length() > 6.5) { for (int index34 = 1; index34 < rCurrentNPC.oldPos.Length; ++index34) { ref Vector2 local = ref rCurrentNPC.oldPos[index34]; Microsoft.Xna.Framework.Color color57 = npcColor2; color57.R = (byte) (0.5 * (double) color57.R * (double) (10 - index34) / 20.0); color57.G = (byte) (0.5 * (double) color57.G * (double) (10 - index34) / 20.0); color57.B = (byte) (0.5 * (double) color57.B * (double) (10 - index34) / 20.0); color57.A = (byte) (0.5 * (double) color57.A * (double) (10 - index34) / 20.0); Microsoft.Xna.Framework.Rectangle frame9 = rCurrentNPC.frame; int num208 = TextureAssets.Npc[type].Height() / Main.npcFrameCount[type]; frame9.Y -= num208 * index34; while (frame9.Y < 0) frame9.Y += num208 * Main.npcFrameCount[type]; mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2((float) ((double) rCurrentNPC.oldPos[index34].X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.oldPos[index34].Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(frame9), color57, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } } else if (type == 472) mySpriteBatch.Draw(TextureAssets.GlowMask[110].Value, new Vector2((float) ((double) rCurrentNPC.position.X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.position.Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); else if (rCurrentNPC.aiStyle == 87) { if ((int) rCurrentNPC.ai[0] == 4 || (double) rCurrentNPC.ai[0] == 5.0 || (double) rCurrentNPC.ai[0] == 6.0) { for (int index35 = 1; index35 < rCurrentNPC.oldPos.Length; ++index35) { ref Vector2 local = ref rCurrentNPC.oldPos[index35]; Microsoft.Xna.Framework.Color color58 = npcColor2; color58.R = (byte) (0.5 * (double) color58.R * (double) (10 - index35) / 20.0); color58.G = (byte) (0.5 * (double) color58.G * (double) (10 - index35) / 20.0); color58.B = (byte) (0.5 * (double) color58.B * (double) (10 - index35) / 20.0); color58.A = (byte) (0.5 * (double) color58.A * (double) (10 - index35) / 20.0); mySpriteBatch.Draw(TextureAssets.Npc[type].Value, new Vector2((float) ((double) rCurrentNPC.oldPos[index35].X - (double) screenPos.X + (double) (rCurrentNPC.width / 2) - (double) TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) rCurrentNPC.oldPos[index35].Y - (double) screenPos.Y + (double) rCurrentNPC.height - (double) TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), color58, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); } } } else { switch (type) { case 50: Texture2D texture2D32 = TextureAssets.Extra[39].Value; Vector2 center5 = rCurrentNPC.Center; float num209 = 0.0f; switch (rCurrentNPC.frame.Y / (TextureAssets.Npc[type].Height() / Main.npcFrameCount[type])) { case 0: num209 = 2f; break; case 1: num209 = -6f; break; case 2: num209 = 2f; break; case 3: num209 = 10f; break; case 4: num209 = 2f; break; case 5: num209 = 0.0f; break; } center5.Y += rCurrentNPC.gfxOffY - (70f - num209) * rCurrentNPC.scale; mySpriteBatch.Draw(texture2D32, center5 - screenPos, new Microsoft.Xna.Framework.Rectangle?(), npcColor2, 0.0f, texture2D32.Size() / 2f, 1f, spriteEffects, 0.0f); break; case 405: mySpriteBatch.Draw(TextureAssets.GlowMask[141].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(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, 0.0f); break; case 406: mySpriteBatch.Draw(TextureAssets.GlowMask[142].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(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, 0.0f); break; case 407: mySpriteBatch.Draw(TextureAssets.GlowMask[139].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 409: mySpriteBatch.Draw(TextureAssets.GlowMask[138].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 410: mySpriteBatch.Draw(TextureAssets.GlowMask[137].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 411: mySpriteBatch.Draw(TextureAssets.GlowMask[136].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(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, 0.0f); break; case 418: mySpriteBatch.Draw(TextureAssets.GlowMask[161].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); vector3 = rCurrentNPC.GetAlpha(npcColor2).ToVector3() - new Vector3(0.5f); float num210 = (float) (0.25 + (double) vector3.Length() * 0.25); for (int index36 = 0; index36 < 4; ++index36) mySpriteBatch.Draw(TextureAssets.GlowMask[161].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY) + rCurrentNPC.velocity.RotatedBy((double) index36 * 1.57079637050629) * num210, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color(64, 64, 64, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 420: mySpriteBatch.Draw(TextureAssets.GlowMask[147].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(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, 0.0f); break; case 421: mySpriteBatch.Draw(TextureAssets.GlowMask[146].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(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, 0.0f); break; case 423: mySpriteBatch.Draw(TextureAssets.GlowMask[145].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(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, 0.0f); break; case 424: mySpriteBatch.Draw(TextureAssets.GlowMask[144].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(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, 0.0f); break; case 425: mySpriteBatch.Draw(TextureAssets.GlowMask[150].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(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, 0.0f); break; case 429: mySpriteBatch.Draw(TextureAssets.GlowMask[151].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(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, 0.0f); break; default: if (type >= 412 && type <= 414) { Microsoft.Xna.Framework.Color color59 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha, 0); int index37 = 157 + type - 412; if (type == 414 && (double) rCurrentNPC.localAI[2] != 0.0) { int num211 = (int) rCurrentNPC.localAI[2]; if ((double) rCurrentNPC.localAI[2] < 0.0) num211 = 128 + (int) rCurrentNPC.localAI[2]; int num212 = (int) byte.MaxValue - num211; color59 = new Microsoft.Xna.Framework.Color(num212, num211, num211, num212); } mySpriteBatch.Draw(TextureAssets.GlowMask[index37].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), color59, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; } switch (type) { case 160: mySpriteBatch.Draw(TextureAssets.GlowMask[166].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(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, 0.0f); break; case 209: mySpriteBatch.Draw(TextureAssets.GlowMask[167].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(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, 0.0f); break; case 315: float num213 = 2f; for (int index38 = 0; index38 < 4; ++index38) mySpriteBatch.Draw(TextureAssets.GlowMask[(int) byte.MaxValue].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY) + Vector2.UnitX.RotatedBy((double) index38 * 1.57079637050629) * num213, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color(64, 64, 64, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); mySpriteBatch.Draw(TextureAssets.GlowMask[(int) byte.MaxValue].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 344: mySpriteBatch.Draw(TextureAssets.GlowMask[253].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color(200, 200, 200, 100) * 0.5f, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 346: float num214 = 4f; for (int index39 = 0; index39 < 4; ++index39) mySpriteBatch.Draw(TextureAssets.GlowMask[254].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY) + Vector2.UnitX.RotatedBy((double) index39 * 1.57079637050629) * num214, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color(64, 64, 64, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); mySpriteBatch.Draw(TextureAssets.GlowMask[254].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color(200, 200, 200, 100), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 415: mySpriteBatch.Draw(TextureAssets.GlowMask[155].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); vector3 = rCurrentNPC.GetAlpha(npcColor2).ToVector3() - new Vector3(0.5f); float num215 = (float) (0.5 + (double) vector3.Length() * 0.5); for (int index40 = 0; index40 < 4; ++index40) mySpriteBatch.Draw(TextureAssets.GlowMask[155].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY) + rCurrentNPC.velocity.RotatedBy((double) index40 * 1.57079637050629) * num215, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color(64, 64, 64, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 417: mySpriteBatch.Draw(TextureAssets.GlowMask[160].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); vector3 = rCurrentNPC.GetAlpha(npcColor2).ToVector3() - new Vector3(0.5f); float num216 = (float) (0.25 + (double) vector3.Length() * 0.25); for (int index41 = 0; index41 < 4; ++index41) mySpriteBatch.Draw(TextureAssets.GlowMask[160].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY) + rCurrentNPC.velocity.RotatedBy((double) index41 * 1.57079637050629) * num216, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color(64, 64, 64, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 419: mySpriteBatch.Draw(TextureAssets.GlowMask[154].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); if ((double) rCurrentNPC.ai[2] >= -6.0) { vector3 = rCurrentNPC.GetAlpha(npcColor2).ToVector3() - new Vector3(0.5f); float num217 = (float) (0.5 + (double) vector3.Length() * 0.5); for (int index42 = 0; index42 < 4; ++index42) mySpriteBatch.Draw(TextureAssets.GlowMask[154].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY) + rCurrentNPC.velocity.RotatedBy((double) index42 * 1.57079637050629) * num217, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color(64, 64, 64, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; } float num218 = 4f; for (int index43 = 0; index43 < 4; ++index43) mySpriteBatch.Draw(TextureAssets.GlowMask[154].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY) + Vector2.UnitX.RotatedBy((double) index43 * 1.57079637050629) * num218, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color(64, 64, 64, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 516: mySpriteBatch.Draw(TextureAssets.Npc[type].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); vector3 = rCurrentNPC.GetAlpha(npcColor2).ToVector3() - new Vector3(0.5f); float num219 = (float) (0.5 + (double) vector3.Length() * 0.5); for (int index44 = 0; index44 < 4; ++index44) mySpriteBatch.Draw(TextureAssets.Npc[type].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY) + rCurrentNPC.velocity.RotatedBy((double) index44 * 1.57079637050629) * num219, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color(64, 64, 64, 0), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 518: Vector2 vector2_42 = new Vector2(-10f, 0.0f); mySpriteBatch.Draw(TextureAssets.GlowMask[163].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha, (int) byte.MaxValue - rCurrentNPC.alpha), rCurrentNPC.rotation, halfSize + vector2_42, rCurrentNPC.scale, spriteEffects, 0.0f); vector3 = rCurrentNPC.GetAlpha(npcColor2).ToVector3() - new Vector3(0.5f); float num220 = (float) (0.5 + (double) vector3.Length() * 0.5); for (int index45 = 0; index45 < 4; ++index45) mySpriteBatch.Draw(TextureAssets.GlowMask[163].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY) + rCurrentNPC.velocity.RotatedBy((double) index45 * 1.57079637050629) * num220, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color(64, 64, 64, 0), rCurrentNPC.rotation, halfSize + vector2_42, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 525: mySpriteBatch.Draw(TextureAssets.GlowMask[169].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color(200, 200, 200, 100), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 526: mySpriteBatch.Draw(TextureAssets.GlowMask[170].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color(200, 200, 200, 100), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 527: mySpriteBatch.Draw(TextureAssets.GlowMask[171].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color(200, 200, 200, 100), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; case 533: mySpriteBatch.Draw(TextureAssets.GlowMask[172].Value, rCurrentNPC.Bottom - screenPos + new Vector2((float) ((double) -TextureAssets.Npc[type].Width() * (double) rCurrentNPC.scale / 2.0 + (double) halfSize.X * (double) rCurrentNPC.scale), (float) ((double) -TextureAssets.Npc[type].Height() * (double) rCurrentNPC.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) halfSize.Y * (double) rCurrentNPC.scale) + addHeight + rCurrentNPC.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 100), rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, spriteEffects, 0.0f); break; } break; } } if (rCurrentNPC.aiStyle != 7) return; this.DrawNPCExtras(rCurrentNPC, false, addHeight, addY, npcColor2, halfSize, spriteEffects, screenPos); return; } } } } } private static void DrawNPCDirect_HallowBoss( SpriteBatch mySpriteBatch, NPC rCurrentNPC, ref Vector2 screenPos, int typeCache, ref Microsoft.Xna.Framework.Color npcColor, ref Vector2 halfSize, SpriteEffects npcSpriteEffect) { Texture2D texture1 = TextureAssets.Npc[typeCache].Value; Vector2 position1 = rCurrentNPC.Center - screenPos; bool flag = rCurrentNPC.AI_120_HallowBoss_IsInPhase2(); int num1 = (int) rCurrentNPC.ai[0]; Texture2D texture2D1 = TextureAssets.Extra[159].Value; Microsoft.Xna.Framework.Rectangle r1 = texture2D1.Frame(verticalFrames: 11, frameY: ((int) ((double) rCurrentNPC.localAI[0] / 4.0) % 11)); Microsoft.Xna.Framework.Color color1 = rCurrentNPC.GetAlpha(npcColor); Texture2D texture2D2 = TextureAssets.Extra[158].Value; Texture2D texture2D3 = TextureAssets.Extra[160].Value; Texture2D texture2 = TextureAssets.Extra[157].Value; int armFrame_Count; int armFrameToUseLeft; int armFrameToUseRight; Main.DrawNPCDirect_GetHallowBossArmFrame(rCurrentNPC, out armFrame_Count, out armFrameToUseLeft, out armFrameToUseRight); Microsoft.Xna.Framework.Rectangle r2 = texture2D2.Frame(verticalFrames: armFrame_Count, frameY: armFrameToUseLeft); Microsoft.Xna.Framework.Rectangle r3 = texture2D3.Frame(verticalFrames: armFrame_Count, frameY: armFrameToUseRight); Vector2 origin1 = r2.Size() / 2f; Vector2 origin2 = r3.Size() / 2f; int num2 = 0; int num3 = 0; if (armFrameToUseLeft == 5) num2 = 1; if (armFrameToUseRight == 5) num3 = 1; float num4 = 1f; int num5 = 0; int num6 = 0; float amount1 = 0.0f; float num7 = 0.0f; float num8 = 0.0f; if (num1 == 8 || num1 == 9) { amount1 = Utils.GetLerpValue(0.0f, 30f, rCurrentNPC.ai[1], true) * Utils.GetLerpValue(90f, 30f, rCurrentNPC.ai[1], true); num7 = Utils.GetLerpValue(0.0f, 30f, rCurrentNPC.ai[1], true) * Utils.GetLerpValue(90f, 70f, rCurrentNPC.ai[1], true); num8 = Utils.GetLerpValue(0.0f, 15f, rCurrentNPC.ai[1], true) * Utils.GetLerpValue(45f, 30f, rCurrentNPC.ai[1], true); color1 = Microsoft.Xna.Framework.Color.Lerp(color1, Microsoft.Xna.Framework.Color.White, amount1); num4 *= 1f - num8; num5 = 4; num6 = 3; } if (num1 == 10) { amount1 = Utils.GetLerpValue(30f, 90f, rCurrentNPC.ai[1], true) * Utils.GetLerpValue(165f, 90f, rCurrentNPC.ai[1], true); num7 = Utils.GetLerpValue(0.0f, 60f, rCurrentNPC.ai[1], true) * Utils.GetLerpValue(180f, 120f, rCurrentNPC.ai[1], true); num8 = Utils.GetLerpValue(0.0f, 60f, rCurrentNPC.ai[1], true) * Utils.GetLerpValue(180f, 120f, rCurrentNPC.ai[1], true); color1 = Microsoft.Xna.Framework.Color.Lerp(color1, Microsoft.Xna.Framework.Color.White, amount1); num4 *= 1f - num8; num6 = 4; } if (num6 + num5 > 0) { for (int index1 = -num6; index1 <= num6 + num5; ++index1) { if (index1 != 0) { Microsoft.Xna.Framework.Color color2 = Microsoft.Xna.Framework.Color.White; Vector2 position2 = position1; if (num1 == 8 || num1 == 9) { double num9 = (double) ((float) index1 + 5f) / 10.0; float num10 = 200f; float num11 = (float) Main.timeForVisualEffects / 60f; Vector3 vector3 = Vector3.Transform(Vector3.Forward, Matrix.CreateRotationX((float) (((double) num11 - 0.300000011920929 + (double) index1 * 0.100000001490116) * 0.699999988079071 * 6.28318548202515)) * Matrix.CreateRotationY((float) (((double) num11 - 0.800000011920929 + (double) index1 * 0.300000011920929) * 0.699999988079071 * 6.28318548202515)) * Matrix.CreateRotationZ((float) (((double) num11 + (double) index1 * 0.5) * 0.100000001490116 * 6.28318548202515))); float num12 = num10 + Utils.GetLerpValue(-1f, 1f, vector3.Z, true) * 150f; Vector2 spinningpoint = new Vector2(vector3.X, vector3.Y) * num12 * amount1; double num13 = (double) MathHelper.Lerp(0.5f, 1f, Utils.GetLerpValue(90f, 0.0f, rCurrentNPC.ai[1], true)); color2 = Main.hslToRgb((float) num9, 1f, (float) num13) * 0.8f * num7; color2.A /= (byte) 3; position2 += spinningpoint.RotatedBy((double) rCurrentNPC.ai[1] / 180.0 * 6.28318548202515); } if (num1 == 10) { if ((double) rCurrentNPC.ai[1] >= 90.0) { float num14 = (float) Main.timeForVisualEffects / 90f; int num15 = index1; if (num15 < 0) ++num15; Vector2 rotationVector2 = ((float) (((double) num15 + 0.5) * 0.785398185253143 + 6.28318548202515 * (double) num14)).ToRotationVector2(); position2 += rotationVector2 * new Vector2(600f * amount1, 150f * amount1); } else position2 += 200f * new Vector2((float) index1, 0.0f) * amount1; color2 = Microsoft.Xna.Framework.Color.White * 0.8f * num7 * num4; color2.A /= (byte) 3; } if (index1 > num6) { float lerpValue = Utils.GetLerpValue(30f, 70f, rCurrentNPC.ai[1], true); if ((double) lerpValue != 0.0) { position2 = position1 + rCurrentNPC.velocity * -3f * ((float) index1 - 4f) * lerpValue; color2 *= 1f - num8; } else continue; } mySpriteBatch.Draw(texture2D1, position2, new Microsoft.Xna.Framework.Rectangle?(r1), color2, rCurrentNPC.rotation, r1.Size() / 2f, rCurrentNPC.scale * 2f, npcSpriteEffect, 0.0f); mySpriteBatch.Draw(texture2, position2, new Microsoft.Xna.Framework.Rectangle?(r1), color2, rCurrentNPC.rotation, r1.Size() / 2f, rCurrentNPC.scale * 2f, npcSpriteEffect, 0.0f); if (flag) { Texture2D texture2D4 = TextureAssets.Extra[187].Value; Microsoft.Xna.Framework.Rectangle rectangle = texture2D4.Frame(verticalFrames: 8, frameY: ((int) ((double) rCurrentNPC.localAI[0] / 4.0) % 8)); mySpriteBatch.Draw(texture2D4, position2, new Microsoft.Xna.Framework.Rectangle?(rectangle), color2, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, npcSpriteEffect, 0.0f); } mySpriteBatch.Draw(texture1, position2, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), color2, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, npcSpriteEffect, 0.0f); for (int index2 = 0; index2 < 2; ++index2) { if (index2 == num2) mySpriteBatch.Draw(texture2D2, position2, new Microsoft.Xna.Framework.Rectangle?(r2), color2, rCurrentNPC.rotation, origin1, rCurrentNPC.scale, npcSpriteEffect, 0.0f); if (index2 == num3) mySpriteBatch.Draw(texture2D3, position2, new Microsoft.Xna.Framework.Rectangle?(r3), color2, rCurrentNPC.rotation, origin2, rCurrentNPC.scale, npcSpriteEffect, 0.0f); } } } } Microsoft.Xna.Framework.Color color3 = color1 * num4; mySpriteBatch.Draw(texture2D1, position1, new Microsoft.Xna.Framework.Rectangle?(r1), color3, rCurrentNPC.rotation, r1.Size() / 2f, rCurrentNPC.scale * 2f, npcSpriteEffect, 0.0f); if (!rCurrentNPC.IsABestiaryIconDummy) { mySpriteBatch.End(); mySpriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.Default, RasterizerState.CullNone, (Effect) null, Main.Transform); } DrawData drawData = new DrawData(texture2, position1, new Microsoft.Xna.Framework.Rectangle?(r1), color3, rCurrentNPC.rotation, r1.Size() / 2f, rCurrentNPC.scale * 2f, npcSpriteEffect, 0); GameShaders.Misc["HallowBoss"].Apply(new DrawData?(drawData)); drawData.Draw(mySpriteBatch); Main.pixelShader.CurrentTechnique.Passes[0].Apply(); if (!rCurrentNPC.IsABestiaryIconDummy) { mySpriteBatch.End(); mySpriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, (Effect) null, Main.Transform); } float amount2 = (float) (Math.Sin((double) Main.GlobalTimeWrappedHourly * 6.28318548202515 * 0.5) * 0.5 + 0.5); Microsoft.Xna.Framework.Color color4 = Main.hslToRgb((float) (((double) amount2 * 0.0799999982118607 + 0.600000023841858) % 1.0), 1f, 0.5f); color4.A = (byte) 0; color4 *= 0.6f; if (NPC.ShouldEmpressBeEnraged()) { color4 = Main.OurFavoriteColor; color4.A = (byte) 0; color4 *= 0.3f; } color4 *= num4 * rCurrentNPC.Opacity; if (flag) { Texture2D texture2D5 = TextureAssets.Extra[187].Value; Microsoft.Xna.Framework.Rectangle rectangle = texture2D5.Frame(verticalFrames: 8, frameY: ((int) ((double) rCurrentNPC.localAI[0] / 4.0) % 8)); mySpriteBatch.Draw(texture2D5, position1, new Microsoft.Xna.Framework.Rectangle?(rectangle), color3, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, npcSpriteEffect, 0.0f); for (float num16 = 0.0f; (double) num16 < 1.0; num16 += 0.25f) { Vector2 vector2 = rCurrentNPC.rotation.ToRotationVector2().RotatedBy((double) num16 * 6.28318548202515 + 0.785398185253143) * MathHelper.Lerp(2f, 8f, amount2); mySpriteBatch.Draw(texture2D5, position1 + vector2, new Microsoft.Xna.Framework.Rectangle?(rectangle), color4, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, npcSpriteEffect, 0.0f); } } mySpriteBatch.Draw(texture1, position1, new Microsoft.Xna.Framework.Rectangle?(rCurrentNPC.frame), color3, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, npcSpriteEffect, 0.0f); if (flag) { Texture2D texture3 = TextureAssets.Extra[188].Value; for (float num17 = 0.0f; (double) num17 < 1.0; num17 += 0.25f) { Vector2 vector2 = rCurrentNPC.rotation.ToRotationVector2().RotatedBy((double) num17 * 6.28318548202515 + 0.785398185253143) * MathHelper.Lerp(2f, 8f, amount2); mySpriteBatch.Draw(texture3, position1 + vector2, new Microsoft.Xna.Framework.Rectangle?(), color4, rCurrentNPC.rotation, halfSize, rCurrentNPC.scale, npcSpriteEffect, 0.0f); } } for (int index = 0; index < 2; ++index) { if (index == num2) mySpriteBatch.Draw(texture2D2, position1, new Microsoft.Xna.Framework.Rectangle?(r2), color3, rCurrentNPC.rotation, origin1, rCurrentNPC.scale, npcSpriteEffect, 0.0f); if (index == num3) mySpriteBatch.Draw(texture2D3, position1, new Microsoft.Xna.Framework.Rectangle?(r3), color3, rCurrentNPC.rotation, origin2, rCurrentNPC.scale, npcSpriteEffect, 0.0f); } } private static void DrawNPCDirect_GetHallowBossArmFrame( NPC rCurrentNPC, out int armFrame_Count, out int armFrameToUseLeft, out int armFrameToUseRight) { int num1 = 0; int num2 = 1; int num3 = 2; int num4 = 3; int num5 = 4; int num6 = 5; int num7 = 6; armFrame_Count = 7; armFrameToUseLeft = num1; armFrameToUseRight = num1; float num8 = rCurrentNPC.ai[1]; switch ((int) rCurrentNPC.ai[0]) { case 0: int num9 = (double) num8 >= 106.0 ? ((double) num8 >= 110.0 ? num1 : num3) : num2; armFrameToUseLeft = num9; armFrameToUseRight = num9; break; case 2: case 11: int num10 = (double) num8 >= 5.0 ? ((double) num8 >= 65.0 ? num3 : num4) : num3; armFrameToUseLeft = num10; break; case 4: case 10: int num11 = (double) num8 >= 6.0 ? ((double) num8 >= 54.0 ? num3 : num4) : num3; armFrameToUseLeft = num11; armFrameToUseRight = num11; break; case 5: int num12 = (double) num8 >= 6.0 ? ((double) num8 >= 54.0 ? num3 : num4) : num3; armFrameToUseRight = num12; break; case 6: int num13 = (double) num8 >= 6.0 ? ((double) num8 >= 174.0 ? ((double) num8 >= 180.0 ? num1 : num3) : num4) : num3; armFrameToUseLeft = num13; armFrameToUseRight = num13; break; case 7: bool isExpertMode = Main.GameModeInfo.IsExpertMode; int num14 = isExpertMode ? 40 : 60; int num15 = 0; int num16 = 5; if ((double) num8 < (double) (num15 + num16)) { armFrameToUseLeft = num3; break; } int num17 = num15 + num16; if ((double) num8 < (double) (num17 + num14 - num16)) { armFrameToUseLeft = num4; break; } int num18 = num17 + (num14 - num16); if ((double) num8 < (double) (num18 + num16)) { armFrameToUseLeft = num4; armFrameToUseRight = num3; break; } int num19 = num18 + num16; if ((double) num8 < (double) (num19 + num14 - num16)) { armFrameToUseLeft = num4; armFrameToUseRight = num4; break; } int num20 = num19 + (num14 - num16); if ((double) num8 < (double) (num20 + num14)) { armFrameToUseLeft = num5; armFrameToUseRight = num4; break; } int num21 = num20 + num14; if ((double) num8 < (double) (num21 + num14)) { armFrameToUseLeft = num5; armFrameToUseRight = num5; break; } int num22 = num21 + num14; if (isExpertMode) { if ((double) num8 < (double) (num22 + num16)) { armFrameToUseLeft = num4; armFrameToUseRight = num5; break; } int num23 = num22 + num16; if ((double) num8 < (double) (num23 + num14 - num16)) { armFrameToUseLeft = num2; armFrameToUseRight = num5; break; } int num24 = num23 + (num14 - num16); if ((double) num8 < (double) (num24 + num16)) { armFrameToUseLeft = num2; armFrameToUseRight = num4; break; } int num25 = num24 + num16; if ((double) num8 < (double) (num25 + num14 - num16)) { armFrameToUseLeft = num2; armFrameToUseRight = num2; break; } num22 = num25 + (num14 - num16); } if ((double) num8 < (double) num22) break; armFrameToUseLeft = num3; armFrameToUseRight = num3; break; case 8: case 9: int num26 = (double) num8 >= 10.0 ? ((double) num8 >= 20.0 ? ((double) num8 >= 30.0 ? num6 : num3) : num4) : num3; int num27 = num26; int num28 = num26; int num29 = (int) rCurrentNPC.ai[3]; int num30 = -1; if ((double) num8 < 30.0) { if (num29 == -1 * num30) num28 = num2; if (num29 == num30) num27 = num2; } int num31 = num6; int num32 = num7; if (num29 == num30 && num28 == num31) num28 = num32; if (num29 == -1 * num30 && num27 == num31) num27 = num32; armFrameToUseLeft = num28; armFrameToUseRight = num27; break; } } private static void DrawNPC_SlimeItem( NPC rCurrentNPC, int typeCache, Microsoft.Xna.Framework.Color npcColor, float addedRotation) { int i = (int) rCurrentNPC.ai[1]; float scale = 1f; float num1 = 22f * rCurrentNPC.scale; float num2 = 18f * rCurrentNPC.scale; Main.instance.LoadItem(i); float num3 = (float) TextureAssets.Item[i].Width(); float num4 = (float) TextureAssets.Item[i].Height(); int num5 = (int) rCurrentNPC.ai[0] == -999 ? 1 : 0; if (num5 != 0) { num1 = 14f * rCurrentNPC.scale; num2 = 14f * rCurrentNPC.scale; } if ((double) num3 > (double) num1) { scale *= num1 / num3; num3 *= scale; num4 *= scale; } if ((double) num4 > (double) num2) { scale *= num2 / num4; num3 *= scale; float num6 = num4 * scale; } float num7 = -1f; float num8 = 1f; int num9 = rCurrentNPC.frame.Y / (TextureAssets.Npc[typeCache].Height() / Main.npcFrameCount[typeCache]); float num10 = num8 - (float) num9; float num11 = num7 + (float) (num9 * 2); float rotation = 0.2f - 0.3f * (float) num9; if (num5 != 0) { rotation = 0.0f; num10 -= 6f; num11 -= num3 * addedRotation; } Main.spriteBatch.Draw(TextureAssets.Item[i].Value, new Vector2(rCurrentNPC.Center.X - Main.screenPosition.X + num11, rCurrentNPC.Center.Y - Main.screenPosition.Y + rCurrentNPC.gfxOffY + num10), new Microsoft.Xna.Framework.Rectangle?(), npcColor, rotation, new Vector2((float) (TextureAssets.Item[i].Width() / 2), (float) (TextureAssets.Item[i].Height() / 2)), scale, SpriteEffects.None, 0.0f); } protected void DrawNPCExtras( NPC n, bool beforeDraw, float addHeight, float addY, Microsoft.Xna.Framework.Color npcColor, Vector2 halfSize, SpriteEffects npcSpriteEffect, Vector2 screenPosition) { if (!beforeDraw && n.UsesPartyHat()) { int index = n.frame.Y / n.frame.Height; int[] npCsFramingGroup = NPCID.Sets.TownNPCsFramingGroups[NPCID.Sets.NPCFramingGroup[n.type]]; if (index >= npCsFramingGroup.Length) index = 0; Texture2D texture2D = TextureAssets.Extra[72].Value; int num1 = 0; switch (n.GetPartyHatColor()) { case PartyHatColor.Pink: num1 = 16; break; case PartyHatColor.Cyan: num1 = 17; break; case PartyHatColor.Purple: num1 = 18; break; case PartyHatColor.White: num1 = 19; break; } Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(20, frameX: (num1 % 20)); r.Width -= 2; r.Height -= 2; int num2 = 0; if (n.type == 637) { num2 = 6; switch (index) { case 11: case 12: case 13: case 14: case 15: num2 += 2; break; case 19: case 22: case 23: case 24: case 25: case 26: case 27: num2 -= 2; break; } } if (n.type == 638) num2 = 12; if (n.type == 656) { num2 = 6; switch (index) { case 1: case 2: case 3: num2 -= 2; break; case 8: num2 -= 2; break; case 18: case 19: case 20: case 21: case 22: case 23: case 24: case 25: num2 -= 4; break; } } Vector2 vector2 = n.Top + new Vector2((float) (-2 * n.spriteDirection), n.gfxOffY); vector2.X += (float) (num2 * n.spriteDirection); vector2.Y += (float) npCsFramingGroup[index]; vector2.Y += (float) NPCID.Sets.HatOffsetY[n.type]; int num3 = 0; if ((double) n.ai[0] == 5.0) { num3 = -4; if (n.type == 38) num3 = -8; if (n.type == 124) num3 = -2; if (n.type == 550) num3 = -4; if (n.type == 588) num3 = -4; if (n.type == 108 || n.type == 178) num3 = -6; if (n.type == 637) num3 = -12; } vector2.Y += (float) num3; if (n.type == 229 && (double) n.ai[0] == 12.0) vector2.X -= (float) (n.spriteDirection * 4); if (n.type == 550 && (double) n.ai[0] == 5.0) vector2.X += (float) (n.spriteDirection * 7); Vector2 origin = r.Size() - new Vector2((float) (r.Width / 2), 12f); int num4 = 0; switch (n.type) { case 17: case 18: case 19: case 20: case 22: case 124: case 229: case 353: case 633: case 637: case 638: case 656: num4 = -1; break; case 37: case 38: case 54: case 107: case 108: case 160: case 207: case 209: num4 = -3; break; case 178: case 208: case 369: num4 = 1; break; case 227: num4 = -4; break; case 228: num4 = -2; break; case 550: num4 = -4; break; case 588: num4 = 0; break; } vector2.X += (float) (num4 * n.spriteDirection); vector2.X += (float) (4 * n.spriteDirection); Main.spriteBatch.Draw(texture2D, new Vector2(vector2.X - screenPosition.X, vector2.Y - screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(r), npcColor * n.Opacity, 0.0f, origin, n.scale, npcSpriteEffect, 0.0f); } if (NPCID.Sets.AttackType[n.type] == 1 && (double) n.ai[0] == 12.0 && !beforeDraw) { if (n.type == 228 || n.type == 229 || n.type == 209) return; double num5 = (double) n.ai[2]; Vector2 vector2_1 = Main.OffsetsNPCOffhand[2]; if (n.spriteDirection == 1) vector2_1.X *= -1f; Vector2 vector2_2 = n.Bottom - vector2_1; if (n.type == 22 && (double) n.ai[2] > -0.100000001490116) vector2_2.Y += 4f; if (n.type == 368 && Main.hardMode && (double) n.ai[2] > -0.100000001490116) vector2_2.Y += 4f; if (n.type == 368 && !Main.hardMode && (double) n.ai[2] < -0.100000001490116) vector2_2.Y -= 8f; float rotation = (float) (num5 * 1.57079637050629) * (float) n.spriteDirection; float num6 = 1f; int index = 0; int num7 = 4; if (n.type == 19) { index = Main.hardMode ? 98 : 95; if (Main.hardMode) { vector2_2.X -= (float) (10 * n.direction); vector2_2.Y += 4f; } } else if (n.type == 22) { index = 39; num7 = 18; } else if (n.type == 178) index = 434; else if (n.type == 227) { index = 3350; num7 = 16; num6 = 0.85f; } else if (n.type == 368) { index = Main.hardMode ? 2223 : 2269; if (Main.hardMode) { num7 = 18; } else { if ((double) n.ai[2] < -0.100000001490116) num7 = 28; num6 = 0.75f; } } Main.instance.LoadItem(index); Texture2D texture = TextureAssets.Item[index].Value; int num8 = (int) Main.DrawPlayerItemPos(1f, index).X - num7; Vector2 origin = new Vector2((float) -num8, (float) (texture.Height / 2)); if (n.spriteDirection == -1) origin = new Vector2((float) (texture.Width + num8), (float) (texture.Height / 2)); Main.spriteBatch.Draw(texture, new Vector2((float) (int) ((double) vector2_2.X - (double) screenPosition.X), (float) (int) ((double) vector2_2.Y - (double) screenPosition.Y)), new Microsoft.Xna.Framework.Rectangle?(), npcColor, rotation, origin, n.scale * num6, npcSpriteEffect ^ SpriteEffects.FlipHorizontally, 0.0f); if (n.type == 22 && n.frame.Y / (TextureAssets.Npc[n.type].Height() / Main.npcFrameCount[n.type]) >= 21) { Texture2D texture2D = TextureAssets.Extra[52].Value; Microsoft.Xna.Framework.Rectangle rectangle = texture2D.Frame(verticalFrames: 5, frameY: (n.frame.Y / (TextureAssets.Npc[n.type].Height() / Main.npcFrameCount[n.type]) - 21)); Main.spriteBatch.Draw(texture2D, new Vector2((float) ((double) n.position.X - (double) screenPosition.X + (double) (n.width / 2) - (double) TextureAssets.Npc[n.type].Width() * (double) n.scale / 2.0 + (double) halfSize.X * (double) n.scale), (float) ((double) n.position.Y - (double) screenPosition.Y + (double) n.height - (double) TextureAssets.Npc[n.type].Height() * (double) n.scale / (double) Main.npcFrameCount[n.type] + 4.0 + (double) halfSize.Y * (double) n.scale) + addHeight + addY + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), n.GetAlpha(npcColor), n.rotation, halfSize, n.scale, npcSpriteEffect, 0.0f); } else if (n.type == 368 && n.frame.Y / (TextureAssets.Npc[n.type].Height() / Main.npcFrameCount[n.type]) >= 21) { Texture2D texture2D = TextureAssets.Extra[53].Value; Microsoft.Xna.Framework.Rectangle rectangle = texture2D.Frame(verticalFrames: 5, frameY: (n.frame.Y / (TextureAssets.Npc[n.type].Height() / Main.npcFrameCount[n.type]) - 21)); Main.spriteBatch.Draw(texture2D, new Vector2((float) ((double) n.position.X - (double) screenPosition.X + (double) (n.width / 2) - (double) TextureAssets.Npc[n.type].Width() * (double) n.scale / 2.0 + (double) halfSize.X * (double) n.scale), (float) ((double) n.position.Y - (double) screenPosition.Y + (double) n.height - (double) TextureAssets.Npc[n.type].Height() * (double) n.scale / (double) Main.npcFrameCount[n.type] + 4.0 + (double) halfSize.Y * (double) n.scale) + addHeight + addY + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), n.GetAlpha(npcColor), n.rotation, halfSize, n.scale, npcSpriteEffect, 0.0f); } } if (NPCID.Sets.AttackType[n.type] == 2 && (double) n.ai[0] == 14.0 && !beforeDraw) { Texture2D texture2D = TextureAssets.Extra[51].Value; Vector2 vector2 = n.Bottom + new Vector2(0.0f, n.gfxOffY + 4f); Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: 4, frameY: ((int) n.frameCounter % 48 / 12)); Vector2 origin = r.Size() * new Vector2(0.5f, 1f); Main.spriteBatch.Draw(texture2D, new Vector2((float) (int) ((double) vector2.X - (double) screenPosition.X), (float) (int) ((double) vector2.Y - (double) screenPosition.Y)), new Microsoft.Xna.Framework.Rectangle?(r), NPCID.Sets.MagicAuraColor[n.type], 0.0f, origin, n.scale, npcSpriteEffect ^ SpriteEffects.FlipHorizontally, 0.0f); } if (NPCID.Sets.AttackType[n.type] == 3 && (double) n.ai[0] == 15.0) { Main.instance.LoadItem(4); Texture2D texture2D = TextureAssets.Item[4].Value; int num9 = 32; float num10 = 0.0f; Vector2 zero = Vector2.Zero; if (n.type == 207) { Main.instance.LoadItem(3349); texture2D = TextureAssets.Item[3349].Value; num10 = 0.15f; if (beforeDraw) return; if ((double) n.ai[1] > (double) NPCID.Sets.AttackTime[n.type] * 0.660000026226044) zero.Y = 12f; } else if (n.type == 353) { Main.instance.LoadItem(3352); texture2D = TextureAssets.Item[3352].Value; num10 = 0.15f; if (!beforeDraw) return; if ((double) n.ai[1] > (double) NPCID.Sets.AttackTime[n.type] * 0.660000026226044) zero.Y = 12f; } else if (n.type == 441) { Main.instance.LoadItem(3351); texture2D = TextureAssets.Item[3351].Value; num9 = 28; num10 = 0.1f; if (!beforeDraw) return; if ((double) n.ai[1] > (double) NPCID.Sets.AttackTime[n.type] * 0.660000026226044) zero.Y = 12f; } Tuple swingStats = n.GetSwingStats(NPCID.Sets.AttackTime[n.type] * 2, (int) n.ai[1], n.spriteDirection, num9, num9); Vector2 vector2 = swingStats.Item1 + (swingStats.Item1 - n.Center) * num10 + zero; Vector2 origin = texture2D.Size() * new Vector2(n.spriteDirection == 1 ? 0.0f : 1f, 1f); Main.spriteBatch.Draw(texture2D, new Vector2((float) (int) ((double) vector2.X - (double) screenPosition.X), (float) (int) ((double) vector2.Y - (double) screenPosition.Y)), new Microsoft.Xna.Framework.Rectangle?(), n.GetAlpha(npcColor), swingStats.Item2, origin, n.scale, npcSpriteEffect ^ SpriteEffects.FlipHorizontally, 0.0f); } if (n.type != 550 || (double) n.ai[0] != 18.0 || beforeDraw) return; Main.instance.LoadItem(353); Texture2D texture2D1 = TextureAssets.Item[353].Value; int num11 = 32; float num12 = 0.15f; Vector2 zero1 = Vector2.Zero; Microsoft.Xna.Framework.Rectangle r1 = texture2D1.Frame(verticalFrames: 3, frameY: 1); int index1 = (int) n.ai[2]; if (index1 >= 0 && index1 < (int) byte.MaxValue) { Player player = Main.player[index1]; bool flag = player.HeldItem.type == 353 && player.direction == Math.Sign(n.Center.X - player.Center.X); double num13 = (double) player.Hitbox.Distance(n.Center); float num14 = n.localAI[3]; if (num13 < 46.0 & flag) { n.localAI[3] = 1f; if ((double) n.localAI[3] != (double) num14) { Vector2 vector2_3 = n.Center + new Vector2((float) (n.spriteDirection * 30), -6f); Vector2 vector2_4 = new Vector2(10f, 10f); for (int index2 = 0; index2 < 30; ++index2) { Dust dust = Dust.NewDustDirect(vector2_3 - vector2_4 / 2f, (int) vector2_4.X, (int) vector2_4.Y, 4, Alpha: 50, newColor: new Microsoft.Xna.Framework.Color(245, 200, 30, 155), Scale: 0.7f); dust.noGravity = true; dust.velocity *= 1f; Dust.NewDustDirect(vector2_3 - vector2_4 / 2f, (int) vector2_4.X, (int) vector2_4.Y, 4, Alpha: 50, newColor: new Microsoft.Xna.Framework.Color(245, 200, 30, 155), Scale: 0.6f).velocity *= 2f; } } } else if ((double) n.localAI[3] == 1.0) n.localAI[3] = 2f; } Tuple swingStats1 = n.GetSwingStats(40, 12, n.spriteDirection, num11, num11); Vector2 vector2_5 = swingStats1.Item1 + (swingStats1.Item1 - n.Center) * num12 + zero1; Vector2 origin1 = r1.Size() * new Vector2(n.spriteDirection == 1 ? 0.0f : 1f, 1f); Main.spriteBatch.Draw(texture2D1, new Vector2((float) (int) ((double) vector2_5.X - (double) screenPosition.X), (float) (int) ((double) vector2_5.Y - (double) screenPosition.Y)), new Microsoft.Xna.Framework.Rectangle?(r1), n.GetAlpha(npcColor), swingStats1.Item2, origin1, n.scale, npcSpriteEffect ^ SpriteEffects.FlipHorizontally, 0.0f); } public void DrawProj(int i) { this.PrepareDrawnEntityDrawing((Entity) Main.projectile[i], Main.GetProjectileDesiredShader(i)); int num1 = ProjectileID.Sets.DrawScreenCheckFluff[Main.projectile[i].type]; if (!new Microsoft.Xna.Framework.Rectangle((int) Main.Camera.ScaledPosition.X - num1, (int) Main.Camera.ScaledPosition.Y - num1, (int) Main.Camera.ScaledSize.X + num1 * 2, (int) Main.Camera.ScaledSize.Y + num1 * 2).Intersects(Main.projectile[i].Hitbox)) return; Projectile projectile1 = Main.projectile[i]; if (projectile1.type == 734) { VoidLensHelper voidLensHelper = new VoidLensHelper(projectile1); this._voidLensData.Clear(); int selectionMode = Main.TryInteractingWithVoidLens(projectile1); voidLensHelper.DrawToDrawData(this._voidLensData, selectionMode); foreach (DrawData data in this._voidLensData) Main.EntitySpriteDraw(data); } else { float polePosX = 0.0f; float polePosY = 0.0f; this.LoadProjectile(projectile1.type); Vector2 mountedCenter = Main.player[projectile1.owner].MountedCenter; if (projectile1.aiStyle == 99) { Vector2 vector2 = mountedCenter; vector2.Y += Main.player[projectile1.owner].gfxOffY; float num2 = projectile1.Center.X - vector2.X; float num3 = projectile1.Center.Y - vector2.Y; Math.Sqrt((double) num2 * (double) num2 + (double) num3 * (double) num3); float num4 = (float) Math.Atan2((double) num3, (double) num2) - 1.57f; if (!projectile1.counterweight) { int num5 = -1; if ((double) projectile1.position.X + (double) (projectile1.width / 2) < (double) Main.player[projectile1.owner].position.X + (double) (Main.player[projectile1.owner].width / 2)) num5 = 1; int num6 = num5 * -1; Main.player[projectile1.owner].itemRotation = (float) Math.Atan2((double) num3 * (double) num6, (double) num2 * (double) num6); } bool flag = true; if ((double) num2 == 0.0 && (double) num3 == 0.0) { flag = false; } else { float num7 = 12f / (float) Math.Sqrt((double) num2 * (double) num2 + (double) num3 * (double) num3); float num8 = num2 * num7; float num9 = num3 * num7; vector2.X -= num8 * 0.1f; vector2.Y -= num9 * 0.1f; num2 = projectile1.position.X + (float) projectile1.width * 0.5f - vector2.X; num3 = projectile1.position.Y + (float) projectile1.height * 0.5f - vector2.Y; } while (flag) { float num10 = 12f; float f1 = (float) Math.Sqrt((double) num2 * (double) num2 + (double) num3 * (double) num3); float f2 = f1; if (float.IsNaN(f1) || float.IsNaN(f2)) { flag = false; } else { if ((double) f1 < 20.0) { num10 = f1 - 8f; flag = false; } float num11 = 12f / f1; float num12 = num2 * num11; float num13 = num3 * num11; vector2.X += num12; vector2.Y += num13; num2 = projectile1.position.X + (float) projectile1.width * 0.5f - vector2.X; num3 = projectile1.position.Y + (float) projectile1.height * 0.1f - vector2.Y; if ((double) f2 > 12.0) { float num14 = 0.3f; float num15 = Math.Abs(projectile1.velocity.X) + Math.Abs(projectile1.velocity.Y); if ((double) num15 > 16.0) num15 = 16f; float num16 = (float) (1.0 - (double) num15 / 16.0); float num17 = num14 * num16; float num18 = f2 / 80f; if ((double) num18 > 1.0) num18 = 1f; float num19 = num17 * num18; if ((double) num19 < 0.0) num19 = 0.0f; float num20 = num19 * num18 * 0.5f; if ((double) num3 > 0.0) { num3 *= 1f + num20; num2 *= 1f - num20; } else { float num21 = Math.Abs(projectile1.velocity.X) / 3f; if ((double) num21 > 1.0) num21 = 1f; float num22 = num21 - 0.5f; float num23 = num20 * num22; if ((double) num23 > 0.0) num23 *= 2f; num3 *= 1f + num23; num2 *= 1f - num23; } } float rotation = (float) Math.Atan2((double) num3, (double) num2) - 1.57f; Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.White; color.A = (byte) ((double) color.A * 0.400000005960464); color = Main.TryApplyingPlayerStringColor(Main.player[projectile1.owner].stringColor, color); float num24 = 0.5f; color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0), color); color = new Microsoft.Xna.Framework.Color((int) (byte) ((double) color.R * (double) num24), (int) (byte) ((double) color.G * (double) num24), (int) (byte) ((double) color.B * (double) num24), (int) (byte) ((double) color.A * (double) num24)); Main.EntitySpriteDraw(TextureAssets.FishingLine.Value, new Vector2((float) ((double) vector2.X - (double) Main.screenPosition.X + (double) TextureAssets.FishingLine.Width() * 0.5), (float) ((double) vector2.Y - (double) Main.screenPosition.Y + (double) TextureAssets.FishingLine.Height() * 0.5)) - new Vector2(6f, 0.0f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.FishingLine.Width(), (int) num10)), color, rotation, new Vector2((float) TextureAssets.FishingLine.Width() * 0.5f, 0.0f), 1f, SpriteEffects.None, 0); } } } else { if (projectile1.aiStyle == 160) { this.DrawKite(projectile1); return; } if (projectile1.aiStyle == 165) { this.DrawWhip(projectile1); return; } } if (projectile1.type == 879 || projectile1.type == 877 || projectile1.type == 878) projectile1.position.Y -= Main.player[projectile1.owner].gfxOffY; if (projectile1.aiStyle == 174) { this.DrawMultisegmentPet(projectile1); } else { if (projectile1.type == 34) new FlameLashDrawer().Draw(projectile1); if (projectile1.type == 16) new MagicMissileDrawer().Draw(projectile1); if (projectile1.type == 933) new FinalFractalHelper().Draw(projectile1); if (projectile1.type == 79) new RainbowRodDrawer().Draw(projectile1); if (projectile1.type == 919) this.DrawProj_FairyQueenLance(projectile1); else if (projectile1.type == 932) this.DrawProj_FairyQueenRangedItemShot(projectile1); else if (projectile1.type == 946) { EmpressBladeDrawer empressBladeDrawer = new EmpressBladeDrawer(); float num25 = (float) ((double) Main.GlobalTimeWrappedHourly % 3.0 / 3.0); float num26 = MathHelper.Max(1f, (float) Main.player[projectile1.owner].maxMinions); float hueOverride = (float) projectile1.identity % num26 / num26 + num25; Microsoft.Xna.Framework.Color queenWeaponsColor1 = projectile1.GetFairyQueenWeaponsColor(0.0f, rawHueOverride: new float?(hueOverride % 1f)); Microsoft.Xna.Framework.Color queenWeaponsColor2 = projectile1.GetFairyQueenWeaponsColor(0.0f, rawHueOverride: new float?((float) (((double) hueOverride + 0.5) % 1.0))); empressBladeDrawer.ColorStart = queenWeaponsColor1; empressBladeDrawer.ColorEnd = queenWeaponsColor2; empressBladeDrawer.Draw(projectile1); this.DrawProj_EmpressBlade(projectile1, hueOverride); } else if (projectile1.type == 927) this.DrawProj_PiercingStarlight(projectile1); else if (projectile1.type == 917) this.DrawProj_CoolWhipMinion(projectile1); else if (projectile1.type == 923) { Vector2 position = projectile1.Center - Main.screenPosition; Texture2D texture2D = TextureAssets.Projectile[projectile1.type].Value; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: 2); Microsoft.Xna.Framework.Rectangle rectangle = texture2D.Frame(verticalFrames: 2, frameY: 1); Vector2 origin = r.Size() * new Vector2(0.03f, 0.5f); float from = 180f; double num27 = (double) projectile1.ai[0] / 6.28318548202515 + (double) projectile1.localAI[0] / (double) from; float num28 = Utils.GetLerpValue(0.0f, 30f, projectile1.localAI[0], true) * Utils.GetLerpValue(from, from - 30f, projectile1.localAI[0], true); Microsoft.Xna.Framework.Color color1 = Main.hslToRgb((float) (num27 % 1.0), 1f, 1f) * num28; float lerpValue = Utils.GetLerpValue(40f, 60f, projectile1.localAI[0], true); Vector2 scale = new Vector2(1f, MathHelper.Lerp(0.25f, 0.7f, lerpValue)) * projectile1.scale; Microsoft.Xna.Framework.Color color2 = Main.hslToRgb((float) ((num27 + 0.300000011920929) % 1.0), 1f, MathHelper.Lerp(0.3f, 0.66f, lerpValue)) * num28; if (NPC.ShouldEmpressBeEnraged()) color2 = Main.OurFavoriteColor * num28; Microsoft.Xna.Framework.Color color3 = Microsoft.Xna.Framework.Color.Lerp(color2, Microsoft.Xna.Framework.Color.White, 0.1f); color3.A /= (byte) 2; Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(rectangle), color3, projectile1.rotation, origin, scale * 1.2f, SpriteEffects.None, 0.0f); Microsoft.Xna.Framework.Color color4 = Main.hslToRgb((float) ((num27 + 0.150000005960464) % 1.0), 1f, MathHelper.Lerp(0.3f, 0.5f, lerpValue)) * num28; if (NPC.ShouldEmpressBeEnraged()) color4 = Main.OurFavoriteColor * num28; Microsoft.Xna.Framework.Color color5 = Microsoft.Xna.Framework.Color.Lerp(color4, Microsoft.Xna.Framework.Color.White, 0.1f); color5.A /= (byte) 2; Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(rectangle), color5, projectile1.rotation, origin, scale * 1.1f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(r), color1 * 0.5f, projectile1.rotation, origin, scale, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(rectangle), color1 * lerpValue, projectile1.rotation, origin, scale, SpriteEffects.None, 0.0f); } else if (projectile1.type == 888) this.DrawTwinsPet(projectile1); else if (projectile1.type == 874) this.DrawMurderAurora(projectile1); else if (projectile1.type == 871) { Texture2D texture2D = TextureAssets.Projectile[projectile1.type].Value; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: 4); Vector2 origin = r.Size() / 2f; Microsoft.Xna.Framework.Color color6 = Microsoft.Xna.Framework.Color.White * projectile1.Opacity; SpriteEffects effects = SpriteEffects.None; color6.A /= (byte) 2; Microsoft.Xna.Framework.Color color7 = projectile1.AI_171_GetColor(); color7.A /= (byte) 2; float scale = projectile1.scale * 1.3f; float num29 = 1f; int pelletStormsCount = projectile1.AI_172_GetPelletStormsCount(); bool flag = false; float num30 = float.PositiveInfinity; for (int stormIndex = 0; stormIndex < pelletStormsCount; ++stormIndex) { Projectile.HallowBossPelletStormInfo pelletStormInfo = projectile1.AI_172_GetPelletStormInfo(stormIndex); for (int bulletIndex = 0; bulletIndex < pelletStormInfo.BulletsInStorm; ++bulletIndex) { float bulletProgress = pelletStormInfo.GetBulletProgress(bulletIndex); if ((double) bulletProgress < (double) num30) num30 = bulletProgress; if (pelletStormInfo.IsValid(bulletIndex)) { if (stormIndex == pelletStormsCount - 1 && (double) bulletProgress > 0.0) flag = true; r = texture2D.Frame(verticalFrames: 4, frameY: ((int) ((double) (bulletIndex + stormIndex * 6) + Main.timeForVisualEffects / 4.0) % 4)); float num31 = Utils.GetLerpValue(0.0f, 0.1f, bulletProgress, true) * Utils.GetLerpValue(1f, 0.8f, bulletProgress, true); Vector2 bulletPosition = pelletStormInfo.GetBulletPosition(bulletIndex, projectile1.Center); Main.EntitySpriteDraw(texture2D, bulletPosition - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(r), color7 * num31, projectile1.rotation, origin, scale * num29, effects, 0); Main.EntitySpriteDraw(texture2D, bulletPosition - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(r), color6 * num31, projectile1.rotation, origin, projectile1.scale * num29, effects, 0); } } } if (flag || (double) num30 > 1.0) return; Main.EntitySpriteDraw(texture2D, projectile1.Center - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(r), color7, projectile1.rotation, origin, scale, effects, 0); Main.EntitySpriteDraw(texture2D, projectile1.Center - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(r), color6, projectile1.rotation, origin, projectile1.scale, effects, 0); } else { if (projectile1.bobber && Main.player[projectile1.owner].inventory[Main.player[projectile1.owner].selectedItem].holdStyle != 0) Main.DrawProj_FishingLine(projectile1, ref polePosX, ref polePosY, mountedCenter); else if (projectile1.type == 32) { Vector2 vector2 = new Vector2(projectile1.position.X + (float) projectile1.width * 0.5f, projectile1.position.Y + (float) projectile1.height * 0.5f); float num32 = mountedCenter.X - vector2.X; float num33 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num33, (double) num32) - 1.57f; bool flag = true; if ((double) num32 == 0.0 && (double) num33 == 0.0) { flag = false; } else { float num34 = 8f / (float) Math.Sqrt((double) num32 * (double) num32 + (double) num33 * (double) num33); float num35 = num32 * num34; float num36 = num33 * num34; vector2.X -= num35; vector2.Y -= num36; num32 = mountedCenter.X - vector2.X; num33 = mountedCenter.Y - vector2.Y; } while (flag) { float f = (float) Math.Sqrt((double) num32 * (double) num32 + (double) num33 * (double) num33); if ((double) f < 28.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num37 = 28f / f; float num38 = num32 * num37; float num39 = num33 * num37; vector2.X += num38; vector2.Y += num39; num32 = mountedCenter.X - vector2.X; num33 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.EntitySpriteDraw(TextureAssets.Chain5.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain5.Width(), TextureAssets.Chain5.Height())), color, rotation, new Vector2((float) TextureAssets.Chain5.Width() * 0.5f, (float) TextureAssets.Chain5.Height() * 0.5f), 1f, SpriteEffects.None, 0); } } } else if (projectile1.type == 73) { Vector2 vector2 = new Vector2(projectile1.position.X + (float) projectile1.width * 0.5f, projectile1.position.Y + (float) projectile1.height * 0.5f); float num40 = mountedCenter.X - vector2.X; float num41 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num41, (double) num40) - 1.57f; bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num40 * (double) num40 + (double) num41 * (double) num41); if ((double) f < 25.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num42 = 12f / f; float num43 = num40 * num42; float num44 = num41 * num42; vector2.X += num43; vector2.Y += num44; num40 = mountedCenter.X - vector2.X; num41 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.EntitySpriteDraw(TextureAssets.Chain8.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain8.Width(), TextureAssets.Chain8.Height())), color, rotation, new Vector2((float) TextureAssets.Chain8.Width() * 0.5f, (float) TextureAssets.Chain8.Height() * 0.5f), 1f, SpriteEffects.None, 0); } } } else if (projectile1.type == 186) { Vector2 vector2 = new Vector2(projectile1.localAI[0], projectile1.localAI[1]); float num45 = Vector2.Distance(projectile1.Center, vector2) - projectile1.velocity.Length(); float num46 = (float) TextureAssets.Chain17.Height() - num45; if ((double) num45 > 0.0 && (double) projectile1.ai[1] > 0.0) { Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) projectile1.position.X / 16, (int) projectile1.position.Y / 16); Main.EntitySpriteDraw(TextureAssets.Chain17.Value, vector2 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, (int) num46, TextureAssets.Chain17.Width(), (int) num45)), color, projectile1.rotation, new Vector2((float) (TextureAssets.Chain17.Width() / 2), 0.0f), 1f, SpriteEffects.None, 0); } } else if (projectile1.type == 74) { Vector2 vector2 = new Vector2(projectile1.position.X + (float) projectile1.width * 0.5f, projectile1.position.Y + (float) projectile1.height * 0.5f); float num47 = mountedCenter.X - vector2.X; float num48 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num48, (double) num47) - 1.57f; bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num47 * (double) num47 + (double) num48 * (double) num48); if ((double) f < 25.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num49 = 12f / f; float num50 = num47 * num49; float num51 = num48 * num49; vector2.X += num50; vector2.Y += num51; num47 = mountedCenter.X - vector2.X; num48 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.EntitySpriteDraw(TextureAssets.Chain9.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain8.Width(), TextureAssets.Chain8.Height())), color, rotation, new Vector2((float) TextureAssets.Chain8.Width() * 0.5f, (float) TextureAssets.Chain8.Height() * 0.5f), 1f, SpriteEffects.None, 0); } } } else if (projectile1.type == 171) { Vector2 vector2 = new Vector2(projectile1.position.X + (float) projectile1.width * 0.5f, projectile1.position.Y + (float) projectile1.height * 0.5f); float num52 = -projectile1.velocity.X; float num53 = -projectile1.velocity.Y; float num54 = 1f; if ((double) projectile1.ai[0] <= 17.0) num54 = projectile1.ai[0] / 17f; int length = (int) (30.0 * (double) num54); float num55 = 1f; if ((double) projectile1.ai[0] <= 30.0) num55 = projectile1.ai[0] / 30f; float num56 = 0.4f * num55; float num57 = num56; float num58 = num53 + num57; Vector2[] vector2Array = new Vector2[length]; float[] numArray = new float[length]; for (int index = 0; index < length; ++index) { float num59 = (float) Math.Sqrt((double) num52 * (double) num52 + (double) num58 * (double) num58); float num60 = 5.6f; if ((double) Math.Abs(num52) + (double) Math.Abs(num58) < 1.0) num60 *= Math.Abs(num52) + Math.Abs(num58) / 1f; float num61 = num60 / num59; float num62 = num52 * num61; float num63 = num58 * num61; float num64 = (float) Math.Atan2((double) num63, (double) num62) - 1.57f; vector2Array[index].X = vector2.X; vector2Array[index].Y = vector2.Y; numArray[index] = num64; vector2.X += num62; vector2.Y += num63; num52 = -projectile1.velocity.X; float num65 = -projectile1.velocity.Y; num57 += num56; num58 = num65 + num57; } int num66; for (int index = num66 = length - 1; index >= 0; --index) { vector2.X = vector2Array[index].X; vector2.Y = vector2Array[index].Y; float rotation = numArray[index]; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.EntitySpriteDraw(TextureAssets.Chain16.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain16.Width(), TextureAssets.Chain16.Height())), color, rotation, new Vector2((float) TextureAssets.Chain16.Width() * 0.5f, (float) TextureAssets.Chain16.Height() * 0.5f), 0.8f, SpriteEffects.None, 0); } } else if (projectile1.type == 475) { Vector2 vector2 = new Vector2(projectile1.position.X + (float) projectile1.width * 0.5f, projectile1.position.Y + (float) projectile1.height * 0.5f); float num67 = -projectile1.velocity.X; float num68 = -projectile1.velocity.Y; float num69 = 1f; if ((double) projectile1.ai[0] <= 17.0) num69 = projectile1.ai[0] / 17f; int length = (int) (30.0 * (double) num69); float num70 = 1f; if ((double) projectile1.ai[0] <= 30.0) num70 = projectile1.ai[0] / 30f; float num71 = 0.4f * num70; float num72 = num71; float num73 = num68 + num72; Vector2[] vector2Array = new Vector2[length]; float[] numArray = new float[length]; for (int index = 0; index < length; ++index) { float num74 = (float) Math.Sqrt((double) num67 * (double) num67 + (double) num73 * (double) num73); float num75 = 5.6f; if ((double) Math.Abs(num67) + (double) Math.Abs(num73) < 1.0) num75 *= Math.Abs(num67) + Math.Abs(num73) / 1f; float num76 = num75 / num74; float num77 = num67 * num76; float num78 = num73 * num76; float num79 = (float) Math.Atan2((double) num78, (double) num77) - 1.57f; vector2Array[index].X = vector2.X; vector2Array[index].Y = vector2.Y; numArray[index] = num79; vector2.X += num77; vector2.Y += num78; num67 = -projectile1.velocity.X; float num80 = -projectile1.velocity.Y; num72 += num71; num73 = num80 + num72; } int num81 = 0; int num82; for (int index = num82 = length - 1; index >= 0; --index) { vector2.X = vector2Array[index].X; vector2.Y = vector2Array[index].Y; float rotation = numArray[index]; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); if (num81 % 2 == 0) Main.EntitySpriteDraw(TextureAssets.Chain38.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain38.Width(), TextureAssets.Chain38.Height())), color, rotation, new Vector2((float) TextureAssets.Chain38.Width() * 0.5f, (float) TextureAssets.Chain38.Height() * 0.5f), 0.8f, SpriteEffects.None, 0); else Main.EntitySpriteDraw(TextureAssets.Chain39.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain39.Width(), TextureAssets.Chain39.Height())), color, rotation, new Vector2((float) TextureAssets.Chain39.Width() * 0.5f, (float) TextureAssets.Chain39.Height() * 0.5f), 0.8f, SpriteEffects.None, 0); ++num81; } } else if (projectile1.type == 505 || projectile1.type == 506) { Vector2 vector2 = new Vector2(projectile1.position.X + (float) projectile1.width * 0.5f, projectile1.position.Y + (float) projectile1.height * 0.5f); float num83 = -projectile1.velocity.X; float num84 = -projectile1.velocity.Y; float num85 = 1f; if ((double) projectile1.ai[0] <= 17.0) num85 = projectile1.ai[0] / 17f; int length = (int) (30.0 * (double) num85); float num86 = 1f; if ((double) projectile1.ai[0] <= 30.0) num86 = projectile1.ai[0] / 30f; float num87 = 0.4f * num86; float num88 = num87; float num89 = num84 + num88; Vector2[] vector2Array = new Vector2[length]; float[] numArray = new float[length]; for (int index = 0; index < length; ++index) { float num90 = (float) Math.Sqrt((double) num83 * (double) num83 + (double) num89 * (double) num89); float num91 = 5.6f; if ((double) Math.Abs(num83) + (double) Math.Abs(num89) < 1.0) num91 *= Math.Abs(num83) + Math.Abs(num89) / 1f; float num92 = num91 / num90; float num93 = num83 * num92; float num94 = num89 * num92; float num95 = (float) Math.Atan2((double) num94, (double) num93) - 1.57f; vector2Array[index].X = vector2.X; vector2Array[index].Y = vector2.Y; numArray[index] = num95; vector2.X += num93; vector2.Y += num94; num83 = -projectile1.velocity.X; float num96 = -projectile1.velocity.Y; num88 += num87; num89 = num96 + num88; } int num97 = 0; int num98; for (int index1 = num98 = length - 1; index1 >= 0; --index1) { vector2.X = vector2Array[index1].X; vector2.Y = vector2Array[index1].Y; float rotation = numArray[index1]; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); int num99 = 4; if (projectile1.type == 506) num99 = 6; int index2 = num99 + num97 % 2; Main.EntitySpriteDraw(TextureAssets.Chains[index2].Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chains[index2].Width(), TextureAssets.Chains[index2].Height())), color, rotation, new Vector2((float) TextureAssets.Chains[index2].Width() * 0.5f, (float) TextureAssets.Chains[index2].Height() * 0.5f), 0.8f, SpriteEffects.None, 0); ++num97; } } else if (projectile1.type == 165) { Vector2 vector2 = new Vector2(projectile1.position.X + (float) projectile1.width * 0.5f, projectile1.position.Y + (float) projectile1.height * 0.5f); float num100 = mountedCenter.X - vector2.X; float num101 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num101, (double) num100) - 1.57f; bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num100 * (double) num100 + (double) num101 * (double) num101); if ((double) f < 25.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num102 = 24f / f; float num103 = num100 * num102; float num104 = num101 * num102; vector2.X += num103; vector2.Y += num104; num100 = mountedCenter.X - vector2.X; num101 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.EntitySpriteDraw(TextureAssets.Chain15.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain15.Width(), TextureAssets.Chain15.Height())), color, rotation, new Vector2((float) TextureAssets.Chain15.Width() * 0.5f, (float) TextureAssets.Chain15.Height() * 0.5f), 1f, SpriteEffects.None, 0); } } } else if (projectile1.type >= 230 && projectile1.type <= 235) { int index = projectile1.type - 229; Vector2 vector2 = new Vector2(projectile1.position.X + (float) projectile1.width * 0.5f, projectile1.position.Y + (float) projectile1.height * 0.5f); float num105 = mountedCenter.X - vector2.X; float num106 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num106, (double) num105) - 1.57f; bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num105 * (double) num105 + (double) num106 * (double) num106); if ((double) f < 25.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num107 = (float) TextureAssets.GemChain[index].Height() / f; float num108 = num105 * num107; float num109 = num106 * num107; vector2.X += num108; vector2.Y += num109; num105 = mountedCenter.X - vector2.X; num106 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.EntitySpriteDraw(TextureAssets.GemChain[index].Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.GemChain[index].Width(), TextureAssets.GemChain[index].Height())), color, rotation, new Vector2((float) TextureAssets.GemChain[index].Width() * 0.5f, (float) TextureAssets.GemChain[index].Height() * 0.5f), 1f, SpriteEffects.None, 0); } } } else if (projectile1.type == 753) { Vector2 vector2 = new Vector2(projectile1.position.X + (float) projectile1.width * 0.5f, projectile1.position.Y + (float) projectile1.height * 0.5f); float num110 = mountedCenter.X - vector2.X; float num111 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num111, (double) num110) - 1.57f; bool flag = true; Texture2D texture2D = TextureAssets.Extra[95].Value; while (flag) { float f = (float) Math.Sqrt((double) num110 * (double) num110 + (double) num111 * (double) num111); if ((double) f < 25.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num112 = (float) texture2D.Height / f; float num113 = num110 * num112; float num114 = num111 * num112; vector2.X += num113; vector2.Y += num114; num110 = mountedCenter.X - vector2.X; num111 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.EntitySpriteDraw(texture2D, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(), color, rotation, texture2D.Size() / 2f, 1f, SpriteEffects.None, 0); } } } else if (projectile1.type == 865) { Vector2 vector2 = new Vector2(projectile1.position.X + (float) projectile1.width * 0.5f, projectile1.position.Y + (float) projectile1.height * 0.5f); float num115 = mountedCenter.X - vector2.X; float num116 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num116, (double) num115) - 1.57f; bool flag1 = true; bool flag2 = true; Texture2D texture2D = TextureAssets.Extra[154].Value; while (flag1) { float f = (float) Math.Sqrt((double) num115 * (double) num115 + (double) num116 * (double) num116); if ((double) f < 25.0) flag1 = false; else if (float.IsNaN(f)) { flag1 = false; } else { float num117 = (float) texture2D.Height / f; float num118 = num115 * num117; float num119 = num116 * num117; vector2.X += num118; vector2.Y += num119; num115 = mountedCenter.X - vector2.X; num116 = mountedCenter.Y - vector2.Y; if (!flag2) { Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.EntitySpriteDraw(texture2D, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(), color, rotation, texture2D.Size() / 2f, 1f, SpriteEffects.None, 0); } flag2 = false; } } } else if (projectile1.type == 935) { Vector2 vector2 = new Vector2(projectile1.position.X + (float) projectile1.width * 0.5f, projectile1.position.Y + (float) projectile1.height * 0.5f); float num120 = mountedCenter.X - vector2.X; float num121 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num121, (double) num120) - 1.57f; bool flag3 = true; bool flag4 = true; Texture2D texture2D = TextureAssets.Extra[208].Value; while (flag3) { float f = (float) Math.Sqrt((double) num120 * (double) num120 + (double) num121 * (double) num121); if ((double) f < 8.0) flag3 = false; else if (float.IsNaN(f)) { flag3 = false; } else { float num122 = (float) texture2D.Height / f; float num123 = num120 * num122; float num124 = num121 * num122; vector2.X += num123; vector2.Y += num124; num120 = mountedCenter.X - vector2.X; num121 = mountedCenter.Y - vector2.Y; if (!flag4) { Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.EntitySpriteDraw(texture2D, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(), color, rotation, texture2D.Size() / 2f, 1f, SpriteEffects.None, 0); } flag4 = false; } } } else if (projectile1.type == 256) { Vector2 vector2 = new Vector2(projectile1.position.X + (float) projectile1.width * 0.5f, projectile1.position.Y + (float) projectile1.height * 0.5f); float num125 = mountedCenter.X - vector2.X; float num126 = mountedCenter.Y - vector2.Y; float num127 = (float) Math.Atan2((double) num126, (double) num125) - 1.57f; bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num125 * (double) num125 + (double) num126 * (double) num126); if ((double) f < 26.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num128 = 26f / f; float num129 = num125 * num128; float num130 = num126 * num128; vector2.X += num129; vector2.Y += num130; num125 = Main.player[projectile1.owner].position.X + (float) (Main.player[projectile1.owner].width / 2) - vector2.X; num126 = Main.player[projectile1.owner].position.Y + (float) (Main.player[projectile1.owner].height / 2) - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.EntitySpriteDraw(TextureAssets.Chain20.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain20.Width(), TextureAssets.Chain20.Height())), color, num127 - 0.785f, new Vector2((float) TextureAssets.Chain20.Width() * 0.5f, (float) TextureAssets.Chain20.Height() * 0.5f), 1f, SpriteEffects.None, 0); } } } else if (projectile1.type == 322) { Vector2 vector2 = new Vector2(projectile1.position.X + (float) projectile1.width * 0.5f, projectile1.position.Y + (float) projectile1.height * 0.5f); float num131 = mountedCenter.X - vector2.X; float num132 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num132, (double) num131) - 1.57f; bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num131 * (double) num131 + (double) num132 * (double) num132); if ((double) f < 22.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num133 = 22f / f; float num134 = num131 * num133; float num135 = num132 * num133; vector2.X += num134; vector2.Y += num135; num131 = mountedCenter.X - vector2.X; num132 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.EntitySpriteDraw(TextureAssets.Chain29.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain29.Width(), TextureAssets.Chain29.Height())), color, rotation, new Vector2((float) TextureAssets.Chain29.Width() * 0.5f, (float) TextureAssets.Chain29.Height() * 0.5f), 1f, SpriteEffects.None, 0); } } } else if (projectile1.type == 315) { Vector2 vector2 = new Vector2(projectile1.position.X + (float) projectile1.width * 0.5f, projectile1.position.Y + (float) projectile1.height * 0.5f); float num136 = mountedCenter.X - vector2.X; float num137 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num137, (double) num136) - 1.57f; bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num136 * (double) num136 + (double) num137 * (double) num137); if ((double) f < 50.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num138 = 40f / f; float num139 = num136 * num138; float num140 = num137 * num138; vector2.X += num139; vector2.Y += num140; num136 = mountedCenter.X - vector2.X; num137 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.EntitySpriteDraw(TextureAssets.Chain28.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain28.Width(), TextureAssets.Chain28.Height())), color, rotation, new Vector2((float) TextureAssets.Chain28.Width() * 0.5f, (float) TextureAssets.Chain28.Height() * 0.5f), 1f, SpriteEffects.None, 0); } } } else if (projectile1.type == 331) { Vector2 vector2 = new Vector2(projectile1.position.X + (float) projectile1.width * 0.5f, projectile1.position.Y + (float) projectile1.height * 0.5f); float num141 = mountedCenter.X - vector2.X; float num142 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num142, (double) num141) - 1.57f; bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num141 * (double) num141 + (double) num142 * (double) num142); if ((double) f < 30.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num143 = 24f / f; float num144 = num141 * num143; float num145 = num142 * num143; vector2.X += num144; vector2.Y += num145; num141 = mountedCenter.X - vector2.X; num142 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.EntitySpriteDraw(TextureAssets.Chain30.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain30.Width(), TextureAssets.Chain30.Height())), color, rotation, new Vector2((float) TextureAssets.Chain30.Width() * 0.5f, (float) TextureAssets.Chain30.Height() * 0.5f), 1f, SpriteEffects.None, 0); } } } else if (projectile1.type == 332) { int num146 = 0; Vector2 vector2 = new Vector2(projectile1.position.X + (float) projectile1.width * 0.5f, projectile1.position.Y + (float) projectile1.height * 0.5f); float num147 = mountedCenter.X - vector2.X; float num148 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num148, (double) num147) - 1.57f; bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num147 * (double) num147 + (double) num148 * (double) num148); if ((double) f < 30.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { int i1 = (int) vector2.X / 16; int j = (int) vector2.Y / 16; if (num146 == 0) Lighting.AddLight(i1, j, 0.0f, 0.2f, 0.2f); if (num146 == 1) Lighting.AddLight(i1, j, 0.1f, 0.2f, 0.0f); if (num146 == 2) Lighting.AddLight(i1, j, 0.2f, 0.1f, 0.0f); if (num146 == 3) Lighting.AddLight(i1, j, 0.2f, 0.0f, 0.2f); float num149 = 16f / f; float num150 = num147 * num149; float num151 = num148 * num149; vector2.X += num150; vector2.Y += num151; num147 = mountedCenter.X - vector2.X; num148 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.EntitySpriteDraw(TextureAssets.Chain31.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, TextureAssets.Chain31.Height() / 4 * num146, TextureAssets.Chain31.Width(), TextureAssets.Chain31.Height() / 4)), color, rotation, new Vector2((float) TextureAssets.Chain30.Width() * 0.5f, (float) (TextureAssets.Chain30.Height() / 8)), 1f, SpriteEffects.None, 0); Main.EntitySpriteDraw(TextureAssets.Chain32.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, TextureAssets.Chain31.Height() / 4 * num146, TextureAssets.Chain31.Width(), TextureAssets.Chain31.Height() / 4)), new Microsoft.Xna.Framework.Color(200, 200, 200, 0), rotation, new Vector2((float) TextureAssets.Chain30.Width() * 0.5f, (float) (TextureAssets.Chain30.Height() / 8)), 1f, SpriteEffects.None, 0); ++num146; if (num146 > 3) num146 = 0; } } } else if (projectile1.type == 372 || projectile1.type == 383 || projectile1.type == 396 || projectile1.type == 403 || projectile1.type == 404 || projectile1.type == 446 || projectile1.type >= 486 && projectile1.type <= 489 || projectile1.type >= 646 && projectile1.type <= 649 || projectile1.type == 652) { Texture2D texture1 = (Texture2D) null; Microsoft.Xna.Framework.Color color8 = Microsoft.Xna.Framework.Color.Transparent; Texture2D texture2 = TextureAssets.Chain33.Value; if (projectile1.type == 383) texture2 = TextureAssets.Chain34.Value; if (projectile1.type == 396) texture2 = TextureAssets.Chain35.Value; if (projectile1.type == 403) texture2 = TextureAssets.Chain36.Value; if (projectile1.type == 404) texture2 = TextureAssets.Chain37.Value; if (projectile1.type == 446) texture2 = TextureAssets.Extra[3].Value; if (projectile1.type >= 486 && projectile1.type <= 489) texture2 = TextureAssets.Chains[projectile1.type - 486].Value; if (projectile1.type >= 646 && projectile1.type <= 649) { texture2 = TextureAssets.Chains[projectile1.type - 646 + 8].Value; texture1 = TextureAssets.Chains[projectile1.type - 646 + 12].Value; color8 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue); } if (projectile1.type == 652) texture2 = TextureAssets.Chains[16].Value; Vector2 position = projectile1.Center; Microsoft.Xna.Framework.Rectangle? sourceRectangle = new Microsoft.Xna.Framework.Rectangle?(); Vector2 origin = new Vector2((float) texture2.Width * 0.5f, (float) texture2.Height * 0.5f); float height = (float) texture2.Height; float num152 = 0.0f; if (projectile1.type == 446) { int num153 = 7; int num154 = (int) projectile1.localAI[0] / num153; sourceRectangle = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, texture2.Height / 4 * num154, texture2.Width, texture2.Height / 4)); origin.Y /= 4f; height /= 4f; } switch (projectile1.type) { case 383: num152 = 14f; break; case 446: num152 = 20f; break; case 487: num152 = 8f; break; case 489: num152 = 10f; break; } if ((double) num152 != 0.0) { float num155 = -1.57f; Vector2 vector2_1 = new Vector2((float) Math.Cos((double) projectile1.rotation + (double) num155), (float) Math.Sin((double) projectile1.rotation + (double) num155)); Vector2 vector2_2 = position - vector2_1 * num152; Vector2 vector2_3 = mountedCenter - vector2_2; vector2_3.Normalize(); position = vector2_2 - vector2_3 * height / 2f; } Vector2 vector2_4 = mountedCenter - position; float rotation = (float) Math.Atan2((double) vector2_4.Y, (double) vector2_4.X) - 1.57f; bool flag = true; if (float.IsNaN(position.X) && float.IsNaN(position.Y)) flag = false; if (float.IsNaN(vector2_4.X) && float.IsNaN(vector2_4.Y)) flag = false; while (flag) { if ((double) vector2_4.Length() < (double) height + 1.0) { flag = false; } else { Vector2 vector2_5 = vector2_4; vector2_5.Normalize(); position += vector2_5 * height; vector2_4 = mountedCenter - position; Microsoft.Xna.Framework.Color color9 = Lighting.GetColor((int) position.X / 16, (int) ((double) position.Y / 16.0)); if (projectile1.type == 396) color9 *= (float) ((int) byte.MaxValue - projectile1.alpha) / (float) byte.MaxValue; if (projectile1.type == 446) color9 = projectile1.GetAlpha(color9); if (projectile1.type == 488) { Lighting.AddLight(position, 0.2f, 0.0f, 0.175f); color9 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue); } if (projectile1.type >= 646 && projectile1.type <= 649) color9 = projectile1.GetAlpha(color9); Main.EntitySpriteDraw(texture2, position - Main.screenPosition, sourceRectangle, color9, rotation, origin, 1f, SpriteEffects.None, 0); if (texture1 != null) Main.EntitySpriteDraw(texture1, position - Main.screenPosition, sourceRectangle, color8, rotation, origin, 1f, SpriteEffects.None, 0); } } } else if (projectile1.aiStyle == 7) { Vector2 vector2 = new Vector2(projectile1.position.X + (float) projectile1.width * 0.5f, projectile1.position.Y + (float) projectile1.height * 0.5f); float num156 = mountedCenter.X - vector2.X; float num157 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num157, (double) num156) - 1.57f; bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num156 * (double) num156 + (double) num157 * (double) num157); if ((double) f < 25.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num158 = 12f / f; float num159 = num156 * num158; float num160 = num157 * num158; vector2.X += num159; vector2.Y += num160; num156 = mountedCenter.X - vector2.X; num157 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.EntitySpriteDraw(TextureAssets.Chain.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain.Width(), TextureAssets.Chain.Height())), color, rotation, new Vector2((float) TextureAssets.Chain.Width() * 0.5f, (float) TextureAssets.Chain.Height() * 0.5f), 1f, SpriteEffects.None, 0); } } } else if (projectile1.type == 262) { float x1 = projectile1.Center.X; float y1 = projectile1.Center.Y; float x2 = projectile1.velocity.X; float y2 = projectile1.velocity.Y; float num161 = 4f / (float) Math.Sqrt((double) x2 * (double) x2 + (double) y2 * (double) y2); float x3; float y3; if ((double) projectile1.ai[0] == 0.0) { x3 = x1 - projectile1.velocity.X * num161; y3 = y1 - projectile1.velocity.Y * num161; } else { x3 = x1 + projectile1.velocity.X * num161; y3 = y1 + projectile1.velocity.Y * num161; } Vector2 vector2 = new Vector2(x3, y3); float num162 = mountedCenter.X - vector2.X; float num163 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num163, (double) num162) - 1.57f; if (projectile1.alpha == 0) { int num164 = -1; if ((double) projectile1.position.X + (double) (projectile1.width / 2) < (double) mountedCenter.X) num164 = 1; Main.player[projectile1.owner].itemRotation = Main.player[projectile1.owner].direction != 1 ? (float) Math.Atan2((double) num163 * (double) num164, (double) num162 * (double) num164) : (float) Math.Atan2((double) num163 * (double) num164, (double) num162 * (double) num164); } bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num162 * (double) num162 + (double) num163 * (double) num163); if ((double) f < 25.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num165 = 12f / f; float num166 = num162 * num165; float num167 = num163 * num165; vector2.X += num166; vector2.Y += num167; num162 = mountedCenter.X - vector2.X; num163 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.EntitySpriteDraw(TextureAssets.Chain22.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain22.Width(), TextureAssets.Chain22.Height())), color, rotation, new Vector2((float) TextureAssets.Chain22.Width() * 0.5f, (float) TextureAssets.Chain22.Height() * 0.5f), 1f, SpriteEffects.None, 0); } } } else if (projectile1.type == 273) { float x4 = projectile1.Center.X; float y4 = projectile1.Center.Y; float x5 = projectile1.velocity.X; float y5 = projectile1.velocity.Y; float num168 = 4f / (float) Math.Sqrt((double) x5 * (double) x5 + (double) y5 * (double) y5); float x6; float y6; if ((double) projectile1.ai[0] == 0.0) { x6 = x4 - projectile1.velocity.X * num168; y6 = y4 - projectile1.velocity.Y * num168; } else { x6 = x4 + projectile1.velocity.X * num168; y6 = y4 + projectile1.velocity.Y * num168; } Vector2 vector2 = new Vector2(x6, y6); float num169 = mountedCenter.X - vector2.X; float num170 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num170, (double) num169) - 1.57f; if (projectile1.alpha == 0) { int num171 = -1; if ((double) projectile1.position.X + (double) (projectile1.width / 2) < (double) mountedCenter.X) num171 = 1; Main.player[projectile1.owner].itemRotation = Main.player[projectile1.owner].direction != 1 ? (float) Math.Atan2((double) num170 * (double) num171, (double) num169 * (double) num171) : (float) Math.Atan2((double) num170 * (double) num171, (double) num169 * (double) num171); } bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num169 * (double) num169 + (double) num170 * (double) num170); if ((double) f < 25.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num172 = 12f / f; float num173 = num169 * num172; float num174 = num170 * num172; vector2.X += num173; vector2.Y += num174; num169 = mountedCenter.X - vector2.X; num170 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.EntitySpriteDraw(TextureAssets.Chain23.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain23.Width(), TextureAssets.Chain23.Height())), color, rotation, new Vector2((float) TextureAssets.Chain23.Width() * 0.5f, (float) TextureAssets.Chain23.Height() * 0.5f), 1f, SpriteEffects.None, 0); } } } else if (projectile1.type == 481) { float x7 = projectile1.Center.X; float y7 = projectile1.Center.Y; float x8 = projectile1.velocity.X; float y8 = projectile1.velocity.Y; float num175 = 4f / (float) Math.Sqrt((double) x8 * (double) x8 + (double) y8 * (double) y8); float x9; float y9; if ((double) projectile1.ai[0] == 0.0) { x9 = x7 - projectile1.velocity.X * num175; y9 = y7 - projectile1.velocity.Y * num175; } else { x9 = x7 + projectile1.velocity.X * num175; y9 = y7 + projectile1.velocity.Y * num175; } Vector2 vector2 = new Vector2(x9, y9); float num176 = mountedCenter.X - vector2.X; float num177 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num177, (double) num176) - 1.57f; if (projectile1.alpha == 0) { int num178 = -1; if ((double) projectile1.position.X + (double) (projectile1.width / 2) < (double) mountedCenter.X) num178 = 1; Main.player[projectile1.owner].itemRotation = Main.player[projectile1.owner].direction != 1 ? (float) Math.Atan2((double) num177 * (double) num178, (double) num176 * (double) num178) : (float) Math.Atan2((double) num177 * (double) num178, (double) num176 * (double) num178); } bool flag = true; while (flag) { float scale = 0.85f; float f3 = (float) Math.Sqrt((double) num176 * (double) num176 + (double) num177 * (double) num177); float num179 = f3; if ((double) f3 < (double) TextureAssets.Chain40.Height() * 1.5) flag = false; else if (float.IsNaN(f3)) { flag = false; } else { float num180 = (float) TextureAssets.Chain40.Height() * scale / f3; float num181 = num176 * num180; float num182 = num177 * num180; vector2.X += num181; vector2.Y += num182; num176 = mountedCenter.X - vector2.X; num177 = mountedCenter.Y - vector2.Y; if ((double) num179 > (double) (TextureAssets.Chain40.Height() * 2)) { for (int index = 0; index < 2; ++index) { float num183 = 0.75f; float num184 = index != 0 ? Math.Abs(Main.player[projectile1.owner].velocity.Y) : Math.Abs(Main.player[projectile1.owner].velocity.X); if ((double) num184 > 10.0) num184 = 10f; float num185 = num184 / 10f; float num186 = num183 * num185; float num187 = num179 / 80f; if ((double) num187 > 1.0) num187 = 1f; float f4 = num186 * num187; if ((double) f4 < 0.0) f4 = 0.0f; if (!float.IsNaN(f4)) { if (index == 0) { if ((double) Main.player[projectile1.owner].velocity.X < 0.0 && (double) projectile1.Center.X < (double) mountedCenter.X) num177 *= 1f - f4; if ((double) Main.player[projectile1.owner].velocity.X > 0.0 && (double) projectile1.Center.X > (double) mountedCenter.X) num177 *= 1f - f4; } else { if ((double) Main.player[projectile1.owner].velocity.Y < 0.0 && (double) projectile1.Center.Y < (double) mountedCenter.Y) num176 *= 1f - f4; if ((double) Main.player[projectile1.owner].velocity.Y > 0.0 && (double) projectile1.Center.Y > (double) mountedCenter.Y) num176 *= 1f - f4; } } } } Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.EntitySpriteDraw(TextureAssets.Chain40.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain40.Width(), TextureAssets.Chain40.Height())), color, rotation, new Vector2((float) TextureAssets.Chain40.Width() * 0.5f, (float) TextureAssets.Chain40.Height() * 0.5f), scale, SpriteEffects.None, 0); } } } else if (projectile1.type == 271) { float x10 = projectile1.Center.X; float y10 = projectile1.Center.Y; float x11 = projectile1.velocity.X; float y11 = projectile1.velocity.Y; float num188 = 4f / (float) Math.Sqrt((double) x11 * (double) x11 + (double) y11 * (double) y11); float x12; float y12; if ((double) projectile1.ai[0] == 0.0) { x12 = x10 - projectile1.velocity.X * num188; y12 = y10 - projectile1.velocity.Y * num188; } else { x12 = x10 + projectile1.velocity.X * num188; y12 = y10 + projectile1.velocity.Y * num188; } Vector2 vector2 = new Vector2(x12, y12); float num189 = mountedCenter.X - vector2.X; float num190 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num190, (double) num189) - 1.57f; if (projectile1.alpha == 0) { int num191 = -1; if ((double) projectile1.position.X + (double) (projectile1.width / 2) < (double) mountedCenter.X) num191 = 1; Main.player[projectile1.owner].itemRotation = Main.player[projectile1.owner].direction != 1 ? (float) Math.Atan2((double) num190 * (double) num191, (double) num189 * (double) num191) : (float) Math.Atan2((double) num190 * (double) num191, (double) num189 * (double) num191); } bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num189 * (double) num189 + (double) num190 * (double) num190); if ((double) f < 25.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num192 = 12f / f; float num193 = num189 * num192; float num194 = num190 * num192; vector2.X += num193; vector2.Y += num194; num189 = mountedCenter.X - vector2.X; num190 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.EntitySpriteDraw(TextureAssets.Chain18.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain18.Width(), TextureAssets.Chain18.Height())), color, rotation, new Vector2((float) TextureAssets.Chain18.Width() * 0.5f, (float) TextureAssets.Chain18.Height() * 0.5f), 1f, SpriteEffects.None, 0); } } } else if (projectile1.aiStyle == 13) { float num195 = projectile1.position.X + 8f; float num196 = projectile1.position.Y + 2f; float x13 = projectile1.velocity.X; float num197 = projectile1.velocity.Y; if ((double) x13 == 0.0 && (double) num197 == 0.0) num197 = 0.0001f; float num198 = 20f / (float) Math.Sqrt((double) x13 * (double) x13 + (double) num197 * (double) num197); float x14; float y; if ((double) projectile1.ai[0] == 0.0) { x14 = num195 - projectile1.velocity.X * num198; y = num196 - projectile1.velocity.Y * num198; } else { x14 = num195 + projectile1.velocity.X * num198; y = num196 + projectile1.velocity.Y * num198; } Vector2 vector2 = new Vector2(x14, y); float num199 = mountedCenter.X - vector2.X; float num200 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num200, (double) num199) - 1.57f; if (projectile1.alpha == 0) { int num201 = -1; if ((double) projectile1.position.X + (double) (projectile1.width / 2) < (double) mountedCenter.X) num201 = 1; Main.player[projectile1.owner].itemRotation = Main.player[projectile1.owner].direction != 1 ? (float) Math.Atan2((double) num200 * (double) num201, (double) num199 * (double) num201) : (float) Math.Atan2((double) num200 * (double) num201, (double) num199 * (double) num201); } bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num199 * (double) num199 + (double) num200 * (double) num200); if ((double) f < 25.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num202 = 12f / f; float num203 = num199 * num202; float num204 = num200 * num202; vector2.X += num203; vector2.Y += num204; num199 = mountedCenter.X - vector2.X; num200 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.EntitySpriteDraw(TextureAssets.Chain.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chain.Width(), TextureAssets.Chain.Height())), color, rotation, new Vector2((float) TextureAssets.Chain.Width() * 0.5f, (float) TextureAssets.Chain.Height() * 0.5f), 1f, SpriteEffects.None, 0); } } } else if (projectile1.type == 190) { float x15 = projectile1.position.X + (float) (projectile1.width / 2); float y13 = projectile1.position.Y + (float) (projectile1.height / 2); float x16 = projectile1.velocity.X; float y14 = projectile1.velocity.Y; Math.Sqrt((double) x16 * (double) x16 + (double) y14 * (double) y14); Vector2 vector2 = new Vector2(x15, y13); float num205 = mountedCenter.X - vector2.X; float num206 = mountedCenter.Y + Main.player[projectile1.owner].gfxOffY - vector2.Y; Math.Atan2((double) num206, (double) num205); if (projectile1.alpha == 0) { int num207 = -1; if ((double) projectile1.position.X + (double) (projectile1.width / 2) < (double) mountedCenter.X) num207 = 1; Main.player[projectile1.owner].itemRotation = Main.player[projectile1.owner].direction != 1 ? (float) Math.Atan2((double) num206 * (double) num207, (double) num205 * (double) num207) : (float) Math.Atan2((double) num206 * (double) num207, (double) num205 * (double) num207); } } else if (projectile1.aiStyle == 15) Main.DrawProj_FlailChains(projectile1, mountedCenter); Microsoft.Xna.Framework.Color color10 = Lighting.GetColor((int) ((double) projectile1.position.X + (double) projectile1.width * 0.5) / 16, (int) (((double) projectile1.position.Y + (double) projectile1.height * 0.5) / 16.0)); if (projectile1.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile1.type]) color10 = Lighting.GetColor((int) mountedCenter.X / 16, (int) ((double) mountedCenter.Y / 16.0)); if (projectile1.type == 14) color10 = Microsoft.Xna.Framework.Color.White; int num208 = 0; int num209 = 0; if (projectile1.type == 175) num208 = 10; if (projectile1.type == 392) num208 = -2; if (projectile1.type == 499) num208 = 12; if (projectile1.type == 765) { num208 = 22; num209 = -16; } if (projectile1.bobber) num208 = 8; if (projectile1.type == 519) { num208 = 6; num209 -= 6; } if (projectile1.type == 520) num208 = 12; if (projectile1.type == 492) { num209 -= 4; num208 += 5; } if (projectile1.type == 498) num208 = 6; if (projectile1.type == 489) num208 = -2; if (projectile1.type == 486) num208 = -6; if (projectile1.type == 525) num208 = 5; if (projectile1.type == 488) num209 -= 8; if (projectile1.type == 373) { num209 = -10; num208 = 6; } if (projectile1.type == 375) { num209 = -11; num208 = 12; } if (projectile1.type == 423) num209 = -5; if (projectile1.type == 346) num208 = 4; if (projectile1.type == 331) num209 = -4; if (projectile1.type == 254) num208 = 3; if (projectile1.type == 273) num209 = 2; if (projectile1.type == 335) num208 = 6; if (projectile1.type == 162) { num208 = 1; num209 = 1; } if (projectile1.type == 377) num208 = -6; if (projectile1.type == 353) { num208 = 36; num209 = -12; } if (projectile1.type == 324) { num208 = 22; num209 = -6; } if (projectile1.type == 266) { num208 = 10; num209 = -10; } if (projectile1.type == 319) { num208 = 10; num209 = -12; } if (projectile1.type == 315) { num208 = -13; num209 = -6; } if (projectile1.type == 313 && projectile1.height != 54) { num209 = -12; num208 = 20; } if (projectile1.type == 314) { num209 = -8; num208 = 0; } if (projectile1.type == 269) { num208 = 18; num209 = -14; } if (projectile1.type == 268) { num208 = 22; num209 = -2; } if (projectile1.type == 18) { num208 = 3; num209 = 3; } if (projectile1.type == 16) num208 = 6; if (projectile1.type == 17 || projectile1.type == 31) num208 = 2; if (projectile1.type == 25 || projectile1.type == 26 || projectile1.type == 35 || projectile1.type == 63 || projectile1.type == 154) { num208 = 6; num209 -= 6; } if (projectile1.type == 947 || projectile1.type == 948) { num208 = 4; num209 -= 4; } if (projectile1.type == 28 || projectile1.type == 37 || projectile1.type == 75) num208 = 8; if (projectile1.type == 29 || projectile1.type == 470 || projectile1.type == 637) num208 = 11; if (projectile1.type == 43) num208 = 4; if (projectile1.type == 208) { num208 = 2; num209 -= 12; } if (projectile1.type == 209) { num208 = 4; num209 -= 8; } if (projectile1.type == 210) { num208 = 2; num209 -= 22; } if (projectile1.type == 251) { num208 = 18; num209 -= 10; } if (projectile1.type == 163 || projectile1.type == 310) num208 = 10; if (projectile1.type == 69 || projectile1.type == 70) { num208 = 4; num209 = 4; } float x17 = (float) ((double) (TextureAssets.Projectile[projectile1.type].Width() - projectile1.width) * 0.5 + (double) projectile1.width * 0.5); if (projectile1.type == 50 || projectile1.type == 53 || projectile1.type == 515 || projectile1.type == 870) num209 = -8; if (projectile1.type == 473) { num209 = -6; num208 = 2; } if (projectile1.type == 72 || projectile1.type == 86 || projectile1.type == 87) { num209 = -16; num208 = 8; } if (projectile1.type == 74) num209 = -6; if (projectile1.type == 138 || projectile1.type == 484) num208 = 1; if (projectile1.type == 655) num208 = 1; if (projectile1.type == 111) { num208 = 18; num209 = -16; } if (projectile1.type == 875) { num208 = 16; num209 = -16; } if (projectile1.type == 881) { num208 = 14; num209 = -8; } if (projectile1.type == 934) { num208 = 14; num209 = -20; } if (projectile1.type == 884) { num208 = 16; num209 = -12; } if (projectile1.type == 890) { num208 = 26; num209 = -9; } if (projectile1.type == 891) { num208 = 30; num209 = -12; } if (projectile1.type == 897) { num208 = 38; num209 = -13; } if (projectile1.type == 899) { num208 = 28; num209 = -12; } if (projectile1.type == 900) { num208 = 54; num209 = -30; } if (projectile1.type == 334) { num209 = -18; num208 = 8; } if (projectile1.type == 816) { num209 = -19; num208 = 6; } if (projectile1.type == 821) { num209 = -10; num208 = 6; } if (projectile1.type == 825) { num209 = -19; num208 = 14; } if (projectile1.type == 854) { num209 = -14; num208 = -4; } if (projectile1.type == 858) { num209 = -8; num208 = 16; } if (projectile1.type == 859) { num209 = -8; num208 = 8; } if (projectile1.type == 860) { num209 = -8; num208 = 34; } if (projectile1.type == 200) { num208 = 12; num209 = -12; } if (projectile1.type == 211) { num208 = 14; num209 = 0; } if (projectile1.type == 236) { num208 = 30; num209 = -14; } if (projectile1.type >= 191 && projectile1.type <= 194) { num208 = 26; num209 = projectile1.direction != 1 ? -22 : -10; } if (projectile1.type >= 390 && projectile1.type <= 392) num209 = 4 * projectile1.direction; if (projectile1.type == 112) num208 = 12; int type1 = projectile1.type; if (projectile1.type == 517 || projectile1.type == 681) num208 = 6; if (projectile1.type == 516) num208 = 6; if (projectile1.type == (int) sbyte.MaxValue) num208 = 8; if (projectile1.type == 155) { num208 = 3; num209 = 3; } if (projectile1.type == 397) { --x17; num208 = -2; num209 = -2; } if (projectile1.type == 398) num208 = 8; SpriteEffects spriteEffects = SpriteEffects.None; if (projectile1.spriteDirection == -1) spriteEffects = SpriteEffects.FlipHorizontally; if (projectile1.type == 681 && (double) projectile1.velocity.X > 0.0) spriteEffects ^= SpriteEffects.FlipHorizontally; if (projectile1.type == 221) { for (int index = 1; index < 10; ++index) { float num210 = (float) ((double) projectile1.velocity.X * (double) index * 0.5); float num211 = (float) ((double) projectile1.velocity.Y * (double) index * 0.5); Microsoft.Xna.Framework.Color alpha = projectile1.GetAlpha(color10); float num212 = 0.0f; if (index == 1) num212 = 0.9f; if (index == 2) num212 = 0.8f; if (index == 3) num212 = 0.7f; if (index == 4) num212 = 0.6f; if (index == 5) num212 = 0.5f; if (index == 6) num212 = 0.4f; if (index == 7) num212 = 0.3f; if (index == 8) num212 = 0.2f; if (index == 9) num212 = 0.1f; alpha.R = (byte) ((double) alpha.R * (double) num212); alpha.G = (byte) ((double) alpha.G * (double) num212); alpha.B = (byte) ((double) alpha.B * (double) num212); alpha.A = (byte) ((double) alpha.A * (double) num212); int height = TextureAssets.Projectile[projectile1.type].Height() / Main.projFrames[projectile1.type]; int y = height * projectile1.frame; Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, new Vector2(projectile1.position.X - Main.screenPosition.X + x17 + (float) num209 - num210, projectile1.position.Y - Main.screenPosition.Y + (float) (projectile1.height / 2) + projectile1.gfxOffY - num211), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, TextureAssets.Projectile[projectile1.type].Width(), height)), alpha, projectile1.rotation, new Vector2(x17, (float) (projectile1.height / 2 + num208)), projectile1.scale, spriteEffects, 0); } } if (projectile1.type == 408 || projectile1.type == 435 || projectile1.type == 436 || projectile1.type == 438 || projectile1.type == 452 || projectile1.type == 454 || projectile1.type == 459 || projectile1.type == 462 || projectile1.type == 503 || projectile1.type == 532 || projectile1.type == 533 || projectile1.type == 573 || projectile1.type == 582 || projectile1.type == 585 || projectile1.type == 592 || projectile1.type == 601 || projectile1.type == 636 || projectile1.type == 638 || projectile1.type == 640 || projectile1.type == 639 || projectile1.type == 424 || projectile1.type == 425 || projectile1.type == 426 || projectile1.type == 660 || projectile1.type == 661 || projectile1.type == 671 || projectile1.type == 664 || projectile1.type == 666 || projectile1.type == 668 || projectile1.type == 675 || projectile1.type == 680 || projectile1.type == 682 || projectile1.type == 684 || projectile1.type == 686 || projectile1.type == 700 || projectile1.type == 706 || projectile1.type == 709 || projectile1.type == 710 || projectile1.type == 711 || projectile1.type == 261 || ProjectileID.Sets.IsAGolfBall[projectile1.type] || projectile1.type == 729 || projectile1.type == 732 || projectile1.type == 731 || projectile1.type == 755 || projectile1.type == 811 || projectile1.type == 814 || projectile1.type == 819 || projectile1.type == 864 || projectile1.type == 873 || projectile1.type == 872 || projectile1.type == 833 || projectile1.type == 834 || projectile1.type == 835 || projectile1.type == 818 || projectile1.type == 902 || projectile1.type == 894 || projectile1.type == 901 || projectile1.type == 909 || projectile1.type == 916 || projectile1.type == 931 || projectile1.type == 933) { Texture2D texture2D1 = TextureAssets.Projectile[projectile1.type].Value; int height = TextureAssets.Projectile[projectile1.type].Height() / Main.projFrames[projectile1.type]; Microsoft.Xna.Framework.Rectangle r1 = new Microsoft.Xna.Framework.Rectangle(0, height * projectile1.frame, texture2D1.Width, height); Vector2 origin1 = r1.Size() / 2f; Vector2 zero = Vector2.Zero; float num213 = 0.0f; if (projectile1.type == 503) origin1.Y = 70f; if (projectile1.type == 686 || projectile1.type == 711) origin1.Y = (float) (r1.Height - 70); if (projectile1.type == 438) r1.Y = 0; if (projectile1.type == 452) r1.Y = 0; if (projectile1.type == 408) r1.Y = height; if (projectile1.type == 636) origin1.Y = 10f; if (projectile1.type == 638) origin1.Y = 2f; if (projectile1.type == 640 || projectile1.type == 639 || projectile1.type == 710) origin1.Y = 5f; if (projectile1.type == 700) origin1.X = projectile1.spriteDirection == 1 ? (float) (r1.Width - 20) : 20f; if (projectile1.type == 872) { r1.Width /= 2; origin1.X /= 2f; } if (projectile1.type == 933) { int index = (int) projectile1.ai[1]; if (TextureAssets.Item.IndexInRange>(index)) { Main.instance.LoadItem(index); texture2D1 = TextureAssets.Item[index].Value; r1 = texture2D1.Frame(); origin1 = r1.Size() / 2f; num213 = -0.7853982f * (float) projectile1.spriteDirection; } } if (projectile1.type == 833 && projectile1.frame != 8) { zero.Y += (float) (projectile1.height / 2); origin1 = r1.Size() * new Vector2(0.5f, 1f); origin1.Y -= 4f; origin1.X -= (float) (7 * spriteEffects.HasFlag((Enum) SpriteEffects.FlipHorizontally).ToDirectionInt()); } if ((projectile1.type == 834 || projectile1.type == 835) && projectile1.frame != 10) { zero.Y += (float) (projectile1.height / 2); origin1 = r1.Size() * new Vector2(0.5f, 1f); origin1.Y -= 4f; origin1.X -= (float) (2 * spriteEffects.HasFlag((Enum) SpriteEffects.FlipHorizontally).ToDirectionInt()); } int num214 = 8; int num215 = 2; int num216 = 1; float num217 = 1f; float num218 = 15f; float num219 = 0.0f; Microsoft.Xna.Framework.Rectangle rectangle1 = r1; UnifiedRandom r2 = (UnifiedRandom) null; if (projectile1.type == 503) { num214 = 9; num215 = 3; num217 = 0.5f; } else if (projectile1.type == 261) { num216 = 18; num214 = 0; num215 = -2; num217 = 1.3f; } else if (projectile1.type == 833 || projectile1.type == 834 || projectile1.type == 835) { num216 = 6; num214 = 0; num215 = -1; num217 = 1.5f; } else if (projectile1.type == 818) { num216 = 18; num214 = 0; num215 = -2; num217 = 1f; } else if (projectile1.type == 729) { num216 = 18; num214 = 0; num215 = -2; num217 = 1.3f; } else if (projectile1.type == 686 || projectile1.type == 711) { num216 = 19; num214 = 0; num215 = -3; num217 = 0.5f; } else if (ProjectileID.Sets.IsAGolfBall[projectile1.type]) { num216 = 0; num214 = 0; num215 = -1; num217 = 2f; } else if (projectile1.type == 671) { num216 = 5; num214 = 0; num215 = -1; num217 = 2.6f; } else if (projectile1.type == 811) { num216 = 5; num214 = 0; num215 = -1; num217 = 2.6f; } else if (projectile1.type == 814) { num216 = 18; num214 = 0; num215 = -1; num217 = 1f; } else if (projectile1.type == 755) { num216 = 5; num214 = 0; num215 = -1; num217 = 2.6f; } else if (projectile1.type == 700) { num214 = 5; num215 = 1; num217 = 2.6f; } else if (projectile1.type == 731) { num216 = 19; num214 = 0; num215 = -1; num217 = 0.5f; } else if (projectile1.type == 864) { num216 = 12; num214 = 0; num215 = -1; num217 = 1.4f; rectangle1.Y += rectangle1.Height; } else if (projectile1.type == 916) { num216 = 19; num214 = 0; num215 = -1; num217 = 1.4f; rectangle1.Y += rectangle1.Height; r2 = new UnifiedRandom(projectile1.timeLeft); } else if (projectile1.type == 873) { num216 = 39; num218 = 40f; num214 = 0; num215 = -1; num217 = 1.4f; } else if (projectile1.type == 931) { num216 = 19; num218 = 20f; num214 = 0; num215 = -1; num217 = 0.7f; } else if (projectile1.type == 933) { num216 = 60; num218 = 60f; num214 = 0; num215 = -15; num217 = 1f; } else if (projectile1.type == 872) { num216 = 79; num218 = 10f; num214 = 0; num215 = -1; num217 = 1f; rectangle1.X += rectangle1.Width; } else if (projectile1.type == 664 || projectile1.type == 666 || projectile1.type == 668) { num214 = 8; num215 = 2; num217 = 0.4f; } else if (projectile1.type == 582 || projectile1.type == 902) { num214 = 10; num215 = 2; num217 = 0.7f; num219 = 0.2f; } else if (projectile1.type == 675) { num214 = 5; num215 = 1; num217 = 0.4f; } else if (projectile1.type == 638) { num214 = 5; num215 = 1; num217 = 1f; } else if (projectile1.type == 660) { num214 = 3; num215 = 1; num217 = 8f; r1 = new Microsoft.Xna.Framework.Rectangle(38 * projectile1.frame, 0, 38, 38); rectangle1 = r1; origin1 = r1.Size() / 2f; } else if (projectile1.type == 684) { num214 = 8; num215 = 1; num217 = 0.75f; } else if (projectile1.type == 639) { num214 = 10; num215 = 1; num217 = 1f; } else if (projectile1.type == 710) { num216 = 9; num214 = 0; num215 = -2; num217 = 0.5f; } else if (projectile1.type == 640) { num214 = 20; num215 = 1; num217 = 1f; } else if (projectile1.type == 436) { num215 = 2; num217 = 0.5f; } else if (projectile1.type == 424 || projectile1.type == 425 || projectile1.type == 426) { num214 = 10; num215 = 2; num217 = 0.6f; } else if (projectile1.type == 438) { num214 = 10; num215 = 2; num217 = 1f; } else if (projectile1.type == 452) { num214 = 10; num215 = 3; num217 = 0.5f; } else if (projectile1.type == 454) { num214 = 5; num215 = 1; num217 = 0.2f; } else if (projectile1.type == 462) { num214 = 7; num215 = 1; num217 = 0.2f; } else if (projectile1.type == 661) { num214 = 0; num215 = 1; num217 = 0.5f; } else if (projectile1.type == 706) { num216 = 9; num214 = 0; num215 = -2; num217 = 0.5f; } else if (projectile1.type == 585) { num214 = 7; num215 = 1; num217 = 0.2f; } else if (projectile1.type == 459) { num214 = (int) ((double) projectile1.scale * 8.0); num215 = num214 / 4; if (num215 < 1) num215 = 1; num217 = 0.3f; } else if (projectile1.type == 709) { num214 = 8; num215 = num214 / 4; if (num215 < 1) num215 = 1; num217 = 0.5f; } else if (projectile1.type == 532) { num214 = 10; num215 = 1; num217 = 0.7f; num219 = 0.2f; } else if (projectile1.type == 592) { num214 = 10; num215 = 2; num217 = 1f; } else if (projectile1.type == 601) { num214 = 8; num215 = 1; num217 = 0.3f; } else if (projectile1.type == 636) { num214 = 20; num215 = 3; num217 = 0.5f; } else if (projectile1.type == 680) { num214 = 9; num215 = 3; num217 = 0.5f; } else if (projectile1.type == 533) { if ((double) projectile1.ai[0] >= 6.0 && (double) projectile1.ai[0] <= 8.0) { num214 = (double) projectile1.ai[0] == 6.0 ? 8 : 4; num215 = 1; if ((double) projectile1.ai[0] != 7.0) num219 = 0.2f; } else num214 = num215 = 0; } for (int index = num216; num215 > 0 && index < num214 || num215 < 0 && index > num214; index += num215) { if (index < projectile1.oldPos.Length) { Microsoft.Xna.Framework.Color color11 = color10; if (projectile1.type == 408 || projectile1.type == 435 || projectile1.type == 682 || projectile1.type == 732 || projectile1.type == 731) color11 = Microsoft.Xna.Framework.Color.Lerp(color11, Microsoft.Xna.Framework.Color.Blue, 0.5f); else if (projectile1.type == 436) color11 = Microsoft.Xna.Framework.Color.Lerp(color11, Microsoft.Xna.Framework.Color.LimeGreen, 0.5f); else if (projectile1.type >= 424 && projectile1.type <= 426) color11 = Microsoft.Xna.Framework.Color.Lerp(color11, Microsoft.Xna.Framework.Color.Red, 0.5f); else if (projectile1.type == 640 || projectile1.type == 639) color11.A = (byte) 127; else if (projectile1.type == 671) color11 = Microsoft.Xna.Framework.Color.Lerp(color11, Microsoft.Xna.Framework.Color.Purple, (float) index / (float) num214); else if (projectile1.type == 811) color11 = Microsoft.Xna.Framework.Color.Lerp(color11, Microsoft.Xna.Framework.Color.Crimson * 0.5f, (float) index / (float) num214); else if (projectile1.type == 814) color11 = Microsoft.Xna.Framework.Color.Lerp(color11, color11 * 0.5f, (float) index / (float) num214); else if (projectile1.type == 261) color11 = Microsoft.Xna.Framework.Color.Lerp(color11, new Microsoft.Xna.Framework.Color(60, 60, 60, 60), (float) index / (float) num214); else if (ProjectileID.Sets.IsAGolfBall[projectile1.type]) color11 = Microsoft.Xna.Framework.Color.Lerp(color11, new Microsoft.Xna.Framework.Color((int) byte.MaxValue, 230, 40, 20), (float) index / (float) num214); color11 = projectile1.GetAlpha(color11); if (projectile1.type == 438) { color11.G /= (byte) index; color11.B /= (byte) index; } else if (projectile1.type == 755) color11 = projectile1.AI_156_GetColor(); else if (projectile1.type == 873) { color11 = projectile1.AI_171_GetColor(); color11.A /= (byte) 2; color11 *= Utils.GetLerpValue(0.0f, 20f, (float) projectile1.timeLeft, true); } else if (projectile1.type == 931) { color11 = projectile1.GetFairyQueenWeaponsColor(0.5f); color11 *= Utils.GetLerpValue(0.0f, 20f, (float) projectile1.timeLeft, true); } else if (projectile1.type == 872) { color11 = projectile1.AI_173_GetColor(); color11 *= 0.4f; color11.A = (byte) ((double) color11.A * 0.600000023841858); if (index > 80) color11 *= 0.15f * Utils.GetLerpValue(120f, 80f, (float) index, true); } else if (projectile1.type == 864) { color11 = projectile1.GetFloatingDaggerMinionGlowColor(); color11.A /= (byte) 4; } else if (projectile1.type == 682) color11.G /= (byte) index; else if (projectile1.type == 686) { if (!(projectile1.oldPos[index] == Vector2.Zero)) { float t = (float) index / (float) num216; color11 = (double) t >= 0.5 ? Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Purple, Microsoft.Xna.Framework.Color.Black, Utils.GetLerpValue(0.5f, 1f, t, false)) : Microsoft.Xna.Framework.Color.Lerp(color11, Microsoft.Xna.Framework.Color.Purple, Utils.GetLerpValue(0.0f, 0.5f, t, false)); } else continue; } else if (projectile1.type == 711) { if (!(projectile1.oldPos[index] == Vector2.Zero)) { float t = (float) index / (float) num216; color11 = (double) t >= 0.5 ? Microsoft.Xna.Framework.Color.Lerp(new Microsoft.Xna.Framework.Color(128, 0, (int) byte.MaxValue, 180), Microsoft.Xna.Framework.Color.Black, Utils.GetLerpValue(0.5f, 1f, t, false)) : Microsoft.Xna.Framework.Color.Lerp(color11, new Microsoft.Xna.Framework.Color(128, 0, (int) byte.MaxValue, 180), Utils.GetLerpValue(0.0f, 0.5f, t, false)); } else continue; } else if (projectile1.type == 684) { if (index == 1) { color11.B /= (byte) 2; color11.G /= (byte) 2; color11.A /= (byte) 2; } color11.B /= (byte) index; color11.G /= (byte) index; color11.A /= (byte) index; } else if (projectile1.type == 706 || projectile1.type == 710) { color11.B /= (byte) index; color11.G /= (byte) index; color11.A /= (byte) index; } else if (projectile1.type == 818) { float to = 0.3f; float amount = Utils.GetLerpValue(0.0f, to, projectile1.ai[0], true) * Utils.GetLerpValue(1f, 1f - to, projectile1.ai[0], true); double lerpValue1 = (double) Utils.GetLerpValue(0.0f, (float) (num215 * -3), (float) index, true); double lerpValue2 = (double) Utils.GetLerpValue((float) num216, (float) (num216 + num215 * 3), (float) index, true); Microsoft.Xna.Framework.Color color12 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0); Microsoft.Xna.Framework.Color favoriteColor = Main.OurFavoriteColor; favoriteColor.A = (byte) 0; favoriteColor *= amount; color11 = Microsoft.Xna.Framework.Color.Lerp(favoriteColor, color12, amount); } else if (projectile1.type == 833 || projectile1.type == 834 || projectile1.type == 835) { float lerpValue = Utils.GetLerpValue(0.0f, 6f, projectile1.velocity.Length(), true); color11 = Microsoft.Xna.Framework.Color.Lerp(color11, Microsoft.Xna.Framework.Color.White, lerpValue * 0.5f); color11.A = (byte) 0; color11 *= lerpValue; } else if (projectile1.type == 592) { color11.R /= (byte) index; color11.G /= (byte) index; } else if (projectile1.type == 640) { color11.R /= (byte) index; color11.A /= (byte) index; } else if (projectile1.type >= 424 && projectile1.type <= 426) { color11.B /= (byte) index; color11.G /= (byte) index; color11.A /= (byte) index; } float t1 = (float) (num214 - index); if (num215 < 0) t1 = (float) (num216 - index); color11 *= t1 / ((float) ProjectileID.Sets.TrailCacheLength[projectile1.type] * 1.5f); Vector2 oldPo = projectile1.oldPos[index]; float rotation = projectile1.rotation; SpriteEffects effects = spriteEffects; if (ProjectileID.Sets.TrailingMode[projectile1.type] == 2 || ProjectileID.Sets.TrailingMode[projectile1.type] == 3 || ProjectileID.Sets.TrailingMode[projectile1.type] == 4) { rotation = projectile1.oldRot[index]; effects = projectile1.oldSpriteDirection[index] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; } if (!(oldPo == Vector2.Zero)) { if (projectile1.type == 916) { rectangle1.Y += rectangle1.Height; rectangle1.Y %= rectangle1.Height * Main.projFrames[projectile1.type]; double num220 = (double) t1 / ((double) ProjectileID.Sets.TrailCacheLength[projectile1.type] * 1.5); Microsoft.Xna.Framework.Color color13 = new Microsoft.Xna.Framework.Color(0, 0, 0, (int) byte.MaxValue); switch (r2.Next(3)) { case 1: case 2: color13 = Microsoft.Xna.Framework.Color.Lerp(new Microsoft.Xna.Framework.Color(106, 90, 205, (int) sbyte.MaxValue), Microsoft.Xna.Framework.Color.Black, (float) (0.200000002980232 + 0.800000011920929 * (double) r2.NextFloat())); break; } color11 = color13; float num221 = t1 / (float) ProjectileID.Sets.TrailCacheLength[projectile1.type]; float lerpValue = Utils.GetLerpValue(0.0f, (float) ProjectileID.Sets.TrailCacheLength[projectile1.type] * 0.75f, t1, true); color11 *= lerpValue; oldPo += r2.NextVector2Circular(8f, 8f); } if (projectile1.type == 933) { float t2 = projectile1.localAI[0] - (float) index; float num222 = Utils.GetLerpValue(0.0f, 20f, t2, true) * Utils.GetLerpValue(68f, 60f, t2, true); color11 = Microsoft.Xna.Framework.Color.White * Utils.GetLerpValue(0.0f, (float) ProjectileID.Sets.TrailCacheLength[projectile1.type], t1, true) * projectile1.Opacity * num222; } Vector2 position = oldPo + zero + projectile1.Size / 2f - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY); Main.EntitySpriteDraw(texture2D1, position, new Microsoft.Xna.Framework.Rectangle?(rectangle1), color11, (float) ((double) rotation + (double) num213 + (double) projectile1.rotation * (double) num219 * (double) (index - 1) * (double) -spriteEffects.HasFlag((Enum) SpriteEffects.FlipHorizontally).ToDirectionInt()), origin1, MathHelper.Lerp(projectile1.scale, num217, (float) index / num218), effects, 0); } } } if (projectile1.type == 661) { Microsoft.Xna.Framework.Color color14 = new Microsoft.Xna.Framework.Color(120, 40, 222, 120); for (int index = 0; index < 4; ++index) Main.EntitySpriteDraw(TextureAssets.Extra[75].Value, projectile1.Center - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY) + projectile1.rotation.ToRotationVector2().RotatedBy(1.57079637050629 * (double) index) * 4f, new Microsoft.Xna.Framework.Rectangle?(r1), color14, projectile1.rotation, origin1, projectile1.scale, spriteEffects, 0); } if (projectile1.type == 864) { Microsoft.Xna.Framework.Color daggerMinionGlowColor = projectile1.GetFloatingDaggerMinionGlowColor(); daggerMinionGlowColor.A /= (byte) 4; Microsoft.Xna.Framework.Rectangle rectangle2 = r1; rectangle2.Y += rectangle2.Height; for (int index = 0; index < 4; ++index) Main.EntitySpriteDraw(texture2D1, projectile1.Center - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY) + projectile1.rotation.ToRotationVector2().RotatedBy(1.57079637050629 * (double) index) * 2f, new Microsoft.Xna.Framework.Rectangle?(rectangle2), daggerMinionGlowColor, projectile1.rotation, origin1, projectile1.scale, spriteEffects, 0); } if (projectile1.type == 873 || projectile1.type == 931) { Microsoft.Xna.Framework.Color color15 = projectile1.AI_171_GetColor() * 0.5f; color15.A = (byte) 0; if (projectile1.type == 931) color15 = projectile1.GetFairyQueenWeaponsColor(0.0f); Vector2 position1 = projectile1.Center - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY); Main.EntitySpriteDraw(texture2D1, position1, new Microsoft.Xna.Framework.Rectangle?(r1), color15, projectile1.rotation, origin1, projectile1.scale * 0.9f, spriteEffects, 0); Texture2D texture2D2 = TextureAssets.Extra[98].Value; Microsoft.Xna.Framework.Color color16 = color15; Vector2 origin2 = texture2D2.Size() / 2f; Microsoft.Xna.Framework.Color color17 = color15 * 0.5f; float num223 = (float) ((double) Utils.GetLerpValue(15f, 30f, (float) projectile1.timeLeft, true) * (double) Utils.GetLerpValue(240f, 200f, (float) projectile1.timeLeft, true) * (1.0 + 0.200000002980232 * Math.Cos((double) Main.GlobalTimeWrappedHourly % 30.0 / 0.5 * 6.28318548202515 * 3.0)) * 0.800000011920929); Vector2 scale1 = new Vector2(0.5f, 5f) * num223; Vector2 scale2 = new Vector2(0.5f, 2f) * num223; Microsoft.Xna.Framework.Color color18 = color16 * num223; Microsoft.Xna.Framework.Color color19 = color17 * num223; int num224 = 0; Vector2 position2 = position1 + projectile1.velocity.SafeNormalize(Vector2.Zero) * MathHelper.Lerp(0.5f, 1f, projectile1.localAI[0] / 60f) * (float) num224; if (projectile1.type == 931) { scale1 *= 0.4f; scale2 *= 0.4f; } Main.EntitySpriteDraw(texture2D2, position2, new Microsoft.Xna.Framework.Rectangle?(), color18, 1.570796f, origin2, scale1, spriteEffects, 0); Main.EntitySpriteDraw(texture2D2, position2, new Microsoft.Xna.Framework.Rectangle?(), color18, 0.0f, origin2, scale2, spriteEffects, 0); Main.EntitySpriteDraw(texture2D2, position2, new Microsoft.Xna.Framework.Rectangle?(), color19, 1.570796f, origin2, scale1 * 0.6f, spriteEffects, 0); Main.EntitySpriteDraw(texture2D2, position2, new Microsoft.Xna.Framework.Rectangle?(), color19, 0.0f, origin2, scale2 * 0.6f, spriteEffects, 0); } if (projectile1.type == 755) { Microsoft.Xna.Framework.Color color20 = projectile1.AI_156_GetColor(); color20.A = (byte) 120; for (int index = 0; index < 4; ++index) Main.EntitySpriteDraw(texture2D1, projectile1.Center - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY) + projectile1.rotation.ToRotationVector2().RotatedBy(1.57079637050629 * (double) index) * 2f, new Microsoft.Xna.Framework.Rectangle?(r1), color20, projectile1.rotation, origin1, projectile1.scale, spriteEffects, 0); } else if (projectile1.type == 684) { float x18 = ((float) ((double) projectile1.localAI[0] * 6.28318548202515 / 30.0)).ToRotationVector2().X; Microsoft.Xna.Framework.Color color21 = new Microsoft.Xna.Framework.Color(220, 40, 30, 40); color21 *= (float) (0.75 + 0.25 * (double) x18); for (int index = 0; index < 8; ++index) Main.EntitySpriteDraw(texture2D1, projectile1.Center - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY) + projectile1.rotation.ToRotationVector2().RotatedBy(0.785398185253143 * (double) index) * (float) (4.0 + 1.0 * (double) x18), new Microsoft.Xna.Framework.Rectangle?(r1), color21, projectile1.rotation, origin1, projectile1.scale, spriteEffects, 0); } else if (ProjectileID.Sets.IsAGolfBall[projectile1.type]) { Player player = Main.player[projectile1.owner]; bool flag5 = GolfHelper.IsPlayerHoldingClub(player); bool flag6 = false; if (flag5) flag6 = (((flag6 ? 1 : 0) | (player.ownedProjectileCounts[722] <= 0 ? 0 : (player.itemAnimation >= player.itemAnimationMax ? 1 : 0))) != 0 | player.itemAnimation == 0) & (double) player.velocity.Y == 0.0; Vector2 shotVector = Main.MouseWorld - projectile1.Center; if (projectile1.owner == Main.myPlayer & flag5 & flag6 && GolfHelper.IsGolfBallResting(projectile1) && GolfHelper.ValidateShot((Entity) projectile1, player, ref shotVector)) { color10 = Microsoft.Xna.Framework.Color.White; Projectile golfHelper = (Projectile) null; for (int index = 0; index < 1000; ++index) { Projectile projectile2 = Main.projectile[index]; if (projectile2.active && projectile2.owner == player.whoAmI && projectile2.type == 722) { golfHelper = projectile2; break; } } if (golfHelper != null) { GolfHelper.ShotStrength shotStrength = GolfHelper.CalculateShotStrength(golfHelper, (Entity) projectile1); Vector2 impactVelocity = Vector2.Normalize(shotVector) * shotStrength.AbsoluteStrength; if ((double) impactVelocity.Length() > 0.0500000007450581) GolfHelper.DrawPredictionLine((Entity) projectile1, impactVelocity, shotStrength.RelativeStrength, shotStrength.RoughLandResistance); } } if (!GolfHelper.IsGolfBallResting(projectile1)) { Microsoft.Xna.Framework.Color golfTrailColor = Projectile.GetGolfTrailColor(projectile1); float num225 = projectile1.velocity.Length() / 16f; if ((double) num225 > 1.0) num225 = 1f; Microsoft.Xna.Framework.Color color22 = golfTrailColor * num225; if (projectile1.oldPos[4] != Vector2.Zero) { color10 = Microsoft.Xna.Framework.Color.White; for (float amount = 0.0f; (double) amount <= 1.0; amount += 0.04f) Main.EntitySpriteDraw(texture2D1, Vector2.Lerp(projectile1.oldPos[4], projectile1.position, amount) + projectile1.Size / 2f - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(r1), color22 * amount, projectile1.rotation, origin1, projectile1.scale * MathHelper.Lerp(0.7f, 1.5f, amount), spriteEffects, 0); } Main.EntitySpriteDraw(texture2D1, projectile1.position + projectile1.Size / 2f - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(r1), color22, projectile1.rotation, origin1, projectile1.scale * 1.5f, spriteEffects, 0); } } Microsoft.Xna.Framework.Color color23 = projectile1.GetAlpha(color10); float scale = projectile1.scale; float rotation1 = projectile1.rotation + num213; if (projectile1.type == 640) color23 = Microsoft.Xna.Framework.Color.Transparent; if (projectile1.type == 684) color23.A = (byte) 127; if (projectile1.type == 873) color23.A /= (byte) 2; if (projectile1.type == 931) color23.A /= (byte) 2; if (projectile1.type == 872) { color23 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0) * projectile1.Opacity; scale *= 0.9f; } if (projectile1.type == 818) color23 = Microsoft.Xna.Framework.Color.Transparent; if (projectile1.type == 916) color23 = Microsoft.Xna.Framework.Color.Black; if (projectile1.type == 933) { float t = projectile1.localAI[0]; float num226 = Utils.GetLerpValue(0.0f, 20f, t, true) * Utils.GetLerpValue(68f, 60f, t, true); color23 *= num226; } Main.EntitySpriteDraw(texture2D1, projectile1.Center + zero - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(r1), color23, rotation1, origin1, scale, spriteEffects, 0); if (projectile1.type == 894) { float num227 = Utils.WrappedLerp(0.6f, 1f, (float) ((int) Main.timeForVisualEffects % 70) / 70f); Microsoft.Xna.Framework.Color color24 = new Microsoft.Xna.Framework.Color(num227, num227, num227, 150f); Main.EntitySpriteDraw(TextureAssets.GlowMask[282].Value, projectile1.Center + zero - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(r1), color24, projectile1.rotation, origin1, projectile1.scale, spriteEffects, 0); } if (projectile1.type == 503) Main.EntitySpriteDraw(TextureAssets.Extra[36].Value, projectile1.Center - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(r1), Microsoft.Xna.Framework.Color.White, projectile1.localAI[0], origin1, projectile1.scale, spriteEffects, 0); else if (projectile1.type == 533) Main.EntitySpriteDraw(TextureAssets.GlowMask[128].Value, projectile1.Center - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(r1), Microsoft.Xna.Framework.Color.White * 0.3f, projectile1.rotation, origin1, projectile1.scale, spriteEffects, 0); else if (projectile1.type == 261) { float num228 = 0.7f; float t = projectile1.velocity.Length(); if ((double) t < 0.300000011920929 && (double) projectile1.velocity.Y == 0.0) num228 = Utils.GetLerpValue(0.02f, 0.3f, t, true) * 0.7f; Main.EntitySpriteDraw(TextureAssets.GlowMask[252].Value, projectile1.Center - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(r1), Microsoft.Xna.Framework.Color.White * num228, projectile1.rotation, origin1, projectile1.scale, spriteEffects, 0); } else if (projectile1.type == 601) { Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; white.A = (byte) 0; Main.EntitySpriteDraw(texture2D1, projectile1.Center - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(r1), white, projectile1.rotation, origin1, projectile1.scale * 0.7f, spriteEffects, 0); } else if (ProjectileID.Sets.IsAGolfBall[projectile1.type] && GolfHelper.IsGolfBallResting(projectile1) && GolfHelper.IsPlayerHoldingClub(Main.LocalPlayer) && GolfHelper.IsGolfShotValid((Entity) projectile1, Main.LocalPlayer) && projectile1.owner == Main.myPlayer) Main.EntitySpriteDraw(TextureAssets.GolfBallOutline.Value, projectile1.Center - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(r1), Microsoft.Xna.Framework.Color.White, projectile1.rotation, origin1, projectile1.scale, spriteEffects, 0); if (projectile1.type != 933) return; float t3 = projectile1.localAI[0]; float num229 = Utils.GetLerpValue(0.0f, 20f, t3, true) * Utils.GetLerpValue(68f, 60f, t3, true); Main.EntitySpriteDraw(texture2D1, projectile1.Center + zero - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(r1), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue) * projectile1.Opacity * num229, rotation1, origin1, scale * 1.25f, spriteEffects, 0); FinalFractalHelper.FinalFractalProfile finalFractalProfile = FinalFractalHelper.GetFinalFractalProfile((int) projectile1.ai[1]); Microsoft.Xna.Framework.Color trailColor = finalFractalProfile.trailColor; trailColor.A /= (byte) 2; Main.DrawPrettyStarSparkle(projectile1, spriteEffects, projectile1.Center + zero - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY) + (projectile1.rotation - 1.570796f).ToRotationVector2() * finalFractalProfile.trailWidth, Microsoft.Xna.Framework.Color.White * num229, trailColor * num229); } else if (projectile1.type == 672) { Vector2 position = projectile1.Center - Main.screenPosition; if ((double) projectile1.localAI[1] == 0.0) { position.Y += 60f; float num230 = projectile1.localAI[0] / 120f; for (int index = 0; index < 4; ++index) { float num231 = MathHelper.Clamp((float) ((double) num230 * 2.0 - (double) index / 3.0), 0.0f, 1f); float num232 = 1f - MathHelper.Clamp((float) (((double) num230 - 0.800000011920929) / 0.200000002980232), 0.0f, 1f); Main.EntitySpriteDraw(TextureAssets.MagicPixel.Value, position, new Microsoft.Xna.Framework.Rectangle?(), new Microsoft.Xna.Framework.Color(0.4f, 0.17f, 0.4f, 0.0f) * (num231 * num232) * 1.3f, 0.0f, new Vector2((float) TextureAssets.MagicPixel.Width() / 2f, (float) TextureAssets.MagicPixel.Height()), new Vector2((float) Math.Sqrt((double) num231) * 100f, num231 * 2f), SpriteEffects.None, 0); } } else if ((double) projectile1.localAI[1] == 1.0) { double num233 = (double) projectile1.localAI[0] / 300.0; float num234 = Math.Min(1f, projectile1.localAI[0] / 30f); int frameNumber = (int) ((double) Main.GlobalTimeWrappedHourly * 10.0) % 8; this.DrawElderEye(Main.spriteBatch, projectile1.Center, 1f, 1f, frameNumber, Microsoft.Xna.Framework.Color.White * num234); this.DrawElderEye(Main.spriteBatch, projectile1.Center, 1f, 1f, (frameNumber + 1) % 8, new Microsoft.Xna.Framework.Color(0.2f, 0.2f, 0.2f, 0.0f) * num234); } else { if ((double) projectile1.localAI[1] != 2.0) return; int frameNumber = (int) ((double) Main.GlobalTimeWrappedHourly * 10.0) % 8; this.DrawElderEye(Main.spriteBatch, projectile1.Center, 1f, 1f, frameNumber, Microsoft.Xna.Framework.Color.White); this.DrawElderEye(Main.spriteBatch, projectile1.Center, 1f, 1f, (frameNumber + 1) % 8, new Microsoft.Xna.Framework.Color(0.2f, 0.2f, 0.2f, 0.0f)); } } else { if (projectile1.type == 713) return; if (projectile1.type == 754) { Texture2D texture2D = TextureAssets.Projectile[projectile1.type].Value; Microsoft.Xna.Framework.Rectangle rectangle3 = texture2D.Frame(5, 2, projectile1.frame); rectangle3.Width -= 2; rectangle3.Height -= 2; Vector2 origin = new Vector2((float) (rectangle3.Width / 2), 0.0f); float y = projectile1.position.Y; float num235 = (float) ((double) projectile1.ai[0] + 8.0 + 2.0 - (double) rectangle3.Height + 2.0); projectile1.GetAlpha(color10); Vector2 top = projectile1.Top; if ((double) projectile1.ai[1] == 2.0) { Microsoft.Xna.Framework.Rectangle rectangle4 = texture2D.Frame(5, 2, 4); rectangle4.Width -= 2; rectangle4.Height -= 2; origin = new Vector2((float) (rectangle4.Width / 2), 0.0f); Microsoft.Xna.Framework.Color alpha = projectile1.GetAlpha(Lighting.GetColor((int) ((double) top.X + (double) (rectangle4.Width / 2)) / 16, (int) (((double) num235 - 2.0 + (double) (rectangle4.Height / 2)) / 16.0))); Main.EntitySpriteDraw(texture2D, new Vector2(top.X, num235 - 2f) - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle4), alpha, projectile1.rotation, origin, projectile1.scale, spriteEffects, 0); } else { for (float num236 = y; (double) num236 < (double) num235; num236 += (float) rectangle3.Height) { Vector2 vector2 = top; vector2.Y = num236; Microsoft.Xna.Framework.Rectangle rectangle5 = rectangle3; float num237 = num235 - num236; if ((double) num237 < (double) rectangle5.Height) rectangle5.Height = (int) num237; Microsoft.Xna.Framework.Color alpha = projectile1.GetAlpha(Lighting.GetColor((int) ((double) vector2.X + (double) (rectangle5.Width / 2)) / 16, (int) (((double) vector2.Y + (double) (rectangle5.Height / 2)) / 16.0))); Main.EntitySpriteDraw(texture2D, vector2 - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle5), alpha, projectile1.rotation, origin, projectile1.scale, spriteEffects, 0); if (rectangle3.Y == 0) rectangle3.Y += rectangle3.Height + 2; } Microsoft.Xna.Framework.Rectangle rectangle6 = texture2D.Frame(5, 2, 4); rectangle6.Width -= 2; rectangle6.Height -= 2; origin = new Vector2((float) (rectangle6.Width / 2), 0.0f); Microsoft.Xna.Framework.Color alpha1 = projectile1.GetAlpha(Lighting.GetColor((int) ((double) top.X + (double) (rectangle6.Width / 2)) / 16, (int) (((double) num235 - 2.0 + (double) (rectangle6.Height / 2)) / 16.0))); Main.EntitySpriteDraw(texture2D, new Vector2(top.X, num235 - 2f) - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle6), alpha1, projectile1.rotation, origin, projectile1.scale, spriteEffects, 0); } } else if (projectile1.type == 12 || projectile1.type == 728) { Texture2D texture = TextureAssets.Projectile[projectile1.type].Value; Microsoft.Xna.Framework.Rectangle r = new Microsoft.Xna.Framework.Rectangle(0, 0, texture.Width, texture.Height); Vector2 origin3 = r.Size() / 2f; Microsoft.Xna.Framework.Color alpha = projectile1.GetAlpha(color10); Texture2D texture2D = TextureAssets.Extra[91].Value; Microsoft.Xna.Framework.Rectangle rectangle = texture2D.Frame(); Vector2 origin4 = new Vector2((float) rectangle.Width / 2f, 10f); Microsoft.Xna.Framework.Color color25 = Microsoft.Xna.Framework.Color.Cyan * 0.5f; Vector2 vector2_6 = new Vector2(0.0f, projectile1.gfxOffY); Vector2 spinningpoint = new Vector2(0.0f, -10f); float num238 = (float) Main.timeForVisualEffects / 60f; Vector2 vector2_7 = projectile1.Center + projectile1.velocity; Microsoft.Xna.Framework.Color color26 = Microsoft.Xna.Framework.Color.Blue * 0.2f; Microsoft.Xna.Framework.Color color27 = Microsoft.Xna.Framework.Color.White * 0.5f; color27.A = (byte) 0; float num239 = 0.0f; if (projectile1.type == 728) { color26 = Microsoft.Xna.Framework.Color.Orange * 0.2f; color27 = Microsoft.Xna.Framework.Color.Gold * 0.5f; color27.A = (byte) 50; num239 = -0.2f; } Microsoft.Xna.Framework.Color color28 = color26; color28.A = (byte) 0; Microsoft.Xna.Framework.Color color29 = color26; color29.A = (byte) 0; Microsoft.Xna.Framework.Color color30 = color26; color30.A = (byte) 0; Main.EntitySpriteDraw(texture2D, vector2_7 - Main.screenPosition + vector2_6 + spinningpoint.RotatedBy(6.28318548202515 * (double) num238), new Microsoft.Xna.Framework.Rectangle?(rectangle), color28, projectile1.velocity.ToRotation() + 1.570796f, origin4, 1.5f + num239, SpriteEffects.None, 0); Main.EntitySpriteDraw(texture2D, vector2_7 - Main.screenPosition + vector2_6 + spinningpoint.RotatedBy(6.28318548202515 * (double) num238 + 2.09439516067505), new Microsoft.Xna.Framework.Rectangle?(rectangle), color29, projectile1.velocity.ToRotation() + 1.570796f, origin4, 1.1f + num239, SpriteEffects.None, 0); Main.EntitySpriteDraw(texture2D, vector2_7 - Main.screenPosition + vector2_6 + spinningpoint.RotatedBy(6.28318548202515 * (double) num238 + 4.1887903213501), new Microsoft.Xna.Framework.Rectangle?(rectangle), color30, projectile1.velocity.ToRotation() + 1.570796f, origin4, 1.3f + num239, SpriteEffects.None, 0); Vector2 vector2_8 = projectile1.Center - projectile1.velocity * 0.5f; for (float num240 = 0.0f; (double) num240 < 1.0; num240 += 0.5f) { float num241 = (float) (((double) num238 % 0.5 / 0.5 + (double) num240) % 1.0); float num242 = num241 * 2f; if ((double) num242 > 1.0) num242 = 2f - num242; Main.EntitySpriteDraw(texture2D, vector2_8 - Main.screenPosition + vector2_6, new Microsoft.Xna.Framework.Rectangle?(rectangle), color27 * num242, projectile1.velocity.ToRotation() + 1.570796f, origin4, (float) (0.300000011920929 + (double) num241 * 0.5), SpriteEffects.None, 0); } Main.EntitySpriteDraw(texture, projectile1.Center - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(r), alpha, projectile1.rotation, origin3, projectile1.scale + 0.1f, spriteEffects, 0); } else if (projectile1.type == 756) { Texture2D texture2D = TextureAssets.Projectile[projectile1.type].Value; Microsoft.Xna.Framework.Rectangle rectangle = texture2D.Frame(verticalFrames: 6, frameY: projectile1.frame); Vector2 origin = new Vector2(16f, (float) (rectangle.Height / 2)); Microsoft.Xna.Framework.Color alpha = projectile1.GetAlpha(color10); Vector2 scale = new Vector2(projectile1.scale); float lerpValue = Utils.GetLerpValue(30f, 25f, projectile1.ai[0], true); scale.Y *= lerpValue; Vector4 vector4_1 = color10.ToVector4(); Vector4 vector4_2 = new Microsoft.Xna.Framework.Color(67, 17, 17).ToVector4() * vector4_1; Main.EntitySpriteDraw(TextureAssets.Extra[98].Value, projectile1.Center - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY) - projectile1.velocity * projectile1.scale * 0.5f, new Microsoft.Xna.Framework.Rectangle?(), projectile1.GetAlpha(new Microsoft.Xna.Framework.Color(vector4_2.X, vector4_2.Y, vector4_2.Z, vector4_2.W)) * 1f, projectile1.rotation + 1.570796f, TextureAssets.Extra[98].Value.Size() / 2f, projectile1.scale * 0.9f, spriteEffects, 0); Main.EntitySpriteDraw(texture2D, projectile1.Center - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(rectangle), alpha, projectile1.rotation, origin, scale, spriteEffects, 0); } else if (projectile1.type == 723 || projectile1.type == 726 || projectile1.type == 725 || projectile1.type == 724) { Texture2D texture = TextureAssets.Projectile[projectile1.type].Value; Microsoft.Xna.Framework.Rectangle r = new Microsoft.Xna.Framework.Rectangle(0, 0, texture.Width, texture.Height); Vector2 origin5 = r.Size() / 2f; Microsoft.Xna.Framework.Color alpha = projectile1.GetAlpha(color10); Texture2D texture2D = TextureAssets.Extra[91].Value; Microsoft.Xna.Framework.Rectangle rectangle = texture2D.Frame(); Vector2 origin6 = new Vector2((float) rectangle.Width / 2f, 10f); Microsoft.Xna.Framework.Color color31 = Microsoft.Xna.Framework.Color.White * 0.2f; Vector2 vector2_9 = new Vector2(0.0f, projectile1.gfxOffY); Vector2 spinningpoint = new Vector2(0.0f, -5f); float num243 = (float) Main.timeForVisualEffects / 60f; Vector2 vector2_10 = projectile1.Center + projectile1.velocity; float scale3 = 1.5f; float scale4 = 1.1f; float scale5 = 1.3f; Microsoft.Xna.Framework.Color color32 = Microsoft.Xna.Framework.Color.Blue * 0.1f; Microsoft.Xna.Framework.Color color33 = Microsoft.Xna.Framework.Color.White * 0.3f; color33.A = (byte) 0; byte num244 = 0; if (projectile1.type == 726) { Microsoft.Xna.Framework.Color color34 = new Microsoft.Xna.Framework.Color(180, 20, (int) byte.MaxValue); color32 = color34 * 0.3f; color33 = color34 * 0.3f; num244 = (byte) 60; float num245 = 0.6f; scale3 -= num245; scale4 -= num245; scale5 -= num245; } if (projectile1.type == 725) { Microsoft.Xna.Framework.Color color35 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, 80, (int) byte.MaxValue); Microsoft.Xna.Framework.Color color36 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, 0); color32 = Microsoft.Xna.Framework.Color.Lerp(color35, color36, 0.2f) * 0.3f; color33 = Microsoft.Xna.Framework.Color.Lerp(color35, color36, 0.8f) * 0.4f; num244 = (byte) 50; float num246 = 0.5f; scale3 -= num246; scale4 -= num246; scale5 -= num246; } if (projectile1.type == 724) { Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Black, Microsoft.Xna.Framework.Color.Orange, 0.75f); Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Black, Microsoft.Xna.Framework.Color.Yellow, 0.5f); Microsoft.Xna.Framework.Color color37 = Microsoft.Xna.Framework.Color.Orange * 0.75f; Microsoft.Xna.Framework.Color color38 = Microsoft.Xna.Framework.Color.Yellow * 0.5f; color32 = Microsoft.Xna.Framework.Color.Lerp(color37, color38, 0.2f) * 0.3f; color33 = Microsoft.Xna.Framework.Color.Lerp(color37, color38, 0.8f) * 0.4f; num244 = (byte) 0; float num247 = 0.5f; scale3 -= num247; scale4 -= num247; scale5 -= num247; } Microsoft.Xna.Framework.Color color39 = color32; color39.A = num244; Microsoft.Xna.Framework.Color color40 = color32; color40.A = num244; Microsoft.Xna.Framework.Color color41 = color32; color41.A = num244; Main.EntitySpriteDraw(texture2D, vector2_10 - Main.screenPosition + vector2_9 + spinningpoint.RotatedBy(6.28318548202515 * (double) num243), new Microsoft.Xna.Framework.Rectangle?(rectangle), color39, projectile1.velocity.ToRotation() + 1.570796f, origin6, scale3, SpriteEffects.None, 0); Main.EntitySpriteDraw(texture2D, vector2_10 - Main.screenPosition + vector2_9 + spinningpoint.RotatedBy(6.28318548202515 * (double) num243 + 2.09439516067505), new Microsoft.Xna.Framework.Rectangle?(rectangle), color40, projectile1.velocity.ToRotation() + 1.570796f, origin6, scale4, SpriteEffects.None, 0); Main.EntitySpriteDraw(texture2D, vector2_10 - Main.screenPosition + vector2_9 + spinningpoint.RotatedBy(6.28318548202515 * (double) num243 + 4.1887903213501), new Microsoft.Xna.Framework.Rectangle?(rectangle), color41, projectile1.velocity.ToRotation() + 1.570796f, origin6, scale5, SpriteEffects.None, 0); Vector2 vector2_11 = projectile1.Center - projectile1.velocity * 0.5f; for (float num248 = 0.0f; (double) num248 < 1.0; num248 += 0.5f) { float num249 = (float) (((double) num243 % 0.5 / 0.5 + (double) num248) % 1.0); float num250 = num249 * 2f; if ((double) num250 > 1.0) num250 = 2f - num250; Main.EntitySpriteDraw(texture2D, vector2_11 - Main.screenPosition + vector2_9, new Microsoft.Xna.Framework.Rectangle?(rectangle), color33 * num250, projectile1.velocity.ToRotation() + 1.570796f, origin6, (float) (0.5 + (double) num249 * 0.5), SpriteEffects.None, 0); } Main.EntitySpriteDraw(texture, projectile1.Center - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(r), alpha, projectile1.rotation, origin5, projectile1.scale + 0.1f, spriteEffects, 0); } else if (projectile1.type == 674) { Texture2D texture = TextureAssets.Extra[60].Value; Vector2 origin = new Vector2(66f, 86f); Vector2 position = projectile1.Center - Main.screenPosition; Vector2 one = Vector2.One; Vector2 vector2_12 = new Vector2(4f, 1f) * 1.4f; Microsoft.Xna.Framework.Color color42 = new Microsoft.Xna.Framework.Color(115, 0, 155, 0); Microsoft.Xna.Framework.Color color43 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, 180, (int) byte.MaxValue, 0); float t = 0.0f; if ((double) projectile1.ai[0] < 30.0) t = Utils.GetLerpValue(0.0f, 30f, projectile1.ai[0], true); else if ((double) projectile1.ai[0] < 40.0) t = 1f + Utils.GetLerpValue(30f, 40f, projectile1.ai[0], true); Vector2 vector2_13 = new Vector2(1f, 1f); Vector2 vector2_14 = new Vector2(0.8f, 2f); if ((double) t < 1.0) vector2_13.X *= t; Vector2 vector2_15 = vector2_12 * t; if ((double) t < 1.0) { color42 *= t; color43 *= t; } if ((double) t > 1.5) { float lerpValue = Utils.GetLerpValue(2f, 1.5f, t, true); color42 *= lerpValue; color43 *= lerpValue; } float num251 = 0.42f; Microsoft.Xna.Framework.Color color44 = color42 * num251; Microsoft.Xna.Framework.Color color45 = color43 * num251; Main.EntitySpriteDraw(texture, position, new Microsoft.Xna.Framework.Rectangle?(), color44, 0.0f, origin, vector2_15 * vector2_13, SpriteEffects.None, 0); Main.EntitySpriteDraw(texture, position, new Microsoft.Xna.Framework.Rectangle?(), color45, 0.0f, origin, vector2_15 * vector2_14, SpriteEffects.None, 0); Main.EntitySpriteDraw(TextureAssets.Extra[59].Value, position, new Microsoft.Xna.Framework.Rectangle?(), color44, 0.0f, origin, vector2_15 * vector2_13 * new Vector2(1f, 0.3f), SpriteEffects.None, 0); } else if (projectile1.type == 440 || projectile1.type == 449 || projectile1.type == 606) { Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) Main.screenPosition.X - 500, (int) Main.screenPosition.Y - 500, Main.screenWidth + 1000, Main.screenHeight + 1000); if (!projectile1.getRect().Intersects(rectangle)) return; Vector2 vector2_16 = new Vector2(projectile1.position.X - Main.screenPosition.X + x17 + (float) num209, projectile1.position.Y - Main.screenPosition.Y + (float) (projectile1.height / 2) + projectile1.gfxOffY); float num252 = 100f; float num253 = 3f; if (projectile1.type == 606) { num252 = 150f; num253 = 3f; } if ((double) projectile1.ai[1] == 1.0) num252 = (float) (int) projectile1.localAI[0]; for (int index = 1; index <= (int) projectile1.localAI[0]; ++index) { Vector2 vector2_17 = Vector2.Normalize(projectile1.velocity) * (float) index * num253; Microsoft.Xna.Framework.Color color46 = projectile1.GetAlpha(color10) * ((num252 - (float) index) / num252); color46.A = (byte) 0; Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, vector2_16 - vector2_17, new Microsoft.Xna.Framework.Rectangle?(), color46, projectile1.rotation, new Vector2(x17, (float) (projectile1.height / 2 + num208)), projectile1.scale, spriteEffects, 0); } } else if (projectile1.type == 687) { Vector2 vector2_18 = projectile1.Center - Main.screenPosition; float num254 = 40f; float num255 = num254 * 2f; float num256 = (float) projectile1.frameCounter / num254; Texture2D texture2D = TextureAssets.Projectile[projectile1.type].Value; Microsoft.Xna.Framework.Color transparent = Microsoft.Xna.Framework.Color.Transparent; Microsoft.Xna.Framework.Color color47 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0); Microsoft.Xna.Framework.Color color48 = new Microsoft.Xna.Framework.Color(180, 30, 30, 200); Microsoft.Xna.Framework.Color color49 = new Microsoft.Xna.Framework.Color(0, 0, 0, 30); ulong seed = 1; for (float num257 = 0.0f; (double) num257 < 15.0; ++num257) { float num258 = (float) ((double) Utils.RandomFloat(ref seed) * 0.25 - 0.125); Vector2 rotationVector2 = (projectile1.rotation + num258).ToRotationVector2(); Vector2 vector2_19 = vector2_18 + rotationVector2 * 400f; float num259 = num256 + num257 * 0.06666667f; int num260 = (int) ((double) num259 / 0.0666666701436043); float num261 = num259 % 1f; if (((double) num261 <= (double) num256 % 1.0 || (double) projectile1.frameCounter >= (double) num254) && ((double) num261 >= (double) num256 % 1.0 || (double) projectile1.frameCounter < (double) num255 - (double) num254)) { Microsoft.Xna.Framework.Color color50 = (double) num261 >= 0.100000001490116 ? ((double) num261 >= 0.349999994039536 ? ((double) num261 >= 0.699999988079071 ? ((double) num261 >= 0.899999976158142 ? ((double) num261 >= 1.0 ? Microsoft.Xna.Framework.Color.Transparent : Microsoft.Xna.Framework.Color.Lerp(color49, Microsoft.Xna.Framework.Color.Transparent, Utils.GetLerpValue(0.9f, 1f, num261, true))) : Microsoft.Xna.Framework.Color.Lerp(color48, color49, Utils.GetLerpValue(0.7f, 0.9f, num261, true))) : Microsoft.Xna.Framework.Color.Lerp(color47, color48, Utils.GetLerpValue(0.35f, 0.7f, num261, true))) : color47) : Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, color47, Utils.GetLerpValue(0.0f, 0.1f, num261, true)); float num262 = (float) (0.899999976158142 + (double) num261 * 0.800000011920929); float scale = num262 * num262 * 0.8f; Vector2 position = Vector2.SmoothStep(vector2_18, vector2_19, num261); Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: 7, frameY: ((int) ((double) num261 * 7.0))); Main.EntitySpriteDraw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(r), color50, (float) ((double) projectile1.rotation + 6.28318548202515 * ((double) num261 + (double) Main.GlobalTimeWrappedHourly * 1.20000004768372) * 0.200000002980232 + (double) num260 * 1.25663709640503), r.Size() / 2f, scale, SpriteEffects.None, 0); } } } else if (projectile1.type == 651) { if (projectile1.owner != Main.myPlayer) return; Player player = Main.player[projectile1.owner]; Microsoft.Xna.Framework.Point point = new Vector2(projectile1.ai[0], projectile1.ai[1]).ToPoint(); Microsoft.Xna.Framework.Point tileCoordinates = projectile1.Center.ToTileCoordinates(); Microsoft.Xna.Framework.Color color51 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0); Microsoft.Xna.Framework.Color color52 = new Microsoft.Xna.Framework.Color((int) sbyte.MaxValue, (int) sbyte.MaxValue, (int) sbyte.MaxValue, 0); int num263 = 1; float num264 = 0.0f; WiresUI.Settings.MultiToolMode toolMode = WiresUI.Settings.ToolMode; bool flag7 = toolMode.HasFlag((Enum) WiresUI.Settings.MultiToolMode.Actuator); if (toolMode.HasFlag((Enum) WiresUI.Settings.MultiToolMode.Red)) { ++num264; color52 = Microsoft.Xna.Framework.Color.Lerp(color52, Microsoft.Xna.Framework.Color.Red, 1f / num264); } if (toolMode.HasFlag((Enum) WiresUI.Settings.MultiToolMode.Blue)) { ++num264; color52 = Microsoft.Xna.Framework.Color.Lerp(color52, Microsoft.Xna.Framework.Color.Blue, 1f / num264); } if (toolMode.HasFlag((Enum) WiresUI.Settings.MultiToolMode.Green)) { ++num264; color52 = Microsoft.Xna.Framework.Color.Lerp(color52, new Microsoft.Xna.Framework.Color(0, (int) byte.MaxValue, 0), 1f / num264); } if (toolMode.HasFlag((Enum) WiresUI.Settings.MultiToolMode.Yellow)) { float num265 = num264 + 1f; color52 = Microsoft.Xna.Framework.Color.Lerp(color52, new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, 0), 1f / num265); } if (toolMode.HasFlag((Enum) WiresUI.Settings.MultiToolMode.Cutter)) color51 = new Microsoft.Xna.Framework.Color(50, 50, 50, (int) byte.MaxValue); color52.A = (byte) 0; if (point == tileCoordinates) { Vector2 position = tileCoordinates.ToVector2() * 16f - Main.screenPosition; Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 16); if (flag7) Main.EntitySpriteDraw(TextureAssets.WireUi[11].Value, position, new Microsoft.Xna.Framework.Rectangle?(), color51, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, position, new Microsoft.Xna.Framework.Rectangle?(rectangle), color52, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); rectangle.Y = 18; Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, position, new Microsoft.Xna.Framework.Rectangle?(rectangle), color51, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); } else if (point.X == tileCoordinates.X) { int num266 = tileCoordinates.Y - point.Y; int num267 = Math.Sign(num266); Vector2 position3 = point.ToVector2() * 16f - Main.screenPosition; Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(num266 * num263 > 0 ? 72 : 18, 0, 16, 16); if (flag7) Main.EntitySpriteDraw(TextureAssets.WireUi[11].Value, position3, new Microsoft.Xna.Framework.Rectangle?(), color51, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, position3, new Microsoft.Xna.Framework.Rectangle?(rectangle), color52, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); rectangle.Y = 18; Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, position3, new Microsoft.Xna.Framework.Rectangle?(rectangle), color51, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); for (int index = point.Y + num267; index != tileCoordinates.Y; index += num267) { Vector2 position4 = new Vector2((float) (point.X * 16), (float) (index * 16)) - Main.screenPosition; rectangle.Y = 0; rectangle.X = 90; if (flag7) Main.EntitySpriteDraw(TextureAssets.WireUi[11].Value, position4, new Microsoft.Xna.Framework.Rectangle?(), color51, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, position4, new Microsoft.Xna.Framework.Rectangle?(rectangle), color52, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); rectangle.Y = 18; Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, position4, new Microsoft.Xna.Framework.Rectangle?(rectangle), color51, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); } Vector2 position5 = tileCoordinates.ToVector2() * 16f - Main.screenPosition; rectangle = new Microsoft.Xna.Framework.Rectangle(num266 * num263 > 0 ? 18 : 72, 0, 16, 16); if (flag7) Main.EntitySpriteDraw(TextureAssets.WireUi[11].Value, position5, new Microsoft.Xna.Framework.Rectangle?(), color51, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, position5, new Microsoft.Xna.Framework.Rectangle?(rectangle), color52, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); rectangle.Y = 18; Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, position5, new Microsoft.Xna.Framework.Rectangle?(rectangle), color51, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); } else if (point.Y == tileCoordinates.Y) { int num268 = tileCoordinates.X - point.X; int num269 = Math.Sign(num268); Vector2 position6 = point.ToVector2() * 16f - Main.screenPosition; Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(num268 > 0 ? 36 : 144, 0, 16, 16); if (flag7) Main.EntitySpriteDraw(TextureAssets.WireUi[11].Value, position6, new Microsoft.Xna.Framework.Rectangle?(), color51, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, position6, new Microsoft.Xna.Framework.Rectangle?(rectangle), color52, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); rectangle.Y = 18; Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, position6, new Microsoft.Xna.Framework.Rectangle?(rectangle), color51, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); for (int index = point.X + num269; index != tileCoordinates.X; index += num269) { Vector2 position7 = new Vector2((float) (index * 16), (float) (point.Y * 16)) - Main.screenPosition; rectangle.Y = 0; rectangle.X = 180; if (flag7) Main.EntitySpriteDraw(TextureAssets.WireUi[11].Value, position7, new Microsoft.Xna.Framework.Rectangle?(), color51, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, position7, new Microsoft.Xna.Framework.Rectangle?(rectangle), color52, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); rectangle.Y = 18; Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, position7, new Microsoft.Xna.Framework.Rectangle?(rectangle), color51, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); } Vector2 position8 = tileCoordinates.ToVector2() * 16f - Main.screenPosition; rectangle = new Microsoft.Xna.Framework.Rectangle(num268 > 0 ? 144 : 36, 0, 16, 16); if (flag7) Main.EntitySpriteDraw(TextureAssets.WireUi[11].Value, position8, new Microsoft.Xna.Framework.Rectangle?(), color51, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, position8, new Microsoft.Xna.Framework.Rectangle?(rectangle), color52, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); rectangle.Y = 18; Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, position8, new Microsoft.Xna.Framework.Rectangle?(rectangle), color51, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); } else { Math.Abs(point.X - tileCoordinates.X); Math.Abs(point.Y - tileCoordinates.Y); int num270 = Math.Sign(tileCoordinates.X - point.X); int num271 = Math.Sign(tileCoordinates.Y - point.Y); Microsoft.Xna.Framework.Point p = new Microsoft.Xna.Framework.Point(); bool flag8 = false; bool flag9 = player.direction == 1; int num272; int num273; int num274; if (flag9) { p.X = point.X; num272 = point.Y; num273 = tileCoordinates.Y; num274 = num271; } else { p.Y = point.Y; num272 = point.X; num273 = tileCoordinates.X; num274 = num270; } Vector2 position9 = point.ToVector2() * 16f - Main.screenPosition; Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 16); rectangle.X = flag9 ? (num274 > 0 ? 72 : 18) : (num274 > 0 ? 36 : 144); if (flag7) Main.EntitySpriteDraw(TextureAssets.WireUi[11].Value, position9, new Microsoft.Xna.Framework.Rectangle?(), color51, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, position9, new Microsoft.Xna.Framework.Rectangle?(rectangle), color52, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); rectangle.Y = 18; Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, position9, new Microsoft.Xna.Framework.Rectangle?(rectangle), color51, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); for (int index = num272 + num274; index != num273 && !flag8; index += num274) { if (flag9) p.Y = index; else p.X = index; if (WorldGen.InWorld(p.X, p.Y, 1) && Main.tile[p.X, p.Y] != null) { Vector2 position10 = p.ToVector2() * 16f - Main.screenPosition; rectangle.Y = 0; rectangle.X = flag9 ? 90 : 180; if (flag7) Main.EntitySpriteDraw(TextureAssets.WireUi[11].Value, position10, new Microsoft.Xna.Framework.Rectangle?(), color51, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, position10, new Microsoft.Xna.Framework.Rectangle?(rectangle), color52, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); rectangle.Y = 18; Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, position10, new Microsoft.Xna.Framework.Rectangle?(rectangle), color51, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); } } int num275; int num276; int num277; if (flag9) { p.Y = tileCoordinates.Y; num275 = point.X; num276 = tileCoordinates.X; num277 = num270; } else { p.X = tileCoordinates.X; num275 = point.Y; num276 = tileCoordinates.Y; num277 = num271; } Vector2 position11 = p.ToVector2() * 16f - Main.screenPosition; rectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 16); if (!flag9) { rectangle.X += num270 > 0 ? 144 : 36; rectangle.X += num271 * num263 > 0 ? 72 : 18; } else { rectangle.X += num270 > 0 ? 36 : 144; rectangle.X += num271 * num263 > 0 ? 18 : 72; } if (flag7) Main.EntitySpriteDraw(TextureAssets.WireUi[11].Value, position11, new Microsoft.Xna.Framework.Rectangle?(), color51, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, position11, new Microsoft.Xna.Framework.Rectangle?(rectangle), color52, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); rectangle.Y = 18; Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, position11, new Microsoft.Xna.Framework.Rectangle?(rectangle), color51, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); for (int index = num275 + num277; index != num276 && !flag8; index += num277) { if (!flag9) p.Y = index; else p.X = index; if (WorldGen.InWorld(p.X, p.Y, 1) && Main.tile[p.X, p.Y] != null) { Vector2 position12 = p.ToVector2() * 16f - Main.screenPosition; rectangle.Y = 0; rectangle.X = flag9 ? 180 : 90; if (flag7) Main.EntitySpriteDraw(TextureAssets.WireUi[11].Value, position12, new Microsoft.Xna.Framework.Rectangle?(), color51, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, position12, new Microsoft.Xna.Framework.Rectangle?(rectangle), color52, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); rectangle.Y = 18; Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, position12, new Microsoft.Xna.Framework.Rectangle?(rectangle), color51, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); } } Vector2 position13 = tileCoordinates.ToVector2() * 16f - Main.screenPosition; rectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 16); if (!flag9) rectangle.X += num271 * num263 > 0 ? 18 : 72; else rectangle.X += num270 > 0 ? 144 : 36; if (flag7) Main.EntitySpriteDraw(TextureAssets.WireUi[11].Value, position13, new Microsoft.Xna.Framework.Rectangle?(), color51, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, position13, new Microsoft.Xna.Framework.Rectangle?(rectangle), color52, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); rectangle.Y = 18; Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, position13, new Microsoft.Xna.Framework.Rectangle?(rectangle), color51, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0); } } else if (projectile1.type == 586) { float num278 = 300f; if ((double) projectile1.ai[0] >= 100.0) num278 = MathHelper.Lerp(300f, 600f, (float) (((double) projectile1.ai[0] - 100.0) / 200.0)); if ((double) num278 > 600.0) num278 = 600f; if ((double) projectile1.ai[0] >= 500.0) num278 = MathHelper.Lerp(600f, 1200f, (float) (((double) projectile1.ai[0] - 500.0) / 100.0)); float rotation2 = projectile1.rotation; Texture2D texture2D = TextureAssets.Projectile[projectile1.type].Value; int num279 = (int) ((double) projectile1.ai[0] / 6.0); Vector2 spinningpoint = new Vector2(0.0f, -num278); for (int index = 0; (double) index < 10.0; ++index) { Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: 5, frameY: ((num279 + index) % 5)); float rotation3 = rotation2 + 0.6283185f * (float) index; Vector2 vec = spinningpoint.RotatedBy((double) rotation3) / 3f + projectile1.Center; Microsoft.Xna.Framework.Color alpha = projectile1.GetAlpha(Lighting.GetColor(vec.ToTileCoordinates())); alpha.A /= (byte) 2; Main.EntitySpriteDraw(texture2D, vec - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(r), alpha, rotation3, r.Size() / 2f, projectile1.scale, SpriteEffects.None, 0); } for (int index = 0; (double) index < 20.0; ++index) { Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: 5, frameY: ((num279 + index) % 5)); float rotation4 = (float) (-(double) rotation2 + 0.314159274101257 * (double) index) * 2f; Vector2 vec = spinningpoint.RotatedBy((double) rotation4) + projectile1.Center; Microsoft.Xna.Framework.Color alpha = projectile1.GetAlpha(Lighting.GetColor(vec.ToTileCoordinates())); alpha.A /= (byte) 2; Main.EntitySpriteDraw(texture2D, vec - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(r), alpha, rotation4, r.Size() / 2f, projectile1.scale, SpriteEffects.None, 0); } } else if (projectile1.type == 536 || projectile1.type == 591 || projectile1.type == 607) { Texture2D texture2D = TextureAssets.Projectile[projectile1.type].Value; Vector2 position = projectile1.position + new Vector2((float) projectile1.width, (float) projectile1.height) / 2f + Vector2.UnitY * projectile1.gfxOffY - Main.screenPosition; Vector2 scale = new Vector2(1f, projectile1.velocity.Length() / (float) texture2D.Height); Main.EntitySpriteDraw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(), projectile1.GetAlpha(color10), projectile1.rotation, texture2D.Frame().Bottom(), scale, spriteEffects, 0); } else if (projectile1.type == 688 || projectile1.type == 689 || projectile1.type == 690) { Texture2D texture2D3 = TextureAssets.Projectile[projectile1.type].Value; Vector2 position14 = projectile1.Top + Vector2.UnitY * projectile1.gfxOffY - Main.screenPosition; Microsoft.Xna.Framework.Rectangle r3 = texture2D3.Frame(verticalFrames: Main.projFrames[projectile1.type], frameY: projectile1.frame); Vector2 origin7 = r3.Size() * new Vector2(0.5f, 0.0f); Microsoft.Xna.Framework.Color color53 = Microsoft.Xna.Framework.Color.Lerp(projectile1.GetAlpha(color10), Microsoft.Xna.Framework.Color.White, 0.5f); Microsoft.Xna.Framework.Color color54 = color53; color54.A = (byte) 127; Texture2D texture = (Texture2D) null; Texture2D texture2D4 = (Texture2D) null; switch (projectile1.type) { case 688: texture = TextureAssets.GlowMask[228].Value; texture2D4 = TextureAssets.Extra[86].Value; break; case 689: texture = TextureAssets.GlowMask[229].Value; texture2D4 = TextureAssets.Extra[87].Value; break; case 690: texture = TextureAssets.GlowMask[230].Value; texture2D4 = TextureAssets.Extra[88].Value; break; } Main.EntitySpriteDraw(texture2D3, position14, new Microsoft.Xna.Framework.Rectangle?(r3), color53, projectile1.rotation, origin7, projectile1.scale, spriteEffects, 0); if (texture != null) Main.EntitySpriteDraw(texture, position14, new Microsoft.Xna.Framework.Rectangle?(r3), color54, projectile1.rotation, origin7, projectile1.scale, spriteEffects, 0); if (texture2D4 == null) return; Vector2 position15 = projectile1.Center + Vector2.UnitY * projectile1.gfxOffY - Main.screenPosition; Microsoft.Xna.Framework.Rectangle r4 = texture2D4.Frame(); Vector2 origin8 = r4.Size() * new Vector2(0.5f, 1f); origin8.Y -= 2f; Main.EntitySpriteDraw(texture2D4, position15, new Microsoft.Xna.Framework.Rectangle?(r4), color53, projectile1.rotation, origin8, projectile1.scale, spriteEffects, 0); } else if (projectile1.type == 694 || projectile1.type == 695 || projectile1.type == 696) { Texture2D texture2D = TextureAssets.Projectile[projectile1.type].Value; Vector2 position = projectile1.Bottom + Vector2.UnitY * projectile1.gfxOffY - Main.screenPosition; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: Main.projFrames[projectile1.type], frameY: projectile1.frame); Vector2 origin = r.Size() * new Vector2(0.5f, 1f); origin.Y -= 8f; switch (projectile1.type) { case 694: case 695: origin.X += 3f; break; } Microsoft.Xna.Framework.Color color55 = Microsoft.Xna.Framework.Color.Lerp(projectile1.GetAlpha(color10), Microsoft.Xna.Framework.Color.White, 0.0f); Main.EntitySpriteDraw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(r), color55, projectile1.rotation, origin, projectile1.scale, spriteEffects, 0); Main.EntitySpriteDraw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(r), color55 * 0.3f, projectile1.rotation, origin, projectile1.scale * 1.1f, spriteEffects, 0); } else if (projectile1.type == 409) { Texture2D texture = TextureAssets.Projectile[projectile1.type].Value; int height = TextureAssets.Projectile[projectile1.type].Height() / Main.projFrames[projectile1.type]; int y = height * projectile1.frame; int num280 = 10; int num281 = 2; float num282 = 0.5f; for (int index = 1; index < num280; index += num281) { ref Vector2 local = ref projectile1.oldPos[index]; Microsoft.Xna.Framework.Color newColor = color10; Microsoft.Xna.Framework.Color color56 = projectile1.GetAlpha(newColor) * ((float) (num280 - index) / 15f); Vector2 vector2 = projectile1.oldPos[index] - Main.screenPosition + new Vector2(x17 + (float) num209, (float) (projectile1.height / 2) + projectile1.gfxOffY); Main.EntitySpriteDraw(texture, projectile1.oldPos[index] + new Vector2((float) projectile1.width, (float) projectile1.height) / 2f - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, texture.Width, height)), color56, projectile1.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), MathHelper.Lerp(projectile1.scale, num282, (float) index / 15f), spriteEffects, 0); } Main.EntitySpriteDraw(texture, projectile1.Center - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, texture.Width, height)), projectile1.GetAlpha(color10), projectile1.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile1.scale, spriteEffects, 0); } else if (projectile1.type == 437) { Texture2D texture = TextureAssets.Projectile[projectile1.type].Value; int height = TextureAssets.Projectile[projectile1.type].Height() / Main.projFrames[projectile1.type]; int y = height * projectile1.frame; int num283 = 10; int num284 = 2; float num285 = 0.2f; for (int index = 1; index < num283; index += num284) { ref Vector2 local = ref projectile1.oldPos[index]; Microsoft.Xna.Framework.Color newColor = color10; Microsoft.Xna.Framework.Color color57 = projectile1.GetAlpha(newColor) * ((float) (num283 - index) / 15f); Vector2 vector2 = projectile1.oldPos[index] - Main.screenPosition + new Vector2(x17 + (float) num209, (float) (projectile1.height / 2) + projectile1.gfxOffY); Main.EntitySpriteDraw(texture, projectile1.oldPos[index] + new Vector2((float) projectile1.width, (float) projectile1.height) / 2f - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, texture.Width, height)), color57, projectile1.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), MathHelper.Lerp(projectile1.scale, num285, (float) index / 15f), spriteEffects, 0); } Main.EntitySpriteDraw(texture, projectile1.Center - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, texture.Width, height)), Microsoft.Xna.Framework.Color.White, projectile1.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile1.scale + 0.2f, spriteEffects, 0); Main.EntitySpriteDraw(texture, projectile1.Center - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, texture.Width, height)), projectile1.GetAlpha(Microsoft.Xna.Framework.Color.White), projectile1.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile1.scale + 0.2f, spriteEffects, 0); } else if (projectile1.type == 384 || projectile1.type == 386) { Texture2D texture = TextureAssets.Projectile[projectile1.type].Value; int height = TextureAssets.Projectile[projectile1.type].Height() / Main.projFrames[projectile1.type]; int y = height * projectile1.frame; Main.EntitySpriteDraw(texture, projectile1.Center - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, texture.Width, height)), projectile1.GetAlpha(color10), projectile1.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile1.scale, spriteEffects, 0); } else if (projectile1.type == 439 || projectile1.type == 460 || projectile1.type == 600 || projectile1.type == 615 || projectile1.type == 630 || projectile1.type == 633 || projectile1.type == 705 || projectile1.type == 714) { Texture2D texture = TextureAssets.Projectile[projectile1.type].Value; if ((double) Main.player[projectile1.owner].gravDir == -1.0) { if (projectile1.type == 705) spriteEffects |= SpriteEffects.FlipVertically; if (projectile1.type == 615 || projectile1.type == 714) { if (Main.player[projectile1.owner].direction == 1) spriteEffects = SpriteEffects.FlipVertically; else if (Main.player[projectile1.owner].direction == -1) spriteEffects = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically; } else if (projectile1.type == 600 || projectile1.type == 439) { if (Main.player[projectile1.owner].direction == 1) spriteEffects = SpriteEffects.FlipHorizontally; else if (Main.player[projectile1.owner].direction == -1) spriteEffects = SpriteEffects.None; } } int height = TextureAssets.Projectile[projectile1.type].Height() / Main.projFrames[projectile1.type]; int y15 = height * projectile1.frame; Vector2 position = (projectile1.position + new Vector2((float) projectile1.width, (float) projectile1.height) / 2f + Vector2.UnitY * projectile1.gfxOffY - Main.screenPosition).Floor(); float num286 = 1f; if (Main.player[projectile1.owner].shroomiteStealth && Main.player[projectile1.owner].inventory[Main.player[projectile1.owner].selectedItem].ranged) { float num287 = Main.player[projectile1.owner].stealth; if ((double) num287 < 0.03) num287 = 0.03f; double num288 = (1.0 + (double) num287 * 10.0) / 11.0; color10 *= num287; num286 = num287; } if (Main.player[projectile1.owner].setVortex && Main.player[projectile1.owner].inventory[Main.player[projectile1.owner].selectedItem].ranged) { float num289 = Main.player[projectile1.owner].stealth; if ((double) num289 < 0.03) num289 = 0.03f; double num290 = (1.0 + (double) num289 * 10.0) / 11.0; color10 = color10.MultiplyRGBA(new Microsoft.Xna.Framework.Color(Vector4.Lerp(Vector4.One, new Vector4(0.0f, 0.12f, 0.16f, 0.0f), 1f - num289))); num286 = num289; } if (projectile1.type == 714) { y15 = 0; Main.instance.LoadItem(3930); texture = TextureAssets.Item[3930].Value; } Main.EntitySpriteDraw(texture, position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y15, texture.Width, height)), projectile1.GetAlpha(color10), projectile1.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile1.scale, spriteEffects, 0); if (projectile1.type == 439) Main.EntitySpriteDraw(TextureAssets.GlowMask[35].Value, position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y15, texture.Width, height)), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0) * num286, projectile1.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile1.scale, spriteEffects, 0); else if (projectile1.type == 714) { int y16 = height * projectile1.frame; Microsoft.Xna.Framework.Color rgb = Main.hslToRgb((float) ((double) projectile1.ai[0] / 90.0 % 1.0), 1f, 0.5f); rgb.A = (byte) 120; Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y16, texture.Width, height)), rgb * num286, projectile1.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile1.scale, spriteEffects, 0); } else if (projectile1.type == 615) Main.EntitySpriteDraw(TextureAssets.GlowMask[192].Value, position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y15, texture.Width, height)), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue) * num286, projectile1.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile1.scale, spriteEffects, 0); else if (projectile1.type == 630) { Main.EntitySpriteDraw(TextureAssets.GlowMask[200].Value, position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y15, texture.Width, height)), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue) * num286, projectile1.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile1.scale, spriteEffects, 0); if ((double) projectile1.localAI[0] <= 0.0) return; int frameY = 6 - (int) ((double) projectile1.localAI[0] / 1.0); Texture2D texture2D = TextureAssets.Extra[65].Value; Main.EntitySpriteDraw(texture2D, position + Vector2.Normalize(projectile1.velocity) * 2f, new Microsoft.Xna.Framework.Rectangle?(texture2D.Frame(verticalFrames: 6, frameY: frameY)), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue) * num286, projectile1.rotation, new Vector2(spriteEffects.HasFlag((Enum) SpriteEffects.FlipHorizontally) ? (float) texture2D.Width : 0.0f, (float) ((double) height / 2.0 - 2.0)), projectile1.scale, spriteEffects, 0); } else if (projectile1.type == 600) { Microsoft.Xna.Framework.Color portalColor = PortalHelper.GetPortalColor(projectile1.owner, (int) projectile1.ai[1]); portalColor.A = (byte) 70; Main.EntitySpriteDraw(TextureAssets.GlowMask[173].Value, position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y15, texture.Width, height)), portalColor, projectile1.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile1.scale, spriteEffects, 0); } else if (projectile1.type == 460) { if ((double) Math.Abs(projectile1.rotation - 1.570796f) > 1.57079637050629) spriteEffects |= SpriteEffects.FlipVertically; Main.EntitySpriteDraw(TextureAssets.GlowMask[102].Value, position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y15, texture.Width, height)), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), projectile1.rotation - 1.570796f, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile1.scale, spriteEffects, 0); if ((double) projectile1.ai[0] <= 180.0 || Main.projectile[(int) projectile1.ai[1]].type != 461) return; this.DrawProj((int) projectile1.ai[1]); } else { if (projectile1.type != 633) return; float num291 = (float) (Math.Cos(6.28318548202515 * ((double) projectile1.ai[0] / 30.0)) * 2.0 + 2.0); if ((double) projectile1.ai[0] > 120.0) num291 = 4f; for (float num292 = 0.0f; (double) num292 < 4.0; ++num292) Main.EntitySpriteDraw(texture, position + Vector2.UnitY.RotatedBy((double) num292 * 6.28318548202515 / 4.0) * num291, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y15, texture.Width, height)), projectile1.GetAlpha(color10).MultiplyRGBA(new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0)) * 0.03f, projectile1.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile1.scale, spriteEffects, 0); } } else if (projectile1.type == 442) { Texture2D texture = TextureAssets.Projectile[projectile1.type].Value; int height = TextureAssets.Projectile[projectile1.type].Height() / Main.projFrames[projectile1.type]; int y = height * projectile1.frame; Vector2 position = projectile1.position + new Vector2((float) projectile1.width, (float) projectile1.height) / 2f + Vector2.UnitY * projectile1.gfxOffY - Main.screenPosition; Main.EntitySpriteDraw(texture, position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, texture.Width, height)), projectile1.GetAlpha(color10), projectile1.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile1.scale, spriteEffects, 0); Main.EntitySpriteDraw(TextureAssets.GlowMask[37].Value, position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, texture.Width, height)), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0) * (float) (1.0 - (double) projectile1.alpha / (double) byte.MaxValue), projectile1.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile1.scale, spriteEffects, 0); } else if (projectile1.type == 447) { Texture2D texture = TextureAssets.Projectile[projectile1.type].Value; Texture2D texture2D = TextureAssets.Extra[4].Value; int num293 = texture.Height / Main.projFrames[projectile1.type]; int num294 = num293 * projectile1.frame; int height = texture2D.Height / Main.projFrames[projectile1.type]; int y = height * projectile1.frame; Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y, texture2D.Width, height); Vector2 position = projectile1.position + new Vector2((float) projectile1.width, 0.0f) / 2f + Vector2.UnitY * projectile1.gfxOffY - Main.screenPosition; Main.EntitySpriteDraw(TextureAssets.Extra[4].Value, position, new Microsoft.Xna.Framework.Rectangle?(rectangle), projectile1.GetAlpha(color10), projectile1.rotation, new Vector2((float) (texture2D.Width / 2), 0.0f), projectile1.scale, spriteEffects, 0); int num295 = projectile1.height - num293 - 14; if (num295 < 0) num295 = 0; if (num295 > 0) { if (y == height * 3) y = height * 2; Main.EntitySpriteDraw(TextureAssets.Extra[4].Value, position + Vector2.UnitY * (float) (height - 1), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y + height - 1, texture2D.Width, 1)), projectile1.GetAlpha(color10), projectile1.rotation, new Vector2((float) (texture2D.Width / 2), 0.0f), new Vector2(1f, (float) num295), spriteEffects, 0); } rectangle.Width = texture.Width; rectangle.Y = num294; Main.EntitySpriteDraw(texture, position + Vector2.UnitY * (float) (height - 1 + num295), new Microsoft.Xna.Framework.Rectangle?(rectangle), projectile1.GetAlpha(color10), projectile1.rotation, new Vector2((float) texture.Width / 2f, 0.0f), projectile1.scale, spriteEffects, 0); } else if (projectile1.type == 455) { if (projectile1.velocity == Vector2.Zero) return; Texture2D texture2D5 = TextureAssets.Projectile[projectile1.type].Value; Texture2D texture = TextureAssets.Extra[21].Value; Texture2D texture2D6 = TextureAssets.Extra[22].Value; float num296 = projectile1.localAI[1]; Microsoft.Xna.Framework.Color color58 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0) * 0.9f; Main.EntitySpriteDraw(texture2D5, projectile1.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(), color58, projectile1.rotation, texture2D5.Size() / 2f, projectile1.scale, SpriteEffects.None, 0); float num297 = num296 - (float) (texture2D5.Height / 2 + texture2D6.Height) * projectile1.scale; Vector2 vector2 = projectile1.Center + projectile1.velocity * projectile1.scale * (float) texture2D5.Height / 2f; if ((double) num297 > 0.0) { float num298 = 0.0f; Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, 16 * (projectile1.timeLeft / 3 % 5), texture.Width, 16); while ((double) num298 + 1.0 < (double) num297) { if ((double) num297 - (double) num298 < (double) rectangle.Height) rectangle.Height = (int) ((double) num297 - (double) num298); Main.EntitySpriteDraw(texture, vector2 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangle), color58, projectile1.rotation, new Vector2((float) (rectangle.Width / 2), 0.0f), projectile1.scale, SpriteEffects.None, 0); num298 += (float) rectangle.Height * projectile1.scale; vector2 += projectile1.velocity * (float) rectangle.Height * projectile1.scale; rectangle.Y += 16; if (rectangle.Y + rectangle.Height > texture.Height) rectangle.Y = 0; } } Main.EntitySpriteDraw(texture2D6, vector2 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(), color58, projectile1.rotation, texture2D6.Frame().Top(), projectile1.scale, SpriteEffects.None, 0); } else if (projectile1.type == 461) { if (projectile1.velocity == Vector2.Zero) return; Texture2D texture2D = TextureAssets.Projectile[projectile1.type].Value; float num299 = projectile1.localAI[1]; Microsoft.Xna.Framework.Color color59 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0) * 0.9f; Microsoft.Xna.Framework.Rectangle r = new Microsoft.Xna.Framework.Rectangle(0, 0, texture2D.Width, 22); Vector2 vector2_20 = new Vector2(0.0f, Main.player[projectile1.owner].gfxOffY); Main.EntitySpriteDraw(texture2D, projectile1.Center.Floor() - Main.screenPosition + vector2_20, new Microsoft.Xna.Framework.Rectangle?(r), color59, projectile1.rotation, r.Size() / 2f, projectile1.scale, SpriteEffects.None, 0); float num300 = num299 - 33f * projectile1.scale; Vector2 vector2_21 = projectile1.Center.Floor() + projectile1.velocity * projectile1.scale * 10.5f; r = new Microsoft.Xna.Framework.Rectangle(0, 25, texture2D.Width, 28); if ((double) num300 > 0.0) { float num301 = 0.0f; while ((double) num301 + 1.0 < (double) num300) { if ((double) num300 - (double) num301 < (double) r.Height) r.Height = (int) ((double) num300 - (double) num301); Main.EntitySpriteDraw(texture2D, vector2_21 - Main.screenPosition + vector2_20, new Microsoft.Xna.Framework.Rectangle?(r), color59, projectile1.rotation, new Vector2((float) (r.Width / 2), 0.0f), projectile1.scale, SpriteEffects.None, 0); num301 += (float) r.Height * projectile1.scale; vector2_21 += projectile1.velocity * (float) r.Height * projectile1.scale; } } r = new Microsoft.Xna.Framework.Rectangle(0, 56, texture2D.Width, 22); Main.EntitySpriteDraw(texture2D, vector2_21 - Main.screenPosition + vector2_20, new Microsoft.Xna.Framework.Rectangle?(r), color59, projectile1.rotation, texture2D.Frame().Top(), projectile1.scale, SpriteEffects.None, 0); } else if (projectile1.type == 632) { if (projectile1.velocity == Vector2.Zero) return; Texture2D tex = TextureAssets.Projectile[projectile1.type].Value; float num302 = projectile1.localAI[1]; float laserLuminance = 0.5f; float laserAlphaMultiplier = 0.0f; Microsoft.Xna.Framework.Color rgb = Main.hslToRgb(projectile1.GetLastPrismHue(projectile1.ai[0], ref laserLuminance, ref laserAlphaMultiplier), 1f, laserLuminance); rgb.A = (byte) ((double) rgb.A * (double) laserAlphaMultiplier); Vector2 vector2_22 = projectile1.Center.Floor() + projectile1.velocity * projectile1.scale * 10.5f; float num303 = num302 - projectile1.scale * 14.5f * projectile1.scale; Vector2 scale = new Vector2(projectile1.scale); DelegateMethods.f_1 = 1f; DelegateMethods.c_1 = rgb * 0.75f * projectile1.Opacity; Vector2 vector2_23 = projectile1.oldPos[0] + new Vector2((float) projectile1.width, (float) projectile1.height) / 2f + Vector2.UnitY * projectile1.gfxOffY - Main.screenPosition; Utils.DrawLaser(Main.spriteBatch, tex, vector2_22 - Main.screenPosition, vector2_22 + projectile1.velocity * num303 - Main.screenPosition, scale, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue) * 0.75f * projectile1.Opacity; Utils.DrawLaser(Main.spriteBatch, tex, vector2_22 - Main.screenPosition, vector2_22 + projectile1.velocity * num303 - Main.screenPosition, scale / 2f, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); } else if (projectile1.type == 642) { if (projectile1.velocity == Vector2.Zero) return; Texture2D tex = TextureAssets.Projectile[projectile1.type].Value; float num304 = projectile1.localAI[1]; Microsoft.Xna.Framework.Color color60 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue); Vector2 vector2_24 = projectile1.Center.Floor(); float num305 = num304 - projectile1.scale * 10.5f; Vector2 scale = new Vector2(projectile1.scale); DelegateMethods.f_1 = 1f; DelegateMethods.c_1 = color60; DelegateMethods.i_1 = 54000 - (int) Main.time / 2; Vector2 vector2_25 = projectile1.oldPos[0] + new Vector2((float) projectile1.width, (float) projectile1.height) / 2f + Vector2.UnitY * projectile1.gfxOffY - Main.screenPosition; Utils.DrawLaser(Main.spriteBatch, tex, vector2_24 - Main.screenPosition, vector2_24 + projectile1.velocity * num305 - Main.screenPosition, scale, new Utils.LaserLineFraming(DelegateMethods.TurretLaserDraw)); DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue) * 0.75f * projectile1.Opacity; Utils.DrawLaser(Main.spriteBatch, tex, vector2_24 - Main.screenPosition, vector2_24 + projectile1.velocity * num305 - Main.screenPosition, scale / 2f, new Utils.LaserLineFraming(DelegateMethods.TurretLaserDraw)); } else if (projectile1.type == 611) { Vector2 vector2_26 = projectile1.position + new Vector2((float) projectile1.width, (float) projectile1.height) / 2f + Vector2.UnitY * projectile1.gfxOffY - Main.screenPosition; Texture2D texture2D = TextureAssets.Projectile[projectile1.type].Value; Microsoft.Xna.Framework.Color alpha = projectile1.GetAlpha(color10); if (projectile1.velocity == Vector2.Zero) return; float num306 = projectile1.velocity.Length() + 16f; bool flag = (double) num306 < 100.0; Vector2 vector2_27 = Vector2.Normalize(projectile1.velocity); Microsoft.Xna.Framework.Rectangle r = new Microsoft.Xna.Framework.Rectangle(0, 2, texture2D.Width, 40); Vector2 vector2_28 = new Vector2(0.0f, Main.player[projectile1.owner].gfxOffY); float rotation = projectile1.rotation + 3.141593f; Main.EntitySpriteDraw(texture2D, projectile1.Center.Floor() - Main.screenPosition + vector2_28, new Microsoft.Xna.Framework.Rectangle?(r), alpha, rotation, r.Size() / 2f - Vector2.UnitY * 4f, projectile1.scale, SpriteEffects.None, 0); float num307 = num306 - 40f * projectile1.scale; Vector2 vector2_29 = projectile1.Center.Floor() + vector2_27 * projectile1.scale * 24f; r = new Microsoft.Xna.Framework.Rectangle(0, 68, texture2D.Width, 18); if ((double) num307 > 0.0) { float num308 = 0.0f; while ((double) num308 + 1.0 < (double) num307) { if ((double) num307 - (double) num308 < (double) r.Height) r.Height = (int) ((double) num307 - (double) num308); Main.EntitySpriteDraw(texture2D, vector2_29 - Main.screenPosition + vector2_28, new Microsoft.Xna.Framework.Rectangle?(r), alpha, rotation, new Vector2((float) (r.Width / 2), 0.0f), projectile1.scale, SpriteEffects.None, 0); num308 += (float) r.Height * projectile1.scale; vector2_29 += vector2_27 * (float) r.Height * projectile1.scale; } } Vector2 vector2_30 = vector2_29; Vector2 vector2_31 = projectile1.Center.Floor() + vector2_27 * projectile1.scale * 24f; r = new Microsoft.Xna.Framework.Rectangle(0, 46, texture2D.Width, 18); int num309 = 18; if (flag) num309 = 9; float num310 = num307; if ((double) num307 > 0.0) { float num311 = 0.0f; float num312 = num310 / (float) num309; float num313 = num311 + num312 * 0.25f; Vector2 vector2_32 = vector2_31 + vector2_27 * num312 * 0.25f; for (int index = 0; index < num309; ++index) { float num314 = num312; if (index == 0) num314 *= 0.75f; Main.EntitySpriteDraw(texture2D, vector2_32 - Main.screenPosition + vector2_28, new Microsoft.Xna.Framework.Rectangle?(r), alpha, rotation, new Vector2((float) (r.Width / 2), 0.0f), projectile1.scale, SpriteEffects.None, 0); num313 += num314; vector2_32 += vector2_27 * num314; } } r = new Microsoft.Xna.Framework.Rectangle(0, 90, texture2D.Width, 48); Main.EntitySpriteDraw(texture2D, vector2_30 - Main.screenPosition + vector2_28, new Microsoft.Xna.Framework.Rectangle?(r), alpha, rotation, texture2D.Frame().Top(), projectile1.scale, SpriteEffects.None, 0); } else if (projectile1.type == 537) { if (projectile1.velocity == Vector2.Zero) return; Texture2D texture2D = TextureAssets.Projectile[projectile1.type].Value; float num315 = projectile1.localAI[1]; Microsoft.Xna.Framework.Color color61 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0) * 0.9f; Microsoft.Xna.Framework.Rectangle r = new Microsoft.Xna.Framework.Rectangle(0, 0, texture2D.Width, 22); Vector2 vector2_33 = new Vector2(0.0f, Main.npc[(int) projectile1.ai[1]].gfxOffY); Main.EntitySpriteDraw(texture2D, projectile1.Center.Floor() - Main.screenPosition + vector2_33, new Microsoft.Xna.Framework.Rectangle?(r), color61, projectile1.rotation, r.Size() / 2f, projectile1.scale, SpriteEffects.None, 0); float num316 = num315 - 33f * projectile1.scale; Vector2 vector2_34 = projectile1.Center.Floor() + projectile1.velocity * projectile1.scale * 10.5f; r = new Microsoft.Xna.Framework.Rectangle(0, 25, texture2D.Width, 28); if ((double) num316 > 0.0) { float num317 = 0.0f; while ((double) num317 + 1.0 < (double) num316) { if ((double) num316 - (double) num317 < (double) r.Height) r.Height = (int) ((double) num316 - (double) num317); Main.EntitySpriteDraw(texture2D, vector2_34 - Main.screenPosition + vector2_33, new Microsoft.Xna.Framework.Rectangle?(r), color61, projectile1.rotation, new Vector2((float) (r.Width / 2), 0.0f), projectile1.scale, SpriteEffects.None, 0); num317 += (float) r.Height * projectile1.scale; vector2_34 += projectile1.velocity * (float) r.Height * projectile1.scale; } } r = new Microsoft.Xna.Framework.Rectangle(0, 56, texture2D.Width, 22); Main.EntitySpriteDraw(texture2D, vector2_34 - Main.screenPosition + vector2_33, new Microsoft.Xna.Framework.Rectangle?(r), color61, projectile1.rotation, texture2D.Frame().Top(), projectile1.scale, SpriteEffects.None, 0); } else if (projectile1.type == 456) { Texture2D texture2D7 = TextureAssets.Projectile[projectile1.type].Value; Texture2D texture = TextureAssets.Extra[23].Value; Texture2D texture2D8 = TextureAssets.Extra[24].Value; Vector2 vector2_35 = new Vector2(0.0f, 216f); Vector2 vector2_36 = Main.npc[(int) Math.Abs(projectile1.ai[0]) - 1].Center - projectile1.Center + vector2_35; float num318 = vector2_36.Length(); Vector2 vector2_37 = Vector2.Normalize(vector2_36); Microsoft.Xna.Framework.Rectangle r5 = texture2D7.Frame(); r5.Height /= 4; r5.Y += projectile1.frame * r5.Height; Microsoft.Xna.Framework.Color newColor1 = Microsoft.Xna.Framework.Color.Lerp(color10, Microsoft.Xna.Framework.Color.White, 0.3f); Main.EntitySpriteDraw(texture2D7, projectile1.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(r5), projectile1.GetAlpha(newColor1), projectile1.rotation, r5.Size() / 2f, projectile1.scale, SpriteEffects.None, 0); float num319 = num318 - (float) (r5.Height / 2 + texture2D8.Height) * projectile1.scale; Vector2 vec = projectile1.Center + vector2_37 * projectile1.scale * (float) r5.Height / 2f; if ((double) num319 > 0.0) { float num320 = 0.0f; Microsoft.Xna.Framework.Rectangle r6 = new Microsoft.Xna.Framework.Rectangle(0, 0, texture.Width, texture.Height); while ((double) num320 + 1.0 < (double) num319) { if ((double) num319 - (double) num320 < (double) r6.Height) r6.Height = (int) ((double) num319 - (double) num320); Microsoft.Xna.Framework.Point tileCoordinates = vec.ToTileCoordinates(); Microsoft.Xna.Framework.Color newColor2 = Microsoft.Xna.Framework.Color.Lerp(Lighting.GetColor(tileCoordinates.X, tileCoordinates.Y), Microsoft.Xna.Framework.Color.White, 0.3f); Main.EntitySpriteDraw(texture, vec - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(r6), projectile1.GetAlpha(newColor2), projectile1.rotation, r6.Bottom(), projectile1.scale, SpriteEffects.None, 0); num320 += (float) r6.Height * projectile1.scale; vec += vector2_37 * (float) r6.Height * projectile1.scale; } } Microsoft.Xna.Framework.Point tileCoordinates1 = vec.ToTileCoordinates(); Microsoft.Xna.Framework.Color color62 = Microsoft.Xna.Framework.Color.Lerp(Lighting.GetColor(tileCoordinates1.X, tileCoordinates1.Y), Microsoft.Xna.Framework.Color.White, 0.3f); Microsoft.Xna.Framework.Rectangle rectangle = texture2D8.Frame(); if ((double) num319 < 0.0) rectangle.Height += (int) num319; Main.EntitySpriteDraw(texture2D8, vec - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangle), color62, projectile1.rotation, new Vector2((float) rectangle.Width / 2f, (float) rectangle.Height), projectile1.scale, SpriteEffects.None, 0); } else if (projectile1.type == 443) { Texture2D texture = TextureAssets.Projectile[projectile1.type].Value; float num321 = 30f; float num322 = num321 * 4f; float num323 = 6.283185f * projectile1.ai[0] / num321; float num324 = 6.283185f * projectile1.ai[0] / num322; Vector2 vector2 = -Vector2.UnitY.RotatedBy((double) num323); float scale6 = (float) (0.75 + (double) vector2.Y * 0.25); float scale7 = (float) (0.800000011920929 - (double) vector2.Y * 0.200000002980232); int height = TextureAssets.Projectile[projectile1.type].Height() / Main.projFrames[projectile1.type]; int y = height * projectile1.frame; Vector2 position = projectile1.position + new Vector2((float) projectile1.width, (float) projectile1.height) / 2f + Vector2.UnitY * projectile1.gfxOffY - Main.screenPosition; Main.EntitySpriteDraw(texture, position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, texture.Width, height)), projectile1.GetAlpha(color10), projectile1.rotation + num324, new Vector2((float) texture.Width / 2f, (float) height / 2f), scale6, spriteEffects, 0); Main.EntitySpriteDraw(texture, position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, texture.Width, height)), projectile1.GetAlpha(color10), projectile1.rotation + (6.283185f - num324), new Vector2((float) texture.Width / 2f, (float) height / 2f), scale7, spriteEffects, 0); } else if (projectile1.type == 656 || projectile1.type == 657) { float num325 = 900f; if (projectile1.type == 657) num325 = 300f; float num326 = 15f; float num327 = 15f; float num328 = projectile1.ai[0]; float num329 = MathHelper.Clamp(num328 / 30f, 0.0f, 1f); if ((double) num328 > (double) num325 - 60.0) num329 = MathHelper.Lerp(1f, 0.0f, (float) (((double) num328 - ((double) num325 - 60.0)) / 60.0)); Microsoft.Xna.Framework.Point tileCoordinates = projectile1.Center.ToTileCoordinates(); int topY; int bottomY; Collision.ExpandVertically(tileCoordinates.X, tileCoordinates.Y, out topY, out bottomY, (int) num326, (int) num327); ++topY; --bottomY; float num330 = 0.2f; Vector2 vector2_38 = new Vector2((float) tileCoordinates.X, (float) topY) * 16f + new Vector2(8f); Vector2 vector2_39 = new Vector2((float) tileCoordinates.X, (float) bottomY) * 16f + new Vector2(8f); Vector2.Lerp(vector2_38, vector2_39, 0.5f); Vector2 vector2_40 = new Vector2(0.0f, vector2_39.Y - vector2_38.Y); vector2_40.X = vector2_40.Y * num330; Vector2 vector2_41 = new Vector2(vector2_38.X - vector2_40.X / 2f, vector2_38.Y); Texture2D texture2D = TextureAssets.Projectile[projectile1.type].Value; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(); Vector2 origin = r.Size() / 2f; float num331 = -0.06283186f * num328; Vector2 spinningpoint = Vector2.UnitY.RotatedBy((double) num328 * 0.100000001490116); float num332 = 0.0f; float num333 = 5.1f; Microsoft.Xna.Framework.Color color63 = new Microsoft.Xna.Framework.Color(212, 192, 100); for (float y = (float) (int) vector2_39.Y; (double) y > (double) (int) vector2_38.Y; y -= num333) { num332 += num333; float num334 = num332 / vector2_40.Y; float num335 = (float) ((double) num332 * 6.28318548202515 / -20.0); float num336 = num334 - 0.15f; Vector2 vector2_42 = spinningpoint.RotatedBy((double) num335); Vector2 vector2_43 = new Vector2(0.0f, num334 + 1f); vector2_43.X = vector2_43.Y * num330; Microsoft.Xna.Framework.Color color64 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, color63, num334 * 2f); if ((double) num334 > 0.5) color64 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, color63, (float) (2.0 - (double) num334 * 2.0)); color64.A = (byte) ((double) color64.A * 0.5); Microsoft.Xna.Framework.Color color65 = color64 * num329; Vector2 vector2_44 = vector2_42 * (vector2_43 * 100f); vector2_44.Y = 0.0f; vector2_44.X = 0.0f; Vector2 position = vector2_44 + (new Vector2(vector2_39.X, y) - Main.screenPosition); Main.EntitySpriteDraw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(r), color65, num331 + num335, origin, 1f + num336, SpriteEffects.None, 0); } } else if (projectile1.type == 704) { float num337 = 300f; float num338 = projectile1.ai[0]; float num339 = MathHelper.Clamp(num338 / 30f, 0.0f, 1f); if ((double) num338 > (double) num337 - 60.0) num339 = MathHelper.Lerp(1f, 0.0f, (float) (((double) num338 - ((double) num337 - 60.0)) / 60.0)); float num340 = 0.2f; Vector2 top = projectile1.Top; Vector2 bottom = projectile1.Bottom; Vector2.Lerp(top, bottom, 0.5f); Vector2 vector2_45 = new Vector2(0.0f, bottom.Y - top.Y); vector2_45.X = vector2_45.Y * num340; Vector2 vector2_46 = new Vector2(top.X - vector2_45.X / 2f, top.Y); Texture2D texture2D = TextureAssets.Projectile[projectile1.type].Value; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(); Vector2 origin = r.Size() / 2f; float num341 = (float) (-0.157079637050629 * (double) num338 * ((double) projectile1.velocity.X > 0.0 ? -1.0 : 1.0)); SpriteEffects effects = (double) projectile1.velocity.X > 0.0 ? SpriteEffects.FlipVertically : SpriteEffects.None; bool flag10 = (double) projectile1.velocity.X > 0.0; Vector2 spinningpoint = Vector2.UnitY.RotatedBy((double) num338 * 0.140000000596046); float num342 = 0.0f; float num343 = (float) (5.01000022888184 + (double) num338 / 150.0 * -0.899999976158142); if ((double) num343 < 4.1100001335144) num343 = 4.11f; Microsoft.Xna.Framework.Color color66 = new Microsoft.Xna.Framework.Color(160, 140, 100, (int) sbyte.MaxValue); Microsoft.Xna.Framework.Color color67 = new Microsoft.Xna.Framework.Color(140, 160, (int) byte.MaxValue, (int) sbyte.MaxValue); float t = num338 % 60f; Microsoft.Xna.Framework.Color color68 = (double) t >= 30.0 ? color67 * Utils.GetLerpValue(38f, 30f, t, true) : color67 * Utils.GetLerpValue(22f, 30f, t, true); bool flag11 = color68 != Microsoft.Xna.Framework.Color.Transparent; for (float y = (float) (int) bottom.Y; (double) y > (double) (int) top.Y; y -= num343) { num342 += num343; float num344 = num342 / vector2_45.Y; float num345 = (float) ((double) num342 * 6.28318548202515 / -20.0); if (flag10) num345 *= -1f; float num346 = num344 - 0.35f; Vector2 vector2_47 = spinningpoint.RotatedBy((double) num345); Vector2 vector2_48 = new Vector2(0.0f, num344 + 1f); vector2_48.X = vector2_48.Y * num340; Microsoft.Xna.Framework.Color color69 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, color66, num344 * 2f); if ((double) num344 > 0.5) color69 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, color66, (float) (2.0 - (double) num344 * 2.0)); color69.A = (byte) ((double) color69.A * 0.5); Microsoft.Xna.Framework.Color color70 = color69 * num339; Vector2 vector2_49 = vector2_47 * (vector2_48 * 100f); vector2_49.Y = 0.0f; vector2_49.X = 0.0f; Vector2 position = vector2_49 + (new Vector2(bottom.X, y) - Main.screenPosition); if (flag11) { Microsoft.Xna.Framework.Color color71 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, color68, num344 * 2f); if ((double) num344 > 0.5) color71 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, color68, (float) (2.0 - (double) num344 * 2.0)); color71.A = (byte) ((double) color71.A * 0.5); Microsoft.Xna.Framework.Color color72 = color71 * num339; Main.EntitySpriteDraw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(r), color72, num341 + num345, origin, (float) ((1.0 + (double) num346) * 0.800000011920929), effects, 0); } Main.EntitySpriteDraw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(r), color70, num341 + num345, origin, 1f + num346, effects, 0); } } else if (projectile1.type == 444 || projectile1.type == 446 || projectile1.type == 490 || projectile1.type == 464 || projectile1.type == 502 || projectile1.type == 538 || projectile1.type == 540 || projectile1.type == 579 || projectile1.type == 578 || projectile1.type == 813 || projectile1.type == 583 || projectile1.type == 584 || projectile1.type == 616 || projectile1.type == 617 || projectile1.type == 618 || projectile1.type == 641 || projectile1.type >= 646 && projectile1.type <= 649 || projectile1.type == 653 || projectile1.type == 186 || projectile1.type == 662 || projectile1.type == 685 || projectile1.type == 673 || projectile1.type == 676 || projectile1.type == 697 || projectile1.type == 699 || projectile1.type == 707 || projectile1.type == 708 || projectile1.type == 719 || projectile1.type == 761 || projectile1.type == 762 || projectile1.type == 763 || projectile1.type == 772 || projectile1.type == 802 || projectile1.type == 842 || projectile1.type == 865 || projectile1.type == 921 || projectile1.type == 926 || projectile1.type == 757 || projectile1.type == 25 || projectile1.type == 35 || projectile1.type == 63 || projectile1.type == 154 || projectile1.type == 247 || projectile1.type == 26 || projectile1.type == 928 || projectile1.type == 16 || projectile1.type == 34 || projectile1.type == 79 || projectile1.type == 936 || projectile1.type == 937 || projectile1.type == 938 || projectile1.type == 939 || projectile1.type == 940 || projectile1.type == 941 || projectile1.type == 942 || projectile1.type == 943 || projectile1.type == 944 || projectile1.type == 945 || (projectile1.type >= 776 && projectile1.type <= 801 || projectile1.type >= 803 && projectile1.type <= 810) && projectile1.type != 779 && projectile1.type != 783 && projectile1.type != 862 && projectile1.type != 863) { Vector2 position16 = projectile1.position + new Vector2((float) projectile1.width, (float) projectile1.height) / 2f + Vector2.UnitY * projectile1.gfxOffY - Main.screenPosition; Texture2D texture2D9 = TextureAssets.Projectile[projectile1.type].Value; Microsoft.Xna.Framework.Color color73 = projectile1.GetAlpha(color10); Vector2 origin9 = new Vector2((float) texture2D9.Width, (float) texture2D9.Height) / 2f; float rotation5 = projectile1.rotation; Vector2 scale8 = Vector2.One * projectile1.scale; Microsoft.Xna.Framework.Rectangle? sourceRectangle = new Microsoft.Xna.Framework.Rectangle?(); if (projectile1.type == 446) origin9.Y = 4f; if (projectile1.type == 865) { position16 += new Vector2(1f, -1f); spriteEffects = (double) projectile1.DirectionFrom(Main.player[projectile1.owner].Center).SafeNormalize(Vector2.Zero).X > 0.0 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; } if (projectile1.type == 16) { float lerpValue = Utils.GetLerpValue(0.0f, 8f, projectile1.velocity.Length(), true); rotation5 *= lerpValue; scale8 *= 0.6f; scale8.Y *= MathHelper.Lerp(1f, 0.8f, lerpValue); scale8.X *= MathHelper.Lerp(1f, 1.5f, lerpValue); } if (projectile1.type == 34) { float lerpValue = Utils.GetLerpValue(0.0f, 8f, projectile1.velocity.Length(), true); float num347 = rotation5 * lerpValue; scale8.X *= MathHelper.Lerp(1f, 0.8f, lerpValue); rotation5 = num347 + -1.570796f * lerpValue; sourceRectangle = new Microsoft.Xna.Framework.Rectangle?(texture2D9.Frame(verticalFrames: Main.projFrames[projectile1.type], frameY: projectile1.frame)); origin9 = sourceRectangle.Value.Size() / 2f; Vector2 vector2 = position16 - projectile1.velocity * 1f; position16 = projectile1.oldPos[0] + projectile1.Size / 2f - Main.screenPosition - projectile1.velocity / 2f; } if (projectile1.type == 79) { rotation5 = 0.0f; scale8 *= Utils.GetLerpValue(32f, 0.0f, projectile1.position.Distance(projectile1.oldPos[12]), true); color73 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0); } if (projectile1.type == 761 || projectile1.type == 762) spriteEffects = projectile1.spriteDirection > 0 ? SpriteEffects.None : SpriteEffects.FlipVertically; if (projectile1.type == 662 || projectile1.type == 685) origin9 = new Vector2(6f, 6f); if (projectile1.type == 699 || projectile1.type == 708) { Player player = Main.player[projectile1.owner]; origin9 = new Vector2(projectile1.spriteDirection == 1 ? (float) texture2D9.Width - -8f : -8f, (double) player.gravDir == 1.0 ? -8f : (float) texture2D9.Height - -8f); if ((double) player.gravDir == -1.0) { spriteEffects |= SpriteEffects.FlipVertically; rotation5 += 1.570796f * (float) -projectile1.spriteDirection; } } if (projectile1.type == 938 || projectile1.type == 939 || projectile1.type == 940 || projectile1.type == 941 || projectile1.type == 942 || projectile1.type == 943 || projectile1.type == 944 || projectile1.type == 945) rotation5 -= 0.7853982f * (float) projectile1.spriteDirection; if (projectile1.type == 502) { this.LoadProjectile(250); Texture2D texture = TextureAssets.Projectile[250].Value; Vector2 origin10 = new Vector2((float) (texture.Width / 2), 0.0f); Vector2 vector2_50 = new Vector2((float) projectile1.width, (float) projectile1.height) / 2f; Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; white.A = (byte) 127; for (int index = projectile1.oldPos.Length - 1; index > 0; --index) { Vector2 vector2_51 = projectile1.oldPos[index] + vector2_50; if (!(vector2_51 == vector2_50)) { Vector2 vector2_52 = projectile1.oldPos[index - 1] + vector2_50; float rotation6 = (vector2_52 - vector2_51).ToRotation() - 1.570796f; Vector2 scale9 = new Vector2(1f, Vector2.Distance(vector2_51, vector2_52) / (float) texture.Height); Microsoft.Xna.Framework.Color color74 = white * (float) (1.0 - (double) index / (double) projectile1.oldPos.Length); Main.EntitySpriteDraw(texture, vector2_51 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(), color74, rotation6, origin10, scale9, spriteEffects, 0); } } } else if (projectile1.type == 540 && projectile1.velocity != Vector2.Zero) { float num348 = 0.0f; if ((double) projectile1.ai[0] >= 10.0) num348 = (float) (((double) projectile1.ai[0] - 10.0) / 10.0); if ((double) projectile1.ai[0] >= 20.0) num348 = (float) ((20.0 - (double) projectile1.ai[0]) / 10.0); if ((double) num348 > 1.0) num348 = 1f; if ((double) num348 < 0.0) num348 = 0.0f; if ((double) num348 != 0.0) { Texture2D texture = TextureAssets.Extra[47].Value; Vector2 origin11 = new Vector2((float) (texture.Width / 2), 0.0f); Microsoft.Xna.Framework.Color color75 = color73 * num348 * 0.7f; Vector2 vector2_53 = projectile1.Center - Main.screenPosition; Vector2 vector2_54 = projectile1.velocity.ToRotation().ToRotationVector2() * (float) texture2D9.Width / 3f; Vector2 zero = Vector2.Zero; Vector2 position17 = vector2_53 + zero; float rotation7 = projectile1.velocity.ToRotation() - 1.570796f; Vector2 scale10 = new Vector2(1f, (projectile1.velocity.Length() - zero.Length() * 2f) / (float) texture.Height); Main.EntitySpriteDraw(texture, position17, new Microsoft.Xna.Framework.Rectangle?(), color75, rotation7, origin11, scale10, SpriteEffects.None, 0); } } if (projectile1.type == 578 || projectile1.type == 579 || projectile1.type == 641 || projectile1.type == 813) { Microsoft.Xna.Framework.Color color76 = color73 * 0.8f; color76.A /= (byte) 2; Microsoft.Xna.Framework.Color color77 = Microsoft.Xna.Framework.Color.Lerp(color73, Microsoft.Xna.Framework.Color.Black, 0.5f); color77.A = color73.A; float num349 = (float) (0.949999988079071 + (double) (projectile1.rotation * 0.75f).ToRotationVector2().Y * 0.100000001490116); Microsoft.Xna.Framework.Color color78 = color77 * num349; float scale11 = (float) (0.600000023841858 + (double) projectile1.scale * 0.600000023841858 * (double) num349); Texture2D texture2D10 = TextureAssets.Extra[50].Value; bool flag = true; if (projectile1.type == 813) { flag = false; texture2D10 = TextureAssets.Extra[131].Value; } Vector2 origin12 = texture2D10.Size() / 2f; Main.EntitySpriteDraw(texture2D10, position16, new Microsoft.Xna.Framework.Rectangle?(), color78, (float) (-(double) rotation5 + 0.349999994039536), origin12, scale11, spriteEffects ^ SpriteEffects.FlipHorizontally, 0); Main.EntitySpriteDraw(texture2D10, position16, new Microsoft.Xna.Framework.Rectangle?(), color73, -rotation5, origin12, projectile1.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0); if (flag) Main.EntitySpriteDraw(texture2D9, position16, new Microsoft.Xna.Framework.Rectangle?(), color76, (float) (-(double) rotation5 * 0.699999988079071), origin9, projectile1.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0); Main.EntitySpriteDraw(texture2D10, position16, new Microsoft.Xna.Framework.Rectangle?(), color73 * 0.8f, rotation5 * 0.5f, origin12, projectile1.scale * 0.9f, spriteEffects, 0); color73.A = (byte) 0; if (projectile1.type == 813) rotation5 = 0.0f; } if (projectile1.type == 617) { Microsoft.Xna.Framework.Color color79 = color73 * 0.8f; color79.A /= (byte) 2; Microsoft.Xna.Framework.Color color80 = Microsoft.Xna.Framework.Color.Lerp(color73, Microsoft.Xna.Framework.Color.Black, 0.5f); color80.A = color73.A; float num350 = (float) (0.949999988079071 + (double) (projectile1.rotation * 0.75f).ToRotationVector2().Y * 0.100000001490116); Microsoft.Xna.Framework.Color color81 = color80 * num350; float scale12 = (float) (0.600000023841858 + (double) projectile1.scale * 0.600000023841858 * (double) num350); Main.EntitySpriteDraw(TextureAssets.Extra[50].Value, position16, new Microsoft.Xna.Framework.Rectangle?(), color81, (float) (-(double) projectile1.rotation + 0.349999994039536), origin9, scale12, spriteEffects ^ SpriteEffects.FlipHorizontally, 0); Main.EntitySpriteDraw(TextureAssets.Extra[50].Value, position16, new Microsoft.Xna.Framework.Rectangle?(), color73, -projectile1.rotation, origin9, projectile1.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0); Main.EntitySpriteDraw(texture2D9, position16, new Microsoft.Xna.Framework.Rectangle?(), color79, (float) (-(double) projectile1.rotation * 0.699999988079071), origin9, projectile1.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0); Main.EntitySpriteDraw(TextureAssets.Extra[50].Value, position16, new Microsoft.Xna.Framework.Rectangle?(), color73 * 0.8f, projectile1.rotation * 0.5f, origin9, projectile1.scale * 0.9f, spriteEffects, 0); color73.A = (byte) 0; } if (projectile1.type == 757 || projectile1.type == 25 || projectile1.type == 35 || projectile1.type == 63 || projectile1.type == 154 || projectile1.type == 247 || projectile1.type == 26) { if ((double) projectile1.ai[0] == 1.0) { Microsoft.Xna.Framework.Color color82 = color73; color82.A = (byte) 127; color82 *= 0.5f; int num351 = (int) projectile1.ai[1]; if (num351 > 5) num351 = 5; for (float num352 = 1f; (double) num352 >= 0.0; num352 -= 0.125f) { float amount = 1f - num352; Vector2 vector2 = projectile1.velocity * (float) -num351 * num352; Main.EntitySpriteDraw(texture2D9, position16 + vector2, new Microsoft.Xna.Framework.Rectangle?(), color82 * amount, rotation5, origin9, projectile1.scale * 1.15f * MathHelper.Lerp(0.5f, 1f, amount), spriteEffects, 0); } } } else if (projectile1.type == 79) { Vector2 scale13 = scale8 * 1.4f; Vector2 spinningpoint = new Vector2((float) (2.0 * (double) scale13.X + Math.Cos((double) Main.GlobalTimeWrappedHourly * 6.28318548202515) * 0.400000005960464), 0.0f).RotatedBy((double) rotation5 + (double) Main.GlobalTimeWrappedHourly * 6.28318548202515); for (float Hue = 0.0f; (double) Hue < 1.0; Hue += 0.1666667f) { Microsoft.Xna.Framework.Color color83 = Main.hslToRgb(Hue, 1f, 0.5f) * 0.3f; color83.A = (byte) 0; Main.EntitySpriteDraw(texture2D9, position16 + spinningpoint.RotatedBy((double) Hue * 6.28318548202515), new Microsoft.Xna.Framework.Rectangle?(), color83, rotation5, origin9, scale13, spriteEffects, 0); } Main.EntitySpriteDraw(texture2D9, position16, new Microsoft.Xna.Framework.Rectangle?(), color73, rotation5, origin9, scale8, spriteEffects, 0); } if ((0 | (projectile1.type != 464 ? 0 : ((double) projectile1.ai[1] != 1.0 ? 1 : 0))) == 0) Main.EntitySpriteDraw(texture2D9, position16, sourceRectangle, color73, rotation5, origin9, scale8, spriteEffects, 0); if (projectile1.type == 464 && (double) projectile1.ai[1] != 1.0) { Texture2D texture2D11 = TextureAssets.Extra[35].Value; Microsoft.Xna.Framework.Rectangle r = texture2D11.Frame(verticalFrames: 3); origin9 = r.Size() / 2f; Vector2 spinningpoint = new Vector2(0.0f, -720f).RotatedBy((double) projectile1.velocity.ToRotation()) * (float) ((double) projectile1.ai[0] % 45.0 / 45.0); for (int index = 0; index < 6; ++index) { float num353 = (float) ((double) index * 6.28318548202515 / 6.0); Vector2 vector2 = projectile1.Center + spinningpoint.RotatedBy((double) num353); Main.EntitySpriteDraw(texture2D11, vector2 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(r), color73, (float) ((double) num353 + (double) projectile1.velocity.ToRotation() + 3.14159274101257), origin9, projectile1.scale, spriteEffects, 0); r.Y += r.Height; if (r.Y >= texture2D11.Height) r.Y = 0; } } else if (projectile1.type == 490) { Main.EntitySpriteDraw(TextureAssets.Extra[34].Value, position16, new Microsoft.Xna.Framework.Rectangle?(), color73, -projectile1.rotation, TextureAssets.Extra[34].Value.Size() / 2f, projectile1.scale, spriteEffects, 0); Main.EntitySpriteDraw(texture2D9, position16, new Microsoft.Xna.Framework.Rectangle?(), color73, projectile1.rotation, origin9, projectile1.scale * 0.42f, spriteEffects, 0); Main.EntitySpriteDraw(TextureAssets.Extra[34].Value, position16, new Microsoft.Xna.Framework.Rectangle?(), color73, -projectile1.rotation, TextureAssets.Extra[34].Value.Size() / 2f, projectile1.scale * 0.42f, spriteEffects, 0); } else if (projectile1.type == 616) Main.EntitySpriteDraw(TextureAssets.GlowMask[193].Value, position16, new Microsoft.Xna.Framework.Rectangle?(), new Microsoft.Xna.Framework.Color((int) sbyte.MaxValue, (int) sbyte.MaxValue, (int) sbyte.MaxValue, 0), projectile1.rotation, origin9, projectile1.scale, spriteEffects, 0); else if (projectile1.type >= 646 && projectile1.type <= 649) Main.EntitySpriteDraw(TextureAssets.GlowMask[203 + projectile1.type - 646].Value, position16, new Microsoft.Xna.Framework.Rectangle?(), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue), projectile1.rotation, origin9, projectile1.scale, spriteEffects, 0); else if (projectile1.type == 699) Main.EntitySpriteDraw(TextureAssets.GlowMask[231].Value, position16, new Microsoft.Xna.Framework.Rectangle?(), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue), rotation5, origin9, projectile1.scale, spriteEffects, 0); else if (projectile1.type == 707 || projectile1.type == 708) { float num354 = 0.5f; Texture2D texture2D12 = TextureAssets.GlowMask[232].Value; Microsoft.Xna.Framework.Rectangle rectangle = texture2D12.Frame(verticalFrames: 3, frameY: ((int) ((double) projectile1.ai[0] % 9.0) / 3)); if (projectile1.type == 708) { rectangle = texture2D12.Frame(verticalFrames: 3, frameY: (Main.player[projectile1.owner].itemAnimation % 9 / 3)); num354 = 0.75f; } Microsoft.Xna.Framework.Color color84 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue) * num354; Vector2 spinningpoint = new Vector2(2f, 0.0f).RotatedBy((double) projectile1.rotation); for (float num355 = 0.0f; (double) num355 < 4.0; ++num355) Main.EntitySpriteDraw(texture2D12, position16 + spinningpoint.RotatedBy((double) num355 * 1.57079637050629), new Microsoft.Xna.Framework.Rectangle?(rectangle), color84 * 0.5f, projectile1.rotation, origin9, projectile1.scale, spriteEffects, 0); Main.EntitySpriteDraw(texture2D12, position16, new Microsoft.Xna.Framework.Rectangle?(rectangle), color84, projectile1.rotation, origin9, projectile1.scale, spriteEffects, 0); } else if (projectile1.type == 719) { Microsoft.Xna.Framework.Color color85 = new Microsoft.Xna.Framework.Color(80, 80, 80, (int) byte.MaxValue) * 0.3f; float scale14 = projectile1.scale * 1.5f; Vector2 spinningpoint = new Vector2(2f * scale14, 0.0f).RotatedBy((double) projectile1.rotation); for (float num356 = 0.0f; (double) num356 < 4.0; ++num356) Main.EntitySpriteDraw(texture2D9, position16 + -projectile1.velocity * num356 * 1.25f, new Microsoft.Xna.Framework.Rectangle?(), color85 * 0.7f, projectile1.rotation, origin9, scale14, spriteEffects, 0); for (float num357 = 0.0f; (double) num357 < 3.0; ++num357) Main.EntitySpriteDraw(texture2D9, position16 + spinningpoint.RotatedBy((double) num357 * 1.57079637050629), new Microsoft.Xna.Framework.Rectangle?(), color85 * 0.9f, projectile1.rotation, origin9, scale14, spriteEffects, 0); Main.EntitySpriteDraw(texture2D9, position16, new Microsoft.Xna.Framework.Rectangle?(), color73, projectile1.rotation, origin9, projectile1.scale, spriteEffects, 0); } else if (projectile1.type == 16) { Microsoft.Xna.Framework.Color color86 = new Microsoft.Xna.Framework.Color(80, 80, 80, 0); Vector2 scale15 = scale8 + scale8 * (float) Math.Cos((double) Main.GlobalTimeWrappedHourly * 6.28318548202515) * 0.4f; Vector2 spinningpoint = new Vector2(2f * scale15.X, 0.0f).RotatedBy((double) rotation5); for (float num358 = 0.0f; (double) num358 < 1.0; num358 += 0.25f) Main.EntitySpriteDraw(texture2D9, position16 + spinningpoint.RotatedBy((double) num358 * 6.28318548202515), new Microsoft.Xna.Framework.Rectangle?(), color86, rotation5, origin9, scale15, spriteEffects, 0); Main.EntitySpriteDraw(texture2D9, position16, new Microsoft.Xna.Framework.Rectangle?(), color73, rotation5, origin9, scale8, spriteEffects, 0); } else { if (projectile1.type != 34) return; float lerpValue = Utils.GetLerpValue(0.0f, 6f, projectile1.localAI[0], true); Microsoft.Xna.Framework.Color color87 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue) * 0.75f; Vector2 scale16 = new Vector2(lerpValue); Vector2 spinningpoint = new Vector2(4f * scale16.X, 0.0f).RotatedBy((double) rotation5); for (float num359 = 0.0f; (double) num359 < 1.0; num359 += 0.25f) Main.EntitySpriteDraw(texture2D9, position16 + spinningpoint.RotatedBy((double) num359 * 6.28318548202515), sourceRectangle, color87, rotation5, origin9, scale16, spriteEffects, 0); } } else if (projectile1.type == 465 || projectile1.type == 467 || projectile1.type == 468 || projectile1.type == 500 || projectile1.type == 518 || projectile1.type == 535 || projectile1.type == 539 || projectile1.type == 575 || projectile1.type == 574 || projectile1.type == 589 || projectile1.type == 590 || projectile1.type == 593 || projectile1.type == 602 || projectile1.type == 596 || projectile1.type == 612 || projectile1.type == 613 || projectile1.type == 614 || projectile1.type == 623 || projectile1.type == 625 || projectile1.type == 626 || projectile1.type == 627 || projectile1.type == 628 || projectile1.type == 634 || projectile1.type == 635 || projectile1.type == 643 || projectile1.type == 644 || projectile1.type == 645 || projectile1.type == 650 || projectile1.type == 652 || projectile1.type == 658 || projectile1.type == 659 || projectile1.type == 663 || projectile1.type == 665 || projectile1.type == 667 || projectile1.type == 677 || projectile1.type == 678 || projectile1.type == 679 || projectile1.type == 691 || projectile1.type == 692 || projectile1.type == 693 || projectile1.type == 702 || projectile1.type == 703 || projectile1.type == 701 || projectile1.type == 712 || projectile1.type == 715 || projectile1.type == 716 || projectile1.type == 717 || projectile1.type == 718 || projectile1.type == 758 || projectile1.type == 759 || projectile1.type == 764 || projectile1.type == 779 || projectile1.type == 783 || projectile1.type == 773 || projectile1.type == 820 || projectile1.type == 831 || projectile1.type == 836 || projectile1.type == 851 || projectile1.type == 855 || projectile1.type == 856 || projectile1.type == 857 || projectile1.type == 861 || projectile1.type == 862 || projectile1.type == 863 || projectile1.type == 866 || projectile1.type == 870 || projectile1.type == 882 || projectile1.type == 885 || projectile1.type == 889 || projectile1.type == 895 || projectile1.type == 896 || projectile1.type == 898 || projectile1.type == 903 || projectile1.type == 904 || projectile1.type == 905 || projectile1.type == 906 || projectile1.type == 908 || projectile1.type == 910 || projectile1.type == 911) { Vector2 vector2_55 = projectile1.position + new Vector2((float) projectile1.width, (float) projectile1.height) / 2f + Vector2.UnitY * projectile1.gfxOffY - Main.screenPosition; Texture2D target = TextureAssets.Projectile[projectile1.type].Value; Microsoft.Xna.Framework.Rectangle r = target.Frame(verticalFrames: Main.projFrames[projectile1.type], frameY: projectile1.frame); Microsoft.Xna.Framework.Color color88 = projectile1.GetAlpha(color10); Vector2 origin13 = r.Size() / 2f; if (projectile1.type == 703) r.Height -= 2; if (projectile1.type == 895 || projectile1.type == 896 || projectile1.type == 898) vector2_55.Y += (float) (Math.Cos((double) Main.mouseTextColor / (double) byte.MaxValue * 6.28318548202515 * 2.0) * 4.0) - 2f; if (projectile1.type == 855) { float y17 = ((float) ((double) Main.GlobalTimeWrappedHourly % 6.0 / 6.0 * 6.28318548202515)).ToRotationVector2().Y; float num360 = (float) ((double) y17 * 0.300000011920929 + 0.699999988079071); Microsoft.Xna.Framework.Color color89 = color88 * num360 * 0.3f; for (int index = 0; index < 4; ++index) { float x19 = 0.0f; float y18 = 0.0f; switch (index) { case 0: x19 = 4f; break; case 1: x19 = -4f; break; case 2: y18 = 4f; break; case 3: y18 = -4f; break; } Vector2 vector2_56 = new Vector2(x19, y18).RotatedBy(6.28318548202515 * (double) i + (double) projectile1.rotation) * y17; Main.spriteBatch.Draw(target, vector2_55 + vector2_56, new Microsoft.Xna.Framework.Rectangle?(r), color89, projectile1.rotation, r.Size() / 2f, 1f, SpriteEffects.None, 0.0f); } } else if (projectile1.type == 908) { PlayerTitaniumStormBuffTextureContent titaniumStormBuff = TextureAssets.RenderTargets.PlayerTitaniumStormBuff; vector2_55 += (Main.GlobalTimeWrappedHourly * 8f + (float) projectile1.whoAmI).ToRotationVector2() * 4f; titaniumStormBuff.Request(); if (titaniumStormBuff.IsReady) target = (Texture2D) titaniumStormBuff.GetTarget(); r = target.Frame(Main.projFrames[projectile1.type], frameX: projectile1.frame); origin13 = r.Size() / 2f; } else if (projectile1.type == 764) this.DrawProjWithStarryTrail(projectile1, color10, spriteEffects); else if (projectile1.type == 856) this.DrawProjWithStarryTrail(projectile1, color10, spriteEffects); else if (projectile1.type == 857) { this.DrawProjWithStarryTrail(projectile1, color10, spriteEffects); color88 = Microsoft.Xna.Framework.Color.White * projectile1.Opacity * 0.9f; color88.A /= (byte) 2; r = target.Frame(15, frameX: projectile1.frame); origin13 = r.Size() / 2f; Main.DrawPrettyStarSparkle(projectile1, spriteEffects, vector2_55, color88, projectile1.GetFirstFractalColor()); } else if (projectile1.type == 539) { if ((double) projectile1.ai[0] >= 210.0) { float num361 = (projectile1.ai[0] - 210f) / 20f; if ((double) num361 > 1.0) num361 = 1f; Main.EntitySpriteDraw(TextureAssets.Extra[46].Value, vector2_55, new Microsoft.Xna.Framework.Rectangle?(), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 128) * num361, projectile1.rotation, new Vector2(17f, 22f), projectile1.scale, spriteEffects, 0); } } else if (projectile1.type == 773) origin13.Y = (float) (r.Height - 12); else if (projectile1.type == 866) origin13.X += 14f; else if (projectile1.type == 759) { origin13.Y = (float) (r.Height - 2); origin13.X += spriteEffects.HasFlag((Enum) SpriteEffects.FlipHorizontally) ? 1f : -1f; } else if (projectile1.type == 758) { vector2_55.Y += (float) (projectile1.height / 2); origin13 = r.Size() * new Vector2(0.5f, 1f); origin13.Y -= 4f; } else if (projectile1.type == 833) { if (projectile1.frame != 8) { vector2_55.Y += (float) (projectile1.height / 2); origin13 = r.Size() * new Vector2(0.5f, 1f); origin13.Y -= 4f; origin13.X -= (float) (7 * spriteEffects.HasFlag((Enum) SpriteEffects.FlipHorizontally).ToDirectionInt()); } } else if (projectile1.type == 834 || projectile1.type == 835) { if (projectile1.frame != 10) { vector2_55.Y += (float) (projectile1.height / 2); origin13 = r.Size() * new Vector2(0.5f, 1f); origin13.Y -= 4f; origin13.X -= (float) (2 * spriteEffects.HasFlag((Enum) SpriteEffects.FlipHorizontally).ToDirectionInt()); } } else if (projectile1.type == 715 || projectile1.type == 716 || projectile1.type == 717 || projectile1.type == 718) { r = target.Frame(3); origin13 = r.Size() / 2f; int num362 = (int) projectile1.ai[0]; Vector2 origin14 = new Vector2((float) (r.Width / 2), 0.0f); Vector2 vector2_57 = projectile1.Size / 2f; Microsoft.Xna.Framework.Color celeb2Color = projectile1.GetCeleb2Color(); celeb2Color.A = (byte) 127; Microsoft.Xna.Framework.Color color90 = celeb2Color * 0.8f; Microsoft.Xna.Framework.Rectangle rectangle = r; rectangle.X += rectangle.Width * 2; for (int index = projectile1.oldPos.Length - 1; index > 0; --index) { Vector2 vector2_58 = projectile1.oldPos[index] + vector2_57; if (!(vector2_58 == vector2_57)) { Vector2 vector2_59 = projectile1.oldPos[index - 1] + vector2_57; float num363 = projectile1.oldRot[index]; Vector2 scale = new Vector2(Vector2.Distance(vector2_58, vector2_59) / (float) r.Width, 1f); Microsoft.Xna.Framework.Color color91 = color90 * (float) (1.0 - (double) index / (double) projectile1.oldPos.Length); switch (num362) { case 2: Vector2 rotationVector2 = num363.ToRotationVector2(); int num364 = index + projectile1.timeLeft; if (num364 < 0) num364 += 20 * (num364 / -20) + 20; int num365 = num364 % 20; float num366 = 0.0f; scale *= 0.6f; switch (num365) { case 1: num366 = 1f; break; case 2: num366 = 2f; break; case 3: num366 = 3f; break; case 4: num366 = 2f; break; case 5: num366 = 1f; break; case 7: num366 = -1f; break; case 8: num366 = -2f; break; case 9: num366 = -3f; break; case 10: num366 = -2f; break; case 11: num366 = -1f; break; } vector2_58 += rotationVector2 * num366 * 4f; break; case 5: scale *= 0.5f; break; } Main.EntitySpriteDraw(target, vector2_58 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangle), color91, num363, origin14, scale, spriteEffects, 0); } } } else if (projectile1.type == 663 || projectile1.type == 665 || projectile1.type == 667) { vector2_55 = projectile1.Bottom + Vector2.UnitY * projectile1.gfxOffY - Main.screenPosition; origin13 = r.Size() * new Vector2(0.5f, 1f); origin13.Y -= 2f; origin13.Y -= 2f; } else if (projectile1.type == 691 || projectile1.type == 692 || projectile1.type == 693) { vector2_55 = projectile1.Bottom + Vector2.UnitY * projectile1.gfxOffY - Main.screenPosition; origin13 = r.Size() * new Vector2(0.5f, 1f); origin13.Y -= 2f; origin13.Y -= 2f; } else if (projectile1.type == 677 || projectile1.type == 678 || projectile1.type == 679) { if (projectile1.spriteDirection == -1) spriteEffects ^= SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically; Texture2D texture2D = TextureAssets.Extra[83].Value; if (projectile1.type == 678) texture2D = TextureAssets.Extra[84].Value; if (projectile1.type == 679) texture2D = TextureAssets.Extra[85].Value; Vector2 position = projectile1.Bottom + Vector2.UnitY * projectile1.gfxOffY - Main.screenPosition; Vector2 origin15 = texture2D.Size() * new Vector2(0.5f, 1f); origin15.Y -= 2f; Main.EntitySpriteDraw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(), color88, 0.0f, origin15, 1f, spriteEffects & SpriteEffects.FlipHorizontally, 0); origin13.X += (float) spriteEffects.HasFlag((Enum) SpriteEffects.FlipHorizontally).ToDirectionInt(); ++vector2_55.Y; vector2_55.Y += 2f; if (projectile1.type == 678) vector2_55.Y += -4f; if (projectile1.type == 679) { vector2_55.Y -= 2f; if (!spriteEffects.HasFlag((Enum) SpriteEffects.FlipVertically)) origin13.Y += 4f; else origin13.Y -= 4f; origin13.X += (float) (spriteEffects.HasFlag((Enum) SpriteEffects.FlipHorizontally).ToDirectionInt() * 4); } } else if (projectile1.type == 602) { origin13.X = (float) (r.Width - 6); --origin13.Y; r.Height -= 2; } else if (projectile1.type == 589) { r = target.Frame(5, frameX: ((int) projectile1.ai[1])); origin13 = r.Size() / 2f; } else if (projectile1.type == 590) { r = target.Frame(3, frameX: projectile1.frame); origin13 = r.Size() / 2f; } else if (projectile1.type == 836) { r = target.Frame(4, frameX: projectile1.frame); origin13 = r.Size() / 2f; } else if (projectile1.type == 650 || projectile1.type == 882 || projectile1.type == 888 || projectile1.type == 894 || projectile1.type == 895 || projectile1.type == 896 || projectile1.type == 898 || projectile1.type == 901) origin13.Y -= 4f; else if (projectile1.type == 623) { if ((double) projectile1.ai[0] == 2.0) vector2_55 += Main.rand.NextVector2Circular(2f, 2f); if (Main.CurrentDrawnEntityShader == 0) color88.A /= (byte) 2; } else if (projectile1.type >= 625 && projectile1.type <= 628) color88.A /= (byte) 2; else if (projectile1.type == 644) { Microsoft.Xna.Framework.Color color92 = Main.hslToRgb(projectile1.ai[0], 1f, 0.5f).MultiplyRGBA(new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0)); Main.EntitySpriteDraw(target, vector2_55, new Microsoft.Xna.Framework.Rectangle?(r), color92, projectile1.rotation, origin13, projectile1.scale * 2f, spriteEffects, 0); Main.EntitySpriteDraw(target, vector2_55, new Microsoft.Xna.Framework.Rectangle?(r), color92, 0.0f, origin13, projectile1.scale * 2f, spriteEffects, 0); if ((double) projectile1.ai[1] != -1.0 && (double) projectile1.Opacity > 0.300000011920929) { Vector2 v = Main.projectile[(int) projectile1.ai[1]].Center - projectile1.Center; Vector2 scale = new Vector2(1f, v.Length() / (float) target.Height); float rotation = v.ToRotation() + 1.570796f; float num367 = MathHelper.Clamp(MathHelper.Distance(30f, projectile1.localAI[1]) / 20f, 0.0f, 1f); if ((double) num367 > 0.0) { Main.EntitySpriteDraw(target, vector2_55 + v / 2f, new Microsoft.Xna.Framework.Rectangle?(r), color92 * num367, rotation, origin13, scale, spriteEffects, 0); Main.EntitySpriteDraw(target, vector2_55 + v / 2f, new Microsoft.Xna.Framework.Rectangle?(r), color88 * num367, rotation, origin13, scale / 2f, spriteEffects, 0); } } } else if (projectile1.type == 658) { Microsoft.Xna.Framework.Color color93 = Main.hslToRgb(0.136f, 1f, 0.5f).MultiplyRGBA(new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0)); Main.EntitySpriteDraw(target, vector2_55, new Microsoft.Xna.Framework.Rectangle?(r), color93, 0.0f, origin13, new Vector2(1f, 5f) * projectile1.scale * 2f, spriteEffects, 0); } Main.EntitySpriteDraw(target, vector2_55, new Microsoft.Xna.Framework.Rectangle?(r), color88, projectile1.rotation, origin13, projectile1.scale, spriteEffects, 0); if (projectile1.type == 896) { Texture2D texture = TextureAssets.GlowMask[278].Value; Microsoft.Xna.Framework.Color color94 = new Microsoft.Xna.Framework.Color(150, 150, 150, 100); for (int index = 0; index < 2; ++index) { Vector2 position = vector2_55 + new Vector2((float) Main.rand.Next(-10, 11) * 0.1f, (float) Main.rand.Next(-10, 11) * 0.1f); Main.EntitySpriteDraw(texture, position, new Microsoft.Xna.Framework.Rectangle?(r), color94, projectile1.rotation, origin13, projectile1.scale, spriteEffects, 0); } Main.EntitySpriteDraw(texture, vector2_55, new Microsoft.Xna.Framework.Rectangle?(r), Microsoft.Xna.Framework.Color.White, projectile1.rotation, origin13, projectile1.scale, spriteEffects, 0); } if (projectile1.type == 889) { Texture2D texture = TextureAssets.GlowMask[276].Value; Microsoft.Xna.Framework.Color color95 = Microsoft.Xna.Framework.Color.White * (float) Main.mouseTextColor; Main.EntitySpriteDraw(texture, vector2_55, new Microsoft.Xna.Framework.Rectangle?(r), color95, projectile1.rotation, origin13, projectile1.scale, spriteEffects, 0); for (int index = 0; index < 4; ++index) { int num368 = 28; int frameY = 7 + index; float num369 = 100f; bool flag = frameY == 8; Microsoft.Xna.Framework.Rectangle rectangle = target.Frame(verticalFrames: Main.projFrames[projectile1.type], frameY: frameY); Vector2 vector2_60 = vector2_55; Vector2 vector2_61 = vector2_55; SpriteEffects effects = SpriteEffects.None; float num370 = Main.GlobalTimeWrappedHourly * 2f; switch (index - 1) { case 0: num370 += 1.570796f; break; case 1: num370 += 3.141593f; break; case 2: num370 += 4.712389f; break; } float f = num370 * 3f; float rotation8 = f; Vector2 position18 = vector2_61 + f.ToRotationVector2() * (float) num368; if ((double) projectile1.localAI[0] == (double) num369) { Main.EntitySpriteDraw(target, position18, new Microsoft.Xna.Framework.Rectangle?(rectangle), color88, rotation8, origin13, projectile1.scale, effects, 0); if (flag) Main.EntitySpriteDraw(texture, position18, new Microsoft.Xna.Framework.Rectangle?(rectangle), color95, rotation8, origin13, projectile1.scale, effects, 0); } else { Vector2 vector2_62 = new Vector2((float) num368, -16f) + projectile1.velocity * 1.5f; float num371 = 4f; float num372 = -0.35f; switch (index) { case 1: vector2_62.X *= -1f; effects = SpriteEffects.FlipHorizontally; num372 = 0.35f; num371 = -3f; break; case 2: vector2_62.Y = 16f; num372 = 0.35f; num371 = 2f; break; case 3: vector2_62.X *= -1f; vector2_62.Y = 16f; effects = SpriteEffects.FlipHorizontally; num372 = -0.35f; num371 = -1f; break; } Vector2 vector2_63 = vector2_62 + (Main.GlobalTimeWrappedHourly * num371).ToRotationVector2() * 4f; Vector2 vector2_64 = vector2_60 + vector2_63; float amount = projectile1.localAI[0] / num369; Vector2 position19 = Vector2.Lerp(vector2_64, position18, amount); float rotation9 = (double) amount > 0.5 ? f : num372; Main.EntitySpriteDraw(target, position19, new Microsoft.Xna.Framework.Rectangle?(rectangle), color88, rotation9, origin13, projectile1.scale, effects, 0); if (flag) Main.EntitySpriteDraw(texture, position19, new Microsoft.Xna.Framework.Rectangle?(rectangle), color95, rotation9, origin13, projectile1.scale, effects, 0); } } } if (projectile1.type == 885) { for (int index = 0; index < 2; ++index) { SpriteEffects effects = SpriteEffects.None; int num373 = -30; if (index == 1) { num373 = 30; effects = SpriteEffects.FlipHorizontally; } int num374 = (int) projectile1.localAI[0]; if (projectile1.frame == 6) num374 = 0; else if (index == 1) num374 = 2 - num374; int frameY = num374 + 7; Microsoft.Xna.Framework.Rectangle rectangle = target.Frame(verticalFrames: Main.projFrames[projectile1.type], frameY: frameY); Vector2 vector2_65 = vector2_55 + new Vector2((float) num373, 0.0f); Vector2 vector2_66 = (Main.GlobalTimeWrappedHourly * 2f).ToRotationVector2() * 4f + projectile1.velocity * -1.5f; Vector2 vector2_67 = (Main.GlobalTimeWrappedHourly * 1f).ToRotationVector2() * 3f; Vector2 position = index != 1 ? vector2_65 - vector2_66 : vector2_65 + (vector2_66 + vector2_67); Main.EntitySpriteDraw(target, position, new Microsoft.Xna.Framework.Rectangle?(rectangle), color88, 0.0f, origin13, projectile1.scale, effects, 0); } } if (projectile1.type == 535) { for (int i2 = 0; i2 < 1000; ++i2) { if (Main.projectile[i2].active && Main.projectile[i2].owner == projectile1.owner && Main.projectile[i2].type == 536) this.DrawProj(i2); } } else if (projectile1.type == 715 || projectile1.type == 716 || projectile1.type == 717 || projectile1.type == 718) { r.X += r.Width; Microsoft.Xna.Framework.Color celeb2Color = projectile1.GetCeleb2Color(); celeb2Color.A = (byte) 80; Main.EntitySpriteDraw(target, vector2_55, new Microsoft.Xna.Framework.Rectangle?(r), celeb2Color, projectile1.rotation, origin13, projectile1.scale, spriteEffects, 0); } else if (projectile1.type == 702) { Texture2D texture2D = TextureAssets.Flames[5].Value; Vector2 origin16 = texture2D.Size() / 2f; Vector2 vector2_68 = new Vector2((float) (5 * projectile1.spriteDirection), -10f).RotatedBy((double) projectile1.rotation); ulong seed = (ulong) ((double) projectile1.localAI[0] / 4.0); for (int index = 0; index < 5; ++index) { Microsoft.Xna.Framework.Color color96 = new Microsoft.Xna.Framework.Color(100, 100, 100, 0); float x20 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.15f; float y = (float) Utils.RandomInt(ref seed, -10, 1) * 0.35f; Main.EntitySpriteDraw(texture2D, vector2_55 + vector2_68 + new Vector2(x20, y), new Microsoft.Xna.Framework.Rectangle?(), color96, projectile1.rotation, origin16, 1f, spriteEffects, 0); } } else if (projectile1.type == 663 || projectile1.type == 665 || projectile1.type == 667) { Texture2D texture = TextureAssets.GlowMask[221].Value; switch (projectile1.type) { case 665: texture = TextureAssets.GlowMask[222].Value; break; case 667: texture = TextureAssets.GlowMask[223].Value; break; } float num375 = (float) ((double) ((float) ((double) projectile1.localAI[0] / 100.0 * 6.28318548202515)).ToRotationVector2().X * 1.0 + 1.0); Microsoft.Xna.Framework.Color color97 = new Microsoft.Xna.Framework.Color(140, 100, 40, 0) * (float) ((double) num375 / 4.0 + 0.5) * 1f; for (float num376 = 0.0f; (double) num376 < 4.0; ++num376) Main.EntitySpriteDraw(texture, vector2_55 + (num376 * 1.570796f).ToRotationVector2() * num375, new Microsoft.Xna.Framework.Rectangle?(r), color97, projectile1.rotation, origin13, projectile1.scale, spriteEffects, 0); } else if (projectile1.type == 644) Main.EntitySpriteDraw(target, vector2_55, new Microsoft.Xna.Framework.Rectangle?(r), color88, 0.0f, origin13, projectile1.scale, spriteEffects, 0); else if (projectile1.type == 773 && (double) projectile1.velocity.Length() == 0.0) { Texture2D texture = TextureAssets.GlowMask[266].Value; Microsoft.Xna.Framework.Color color98 = Microsoft.Xna.Framework.Color.White * (float) Main.mouseTextColor; Vector2 position = vector2_55; Microsoft.Xna.Framework.Rectangle? sourceRectangle = new Microsoft.Xna.Framework.Rectangle?(r); Microsoft.Xna.Framework.Color color99 = color98; double rotation = (double) projectile1.rotation; Vector2 origin17 = origin13; double scale = (double) projectile1.scale; int num377 = (int) spriteEffects; Main.EntitySpriteDraw(texture, position, sourceRectangle, color99, (float) rotation, origin17, (float) scale, (SpriteEffects) num377, 0); } else if (projectile1.type == 658) Main.EntitySpriteDraw(target, vector2_55, new Microsoft.Xna.Framework.Rectangle?(r), color88, 0.0f, origin13, new Vector2(1f, 8f) * projectile1.scale, spriteEffects, 0); else if (projectile1.type == 602) { Texture2D texture2D13 = TextureAssets.Extra[60].Value; Microsoft.Xna.Framework.Color color100 = color88; color100.A = (byte) 0; color100 *= 0.3f; origin13 = texture2D13.Size() / 2f; Main.EntitySpriteDraw(texture2D13, vector2_55, new Microsoft.Xna.Framework.Rectangle?(), color100, projectile1.rotation - 1.570796f, origin13, projectile1.scale, spriteEffects, 0); Texture2D texture2D14 = TextureAssets.Extra[59].Value; color100 = color88; color100.A = (byte) 0; color100 *= 0.13f; origin13 = texture2D14.Size() / 2f; Main.EntitySpriteDraw(texture2D14, vector2_55, new Microsoft.Xna.Framework.Rectangle?(), color100, projectile1.rotation - 1.570796f, origin13, projectile1.scale * 0.9f, spriteEffects, 0); } else if (projectile1.type == 539) Main.EntitySpriteDraw(TextureAssets.GlowMask[140].Value, vector2_55, new Microsoft.Xna.Framework.Rectangle?(r), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), projectile1.rotation, origin13, projectile1.scale, spriteEffects, 0); else if (projectile1.type == 613) Main.EntitySpriteDraw(TextureAssets.GlowMask[189].Value, vector2_55, new Microsoft.Xna.Framework.Rectangle?(r), new Microsoft.Xna.Framework.Color(128 - projectile1.alpha / 2, 128 - projectile1.alpha / 2, 128 - projectile1.alpha / 2, 0), projectile1.rotation, origin13, projectile1.scale, spriteEffects, 0); else if (projectile1.type == 614) Main.EntitySpriteDraw(TextureAssets.GlowMask[190].Value, vector2_55, new Microsoft.Xna.Framework.Rectangle?(r), new Microsoft.Xna.Framework.Color(128 - projectile1.alpha / 2, 128 - projectile1.alpha / 2, 128 - projectile1.alpha / 2, 0), projectile1.rotation, origin13, projectile1.scale, spriteEffects, 0); else if (projectile1.type == 574) Main.EntitySpriteDraw(TextureAssets.GlowMask[148].Value, vector2_55, new Microsoft.Xna.Framework.Rectangle?(r), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), projectile1.rotation, origin13, projectile1.scale, spriteEffects, 0); else if (projectile1.type == 691 || projectile1.type == 692 || projectile1.type == 693) { Texture2D texture = TextureAssets.GlowMask[235].Value; switch (projectile1.type) { case 692: texture = TextureAssets.GlowMask[236].Value; break; case 693: texture = TextureAssets.GlowMask[237].Value; break; } Main.EntitySpriteDraw(texture, vector2_55, new Microsoft.Xna.Framework.Rectangle?(r), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue), projectile1.rotation, origin13, projectile1.scale, spriteEffects, 0); } else if (projectile1.type == 590) Main.EntitySpriteDraw(TextureAssets.GlowMask[168].Value, vector2_55, new Microsoft.Xna.Framework.Rectangle?(r), new Microsoft.Xna.Framework.Color((int) sbyte.MaxValue - projectile1.alpha / 2, (int) sbyte.MaxValue - projectile1.alpha / 2, (int) sbyte.MaxValue - projectile1.alpha / 2, 0), projectile1.rotation, origin13, projectile1.scale, spriteEffects, 0); else if (projectile1.type == 623 || projectile1.type >= 625 && projectile1.type <= 628) { if ((double) Main.player[projectile1.owner].ghostFade != 0.0) { float num378 = Main.player[projectile1.owner].ghostFade * 5f; for (float num379 = 0.0f; (double) num379 < 4.0; ++num379) Main.EntitySpriteDraw(target, vector2_55 + Vector2.UnitY.RotatedBy((double) num379 * 6.28318548202515 / 4.0) * num378, new Microsoft.Xna.Framework.Rectangle?(r), color88 * 0.1f, projectile1.rotation, origin13, projectile1.scale, spriteEffects, 0); } if (projectile1.type != 623 || (double) projectile1.ai[0] != 2.0 || projectile1.frame < 14) return; this.DrawProj_StardustGuardianPunching(projectile1); } else if (projectile1.type == 643) { float num380 = (float) (Math.Cos(6.28318548202515 * ((double) projectile1.localAI[0] / 60.0)) + 3.0 + 3.0); for (float num381 = 0.0f; (double) num381 < 4.0; ++num381) Main.EntitySpriteDraw(target, vector2_55 + Vector2.UnitY.RotatedBy((double) num381 * 1.57079637050629) * num380, new Microsoft.Xna.Framework.Rectangle?(r), color88 * 0.2f, projectile1.rotation, origin13, projectile1.scale, spriteEffects, 0); } else { if (projectile1.type != 650) return; int num382 = (int) ((double) projectile1.localAI[0] / 6.28318548202515); float f = (float) ((double) projectile1.localAI[0] % 6.28318548202515 - 3.14159274101257); float num383 = (float) Math.IEEERemainder((double) projectile1.localAI[1], 1.0); if ((double) num383 < 0.0) ++num383; int num384 = (int) Math.Floor((double) projectile1.localAI[1]); float num385 = 5f; float scale = (float) (1.0 + (double) num384 * 0.0199999995529652); if ((double) num382 == 1.0) num385 = 7f; Vector2 vector2_69 = f.ToRotationVector2() * num383 * num385 * projectile1.scale; Texture2D texture2D = TextureAssets.Extra[66].Value; Main.EntitySpriteDraw(texture2D, vector2_55 + vector2_69, new Microsoft.Xna.Framework.Rectangle?(), color88, projectile1.rotation, texture2D.Size() / 2f, scale, SpriteEffects.None, 0); } } else if (projectile1.type == 466) { Vector2 end1 = projectile1.position + new Vector2((float) projectile1.width, (float) projectile1.height) / 2f + Vector2.UnitY * projectile1.gfxOffY - Main.screenPosition; Texture2D tex = TextureAssets.Extra[33].Value; projectile1.GetAlpha(color10); Vector2 vector2 = new Vector2(projectile1.scale) / 2f; for (int index3 = 0; index3 < 3; ++index3) { Vector2 scale; if (index3 == 0) { scale = new Vector2(projectile1.scale) * 0.6f; DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(115, 204, 219, 0) * 0.5f; } else if (index3 == 1) { scale = new Vector2(projectile1.scale) * 0.4f; DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(113, 251, (int) byte.MaxValue, 0) * 0.5f; } else { scale = new Vector2(projectile1.scale) * 0.2f; DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0) * 0.5f; } DelegateMethods.f_1 = 1f; for (int index4 = projectile1.oldPos.Length - 1; index4 > 0; --index4) { if (!(projectile1.oldPos[index4] == Vector2.Zero)) { Vector2 start = projectile1.oldPos[index4] + new Vector2((float) projectile1.width, (float) projectile1.height) / 2f + Vector2.UnitY * projectile1.gfxOffY - Main.screenPosition; Vector2 end2 = projectile1.oldPos[index4 - 1] + new Vector2((float) projectile1.width, (float) projectile1.height) / 2f + Vector2.UnitY * projectile1.gfxOffY - Main.screenPosition; Utils.DrawLaser(Main.spriteBatch, tex, start, end2, scale, new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); } } if (projectile1.oldPos[0] != Vector2.Zero) { DelegateMethods.f_1 = 1f; Vector2 start = projectile1.oldPos[0] + new Vector2((float) projectile1.width, (float) projectile1.height) / 2f + Vector2.UnitY * projectile1.gfxOffY - Main.screenPosition; Utils.DrawLaser(Main.spriteBatch, tex, start, end1, scale, new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); } } } else if (projectile1.type == 580) { Vector2 end3 = projectile1.position + new Vector2((float) projectile1.width, (float) projectile1.height) / 2f + Vector2.UnitY * projectile1.gfxOffY - Main.screenPosition; Texture2D tex = TextureAssets.Extra[33].Value; projectile1.GetAlpha(color10); Vector2 vector2 = new Vector2(projectile1.scale) / 2f; for (int index5 = 0; index5 < 2; ++index5) { float num386 = (double) projectile1.localAI[1] == -1.0 || (double) projectile1.localAI[1] == 1.0 ? -0.2f : 0.0f; Vector2 scale; if (index5 == 0) { scale = new Vector2(projectile1.scale) * (0.5f + num386); DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(115, 244, 219, 0) * 0.5f; } else { scale = new Vector2(projectile1.scale) * (0.3f + num386); DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0) * 0.5f; } DelegateMethods.f_1 = 1f; for (int index6 = projectile1.oldPos.Length - 1; index6 > 0; --index6) { if (!(projectile1.oldPos[index6] == Vector2.Zero)) { Vector2 start = projectile1.oldPos[index6] + new Vector2((float) projectile1.width, (float) projectile1.height) / 2f + Vector2.UnitY * projectile1.gfxOffY - Main.screenPosition; Vector2 end4 = projectile1.oldPos[index6 - 1] + new Vector2((float) projectile1.width, (float) projectile1.height) / 2f + Vector2.UnitY * projectile1.gfxOffY - Main.screenPosition; Utils.DrawLaser(Main.spriteBatch, tex, start, end4, scale, new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); } } if (projectile1.oldPos[0] != Vector2.Zero) { DelegateMethods.f_1 = 1f; Vector2 start = projectile1.oldPos[0] + new Vector2((float) projectile1.width, (float) projectile1.height) / 2f + Vector2.UnitY * projectile1.gfxOffY - Main.screenPosition; Utils.DrawLaser(Main.spriteBatch, tex, start, end3, scale, new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); } } } else if (projectile1.type == 445) { if ((double) Main.player[Main.projectile[i].owner].gravDir == -1.0) spriteEffects |= SpriteEffects.FlipVertically; Vector2 position = projectile1.position + new Vector2((float) projectile1.width, (float) projectile1.height) / 2f + Vector2.UnitY * projectile1.gfxOffY - Main.screenPosition; Texture2D texture3 = TextureAssets.Projectile[projectile1.type].Value; Microsoft.Xna.Framework.Color alpha = projectile1.GetAlpha(color10); Vector2 vector2_70 = Main.player[projectile1.owner].RotatedRelativePoint(mountedCenter) + Vector2.UnitY * Main.player[projectile1.owner].gfxOffY; Vector2 v = position + Main.screenPosition - vector2_70; Vector2 vector2_71 = Vector2.Normalize(v); float num387 = v.Length(); float rotation = v.ToRotation() + 1.570796f; float num388 = -5f; float num389 = num388 + 30f; Vector2 vector2_72 = new Vector2(2f, num387 - num389); Vector2 vector2_73 = Vector2.Lerp(position + Main.screenPosition, vector2_70 + vector2_71 * num389, 0.5f); Vector2 spinningpoint = -Vector2.UnitY.RotatedBy((double) projectile1.localAI[0] / 60.0 * 3.14159274101257); Vector2[] vector2Array = new Vector2[4] { spinningpoint, spinningpoint.RotatedBy(1.57079637050629), spinningpoint.RotatedBy(3.14159274101257), spinningpoint.RotatedBy(4.71238899230957) }; if ((double) num387 > (double) num389) { for (int index = 0; index < 2; ++index) { Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; Microsoft.Xna.Framework.Color color101; if (index % 2 == 0) { Microsoft.Xna.Framework.Color limeGreen = Microsoft.Xna.Framework.Color.LimeGreen; limeGreen.A = (byte) 128; color101 = limeGreen * 0.5f; } else { Microsoft.Xna.Framework.Color cornflowerBlue = Microsoft.Xna.Framework.Color.CornflowerBlue; cornflowerBlue.A = (byte) 128; color101 = cornflowerBlue * 0.5f; } Vector2 vector2_74 = new Vector2(vector2Array[index].X, 0.0f).RotatedBy((double) rotation) * 4f; Main.EntitySpriteDraw(TextureAssets.MagicPixel.Value, vector2_73 - Main.screenPosition + vector2_74, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1)), color101, rotation, Vector2.One / 2f, new Vector2(2f, num387 - num389), spriteEffects, 0); } } int type2 = Main.player[projectile1.owner].inventory[Main.player[projectile1.owner].selectedItem].type; Main.instance.LoadItem(type2); Texture2D texture4 = TextureAssets.Item[type2].Value; Microsoft.Xna.Framework.Color color102 = Lighting.GetColor((int) vector2_70.X / 16, (int) vector2_70.Y / 16); Main.EntitySpriteDraw(texture4, vector2_70 - Main.screenPosition + vector2_71 * num388, new Microsoft.Xna.Framework.Rectangle?(), color102, (float) ((double) projectile1.rotation + 1.57079637050629 + (spriteEffects == SpriteEffects.None || spriteEffects == SpriteEffects.FlipVertically ? 3.14159274101257 : 0.0)), new Vector2(spriteEffects == SpriteEffects.None || spriteEffects == SpriteEffects.FlipVertically ? 0.0f : (float) texture4.Width, (float) texture4.Height / 2f) + Vector2.UnitY * 1f, Main.player[projectile1.owner].inventory[Main.player[projectile1.owner].selectedItem].scale, spriteEffects, 0); Main.EntitySpriteDraw(TextureAssets.GlowMask[39].Value, vector2_70 - Main.screenPosition + vector2_71 * num388, new Microsoft.Xna.Framework.Rectangle?(), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), (float) ((double) projectile1.rotation + 1.57079637050629 + (spriteEffects == SpriteEffects.None || spriteEffects == SpriteEffects.FlipVertically ? 3.14159274101257 : 0.0)), new Vector2(spriteEffects == SpriteEffects.None || spriteEffects == SpriteEffects.FlipVertically ? 0.0f : (float) texture4.Width, (float) texture4.Height / 2f) + Vector2.UnitY * 1f, Main.player[projectile1.owner].inventory[Main.player[projectile1.owner].selectedItem].scale, spriteEffects, 0); if ((double) num387 > (double) num389) { for (int index = 2; index < 4; ++index) { Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; Microsoft.Xna.Framework.Color color103; if (index % 2 == 0) { Microsoft.Xna.Framework.Color limeGreen = Microsoft.Xna.Framework.Color.LimeGreen; limeGreen.A = (byte) 128; color103 = limeGreen * 0.5f; } else { Microsoft.Xna.Framework.Color cornflowerBlue = Microsoft.Xna.Framework.Color.CornflowerBlue; cornflowerBlue.A = (byte) 128; color103 = cornflowerBlue * 0.5f; } Vector2 vector2_75 = new Vector2(vector2Array[index].X, 0.0f).RotatedBy((double) rotation) * 4f; Main.EntitySpriteDraw(TextureAssets.MagicPixel.Value, vector2_73 - Main.screenPosition + vector2_75, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1)), color103, rotation, Vector2.One / 2f, new Vector2(2f, num387 - num389), spriteEffects, 0); } } float num390 = projectile1.localAI[0] / 60f; if ((double) num390 > 0.5) num390 = 1f - num390; Main.EntitySpriteDraw(texture3, position, new Microsoft.Xna.Framework.Rectangle?(), alpha * num390 * 2f, projectile1.rotation, new Vector2((float) texture3.Width, (float) texture3.Height) / 2f, projectile1.scale, spriteEffects, 0); Main.EntitySpriteDraw(TextureAssets.GlowMask[40].Value, position, new Microsoft.Xna.Framework.Rectangle?(), alpha * (0.5f - num390) * 2f, projectile1.rotation, new Vector2((float) texture3.Width, (float) texture3.Height) / 2f, projectile1.scale, spriteEffects, 0); } else if (projectile1.type >= 393 && projectile1.type <= 395 || projectile1.type == 398 || projectile1.type == 423 || projectile1.type == 450) { Texture2D texture5 = TextureAssets.Projectile[projectile1.type].Value; int height = TextureAssets.Projectile[projectile1.type].Height() / Main.projFrames[projectile1.type]; int y = height * projectile1.frame; Main.EntitySpriteDraw(texture5, projectile1.Center - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY - 2f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, texture5.Width, height)), projectile1.GetAlpha(color10), projectile1.rotation, new Vector2((float) texture5.Width / 2f, (float) height / 2f), projectile1.scale, spriteEffects, 0); if (projectile1.type == 398) { Texture2D texture6 = TextureAssets.MiniMinotaur.Value; Main.EntitySpriteDraw(texture6, projectile1.Center - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY - 2f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, texture6.Width, height)), new Microsoft.Xna.Framework.Color(250, 250, 250, projectile1.alpha), projectile1.rotation, new Vector2((float) texture6.Width / 2f, (float) height / 2f), projectile1.scale, spriteEffects, 0); } if (projectile1.type != 423) return; Texture2D texture7 = TextureAssets.GlowMask[0].Value; Main.EntitySpriteDraw(texture7, projectile1.Center - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY - 2f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, texture7.Width, height)), new Microsoft.Xna.Framework.Color(250, 250, 250, projectile1.alpha), projectile1.rotation, new Vector2((float) texture7.Width / 2f, (float) height / 2f), projectile1.scale, spriteEffects, 0); } else if (projectile1.type == 385) { Texture2D texture = TextureAssets.Projectile[projectile1.type].Value; int height = texture.Height / Main.projFrames[projectile1.type]; int y = height * projectile1.frame; int num391 = 8; int num392 = 2; float num393 = 0.4f; for (int index = 1; index < num391; index += num392) { ref Vector2 local = ref projectile1.oldPos[index]; Microsoft.Xna.Framework.Color newColor = color10; Microsoft.Xna.Framework.Color color104 = projectile1.GetAlpha(newColor) * ((float) (num391 - index) / 15f); Microsoft.Xna.Framework.Color alpha = projectile1.GetAlpha(color10); Vector2 vector2 = projectile1.oldPos[index] - Main.screenPosition + new Vector2(x17 + (float) num209, (float) (projectile1.height / 2) + projectile1.gfxOffY); Main.EntitySpriteDraw(texture, projectile1.oldPos[index] + new Vector2((float) projectile1.width, (float) projectile1.height) / 2f - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, texture.Width, height)), Microsoft.Xna.Framework.Color.Lerp(alpha, color104, 0.3f), projectile1.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), MathHelper.Lerp(projectile1.scale, num393, (float) index / 15f), spriteEffects, 0); } Main.EntitySpriteDraw(texture, projectile1.Center - Main.screenPosition + new Vector2(0.0f, projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, texture.Width, height)), projectile1.GetAlpha(color10), projectile1.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile1.scale, spriteEffects, 0); } else if (projectile1.type == 388) { Texture2D texture = TextureAssets.Projectile[projectile1.type].Value; int height = texture.Height / Main.projFrames[projectile1.type]; int y = height * projectile1.frame; int num394; int num395; if ((double) projectile1.ai[0] == 2.0) { num394 = 10; num395 = 1; } else { num395 = 2; num394 = 5; } for (int index = 1; index < num394; index += num395) { ref Vector2 local = ref projectile1.oldPos[index]; Microsoft.Xna.Framework.Color newColor = color10; Microsoft.Xna.Framework.Color color105 = projectile1.GetAlpha(newColor) * ((float) (num394 - index) / 15f); Vector2 position = projectile1.oldPos[index] - Main.screenPosition + new Vector2(x17 + (float) num209, (float) (projectile1.height / 2) + projectile1.gfxOffY); Main.EntitySpriteDraw(texture, position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, texture.Width, height)), color105, projectile1.rotation, new Vector2(x17, (float) (projectile1.height / 2 + num208)), projectile1.scale, spriteEffects, 0); } Main.EntitySpriteDraw(texture, projectile1.position - Main.screenPosition + new Vector2(x17 + (float) num209, (float) (projectile1.height / 2) + projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, texture.Width, height)), projectile1.GetAlpha(color10), projectile1.rotation, new Vector2(x17, (float) (projectile1.height / 2 + num208)), projectile1.scale, spriteEffects, 0); } else if (Main.projFrames[projectile1.type] > 1) { int height = TextureAssets.Projectile[projectile1.type].Height() / Main.projFrames[projectile1.type]; int y = height * projectile1.frame; if (projectile1.type == 111) { Microsoft.Xna.Framework.Color oldColor = new Microsoft.Xna.Framework.Color((int) Main.player[projectile1.owner].shirtColor.R, (int) Main.player[projectile1.owner].shirtColor.G, (int) Main.player[projectile1.owner].shirtColor.B); Microsoft.Xna.Framework.Color color106 = Lighting.GetColor((int) ((double) projectile1.position.X + (double) projectile1.width * 0.5) / 16, (int) (((double) projectile1.position.Y + (double) projectile1.height * 0.5) / 16.0), oldColor); Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, new Vector2(projectile1.position.X - Main.screenPosition.X + x17 + (float) num209, projectile1.position.Y - Main.screenPosition.Y + (float) (projectile1.height / 2) + projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, TextureAssets.Projectile[projectile1.type].Width(), height)), projectile1.GetAlpha(color106), projectile1.rotation, new Vector2(x17, (float) (projectile1.height / 2 + num208)), projectile1.scale, spriteEffects, 0); } else { Microsoft.Xna.Framework.Color alpha = projectile1.GetAlpha(color10); if (projectile1.type == 211 && Main.CurrentDrawnEntityShader != 0) alpha.A = (byte) 127; Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, new Vector2(projectile1.position.X - Main.screenPosition.X + x17 + (float) num209, projectile1.position.Y - Main.screenPosition.Y + (float) (projectile1.height / 2) + projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, TextureAssets.Projectile[projectile1.type].Width(), height - 1)), alpha, projectile1.rotation, new Vector2(x17, (float) (projectile1.height / 2 + num208)), projectile1.scale, spriteEffects, 0); if (projectile1.type == 335) Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, new Vector2(projectile1.position.X - Main.screenPosition.X + x17 + (float) num209, projectile1.position.Y - Main.screenPosition.Y + (float) (projectile1.height / 2) + projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, TextureAssets.Projectile[projectile1.type].Width(), height - 1)), new Microsoft.Xna.Framework.Color(100, 100, 100, 0), projectile1.rotation, new Vector2(x17, (float) (projectile1.height / 2 + num208)), projectile1.scale, spriteEffects, 0); if (projectile1.type == 897 || projectile1.type == 899) { int index = 279; if (projectile1.type == 899) index = 281; Main.EntitySpriteDraw(TextureAssets.GlowMask[index].Value, new Vector2(projectile1.position.X - Main.screenPosition.X + x17 + (float) num209, projectile1.position.Y - Main.screenPosition.Y + (float) (projectile1.height / 2) + projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, TextureAssets.Projectile[projectile1.type].Width(), height - 1)), Microsoft.Xna.Framework.Color.White, projectile1.rotation, new Vector2(x17, (float) (projectile1.height / 2 + num208)), projectile1.scale, spriteEffects, 0); } if (projectile1.type == 891) { float num396 = Utils.WrappedLerp(0.6f, 1f, (float) ((int) Main.timeForVisualEffects % 100) / 100f); Microsoft.Xna.Framework.Color color107 = new Microsoft.Xna.Framework.Color(num396, num396, num396, 150f); Main.EntitySpriteDraw(TextureAssets.GlowMask[277].Value, new Vector2(projectile1.position.X - Main.screenPosition.X + x17 + (float) num209, projectile1.position.Y - Main.screenPosition.Y + (float) (projectile1.height / 2) + projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, TextureAssets.Projectile[projectile1.type].Width(), height - 1)), color107, projectile1.rotation, new Vector2(x17, (float) (projectile1.height / 2 + num208)), projectile1.scale, spriteEffects, 0); } if (projectile1.type == 595) { Player player = Main.player[projectile1.owner]; if (player.active && player.body == 208) { for (float amount = 0.0f; (double) amount <= 1.0; amount += 0.2f) { Microsoft.Xna.Framework.Color underShirtColor = player.underShirtColor; underShirtColor.A = (byte) (120.0 * (1.0 - (double) amount * 0.5)); Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, new Vector2(projectile1.position.X - Main.screenPosition.X + x17 + (float) num209, projectile1.position.Y - Main.screenPosition.Y + (float) (projectile1.height / 2) + projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, TextureAssets.Projectile[projectile1.type].Width(), height - 1)), underShirtColor, projectile1.rotation, new Vector2(x17, (float) (projectile1.height / 2 + num208)), projectile1.scale * MathHelper.Lerp(0.8f, 1.3f, amount), spriteEffects, 0); } } } if (projectile1.type == 387) Main.EntitySpriteDraw(TextureAssets.EyeLaserSmall.Value, new Vector2(projectile1.position.X - Main.screenPosition.X + x17 + (float) num209, projectile1.position.Y - Main.screenPosition.Y + (float) (projectile1.height / 2) + projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, TextureAssets.Projectile[projectile1.type].Width(), height)), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), projectile1.rotation, new Vector2(x17, (float) (projectile1.height / 2 + num208)), projectile1.scale, spriteEffects, 0); if (projectile1.type != 525) return; int num397 = Main.TryInteractingWithMoneyTrough(projectile1); if (num397 == 0) return; int averageTileLighting = ((int) color10.R + (int) color10.G + (int) color10.B) / 3; if (averageTileLighting <= 10) return; Microsoft.Xna.Framework.Color selectionGlowColor = Colors.GetSelectionGlowColor(num397 == 2, averageTileLighting); Main.EntitySpriteDraw(TextureAssets.Extra[94].Value, new Vector2(projectile1.position.X - Main.screenPosition.X + x17 + (float) num209, projectile1.position.Y - Main.screenPosition.Y + (float) (projectile1.height / 2) + projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y, TextureAssets.Projectile[projectile1.type].Width(), height - 1)), selectionGlowColor, 0.0f, new Vector2(x17, (float) (projectile1.height / 2 + num208)), 1f, spriteEffects, 0); } } else if (projectile1.type == 383 || projectile1.type == 399) { Texture2D texture = TextureAssets.Projectile[projectile1.type].Value; Main.EntitySpriteDraw(texture, projectile1.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(), projectile1.GetAlpha(color10), projectile1.rotation, new Vector2((float) texture.Width, (float) texture.Height) / 2f, projectile1.scale, spriteEffects, 0); } else if (projectile1.type == 157 || projectile1.type == 378) Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, new Vector2(projectile1.position.X - Main.screenPosition.X + (float) (projectile1.width / 2), projectile1.position.Y - Main.screenPosition.Y + (float) (projectile1.height / 2)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[projectile1.type].Width(), TextureAssets.Projectile[projectile1.type].Height())), projectile1.GetAlpha(color10), projectile1.rotation, new Vector2((float) (TextureAssets.Projectile[projectile1.type].Width() / 2), (float) (TextureAssets.Projectile[projectile1.type].Height() / 2)), projectile1.scale, spriteEffects, 0); else if (projectile1.type == 306) Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, new Vector2(projectile1.position.X - Main.screenPosition.X + (float) (projectile1.width / 2), projectile1.position.Y - Main.screenPosition.Y + (float) (projectile1.height / 2)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[projectile1.type].Width(), TextureAssets.Projectile[projectile1.type].Height())), projectile1.GetAlpha(color10), projectile1.rotation, new Vector2((float) (TextureAssets.Projectile[projectile1.type].Width() / 2), (float) (TextureAssets.Projectile[projectile1.type].Height() / 2)), projectile1.scale, spriteEffects, 0); else if (projectile1.type == 256) Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, new Vector2(projectile1.position.X - Main.screenPosition.X + (float) (projectile1.width / 2), projectile1.position.Y - Main.screenPosition.Y + (float) (projectile1.height / 2)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[projectile1.type].Width(), TextureAssets.Projectile[projectile1.type].Height())), projectile1.GetAlpha(color10), projectile1.rotation, new Vector2((float) (TextureAssets.Projectile[projectile1.type].Width() / 2), (float) (TextureAssets.Projectile[projectile1.type].Height() / 2)), projectile1.scale, spriteEffects, 0); else if (projectile1.aiStyle == 27) Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, new Vector2(projectile1.position.X - Main.screenPosition.X + (float) (projectile1.width / 2), projectile1.position.Y - Main.screenPosition.Y + (float) (projectile1.height / 2)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[projectile1.type].Width(), TextureAssets.Projectile[projectile1.type].Height())), projectile1.GetAlpha(color10), projectile1.rotation, new Vector2((float) TextureAssets.Projectile[projectile1.type].Width(), 0.0f), projectile1.scale, spriteEffects, 0); else if (projectile1.aiStyle == 19) { SpriteEffects effects = SpriteEffects.None; float rotation = (float) Math.Atan2((double) projectile1.velocity.Y, (double) projectile1.velocity.X) + 2.355f; Vector2 origin = Vector2.Zero; if (Main.player[projectile1.owner].direction > 0) { effects = SpriteEffects.FlipHorizontally; origin.X = (float) TextureAssets.Projectile[projectile1.type].Width(); rotation -= 1.570796f; } if ((double) Main.player[projectile1.owner].gravDir == -1.0) { if (projectile1.direction == 1) { effects = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically; origin = new Vector2((float) TextureAssets.Projectile[projectile1.type].Width(), (float) TextureAssets.Projectile[projectile1.type].Height()); rotation -= 1.570796f; } else if (projectile1.direction == -1) { effects = SpriteEffects.FlipVertically; origin = new Vector2(0.0f, (float) TextureAssets.Projectile[projectile1.type].Height()); rotation += 1.570796f; } } Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, new Vector2(projectile1.position.X - Main.screenPosition.X + (float) (projectile1.width / 2), projectile1.position.Y - Main.screenPosition.Y + (float) (projectile1.height / 2) + projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[projectile1.type].Width(), TextureAssets.Projectile[projectile1.type].Height())), projectile1.GetAlpha(color10), rotation, origin, projectile1.scale, effects, 0); } else if (projectile1.type == 451) Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, projectile1.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(), projectile1.GetAlpha(color10), projectile1.rotation, new Vector2((float) TextureAssets.Projectile[projectile1.type].Width(), 0.0f), projectile1.scale, spriteEffects, 0); else if (projectile1.type == 434) { Vector2 vector2_76 = new Vector2(projectile1.ai[0], projectile1.ai[1]); Vector2 v = projectile1.position - vector2_76; float y = (float) Math.Sqrt((double) v.X * (double) v.X + (double) v.Y * (double) v.Y); Vector2 vector2_77 = new Vector2(4f, y); float rotation = v.ToRotation() + 1.570796f; Vector2 vector2_78 = Vector2.Lerp(projectile1.position, vector2_76, 0.5f); Microsoft.Xna.Framework.Color red = Microsoft.Xna.Framework.Color.Red; red.A = (byte) 0; Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; Microsoft.Xna.Framework.Color color108 = red * projectile1.localAI[0]; Microsoft.Xna.Framework.Color color109 = white * projectile1.localAI[0]; float num398 = (float) Math.Sqrt((double) (projectile1.damage / 50)); Main.EntitySpriteDraw(TextureAssets.MagicPixel.Value, vector2_78 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1)), color108, rotation, Vector2.One / 2f, new Vector2(2f * num398, y + 8f), spriteEffects, 0); Main.EntitySpriteDraw(TextureAssets.MagicPixel.Value, vector2_78 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1)), color108, rotation, Vector2.One / 2f, new Vector2(4f * num398, y), spriteEffects, 0); Main.EntitySpriteDraw(TextureAssets.MagicPixel.Value, vector2_78 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1)), color109, rotation, Vector2.One / 2f, new Vector2(2f * num398, y), spriteEffects, 0); } else { if (projectile1.type == 94 && (double) projectile1.ai[1] > 6.0) { for (int index = 0; index < 10; ++index) { Microsoft.Xna.Framework.Color alpha = projectile1.GetAlpha(color10); float num399 = (float) (9 - index) / 9f; alpha.R = (byte) ((double) alpha.R * (double) num399); alpha.G = (byte) ((double) alpha.G * (double) num399); alpha.B = (byte) ((double) alpha.B * (double) num399); alpha.A = (byte) ((double) alpha.A * (double) num399); float num400 = (float) (9 - index) / 9f; Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, new Vector2(projectile1.oldPos[index].X - Main.screenPosition.X + x17 + (float) num209, projectile1.oldPos[index].Y - Main.screenPosition.Y + (float) (projectile1.height / 2) + projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[projectile1.type].Width(), TextureAssets.Projectile[projectile1.type].Height())), alpha, projectile1.rotation, new Vector2(x17, (float) (projectile1.height / 2 + num208)), num400 * projectile1.scale, spriteEffects, 0); } } if (projectile1.type == 301) { for (int index = 0; index < 10; ++index) { Microsoft.Xna.Framework.Color alpha = projectile1.GetAlpha(color10); float num401 = (float) (9 - index) / 9f; alpha.R = (byte) ((double) alpha.R * (double) num401); alpha.G = (byte) ((double) alpha.G * (double) num401); alpha.B = (byte) ((double) alpha.B * (double) num401); alpha.A = (byte) ((double) alpha.A * (double) num401); float num402 = (float) (9 - index) / 9f; Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, new Vector2(projectile1.oldPos[index].X - Main.screenPosition.X + x17 + (float) num209, projectile1.oldPos[index].Y - Main.screenPosition.Y + (float) (projectile1.height / 2) + projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[projectile1.type].Width(), TextureAssets.Projectile[projectile1.type].Height())), alpha, projectile1.rotation, new Vector2(x17, (float) (projectile1.height / 2 + num208)), num402 * projectile1.scale, spriteEffects, 0); } } if (projectile1.type == 323 && projectile1.alpha == 0) { for (int index = 1; index < 8; ++index) { float num403 = projectile1.velocity.X * (float) index; float num404 = projectile1.velocity.Y * (float) index; Microsoft.Xna.Framework.Color alpha = projectile1.GetAlpha(color10); float num405 = 0.0f; if (index == 1) num405 = 0.7f; if (index == 2) num405 = 0.6f; if (index == 3) num405 = 0.5f; if (index == 4) num405 = 0.4f; if (index == 5) num405 = 0.3f; if (index == 6) num405 = 0.2f; if (index == 7) num405 = 0.1f; alpha.R = (byte) ((double) alpha.R * (double) num405); alpha.G = (byte) ((double) alpha.G * (double) num405); alpha.B = (byte) ((double) alpha.B * (double) num405); alpha.A = (byte) ((double) alpha.A * (double) num405); Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, new Vector2(projectile1.position.X - Main.screenPosition.X + x17 + (float) num209 - num403, projectile1.position.Y - Main.screenPosition.Y + (float) (projectile1.height / 2) + projectile1.gfxOffY - num404), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[projectile1.type].Width(), TextureAssets.Projectile[projectile1.type].Height())), alpha, projectile1.rotation, new Vector2(x17, (float) (projectile1.height / 2 + num208)), num405 + 0.2f, spriteEffects, 0); } } if (projectile1.type == 117 && (double) projectile1.ai[0] > 3.0) { for (int index = 1; index < 5; ++index) { float num406 = projectile1.velocity.X * (float) index; float num407 = projectile1.velocity.Y * (float) index; Microsoft.Xna.Framework.Color alpha = projectile1.GetAlpha(color10); float num408 = 0.0f; if (index == 1) num408 = 0.4f; if (index == 2) num408 = 0.3f; if (index == 3) num408 = 0.2f; if (index == 4) num408 = 0.1f; alpha.R = (byte) ((double) alpha.R * (double) num408); alpha.G = (byte) ((double) alpha.G * (double) num408); alpha.B = (byte) ((double) alpha.B * (double) num408); alpha.A = (byte) ((double) alpha.A * (double) num408); Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, new Vector2(projectile1.position.X - Main.screenPosition.X + x17 + (float) num209 - num406, projectile1.position.Y - Main.screenPosition.Y + (float) (projectile1.height / 2) + projectile1.gfxOffY - num407), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[projectile1.type].Width(), TextureAssets.Projectile[projectile1.type].Height())), alpha, projectile1.rotation, new Vector2(x17, (float) (projectile1.height / 2 + num208)), projectile1.scale, spriteEffects, 0); } } if (projectile1.bobber) { if ((double) projectile1.ai[1] > 0.0 && (double) projectile1.ai[1] < 5045.0 && (double) projectile1.ai[0] == 1.0) { int i3 = (int) projectile1.ai[1]; Vector2 center = projectile1.Center; float num409 = projectile1.rotation; Vector2 vector2 = center; float num410 = polePosX - vector2.X; float num411 = polePosY - vector2.Y; num409 = (float) Math.Atan2((double) num411, (double) num410); float rotation; if ((double) projectile1.velocity.X > 0.0) { spriteEffects = SpriteEffects.None; rotation = (float) Math.Atan2((double) num411, (double) num410) + 0.785f; if ((double) projectile1.ai[1] == 2342.0) rotation -= 0.785f; } else { spriteEffects = SpriteEffects.FlipHorizontally; rotation = (float) Math.Atan2(-(double) num411, -(double) num410) - 0.785f; if ((double) projectile1.ai[1] == 2342.0) rotation += 0.785f; } Main.instance.LoadItem(i3); Main.EntitySpriteDraw(TextureAssets.Item[i3].Value, new Vector2(center.X - Main.screenPosition.X, center.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Item[i3].Width(), TextureAssets.Item[i3].Height())), color10, rotation, new Vector2((float) (TextureAssets.Item[i3].Width() / 2), (float) (TextureAssets.Item[i3].Height() / 2)), projectile1.scale, spriteEffects, 0); } else if ((double) projectile1.ai[0] <= 1.0) Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, new Vector2(projectile1.position.X - Main.screenPosition.X + x17 + (float) num209, projectile1.position.Y - Main.screenPosition.Y + (float) (projectile1.height / 2) + projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[projectile1.type].Width(), TextureAssets.Projectile[projectile1.type].Height())), projectile1.GetAlpha(color10), projectile1.rotation, new Vector2(x17, (float) (projectile1.height / 2 + num208)), projectile1.scale, spriteEffects, 0); } else { if (projectile1.ownerHitCheck && (double) Main.player[projectile1.owner].gravDir == -1.0) { if (Main.player[projectile1.owner].direction == 1) spriteEffects = SpriteEffects.FlipHorizontally; else if (Main.player[projectile1.owner].direction == -1) spriteEffects = SpriteEffects.None; } Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, new Vector2(projectile1.position.X - Main.screenPosition.X + x17 + (float) num209, projectile1.position.Y - Main.screenPosition.Y + (float) (projectile1.height / 2) + projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[projectile1.type].Width(), TextureAssets.Projectile[projectile1.type].Height())), projectile1.GetAlpha(color10), projectile1.rotation, new Vector2(x17, (float) (projectile1.height / 2 + num208)), projectile1.scale, spriteEffects, 0); if (projectile1.glowMask != (short) -1) Main.EntitySpriteDraw(TextureAssets.GlowMask[(int) projectile1.glowMask].Value, new Vector2(projectile1.position.X - Main.screenPosition.X + x17 + (float) num209, projectile1.position.Y - Main.screenPosition.Y + (float) (projectile1.height / 2) + projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[projectile1.type].Width(), TextureAssets.Projectile[projectile1.type].Height())), new Microsoft.Xna.Framework.Color(250, 250, 250, projectile1.alpha), projectile1.rotation, new Vector2(x17, (float) (projectile1.height / 2 + num208)), projectile1.scale, spriteEffects, 0); if (projectile1.type == 473) Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, new Vector2(projectile1.position.X - Main.screenPosition.X + x17 + (float) num209, projectile1.position.Y - Main.screenPosition.Y + (float) (projectile1.height / 2) + projectile1.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[projectile1.type].Width(), TextureAssets.Projectile[projectile1.type].Height())), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, 0, 0), projectile1.rotation, new Vector2(x17, (float) (projectile1.height / 2 + num208)), projectile1.scale, spriteEffects, 0); if (projectile1.type == 312) { ulong tileFrameSeed = Main.TileFrameSeed; for (int index = 0; index < 4; ++index) { Vector2 vector2 = new Vector2((float) Utils.RandomInt(ref tileFrameSeed, -2, 3), (float) Utils.RandomInt(ref tileFrameSeed, -2, 3)); Main.EntitySpriteDraw(TextureAssets.GlowMask[(int) projectile1.glowMask].Value, new Vector2(projectile1.position.X - Main.screenPosition.X + x17 + (float) num209, projectile1.position.Y - Main.screenPosition.Y + (float) (projectile1.height / 2) + projectile1.gfxOffY) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[projectile1.type].Width(), TextureAssets.Projectile[projectile1.type].Height())), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue) * 0.2f, projectile1.rotation, new Vector2(x17, (float) (projectile1.height / 2 + num208)), projectile1.scale, spriteEffects, 0); } } } if (projectile1.type == 106) Main.EntitySpriteDraw(TextureAssets.LightDisc.Value, new Vector2(projectile1.position.X - Main.screenPosition.X + x17 + (float) num209, projectile1.position.Y - Main.screenPosition.Y + (float) (projectile1.height / 2)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[projectile1.type].Width(), TextureAssets.Projectile[projectile1.type].Height())), new Microsoft.Xna.Framework.Color(200, 200, 200, 0), projectile1.rotation, new Vector2(x17, (float) (projectile1.height / 2 + num208)), projectile1.scale, spriteEffects, 0); if (projectile1.type >= 326 && projectile1.type <= 328) { ulong tileFrameSeed = Main.TileFrameSeed; for (int index = 0; index < 4; ++index) { Vector2 vector2 = new Vector2((float) Utils.RandomInt(ref tileFrameSeed, -2, 3), (float) Utils.RandomInt(ref tileFrameSeed, -2, 3)); Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, new Vector2(projectile1.position.X - Main.screenPosition.X + x17 + (float) num209, projectile1.position.Y - Main.screenPosition.Y + (float) (projectile1.height / 2)) + vector2 - projectile1.velocity * 0.25f * (float) index, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[projectile1.type].Width(), TextureAssets.Projectile[projectile1.type].Height())), new Microsoft.Xna.Framework.Color(120, 120, 120, 60) * 1f, projectile1.rotation, new Vector2(x17, (float) (projectile1.height / 2 + num208)), projectile1.scale - (float) index * 0.2f, spriteEffects, 0); } } if (projectile1.type == 554 || projectile1.type == 603) { for (int index = 1; index < 5; ++index) { float num412 = (float) ((double) projectile1.velocity.X * (double) index * 0.5); float num413 = (float) ((double) projectile1.velocity.Y * (double) index * 0.5); Microsoft.Xna.Framework.Color alpha = projectile1.GetAlpha(color10); float num414 = 0.0f; if (index == 1) num414 = 0.4f; if (index == 2) num414 = 0.3f; if (index == 3) num414 = 0.2f; if (index == 4) num414 = 0.1f; alpha.R = (byte) ((double) alpha.R * (double) num414); alpha.G = (byte) ((double) alpha.G * (double) num414); alpha.B = (byte) ((double) alpha.B * (double) num414); alpha.A = (byte) ((double) alpha.A * (double) num414); Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, new Vector2(projectile1.position.X - Main.screenPosition.X + x17 + (float) num209 - num412, projectile1.position.Y - Main.screenPosition.Y + (float) (projectile1.height / 2) + projectile1.gfxOffY - num413), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[projectile1.type].Width(), TextureAssets.Projectile[projectile1.type].Height())), alpha, projectile1.rotation, new Vector2(x17, (float) (projectile1.height / 2 + num208)), projectile1.scale, spriteEffects, 0); } } else if (projectile1.type == 604) { int num415 = (int) projectile1.ai[1] + 1; if (num415 > 7) num415 = 7; for (int index = 1; index < num415; ++index) { float num416 = (float) ((double) projectile1.velocity.X * (double) index * 1.5); float num417 = (float) ((double) projectile1.velocity.Y * (double) index * 1.5); Microsoft.Xna.Framework.Color alpha = projectile1.GetAlpha(color10); float num418 = 0.0f; if (index == 1) num418 = 0.4f; if (index == 2) num418 = 0.3f; if (index == 3) num418 = 0.2f; if (index == 4) num418 = 0.1f; float num419 = (float) (0.400000005960464 - (double) index * 0.0599999986588955) * (float) (1.0 - (double) projectile1.alpha / (double) byte.MaxValue); alpha.R = (byte) ((double) alpha.R * (double) num419); alpha.G = (byte) ((double) alpha.G * (double) num419); alpha.B = (byte) ((double) alpha.B * (double) num419); alpha.A = (byte) ((double) alpha.A * (double) num419 / 2.0); float scale = projectile1.scale - (float) index * 0.1f; Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, new Vector2(projectile1.position.X - Main.screenPosition.X + x17 + (float) num209 - num416, projectile1.position.Y - Main.screenPosition.Y + (float) (projectile1.height / 2) + projectile1.gfxOffY - num417), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[projectile1.type].Width(), TextureAssets.Projectile[projectile1.type].Height())), alpha, projectile1.rotation, new Vector2(x17, (float) (projectile1.height / 2 + num208)), scale, spriteEffects, 0); } } else { if (projectile1.type != 553) return; for (int index = 1; index < 5; ++index) { float num420 = (float) ((double) projectile1.velocity.X * (double) index * 0.400000005960464); float num421 = (float) ((double) projectile1.velocity.Y * (double) index * 0.400000005960464); Microsoft.Xna.Framework.Color alpha = projectile1.GetAlpha(color10); float num422 = 0.0f; if (index == 1) num422 = 0.4f; if (index == 2) num422 = 0.3f; if (index == 3) num422 = 0.2f; if (index == 4) num422 = 0.1f; alpha.R = (byte) ((double) alpha.R * (double) num422); alpha.G = (byte) ((double) alpha.G * (double) num422); alpha.B = (byte) ((double) alpha.B * (double) num422); alpha.A = (byte) ((double) alpha.A * (double) num422); Main.EntitySpriteDraw(TextureAssets.Projectile[projectile1.type].Value, new Vector2(projectile1.position.X - Main.screenPosition.X + x17 + (float) num209 - num420, projectile1.position.Y - Main.screenPosition.Y + (float) (projectile1.height / 2) + projectile1.gfxOffY - num421), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Projectile[projectile1.type].Width(), TextureAssets.Projectile[projectile1.type].Height())), alpha, projectile1.rotation, new Vector2(x17, (float) (projectile1.height / 2 + num208)), projectile1.scale, spriteEffects, 0); } } } } } } } } private static void DrawPrettyStarSparkle( Projectile proj, SpriteEffects dir, Vector2 drawpos, Microsoft.Xna.Framework.Color drawColor, Microsoft.Xna.Framework.Color shineColor) { Texture2D texture2D = TextureAssets.Extra[98].Value; Microsoft.Xna.Framework.Color color1 = shineColor * proj.Opacity * 0.5f; color1.A = (byte) 0; Vector2 origin = texture2D.Size() / 2f; Microsoft.Xna.Framework.Color color2 = drawColor * 0.5f; float num = Utils.GetLerpValue(15f, 30f, proj.localAI[0], true) * Utils.GetLerpValue(45f, 30f, proj.localAI[0], true); Vector2 scale1 = new Vector2(0.5f, 5f) * num; Vector2 scale2 = new Vector2(0.5f, 2f) * num; Microsoft.Xna.Framework.Color color3 = color1 * num; Microsoft.Xna.Framework.Color color4 = color2 * num; Vector2 position = drawpos; Main.EntitySpriteDraw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(), color3, 1.570796f, origin, scale1, dir, 0); Main.EntitySpriteDraw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(), color3, 0.0f, origin, scale2, dir, 0); Main.EntitySpriteDraw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(), color4, 1.570796f, origin, scale1 * 0.6f, dir, 0); Main.EntitySpriteDraw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(), color4, 0.0f, origin, scale2 * 0.6f, dir, 0); } private static void DrawProj_FlailChains(Projectile proj, Vector2 mountedCenter) { Player player = Main.player[proj.owner]; Vector2 playerArmPosition = Main.GetPlayerArmPosition(proj); Asset asset1 = (Asset) null; Microsoft.Xna.Framework.Rectangle? sourceRectangle = new Microsoft.Xna.Framework.Rectangle?(); float num1 = 0.0f; Asset asset2; switch (proj.type) { case 25: asset2 = TextureAssets.Chain2; break; case 35: asset2 = TextureAssets.Chain6; break; case 63: asset2 = TextureAssets.Chain7; break; case 154: asset2 = TextureAssets.Chain13; break; case 247: asset2 = TextureAssets.Chain19; break; case 757: asset2 = TextureAssets.Extra[99]; sourceRectangle = new Microsoft.Xna.Framework.Rectangle?(asset2.Frame(verticalFrames: 6)); num1 = -2f; break; case 947: asset2 = TextureAssets.Chain41; break; case 948: asset2 = TextureAssets.Chain43; break; default: asset2 = TextureAssets.Chain3; break; } Vector2 origin = sourceRectangle.HasValue ? sourceRectangle.Value.Size() / 2f : asset2.Size() / 2f; Vector2 center = proj.Center; Vector2 v1 = playerArmPosition.MoveTowards(center, 4f) - center; Vector2 v2 = v1.SafeNormalize(Vector2.Zero); float num2 = (sourceRectangle.HasValue ? (float) sourceRectangle.Value.Height : (float) asset2.Height()) + num1; float rotation = v2.ToRotation() + 1.570796f; int num3 = 0; float num4 = v1.Length() + num2 / 2f; int num5 = 0; for (; (double) num4 > 0.0; num4 -= num2) { Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) center.X / 16, (int) ((double) center.Y / 16.0)); switch (proj.type) { case 757: sourceRectangle = new Microsoft.Xna.Framework.Rectangle?(asset2.Frame(verticalFrames: 6, frameY: (num3 % 6))); break; case 948: if (num5 >= 6) asset2 = asset1 = TextureAssets.Chain41; else if (num5 >= 4) { asset2 = asset1 = TextureAssets.Chain42; byte num6 = 140; if ((int) color.R < (int) num6) color.R = num6; if ((int) color.G < (int) num6) color.G = num6; if ((int) color.B < (int) num6) color.B = num6; } else color = Microsoft.Xna.Framework.Color.White; ++num5; break; } Main.spriteBatch.Draw(asset2.Value, center - Main.screenPosition, sourceRectangle, color, rotation, origin, 1f, SpriteEffects.None, 0.0f); center += v2 * num2; ++num3; } } private static void DrawProj_FlailChains_Old(Projectile proj, Vector2 mountedCenter) { Vector2 vector2 = new Vector2(proj.position.X + (float) proj.width * 0.5f, proj.position.Y + (float) proj.height * 0.5f); float num1 = mountedCenter.X - vector2.X; float num2 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num2, (double) num1) - 1.57f; if (proj.alpha == 0) { int num3 = -1; if ((double) proj.position.X + (double) (proj.width / 2) < (double) mountedCenter.X) num3 = 1; Main.player[proj.owner].itemRotation = Main.player[proj.owner].direction != 1 ? (float) Math.Atan2((double) num2 * (double) num3, (double) num1 * (double) num3) : (float) Math.Atan2((double) num2 * (double) num3, (double) num1 * (double) num3); } bool flag = true; int num4 = 0; int num5 = 25; if (proj.type == 757) num5 = 12; while (flag) { float f = (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); if ((double) f < (double) num5) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num6 = proj.type == 154 || proj.type == 247 ? 18f / f : (proj.type != 757 ? 12f / f : 16f / f); float num7 = num1 * num6; float num8 = num2 * num6; vector2.X += num7; vector2.Y += num8; num1 = mountedCenter.X - vector2.X; num2 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); if (proj.type == 25) Main.EntitySpriteDraw(TextureAssets.Chain2.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(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, 0); else if (proj.type == 35) Main.EntitySpriteDraw(TextureAssets.Chain6.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(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, 0); else if (proj.type == 757) { Texture2D texture2D = TextureAssets.Extra[99].Value; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: 6, frameY: (num4 % 6)); Main.EntitySpriteDraw(texture2D, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(texture2D.Frame(verticalFrames: 6, frameY: (num4 % 6))), color, rotation, r.Size() / 2f, 1f, SpriteEffects.None, 0); } else if (proj.type == 247) Main.EntitySpriteDraw(TextureAssets.Chain19.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(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, 0); else if (proj.type == 63) Main.EntitySpriteDraw(TextureAssets.Chain7.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(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, 0); else if (proj.type == 154) Main.EntitySpriteDraw(TextureAssets.Chain13.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(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, 0); else Main.EntitySpriteDraw(TextureAssets.Chain3.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(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, 0); } ++num4; } } private static Microsoft.Xna.Framework.Color TryApplyingPlayerStringColor( int playerStringColor, Microsoft.Xna.Framework.Color stringColor) { if (playerStringColor > 0) { stringColor = WorldGen.paintColor(playerStringColor); if (stringColor.R < (byte) 75) stringColor.R = (byte) 75; if (stringColor.G < (byte) 75) stringColor.G = (byte) 75; if (stringColor.B < (byte) 75) stringColor.B = (byte) 75; switch (playerStringColor) { case 0: case 14: stringColor = new Microsoft.Xna.Framework.Color(200, 200, 200); break; case 13: stringColor = new Microsoft.Xna.Framework.Color(20, 20, 20); break; case 27: stringColor = new Microsoft.Xna.Framework.Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); break; case 28: stringColor = new Microsoft.Xna.Framework.Color(163, 116, 91); break; } stringColor.A = (byte) ((double) stringColor.A * 0.400000005960464); } return stringColor; } private static void DrawProj_FishingLine( Projectile proj, ref float polePosX, ref float polePosY, Vector2 mountedCenter) { polePosX = mountedCenter.X; polePosY = mountedCenter.Y; polePosY += Main.player[proj.owner].gfxOffY; int type = Main.player[proj.owner].inventory[Main.player[proj.owner].selectedItem].type; Microsoft.Xna.Framework.Color stringColor = new Microsoft.Xna.Framework.Color(200, 200, 200, 100); if (type == 2294) stringColor = new Microsoft.Xna.Framework.Color(100, 180, 230, 100); if (type == 2295) stringColor = new Microsoft.Xna.Framework.Color(250, 90, 70, 100); if (type == 2293) stringColor = new Microsoft.Xna.Framework.Color(203, 190, 210, 100); if (type == 2421) stringColor = new Microsoft.Xna.Framework.Color(183, 77, 112, 100); if (type == 2422) stringColor = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, 226, 116, 100); if (type == 4325) stringColor = new Microsoft.Xna.Framework.Color(200, 100, 100, 100); if (type == 4442) stringColor = new Microsoft.Xna.Framework.Color(100, 100, 200, 100); Microsoft.Xna.Framework.Color oldColor = Main.TryApplyingPlayerStringColor(Main.player[proj.owner].stringColor, stringColor); float gravDir = Main.player[proj.owner].gravDir; if (type == 2289) { polePosX += (float) (43 * Main.player[proj.owner].direction); if (Main.player[proj.owner].direction < 0) polePosX -= 13f; polePosY -= 36f * gravDir; } else if (type == 2291) { polePosX += (float) (43 * Main.player[proj.owner].direction); if (Main.player[proj.owner].direction < 0) polePosX -= 13f; polePosY -= 34f * gravDir; } else if (type == 2292) { polePosX += (float) (46 * Main.player[proj.owner].direction); if (Main.player[proj.owner].direction < 0) polePosX -= 13f; polePosY -= 34f * gravDir; } else if (type == 2293) { polePosX += (float) (43 * Main.player[proj.owner].direction); if (Main.player[proj.owner].direction < 0) polePosX -= 13f; polePosY -= 34f * gravDir; } else if (type == 2294) { polePosX += (float) (43 * Main.player[proj.owner].direction); if (Main.player[proj.owner].direction < 0) polePosX -= 13f; polePosY -= 30f * gravDir; } else if (type == 2295) { polePosX += (float) (43 * Main.player[proj.owner].direction); if (Main.player[proj.owner].direction < 0) polePosX -= 13f; polePosY -= 30f * gravDir; } else if (type == 2296) { polePosX += (float) (43 * Main.player[proj.owner].direction); if (Main.player[proj.owner].direction < 0) polePosX -= 13f; polePosY -= 30f * gravDir; } else if (type == 2421) { polePosX += (float) (47 * Main.player[proj.owner].direction); if (Main.player[proj.owner].direction < 0) polePosX -= 13f; polePosY -= 36f * gravDir; } else if (type == 2422) { polePosX += (float) (47 * Main.player[proj.owner].direction); if (Main.player[proj.owner].direction < 0) polePosX -= 13f; polePosY -= 32f * gravDir; } else if (type == 4325) { polePosX += (float) (44 * Main.player[proj.owner].direction); if (Main.player[proj.owner].direction < 0) polePosX -= 13f; polePosY -= 32f * gravDir; } else if (type == 4442) { polePosX += (float) (44 * Main.player[proj.owner].direction); if (Main.player[proj.owner].direction < 0) polePosX -= 13f; polePosY -= 32f * gravDir; } if ((double) gravDir == -1.0) polePosY -= 12f; Vector2 vector2_1 = new Vector2(polePosX, polePosY); Vector2 vector2_2 = Main.player[proj.owner].RotatedRelativePoint(vector2_1 + new Vector2(8f)) - new Vector2(8f); float num1 = proj.position.X + (float) proj.width * 0.5f - vector2_2.X; float num2 = proj.position.Y + (float) proj.height * 0.5f - vector2_2.Y; Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); float num3 = (float) Math.Atan2((double) num2, (double) num1) - 1.57f; bool flag = true; if ((double) num1 == 0.0 && (double) num2 == 0.0) { flag = false; } else { float num4 = 12f / (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); float num5 = num1 * num4; float num6 = num2 * num4; vector2_2.X -= num5; vector2_2.Y -= num6; num1 = proj.position.X + (float) proj.width * 0.5f - vector2_2.X; num2 = proj.position.Y + (float) proj.height * 0.5f - vector2_2.Y; } while (flag) { float num7 = 12f; float f1 = (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); float f2 = f1; if (float.IsNaN(f1) || float.IsNaN(f2)) { flag = false; } else { if ((double) f1 < 20.0) { num7 = f1 - 8f; flag = false; } float num8 = 12f / f1; float num9 = num1 * num8; float num10 = num2 * num8; vector2_2.X += num9; vector2_2.Y += num10; num1 = proj.position.X + (float) proj.width * 0.5f - vector2_2.X; num2 = proj.position.Y + (float) proj.height * 0.1f - vector2_2.Y; if ((double) f2 > 12.0) { float num11 = 0.3f; float num12 = Math.Abs(proj.velocity.X) + Math.Abs(proj.velocity.Y); if ((double) num12 > 16.0) num12 = 16f; float num13 = (float) (1.0 - (double) num12 / 16.0); float num14 = num11 * num13; float num15 = f2 / 80f; if ((double) num15 > 1.0) num15 = 1f; float num16 = num14 * num15; if ((double) num16 < 0.0) num16 = 0.0f; float num17 = (float) (1.0 - (double) proj.localAI[0] / 100.0); float num18 = num16 * num17; if ((double) num2 > 0.0) { num2 *= 1f + num18; num1 *= 1f - num18; } else { float num19 = Math.Abs(proj.velocity.X) / 3f; if ((double) num19 > 1.0) num19 = 1f; float num20 = num19 - 0.5f; float num21 = num18 * num20; if ((double) num21 > 0.0) num21 *= 2f; num2 *= 1f + num21; num1 *= 1f - num21; } } float rotation = (float) Math.Atan2((double) num2, (double) num1) - 1.57f; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2_2.X / 16, (int) ((double) vector2_2.Y / 16.0), oldColor); Main.EntitySpriteDraw(TextureAssets.FishingLine.Value, new Vector2((float) ((double) vector2_2.X - (double) Main.screenPosition.X + (double) TextureAssets.FishingLine.Width() * 0.5), (float) ((double) vector2_2.Y - (double) Main.screenPosition.Y + (double) TextureAssets.FishingLine.Height() * 0.5)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.FishingLine.Width(), (int) num7)), color, rotation, new Vector2((float) TextureAssets.FishingLine.Width() * 0.5f, 0.0f), 1f, SpriteEffects.None, 0); } } } private void DrawProj_StardustGuardianPunching(Projectile proj) { int num1 = 6; Texture2D texture2D = TextureAssets.Extra[46].Value; int num2 = 20; Vector2 vector2 = proj.Center - proj.rotation.ToRotationVector2() * (float) num2 * (float) proj.spriteDirection; for (int index = 0; index < num1; ++index) { float num3 = Main.rand.NextFloat(); float num4 = Utils.GetLerpValue(0.0f, 0.3f, num3, true) * Utils.GetLerpValue(1f, 0.5f, num3, true); float num5 = MathHelper.Lerp(0.6f, 1f, Utils.GetLerpValue(0.0f, 0.3f, num3, true) * Utils.GetLerpValue(1f, 0.5f, num3, true)); Microsoft.Xna.Framework.Color color1 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue) * (num4 * 0.5f); Vector2 origin = texture2D.Size() / 2f; Microsoft.Xna.Framework.Color color2 = Microsoft.Xna.Framework.Color.White * num4; color2.A /= (byte) 2; Microsoft.Xna.Framework.Color color3 = color2 * 0.5f; float num6 = 1f; float num7 = (float) (1.0 + (double) Main.rand.NextFloat() * 0.5); float num8 = Main.rand.NextFloatDirection(); Vector2 scale = new Vector2(0.8f) * num7 * num6 * num5; float num9 = (float) (20.0 + (double) MathHelper.Lerp(0.0f, 20f, num3) + (double) num7 * 16.0); float f = (float) ((double) proj.rotation + (proj.direction == 1 ? 0.0 : 3.14159274101257) + (double) num8 * 6.28318548202515 * 0.0399999991059303); float rotation = f + 1.570796f; Vector2 position = vector2 + f.ToRotationVector2() * num9 + Main.rand.NextVector2Circular(20f, 20f) - Main.screenPosition; Microsoft.Xna.Framework.Color color4 = color1 * num6; Microsoft.Xna.Framework.Color color5 = color3 * num6; SpriteEffects effects = SpriteEffects.None; Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(), color4, rotation, origin, scale, effects, 0.0f); Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(), color5, rotation, origin, scale * 0.8f, effects, 0.0f); } } private void DrawProj_PiercingStarlight(Projectile proj) { int num1 = 3; this.LoadProjectile(proj.type); this.LoadItem(4923); int num2 = 2; Vector2 vector2_1 = proj.Center - proj.rotation.ToRotationVector2() * (float) num2; for (int index = 0; index < 1; ++index) { float num3 = Main.rand.NextFloat(); float num4 = Utils.GetLerpValue(0.0f, 0.3f, num3, true) * Utils.GetLerpValue(1f, 0.5f, num3, true); Microsoft.Xna.Framework.Color color = proj.GetAlpha(Lighting.GetColor(proj.Center.ToTileCoordinates())) * num4; Texture2D texture2D = TextureAssets.Item[4923].Value; Vector2 origin = texture2D.Size() / 2f; float num5 = Main.rand.NextFloatDirection(); float num6 = (float) (8.0 + (double) MathHelper.Lerp(0.0f, 20f, num3) + (double) Main.rand.NextFloat() * 6.0); float f = proj.rotation + (float) ((double) num5 * 6.28318548202515 * 0.0399999991059303); float rotation = f + 0.7853982f; Vector2 position = vector2_1 + f.ToRotationVector2() * num6 + Main.rand.NextVector2Circular(8f, 8f) - Main.screenPosition; SpriteEffects effects = SpriteEffects.None; if ((double) proj.rotation < -1.57079637050629 || (double) proj.rotation > 1.57079637050629) { rotation += 1.570796f; effects |= SpriteEffects.FlipHorizontally; } Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(), color, rotation, origin, 1f, effects, 0.0f); } for (int index = 0; index < num1; ++index) { float num7 = Main.rand.NextFloat(); float num8 = Utils.GetLerpValue(0.0f, 0.3f, num7, true) * Utils.GetLerpValue(1f, 0.5f, num7, true); float num9 = MathHelper.Lerp(0.6f, 1f, Utils.GetLerpValue(0.0f, 0.3f, num7, true) * Utils.GetLerpValue(1f, 0.5f, num7, true)); Microsoft.Xna.Framework.Color queenWeaponsColor = proj.GetFairyQueenWeaponsColor(0.25f, rawHueOverride: new float?((float) (((double) Main.rand.NextFloat() * 0.330000013113022 + (double) Main.GlobalTimeWrappedHourly) % 1.0))); Texture2D texture2D = TextureAssets.Projectile[proj.type].Value; Microsoft.Xna.Framework.Color color1 = queenWeaponsColor * (num8 * 0.5f); Vector2 origin = texture2D.Size() / 2f; Microsoft.Xna.Framework.Color color2 = Microsoft.Xna.Framework.Color.White * num8; color2.A /= (byte) 2; Microsoft.Xna.Framework.Color color3 = color2 * 0.5f; float num10 = 1f; float num11 = Main.rand.NextFloat() * 2f; float num12 = Main.rand.NextFloatDirection(); Vector2 scale = new Vector2(2.8f + num11, 1f) * num10 * num9; Vector2 vector2_2 = new Vector2((float) (1.5 + (double) num11 * 0.5), 1f) * num10 * num9; int num13 = 50; Vector2 vector2_3 = proj.rotation.ToRotationVector2() * (index >= 1 ? 56f : 0.0f); float num14 = (float) (0.0299999993294477 - (double) index * 0.0120000001043081); float num15 = (float) (30.0 + (double) MathHelper.Lerp(0.0f, (float) num13, num7) + (double) num11 * 16.0); float f = proj.rotation + num12 * 6.283185f * num14; float rotation = f; Vector2 position = vector2_1 + f.ToRotationVector2() * num15 + Main.rand.NextVector2Circular(20f, 20f) + vector2_3 - Main.screenPosition; Microsoft.Xna.Framework.Color color4 = color1 * num10; Microsoft.Xna.Framework.Color color5 = color3 * num10; SpriteEffects effects = SpriteEffects.None; Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(), color4, rotation, origin, scale, effects, 0.0f); Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(), color5, rotation, origin, scale * 0.6f, effects, 0.0f); } } private void DrawProj_FairyQueenLance(Projectile proj) { Vector2 position = proj.Center - Main.screenPosition; int num1 = 180 * 40 / 2; Microsoft.Xna.Framework.Color color1 = proj.AI_171_GetColor(); Microsoft.Xna.Framework.Color color2 = color1; color1.A = (byte) 0; color2.A /= (byte) 2; Texture2D texture2D1 = TextureAssets.Extra[178].Value; Vector2 origin1 = texture2D1.Frame().Size() * new Vector2(0.0f, 0.5f); Vector2 scale1 = new Vector2((float) (num1 / texture2D1.Width), 2f); Vector2 scale2 = new Vector2((float) (num1 / texture2D1.Width) * 0.5f, 2f); Microsoft.Xna.Framework.Color color3 = color1 * Utils.GetLerpValue(60f, 55f, proj.localAI[0], true) * Utils.GetLerpValue(0.0f, 10f, proj.localAI[0], true); Main.spriteBatch.Draw(texture2D1, position, new Microsoft.Xna.Framework.Rectangle?(), color3, proj.rotation, origin1, scale2, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(texture2D1, position, new Microsoft.Xna.Framework.Rectangle?(), color3 * 0.3f, proj.rotation, origin1, scale1, SpriteEffects.None, 0.0f); Texture2D texture2D2 = TextureAssets.Projectile[proj.type].Value; Vector2 origin2 = texture2D2.Frame().Size() / 2f; Microsoft.Xna.Framework.Color color4 = Microsoft.Xna.Framework.Color.White * Utils.GetLerpValue(0.0f, 20f, proj.localAI[0], true); color4.A /= (byte) 2; float scale3 = MathHelper.Lerp(0.7f, 1f, Utils.GetLerpValue(55f, 60f, proj.localAI[0], true)); float lerpValue1 = Utils.GetLerpValue(10f, 60f, proj.localAI[0], false); if ((double) lerpValue1 > 0.0) { float lerpValue2 = Utils.GetLerpValue(0.0f, 1f, proj.velocity.Length(), true); for (float num2 = 1f; (double) num2 > 0.0; num2 -= 0.1666667f) { Vector2 vector2 = proj.rotation.ToRotationVector2() * -120f * num2 * lerpValue2; Main.spriteBatch.Draw(texture2D2, position + vector2, new Microsoft.Xna.Framework.Rectangle?(), color1 * lerpValue1 * (1f - num2), proj.rotation, origin2, scale3, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(texture2D2, position + vector2, new Microsoft.Xna.Framework.Rectangle?(), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0) * 0.15f * lerpValue1 * (1f - num2), proj.rotation, origin2, scale3 * 0.85f, SpriteEffects.None, 0.0f); } for (float num3 = 0.0f; (double) num3 < 1.0; num3 += 0.25f) { Vector2 vector2 = (num3 * 6.283185f + proj.rotation).ToRotationVector2() * 2f * scale3; Main.spriteBatch.Draw(texture2D2, position + vector2, new Microsoft.Xna.Framework.Rectangle?(), color2 * lerpValue1, proj.rotation, origin2, scale3, SpriteEffects.None, 0.0f); } Main.spriteBatch.Draw(texture2D2, position, new Microsoft.Xna.Framework.Rectangle?(), color2 * lerpValue1, proj.rotation, origin2, scale3 * 1.1f, SpriteEffects.None, 0.0f); } Main.spriteBatch.Draw(texture2D2, position, new Microsoft.Xna.Framework.Rectangle?(), color4, proj.rotation, origin2, scale3, SpriteEffects.None, 0.0f); } private void DrawProj_FairyQueenRangedItemShot(Projectile proj) { Vector2 position = proj.Center - Main.screenPosition; Microsoft.Xna.Framework.Color queenWeaponsColor1 = proj.GetFairyQueenWeaponsColor(0.0f); Microsoft.Xna.Framework.Color queenWeaponsColor2 = proj.GetFairyQueenWeaponsColor(0.5f); Texture2D texture2D = TextureAssets.Projectile[proj.type].Value; Vector2 origin = texture2D.Frame().Size() / 2f; Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.White * proj.Opacity; color.A /= (byte) 2; float scale = MathHelper.Lerp(0.7f, 1f, Utils.GetLerpValue(0.0f, 5f, proj.ai[0], true)); float opacity = proj.Opacity; if ((double) opacity > 0.0) { float lerpValue = Utils.GetLerpValue(0.0f, 1f, proj.velocity.Length(), true); for (float num = 0.0f; (double) num < 1.0; num += 0.1666667f) { Vector2 vector2 = proj.rotation.ToRotationVector2() * -120f * num * lerpValue; Main.spriteBatch.Draw(texture2D, position + vector2, new Microsoft.Xna.Framework.Rectangle?(), queenWeaponsColor1 * opacity * (1f - num), proj.rotation, origin, scale, SpriteEffects.None, 0.0f); } for (float num = 0.0f; (double) num < 1.0; num += 0.25f) { Vector2 vector2 = (num * 6.283185f + proj.rotation).ToRotationVector2() * 4f * scale; Main.spriteBatch.Draw(texture2D, position + vector2, new Microsoft.Xna.Framework.Rectangle?(), queenWeaponsColor2 * opacity, proj.rotation, origin, scale, SpriteEffects.None, 0.0f); } } Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(), color, proj.rotation, origin, scale, SpriteEffects.None, 0.0f); } private void DrawProj_EmpressBlade(Projectile proj, float hueOverride) { Main.CurrentDrawnEntityShader = -1; this.PrepareDrawnEntityDrawing((Entity) proj, Main.GetProjectileDesiredShader(proj.whoAmI)); Vector2 position = proj.Center - Main.screenPosition; proj.GetFairyQueenWeaponsColor(0.0f, rawHueOverride: new float?(hueOverride)); Microsoft.Xna.Framework.Color queenWeaponsColor = proj.GetFairyQueenWeaponsColor(0.5f, rawHueOverride: new float?(hueOverride)); Texture2D texture2D = TextureAssets.Projectile[proj.type].Value; Vector2 origin = texture2D.Frame().Size() / 2f; Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.White * proj.Opacity; color.A = (byte) ((double) color.A * 0.699999988079071); queenWeaponsColor.A /= (byte) 2; float scale = proj.scale; float num1 = proj.rotation - 1.570796f; float num2 = proj.Opacity * 0.3f; if ((double) num2 > 0.0) { float lerpValue = Utils.GetLerpValue(60f, 50f, proj.ai[0], true); float num3 = Utils.GetLerpValue(70f, 50f, proj.ai[0], true) * Utils.GetLerpValue(40f, 45f, proj.ai[0], true); for (float num4 = 0.0f; (double) num4 < 1.0; num4 += 0.1666667f) { Vector2 vector2 = num1.ToRotationVector2() * -120f * num4 * lerpValue; Main.EntitySpriteDraw(texture2D, position + vector2, new Microsoft.Xna.Framework.Rectangle?(), queenWeaponsColor * num2 * (1f - num4) * num3, num1, origin, scale * 1.5f, SpriteEffects.None, 0); } for (float num5 = 0.0f; (double) num5 < 1.0; num5 += 0.25f) { Vector2 vector2 = (num5 * 6.283185f + num1).ToRotationVector2() * 4f * scale; Main.EntitySpriteDraw(texture2D, position + vector2, new Microsoft.Xna.Framework.Rectangle?(), queenWeaponsColor * num2, num1, origin, scale, SpriteEffects.None, 0); } } Main.EntitySpriteDraw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(), color, num1, origin, scale, SpriteEffects.None, 0); Main.EntitySpriteDraw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(), queenWeaponsColor * num2 * 0.5f, num1, origin, scale, SpriteEffects.None, 0); } private void DrawProj_CoolWhipMinion(Projectile proj) { Vector2 position = proj.Center - Main.screenPosition; Microsoft.Xna.Framework.Color color1 = Microsoft.Xna.Framework.Color.White * 0.5f; color1.A = (byte) 0; Microsoft.Xna.Framework.Color color2 = color1; color2.A = (byte) 127; Texture2D texture2D = TextureAssets.Projectile[proj.type].Value; Vector2 origin = texture2D.Frame().Size() / 2f; Microsoft.Xna.Framework.Color color3 = Microsoft.Xna.Framework.Color.White * proj.Opacity; color3.A /= (byte) 2; int num1 = 1; float opacity = proj.Opacity; if ((double) opacity > 0.0) { for (float num2 = 0.0f; (double) num2 < 4.0; ++num2) { Vector2 vector2 = proj.velocity * -num2; Main.spriteBatch.Draw(texture2D, position + vector2, new Microsoft.Xna.Framework.Rectangle?(), color1 * opacity * (float) ((4.0 - (double) num2) / 4.0), proj.rotation, origin, (float) num1, SpriteEffects.None, 0.0f); } for (float num3 = 0.0f; (double) num3 < 1.0; num3 += 0.25f) { Vector2 vector2 = (num3 * 6.283185f + proj.rotation).ToRotationVector2() * 4f * (float) num1; Main.spriteBatch.Draw(texture2D, position + vector2, new Microsoft.Xna.Framework.Rectangle?(), color2 * opacity, proj.rotation, origin, (float) num1, SpriteEffects.None, 0.0f); } } Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(), color3, proj.rotation, origin, (float) num1, SpriteEffects.None, 0.0f); } private void DrawMurderAurora(Projectile proj) { Texture2D texture2D = TextureAssets.Projectile[proj.type].Value; Vector2 origin = texture2D.Size() / 2f; float num1 = (float) ((double) Main.GlobalTimeWrappedHourly % 10.0 / 10.0); Vector2 vector2_1 = proj.Center - Main.screenPosition; float[] numArray1 = new float[15]; float[] numArray2 = new float[15]; float[] numArray3 = new float[15]; float[] numArray4 = new float[15]; float[] numArray5 = new float[15]; int num2 = 210; float num3 = Utils.GetLerpValue(0.0f, 60f, (float) proj.timeLeft, true) * Utils.GetLerpValue((float) num2, (float) (num2 - 60), (float) proj.timeLeft, true); float num4 = MathHelper.Lerp(0.2f, 0.5f, Utils.GetLerpValue(0.0f, 60f, (float) proj.timeLeft, true) * Utils.GetLerpValue((float) num2, 90f, (float) proj.timeLeft, true)); double num5 = 800.0 / (double) texture2D.Width; float num6 = (float) (num5 * 0.800000011920929); float num7 = (float) ((num5 - (double) num6) / 15.0); float num8 = 30f; float num9 = 300f; Vector2 vector2_2 = new Vector2(3f, 6f); for (int index = 0; index < 15; ++index) { double num10 = (double) (index + 1) / 50.0; float num11 = (float) Math.Sin((double) num1 * 6.28318548202515 + 1.57079637050629 + (double) index / 2.0); numArray1[index] = num11 * (num9 - (float) index * 3f); numArray2[index] = (float) Math.Sin((double) num1 * 6.28318548202515 * 2.0 + 1.04719758033752 + (double) index) * num8; numArray2[index] -= (float) index * 3f; numArray3[index] = (float) ((double) index / 15.0 * 2.0) + num1; numArray3[index] = (float) (((double) num11 * 0.5 + 0.5) * 0.600000023841858) + num1; numArray4[index] = (float) (1.0 - Math.Pow(1.0 * (double) index / 15.0, 2.0)); numArray5[index] = num6 + (float) (index + 1) * num7; numArray5[index] *= 0.3f; Microsoft.Xna.Framework.Color color = Main.hslToRgb(numArray3[index] % 1f, 1f, 0.5f) * num3 * num4; color.A /= (byte) 4; float rotation = (float) (1.57079637050629 + (double) num11 * 0.785398185253143 * -0.300000011920929 + 3.14159274101257 * (double) index); Main.EntitySpriteDraw(texture2D, vector2_1 + new Vector2(numArray1[index], numArray2[index]), new Microsoft.Xna.Framework.Rectangle?(), color, rotation, origin, new Vector2(numArray5[index], numArray5[index]) * vector2_2, SpriteEffects.None, 0); } } private void DrawWhip(Projectile proj) { List controlPoints = new List(); Projectile.FillWhipControlPoints(proj, controlPoints); Texture2D texture2D = TextureAssets.FishingLine.Value; Microsoft.Xna.Framework.Rectangle rectangle = texture2D.Frame(); Vector2 origin = new Vector2((float) (rectangle.Width / 2), 2f); Microsoft.Xna.Framework.Color originalColor = Microsoft.Xna.Framework.Color.White; switch (proj.type) { case 847: originalColor = Microsoft.Xna.Framework.Color.OrangeRed; break; case 848: originalColor = Microsoft.Xna.Framework.Color.DarkBlue; break; case 849: Microsoft.Xna.Framework.Color slateBlue = Microsoft.Xna.Framework.Color.SlateBlue; originalColor = Microsoft.Xna.Framework.Color.Black; break; case 912: originalColor = Microsoft.Xna.Framework.Color.LightBlue; break; case 913: originalColor = Microsoft.Xna.Framework.Color.Firebrick; break; case 914: originalColor = Microsoft.Xna.Framework.Color.ForestGreen; break; case 915: originalColor = Microsoft.Xna.Framework.Color.White; break; } Vector2 vector2_1 = controlPoints[0]; for (int index = 0; index < controlPoints.Count - 1; ++index) { Vector2 vec = controlPoints[index]; Vector2 v = controlPoints[index + 1] - vec; float rotation = v.ToRotation() - 1.570796f; Microsoft.Xna.Framework.Color color = Lighting.GetColor(vec.ToTileCoordinates(), originalColor); Vector2 scale = new Vector2(1f, (v.Length() + 2f) / (float) rectangle.Height); Main.spriteBatch.Draw(texture2D, vector2_1 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangle), color, rotation, origin, scale, SpriteEffects.None, 0.0f); vector2_1 += v; } Vector2 vector2_2; switch (proj.type) { case 841: vector2_2 = Main.DrawWhip_WhipBland(proj, controlPoints); break; case 847: vector2_2 = Main.DrawWhip_WhipSword(proj, controlPoints); break; case 848: vector2_2 = Main.DrawWhip_WhipMace(proj, controlPoints); break; case 849: vector2_2 = Main.DrawWhip_WhipScythe(proj, controlPoints); break; case 912: vector2_2 = Main.DrawWhip_CoolWhip(proj, controlPoints); break; case 913: vector2_2 = Main.DrawWhip_FireWhip(proj, controlPoints); break; case 914: vector2_2 = Main.DrawWhip_ThornWhip(proj, controlPoints); break; case 915: vector2_2 = Main.DrawWhip_RainbowWhip(proj, controlPoints); break; } } private static Vector2 DrawWhip_CoolWhip(Projectile proj, List controlPoints) { Texture2D texture2D = TextureAssets.Projectile[proj.type].Value; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: 5); int height = r.Height; r.Height -= 2; Vector2 vector2 = r.Size() / 2f; Vector2 controlPoint1 = controlPoints[0]; for (int index = 0; index < controlPoints.Count - 1; ++index) { bool flag = true; Vector2 origin = vector2; switch (index) { case 0: origin.Y -= 4f; break; case 3: case 5: case 7: r.Y = height; break; case 9: case 11: case 13: r.Y = height * 2; break; case 15: case 17: r.Y = height * 3; break; case 19: r.Y = height * 4; break; default: flag = false; break; } Vector2 controlPoint2 = controlPoints[index]; Vector2 v = controlPoints[index + 1] - controlPoint2; if (flag) { float rotation = v.ToRotation() - 1.570796f; Microsoft.Xna.Framework.Color alpha = proj.GetAlpha(Lighting.GetColor(controlPoint2.ToTileCoordinates())); Main.spriteBatch.Draw(texture2D, controlPoint1 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(r), alpha, rotation, origin, 1f, SpriteEffects.None, 0.0f); } controlPoint1 += v; } return controlPoint1; } private static Vector2 DrawWhip_FireWhip(Projectile proj, List controlPoints) { Texture2D texture2D = TextureAssets.Projectile[proj.type].Value; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: 5); int height = r.Height; r.Height -= 2; Vector2 vector2 = r.Size() / 2f; Vector2 controlPoint1 = controlPoints[0]; for (int index = 0; index < controlPoints.Count - 1; ++index) { bool flag = true; Vector2 origin = vector2; switch (index) { case 0: origin.Y -= 4f; break; case 3: case 5: case 7: r.Y = height; break; case 9: case 11: case 13: r.Y = height * 2; break; case 15: case 17: r.Y = height * 3; break; case 19: r.Y = height * 4; break; default: flag = false; break; } Vector2 controlPoint2 = controlPoints[index]; Vector2 v = controlPoints[index + 1] - controlPoint2; if (flag) { float rotation = v.ToRotation() - 1.570796f; Microsoft.Xna.Framework.Color alpha = proj.GetAlpha(Lighting.GetColor(controlPoint2.ToTileCoordinates())); Main.spriteBatch.Draw(texture2D, controlPoint1 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(r), alpha, rotation, origin, 1f, SpriteEffects.None, 0.0f); } controlPoint1 += v; } return controlPoint1; } private static Vector2 DrawWhip_RainbowWhip(Projectile proj, List controlPoints) { Texture2D texture2D = TextureAssets.Projectile[proj.type].Value; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: 5); int height = r.Height; r.Height -= 2; Vector2 vector2 = r.Size() / 2f; Vector2 controlPoint1 = controlPoints[0]; float counterNormalized = Main.player[proj.owner].miscCounterNormalized; for (int index = 0; index < controlPoints.Count - 1; ++index) { bool flag = true; Vector2 origin = vector2; switch (index) { case 0: origin.Y -= 4f; break; case 39: r.Y = height * 4; break; default: flag = index % 2 == 0; r.Y = height * (1 + index % 3); break; } Vector2 controlPoint2 = controlPoints[index]; Vector2 v = controlPoints[index + 1] - controlPoint2; if (flag) { Microsoft.Xna.Framework.Color rgb = Main.hslToRgb((float) (((double) counterNormalized * 5.0 + (double) index * 0.0500000007450581) % 1.0), 1f, 0.5f); Microsoft.Xna.Framework.Color color1 = rgb; float lerpValue = Utils.GetLerpValue((float) (controlPoints.Count - 10), (float) (controlPoints.Count - 2), (float) index, true); float scale = MathHelper.Lerp(1f, 1f, lerpValue); color1.A /= (byte) 2; color1.A = (byte) ((double) color1.A * (double) lerpValue); float rotation = v.ToRotation() - 1.570796f; Microsoft.Xna.Framework.Color color2 = Lighting.GetColor(controlPoint2.ToTileCoordinates()); Main.spriteBatch.Draw(texture2D, controlPoint1 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(r), Microsoft.Xna.Framework.Color.Lerp(color2, color1, 0.5f), rotation, origin, scale, SpriteEffects.None, 0.0f); color1.A = (byte) 0; Main.spriteBatch.Draw(texture2D, controlPoint1 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(r), color1 * 0.1f, rotation, origin, scale * 1.2f, SpriteEffects.None, 0.0f); if (index == 39) { color1 = rgb; color1.A = (byte) 127; Main.spriteBatch.Draw(texture2D, controlPoint1 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(r), color1 * 0.3f, rotation, origin, scale * 1.4f, SpriteEffects.None, 0.0f); } } controlPoint1 += v; } return controlPoint1; } private static Vector2 DrawWhip_ThornWhip(Projectile proj, List controlPoints) { Texture2D texture2D = TextureAssets.Projectile[proj.type].Value; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: 5); int height = r.Height; r.Height -= 2; Vector2 vector2 = r.Size() / 2f; Vector2 controlPoint1 = controlPoints[0]; for (int index = 0; index < controlPoints.Count - 1; ++index) { bool flag = true; Vector2 origin = vector2; float scale = 1f; switch (index) { case 0: origin.Y -= 4f; break; case 19: r.Y = height * 4; scale = 1.1f; break; default: r.Y = height * (1 + index % 3); scale = 0.8f; break; } Vector2 controlPoint2 = controlPoints[index]; Vector2 v = controlPoints[index + 1] - controlPoint2; if (flag) { float rotation = v.ToRotation() - 1.570796f; Microsoft.Xna.Framework.Color color = Lighting.GetColor(controlPoint2.ToTileCoordinates()); Main.spriteBatch.Draw(texture2D, controlPoint1 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(r), color, rotation, origin, scale, SpriteEffects.None, 0.0f); } controlPoint1 += v; } return controlPoint1; } private static Vector2 DrawWhip_WhipSword(Projectile proj, List controlPoints) { Texture2D texture2D = TextureAssets.Projectile[proj.type].Value; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: 5); int height = r.Height; r.Height -= 2; Vector2 vector2 = r.Size() / 2f; Vector2 controlPoint1 = controlPoints[0]; for (int index = 0; index < controlPoints.Count - 1; ++index) { bool flag = true; Vector2 origin = vector2; switch (index) { case 0: origin.Y -= 4f; break; case 3: case 5: case 7: r.Y = height; break; case 9: case 11: case 13: r.Y = height * 2; break; case 15: case 17: r.Y = height * 3; break; case 19: r.Y = height * 4; break; default: flag = false; break; } Vector2 controlPoint2 = controlPoints[index]; Vector2 v = controlPoints[index + 1] - controlPoint2; if (flag) { float rotation = v.ToRotation() - 1.570796f; Microsoft.Xna.Framework.Color color = Lighting.GetColor(controlPoint2.ToTileCoordinates()); Main.spriteBatch.Draw(texture2D, controlPoint1 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(r), color, rotation, origin, 1f, SpriteEffects.None, 0.0f); } controlPoint1 += v; } return controlPoint1; } private static Vector2 DrawWhip_WhipMace(Projectile proj, List controlPoints) { SpriteEffects effects = SpriteEffects.None; if (proj.spriteDirection == 1) effects ^= SpriteEffects.FlipHorizontally; Texture2D texture2D = TextureAssets.Projectile[proj.type].Value; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: 5); int height = r.Height; r.Height -= 2; Vector2 vector2 = r.Size() / 2f; Vector2 controlPoint1 = controlPoints[0]; for (int index = 0; index < controlPoints.Count - 1; ++index) { bool flag = false; Vector2 origin = vector2; float scale = 1f; if (index == 0) { origin.Y -= 4f; flag = true; } else if (index % 2 == 0) { flag = true; int num = 1; if (index > 10) num = 2; if (index > 20) num = 3; r.Y = height * num; } if (index == controlPoints.Count - 2) { flag = true; r.Y = height * 4; float timeToFlyOut; Projectile.GetWhipSettings(proj, out timeToFlyOut, out int _, out float _); float t = proj.ai[0] / timeToFlyOut; scale = MathHelper.Lerp(0.5f, 2f, Utils.GetLerpValue(0.1f, 0.7f, t, true) * Utils.GetLerpValue(0.9f, 0.7f, t, true)); } Vector2 controlPoint2 = controlPoints[index]; Vector2 v = controlPoints[index + 1] - controlPoint2; if (flag) { float rotation = v.ToRotation() - 1.570796f; Microsoft.Xna.Framework.Color color = Lighting.GetColor(controlPoint2.ToTileCoordinates()); Main.spriteBatch.Draw(texture2D, controlPoint1 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(r), color, rotation, origin, scale, effects, 0.0f); } controlPoint1 += v; } return controlPoint1; } private static Vector2 DrawWhip_WhipScythe(Projectile proj, List controlPoints) { SpriteEffects effects = SpriteEffects.None; if (proj.spriteDirection == 1) effects ^= SpriteEffects.FlipHorizontally; Texture2D texture2D = TextureAssets.Projectile[proj.type].Value; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: 5); int height = r.Height; r.Height -= 2; Vector2 vector2 = r.Size() / 2f; Vector2 controlPoint1 = controlPoints[0]; for (int index = 0; index < controlPoints.Count - 1; ++index) { bool flag = false; Vector2 origin = vector2; float scale = 1f; if (index == 0) { origin.Y -= 4f; flag = true; } else if (index % 2 == 0) { flag = true; int num = 1; if (index > 10) num = 2; if (index > 20) num = 3; r.Y = height * num; } if (index == controlPoints.Count - 2) { flag = true; r.Y = height * 4; float timeToFlyOut; Projectile.GetWhipSettings(proj, out timeToFlyOut, out int _, out float _); float t = proj.ai[0] / timeToFlyOut; scale = MathHelper.Lerp(0.5f, 1.5f, Utils.GetLerpValue(0.1f, 0.7f, t, true) * Utils.GetLerpValue(0.9f, 0.7f, t, true)); } Vector2 controlPoint2 = controlPoints[index]; Vector2 v = controlPoints[index + 1] - controlPoint2; if (flag) { float rotation = v.ToRotation() - 1.570796f; Microsoft.Xna.Framework.Color color = Lighting.GetColor(controlPoint2.ToTileCoordinates()); Main.spriteBatch.Draw(texture2D, controlPoint1 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(r), color, rotation, origin, scale, effects, 0.0f); } controlPoint1 += v; } return controlPoint1; } private static Vector2 DrawWhip_WhipBland(Projectile proj, List controlPoints) { SpriteEffects effects = SpriteEffects.None; if (proj.spriteDirection == 1) effects ^= SpriteEffects.FlipHorizontally; Texture2D texture2D = TextureAssets.Projectile[proj.type].Value; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: 5); int height = r.Height; r.Height -= 2; Vector2 vector2 = r.Size() / 2f; Vector2 controlPoint1 = controlPoints[0]; for (int index = 0; index < controlPoints.Count - 1; ++index) { Vector2 origin = vector2; float scale = 1f; bool flag; if (index == 0) { origin.Y -= 4f; flag = true; } else { flag = true; int num = 1; if (index > 10) num = 2; if (index > 20) num = 3; r.Y = height * num; } if (index == controlPoints.Count - 2) { flag = true; r.Y = height * 4; float timeToFlyOut; Projectile.GetWhipSettings(proj, out timeToFlyOut, out int _, out float _); float t = proj.ai[0] / timeToFlyOut; scale = MathHelper.Lerp(0.5f, 1.5f, Utils.GetLerpValue(0.1f, 0.7f, t, true) * Utils.GetLerpValue(0.9f, 0.7f, t, true)); } Vector2 controlPoint2 = controlPoints[index]; Vector2 v = controlPoints[index + 1] - controlPoint2; if (flag) { float rotation = v.ToRotation() - 1.570796f; Microsoft.Xna.Framework.Color color = Lighting.GetColor(controlPoint2.ToTileCoordinates()); Main.spriteBatch.Draw(texture2D, controlPoint1 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(r), color, rotation, origin, scale, effects, 0.0f); } controlPoint1 += v; } return controlPoint1; } private void DrawWhipOld(Projectile proj) { List vector2List = new List(); float num1 = 100f; float num2 = proj.ai[0] / num1; if ((double) num2 <= 1.0) { float num3 = (float) (12.5663709640503 * (1.0 - (double) num2) * (double) -proj.spriteDirection / 20.0); float num4 = (float) ((double) proj.velocity.Length() * ((double) proj.ai[0] - 1.0) / 20.0); float num5 = num2; Vector2 vector2_1 = Main.player[proj.owner].Center; Vector2 vector2_2 = vector2_1; float f1 = proj.rotation - 1.570796f; float f2 = (float) ((double) proj.rotation - 1.57079637050629 + 1.57079637050629 * (double) proj.spriteDirection); for (int index = 0; index < 20; ++index) { float num6 = (float) index / 20f; Vector2 vector2_3 = vector2_1 + f1.ToRotationVector2() * num4; Vector2 vector2_4 = vector2_2 + f2.ToRotationVector2() * (num4 * 2f); float num7 = num3 * num6 * num5; f1 += num7; f2 += num7; vector2List.Add(Vector2.Lerp(vector2_4, vector2_3, (float) ((double) num2 * 0.5 + 0.5))); vector2_1 = vector2_3; vector2_2 = vector2_4; } } Texture2D texture2D = TextureAssets.FishingLine.Value; Microsoft.Xna.Framework.Rectangle rectangle = texture2D.Frame(); Vector2 origin = new Vector2((float) (rectangle.Width / 2), 2f); for (int index = 0; index < vector2List.Count - 1; ++index) { Vector2 vector2 = vector2List[index]; Vector2 Target = vector2List[index + 1]; float rotation = vector2.DirectionTo(Target).ToRotation() - 1.570796f; Microsoft.Xna.Framework.Color color = Lighting.GetColor(vector2.ToTileCoordinates()); Vector2 scale = new Vector2(1f, ((Target - vector2).Length() + 2f) / (float) rectangle.Height); Main.spriteBatch.Draw(texture2D, vector2 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangle), color, rotation, origin, scale, SpriteEffects.None, 0.0f); } } private void DrawTwinsPet(Projectile proj) { Texture2D texture2D = TextureAssets.Projectile[proj.type].Value; SpriteEffects effects = proj.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: Main.projFrames[proj.type], frameY: proj.frame); Vector2 origin = r.Size() / 2f; Vector2 vector2 = proj.Center - Main.screenPosition; Microsoft.Xna.Framework.Color alpha = proj.GetAlpha(Lighting.GetColor(proj.Center.ToTileCoordinates())); Vector2 position1 = vector2 + (Main.GlobalTimeWrappedHourly * 2f).ToRotationVector2() * 18f; Main.EntitySpriteDraw(texture2D, position1, new Microsoft.Xna.Framework.Rectangle?(r), alpha, proj.rotation, origin, proj.scale, effects, 0); Vector2 position2 = vector2 - (Main.GlobalTimeWrappedHourly * 2f).ToRotationVector2() * 18f; Microsoft.Xna.Framework.Rectangle rectangle = texture2D.Frame(verticalFrames: Main.projFrames[proj.type], frameY: (proj.frame + 18)); Main.EntitySpriteDraw(texture2D, position2, new Microsoft.Xna.Framework.Rectangle?(rectangle), alpha, proj.rotation, origin, proj.scale, effects, 0); } private void DrawMultisegmentPet(Projectile proj) { Texture2D texture2D = TextureAssets.Projectile[proj.type].Value; Texture2D texture = (Texture2D) null; if (proj.type == 887) texture = TextureAssets.GlowMask[275].Value; int num1 = 5; int num2 = 16; switch (proj.type) { case 883: num1 = 5; num2 = 16; break; case 887: num1 = 6; num2 = 16; break; case 893: num1 = 8; num2 = 20; break; } SpriteEffects effects1 = proj.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: Main.projFrames[proj.type]); Vector2 origin = r.Size() / 2f; Vector2 position1 = proj.Center - Main.screenPosition; Microsoft.Xna.Framework.Color alpha = proj.GetAlpha(Lighting.GetColor(proj.Center.ToTileCoordinates())); Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.White * ((float) Main.mouseTextColor / (float) byte.MaxValue); Vector2 vector2_1 = proj.Center; int num3 = 1; int num4 = Main.projFrames[proj.type] - 1; for (int index = 1; index < num1; ++index) { int frameY = num3; if (index == num1 - 1) frameY = num4; else if (proj.type == 893 && index != 2 && index != 5) frameY = 2; Microsoft.Xna.Framework.Rectangle rectangle = texture2D.Frame(verticalFrames: Main.projFrames[proj.type], frameY: frameY); Vector2 vector2_2 = proj.oldPos[index * 10] + proj.Size / 2f; float rotation1 = (vector2_1 - vector2_2).ToRotation(); Vector2 vec = vector2_1 - new Vector2((float) num2, 0.0f).RotatedBy((double) rotation1, Vector2.Zero); float rotation2 = (vector2_1 - vec).ToRotation() + 1.570796f; Vector2 position2 = vec - Main.screenPosition; SpriteEffects effects2 = (double) vec.X < (double) vector2_1.X ? SpriteEffects.None : SpriteEffects.FlipHorizontally; vector2_1 = vec; Main.EntitySpriteDraw(texture2D, position2, new Microsoft.Xna.Framework.Rectangle?(rectangle), proj.GetAlpha(Lighting.GetColor(vec.ToTileCoordinates())), rotation2, origin, proj.scale, effects2, 0); if (texture != null) Main.EntitySpriteDraw(texture, position2, new Microsoft.Xna.Framework.Rectangle?(rectangle), proj.GetAlpha(color), rotation2, origin, proj.scale, effects2, 0); } Main.EntitySpriteDraw(texture2D, position1, new Microsoft.Xna.Framework.Rectangle?(r), alpha, proj.rotation, origin, proj.scale, effects1, 0); if (texture == null) return; Main.EntitySpriteDraw(texture, position1, new Microsoft.Xna.Framework.Rectangle?(r), color, proj.rotation, origin, proj.scale, effects1, 0); } private void DrawKite(Projectile proj) { Texture2D texture2D1 = TextureAssets.Projectile[proj.type].Value; Texture2D texture2D2 = TextureAssets.Extra[103].Value; int horizontalFrames = 15; float num1 = 0.0f; int num2 = 10; int num3 = 5; float num4 = 10f; float num5 = 0.0f; int num6 = -14; int num7 = -2; int num8 = -1; int num9 = -1; int num10 = 8; int num11 = 0; int num12 = 1; int num13 = 0; int num14 = 0; bool flag1 = true; bool flag2 = false; switch (proj.type) { case 766: case 767: case 768: case 769: case 770: num11 = (proj.type - 766) * 3 + 3; break; case 771: texture2D2 = TextureAssets.Extra[104].Value; horizontalFrames = 12; num11 = 12; num1 = proj.spriteDirection == 1 ? 1.570796f : -1.570796f; num2 = 12; num4 = 22f; num5 += 0.3926991f * (float) proj.spriteDirection; num6 = -8; num7 = -6; num8 = 10; num9 = 8; num10 = 12; break; case 822: texture2D2 = TextureAssets.Extra[132].Value; horizontalFrames = 7; num11 = 7; num1 = proj.spriteDirection == 1 ? 1.570796f : -1.570796f; num2 = 7; num4 = 22f; num5 += 0.2617994f * (float) proj.spriteDirection; num6 = -20; num7 = -6; num10 = 12; break; case 823: case 846: texture2D2 = TextureAssets.Extra[133].Value; if (proj.type == 846) texture2D2 = TextureAssets.Extra[146].Value; horizontalFrames = 6; num11 = 6; num1 = proj.spriteDirection == 1 ? 1.570796f : -1.570796f; num2 = 6; num4 = 40f; num5 += 0.2617994f * (float) proj.spriteDirection; num6 = -16; num7 = -10; num10 = 30; break; case 824: case 826: case 839: case 840: case 853: num12 = 0; break; case 827: case 844: texture2D2 = TextureAssets.Extra[135].Value; if (proj.type == 844) texture2D2 = TextureAssets.Extra[144].Value; horizontalFrames = 4; num11 = 3; num1 = proj.spriteDirection == 1 ? 1.570796f : -1.570796f; num2 = 16; num4 = 10f; num5 += 0.2617994f * (float) proj.spriteDirection; num7 = -4; num3 = 4; flag2 = true; break; case 828: case 829: texture2D2 = TextureAssets.Extra[136].Value; if (proj.type == 829) texture2D2 = TextureAssets.Extra[137].Value; horizontalFrames = 2; num11 = 1; num1 = proj.spriteDirection == 1 ? 1.570796f : -1.570796f; num2 = 6; num4 = 10f; num5 += 0.2617994f * (float) proj.spriteDirection; num10 = 10; num7 = -4; num12 = 3; flag1 = false; flag2 = true; break; case 830: case 838: texture2D2 = TextureAssets.Extra[138].Value; if (proj.type == 838) texture2D2 = TextureAssets.Extra[139].Value; horizontalFrames = 3; num11 = 3; num1 = proj.spriteDirection == 1 ? 1.570796f : -1.570796f; num2 = 3; num4 = 60f; num9 = 40; num8 = 3; num5 += 0.2617994f * (float) proj.spriteDirection; num10 = 50; num7 = -20; num13 = -10; break; case 843: texture2D2 = TextureAssets.Extra[140].Value; horizontalFrames = 2; num11 = 2; num1 = proj.spriteDirection == 1 ? 1.570796f : -1.570796f; num2 = 2; num4 = 30f; num5 += 0.2617994f * (float) proj.spriteDirection; num10 = 20; num7 = -16; num13 = -10; break; case 845: texture2D2 = TextureAssets.Extra[145].Value; horizontalFrames = 3; num11 = 3; num1 = proj.spriteDirection == 1 ? 1.570796f : -1.570796f; num2 = 3; num4 = 42f; num9 = 50; num8 = 2; num5 += 0.2617994f * (float) proj.spriteDirection; num10 = 30; num7 = -8; num13 = -10; break; case 850: texture2D2 = TextureAssets.Extra[147].Value; horizontalFrames = 8; num11 = 8; num1 = proj.spriteDirection == 1 ? 1.570796f : -1.570796f; num2 = 8; num4 = 22f; num5 += 0.2617994f * (float) proj.spriteDirection; num6 = -20; num7 = -38; num10 = 12; num13 = 6; num14 = 2; flag1 = false; break; case 852: texture2D2 = TextureAssets.Extra[148].Value; horizontalFrames = 2; num11 = 1; num1 = proj.spriteDirection == 1 ? 1.570796f : -1.570796f; num2 = 6; num4 = 10f; num5 += 0.2617994f * (float) proj.spriteDirection; num10 = 10; num7 = -4; num12 = 4; flag1 = false; flag2 = true; break; } SpriteEffects effects = proj.spriteDirection == 1 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; Microsoft.Xna.Framework.Rectangle r1 = texture2D1.Frame(Main.projFrames[proj.type], frameX: proj.frame); Vector2 origin1 = r1.Size() / 2f; Vector2 position = proj.Center - Main.screenPosition; Microsoft.Xna.Framework.Color color1 = Lighting.GetColor(proj.Center.ToTileCoordinates()); Microsoft.Xna.Framework.Color alpha = proj.GetAlpha(color1); Texture2D texture2D3 = TextureAssets.FishingLine.Value; Microsoft.Xna.Framework.Rectangle rectangle1 = texture2D3.Frame(); Vector2 origin2 = new Vector2((float) (rectangle1.Width / 2), 2f); Microsoft.Xna.Framework.Rectangle r2 = texture2D2.Frame(horizontalFrames); int width = r2.Width; r2.Width -= 2; Vector2 origin3 = r2.Size() / 2f; r2.X = width * (horizontalFrames - 1); Vector2 playerArmPosition = Main.GetPlayerArmPosition(proj); Vector2 center = proj.Center; double num15 = (double) Vector2.Distance(center, playerArmPosition); float num16 = 12f; Vector2 vector2_1 = (playerArmPosition - center).SafeNormalize(Vector2.Zero) * num16; Vector2 vector2_2 = playerArmPosition; Vector2 v1 = center - vector2_2; Vector2 velocity = proj.velocity; if ((double) Math.Abs(velocity.X) > (double) Math.Abs(velocity.Y)) Utils.Swap(ref velocity.X, ref velocity.Y); float num17 = v1.Length(); float num18 = 16f; float num19 = 80f; bool flag3 = true; if ((double) num17 == 0.0) { flag3 = false; } else { Vector2 vector2_3 = v1 * (12f / num17); vector2_2 -= vector2_3; v1 = center - vector2_2; } while (flag3) { float num20 = 12f; float f = v1.Length(); float num21 = f; if (float.IsNaN(f) || (double) f == 0.0) { flag3 = false; } else { if ((double) f < 20.0) { num20 = f - 8f; flag3 = false; } float num22 = 12f / f; Vector2 vector2_4 = v1 * num22; vector2_2 += vector2_4; v1 = center - vector2_2; if ((double) num21 > 12.0) { float num23 = 0.3f; float num24 = Math.Abs(velocity.X) + Math.Abs(velocity.Y); if ((double) num24 > (double) num18) num24 = num18; float num25 = (float) (1.0 - (double) num24 / (double) num18); float num26 = num23 * num25; float num27 = num21 / num19; if ((double) num27 > 1.0) num27 = 1f; float num28 = num26 * num27; if ((double) num28 < 0.0) num28 = 0.0f; float num29 = 1f; float num30 = num28 * num29; if ((double) v1.Y > 0.0) { v1.Y *= 1f + num30; v1.X *= 1f - num30; } else { float num31 = Math.Abs(velocity.X) / 3f; if ((double) num31 > 1.0) num31 = 1f; float num32 = num31 - 0.5f; float num33 = num30 * num32; if ((double) num33 > 0.0) num33 *= 2f; v1.Y *= 1f + num33; v1.X *= 1f - num33; } } float rotation = v1.ToRotation() - 1.570796f; if (!flag3) rectangle1.Height = (int) num20; Microsoft.Xna.Framework.Color color2 = Lighting.GetColor(center.ToTileCoordinates()); Main.EntitySpriteDraw(texture2D3, vector2_2 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangle1), color2, rotation, origin2, 1f, SpriteEffects.None, 0); } } Vector2 vector2_5 = proj.Size / 2f; float num34 = Math.Abs(Main.WindForVisuals); float num35 = MathHelper.Lerp(0.5f, 1f, num34); float num36 = num34; if ((double) v1.Y >= -0.0199999995529652 && (double) v1.Y < 1.0) num36 = Utils.GetLerpValue(0.2f, 0.5f, num34, true); int num37 = num3; int num38 = num2 + 1; for (int index1 = 0; index1 < num12; ++index1) { r2.X = width * (horizontalFrames - 1); List vector2List = new List(); Vector2 vector2_6 = new Vector2(num35 * (float) num10 * (float) proj.spriteDirection, (float) Math.Sin(Main.timeForVisualEffects / 300.0 * 6.28318548202515) * num36) * 2f; float num39 = (float) (num6 + num13); float y = (float) (num7 + num14); switch (index1) { case 1: vector2_6 = new Vector2(num35 * (float) num10 * (float) proj.spriteDirection, (float) (Math.Sin(Main.timeForVisualEffects / 300.0 * 6.28318548202515) * (double) num36 + 0.5)) * 2f; num39 -= 8f; y -= 8f; break; case 2: vector2_6 = new Vector2(num35 * (float) num10 * (float) proj.spriteDirection, (float) (Math.Sin(Main.timeForVisualEffects / 300.0 * 6.28318548202515) * (double) num36 + 1.0)) * 2f; num39 -= 4f; y -= 4f; break; case 3: vector2_6 = new Vector2(num35 * (float) num10 * (float) proj.spriteDirection, (float) (Math.Sin(Main.timeForVisualEffects / 300.0 * 6.28318548202515) * (double) num36 + 1.5)) * 2f; num39 -= 12f; y -= 12f; break; } Vector2 vector2_7 = proj.Center + new Vector2(((float) r1.Width * 0.5f + num39) * (float) proj.spriteDirection, y).RotatedBy((double) proj.rotation + (double) num5); vector2List.Add(vector2_7); int index2 = num37; int num40 = 1; while (index2 < num38 * num37) { if (num8 != -1 && num8 == num40) num4 = (float) num9; Vector2 oldPo = proj.oldPos[index2]; if ((double) oldPo.X == 0.0 && (double) oldPo.Y == 0.0) { vector2List.Add(vector2_7); } else { Vector2 vector2_8 = oldPo + (vector2_5 + new Vector2(((float) r1.Width * 0.5f + num39) * (float) proj.oldSpriteDirection[index2], y).RotatedBy((double) proj.oldRot[index2] + (double) num5)) + vector2_6 * (float) (num40 + 1); Vector2 vector2_9 = vector2_7 - vector2_8; float num41 = vector2_9.Length(); if ((double) num41 > (double) num4) vector2_9 *= num4 / num41; Vector2 vector2_10 = vector2_7 - vector2_9; vector2List.Add(vector2_10); vector2_7 = vector2_10; } index2 += num37; ++num40; } if (flag1) { Microsoft.Xna.Framework.Rectangle rectangle2 = texture2D3.Frame(); for (int index3 = vector2List.Count - 2; index3 >= 0; --index3) { Vector2 vector2_11 = vector2List[index3]; Vector2 v2 = vector2List[index3 + 1] - vector2_11; float num42 = v2.Length(); if ((double) num42 >= 2.0) { float rotation = v2.ToRotation() - 1.570796f; Main.EntitySpriteDraw(texture2D3, vector2_11 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangle2), alpha, rotation, origin2, new Vector2(1f, num42 / (float) rectangle2.Height), SpriteEffects.None, 0); } } } for (int index4 = vector2List.Count - 2; index4 >= 0; --index4) { Vector2 vector2_12 = vector2List[index4]; Vector2 vector2_13 = vector2List[index4 + 1]; Vector2 v3 = vector2_13 - vector2_12; double num43 = (double) v3.Length(); float rotation = v3.ToRotation() - 1.570796f + num1; Main.EntitySpriteDraw(texture2D2, vector2_13 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(r2), alpha, rotation, origin3, proj.scale, effects, 0); r2.X -= width; if (r2.X < 0) { int num44 = num11; if (flag2) --num44; r2.X = num44 * width; } } } Main.EntitySpriteDraw(texture2D1, position, new Microsoft.Xna.Framework.Rectangle?(r1), alpha, proj.rotation + num5, origin1, proj.scale, effects, 0); } public static Vector2 GetPlayerArmPosition(Projectile proj) { Player player = Main.player[proj.owner]; Vector2 vector2_1 = Main.OffsetsPlayerOnhand[player.bodyFrame.Y / 56] * 2f; if (player.direction != 1) vector2_1.X = (float) player.bodyFrame.Width - vector2_1.X; if ((double) player.gravDir != 1.0) vector2_1.Y = (float) player.bodyFrame.Height - vector2_1.Y; Vector2 vector2_2 = vector2_1 - new Vector2((float) (player.bodyFrame.Width - player.width), (float) (player.bodyFrame.Height - 42)) / 2f; return player.RotatedRelativePoint(player.MountedCenter - new Vector2(20f, 42f) / 2f + vector2_2 + Vector2.UnitY * player.gfxOffY); } private void DrawProjWithStarryTrail(Projectile proj, Microsoft.Xna.Framework.Color projectileColor, SpriteEffects dir) { Microsoft.Xna.Framework.Color color1 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) projectileColor.A - proj.alpha); Vector2 v = proj.velocity; Microsoft.Xna.Framework.Color color2 = Microsoft.Xna.Framework.Color.Blue * 0.1f; Vector2 spinningpoint = new Vector2(0.0f, -4f); float num1 = 0.0f; float num2 = Utils.GetLerpValue(3f, 5f, v.Length(), true); bool flag = true; if (proj.type == 856 || proj.type == 857) { Vector2 vector2 = proj.position - proj.oldPos[1]; float num3 = vector2.Length(); v = (double) num3 != 0.0 ? vector2 * (5f / num3) : Vector2.UnitY; Vector2 Origin = new Vector2(proj.ai[0], proj.ai[1]); Vector2 center = Main.player[proj.owner].Center; float lerpValue1 = Utils.GetLerpValue(0.0f, 120f, Origin.Distance(center), true); float from = 90f; if (proj.type == 857) { from = 60f; flag = false; } float lerpValue2 = Utils.GetLerpValue(from, from * 0.8333333f, proj.localAI[0], true); float lerpValue3 = Utils.GetLerpValue(0.0f, 120f, proj.Center.Distance(center), true); float num4 = lerpValue1 * lerpValue3; float num5 = lerpValue2 * Utils.GetLerpValue(0.0f, 15f, proj.localAI[0], true); color2 = Microsoft.Xna.Framework.Color.HotPink * 0.15f * (num5 * num4); if (proj.type == 857) color2 = proj.GetFirstFractalColor() * 0.15f * (num5 * num4); spinningpoint = new Vector2(0.0f, -2f); num1 = ((float) (-0.300000011920929 * (1.0 - (double) (Utils.GetLerpValue(from, from * 0.6666667f, proj.localAI[0], true) * Utils.GetLerpValue(0.0f, 20f, proj.localAI[0], true)))) + -1f * Utils.GetLerpValue(15f, 0.0f, proj.localAI[0], true)) * num4; num2 = num5 * num4; } Vector2 vector2_1 = proj.Center + v; Texture2D texture2D1 = TextureAssets.Projectile[proj.type].Value; Vector2 vector2_2 = new Microsoft.Xna.Framework.Rectangle(0, 0, texture2D1.Width, texture2D1.Height).Size() / 2f; Texture2D texture2D2 = TextureAssets.Extra[91].Value; Microsoft.Xna.Framework.Rectangle rectangle = texture2D2.Frame(); Vector2 origin1 = new Vector2((float) rectangle.Width / 2f, 10f); Microsoft.Xna.Framework.Color color3 = Microsoft.Xna.Framework.Color.Cyan * 0.5f * num2; Vector2 vector2_3 = new Vector2(0.0f, proj.gfxOffY); float num6 = (float) Main.timeForVisualEffects / 60f; Vector2 vector2_4 = vector2_1 + v * 0.5f; Microsoft.Xna.Framework.Color color4 = Microsoft.Xna.Framework.Color.White * 0.5f * num2; color4.A = (byte) 0; Microsoft.Xna.Framework.Color color5 = color2 * num2; color5.A = (byte) 0; Microsoft.Xna.Framework.Color color6 = color2 * num2; color6.A = (byte) 0; Microsoft.Xna.Framework.Color color7 = color2 * num2; color7.A = (byte) 0; float rotation1 = v.ToRotation(); Main.EntitySpriteDraw(texture2D2, vector2_4 - Main.screenPosition + vector2_3 + spinningpoint.RotatedBy(6.28318548202515 * (double) num6), new Microsoft.Xna.Framework.Rectangle?(rectangle), color5, rotation1 + 1.570796f, origin1, 1.5f + num1, SpriteEffects.None, 0); Main.EntitySpriteDraw(texture2D2, vector2_4 - Main.screenPosition + vector2_3 + spinningpoint.RotatedBy(6.28318548202515 * (double) num6 + 2.09439516067505), new Microsoft.Xna.Framework.Rectangle?(rectangle), color6, rotation1 + 1.570796f, origin1, 1.1f + num1, SpriteEffects.None, 0); Main.EntitySpriteDraw(texture2D2, vector2_4 - Main.screenPosition + vector2_3 + spinningpoint.RotatedBy(6.28318548202515 * (double) num6 + 4.1887903213501), new Microsoft.Xna.Framework.Rectangle?(rectangle), color7, rotation1 + 1.570796f, origin1, 1.3f + num1, SpriteEffects.None, 0); Vector2 vector2_5 = vector2_1 - v * 0.5f; for (float num7 = 0.0f; (double) num7 < 1.0; num7 += 0.5f) { float num8 = (float) (((double) num6 % 0.5 / 0.5 + (double) num7) % 1.0); float num9 = num8 * 2f; if ((double) num9 > 1.0) num9 = 2f - num9; Main.EntitySpriteDraw(texture2D2, vector2_5 - Main.screenPosition + vector2_3, new Microsoft.Xna.Framework.Rectangle?(rectangle), color4 * num9, rotation1 + 1.570796f, origin1, (float) (0.300000011920929 + (double) num8 * 0.5), SpriteEffects.None, 0); } if (!flag) return; float rotation2 = proj.rotation + proj.localAI[1]; double num10 = Main.timeForVisualEffects / 240.0; double timeWrappedHourly = (double) Main.GlobalTimeWrappedHourly; float num11 = Main.GlobalTimeWrappedHourly % 5f / 2.5f; if ((double) num11 >= 1.0) num11 = 2f - num11; float num12 = (float) ((double) num11 * 0.5 + 0.5); Vector2 position = proj.Center - Main.screenPosition; Main.instance.LoadItem(75); Texture2D texture2D3 = TextureAssets.Item[75].Value; Microsoft.Xna.Framework.Rectangle r = texture2D3.Frame(verticalFrames: 8); Vector2 origin2 = r.Size() / 2f; Main.EntitySpriteDraw(texture2D3, position, new Microsoft.Xna.Framework.Rectangle?(r), color1, rotation2, origin2, proj.scale, SpriteEffects.None, 0); } private static int TryInteractingWithVoidLens(Projectile proj) { if (Main.gamePaused || Main.gameMenu) return 0; bool flag1 = !Main.SmartCursorEnabled && !PlayerInput.UsingGamepad; Player localPlayer = Main.LocalPlayer; Microsoft.Xna.Framework.Point tileCoordinates = proj.Center.ToTileCoordinates(); Vector2 center = localPlayer.Center; if (!localPlayer.IsProjectileInteractibleAndInInteractionRange(proj, ref center)) return 0; Matrix matrix1 = Matrix.Invert(Main.GameViewMatrix.ZoomMatrix); Vector2 position = Main.ReverseGravitySupport(Main.MouseScreen); Vector2.Transform(Main.screenPosition, matrix1); Matrix matrix2 = matrix1; Vector2 v = Vector2.Transform(position, matrix2) + Main.screenPosition; bool flag2 = proj.Hitbox.Contains(v.ToPoint()); if (((flag2 ? 1 : (Main.SmartInteractProj == proj.whoAmI ? 1 : 0)) & (!localPlayer.lastMouseInterface ? 1 : 0)) == 0) return !flag1 ? 1 : 0; Main.HasInteractibleObjectThatIsNotATile = true; if (flag2) { localPlayer.noThrow = 2; localPlayer.cursorItemIconEnabled = true; localPlayer.cursorItemIconID = 4131; } if (PlayerInput.UsingGamepad) localPlayer.GamepadEnableGrappleCooldown(); if (Main.mouseRight && Main.mouseRightRelease && Player.BlockInteractionWithProjectiles == 0) { Main.mouseRightRelease = false; localPlayer.tileInteractAttempted = true; localPlayer.tileInteractionHappened = true; localPlayer.releaseUseTile = false; if (localPlayer.chest == -5) { localPlayer.chest = -1; SoundEngine.PlaySound(SoundID.Item130); Recipe.FindRecipes(); } else { localPlayer.chest = -5; for (int index = 0; index < 40; ++index) ItemSlot.SetGlow(index, -1f, true); localPlayer.voidLensChest = proj.whoAmI; localPlayer.chestX = tileCoordinates.X; localPlayer.chestY = tileCoordinates.Y; localPlayer.SetTalkNPC(-1); Main.SetNPCShopIndex(0); Main.playerInventory = true; SoundEngine.PlaySound(SoundID.Item130); Recipe.FindRecipes(); } } return !Main.SmartCursorEnabled && !PlayerInput.UsingGamepad || flag1 ? 0 : 2; } private static int TryInteractingWithMoneyTrough(Projectile proj) { if (Main.gamePaused || Main.gameMenu) return 0; bool flag1 = !Main.SmartCursorEnabled && !PlayerInput.UsingGamepad; Player localPlayer = Main.LocalPlayer; Microsoft.Xna.Framework.Point tileCoordinates = proj.Center.ToTileCoordinates(); Vector2 center = localPlayer.Center; if (!localPlayer.IsProjectileInteractibleAndInInteractionRange(proj, ref center)) return 0; Matrix matrix1 = Matrix.Invert(Main.GameViewMatrix.ZoomMatrix); Vector2 position = Main.ReverseGravitySupport(Main.MouseScreen); Vector2.Transform(Main.screenPosition, matrix1); Matrix matrix2 = matrix1; Vector2 v = Vector2.Transform(position, matrix2) + Main.screenPosition; bool flag2 = proj.Hitbox.Contains(v.ToPoint()); if (((flag2 ? 1 : (Main.SmartInteractProj == proj.whoAmI ? 1 : 0)) & (!localPlayer.lastMouseInterface ? 1 : 0)) == 0) return !flag1 ? 1 : 0; Main.HasInteractibleObjectThatIsNotATile = true; if (flag2) { localPlayer.noThrow = 2; localPlayer.cursorItemIconEnabled = true; localPlayer.cursorItemIconID = 3213; } if (PlayerInput.UsingGamepad) localPlayer.GamepadEnableGrappleCooldown(); if (Main.mouseRight && Main.mouseRightRelease && Player.BlockInteractionWithProjectiles == 0) { Main.mouseRightRelease = false; localPlayer.tileInteractAttempted = true; localPlayer.tileInteractionHappened = true; localPlayer.releaseUseTile = false; if (localPlayer.chest == -2) { localPlayer.chest = -1; SoundEngine.PlaySound(SoundID.Item59); Recipe.FindRecipes(); } else { localPlayer.chest = -2; for (int index = 0; index < 40; ++index) ItemSlot.SetGlow(index, -1f, true); localPlayer.flyingPigChest = proj.whoAmI; localPlayer.chestX = tileCoordinates.X; localPlayer.chestY = tileCoordinates.Y; localPlayer.SetTalkNPC(-1); Main.SetNPCShopIndex(0); Main.playerInventory = true; SoundEngine.PlaySound(SoundID.Item59); Recipe.FindRecipes(); } } return !Main.SmartCursorEnabled && !PlayerInput.UsingGamepad || flag1 ? 0 : 2; } public static void PrintTimedMessage(string message, params object[] arguments) => Console.WriteLine(string.Format("{0} {1}", (object) (int) Main.time, (object) string.Format(message, arguments))); private static void TryInteractingWithMoneyTrough2(Projectile proj) { if (Main.gamePaused && !Main.gameMenu) return; Vector2 vector2 = proj.position - Main.screenPosition; if ((double) Main.mouseX <= (double) vector2.X || (double) Main.mouseX >= (double) vector2.X + (double) proj.width || (double) Main.mouseY <= (double) vector2.Y || (double) Main.mouseY >= (double) vector2.Y + (double) proj.height) return; int num1 = (int) ((double) Main.player[Main.myPlayer].Center.X / 16.0); int num2 = (int) ((double) Main.player[Main.myPlayer].Center.Y / 16.0); int num3 = (int) proj.Center.X / 16; int num4 = (int) proj.Center.Y / 16; int lastTileRangeX = Main.player[Main.myPlayer].lastTileRangeX; int lastTileRangeY = Main.player[Main.myPlayer].lastTileRangeY; if (num1 < num3 - lastTileRangeX || num1 > num3 + lastTileRangeX + 1 || num2 < num4 - lastTileRangeY || num2 > num4 + lastTileRangeY + 1) return; Player localPlayer = Main.LocalPlayer; Main.player[Main.myPlayer].noThrow = 2; Main.player[Main.myPlayer].cursorItemIconEnabled = true; Main.player[Main.myPlayer].cursorItemIconID = 3213; if (PlayerInput.UsingGamepad) Main.player[Main.myPlayer].GamepadEnableGrappleCooldown(); if (!Main.mouseRight || !Main.mouseRightRelease || Player.BlockInteractionWithProjectiles != 0) return; Main.mouseRightRelease = false; localPlayer.tileInteractAttempted = true; localPlayer.tileInteractionHappened = true; localPlayer.releaseUseTile = false; if (Main.player[Main.myPlayer].chest == -2) { SoundEngine.PlaySound(SoundID.Item59); Main.player[Main.myPlayer].chest = -1; Recipe.FindRecipes(); } else { Main.player[Main.myPlayer].flyingPigChest = proj.whoAmI; Main.player[Main.myPlayer].chest = -2; Main.player[Main.myPlayer].chestX = (int) ((double) proj.Center.X / 16.0); Main.player[Main.myPlayer].chestY = (int) ((double) proj.Center.Y / 16.0); Main.player[Main.myPlayer].SetTalkNPC(-1); Main.SetNPCShopIndex(0); Main.playerInventory = true; SoundEngine.PlaySound(SoundID.Item59); Recipe.FindRecipes(); } } public void PrepareDrawnEntityDrawing(Entity entity, int intendedShader) { Main.CurrentDrawnEntity = entity; if (intendedShader != 0) { if (Main.CurrentDrawnEntityShader == 0 || Main.CurrentDrawnEntityShader == -1) { Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, (Effect) null, Main.Transform); } } else if (Main.CurrentDrawnEntityShader != 0 && Main.CurrentDrawnEntityShader != -1) { Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, (Effect) null, Main.Transform); } Main.CurrentDrawnEntityShader = intendedShader; } 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, int worthless) { Main.EntitySpriteDraw(texture, position, sourceRectangle, color, rotation, origin, new Vector2(scale), effects, worthless); } 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, int worthless) { if (Main.CurrentDrawnEntityShader > 0) { DrawData drawData = new DrawData(texture, position, sourceRectangle, color, rotation, origin, scale, effects, worthless); GameShaders.Armor.Apply(Main.CurrentDrawnEntityShader, Main.CurrentDrawnEntity, new DrawData?(drawData)); drawData.Draw(Main.spriteBatch); } else Main.spriteBatch.Draw(texture, position, sourceRectangle, color, rotation, origin, scale, effects, (float) worthless); } public static void EntitySpriteDraw(DrawData data) { if (Main.CurrentDrawnEntityShader > 0) { GameShaders.Armor.Apply(Main.CurrentDrawnEntityShader, Main.CurrentDrawnEntity, new DrawData?(data)); data.Draw(Main.spriteBatch); } else data.Draw(Main.spriteBatch); } public static Microsoft.Xna.Framework.Color buffColor( Microsoft.Xna.Framework.Color newColor, float R, float G, float B, float A) { newColor.R = (byte) ((double) newColor.R * (double) R); newColor.G = (byte) ((double) newColor.G * (double) G); newColor.B = (byte) ((double) newColor.B * (double) B); newColor.A = (byte) ((double) newColor.A * (double) A); return newColor; } protected void CacheNPCDraws() { this.DrawCacheNPCsMoonMoon.Clear(); this.DrawCacheNPCsOverPlayers.Clear(); this.DrawCacheNPCProjectiles.Clear(); this.DrawCacheNPCsBehindNonSolidTiles.Clear(); for (int index1 = 0; index1 < 200; ++index1) { if (Main.npc[index1].active) { if (Main.npc[index1].type == 398 && (double) Main.npc[index1].ai[0] >= 0.0) { int num1 = index1; int num2 = -1; int num3 = -1; int num4 = -1; for (int index2 = 0; index2 < 200; ++index2) { if (Main.npc[index2].active && (double) Main.npc[index2].ai[3] == (double) num1) { if (num2 == -1 && Main.npc[index2].type == 397 && (double) Main.npc[index2].ai[2] == 0.0) num2 = index2; if (num3 == -1 && Main.npc[index2].type == 397 && (double) Main.npc[index2].ai[2] == 1.0) num3 = index2; if (num4 == -1 && Main.npc[index2].type == 396) num4 = index2; if (num2 != -1 && num3 != -1 && num4 != -1) break; } } if (num2 != -1 && num3 != -1 && num4 != -1) { this.DrawCacheNPCsMoonMoon.Add(num1); if (num2 != -1) this.DrawCacheNPCsMoonMoon.Add(num2); if (num3 != -1) this.DrawCacheNPCsMoonMoon.Add(num3); if (num4 != -1) this.DrawCacheNPCsMoonMoon.Add(num4); } } else if (Main.npc[index1].type == 421 && (double) Main.npc[index1].ai[0] == 5.0) this.DrawCacheNPCsOverPlayers.Add(index1); else if (Main.npc[index1].type == 516 || Main.npc[index1].type == 519) this.DrawCacheNPCProjectiles.Add(index1); else if (Main.npc[index1].type == 548) this.DrawCacheNPCsBehindNonSolidTiles.Add(index1); } } } protected void CacheProjDraws() { this.DrawCacheProjsBehindNPCsAndTiles.Clear(); this.DrawCacheProjsBehindNPCs.Clear(); this.DrawCacheProjsBehindProjectiles.Clear(); this.DrawCacheProjsOverWiresUI.Clear(); this.DrawCacheProjsOverPlayers.Clear(); this.DrawCacheFirstFractals.Clear(); for (int index1 = 0; index1 < 1000; ++index1) { if (Main.projectile[index1].active) { if (Main.projectile[index1].type == 857) this.DrawCacheFirstFractals.Add(index1); if (Main.projectile[index1].type == 578 || Main.projectile[index1].type == 579 || Main.projectile[index1].type == 641 || Main.projectile[index1].type == 617 || Main.projectile[index1].type == 813) this.DrawCacheProjsBehindNPCsAndTiles.Add(index1); if (Main.projectile[index1].type == 625 || Main.projectile[index1].type == 626 || Main.projectile[index1].type == 627 || Main.projectile[index1].type == 628 || Main.projectile[index1].type == 525 || Main.projectile[index1].type == 734 || Main.projectile[index1].type == 946 || Main.projectile[index1].type == 908 && (double) Main.projectile[index1].localAI[0] <= 0.0) this.DrawCacheProjsBehindProjectiles.Add(index1); if (Main.projectile[index1].type == 759 || Main.projectile[index1].type == 908 && (double) Main.projectile[index1].localAI[0] > 0.0) this.DrawCacheProjsOverPlayers.Add(index1); if (Main.projectile[index1].type == 651) this.DrawCacheProjsOverWiresUI.Add(index1); if (Main.projectile[index1].type == 673 || Main.projectile[index1].type == 674 || Main.projectile[index1].type == 691 || Main.projectile[index1].type == 692 || Main.projectile[index1].type == 693 || Main.projectile[index1].type == 923) this.DrawCacheProjsBehindNPCs.Add(index1); if (Main.projectile[index1].type == 636 || Main.projectile[index1].type == 598) { bool flag = true; if ((double) Main.projectile[index1].ai[0] == 1.0) { int index2 = (int) Main.projectile[index1].ai[1]; if (index2 >= 0 && index2 < 200 && Main.npc[index2].active && Main.npc[index2].type != 492) { if (Main.npc[index2].behindTiles) this.DrawCacheProjsBehindNPCsAndTiles.Add(index1); else this.DrawCacheProjsBehindNPCs.Add(index1); flag = false; } } if (flag) this.DrawCacheProjsBehindProjectiles.Add(index1); } } } } protected void DrawCachedNPCs(List npcCache, bool behindTiles) { for (int index = 0; index < npcCache.Count; ++index) { try { this.DrawNPC(npcCache[index], behindTiles); } catch { Main.npc[npcCache[index]].active = false; } } } protected void DrawCachedProjs(List projCache, bool startSpriteBatch = true) { if (startSpriteBatch) Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, (Effect) null, Main.Transform); for (int index = 0; index < projCache.Count; ++index) { try { this.DrawProj(projCache[index]); } catch (Exception ex) { TimeLogger.DrawException(ex); Main.projectile[projCache[index]].active = false; } } if (!startSpriteBatch) return; Main.spriteBatch.End(); } protected void DrawSuperSpecialProjectiles(List projCache, bool startSpriteBatch = true) { if (startSpriteBatch) Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, (Effect) null, Main.Transform); for (int index1 = 0; index1 < projCache.Count; ++index1) { try { int index2 = projCache[index1]; Projectile projectile = Main.projectile[index2]; int owner = projectile.owner; Player other = Main.player[owner]; if (Main.playerVisualClone[owner] == null) Main.playerVisualClone[owner] = new Player(); Player drawPlayer = Main.playerVisualClone[owner]; drawPlayer.CopyVisuals(other); drawPlayer.isFirstFractalAfterImage = true; drawPlayer.firstFractalAfterImageOpacity = projectile.Opacity * 1f; drawPlayer.ResetEffects(); drawPlayer.ResetVisibleAccessories(); drawPlayer.UpdateDyes(); drawPlayer.DisplayDollUpdate(); drawPlayer.UpdateSocialShadow(); drawPlayer.itemAnimationMax = 60; drawPlayer.itemAnimation = (int) projectile.localAI[0]; drawPlayer.itemRotation = projectile.velocity.ToRotation(); drawPlayer.heldProj = index2; drawPlayer.Center = projectile.Center - projectile.velocity.SafeNormalize(Vector2.Zero) * 42f; drawPlayer.direction = (double) projectile.velocity.X > 0.0 ? 1 : -1; drawPlayer.itemRotation = (float) Math.Atan2((double) projectile.velocity.Y * (double) drawPlayer.direction, (double) projectile.velocity.X * (double) drawPlayer.direction); drawPlayer.velocity.Y = 0.01f; drawPlayer.wingFrame = 2; drawPlayer.PlayerFrame(); drawPlayer.socialIgnoreLight = true; Main.PlayerRenderer.DrawPlayer(Main.Camera, drawPlayer, drawPlayer.position, 0.0f, drawPlayer.fullRotationOrigin); } catch (Exception ex) { TimeLogger.DrawException(ex); Main.projectile[projCache[index1]].active = false; } } if (!startSpriteBatch) return; Main.spriteBatch.End(); } protected void SortDrawCacheWorms() { this.SortBabyBirdProjectiles(this.DrawCacheProjsOverPlayers); this.SortStardustDragonProjectiles(this.DrawCacheProjsBehindProjectiles); } private void SortBabyBirdProjectiles(List list) { List intList = new List(); for (int index1 = list.Count - 1; index1 >= 0; --index1) { int index2 = list[index1]; if (Main.projectile[index2].type == 759) { intList.Add(index2); list.RemoveAt(index1); Projectile projectile = Main.projectile[index2]; Player master = Main.player[projectile.owner]; int stackedIndex = (int) projectile.localAI[0]; if (projectile.frame == Main.projFrames[projectile.type] - 1) { projectile.Center = Projectile.AI_158_GetHomeLocation(master, stackedIndex); projectile.velocity = Vector2.Zero; } } } list.AddRange((IEnumerable) intList); intList.Clear(); } private void SortStardustDragonProjectiles(List list) { List> intListList = new List>(); for (int index1 = 0; index1 < list.Count; ++index1) { int index2 = list[index1]; if (Main.projectile[index2].type == 628) { list.Remove(index2); List intList1 = new List(); intList1.Insert(0, index2); for (int byUuid = Projectile.GetByUUID(Main.projectile[index2].owner, Main.projectile[index2].ai[0]); byUuid >= 0 && !intList1.Contains(byUuid) && Main.projectile[byUuid].active && Main.projectile[byUuid].type >= 625 && Main.projectile[byUuid].type <= 627; byUuid = Projectile.GetByUUID(Main.projectile[byUuid].owner, Main.projectile[byUuid].ai[0])) { intList1.Add(byUuid); list.Remove(byUuid); } List intList2 = new List(); for (int index3 = intList1.Count - 2; index3 >= 0; --index3) intList2.Add(intList1[index3]); intList2.Add(intList1[intList1.Count - 1]); intListList.Add(intList2); index1 = -1; } } List intList = new List((IEnumerable) list); intListList.Add(intList); list.Clear(); for (int index4 = 0; index4 < intListList.Count; ++index4) { for (int index5 = 0; index5 < intListList[index4].Count; ++index5) list.Add(intListList[index4][index5]); } for (int index = 0; index < list.Count; ++index) { Projectile projectile1 = Main.projectile[list[index]]; int byUuid = Projectile.GetByUUID(projectile1.owner, projectile1.ai[0]); if (projectile1.type >= 626 && projectile1.type <= 628 && byUuid >= 0 && ProjectileID.Sets.StardustDragon[Main.projectile[byUuid].type]) { Vector2 vector2 = Main.projectile[byUuid].Center - projectile1.Center; if (vector2 != Vector2.Zero) { float num = Main.projectile[byUuid].scale * 16f - vector2.Length(); if ((double) num != 0.0) { Projectile projectile2 = projectile1; projectile2.Center = projectile2.Center + Vector2.Normalize(vector2) * -num; } } } } } protected void DrawWoF() { if ((Main.wofNPCIndex < 0 || !Main.npc[Main.wofNPCIndex].active ? 0 : (Main.npc[Main.wofNPCIndex].life > 0 ? 1 : 0)) == 0) return; for (int i = 0; i < (int) byte.MaxValue; ++i) { if (Main.player[i].active && Main.player[i].tongued && !Main.player[i].dead) Main.DrawWOFTongueToPlayer(i); } for (int i = 0; i < 200; ++i) { if (Main.npc[i].active && Main.npc[i].aiStyle == 29) Main.DrawWOFRopeToTheHungry(i); } Main.DrawWOFBody(); } private static void DrawWOFBody() { int num1 = TextureAssets.Wof.Height() / 3; float wofDrawAreaTop = (float) Main.wofDrawAreaTop; float wofDrawAreaBottom = (float) Main.wofDrawAreaBottom; float num2 = Main.screenPosition.Y + (float) Main.screenHeight; float num3 = (float) ((int) (((double) wofDrawAreaTop - (double) Main.screenPosition.Y) / (double) num1) + 1); if ((double) num3 > 12.0) return; float num4 = num3 * (float) num1; if ((double) num4 > 0.0) wofDrawAreaTop -= num4; float x1 = Main.npc[Main.wofNPCIndex].position.X; if (Main.npc[Main.wofNPCIndex].direction > 0) x1 -= 80f; SpriteEffects effects = SpriteEffects.None; if (Main.npc[Main.wofNPCIndex].spriteDirection == 1) effects = SpriteEffects.FlipHorizontally; int num5 = Main.wofDrawFrameIndex / 6 * num1; if (!Main.gamePaused && ++Main.wofDrawFrameIndex >= 18) Main.wofDrawFrameIndex = 0; float num6 = num2 - wofDrawAreaTop; for (int index1 = (int) wofDrawAreaTop; (double) index1 < (double) num2; index1 += num1) { float num7 = num2 - (float) index1; if ((double) num7 > (double) num1) num7 = (float) num1; for (int index2 = 0; (double) index2 < (double) num7; index2 += 16) { int x2 = (int) ((double) x1 + (double) (TextureAssets.Wof.Width() / 2)) / 16; int y = (index1 + index2) / 16; Main.spriteBatch.Draw(TextureAssets.Wof.Value, new Vector2(x1 - Main.screenPosition.X, (float) (index1 + index2) - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, num5 + index2, TextureAssets.Wof.Width(), 16)), Lighting.GetColor(x2, y), 0.0f, new Vector2(), 1f, effects, 0.0f); } } } private static void DrawWOFRopeToTheHungry(int i) { float num1 = Main.npc[Main.wofNPCIndex].position.X + (float) (Main.npc[Main.wofNPCIndex].width / 2); float y = Main.npc[Main.wofNPCIndex].position.Y; float num2 = (float) (Main.wofDrawAreaBottom - Main.wofDrawAreaTop); bool flag1 = false; if (Main.npc[i].frameCounter > 7.0) flag1 = true; float num3 = (float) Main.wofDrawAreaTop + num2 * Main.npc[i].ai[0]; Vector2 vector2 = new Vector2(Main.npc[i].position.X + (float) (Main.npc[i].width / 2), Main.npc[i].position.Y + (float) (Main.npc[i].height / 2)); float num4 = num1 - vector2.X; float num5 = num3 - vector2.Y; float rotation = (float) Math.Atan2((double) num5, (double) num4) - 1.57f; bool flag2 = true; while (flag2) { SpriteEffects effects = SpriteEffects.None; if (flag1) { effects = SpriteEffects.FlipHorizontally; flag1 = false; } else flag1 = true; int height = 28; float num6 = (float) Math.Sqrt((double) num4 * (double) num4 + (double) num5 * (double) num5); if ((double) num6 < 40.0) { height = (int) num6 - 40 + 28; flag2 = false; } float num7 = 28f / num6; float num8 = num4 * num7; float num9 = num5 * num7; vector2.X += num8; vector2.Y += num9; num4 = num1 - vector2.X; num5 = num3 - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.spriteBatch.Draw(TextureAssets.Chain12.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(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), 1f, effects, 0.0f); } } private static void DrawWOFTongueToPlayer(int i) { float num1 = Main.npc[Main.wofNPCIndex].position.X + (float) (Main.npc[Main.wofNPCIndex].width / 2); float num2 = Main.npc[Main.wofNPCIndex].position.Y + (float) (Main.npc[Main.wofNPCIndex].height / 2); Vector2 vector2 = new Vector2(Main.player[i].position.X + (float) Main.player[i].width * 0.5f, Main.player[i].position.Y + (float) Main.player[i].height * 0.5f); float num3 = num1 - vector2.X; float num4 = num2 - vector2.Y; float rotation = (float) Math.Atan2((double) num4, (double) num3) - 1.57f; bool flag = true; while (flag) { float num5 = (float) Math.Sqrt((double) num3 * (double) num3 + (double) num4 * (double) num4); if ((double) num5 < 40.0) { flag = false; } else { float num6 = (float) TextureAssets.Chain12.Height() / num5; float num7 = num3 * num6; float num8 = num4 * num6; vector2.X += num7; vector2.Y += num8; num3 = num1 - vector2.X; num4 = num2 - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.spriteBatch.Draw(TextureAssets.Chain12.Value, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(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, 0.0f); } } } public static Microsoft.Xna.Framework.Color quickAlpha(Microsoft.Xna.Framework.Color oldColor, float Alpha) { Microsoft.Xna.Framework.Color color = oldColor; color.R = (byte) ((double) color.R * (double) Alpha); color.G = (byte) ((double) color.G * (double) Alpha); color.B = (byte) ((double) color.B * (double) Alpha); color.A = (byte) ((double) color.A * (double) Alpha); return color; } private void DrawItem_GetBasics( Item item, int slot, out Texture2D texture, out Microsoft.Xna.Framework.Rectangle frame) { this.LoadItem(item.type); if (ItemID.Sets.AnimatesAsSoul[item.type] || ItemID.Sets.NebulaPickup[item.type]) { this.DrawItem_AnimateSlot(slot, Main.itemAnimations[item.type].TicksPerFrame, Main.itemAnimations[item.type].FrameCount); texture = TextureAssets.Item[item.type].Value; } else if (ItemID.Sets.IsFood[item.type]) { texture = TextureAssets.Item[item.type].Value; } else { switch (item.type) { case 71: case 72: case 73: case 74: int index = item.type - 71; texture = TextureAssets.Coin[index].Value; this.DrawItem_AnimateSlot(slot, 6, 8); frame = Main._coinOnWorldAnimation.GetFrame(texture, Main.itemFrameCounter[slot]); return; case 75: texture = TextureAssets.Item[item.type].Value; this.DrawItem_AnimateSlot(slot, Main.itemAnimations[item.type].TicksPerFrame, Main.itemAnimations[item.type].FrameCount * 2 - 1); break; case 3858: texture = TextureAssets.Item[item.type].Value; this.DrawItem_AnimateSlot(slot, 5, 3); break; default: texture = TextureAssets.Item[item.type].Value; break; } } if (Main.itemAnimations[item.type] != null) frame = Main.itemAnimations[item.type].GetFrame(texture, Main.itemFrameCounter[slot]); else frame = texture.Frame(); } private void DrawItem_AnimateSlot( int slot, int gameFramesPerSpriteFrame, int spriteFramesAmount) { if (++Main.itemFrameCounter[slot] < gameFramesPerSpriteFrame * spriteFramesAmount) return; Main.itemFrameCounter[slot] = 0; } protected void DrawItem(Item item, int whoami) { if (!item.active || item.IsAir) return; Main.instance.LoadItem(item.type); Texture2D texture; Microsoft.Xna.Framework.Rectangle frame; this.DrawItem_GetBasics(item, whoami, out texture, out frame); Vector2 origin = frame.Size() / 2f; Vector2 vector2 = new Vector2((float) (item.width / 2) - origin.X, (float) (item.height - frame.Height)); Vector2 position = item.position - Main.screenPosition + origin + vector2; float rotation = item.velocity.X * 0.2f; float scale = 1f; Microsoft.Xna.Framework.Color color = Lighting.GetColor(item.Center.ToTileCoordinates()); Microsoft.Xna.Framework.Color currentColor = item.GetAlpha(color); ItemSlot.GetItemLight(ref currentColor, ref scale, item); int index1 = (int) item.glowMask; if (!Main.gamePaused && this.IsActive && (item.type >= 71 && item.type <= 74 || item.type == 58 || item.type == 109) && color.R > (byte) 60 && (double) Main.rand.Next(500) - ((double) Math.Abs(item.velocity.X) + (double) Math.Abs(item.velocity.Y)) * 10.0 < (double) ((int) color.R / 50)) { int index2 = Dust.NewDust(item.position, item.width, item.height, 43, Alpha: 254, newColor: Microsoft.Xna.Framework.Color.White, Scale: 0.5f); Main.dust[index2].velocity *= 0.0f; } if (item.type >= 3318 && item.type <= 3332 || item.type == 3860 || item.type == 3862 || item.type == 3861 || item.type == 4782 || item.type == 4957) { float num1 = (float) ((double) item.timeSinceItemSpawned / 240.0 + (double) Main.GlobalTimeWrappedHourly * 0.0399999991059303); float num2 = Main.GlobalTimeWrappedHourly % 4f / 2f; if ((double) num2 >= 1.0) num2 = 2f - num2; float num3 = (float) ((double) num2 * 0.5 + 0.5); for (float num4 = 0.0f; (double) num4 < 1.0; num4 += 0.25f) Main.spriteBatch.Draw(texture, position + new Vector2(0.0f, 8f).RotatedBy(((double) num4 + (double) num1) * 6.28318548202515) * num3, new Microsoft.Xna.Framework.Rectangle?(frame), new Microsoft.Xna.Framework.Color(90, 70, (int) byte.MaxValue, 50), rotation, origin, scale, SpriteEffects.None, 0.0f); for (float num5 = 0.0f; (double) num5 < 1.0; num5 += 0.34f) Main.spriteBatch.Draw(texture, position + new Vector2(0.0f, 4f).RotatedBy(((double) num5 + (double) num1) * 6.28318548202515) * num3, new Microsoft.Xna.Framework.Rectangle?(frame), new Microsoft.Xna.Framework.Color(140, 120, (int) byte.MaxValue, 77), rotation, origin, scale, SpriteEffects.None, 0.0f); } else if (item.type == 75) { float num6 = (float) ((double) item.timeSinceItemSpawned / 240.0 + (double) Main.GlobalTimeWrappedHourly * 0.0399999991059303); float num7 = Main.GlobalTimeWrappedHourly % 5f / 2.5f; if ((double) num7 >= 1.0) num7 = 2f - num7; float num8 = (float) ((double) num7 * 0.5 + 0.5); for (float num9 = 0.0f; (double) num9 < 1.0; num9 += 0.25f) Main.spriteBatch.Draw(TextureAssets.Item[item.type].Value, position + new Vector2(0.0f, 8f).RotatedBy(((double) num9 + (double) num6) * 6.28318548202515) * num8, new Microsoft.Xna.Framework.Rectangle?(frame), new Microsoft.Xna.Framework.Color(50, 50, (int) byte.MaxValue, 50), rotation, origin, scale, SpriteEffects.None, 0.0f); for (float num10 = 0.0f; (double) num10 < 1.0; num10 += 0.34f) Main.spriteBatch.Draw(TextureAssets.Item[item.type].Value, position + new Vector2(0.0f, 4f).RotatedBy(((double) num10 + (double) num6) * 6.28318548202515) * num8, new Microsoft.Xna.Framework.Rectangle?(frame), new Microsoft.Xna.Framework.Color(120, 120, (int) byte.MaxValue, (int) sbyte.MaxValue), rotation, origin, scale, SpriteEffects.None, 0.0f); } else if (item.type == 4143) { float num11 = (float) ((double) item.timeSinceItemSpawned / 240.0 + (double) Main.GlobalTimeWrappedHourly * 0.0399999991059303); float num12 = Main.GlobalTimeWrappedHourly % 5f / 2.5f; if ((double) num12 >= 1.0) num12 = 2f - num12; float num13 = (float) ((double) num12 * 0.5 + 0.5); for (float num14 = 0.0f; (double) num14 < 1.0; num14 += 0.34f) Main.spriteBatch.Draw(TextureAssets.Item[item.type].Value, position + new Vector2(0.0f, 8f).RotatedBy(((double) num14 + (double) num11) * 6.28318548202515) * num13, new Microsoft.Xna.Framework.Rectangle?(frame), new Microsoft.Xna.Framework.Color(30, 30, 155, 60), rotation, origin, scale, SpriteEffects.None, 0.0f); for (float num15 = 0.0f; (double) num15 < 1.0; num15 += 0.34f) Main.spriteBatch.Draw(TextureAssets.Item[item.type].Value, position + new Vector2(0.0f, 4f).RotatedBy(((double) num15 + (double) num11) * 6.28318548202515) * num13, new Microsoft.Xna.Framework.Rectangle?(frame), new Microsoft.Xna.Framework.Color(60, 60, (int) sbyte.MaxValue, 57), rotation, origin, scale, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(texture, position, new Microsoft.Xna.Framework.Rectangle?(frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 128), rotation, origin, scale, SpriteEffects.None, 0.0f); } if (item.type >= 1522 && item.type <= 1527 || item.type == 3643) { currentColor = new Microsoft.Xna.Framework.Color(250, 250, 250, (int) Main.mouseTextColor / 2); scale = (float) ((double) Main.mouseTextColor / 1000.0 + 0.800000011920929); } if (item.type == 3779) index1 = -1; Main.spriteBatch.Draw(texture, position, new Microsoft.Xna.Framework.Rectangle?(frame), currentColor, rotation, origin, scale, SpriteEffects.None, 0.0f); if (item.color != Microsoft.Xna.Framework.Color.Transparent) Main.spriteBatch.Draw(texture, position, new Microsoft.Xna.Framework.Rectangle?(frame), item.GetColor(color), rotation, origin, scale, SpriteEffects.None, 0.0f); if (index1 != -1) Main.spriteBatch.Draw(TextureAssets.GlowMask[index1].Value, position, new Microsoft.Xna.Framework.Rectangle?(frame), new Microsoft.Xna.Framework.Color(250, 250, 250, item.alpha), rotation, origin, scale, SpriteEffects.None, 0.0f); if (ItemID.Sets.TrapSigned[item.type]) Main.spriteBatch.Draw(TextureAssets.Wire.Value, position + frame.Size().RotatedBy((double) rotation) * 0.45f * item.scale, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(4, 58, 8, 8)), currentColor, 0.0f, new Vector2(4f), 1f, SpriteEffects.None, 0.0f); if (item.type != 3858) return; Main.spriteBatch.Draw(TextureAssets.GlowMask[233].Value, position, new Microsoft.Xna.Framework.Rectangle?(frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 63) * 0.75f, rotation, frame.Size() / 2f, scale, SpriteEffects.None, 0.0f); } public void DrawItems() { for (int whoami = 0; whoami < 400; ++whoami) this.DrawItem(Main.item[whoami], whoami); } protected void DrawRain() { bool flag = this.IsActive || Main.netMode == 1; Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, 2, 40); Texture2D texture = TextureAssets.Rain.Value; Vector2 zero = Vector2.Zero; for (int index = 0; index < Main.maxRain; ++index) { Rain rain = Main.rain[index]; if (rain.active) { rectangle.X = (int) rain.type * 4; Main.spriteBatch.Draw(texture, rain.position - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangle), Lighting.GetColor((int) ((double) rain.position.X + 4.0) >> 4, (int) ((double) rain.position.Y + 4.0) >> 4) * 0.85f, rain.rotation, zero, rain.scale, SpriteEffects.None, 0.0f); if (flag) rain.Update(); } } TimeLogger.DetailedDrawTime(23); } protected void DrawDust() { Microsoft.Xna.Framework.Rectangle rectangle1 = new Microsoft.Xna.Framework.Rectangle((int) Main.screenPosition.X - 500, (int) Main.screenPosition.Y - 50, Main.screenWidth + 1000, Main.screenHeight + 100); rectangle1 = new Microsoft.Xna.Framework.Rectangle((int) Main.screenPosition.X - 1000, (int) Main.screenPosition.Y - 1050, Main.screenWidth + 2000, Main.screenHeight + 2100); Microsoft.Xna.Framework.Rectangle rectangle2 = rectangle1; ArmorShaderData armorShaderData = (ArmorShaderData) null; Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone, (Effect) null, Main.Transform); for (int index1 = 0; index1 < Main.maxDustToDraw; ++index1) { Dust dust = Main.dust[index1]; if (dust.active) { if (dust.type >= 130 && dust.type <= 134 || dust.type >= 219 && dust.type <= 223 || dust.type == 226 || dust.type == 278) rectangle1 = rectangle2; if (new Microsoft.Xna.Framework.Rectangle((int) dust.position.X, (int) dust.position.Y, 4, 4).Intersects(rectangle1)) { float scale1 = dust.scale; if (dust.shader != armorShaderData) { Main.spriteBatch.End(); armorShaderData = dust.shader; if (armorShaderData == null) { Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone, (Effect) null, Main.Transform); } else { Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullNone, (Effect) null, Main.Transform); dust.shader.Apply((Entity) null); } } if (dust.type >= 130 && dust.type <= 134) { float num = (Math.Abs(dust.velocity.X) + Math.Abs(dust.velocity.Y)) * 0.3f * 10f; if ((double) num > 10.0) num = 10f; for (int index2 = 0; (double) index2 < (double) num; ++index2) { Vector2 velocity = dust.velocity; Vector2 vector2 = dust.position - velocity * (float) index2; float scale2 = dust.scale * (float) (1.0 - (double) index2 / 10.0); Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) ((double) dust.position.X + 4.0) / 16, (int) ((double) dust.position.Y + 4.0) / 16); Microsoft.Xna.Framework.Color alpha = dust.GetAlpha(color); Main.spriteBatch.Draw(TextureAssets.Dust.Value, vector2 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(dust.frame), alpha, dust.rotation, new Vector2(4f, 4f), scale2, SpriteEffects.None, 0.0f); } } else if (dust.type == 278) { float num = (Math.Abs(dust.velocity.X) + Math.Abs(dust.velocity.Y)) * 0.3f * 10f; if ((double) num > 10.0) num = 10f; Vector2 origin = new Vector2(4f, 4f); for (int index3 = 0; (double) index3 < (double) num; ++index3) { Vector2 velocity = dust.velocity; Vector2 vector2 = dust.position - velocity * (float) index3; float scale3 = dust.scale * (float) (1.0 - (double) index3 / 10.0); Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) ((double) dust.position.X + 4.0) / 16, (int) ((double) dust.position.Y + 4.0) / 16); Microsoft.Xna.Framework.Color alpha = dust.GetAlpha(color); Main.spriteBatch.Draw(TextureAssets.Dust.Value, vector2 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(dust.frame), alpha, dust.rotation, origin, scale3, SpriteEffects.None, 0.0f); } } else if (dust.type >= 219 && dust.type <= 223 && (double) dust.fadeIn == 0.0) { float num = (Math.Abs(dust.velocity.X) + Math.Abs(dust.velocity.Y)) * 0.3f * 10f; if ((double) num > 10.0) num = 10f; for (int index4 = 0; (double) index4 < (double) num; ++index4) { Vector2 velocity = dust.velocity; Vector2 vector2 = dust.position - velocity * (float) index4; float scale4 = dust.scale * (float) (1.0 - (double) index4 / 10.0); Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) ((double) dust.position.X + 4.0) / 16, (int) ((double) dust.position.Y + 4.0) / 16); Microsoft.Xna.Framework.Color alpha = dust.GetAlpha(color); Main.spriteBatch.Draw(TextureAssets.Dust.Value, vector2 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(dust.frame), alpha, dust.rotation, new Vector2(4f, 4f), scale4, SpriteEffects.None, 0.0f); } } else if (dust.type == 264 && (double) dust.fadeIn == 0.0) { float num = (Math.Abs(dust.velocity.X) + Math.Abs(dust.velocity.Y)) * 10f; if ((double) num > 10.0) num = 10f; for (int index5 = 0; (double) index5 < (double) num; ++index5) { Vector2 velocity = dust.velocity; Vector2 vector2 = dust.position - velocity * (float) index5; float scale5 = dust.scale * (float) (1.0 - (double) index5 / 10.0); Microsoft.Xna.Framework.Color color1 = Lighting.GetColor((int) ((double) dust.position.X + 4.0) / 16, (int) ((double) dust.position.Y + 4.0) / 16); Microsoft.Xna.Framework.Color color2 = dust.GetAlpha(color1) * 0.3f; Main.spriteBatch.Draw(TextureAssets.Dust.Value, vector2 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(dust.frame), color2, dust.rotation, new Vector2(5f), scale5, SpriteEffects.None, 0.0f); Microsoft.Xna.Framework.Color color3 = dust.GetColor(color2); Main.spriteBatch.Draw(TextureAssets.Dust.Value, vector2 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(dust.frame), color3, dust.rotation, new Vector2(5f), scale5, SpriteEffects.None, 0.0f); } } else if ((dust.type == 226 || dust.type == 272) && (double) dust.fadeIn == 0.0) { float num = (Math.Abs(dust.velocity.X) + Math.Abs(dust.velocity.Y)) * 0.3f * 10f; if ((double) num > 10.0) num = 10f; for (int index6 = 0; (double) index6 < (double) num; ++index6) { Vector2 velocity = dust.velocity; Vector2 vector2 = dust.position - velocity * (float) index6; float scale6 = dust.scale * (float) (1.0 - (double) index6 / 10.0); Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) ((double) dust.position.X + 4.0) / 16, (int) ((double) dust.position.Y + 4.0) / 16); Microsoft.Xna.Framework.Color alpha = dust.GetAlpha(color); Main.spriteBatch.Draw(TextureAssets.Dust.Value, vector2 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(dust.frame), alpha, dust.rotation, new Vector2(4f, 4f), scale6, SpriteEffects.None, 0.0f); } } Microsoft.Xna.Framework.Color newColor = Lighting.GetColor((int) ((double) dust.position.X + 4.0) / 16, (int) ((double) dust.position.Y + 4.0) / 16); if (dust.type == 6 || dust.type == 15 || dust.type >= 59 && dust.type <= 64) newColor = Microsoft.Xna.Framework.Color.White; Microsoft.Xna.Framework.Color alpha1 = dust.GetAlpha(newColor); if (dust.type == 213) scale1 = 1f; Main.spriteBatch.Draw(TextureAssets.Dust.Value, dust.position - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(dust.frame), alpha1, dust.rotation, new Vector2(4f, 4f), scale1, SpriteEffects.None, 0.0f); if (dust.color.PackedValue != 0U) { Microsoft.Xna.Framework.Color color = dust.GetColor(alpha1); if (color.PackedValue != 0U) Main.spriteBatch.Draw(TextureAssets.Dust.Value, dust.position - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(dust.frame), color, dust.rotation, new Vector2(4f, 4f), scale1, SpriteEffects.None, 0.0f); } if (alpha1 == Microsoft.Xna.Framework.Color.Black) dust.active = false; } else dust.active = false; } } Main.spriteBatch.End(); Main.pixelShader.CurrentTechnique.Passes[0].Apply(); TimeLogger.DetailedDrawTime(25); } private static void HelpText() { bool flag1 = false; if (Main.player[Main.myPlayer].statLifeMax > 100) flag1 = true; bool flag2 = false; if (Main.player[Main.myPlayer].statManaMax > 20) flag2 = true; bool flag3 = true; bool flag4 = false; bool flag5 = false; bool flag6 = false; bool flag7 = false; bool flag8 = false; bool flag9 = false; bool flag10 = false; bool flag11 = false; bool flag12 = false; bool flag13 = false; for (int index = 0; index < 58; ++index) { if (Main.player[Main.myPlayer].inventory[index].pick > 0 && Main.player[Main.myPlayer].inventory[index].Name != "Copper Pickaxe") flag3 = false; if (Main.player[Main.myPlayer].inventory[index].axe > 0 && Main.player[Main.myPlayer].inventory[index].Name != "Copper Axe") flag3 = false; if (Main.player[Main.myPlayer].inventory[index].hammer > 0) flag3 = false; if (Main.player[Main.myPlayer].inventory[index].type == 11 || Main.player[Main.myPlayer].inventory[index].type == 12 || Main.player[Main.myPlayer].inventory[index].type == 13 || Main.player[Main.myPlayer].inventory[index].type == 14 || Main.player[Main.myPlayer].inventory[index].type == 699 || Main.player[Main.myPlayer].inventory[index].type == 700 || Main.player[Main.myPlayer].inventory[index].type == 701 || Main.player[Main.myPlayer].inventory[index].type == 702) flag4 = true; if (Main.player[Main.myPlayer].inventory[index].type == 19 || Main.player[Main.myPlayer].inventory[index].type == 20 || Main.player[Main.myPlayer].inventory[index].type == 21 || Main.player[Main.myPlayer].inventory[index].type == 22 || Main.player[Main.myPlayer].inventory[index].type == 703 || Main.player[Main.myPlayer].inventory[index].type == 704 || Main.player[Main.myPlayer].inventory[index].type == 705 || Main.player[Main.myPlayer].inventory[index].type == 706) flag5 = true; if (Main.player[Main.myPlayer].inventory[index].type == 75) flag6 = true; if (Main.player[Main.myPlayer].inventory[index].type == 38) flag7 = true; if (Main.player[Main.myPlayer].inventory[index].type == 68 || Main.player[Main.myPlayer].inventory[index].type == 70 || Main.player[Main.myPlayer].inventory[index].type == 1330 || Main.player[Main.myPlayer].inventory[index].type == 1331 || Main.player[Main.myPlayer].inventory[index].type == 67 || Main.player[Main.myPlayer].inventory[index].type == 2886) flag8 = true; if (Main.player[Main.myPlayer].inventory[index].type == 84 || Main.player[Main.myPlayer].inventory[index].type == 1236 || Main.player[Main.myPlayer].inventory[index].type == 1237 || Main.player[Main.myPlayer].inventory[index].type == 1238 || Main.player[Main.myPlayer].inventory[index].type == 1239 || Main.player[Main.myPlayer].inventory[index].type == 1240 || Main.player[Main.myPlayer].inventory[index].type == 1241 || Main.player[Main.myPlayer].inventory[index].type == 939 || Main.player[Main.myPlayer].inventory[index].type == 1273 || Main.player[Main.myPlayer].inventory[index].type == 2585 || Main.player[Main.myPlayer].inventory[index].type == 2360 || Main.player[Main.myPlayer].inventory[index].type == 185 || Main.player[Main.myPlayer].inventory[index].type == 1800 || Main.player[Main.myPlayer].inventory[index].type == 1915) flag9 = true; if (Main.player[Main.myPlayer].inventory[index].type == 3347) flag10 = true; if (Main.player[Main.myPlayer].inventory[index].type == 174) flag11 = true; if (Main.player[Main.myPlayer].inventory[index].type == 1141) flag12 = true; if (Main.player[Main.myPlayer].inventory[index].type == 1533 || Main.player[Main.myPlayer].inventory[index].type == 1534 || Main.player[Main.myPlayer].inventory[index].type == 1535 || Main.player[Main.myPlayer].inventory[index].type == 1536 || Main.player[Main.myPlayer].inventory[index].type == 1537 || Main.player[Main.myPlayer].inventory[index].type == 4714) flag13 = true; } bool flag14 = false; bool flag15 = false; bool flag16 = false; bool flag17 = false; bool flag18 = false; bool flag19 = false; bool flag20 = false; bool flag21 = false; bool flag22 = false; bool flag23 = false; bool flag24 = false; bool flag25 = false; bool flag26 = false; bool flag27 = false; bool flag28 = false; bool flag29 = false; bool flag30 = false; bool flag31 = false; bool flag32 = false; bool flag33 = false; bool flag34 = false; bool flag35 = false; bool flag36 = false; bool flag37 = false; bool flag38 = false; int num = 0; for (int index = 0; index < 200; ++index) { if (Main.npc[index].active) { if (Main.npc[index].townNPC && Main.npc[index].type != 37) ++num; if (Main.npc[index].type == 17) flag14 = true; if (Main.npc[index].type == 18) flag15 = true; if (Main.npc[index].type == 19) flag17 = true; if (Main.npc[index].type == 20) flag16 = true; if (Main.npc[index].type == 54) flag22 = true; if (Main.npc[index].type == 124) flag19 = true; if (Main.npc[index].type == 38) flag18 = true; if (Main.npc[index].type == 108) flag20 = true; if (Main.npc[index].type == 107) flag21 = true; if (Main.npc[index].type == 228) flag23 = true; if (Main.npc[index].type == 178) flag24 = true; if (Main.npc[index].type == 209) flag25 = true; if (Main.npc[index].type == 353) flag26 = true; if (Main.npc[index].type == 633) flag38 = true; if (Main.npc[index].type == 369) flag27 = true; if (Main.npc[index].type == 441) flag28 = true; if (Main.npc[index].type == 229) flag29 = true; if (Main.npc[index].type == 207) flag30 = true; if (Main.npc[index].type == 160) flag31 = true; if (Main.npc[index].type == 588) flag32 = true; if (Main.npc[index].type == 227) flag33 = true; if (Main.npc[index].type == 208) flag34 = true; if (Main.npc[index].type == 550) flag35 = true; if (Main.npc[index].type == 368) flag36 = true; if (Main.npc[index].type == 453) flag37 = true; } } object substitutionObject = Lang.CreateDialogSubstitutionObject(); while (true) { do { ++Main.helpText; if (Language.Exists("GuideHelpText.Help_" + (object) Main.helpText)) { LocalizedText text = Language.GetText("GuideHelpText.Help_" + (object) Main.helpText); if (text.CanFormatWith(substitutionObject)) { Main.npcChatText = text.FormatWith(substitutionObject); return; } } if (flag3) { switch (Main.helpText) { case 1: Main.npcChatText = Lang.dialog(177); return; case 2: Main.npcChatText = Lang.dialog(178); return; case 3: Main.npcChatText = Lang.dialog(179); return; case 4: Main.npcChatText = Lang.dialog(180); return; case 5: Main.npcChatText = Lang.dialog(181); return; case 6: Main.npcChatText = Lang.dialog(182); return; } } if (flag3 && !flag4 && !flag5 && Main.helpText == 11) { Main.npcChatText = Lang.dialog(183); return; } if (flag3 & flag4 && !flag5) { if (Main.helpText == 21) { Main.npcChatText = Lang.dialog(184); return; } if (Main.helpText == 22) { Main.npcChatText = Lang.dialog(185); return; } } if (flag3 & flag5) { if (Main.helpText == 31) { Main.npcChatText = Lang.dialog(186); return; } if (Main.helpText == 32) { Main.npcChatText = Lang.dialog(187); return; } } if (!flag1 && Main.helpText == 41) { Main.npcChatText = Lang.dialog(188); return; } if (!flag2 && Main.helpText == 42) { Main.npcChatText = Lang.dialog(189); return; } if (!flag2 && !flag6 && Main.helpText == 43) { Main.npcChatText = Lang.dialog(190); return; } if (!flag14 && !flag15) { switch (Main.helpText) { case 51: Main.npcChatText = Lang.dialog(191); return; case 52: Main.npcChatText = Lang.dialog(192); return; case 53: Main.npcChatText = Lang.dialog(193); return; case 54: Main.npcChatText = Lang.dialog(194); return; } } if (!flag14 && Main.helpText == 61) { Main.npcChatText = Lang.dialog(195); return; } if (!flag15 && Main.helpText == 62) { Main.npcChatText = Lang.dialog(196); return; } if (!flag17 && Main.helpText == 63) { Main.npcChatText = Lang.dialog(197); return; } if (!flag16 && Main.helpText == 64) { Main.npcChatText = Lang.dialog(198); return; } if (!flag19 && Main.helpText == 65 && NPC.downedBoss3) { Main.npcChatText = Lang.dialog(199); return; } if (!flag22 && Main.helpText == 66 && NPC.downedBoss3) { Main.npcChatText = Lang.dialog(200); return; } if (!flag18 && Main.helpText == 67) { Main.npcChatText = Lang.dialog(201); return; } if (!flag21 && NPC.downedBoss2 && Main.helpText == 68) { Main.npcChatText = Lang.dialog(202); return; } if (!flag20 && Main.hardMode && Main.helpText == 69) { Main.npcChatText = Lang.dialog(203); return; } if (!flag23 && Main.helpText == 70 && NPC.downedBoss2) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1100"); return; } if (!flag24 && Main.helpText == 71 && Main.hardMode) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1101"); return; } if (!flag25 && Main.helpText == 72 && NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1102"); return; } if (!flag26 && Main.helpText == 73) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1103"); return; } if (!flag27 && Main.helpText == 74) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1104"); return; } if (!flag28 && Main.helpText == 75 && Main.hardMode) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1105"); return; } if (!flag29 && Main.helpText == 76 && Main.hardMode) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1106"); return; } if (!flag30 && Main.helpText == 77) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1107"); return; } if (!flag31 && Main.helpText == 78 && Main.hardMode) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1108"); return; } if (!flag32 && Main.helpText == 79) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1109"); return; } if (!flag33 && Main.helpText == 80 && num >= 5) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1110"); return; } if (!flag34 && Main.helpText == 81 && num >= 11) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1111"); return; } if (!flag35 && NPC.downedBoss2 && Main.helpText == 82) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1112"); return; } if (((flag36 ? 0 : (Main.helpText == 83 ? 1 : 0)) & (flag14 ? 1 : 0)) != 0) { Main.npcChatText = Language.GetTextValueWith("GuideHelpTextSpecific.Help_1113", substitutionObject); return; } if (!flag37 && Main.helpText == 84 && !Main.hardMode) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1114"); return; } if (!flag38 && Main.helpText == 85 && !Main.hardMode) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1115"); return; } if (flag7 && !WorldGen.crimson && Main.helpText == 100) { Main.npcChatText = Lang.dialog(204); return; } if (flag8 && Main.helpText == 101) { Main.npcChatText = Lang.dialog(WorldGen.crimson ? 403 : 205); return; } if (flag7 | flag8 && Main.helpText == 102) { Main.npcChatText = Lang.dialog(WorldGen.crimson ? 402 : 206); return; } if (flag7 && WorldGen.crimson && Main.helpText == 103) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1159"); return; } if (!flag9 && Main.LocalPlayer.miscEquips[4].IsAir && Main.helpText == 201 && !Main.hardMode && !NPC.downedBoss3 && !NPC.downedBoss2) { Main.npcChatText = Lang.dialog(207); return; } if (Main.helpText == 202 && !Main.hardMode && Main.player[Main.myPlayer].statLifeMax >= 140) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1120"); return; } if (Main.helpText == 203 && Main.hardMode && NPC.downedMechBossAny) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1121"); return; } if (Main.helpText == 204 && !NPC.downedGoblins && Main.player[Main.myPlayer].statLifeMax >= 200 && WorldGen.shadowOrbSmashed) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1122"); return; } if (Main.helpText == 205 && Main.hardMode && !NPC.downedPirates && Main.player[Main.myPlayer].statLifeMax >= 200) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1123"); return; } if (Main.helpText == 206 && Main.hardMode && NPC.downedGolemBoss && !NPC.downedMartians) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1124"); return; } if (Main.helpText == 207 && (NPC.downedBoss1 || NPC.downedBoss2 || NPC.downedBoss3)) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1125"); return; } if (Main.helpText == 208 && !Main.hardMode) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1130"); return; } if (Main.helpText == 209 && !Main.hardMode) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1131"); return; } if (Main.helpText == 210 && !Main.hardMode) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1132"); return; } if (Main.helpText == 211 && !Main.hardMode) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1133"); return; } if (Main.helpText == 212 && !Main.hardMode) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1134"); return; } if (Main.helpText == 213 && !Main.hardMode) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1135"); return; } if (Main.helpText == 214 && !Main.hardMode && flag4 | flag5) { Main.npcChatText = Language.GetTextValueWith("GuideHelpTextSpecific.Help_1136", substitutionObject); return; } if (Main.helpText == 215 && Main.LocalPlayer.anglerQuestsFinished < 1) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1137"); return; } if (Main.helpText == 216 && !Main.hardMode) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1138"); return; } if (Main.helpText == 1000 && !NPC.downedBoss1 && !NPC.downedBoss2) { Main.npcChatText = Lang.dialog(208); return; } if (Main.helpText == 1001 && !NPC.downedBoss1 && !NPC.downedBoss2) { Main.npcChatText = Lang.dialog(209); return; } if (Main.helpText == 1002 && !NPC.downedBoss2) { if (WorldGen.crimson) { Main.npcChatText = Lang.dialog(331); return; } Main.npcChatText = Lang.dialog(210); return; } if (Main.helpText == 1050 && !NPC.downedBoss1 && Main.player[Main.myPlayer].statLifeMax < 200) { Main.npcChatText = Lang.dialog(211); return; } if (Main.helpText == 1051 && !NPC.downedBoss1 && Main.player[Main.myPlayer].statDefense <= 10) { Main.npcChatText = Lang.dialog(212); return; } if (Main.helpText == 1052 && !NPC.downedBoss1 && Main.player[Main.myPlayer].statLifeMax >= 200 && Main.player[Main.myPlayer].statDefense > 10) { Main.npcChatText = Lang.dialog(WorldGen.crimson ? 404 : 213); return; } if (Main.helpText == 1053 && NPC.downedBoss1 && !NPC.downedBoss2 && Main.player[Main.myPlayer].statLifeMax < 300) { Main.npcChatText = Lang.dialog(214); return; } if (Main.helpText == 1054 && NPC.downedBoss1 && !NPC.downedBoss2 && !WorldGen.crimson && Main.player[Main.myPlayer].statLifeMax >= 300) { Main.npcChatText = Lang.dialog(215); return; } if (Main.helpText == 1055 && NPC.downedBoss1 && !NPC.downedBoss2 && !WorldGen.crimson && Main.player[Main.myPlayer].statLifeMax >= 300) { Main.npcChatText = Lang.dialog(216); return; } if (Main.helpText == 1056 && NPC.downedBoss1 && NPC.downedBoss2 && !NPC.downedBoss3) { Main.npcChatText = Lang.dialog(217); return; } if (Main.helpText == 1057 && NPC.downedBoss1 && NPC.downedBoss2 && NPC.downedBoss3 && !Main.hardMode && Main.player[Main.myPlayer].statLifeMax < 400) { Main.npcChatText = Lang.dialog(218); return; } if (Main.helpText == 1058 && NPC.downedBoss1 && NPC.downedBoss2 && NPC.downedBoss3 && !Main.hardMode && Main.player[Main.myPlayer].statLifeMax >= 400) { Main.npcChatText = Lang.dialog(219); return; } if (Main.helpText == 1059 && NPC.downedBoss1 && NPC.downedBoss2 && NPC.downedBoss3 && !Main.hardMode && Main.player[Main.myPlayer].statLifeMax >= 400) { Main.npcChatText = Lang.dialog(220); return; } if (Main.helpText == 1060 && NPC.downedBoss1 && NPC.downedBoss2 && NPC.downedBoss3 && !Main.hardMode && Main.player[Main.myPlayer].statLifeMax >= 400) { Main.npcChatText = Lang.dialog(221); return; } if (Main.helpText == 1061 && Main.hardMode && !NPC.downedPlantBoss) { Main.npcChatText = Lang.dialog(WorldGen.crimson ? 401 : 222); return; } if (Main.helpText == 1062 && Main.hardMode && !NPC.downedPlantBoss) { Main.npcChatText = Lang.dialog(223); return; } if (Main.helpText == 1140 && NPC.downedBoss1 && !NPC.downedBoss2 && WorldGen.crimson && Main.player[Main.myPlayer].statLifeMax >= 300) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1140"); return; } if (Main.helpText == 1141 && NPC.downedBoss1 && !NPC.downedBoss2 && WorldGen.crimson && Main.player[Main.myPlayer].statLifeMax >= 300) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1141"); return; } if (Main.helpText == 1142 && NPC.downedBoss2 && !Main.hardMode) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1142"); return; } if (Main.helpText == 1143 && NPC.downedBoss2 && !NPC.downedQueenBee && Main.player[Main.myPlayer].statLifeMax >= 300) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1143"); return; } if (Main.helpText == 1144 & flag10) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1144"); return; } if (Main.helpText == 1145 & flag11 && !Main.hardMode) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1145"); return; } if (Main.helpText == 1146 && Main.hardMode && Main.player[Main.myPlayer].wingsLogic == 0 && !Main.LocalPlayer.mount.Active && !NPC.downedPlantBoss) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1146"); return; } if (Main.helpText == 1147 && Main.hardMode && WorldGen.SavedOreTiers.Adamantite == 111 && !NPC.downedMechBossAny) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1147"); return; } if (Main.helpText == 1148 && Main.hardMode && WorldGen.SavedOreTiers.Adamantite == 223 && !NPC.downedMechBossAny) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1148"); return; } if (Main.helpText == 1149 && Main.hardMode && NPC.downedMechBossAny && Main.player[Main.myPlayer].statLifeMax < 500) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1149"); return; } if (Main.helpText == 1150 && Main.hardMode && NPC.downedMechBoss1 && NPC.downedMechBoss2 && NPC.downedMechBoss3 && !NPC.downedPlantBoss) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1150"); return; } if (((Main.helpText != 1151 || !Main.hardMode || !NPC.downedPlantBoss ? 0 : (!NPC.downedGolemBoss ? 1 : 0)) & (flag12 ? 1 : 0)) != 0) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1151"); return; } if (Main.helpText == 1152 && Main.hardMode && NPC.downedPlantBoss && !NPC.downedGolemBoss && !flag12) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1152"); return; } if (((Main.helpText != 1153 ? 0 : (Main.hardMode ? 1 : 0)) & (flag13 ? 1 : 0)) != 0) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1153"); return; } if (Main.helpText == 1154 && Main.hardMode && !NPC.downedFishron) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1154"); return; } if (Main.helpText == 1155 && Main.hardMode && NPC.downedGolemBoss && !NPC.downedHalloweenTree && !NPC.downedHalloweenKing) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1155"); return; } if (Main.helpText == 1156 && Main.hardMode && NPC.downedGolemBoss && !NPC.downedChristmasIceQueen && !NPC.downedChristmasTree && !NPC.downedChristmasSantank) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1156"); return; } if (Main.helpText == 1157 && Main.hardMode && NPC.downedGolemBoss && NPC.AnyNPCs(437) && !NPC.downedMoonlord) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1157"); return; } if (Main.helpText == 1158 && Main.hardMode && NPC.LunarApocalypseIsUp && !NPC.downedMoonlord) { Main.npcChatText = Language.GetTextValue("GuideHelpTextSpecific.Help_1158"); return; } } while (Main.helpText <= 1200); Main.helpText = 0; } } protected void GUIChatDrawInner() { if (Main.player[Main.myPlayer].talkNPC < 0 && Main.player[Main.myPlayer].sign == -1) { Main.npcChatText = ""; } else { Microsoft.Xna.Framework.Color color1 = new Microsoft.Xna.Framework.Color(200, 200, 200, 200); int num1 = ((int) Main.mouseTextColor * 2 + (int) byte.MaxValue) / 3; Microsoft.Xna.Framework.Color color2 = new Microsoft.Xna.Framework.Color(num1, num1, num1, num1); bool flag1 = Main.InGameUI.CurrentState is UIVirtualKeyboard && PlayerInput.UsingGamepad; this._textDisplayCache.PrepareCache(Main.npcChatText); string[] textLines = this._textDisplayCache.TextLines; int amountOfLines = this._textDisplayCache.AmountOfLines; bool flag2 = false; if (Main.editSign) { ++this.textBlinkerCount; if (this.textBlinkerCount >= 20) { this.textBlinkerState = this.textBlinkerState != 0 ? 0 : 1; this.textBlinkerCount = 0; } if (this.textBlinkerState == 1) flag2 = true; Main.instance.DrawWindowsIMEPanel(new Vector2((float) (Main.screenWidth / 2), 90f), 0.5f); } int numLines = amountOfLines + 1; Main.spriteBatch.Draw(TextureAssets.ChatBack.Value, new Vector2((float) (Main.screenWidth / 2 - TextureAssets.ChatBack.Width() / 2), 100f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.ChatBack.Width(), (numLines + 1) * 30)), color1, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.ChatBack.Value, new Vector2((float) (Main.screenWidth / 2 - TextureAssets.ChatBack.Width() / 2), (float) (100 + (numLines + 1) * 30)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, TextureAssets.ChatBack.Height() - 30, TextureAssets.ChatBack.Width(), 30)), color1, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); for (int index = 0; index < numLines; ++index) { string text = textLines[index]; if (text != null) { if (index == numLines - 1 & flag2) text += "|"; Utils.DrawBorderStringFourWay(Main.spriteBatch, FontAssets.MouseText.Value, text, (float) (170 + (Main.screenWidth - 800) / 2), (float) (120 + index * 30), color2, Microsoft.Xna.Framework.Color.Black, Vector2.Zero); } } Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(Main.screenWidth / 2 - TextureAssets.ChatBack.Width() / 2, 100, TextureAssets.ChatBack.Width(), (numLines + 2) * 30); int num2 = 120 + numLines * 30 + 30 - 235; UIVirtualKeyboard.ShouldHideText = !PlayerInput.UsingGamepad; if (!PlayerInput.UsingGamepad) num2 = 9999; UIVirtualKeyboard.OffsetDown = num2; if (Main.npcChatCornerItem != 0) { Vector2 position = new Vector2((float) (Main.screenWidth / 2 + TextureAssets.ChatBack.Width() / 2), (float) (100 + (numLines + 1) * 30 + 30)) - Vector2.One * 8f; Item obj = new Item(); obj.netDefaults(Main.npcChatCornerItem); float scale = 1f; this.LoadItem(obj.type); Texture2D texture = TextureAssets.Item[obj.type].Value; if (texture.Width > 32 || texture.Height > 32) scale = texture.Width <= texture.Height ? 32f / (float) texture.Height : 32f / (float) texture.Width; Main.spriteBatch.Draw(texture, position, new Microsoft.Xna.Framework.Rectangle?(), obj.GetAlpha(Microsoft.Xna.Framework.Color.White), 0.0f, new Vector2((float) texture.Width, (float) texture.Height), scale, SpriteEffects.None, 0.0f); if (obj.color != new Microsoft.Xna.Framework.Color()) Main.spriteBatch.Draw(texture, position, new Microsoft.Xna.Framework.Rectangle?(), obj.GetColor(obj.color), 0.0f, new Vector2((float) texture.Width, (float) texture.Height), scale, SpriteEffects.None, 0.0f); if (new Microsoft.Xna.Framework.Rectangle((int) position.X - (int) ((double) texture.Width * (double) scale), (int) position.Y - (int) ((double) texture.Height * (double) scale), (int) ((double) texture.Width * (double) scale), (int) ((double) texture.Height * (double) scale)).Contains(new Microsoft.Xna.Framework.Point(Main.mouseX, Main.mouseY))) this.MouseText(obj.Name, -11); } int mouseTextColor = (int) Main.mouseTextColor; color2 = new Microsoft.Xna.Framework.Color(mouseTextColor, (int) ((double) mouseTextColor / 1.1), mouseTextColor / 2, mouseTextColor); string focusText = ""; string focusText3 = ""; int num3 = Main.player[Main.myPlayer].statLifeMax2 - Main.player[Main.myPlayer].statLife; for (int index1 = 0; index1 < 22; ++index1) { int index2 = Main.player[Main.myPlayer].buffType[index1]; if (Main.debuff[index2] && Main.player[Main.myPlayer].buffTime[index1] > 60 && index2 != 28 && index2 != 34 && index2 != 87 && index2 != 89 && index2 != 21 && index2 != 86 && index2 != 199) num3 += 100; } if (NPC.downedGolemBoss) num3 *= 200; else if (NPC.downedPlantBoss) num3 *= 150; else if (NPC.downedMechBossAny) num3 *= 100; else if (Main.hardMode) num3 *= 60; else if (NPC.downedBoss3 || NPC.downedQueenBee) num3 *= 25; else if (NPC.downedBoss2) num3 *= 10; else if (NPC.downedBoss1) num3 *= 3; if (Main.expertMode) num3 *= 2; int num4 = (int) ((double) num3 * Main.player[Main.myPlayer].currentShoppingSettings.PriceAdjustment); string str1 = (string) null; string text1 = (string) null; if (Main.player[Main.myPlayer].sign > -1) focusText = !Main.editSign ? Lang.inter[48].Value : Lang.inter[47].Value; else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 20) { focusText = Lang.inter[28].Value; focusText3 = Lang.inter[49].Value; } else if (NPCID.Sets.IsTownPet[Main.npc[Main.player[Main.myPlayer].talkNPC].type]) focusText = Language.GetTextValue("UI.PetTheAnimal"); else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 207) { focusText = Lang.inter[28].Value; if (Main.hardMode) focusText3 = Lang.inter[107].Value; } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 453) focusText = Lang.inter[28].Value; else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 550) { focusText = Lang.inter[28].Value; focusText3 = Language.GetTextValue("UI.BartenderHelp"); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 588) focusText = Lang.inter[28].Value; else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 633) focusText = Lang.inter[28].Value; else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 353) { focusText = Lang.inter[28].Value; focusText3 = Language.GetTextValue("GameUI.HairStyle"); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 368) focusText = Lang.inter[28].Value; else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 369) focusText = Lang.inter[64].Value; else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 208) { focusText = Lang.inter[28].Value; if (Main.TOWMusicUnlocked) focusText3 = Language.GetTextValue("GameUI.Music"); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 17 || Main.npc[Main.player[Main.myPlayer].talkNPC].type == 19 || Main.npc[Main.player[Main.myPlayer].talkNPC].type == 38 || Main.npc[Main.player[Main.myPlayer].talkNPC].type == 54 || Main.npc[Main.player[Main.myPlayer].talkNPC].type == 107 || Main.npc[Main.player[Main.myPlayer].talkNPC].type == 108 || Main.npc[Main.player[Main.myPlayer].talkNPC].type == 124 || Main.npc[Main.player[Main.myPlayer].talkNPC].type == 142 || Main.npc[Main.player[Main.myPlayer].talkNPC].type == 160 || Main.npc[Main.player[Main.myPlayer].talkNPC].type == 178 || Main.npc[Main.player[Main.myPlayer].talkNPC].type == 207 || Main.npc[Main.player[Main.myPlayer].talkNPC].type == 209 || Main.npc[Main.player[Main.myPlayer].talkNPC].type == 227 || Main.npc[Main.player[Main.myPlayer].talkNPC].type == 228 || Main.npc[Main.player[Main.myPlayer].talkNPC].type == 229) { focusText = Lang.inter[28].Value; if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 107) focusText3 = Lang.inter[19].Value; } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 37) { if (!Main.dayTime) focusText = Lang.inter[50].Value; } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 22) { focusText = Lang.inter[51].Value; focusText3 = Lang.inter[25].Value; } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 441) { if (Main.player[Main.myPlayer].taxMoney <= 0) { focusText = Lang.inter[89].Value; } else { string str2 = ""; int num5 = 0; int num6 = 0; int num7 = 0; int num8 = 0; int num9 = (int) ((double) Main.player[Main.myPlayer].taxMoney / Main.player[Main.myPlayer].currentShoppingSettings.PriceAdjustment); if (num9 < 0) num9 = 0; num4 = num9; if (num9 >= 1000000) { num5 = num9 / 1000000; num9 -= num5 * 1000000; } if (num9 >= 10000) { num6 = num9 / 10000; num9 -= num6 * 10000; } if (num9 >= 100) { num7 = num9 / 100; num9 -= num7 * 100; } if (num9 >= 1) num8 = num9; if (num5 > 0) str2 = str2 + (object) num5 + " " + Lang.inter[15].Value + " "; if (num6 > 0) str2 = str2 + (object) num6 + " " + Lang.inter[16].Value + " "; if (num7 > 0) str2 = str2 + (object) num7 + " " + Lang.inter[17].Value + " "; if (num8 > 0) str2 = str2 + (object) num8 + " " + Lang.inter[18].Value + " "; float num10 = (float) Main.mouseTextColor / (float) byte.MaxValue; if (num5 > 0) color2 = new Microsoft.Xna.Framework.Color((int) (byte) (220.0 * (double) num10), (int) (byte) (220.0 * (double) num10), (int) (byte) (198.0 * (double) num10), (int) Main.mouseTextColor); else if (num6 > 0) color2 = new Microsoft.Xna.Framework.Color((int) (byte) (224.0 * (double) num10), (int) (byte) (201.0 * (double) num10), (int) (byte) (92.0 * (double) num10), (int) Main.mouseTextColor); else if (num7 > 0) color2 = new Microsoft.Xna.Framework.Color((int) (byte) (181.0 * (double) num10), (int) (byte) (192.0 * (double) num10), (int) (byte) (193.0 * (double) num10), (int) Main.mouseTextColor); else if (num8 > 0) color2 = new Microsoft.Xna.Framework.Color((int) (byte) (246.0 * (double) num10), (int) (byte) (138.0 * (double) num10), (int) (byte) (96.0 * (double) num10), (int) Main.mouseTextColor); string str3; if (str2 == "") { str3 = Lang.inter[89].Value; } else { string str4 = str2.Substring(0, str2.Length - 1); str3 = Lang.inter[89].Value + " (" + str4 + ")"; } string str5 = Lang.inter[89].Value; text1 = str5; str1 = ""; for (int index = 0; index < str5.Length; ++index) str1 += " "; focusText = str5 + str1 + " "; } } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 18) { string str6 = ""; int num11 = 0; int num12 = 0; int num13 = 0; int num14 = 0; int num15 = num4; if (num15 > 0 && num15 < 1) num15 = 1; if (num15 < 0) num15 = 0; num4 = num15; if (num15 >= 1000000) { num11 = num15 / 1000000; num15 -= num11 * 1000000; } if (num15 >= 10000) { num12 = num15 / 10000; num15 -= num12 * 10000; } if (num15 >= 100) { num13 = num15 / 100; num15 -= num13 * 100; } if (num15 >= 1) num14 = num15; if (num11 > 0) str6 = str6 + (object) num11 + " " + Lang.inter[15].Value + " "; if (num12 > 0) str6 = str6 + (object) num12 + " " + Lang.inter[16].Value + " "; if (num13 > 0) str6 = str6 + (object) num13 + " " + Lang.inter[17].Value + " "; if (num14 > 0) str6 = str6 + (object) num14 + " " + Lang.inter[18].Value + " "; float num16 = (float) Main.mouseTextColor / (float) byte.MaxValue; if (num11 > 0) color2 = new Microsoft.Xna.Framework.Color((int) (byte) (220.0 * (double) num16), (int) (byte) (220.0 * (double) num16), (int) (byte) (198.0 * (double) num16), (int) Main.mouseTextColor); else if (num12 > 0) color2 = new Microsoft.Xna.Framework.Color((int) (byte) (224.0 * (double) num16), (int) (byte) (201.0 * (double) num16), (int) (byte) (92.0 * (double) num16), (int) Main.mouseTextColor); else if (num13 > 0) color2 = new Microsoft.Xna.Framework.Color((int) (byte) (181.0 * (double) num16), (int) (byte) (192.0 * (double) num16), (int) (byte) (193.0 * (double) num16), (int) Main.mouseTextColor); else if (num14 > 0) color2 = new Microsoft.Xna.Framework.Color((int) (byte) (246.0 * (double) num16), (int) (byte) (138.0 * (double) num16), (int) (byte) (96.0 * (double) num16), (int) Main.mouseTextColor); if (str6 == "") { focusText = Lang.inter[54].Value; } else { string str7 = str6.Substring(0, str6.Length - 1); focusText = Lang.inter[54].Value + " (" + str7 + ")"; } } if (!flag1) { Main.DrawNPCChatButtons(mouseTextColor, color2, numLines, focusText, focusText3); if (str1 != null) { float num17 = (float) (130 + numLines * 30); float shopx = (float) (180 + (Main.screenWidth - 800) / 2) + (ChatManager.GetStringSize(FontAssets.MouseText.Value, text1, new Vector2(0.9f)).X - 20f); int num18 = (int) ((double) Main.player[Main.myPlayer].taxMoney / Main.player[Main.myPlayer].currentShoppingSettings.PriceAdjustment); ItemSlot.DrawMoney(Main.spriteBatch, "", shopx, num17 - 40f, Utils.CoinsSplit((long) num18), true); } } if (PlayerInput.IgnoreMouseInterface) return; if (rectangle.Contains(new Microsoft.Xna.Framework.Point(Main.mouseX, Main.mouseY))) Main.player[Main.myPlayer].mouseInterface = true; if (!Main.mouseLeft || !Main.mouseLeftRelease || !rectangle.Contains(new Microsoft.Xna.Framework.Point(Main.mouseX, Main.mouseY))) return; Main.mouseLeftRelease = false; Main.player[Main.myPlayer].releaseUseItem = false; Main.player[Main.myPlayer].mouseInterface = true; if (Main.npcChatFocus1) Main.CloseNPCChatOrSign(); else if (Main.npcChatFocus2) { if (Main.player[Main.myPlayer].sign != -1) { if (Main.editSign) Main.SubmitSignText(); else IngameFancyUI.OpenVirtualKeyboard(1); } else if (NPCID.Sets.IsTownPet[Main.npc[Main.player[Main.myPlayer].talkNPC].type]) Main.player[Main.myPlayer].PetAnimal(Main.player[Main.myPlayer].talkNPC); else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 369) { Main.npcChatCornerItem = 0; SoundEngine.PlaySound(12); bool turnIn = false; if (!Main.anglerQuestFinished && !Main.anglerWhoFinishedToday.Contains(Main.player[Main.myPlayer].name)) { int index = Main.player[Main.myPlayer].FindItem(Main.anglerQuestItemNetIDs[Main.anglerQuest]); if (index != -1) { --Main.player[Main.myPlayer].inventory[index].stack; if (Main.player[Main.myPlayer].inventory[index].stack <= 0) Main.player[Main.myPlayer].inventory[index] = new Item(); turnIn = true; SoundEngine.PlaySound(24); ++Main.player[Main.myPlayer].anglerQuestsFinished; Main.player[Main.myPlayer].GetAnglerReward(); } } Main.npcChatText = Lang.AnglerQuestChat(turnIn); if (!turnIn) return; Main.anglerQuestFinished = true; if (Main.netMode == 1) NetMessage.SendData(75); else Main.anglerWhoFinishedToday.Add(Main.player[Main.myPlayer].name); AchievementsHelper.HandleAnglerService(); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 17) this.OpenShop(1); else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 19) this.OpenShop(2); else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 124) this.OpenShop(8); else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 142) this.OpenShop(9); else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 37) { if (Main.netMode == 0) NPC.SpawnSkeletron(); else NetMessage.SendData(51, number: Main.myPlayer, number2: 1f); Main.npcChatText = ""; } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 20) this.OpenShop(3); else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 38) this.OpenShop(4); else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 54) this.OpenShop(5); else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 107) this.OpenShop(6); else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 108) this.OpenShop(7); else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 160) this.OpenShop(10); else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 178) this.OpenShop(11); else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 207) this.OpenShop(12); else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 208) this.OpenShop(13); else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 209) this.OpenShop(14); else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 227) this.OpenShop(15); else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 228) this.OpenShop(16); else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 229) this.OpenShop(17); else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 353) this.OpenShop(18); else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 368) this.OpenShop(19); else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 453) this.OpenShop(20); else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 550) this.OpenShop(21); else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 588) this.OpenShop(22); else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 633) this.OpenShop(23); else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 22) { SoundEngine.PlaySound(12); Main.HelpText(); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 441) { if (Main.player[Main.myPlayer].taxMoney > 0) { int num19 = (int) ((double) Main.player[Main.myPlayer].taxMoney / Main.player[Main.myPlayer].currentShoppingSettings.PriceAdjustment); while (num19 > 0) { if (num19 > 1000000) { int Stack = num19 / 1000000; num19 -= 1000000 * Stack; int number = Item.NewItem((int) Main.player[Main.myPlayer].position.X, (int) Main.player[Main.myPlayer].position.Y, Main.player[Main.myPlayer].width, Main.player[Main.myPlayer].height, 74, Stack); if (Main.netMode == 1) NetMessage.SendData(21, number: number, number2: 1f); } else if (num19 > 10000) { int Stack = num19 / 10000; num19 -= 10000 * Stack; int number = Item.NewItem((int) Main.player[Main.myPlayer].position.X, (int) Main.player[Main.myPlayer].position.Y, Main.player[Main.myPlayer].width, Main.player[Main.myPlayer].height, 73, Stack); if (Main.netMode == 1) NetMessage.SendData(21, number: number, number2: 1f); } else if (num19 > 100) { int Stack = num19 / 100; num19 -= 100 * Stack; int number = Item.NewItem((int) Main.player[Main.myPlayer].position.X, (int) Main.player[Main.myPlayer].position.Y, Main.player[Main.myPlayer].width, Main.player[Main.myPlayer].height, 72, Stack); if (Main.netMode == 1) NetMessage.SendData(21, number: number, number2: 1f); } else { int Stack = num19; if (Stack < 1) Stack = 1; num19 -= Stack; int number = Item.NewItem((int) Main.player[Main.myPlayer].position.X, (int) Main.player[Main.myPlayer].position.Y, Main.player[Main.myPlayer].width, Main.player[Main.myPlayer].height, 71, Stack); if (Main.netMode == 1) NetMessage.SendData(21, number: number, number2: 1f); } } Main.npcChatText = Lang.dialog(Main.rand.Next(380, 382)); Main.player[Main.myPlayer].taxMoney = 0; } else Main.npcChatText = Lang.dialog(Main.rand.Next(390, 401)); } else { if (Main.npc[Main.player[Main.myPlayer].talkNPC].type != 18) return; SoundEngine.PlaySound(12); if (num4 > 0) { if (Main.player[Main.myPlayer].BuyItem(num4)) { AchievementsHelper.HandleNurseService(num4); SoundEngine.PlaySound(SoundID.Item4); Main.player[Main.myPlayer].HealEffect(Main.player[Main.myPlayer].statLifeMax2 - Main.player[Main.myPlayer].statLife); Main.npcChatText = (double) Main.player[Main.myPlayer].statLife >= (double) Main.player[Main.myPlayer].statLifeMax2 * 0.25 ? ((double) Main.player[Main.myPlayer].statLife >= (double) Main.player[Main.myPlayer].statLifeMax2 * 0.5 ? ((double) Main.player[Main.myPlayer].statLife >= (double) Main.player[Main.myPlayer].statLifeMax2 * 0.75 ? Lang.dialog(230) : Lang.dialog(229)) : Lang.dialog(228)) : Lang.dialog(227); Main.player[Main.myPlayer].statLife = Main.player[Main.myPlayer].statLifeMax2; for (int b = 0; b < 22; ++b) { int index = Main.player[Main.myPlayer].buffType[b]; if (Main.debuff[index] && Main.player[Main.myPlayer].buffTime[b] > 0 && index != 28 && index != 34 && index != 87 && index != 89 && index != 21 && index != 86 && index != 199) { Main.player[Main.myPlayer].DelBuff(b); b = -1; } } } else { int num20 = Main.rand.Next(3); if (num20 == 0) Main.npcChatText = Lang.dialog(52); if (num20 == 1) Main.npcChatText = Lang.dialog(53); if (num20 != 2) return; Main.npcChatText = Lang.dialog(54); } } else { int num21 = Main.rand.Next(3); if (!ChildSafety.Disabled) num21 = Main.rand.Next(1, 3); switch (num21) { case 0: Main.npcChatText = Lang.dialog(55); break; case 1: Main.npcChatText = Lang.dialog(56); break; case 2: Main.npcChatText = Lang.dialog(57); break; } } } } else if (Main.npcChatFocus4) { Main.npcChatCornerItem = 0; SoundEngine.PlaySound(12); Main.npcChatText = Main.player[Main.myPlayer].currentShoppingSettings.HappinessReport; } else { if (!Main.npcChatFocus3 || Main.player[Main.myPlayer].talkNPC < 0) return; if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 20) { SoundEngine.PlaySound(12); Main.npcChatText = Lang.GetDryadWorldStatusDialog(); } if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 208) { SoundEngine.PlaySound(12); Main.npcChatText = Language.GetTextValue("PartyGirlSpecialText.Music" + (object) Main.rand.Next(1, 4)); Main.swapMusic = !Main.swapMusic; } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 22) { Main.playerInventory = true; Main.npcChatText = ""; SoundEngine.PlaySound(12); Main.InGuideCraftMenu = true; UILinkPointNavigator.GoToDefaultPage(); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 107) { Main.playerInventory = true; Main.npcChatText = ""; SoundEngine.PlaySound(12); Main.InReforgeMenu = true; UILinkPointNavigator.GoToDefaultPage(); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 353) Main.OpenHairWindow(); else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 207) { Main.npcChatCornerItem = 0; SoundEngine.PlaySound(12); bool gotDye = false; int index = Main.player[Main.myPlayer].FindItem(ItemID.Sets.ExoticPlantsForDyeTrade); if (index != -1) { --Main.player[Main.myPlayer].inventory[index].stack; if (Main.player[Main.myPlayer].inventory[index].stack <= 0) Main.player[Main.myPlayer].inventory[index] = new Item(); gotDye = true; SoundEngine.PlaySound(24); Main.player[Main.myPlayer].GetDyeTraderReward(); } Main.npcChatText = Lang.DyeTraderQuestChat(gotDye); } else { if (Main.npc[Main.player[Main.myPlayer].talkNPC].type != 550) return; SoundEngine.PlaySound(12); Main.HelpText(); Main.npcChatText = Lang.BartenderHelpText(Main.npc[Main.player[Main.myPlayer].talkNPC]); } } } } private void OpenShop(int shopIndex) { Main.playerInventory = true; Main.stackSplit = 9999; Main.npcChatText = ""; Main.SetNPCShopIndex(shopIndex); this.shop[Main.npcShop].SetupShop(Main.npcShop); SoundEngine.PlaySound(12); } public static void SetNPCShopIndex(int index) => Main.npcShop = index; private static void DrawNPCChatButtons( int superColor, Microsoft.Xna.Framework.Color chatColor, int numLines, string focusText, string focusText3) { float y = (float) (130 + numLines * 30); int num1 = 180 + (Main.screenWidth - 800) / 2; Vector2 vec = new Vector2((float) Main.mouseX, (float) Main.mouseY); Player player = Main.player[Main.myPlayer]; Vector2 vector2_1 = new Vector2((float) num1, y); string text1 = focusText; DynamicSpriteFont font1 = FontAssets.MouseText.Value; Vector2 minimum1 = vector2_1; Vector2 baseScale = new Vector2(0.9f); Vector2 stringSize1 = ChatManager.GetStringSize(font1, text1, baseScale); Microsoft.Xna.Framework.Color baseColor1 = chatColor; Microsoft.Xna.Framework.Color black = Microsoft.Xna.Framework.Color.Black; Vector2 vector2_2 = new Vector2(1f); Microsoft.Xna.Framework.Color brown = Microsoft.Xna.Framework.Color.Brown; float num2 = 1.2f; if ((double) stringSize1.X > 260.0) vector2_2.X *= 260f / stringSize1.X; if (vec.Between(minimum1, minimum1 + stringSize1 * baseScale * vector2_2.X) && !PlayerInput.IgnoreMouseInterface) { player.mouseInterface = true; player.releaseUseItem = false; baseScale *= num2; if (!Main.npcChatFocus2) SoundEngine.PlaySound(12); Main.npcChatFocus2 = true; } else { if (Main.npcChatFocus2) SoundEngine.PlaySound(12); Main.npcChatFocus2 = false; } Microsoft.Xna.Framework.Color baseColor2 = !Main.npcChatFocus2 ? Microsoft.Xna.Framework.Color.Black : brown; ChatManager.DrawColorCodedStringShadow(Main.spriteBatch, font1, text1, minimum1 + stringSize1 * vector2_2 * 0.5f, baseColor2, 0.0f, stringSize1 * 0.5f, baseScale * vector2_2); ChatManager.DrawColorCodedString(Main.spriteBatch, font1, text1, minimum1 + stringSize1 * vector2_2 * 0.5f, baseColor1, 0.0f, stringSize1 * 0.5f, baseScale * vector2_2); if (text1.Length > 0) { UILinkPointNavigator.SetPosition(2500, minimum1 + stringSize1 * 0.5f); UILinkPointNavigator.Shortcuts.NPCCHAT_ButtonsLeft = true; } Vector2 vector2_3 = new Vector2((float) ((double) num1 + (double) stringSize1.X * (double) vector2_2.X + 30.0), y); string text2 = Lang.inter[52].Value; DynamicSpriteFont font2 = FontAssets.MouseText.Value; Vector2 minimum2 = vector2_3; baseScale = new Vector2(0.9f); Vector2 stringSize2 = ChatManager.GetStringSize(font2, text2, baseScale); baseColor1 = new Microsoft.Xna.Framework.Color(superColor, (int) ((double) superColor / 1.1), superColor / 2, superColor); vector2_2 = new Vector2(1f); if (vec.Between(minimum2, minimum2 + stringSize2 * baseScale * vector2_2.X) && !PlayerInput.IgnoreMouseInterface) { player.mouseInterface = true; player.releaseUseItem = false; baseScale *= num2; if (!Main.npcChatFocus1) SoundEngine.PlaySound(12); Main.npcChatFocus1 = true; } else { if (Main.npcChatFocus1) SoundEngine.PlaySound(12); Main.npcChatFocus1 = false; } Microsoft.Xna.Framework.Color baseColor3 = !Main.npcChatFocus1 ? Microsoft.Xna.Framework.Color.Black : brown; ChatManager.DrawColorCodedStringShadow(Main.spriteBatch, font2, text2, minimum2 + stringSize2 * vector2_2 * 0.5f, baseColor3, 0.0f, stringSize2 * 0.5f, baseScale * vector2_2); ChatManager.DrawColorCodedString(Main.spriteBatch, font2, text2, minimum2 + stringSize2 * vector2_2 * 0.5f, baseColor1, 0.0f, stringSize2 * 0.5f, baseScale * vector2_2); if (text2.Length > 0) { UILinkPointNavigator.SetPosition(2501, minimum2 + stringSize2 * 0.5f); UILinkPointNavigator.Shortcuts.NPCCHAT_ButtonsMiddle = true; } if (string.IsNullOrWhiteSpace(focusText3)) { Main.npcChatFocus3 = false; UILinkPointNavigator.Shortcuts.NPCCHAT_ButtonsRight = false; } else { Vector2 vector2_4 = new Vector2((float) ((double) vector2_3.X + (double) stringSize2.X * (double) vector2_2.X + 30.0), y); string text3 = focusText3; DynamicSpriteFont font3 = FontAssets.MouseText.Value; Vector2 minimum3 = vector2_4; baseScale = new Vector2(0.9f); stringSize2 = ChatManager.GetStringSize(font3, text3, baseScale); baseColor1 = chatColor; vector2_2 = new Vector2(1f); vector2_3.X = vector2_4.X; if (vec.Between(minimum3, minimum3 + stringSize2 * baseScale * vector2_2.X) && !PlayerInput.IgnoreMouseInterface) { player.mouseInterface = true; player.releaseUseItem = false; baseScale *= num2; if (!Main.npcChatFocus3) SoundEngine.PlaySound(12); Main.npcChatFocus3 = true; } else { if (Main.npcChatFocus3) SoundEngine.PlaySound(12); Main.npcChatFocus3 = false; } Microsoft.Xna.Framework.Color baseColor4 = !Main.npcChatFocus3 ? Microsoft.Xna.Framework.Color.Black : brown; ChatManager.DrawColorCodedStringShadow(Main.spriteBatch, font3, text3, minimum3 + stringSize2 * vector2_2 * 0.5f, baseColor4, 0.0f, stringSize2 * 0.5f, baseScale * vector2_2); ChatManager.DrawColorCodedString(Main.spriteBatch, font3, text3, minimum3 + stringSize2 * vector2_2 * 0.5f, baseColor1, 0.0f, stringSize2 * 0.5f, baseScale * vector2_2); UILinkPointNavigator.SetPosition(2502, minimum3 + stringSize2 * 0.5f); UILinkPointNavigator.Shortcuts.NPCCHAT_ButtonsRight = true; } if (Main.player[Main.myPlayer].currentShoppingSettings.HappinessReport == "") { Main.npcChatFocus4 = false; UILinkPointNavigator.Shortcuts.NPCCHAT_ButtonsRight2 = false; } else { string textValue = Language.GetTextValue("UI.NPCCheckHappiness"); Vector2 vector2_5 = new Vector2((float) ((double) vector2_3.X + (double) stringSize2.X * (double) vector2_2.X + 30.0), y); string text4 = textValue; DynamicSpriteFont font4 = FontAssets.MouseText.Value; Vector2 minimum4 = vector2_5; baseScale = new Vector2(0.9f); Vector2 stringSize3 = ChatManager.GetStringSize(font4, text4, baseScale); baseColor1 = new Microsoft.Xna.Framework.Color(superColor, (int) ((double) superColor / 1.1), superColor / 2, superColor); vector2_2 = new Vector2(1f); if (vec.Between(minimum4, minimum4 + stringSize3 * baseScale * vector2_2.X) && !PlayerInput.IgnoreMouseInterface) { player.mouseInterface = true; player.releaseUseItem = false; baseScale *= num2; if (!Main.npcChatFocus4) SoundEngine.PlaySound(12); Main.npcChatFocus4 = true; } else { if (Main.npcChatFocus4) SoundEngine.PlaySound(12); Main.npcChatFocus4 = false; } Microsoft.Xna.Framework.Color baseColor5 = !Main.npcChatFocus4 ? Microsoft.Xna.Framework.Color.Black : brown; ChatManager.DrawColorCodedStringShadow(Main.spriteBatch, font4, text4, minimum4 + stringSize3 * vector2_2 * 0.5f, baseColor5, 0.0f, stringSize3 * 0.5f, baseScale * vector2_2); ChatManager.DrawColorCodedString(Main.spriteBatch, font4, text4, minimum4 + stringSize3 * vector2_2 * 0.5f, baseColor1, 0.0f, stringSize3 * 0.5f, baseScale * vector2_2); UILinkPointNavigator.SetPosition(2503, minimum4 + stringSize3 * 0.5f); UILinkPointNavigator.Shortcuts.NPCCHAT_ButtonsRight2 = true; } } public static void CloseNPCChatOrSign() { Main.player[Main.myPlayer].sign = -1; Main.editSign = false; Main.player[Main.myPlayer].SetTalkNPC(-1); Main.npcChatCornerItem = 0; Main.npcChatText = ""; SoundEngine.PlaySound(11); Main.player[Main.myPlayer].releaseMount = false; } public static void SubmitSignText() { SoundEngine.PlaySound(12); int sign = Main.player[Main.myPlayer].sign; Sign.TextSign(sign, Main.npcChatText); Main.editSign = false; if (Main.netMode != 1) return; NetMessage.SendData(47, number: sign); } private int NPCBannerSorter(int npcIndex1, int npcIndex2) => -Main.npc[npcIndex1].housingCategory.CompareTo(Main.npc[npcIndex2].housingCategory); protected void DrawNPCHousesInWorld() { this._npcsWithBannersToDraw.Clear(); for (int index = 0; index < 200; ++index) { if (Main.npc[index].active && Main.npc[index].townNPC && !Main.npc[index].homeless && Main.npc[index].homeTileX > 0 && Main.npc[index].homeTileY > 0 && Main.npc[index].type != 37) this._npcsWithBannersToDraw.Add(index); } this._npcsWithBannersToDraw.Sort(new Comparison(this.NPCBannerSorter)); for (int index1 = 0; index1 < this._npcsWithBannersToDraw.Count; ++index1) { int n = this._npcsWithBannersToDraw[index1]; NPC npc = Main.npc[n]; if (npc.active && npc.townNPC && !npc.homeless && npc.homeTileX > 0 && npc.homeTileY > 0 && npc.type != 37) { int bannerStyle = 0; int housingCategory = npc.housingCategory; int homeTileX = npc.homeTileX; int index2 = npc.homeTileY - 1; WorldGen.TownManager.AddOccupantsToList(homeTileX, index2 + 1, this._occupantsListToDrawNPCHouses); if (this._occupantsListToDrawNPCHouses.Contains(npc.type)) bannerStyle = 1; int num1 = 0; for (int index3 = this._npcsWithBannersToDraw.Count - 1; index3 > index1; --index3) { int index4 = this._npcsWithBannersToDraw[index3]; if (Main.npc[index4].homeTileX == homeTileX && Main.npc[index4].homeTileY == index2 + 1) ++num1; } int num2 = num1 * 26; if (Main.tile[homeTileX, index2] != null) { bool flag = false; while (!Main.tile[homeTileX, index2].active() || !Main.tileSolid[(int) Main.tile[homeTileX, index2].type]) { --index2; if (index2 >= 10) { if (Main.tile[homeTileX, index2] == null) { flag = true; break; } } else break; } if (!flag) { int num3 = 8; int num4 = 18; if (Main.tile[homeTileX, index2].type == (ushort) 19) num4 -= 8; int y = index2 + 1; int num5 = 0; float num6 = (float) (y * 16) + (float) num2; SpriteEffects effects = SpriteEffects.None; Texture2D texture2D = TextureAssets.HouseBanner.Value; Microsoft.Xna.Framework.Rectangle rectangle = texture2D.Frame(2, 2); if (bannerStyle > 0) rectangle.X += rectangle.Width * bannerStyle; if (housingCategory > 0) rectangle.Y += rectangle.Height * housingCategory; if ((double) Main.player[Main.myPlayer].gravDir == -1.0) { float num7 = num6 - Main.screenPosition.Y; num6 = Main.screenPosition.Y + (float) Main.screenHeight - num7 - (float) rectangle.Height; effects = SpriteEffects.FlipVertically; num5 = 4; } Main.spriteBatch.Draw(texture2D, new Vector2((float) (homeTileX * 16 - (int) Main.screenPosition.X + num3), num6 - (float) (int) Main.screenPosition.Y + (float) num4 + (float) num5), new Microsoft.Xna.Framework.Rectangle?(rectangle), Lighting.GetColor(homeTileX, y), 0.0f, new Vector2((float) (rectangle.Width / 2), (float) (rectangle.Height / 2)), 1f, effects, 0.0f); ITownNPCProfile profile; int index5 = !TownNPCProfiles.Instance.GetProfile(npc.type, out profile) ? NPC.TypeToDefaultHeadIndex(npc.type) : profile.GetHeadTextureIndex(npc); float scale = 1f; float num8 = TextureAssets.NpcHead[index5].Width() <= TextureAssets.NpcHead[index5].Height() ? (float) TextureAssets.NpcHead[index5].Height() : (float) TextureAssets.NpcHead[index5].Width(); if ((double) num8 > 24.0) scale = 24f / num8; Main.spriteBatch.Draw(TextureAssets.NpcHead[index5].Value, new Vector2((float) (homeTileX * 16 - (int) Main.screenPosition.X + num3), (float) ((double) num6 - (double) (int) Main.screenPosition.Y + (double) num4 + 2.0)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.NpcHead[index5].Width(), TextureAssets.NpcHead[index5].Height())), Lighting.GetColor(homeTileX, y), 0.0f, new Vector2((float) (TextureAssets.NpcHead[index5].Width() / 2), (float) (TextureAssets.NpcHead[index5].Height() / 2)), scale, effects, 0.0f); int num9 = homeTileX * 16 - (int) Main.screenPosition.X + num3 - rectangle.Width / 2; int num10 = (int) num6 - (int) Main.screenPosition.Y + 4; int num11 = -8; if (Main.mouseX >= num9 && Main.mouseX <= num9 + rectangle.Width && Main.mouseY >= num10 && Main.mouseY <= num10 + rectangle.Height + num11) { this.MouseText(Lang.GetNPCHouseBannerText(npc, bannerStyle)); if (Main.mouseRightRelease && Main.mouseRight) { Main.mouseRightRelease = false; WorldGen.kickOut(n); SoundEngine.PlaySound(12); } } } } } } } public void DrawWindowsIMEPanel(Vector2 position, float xAnchor = 0.0f) { if (!Platform.Get().IsCandidateListVisible) return; List stringList = new List(); for (uint index = 0; index < Platform.Get().CandidateCount; ++index) { string candidate = Platform.Get().GetCandidate(index); stringList.Add(candidate); } if (stringList.Count == 0) return; uint selectedCandidate = Platform.Get().SelectedCandidate; DynamicSpriteFont dynamicSpriteFont = FontAssets.MouseText.Value; float scale = 0.85f; float num1 = 14f; float num2 = 0.0f; int num3 = 32; float width = num2 + num1; string str1 = "{0,2}: {1}"; string str2 = " "; for (int index = 0; index < stringList.Count; ++index) { int num4 = index + 1; string format = str1; if (index < stringList.Count - 1) format += str2; width = width + dynamicSpriteFont.MeasureString(string.Format(format, (object) num4, (object) stringList[index])).X * scale + num1; } Vector2 vector2_1 = new Vector2(width * -xAnchor, 0.0f); Utils.DrawSettings2Panel(Main.spriteBatch, position + vector2_1 + new Vector2(0.0f, (float) -num3), width, new Microsoft.Xna.Framework.Color(63, 65, 151, (int) byte.MaxValue) * 0.785f); Vector2 pos = position + new Vector2(10f, (float) (-num3 / 2)) + vector2_1; for (uint index = 0; (long) index < (long) stringList.Count; ++index) { Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.Gray; if ((int) index == (int) selectedCandidate) color = Microsoft.Xna.Framework.Color.White; uint num5 = index + 1U; string format = str1; if ((long) index < (long) (stringList.Count - 1)) format += str2; string text = string.Format(format, (object) num5, (object) stringList[(int) index]); Vector2 vector2_2 = dynamicSpriteFont.MeasureString(text) * scale; Utils.DrawBorderString(Main.spriteBatch, text, pos, color, scale, anchory: 0.4f); pos.X += vector2_2.X + num1; } } public void HandleIME() { if (this._imeToggle == PlayerInput.WritingText) return; this._imeToggle = PlayerInput.WritingText; if (this._imeToggle) Platform.Get().Enable(); else Platform.Get().Disable(); } protected void DrawPlayerChat() { TextSnippet[] snippets = (TextSnippet[]) null; if (Main.drawingPlayerChat) PlayerInput.WritingText = true; this.HandleIME(); if (Main.drawingPlayerChat) { ++this.textBlinkerCount; if (this.textBlinkerCount >= 20) { this.textBlinkerState = this.textBlinkerState != 0 ? 0 : 1; this.textBlinkerCount = 0; } string chatText = Main.chatText; if (Main.screenWidth > 800) { int num1 = Main.screenWidth - 300; int num2 = 78; Main.spriteBatch.Draw(TextureAssets.TextBack.Value, new Vector2((float) num2, (float) (Main.screenHeight - 36)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.TextBack.Width() - 100, TextureAssets.TextBack.Height())), new Microsoft.Xna.Framework.Color(100, 100, 100, 100), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); int num3 = num1 - 400; int num4 = num2 + 400; while (num3 > 0) { if (num3 > 300) { Main.spriteBatch.Draw(TextureAssets.TextBack.Value, new Vector2((float) num4, (float) (Main.screenHeight - 36)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(100, 0, TextureAssets.TextBack.Width() - 200, TextureAssets.TextBack.Height())), new Microsoft.Xna.Framework.Color(100, 100, 100, 100), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); num3 -= 300; num4 += 300; } else { Main.spriteBatch.Draw(TextureAssets.TextBack.Value, new Vector2((float) num4, (float) (Main.screenHeight - 36)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(TextureAssets.TextBack.Width() - num3, 0, TextureAssets.TextBack.Width() - (TextureAssets.TextBack.Width() - num3), TextureAssets.TextBack.Height())), new Microsoft.Xna.Framework.Color(100, 100, 100, 100), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); num3 = 0; } } } else Main.spriteBatch.Draw(TextureAssets.TextBack.Value, new Vector2(78f, (float) (Main.screenHeight - 36)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.TextBack.Width(), TextureAssets.TextBack.Height())), new Microsoft.Xna.Framework.Color(100, 100, 100, 100), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); int hoveredSnippet = -1; List message = ChatManager.ParseMessage(chatText, Microsoft.Xna.Framework.Color.White); string compositionString = Platform.Get().CompositionString; if (compositionString != null && compositionString.Length > 0) message.Add(new TextSnippet(compositionString, new Microsoft.Xna.Framework.Color((int) byte.MaxValue, 240, 20))); if (this.textBlinkerState == 1) message.Add(new TextSnippet("|", Microsoft.Xna.Framework.Color.White)); snippets = message.ToArray(); ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, FontAssets.MouseText.Value, snippets, new Vector2(88f, (float) (Main.screenHeight - 30)), 0.0f, Vector2.Zero, Vector2.One, out hoveredSnippet); if (hoveredSnippet > -1) { snippets[hoveredSnippet].OnHover(); if (Main.mouseLeft && Main.mouseLeftRelease) snippets[hoveredSnippet].OnClick(); } } Main.chatMonitor.DrawChat(Main.drawingPlayerChat); if (Main.drawingPlayerChat && snippets != null) { Vector2 stringSize = ChatManager.GetStringSize(FontAssets.MouseText.Value, snippets, Vector2.Zero); this.DrawWindowsIMEPanel(new Vector2(88f, (float) (Main.screenHeight - 30)) + new Vector2(stringSize.X + 10f, -6f)); } TimeLogger.DetailedDrawTime(10); } public static bool ShouldPVPDraw => Main.netMode == 1; protected void DrawInventory() { Recipe.GetThroughDelayedFindRecipes(); if (Main.ShouldPVPDraw) Main.DrawPVPIcons(); int pivotTopLeftX = 0; int pivotTopLeftY = 0; int screenWidth1 = Main.screenWidth; int num1 = 0; int screenWidth2 = Main.screenWidth; int num2 = 0; Vector2 vector2_1 = new Vector2((float) pivotTopLeftX, (float) pivotTopLeftY); Vector2 vector2_2 = new Vector2((float) screenWidth1, (float) num1); Vector2 vector2_3 = new Vector2((float) screenWidth2, (float) num2); Main.DrawBestiaryIcon(pivotTopLeftX, pivotTopLeftY); Main.DrawEmoteBubblesButton(pivotTopLeftX, pivotTopLeftY); Main.DrawTrashItemSlot(pivotTopLeftX, pivotTopLeftY); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, Lang.inter[4].Value, new Vector2(40f, 0.0f) + vector2_1, new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); Main.inventoryScale = 0.85f; if (Main.mouseX > 20 && Main.mouseX < (int) (20.0 + 560.0 * (double) Main.inventoryScale) && Main.mouseY > 20 && Main.mouseY < (int) (20.0 + 280.0 * (double) Main.inventoryScale) && !PlayerInput.IgnoreMouseInterface) Main.player[Main.myPlayer].mouseInterface = true; for (int index1 = 0; index1 < 10; ++index1) { for (int index2 = 0; index2 < 5; ++index2) { int num3 = (int) (20.0 + (double) (index1 * 56) * (double) Main.inventoryScale) + pivotTopLeftX; int num4 = (int) (20.0 + (double) (index2 * 56) * (double) Main.inventoryScale) + pivotTopLeftY; int slot = index1 + index2 * 10; Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(100, 100, 100, 100); if (Main.mouseX >= num3 && (double) Main.mouseX <= (double) num3 + (double) TextureAssets.InventoryBack.Width() * (double) Main.inventoryScale && Main.mouseY >= num4 && (double) Main.mouseY <= (double) num4 + (double) TextureAssets.InventoryBack.Height() * (double) Main.inventoryScale && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; ItemSlot.OverrideHover(Main.player[Main.myPlayer].inventory, slot: slot); if (Main.player[Main.myPlayer].inventoryChestStack[slot] && (Main.player[Main.myPlayer].inventory[slot].type == 0 || Main.player[Main.myPlayer].inventory[slot].stack == 0)) Main.player[Main.myPlayer].inventoryChestStack[slot] = false; if (!Main.player[Main.myPlayer].inventoryChestStack[slot]) { ItemSlot.LeftClick(Main.player[Main.myPlayer].inventory, slot: slot); ItemSlot.RightClick(Main.player[Main.myPlayer].inventory, slot: slot); if (Main.mouseLeftRelease && Main.mouseLeft) Recipe.FindRecipes(); } ItemSlot.MouseHover(Main.player[Main.myPlayer].inventory, slot: slot); } ItemSlot.Draw(Main.spriteBatch, Main.player[Main.myPlayer].inventory, 0, slot, new Vector2((float) num3, (float) num4)); } } int totalDrawnIcons; Main.GetBuilderAccsCountToShow(Main.LocalPlayer, out int _, out int _, out totalDrawnIcons); bool pushSideToolsUp = totalDrawnIcons >= 10; if (!PlayerInput.UsingGamepad) this.DrawHotbarLockIcon(pivotTopLeftX, pivotTopLeftY, pushSideToolsUp); ItemSlot.DrawRadialDpad(Main.spriteBatch, new Vector2(20f) + new Vector2((float) (56.0 * (double) Main.inventoryScale * 10.0), (float) (56.0 * (double) Main.inventoryScale * 5.0)) + new Vector2(26f, 70f) + vector2_1); if (this._achievementAdvisor.CanDrawAboveCoins) { int num5 = (int) (20.0 + 560.0 * (double) Main.inventoryScale) + pivotTopLeftX; int num6 = (int) (20.0 + 0.0 * (double) Main.inventoryScale) + pivotTopLeftY; this._achievementAdvisor.DrawOneAchievement(Main.spriteBatch, new Vector2((float) num5, (float) num6) + new Vector2(5f), true); } if (Main.mapEnabled) { bool flag = false; int num7 = screenWidth1 - 440; int num8 = 40 + num1; if (Main.screenWidth < 940) flag = true; if (flag) { num7 = screenWidth2 - 40; num8 = num2 - 200; } int num9 = 0; for (int index3 = 0; index3 < 4; ++index3) { int num10 = num7 + index3 * 32 - num9; int num11 = num8; if (flag) { num10 = num7; num11 = num8 + index3 * 32 - num9; } int index4 = index3; int num12 = 120; if (index3 > 0 && Main.mapStyle == index3 - 1) num12 = 200; if (Main.mouseX >= num10 && Main.mouseX <= num10 + 32 && Main.mouseY >= num11 && Main.mouseY <= num11 + 30 && !PlayerInput.IgnoreMouseInterface) { num12 = (int) byte.MaxValue; index4 += 4; Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeft && Main.mouseLeftRelease) { if (index3 == 0) { Main.playerInventory = false; Main.player[Main.myPlayer].SetTalkNPC(-1); Main.npcChatCornerItem = 0; SoundEngine.PlaySound(10); Main.mapFullscreenScale = 2.5f; Main.mapFullscreen = true; Main.resetMapFull = true; } if (index3 == 1) { Main.mapStyle = 0; SoundEngine.PlaySound(12); } if (index3 == 2) { Main.mapStyle = 1; SoundEngine.PlaySound(12); } if (index3 == 3) { Main.mapStyle = 2; SoundEngine.PlaySound(12); } } } Main.spriteBatch.Draw(TextureAssets.MapIcon[index4].Value, new Vector2((float) num10, (float) num11), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.MapIcon[index4].Width(), TextureAssets.MapIcon[index4].Height())), new Microsoft.Xna.Framework.Color(num12, num12, num12, num12), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } } if (Main.armorHide) { Main.armorAlpha -= 0.1f; if ((double) Main.armorAlpha < 0.0) Main.armorAlpha = 0.0f; } else { Main.armorAlpha += 0.025f; if ((double) Main.armorAlpha > 1.0) Main.armorAlpha = 1f; } Microsoft.Xna.Framework.Color color1 = new Microsoft.Xna.Framework.Color((int) (byte) ((double) Main.mouseTextColor * (double) Main.armorAlpha), (int) (byte) ((double) Main.mouseTextColor * (double) Main.armorAlpha), (int) (byte) ((double) Main.mouseTextColor * (double) Main.armorAlpha), (int) (byte) ((double) Main.mouseTextColor * (double) Main.armorAlpha)); Main.armorHide = false; int num13 = 8 + Main.player[Main.myPlayer].GetAmountOfExtraAccessorySlotsToShow(); int num14 = 174 + Main.mH; int num15 = 950; Main._cannotDrawAccessoriesHorizontally = false; if (Main.screenHeight < num15 && num13 >= 10) { num14 -= (int) (56.0 * (double) Main.inventoryScale * (double) (num13 - 9)); Main._cannotDrawAccessoriesHorizontally = true; } int num16 = Main.DrawPageIcons(num14 - 32); if (num16 > -1) { Main.HoverItem = new Item(); switch (num16) { case 1: Main.hoverItemName = Lang.inter[80].Value; break; case 2: Main.hoverItemName = Lang.inter[79].Value; break; case 3: Main.hoverItemName = Main.CaptureModeDisabled ? Lang.inter[115].Value : Lang.inter[81].Value; break; } } switch (Main.EquipPage) { case 1: this.DrawNPCHousesInUI(); break; case 2: Microsoft.Xna.Framework.Point point1 = new Microsoft.Xna.Framework.Point(Main.mouseX, Main.mouseY); Microsoft.Xna.Framework.Rectangle r1 = new Microsoft.Xna.Framework.Rectangle(0, 0, (int) ((double) TextureAssets.InventoryBack.Width() * (double) Main.inventoryScale), (int) ((double) TextureAssets.InventoryBack.Height() * (double) Main.inventoryScale)); Item[] inv = Main.player[Main.myPlayer].miscEquips; int num17 = Main.screenWidth - 92; int num18 = Main.mH + 174; for (int index = 0; index < 2; ++index) { if (index == 0) inv = Main.player[Main.myPlayer].miscEquips; else if (index == 1) inv = Main.player[Main.myPlayer].miscDyes; r1.X = num17 + index * -47; for (int slot = 0; slot < 5; ++slot) { int context = 0; int key = -1; switch (slot) { case 0: context = 19; key = 0; break; case 1: context = 20; key = 1; break; case 2: context = 18; break; case 3: context = 17; break; case 4: context = 16; break; } if (index == 1) { context = 12; key = -1; } r1.Y = num18 + slot * 47; Texture2D texture = TextureAssets.InventoryTickOn.Value; if (Main.player[Main.myPlayer].hideMisc[key]) texture = TextureAssets.InventoryTickOff.Value; Microsoft.Xna.Framework.Rectangle r2 = new Microsoft.Xna.Framework.Rectangle(r1.Left + 34, r1.Top - 2, texture.Width, texture.Height); int num19 = 0; bool flag = false; if (r2.Contains(point1) && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; flag = true; if (Main.mouseLeft && Main.mouseLeftRelease) { if (key == 0) Main.player[Main.myPlayer].TogglePet(); if (key == 1) Main.player[Main.myPlayer].ToggleLight(); Main.mouseLeftRelease = false; SoundEngine.PlaySound(12); if (Main.netMode == 1) NetMessage.SendData(4, number: Main.myPlayer); } num19 = !Main.player[Main.myPlayer].hideMisc[key] ? 1 : 2; } if (r1.Contains(point1) && !flag && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; Main.armorHide = true; ItemSlot.Handle(inv, context, slot); } ItemSlot.Draw(Main.spriteBatch, inv, context, slot, r1.TopLeft()); if (key != -1) { Main.spriteBatch.Draw(texture, r2.TopLeft(), Microsoft.Xna.Framework.Color.White * 0.7f); if (num19 > 0) { Main.HoverItem = new Item(); Main.hoverItemName = Lang.inter[58 + num19].Value; } } } } int num20 = num18 + 247; int num21 = num17 + 8; int drawBuffText = -1; int num22 = 0; int num23 = 3; int num24 = 260; if (Main.screenHeight > 630 + num24 * (Main.mapStyle == 1).ToInt()) ++num23; if (Main.screenHeight > 680 + num24 * (Main.mapStyle == 1).ToInt()) ++num23; if (Main.screenHeight > 730 + num24 * (Main.mapStyle == 1).ToInt()) ++num23; int num25 = 46; for (int buffSlotOnPlayer = 0; buffSlotOnPlayer < 22; ++buffSlotOnPlayer) { if (Main.player[Main.myPlayer].buffType[buffSlotOnPlayer] != 0) { int num26 = num22 / num23; int num27 = num22 % num23; Microsoft.Xna.Framework.Point point2 = new Microsoft.Xna.Framework.Point(num21 + num26 * -num25, num20 + num27 * num25); drawBuffText = Main.DrawBuffIcon(drawBuffText, buffSlotOnPlayer, point2.X, point2.Y); UILinkPointNavigator.SetPosition(9000 + num22, new Vector2((float) (point2.X + 30), (float) (point2.Y + 30))); ++num22; if ((double) Main.buffAlpha[buffSlotOnPlayer] < 0.649999976158142) Main.buffAlpha[buffSlotOnPlayer] = 0.65f; } } UILinkPointNavigator.Shortcuts.BUFFS_DRAWN = num22; UILinkPointNavigator.Shortcuts.BUFFS_PER_COLUMN = num23; if (drawBuffText >= 0) { int index = Main.player[Main.myPlayer].buffType[drawBuffText]; if (index > 0) { string buffName = Lang.GetBuffName(index); string buffTooltip = Main.GetBuffTooltip(Main.player[Main.myPlayer], index); if (index == 147) Main.bannerMouseOver = true; if (Main.meleeBuff[index]) { this.MouseTextHackZoom(buffName, -10, buffTooltip: buffTooltip); break; } this.MouseTextHackZoom(buffName, buffTooltip); break; } break; } break; default: int num28 = 4; if (Main.mouseX > Main.screenWidth - 64 - 28 && Main.mouseX < (int) ((double) (Main.screenWidth - 64 - 28) + 56.0 * (double) Main.inventoryScale) && Main.mouseY > num14 && Main.mouseY < (int) ((double) num14 + 448.0 * (double) Main.inventoryScale) && !PlayerInput.IgnoreMouseInterface) Main.player[Main.myPlayer].mouseInterface = true; float inventoryScale = Main.inventoryScale; bool flag1 = false; int num29 = num13 - 1; bool flag2 = Main.LocalPlayer.CanDemonHeartAccessoryBeShown(); bool flag3 = Main.LocalPlayer.CanMasterModeAccessoryBeShown(); if (Main._settingsButtonIsPushedToSide) --num29; int num30 = num29 - 1; Microsoft.Xna.Framework.Color inventoryBack1 = Main.inventoryBack; Microsoft.Xna.Framework.Color color2 = new Microsoft.Xna.Framework.Color(80, 80, 80, 80); int num31 = -1; for (int slot = 0; slot < 10; ++slot) { if ((slot != 8 || flag2) && (slot != 9 || flag3)) { ++num31; bool flag4 = Main.LocalPlayer.IsAValidEquipmentSlotForIteration(slot); if (!flag4) flag1 = true; int inventoryX = Main.screenWidth - 64 - 28; int inventoryY = (int) ((double) num14 + (double) (num31 * 56) * (double) Main.inventoryScale); Microsoft.Xna.Framework.Color color3 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100); int x = Main.screenWidth - 58; int y = (int) ((double) (num14 - 2) + (double) (num31 * 56) * (double) Main.inventoryScale); int context = 8; if (slot > 2) { inventoryY += num28; y += num28; context = 10; } if (num31 == num30 && !this._achievementAdvisor.CanDrawAboveCoins) { this._achievementAdvisor.DrawOneAchievement(Main.spriteBatch, new Vector2((float) (inventoryX - 10 - 47 - 47 - 14 - 14), (float) (inventoryY + 8)), false); UILinkPointNavigator.SetPosition(1570, new Vector2((float) (inventoryX - 10 - 47 - 47 - 14 - 14), (float) (inventoryY + 8)) + new Vector2(20f) * Main.inventoryScale); } if (num31 == num29) Main.DrawDefenseCounter(inventoryX, inventoryY); Texture2D texture = TextureAssets.InventoryTickOn.Value; if (Main.player[Main.myPlayer].hideVisibleAccessory[slot]) texture = TextureAssets.InventoryTickOff.Value; Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(x, y, texture.Width, texture.Height); int num32 = 0; if (slot > 2 && rectangle.Contains(new Microsoft.Xna.Framework.Point(Main.mouseX, Main.mouseY)) && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeft && Main.mouseLeftRelease) { Main.player[Main.myPlayer].hideVisibleAccessory[slot] = !Main.player[Main.myPlayer].hideVisibleAccessory[slot]; SoundEngine.PlaySound(12); if (Main.netMode == 1) NetMessage.SendData(4, number: Main.myPlayer); } num32 = !Main.player[Main.myPlayer].hideVisibleAccessory[slot] ? 1 : 2; } else if (Main.mouseX >= inventoryX && (double) Main.mouseX <= (double) inventoryX + (double) TextureAssets.InventoryBack.Width() * (double) Main.inventoryScale && Main.mouseY >= inventoryY && (double) Main.mouseY <= (double) inventoryY + (double) TextureAssets.InventoryBack.Height() * (double) Main.inventoryScale && !PlayerInput.IgnoreMouseInterface) { Main.armorHide = true; Main.player[Main.myPlayer].mouseInterface = true; ItemSlot.OverrideHover(Main.player[Main.myPlayer].armor, context, slot); if ((flag4 ? 0 : (!Main.mouseItem.IsAir ? 1 : 0)) == 0) ItemSlot.LeftClick(Main.player[Main.myPlayer].armor, context, slot); ItemSlot.MouseHover(Main.player[Main.myPlayer].armor, context, slot); } if (flag1) Main.inventoryBack = color2; ItemSlot.Draw(Main.spriteBatch, Main.player[Main.myPlayer].armor, context, slot, new Vector2((float) inventoryX, (float) inventoryY)); if (slot > 2) { Main.spriteBatch.Draw(texture, new Vector2((float) x, (float) y), Microsoft.Xna.Framework.Color.White * 0.7f); if (num32 > 0) { Main.HoverItem = new Item(); Main.hoverItemName = Lang.inter[58 + num32].Value; } } } } Main.inventoryBack = inventoryBack1; if (Main.mouseX > Main.screenWidth - 64 - 28 - 47 && Main.mouseX < (int) ((double) (Main.screenWidth - 64 - 20 - 47) + 56.0 * (double) Main.inventoryScale) && Main.mouseY > num14 && Main.mouseY < (int) ((double) num14 + 168.0 * (double) Main.inventoryScale) && !PlayerInput.IgnoreMouseInterface) Main.player[Main.myPlayer].mouseInterface = true; int num33 = -1; for (int slot = 10; slot < 20; ++slot) { if ((slot != 18 || flag2) && (slot != 19 || flag3)) { ++num33; int num34 = Main.LocalPlayer.IsAValidEquipmentSlotForIteration(slot) ? 1 : 0; bool flag5 = num34 == 0; bool flag6 = num34 == 0 && !Main.mouseItem.IsAir; int num35 = Main.screenWidth - 64 - 28 - 47; int num36 = (int) ((double) num14 + (double) (num33 * 56) * (double) Main.inventoryScale); Microsoft.Xna.Framework.Color color4 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100); if (slot > 12) num36 += num28; int context = 9; if (slot > 12) context = 11; if (Main.mouseX >= num35 && (double) Main.mouseX <= (double) num35 + (double) TextureAssets.InventoryBack.Width() * (double) Main.inventoryScale && Main.mouseY >= num36 && (double) Main.mouseY <= (double) num36 + (double) TextureAssets.InventoryBack.Height() * (double) Main.inventoryScale && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; Main.armorHide = true; ItemSlot.OverrideHover(Main.player[Main.myPlayer].armor, context, slot); if (!flag6) { ItemSlot.LeftClick(Main.player[Main.myPlayer].armor, context, slot); ItemSlot.RightClick(Main.player[Main.myPlayer].armor, context, slot); } ItemSlot.MouseHover(Main.player[Main.myPlayer].armor, context, slot); } if (flag5) Main.inventoryBack = color2; ItemSlot.Draw(Main.spriteBatch, Main.player[Main.myPlayer].armor, context, slot, new Vector2((float) num35, (float) num36)); } } Main.inventoryBack = inventoryBack1; if (Main.mouseX > Main.screenWidth - 64 - 28 - 47 && Main.mouseX < (int) ((double) (Main.screenWidth - 64 - 20 - 47) + 56.0 * (double) Main.inventoryScale) && Main.mouseY > num14 && Main.mouseY < (int) ((double) num14 + 168.0 * (double) Main.inventoryScale) && !PlayerInput.IgnoreMouseInterface) Main.player[Main.myPlayer].mouseInterface = true; int num37 = -1; for (int slot = 0; slot < 10; ++slot) { if ((slot != 8 || flag2) && (slot != 9 || flag3)) { ++num37; int num38 = Main.LocalPlayer.IsAValidEquipmentSlotForIteration(slot) ? 1 : 0; bool flag7 = num38 == 0; bool flag8 = num38 == 0 && !Main.mouseItem.IsAir; int num39 = Main.screenWidth - 64 - 28 - 47 - 47; int num40 = (int) ((double) num14 + (double) (num37 * 56) * (double) Main.inventoryScale); Microsoft.Xna.Framework.Color color5 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100); if (slot > 2) num40 += num28; if (Main.mouseX >= num39 && (double) Main.mouseX <= (double) num39 + (double) TextureAssets.InventoryBack.Width() * (double) Main.inventoryScale && Main.mouseY >= num40 && (double) Main.mouseY <= (double) num40 + (double) TextureAssets.InventoryBack.Height() * (double) Main.inventoryScale && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; Main.armorHide = true; ItemSlot.OverrideHover(Main.player[Main.myPlayer].dye, 12, slot); if (!flag8) { if (Main.mouseRightRelease && Main.mouseRight) ItemSlot.RightClick(Main.player[Main.myPlayer].dye, 12, slot); ItemSlot.LeftClick(Main.player[Main.myPlayer].dye, 12, slot); } ItemSlot.MouseHover(Main.player[Main.myPlayer].dye, 12, slot); } if (flag7) Main.inventoryBack = color2; ItemSlot.Draw(Main.spriteBatch, Main.player[Main.myPlayer].dye, 12, slot, new Vector2((float) num39, (float) num40)); } } Main.inventoryBack = inventoryBack1; Main.inventoryScale = inventoryScale; break; } int adjY = (Main.screenHeight - 600) / 2; int num41 = (int) ((double) Main.screenHeight / 600.0 * 250.0); if (Main.screenHeight < 700) { adjY = (Main.screenHeight - 508) / 2; num41 = (int) ((double) Main.screenHeight / 600.0 * 200.0); } else if (Main.screenHeight < 850) num41 = (int) ((double) Main.screenHeight / 600.0 * 225.0); if (Main.craftingHide) { Main.craftingAlpha -= 0.1f; if ((double) Main.craftingAlpha < 0.0) Main.craftingAlpha = 0.0f; } else { Main.craftingAlpha += 0.025f; if ((double) Main.craftingAlpha > 1.0) Main.craftingAlpha = 1f; } Microsoft.Xna.Framework.Color craftingTipColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) Main.mouseTextColor * (double) Main.craftingAlpha), (int) (byte) ((double) Main.mouseTextColor * (double) Main.craftingAlpha), (int) (byte) ((double) Main.mouseTextColor * (double) Main.craftingAlpha), (int) (byte) ((double) Main.mouseTextColor * (double) Main.craftingAlpha)); Main.craftingHide = false; if (Main.InReforgeMenu) { if (Main.mouseReforge) { if ((double) Main.reforgeScale < 1.0) Main.reforgeScale += 0.02f; } else if ((double) Main.reforgeScale > 1.0) Main.reforgeScale -= 0.02f; if (Main.player[Main.myPlayer].chest != -1 || Main.npcShop != 0 || Main.player[Main.myPlayer].talkNPC == -1 || Main.InGuideCraftMenu) { Main.InReforgeMenu = false; Main.player[Main.myPlayer].dropItemCheck(); Recipe.FindRecipes(); } else { int num42 = 50; int num43 = 270; string text1 = Lang.inter[46].Value + ": "; if (Main.reforgeItem.type > 0) { int num44 = Main.reforgeItem.value; if (Main.player[Main.myPlayer].discount) num44 = (int) ((double) num44 * 0.8); int price = (int) ((double) num44 * Main.player[Main.myPlayer].currentShoppingSettings.PriceAdjustment) / 3; string text2 = ""; int num45 = 0; int num46 = 0; int num47 = 0; int num48 = 0; int num49 = price; if (num49 < 1) num49 = 1; if (num49 >= 1000000) { num45 = num49 / 1000000; num49 -= num45 * 1000000; } if (num49 >= 10000) { num46 = num49 / 10000; num49 -= num46 * 10000; } if (num49 >= 100) { num47 = num49 / 100; num49 -= num47 * 100; } if (num49 >= 1) num48 = num49; if (num45 > 0) text2 = text2 + "[c/" + Colors.AlphaDarken(Colors.CoinPlatinum).Hex3() + ":" + (object) num45 + " " + Lang.inter[15].Value + "] "; if (num46 > 0) text2 = text2 + "[c/" + Colors.AlphaDarken(Colors.CoinGold).Hex3() + ":" + (object) num46 + " " + Lang.inter[16].Value + "] "; if (num47 > 0) text2 = text2 + "[c/" + Colors.AlphaDarken(Colors.CoinSilver).Hex3() + ":" + (object) num47 + " " + Lang.inter[17].Value + "] "; if (num48 > 0) text2 = text2 + "[c/" + Colors.AlphaDarken(Colors.CoinCopper).Hex3() + ":" + (object) num48 + " " + Lang.inter[18].Value + "] "; ItemSlot.DrawSavings(Main.spriteBatch, (float) (num42 + 130), (float) this.invBottom, true); ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, FontAssets.MouseText.Value, text2, new Vector2((float) (num42 + 50) + FontAssets.MouseText.Value.MeasureString(text1).X, (float) num43), Microsoft.Xna.Framework.Color.White, 0.0f, Vector2.Zero, Vector2.One); int num50 = num42 + 70; int num51 = num43 + 40; int num52 = Main.mouseX <= num50 - 15 || Main.mouseX >= num50 + 15 || Main.mouseY <= num51 - 15 || Main.mouseY >= num51 + 15 ? 0 : (!PlayerInput.IgnoreMouseInterface ? 1 : 0); Texture2D texture2D = TextureAssets.Reforge[0].Value; if (num52 != 0) texture2D = TextureAssets.Reforge[1].Value; Main.spriteBatch.Draw(texture2D, new Vector2((float) num50, (float) num51), new Microsoft.Xna.Framework.Rectangle?(), Microsoft.Xna.Framework.Color.White, 0.0f, texture2D.Size() / 2f, Main.reforgeScale, SpriteEffects.None, 0.0f); UILinkPointNavigator.SetPosition(304, new Vector2((float) num50, (float) num51) + texture2D.Size() / 4f); if (num52 != 0) { Main.hoverItemName = Lang.inter[19].Value; if (!Main.mouseReforge) SoundEngine.PlaySound(12); Main.mouseReforge = true; Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft && Main.player[Main.myPlayer].BuyItem(price)) { bool favorited = Main.reforgeItem.favorited; Main.reforgeItem.netDefaults(Main.reforgeItem.netID); Main.reforgeItem.Prefix(-2); Main.reforgeItem.position.X = Main.player[Main.myPlayer].position.X + (float) (Main.player[Main.myPlayer].width / 2) - (float) (Main.reforgeItem.width / 2); Main.reforgeItem.position.Y = Main.player[Main.myPlayer].position.Y + (float) (Main.player[Main.myPlayer].height / 2) - (float) (Main.reforgeItem.height / 2); Main.reforgeItem.favorited = favorited; PopupText.NewText(PopupTextContext.ItemReforge, Main.reforgeItem, Main.reforgeItem.stack, true); SoundEngine.PlaySound(SoundID.Item37); } } else Main.mouseReforge = false; } else text1 = Lang.inter[20].Value; ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, FontAssets.MouseText.Value, text1, new Vector2((float) (num42 + 50), (float) num43), new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor), 0.0f, Vector2.Zero, Vector2.One); if (Main.mouseX >= num42 && (double) Main.mouseX <= (double) num42 + (double) TextureAssets.InventoryBack.Width() * (double) Main.inventoryScale && Main.mouseY >= num43 && (double) Main.mouseY <= (double) num43 + (double) TextureAssets.InventoryBack.Height() * (double) Main.inventoryScale && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; Main.craftingHide = true; ItemSlot.LeftClick(ref Main.reforgeItem, 5); if (Main.mouseLeftRelease && Main.mouseLeft) Recipe.FindRecipes(); ItemSlot.RightClick(ref Main.reforgeItem, 5); ItemSlot.MouseHover(ref Main.reforgeItem, 5); } ItemSlot.Draw(Main.spriteBatch, ref Main.reforgeItem, 5, new Vector2((float) num42, (float) num43)); } } else if (Main.InGuideCraftMenu) { if (Main.player[Main.myPlayer].chest != -1 || Main.npcShop != 0 || Main.player[Main.myPlayer].talkNPC == -1 || Main.InReforgeMenu) { Main.InGuideCraftMenu = false; Main.player[Main.myPlayer].dropItemCheck(); Recipe.FindRecipes(); } else { int inventoryX; int inventoryY; Main.DrawGuideCraftText(adjY, craftingTipColor, out inventoryX, out inventoryY); Microsoft.Xna.Framework.Color color6 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100); if (Main.mouseX >= inventoryX && (double) Main.mouseX <= (double) inventoryX + (double) TextureAssets.InventoryBack.Width() * (double) Main.inventoryScale && Main.mouseY >= inventoryY && (double) Main.mouseY <= (double) inventoryY + (double) TextureAssets.InventoryBack.Height() * (double) Main.inventoryScale && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; Main.craftingHide = true; ItemSlot.OverrideHover(ref Main.guideItem, 7); ItemSlot.LeftClick(ref Main.guideItem, 7); if (Main.mouseLeftRelease && Main.mouseLeft) Recipe.FindRecipes(); ItemSlot.RightClick(ref Main.guideItem, 7); ItemSlot.MouseHover(ref Main.guideItem, 7); } ItemSlot.Draw(Main.spriteBatch, ref Main.guideItem, 7, new Vector2((float) inventoryX, (float) inventoryY)); } } Main.CreativeMenu.Draw(Main.spriteBatch); bool flag9 = Main.CreativeMenu.Enabled && !Main.CreativeMenu.Blocked; if (!Main.InReforgeMenu && !Main.LocalPlayer.tileEntityAnchor.InUse && !flag9) { UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeBig = -1; UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeSmall = -1; if (Main.numAvailableRecipes > 0) DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, Lang.inter[25].Value, new Vector2(76f, (float) (414 + adjY)), craftingTipColor, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); for (int recipeIndex = 0; recipeIndex < Recipe.maxRecipes; ++recipeIndex) { Main.inventoryScale = (float) (100.0 / ((double) Math.Abs(Main.availableRecipeY[recipeIndex]) + 100.0)); if ((double) Main.inventoryScale < 0.75) Main.inventoryScale = 0.75f; if (Main.recFastScroll) Main.inventoryScale = 0.75f; if ((double) Main.availableRecipeY[recipeIndex] < (double) ((recipeIndex - Main.focusRecipe) * 65)) { if ((double) Main.availableRecipeY[recipeIndex] == 0.0 && !Main.recFastScroll) SoundEngine.PlaySound(12); Main.availableRecipeY[recipeIndex] += 6.5f; if (Main.recFastScroll) Main.availableRecipeY[recipeIndex] += 130000f; if ((double) Main.availableRecipeY[recipeIndex] > (double) ((recipeIndex - Main.focusRecipe) * 65)) Main.availableRecipeY[recipeIndex] = (float) ((recipeIndex - Main.focusRecipe) * 65); } else if ((double) Main.availableRecipeY[recipeIndex] > (double) ((recipeIndex - Main.focusRecipe) * 65)) { if ((double) Main.availableRecipeY[recipeIndex] == 0.0 && !Main.recFastScroll) SoundEngine.PlaySound(12); Main.availableRecipeY[recipeIndex] -= 6.5f; if (Main.recFastScroll) Main.availableRecipeY[recipeIndex] -= 130000f; if ((double) Main.availableRecipeY[recipeIndex] < (double) ((recipeIndex - Main.focusRecipe) * 65)) Main.availableRecipeY[recipeIndex] = (float) ((recipeIndex - Main.focusRecipe) * 65); } else Main.recFastScroll = false; if (recipeIndex < Main.numAvailableRecipes && (double) Math.Abs(Main.availableRecipeY[recipeIndex]) <= (double) num41) { int num53 = (int) (46.0 - 26.0 * (double) Main.inventoryScale); int num54 = (int) (410.0 + (double) Main.availableRecipeY[recipeIndex] * (double) Main.inventoryScale - 30.0 * (double) Main.inventoryScale + (double) adjY); double num55 = (double) ((int) Main.inventoryBack.A + 50); double num56 = (double) byte.MaxValue; if ((double) Math.Abs(Main.availableRecipeY[recipeIndex]) > (double) num41 - 100.0) { num55 = 150.0 * (100.0 - ((double) Math.Abs(Main.availableRecipeY[recipeIndex]) - ((double) num41 - 100.0))) * 0.01; num56 = (double) byte.MaxValue * (100.0 - ((double) Math.Abs(Main.availableRecipeY[recipeIndex]) - ((double) num41 - 100.0))) * 0.01; } Microsoft.Xna.Framework.Color color7 = new Microsoft.Xna.Framework.Color((int) (byte) num55, (int) (byte) num55, (int) (byte) num55, (int) (byte) num55); Microsoft.Xna.Framework.Color lightColor = new Microsoft.Xna.Framework.Color((int) (byte) num56, (int) (byte) num56, (int) (byte) num56, (int) (byte) num56); if (!Main.LocalPlayer.creativeInterface && Main.mouseX >= num53 && (double) Main.mouseX <= (double) num53 + (double) TextureAssets.InventoryBack.Width() * (double) Main.inventoryScale && Main.mouseY >= num54 && (double) Main.mouseY <= (double) num54 + (double) TextureAssets.InventoryBack.Height() * (double) Main.inventoryScale && !PlayerInput.IgnoreMouseInterface) Main.HoverOverCraftingItemButton(recipeIndex); if (Main.numAvailableRecipes > 0) { double num57 = num55 - 50.0; if (num57 < 0.0) num57 = 0.0; if (recipeIndex == Main.focusRecipe) { UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeSmall = 0; if (!PlayerInput.UsingGamepad) ItemSlot.DrawGoldBGForCraftingMaterial = true; } else UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeSmall = -1; Microsoft.Xna.Framework.Color inventoryBack2 = Main.inventoryBack; Main.inventoryBack = new Microsoft.Xna.Framework.Color((int) (byte) num57, (int) (byte) num57, (int) (byte) num57, (int) (byte) num57); ItemSlot.Draw(Main.spriteBatch, ref Main.recipe[Main.availableRecipe[recipeIndex]].createItem, 22, new Vector2((float) num53, (float) num54), lightColor); Main.inventoryBack = inventoryBack2; } } } if (Main.numAvailableRecipes > 0) { UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeBig = -1; UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeSmall = -1; for (int i = 0; i < Recipe.maxRequirements; ++i) { if (Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[i].type == 0) { UILinkPointNavigator.Shortcuts.CRAFT_CurrentIngridientsCount = i + 1; break; } int num58 = 80 + i * 40; int num59 = 380 + adjY; double num60 = (double) ((int) Main.inventoryBack.A + 50); Microsoft.Xna.Framework.Color white1 = Microsoft.Xna.Framework.Color.White; Microsoft.Xna.Framework.Color white2 = Microsoft.Xna.Framework.Color.White; double num61 = (double) ((int) Main.inventoryBack.A + 50) - (double) Math.Abs(Main.availableRecipeY[Main.focusRecipe]) * 2.0; double num62 = (double) byte.MaxValue - (double) Math.Abs(Main.availableRecipeY[Main.focusRecipe]) * 2.0; if (num61 < 0.0) num61 = 0.0; if (num62 < 0.0) num62 = 0.0; white1.R = (byte) num61; white1.G = (byte) num61; white1.B = (byte) num61; white1.A = (byte) num61; white2.R = (byte) num62; white2.G = (byte) num62; white2.B = (byte) num62; white2.A = (byte) num62; Main.inventoryScale = 0.6f; if (num61 != 0.0) { if (Main.mouseX >= num58 && (double) Main.mouseX <= (double) num58 + (double) TextureAssets.InventoryBack.Width() * (double) Main.inventoryScale && Main.mouseY >= num59 && (double) Main.mouseY <= (double) num59 + (double) TextureAssets.InventoryBack.Height() * (double) Main.inventoryScale && !PlayerInput.IgnoreMouseInterface) { Main.craftingHide = true; Main.player[Main.myPlayer].mouseInterface = true; Main.SetRecipeMaterialDisplayName(i); } double num63 = num61 - 50.0; if (num63 < 0.0) num63 = 0.0; UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeSmall = 1 + i; Microsoft.Xna.Framework.Color inventoryBack3 = Main.inventoryBack; Main.inventoryBack = new Microsoft.Xna.Framework.Color((int) (byte) num63, (int) (byte) num63, (int) (byte) num63, (int) (byte) num63); ItemSlot.Draw(Main.spriteBatch, ref Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[i], 22, new Vector2((float) num58, (float) num59)); Main.inventoryBack = inventoryBack3; } else break; } } if (Main.numAvailableRecipes == 0) { Main.recBigList = false; } else { int num64 = 94; int num65 = 450 + adjY; if (Main.InGuideCraftMenu) num65 -= 150; bool flag10 = Main.mouseX > num64 - 15 && Main.mouseX < num64 + 15 && Main.mouseY > num65 - 15 && Main.mouseY < num65 + 15 && !PlayerInput.IgnoreMouseInterface; int index = Main.recBigList.ToInt() * 2 + flag10.ToInt(); Main.spriteBatch.Draw(TextureAssets.CraftToggle[index].Value, new Vector2((float) num64, (float) num65), new Microsoft.Xna.Framework.Rectangle?(), Microsoft.Xna.Framework.Color.White, 0.0f, TextureAssets.CraftToggle[index].Value.Size() / 2f, 1f, SpriteEffects.None, 0.0f); if (flag10) { this.MouseText(Language.GetTextValue("GameUI.CraftingWindow")); Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeft && Main.mouseLeftRelease) { if (!Main.recBigList) { Main.recBigList = true; SoundEngine.PlaySound(12); } else { Main.recBigList = false; SoundEngine.PlaySound(12); } } } } } if (Main.recBigList && !flag9) { UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeBig = -1; UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeSmall = -1; int num66 = 42; if ((double) Main.inventoryScale < 0.75) Main.inventoryScale = 0.75f; int num67 = 340; int num68 = 310; int num69 = (Main.screenWidth - num68 - 280) / num66; int num70 = (Main.screenHeight - num67 - 20) / num66; UILinkPointNavigator.Shortcuts.CRAFT_IconsPerRow = num69; UILinkPointNavigator.Shortcuts.CRAFT_IconsPerColumn = num70; int num71 = 0; int num72 = 0; int num73 = num68; int num74 = num67; int num75 = num68 - 20; int num76 = num67 + 2; if (Main.recStart > Main.numAvailableRecipes - num69 * num70) { Main.recStart = Main.numAvailableRecipes - num69 * num70; if (Main.recStart < 0) Main.recStart = 0; } if (Main.recStart > 0) { if (Main.mouseX >= num75 && Main.mouseX <= num75 + TextureAssets.CraftUpButton.Width() && Main.mouseY >= num76 && Main.mouseY <= num76 + TextureAssets.CraftUpButton.Height() && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft) { Main.recStart -= num69; if (Main.recStart < 0) Main.recStart = 0; SoundEngine.PlaySound(12); Main.mouseLeftRelease = false; } } Main.spriteBatch.Draw(TextureAssets.CraftUpButton.Value, new Vector2((float) num75, (float) num76), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.CraftUpButton.Width(), TextureAssets.CraftUpButton.Height())), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (Main.recStart < Main.numAvailableRecipes - num69 * num70) { int num77 = num76 + 20; if (Main.mouseX >= num75 && Main.mouseX <= num75 + TextureAssets.CraftUpButton.Width() && Main.mouseY >= num77 && Main.mouseY <= num77 + TextureAssets.CraftUpButton.Height() && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft) { Main.recStart += num69; SoundEngine.PlaySound(12); if (Main.recStart > Main.numAvailableRecipes - num69) Main.recStart = Main.numAvailableRecipes - num69; Main.mouseLeftRelease = false; } } Main.spriteBatch.Draw(TextureAssets.CraftDownButton.Value, new Vector2((float) num75, (float) num77), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.CraftUpButton.Width(), TextureAssets.CraftUpButton.Height())), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } for (int recStart = Main.recStart; recStart < Recipe.maxRecipes && recStart < Main.numAvailableRecipes; ++recStart) { int num78 = num73; int num79 = num74; double num80 = (double) ((int) Main.inventoryBack.A + 50); double maxValue = (double) byte.MaxValue; Microsoft.Xna.Framework.Color color8 = new Microsoft.Xna.Framework.Color((int) (byte) num80, (int) (byte) num80, (int) (byte) num80, (int) (byte) num80); Microsoft.Xna.Framework.Color color9 = new Microsoft.Xna.Framework.Color((int) (byte) maxValue, (int) (byte) maxValue, (int) (byte) maxValue, (int) (byte) maxValue); if (Main.mouseX >= num78 && (double) Main.mouseX <= (double) num78 + (double) TextureAssets.InventoryBack.Width() * (double) Main.inventoryScale && Main.mouseY >= num79 && (double) Main.mouseY <= (double) num79 + (double) TextureAssets.InventoryBack.Height() * (double) Main.inventoryScale && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft) { Main.focusRecipe = recStart; Main.recFastScroll = true; Main.recBigList = false; SoundEngine.PlaySound(12); Main.mouseLeftRelease = false; if (PlayerInput.UsingGamepadUI) { UILinkPointNavigator.ChangePage(9); Main.LockCraftingForThisCraftClickDuration(); } } Main.craftingHide = true; Main.hoverItemName = Main.recipe[Main.availableRecipe[recStart]].createItem.Name; Main.HoverItem = Main.recipe[Main.availableRecipe[recStart]].createItem.Clone(); if (Main.recipe[Main.availableRecipe[recStart]].createItem.stack > 1) Main.hoverItemName = Main.hoverItemName + " (" + (object) Main.recipe[Main.availableRecipe[recStart]].createItem.stack + ")"; } if (Main.numAvailableRecipes > 0) { double num81 = num80 - 50.0; if (num81 < 0.0) num81 = 0.0; UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeBig = recStart - Main.recStart; Microsoft.Xna.Framework.Color inventoryBack4 = Main.inventoryBack; Main.inventoryBack = new Microsoft.Xna.Framework.Color((int) (byte) num81, (int) (byte) num81, (int) (byte) num81, (int) (byte) num81); ItemSlot.Draw(Main.spriteBatch, ref Main.recipe[Main.availableRecipe[recStart]].createItem, 22, new Vector2((float) num78, (float) num79)); Main.inventoryBack = inventoryBack4; } num73 += num66; ++num71; if (num71 >= num69) { num73 = num68; num74 += num66; num71 = 0; ++num72; if (num72 >= num70) break; } } } Vector2 vector2_4 = FontAssets.MouseText.Value.MeasureString("Coins"); Vector2 vector2_5 = FontAssets.MouseText.Value.MeasureString(Lang.inter[26].Value); float num82 = vector2_4.X / vector2_5.X; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, Lang.inter[26].Value, new Vector2(496f, (float) (84.0 + ((double) vector2_4.Y - (double) vector2_4.Y * (double) num82) / 2.0)), new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor), 0.0f, new Vector2(), 0.75f * num82, SpriteEffects.None, 0.0f); Main.inventoryScale = 0.6f; for (int index = 0; index < 4; ++index) { int num83 = 497; int num84 = (int) (85.0 + (double) (index * 56) * (double) Main.inventoryScale + 20.0); int slot = index + 50; Microsoft.Xna.Framework.Color color10 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100); if (Main.mouseX >= num83 && (double) Main.mouseX <= (double) num83 + (double) TextureAssets.InventoryBack.Width() * (double) Main.inventoryScale && Main.mouseY >= num84 && (double) Main.mouseY <= (double) num84 + (double) TextureAssets.InventoryBack.Height() * (double) Main.inventoryScale && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; ItemSlot.OverrideHover(Main.player[Main.myPlayer].inventory, 1, slot); ItemSlot.LeftClick(Main.player[Main.myPlayer].inventory, 1, slot); ItemSlot.RightClick(Main.player[Main.myPlayer].inventory, 1, slot); if (Main.mouseLeftRelease && Main.mouseLeft) Recipe.FindRecipes(); ItemSlot.MouseHover(Main.player[Main.myPlayer].inventory, 1, slot); } ItemSlot.Draw(Main.spriteBatch, Main.player[Main.myPlayer].inventory, 1, slot, new Vector2((float) num83, (float) num84)); } Vector2 vector2_6 = FontAssets.MouseText.Value.MeasureString("Ammo"); Vector2 vector2_7 = FontAssets.MouseText.Value.MeasureString(Lang.inter[27].Value); float num85 = vector2_6.X / vector2_7.X; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, Lang.inter[27].Value, new Vector2(532f, (float) (84.0 + ((double) vector2_6.Y - (double) vector2_6.Y * (double) num85) / 2.0)), new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor), 0.0f, new Vector2(), 0.75f * num85, SpriteEffects.None, 0.0f); Main.inventoryScale = 0.6f; for (int index = 0; index < 4; ++index) { int num86 = 534; int num87 = (int) (85.0 + (double) (index * 56) * (double) Main.inventoryScale + 20.0); int slot = 54 + index; Microsoft.Xna.Framework.Color color11 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100); if (Main.mouseX >= num86 && (double) Main.mouseX <= (double) num86 + (double) TextureAssets.InventoryBack.Width() * (double) Main.inventoryScale && Main.mouseY >= num87 && (double) Main.mouseY <= (double) num87 + (double) TextureAssets.InventoryBack.Height() * (double) Main.inventoryScale && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; ItemSlot.OverrideHover(Main.player[Main.myPlayer].inventory, 2, slot); ItemSlot.LeftClick(Main.player[Main.myPlayer].inventory, 2, slot); ItemSlot.RightClick(Main.player[Main.myPlayer].inventory, 2, slot); if (Main.mouseLeftRelease && Main.mouseLeft) Recipe.FindRecipes(); ItemSlot.MouseHover(Main.player[Main.myPlayer].inventory, 2, slot); } ItemSlot.Draw(Main.spriteBatch, Main.player[Main.myPlayer].inventory, 2, slot, new Vector2((float) num86, (float) num87)); } if (Main.npcShop > 0 && (!Main.playerInventory || Main.player[Main.myPlayer].talkNPC == -1)) Main.SetNPCShopIndex(0); if (Main.npcShop > 0 && !Main.recBigList) { Utils.DrawBorderStringFourWay(Main.spriteBatch, FontAssets.MouseText.Value, Lang.inter[28].Value, 504f, (float) this.invBottom, Microsoft.Xna.Framework.Color.White * ((float) Main.mouseTextColor / (float) byte.MaxValue), Microsoft.Xna.Framework.Color.Black, Vector2.Zero); ItemSlot.DrawSavings(Main.spriteBatch, 504f, (float) this.invBottom); Main.inventoryScale = 0.755f; if (Main.mouseX > 73 && Main.mouseX < (int) (73.0 + 560.0 * (double) Main.inventoryScale) && Main.mouseY > this.invBottom && Main.mouseY < (int) ((double) this.invBottom + 224.0 * (double) Main.inventoryScale) && !PlayerInput.IgnoreMouseInterface) Main.player[Main.myPlayer].mouseInterface = true; for (int index5 = 0; index5 < 10; ++index5) { for (int index6 = 0; index6 < 4; ++index6) { int num88 = (int) (73.0 + (double) (index5 * 56) * (double) Main.inventoryScale); int num89 = (int) ((double) this.invBottom + (double) (index6 * 56) * (double) Main.inventoryScale); int slot = index5 + index6 * 10; Microsoft.Xna.Framework.Color color12 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100); if (Main.mouseX >= num88 && (double) Main.mouseX <= (double) num88 + (double) TextureAssets.InventoryBack.Width() * (double) Main.inventoryScale && Main.mouseY >= num89 && (double) Main.mouseY <= (double) num89 + (double) TextureAssets.InventoryBack.Height() * (double) Main.inventoryScale && !PlayerInput.IgnoreMouseInterface) { ItemSlot.OverrideHover(this.shop[Main.npcShop].item, 15, slot); Main.player[Main.myPlayer].mouseInterface = true; ItemSlot.LeftClick(this.shop[Main.npcShop].item, 15, slot); ItemSlot.RightClick(this.shop[Main.npcShop].item, 15, slot); ItemSlot.MouseHover(this.shop[Main.npcShop].item, 15, slot); } ItemSlot.Draw(Main.spriteBatch, this.shop[Main.npcShop].item, 15, slot, new Vector2((float) num88, (float) num89)); } } } if (Main.player[Main.myPlayer].chest > -1 && !Main.tileContainer[(int) Main.tile[Main.player[Main.myPlayer].chestX, Main.player[Main.myPlayer].chestY].type]) { Main.player[Main.myPlayer].chest = -1; Recipe.FindRecipes(); } int num90 = 0; UIVirtualKeyboard.ShouldHideText = !PlayerInput.UsingGamepad; if (!PlayerInput.UsingGamepad) num90 = 9999; UIVirtualKeyboard.OffsetDown = num90; ChestUI.Draw(Main.spriteBatch); Main.LocalPlayer.tileEntityAnchor.GetTileEntity()?.OnInventoryDraw(Main.LocalPlayer, Main.spriteBatch); if (Main.player[Main.myPlayer].chest == -1 && Main.npcShop == 0) { int index = 0; int num91 = 498; int num92 = 244; int num93 = TextureAssets.ChestStack[index].Width(); int num94 = TextureAssets.ChestStack[index].Height(); UILinkPointNavigator.SetPosition(301, new Vector2((float) num91 + (float) num93 * 0.75f, (float) num92 + (float) num94 * 0.75f)); if (Main.mouseX >= num91 && Main.mouseX <= num91 + num93 && Main.mouseY >= num92 && Main.mouseY <= num92 + num94 && !PlayerInput.IgnoreMouseInterface) { index = 1; if (!Main.allChestStackHover) { SoundEngine.PlaySound(12); Main.allChestStackHover = true; } if (Main.mouseLeft && Main.mouseLeftRelease) { Main.mouseLeftRelease = false; Main.player[Main.myPlayer].QuickStackAllChests(); Recipe.FindRecipes(); } Main.player[Main.myPlayer].mouseInterface = true; } else if (Main.allChestStackHover) { SoundEngine.PlaySound(12); Main.allChestStackHover = false; } Main.spriteBatch.Draw(TextureAssets.ChestStack[index].Value, new Vector2((float) num91, (float) num92), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.ChestStack[index].Width(), TextureAssets.ChestStack[index].Height())), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); if (!Main.mouseText && index == 1) this.MouseText(Language.GetTextValue("GameUI.QuickStackToNearby")); } if (Main.player[Main.myPlayer].chest != -1 || Main.npcShop != 0) return; int num95 = 0; int num96 = 534; int num97 = 244; int num98 = 30; int num99 = 30; UILinkPointNavigator.SetPosition(302, new Vector2((float) num96 + (float) num98 * 0.75f, (float) num97 + (float) num99 * 0.75f)); bool flag11 = false; if (Main.mouseX >= num96 && Main.mouseX <= num96 + num98 && Main.mouseY >= num97 && Main.mouseY <= num97 + num99 && !PlayerInput.IgnoreMouseInterface) { num95 = 1; flag11 = true; Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeft && Main.mouseLeftRelease) { Main.mouseLeftRelease = false; ItemSorting.SortInventory(); Recipe.FindRecipes(); } } if (flag11 != Main.inventorySortMouseOver) { SoundEngine.PlaySound(12); Main.inventorySortMouseOver = flag11; } Texture2D texture1 = TextureAssets.InventorySort[Main.inventorySortMouseOver ? 1 : 0].Value; Main.spriteBatch.Draw(texture1, new Vector2((float) num96, (float) num97), new Microsoft.Xna.Framework.Rectangle?(), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); if (Main.mouseText || num95 != 1) return; this.MouseText(Language.GetTextValue("GameUI.SortInventory")); } private void DrawNPCHousesInUI() { UILinkPointNavigator.Shortcuts.NPCS_LastHovered = -2; if (Main.mouseX > Main.screenWidth - 64 - 28 && Main.mouseX < (int) ((double) (Main.screenWidth - 64 - 28) + 56.0 * (double) Main.inventoryScale) && Main.mouseY > 174 + Main.mH && Main.mouseY < (int) ((double) (174 + Main.mH) + 448.0 * (double) Main.inventoryScale) && !PlayerInput.IgnoreMouseInterface) Main.player[Main.myPlayer].mouseInterface = true; int num1 = 0; string cursorText = ""; int num2 = 0; int num3 = 0; this._npcTypesThatAlreadyDrewAHead.Clear(); for (int index = 0; index < this._npcIndexWhoHoldsHeadIndex.Length; ++index) this._npcIndexWhoHoldsHeadIndex[index] = -1; for (int index1 = 0; index1 < 200; ++index1) { if (Main.npc[index1].active && !this._npcTypesThatAlreadyDrewAHead.Contains(Main.npc[index1].type)) { ITownNPCProfile profile; int index2 = !TownNPCProfiles.Instance.GetProfile(Main.npc[index1].type, out profile) ? NPC.TypeToDefaultHeadIndex(Main.npc[index1].type) : profile.GetHeadTextureIndex(Main.npc[index1]); if (index2 > 0 && index2 <= 45 && !NPCHeadID.Sets.CannotBeDrawnInHousingUI[index2] && this._npcIndexWhoHoldsHeadIndex[index2] == -1) { this._npcIndexWhoHoldsHeadIndex[index2] = index1; this._npcTypesThatAlreadyDrewAHead.Add(Main.npc[index1].type); } } } Main.hidePVPIcons = false; for (int index3 = 0; index3 < TextureAssets.NpcHead.Length; ++index3) { if (index3 == 0 || this._npcIndexWhoHoldsHeadIndex[index3] != -1) { int index4 = this._npcIndexWhoHoldsHeadIndex[index3]; int num4 = Main.screenWidth - 64 - 28 + num3; int num5 = (int) ((double) (174 + Main.mH) + (double) (num1 * 56) * (double) Main.inventoryScale) + num2; Microsoft.Xna.Framework.Color color1 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100); if (num5 > Main.screenHeight - 80) { num3 -= 48; num2 -= num5 - (174 + Main.mH); num4 = Main.screenWidth - 64 - 28 + num3; num5 = (int) ((double) (174 + Main.mH) + (double) (num1 * 56) * (double) Main.inventoryScale) + num2; UILinkPointNavigator.Shortcuts.NPCS_IconsPerColumn = num1; if (num3 <= -144) Main.hidePVPIcons = true; } if (Main.mouseX >= num4 && (double) Main.mouseX <= (double) num4 + (double) TextureAssets.InventoryBack.Width() * (double) Main.inventoryScale && Main.mouseY >= num5 && (double) Main.mouseY <= (double) num5 + (double) TextureAssets.InventoryBack.Height() * (double) Main.inventoryScale) { UILinkPointNavigator.Shortcuts.NPCS_LastHovered = index4; Main.mouseText = true; cursorText = index3 != 0 ? Main.npc[index4].FullName : Lang.inter[8].Value; if (!PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft && !PlayerInput.UsingGamepadUI && Main.mouseItem.type == 0) { SoundEngine.PlaySound(12); if (index3 == 0) this.SetMouseNPC_ToHousingQuery(); else this.SetMouseNPC(index4, Main.npc[index4].type); Main.mouseLeftRelease = false; } } } UILinkPointNavigator.SetPosition(600 + num1, new Vector2((float) num4, (float) num5) + TextureAssets.InventoryBack.Value.Size() * 0.75f); Texture2D texture = TextureAssets.InventoryBack11.Value; Microsoft.Xna.Framework.Color color2 = Main.inventoryBack; if (UILinkPointNavigator.CurrentPoint - 600 == num1) { texture = TextureAssets.InventoryBack14.Value; color2 = Microsoft.Xna.Framework.Color.White; } Main.spriteBatch.Draw(texture, new Vector2((float) num4, (float) num5), new Microsoft.Xna.Framework.Rectangle?(), color2, 0.0f, new Vector2(), Main.inventoryScale, SpriteEffects.None, 0.0f); color1 = Microsoft.Xna.Framework.Color.White; int index5 = index3; float scale = 1f; float num6 = TextureAssets.NpcHead[index5].Width() <= TextureAssets.NpcHead[index5].Height() ? (float) TextureAssets.NpcHead[index5].Height() : (float) TextureAssets.NpcHead[index5].Width(); if ((double) num6 > 36.0) scale = 36f / num6; Main.spriteBatch.Draw(TextureAssets.NpcHead[index5].Value, new Vector2((float) num4 + 26f * Main.inventoryScale, (float) num5 + 26f * Main.inventoryScale), new Microsoft.Xna.Framework.Rectangle?(), color1, 0.0f, new Vector2((float) (TextureAssets.NpcHead[index5].Width() / 2), (float) (TextureAssets.NpcHead[index5].Height() / 2)), scale, SpriteEffects.None, 0.0f); ++num1; } } UILinkPointNavigator.Shortcuts.NPCS_IconsTotal = num1; if (!(cursorText != "") || Main.mouseItem.type != 0) return; this.MouseText(cursorText); } private static void DrawDefenseCounter(int inventoryX, int inventoryY) { Vector2 vector2_1 = new Vector2((float) (inventoryX - 10 - 47 - 47 - 14), (float) inventoryY + (float) TextureAssets.InventoryBack.Height() * 0.5f); Main.spriteBatch.Draw(TextureAssets.Extra[58].Value, vector2_1, new Microsoft.Xna.Framework.Rectangle?(), Microsoft.Xna.Framework.Color.White, 0.0f, TextureAssets.Extra[58].Value.Size() / 2f, Main.inventoryScale, SpriteEffects.None, 0.0f); Vector2 vector2_2 = FontAssets.MouseText.Value.MeasureString(Main.player[Main.myPlayer].statDefense.ToString()); ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, FontAssets.MouseText.Value, Main.player[Main.myPlayer].statDefense.ToString(), vector2_1 - vector2_2 * 0.5f * Main.inventoryScale, Microsoft.Xna.Framework.Color.White, 0.0f, Vector2.Zero, new Vector2(Main.inventoryScale)); if (Utils.CenteredRectangle(vector2_1, TextureAssets.Extra[58].Value.Size()).Contains(new Microsoft.Xna.Framework.Point(Main.mouseX, Main.mouseY)) && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; string str = Main.player[Main.myPlayer].statDefense.ToString() + " " + Lang.inter[10].Value; if (!string.IsNullOrEmpty(str)) Main.hoverItemName = str; } UILinkPointNavigator.SetPosition(1557, vector2_1 + TextureAssets.Extra[58].Value.Size() * Main.inventoryScale / 4f); } private static void DrawGuideCraftText( int adjY, Microsoft.Xna.Framework.Color craftingTipColor, out int inventoryX, out int inventoryY) { inventoryX = 73; inventoryY = 331; inventoryY += adjY; Main._requiredObjecsForCraftingText.Clear(); string str1; if (Main.guideItem.IsAir) { str1 = Lang.inter[24].Value; } else { str1 = Lang.inter[21].Value + " " + Main.guideItem.Name; Recipe recipe = Main.recipe[Main.availableRecipe[Main.focusRecipe]]; for (int index = 0; index < Recipe.maxRequirements; ++index) { int num = recipe.requiredTile[index]; if (num != -1) { int requiredTileStyle = Recipe.GetRequiredTileStyle(num); string mapObjectName = Lang.GetMapObjectName(MapHelper.TileToLookup(num, requiredTileStyle)); Main._requiredObjecsForCraftingText.Add(mapObjectName); } else break; } if (recipe.needWater) Main._requiredObjecsForCraftingText.Add(Lang.inter[53].Value); if (recipe.needHoney) Main._requiredObjecsForCraftingText.Add(Lang.inter[58].Value); if (recipe.needLava) Main._requiredObjecsForCraftingText.Add(Lang.inter[56].Value); if (recipe.needSnowBiome) Main._requiredObjecsForCraftingText.Add(Lang.inter[123].Value); if (recipe.needGraveyardBiome) Main._requiredObjecsForCraftingText.Add(Lang.inter[124].Value); if (Main._requiredObjecsForCraftingText.Count == 0) { string str2 = Lang.inter[23].Value; Main._requiredObjecsForCraftingText.Add(str2); } } Microsoft.Xna.Framework.Color color1 = new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor); Vector2 vector2_1 = new Vector2((float) (inventoryX + 50), (float) (inventoryY + 12)); DynamicSpriteFont dynamicSpriteFont = FontAssets.MouseText.Value; if (Main._requiredObjecsForCraftingText.Count > 0) { vector2_1.Y -= 14f; Vector2 vector2_2 = vector2_1 + new Vector2(0.0f, 26f); Microsoft.Xna.Framework.Color color2 = color1; string str3 = Lang.inter[22].Value + " " + string.Join(", ", (IEnumerable) Main._requiredObjecsForCraftingText); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, dynamicSpriteFont, str3, vector2_2, color2, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, dynamicSpriteFont, str1, vector2_1, color1, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } private static void DrawGuideCraftText_Old( int adjY, Microsoft.Xna.Framework.Color craftingTipColor, out int inventoryX, out int inventoryY) { inventoryX = 73; inventoryY = 331; inventoryY += adjY; int num1 = 0; int num2 = 0; inventoryX += num1; inventoryY += num2; string str; if (Main.guideItem.type > 0) { str = Lang.inter[21].Value + " " + Main.guideItem.Name; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, Lang.inter[22].Value, new Vector2((float) inventoryX, (float) (inventoryY + 118)), craftingTipColor, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); int focusRecipe = Main.focusRecipe; int num3 = 0; for (int index = 0; index < Recipe.maxRequirements; ++index) { int num4 = (index + 1) * 26; if (Main.recipe[Main.availableRecipe[focusRecipe]].requiredTile[index] == -1) { if (index == 0 && !Main.recipe[Main.availableRecipe[focusRecipe]].needWater && !Main.recipe[Main.availableRecipe[focusRecipe]].needHoney && !Main.recipe[Main.availableRecipe[focusRecipe]].needLava && !Main.recipe[Main.availableRecipe[focusRecipe]].needSnowBiome && !Main.recipe[Main.availableRecipe[focusRecipe]].needGraveyardBiome) { DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, Lang.inter[23].Value, new Vector2((float) inventoryX, (float) (inventoryY + 118 + num4)), craftingTipColor, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); break; } break; } ++num3; int num5 = Main.recipe[Main.availableRecipe[focusRecipe]].requiredTile[index]; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, Lang.GetMapObjectName(MapHelper.TileToLookup(num5, Recipe.GetRequiredTileStyle(num5))), new Vector2((float) inventoryX, (float) (inventoryY + 118 + num4)), craftingTipColor, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (Main.recipe[Main.availableRecipe[focusRecipe]].needWater) { int num6 = (num3 + 1) * 26; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, Lang.inter[53].Value, new Vector2((float) inventoryX, (float) (inventoryY + 118 + num6)), craftingTipColor, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (Main.recipe[Main.availableRecipe[focusRecipe]].needHoney) { int num7 = (num3 + 1) * 26; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, Lang.inter[58].Value, new Vector2((float) inventoryX, (float) (inventoryY + 118 + num7)), craftingTipColor, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (Main.recipe[Main.availableRecipe[focusRecipe]].needLava) { int num8 = (num3 + 1) * 26; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, Lang.inter[56].Value, new Vector2((float) inventoryX, (float) (inventoryY + 118 + num8)), craftingTipColor, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (Main.recipe[Main.availableRecipe[focusRecipe]].needSnowBiome) { int num9 = (num3 + 1) * 26; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, Lang.inter[123].Value, new Vector2((float) inventoryX, (float) (inventoryY + 118 + num9)), craftingTipColor, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (Main.recipe[Main.availableRecipe[focusRecipe]].needGraveyardBiome) { int num10 = (num3 + 1) * 26; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, Lang.inter[124].Value, new Vector2((float) inventoryX, (float) (inventoryY + 118 + num10)), craftingTipColor, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } } else str = Lang.inter[24].Value; inventoryX -= num1; inventoryY -= num2; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, str, new Vector2((float) (inventoryX + 50), (float) (inventoryY + 12)), new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } public static void LockCraftingForThisCraftClickDuration() => Main._preventCraftingBecauseClickWasUsedToChangeFocusedRecipe = true; private static void HoverOverCraftingItemButton(int recipeIndex) { Recipe recipe = Main.recipe[Main.availableRecipe[recipeIndex]]; Main.player[Main.myPlayer].mouseInterface = true; bool flag1 = Main.mouseLeftRelease && Main.mouseLeft || Main.mouseRightRelease && Main.mouseRight; bool flag2 = Main.mouseLeft || Main.mouseRight; if (Main.focusRecipe == recipeIndex && Main.guideItem.IsAir) { bool flag3 = Main.LocalPlayer.ItemTimeIsZero && Main.LocalPlayer.itemAnimation == 0 && !Main.player[Main.myPlayer].HasLockedInventory() && !Main._preventCraftingBecauseClickWasUsedToChangeFocusedRecipe; bool flag4 = ((Main._currentRecipeBeingCrafted == -1 ? 0 : (Main._currentRecipeBeingCrafted != Main.availableRecipe[recipeIndex] ? 1 : 0)) | (Main._currentRecipeBeingCrafted == -1 ? (false ? 1 : 0) : (Main.recipe[Main._currentRecipeBeingCrafted].createItem.maxStack == 1 ? 1 : 0))) != 0; if (((!flag2 ? 0 : (!flag4 ? 1 : 0)) & (flag3 ? 1 : 0)) != 0 && Main.stackSplit <= 1) { bool usingGamepad = PlayerInput.UsingGamepad; bool movedAnItemToAllowCrafting; int num = Main.TryAllowingToCraftRecipe(recipe, usingGamepad, out movedAnItemToAllowCrafting) ? 1 : 0; if (movedAnItemToAllowCrafting) Main._preventCraftingBecauseClickWasUsedToChangeFocusedRecipe = true; if (num != 0 && !movedAnItemToAllowCrafting) { if (Main._currentRecipeBeingCrafted == -1) Main._currentRecipeBeingCrafted = Main.availableRecipe[recipeIndex]; ItemSlot.RefreshStackSplitCooldown(); Main.CraftItem(recipe); } } } else if (flag1) { Main.focusRecipe = recipeIndex; Main.stackSplit = 15; Main._preventCraftingBecauseClickWasUsedToChangeFocusedRecipe = true; } Main.craftingHide = true; Main.hoverItemName = recipe.createItem.Name; Main.HoverItem = recipe.createItem.Clone(); if (recipe.createItem.stack > 1) Main.hoverItemName = Main.hoverItemName + " (" + (object) recipe.createItem.stack + ")"; if (flag2) return; Main._preventCraftingBecauseClickWasUsedToChangeFocusedRecipe = false; Main._currentRecipeBeingCrafted = -1; } private static bool TryAllowingToCraftRecipe( Recipe currentRecipe, bool tryFittingItemInInventoryToAllowCrafting, out bool movedAnItemToAllowCrafting) { movedAnItemToAllowCrafting = false; if (Main.mouseItem.IsAir || Main.mouseItem.IsTheSameAs(currentRecipe.createItem) && Main.mouseItem.stack + currentRecipe.createItem.stack <= Main.mouseItem.maxStack) return true; if (tryFittingItemInInventoryToAllowCrafting && Main.LocalPlayer.ItemSpace(Main.mouseItem).CanTakeItemToPersonalInventory) { Main.mouseItem = Main.LocalPlayer.GetItem(Main.myPlayer, Main.mouseItem, GetItemSettings.InventoryUIToInventorySettingsShowAsNew); if (Main.mouseItem.IsAir) { movedAnItemToAllowCrafting = true; return true; } if (Main.mouseItem.IsTheSameAs(currentRecipe.createItem) && Main.mouseItem.stack + currentRecipe.createItem.stack <= Main.mouseItem.maxStack) { movedAnItemToAllowCrafting = true; return true; } } return false; } private static void DrawTrashItemSlot(int pivotTopLeftX, int pivotTopLeftY) { Main.inventoryScale = 0.85f; int num1 = 448 + pivotTopLeftX; int num2 = 258 + pivotTopLeftY; if ((Main.player[Main.myPlayer].chest != -1 || Main.npcShop > 0) && !Main.recBigList) { num2 += 168; Main.inventoryScale = 0.755f; num1 += 5; } Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(150, 150, 150, 150); if (Main.mouseX >= num1 && (double) Main.mouseX <= (double) num1 + (double) TextureAssets.InventoryBack.Width() * (double) Main.inventoryScale && Main.mouseY >= num2 && (double) Main.mouseY <= (double) num2 + (double) TextureAssets.InventoryBack.Height() * (double) Main.inventoryScale && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; ItemSlot.LeftClick(ref Main.player[Main.myPlayer].trashItem, 6); if (Main.mouseLeftRelease && Main.mouseLeft) Recipe.FindRecipes(); ItemSlot.MouseHover(ref Main.player[Main.myPlayer].trashItem, 6); } ItemSlot.Draw(Main.spriteBatch, ref Main.player[Main.myPlayer].trashItem, 6, new Vector2((float) num1, (float) num2)); } private static void DrawEmoteBubblesButton(int pivotTopLeftX, int pivotTopLeftY) { Main.inventoryScale = 0.85f; int num1 = (int) ((double) (450 + pivotTopLeftX) - 56.0 * (double) Main.inventoryScale); int num2 = 258 + pivotTopLeftY; int num3 = 244; int width = 30; int height = 30; int x = 534; int y = num3 + height + 4; if ((Main.player[Main.myPlayer].chest != -1 || Main.npcShop > 0) && !Main.recBigList) { y += 168; Main.inventoryScale = 0.755f; x += 5; int num4 = num3 + 24; } Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(x, y, (int) ((double) TextureAssets.InventoryBack.Width() * (double) Main.inventoryScale), (int) ((double) TextureAssets.InventoryBack.Height() * (double) Main.inventoryScale)); rectangle = new Microsoft.Xna.Framework.Rectangle(x, y, width, height); bool flag = false; if (rectangle.Contains(new Microsoft.Xna.Framework.Point(Main.mouseX, Main.mouseY)) && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; flag = true; if (Main.mouseLeft && Main.mouseLeftRelease) { Main.player[Main.myPlayer].SetTalkNPC(-1); Main.npcChatCornerItem = 0; Main.npcChatText = ""; Main.mouseLeftRelease = false; SoundEngine.PlaySound(12); IngameFancyUI.OpenUIState((UIState) new UIEmotesMenu()); } } Texture2D texture2D = TextureAssets.EmoteMenuButton.Value; Vector2 vector2 = rectangle.Center.ToVector2(); Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(2, frameX: (flag ? 1 : 0)); r.Width -= 2; r.Height -= 2; Vector2 origin = r.Size() / 2f; Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; Main.spriteBatch.Draw(texture2D, vector2, new Microsoft.Xna.Framework.Rectangle?(r), white, 0.0f, origin, 1f, SpriteEffects.None, 0.0f); UILinkPointNavigator.SetPosition(309, vector2); if (!(!Main.mouseText & flag)) return; Main.instance.MouseText(Language.GetTextValue("GameUI.Emote")); } private static void DrawBestiaryIcon(int pivotTopLeftX, int pivotTopLeftY) { Main.inventoryScale = 0.85f; int num1 = (int) ((double) (450 + pivotTopLeftX) - 56.0 * (double) Main.inventoryScale * 2.0); int num2 = 258 + pivotTopLeftY; int num3 = 244; int width = 30; int height = 30; int num4 = 244; int x = 498; int y = num4 + height + 4; if ((Main.player[Main.myPlayer].chest != -1 || Main.npcShop > 0) && !Main.recBigList) { y += 168; Main.inventoryScale = 0.755f; x += 5; num3 = num4 + 24; } Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(x, y, (int) ((double) TextureAssets.InventoryBack.Width() * (double) Main.inventoryScale), (int) ((double) TextureAssets.InventoryBack.Height() * (double) Main.inventoryScale)); rectangle = new Microsoft.Xna.Framework.Rectangle(x, y, width, height); bool flag = false; if (rectangle.Contains(new Microsoft.Xna.Framework.Point(Main.mouseX, Main.mouseY)) && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; flag = true; if (Main.mouseLeft && Main.mouseLeftRelease) { Main.player[Main.myPlayer].SetTalkNPC(-1); Main.npcChatCornerItem = 0; Main.npcChatText = ""; Main.mouseLeftRelease = false; SoundEngine.PlaySound(12); IngameFancyUI.OpenUIState((UIState) Main.BestiaryUI); Main.BestiaryUI.OnOpenPage(); } } Texture2D texture2D = TextureAssets.BestiaryMenuButton.Value; Vector2 vector2 = rectangle.Center.ToVector2(); Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(2, frameX: (flag ? 1 : 0)); r.Width -= 2; r.Height -= 2; Vector2 origin = r.Size() / 2f; Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; Main.spriteBatch.Draw(texture2D, vector2, new Microsoft.Xna.Framework.Rectangle?(r), white, 0.0f, origin, 1f, SpriteEffects.None, 0.0f); UILinkPointNavigator.SetPosition(310, vector2); if (!(!Main.mouseText & flag)) return; Main.instance.MouseText(Language.GetTextValue("GameUI.Bestiary")); } private static void SetRecipeMaterialDisplayName(int i) { Main.hoverItemName = Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[i].Name; Main.HoverItem = Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[i].Clone(); string theText; if (Main.recipe[Main.availableRecipe[Main.focusRecipe]].ProcessGroupsForText(Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[i].type, out theText)) Main.HoverItem.SetNameOverride(theText); if (Main.recipe[Main.availableRecipe[Main.focusRecipe]].anyIronBar && Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[i].type == 22) Main.HoverItem.SetNameOverride(Lang.misc[37].Value + " " + Lang.GetItemNameValue(22)); else if (Main.recipe[Main.availableRecipe[Main.focusRecipe]].anyWood && Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[i].type == 9) Main.HoverItem.SetNameOverride(Lang.misc[37].Value + " " + Lang.GetItemNameValue(9)); else if (Main.recipe[Main.availableRecipe[Main.focusRecipe]].anySand && Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[i].type == 169) Main.HoverItem.SetNameOverride(Lang.misc[37].Value + " " + Lang.GetItemNameValue(169)); else if (Main.recipe[Main.availableRecipe[Main.focusRecipe]].anyFragment && Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[i].type == 3458) Main.HoverItem.SetNameOverride(Lang.misc[37].Value + " " + Lang.misc[51].Value); else if (Main.recipe[Main.availableRecipe[Main.focusRecipe]].anyPressurePlate && Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[i].type == 542) Main.HoverItem.SetNameOverride(Lang.misc[37].Value + " " + Lang.misc[38].Value); if (Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[i].stack <= 1) return; Main.hoverItemName = Main.hoverItemName + " (" + (object) Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[i].stack + ")"; } private void DrawHotbarLockIcon(int pivotTopLeftX, int pivotTopLeftY, bool pushSideToolsUp) { int num1 = pivotTopLeftX; int num2 = 21 + pivotTopLeftY; Player player = Main.player[Main.myPlayer]; if (pushSideToolsUp) num2 = pivotTopLeftY; float scale = 0.9f; Texture2D texture2D = TextureAssets.HbLock[Main.player[Main.myPlayer].hbLocked ? 0 : 1].Value; Microsoft.Xna.Framework.Rectangle rectangle = texture2D.Frame(2); bool flag = false; if (Main.mouseX > num1 && (double) Main.mouseX < (double) num1 + (double) rectangle.Width * (double) scale && Main.mouseY > num2 && (double) Main.mouseY < (double) num2 + (double) rectangle.Height * (double) scale) { flag = true; Main.player[Main.myPlayer].mouseInterface = true; if (!Main.player[Main.myPlayer].hbLocked) this.MouseText(Lang.inter[5].Value); else this.MouseText(Lang.inter[6].Value); Main.mouseText = true; if (Main.mouseLeft && Main.mouseLeftRelease) { SoundEngine.PlaySound(22); Main.player[Main.myPlayer].hbLocked = !Main.player[Main.myPlayer].hbLocked; } } Main.spriteBatch.Draw(texture2D, new Vector2((float) num1, (float) num2), new Microsoft.Xna.Framework.Rectangle?(rectangle), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2(), scale, SpriteEffects.None, 0.0f); if (!flag) return; Main.spriteBatch.Draw(texture2D, new Vector2((float) num1, (float) num2), new Microsoft.Xna.Framework.Rectangle?(texture2D.Frame(2, frameX: 1)), Main.OurFavoriteColor, 0.0f, new Vector2(), scale, SpriteEffects.None, 0.0f); } private void DrawBlockReplacementIcon( int pivotTopLeftX, int pivotTopLeftY, bool pushSideToolsUp, int gamepadPointOffset) { if (!Main.playerInventory) return; int num1 = pivotTopLeftX; int num2 = 44 + pivotTopLeftY; Player player = Main.player[Main.myPlayer]; if (pushSideToolsUp) num2 = 23 + pivotTopLeftY; float scale = 0.9f; int index = 10; bool flag1 = Main.player[Main.myPlayer].builderAccStatus[index] == 0; Texture2D texture2D = TextureAssets.blockReplaceIcon[0].Value; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(3, frameX: (flag1 ? 0 : 1)); bool flag2 = false; if (Main.mouseX > num1 && (double) Main.mouseX < (double) num1 + (double) r.Width * (double) scale && Main.mouseY > num2 && (double) Main.mouseY < (double) num2 + (double) r.Height * (double) scale) { flag2 = true; Main.player[Main.myPlayer].mouseInterface = true; this.MouseText(flag1 ? Language.GetTextValue("GameUI.BlockReplacerOn") : Language.GetTextValue("GameUI.BlockReplacerOff")); Main.mouseText = true; if (Main.mouseLeft && Main.mouseLeftRelease) { SoundEngine.PlaySound(22); Main.player[Main.myPlayer].builderAccStatus[index] = flag1 ? 1 : 0; } } Vector2 position = new Vector2((float) num1, (float) num2); Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(r), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2(), scale, SpriteEffects.None, 0.0f); if (flag2) Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(texture2D.Frame(3, frameX: 2)), Main.OurFavoriteColor, 0.0f, new Vector2(), scale, SpriteEffects.None, 0.0f); UILinkPointNavigator.SetPosition(6000 + gamepadPointOffset, position + r.Size() * 0.65f); } private void DrawTorchBiomeSwapIcon( int pivotTopLeftX, int pivotTopLeftY, bool pushSideToolsUp, int gamepadPointOffset) { if (!Main.playerInventory) return; int num1 = pivotTopLeftX; int num2 = 68 + pivotTopLeftY; Player player = Main.player[Main.myPlayer]; if (pushSideToolsUp) num2 = 47 + pivotTopLeftY; float scale = 0.9f; int index = 11; bool flag1 = Main.player[Main.myPlayer].builderAccStatus[index] == 0; Texture2D texture2D = TextureAssets.Extra[211].Value; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(4, frameX: (flag1 ? 1 : 0)); bool flag2 = false; if (Main.mouseX > num1 && (double) Main.mouseX < (double) num1 + (double) r.Width * (double) scale && Main.mouseY > num2 && (double) Main.mouseY < (double) num2 + (double) r.Height * (double) scale) { flag2 = true; Main.player[Main.myPlayer].mouseInterface = true; this.MouseText(flag1 ? Language.GetTextValue("GameUI.TorchTypeSwapperOn") : Language.GetTextValue("GameUI.TorchTypeSwapperOff")); Main.mouseText = true; if (Main.mouseLeft && Main.mouseLeftRelease) { SoundEngine.PlaySound(22); Main.player[Main.myPlayer].builderAccStatus[index] = flag1 ? 1 : 0; } } Vector2 position = new Vector2((float) num1, (float) num2); Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(r), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2(), scale, SpriteEffects.None, 0.0f); if (flag2) Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(texture2D.Frame(4, frameX: (flag1 ? 3 : 2))), Main.OurFavoriteColor, 0.0f, new Vector2(), scale, SpriteEffects.None, 0.0f); UILinkPointNavigator.SetPosition(6000 + gamepadPointOffset, position + r.Size() * 0.65f); } public static void CraftItem(Recipe r) { int stack = Main.mouseItem.stack; Main.mouseItem = r.createItem.Clone(); Main.mouseItem.stack += stack; if (stack <= 0) Main.mouseItem.Prefix(-1); Main.mouseItem.position.X = Main.player[Main.myPlayer].position.X + (float) (Main.player[Main.myPlayer].width / 2) - (float) (Main.mouseItem.width / 2); Main.mouseItem.position.Y = Main.player[Main.myPlayer].position.Y + (float) (Main.player[Main.myPlayer].height / 2) - (float) (Main.mouseItem.height / 2); PopupText.NewText(PopupTextContext.ItemCraft, Main.mouseItem, r.createItem.stack); r.Create(); if (Main.mouseItem.type <= 0 && r.createItem.type <= 0) return; SoundEngine.PlaySound(7); } private static void DrawPVPIcons() { if (Main.EquipPage == 1) { if (Main.hidePVPIcons) return; } else Main.hidePVPIcons = false; Main.inventoryScale = 0.6f; int num1 = (int) (52.0 * (double) Main.inventoryScale); int num2 = 707 - num1 * 4 + Main.screenWidth - 800; int num3 = 114 + Main.mH + num1 * 2 + num1 / 2 - 12; if (Main.EquipPage == 2) num2 += num1 + num1 / 2; int num4 = Main.player[Main.myPlayer].hostile ? 2 : 0; if (Main.mouseX > num2 - 7 && Main.mouseX < num2 + 25 && Main.mouseY > num3 - 2 && Main.mouseY < num3 + 37 && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.teamCooldown == 0) ++num4; if (Main.mouseLeft && Main.mouseLeftRelease && Main.teamCooldown == 0) { Main.teamCooldown = Main.teamCooldownLen; SoundEngine.PlaySound(12); Main.player[Main.myPlayer].hostile = !Main.player[Main.myPlayer].hostile; NetMessage.SendData(30, number: Main.myPlayer); } } Microsoft.Xna.Framework.Rectangle r1 = TextureAssets.Pvp[0].Frame(4, 6); r1.Location = new Microsoft.Xna.Framework.Point(r1.Width * num4, r1.Height * Main.player[Main.myPlayer].team); r1.Width -= 2; --r1.Height; Main.spriteBatch.Draw(TextureAssets.Pvp[0].Value, new Vector2((float) (num2 - 10), (float) num3), new Microsoft.Xna.Framework.Rectangle?(r1), Microsoft.Xna.Framework.Color.White, 0.0f, Vector2.Zero, Vector2.One, SpriteEffects.None, 0.0f); UILinkPointNavigator.SetPosition(1550, new Vector2((float) (num2 - 10), (float) num3) + r1.Size() * 0.75f); int num5 = num3 + 60; int num6 = num2 - 10; Microsoft.Xna.Framework.Rectangle rectangle1 = TextureAssets.Pvp[1].Frame(6); Microsoft.Xna.Framework.Rectangle r2 = rectangle1; for (int index = 0; index < 6; ++index) { r2.Location = new Microsoft.Xna.Framework.Point(num6 + index % 2 * 20, num5 + index / 2 * 20); rectangle1.X = rectangle1.Width * index; bool flag = false; if (r2.Contains(Main.MouseScreen.ToPoint()) && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.teamCooldown == 0) flag = true; if (Main.mouseLeft && Main.mouseLeftRelease && Main.player[Main.myPlayer].team != index && Main.teamCooldown == 0) { if (!Main.player[Main.myPlayer].TeamChangeAllowed()) { Main.NewText(Lang.misc[84].Value, G: (byte) 240, B: (byte) 20); } else { Main.teamCooldown = Main.teamCooldownLen; SoundEngine.PlaySound(12); Main.player[Main.myPlayer].team = index; NetMessage.SendData(45, number: Main.myPlayer); } } } r2.Width = rectangle1.Width - 2; if (flag) Main.spriteBatch.Draw(TextureAssets.Pvp[2].Value, r2.Location.ToVector2() + new Vector2(-2f), Microsoft.Xna.Framework.Color.White); Microsoft.Xna.Framework.Rectangle rectangle2 = rectangle1; rectangle2.Width -= 2; Main.spriteBatch.Draw(TextureAssets.Pvp[1].Value, r2.Location.ToVector2(), new Microsoft.Xna.Framework.Rectangle?(rectangle2), Microsoft.Xna.Framework.Color.White); UILinkPointNavigator.SetPosition(1550 + index + 1, r2.Location.ToVector2() + r2.Size() * 0.75f); } } private static int DrawPageIcons(int yPos) { int num = -1; Vector2 vector2 = new Vector2((float) (Main.screenWidth - 162), (float) yPos); vector2.X += 82f; Texture2D texture2D1 = TextureAssets.EquipPage[Main.EquipPage == 2 ? 3 : 2].Value; if (Collision.CheckAABBvAABBCollision(vector2, texture2D1.Size(), new Vector2((float) Main.mouseX, (float) Main.mouseY), Vector2.One) && (Main.mouseItem.stack < 1 || Main.mouseItem.dye > (byte) 0)) num = 2; if (num == 2) Main.spriteBatch.Draw(TextureAssets.EquipPage[6].Value, vector2, new Microsoft.Xna.Framework.Rectangle?(), Main.OurFavoriteColor, 0.0f, new Vector2(2f), 0.9f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(texture2D1, vector2, new Microsoft.Xna.Framework.Rectangle?(), Microsoft.Xna.Framework.Color.White, 0.0f, Vector2.Zero, 0.9f, SpriteEffects.None, 0.0f); UILinkPointNavigator.SetPosition(305, vector2 + texture2D1.Size() * 0.75f); vector2.X -= 48f; Texture2D texture2D2 = TextureAssets.EquipPage[Main.EquipPage == 1 ? 5 : 4].Value; if (Collision.CheckAABBvAABBCollision(vector2, texture2D2.Size(), new Vector2((float) Main.mouseX, (float) Main.mouseY), Vector2.One) && Main.mouseItem.stack < 1) num = 1; if (num == 1) Main.spriteBatch.Draw(TextureAssets.EquipPage[7].Value, vector2, new Microsoft.Xna.Framework.Rectangle?(), Main.OurFavoriteColor, 0.0f, new Vector2(2f), 0.9f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(texture2D2, vector2, new Microsoft.Xna.Framework.Rectangle?(), Microsoft.Xna.Framework.Color.White, 0.0f, Vector2.Zero, 0.9f, SpriteEffects.None, 0.0f); UILinkPointNavigator.SetPosition(306, vector2 + texture2D2.Size() * 0.75f); vector2.X -= 48f; Texture2D texture2D3 = TextureAssets.EquipPage[Main.EquipPage == 3 ? 10 : 8].Value; if (Collision.CheckAABBvAABBCollision(vector2, texture2D3.Size(), new Vector2((float) Main.mouseX, (float) Main.mouseY), Vector2.One) && Main.mouseItem.stack < 1) num = 3; if (num == 3 && !Main.CaptureModeDisabled) Main.spriteBatch.Draw(TextureAssets.EquipPage[9].Value, vector2, new Microsoft.Xna.Framework.Rectangle?(), Main.OurFavoriteColor, 0.0f, Vector2.Zero, 0.9f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(texture2D3, vector2, new Microsoft.Xna.Framework.Rectangle?(), Main.CaptureModeDisabled ? Microsoft.Xna.Framework.Color.Red : Microsoft.Xna.Framework.Color.White, 0.0f, Vector2.Zero, 0.9f, SpriteEffects.None, 0.0f); UILinkPointNavigator.SetPosition(307, vector2 + texture2D3.Size() * 0.75f); if (num != -1) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeft && Main.mouseLeftRelease) { bool flag = true; if (num == 3) { if (Main.CaptureModeDisabled) flag = false; else if (PlayerInput.UsingGamepad) { CaptureInterface.QuickScreenshot(); } else { CaptureManager.Instance.Active = true; Main.blockMouse = true; } } else Main.EquipPageSelected = Main.EquipPageSelected == num ? 0 : num; if (flag) SoundEngine.PlaySound(10); } } ItemSlot.SelectEquipPage(Main.mouseItem); if (Main.EquipPage == -1) Main.EquipPage = Main.EquipPageSelected; return num; } public void DrawMouseOver() { PlayerInput.SetZoom_Unscaled(); PlayerInput.SetZoom_MouseInWorld(); Microsoft.Xna.Framework.Rectangle rectangle1 = new Microsoft.Xna.Framework.Rectangle((int) ((double) Main.mouseX + (double) Main.screenPosition.X), (int) ((double) Main.mouseY + (double) Main.screenPosition.Y), 1, 1); if ((double) Main.player[Main.myPlayer].gravDir == -1.0) rectangle1.Y = (int) Main.screenPosition.Y + Main.screenHeight - Main.mouseY; PlayerInput.SetZoom_UI(); if (!Main.LocalPlayer.ghost) Main.ActivePlayerResourcesSet.TryToHover(); Main.AchievementAdvisor.DrawMouseHover(); IngameOptions.MouseOver(); IngameFancyUI.MouseOver(); if (!Main.mouseText) { for (int index = 0; index < 400; ++index) { if (Main.item[index].active) { Microsoft.Xna.Framework.Rectangle drawHitbox = Item.GetDrawHitbox(Main.item[index].type, (Player) null); Vector2 bottom = Main.item[index].Bottom; Microsoft.Xna.Framework.Rectangle rectangle2 = new Microsoft.Xna.Framework.Rectangle((int) ((double) bottom.X - (double) drawHitbox.Width * 0.5), (int) ((double) bottom.Y - (double) drawHitbox.Height), drawHitbox.Width, drawHitbox.Height); if (rectangle1.Intersects(rectangle2)) { Main.player[Main.myPlayer].cursorItemIconEnabled = false; string text = Main.item[index].AffixName(); if (Main.item[index].stack > 1) text = text + " (" + (object) Main.item[index].stack + ")"; if (Main.item[index].playerIndexTheItemIsReservedFor < (int) byte.MaxValue && Main.showItemOwner) text = text + " <" + Main.player[Main.item[index].playerIndexTheItemIsReservedFor].name + ">"; Main.rare = Main.item[index].rare; if (Main.item[index].expert) Main.rare = -12; this.MouseTextHackZoom(text, Main.rare); Main.mouseText = true; break; } } } } for (int index = 0; index < (int) byte.MaxValue; ++index) { if (Main.player[index].active && Main.myPlayer != index && !Main.player[index].dead && !Main.player[index].ShouldNotDraw && (double) Main.player[index].stealth > 0.5) { Microsoft.Xna.Framework.Rectangle rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) ((double) Main.player[index].position.X + (double) Main.player[index].width * 0.5 - 16.0), (int) ((double) Main.player[index].position.Y + (double) Main.player[index].height - 48.0), 32, 48); if (!Main.mouseText && rectangle1.Intersects(rectangle3)) { Main.player[Main.myPlayer].cursorItemIconEnabled = false; int num = Main.player[index].statLife; if (num < 0) num = 0; string text = Main.player[index].name + ": " + (object) num + "/" + (object) Main.player[index].statLifeMax2; if (Main.player[index].hostile) text = text + " " + Language.GetTextValue("Game.PvPFlag"); this.MouseTextHackZoom(text, 0, Main.player[index].difficulty); Main.mouseText = true; } } } Main.HoveringOverAnNPC = false; if (!Main.mouseText) { for (int npcIndex = 0; npcIndex < 200; ++npcIndex) { if (Main.npc[npcIndex].active) { this.LoadNPC(Main.npc[npcIndex].type); NPC npc1 = Main.npc[npcIndex]; npc1.position = npc1.position + Main.npc[npcIndex].netOffset; Microsoft.Xna.Framework.Rectangle rectangle4 = new Microsoft.Xna.Framework.Rectangle((int) Main.npc[npcIndex].Bottom.X - Main.npc[npcIndex].frame.Width / 2, (int) Main.npc[npcIndex].Bottom.Y - Main.npc[npcIndex].frame.Height, Main.npc[npcIndex].frame.Width, Main.npc[npcIndex].frame.Height); if (Main.npc[npcIndex].type >= 87 && Main.npc[npcIndex].type <= 92) rectangle4 = new Microsoft.Xna.Framework.Rectangle((int) ((double) Main.npc[npcIndex].position.X + (double) Main.npc[npcIndex].width * 0.5 - 32.0), (int) ((double) Main.npc[npcIndex].position.Y + (double) Main.npc[npcIndex].height * 0.5 - 32.0), 64, 64); bool flag1 = rectangle1.Intersects(rectangle4); bool flag2 = flag1 || Main.SmartInteractShowingGenuine && Main.SmartInteractNPC == npcIndex; if (flag2 && (Main.npc[npcIndex].type != 85 && Main.npc[npcIndex].type != 341 && Main.npc[npcIndex].type != 629 && Main.npc[npcIndex].aiStyle != 87 || (double) Main.npc[npcIndex].ai[0] != 0.0) && Main.npc[npcIndex].type != 488) { bool flag3 = Main.SmartInteractShowingGenuine && Main.SmartInteractNPC == npcIndex; if ((Main.npc[npcIndex].townNPC || Main.npc[npcIndex].type == 105 || Main.npc[npcIndex].type == 106 || Main.npc[npcIndex].type == 123 || Main.npc[npcIndex].type == 354 || Main.npc[npcIndex].type == 376 || Main.npc[npcIndex].type == 579 || Main.npc[npcIndex].type == 453 || Main.npc[npcIndex].type == 589) && new Microsoft.Xna.Framework.Rectangle((int) ((double) Main.player[Main.myPlayer].position.X + (double) (Main.player[Main.myPlayer].width / 2) - (double) (Player.tileRangeX * 16)), (int) ((double) Main.player[Main.myPlayer].position.Y + (double) (Main.player[Main.myPlayer].height / 2) - (double) (Player.tileRangeY * 16)), Player.tileRangeX * 16 * 2, Player.tileRangeY * 16 * 2).Intersects(new Microsoft.Xna.Framework.Rectangle((int) Main.npc[npcIndex].position.X, (int) Main.npc[npcIndex].position.Y, Main.npc[npcIndex].width, Main.npc[npcIndex].height))) flag3 = true; if (Main.player[Main.myPlayer].ownedProjectileCounts[651] > 0) flag3 = false; if (flag3 && !Main.player[Main.myPlayer].dead) { PlayerInput.SetZoom_MouseInWorld(); Main.HoveringOverAnNPC = true; this.currentNPCShowingChatBubble = npcIndex; if (Main.mouseRight && Main.npcChatRelease) { Main.npcChatRelease = false; if (PlayerInput.UsingGamepad) Main.player[Main.myPlayer].releaseInventory = false; if (Main.player[Main.myPlayer].talkNPC != npcIndex && !Main.player[Main.myPlayer].tileInteractionHappened) { Main.CancelHairWindow(); Main.SetNPCShopIndex(0); Main.InGuideCraftMenu = false; Main.player[Main.myPlayer].dropItemCheck(); Main.npcChatCornerItem = 0; Main.player[Main.myPlayer].sign = -1; Main.editSign = false; Main.player[Main.myPlayer].SetTalkNPC(npcIndex); Main.playerInventory = false; Main.player[Main.myPlayer].chest = -1; Recipe.FindRecipes(); Main.npcChatText = Main.npc[npcIndex].GetChat(); SoundEngine.PlaySound(24); } } } if (flag1 && !Main.player[Main.myPlayer].mouseInterface) { Main.player[Main.myPlayer].cursorItemIconEnabled = false; string text = Main.npc[npcIndex].GivenOrTypeName; int index = npcIndex; if (Main.npc[npcIndex].realLife >= 0) index = Main.npc[npcIndex].realLife; if (Main.npc[index].lifeMax > 1 && !Main.npc[index].dontTakeDamage) text = text + ": " + (object) Main.npc[index].life + "/" + (object) Main.npc[index].lifeMax; this.MouseTextHackZoom(text); Main.mouseText = true; NPC npc2 = Main.npc[npcIndex]; npc2.position = npc2.position - Main.npc[npcIndex].netOffset; break; } if (flag2) { NPC npc3 = Main.npc[npcIndex]; npc3.position = npc3.position - Main.npc[npcIndex].netOffset; break; } } NPC npc4 = Main.npc[npcIndex]; npc4.position = npc4.position - Main.npc[npcIndex].netOffset; } } } if (!Main.mouseText && Main.signHover != -1 && Main.sign[Main.signHover] != null && !Main.player[Main.myPlayer].mouseInterface && !string.IsNullOrWhiteSpace(Main.sign[Main.signHover].text)) { int lineAmount; string[] strArray = Utils.WordwrapString(Main.sign[Main.signHover].text, FontAssets.MouseText.Value, 460, 10, out lineAmount); ++lineAmount; Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, (BlendState) null, (SamplerState) null, (DepthStencilState) null, (RasterizerState) null, (Effect) null, Main._uiScaleMatrix); PlayerInput.SetZoom_UI(); int screenWidth = Main.screenWidth; int screenHeight = Main.screenHeight; int mouseX = Main.mouseX; int mouseY = Main.mouseY; PlayerInput.SetZoom_UI(); PlayerInput.SetZoom_Test(); float num1 = 0.0f; for (int index = 0; index < lineAmount; ++index) { float x = FontAssets.MouseText.Value.MeasureString(strArray[index]).X; if ((double) num1 < (double) x) num1 = x; } if ((double) num1 > 460.0) num1 = 460f; int num2 = Main.SettingsEnabled_OpaqueBoxBehindTooltips ? 1 : 0; Vector2 vector2 = new Vector2((float) mouseX, (float) mouseY) + new Vector2(16f); if (num2 != 0) vector2 += new Vector2(8f, 2f); if ((double) vector2.Y > (double) (screenHeight - 30 * lineAmount)) vector2.Y = (float) (screenHeight - 30 * lineAmount); if ((double) vector2.X > (double) screenWidth - (double) num1) vector2.X = (float) screenWidth - num1; Microsoft.Xna.Framework.Color textColor = new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor); if (num2 != 0) { textColor = Microsoft.Xna.Framework.Color.Lerp(textColor, Microsoft.Xna.Framework.Color.White, 1f); int num3 = 10; int num4 = 5; Utils.DrawInvBG(Main.spriteBatch, new Microsoft.Xna.Framework.Rectangle((int) vector2.X - num3, (int) vector2.Y - num4, (int) num1 + num3 * 2, 30 * lineAmount + num4 + num4 / 2), new Microsoft.Xna.Framework.Color(23, 25, 81, (int) byte.MaxValue) * 0.925f * 0.85f); } for (int index = 0; index < lineAmount; ++index) Utils.DrawBorderStringFourWay(Main.spriteBatch, FontAssets.MouseText.Value, strArray[index], vector2.X, vector2.Y + (float) (index * 30), textColor, Microsoft.Xna.Framework.Color.Black, Vector2.Zero); Main.mouseText = true; } PlayerInput.SetZoom_UI(); } private static void DrawNPCChatBubble(int i) { int num = -(Main.npc[i].width / 2 + 8); float y = Main.npc[i].position.Y - (float) TextureAssets.Chat.Height() - (float) (int) Main.screenPosition.Y; if (Main.npc[i].type == 637 && (double) Main.npc[i].ai[0] == 5.0) y -= 18f; SpriteEffects effects = SpriteEffects.None; if (Main.npc[i].spriteDirection == -1) { effects = SpriteEffects.FlipHorizontally; num = Main.npc[i].width / 2 + 8; } if ((double) Main.player[Main.myPlayer].gravDir != 1.0) { effects |= SpriteEffects.FlipVertically; y = (float) Main.screenHeight - y - (float) TextureAssets.Chat.Height(); } Vector2 position = new Vector2(Main.npc[i].position.X + (float) (Main.npc[i].width / 2) - Main.screenPosition.X - (float) (TextureAssets.Chat.Width() / 2) - (float) num, y); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, (BlendState) null, SamplerState.PointClamp, (DepthStencilState) null, (RasterizerState) null, (Effect) null, Main.GameViewMatrix.ZoomMatrix); PlayerInput.SetZoom_UI(); Main.spriteBatch.Draw(TextureAssets.Chat.Value, position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chat.Width(), TextureAssets.Chat.Height())), new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor), 0.0f, new Vector2(), 1f, effects, 0.0f); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, (BlendState) null, (SamplerState) null, (DepthStencilState) null, (RasterizerState) null, (Effect) null, Main._uiScaleMatrix); } public void GUIBarsDraw() { if (Main.ignoreErrors) { try { this.GUIBarsDrawInner(); } catch (Exception ex) { TimeLogger.DrawException(ex); } } else this.GUIBarsDrawInner(); } protected void GUIBarsDrawInner() { Main.ActivePlayerResourcesSet.Draw(); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, (Effect) null, Main.UIScaleMatrix); Main.DrawInterface_Resources_Breath(); Main.DrawInterface_Resources_ClearBuffs(); if (Main.ingameOptionsWindow || Main.playerInventory || Main.inFancyUI) return; this.DrawInterface_Resources_Buffs(); } private static void DrawInterface_Resources_ClearBuffs() { Main.buffString = ""; Main.bannerMouseOver = false; if (Main.recBigList) return; Main.recStart = 0; } private void DrawInterface_Resources_Buffs() { Main.recBigList = false; int drawBuffText = -1; int num1 = 11; for (int buffSlotOnPlayer = 0; buffSlotOnPlayer < 22; ++buffSlotOnPlayer) { if (Main.player[Main.myPlayer].buffType[buffSlotOnPlayer] > 0) { int num2 = Main.player[Main.myPlayer].buffType[buffSlotOnPlayer]; int x = 32 + buffSlotOnPlayer * 38; int y = 76; if (buffSlotOnPlayer >= num1) { x = 32 + (buffSlotOnPlayer - num1) * 38; y += 50; } drawBuffText = Main.DrawBuffIcon(drawBuffText, buffSlotOnPlayer, x, y); } else Main.buffAlpha[buffSlotOnPlayer] = 0.4f; } if (drawBuffText < 0) return; int index = Main.player[Main.myPlayer].buffType[drawBuffText]; if (index <= 0) return; string buffName = Lang.GetBuffName(index); string buffTooltip = Main.GetBuffTooltip(Main.player[Main.myPlayer], index); if (index == 147) Main.bannerMouseOver = true; if (Main.meleeBuff[index]) this.MouseTextHackZoom(buffName, -10, buffTooltip: buffTooltip); else this.MouseTextHackZoom(buffName, buffTooltip); } private static string GetBuffTooltip(Player player, int buffType) { string str = Lang.GetBuffDescription(buffType); switch (buffType) { case 26: if (Main.expertMode) { str = Language.GetTextValue("BuffDescription.WellFed_Expert"); break; } break; case 94: int num = (int) ((double) player.manaSickReduction * 100.0) + 1; str = str + (object) num + "%"; break; case 206: if (Main.expertMode) { str = Language.GetTextValue("BuffDescription.WellFed2_Expert"); break; } break; case 207: if (Main.expertMode) { str = Language.GetTextValue("BuffDescription.WellFed3_Expert"); break; } break; } return str; } private static bool TryGetBuffTime(int buffSlotOnPlayer, out int buffTimeValue) { int index = Main.player[Main.myPlayer].buffType[buffSlotOnPlayer]; buffTimeValue = 0; if (Main.vanityPet[index] || Main.lightPet[index] || Main.buffNoTimeDisplay[index] || Main.player[Main.myPlayer].honeyWet && index == 48 || Main.player[Main.myPlayer].wet && Main.expertMode && index == 46) return false; buffTimeValue = Main.player[Main.myPlayer].buffTime[buffSlotOnPlayer]; return true; } private static int DrawBuffIcon(int drawBuffText, int buffSlotOnPlayer, int x, int y) { int b = Main.player[Main.myPlayer].buffType[buffSlotOnPlayer]; if (b == 0) return drawBuffText; Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(Main.buffAlpha[buffSlotOnPlayer], Main.buffAlpha[buffSlotOnPlayer], Main.buffAlpha[buffSlotOnPlayer], Main.buffAlpha[buffSlotOnPlayer]); Main.spriteBatch.Draw(TextureAssets.Buff[b].Value, new Vector2((float) x, (float) y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Buff[b].Width(), TextureAssets.Buff[b].Height())), color, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); int buffTimeValue; if (Main.TryGetBuffTime(buffSlotOnPlayer, out buffTimeValue) && buffTimeValue > 2) { string str = Lang.LocalizedDuration(new TimeSpan(0, 0, buffTimeValue / 60), true, false); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.ItemStack.Value, str, new Vector2((float) x, (float) (y + TextureAssets.Buff[b].Height())), color, 0.0f, new Vector2(), 0.8f, SpriteEffects.None, 0.0f); } if (Main.mouseX < x + TextureAssets.Buff[b].Width() && Main.mouseY < y + TextureAssets.Buff[b].Height() && Main.mouseX > x && Main.mouseY > y) { drawBuffText = buffSlotOnPlayer; Main.buffAlpha[buffSlotOnPlayer] += 0.1f; bool flag = Main.mouseRight && Main.mouseRightRelease; if (PlayerInput.UsingGamepad) { flag = Main.mouseLeft && Main.mouseLeftRelease && Main.playerInventory; if (Main.playerInventory) Main.player[Main.myPlayer].mouseInterface = true; } else Main.player[Main.myPlayer].mouseInterface = true; if (flag) Main.TryRemovingBuff(buffSlotOnPlayer, b); } else Main.buffAlpha[buffSlotOnPlayer] -= 0.05f; if ((double) Main.buffAlpha[buffSlotOnPlayer] > 1.0) Main.buffAlpha[buffSlotOnPlayer] = 1f; else if ((double) Main.buffAlpha[buffSlotOnPlayer] < 0.4) Main.buffAlpha[buffSlotOnPlayer] = 0.4f; if (PlayerInput.UsingGamepad && !Main.playerInventory) drawBuffText = -1; return drawBuffText; } private static void TryRemovingBuff(int i, int b) { bool flag = false; if (Main.debuff[b] || b == 60 || b == 151) return; if (Main.player[Main.myPlayer].mount.Active && Main.player[Main.myPlayer].mount.CheckBuff(b)) { Main.player[Main.myPlayer].mount.Dismount(Main.player[Main.myPlayer]); flag = true; } Main.TryRemovingBuff_CheckBuffHideMisc(0, b); Main.TryRemovingBuff_CheckBuffHideMisc(1, b); SoundEngine.PlaySound(12); if (flag) return; Main.player[Main.myPlayer].DelBuff(i); } private static void TryRemovingBuff_CheckBuffHideMisc(int slot, int buffID) { if (Main.player[Main.myPlayer].hideMisc[slot]) return; bool flag = Main.player[Main.myPlayer].miscEquips[slot].buffType == buffID; if (!flag && (buffID == 102 || buffID == 101)) flag = Main.player[Main.myPlayer].miscEquips[slot].buffType == 27; if (!flag) return; Main.player[Main.myPlayer].hideMisc[slot] = true; } private static void DrawInterface_Resources_Breath() { bool flag = false; if (Main.player[Main.myPlayer].dead) return; if (Main.player[Main.myPlayer].lavaTime < Main.player[Main.myPlayer].lavaMax && Main.player[Main.myPlayer].lavaWet) flag = true; else if (Main.player[Main.myPlayer].lavaTime < Main.player[Main.myPlayer].lavaMax && Main.player[Main.myPlayer].breath == Main.player[Main.myPlayer].breathMax) flag = true; Vector2 vector2_1 = Main.player[Main.myPlayer].Top + new Vector2(0.0f, Main.player[Main.myPlayer].gfxOffY); if (Main.playerInventory && Main.screenHeight < 1000) vector2_1.Y += (float) (Main.player[Main.myPlayer].height - 20); Vector2 vector2_2 = Vector2.Transform(vector2_1 - Main.screenPosition, Main.GameViewMatrix.ZoomMatrix); if (!Main.playerInventory || Main.screenHeight >= 1000) vector2_2.Y -= 100f; Vector2 vector2_3 = vector2_2 / Main.UIScale; if (Main.ingameOptionsWindow || Main.InGameUI.IsVisible) { vector2_3 = new Vector2((float) (Main.screenWidth / 2), (float) (Main.screenHeight / 2 + 236)); if (Main.InGameUI.IsVisible) vector2_3.Y = (float) (Main.screenHeight - 64); } if (Main.player[Main.myPlayer].breath < Main.player[Main.myPlayer].breathMax && !Main.player[Main.myPlayer].ghost && !flag) { int num1 = Main.player[Main.myPlayer].breathMax / 20; int num2 = 20; for (int index = 1; index < Main.player[Main.myPlayer].breathMax / num2 + 1; ++index) { float scale = 1f; int num3; if (Main.player[Main.myPlayer].breath >= index * num2) { num3 = (int) byte.MaxValue; } else { float num4 = (float) (Main.player[Main.myPlayer].breath - (index - 1) * num2) / (float) num2; num3 = (int) (30.0 + 225.0 * (double) num4); if (num3 < 30) num3 = 30; scale = (float) ((double) num4 / 4.0 + 0.75); if ((double) scale < 0.75) scale = 0.75f; } int num5 = 0; int num6 = 0; if (index > 10) { num5 -= 260; num6 += 26; } Main.spriteBatch.Draw(TextureAssets.Bubble.Value, vector2_3 + new Vector2((float) (26 * (index - 1) + num5) - 125f, (float) (32.0 + ((double) TextureAssets.Bubble.Height() - (double) TextureAssets.Bubble.Height() * (double) scale) / 2.0) + (float) num6), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Bubble.Width(), TextureAssets.Bubble.Height())), new Microsoft.Xna.Framework.Color(num3, num3, num3, num3), 0.0f, new Vector2(), scale, SpriteEffects.None, 0.0f); } } if (((Main.player[Main.myPlayer].lavaTime >= Main.player[Main.myPlayer].lavaMax ? 0 : (!Main.player[Main.myPlayer].ghost ? 1 : 0)) & (flag ? 1 : 0)) == 0) return; int num7 = Main.player[Main.myPlayer].lavaMax / 10; int num8 = Main.player[Main.myPlayer].breathMax / num7; for (int index = 1; index < Main.player[Main.myPlayer].lavaMax / num7 + 1; ++index) { float scale = 1f; int num9; if (Main.player[Main.myPlayer].lavaTime >= index * num7) { num9 = (int) byte.MaxValue; } else { float num10 = (float) (Main.player[Main.myPlayer].lavaTime - (index - 1) * num7) / (float) num7; num9 = (int) (30.0 + 225.0 * (double) num10); if (num9 < 30) num9 = 30; scale = (float) ((double) num10 / 4.0 + 0.75); if ((double) scale < 0.75) scale = 0.75f; } int num11 = 0; int num12 = 0; if (index > 10) { num11 -= 260; num12 += 26; } Main.spriteBatch.Draw(TextureAssets.Flame.Value, vector2_3 + new Vector2((float) (26 * (index - 1) + num11) - 125f, (float) (32.0 + ((double) TextureAssets.Flame.Height() - (double) TextureAssets.Flame.Height() * (double) scale) / 2.0) + (float) num12), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Bubble.Width(), TextureAssets.Bubble.Height())), new Microsoft.Xna.Framework.Color(num9, num9, num9, num9), 0.0f, new Vector2(), scale, SpriteEffects.None, 0.0f); } } private static void DrawInterface_Resources_GolfPower() { Projectile golfHelper = (Projectile) null; for (int index = 0; index < 1000; ++index) { Projectile projectile = Main.projectile[index]; if (projectile.active && projectile.owner == Main.myPlayer && projectile.type == 722) { golfHelper = projectile; break; } } if (golfHelper == null) return; Projectile golfBallForHelper = GolfHelper.FindGolfBallForHelper(golfHelper); if (golfBallForHelper == null) return; float relativeStrength = GolfHelper.CalculateShotStrength(golfHelper, (Entity) golfBallForHelper).RelativeStrength; if ((double) relativeStrength < 1.0 / 1000.0) return; Vector2 position = (Main.LocalPlayer.Bottom - Main.Camera.ScaledPosition) * Main.GameViewMatrix.Zoom / Main.UIScale; position.X -= 27f; position.Y += 14f; Main.spriteBatch.Draw(TextureAssets.GolfSwingBarPanel.Value, position, new Microsoft.Xna.Framework.Rectangle?(), Microsoft.Xna.Framework.Color.White); Main.spriteBatch.Draw(TextureAssets.GolfSwingBarFill.Value, position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, (int) (54.0 * (double) relativeStrength), 14)), Microsoft.Xna.Framework.Color.White); } private static void DrawInterface_GolfBallIndicator() { if (!Item.IsAGolfingItem(Main.LocalPlayer.HeldItem)) return; Projectile lastHitBall = Main.LocalGolfState.GetLastHitBall(); if (lastHitBall == null || !GolfHelper.IsGolfBallResting(lastHitBall)) return; Vector2 vector2_1 = (lastHitBall.Top - Main.Camera.ScaledPosition) * Main.GameViewMatrix.Zoom / Main.UIScale; float num1 = MathHelper.Clamp((float) (((double) (Main.LocalPlayer.position - lastHitBall.position).Length() - 150.0) / 50.0), 0.0f, 1f); Vector2 vector2_2 = Vector2.Clamp(vector2_1, new Vector2(20f), Main.Camera.UnscaledSize - new Vector2(20f)); float rotation = 0.0f; if (vector2_2 != vector2_1) rotation = (vector2_2 - vector2_1).ToRotation() + 1.570796f; Vector2 position = vector2_2 - (rotation + 1.570796f).ToRotationVector2() * (float) ((Math.Sin((double) Main.GlobalTimeWrappedHourly * 4.0) * 0.5 + 0.5) * 5.0 + 14.0); Texture2D texture2D = TextureAssets.GolfBallArrow.Value; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(2); Vector2 origin = r.Size() * new Vector2(0.5f, 1f); Microsoft.Xna.Framework.Rectangle rectangle = texture2D.Frame(2, frameX: 1); Main.spriteBatch.Draw(TextureAssets.GolfBallArrowShadow.Value, position + new Vector2(-4f, 4f) * 1.5f, new Microsoft.Xna.Framework.Rectangle?(r), Microsoft.Xna.Framework.Color.White * num1, rotation, origin, 1.5f, SpriteEffects.None, 0.0f); float amount = (float) (Math.Sin((double) Main.GlobalTimeWrappedHourly * 4.0) * 0.5 + 0.5); for (float num2 = 0.0f; (double) num2 < 1.0; num2 += 0.25f) Main.spriteBatch.Draw(texture2D, position + (6.283185f * num2 + rotation).ToRotationVector2() * MathHelper.Lerp(2f, 2f, amount), new Microsoft.Xna.Framework.Rectangle?(rectangle), Microsoft.Xna.Framework.Color.Black * num1 * MathHelper.Lerp(1f, 1f, amount), rotation, origin, 1.5f, SpriteEffects.None, 0.0f); for (float num3 = 0.0f; (double) num3 < 1.0; num3 += 0.25f) Main.spriteBatch.Draw(texture2D, position + (6.283185f * num3 + rotation).ToRotationVector2() * MathHelper.Lerp(0.0f, 0.0f, amount), new Microsoft.Xna.Framework.Rectangle?(rectangle), Microsoft.Xna.Framework.Color.White * num1 * MathHelper.Lerp(0.8f, 0.8f, amount), rotation, origin, 1.5f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(r), Main.mouseColor * num1, rotation, origin, 1.5f, SpriteEffects.None, 0.0f); } protected void GUIHotbarDrawInner() { if (Main.playerInventory || Main.player[Main.myPlayer].ghost) return; string str = Lang.inter[37].Value; if (Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].Name != null && Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].Name != "") str = Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].AffixName(); Vector2 vector2 = FontAssets.MouseText.Value.MeasureString(str) / 2f; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, str, new Vector2(236f - vector2.X, 0.0f), new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); int num1 = 20; for (int slot = 0; slot < 10; ++slot) { if (slot == Main.player[Main.myPlayer].selectedItem) { if ((double) Main.hotbarScale[slot] < 1.0) Main.hotbarScale[slot] += 0.05f; } else if ((double) Main.hotbarScale[slot] > 0.75) Main.hotbarScale[slot] -= 0.05f; float num2 = Main.hotbarScale[slot]; int num3 = (int) (20.0 + 22.0 * (1.0 - (double) num2)); Microsoft.Xna.Framework.Color lightColor = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) (75.0 + 150.0 * (double) num2)); if (!Main.player[Main.myPlayer].hbLocked && !PlayerInput.IgnoreMouseInterface && Main.mouseX >= num1 && (double) Main.mouseX <= (double) num1 + (double) TextureAssets.InventoryBack.Width() * (double) Main.hotbarScale[slot] && Main.mouseY >= num3 && (double) Main.mouseY <= (double) num3 + (double) TextureAssets.InventoryBack.Height() * (double) Main.hotbarScale[slot] && !Main.player[Main.myPlayer].channel) { Main.player[Main.myPlayer].mouseInterface = true; Main.player[Main.myPlayer].cursorItemIconEnabled = false; if (Main.mouseLeft && !Main.player[Main.myPlayer].hbLocked && !Main.blockMouse) Main.player[Main.myPlayer].changeItem = slot; Main.hoverItemName = Main.player[Main.myPlayer].inventory[slot].AffixName(); if (Main.player[Main.myPlayer].inventory[slot].stack > 1) Main.hoverItemName = Main.hoverItemName + " (" + (object) Main.player[Main.myPlayer].inventory[slot].stack + ")"; Main.rare = Main.player[Main.myPlayer].inventory[slot].rare; } double inventoryScale = (double) Main.inventoryScale; Main.inventoryScale = num2; ItemSlot.Draw(Main.spriteBatch, Main.player[Main.myPlayer].inventory, 13, slot, new Vector2((float) num1, (float) num3), lightColor); Main.inventoryScale = (float) inventoryScale; num1 += (int) ((double) TextureAssets.InventoryBack.Width() * (double) Main.hotbarScale[slot]) + 4; } int selectedItem = Main.player[Main.myPlayer].selectedItem; if (selectedItem < 10 || selectedItem == 58 && Main.mouseItem.type <= 0) return; float num4 = 1f; int num5 = (int) (20.0 + 22.0 * (1.0 - (double) num4)); Microsoft.Xna.Framework.Color lightColor1 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) (75.0 + 150.0 * (double) num4)); double inventoryScale1 = (double) Main.inventoryScale; Main.inventoryScale = num4; ItemSlot.Draw(Main.spriteBatch, Main.player[Main.myPlayer].inventory, 13, selectedItem, new Vector2((float) num1, (float) num5), lightColor1); Main.inventoryScale = (float) inventoryScale1; } public static void OpenHairWindow() { Main.hBar = -1f; Main.lBar = -1f; Main.sBar = -1f; Main.playerInventory = false; Main.npcChatText = ""; Main.oldHairStyle = Main.player[Main.myPlayer].hair; Main.oldHairColor = Main.player[Main.myPlayer].hairColor; Main.hairWindow = true; SoundEngine.PlaySound(10); } public static void CancelHairWindow() { if (!Main.hairWindow) return; Main.player[Main.myPlayer].hair = Main.oldHairStyle; Main.player[Main.myPlayer].hairColor = Main.oldHairColor; Main.hairWindow = false; if (Main.player[Main.myPlayer].talkNPC > -1 && Main.npc[Main.player[Main.myPlayer].talkNPC].type == 353) Main.player[Main.myPlayer].SetTalkNPC(-1); SoundEngine.PlaySound(11); } public static void BuyHairWindow() { SoundEngine.PlaySound(18); Main.hairWindow = false; Main.player[Main.myPlayer].SetTalkNPC(-1); Main.npcChatCornerItem = 0; NetMessage.SendData(4, number: Main.myPlayer); } public static int UnlockedMaxHair() { int num = 151; if (NPC.downedMartians) num += 10; if (NPC.downedMartians && NPC.downedMoonlord) ++num; return num; } protected void DrawHairWindow() { if (Main.npcChatText != "" || Main.playerInventory || Main.player[Main.myPlayer].chest != -1 || Main.npcShop != 0 || Main.player[Main.myPlayer].talkNPC == -1 || Main.InGuideCraftMenu) { Main.CancelHairWindow(); } else { Main.Hairstyles.UpdateUnlocks(); int count = Main.Hairstyles.AvailableHairstyles.Count; int y1 = Main.screenHeight / 2 + 60; int x1 = Main.screenWidth / 2 - TextureAssets.HairStyleBack.Width() / 2; int num1 = y1 + 42; int num2 = x1 + 22; int num3 = x1 + 234; int num4 = y1 + 18; Main.selColor = Main.player[Main.myPlayer].hairColor; Main.spriteBatch.Draw(TextureAssets.HairStyleBack.Value, new Vector2((float) x1, (float) y1), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.HairStyleBack.Width(), TextureAssets.HairStyleBack.Height())), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); if (new Microsoft.Xna.Framework.Rectangle(x1, y1, TextureAssets.HairStyleBack.Width(), TextureAssets.HairStyleBack.Height()).Contains(Main.MouseScreen.ToPoint())) { int num5 = -(PlayerInput.ScrollWheelDelta / 120); int num6 = Math.Sign(num5); for (; num5 != 0; num5 -= num6) { if (num5 < 0) { Main.hairStart -= 5; SoundEngine.PlaySound(12); } else { Main.hairStart += 5; SoundEngine.PlaySound(12); } } } if (Main.mouseX > x1 && Main.mouseX < x1 + TextureAssets.HairStyleBack.Width() && Main.mouseY > y1 && Main.mouseY < y1 + TextureAssets.HairStyleBack.Height()) Main.player[Main.myPlayer].mouseInterface = true; int num7 = num3 - 18; int num8 = num4 + 74; if (Main.hairStart > 1) { if (Main.mouseX >= num7 && Main.mouseX <= num7 + TextureAssets.CraftUpButton.Width() && Main.mouseY >= num8 && Main.mouseY <= num8 + TextureAssets.CraftUpButton.Height()) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft) { Main.hairStart -= 15; SoundEngine.PlaySound(12); } } Main.spriteBatch.Draw(TextureAssets.ScrollLeftButton.Value, new Vector2((float) num7, (float) num8), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.CraftUpButton.Width(), TextureAssets.CraftUpButton.Height())), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (Main.hairStart + 15 < count) { int num9 = num7 + 296; if (Main.mouseX >= num9 && Main.mouseX <= num9 + TextureAssets.CraftUpButton.Width() && Main.mouseY >= num8 && Main.mouseY <= num8 + TextureAssets.CraftUpButton.Height()) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft) { Main.hairStart += 15; SoundEngine.PlaySound(12); } } Main.spriteBatch.Draw(TextureAssets.ScrollRightButton.Value, new Vector2((float) num9, (float) num8), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.CraftUpButton.Width(), TextureAssets.CraftUpButton.Height())), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (Main.hairStart + 15 >= count) Main.hairStart = count - 15; if (Main.hairStart < 0) Main.hairStart = 0; int num10 = 0; if (Main.oldHairStyle != Main.player[Main.myPlayer].hair) { if (Main.player[Main.myPlayer].hair > 51) num10 += 200000; else num10 += 20000; } if (Main.oldHairColor != Main.player[Main.myPlayer].hairColor) num10 += 20000; int num11 = (int) Math.Round((double) (int) ((double) num10 * Main.player[Main.myPlayer].currentShoppingSettings.PriceAdjustment) / 10000.0) * 10000; string str1 = ""; int num12 = 0; int num13 = 0; int num14 = 0; int num15 = 0; int num16 = num11; if (num16 < 0) num16 = 0; int price = num16; if (num16 >= 1000000) { num12 = num16 / 1000000; num16 -= num12 * 1000000; } if (num16 >= 10000) { num13 = num16 / 10000; num16 -= num13 * 10000; } if (num16 >= 100) { num14 = num16 / 100; num16 -= num14 * 100; } if (num16 >= 1) num15 = num16; if (num12 > 0) str1 = str1 + (object) num12 + " " + Lang.inter[15].Value + " "; if (num13 > 0) str1 = str1 + (object) num13 + " " + Lang.inter[16].Value + " "; if (num14 > 0) str1 = str1 + (object) num14 + " " + Lang.inter[17].Value + " "; if (num15 > 0) str1 = str1 + (object) num15 + " " + Lang.inter[18].Value + " "; string textValue1 = Language.GetTextValue("GameUI.BuyWithValue", (object) str1); if (price == 0) textValue1 = Language.GetTextValue("GameUI.Buy"); int num17 = ((int) Main.mouseTextColor * 2 + (int) byte.MaxValue) / 3; Microsoft.Xna.Framework.Color color1 = new Microsoft.Xna.Framework.Color(num17, (int) ((double) num17 / 1.1), num17 / 2, num17); float num18 = 0.9f; string str2 = textValue1; int num19 = x1 + 18; int num20 = y1 + 156; bool flag1 = false; if (price > 0) ItemSlot.DrawSavings(Main.spriteBatch, (float) num19, (float) (num20 - 70), true); if (price > 0 && Main.mouseX > num19 && (double) Main.mouseX < (double) num19 + (double) FontAssets.MouseText.Value.MeasureString(str2).X && Main.mouseY > num20 && (double) Main.mouseY < (double) num20 + (double) FontAssets.MouseText.Value.MeasureString(str2).Y) { flag1 = true; num18 = 1.1f; if (!Main.npcChatFocus1) SoundEngine.PlaySound(12); Main.npcChatFocus1 = true; Main.player[Main.myPlayer].releaseUseItem = false; } else { if (Main.npcChatFocus1) SoundEngine.PlaySound(12); Main.npcChatFocus1 = false; } Vector2 vector2_1 = FontAssets.MouseText.Value.MeasureString(str2) * 0.5f; UILinkPointNavigator.SetPosition(2603, new Vector2((float) num19, (float) num20) + vector2_1); for (int index = 0; index < 5; ++index) { int num21 = num19; int num22 = num20; Microsoft.Xna.Framework.Color color2 = Microsoft.Xna.Framework.Color.Black; if (flag1) color2 = Microsoft.Xna.Framework.Color.Brown; if (index == 0) num21 -= 2; if (index == 1) num21 += 2; if (index == 2) num22 -= 2; if (index == 3) num22 += 2; if (index == 4) color2 = price != 0 ? color1 : new Microsoft.Xna.Framework.Color(100, 100, 100); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, str2, new Vector2((float) num21 + vector2_1.X, (float) num22 + vector2_1.Y), color2, 0.0f, vector2_1, num18, SpriteEffects.None, 0.0f); } float num23 = 0.9f; string textValue2 = Language.GetTextValue("GameUI.Cancel"); int num24 = num19 + 130; bool flag2 = false; if (Main.mouseX > num24 && (double) Main.mouseX < (double) num24 + (double) FontAssets.MouseText.Value.MeasureString(textValue2).X && Main.mouseY > num20 && (double) Main.mouseY < (double) num20 + (double) FontAssets.MouseText.Value.MeasureString(textValue2).Y) { flag2 = true; num23 = 1.1f; if (!Main.npcChatFocus2) SoundEngine.PlaySound(12); Main.npcChatFocus2 = true; Main.player[Main.myPlayer].releaseUseItem = false; } else { if (Main.npcChatFocus2) SoundEngine.PlaySound(12); Main.npcChatFocus2 = false; } Vector2 vector2_2 = FontAssets.MouseText.Value.MeasureString(textValue2) * 0.5f; UILinkPointNavigator.SetPosition(2604, new Vector2((float) num24, (float) num20) + vector2_2); for (int index = 0; index < 5; ++index) { int num25 = num24; int num26 = num20; Microsoft.Xna.Framework.Color color3 = Microsoft.Xna.Framework.Color.Black; if (flag2) color3 = Microsoft.Xna.Framework.Color.Brown; if (index == 0) num25 -= 2; if (index == 1) num25 += 2; if (index == 2) num26 -= 2; if (index == 3) num26 += 2; if (index == 4) color3 = color1; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, textValue2, new Vector2((float) num25 + vector2_2.X, (float) num26 + vector2_2.Y), color3, 0.0f, vector2_2, num23, SpriteEffects.None, 0.0f); } if (Main.mouseLeft && Main.mouseLeftRelease) { if (Main.npcChatFocus1) { if (Main.player[Main.myPlayer].BuyItem(price)) { Main.BuyHairWindow(); return; } } else if (Main.npcChatFocus2) { Main.CancelHairWindow(); return; } } if (!Main.mouseLeft) { this.grabColorSlider = 0; Main.blockMouse = false; } int num27 = 167; Vector3 hsl = Main.rgbToHsl(Main.selColor); float Hue = hsl.X; float Saturation1 = hsl.Y; float Luminosity1 = hsl.Z; float num28 = (float) Main.selColor.A / (float) byte.MaxValue; if ((double) Main.hBar == -1.0 || (double) Main.sBar == -1.0 || (double) Main.lBar == -1.0 || (double) Main.aBar == -1.0) { Main.hBar = Hue; Main.sBar = Saturation1; Main.lBar = Luminosity1; Main.aBar = (float) Main.selColor.A / (float) byte.MaxValue; } else { Hue = Main.hBar; Saturation1 = Main.sBar; Luminosity1 = Main.lBar; Main.aBar = num28; } UILinkPointNavigator.SetPosition(2600, new Vector2((float) num2, (float) num1) + TextureAssets.Hue.Value.Size() / 2f); Main.spriteBatch.Draw(TextureAssets.Hue.Value, new Vector2((float) num2, (float) num1), Microsoft.Xna.Framework.Color.White); if (Main.mouseX > num2 - 4 && Main.mouseX < num2 + TextureAssets.Hue.Width() + 4 && Main.mouseY > num1 - 4 && Main.mouseY < num1 + TextureAssets.Hue.Height() + 4 || this.grabColorSlider == 1) Main.spriteBatch.Draw(TextureAssets.ColorHighlight.Value, new Vector2((float) num2, (float) num1), Main.OurFavoriteColor); Main.spriteBatch.Draw(TextureAssets.ColorSlider.Value, new Vector2((float) num2 + (float) (TextureAssets.Hue.Width() - 2) * Main.hBar - (float) (TextureAssets.ColorSlider.Width() / 2), (float) (num1 - TextureAssets.ColorSlider.Height() / 2 + TextureAssets.Hue.Height() / 2)), Microsoft.Xna.Framework.Color.White); if ((Main.mouseX > num2 - 4 && Main.mouseX < num2 + TextureAssets.Hue.Width() + 4 && Main.mouseY > num1 - 4 && Main.mouseY < num1 + TextureAssets.Hue.Height() + 4 || this.grabColorSlider == 1) && Main.mouseLeft && !Main.blockMouse) { this.grabColorSlider = 1; Hue = (float) (Main.mouseX - num2) / (float) TextureAssets.Hue.Width(); if ((double) Hue < 0.0) Hue = 0.0f; if ((double) Hue > 1.0) Hue = 1f; Main.hBar = Hue; } int num29 = num1 + 26; UILinkPointNavigator.SetPosition(2601, new Vector2((float) num2, (float) num29) + TextureAssets.ColorBar.Value.Size() / 2f); Main.spriteBatch.Draw(TextureAssets.ColorBar.Value, new Vector2((float) num2, (float) num29), Microsoft.Xna.Framework.Color.White); for (int index = 0; index <= num27; ++index) { float Saturation2 = (float) index / (float) num27; Microsoft.Xna.Framework.Color rgb = Main.hslToRgb(Hue, Saturation2, Luminosity1); Main.spriteBatch.Draw(TextureAssets.ColorBlip.Value, new Vector2((float) (num2 + index + 5), (float) (num29 + 4)), rgb); } if (Main.mouseX > num2 - 4 && Main.mouseX < num2 + TextureAssets.Hue.Width() + 4 && Main.mouseY > num29 - 4 && Main.mouseY < num29 + TextureAssets.Hue.Height() + 4 || this.grabColorSlider == 2) Main.spriteBatch.Draw(TextureAssets.ColorHighlight.Value, new Vector2((float) num2, (float) num29), Main.OurFavoriteColor); Main.spriteBatch.Draw(TextureAssets.ColorSlider.Value, new Vector2((float) num2 + (float) (TextureAssets.Hue.Width() - 2) * Main.sBar - (float) (TextureAssets.ColorSlider.Width() / 2), (float) (num29 - TextureAssets.ColorSlider.Height() / 2 + TextureAssets.Hue.Height() / 2)), Microsoft.Xna.Framework.Color.White); if ((Main.mouseX > num2 - 4 && Main.mouseX < num2 + TextureAssets.Hue.Width() + 4 && Main.mouseY > num29 - 4 && Main.mouseY < num29 + TextureAssets.Hue.Height() + 4 || this.grabColorSlider == 2) && Main.mouseLeft && !Main.blockMouse) { this.grabColorSlider = 2; Saturation1 = (float) (Main.mouseX - num2) / (float) TextureAssets.Hue.Width(); if ((double) Saturation1 < 0.0) Saturation1 = 0.0f; if ((double) Saturation1 > 1.0) Saturation1 = 1f; Main.sBar = Saturation1; } int num30 = num29 + 26; UILinkPointNavigator.SetPosition(2602, new Vector2((float) num2, (float) num30) + TextureAssets.ColorBar.Value.Size() / 2f); Main.spriteBatch.Draw(TextureAssets.ColorBar.Value, new Vector2((float) num2, (float) num30), Microsoft.Xna.Framework.Color.White); float num31 = 0.15f; for (int index = 0; index <= num27; ++index) { float Luminosity2 = (float) index / (float) num27; Microsoft.Xna.Framework.Color rgb = Main.hslToRgb(Hue, Saturation1, Luminosity2); Main.spriteBatch.Draw(TextureAssets.ColorBlip.Value, new Vector2((float) (num2 + index + 5), (float) (num30 + 4)), rgb); } if (Main.mouseX > num2 - 4 && Main.mouseX < num2 + TextureAssets.Hue.Width() + 4 && Main.mouseY > num30 - 4 && Main.mouseY < num30 + TextureAssets.Hue.Height() + 4 || this.grabColorSlider == 3) Main.spriteBatch.Draw(TextureAssets.ColorHighlight.Value, new Vector2((float) num2, (float) num30), Main.OurFavoriteColor); Main.spriteBatch.Draw(TextureAssets.ColorSlider.Value, new Vector2((float) num2 + (float) (TextureAssets.Hue.Width() - 2) * (float) (((double) Main.lBar - (double) num31) / (1.0 - (double) num31)) - (float) (TextureAssets.ColorSlider.Width() / 2), (float) (num30 - TextureAssets.ColorSlider.Height() / 2 + TextureAssets.Hue.Height() / 2)), Microsoft.Xna.Framework.Color.White); if ((Main.mouseX > num2 - 4 && Main.mouseX < num2 + TextureAssets.Hue.Width() + 4 && Main.mouseY > num30 - 4 && Main.mouseY < num30 + TextureAssets.Hue.Height() + 4 || this.grabColorSlider == 3) && Main.mouseLeft && !Main.blockMouse) { this.grabColorSlider = 3; float num32 = (float) (Main.mouseX - num2) / (float) TextureAssets.Hue.Width(); if ((double) num32 < 0.0) num32 = 0.0f; if ((double) num32 > 1.0) num32 = 1f; Main.lBar = num32 * (1f - num31) + num31; } Main.selColor = Main.hslToRgb(Main.hBar, Main.sBar, Main.lBar); Main.player[Main.myPlayer].hairColor = Main.selColor; int x2 = num3; int y2 = num4; int hairStart = Main.hairStart; int index1 = 0; int num33 = 0; for (int index2 = 0; index2 < 15; ++index2) { int availableHairstyle = Main.Hairstyles.AvailableHairstyles[Main.hairStart + index2]; UILinkPointNavigator.SetPosition(2605 + index2, new Vector2((float) x2, (float) y2) + TextureAssets.InventoryBack.Value.Size() * 0.75f); if (Main.player[Main.myPlayer].hair == availableHairstyle) Main.spriteBatch.Draw(TextureAssets.InventoryBack14.Value, new Vector2((float) x2, (float) y2), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.InventoryBack.Width(), TextureAssets.InventoryBack.Height())), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); else Main.spriteBatch.Draw(TextureAssets.InventoryBack8.Value, new Vector2((float) x2, (float) y2), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.InventoryBack.Width(), TextureAssets.InventoryBack.Height())), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); if ((Main.mouseX <= x2 || Main.mouseX >= x2 + TextureAssets.InventoryBack.Width() || Main.mouseY <= y2 ? 0 : (Main.mouseY < y2 + TextureAssets.InventoryBack.Height() ? 1 : 0)) != 0) { Asset asset = Main.Assets.Request("Images/UI/PanelBorder", (AssetRequestMode) 1); Utils.DrawSplicedPanel(Main.spriteBatch, asset.Value, x2, y2, TextureAssets.InventoryBack.Width(), TextureAssets.InventoryBack.Height(), asset.Width() / 2 - 1, asset.Width() / 2 - 1, asset.Height() / 2 - 1, asset.Height() / 2 - 1, Main.OurFavoriteColor); if (Main.mouseLeft && Main.mouseLeftRelease) { Main.mouseLeftRelease = false; Main.player[Main.myPlayer].hair = availableHairstyle; SoundEngine.PlaySound(12); } } this.LoadHair(availableHairstyle); float x3 = (float) (x2 + TextureAssets.InventoryBack.Width() / 2 - TextureAssets.PlayerHair[availableHairstyle].Width() / 2); float y3 = (float) (y2 + 4); Main.spriteBatch.Draw(TextureAssets.Players[index1, 0].Value, new Vector2(x3, y3), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.PlayerHair[availableHairstyle].Width(), 56)), Main.player[Main.myPlayer].skinColor, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.Players[index1, 1].Value, new Vector2(x3, y3), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.PlayerHair[availableHairstyle].Width(), 56)), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.Players[index1, 2].Value, new Vector2(x3, y3), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.PlayerHair[availableHairstyle].Width(), 56)), Main.player[Main.myPlayer].eyeColor, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.PlayerHair[availableHairstyle].Value, new Vector2(x3, y3), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.PlayerHair[availableHairstyle].Width(), 56)), Main.selColor, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); ++num33; x2 += 56; if (num33 >= 5) { num33 = 0; x2 = num3; y2 += 56; } } } } public static void OpenClothesWindow() { if (Main.clothesWindow) { Main.CancelClothesWindow(); } else { Main.hBar = -1f; Main.lBar = -1f; Main.sBar = -1f; Main.playerInventory = false; Main.npcChatText = ""; Main.clothesWindow = true; SoundEngine.PlaySound(10); Main.selClothes = 0; Main.oldClothesColor[0] = Main.player[Main.myPlayer].shirtColor; Main.oldClothesColor[1] = Main.player[Main.myPlayer].underShirtColor; Main.oldClothesColor[2] = Main.player[Main.myPlayer].pantsColor; Main.oldClothesColor[3] = Main.player[Main.myPlayer].shoeColor; Main.oldClothesColor[4] = Main.player[Main.myPlayer].eyeColor; Main.oldClothesColor[5] = Main.player[Main.myPlayer].skinColor; if (Main.dresserInterfaceDummy == null) Main.dresserInterfaceDummy = new Player(); Main.oldClothesStyle = Main.player[Main.myPlayer].skinVariant; } } public static void CancelClothesWindow(bool quiet = false) { if (!Main.clothesWindow) return; Main.clothesWindow = false; if (!quiet) SoundEngine.PlaySound(11); Main.player[Main.myPlayer].shirtColor = Main.oldClothesColor[0]; Main.player[Main.myPlayer].underShirtColor = Main.oldClothesColor[1]; Main.player[Main.myPlayer].pantsColor = Main.oldClothesColor[2]; Main.player[Main.myPlayer].shoeColor = Main.oldClothesColor[3]; Main.player[Main.myPlayer].eyeColor = Main.oldClothesColor[4]; Main.player[Main.myPlayer].skinColor = Main.oldClothesColor[5]; Main.dresserInterfaceDummy.skinVariant = Main.oldClothesStyle; Main.dresserInterfaceDummy.Male = Main.player[Main.myPlayer].Male; Main.player[Main.myPlayer].skinVariant = Main.dresserInterfaceDummy.skinVariant; } public static void SaveClothesWindow() { SoundEngine.PlaySound(7); Main.clothesWindow = false; NetMessage.SendData(4, number: Main.myPlayer); } protected void DrawClothesWindow() { if (Main.npcChatText != "" || Main.playerInventory || Main.player[Main.myPlayer].chest != -1 || Main.npcShop != 0 || Main.player[Main.myPlayer].talkNPC != -1 || Main.InGuideCraftMenu) Main.CancelClothesWindow(); else if (!Main.LocalPlayer.IsInInteractionRangeToMultiTileHitbox(Main.interactedDresserTopLeftX, Main.interactedDresserTopLeftY) || !Main.tile[Main.interactedDresserTopLeftX, Main.interactedDresserTopLeftY].active()) { Main.CancelClothesWindow(); } else { int num1 = 477 / 2; int num2 = 180; int num3 = 511; int width = num3 - (num3 / 2 - num2 - 26); int y1 = Main.screenHeight / 2 + 60; int x1 = Main.screenWidth / 2 - width / 2; int num4 = y1 + 32; int num5 = x1 + 22; int num6 = num4 - 16; int num7 = x1 + width - num2; int num8 = y1 + 18; if (Main.selClothes == 0) Main.selColor = Main.player[Main.myPlayer].shirtColor; if (Main.selClothes == 1) Main.selColor = Main.player[Main.myPlayer].underShirtColor; if (Main.selClothes == 2) Main.selColor = Main.player[Main.myPlayer].pantsColor; if (Main.selClothes == 3) Main.selColor = Main.player[Main.myPlayer].shoeColor; if (Main.selClothes == 4) Main.selColor = Main.player[Main.myPlayer].eyeColor; if (Main.selClothes == 5) Main.selColor = Main.player[Main.myPlayer].skinColor; Utils.DrawInvBG(Main.spriteBatch, new Microsoft.Xna.Framework.Rectangle(x1, y1, width, 133)); if (!PlayerInput.IgnoreMouseInterface && Main.mouseX > x1 && Main.mouseX < x1 + TextureAssets.ClothesStyleBack.Width() && Main.mouseY > y1 && Main.mouseY < y1 + TextureAssets.ClothesStyleBack.Height()) Main.player[Main.myPlayer].mouseInterface = true; Vector2 vector2_1 = new Vector2((float) (x1 + width / 2 - 16 - 28), (float) (y1 + 66 + Main.dresserInterfaceDummy.height / 2 - 20)); vector2_1.Y += 18f; vector2_1.X += 58f; Microsoft.Xna.Framework.Rectangle R = new Microsoft.Xna.Framework.Rectangle((int) vector2_1.X - Main.dresserInterfaceDummy.width / 2 - 15, (int) vector2_1.Y - Main.dresserInterfaceDummy.height - 33, Main.dresserInterfaceDummy.width + 30, Main.dresserInterfaceDummy.height + 66); bool flag1 = R.Contains(Main.MouseScreen.ToPoint()); int selClothes = Main.selClothes; int num9 = ((int) Main.mouseTextColor * 2 + (int) byte.MaxValue) / 3; Microsoft.Xna.Framework.Color color1 = new Microsoft.Xna.Framework.Color(num9, (int) ((double) num9 / 1.1), num9 / 2, num9); float num10 = 0.9f; string textValue1 = Language.GetTextValue("GameUI.Change"); int num11 = x1 + width - num2 + 22; int num12 = x1 + 22; int num13 = y1 + 94; bool flag2 = false; if (Main.oldClothesColor[0] != Main.player[Main.myPlayer].shirtColor || Main.oldClothesColor[1] != Main.player[Main.myPlayer].underShirtColor || Main.oldClothesColor[2] != Main.player[Main.myPlayer].pantsColor || Main.oldClothesColor[3] != Main.player[Main.myPlayer].shoeColor || Main.oldClothesColor[4] != Main.player[Main.myPlayer].eyeColor || Main.oldClothesColor[5] != Main.player[Main.myPlayer].skinColor || Main.oldClothesStyle != Main.player[Main.myPlayer].skinVariant) flag2 = true; Vector2 vector2_2 = FontAssets.MouseText.Value.MeasureString(textValue1); bool flag3 = false; UILinkPointNavigator.SetPosition(2803, new Vector2((float) num12, (float) num13) + vector2_2 * num10 * 0.5f); if (flag2 && Main.mouseX > num12 && (double) Main.mouseX < (double) num12 + (double) vector2_2.X && Main.mouseY > num13 && (double) Main.mouseY < (double) num13 + (double) vector2_2.Y) { flag3 = true; num10 = 1.1f; if (!Main.npcChatFocus1) SoundEngine.PlaySound(12); Main.npcChatFocus1 = true; Main.player[Main.myPlayer].releaseUseItem = false; } else { if (Main.npcChatFocus1) SoundEngine.PlaySound(12); Main.npcChatFocus1 = false; } for (int index = 0; index < 5; ++index) { int num14 = num12; int num15 = num13; Microsoft.Xna.Framework.Color color2 = Microsoft.Xna.Framework.Color.Black; if (flag3) color2 = Microsoft.Xna.Framework.Color.Brown; if (index == 0) num14 -= 2; if (index == 1) num14 += 2; if (index == 2) num15 -= 2; if (index == 3) num15 += 2; if (index == 4) color2 = flag2 ? color1 : new Microsoft.Xna.Framework.Color(100, 100, 100); Vector2 vector2_3 = FontAssets.MouseText.Value.MeasureString(textValue1) * 0.5f; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, textValue1, new Vector2((float) num14 + vector2_3.X, (float) num15 + vector2_3.Y), color2, 0.0f, vector2_3, num10, SpriteEffects.None, 0.0f); } float num16 = 0.9f; string textValue2 = Language.GetTextValue("GameUI.Cancel"); int num17 = num12 + 130; bool flag4 = false; Vector2 vector2_4 = FontAssets.MouseText.Value.MeasureString(textValue2); UILinkPointNavigator.SetPosition(2804, new Vector2((float) num17, (float) num13) + vector2_4 * num16 * 0.5f); if (Main.mouseX > num17 && (double) Main.mouseX < (double) num17 + (double) vector2_4.X && Main.mouseY > num13 && (double) Main.mouseY < (double) num13 + (double) vector2_4.Y) { flag4 = true; num16 = 1.1f; if (!Main.npcChatFocus2) SoundEngine.PlaySound(12); Main.npcChatFocus2 = true; Main.player[Main.myPlayer].releaseUseItem = false; } else { if (Main.npcChatFocus2) SoundEngine.PlaySound(12); Main.npcChatFocus2 = false; } for (int index = 0; index < 5; ++index) { int num18 = num17; int num19 = num13; Microsoft.Xna.Framework.Color color3 = Microsoft.Xna.Framework.Color.Black; if (flag4) color3 = Microsoft.Xna.Framework.Color.Brown; if (index == 0) num18 -= 2; if (index == 1) num18 += 2; if (index == 2) num19 -= 2; if (index == 3) num19 += 2; if (index == 4) color3 = color1; Vector2 vector2_5 = FontAssets.MouseText.Value.MeasureString(textValue2) * 0.5f; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, textValue2, new Vector2((float) num18 + vector2_5.X, (float) num19 + vector2_5.Y), color3, 0.0f, vector2_5, num16, SpriteEffects.None, 0.0f); } if (Main.mouseLeft && Main.mouseLeftRelease) { if (Main.npcChatFocus1) { Main.SaveClothesWindow(); return; } if (Main.npcChatFocus2) { Main.CancelClothesWindow(); return; } } if (!Main.mouseLeft) { this.grabColorSlider = 0; Main.blockMouse = false; } int num20 = 167; Vector3 hsl = Main.rgbToHsl(Main.selColor); float Hue = hsl.X; float Saturation1 = hsl.Y; float Luminosity1 = hsl.Z; if ((double) Main.hBar == -1.0 || (double) Main.sBar == -1.0 || (double) Main.lBar == -1.0) { Main.hBar = Hue; Main.sBar = Saturation1; Main.lBar = Luminosity1; } else { Hue = Main.hBar; Saturation1 = Main.sBar; Luminosity1 = Main.lBar; } Main.spriteBatch.Draw(TextureAssets.Hue.Value, new Vector2((float) num5, (float) num6), Microsoft.Xna.Framework.Color.White); if (Main.mouseX > num5 - 4 && Main.mouseX < num5 + TextureAssets.Hue.Width() + 4 && Main.mouseY > num6 - 4 && Main.mouseY < num6 + TextureAssets.Hue.Height() + 4 || this.grabColorSlider == 1) Main.spriteBatch.Draw(TextureAssets.ColorHighlight.Value, new Vector2((float) num5, (float) num6), Main.OurFavoriteColor); Main.spriteBatch.Draw(TextureAssets.ColorSlider.Value, new Vector2((float) num5 + (float) (TextureAssets.Hue.Width() - 2) * Main.hBar - (float) (TextureAssets.ColorSlider.Width() / 2), (float) (num6 - TextureAssets.ColorSlider.Height() / 2 + TextureAssets.Hue.Height() / 2)), Microsoft.Xna.Framework.Color.White); if ((Main.mouseX > num5 - 4 && Main.mouseX < num5 + TextureAssets.Hue.Width() + 4 && Main.mouseY > num6 - 4 && Main.mouseY < num6 + TextureAssets.Hue.Height() + 4 || this.grabColorSlider == 1) && Main.mouseLeft && !Main.blockMouse) { this.grabColorSlider = 1; Hue = (float) (Main.mouseX - num5) / (float) TextureAssets.Hue.Width(); if ((double) Hue < 0.0) Hue = 0.0f; if ((double) Hue > 1.0) Hue = 1f; Main.hBar = Hue; } UILinkPointNavigator.SetPosition(2800, new Vector2((float) num5, (float) num6) + TextureAssets.Hue.Value.Size() / 2f); int num21 = num6 + 26; Main.spriteBatch.Draw(TextureAssets.ColorBar.Value, new Vector2((float) num5, (float) num21), Microsoft.Xna.Framework.Color.White); for (int index = 0; index <= num20; ++index) { float Saturation2 = (float) index / (float) num20; Microsoft.Xna.Framework.Color rgb = Main.hslToRgb(Hue, Saturation2, Luminosity1); Main.spriteBatch.Draw(TextureAssets.ColorBlip.Value, new Vector2((float) (num5 + index + 5), (float) (num21 + 4)), rgb); } if (Main.mouseX > num5 - 4 && Main.mouseX < num5 + TextureAssets.Hue.Width() + 4 && Main.mouseY > num21 - 4 && Main.mouseY < num21 + TextureAssets.Hue.Height() + 4 || this.grabColorSlider == 2) Main.spriteBatch.Draw(TextureAssets.ColorHighlight.Value, new Vector2((float) num5, (float) num21), Main.OurFavoriteColor); Main.spriteBatch.Draw(TextureAssets.ColorSlider.Value, new Vector2((float) num5 + (float) (TextureAssets.Hue.Width() - 2) * Main.sBar - (float) (TextureAssets.ColorSlider.Width() / 2), (float) (num21 - TextureAssets.ColorSlider.Height() / 2 + TextureAssets.Hue.Height() / 2)), Microsoft.Xna.Framework.Color.White); if ((Main.mouseX > num5 - 4 && Main.mouseX < num5 + TextureAssets.Hue.Width() + 4 && Main.mouseY > num21 - 4 && Main.mouseY < num21 + TextureAssets.Hue.Height() + 4 || this.grabColorSlider == 2) && Main.mouseLeft && !Main.blockMouse) { this.grabColorSlider = 2; Saturation1 = (float) (Main.mouseX - num5) / (float) TextureAssets.Hue.Width(); if ((double) Saturation1 < 0.0) Saturation1 = 0.0f; if ((double) Saturation1 > 1.0) Saturation1 = 1f; Main.sBar = Saturation1; } UILinkPointNavigator.SetPosition(2801, new Vector2((float) num5, (float) num21) + TextureAssets.Hue.Value.Size() / 2f); int num22 = num21 + 26; Main.spriteBatch.Draw(TextureAssets.ColorBar.Value, new Vector2((float) num5, (float) num22), Microsoft.Xna.Framework.Color.White); float num23 = 0.15f; for (int index = 0; index <= num20; ++index) { float Luminosity2 = (float) index / (float) num20; Microsoft.Xna.Framework.Color rgb = Main.hslToRgb(Hue, Saturation1, Luminosity2); Main.spriteBatch.Draw(TextureAssets.ColorBlip.Value, new Vector2((float) (num5 + index + 5), (float) (num22 + 4)), rgb); } if (Main.mouseX > num5 - 4 && Main.mouseX < num5 + TextureAssets.Hue.Width() + 4 && Main.mouseY > num22 - 4 && Main.mouseY < num22 + TextureAssets.Hue.Height() + 4 || this.grabColorSlider == 3) Main.spriteBatch.Draw(TextureAssets.ColorHighlight.Value, new Vector2((float) num5, (float) num22), Main.OurFavoriteColor); Main.spriteBatch.Draw(TextureAssets.ColorSlider.Value, new Vector2((float) num5 + (float) (TextureAssets.Hue.Width() - 2) * (float) (((double) Main.lBar - (double) num23) / (1.0 - (double) num23)) - (float) (TextureAssets.ColorSlider.Width() / 2), (float) (num22 - TextureAssets.ColorSlider.Height() / 2 + TextureAssets.Hue.Height() / 2)), Microsoft.Xna.Framework.Color.White); if ((Main.mouseX > num5 - 4 && Main.mouseX < num5 + TextureAssets.Hue.Width() + 4 && Main.mouseY > num22 - 4 && Main.mouseY < num22 + TextureAssets.Hue.Height() + 4 || this.grabColorSlider == 3) && Main.mouseLeft && !Main.blockMouse) { this.grabColorSlider = 3; float num24 = (float) (Main.mouseX - num5) / (float) TextureAssets.Hue.Width(); if ((double) num24 < 0.0) num24 = 0.0f; if ((double) num24 > 1.0) num24 = 1f; Main.lBar = num24 * (1f - num23) + num23; } UILinkPointNavigator.SetPosition(2802, new Vector2((float) num5, (float) num22) + TextureAssets.Hue.Value.Size() / 2f); Main.selColor = Main.hslToRgb(Main.hBar, Main.sBar, Main.lBar); if (Main.selClothes == 0) Main.player[Main.myPlayer].shirtColor = Main.selColor; if (Main.selClothes == 1) Main.player[Main.myPlayer].underShirtColor = Main.selColor; if (Main.selClothes == 2) Main.player[Main.myPlayer].pantsColor = Main.selColor; if (Main.selClothes == 3) Main.player[Main.myPlayer].shoeColor = Main.selColor; if (Main.selClothes == 4) Main.player[Main.myPlayer].eyeColor = Main.selColor; if (Main.selClothes == 5) Main.player[Main.myPlayer].skinColor = Main.selColor; int num25 = num7; int num26 = num8 - 8; for (int index = 0; index < 6; ++index) { if (selClothes == index) Main.spriteBatch.Draw(TextureAssets.InventoryBack14.Value, new Vector2((float) num25, (float) num26), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.InventoryBack.Width(), TextureAssets.InventoryBack.Height())), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); else Main.spriteBatch.Draw(TextureAssets.InventoryBack8.Value, new Vector2((float) num25, (float) num26), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.InventoryBack.Width(), TextureAssets.InventoryBack.Height())), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); if (Main.mouseX > num25 && Main.mouseX < num25 + TextureAssets.InventoryBack.Width() && Main.mouseY > num26 && Main.mouseY < num26 + TextureAssets.InventoryBack.Height() && Main.mouseLeft && Main.mouseLeftRelease) { Main.mouseLeftRelease = false; Main.selClothes = index; SoundEngine.PlaySound(12); Main.hBar = -1f; Main.lBar = -1f; Main.sBar = -1f; } float x2 = (float) (num25 + TextureAssets.InventoryBack.Width() / 2 - TextureAssets.Clothes[index].Width() / 2); float y2 = (float) (num26 + TextureAssets.InventoryBack.Height() / 2 - TextureAssets.Clothes[index].Height() / 2); Microsoft.Xna.Framework.Color color4 = Microsoft.Xna.Framework.Color.White; if (index == 0) color4 = Main.player[Main.myPlayer].shirtColor; if (index == 1) color4 = Main.player[Main.myPlayer].underShirtColor; if (index == 2) color4 = Main.player[Main.myPlayer].pantsColor; if (index == 3) color4 = Main.player[Main.myPlayer].shoeColor; if (index == 4) color4 = Main.player[Main.myPlayer].eyeColor; if (index == 5) color4 = Main.player[Main.myPlayer].skinColor; Main.spriteBatch.Draw(TextureAssets.Clothes[index].Value, new Vector2(x2, y2), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Clothes[index].Width(), TextureAssets.Clothes[index].Height())), color4, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); if (index == 4) { Texture2D texture2D = Main.Assets.Request("Images/UI/CharCreation/ColorEyeBack", (AssetRequestMode) 1).Value; Main.spriteBatch.Draw(texture2D, new Vector2(x2, y2), new Microsoft.Xna.Framework.Rectangle?(texture2D.Frame()), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } UILinkPointNavigator.SetPosition(2806 + index, new Vector2(x2, y2) + TextureAssets.Clothes[index].Value.Size() * 0.75f); num25 += 56; if (index == 1) { num25 -= 112; num26 += 56; } if (index == 3) num26 -= 56; if (index == 4) { num26 += 56; num25 -= 56; } } Main.dresserInterfaceDummy.skinVariant = Main.player[Main.myPlayer].skinVariant; Main.dresserInterfaceDummy.eyeColor = Main.player[Main.myPlayer].eyeColor; Main.dresserInterfaceDummy.hairColor = Main.player[Main.myPlayer].hairColor; Main.dresserInterfaceDummy.hair = Main.player[Main.myPlayer].hair; Main.dresserInterfaceDummy.skinColor = Main.player[Main.myPlayer].skinColor; Main.dresserInterfaceDummy.shirtColor = Main.player[Main.myPlayer].shirtColor; Main.dresserInterfaceDummy.underShirtColor = Main.player[Main.myPlayer].underShirtColor; Main.dresserInterfaceDummy.shoeColor = Main.player[Main.myPlayer].shoeColor; Main.dresserInterfaceDummy.pantsColor = Main.player[Main.myPlayer].pantsColor; Main.dresserInterfaceDummy.Bottom = Main.screenPosition + vector2_1; Main.dresserInterfaceDummy.direction = -1; Main.dresserInterfaceDummy.gravDir = 1f; Main.dresserInterfaceDummy.PlayerFrame(); Main.dresserInterfaceDummy.socialIgnoreLight = true; Microsoft.Xna.Framework.Color c = new Microsoft.Xna.Framework.Color(46, 106, 98) * 0.6f; if (flag1) { c = new Microsoft.Xna.Framework.Color(46, 106, 98) * 2f * 0.6f; if (Main.mouseLeft && Main.mouseLeftRelease) { Main.mouseLeftRelease = false; SoundEngine.PlaySound(12); Main.CycleClothingStyle(Main.player[Main.myPlayer]); } } UILinkPointNavigator.SetPosition(2805, R.Center.ToVector2()); Utils.DrawInvBG(Main.spriteBatch, R, c); Main.PlayerRenderer.DrawPlayer(Main.Camera, Main.dresserInterfaceDummy, Main.dresserInterfaceDummy.position, Main.dresserInterfaceDummy.fullRotation, Main.dresserInterfaceDummy.fullRotationOrigin); } } private void DrawInterface_Tests() { } private void SetupDrawInterfaceLayers() { if (!this._needToSetupDrawInterfaceLayers) return; this._needToSetupDrawInterfaceLayers = false; this._gameInterfaceLayers = new List(); this._gameInterfaceLayers.AddRange((IEnumerable) new GameInterfaceLayer[43] { (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Interface Logic 1", (GameInterfaceDrawMethod) (() => { Main.DrawInterface_0_InterfaceLogic1(); return true; })), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: MP Player Names", (GameInterfaceDrawMethod) (() => { Main.DrawInterface_20_MultiplayerPlayerNames(); return true; })), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Emote Bubbles", (GameInterfaceDrawMethod) (() => { Main.DrawInterface_1_1_DrawEmoteBubblesInWorld(); return true; })), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Entity Markers", (GameInterfaceDrawMethod) (() => { Main.DrawInterface_1_2_DrawEntityMarkersInWorld(); return true; })), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Smart Cursor Targets", (GameInterfaceDrawMethod) (() => { Main.DrawInterface_2_SmartCursorTargets(); return true; })), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Laser Ruler", (GameInterfaceDrawMethod) (() => { Main.DrawInterface_3_LaserRuler(); return true; })), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Ruler", (GameInterfaceDrawMethod) (() => { Main.DrawInterface_4_Ruler(); return true; })), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Gamepad Lock On", (GameInterfaceDrawMethod) (() => { Main.DrawInterface_5_GamepadLockOn(); return true; })), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Tile Grid Option", (GameInterfaceDrawMethod) (() => { Main.DrawInterface_6_TileGridOption(); return true; })), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Town NPC House Banners", (GameInterfaceDrawMethod) (() => { this.DrawInterface_7_TownNPCHouseBanners(); return true; })), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Hide UI Toggle", new GameInterfaceDrawMethod(Main.DrawInterface_8_CheckF11UIHideToggle), InterfaceScaleType.UI), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Wire Selection", (GameInterfaceDrawMethod) (() => { Main.DrawInterface_9_WireSelection(); return true; }), InterfaceScaleType.UI), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Capture Manager Check", new GameInterfaceDrawMethod(Main.DrawInterface_10_CheckCaptureManager)), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Ingame Options", new GameInterfaceDrawMethod(this.DrawInterface_11_IngameOptionsMenu), InterfaceScaleType.UI), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Fancy UI", new GameInterfaceDrawMethod(Main.DrawInterface_12_IngameFancyUI), InterfaceScaleType.UI), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Achievement Complete Popups", (GameInterfaceDrawMethod) (() => { Main.DrawInterface_13_AchievementCompletePopups(); return true; }), InterfaceScaleType.UI), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Entity Health Bars", (GameInterfaceDrawMethod) (() => { this.DrawInterface_14_EntityHealthBars(); return true; })), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Invasion Progress Bars", (GameInterfaceDrawMethod) (() => { Main.DrawInterface_15_InvasionProgressBars(); return true; }), InterfaceScaleType.UI), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Map / Minimap", (GameInterfaceDrawMethod) (() => { this.DrawInterface_16_MapOrMinimap(); return true; }), InterfaceScaleType.UI), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Diagnose Net", (GameInterfaceDrawMethod) (() => { Main.DrawInterface_17_DiagnoseNet(); return true; }), InterfaceScaleType.UI), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Diagnose Video", (GameInterfaceDrawMethod) (() => { Main.DrawInterface_18_DiagnoseVideo(); return true; }), InterfaceScaleType.UI), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Sign Tile Bubble", (GameInterfaceDrawMethod) (() => { Main.DrawInterface_19_SignTileBubble(); return true; })), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Hair Window", (GameInterfaceDrawMethod) (() => { this.DrawInterface_21_HairWindow(); return true; }), InterfaceScaleType.UI), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Dresser Window", (GameInterfaceDrawMethod) (() => { this.DrawInterface_22_DresserWindow(); return true; }), InterfaceScaleType.UI), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: NPC / Sign Dialog", (GameInterfaceDrawMethod) (() => { this.DrawInterface_23_NPCSignsDialog(); return true; }), InterfaceScaleType.UI), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Interface Logic 2", (GameInterfaceDrawMethod) (() => { Main.DrawInterface_24_InterfaceLogic2(); return true; })), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Resource Bars", (GameInterfaceDrawMethod) (() => { this.DrawInterface_25_ResourceBars(); return true; }), InterfaceScaleType.UI), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Interface Logic 3", (GameInterfaceDrawMethod) (() => { Main.DrawInterface_26_InterfaceLogic3(); return true; })), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Inventory", (GameInterfaceDrawMethod) (() => { this.DrawInterface_27_Inventory(); return true; }), InterfaceScaleType.UI), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Info Accessories Bar", (GameInterfaceDrawMethod) (() => { this.DrawInterface_28_InfoAccs(); return true; }), InterfaceScaleType.UI), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Settings Button", (GameInterfaceDrawMethod) (() => { Main.DrawInterface_29_SettingsButton(); return true; }), InterfaceScaleType.UI), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Hotbar", (GameInterfaceDrawMethod) (() => { this.DrawInterface_30_Hotbar(); return true; }), InterfaceScaleType.UI), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Builder Accessories Bar", (GameInterfaceDrawMethod) (() => { this.DrawInterface_31_BuilderAccToggles(); return true; }), InterfaceScaleType.UI), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Radial Hotbars", (GameInterfaceDrawMethod) (() => { Main.DrawInterface_32_GamepadRadialHotbars(); return true; }), InterfaceScaleType.UI), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Mouse Text", (GameInterfaceDrawMethod) (() => { this.DrawInterface_33_MouseText(); return true; }), InterfaceScaleType.UI), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Player Chat", (GameInterfaceDrawMethod) (() => { this.DrawInterface_34_PlayerChat(); return true; }), InterfaceScaleType.UI), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Death Text", (GameInterfaceDrawMethod) (() => { Main.DrawInterface_35_YouDied(); return true; }), InterfaceScaleType.UI), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Cursor", (GameInterfaceDrawMethod) (() => { Main.DrawInterface_36_Cursor(); return true; }), InterfaceScaleType.UI), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Debug Stuff", (GameInterfaceDrawMethod) (() => { Main.DrawInterface_37_DebugStuff(); return true; }), InterfaceScaleType.UI), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Mouse Item / NPC Head", (GameInterfaceDrawMethod) (() => { this.DrawInterface_38_MouseCarriedObject(); return true; }), InterfaceScaleType.UI), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Mouse Over", (GameInterfaceDrawMethod) (() => { this.DrawInterface_39_MouseOver(); return true; })), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Interact Item Icon", (GameInterfaceDrawMethod) (() => { this.DrawInterface_40_InteractItemIcon(); return true; }), InterfaceScaleType.UI), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Interface Logic 4", (GameInterfaceDrawMethod) (() => { Main.DrawInterface_41_InterfaceLogic4(); return true; }), InterfaceScaleType.UI) }); } protected void DrawInterface(GameTime gameTime) { Main._drawInterfaceGameTime = gameTime; if (this._needToSetupDrawInterfaceLayers) this.SetupDrawInterfaceLayers(); PlayerInput.SetZoom_UI(); foreach (GameInterfaceLayer gameInterfaceLayer in this._gameInterfaceLayers) { if (!gameInterfaceLayer.Draw()) break; } PlayerInput.SetZoom_World(); } private static void DrawWallOfCopperShortswords() { UnifiedRandom r = new UnifiedRandom(5000); Texture2D texture = TextureAssets.Cloud[28].Value; Vector2 vector2_1 = Main.ScreenSize.ToVector2(); Main.spriteBatch.Begin(); for (int index = 0; index < 20000; ++index) { Vector2 vector2_2 = r.NextVector2Square(-0.1f, 1.1f); vector2_2.X -= 0.1f; vector2_2.X += (float) ((double) Main.GlobalTimeWrappedHourly % 10.0 / 10.0 * 1.20000004768372); vector2_2.Y -= (float) ((double) Main.GlobalTimeWrappedHourly % 10.0 / 10.0); if ((double) vector2_2.Y < -0.200000002980232) vector2_2.Y += 1.4f; if ((double) vector2_2.X > 1.10000002384186) vector2_2.X -= 1.2f; Vector2 position = vector2_2 * vector2_1; Main.spriteBatch.Draw(texture, position, Microsoft.Xna.Framework.Color.White); } Main.spriteBatch.End(); } private static void DrawWallOfBoulders() { UnifiedRandom r = new UnifiedRandom(5000); Main.instance.LoadProjectile(99); Texture2D texture = TextureAssets.Projectile[99].Value; Vector2 vector2_1 = Main.ScreenSize.ToVector2(); Main.spriteBatch.Begin(); for (int index = 0; index < 20000; ++index) { Vector2 vector2_2 = r.NextVector2Square(-0.1f, 1.1f); vector2_2.X *= 0.1f; vector2_2.X -= 0.1f; vector2_2.X += (float) ((double) Main.GlobalTimeWrappedHourly % 10.0 / 10.0 * 1.20000004768372); vector2_2.Y -= (float) ((double) Main.GlobalTimeWrappedHourly % 10.0 / 10.0); if ((double) vector2_2.Y < -0.200000002980232) vector2_2.Y += 1.4f; if ((double) vector2_2.X > 1.10000002384186) vector2_2.X -= 1.2f; Vector2 position = vector2_2 * vector2_1; Main.spriteBatch.Draw(texture, position, Microsoft.Xna.Framework.Color.White); } Main.spriteBatch.End(); } private static void DrawInterface_41_InterfaceLogic4() { Main.npcChatRelease = !Main.mouseRight; Main._MouseOversCanClear = true; Main.DrawPendingMouseText(); Main.cursorOverride = -1; } private static void DrawPendingMouseText() { Main.DrawGamepadInstructions(); if (!Main.instance._mouseTextCache.isValid) return; Main.instance.MouseTextInner(Main.instance._mouseTextCache); Main.DrawInterface_36_Cursor(); Main.instance._mouseTextCache.isValid = false; Main.instance._mouseTextCache.noOverride = false; } private void DrawInterface_40_InteractItemIcon() { if (Main.HoveringOverAnNPC || Main.LocalPlayer.mouseInterface) return; int index = Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type; if (index == 8 && Main.player[Main.myPlayer].UsingBiomeTorches) index = Main.player[Main.myPlayer].BiomeTorchHoldStyle(index); if (Main.player[Main.myPlayer].cursorItemIconID != 0) index = Main.player[Main.myPlayer].cursorItemIconID; bool flag1 = Main.player[Main.myPlayer].cursorItemIconEnabled && (Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type > 0 || (uint) Main.player[Main.myPlayer].cursorItemIconID > 0U); Main.ItemIconCacheVerification(); bool flag2 = Main._itemIconCacheTime > 0 && Main.mouseItem.type < 1; if (!(flag1 | flag2)) return; int cacheSelectedItemId = Main._itemIconCacheSelectedItemID; if (!flag1) Utils.Swap(ref cacheSelectedItemId, ref Main.player[Main.myPlayer].cursorItemIconID); Microsoft.Xna.Framework.Color currentColor = Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].GetAlpha(Microsoft.Xna.Framework.Color.White); Microsoft.Xna.Framework.Color color = Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].GetColor(Microsoft.Xna.Framework.Color.White); if (Main.player[Main.myPlayer].cursorItemIconID != 0) { currentColor = Microsoft.Xna.Framework.Color.White; color = new Microsoft.Xna.Framework.Color(); } if (Main.player[Main.myPlayer].cursorItemIconID == 269) currentColor = Main.player[Main.myPlayer].shirtColor; float cursorScale = Main.cursorScale; ItemSlot.GetItemLight(ref currentColor, index); SpriteEffects effects = SpriteEffects.None; if (Main.player[Main.myPlayer].cursorItemIconReversed) effects = SpriteEffects.FlipHorizontally; if (index > 0) { Main.instance.LoadItem(index); Main.spriteBatch.Draw(TextureAssets.Item[index].Value, new Vector2((float) (Main.mouseX + 10), (float) (Main.mouseY + 10)), new Microsoft.Xna.Framework.Rectangle?(Item.GetDrawHitbox(index, (Player) null)), currentColor, 0.0f, new Vector2(), cursorScale, effects, 0.0f); } if (Main.player[Main.myPlayer].cursorItemIconText != "") this.MouseText(Main.player[Main.myPlayer].cursorItemIconText); if (Main.player[Main.myPlayer].cursorItemIconID == 0 && Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].color != new Microsoft.Xna.Framework.Color()) { Main.instance.LoadItem(Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type); Main.spriteBatch.Draw(TextureAssets.Item[Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type].Value, new Vector2((float) (Main.mouseX + 10), (float) (Main.mouseY + 10)), new Microsoft.Xna.Framework.Rectangle?(Item.GetDrawHitbox(Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type, (Player) null)), color, 0.0f, new Vector2(), cursorScale, SpriteEffects.None, 0.0f); } if (flag1) return; Utils.Swap(ref cacheSelectedItemId, ref Main.player[Main.myPlayer].cursorItemIconID); } private void DrawInterface_39_MouseOver() { if (Main.ignoreErrors) { try { this.DrawMouseOver(); } catch (Exception ex) { TimeLogger.DrawException(ex); } } else this.DrawMouseOver(); } private void DrawInterface_38_MouseCarriedObject() { if (Main.mouseItem.type > 0 && Main.mouseItem.stack > 0) { this.SetMouseNPC(-1, -1); Main.player[Main.myPlayer].cursorItemIconEnabled = false; Main.player[Main.myPlayer].cursorItemIconID = 0; Main.mouseText = true; double inventoryScale = (double) Main.inventoryScale; Main.inventoryScale = Main.cursorScale; ItemSlot.Draw(Main.spriteBatch, ref Main.mouseItem, 21, new Vector2((float) Main.mouseX, (float) Main.mouseY)); Main.inventoryScale = (float) inventoryScale; } else { if (this.mouseNPCType <= -1) return; float scale = 1f * Main.cursorScale; if (this.mouseNPCIndex >= 0) { NPC npc = Main.npc[this.mouseNPCIndex]; if (!npc.active || npc.type != this.mouseNPCType) this.SetMouseNPC_ToHousingQuery(); } int mouseNpcType = this.mouseNPCType; ITownNPCProfile profile; int index = this.mouseNPCIndex < 0 || !TownNPCProfiles.Instance.GetProfile(mouseNpcType, out profile) ? NPC.TypeToDefaultHeadIndex(mouseNpcType) : profile.GetHeadTextureIndex(Main.npc[this.mouseNPCIndex]); Texture2D texture = TextureAssets.NpcHead[index].Value; Main.spriteBatch.Draw(texture, new Vector2((float) ((double) Main.mouseX + 26.0 * (double) scale - (double) texture.Width * 0.5 * (double) scale), (float) ((double) Main.mouseY + 26.0 * (double) scale - (double) texture.Height * 0.5 * (double) scale)), new Microsoft.Xna.Framework.Rectangle?(), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2(), scale, SpriteEffects.None, 0.0f); if (PlayerInput.IgnoreMouseInterface) return; Main.player[Main.myPlayer].mouseInterface = true; Main.mouseText = false; if (Main.mouseRight && Main.mouseRightRelease) { SoundEngine.PlaySound(12); this.SetMouseNPC(-1, -1); } if (!Main.mouseLeft || !Main.mouseLeftRelease) return; if (this.mouseNPCType == 0) { PlayerInput.SetZoom_Unscaled(); PlayerInput.SetZoom_MouseInWorld(); int x = (int) (((double) Main.mouseX + (double) Main.screenPosition.X) / 16.0); int num1 = (int) (((double) Main.mouseY + (double) Main.screenPosition.Y) / 16.0); if ((double) Main.player[Main.myPlayer].gravDir == -1.0) num1 = (int) (((double) Main.screenPosition.Y + (double) Main.screenHeight - (double) Main.mouseY) / 16.0); PlayerInput.SetZoom_Unscaled(); int num2 = -1; int y = num1; int n = num2; if (!WorldGen.MoveTownNPC(x, y, n)) return; Main.NewText(Lang.inter[39].Value, G: (byte) 240, B: (byte) 20); } else { int mouseNpcIndex = this.mouseNPCIndex; if (mouseNpcIndex < 0) return; PlayerInput.SetZoom_Unscaled(); PlayerInput.SetZoom_MouseInWorld(); int x = (int) (((double) Main.mouseX + (double) Main.screenPosition.X) / 16.0); int y = (int) (((double) Main.mouseY + (double) Main.screenPosition.Y) / 16.0); PlayerInput.SetZoom_Unscaled(); if (!WorldGen.MoveTownNPC(x, y, mouseNpcIndex)) return; this.SetMouseNPC(-1, -1); WorldGen.moveRoom(x, y, mouseNpcIndex); SoundEngine.PlaySound(12); } } } private static void DrawInterface_37_DebugStuff() { } private static void DrawInterface_36_Cursor() { Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.SamplerStateForCursor, DepthStencilState.None, RasterizerState.CullCounterClockwise, (Effect) null, Main.UIScaleMatrix); if (Main.cursorOverride != -1) { Microsoft.Xna.Framework.Color color1 = new Microsoft.Xna.Framework.Color((int) ((double) Main.cursorColor.R * 0.200000002980232), (int) ((double) Main.cursorColor.G * 0.200000002980232), (int) ((double) Main.cursorColor.B * 0.200000002980232), (int) ((double) Main.cursorColor.A * 0.5)); Microsoft.Xna.Framework.Color color2 = Main.cursorColor; bool flag1 = true; bool flag2 = true; float rotation = 0.0f; Vector2 vector2 = new Vector2(); float num = 1f; if (Main.cursorOverride == 2) { flag1 = false; color2 = Microsoft.Xna.Framework.Color.White; num = 0.7f; vector2 = new Vector2(0.1f); } switch (Main.cursorOverride - 2) { case 0: flag1 = false; color2 = Microsoft.Xna.Framework.Color.White; num = 0.7f; vector2 = new Vector2(0.1f); break; case 1: case 4: case 5: case 6: case 7: case 8: flag1 = false; color2 = Microsoft.Xna.Framework.Color.White; break; } if (flag1) Main.spriteBatch.Draw(TextureAssets.Cursors[Main.cursorOverride].Value, new Vector2((float) (Main.mouseX + 1), (float) (Main.mouseY + 1)), new Microsoft.Xna.Framework.Rectangle?(), color1, rotation, vector2 * TextureAssets.Cursors[Main.cursorOverride].Value.Size(), Main.cursorScale * 1.1f * num, SpriteEffects.None, 0.0f); if (!flag2) return; Main.spriteBatch.Draw(TextureAssets.Cursors[Main.cursorOverride].Value, new Vector2((float) Main.mouseX, (float) Main.mouseY), new Microsoft.Xna.Framework.Rectangle?(), color2, rotation, vector2 * TextureAssets.Cursors[Main.cursorOverride].Value.Size(), Main.cursorScale * num, SpriteEffects.None, 0.0f); } else if (Main.SmartCursorEnabled) Main.DrawCursor(Main.DrawThickCursor(true), true); else Main.DrawCursor(Main.DrawThickCursor()); } private static void DrawInterface_35_YouDied() { if (!Main.player[Main.myPlayer].dead) return; float num1 = -60f; string str = Lang.inter[38].Value; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.DeathText.Value, str, new Vector2((float) (Main.screenWidth / 2) - FontAssets.DeathText.Value.MeasureString(str).X / 2f, (float) (Main.screenHeight / 2) + num1), Main.player[Main.myPlayer].GetDeathAlpha(Microsoft.Xna.Framework.Color.Transparent), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); if (Main.player[Main.myPlayer].lostCoins > 0) { num1 += 50f; string textValue = Language.GetTextValue("Game.DroppedCoins", (object) Main.player[Main.myPlayer].lostCoinString); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, textValue, new Vector2((float) (Main.screenWidth / 2) - FontAssets.MouseText.Value.MeasureString(textValue).X / 2f, (float) (Main.screenHeight / 2) + num1), Main.player[Main.myPlayer].GetDeathAlpha(Microsoft.Xna.Framework.Color.Transparent), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } float num2 = num1 + (Main.player[Main.myPlayer].lostCoins > 0 ? 24f : 50f) + 20f; float num3 = 0.7f; string textValue1 = Language.GetTextValue("Game.RespawnInSuffix", (object) ((float) (int) (1.0 + (double) Main.player[Main.myPlayer].respawnTimer / 60.0)).ToString()); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.DeathText.Value, textValue1, new Vector2((float) (Main.screenWidth / 2) - (float) ((double) FontAssets.MouseText.Value.MeasureString(textValue1).X * (double) num3 / 2.0), (float) (Main.screenHeight / 2) + num2), Main.player[Main.myPlayer].GetDeathAlpha(Microsoft.Xna.Framework.Color.Transparent), 0.0f, new Vector2(), num3, SpriteEffects.None, 0.0f); } private void DrawInterface_34_PlayerChat() { if (Main.ignoreErrors) { try { this.DrawPlayerChat(); } catch (Exception ex) { TimeLogger.DrawException(ex); } } else this.DrawPlayerChat(); } private void DrawInterface_33_MouseText() { if (Main.mouseItem.stack <= 0) Main.mouseItem.type = 0; if (Main.hoverItemName != null && Main.hoverItemName != "" && Main.mouseItem.type == 0) { Main.player[Main.myPlayer].cursorItemIconEnabled = false; if (Main.SettingsEnabled_OpaqueBoxBehindTooltips) this.MouseText(Main.hoverItemName, Main.rare, hackedMouseX: (Main.mouseX + 6), hackedMouseY: (Main.mouseY + 6)); else this.MouseText(Main.hoverItemName, Main.rare); Main.mouseText = true; } if (!Main.LocalPlayer.rulerLine || Main.LocalPlayer.builderAccStatus[0] != 0 || (double) Main.LocalPlayer.velocity.Length() > 6.0) return; int num1 = Math.Abs(Main.rulerLineDisplayValues.X) + 1; int num2 = Math.Abs(Main.rulerLineDisplayValues.Y) + 1; if (num1 <= 1 && num2 <= 1) return; Utils.DrawBorderString(Main.spriteBatch, num1.ToString() + "x" + (object) num2, Main.MouseScreen + new Vector2(16f, 0.0f), new Microsoft.Xna.Framework.Color(0.24f, 0.8f, 0.9f, 1f), Main.GameZoomTarget, anchory: 0.8f); } private static void DrawInterface_32_GamepadRadialHotbars() { ItemSlot.DrawRadialCircular(Main.spriteBatch, new Vector2((float) Main.screenWidth, (float) Main.screenHeight) / 2f); ItemSlot.DrawRadialQuicks(Main.spriteBatch, new Vector2((float) Main.screenWidth, (float) Main.screenHeight) / 2f); } private void DrawInterface_31_BuilderAccToggles() => this.DrawBuilderAccToggles(new Vector2(10f, 77f)); public static void DrawInterface_29_SettingsButton() { Main._settingsButtonIsPushedToSide = false; if (!Main.playerInventory && !Main.ingameOptionsWindow && !Main.player[Main.myPlayer].ghost && !Main.player[Main.myPlayer].dead) return; string text = Lang.inter[62].Value; string textSizeMatcher = "Settings"; int posX = Main.screenWidth - 110; int posY = Main.screenHeight - 20; int num1 = 620; int num2 = 870; int accessorySlotsToShow = Main.player[Main.myPlayer].GetAmountOfExtraAccessorySlotsToShow(); if (accessorySlotsToShow > 1) { int num3 = (int) (56.0 * (double) Main.inventoryScale * (double) (accessorySlotsToShow - 1)); num1 += num3; num2 += num3; } if (accessorySlotsToShow >= 1 && (Main.screenHeight < num1 || Main.screenHeight < num2 && Main.mapStyle == 1)) { posX -= 140; posY -= PlayerInput.UsingGamepad.ToInt() * 30; Main._settingsButtonIsPushedToSide = true; } Action clickAction = new Action(IngameOptions.Open); if (Main.ingameOptionsWindow) clickAction = new Action(IngameOptions.Close); Main.DrawSettingButton(ref Main.mouseExit, ref Main.exitScale, posX, posY, text, textSizeMatcher, clickAction); } public static void DrawSettingButton( ref bool mouseOver, ref float scale, int posX, int posY, string text, string textSizeMatcher, Action clickAction) { Vector2 vector2_1 = FontAssets.MouseText.Value.MeasureString(textSizeMatcher); Vector2 vector2_2 = FontAssets.MouseText.Value.MeasureString(text); Vector2 vector2_3 = FontAssets.DeathText.Value.MeasureString(text); float num1 = vector2_1.X / vector2_2.X; if (mouseOver) { if ((double) scale < 0.96) scale += 0.02f; } else if ((double) scale > 0.8) scale -= 0.02f; UILinkPointNavigator.SetPosition(308, new Vector2((float) posX, (float) posY)); for (int index = 0; index < 5; ++index) { int num2 = 0; int num3 = 0; Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.Black; if (index == 0) num2 = -2; if (index == 1) num2 = 2; if (index == 2) num3 = -2; if (index == 3) num3 = 2; if (index == 4) color = Microsoft.Xna.Framework.Color.White; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.DeathText.Value, text, new Vector2((float) (posX + num2), (float) (posY + num3)), color, 0.0f, new Vector2(vector2_3.X / 2f, vector2_3.Y / 2f), (scale - 0.2f) * num1, SpriteEffects.None, 0.0f); } if ((double) Main.mouseX > (double) posX - (double) vector2_3.X / 2.0 && (double) Main.mouseX < (double) posX + (double) vector2_3.X / 2.0 && (double) Main.mouseY > (double) posY - (double) vector2_3.Y / 2.0 && (double) Main.mouseY < (double) posY + (double) vector2_3.Y / 2.0 - 10.0 && !Main.LocalPlayer.mouseInterface) { if (PlayerInput.IgnoreMouseInterface) return; if (!mouseOver) SoundEngine.PlaySound(12); mouseOver = true; Main.player[Main.myPlayer].mouseInterface = true; if (!Main.mouseLeftRelease || !Main.mouseLeft) return; mouseOver = false; scale = 0.8f; clickAction(); } else mouseOver = false; } private void DrawInterface_28_InfoAccs() { double inventoryScale = (double) Main.inventoryScale; Main.inventoryScale = 0.6f; this.DrawInfoAccs(); Main.inventoryScale = (float) inventoryScale; } private void DrawInterface_27_Inventory() { if (Main.playerInventory) { if (Main.player[Main.myPlayer].chest != -1) Main.CreativeMenu.CloseMenu(); if (Main.ignoreErrors) { try { this.DrawInventory(); } catch (Exception ex) { TimeLogger.DrawException(ex); } } else this.DrawInventory(); } else { Main.CreativeMenu.CloseMenu(); Main.recFastScroll = true; this.SetMouseNPC(-1, -1); Main.EquipPage = 0; } } private static void DrawInterface_26_InterfaceLogic3() { bool playerInventory = Main.playerInventory; if (Main.player[Main.myPlayer].dead) Main.playerInventory = false; if (!Main.playerInventory) { Main.player[Main.myPlayer].chest = -1; Main.InGuideCraftMenu = false; Main.InReforgeMenu = false; if (playerInventory) Recipe.FindRecipes(); } Main.hoverItemName = ""; } private void DrawInterface_25_ResourceBars() => this.GUIBarsDraw(); private static void DrawInterface_24_InterfaceLogic2() { Main.invAlpha += Main.invDir * 0.2f; if ((double) Main.invAlpha > 240.0) { Main.invAlpha = 240f; Main.invDir = -1f; } if ((double) Main.invAlpha < 180.0) { Main.invAlpha = 180f; Main.invDir = 1f; } Main.inventoryBack = new Microsoft.Xna.Framework.Color((int) (byte) Main.invAlpha, (int) (byte) Main.invAlpha, (int) (byte) Main.invAlpha, (int) (byte) Main.invAlpha); Main.mouseText = false; Main.rare = 0; } private void DrawInterface_23_NPCSignsDialog() => this.GUIChatDraw(); private void DrawInterface_22_DresserWindow() { if (!Main.clothesWindow) return; this.DrawClothesWindow(); } private void DrawInterface_21_HairWindow() { if (!Main.hairWindow) return; this.DrawHairWindow(); } private static void DrawInterface_20_MultiplayerPlayerNames() => Main.ActiveClosePlayersTeamOverlay.Draw(); private static void DrawInterface_19_SignTileBubble() { if (!Main.signBubble) return; int num1 = (int) ((double) Main.signX - (double) Main.screenPosition.X); int num2 = (int) ((double) Main.signY - (double) Main.screenPosition.Y); if ((double) Main.player[Main.myPlayer].gravDir == -1.0) num2 = Main.screenHeight - (int) ((double) Main.signY - (double) Main.screenPosition.Y) - 32; SpriteEffects effects = SpriteEffects.None; int num3; if ((double) Main.signX > (double) Main.player[Main.myPlayer].position.X + (double) Main.player[Main.myPlayer].width) { effects = SpriteEffects.FlipHorizontally; num3 = num1 + (-8 - TextureAssets.Chat2.Width()); } else num3 = num1 + 8; int num4 = num2 - 22; Main.spriteBatch.Draw(TextureAssets.Chat2.Value, new Vector2((float) num3, (float) num4), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Chat2.Width(), TextureAssets.Chat2.Height())), new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor), 0.0f, new Vector2(), 1f, effects, 0.0f); Main.signBubble = false; } private static void DrawInterface_18_DiagnoseVideo() { if (!Main.drawDiag) return; if (PlayerInput.UsingGamepad) { for (int index = 0; index < 2; ++index) { string str = ""; int num1 = 20; int num2 = 160 + index * 16; if (index == 0) str = "Gamepad Left Thumbstick : " + string.Format("{0,-10} , {1,-10}", (object) PlayerInput.GamepadThumbstickLeft.X.ToString("P2"), (object) PlayerInput.GamepadThumbstickLeft.Y.ToString("P2")); if (index == 1) str = "Gamepad Right Thumbstick: " + string.Format("{0,-10} , {1,-10}", (object) PlayerInput.GamepadThumbstickRight.X.ToString("P2"), (object) PlayerInput.GamepadThumbstickRight.Y.ToString("P2")); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, str, new Vector2((float) num1, (float) num2), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } } for (int index = 0; index < 7; ++index) { string str = ""; int num3 = 20; int num4 = 220 + index * 16; if (index == 0) str = "Solid Tiles:"; if (index == 1) str = "Misc. Tiles:"; if (index == 2) str = "Walls Tiles:"; if (index == 3) str = "Background Tiles:"; if (index == 4) str = "Water Tiles:"; if (index == 5) str = "Black Tiles:"; if (index == 6) str = "Total Render:"; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, str, new Vector2((float) num3, (float) num4), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } for (int drawType = 0; drawType < 7; ++drawType) { int num5 = 180; int num6 = 220 + drawType * 16; string str = string.Format("{0:F2}ms", (object) (float) (drawType != 6 ? (double) TimeLogger.GetDrawTime(drawType) : (double) TimeLogger.GetDrawTotal())); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, str, new Vector2((float) num5, (float) num6), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } for (int index = 0; index < 6; ++index) { string str = ""; int num7 = 20; int num8 = 346 + index * 16; if (index == 0) str = "Lighting Init:"; if (index == 1) str = "Lighting Phase #1:"; if (index == 2) str = "Lighting Phase #2:"; if (index == 3) str = "Lighting Phase #3"; if (index == 4) str = "Lighting Phase #4"; if (index == 5) str = "Total Lighting:"; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, str, new Vector2((float) num7, (float) num8), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } for (int lightingType = 0; lightingType < 6; ++lightingType) { int num9 = 180; int num10 = 346 + lightingType * 16; string str = string.Format("{0:F2}ms", (object) (float) (lightingType != 5 ? (double) TimeLogger.GetLightingTime(lightingType) : (double) TimeLogger.GetLightingTotal())); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, str, new Vector2((float) num9, (float) num10), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } int num11 = 5; for (int index = 0; index < num11; ++index) { int num12 = 20; int num13 = 456 + index * 16; string str = "Render #" + (object) index + ":"; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, str, new Vector2((float) num12, (float) num13), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } for (int renderType = 0; renderType < num11; ++renderType) { int num14 = 180; int num15 = 456 + renderType * 16; string str = string.Format("{0:F2}ms", (object) TimeLogger.GetRenderTime(renderType)); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, str, new Vector2((float) num14, (float) num15), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } for (int renderType = 0; renderType < num11; ++renderType) { int num16 = 230; int num17 = 456 + renderType * 16; int num18 = num16 + 10; string str = string.Format("{0:F2}ms", (object) TimeLogger.GetRenderMax(renderType)); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, str, new Vector2((float) num18, (float) num17), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } string str1 = ""; int num19 = 20; int num20 = 456 + 16 * num11 + 16; string str2 = "Update:"; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, str2, new Vector2((float) num19, (float) num20), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); str1 = ""; int num21 = 180; string str3 = string.Format("{0:F2}ms", (object) Main.upTimer); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, str3, new Vector2((float) num21, (float) num20), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); str1 = ""; int num22 = 240; string str4 = string.Format("{0:F2}ms", (object) Main.upTimerMax); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, str4, new Vector2((float) num22, (float) num20), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } private static void DrawInterface_17_DiagnoseNet() { if (!Main.shouldDrawNetDiagnosticsUI) return; Main.ActiveNetDiagnosticsUI.Draw(Main.spriteBatch); } private void DrawInterface_16_MapOrMinimap() { Main.mH = 0; if (!Main.mapEnabled) return; if (!Main.mapFullscreen && Main.mapStyle == 1) { Main.mH = 256; try { this.DrawMap(new GameTime()); } catch (Exception ex) { if (Main.ignoreErrors) TimeLogger.DrawException(ex); else throw; } } PlayerInput.SetZoom_UI(); if (Main.mH + this.RecommendedEquipmentAreaPushUp <= Main.screenHeight) return; Main.mH = Main.screenHeight - this.RecommendedEquipmentAreaPushUp; } public int RecommendedEquipmentAreaPushUp => Main.player[Main.myPlayer].CanDemonHeartAccessoryBeShown() ? 610 + PlayerInput.UsingGamepad.ToInt() * 30 : 600; private static void DrawInterface_15_InvasionProgressBars() { Main.DrawInvasionProgress(); if (Main.HealthBarDrawSettings == (byte) 0) return; Main.BigBossProgressBar.Draw(Main.spriteBatch); } private void DrawInterface_14_EntityHealthBars() { if (Main.HealthBarDrawSettings == (byte) 0) return; int index1 = -1; if (PlayerInput.UsingGamepad) { Player localPlayer = Main.LocalPlayer; for (int index2 = 0; index2 < 200; ++index2) { NPC npc = Main.npc[index2]; if ((npc.life == npc.lifeMax || npc.dontTakeDamage) && !npc.dontTakeDamage && (double) npc.nameOver > 0.0 && (index1 == -1 || (double) npc.Distance(localPlayer.Center) < (double) Main.npc[index1].Distance(localPlayer.Center))) index1 = index2; } } bool flag = false; for (int i = 199; i >= 0; --i) { if (Main.npc[i].active && Main.npc[i].type > 0) { NPC npc1 = Main.npc[i]; npc1.position = npc1.position + Main.npc[i].netOffset; if (Main.npc[i].life != Main.npc[i].lifeMax && !Main.npc[i].dontTakeDamage) { float scale1 = 1f; int type = Main.npc[i].type; if (type == 4) scale1 = 1.5f; if (type == 35) scale1 = 1.5f; if (type == 36) scale1 = 1.5f; if (type == 50) scale1 = 1.5f; if (type == 113) scale1 = 1.5f; if (type == 114) scale1 = 1.5f; if (type == 125) scale1 = 1.5f; if (type == 126) scale1 = 1.5f; if (type == (int) sbyte.MaxValue) scale1 = 1.5f; if (type == 128) scale1 = 1.5f; if (type == 129) scale1 = 1.5f; if (type == 130) scale1 = 1.5f; if (type == 131) scale1 = 1.5f; if (type == 222) scale1 = 1.5f; if (type >= 245 && type <= 249) scale1 = 1.5f; if (type == 262) scale1 = 1.5f; if (type == 266) scale1 = 1.5f; if (type == 564 || type == 565 || type == 551 || type == 576 || type == 577) scale1 = 1.5f; if (type == 87) scale1 = 1.5f; if (type == 510 || type == 454 || type == 621) scale1 = 1.5f; if (type == 439 || type == 370) scale1 = 1.5f; if ((!Main.expertMode || type != 266) && (type != 439 && type != 440 || (double) Main.npc[i].ai[0] != 5.0)) { if (type >= 134 && type <= 136) { float scale2 = 1.5f; if (!flag) { flag = true; Vector2 vector2_1 = new Vector2(); float num = 999999f; for (int index3 = 0; index3 < 200; ++index3) { if (Main.npc[index3].active && Main.npc[index3].type >= 134 && Main.npc[index3].type <= 136) { Vector2 vector2_2 = Main.player[Main.myPlayer].Center - Main.npc[index3].Center; if ((double) vector2_2.Length() < (double) num && Collision.CanHit(Main.player[Main.myPlayer].Center, 1, 1, Main.npc[index3].Center, 1, 1)) { num = vector2_2.Length(); vector2_1 = Main.npc[index3].position; } } } if ((double) num < (double) Main.screenWidth) { Main.destroyerHB = (double) Main.destroyerHB.X >= 100.0 || (double) Main.destroyerHB.Y >= 100.0 ? (Main.destroyerHB * 49f + vector2_1) / 50f : vector2_1; Vector2 destroyerHb = Main.destroyerHB; int index4 = i; if (type != 134 && Main.npc[i].realLife != -1) index4 = Main.npc[i].realLife; float alpha = (float) (((double) Lighting.Brightness((int) (((double) Main.npc[i].position.X + (double) (Main.npc[i].width / 2)) / 16.0), (int) (((double) Main.npc[i].position.Y + (double) (Main.npc[i].height / 2) + (double) Main.npc[i].gfxOffY) / 16.0)) + 1.0) / 2.0); this.DrawHealthBar(destroyerHb.X + (float) (Main.npc[i].width / 2), destroyerHb.Y + (float) (Main.npc[i].height / 2), Main.npc[index4].life, Main.npc[index4].lifeMax, alpha, scale2); } else Main.destroyerHB = new Vector2(0.0f, 0.0f); } } else if (type == 7) this.DrawInterface_Healthbar_Worm(Main.npc[i], 9, scale1); else if (type != 8 && type != 9) { if (type == 95) this.DrawInterface_Healthbar_Worm(Main.npc[i], 97, scale1); else if (type != 96 && type != 97) { if (type == 10) this.DrawInterface_Healthbar_Worm(Main.npc[i], 12, scale1); else if (type != 11 && type != 12) { if (type == 87) this.DrawInterface_Healthbar_Worm(Main.npc[i], 92, scale1); else if (type < 88 || type > 92) { if (type == 412) this.DrawInterface_Healthbar_Worm(Main.npc[i], 414, scale1); else if (type != 414 && type != 413) { if (type == 39) this.DrawInterface_Healthbar_Worm(Main.npc[i], 41, scale1); else if (type != 40 && type != 41) { if (type == 98) this.DrawInterface_Healthbar_Worm(Main.npc[i], 100, scale1); else if (type != 99 && type != 100) { if (type == 454) this.DrawInterface_Healthbar_Worm(Main.npc[i], 459, scale1); else if (type < 455 || type > 459) { if (type == 510) this.DrawInterface_Healthbar_Worm(Main.npc[i], 512, scale1); else if (type != 511 && type != 512) { if (type == 621) this.DrawInterface_Healthbar_Worm(Main.npc[i], 623, scale1); else if (type != 622 && type != 623) { if (type == 513) this.DrawInterface_Healthbar_Worm(Main.npc[i], 515, scale1); else if (type != 514 && type != 515) { if (type == 117) this.DrawInterface_Healthbar_Worm(Main.npc[i], 119, scale1); else if (type != 118 && type != 119) { switch (Main.HealthBarDrawSettings) { case 1: float num1 = 10f + Main.NPCAddHeight(Main.npc[i]); this.DrawHealthBar(Main.npc[i].position.X + (float) (Main.npc[i].width / 2), Main.npc[i].position.Y + (float) Main.npc[i].height + num1 + Main.npc[i].gfxOffY, Main.npc[i].life, Main.npc[i].lifeMax, Lighting.Brightness((int) (((double) Main.npc[i].position.X + (double) (Main.npc[i].width / 2)) / 16.0), (int) (((double) Main.npc[i].position.Y + (double) (Main.npc[i].height / 2) + (double) Main.npc[i].gfxOffY) / 16.0)), scale1); break; case 2: float num2 = -24f - Main.NPCAddHeight(Main.npc[i]) / 2f; this.DrawHealthBar(Main.npc[i].position.X + (float) (Main.npc[i].width / 2), Main.npc[i].position.Y + num2 + Main.npc[i].gfxOffY, Main.npc[i].life, Main.npc[i].lifeMax, Lighting.Brightness((int) (((double) Main.npc[i].position.X + (double) (Main.npc[i].width / 2)) / 16.0), (int) (((double) Main.npc[i].position.Y + (double) (Main.npc[i].height / 2) + (double) Main.npc[i].gfxOffY) / 16.0)), scale1); break; } } } } } } } } } } } } } } } else if (!Main.npc[i].dontTakeDamage && (double) Main.npc[i].nameOver > 0.0 && PlayerInput.UsingGamepad && i == index1) { Vector2 stringSize = ChatManager.GetStringSize(FontAssets.MouseText.Value, Main.npc[i].GivenOrTypeName, Vector2.One); Vector2 vector2_3 = Main.npc[i].Bottom - Main.screenPosition + new Vector2(0.0f, 10f); Vector2 pos; if (NPC.GetNPCLocation(i, true, true, out int _, out pos)) { Vector2 vector2_4 = pos - Main.screenPosition + new Vector2(0.0f, (float) (10 + Main.npc[i].height / 2)); if ((double) Main.player[Main.myPlayer].gravDir == -1.0) vector2_4 = Main.ReverseGravitySupport(vector2_4, (float) (-Main.npc[i].height - 20)); Vector2 origin = stringSize * new Vector2(0.5f, 0.0f); ChatManager.DrawColorCodedStringShadow(Main.spriteBatch, FontAssets.MouseText.Value, Main.npc[i].GivenOrTypeName, vector2_4, Microsoft.Xna.Framework.Color.Black * Main.npc[i].nameOver * 0.5f, 0.0f, origin, Vector2.One); ChatManager.DrawColorCodedString(Main.spriteBatch, FontAssets.MouseText.Value, Main.npc[i].GivenOrTypeName, vector2_4, Microsoft.Xna.Framework.Color.White * Main.npc[i].nameOver, 0.0f, origin, Vector2.One); } } if (Main.npc[i].type == 548 && !Main.npc[i].dontTakeDamageFromHostiles && DD2Event.TimeLeftBetweenWaves > 0 && !Main.hideUI) { Vector2 position = Main.npc[i].Bottom - Main.screenPosition + new Vector2(0.0f, -100f); string text = string.Format("{0}", (object) (DD2Event.TimeLeftBetweenWaves / 60)); DynamicSpriteFont font = FontAssets.MouseText.Value; float num = 1f; Vector2 origin = font.MeasureString(text) * num * new Vector2(0.5f, 0.5f); ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, font, text, position, Microsoft.Xna.Framework.Color.White, 0.0f, origin, Vector2.One * num); } NPC npc2 = Main.npc[i]; npc2.position = npc2.position - Main.npc[i].netOffset; } } for (int index5 = 0; index5 < (int) byte.MaxValue; ++index5) { if (index5 != Main.myPlayer && Main.player[index5].active && !Main.player[index5].ghost && !Main.player[index5].dead && !Main.player[index5].invis && Main.player[index5].statLife != Main.player[index5].statLifeMax2) { switch (Main.HealthBarDrawSettings) { case 1: int num3 = 10; this.DrawHealthBar(Main.player[index5].position.X + (float) (Main.player[index5].width / 2), Main.player[index5].position.Y + (float) Main.player[index5].height + (float) num3 + Main.player[index5].gfxOffY, Main.player[index5].statLife, Main.player[index5].statLifeMax2, Main.player[index5].stealth * Lighting.Brightness((int) (((double) Main.player[index5].position.X + (double) (Main.player[index5].width / 2)) / 16.0), (int) (((double) Main.player[index5].position.Y + (double) (Main.player[index5].height / 2) + (double) Main.player[index5].gfxOffY) / 16.0))); continue; case 2: int num4 = -20; this.DrawHealthBar(Main.player[index5].position.X + (float) (Main.player[index5].width / 2), Main.player[index5].position.Y + (float) num4 + Main.player[index5].gfxOffY, Main.player[index5].statLife, Main.player[index5].statLifeMax2, Main.player[index5].stealth * Lighting.Brightness((int) (((double) Main.player[index5].position.X + (double) (Main.player[index5].width / 2)) / 16.0), (int) (((double) Main.player[index5].position.Y + (double) (Main.player[index5].height / 2) + (double) Main.player[index5].gfxOffY) / 16.0))); continue; default: continue; } } } } private void DrawInterface_Healthbar_Worm(NPC head, int tailID, float scale) { NPC npc = head; for (int index = head.whoAmI + 1; index < 200; ++index) { if (Main.npc[index].active && Main.npc[index].type == tailID) { npc = Main.npc[index]; break; } } Vector2 vector2 = (head.position + npc.position) / 2f; this.DrawHealthBar(vector2.X + (float) (head.width / 2), vector2.Y + (float) (head.height / 2), head.life, head.lifeMax, Lighting.Brightness((int) (((double) head.position.X + (double) (head.width / 2)) / 16.0), (int) (((double) head.position.Y + (double) (head.height / 2) + (double) head.gfxOffY) / 16.0)), scale); } private static void DrawInterface_13_AchievementCompletePopups() => InGameNotificationsTracker.DrawInGame(Main.spriteBatch); private static bool DrawInterface_12_IngameFancyUI() { Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.SamplerStateForCursor, DepthStencilState.None, RasterizerState.CullCounterClockwise, (Effect) null, Main.UIScaleMatrix); Main.InGameUI.Draw(Main.spriteBatch, Main._drawInterfaceGameTime); bool flag = true; if (Main.inFancyUI && !IngameFancyUI.Draw(Main.spriteBatch, Main._drawInterfaceGameTime)) { flag = false; Main.DrawPendingMouseText(); } return flag; } private bool DrawInterface_11_IngameOptionsMenu() { bool flag = true; if (Main.ingameOptionsWindow) { this.DrawInterface_16_MapOrMinimap(); PlayerInput.SetZoom_UI(); Matrix uiScaleMatrix = Main.UIScaleMatrix; Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, (BlendState) null, (SamplerState) null, (DepthStencilState) null, (RasterizerState) null, (Effect) null, uiScaleMatrix); IngameOptions.Draw(this, Main.spriteBatch); this.DrawInterface_40_InteractItemIcon(); Main.DrawPendingMouseText(); flag = false; Main._MouseOversCanClear = true; } return flag; } private static bool DrawInterface_8_CheckF11UIHideToggle() { bool flag = true; if (Main.hideUI) { Main.maxQ = true; flag = false; Main._MouseOversCanClear = true; Main.DrawPendingMouseText(); } return flag; } private static bool DrawInterface_10_CheckCaptureManager() { bool flag = true; PlayerInput.SetDesiredZoomContext(ZoomContext.Unscaled_MouseInWorld); CaptureManager.Instance.Update(); if (CaptureManager.Instance.Active) { CaptureManager.Instance.Draw(Main.spriteBatch); flag = false; Main._MouseOversCanClear = true; PlayerInput.SetZoom_UI(); Matrix uiScaleMatrix = Main.UIScaleMatrix; Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, (BlendState) null, (SamplerState) null, (DepthStencilState) null, (RasterizerState) null, (Effect) null, uiScaleMatrix); Main.DrawPendingMouseText(); } return flag; } private static void DrawInterface_9_WireSelection() { if (!Main.hideUI) { Main.DrawInterface_Resources_GolfPower(); Main.DrawInterface_GolfBallIndicator(); } WiresUI.HandleWiresUI(Main.spriteBatch); } private static void DrawInterface_0_InterfaceLogic1() { if (Main.player[Main.myPlayer].selectedItem != 58 || Main.player[Main.myPlayer].itemAnimation <= 0) return; Main.mouseLeftRelease = false; } private void DrawInterface_7_TownNPCHouseBanners() { if (Main.EquipPage != 1 && (!UILinkPointNavigator.Shortcuts.NPCS_IconsDisplay || !PlayerInput.UsingGamepad)) return; if (Main.ignoreErrors) { try { this.DrawNPCHousesInWorld(); } catch (Exception ex) { TimeLogger.DrawException(ex); } } else this.DrawNPCHousesInWorld(); } private static void DrawInterface_6_TileGridOption() { bool flag = Main.MouseShowBuildingGrid && !Main.SmartCursorEnabled; int num1 = !PlayerInput.UsingGamepad || Main.SmartCursorEnabled ? 0 : (!PlayerInput.UsingGamepadUI ? 1 : 0); if (flag && !Main.player[Main.myPlayer].dead && !PlayerInput.CursorIsBusy) { float num2 = MathHelper.Lerp(0.0f, 0.7f, MathHelper.Clamp((float) (1.0 - (double) Main.player[Main.myPlayer].velocity.Length() / 6.0), 0.0f, 1f)); Main.MouseBuildingGridAlpha = MathHelper.Lerp(Main.MouseBuildingGridAlpha, num2, 0.2f); float buildingGridAlpha = Main.MouseBuildingGridAlpha; if ((double) buildingGridAlpha <= 0.0) return; Vector2 vector2_1 = Main.MouseWorld.ToTileCoordinates().ToVector2() * 16f; Vector2 vector2_2 = new Vector2((float) Main.offScreenRange, (float) Main.offScreenRange); int num3 = Main.drawToScreen ? 1 : 0; Vector2 position = vector2_1 - Main.screenPosition + new Vector2(8f); if ((double) Main.player[Main.myPlayer].gravDir == -1.0) position.Y = (float) Main.screenHeight - position.Y; Texture2D texture2D = TextureAssets.CursorRadial.Value; Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(), Microsoft.Xna.Framework.Color.White * 0.5f * buildingGridAlpha, 0.0f, texture2D.Size() / 2f, 1f, SpriteEffects.None, 0.0f); } else Main.MouseBuildingGridAlpha = MathHelper.Clamp(Main.MouseBuildingGridAlpha - 0.05f, 0.0f, 1f); } private static void DrawInterface_5_GamepadLockOn() => LockOnHelper.Draw(Main.spriteBatch); private static void DrawInterface_4_Ruler() { if (!Main.player[Main.myPlayer].rulerLine || Main.player[Main.myPlayer].builderAccStatus[0] != 0) return; float num1 = Main.player[Main.myPlayer].velocity.Length(); float num2 = 6f; float num3 = 2f; if ((double) num1 > (double) num2) return; float num4 = 1f; if ((double) num1 >= (double) num3) num4 = (float) (1.0 - ((double) num1 - (double) num3) / (double) num2); int num5 = 1; if ((double) Main.mouseX + (double) Main.screenPosition.X < (double) Main.player[Main.myPlayer].Center.X) num5 = -1; int num6 = (int) ((double) Main.player[Main.myPlayer].position.X + (double) (Main.player[Main.myPlayer].width / 2)) / 16; int num7 = (int) ((double) Main.player[Main.myPlayer].position.Y + (double) Main.player[Main.myPlayer].height - 2.0) / 16; if ((double) Main.player[Main.myPlayer].gravDir == -1.0) --num7; Vector2 mouseWorld = Main.MouseWorld; if (Math.Abs(num6 - (int) ((double) Main.MouseWorld.X / 16.0)) > 0) num6 += num5; if ((double) Main.player[Main.myPlayer].gravDir == -1.0) mouseWorld.Y += 16f; Vector2 vector2_1 = mouseWorld / 16f; Vector2 vector2_2 = new Vector2((float) num6, (float) num7); int num8 = (int) vector2_1.X - num6; int num9 = (int) vector2_1.Y - num7; Math.Abs(num8); Math.Abs(num9); Main.rulerLineDisplayValues.X = num8; Main.rulerLineDisplayValues.Y = num9; if (num8 == 0 && num9 == 0) return; Texture2D texture = TextureAssets.Extra[2].Value; Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 16); int num10 = num6; int num11 = num7; if ((double) Main.player[Main.myPlayer].gravDir == -1.0) --num11; float r = 0.24f; float g = 0.8f; float b = 0.9f; float a = 1f; float num12 = 0.8f; Microsoft.Xna.Framework.Color color1 = new Microsoft.Xna.Framework.Color(r, g, b, a) * num12 * num4; Main.spriteBatch.Draw(texture, Main.ReverseGravitySupport(new Vector2((float) num10, (float) num11) * 16f - Main.screenPosition, 16f), new Microsoft.Xna.Framework.Rectangle?(rectangle), color1, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); if (num8 != 0) { int num13 = Math.Sign(num8); rectangle.Y = num13 == 1 ? 16 : 32; while (num8 != 0) { num8 -= num13; num10 += num13; if (num8 == 0) rectangle.Y = 0; Microsoft.Xna.Framework.Color color2 = new Microsoft.Xna.Framework.Color(r, g, b, a) * num12 * num4; Main.spriteBatch.Draw(texture, Main.ReverseGravitySupport(new Vector2((float) num10, (float) num11) * 16f - Main.screenPosition, 16f), new Microsoft.Xna.Framework.Rectangle?(rectangle), color2, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } if (num9 == 0) return; int num14 = Math.Sign(num9); rectangle.Y = num14 == 1 ? 48 : 64; while (num9 != 0) { num9 -= num14; num11 += num14; if (num9 == 0) rectangle.Y = 0; Microsoft.Xna.Framework.Color color3 = new Microsoft.Xna.Framework.Color(r, g, b, a) * num12 * num4; Main.spriteBatch.Draw(texture, Main.ReverseGravitySupport(new Vector2((float) num10, (float) num11) * 16f - Main.screenPosition, 16f), new Microsoft.Xna.Framework.Rectangle?(rectangle), color3, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } private static void DrawInterface_3_LaserRuler() { if (!Main.player[Main.myPlayer].rulerGrid || Main.player[Main.myPlayer].builderAccStatus[1] != 0) return; Main.player[Main.myPlayer].velocity.Length(); float num1 = Vector2.Distance(Main.player[Main.myPlayer].position, Main.player[Main.myPlayer].shadowPos[2]); float num2 = 6f; Texture2D texture = TextureAssets.Extra[68].Value; float num3 = MathHelper.Lerp(0.2f, 0.7f, MathHelper.Clamp((float) (1.0 - (double) num1 / (double) num2), 0.0f, 1f)); Vector2 vector2_1 = (Main.screenPosition + new Vector2(-50f)).ToTileCoordinates().ToVector2() * 16f; int num4 = (Main.screenWidth + 100) / 16; int num5 = (Main.screenHeight + 100) / 16; Microsoft.Xna.Framework.Point tileCoordinates = Main.MouseWorld.ToTileCoordinates(); tileCoordinates.X -= (int) vector2_1.X / 16; tileCoordinates.Y -= (int) vector2_1.Y / 16; Microsoft.Xna.Framework.Color color1 = new Microsoft.Xna.Framework.Color(0.24f, 0.8f, 0.9f, 0.5f) * 0.4f * num3; Microsoft.Xna.Framework.Color color2 = new Microsoft.Xna.Framework.Color(1f, 0.8f, 0.9f, 0.5f) * 0.5f * num3; Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, 18, 18, 18); Vector2 vector2_2 = vector2_1 - Vector2.One; for (int index1 = 0; index1 < num4; ++index1) { for (int index2 = 0; index2 < num5; ++index2) { Microsoft.Xna.Framework.Color color3 = color1; Vector2 zero = Vector2.Zero; if (index1 != tileCoordinates.X && index2 != tileCoordinates.Y) { if (index1 != tileCoordinates.X + 1) { rectangle.X = 0; rectangle.Width = 16; } else { rectangle.X = 2; rectangle.Width = 14; zero.X = 2f; } if (index2 != tileCoordinates.Y + 1) { rectangle.Y = 18; rectangle.Height = 16; } else { rectangle.Y = 2; rectangle.Height = 14; zero.Y = 2f; } Main.spriteBatch.Draw(texture, Main.ReverseGravitySupport(new Vector2((float) index1, (float) index2) * 16f - Main.screenPosition + vector2_2 + zero, 16f), new Microsoft.Xna.Framework.Rectangle?(rectangle), color3, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } } rectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 18); for (int index = 0; index < num4; ++index) { if (index == tileCoordinates.X) Main.spriteBatch.Draw(texture, Main.ReverseGravitySupport(new Vector2((float) index, (float) tileCoordinates.Y) * 16f - Main.screenPosition + vector2_2, 16f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 16)), color2, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); else Main.spriteBatch.Draw(texture, Main.ReverseGravitySupport(new Vector2((float) index, (float) tileCoordinates.Y) * 16f - Main.screenPosition + vector2_2, 16f), new Microsoft.Xna.Framework.Rectangle?(rectangle), color2, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } rectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, 18, 16); for (int index = 0; index < num5; ++index) { if (index != tileCoordinates.Y) Main.spriteBatch.Draw(texture, Main.ReverseGravitySupport(new Vector2((float) tileCoordinates.X, (float) index) * 16f - Main.screenPosition + vector2_2, 16f), new Microsoft.Xna.Framework.Rectangle?(rectangle), color2, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } private static void DrawInterface_2_SmartCursorTargets() => Main.DrawSmartCursor(); private static void DrawInterface_1_1_DrawEmoteBubblesInWorld() { Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, (BlendState) null, SamplerState.PointClamp, (DepthStencilState) null, (RasterizerState) null, (Effect) null, Main.GameViewMatrix.ZoomMatrix); EmoteBubble.DrawAll(Main.spriteBatch); if (Main.instance.currentNPCShowingChatBubble != -1) Main.DrawNPCChatBubble(Main.instance.currentNPCShowingChatBubble); Main.instance.currentNPCShowingChatBubble = -1; } private static void DrawInterface_1_2_DrawEntityMarkersInWorld() { Player localPlayer = Main.LocalPlayer; if ((localPlayer.dead ? 0 : (localPlayer.HeldItem.summon ? 1 : 0)) == 0) return; Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, (BlendState) null, SamplerState.PointClamp, (DepthStencilState) null, (RasterizerState) null, (Effect) null, Main.GameViewMatrix.ZoomMatrix); Texture2D texture2D = TextureAssets.Extra[199].Value; Vector2 zero = Vector2.Zero; int minionAttackTargetNpc = localPlayer.MinionAttackTargetNPC; Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) Main.screenPosition.X, (int) Main.screenPosition.Y, Main.screenWidth, Main.screenHeight); for (int index = 0; index < 200; ++index) { NPC npc = Main.npc[index]; if (npc.active && npc.Hitbox.Intersects(rectangle)) { Vector2 vector2 = npc.Center - Main.screenPosition; if ((double) Main.player[Main.myPlayer].gravDir == -1.0) vector2.Y = (float) Main.screenHeight - vector2.Y; Vector2 position = vector2 + zero; if (index == minionAttackTargetNpc) { int frameY = (int) ((double) Main.GlobalTimeWrappedHourly * 10.0) % 4; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: 4, frameY: frameY, sizeOffsetY: -2); Vector2 origin = r.Size() / 2f; Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.White * 0.7f; color.A /= (byte) 2; Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(r), color, 0.0f, origin, 1f, SpriteEffects.None, 0.0f); } } } } private static void MouseOversTryToClear() { if (!Main._MouseOversCanClear) return; Main._MouseOversCanClear = false; Main.MouseOversClear(); } private static void MouseOversClear() { Main.player[Main.myPlayer].cursorItemIconEnabled = false; Main.player[Main.myPlayer].cursorItemIconID = 0; Main.player[Main.myPlayer].cursorItemIconText = string.Empty; Main.signHover = -1; } public static void ItemIconCacheUpdate(int selectedItemID) { Main._itemIconCacheScreenPosition = Main.MouseScreen; Main._itemIconCacheSelectedItemID = selectedItemID; Main._itemIconCacheTime = 10; } public static void ItemIconCacheVerification() { if (Main._itemIconCacheTime <= 0) return; double num = (double) Vector2.Distance(Main._itemIconCacheScreenPosition, Main.MouseScreen); if (num != 0.0) --Main._itemIconCacheTime; if (num > 4.0) Main._itemIconCacheTime = 0; if (Main._itemIconCacheSelectedItemID == Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type) return; Main._itemIconCacheTime = 0; } public static void DrawWallOfFish() { List intList = new List(); for (int index = 2297; index <= 2321; ++index) intList.Add(index); for (int index = 2450; index <= 2488; ++index) intList.Add(index); for (int index1 = 0; index1 < 5; ++index1) { float num = 10f; Vector2 position = new Vector2((float) ((double) Main.screenWidth / (double) num * ((double) Main.GlobalTimeWrappedHourly % (double) num)), -100f); position.X += (float) (14 * index1); position.Y += (float) (index1 % 2 * 14); int index2 = 30 * index1; while ((double) position.Y < (double) (Main.screenHeight + 100)) { if (++index2 >= intList.Count) index2 = 0; position.Y += 26f; Main.instance.LoadItem(intList[index2]); Texture2D texture2D = TextureAssets.Item[intList[index2]].Value; Microsoft.Xna.Framework.Point tileCoordinates = (position + Main.screenPosition).ToTileCoordinates(); Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(), Lighting.GetColor(tileCoordinates.X, tileCoordinates.Y), 0.7853982f, texture2D.Size() / 2f, 1f, SpriteEffects.None, 0.0f); } } } public static void DrawWallOfStars() { bool flag = true; if (flag) Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, (Effect) null, Main.Transform); int i = Projectile.NewProjectile(Vector2.Zero, Vector2.UnitX, 12, 0, 0.0f, Main.myPlayer); Projectile projectile = Main.projectile[i]; for (int index = 0; index < 5; ++index) { float num = 10f; Vector2 vector2 = new Vector2((float) ((double) Main.screenWidth / (double) num * ((double) Main.GlobalTimeWrappedHourly % (double) num)), -100f); vector2.X += (float) (14 * index); vector2.Y += (float) (index % 2 * 14); while ((double) vector2.Y < (double) (Main.screenHeight + 100)) { vector2.Y += 26f; projectile.position = Vector2.One * 10f; projectile.velocity = Vector2.UnitX * 10f; projectile.rotation = Main.GlobalTimeWrappedHourly * 6.283185f; projectile.Update(i); projectile.position = vector2 + Main.screenPosition; Main.instance.DrawProj(i); } } projectile.position = Vector2.One * 10f; projectile.Kill(); if (!flag) return; Main.spriteBatch.End(); } private static void DrawSmartCursor() { if (!Main.SmartCursorShowing || Main.player[Main.myPlayer].dead) return; Vector2 vector2_1 = new Vector2((float) Main.SmartCursorX, (float) Main.SmartCursorY) * 16f; Vector2 vector2_2 = new Vector2((float) Main.offScreenRange, (float) Main.offScreenRange); int num1 = Main.drawToScreen ? 1 : 0; Vector2 position = vector2_1 - Main.screenPosition; if ((double) Main.player[Main.myPlayer].gravDir == -1.0) position.Y = (float) ((double) Main.screenHeight - (double) position.Y - 16.0); Microsoft.Xna.Framework.Color newColor = Lighting.GetColor(Main.SmartCursorX, Main.SmartCursorY) * 1f; Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1); float R = 1f; float G1 = 0.9f; float B1 = 0.1f; float A1 = 1f; float num2 = 0.6f; Main.spriteBatch.Draw(TextureAssets.MagicPixel.Value, position, new Microsoft.Xna.Framework.Rectangle?(rectangle), Main.buffColor(newColor, R, G1, B1, A1) * num2, 0.0f, Vector2.Zero, 8f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.MagicPixel.Value, position + Vector2.UnitX * 8f, new Microsoft.Xna.Framework.Rectangle?(rectangle), Main.buffColor(newColor, R, G1, B1, A1) * num2, 0.0f, Vector2.Zero, 8f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.MagicPixel.Value, position + Vector2.UnitY * 8f, new Microsoft.Xna.Framework.Rectangle?(rectangle), Main.buffColor(newColor, R, G1, B1, A1) * num2, 0.0f, Vector2.Zero, 8f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.MagicPixel.Value, position + Vector2.One * 8f, new Microsoft.Xna.Framework.Rectangle?(rectangle), Main.buffColor(newColor, R, G1, B1, A1) * num2, 0.0f, Vector2.Zero, 8f, SpriteEffects.None, 0.0f); float B2 = 0.3f; float G2 = 0.95f; float num3; float A2 = num3 = 1f; Main.spriteBatch.Draw(TextureAssets.MagicPixel.Value, position + Vector2.UnitX * -2f, new Microsoft.Xna.Framework.Rectangle?(rectangle), Main.buffColor(newColor, R, G2, B2, A2) * num3, 0.0f, Vector2.Zero, new Vector2(2f, 16f), SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.MagicPixel.Value, position + Vector2.UnitX * 16f, new Microsoft.Xna.Framework.Rectangle?(rectangle), Main.buffColor(newColor, R, G2, B2, A2) * num3, 0.0f, Vector2.Zero, new Vector2(2f, 16f), SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.MagicPixel.Value, position + Vector2.UnitY * -2f, new Microsoft.Xna.Framework.Rectangle?(rectangle), Main.buffColor(newColor, R, G2, B2, A2) * num3, 0.0f, Vector2.Zero, new Vector2(16f, 2f), SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.MagicPixel.Value, position + Vector2.UnitY * 16f, new Microsoft.Xna.Framework.Rectangle?(rectangle), Main.buffColor(newColor, R, G2, B2, A2) * num3, 0.0f, Vector2.Zero, new Vector2(16f, 2f), SpriteEffects.None, 0.0f); } private static void DrawSmartInteract() { if (!Main.SmartInteractShowingGenuine || Main.SmartInteractNPC != -1 || Main.SmartInteractProj != -1 || Main.player[Main.myPlayer].dead) return; Vector2 vector2_1 = new Vector2((float) Main.SmartInteractX, (float) Main.SmartInteractY) * 16f; Vector2 vector2_2 = new Vector2((float) Main.offScreenRange, (float) Main.offScreenRange); int num1 = Main.drawToScreen ? 1 : 0; Vector2 position = vector2_1 - Main.screenPosition; if ((double) Main.player[Main.myPlayer].gravDir == -1.0) position.Y = (float) ((double) Main.screenHeight - (double) position.Y - 16.0); Microsoft.Xna.Framework.Color newColor = Lighting.GetColor(Main.SmartInteractX, Main.SmartInteractY) * 1f; Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1); float R1 = 0.1f; float G1 = 0.9f; float B = 1f; float A1 = 1f; float num2 = 0.6f; Main.spriteBatch.Draw(TextureAssets.MagicPixel.Value, position, new Microsoft.Xna.Framework.Rectangle?(rectangle), Main.buffColor(newColor, R1, G1, B, A1) * num2, 0.0f, Vector2.Zero, 8f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.MagicPixel.Value, position + Vector2.UnitX * 8f, new Microsoft.Xna.Framework.Rectangle?(rectangle), Main.buffColor(newColor, R1, G1, B, A1) * num2, 0.0f, Vector2.Zero, 8f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.MagicPixel.Value, position + Vector2.UnitY * 8f, new Microsoft.Xna.Framework.Rectangle?(rectangle), Main.buffColor(newColor, R1, G1, B, A1) * num2, 0.0f, Vector2.Zero, 8f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.MagicPixel.Value, position + Vector2.One * 8f, new Microsoft.Xna.Framework.Rectangle?(rectangle), Main.buffColor(newColor, R1, G1, B, A1) * num2, 0.0f, Vector2.Zero, 8f, SpriteEffects.None, 0.0f); float R2 = 0.3f; float G2 = 0.95f; float num3; float A2 = num3 = 1f; Main.spriteBatch.Draw(TextureAssets.MagicPixel.Value, position + Vector2.UnitX * -2f, new Microsoft.Xna.Framework.Rectangle?(rectangle), Main.buffColor(newColor, R2, G2, B, A2) * num3, 0.0f, Vector2.Zero, new Vector2(2f, 16f), SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.MagicPixel.Value, position + Vector2.UnitX * 16f, new Microsoft.Xna.Framework.Rectangle?(rectangle), Main.buffColor(newColor, R2, G2, B, A2) * num3, 0.0f, Vector2.Zero, new Vector2(2f, 16f), SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.MagicPixel.Value, position + Vector2.UnitY * -2f, new Microsoft.Xna.Framework.Rectangle?(rectangle), Main.buffColor(newColor, R2, G2, B, A2) * num3, 0.0f, Vector2.Zero, new Vector2(16f, 2f), SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.MagicPixel.Value, position + Vector2.UnitY * 16f, new Microsoft.Xna.Framework.Rectangle?(rectangle), Main.buffColor(newColor, R2, G2, B, A2) * num3, 0.0f, Vector2.Zero, new Vector2(16f, 2f), SpriteEffects.None, 0.0f); } private void DrawInterface_30_Hotbar() { try { this.GUIHotbarDrawInner(); } catch (Exception ex) { if (Main.ignoreErrors) TimeLogger.DrawException(ex); else throw; } } public void GUIChatDraw() { if (Main.ignoreErrors) { try { if (!(Main.npcChatText != "") && Main.player[Main.myPlayer].sign == -1 || Main.editChest) return; this.GUIChatDrawInner(); } catch (Exception ex) { TimeLogger.DrawException(ex); } } else { if (!(Main.npcChatText != "") && Main.player[Main.myPlayer].sign == -1 || Main.editChest) return; this.GUIChatDrawInner(); } } public static bool ShouldDrawInfoIconsHorizontally => !Main._cannotDrawAccessoriesHorizontally && (Main.mapStyle != 1 || !Main.mapEnabled || Main.screenHeight >= 820) && (Main.mapStyle == 1 || Main.screenWidth >= 855) && !PlayerInput.UsingGamepad; public static bool CanShowInfoAccs => (Main.npcChatText == null || Main.npcChatText == "" || Main.player[Main.myPlayer].chest > -1) && Main.player[Main.myPlayer].sign < 0; public static void DrawItemIcon( SpriteBatch spriteBatch, Item theItem, Vector2 screenPositionForItemCenter, Microsoft.Xna.Framework.Color itemLightColor, float sizeLimit) { Main.instance.LoadItem(theItem.type); Texture2D texture2D = TextureAssets.Item[theItem.type].Value; Microsoft.Xna.Framework.Rectangle rectangle = Main.itemAnimations[theItem.type] == null ? texture2D.Frame() : Main.itemAnimations[theItem.type].GetFrame(texture2D); int width = rectangle.Width; int height = rectangle.Height; float num1 = 1f; if ((double) width > (double) sizeLimit || (double) height > (double) sizeLimit) num1 = width <= height ? sizeLimit / (float) height : sizeLimit / (float) width; float num2 = num1 * theItem.scale; SpriteEffects effects = SpriteEffects.None; Microsoft.Xna.Framework.Color currentColor = itemLightColor; float scale1 = 1f; ItemSlot.GetItemLight(ref currentColor, ref scale1, theItem); float scale2 = num2 * scale1; spriteBatch.Draw(texture2D, screenPositionForItemCenter, new Microsoft.Xna.Framework.Rectangle?(rectangle), currentColor, 0.0f, new Vector2((float) (width / 2), (float) (height / 2)), scale2, effects, 0.0f); if (!(theItem.color != new Microsoft.Xna.Framework.Color())) return; spriteBatch.Draw(texture2D, screenPositionForItemCenter, new Microsoft.Xna.Framework.Rectangle?(rectangle), theItem.GetColor(itemLightColor), 0.0f, new Vector2((float) (width / 2), (float) (height / 2)), scale2, effects, 0.0f); } private void DrawInfoAccs() { if (!Main.CanShowInfoAccs) return; bool flag1 = false; bool flag2 = false; bool flag3 = false; bool flag4 = false; bool flag5 = false; bool flag6 = false; bool flag7 = false; bool flag8 = false; bool flag9 = false; bool flag10 = false; bool flag11 = false; bool flag12 = false; int index1 = -1; int num1 = -10; int drawnCount = 0; string cursorText = ""; float num2 = 215f; int StartX = 0; if (GameCulture.FromCultureName(GameCulture.CultureName.Russian).IsActive) { StartX = -50; num2 += 50f; } for (int index2 = 0; index2 < 12; ++index2) { string str1 = ""; string str2 = ""; if (Main.player[Main.myPlayer].accWatch > 0 && !flag1 && (!Main.player[Main.myPlayer].hideInfo[0] || Main.playerInventory)) { index1 = 0; str2 = Lang.inter[95].Value; string textValue = Language.GetTextValue("GameUI.TimeAtMorning"); double time = Main.time; if (!Main.dayTime) time += 54000.0; double num3 = time / 86400.0 * 24.0 - 7.5 - 12.0; if (num3 < 0.0) num3 += 24.0; if (num3 >= 12.0) textValue = Language.GetTextValue("GameUI.TimePastMorning"); int num4 = (int) num3; double num5 = (double) (int) ((num3 - (double) num4) * 60.0); string str3 = string.Concat((object) num5); if (num5 < 10.0) str3 = "0" + str3; if (num4 > 12) num4 -= 12; if (num4 == 0) num4 = 12; if (Main.player[Main.myPlayer].accWatch == 1) str3 = "00"; else if (Main.player[Main.myPlayer].accWatch == 2) str3 = num5 >= 30.0 ? "30" : "00"; str1 = num4.ToString() + ":" + str3 + " " + textValue; flag1 = true; } else if (Main.player[Main.myPlayer].accWeatherRadio && !flag5 && (!Main.player[Main.myPlayer].hideInfo[1] || Main.playerInventory)) { index1 = 1; str2 = Lang.inter[96].Value; str1 = !Main.IsItStorming ? ((double) Main.maxRaining <= 0.6 ? ((double) Main.maxRaining < 0.2 ? ((double) Main.maxRaining <= 0.0 ? ((double) Main.cloudBGActive <= 0.0 ? (Main.numClouds <= 90 ? (Main.numClouds <= 55 ? (Main.numClouds <= 15 ? Language.GetTextValue("GameUI.Clear") : Language.GetTextValue("GameUI.PartlyCloudy")) : Language.GetTextValue("GameUI.Cloudy")) : Language.GetTextValue("GameUI.MostlyCloudy")) : Language.GetTextValue("GameUI.Overcast")) : Language.GetTextValue("GameUI.LightRain")) : Language.GetTextValue("GameUI.Rain")) : Language.GetTextValue("GameUI.HeavyRain")) : Language.GetTextValue("GameUI.Storm"); int num6 = (int) ((double) Main.windSpeedCurrent * 50.0); if (num6 < 0) str1 += Language.GetTextValue("GameUI.EastWind", (object) Math.Abs(num6)); else if (num6 > 0) str1 += Language.GetTextValue("GameUI.WestWind", (object) num6); flag5 = true; } else if (Main.player[Main.myPlayer].accCalendar && !flag8 && (!Main.player[Main.myPlayer].hideInfo[7] || Main.playerInventory)) { index1 = !Main.bloodMoon || Main.dayTime ? (!Main.eclipse || !Main.dayTime ? 7 : 8) : 8; str2 = Lang.inter[102].Value; switch (Main.moonPhase) { case 0: str1 = Language.GetTextValue("GameUI.FullMoon"); break; case 1: str1 = Language.GetTextValue("GameUI.WaningGibbous"); break; case 2: str1 = Language.GetTextValue("GameUI.ThirdQuarter"); break; case 3: str1 = Language.GetTextValue("GameUI.WaningCrescent"); break; case 4: str1 = Language.GetTextValue("GameUI.NewMoon"); break; case 5: str1 = Language.GetTextValue("GameUI.WaxingCrescent"); break; case 6: str1 = Language.GetTextValue("GameUI.FirstQuarter"); break; case 7: str1 = Language.GetTextValue("GameUI.WaxingGibbous"); break; } flag8 = true; } else if (Main.player[Main.myPlayer].accFishFinder && !flag4 && (!Main.player[Main.myPlayer].hideInfo[2] || Main.playerInventory)) { bool flag13 = false; index1 = 2; str2 = Lang.inter[97].Value; for (int index3 = 0; index3 < 1000; ++index3) { if (Main.projectile[index3].active && Main.projectile[index3].owner == Main.myPlayer && Main.projectile[index3].bobber) { flag13 = true; break; } } if (flag13) { str1 = Main.player[Main.myPlayer].displayedFishingInfo; } else { PlayerFishingConditions fishingConditions = Main.player[Main.myPlayer].GetFishingConditions(); str1 = fishingConditions.BaitItemType != 2673 ? (Main.player[Main.myPlayer].displayedFishingInfo = Language.GetTextValue("GameUI.FishingPower", (object) fishingConditions.FinalFishingLevel)) : Language.GetTextValue("GameUI.FishingWarning"); } flag4 = true; } else if (Main.player[Main.myPlayer].accOreFinder && !flag10 && (!Main.player[Main.myPlayer].hideInfo[10] || Main.playerInventory)) { index1 = 10; str2 = Lang.inter[104].Value; if (Main.SceneMetrics.bestOre <= 0) { str1 = Language.GetTextValue("GameUI.NoTreasureNearby"); } else { int baseOption = 0; int tileType = Main.SceneMetrics.bestOre; Microsoft.Xna.Framework.Point? closestOrePosition = Main.SceneMetrics.ClosestOrePosition; if (closestOrePosition.HasValue) { closestOrePosition = Main.SceneMetrics.ClosestOrePosition; Microsoft.Xna.Framework.Point pt = closestOrePosition.Value; Tile tileSafely = Framing.GetTileSafely(pt); if (tileSafely.active()) { MapHelper.GetTileBaseOption(pt.Y, tileSafely, ref baseOption); tileType = (int) tileSafely.type; if (TileID.Sets.BasicChest[tileType] || TileID.Sets.BasicChestFake[tileType]) baseOption = 0; } } str1 = Language.GetTextValue("GameUI.OreDetected", (object) Lang.GetMapObjectName(MapHelper.TileToLookup(tileType, baseOption))); } flag10 = true; } else if (Main.player[Main.myPlayer].accCritterGuide && !flag11 && (!Main.player[Main.myPlayer].hideInfo[11] || Main.playerInventory)) { flag11 = true; index1 = 11; str2 = Lang.inter[105].Value; int num7 = 1300; int num8 = 0; int index4 = -1; if (Main.player[Main.myPlayer].accCritterGuideCounter <= (byte) 0) { Main.player[Main.myPlayer].accCritterGuideCounter = (byte) 15; for (int index5 = 0; index5 < 200; ++index5) { if (Main.npc[index5].active && Main.npc[index5].rarity > num8 && (double) (Main.npc[index5].Center - Main.player[Main.myPlayer].Center).Length() < (double) num7) { index4 = index5; num8 = Main.npc[index5].rarity; } } Main.player[Main.myPlayer].accCritterGuideNumber = (byte) index4; } else { --Main.player[Main.myPlayer].accCritterGuideCounter; index4 = (int) Main.player[Main.myPlayer].accCritterGuideNumber; } str1 = index4 < 0 || index4 >= 200 || !Main.npc[index4].active || Main.npc[index4].rarity <= 0 ? Language.GetTextValue("GameUI.NoRareCreatures") : Main.npc[index4].GivenOrTypeName; } else if (Main.player[Main.myPlayer].accThirdEye && !flag6 && (!Main.player[Main.myPlayer].hideInfo[5] || Main.playerInventory)) { flag6 = true; index1 = 5; str2 = Lang.inter[100].Value; int num9 = 2000; if (Main.player[Main.myPlayer].accThirdEyeCounter == (byte) 0) { Main.player[Main.myPlayer].accThirdEyeNumber = (byte) 0; Main.player[Main.myPlayer].accThirdEyeCounter = (byte) 15; for (int index6 = 0; index6 < 200; ++index6) { if (Main.npc[index6].active && !Main.npc[index6].friendly && Main.npc[index6].damage > 0 && Main.npc[index6].lifeMax > 5 && !Main.npc[index6].dontCountMe && (double) (Main.npc[index6].Center - Main.player[Main.myPlayer].Center).Length() < (double) num9) ++Main.player[Main.myPlayer].accThirdEyeNumber; } } else --Main.player[Main.myPlayer].accThirdEyeCounter; str1 = Main.player[Main.myPlayer].accThirdEyeNumber != (byte) 0 ? (Main.player[Main.myPlayer].accThirdEyeNumber != (byte) 1 ? Language.GetTextValue("GameUI.EnemiesNearby", (object) Main.player[Main.myPlayer].accThirdEyeNumber) : Language.GetTextValue("GameUI.OneEnemyNearby")) : Language.GetTextValue("GameUI.NoEnemiesNearby"); } else if (Main.player[Main.myPlayer].accJarOfSouls && !flag7 && (!Main.player[Main.myPlayer].hideInfo[6] || Main.playerInventory)) { flag7 = true; index1 = 6; str2 = Lang.inter[101].Value; int lastCreatureHit = Main.player[Main.myPlayer].lastCreatureHit; str1 = lastCreatureHit > 0 ? Lang.GetNPCNameValue(Item.BannerToNPC(lastCreatureHit)) + ": " + (object) NPC.killCount[lastCreatureHit] : Language.GetTextValue("GameUI.NoKillCount"); } else if (Main.player[Main.myPlayer].accDreamCatcher && !flag12 && (!Main.player[Main.myPlayer].hideInfo[12] || Main.playerInventory)) { index1 = 12; str2 = Lang.inter[106].Value; Main.player[Main.myPlayer].checkDPSTime(); int dps = Main.player[Main.myPlayer].getDPS(); flag12 = true; str1 = dps != 0 ? Language.GetTextValue("GameUI.DPS", (object) Main.player[Main.myPlayer].getDPS()) : Language.GetTextValue("GameUI.NoDPS"); } else if (Main.player[Main.myPlayer].accStopwatch && !flag9 && (!Main.player[Main.myPlayer].hideInfo[9] || Main.playerInventory)) { index1 = 9; str2 = Lang.inter[103].Value; Vector2 vector2 = Main.player[Main.myPlayer].velocity + Main.player[Main.myPlayer].instantMovementAccumulatedThisFrame; if (Main.player[Main.myPlayer].mount.Active && Main.player[Main.myPlayer].mount.IsConsideredASlimeMount && (double) Main.player[Main.myPlayer].velocity.Y != 0.0 && !Main.player[Main.myPlayer].SlimeDontHyperJump) vector2.Y += Main.player[Main.myPlayer].velocity.Y; int num10 = (int) (1.0 + (double) vector2.Length() * 6.0); if (num10 > Main.player[Main.myPlayer].speedSlice.Length) num10 = Main.player[Main.myPlayer].speedSlice.Length; float num11 = 0.0f; for (int index7 = num10 - 1; index7 > 0; --index7) Main.player[Main.myPlayer].speedSlice[index7] = Main.player[Main.myPlayer].speedSlice[index7 - 1]; Main.player[Main.myPlayer].speedSlice[0] = vector2.Length(); for (int index8 = 0; index8 < Main.player[Main.myPlayer].speedSlice.Length; ++index8) { if (index8 < num10) num11 += Main.player[Main.myPlayer].speedSlice[index8]; else Main.player[Main.myPlayer].speedSlice[index8] = num11 / (float) num10; } float num12 = num11 / (float) num10; int num13 = 42240; int num14 = 216000; float num15 = num12 * (float) num14 / (float) num13; if (!Main.player[Main.myPlayer].merman && !Main.player[Main.myPlayer].ignoreWater) { if (Main.player[Main.myPlayer].honeyWet) num15 /= 4f; else if (Main.player[Main.myPlayer].wet) num15 /= 2f; } str1 = Language.GetTextValue("GameUI.Speed", (object) Math.Round((double) num15)); flag9 = true; } else if (Main.player[Main.myPlayer].accCompass > 0 && !flag3 && (!Main.player[Main.myPlayer].hideInfo[3] || Main.playerInventory)) { index1 = 3; str2 = Lang.inter[98].Value; int num16 = (int) (((double) Main.player[Main.myPlayer].position.X + (double) (Main.player[Main.myPlayer].width / 2)) * 2.0 / 16.0 - (double) Main.maxTilesX); str1 = num16 <= 0 ? (num16 >= 0 ? Language.GetTextValue("GameUI.CompassCenter") : Language.GetTextValue("GameUI.CompassWest", (object) -num16)) : Language.GetTextValue("GameUI.CompassEast", (object) num16); flag3 = true; } else if (Main.player[Main.myPlayer].accDepthMeter > 0 && !flag2 && (!Main.player[Main.myPlayer].hideInfo[4] || Main.playerInventory)) { index1 = 4; str2 = Lang.inter[99].Value; int num17 = (int) (((double) Main.player[Main.myPlayer].position.Y + (double) Main.player[Main.myPlayer].height) * 2.0 / 16.0 - Main.worldSurface * 2.0); float num18 = (float) (Main.maxTilesX / 4200); float num19 = num18 * num18; int num20 = 1200; float num21 = (float) (((double) Main.player[Main.myPlayer].Center.Y / 16.0 - (65.0 + 10.0 * (double) num19)) / (Main.worldSurface / 5.0)); string str4 = (double) Main.player[Main.myPlayer].position.Y <= (double) ((Main.maxTilesY - 204) * 16) ? ((double) Main.player[Main.myPlayer].position.Y <= Main.rockLayer * 16.0 + (double) (num20 / 2) + 16.0 ? (num17 <= 0 ? ((double) num21 < 1.0 ? Language.GetTextValue("GameUI.LayerSpace") : Language.GetTextValue("GameUI.LayerSurface")) : Language.GetTextValue("GameUI.LayerUnderground")) : Language.GetTextValue("GameUI.LayerCaverns")) : Language.GetTextValue("GameUI.LayerUnderworld"); int num22 = Math.Abs(num17); str1 = (num22 != 0 ? Language.GetTextValue("GameUI.Depth", (object) num22) : Language.GetTextValue("GameUI.DepthLevel")) + " " + str4; flag2 = true; } if (str1 != "") { int X; int Y; Main.GetInfoAccIconPosition(drawnCount, StartX, out X, out Y); if (index1 >= 0) { ++drawnCount; int num23 = 22; if (Main.screenHeight < 650) num23 = 20; Vector2 position = new Vector2((float) X, (float) (Y + 74 + num23 * index2 + 52)); int index9 = index1; if (index9 == 8) index9 = 7; Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.White; bool flag14 = false; if (Main.playerInventory) { position = new Vector2((float) X, (float) Y); if ((double) Main.mouseX >= (double) position.X && (double) Main.mouseY >= (double) position.Y && (double) Main.mouseX <= (double) position.X + (double) TextureAssets.InfoIcon[index1].Width() && (double) Main.mouseY <= (double) position.Y + (double) TextureAssets.InfoIcon[index1].Height() && !PlayerInput.IgnoreMouseInterface) { flag14 = true; Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeft && Main.mouseLeftRelease) { SoundEngine.PlaySound(12); Main.mouseLeftRelease = false; Main.player[Main.myPlayer].hideInfo[index9] = !Main.player[Main.myPlayer].hideInfo[index9]; } if (!Main.mouseText) { cursorText = str2; Main.mouseText = true; } } if (Main.player[Main.myPlayer].hideInfo[index9]) color = new Microsoft.Xna.Framework.Color(80, 80, 80, 70); } else if ((double) Main.mouseX >= (double) position.X && (double) Main.mouseY >= (double) position.Y && (double) Main.mouseX <= (double) position.X + (double) TextureAssets.InfoIcon[index1].Width() && (double) Main.mouseY <= (double) position.Y + (double) TextureAssets.InfoIcon[index1].Height() && !Main.mouseText) { num1 = index2; cursorText = str2; Main.mouseText = true; } UILinkPointNavigator.SetPosition(1558 + drawnCount - 1, position + TextureAssets.InfoIcon[index1].Value.Size() * 0.75f); Main.spriteBatch.Draw(TextureAssets.InfoIcon[index1].Value, position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.InfoIcon[index1].Width(), TextureAssets.InfoIcon[index1].Height())), color, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); if (flag14) Main.spriteBatch.Draw(TextureAssets.InfoIcon[13].Value, position - Vector2.One * 2f, new Microsoft.Xna.Framework.Rectangle?(), Main.OurFavoriteColor, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); X += 20; } UILinkPointNavigator.Shortcuts.INFOACCCOUNT = drawnCount; if (!Main.playerInventory) { Vector2 vector2_1 = new Vector2(1f); Vector2 vector2_2 = FontAssets.MouseText.Value.MeasureString(str1); if ((double) vector2_2.X > (double) num2) vector2_1.X = num2 / vector2_2.X; if ((double) vector2_1.X < 0.579999983310699) vector2_1.Y = (float) (1.0 - (double) vector2_1.X / 3.0); for (int index10 = 0; index10 < 5; ++index10) { int num24 = 0; int num25 = 0; Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.Black; if (index10 == 0) num24 = -2; if (index10 == 1) num24 = 2; if (index10 == 2) num25 = -2; if (index10 == 3) num25 = 2; if (index10 == 4) color = new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor); if (index2 > num1 && index2 < num1 + 2) color = new Microsoft.Xna.Framework.Color((int) color.R / 3, (int) color.G / 3, (int) color.B / 3, (int) color.A / 3); int num26 = 22; if (Main.screenHeight < 650) num26 = 20; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, str1, new Vector2((float) (X + num24), (float) (Y + 74 + num26 * index2 + num25 + 48)), color, 0.0f, new Vector2(), vector2_1, SpriteEffects.None, 0.0f); } } } } if (string.IsNullOrEmpty(cursorText)) return; if (Main.playerInventory) Main.player[Main.myPlayer].mouseInterface = true; this.MouseText(cursorText); } private static void GetInfoAccIconPosition(int drawnCount, int StartX, out int X, out int Y) { if (!Main.playerInventory) { X = Main.screenWidth - 280; Y = -32; if (Main.mapStyle == 1 && Main.mapEnabled) Y += 261; } else if (Main.ShouldDrawInfoIconsHorizontally) { X = Main.screenWidth - 280 + 20 * drawnCount - 10; Y = 94; if (Main.mapStyle == 1 && Main.mapEnabled) Y += 261; } else { int num = (int) (52.0 * (double) Main.inventoryScale); X = 697 - num * 4 + Main.screenWidth - 800 + 20 * (drawnCount % 2); Y = 114 + Main.mH + num * 7 + num / 2 + 20 * (drawnCount / 2) + 8 * (drawnCount / 4) - 20; if (Main.EquipPage == 2) { X += num + num / 2; Y -= num; } } X += StartX; } private void DrawBuilderAccToggles(Vector2 start) { if (!Main.playerInventory) return; string.IsNullOrEmpty(Main.npcChatText); if (Main.player[Main.myPlayer].sign >= 0) return; int num1 = 0; Player plr = Main.player[Main.myPlayer]; int[] builderAccStatus = Main.player[Main.myPlayer].builderAccStatus; int blockReplaceIcons; int torchGodIcons; int totalDrawnIcons; Main.GetBuilderAccsCountToShow(plr, out blockReplaceIcons, out torchGodIcons, out totalDrawnIcons); start.Y += (float) (24 * torchGodIcons); bool pushSideToolsUp = totalDrawnIcons >= 10; int num2 = 10; for (int index1 = 0; index1 < num2; ++index1) { int index2 = index1 - 2; switch (index1) { case 0: index2 = 8; break; case 1: index2 = 9; break; } Texture2D texture = TextureAssets.BuilderAcc.Value; Microsoft.Xna.Framework.Rectangle r = new Microsoft.Xna.Framework.Rectangle(0, 16, 14, 14); Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.White; Microsoft.Xna.Framework.Color firstColor = new Microsoft.Xna.Framework.Color((int) sbyte.MaxValue, (int) sbyte.MaxValue, (int) sbyte.MaxValue); Vector2 vector2 = start + new Vector2(0.0f, (float) (num1 * 24)); if (pushSideToolsUp) vector2.Y -= 24f; bool flag1 = Utils.CenteredRectangle(vector2, new Vector2(14f)).Contains(Main.MouseScreen.ToPoint()) && !PlayerInput.IgnoreMouseInterface; bool flag2 = flag1 && Main.mouseLeft && Main.mouseLeftRelease; switch (index2) { case 0: if (plr.rulerLine) { r.X = index2 * 16; color = builderAccStatus[index2] == 0 ? color : firstColor; if (flag1) { plr.mouseInterface = true; this.MouseText(builderAccStatus[index2] == 0 ? Language.GetTextValue("GameUI.RulerOn") : Language.GetTextValue("GameUI.RulerOff")); Main.mouseText = true; } if (flag2) { builderAccStatus[index2] = builderAccStatus[index2] == 0 ? 1 : 0; SoundEngine.PlaySound(12); Main.mouseLeftRelease = false; break; } break; } continue; case 1: if (plr.rulerGrid) { r.X = index2 * 16; color = builderAccStatus[index2] == 0 ? color : firstColor; if (flag1) { plr.mouseInterface = true; this.MouseText(builderAccStatus[index2] == 0 ? Language.GetTextValue("GameUI.MechanicalRulerOn") : Language.GetTextValue("GameUI.MechanicalRulerOff")); Main.mouseText = true; } if (flag2) { builderAccStatus[index2] = builderAccStatus[index2] == 0 ? 1 : 0; SoundEngine.PlaySound(12); Main.mouseLeftRelease = false; break; } break; } continue; case 2: if (plr.autoActuator) { r.X = index2 * 16; color = builderAccStatus[index2] == 0 ? color : firstColor; if (flag1) { plr.mouseInterface = true; this.MouseText(builderAccStatus[index2] == 0 ? Language.GetTextValue("GameUI.ActuationDeviceOn") : Language.GetTextValue("GameUI.ActuationDeviceOff")); Main.mouseText = true; } if (flag2) { builderAccStatus[index2] = builderAccStatus[index2] == 0 ? 1 : 0; SoundEngine.PlaySound(12); Main.mouseLeftRelease = false; break; } break; } continue; case 3: if (plr.autoPaint) { r.X = index2 * 16; color = builderAccStatus[index2] == 0 ? color : firstColor; if (flag1) { plr.mouseInterface = true; this.MouseText(builderAccStatus[index2] == 0 ? Language.GetTextValue("GameUI.PaintSprayerOn") : Language.GetTextValue("GameUI.PaintSprayerOff")); Main.mouseText = true; } if (flag2) { builderAccStatus[index2] = builderAccStatus[index2] == 0 ? 1 : 0; SoundEngine.PlaySound(12); Main.mouseLeftRelease = false; break; } break; } continue; case 4: case 5: case 6: case 7: case 9: if (plr.InfoAccMechShowWires) { r.X = index2 * 16; color = builderAccStatus[index2] == 0 ? color : (builderAccStatus[index2] == 1 ? firstColor : (builderAccStatus[index2] == 2 ? firstColor.MultiplyRGBA(new Microsoft.Xna.Framework.Color(0.66f, 0.66f, 0.66f, 0.66f)) : firstColor.MultiplyRGBA(new Microsoft.Xna.Framework.Color(0.33f, 0.33f, 0.33f, 0.33f)))); if (flag1) { plr.mouseInterface = true; string str1 = ""; switch (index2) { case 4: str1 = Language.GetTextValue("Game.RedWires"); break; case 5: str1 = Language.GetTextValue("Game.BlueWires"); break; case 6: str1 = Language.GetTextValue("Game.GreenWires"); break; case 7: str1 = Language.GetTextValue("Game.YellowWires"); break; case 9: str1 = Language.GetTextValue("Game.Actuators"); break; } string str2 = ""; switch (builderAccStatus[index2]) { case 0: str2 = Language.GetTextValue("GameUI.Bright"); break; case 1: str2 = Language.GetTextValue("GameUI.Normal"); break; case 2: str2 = Language.GetTextValue("GameUI.Faded"); break; case 3: str2 = Language.GetTextValue("GameUI.Hidden"); break; } this.MouseText(string.Format("{0}: {1}", (object) str1, (object) str2)); Main.mouseText = true; } if (flag2) { builderAccStatus[index2] = builderAccStatus[index2] + 1; if (builderAccStatus[index2] >= 3) builderAccStatus[index2] = 0; SoundEngine.PlaySound(12); Main.mouseLeftRelease = false; break; } break; } continue; case 8: if (plr.InfoAccMechShowWires) { r.X = index2 * 16; color = builderAccStatus[index2] == 0 ? color : firstColor; if (flag1) { plr.mouseInterface = true; this.MouseText(builderAccStatus[index2] == 0 ? Language.GetTextValue("GameUI.WireModeForced") : Language.GetTextValue("GameUI.WireModeNormal")); Main.mouseText = true; } if (flag2) { builderAccStatus[index2] = builderAccStatus[index2] == 0 ? 1 : 0; SoundEngine.PlaySound(12); Main.mouseLeftRelease = false; break; } break; } continue; case 11: continue; } Main.spriteBatch.Draw(texture, vector2, new Microsoft.Xna.Framework.Rectangle?(r), color, 0.0f, r.Size() / 2f, 1f, SpriteEffects.None, 0.0f); if (flag1) Main.spriteBatch.Draw(TextureAssets.InfoIcon[13].Value, vector2, new Microsoft.Xna.Framework.Rectangle?(), Main.OurFavoriteColor, 0.0f, TextureAssets.InfoIcon[13].Value.Size() / 2f, 1f, SpriteEffects.None, 0.0f); UILinkPointNavigator.SetPosition(6000 + num1 + blockReplaceIcons + torchGodIcons, vector2 + r.Size() * 0.15f); ++num1; } this.DrawBlockReplacementIcon(0, 0, pushSideToolsUp, 0); int num3 = num1 + 1; if (plr.unlockedBiomeTorches) { this.DrawTorchBiomeSwapIcon(0, 0, pushSideToolsUp, 0); ++num3; } UILinkPointNavigator.Shortcuts.BUILDERACCCOUNT = num3; } private static void GetBuilderAccsCountToShow( Player plr, out int blockReplaceIcons, out int torchGodIcons, out int totalDrawnIcons) { blockReplaceIcons = 1; torchGodIcons = plr.unlockedBiomeTorches ? 1 : 0; totalDrawnIcons = plr.InfoAccMechShowWires.ToInt() * 6 + plr.rulerLine.ToInt() + plr.rulerGrid.ToInt() + plr.autoActuator.ToInt() + plr.autoPaint.ToInt() + blockReplaceIcons + torchGodIcons; } public static void CheckInvasionProgressDisplay() { if (Main.invasionProgressMode != 2) { Main.invasionProgressNearInvasion = false; } else { bool flag = false; Player player = Main.player[Main.myPlayer]; Microsoft.Xna.Framework.Rectangle rectangle1 = new Microsoft.Xna.Framework.Rectangle((int) Main.screenPosition.X, (int) Main.screenPosition.Y, Main.screenWidth, Main.screenHeight); int num = 5000; int icon = 0; for (int index = 0; index < 200; ++index) { if (Main.npc[index].active) { icon = 0; switch (Main.npc[index].type) { case 26: case 27: case 28: case 29: case 111: icon = 4; break; case 143: case 144: case 145: icon = 5; break; case 212: case 213: case 214: case 215: case 216: case 491: icon = 6; break; case 305: case 306: case 307: case 308: case 309: case 310: case 311: case 312: case 313: case 314: case 315: case 325: case 326: case 327: case 329: case 330: icon = 2; break; case 338: case 339: case 340: case 341: case 342: case 343: case 344: case 345: case 346: case 347: case 348: case 349: case 350: icon = 1; break; case 381: case 382: case 383: case 385: case 386: case 388: case 389: case 390: case 391: case 395: icon = 7; break; case 548: case 549: case 551: case 552: case 553: case 554: case 555: case 556: case 557: case 558: case 559: case 560: case 561: case 562: case 563: case 564: case 565: case 568: case 569: case 570: case 571: case 572: case 573: case 574: case 575: case 576: case 577: case 578: icon = 3; break; } if (icon != 0 && (icon != 1 || (double) player.position.Y <= Main.worldSurface * 16.0 && !Main.dayTime && Main.snowMoon) && (icon != 2 || (double) player.position.Y <= Main.worldSurface * 16.0 && !Main.dayTime && Main.pumpkinMoon) && (icon != 3 || DD2Event.Ongoing) && (icon <= 3 || (double) player.position.Y <= Main.worldSurface * 16.0 && Main.invasionType == icon - 3)) { Microsoft.Xna.Framework.Rectangle rectangle2 = new Microsoft.Xna.Framework.Rectangle((int) ((double) Main.npc[index].position.X + (double) (Main.npc[index].width / 2)) - num, (int) ((double) Main.npc[index].position.Y + (double) (Main.npc[index].height / 2)) - num, num * 2, num * 2); if (rectangle1.Intersects(rectangle2)) { flag = true; break; } } } } Main.invasionProgressNearInvasion = flag; if (!flag || Main.invasionProgressIcon != 0) return; int waveNumber = NPC.waveNumber; if (Main.snowMoon) { int progressMax = new int[21] { 0, 25, 15, 10, 30, 100, 160, 180, 200, 250, 300, 375, 450, 525, 675, 850, 1025, 1325, 1550, 2000, 0 }[waveNumber]; Main.ReportInvasionProgress((int) NPC.waveKills, progressMax, 1, waveNumber); } else if (Main.pumpkinMoon) { int progressMax = new int[16] { 0, 25, 40, 50, 80, 100, 160, 180, 200, 250, 300, 375, 450, 525, 675, 0 }[waveNumber]; Main.ReportInvasionProgress((int) NPC.waveKills, progressMax, 2, waveNumber); } else if (DD2Event.Ongoing) { DD2Event.ReportEventProgress(); } else { int progressMax = 1; if (Main.invasionType != 0 && Main.invasionSizeStart != 0) progressMax = Main.invasionSizeStart; Main.ReportInvasionProgress(Main.invasionSizeStart - Main.invasionSize, progressMax, icon, 0); } } } public static void SyncAnInvasion(int toWho) { int waveNumber = NPC.waveNumber; if (Main.snowMoon) { int num = new int[21] { 0, 25, 15, 10, 30, 100, 160, 180, 200, 250, 300, 375, 450, 525, 675, 850, 1025, 1325, 1550, 2000, 0 }[waveNumber]; NetMessage.SendData(78, toWho, number: ((int) NPC.waveKills), number2: ((float) num), number3: 1f, number4: ((float) waveNumber)); } else if (Main.pumpkinMoon) { int num = new int[16] { 0, 25, 40, 50, 80, 100, 160, 180, 200, 250, 300, 375, 450, 525, 675, 0 }[waveNumber]; NetMessage.SendData(78, toWho, number: ((int) NPC.waveKills), number2: ((float) num), number3: 2f, number4: ((float) waveNumber)); } else if (DD2Event.Ongoing) { DD2Event.SyncInvasionProgress(toWho); } else { if (Main.invasionType <= 0) return; int num = 1; if (Main.invasionType != 0 && Main.invasionSizeStart != 0) num = Main.invasionSizeStart; NetMessage.SendData(78, toWho, number: (Main.invasionSizeStart - Main.invasionSize), number2: ((float) num), number3: ((float) (Main.invasionType + 3))); } } public static void ReportInvasionProgress( int progress, int progressMax, int icon, int progressWave) { Main.invasionProgress = progress; Main.invasionProgressMax = progressMax; Main.invasionProgressIcon = icon; Main.invasionProgressWave = progressWave; Main.invasionProgressDisplayLeft = 160; } public static void DrawInvasionProgress() { if (Main.invasionProgress == -1) return; if (Main.invasionProgressMode == 2 && Main.invasionProgressNearInvasion && Main.invasionProgressDisplayLeft < 160) Main.invasionProgressDisplayLeft = 160; if (!Main.gamePaused && Main.invasionProgressDisplayLeft > 0) --Main.invasionProgressDisplayLeft; if (Main.invasionProgressDisplayLeft > 0) Main.invasionProgressAlpha += 0.05f; else Main.invasionProgressAlpha -= 0.05f; if (Main.invasionProgressMode == 0) { Main.invasionProgressDisplayLeft = 0; Main.invasionProgressAlpha = 0.0f; } if ((double) Main.invasionProgressAlpha < 0.0) Main.invasionProgressAlpha = 0.0f; if ((double) Main.invasionProgressAlpha > 1.0) Main.invasionProgressAlpha = 1f; if ((double) Main.invasionProgressAlpha <= 0.0) return; float scale1 = (float) (0.5 + (double) Main.invasionProgressAlpha * 0.5); Texture2D texture1 = TextureAssets.Extra[9].Value; string text = ""; Microsoft.Xna.Framework.Color c = Microsoft.Xna.Framework.Color.White; switch (Main.invasionProgressIcon) { case 1: texture1 = TextureAssets.Extra[8].Value; text = Lang.inter[83].Value; c = new Microsoft.Xna.Framework.Color(64, 109, 164) * 0.5f; break; case 2: texture1 = TextureAssets.Extra[12].Value; text = Lang.inter[84].Value; c = new Microsoft.Xna.Framework.Color(112, 86, 114) * 0.5f; break; case 3: texture1 = TextureAssets.Extra[79].Value; text = Language.GetTextValue("DungeonDefenders2.InvasionProgressTitle"); c = new Microsoft.Xna.Framework.Color(88, 0, 160) * 0.5f; break; case 4: texture1 = TextureAssets.Extra[9].Value; text = Lang.inter[88].Value; c = new Microsoft.Xna.Framework.Color(94, 72, 131) * 0.5f; break; case 5: texture1 = TextureAssets.Extra[7].Value; text = Lang.inter[87].Value; c = new Microsoft.Xna.Framework.Color(173, 135, 140) * 0.5f; break; case 6: texture1 = TextureAssets.Extra[11].Value; text = Lang.inter[86].Value; c = new Microsoft.Xna.Framework.Color(148, 122, 72) * 0.5f; break; case 7: texture1 = TextureAssets.Extra[10].Value; text = Lang.inter[85].Value; c = new Microsoft.Xna.Framework.Color(165, 160, 155) * 0.5f; break; } if (Main.invasionProgressWave > 0) { int width = (int) (200.0 * (double) scale1); int height = (int) (45.0 * (double) scale1); Vector2 position1 = new Vector2((float) (Main.screenWidth - 120), (float) (Main.screenHeight - 40)); Microsoft.Xna.Framework.Rectangle R = new Microsoft.Xna.Framework.Rectangle((int) position1.X - width / 2, (int) position1.Y - height / 2, width, height); Utils.DrawInvBG(Main.spriteBatch, R, new Microsoft.Xna.Framework.Color(63, 65, 151, (int) byte.MaxValue) * 0.785f); string str = Main.invasionProgressMax != 0 ? ((int) ((double) Main.invasionProgress * 100.0 / (double) Main.invasionProgressMax)).ToString() + "%" : Language.GetTextValue("Game.InvasionPoints", (object) Main.invasionProgress); string textValue = Language.GetTextValue("Game.WaveMessage", (object) Main.invasionProgressWave, (object) str); Texture2D texture2 = TextureAssets.ColorBar.Value; Texture2D texture2D = TextureAssets.ColorBlip.Value; float num1 = MathHelper.Clamp((float) Main.invasionProgress / (float) Main.invasionProgressMax, 0.0f, 1f); if (Main.invasionProgressMax == 0) num1 = 1f; float num2 = 169f * scale1; float y = 8f * scale1; Vector2 pos = position1 + Vector2.UnitY * y + Vector2.UnitX * 1f; Utils.DrawBorderString(Main.spriteBatch, textValue, pos, Microsoft.Xna.Framework.Color.White * Main.invasionProgressAlpha, scale1, 0.5f, 1f); Main.spriteBatch.Draw(texture2, position1, new Microsoft.Xna.Framework.Rectangle?(), Microsoft.Xna.Framework.Color.White * Main.invasionProgressAlpha, 0.0f, new Vector2((float) (texture2.Width / 2), 0.0f), scale1, SpriteEffects.None, 0.0f); Vector2 position2 = pos + Vector2.UnitX * (num1 - 0.5f) * num2; Main.spriteBatch.Draw(TextureAssets.MagicPixel.Value, position2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1)), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, 241, 51) * Main.invasionProgressAlpha, 0.0f, new Vector2(1f, 0.5f), new Vector2(num2 * num1, y), SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.MagicPixel.Value, position2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1)), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, 165, 0, (int) sbyte.MaxValue) * Main.invasionProgressAlpha, 0.0f, new Vector2(1f, 0.5f), new Vector2(2f, y), SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.MagicPixel.Value, position2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1)), Microsoft.Xna.Framework.Color.Black * Main.invasionProgressAlpha, 0.0f, new Vector2(0.0f, 0.5f), new Vector2(num2 * (1f - num1), y), SpriteEffects.None, 0.0f); } else { int width = (int) (200.0 * (double) scale1); int height = (int) (45.0 * (double) scale1); Vector2 position3 = new Vector2((float) (Main.screenWidth - 120), (float) (Main.screenHeight - 40)); Microsoft.Xna.Framework.Rectangle R = new Microsoft.Xna.Framework.Rectangle((int) position3.X - width / 2, (int) position3.Y - height / 2, width, height); Utils.DrawInvBG(Main.spriteBatch, R, new Microsoft.Xna.Framework.Color(63, 65, 151, (int) byte.MaxValue) * 0.785f); string textValue = Language.GetTextValue("Game.WaveCleared", Main.invasionProgressMax != 0 ? (object) (((int) ((double) Main.invasionProgress * 100.0 / (double) Main.invasionProgressMax)).ToString() + "%") : (object) Main.invasionProgress.ToString()); Texture2D texture3 = TextureAssets.ColorBar.Value; Texture2D texture2D = TextureAssets.ColorBlip.Value; if (Main.invasionProgressMax != 0) { Main.spriteBatch.Draw(texture3, position3, new Microsoft.Xna.Framework.Rectangle?(), Microsoft.Xna.Framework.Color.White * Main.invasionProgressAlpha, 0.0f, new Vector2((float) (texture3.Width / 2), 0.0f), scale1, SpriteEffects.None, 0.0f); float num3 = MathHelper.Clamp((float) Main.invasionProgress / (float) Main.invasionProgressMax, 0.0f, 1f); Vector2 vector2_1 = FontAssets.MouseText.Value.MeasureString(textValue); float scale2 = scale1; if ((double) vector2_1.Y > 22.0) scale2 *= 22f / vector2_1.Y; float num4 = 169f * scale1; float y = 8f * scale1; Vector2 vector2_2 = position3 + Vector2.UnitY * y + Vector2.UnitX * 1f; Utils.DrawBorderString(Main.spriteBatch, textValue, vector2_2 + new Vector2(0.0f, -4f), Microsoft.Xna.Framework.Color.White * Main.invasionProgressAlpha, scale2, 0.5f, 1f); Vector2 position4 = vector2_2 + Vector2.UnitX * (num3 - 0.5f) * num4; Main.spriteBatch.Draw(TextureAssets.MagicPixel.Value, position4, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1)), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, 241, 51) * Main.invasionProgressAlpha, 0.0f, new Vector2(1f, 0.5f), new Vector2(num4 * num3, y), SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.MagicPixel.Value, position4, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1)), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, 165, 0, (int) sbyte.MaxValue) * Main.invasionProgressAlpha, 0.0f, new Vector2(1f, 0.5f), new Vector2(2f, y), SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.MagicPixel.Value, position4, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1)), Microsoft.Xna.Framework.Color.Black * Main.invasionProgressAlpha, 0.0f, new Vector2(0.0f, 0.5f), new Vector2(num4 * (1f - num3), y), SpriteEffects.None, 0.0f); } } Vector2 vector2 = FontAssets.MouseText.Value.MeasureString(text); float num = 120f; if ((double) vector2.X > 200.0) num += vector2.X - 200f; Microsoft.Xna.Framework.Rectangle rectangle = Utils.CenteredRectangle(new Vector2((float) Main.screenWidth - num, (float) (Main.screenHeight - 80)), (vector2 + new Vector2((float) (texture1.Width + 12), 6f)) * scale1); Utils.DrawInvBG(Main.spriteBatch, rectangle, c); Main.spriteBatch.Draw(texture1, rectangle.Left() + Vector2.UnitX * scale1 * 8f, new Microsoft.Xna.Framework.Rectangle?(), Microsoft.Xna.Framework.Color.White * Main.invasionProgressAlpha, 0.0f, new Vector2(0.0f, (float) (texture1.Height / 2)), scale1 * 0.8f, SpriteEffects.None, 0.0f); Utils.DrawBorderString(Main.spriteBatch, text, rectangle.Right() + Vector2.UnitX * scale1 * -22f, Microsoft.Xna.Framework.Color.White * Main.invasionProgressAlpha, scale1 * 0.9f, 1f, 0.4f); } protected void QuitGame() { Main.SaveSettings(); SocialAPI.Shutdown(); this.Exit(); } protected Microsoft.Xna.Framework.Color randColor() { int r = 0; int g = 0; int b; for (b = 0; r + b + g <= 150; b = Main.rand.Next(256)) { r = Main.rand.Next(256); g = Main.rand.Next(256); } return new Microsoft.Xna.Framework.Color(r, g, b, (int) byte.MaxValue); } public static Microsoft.Xna.Framework.Color hslToRgb(Vector3 hslVector) => Main.hslToRgb(hslVector.X, hslVector.Y, hslVector.Z); public static Microsoft.Xna.Framework.Color hslToRgb( float Hue, float Saturation, float Luminosity) { byte num1; byte num2; byte num3; if ((double) Saturation == 0.0) { num1 = (byte) Math.Round((double) Luminosity * (double) byte.MaxValue); num2 = (byte) Math.Round((double) Luminosity * (double) byte.MaxValue); num3 = (byte) Math.Round((double) Luminosity * (double) byte.MaxValue); } else { double num4 = (double) Hue; double t2_1 = (double) Luminosity >= 0.5 ? (double) Luminosity + (double) Saturation - (double) Luminosity * (double) Saturation : (double) Luminosity * (1.0 + (double) Saturation); double t1_1 = 2.0 * (double) Luminosity - t2_1; double c1 = num4 + 1.0 / 3.0; double c2 = num4; double c3 = num4 - 1.0 / 3.0; double num5 = Main.hue2rgb(c1, t1_1, t2_1); double num6 = Main.hue2rgb(c2, t1_1, t2_1); double t1_2 = t1_1; double t2_2 = t2_1; double num7 = Main.hue2rgb(c3, t1_2, t2_2); num1 = (byte) Math.Round(num5 * (double) byte.MaxValue); num2 = (byte) Math.Round(num6 * (double) byte.MaxValue); num3 = (byte) Math.Round(num7 * (double) byte.MaxValue); } return new Microsoft.Xna.Framework.Color((int) num1, (int) num2, (int) num3); } public static double hue2rgb(double c, double t1, double t2) { if (c < 0.0) ++c; if (c > 1.0) --c; if (6.0 * c < 1.0) return t1 + (t2 - t1) * 6.0 * c; if (2.0 * c < 1.0) return t2; return 3.0 * c < 2.0 ? t1 + (t2 - t1) * (2.0 / 3.0 - c) * 6.0 : t1; } public static Vector3 rgbToHsl(Microsoft.Xna.Framework.Color newColor) { float r = (float) newColor.R; float g = (float) newColor.G; float b = (float) newColor.B; float val1 = r / (float) byte.MaxValue; float val2_1 = g / (float) byte.MaxValue; float val2_2 = b / (float) byte.MaxValue; float num1 = Math.Max(Math.Max(val1, val2_1), val2_2); float num2 = Math.Min(Math.Min(val1, val2_1), val2_2); float num3 = 0.0f; float z = (float) (((double) num1 + (double) num2) / 2.0); float y; float x; if ((double) num1 == (double) num2) { x = y = 0.0f; } else { float num4 = num1 - num2; y = (double) z > 0.5 ? num4 / (2f - num1 - num2) : num4 / (num1 + num2); if ((double) num1 == (double) val1) num3 = (float) (((double) val2_1 - (double) val2_2) / (double) num4 + ((double) val2_1 < (double) val2_2 ? 6.0 : 0.0)); if ((double) num1 == (double) val2_1) num3 = (float) (((double) val2_2 - (double) val1) / (double) num4 + 2.0); if ((double) num1 == (double) val2_2) num3 = (float) (((double) val1 - (double) val2_1) / (double) num4 + 4.0); x = num3 / 6f; } return new Vector3(x, y, z); } public static void DrawCursor(Vector2 bonus, bool smart = false) { if (Main.gameMenu && Main.alreadyGrabbingSunOrMoon) return; if (Main.player[Main.myPlayer].dead || Main.player[Main.myPlayer].mouseInterface) { Main.ClearSmartInteract(); int num; Main.TileInteractionHY = num = -1; Main.TileInteractionLY = num; Main.TileInteractionHX = num; Main.TileInteractionLX = num; } bool flag1 = UILinkPointNavigator.Available && !PlayerInput.InBuildingMode; Microsoft.Xna.Framework.Color cursorColor = Main.cursorColor; if (PlayerInput.UsingGamepad) { if (Main.player[Main.myPlayer].dead && !Main.player[Main.myPlayer].ghost && !Main.gameMenu || PlayerInput.InvisibleGamepadInMenus) return; Vector2 t1 = new Vector2((float) Main.mouseX, (float) Main.mouseY); Vector2 t2 = Vector2.Zero; bool flag2 = Main.SmartCursorEnabled; if (flag2) { PlayerInput.smartSelectPointer.UpdateCenter(Main.ScreenSize.ToVector2() / 2f); t2 = PlayerInput.smartSelectPointer.GetPointerPosition(); if ((double) Vector2.Distance(t2, t1) < 1.0) flag2 = false; else Utils.Swap(ref t1, ref t2); } float num = 1f; if (flag2) { num = 0.3f; Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.White * Main.GamepadCursorAlpha; int index = 17; int frameX = 0; Main.spriteBatch.Draw(TextureAssets.Cursors[index].Value, t2 + bonus, new Microsoft.Xna.Framework.Rectangle?(TextureAssets.Cursors[index].Frame(frameX: frameX)), color, 1.570796f * Main.GlobalTimeWrappedHourly, TextureAssets.Cursors[index].Frame(frameX: frameX).Size() / 2f, Main.cursorScale, SpriteEffects.None, 0.0f); } if (smart && !flag1) { Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.White * Main.GamepadCursorAlpha * num; int index = 13; int frameX = 0; Main.spriteBatch.Draw(TextureAssets.Cursors[index].Value, t1 + bonus, new Microsoft.Xna.Framework.Rectangle?(TextureAssets.Cursors[index].Frame(2, frameX: frameX)), color, 0.0f, TextureAssets.Cursors[index].Frame(2, frameX: frameX).Size() / 2f, Main.cursorScale, SpriteEffects.None, 0.0f); } else { Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; int index = 15; Main.spriteBatch.Draw(TextureAssets.Cursors[index].Value, new Vector2((float) Main.mouseX, (float) Main.mouseY) + bonus, new Microsoft.Xna.Framework.Rectangle?(), white, 0.0f, TextureAssets.Cursors[index].Value.Size() / 2f, Main.cursorScale, SpriteEffects.None, 0.0f); } } else { int index = smart.ToInt(); Main.spriteBatch.Draw(TextureAssets.Cursors[index].Value, new Vector2((float) Main.mouseX, (float) Main.mouseY) + bonus + Vector2.One, new Microsoft.Xna.Framework.Rectangle?(), new Microsoft.Xna.Framework.Color((int) ((double) cursorColor.R * 0.200000002980232), (int) ((double) cursorColor.G * 0.200000002980232), (int) ((double) cursorColor.B * 0.200000002980232), (int) ((double) cursorColor.A * 0.5)), 0.0f, new Vector2(), Main.cursorScale * 1.1f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.Cursors[index].Value, new Vector2((float) Main.mouseX, (float) Main.mouseY) + bonus, new Microsoft.Xna.Framework.Rectangle?(), cursorColor, 0.0f, new Vector2(), Main.cursorScale, SpriteEffects.None, 0.0f); } } public static void ClearSmartInteract() { Main.SmartInteractShowingGenuine = false; Main.SmartInteractShowingFake = false; Main.SmartInteractNPC = -1; Main.SmartInteractProj = -1; Main.SmartInteractTileCoords.Clear(); Main.SmartInteractTileCoordsSelected.Clear(); } public static Vector2 DrawThickCursor(bool smart = false) { if (!Main.ThickMouse || Main.gameMenu && Main.alreadyGrabbingSunOrMoon || PlayerInput.UsingGamepad && PlayerInput.InvisibleGamepadInMenus || PlayerInput.UsingGamepad && Main.player[Main.myPlayer].dead && !Main.player[Main.myPlayer].ghost && !Main.gameMenu) return Vector2.Zero; bool flag = UILinkPointNavigator.Available && !PlayerInput.InBuildingMode; Microsoft.Xna.Framework.Color mouseBorderColor = Main.MouseBorderColor; int index1 = 11 + smart.ToInt(); for (int index2 = 0; index2 < 4; ++index2) { Vector2 vector2_1 = Vector2.Zero; switch (index2) { case 0: vector2_1 = new Vector2(0.0f, 1f); break; case 1: vector2_1 = new Vector2(1f, 0.0f); break; case 2: vector2_1 = new Vector2(0.0f, -1f); break; case 3: vector2_1 = new Vector2(-1f, 0.0f); break; } Vector2 vector2_2 = vector2_1 * 1f + Vector2.One * 2f; Vector2 origin = new Vector2(2f); Microsoft.Xna.Framework.Rectangle? sourceRectangle = new Microsoft.Xna.Framework.Rectangle?(); float scale = Main.cursorScale * 1.1f; if (PlayerInput.UsingGamepad) { if (smart && !flag) { index1 = 13; int frameX = 0; vector2_2 = Vector2.One; sourceRectangle = new Microsoft.Xna.Framework.Rectangle?(TextureAssets.Cursors[index1].Frame(2, frameX: frameX)); origin = TextureAssets.Cursors[index1].Frame(2, frameX: frameX).Size() / 2f; mouseBorderColor *= Main.GamepadCursorAlpha; } else { index1 = 15; vector2_2 = Vector2.One; origin = TextureAssets.Cursors[index1].Value.Size() / 2f; } } Main.spriteBatch.Draw(TextureAssets.Cursors[index1].Value, new Vector2((float) Main.mouseX, (float) Main.mouseY) + vector2_2, sourceRectangle, mouseBorderColor, 0.0f, origin, scale, SpriteEffects.None, 0.0f); } return new Vector2(2f); } private void OnCharacterNamed(string text) { Main.PendingPlayer.name = text.Trim(); PlayerFileData.CreateAndSave(Main.PendingPlayer); Main.LoadPlayers(); Main.menuMode = 1; } private void OnSeedSelected(string text) { text = text.Trim(); if (text.Length == 0) Main.ActiveWorldFileData.SetSeedToRandom(); else Main.ActiveWorldFileData.SetSeed(text); Main.menuMode = 10; WorldGen.CreateNewWorld(); } private void OnWorldNamed(string text) { Main.menuMode = 10; Main.worldName = text.Trim(); Main.ActiveWorldFileData = WorldFile.CreateMetadata(Main.worldName, SocialAPI.Cloud != null && SocialAPI.Cloud.EnabledByDefault, Main.GameMode); Main.menuMode = 5000; } private static Action CreateGoToMenuEvent(int menu) => (Action) (() => { Main.menuMode = menu; UILinkPointNavigator.Shortcuts.FANCYUI_SPECIAL_INSTRUCTIONS = 0; }); public static Microsoft.Xna.Framework.Point ScreenSize => new Microsoft.Xna.Framework.Point(Main.screenWidth, Main.screenHeight); public static void GoToWorldSelect() { Main.MenuUI.SetState((UIState) Main._worldSelectMenu); Main.menuMode = 888; } public static void StartClientGameplay() { Main.menuMode = 10; Netplay.StartTcpClient(); } public static void ReleaseHostAndPlayProcess() { if (Main.tServer == null) return; Main.tServer = (Process) null; } protected void DrawMenu(GameTime gameTime) { if (!Main.IsEngineLoaded) { Main.IsEngineLoaded = true; if (Main.OnEngineLoad != null) Main.OnEngineLoad(); } GamepadMainMenuHandler.Update(); GamepadMainMenuHandler.MenuItemPositions.Clear(); int menuMode1 = Main.menuMode; if (Main.menuMode <= 1 && Main.slimeRain) Main.StopSlimeRain(); Main.render = false; Main.SceneMetrics.Reset(); Main.drawingPlayerChat = false; Main.chatMonitor.Clear(); Main.screenLastPosition = Main.screenPosition; Main.screenPosition.Y = (float) (Main.worldSurface * 16.0) - (float) Main.screenHeight; Main.MenuXMovement = 4f; if (Main.alreadyGrabbingSunOrMoon) this.playOldTile = true; Main.screenPosition.X += Main.MenuXMovement; if ((double) Main.screenPosition.X > 2147483520.0) Main.screenPosition.X = 0.0f; if ((double) Main.screenPosition.X < -2147483520.0) Main.screenPosition.X = 0.0f; Star.UpdateStars(); Cloud.UpdateClouds(); this.DrawFPS(); Main.background = 0; byte num1 = (byte) (((int) byte.MaxValue + (int) Main.tileColor.R * 2) / 3); Microsoft.Xna.Framework.Color color1 = new Microsoft.Xna.Framework.Color((int) num1, (int) num1, (int) num1, (int) byte.MaxValue); if (WorldGen.drunkWorldGen) { this.logoRotation += this.logoRotationSpeed * 4E-06f; if ((double) this.logoRotationSpeed > 0.0) this.logoRotationSpeed += 1500f; else this.logoRotationSpeed -= 1500f; this.logoScale -= 0.05f; if ((double) this.logoScale < 0.0) this.logoScale = 0.0f; } else { this.logoRotation += this.logoRotationSpeed * 4E-06f; if ((double) this.logoRotation > 0.08) this.logoRotationDirection = -1f; else if ((double) this.logoRotation < -0.08) this.logoRotationDirection = 1f; if ((double) this.logoRotationSpeed < 20.0 && (double) this.logoRotationDirection == 1.0) ++this.logoRotationSpeed; else if ((double) this.logoRotationSpeed > -20.0 && (double) this.logoRotationDirection == -1.0) --this.logoRotationSpeed; this.logoScale += this.logoScaleSpeed * 9E-06f; if ((double) this.logoScale > 1.35) this.logoScaleDirection = -1f; else if ((double) this.logoScale < 1.0) this.logoScaleDirection = 1f; if ((double) this.logoScaleSpeed < 50.0 && (double) this.logoScaleDirection == 1.0) ++this.logoScaleSpeed; else if ((double) this.logoScaleSpeed > -50.0 && (double) this.logoScaleDirection == -1.0) --this.logoScaleSpeed; } Microsoft.Xna.Framework.Color color2 = new Microsoft.Xna.Framework.Color((int) (byte) ((double) color1.R * ((double) Main.LogoA / (double) byte.MaxValue)), (int) (byte) ((double) color1.G * ((double) Main.LogoA / (double) byte.MaxValue)), (int) (byte) ((double) color1.B * ((double) Main.LogoA / (double) byte.MaxValue)), (int) (byte) ((double) color1.A * ((double) Main.LogoA / (double) byte.MaxValue))); Microsoft.Xna.Framework.Color color3 = new Microsoft.Xna.Framework.Color((int) (byte) ((double) color1.R * ((double) Main.LogoB / (double) byte.MaxValue)), (int) (byte) ((double) color1.G * ((double) Main.LogoB / (double) byte.MaxValue)), (int) (byte) ((double) color1.B * ((double) Main.LogoB / (double) byte.MaxValue)), (int) (byte) ((double) color1.A * ((double) Main.LogoB / (double) byte.MaxValue))); if (this.playOldTile) { Main.spriteBatch.Draw(TextureAssets.Logo3.Value, new Vector2((float) (Main.screenWidth / 2), 100f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Logo.Width(), TextureAssets.Logo.Height())), color2, this.logoRotation, new Vector2((float) (TextureAssets.Logo.Width() / 2), (float) (TextureAssets.Logo.Height() / 2)), this.logoScale, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.Logo4.Value, new Vector2((float) (Main.screenWidth / 2), 100f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Logo.Width(), TextureAssets.Logo.Height())), color3, this.logoRotation, new Vector2((float) (TextureAssets.Logo.Width() / 2), (float) (TextureAssets.Logo.Height() / 2)), this.logoScale, SpriteEffects.None, 0.0f); } else { Main.spriteBatch.Draw(TextureAssets.Logo.Value, new Vector2((float) (Main.screenWidth / 2), 100f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Logo.Width(), TextureAssets.Logo.Height())), color2, this.logoRotation, new Vector2((float) (TextureAssets.Logo.Width() / 2), (float) (TextureAssets.Logo.Height() / 2)), this.logoScale, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.Logo2.Value, new Vector2((float) (Main.screenWidth / 2), 100f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Logo.Width(), TextureAssets.Logo.Height())), color3, this.logoRotation, new Vector2((float) (TextureAssets.Logo.Width() / 2), (float) (TextureAssets.Logo.Height() / 2)), this.logoScale, SpriteEffects.None, 0.0f); } if (Main.dayTime) { Main.LogoA += 2; if (Main.LogoA > (int) byte.MaxValue) Main.LogoA = (int) byte.MaxValue; --Main.LogoB; if (Main.LogoB < 0) Main.LogoB = 0; } else { Main.LogoB += 2; if (Main.LogoB > (int) byte.MaxValue) Main.LogoB = (int) byte.MaxValue; --Main.LogoA; if (Main.LogoA < 0) { Main.LogoA = 0; Main.LogoT = true; } } int num2 = 250; int num3 = Main.screenWidth / 2; int num4 = 80; int num5 = 0; int menuMode2 = Main.menuMode; int num6 = 0; int num7 = 0; bool flag1 = false; bool flag2 = false; bool flag3 = false; int num8 = 0; bool[] flagArray1 = new bool[Main.maxMenuItems]; bool[] flagArray2 = new bool[Main.maxMenuItems]; bool[] flagArray3 = new bool[Main.maxMenuItems]; int[] numArray1 = new int[Main.maxMenuItems]; int[] numArray2 = new int[Main.maxMenuItems]; byte[] numArray3 = new byte[Main.maxMenuItems]; float[] numArray4 = new float[Main.maxMenuItems]; bool[] flagArray4 = new bool[Main.maxMenuItems]; bool flag4 = false; bool flag5 = UILinkPointNavigator.Shortcuts.BackButtonInUse && !UILinkPointNavigator.Shortcuts.BackButtonLock; for (int index = 0; index < Main.maxMenuItems; ++index) { flagArray1[index] = false; flagArray2[index] = false; numArray1[index] = 0; numArray2[index] = 0; numArray4[index] = 1f; } string[] strArray1 = new string[Main.maxMenuItems]; if (Main.menuMode == -1) Main.menuMode = 0; if (Program.LoadedEverything) GamepadMainMenuHandler.CanRun = true; switch (Main.menuMode) { case 1212: strArray1[0] = Lang.menu[102].Value; num4 = 33; num2 = 200; numArray1[0] = -20; numArray1[1] = 25; numArray1[2] = 25; numArray1[3] = 25; numArray1[4] = 25; numArray1[5] = 25; numArray1[6] = 25; numArray1[7] = 25; numArray1[8] = 25; numArray1[9] = 25; flagArray1[0] = true; strArray1[1] = Language.GetTextValue("Language.English"); strArray1[2] = Language.GetTextValue("Language.German"); strArray1[3] = Language.GetTextValue("Language.Italian"); strArray1[4] = Language.GetTextValue("Language.French"); strArray1[5] = Language.GetTextValue("Language.Spanish"); strArray1[6] = Language.GetTextValue("Language.Russian"); strArray1[7] = Language.GetTextValue("Language.Chinese"); strArray1[8] = Language.GetTextValue("Language.Portuguese"); strArray1[9] = Language.GetTextValue("Language.Polish"); num5 = 10; for (int index = 0; index < num5; ++index) numArray4[index] = 0.75f; numArray4[0] = 1f; if (this.selectedMenu >= 1) { Main.changeTheTitle = true; LanguageManager.Instance.SetLanguage(this.selectedMenu); Main.menuMode = 0; SoundEngine.PlaySound(10); Main.SaveSettings(); break; } break; case 1213: strArray1[0] = Lang.menu[102].Value; flagArray1[0] = true; strArray1[1] = Language.GetTextValue("Language.English"); strArray1[2] = Language.GetTextValue("Language.German"); strArray1[3] = Language.GetTextValue("Language.Italian"); strArray1[4] = Language.GetTextValue("Language.French"); strArray1[5] = Language.GetTextValue("Language.Spanish"); strArray1[6] = Language.GetTextValue("Language.Russian"); strArray1[7] = Language.GetTextValue("Language.Chinese"); strArray1[8] = Language.GetTextValue("Language.Portuguese"); strArray1[9] = Language.GetTextValue("Language.Polish"); strArray1[10] = Lang.menu[5].Value; num5 = 11; if (this.selectedMenu == 10 | flag5) { flag5 = false; Main.menuMode = 11; SoundEngine.PlaySound(11); } else if (this.selectedMenu >= 1) { Main.changeTheTitle = true; LanguageManager.Instance.SetLanguage(this.selectedMenu); SoundEngine.PlaySound(12); Main.SaveSettings(); } num4 = 33; num2 = 200; numArray1[0] = -20; numArray1[10] = 10; for (int index = 0; index < num5; ++index) numArray4[index] = 0.75f; numArray4[0] = 0.85f; numArray4[10] = 0.95f; break; default: if (Main.netMode == 2) { bool flag6 = true; for (int index = 0; index < 8; ++index) { if (index < (int) byte.MaxValue) { try { strArray1[index] = Netplay.Clients[index].StatusText; if (Netplay.Clients[index].IsActive) { if (Main.showSpam) { ref string local = ref strArray1[index]; local = local + " (" + (object) NetMessage.buffer[index].spamCount + ")"; } } } catch { strArray1[index] = ""; } flagArray1[index] = true; if (strArray1[index] != "" && strArray1[index] != null) flag6 = false; } } if (flag6) { strArray1[0] = Lang.menu[0].Value; strArray1[1] = Lang.menu[1].Value + (object) Netplay.ListenPort + "."; } num5 = 11; strArray1[9] = Main.statusText; flagArray1[9] = true; num2 = 170; num4 = 30; numArray1[10] = 20; numArray1[10] = 40; strArray1[10] = Lang.menu[2].Value; if (this.selectedMenu == 10 | flag5) { flag5 = false; Netplay.Disconnect = true; SoundEngine.PlaySound(11); break; } break; } if (Main.menuMode == 31) { string serverPassword1 = Netplay.ServerPassword; PlayerInput.WritingText = true; flag5 = false; Main.instance.HandleIME(); Netplay.ServerPassword = Main.GetInputText(Netplay.ServerPassword); string serverPassword2 = Netplay.ServerPassword; if (serverPassword1 != serverPassword2) SoundEngine.PlaySound(12); strArray1[0] = Lang.menu[3].Value; ++this.textBlinkerCount; if (this.textBlinkerCount >= 20) { this.textBlinkerState = this.textBlinkerState != 0 ? 0 : 1; this.textBlinkerCount = 0; } strArray1[1] = Netplay.ServerPassword; if (Main.HidePassword) { strArray1[1] = ""; for (int index = 0; index < Netplay.ServerPassword.Length; ++index) { // ISSUE: explicit reference operation ^ref strArray1[1] += "*"; } } if (this.textBlinkerState == 1) { // ISSUE: explicit reference operation ^ref strArray1[1] += "|"; numArray2[1] = 1; } else { // ISSUE: explicit reference operation ^ref strArray1[1] += " "; } flagArray1[0] = true; flagArray1[1] = true; numArray1[1] = -20; numArray1[2] = 20; strArray1[2] = Lang.menu[4].Value; strArray1[3] = Lang.menu[5].Value; num5 = 4; if (this.selectedMenu == 3 | flag5) { flag5 = false; SoundEngine.PlaySound(11); Main.menuMode = 0; Netplay.Disconnect = true; Netplay.ServerPassword = ""; break; } if (this.selectedMenu == 2 || Main.inputTextEnter) { NetMessage.SendData(38); Main.menuMode = 14; break; } break; } if (Main.netMode != 1) { switch (Main.menuMode) { case -71: num2 = 200; num4 = 60; numArray1[1] = 30; numArray1[2] = 30; numArray1[3] = 30; numArray1[4] = 70; num5 = 5; int index1 = 0; strArray1[index1] = Lang.misc[100].Value; flagArray1[index1] = true; int index2 = index1 + 1; strArray1[index2] = Lang.misc[101].Value; if (this.selectedMenu == index2) { WorldGen.WorldGenParam_Evil = 0; SoundEngine.PlaySound(10); Main.menuMode = 7; } int index3 = index2 + 1; strArray1[index3] = Lang.misc[102].Value; if (this.selectedMenu == index3) { WorldGen.WorldGenParam_Evil = 1; SoundEngine.PlaySound(10); Main.menuMode = 7; } int index4 = index3 + 1; strArray1[index4] = Lang.misc[103].Value; if (this.selectedMenu == index4) { WorldGen.WorldGenParam_Evil = -1; SoundEngine.PlaySound(10); Main.menuMode = 7; } int index5 = index4 + 1; strArray1[index5] = Language.GetTextValue("UI.Back"); if (this.selectedMenu == index5 | flag5) { flag5 = false; SoundEngine.PlaySound(11); Main.menuMode = -7; } int num9 = index5 + 1; Main.clrInput(); goto label_623; case -7: num2 = 200; num4 = 60; numArray1[2] = 30; numArray1[3] = 30; numArray1[4] = 30; numArray3[3] = (byte) 1; numArray3[4] = (byte) 2; numArray1[5] = 70; if (this.focusMenu == 2) strArray1[1] = Language.GetTextValue("UI.WorldDescriptionNormal"); else if (this.focusMenu == 3) strArray1[1] = Language.GetTextValue("UI.WorldDescriptionExpert"); else if (this.focusMenu == 4) strArray1[1] = Language.GetTextValue("UI.WorldDescriptionMaster"); strArray1[0] = Lang.menu[32].Value; flagArray1[0] = true; flagArray1[1] = true; strArray1[2] = Language.GetTextValue("UI.Normal"); strArray1[3] = Language.GetTextValue("UI.Expert"); strArray1[4] = Language.GetTextValue("UI.Master"); strArray1[5] = Language.GetTextValue("UI.Back"); num5 = 6; if (this.selectedMenu == 2) { Main.GameMode = 0; SoundEngine.PlaySound(10); Main.menuMode = 7; if (Main.SettingsUnlock_WorldEvil) Main.menuMode = -71; } else if (this.selectedMenu == 3) { Main.GameMode = 1; SoundEngine.PlaySound(10); Main.menuMode = 7; if (Main.SettingsUnlock_WorldEvil) Main.menuMode = -71; } else if (this.selectedMenu == 4) { Main.GameMode = 2; SoundEngine.PlaySound(10); Main.menuMode = 7; if (Main.SettingsUnlock_WorldEvil) Main.menuMode = -71; } else if (this.selectedMenu == 5 | flag5) { flag5 = false; SoundEngine.PlaySound(11); Main.menuMode = 16; } Main.clrInput(); goto label_623; case 0: Main._blockFancyUIWhileLoading = false; Main._pendingCharacterSelect = (Main.OnPlayerSelected) null; DD2Event.Ongoing = false; Main.eclipse = false; Main.pumpkinMoon = false; Main.snowMoon = false; Main.ServerSideCharacter = false; Main.menuMultiplayer = false; Main.menuServer = false; Main.netMode = 0; Main.ClearVisualPostProcessEffects(); int index6 = 0; num5 = 6; num4 = 60; strArray1[index6] = Lang.menu[12].Value; if (this.selectedMenu == index6) { SoundEngine.PlaySound(10); Main.ClearPendingPlayerSelectCallbacks(); Main.menuMode = 1; } int index7 = index6 + 1; strArray1[index7] = Lang.menu[13].Value; if (this.selectedMenu == index7) { SoundEngine.PlaySound(10); Main.menuMode = 12; } int index8 = index7 + 1; strArray1[index8] = Lang.menu[131].Value; if (this.selectedMenu == index8) { SoundEngine.PlaySound(10); Main.MenuUI.SetState((UIState) Main.AchievementsMenu); Main.menuMode = 888; } int index9 = index8 + 1; strArray1[index9] = Language.GetText("UI.ResourcePacks").Value; if (this.selectedMenu == index9) { SoundEngine.PlaySound(10); Main.MenuUI.SetState((UIState) new UIResourcePackSelectionMenu(Main.AssetSourceController, AssetInitializer.CreateResourcePackList((System.IServiceProvider) this.Services))); Main.menuMode = 888; } int index10 = index9 + 1; strArray1[index10] = Lang.menu[14].Value; if (this.selectedMenu == index10) { SoundEngine.PlaySound(10); Main.menuMode = 11; } int index11 = index10 + 1; strArray1[index11] = Lang.menu[15].Value; if (this.selectedMenu == index11) this.QuitGame(); int num10 = index11 + 1; goto label_623; case 1: Main.OpenCharacterSelectUI(); goto label_623; case 2: flag4 = true; if (this.selectedMenu == 0) { Main.menuMode = 17; SoundEngine.PlaySound(10); Main.selColor = Main.PendingPlayer.hairColor; } if (this.selectedMenu == 1) { Main.menuMode = 18; SoundEngine.PlaySound(10); Main.selColor = Main.PendingPlayer.eyeColor; } if (this.selectedMenu == 2) { Main.menuMode = 19; SoundEngine.PlaySound(10); Main.selColor = Main.PendingPlayer.skinColor; } if (this.selectedMenu == 3) { Main.menuMode = 20; SoundEngine.PlaySound(10); } strArray1[0] = Lang.menu[18].Value; strArray1[1] = Lang.menu[19].Value; strArray1[2] = Lang.menu[20].Value; strArray1[3] = Lang.menu[21].Value; num2 = 220; for (int index12 = 0; index12 < 9; ++index12) numArray4[index12] = index12 >= 6 ? 0.9f : 0.75f; num4 = 38; numArray1[6] = 6; numArray1[7] = 12; numArray1[8] = 18; num6 = Main.screenWidth / 2 - 16; num7 = 176; strArray1[4] = !Main.PendingPlayer.Male ? Lang.menu[23].Value : Lang.menu[22].Value; if (this.selectedMenu == 4) { if (Main.PendingPlayer.Male) { SoundEngine.PlaySound(20); Main.PendingPlayer.Male = false; } else { SoundEngine.PlaySound(1); Main.PendingPlayer.Male = true; } } if (Main.PendingPlayer.difficulty == (byte) 2) { strArray1[5] = Lang.menu[24].Value; numArray3[5] = Main.PendingPlayer.difficulty; } else if (Main.PendingPlayer.difficulty == (byte) 1) { strArray1[5] = Lang.menu[25].Value; numArray3[5] = Main.PendingPlayer.difficulty; } else strArray1[5] = Lang.menu[26].Value; if (this.selectedMenu == 5) { SoundEngine.PlaySound(10); Main.menuMode = 222; } if (this.selectedMenu == 7) { SoundEngine.PlaySound(12); Main.PendingPlayer.hair = Main.rand.Next(51); Main.PendingPlayer.eyeColor = this.randColor(); while ((int) Main.PendingPlayer.eyeColor.R + (int) Main.PendingPlayer.eyeColor.G + (int) Main.PendingPlayer.eyeColor.B > 300) Main.PendingPlayer.eyeColor = this.randColor(); Main.PendingPlayer.hairColor = this.randColor(); Main.PendingPlayer.pantsColor = this.randColor(); Main.PendingPlayer.shirtColor = this.randColor(); Main.PendingPlayer.shoeColor = this.randColor(); Main.PendingPlayer.skinColor = this.randColor(); float num11 = (float) Main.rand.Next(60, 120) * 0.01f; if ((double) num11 > 1.0) num11 = 1f; Main.PendingPlayer.skinColor.R = (byte) ((double) Main.rand.Next(240, (int) byte.MaxValue) * (double) num11); Main.PendingPlayer.skinColor.G = (byte) ((double) Main.rand.Next(110, 140) * (double) num11); Main.PendingPlayer.skinColor.B = (byte) ((double) Main.rand.Next(75, 110) * (double) num11); Main.PendingPlayer.underShirtColor = this.randColor(); switch (Main.PendingPlayer.hair + 1) { case 5: case 6: case 7: case 10: case 12: case 19: case 22: case 23: case 26: case 27: case 30: case 33: Main.PendingPlayer.Male = false; break; default: Main.PendingPlayer.Male = true; break; } Main.PendingPlayer.skinVariant = Main.rand.Next(12); } strArray1[7] = Lang.menu[27].Value; strArray1[6] = Lang.menu[28].Value; strArray1[8] = Lang.menu[5].Value; num5 = 9; if (this.selectedMenu == 8 | flag5) { flag5 = false; SoundEngine.PlaySound(11); Main.menuMode = 1; goto label_623; } else if (this.selectedMenu == 6) { SoundEngine.PlaySound(10); Main.PendingPlayer.name = ""; Main.menuMode = 3; Main.clrInput(); goto label_623; } else goto label_623; case 3: UIVirtualKeyboard uiVirtualKeyboard = new UIVirtualKeyboard(Lang.menu[45].Value, "", new UIVirtualKeyboard.KeyboardSubmitEvent(this.OnCharacterNamed), Main.CreateGoToMenuEvent(2)); uiVirtualKeyboard.SetMaxInputLength(20); Main.MenuUI.SetState((UIState) uiVirtualKeyboard); Main.menuMode = 888; goto label_623; case 5: strArray1[0] = Lang.menu[46].Value + " " + Main.PlayerList[Main.selectedPlayer].Player.name + "?"; flagArray1[0] = true; strArray1[1] = Lang.menu[104].Value; strArray1[2] = Lang.menu[105].Value; num5 = 3; if (this.selectedMenu == 1) { Main.ErasePlayer(Main.selectedPlayer); SoundEngine.PlaySound(10); Main.menuMode = 1; goto label_623; } else if (this.selectedMenu == 2 | flag5) { flag5 = false; SoundEngine.PlaySound(11); Main.menuMode = 1; goto label_623; } else goto label_623; case 6: Main.MenuUI.SetState((UIState) Main._worldSelectMenu); Main.menuMode = 888; goto label_623; case 7: Main.MenuUI.SetState((UIState) new UIVirtualKeyboard(Lang.menu[48].Value, "", new UIVirtualKeyboard.KeyboardSubmitEvent(this.OnWorldNamed), Main.CreateGoToMenuEvent(-7))); Main.menuMode = 888; goto label_623; case 8: num2 = 180; num4 = 40; num5 = 8; numArray1[7] += 30; for (int index13 = 0; index13 < num5; ++index13) numArray4[index13] = 0.8f; strArray1[7] = Lang.menu[5].Value; for (int index14 = 0; index14 < 7; ++index14) { if (index14 < Main.WorldList.Count) { strArray1[index14] = Main.WorldList[index14 + Main.menuSkip].Name; if (Main.WorldList[index14 + Main.menuSkip].GameMode == 1) numArray3[index14] = (byte) 1; else if (Main.WorldList[index14 + Main.menuSkip].GameMode == 2) numArray3[index14] = (byte) 2; } else strArray1[index14] = (string) null; } if (Main.WorldList.Count > 7 + Main.menuSkip) { strArray1[6] = Language.GetTextValue("UI.More"); strArray1[6] = "▼"; numArray4[6] = 0.6f; numArray1[6] += 8; this.menuWide[6] = true; } if (Main.menuSkip > 0) { strArray1[0] = "▲"; numArray4[0] = 0.6f; numArray1[0] += 8; this.menuWide[0] = true; } if (this.selectedMenu == 0 && Main.menuSkip > 0) { SoundEngine.PlaySound(12); Main.menuSkip -= 5; if (Main.menuSkip < 0) { Main.menuSkip = 0; goto label_623; } else goto label_623; } else if (this.selectedMenu == 6 && Main.menuSkip < Main.WorldList.Count - 7) { SoundEngine.PlaySound(12); Main.menuSkip += 5; if (Main.menuSkip >= Main.PlayerList.Count - 7) { Main.menuSkip = Main.WorldList.Count - 7; goto label_623; } else goto label_623; } else if (this.selectedMenu == 7 | flag5) { flag5 = false; SoundEngine.PlaySound(11); Main.menuMode = 6; goto label_623; } else if (this.selectedMenu >= 0) { Main.selectedWorld = this.selectedMenu + Main.menuSkip; SoundEngine.PlaySound(10); Main.menuMode = 9; goto label_623; } else goto label_623; case 9: strArray1[0] = Lang.menu[46].Value + " " + Main.WorldList[Main.selectedWorld].Name + "?"; flagArray1[0] = true; strArray1[1] = Lang.menu[104].Value; strArray1[2] = Lang.menu[105].Value; num5 = 3; if (this.selectedMenu == 1) { Main.EraseWorld(Main.selectedWorld); SoundEngine.PlaySound(10); Main.menuMode = 6; goto label_623; } else if (this.selectedMenu == 2 | flag5) { SoundEngine.PlaySound(11); Main.menuMode = 6; goto label_623; } else goto label_623; case 10: num5 = 1; strArray1[0] = Main.statusText; flagArray1[0] = true; num2 = 300; Main.gameTips.Update(); Main.gameTips.Draw(); goto label_623; case 11: num2 = 210; num4 = 37; num5 = 8; numArray1[num5 - 1] = 8; for (int index15 = 0; index15 < num5; ++index15) numArray4[index15] = 0.75f; int index16 = 0; strArray1[index16] = Lang.menu[114].Value; if (this.selectedMenu == index16) { SoundEngine.PlaySound(10); Main.menuMode = 112; } int index17 = index16 + 1; strArray1[index17] = Lang.menu[210].Value; if (this.selectedMenu == index17) { SoundEngine.PlaySound(10); Main.menuMode = 1112; } int index18 = index17 + 1; strArray1[index18] = Lang.menu[63].Value; if (this.selectedMenu == index18) { SoundEngine.PlaySound(10); Main.menuMode = 1111; } int index19 = index18 + 1; strArray1[index19] = Lang.menu[65].Value; if (this.selectedMenu == index19) { SoundEngine.PlaySound(11); Main.menuMode = 26; } int index20 = index19 + 1; strArray1[index20] = Lang.menu[218].Value; if (this.selectedMenu == index20) { SoundEngine.PlaySound(10); Main.menuMode = 1125; } int index21 = index20 + 1; strArray1[index21] = Lang.menu[219].Value; if (this.selectedMenu == index21) { SoundEngine.PlaySound(10); Main.menuMode = 1127; } int index22 = index21 + 1; strArray1[index22] = Lang.menu[103].Value; if (this.selectedMenu == index22) { SoundEngine.PlaySound(10); Main.menuMode = 1213; } int index23 = index22 + 1; strArray1[index23] = Lang.menu[5].Value; if (this.selectedMenu == index23 | flag5) { flag5 = false; SoundEngine.PlaySound(11); Main.menuMode = 0; Main.SaveSettings(); goto label_623; } else goto label_623; case 12: int num12 = SocialAPI.Network != null ? 1 : 0; Main.menuServer = false; strArray1[0] = Lang.menu[SocialAPI.Network != null ? 146 : 87].Value; strArray1[1] = Lang.menu[145].Value; strArray1[1 + num12] = Lang.menu[88].Value; strArray1[2 + num12] = Lang.menu[5].Value; if (this.selectedMenu == 0) { Main.LoadPlayers(); Main.menuMultiplayer = true; SoundEngine.PlaySound(10); Main.ClearPendingPlayerSelectCallbacks(); Main.menuMode = 1; } else if (this.selectedMenu == 1 + num12) { Main.LoadPlayers(); SoundEngine.PlaySound(10); Main.ClearPendingPlayerSelectCallbacks(); Main.menuMode = 1; Main.menuMultiplayer = true; Main.menuServer = true; } else if (this.selectedMenu == 1) { SoundEngine.PlaySound(10); SocialAPI.Friends.OpenJoinInterface(); } else if (this.selectedMenu == 2 + num12 | flag5) { flag5 = false; SoundEngine.PlaySound(11); Main.menuMode = 0; } num5 = 3 + num12; goto label_623; case 13: string getIp1 = Main.getIP; PlayerInput.WritingText = true; flag5 = false; Main.instance.HandleIME(); Main.getIP = Main.GetInputText(Main.getIP); string getIp2 = Main.getIP; if (getIp1 != getIp2) SoundEngine.PlaySound(12); strArray1[0] = Lang.menu[89].Value; flagArray2[9] = true; if (Main.getIP != "") { if (Main.getIP.Substring(0, 1) == " ") Main.getIP = ""; for (int index24 = 0; index24 < Main.getIP.Length; ++index24) { if (Main.getIP != " ") flagArray2[9] = false; } } ++this.textBlinkerCount; if (this.textBlinkerCount >= 20) { this.textBlinkerState = this.textBlinkerState != 0 ? 0 : 1; this.textBlinkerCount = 0; } strArray1[1] = Main.getIP; if (this.textBlinkerState == 1) { // ISSUE: explicit reference operation ^ref strArray1[1] += "|"; numArray2[1] = 1; } else { // ISSUE: explicit reference operation ^ref strArray1[1] += " "; } flagArray1[0] = true; flagArray1[1] = true; numArray1[9] = 44; numArray1[10] = 64; strArray1[9] = Lang.menu[4].Value; strArray1[10] = Lang.menu[5].Value; num5 = 11; num2 = 180; num4 = 30; numArray1[1] = 19; for (int index25 = 2; index25 < 9; ++index25) { int index26 = index25 - 2; if (Main.recentWorld[index26] != null && Main.recentWorld[index26] != "") { strArray1[index25] = Main.recentWorld[index26] + " (" + Main.recentIP[index26] + ":" + (object) Main.recentPort[index26] + ")"; } else { strArray1[index25] = ""; flagArray1[index25] = true; } numArray4[index25] = 0.6f; numArray1[index25] = 40; } if (this.selectedMenu >= 2 && this.selectedMenu < 9) { Main.autoPass = false; int index27 = this.selectedMenu - 2; Netplay.ListenPort = Main.recentPort[index27]; Main.getIP = Main.recentIP[index27]; Netplay.SetRemoteIPAsync(Main.getIP, new Action(Main.StartClientGameplay)); Main.menuMode = 14; Main.statusText = Language.GetTextValue("Net.ConnectingTo", (object) Main.getIP); } if (this.selectedMenu == 10 | flag5) { flag5 = false; SoundEngine.PlaySound(11); Main.menuMode = 1; } if (this.selectedMenu == 9 || !flagArray2[2] && Main.inputTextEnter) { SoundEngine.PlaySound(12); Main.menuMode = 131; Main.clrInput(); goto label_623; } else goto label_623; case 14: break; case 15: num5 = 2; strArray1[0] = Main.statusText; flagArray1[0] = true; num2 = 80; num4 = 400; strArray1[1] = Lang.menu[5].Value; if (this.selectedMenu == 1 | flag5) { flag5 = false; Netplay.Disconnect = true; SoundEngine.PlaySound(11); Main.menuMode = 0; Main.netMode = 0; goto label_623; } else goto label_623; case 16: num2 = 200; num4 = 60; numArray1[1] = 30; numArray1[2] = 30; numArray1[3] = 30; numArray1[4] = 70; strArray1[0] = Lang.menu[91].Value; flagArray1[0] = true; strArray1[1] = Lang.menu[92].Value; strArray1[2] = Lang.menu[93].Value; strArray1[3] = Lang.menu[94].Value; strArray1[4] = Lang.menu[5].Value; num5 = 5; if (this.selectedMenu == 4 | flag5) { flag5 = false; Main.menuMode = 6; SoundEngine.PlaySound(11); goto label_623; } else if (this.selectedMenu > 0) { if (this.selectedMenu == 1) { Main.maxTilesX = 4200; Main.maxTilesY = 1200; } else if (this.selectedMenu == 2) { Main.maxTilesX = 6400; Main.maxTilesY = 1800; } else { Main.maxTilesX = 8400; Main.maxTilesY = 2400; } Main.clrInput(); Main.menuMode = -7; SoundEngine.PlaySound(10); WorldGen.setWorldSize(); goto label_623; } else goto label_623; case 17: flag4 = true; num6 = Main.screenWidth / 2 - 16; num7 = 210; flag1 = true; num8 = 390; num2 = 260; num4 = 60; Main.PendingPlayer.hairColor = Main.selColor; num5 = 3; strArray1[0] = Lang.menu[37].Value + " " + (object) (Main.PendingPlayer.hair + 1); strArray1[1] = Lang.menu[38].Value; flagArray1[1] = true; numArray1[2] = 150; numArray1[1] = 10; strArray1[2] = Lang.menu[5].Value; int num13 = 51; if (this.focusMenu == 0) UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 9; if (this.selectedMenu == 0) { SoundEngine.PlaySound(12); ++Main.PendingPlayer.hair; if (Main.PendingPlayer.hair >= num13) Main.PendingPlayer.hair = 0; } else if (this.selectedMenu2 == 0) { SoundEngine.PlaySound(12); --Main.PendingPlayer.hair; if (Main.PendingPlayer.hair < 0) Main.PendingPlayer.hair = num13 - 1; } if (this.selectedMenu == 2 | flag5) { flag5 = false; Main.menuMode = 2; SoundEngine.PlaySound(11); goto label_623; } else goto label_623; case 18: flag4 = true; num6 = Main.screenWidth / 2 - 16; num7 = 210; flag1 = true; num8 = 370; num2 = 240; num4 = 60; Main.PendingPlayer.eyeColor = Main.selColor; num5 = 3; strArray1[0] = ""; strArray1[1] = Lang.menu[39].Value; flagArray1[1] = true; numArray1[2] = 170; numArray1[1] = 10; strArray1[2] = Lang.menu[5].Value; if (this.selectedMenu == 2 | flag5) { flag5 = false; Main.menuMode = 2; SoundEngine.PlaySound(11); goto label_623; } else goto label_623; case 19: flag4 = true; num6 = Main.screenWidth / 2 - 16; num7 = 210; flag1 = true; num8 = 370; num2 = 240; num4 = 60; Main.PendingPlayer.skinColor = Main.selColor; num5 = 3; strArray1[0] = ""; strArray1[1] = Lang.menu[40].Value; flagArray1[1] = true; numArray1[2] = 170; numArray1[1] = 10; strArray1[2] = Lang.menu[5].Value; if (this.selectedMenu == 2 | flag5) { flag5 = false; Main.menuMode = 2; SoundEngine.PlaySound(11); goto label_623; } else goto label_623; case 20: flag4 = true; if (this.selectedMenu == 0) { Main.menuMode = 21; SoundEngine.PlaySound(10); Main.selColor = Main.PendingPlayer.shirtColor; } if (this.selectedMenu == 1) { Main.menuMode = 22; SoundEngine.PlaySound(10); Main.selColor = Main.PendingPlayer.underShirtColor; } if (this.selectedMenu == 2) { Main.menuMode = 23; SoundEngine.PlaySound(10); Main.selColor = Main.PendingPlayer.pantsColor; } if (this.selectedMenu == 3) { Main.selColor = Main.PendingPlayer.shoeColor; Main.menuMode = 24; SoundEngine.PlaySound(10); } if (this.selectedMenu == 5 | flag5) { flag5 = false; SoundEngine.PlaySound(11); Main.menuMode = 2; } if (this.selectedMenu == 4) { SoundEngine.PlaySound(12); Main.CycleClothingStyle(Main.PendingPlayer); } num6 = Main.screenWidth / 2 - 16; num7 = 210; num2 = 260; num4 = 50; num5 = 6; strArray1[0] = Lang.menu[33].Value; strArray1[1] = Lang.menu[34].Value; strArray1[2] = Lang.menu[35].Value; strArray1[3] = Lang.menu[36].Value; strArray1[4] = Lang.menu[(int) sbyte.MaxValue].Value; strArray1[5] = Lang.menu[5].Value; numArray1[5] = 20; goto label_623; case 21: flag4 = true; num6 = Main.screenWidth / 2 - 16; num7 = 210; flag1 = true; num8 = 370; num2 = 240; num4 = 60; Main.PendingPlayer.shirtColor = Main.selColor; num5 = 3; strArray1[0] = ""; strArray1[1] = Lang.menu[41].Value; flagArray1[1] = true; numArray1[2] = 170; numArray1[1] = 10; strArray1[2] = Lang.menu[5].Value; if (this.selectedMenu == 2 | flag5) { flag5 = false; Main.menuMode = 20; SoundEngine.PlaySound(11); goto label_623; } else goto label_623; case 22: flag4 = true; num6 = Main.screenWidth / 2 - 16; num7 = 210; flag1 = true; num8 = 370; num2 = 240; num4 = 60; Main.PendingPlayer.underShirtColor = Main.selColor; num5 = 3; strArray1[0] = ""; strArray1[1] = Lang.menu[42].Value; flagArray1[1] = true; numArray1[2] = 170; numArray1[1] = 10; strArray1[2] = Lang.menu[5].Value; if (this.selectedMenu == 2 | flag5) { flag5 = false; Main.menuMode = 20; SoundEngine.PlaySound(11); goto label_623; } else goto label_623; case 23: flag4 = true; num6 = Main.screenWidth / 2 - 16; num7 = 210; flag1 = true; num8 = 370; num2 = 240; num4 = 60; Main.PendingPlayer.pantsColor = Main.selColor; num5 = 3; strArray1[0] = ""; strArray1[1] = Lang.menu[43].Value; flagArray1[1] = true; numArray1[2] = 170; numArray1[1] = 10; strArray1[2] = Lang.menu[5].Value; if (this.selectedMenu == 2 | flag5) { flag5 = false; Main.menuMode = 20; SoundEngine.PlaySound(11); goto label_623; } else goto label_623; case 24: flag4 = true; num6 = Main.screenWidth / 2 - 16; num7 = 210; flag1 = true; num8 = 370; num2 = 240; num4 = 60; Main.PendingPlayer.shoeColor = Main.selColor; num5 = 3; strArray1[0] = ""; strArray1[1] = Lang.menu[44].Value; flagArray1[1] = true; numArray1[2] = 170; numArray1[1] = 10; strArray1[2] = Lang.menu[5].Value; if (this.selectedMenu == 2 | flag5) { flag5 = false; Main.menuMode = 20; SoundEngine.PlaySound(11); goto label_623; } else goto label_623; case 25: flag1 = true; num8 = 320; num2 = 200; num4 = 10; Main.mouseColor = Main.selColor; Main.mouseColorSlider.SetHSL(Main.mouseColor); num5 = 3; strArray1[0] = ""; strArray1[1] = Lang.menu[64].Value; flagArray1[1] = true; numArray1[2] = 250; numArray1[1] = 10; strArray1[2] = Lang.menu[5].Value; if (this.selectedMenu == 2 | flag5) { flag5 = false; Main.menuMode = 1125; SoundEngine.PlaySound(11); goto label_623; } else goto label_623; case 26: flag2 = true; num2 = 200; num4 = 10; num5 = 3; strArray1[0] = ""; strArray1[1] = Lang.menu[65].Value; flagArray1[1] = true; numArray1[2] = 250; numArray1[1] = 10; strArray1[2] = Lang.menu[5].Value; if (this.selectedMenu == 2 | flag5) { flag5 = false; Main.menuMode = 11; SoundEngine.PlaySound(11); goto label_623; } else goto label_623; case 27: num2 = 176; num4 = 22; num5 = 16; string[] strArray2 = new string[14] { Main.cUp, Main.cDown, Main.cLeft, Main.cRight, Main.cJump, Main.cThrowItem, Main.cInv, Main.cHeal, Main.cMana, Main.cBuff, Main.cHook, Main.cTorch, Main.cSmart, Main.cMount }; if (Main.setKey >= 0) strArray2[Main.setKey] = "_"; strArray1[0] = Lang.menu[74].Value + strArray2[0]; strArray1[1] = Lang.menu[75].Value + strArray2[1]; strArray1[2] = Lang.menu[76].Value + strArray2[2]; strArray1[3] = Lang.menu[77].Value + strArray2[3]; strArray1[4] = Lang.menu[78].Value + strArray2[4]; strArray1[5] = Lang.menu[79].Value + strArray2[5]; strArray1[6] = Lang.menu[80].Value + strArray2[6]; strArray1[7] = Lang.menu[81].Value + strArray2[7]; strArray1[8] = Lang.menu[82].Value + strArray2[8]; strArray1[9] = Lang.menu[83].Value + strArray2[9]; strArray1[10] = Lang.menu[84].Value + strArray2[10]; strArray1[11] = Lang.menu[85].Value + strArray2[11]; strArray1[12] = Lang.menu[120].Value + strArray2[12]; strArray1[13] = Lang.menu[130].Value + strArray2[13]; for (int index28 = 0; index28 < 14; ++index28) { flagArray4[index28] = true; numArray4[index28] = 0.45f; numArray2[index28] = -80; } numArray4[14] = 0.8f; numArray1[14] = 6; strArray1[14] = Lang.menu[86].Value; numArray4[15] = 0.8f; numArray1[15] = 16; strArray1[15] = Lang.menu[5].Value; if (this.selectedMenu == 15 | flag5) { flag5 = false; Main.menuMode = 11; SoundEngine.PlaySound(11); } else if (this.selectedMenu == 14) { Main.ResetKeyBindings(); Main.setKey = -1; SoundEngine.PlaySound(11); } else if (this.selectedMenu >= 0) Main.setKey = this.selectedMenu; if (Main.setKey >= 0) { List pressedKeys = PlayerInput.GetPressedKeys(); if (pressedKeys.Count > 0) { string str = string.Concat((object) pressedKeys[0]); if (str != "None") { if (Main.setKey == 0) Main.cUp = str; if (Main.setKey == 1) Main.cDown = str; if (Main.setKey == 2) Main.cLeft = str; if (Main.setKey == 3) Main.cRight = str; if (Main.setKey == 4) Main.cJump = str; if (Main.setKey == 5) Main.cThrowItem = str; if (Main.setKey == 6) Main.cInv = str; if (Main.setKey == 7) Main.cHeal = str; if (Main.setKey == 8) Main.cMana = str; if (Main.setKey == 9) Main.cBuff = str; if (Main.setKey == 10) Main.cHook = str; if (Main.setKey == 11) Main.cTorch = str; if (Main.setKey == 12) Main.cSmart = str; if (Main.setKey == 13) Main.cMount = str; Main.setKey = -1; goto label_623; } else goto label_623; } else goto label_623; } else goto label_623; case 28: Main.caveParallax = (float) (1.0 - (double) Main.bgScroll / 500.0); flag3 = true; num2 = 240; num4 = 60; num5 = 3; strArray1[0] = ""; strArray1[1] = Lang.menu[52].Value; flagArray1[1] = true; numArray1[2] = 170; numArray1[1] = 10; strArray1[2] = Lang.menu[5].Value; if (this.selectedMenu == 2 | flag5) { flag5 = false; Main.menuMode = 1111; SoundEngine.PlaySound(11); goto label_623; } else goto label_623; case 30: string serverPassword3 = Netplay.ServerPassword; PlayerInput.WritingText = true; flag5 = false; Main.instance.HandleIME(); Netplay.ServerPassword = Main.GetInputText(Netplay.ServerPassword); string serverPassword4 = Netplay.ServerPassword; if (serverPassword3 != serverPassword4) SoundEngine.PlaySound(12); strArray1[0] = Lang.menu[7].Value; ++this.textBlinkerCount; if (this.textBlinkerCount >= 20) { this.textBlinkerState = this.textBlinkerState != 0 ? 0 : 1; this.textBlinkerCount = 0; } strArray1[1] = Netplay.ServerPassword; if (Main.HidePassword) { strArray1[1] = ""; for (int index29 = 0; index29 < Netplay.ServerPassword.Length; ++index29) { // ISSUE: explicit reference operation ^ref strArray1[1] += "*"; } } if (this.textBlinkerState == 1) { // ISSUE: explicit reference operation ^ref strArray1[1] += "|"; numArray2[1] = 1; } else { // ISSUE: explicit reference operation ^ref strArray1[1] += " "; } flagArray1[0] = true; flagArray1[1] = true; numArray1[1] = -20; numArray1[2] = 20; strArray1[2] = Lang.menu[4].Value; strArray1[3] = Lang.menu[5].Value; num5 = 4; if (this.selectedMenu == 3 | flag5) { flag5 = false; Main.menuMode = SocialAPI.Network == null ? 6 : 889; Netplay.ServerPassword = ""; goto label_623; } else if (this.selectedMenu == 2 || Main.inputTextEnter || Main.autoPass) { string str1 = "-autoshutdown -password \"" + Main.ConvertToSafeArgument(Netplay.ServerPassword) + "\" -lang " + (object) Language.ActiveCulture.LegacyId; string str2 = (!Main.ActiveWorldFileData.IsCloudSave ? (object) (str1 + " -world \"" + Main.worldPathName + "\"") : (object) (str1 + " -cloudworld \"" + Main.worldPathName + "\"")).ToString() + " -worldrollbackstokeep " + (object) Main.WorldRollingBackupsCountToKeep; Main.tServer = new Process(); Main.tServer.StartInfo.FileName = "TerrariaServer.exe"; Main.tServer.StartInfo.Arguments = str2; if (Main.libPath != "") { ProcessStartInfo startInfo = Main.tServer.StartInfo; startInfo.Arguments = startInfo.Arguments + " -loadlib " + Main.libPath; } Main.tServer.StartInfo.UseShellExecute = false; Main.tServer.StartInfo.CreateNoWindow = true; if (SocialAPI.Network != null) SocialAPI.Network.LaunchLocalServer(Main.tServer, Main.MenuServerMode); else Main.tServer.Start(); Netplay.SetRemoteIP("127.0.0.1"); Main.autoPass = true; Main.statusText = Lang.menu[8].Value; Netplay.StartTcpClient(); Main.menuMode = 10; goto label_623; } else goto label_623; case 100: num5 = 1; strArray1[0] = Main.statusText; flagArray1[0] = true; num2 = 300; goto label_623; case 111: for (int index30 = 0; index30 < 9; ++index30) numArray4[index30] = 0.85f; num2 = 210; num4 = 55; int index31 = 0; strArray1[index31] = Lang.menu[73].Value + ": " + (object) Main.PendingResolutionWidth + "x" + (object) Main.PendingResolutionHeight; if (this.selectedMenu == index31) { SoundEngine.PlaySound(12); int num14 = 0; for (int index32 = 0; index32 < Main.numDisplayModes; ++index32) { if (Main.displayWidth[index32] == Main.PendingResolutionWidth && Main.displayHeight[index32] == Main.PendingResolutionHeight) { num14 = index32; break; } } int index33 = (num14 + 1) % Main.numDisplayModes; Main.PendingResolutionWidth = Main.displayWidth[index33]; Main.PendingResolutionHeight = Main.displayHeight[index33]; } int index34 = index31 + 1; if (Main.IsBorderlessDisplayAvailable()) { strArray1[index34] = Lang.menu[Main.PendingBorderlessState ? 245 : 246].Value; if (this.selectedMenu == index34) { SoundEngine.PlaySound(12); Main.PendingBorderlessState = !Main.PendingBorderlessState; } ++index34; } numArray1[index34] = 100; strArray1[index34] = Lang.menu[134].Value; if (this.selectedMenu == index34) { if (Main.graphics.IsFullScreen || Main.PendingBorderlessState != Main.screenBorderless || Main.PendingResolutionWidth != Main.screenWidth || Main.PendingResolutionHeight != Main.screenHeight) { Main.screenBorderless = Main.PendingBorderlessState; Main.screenBorderlessPendingResizes = Main.screenBorderless ? 6 : 0; Main.SetResolution(Main.PendingResolutionWidth, Main.PendingResolutionHeight); } SoundEngine.PlaySound(11); Main.menuMode = 1111; } int index35 = index34 + 1; strArray1[index35] = Lang.menu[5].Value; numArray1[index35] = 100; if (this.selectedMenu == index35 | flag5) { flag5 = false; Main.PendingResolutionWidth = Main.graphics.PreferredBackBufferWidth; Main.PendingResolutionHeight = Main.graphics.PreferredBackBufferHeight; Main.PendingBorderlessState = Main.screenBorderless; Main.menuMode = 1111; SoundEngine.PlaySound(11); } num5 = index35 + 1; goto label_623; case 112: num2 = 250; num4 = 52; num5 = 5; numArray1[num5 - 1] = 18; for (int index36 = 0; index36 < num5; ++index36) numArray4[index36] = 0.78f; int index37 = 0; strArray1[index37] = !Main.autoSave ? Lang.menu[68].Value : Lang.menu[67].Value; if (this.selectedMenu == index37) { SoundEngine.PlaySound(12); Main.autoSave = !Main.autoSave; } int index38 = index37 + 1; strArray1[index38] = !Main.autoPause ? Lang.menu[70].Value : Lang.menu[69].Value; if (this.selectedMenu == index38) { SoundEngine.PlaySound(12); Main.autoPause = !Main.autoPause; } int index39 = index38 + 1; strArray1[index39] = !Main.mapEnabled ? Lang.menu[113].Value : Lang.menu[112].Value; if (this.selectedMenu == index39) { SoundEngine.PlaySound(12); Main.mapEnabled = !Main.mapEnabled; } int index40 = index39 + 1; strArray1[index40] = Main.HidePassword ? Lang.menu[212].Value : Lang.menu[211].Value; if (this.selectedMenu == index40) { SoundEngine.PlaySound(12); Main.HidePassword = !Main.HidePassword; } int index41 = index40 + 1; strArray1[index41] = Lang.menu[5].Value; if (this.selectedMenu == index41 | flag5) { flag5 = false; Main.menuMode = 11; SoundEngine.PlaySound(11); goto label_623; } else goto label_623; case 131: int num15 = 7777; PlayerInput.WritingText = true; flag5 = false; Main.instance.HandleIME(); string getPort1 = Main.getPort; Main.getPort = Main.GetInputText(Main.getPort); string getPort2 = Main.getPort; if (getPort1 != getPort2) SoundEngine.PlaySound(12); strArray1[0] = Lang.menu[90].Value; flagArray2[2] = true; if (Main.getPort != "") { bool flag7 = false; try { num15 = Convert.ToInt32(Main.getPort); if (num15 > 0) { if (num15 <= (int) ushort.MaxValue) flag7 = true; } } catch { } if (flag7) flagArray2[2] = false; } ++this.textBlinkerCount; if (this.textBlinkerCount >= 20) { this.textBlinkerState = this.textBlinkerState != 0 ? 0 : 1; this.textBlinkerCount = 0; } strArray1[1] = Main.getPort; if (this.textBlinkerState == 1) { // ISSUE: explicit reference operation ^ref strArray1[1] += "|"; numArray2[1] = 1; } else { // ISSUE: explicit reference operation ^ref strArray1[1] += " "; } flagArray1[0] = true; flagArray1[1] = true; numArray1[1] = -20; numArray1[2] = 20; strArray1[2] = Lang.menu[4].Value; strArray1[3] = Lang.menu[5].Value; num5 = 4; if (this.selectedMenu == 3 | flag5) { flag5 = false; SoundEngine.PlaySound(11); Main.menuMode = 1; } if (this.selectedMenu == 2 || !flagArray2[2] && Main.inputTextEnter) { Netplay.ListenPort = num15; Main.autoPass = false; Netplay.SetRemoteIPAsync(Main.getIP, new Action(Main.StartClientGameplay)); Main.menuMode = 14; Main.statusText = Language.GetTextValue("Net.ConnectingTo", (object) Main.getIP); goto label_623; } else goto label_623; case 200: num5 = 3; strArray1[0] = Lang.menu[9].Value; flagArray1[0] = true; num2 -= 30; numArray1[1] = 70; numArray1[2] = 50; strArray1[1] = Lang.menu[10].Value; strArray1[2] = Lang.menu[6].Value; if (this.selectedMenu == 1) { if (FileUtilities.Exists(Main.worldPathName + ".bak", Main.ActiveWorldFileData.IsCloudSave)) { FileUtilities.Move(Main.worldPathName, Main.worldPathName + ".bad", Main.ActiveWorldFileData.IsCloudSave); FileUtilities.Move(Main.worldPathName + ".bak", Main.worldPathName, Main.ActiveWorldFileData.IsCloudSave); SoundEngine.PlaySound(10); WorldGen.playWorld(); Main.menuMode = 10; } else { SoundEngine.PlaySound(11); Main.menuMode = 0; Main.netMode = 0; } } if (this.selectedMenu == 2 | flag5) { flag5 = false; SoundEngine.PlaySound(11); Main.menuMode = 0; Main.netMode = 0; goto label_623; } else goto label_623; case 201: num5 = 3; strArray1[0] = Lang.menu[9].Value; flagArray1[0] = true; flagArray1[1] = true; num2 -= 30; numArray1[1] = -30; numArray1[2] = 50; strArray1[1] = Lang.menu[11].Value; strArray1[2] = Lang.menu[5].Value; if (this.selectedMenu == 2 | flag5) { flag5 = false; SoundEngine.PlaySound(11); Main.menuMode = 0; Main.netMode = 0; goto label_623; } else goto label_623; case 222: strArray1[0] = this.focusMenu != 3 ? (this.focusMenu != 2 ? (this.focusMenu != 1 ? Lang.menu[32].Value : Lang.menu[31].Value) : Lang.menu[30].Value) : Lang.menu[29].Value; num4 = 50; numArray1[1] = 25; numArray1[2] = 25; numArray1[3] = 25; flagArray1[0] = true; strArray1[1] = Lang.menu[26].Value; strArray1[2] = Lang.menu[25].Value; numArray3[2] = (byte) 1; strArray1[3] = Lang.menu[24].Value; numArray3[3] = (byte) 2; num5 = 4; if (this.selectedMenu == 1) { Main.PendingPlayer.difficulty = (byte) 0; Main.menuMode = 2; goto label_623; } else if (this.selectedMenu == 2) { Main.menuMode = 2; Main.PendingPlayer.difficulty = (byte) 1; goto label_623; } else if (this.selectedMenu == 3) { Main.PendingPlayer.difficulty = (byte) 2; Main.menuMode = 2; goto label_623; } else goto label_623; case 252: flag1 = true; num8 = 320; num2 = 200; num4 = 10; Main.MouseBorderColor = Main.selColor; Main.mouseBorderColorSlider.SetHSL(Main.mouseColor); num5 = 3; strArray1[0] = ""; strArray1[1] = Lang.menu[217].Value; flagArray1[1] = true; numArray1[2] = 250; numArray1[1] = 10; strArray1[2] = Lang.menu[5].Value; if (this.selectedMenu == 2 | flag5) { flag5 = false; Main.menuMode = 1125; SoundEngine.PlaySound(11); goto label_623; } else goto label_623; case 882: num5 = 2; flagArray1[0] = true; num2 = 300; strArray1[0] = Main.statusText; strArray1[1] = Lang.menu[6].Value; if (this.selectedMenu == 1 | flag5) { flag5 = false; SoundEngine.PlaySound(11); Main.menuMode = 0; Main.netMode = 0; if (SocialAPI.Network != null) { SocialAPI.Network.CancelJoin(); goto label_623; } else goto label_623; } else goto label_623; case 889: num2 = 200; num4 = 60; numArray1[1] = 30; numArray1[2] = 30; numArray1[3] = 30; numArray1[4] = 70; numArray1[5] = 70; num5 = 6; strArray1[0] = Lang.menu[135].Value; strArray1[4] = Lang.menu[144].Value; strArray1[5] = Lang.menu[5].Value; flagArray1[0] = true; if (!Main.MenuServerMode.HasFlag((Enum) ServerMode.Lobby)) { Main.MenuServerMode = ServerMode.None; flagArray1[2] = true; flagArray1[3] = true; strArray1[1] = Lang.menu[136].Value; strArray1[2] = ""; strArray1[3] = ""; } else { strArray1[1] = Lang.menu[137].Value; if (Main.MenuServerMode.HasFlag((Enum) ServerMode.FriendsCanJoin)) { strArray1[2] = Lang.menu[139].Value; strArray1[3] = !Main.MenuServerMode.HasFlag((Enum) ServerMode.FriendsOfFriends) ? Lang.menu[142].Value : Lang.menu[143].Value; } else { strArray1[2] = Lang.menu[138].Value; strArray1[3] = !Main.MenuServerMode.HasFlag((Enum) ServerMode.FriendsOfFriends) ? Lang.menu[140].Value : Lang.menu[141].Value; } } if (flag5) { flag5 = false; this.selectedMenu = 5; } switch (this.selectedMenu) { case 1: Main.MenuServerMode ^= ServerMode.Lobby; SoundEngine.PlaySound(12); goto label_623; case 2: Main.MenuServerMode ^= ServerMode.FriendsCanJoin; SoundEngine.PlaySound(12); goto label_623; case 3: Main.MenuServerMode ^= ServerMode.FriendsOfFriends; SoundEngine.PlaySound(12); goto label_623; case 4: Main.clrInput(); Netplay.ServerPassword = ""; Main.GetInputText(""); Main.autoPass = false; Main.menuMode = 30; SoundEngine.PlaySound(10); goto label_623; case 5: Main.menuMode = 6; SoundEngine.PlaySound(11); goto label_623; default: goto label_623; } case 1111: Main.bgScroll = (int) Math.Round((1.0 - (double) Main.caveParallax) * 500.0); int index42 = 0; strArray1[index42] = Main.graphics.IsFullScreen ? Lang.menu[49].Value : Lang.menu[50].Value; if (this.selectedMenu == index42) Main.ToggleFullScreen(); int index43 = index42 + 1; strArray1[index43] = Lang.menu[51].Value; if (this.selectedMenu == index43) { SoundEngine.PlaySound(10); Main.menuMode = 111; } int index44 = index43 + 1; strArray1[index44] = Lang.menu[52].Value; if (this.selectedMenu == index44) { SoundEngine.PlaySound(11); Main.menuMode = 28; } int index45 = index44 + 1; strArray1[index45] = Lang.menu[247 + Main.FrameSkipMode].Value; if (this.selectedMenu == index45) { SoundEngine.PlaySound(12); ++Main.FrameSkipMode; if (Main.FrameSkipMode < 0 || Main.FrameSkipMode > 2) Main.FrameSkipMode = 0; } int index46 = index45 + 1; strArray1[index46] = Language.GetTextValue("UI.LightMode_" + (object) Lighting.Mode); if (this.selectedMenu == index46) { SoundEngine.PlaySound(12); Lighting.NextLightMode(); } int index47 = index46 + 1; switch (Main.qaStyle) { case 0: strArray1[index47] = Lang.menu[59].Value; break; case 1: strArray1[index47] = Lang.menu[60].Value; break; case 2: strArray1[index47] = Lang.menu[61].Value; break; default: strArray1[index47] = Lang.menu[62].Value; break; } if (this.selectedMenu == index47) { SoundEngine.PlaySound(12); if (++Main.qaStyle > 3) Main.qaStyle = 0; } int index48 = index47 + 1; strArray1[index48] = Main.BackgroundEnabled ? Lang.menu[100].Value : Lang.menu[101].Value; if (this.selectedMenu == index48) { SoundEngine.PlaySound(12); Main.BackgroundEnabled = !Main.BackgroundEnabled; } int index49 = index48 + 1; strArray1[index49] = ChildSafety.Disabled ? Lang.menu[132].Value : Lang.menu[133].Value; if (this.selectedMenu == index49) { SoundEngine.PlaySound(12); ChildSafety.Disabled = !ChildSafety.Disabled; } int index50 = index49 + 1; strArray1[index50] = Main.SettingsEnabled_MinersWobble ? Lang.menu[250].Value : Lang.menu[251].Value; if (this.selectedMenu == index50) { SoundEngine.PlaySound(12); Main.SettingsEnabled_MinersWobble = !Main.SettingsEnabled_MinersWobble; } int index51 = index50 + 1; strArray1[index51] = Main.SettingsEnabled_TilesSwayInWind ? Language.GetTextValue("UI.TilesSwayInWindOn") : Language.GetTextValue("UI.TilesSwayInWindOff"); if (this.selectedMenu == index51) { SoundEngine.PlaySound(12); Main.SettingsEnabled_TilesSwayInWind = !Main.SettingsEnabled_TilesSwayInWind; } int index52 = index51 + 1; strArray1[index52] = Language.GetTextValue("UI.Effects"); if (this.selectedMenu == index52) { SoundEngine.PlaySound(11); Main.menuMode = 2008; } int num16 = index52; int index53 = num16; strArray1[index53] = Lang.menu[5].Value; numArray1[index53] = 8; if (this.selectedMenu == index53 | flag5) { flag5 = false; SoundEngine.PlaySound(11); Main.SaveSettings(); Main.menuMode = 11; } num2 = 186; num4 = 30; num5 = index53 + 1; for (int index54 = 0; index54 < num16; ++index54) numArray4[index54] = 0.6f; goto label_623; case 1112: num2 = 210; num4 = 36; num5 = 9; numArray1[num5 - 1] = 18; for (int index55 = 0; index55 < num5; ++index55) numArray4[index55] = 0.75f; int index56 = 0; strArray1[index56] = !Main.showItemText ? Lang.menu[72].Value : Lang.menu[71].Value; if (this.selectedMenu == index56) { SoundEngine.PlaySound(12); Main.showItemText = !Main.showItemText; } int index57 = index56 + 1; strArray1[index57] = Lang.menu[123].Value + " " + Lang.menu[124 + Main.invasionProgressMode].Value; if (this.selectedMenu == index57) { SoundEngine.PlaySound(12); ++Main.invasionProgressMode; if (Main.invasionProgressMode >= 3) Main.invasionProgressMode = 0; } int index58 = index57 + 1; strArray1[index58] = Main.placementPreview ? Lang.menu[128].Value : Lang.menu[129].Value; if (this.selectedMenu == index58) { SoundEngine.PlaySound(12); Main.placementPreview = !Main.placementPreview; } int index59 = index58 + 1; strArray1[index59] = ItemSlot.Options.HighlightNewItems ? Lang.inter[117].Value : Lang.inter[116].Value; if (this.selectedMenu == index59) { SoundEngine.PlaySound(12); ItemSlot.Options.HighlightNewItems = !ItemSlot.Options.HighlightNewItems; } int index60 = index59 + 1; strArray1[index60] = Main.MouseShowBuildingGrid ? Lang.menu[229].Value : Lang.menu[230].Value; if (this.selectedMenu == index60) { SoundEngine.PlaySound(12); Main.MouseShowBuildingGrid = !Main.MouseShowBuildingGrid; } int index61 = index60 + 1; strArray1[index61] = Main.GamepadDisableInstructionsDisplay ? Lang.menu[241].Value : Lang.menu[242].Value; if (this.selectedMenu == index61) { SoundEngine.PlaySound(12); Main.GamepadDisableInstructionsDisplay = !Main.GamepadDisableInstructionsDisplay; } int index62 = index61 + 1; string str3 = ""; MinimapFrame minimapFrame1 = (MinimapFrame) null; foreach (KeyValuePair minimapFrame2 in Main.MinimapFrames) { MinimapFrame minimapFrame3 = minimapFrame2.Value; if (minimapFrame3 == Main.ActiveMinimapFrame) { str3 = Language.GetTextValue("UI.MinimapFrame_" + minimapFrame2.Key); break; } minimapFrame1 = minimapFrame3; } if (minimapFrame1 == null) minimapFrame1 = Main.MinimapFrames.Values.Last(); strArray1[index62] = Language.GetTextValue("UI.SelectMapBorder", (object) str3); if (this.selectedMenu == index62) Main.ActiveMinimapFrame = minimapFrame1; int index63 = index62 + 1; string str4 = ""; IPlayerResourcesDisplaySet resourcesDisplaySet1 = (IPlayerResourcesDisplaySet) null; foreach (KeyValuePair playerResourcesSet in Main.PlayerResourcesSets) { IPlayerResourcesDisplaySet resourcesDisplaySet2 = playerResourcesSet.Value; if (resourcesDisplaySet2 == Main.ActivePlayerResourcesSet) { str4 = Language.GetTextValue("UI.HealthManaStyle_" + playerResourcesSet.Key); break; } resourcesDisplaySet1 = resourcesDisplaySet2; } if (resourcesDisplaySet1 == null) resourcesDisplaySet1 = Main.PlayerResourcesSets.Values.Last(); strArray1[index63] = Language.GetTextValue("UI.SelectHealthStyle", (object) str4); if (this.selectedMenu == index63) Main.ActivePlayerResourcesSet = resourcesDisplaySet1; int index64 = index63 + 1; strArray1[index64] = Lang.menu[5].Value; if (this.selectedMenu == index64 | flag5) { flag5 = false; Main.menuMode = 11; SoundEngine.PlaySound(11); goto label_623; } else goto label_623; case 1125: num2 = 232; num4 = 38; num5 = 7; numArray1[num5 - 1] = 18; for (int index65 = 0; index65 < num5; ++index65) numArray4[index65] = 0.73f; int index66 = 0; strArray1[index66] = Lang.menu[64].Value; if (this.selectedMenu == index66) { SoundEngine.PlaySound(10); Main.selColor = Main.mouseColor; Main.mouseColorSlider.SetHSL(Main.mouseColor); Main.menuMode = 25; } int index67 = index66 + 1; strArray1[index67] = Lang.menu[217].Value; if (this.selectedMenu == index67) { SoundEngine.PlaySound(10); Main.selColor = Main.MouseBorderColor; Main.mouseBorderColorSlider.SetHSL(Main.mouseColor); Main.menuMode = 252; } int index68 = index67 + 1; strArray1[index68] = Main.cSmartCursorModeIsToggleAndNotHold ? Lang.menu[121].Value : Lang.menu[122].Value; if (this.selectedMenu == index68) { SoundEngine.PlaySound(12); Main.cSmartCursorModeIsToggleAndNotHold = !Main.cSmartCursorModeIsToggleAndNotHold; } int index69 = index68 + 1; strArray1[index69] = Player.SmartCursorSettings.SmartAxeAfterPickaxe ? Lang.menu[214].Value : Lang.menu[213].Value; if (this.selectedMenu == index69) { SoundEngine.PlaySound(12); Player.SmartCursorSettings.SmartAxeAfterPickaxe = !Player.SmartCursorSettings.SmartAxeAfterPickaxe; } int index70 = index69 + 1; strArray1[index70] = Player.SmartCursorSettings.SmartBlocksEnabled ? Lang.menu[215].Value : Lang.menu[216].Value; if (this.selectedMenu == index70) { SoundEngine.PlaySound(12); Player.SmartCursorSettings.SmartBlocksEnabled = !Player.SmartCursorSettings.SmartBlocksEnabled; } int index71 = index70 + 1; switch (LockOnHelper.UseMode) { case LockOnHelper.LockOnMode.FocusTarget: strArray1[index71] = Lang.menu[232].Value; break; case LockOnHelper.LockOnMode.TargetClosest: strArray1[index71] = Lang.menu[233].Value; break; case LockOnHelper.LockOnMode.ThreeDS: strArray1[index71] = Lang.menu[234].Value; break; } if (this.selectedMenu == index71) { SoundEngine.PlaySound(12); LockOnHelper.CycleUseModes(); } int index72 = index71 + 1; strArray1[index72] = Lang.menu[5].Value; if (this.selectedMenu == index72 | flag5) { flag5 = false; Main.menuMode = 11; SoundEngine.PlaySound(11); goto label_623; } else goto label_623; case 1127: num2 = 250; num4 = 52; num5 = 4; numArray1[num5 - 1] = 18; for (int index73 = 0; index73 < num5; ++index73) numArray4[index73] = 0.78f; int index74 = 0; strArray1[index74] = Main.ReversedUpDownArmorSetBonuses ? Lang.menu[220].Value : Lang.menu[221].Value; if (this.selectedMenu == index74) { SoundEngine.PlaySound(12); Main.ReversedUpDownArmorSetBonuses = !Main.ReversedUpDownArmorSetBonuses; } int index75 = index74 + 1; strArray1[index75] = ItemSlot.Options.DisableLeftShiftTrashCan ? Lang.menu[224].Value : Lang.menu[223].Value; if (this.selectedMenu == index75) { SoundEngine.PlaySound(12); ItemSlot.Options.DisableLeftShiftTrashCan = !ItemSlot.Options.DisableLeftShiftTrashCan; } int index76 = index75 + 1; strArray1[index76] = Lang.menu[222].Value; if (this.selectedMenu == index76) { SoundEngine.PlaySound(10); Main.MenuUI.SetState((UIState) Main.ManageControlsMenu); Main.menuMode = 888; } int index77 = index76 + 1; strArray1[index77] = Lang.menu[5].Value; if (this.selectedMenu == index77 | flag5) { flag5 = false; Main.menuMode = 11; SoundEngine.PlaySound(11); goto label_623; } else goto label_623; case 2008: num2 = 240; num4 = 60; num5 = 6; strArray1[0] = ""; strArray1[1] = Language.GetTextValue("UI.Effects"); flagArray1[1] = true; numArray1[1] = 10; strArray1[2] = Language.GetTextValue("GameUI.StormEffects", Main.UseStormEffects ? (object) Language.GetTextValue("GameUI.Enabled") : (object) Language.GetTextValue("GameUI.Disabled")); numArray4[2] = 0.8f; strArray1[3] = Language.GetTextValue("GameUI.HeatDistortion", Main.UseHeatDistortion ? (object) Language.GetTextValue("GameUI.Enabled") : (object) Language.GetTextValue("GameUI.Disabled")); numArray4[3] = 0.8f; string textValue; switch (Main.WaveQuality) { case 1: textValue = Language.GetTextValue("GameUI.QualityLow"); break; case 2: textValue = Language.GetTextValue("GameUI.QualityMedium"); break; case 3: textValue = Language.GetTextValue("GameUI.QualityHigh"); break; default: textValue = Language.GetTextValue("GameUI.QualityOff"); break; } strArray1[4] = Language.GetTextValue("GameUI.WaveQuality", (object) textValue); numArray4[4] = 0.8f; strArray1[5] = Lang.menu[5].Value; if (this.selectedMenu == 2) Main.UseStormEffects = !Main.UseStormEffects; if (this.selectedMenu == 3) Main.UseHeatDistortion = !Main.UseHeatDistortion; if (this.selectedMenu == 4) Main.WaveQuality = (Main.WaveQuality + 1) % 4; if (this.selectedMenu == 5 | flag5) { flag5 = false; Main.menuMode = 1111; SoundEngine.PlaySound(11); goto label_623; } else goto label_623; case 5000: Main.MenuUI.SetState((UIState) new UIVirtualKeyboard(Language.GetTextValue("UI.EnterSeed"), "", new UIVirtualKeyboard.KeyboardSubmitEvent(this.OnSeedSelected), Main.CreateGoToMenuEvent(7), allowEmpty: true)); Main.menuMode = 888; goto label_623; case 272727: num2 = 200; num4 = 30; num5 = 14; string[] strArray3 = new string[12] { Main.cMapStyle, Main.cMapFull, Main.cMapZoomIn, Main.cMapZoomOut, Main.cMapAlphaUp, Main.cMapAlphaDown, null, null, null, null, null, null }; if (Main.setKey >= 0) strArray3[Main.setKey] = "_"; strArray1[0] = Lang.menu[106].Value + strArray3[0]; strArray1[1] = Lang.menu[107].Value + strArray3[1]; strArray1[2] = Lang.menu[108].Value + strArray3[2]; strArray1[3] = Lang.menu[109].Value + strArray3[3]; strArray1[4] = Lang.menu[110].Value + strArray3[4]; strArray1[5] = Lang.menu[111].Value + strArray3[5]; for (int index78 = 0; index78 < 6; ++index78) { flagArray4[index78] = true; numArray4[index78] = 0.55f; numArray2[index78] = -140; } numArray4[6] = 0.8f; numArray4[6] = 0.8f; numArray1[6] = 6; strArray1[6] = Lang.menu[86].Value; numArray1[7] = 16; strArray1[7] = Lang.menu[5].Value; if (this.selectedMenu == 7 | flag5) { flag5 = false; Main.menuMode = 11; SoundEngine.PlaySound(11); } else if (this.selectedMenu == 6) { Main.cMapStyle = "Tab"; Main.cMapFull = "M"; Main.cMapZoomIn = "Add"; Main.cMapZoomOut = "Subtract"; Main.cMapAlphaUp = "PageUp"; Main.cMapAlphaDown = "PageDown"; Main.setKey = -1; SoundEngine.PlaySound(11); } else if (this.selectedMenu >= 0) Main.setKey = this.selectedMenu; if (Main.setKey >= 0) { List pressedKeys = PlayerInput.GetPressedKeys(); if (pressedKeys.Count > 0) { string str5 = string.Concat((object) pressedKeys[0]); if (str5 != "None") { if (Main.setKey == 0) Main.cMapStyle = str5; if (Main.setKey == 1) Main.cMapFull = str5; if (Main.setKey == 2) Main.cMapZoomIn = str5; if (Main.setKey == 3) Main.cMapZoomOut = str5; if (Main.setKey == 4) Main.cMapAlphaUp = str5; if (Main.setKey == 5) Main.cMapAlphaDown = str5; Main.setKey = -1; goto label_623; } else goto label_623; } else goto label_623; } else goto label_623; case 1000000: num5 = 2; strArray1[0] = Main.statusText; flagArray1[0] = true; num2 = 220; num4 = 250; strArray1[1] = Lang.menu[5].Value; if (this.selectedMenu == 1 | flag5) { flag5 = false; SoundEngine.PlaySound(11); Main.menuMode = 6; Main.netMode = 0; goto label_623; } else goto label_623; default: goto label_623; } } num5 = 2; strArray1[0] = Main.statusText; flagArray1[0] = true; num2 = 300; int num17 = Main.statusText.Split('\n').Length - 1; numArray4[0] = (float) (1.0 - (double) num17 * 0.0399999991059303); numArray1[0] = num17 * -18; numArray1[1] = num17 * 28; strArray1[1] = Lang.menu[6].Value; if (this.selectedMenu == 1 | flag5) { flag5 = false; Netplay.InvalidateAllOngoingIPSetAttempts(); Netplay.Disconnect = true; Netplay.Connection.Socket.Close(); SoundEngine.PlaySound(11); Main.menuMode = 0; Main.netMode = 0; if (Main.tServer != null) { try { Main.tServer.Kill(); Main.tServer = (Process) null; break; } catch { break; } } else break; } else break; } label_623: if (Main.menuMode == 888) { if (!Main._blockFancyUIWhileLoading) Main.MenuUI.Draw(Main.spriteBatch, gameTime); } else Main.MenuUI.SetState((UIState) null); if (UILinkPointNavigator.Shortcuts.BackButtonInUse && !flag5) UILinkPointNavigator.Shortcuts.BackButtonLock = true; int num18 = this.focusMenu; if (Main.menuMode != menuMode2) { if (Main.menuMode == 10) Main.gameTips.ClearTips(); Main.blockMouse = true; Main.menuSkip = 0; num5 = 0; if (PlayerInput.UsingGamepad && Main.InvisibleCursorForGamepad) { this.focusMenu = num18 = -1; int num19; PlayerInput.MouseY = num19 = 0; PlayerInput.MouseX = num19; Main.mouseY = num19; Main.mouseX = num19; } for (int index79 = 0; index79 < Main.maxMenuItems; ++index79) this.menuItemScale[index79] = 0.8f; } if (!Main.mouseLeft) Main.blockMouse = true; this.selectedMenu = -1; this.selectedMenu2 = -1; this.focusMenu = -1; bool flag8 = Main.mouseLeft && !PlayerInput.UsingGamepad; if (!flag1) { this.grabColorSlider = 0; Main.hBar = -1f; Main.sBar = -1f; Main.lBar = -1f; Main.aBar = -1f; } if (flag1) { if (!Main.mouseLeft) { this.grabColorSlider = 0; Main.blockMouse = false; } int focusColor = Main.focusColor; Main.focusColor = 0; int num20 = num8; int num21 = Main.screenWidth / 2 - TextureAssets.Hue.Width() / 2; int num22 = 167; Vector3 hsl = Main.rgbToHsl(Main.selColor); float Hue = hsl.X; float Saturation1 = hsl.Y; float Luminosity1 = hsl.Z; float num23 = (float) Main.selColor.A / (float) byte.MaxValue; if ((double) Main.hBar == -1.0 || (double) Main.sBar == -1.0 || (double) Main.lBar == -1.0 || (double) Main.aBar == -1.0) { Main.hBar = Hue; Main.sBar = Saturation1; Main.lBar = Luminosity1; Main.aBar = num23; } else { Hue = Main.hBar; Saturation1 = Main.sBar; Luminosity1 = Main.lBar; float aBar = Main.aBar; } Main.spriteBatch.Draw(TextureAssets.Hue.Value, new Vector2((float) num21, (float) num20), Microsoft.Xna.Framework.Color.White); if (Main.mouseX > num21 - 4 && Main.mouseX < num21 + TextureAssets.Hue.Width() + 4 && Main.mouseY > num20 - 4 && Main.mouseY < num20 + TextureAssets.Hue.Height() + 4 && this.grabColorSlider == 0 || this.grabColorSlider == 1) Main.spriteBatch.Draw(TextureAssets.ColorHighlight.Value, new Vector2((float) num21, (float) num20), Main.OurFavoriteColor); Main.spriteBatch.Draw(TextureAssets.ColorSlider.Value, new Vector2((float) num21 + (float) (TextureAssets.Hue.Width() - 2) * Main.hBar - (float) (TextureAssets.ColorSlider.Width() / 2), (float) (num20 - TextureAssets.ColorSlider.Height() / 2 + TextureAssets.Hue.Height() / 2)), Microsoft.Xna.Framework.Color.White); if (Main.mouseX > num21 - 4 && Main.mouseX < num21 + TextureAssets.Hue.Width() + 4 && Main.mouseY > num20 - 4 && Main.mouseY < num20 + TextureAssets.Hue.Height() + 4 && this.grabColorSlider == 0 || this.grabColorSlider == 1) { Main.focusColor = 1; UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 5; if (flag8 && !Main.blockMouse) { this.grabColorSlider = 1; Hue = (float) (Main.mouseX - num21) / (float) TextureAssets.Hue.Width(); if ((double) Hue < 0.0) Hue = 0.0f; if ((double) Hue > 1.0) Hue = 1f; Main.hBar = Hue; } } GamepadMainMenuHandler.MenuItemPositions.Add(new Vector2((float) num21, (float) num20) + TextureAssets.ColorBar.Value.Size() / 2f); int num24 = num20 + 26; Main.spriteBatch.Draw(TextureAssets.ColorBar.Value, new Vector2((float) num21, (float) num24), Microsoft.Xna.Framework.Color.White); for (int index80 = 0; index80 <= num22; ++index80) { float Saturation2 = (float) index80 / (float) num22; Microsoft.Xna.Framework.Color rgb = Main.hslToRgb(Hue, Saturation2, Luminosity1); Main.spriteBatch.Draw(TextureAssets.ColorBlip.Value, new Vector2((float) (num21 + index80 + 5), (float) (num24 + 4)), rgb); } if (Main.mouseX > num21 - 4 && Main.mouseX < num21 + TextureAssets.Hue.Width() + 4 && Main.mouseY > num24 - 4 && Main.mouseY < num24 + TextureAssets.Hue.Height() + 4 && this.grabColorSlider == 0 || this.grabColorSlider == 2) Main.spriteBatch.Draw(TextureAssets.ColorHighlight.Value, new Vector2((float) num21, (float) num24), Main.OurFavoriteColor); Main.spriteBatch.Draw(TextureAssets.ColorSlider.Value, new Vector2((float) num21 + (float) (TextureAssets.Hue.Width() - 2) * Main.sBar - (float) (TextureAssets.ColorSlider.Width() / 2), (float) (num24 - TextureAssets.ColorSlider.Height() / 2 + TextureAssets.Hue.Height() / 2)), Microsoft.Xna.Framework.Color.White); if (Main.mouseX > num21 - 4 && Main.mouseX < num21 + TextureAssets.Hue.Width() + 4 && Main.mouseY > num24 - 4 && Main.mouseY < num24 + TextureAssets.Hue.Height() + 4 && this.grabColorSlider == 0 || this.grabColorSlider == 2) { Main.focusColor = 2; UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 6; if (flag8 && !Main.blockMouse) { this.grabColorSlider = 2; Saturation1 = (float) (Main.mouseX - num21) / (float) TextureAssets.Hue.Width(); if ((double) Saturation1 < 0.0) Saturation1 = 0.0f; if ((double) Saturation1 > 1.0) Saturation1 = 1f; Main.sBar = Saturation1; } } GamepadMainMenuHandler.MenuItemPositions.Add(new Vector2((float) num21, (float) num24) + TextureAssets.ColorBar.Value.Size() / 2f); int num25 = num24 + 26; Main.spriteBatch.Draw(TextureAssets.ColorBar.Value, new Vector2((float) num21, (float) num25), Microsoft.Xna.Framework.Color.White); float num26 = 0.15f; if (Main.menuMode == 252) num26 = 0.0f; for (int index81 = 0; index81 <= num22; ++index81) { float Luminosity2 = (float) index81 / (float) num22; Microsoft.Xna.Framework.Color rgb = Main.hslToRgb(Hue, Saturation1, Luminosity2); Main.spriteBatch.Draw(TextureAssets.ColorBlip.Value, new Vector2((float) (num21 + index81 + 5), (float) (num25 + 4)), rgb); } if (Main.mouseX > num21 - 4 && Main.mouseX < num21 + TextureAssets.Hue.Width() + 4 && Main.mouseY > num25 - 4 && Main.mouseY < num25 + TextureAssets.Hue.Height() + 4 && this.grabColorSlider == 0 || this.grabColorSlider == 3) Main.spriteBatch.Draw(TextureAssets.ColorHighlight.Value, new Vector2((float) num21, (float) num25), Main.OurFavoriteColor); Main.spriteBatch.Draw(TextureAssets.ColorSlider.Value, new Vector2((float) num21 + (float) (TextureAssets.Hue.Width() - 2) * (float) (((double) Main.lBar - (double) num26) / (1.0 - (double) num26)) - (float) (TextureAssets.ColorSlider.Width() / 2), (float) (num25 - TextureAssets.ColorSlider.Height() / 2 + TextureAssets.Hue.Height() / 2)), Microsoft.Xna.Framework.Color.White); if (Main.mouseX > num21 - 4 && Main.mouseX < num21 + TextureAssets.Hue.Width() + 4 && Main.mouseY > num25 - 4 && Main.mouseY < num25 + TextureAssets.Hue.Height() + 4 && this.grabColorSlider == 0 || this.grabColorSlider == 3) { Main.focusColor = 3; UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 7; if (flag8 && !Main.blockMouse) { this.grabColorSlider = 3; float num27 = (float) (Main.mouseX - num21) / (float) TextureAssets.Hue.Width(); if ((double) num27 < 0.0) num27 = 0.0f; if ((double) num27 > 1.0) num27 = 1f; Luminosity1 = num27 * (1f - num26) + num26; Main.lBar = Luminosity1; } } GamepadMainMenuHandler.MenuItemPositions.Add(new Vector2((float) num21, (float) num25) + TextureAssets.ColorBar.Value.Size() / 2f); bool flag9 = false; if (Main.menuMode == 252) { int num28 = num25 + 26; flag9 = true; Main.spriteBatch.Draw(TextureAssets.ColorBar.Value, new Vector2((float) num21, (float) num28), Microsoft.Xna.Framework.Color.White); Microsoft.Xna.Framework.Color rgb = Main.hslToRgb(Hue, Saturation1, Luminosity1); for (int index82 = 0; index82 <= num22; ++index82) { float num29 = (float) index82 / (float) num22; Microsoft.Xna.Framework.Color color4 = rgb * num29; Main.spriteBatch.Draw(TextureAssets.ColorBlip.Value, new Vector2((float) (num21 + index82 + 5), (float) (num28 + 4)), color4); } if (Main.mouseX > num21 - 4 && Main.mouseX < num21 + TextureAssets.Hue.Width() + 4 && Main.mouseY > num28 - 4 && Main.mouseY < num28 + TextureAssets.Hue.Height() + 4 && this.grabColorSlider == 0 || this.grabColorSlider == 4) Main.spriteBatch.Draw(TextureAssets.ColorHighlight.Value, new Vector2((float) num21, (float) num28), Main.OurFavoriteColor); Main.spriteBatch.Draw(TextureAssets.ColorSlider.Value, new Vector2((float) num21 + (float) (TextureAssets.Hue.Width() - 2) * Main.aBar - (float) (TextureAssets.ColorSlider.Width() / 2), (float) (num28 - TextureAssets.ColorSlider.Height() / 2 + TextureAssets.Hue.Height() / 2)), Microsoft.Xna.Framework.Color.White); if (Main.mouseX > num21 - 4 && Main.mouseX < num21 + TextureAssets.Hue.Width() + 4 && Main.mouseY > num28 - 4 && Main.mouseY < num28 + TextureAssets.Hue.Height() + 4 && this.grabColorSlider == 0 || this.grabColorSlider == 4) { Main.focusColor = 4; UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 8; if (Main.mouseLeft && !Main.blockMouse) { this.grabColorSlider = 4; float num30 = (float) (Main.mouseX - num21) / (float) TextureAssets.Hue.Width(); if ((double) num30 < 0.0) num30 = 0.0f; if ((double) num30 > 1.0) num30 = 1f; Main.aBar = num30; } } GamepadMainMenuHandler.MenuItemPositions.Add(new Vector2((float) num21, (float) num28) + TextureAssets.ColorBar.Value.Size() / 2f); } if (focusColor != Main.focusColor) SoundEngine.PlaySound(12); Main.selColor = Main.hslToRgb(Main.hBar, Main.sBar, Main.lBar); if (flag9) Main.selColor.A = (byte) ((double) Main.aBar * (double) byte.MaxValue); } else if (flag1) { string str6 = ""; for (int index83 = 0; index83 < 6; ++index83) { int num31 = num8; int num32 = 370 + Main.screenWidth / 2 - 400; if (index83 == 0) str6 = Lang.menu[95].Value; if (index83 == 1) { str6 = Lang.menu[96].Value; num31 += 30; } if (index83 == 2) { str6 = Lang.menu[97].Value; num31 += 60; } if (index83 == 3) { str6 = string.Concat((object) Main.selColor.R); num32 += 90; } if (index83 == 4) { str6 = string.Concat((object) Main.selColor.G); num32 += 90; num31 += 30; } if (index83 == 5) { str6 = string.Concat((object) Main.selColor.B); num32 += 90; num31 += 60; } for (int index84 = 0; index84 < 5; ++index84) { Microsoft.Xna.Framework.Color color5 = Microsoft.Xna.Framework.Color.Black; if (index84 == 4) { color5 = color1; color5.R = (byte) (((int) byte.MaxValue + (int) color5.R) / 2); color5.G = (byte) (((int) byte.MaxValue + (int) color5.R) / 2); color5.B = (byte) (((int) byte.MaxValue + (int) color5.R) / 2); } int maxValue = (int) byte.MaxValue; int num33 = (int) color5.R - ((int) byte.MaxValue - maxValue); if (num33 < 0) num33 = 0; color5 = new Microsoft.Xna.Framework.Color((int) (byte) num33, (int) (byte) num33, (int) (byte) num33, (int) (byte) maxValue); int num34 = 0; int num35 = 0; if (index84 == 0) num34 = -2; if (index84 == 1) num34 = 2; if (index84 == 2) num35 = -2; if (index84 == 3) num35 = 2; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.DeathText.Value, str6, new Vector2((float) (num32 + num34), (float) (num31 + num35)), color5, 0.0f, new Vector2(), 0.5f, SpriteEffects.None, 0.0f); } } bool flag10 = false; for (int index85 = 0; index85 < 2; ++index85) { for (int index86 = 0; index86 < 3; ++index86) { int num36 = num8 + index86 * 30 - 12; int num37 = 360 + Main.screenWidth / 2 - 400; float num38 = 0.9f; int num39; if (index85 == 0) { num39 = num37 - 70; num36 += 2; } else num39 = num37 - 40; string str7 = "-"; if (index85 == 1) str7 = "+"; Vector2 vector2 = new Vector2(24f, 24f); int num40 = 142; if (Main.mouseX > num39 && (double) Main.mouseX < (double) num39 + (double) vector2.X && Main.mouseY > num36 + 13 && (double) Main.mouseY < (double) (num36 + 13) + (double) vector2.Y) { if (Main.focusColor != (index85 + 1) * (index86 + 10)) SoundEngine.PlaySound(12); Main.focusColor = (index85 + 1) * (index86 + 10); flag10 = true; num40 = (int) byte.MaxValue; if (Main.mouseLeft) { if (Main.colorDelay <= 1) { Main.colorDelay = Main.colorDelay != 0 ? 3 : 40; int num41 = index85; if (index85 == 0) { num41 = -1; if ((int) Main.selColor.R + (int) Main.selColor.G + (int) Main.selColor.B <= 150) num41 = 0; } if (index86 == 0 && (int) Main.selColor.R + num41 >= 0 && (int) Main.selColor.R + num41 <= (int) byte.MaxValue) Main.selColor.R += (byte) num41; if (index86 == 1 && (int) Main.selColor.G + num41 >= 0 && (int) Main.selColor.G + num41 <= (int) byte.MaxValue) Main.selColor.G += (byte) num41; if (index86 == 2 && (int) Main.selColor.B + num41 >= 0 && (int) Main.selColor.B + num41 <= (int) byte.MaxValue) Main.selColor.B += (byte) num41; } --Main.colorDelay; } else Main.colorDelay = 0; } for (int index87 = 0; index87 < 5; ++index87) { Microsoft.Xna.Framework.Color color6 = Microsoft.Xna.Framework.Color.Black; if (index87 == 4) { color6 = color1; color6.R = (byte) (((int) byte.MaxValue + (int) color6.R) / 2); color6.G = (byte) (((int) byte.MaxValue + (int) color6.R) / 2); color6.B = (byte) (((int) byte.MaxValue + (int) color6.R) / 2); } int num42 = (int) color6.R - ((int) byte.MaxValue - num40); if (num42 < 0) num42 = 0; color6 = new Microsoft.Xna.Framework.Color((int) (byte) num42, (int) (byte) num42, (int) (byte) num42, (int) (byte) num40); int num43 = 0; int num44 = 0; if (index87 == 0) num43 = -2; if (index87 == 1) num43 = 2; if (index87 == 2) num44 = -2; if (index87 == 3) num44 = 2; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.DeathText.Value, str7, new Vector2((float) (num39 + num43), (float) (num36 + num44)), color6, 0.0f, new Vector2(), num38, SpriteEffects.None, 0.0f); } } } if (!flag10) { Main.focusColor = 0; Main.colorDelay = 0; } } if (flag2) { float x = (float) (Main.screenWidth / 2 - 40 + 37); int num45 = 320; string text = ""; for (int index88 = 0; index88 < 6; ++index88) { int num46 = num45; int num47 = 370 + Main.screenWidth / 2 - 400 + 37; switch (index88) { case 0: text = Lang.menu[98].Value; num46 += 30; break; case 1: text = Lang.menu[99].Value; break; case 2: text = Lang.menu[119].Value; num46 += 60; break; case 3: text = Math.Round((double) Main.musicVolume * 100.0).ToString() + "%"; num47 += 90; break; case 4: text = Math.Round((double) Main.soundVolume * 100.0).ToString() + "%"; num47 += 90; num46 += 30; break; case 5: text = Math.Round((double) Main.ambientVolume * 100.0).ToString() + "%"; num47 += 90; num46 += 60; break; } Microsoft.Xna.Framework.Color textColor = color1; textColor.R = (byte) (((int) byte.MaxValue + (int) textColor.R) / 2); textColor.G = (byte) (((int) byte.MaxValue + (int) textColor.R) / 2); textColor.B = (byte) (((int) byte.MaxValue + (int) textColor.R) / 2); int maxValue = (int) byte.MaxValue; int num48 = (int) textColor.R - ((int) byte.MaxValue - maxValue); if (num48 < 0) num48 = 0; textColor = new Microsoft.Xna.Framework.Color((int) (byte) num48, (int) (byte) num48, (int) (byte) num48, (int) (byte) maxValue); Utils.DrawBorderStringFourWay(Main.spriteBatch, FontAssets.DeathText.Value, text, (float) num47, (float) num46, textColor, Microsoft.Xna.Framework.Color.Black, Vector2.Zero, 0.5f); } int rightHover = IngameOptions.rightHover; IngameOptions.rightHover = -1; if (!Main.mouseLeft) IngameOptions.rightLock = -1; IngameOptions.valuePosition = new Vector2(x, (float) (num45 - 18 + 30)); GamepadMainMenuHandler.MenuItemPositions.Add(IngameOptions.valuePosition - TextureAssets.ColorBar.Value.Size() * new Vector2(0.5f, 0.0f)); float num49 = IngameOptions.DrawValueBar(Main.spriteBatch, 1f, Main.musicVolume); if (IngameOptions.inBar || IngameOptions.rightLock == 3) { UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 2; IngameOptions.rightHover = 3; if (flag8 && IngameOptions.rightLock == 3) Main.musicVolume = num49; } IngameOptions.valuePosition = new Vector2(x, (float) (num45 - 18 + 60)); GamepadMainMenuHandler.MenuItemPositions.Add(IngameOptions.valuePosition - TextureAssets.ColorBar.Value.Size() * new Vector2(0.5f, 0.0f)); float num50 = IngameOptions.DrawValueBar(Main.spriteBatch, 1f, Main.soundVolume); if (IngameOptions.inBar || IngameOptions.rightLock == 2) { UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 3; IngameOptions.rightHover = 2; if (flag8 && IngameOptions.rightLock == 2) Main.soundVolume = num50; } IngameOptions.valuePosition = new Vector2(x, (float) (num45 - 18 + 90)); GamepadMainMenuHandler.MenuItemPositions.Add(IngameOptions.valuePosition - TextureAssets.ColorBar.Value.Size() * new Vector2(0.5f, 0.0f)); float num51 = IngameOptions.DrawValueBar(Main.spriteBatch, 1f, Main.ambientVolume); if (IngameOptions.inBar || IngameOptions.rightLock == 4) { UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 4; IngameOptions.rightHover = 4; if (flag8 && IngameOptions.rightLock == 4) Main.ambientVolume = num51; } if (IngameOptions.rightHover != -1) IngameOptions.rightLock = IngameOptions.rightHover; if (IngameOptions.rightHover != rightHover) SoundEngine.PlaySound(12); } if (flag3) { int num52 = 400; string str8 = ""; for (int index89 = 0; index89 < 4; ++index89) { int num53 = num52; int num54 = 370 + Main.screenWidth / 2 - 400; if (index89 == 0) str8 = Lang.menu[52].Value + ": " + (object) Main.bgScroll; for (int index90 = 0; index90 < 5; ++index90) { Microsoft.Xna.Framework.Color color7 = Microsoft.Xna.Framework.Color.Black; if (index90 == 4) { color7 = color1; color7.R = (byte) (((int) byte.MaxValue + (int) color7.R) / 2); color7.G = (byte) (((int) byte.MaxValue + (int) color7.R) / 2); color7.B = (byte) (((int) byte.MaxValue + (int) color7.R) / 2); } int maxValue = (int) byte.MaxValue; int num55 = (int) color7.R - ((int) byte.MaxValue - maxValue); if (num55 < 0) num55 = 0; color7 = new Microsoft.Xna.Framework.Color((int) (byte) num55, (int) (byte) num55, (int) (byte) num55, (int) (byte) maxValue); int num56 = 0; int num57 = 0; if (index90 == 0) num56 = -2; if (index90 == 1) num56 = 2; if (index90 == 2) num57 = -2; if (index90 == 3) num57 = 2; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.DeathText.Value, str8, new Vector2((float) (num54 + num56), (float) (num53 + num57)), color7, 0.0f, new Vector2(), 0.5f, SpriteEffects.None, 0.0f); } } IngameOptions.rightHover = -1; if (!Main.mouseLeft) IngameOptions.rightLock = -1; IngameOptions.valuePosition = new Vector2((float) (Main.screenWidth / 2 - 40), (float) (num52 + 12)); GamepadMainMenuHandler.MenuItemPositions.Add(IngameOptions.valuePosition - TextureAssets.ColorBar.Value.Size() * new Vector2(0.5f, 0.0f)); float num58 = IngameOptions.DrawValueBar(Main.spriteBatch, 1f, (float) Main.bgScroll / 100f); if (IngameOptions.inBar || IngameOptions.rightLock == 2) { UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 1; IngameOptions.rightHover = 2; if (flag8 && IngameOptions.rightLock == 2) { Main.bgScroll = (int) ((double) num58 * 100.0); Main.caveParallax = (float) (1.0 - (double) Main.bgScroll / 500.0); } } if (IngameOptions.rightHover != -1) IngameOptions.rightLock = IngameOptions.rightHover; } bool flag11 = false; for (int index91 = 0; index91 < num5; ++index91) { if (strArray1[index91] != null) { Vector2 vector2_1 = FontAssets.DeathText.Value.MeasureString(strArray1[index91]); vector2_1.X *= 0.5f; vector2_1.Y *= 0.5f; for (int index92 = 0; index92 < 5; ++index92) { Microsoft.Xna.Framework.Color color8 = Microsoft.Xna.Framework.Color.Black; if (index92 == 4) { switch (numArray3[index91]) { case 0: color8 = color1; break; case 1: color8 = Main.mcColor; break; case 2: color8 = Main.hcColor; break; case 3: color8 = Main.highVersionColor; break; case 4: case 5: case 6: color8 = Main.errorColor; break; default: color8 = color1; break; } color8.R = (byte) (((int) byte.MaxValue + (int) color8.R) / 2); color8.G = (byte) (((int) byte.MaxValue + (int) color8.G) / 2); color8.B = (byte) (((int) byte.MaxValue + (int) color8.B) / 2); } int num59 = (int) ((double) byte.MaxValue * ((double) this.menuItemScale[index91] * 2.0 - 1.0)); if (flagArray1[index91]) num59 = (int) byte.MaxValue; int num60 = (int) color8.R - ((int) byte.MaxValue - num59); if (num60 < 0) num60 = 0; int num61 = (int) color8.G - ((int) byte.MaxValue - num59); if (num61 < 0) num61 = 0; int num62 = (int) color8.B - ((int) byte.MaxValue - num59); if (num62 < 0) num62 = 0; if (num18 == index91 && index92 == 4) { float num63 = (float) num59 / (float) byte.MaxValue; num60 = (int) ((double) num60 * (1.0 - (double) num63) + (double) byte.MaxValue * (double) num63); num61 = (int) ((double) num61 * (1.0 - (double) num63) + 215.0 * (double) num63); num62 = (int) ((double) num62 * (1.0 - (double) num63) + 0.0 * (double) num63); } color8 = new Microsoft.Xna.Framework.Color((int) (byte) num60, (int) (byte) num61, (int) (byte) num62, (int) (byte) num59); if (flagArray3[index91]) { if (index92 == 4) { color8.R = (byte) ((int) color8.R * (int) Main.mouseTextColor / 300); color8.G = (byte) ((int) color8.G * (int) Main.mouseTextColor / 300); color8.B = (byte) ((int) color8.B * (int) Main.mouseTextColor / 300); color8.A = (byte) ((int) color8.A * (int) Main.mouseTextColor / 300); } else color8.A -= (byte) ((uint) Main.mouseTextColor / 5U); } int num64 = 0; int num65 = 0; if (index92 == 0) num64 = -2; if (index92 == 1) num64 = 2; if (index92 == 2) num65 = -2; if (index92 == 3) num65 = 2; float num66 = this.menuItemScale[index91]; if (Main.menuMode == 15 && index91 == 0) num66 *= 0.35f; else if (Main.menuMode == 1000000 && index91 == 0) num66 *= 0.75f; else if (Main.netMode == 2) num66 *= 0.5f; float num67 = num66 * numArray4[index91]; if (!flagArray4[index91]) DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.DeathText.Value, strArray1[index91], new Vector2((float) (num3 + num64 + numArray2[index91]), (float) (num2 + num4 * index91 + num65) + vector2_1.Y * numArray4[index91] + (float) numArray1[index91]), color8, 0.0f, vector2_1, num67, SpriteEffects.None, 0.0f); else DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.DeathText.Value, strArray1[index91], new Vector2((float) (num3 + num64 + numArray2[index91]), (float) (num2 + num4 * index91 + num65) + vector2_1.Y * numArray4[index91] + (float) numArray1[index91]), color8, 0.0f, new Vector2(0.0f, vector2_1.Y), num67, SpriteEffects.None, 0.0f); } if (!flagArray1[index91] && !flagArray2[index91]) GamepadMainMenuHandler.MenuItemPositions.Add(new Vector2((float) (num3 + numArray2[index91]), (float) (num2 + num4 * index91) + vector2_1.Y * numArray4[index91] + (float) numArray1[index91])); if (!flagArray4[index91]) { int num68 = 0; this.menuWide[index91] = false; Vector2 vector2_2 = FontAssets.DeathText.Value.MeasureString(strArray1[index91]) * numArray4[index91]; if ((double) Main.mouseX > (double) num3 - (double) vector2_2.X * 0.5 + (double) numArray2[index91] - (double) num68 && (double) Main.mouseX < (double) num3 + (double) vector2_2.X * 0.5 * (double) numArray4[index91] + (double) numArray2[index91] + (double) num68 && Main.mouseY > num2 + num4 * index91 + numArray1[index91] && (double) Main.mouseY < (double) (num2 + num4 * index91 + numArray1[index91]) + 50.0 * (double) numArray4[index91] && Main.hasFocus) { this.focusMenu = index91; if (flagArray1[index91] || flagArray2[index91]) { this.focusMenu = -1; } else { if (num18 != this.focusMenu) flag11 = true; if (Main.mouseLeftRelease && Main.mouseLeft) this.selectedMenu = index91; if (Main.mouseRightRelease && Main.mouseRight) this.selectedMenu2 = index91; } } } else { Vector2 vector2_3 = FontAssets.DeathText.Value.MeasureString(strArray1[index91]) * numArray4[index91]; if (Main.mouseX > num3 + numArray2[index91] && (double) Main.mouseX < (double) num3 + (double) vector2_3.X + (double) numArray2[index91] && Main.mouseY > num2 + num4 * index91 + numArray1[index91] && (double) Main.mouseY < (double) (num2 + num4 * index91 + numArray1[index91]) + 50.0 * (double) numArray4[index91] && Main.hasFocus) { this.focusMenu = index91; if (flagArray1[index91] || flagArray2[index91]) { this.focusMenu = -1; } else { if (num18 != this.focusMenu) flag11 = true; if (Main.mouseLeftRelease && Main.mouseLeft) this.selectedMenu = index91; if (Main.mouseRightRelease && Main.mouseRight) this.selectedMenu2 = index91; } } } } } if (flag11 && num18 != this.focusMenu) SoundEngine.PlaySound(12); if (GamepadMainMenuHandler.MenuItemPositions.Count == 0) { Vector2 vector2 = new Vector2((float) Math.Cos((double) Main.GlobalTimeWrappedHourly * 6.28318548202515), (float) Math.Sin((double) Main.GlobalTimeWrappedHourly * 6.28318548202515 * 2.0)) * new Vector2(30f, 15f) + Vector2.UnitY * 20f; UILinkPointNavigator.SetPosition(2000, new Vector2((float) Main.screenWidth, (float) Main.screenHeight) / 2f + vector2); } for (int index93 = 0; index93 < Main.maxMenuItems; ++index93) { if (index93 == this.focusMenu) { if ((double) this.menuItemScale[index93] < 1.0) this.menuItemScale[index93] += 0.02f; if ((double) this.menuItemScale[index93] > 1.0) this.menuItemScale[index93] = 1f; } else if ((double) this.menuItemScale[index93] > 0.8) this.menuItemScale[index93] -= 0.02f; } if (flag4) { Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, (Effect) null, Main.UIScaleMatrix); Player pendingPlayer = Main.PendingPlayer; pendingPlayer.PlayerFrame(); pendingPlayer.position.X = (float) num6 + Main.screenPosition.X; pendingPlayer.position.Y = (float) num7 + Main.screenPosition.Y; Main.PlayerRenderer.DrawPlayer(Main.Camera, pendingPlayer, pendingPlayer.position, 0.0f, Vector2.Zero); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, (Effect) null, Main.UIScaleMatrix); } if (!WorldGen.drunkWorldGen) { for (int index94 = 0; index94 < 5; ++index94) { Microsoft.Xna.Framework.Color color9 = Microsoft.Xna.Framework.Color.Black; if (index94 == 4) { color9 = color1; color9.R = (byte) (((int) byte.MaxValue + (int) color9.R) / 2); color9.G = (byte) (((int) byte.MaxValue + (int) color9.R) / 2); color9.B = (byte) (((int) byte.MaxValue + (int) color9.R) / 2); } color9.A = (byte) ((double) color9.A * 0.300000011920929); int num69 = 0; int num70 = 0; if (index94 == 0) num69 = -2; if (index94 == 1) num69 = 2; if (index94 == 2) num70 = -2; if (index94 == 3) num70 = 2; Vector2 vector2 = FontAssets.MouseText.Value.MeasureString(Main.versionNumber); vector2.X *= 0.5f; vector2.Y *= 0.5f; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, Main.versionNumber, new Vector2((float) ((double) vector2.X + (double) num69 + 10.0), (float) ((double) Main.screenHeight - (double) vector2.Y + (double) num70 - 2.0)), color9, 0.0f, vector2, 1f, SpriteEffects.None, 0.0f); } } Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.SamplerStateForCursor, DepthStencilState.None, RasterizerState.CullCounterClockwise, (Effect) null, Main.UIScaleMatrix); Main.DrawCursor(Main.DrawThickCursor()); Main.DrawPendingMouseText(); if (Main.fadeCounter > 0) { Microsoft.Xna.Framework.Color color10 = Microsoft.Xna.Framework.Color.White; --Main.fadeCounter; float num71 = (float) ((double) Main.fadeCounter / 120.0 * (double) byte.MaxValue); if (this.quickSplash) num71 = (float) ((double) Main.fadeCounter / 75.0 * (double) byte.MaxValue); byte num72 = (byte) num71; color10 = new Microsoft.Xna.Framework.Color((int) num72, (int) num72, (int) num72, (int) num72); Main.spriteBatch.Draw(TextureAssets.Fade.Value, new Microsoft.Xna.Framework.Rectangle(-5, -5, Main.screenWidth + 10, Main.screenHeight + 10), color10); } Main.spriteBatch.End(); Main.mouseLeftRelease = !Main.mouseLeft; Main.mouseRightRelease = !Main.mouseRight; if (Main.menuMode != menuMode1) return; GamepadMainMenuHandler.LastDrew = menuMode1; } private static void ClearVisualPostProcessEffects() { for (int index = 0; index < 13; ++index) { string key = ""; switch (index) { case 0: key = "Solar"; break; case 1: key = "Vortex"; break; case 2: key = "Nebula"; break; case 3: key = "Stardust"; break; case 4: key = "MoonLord"; break; case 5: key = "MonolithSolar"; break; case 6: key = "MonolithVortex"; break; case 7: key = "MonolithNebula"; break; case 8: key = "MonolithStardust"; break; case 9: key = "Blizzard"; break; case 10: key = "HeatDistortion"; break; case 11: key = "Sandstorm"; break; case 12: key = "MonolithMoonLord"; break; } if (SkyManager.Instance[key] != null && SkyManager.Instance[key].IsActive()) SkyManager.Instance[key].Deactivate(); if (Overlays.Scene[key] != null && Overlays.Scene[key].IsVisible()) Overlays.Scene[key].Deactivate(); if (Terraria.Graphics.Effects.Filters.Scene[key] != null && Terraria.Graphics.Effects.Filters.Scene[key].IsActive()) Terraria.Graphics.Effects.Filters.Scene[key].Deactivate(); } if (Terraria.Graphics.Effects.Filters.Scene["BloodMoon"].IsActive()) Terraria.Graphics.Effects.Filters.Scene["BloodMoon"].Deactivate(); if (Terraria.Graphics.Effects.Filters.Scene["Graveyard"].IsActive()) Terraria.Graphics.Effects.Filters.Scene["Graveyard"].Deactivate(); if (Terraria.Graphics.Effects.Filters.Scene["BloodMoon"].IsActive()) Terraria.Graphics.Effects.Filters.Scene["BloodMoon"].Deactivate(); if (Terraria.Graphics.Effects.Filters.Scene["MoonLordShake"].IsActive()) Terraria.Graphics.Effects.Filters.Scene["MoonLordShake"].Deactivate(); if (Terraria.Graphics.Effects.Filters.Scene["WaterDistortion"].IsActive()) Terraria.Graphics.Effects.Filters.Scene["WaterDistortion"].Deactivate(); if (SkyManager.Instance["Martian"].IsActive()) SkyManager.Instance["Martian"].Deactivate(); if (SkyManager.Instance["Party"].IsActive()) SkyManager.Instance["Party"].Deactivate(); if (SkyManager.Instance["Slime"].IsActive()) SkyManager.Instance["Slime"].Deactivate(); if (SkyManager.Instance["Ambience"].IsActive()) SkyManager.Instance["Ambience"].Deactivate(); Main.slimeRain = false; Main.slimeRainTime = 0.0; Main.slimeWarningTime = 0; BirthdayParty.WorldClear(); LanternNight.WorldClear(); Sandstorm.WorldClear(); Main.maxRaining = 0.0f; Main.raining = false; } private static void PostDrawMenu(Microsoft.Xna.Framework.Point screenSizeCache, Microsoft.Xna.Framework.Point screenSizeCacheAfterScaling) { if (!(Main.ScreenSize == screenSizeCacheAfterScaling)) return; Main.screenPosition.Y -= (float) (screenSizeCache.Y - Main.screenHeight); } private void PreDrawMenu(out Microsoft.Xna.Framework.Point screenSizeCache, out Microsoft.Xna.Framework.Point screenSizeCacheAfterScaling) { double uiScaleWanted = (double) Main._uiScaleWanted; float num = (float) Main.screenHeight / 900f; if ((double) num < 1.0) num = 1f; if (Main.SettingDontScaleMainMenuUp) num = 1f; screenSizeCache = Main.ScreenSize; Main.UIScale = num; PlayerInput.SetZoom_UI(); screenSizeCacheAfterScaling = Main.ScreenSize; if (this._needsMenuUIRecalculation) { this._needsMenuUIRecalculation = false; Main.MenuUI.Recalculate(); } Main._uiScaleWanted = (float) uiScaleWanted; } private static bool IsBorderlessDisplayAvailable() => true; private static void SetDisplayModeAsBorderless(ref int width, ref int height, Form form) { if (!Main.screenBorderless || Main.graphics.IsFullScreen || Main.screenBorderlessPendingResizes <= 0) return; --Main.screenBorderlessPendingResizes; System.Drawing.Rectangle bounds = Screen.FromPoint(form.Location).Bounds; width = bounds.Width; height = bounds.Height; Main.TryPickingDefaultUIScale((float) height); } private static void ApplyBorderlessResolution(Form form) { if (Main.screenBorderlessPendingResizes <= 0) return; --Main.screenBorderlessPendingResizes; System.Drawing.Rectangle bounds = Screen.FromPoint(form.Location).Bounds; form.Location = new System.Drawing.Point(bounds.X, bounds.Y); form.FormBorderStyle = FormBorderStyle.None; form.Width = bounds.Width; form.Height = bounds.Height; } private static void SetBorderlessFormStyle(Form form) { form.Location = new System.Drawing.Point(0, 0); form.FormBorderStyle = FormBorderStyle.None; } public static void OpenCharacterSelectUI() { Main.MenuUI.SetState((UIState) Main._characterSelectMenu); Main.menuMode = 888; } public static void OpenWorldSelectUI() { Main.MenuUI.SetState((UIState) Main._worldSelectMenu); Main.menuMode = 888; } private static void CycleClothingStyle(Player plr) { Main.CycleClothingStyle_Inner(plr); while (!Main.IsValidPlayerStyle(plr)) Main.CycleClothingStyle_Inner(plr); } private static bool IsValidPlayerStyle(Player plr) { switch (plr.skinVariant) { case 10: case 11: return false; default: return true; } } private static void CycleClothingStyle_Inner(Player plr) { if (plr.Male) { int num = 0; int[] variantOrderMale = PlayerVariantID.Sets.VariantOrderMale; for (int index = 0; index < variantOrderMale.Length; ++index) { if (variantOrderMale[index] == plr.skinVariant) { num = index; break; } } if (num == variantOrderMale.Length - 1) plr.skinVariant = variantOrderMale[0]; else plr.skinVariant = variantOrderMale[num + 1]; } else { int num = 0; int[] variantOrderFemale = PlayerVariantID.Sets.VariantOrderFemale; for (int index = 0; index < variantOrderFemale.Length; ++index) { if (variantOrderFemale[index] == plr.skinVariant) { num = index; break; } } if (num == variantOrderFemale.Length - 1) plr.skinVariant = variantOrderFemale[0]; else plr.skinVariant = variantOrderFemale[num + 1]; } } public static void ResetKeyBindings() { Main.cUp = "W"; Main.cDown = "S"; Main.cLeft = "A"; Main.cRight = "D"; Main.cJump = "Space"; Main.cThrowItem = "T"; Main.cInv = "Escape"; Main.cHeal = "H"; Main.cMana = "J"; Main.cBuff = "B"; Main.cHook = "E"; Main.cTorch = "LeftShift"; Main.cSmart = "LeftControl"; Main.cMount = "R"; } public static void CursorColor() { Main.cursorAlpha += (float) Main.cursorColorDirection * 0.015f; if ((double) Main.cursorAlpha >= 1.0) { Main.cursorAlpha = 1f; Main.cursorColorDirection = -1; } if ((double) Main.cursorAlpha <= 0.6) { Main.cursorAlpha = 0.6f; Main.cursorColorDirection = 1; } float num = (float) ((double) Main.cursorAlpha * 0.300000011920929 + 0.699999988079071); Main.cursorColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) Main.mouseColor.R * (double) Main.cursorAlpha), (int) (byte) ((double) Main.mouseColor.G * (double) Main.cursorAlpha), (int) (byte) ((double) Main.mouseColor.B * (double) Main.cursorAlpha), (int) (byte) ((double) byte.MaxValue * (double) num)); Main.cursorScale = (float) ((double) Main.cursorAlpha * 0.300000011920929 + 0.699999988079071 + 0.100000001490116); } protected void DrawSplash(GameTime gameTime) { int num1 = 10000; this.GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Black); base.Draw(gameTime); this.TickLoadProcess(); long num2 = Main.splashTimer.ElapsedMilliseconds; if ((double) Main.musicVolume == 0.0) { this.quickSplash = true; num2 = 999999L; num1 = 0; } if (Main.Assets.PendingAssets == 0 && this._musicLoaded && this._artLoaded && Program.LoadedEverything) Main._isAsyncLoadComplete = true; Main.spriteBatch.Begin(); ++this.splashCounter; Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.White; byte num3 = 0; if (this.quickSplash) { if (this.splashCounter <= 75) num3 = (byte) ((double) this.splashCounter / 75.0 * (double) byte.MaxValue); else if (this.splashCounter <= 125) num3 = byte.MaxValue; else if (this.splashCounter <= 200) { if (!Main._isAsyncLoadComplete) this.splashCounter = 125; num3 = (byte) ((double) (75 - (this.splashCounter - 125)) / 75.0 * (double) byte.MaxValue); } else { this.Initialize_AlmostEverything(); Main.PostContentLoadInitialize(); Main.showSplash = false; Main.fadeCounter = 75; Main.splashTimer.Stop(); } } else { int num4 = 90; int num5 = 410; int num6 = 620; int num7 = 60; if (this.splashCounter >= num4) { if (this.splashCounter <= num5) { float num8 = (float) (this.splashCounter - num4) / (float) (num5 - num4); num3 = (byte) (num8 * (num8 * num8 * num8) * (float) byte.MaxValue); } else if (this.splashCounter <= num6) { num3 = byte.MaxValue; if (this.splashCounter >= num6 - num7) num3 = (byte) ((double) (num7 - (this.splashCounter - (num6 - num7))) / (double) num7 * (double) byte.MaxValue); } else if (!Main._isAsyncLoadComplete) { num3 = (byte) 0; num1 = 1; } else { this.Initialize_AlmostEverything(); Main.PostContentLoadInitialize(); Main.showSplash = false; Main.fadeCounter = 120; Main.splashTimer.Stop(); } } } color = new Microsoft.Xna.Framework.Color((int) num3, (int) num3, (int) num3, (int) num3); Asset splashTextureLegoBack = TextureAssets.SplashTextureLegoBack; if (splashTextureLegoBack.Width() > 0 && splashTextureLegoBack.Height() > 0) { Vector2 vector2_1 = new Vector2((float) Main.screenWidth / (float) splashTextureLegoBack.Width(), (float) Main.screenHeight / (float) splashTextureLegoBack.Height()); Vector2 vector2_2 = splashTextureLegoBack.Size() / 2f; Vector2 position = new Vector2((float) Main.screenWidth, (float) Main.screenHeight) / 2f; Vector2 scale1 = vector2_1; if ((double) scale1.X > (double) scale1.Y) scale1.X = scale1.Y; else scale1.Y = scale1.X; Vector2 scale2 = vector2_1; if ((double) scale2.X < (double) scale2.Y) scale2.X = scale2.Y; else scale2.Y = scale2.X; Main.spriteBatch.Draw(splashTextureLegoBack.Value, position, new Microsoft.Xna.Framework.Rectangle?(), color, 0.0f, splashTextureLegoBack.Size() / 2f, scale2, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.SplashTextureLegoTree.Value, Main.ScreenSize.ToVector2(), new Microsoft.Xna.Framework.Rectangle?(), color, 0.0f, TextureAssets.SplashTextureLegoTree.Size(), scale1, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.SplashTextureLegoFront.Value, position, new Microsoft.Xna.Framework.Rectangle?(), color, 0.0f, TextureAssets.SplashTextureLegoFront.Size() / 2f, scale1, SpriteEffects.None, 0.0f); } int num9 = 70; if (num1 == 1) this.DrawSplash_LoadingFlower(Microsoft.Xna.Framework.Color.White); else if (num2 > (long) num1) this.DrawSplash_LoadingFlower(color); ++this._splashFrameCount; if ((double) this._splashFrameCount >= (double) num9) this._splashFrameCount = 0.0f; Main.spriteBatch.End(); } private void DrawSplash_LoadingFlower(Microsoft.Xna.Framework.Color splashColor) { float val2_1 = (float) Main.screenWidth / Main.MinimumZoomComparerX; float val2_2 = (float) Main.screenHeight / Main.MinimumZoomComparerY; float scale = Math.Max(Math.Max(1f, val2_1), val2_2); Texture2D texture2D = TextureAssets.LoadingSunflower.Value; int num1 = 3; int verticalFrames = 19; Vector2 position = new Vector2((float) (Main.screenWidth / 2), (float) Main.screenHeight) - new Vector2(0.0f, 50f) * scale; int num2 = (int) this._splashFrameCount / num1; if (num2 >= verticalFrames) num2 = 0; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: verticalFrames, frameY: ((num2 + 10) % verticalFrames)); float rotation = 0.0f; Vector2 origin = r.Size() / 2f; Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(r), splashColor, rotation, origin, scale, SpriteEffects.None, 0.0f); } private void DrawSplash_LoadingStar(Microsoft.Xna.Framework.Color splashColor) { int num = 4; Vector2 position = new Vector2((float) Main.screenWidth, (float) Main.screenHeight) - new Vector2(30f); int frameY = (int) this._splashFrameCount / num; if (frameY >= 15) frameY = 0; if (frameY >= 8) frameY = 14 - frameY; Microsoft.Xna.Framework.Rectangle r = TextureAssets.Item[75].Frame(verticalFrames: 8, frameY: frameY); r.Height -= 2; float rotation = 0.0f; Vector2 origin = r.Size() / 2f; origin.Y += 2f; Main.spriteBatch.Draw(TextureAssets.Item[75].Value, position, new Microsoft.Xna.Framework.Rectangle?(r), splashColor, rotation, origin, 1f, SpriteEffects.None, 0.0f); } protected void DrawUnderworldBackground(bool flat) { if ((double) Main.screenPosition.Y + (double) Main.screenHeight < (double) (Main.maxTilesY - 220) * 16.0) return; Vector2 screenOffset = Main.screenPosition + new Vector2((float) (Main.screenWidth >> 1), (float) (Main.screenHeight >> 1)); float pushUp = (float) (((double) Main.GameViewMatrix.Zoom.Y - 1.0) * 0.5 * 200.0); SkyManager.Instance.ResetDepthTracker(); for (int layerTextureIndex = 4; layerTextureIndex >= 0; --layerTextureIndex) Main.DrawUnderworldBackgroudLayer(flat, screenOffset, pushUp, layerTextureIndex); if (!Main.mapFullscreen) SkyManager.Instance.DrawRemainingDepth(Main.spriteBatch); this.DrawSurfaceBG_DrawChangeOverlay(12); } private static void DrawUnderworldBackgroudLayer( bool flat, Vector2 screenOffset, float pushUp, int layerTextureIndex) { int index1 = Main.underworldBG[layerTextureIndex]; Asset asset = TextureAssets.Underworld[index1]; if (!asset.IsLoaded) Main.Assets.Request(asset.Name, (AssetRequestMode) 1); Texture2D texture = asset.Value; Vector2 vector2_1 = new Vector2((float) texture.Width, (float) texture.Height) * 0.5f; float num1 = flat ? 1f : (float) (layerTextureIndex * 2) + 3f; Vector2 vector2_2 = new Vector2(1f / num1); Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, texture.Width, texture.Height); float scale = 1.3f; Vector2 zero = Vector2.Zero; int num2 = 0; switch (index1) { case 1: int num3 = (int) ((double) Main.GlobalTimeWrappedHourly * 8.0) % 4; rectangle = new Microsoft.Xna.Framework.Rectangle((num3 >> 1) * (texture.Width >> 1), num3 % 2 * (texture.Height >> 1), texture.Width >> 1, texture.Height >> 1); vector2_1 *= 0.5f; zero.Y += 175f; break; case 2: zero.Y += 100f; break; case 3: zero.Y += 75f; break; case 4: scale = 0.5f; zero.Y -= 0.0f; break; case 5: zero.Y += (float) num2; break; case 6: int num4 = (int) ((double) Main.GlobalTimeWrappedHourly * 8.0) % 4; rectangle = new Microsoft.Xna.Framework.Rectangle(num4 % 2 * (texture.Width >> 1), (num4 >> 1) * (texture.Height >> 1), texture.Width >> 1, texture.Height >> 1); vector2_1 *= 0.5f; zero.Y += (float) num2; zero.Y += -60f; break; case 7: int num5 = (int) ((double) Main.GlobalTimeWrappedHourly * 8.0) % 4; rectangle = new Microsoft.Xna.Framework.Rectangle(num5 % 2 * (texture.Width >> 1), (num5 >> 1) * (texture.Height >> 1), texture.Width >> 1, texture.Height >> 1); vector2_1 *= 0.5f; zero.Y += (float) num2; zero.X -= 400f; zero.Y += 90f; break; case 8: int num6 = (int) ((double) Main.GlobalTimeWrappedHourly * 8.0) % 4; rectangle = new Microsoft.Xna.Framework.Rectangle(num6 % 2 * (texture.Width >> 1), (num6 >> 1) * (texture.Height >> 1), texture.Width >> 1, texture.Height >> 1); vector2_1 *= 0.5f; zero.Y += (float) num2; zero.Y += 90f; break; case 9: zero.Y += (float) num2; zero.Y -= 30f; break; case 10: zero.Y += 250f * num1; break; case 11: zero.Y += 100f * num1; break; case 12: zero.Y += 20f * num1; break; case 13: zero.Y += 20f * num1; int num7 = (int) ((double) Main.GlobalTimeWrappedHourly * 8.0) % 4; rectangle = new Microsoft.Xna.Framework.Rectangle(num7 % 2 * (texture.Width >> 1), (num7 >> 1) * (texture.Height >> 1), texture.Width >> 1, texture.Height >> 1); vector2_1 *= 0.5f; break; } if (flat) scale *= 1.5f; Vector2 vec = vector2_1 * scale; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / vector2_2.X); if (flat) zero.Y += (float) (TextureAssets.Underworld[0].Height() >> 1) * 1.3f - vec.Y; zero.Y -= pushUp; float num8 = scale * (float) rectangle.Width; int num9 = (int) ((double) (int) ((double) screenOffset.X * (double) vector2_2.X - (double) vec.X + (double) zero.X - (double) (Main.screenWidth >> 1)) / (double) num8); Vector2 vector2_3 = vec.Floor(); int num10 = (int) Math.Ceiling((double) Main.screenWidth / (double) num8); int num11 = (int) ((double) scale * ((double) (rectangle.Width - 1) / (double) vector2_2.X)); Vector2 position; for (position = ((new Vector2((float) ((num9 - 2) * num11), (float) Main.UnderworldLayer * 16f) + vector2_3 - screenOffset) * vector2_2 + screenOffset - Main.screenPosition - vector2_3 + zero).Floor(); (double) position.X + (double) num8 < 0.0; position.X += num8) ++num9; for (int index2 = num9 - 2; index2 <= num9 + 4 + num10; ++index2) { Main.spriteBatch.Draw(texture, position, new Microsoft.Xna.Framework.Rectangle?(rectangle), Microsoft.Xna.Framework.Color.White, 0.0f, Vector2.Zero, scale, SpriteEffects.None, 0.0f); if (layerTextureIndex == 0) { int y = (int) ((double) position.Y + (double) rectangle.Height * (double) scale); Main.spriteBatch.Draw(TextureAssets.BlackTile.Value, new Microsoft.Xna.Framework.Rectangle((int) position.X, y, (int) ((double) rectangle.Width * (double) scale), Math.Max(0, Main.screenHeight - y)), new Microsoft.Xna.Framework.Color(11, 3, 7)); } position.X += num8; } } protected void DrawBackground() { if (!Main.BackgroundEnabled) { this.OldDrawBackground(); } else { Microsoft.Xna.Framework.Color[] slices = new Microsoft.Xna.Framework.Color[9]; Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); double num1 = (double) ((int) (((double) (Main.maxTilesY - 330) - Main.worldSurface) / 6.0) * 6); double num2 = Main.worldSurface + num1 - 5.0; int num3 = (int) ((double) byte.MaxValue * (1.0 - (double) Main.gfxQuality) + 140.0 * (double) Main.gfxQuality); int num4 = (int) (200.0 * (1.0 - (double) Main.gfxQuality) + 40.0 * (double) Main.gfxQuality); Vector2 vector2 = Main.drawToScreen ? Vector2.Zero : new Vector2((float) Main.offScreenRange, (float) Main.offScreenRange); Vector3 vector3 = new Vector3(0.9f); float num5 = MathHelper.Clamp((float) (((double) Main.screenPosition.Y - Main.worldSurface * 16.0) / 300.0), 0.0f, 1f); Lighting.GlobalBrightness = (float) ((double) Lighting.GlobalBrightness * (1.0 - (double) num5) + 1.0 * (double) num5); float num6 = MathHelper.Clamp((float) ((double) Main.screenPosition.Y - (double) (Main.screenHeight / 2) + 200.0 - Main.rockLayer * 16.0) / 300f, 0.0f, 1f); int num7 = (int) (((double) Main.screenPosition.X + (double) (Main.screenWidth / 2)) / 16.0); int num8 = (num7 > Main.caveBackX[0] ? (num7 > Main.caveBackX[1] ? (num7 > Main.caveBackX[2] ? Main.caveBackStyle[3] : Main.caveBackStyle[2]) : Main.caveBackStyle[1]) : Main.caveBackStyle[0]) + 3; if (Main.SceneMetrics.SnowTileCount > SceneMetrics.SnowTileThreshold && ((double) Main.screenPosition.Y + (double) Main.screenHeight + 1200.0) / 16.0 < (double) (Main.maxTilesY - 250)) num8 = 1; if (Main.SceneMetrics.JungleTileCount > SceneMetrics.JungleTileThreshold) { if (num8 == 1) { if (Main.SceneMetrics.JungleTileCount > Main.SceneMetrics.SnowTileCount) num8 = 11; } else num8 = 11; } if (WorldGen.oceanDepths((int) ((double) Main.screenPosition.X + (double) (Main.screenHeight / 2)) / 16, (int) ((double) Main.screenPosition.Y + (double) (Main.screenHeight / 2)) / 16)) num8 = !Main.player[Main.myPlayer].ZoneCorrupt ? (!Main.player[Main.myPlayer].ZoneCrimson ? (!Main.player[Main.myPlayer].ZoneHallow ? 18 : 20) : 21) : 19; else if ((double) Main.screenPosition.Y / 16.0 > Main.rockLayer + 60.0 && (double) Main.screenPosition.Y / 16.0 < num2 - 60.0) { if (Main.player[Main.myPlayer].ZoneSnow) { if (Main.player[Main.myPlayer].ZoneCorrupt) num8 = 15; else if (Main.player[Main.myPlayer].ZoneCrimson) num8 = 16; else if (Main.player[Main.myPlayer].ZoneHallow) num8 = 17; } else if (Main.player[Main.myPlayer].ZoneCorrupt) num8 = 12; else if (Main.player[Main.myPlayer].ZoneCrimson) num8 = 13; else if (Main.player[Main.myPlayer].ZoneHallow) num8 = 14; } if (Main.SceneMetrics.MushroomTileCount > SceneMetrics.MushroomTileMax) num8 = 2; if (num8 != Main.undergroundBackground) { Main.oldUndergroundBackground = Main.undergroundBackground; Main.undergroundBackground = num8; Main.ugBackTransition = 1f; } if ((double) Main.ugBackTransition > 0.0) Main.ugBackTransition -= 0.25f; if ((double) Main.ugBackTransition < 0.0) Main.ugBackTransition = 0.0f; int[] numArray1 = new int[7]; int[] numArray2 = new int[7]; for (int index1 = 0; index1 < 2; ++index1) { int undergroundBackground = Main.undergroundBackground; if (index1 == 1) undergroundBackground = Main.oldUndergroundBackground; int[] numArray3 = new int[7]; switch (undergroundBackground) { case 0: numArray3[0] = 1; numArray3[1] = 2; numArray3[2] = 4; numArray3[3] = 3; numArray3[4] = 6; numArray3[5] = 5; break; case 1: switch (Main.iceBackStyle) { case 0: numArray3[1] = 33; numArray3[3] = 32; numArray3[0] = 40; numArray3[2] = 34; break; case 1: numArray3[1] = 118; numArray3[3] = 117; numArray3[0] = 160; numArray3[2] = 161; break; case 2: numArray3[1] = 165; numArray3[3] = 167; numArray3[0] = 164; numArray3[2] = 166; break; default: numArray3[1] = 120; numArray3[3] = 119; numArray3[0] = 162; numArray3[2] = 163; break; } numArray3[4] = 128 + Main.hellBackStyle; break; case 2: numArray3[0] = 62; numArray3[1] = 63; numArray3[2] = 64; numArray3[3] = 65; numArray3[4] = 143 + Main.hellBackStyle; break; case 3: numArray3[0] = 66; numArray3[1] = 67; numArray3[2] = 68; numArray3[3] = 69; numArray3[4] = 128 + Main.hellBackStyle; break; case 4: numArray3[0] = 70; numArray3[1] = 71; numArray3[2] = 68; numArray3[3] = 72; numArray3[4] = 128 + Main.hellBackStyle; break; case 5: numArray3[0] = 73; numArray3[1] = 74; numArray3[2] = 75; numArray3[3] = 76; numArray3[4] = 131 + Main.hellBackStyle; break; case 6: numArray3[0] = 77; numArray3[1] = 78; numArray3[2] = 79; numArray3[3] = 80; numArray3[4] = 134 + Main.hellBackStyle; break; case 7: numArray3[0] = 77; numArray3[1] = 81; numArray3[2] = 79; numArray3[3] = 82; numArray3[4] = 134 + Main.hellBackStyle; break; case 8: numArray3[0] = 83; numArray3[1] = 84; numArray3[2] = 85; numArray3[3] = 86; numArray3[4] = 137 + Main.hellBackStyle; break; case 9: numArray3[0] = 83; numArray3[1] = 87; numArray3[2] = 88; numArray3[3] = 89; numArray3[4] = 137 + Main.hellBackStyle; break; case 10: numArray3[0] = 121; numArray3[1] = 122; numArray3[2] = 123; numArray3[3] = 124; numArray3[4] = 140 + Main.hellBackStyle; break; case 11: if (Main.jungleBackStyle == 0) { numArray3[0] = 153; numArray3[1] = 147; numArray3[2] = 148; numArray3[3] = 149; numArray3[4] = 150 + Main.hellBackStyle; break; } numArray3[0] = 146; numArray3[1] = 154; numArray3[2] = 155; numArray3[3] = 156; numArray3[4] = 157 + Main.hellBackStyle; break; default: if (undergroundBackground >= 12 && undergroundBackground <= 14) { numArray3[0] = 66; numArray3[1] = 67; numArray3[2] = 68; numArray3[4] = 128 + Main.hellBackStyle; switch (undergroundBackground) { case 12: numArray3[3] = 193 + Main.worldID % 4; break; case 13: numArray3[3] = 188 + Main.worldID % 5; break; case 14: numArray3[3] = 197 + Main.worldID % 3; break; } } else if (undergroundBackground >= 15 && undergroundBackground <= 17) { numArray3[0] = 40; numArray3[1] = 33; numArray3[2] = 34; numArray3[4] = 128 + Main.hellBackStyle; switch (undergroundBackground) { case 15: numArray3[3] = 200; break; case 16: numArray3[3] = 201 + Main.worldID % 2; break; case 17: numArray3[3] = 203 + Main.worldID % 4; break; } } else { switch (undergroundBackground) { case 18: numArray3[0] = 290; numArray3[1] = 291; break; case 19: numArray3[0] = 292; numArray3[1] = 293; break; case 20: numArray3[0] = 294; numArray3[1] = 295; break; case 21: numArray3[0] = 296; numArray3[1] = 297; break; } } break; } if (Main.hellBackStyle == 0) numArray3[5] = 125; if (Main.hellBackStyle == 1) numArray3[5] = 126; if (Main.hellBackStyle == 2) numArray3[5] = (int) sbyte.MaxValue; numArray3[6] = 185 + Main.hellBackStyle; this.LoadBackground(numArray3[0]); this.LoadBackground(numArray3[1]); this.LoadBackground(numArray3[2]); this.LoadBackground(numArray3[3]); this.LoadBackground(numArray3[4]); this.LoadBackground(numArray3[5]); this.LoadBackground(numArray3[6]); if (index1 == 0) { for (int index2 = 0; index2 < 7; ++index2) numArray1[index2] = numArray3[index2]; } else { for (int index3 = 0; index3 < 7; ++index3) numArray2[index3] = numArray3[index3]; } } float num9 = (float) (1.20000004768372 - 0.200000002980232 * (double) num6); float x1 = vector3.X; float y1 = vector3.Y; float z = vector3.Z; int num10 = TextureAssets.Background[numArray1[0]].Width() - 32; this.bgParallax = (double) Main.caveParallax; this.bgStartX = (int) (-Math.IEEERemainder((double) num10 + (double) Main.screenPosition.X * this.bgParallax, (double) num10) - (double) (num10 / 2)) - (int) vector2.X; this.bgLoops = (Main.screenWidth + (int) vector2.X * 2) / num10 + 2; this.bgTopY = (int) ((double) ((int) Main.worldSurface * 16 - 16) - (double) Main.screenPosition.Y + 16.0); for (int index4 = 0; index4 < this.bgLoops; ++index4) { for (int index5 = 0; index5 < num10 / 16; ++index5) { int num11 = (int) (float) Math.Round(-Math.IEEERemainder((double) this.bgStartX + (double) Main.screenPosition.X, 16.0)); if (num11 == -8) num11 = 8; double num12 = (double) (this.bgStartX + num10 * index4 + index5 * 16 + 8); float bgTopY = (float) this.bgTopY; double x2 = (double) Main.screenPosition.X; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) ((num12 + x2) / 16.0), (int) (((double) Main.screenPosition.Y + (double) bgTopY) / 16.0)); color.R = (byte) ((double) color.R * (double) x1); color.G = (byte) ((double) color.G * (double) y1); color.B = (byte) ((double) color.B * (double) z); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[0]].Value, new Vector2((float) (this.bgStartX + num10 * index4 + 16 * index5 + num11), (float) this.bgTopY) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index5 + num11 + 16, 0, 16, 16)), color); } } if ((double) Main.ugBackTransition > 0.0) { num10 = TextureAssets.Background[numArray2[0]].Width() - 32; this.bgStartX = (int) (-Math.IEEERemainder((double) num10 + (double) Main.screenPosition.X * this.bgParallax, (double) num10) - (double) (num10 / 2)) - (int) vector2.X; this.bgLoops = (Main.screenWidth + (int) vector2.X * 2) / num10 + 2; for (int index6 = 0; index6 < this.bgLoops; ++index6) { for (int index7 = 0; index7 < num10 / 16; ++index7) { int num13 = (int) (float) Math.Round(-Math.IEEERemainder((double) this.bgStartX + (double) Main.screenPosition.X, 16.0)); if (num13 == -8) num13 = 8; double num14 = (double) (this.bgStartX + num10 * index6 + index7 * 16 + 8); float bgTopY = (float) this.bgTopY; double x3 = (double) Main.screenPosition.X; Microsoft.Xna.Framework.Color color1 = Lighting.GetColor((int) ((num14 + x3) / 16.0), (int) (((double) Main.screenPosition.Y + (double) bgTopY) / 16.0)); color1.R = (byte) ((double) color1.R * (double) x1); color1.G = (byte) ((double) color1.G * (double) y1); color1.B = (byte) ((double) color1.B * (double) z); Microsoft.Xna.Framework.Color color2 = color1; color2.R = (byte) ((double) color2.R * (double) Main.ugBackTransition); color2.G = (byte) ((double) color2.G * (double) Main.ugBackTransition); color2.B = (byte) ((double) color2.B * (double) Main.ugBackTransition); color2.A = (byte) ((double) color2.A * (double) Main.ugBackTransition); Main.spriteBatch.Draw(TextureAssets.Background[numArray2[0]].Value, new Vector2((float) (this.bgStartX + num10 * index6 + 16 * index7 + num13), (float) this.bgTopY) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index7 + num13 + 16, 0, 16, 16)), color2); } } } bool flag1 = false; bool flag2 = false; this.bgTopY = (int) ((double) ((int) Main.worldSurface * 16) - (double) Main.screenPosition.Y + 16.0); if (Main.worldSurface * 16.0 <= (double) Main.screenPosition.Y + (double) Main.screenHeight + (double) Main.offScreenRange) { this.bgParallax = (double) Main.caveParallax; int num15 = TextureAssets.Background[numArray1[1]].Width() - 32; this.bgStartX = (int) (-Math.IEEERemainder((double) num15 + (double) Main.screenPosition.X * this.bgParallax, (double) num15) - (double) (num15 / 2)) - (int) vector2.X; this.bgLoops = (Main.screenWidth + (int) vector2.X * 2) / num15 + 2; if (Main.worldSurface * 16.0 < (double) Main.screenPosition.Y - 16.0) { this.bgStartY = (int) (Math.IEEERemainder((double) this.bgTopY, (double) Main.backgroundHeight[2]) - (double) Main.backgroundHeight[2]); this.bgLoopsY = (Main.screenHeight - this.bgStartY + (int) vector2.Y * 2) / Main.backgroundHeight[2] + 1; } else { this.bgStartY = this.bgTopY; this.bgLoopsY = (Main.screenHeight - this.bgTopY + (int) vector2.Y * 2) / Main.backgroundHeight[2] + 1; } if (Main.rockLayer * 16.0 < (double) Main.Camera.ScaledPosition.Y + 600.0) { this.bgLoopsY = (int) (Main.rockLayer * 16.0 - (double) Main.screenPosition.Y + 600.0 - (double) this.bgStartY) / Main.backgroundHeight[2]; flag2 = true; } int num16 = (int) (float) Math.Round(-Math.IEEERemainder((double) this.bgStartX + (double) Main.screenPosition.X, 16.0)); if (num16 == -8) num16 = 8; for (int index8 = 0; index8 < this.bgLoops; ++index8) { for (int index9 = 0; index9 < this.bgLoopsY; ++index9) { for (int index10 = 0; index10 < num15 / 16; ++index10) { for (int index11 = 0; index11 < 6; ++index11) { double num17 = (double) (this.bgStartY + index9 * 96 + index11 * 16 + 8); int index12 = (int) (((double) (this.bgStartX + num15 * index8 + index10 * 16 + 8) + (double) Main.screenPosition.X) / 16.0); double y2 = (double) Main.screenPosition.Y; int index13 = (int) ((num17 + y2) / 16.0); Microsoft.Xna.Framework.Color color3 = Lighting.GetColor(index12, index13); if (WorldGen.InWorld(index12, index13)) { if (Main.tile[index12, index13] == null) Main.tile[index12, index13] = new Tile(); if (color3.R > (byte) 0 || color3.G > (byte) 0 || color3.B > (byte) 0) { if (!Main.drawToScreen) { VertexColors vertices; Lighting.GetCornerColors(index12, index13, out vertices); vertices.BottomLeftColor = new Microsoft.Xna.Framework.Color(vertices.BottomLeftColor.ToVector3() * vector3); vertices.BottomRightColor = new Microsoft.Xna.Framework.Color(vertices.BottomRightColor.ToVector3() * vector3); Main.tileBatch.Draw(TextureAssets.Background[numArray1[1]].Value, new Vector2((float) (this.bgStartX + num15 * index8 + 16 * index10 + num16), (float) (this.bgStartY + Main.backgroundHeight[numArray2[1]] * index9 + 16 * index11)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index10 + num16 + 16, 16 * index11, 16, 16)), vertices, Vector2.Zero, 1f, SpriteEffects.None); } else if (((int) color3.R > num3 || (double) color3.G > (double) num3 * 1.1 || (double) color3.B > (double) num3 * 1.2) && !Main.tile[index12, index13].active() && Main.wallLight[(int) Main.tile[index12, index13].wall] && (double) Main.ugBackTransition == 0.0) { Lighting.GetColor9Slice(index12, index13, ref slices); try { for (int index14 = 0; index14 < 9; ++index14) { int num18 = 0; int num19 = 0; int width = 4; int height = 4; Microsoft.Xna.Framework.Color color4 = color3; Microsoft.Xna.Framework.Color color5 = color3; switch (index14) { case 0: if (!Main.tile[index12 - 1, index13 - 1].active()) { color5 = slices[index14]; break; } break; case 1: width = 8; num18 = 4; if (!Main.tile[index12, index13 - 1].active()) { color5 = slices[index14]; break; } break; case 2: num18 = 12; if (!Main.tile[index12 + 1, index13 - 1].active()) { color5 = slices[index14]; break; } break; case 3: height = 8; num19 = 4; if (!Main.tile[index12 - 1, index13].active()) { color5 = slices[index14]; break; } break; case 4: width = 8; height = 8; num18 = 4; num19 = 4; break; case 5: num18 = 12; num19 = 4; height = 8; if (!Main.tile[index12 + 1, index13].active()) { color5 = slices[index14]; break; } break; case 6: num19 = 12; if (!Main.tile[index12 - 1, index13 + 1].active()) { color5 = slices[index14]; break; } break; case 7: width = 8; height = 4; num18 = 4; num19 = 12; if (!Main.tile[index12, index13 + 1].active()) { color5 = slices[index14]; break; } break; case 8: num18 = 12; num19 = 12; if (!Main.tile[index12 + 1, index13 + 1].active()) { color5 = slices[index14]; break; } break; } color4.R = (byte) (((int) color3.R + (int) color5.R) / 2); color4.G = (byte) (((int) color3.G + (int) color5.G) / 2); color4.B = (byte) (((int) color3.B + (int) color5.B) / 2); color4.R = (byte) ((double) color4.R * (double) x1); color4.G = (byte) ((double) color4.G * (double) y1); color4.B = (byte) ((double) color4.B * (double) z); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[1]].Value, new Vector2((float) (this.bgStartX + num15 * index8 + 16 * index10 + num18 + num16), (float) (this.bgStartY + Main.backgroundHeight[numArray1[1]] * index9 + 16 * index11 + num19)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index10 + num18 + num16 + 16, 16 * index11 + num19, width, height)), color4); if ((double) Main.ugBackTransition > 0.0) { Microsoft.Xna.Framework.Color color6 = color4; color6.R = (byte) ((double) color6.R * (double) Main.ugBackTransition); color6.G = (byte) ((double) color6.G * (double) Main.ugBackTransition); color6.B = (byte) ((double) color6.B * (double) Main.ugBackTransition); color6.A = (byte) ((double) color6.A * (double) Main.ugBackTransition); Main.spriteBatch.Draw(TextureAssets.Background[numArray2[1]].Value, new Vector2((float) (this.bgStartX + num15 * index8 + 16 * index10 + num18 + num16), (float) (this.bgStartY + Main.backgroundHeight[numArray2[1]] * index9 + 16 * index11 + num19)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index10 + num18 + num16 + 16, 16 * index11 + num19, width, height)), color6); } } } catch { color3.R = (byte) ((double) color3.R * (double) x1); color3.G = (byte) ((double) color3.G * (double) y1); color3.B = (byte) ((double) color3.B * (double) z); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[1]].Value, new Vector2((float) (this.bgStartX + num15 * index8 + 16 * index10 + num16), (float) (this.bgStartY + Main.backgroundHeight[numArray1[1]] * index9 + 16 * index11)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index10 + num16 + 16, 16 * index11, 16, 16)), color3); } } else if (((int) color3.R > num4 || (double) color3.G > (double) num4 * 1.1 || (double) color3.B > (double) num4 * 1.2) && (double) Main.ugBackTransition == 0.0) { Lighting.GetColor4Slice(index12, index13, ref slices); for (int index15 = 0; index15 < 4; ++index15) { int num20 = 0; int num21 = 0; Microsoft.Xna.Framework.Color color7 = color3; Microsoft.Xna.Framework.Color color8 = slices[index15]; switch (index15 - 1) { case 0: num20 = 8; break; case 1: num21 = 8; break; case 2: num20 = 8; num21 = 8; break; } color7.R = (byte) (((int) color3.R + (int) color8.R) / 2); color7.G = (byte) (((int) color3.G + (int) color8.G) / 2); color7.B = (byte) (((int) color3.B + (int) color8.B) / 2); color7.R = (byte) ((double) color7.R * (double) x1); color7.G = (byte) ((double) color7.G * (double) y1); color7.B = (byte) ((double) color7.B * (double) z); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[1]].Value, new Vector2((float) (this.bgStartX + num15 * index8 + 16 * index10 + num20 + num16), (float) (this.bgStartY + Main.backgroundHeight[numArray1[1]] * index9 + 16 * index11 + num21)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index10 + num20 + num16 + 16, 16 * index11 + num21, 8, 8)), color7); if ((double) Main.ugBackTransition > 0.0) { Microsoft.Xna.Framework.Color color9 = color7; color9.R = (byte) ((double) color9.R * (double) Main.ugBackTransition); color9.G = (byte) ((double) color9.G * (double) Main.ugBackTransition); color9.B = (byte) ((double) color9.B * (double) Main.ugBackTransition); color9.A = (byte) ((double) color9.A * (double) Main.ugBackTransition); Main.spriteBatch.Draw(TextureAssets.Background[numArray2[1]].Value, new Vector2((float) (this.bgStartX + num15 * index8 + 16 * index10 + num20 + num16), (float) (this.bgStartY + Main.backgroundHeight[numArray2[1]] * index9 + 16 * index11 + num21)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index10 + num20 + num16 + 16, 16 * index11 + num21, 8, 8)), color9); } } } else { color3.R = (byte) ((double) color3.R * (double) x1); color3.G = (byte) ((double) color3.G * (double) y1); color3.B = (byte) ((double) color3.B * (double) z); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[1]].Value, new Vector2((float) (this.bgStartX + num15 * index8 + 16 * index10 + num16), (float) (this.bgStartY + Main.backgroundHeight[numArray1[1]] * index9 + 16 * index11)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index10 + num16 + 16, 16 * index11, 16, 16)), color3); if ((double) Main.ugBackTransition > 0.0) { Microsoft.Xna.Framework.Color color10 = color3; color10.R = (byte) ((double) color10.R * (double) Main.ugBackTransition); color10.G = (byte) ((double) color10.G * (double) Main.ugBackTransition); color10.B = (byte) ((double) color10.B * (double) Main.ugBackTransition); color10.A = (byte) ((double) color10.A * (double) Main.ugBackTransition); Main.spriteBatch.Draw(TextureAssets.Background[numArray2[1]].Value, new Vector2((float) (this.bgStartX + num15 * index8 + 16 * index10 + num16), (float) (this.bgStartY + Main.backgroundHeight[numArray2[1]] * index9 + 16 * index11)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index10 + num16 + 16, 16 * index11, 16, 16)), color10); } } } else { color3.R = (byte) ((double) color3.R * (double) x1); color3.G = (byte) ((double) color3.G * (double) y1); color3.B = (byte) ((double) color3.B * (double) z); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[1]].Value, new Vector2((float) (this.bgStartX + num15 * index8 + 16 * index10 + num16), (float) (this.bgStartY + Main.backgroundHeight[numArray1[1]] * index9 + 16 * index11)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index10 + num16 + 16, 16 * index11, 16, 16)), color3); } } } } } } if ((double) Main.ugBackTransition > 0.0) { int num22 = TextureAssets.Background[numArray2[1]].Width() - 32; this.bgStartX = (int) (-Math.IEEERemainder((double) num22 + (double) Main.screenPosition.X * this.bgParallax, (double) num22) - (double) (num22 / 2)) - (int) vector2.X; this.bgLoops = (Main.screenWidth + (int) vector2.X * 2) / num22 + 2; num16 = (int) (float) Math.Round(-Math.IEEERemainder((double) this.bgStartX + (double) Main.screenPosition.X, 16.0)); if (num16 == -8) num16 = 8; for (int index16 = 0; index16 < this.bgLoops; ++index16) { for (int index17 = 0; index17 < this.bgLoopsY; ++index17) { for (int index18 = 0; index18 < num22 / 16; ++index18) { for (int index19 = 0; index19 < 6; ++index19) { double num23 = (double) (this.bgStartY + index17 * 96 + index19 * 16 + 8); int index20 = (int) (((double) (this.bgStartX + num22 * index16 + index18 * 16 + 8) + (double) Main.screenPosition.X) / 16.0); double y3 = (double) Main.screenPosition.Y; int index21 = (int) ((num23 + y3) / 16.0); if (WorldGen.InWorld(index20, index21)) { Microsoft.Xna.Framework.Color color = Lighting.GetColor(index20, index21); if (Main.tile[index20, index21] == null) Main.tile[index20, index21] = new Tile(); if (color.R > (byte) 0 || color.G > (byte) 0 || color.B > (byte) 0) { VertexColors vertices; Lighting.GetCornerColors(index20, index21, out vertices, Main.ugBackTransition); byte num24 = (byte) ((double) byte.MaxValue * (double) Main.ugBackTransition); vertices.BottomLeftColor.A = num24; vertices.BottomRightColor.A = num24; vertices.TopLeftColor.A = num24; vertices.TopRightColor.A = num24; Main.tileBatch.Draw(TextureAssets.Background[numArray2[1]].Value, new Vector2((float) (this.bgStartX + num22 * index16 + 16 * index18 + num16), (float) (this.bgStartY + Main.backgroundHeight[numArray2[1]] * index17 + 16 * index19)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index18 + num16 + 16, 16 * index19, 16, 16)), vertices, Vector2.Zero, 1f, SpriteEffects.None); } } } } } } } num10 = 128; if (flag2) { this.bgParallax = (double) Main.caveParallax; this.bgStartX = (int) (-Math.IEEERemainder((double) num10 + (double) Main.screenPosition.X * this.bgParallax, (double) num10) - (double) (num10 / 2)) - (int) vector2.X; this.bgLoops = (Main.screenWidth + (int) vector2.X * 2) / num10 + 2; this.bgTopY = this.bgStartY + this.bgLoopsY * Main.backgroundHeight[2]; if (this.bgTopY > -32) { for (int index22 = 0; index22 < this.bgLoops; ++index22) { for (int index23 = 0; index23 < num10 / 16; ++index23) { double num25 = (double) (this.bgStartX + num10 * index22 + index23 * 16 + 8); float bgTopY = (float) this.bgTopY; double x4 = (double) Main.screenPosition.X; Microsoft.Xna.Framework.Color color11 = Lighting.GetColor((int) ((num25 + x4) / 16.0), (int) (((double) Main.screenPosition.Y + (double) bgTopY) / 16.0)); color11.R = (byte) ((double) color11.R * (double) x1); color11.G = (byte) ((double) color11.G * (double) y1); color11.B = (byte) ((double) color11.B * (double) z); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[2]].Value, new Vector2((float) (this.bgStartX + num10 * index22 + 16 * index23 + num16), (float) this.bgTopY) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index23 + num16 + 16, 0, 16, 16)), color11); if ((double) Main.ugBackTransition > 0.0) { Microsoft.Xna.Framework.Color color12 = color11; color12.R = (byte) ((double) color12.R * (double) Main.ugBackTransition); color12.G = (byte) ((double) color12.G * (double) Main.ugBackTransition); color12.B = (byte) ((double) color12.B * (double) Main.ugBackTransition); color12.A = (byte) ((double) color12.A * (double) Main.ugBackTransition); Main.spriteBatch.Draw(TextureAssets.Background[numArray2[2]].Value, new Vector2((float) (this.bgStartX + num10 * index22 + 16 * index23 + num16), (float) this.bgTopY) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index23 + num16 + 16, 0, 16, 16)), color12); } } } } } } if (num2 * 16.0 <= (double) Main.screenPosition.Y + (double) Main.screenHeight) { int y4 = 0; int x5 = 0; int height = Main.screenHeight + 200; int width = Main.screenWidth + 100; if ((double) Main.UnderworldLayer * 16.0 < (double) Main.screenPosition.Y + (double) Main.screenHeight) { int num26 = (int) ((double) this.hellBlackBoxBottom - (double) Main.screenPosition.Y + (double) vector2.Y); if (height > num26) height = num26; } Main.spriteBatch.Draw(TextureAssets.BlackTile.Value, new Microsoft.Xna.Framework.Rectangle(x5, y4, width, height), new Microsoft.Xna.Framework.Color(0, 0, 0)); } this.hellBlackBoxBottom = (float) ((double) Main.screenPosition.Y + (double) Main.screenHeight + 100.0); this.bgTopY = (int) ((double) ((int) Main.rockLayer * 16) - (double) Main.screenPosition.Y + 16.0 + 600.0 - 8.0); if (Main.rockLayer * 16.0 <= (double) Main.screenPosition.Y + (double) Main.screenHeight) { this.bgParallax = (double) Main.caveParallax; this.bgStartX = (int) (-Math.IEEERemainder((double) num10 + (double) Main.screenPosition.X * this.bgParallax, (double) num10) - (double) (num10 / 2)) - (int) vector2.X; this.bgLoops = (Main.screenWidth + (int) vector2.X * 2) / num10 + 2; if (Main.rockLayer * 16.0 + (double) Main.screenHeight < (double) Main.screenPosition.Y - 16.0) { this.bgStartY = (int) (Math.IEEERemainder((double) this.bgTopY, (double) Main.backgroundHeight[3]) - (double) Main.backgroundHeight[3]); this.bgLoopsY = (Main.screenHeight - this.bgStartY + (int) vector2.Y * 2) / Main.backgroundHeight[2] + 1; } else { this.bgStartY = this.bgTopY; this.bgLoopsY = (Main.screenHeight - this.bgTopY + (int) vector2.Y * 2) / Main.backgroundHeight[2] + 1; } if (num2 * 16.0 < (double) Main.screenPosition.Y + (double) Main.screenHeight) { this.bgLoopsY = (int) (num2 * 16.0 - (double) Main.screenPosition.Y + 600.0 - (double) this.bgStartY) / Main.backgroundHeight[2]; flag1 = true; } int num27 = (int) (float) Math.Round(-Math.IEEERemainder((double) this.bgStartX + (double) Main.screenPosition.X, 16.0)); if (num27 == -8) num27 = 8; for (int index24 = 0; index24 < this.bgLoops; ++index24) { for (int index25 = 0; index25 < this.bgLoopsY; ++index25) { for (int index26 = 0; index26 < num10 / 16; ++index26) { for (int index27 = 0; index27 < 6; ++index27) { double num28 = (double) (this.bgStartY + index25 * 96 + index27 * 16 + 8); int index28 = (int) (((double) (this.bgStartX + num10 * index24 + index26 * 16 + 8) + (double) Main.screenPosition.X) / 16.0); double y5 = (double) Main.screenPosition.Y; int index29 = (int) ((num28 + y5) / 16.0); if (WorldGen.InWorld(index28, index29, 1)) { Microsoft.Xna.Framework.Color color13 = Lighting.GetColor(index28, index29); if (Main.tile[index28, index29] == null) Main.tile[index28, index29] = new Tile(); bool flag3 = false; if ((double) Main.caveParallax != 0.0) { if (Main.tile[index28 - 1, index29] == null) Main.tile[index28 - 1, index29] = new Tile(); if (Main.tile[index28 + 1, index29] == null) Main.tile[index28 + 1, index29] = new Tile(); if (Main.wallLight[(int) Main.tile[index28, index29].wall] || Main.wallLight[(int) Main.tile[index28 - 1, index29].wall] || Main.wallLight[(int) Main.tile[index28 + 1, index29].wall]) flag3 = true; } else if (Main.wallLight[(int) Main.tile[index28, index29].wall]) flag3 = true; if ((flag3 || color13.R == (byte) 0 || color13.G == (byte) 0 || color13.B == (byte) 0) && (color13.R > (byte) 0 || color13.G > (byte) 0 || color13.B > (byte) 0) && (Main.wallLight[(int) Main.tile[index28, index29].wall] || (double) Main.caveParallax != 0.0)) { if (Lighting.NotRetro && color13.R < (byte) 230 && color13.G < (byte) 230 && color13.B < (byte) 230 && (double) Main.ugBackTransition == 0.0) { if (((int) color13.R > num3 || (double) color13.G > (double) num3 * 1.1 || (double) color13.B > (double) num3 * 1.2) && !Main.tile[index28, index29].active()) { Lighting.GetColor9Slice(index28, index29, ref slices); for (int index30 = 0; index30 < 9; ++index30) { int num29 = 0; int num30 = 0; int width = 4; int height = 4; Microsoft.Xna.Framework.Color color14 = color13; Microsoft.Xna.Framework.Color color15 = color13; switch (index30) { case 0: if (!Main.tile[index28 - 1, index29 - 1].active()) { color15 = slices[index30]; break; } break; case 1: width = 8; num29 = 4; if (!Main.tile[index28, index29 - 1].active()) { color15 = slices[index30]; break; } break; case 2: num29 = 12; if (!Main.tile[index28 + 1, index29 - 1].active()) { color15 = slices[index30]; break; } break; case 3: height = 8; num30 = 4; if (!Main.tile[index28 - 1, index29].active()) { color15 = slices[index30]; break; } break; case 4: width = 8; height = 8; num29 = 4; num30 = 4; break; case 5: num29 = 12; num30 = 4; height = 8; if (!Main.tile[index28 + 1, index29].active()) { color15 = slices[index30]; break; } break; case 6: num30 = 12; if (!Main.tile[index28 - 1, index29 + 1].active()) { color15 = slices[index30]; break; } break; case 7: width = 8; height = 4; num29 = 4; num30 = 12; if (!Main.tile[index28, index29 + 1].active()) { color15 = slices[index30]; break; } break; case 8: num29 = 12; num30 = 12; if (!Main.tile[index28 + 1, index29 + 1].active()) { color15 = slices[index30]; break; } break; } color14.R = (byte) (((int) color13.R + (int) color15.R) / 2); color14.G = (byte) (((int) color13.G + (int) color15.G) / 2); color14.B = (byte) (((int) color13.B + (int) color15.B) / 2); color14.R = (byte) ((double) color14.R * (double) x1); color14.G = (byte) ((double) color14.G * (double) y1); color14.B = (byte) ((double) color14.B * (double) z); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[3]].Value, new Vector2((float) (this.bgStartX + num10 * index24 + 16 * index26 + num29 + num27), (float) (this.bgStartY + Main.backgroundHeight[numArray1[3]] * index25 + 16 * index27 + num30)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index26 + num29 + num27 + 16, 16 * index27 + num30, width, height)), color14); if ((double) Main.ugBackTransition > 0.0) { Microsoft.Xna.Framework.Color color16 = color14; color16.R = (byte) ((double) color16.R * (double) Main.ugBackTransition); color16.G = (byte) ((double) color16.G * (double) Main.ugBackTransition); color16.B = (byte) ((double) color16.B * (double) Main.ugBackTransition); color16.A = (byte) ((double) color16.A * (double) Main.ugBackTransition); Main.spriteBatch.Draw(TextureAssets.Background[numArray2[3]].Value, new Vector2((float) (this.bgStartX + num10 * index24 + 16 * index26 + num29 + num27), (float) (this.bgStartY + Main.backgroundHeight[numArray2[3]] * index25 + 16 * index27 + num30)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index26 + num29 + num27 + 16, 16 * index27 + num30, width, height)), color16); } } } else if ((int) color13.R > num4 || (double) color13.G > (double) num4 * 1.1 || (double) color13.B > (double) num4 * 1.2) { Lighting.GetColor4Slice(index28, index29, ref slices); for (int index31 = 0; index31 < 4; ++index31) { int num31 = 0; int num32 = 0; Microsoft.Xna.Framework.Color color17 = color13; Microsoft.Xna.Framework.Color color18 = slices[index31]; switch (index31 - 1) { case 0: num31 = 8; break; case 1: num32 = 8; break; case 2: num31 = 8; num32 = 8; break; } color17.R = (byte) (((int) color13.R + (int) color18.R) / 2); color17.G = (byte) (((int) color13.G + (int) color18.G) / 2); color17.B = (byte) (((int) color13.B + (int) color18.B) / 2); color17.R = (byte) ((double) color17.R * (double) x1); color17.G = (byte) ((double) color17.G * (double) y1); color17.B = (byte) ((double) color17.B * (double) z); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[3]].Value, new Vector2((float) (this.bgStartX + num10 * index24 + 16 * index26 + num31 + num27), (float) (this.bgStartY + Main.backgroundHeight[numArray1[3]] * index25 + 16 * index27 + num32)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index26 + num31 + num27 + 16, 16 * index27 + num32, 8, 8)), color17); if ((double) Main.ugBackTransition > 0.0) { Microsoft.Xna.Framework.Color color19 = color17; color19.R = (byte) ((double) color19.R * (double) Main.ugBackTransition); color19.G = (byte) ((double) color19.G * (double) Main.ugBackTransition); color19.B = (byte) ((double) color19.B * (double) Main.ugBackTransition); color19.A = (byte) ((double) color19.A * (double) Main.ugBackTransition); Main.spriteBatch.Draw(TextureAssets.Background[numArray2[3]].Value, new Vector2((float) (this.bgStartX + num10 * index24 + 16 * index26 + num31 + num27), (float) (this.bgStartY + Main.backgroundHeight[numArray2[3]] * index25 + 16 * index27 + num32)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index26 + num31 + num27 + 16, 16 * index27 + num32, 8, 8)), color19); } } } else { color13.R = (byte) ((double) color13.R * (double) x1); color13.G = (byte) ((double) color13.G * (double) y1); color13.B = (byte) ((double) color13.B * (double) z); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[3]].Value, new Vector2((float) (this.bgStartX + num10 * index24 + 16 * index26 + num27), (float) (this.bgStartY + Main.backgroundHeight[numArray1[3]] * index25 + 16 * index27)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index26 + num27 + 16, 16 * index27, 16, 16)), color13); if ((double) Main.ugBackTransition > 0.0) { Microsoft.Xna.Framework.Color color20 = color13; color20.R = (byte) ((double) color20.R * (double) Main.ugBackTransition); color20.G = (byte) ((double) color20.G * (double) Main.ugBackTransition); color20.B = (byte) ((double) color20.B * (double) Main.ugBackTransition); color20.A = (byte) ((double) color20.A * (double) Main.ugBackTransition); Main.spriteBatch.Draw(TextureAssets.Background[numArray2[3]].Value, new Vector2((float) (this.bgStartX + num10 * index24 + 16 * index26 + num27), (float) (this.bgStartY + Main.backgroundHeight[numArray2[3]] * index25 + 16 * index27)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index26 + num27 + 16, 16 * index27, 16, 16)), color20); } } } else { color13.R = (byte) ((double) color13.R * (double) x1); color13.G = (byte) ((double) color13.G * (double) y1); color13.B = (byte) ((double) color13.B * (double) z); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[3]].Value, new Vector2((float) (this.bgStartX + num10 * index24 + 16 * index26 + num27), (float) (this.bgStartY + Main.backgroundHeight[numArray1[3]] * index25 + 16 * index27)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index26 + num27 + 16, 16 * index27, 16, 16)), color13); if ((double) Main.ugBackTransition > 0.0) { Microsoft.Xna.Framework.Color color21 = color13; color21.R = (byte) ((double) color21.R * (double) Main.ugBackTransition); color21.G = (byte) ((double) color21.G * (double) Main.ugBackTransition); color21.B = (byte) ((double) color21.B * (double) Main.ugBackTransition); color21.A = (byte) ((double) color21.A * (double) Main.ugBackTransition); Main.spriteBatch.Draw(TextureAssets.Background[numArray2[3]].Value, new Vector2((float) (this.bgStartX + num10 * index24 + 16 * index26 + num27), (float) (this.bgStartY + Main.backgroundHeight[numArray2[3]] * index25 + 16 * index27)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index26 + num27 + 16, 16 * index27, 16, 16)), color21); } } } } } } } } num10 = 128; if (flag1) { this.bgParallax = (double) Main.caveParallax; this.bgStartX = (int) (-Math.IEEERemainder((double) num10 + (double) Main.screenPosition.X * this.bgParallax, (double) num10) - (double) (num10 / 2)) - (int) vector2.X; this.bgLoops = (Main.screenWidth + (int) vector2.X * 2) / num10 + 2; this.bgTopY = this.bgStartY + this.bgLoopsY * Main.backgroundHeight[2]; for (int index32 = 0; index32 < this.bgLoops; ++index32) { for (int index33 = 0; index33 < num10 / 16; ++index33) { double num33 = (double) (this.bgStartX + num10 * index32 + index33 * 16 + 8); float bgTopY = (float) this.bgTopY; double x6 = (double) Main.screenPosition.X; Microsoft.Xna.Framework.Color color22 = Lighting.GetColor((int) ((num33 + x6) / 16.0), (int) (((double) Main.screenPosition.Y + (double) bgTopY) / 16.0)); color22.R = (byte) ((double) color22.R * (double) x1); color22.G = (byte) ((double) color22.G * (double) y1); color22.B = (byte) ((double) color22.B * (double) z); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[4]].Value, new Vector2((float) (this.bgStartX + num10 * index32 + 16 * index33 + num27), (float) this.bgTopY) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index33 + num27 + 16, Main.magmaBGFrame * 16, 16, 16)), color22); if ((double) Main.ugBackTransition > 0.0) { Microsoft.Xna.Framework.Color color23 = color22; color23.R = (byte) ((double) color23.R * (double) Main.ugBackTransition); color23.G = (byte) ((double) color23.G * (double) Main.ugBackTransition); color23.B = (byte) ((double) color23.B * (double) Main.ugBackTransition); color23.A = (byte) ((double) color23.A * (double) Main.ugBackTransition); Main.spriteBatch.Draw(TextureAssets.Background[numArray2[4]].Value, new Vector2((float) (this.bgStartX + num10 * index32 + 16 * index33 + num27), (float) this.bgTopY) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index33 + num27 + 16, Main.magmaBGFrame * 16, 16, 16)), color23); } } } } } this.bgTopY = (int) ((double) ((int) num2 * 16) - (double) Main.screenPosition.Y + 16.0 + 600.0) - 8; bool flag4 = false; if (num2 * 16.0 <= (double) Main.screenPosition.Y + (double) Main.screenHeight) { this.bgStartX = (int) (-Math.IEEERemainder((double) num10 + (double) Main.screenPosition.X * this.bgParallax, (double) num10) - (double) (num10 / 2)) - (int) vector2.X; this.bgLoops = (Main.screenWidth + (int) vector2.X * 2) / num10 + 2; if (num2 * 16.0 + (double) Main.screenHeight < (double) Main.screenPosition.Y - 16.0) { this.bgStartY = (int) (Math.IEEERemainder((double) this.bgTopY, (double) Main.backgroundHeight[2]) - (double) Main.backgroundHeight[2]); this.bgLoopsY = (Main.screenHeight - this.bgStartY + (int) vector2.Y * 2) / Main.backgroundHeight[2] + 1; } else { this.bgStartY = this.bgTopY; this.bgLoopsY = (Main.screenHeight - this.bgTopY + (int) vector2.Y * 2) / Main.backgroundHeight[2] + 1; } if ((double) Main.UnderworldLayer * 16.0 < (double) Main.screenPosition.Y + (double) Main.screenHeight) { this.bgLoopsY = (int) Math.Ceiling(((double) Main.UnderworldLayer * 16.0 - (double) Main.screenPosition.Y - (double) this.bgStartY) / (double) Main.backgroundHeight[2]); flag4 = true; } int num34 = (int) ((double) num3 * 1.5); int num35 = (int) ((double) num4 * 1.5); int num36 = (int) (float) Math.Round(-Math.IEEERemainder((double) this.bgStartX + (double) Main.screenPosition.X, 16.0)); if (num36 == -8) num36 = 8; for (int index34 = 0; index34 < this.bgLoops; ++index34) { for (int index35 = 0; index35 < this.bgLoopsY; ++index35) { for (int index36 = 0; index36 < num10 / 16; ++index36) { for (int index37 = 0; index37 < 6; ++index37) { double num37 = (double) (this.bgStartY + index35 * 96 + index37 * 16 + 8); int index38 = (int) (((double) (this.bgStartX + num10 * index34 + index36 * 16 + 8) + (double) Main.screenPosition.X) / 16.0); double y6 = (double) Main.screenPosition.Y; int index39 = (int) ((num37 + y6) / 16.0); if (WorldGen.InWorld(index38, index39, 1)) { Microsoft.Xna.Framework.Color color24 = Lighting.GetColor(index38, index39); if (Main.tile[index38, index39] == null) Main.tile[index38, index39] = new Tile(); bool flag5 = false; if ((double) Main.caveParallax != 0.0) { if (Main.tile[index38 - 1, index39] == null) Main.tile[index38 - 1, index39] = new Tile(); if (Main.tile[index38 + 1, index39] == null) Main.tile[index38 + 1, index39] = new Tile(); if (Main.wallLight[(int) Main.tile[index38, index39].wall] || Main.wallLight[(int) Main.tile[index38 - 1, index39].wall] || Main.wallLight[(int) Main.tile[index38 + 1, index39].wall]) flag5 = true; } else if (Main.wallLight[(int) Main.tile[index38, index39].wall]) flag5 = true; if ((flag5 || color24.R == (byte) 0 || color24.G == (byte) 0 || color24.B == (byte) 0) && (color24.R > (byte) 0 || color24.G > (byte) 0 || color24.B > (byte) 0 || index39 > Main.maxTilesY - 300) && (Main.wallLight[(int) Main.tile[index38, index39].wall] || (double) Main.caveParallax != 0.0)) { if (Lighting.NotRetro && color24.R < (byte) 230 && color24.G < (byte) 230 && color24.B < (byte) 230) { if (((int) color24.R > num34 || (double) color24.G > (double) num34 * 1.1 || (double) color24.B > (double) num34 * 1.2) && !Main.tile[index38, index39].active()) { Lighting.GetColor9Slice(index38, index39, ref slices); for (int index40 = 0; index40 < 9; ++index40) { int num38 = 0; int num39 = 0; int width = 4; int height = 4; Microsoft.Xna.Framework.Color color25 = color24; Microsoft.Xna.Framework.Color color26 = color24; switch (index40) { case 0: if (!Main.tile[index38 - 1, index39 - 1].active()) { color26 = slices[index40]; break; } break; case 1: width = 8; num38 = 4; if (!Main.tile[index38, index39 - 1].active()) { color26 = slices[index40]; break; } break; case 2: num38 = 12; if (!Main.tile[index38 + 1, index39 - 1].active()) { color26 = slices[index40]; break; } break; case 3: height = 8; num39 = 4; if (!Main.tile[index38 - 1, index39].active()) { color26 = slices[index40]; break; } break; case 4: width = 8; height = 8; num38 = 4; num39 = 4; break; case 5: num38 = 12; num39 = 4; height = 8; if (!Main.tile[index38 + 1, index39].active()) { color26 = slices[index40]; break; } break; case 6: num39 = 12; if (!Main.tile[index38 - 1, index39 + 1].active()) { color26 = slices[index40]; break; } break; case 7: width = 8; height = 4; num38 = 4; num39 = 12; if (!Main.tile[index38, index39 + 1].active()) { color26 = slices[index40]; break; } break; case 8: num38 = 12; num39 = 12; if (!Main.tile[index38 + 1, index39 + 1].active()) { color26 = slices[index40]; break; } break; } color25.R = (byte) (((int) color24.R + (int) color26.R) / 2); color25.G = (byte) (((int) color24.G + (int) color26.G) / 2); color25.B = (byte) (((int) color24.B + (int) color26.B) / 2); color25.R = (byte) ((double) color25.R * (double) x1); color25.G = (byte) ((double) color25.G * (double) y1); color25.B = (byte) ((double) color25.B * (double) z); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[5]].Value, new Vector2((float) (this.bgStartX + num10 * index34 + 16 * index36 + num38 + num36), (float) (this.bgStartY + Main.backgroundHeight[2] * index35 + 16 * index37 + num39)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index36 + num38 + num36 + 16, 16 * index37 + Main.backgroundHeight[2] * Main.magmaBGFrame + num39, width, height)), color25, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } } else if ((int) color24.R > num35 || (double) color24.G > (double) num35 * 1.1 || (double) color24.B > (double) num35 * 1.2) { Lighting.GetColor4Slice(index38, index39, ref slices); for (int index41 = 0; index41 < 4; ++index41) { int num40 = 0; int num41 = 0; Microsoft.Xna.Framework.Color color27 = color24; Microsoft.Xna.Framework.Color color28 = slices[index41]; switch (index41 - 1) { case 0: num40 = 8; break; case 1: num41 = 8; break; case 2: num40 = 8; num41 = 8; break; } color27.R = (byte) (((int) color24.R + (int) color28.R) / 2); color27.G = (byte) (((int) color24.G + (int) color28.G) / 2); color27.B = (byte) (((int) color24.B + (int) color28.B) / 2); color27.R = (byte) ((double) color27.R * (double) x1); color27.G = (byte) ((double) color27.G * (double) y1); color27.B = (byte) ((double) color27.B * (double) z); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[5]].Value, new Vector2((float) (this.bgStartX + num10 * index34 + 16 * index36 + num40 + num36), (float) (this.bgStartY + Main.backgroundHeight[2] * index35 + 16 * index37 + num41)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index36 + num40 + num36 + 16, 16 * index37 + Main.backgroundHeight[2] * Main.magmaBGFrame + num41, 8, 8)), color27, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } } else { color24.R = (byte) ((double) color24.R * (double) x1); color24.G = (byte) ((double) color24.G * (double) y1); color24.B = (byte) ((double) color24.B * (double) z); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[5]].Value, new Vector2((float) (this.bgStartX + num10 * index34 + 16 * index36 + num36), (float) (this.bgStartY + Main.backgroundHeight[2] * index35 + 16 * index37)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index36 + num36 + 16, 16 * index37 + Main.backgroundHeight[2] * Main.magmaBGFrame, 16, 16)), color24, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } } else { color24.R = (byte) ((double) color24.R * (double) x1); color24.G = (byte) ((double) color24.G * (double) y1); color24.B = (byte) ((double) color24.B * (double) z); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[5]].Value, new Vector2((float) (this.bgStartX + num10 * index34 + 16 * index36 + num36), (float) (this.bgStartY + Main.backgroundHeight[2] * index35 + 16 * index37)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index36 + num36 + 16, 16 * index37 + Main.backgroundHeight[2] * Main.magmaBGFrame, 16, 16)), color24, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } } } } } } } if (flag4) { this.bgParallax = (double) Main.caveParallax; this.bgStartX = (int) (-Math.IEEERemainder((double) num10 + (double) Main.screenPosition.X * this.bgParallax, (double) num10) - (double) (num10 / 2)) - (int) vector2.X; this.bgLoops = (Main.screenWidth + (int) vector2.X * 2) / num10 + 2; this.bgTopY = this.bgStartY + this.bgLoopsY * Main.backgroundHeight[2]; this.hellBlackBoxBottom = (float) this.bgTopY + Main.screenPosition.Y; for (int index42 = 0; index42 < this.bgLoops; ++index42) { for (int index43 = 0; index43 < num10 / 16; ++index43) { double num42 = (double) (this.bgStartX + num10 * index42 + index43 * 16 + 8); float bgTopY = (float) this.bgTopY; double x7 = (double) Main.screenPosition.X; Microsoft.Xna.Framework.Color color29 = Lighting.GetColor((int) ((num42 + x7) / 16.0), (int) (((double) Main.screenPosition.Y + (double) bgTopY) / 16.0)); color29.R = (byte) ((double) color29.R * (double) x1); color29.G = (byte) ((double) color29.G * (double) y1); color29.B = (byte) ((double) color29.B * (double) z); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[6]].Value, new Vector2((float) (this.bgStartX + num10 * index42 + 16 * index43 + num36), (float) this.bgTopY) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index43 + num36 + 16, Main.magmaBGFrame * 16, 16, 16)), color29); if ((double) Main.ugBackTransition > 0.0) { Microsoft.Xna.Framework.Color color30 = color29; color30.R = (byte) ((double) color30.R * (double) Main.ugBackTransition); color30.G = (byte) ((double) color30.G * (double) Main.ugBackTransition); color30.B = (byte) ((double) color30.B * (double) Main.ugBackTransition); color30.A = (byte) ((double) color30.A * (double) Main.ugBackTransition); Main.spriteBatch.Draw(TextureAssets.Background[numArray2[6]].Value, new Vector2((float) (this.bgStartX + num10 * index42 + 16 * index43 + num36), (float) this.bgTopY) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index43 + num36 + 16, Main.magmaBGFrame * 16, 16, 16)), color30); } } } } } Lighting.GlobalBrightness = num9; TimeLogger.DrawTime(3, stopwatch.Elapsed.TotalMilliseconds); } } public static Microsoft.Xna.Framework.Point GetScreenOverdrawOffset() => (Main.Camera.ScaledPosition - Main.Camera.UnscaledPosition).ToTileCoordinates(); protected void OldDrawBackground() { Microsoft.Xna.Framework.Color[] slices = new Microsoft.Xna.Framework.Color[9]; Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); int num1 = (int) ((double) byte.MaxValue * (1.0 - (double) Main.gfxQuality) + 140.0 * (double) Main.gfxQuality); int num2 = (int) (200.0 * (1.0 - (double) Main.gfxQuality) + 40.0 * (double) Main.gfxQuality); int num3 = 128; Vector2 vector2 = new Vector2((float) Main.offScreenRange, (float) Main.offScreenRange); if (Main.drawToScreen) vector2 = Vector2.Zero; double num4; float num5 = (float) (num4 = 0.899999976158142); float num6 = (float) num4; float num7 = (float) num4; float num8 = 0.0f; if (Main.SceneMetrics.BloodTileCount > Main.SceneMetrics.EvilTileCount && Main.SceneMetrics.BloodTileCount > Main.SceneMetrics.HolyTileCount) num8 = (float) Main.SceneMetrics.BloodTileCount; else if (Main.SceneMetrics.HolyTileCount > Main.SceneMetrics.EvilTileCount) num8 = (float) Main.SceneMetrics.HolyTileCount; else if (Main.SceneMetrics.EvilTileCount > Main.SceneMetrics.HolyTileCount) num8 = (float) Main.SceneMetrics.EvilTileCount; float num9 = MathHelper.Clamp(num8 / 800f, 0.0f, 1f); float num10 = (Main.screenPosition.Y - (float) (Main.worldSurface * 16.0)) / 300f; if ((double) num10 < 0.0) num10 = 0.0f; else if ((double) num10 > 1.0) num10 = 1f; float num11 = (float) (1.0 * (1.0 - (double) num10) + (double) num5 * (double) num10); Lighting.GlobalBrightness = (float) ((double) Lighting.GlobalBrightness * (1.0 - (double) num10) + 1.0 * (double) num10); float num12 = MathHelper.Clamp((float) ((double) Main.screenPosition.Y - (double) (Main.screenHeight / 2) + 200.0 - Main.rockLayer * 16.0) / 300f, 0.0f, 1f); if (Main.SceneMetrics.BloodTileCount > Main.SceneMetrics.EvilTileCount && Main.SceneMetrics.BloodTileCount > Main.SceneMetrics.HolyTileCount) { num5 = (float) (1.0 * (double) num9 + (double) num5 * (1.0 - (double) num9)); num6 = (float) (0.550000011920929 * (double) num9 + (double) num6 * (1.0 - (double) num9)); num7 = (float) (0.5 * (double) num9 + (double) num7 * (1.0 - (double) num9)); } else if (Main.SceneMetrics.EvilTileCount > 0) { num5 = (float) (0.800000011920929 * (double) num9 + (double) num5 * (1.0 - (double) num9)); num6 = (float) (0.75 * (double) num9 + (double) num6 * (1.0 - (double) num9)); num7 = (float) (1.10000002384186 * (double) num9 + (double) num7 * (1.0 - (double) num9)); } else if (Main.SceneMetrics.HolyTileCount > 0) { num5 = (float) (1.0 * (double) num9 + (double) num5 * (1.0 - (double) num9)); num6 = (float) (0.699999988079071 * (double) num9 + (double) num6 * (1.0 - (double) num9)); num7 = (float) (0.899999976158142 * (double) num9 + (double) num7 * (1.0 - (double) num9)); } float num13 = (float) (1.0 * ((double) num11 - (double) num12) + (double) num5 * (double) num12); float num14 = (float) (1.0 * ((double) num11 - (double) num12) + (double) num6 * (double) num12); float num15 = (float) (1.0 * ((double) num11 - (double) num12) + (double) num7 * (double) num12); int num16 = (int) (((double) Main.screenPosition.X + (double) (Main.screenWidth / 2)) / 16.0); int num17 = (num16 > Main.caveBackX[0] ? (num16 > Main.caveBackX[1] ? (num16 > Main.caveBackX[2] ? Main.caveBackStyle[3] : Main.caveBackStyle[2]) : Main.caveBackStyle[1]) : Main.caveBackStyle[0]) + 3; if (Main.SceneMetrics.SnowTileCount > SceneMetrics.SnowTileThreshold && ((double) Main.screenPosition.Y + (double) Main.screenHeight) / 16.0 < (double) (Main.maxTilesY - 250)) num17 = 1; if (Main.SceneMetrics.JungleTileCount > SceneMetrics.JungleTileThreshold) { if (num17 == 1) { if (Main.SceneMetrics.JungleTileCount > Main.SceneMetrics.SnowTileCount) num17 = 11; } else num17 = 11; } if (Main.SceneMetrics.MushroomTileCount > SceneMetrics.MushroomTileMax) num17 = 2; if (num17 != Main.undergroundBackground) { Main.oldUndergroundBackground = Main.undergroundBackground; Main.undergroundBackground = num17; Main.ugBackTransition = 1f; } if ((double) Main.ugBackTransition > 0.0) Main.ugBackTransition -= 0.25f; if ((double) Main.ugBackTransition < 0.0) Main.ugBackTransition = 0.0f; int[] numArray1 = new int[6]; int[] numArray2 = new int[6]; for (int index1 = 0; index1 < 2; ++index1) { int undergroundBackground = Main.undergroundBackground; if (index1 == 1) undergroundBackground = Main.oldUndergroundBackground; int[] numArray3 = new int[6]; switch (undergroundBackground) { case 0: numArray3[0] = 1; numArray3[1] = 2; numArray3[2] = 4; numArray3[3] = 3; numArray3[4] = 6; numArray3[5] = 5; break; case 1: switch (Main.iceBackStyle) { case 0: numArray3[1] = 33; numArray3[3] = 32; numArray3[0] = 40; numArray3[2] = 34; break; case 1: numArray3[1] = 118; numArray3[3] = 117; numArray3[0] = 160; numArray3[2] = 161; break; case 2: numArray3[1] = 165; numArray3[3] = 167; numArray3[0] = 164; numArray3[2] = 166; break; default: numArray3[1] = 120; numArray3[3] = 119; numArray3[0] = 162; numArray3[2] = 163; break; } numArray3[4] = numArray3[3]; break; case 2: numArray3[0] = 62; numArray3[1] = 63; numArray3[2] = 64; numArray3[3] = 65; numArray3[4] = 143 + Main.hellBackStyle; break; case 3: numArray3[0] = 66; numArray3[1] = 67; numArray3[2] = 68; numArray3[3] = 69; numArray3[4] = 128 + Main.hellBackStyle; break; case 4: numArray3[0] = 70; numArray3[1] = 71; numArray3[2] = 68; numArray3[3] = 72; numArray3[4] = 128 + Main.hellBackStyle; break; case 5: numArray3[0] = 73; numArray3[1] = 74; numArray3[2] = 75; numArray3[3] = 76; numArray3[4] = 131 + Main.hellBackStyle; break; case 6: numArray3[0] = 77; numArray3[1] = 78; numArray3[2] = 79; numArray3[3] = 80; numArray3[4] = 134 + Main.hellBackStyle; break; case 7: numArray3[0] = 77; numArray3[1] = 81; numArray3[2] = 79; numArray3[3] = 82; numArray3[4] = 134 + Main.hellBackStyle; break; case 8: numArray3[0] = 83; numArray3[1] = 84; numArray3[2] = 85; numArray3[3] = 86; numArray3[4] = 137 + Main.hellBackStyle; break; case 9: numArray3[0] = 83; numArray3[1] = 87; numArray3[2] = 88; numArray3[3] = 89; numArray3[4] = 137 + Main.hellBackStyle; break; case 10: numArray3[0] = 121; numArray3[1] = 122; numArray3[2] = 123; numArray3[3] = 124; numArray3[4] = 140 + Main.hellBackStyle; break; case 11: if (Main.jungleBackStyle == 0) { numArray3[0] = 153; numArray3[1] = 147; numArray3[2] = 148; numArray3[3] = 149; numArray3[4] = 150 + Main.hellBackStyle; break; } numArray3[0] = 146; numArray3[1] = 154; numArray3[2] = 155; numArray3[3] = 156; numArray3[4] = 157 + Main.hellBackStyle; break; } if (Main.hellBackStyle == 0) numArray3[5] = 125; if (Main.hellBackStyle == 1) numArray3[5] = 126; if (Main.hellBackStyle == 2) numArray3[5] = (int) sbyte.MaxValue; this.LoadBackground(numArray3[0]); this.LoadBackground(numArray3[1]); this.LoadBackground(numArray3[2]); this.LoadBackground(numArray3[3]); this.LoadBackground(numArray3[4]); this.LoadBackground(numArray3[5]); if (index1 == 0) { for (int index2 = 0; index2 < 6; ++index2) numArray1[index2] = numArray3[index2]; } else { for (int index3 = 0; index3 < 6; ++index3) numArray2[index3] = numArray3[index3]; } } float num18 = (float) (1.20000004768372 * (1.0 - (double) num12) + 1.0 * (double) num12); this.bgParallax = (double) Main.caveParallax; this.bgStartX = (int) (-Math.IEEERemainder((double) num3 + (double) Main.screenPosition.X * this.bgParallax, (double) num3) - (double) (num3 / 2)) - (int) vector2.X; this.bgLoops = (Main.screenWidth + (int) vector2.X * 2) / num3 + 2; this.bgTopY = (int) ((double) ((int) Main.worldSurface * 16 - 16) - (double) Main.screenPosition.Y + 16.0); for (int index4 = 0; index4 < this.bgLoops; ++index4) { for (int index5 = 0; index5 < num3 / 16; ++index5) { int num19 = (int) (float) Math.Round(-Math.IEEERemainder((double) this.bgStartX + (double) Main.screenPosition.X, 16.0)); if (num19 == -8) num19 = 8; double num20 = (double) (this.bgStartX + num3 * index4 + index5 * 16 + 8); float bgTopY = (float) this.bgTopY; double x = (double) Main.screenPosition.X; Microsoft.Xna.Framework.Color color1 = Lighting.GetColor((int) ((num20 + x) / 16.0), (int) (((double) Main.screenPosition.Y + (double) bgTopY) / 16.0)); color1.R = (byte) ((double) color1.R * (double) num13); color1.G = (byte) ((double) color1.G * (double) num14); color1.B = (byte) ((double) color1.B * (double) num15); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[0]].Value, new Vector2((float) (this.bgStartX + num3 * index4 + 16 * index5 + num19), (float) this.bgTopY) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index5 + num19 + 16, 0, 16, 16)), color1); if ((double) Main.ugBackTransition > 0.0) { Microsoft.Xna.Framework.Color color2 = color1; color2.R = (byte) ((double) color2.R * (double) Main.ugBackTransition); color2.G = (byte) ((double) color2.G * (double) Main.ugBackTransition); color2.B = (byte) ((double) color2.B * (double) Main.ugBackTransition); color2.A = (byte) ((double) color2.A * (double) Main.ugBackTransition); Main.spriteBatch.Draw(TextureAssets.Background[numArray2[0]].Value, new Vector2((float) (this.bgStartX + num3 * index4 + 16 * index5 + num19), (float) this.bgTopY) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index5 + num19 + 16, 0, 16, 16)), color2); } } } double num21 = (double) ((int) (((double) (Main.maxTilesY - 230) - Main.worldSurface) / 6.0) * 6); double num22 = Main.worldSurface + num21 - 5.0; bool flag1 = false; bool flag2 = false; this.bgTopY = (int) ((double) ((int) Main.worldSurface * 16) - (double) Main.screenPosition.Y + 16.0); if (Main.worldSurface * 16.0 <= (double) Main.screenPosition.Y + (double) Main.screenHeight + (double) Main.offScreenRange) { this.bgParallax = (double) Main.caveParallax; this.bgStartX = (int) (-Math.IEEERemainder((double) num3 + (double) Main.screenPosition.X * this.bgParallax, (double) num3) - (double) (num3 / 2)) - (int) vector2.X; this.bgLoops = (Main.screenWidth + (int) vector2.X * 2) / num3 + 2; if (Main.worldSurface * 16.0 < (double) Main.screenPosition.Y - 16.0) { this.bgStartY = (int) (Math.IEEERemainder((double) this.bgTopY, (double) Main.backgroundHeight[2]) - (double) Main.backgroundHeight[2]); this.bgLoopsY = (Main.screenHeight - this.bgStartY + (int) vector2.Y * 2) / Main.backgroundHeight[2] + 1; } else { this.bgStartY = this.bgTopY; this.bgLoopsY = (Main.screenHeight - this.bgTopY + (int) vector2.Y * 2) / Main.backgroundHeight[2] + 1; } if (Main.rockLayer * 16.0 < (double) Main.Camera.ScaledPosition.Y + 600.0) { this.bgLoopsY = (int) (Main.rockLayer * 16.0 - (double) Main.screenPosition.Y + 600.0 - (double) this.bgStartY) / Main.backgroundHeight[2]; flag2 = true; } int num23 = (int) (float) Math.Round(-Math.IEEERemainder((double) this.bgStartX + (double) Main.screenPosition.X, 16.0)); if (num23 == -8) num23 = 8; for (int index6 = 0; index6 < this.bgLoops; ++index6) { for (int index7 = 0; index7 < this.bgLoopsY; ++index7) { for (int index8 = 0; index8 < num3 / 16; ++index8) { for (int index9 = 0; index9 < 6; ++index9) { double num24 = (double) (this.bgStartY + index7 * 96 + index9 * 16 + 8); int index10 = (int) (((double) (this.bgStartX + num3 * index6 + index8 * 16 + 8) + (double) Main.screenPosition.X) / 16.0); double y = (double) Main.screenPosition.Y; int index11 = (int) ((num24 + y) / 16.0); Microsoft.Xna.Framework.Color color3 = Lighting.GetColor(index10, index11); if (Main.tile[index10, index11] == null) Main.tile[index10, index11] = new Tile(); if (color3.R > (byte) 0 || color3.G > (byte) 0 || color3.B > (byte) 0) { if (!Main.drawToScreen) { VertexColors vertices; Lighting.GetCornerColors(index10, index11, out vertices); Main.tileBatch.Draw(TextureAssets.Background[numArray1[1]].Value, new Vector2((float) (this.bgStartX + num3 * index6 + 16 * index8 + num23), (float) (this.bgStartY + Main.backgroundHeight[numArray2[1]] * index7 + 16 * index9)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index8 + num23 + 16, 16 * index9, 16, 16)), vertices, Vector2.Zero, 1f, SpriteEffects.None); } else if (((int) color3.R > num1 || (double) color3.G > (double) num1 * 1.1 || (double) color3.B > (double) num1 * 1.2) && !Main.tile[index10, index11].active() && Main.wallLight[(int) Main.tile[index10, index11].wall] && (double) Main.ugBackTransition == 0.0) { Lighting.GetColor9Slice(index10, index11, ref slices); try { for (int index12 = 0; index12 < 9; ++index12) { int num25 = 0; int num26 = 0; int width = 4; int height = 4; Microsoft.Xna.Framework.Color color4 = color3; Microsoft.Xna.Framework.Color color5 = color3; switch (index12) { case 0: if (!Main.tile[index10 - 1, index11 - 1].active()) { color5 = slices[index12]; break; } break; case 1: width = 8; num25 = 4; if (!Main.tile[index10, index11 - 1].active()) { color5 = slices[index12]; break; } break; case 2: num25 = 12; if (!Main.tile[index10 + 1, index11 - 1].active()) { color5 = slices[index12]; break; } break; case 3: height = 8; num26 = 4; if (!Main.tile[index10 - 1, index11].active()) { color5 = slices[index12]; break; } break; case 4: width = 8; height = 8; num25 = 4; num26 = 4; break; case 5: num25 = 12; num26 = 4; height = 8; if (!Main.tile[index10 + 1, index11].active()) { color5 = slices[index12]; break; } break; case 6: num26 = 12; if (!Main.tile[index10 - 1, index11 + 1].active()) { color5 = slices[index12]; break; } break; case 7: width = 8; height = 4; num25 = 4; num26 = 12; if (!Main.tile[index10, index11 + 1].active()) { color5 = slices[index12]; break; } break; case 8: num25 = 12; num26 = 12; if (!Main.tile[index10 + 1, index11 + 1].active()) { color5 = slices[index12]; break; } break; } color4.R = (byte) (((int) color3.R + (int) color5.R) / 2); color4.G = (byte) (((int) color3.G + (int) color5.G) / 2); color4.B = (byte) (((int) color3.B + (int) color5.B) / 2); color4.R = (byte) ((double) color4.R * (double) num13); color4.G = (byte) ((double) color4.G * (double) num14); color4.B = (byte) ((double) color4.B * (double) num15); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[1]].Value, new Vector2((float) (this.bgStartX + num3 * index6 + 16 * index8 + num25 + num23), (float) (this.bgStartY + Main.backgroundHeight[numArray1[1]] * index7 + 16 * index9 + num26)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index8 + num25 + num23 + 16, 16 * index9 + num26, width, height)), color4); if ((double) Main.ugBackTransition > 0.0) { Microsoft.Xna.Framework.Color color6 = color4; color6.R = (byte) ((double) color6.R * (double) Main.ugBackTransition); color6.G = (byte) ((double) color6.G * (double) Main.ugBackTransition); color6.B = (byte) ((double) color6.B * (double) Main.ugBackTransition); color6.A = (byte) ((double) color6.A * (double) Main.ugBackTransition); Main.spriteBatch.Draw(TextureAssets.Background[numArray2[1]].Value, new Vector2((float) (this.bgStartX + num3 * index6 + 16 * index8 + num25 + num23), (float) (this.bgStartY + Main.backgroundHeight[numArray2[1]] * index7 + 16 * index9 + num26)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index8 + num25 + num23 + 16, 16 * index9 + num26, width, height)), color6); } } } catch { color3.R = (byte) ((double) color3.R * (double) num13); color3.G = (byte) ((double) color3.G * (double) num14); color3.B = (byte) ((double) color3.B * (double) num15); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[1]].Value, new Vector2((float) (this.bgStartX + num3 * index6 + 16 * index8 + num23), (float) (this.bgStartY + Main.backgroundHeight[numArray1[1]] * index7 + 16 * index9)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index8 + num23 + 16, 16 * index9, 16, 16)), color3); } } else if (((int) color3.R > num2 || (double) color3.G > (double) num2 * 1.1 || (double) color3.B > (double) num2 * 1.2) && (double) Main.ugBackTransition == 0.0) { Lighting.GetColor4Slice(index10, index11, ref slices); for (int index13 = 0; index13 < 4; ++index13) { int num27 = 0; int num28 = 0; Microsoft.Xna.Framework.Color color7 = color3; Microsoft.Xna.Framework.Color color8 = slices[index13]; switch (index13 - 1) { case 0: num27 = 8; break; case 1: num28 = 8; break; case 2: num27 = 8; num28 = 8; break; } color7.R = (byte) (((int) color3.R + (int) color8.R) / 2); color7.G = (byte) (((int) color3.G + (int) color8.G) / 2); color7.B = (byte) (((int) color3.B + (int) color8.B) / 2); color7.R = (byte) ((double) color7.R * (double) num13); color7.G = (byte) ((double) color7.G * (double) num14); color7.B = (byte) ((double) color7.B * (double) num15); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[1]].Value, new Vector2((float) (this.bgStartX + num3 * index6 + 16 * index8 + num27 + num23), (float) (this.bgStartY + Main.backgroundHeight[numArray1[1]] * index7 + 16 * index9 + num28)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index8 + num27 + num23 + 16, 16 * index9 + num28, 8, 8)), color7); if ((double) Main.ugBackTransition > 0.0) { Microsoft.Xna.Framework.Color color9 = color7; color9.R = (byte) ((double) color9.R * (double) Main.ugBackTransition); color9.G = (byte) ((double) color9.G * (double) Main.ugBackTransition); color9.B = (byte) ((double) color9.B * (double) Main.ugBackTransition); color9.A = (byte) ((double) color9.A * (double) Main.ugBackTransition); Main.spriteBatch.Draw(TextureAssets.Background[numArray2[1]].Value, new Vector2((float) (this.bgStartX + num3 * index6 + 16 * index8 + num27 + num23), (float) (this.bgStartY + Main.backgroundHeight[numArray2[1]] * index7 + 16 * index9 + num28)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index8 + num27 + num23 + 16, 16 * index9 + num28, 8, 8)), color9); } } } else { color3.R = (byte) ((double) color3.R * (double) num13); color3.G = (byte) ((double) color3.G * (double) num14); color3.B = (byte) ((double) color3.B * (double) num15); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[1]].Value, new Vector2((float) (this.bgStartX + num3 * index6 + 16 * index8 + num23), (float) (this.bgStartY + Main.backgroundHeight[numArray1[1]] * index7 + 16 * index9)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index8 + num23 + 16, 16 * index9, 16, 16)), color3); if ((double) Main.ugBackTransition > 0.0) { Microsoft.Xna.Framework.Color color10 = color3; color10.R = (byte) ((double) color10.R * (double) Main.ugBackTransition); color10.G = (byte) ((double) color10.G * (double) Main.ugBackTransition); color10.B = (byte) ((double) color10.B * (double) Main.ugBackTransition); color10.A = (byte) ((double) color10.A * (double) Main.ugBackTransition); Main.spriteBatch.Draw(TextureAssets.Background[numArray2[1]].Value, new Vector2((float) (this.bgStartX + num3 * index6 + 16 * index8 + num23), (float) (this.bgStartY + Main.backgroundHeight[numArray2[1]] * index7 + 16 * index9)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index8 + num23 + 16, 16 * index9, 16, 16)), color10); } } } else { color3.R = (byte) ((double) color3.R * (double) num13); color3.G = (byte) ((double) color3.G * (double) num14); color3.B = (byte) ((double) color3.B * (double) num15); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[1]].Value, new Vector2((float) (this.bgStartX + num3 * index6 + 16 * index8 + num23), (float) (this.bgStartY + Main.backgroundHeight[numArray1[1]] * index7 + 16 * index9)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index8 + num23 + 16, 16 * index9, 16, 16)), color3); } } } } } if ((double) Main.ugBackTransition > 0.0) { for (int index14 = 0; index14 < this.bgLoops; ++index14) { for (int index15 = 0; index15 < this.bgLoopsY; ++index15) { for (int index16 = 0; index16 < num3 / 16; ++index16) { for (int index17 = 0; index17 < 6; ++index17) { double num29 = (double) (this.bgStartY + index15 * 96 + index17 * 16 + 8); int index18 = (int) (((double) (this.bgStartX + num3 * index14 + index16 * 16 + 8) + (double) Main.screenPosition.X) / 16.0); double y = (double) Main.screenPosition.Y; int index19 = (int) ((num29 + y) / 16.0); Microsoft.Xna.Framework.Color color = Lighting.GetColor(index18, index19); if (Main.tile[index18, index19] == null) Main.tile[index18, index19] = new Tile(); if (color.R > (byte) 0 || color.G > (byte) 0 || color.B > (byte) 0) { VertexColors vertices; Lighting.GetCornerColors(index18, index19, out vertices, Main.ugBackTransition); byte num30 = (byte) ((double) byte.MaxValue * (double) Main.ugBackTransition); vertices.BottomLeftColor.A = num30; vertices.BottomRightColor.A = num30; vertices.TopLeftColor.A = num30; vertices.TopRightColor.A = num30; Main.tileBatch.Draw(TextureAssets.Background[numArray2[1]].Value, new Vector2((float) (this.bgStartX + num3 * index14 + 16 * index16 + num23), (float) (this.bgStartY + Main.backgroundHeight[numArray2[1]] * index15 + 16 * index17)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index16 + num23 + 16, 16 * index17, 16, 16)), vertices, Vector2.Zero, 1f, SpriteEffects.None); } } } } } } if (flag2) { this.bgParallax = (double) Main.caveParallax; this.bgStartX = (int) (-Math.IEEERemainder((double) num3 + (double) Main.screenPosition.X * this.bgParallax, (double) num3) - (double) (num3 / 2)) - (int) vector2.X; this.bgLoops = (Main.screenWidth + (int) vector2.X * 2) / num3 + 2; this.bgTopY = this.bgStartY + this.bgLoopsY * Main.backgroundHeight[2]; if (this.bgTopY > -32) { for (int index20 = 0; index20 < this.bgLoops; ++index20) { for (int index21 = 0; index21 < num3 / 16; ++index21) { double num31 = (double) (this.bgStartX + num3 * index20 + index21 * 16 + 8); float bgTopY = (float) this.bgTopY; double x = (double) Main.screenPosition.X; Microsoft.Xna.Framework.Color color11 = Lighting.GetColor((int) ((num31 + x) / 16.0), (int) (((double) Main.screenPosition.Y + (double) bgTopY) / 16.0)); color11.R = (byte) ((double) color11.R * (double) num13); color11.G = (byte) ((double) color11.G * (double) num14); color11.B = (byte) ((double) color11.B * (double) num15); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[2]].Value, new Vector2((float) (this.bgStartX + num3 * index20 + 16 * index21 + num23), (float) this.bgTopY) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index21 + num23 + 16, 0, 16, 16)), color11); if ((double) Main.ugBackTransition > 0.0) { Microsoft.Xna.Framework.Color color12 = color11; color12.R = (byte) ((double) color12.R * (double) Main.ugBackTransition); color12.G = (byte) ((double) color12.G * (double) Main.ugBackTransition); color12.B = (byte) ((double) color12.B * (double) Main.ugBackTransition); color12.A = (byte) ((double) color12.A * (double) Main.ugBackTransition); Main.spriteBatch.Draw(TextureAssets.Background[numArray2[2]].Value, new Vector2((float) (this.bgStartX + num3 * index20 + 16 * index21 + num23), (float) this.bgTopY) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index21 + num23 + 16, 0, 16, 16)), color12); } } } } } } this.bgTopY = (int) ((double) ((int) Main.rockLayer * 16) - (double) Main.screenPosition.Y + 16.0 + 600.0 - 8.0); if (Main.rockLayer * 16.0 <= (double) Main.screenPosition.Y + 600.0) { this.bgParallax = (double) Main.caveParallax; this.bgStartX = (int) (-Math.IEEERemainder((double) num3 + (double) Main.screenPosition.X * this.bgParallax, (double) num3) - (double) (num3 / 2)) - (int) vector2.X; this.bgLoops = (Main.screenWidth + (int) vector2.X * 2) / num3 + 2; if (Main.rockLayer * 16.0 + (double) Main.screenHeight < (double) Main.screenPosition.Y - 16.0) { this.bgStartY = (int) (Math.IEEERemainder((double) this.bgTopY, (double) Main.backgroundHeight[3]) - (double) Main.backgroundHeight[3]); this.bgLoopsY = (Main.screenHeight - this.bgStartY + (int) vector2.Y * 2) / Main.backgroundHeight[2] + 1; } else { this.bgStartY = this.bgTopY; this.bgLoopsY = (Main.screenHeight - this.bgTopY + (int) vector2.Y * 2) / Main.backgroundHeight[2] + 1; } if (num22 * 16.0 < (double) Main.screenPosition.Y + 600.0) { this.bgLoopsY = (int) (num22 * 16.0 - (double) Main.screenPosition.Y + 600.0 - (double) this.bgStartY) / Main.backgroundHeight[2]; flag1 = true; } int num32 = (int) (float) Math.Round(-Math.IEEERemainder((double) this.bgStartX + (double) Main.screenPosition.X, 16.0)); if (num32 == -8) num32 = 8; for (int index22 = 0; index22 < this.bgLoops; ++index22) { for (int index23 = 0; index23 < this.bgLoopsY; ++index23) { for (int index24 = 0; index24 < num3 / 16; ++index24) { for (int index25 = 0; index25 < 6; ++index25) { double num33 = (double) (this.bgStartY + index23 * 96 + index25 * 16 + 8); int index26 = (int) (((double) (this.bgStartX + num3 * index22 + index24 * 16 + 8) + (double) Main.screenPosition.X) / 16.0); double y = (double) Main.screenPosition.Y; int index27 = (int) ((num33 + y) / 16.0); Microsoft.Xna.Framework.Color color13 = Lighting.GetColor(index26, index27); if (Main.tile[index26, index27] == null) Main.tile[index26, index27] = new Tile(); bool flag3 = false; if ((double) Main.caveParallax != 0.0) { if (Main.tile[index26 - 1, index27] == null) Main.tile[index26 - 1, index27] = new Tile(); if (Main.tile[index26 + 1, index27] == null) Main.tile[index26 + 1, index27] = new Tile(); if (Main.wallLight[(int) Main.tile[index26, index27].wall] || Main.wallLight[(int) Main.tile[index26 - 1, index27].wall] || Main.wallLight[(int) Main.tile[index26 + 1, index27].wall]) flag3 = true; } else if (Main.wallLight[(int) Main.tile[index26, index27].wall]) flag3 = true; if ((flag3 || color13.R == (byte) 0 || color13.G == (byte) 0 || color13.B == (byte) 0) && (color13.R > (byte) 0 || color13.G > (byte) 0 || color13.B > (byte) 0) && (Main.wallLight[(int) Main.tile[index26, index27].wall] || (double) Main.caveParallax != 0.0)) { if (Lighting.NotRetro && color13.R < (byte) 230 && color13.G < (byte) 230 && color13.B < (byte) 230 && (double) Main.ugBackTransition == 0.0) { if (((int) color13.R > num1 || (double) color13.G > (double) num1 * 1.1 || (double) color13.B > (double) num1 * 1.2) && !Main.tile[index26, index27].active()) { Lighting.GetColor9Slice(index26, index27, ref slices); for (int index28 = 0; index28 < 9; ++index28) { int num34 = 0; int num35 = 0; int width = 4; int height = 4; Microsoft.Xna.Framework.Color color14 = color13; Microsoft.Xna.Framework.Color color15 = color13; switch (index28) { case 0: if (!Main.tile[index26 - 1, index27 - 1].active()) { color15 = slices[index28]; break; } break; case 1: width = 8; num34 = 4; if (!Main.tile[index26, index27 - 1].active()) { color15 = slices[index28]; break; } break; case 2: num34 = 12; if (!Main.tile[index26 + 1, index27 - 1].active()) { color15 = slices[index28]; break; } break; case 3: height = 8; num35 = 4; if (!Main.tile[index26 - 1, index27].active()) { color15 = slices[index28]; break; } break; case 4: width = 8; height = 8; num34 = 4; num35 = 4; break; case 5: num34 = 12; num35 = 4; height = 8; if (!Main.tile[index26 + 1, index27].active()) { color15 = slices[index28]; break; } break; case 6: num35 = 12; if (!Main.tile[index26 - 1, index27 + 1].active()) { color15 = slices[index28]; break; } break; case 7: width = 8; height = 4; num34 = 4; num35 = 12; if (!Main.tile[index26, index27 + 1].active()) { color15 = slices[index28]; break; } break; case 8: num34 = 12; num35 = 12; if (!Main.tile[index26 + 1, index27 + 1].active()) { color15 = slices[index28]; break; } break; } color14.R = (byte) (((int) color13.R + (int) color15.R) / 2); color14.G = (byte) (((int) color13.G + (int) color15.G) / 2); color14.B = (byte) (((int) color13.B + (int) color15.B) / 2); color14.R = (byte) ((double) color14.R * (double) num13); color14.G = (byte) ((double) color14.G * (double) num14); color14.B = (byte) ((double) color14.B * (double) num15); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[3]].Value, new Vector2((float) (this.bgStartX + num3 * index22 + 16 * index24 + num34 + num32), (float) (this.bgStartY + Main.backgroundHeight[numArray1[3]] * index23 + 16 * index25 + num35)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index24 + num34 + num32 + 16, 16 * index25 + num35, width, height)), color14); if ((double) Main.ugBackTransition > 0.0) { Microsoft.Xna.Framework.Color color16 = color14; color16.R = (byte) ((double) color16.R * (double) Main.ugBackTransition); color16.G = (byte) ((double) color16.G * (double) Main.ugBackTransition); color16.B = (byte) ((double) color16.B * (double) Main.ugBackTransition); color16.A = (byte) ((double) color16.A * (double) Main.ugBackTransition); Main.spriteBatch.Draw(TextureAssets.Background[numArray2[3]].Value, new Vector2((float) (this.bgStartX + num3 * index22 + 16 * index24 + num34 + num32), (float) (this.bgStartY + Main.backgroundHeight[numArray2[3]] * index23 + 16 * index25 + num35)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index24 + num34 + num32 + 16, 16 * index25 + num35, width, height)), color16); } } } else if ((int) color13.R > num2 || (double) color13.G > (double) num2 * 1.1 || (double) color13.B > (double) num2 * 1.2) { Lighting.GetColor4Slice(index26, index27, ref slices); for (int index29 = 0; index29 < 4; ++index29) { int num36 = 0; int num37 = 0; Microsoft.Xna.Framework.Color color17 = color13; Microsoft.Xna.Framework.Color color18 = slices[index29]; switch (index29 - 1) { case 0: num36 = 8; break; case 1: num37 = 8; break; case 2: num36 = 8; num37 = 8; break; } color17.R = (byte) (((int) color13.R + (int) color18.R) / 2); color17.G = (byte) (((int) color13.G + (int) color18.G) / 2); color17.B = (byte) (((int) color13.B + (int) color18.B) / 2); color17.R = (byte) ((double) color17.R * (double) num13); color17.G = (byte) ((double) color17.G * (double) num14); color17.B = (byte) ((double) color17.B * (double) num15); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[3]].Value, new Vector2((float) (this.bgStartX + num3 * index22 + 16 * index24 + num36 + num32), (float) (this.bgStartY + Main.backgroundHeight[numArray1[3]] * index23 + 16 * index25 + num37)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index24 + num36 + num32 + 16, 16 * index25 + num37, 8, 8)), color17); if ((double) Main.ugBackTransition > 0.0) { Microsoft.Xna.Framework.Color color19 = color17; color19.R = (byte) ((double) color19.R * (double) Main.ugBackTransition); color19.G = (byte) ((double) color19.G * (double) Main.ugBackTransition); color19.B = (byte) ((double) color19.B * (double) Main.ugBackTransition); color19.A = (byte) ((double) color19.A * (double) Main.ugBackTransition); Main.spriteBatch.Draw(TextureAssets.Background[numArray2[3]].Value, new Vector2((float) (this.bgStartX + num3 * index22 + 16 * index24 + num36 + num32), (float) (this.bgStartY + Main.backgroundHeight[numArray2[3]] * index23 + 16 * index25 + num37)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index24 + num36 + num32 + 16, 16 * index25 + num37, 8, 8)), color19); } } } else { color13.R = (byte) ((double) color13.R * (double) num13); color13.G = (byte) ((double) color13.G * (double) num14); color13.B = (byte) ((double) color13.B * (double) num15); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[3]].Value, new Vector2((float) (this.bgStartX + num3 * index22 + 16 * index24 + num32), (float) (this.bgStartY + Main.backgroundHeight[numArray1[3]] * index23 + 16 * index25)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index24 + num32 + 16, 16 * index25, 16, 16)), color13); if ((double) Main.ugBackTransition > 0.0) { Microsoft.Xna.Framework.Color color20 = color13; color20.R = (byte) ((double) color20.R * (double) Main.ugBackTransition); color20.G = (byte) ((double) color20.G * (double) Main.ugBackTransition); color20.B = (byte) ((double) color20.B * (double) Main.ugBackTransition); color20.A = (byte) ((double) color20.A * (double) Main.ugBackTransition); Main.spriteBatch.Draw(TextureAssets.Background[numArray2[3]].Value, new Vector2((float) (this.bgStartX + num3 * index22 + 16 * index24 + num32), (float) (this.bgStartY + Main.backgroundHeight[numArray2[3]] * index23 + 16 * index25)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index24 + num32 + 16, 16 * index25, 16, 16)), color20); } } } else { color13.R = (byte) ((double) color13.R * (double) num13); color13.G = (byte) ((double) color13.G * (double) num14); color13.B = (byte) ((double) color13.B * (double) num15); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[3]].Value, new Vector2((float) (this.bgStartX + num3 * index22 + 16 * index24 + num32), (float) (this.bgStartY + Main.backgroundHeight[numArray1[3]] * index23 + 16 * index25)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index24 + num32 + 16, 16 * index25, 16, 16)), color13); if ((double) Main.ugBackTransition > 0.0) { Microsoft.Xna.Framework.Color color21 = color13; color21.R = (byte) ((double) color21.R * (double) Main.ugBackTransition); color21.G = (byte) ((double) color21.G * (double) Main.ugBackTransition); color21.B = (byte) ((double) color21.B * (double) Main.ugBackTransition); color21.A = (byte) ((double) color21.A * (double) Main.ugBackTransition); Main.spriteBatch.Draw(TextureAssets.Background[numArray2[3]].Value, new Vector2((float) (this.bgStartX + num3 * index22 + 16 * index24 + num32), (float) (this.bgStartY + Main.backgroundHeight[numArray2[3]] * index23 + 16 * index25)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index24 + num32 + 16, 16 * index25, 16, 16)), color21); } } } } } } } num3 = 128; if (flag1) { this.bgParallax = (double) Main.caveParallax; this.bgStartX = (int) (-Math.IEEERemainder((double) num3 + (double) Main.screenPosition.X * this.bgParallax, (double) num3) - (double) (num3 / 2)) - (int) vector2.X; this.bgLoops = (Main.screenWidth + (int) vector2.X * 2) / num3 + 2; this.bgTopY = this.bgStartY + this.bgLoopsY * Main.backgroundHeight[2]; for (int index30 = 0; index30 < this.bgLoops; ++index30) { for (int index31 = 0; index31 < num3 / 16; ++index31) { double num38 = (double) (this.bgStartX + num3 * index30 + index31 * 16 + 8); float bgTopY = (float) this.bgTopY; double x = (double) Main.screenPosition.X; Microsoft.Xna.Framework.Color color22 = Lighting.GetColor((int) ((num38 + x) / 16.0), (int) (((double) Main.screenPosition.Y + (double) bgTopY) / 16.0)); color22.R = (byte) ((double) color22.R * (double) num13); color22.G = (byte) ((double) color22.G * (double) num14); color22.B = (byte) ((double) color22.B * (double) num15); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[4]].Value, new Vector2((float) (this.bgStartX + num3 * index30 + 16 * index31 + num32), (float) this.bgTopY) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index31 + num32 + 16, Main.magmaBGFrame * 16, 16, 16)), color22); if ((double) Main.ugBackTransition > 0.0) { Microsoft.Xna.Framework.Color color23 = color22; color23.R = (byte) ((double) color23.R * (double) Main.ugBackTransition); color23.G = (byte) ((double) color23.G * (double) Main.ugBackTransition); color23.B = (byte) ((double) color23.B * (double) Main.ugBackTransition); color23.A = (byte) ((double) color23.A * (double) Main.ugBackTransition); Main.spriteBatch.Draw(TextureAssets.Background[numArray2[4]].Value, new Vector2((float) (this.bgStartX + num3 * index30 + 16 * index31 + num32), (float) this.bgTopY) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index31 + num32 + 16, Main.magmaBGFrame * 16, 16, 16)), color23); } } } } } this.bgTopY = (int) ((double) ((int) num22 * 16) - (double) Main.screenPosition.Y + 16.0 + 600.0) - 8; if (num22 * 16.0 <= (double) Main.screenPosition.Y + 600.0) { this.bgStartX = (int) (-Math.IEEERemainder((double) num3 + (double) Main.screenPosition.X * this.bgParallax, (double) num3) - (double) (num3 / 2)) - (int) vector2.X; this.bgLoops = (Main.screenWidth + (int) vector2.X * 2) / num3 + 2; if (num22 * 16.0 + (double) Main.screenHeight < (double) Main.screenPosition.Y - 16.0) { this.bgStartY = (int) (Math.IEEERemainder((double) this.bgTopY, (double) Main.backgroundHeight[2]) - (double) Main.backgroundHeight[2]); this.bgLoopsY = (Main.screenHeight - this.bgStartY + (int) vector2.Y * 2) / Main.backgroundHeight[2] + 1; } else { this.bgStartY = this.bgTopY; this.bgLoopsY = (Main.screenHeight - this.bgTopY + (int) vector2.Y * 2) / Main.backgroundHeight[2] + 1; } int num39 = (int) ((double) num1 * 1.5); int num40 = (int) ((double) num2 * 1.5); int num41 = (int) (float) Math.Round(-Math.IEEERemainder((double) this.bgStartX + (double) Main.screenPosition.X, 16.0)); if (num41 == -8) num41 = 8; for (int index32 = 0; index32 < this.bgLoops; ++index32) { for (int index33 = 0; index33 < this.bgLoopsY; ++index33) { for (int index34 = 0; index34 < num3 / 16; ++index34) { for (int index35 = 0; index35 < 6; ++index35) { double num42 = (double) (this.bgStartY + index33 * 96 + index35 * 16 + 8); int index36 = (int) (((double) (this.bgStartX + num3 * index32 + index34 * 16 + 8) + (double) Main.screenPosition.X) / 16.0); double y = (double) Main.screenPosition.Y; int index37 = (int) ((num42 + y) / 16.0); Microsoft.Xna.Framework.Color color24 = Lighting.GetColor(index36, index37); if (Main.tile[index36, index37] == null) Main.tile[index36, index37] = new Tile(); bool flag4 = false; if ((double) Main.caveParallax != 0.0) { if (Main.tile[index36 - 1, index37] == null) Main.tile[index36 - 1, index37] = new Tile(); if (Main.tile[index36 + 1, index37] == null) Main.tile[index36 + 1, index37] = new Tile(); if (Main.wallLight[(int) Main.tile[index36, index37].wall] || Main.wallLight[(int) Main.tile[index36 - 1, index37].wall] || Main.wallLight[(int) Main.tile[index36 + 1, index37].wall]) flag4 = true; } else if (Main.wallLight[(int) Main.tile[index36, index37].wall]) flag4 = true; if ((flag4 || color24.R == (byte) 0 || color24.G == (byte) 0 || color24.B == (byte) 0) && (color24.R > (byte) 0 || color24.G > (byte) 0 || color24.B > (byte) 0) && (Main.wallLight[(int) Main.tile[index36, index37].wall] || (double) Main.caveParallax != 0.0)) { if (Lighting.NotRetro && color24.R < (byte) 230 && color24.G < (byte) 230 && color24.B < (byte) 230) { if (((int) color24.R > num39 || (double) color24.G > (double) num39 * 1.1 || (double) color24.B > (double) num39 * 1.2) && !Main.tile[index36, index37].active()) { Lighting.GetColor9Slice(index36, index37, ref slices); for (int index38 = 0; index38 < 9; ++index38) { int num43 = 0; int num44 = 0; int width = 4; int height = 4; Microsoft.Xna.Framework.Color color25 = color24; Microsoft.Xna.Framework.Color color26 = color24; switch (index38) { case 0: if (!Main.tile[index36 - 1, index37 - 1].active()) { color26 = slices[index38]; break; } break; case 1: width = 8; num43 = 4; if (!Main.tile[index36, index37 - 1].active()) { color26 = slices[index38]; break; } break; case 2: num43 = 12; if (!Main.tile[index36 + 1, index37 - 1].active()) { color26 = slices[index38]; break; } break; case 3: height = 8; num44 = 4; if (!Main.tile[index36 - 1, index37].active()) { color26 = slices[index38]; break; } break; case 4: width = 8; height = 8; num43 = 4; num44 = 4; break; case 5: num43 = 12; num44 = 4; height = 8; if (!Main.tile[index36 + 1, index37].active()) { color26 = slices[index38]; break; } break; case 6: num44 = 12; if (!Main.tile[index36 - 1, index37 + 1].active()) { color26 = slices[index38]; break; } break; case 7: width = 8; height = 4; num43 = 4; num44 = 12; if (!Main.tile[index36, index37 + 1].active()) { color26 = slices[index38]; break; } break; case 8: num43 = 12; num44 = 12; if (!Main.tile[index36 + 1, index37 + 1].active()) { color26 = slices[index38]; break; } break; } color25.R = (byte) (((int) color24.R + (int) color26.R) / 2); color25.G = (byte) (((int) color24.G + (int) color26.G) / 2); color25.B = (byte) (((int) color24.B + (int) color26.B) / 2); color25.R = (byte) ((double) color25.R * (double) num13); color25.G = (byte) ((double) color25.G * (double) num14); color25.B = (byte) ((double) color25.B * (double) num15); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[5]].Value, new Vector2((float) (this.bgStartX + num3 * index32 + 16 * index34 + num43 + num41), (float) (this.bgStartY + Main.backgroundHeight[2] * index33 + 16 * index35 + num44)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index34 + num43 + num41 + 16, 16 * index35 + Main.backgroundHeight[2] * Main.magmaBGFrame + num44, width, height)), color25, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } } else if ((int) color24.R > num40 || (double) color24.G > (double) num40 * 1.1 || (double) color24.B > (double) num40 * 1.2) { Lighting.GetColor4Slice(index36, index37, ref slices); for (int index39 = 0; index39 < 4; ++index39) { int num45 = 0; int num46 = 0; Microsoft.Xna.Framework.Color color27 = color24; Microsoft.Xna.Framework.Color color28 = slices[index39]; switch (index39 - 1) { case 0: num45 = 8; break; case 1: num46 = 8; break; case 2: num45 = 8; num46 = 8; break; } color27.R = (byte) (((int) color24.R + (int) color28.R) / 2); color27.G = (byte) (((int) color24.G + (int) color28.G) / 2); color27.B = (byte) (((int) color24.B + (int) color28.B) / 2); color27.R = (byte) ((double) color27.R * (double) num13); color27.G = (byte) ((double) color27.G * (double) num14); color27.B = (byte) ((double) color27.B * (double) num15); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[5]].Value, new Vector2((float) (this.bgStartX + num3 * index32 + 16 * index34 + num45 + num41), (float) (this.bgStartY + Main.backgroundHeight[2] * index33 + 16 * index35 + num46)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index34 + num45 + num41 + 16, 16 * index35 + Main.backgroundHeight[2] * Main.magmaBGFrame + num46, 8, 8)), color27, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } } else { color24.R = (byte) ((double) color24.R * (double) num13); color24.G = (byte) ((double) color24.G * (double) num14); color24.B = (byte) ((double) color24.B * (double) num15); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[5]].Value, new Vector2((float) (this.bgStartX + num3 * index32 + 16 * index34 + num41), (float) (this.bgStartY + Main.backgroundHeight[2] * index33 + 16 * index35)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index34 + num41 + 16, 16 * index35 + Main.backgroundHeight[2] * Main.magmaBGFrame, 16, 16)), color24, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } } else { color24.R = (byte) ((double) color24.R * (double) num13); color24.G = (byte) ((double) color24.G * (double) num14); color24.B = (byte) ((double) color24.B * (double) num15); Main.spriteBatch.Draw(TextureAssets.Background[numArray1[5]].Value, new Vector2((float) (this.bgStartX + num3 * index32 + 16 * index34 + num41), (float) (this.bgStartY + Main.backgroundHeight[2] * index33 + 16 * index35)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index34 + num41 + 16, 16 * index35 + Main.backgroundHeight[2] * Main.magmaBGFrame, 16, 16)), color24, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } } } } } } } Lighting.GlobalBrightness = num18; TimeLogger.DrawTime(3, stopwatch.Elapsed.TotalMilliseconds); } protected void RenderBackground() { if (Main.drawToScreen) return; this.GraphicsDevice.SetRenderTarget(this.backWaterTarget); this.GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Transparent); Main.spriteBatch.Begin(); Main.tileBatch.Begin(); try { this.DrawWaters(true); } catch { } Main.tileBatch.End(); Main.spriteBatch.End(); this.GraphicsDevice.SetRenderTarget((RenderTarget2D) null); this.GraphicsDevice.SetRenderTarget(this.backgroundTarget); this.GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Transparent); Main.spriteBatch.Begin(); Main.tileBatch.Begin(); if (Main.ignoreErrors) { try { this.DrawBackground(); } catch (Exception ex) { TimeLogger.DrawException(ex); } } else this.DrawBackground(); TimeLogger.DetailedDrawReset(); Main.spriteBatch.End(); Main.tileBatch.End(); TimeLogger.DetailedDrawTime(33); this.GraphicsDevice.SetRenderTarget((RenderTarget2D) null); } protected void DrawToMap() { if (!Main.mapEnabled) return; int num1 = Main.maxTilesX / Main.textureMaxWidth; int num2 = Main.maxTilesY / Main.textureMaxHeight; for (int i = 0; i <= num1; ++i) { for (int j = 0; j <= num2; ++j) { if (!this.checkMap(i, j)) return; } } if (Main.clearMap) { for (int index1 = 0; index1 <= num1; ++index1) { for (int index2 = 0; index2 <= num2; ++index2) { this.GraphicsDevice.SetRenderTarget(this.mapTarget[index1, index2]); this.GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Transparent); this.GraphicsDevice.SetRenderTarget((RenderTarget2D) null); } } Main.clearMap = false; } int num3 = -1; int num4 = -1; bool flag = false; int num5 = 0; int mapMinY1 = Main.mapMinY; int num6 = Main.mapMinY; int num7 = Main.mapMaxY; int mapMaxY = Main.mapMaxY; int num8 = 1; if (Main.mapMinY / Main.textureMaxHeight != Main.mapMaxY / Main.textureMaxHeight) { num7 = Main.textureMaxHeight; num6 = Main.textureMaxHeight; num8 = 2; } for (int index3 = 0; index3 < num8; ++index3) { switch (index3) { case 0: Main.mapMinY = mapMinY1; Main.mapMaxY = num7; break; case 1: Main.mapMinY = num6; Main.mapMaxY = mapMaxY; break; } if (Main.mapMinX < 0) Main.mapMinX = 0; if (Main.mapMinX >= Main.maxTilesX) Main.mapMinX = Main.maxTilesX - 1; if (Main.mapMinY < 0) Main.mapMinY = 0; if (Main.mapMinY >= Main.maxTilesY) Main.mapMinY = Main.maxTilesY - 1; for (int mapMinX = Main.mapMinX; mapMinX < Main.mapMaxX; ++mapMinX) { for (int mapMinY2 = Main.mapMinY; mapMinY2 < Main.mapMaxY; ++mapMinY2) { MapTile tile = Main.Map[mapMinX, mapMinY2]; if (tile.IsChanged && !this.mapTarget[mapMinX / Main.textureMaxWidth, mapMinY2 / Main.textureMaxHeight].IsContentLost) { ++num5; if (num5 < Main.maxMapUpdates) { if (Main.loadMap) Main.loadMapLastX = mapMinX; Main.Map.ConsumeUpdate(mapMinX, mapMinY2); int index4 = mapMinX / Main.textureMaxWidth; int index5 = mapMinY2 / Main.textureMaxHeight; if (index4 != num3 || index5 != num4) { num3 = index4; num4 = index5; if (flag) { Main.spriteBatch.End(); this.GraphicsDevice.SetRenderTarget((RenderTarget2D) null); } flag = true; this.GraphicsDevice.SetRenderTarget(this.mapTarget[index4, index5]); Main.spriteBatch.Begin(); } int num9 = mapMinX - index4 * Main.textureMaxWidth; int num10 = mapMinY2 - index5 * Main.textureMaxHeight; Microsoft.Xna.Framework.Color mapTileXnaColor = MapHelper.GetMapTileXnaColor(ref tile); int height = 1; int width = 1; int y = mapMinY2 + 1; MapTile other; MapTile mapTile; while (y < Main.mapMaxY) { mapTile = other = Main.Map[mapMinX, y]; if (mapTile.IsChanged && tile.Equals(ref other) && y / Main.textureMaxHeight == index5) { Main.Map.ConsumeUpdate(mapMinX, y); ++height; ++y; ++mapMinY2; } else break; } if (height == 1) { for (int x = mapMinX + 1; x < Main.mapMaxX; ++x) { mapTile = other = Main.Map[x, mapMinY2]; if (mapTile.IsChanged && tile.Equals(ref other) && x / Main.textureMaxWidth == index4) { Main.Map.ConsumeUpdate(x, mapMinY2); ++width; } else break; } } Main.spriteBatch.Draw(TextureAssets.MagicPixel.Value, new Vector2((float) num9, (float) num10), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, width, height)), mapTileXnaColor, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } } } } } for (int index6 = 0; index6 < MapHelper.numUpdateTile; ++index6) { int x = (int) MapHelper.updateTileX[index6]; int y = (int) MapHelper.updateTileY[index6]; MapTile tile = Main.Map[x, y]; if (tile.IsChanged) { Main.Map.ConsumeUpdate(x, y); int index7 = x / Main.textureMaxWidth; int index8 = y / Main.textureMaxHeight; if (index7 != num3 || index8 != num4) { num3 = index7; num4 = index8; if (flag) { Main.spriteBatch.End(); this.GraphicsDevice.SetRenderTarget((RenderTarget2D) null); } flag = true; this.GraphicsDevice.SetRenderTarget(this.mapTarget[index7, index8]); Main.spriteBatch.Begin(); } int num11 = x - index7 * Main.textureMaxWidth; int num12 = y - index8 * Main.textureMaxHeight; Microsoft.Xna.Framework.Color mapTileXnaColor = MapHelper.GetMapTileXnaColor(ref tile); Main.spriteBatch.Draw(TextureAssets.MagicPixel.Value, new Vector2((float) num11, (float) num12), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1)), mapTileXnaColor, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } } MapHelper.numUpdateTile = 0; if (flag) { Main.spriteBatch.End(); this.GraphicsDevice.SetRenderTarget((RenderTarget2D) null); } Main.mapReady = true; Main.loadMapLastX = 0; Main.loadMap = false; Main.loadMapLock = false; } protected void DrawToMap_Section(int secX, int secY) { Stopwatch stopwatch = Stopwatch.StartNew(); Microsoft.Xna.Framework.Color[] mapColorCacheArray = Main._mapColorCacheArray; int num1 = secX * 200; int num2 = num1 + 200; int num3 = secY * 150; int num4 = num3 + 150; int i = num1 / Main.textureMaxWidth; int j = num3 / Main.textureMaxHeight; int num5 = num1 % Main.textureMaxWidth; int num6 = num3 % Main.textureMaxHeight; if (!this.checkMap(i, j)) return; int index = 0; Microsoft.Xna.Framework.Color transparent = Microsoft.Xna.Framework.Color.Transparent; for (int y = num3; y < num4; ++y) { for (int x = num1; x < num2; ++x) { MapTile tile = Main.Map[x, y]; mapColorCacheArray[index] = MapHelper.GetMapTileXnaColor(ref tile); ++index; } } try { this.GraphicsDevice.SetRenderTarget(this.mapTarget[i, j]); } catch (ObjectDisposedException ex) { Main.initMap[i, j] = false; return; } Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); TimeSpan elapsed = stopwatch.Elapsed; double totalMilliseconds1 = elapsed.TotalMilliseconds; this.mapSectionTexture.SetData(mapColorCacheArray, 0, mapColorCacheArray.Length); elapsed = stopwatch.Elapsed; double totalMilliseconds2 = elapsed.TotalMilliseconds; elapsed = stopwatch.Elapsed; totalMilliseconds1 = elapsed.TotalMilliseconds; Main.spriteBatch.Draw((Texture2D) this.mapSectionTexture, new Vector2((float) num5, (float) num6), Microsoft.Xna.Framework.Color.White); Main.spriteBatch.End(); this.GraphicsDevice.SetRenderTarget((RenderTarget2D) null); elapsed = stopwatch.Elapsed; double totalMilliseconds3 = elapsed.TotalMilliseconds; stopwatch.Stop(); } public static string ValueToCoins(int value) { int num1 = value; int num2 = 0; int num3 = 0; int num4 = 0; while (num1 >= 1000000) { num1 -= 1000000; ++num2; } while (num1 >= 10000) { num1 -= 10000; ++num3; } while (num1 >= 100) { num1 -= 100; ++num4; } int num5 = num1; string str = ""; if (num2 > 0) str += string.Format("{0} {1} ", (object) num2, (object) Language.GetTextValue("Currency.Platinum").ToLower()); if (num3 > 0) str += string.Format("{0} {1} ", (object) num3, (object) Language.GetTextValue("Currency.Gold").ToLower()); if (num4 > 0) str += string.Format("{0} {1} ", (object) num4, (object) Language.GetTextValue("Currency.Silver").ToLower()); if (num5 > 0) str += string.Format("{0} {1} ", (object) num5, (object) Language.GetTextValue("Currency.Copper").ToLower()); if (str.Length > 0) str = str.Substring(0, str.Length - 1); return str; } private static void UpdateMinimapAnchors() { int num1 = 240; int num2 = 240; Main._minimapTopRightAnchorOffsetTowardsLeft = 292; Main._minimapTopRightAnchorOffsetTowardsBottom = 90; Main._minimapTopRightAnchorOffsetTowardsLeft = (int) ((double) (52 + num1 / 2) + (double) Main.MapScale * (double) num1 / 2.0); Main._minimapTopRightAnchorOffsetTowardsBottom = (int) ((double) (90 + num2 / 2) - (double) Main.MapScale * (double) num2 / 2.0); Main._minimapTopRightAnchorOffsetTowardsLeft = 52 + (int) (240.0 * (double) Main.MapScale); Main._minimapTopRightAnchorOffsetTowardsBottom = 90; } protected void DrawMap(GameTime gameTime) { string cursorText = ""; if (!Main.mapEnabled || !Main.mapReady) return; float num1 = 0.0f; float num2 = 0.0f; float num3 = num1; float num4 = num2; byte alpha = byte.MaxValue; int num5 = Main.maxTilesX / Main.textureMaxWidth; int num6 = Main.maxTilesY / Main.textureMaxHeight; float offScreenTiles1 = (float) Lighting.OffScreenTiles; float offScreenTiles2 = (float) Lighting.OffScreenTiles; float num7 = (float) (Main.maxTilesX - Lighting.OffScreenTiles - 1); float num8 = (float) (Main.maxTilesY - Lighting.OffScreenTiles - 42); float num9 = 0.0f; float num10 = 0.0f; float num11 = 10f; float num12 = 10f; float num13 = (float) (Main.maxTilesX - 10); float num14 = (float) (Main.maxTilesY - 10); for (int index1 = 0; index1 < this.mapTarget.GetLength(0); ++index1) { for (int index2 = 0; index2 < this.mapTarget.GetLength(1); ++index2) { if (this.mapTarget[index1, index2] != null) { if (this.mapTarget[index1, index2].IsContentLost && !Main.mapWasContentLost[index1, index2]) { Main.mapWasContentLost[index1, index2] = true; Main.refreshMap = true; Main.clearMap = true; } else if (!this.mapTarget[index1, index2].IsContentLost && Main.mapWasContentLost[index1, index2]) Main.mapWasContentLost[index1, index2] = false; } } } float num15 = 200f; float num16 = 300f; float num17 = 0.0f; float num18 = 0.0f; float num19 = num13 - 1f; float num20 = num14 - 1f; float num21 = !Main.mapFullscreen ? (Main.mapStyle != 1 ? Main.mapOverlayScale : Main.mapMinimapScale) : Main.mapFullscreenScale; bool flag1 = false; float mapScale = Main.MapScale; float num22 = 1f / mapScale; int mouseX = Main.mouseX; int mouseY = Main.mouseY; Matrix uiScaleMatrix = Main.UIScaleMatrix; Matrix transformMatrix1 = uiScaleMatrix; Matrix transformMatrix2 = uiScaleMatrix; Matrix scale = Matrix.CreateScale(mapScale); int index3 = -1; if (Main.mapStyle != 1) transformMatrix1 = Matrix.Identity; if (Main.mapFullscreen) transformMatrix1 = Matrix.Identity; if (!Main.mapFullscreen && Main.mapStyle == 1) { transformMatrix1 *= scale; transformMatrix2 *= scale; } if (!Main.mapFullscreen) { Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, (Effect) null, transformMatrix1); if ((double) num21 > 1.0) flag1 = true; } if (Main.mapFullscreen) { if (Main.mouseLeft && this.IsActive && !CaptureManager.Instance.UsingMap) { if (Main.mouseLeftRelease) { Main.grabMapX = (float) Main.mouseX; Main.grabMapY = (float) Main.mouseY; } else { float num23 = (float) Main.mouseX - Main.grabMapX; float num24 = (float) Main.mouseY - Main.grabMapY; Main.grabMapX = (float) Main.mouseX; Main.grabMapY = (float) Main.mouseY; float num25 = num23 * 0.06255f; float num26 = num24 * 0.06255f; Main.mapFullscreenPos.X -= num25 * (16f / Main.mapFullscreenScale); Main.mapFullscreenPos.Y -= num26 * (16f / Main.mapFullscreenScale); } } Main.player[Main.myPlayer].mouseInterface = true; float num27 = (float) ((double) Main.screenWidth / (double) Main.maxTilesX * 0.598999977111816); if ((double) Main.mapFullscreenScale < (double) num27) Main.mapFullscreenScale = num27; if ((double) Main.mapFullscreenScale > 31.2000007629395) Main.mapFullscreenScale = 31.18f; num21 = Main.mapFullscreenScale; alpha = byte.MaxValue; if ((double) Main.mapFullscreenPos.X < (double) num11) Main.mapFullscreenPos.X = num11; if ((double) Main.mapFullscreenPos.X > (double) num13) Main.mapFullscreenPos.X = num13; if ((double) Main.mapFullscreenPos.Y < (double) num12) Main.mapFullscreenPos.Y = num12; if ((double) Main.mapFullscreenPos.Y > (double) num14) Main.mapFullscreenPos.Y = num14; float num28 = Main.mapFullscreenPos.X; float num29 = Main.mapFullscreenPos.Y; if (Main.resetMapFull) { Main.resetMapFull = false; num28 = (float) (((double) Main.screenPosition.X + (double) (Main.screenWidth / 2)) / 16.0); num29 = (float) (((double) Main.screenPosition.Y + (double) (Main.screenHeight / 2)) / 16.0); Main.mapFullscreenPos.X = num28; Main.mapFullscreenPos.Y = num29; } float num30 = num28 * num21; float num31 = num29 * num21; float num32 = -num30 + (float) (Main.screenWidth / 2); float num33 = -num31 + (float) (Main.screenHeight / 2); num15 = num32 + num11 * num21; num16 = num33 + num12 * num21; float num34 = (float) (Main.maxTilesX / 840) * Main.mapFullscreenScale; float num35 = num15; float num36 = num16; float num37 = (float) TextureAssets.Map.Width(); float num38 = (float) TextureAssets.Map.Height(); switch (Main.maxTilesX) { case 4200: float num39 = num34 * 0.998f; num35 -= 37.3f * num39; num36 -= 1.7f * num39; num37 = (num37 - 16f) * num39; num38 = (num38 - 8.31f) * num39; break; case 6300: float num40 = num34 * 1.09f; num35 -= 39.8f * num40; num36 = num16 - 4.08f * num40; num37 = (num37 - 26.69f) * num40; num38 = (num38 - 6.92f) * num40; if ((double) num40 < 1.2) { num38 += 2f; break; } break; case 6400: float num41 = num34 * 1.09f; num35 -= 38.8f * num41; num36 = num16 - 3.85f * num41; num37 = (num37 - 13.6f) * num41; num38 = (num38 - 6.92f) * num41; if ((double) num41 < 1.2) { num38 += 2f; break; } break; case 8400: float num42 = num34 * 0.999f; num35 -= 40.6f * num42; num36 = num16 - 5f * num42; num37 = (num37 - 8.045f) * num42; num38 = (num38 + 0.12f) * num42; if ((double) num42 < 1.2) { ++num38; break; } break; } Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise); flag1 = true; Main.DrawMapFullscreenBackground(Main.screenPosition, Main.screenWidth, Main.screenHeight); Microsoft.Xna.Framework.Rectangle destinationRectangle = new Microsoft.Xna.Framework.Rectangle((int) num35, (int) num36, (int) num37, (int) num38); Main.spriteBatch.Draw(TextureAssets.Map.Value, destinationRectangle, Microsoft.Xna.Framework.Color.White); if (Main.mouseLeft && Main.mouseLeftRelease) { double totalSeconds = gameTime.TotalGameTime.TotalSeconds; if (totalSeconds - Main._lastPingMouseDownTime < 0.5 && (double) Vector2.Distance(Main.MouseScreen, Main._lastPingMousePosition) < 2.0) Main.TriggerPing((Main.MouseScreen - new Vector2(num15 - 10f * num21, num16 - 10f * num21)) / num21); Main._lastPingMouseDownTime = totalSeconds; Main._lastPingMousePosition = Main.MouseScreen; } if ((double) num21 < 1.0) { Main.spriteBatch.End(); Main.spriteBatch.Begin(); flag1 = false; } } else { switch (Main.mapStyle) { case 1: Main.UpdateMinimapAnchors(); Main.miniMapWidth = 240; Main.miniMapHeight = 240; Main.miniMapX = Main.screenWidth - Main._minimapTopRightAnchorOffsetTowardsLeft; Main.miniMapY = Main._minimapTopRightAnchorOffsetTowardsBottom; Main.miniMapX = (int) ((double) Main.miniMapX * (double) num22); Main.miniMapY = (int) ((double) Main.miniMapY * (double) num22); Main.mouseX = (int) ((double) Main.mouseX * (double) num22); Main.mouseY = (int) ((double) Main.mouseY * (double) num22); double num43 = (double) Main.miniMapHeight / (double) Main.maxTilesY; if ((double) Main.mapMinimapScale < 0.2) Main.mapMinimapScale = 0.2f; if ((double) Main.mapMinimapScale > 3.0) Main.mapMinimapScale = 3f; if ((double) Main.mapMinimapAlpha < 0.01) Main.mapMinimapAlpha = 0.01f; if ((double) Main.mapMinimapAlpha > 1.0) Main.mapMinimapAlpha = 1f; num21 = Main.mapMinimapScale; alpha = (byte) ((double) byte.MaxValue * (double) Main.mapMinimapAlpha); num15 = (float) Main.miniMapX; num16 = (float) Main.miniMapY; num3 = num15; num4 = num16; double num44 = ((double) Main.screenPosition.X + (double) (PlayerInput.RealScreenWidth / 2)) / 16.0; float num45 = (float) (((double) Main.screenPosition.Y + (double) (PlayerInput.RealScreenHeight / 2)) / 16.0); num9 = (float) -(num44 - (double) (int) (((double) Main.screenPosition.X + (double) (PlayerInput.RealScreenWidth / 2)) / 16.0)) * num21; num10 = (float) -((double) num45 - (double) (int) (((double) Main.screenPosition.Y + (double) (PlayerInput.RealScreenHeight / 2)) / 16.0)) * num21; num19 = (float) Main.miniMapWidth / num21; num20 = (float) Main.miniMapHeight / num21; num17 = (float) (int) num44 - num19 / 2f; num18 = (float) (int) num45 - num20 / 2f; double num46 = (double) Main.maxTilesY + (double) num18; float num47 = num3 - 6f; float num48 = num4 - 6f; Main.ActiveMinimapFrame.MinimapPosition = new Vector2(num47 + 10f, num48 + 10f); Main.ActiveMinimapFrame.Update(); Main.ActiveMinimapFrame.DrawBackground(Main.spriteBatch); break; case 2: float num49 = (float) Main.screenWidth / (float) Main.maxTilesX; if ((double) Main.mapOverlayScale < (double) num49) Main.mapOverlayScale = num49; if ((double) Main.mapOverlayScale > 16.0 * (double) Main.GameViewMatrix.Zoom.X) Main.mapOverlayScale = 16f * Main.GameViewMatrix.Zoom.X; if ((double) Main.mapOverlayAlpha < 0.01) Main.mapOverlayAlpha = 0.01f; if ((double) Main.mapOverlayAlpha > 1.0) Main.mapOverlayAlpha = 1f; num21 = Main.mapOverlayScale; alpha = (byte) ((double) byte.MaxValue * (double) Main.mapOverlayAlpha); int maxTilesX = Main.maxTilesX; int maxTilesY = Main.maxTilesY; float num50 = (float) (((double) Main.screenPosition.X + (double) (Main.screenWidth / 2)) / 16.0); double num51 = ((double) Main.screenPosition.Y + (double) (Main.screenHeight / 2)) / 16.0; float num52 = num50 * num21; double num53 = (double) num21; double num54 = num51 * num53; float num55 = -num52 + (float) (Main.screenWidth / 2); float num56 = (float) -num54 + (float) (Main.screenHeight / 2); num15 = num55 + num11 * num21; num16 = num56 + num12 * num21; break; } } if (Main.mapStyle == 1 && !Main.mapFullscreen) { if ((double) num17 < (double) num11) num15 -= (num17 - num11) * num21; if ((double) num18 < (double) num12) num16 -= (num18 - num12) * num21; } float num57 = num17 + num19; float num58 = num18 + num20; if ((double) num17 > (double) num11) num11 = num17; if ((double) num18 > (double) num12) num12 = num18; if ((double) num57 < (double) num13) num13 = num57; if ((double) num58 < (double) num14) num14 = num58; float num59 = (float) Main.textureMaxWidth * num21; float num60 = (float) Main.textureMaxHeight * num21; float num61 = num15; float num62 = 0.0f; for (int index4 = 0; index4 <= 4; ++index4) { if ((double) ((index4 + 1) * Main.textureMaxWidth) > (double) num11 && (double) (index4 * Main.textureMaxWidth) < (double) num11 + (double) num13) { for (int index5 = 0; index5 <= num6; ++index5) { if ((double) ((index5 + 1) * Main.textureMaxHeight) > (double) num12 && (double) (index5 * Main.textureMaxHeight) < (double) num12 + (double) num14) { float num63 = num15 + (float) (int) ((double) index4 * (double) num59); float num64 = num16 + (float) (int) ((double) index5 * (double) num60); float num65 = (float) (index4 * Main.textureMaxWidth); float num66 = (float) (index5 * Main.textureMaxHeight); float num67 = 0.0f; float num68 = 0.0f; float num69; if ((double) num65 < (double) num11) { num67 = num11 - num65; num69 = num15; } else num69 = num63 - num11 * num21; float num70; if ((double) num66 < (double) num12) { num68 = num12 - num66; num70 = num16; } else num70 = num64 - num12 * num21; float num71 = num61; float textureMaxWidth = (float) Main.textureMaxWidth; float textureMaxHeight = (float) Main.textureMaxHeight; float num72 = (float) ((index4 + 1) * Main.textureMaxWidth); float num73 = (float) ((index5 + 1) * Main.textureMaxHeight); if ((double) num72 >= (double) num13) textureMaxWidth -= num72 - num13; if ((double) num73 >= (double) num14) textureMaxHeight -= num73 - num14; float x = num71 + num9; float y = num70 + num10; if ((double) textureMaxWidth > (double) num67) { Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) num67, (int) num68, (int) textureMaxWidth - (int) num67, (int) textureMaxHeight - (int) num68); Main.spriteBatch.Draw((Texture2D) this.mapTarget[index4, index5], new Vector2(x, y), new Microsoft.Xna.Framework.Rectangle?(rectangle), new Microsoft.Xna.Framework.Color((int) alpha, (int) alpha, (int) alpha, (int) alpha), 0.0f, new Vector2(), num21, SpriteEffects.None, 0.0f); } num62 = (float) ((int) textureMaxWidth - (int) num67) * num21; } if (index5 == num6) num61 += num62; } } } if (flag1) { Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, (Effect) null, transformMatrix1); } if (!Main.mapFullscreen) { if (Main.mapStyle == 2) { float num74 = (float) (((double) num21 * 0.200000002980232 * 2.0 + 1.0) / 3.0); if ((double) num74 > 1.0) num74 = 1f; float num75 = num74 * Main.UIScale; Main.MapIcons.Draw(Vector2.Zero, new Vector2(num15 - 10f * num21, num16 - 10f * num21), new Microsoft.Xna.Framework.Rectangle?(), num21, num75, ref cursorText); CoinLossRevengeSystem.RevengeMarker revengeMarker = NPC.RevengeManager.DrawMapIcons(Main.spriteBatch, Vector2.Zero, new Vector2(num15 - 10f * num21, num16 - 10f * num21), new Microsoft.Xna.Framework.Rectangle?(), num21, num75, ref cursorText); this.DrawMiscMapIcons(Main.spriteBatch, Vector2.Zero, new Vector2(num15 - 10f * num21, num16 - 10f * num21), new Microsoft.Xna.Framework.Rectangle?(), num21, num75, ref cursorText); Main.spriteBatch.End(); if (revengeMarker != null) { Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, (Effect) null, uiScaleMatrix); try { revengeMarker.UseMouseOver(Main.spriteBatch, ref cursorText, num75); } catch (Exception ex) { TimeLogger.DrawException(ex); } Main.spriteBatch.End(); } Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, (Effect) null, transformMatrix1); try { for (int index6 = 0; index6 < 200; ++index6) { if (Main.npc[index6].active && Main.npc[index6].townNPC) { ITownNPCProfile profile; int npcID = !TownNPCProfiles.Instance.GetProfile(Main.npc[index6].type, out profile) ? NPC.TypeToDefaultHeadIndex(Main.npc[index6].type) : profile.GetHeadTextureIndex(Main.npc[index6]); if (npcID > 0) { SpriteEffects dir = SpriteEffects.None; if (Main.npc[index6].direction > 0) dir = SpriteEffects.FlipHorizontally; float num76 = (float) (((double) Main.npc[index6].position.X + (double) (Main.npc[index6].width / 2)) / 16.0) * num21; float num77 = (float) (((double) Main.npc[index6].position.Y + (double) (Main.npc[index6].height / 2)) / 16.0) * num21; float num78 = num76 + num15; float num79 = num77 + num16; float x = num78 - 10f * num21; float y = num79 - 10f * num21; Main.DrawNPCHeadFriendly((Entity) Main.npc[index6], alpha, num75, dir, npcID, x, y); } } if (Main.npc[index6].active && Main.npc[index6].GetBossHeadTextureIndex() != -1) { float bossHeadRotation = Main.npc[index6].GetBossHeadRotation(); SpriteEffects headSpriteEffects = Main.npc[index6].GetBossHeadSpriteEffects(); Vector2 vector2 = Main.npc[index6].Center + new Vector2(0.0f, Main.npc[index6].gfxOffY); if (Main.npc[index6].type == 134) { Vector2 center = Main.npc[index6].Center; int num80 = 1; for (int index7 = (int) Main.npc[index6].ai[0]; num80 < 15 && Main.npc[index7].active && Main.npc[index7].type >= 134 && Main.npc[index7].type <= 136; index7 = (int) Main.npc[index7].ai[0]) { ++num80; center += Main.npc[index7].Center; } vector2 = center / (float) num80; } int headTextureIndex = Main.npc[index6].GetBossHeadTextureIndex(); float num81 = vector2.X / 16f * num21; float num82 = vector2.Y / 16f * num21; float num83 = num81 + num15; float num84 = num82 + num16; float x = num83 - 10f * num21; float y = num84 - 10f * num21; Main.DrawNPCHeadBoss((Entity) Main.npc[index6], alpha, num75, bossHeadRotation, headSpriteEffects, headTextureIndex, x, y); } } } catch (Exception ex) { TimeLogger.DrawException(ex); } Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, (Effect) null, transformMatrix1); for (int index8 = 0; index8 < (int) byte.MaxValue; ++index8) { if (Main.player[index8].active && !Main.player[index8].dead && index8 != Main.myPlayer && (!Main.player[Main.myPlayer].hostile && !Main.player[index8].hostile || Main.player[Main.myPlayer].team == Main.player[index8].team && Main.player[index8].team != 0 || index8 == Main.myPlayer)) { float num85 = (float) (((double) Main.player[index8].position.X + (double) (Main.player[index8].width / 2)) / 16.0) * num21; float num86 = Main.player[index8].position.Y / 16f * num21; float num87 = num85 + num15; float num88 = num86 + num16; float num89 = num87 - 6f; float num90 = num88 - 2f - (float) (2.0 - (double) num21 / 5.0 * 2.0); float x = num89 - 10f * num21; float y = num90 - 10f * num21; Microsoft.Xna.Framework.Color headBordersColor = Main.GetPlayerHeadBordersColor(Main.player[index8]); Main.MapPlayerRenderer.DrawPlayerHead(Main.Camera, Main.player[index8], new Vector2(x, y), (float) alpha / (float) byte.MaxValue, num75, headBordersColor); } } Main.spriteBatch.End(); Main.spriteBatch.Begin(); } if (Main.mapStyle == 1) { float num91 = (float) (((double) num21 * 0.25 * 2.0 + 1.0) / 3.0); if ((double) num91 > 1.0) num91 = 1f; Main.MapIcons.Draw(new Vector2(num17, num18), new Vector2(num3 + num9, num4 + num10), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(Main.miniMapX, Main.miniMapY, Main.miniMapWidth, Main.miniMapHeight)), num21, num91, ref cursorText); CoinLossRevengeSystem.RevengeMarker revengeMarker = NPC.RevengeManager.DrawMapIcons(Main.spriteBatch, new Vector2(num17, num18), new Vector2(num3 + num9, num4 + num10), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(Main.miniMapX, Main.miniMapY, Main.miniMapWidth, Main.miniMapHeight)), num21, num91, ref cursorText); this.DrawMiscMapIcons(Main.spriteBatch, new Vector2(num17, num18), new Vector2(num3 + num9, num4 + num10), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(Main.miniMapX, Main.miniMapY, Main.miniMapWidth, Main.miniMapHeight)), num21, num91, ref cursorText); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, (Effect) null, transformMatrix2); for (int index9 = 0; index9 < 200; ++index9) { if (Main.npc[index9].active && Main.npc[index9].townNPC) { ITownNPCProfile profile; int npcID = !TownNPCProfiles.Instance.GetProfile(Main.npc[index9].type, out profile) ? NPC.TypeToDefaultHeadIndex(Main.npc[index9].type) : profile.GetHeadTextureIndex(Main.npc[index9]); if (npcID > 0) { SpriteEffects dir = SpriteEffects.None; if (Main.npc[index9].direction > 0) dir = SpriteEffects.FlipHorizontally; float num92 = ((float) (((double) Main.npc[index9].position.X + (double) Main.npc[index9].width / 2.0) / 16.0) - num17) * num21; float num93 = ((float) (((double) Main.npc[index9].position.Y + (double) Main.npc[index9].gfxOffY + (double) Main.npc[index9].height / 2.0) / 16.0) - num18) * num21; float num94 = num92 + num3; float num95 = num93 + num4 - (float) (2.0 * (double) num21 / 5.0); float x = num94 + num9; float y = num95 + num10; if ((double) x > (double) (Main.miniMapX + 12) && (double) x < (double) (Main.miniMapX + Main.miniMapWidth - 16) && (double) y > (double) (Main.miniMapY + 10) && (double) y < (double) (Main.miniMapY + Main.miniMapHeight - 14)) { float num96 = x - (float) (TextureAssets.NpcHead[npcID].Width() / 2) * num91; float num97 = y - (float) (TextureAssets.NpcHead[npcID].Height() / 2) * num91; float num98 = num96 + (float) TextureAssets.NpcHead[npcID].Width() * num91; float num99 = num97 + (float) TextureAssets.NpcHead[npcID].Height() * num91; if ((double) Main.mouseX >= (double) num96 && (double) Main.mouseX <= (double) num98 && (double) Main.mouseY >= (double) num97 && (double) Main.mouseY <= (double) num99) cursorText = Main.npc[index9].FullName; Main.DrawNPCHeadFriendly((Entity) Main.npc[index9], alpha, num91, dir, npcID, x, y); } } } if (Main.npc[index9].active && Main.npc[index9].GetBossHeadTextureIndex() != -1) { float bossHeadRotation = Main.npc[index9].GetBossHeadRotation(); SpriteEffects headSpriteEffects = Main.npc[index9].GetBossHeadSpriteEffects(); Vector2 vector2 = Main.npc[index9].Center + new Vector2(0.0f, Main.npc[index9].gfxOffY); if (Main.npc[index9].type == 134) { Vector2 center = Main.npc[index9].Center; int num100 = 1; for (int index10 = (int) Main.npc[index9].ai[0]; num100 < 15 && Main.npc[index10].active && Main.npc[index10].type >= 134 && Main.npc[index10].type <= 136; index10 = (int) Main.npc[index10].ai[0]) { ++num100; center += Main.npc[index10].Center; } vector2 = center / (float) num100; } int headTextureIndex = Main.npc[index9].GetBossHeadTextureIndex(); float num101 = (vector2.X / 16f - num17) * num21; float num102 = (vector2.Y / 16f - num18) * num21; float num103 = num101 + num3; float num104 = num102 + num4 - (float) (2.0 * (double) num21 / 5.0); float x = num103 + num9; float y = num104 + num10; if ((double) x > (double) (Main.miniMapX + 12) && (double) x < (double) (Main.miniMapX + Main.miniMapWidth - 16) && (double) y > (double) (Main.miniMapY + 10) && (double) y < (double) (Main.miniMapY + Main.miniMapHeight - 14)) { float num105 = x - (float) (TextureAssets.NpcHeadBoss[headTextureIndex].Width() / 2) * num91; float num106 = y - (float) (TextureAssets.NpcHeadBoss[headTextureIndex].Height() / 2) * num91; float num107 = num105 + (float) TextureAssets.NpcHeadBoss[headTextureIndex].Width() * num91; float num108 = num106 + (float) TextureAssets.NpcHeadBoss[headTextureIndex].Height() * num91; if ((double) Main.mouseX >= (double) num105 && (double) Main.mouseX <= (double) num107 && (double) Main.mouseY >= (double) num106 && (double) Main.mouseY <= (double) num108) cursorText = Main.npc[index9].GivenOrTypeName; Main.DrawNPCHeadBoss((Entity) Main.npc[index9], alpha, num91, bossHeadRotation, headSpriteEffects, headTextureIndex, x, y); } } } Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, (Effect) null, transformMatrix2); for (int index11 = 0; index11 < (int) byte.MaxValue; ++index11) { if (Main.player[index11].active && (!Main.player[Main.myPlayer].hostile && !Main.player[index11].hostile || Main.player[Main.myPlayer].team == Main.player[index11].team && Main.player[index11].team != 0 || index11 == Main.myPlayer)) { float num109 = ((float) (((double) Main.player[index11].position.X + (double) (Main.player[index11].width / 2)) / 16.0) - num17) * num21; float num110 = ((float) (((double) Main.player[index11].position.Y + (double) Main.player[index11].gfxOffY + (double) (Main.player[index11].height / 2)) / 16.0) - num18) * num21; float num111 = num109 + num3; float num112 = num110 + num4; float num113 = num111 - 6f; float num114 = num112 - 6f - (float) (2.0 - (double) num21 / 5.0 * 2.0); float x1 = num113 + num9; float y1 = num114 + num10; if (!Main.player[index11].dead && (double) x1 > (double) (Main.miniMapX + 6) && (double) x1 < (double) (Main.miniMapX + Main.miniMapWidth - 16) && (double) y1 > (double) (Main.miniMapY + 6) && (double) y1 < (double) (Main.miniMapY + Main.miniMapHeight - 14)) { Microsoft.Xna.Framework.Color headBordersColor = Main.GetPlayerHeadBordersColor(Main.player[index11]); Main.MapPlayerRenderer.DrawPlayerHead(Main.Camera, Main.player[index11], new Vector2(x1, y1), (float) alpha / (float) byte.MaxValue, num91, headBordersColor); if (index11 != Main.myPlayer) { float num115 = (float) ((double) x1 + 4.0 - 14.0 * (double) num91); float num116 = (float) ((double) y1 + 2.0 - 14.0 * (double) num91); float num117 = num115 + 28f * num91; float num118 = num116 + 28f * num91; if ((double) Main.mouseX >= (double) num115 && (double) Main.mouseX <= (double) num117 && (double) Main.mouseY >= (double) num116 && (double) Main.mouseY <= (double) num118) cursorText = Main.player[index11].name; } } if (Main.player[index11].showLastDeath) { float num119 = (Main.player[index11].lastDeathPostion.X / 16f - num17) * num21; float num120 = (Main.player[index11].lastDeathPostion.Y / 16f - num18) * num21; float num121 = num119 + num3; float num122 = num120 + num4 - (float) (2.0 - (double) num21 / 5.0 * 2.0); float x2 = num121 + num9; float y2 = num122 + num10; if ((double) x2 > (double) (Main.miniMapX + 8) && (double) x2 < (double) (Main.miniMapX + Main.miniMapWidth - 18) && (double) y2 > (double) (Main.miniMapY + 8) && (double) y2 < (double) (Main.miniMapY + Main.miniMapHeight - 16)) { Main.spriteBatch.Draw(TextureAssets.MapDeath.Value, new Vector2(x2, y2), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.MapDeath.Width(), TextureAssets.MapDeath.Height())), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2((float) TextureAssets.MapDeath.Width() * 0.5f, (float) TextureAssets.MapDeath.Height() * 0.5f), num91, SpriteEffects.None, 0.0f); float num123 = (float) ((double) x2 + 4.0 - 14.0 * (double) num91); float num124 = (float) ((double) y2 + 2.0 - 14.0 * (double) num91); float num125 = num123 - 4f; float num126 = num124 - 4f; float num127 = num125 + 28f * num91; float num128 = num126 + 28f * num91; if ((double) Main.mouseX >= (double) num125 && (double) Main.mouseX <= (double) num127 && (double) Main.mouseY >= (double) num126 && (double) Main.mouseY <= (double) num128) index3 = index11; } } } } Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, (Effect) null, transformMatrix2); Main.ActiveMinimapFrame.DrawForeground(Main.spriteBatch); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, (Effect) null, uiScaleMatrix); if (index3 != -1) { TimeSpan time = DateTime.Now - Main.player[index3].lastDeathTime; cursorText = Language.GetTextValue("Game.PlayerDeathTime", (object) Main.player[index3].name, (object) Lang.LocalizedDuration(time, false, false)); } else revengeMarker?.UseMouseOver(Main.spriteBatch, ref cursorText); } } if (Main.mapFullscreen) { int x3 = (int) ((-(double) num15 + (double) Main.mouseX) / (double) num21 + (double) num11); int y3 = (int) ((-(double) num16 + (double) Main.mouseY) / (double) num21 + (double) num12); bool flag2 = false; if ((double) x3 < (double) num11) flag2 = true; if ((double) x3 >= (double) num13) flag2 = true; if ((double) y3 < (double) num12) flag2 = true; if ((double) y3 >= (double) num14) flag2 = true; if (!flag2 && Main.Map[x3, y3].Light > (byte) 40) { int type = (int) Main.Map[x3, y3].Type; int num129 = (int) MapHelper.tileLookup[21]; int num130 = (int) MapHelper.tileLookup[441]; int tileOptionCount1 = MapHelper.tileOptionCounts[21]; int num131 = (int) MapHelper.tileLookup[467]; int num132 = (int) MapHelper.tileLookup[468]; int tileOptionCount2 = MapHelper.tileOptionCounts[467]; int num133 = (int) MapHelper.tileLookup[88]; int tileOptionCount3 = MapHelper.tileOptionCounts[88]; LocalizedText[] chestType = Lang.chestType; LocalizedText[] chestType2 = Lang.chestType2; if (type >= num129 && type < num129 + tileOptionCount1) { Tile chestTile = Main.tile[x3, y3]; if (chestTile != null) { int x4 = x3; int y4 = y3; if ((int) chestTile.frameX % 36 != 0) --x4; if ((int) chestTile.frameY % 36 != 0) --y4; cursorText = Main.DrawMap_FindChestName(chestType, chestTile, x4, y4); } } else if (type >= num131 && type < num131 + tileOptionCount2) { Tile chestTile = Main.tile[x3, y3]; if (chestTile != null) { int x5 = x3; int y5 = y3; if ((int) chestTile.frameX % 36 != 0) --x5; if ((int) chestTile.frameY % 36 != 0) --y5; cursorText = Main.DrawMap_FindChestName(chestType2, chestTile, x5, y5); } } else if (type >= num130 && type < num130 + tileOptionCount1) { Tile tile = Main.tile[x3, y3]; if (tile != null) { int num134 = x3; int num135 = y3; if ((int) tile.frameX % 36 != 0) { int num136 = num134 - 1; } if ((int) tile.frameY % 36 != 0) { int num137 = num135 - 1; } cursorText = chestType[(int) tile.frameX / 36].Value; } } else if (type >= num132 && type < num132 + tileOptionCount2) { Tile tile = Main.tile[x3, y3]; if (tile != null) { int num138 = x3; int num139 = y3; if ((int) tile.frameX % 36 != 0) { int num140 = num138 - 1; } if ((int) tile.frameY % 36 != 0) { int num141 = num139 - 1; } cursorText = chestType2[(int) tile.frameX / 36].Value; } } else if (type >= num133 && type < num133 + tileOptionCount3) { Tile tile = Main.tile[x3, y3]; if (tile != null) { int num142 = x3; int num143 = y3; int num144 = (int) tile.frameX % 54 / 18; int X = num142 - num144; if ((int) tile.frameY % 36 != 0) --num143; int Y = num143; int chest = Chest.FindChest(X, Y); cursorText = chest >= 0 ? (!(Main.chest[chest].name != "") ? Lang.dresserType[(int) tile.frameX / 54].Value : Lang.dresserType[(int) tile.frameX / 54].Value + ": " + Main.chest[chest].name) : Lang.dresserType[0].Value; } } else cursorText = Lang.GetMapObjectName(type); } float num145; if (((double) num21 * 0.25 * 2.0 + 1.0) / 3.0 > 1.0) num145 = 1f; num145 = 1f; float uiScale = Main.UIScale; CoinLossRevengeSystem.RevengeMarker revengeMarker = NPC.RevengeManager.DrawMapIcons(Main.spriteBatch, Vector2.Zero, new Vector2(num15 - 10f * num21, num16 - 10f * num21), new Microsoft.Xna.Framework.Rectangle?(), num21, uiScale, ref cursorText); this.DrawMiscMapIcons(Main.spriteBatch, Vector2.Zero, new Vector2(num15 - 10f * num21, num16 - 10f * num21), new Microsoft.Xna.Framework.Rectangle?(), num21, uiScale, ref cursorText); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); for (int index12 = 0; index12 < 200; ++index12) { if (Main.npc[index12].active && Main.npc[index12].townNPC) { ITownNPCProfile profile; int npcID = !TownNPCProfiles.Instance.GetProfile(Main.npc[index12].type, out profile) ? NPC.TypeToDefaultHeadIndex(Main.npc[index12].type) : profile.GetHeadTextureIndex(Main.npc[index12]); if (npcID > 0) { SpriteEffects dir = SpriteEffects.None; if (Main.npc[index12].direction > 0) dir = SpriteEffects.FlipHorizontally; float num146 = (float) (((double) Main.npc[index12].position.X + (double) (Main.npc[index12].width / 2)) / 16.0) * num21; float num147 = (float) (((double) Main.npc[index12].position.Y + (double) Main.npc[index12].gfxOffY + (double) (Main.npc[index12].height / 2)) / 16.0) * num21; float num148 = num146 + num15; float num149 = num147 + num16; float x6 = num148 - 10f * num21; float y6 = num149 - 10f * num21; float num150 = x6 - (float) (TextureAssets.NpcHead[npcID].Width() / 2) * uiScale; float num151 = y6 - (float) (TextureAssets.NpcHead[npcID].Height() / 2) * uiScale; float num152 = num150 + (float) TextureAssets.NpcHead[npcID].Width() * uiScale; float num153 = num151 + (float) TextureAssets.NpcHead[npcID].Height() * uiScale; if ((double) Main.mouseX >= (double) num150 && (double) Main.mouseX <= (double) num152 && (double) Main.mouseY >= (double) num151 && (double) Main.mouseY <= (double) num153) cursorText = Main.npc[index12].FullName; Main.DrawNPCHeadFriendly((Entity) Main.npc[index12], alpha, uiScale, dir, npcID, x6, y6); } } if (Main.npc[index12].active && Main.npc[index12].GetBossHeadTextureIndex() != -1) { float bossHeadRotation = Main.npc[index12].GetBossHeadRotation(); SpriteEffects headSpriteEffects = Main.npc[index12].GetBossHeadSpriteEffects(); Vector2 vector2 = Main.npc[index12].Center + new Vector2(0.0f, Main.npc[index12].gfxOffY); if (Main.npc[index12].type == 134) { Vector2 center = Main.npc[index12].Center; int num154 = 1; for (int index13 = (int) Main.npc[index12].ai[0]; num154 < 15 && Main.npc[index13].active && Main.npc[index13].type >= 134 && Main.npc[index13].type <= 136; index13 = (int) Main.npc[index13].ai[0]) { ++num154; center += Main.npc[index13].Center; } vector2 = center / (float) num154; } int headTextureIndex = Main.npc[index12].GetBossHeadTextureIndex(); float num155 = vector2.X / 16f * num21; float num156 = vector2.Y / 16f * num21; float num157 = num155 + num15; float num158 = num156 + num16; float x7 = num157 - 10f * num21; float y7 = num158 - 10f * num21; Main.DrawNPCHeadBoss((Entity) Main.npc[index12], alpha, uiScale, bossHeadRotation, headSpriteEffects, headTextureIndex, x7, y7); float num159 = x7 - (float) (TextureAssets.NpcHeadBoss[headTextureIndex].Width() / 2) * uiScale; float num160 = y7 - (float) (TextureAssets.NpcHeadBoss[headTextureIndex].Height() / 2) * uiScale; float num161 = num159 + (float) TextureAssets.NpcHeadBoss[headTextureIndex].Width() * uiScale; float num162 = num160 + (float) TextureAssets.NpcHeadBoss[headTextureIndex].Height() * uiScale; if ((double) Main.mouseX >= (double) num159 && (double) Main.mouseX <= (double) num161 && (double) Main.mouseY >= (double) num160 && (double) Main.mouseY <= (double) num162) cursorText = Main.npc[index12].GivenOrTypeName; } } bool flag3 = false; Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); for (int i = 0; i < (int) byte.MaxValue; ++i) { if (Main.player[i].active && (!Main.player[Main.myPlayer].hostile && !Main.player[i].hostile || Main.player[Main.myPlayer].team == Main.player[i].team && Main.player[i].team != 0 || i == Main.myPlayer) && Main.player[i].showLastDeath && Main.DrawPlayerDeathMarker(num15, num16, num21, num17, num18, uiScale, i)) index3 = i; } if (index3 != -1) { TimeSpan time = DateTime.Now - Main.player[index3].lastDeathTime; cursorText = Language.GetTextValue("Game.PlayerDeathTime", (object) Main.player[index3].name, (object) Lang.LocalizedDuration(time, false, false)); } else if (revengeMarker != null) { Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, (Effect) null, uiScaleMatrix); revengeMarker.UseMouseOver(Main.spriteBatch, ref cursorText, uiScale); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); } for (int index14 = 0; index14 < (int) byte.MaxValue; ++index14) { if (Main.player[index14].active && (!Main.player[Main.myPlayer].hostile && !Main.player[index14].hostile || Main.player[Main.myPlayer].team == Main.player[index14].team && Main.player[index14].team != 0 || index14 == Main.myPlayer)) { float num163 = ((float) (((double) Main.player[index14].position.X + (double) (Main.player[index14].width / 2)) / 16.0) - num17) * num21; float num164 = ((float) (((double) Main.player[index14].position.Y + (double) Main.player[index14].gfxOffY + (double) (Main.player[index14].height / 2)) / 16.0) - num18) * num21; float num165 = num163 + num15; float num166 = num164 + num16; float num167 = num165 - 6f; float num168 = num166 - 2f - (float) (2.0 - (double) num21 / 5.0 * 2.0); float x8 = num167 - 10f * num21; float y8 = num168 - 10f * num21; float num169 = (float) ((double) x8 + 4.0 - 14.0 * (double) uiScale); float num170 = (float) ((double) y8 + 2.0 - 14.0 * (double) uiScale); float num171 = num169 + 28f * uiScale; float num172 = num170 + 28f * uiScale; if (!Main.player[index14].dead) { Microsoft.Xna.Framework.Color headBordersColor = Main.GetPlayerHeadBordersColor(Main.player[index14]); Main.MapPlayerRenderer.DrawPlayerHead(Main.Camera, Main.player[index14], new Vector2(x8, y8), (float) alpha / (float) byte.MaxValue, uiScale, headBordersColor); if ((double) Main.mouseX >= (double) num169 && (double) Main.mouseX <= (double) num171 && (double) Main.mouseY >= (double) num170 && (double) Main.mouseY <= (double) num172) { cursorText = Main.player[index14].name; if (index14 != Main.myPlayer && Main.player[Main.myPlayer].team > 0 && Main.player[Main.myPlayer].team == Main.player[index14].team && Main.netMode == 1 && Main.player[Main.myPlayer].HasUnityPotion() && !flag3 && !Main.cancelWormHole) { flag3 = true; if (!this.unityMouseOver) SoundEngine.PlaySound(12); this.unityMouseOver = true; Microsoft.Xna.Framework.Color favoriteColor = Main.OurFavoriteColor; Main.MapPlayerRenderer.DrawPlayerHead(Main.Camera, Main.player[index14], new Vector2(x8, y8), scale: (uiScale + 0.5f), borderColor: favoriteColor); cursorText = Language.GetTextValue("Game.TeleportTo", (object) Main.player[index14].name); if (Main.mouseLeft && Main.mouseLeftRelease) { Main.mouseLeftRelease = false; Main.mapFullscreen = false; Main.player[Main.myPlayer].UnityTeleport(Main.player[index14].position); Main.player[Main.myPlayer].TakeUnityPotion(); } } } } } } Main.cancelWormHole = false; Main.MapIcons.Draw(Vector2.Zero, new Vector2(num15 - 10f * num21, num16 - 10f * num21), new Microsoft.Xna.Framework.Rectangle?(), num21, uiScale, ref cursorText); if (!flag3 && this.unityMouseOver) this.unityMouseOver = false; Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.SamplerStateForCursor, DepthStencilState.None, RasterizerState.CullCounterClockwise, (Effect) null, Main.UIScaleMatrix); PlayerInput.SetZoom_UI(); int num173 = 10; int num174 = Main.screenHeight - 40; if (Main.showFrameRate) num174 -= 15; int index15 = 0; int num175 = 130; if (Main.mouseX >= num173 && Main.mouseX <= num173 + 32 && Main.mouseY >= num174 && Main.mouseY <= num174 + 30) { num175 = (int) byte.MaxValue; index15 += 4; Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeft && Main.mouseLeftRelease) { SoundEngine.PlaySound(10); Main.mapFullscreen = false; } } Main.spriteBatch.Draw(TextureAssets.MapIcon[index15].Value, new Vector2((float) num173, (float) num174), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.MapIcon[index15].Width(), TextureAssets.MapIcon[index15].Height())), new Microsoft.Xna.Framework.Color(num175, num175, num175, num175), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); Main.DrawCursor(Main.DrawThickCursor()); } Main.mouseX = mouseX; Main.mouseY = mouseY; float t1 = 3f; Utils.Swap(ref t1, ref Main.inventoryScale); if (cursorText != "") this.MouseText(cursorText); Utils.Swap(ref t1, ref Main.inventoryScale); Main.spriteBatch.End(); try { if ((double) num17 < (double) num11) num15 += (num17 - num11) * num21; if ((double) num18 < (double) num12) num16 += (num18 - num12) * num21; if (Main.mapFullscreen) { if (Main.OnPostFullscreenMapDraw != null) Main.OnPostFullscreenMapDraw(new Vector2(num15, num16), num21); } } catch (Exception ex) { TimeLogger.DrawException(ex); } Main.spriteBatch.Begin(); PlayerInput.SetZoom_Unscaled(); TimeLogger.DetailedDrawTime(9); } private static void DrawMapFullscreenBackground( Vector2 screenPosition, int screenWidth, int screenHeight) { Asset mapBg = TextureAssets.MapBGs[0]; int index = -1; Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.White; int wall = (int) Main.tile[(int) ((double) Main.player[Main.myPlayer].Center.X / 16.0), (int) ((double) Main.player[Main.myPlayer].Center.Y / 16.0)].wall; if ((double) screenPosition.Y > (double) ((Main.maxTilesY - 232) * 16)) index = 2; else if (Main.player[Main.myPlayer].ZoneDungeon) index = 4; else if (wall == 87) index = 13; else if ((double) screenPosition.Y > Main.worldSurface * 16.0) { switch (wall) { case 62: case 263: index = 18; break; case 86: case 108: index = 15; break; case 178: case 183: index = 17; break; case 180: case 184: index = 16; break; default: index = !Main.player[Main.myPlayer].ZoneGlowshroom ? (!Main.player[Main.myPlayer].ZoneCorrupt ? (!Main.player[Main.myPlayer].ZoneCrimson ? (!Main.player[Main.myPlayer].ZoneHallow ? (!Main.player[Main.myPlayer].ZoneSnow ? (!Main.player[Main.myPlayer].ZoneJungle ? (!Main.player[Main.myPlayer].ZoneDesert ? (!Main.player[Main.myPlayer].ZoneRockLayerHeight ? 1 : 31) : 14) : 12) : 3) : (!Main.player[Main.myPlayer].ZoneDesert ? (!Main.player[Main.myPlayer].ZoneSnow ? 21 : 35) : 41)) : (!Main.player[Main.myPlayer].ZoneDesert ? (!Main.player[Main.myPlayer].ZoneSnow ? 23 : 34) : 40)) : (!Main.player[Main.myPlayer].ZoneDesert ? (!Main.player[Main.myPlayer].ZoneSnow ? 22 : 33) : 39)) : 20; break; } } else if (Main.player[Main.myPlayer].ZoneGlowshroom) { index = 19; } else { color = Main.ColorOfTheSkies; int num = (int) (((double) screenPosition.X + (double) (screenWidth / 2)) / 16.0); if (Main.player[Main.myPlayer].ZoneSkyHeight) index = 32; else if (Main.player[Main.myPlayer].ZoneCorrupt) index = !Main.player[Main.myPlayer].ZoneDesert ? 5 : 36; else if (Main.player[Main.myPlayer].ZoneCrimson) index = !Main.player[Main.myPlayer].ZoneDesert ? 6 : 37; else if (Main.player[Main.myPlayer].ZoneHallow) index = !Main.player[Main.myPlayer].ZoneDesert ? 7 : 38; else if ((double) screenPosition.Y / 16.0 < Main.worldSurface + 10.0 && (num < 380 || num > Main.maxTilesX - 380)) index = 10; else if (Main.player[Main.myPlayer].ZoneSnow) index = 11; else if (Main.player[Main.myPlayer].ZoneJungle) index = 8; else if (Main.player[Main.myPlayer].ZoneDesert) index = 9; else if (Main.bloodMoon) { color *= 2f; index = 25; } else if (Main.player[Main.myPlayer].ZoneGraveyard) index = 26; } if (index > -1) mapBg = TextureAssets.MapBGs[index]; Main.spriteBatch.Draw(mapBg.Value, new Microsoft.Xna.Framework.Rectangle(0, 0, screenWidth, screenHeight), color); } private static bool DrawPlayerDeathMarker( float X, float Y, float scale, float left, float top, float headScale, int i) { float num1 = (Main.player[i].lastDeathPostion.X / 16f - left) * scale; float num2 = (Main.player[i].lastDeathPostion.Y / 16f - top) * scale; float num3 = num1 + X; float num4 = num2 + Y - (float) (2.0 - (double) scale / 5.0 * 2.0); float x = num3 - 10f * scale; float y = num4 - 10f * scale; Main.spriteBatch.Draw(TextureAssets.MapDeath.Value, new Vector2(x, y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.MapDeath.Width(), TextureAssets.MapDeath.Height())), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2((float) TextureAssets.MapDeath.Width() * 0.5f, (float) TextureAssets.MapDeath.Height() * 0.5f), headScale, SpriteEffects.None, 0.0f); float num5 = (float) ((double) x + 4.0 - 14.0 * (double) headScale); float num6 = (float) ((double) y + 2.0 - 14.0 * (double) headScale); float num7 = num5 + 28f * headScale; float num8 = num6 + 28f * headScale; return (double) Main.mouseX >= (double) num5 && (double) Main.mouseX <= (double) num7 && (double) Main.mouseY >= (double) num6 && (double) Main.mouseY <= (double) num8; } private void DrawMiscMapIcons( SpriteBatch spriteBatch, Vector2 mapTopLeft, Vector2 mapX2Y2AndOff, Microsoft.Xna.Framework.Rectangle? mapRect, float mapScale, float drawScale, ref string mouseTextString) { this.DrawMapIcons_PotionOfReturnHomePosition(spriteBatch, mapTopLeft, mapX2Y2AndOff, mapRect, mapScale, drawScale, ref mouseTextString); this.DrawMapIcons_PotionOfReturnAppearAfterUsePosition(spriteBatch, mapTopLeft, mapX2Y2AndOff, mapRect, mapScale, drawScale, ref mouseTextString); this.DrawMapIcons_LastGolfballHit(spriteBatch, mapTopLeft, mapX2Y2AndOff, mapRect, mapScale, drawScale, ref mouseTextString); } private void DrawMapIcons_PotionOfReturnAppearAfterUsePosition( SpriteBatch spriteBatch, Vector2 mapTopLeft, Vector2 mapX2Y2AndOff, Microsoft.Xna.Framework.Rectangle? mapRect, float mapScale, float drawScale, ref string mouseTextString) { Vector2? originalUsePosition = Main.LocalPlayer.PotionOfReturnOriginalUsePosition; if (!originalUsePosition.HasValue) return; Vector2? nullable = originalUsePosition; Vector2 vector2_1 = new Vector2(0.0f, (float) (-Main.LocalPlayer.height / 2)); Vector2 vector2_2 = (((nullable.HasValue ? new Vector2?(nullable.GetValueOrDefault() + vector2_1) : new Vector2?()).Value / 16f - mapTopLeft) * mapScale + mapX2Y2AndOff).Floor(); if (mapRect.HasValue && !mapRect.Value.Contains(vector2_2.ToPoint())) return; Texture2D texture2D = TextureAssets.Extra[173].Value; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(); spriteBatch.Draw(texture2D, vector2_2, new Microsoft.Xna.Framework.Rectangle?(r), Microsoft.Xna.Framework.Color.White, 0.0f, r.Size() / 2f, drawScale, SpriteEffects.None, 0.0f); if (!Utils.CenteredRectangle(vector2_2, r.Size() * drawScale).Contains(Main.MouseScreen.ToPoint())) return; mouseTextString = Language.GetTextValue("GameUI.PotionOfReturnExitPortal"); Vector2 vector2_3 = Main.MouseScreen + new Vector2(-28f) + new Vector2(4f, 0.0f); } private void DrawMapIcons_PotionOfReturnHomePosition( SpriteBatch spriteBatch, Vector2 mapTopLeft, Vector2 mapX2Y2AndOff, Microsoft.Xna.Framework.Rectangle? mapRect, float mapScale, float drawScale, ref string mouseTextString) { Vector2? returnHomePosition = Main.LocalPlayer.PotionOfReturnHomePosition; if (!returnHomePosition.HasValue) return; Vector2? nullable = returnHomePosition; Vector2 vector2_1 = new Vector2(0.0f, (float) (-Main.LocalPlayer.height / 2)); Vector2 vector2_2 = (((nullable.HasValue ? new Vector2?(nullable.GetValueOrDefault() + vector2_1) : new Vector2?()).Value / 16f - mapTopLeft) * mapScale + mapX2Y2AndOff).Floor(); if (mapRect.HasValue && !mapRect.Value.Contains(vector2_2.ToPoint())) return; Texture2D texture2D = TextureAssets.Extra[175].Value; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(); spriteBatch.Draw(texture2D, vector2_2, new Microsoft.Xna.Framework.Rectangle?(r), Microsoft.Xna.Framework.Color.White, 0.0f, r.Size() / 2f, drawScale, SpriteEffects.None, 0.0f); if (!Utils.CenteredRectangle(vector2_2, r.Size() * drawScale).Contains(Main.MouseScreen.ToPoint())) return; mouseTextString = Language.GetTextValue("GameUI.PotionOfReturnHomePortal"); Vector2 vector2_3 = Main.MouseScreen + new Vector2(-28f) + new Vector2(4f, 0.0f); } private void DrawMapIcons_LastGolfballHit( SpriteBatch spriteBatch, Vector2 mapTopLeft, Vector2 mapX2Y2AndOff, Microsoft.Xna.Framework.Rectangle? mapRect, float mapScale, float drawScale, ref string mouseTextString) { Projectile lastHitBall = Main.LocalGolfState.GetLastHitBall(); if (lastHitBall == null) return; Vector2 vector2_1 = ((lastHitBall.Center / 16f - mapTopLeft) * mapScale + mapX2Y2AndOff).Floor(); if (mapRect.HasValue && !mapRect.Value.Contains(vector2_1.ToPoint())) return; Texture2D texture2D1 = TextureAssets.Extra[176].Value; Microsoft.Xna.Framework.Rectangle r1 = texture2D1.Frame(); spriteBatch.Draw(texture2D1, vector2_1, new Microsoft.Xna.Framework.Rectangle?(r1), Microsoft.Xna.Framework.Color.White, 0.0f, r1.Size() / 2f, drawScale, SpriteEffects.None, 0.0f); Microsoft.Xna.Framework.Rectangle rectangle = Utils.CenteredRectangle(vector2_1, r1.Size() * drawScale); this.LoadProjectile(lastHitBall.type); Texture2D texture2D2 = TextureAssets.Projectile[lastHitBall.type].Value; Microsoft.Xna.Framework.Rectangle r2 = texture2D2.Frame(); spriteBatch.Draw(texture2D2, vector2_1, new Microsoft.Xna.Framework.Rectangle?(r2), Microsoft.Xna.Framework.Color.White, 0.0f, r2.Size() / 2f, drawScale, SpriteEffects.None, 0.0f); if (!rectangle.Contains(Main.MouseScreen.ToPoint())) return; mouseTextString = lastHitBall.Name; Vector2 vector2_2 = Main.MouseScreen + new Vector2(-28f) + new Vector2(4f, 0.0f); } public static void TriggerPing(Vector2 position) { Main.Pings.Add(position); if (Main.netMode != 1) return; NetManager.Instance.SendToServer(NetPingModule.Serialize(position)); } private static void DrawNPCHeadFriendly( Entity theNPC, byte alpha, float headScale, SpriteEffects dir, int npcID, float x, float y) { Main.TownNPCHeadRenderer.DrawWithOutlines(theNPC, npcID, new Vector2(x, y), new Microsoft.Xna.Framework.Color((int) alpha, (int) alpha, (int) alpha, (int) alpha), 0.0f, headScale, dir); } private static void DrawNPCHeadBoss( Entity theNPC, byte alpha, float headScale, float rotation, SpriteEffects effects, int npcID, float x, float y) { Main.BossNPCHeadRenderer.DrawWithOutlines(theNPC, npcID, new Vector2(x, y), new Microsoft.Xna.Framework.Color((int) alpha, (int) alpha, (int) alpha, (int) alpha), 0.0f, headScale, effects); } 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) { float num1 = 2f * scale; Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; int colorOnlyShaderIndex = ContentSamples.CommonlyUsedContentSamples.ColorOnlyShaderIndex; DrawData drawData = new DrawData(tex, position, rect, color, rotation, origin, scale, effects, 0); GameShaders.Armor.Apply(colorOnlyShaderIndex, entity, new DrawData?(drawData)); Microsoft.Xna.Framework.Color color1 = Microsoft.Xna.Framework.Color.Black * ((float) color.A / (float) byte.MaxValue) * ((float) color.A / (float) byte.MaxValue); Microsoft.Xna.Framework.Color color2 = white * ((float) color.A / (float) byte.MaxValue) * ((float) color.A / (float) byte.MaxValue); int num2 = 2; for (int index1 = -num2; index1 <= num2; ++index1) { for (int index2 = -num2; index2 <= num2; ++index2) { if (Math.Abs(index1) + Math.Abs(index2) == num2) { Vector2 vector2 = new Vector2((float) index1 * num1, (float) index2 * num1).RotatedBy((double) rotation); Main.spriteBatch.Draw(tex, position + vector2, rect, color1, rotation, origin, scale, effects, 0.0f); } } } int num3 = 1; Vector2 zero = Vector2.Zero; for (int index3 = -num3; index3 <= num3; ++index3) { for (int index4 = -num3; index4 <= num3; ++index4) { if (Math.Abs(index3) + Math.Abs(index4) == num3) { Vector2 vector2 = new Vector2((float) index3 * num1, (float) index4 * num1).RotatedBy((double) rotation); Main.spriteBatch.Draw(tex, position + vector2, rect, color2, rotation, origin, scale, effects, 0.0f); } } } Main.pixelShader.CurrentTechnique.Passes[0].Apply(); Main.spriteBatch.Draw(tex, position, rect, color, rotation, origin, scale, effects, 0.0f); } public static Microsoft.Xna.Framework.Color GetPlayerHeadBordersColor(Player plr) => plr.ghost || plr.dead || plr.whoAmI != Main.myPlayer && plr.hostile && (plr.team != Main.LocalPlayer.team || plr.team == 0) ? Microsoft.Xna.Framework.Color.Transparent : Main.teamColor[plr.team]; private static string DrawMap_FindChestName( LocalizedText[] chestNames, Tile chestTile, int x, int y, int fullTileWidth = 36) { int chestByGuessing = Chest.FindChestByGuessing(x, y); return chestByGuessing >= 0 ? (!(Main.chest[chestByGuessing].name != "") ? chestNames[(int) chestTile.frameX / fullTileWidth].Value : chestNames[(int) chestTile.frameX / fullTileWidth].ToString() + ": " + Main.chest[chestByGuessing].name) : chestNames[0].Value; } public void DrawSimpleSurfaceBackground(Vector2 areaPosition, int areaWidth, int areaHeight) { float val2 = (float) (Main.worldSurface + 1.0) * 16f; float num1 = Math.Min(areaPosition.Y + (float) areaHeight, val2) - areaPosition.Y; float y = areaPosition.Y; float num2 = areaPosition.Y + num1; Vector4 vector4_1 = Main.ColorOfTheSkies.ToVector4(); Vector4 vector4_2 = new Microsoft.Xna.Framework.Color(53, 43, 243).ToVector4() * vector4_1; Vector4 vector4_3 = new Microsoft.Xna.Framework.Color(132, 170, 248).ToVector4() * vector4_1; Microsoft.Xna.Framework.Color color1 = new Microsoft.Xna.Framework.Color(Vector4.Lerp(vector4_2, vector4_3, y / val2)); Microsoft.Xna.Framework.Color color2 = new Microsoft.Xna.Framework.Color(Vector4.Lerp(vector4_2, vector4_3, num2 / val2)); VertexColors colors; colors.TopLeftColor = color1; colors.TopRightColor = color1; colors.BottomLeftColor = color2; colors.BottomRightColor = color2; Main.tileBatch.Draw(TextureAssets.BlackTile.Value, new Vector4(0.0f, 0.0f, (float) areaWidth, num1), colors); float w = (float) areaHeight - num1; if ((double) w <= 0.0) return; colors.TopLeftColor = Microsoft.Xna.Framework.Color.Black; colors.TopRightColor = Microsoft.Xna.Framework.Color.Black; colors.BottomLeftColor = Microsoft.Xna.Framework.Color.Black; colors.BottomRightColor = Microsoft.Xna.Framework.Color.Black; Main.tileBatch.Draw(TextureAssets.BlackTile.Value, new Vector4(0.0f, num1, (float) areaWidth, w), colors); } public void DrawCapture(Microsoft.Xna.Framework.Rectangle area, CaptureSettings settings) { float[] bgAlphaFrontLayer = Main.bgAlphaFrontLayer; Main.bgAlphaFrontLayer = new float[bgAlphaFrontLayer.Length]; float[] alphaFarBackLayer = Main.bgAlphaFarBackLayer; Main.bgAlphaFarBackLayer = new float[alphaFarBackLayer.Length]; this.UpdateBGVisibility_BackLayer(new int?(settings.Biome.BackgroundIndex), new float?(1f)); this.UpdateBGVisibility_FrontLayer(new int?(settings.Biome.BackgroundIndex), new float?(1f)); float[] array = ((IEnumerable) Main.liquidAlpha).ToArray(); int holyTileCount = Main.SceneMetrics.HolyTileCount; Main.SceneMetrics.HolyTileCount = settings.Biome.BackgroundIndex == 6 ? SceneMetrics.HallowTileMax : 0; int offScreenRange = Main.offScreenRange; Main.offScreenRange = 0; SpriteViewMatrix gameViewMatrix = Main.GameViewMatrix; Main.GameViewMatrix = new SpriteViewMatrix(this.GraphicsDevice); Main.Rasterizer = RasterizerState.CullCounterClockwise; bool captureEntities = settings.CaptureEntities; bool captureBackground = settings.CaptureBackground; CaptureBiome biome = settings.Biome; Vector2 screenPosition1 = Main.screenPosition; int screenWidth1 = Main.screenWidth; int screenHeight1 = Main.screenHeight; float cloudAlpha = Main.cloudAlpha; bool captureMech = settings.CaptureMech; Main.screenWidth = area.Width << 4; Main.screenHeight = area.Height << 4; Main.screenPosition = new Vector2((float) (area.X * 16), (float) (area.Y * 16)); Main.cloudAlpha = 0.0f; for (int index = 0; index <= 10; ++index) { if (index != 1) Main.liquidAlpha[index] = index == biome.WaterStyle ? 1f : 0.0f; } int x1 = area.X; int y1 = area.Y; int num1 = area.X + Main.screenWidth / 16; int num2 = area.Y + Main.screenHeight / 16; float tempMushroomInfluence = (float) (biome.TileColor == CaptureBiome.TileColorStyle.Mushroom).ToInt(); Microsoft.Xna.Framework.Color sunColor; Microsoft.Xna.Framework.Color moonColor; Main.SetBackColor(new Main.InfoToSetBackColor() { isInGameMenuOrIsServer = Main.gameMenu || Main.netMode == 2, CorruptionBiomeInfluence = (float) (biome.TileColor == CaptureBiome.TileColorStyle.Corrupt).ToInt(), CrimsonBiomeInfluence = (float) (biome.TileColor == CaptureBiome.TileColorStyle.Crimson).ToInt(), JungleBiomeInfluence = (float) (biome.TileColor == CaptureBiome.TileColorStyle.Jungle).ToInt(), MushroomBiomeInfluence = tempMushroomInfluence, GraveyardInfluence = Main.GraveyardVisualIntensity, BloodMoonActive = biome.WaterStyle == 9, LanternNightActive = LanternNight.LanternsUp }, out sunColor, out moonColor); Main.ApplyColorOfTheSkiesToTiles(); Main.ColorOfSurfaceBackgroundsBase = Main.ColorOfSurfaceBackgroundsModified = Main.ColorOfTheSkies; bool mapEnabled = Main.mapEnabled; Main.mapEnabled = false; Lighting.Initialize(); Main.renderCount = 99; for (int index = 0; index < 4; ++index) Lighting.LightTiles(x1, num1, y1, num2); Main.mapEnabled = mapEnabled; if ((double) (settings.Area.X * 16) <= (double) screenPosition1.X - 16.0 || (double) (settings.Area.Y * 16) <= (double) screenPosition1.Y - 16.0 || (double) ((settings.Area.X + settings.Area.Width) * 16) >= (double) screenPosition1.X + (double) screenWidth1 + 16.0 || (double) ((settings.Area.Y + settings.Area.Height) * 16) >= (double) screenPosition1.Y + (double) screenHeight1 + 16.0) { for (int index = 0; index < Main.dust.Length; ++index) { if (Main.dust[index].active && Main.dust[index].type == 76) Main.dust[index].active = false; } } Vector2 vector2_1 = Main.drawToScreen ? Vector2.Zero : new Vector2((float) Main.offScreenRange, (float) Main.offScreenRange); int val1_1 = (int) (((double) Main.screenPosition.X - (double) vector2_1.X) / 16.0 - 1.0); int val1_2 = (int) (((double) Main.screenPosition.X + (double) Main.screenWidth + (double) vector2_1.X) / 16.0) + 2; int val1_3 = (int) (((double) Main.screenPosition.Y - (double) vector2_1.Y) / 16.0 - 1.0); int val1_4 = (int) (((double) Main.screenPosition.Y + (double) Main.screenHeight + (double) vector2_1.Y) / 16.0) + 5; Vector2 vector2_2 = vector2_1 - Main.screenPosition; int x2 = Math.Max(val1_1, 5) - 2; int y2 = Math.Max(val1_3, 5); int num3 = Math.Min(val1_2, Main.maxTilesX - 5) + 2; int num4 = Math.Min(val1_4, Main.maxTilesY - 5) + 4; Microsoft.Xna.Framework.Rectangle drawArea = new Microsoft.Xna.Framework.Rectangle(x2, y2, num3 - x2, num4 - y2); LiquidRenderer.Instance.PrepareDraw(drawArea); WorldGen.SectionTileFrameWithCheck(x1, y1, num1, num2); if (captureBackground) { Matrix transform = Main.Transform; int screenHeight2 = Main.screenHeight; int screenWidth2 = Main.screenWidth; Vector2 screenPosition2 = Main.screenPosition; bool mapFullscreen = Main.mapFullscreen; Main.mapFullscreen = false; float scAdj = this.scAdj; Vector2 vector2_3 = new Vector2((float) screenWidth1, (float) screenHeight1); Vector2 vector2_4 = new Vector2((float) (settings.Area.Width * 16), (float) (settings.Area.Height * 16)) / vector2_3; vector2_4.X = Math.Max(1f, vector2_4.X); vector2_4.Y = Math.Max(1f, vector2_4.Y); Vector2[] vector2Array = new Vector2[Main.numClouds]; for (int index = 0; index < Main.numClouds; ++index) { vector2Array[index] = Main.cloud[index].position; Main.cloud[index].position *= vector2_4; } if ((double) (settings.Area.Height * 16) >= 2000.0 || (double) (settings.Area.Width * 16) >= 2000.0) { this.scAdj = 0.0f; float num5 = 2048f; float scale = MathHelper.Clamp((float) settings.Area.Height * 16f / num5, 1f, 3f); Main.screenWidth = settings.Area.Width * 16; Main.screenHeight = Math.Min(2048, settings.Area.Height * 16); Main.screenPosition.X = (float) (settings.Area.X * 16); Main.screenPosition.Y = (float) (settings.Area.Y * 16); Main.screenPosition.Y += Math.Max(0.0f, (float) ((double) Math.Min((float) settings.Area.Height, (float) Main.worldSurface) * 16.0 - (double) num5 * (double) scale)); transform *= Matrix.CreateScale(scale); transform.Translation += new Vector3((float) ((settings.Area.X - area.X) * 16), (float) ((settings.Area.Y - area.Y) * 16), 0.0f); transform.Translation += new Vector3(0.0f, Math.Max(0.0f, (float) ((double) Math.Min((float) settings.Area.Height, (float) Main.worldSurface) * 16.0 - (double) num5 * (double) scale)) / scale, 0.0f); } else if ((double) (settings.Area.X * 16) > (double) screenPosition1.X - 16.0 && (double) (settings.Area.Y * 16) > (double) screenPosition1.Y - 16.0 && (double) ((settings.Area.X + settings.Area.Width) * 16) < (double) screenPosition1.X + (double) screenWidth1 + 16.0 && (double) ((settings.Area.Y + settings.Area.Height) * 16) < (double) screenPosition1.Y + (double) screenHeight1 + 16.0) { Main.screenPosition = screenPosition1; Main.screenWidth = screenWidth1; Main.screenHeight = screenHeight1; transform.Translation += new Vector3(screenPosition1.X - (float) area.X * 16f, screenPosition1.Y - (float) area.Y * 16f, 0.0f); } Vector2 areaPosition = new Vector2((float) (area.X * 16), (float) (area.Y * 16)); int areaWidth = area.Width * 16; int areaHeight = area.Height * 16; Main.tileBatch.Begin(); this.DrawSimpleSurfaceBackground(areaPosition, areaWidth, areaHeight); Main.tileBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.AnisotropicClamp, DepthStencilState.Default, RasterizerState.CullNone, (Effect) null, transform); int num6 = Main.screenWidth; int num7 = Main.screenHeight; Vector2 zero = Vector2.Zero; if (num6 < 800) { int num8 = 800 - num6; zero.X -= (float) num8 * 0.5f; num6 = 800; } if (num7 < 600) { int num9 = 600 - num7; zero.Y -= (float) num9 * 0.5f; num7 = 600; } Main.SceneArea sceneArea = new Main.SceneArea() { bgTopY = 0, totalWidth = (float) num6, totalHeight = (float) num7, SceneLocalScreenPositionOffset = zero }; this.DrawStarsInBackground(sceneArea); if ((double) Main.screenPosition.Y / 16.0 < Main.worldSurface + 2.0) this.DrawSunAndMoon(sceneArea, moonColor, sunColor, tempMushroomInfluence); this.DrawSurfaceBG(); Main.spriteBatch.End(); for (int index = 0; index < Main.numClouds; ++index) Main.cloud[index].position = vector2Array[index]; this.scAdj = scAdj; Main.mapFullscreen = mapFullscreen; Main.screenWidth = screenWidth2; Main.screenHeight = screenHeight2; Main.screenPosition = screenPosition2; } if (captureBackground) { Main.spriteBatch.Begin(); this.DrawUnderworldBackground(true); Main.spriteBatch.End(); } if (captureEntities) { Main.spriteBatch.Begin(); this.CacheNPCDraws(); this.CacheProjDraws(); this.DrawCachedNPCs(this.DrawCacheNPCsMoonMoon, true); Main.spriteBatch.End(); } Main.tileBatch.Begin(); Main.spriteBatch.Begin(); this.DrawBlack(true); Main.tileBatch.End(); Main.spriteBatch.End(); Main.tileBatch.Begin(); Main.spriteBatch.Begin(); if (biome == null) this.DrawWater(true, Main.waterStyle); else this.DrawWater(true, Main.bloodMoon ? 9 : biome.WaterStyle); Main.tileBatch.End(); Main.spriteBatch.End(); if (captureBackground) { Main.tileBatch.Begin(); Main.spriteBatch.Begin(); this.DrawBackground(); Main.tileBatch.End(); Main.spriteBatch.End(); } Main.tileBatch.Begin(); Main.spriteBatch.Begin(); this.DrawWalls(); Main.tileBatch.End(); Main.spriteBatch.End(); if (captureEntities) { Main.spriteBatch.Begin(); this.DrawWoF(); Main.spriteBatch.End(); } if (Main.drawBackGore & captureEntities) { Main.spriteBatch.Begin(); this.DrawGoreBehind(); Main.spriteBatch.End(); Main.drawBackGore = true; } if (captureEntities) { Main.spriteBatch.Begin(); MoonlordDeathDrama.DrawPieces(Main.spriteBatch); MoonlordDeathDrama.DrawExplosions(Main.spriteBatch); Main.spriteBatch.End(); } bool flag = false; bool intoRenderTargets1 = false; bool intoRenderTargets2 = true; this.TilesRenderer.PreDrawTiles(false, flag, intoRenderTargets2); Main.tileBatch.Begin(); Main.spriteBatch.Begin(); this.DrawCachedNPCs(this.DrawCacheNPCsBehindNonSolidTiles, true); int waterStyleOverride = Main.bloodMoon ? 9 : biome.WaterStyle; if (biome == null) this.DrawTiles(false, flag, intoRenderTargets1); else this.DrawTiles(false, flag, intoRenderTargets1, waterStyleOverride); Main.tileBatch.End(); Main.spriteBatch.End(); this.DrawTileEntities(false, flag, intoRenderTargets1); if (captureEntities) { Main.spriteBatch.Begin(); this.waterfallManager.FindWaterfalls(true); this.waterfallManager.Draw(Main.spriteBatch); Main.spriteBatch.End(); } if (captureEntities) { this.DrawCachedProjs(this.DrawCacheProjsBehindNPCsAndTiles); Main.spriteBatch.Begin(); this.DrawNPCs(true); Main.spriteBatch.End(); } this.TilesRenderer.PreDrawTiles(true, flag, intoRenderTargets2); Main.tileBatch.Begin(); Main.spriteBatch.Begin(); if (biome == null) this.DrawTiles(true, flag, intoRenderTargets1); else this.DrawTiles(true, flag, intoRenderTargets1, waterStyleOverride); Main.tileBatch.End(); Main.spriteBatch.End(); this.DrawTileEntities(true, flag, intoRenderTargets1); if (captureEntities) { this.DrawPlayers_BehindNPCs(); this.DrawCachedProjs(this.DrawCacheProjsBehindNPCs); Main.spriteBatch.Begin(); this.DrawNPCs(); Main.spriteBatch.End(); Main.spriteBatch.Begin(); this.DrawCachedNPCs(this.DrawCacheNPCProjectiles, false); Main.spriteBatch.End(); this.DrawSuperSpecialProjectiles(this.DrawCacheFirstFractals); this.DrawCachedProjs(this.DrawCacheProjsBehindProjectiles); this.DrawProjectiles(); this.DrawPlayers_AfterProjectiles(); this.DrawCachedProjs(this.DrawCacheProjsOverPlayers); Main.spriteBatch.Begin(); this.DrawCachedNPCs(this.DrawCacheNPCsOverPlayers, false); Main.spriteBatch.End(); Main.spriteBatch.Begin(); this.DrawItems(); Main.spriteBatch.End(); Main.spriteBatch.Begin(); this.DrawRain(); Main.spriteBatch.End(); Main.spriteBatch.Begin(); this.DrawGore(); Main.spriteBatch.End(); this.DrawDust(); } Main.tileBatch.Begin(); Main.spriteBatch.Begin(); if (biome == null) this.DrawWater(Style: Main.waterStyle); else this.DrawWater(Style: biome.WaterStyle); if (captureMech) this.DrawWires(); Main.tileBatch.End(); Main.spriteBatch.End(); this.DrawCachedProjs(this.DrawCacheProjsOverWiresUI); if (Main.mapEnabled) { Main.spriteBatch.Begin(); for (int x3 = area.X; x3 < area.X + area.Width; ++x3) { for (int y3 = area.Y; y3 < area.Y + area.Height; ++y3) { if (!Main.Map.IsRevealed(x3, y3)) Main.spriteBatch.Draw(TextureAssets.BlackTile.Value, new Vector2((float) x3 * 16f, (float) y3 * 16f) - Main.screenPosition, Microsoft.Xna.Framework.Color.Black); } } Main.spriteBatch.End(); } Main.renderCount = 99; Main.screenWidth = screenWidth1; Main.screenHeight = screenHeight1; Main.screenPosition = screenPosition1; Main.liquidAlpha = array; Main.offScreenRange = offScreenRange; Main.cloudAlpha = cloudAlpha; Main.bgAlphaFrontLayer = bgAlphaFrontLayer; Main.bgAlphaFarBackLayer = alphaFarBackLayer; Main.SceneMetrics.HolyTileCount = holyTileCount; Lighting.Initialize(); Main.GameViewMatrix = gameViewMatrix; } protected void RenderTiles() { if (Main.drawToScreen) return; this.RenderBlack(); this.GraphicsDevice.SetRenderTarget(this.tileTarget); this.GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Transparent); Main.spriteBatch.Begin(); try { this.TilesRenderer.PreDrawTiles(true, false, true); this.DrawTiles(true, false, true); } catch (Exception ex) { if (Main.ignoreErrors) TimeLogger.DrawException(ex); else throw; } TimeLogger.DetailedDrawReset(); Main.spriteBatch.End(); this.DrawTileEntities(true, false, true); TimeLogger.DetailedDrawTime(28); this.GraphicsDevice.SetRenderTarget((RenderTarget2D) null); } protected void RenderTiles2() { if (Main.drawToScreen) return; this.GraphicsDevice.SetRenderTarget(this.tile2Target); this.GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Transparent); Main.spriteBatch.Begin(); try { this.TilesRenderer.PreDrawTiles(false, false, true); this.DrawTiles(false, false, true); } catch (Exception ex) { if (Main.ignoreErrors) TimeLogger.DrawException(ex); else throw; } TimeLogger.DetailedDrawReset(); Main.spriteBatch.End(); this.DrawTileEntities(false, false, true); TimeLogger.DetailedDrawTime(29); this.GraphicsDevice.SetRenderTarget((RenderTarget2D) null); } protected void RenderWater() { if (Main.drawToScreen) return; this.GraphicsDevice.SetRenderTarget(Main.waterTarget); this.GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Transparent); Main.spriteBatch.Begin(); try { this.DrawWaters(); } catch { } TimeLogger.DetailedDrawReset(); Main.spriteBatch.End(); TimeLogger.DetailedDrawTime(31); this.GraphicsDevice.SetRenderTarget((RenderTarget2D) null); } public static int CalculateWaterStyle(bool ignoreFountains = false) { if (Main.SceneMetrics.ActiveFountainColor >= 0 && !ignoreFountains) return Main.SceneMetrics.ActiveFountainColor; if (Main.bgStyle != 4 && Main.bloodMoon && !Main.dayTime) return 9; switch (Main.bgStyle) { case 1: return 2; case 2: return (double) Main.player[Main.myPlayer].position.Y / 16.0 > Main.worldSurface ? 12 : 6; case 3: return 3; case 5: if (Main.SceneMetrics.EvilTileCount > Main.SceneMetrics.HolyTileCount && Main.SceneMetrics.EvilTileCount > Main.SceneMetrics.BloodTileCount) return 2; return Main.SceneMetrics.HolyTileCount > Main.SceneMetrics.BloodTileCount ? 4 : 10; case 6: return 4; case 7: return 5; case 8: return 10; default: return (double) Main.screenPosition.Y / 16.0 > Main.rockLayer + 40.0 ? (Main.player[Main.myPlayer].ZoneGlowshroom ? 7 : 8) : ((double) Main.screenPosition.Y / 16.0 > Main.worldSurface ? 7 : 0); } } public static bool IsLiquidStyleWater(int liquidStyle) => liquidStyle != 1 && liquidStyle != 11; private void DrawWaters(bool isBackground = false) { Main.drewLava = false; if (!isBackground) { Main.waterStyle = Main.CalculateWaterStyle(); for (int index = 0; index < 13; ++index) { if (Main.IsLiquidStyleWater(Main.waterStyle)) Main.liquidAlpha[index] = Main.waterStyle == index ? Math.Min(Main.liquidAlpha[index] + 0.2f, 1f) : Math.Max(Main.liquidAlpha[index] - 0.2f, 0.0f); } } if (!Main.drawToScreen && !isBackground) { Vector2 vector2 = Main.drawToScreen ? Vector2.Zero : new Vector2((float) Main.offScreenRange, (float) Main.offScreenRange); int val1_1 = (int) (((double) Main.Camera.ScaledPosition.X - (double) vector2.X) / 16.0 - 1.0); int val1_2 = (int) (((double) Main.Camera.ScaledPosition.X + (double) Main.Camera.ScaledSize.X + (double) vector2.X) / 16.0) + 2; int val1_3 = (int) (((double) Main.Camera.ScaledPosition.Y - (double) vector2.Y) / 16.0 - 1.0); int val1_4 = (int) (((double) Main.Camera.ScaledPosition.Y + (double) Main.Camera.ScaledSize.Y + (double) vector2.Y) / 16.0) + 5; int x = Math.Max(val1_1, 5) - 2; int y = Math.Max(val1_3, 5); int num1 = Math.Min(val1_2, Main.maxTilesX - 5) + 2; int num2 = Math.Min(val1_4, Main.maxTilesY - 5) + 4; Microsoft.Xna.Framework.Rectangle drawArea = new Microsoft.Xna.Framework.Rectangle(x, y, num1 - x, num2 - y); LiquidRenderer.Instance.PrepareDraw(drawArea); } bool flag = false; for (int index = 0; index < 13; ++index) { if (Main.IsLiquidStyleWater(index) && (double) Main.liquidAlpha[index] > 0.0 && index != Main.waterStyle) { this.DrawWater(isBackground, index, isBackground ? 1f : Main.liquidAlpha[index]); flag = true; } } this.DrawWater(isBackground, Main.waterStyle, flag ? Main.liquidAlpha[Main.waterStyle] : 1f); } protected void DrawWater(bool bg = false, int Style = 0, float Alpha = 1f) { if (!Lighting.NotRetro) { this.oldDrawWater(bg, Style, Alpha); } else { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); Vector2 drawOffset = (Main.drawToScreen ? Vector2.Zero : new Vector2((float) Main.offScreenRange, (float) Main.offScreenRange)) - Main.screenPosition; LiquidRenderer.Instance.Draw(Main.spriteBatch, drawOffset, Style, Alpha, bg); if (bg) return; TimeLogger.DrawTime(4, stopwatch.Elapsed.TotalMilliseconds); } } public static void DrawTileInWater(Vector2 drawOffset, int x, int y) { if (Main.tile[x, y] == null || !Main.tile[x, y].active() || Main.tile[x, y].type != (ushort) 518) return; Main.instance.LoadTiles((int) Main.tile[x, y].type); Tile tile = Main.tile[x, y]; int num = (int) tile.liquid / 16 - 3; if (WorldGen.SolidTile(x, y - 1) && num > 8) num = 8; Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle((int) tile.frameX, (int) tile.frameY, 16, 16); Main.spriteBatch.Draw(TextureAssets.Tile[(int) tile.type].Value, new Vector2((float) (x * 16), (float) (y * 16 - num)) + drawOffset, new Microsoft.Xna.Framework.Rectangle?(rectangle), Lighting.GetColor(x, y), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } public void oldDrawWater(bool bg = false, int Style = 0, float Alpha = 1f) { float num1 = 0.0f; float num2 = 99999f; float num3 = 99999f; int num4 = -1; int num5 = -1; Vector2 vector2_1 = new Vector2((float) Main.offScreenRange, (float) Main.offScreenRange); if (Main.drawToScreen) vector2_1 = Vector2.Zero; Microsoft.Xna.Framework.Color[] colorArray = new Microsoft.Xna.Framework.Color[4]; int num6 = (int) ((double) byte.MaxValue * (1.0 - (double) Main.gfxQuality) + 40.0 * (double) Main.gfxQuality); double gfxQuality1 = (double) Main.gfxQuality; double gfxQuality2 = (double) Main.gfxQuality; int num7 = (int) (((double) Main.screenPosition.X - (double) vector2_1.X) / 16.0 - 1.0); int num8 = (int) (((double) Main.screenPosition.X + (double) Main.screenWidth + (double) vector2_1.X) / 16.0) + 2; int num9 = (int) (((double) Main.screenPosition.Y - (double) vector2_1.Y) / 16.0 - 1.0); int num10 = (int) (((double) Main.screenPosition.Y + (double) Main.screenHeight + (double) vector2_1.Y) / 16.0) + 5; if (num7 < 5) num7 = 5; if (num8 > Main.maxTilesX - 5) num8 = Main.maxTilesX - 5; if (num9 < 5) num9 = 5; if (num10 > Main.maxTilesY - 5) num10 = Main.maxTilesY - 5; for (int y = num9; y < num10 + 4; ++y) { for (int x = num7 - 2; x < num8 + 2; ++x) { if (Main.tile[x, y] == null) Main.tile[x, y] = new Tile(); if (Main.tile[x, y].liquid > (byte) 0 && (!Main.tile[x, y].nactive() || !Main.tileSolid[(int) Main.tile[x, y].type] || Main.tileSolidTop[(int) Main.tile[x, y].type]) && (double) Lighting.Brightness(x, y) > 0.0 | bg) { Microsoft.Xna.Framework.Color color1 = Lighting.GetColor(x, y); float num11 = (float) (256 - (int) Main.tile[x, y].liquid) / 32f; int index1 = 0; if (Main.tile[x, y].lava()) { if (!Main.drewLava) { float num12 = Math.Abs((float) (x * 16 + 8) - (Main.screenPosition.X + (float) (Main.screenWidth / 2))); float num13 = Math.Abs((float) (y * 16 + 8) - (Main.screenPosition.Y + (float) (Main.screenHeight / 2))); if ((double) num12 < (double) (Main.screenWidth * 2) && (double) num13 < (double) (Main.screenHeight * 2)) { float num14 = (float) (1.0 - Math.Sqrt((double) num12 * (double) num12 + (double) num13 * (double) num13) / ((double) Main.screenWidth * 0.75)); if ((double) num14 > 0.0) num1 += num14; } if ((double) num12 < (double) num2) { num2 = num12; num4 = x * 16 + 8; } if ((double) num13 < (double) num3) { num3 = num12; num5 = y * 16 + 8; } index1 = 1; } else continue; } else if (Main.tile[x, y].honey()) index1 = 11; if (index1 == 0) index1 = Style; if (index1 != 1 && index1 != 11 || !Main.drewLava) { float num15 = 0.5f; if (bg) num15 = 1f; if (index1 != 1 && index1 != 11) num15 *= Alpha; Main.DrawTileInWater(-Main.screenPosition + vector2_1, x, y); Vector2 vector2_2 = new Vector2((float) (x * 16), (float) (y * 16 + (int) num11 * 2)); Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 16 - (int) num11 * 2); if (Main.tile[x, y + 1].liquid < (byte) 245 && (!Main.tile[x, y + 1].nactive() || !Main.tileSolid[(int) Main.tile[x, y + 1].type] || Main.tileSolidTop[(int) Main.tile[x, y + 1].type])) { float num16 = (float) (256 - (int) Main.tile[x, y + 1].liquid) / 32f; num15 = (float) (0.5 * (8.0 - (double) num11) / 4.0); if ((double) num15 > 0.55) num15 = 0.55f; if ((double) num15 < 0.35) num15 = 0.35f; float num17 = num11 / 2f; if (Main.tile[x, y + 1].liquid < (byte) 200) { if (!bg) { if (Main.tile[x, y - 1].liquid > (byte) 0 && Main.tile[x, y - 1].liquid > (byte) 0) { rectangle = new Microsoft.Xna.Framework.Rectangle(0, 4, 16, 16); num15 = 0.5f; } else if (Main.tile[x, y - 1].liquid > (byte) 0) { vector2_2 = new Vector2((float) (x * 16), (float) (y * 16 + 4)); rectangle = new Microsoft.Xna.Framework.Rectangle(0, 4, 16, 12); num15 = 0.5f; } else if (Main.tile[x, y + 1].liquid > (byte) 0) { vector2_2 = new Vector2((float) (x * 16), (float) (y * 16 + (int) num11 * 2 + (int) num16 * 2)); rectangle = new Microsoft.Xna.Framework.Rectangle(0, 4, 16, 16 - (int) num11 * 2); } else { vector2_2 = new Vector2((float) (x * 16 + (int) num17), (float) (y * 16 + (int) num17 * 2 + (int) num16 * 2)); rectangle = new Microsoft.Xna.Framework.Rectangle(0, 4, 16 - (int) num17 * 2, 16 - (int) num17 * 2); } } else continue; } else { num15 = 0.5f; rectangle = new Microsoft.Xna.Framework.Rectangle(0, 4, 16, 16 - (int) num11 * 2 + (int) num16 * 2); } } else if (Main.tile[x, y - 1].liquid > (byte) 32) rectangle = new Microsoft.Xna.Framework.Rectangle(0, 4, rectangle.Width, rectangle.Height); else if ((double) num11 < 1.0 && Main.tile[x, y - 1].nactive() && Main.tileSolid[(int) Main.tile[x, y - 1].type] && !Main.tileSolidTop[(int) Main.tile[x, y - 1].type]) { vector2_2 = new Vector2((float) (x * 16), (float) (y * 16)); rectangle = new Microsoft.Xna.Framework.Rectangle(0, 4, 16, 16); } else { bool flag = true; for (int index2 = y + 1; index2 < y + 6 && (!Main.tile[x, index2].nactive() || !Main.tileSolid[(int) Main.tile[x, index2].type] || Main.tileSolidTop[(int) Main.tile[x, index2].type]); ++index2) { if (Main.tile[x, index2].liquid < (byte) 200) { flag = false; break; } } if (!flag) { num15 = 0.5f; rectangle = new Microsoft.Xna.Framework.Rectangle(0, 4, 16, 16); } else if (Main.tile[x, y - 1].liquid > (byte) 0) rectangle = new Microsoft.Xna.Framework.Rectangle(0, 2, rectangle.Width, rectangle.Height); } if ((color1.R > (byte) 20 || color1.B > (byte) 20 || color1.G > (byte) 20) && rectangle.Y < 4) { int num18 = (int) color1.R; if ((int) color1.G > num18) num18 = (int) color1.G; if ((int) color1.B > num18) num18 = (int) color1.B; int num19 = num18 / 30; if (Main.rand.Next(20000) < num19) { Microsoft.Xna.Framework.Color newColor = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue); if (Main.tile[x, y].honey()) newColor = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, 50); int index3 = Dust.NewDust(new Vector2((float) (x * 16), vector2_2.Y - 2f), 16, 8, 43, Alpha: 254, newColor: newColor, Scale: 0.75f); Main.dust[index3].velocity *= 0.0f; } } if (Main.tile[x, y].honey()) { num15 *= 1.6f; if ((double) num15 > 1.0) num15 = 1f; } if (Main.tile[x, y].lava()) { num15 *= 1.8f; if ((double) num15 > 1.0) num15 = 1f; if (this.IsActive && !Main.gamePaused && Dust.lavaBubbles < 200) { if (Main.tile[x, y].liquid > (byte) 200 && Main.rand.Next(700) == 0) Dust.NewDust(new Vector2((float) (x * 16), (float) (y * 16)), 16, 16, 35); if (rectangle.Y == 0 && Main.rand.Next(350) == 0) { int index4 = Dust.NewDust(new Vector2((float) (x * 16), (float) ((double) (y * 16) + (double) num11 * 2.0 - 8.0)), 16, 8, 35, Alpha: 50, Scale: 1.5f); Main.dust[index4].velocity *= 0.8f; Main.dust[index4].velocity.X *= 2f; Main.dust[index4].velocity.Y -= (float) Main.rand.Next(1, 7) * 0.1f; if (Main.rand.Next(10) == 0) Main.dust[index4].velocity.Y *= (float) Main.rand.Next(2, 5); Main.dust[index4].noGravity = true; } } } color1 = new Microsoft.Xna.Framework.Color((int) (byte) ((float) color1.R * num15), (int) (byte) ((float) color1.G * num15), (int) (byte) ((float) color1.B * num15), (int) (byte) ((float) color1.A * num15)); if (Lighting.NotRetro && !bg) { Microsoft.Xna.Framework.Color color2 = color1; if (index1 != 1 && ((double) color2.R > (double) num6 * 0.6 || (double) color2.G > (double) num6 * 0.65 || (double) color2.B > (double) num6 * 0.7)) { for (int index5 = 0; index5 < 4; ++index5) { int num20 = 0; int num21 = 0; int width = 8; int height = 8; Microsoft.Xna.Framework.Color color3 = color2; Microsoft.Xna.Framework.Color color4 = Lighting.GetColor(x, y); if (index5 == 0) { color4 = Lighting.GetColor(x - 1, y - 1); if (rectangle.Height < 8) height = rectangle.Height; } if (index5 == 1) { color4 = Lighting.GetColor(x + 1, y - 1); num20 = 8; if (rectangle.Height < 8) height = rectangle.Height; } if (index5 == 2) { color4 = Lighting.GetColor(x - 1, y + 1); num21 = 8; height = 8 - (16 - rectangle.Height); } if (index5 == 3) { color4 = Lighting.GetColor(x + 1, y + 1); num20 = 8; num21 = 8; height = 8 - (16 - rectangle.Height); } color4 = new Microsoft.Xna.Framework.Color((int) (byte) ((float) color4.R * num15), (int) (byte) ((float) color4.G * num15), (int) (byte) ((float) color4.B * num15), (int) (byte) ((float) color4.A * num15)); color3.R = (byte) (((int) color2.R * 3 + (int) color4.R * 2) / 5); color3.G = (byte) (((int) color2.G * 3 + (int) color4.G * 2) / 5); color3.B = (byte) (((int) color2.B * 3 + (int) color4.B * 2) / 5); color3.A = (byte) (((int) color2.A * 3 + (int) color4.A * 2) / 5); Main.spriteBatch.Draw(TextureAssets.Liquid[index1].Value, vector2_2 - Main.screenPosition + new Vector2((float) num20, (float) num21) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(rectangle.X + num20, rectangle.Y + num21, width, height)), color3, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } } else Main.spriteBatch.Draw(TextureAssets.Liquid[index1].Value, vector2_2 - Main.screenPosition + vector2_1, new Microsoft.Xna.Framework.Rectangle?(rectangle), color1, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } else { if (rectangle.Y < 4) rectangle.X += (int) ((double) Main.wFrame * 18.0); Main.spriteBatch.Draw(TextureAssets.Liquid[index1].Value, vector2_2 - Main.screenPosition + vector2_1, new Microsoft.Xna.Framework.Rectangle?(rectangle), color1, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (Main.tile[x, y + 1].halfBrick()) { color1 = Lighting.GetColor(x, y + 1); color1 = new Microsoft.Xna.Framework.Color((int) (byte) ((float) color1.R * num15), (int) (byte) ((float) color1.G * num15), (int) (byte) ((float) color1.B * num15), (int) (byte) ((float) color1.A * num15)); vector2_2 = new Vector2((float) (x * 16), (float) (y * 16 + 16)); Main.spriteBatch.Draw(TextureAssets.Liquid[index1].Value, vector2_2 - Main.screenPosition + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 4, 16, 8)), color1, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } } } } } if (!Main.drewLava) { Main.ambientLavaX = (float) num4; Main.ambientLavaY = (float) num5; Main.ambientLavaStrength = num1; } Main.drewLava = true; } protected bool FullTile(int x, int y) { 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) return false; Tile tile = Main.tile[x, y]; if (tile == null || !tile.active() || (int) tile.type < TileID.Sets.DrawsWalls.Length && TileID.Sets.DrawsWalls[(int) tile.type] || !Main.tileSolid[(int) tile.type] || Main.tileSolidTop[(int) tile.type]) return false; int frameX = (int) tile.frameX; int frameY = (int) tile.frameY; if (Main.tileLargeFrames[(int) tile.type] > (byte) 0) { if ((frameY == 18 || frameY == 108) && (frameX >= 18 && frameX <= 54 || frameX >= 108 && frameX <= 144)) return true; } else if (frameY == 18) { if (frameX >= 18 && frameX <= 54 || frameX >= 108 && frameX <= 144) return true; } else if (frameY >= 90 && frameY <= 196 && (frameX <= 70 || frameX >= 144 && frameX <= 232)) return true; return false; } protected void DrawBlack(bool force = false) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); Vector2 vector2 = Main.drawToScreen ? Vector2.Zero : new Vector2((float) Main.offScreenRange, (float) Main.offScreenRange); int num1 = ((int) Main.tileColor.R + (int) Main.tileColor.G + (int) Main.tileColor.B) / 3; float num2 = (float) num1 * 0.4f / (float) byte.MaxValue; switch (Lighting.Mode) { case LightMode.Retro: num2 = (float) ((int) Main.tileColor.R - 55) / (float) byte.MaxValue; if ((double) num2 < 0.0) { num2 = 0.0f; break; } break; case LightMode.Trippy: num2 = (float) (num1 - 55) / (float) byte.MaxValue; if ((double) num2 < 0.0) { num2 = 0.0f; break; } break; } Microsoft.Xna.Framework.Point screenOverdrawOffset = Main.GetScreenOverdrawOffset(); Microsoft.Xna.Framework.Point point = new Microsoft.Xna.Framework.Point(-Main.offScreenRange / 16 + screenOverdrawOffset.X, -Main.offScreenRange / 16 + screenOverdrawOffset.Y); int num3 = (int) (((double) Main.screenPosition.X - (double) vector2.X) / 16.0 - 1.0) + point.X; int num4 = (int) (((double) Main.screenPosition.X + (double) Main.screenWidth + (double) vector2.X) / 16.0) + 2 - point.X; int val1_1 = (int) (((double) Main.screenPosition.Y - (double) vector2.Y) / 16.0 - 1.0) + point.Y; int val1_2 = (int) (((double) Main.screenPosition.Y + (double) Main.screenHeight + (double) vector2.Y) / 16.0) + 5 - point.Y; if (num3 < 0) num3 = point.X; if (num4 > Main.maxTilesX) num4 = Main.maxTilesX - point.X; if (val1_1 < 0) val1_1 = point.Y; if (val1_2 > Main.maxTilesY) val1_2 = Main.maxTilesY - point.Y; if (!force) { if (val1_1 < Main.maxTilesY / 2) { val1_2 = Math.Min(val1_2, (int) Main.worldSurface + 1); val1_1 = Math.Min(val1_1, (int) Main.worldSurface + 1); } else { val1_2 = Math.Max(val1_2, Main.UnderworldLayer); val1_1 = Math.Max(val1_1, Main.UnderworldLayer); } } for (int y = val1_1; y < val1_2; ++y) { bool flag = y >= Main.UnderworldLayer; if (flag) num2 = 0.2f; for (int x = num3; x < num4; ++x) { int num5 = x; for (; x < num4; ++x) { if (!WorldGen.InWorld(x, y)) return; if (Main.tile[x, y] == null) Main.tile[x, y] = new Tile(); Tile testTile = Main.tile[x, y]; float num6 = (float) Math.Floor((double) Lighting.Brightness(x, y) * (double) byte.MaxValue) / (float) byte.MaxValue; byte liquid = testTile.liquid; if (((((double) num6 > (double) num2 ? 0 : (!flag && liquid < (byte) 250 || WorldGen.SolidTile(testTile) ? 1 : (liquid < (byte) 200 ? 0 : ((double) num6 == 0.0 ? 1 : 0)))) == 0 ? 0 : (!WallID.Sets.Transparent[(int) testTile.wall] ? 1 : (!Main.tile[x, y].active() ? 0 : (Main.tileBlockLight[(int) testTile.type] ? 1 : 0)))) == 0 ? 0 : (Main.drawToScreen || !LiquidRenderer.Instance.HasFullWater(x, y) || testTile.wall != (ushort) 0 || testTile.halfBrick() ? 1 : ((double) y <= Main.worldSurface ? 1 : 0))) == 0) break; } if (x - num5 > 0) Main.spriteBatch.Draw(TextureAssets.BlackTile.Value, new Vector2((float) (num5 << 4), (float) (y << 4)) - Main.screenPosition + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, x - num5 << 4, 16)), Microsoft.Xna.Framework.Color.Black); } } TimeLogger.DrawTime(5, stopwatch.Elapsed.TotalMilliseconds); } protected void RenderBlack() { if (Main.drawToScreen) return; this.GraphicsDevice.SetRenderTarget(this.blackTarget); this.GraphicsDevice.DepthStencilState = new DepthStencilState() { DepthBufferEnable = true }; this.GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Transparent); Main.spriteBatch.Begin(); this.DrawBlack(); TimeLogger.DetailedDrawReset(); Main.spriteBatch.End(); TimeLogger.DetailedDrawTime(30); this.GraphicsDevice.SetRenderTarget((RenderTarget2D) null); } protected void DrawWalls() => this.WallsRenderer.DrawWalls(); protected void RenderWalls() { if (Main.drawToScreen) return; this.GraphicsDevice.SetRenderTarget(this.wallTarget); this.GraphicsDevice.DepthStencilState = new DepthStencilState() { DepthBufferEnable = true }; this.GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Transparent); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend); Main.tileBatch.Begin(); if (Main.ignoreErrors) { try { this.DrawWalls(); } catch (Exception ex) { TimeLogger.DrawException(ex); } } else this.DrawWalls(); TimeLogger.DetailedDrawReset(); Main.tileBatch.End(); Main.spriteBatch.End(); TimeLogger.DetailedDrawTime(32); this.GraphicsDevice.SetRenderTarget((RenderTarget2D) null); } protected void ReleaseTargets() { try { if (Main.dedServ) return; Main.offScreenRange = 0; Main.targetSet = false; if (Main.waterTarget != null) Main.waterTarget.Dispose(); if (this.backWaterTarget != null) this.backWaterTarget.Dispose(); if (this.blackTarget != null) this.blackTarget.Dispose(); if (this.tileTarget != null) this.tileTarget.Dispose(); if (this.tile2Target != null) this.tile2Target.Dispose(); if (this.wallTarget != null) this.wallTarget.Dispose(); if (Main.screenTarget != null) Main.screenTarget.Dispose(); if (Main.screenTargetSwap != null) Main.screenTargetSwap.Dispose(); if (this.backgroundTarget != null) this.backgroundTarget.Dispose(); if (Main.OnRenderTargetsReleased == null) return; Main.OnRenderTargetsReleased(); } catch { } } protected bool checkMap(int i, int j) { if (this.mapTarget[i, j] == null || this.mapTarget[i, j].IsDisposed) Main.initMap[i, j] = false; if (!Main.initMap[i, j]) { try { int width = Main.textureMaxWidth; int height = Main.textureMaxHeight; if (i == Main.mapTargetX - 1) width = 400; if (j == Main.mapTargetY - 1) height = 600; this.mapTarget[i, j] = new RenderTarget2D(this.GraphicsDevice, width, height, false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None, 0, RenderTargetUsage.PreserveContents); } catch { Main.mapEnabled = false; for (int index1 = 0; index1 < Main.mapTargetX; ++index1) { for (int index2 = 0; index2 < Main.mapTargetY; ++index2) { try { Main.initMap[index1, index2] = false; this.mapTarget[index1, index2].Dispose(); } catch { } } } return false; } Main.initMap[i, j] = true; } return true; } protected void InitMap() { int mapTargetX = Main.mapTargetX; int mapTargetY = Main.mapTargetY; if (!Main.mapEnabled) return; try { for (int index1 = 0; index1 < mapTargetX; ++index1) { for (int index2 = 0; index2 < mapTargetY; ++index2) this.mapTarget[index1, index2] = new RenderTarget2D(this.GraphicsDevice, Main.textureMaxWidth, Main.textureMaxHeight, false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None, 0, RenderTargetUsage.PreserveContents); } Main.mapInit = true; } catch { Main.mapEnabled = false; for (int index3 = 0; index3 < mapTargetX; ++index3) { for (int index4 = 0; index4 < mapTargetY; ++index4) { try { if (this.mapTarget[index3, index4] != null) this.mapTarget[index3, index4].Dispose(); } catch { } } } } } protected void InitTargets() { this.UpdateDisplaySettings(); this.InitTargets(this.GraphicsDevice.PresentationParameters.BackBufferWidth, this.GraphicsDevice.PresentationParameters.BackBufferHeight); } protected void EnsureRenderTargetContent() { if (Main.waterTarget != null && !Main.waterTarget.IsContentLost && this.backWaterTarget != null && !this.backWaterTarget.IsContentLost && this.blackTarget != null && !this.blackTarget.IsContentLost && this.tileTarget != null && !this.tileTarget.IsContentLost && this.tile2Target != null && !this.tile2Target.IsContentLost && this.wallTarget != null && !this.wallTarget.IsContentLost && this.backgroundTarget != null && !this.backgroundTarget.IsContentLost && Main.screenTarget != null && !Main.screenTarget.IsContentLost && Main.screenTargetSwap != null && !Main.screenTargetSwap.IsContentLost) return; this.InitTargets(); } protected void InitTargets(int width, int height) { this.ReleaseTargets(); Main.offScreenRange = 192; if (width + Main.offScreenRange * 2 > Main._renderTargetMaxSize) Main.offScreenRange = (Main._renderTargetMaxSize - width) / 2; width += Main.offScreenRange * 2; height += Main.offScreenRange * 2; try { if (Main.dedServ) return; Main.targetSet = true; Main.waterTarget = new RenderTarget2D(this.GraphicsDevice, width, height, false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None); this.backWaterTarget = new RenderTarget2D(this.GraphicsDevice, width, height, false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None); this.blackTarget = new RenderTarget2D(this.GraphicsDevice, width, height, false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None); this.tileTarget = new RenderTarget2D(this.GraphicsDevice, width, height, false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None); this.tile2Target = new RenderTarget2D(this.GraphicsDevice, width, height, false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None); this.wallTarget = new RenderTarget2D(this.GraphicsDevice, width, height, false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None); this.backgroundTarget = new RenderTarget2D(this.GraphicsDevice, width, height, false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None); Main.screenTarget = new RenderTarget2D(this.GraphicsDevice, this.GraphicsDevice.PresentationParameters.BackBufferWidth, this.GraphicsDevice.PresentationParameters.BackBufferHeight, false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None); Main.screenTargetSwap = new RenderTarget2D(this.GraphicsDevice, this.GraphicsDevice.PresentationParameters.BackBufferWidth, this.GraphicsDevice.PresentationParameters.BackBufferHeight, false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.None); if (Main.OnRenderTargetsInitialized == null) return; Main.OnRenderTargetsInitialized(this.GraphicsDevice.PresentationParameters.BackBufferWidth, this.GraphicsDevice.PresentationParameters.BackBufferHeight); } catch { Lighting.Mode = LightMode.Retro; Main.mapEnabled = false; Main.SaveSettings(); try { this.ReleaseTargets(); } catch { } } } protected void DrawWires() { Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 16); Vector2 zero1 = Vector2.Zero; this.DrawWiresSpecialTiles.Clear(); bool flag1 = !WiresUI.Settings.HideWires; float num1 = 1f; if (WiresUI.Settings.HideWires) num1 = 0.5f; int num2 = 1; int num3 = 1; int num4 = 1; int num5 = 1; int num6 = 1; if (Main.player[Main.myPlayer].InfoAccMechShowWires) { int[] builderAccStatus = Main.player[Main.myPlayer].builderAccStatus; num2 = builderAccStatus[4]; num3 = builderAccStatus[5]; num4 = builderAccStatus[6]; num5 = builderAccStatus[7]; num6 = builderAccStatus[9]; } double gfxQuality1 = (double) Main.gfxQuality; double gfxQuality2 = (double) Main.gfxQuality; Vector2 zero2 = Vector2.Zero; if (Main.drawToScreen) zero2 = Vector2.Zero; int num7 = (int) (((double) Main.screenPosition.X - (double) zero2.X) / 16.0 - 1.0); int num8 = (int) (((double) Main.screenPosition.X + (double) Main.screenWidth + (double) zero2.X) / 16.0) + 2; int num9 = (int) (((double) Main.screenPosition.Y - (double) zero2.Y) / 16.0 - 1.0); int num10 = (int) (((double) Main.screenPosition.Y + (double) Main.screenHeight + (double) zero2.Y) / 16.0) + 5; if (num7 < 0) num7 = 0; if (num8 > Main.maxTilesX) num8 = Main.maxTilesX; if (num9 < 0) num9 = 0; if (num10 > Main.maxTilesY) num10 = Main.maxTilesY; Microsoft.Xna.Framework.Point screenOverdrawOffset = Main.GetScreenOverdrawOffset(); for (int y = num9 + screenOverdrawOffset.Y; y < num10 - screenOverdrawOffset.Y; ++y) { for (int x = num7 + screenOverdrawOffset.X; x < num8 - screenOverdrawOffset.X; ++x) { bool flag2 = false; bool flag3 = false; bool flag4 = false; bool flag5 = false; float num11 = 0.0f; Tile tile = Main.tile[x, y]; if (flag1) { int num12 = 0; if (tile.active()) { if (tile.type == (ushort) 424) { switch ((int) tile.frameX / 18) { case 0: num12 += 72; break; case 1: num12 += 144; break; case 2: num12 += 216; break; } } else if (tile.type == (ushort) 445) num12 += 72; } if (tile.wire()) { ++num11; int num13 = 0; if (Main.tile[x, y - 1].wire()) { num13 += 18; flag4 = true; } if (Main.tile[x + 1, y].wire()) { num13 += 36; flag3 = true; } if (Main.tile[x, y + 1].wire()) { num13 += 72; flag5 = true; } if (Main.tile[x - 1, y].wire()) { num13 += 144; flag2 = true; } rectangle.Y = num12; rectangle.X = num13; Microsoft.Xna.Framework.Color color = Lighting.GetColor(x, y); switch (num2) { case 0: color = Microsoft.Xna.Framework.Color.White; break; case 2: color *= 0.5f; break; case 3: color = Microsoft.Xna.Framework.Color.Transparent; break; } if (color == Microsoft.Xna.Framework.Color.Transparent) --num11; else Main.spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2((float) (x * 16 - (int) Main.screenPosition.X), (float) (y * 16 - (int) Main.screenPosition.Y)) + zero2, new Microsoft.Xna.Framework.Rectangle?(rectangle), color, 0.0f, zero1, 1f, SpriteEffects.None, 0.0f); } if (tile.wire2()) { int num14; bool flag6 = (num14 = 0) != 0; bool flag7 = num14 != 0; bool flag8 = num14 != 0; bool flag9 = num14 != 0; bool flag10 = num14 != 0; ++num11; int num15 = 0; if (Main.tile[x, y - 1].wire2()) { num15 += 18; flag8 = true; if (flag4) flag6 = true; } if (Main.tile[x + 1, y].wire2()) { num15 += 36; flag9 = true; if (flag3) flag6 = true; } if (Main.tile[x, y + 1].wire2()) { num15 += 72; flag7 = true; if (flag5) flag6 = true; } if (Main.tile[x - 1, y].wire2()) { num15 += 144; flag10 = true; if (flag2) flag6 = true; } if ((double) num11 > 1.0) flag6 = true; rectangle.Y = num12 + 18; rectangle.X = num15; Microsoft.Xna.Framework.Color color = Lighting.GetColor(x, y); switch (num3) { case 0: color = Microsoft.Xna.Framework.Color.White; break; case 2: color *= 0.5f; break; case 3: color = Microsoft.Xna.Framework.Color.Transparent; break; } if (color == Microsoft.Xna.Framework.Color.Transparent) { --num11; } else { Main.spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2((float) (x * 16 - (int) Main.screenPosition.X), (float) (y * 16 - (int) Main.screenPosition.Y)) + zero2, new Microsoft.Xna.Framework.Rectangle?(rectangle), color * (1f / num11), 0.0f, zero1, 1f, SpriteEffects.None, 0.0f); if (flag8) { if (flag6 && !flag4) Main.spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2((float) (x * 16 - (int) Main.screenPosition.X), (float) (y * 16 - (int) Main.screenPosition.Y)) + zero2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(18, rectangle.Y, 16, 6)), color, 0.0f, zero1, 1f, SpriteEffects.None, 0.0f); flag4 = true; } if (flag7) { if (flag6 && !flag5) Main.spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2((float) (x * 16 - (int) Main.screenPosition.X), (float) (y * 16 - (int) Main.screenPosition.Y)) + zero2 + new Vector2(0.0f, 10f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(72, rectangle.Y + 10, 16, 6)), color, 0.0f, zero1, 1f, SpriteEffects.None, 0.0f); flag5 = true; } if (flag9) { if (flag6 && !flag3) Main.spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2((float) (x * 16 - (int) Main.screenPosition.X), (float) (y * 16 - (int) Main.screenPosition.Y)) + zero2 + new Vector2(10f, 0.0f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(46, rectangle.Y, 6, 16)), color, 0.0f, zero1, 1f, SpriteEffects.None, 0.0f); flag3 = true; } if (flag10) { if (flag6 && !flag2) Main.spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2((float) (x * 16 - (int) Main.screenPosition.X), (float) (y * 16 - (int) Main.screenPosition.Y)) + zero2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(144, rectangle.Y, 6, 16)), color, 0.0f, zero1, 1f, SpriteEffects.None, 0.0f); flag2 = true; } } } if (tile.wire3()) { int num16; bool flag11 = (num16 = 0) != 0; bool flag12 = num16 != 0; bool flag13 = num16 != 0; bool flag14 = num16 != 0; bool flag15 = num16 != 0; ++num11; int num17 = 0; if (Main.tile[x, y - 1].wire3()) { num17 += 18; flag13 = true; if (flag4) flag11 = true; } if (Main.tile[x + 1, y].wire3()) { num17 += 36; flag14 = true; if (flag3) flag11 = true; } if (Main.tile[x, y + 1].wire3()) { num17 += 72; flag12 = true; if (flag5) flag11 = true; } if (Main.tile[x - 1, y].wire3()) { num17 += 144; flag15 = true; if (flag2) flag11 = true; } if ((double) num11 > 1.0) flag11 = true; rectangle.Y = num12 + 36; rectangle.X = num17; Microsoft.Xna.Framework.Color color = Lighting.GetColor(x, y); switch (num4) { case 0: color = Microsoft.Xna.Framework.Color.White; break; case 2: color *= 0.5f; break; case 3: color = Microsoft.Xna.Framework.Color.Transparent; break; } if (color == Microsoft.Xna.Framework.Color.Transparent) { --num11; } else { Main.spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2((float) (x * 16 - (int) Main.screenPosition.X), (float) (y * 16 - (int) Main.screenPosition.Y)) + zero2, new Microsoft.Xna.Framework.Rectangle?(rectangle), color * (1f / num11), 0.0f, zero1, 1f, SpriteEffects.None, 0.0f); if (flag13) { if (flag11 && !flag4) Main.spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2((float) (x * 16 - (int) Main.screenPosition.X), (float) (y * 16 - (int) Main.screenPosition.Y)) + zero2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(18, rectangle.Y, 16, 6)), color, 0.0f, zero1, 1f, SpriteEffects.None, 0.0f); flag4 = true; } if (flag12) { if (flag11 && !flag5) Main.spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2((float) (x * 16 - (int) Main.screenPosition.X), (float) (y * 16 - (int) Main.screenPosition.Y)) + zero2 + new Vector2(0.0f, 10f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(72, rectangle.Y + 10, 16, 6)), color, 0.0f, zero1, 1f, SpriteEffects.None, 0.0f); flag5 = true; } if (flag14) { if (flag11 && !flag3) Main.spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2((float) (x * 16 - (int) Main.screenPosition.X), (float) (y * 16 - (int) Main.screenPosition.Y)) + zero2 + new Vector2(10f, 0.0f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(46, rectangle.Y, 6, 16)), color, 0.0f, zero1, 1f, SpriteEffects.None, 0.0f); flag3 = true; } if (flag15) { if (flag11 && !flag2) Main.spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2((float) (x * 16 - (int) Main.screenPosition.X), (float) (y * 16 - (int) Main.screenPosition.Y)) + zero2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(144, rectangle.Y, 6, 16)), color, 0.0f, zero1, 1f, SpriteEffects.None, 0.0f); flag2 = true; } } } if (tile.wire4()) { int num18; bool flag16 = (num18 = 0) != 0; bool flag17 = num18 != 0; bool flag18 = num18 != 0; bool flag19 = num18 != 0; bool flag20 = num18 != 0; float num19 = num11 + 1f; int num20 = 0; if (Main.tile[x, y - 1].wire4()) { num20 += 18; flag18 = true; if (flag4) flag16 = true; } if (Main.tile[x + 1, y].wire4()) { num20 += 36; flag19 = true; if (flag3) flag16 = true; } if (Main.tile[x, y + 1].wire4()) { num20 += 72; flag17 = true; if (flag5) flag16 = true; } if (Main.tile[x - 1, y].wire4()) { num20 += 144; flag20 = true; if (flag2) flag16 = true; } if ((double) num19 > 1.0) flag16 = true; rectangle.Y = num12 + 54; rectangle.X = num20; Microsoft.Xna.Framework.Color color = Lighting.GetColor(x, y); switch (num5) { case 0: color = Microsoft.Xna.Framework.Color.White; break; case 2: color *= 0.5f; break; case 3: color = Microsoft.Xna.Framework.Color.Transparent; break; } if (color == Microsoft.Xna.Framework.Color.Transparent) { float num21 = num19 - 1f; } else { Main.spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2((float) (x * 16 - (int) Main.screenPosition.X), (float) (y * 16 - (int) Main.screenPosition.Y)) + zero2, new Microsoft.Xna.Framework.Rectangle?(rectangle), color * (1f / num19), 0.0f, zero1, 1f, SpriteEffects.None, 0.0f); if (flag18) { if (flag16 && !flag4) Main.spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2((float) (x * 16 - (int) Main.screenPosition.X), (float) (y * 16 - (int) Main.screenPosition.Y)) + zero2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(18, rectangle.Y, 16, 6)), color, 0.0f, zero1, 1f, SpriteEffects.None, 0.0f); } if (flag17) { if (flag16 && !flag5) Main.spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2((float) (x * 16 - (int) Main.screenPosition.X), (float) (y * 16 - (int) Main.screenPosition.Y)) + zero2 + new Vector2(0.0f, 10f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(72, rectangle.Y + 10, 16, 6)), color, 0.0f, zero1, 1f, SpriteEffects.None, 0.0f); } if (flag19) { if (flag16 && !flag3) Main.spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2((float) (x * 16 - (int) Main.screenPosition.X), (float) (y * 16 - (int) Main.screenPosition.Y)) + zero2 + new Vector2(10f, 0.0f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(46, rectangle.Y, 6, 16)), color, 0.0f, zero1, 1f, SpriteEffects.None, 0.0f); } if (flag20) { if (flag16 && !flag2) Main.spriteBatch.Draw(TextureAssets.WireNew.Value, new Vector2((float) (x * 16 - (int) Main.screenPosition.X), (float) (y * 16 - (int) Main.screenPosition.Y)) + zero2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(144, rectangle.Y, 6, 16)), color, 0.0f, zero1, 1f, SpriteEffects.None, 0.0f); } } } } if (Main.tile[x, y].actuator() && ((double) Lighting.Brightness(x, y) > 0.0 || num6 == 0)) { Microsoft.Xna.Framework.Color color = Lighting.GetColor(x, y); switch (num6) { case 0: color = Microsoft.Xna.Framework.Color.White; break; case 2: color *= 0.5f; break; case 3: color = Microsoft.Xna.Framework.Color.Transparent; break; } Main.spriteBatch.Draw(TextureAssets.Actuator.Value, new Vector2((float) (x * 16 - (int) Main.screenPosition.X), (float) (y * 16 - (int) Main.screenPosition.Y)) + zero2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Actuator.Width(), TextureAssets.Actuator.Height())), color * num1, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (tile.active() && tile.type == (ushort) 423 && tile.frameY == (short) 36) this.DrawWiresSpecialTiles.Add(Tuple.Create(x, y, tile.type)); } } for (int index = 0; index < this.DrawWiresSpecialTiles.Count; ++index) { Tuple wiresSpecialTile = this.DrawWiresSpecialTiles[index]; if (wiresSpecialTile.Item3 == (ushort) 423) { Vector2 start = new Vector2((float) (wiresSpecialTile.Item1 * 16 - 32 - 1), (float) (wiresSpecialTile.Item2 * 16 - 160 - 1)) + zero2; Vector2 end = new Vector2((float) (wiresSpecialTile.Item1 * 16 + 48 + 1), (float) (wiresSpecialTile.Item2 * 16 + 1)) + zero2; Utils.DrawRectangle(Main.spriteBatch, start, end, Microsoft.Xna.Framework.Color.LightSeaGreen, Microsoft.Xna.Framework.Color.LightSeaGreen, 2f); } } TimeLogger.DetailedDrawTime(34); } public static int ConvertPaintIdToTileShaderIndex( int paintIndexOnTile, bool isUsedForPaintingGrass, bool useWallShaderHacks) { if (paintIndexOnTile == 31) return 0; if (paintIndexOnTile == 30 & useWallShaderHacks) return 43; if (paintIndexOnTile >= 28) return paintIndexOnTile + 12; return isUsedForPaintingGrass && paintIndexOnTile >= 1 && paintIndexOnTile <= 12 ? paintIndexOnTile + 27 : paintIndexOnTile; } public static void ResetWindCounter(bool resetExtreme = false) { FastRandom withRandomSeed = FastRandom.CreateWithRandomSeed(); Main.windCounter = withRandomSeed.Next(900, 2701); if (!resetExtreme) return; Main.extremeWindCounter = withRandomSeed.Next(10, 31); } public static void NewLightning() { if (Main.DisableIntenseVisualEffects) return; Main.thunderDelay = Main.rand.Next(3) != 0 ? (Main.rand.Next(2) != 0 ? Main.rand.Next(11, 61) : Main.rand.Next(31, 121)) : Main.rand.Next(1, 31); Main.thunderDistance = Main.thunderDelay; Main.lightningDecay = (float) ((double) Main.rand.NextFloat() * 0.0500000007450581 + 0.00800000037997961); Main.lightningSpeed = (float) ((double) Main.rand.NextFloat() * 0.0500000007450581 + 0.0500000007450581); } public void UpdateWeather(GameTime gameTime) { if (Main.netMode != 2) { bool isActive = this.IsActive; if (Main.thunderDelay > 0) { --Main.thunderDelay; if (Main.thunderDelay == 0) { Vector2 center = Main.player[Main.myPlayer].Center; float num1 = (float) (Main.thunderDistance * 15); if (Main.rand.Next(2) == 0) num1 *= -1f; center.X += num1; int num2 = (int) (Main.worldSurface * 16.0) - 500; if ((double) center.Y > (double) num2) center.Y = (float) num2; if (isActive) SoundEngine.PlaySound(43, center); } } if ((double) Main.lightningSpeed > 0.0) { Main.lightning += Main.lightningSpeed; if ((double) Main.lightning >= 1.0) { Main.lightning = 1f; Main.lightningSpeed = 0.0f; } Lighting.LightTiles(this.firstTileX, this.lastTileX, this.firstTileY, this.lastTileY); Lighting.LightTiles(this.firstTileX, this.lastTileX, this.firstTileY, this.lastTileY); } else if ((double) Main.lightning > 0.0) { Main.lightning -= Main.lightningDecay; Lighting.LightTiles(this.firstTileX, this.lastTileX, this.firstTileY, this.lastTileY); Lighting.LightTiles(this.firstTileX, this.lastTileX, this.firstTileY, this.lastTileY); } else if (Main.thunderDelay <= 0 && (double) Main.player[Main.myPlayer].position.Y < Main.rockLayer * 16.0 && (double) Main.atmo == 1.0) { if (Main.IsItStorming) { float num3 = 600f; float num4 = 1600f; if ((double) Main.maxRaining > 0.8) { num3 *= 0.6f; num4 *= 0.8f; } if ((double) Main.maxRaining > 0.7) { num3 *= 0.7f; num4 *= 0.9f; } if ((double) Main.maxRaining > 0.6) { num3 *= 0.8f; num4 *= 0.95f; } if ((double) Math.Abs(Main.windSpeedTarget) > 0.7) { num3 *= 0.6f; num4 *= 0.8f; } if ((double) Math.Abs(Main.windSpeedTarget) > 0.6) { num3 *= 0.7f; num4 *= 0.9f; } if ((double) Math.Abs(Main.windSpeedTarget) > 0.5) { num3 *= 0.8f; num4 *= 0.95f; } float num5 = (float) Main.rand.Next((int) num3, (int) num4) * (float) ((1.0 - (double) Main.maxRaining + 1.0) / 2.0) * (float) ((1.0 - (double) Main.windSpeedTarget + 1.0) / 2.0) * (float) Main.dayRate; if (Main.rand.Next((int) num5) == 0) Main.NewLightning(); } else if ((double) Main.GraveyardVisualIntensity >= 0.9 && Main.rand.Next(7200) == 0) Main.NewLightning(); } } float num6 = 0.8f; float num7 = 0.0003f; float num8 = Main.windSpeedTarget * (float) (1.0 + 0.555555582046509 * (double) Main.maxRaining); bool enabled = CreativePowerManager.Instance.GetPower().Enabled; if (!enabled && LanternNight.LanternsUp) Main.windSpeedTarget = 0.0f; float num9 = num7 + Math.Abs(num8 - Main.windSpeedCurrent) * 0.0015f; if ((double) Main.windSpeedCurrent < (double) num8) { Main.windSpeedCurrent += num9; if ((double) Main.windSpeedCurrent > (double) num8) Main.windSpeedCurrent = num8; } else if ((double) Main.windSpeedCurrent > (double) num8) { Main.windSpeedCurrent -= num9; if ((double) Main.windSpeedCurrent < (double) num8) Main.windSpeedCurrent = num8; } switch (Main.netMode) { case 1: break; case 2: if (!enabled && LanternNight.LanternsUp) break; if (!enabled) { --Main.windCounter; if (Main.windCounter <= 0) { float num10 = 1f; if ((double) Main.windSpeedTarget < 0.0) num10 = -1f; if (Main.rand.Next(4) == 0) Main.windSpeedTarget += (float) Main.rand.Next(-25, 26) * (1f / 1000f); else if (Main.rand.Next(2) == 0) Main.windSpeedTarget += (float) Main.rand.Next(-50, 51) * (1f / 1000f); else Main.windSpeedTarget += (float) Main.rand.Next(-100, 101) * (1f / 1000f); --Main.extremeWindCounter; if (Main.extremeWindCounter <= 0) { Main.ResetWindCounter(true); if (Main.rand.Next(30) < 13) { if (Main.rand.Next(2) == 0) { Main.windSpeedTarget = 0.0f; Main.windCounter = Main.rand.Next(7200, 28801); } else Main.windSpeedTarget = (float) Main.rand.Next(-200, 201) * (1f / 1000f); } else Main.windSpeedTarget = Main.rand.Next(20) >= 13 ? (float) Main.rand.Next(-850, 851) * (1f / 1000f) : (float) Main.rand.Next(-400, 401) * (1f / 1000f); if ((double) Math.Abs(Main.windSpeedTarget) > 0.3) Main.extremeWindCounter += Main.rand.Next(5, 11); if ((double) Math.Abs(Main.windSpeedTarget) > 0.5) Main.extremeWindCounter += Main.rand.Next(10, 21); if ((double) Math.Abs(Main.windSpeedTarget) > 0.7) Main.extremeWindCounter += Main.rand.Next(15, 31); } else Main.ResetWindCounter(); if (Main.rand.Next(3) != 0 && ((double) num10 < 0.0 && (double) Main.windSpeedTarget > 0.0 || (double) num10 > 0.0 && (double) Main.windSpeedTarget < 0.0)) Main.windSpeedTarget *= -1f; } if ((double) Main.windSpeedTarget > (double) num6) Main.windSpeedTarget = num6; if ((double) Main.windSpeedTarget < -(double) num6) Main.windSpeedTarget = -num6; } if (Main.rand.Next(60) == 0) Main.numCloudsTemp += Main.rand.Next(-1, 2); if ((double) Main.rand.Next(1000) < 50.0 * (double) Main.cloudBGAlpha) ++Main.numCloudsTemp; if ((double) Main.rand.Next(1300) < 25.0 * (1.0 - (double) Main.cloudBGAlpha)) --Main.numCloudsTemp; if ((double) Main.rand.Next(1000) < 200.0 * (double) Main.cloudAlpha && Main.numCloudsTemp < 100) ++Main.numCloudsTemp; if ((double) Main.rand.Next(1000) < 50.0 * (double) Main.cloudAlpha) ++Main.numCloudsTemp; if (Main.numCloudsTemp > 66 && Main.rand.Next(100) == 0) Main.numCloudsTemp -= Main.rand.Next(1, 3); if (Main.numCloudsTemp < 50 && Main.rand.Next(100) == 0) Main.numCloudsTemp += Main.rand.Next(1, 3); if ((double) Main.cloudBGActive <= 0.0 && Main.numCloudsTemp > 100 && (double) Main.cloudAlpha == 0.0) Main.numCloudsTemp = 100; if (Main.numCloudsTemp < -20) Main.numCloudsTemp = -20; if ((double) Main.cloudAlpha > 0.0 && (double) Main.numClouds < 200.0 * (double) Main.cloudAlpha) { while ((double) Main.numClouds < 200.0 * (double) Main.cloudAlpha) { Main.numClouds += Main.rand.Next(30); if (Main.numClouds > 200) Main.numClouds = 200; if (Main.numCloudsTemp < Main.numClouds) Main.numCloudsTemp = Main.numClouds; } if (Main.netMode == 2) NetMessage.SendData(7); } --Main.weatherCounter; if (Main.weatherCounter > 0) break; if (Main.rand.Next(2) == 0) { if (Main.rand.Next(2) == 0) Main.numCloudsTemp += Main.rand.Next(250); else Main.numCloudsTemp += Main.rand.Next(100); } if (Main.numCloudsTemp < 0) Main.numCloudsTemp = 0; if (Main.numCloudsTemp > 200) Main.numCloudsTemp = 200; Main.numClouds = Main.numCloudsTemp; Main.weatherCounter = Main.rand.Next(3600, 10800); if (Main.netMode != 2) break; NetMessage.SendData(7); break; default: if (Main.gameMenu) break; goto case 2; } } public void LoadBackground(int i) { if (i < 0 || TextureAssets.Background[i].State != null) return; Main.Assets.Request(TextureAssets.Background[i].Name, (AssetRequestMode) 1); Main.backgroundWidth[i] = TextureAssets.Background[i].Width(); Main.backgroundHeight[i] = TextureAssets.Background[i].Height(); switch (i) { case 219: case 220: case 221: case 235: case 271: case 272: case 273: case 281: Main.backgroundWidth[i] /= 2; Main.backgroundHeight[i] /= 2; break; } } public void LoadItem(int i) { if (TextureAssets.Item[i].State != null) return; Main.Assets.Request(TextureAssets.Item[i].Name, (AssetRequestMode) 1); } public void LoadNPC(int i) { if (TextureAssets.Npc[i].State != null) return; Main.Assets.Request(TextureAssets.Npc[i].Name, (AssetRequestMode) 1); } public void LoadProjectile(int i) { if (TextureAssets.Projectile[i].State != null) return; Main.Assets.Request(TextureAssets.Projectile[i].Name, (AssetRequestMode) 1); } public void LoadGore(int i) { if (TextureAssets.Gore[i].State != null) return; Main.Assets.Request(TextureAssets.Gore[i].Name, (AssetRequestMode) 1); } public void LoadWall(int i) { if (TextureAssets.Wall[i].State != null) return; Main.Assets.Request(TextureAssets.Wall[i].Name, (AssetRequestMode) 1); } public void LoadTiles(int i) { if (TextureAssets.Tile[i].State != null) return; Main.Assets.Request(TextureAssets.Tile[i].Name, (AssetRequestMode) 1); } public void LoadItemFlames(int i) { if (TextureAssets.ItemFlame[i].State != null) return; try { Main.Assets.Request(TextureAssets.ItemFlame[i].Name, (AssetRequestMode) 1); } catch { } } public void LoadWings(int i) { if (TextureAssets.Wings[i].State != null) return; Main.Assets.Request(TextureAssets.Wings[i].Name, (AssetRequestMode) 1); } public void LoadHair(int i) { if (TextureAssets.PlayerHair[i].State != null) return; Main.Assets.Request(TextureAssets.PlayerHair[i].Name, (AssetRequestMode) 1); Main.Assets.Request(TextureAssets.PlayerHairAlt[i].Name, (AssetRequestMode) 1); } public void LoadArmorHead(int i) { if (TextureAssets.ArmorHead[i].State != null) return; Main.Assets.Request(TextureAssets.ArmorHead[i].Name, (AssetRequestMode) 1); } public void LoadArmorBody(int i) { if (ArmorIDs.Body.Sets.UsesNewFramingCode[i]) { if (TextureAssets.ArmorBodyComposite[i].State != null) return; Main.Assets.Request(TextureAssets.ArmorBodyComposite[i].Name, (AssetRequestMode) 1); } else { if (TextureAssets.ArmorBody[i].State != null) return; Main.Assets.Request(TextureAssets.FemaleBody[i].Name, (AssetRequestMode) 1); Main.Assets.Request(TextureAssets.ArmorBody[i].Name, (AssetRequestMode) 1); Main.Assets.Request(TextureAssets.ArmorArm[i].Name, (AssetRequestMode) 1); } } public void LoadArmorLegs(int i) { if (TextureAssets.ArmorLeg[i].State != null) return; Main.Assets.Request(TextureAssets.ArmorLeg[i].Name, (AssetRequestMode) 1); } public void LoadAccHandsOn(int i) { if (TextureAssets.AccHandsOn[i].State == null) Main.Assets.Request(TextureAssets.AccHandsOn[i].Name, (AssetRequestMode) 1); if (!ArmorIDs.HandOn.Sets.UsesNewFramingCode[i] || TextureAssets.AccHandsOnComposite[i].State != null) return; Main.Assets.Request(TextureAssets.AccHandsOnComposite[i].Name, (AssetRequestMode) 1); } public void LoadAccHandsOff(int i) { if (TextureAssets.AccHandsOff[i].State == null) Main.Assets.Request(TextureAssets.AccHandsOff[i].Name, (AssetRequestMode) 1); if (!ArmorIDs.HandOff.Sets.UsesNewFramingCode[i] || TextureAssets.AccHandsOffComposite[i].State != null) return; Main.Assets.Request(TextureAssets.AccHandsOffComposite[i].Name, (AssetRequestMode) 1); } public void LoadAccBack(int i) { if (TextureAssets.AccBack[i].State != null) return; Main.Assets.Request(TextureAssets.AccBack[i].Name, (AssetRequestMode) 1); } public void LoadAccFront(int i) { if (TextureAssets.AccFront[i].State != null) return; Main.Assets.Request(TextureAssets.AccFront[i].Name, (AssetRequestMode) 1); } public void LoadAccShoes(int i) { if (TextureAssets.AccShoes[i].State != null) return; Main.Assets.Request(TextureAssets.AccShoes[i].Name, (AssetRequestMode) 1); } public void LoadAccWaist(int i) { if (TextureAssets.AccWaist[i].State != null) return; Main.Assets.Request(TextureAssets.AccWaist[i].Name, (AssetRequestMode) 1); } public void LoadAccShield(int i) { if (TextureAssets.AccShield[i].State != null) return; Main.Assets.Request(TextureAssets.AccShield[i].Name, (AssetRequestMode) 1); } public void LoadAccNeck(int i) { if (TextureAssets.AccNeck[i].State != null) return; Main.Assets.Request(TextureAssets.AccNeck[i].Name, (AssetRequestMode) 1); } public void LoadAccFace(int i) { if (TextureAssets.AccFace[i].State != null) return; Main.Assets.Request(TextureAssets.AccFace[i].Name, (AssetRequestMode) 1); } public void LoadAccBalloon(int i) { if (TextureAssets.AccBalloon[i].State != null) return; Main.Assets.Request(TextureAssets.AccBalloon[i].Name, (AssetRequestMode) 1); } public void LoadFlameRing() { if (TextureAssets.FlameRing.State != null) return; Main.Assets.Request(TextureAssets.FlameRing.Name, (AssetRequestMode) 1); } protected void DrawSurfaceBG() { Microsoft.Xna.Framework.Color surfaceBackgroundsBase = Main.ColorOfSurfaceBackgroundsBase; int num1 = 30; if (Main.gameMenu) num1 = 0; if (WorldGen.drunkWorldGen) num1 = -180; float num2 = (float) Main.worldSurface; if ((double) num2 == 0.0) num2 = 1f; Vector2 screenPosition = Main.screenPosition; double num3 = (double) Main.screenPosition.Y + (double) (Main.screenHeight / 2) - 600.0; double num4 = -(double) MathHelper.Lerp((float) ((num3 - (double) this.screenOff / 2.0) / ((double) num2 * 16.0)), 1f, 0.0f); double backgroundTopMagicNumber = (-num3 + (double) this.screenOff / 2.0) / ((double) num2 * 16.0); float bgGlobalScaleMultiplier = 2f; int num5 = 0; float num6 = SkyManager.Instance.ProcessCloudAlpha() * Main.atmo; if (!Main.mapFullscreen && (double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index = 0; index < 200; ++index) { if (Main.cloud[index].active && (double) Main.cloud[index].scale < 1.0) { Microsoft.Xna.Framework.Color color = Main.cloud[index].cloudColor(Main.ColorOfTheSkies); float num7 = Main.cloud[index].scale * 0.8f; float num8 = (float) (((double) Main.cloud[index].scale + 1.0) / 2.0 * 0.899999976158142); color.R = (byte) ((double) color.R * (double) num7); color.G = (byte) ((double) color.G * (double) num8); float num9 = Main.cloud[index].position.Y * ((float) Main.screenHeight / 600f); float num10 = Main.cloud[index].position.Y + (float) (int) (backgroundTopMagicNumber * 750.0 + 830.0) + (float) (int) this.scAdj + (float) num5; Main.spriteBatch.Draw(TextureAssets.Cloud[Main.cloud[index].type].Value, new Vector2(Main.cloud[index].position.X + (float) TextureAssets.Cloud[Main.cloud[index].type].Width() * 0.5f, num10 + (float) TextureAssets.Cloud[Main.cloud[index].type].Height() * 0.5f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Cloud[Main.cloud[index].type].Width(), TextureAssets.Cloud[Main.cloud[index].type].Height())), color * num6, Main.cloud[index].rotation, new Vector2((float) TextureAssets.Cloud[Main.cloud[index].type].Width() * 0.5f, (float) TextureAssets.Cloud[Main.cloud[index].type].Height() * 0.5f), Main.cloud[index].scale, Main.cloud[index].spriteDir, 0.0f); } } } if (Main.invasionType == 4 && !SkyManager.Instance["Martian"].IsActive()) SkyManager.Instance.Activate("Martian", new Vector2()); else if (Main.invasionType != 4 && SkyManager.Instance["Martian"].IsActive()) SkyManager.Instance.Deactivate("Martian"); SkyManager.Instance.ResetDepthTracker(); this.bgParallax = 0.15; int num11 = -180; bool flag = true; int num12 = 0; if (Main.gameMenu) num12 -= num11; int pushBGTopHack = num12 + num1; if (!WorldGen.drunkWorldGen && !Main.mapFullscreen && (double) Main.screenPosition.Y / 16.0 <= Main.worldSurface + 10.0) { if (Main.BackgroundEnabled) { if ((double) Main.cloudBGActive > 0.0) { Main.cloudBGAlpha += 0.0005f * (float) Main.dayRate; if ((double) Main.cloudBGAlpha > 1.0) Main.cloudBGAlpha = 1f; } else { Main.cloudBGAlpha -= 0.0005f * (float) Main.dayRate; if ((double) Main.cloudBGAlpha < 0.0) Main.cloudBGAlpha = 0.0f; } if ((double) Main.cloudBGAlpha > 0.0) { this.LoadBackground(Main.cloudBG[0]); this.LoadBackground(Main.cloudBG[1]); float num13 = Main.cloudBGAlpha; if ((double) num13 > 1.0) num13 = 1f; Main.bgScale = 1.65f; this.bgParallax = 0.0900000035762787; if (this.IsActive && !Main.gamePaused) Main.cloudBGX[0] += (float) ((double) Main.windSpeedCurrent * this.bgParallax * 9.0) * (float) Main.dayRate; if ((double) Main.cloudBGX[0] > (double) Main.backgroundWidth[Main.cloudBG[0]] * (double) Main.bgScale) Main.cloudBGX[0] -= (float) Main.backgroundWidth[Main.cloudBG[0]] * Main.bgScale; if ((double) Main.cloudBGX[0] < (double) -Main.backgroundWidth[Main.cloudBG[0]] * (double) Main.bgScale) Main.cloudBGX[0] += (float) Main.backgroundWidth[Main.cloudBG[0]] * Main.bgScale; float num14 = (float) Main.backgroundWidth[Main.cloudBG[0]] * Main.bgScale; this.bgTopY = (int) (backgroundTopMagicNumber * 900.0 + 600.0) + (int) this.scAdj + pushBGTopHack; if (Main.gameMenu) this.bgTopY = pushBGTopHack - 150; this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) num14) - (double) num14 / 2.0 - (double) num14); this.bgStartX += (int) Main.cloudBGX[0]; this.bgLoops = Main.screenWidth / (int) num14 + 2 + 2; Main.ColorOfSurfaceBackgroundsModified = surfaceBackgroundsBase * num13; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(TextureAssets.Background[Main.cloudBG[0]].Value, new Vector2((float) this.bgStartX + num14 * (float) index, (float) this.bgTopY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.cloudBG[0]], Main.backgroundHeight[Main.cloudBG[0]])), Main.ColorOfSurfaceBackgroundsModified * num6, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); float num15 = Main.cloudBGAlpha * 1.5f; if ((double) num15 > 1.0) num15 = 1f; Main.ColorOfSurfaceBackgroundsModified = surfaceBackgroundsBase * num15; Main.bgScale = 1.85f; this.bgParallax = 0.12; if (this.IsActive && !Main.gamePaused) Main.cloudBGX[1] += (float) ((double) Main.windSpeedCurrent * this.bgParallax * 9.0) * (float) Main.dayRate; if ((double) Main.cloudBGX[1] > (double) Main.backgroundWidth[Main.cloudBG[1]] * (double) Main.bgScale) Main.cloudBGX[1] -= (float) Main.backgroundWidth[Main.cloudBG[1]] * Main.bgScale; if ((double) Main.cloudBGX[1] < (double) -Main.backgroundWidth[Main.cloudBG[1]] * (double) Main.bgScale) Main.cloudBGX[1] += (float) Main.backgroundWidth[Main.cloudBG[1]] * Main.bgScale; float num16 = (float) Main.backgroundWidth[Main.cloudBG[1]] * Main.bgScale; this.bgTopY = (int) (backgroundTopMagicNumber * 1100.0 + 750.0) + (int) this.scAdj + pushBGTopHack; if (Main.gameMenu) this.bgTopY = pushBGTopHack - 50; this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) num16) - (double) num16 / 2.0 - (double) num16); this.bgStartX += (int) Main.cloudBGX[1]; this.bgLoops = Main.screenWidth / (int) num16 + 2 + 2; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(TextureAssets.Background[Main.cloudBG[1]].Value, new Vector2((float) this.bgStartX + num16 * (float) index, (float) this.bgTopY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.cloudBG[1]], Main.backgroundHeight[Main.cloudBG[1]])), Main.ColorOfSurfaceBackgroundsModified * num6, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } this.DrawSurfaceBG_BackMountainsStep1(backgroundTopMagicNumber, bgGlobalScaleMultiplier, pushBGTopHack); } this.cTop = (float) (this.bgTopY - 50); if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index = 0; index < 200; ++index) { if (Main.cloud[index].active && (double) Main.cloud[index].scale < 1.15 && (double) Main.cloud[index].scale >= 1.0) { Microsoft.Xna.Framework.Color color = Main.cloud[index].cloudColor(Main.ColorOfTheSkies); if ((double) Main.atmo < 1.0) color *= Main.atmo; float num17 = Main.cloud[index].position.Y * ((float) Main.screenHeight / 600f); float num18 = (float) (((double) Main.screenPosition.Y / 16.0 - 24.0) / Main.worldSurface); if ((double) num18 < 0.0) num18 = 0.0f; float num19; if ((double) num18 > 1.0) num19 = 1f; if (Main.gameMenu) num19 = 1f; Main.spriteBatch.Draw(TextureAssets.Cloud[Main.cloud[index].type].Value, new Vector2(Main.cloud[index].position.X + (float) TextureAssets.Cloud[Main.cloud[index].type].Width() * 0.5f, (float) ((double) num17 + (double) TextureAssets.Cloud[Main.cloud[index].type].Height() * 0.5 + (double) this.cTop + 200.0)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Cloud[Main.cloud[index].type].Width(), TextureAssets.Cloud[Main.cloud[index].type].Height())), color * num6, Main.cloud[index].rotation, new Vector2((float) TextureAssets.Cloud[Main.cloud[index].type].Width() * 0.5f, (float) TextureAssets.Cloud[Main.cloud[index].type].Height() * 0.5f), Main.cloud[index].scale, Main.cloud[index].spriteDir, 0.0f); } } } if (Main.SceneMetrics.HolyTileCount > 0 && Main.BackgroundEnabled) { this.bgParallax = 0.17; Main.bgScale = 1.1f; this.bgTopY = (int) (backgroundTopMagicNumber * 1400.0 + 900.0) + (int) this.scAdj + pushBGTopHack; this.SetBackgroundOffsets(18, backgroundTopMagicNumber, pushBGTopHack); Main.bgScale *= bgGlobalScaleMultiplier; Main.bgWidthScaled = (int) (2100.0 * (double) Main.bgScale * 1.05); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if (Main.gameMenu) { this.bgTopY = 230 + pushBGTopHack; this.bgStartX -= 500; } SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); Microsoft.Xna.Framework.Color color = surfaceBackgroundsBase; float num20 = (float) (Main.SceneMetrics.HolyTileCount - SceneMetrics.HallowTileThreshold) / (float) (SceneMetrics.HallowTileMax - SceneMetrics.HallowTileThreshold); if ((double) num20 > 0.5) num20 = 0.5f; else if ((double) num20 < 0.0) num20 = 0.0f; color.R = (byte) ((double) color.R * (double) num20); color.G = (byte) ((double) color.G * (double) num20); color.B = (byte) ((double) color.B * (double) num20); color.A = (byte) ((double) color.A * (double) num20 * 0.800000011920929); if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { this.LoadBackground(18); this.LoadBackground(19); for (int index = 0; index < this.bgLoops; ++index) { Main.spriteBatch.Draw(TextureAssets.Background[18].Value, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index), (float) this.bgTopY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[18], Main.backgroundHeight[18])), color, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(TextureAssets.Background[19].Value, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index + 1900), (float) (this.bgTopY + 100)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[19], Main.backgroundHeight[19])), color, 0.0f, new Vector2(), Main.bgScale * 0.9f, SpriteEffects.None, 0.0f); } } } if (Main.treeMntBGSet1[1] > -1) { this.LoadBackground(Main.treeMntBGSet1[1]); this.bgParallax = 0.2; Main.bgScale = 1.15f; Main.bgScale *= bgGlobalScaleMultiplier; int num21 = Main.backgroundWidth[Main.treeMntBGSet1[1]]; if (num21 == 0) num21 = 1; Main.bgWidthScaled = (int) ((double) num21 * (double) Main.bgScale); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if (Main.treeMntBGSet1[1] == 172) ++this.bgLoops; this.bgTopY = (int) (backgroundTopMagicNumber * 1400.0 + 1260.0) + (int) this.scAdj + pushBGTopHack; } if (Main.BackgroundEnabled) this.DrawSurfaceBG_BackMountainsStep2(pushBGTopHack); this.cTop = (float) ((double) this.bgTopY * 1.00999999046326 - 150.0); if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index = 0; index < 200; ++index) { if (Main.cloud[index].active && (double) Main.cloud[index].scale >= 1.14999997615814) { Microsoft.Xna.Framework.Color color = Main.cloud[index].cloudColor(Main.ColorOfTheSkies); if ((double) Main.atmo < 1.0) color *= Main.atmo; float num22 = (float) ((double) Main.cloud[index].position.Y * ((double) Main.screenHeight / 600.0) - 100.0); float num23 = (float) (((double) Main.screenPosition.Y / 16.0 - 24.0) / Main.worldSurface); if ((double) num23 < 0.0) num23 = 0.0f; float num24; if ((double) num23 > 1.0) num24 = 1f; if (Main.gameMenu) num24 = 1f; Main.spriteBatch.Draw(TextureAssets.Cloud[Main.cloud[index].type].Value, new Vector2(Main.cloud[index].position.X + (float) TextureAssets.Cloud[Main.cloud[index].type].Width() * 0.5f, num22 + (float) TextureAssets.Cloud[Main.cloud[index].type].Height() * 0.5f + this.cTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.Cloud[Main.cloud[index].type].Width(), TextureAssets.Cloud[Main.cloud[index].type].Height())), color * num6, Main.cloud[index].rotation, new Vector2((float) TextureAssets.Cloud[Main.cloud[index].type].Width() * 0.5f, (float) TextureAssets.Cloud[Main.cloud[index].type].Height() * 0.5f), Main.cloud[index].scale, Main.cloud[index].spriteDir, 0.0f); } } } } if (flag) pushBGTopHack += num11; if (!Main.mapFullscreen) { for (int index = 0; index < Main.bgAlphaFrontLayer.Length; ++index) { if (Main.BackgroundEnabled) { Main.ColorOfSurfaceBackgroundsModified = surfaceBackgroundsBase * Main.bgAlphaFrontLayer[index]; if ((double) Main.bgAlphaFrontLayer[index] > 0.0 && index == 0) { this.DrawSurfaceBG_Forest(backgroundTopMagicNumber, bgGlobalScaleMultiplier, pushBGTopHack, Main.treeBGSet1); this.DrawSurfaceBG_DrawChangeOverlay(0); } if ((double) Main.bgAlphaFrontLayer[index] > 0.0 && index == 10) { this.DrawSurfaceBG_Forest(backgroundTopMagicNumber, bgGlobalScaleMultiplier, pushBGTopHack, Main.treeBGSet2); this.DrawSurfaceBG_DrawChangeOverlay(1); } if ((double) Main.bgAlphaFrontLayer[index] > 0.0 && index == 11) { this.DrawSurfaceBG_Forest(backgroundTopMagicNumber, bgGlobalScaleMultiplier, pushBGTopHack, Main.treeBGSet3); this.DrawSurfaceBG_DrawChangeOverlay(2); } if ((double) Main.bgAlphaFrontLayer[index] > 0.0 && index == 12) { this.DrawSurfaceBG_Forest(backgroundTopMagicNumber, bgGlobalScaleMultiplier, pushBGTopHack, Main.treeBGSet4); this.DrawSurfaceBG_DrawChangeOverlay(3); } if ((double) Main.bgAlphaFrontLayer[index] > 0.0 && index == 1) { int[] corruptBg = Main.corruptBG; this.DrawSurfaceBG_Corrupt(backgroundTopMagicNumber, bgGlobalScaleMultiplier, pushBGTopHack, corruptBg); this.DrawSurfaceBG_DrawChangeOverlay(4); } if ((double) Main.bgAlphaFrontLayer[index] > 0.0 && index == 2) { int[] desertBg = Main.desertBG; this.DrawSurfaceBG_Desert(backgroundTopMagicNumber, bgGlobalScaleMultiplier, pushBGTopHack, desertBg); this.DrawSurfaceBG_DrawChangeOverlay(9); } if ((double) Main.bgAlphaFrontLayer[index] > 0.0 && index == 3) { int[] jungleBg = Main.jungleBG; this.DrawSurfaceBG_Jungle(backgroundTopMagicNumber, bgGlobalScaleMultiplier, pushBGTopHack, jungleBg); this.DrawSurfaceBG_DrawChangeOverlay(5); } if ((double) Main.bgAlphaFrontLayer[index] > 0.0 && index == 4) this.DrawSurfaceBG_DrawChangeOverlay(10); if ((double) Main.bgAlphaFrontLayer[index] > 0.0 && index == 5) { this.DrawSurfaceBG_GoodEvilDesert(backgroundTopMagicNumber, bgGlobalScaleMultiplier, pushBGTopHack); this.DrawSurfaceBG_DrawChangeOverlay(9); } if ((double) Main.bgAlphaFrontLayer[index] > 0.0 && index == 6) { int[] hallowBg = Main.hallowBG; this.DrawSurfaceBG_Hallow(backgroundTopMagicNumber, bgGlobalScaleMultiplier, pushBGTopHack, hallowBg); this.DrawSurfaceBG_DrawChangeOverlay(7); } if ((double) Main.bgAlphaFrontLayer[index] > 0.0 && index == 7) { int[] snowBg = Main.snowBG; this.DrawSurfaceBG_Snow(backgroundTopMagicNumber, bgGlobalScaleMultiplier, pushBGTopHack, snowBg); this.DrawSurfaceBG_DrawChangeOverlay(6); } if ((double) Main.bgAlphaFrontLayer[index] > 0.0 && index == 8) { int[] crimsonBg = Main.crimsonBG; this.DrawSurfaceBG_Crimson(backgroundTopMagicNumber, bgGlobalScaleMultiplier, pushBGTopHack, crimsonBg); this.DrawSurfaceBG_DrawChangeOverlay(8); } if ((double) Main.bgAlphaFrontLayer[index] > 0.0 && index == 9) { int[] mushroomBg = Main.mushroomBG; this.DrawSurfaceBG_Mushroom(backgroundTopMagicNumber, bgGlobalScaleMultiplier, pushBGTopHack, mushroomBg); this.DrawSurfaceBG_DrawChangeOverlay(11); } } } } if (flag) { int num25 = pushBGTopHack - num11; } float fogPower = Main.DrawSurfaceBG_GetFogPower(); if (!Main.mapFullscreen && (double) fogPower > 0.0 && !Main.gameMenu && (double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { this.bgParallax = 0.1; this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.backgroundWidth[Main.background]) - (double) (Main.backgroundWidth[Main.background] / 2)); this.bgLoops = Main.screenWidth / Main.backgroundWidth[Main.background] + 2; this.bgStartY = 0; this.bgLoopsY = 0; this.bgTopY = (int) (-(double) Main.screenPosition.Y / (Main.worldSurface * 16.0 - 600.0) * 200.0); Texture2D texture = TextureAssets.Background[49].Value; for (int index = 0; index < this.bgLoops; ++index) { this.bgStartX = 0; Microsoft.Xna.Framework.Color color = Main.ColorOfTheSkies * fogPower * Main.atmo; int height = Math.Max(Main.screenHeight + 210, texture.Height); Main.spriteBatch.Draw(texture, new Microsoft.Xna.Framework.Rectangle(this.bgStartX + texture.Width * index, this.bgTopY, texture.Width, height), color); } } if (Main.mapFullscreen) return; SkyManager.Instance.DrawRemainingDepth(Main.spriteBatch); } private static float DrawSurfaceBG_GetFogPower() => Math.Max(Main.cloudAlpha, Main.GraveyardVisualIntensity * 0.92f); private void DrawSurfaceBG_DrawBackMountainsLayer(int bgTextureIndex) { if (bgTextureIndex < 0) return; this.LoadBackground(bgTextureIndex); int layerYoffset = this.DrawSurfaceBG_GetLayerYOffset(bgTextureIndex); this.bgTopY += layerYoffset; for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(TextureAssets.Background[bgTextureIndex].Value, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index), (float) this.bgTopY), this.GetBackgroundRect(bgTextureIndex), Main.ColorOfSurfaceBackgroundsModified, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); this.bgTopY -= layerYoffset; } private int DrawSurfaceBG_GetLayerYOffset(int bgTextureIndex) { switch (bgTextureIndex) { case 59: return -550; case 93: case 168: case 169: case 170: return -50; case 171: return -100; case 172: return 130; case 176: return -760; case 177: return -200; case 179: return -100; case 180: case 181: case 182: case 183: return -350; case 246: return -150; case 247: return -150; case 263: return -700; case 269: return -100; case 270: return -50; case 271: return -300; case 272: return -380; case 277: return -260; case 278: return -120; case 280: return -170; case 281: return -300; case 283: return -800; default: return 0; } } private float GetForestToForestBackgroundLerperValue() => (float) ((double) (Main.GlobalTimeWrappedHourly * 1.570796f).ToRotationVector2().X * 0.5 + 0.5); private void DrawSurfaceBG_BackMountainsStep1( double backgroundTopMagicNumber, float bgGlobalScaleMultiplier, int pushBGTopHack) { Microsoft.Xna.Framework.Color surfaceBackgroundsBase = Main.ColorOfSurfaceBackgroundsBase; Main.bgScale = 1f; this.bgTopY = (int) (backgroundTopMagicNumber * 1300.0 + 1090.0) + (int) this.scAdj + pushBGTopHack; Main.bgScale *= bgGlobalScaleMultiplier; this.bgParallax = 0.15; Main.bgWidthScaled = (int) (1024.0 * (double) Main.bgScale); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); if (Main.bgWidthScaled == 0) Main.bgWidthScaled = 1024; this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if (Main.gameMenu) this.bgTopY = 100 + pushBGTopHack; if ((double) Main.screenPosition.Y >= Main.worldSurface * 16.0 + 16.0) return; if ((double) Main.bgAlphaFarBackLayer[0] > 0.0) { Main.ColorOfSurfaceBackgroundsModified = surfaceBackgroundsBase * Main.bgAlphaFarBackLayer[0]; this.DrawSurfaceBG_DrawBackMountainsLayer(Main.treeMntBGSet1[0]); } if ((double) Main.bgAlphaFarBackLayer[10] > 0.0) { Main.ColorOfSurfaceBackgroundsModified = surfaceBackgroundsBase * Main.bgAlphaFarBackLayer[10]; this.DrawSurfaceBG_DrawBackMountainsLayer(Main.treeMntBGSet2[0]); } if ((double) Main.bgAlphaFarBackLayer[11] > 0.0) { Main.ColorOfSurfaceBackgroundsModified = surfaceBackgroundsBase * Main.bgAlphaFarBackLayer[11]; this.DrawSurfaceBG_DrawBackMountainsLayer(Main.treeMntBGSet3[0]); } if ((double) Main.bgAlphaFarBackLayer[12] > 0.0) { Main.ColorOfSurfaceBackgroundsModified = surfaceBackgroundsBase * Main.bgAlphaFarBackLayer[12]; this.DrawSurfaceBG_DrawBackMountainsLayer(Main.treeMntBGSet4[0]); } if ((double) Main.bgAlphaFarBackLayer[1] > 0.0) { Main.ColorOfSurfaceBackgroundsModified = surfaceBackgroundsBase * Main.bgAlphaFarBackLayer[1]; if (WorldGen.desertBG != 4) this.DrawSurfaceBG_DrawBackMountainsLayer(23); } if ((double) Main.bgAlphaFarBackLayer[2] > 0.0) { Main.ColorOfSurfaceBackgroundsModified = surfaceBackgroundsBase * Main.bgAlphaFarBackLayer[2]; this.DrawSurfaceBG_DrawBackMountainsLayer(24); } if ((double) Main.bgAlphaFarBackLayer[4] > 0.0) { Main.ColorOfSurfaceBackgroundsModified = surfaceBackgroundsBase * Main.bgAlphaFarBackLayer[4]; this.DrawSurfaceBG_DrawBackMountainsLayer(Main.snowMntBG[0]); } if ((double) Main.bgAlphaFarBackLayer[5] > 0.0) { Main.ColorOfSurfaceBackgroundsModified = surfaceBackgroundsBase * Main.bgAlphaFarBackLayer[5]; if (WorldGen.crimsonBG != 5) this.DrawSurfaceBG_DrawBackMountainsLayer(24); } if ((double) Main.bgAlphaFarBackLayer[6] > 0.0 && WorldGen.hallowBG == 3) { Main.ColorOfSurfaceBackgroundsModified = surfaceBackgroundsBase * Main.bgAlphaFarBackLayer[6]; this.DrawSurfaceBG_DrawBackMountainsLayer(246); } SkyManager.Instance.DrawToDepth(Main.spriteBatch, 5f); } private void DrawSurfaceBG_BackMountainsStep2(int pushBGTopHack) { if (Main.gameMenu) { this.bgTopY = 230 + pushBGTopHack; this.bgStartX -= 500; } Microsoft.Xna.Framework.Color surfaceBackgroundsBase = Main.ColorOfSurfaceBackgroundsBase; this.UpdateOceanWaterLineForAmbience(); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); if ((double) Main.screenPosition.Y >= Main.worldSurface * 16.0 + 16.0) return; if ((double) Main.bgAlphaFarBackLayer[0] > 0.0) { Main.ColorOfSurfaceBackgroundsModified = surfaceBackgroundsBase * Main.bgAlphaFarBackLayer[0]; if (Main.treeMntBGSet1[1] > -1) this.DrawSurfaceBG_DrawBackMountainsLayer(Main.treeMntBGSet1[1]); } if ((double) Main.bgAlphaFarBackLayer[1] > 0.0) { Main.ColorOfSurfaceBackgroundsModified = surfaceBackgroundsBase * Main.bgAlphaFarBackLayer[1]; if (WorldGen.desertBG != 4) this.DrawSurfaceBG_DrawBackMountainsLayer(22); } if ((double) Main.bgAlphaFarBackLayer[2] > 0.0) { Main.ColorOfSurfaceBackgroundsModified = surfaceBackgroundsBase * Main.bgAlphaFarBackLayer[2]; this.DrawSurfaceBG_DrawBackMountainsLayer(25); } if ((double) Main.bgAlphaFarBackLayer[3] > 0.0) { Main.ColorOfSurfaceBackgroundsModified = surfaceBackgroundsBase * Main.bgAlphaFarBackLayer[3]; this.DrawSurfaceBG_DrawBackMountainsLayer(Main.oceanBG); } if ((double) Main.bgAlphaFarBackLayer[4] > 0.0) { Main.ColorOfSurfaceBackgroundsModified = surfaceBackgroundsBase * Main.bgAlphaFarBackLayer[4]; this.DrawSurfaceBG_DrawBackMountainsLayer(Main.snowMntBG[1]); } if ((double) Main.bgAlphaFarBackLayer[5] > 0.0) { Main.ColorOfSurfaceBackgroundsModified = surfaceBackgroundsBase * Main.bgAlphaFarBackLayer[5]; if (WorldGen.crimsonBG != 5) this.DrawSurfaceBG_DrawBackMountainsLayer(42); } if ((double) Main.bgAlphaFarBackLayer[6] > 0.0 && WorldGen.hallowBG == 3) { Main.ColorOfSurfaceBackgroundsModified = surfaceBackgroundsBase * Main.bgAlphaFarBackLayer[6]; this.DrawSurfaceBG_DrawBackMountainsLayer(247); } if ((double) Main.bgAlphaFarBackLayer[10] > 0.0) { Main.ColorOfSurfaceBackgroundsModified = surfaceBackgroundsBase * Main.bgAlphaFarBackLayer[10]; if (Main.treeMntBGSet2[1] > -1) this.DrawSurfaceBG_DrawBackMountainsLayer(Main.treeMntBGSet2[1]); } if ((double) Main.bgAlphaFarBackLayer[11] > 0.0) { Main.ColorOfSurfaceBackgroundsModified = surfaceBackgroundsBase * Main.bgAlphaFarBackLayer[11]; if (Main.treeMntBGSet3[1] > -1) this.DrawSurfaceBG_DrawBackMountainsLayer(Main.treeMntBGSet3[1]); } if ((double) Main.bgAlphaFarBackLayer[12] <= 0.0) return; Main.ColorOfSurfaceBackgroundsModified = surfaceBackgroundsBase * Main.bgAlphaFarBackLayer[12]; if (Main.treeMntBGSet4[1] <= -1) return; this.DrawSurfaceBG_DrawBackMountainsLayer(Main.treeMntBGSet4[1]); } private void UpdateOceanWaterLineForAmbience() { int layerYoffset = this.DrawSurfaceBG_GetLayerYOffset(Main.oceanBG); int num = 0; switch (Main.oceanBG) { case 28: case 110: case 111: case 209: case 210: num = 102; break; case 283: num = 124; break; } float yScreenPosition = (float) (this.bgTopY + layerYoffset) + (float) num * Main.bgScale; AmbientSkyDrawCache.Instance.SetOceanLineInfo(yScreenPosition, Main.bgAlphaFarBackLayer[3]); } private void DrawSurfaceBG_Mushroom( double backgroundTopMagicNumber, float bgGlobalScaleMultiplier, int pushBGTopHack, int[] bgTexIndexes) { Vector3 vector3_1 = new Vector3(0.1f, 0.15f, 0.3f); Vector3 vector3_2 = new Vector3(0.1f, 0.175f, 0.3f); Vector3 vector3_3 = new Vector3(0.125f, 0.2f, 0.3f); float num1 = 0.5f; float num2 = 0.625f; float num3 = 0.75f; Vector3 vector3_4 = vector3_1 * 3f; Vector3 vector3_5 = vector3_2 * 3f; Vector3 vector3_6 = vector3_3 * 3f; float num4 = (float) Main.ColorOfSurfaceBackgroundsModified.A / (float) byte.MaxValue; Microsoft.Xna.Framework.Color backgroundsModified = Main.ColorOfSurfaceBackgroundsModified; float num5 = (float) Main.rand.Next(28, 42) * (1f / 1000f) + (float) (270 - (int) Main.mouseTextColor) / 5000f; float x1 = vector3_4.X; float num6 = vector3_4.Y + num5 / 2f; float num7 = vector3_4.Z + num5; float num8 = x1 * (float) byte.MaxValue; float num9 = num6 * (float) byte.MaxValue; float num10 = num7 * (float) byte.MaxValue; float num11 = num8 * (num1 * num4); float num12 = num9 * (num1 * num4); float num13 = num10 * (num1 * num4); if ((double) num11 > (double) byte.MaxValue) num11 = (float) byte.MaxValue; if ((double) num12 > (double) byte.MaxValue) num12 = (float) byte.MaxValue; if ((double) num13 > (double) byte.MaxValue) num13 = (float) byte.MaxValue; if ((double) num11 > (double) backgroundsModified.R) backgroundsModified.R = (byte) num11; if ((double) num12 > (double) backgroundsModified.G) backgroundsModified.G = (byte) num12; if ((double) num13 > (double) backgroundsModified.B) backgroundsModified.B = (byte) num13; Main.bgScale = 1.25f; Main.bgScale *= bgGlobalScaleMultiplier; this.LoadBackground(bgTexIndexes[0]); Main.bgWidthScaled = (int) ((double) Main.backgroundWidth[bgTexIndexes[0]] * (double) Main.bgScale); this.bgParallax = 0.4; this.SetBackgroundOffsets(bgTexIndexes[0], backgroundTopMagicNumber, pushBGTopHack); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); this.bgTopY = (int) (backgroundTopMagicNumber * 1800.0 + 1400.0) + (int) this.scAdj + pushBGTopHack; this.SetBackgroundOffsets(bgTexIndexes[0], backgroundTopMagicNumber, pushBGTopHack); if (Main.gameMenu) this.bgTopY = 320 + pushBGTopHack; if (Main.bgWidthScaled != 0) this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if (TextureAssets.Background[bgTexIndexes[0]].Value == null) return; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(TextureAssets.Background[bgTexIndexes[0]].Value, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index), (float) this.bgTopY), this.GetBackgroundRect(bgTexIndexes[0]), backgroundsModified, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } backgroundsModified = Main.ColorOfSurfaceBackgroundsModified; float num14 = (float) Main.rand.Next(28, 42) * (1f / 1000f) + (float) (270 - (int) Main.mouseTextColor) / 5000f; float x2 = vector3_5.X; float num15 = vector3_5.Y + num14 / 2f; float num16 = vector3_5.Z + num14; float num17 = x2 * (float) byte.MaxValue; float num18 = num15 * (float) byte.MaxValue; float num19 = num16 * (float) byte.MaxValue; float num20 = num17 * (num2 * num4); float num21 = num18 * (num2 * num4); float num22 = num19 * (num2 * num4); if ((double) num20 > (double) byte.MaxValue) num20 = (float) byte.MaxValue; if ((double) num21 > (double) byte.MaxValue) num21 = (float) byte.MaxValue; if ((double) num22 > (double) byte.MaxValue) num22 = (float) byte.MaxValue; if ((double) num20 > (double) backgroundsModified.R) backgroundsModified.R = (byte) num20; if ((double) num21 > (double) backgroundsModified.G) backgroundsModified.G = (byte) num21; if ((double) num22 > (double) backgroundsModified.B) backgroundsModified.B = (byte) num22; Main.bgScale = 1.32f; Main.bgScale *= bgGlobalScaleMultiplier; this.LoadBackground(bgTexIndexes[1]); Main.bgWidthScaled = (int) ((double) Main.backgroundWidth[bgTexIndexes[1]] * (double) Main.bgScale); this.bgParallax = 0.43; this.SetBackgroundOffsets(bgTexIndexes[1], backgroundTopMagicNumber, pushBGTopHack); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); this.bgTopY = (int) (backgroundTopMagicNumber * 1950.0 + 1675.0) + (int) this.scAdj + pushBGTopHack; this.SetBackgroundOffsets(bgTexIndexes[1], backgroundTopMagicNumber, pushBGTopHack); if (Main.gameMenu) { this.bgTopY = 400 + pushBGTopHack; this.bgStartX -= 80; } if (Main.bgWidthScaled == 0) return; this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(TextureAssets.Background[bgTexIndexes[1]].Value, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index), (float) this.bgTopY), this.GetBackgroundRect(bgTexIndexes[1]), backgroundsModified, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } backgroundsModified = Main.ColorOfSurfaceBackgroundsModified; float num23 = (float) Main.rand.Next(28, 42) * (1f / 1000f) + (float) (270 - (int) Main.mouseTextColor) / 3000f; float x3 = vector3_6.X; float num24 = vector3_6.Y + num23 / 2f; float num25 = vector3_6.Z + num23; float num26 = x3 * ((float) byte.MaxValue * num4 * num3); float num27 = num24 * ((float) byte.MaxValue * num4 * num3); float num28 = num25 * ((float) byte.MaxValue * num4 * num3); if ((double) num26 > (double) byte.MaxValue) num26 = (float) byte.MaxValue; if ((double) num27 > (double) byte.MaxValue) num27 = (float) byte.MaxValue; if ((double) num28 > (double) byte.MaxValue) num28 = (float) byte.MaxValue; if ((double) num26 > (double) backgroundsModified.R) backgroundsModified.R = (byte) num26; if ((double) num27 > (double) backgroundsModified.G) backgroundsModified.G = (byte) num27; if ((double) num28 > (double) backgroundsModified.B) backgroundsModified.B = (byte) num28; Main.bgScale = 1.36f; Main.bgScale *= bgGlobalScaleMultiplier; this.LoadBackground(bgTexIndexes[2]); Main.bgWidthScaled = (int) ((double) Main.backgroundWidth[bgTexIndexes[2]] * (double) Main.bgScale); this.bgParallax = 0.49; this.SetBackgroundOffsets(bgTexIndexes[2], backgroundTopMagicNumber, pushBGTopHack); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); this.bgTopY = (int) (backgroundTopMagicNumber * 2100.0 + 1950.0) + (int) this.scAdj + pushBGTopHack; this.SetBackgroundOffsets(bgTexIndexes[2], backgroundTopMagicNumber, pushBGTopHack); if (Main.gameMenu) { this.bgTopY = 480 + pushBGTopHack; this.bgStartX -= 120; } if (Main.bgWidthScaled == 0) return; this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(TextureAssets.Background[bgTexIndexes[2]].Value, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index), (float) this.bgTopY), this.GetBackgroundRect(bgTexIndexes[2]), backgroundsModified, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f); } private void DrawSurfaceBG_Crimson( double backgroundTopMagicNumber, float bgGlobalScaleMultiplier, int pushBGTopHack, int[] bgTexIndexes) { if (bgTexIndexes[0] > -1) { Main.bgScale = 1.25f; this.bgParallax = 0.4; this.bgTopY = (int) (backgroundTopMagicNumber * 1800.0 + 1500.0) + (int) this.scAdj + pushBGTopHack; this.SetBackgroundOffsets(bgTexIndexes[0], backgroundTopMagicNumber, pushBGTopHack); Main.bgScale *= bgGlobalScaleMultiplier; this.LoadBackground(bgTexIndexes[0]); Main.bgWidthScaled = (int) ((double) Main.backgroundWidth[bgTexIndexes[0]] * (double) Main.bgScale); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); if (bgTexIndexes[0] == 105) this.bgTopY += 50; if (bgTexIndexes[0] == 174) this.bgTopY -= 350; if (Main.gameMenu) this.bgTopY = 320 + pushBGTopHack; this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(TextureAssets.Background[bgTexIndexes[0]].Value, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index), (float) this.bgTopY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[bgTexIndexes[0]], Main.backgroundHeight[bgTexIndexes[0]])), Main.ColorOfSurfaceBackgroundsModified, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } } if (bgTexIndexes[1] > -1) { Main.bgScale = 1.31f; this.bgParallax = 0.43; this.bgTopY = (int) (backgroundTopMagicNumber * 1950.0 + 1750.0) + (int) this.scAdj + pushBGTopHack; this.SetBackgroundOffsets(bgTexIndexes[1], backgroundTopMagicNumber, pushBGTopHack); Main.bgScale *= bgGlobalScaleMultiplier; this.LoadBackground(bgTexIndexes[1]); Main.bgWidthScaled = (int) ((double) Main.backgroundWidth[bgTexIndexes[1]] * (double) Main.bgScale); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); if (Main.gameMenu) { this.bgTopY = 400 + pushBGTopHack; this.bgStartX -= 80; } this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(TextureAssets.Background[bgTexIndexes[1]].Value, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index), (float) this.bgTopY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[bgTexIndexes[1]], Main.backgroundHeight[bgTexIndexes[1]])), Main.ColorOfSurfaceBackgroundsModified, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } } Main.bgScale = 1.34f; this.bgParallax = 0.49; this.bgTopY = (int) (backgroundTopMagicNumber * 2100.0 + 2000.0) + (int) this.scAdj + pushBGTopHack; this.SetBackgroundOffsets(bgTexIndexes[2], backgroundTopMagicNumber, pushBGTopHack); Main.bgScale *= bgGlobalScaleMultiplier; this.LoadBackground(bgTexIndexes[2]); Main.bgWidthScaled = (int) ((double) Main.backgroundWidth[bgTexIndexes[2]] * (double) Main.bgScale); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); if (Main.gameMenu) { this.bgTopY = 480 + pushBGTopHack; this.bgStartX -= 120; } if (bgTexIndexes[2] == 175) { this.bgStartX -= 1000; this.bgTopY -= 400; } this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if ((double) Main.screenPosition.Y >= Main.worldSurface * 16.0 + 16.0) return; for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(TextureAssets.Background[bgTexIndexes[2]].Value, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index), (float) this.bgTopY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[bgTexIndexes[2]], Main.backgroundHeight[bgTexIndexes[2]])), Main.ColorOfSurfaceBackgroundsModified, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } private void DrawSurfaceBG_Snow( double backgroundTopMagicNumber, float bgGlobalScaleMultiplier, int pushBGTopHack, int[] bgTexIndexes) { if (bgTexIndexes[0] >= 0) { Main.bgScale = 1.25f; this.bgParallax = 0.4; this.bgTopY = (int) (backgroundTopMagicNumber * 1800.0 + 1500.0) + (int) this.scAdj + pushBGTopHack; this.SetBackgroundOffsets(bgTexIndexes[0], backgroundTopMagicNumber, pushBGTopHack); Main.bgScale *= bgGlobalScaleMultiplier; this.LoadBackground(bgTexIndexes[0]); Main.bgWidthScaled = (int) ((double) Main.backgroundWidth[bgTexIndexes[0]] * (double) Main.bgScale); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); if (Main.gameMenu) this.bgTopY = 320 + pushBGTopHack; this.bgTopY += this.DrawSurfaceBG_GetLayerYOffset(bgTexIndexes[0]); this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(TextureAssets.Background[bgTexIndexes[0]].Value, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index), (float) this.bgTopY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[bgTexIndexes[0]], Main.backgroundHeight[bgTexIndexes[0]])), Main.ColorOfSurfaceBackgroundsModified, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } } if (bgTexIndexes[1] >= 0) { Main.bgScale = 1.31f; this.bgParallax = 0.43; this.bgTopY = (int) (backgroundTopMagicNumber * 1950.0 + 1750.0) + (int) this.scAdj + pushBGTopHack; this.SetBackgroundOffsets(bgTexIndexes[1], backgroundTopMagicNumber, pushBGTopHack); Main.bgScale *= bgGlobalScaleMultiplier; this.LoadBackground(bgTexIndexes[1]); Main.bgWidthScaled = (int) ((double) Main.backgroundWidth[bgTexIndexes[1]] * (double) Main.bgScale); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); if (Main.gameMenu) { this.bgTopY = 400 + pushBGTopHack; this.bgStartX -= 80; } this.bgTopY += this.DrawSurfaceBG_GetLayerYOffset(bgTexIndexes[1]); this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(TextureAssets.Background[bgTexIndexes[1]].Value, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index), (float) this.bgTopY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[bgTexIndexes[1]], Main.backgroundHeight[bgTexIndexes[1]])), Main.ColorOfSurfaceBackgroundsModified, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } } if (bgTexIndexes[2] < 0) return; Main.bgScale = 1.34f; this.bgParallax = 0.49; this.bgTopY = (int) (backgroundTopMagicNumber * 2100.0 + 2000.0) + (int) this.scAdj + pushBGTopHack; this.SetBackgroundOffsets(bgTexIndexes[2], backgroundTopMagicNumber, pushBGTopHack); Main.bgScale *= bgGlobalScaleMultiplier; this.LoadBackground(bgTexIndexes[2]); Main.bgWidthScaled = (int) ((double) Main.backgroundWidth[bgTexIndexes[2]] * (double) Main.bgScale); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); if (Main.gameMenu) { this.bgTopY = 480 + pushBGTopHack; this.bgStartX -= 120; } this.bgTopY += this.DrawSurfaceBG_GetLayerYOffset(bgTexIndexes[2]); this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if ((double) Main.screenPosition.Y >= Main.worldSurface * 16.0 + 16.0) return; for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(TextureAssets.Background[bgTexIndexes[2]].Value, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index), (float) this.bgTopY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[bgTexIndexes[2]], Main.backgroundHeight[bgTexIndexes[2]])), Main.ColorOfSurfaceBackgroundsModified, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } private void SetBackgroundOffsets( int backgroundID, double backgroundTopMagicNumber, int pushBGTopHack) { int num1 = 0; int num2 = 0; switch (backgroundID) { case 18: if (WorldGen.hallowBG == 3) { this.bgParallax = 0.17; Main.bgScale = 1.1f; num1 = 1400; num2 = 1100; break; } break; case 207: this.bgParallax = 0.32; break; case 219: this.bgParallax = 0.25; break; case 220: this.bgParallax = 0.34; break; case 221: this.bgParallax = 0.43; break; case 222: num1 = 1800; num2 = 1400; break; case 223: num1 = 2150; num2 = 1850; break; case 224: num1 = 2500; num2 = 2400; break; case 234: this.bgParallax = 0.23; num1 = 1700; num2 = 1150; break; case 235: this.bgParallax = 0.33; num1 = 1950; num2 = 1550; break; case 236: this.bgParallax = 0.41; num1 = 2100; num2 = 2000; break; case 237: num1 = 1800; num2 = 1500; break; case 238: num1 = 1950; num2 = 1500; break; case 239: num1 = 2100; num2 = 1900; break; case 240: Main.bgScale = 1.15f; this.bgParallax = 0.3; num1 = 1800; num2 = 1500; break; case 241: Main.bgScale = 1.21f; this.bgParallax = 0.43; num1 = 1950; num2 = 1300; break; case 242: Main.bgScale = 1.34f; this.bgParallax = 0.49; num1 = 2100; num2 = 1400; break; case 243: Main.bgScale = 1.15f; this.bgParallax = 0.25; num1 = 1800; num2 = 1400; break; case 244: Main.bgScale = 1.21f; this.bgParallax = 0.35; num1 = 1950; num2 = 1550; break; case 245: Main.bgScale = 1.24f; this.bgParallax = 0.45; num1 = 2100; num2 = 1650; break; case 248: Main.bgScale = 1.3f; this.bgParallax = 0.37; num1 = 1800; num2 = 1100; break; case 249: Main.bgScale = 1.4f; this.bgParallax = 0.43; num1 = 1950; num2 = 1200; break; case 250: Main.bgScale = 1.7f; this.bgParallax = 0.49; num1 = 2000; num2 = 1000; break; case (int) byte.MaxValue: Main.bgScale = 1.15f; this.bgParallax = 0.25; num1 = 1800; num2 = 1450; break; case 256: Main.bgScale = 1.21f; this.bgParallax = 0.32; num1 = 1950; num2 = 1550; break; case 257: Main.bgScale = 1.34f; this.bgParallax = 0.4; num1 = 2100; num2 = 1550; break; case 258: Main.bgScale = 1.25f; this.bgParallax = 0.23; num1 = 1800; num2 = 850; break; case 259: Main.bgScale = 1.31f; this.bgParallax = 0.33; num1 = 1950; num2 = 1500; break; case 260: Main.bgScale = 1.34f; this.bgParallax = 0.4; num1 = 2100; num2 = 1650; break; case 261: this.bgParallax = 0.27; break; case 262: this.bgParallax = 0.4; break; case 263: Main.bgScale = 1.25f; this.bgParallax = 0.23; num1 = 1800; num2 = 1450; break; case 264: Main.bgScale = 1.31f; this.bgParallax = 0.33; num1 = 1950; num2 = 1700; break; case 265: Main.bgScale = 1.34f; this.bgParallax = 0.4; num1 = 2100; num2 = 2000; break; case 266: Main.bgScale = 1.31f; this.bgParallax = 0.33; num1 = 1950; num2 = 1600; break; case 267: Main.bgScale = 1.25f; this.bgParallax = 0.23; num1 = 1700; num2 = 1300; break; case 268: Main.bgScale = 1.34f; this.bgParallax = 0.41; num1 = 2100; num2 = 1850; break; case 273: this.bgParallax = 0.490000009536743; num1 = 2100; num2 = 1560; break; case 279: Main.bgScale = 2.5f; this.bgParallax = 0.349999994039536; num1 = 1850; num2 = 1750; break; case 282: Main.bgScale = 2.6f; this.bgParallax = 0.25; num1 = 1800; num2 = 1340; break; case 284: this.bgParallax = 0.23; num1 = 1600; num2 = 900; break; case 285: this.bgParallax = 0.36; num1 = 1900; num2 = 960; break; case 286: this.bgParallax = 0.42; num1 = 2100; num2 = 1200; break; case 287: this.bgParallax = 0.21; num1 = 1700; num2 = 1560; break; case 288: this.bgParallax = 0.33; num1 = 1950; num2 = 1730; break; case 289: this.bgParallax = 0.41; num1 = 2100; num2 = 1400; break; } if (num1 == 0 && num2 == 0) return; this.bgTopY = (int) (backgroundTopMagicNumber * (double) num1 + (double) num2) + (int) this.scAdj + pushBGTopHack; } private void DrawSurfaceBG_Hallow( double backgroundTopMagicNumber, float bgGlobalScaleMultiplier, int pushBGTopHack, int[] bgTexIndexes) { if (bgTexIndexes[0] > 0) { Main.bgScale = 1.25f; this.bgParallax = 0.4; this.bgTopY = (int) (backgroundTopMagicNumber * 1800.0 + 1500.0) + (int) this.scAdj + pushBGTopHack; this.SetBackgroundOffsets(bgTexIndexes[0], backgroundTopMagicNumber, pushBGTopHack); Main.bgScale *= bgGlobalScaleMultiplier; this.LoadBackground(bgTexIndexes[0]); Main.bgWidthScaled = (int) ((double) Main.backgroundWidth[bgTexIndexes[0]] * (double) Main.bgScale); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1.2f / (float) this.bgParallax); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); if (Main.gameMenu) this.bgTopY = 320 + pushBGTopHack; this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(TextureAssets.Background[bgTexIndexes[0]].Value, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index), (float) this.bgTopY), this.GetBackgroundRect(bgTexIndexes[0]), Main.ColorOfSurfaceBackgroundsModified, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } } if (bgTexIndexes[1] > 0) { Main.bgScale = 1.31f; this.bgParallax = 0.43; this.bgTopY = (int) (backgroundTopMagicNumber * 1950.0 + 1750.0) + (int) this.scAdj + pushBGTopHack; this.SetBackgroundOffsets(bgTexIndexes[1], backgroundTopMagicNumber, pushBGTopHack); Main.bgScale *= bgGlobalScaleMultiplier; this.LoadBackground(bgTexIndexes[1]); Main.bgWidthScaled = (int) ((double) Main.backgroundWidth[bgTexIndexes[1]] * (double) Main.bgScale); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); if (Main.gameMenu) { this.bgTopY = 400 + pushBGTopHack; this.bgStartX -= 80; } this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(TextureAssets.Background[bgTexIndexes[1]].Value, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index), (float) this.bgTopY), this.GetBackgroundRect(bgTexIndexes[1]), Main.ColorOfSurfaceBackgroundsModified, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } } if (bgTexIndexes[2] <= 0) return; Main.bgScale = 1.34f; this.bgParallax = 0.49; this.bgTopY = (int) (backgroundTopMagicNumber * 2100.0 + 2000.0) + (int) this.scAdj + pushBGTopHack; this.SetBackgroundOffsets(bgTexIndexes[2], backgroundTopMagicNumber, pushBGTopHack); Main.bgScale *= bgGlobalScaleMultiplier; this.LoadBackground(bgTexIndexes[2]); Main.bgWidthScaled = (int) ((double) Main.backgroundWidth[bgTexIndexes[2]] * (double) Main.bgScale); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); if (Main.gameMenu) { this.bgTopY = 480 + pushBGTopHack; this.bgStartX -= 120; } this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if ((double) Main.screenPosition.Y >= Main.worldSurface * 16.0 + 16.0) return; for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(TextureAssets.Background[bgTexIndexes[2]].Value, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index), (float) this.bgTopY), this.GetBackgroundRect(bgTexIndexes[2]), Main.ColorOfSurfaceBackgroundsModified, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } private void DrawSurfaceBG_GoodEvilDesert( double backgroundTopMagicNumber, float bgGlobalScaleMultiplier, int pushBGTopHack) { this.LoadBackground(26); Main.bgScale = 1.25f; Main.bgScale *= bgGlobalScaleMultiplier; Main.bgWidthScaled = (int) ((double) Main.backgroundWidth[26] * (double) Main.bgScale); this.bgParallax = 0.37; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); this.bgTopY = (int) (backgroundTopMagicNumber * 1800.0 + 1750.0) + (int) this.scAdj + pushBGTopHack; if (Main.gameMenu) this.bgTopY = 320 + pushBGTopHack; this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(TextureAssets.Background[26].Value, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index), (float) this.bgTopY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[26], Main.backgroundHeight[26])), Main.ColorOfSurfaceBackgroundsModified, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } Main.bgScale = 1.34f; Main.bgScale *= bgGlobalScaleMultiplier; this.LoadBackground(27); Main.bgWidthScaled = (int) ((double) Main.backgroundWidth[27] * (double) Main.bgScale); this.bgParallax = 0.49; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); this.bgTopY = (int) (backgroundTopMagicNumber * 2100.0 + 2150.0) + (int) this.scAdj + pushBGTopHack; if (Main.gameMenu) { this.bgTopY = 480 + pushBGTopHack; this.bgStartX -= 120; } this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if ((double) Main.screenPosition.Y >= Main.worldSurface * 16.0 + 16.0) return; for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(TextureAssets.Background[27].Value, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index), (float) this.bgTopY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[27], Main.backgroundHeight[27])), Main.ColorOfSurfaceBackgroundsModified, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } private void DrawSurfaceBG_Jungle( double backgroundTopMagicNumber, float bgGlobalScaleMultiplier, int pushBGTopHack, int[] bgTexIndexes) { this.LoadBackground(bgTexIndexes[0]); Main.bgScale = 1.25f; Main.bgScale *= bgGlobalScaleMultiplier; Main.bgWidthScaled = (int) ((double) Main.backgroundWidth[bgTexIndexes[0]] * (double) Main.bgScale); this.bgParallax = 0.4; this.SetBackgroundOffsets(bgTexIndexes[0], backgroundTopMagicNumber, pushBGTopHack); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); this.bgTopY = (int) (backgroundTopMagicNumber * 1800.0 + 1660.0) + (int) this.scAdj + pushBGTopHack; this.SetBackgroundOffsets(bgTexIndexes[0], backgroundTopMagicNumber, pushBGTopHack); if (Main.gameMenu) this.bgTopY = 320 + pushBGTopHack; if (bgTexIndexes[0] == 59) this.bgTopY -= 200; this.bgTopY += this.DrawSurfaceBG_GetLayerYOffset(bgTexIndexes[0]); this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(TextureAssets.Background[bgTexIndexes[0]].Value, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index), (float) this.bgTopY), this.GetBackgroundRect(bgTexIndexes[0]), Main.ColorOfSurfaceBackgroundsModified, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } this.LoadBackground(bgTexIndexes[1]); Main.bgScale = 1.31f; Main.bgScale *= bgGlobalScaleMultiplier; Main.bgWidthScaled = (int) ((double) Main.backgroundWidth[bgTexIndexes[1]] * (double) Main.bgScale); this.bgParallax = 0.43; this.SetBackgroundOffsets(bgTexIndexes[1], backgroundTopMagicNumber, pushBGTopHack); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); this.bgTopY = (int) (backgroundTopMagicNumber * 1950.0 + 1840.0) + (int) this.scAdj + pushBGTopHack; this.SetBackgroundOffsets(bgTexIndexes[1], backgroundTopMagicNumber, pushBGTopHack); if (Main.gameMenu) { this.bgTopY = 400 + pushBGTopHack; this.bgStartX -= 80; } if (bgTexIndexes[1] == 60) this.bgTopY -= 175; this.bgTopY += this.DrawSurfaceBG_GetLayerYOffset(bgTexIndexes[1]); this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(TextureAssets.Background[bgTexIndexes[1]].Value, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index), (float) this.bgTopY), this.GetBackgroundRect(bgTexIndexes[1]), Main.ColorOfSurfaceBackgroundsModified, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.FlipHorizontally, 0.0f); } Main.bgScale = 1.34f; Main.bgScale *= bgGlobalScaleMultiplier; this.LoadBackground(bgTexIndexes[2]); Main.bgWidthScaled = (int) ((double) Main.backgroundWidth[bgTexIndexes[2]] * (double) Main.bgScale); this.bgParallax = 0.49; this.SetBackgroundOffsets(bgTexIndexes[2], backgroundTopMagicNumber, pushBGTopHack); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); this.bgTopY = (int) (backgroundTopMagicNumber * 2100.0 + 2060.0) + (int) this.scAdj + pushBGTopHack; this.SetBackgroundOffsets(bgTexIndexes[2], backgroundTopMagicNumber, pushBGTopHack); if (Main.gameMenu) { this.bgTopY = 480 + pushBGTopHack; this.bgStartX -= 120; } if (bgTexIndexes[2] == 61) this.bgTopY -= 150; this.bgTopY += this.DrawSurfaceBG_GetLayerYOffset(bgTexIndexes[2]); this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if ((double) Main.screenPosition.Y >= Main.worldSurface * 16.0 + 16.0) return; for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(TextureAssets.Background[bgTexIndexes[2]].Value, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index), (float) this.bgTopY), this.GetBackgroundRect(bgTexIndexes[2]), Main.ColorOfSurfaceBackgroundsModified, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } private void DrawSurfaceBG_Desert( double backgroundTopMagicNumber, float bgGlobalScaleMultiplier, int pushBGTopHack, int[] bgTexIndexes) { if (bgTexIndexes[0] > 0) { Main.bgScale = 1.25f; this.bgParallax = 0.37; this.bgTopY = (int) (backgroundTopMagicNumber * 1800.0 + 1750.0) + (int) this.scAdj + pushBGTopHack; this.SetBackgroundOffsets(bgTexIndexes[0], backgroundTopMagicNumber, pushBGTopHack); this.LoadBackground(bgTexIndexes[0]); Main.bgScale *= bgGlobalScaleMultiplier; float num = (float) Main.backgroundWidth[bgTexIndexes[0]] * Main.bgScale; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) num) - (double) num / 2.0); if (Main.gameMenu) this.bgTopY = 320 + pushBGTopHack; this.bgLoops = Main.screenWidth / (int) num + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(TextureAssets.Background[bgTexIndexes[0]].Value, new Vector2((float) this.bgStartX + num * (float) index, (float) this.bgTopY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[bgTexIndexes[0]], Main.backgroundHeight[bgTexIndexes[0]])), Main.ColorOfSurfaceBackgroundsModified, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } } if (bgTexIndexes[1] > 0) { Main.bgScale = 1.34f; this.bgParallax = 0.49; this.bgTopY = (int) (backgroundTopMagicNumber * 2100.0 + 2150.0) + (int) this.scAdj + pushBGTopHack; this.SetBackgroundOffsets(bgTexIndexes[1], backgroundTopMagicNumber, pushBGTopHack); Main.bgScale *= bgGlobalScaleMultiplier; this.LoadBackground(bgTexIndexes[1]); Main.bgWidthScaled = (int) ((double) Main.backgroundWidth[bgTexIndexes[1]] * (double) Main.bgScale); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); if (Main.gameMenu) { this.bgTopY = 480 + pushBGTopHack; this.bgStartX -= 120; } this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(TextureAssets.Background[bgTexIndexes[1]].Value, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index), (float) this.bgTopY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[bgTexIndexes[1]], Main.backgroundHeight[bgTexIndexes[1]])), Main.ColorOfSurfaceBackgroundsModified, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } } if (bgTexIndexes[2] <= 0) return; Main.bgScale = 1.34f; this.bgParallax = 0.49; this.bgTopY = (int) (backgroundTopMagicNumber * 2100.0 + 2150.0) + (int) this.scAdj + pushBGTopHack; this.SetBackgroundOffsets(bgTexIndexes[2], backgroundTopMagicNumber, pushBGTopHack); Main.bgScale *= bgGlobalScaleMultiplier; this.LoadBackground(bgTexIndexes[2]); Main.bgWidthScaled = (int) ((double) Main.backgroundWidth[bgTexIndexes[2]] * (double) Main.bgScale); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); if (Main.gameMenu) { this.bgTopY = 480 + pushBGTopHack; this.bgStartX -= 120; } this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if ((double) Main.screenPosition.Y >= Main.worldSurface * 16.0 + 16.0) return; for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(TextureAssets.Background[bgTexIndexes[2]].Value, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index), (float) this.bgTopY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[bgTexIndexes[2]], Main.backgroundHeight[bgTexIndexes[2]])), Main.ColorOfSurfaceBackgroundsModified, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } private void DrawSurfaceBG_DrawChangeOverlay(int backgroundAreaId) { Texture2D texture = TextureAssets.MagicPixel.Value; Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.Black * WorldGen.BackgroundsCache.GetFlashPower(backgroundAreaId); Main.spriteBatch.Draw(texture, new Microsoft.Xna.Framework.Rectangle(0, 0, Main.screenWidth, Main.screenHeight), color); } private void DrawSurfaceBG_Corrupt( double backgroundTopMagicNumber, float bgGlobalScaleMultiplier, int pushBGTopHack, int[] bgTexIndexes) { Main.bgScale = 1.25f; this.bgParallax = 0.4; this.bgTopY = (int) (backgroundTopMagicNumber * 1800.0 + 1500.0) + (int) this.scAdj + pushBGTopHack; this.SetBackgroundOffsets(bgTexIndexes[0], backgroundTopMagicNumber, pushBGTopHack); Main.bgScale *= bgGlobalScaleMultiplier; this.LoadBackground(bgTexIndexes[0]); if (Main.backgroundWidth[bgTexIndexes[0]] == 0 || Main.backgroundHeight[bgTexIndexes[0]] == 0) return; Main.bgWidthScaled = (int) ((double) Main.backgroundWidth[bgTexIndexes[0]] * (double) Main.bgScale); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); if (Main.gameMenu) this.bgTopY = 320 + pushBGTopHack; if (bgTexIndexes[0] == 56) this.bgTopY -= 100; this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(TextureAssets.Background[bgTexIndexes[0]].Value, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index), (float) this.bgTopY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[bgTexIndexes[0]], Main.backgroundHeight[bgTexIndexes[0]])), Main.ColorOfSurfaceBackgroundsModified, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } Main.bgScale = 1.31f; this.bgParallax = 0.43; this.bgTopY = (int) (backgroundTopMagicNumber * 1950.0 + 1750.0) + (int) this.scAdj + pushBGTopHack; this.SetBackgroundOffsets(bgTexIndexes[1], backgroundTopMagicNumber, pushBGTopHack); Main.bgScale *= bgGlobalScaleMultiplier; this.LoadBackground(bgTexIndexes[1]); Main.bgWidthScaled = (int) ((double) Main.backgroundWidth[bgTexIndexes[1]] * (double) Main.bgScale); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); if (Main.gameMenu) { this.bgTopY = 400 + pushBGTopHack; this.bgStartX -= 80; } if (bgTexIndexes[0] == 56) this.bgTopY -= 100; if (Main.bgWidthScaled == 0) Main.bgWidthScaled = 1; this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { try { Texture2D texture = TextureAssets.Background[bgTexIndexes[1]].Value; if (texture != null) { for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(texture, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index), (float) this.bgTopY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[bgTexIndexes[1]], Main.backgroundHeight[bgTexIndexes[1]])), Main.ColorOfSurfaceBackgroundsModified, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.FlipHorizontally, 0.0f); } } catch { this.LoadBackground(bgTexIndexes[1]); } } Main.bgScale = 1.34f; this.bgParallax = 0.49; this.bgTopY = (int) (backgroundTopMagicNumber * 2100.0 + 2000.0) + (int) this.scAdj + pushBGTopHack; this.SetBackgroundOffsets(bgTexIndexes[2], backgroundTopMagicNumber, pushBGTopHack); Main.bgScale *= bgGlobalScaleMultiplier; this.LoadBackground(bgTexIndexes[2]); Main.bgWidthScaled = (int) ((double) Main.backgroundWidth[bgTexIndexes[2]] * (double) Main.bgScale); if (Main.bgWidthScaled == 0) Main.bgWidthScaled = 150; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); if (Main.gameMenu) { this.bgTopY = 480 + pushBGTopHack; this.bgStartX -= 120; } if (bgTexIndexes[0] == 56) this.bgTopY -= 100; this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if ((double) Main.screenPosition.Y >= Main.worldSurface * 16.0 + 16.0) return; for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(TextureAssets.Background[bgTexIndexes[2]].Value, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index), (float) this.bgTopY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[bgTexIndexes[2]], Main.backgroundHeight[bgTexIndexes[2]])), Main.ColorOfSurfaceBackgroundsModified, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } private Microsoft.Xna.Framework.Rectangle? GetBackgroundRect(int backgroundTextureIndex) { Microsoft.Xna.Framework.Rectangle rectangle1 = new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1); switch (backgroundTextureIndex) { case 219: case 220: case 221: case 271: case 272: case 273: int num1 = (int) (this.GetBackgroundCounter() / 15U) % 4; Microsoft.Xna.Framework.Rectangle rectangle2 = TextureAssets.Background[backgroundTextureIndex].Frame(2, 2, num1 % 2, num1 / 2); rectangle2.Inflate(0, -2); return new Microsoft.Xna.Framework.Rectangle?(rectangle2); case 235: int num2 = (int) (this.GetBackgroundCounter() / 20U) % 4; Microsoft.Xna.Framework.Rectangle rectangle3 = TextureAssets.Background[backgroundTextureIndex].Frame(2, 2, num2 % 2, num2 / 2); rectangle3.Inflate(0, -2); return new Microsoft.Xna.Framework.Rectangle?(rectangle3); case 281: int num3 = (int) (this.GetBackgroundCounter() / 5U) % 4; Microsoft.Xna.Framework.Rectangle rectangle4 = TextureAssets.Background[backgroundTextureIndex].Frame(2, 2, num3 % 2, num3 / 2); rectangle4.Inflate(0, -2); return new Microsoft.Xna.Framework.Rectangle?(rectangle4); default: return new Microsoft.Xna.Framework.Rectangle?(); } } private uint GetBackgroundCounter() => !Main.gameMenu ? Main.GameUpdateCount : (uint) ((double) Main.GlobalTimeWrappedHourly * 40.0); private void DrawSurfaceBG_Forest( double backgroundTopMagicNumber, float bgGlobalScaleMultiplier, int pushBGTopHack, int[] bgTexIndexes) { Main.bgScale = 1.25f; this.bgParallax = 0.4; this.bgTopY = (int) (backgroundTopMagicNumber * 1800.0 + 1500.0) + (int) this.scAdj + pushBGTopHack; if (bgTexIndexes[0] == 91) { this.bgParallax = 0.270000010728836; Main.bgScale = 1.2f; } if (bgTexIndexes[0] == 173) { this.bgParallax = 0.25; Main.bgScale = 1.3f; } if (bgTexIndexes[0] == 178) { this.bgParallax = 0.300000011920929; Main.bgScale = 1.2f; } if (bgTexIndexes[0] == 184) { this.bgParallax = 0.25; Main.bgScale = 1.2f; } if (bgTexIndexes[0] == 282) Main.bgScale = 1.4f; this.SetBackgroundOffsets(bgTexIndexes[0], backgroundTopMagicNumber, pushBGTopHack); Main.bgScale *= bgGlobalScaleMultiplier; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); if (bgTexIndexes[0] >= 0) { this.SetBackgroundOffsets(bgTexIndexes[0], backgroundTopMagicNumber, pushBGTopHack); this.LoadBackground(bgTexIndexes[0]); Main.bgWidthScaled = (int) ((double) Main.backgroundWidth[bgTexIndexes[0]] * (double) Main.bgScale); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); if (bgTexIndexes[0] == 91) this.bgTopY = (int) (backgroundTopMagicNumber * 1600.0 + 1400.0) + (int) this.scAdj + pushBGTopHack; if (bgTexIndexes[0] == 173) this.bgTopY = (int) (backgroundTopMagicNumber * 1600.0 + 1400.0) + (int) this.scAdj + pushBGTopHack; if (bgTexIndexes[0] == 184) this.bgTopY = (int) (backgroundTopMagicNumber * 1600.0 + 1400.0) + (int) this.scAdj + pushBGTopHack; if (Main.gameMenu) this.bgTopY = 320 + pushBGTopHack; if (bgTexIndexes[0] == 50) this.bgTopY -= 50; if (bgTexIndexes[0] == 53) this.bgTopY -= 100; if (bgTexIndexes[0] == 91) this.bgTopY += 200; if (bgTexIndexes[0] == 173) this.bgTopY += 200; if (bgTexIndexes[0] == 178) this.bgTopY += 75; this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index = 0; index < this.bgLoops; ++index) { if (bgTexIndexes[0] != -1) { Asset asset = TextureAssets.Background[bgTexIndexes[0]]; if (bgTexIndexes[0] == 173) { int i = 251 + (int) (this.GetBackgroundCounter() / 10U) % 4; this.LoadBackground(i); asset = TextureAssets.Background[i]; } if (asset.Value != null) Main.spriteBatch.Draw(asset.Value, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index), (float) this.bgTopY), this.GetBackgroundRect(bgTexIndexes[0]), Main.ColorOfSurfaceBackgroundsModified, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } } } } if (bgTexIndexes[1] >= 0) { this.LoadBackground(bgTexIndexes[1]); Main.bgScale = 1.31f; Main.bgScale *= bgGlobalScaleMultiplier; Main.bgWidthScaled = (int) ((double) Main.backgroundWidth[bgTexIndexes[1]] * (double) Main.bgScale); if (Main.bgWidthScaled == 0) Main.bgWidthScaled = 1; this.bgParallax = 0.43; this.SetBackgroundOffsets(bgTexIndexes[1], backgroundTopMagicNumber, pushBGTopHack); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); this.bgTopY = (int) (backgroundTopMagicNumber * 1950.0 + 1750.0) + (int) this.scAdj + pushBGTopHack; if (Main.gameMenu) { this.bgTopY = 400 + pushBGTopHack; this.bgStartX -= 80; } if (bgTexIndexes[1] == 51) this.bgTopY -= 50; if (bgTexIndexes[1] == 54) this.bgTopY -= 100; this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(TextureAssets.Background[bgTexIndexes[1]].Value, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index), (float) this.bgTopY), this.GetBackgroundRect(bgTexIndexes[1]), Main.ColorOfSurfaceBackgroundsModified, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.FlipHorizontally, 0.0f); } } if (bgTexIndexes[2] < 0) return; this.LoadBackground(bgTexIndexes[2]); Main.bgScale = 1.34f; Main.bgScale *= bgGlobalScaleMultiplier; this.bgParallax = 0.49; this.SetBackgroundOffsets(bgTexIndexes[2], backgroundTopMagicNumber, pushBGTopHack); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); if (bgTexIndexes[0] == 91) { Main.bgScale = 1.3f; Main.bgScale *= bgGlobalScaleMultiplier; this.bgParallax = 0.42; } if (bgTexIndexes[2] < 0 && WorldGen.drunkWorldGen) return; Main.bgWidthScaled = (int) ((double) Main.backgroundWidth[bgTexIndexes[2]] * (double) Main.bgScale); if (Main.bgWidthScaled == 0) Main.bgWidthScaled = 1; this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgWidthScaled) - (double) (Main.bgWidthScaled / 2)); this.bgTopY = (int) (backgroundTopMagicNumber * 2100.0 + 2000.0) + (int) this.scAdj + pushBGTopHack; if (Main.gameMenu) { this.bgTopY = 480 + pushBGTopHack; this.bgStartX -= 120; } if (bgTexIndexes[2] == 52) this.bgTopY -= 50; if (bgTexIndexes[2] == 55) this.bgTopY -= 100; if (bgTexIndexes[2] == 92) this.bgTopY += 150; this.bgLoops = Main.screenWidth / Main.bgWidthScaled + 2; if ((double) Main.screenPosition.Y >= Main.worldSurface * 16.0 + 16.0) return; for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(TextureAssets.Background[bgTexIndexes[2]].Value, new Vector2((float) (this.bgStartX + Main.bgWidthScaled * index), (float) this.bgTopY), this.GetBackgroundRect(bgTexIndexes[2]), Main.ColorOfSurfaceBackgroundsModified, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } private void DrawBackgroundBlackFill() { float num1 = (float) (Main.worldSurface + 2.0) * 16f - Main.screenPosition.Y; float num2 = (float) ((double) Main.maxTilesY * 16.0 - 2880.0 - ((double) Main.screenPosition.Y + (double) Main.screenHeight)); float num3 = MathHelper.Clamp(num1, 0.0f, (float) Main.screenHeight); float num4 = MathHelper.Clamp(num2, 0.0f, (float) Main.screenHeight); if ((double) num4 - (double) num3 <= 0.0) return; Main.spriteBatch.Draw(TextureAssets.BlackTile.Value, new Microsoft.Xna.Framework.Rectangle(0, (int) num3, Main.screenWidth, (int) ((double) num4 - (double) num3)), Microsoft.Xna.Framework.Color.Black); } public void DrawTileCracks(int crackType, HitTile hitter) { Vector2 vector2 = new Vector2((float) Main.offScreenRange, (float) Main.offScreenRange); if (Main.drawToScreen) vector2 = Vector2.Zero; for (int index = 0; index < hitter.data.Length; ++index) { if (hitter.data[index].type == crackType) { int damage = hitter.data[index].damage; if (damage >= 20) { int x = hitter.data[index].X; int y = hitter.data[index].Y; if (WorldGen.InWorld(x, y)) { bool flag1 = Main.tile[x, y] != null; if (flag1 && crackType == 1) flag1 = flag1 && Main.tile[x, y].active(); if (flag1 && crackType == 2) flag1 = flag1 && Main.tile[x, y].wall > (ushort) 0; if (flag1) { bool flag2 = false; bool flag3 = false; if (Main.tile[x, y].type == (ushort) 10) flag2 = false; else if (Main.tileSolid[(int) Main.tile[x, y].type] && !Main.tileSolidTop[(int) Main.tile[x, y].type]) flag2 = true; else if (WorldGen.IsTreeType((int) Main.tile[x, y].type)) { flag3 = true; int num1 = (int) Main.tile[x, y].frameX / 22; int num2 = (int) Main.tile[x, y].frameY / 22; if (num2 < 9) flag2 = (num1 != 1 && num1 != 2 || num2 < 6 || num2 > 8) && (num1 != 3 || num2 > 2) && (num1 != 4 || num2 < 3 || num2 > 5) && (num1 != 5 || num2 < 6 || num2 > 8); } else if (Main.tile[x, y].type == (ushort) 72) { flag3 = true; if (Main.tile[x, y].frameX <= (short) 34) flag2 = true; } if (flag2 && Main.tile[x, y].slope() == (byte) 0 && !Main.tile[x, y].halfBrick()) { int num = 0; if (damage >= 80) num = 3; else if (damage >= 60) num = 2; else if (damage >= 40) num = 1; else if (damage >= 20) num = 0; Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(hitter.data[index].crackStyle * 18, num * 18, 16, 16); if (flag3) rectangle.X = (4 + hitter.data[index].crackStyle / 2) * 18; Main.spriteBatch.Draw(TextureAssets.TileCrack.Value, new Vector2((float) (x * 16 - (int) Main.screenPosition.X), (float) (y * 16 - (int) Main.screenPosition.Y)) + vector2, new Microsoft.Xna.Framework.Rectangle?(rectangle), Lighting.GetColor(x, y), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } } } } } } } private static void CheckMonoliths() { bool flag = Main.player[Main.myPlayer].ZoneTowerVortex || Main.player[Main.myPlayer].ZoneTowerNebula || Main.player[Main.myPlayer].ZoneTowerStardust || Main.player[Main.myPlayer].ZoneTowerSolar; for (int index = 0; index < Main.MonolithFilterNames.Length; ++index) { if (!flag && index == Main.SceneMetrics.ActiveMonolithType) { if (!Terraria.Graphics.Effects.Filters.Scene[Main.MonolithFilterNames[Main.SceneMetrics.ActiveMonolithType]].IsActive()) Terraria.Graphics.Effects.Filters.Scene.Activate(Main.MonolithFilterNames[Main.SceneMetrics.ActiveMonolithType], new Vector2()); if (!SkyManager.Instance[Main.MonolithSkyNames[index]].IsActive()) SkyManager.Instance.Activate(Main.MonolithSkyNames[index], new Vector2()); } else { if (Terraria.Graphics.Effects.Filters.Scene[Main.MonolithFilterNames[index]].IsActive()) Terraria.Graphics.Effects.Filters.Scene.Deactivate(Main.MonolithFilterNames[index]); if (SkyManager.Instance[Main.MonolithSkyNames[index]].IsActive()) SkyManager.Instance.Deactivate(Main.MonolithSkyNames[index]); } } } public static bool IsGraphicsDeviceAvailable => !Main.instance.GraphicsDevice.IsDisposed && Main.instance.GraphicsDevice.GraphicsDeviceStatus == GraphicsDeviceStatus.Normal; private void GraphicsDeviceLost(object sender, EventArgs evt) { } protected override void Draw(GameTime gameTime) { if (this._isDrawingOrUpdating || !Main.IsGraphicsDeviceAvailable) return; this._isDrawingOrUpdating = true; this.EnsureRenderTargetContent(); this.DoDraw(gameTime); if (Main.OnPostDraw != null) Main.OnPostDraw(gameTime); Main.Assets.TransferCompletedAssets(); this._isDrawingOrUpdating = false; } private void DoDraw(GameTime gameTime) { Stopwatch stopwatch1 = new Stopwatch(); stopwatch1.Start(); if (Main.showSplash) { this.DrawSplash(gameTime); TimeLogger.SplashDrawTime(stopwatch1.Elapsed.TotalMilliseconds); TimeLogger.EndDrawFrame(); } else { if (Main._drawCycleCounter == 0UL) Main.TileFrameSeed = Utils.RandomNextSeed(Main.TileFrameSeed); Main._drawCycleCounter = (Main._drawCycleCounter + 1UL) % 5UL; Main.MenuUI.IsVisible = Main.gameMenu && Main.menuMode == 888; Main.InGameUI.IsVisible = !Main.gameMenu && Main.InGameUI.CurrentState != null; PlayerInput.UpdateMainMouse(); this.RefreshPlayerDrawOrder(); CaptureManager.Instance.DrawTick(); TimeLogger.NewDrawFrame(); if (!Main.gameMenu) this.TilesRenderer.PreparePaintForTilesOnScreen(); for (int index = 0; index < Main.ContentThatNeedsRenderTargets.Count; ++index) Main.ContentThatNeedsRenderTargets[index].PrepareRenderTarget(this.GraphicsDevice, Main.spriteBatch); this.TilePaintSystem.PrepareAllRequests(); TimeLogger.DetailedDrawTime(0); if (Main.loadMap) { Main.refreshMap = false; this.DrawToMap(); TimeLogger.DetailedDrawTime(1); } Main.drawToScreen = Lighting.UpdateEveryFrame; if (Main.drawToScreen && Main.targetSet) this.ReleaseTargets(); if (!Main.drawToScreen && !Main.targetSet) this.InitTargets(); ++Main.fpsCount; if (!this.IsActive) Main.maxQ = true; this.UpdateDisplaySettings(); if (Main.OnPreDraw != null) Main.OnPreDraw(gameTime); ++Main.drawsCountedForFPS; Main.screenLastPosition = Main.screenPosition; if (Main.stackSplit == 0) { Main.stackCounter = 0; Main.stackDelay = 7; Main.superFastStack = 0; } else { ++Main.stackCounter; int num; switch (Main.stackDelay) { case 3: num = 10; break; case 4: num = 15; break; case 5: num = 20; break; case 6: num = 25; break; case 7: num = 30; break; default: num = 5; break; } if (Main.stackCounter >= num) { --Main.stackDelay; if (Main.stackDelay < 2) { Main.stackDelay = 2; ++Main.superFastStack; } Main.stackCounter = 0; } } if (Main.myPlayer >= 0) { Main.player[Main.myPlayer].lastMouseInterface = Main.player[Main.myPlayer].mouseInterface; Main.player[Main.myPlayer].mouseInterface = false; } if (Main.mapTime > 0) --Main.mapTime; if (Main.gameMenu) Main.mapTime = Main.mapTimeMax; Main.HoverItem = new Item(); Main.DoDraw_UpdateCameraPosition(); Main.CheckMonoliths(); Main.sunCircle += 0.01f; if ((double) Main.sunCircle > 6.285) Main.sunCircle -= 6.285f; TimeLogger.DetailedDrawReset(); if (!Main.gameMenu) { this.waterfallManager.FindWaterfalls(); TimeLogger.DetailedDrawTime(2); if (Main.renderNow) { Main.screenLastPosition = Main.screenPosition; Main.renderNow = false; Main.renderCount = 99; this.Draw(gameTime); Lighting.LightTiles(this.firstTileX, this.lastTileX, this.firstTileY, this.lastTileY); Lighting.LightTiles(this.firstTileX, this.lastTileX, this.firstTileY, this.lastTileY); this.RenderTiles(); Main.sceneTilePos.X = Main.screenPosition.X - (float) Main.offScreenRange; Main.sceneTilePos.Y = Main.screenPosition.Y - (float) Main.offScreenRange; this.RenderBackground(); Main.sceneBackgroundPos.X = Main.screenPosition.X - (float) Main.offScreenRange; Main.sceneBackgroundPos.Y = Main.screenPosition.Y - (float) Main.offScreenRange; this.RenderWalls(); Main.sceneWallPos.X = Main.screenPosition.X - (float) Main.offScreenRange; Main.sceneWallPos.Y = Main.screenPosition.Y - (float) Main.offScreenRange; this.RenderTiles2(); Main.sceneTile2Pos.X = Main.screenPosition.X - (float) Main.offScreenRange; Main.sceneTile2Pos.Y = Main.screenPosition.Y - (float) Main.offScreenRange; this.RenderWater(); Main.sceneWaterPos.X = Main.screenPosition.X - (float) Main.offScreenRange; Main.sceneWaterPos.Y = Main.screenPosition.Y - (float) Main.offScreenRange; Main.renderCount = 99; } else { if (Main.renderCount == 3) { this.RenderTiles(); Main.sceneTilePos.X = Main.screenPosition.X - (float) Main.offScreenRange; Main.sceneTilePos.Y = Main.screenPosition.Y - (float) Main.offScreenRange; } if (Main.renderCount == 3) { this.RenderTiles2(); Main.sceneTile2Pos.X = Main.screenPosition.X - (float) Main.offScreenRange; Main.sceneTile2Pos.Y = Main.screenPosition.Y - (float) Main.offScreenRange; } if (Main.renderCount == 3) { this.RenderWalls(); Main.sceneWallPos.X = Main.screenPosition.X - (float) Main.offScreenRange; Main.sceneWallPos.Y = Main.screenPosition.Y - (float) Main.offScreenRange; } if (Main.renderCount == 2) { this.RenderBackground(); Main.sceneBackgroundPos.X = Main.screenPosition.X - (float) Main.offScreenRange; Main.sceneBackgroundPos.Y = Main.screenPosition.Y - (float) Main.offScreenRange; } if (Main.renderCount == 1) { this.RenderWater(); Main.sceneWaterPos.X = Main.screenPosition.X - (float) Main.offScreenRange; Main.sceneWaterPos.Y = Main.screenPosition.Y - (float) Main.offScreenRange; } } if (Main.render && !Main.gameMenu) { if ((double) Math.Abs(Main.sceneTilePos.X - (Main.screenPosition.X - (float) Main.offScreenRange)) > (double) Main.offScreenRange || (double) Math.Abs(Main.sceneTilePos.Y - (Main.screenPosition.Y - (float) Main.offScreenRange)) > (double) Main.offScreenRange) { this.RenderTiles(); Main.sceneTilePos.X = Main.screenPosition.X - (float) Main.offScreenRange; Main.sceneTilePos.Y = Main.screenPosition.Y - (float) Main.offScreenRange; } if ((double) Math.Abs(Main.sceneTile2Pos.X - (Main.screenPosition.X - (float) Main.offScreenRange)) > (double) Main.offScreenRange || (double) Math.Abs(Main.sceneTile2Pos.Y - (Main.screenPosition.Y - (float) Main.offScreenRange)) > (double) Main.offScreenRange) { this.RenderTiles2(); Main.sceneTile2Pos.X = Main.screenPosition.X - (float) Main.offScreenRange; Main.sceneTile2Pos.Y = Main.screenPosition.Y - (float) Main.offScreenRange; } if ((double) Math.Abs(Main.sceneBackgroundPos.X - (Main.screenPosition.X - (float) Main.offScreenRange)) > (double) Main.offScreenRange || (double) Math.Abs(Main.sceneBackgroundPos.Y - (Main.screenPosition.Y - (float) Main.offScreenRange)) > (double) Main.offScreenRange) { this.RenderBackground(); Main.sceneBackgroundPos.X = Main.screenPosition.X - (float) Main.offScreenRange; Main.sceneBackgroundPos.Y = Main.screenPosition.Y - (float) Main.offScreenRange; } if ((double) Math.Abs(Main.sceneWallPos.X - (Main.screenPosition.X - (float) Main.offScreenRange)) > (double) Main.offScreenRange || (double) Math.Abs(Main.sceneWallPos.Y - (Main.screenPosition.Y - (float) Main.offScreenRange)) > (double) Main.offScreenRange) { this.RenderWalls(); Main.sceneWallPos.X = Main.screenPosition.X - (float) Main.offScreenRange; Main.sceneWallPos.Y = Main.screenPosition.Y - (float) Main.offScreenRange; } if ((double) Math.Abs(Main.sceneWaterPos.X - (Main.screenPosition.X - (float) Main.offScreenRange)) > (double) Main.offScreenRange || (double) Math.Abs(Main.sceneWaterPos.Y - (Main.screenPosition.Y - (float) Main.offScreenRange)) > (double) Main.offScreenRange) { this.RenderWater(); Main.sceneWaterPos.X = Main.screenPosition.X - (float) Main.offScreenRange; Main.sceneWaterPos.Y = Main.screenPosition.Y - (float) Main.offScreenRange; } } } if (!Main.loadMap) { if (!Main.gameMenu) { TimeLogger.DetailedDrawReset(); Stopwatch stopwatch2 = new Stopwatch(); stopwatch2.Start(); int num = 0; int x; int y; while (stopwatch2.ElapsedMilliseconds < 5L && Main.sectionManager.GetNextMapDraw(Main.player[Main.myPlayer].position, out x, out y)) { this.DrawToMap_Section(x, y); ++num; } TimeLogger.DetailedDrawTime(3); } if (Main.updateMap) { if (this.IsActive || Main.netMode == 1) { if (Main.refreshMap) { Main.refreshMap = false; Main.sectionManager.ClearMapDraw(); } this.DrawToMap(); Main.updateMap = false; } else if (MapHelper.numUpdateTile > 0) this.DrawToMap(); TimeLogger.DetailedDrawTime(4); } } this.bgParallax = 0.1; this.bgStartX = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.backgroundWidth[Main.background]) - (double) (Main.backgroundWidth[Main.background] / 2)); this.bgLoops = Main.screenWidth / Main.backgroundWidth[Main.background] + 2; this.bgStartY = 0; this.bgLoopsY = 0; this.bgTopY = (int) (-(double) Main.screenPosition.Y / (Main.worldSurface * 16.0 - 600.0) * 200.0); if (Main.gameMenu || Main.netMode == 2) this.bgTopY = -200; float num1 = 0.0005f * (float) Main.dayRate; if (Main.gameMenu) num1 *= 20f; if (Main.raining) { if ((double) Main.cloudAlpha > (double) Main.maxRaining) { Main.cloudAlpha -= num1; if ((double) Main.cloudAlpha < (double) Main.maxRaining) Main.cloudAlpha = Main.maxRaining; } else if ((double) Main.cloudAlpha < (double) Main.maxRaining) { Main.cloudAlpha += num1; if ((double) Main.cloudAlpha > (double) Main.maxRaining) Main.cloudAlpha = Main.maxRaining; } } else { Main.cloudAlpha -= num1; if ((double) Main.cloudAlpha < 0.0) Main.cloudAlpha = 0.0f; } if (Main.gameMenu || Main.netMode == 2) { Main.bgDelay = 1000; Main.SceneMetrics.EvilTileCount = (int) ((double) Main.bgAlphaFrontLayer[1] * (double) SceneMetrics.CorruptionTileMax); } Microsoft.Xna.Framework.Color moonColor = Microsoft.Xna.Framework.Color.White; Microsoft.Xna.Framework.Color sunColor = Microsoft.Xna.Framework.Color.White; float num2 = (float) (Main.SceneMetrics.MushroomTileCount / SceneMetrics.MushroomTileMax); float tempMushroomInfluence = Main.SmoothedMushroomLightInfluence; if ((double) num2 > 0.0) { double num3 = (double) num2; if (num3 > (double) tempMushroomInfluence) tempMushroomInfluence += 0.01f; if (num3 < (double) tempMushroomInfluence) tempMushroomInfluence -= 0.01f; } else tempMushroomInfluence -= 0.02f; if ((double) tempMushroomInfluence < 0.0) tempMushroomInfluence = 0.0f; if ((double) tempMushroomInfluence > 1.0) tempMushroomInfluence = 1f; Main.SmoothedMushroomLightInfluence = tempMushroomInfluence; Main.SetBackColor(new Main.InfoToSetBackColor() { isInGameMenuOrIsServer = Main.gameMenu || Main.netMode == 2, CorruptionBiomeInfluence = (float) Main.SceneMetrics.EvilTileCount / (float) SceneMetrics.CorruptionTileMax, CrimsonBiomeInfluence = (float) Main.SceneMetrics.BloodTileCount / (float) SceneMetrics.CrimsonTileMax, JungleBiomeInfluence = (float) Main.SceneMetrics.JungleTileCount / (float) SceneMetrics.JungleTileMax, MushroomBiomeInfluence = Main.SmoothedMushroomLightInfluence, GraveyardInfluence = Main.GraveyardVisualIntensity, BloodMoonActive = Main.bloodMoon || Main.SceneMetrics.BloodMoonMonolith, LanternNightActive = LanternNight.LanternsUp }, out sunColor, out moonColor); if (Main.gameMenu || Main.netMode == 2) this.bgTopY = 0; Main.ApplyColorOfTheSkiesToTiles(); Main.UpdateAtmosphereTransparencyToSkyColor(); this.GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Black); base.Draw(gameTime); float val2_1 = (float) Main.screenWidth / Main.MinimumZoomComparerX; float val2_2 = (float) Main.screenHeight / Main.MinimumZoomComparerY; Main.ForcedMinimumZoom = Math.Max(Math.Max(1f, val2_1), val2_2); Main.GameViewMatrix.Effects = Main.gameMenu || (double) Main.player[Main.myPlayer].gravDir == 1.0 ? SpriteEffects.None : SpriteEffects.FlipVertically; Main.BackgroundViewMatrix.Effects = Main.GameViewMatrix.Effects; Main.BackgroundViewMatrix.Zoom = new Vector2(Main.ForcedMinimumZoom); Main.GameViewMatrix.Zoom = new Vector2(Main.ForcedMinimumZoom * MathHelper.Clamp(Main.GameZoomTarget, 1f, 2f)); Main.Rasterizer = Main.gameMenu || (double) Main.player[Main.myPlayer].gravDir == 1.0 ? RasterizerState.CullCounterClockwise : RasterizerState.CullClockwise; bool flag = !Main.drawToScreen && Main.netMode != 2 && !Main.gameMenu && !Main.mapFullscreen && Lighting.NotRetro && Terraria.Graphics.Effects.Filters.Scene.CanCapture(); if (flag) Terraria.Graphics.Effects.Filters.Scene.BeginCapture(Main.screenTarget, Microsoft.Xna.Framework.Color.Black); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, (Effect) null, Main.BackgroundViewMatrix.TransformationMatrix); TimeLogger.DetailedDrawReset(); if (!Main.mapFullscreen) { this.unityMouseOver = false; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { Asset asset = TextureAssets.Background[Main.background]; Microsoft.Xna.Framework.Rectangle destinationRectangle = new Microsoft.Xna.Framework.Rectangle(this.bgStartX, this.bgTopY, asset.Width(), Math.Max(Main.screenHeight, asset.Height())); if (destinationRectangle.Bottom < asset.Height()) { int num4 = asset.Height() - destinationRectangle.Bottom; destinationRectangle.Height += num4; } for (int index = 0; index < this.bgLoops; ++index) { destinationRectangle.X = this.bgStartX + asset.Width() * index; Main.spriteBatch.Draw(asset.Value, destinationRectangle, Main.ColorOfTheSkies); } TimeLogger.DetailedDrawTime(6); } Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, (Effect) null, Main.BackgroundViewMatrix.EffectMatrix); Main.SceneArea sceneArea = new Main.SceneArea() { bgTopY = this.bgTopY, totalHeight = (float) Main.screenHeight, totalWidth = (float) Main.screenWidth, SceneLocalScreenPositionOffset = Vector2.Zero }; this.DrawStarsInBackground(sceneArea); if ((double) Main.screenPosition.Y / 16.0 < Main.worldSurface + 2.0) this.DrawSunAndMoon(sceneArea, moonColor, sunColor, tempMushroomInfluence); TimeLogger.DetailedDrawTime(7); } Overlays.Scene.Draw(Main.spriteBatch, RenderLayers.Sky); Main.spriteBatch.End(); Vector2 screenPosition = Main.screenPosition; int screenWidth = Main.screenWidth; int screenHeight = Main.screenHeight; Main.screenWidth = (int) ((double) Main.screenWidth / (double) Main.BackgroundViewMatrix.Zoom.X); Main.screenHeight = (int) ((double) Main.screenHeight / (double) Main.BackgroundViewMatrix.Zoom.Y); Main.screenPosition += Main.BackgroundViewMatrix.Translation; Matrix transformationMatrix = Main.BackgroundViewMatrix.TransformationMatrix; transformationMatrix.Translation -= Main.BackgroundViewMatrix.ZoomMatrix.Translation * new Vector3(1f, Main.BackgroundViewMatrix.Effects.HasFlag((Enum) SpriteEffects.FlipVertically) ? -1f : 1f, 1f); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, Main.Rasterizer, (Effect) null, transformationMatrix); this.DrawBG(); Main.screenWidth = screenWidth; Main.screenHeight = screenHeight; Main.screenPosition = screenPosition; Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, Main.Rasterizer, (Effect) null, Main.GameViewMatrix.TransformationMatrix); this.DrawBackgroundBlackFill(); Main.spriteBatch.End(); Overlays.Scene.Draw(Main.spriteBatch, RenderLayers.Landscape); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, Main.Rasterizer, (Effect) null, Main.UIScaleMatrix); if (Main.gameMenu || Main.netMode == 2) { Main.spriteBatch.End(); Microsoft.Xna.Framework.Point screenSizeCache; Microsoft.Xna.Framework.Point screenSizeCacheAfterScaling; this.PreDrawMenu(out screenSizeCache, out screenSizeCacheAfterScaling); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, Main.Rasterizer, (Effect) null, Main.UIScaleMatrix); this.DrawMenu(gameTime); Main.PostDrawMenu(screenSizeCache, screenSizeCacheAfterScaling); TimeLogger.MenuDrawTime(stopwatch1.Elapsed.TotalMilliseconds); TimeLogger.EndDrawFrame(); } else { Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, (Effect) null, Main.Transform); this.DoLightTiles(); TimeLogger.DetailedDrawReset(); if (Main.mapFullscreen) { if (Main.player[Main.myPlayer].talkNPC >= 0 || Main.player[Main.myPlayer].sign >= 0 || Main.playerInventory && !CaptureManager.Instance.Active) Main.player[Main.myPlayer].ToggleInv(); this.DrawMap(gameTime); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.SamplerStateForCursor, (DepthStencilState) null, (RasterizerState) null, (Effect) null, Main.UIScaleMatrix); PlayerInput.SetZoom_UI(); this.DrawFPS(); this.DrawPlayerChat(); Main.DrawPendingMouseText(); Main.DrawCursor(Main.DrawThickCursor()); PlayerInput.SetZoom_Unscaled(); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, (DepthStencilState) null, (RasterizerState) null, (Effect) null); TimeLogger.MapDrawTime(stopwatch1.Elapsed.TotalMilliseconds); TimeLogger.EndDrawFrame(); PlayerInput.SetDesiredZoomContext(ZoomContext.Unscaled); CaptureManager.Instance.Update(); if (CaptureManager.Instance.Active) CaptureManager.Instance.Draw(Main.spriteBatch); Main.spriteBatch.End(); if (Main.mouseLeft) Main.mouseLeftRelease = false; else Main.mouseLeftRelease = true; } else { Overlays.Scene.Draw(Main.spriteBatch, RenderLayers.InWorldUI); Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; if (Main.drawToScreen) { this.DrawWaters(true); } else { Main.spriteBatch.Draw((Texture2D) this.backWaterTarget, Main.sceneBackgroundPos - Main.screenPosition, Microsoft.Xna.Framework.Color.White); TimeLogger.DetailedDrawTime(11); } Overlays.Scene.Draw(Main.spriteBatch, RenderLayers.BackgroundWater); float x = (Main.sceneBackgroundPos.X - Main.screenPosition.X + (float) Main.offScreenRange) * Main.caveParallax - (float) Main.offScreenRange; if (Main.drawToScreen) { Main.tileBatch.Begin(); this.DrawBackground(); Main.tileBatch.End(); } else { Main.spriteBatch.Draw((Texture2D) this.backgroundTarget, new Vector2(x, Main.sceneBackgroundPos.Y - Main.screenPosition.Y), Microsoft.Xna.Framework.Color.White); TimeLogger.DetailedDrawTime(12); } Overlays.Scene.Draw(Main.spriteBatch, RenderLayers.Background); ScreenDarkness.DrawBack(Main.spriteBatch); ++Main.magmaBGFrameCounter; if (Main.magmaBGFrameCounter >= 8) { Main.magmaBGFrameCounter = 0; ++Main.magmaBGFrame; if (Main.magmaBGFrame >= 3) Main.magmaBGFrame = 0; } this.DoDraw_WallsTilesNPCs(); Overlays.Scene.Draw(Main.spriteBatch, RenderLayers.TilesAndNPCs); if (!Main.mapFullscreen) { if (Main.mapStyle == 2) { try { this.DrawMap(gameTime); } catch (Exception ex) { if (Main.ignoreErrors) TimeLogger.DrawException(ex); else throw; } } } TimeLogger.DetailedDrawReset(); Main.spriteBatch.End(); TimeLogger.DetailedDrawTime(35); Main.HasInteractibleObjectThatIsNotATile = false; this.SortDrawCacheWorms(); this.DrawSuperSpecialProjectiles(this.DrawCacheFirstFractals); this.DrawCachedProjs(this.DrawCacheProjsBehindProjectiles); this.DrawProjectiles(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, (Effect) null, Main.Transform); Main.ParticleSystem_World_BehindPlayers.Settings.AnchorPosition = -Main.screenPosition; Main.ParticleSystem_World_BehindPlayers.Draw(Main.spriteBatch); Main.spriteBatch.End(); this.DrawPlayers_AfterProjectiles(); this.DrawCachedProjs(this.DrawCacheProjsOverPlayers); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, (Effect) null, Main.Transform); Main.ParticleSystem_World_OverPlayers.Settings.AnchorPosition = -Main.screenPosition; Main.ParticleSystem_World_OverPlayers.Draw(Main.spriteBatch); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, (Effect) null, Main.Transform); this.DrawCachedNPCs(this.DrawCacheNPCsOverPlayers, false); if (!Main.gamePaused) { Main.essScale += (float) Main.essDir * 0.01f; if ((double) Main.essScale > 1.0) { Main.essDir = -1; Main.essScale = 1f; } if ((double) Main.essScale < 0.7) { Main.essDir = 1; Main.essScale = 0.7f; } } this.DrawItems(); TimeLogger.DetailedDrawTime(22); this.DrawRain(); if (Main.ignoreErrors) { try { this.DrawGore(); } catch (Exception ex) { TimeLogger.DrawException(ex); } } else this.DrawGore(); Main.spriteBatch.End(); this.DrawDust(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, (Effect) null, Main.Transform); Overlays.Scene.Draw(Main.spriteBatch, RenderLayers.Entities); if (Main.drawToScreen) { this.DrawWaters(); if (WiresUI.Settings.DrawWires) this.DrawWires(); } else { Main.spriteBatch.Draw((Texture2D) Main.waterTarget, Main.sceneWaterPos - Main.screenPosition, Microsoft.Xna.Framework.Color.White); if (WiresUI.Settings.DrawWires) this.DrawWires(); TimeLogger.DetailedDrawTime(26); } Overlays.Scene.Draw(Main.spriteBatch, RenderLayers.ForegroundWater); this.DrawCachedProjs(this.DrawCacheProjsOverWiresUI, false); this.DrawInfernoRings(); ScreenDarkness.DrawFront(Main.spriteBatch); MoonlordDeathDrama.DrawWhite(Main.spriteBatch); ScreenObstruction.Draw(Main.spriteBatch); TimeLogger.DetailedDrawReset(); Main.spriteBatch.End(); Overlays.Scene.Draw(Main.spriteBatch, RenderLayers.All); if (flag) Terraria.Graphics.Effects.Filters.Scene.EndCapture((RenderTarget2D) null, Main.screenTarget, Main.screenTargetSwap, Microsoft.Xna.Framework.Color.Black); TimeLogger.DetailedDrawTime(36); if (!Main.hideUI) { Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, (DepthStencilState) null, (RasterizerState) null, (Effect) null, Main.UIScaleMatrix); TimeLogger.DetailedDrawReset(); this.DrawPlayerChatBubbles(); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, (DepthStencilState) null, (RasterizerState) null, (Effect) null, Main.GameViewMatrix.ZoomMatrix); float targetScale = CombatText.TargetScale; for (int index1 = 0; index1 < 100; ++index1) { if (Main.combatText[index1].active) { int index2 = 0; if (Main.combatText[index1].crit) index2 = 1; Vector2 vector2_1 = FontAssets.CombatText[index2].Value.MeasureString(Main.combatText[index1].text); Vector2 vector2_2 = new Vector2(vector2_1.X * 0.5f, vector2_1.Y * 0.5f); float num5 = Main.combatText[index1].scale / targetScale; float r = (float) Main.combatText[index1].color.R; float g = (float) Main.combatText[index1].color.G; float b = (float) Main.combatText[index1].color.B; float a = (float) Main.combatText[index1].color.A; float num6 = r * (float) ((double) num5 * (double) Main.combatText[index1].alpha * 0.300000011920929); float num7 = b * (float) ((double) num5 * (double) Main.combatText[index1].alpha * 0.300000011920929); float num8 = g * (float) ((double) num5 * (double) Main.combatText[index1].alpha * 0.300000011920929); float num9 = a * (num5 * Main.combatText[index1].alpha); Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color((int) num6, (int) num8, (int) num7, (int) num9); for (int index3 = 0; index3 < 5; ++index3) { float num10 = 0.0f; float num11 = 0.0f; if (index3 == 0) num10 -= targetScale; else if (index3 == 1) num10 += targetScale; else if (index3 == 2) num11 -= targetScale; else if (index3 == 3) { num11 += targetScale; } else { float num12 = (float) Main.combatText[index1].color.R * num5 * Main.combatText[index1].alpha; float num13 = (float) Main.combatText[index1].color.B * num5 * Main.combatText[index1].alpha; float num14 = (float) Main.combatText[index1].color.G * num5 * Main.combatText[index1].alpha; float num15 = (float) Main.combatText[index1].color.A * num5 * Main.combatText[index1].alpha; color = new Microsoft.Xna.Framework.Color((int) num12, (int) num14, (int) num13, (int) num15); } if ((double) Main.player[Main.myPlayer].gravDir == -1.0) { float num16 = Main.combatText[index1].position.Y - Main.screenPosition.Y; float num17 = (float) Main.screenHeight - num16; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.CombatText[index2].Value, Main.combatText[index1].text, new Vector2(Main.combatText[index1].position.X - Main.screenPosition.X + num10 + vector2_2.X, num17 + num11 + vector2_2.Y), color, Main.combatText[index1].rotation, vector2_2, Main.combatText[index1].scale, SpriteEffects.None, 0.0f); } else DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.CombatText[index2].Value, Main.combatText[index1].text, new Vector2(Main.combatText[index1].position.X - Main.screenPosition.X + num10 + vector2_2.X, Main.combatText[index1].position.Y - Main.screenPosition.Y + num11 + vector2_2.Y), color, Main.combatText[index1].rotation, vector2_2, Main.combatText[index1].scale, SpriteEffects.None, 0.0f); } } } float num18 = PopupText.TargetScale; if ((double) num18 == 0.0) num18 = 1f; for (int index4 = 0; index4 < 20; ++index4) { if (Main.popupText[index4].active) { string str = Main.popupText[index4].name; if (Main.popupText[index4].stack > 1) str = str + " (" + (object) Main.popupText[index4].stack + ")"; Vector2 vector2_3 = FontAssets.MouseText.Value.MeasureString(str); Vector2 vector2_4 = new Vector2(vector2_3.X * 0.5f, vector2_3.Y * 0.5f); float num19 = Main.popupText[index4].scale / num18; int num20 = (int) ((double) byte.MaxValue - (double) byte.MaxValue * (double) num19); float r = (float) Main.popupText[index4].color.R; float g = (float) Main.popupText[index4].color.G; float b = (float) Main.popupText[index4].color.B; float a = (float) Main.popupText[index4].color.A; float num21 = r * (float) ((double) num19 * (double) Main.popupText[index4].alpha * 0.300000011920929); float num22 = b * (float) ((double) num19 * (double) Main.popupText[index4].alpha * 0.300000011920929); float num23 = g * (float) ((double) num19 * (double) Main.popupText[index4].alpha * 0.300000011920929); float t = a * (num19 * Main.popupText[index4].alpha); Microsoft.Xna.Framework.Color color1 = new Microsoft.Xna.Framework.Color((int) num21, (int) num23, (int) num22, (int) t); Microsoft.Xna.Framework.Color color2 = Microsoft.Xna.Framework.Color.Black; float num24 = 1f; Texture2D texture2D = (Texture2D) null; switch (Main.popupText[index4].context) { case PopupTextContext.ItemPickupToVoidContainer: color2 = new Microsoft.Xna.Framework.Color((int) sbyte.MaxValue, 20, (int) byte.MaxValue) * 0.4f; num24 = 0.8f; break; case PopupTextContext.SonarAlert: color2 = Microsoft.Xna.Framework.Color.Blue * 0.4f; if (Main.popupText[index4].npcNetID != 0) color2 = Microsoft.Xna.Framework.Color.Red * 0.4f; num24 = 1f; break; } float num25 = (float) num20 / (float) byte.MaxValue; for (int index5 = 0; index5 < 5; ++index5) { color1 = color2; float num26 = 0.0f; float num27 = 0.0f; if (index5 == 0) num26 -= num18 * 2f; else if (index5 == 1) num26 += num18 * 2f; else if (index5 == 2) num27 -= num18 * 2f; else if (index5 == 3) num27 += num18 * 2f; else color1 = Main.popupText[index4].color * num19 * Main.popupText[index4].alpha * num24; if (index5 < 4) { t = (float) Main.popupText[index4].color.A * num19 * Main.popupText[index4].alpha; color1 = new Microsoft.Xna.Framework.Color(0, 0, 0, (int) t); } if (color2 != Microsoft.Xna.Framework.Color.Black && index5 < 4) { num26 *= (float) (1.29999995231628 + 1.29999995231628 * (double) num25); num27 *= (float) (1.29999995231628 + 1.29999995231628 * (double) num25); } float num28 = Main.popupText[index4].position.Y - Main.screenPosition.Y + num27; if ((double) Main.player[Main.myPlayer].gravDir == -1.0) num28 = (float) Main.screenHeight - num28; if (color2 != Microsoft.Xna.Framework.Color.Black && index5 < 4) { Microsoft.Xna.Framework.Color color3 = color2; color3.A = (byte) MathHelper.Lerp(60f, (float) sbyte.MaxValue, Utils.GetLerpValue(0.0f, (float) byte.MaxValue, t, true)); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, str, new Vector2(Main.popupText[index4].position.X - Main.screenPosition.X + num26 + vector2_4.X, num28 + vector2_4.Y), Microsoft.Xna.Framework.Color.Lerp(color1, color3, 0.5f), Main.popupText[index4].rotation, vector2_4, Main.popupText[index4].scale, SpriteEffects.None, 0.0f); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, str, new Vector2(Main.popupText[index4].position.X - Main.screenPosition.X + num26 + vector2_4.X, num28 + vector2_4.Y), color3, Main.popupText[index4].rotation, vector2_4, Main.popupText[index4].scale, SpriteEffects.None, 0.0f); } else DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, FontAssets.MouseText.Value, str, new Vector2(Main.popupText[index4].position.X - Main.screenPosition.X + num26 + vector2_4.X, num28 + vector2_4.Y), color1, Main.popupText[index4].rotation, vector2_4, Main.popupText[index4].scale, SpriteEffects.None, 0.0f); if (texture2D != null) { float scale = (float) ((1.29999995231628 - (double) num25) * (double) Main.popupText[index4].scale * 0.699999988079071); Vector2 vector2_5 = new Vector2(Main.popupText[index4].position.X - Main.screenPosition.X + num26 + vector2_4.X, num28 + vector2_4.Y); Microsoft.Xna.Framework.Color color4 = color2 * 0.6f; if (index5 == 4) color4 = Microsoft.Xna.Framework.Color.White * 0.6f; color4.A = (byte) ((double) color4.A * 0.5); int num29 = 25; Main.spriteBatch.Draw(texture2D, vector2_5 + new Vector2((float) ((double) vector2_4.X * -0.5 - (double) num29 - (double) texture2D.Size().X / 2.0), 0.0f), new Microsoft.Xna.Framework.Rectangle?(), color4 * Main.popupText[index4].scale, 0.0f, texture2D.Size() / 2f, scale, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(texture2D, vector2_5 + new Vector2((float) ((double) vector2_4.X * 0.5 + (double) num29 + (double) texture2D.Size().X / 2.0), 0.0f), new Microsoft.Xna.Framework.Rectangle?(), color4 * Main.popupText[index4].scale, 0.0f, texture2D.Size() / 2f, scale, SpriteEffects.None, 0.0f); } } } } PlayerInput.SetZoom_UI(); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, (DepthStencilState) null, (RasterizerState) null, (Effect) null, Main.UIScaleMatrix); Main.DrawNetplayStatusText(); this.DrawFPS(); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, (DepthStencilState) null, (RasterizerState) null, (Effect) null, Main.GameViewMatrix.ZoomMatrix); PlayerInput.SetZoom_World(); if (Main.BlackFadeIn > 0) { if (Main.BlackFadeIn < 0) Main.BlackFadeIn = 0; int a = Main.BlackFadeIn; if (a > (int) byte.MaxValue) a = (int) byte.MaxValue; Main.BlackFadeIn -= 25; Main.spriteBatch.Draw(TextureAssets.SplashTexture16x9.Value, new Microsoft.Xna.Framework.Rectangle(0, 0, Main.screenWidth, Main.screenHeight), new Microsoft.Xna.Framework.Color(0, 0, 0, a)); } Main.spriteBatch.End(); if (!Main.mapFullscreen) { if (Main.ignoreErrors) { try { this.DrawInterface(gameTime); } catch (Exception ex) { TimeLogger.DrawException(ex); } } else this.DrawInterface(gameTime); } TimeLogger.DetailedDrawTime(27); } else Main.maxQ = true; TimeLogger.DetailedDrawTime(37); Main.mouseLeftRelease = !Main.mouseLeft; Main.mouseRightRelease = !Main.mouseRight; if (!PlayerInput.Triggers.Current.MouseRight && !PlayerInput.Triggers.Current.MouseLeft && !Main.preventStackSplitReset) Main.stackSplit = 0; if (Main.stackSplit > 0) { --Main.stackSplit; if (Main.stackSplit == 0) Main.preventStackSplitReset = false; } TimeLogger.RenderTime(Main.renderCount, stopwatch1.Elapsed.TotalMilliseconds); TimeLogger.EndDrawFrame(); } } } } private static void DoDraw_UpdateCameraPosition() { Vector3 vector3 = Vector3.One / new Vector3(1f, 1f, 1f); if ((Main.gameMenu ? 0 : (Main.netMode != 2 ? 1 : 0)) == 0) return; int num1 = 21; if ((double) Main.cameraX != 0.0 && !Main.player[Main.myPlayer].pulley) Main.cameraX = 0.0f; if ((double) Main.cameraX > 0.0) { --Main.cameraX; if ((double) Main.cameraX < 0.0) Main.cameraX = 0.0f; } if ((double) Main.cameraX < 0.0) { ++Main.cameraX; if ((double) Main.cameraX > 0.0) Main.cameraX = 0.0f; } Vector2 screenPosition = Main.screenPosition; Main.screenPosition.X = (float) ((double) Main.player[Main.myPlayer].position.X + (double) Main.player[Main.myPlayer].width * 0.5 - (double) Main.screenWidth * 0.5 * (double) vector3.X) + Main.cameraX; Main.screenPosition.Y = (float) ((double) Main.player[Main.myPlayer].position.Y + (double) Main.player[Main.myPlayer].height - (double) num1 - (double) Main.screenHeight * 0.5 * (double) vector3.Y) + Main.player[Main.myPlayer].gfxOffY; Vector2 vector2_1 = Vector2.Zero; float num2 = 0.0f; float num3 = 0.0f; float max = 36f; bool flag = false; if ((Main.player[Main.myPlayer].noThrow <= 0 && !Main.player[Main.myPlayer].lastMouseInterface || !(Main.CurrentPan == Vector2.Zero)) && !Main.player[Main.myPlayer].dead) { if (Main.LocalGolfState != null && (Main.LocalGolfState.ShouldCameraTrackBallLastKnownLocation || Main.LocalGolfState.IsTrackingBall)) { if (Main.LocalGolfState.IsTrackingBall) { Projectile lastHitBall = Main.LocalGolfState.GetLastHitBall(); Vector2 vector2_2 = lastHitBall.Center - Main.LocalPlayer.Center; if ((double) lastHitBall.velocity.Length() > 20.0) max *= 2f; vector2_1 = Main.CurrentPan * 0.87f + vector2_2 * 0.13f; flag = true; } else if (Main.LocalGolfState.ShouldCameraTrackBallLastKnownLocation) { Vector2? lastBallLocation = Main.LocalGolfState.GetLastBallLocation(); if (lastBallLocation.HasValue) { Vector2 vector2_3 = lastBallLocation.Value - Main.LocalPlayer.Center; vector2_1 = Main.CurrentPan * 0.87f + vector2_3 * 0.13f; flag = true; } } } else if (PlayerInput.UsingGamepad) { Player player = Main.player[Main.myPlayer]; if ((double) PlayerInput.GamepadThumbstickRight.Length() != 0.0 || !Main.SmartCursorEnabled) { float num4 = -1f; if (player.inventory[player.selectedItem].type == 1254 && player.scope) num4 = 0.8f; else if (player.inventory[player.selectedItem].type == 1254) num4 = 0.6666667f; else if (player.inventory[player.selectedItem].type == 1299) num4 = 0.6666667f; else if (player.scope) num4 = 0.5f; Vector2 vector2_4 = (Main.MouseScreen - new Vector2((float) Main.screenWidth, (float) Main.screenHeight) / 2f) / (new Vector2((float) Main.screenWidth, (float) Main.screenHeight) / 2f); max = 48f; if (vector2_4 != Vector2.Zero && (double) num4 != -1.0) { Vector2 vector2_5 = new Vector2((float) Main.screenWidth, (float) Main.screenHeight) * 0.5f * vector2_4 * num4; vector2_1.X = vector2_5.X; vector2_1.Y = vector2_5.Y; flag = true; } } } else if (Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type == 1254 && Main.player[Main.myPlayer].scope && Main.mouseRight) { int num5 = Main.mouseX; int num6 = Main.mouseY; if (num5 > Main.screenWidth) num5 = Main.screenWidth; if (num5 < 0) num5 = 0; if (num6 > Main.screenHeight) num6 = Main.screenHeight; if (num6 < 0) num6 = 0; vector2_1.X = (float) (num5 - Main.screenWidth / 2) / 1.25f; vector2_1.Y = (float) (num6 - Main.screenHeight / 2) / 1.25f; flag = true; } else if (Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type == 1254 && Main.mouseRight) { int num7 = Main.mouseX; int num8 = Main.mouseY; if (num7 > Main.screenWidth) num7 = Main.screenWidth; if (num7 < 0) num7 = 0; if (num8 > Main.screenHeight) num8 = Main.screenHeight; if (num8 < 0) num8 = 0; vector2_1.X = (float) (num7 - Main.screenWidth / 2) / 1.5f; vector2_1.Y = (float) (num8 - Main.screenHeight / 2) / 1.5f; flag = true; } else if (Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type == 1299 && Main.player[Main.myPlayer].selectedItem != 58) { int num9 = Main.mouseX; int num10 = Main.mouseY; if (num9 > Main.screenWidth) num9 = Main.screenWidth; if (num9 < 0) num9 = 0; if (num10 > Main.screenHeight) num10 = Main.screenHeight; if (num10 < 0) num10 = 0; vector2_1.X = (float) (num9 - Main.screenWidth / 2) / 1.5f; vector2_1.Y = (float) (num10 - Main.screenHeight / 2) / 1.5f; flag = true; } else if (Main.player[Main.myPlayer].scope && Main.mouseRight) { int num11 = Main.mouseX; int num12 = Main.mouseY; if (num11 > Main.screenWidth) num11 = Main.screenWidth; if (num11 < 0) num11 = 0; if (num12 > Main.screenHeight) num12 = Main.screenHeight; if (num12 < 0) num12 = 0; vector2_1.X = (float) (num11 - Main.screenWidth / 2) / 2f; vector2_1.Y = (float) (num12 - Main.screenHeight / 2) / 2f; flag = true; } } if (float.IsNaN(Main.CurrentPan.X)) Main.CurrentPan.X = 0.0f; if (float.IsNaN(Main.CurrentPan.Y)) Main.CurrentPan.Y = 0.0f; Vector2 vector2_6 = vector2_1 - Main.CurrentPan; float num13 = vector2_6.Length(); float amount = 1f; if ((double) num3 > (double) num2 + 9.99999974737875E-05) amount = MathHelper.Clamp((float) (((double) num13 - (double) num2) / ((double) num3 - (double) num2)), 0.0f, 1f); float num14 = MathHelper.Clamp(MathHelper.SmoothStep(0.0f, num13, amount), 0.0f, max); if (vector2_1 == Vector2.Zero && !flag) { if ((double) Math.Abs(vector2_6.X) >= (double) (Main.screenWidth / 2) || (double) Math.Abs(vector2_6.Y) >= (double) (Main.screenHeight / 2)) { Main.renderNow = true; Main.CurrentPan *= 0.9f; } else if ((double) num14 > 9.99999974737875E-05) Main.CurrentPan += Vector2.Normalize(vector2_6) * num14; } else if ((double) num14 > 9.99999974737875E-05) Main.CurrentPan += Vector2.Normalize(vector2_6) * num14; Main.screenPosition.X += Main.CurrentPan.X; Main.screenPosition.Y += Main.CurrentPan.Y * Main.player[Main.myPlayer].gravDir; if ((double) Main.cameraLerp > 0.0) { if ((double) Vector2.Distance(screenPosition, Main.screenPosition) - (double) Main.player[Main.myPlayer].velocity.Length() < 0.25 || Main.cameraGamePadLerp && !PlayerInput.UsingGamepad) { Main.cameraLerp = 0.0f; Main.cameraGamePadLerp = false; } else Main.screenPosition = Vector2.Lerp(screenPosition, Main.screenPosition, Main.cameraLerp); } Main.screenPosition.X = (float) (int) Main.screenPosition.X; Main.screenPosition.Y = (float) (int) Main.screenPosition.Y; Main.ClampScreenPositionToWorld(); } private void DrawSunAndMoon( Main.SceneArea sceneArea, Microsoft.Xna.Framework.Color moonColor, Microsoft.Xna.Framework.Color sunColor, float tempMushroomInfluence) { Texture2D texture2D1 = TextureAssets.Sun.Value; int index = Main.moonType; if (!TextureAssets.Moon.IndexInRange>(index)) index = Utils.Clamp(index, 0, 8); Texture2D texture2D2 = TextureAssets.Moon[index].Value; int bgTopY = sceneArea.bgTopY; int num1 = (int) (Main.time / 54000.0 * ((double) sceneArea.totalWidth + (double) (texture2D1.Width * 2))) - texture2D1.Width; int num2 = 0; float num3 = 1f; float rotation1 = (float) (Main.time / 54000.0 * 2.0 - 7.30000019073486); int num4 = (int) (Main.time / 32400.0 * ((double) sceneArea.totalWidth + (double) (texture2D2.Width * 2))) - texture2D2.Width; int num5 = 0; float num6 = 1f; float rotation2 = (float) (Main.time / 32400.0 * 2.0 - 7.30000019073486); if (Main.dayTime) { double num7; if (Main.time < 27000.0) { num7 = Math.Pow(1.0 - Main.time / 54000.0 * 2.0, 2.0); num2 = (int) ((double) bgTopY + num7 * 250.0 + 180.0); } else { num7 = Math.Pow((Main.time / 54000.0 - 0.5) * 2.0, 2.0); num2 = (int) ((double) bgTopY + num7 * 250.0 + 180.0); } num3 = (float) (1.2 - num7 * 0.4); } else { double num8; if (Main.time < 16200.0) { num8 = Math.Pow(1.0 - Main.time / 32400.0 * 2.0, 2.0); num5 = (int) ((double) bgTopY + num8 * 250.0 + 180.0); } else { num8 = Math.Pow((Main.time / 32400.0 - 0.5) * 2.0, 2.0); num5 = (int) ((double) bgTopY + num8 * 250.0 + 180.0); } num6 = (float) (1.2 - num8 * 0.4); } float scale1 = num3 * Main.ForcedMinimumZoom; float scale2 = num6 * Main.ForcedMinimumZoom; if (Main.dayTime) { scale1 *= 1.1f; float num9 = 1f - tempMushroomInfluence - Main.cloudAlpha * 1.5f * Main.atmo; if ((double) num9 < 0.0) num9 = 0.0f; Microsoft.Xna.Framework.Color color1 = new Microsoft.Xna.Framework.Color((int) (byte) ((double) byte.MaxValue * (double) num9), (int) (byte) ((double) sunColor.G * (double) num9), (int) (byte) ((double) sunColor.B * (double) num9), (int) (byte) ((double) byte.MaxValue * (double) num9)); Microsoft.Xna.Framework.Color color2 = new Microsoft.Xna.Framework.Color((int) (byte) ((double) sunColor.R * (double) num9), (int) (byte) ((double) sunColor.G * (double) num9), (int) (byte) ((double) sunColor.B * (double) num9), (int) (byte) ((double) sunColor.B * (double) num9)); bool flag = false; if (Main.eclipse) { texture2D1 = TextureAssets.Sun3.Value; flag = true; } else if (!Main.gameMenu && Main.player[Main.myPlayer].head == 12) { texture2D1 = TextureAssets.Sun2.Value; flag = true; } if (flag) color2 = new Microsoft.Xna.Framework.Color((int) (byte) ((double) sunColor.R * (double) num9), (int) (byte) ((double) sunColor.G * (double) num9), (int) (byte) ((double) sunColor.B * (double) num9), (int) (byte) ((double) ((int) sunColor.B - 60) * (double) num9)); Vector2 origin = texture2D1.Size() / 2f; Vector2 position = new Vector2((float) num1, (float) (num2 + (int) Main.sunModY)) + sceneArea.SceneLocalScreenPositionOffset; Main.spriteBatch.Draw(texture2D1, position, new Microsoft.Xna.Framework.Rectangle?(), color1, rotation1, origin, scale1, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(texture2D1, position, new Microsoft.Xna.Framework.Rectangle?(), color2, rotation1, origin, scale1, SpriteEffects.None, 0.0f); } if (!Main.dayTime) { float num10 = (float) (1.0 - (double) Main.cloudAlpha * 1.5 * (double) Main.atmo); if ((double) num10 < 0.0) num10 = 0.0f; moonColor *= num10; Vector2 position = new Vector2((float) num4, (float) (num5 + (int) Main.moonModY)) + sceneArea.SceneLocalScreenPositionOffset; if (WorldGen.drunkWorldGen) Main.spriteBatch.Draw(TextureAssets.SmileyMoon.Value, position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, TextureAssets.SmileyMoon.Width(), TextureAssets.SmileyMoon.Height())), moonColor, (float) ((double) rotation2 / 2.0 + 3.14159274101257), new Vector2((float) (TextureAssets.SmileyMoon.Width() / 2), (float) (TextureAssets.SmileyMoon.Width() / 2)), scale2, SpriteEffects.None, 0.0f); else if (Main.pumpkinMoon) Main.spriteBatch.Draw(TextureAssets.PumpkinMoon.Value, position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, TextureAssets.PumpkinMoon.Width() * Main.moonPhase, TextureAssets.PumpkinMoon.Width(), TextureAssets.PumpkinMoon.Width())), moonColor, rotation2, new Vector2((float) (TextureAssets.PumpkinMoon.Width() / 2), (float) (TextureAssets.PumpkinMoon.Width() / 2)), scale2, SpriteEffects.None, 0.0f); else if (Main.snowMoon) Main.spriteBatch.Draw(TextureAssets.SnowMoon.Value, position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, TextureAssets.SnowMoon.Width() * Main.moonPhase, TextureAssets.SnowMoon.Width(), TextureAssets.SnowMoon.Width())), moonColor, rotation2, new Vector2((float) (TextureAssets.SnowMoon.Width() / 2), (float) (TextureAssets.SnowMoon.Width() / 2)), scale2, SpriteEffects.None, 0.0f); else Main.spriteBatch.Draw(TextureAssets.Moon[index].Value, position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, TextureAssets.Moon[index].Width() * Main.moonPhase, TextureAssets.Moon[index].Width(), TextureAssets.Moon[index].Width())), moonColor, rotation2, new Vector2((float) (TextureAssets.Moon[index].Width() / 2), (float) (TextureAssets.Moon[index].Width() / 2)), scale2, SpriteEffects.None, 0.0f); } Microsoft.Xna.Framework.Rectangle rectangle1 = !Main.dayTime ? new Microsoft.Xna.Framework.Rectangle((int) ((double) num4 - (double) TextureAssets.Moon[index].Width() * 0.5 * (double) scale2), (int) ((double) num5 - (double) TextureAssets.Moon[index].Width() * 0.5 * (double) scale2 + (double) Main.moonModY), (int) ((double) TextureAssets.Moon[index].Width() * (double) scale2), (int) ((double) TextureAssets.Moon[index].Width() * (double) scale2)) : new Microsoft.Xna.Framework.Rectangle((int) ((double) num1 - (double) TextureAssets.Sun.Width() * 0.5 * (double) scale1), (int) ((double) num2 - (double) TextureAssets.Sun.Height() * 0.5 * (double) scale1 + (double) Main.sunModY), (int) ((double) TextureAssets.Sun.Width() * (double) scale1), (int) ((double) TextureAssets.Sun.Width() * (double) scale1)); rectangle1.Offset((int) sceneArea.SceneLocalScreenPositionOffset.X, (int) sceneArea.SceneLocalScreenPositionOffset.Y); Microsoft.Xna.Framework.Rectangle rectangle2 = new Microsoft.Xna.Framework.Rectangle(Main.mouseX, Main.mouseY, 1, 1); Main.sunModY = (short) ((double) Main.sunModY * 0.999); Main.moonModY = (short) ((double) Main.moonModY * 0.999); if ((!Main.gameMenu ? 0 : (Main.netMode != 1 ? 1 : 0)) == 0) return; if (rectangle2.Intersects(rectangle1) || Main.alreadyGrabbingSunOrMoon) Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeft && Main.hasFocus) { if (!rectangle2.Intersects(rectangle1) && !Main.alreadyGrabbingSunOrMoon) return; if (Main.dayTime) { Main.time = 54000.0 * ((double) (Main.mouseX + TextureAssets.Sun.Width()) / ((double) Main.screenWidth + (double) (TextureAssets.Sun.Width() * 2))); Main.sunModY = (short) (Main.mouseY - num2); if (Main.time > 53990.0) Main.time = 53990.0; } else { Main.time = 32400.0 * ((double) (Main.mouseX + TextureAssets.Moon[index].Width()) / ((double) Main.screenWidth + (double) (TextureAssets.Moon[index].Width() * 2))); Main.moonModY = (short) (Main.mouseY - num5); if (Main.time > 32390.0) Main.time = 32390.0; } if (Main.time < 10.0) Main.time = 10.0; Main.alreadyGrabbingSunOrMoon = true; } else Main.alreadyGrabbingSunOrMoon = false; } private void DrawStarsInBackground(Main.SceneArea sceneArea) { if (Main.netMode == 2 || (double) Main.screenPosition.Y >= Main.worldSurface * 16.0 + 16.0) return; float num1 = 1f; if ((double) Main.GraveyardVisualIntensity > 0.0) { float num2 = (float) (1.0 - (double) Main.GraveyardVisualIntensity * 1.39999997615814); if ((double) num2 <= 0.0) return; num1 *= num2; } Microsoft.Xna.Framework.Color colorOfTheSkies = Main.ColorOfTheSkies; if ((double) byte.MaxValue * (1.0 - (double) Main.cloudAlpha * (double) Main.atmo) - (double) colorOfTheSkies.R - 25.0 <= 0.0) return; for (int index1 = 0; index1 < Main.numStars; ++index1) { Star star = Main.star[index1]; if (star != null && !star.hidden) { Microsoft.Xna.Framework.Color color1 = new Microsoft.Xna.Framework.Color(); float num3 = 1f - star.fadeIn; int num4 = (int) ((double) ((int) byte.MaxValue - (int) colorOfTheSkies.R - 100) * (double) star.twinkle * (double) num3); int num5 = (int) ((double) ((int) byte.MaxValue - (int) colorOfTheSkies.G - 100) * (double) star.twinkle * (double) num3); int num6 = (int) ((double) ((int) byte.MaxValue - (int) colorOfTheSkies.B - 100) * (double) star.twinkle * (double) num3); int num7 = (num4 + num6 + num5) / 3; if (num7 > 0) { int num8 = (int) ((double) num7 * 1.4); if (num8 > (int) byte.MaxValue) num8 = (int) byte.MaxValue; int num9 = num8; int num10 = num8; color1.R = (byte) num8; color1.G = (byte) num9; color1.B = (byte) num10; color1 *= num1; Vector2 position = new Vector2(star.position.X / 1920f, star.position.Y / 1200f) * new Vector2(sceneArea.totalWidth, sceneArea.totalHeight) + new Vector2(0.0f, (float) sceneArea.bgTopY) + sceneArea.SceneLocalScreenPositionOffset; Texture2D texture2D = TextureAssets.Star[star.type].Value; Vector2 origin = texture2D.Size() / 2f; if (star.falling) { star.fadeIn = 0.0f; int num11 = star.fallTime; float num12 = 30f; if ((double) num11 > (double) num12) num11 = (int) num12; for (int index2 = 1; index2 < num11; ++index2) { Vector2 vector2 = star.fallSpeed * (float) index2 * 0.4f; float num13 = star.scale * (float) (1.0 - (double) index2 * 1.0 / (double) num12); Microsoft.Xna.Framework.Color color2 = color1; double rotation = (double) star.rotation; Microsoft.Xna.Framework.Color color3 = color2 * (float) (1.0 - (double) index2 * 1.0 / (double) num12); Main.spriteBatch.Draw(texture2D, position - vector2, new Microsoft.Xna.Framework.Rectangle?(), color3, star.rotation, origin, num13 * star.twinkle * Main.ForcedMinimumZoom, SpriteEffects.None, 0.0f); } } Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(), color1, star.rotation, origin, star.scale * star.twinkle * Main.ForcedMinimumZoom, SpriteEffects.None, 0.0f); } } } } private static void ApplyColorOfTheSkiesToTiles() { Microsoft.Xna.Framework.Color colorOfTheSkies = Main.ColorOfTheSkies; Main.tileColor.A = byte.MaxValue; Main.tileColor.R = (byte) (((int) colorOfTheSkies.R + (int) colorOfTheSkies.G + (int) colorOfTheSkies.B + (int) colorOfTheSkies.R * 7) / 10); Main.tileColor.G = (byte) (((int) colorOfTheSkies.R + (int) colorOfTheSkies.G + (int) colorOfTheSkies.B + (int) colorOfTheSkies.G * 7) / 10); Main.tileColor.B = (byte) (((int) colorOfTheSkies.R + (int) colorOfTheSkies.G + (int) colorOfTheSkies.B + (int) colorOfTheSkies.B * 7) / 10); Main.tileColor = SkyManager.Instance.ProcessTileColor(Main.tileColor); } private static void UpdateAtmosphereTransparencyToSkyColor() { float num1 = (float) (Main.maxTilesX / 4200); float num2 = num1 * num1; Main.atmo = (float) ((((double) Main.screenPosition.Y + (double) (Main.screenHeight / 2)) / 16.0 - (65.0 + 10.0 * (double) num2)) / (Main.worldSurface / 5.0)); if ((double) Main.atmo < 0.0) Main.atmo = 0.0f; if ((double) Main.atmo > 1.0) Main.atmo = 1f; if (Main.gameMenu || Main.netMode == 2) Main.atmo = 1f; Microsoft.Xna.Framework.Color color = Main.ColorOfTheSkies; color.R = (byte) ((double) color.R * (double) Main.atmo); color.G = (byte) ((double) color.G * (double) Main.atmo); color.B = (byte) ((double) color.B * (double) Main.atmo); if ((double) Main.atmo <= 0.01) color = Microsoft.Xna.Framework.Color.Transparent; Main.ColorOfTheSkies = color; } private void Debug_PrettifyMap() { } private static void DrawNetplayStatusText() { if (Main.netMode != 1 || string.IsNullOrWhiteSpace(Netplay.Connection.StatusText)) return; string text = Netplay.Connection.StatusText; if (!Netplay.Connection.HideStatusTextPercent) text = text + ": " + (object) (int) ((double) Netplay.Connection.StatusCount / (double) Netplay.Connection.StatusMax * 100.0) + "%"; if (Main._netplayStatusTextSnippets == null || Main._oldNetplayStatusText != text) { Main._netplayStatusTextSnippets = ChatManager.ParseMessage(text, Microsoft.Xna.Framework.Color.White).ToArray(); Main._oldNetplayStatusText = text; } Vector2 position = new Vector2((float) (628.0 - (double) ChatManager.GetStringSize(FontAssets.MouseText.Value, Main._netplayStatusTextSnippets, Vector2.One).X * 0.5) + (float) (Main.screenWidth - 800), 84f); int hoveredSnippet; if (Netplay.Connection.StatusTextHasShadows) ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, FontAssets.MouseText.Value, Main._netplayStatusTextSnippets, position, 0.0f, Vector2.Zero, Vector2.One, out hoveredSnippet); else ChatManager.DrawColorCodedString(Main.spriteBatch, FontAssets.MouseText.Value, Main._netplayStatusTextSnippets, position, new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor), 0.0f, Vector2.Zero, Vector2.One, out hoveredSnippet, -1f); } private void DrawPlayerChatBubbles() { for (int index = 0; index < (int) byte.MaxValue; ++index) { if (Main.player[index].active && Main.player[index].chatOverhead.timeLeft > 0 && !Main.player[index].dead) { Vector2 messageSize = Main.player[index].chatOverhead.messageSize; Vector2 screenPosition = Main.player[index].Top.ToScreenPosition(); screenPosition.Y -= messageSize.Y + 2f; if ((double) Main.player[Main.myPlayer].gravDir == -1.0) screenPosition.Y += 2f; screenPosition.X -= messageSize.X / 2f; screenPosition.Y += Main.player[index].gfxOffY; Vector2 position = screenPosition.Floor(); int hoveredSnippet = 0; ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, FontAssets.MouseText.Value, Main.player[index].chatOverhead.snippets, position, 0.0f, Main.player[index].chatOverhead.color, Vector2.Zero, Vector2.One, out hoveredSnippet); } } } private void DrawRainInMenu() { bool isActive = this.IsActive; Microsoft.Xna.Framework.Rectangle[] rectangleArray = new Microsoft.Xna.Framework.Rectangle[6]; for (int index = 0; index < rectangleArray.Length; ++index) rectangleArray[index] = new Microsoft.Xna.Framework.Rectangle(index * 4, 0, 2, 40); Microsoft.Xna.Framework.Color color = Main.ColorOfTheSkies * 0.85f; for (int index = 0; index < Main.maxRain; ++index) { if (Main.rain[index].active) { Rain rain = Main.rain[index]; Main.spriteBatch.Draw(TextureAssets.Rain.Value, rain.position - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangleArray[(int) rain.type]), color, rain.rotation, Vector2.Zero, rain.scale, SpriteEffects.None, 0.0f); if (isActive) rain.Update(); } } } private void DoDraw_WallsTilesNPCs() { try { this.CacheNPCDraws(); this.CacheProjDraws(); this.DrawCachedNPCs(this.DrawCacheNPCsMoonMoon, true); this.DoDraw_WallsAndBlacks(); this.DrawWoF(); this.DrawBackGore(); MoonlordDeathDrama.DrawPieces(Main.spriteBatch); MoonlordDeathDrama.DrawExplosions(Main.spriteBatch); this.DrawCachedNPCs(this.DrawCacheNPCsBehindNonSolidTiles, true); this.DoDraw_Tiles_NonSolid(); this.DoDraw_Waterfalls(); } catch (Exception ex) { TimeLogger.DrawException(ex); } Main.spriteBatch.End(); try { int num = Main.player[Main.myPlayer].detectCreature ? 1 : 0; if (num == 0) this.DoDraw_DrawNPCsBehindTiles(); this.DoDraw_Tiles_Solid(); if (num != 0) this.DoDraw_DrawNPCsBehindTiles(); this.DrawPlayers_BehindNPCs(); this.DoDraw_DrawNPCsOverTiles(); TimeLogger.DetailedDrawReset(); } catch (Exception ex) { TimeLogger.DrawException(ex); } Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, (Effect) null, Main.Transform); } private void DoDraw_Waterfalls() { this.waterfallManager.Draw(Main.spriteBatch); TimeLogger.DetailedDrawTime(16); } private void DoDraw_Tiles_Solid() { this.TilesRenderer.PreDrawTiles(true, !Main.drawToScreen, false); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, (Effect) null, Main.Transform); try { if (Main.drawToScreen) { this.DrawTiles(true, !Main.drawToScreen, false); } else { Main.spriteBatch.Draw((Texture2D) this.tileTarget, Main.sceneTilePos - Main.screenPosition, Microsoft.Xna.Framework.Color.White); TimeLogger.DetailedDrawTime(17); } } catch (Exception ex) { TimeLogger.DrawException(ex); } Main.spriteBatch.End(); this.DrawTileEntities(true, !Main.drawToScreen, false); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, (Effect) null, Main.Transform); try { Main.player[Main.myPlayer].hitReplace.DrawFreshAnimations(Main.spriteBatch); Main.player[Main.myPlayer].hitTile.DrawFreshAnimations(Main.spriteBatch); } catch (Exception ex) { TimeLogger.DrawException(ex); } Main.spriteBatch.End(); } private void DoDraw_Tiles_NonSolid() { this.TilesRenderer.PreDrawTiles(false, !Main.drawToScreen, false); if (Main.drawToScreen) { this.DrawTiles(false, !Main.drawToScreen, false); TimeLogger.DetailedDrawReset(); } else { Main.spriteBatch.Draw((Texture2D) this.tile2Target, Main.sceneTile2Pos - Main.screenPosition, Microsoft.Xna.Framework.Color.White); TimeLogger.DetailedDrawTime(15); } Main.spriteBatch.End(); try { this.DrawTileEntities(false, !Main.drawToScreen, false); } catch (Exception ex) { TimeLogger.DrawException(ex); } Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, (Effect) null, Main.Transform); } private void DoDraw_DrawNPCsOverTiles() { this.DrawCachedProjs(this.DrawCacheProjsBehindNPCs); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, (Effect) null, Main.Transform); try { this.DrawNPCs(); this.DrawCachedNPCs(this.DrawCacheNPCProjectiles, false); TimeLogger.DetailedDrawTime(19); } catch (Exception ex) { TimeLogger.DrawException(ex); } Main.spriteBatch.End(); } private void DoDraw_DrawNPCsBehindTiles() { this.DrawCachedProjs(this.DrawCacheProjsBehindNPCsAndTiles); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, Main.Rasterizer, (Effect) null, Main.Transform); try { this.DrawNPCs(true); TimeLogger.DetailedDrawTime(18); } catch (Exception ex) { TimeLogger.DrawException(ex); } Main.spriteBatch.End(); } private void DrawBackGore() { if (!Main.drawBackGore) return; Main.drawBackGore = false; if (Main.ignoreErrors) { try { this.DrawGoreBehind(); } catch (Exception ex) { TimeLogger.DrawException(ex); } } else this.DrawGoreBehind(); } private void DoDraw_WallsAndBlacks() { if (Main.drawToScreen) { this.DrawBlack(); Main.tileBatch.Begin(); this.DrawWalls(); Main.tileBatch.End(); } else { Main.spriteBatch.Draw((Texture2D) this.blackTarget, Main.sceneTilePos - Main.screenPosition, Microsoft.Xna.Framework.Color.White); TimeLogger.DetailedDrawTime(13); Main.spriteBatch.Draw((Texture2D) this.wallTarget, Main.sceneWallPos - Main.screenPosition, Microsoft.Xna.Framework.Color.White); TimeLogger.DetailedDrawTime(14); } Overlays.Scene.Draw(Main.spriteBatch, RenderLayers.Walls); } private static void SetBackColor( Main.InfoToSetBackColor info, out Microsoft.Xna.Framework.Color sunColor, out Microsoft.Xna.Framework.Color moonColor) { double time = Main.time; Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; sunColor = Microsoft.Xna.Framework.Color.White; moonColor = Microsoft.Xna.Framework.Color.White; int num1 = info.isInGameMenuOrIsServer ? 1 : 0; if (Main.dayTime) { if (time < 13500.0) { float num2 = (float) (time / 13500.0); sunColor.R = (byte) ((double) num2 * 200.0 + 55.0); sunColor.G = (byte) ((double) num2 * 180.0 + 75.0); sunColor.B = (byte) ((double) num2 * 250.0 + 5.0); white.R = (byte) ((double) num2 * 230.0 + 25.0); white.G = (byte) ((double) num2 * 220.0 + 35.0); white.B = (byte) ((double) num2 * 220.0 + 35.0); } if (time > 45900.0) { float num3 = (float) (1.0 - (time / 54000.0 - 0.85) * (20.0 / 3.0)); sunColor.R = (byte) ((double) num3 * 120.0 + 55.0); sunColor.G = (byte) ((double) num3 * 100.0 + 25.0); sunColor.B = (byte) ((double) num3 * 120.0 + 55.0); white.R = (byte) ((double) num3 * 200.0 + 35.0); white.G = (byte) ((double) num3 * 85.0 + 35.0); white.B = (byte) ((double) num3 * 135.0 + 35.0); } else if (time > 37800.0) { float num4 = (float) (1.0 - (time / 54000.0 - 0.7) * (20.0 / 3.0)); sunColor.R = (byte) ((double) num4 * 80.0 + 175.0); sunColor.G = (byte) ((double) num4 * 130.0 + 125.0); sunColor.B = (byte) ((double) num4 * 100.0 + 155.0); white.R = (byte) ((double) num4 * 20.0 + 235.0); white.G = (byte) ((double) num4 * 135.0 + 120.0); white.B = (byte) ((double) num4 * 85.0 + 170.0); } } if (!Main.dayTime) { if (info.BloodMoonActive) { if (time < 16200.0) { float num5 = (float) (1.0 - time / 16200.0); moonColor.R = (byte) ((double) num5 * 10.0 + 205.0); moonColor.G = (byte) ((double) num5 * 170.0 + 55.0); moonColor.B = (byte) ((double) num5 * 200.0 + 55.0); white.R = (byte) (40.0 - (double) num5 * 40.0 + 35.0); white.G = (byte) ((double) num5 * 20.0 + 15.0); white.B = (byte) ((double) num5 * 20.0 + 15.0); } else if (time >= 16200.0) { float num6 = (float) ((time / 32400.0 - 0.5) * 2.0); moonColor.R = (byte) ((double) num6 * 50.0 + 205.0); moonColor.G = (byte) ((double) num6 * 100.0 + 155.0); moonColor.B = (byte) ((double) num6 * 100.0 + 155.0); moonColor.R = (byte) ((double) num6 * 10.0 + 205.0); moonColor.G = (byte) ((double) num6 * 170.0 + 55.0); moonColor.B = (byte) ((double) num6 * 200.0 + 55.0); white.R = (byte) (40.0 - (double) num6 * 40.0 + 35.0); white.G = (byte) ((double) num6 * 20.0 + 15.0); white.B = (byte) ((double) num6 * 20.0 + 15.0); } } else if (time < 16200.0) { float num7 = (float) (1.0 - time / 16200.0); moonColor.R = (byte) ((double) num7 * 10.0 + 205.0); moonColor.G = (byte) ((double) num7 * 70.0 + 155.0); moonColor.B = (byte) ((double) num7 * 100.0 + 155.0); white.R = (byte) ((double) num7 * 30.0 + 5.0); white.G = (byte) ((double) num7 * 30.0 + 5.0); white.B = (byte) ((double) num7 * 30.0 + 5.0); } else if (time >= 16200.0) { float num8 = (float) ((time / 32400.0 - 0.5) * 2.0); moonColor.R = (byte) ((double) num8 * 50.0 + 205.0); moonColor.G = (byte) ((double) num8 * 100.0 + 155.0); moonColor.B = (byte) ((double) num8 * 100.0 + 155.0); white.R = (byte) ((double) num8 * 20.0 + 5.0); white.G = (byte) ((double) num8 * 30.0 + 5.0); white.B = (byte) ((double) num8 * 30.0 + 5.0); } } if ((double) Main.cloudAlpha > 0.0) { float num9 = (float) (1.0 - (double) Main.cloudAlpha * 0.899999976158142 * (double) Main.atmo); white.R = (byte) ((double) white.R * (double) num9); white.G = (byte) ((double) white.G * (double) num9); white.B = (byte) ((double) white.B * (double) num9); } if ((double) info.GraveyardInfluence > 0.0) { float num10 = (float) (1.0 - (double) info.GraveyardInfluence * 0.600000023841858); white.R = (byte) ((double) white.R * (double) num10); white.G = (byte) ((double) white.G * (double) num10); white.B = (byte) ((double) white.B * (double) num10); } if (num1 != 0 && !Main.dayTime) { white.R = (byte) 35; white.G = (byte) 35; white.B = (byte) 35; } if ((double) info.CorruptionBiomeInfluence > 0.0) { float num11 = info.CorruptionBiomeInfluence; if ((double) num11 > 1.0) num11 = 1f; int r1 = (int) white.R; int g1 = (int) white.G; int b1 = (int) white.B; int num12 = r1 - (int) (90.0 * (double) num11 * ((double) white.R / (double) byte.MaxValue)); int num13 = g1 - (int) (140.0 * (double) num11 * ((double) white.G / (double) byte.MaxValue)); int num14 = b1 - (int) (70.0 * (double) num11 * ((double) white.B / (double) byte.MaxValue)); if (num12 < 15) num12 = 15; if (num13 < 15) num13 = 15; if (num14 < 15) num14 = 15; white.R = (byte) num12; white.G = (byte) num13; white.B = (byte) num14; int r2 = (int) sunColor.R; int g2 = (int) sunColor.G; int b2 = (int) sunColor.B; int num15 = r2 - (int) (100.0 * (double) num11 * ((double) sunColor.R / (double) byte.MaxValue)); int num16 = g2 - (int) (100.0 * (double) num11 * ((double) sunColor.G / (double) byte.MaxValue)); int num17 = b2 - (int) (0.0 * (double) num11 * ((double) sunColor.B / (double) byte.MaxValue)); if (num15 < 15) num15 = 15; if (num16 < 15) num16 = 15; if (num17 < 15) num17 = 15; sunColor.R = (byte) num15; sunColor.G = (byte) num16; sunColor.B = (byte) num17; } if ((double) info.CrimsonBiomeInfluence > 0.0) { float num18 = info.CrimsonBiomeInfluence; if ((double) num18 > 1.0) num18 = 1f; int r = (int) white.R; int g3 = (int) white.G; int b3 = (int) white.B; int num19 = r - (int) (40.0 * (double) num18 * ((double) white.G / (double) byte.MaxValue)); int num20 = g3 - (int) (110.0 * (double) num18 * ((double) white.G / (double) byte.MaxValue)); int num21 = b3 - (int) (140.0 * (double) num18 * ((double) white.B / (double) byte.MaxValue)); if (num19 < 15) num19 = 15; if (num20 < 15) num20 = 15; if (num21 < 15) num21 = 15; white.R = (byte) num19; white.G = (byte) num20; white.B = (byte) num21; int num22 = (int) sunColor.R; int g4 = (int) sunColor.G; int b4 = (int) sunColor.B; int num23 = g4 - (int) (90.0 * (double) num18 * ((double) sunColor.G / (double) byte.MaxValue)); int num24 = b4 - (int) (110.0 * (double) num18 * ((double) sunColor.B / (double) byte.MaxValue)); if (num22 < 15) num22 = 15; if (num23 < 15) num23 = 15; if (num24 < 15) num24 = 15; sunColor.R = (byte) num22; sunColor.G = (byte) num23; sunColor.B = (byte) num24; } if ((double) info.JungleBiomeInfluence > 0.0) { float num25 = info.JungleBiomeInfluence; if ((double) num25 > 1.0) num25 = 1f; int r3 = (int) white.R; int num26 = (int) white.G; int b5 = (int) white.B; int num27 = r3 - (int) (40.0 * (double) num25 * ((double) white.R / (double) byte.MaxValue)); int num28 = b5 - (int) (70.0 * (double) num25 * ((double) white.B / (double) byte.MaxValue)); if (num26 > (int) byte.MaxValue) num26 = (int) byte.MaxValue; if (num26 < 15) num26 = 15; if (num27 > (int) byte.MaxValue) num27 = (int) byte.MaxValue; if (num27 < 15) num27 = 15; if (num28 < 15) num28 = 15; white.R = (byte) num27; white.G = (byte) num26; white.B = (byte) num28; int r4 = (int) sunColor.R; int num29 = (int) sunColor.G; int b6 = (int) sunColor.B; int num30 = r4 - (int) (30.0 * (double) num25 * ((double) sunColor.R / (double) byte.MaxValue)); int num31 = b6 - (int) (10.0 * (double) num25 * ((double) sunColor.B / (double) byte.MaxValue)); if (num30 < 15) num30 = 15; if (num29 < 15) num29 = 15; if (num31 < 15) num31 = 15; sunColor.R = (byte) num30; sunColor.G = (byte) num29; sunColor.B = (byte) num31; } if ((double) info.MushroomBiomeInfluence > 0.0) { float mushroomBiomeInfluence = info.MushroomBiomeInfluence; int r5 = (int) white.R; int g5 = (int) white.G; int b7 = (int) white.B; int num32 = g5 - (int) (250.0 * (double) mushroomBiomeInfluence * ((double) white.G / (double) byte.MaxValue)); int num33 = r5 - (int) (250.0 * (double) mushroomBiomeInfluence * ((double) white.R / (double) byte.MaxValue)); int num34 = b7 - (int) (250.0 * (double) mushroomBiomeInfluence * ((double) white.B / (double) byte.MaxValue)); if (num32 < 15) num32 = 15; if (num33 < 15) num33 = 15; if (num34 < 15) num34 = 15; white.R = (byte) num33; white.G = (byte) num32; white.B = (byte) num34; int r6 = (int) sunColor.R; int g6 = (int) sunColor.G; int b8 = (int) sunColor.B; int num35 = g6 - (int) (10.0 * (double) mushroomBiomeInfluence * ((double) sunColor.G / (double) byte.MaxValue)); int num36 = r6 - (int) (30.0 * (double) mushroomBiomeInfluence * ((double) sunColor.R / (double) byte.MaxValue)); int num37 = b8 - (int) (10.0 * (double) mushroomBiomeInfluence * ((double) sunColor.B / (double) byte.MaxValue)); if (num36 < 15) num36 = 15; if (num35 < 15) num35 = 15; if (num37 < 15) num37 = 15; sunColor.R = (byte) num36; sunColor.G = (byte) num35; sunColor.B = (byte) num37; int r7 = (int) moonColor.R; int g7 = (int) moonColor.G; int b9 = (int) moonColor.B; int num38 = g7 - (int) (140.0 * (double) mushroomBiomeInfluence * ((double) moonColor.R / (double) byte.MaxValue)); int num39 = r7 - (int) (170.0 * (double) mushroomBiomeInfluence * ((double) moonColor.G / (double) byte.MaxValue)); int num40 = b9 - (int) (190.0 * (double) mushroomBiomeInfluence * ((double) moonColor.B / (double) byte.MaxValue)); if (num39 < 15) num39 = 15; if (num38 < 15) num38 = 15; if (num40 < 15) num40 = 15; moonColor.R = (byte) num39; moonColor.G = (byte) num38; moonColor.B = (byte) num40; } byte num41 = 15; switch (Main.GetMoonPhase()) { case MoonPhase.Full: num41 = (byte) 19; break; case MoonPhase.ThreeQuartersAtLeft: case MoonPhase.ThreeQuartersAtRight: num41 = (byte) 17; break; case MoonPhase.HalfAtLeft: case MoonPhase.HalfAtRight: num41 = (byte) 15; break; case MoonPhase.QuarterAtLeft: case MoonPhase.QuarterAtRight: num41 = (byte) 13; break; case MoonPhase.Empty: num41 = (byte) 11; break; } if ((int) white.R < (int) num41) white.R = num41; if ((int) white.G < (int) num41) white.G = num41; if ((int) white.B < (int) num41) white.B = num41; if (info.BloodMoonActive) { if (white.R < (byte) 25) white.R = (byte) 25; if (white.G < (byte) 25) white.G = (byte) 25; if (white.B < (byte) 25) white.B = (byte) 25; } if (Main.eclipse && Main.dayTime) { float num42 = 1242f; Main.eclipseLight = (float) time / num42; if ((double) Main.eclipseLight > 1.0) Main.eclipseLight = 1f; } else if ((double) Main.eclipseLight > 0.0) { Main.eclipseLight -= 0.01f; if ((double) Main.eclipseLight < 0.0) Main.eclipseLight = 0.0f; } if ((double) Main.eclipseLight > 0.0) { float num43 = (float) (1.0 - 0.925000011920929 * (double) Main.eclipseLight); float num44 = (float) (1.0 - 0.959999978542328 * (double) Main.eclipseLight); float num45 = (float) (1.0 - 1.0 * (double) Main.eclipseLight); int num46 = (int) ((double) white.R * (double) num43); int num47 = (int) ((double) white.G * (double) num44); int num48 = (int) ((double) white.B * (double) num45); white.R = (byte) num46; white.G = (byte) num47; white.B = (byte) num48; sunColor.R = byte.MaxValue; sunColor.G = (byte) 127; sunColor.B = (byte) 67; if (white.R < (byte) 20) white.R = (byte) 20; if (white.G < (byte) 10) white.G = (byte) 10; if (!Lighting.NotRetro) { if (white.R < (byte) 20) white.R = (byte) 20; if (white.G < (byte) 14) white.G = (byte) 14; if (white.B < (byte) 6) white.B = (byte) 6; } } if ((double) Main.lightning > 0.0) { float num49 = (float) white.R / (float) byte.MaxValue; float num50 = (float) white.G / (float) byte.MaxValue; float num51 = (float) white.B / (float) byte.MaxValue; float num52 = MathHelper.Lerp(num49, 1f, Main.lightning); float num53 = MathHelper.Lerp(num50, 1f, Main.lightning); float num54 = MathHelper.Lerp(num51, 1f, Main.lightning); white.R = (byte) ((double) num52 * (double) byte.MaxValue); white.G = (byte) ((double) num53 * (double) byte.MaxValue); white.B = (byte) ((double) num54 * (double) byte.MaxValue); } if (!info.BloodMoonActive) moonColor = Microsoft.Xna.Framework.Color.White; Main.ColorOfTheSkies = white; } private void DoLightTiles() { Vector2 vector2_1 = Main.Camera.ScaledPosition; Vector2 vector2_2 = Main.Camera.ScaledSize; if (!Lighting.UsingNewLighting) { vector2_1 = Main.Camera.UnscaledPosition; vector2_2 = Main.Camera.UnscaledSize; } this.firstTileX = (int) Math.Floor((double) vector2_1.X / 16.0) - 1; this.lastTileX = (int) Math.Floor(((double) vector2_1.X + (double) vector2_2.X) / 16.0) + 2; this.firstTileY = (int) Math.Floor((double) vector2_1.Y / 16.0) - 1; this.lastTileY = (int) Math.Floor(((double) vector2_1.Y + (double) vector2_2.Y) / 16.0) + 2; if (Main.drawSkip) return; Lighting.LightTiles(this.firstTileX, this.lastTileX, this.firstTileY, this.lastTileY); } private static void ClampScreenPositionToWorld() { Vector2 input1 = new Vector2(Main.leftWorld + 656f, Main.topWorld + 656f) - Main.GameViewMatrix.Translation; Vector2 input2 = new Vector2((float) ((double) Main.rightWorld - (double) Main.screenWidth / (double) Main.GameViewMatrix.Zoom.X - 672.0), (float) ((double) Main.bottomWorld - (double) Main.screenHeight / (double) Main.GameViewMatrix.Zoom.Y - 672.0)) - Main.GameViewMatrix.Translation; Vector2 min = Utils.Round(input1); Vector2 max = Utils.Round(input2); Main.screenPosition = Vector2.Clamp(Main.screenPosition, min, max); } private void DrawBG() { float num1 = (float) Math.Min(PlayerInput.RealScreenHeight, Main.LogicCheckScreenHeight); float num2 = (float) ((double) Main.screenPosition.Y + (double) (Main.screenHeight / 2) - (double) num1 / 2.0); this.scAdj = (float) (Main.worldSurface * 16.0) / (num2 + num1); float num3 = (float) ((double) Main.maxTilesY * 0.150000005960464 * 16.0) - num2; if ((double) num3 < 0.0) num3 = 0.0f; float num4 = num3 * 0.00025f; this.scAdj *= 0.45f - num4 * num4; if (Main.maxTilesY <= 1200) this.scAdj *= -500f; else if (Main.maxTilesY <= 1800) this.scAdj *= -300f; else this.scAdj *= -150f; this.screenOff = (float) Main.screenHeight - 600f; this.bgTopY = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 1200.0 + 1190.0) + (int) this.scAdj; this.cTop = (float) (this.bgTopY - 50); if (Main.resetClouds) { Cloud.resetClouds(); Main.resetClouds = false; } Main.bgScale = 1f; Main.bgWidthScaled = (int) ((double) Main.backgroundWidth[Main.treeMntBGSet1[0]] * (double) Main.bgScale); Main.ColorOfSurfaceBackgroundsModified = Main.ColorOfTheSkies; Main.ColorOfSurfaceBackgroundsBase = Main.ColorOfTheSkies; int num5 = Main.GetPreferredBGStyleForPlayer(); int num6 = 30; Main.backgroundLayerTransitionSpeed = 0.05f; if (num5 == 0) num6 = 60; if (Main.bgDelay < 0) ++Main.bgDelay; else if (num5 != Main.bgStyle) { ++Main.bgDelay; if (Main.bgDelay > num6) { Main.bgDelay = -60; Main.bgStyle = num5; if (num5 == 0) Main.bgDelay = 0; } } else if (Main.bgDelay > 0) --Main.bgDelay; if (Main.gameMenu) { Main.backgroundLayerTransitionSpeed = 0.02f; Main.bgStyle = Main.dayTime ? 0 : 1; num5 = Main.bgStyle; if (WorldGen.drunkWorldGen) Main.bgStyle = 9; } if (Main.instantBGTransitionCounter > 0) { --Main.instantBGTransitionCounter; Main.bgStyle = num5; Main.backgroundLayerTransitionSpeed = 1f; } this.UpdateBGVisibility_BackLayer(new int?(), new float?()); this.UpdateBGVisibility_FrontLayer(new int?(), new float?()); try { this.DrawSurfaceBG(); if (Main.BackgroundEnabled) this.DrawUnderworldBackground(false); } catch (Exception ex) { if (!Main.ignoreErrors) throw ex; TimeLogger.DrawException(ex); } TimeLogger.DetailedDrawTime(8); } private void UpdateBGVisibility_FrontLayer( int? targetBiomeOverride, float? transitionAmountOverride) { int bgStyle = Main.bgStyle; if (targetBiomeOverride.HasValue) bgStyle = targetBiomeOverride.Value; float layerTransitionSpeed = Main.backgroundLayerTransitionSpeed; if (transitionAmountOverride.HasValue) layerTransitionSpeed = transitionAmountOverride.Value; for (int index = 0; index < Main.bgAlphaFrontLayer.Length; ++index) { if (bgStyle == index) { Main.bgAlphaFrontLayer[index] += layerTransitionSpeed; if ((double) Main.bgAlphaFrontLayer[index] > 1.0) Main.bgAlphaFrontLayer[index] = 1f; } else { Main.bgAlphaFrontLayer[index] -= layerTransitionSpeed; if ((double) Main.bgAlphaFrontLayer[index] < 0.0) Main.bgAlphaFrontLayer[index] = 0.0f; } } } private void UpdateBGVisibility_BackLayer( int? targetBiomeOverride, float? transitionAmountOverride) { int bgStyle = Main.bgStyle; if (targetBiomeOverride.HasValue) bgStyle = targetBiomeOverride.Value; double layerTransitionSpeed = (double) Main.backgroundLayerTransitionSpeed; if (transitionAmountOverride.HasValue) { double num = (double) transitionAmountOverride.Value; } switch (bgStyle) { case 1: case 5: this.DrawBG_ModifyBGFarBackLayerAlpha(2, transitionAmountOverride: transitionAmountOverride); break; case 2: this.DrawBG_ModifyBGFarBackLayerAlpha(1, transitionAmountOverride: transitionAmountOverride); break; case 3: if (WorldGen.jungleBG == 5) { this.DrawBG_ModifyBGFarBackLayerAlpha(13, transitionAmountOverride: transitionAmountOverride); break; } this.DrawBG_ModifyBGFarBackLayerAlpha(0, transitionAmountOverride: transitionAmountOverride); break; case 4: this.DrawBG_ModifyBGFarBackLayerAlpha(3, transitionAmountOverride: transitionAmountOverride); break; case 6: if (WorldGen.hallowBG == 3) { this.DrawBG_ModifyBGFarBackLayerAlpha(6, transitionAmountOverride: transitionAmountOverride); break; } this.DrawBG_ModifyBGFarBackLayerAlpha(2, transitionAmountOverride: transitionAmountOverride); break; case 7: this.DrawBG_ModifyBGFarBackLayerAlpha(4, transitionAmountOverride: transitionAmountOverride); break; case 8: this.DrawBG_ModifyBGFarBackLayerAlpha(5, transitionAmountOverride: transitionAmountOverride); break; case 9: this.DrawBG_ModifyBGFarBackLayerAlpha(0, new int?(6), transitionAmountOverride); break; case 10: case 11: case 12: this.DrawBG_ModifyBGFarBackLayerAlpha(bgStyle, transitionAmountOverride: transitionAmountOverride); break; default: this.DrawBG_ModifyBGFarBackLayerAlpha(0, transitionAmountOverride: transitionAmountOverride); break; } } public static int GetPreferredBGStyleForPlayer() { int bgStyle = Main.bgStyle; int num1 = (int) (((double) Main.screenPosition.X + (double) (Main.screenWidth / 2)) / 16.0); int num2; if (WorldGen.oceanDepths((int) ((double) Main.screenPosition.X + (double) (Main.screenWidth / 2)) / 16, (int) ((double) Main.screenPosition.Y + (double) (Main.screenHeight / 2)) / 16)) num2 = !Main.player[Main.myPlayer].ZoneHallow ? (!Main.player[Main.myPlayer].ZoneCorrupt ? (!Main.player[Main.myPlayer].ZoneCrimson ? (Main.SceneMetrics.HoneyBlockCount <= 400 ? 4 : 3) : 8) : (Main.SceneMetrics.BloodTileCount <= Main.SceneMetrics.EvilTileCount ? 1 : 8)) : 6; else if (Main.player[Main.myPlayer].ZoneGlowshroom) num2 = 9; else if (Main.player[Main.myPlayer].ZoneDesert) num2 = !Main.player[Main.myPlayer].ZoneCorrupt ? (!Main.player[Main.myPlayer].ZoneCrimson ? (!Main.player[Main.myPlayer].ZoneHallow ? 2 : 5) : 5) : 5; else if (Main.player[Main.myPlayer].ZoneHallow) num2 = 6; else if (Main.player[Main.myPlayer].ZoneCorrupt) num2 = Main.SceneMetrics.BloodTileCount <= Main.SceneMetrics.EvilTileCount ? 1 : 8; else if (Main.player[Main.myPlayer].ZoneCrimson) num2 = 8; else if (Main.player[Main.myPlayer].ZoneJungle) num2 = 3; else if (Main.player[Main.myPlayer].ZoneSnow) { num2 = 7; } else { num2 = 0; if (num1 >= Main.treeX[0]) { if (WorldGen.treeBG1 != WorldGen.treeBG2 && num1 < Main.treeX[1]) num2 = 10; else if (WorldGen.treeBG1 != WorldGen.treeBG3 && num1 < Main.treeX[2]) num2 = 11; else if (WorldGen.treeBG1 != WorldGen.treeBG4) num2 = 12; } } return num2; } private void DrawBG_ModifyBGFarBackLayerAlpha( int desiredBG, int? desiredBG2 = null, float? transitionAmountOverride = null) { float layerTransitionSpeed = Main.backgroundLayerTransitionSpeed; if (transitionAmountOverride.HasValue) layerTransitionSpeed = transitionAmountOverride.Value; for (int index = 0; index < Main.bgAlphaFarBackLayer.Length; ++index) { int num1 = desiredBG == index ? 1 : 0; int num2; if (desiredBG2.HasValue) { int? nullable = desiredBG2; int num3 = index; num2 = nullable.GetValueOrDefault() == num3 & nullable.HasValue ? 1 : 0; } else num2 = 0; bool flag = (num1 | num2) != 0; Main.bgAlphaFarBackLayer[index] = MathHelper.Clamp(Main.bgAlphaFarBackLayer[index] + (flag ? layerTransitionSpeed : -layerTransitionSpeed), 0.0f, 1f); } } public void DrawInfernoRings() { for (int index1 = 0; index1 < (int) byte.MaxValue; ++index1) { if (Main.player[index1].active && !Main.player[index1].outOfRange && Main.player[index1].inferno && !Main.player[index1].dead) { this.LoadFlameRing(); float num1 = 0.1f; float num2 = 0.9f; if (!Main.gamePaused && this.IsActive) Main.player[index1].flameRingScale += 0.004f; float flameRingScale; if ((double) Main.player[index1].flameRingScale < 1.0) { flameRingScale = Main.player[index1].flameRingScale; } else { Main.player[index1].flameRingScale = 0.8f; flameRingScale = Main.player[index1].flameRingScale; } if (!Main.gamePaused && this.IsActive) Main.player[index1].flameRingRot += 0.05f; if ((double) Main.player[index1].flameRingRot > 6.28318548202515) Main.player[index1].flameRingRot -= 6.283185f; if ((double) Main.player[index1].flameRingRot < -6.28318548202515) Main.player[index1].flameRingRot += 6.283185f; for (int index2 = 0; index2 < 3; ++index2) { float scale = flameRingScale + num1 * (float) index2; if ((double) scale > 1.0) scale -= num1 * 2f; float num3 = MathHelper.Lerp(0.8f, 0.0f, Math.Abs(scale - num2) * 10f); Main.spriteBatch.Draw(TextureAssets.FlameRing.Value, Main.player[index1].Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 400 * index2, 400, 400)), new Microsoft.Xna.Framework.Color(num3, num3, num3, num3 / 2f), Main.player[index1].flameRingRot + 1.047198f * (float) index2, new Vector2(200f, 200f), scale, SpriteEffects.None, 0.0f); } } } } private static void UpdateInvasion() { if (Main.invasionType <= 0) return; if (Main.invasionSize <= 0) { switch (Main.invasionType) { case 1: NPC.SetEventFlagCleared(ref NPC.downedGoblins, 0); if (Main.netMode == 2) NetMessage.SendData(7); AchievementsHelper.NotifyProgressionEvent(10); break; case 2: NPC.SetEventFlagCleared(ref NPC.downedFrost, 1); AchievementsHelper.NotifyProgressionEvent(12); break; case 3: NPC.SetEventFlagCleared(ref NPC.downedPirates, 2); AchievementsHelper.NotifyProgressionEvent(11); break; case 4: NPC.SetEventFlagCleared(ref NPC.downedMartians, 3); AchievementsHelper.NotifyProgressionEvent(13); break; } Main.InvasionWarning(); Main.invasionType = 0; Main.invasionDelay = 0; } if (Main.invasionX == (double) Main.spawnTileX) return; float dayRate = (float) Main.dayRate; if (Main.invasionX > (double) Main.spawnTileX) { Main.invasionX -= (double) dayRate; if (Main.invasionX <= (double) Main.spawnTileX) { Main.invasionX = (double) Main.spawnTileX; Main.InvasionWarning(); } else if ((double) dayRate > 0.0) --Main.invasionWarn; } else if (Main.invasionX < (double) Main.spawnTileX) { Main.invasionX += (double) dayRate; if (Main.invasionX >= (double) Main.spawnTileX) { Main.invasionX = (double) Main.spawnTileX; Main.InvasionWarning(); } else if ((double) dayRate > 0.0) --Main.invasionWarn; } if (Main.invasionWarn > 0) return; Main.invasionWarn = 3600; Main.InvasionWarning(); } private static void InvasionWarning() { LocalizedText empty = LocalizedText.Empty; LocalizedText localizedText; if (Main.invasionSize <= 0) { switch (Main.invasionType) { case 2: localizedText = Lang.misc[4]; break; case 3: localizedText = Lang.misc[24]; break; case 4: localizedText = Lang.misc[42]; break; default: localizedText = empty = Lang.misc[0]; break; } } else if (Main.invasionX < (double) Main.spawnTileX) { switch (Main.invasionType) { case 2: localizedText = Lang.misc[5]; break; case 3: localizedText = Lang.misc[25]; break; case 4: localizedText = LocalizedText.Empty; break; default: localizedText = empty = Lang.misc[1]; break; } } else if (Main.invasionX > (double) Main.spawnTileX) { switch (Main.invasionType) { case 2: localizedText = Lang.misc[6]; break; case 3: localizedText = Lang.misc[26]; break; case 4: localizedText = LocalizedText.Empty; break; default: localizedText = empty = Lang.misc[2]; break; } } else { switch (Main.invasionType) { case 2: localizedText = Lang.misc[7]; break; case 3: localizedText = Lang.misc[27]; break; case 4: localizedText = Lang.misc[41]; break; default: localizedText = empty = Lang.misc[3]; break; } } switch (Main.netMode) { case 0: Main.NewText(localizedText.ToString(), (byte) 175, (byte) 75); break; case 2: if (!(localizedText.Value != "")) break; ChatHelper.BroadcastChatMessage(NetworkText.FromKey(localizedText.Key), new Microsoft.Xna.Framework.Color(175, 75, (int) byte.MaxValue)); break; } } public static bool CanStartInvasion(int type = 1, bool ignoreDelay = false) { if (Main.invasionType != 0 || Main.invasionDelay != 0 && !ignoreDelay) return false; int num = 0; for (int index = 0; index < (int) byte.MaxValue; ++index) { if (Main.player[index].active && Main.player[index].statLifeMax >= 200) ++num; } return num > 0; } public static void StartInvasion(int type = 1) { if (Main.invasionType != 0 && Main.invasionSize == 0) Main.invasionType = 0; if (Main.invasionType != 0) return; int num = 0; for (int index = 0; index < (int) byte.MaxValue; ++index) { if (Main.player[index].active && Main.player[index].statLifeMax >= 200) ++num; } if (num <= 0) return; Main.invasionType = type; Main.invasionSize = 80 + 40 * num; if (type == 3) Main.invasionSize += 40 + 20 * num; if (type == 4) Main.invasionSize = 160 + 40 * num; Main.invasionSizeStart = Main.invasionSize; Main.invasionProgress = 0; Main.invasionProgressIcon = type + 3; Main.invasionProgressWave = 0; Main.invasionProgressMax = Main.invasionSizeStart; Main.invasionWarn = 0; if (type == 4) { Main.invasionX = (double) (Main.spawnTileX - 1); Main.invasionWarn = 2; } else if (Main.rand.Next(2) == 0) Main.invasionX = 0.0; else Main.invasionX = (double) Main.maxTilesX; } public static void FakeLoadInvasionStart() { int num1 = 0; int num2 = 0; switch (Main.invasionType) { case 1: case 2: num1 = 80; num2 = 40; break; case 3: num1 = 120; num2 = 60; break; case 4: num1 = 160; num2 = 40; break; } int num3 = (int) Math.Ceiling((double) (Main.invasionSize - num1) / (double) num2); Main.invasionSizeStart = num1; if (num3 <= 0) return; Main.invasionSizeStart += num3 * num2; } private static void UpdateClient() { if (Main.myPlayer == (int) byte.MaxValue) Netplay.Disconnect = true; ++Main.netPlayCounter; if (Main.netPlayCounter > 3600) Main.netPlayCounter = 0; if (Main.netPlayCounter % 420 == 0) NetMessage.SendData(13, number: Main.myPlayer); if (Main.netPlayCounter % 900 == 0) { NetMessage.SendData(36, number: Main.myPlayer); NetMessage.SendData(16, number: Main.myPlayer); NetMessage.SendData(40, number: Main.myPlayer); } if (Netplay.Connection.IsActive) { ++Netplay.Connection.TimeOutTimer; if (!Main.stopTimeOuts && Netplay.Connection.TimeOutTimer > 7200) { Main.statusText = Lang.inter[43].Value; Netplay.Disconnect = true; } } for (int whoAmI = 0; whoAmI < 400; ++whoAmI) { if (Main.item[whoAmI].active && Main.item[whoAmI].playerIndexTheItemIsReservedFor == Main.myPlayer) Main.item[whoAmI].FindOwner(whoAmI); } } private static void UpdateServer() { ++Main.netPlayCounter; if (Main.netPlayCounter % 3600 == 0) { NetMessage.SendData(7); Main.netPlayCounter = 0; } for (int index = 0; index < Main.maxNetPlayers; ++index) { if (Main.player[index].active && Netplay.Clients[index].IsActive) Netplay.Clients[index].SpamUpdate(); } if (Math.IEEERemainder((double) Main.netPlayCounter, 900.0) == 0.0) { bool flag = true; int number = Main.lastItemUpdate; int num = 0; while (flag) { ++number; if (number >= 400) number = 0; ++num; if (!Main.item[number].active || Main.item[number].playerIndexTheItemIsReservedFor == (int) byte.MaxValue) NetMessage.SendData(21, number: number); if (num >= Main.maxItemUpdates || number == Main.lastItemUpdate) flag = false; } Main.lastItemUpdate = number; } for (int whoAmI = 0; whoAmI < 400; ++whoAmI) { Item obj = Main.item[whoAmI]; if (obj.active && (obj.playerIndexTheItemIsReservedFor == (int) byte.MaxValue || !Main.player[obj.playerIndexTheItemIsReservedFor].active)) obj.FindOwner(whoAmI); } for (int playerIndex = 0; playerIndex < (int) byte.MaxValue; ++playerIndex) { if (Netplay.Clients[playerIndex].IsActive) { ++Netplay.Clients[playerIndex].TimeOutTimer; if (Netplay.Clients[playerIndex].State == 0) Netplay.Clients[playerIndex].TimeOutTimer += 3; if (!Main.stopTimeOuts && Netplay.Clients[playerIndex].TimeOutTimer > 7200) { Netplay.Clients[playerIndex].PendingTermination = true; Netplay.Clients[playerIndex].PendingTerminationApproved = true; } } if (Main.player[playerIndex].active) RemoteClient.CheckSection(playerIndex, Main.player[playerIndex].position); } } public static void NewText(string newText, byte R = 255, byte G = 255, byte B = 255) { Main.chatMonitor.NewText(newText, R, G, B); SoundEngine.PlaySound(12); } public static void NewTextMultiline(string text, bool force = false, Microsoft.Xna.Framework.Color c = default (Microsoft.Xna.Framework.Color), int WidthLimit = -1) { Main.chatMonitor.NewTextMultiline(text, force, c, WidthLimit); SoundEngine.PlaySound(12); } public static void StopRain() { Main.rainTime = 0; Main.raining = false; Main.maxRaining = 0.0f; } public static void StartRain() { int maxValue1 = 86400; int maxValue2 = maxValue1 / 24; int num1 = Main.rand.Next(maxValue2 * 8, maxValue1); if (Main.rand.Next(3) == 0) num1 += Main.rand.Next(0, maxValue2); if (Main.rand.Next(4) == 0) num1 += Main.rand.Next(0, maxValue2 * 2); if (Main.rand.Next(5) == 0) num1 += Main.rand.Next(0, maxValue2 * 2); if (Main.rand.Next(6) == 0) num1 += Main.rand.Next(0, maxValue2 * 3); if (Main.rand.Next(7) == 0) num1 += Main.rand.Next(0, maxValue2 * 4); if (Main.rand.Next(8) == 0) num1 += Main.rand.Next(0, maxValue2 * 5); float num2 = 1f; if (Main.rand.Next(2) == 0) num2 += 0.05f; if (Main.rand.Next(3) == 0) num2 += 0.1f; if (Main.rand.Next(4) == 0) num2 += 0.15f; if (Main.rand.Next(5) == 0) num2 += 0.2f; Main.rainTime = (int) ((double) num1 * (double) num2); Main.ChangeRain(); Main.raining = true; } private static void ChangeRain() { float maxRaining = Main.maxRaining; Main.maxRaining = (double) Main.cloudBGActive >= 1.0 || (double) Main.numClouds > 150.0 ? (Main.rand.Next(3) != 0 ? (float) Main.rand.Next(40, 91) * 0.01f : (float) Main.rand.Next(20, 91) * 0.01f) : ((double) Main.numClouds <= 100.0 ? (Main.rand.Next(3) != 0 ? (float) Main.rand.Next(5, 31) * 0.01f : (float) Main.rand.Next(5, 41) * 0.01f) : (Main.rand.Next(3) != 0 ? (float) Main.rand.Next(20, 61) * 0.01f : (float) Main.rand.Next(10, 71) * 0.01f)); } public static void StartSlimeRain(bool announce = true) { if (Main.slimeRain) return; if (Main.netMode == 1) { Main.slimeRainTime = 54000.0; Main.slimeRain = true; SkyManager.Instance.Activate("Slime", new Vector2()); } else { if (Main.raining) return; if (Main.slimeRainTime <= 0.0) Main.slimeRainTime = (double) Main.rand.Next(32400, 54000); Main.slimeRain = true; Main.slimeRainKillCount = 0; if (Main.netMode == 0) { SkyManager.Instance.Activate("Slime", new Vector2()); if (!announce) return; Main.slimeWarningTime = Main.slimeWarningDelay; } else { if (!announce) return; Main.slimeWarningTime = Main.slimeWarningDelay; NetMessage.SendData(7); } } } public static void StopSlimeRain(bool announce = true) { if (!Main.slimeRain) return; if (Main.netMode == 1) { Main.slimeRainTime = 0.0; Main.slimeRain = false; SkyManager.Instance.Deactivate("Slime"); } else { int num1 = 86400 * 7; if (Main.hardMode) { int num2 = num1 * 2; } Main.slimeRainTime = (double) (-Main.rand.Next(3024, 6048) * 100); Main.slimeRain = false; if (Main.netMode == 0) { if (announce) Main.slimeWarningTime = Main.slimeWarningDelay; SkyManager.Instance.Deactivate("Slime"); } else { if (!announce) return; Main.slimeWarningTime = Main.slimeWarningDelay; NetMessage.SendData(7); } } } private static void UpdateTime() { if (LanternNight.LanternsUp) { Main.cloudBGActive = 0.0f; if (Main.numClouds > 30) Main.numClouds = 30; } if (Main.ladyBugRainBoost > 0) Main.ladyBugRainBoost -= Main.dayRate; if (Main.pumpkinMoon) { Main.bloodMoon = false; Main.snowMoon = false; } if (Main.snowMoon) Main.bloodMoon = false; if (Main.netMode != 1 && !Main.gameMenu || Main.netMode == 2) { if (Main.slimeRainTime > 0.0) { Main.slimeRainTime -= (double) Main.dayRate; if (Main.slimeRainTime <= 0.0) Main.StopSlimeRain(); } else if (Main.slimeRainTime < 0.0) { Main.slimeRainTime += (double) Main.dayRate; if (Main.slimeRainTime > 0.0) Main.slimeRainTime = 0.0; } if (Main.raining) { if (!CreativePowerManager.Instance.GetPower().Enabled) { if (LanternNight.LanternsUp) { Main.StopRain(); } else { Main.rainTime -= Main.dayRate; if (Main.dayRate > 0) { int num = 86400 / Main.dayRate / 24; if (Main.rainTime <= 0) Main.StopRain(); else if (Main.rand.Next(num * 2) == 0) Main.ChangeRain(); } } } } else if (!Main.slimeRain && !LanternNight.LanternsUp && !LanternNight.NextNightIsLanternNight) { int maxValue1 = 86400 / (Main.dayRate != 0 ? Main.dayRate : 1); if (!CreativePowerManager.Instance.GetPower().Enabled) { if (Main.rand.Next((int) ((double) maxValue1 * 5.75)) == 0) Main.StartRain(); else if ((double) Main.cloudBGActive >= 1.0 && Main.rand.Next((int) ((double) maxValue1 * 4.25)) == 0) Main.StartRain(); else if (Main.ladyBugRainBoost > 0 && Main.rand.Next(maxValue1) == 0) Main.StartRain(); } if (!Main.raining && !NPC.BusyWithAnyInvasionOfSorts()) { int maxValue2 = (int) (1728000.0 / (double) Main.dayRate); if (!NPC.downedSlimeKing) maxValue2 /= 2; if (Main.hardMode) maxValue2 = (int) ((double) maxValue2 * 1.5); bool flag = false; for (int index = 0; index < (int) byte.MaxValue; ++index) { if (Main.player[index].active && Main.player[index].statLifeMax > 140 && Main.player[index].statDefense > 8) flag = true; } if (!flag) maxValue2 *= 5; if (Main.dayRate > 0 && maxValue2 > 0 && (flag || Main.expertMode) && Main.rand.Next(maxValue2) == 0) Main.StartSlimeRain(); } } } if ((double) Main.maxRaining != (double) Main.oldMaxRaining) { if (Main.netMode == 2) NetMessage.SendData(7); Main.oldMaxRaining = Main.maxRaining; } Main.UpdateTimeRate(); Main.time += (double) Main.dayRate; CultistRitual.UpdateTime(); BirthdayParty.UpdateTime(); LanternNight.UpdateTime(); Sandstorm.UpdateTime(); DD2Event.UpdateTime(); WorldGen.mysticLogsEvent.UpdateTime(); Main.PylonSystem.Update(); if (NPC.MoonLordCountdown > 0) { float intensity = MathHelper.Clamp((float) Math.Sin((double) NPC.MoonLordCountdown / 60.0 * 0.5) * 2f, 0.0f, 1f) * (float) (0.75 - 0.5 * ((double) NPC.MoonLordCountdown / 3600.0)); if (!Terraria.Graphics.Effects.Filters.Scene["MoonLordShake"].IsActive()) Terraria.Graphics.Effects.Filters.Scene.Activate("MoonLordShake", Main.player[Main.myPlayer].position); Terraria.Graphics.Effects.Filters.Scene["MoonLordShake"].GetShader().UseIntensity(intensity); } else if (Terraria.Graphics.Effects.Filters.Scene["MoonLordShake"].IsActive()) Terraria.Graphics.Effects.Filters.Scene.Deactivate("MoonLordShake"); if (NPC.MoonLordCountdown > 0) { --NPC.MoonLordCountdown; if (NPC.MoonLordCountdown <= 0 && Main.netMode != 1) NPC.SpawnOnPlayer((int) Player.FindClosest(new Vector2((float) (Main.maxTilesX / 2), (float) Main.worldSurface / 2f) * 16f, 0, 0), 398); } if (NPC.taxCollector && Main.netMode != 2 && !Main.gameMenu) { Main.player[Main.myPlayer].taxTimer += Main.dayRate; if (Main.player[Main.myPlayer].taxTimer >= Player.taxRate) { Main.player[Main.myPlayer].taxTimer -= Player.taxRate; Main.player[Main.myPlayer].CollectTaxes(); } } if (Main.netMode != 1) Main.UpdateSlimeRainWarning(); if (Main.netMode != 1) { if (NPC.travelNPC) { if (!Main.dayTime || Main.time > 48600.0) WorldGen.UnspawnTravelNPC(); } else if (!Main.fastForwardTime && Main.dayTime && Main.time < 27000.0) { int maxValue = (int) (27000.0 / (double) Main.dayRate) * 4; if (Main.rand.Next(maxValue) == 0) { int num = 0; for (int index = 0; index < 200; ++index) { if (Main.npc[index].active && Main.npc[index].townNPC && Main.npc[index].type != 37 && Main.npc[index].type != 453) ++num; } if (num >= 2) WorldGen.SpawnTravelNPC(); } } NPC.travelNPC = false; } bool start = Main.ShouldNormalEventsBeAbleToStart(); if (!Main.dayTime) { Main.eclipse = false; if (!Main.fastForwardTime && !start) { if (WorldGen.spawnEye && Main.netMode != 1 && Main.time > 4860.0) { for (int plr = 0; plr < (int) byte.MaxValue; ++plr) { if (Main.player[plr].active && !Main.player[plr].dead && (double) Main.player[plr].position.Y < Main.worldSurface * 16.0) { NPC.SpawnOnPlayer(plr, 4); WorldGen.spawnEye = false; break; } } } if (WorldGen.spawnHardBoss > 0 && Main.netMode != 1 && Main.time > 4860.0) { bool flag = false; for (int index = 0; index < 200; ++index) { if (Main.npc[index].active && Main.npc[index].boss) flag = true; } if (!flag) { for (int plr = 0; plr < (int) byte.MaxValue; ++plr) { if (Main.player[plr].active && !Main.player[plr].dead && (double) Main.player[plr].position.Y < Main.worldSurface * 16.0) { switch (WorldGen.spawnHardBoss) { case 1: NPC.SpawnOnPlayer(plr, 134); goto label_102; case 2: NPC.SpawnOnPlayer(plr, 125); NPC.SpawnOnPlayer(plr, 126); goto label_102; case 3: NPC.SpawnOnPlayer(plr, (int) sbyte.MaxValue); goto label_102; default: goto label_102; } } } } label_102: WorldGen.spawnHardBoss = 0; } } if (Main.time > 32400.0) Main.UpdateTime_StartDay(ref start); Main.HandleMeteorFall(); } else { WorldGen.spawnHardBoss = 0; WorldGen.spawnEye = false; Main.bloodMoon = false; Main.stopMoonEvent(); if (Main.time > 54000.0) Main.UpdateTime_StartNight(ref start); Main.UpdateTime_SpawnTownNPCs(); } } public static void SkipToTime(int timeToSet, bool setIsDayTime) { double time = Main.time; int num = Main.dayTime ? 1 : 0; while (setIsDayTime != Main.dayTime) { bool start = Main.ShouldNormalEventsBeAbleToStart(); if (Main.dayTime) Main.UpdateTime_StartNight(ref start); else Main.UpdateTime_StartDay(ref start); } Main.time = (double) timeToSet; if (Main.netMode != 2) return; NetMessage.TrySendData(7); } public static bool ShouldNormalEventsBeAbleToStart() => NPC.LunarApocalypseIsUp || NPC.AnyNPCs(398) || NPC.MoonLordCountdown > 0 || LanternNight.LanternsUp; public static void UpdateTime_StartNight(ref bool stopEvents) { NPC.ResetBadgerHatTime(); NPC.freeCake = false; Star.NightSetup(); NPC.setFireFlyChance(); BirthdayParty.CheckNight(); LanternNight.CheckNight(); WorldGen.mysticLogsEvent.StartNight(); WorldGen.prioritizedTownNPCType = 0; Main.checkForSpawns = 0; if (Main.rand.Next(50) == 0 && Main.netMode != 1 && NPC.downedBoss2) WorldGen.spawnMeteor = true; if (LanternNight.LanternsUp) stopEvents = true; if (Main.eclipse && Main.netMode != 1) AchievementsHelper.NotifyProgressionEvent(3); Main.eclipse = false; if (Main.netMode != 1) AchievementsHelper.NotifyProgressionEvent(0); if (!Main.fastForwardTime && !stopEvents) { if (!NPC.downedBoss1 && Main.netMode != 1) { bool flag = false; for (int index = 0; index < (int) byte.MaxValue; ++index) { if (Main.player[index].active && Main.player[index].statLifeMax >= 200 && Main.player[index].statDefense > 10) { flag = true; break; } } if (flag && Main.rand.Next(3) == 0) { int num = 0; for (int index = 0; index < 200; ++index) { if (Main.npc[index].active && Main.npc[index].townNPC) ++num; } if (num >= 4) { WorldGen.spawnEye = true; switch (Main.netMode) { case 0: Main.NewText(Lang.misc[9].Value, (byte) 50, B: (byte) 130); break; case 2: ChatHelper.BroadcastChatMessage(Lang.misc[9].ToNetworkText(), new Microsoft.Xna.Framework.Color(50, (int) byte.MaxValue, 130)); break; } } } } if (Main.netMode != 1 && !Main.pumpkinMoon && !DD2Event.Ongoing && !Main.snowMoon && WorldGen.altarCount > 0 && Main.hardMode && !WorldGen.spawnEye && Main.rand.Next(10) == 0) { bool flag = false; for (int index = 0; index < 200; ++index) { if (Main.npc[index].active && Main.npc[index].boss) flag = true; } if (!flag && (!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3)) { for (int index = 0; index < 1000; ++index) { int num = Main.rand.Next(3) + 1; if (num == 1 && !NPC.downedMechBoss1) { WorldGen.spawnHardBoss = num; switch (Main.netMode) { case 0: Main.NewText(Lang.misc[28].Value, (byte) 50, B: (byte) 130); goto label_47; case 2: ChatHelper.BroadcastChatMessage(Lang.misc[28].ToNetworkText(), new Microsoft.Xna.Framework.Color(50, (int) byte.MaxValue, 130)); goto label_47; default: goto label_47; } } else if (num == 2 && !NPC.downedMechBoss2) { WorldGen.spawnHardBoss = num; switch (Main.netMode) { case 0: Main.NewText(Lang.misc[29].Value, (byte) 50, B: (byte) 130); goto label_47; case 2: ChatHelper.BroadcastChatMessage(Lang.misc[29].ToNetworkText(), new Microsoft.Xna.Framework.Color(50, (int) byte.MaxValue, 130)); goto label_47; default: goto label_47; } } else if (num == 3 && !NPC.downedMechBoss3) { WorldGen.spawnHardBoss = num; switch (Main.netMode) { case 0: Main.NewText(Lang.misc[30].Value, (byte) 50, B: (byte) 130); goto label_47; case 2: ChatHelper.BroadcastChatMessage(Lang.misc[30].ToNetworkText(), new Microsoft.Xna.Framework.Color(50, (int) byte.MaxValue, 130)); goto label_47; default: goto label_47; } } } } } label_47: if (!WorldGen.spawnEye && Main.moonPhase != 4 && Main.rand.Next(9) == 0 && Main.netMode != 1) { for (int index = 0; index < (int) byte.MaxValue; ++index) { if (Main.player[index].active && Main.player[index].statLifeMax > 120) { Main.bloodMoon = true; break; } } if (Main.bloodMoon) { AchievementsHelper.NotifyProgressionEvent(4); switch (Main.netMode) { case 0: Main.NewText(Lang.misc[8].Value, (byte) 50, B: (byte) 130); break; case 2: ChatHelper.BroadcastChatMessage(Lang.misc[8].ToNetworkText(), new Microsoft.Xna.Framework.Color(50, (int) byte.MaxValue, 130)); break; } } } } Main.time = 0.0; Main.dayTime = false; if (Main.netMode != 2) return; NetMessage.SendData(7); } public static void UpdateTime_StartDay(ref bool stopEvents) { WorldGen.numTreeShakes = 0; if (Main.fastForwardTime) { Main.fastForwardTime = false; Main.UpdateTimeRate(); } Main.AnglerQuestSwap(); BirthdayParty.CheckMorning(); LanternNight.CheckMorning(); if (Main.invasionDelay > 0) --Main.invasionDelay; WorldGen.prioritizedTownNPCType = 0; Main.checkForSpawns = 0; Main.time = 0.0; if (Main.bloodMoon && Main.netMode != 1) AchievementsHelper.NotifyProgressionEvent(5); Main.bloodMoon = false; Main.CheckForMoonEventsStartingTemporarySeasons(); Main.checkXMas(); Main.checkHalloween(); Main.stopMoonEvent(); Main.dayTime = true; if (Main.sundialCooldown > 0) --Main.sundialCooldown; ++Main.moonPhase; if (Main.moonPhase >= 8) Main.moonPhase = 0; if (Main.drunkWorld && Main.netMode != 1) WorldGen.crimson = !WorldGen.crimson; if (Main.netMode == 2) NetMessage.SendData(7); if (Main.netMode == 1) return; AchievementsHelper.NotifyProgressionEvent(1); if (stopEvents) return; if (Main.hardMode && NPC.downedMechBossAny && Main.rand.Next(20) == 0) { Main.eclipse = true; AchievementsHelper.NotifyProgressionEvent(2); if (Main.eclipse) { if (Main.netMode == 0) Main.NewText(Lang.misc[20].Value, (byte) 50, B: (byte) 130); else if (Main.netMode == 2) ChatHelper.BroadcastChatMessage(Lang.misc[20].ToNetworkText(), new Microsoft.Xna.Framework.Color(50, (int) byte.MaxValue, 130)); } if (Main.netMode != 2) return; NetMessage.SendData(7); } else { if (Main.snowMoon || Main.pumpkinMoon || DD2Event.Ongoing) return; if (WorldGen.shadowOrbSmashed) { if (!NPC.downedGoblins) { if (Main.rand.Next(3) == 0) Main.StartInvasion(); } else if (Main.hardMode && Main.rand.Next(60) == 0 || !Main.hardMode && Main.rand.Next(30) == 0) Main.StartInvasion(); } if (Main.invasionType != 0 || !Main.hardMode || WorldGen.altarCount <= 0 || (!NPC.downedPirates || Main.rand.Next(60) != 0) && (NPC.downedPirates || Main.rand.Next(30) != 0)) return; Main.StartInvasion(3); } } private static void HandleMeteorFall() { if (Main.netMode != 1 && WorldGen.spawnMeteor) { if (Main.time < 15000.0) { Main._canShowMeteorFall = true; } else { if (Main._canShowMeteorFall && Main.time <= 16200.0) Main.AmbienceServer.ForceEntitySpawn(new AmbienceServer.AmbienceSpawnInfo() { skyEntityType = SkyEntityType.Meteor, targetPlayer = -1 }); Main._canShowMeteorFall = false; } } if (Main.time <= 16200.0 || !WorldGen.spawnMeteor) return; WorldGen.spawnMeteor = false; WorldGen.dropMeteor(); } private static void UpdateSlimeRainWarning() { if (Main.slimeWarningTime <= 0) return; --Main.slimeWarningTime; if (Main.slimeWarningTime > 0) return; if (Main.netMode == 0) { if (Main.slimeRainTime > 0.0) Main.NewText(Lang.gen[74].Value, (byte) 50, B: (byte) 130); else Main.NewText(Lang.gen[75].Value, (byte) 50, B: (byte) 130); } else if (Main.slimeRainTime > 0.0) ChatHelper.BroadcastChatMessage(NetworkText.FromKey(Lang.gen[74].Key), new Microsoft.Xna.Framework.Color(50, (int) byte.MaxValue, 130)); else ChatHelper.BroadcastChatMessage(NetworkText.FromKey(Lang.gen[75].Key), new Microsoft.Xna.Framework.Color(50, (int) byte.MaxValue, 130)); } public static BestiaryUnlockProgressReport GetBestiaryProgressReport() { float num1 = 0.0f; int num2 = 0; List entries = Main.BestiaryDB.Entries; for (int index = 0; index < entries.Count; ++index) { int num3 = entries[index].UIInfoProvider.GetEntryUICollectionInfo().UnlockState > BestiaryEntryUnlockState.NotKnownAtAll_0 ? 1 : 0; ++num2; num1 += (float) num3; } return new BestiaryUnlockProgressReport() { EntriesTotal = num2, CompletionAmountTotal = num1 }; } private static void UpdateTime_SpawnTownNPCs() { int worldUpdateRate = WorldGen.GetWorldUpdateRate(); if (Main.netMode == 1 || worldUpdateRate <= 0) return; ++Main.checkForSpawns; if (Main.checkForSpawns < 7200 / worldUpdateRate) return; Main.checkForSpawns = 0; int num1 = 0; for (int index = 0; index < (int) byte.MaxValue; ++index) { if (Main.player[index].active) ++num1; } for (int index = 0; index < 663; ++index) Main.townNPCCanSpawn[index] = false; WorldGen.prioritizedTownNPCType = 0; int num2 = 0; int num3 = 0; int num4 = 0; int num5 = 0; int num6 = 0; int num7 = 0; int num8 = 0; int num9 = 0; int num10 = 0; int num11 = 0; int num12 = 0; int num13 = 0; int num14 = 0; int num15 = 0; int num16 = 0; int num17 = 0; int num18 = 0; int num19 = 0; int num20 = 0; int num21 = 0; int num22 = 0; int num23 = 0; int num24 = 0; int num25 = 0; int num26 = 0; int num27 = 0; int num28 = 0; int num29 = 0; int num30 = 0; int num31 = 0; for (int npc = 0; npc < 200; ++npc) { if (Main.npc[npc].active && Main.npc[npc].townNPC) { if (Main.npc[npc].type != 368 && Main.npc[npc].type != 37 && Main.npc[npc].type != 453 && !Main.npc[npc].homeless) WorldGen.QuickFindHome(npc); if (Main.npc[npc].type == 37) ++num7; if (Main.npc[npc].type == 17) ++num2; if (Main.npc[npc].type == 18) ++num3; if (Main.npc[npc].type == 19) ++num5; if (Main.npc[npc].type == 20) ++num4; if (Main.npc[npc].type == 22) ++num6; if (Main.npc[npc].type == 38) ++num8; if (Main.npc[npc].type == 54) ++num9; if (Main.npc[npc].type == 107) ++num11; if (Main.npc[npc].type == 108) ++num10; if (Main.npc[npc].type == 124) ++num12; if (Main.npc[npc].type == 142) ++num13; if (Main.npc[npc].type == 160) ++num14; if (Main.npc[npc].type == 178) ++num15; if (Main.npc[npc].type == 207) ++num16; if (Main.npc[npc].type == 208) ++num17; if (Main.npc[npc].type == 209) ++num18; if (Main.npc[npc].type == 227) ++num19; if (Main.npc[npc].type == 228) ++num20; if (Main.npc[npc].type == 229) ++num21; if (Main.npc[npc].type == 353) ++num22; if (Main.npc[npc].type == 369) ++num23; if (Main.npc[npc].type == 441) ++num24; if (Main.npc[npc].type == 550) ++num25; if (Main.npc[npc].type == 588) ++num26; if (Main.npc[npc].type == 633) ++num27; if (Main.npc[npc].type == 637) ++num28; if (Main.npc[npc].type == 638) ++num29; if (Main.npc[npc].type == 656) ++num30; ++num31; } } if (WorldGen.prioritizedTownNPCType != 0) return; int num32 = 0; bool flag1 = false; int num33 = 0; bool flag2 = false; bool flag3 = false; bool flag4 = false; BestiaryUnlockProgressReport bestiaryProgressReport = Main.GetBestiaryProgressReport(); for (int index1 = 0; index1 < (int) byte.MaxValue; ++index1) { if (Main.player[index1].active) { for (int index2 = 0; index2 < 58; ++index2) { if (Main.player[index1].inventory[index2] != null && Main.player[index1].inventory[index2].stack > 0) { if (num32 < 2000000000) { if (Main.player[index1].inventory[index2].type == 71) num32 += Main.player[index1].inventory[index2].stack; if (Main.player[index1].inventory[index2].type == 72) num32 += Main.player[index1].inventory[index2].stack * 100; if (Main.player[index1].inventory[index2].type == 73) num32 += Main.player[index1].inventory[index2].stack * 10000; if (Main.player[index1].inventory[index2].type == 74) num32 += Main.player[index1].inventory[index2].stack * 1000000; } if (Main.player[index1].inventory[index2].ammo == AmmoID.Bullet || Main.player[index1].inventory[index2].useAmmo == AmmoID.Bullet) flag2 = true; if (ItemID.Sets.ItemsThatCountAsBombsForDemolitionistToSpawn[Main.player[index1].inventory[index2].type]) flag3 = true; if (Main.player[index1].inventory[index2].dye > (byte) 0 || Main.player[index1].inventory[index2].type >= 1107 && Main.player[index1].inventory[index2].type <= 1120 || Main.player[index1].inventory[index2].type >= 3385 && Main.player[index1].inventory[index2].type <= 3388) flag4 = true; } } int num34 = Main.player[index1].statLifeMax / 20; if (num34 > 5) flag1 = true; num33 += num34; if (!flag4) { for (int index3 = 0; index3 < 3; ++index3) { if (Main.player[index1].dye[index3] != null && Main.player[index1].dye[index3].stack > 0 && Main.player[index1].dye[index3].dye > (byte) 0) flag4 = true; } } } } if (!NPC.downedBoss3 && num7 == 0) { int index = NPC.NewNPC(Main.dungeonX * 16 + 8, Main.dungeonY * 16, 37); Main.npc[index].homeless = false; Main.npc[index].homeTileX = Main.dungeonX; Main.npc[index].homeTileY = Main.dungeonY; } bool flag5 = false; if (Main.rand.Next(40) == 0) flag5 = true; if (num6 < 1) Main.townNPCCanSpawn[22] = true; if ((double) num32 > 5000.0 && num2 < 1) Main.townNPCCanSpawn[17] = true; if (flag1 && num3 < 1 && num2 > 0) Main.townNPCCanSpawn[18] = true; if (flag2 && num5 < 1) Main.townNPCCanSpawn[19] = true; if ((NPC.downedBoss1 || NPC.downedBoss2 || NPC.downedBoss3) && num4 < 1) Main.townNPCCanSpawn[20] = true; if (flag3 && num2 > 0 && num8 < 1) Main.townNPCCanSpawn[38] = true; if (NPC.savedStylist && num22 < 1) Main.townNPCCanSpawn[353] = true; if (NPC.savedAngler && num23 < 1) Main.townNPCCanSpawn[369] = true; if (NPC.downedBoss3 && num9 < 1) Main.townNPCCanSpawn[54] = true; if (NPC.savedGoblin && num11 < 1) Main.townNPCCanSpawn[107] = true; if (NPC.savedTaxCollector && num24 < 1) Main.townNPCCanSpawn[441] = true; if (NPC.savedWizard && num10 < 1) Main.townNPCCanSpawn[108] = true; if (NPC.savedMech && num12 < 1) Main.townNPCCanSpawn[124] = true; if (NPC.downedFrost && num13 < 1 && Main.xMas) Main.townNPCCanSpawn[142] = true; if (NPC.downedMechBossAny && num15 < 1) Main.townNPCCanSpawn[178] = true; if (flag4 && num16 < 1 && num31 >= 4) Main.townNPCCanSpawn[207] = true; if (NPC.downedQueenBee && num20 < 1) Main.townNPCCanSpawn[228] = true; if (NPC.downedPirates && num21 < 1) Main.townNPCCanSpawn[229] = true; if (num14 < 1 && Main.hardMode) Main.townNPCCanSpawn[160] = true; if (Main.hardMode && NPC.downedPlantBoss && num18 < 1) Main.townNPCCanSpawn[209] = true; if (num31 >= 8 && num19 < 1) Main.townNPCCanSpawn[227] = true; if (flag5 && num17 < 1 && num31 >= 14) Main.townNPCCanSpawn[208] = true; if (NPC.savedBartender && num25 < 1) Main.townNPCCanSpawn[550] = true; if (NPC.savedGolfer && num26 < 1) Main.townNPCCanSpawn[588] = true; if ((double) bestiaryProgressReport.CompletionPercent >= 0.100000001490116 && num27 < 1) Main.townNPCCanSpawn[633] = true; if (NPC.boughtCat && num28 < 1) Main.townNPCCanSpawn[637] = true; if (NPC.boughtDog && num29 < 1) Main.townNPCCanSpawn[638] = true; if (NPC.boughtBunny && num30 < 1) Main.townNPCCanSpawn[656] = true; int num35 = WorldGen.prioritizedTownNPCType; if (num35 == 0 && NPC.boughtCat && num28 < 1) num35 = 637; if (num35 == 0 && NPC.boughtDog && num29 < 1) num35 = 638; if (num35 == 0 && NPC.boughtBunny && num30 < 1) num35 = 656; if (num35 == 0 && num6 < 1) num35 = 22; if (num35 == 0 && (double) num32 > 5000.0 && num2 < 1) num35 = 17; if (num35 == 0 & flag1 && num3 < 1 && num2 > 0) num35 = 18; if (num35 == 0 & flag2 && num5 < 1) num35 = 19; if (num35 == 0 && NPC.savedGoblin && num11 < 1) num35 = 107; if (num35 == 0 && NPC.savedTaxCollector && num24 < 1) num35 = 441; if (num35 == 0 && NPC.savedWizard && num10 < 1) num35 = 108; if (num35 == 0 && Main.hardMode && num14 < 1) num35 = 160; if (num35 == 0 && (NPC.downedBoss1 || NPC.downedBoss2 || NPC.downedBoss3) && num4 < 1) num35 = 20; if (num35 == 0 & flag3 && num2 > 0 && num8 < 1) num35 = 38; if (num35 == 0 && NPC.downedQueenBee && num20 < 1) num35 = 228; if (num35 == 0 && NPC.downedMechBossAny && num15 < 1) num35 = 178; if (num35 == 0 && NPC.savedMech && num12 < 1) num35 = 124; if (num35 == 0 && NPC.savedAngler && num23 < 1) num35 = 369; if (num35 == 0 && Main.hardMode && NPC.downedPlantBoss && num18 < 1) num35 = 209; if (num35 == 0 && NPC.downedPirates && num21 < 1) num35 = 229; if (num35 == 0 && NPC.downedBoss3 && num9 < 1) num35 = 54; if (num35 == 0 && NPC.savedStylist && num22 < 1) num35 = 353; if (((num35 != 0 ? 0 : (num31 >= 4 ? 1 : 0)) & (flag4 ? 1 : 0)) != 0 && num16 < 1) num35 = 207; if (num35 == 0 && num31 >= 8 && num19 < 1) num35 = 227; if (num35 == 0 & flag5 && num31 >= 14 && num17 < 1) num35 = 208; if (num35 == 0 && NPC.downedFrost && num13 < 1 && Main.xMas) num35 = 142; if (num35 == 0 && NPC.savedBartender && num25 < 1) num35 = 550; if (num35 == 0 && NPC.savedGolfer && num26 < 1) num35 = 588; if (num35 == 0 && (double) bestiaryProgressReport.CompletionPercent >= 0.100000001490116 && num27 < 1) num35 = 633; WorldGen.prioritizedTownNPCType = num35; } public static int DamageVar(float dmg, float luck = 0.0f) { float num1 = dmg * (float) (1.0 + (double) Main.rand.Next(-15, 16) * 0.00999999977648258); if ((double) luck > 0.0) { if ((double) Main.rand.NextFloat() < (double) luck) { float num2 = dmg * (float) (1.0 + (double) Main.rand.Next(-15, 16) * 0.00999999977648258); if ((double) num2 > (double) num1) num1 = num2; } } else if ((double) luck < 0.0 && (double) Main.rand.NextFloat() < -(double) luck) { float num3 = dmg * (float) (1.0 + (double) Main.rand.Next(-15, 16) * 0.00999999977648258); if ((double) num3 < (double) num1) num1 = num3; } return (int) Math.Round((double) num1); } public static double CalculateDamageNPCsTake(int Damage, int Defense) { double num = (double) Damage - (double) Defense * 0.5; if (num < 1.0) num = 1.0; return num; } public static double CalculateDamagePlayersTakeInPVP(int Damage, int Defense) { double num = (double) Damage - (double) Defense * 0.5; if (num < 1.0) num = 1.0; return num; } public static double CalculateDamagePlayersTake(int Damage, int Defense) { double num = (double) Damage - (double) Defense * 0.5; if (Main.masterMode) num = (double) (Damage - Defense); else if (Main.expertMode) num = (double) Damage - (double) Defense * 0.75; if (num < 1.0) num = 1.0; return num; } public void OnTileChangeEvent(int x, int y, int count, TileChangeType eventType) { switch (eventType) { case TileChangeType.LavaWater: SoundEngine.PlaySound(SoundID.LiquidsWaterLava, x * 16 + count * 8, y * 16 + count * 8); break; case TileChangeType.HoneyWater: SoundEngine.PlaySound(SoundID.LiquidsHoneyWater, x * 16 + count * 8, y * 16 + count * 8); break; case TileChangeType.HoneyLava: SoundEngine.PlaySound(SoundID.LiquidsHoneyLava, x * 16 + count * 8, y * 16 + count * 8); break; } } public static void ClearPendingPlayerSelectCallbacks() => Main._pendingCharacterSelect = (Main.OnPlayerSelected) null; public static void SelectPlayer(PlayerFileData data) { if (Main._pendingCharacterSelect != null) { Main._pendingCharacterSelect(data); Main._pendingCharacterSelect = (Main.OnPlayerSelected) null; } else if (Main.menuMultiplayer) { Main.ServerSideCharacter = false; data.SetAsActive(); SoundEngine.PlaySound(10); if (Main.autoJoin) { if (Netplay.SetRemoteIP(Main.getIP)) { Main.menuMode = 10; Netplay.StartTcpClient(); } Main.autoJoin = false; } else if (Main.menuServer) { Main.LoadWorlds(); Main.menuMode = 6; } else { Main.menuMode = 13; Main.clrInput(); } } else { Main.ServerSideCharacter = false; Main.myPlayer = 0; data.SetAsActive(); Main.player[Main.myPlayer].position = Vector2.Zero; Main.LoadWorlds(); SoundEngine.PlaySound(10); Main.menuMode = 6; } } public static void ToggleFullScreen() => Main.SetFullScreen(!Main.graphics.IsFullScreen); public static void SetFullScreen(bool fullscreen) => Main.SetDisplayMode(Main.PendingResolutionWidth, Main.PendingResolutionHeight, fullscreen); public static void SetResolution(int width, int height) => Main.SetDisplayMode(width, height, Main.graphics.IsFullScreen); public static void SetDisplayMode(int width, int height, bool fullscreen) { Main.screenMaximized = ((Form) Control.FromHandle(Main.instance.Window.Handle)).WindowState == FormWindowState.Maximized; if (Main.screenBorderless && Main.screenMaximized && !Main.graphics.IsFullScreen) { Main.screenMaximized = false; ((Form) Control.FromHandle(Main.instance.Window.Handle)).WindowState = FormWindowState.Normal; } Form form = (Form) Control.FromHandle(Main.instance.Window.Handle); bool flag1 = form.FormBorderStyle == FormBorderStyle.None; bool flag2 = false; int num1; int num2; if (((Main.screenBorderless || Main.screenMaximized ? 1 : (Main.graphics.IsFullScreen ? 1 : 0)) | (fullscreen ? 1 : 0)) != 0) { form.MinimumSize = new Size(0, 0); if (!fullscreen) Main.SetDisplayModeAsBorderless(ref width, ref height, form); if (width > Main.maxScreenW) { double num3 = (double) height / (double) width; width = Main.maxScreenW; double num4 = (double) width; height = (int) (num3 * num4); } if (height > Main.maxScreenH) { double num5 = (double) width / (double) height; height = Main.maxScreenH; double num6 = (double) height; width = (int) (num5 * num6); } PlayerInput.RawMouseScale = new Vector2((float) width / (float) Main.instance.Window.ClientBounds.Width, (float) height / (float) Main.instance.Window.ClientBounds.Height); if (!Main.graphics.IsFullScreen) { num1 = Math.Max(Main.graphics.PreferredBackBufferWidth, Main.graphics.GraphicsDevice.Viewport.Width); num2 = Math.Max(Main.graphics.PreferredBackBufferHeight, Main.graphics.GraphicsDevice.Viewport.Height); if (num1 != Main.graphics.PreferredBackBufferWidth || num2 != Main.graphics.PreferredBackBufferHeight) flag2 = true; } else { num1 = Main.graphics.PreferredBackBufferWidth; num2 = Main.graphics.PreferredBackBufferHeight; } } else { PlayerInput.RawMouseScale = Vector2.One; form.MinimumSize = new Size(Main.minScreenW, Main.minScreenH); if (flag1) { width = Main.displayWidth[0]; height = Main.displayHeight[0]; } width = Math.Min(width, Main.maxScreenW); height = Math.Min(height, Main.maxScreenH); Viewport viewport = Main.graphics.GraphicsDevice.Viewport; num1 = viewport.Width; viewport = Main.graphics.GraphicsDevice.Viewport; num2 = viewport.Height; int preferredBackBufferWidth = Main.graphics.PreferredBackBufferWidth; viewport = Main.graphics.GraphicsDevice.Viewport; int width1 = viewport.Width; int num7; if (preferredBackBufferWidth == width1) { int backBufferHeight = Main.graphics.PreferredBackBufferHeight; viewport = Main.graphics.GraphicsDevice.Viewport; int height1 = viewport.Height; num7 = backBufferHeight != height1 ? 1 : 0; } else num7 = 1; flag2 = num7 != 0; } if (!fullscreen && !flag2) { Size clientSize = form.ClientSize; if (clientSize.Width < Main.graphics.PreferredBackBufferWidth) { clientSize = form.ClientSize; width = clientSize.Width; flag2 = true; } clientSize = form.ClientSize; if (clientSize.Height < Main.graphics.PreferredBackBufferHeight) { clientSize = form.ClientSize; height = clientSize.Height; flag2 = true; } } width &= 2147483646; height &= 2147483646; width = Math.Max(width, Main.minScreenW); height = Math.Max(height, Main.minScreenH); if (Main.graphics.IsFullScreen != fullscreen) { Main.graphics.PreferredBackBufferWidth = width; Main.graphics.PreferredBackBufferHeight = height; Main.graphics.ApplyChanges(); Main.graphics.ToggleFullScreen(); } if (((width != num1 ? 1 : (height != num2 ? 1 : 0)) | (flag2 ? 1 : 0)) != 0) { Main.mapTime = 0; if (Main.gamePaused) Main.renderNow = true; Main.screenWidth = width; Main.screenHeight = height; Main.graphics.PreferredBackBufferWidth = Main.screenWidth; Main.graphics.PreferredBackBufferHeight = Main.screenHeight; Main.graphics.ApplyChanges(); PlayerInput.CacheOriginalScreenDimensions(); Main.FixUIScale(); if (Main.OnResolutionChanged != null) Main.OnResolutionChanged(new Vector2((float) Main.screenWidth, (float) Main.screenHeight)); Main.PendingResolutionWidth = Main.screenWidth; Main.PendingResolutionHeight = Main.screenHeight; PlayerInput.CacheOriginalScreenDimensions(); if (!fullscreen) { if (Main.screenBorderless) { Main.ApplyBorderlessResolution(form); form.FormBorderStyle = FormBorderStyle.None; } else form.FormBorderStyle = FormBorderStyle.Sizable; form.SendToBack(); form.BringToFront(); } Lighting.Initialize(); if (!Main.drawToScreen) Main.instance.InitTargets(); UserInterface.ActiveInstance.Recalculate(); Main.instance._needsMenuUIRecalculation = true; Console.WriteLine(Language.GetTextValue("Misc.ResolutionChanged", (object) width, (object) height)); Main.chatMonitor.OnResolutionChange(); } if (Main.graphics.SynchronizeWithVerticalRetrace) return; Main.graphics.SynchronizeWithVerticalRetrace = true; Main.graphics.ApplyChanges(); } public static void FixUIScale() => Main.UIScale = Main.UIScaleWanted; public void FullscreenStartup() { Main.startFullscreen = false; int preferredBackBufferWidth = Main.graphics.PreferredBackBufferWidth; int backBufferHeight = Main.graphics.PreferredBackBufferHeight; Main.Configuration.Get("DisplayWidth", ref preferredBackBufferWidth); Main.Configuration.Get("DisplayHeight", ref backBufferHeight); Main.SetDisplayMode(preferredBackBufferWidth, backBufferHeight, true); } public void UpdateDisplaySettings() { if (Main.startFullscreen) this.FullscreenStartup(); Main.SetResolution(this.GraphicsDevice.Viewport.Width, this.GraphicsDevice.Viewport.Height); } public static void OpenPlayerSelect(Main.OnPlayerSelected method) { if (Main.gameMenu && (Main.menuMode == 10 || Main.menuMode == 14) || WorldGen.gen) return; if (!Main.gameMenu) { WorldGen.SaveAndQuit((Action) (() => { Main.menuMode = 888; Main._blockFancyUIWhileLoading = true; Main.LoadPlayers(); Main.MenuUI.SetState((UIState) Main._characterSelectMenu); Main._blockFancyUIWhileLoading = false; Main._pendingCharacterSelect = method; })); } else { Main.menuMode = 888; Main._blockFancyUIWhileLoading = true; Main.LoadPlayers(); Main.MenuUI.SetState((UIState) Main._characterSelectMenu); Main._blockFancyUIWhileLoading = false; Main._pendingCharacterSelect = method; } } public static void SwitchNetMode(int mode) { if (mode < 0 || mode > 2) return; Main._targetNetMode = mode; Main._hasPendingNetmodeChange = true; } public static void WeGameRequireExitGame() => Main._WeGameReqExit = true; public delegate void OnPlayerSelected(PlayerFileData player); public static class CurrentFrameFlags { public static int ActivePlayersCount; public static int SleepingPlayersCount; public static bool AnyActiveBossNPC; public static bool HadAnActiveInteractibleProjectile; } public enum WorldPreparationState { AwaitingData, ProcessingData, Ready, } internal static class NativeMethods { public const uint ES_CONTINUOUS = 2147483648; public const uint ES_SYSTEM_REQUIRED = 1; [DllImport("kernel32.dll")] public static extern uint SetThreadExecutionState(uint esFlags); } private struct MouseTextCache { public bool noOverride; public bool isValid; public string cursorText; public int rare; public byte diff; public int X; public int Y; public int hackedScreenWidth; public int hackedScreenHeight; public string buffTooltip; } protected class TextDisplayCache { private string _originalText; private int _lastScreenWidth; private int _lastScreenHeight; public string[] TextLines { get; private set; } public int AmountOfLines { get; private set; } public void PrepareCache(string text) { if ((0 | (Main.screenWidth != this._lastScreenWidth ? 1 : 0) | (Main.screenHeight != this._lastScreenHeight ? 1 : 0) | (this._originalText != text ? 1 : 0)) == 0) return; this._lastScreenWidth = Main.screenWidth; this._lastScreenHeight = Main.screenHeight; this._originalText = text; int lineAmount; this.TextLines = Utils.WordwrapString(Main.npcChatText, FontAssets.MouseText.Value, 460, 10, out lineAmount); this.AmountOfLines = lineAmount; } } public struct SceneArea { public Vector2 SceneLocalScreenPositionOffset; public float totalWidth; public float totalHeight; public int bgTopY; } public struct InfoToSetBackColor { public bool isInGameMenuOrIsServer; public float CorruptionBiomeInfluence; public float CrimsonBiomeInfluence; public float JungleBiomeInfluence; public float MushroomBiomeInfluence; public float GraveyardInfluence; public bool BloodMoonActive; public bool LanternNightActive; } } }