// Decompiled with JetBrains decompiler // Type: Terraria.Main // Assembly: Terraria, Version=1.3.5.3, Culture=neutral, PublicKeyToken=null // MVID: 68659D26-2BE6-448F-8663-74FA559E6F08 // 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.Graphics; using ReLogic.Localization.IME; using ReLogic.OS; using ReLogic.Utilities; using System; 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.Windows.Forms; using Terraria.Achievements; using Terraria.Audio; using Terraria.Chat; using Terraria.Cinematics; using Terraria.DataStructures; using Terraria.GameContent; using Terraria.GameContent.Achievements; using Terraria.GameContent.Events; using Terraria.GameContent.Liquid; using Terraria.GameContent.Skies; using Terraria.GameContent.Tile_Entities; using Terraria.GameContent.UI; 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.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.World.Generation; namespace Terraria { public class Main : Game { public const int curRelease = 194; public const ulong WorldGeneratorVersion = 833223655425; private const string versionStringBecauseTheyreTheSame = "v1.3.5.3"; public const string assemblyVersionNumber = "1.3.5.3"; public static bool RunningAchievementEnabled = true; 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 = false; public static bool SettingsEnabled_MinersWobble = true; public static bool HidePassword = false; public static bool ReversedUpDownArmorSetBonuses = false; public static Microsoft.Xna.Framework.Color MouseBorderColor = Microsoft.Xna.Framework.Color.Transparent; public static bool MouseShowBuildingGrid = false; public static bool AllowUnfocusedInputOnGamepad = false; public static bool InvisibleCursorForGamepad = true; public static bool GamepadDisableCursorItemIconInner = true; public static bool GamepadDisableInstructionsDisplay = false; public static bool CrouchingEnabled = false; public static float MouseBuildingGridAlpha = 0.0f; public static bool CaptureModeDisabled = false; public bool unityMouseOver; public static Main instance; public static string versionNumber = "v1.3.5.3"; public static string versionNumber2 = "v1.3.5.3"; public static string SavePath = Program.LaunchParameters.ContainsKey("-savedirectory") ? Program.LaunchParameters["-savedirectory"] : ((Platform) Platform.Current).GetStoragePath("Terraria"); public static bool AnnouncementBoxDisabled = false; public static int AnnouncementBoxRange = -1; public static string AutogenSeedName; 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; private AchievementManager _achievements; private static List ActiveSoundInstances = new List(128); public static UserInterface MenuUI = new UserInterface(); public static UserInterface InGameUI = new UserInterface(); private static Main.OnPlayerSelected _pendingCharacterSelect; public static bool drawBackGore = false; public static ulong LobbyId = 0; private static object _audioLock = new object(); private static Microsoft.Xna.Framework.Color[] _mapColorCacheArray = new Microsoft.Xna.Framework.Color[30000]; public static float expertLife = 2f; public static float expertDamage = 2f; public static float expertDebuffTime = 2f; public static float expertKnockBack = 0.9f; public static float expertNPCDamage = 1.5f; public static float knockBackMultiplier = 1f; public static float damageMultiplier = 1f; public WaterfallManager waterfallManager; public static WorldSections sectionManager; public static bool ServerSideCharacter = false; public static string clientUUID; public static bool ContentLoaded = false; public static int maxMsg = 121; private static int toolTipDistance = 6; public static float GlobalTime = 0.0f; public static bool GlobalTimerPaused = false; private static ulong _tileFrameSeed = (ulong) Guid.NewGuid().GetHashCode(); private static ulong _drawCycleCounter = 0; public static ContentManager ShaderContentManager; public static Ref ScreenShaderRef = new Ref(); public static Ref PixelShaderRef = new Ref(); public static Ref TileShaderRef = new Ref(); public static int WaveQuality = 3; public static bool UseStormEffects = true; public static bool UseHeatDistortion = true; public static int npcStreamSpeed = 60; public static int musicError = 0; public static bool dedServFPS = false; public static int dedServCount1 = 0; public static int dedServCount2 = 0; public static bool superFast = false; public const int offLimitBorderTiles = 40; public const int maxItemTypes = 3930; public const int maxProjectileTypes = 714; public const int maxNPCTypes = 580; public const int maxTileSets = 470; public const int maxWallTypes = 231; public const int maxBuffTypes = 206; public const int maxGlowMasks = 252; public const int maxExtras = 91; public const int maxGoreTypes = 1087; public const int maxMusic = 42; public const int MaxBannerTypes = 267; public const int numArmorHead = 216; public const int numArmorBody = 210; public const int numArmorLegs = 161; public const int numAccHandsOn = 20; public const int numAccHandsOff = 12; public const int numAccNeck = 10; public const int numAccBack = 14; public const int numAccFront = 5; public const int numAccShoes = 18; public const int numAccWaist = 13; public const int numAccShield = 7; public const int numAccFace = 9; public const int numAccBalloon = 18; public const int maxWings = 40; public const int maxBackgrounds = 207; public static int MaxShopIDs = 22; public static bool[] hairLoaded = new bool[134]; public static bool[] wingsLoaded = new bool[40]; public static bool[] goreLoaded = new bool[1087]; public static bool[] projectileLoaded = new bool[714]; public static bool[] itemFlameLoaded = new bool[3930]; public static bool[] backgroundLoaded = new bool[207]; public static bool[] tileSetsLoaded = new bool[470]; public static bool[] wallLoaded = new bool[231]; public static bool[] NPCLoaded = new bool[580]; public static bool[] armorHeadLoaded = new bool[216]; public static bool[] armorBodyLoaded = new bool[210]; public static bool[] armorLegsLoaded = new bool[161]; public static bool[] accHandsOnLoaded = new bool[20]; public static bool[] accHandsOffLoaded = new bool[12]; public static bool[] accBackLoaded = new bool[14]; public static bool[] accFrontLoaded = new bool[5]; public static bool[] accShoesLoaded = new bool[18]; public static bool[] accWaistLoaded = new bool[13]; public static bool[] accShieldLoaded = new bool[7]; public static bool[] accNeckLoaded = new bool[10]; public static bool[] accFaceLoaded = new bool[9]; public static bool[] accballoonLoaded = new bool[18]; private static float cameraLerp = 0.0f; private static int cameraLerpTimer = 0; private static int cameraLerpTimeToggle = 0; private static bool cameraGamePadLerp = false; 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 float zoomX; public static float zoomY; public static float sunCircle; public static int BlackFadeIn = 0; public static bool noWindowBorder = false; private RasterizerState Rasterizer = RasterizerState.CullCounterClockwise; private static string _cachedTitle; public static int ugBack = 0; public static int oldUgBack = 0; public static int[] bgFrame = new int[1]; public static int[] bgFrameCounter = new int[1]; 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[580]; public static int musicBox = -1; public static int musicBox2 = -1; public static byte HealthBarDrawSettings = 1; public static bool cEd = false; public static float wFrCounter = 0.0f; public static float wFrame = 0.0f; public static float upTimer; public static float upTimerMax; public static float upTimerMaxDelay; public static bool drawDiag = false; public static bool drawRelease = false; public static bool drawBetterDebug = false; public static bool betterDebugRelease = false; public static bool renderNow = false; public static bool drawToScreen = false; public static bool targetSet = false; public static int mouseX; public static int mouseY; public static int lastMouseX; public static int lastMouseY; 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[] treeMntBG = new int[2]; public static int[] treeBG = 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[2]; public static int oceanBG; 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 = false; public static bool halloween = false; public static int snowDust = 0; public static bool chTitle = false; public static bool hairWindow = false; public static bool clothesWindow = false; public static bool ingameOptionsWindow = false; public static bool inFancyUI = false; public static int keyCount = 0; public static string[] keyString = new string[10]; public static int[] keyInt = new int[10]; public static byte gFade = 0; public static float gFader = 0.0f; public static byte gFadeDir = 1; public static bool netDiag = false; public static int txData = 0; public static int rxData = 0; public static int txMsg = 0; public static int rxMsg = 0; public static int[] rxMsgType = new int[Main.maxMsg]; public static int[] rxDataType = new int[Main.maxMsg]; public static int[] txMsgType = new int[Main.maxMsg]; public static int[] txDataType = new int[Main.maxMsg]; public static double UpdateTimeAccumulator = 0.0; public static bool drawSkip = false; public static int fpsCount = 0; public static Stopwatch fpsTimer = new Stopwatch(); public bool gammaTest; public static int fountainColor = -1; public static int monolithType = -1; public static bool showSplash = true; public static bool ignoreErrors = true; public static string defaultIP = ""; public static int dayRate = 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 = false; public static int qaStyle = 0; public static int zoneX = 99; public static int zoneY = 87; public static float harpNote = 0.0f; public static bool[] projHostile = new bool[714]; public static bool[] projHook = new bool[714]; public static bool[] pvpBuff = new bool[206]; public static bool[] persistentBuff = new bool[206]; public static bool[] vanityPet = new bool[206]; public static bool[] lightPet = new bool[206]; public static bool[] meleeBuff = new bool[206]; public static bool[] debuff = new bool[206]; public static bool[] buffNoSave = new bool[206]; public static bool[] buffNoTimeDisplay = new bool[206]; public static bool[] buffDoubleApply = new bool[206]; 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 quickBG = 2; public static int bgDelay = 0; public static int bgStyle = 0; public static float[] bgAlpha = new float[10]; public static float[] bgAlpha2 = new float[10]; public static int EquipPage = 0; public static int EquipPageSelected = 0; public int mouseNPC = -1; public static int wof = -1; public static int wofT; public static int wofB; public static int wofF = 0; 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 = false; public static int loadMapLastX = 0; public static bool loadMapLock = false; public static bool loadMap = false; public static bool mapReady = false; public static int textureMaxWidth = 2000; public static int textureMaxHeight = 1800; public static bool updateMap = false; public static int mapMinX = 0; public static int mapMaxX = 0; public static int mapMinY = 0; public static int mapMaxY = 0; 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 static bool flameRingLoaded; private Texture2D flameRingTexture; private Texture2D mapDeathTexture; 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 Texture2D[] infoIconTexture = new Texture2D[14]; public static Texture2D[] wireUITexture = new Texture2D[12]; public static Texture2D builderAccTexture; public static Texture2D quicksIconTexture; public static Texture2D[] clothesTexture = new Texture2D[4]; public static Texture2D[] mapIconTexture = new Texture2D[9]; private static Texture2D[] underworldTexture = new Texture2D[5]; public static Texture2D mapTexture; private Texture2D mapBG1Texture; private Texture2D mapBG2Texture; private Texture2D mapBG3Texture; private Texture2D mapBG4Texture; private Texture2D mapBG5Texture; private Texture2D mapBG6Texture; private Texture2D mapBG7Texture; private Texture2D mapBG8Texture; private Texture2D mapBG9Texture; private Texture2D mapBG10Texture; private Texture2D mapBG11Texture; private Texture2D mapBG12Texture; private Texture2D mapBG13Texture; private Texture2D mapBG14Texture; private Texture2D mapBG15Texture; private Texture2D hueTexture; public static Texture2D colorSliderTexture; public static Texture2D colorBarTexture; public static Texture2D colorBlipTexture; public static Texture2D smartDigTexture; public static Texture2D colorHighlightTexture; public static Microsoft.Xna.Framework.Color OurFavoriteColor = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, 231, 69); public static Texture2D tileCrackTexture; public static Texture2D LockOnCursorTexture; private Texture2D iceBarrierTexture; public static bool mapInit = false; public static bool mapEnabled = true; public static int mapStyle = 1; public static float grabMapX = 0.0f; public static float grabMapY = 0.0f; public static int miniMapX = 0; public static int miniMapY = 0; public static int miniMapWidth = 0; public static int miniMapHeight = 0; public static float mapMinimapScale = 1.25f; public static float mapMinimapAlpha = 1f; public static float mapOverlayScale = 2.5f; public static float mapOverlayAlpha = 0.35f; public static bool mapFullscreen = false; public static bool resetMapFull = false; public static float mapFullscreenScale = 4f; public static Vector2 mapFullscreenPos = new Vector2(-1f, -1f); private static bool IsEnginePreloaded = false; private static bool IsEngineLoaded = false; private static uint _gameUpdateCount = 0; public static bool SkipAssemblyLoad = false; private int firstTileX; private int lastTileX; private int firstTileY; private int lastTileY; private double bgParallax; private int bgStart; private int bgLoops; private int bgStartY; private int bgLoopsY; private int bgTop; 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 GenerationProgress AutogenProgress = new GenerationProgress(); private Process tServer = new Process(); 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(125, 125, (int) byte.MaxValue); public static Microsoft.Xna.Framework.Color hcColor = new Microsoft.Xna.Framework.Color(200, 125, (int) byte.MaxValue); 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 Microsoft.Xna.Framework.Color bgColor; public static bool craftingHide = false; public static bool armorHide = false; public static float craftingAlpha = 1f; public static float armorAlpha = 1f; public static float[] buffAlpha = new float[206]; public static bool hardMode = false; 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 = 0; public static int DiscoG = 0; public static int teamCooldown = 0; public static int teamCooldownLen = 300; public static bool gamePaused = false; public static bool gameInactive = false; public static int updatesCountedForFPS = 0; public static int drawsCountedForFPS = 0; public static int uCount = 0; public static int updateRate = 0; public static int frameRate = 0; public static bool RGBRelease = false; public static bool qRelease = false; public static bool netRelease = false; public static bool frameRelease = false; public static bool showFrameRate = false; public static int magmaBGFrame = 0; public static int magmaBGFrameCounter = 0; public static int saveTimer = 0; public static bool autoJoin = false; 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 ActivePlayersCount = 0; public static int maxNetPlayers = (int) byte.MaxValue; public const int maxChests = 1000; 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 = 0; public static int slimeWarningDelay = 420; public static float slimeRainNPCSlots = 0.65f; public static bool[] slimeRainNPC = new bool[580]; public static double slimeRainTime = 0.0; public static bool slimeRain = false; public static int slimeRainKillCount = 0; 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 = 500; public const int realInventory = 50; public const int maxInventory = 58; public int invBottom = 210; public const int maxItemSounds = 125; public const int maxNPCHitSounds = 57; public const int maxNPCKilledSounds = 62; public const int maxLiquidTypes = 12; public static float cameraX = 0.0f; public static bool drewLava = false; public static float[] liquidAlpha = new float[12]; public static int waterStyle = 0; public static int worldRate = 1; public static float caveParallax = 0.88f; public static int dungeonX; public static int dungeonY; public static Terraria.Liquid[] liquid = new Terraria.Liquid[Terraria.Liquid.resLiquid]; public static LiquidBuffer[] liquidBuffer = new LiquidBuffer[10000]; public static bool dedServ = false; public static int spamCount = 0; public static int curMusic = 0; public static int dayMusic = 0; public static int ugMusic = 0; public int newMusic; public static bool showItemText = true; public static bool autoSave = true; public static bool validateSaves = true; public static bool bannerMouseOver = false; public static string buffString = ""; public static string libPath = ""; public static int lo = 0; public static int LogoA = (int) byte.MaxValue; public static int LogoB = 0; public static bool LogoT = false; public static string statusText = ""; public static string worldName = ""; public static int worldID; public static int background = 0; public static int caveBackground = 0; public static float ugBackTransition = 0.0f; 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 int moonPhase = 0; public static short sunModY = 0; public static short moonModY = 0; public static bool grabSky = false; public static bool bloodMoon = false; public static bool pumpkinMoon = false; public static bool snowMoon = false; public static float cloudAlpha = 0.0f; public static float maxRaining = 0.0f; public static float oldMaxRaining = 0.0f; public static int rainTime = 0; public static bool raining = false; public static bool eclipse = false; public static float eclipseLight = 0.0f; public static int checkForSpawns = 0; public static int helpText = 0; public static int BartenderHelpTextIndex = 0; public static bool autoGen = false; public static bool autoPause = false; public static int[] projFrames = new int[714]; public static bool[] projPet = new bool[714]; public static float demonTorch = 1f; public static int demonTorchDir = 1; public static float martianLight = 1f; public static int martianLightDir = 1; public static bool placementPreview = true; public static int[] screenTileCounts = new int[470]; public const int maxStars = 130; public static int numStars; public const int maxStarTypes = 5; public const int maxClouds = 200; public const int maxCloudTypes = 22; public static int weatherCounter = 0; public static int cloudLimit = 200; public static int numClouds = Main.cloudLimit; public static int numCloudsTemp = Main.numClouds; public static float windSpeedTemp = 0.0f; public static float windSpeed = 0.0f; public static float windSpeedSet = 0.0f; public static float windSpeedSpeed = 0.0f; public static Cloud[] cloud = new Cloud[200]; public static bool resetClouds = true; public static int sandTiles; public static int evilTiles; public static int shroomTiles; public static float shroomLight; public static int snowTiles; public static int holyTiles; public static int waterCandles; public static int peaceCandles; public static int partyMonoliths; public static int meteorTiles; public static int bloodTiles; public static int jungleTiles; public static int dungeonTiles; public static bool sunflower; public static bool clock; public static bool campfire; public static bool starInBottle; public static bool heartLantern; public static int fadeCounter = 0; public static float invAlpha = 1f; public static float invDir = 1f; [ThreadStatic] public static UnifiedRandom rand; public static Texture2D[] chestStackTexture = new Texture2D[2]; private static bool allChestStackHover = false; private static bool inventorySortMouseOver = false; public static Texture2D[] npcHeadTexture = new Texture2D[25]; public static Texture2D[] npcHeadBossTexture = new Texture2D[37]; public static Texture2D[] craftToggleTexture = new Texture2D[4]; public static Texture2D[] inventorySortTexture = new Texture2D[2]; public static Texture2D[] textGlyphTexture = new Texture2D[1]; public static Texture2D[] hotbarRadialTexture = new Texture2D[3]; public static Texture2D craftUpButtonTexture; public static Texture2D craftDownButtonTexture; public static Texture2D scrollLeftButtonTexture; public static Texture2D scrollRightButtonTexture; public static Texture2D frozenTexture; public static Texture2D magicPixel; public static Texture2D settingsPanelTexture; public static Texture2D settingsPanelTexture2; public static Texture2D miniMapFrameTexture; public static Texture2D miniMapFrame2Texture; public static Texture2D[] miniMapButtonTexture = new Texture2D[3]; public static Texture2D[] destTexture = new Texture2D[3]; public static Texture2D[] gemTexture = new Texture2D[7]; public static Texture2D[] rudolphMountTexture = new Texture2D[3]; public static Texture2D bunnyMountTexture; public static Texture2D pigronMountTexture; public static Texture2D slimeMountTexture; public static Texture2D minecartMountTexture; public static Texture2D turtleMountTexture; public static Texture2D[] beeMountTexture = new Texture2D[2]; public static Texture2D[] UFOMountTexture = new Texture2D[2]; public static Texture2D[] drillMountTexture = new Texture2D[6]; public static Texture2D[] scutlixMountTexture = new Texture2D[3]; public static Texture2D unicornMountTexture; public static Texture2D basiliskMountTexture; public static Texture2D[] minecartMechMountTexture = new Texture2D[2]; public static Texture2D[] cuteFishronMountTexture = new Texture2D[2]; public static Texture2D minecartWoodMountTexture; public static Texture2D[] wingsTexture = new Texture2D[40]; public static Texture2D[] armorHeadTexture = new Texture2D[216]; public static Texture2D[] armorBodyTexture = new Texture2D[210]; public static Texture2D[] femaleBodyTexture = new Texture2D[210]; public static Texture2D[] armorArmTexture = new Texture2D[210]; public static Texture2D[] armorLegTexture = new Texture2D[161]; public static Texture2D[] accHandsOnTexture = new Texture2D[20]; public static Texture2D[] accHandsOffTexture = new Texture2D[12]; public static Texture2D[] accBackTexture = new Texture2D[14]; public static Texture2D[] accFrontTexture = new Texture2D[5]; public static Texture2D[] accShoesTexture = new Texture2D[18]; public static Texture2D[] accWaistTexture = new Texture2D[13]; public static Texture2D[] accShieldTexture = new Texture2D[7]; public static Texture2D[] accNeckTexture = new Texture2D[10]; public static Texture2D[] accFaceTexture = new Texture2D[9]; public static Texture2D[] accBalloonTexture = new Texture2D[18]; public static Texture2D pulleyTexture; public static Texture2D[] xmasTree = new Texture2D[5]; public static Texture2D[] FlameTexture = new Texture2D[17]; public static Texture2D timerTexture; public static Texture2D[] reforgeTexture = new Texture2D[2]; public static Texture2D wallOutlineTexture; public static Texture2D actuatorTexture; public static Texture2D wireTexture; public static Texture2D wire2Texture; public static Texture2D wire3Texture; public static Texture2D wire4Texture; public static Texture2D wireTextureNew; public static Texture2D[] cameraTexture = new Texture2D[8]; public static Texture2D flyingCarpetTexture; public static Texture2D gridTexture; public static Texture2D lightDiscTexture; public static Texture2D EyeLaserTexture; public static Texture2D BoneEyesTexture; public static Texture2D BoneLaserTexture; public static Texture2D trashTexture; public static Texture2D fishingLineTexture; public static Texture2D beetleTexture; public static Texture2D probeTexture; public static Texture2D eyeLaserSmallTexture; public static Texture2D xmasLightTexture; public static Texture2D[] golemTexture = new Texture2D[4]; public static Texture2D confuseTexture; public static Texture2D sunOrbTexture; public static Texture2D sunAltarTexture; public static Texture2D[] chainsTexture = new Texture2D[17]; public static Texture2D chainTexture; public static Texture2D[] gemChainTexture = new Texture2D[7]; public static Texture2D chain2Texture; public static Texture2D chain3Texture; public static Texture2D chain4Texture; public static Texture2D chain5Texture; public static Texture2D chain6Texture; public static Texture2D chain7Texture; public static Texture2D chain8Texture; public static Texture2D chain9Texture; public static Texture2D chain10Texture; public static Texture2D chain11Texture; public static Texture2D chain12Texture; public static Texture2D chain13Texture; public static Texture2D chain14Texture; public static Texture2D chain15Texture; public static Texture2D chain16Texture; public static Texture2D chain17Texture; public static Texture2D chain18Texture; public static Texture2D chain19Texture; public static Texture2D chain20Texture; public static Texture2D chain21Texture; public static Texture2D chain22Texture; public static Texture2D chain23Texture; public static Texture2D chain24Texture; public static Texture2D chain25Texture; public static Texture2D chain26Texture; public static Texture2D chain27Texture; public static Texture2D chain28Texture; public static Texture2D chain29Texture; public static Texture2D chain30Texture; public static Texture2D chain31Texture; public static Texture2D chain32Texture; public static Texture2D chain33Texture; public static Texture2D chain34Texture; public static Texture2D chain35Texture; public static Texture2D chain36Texture; public static Texture2D chain37Texture; public static Texture2D chain38Texture; public static Texture2D chain39Texture; public static Texture2D chain40Texture; public static Texture2D hbTexture1; public static Texture2D hbTexture2; public static Texture2D chaosTexture; public static Texture2D cdTexture; public static Texture2D wofTexture; public static Texture2D boneArmTexture; public static Texture2D boneArm2Texture; public static Texture2D pumpkingArmTexture; public static Texture2D pumpkingCloakTexture; public static Texture2D[] EquipPageTexture = new Texture2D[11]; public static Texture2D[] HouseBannerTexture = new Texture2D[2]; public static Texture2D[] PVPTexture = new Texture2D[3]; public static Texture2D[] npcToggleTexture = new Texture2D[2]; public static Texture2D[] HBLockTexture = new Texture2D[2]; public static Texture2D[] buffTexture = new Texture2D[206]; public static Texture2D[] itemTexture = new Texture2D[3930]; public static Texture2D[] itemFlameTexture = new Texture2D[3930]; public static Texture2D[] npcTexture = new Texture2D[580]; public static Texture2D[][] npcAltTextures; public static Texture2D[] projectileTexture = new Texture2D[714]; public static Texture2D[] goreTexture = new Texture2D[1087]; public static Texture2D[] BackPackTexture = new Texture2D[8]; public static Texture2D rainTexture; public static Texture2D[] glowMaskTexture = new Texture2D[252]; public static Texture2D[] extraTexture = new Texture2D[91]; public static Texture2D[] highlightMaskTexture = new Texture2D[470]; public static Texture2D[] coinTexture = new Texture2D[4]; public static Texture2D[] cursorTextures = new Texture2D[17]; public static Texture2D cursorRadialTexture; public static Texture2D dustTexture; public static Texture2D sunTexture; public static Texture2D sun2Texture; public static Texture2D sun3Texture; public static int maxMoons = 3; public static int moonType = 0; public static Texture2D[] moonTexture = new Texture2D[Main.maxMoons]; public static Texture2D pumpkinMoonTexture; public static Texture2D snowMoonTexture; public static Texture2D oneDropLogo; public static int numTileColors = 31; public static RenderTarget2D[,] tileAltTexture = new RenderTarget2D[470, Main.numTileColors]; public static bool[,] tileAltTextureInit = new bool[470, Main.numTileColors]; public static bool[,] tileAltTextureDrawn = new bool[470, Main.numTileColors]; public static int numTreeStyles = 19; public static RenderTarget2D[,] treeTopAltTexture = new RenderTarget2D[Main.numTreeStyles, Main.numTileColors]; public static RenderTarget2D[,] treeBranchAltTexture = new RenderTarget2D[Main.numTreeStyles, Main.numTileColors]; public static bool[,] treeAltTextureInit = new bool[Main.numTreeStyles, Main.numTileColors]; public static bool[,] treeAltTextureDrawn = new bool[Main.numTreeStyles, Main.numTileColors]; public static bool[,] checkTreeAlt = new bool[Main.numTreeStyles, Main.numTileColors]; public static RenderTarget2D[,] wallAltTexture = new RenderTarget2D[231, Main.numTileColors]; public static bool[,] wallAltTextureInit = new bool[231, Main.numTileColors]; public static bool[,] wallAltTextureDrawn = new bool[231, Main.numTileColors]; public static Texture2D[] tileTexture = new Texture2D[470]; public static Texture2D blackTileTexture; public static Texture2D[] wallTexture = new Texture2D[231]; public static Texture2D[] backgroundTexture = new Texture2D[207]; public static Texture2D[] cloudTexture = new Texture2D[22]; public static Texture2D[] starTexture = new Texture2D[5]; public static Texture2D[] liquidTexture = new Texture2D[12]; public static Texture2D heartTexture; public static Texture2D heart2Texture; public static Texture2D manaTexture; public static Texture2D bubbleTexture; public static Texture2D flameTexture; public static Texture2D[] treeTopTexture = new Texture2D[Main.numTreeStyles]; public static Texture2D[] treeBranchTexture = new Texture2D[Main.numTreeStyles]; public static Texture2D[] woodTexture = new Texture2D[7]; public static RenderTarget2D[,] woodAltTexture = new RenderTarget2D[Main.woodTexture.Length, Main.numTileColors]; public static Texture2D shroomCapTexture; public static Texture2D inventoryBackTexture; public static Texture2D inventoryBack2Texture; public static Texture2D inventoryBack3Texture; public static Texture2D inventoryBack4Texture; public static Texture2D inventoryBack5Texture; public static Texture2D inventoryBack6Texture; public static Texture2D inventoryBack7Texture; public static Texture2D inventoryBack8Texture; public static Texture2D inventoryBack9Texture; public static Texture2D inventoryBack10Texture; public static Texture2D inventoryBack11Texture; public static Texture2D inventoryBack12Texture; public static Texture2D inventoryBack13Texture; public static Texture2D inventoryBack14Texture; public static Texture2D inventoryBack15Texture; public static Texture2D inventoryBack16Texture; public static Texture2D hairStyleBackTexture; public static Texture2D clothesStyleBackTexture; public static Texture2D inventoryTickOnTexture; public static Texture2D inventoryTickOffTexture; public static Texture2D loTexture; public static Texture2D logoTexture; public static Texture2D logo2Texture; public static Texture2D textBackTexture; public static Texture2D chatTexture; public static Texture2D chat2Texture; public static Texture2D chatBackTexture; public static Texture2D teamTexture; public static Texture2D reTexture; public static Texture2D raTexture; public static Texture2D splashTexture; public static Texture2D fadeTexture; public static Texture2D ninjaTexture; public static Texture2D antLionTexture; public static Texture2D spikeBaseTexture; public static Texture2D ghostTexture; public static Texture2D evilCactusTexture; public static Texture2D goodCactusTexture; public static Texture2D crimsonCactusTexture; public static Texture2D wraithEyeTexture; public static Texture2D fireflyTexture; public static Texture2D fireflyJarTexture; public static Texture2D lightningbugTexture; public static Texture2D lightningbugJarTexture; public static Texture2D[] jellyfishBowlTexture = new Texture2D[3]; public static Texture2D glowSnailTexture; public static Texture2D iceQueenTexture; public static Texture2D santaTankTexture; public static Texture2D reaperEyeTexture; public static Texture2D jackHatTexture; public static Texture2D treeFaceTexture; public static Texture2D pumpkingFaceTexture; public static Texture2D dukeFishronTexture; public static Texture2D miniMinotaurTexture; public static Texture2D[,] playerTextures; public const int maxHairTotal = 134; public const int maxCharSelectHair = 51; public static bool UseExperimentalFeatures = false; public static string DefaultSeed = ""; public static Texture2D[] playerHairTexture = new Texture2D[134]; public static Texture2D[] playerHairAltTexture = new Texture2D[134]; public static SoundEffect[] soundDrip = new SoundEffect[3]; public static SoundEffectInstance[] soundInstanceDrip = new SoundEffectInstance[3]; public static SoundEffect[] soundLiquid = new SoundEffect[2]; public static SoundEffectInstance[] soundInstanceLiquid = new SoundEffectInstance[2]; public static SoundEffect[] soundMech = new SoundEffect[1]; public static SoundEffectInstance[] soundInstanceMech = new SoundEffectInstance[1]; public static SoundEffect[] soundDig = new SoundEffect[3]; public static SoundEffectInstance[] soundInstanceDig = new SoundEffectInstance[3]; public static SoundEffect[] soundTink = new SoundEffect[3]; public static SoundEffectInstance[] soundInstanceTink = new SoundEffectInstance[3]; public static SoundEffect[] soundCoin = new SoundEffect[5]; public static SoundEffectInstance[] soundInstanceCoin = new SoundEffectInstance[5]; public static SoundEffect[] soundPlayerHit = new SoundEffect[3]; public static SoundEffectInstance[] soundInstancePlayerHit = new SoundEffectInstance[3]; public static SoundEffect[] soundFemaleHit = new SoundEffect[3]; public static SoundEffectInstance[] soundInstanceFemaleHit = new SoundEffectInstance[3]; public static SoundEffect soundPlayerKilled; public static SoundEffectInstance soundInstancePlayerKilled; public static SoundEffect soundGrass; public static SoundEffectInstance soundInstanceGrass; public static SoundEffect soundGrab; public static SoundEffectInstance soundInstanceGrab; public static SoundEffect soundPixie; public static SoundEffectInstance soundInstancePixie; public static SoundEffect[] soundItem = new SoundEffect[126]; public static SoundEffectInstance[] soundInstanceItem = new SoundEffectInstance[126]; public static SoundEffect[] soundNPCHit = new SoundEffect[58]; public static SoundEffectInstance[] soundInstanceNPCHit = new SoundEffectInstance[58]; public static SoundEffect[] soundNPCKilled = new SoundEffect[63]; public static SoundEffectInstance[] soundInstanceNPCKilled = new SoundEffectInstance[63]; public static SoundEffectInstance soundInstanceMoonlordCry; public static SoundEffect soundDoorOpen; public static SoundEffectInstance soundInstanceDoorOpen; public static SoundEffect soundDoorClosed; public static SoundEffectInstance soundInstanceDoorClosed; public static SoundEffect soundMenuOpen; public static SoundEffectInstance soundInstanceMenuOpen; public static SoundEffect soundMenuClose; public static SoundEffectInstance soundInstanceMenuClose; public static SoundEffect soundMenuTick; public static SoundEffectInstance soundInstanceMenuTick; public static SoundEffect soundShatter; public static SoundEffectInstance soundInstanceShatter; public static SoundEffect soundCamera; public static SoundEffectInstance soundInstanceCamera; public static SoundEffect[] soundZombie = new SoundEffect[106]; public static SoundEffectInstance[] soundInstanceZombie = new SoundEffectInstance[106]; public static SoundEffect[] soundRoar = new SoundEffect[3]; public static SoundEffectInstance[] soundInstanceRoar = new SoundEffectInstance[3]; public static SoundEffect[] soundSplash = new SoundEffect[2]; public static SoundEffectInstance[] soundInstanceSplash = new SoundEffectInstance[2]; public static SoundEffect soundDoubleJump; public static SoundEffectInstance soundInstanceDoubleJump; public static SoundEffect soundRun; public static SoundEffectInstance soundInstanceRun; public static SoundEffect soundCoins; public static SoundEffectInstance soundInstanceCoins; public static SoundEffect soundUnlock; public static SoundEffectInstance soundInstanceUnlock; public static SoundEffect soundChat; public static SoundEffectInstance soundInstanceChat; public static SoundEffect soundMaxMana; public static SoundEffectInstance soundInstanceMaxMana; public static SoundEffect soundDrown; public static SoundEffectInstance soundInstanceDrown; public static SoundEffect[] trackableSounds; public static SoundEffectInstance[] trackableSoundInstances; private static bool _areSoundsPaused = false; public static AudioEngine engine; public static SoundBank soundBank; public static WaveBank waveBank; public static Cue[] music = new Cue[42]; public static float[] musicFade = new float[42]; public static float musicVolume = 0.75f; public static float ambientVolume = 0.75f; public static float soundVolume = 1f; public static DynamicSpriteFont fontItemStack; public static DynamicSpriteFont fontMouseText; public static DynamicSpriteFont fontDeathText; public static DynamicSpriteFont[] fontCombatText = new DynamicSpriteFont[2]; public static ServerMode MenuServerMode = ServerMode.Lobby | ServerMode.FriendsCanJoin; public static bool[] tileLighted = new bool[470]; public static bool[] tileMergeDirt = new bool[470]; public static bool[] tileCut = new bool[470]; public static bool[] tileAlch = new bool[470]; public static int[] tileShine = new int[470]; public static bool[] tileShine2 = new bool[470]; public static bool[] wallHouse = new bool[231]; public static bool[] wallDungeon = new bool[231]; public static bool[] wallLight = new bool[231]; public static int[] wallBlend = new int[231]; public static bool[] tileStone = new bool[470]; public static bool[] tileAxe = new bool[470]; public static bool[] tileHammer = new bool[470]; public static bool[] tileWaterDeath = new bool[470]; public static bool[] tileLavaDeath = new bool[470]; public static bool[] tileTable = new bool[470]; public static bool[] tileBlockLight = new bool[470]; public static bool[] tileNoSunLight = new bool[470]; public static bool[] tileDungeon = new bool[470]; public static bool[] tileSpelunker = new bool[470]; public static bool[] tileSolidTop = new bool[470]; public static bool[] tileSolid = new bool[470]; public static bool[] tileBouncy = new bool[470]; public static short[] tileValue = new short[470]; public static byte[] tileLargeFrames = new byte[470]; public static byte[] wallLargeFrames = new byte[231]; public static bool[] tileRope = new bool[470]; public static bool[] tileBrick = new bool[470]; public static bool[] tileMoss = new bool[470]; public static bool[] tileNoAttach = new bool[470]; public static bool[] tileNoFail = new bool[470]; public static bool[] tileObsidianKill = new bool[470]; public static bool[] tileFrameImportant = new bool[470]; public static bool[] tilePile = new bool[470]; public static bool[] tileBlendAll = new bool[470]; public static short[] tileGlowMask = new short[470]; public static bool[] tileContainer = new bool[470]; public static bool[] tileSign = new bool[470]; public static bool[][] tileMerge = new bool[470][]; public static int cageFrames = 25; public static bool critterCage = false; 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[] 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[,] 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[] 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 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[] penguinCageFrame = new int[Main.cageFrames]; public static int[] penguinCageFrameCounter = 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[] grasshopperCageFrame = new int[Main.cageFrames]; public static int[] grasshopperCageFrameCounter = new int[Main.cageFrames]; public static bool[] tileSand = new bool[470]; public static bool[] tileFlame = new bool[470]; public static bool[] npcCatchable = new bool[580]; public static int[] tileFrame = new int[470]; public static int[] tileFrameCounter = new int[470]; public static byte[] wallFrame = new byte[231]; public static byte[] wallFrameCounter = new byte[231]; public static int[] backgroundWidth = new int[207]; public static int[] backgroundHeight = new int[207]; 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[130]; public static Item[] item = new Item[401]; public static int[] itemLockoutTime = new int[401]; public static NPC[] npc = new NPC[201]; public static Gore[] gore = new Gore[501]; 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 ItemText[] itemText = new ItemText[20]; public static Chest[] chest = new Chest[1000]; 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[3930]; 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 = false; public static bool screenBorderless = false; public static int screenBorderlessPendingResizes = 0; public static int chatLength = 600; public static bool drawingPlayerChat = false; public static bool chatRelease = false; public static int showCount = 10; public static int numChatLines = 500; public static int startChatLine = 0; public static string chatText = ""; public static ChatLine[] chatLine = new ChatLine[Main.numChatLines]; public static bool inputTextEnter = false; public static bool inputTextEscape = false; 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 = 0; public static int mouseTextColorChange = 1; public static bool mouseLeftRelease = false; public static bool mouseRightRelease = false; public static bool playerInventory = false; public static int stackSplit; public static int stackCounter = 0; public static int stackDelay = 7; public static int superFastStack = 0; 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 = false; public static bool recFastScroll = false; public static bool recBigList = false; public static int recStart = 0; 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 = 0; public static Player[] player = new Player[256]; public static List playerDrawData = new List(); public static List playerDrawDust = new List(); public static List playerDrawGore = new List(); public static int spawnTileX; public static int spawnTileY; public static bool npcChatRelease = false; public static bool editSign = false; public static bool editChest = false; 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 = false; public static bool npcChatFocus2 = false; public static bool npcChatFocus3 = false; public static int npcShop = 0; public static int npcChatCornerItem = 0; public Chest[] shop = new Chest[Main.MaxShopIDs]; public static int[] travelShop = new int[40]; public static List anglerWhoFinishedToday = new List(); public static bool anglerQuestFinished; public static int anglerQuest = 0; public static int[] anglerQuestItemNetIDs = new int[39] { 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 }; public static bool Support4K = true; 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; public static float temporaryGUIScaleSlider = -1f; public static bool temporaryGUIScaleSliderUpdate = false; public static bool InGuideCraftMenu = false; public static bool InReforgeMenu = false; public static Item HoverItem = new Item(); private static int backSpaceCount = 0; public static string motd = ""; public static bool toggleFullscreen; public static int numDisplayModes = 0; public static int[] displayWidth = new int[99]; public static int[] displayHeight = new int[99]; public static bool gameMenu = true; 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 = false; public static int invasionType = 0; public static double invasionX = 0.0; public static int invasionSize = 0; public static int invasionDelay = 0; public static int invasionWarn = 0; public static int invasionSizeStart = 0; public static bool invasionProgressNearInvasion = false; public static int invasionProgressMode = 2; public static int invasionProgressIcon = 0; public static int invasionProgress = 0; public static int invasionProgressMax = 0; public static int invasionProgressWave = 0; public static int invasionProgressDisplayLeft = 0; public static float invasionProgressAlpha = 0.0f; public int currentNPCShowingChatBubble = -1; public static int[] npcFrameCount = new int[580] { 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, 4, 5, 6, 5, 3, 3, 23, 6, 3, 6, 6, 2, 5, 3, 2, 7, 7, 4, 2, 8, 1, 5, 1, 2, 4, 16, 5, 4, 4, 15, 15, 15, 15, 2, 4, 6, 6, 24, 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, 9, 5, 6, 4, 15, 23, 3, 3, 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, 15, 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, 15, 15, 15, 15, 15, 15, 3, 3, 3, 3, 3, 3, 15, 3, 6, 12, 20, 20, 20, 15, 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, 15, 15, 15, 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, 10, 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, 10, 2, 6, 2, 19, 19, 19, 19, 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 }; public static Dictionary npcLifeBytes = new Dictionary(); private static bool mouseExit = false; private static float exitScale = 0.8f; private static bool mouseReforge = false; private 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 = false; public static bool menuServer = false; public static int netMode = 0; private static int _targetNetMode = 0; private static bool _hasPendingNetmodeChange = false; 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 cSmartCursorToggle = true; public static bool SmartCursorEnabled = false; public static bool SmartCursorShowing = false; public static int SmartCursorX; public static int SmartCursorY; public static bool SmartInteractShowingGenuine = false; public static bool SmartInteractShowingFake = false; public static int SmartInteractX; public static int SmartInteractY; public static int SmartInteractNPC; public static List SmartInteractNPCsNearby = new List(); 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 = 0.0f; public static float cursorScale = 0.0f; public static bool signBubble = false; public static int signX = 0; public static int signY = 0; public static bool hideUI = false; public static bool releaseUI = false; 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 static string oldStatusText = ""; public static bool autoShutdown = false; public static bool serverGenLock = false; public static int sundialCooldown = 0; public static bool fastForwardTime = false; private System.Type t2d = typeof (Texture2D); private Stopwatch t2dtest = new Stopwatch(); public static readonly object globalTextureLocker = new object(); 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 = 0.0f; public static int ambientCounter = 0; public static int ProjectileUpdateLoopIndex = -1; private bool _crazyTestedMemoryLimit; private Player[] _crazyTestArrayMemoryLimit; 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 = 0; public static int menuMode = 0; public static int menuSkip = 0; private static bool _needsLanguageSelect = true; private static Item cpItem = new Item(); public int textBlinkerCount; public int textBlinkerState; public static string newWorldName = ""; private static int[] specX = new int[1000]; private static int[] specY = new int[1000]; private bool _imeToggle; public static bool HoveringOverAnNPC = false; public static string hoverItemName = ""; public static Microsoft.Xna.Framework.Color inventoryBack = new Microsoft.Xna.Framework.Color(220, 220, 220, 220); public static bool mouseText = false; private static int mH = 0; private static int UI_ScreenAnchorX = Main.screenWidth - 800; private static int UIDisplay_ManaPerStar = 20; private static float UIDisplay_LifePerHeart = 20f; private static int rare = 0; public static int hairStart = 0; private static int oldHairStyle; private static Microsoft.Xna.Framework.Color oldHairColor; public static int selClothes = 0; private static Microsoft.Xna.Framework.Color[] oldClothesColor = new Microsoft.Xna.Framework.Color[4]; private static int oldClothesStyle = 0; public static int dresserX; public static int dresserY; public static Player dresserDummy; private bool _needToSetupDrawInterfaceLayers = true; private List _gameInterfaceLayers; private static GameTime _drawInterfaceGameTime; private static bool _MouseOversCanClear = false; private static Vector2 _itemIconCacheScreenPosition; private static int _itemIconCacheSelectedItemID; private static int _itemIconCacheTime = 0; public static Microsoft.Xna.Framework.Color selColor = Microsoft.Xna.Framework.Color.White; public static int focusColor = 0; public static int colorDelay = 0; public static int setKey = -1; public static int bgScroll = 0; public static bool autoPass = false; 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 = false; private static bool _blockFancyUIWhileLoading = false; private bool[] menuWide = new bool[100]; public static float GamepadCursorAlpha = 0.0f; protected List> DrawWiresSpecialTiles = new List>(); private static string[] MonolithFilterNames = new string[4] { "MonolithVortex", "MonolithNebula", "MonolithStardust", "MonolithSolar" }; private static string[] MonolithSkyNames = new string[4] { "MonolithVortex", "MonolithNebula", "MonolithStardust", "MonolithSolar" }; private static float tranSpeed = 0.05f; private static float atmo = 0.0f; private static float bgScale = 1f; private static int bgW = (int) (1024.0 * (double) Main.bgScale); private static Microsoft.Xna.Framework.Color backColor = Microsoft.Xna.Framework.Color.White; private static Microsoft.Xna.Framework.Color trueBackColor = Main.backColor; private float screenOff; private float scAdj; private float cTop; private bool _isDrawingOrUpdating; private static SlotVector _trackedSounds = new SlotVector(4096); 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 { get { int realScreenWidth = PlayerInput.RealScreenWidth; int realScreenHeight = PlayerInput.RealScreenHeight; float num = 2f; if ((double) realScreenWidth / 800.0 < (double) num) num = (float) realScreenWidth / 800f; if ((double) realScreenHeight / 600.0 < (double) num) num = (float) realScreenHeight / 600f; if ((double) num < 1.0) num = 1f; return num; } } public static bool RenderTargetsRequired => (double) Main.GameZoomTarget > 1.0 || (double) Main.GameViewMatrix.TransformationMatrix.M11 > 1.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 bool expertMode { get => Main.ActiveWorldFileData != null && Main.ActiveWorldFileData.IsExpertMode; set { if (Main.ActiveWorldFileData == null) return; Main.ActiveWorldFileData.IsExpertMode = value; } } public static AchievementManager Achievements => Main.instance._achievements; public static Effect screenShader => Main.ScreenShaderRef.Value; public static Effect pixelShader => Main.PixelShaderRef.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 static event Action OnEnginePreload; public static event Action OnResolutionChanged; public static event Action OnEngineLoad; public static uint GameUpdateCount => Main._gameUpdateCount; public static event Action OnTick; public static event Action OnPreDraw; public static event Action OnPostDraw; 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 SamplerState MountedSamplerState => !Main.drawToScreen ? SamplerState.AnisotropicClamp : SamplerState.LinearClamp; public static bool UseSeedUI => Main.UseExperimentalFeatures; public static void SetupTileMerge() { int length = 470; 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(4, 4)); Main.RegisterItemAnimation(575, (DrawAnimation) new DrawAnimationVertical(5, 4)); Main.RegisterItemAnimation(547, (DrawAnimation) new DrawAnimationVertical(5, 4)); Main.RegisterItemAnimation(520, (DrawAnimation) new DrawAnimationVertical(5, 4)); Main.RegisterItemAnimation(548, (DrawAnimation) new DrawAnimationVertical(5, 4)); Main.RegisterItemAnimation(521, (DrawAnimation) new DrawAnimationVertical(5, 4)); Main.RegisterItemAnimation(549, (DrawAnimation) new DrawAnimationVertical(5, 4)); } public static Player LocalPlayer => Main.player[Main.myPlayer]; 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 void LoadWorlds() { Main.WorldList.Clear(); Directory.CreateDirectory(Main.WorldPath); 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(); Directory.CreateDirectory(Main.PlayerPath); 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() { Directory.CreateDirectory(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(194); 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("SmartCursorToggle", (object) Main.cSmartCursorToggle); 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("VolumeSound", (object) Main.soundVolume); Main.Configuration.Put("VolumeAmbient", (object) Main.ambientVolume); Main.Configuration.Put("VolumeMusic", (object) Main.musicVolume); 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.lightMode); Main.Configuration.Put("LightingThreads", (object) Lighting.LightingThreads); Main.Configuration.Put("Parallax", (object) Main.caveParallax); Main.Configuration.Put("ShowItemText", (object) Main.showItemText); Main.Configuration.Put("LastLaunchedVersion", (object) 194); 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("UseSmartWallReplacement", (object) Player.SmartCursorSettings.SmartWallReplacement); 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("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("RunningAchievementEnabled", (object) Main.RunningAchievementEnabled); 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.cEd = true; } catch { Main.cEd = false; } } protected void OpenSettings() { if (File.Exists(Main.SavePath + Path.DirectorySeparatorChar.ToString() + "config.dat")) { this.OpenLegacySettings(); if (Main.SaveSettings()) File.Delete(Main.SavePath + Path.DirectorySeparatorChar.ToString() + "config.dat"); Lighting.LightingThreads = 0; } else { Main.Configuration.Load(); Main.Configuration.Get("SmartCursorToggle", ref Main.cSmartCursorToggle); 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)) { Main.chTitle = true; LanguageManager.Instance.SetLanguage(result1); } else { Main.chTitle = true; LanguageManager.Instance.SetLanguage(str); } Main.Configuration.Get("PlacementPreview", ref Main.placementPreview); Main.Configuration.Get("GoreVisualsAllowed", ref ChildSafety.Disabled); 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; Main.Configuration.Get("WindowMaximized", ref Main.screenMaximized); Main.Configuration.Get("WindowBorderless", ref Main.screenBorderless); Main.PendingBorderlessState = Main.screenBorderless; Main.screenBorderlessPendingResizes = Main.screenBorderless ? 6 : 0; Main.Configuration.Get("GraphicsQuality", ref Main.qaStyle); Main.Configuration.Get("BackgroundEnabled", ref Main.BackgroundEnabled); if (Main.Configuration.GetAllKeys().Contains("FrameSkip")) { bool currentValue = false; Main.Configuration.Get("FrameSkip", ref currentValue); Main.terrariasFixedTiming = !currentValue; 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; Main.Configuration.Get("LightingMode", ref Lighting.lightMode); Main.Configuration.Get("LightingThreads", ref Lighting.LightingThreads); Main.Configuration.Get("Parallax", ref Main.caveParallax); Main.bgScroll = (int) ((1.0 - (double) Main.caveParallax) * 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("UseSmartWallReplacement", ref Player.SmartCursorSettings.SmartWallReplacement); Main.Configuration.Get("UseSmartAxeAfterSmartPickaxe", ref Player.SmartCursorSettings.SmartAxeAfterPickaxe); 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("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; bool currentValue1 = false; int preferredBackBufferWidth = Main.graphics.PreferredBackBufferWidth; int backBufferHeight = Main.graphics.PreferredBackBufferHeight; Main.Configuration.Get("Fullscreen", ref currentValue1); Main.Configuration.Get("DisplayWidth", ref preferredBackBufferWidth); Main.Configuration.Get("DisplayHeight", ref backBufferHeight); Dictionary currentValue2 = new Dictionary(); Main.Configuration.Get>("MouseColor", ref currentValue2); byte num; if (currentValue2.TryGetValue("R", out num)) Main.mouseColor.R = num; if (currentValue2.TryGetValue("G", out num)) Main.mouseColor.G = num; if (currentValue2.TryGetValue("B", out num)) Main.mouseColor.B = num; currentValue2.Clear(); Main.Configuration.Get>("MouseBorderColor", ref currentValue2); if (currentValue2.TryGetValue("R", out num)) Main.MouseBorderColor.R = num; if (currentValue2.TryGetValue("G", out num)) Main.MouseBorderColor.G = num; if (currentValue2.TryGetValue("B", out num)) Main.MouseBorderColor.B = num; if (currentValue2.TryGetValue("A", out num)) Main.MouseBorderColor.A = num; Main.Configuration.Get("QuickLaunch", ref Main.SkipAssemblyLoad); Main.GameZoomTarget = Main.Configuration.Get("Zoom", 1f); Main.UIScale = Main.Configuration.Get("UIScale", 1f); int currentValue3 = -1; Main.Configuration.Get("LockOnPriority", ref currentValue3); if (currentValue3 < 0) currentValue3 = 0; if (currentValue3 > 2) currentValue3 = 2; LockOnHelper.UseMode = (LockOnHelper.LockOnMode) currentValue3; if (LockOnHelper.UseMode == LockOnHelper.LockOnMode.FocusTarget) LockOnHelper.UseMode = LockOnHelper.LockOnMode.ThreeDS; Main.Configuration.Get("InvisibleCursorForGamepad", ref Main.InvisibleCursorForGamepad); Form form = (Form) Control.FromHandle(Main.instance.Window.Handle); if (Main.screenBorderless) { form.Location = new System.Drawing.Point(0, 0); form.FormBorderStyle = FormBorderStyle.None; } else if (Main.screenMaximized) { form.WindowState = FormWindowState.Maximized; form.FormBorderStyle = FormBorderStyle.Sizable; } else form.FormBorderStyle = FormBorderStyle.Sizable; Main.SetDisplayMode(preferredBackBufferWidth, backBufferHeight, currentValue1); Main.Configuration.Get("SettingsUnlock_WorldEvil", ref Main.SettingsUnlock_WorldEvil); Main.Configuration.Get("SettingsEnabled_MinersWobble", ref Main.SettingsEnabled_MinersWobble); int currentValue4 = 0; Main.Configuration.Get("LastLaunchedVersion", ref currentValue4); Main.Configuration.Get("RunningAchievementEnabled", ref Main.RunningAchievementEnabled); if (currentValue4 <= 146) Lighting.LightingThreads = 0; if (currentValue4 <= 147) Main.terrariasFixedTiming = !Main.terrariasFixedTiming; if (currentValue4 <= 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 (currentValue4 <= 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 (currentValue4 < 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 (currentValue4 == 194) 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.lightMode = (int) 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) { Lighting.LightingThreads = binaryReader.ReadInt32(); if (Lighting.LightingThreads >= Environment.ProcessorCount) Lighting.LightingThreads = Environment.ProcessorCount - 1; } if (num1 >= 100) { Main.cSmart = binaryReader.ReadString(); Main.cSmartCursorToggle = 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 (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 = ""; 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 = cloudSave ? Main.CloudWorldPath : Main.WorldPath; if (FileUtilities.GetFullPath(str3 + Path.DirectorySeparatorChar.ToString() + str2 + ".wld", cloudSave).StartsWith("\\\\.\\", StringComparison.Ordinal)) str2 += "_"; string str4 = str3; char directorySeparatorChar = Path.DirectorySeparatorChar; string str5 = directorySeparatorChar.ToString(); string str6 = str2; if (FileUtilities.Exists(str4 + str5 + str6 + ".wld", cloudSave)) { int num = 2; while (true) { object[] objArray = new object[5] { (object) str3, null, null, null, null }; directorySeparatorChar = Path.DirectorySeparatorChar; objArray[1] = (object) directorySeparatorChar.ToString(); objArray[2] = (object) str2; objArray[3] = (object) num; objArray[4] = (object) ".wld"; if (FileUtilities.Exists(string.Concat(objArray), cloudSave)) ++num; else break; } str2 += (string) (object) num; } string str7 = str3; directorySeparatorChar = Path.DirectorySeparatorChar; string str8 = directorySeparatorChar.ToString(); string str9 = str2; return str7 + str8 + str9 + ".wld"; } 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 void LoadDedConfig(string configPath) { if (!File.Exists(configPath)) return; using (StreamReader streamReader = new StreamReader(configPath)) { string str1; while ((str1 = streamReader.ReadLine()) != null) { try { if (str1.Length > 6 && str1.Substring(0, 6).ToLower() == "world=") Main.ActiveWorldFileData = WorldFile.GetAllMetadata(str1.Substring(6), false); if (str1.Length > 5 && str1.Substring(0, 5).ToLower() == "port=") { string str2 = str1.Substring(5); try { Netplay.ListenPort = Convert.ToInt32(str2); } catch { } } if (str1.Length > 11 && str1.Substring(0, 11).ToLower() == "maxplayers=") { string str3 = str1.Substring(11); try { Main.maxNetPlayers = Convert.ToInt32(str3); } catch { } } if (str1.Length > 11 && str1.Substring(0, 9).ToLower() == "priority=" && !Program.LaunchParameters.ContainsKey("-forcepriority")) { string str4 = str1.Substring(9); try { int int32 = Convert.ToInt32(str4); 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 (str1.Length > 9 && str1.Substring(0, 9).ToLower() == "password=") Netplay.ServerPassword = str1.Substring(9); if (str1.Length > 5 && str1.Substring(0, 5).ToLower() == "motd=") Main.motd = str1.Substring(5); if (str1.Length > 5 && str1.Substring(0, 5).ToLower() == "lang=") { string str5 = str1.Substring(5); LanguageManager.Instance.SetLanguage(Convert.ToInt32(str5)); } if (str1.Length > 5 && str1.Substring(0, 5).ToLower() == "language=") { string cultureName = str1.Substring(9); LanguageManager.Instance.SetLanguage(cultureName); } if (str1.Length >= 10 && str1.Substring(0, 10).ToLower() == "worldpath=") Main.WorldPath = str1.Substring(10); if (str1.Length >= 10 && str1.Substring(0, 10).ToLower() == "worldname=") Main.worldName = str1.Substring(10); if (str1.Length >= 5 && str1.Substring(0, 5).ToLower() == "seed=") Main.AutogenSeedName = str1.Substring(5); if (str1.Length > 8 && str1.Substring(0, 8).ToLower() == "banlist=") Netplay.BanFilePath = str1.Substring(8); if (str1.Length > 11 && str1.Substring(0, 11).ToLower() == "difficulty=") { string str6 = str1.Substring(11); if (str6 == "0") Main.expertMode = false; else if (str6 == "1") Main.expertMode = true; } if (str1.Length > 11 && str1.Substring(0, 11).ToLower() == "autocreate=") { string str7 = str1.Substring(11); if (str7 == "0") Main.autoGen = false; else if (str7 == "1") { Main.maxTilesX = 4200; Main.maxTilesY = 1200; Main.autoGen = true; } else if (str7 == "2") { Main.maxTilesX = 6300; Main.maxTilesY = 1800; Main.autoGen = true; } else if (str7 == "3") { Main.maxTilesX = 8400; Main.maxTilesY = 2400; Main.autoGen = true; } } if (str1.Length > 7 && str1.Substring(0, 7).ToLower() == "secure=" && str1.Substring(7) == "1") Netplay.spamCheck = true; if (str1.Length > 5 && str1.Substring(0, 5).ToLower() == "upnp=" && str1.Substring(5) != "1") Netplay.UseUPNP = false; if (str1.Length > 10) { if (str1.Substring(0, 10).ToLower() == "npcstream=") { string str8 = str1.Substring(10); try { Main.npcStreamSpeed = Convert.ToInt32(str8); } catch { } } } } 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.menuMode = 1; } public void loadLib(string path) { Main.libPath = path; Main.LoadLibrary(Main.libPath); } public void DedServ() { 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_125: if (Main.worldPathName != null) goto label_126; 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; 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(string.Format("({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 = "8"; 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_115; } Netplay.UseUPNP = false; flag4 = false; } } catch { } label_115: 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(""); Console.Write(Language.GetTextValue("CLI.ChooseDifficulty")); string str8 = Console.ReadLine(); try { switch (Convert.ToInt32(str8)) { case 1: Main.expertMode = false; flag6 = false; break; case 2: Main.expertMode = true; 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 = Main.UseSeedUI; 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.expertMode); string seedText = str10.Trim(); if (seedText.Length == 0) Main.ActiveWorldFileData.SetSeedToRandom(); else Main.ActiveWorldFileData.SetSeed(seedText); Main.menuMode = 10; Main.serverGenLock = true; GenerationProgress progress = new GenerationProgress(); WorldGen.CreateNewWorld(progress); while (Main.menuMode == 10) { if (Main.oldStatusText != Main.statusText) { Main.oldStatusText = Main.statusText; Console.WriteLine(Main.statusText); } } try { Console.Clear(); } catch { } while (Main.serverGenLock) { 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_125; label_126: if (!(Main.worldPathName == "")) { try { Console.Clear(); } catch { } WorldGen.serverLoadWorld(); Console.WriteLine(Language.GetTextValue("CLI.Server", (object) Main.versionNumber)); Console.WriteLine(""); while (!Netplay.IsServerRunning) { 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 { Console.Clear(); } catch { } 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(); 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.anyClients) this.Update(new GameTime()); if (Main.OnTick != null) Main.OnTick(); 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.anyClients) { num4 = 0.0; Thread.Sleep(10); } } } } Thread.Sleep(0); } } else goto label_5; } public static void startDedInput() => ThreadPool.QueueUserWorkItem(new WaitCallback(Main.startDedInputCallBack), (object) 1); public static void startDedInputCallBack(object threadContext) { 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" }; if (Main.UseSeedUI) stringList.Add("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 str5 = "AM"; 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) str5 = "PM"; int num4 = (int) num3; double num5 = (double) (int) ((num3 - (double) num4) * 60.0); string str6 = string.Concat((object) num5); if (num5 < 10.0) str6 = "0" + str6; if (num4 > 12) num4 -= 12; if (num4 == 0) num4 = 12; Console.WriteLine(Language.GetTextValue("CLI.Time", (object) (num4.ToString() + ":" + str6 + " " + str5))); } 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 str7 = str2.Substring(Language.GetTextValue("CLI.SetPassword_Command").Length + 1); if (str7 == "") { Netplay.ServerPassword = ""; Console.WriteLine(Language.GetTextValue("CLI.PasswordDisabled")); } else { Netplay.ServerPassword = str7; 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 str8 = str2.Substring(length + 1); Console.WriteLine(Language.GetTextValue("CLI.ServerMessage", (object) str8)); NetMessage.BroadcastChatMessage(NetworkText.FromKey("CLI.ServerMessage", (object) str8), 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.SeedText)); } 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 UpdateSundial() { if (Main.fastForwardTime) Main.dayRate = 60; else Main.dayRate = 1; } public Main() { Main.instance = this; Main.graphics = new GraphicsDeviceManager((Game) this); this.Content.RootDirectory = "Content"; } protected void SetTitle() { Main._cachedTitle = Lang.GetRandomGameTitle(); ((Platform) Platform.Current).SetWindowUnicodeTitle(this.Window, Main._cachedTitle); } public static void InitLifeBytes() { NPC npc = new NPC(); for (int index = -65; index < 580; ++index) { if (index != 0) { npc.SetDefaults(index); Main.npcLifeBytes[index] = npc.lifeMax > (int) short.MaxValue || npc.boss ? (byte) 4 : (npc.lifeMax <= (int) sbyte.MaxValue ? (byte) 1 : (byte) 2); } } } private static void SetTileValue() { Main.tileValue[28] = (short) 100; Main.tileValue[7] = (short) 200; Main.tileValue[166] = (short) 210; Main.tileValue[6] = (short) 220; Main.tileValue[167] = (short) 230; Main.tileValue[9] = (short) 240; Main.tileValue[168] = (short) 250; Main.tileValue[37] = (short) 300; Main.tileValue[22] = (short) 310; Main.tileValue[204] = (short) 320; Main.tileValue[407] = (short) 350; Main.tileValue[8] = (short) 400; Main.tileValue[169] = (short) 410; Main.tileValue[21] = (short) 500; Main.tileValue[467] = (short) 500; Main.tileValue[441] = (short) 500; Main.tileValue[468] = (short) 500; Main.tileValue[107] = (short) 600; Main.tileValue[221] = (short) 610; Main.tileValue[108] = (short) 620; Main.tileValue[222] = (short) 630; Main.tileValue[111] = (short) 640; Main.tileValue[223] = (short) 650; Main.tileValue[211] = (short) 700; Main.tileValue[12] = (short) 800; Main.tileValue[236] = (short) 810; } private static void ResetGameCounter() => Main._gameUpdateCount = 0U; protected override void Initialize() { Main.LocalFavoriteData.Load(); Main.CloudFavoritesData.Load(); Main.FindAnnouncementBoxStatus(); PlayerInput.Initialize(); CustomCurrencyManager.Initialize(); TileObjectData.Initialize(); Animation.Initialize(); Chest.Initialize(); Wiring.Initialize(); Framing.Initialize(); ItemRarity.Initialize(); TileEntity.InitializeAll(); Projectile.InitializeStaticThings(); Main.InitializeItemAnimations(); Lighting.Initialize(); MapHelper.Initialize(); TimeLogger.Initialize(); WorldGen.RandomizeBackgrounds(); WorldGen.RandomizeCaveBackgrounds(); WorldGen.RandomizeMoonState(); WorldGen.Hooks.Initialize(); WorldGen.Hooks.OnWorldLoad += new Action(Main.ResetGameCounter); Main.bgAlpha[0] = 1f; Main.bgAlpha2[0] = 1f; this.invBottom = 258; for (int index = 0; index < 714; ++index) Main.projFrames[index] = 1; 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[596] = 4; Main.projFrames[612] = 5; Main.projFrames[613] = 4; Main.projFrames[614] = 4; Main.projFrames[615] = 7; Main.projFrames[623] = 12; Main.projFrames[633] = 5; Main.projFrames[645] = 7; Main.projFrames[650] = 4; Main.projFrames[652] = 6; Main.projFrames[659] = 4; 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.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[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.tileLighted[237] = true; Main.tileLighted[27] = true; Main.tileLighted[381] = true; Main.tileLighted[184] = true; Main.tileLighted[463] = 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.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.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[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[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; 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[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.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; 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.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.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[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 < 580; ++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; 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[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.SetupTileMerge(); Main.tileSolid[379] = 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.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.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[356] = true; Main.tileFrameImportant[334] = true; Main.tileFrameImportant[440] = 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.tileFrameImportant[355] = true; Main.tileFrameImportant[324] = true; Main.tileObsidianKill[324] = true; Main.tileLavaDeath[324] = true; Main.tileFrameImportant[463] = 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[429] = true; Main.tileFrameImportant[445] = 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.tileLargeFrames[409] = (byte) 1; Main.tileFrameImportant[410] = 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.tileSolid[460] = true; Main.tileSolid[326] = true; Main.tileBlockLight[326] = true; Main.tileSolid[458] = true; Main.tileBlockLight[458] = true; Main.tileSolid[459] = true; Main.tileSolid[327] = true; Main.tileBlockLight[327] = true; Main.tileSolid[345] = true; Main.tileBlockLight[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.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.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; 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[370] = (short) 111; Main.tileGlowMask[391] = (short) 131; Main.tileGlowMask[429] = (short) 214; Main.tileGlowMask[209] = (short) 215; Main.tileGlowMask[445] = (short) 214; Main.tileLighted[429] = true; Main.tileLighted[209] = true; Main.tileGlowMask[410] = (short) 201; 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.tileSign[55] = true; Main.tileSign[85] = true; Main.tileSign[425] = 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[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.tileLighted[286] = true; Main.tileLighted[302] = true; Main.tileFrameImportant[298] = true; Main.tileFrameImportant[299] = true; Main.tileSolid[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.tileBrick[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; 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[390] = true; Main.tileNoAttach[390] = true; Main.tileLavaDeath[390] = true; Main.tileLighted[390] = 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[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[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[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[174] = true; Main.wallHouse[223] = true; Main.wallHouse[230] = true; Main.wallHouse[228] = true; Main.wallHouse[229] = 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[168] = true; for (int index = 0; index < 231; ++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; 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); Main.critterCage = true; for (int index = 0; index < 3600; ++index) Main.CritterCages(); Main.critterCage = false; 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[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.tileMergeDirt[202] = true; Main.tileBrick[202] = true; Main.tileSolid[202] = true; Main.tileBlockLight[202] = 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[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.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[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[330] = true; Main.tileNoFail[331] = true; Main.tileNoFail[332] = true; Main.tileNoFail[333] = true; Main.tileNoFail[254] = 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[323] = 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[233] = 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.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.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.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[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[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] = 800; 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.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[44] = true; Main.tileMergeDirt[43] = true; Main.tileMergeDirt[41] = 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[15] = 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[141] = true; Main.tileFrameImportant[270] = true; Main.tileFrameImportant[271] = true; Main.tileFrameImportant[314] = true; Main.tileSolidTop[376] = true; Main.tileTable[376] = true; Main.tileTable[380] = 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[444] = 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[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.tileBlockLight[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[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[15] = 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.tileBrick[192] = false; Main.tileWaterDeath[215] = true; Main.tileWaterDeath[4] = true; Main.tileWaterDeath[51] = true; Main.tileWaterDeath[93] = true; Main.tileWaterDeath[98] = 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[15] = 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[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[316] = true; Main.tileLavaDeath[317] = true; Main.tileLavaDeath[318] = true; Main.tileLavaDeath[319] = true; Main.tileLavaDeath[354] = true; Main.tileLavaDeath[355] = true; Main.tileLavaDeath[323] = true; Main.tileLavaDeath[335] = true; Main.tileLavaDeath[338] = true; Main.tileLavaDeath[339] = 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.tileLighted[316] = true; Main.tileLighted[317] = true; Main.tileLighted[318] = true; for (int index = 0; index < 470; ++index) { if (Main.tileLavaDeath[index]) Main.tileObsidianKill[index] = 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.tileSolid[384] = true; Main.tileBlockLight[384] = true; Main.tileNoFail[384] = true; Main.tileFrameImportant[395] = true; Main.tileLavaDeath[395] = 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] = true; 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[455] = true; Main.tileFrameImportant[412] = true; for (int index = 0; index < 231; ++index) Main.wallBlend[index] = index != 20 ? (index != 19 ? (index != 18 ? (index != 17 ? (index == 16 || index == 59 ? 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.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 < 470; ++index) { if (Main.tileSolid[index]) Main.tileNoSunLight[index] = true; Main.tileFrame[index] = 0; Main.tileFrameCounter[index] = 0; } 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[460] = false; 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 < 501; ++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.itemText[index] = new ItemText(); for (int Type = 0; Type < 3930; ++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 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: Item.staff[obj.type] = true; break; case 1827: case 3245: Item.claw[obj.type] = true; break; } } Main.InitLifeBytes(); for (int index = 0; index < Recipe.maxRecipes; ++index) { Main.recipe[index] = new Recipe(); Main.availableRecipeY[index] = (float) (65 * index); } Recipe.SetupRecipes(); for (int index = 0; index < Main.numChatLines; ++index) Main.chatLine[index] = new ChatLine(); for (int index = 0; index < Terraria.Liquid.resLiquid; ++index) Main.liquid[index] = new Terraria.Liquid(); for (int index = 0; index < 10000; ++index) Main.liquidBuffer[index] = new LiquidBuffer(); this.waterfallManager = new WaterfallManager(); Lighting.LightingThreads = 0; this.shop[0] = new Chest(); Chest.SetupTravelShop(); for (int type = 1; type < Main.MaxShopIDs; ++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); if (Main.menuMode == 1) Main.LoadPlayers(); for (int Type = 1; Type < 714; ++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.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(); 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); } this.ClientInitialize(); } private void ClientInitialize() { MessageBuffer.OnTileChangeReceived += new TileChangeReceivedEvent(this.OnTileChangeEvent); Main.clientUUID = Guid.NewGuid().ToString(); FilterManager scene = Filters.Scene; ((Platform) Platform.Current).InitializeIme(this.Window.Handle); PlatformIme ime = ((Platform) Platform.Current).Ime; ime.OnKeyPress = (__Null) Delegate.Combine((Delegate) ime.OnKeyPress, (Delegate) (keyStroke => { if (Main.keyCount >= 10) return; Main.keyInt[Main.keyCount] = (int) keyStroke; Main.keyString[Main.keyCount] = keyStroke.ToString() ?? ""; ++Main.keyCount; })); base.Initialize(); this.Window.AllowUserResizing = true; this.OpenSettings(); 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.OpenRecent(); Star.SpawnStars(); WorldGen.RandomizeWeather(); this._achievements = new AchievementManager(); AchievementInitializer.Load(); DyeInitializer.Load(); ScreenEffectInitializer.Load(); AchievementCompleteUI.Initialize(); UILinksInitializer.Load(); ItemSorting.SetupWhiteLists(); 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; } } } if (Main.autoJoin) { Main.LoadPlayers(); Main.menuMode = 1; Main.menuMultiplayer = true; } Main.fpsTimer.Start(); } public T OurLoad(string path) { lock (Main.globalTextureLocker) { Texture2D tex; return TexturePackSupport.Enabled && typeof (T) == this.t2d && TexturePackSupport.FetchTexture(path + ".png", out tex) ? (T) tex : this.Content.Load(path); } } protected override void LoadContent() { Main.Configuration.Load(); Main.Configuration.Get("UseExperimentalFeatures", ref Main.UseExperimentalFeatures); if (Main.UseExperimentalFeatures) TexturePackSupport.Enabled = true; 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) Main.SetGraphicsProfile(GraphicsProfile.HiDef); TexturePackSupport.FindTexturePack(); TextureManager.Initialize(); 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.TileShaderRef.Value = Main.ShaderContentManager.Load("TileShader"); Main.ScreenShaderRef.Value = Main.ShaderContentManager.Load("ScreenShader"); try { Main.LoadMusic(); this.LoadSounds(); } catch { Main.musicVolume = 0.0f; Main.soundVolume = 0.0f; } this.LoadTextures(); this.LoadFonts(); Mount.Initialize(); Minecart.Initialize(); } private void LoadFonts() { Main.fontItemStack = this.OurLoad("Fonts" + Path.DirectorySeparatorChar.ToString() + "Item_Stack"); Main.fontMouseText = this.OurLoad("Fonts" + Path.DirectorySeparatorChar.ToString() + "Mouse_Text"); Main.fontDeathText = this.OurLoad("Fonts" + Path.DirectorySeparatorChar.ToString() + "Death_Text"); Main.fontCombatText[0] = this.OurLoad("Fonts" + Path.DirectorySeparatorChar.ToString() + "Combat_Text"); Main.fontCombatText[1] = this.OurLoad("Fonts" + Path.DirectorySeparatorChar.ToString() + "Combat_Crit"); } private void LoadTextures() { Main.tileCrackTexture = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "TileCracks"); Main.chestStackTexture[0] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "ChestStack_0"); Main.chestStackTexture[1] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "ChestStack_1"); Main.smartDigTexture = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "SmartDig"); this.iceBarrierTexture = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "IceBarrier"); Main.frozenTexture = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "Frozen"); for (int index = 0; index < Main.PVPTexture.Length; ++index) Main.PVPTexture[index] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "UI" + Path.DirectorySeparatorChar.ToString() + "PVP_" + (object) index); for (int index = 0; index < Main.EquipPageTexture.Length; ++index) Main.EquipPageTexture[index] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "UI" + Path.DirectorySeparatorChar.ToString() + "DisplaySlots_" + (object) index); for (int index = 0; index < Main.HouseBannerTexture.Length; ++index) Main.HouseBannerTexture[index] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "UI" + Path.DirectorySeparatorChar.ToString() + "House_Banner_" + (object) index); for (int index = 0; index < Main.craftToggleTexture.Length; ++index) Main.craftToggleTexture[index] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "UI" + Path.DirectorySeparatorChar.ToString() + "Craft_Toggle_" + (object) index); for (int index = 0; index < Main.inventorySortTexture.Length; ++index) Main.inventorySortTexture[index] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "UI" + Path.DirectorySeparatorChar.ToString() + "Sort_" + (object) index); for (int index = 0; index < Main.textGlyphTexture.Length; ++index) Main.textGlyphTexture[index] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "UI" + Path.DirectorySeparatorChar.ToString() + "Glyphs_" + (object) index); for (int index = 0; index < Main.hotbarRadialTexture.Length; ++index) Main.hotbarRadialTexture[index] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "UI" + Path.DirectorySeparatorChar.ToString() + "HotbarRadial_" + (object) index); for (int index = 0; index < this.infoIconTexture.Length; ++index) this.infoIconTexture[index] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "UI" + Path.DirectorySeparatorChar.ToString() + "InfoIcon_" + (object) index); for (int index = 0; index < Main.reforgeTexture.Length; ++index) Main.reforgeTexture[index] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "UI" + Path.DirectorySeparatorChar.ToString() + "Reforge_" + (object) index); for (int index = 0; index < Main.cameraTexture.Length; ++index) Main.cameraTexture[index] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "UI" + Path.DirectorySeparatorChar.ToString() + "Camera_" + (object) index); for (int index = 0; index < Main.wireUITexture.Length; ++index) Main.wireUITexture[index] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "UI" + Path.DirectorySeparatorChar.ToString() + "Wires_" + (object) index); string[] strArray1 = new string[5] { "Images", null, null, null, null }; char directorySeparatorChar1 = Path.DirectorySeparatorChar; strArray1[1] = directorySeparatorChar1.ToString(); strArray1[2] = "UI"; directorySeparatorChar1 = Path.DirectorySeparatorChar; strArray1[3] = directorySeparatorChar1.ToString(); strArray1[4] = "BuilderIcons"; Main.builderAccTexture = this.OurLoad(string.Concat(strArray1)); string[] strArray2 = new string[5] { "Images", null, null, null, null }; char directorySeparatorChar2 = Path.DirectorySeparatorChar; strArray2[1] = directorySeparatorChar2.ToString(); strArray2[2] = "UI"; directorySeparatorChar2 = Path.DirectorySeparatorChar; strArray2[3] = directorySeparatorChar2.ToString(); strArray2[4] = "UI_quickicon1"; Main.quicksIconTexture = this.OurLoad(string.Concat(strArray2)); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.craftUpButtonTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "RecUp"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.craftDownButtonTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "RecDown"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.scrollLeftButtonTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "RecLeft"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.scrollRightButtonTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "RecRight"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.oneDropLogo = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "OneDropLogo"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.pulleyTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "PlayerPulley"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.timerTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Timer"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.wofTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "WallOfFlesh"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.wallOutlineTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Wall_Outline"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.fadeTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "fade-out"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.ghostTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Ghost"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.evilCactusTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Evil_Cactus"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.goodCactusTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Good_Cactus"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.crimsonCactusTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Crimson_Cactus"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.wraithEyeTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Wraith_Eyes"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.fireflyTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Firefly"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.fireflyJarTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "FireflyJar"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.lightningbugTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "LightningBug"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.lightningbugJarTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "LightningBugJar"); AchievementCompleteUI.LoadContent(); for (int index1 = 1; index1 <= 3; ++index1) { Texture2D[] jellyfishBowlTexture = Main.jellyfishBowlTexture; int index2 = index1 - 1; object[] objArray = new object[4] { (object) "Images", null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray[1] = (object) directorySeparatorChar2.ToString(); objArray[2] = (object) "jellyfishBowl"; objArray[3] = (object) index1; Texture2D texture2D = this.OurLoad(string.Concat(objArray)); jellyfishBowlTexture[index2] = texture2D; } directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.glowSnailTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "GlowSnail"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.iceQueenTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "IceQueen"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.santaTankTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "SantaTank"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.jackHatTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "JackHat"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.treeFaceTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "TreeFace"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.pumpkingFaceTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "PumpkingFace"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.reaperEyeTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Reaper_Eyes"); directorySeparatorChar2 = Path.DirectorySeparatorChar; this.mapDeathTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "MapDeath"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.dukeFishronTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "DukeFishron"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.miniMinotaurTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "MiniMinotaur"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.mapTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Map"); directorySeparatorChar2 = Path.DirectorySeparatorChar; this.mapBG1Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "MapBG1"); directorySeparatorChar2 = Path.DirectorySeparatorChar; this.mapBG2Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "MapBG2"); directorySeparatorChar2 = Path.DirectorySeparatorChar; this.mapBG3Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "MapBG3"); directorySeparatorChar2 = Path.DirectorySeparatorChar; this.mapBG4Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "MapBG4"); directorySeparatorChar2 = Path.DirectorySeparatorChar; this.mapBG5Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "MapBG5"); directorySeparatorChar2 = Path.DirectorySeparatorChar; this.mapBG6Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "MapBG6"); directorySeparatorChar2 = Path.DirectorySeparatorChar; this.mapBG7Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "MapBG7"); directorySeparatorChar2 = Path.DirectorySeparatorChar; this.mapBG8Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "MapBG8"); directorySeparatorChar2 = Path.DirectorySeparatorChar; this.mapBG9Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "MapBG9"); directorySeparatorChar2 = Path.DirectorySeparatorChar; this.mapBG10Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "MapBG10"); directorySeparatorChar2 = Path.DirectorySeparatorChar; this.mapBG11Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "MapBG11"); directorySeparatorChar2 = Path.DirectorySeparatorChar; this.mapBG12Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "MapBG12"); directorySeparatorChar2 = Path.DirectorySeparatorChar; this.mapBG13Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "MapBG13"); directorySeparatorChar2 = Path.DirectorySeparatorChar; this.mapBG14Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "MapBG14"); directorySeparatorChar2 = Path.DirectorySeparatorChar; this.mapBG15Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "MapBG15"); directorySeparatorChar2 = Path.DirectorySeparatorChar; this.hueTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Hue"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.colorSliderTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "ColorSlider"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.colorBarTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "ColorBar"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.colorBlipTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "ColorBlip"); string[] strArray3 = new string[5] { "Images", null, null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; strArray3[1] = directorySeparatorChar2.ToString(); strArray3[2] = "UI"; directorySeparatorChar2 = Path.DirectorySeparatorChar; strArray3[3] = directorySeparatorChar2.ToString(); strArray3[4] = "Slider_Highlight"; Main.colorHighlightTexture = this.OurLoad(string.Concat(strArray3)); string[] strArray4 = new string[5] { "Images", null, null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; strArray4[1] = directorySeparatorChar2.ToString(); strArray4[2] = "UI"; directorySeparatorChar2 = Path.DirectorySeparatorChar; strArray4[3] = directorySeparatorChar2.ToString(); strArray4[4] = "LockOn_Cursor"; Main.LockOnCursorTexture = this.OurLoad(string.Concat(strArray4)); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.rainTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Rain"); for (int index3 = 0; index3 < 252; ++index3) { Texture2D[] glowMaskTexture = Main.glowMaskTexture; int index4 = index3; object[] objArray = new object[4] { (object) "Images", null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray[1] = (object) directorySeparatorChar2.ToString(); objArray[2] = (object) "Glow_"; objArray[3] = (object) index3; Texture2D texture2D = this.OurLoad(string.Concat(objArray)); glowMaskTexture[index4] = texture2D; } for (int index5 = 0; index5 < Main.highlightMaskTexture.Length; ++index5) { if (TileID.Sets.HasOutlines[index5]) { Texture2D[] highlightMaskTexture = Main.highlightMaskTexture; int index6 = index5; object[] objArray = new object[8]; objArray[0] = (object) "Images"; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray[1] = (object) directorySeparatorChar2.ToString(); objArray[2] = (object) "Misc"; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray[3] = (object) directorySeparatorChar2.ToString(); objArray[4] = (object) "TileOutlines"; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray[5] = (object) directorySeparatorChar2.ToString(); objArray[6] = (object) "Tiles_"; objArray[7] = (object) index5; Texture2D texture2D = this.OurLoad(string.Concat(objArray)); highlightMaskTexture[index6] = texture2D; } } for (int index7 = 0; index7 < 91; ++index7) { Texture2D[] extraTexture = Main.extraTexture; int index8 = index7; object[] objArray = new object[4] { (object) "Images", null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray[1] = (object) directorySeparatorChar2.ToString(); objArray[2] = (object) "Extra_"; objArray[3] = (object) index7; Texture2D texture2D = this.OurLoad(string.Concat(objArray)); extraTexture[index8] = texture2D; } for (int index9 = 0; index9 < 4; ++index9) { Texture2D[] coinTexture = Main.coinTexture; int index10 = index9; object[] objArray = new object[4] { (object) "Images", null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray[1] = (object) directorySeparatorChar2.ToString(); objArray[2] = (object) "Coin_"; objArray[3] = (object) index9; Texture2D texture2D = this.OurLoad(string.Concat(objArray)); coinTexture[index10] = texture2D; } directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.magicPixel = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "MagicPixel"); string[] strArray5 = new string[5] { "Images", null, null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; strArray5[1] = directorySeparatorChar2.ToString(); strArray5[2] = "UI"; directorySeparatorChar2 = Path.DirectorySeparatorChar; strArray5[3] = directorySeparatorChar2.ToString(); strArray5[4] = "Settings_Panel"; Main.settingsPanelTexture = this.OurLoad(string.Concat(strArray5)); string[] strArray6 = new string[5] { "Images", null, null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; strArray6[1] = directorySeparatorChar2.ToString(); strArray6[2] = "UI"; directorySeparatorChar2 = Path.DirectorySeparatorChar; strArray6[3] = directorySeparatorChar2.ToString(); strArray6[4] = "Settings_Panel_2"; Main.settingsPanelTexture2 = this.OurLoad(string.Concat(strArray6)); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.miniMapFrameTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "MiniMapFrame"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.miniMapFrame2Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "MiniMapFrame2"); for (int index11 = 0; index11 < Main.xmasTree.Length; ++index11) { Texture2D[] xmasTree = Main.xmasTree; int index12 = index11; object[] objArray = new object[4] { (object) "Images", null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray[1] = (object) directorySeparatorChar2.ToString(); objArray[2] = (object) "Xmas_"; objArray[3] = (object) index11; Texture2D texture2D = this.OurLoad(string.Concat(objArray)); xmasTree[index12] = texture2D; } for (int index13 = 0; index13 < 4; ++index13) { Texture2D[] clothesTexture = Main.clothesTexture; int index14 = index13; object[] objArray = new object[4] { (object) "Images", null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray[1] = (object) directorySeparatorChar2.ToString(); objArray[2] = (object) "Clothes_"; objArray[3] = (object) index13; Texture2D texture2D = this.OurLoad(string.Concat(objArray)); clothesTexture[index14] = texture2D; } for (int index15 = 0; index15 < Main.FlameTexture.Length; ++index15) { Texture2D[] flameTexture = Main.FlameTexture; int index16 = index15; object[] objArray = new object[4] { (object) "Images", null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray[1] = (object) directorySeparatorChar2.ToString(); objArray[2] = (object) "Flame_"; objArray[3] = (object) index15; Texture2D texture2D = this.OurLoad(string.Concat(objArray)); flameTexture[index16] = texture2D; } for (int index17 = 0; index17 < 3; ++index17) { Texture2D[] mapButtonTexture = Main.miniMapButtonTexture; int index18 = index17; object[] objArray = new object[4] { (object) "Images", null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray[1] = (object) directorySeparatorChar2.ToString(); objArray[2] = (object) "MiniMapButton_"; objArray[3] = (object) index17; Texture2D texture2D = this.OurLoad(string.Concat(objArray)); mapButtonTexture[index18] = texture2D; } for (int index19 = 0; index19 < 8; ++index19) { Texture2D[] mapIconTexture = Main.mapIconTexture; int index20 = index19; object[] objArray = new object[4] { (object) "Images", null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray[1] = (object) directorySeparatorChar2.ToString(); objArray[2] = (object) "Map_"; objArray[3] = (object) index19; Texture2D texture2D = this.OurLoad(string.Concat(objArray)); mapIconTexture[index20] = texture2D; } for (int index = 0; index < Main.underworldTexture.Length; ++index) Main.underworldTexture[index] = this.OurLoad("Images/Backgrounds/Underworld " + (object) index); Texture2D[] destTexture1 = Main.destTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D1 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Dest1"); destTexture1[0] = texture2D1; Texture2D[] destTexture2 = Main.destTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D2 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Dest2"); destTexture2[1] = texture2D2; Texture2D[] destTexture3 = Main.destTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D3 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Dest3"); destTexture3[2] = texture2D3; directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.actuatorTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Actuator"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.wireTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Wires"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.wire2Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Wires2"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.wire3Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Wires3"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.wire4Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Wires4"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.wireTextureNew = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "WiresNew"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.flyingCarpetTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "FlyingCarpet"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.hbTexture1 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "HealthBar1"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.hbTexture2 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "HealthBar2"); object[] objArray1 = new object[4] { (object) "Images", null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray1[1] = (object) directorySeparatorChar2.ToString(); objArray1[2] = (object) "logo_"; objArray1[3] = (object) Main.rand.Next(1, 9); Main.loTexture = this.OurLoad(string.Concat(objArray1)); Main.spriteBatch = new SpriteBatch(this.GraphicsDevice); Main.tileBatch = new TileBatch(this.GraphicsDevice); Main.GameViewMatrix = new SpriteViewMatrix(this.GraphicsDevice); Main.BackgroundViewMatrix = new SpriteViewMatrix(this.GraphicsDevice); for (int index21 = 0; index21 < Main.npcHeadTexture.Length; ++index21) { Texture2D[] npcHeadTexture = Main.npcHeadTexture; int index22 = index21; object[] objArray2 = new object[4] { (object) "Images", null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray2[1] = (object) directorySeparatorChar2.ToString(); objArray2[2] = (object) "NPC_Head_"; objArray2[3] = (object) index21; Texture2D texture2D4 = this.OurLoad(string.Concat(objArray2)); npcHeadTexture[index22] = texture2D4; } for (int index23 = 0; index23 < Main.npcHeadBossTexture.Length; ++index23) { Texture2D[] npcHeadBossTexture = Main.npcHeadBossTexture; int index24 = index23; object[] objArray3 = new object[4] { (object) "Images", null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray3[1] = (object) directorySeparatorChar2.ToString(); objArray3[2] = (object) "NPC_Head_Boss_"; objArray3[3] = (object) index23; Texture2D texture2D5 = this.OurLoad(string.Concat(objArray3)); npcHeadBossTexture[index24] = texture2D5; } for (int index25 = 1; index25 < Main.BackPackTexture.Length; ++index25) { Texture2D[] backPackTexture = Main.BackPackTexture; int index26 = index25; object[] objArray4 = new object[4] { (object) "Images", null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray4[1] = (object) directorySeparatorChar2.ToString(); objArray4[2] = (object) "BackPack_"; objArray4[3] = (object) index25; Texture2D texture2D6 = this.OurLoad(string.Concat(objArray4)); backPackTexture[index26] = texture2D6; } for (int index27 = 1; index27 < 206; ++index27) { Texture2D[] buffTexture = Main.buffTexture; int index28 = index27; object[] objArray5 = new object[4] { (object) "Images", null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray5[1] = (object) directorySeparatorChar2.ToString(); objArray5[2] = (object) "Buff_"; objArray5[3] = (object) index27; Texture2D texture2D7 = this.OurLoad(string.Concat(objArray5)); buffTexture[index28] = texture2D7; } this.LoadBackground(0); this.LoadBackground(49); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.minecartMountTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Mount_Minecart"); for (int index29 = 0; index29 < Main.rudolphMountTexture.Length; ++index29) { Texture2D[] rudolphMountTexture = Main.rudolphMountTexture; int index30 = index29; object[] objArray6 = new object[4] { (object) "Images", null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray6[1] = (object) directorySeparatorChar2.ToString(); objArray6[2] = (object) "Rudolph_"; objArray6[3] = (object) index29; Texture2D texture2D8 = this.OurLoad(string.Concat(objArray6)); rudolphMountTexture[index30] = texture2D8; } directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.bunnyMountTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Mount_Bunny"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.pigronMountTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Mount_Pigron"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.slimeMountTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Mount_Slime"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.turtleMountTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Mount_Turtle"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.unicornMountTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Mount_Unicorn"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.basiliskMountTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Mount_Basilisk"); Texture2D[] mechMountTexture1 = Main.minecartMechMountTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D9 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Mount_MinecartMech"); mechMountTexture1[0] = texture2D9; Texture2D[] mechMountTexture2 = Main.minecartMechMountTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D10 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Mount_MinecartMechGlow"); mechMountTexture2[1] = texture2D10; Texture2D[] fishronMountTexture1 = Main.cuteFishronMountTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D11 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Mount_CuteFishron1"); fishronMountTexture1[0] = texture2D11; Texture2D[] fishronMountTexture2 = Main.cuteFishronMountTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D12 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Mount_CuteFishron2"); fishronMountTexture2[1] = texture2D12; directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.minecartWoodMountTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Mount_MinecartWood"); Texture2D[] beeMountTexture1 = Main.beeMountTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D13 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Mount_Bee"); beeMountTexture1[0] = texture2D13; Texture2D[] beeMountTexture2 = Main.beeMountTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D14 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Mount_BeeWings"); beeMountTexture2[1] = texture2D14; Texture2D[] ufoMountTexture1 = Main.UFOMountTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D15 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Mount_UFO"); ufoMountTexture1[0] = texture2D15; Texture2D[] ufoMountTexture2 = Main.UFOMountTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D16 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Mount_UFOGlow"); ufoMountTexture2[1] = texture2D16; Texture2D[] drillMountTexture1 = Main.drillMountTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D17 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Mount_DrillRing"); drillMountTexture1[0] = texture2D17; Texture2D[] drillMountTexture2 = Main.drillMountTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D18 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Mount_DrillSeat"); drillMountTexture2[1] = texture2D18; Texture2D[] drillMountTexture3 = Main.drillMountTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D19 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Mount_DrillDiode"); drillMountTexture3[2] = texture2D19; Texture2D[] drillMountTexture4 = Main.drillMountTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D20 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Mount_Glow_DrillRing"); drillMountTexture4[3] = texture2D20; Texture2D[] drillMountTexture5 = Main.drillMountTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D21 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Mount_Glow_DrillSeat"); drillMountTexture5[4] = texture2D21; Texture2D[] drillMountTexture6 = Main.drillMountTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D22 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Mount_Glow_DrillDiode"); drillMountTexture6[5] = texture2D22; Texture2D[] scutlixMountTexture1 = Main.scutlixMountTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D23 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Mount_Scutlix"); scutlixMountTexture1[0] = texture2D23; Texture2D[] scutlixMountTexture2 = Main.scutlixMountTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D24 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Mount_ScutlixEyes"); scutlixMountTexture2[1] = texture2D24; Texture2D[] scutlixMountTexture3 = Main.scutlixMountTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D25 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Mount_ScutlixEyeGlow"); scutlixMountTexture3[2] = texture2D25; for (int index31 = 0; index31 < 3930; ++index31) { int index32 = ItemID.Sets.TextureCopyLoad[index31]; if (index32 != -1) { Main.itemTexture[index31] = Main.itemTexture[index32]; } else { Texture2D[] itemTexture = Main.itemTexture; int index33 = index31; object[] objArray7 = new object[4] { (object) "Images", null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray7[1] = (object) directorySeparatorChar2.ToString(); objArray7[2] = (object) "Item_"; objArray7[3] = (object) index31; Texture2D texture2D26 = this.OurLoad(string.Concat(objArray7)); itemTexture[index33] = texture2D26; } } for (int index34 = 0; index34 < Main.gemTexture.Length; ++index34) { Texture2D[] gemTexture = Main.gemTexture; int index35 = index34; object[] objArray8 = new object[4] { (object) "Images", null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray8[1] = (object) directorySeparatorChar2.ToString(); objArray8[2] = (object) "Gem_"; objArray8[3] = (object) index34; Texture2D texture2D27 = this.OurLoad(string.Concat(objArray8)); gemTexture[index35] = texture2D27; } for (int index36 = 0; index36 < 22; ++index36) { Texture2D[] cloudTexture = Main.cloudTexture; int index37 = index36; object[] objArray9 = new object[4] { (object) "Images", null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray9[1] = (object) directorySeparatorChar2.ToString(); objArray9[2] = (object) "Cloud_"; objArray9[3] = (object) index36; Texture2D texture2D28 = this.OurLoad(string.Concat(objArray9)); cloudTexture[index37] = texture2D28; } for (int index38 = 0; index38 < 5; ++index38) { Texture2D[] starTexture = Main.starTexture; int index39 = index38; object[] objArray10 = new object[4] { (object) "Images", null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray10[1] = (object) directorySeparatorChar2.ToString(); objArray10[2] = (object) "Star_"; objArray10[3] = (object) index38; Texture2D texture2D29 = this.OurLoad(string.Concat(objArray10)); starTexture[index39] = texture2D29; } for (int index40 = 0; index40 < 12; ++index40) { Texture2D[] liquidTexture = Main.liquidTexture; int index41 = index40; object[] objArray11 = new object[4] { (object) "Images", null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray11[1] = (object) directorySeparatorChar2.ToString(); objArray11[2] = (object) "Liquid_"; objArray11[3] = (object) index40; Texture2D texture2D30 = this.OurLoad(string.Concat(objArray11)); liquidTexture[index41] = texture2D30; } this.waterfallManager.LoadContent(); Texture2D[] npcToggleTexture1 = Main.npcToggleTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D31 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "House_1"); npcToggleTexture1[0] = texture2D31; Texture2D[] npcToggleTexture2 = Main.npcToggleTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D32 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "House_2"); npcToggleTexture2[1] = texture2D32; Texture2D[] hbLockTexture1 = Main.HBLockTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D33 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Lock_0"); hbLockTexture1[0] = texture2D33; Texture2D[] hbLockTexture2 = Main.HBLockTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D34 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Lock_1"); hbLockTexture2[1] = texture2D34; directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.gridTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Grid"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.trashTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Trash"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.cdTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "CoolDown"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.logoTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Logo"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.logo2Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Logo2"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.dustTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Dust"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.sunTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Sun"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.sun2Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Sun2"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.sun3Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Sun3"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.blackTileTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Black_Tile"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.heartTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Heart"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.heart2Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Heart2"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.bubbleTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Bubble"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.flameTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Flame"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.manaTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Mana"); for (int index42 = 0; index42 < Main.cursorTextures.Length; ++index42) { Texture2D[] cursorTextures = Main.cursorTextures; int index43 = index42; object[] objArray12 = new object[6]; objArray12[0] = (object) "Images"; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray12[1] = (object) directorySeparatorChar2.ToString(); objArray12[2] = (object) "UI"; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray12[3] = (object) directorySeparatorChar2.ToString(); objArray12[4] = (object) "Cursor_"; objArray12[5] = (object) index42; Texture2D texture2D35 = this.OurLoad(string.Concat(objArray12)); cursorTextures[index43] = texture2D35; } string[] strArray7 = new string[5] { "Images", null, null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; strArray7[1] = directorySeparatorChar2.ToString(); strArray7[2] = "UI"; directorySeparatorChar2 = Path.DirectorySeparatorChar; strArray7[3] = directorySeparatorChar2.ToString(); strArray7[4] = "Radial"; Main.cursorRadialTexture = this.OurLoad(string.Concat(strArray7)); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.ninjaTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Ninja"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.antLionTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "AntlionBody"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.spikeBaseTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Spike_Base"); Texture2D[] woodTexture1 = Main.woodTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D36 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Tiles_5_0"); woodTexture1[0] = texture2D36; Texture2D[] woodTexture2 = Main.woodTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D37 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Tiles_5_1"); woodTexture2[1] = texture2D37; Texture2D[] woodTexture3 = Main.woodTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D38 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Tiles_5_2"); woodTexture3[2] = texture2D38; Texture2D[] woodTexture4 = Main.woodTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D39 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Tiles_5_3"); woodTexture4[3] = texture2D39; Texture2D[] woodTexture5 = Main.woodTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D40 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Tiles_5_4"); woodTexture5[4] = texture2D40; Texture2D[] woodTexture6 = Main.woodTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D41 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Tiles_5_5"); woodTexture6[5] = texture2D41; Texture2D[] woodTexture7 = Main.woodTexture; directorySeparatorChar2 = Path.DirectorySeparatorChar; Texture2D texture2D42 = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Tiles_5_6"); woodTexture7[6] = texture2D42; directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.pumpkinMoonTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Moon_Pumpkin"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.snowMoonTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Moon_Snow"); for (int index44 = 0; index44 < Main.moonTexture.Length; ++index44) { Texture2D[] moonTexture = Main.moonTexture; int index45 = index44; object[] objArray13 = new object[4] { (object) "Images", null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray13[1] = (object) directorySeparatorChar2.ToString(); objArray13[2] = (object) "Moon_"; objArray13[3] = (object) index44; Texture2D texture2D43 = this.OurLoad(string.Concat(objArray13)); moonTexture[index45] = texture2D43; } for (int index46 = 0; index46 < Main.treeTopTexture.Length; ++index46) { Texture2D[] treeTopTexture = Main.treeTopTexture; int index47 = index46; object[] objArray14 = new object[4] { (object) "Images", null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray14[1] = (object) directorySeparatorChar2.ToString(); objArray14[2] = (object) "Tree_Tops_"; objArray14[3] = (object) index46; Texture2D texture2D44 = this.OurLoad(string.Concat(objArray14)); treeTopTexture[index47] = texture2D44; } for (int index48 = 0; index48 < Main.treeBranchTexture.Length; ++index48) { Texture2D[] treeBranchTexture = Main.treeBranchTexture; int index49 = index48; object[] objArray15 = new object[4] { (object) "Images", null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray15[1] = (object) directorySeparatorChar2.ToString(); objArray15[2] = (object) "Tree_Branches_"; objArray15[3] = (object) index48; Texture2D texture2D45 = this.OurLoad(string.Concat(objArray15)); treeBranchTexture[index49] = texture2D45; } directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.shroomCapTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Shroom_Tops"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.inventoryBackTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Inventory_Back"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.inventoryBack2Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Inventory_Back2"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.inventoryBack3Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Inventory_Back3"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.inventoryBack4Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Inventory_Back4"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.inventoryBack5Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Inventory_Back5"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.inventoryBack6Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Inventory_Back6"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.inventoryBack7Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Inventory_Back7"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.inventoryBack8Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Inventory_Back8"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.inventoryBack9Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Inventory_Back9"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.inventoryBack10Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Inventory_Back10"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.inventoryBack11Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Inventory_Back11"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.inventoryBack12Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Inventory_Back12"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.inventoryBack13Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Inventory_Back13"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.inventoryBack14Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Inventory_Back14"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.inventoryBack15Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Inventory_Back15"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.inventoryBack16Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Inventory_Back16"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.hairStyleBackTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "HairStyleBack"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.clothesStyleBackTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "ClothesStyleBack"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.inventoryTickOffTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Inventory_Tick_Off"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.inventoryTickOnTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Inventory_Tick_On"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.textBackTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Text_Back"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chatTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chat"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chat2Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chat2"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chatBackTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chat_Back"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.teamTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Team"); PlayerDataInitializer.Load(); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chaosTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chaos"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.EyeLaserTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Eye_Laser"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.BoneEyesTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Bone_Eyes"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.BoneLaserTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Bone_Laser"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.lightDiscTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Light_Disc"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.confuseTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Confuse"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.probeTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Probe"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.sunOrbTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "SunOrb"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.sunAltarTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "SunAltar"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.xmasLightTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "XmasLight"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.beetleTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "BeetleOrb"); for (int index50 = 0; index50 < 17; ++index50) { Texture2D[] chainsTexture = Main.chainsTexture; int index51 = index50; object[] objArray16 = new object[4] { (object) "Images", null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray16[1] = (object) directorySeparatorChar2.ToString(); objArray16[2] = (object) "Chains_"; objArray16[3] = (object) index50; Texture2D texture2D46 = this.OurLoad(string.Concat(objArray16)); chainsTexture[index51] = texture2D46; } directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain20Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain20"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.fishingLineTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "FishingLine"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chainTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain2Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain2"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain3Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain3"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain4Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain4"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain5Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain5"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain6Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain6"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain7Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain7"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain8Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain8"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain9Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain9"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain10Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain10"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain11Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain11"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain12Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain12"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain13Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain13"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain14Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain14"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain15Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain15"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain16Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain16"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain17Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain17"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain18Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain18"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain19Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain19"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain20Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain20"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain21Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain21"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain22Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain22"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain23Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain23"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain24Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain24"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain25Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain25"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain26Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain26"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain27Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain27"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain28Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain28"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain29Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain29"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain30Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain30"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain31Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain31"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain32Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain32"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain33Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain33"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain34Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain34"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain35Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain35"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain36Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain36"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain37Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain37"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain38Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain38"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain39Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain39"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.chain40Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Chain40"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.eyeLaserSmallTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Eye_Laser_Small"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.boneArmTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Arm_Bone"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.pumpkingArmTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "PumpkingArm"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.pumpkingCloakTexture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "PumpkingCloak"); directorySeparatorChar2 = Path.DirectorySeparatorChar; Main.boneArm2Texture = this.OurLoad("Images" + directorySeparatorChar2.ToString() + "Arm_Bone_2"); for (int index52 = 1; index52 < Main.gemChainTexture.Length; ++index52) { Texture2D[] gemChainTexture = Main.gemChainTexture; int index53 = index52; object[] objArray17 = new object[4] { (object) "Images", null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray17[1] = (object) directorySeparatorChar2.ToString(); objArray17[2] = (object) "GemChain_"; objArray17[3] = (object) index52; Texture2D texture2D47 = this.OurLoad(string.Concat(objArray17)); gemChainTexture[index53] = texture2D47; } for (int index54 = 1; index54 < Main.golemTexture.Length; ++index54) { Texture2D[] golemTexture = Main.golemTexture; int index55 = index54; object[] objArray18 = new object[4] { (object) "Images", null, null, null }; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray18[1] = (object) directorySeparatorChar2.ToString(); objArray18[2] = (object) "GolemLights"; objArray18[3] = (object) index54; Texture2D texture2D48 = this.OurLoad(string.Concat(objArray18)); golemTexture[index55] = texture2D48; } Main.npcAltTextures = new Texture2D[Main.npcTexture.Length][]; for (int i = 0; i < NPCID.Sets.ExtraTextureCount.Length; ++i) { int num = NPCID.Sets.ExtraTextureCount[i]; Main.npcAltTextures[i] = new Texture2D[num + 1]; if (num > 0) { this.LoadNPC(i); Main.npcAltTextures[i][0] = Main.npcTexture[i]; } for (int index56 = 1; index56 <= num; ++index56) { Texture2D[] npcAltTexture = Main.npcAltTextures[i]; int index57 = index56; object[] objArray19 = new object[6]; objArray19[0] = (object) "Images"; directorySeparatorChar2 = Path.DirectorySeparatorChar; objArray19[1] = (object) directorySeparatorChar2.ToString(); objArray19[2] = (object) "NPC_"; objArray19[3] = (object) i; objArray19[4] = (object) "_Alt_"; objArray19[5] = (object) index56; Texture2D texture2D49 = this.OurLoad(string.Concat(objArray19)); npcAltTexture[index57] = texture2D49; } } } private static void LoadMusic() { Main.engine = new AudioEngine("Content" + Path.DirectorySeparatorChar.ToString() + "TerrariaMusic.xgs"); Main.soundBank = new SoundBank(Main.engine, "Content" + Path.DirectorySeparatorChar.ToString() + "Sound Bank.xsb"); Main.waveBank = new WaveBank(Main.engine, "Content" + Path.DirectorySeparatorChar.ToString() + "Wave Bank.xwb"); for (int index = 1; index < 42; ++index) Main.music[index] = Main.soundBank.GetCue("Music_" + (object) index); } private void LoadSounds() { Main.soundMech[0] = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Mech_0"); Main.soundInstanceMech[0] = Main.soundMech[0].CreateInstance(); Main.soundGrab = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Grab"); Main.soundInstanceGrab = Main.soundGrab.CreateInstance(); Main.soundPixie = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Pixie"); Main.soundInstancePixie = Main.soundGrab.CreateInstance(); Main.soundDig[0] = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Dig_0"); Main.soundInstanceDig[0] = Main.soundDig[0].CreateInstance(); Main.soundDig[1] = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Dig_1"); Main.soundInstanceDig[1] = Main.soundDig[1].CreateInstance(); Main.soundDig[2] = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Dig_2"); Main.soundInstanceDig[2] = Main.soundDig[2].CreateInstance(); Main.soundTink[0] = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Tink_0"); Main.soundInstanceTink[0] = Main.soundTink[0].CreateInstance(); Main.soundTink[1] = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Tink_1"); Main.soundInstanceTink[1] = Main.soundTink[1].CreateInstance(); Main.soundTink[2] = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Tink_2"); Main.soundInstanceTink[2] = Main.soundTink[2].CreateInstance(); Main.soundPlayerHit[0] = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Player_Hit_0"); Main.soundInstancePlayerHit[0] = Main.soundPlayerHit[0].CreateInstance(); Main.soundPlayerHit[1] = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Player_Hit_1"); Main.soundInstancePlayerHit[1] = Main.soundPlayerHit[1].CreateInstance(); Main.soundPlayerHit[2] = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Player_Hit_2"); Main.soundInstancePlayerHit[2] = Main.soundPlayerHit[2].CreateInstance(); Main.soundFemaleHit[0] = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Female_Hit_0"); Main.soundInstanceFemaleHit[0] = Main.soundFemaleHit[0].CreateInstance(); Main.soundFemaleHit[1] = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Female_Hit_1"); Main.soundInstanceFemaleHit[1] = Main.soundFemaleHit[1].CreateInstance(); Main.soundFemaleHit[2] = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Female_Hit_2"); Main.soundInstanceFemaleHit[2] = Main.soundFemaleHit[2].CreateInstance(); Main.soundPlayerKilled = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Player_Killed"); Main.soundInstancePlayerKilled = Main.soundPlayerKilled.CreateInstance(); Main.soundChat = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Chat"); Main.soundInstanceChat = Main.soundChat.CreateInstance(); Main.soundGrass = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Grass"); Main.soundInstanceGrass = Main.soundGrass.CreateInstance(); Main.soundDoorOpen = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Door_Opened"); Main.soundInstanceDoorOpen = Main.soundDoorOpen.CreateInstance(); Main.soundDoorClosed = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Door_Closed"); Main.soundInstanceDoorClosed = Main.soundDoorClosed.CreateInstance(); Main.soundMenuTick = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Menu_Tick"); Main.soundInstanceMenuTick = Main.soundMenuTick.CreateInstance(); Main.soundMenuOpen = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Menu_Open"); Main.soundInstanceMenuOpen = Main.soundMenuOpen.CreateInstance(); Main.soundMenuClose = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Menu_Close"); Main.soundInstanceMenuClose = Main.soundMenuClose.CreateInstance(); Main.soundShatter = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Shatter"); Main.soundInstanceShatter = Main.soundShatter.CreateInstance(); Main.soundCamera = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Camera"); Main.soundInstanceCamera = Main.soundShatter.CreateInstance(); for (int index = 0; index < Main.soundCoin.Length; ++index) { Main.soundCoin[index] = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Coin_" + (object) index); Main.soundInstanceCoin[index] = Main.soundCoin[index].CreateInstance(); } for (int index = 0; index < Main.soundDrip.Length; ++index) { Main.soundDrip[index] = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Drip_" + (object) index); Main.soundInstanceDrip[index] = Main.soundDrip[index].CreateInstance(); } for (int index = 0; index < Main.soundZombie.Length; ++index) { Main.soundZombie[index] = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Zombie_" + (object) index); Main.soundInstanceZombie[index] = Main.soundZombie[index].CreateInstance(); } for (int index = 0; index < Main.soundLiquid.Length; ++index) { Main.soundLiquid[index] = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Liquid_" + (object) index); Main.soundInstanceLiquid[index] = Main.soundLiquid[index].CreateInstance(); } for (int index = 0; index < Main.soundRoar.Length; ++index) { Main.soundRoar[index] = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Roar_" + (object) index); Main.soundInstanceRoar[index] = Main.soundRoar[index].CreateInstance(); } Main.soundSplash[0] = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Splash_0"); Main.soundInstanceSplash[0] = Main.soundRoar[0].CreateInstance(); Main.soundSplash[1] = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Splash_1"); Main.soundInstanceSplash[1] = Main.soundSplash[1].CreateInstance(); Main.soundDoubleJump = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Double_Jump"); Main.soundInstanceDoubleJump = Main.soundRoar[0].CreateInstance(); Main.soundRun = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Run"); Main.soundInstanceRun = Main.soundRun.CreateInstance(); Main.soundCoins = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Coins"); Main.soundInstanceCoins = Main.soundCoins.CreateInstance(); Main.soundUnlock = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Unlock"); Main.soundInstanceUnlock = Main.soundUnlock.CreateInstance(); Main.soundMaxMana = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "MaxMana"); Main.soundInstanceMaxMana = Main.soundMaxMana.CreateInstance(); Main.soundDrown = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Drown"); Main.soundInstanceDrown = Main.soundDrown.CreateInstance(); for (int index = 1; index < 126; ++index) { Main.soundItem[index] = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Item_" + (object) index); Main.soundInstanceItem[index] = Main.soundItem[index].CreateInstance(); } for (int index = 1; index < 58; ++index) { Main.soundNPCHit[index] = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "NPC_Hit_" + (object) index); Main.soundInstanceNPCHit[index] = Main.soundNPCHit[index].CreateInstance(); } for (int index = 1; index < 63; ++index) { Main.soundNPCKilled[index] = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "NPC_Killed_" + (object) index); Main.soundInstanceNPCKilled[index] = Main.soundNPCKilled[index].CreateInstance(); } Main.trackableSounds = new SoundEffect[SoundID.TrackableLegacySoundCount]; Main.trackableSoundInstances = new SoundEffectInstance[Main.trackableSounds.Length]; for (int id = 0; id < Main.trackableSounds.Length; ++id) { Main.trackableSounds[id] = this.OurLoad("Sounds" + Path.DirectorySeparatorChar.ToString() + "Custom" + Path.DirectorySeparatorChar.ToString() + SoundID.GetTrackableLegacySoundPath(id)); Main.trackableSoundInstances[id] = Main.trackableSounds[id].CreateInstance(); } Main.soundInstanceMoonlordCry = Main.soundNPCKilled[10].CreateInstance(); } protected override void UnloadContent() { } public static void stopMoonEvent() { 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; 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; NetMessage.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; 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; NetMessage.BroadcastChatMessage(invasionWaveText, new Microsoft.Xna.Framework.Color(175, 75, (int) byte.MaxValue)); } } protected void UpdateAudio() { if (!Main.dedServ) { bool flag = (!Main.hasFocus || Main.gamePaused) && Main.netMode == 0; if (flag) { foreach (SlotVector.ItemPair trackedSound in (IEnumerable.ItemPair>) Main._trackedSounds) ((ActiveSound) trackedSound.Value).Pause(); } else if (Main._areSoundsPaused && !flag) { foreach (SlotVector.ItemPair trackedSound in (IEnumerable.ItemPair>) Main._trackedSounds) ((ActiveSound) trackedSound.Value).Resume(); } Main._areSoundsPaused = flag; if (!Main._areSoundsPaused) { foreach (SlotVector.ItemPair trackedSound in (IEnumerable.ItemPair>) Main._trackedSounds) { ((ActiveSound) trackedSound.Value).Update(); if (!((ActiveSound) trackedSound.Value).IsPlaying) Main._trackedSounds.Remove((SlotId) trackedSound.Id); } } } if ((double) Main.musicVolume == 0.0) Main.curMusic = 0; try { if (Main.dedServ) return; if (Main.curMusic > 0) { if (!this.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) { } } } } for (int index = 0; index < Main.soundInstanceLiquid.Length; ++index) Main.soundInstanceLiquid[index].Stop(); } 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) { } } } } } } 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; Microsoft.Xna.Framework.Rectangle rectangle1 = new Microsoft.Xna.Framework.Rectangle((int) Main.screenPosition.X, (int) Main.screenPosition.Y, Main.screenWidth, Main.screenHeight); int num1 = 5000; for (int index = 0; index < 200; ++index) { if (Main.npc[index].active) { 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: num2 = 11; break; case 113: case 114: case 125: case 126: num2 = 2; break; case 134: case 143: case 144: case 145: case 266: num2 = 3; break; case 212: case 213: case 214: case 215: case 216: case 491: num2 = 8; break; case 222: num2 = 5; break; case 245: num2 = 4; break; case 262: case 263: case 264: num2 = 6; 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) { num2 = 4; break; } break; case 439: num2 = 4; 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_88; case 2: flag2 = true; goto label_88; case 3: flag3 = true; goto label_88; case 4: flag4 = true; goto label_88; case 5: flag5 = true; goto label_88; case 6: flag6 = true; goto label_88; case 7: flag7 = true; goto label_88; case 8: flag8 = true; goto label_88; case 9: flag9 = true; goto label_88; case 10: flag10 = true; goto label_88; case 11: flag11 = true; goto label_88; case 12: flag12 = true; goto label_88; default: goto label_88; } } } } } label_88: int num3 = (int) (((double) Main.screenPosition.X + (double) (Main.screenWidth / 2)) / 16.0); if ((double) Main.musicVolume == 0.0) this.newMusic = 0; else if (Main.gameMenu) { this.newMusic = Main.netMode == 2 ? 0 : 6; } 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 = 38; else if (flag9) this.newMusic = 37; else if (flag10) this.newMusic = 34; else if (flag6) this.newMusic = 24; 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 (flag8) this.newMusic = 35; else if (flag11) this.newMusic = 39; else if (flag12) this.newMusic = 41; else if (Main.player[Main.myPlayer].ZoneSandstorm) this.newMusic = 40; else if ((double) Main.player[Main.myPlayer].position.Y > (double) ((Main.maxTilesY - 200) * 16)) this.newMusic = 36; else if (Main.eclipse && (double) Main.player[Main.myPlayer].position.Y < Main.worldSurface * 16.0 + (double) (Main.screenHeight / 2)) this.newMusic = 27; else if ((double) num6 < 1.0) this.newMusic = 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 == (byte) 87) this.newMusic = 26; else if (Main.bgStyle == 9 && (double) Main.player[Main.myPlayer].position.Y < Main.worldSurface * 16.0 + (double) (Main.screenHeight / 2) || Main.ugBack == 2) this.newMusic = 29; else if (Main.player[Main.myPlayer].ZoneCorrupt) this.newMusic = (double) Main.player[Main.myPlayer].position.Y <= Main.worldSurface * 16.0 + (double) (Main.screenHeight / 2) ? 8 : 10; 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].ZoneDungeon) this.newMusic = 23; else if (Main.player[Main.myPlayer].ZoneMeteor) this.newMusic = 2; else if (Main.player[Main.myPlayer].ZoneJungle) this.newMusic = 7; 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)) { if (Main.player[Main.myPlayer].ZoneHoly) this.newMusic = 11; else if (Main.sandTiles > 2200) { this.newMusic = 21; } 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].ZoneHoly) this.newMusic = (double) Main.cloudAlpha <= 0.0 || Main.gameMenu ? 9 : 19; else if ((double) Main.screenPosition.Y / 16.0 < Main.worldSurface + 10.0 && (num3 < 380 || num3 > Main.maxTilesX - 380)) this.newMusic = 22; else if (Main.sandTiles > 1000) this.newMusic = 21; else if (Main.dayTime) { if ((double) Main.cloudAlpha > 0.0 && !Main.gameMenu) { this.newMusic = 19; } else { if (Main.dayMusic == 0) Main.dayMusic = 1; if (!Main.music[1].IsPlaying && !Main.music[18].IsPlaying) { switch (Main.rand.Next(2)) { case 0: Main.dayMusic = 1; break; case 1: Main.dayMusic = 18; break; } } this.newMusic = Main.dayMusic; } } 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) this.newMusic = 32; } if (Main.gameMenu || (double) Main.musicVolume == 0.0) { Main.musicBox2 = -1; Main.musicBox = -1; } if (Main.musicBox2 >= 0) Main.musicBox = Main.musicBox2; if (Main.musicBox >= 0) { if (Main.musicBox == 0) this.newMusic = 1; if (Main.musicBox == 1) this.newMusic = 2; if (Main.musicBox == 2) this.newMusic = 3; if (Main.musicBox == 4) this.newMusic = 4; if (Main.musicBox == 5) this.newMusic = 5; if (Main.musicBox == 3) this.newMusic = 6; if (Main.musicBox == 6) this.newMusic = 7; if (Main.musicBox == 7) this.newMusic = 8; if (Main.musicBox == 9) this.newMusic = 9; if (Main.musicBox == 8) this.newMusic = 10; if (Main.musicBox == 11) this.newMusic = 11; if (Main.musicBox == 10) this.newMusic = 12; if (Main.musicBox == 12) this.newMusic = 13; if (Main.musicBox == 13) this.newMusic = 14; if (Main.musicBox == 14) this.newMusic = 15; if (Main.musicBox == 15) this.newMusic = 16; if (Main.musicBox == 16) this.newMusic = 17; if (Main.musicBox == 17) this.newMusic = 18; if (Main.musicBox == 18) this.newMusic = 19; if (Main.musicBox == 19) this.newMusic = 20; if (Main.musicBox == 20) this.newMusic = 21; if (Main.musicBox == 21) this.newMusic = 22; if (Main.musicBox == 22) this.newMusic = 23; if (Main.musicBox == 23) this.newMusic = 24; if (Main.musicBox == 24) this.newMusic = 25; if (Main.musicBox == 25) this.newMusic = 26; if (Main.musicBox == 26) this.newMusic = 27; if (Main.musicBox == 27) this.newMusic = 29; if (Main.musicBox == 28) this.newMusic = 30; if (Main.musicBox == 29) this.newMusic = 31; if (Main.musicBox == 30) this.newMusic = 32; if (Main.musicBox == 31) this.newMusic = 33; if (Main.musicBox == 32) this.newMusic = 38; if (Main.musicBox == 33) this.newMusic = 37; if (Main.musicBox == 34) this.newMusic = 35; if (Main.musicBox == 35) this.newMusic = 36; if (Main.musicBox == 36) this.newMusic = 34; if (Main.musicBox == 37) this.newMusic = 39; if (Main.musicBox == 38) this.newMusic = 40; if (Main.musicBox == 39) this.newMusic = 41; } Main.curMusic = this.newMusic; float num7 = 1f; if (NPC.MoonLordCountdown > 0) { float num8 = (float) NPC.MoonLordCountdown / 3600f; float amount = num8 * num8; if (NPC.MoonLordCountdown > 720) { num7 = MathHelper.Lerp(0.0f, 1f, amount); } else { num7 = 0.0f; Main.curMusic = 0; } if (NPC.MoonLordCountdown == 1 && Main.curMusic >= 1 && Main.curMusic < 42) Main.musicFade[Main.curMusic] = 0.0f; } for (int index = 1; index < 42; ++index) { if (index == 28) { 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) { 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); } 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); } } else if (Main.music[index].IsPlaying) { 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].Stop(AudioStopOptions.Immediate); } else Main.music[index].SetVariable("Volume", Main.musicFade[index] * Main.ambientVolume); } else Main.musicFade[index] = 0.0f; } else if (index == Main.curMusic) { 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.musicVolume * num7); } 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.musicVolume * num7); } } else if (Main.music[index].IsPlaying) { 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].Stop(AudioStopOptions.Immediate); } else Main.music[index].SetVariable("Volume", Main.musicFade[index] * Main.musicVolume * num7); } 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 void snowing() { if (Main.gamePaused || Main.snowTiles <= 0 || (double) Main.player[Main.myPlayer].position.Y >= Main.worldSurface * 16.0) return; int maxValue = 800 / Main.snowTiles; int num1 = (int) ((double) (int) (500.0 * (double) ((float) Main.screenWidth / (float) Main.maxScreenW)) * (1.0 + 2.0 * (double) Main.cloudAlpha)); float num2 = (float) (1.0 + 50.0 * (double) Main.cloudAlpha); for (int index1 = 0; (double) index1 < (double) num2; ++index1) { try { if ((double) Main.snowDust >= (double) num1 * ((double) Main.gfxQuality / 2.0 + 0.5) + (double) num1 * 0.100000001490116) break; if (Main.rand.Next(maxValue) == 0) { int num3 = Main.rand.Next(Main.screenWidth + 1000) - 500; int num4 = (int) Main.screenPosition.Y - Main.rand.Next(50); if ((double) Main.player[Main.myPlayer].velocity.Y > 0.0) num4 -= (int) Main.player[Main.myPlayer].velocity.Y; if (Main.rand.Next(5) == 0) num3 = Main.rand.Next(500) - 500; else if (Main.rand.Next(5) == 0) num3 = Main.rand.Next(500) + Main.screenWidth; if (num3 < 0 || num3 > Main.screenWidth) num4 += Main.rand.Next((int) ((double) Main.screenHeight * 0.8)) + (int) ((double) Main.screenHeight * 0.1); int num5 = num3 + (int) Main.screenPosition.X; int index2 = num5 / 16; int index3 = num4 / 16; if (Main.tile[index2, index3] != null) { if (Main.tile[index2, index3].wall == (byte) 0) { int index4 = Dust.NewDust(new Vector2((float) num5, (float) num4), 10, 10, 76); Main.dust[index4].scale += Main.cloudAlpha * 0.2f; Main.dust[index4].velocity.Y = (float) (3.0 + (double) Main.rand.Next(30) * 0.100000001490116); Main.dust[index4].velocity.Y *= Main.dust[index4].scale; if (!Main.raining) { Main.dust[index4].velocity.X = Main.windSpeed + (float) Main.rand.Next(-10, 10) * 0.1f; Main.dust[index4].velocity.X += (float) ((double) Main.windSpeed * (double) Main.cloudAlpha * 10.0); } else { Main.dust[index4].velocity.X = (float) (Math.Sqrt((double) Math.Abs(Main.windSpeed)) * (double) Math.Sign(Main.windSpeed) * ((double) Main.cloudAlpha + 0.5) * 25.0 + (double) Main.rand.NextFloat() * 0.200000002980232 - 0.100000001490116); Main.dust[index4].velocity.Y *= 0.5f; } Main.dust[index4].velocity.Y *= (float) (1.0 + 0.300000011920929 * (double) Main.cloudAlpha); Main.dust[index4].scale += Main.cloudAlpha * 0.2f; Main.dust[index4].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; if (day >= 15 && month == 12) Main.xMas = true; else Main.xMas = false; } public static void checkHalloween() { DateTime now = DateTime.Now; int day = now.Day; int month = now.Month; if (day >= 20 && month == 10) Main.halloween = true; else if (day <= 1 && month == 11) Main.halloween = true; else Main.halloween = false; } public void updateCloudLayer() { switch (Main.netMode) { case 0: if (Main.gameMenu) return; break; case 1: return; } int num1 = 86400; int num2 = num1 / 24; float num3 = 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 / num3; if ((double) Main.cloudBGActive < 1.0) Main.cloudBGActive = 1f; if ((double) Main.cloudBGActive != 1.0 || Main.rand.Next((int) ((double) (num2 * 2 / Math.Max(Main.dayRate, 1)) * (double) num3)) != 0) return; Main.cloudBGActive = (float) -Main.rand.Next(num2 * 4, num1 * 4); if (Main.netMode != 2) return; NetMessage.SendData(7); } else { if ((double) Main.cloudBGActive < 0.0) { Main.cloudBGActive += (float) Main.dayRate * num3; if (Main.raining) Main.cloudBGActive += (float) (2 * Main.dayRate) * num3; } if ((double) Main.cloudBGActive > 0.0) Main.cloudBGActive = 0.0f; if ((double) Main.cloudBGActive != 0.0 || Main.rand.Next((int) ((double) (num2 * 8 / (Main.dayRate == 0 ? 1 : Main.dayRate)) / (double) num3)) != 0) return; Main.cloudBGActive = (float) Main.rand.Next(num2 * 3, num1 * 2); 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) { switch (Style) { case 0: Main.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: Main.PlaySound(SoundID.Item8, effectRect.X + effectRect.Width / 2, effectRect.Y + effectRect.Height / 2); int num2 = effectRect.Width * effectRect.Height / 5; 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: for (int index = 0; index < 50; ++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: Main.PlaySound(SoundID.Item6, effectRect.X + effectRect.Width / 2, effectRect.Y + effectRect.Height / 2); for (int index5 = 0; index5 < 50; ++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: Main.PlaySound(SoundID.Item8, effectRect.X + effectRect.Width / 2, effectRect.Y + effectRect.Height / 2); int num3 = (int) ((double) (effectRect.Width * effectRect.Height / 5) * (double) dustCountMult); for (int index = 0; index < num3; ++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; } } public static void Ambience() { ++Main.ambientCounter; if (Main.ambientCounter < 15) return; Main.ambientCounter = 0; Main.PlaySound(34, (int) Main.ambientWaterfallX, (int) Main.ambientWaterfallY, (int) Main.ambientWaterfallStrength); 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; Main.PlaySound(35, (int) num3, (int) num4, (int) num6); } public static void 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) { 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) { 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 num1 = 0; for (int index3 = 0; index3 < 3; ++index3) { switch (index3) { case 0: num1 = 24; break; case 1: num1 = 31; break; case 2: num1 = 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] >= num1) 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) { byte num2 = 5; if (Main.fishBowlFrameMode[index] == (byte) 1) { if (Main.rand.Next(900) == 0) Main.fishBowlFrameMode[index] = (byte) Main.rand.Next((int) num2); ++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) num2); ++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) num2); ++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) num2); ++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 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 num3 = Main.rand.Next(3, 16); if (Main.butterflyCageMode[index5, index6] == (byte) 1 || Main.butterflyCageMode[index5, index6] == (byte) 11) num3 = 3; if (Main.butterflyCageMode[index5, index6] == (byte) 2 || Main.butterflyCageMode[index5, index6] == (byte) 12) num3 = 5; if (Main.butterflyCageMode[index5, index6] == (byte) 3 || Main.butterflyCageMode[index5, index6] == (byte) 13) num3 = 10; if (Main.butterflyCageMode[index5, index6] == (byte) 4 || Main.butterflyCageMode[index5, index6] == (byte) 14) num3 = 15; if (Main.butterflyCageMode[index5, index6] >= (byte) 10) { if (Main.butterflyCageFrame[index5, index6] <= 7) { if (Main.butterflyCageFrameCounter[index5, index6] >= num3) { 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] >= num3) { 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] >= num3) { 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] >= num3) { 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; } } } 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 num4 = 1; if (Main.jellyfishCageMode[index7, index8] == (byte) 0) num4 = Main.rand.Next(10, 20); if (Main.jellyfishCageMode[index7, index8] == (byte) 1) num4 = Main.rand.Next(15, 25); if (Main.jellyfishCageMode[index7, index8] == (byte) 2) num4 = Main.rand.Next(4, 9); if (Main.jellyfishCageMode[index7, index8] == (byte) 3) num4 = Main.rand.Next(15, 25); if (Main.jellyfishCageMode[index7, index8] == (byte) 0 && Main.jellyfishCageFrame[index7, index8] <= 3 && Main.jellyfishCageFrameCounter[index7, index8] >= num4) { 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] >= num4) { 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] >= num4) { 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] >= num4) { 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; } } } } } 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 int TextMaxLengthForScreen => Main.screenWidth - 320; public void CrazyTestMemoryLimit() { if (!this._crazyTestedMemoryLimit) { this._crazyTestedMemoryLimit = true; this._crazyTestArrayMemoryLimit = new Player[50000]; for (int index = 0; index < this._crazyTestArrayMemoryLimit.Length; ++index) this._crazyTestArrayMemoryLimit[index] = new Player(); } int index1 = Main.rand.Next(this._crazyTestArrayMemoryLimit.Length); Main.NewText("testing " + (object) index1 + " " + this._crazyTestArrayMemoryLimit[index1].name); } protected override void Update(GameTime gameTime) { if (!Main.IsEnginePreloaded) { Main.IsEnginePreloaded = true; if (Main.OnEnginePreload != null) Main.OnEnginePreload(); } if (this._isDrawingOrUpdating) return; 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; } public void UpdateViewZoomKeys() { 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); } protected void DoUpdate(GameTime gameTime) { Main.ignoreErrors = true; PartySky.MultipleSkyWorkaroundFix = true; TimeSpan timeSpan; if (!Main.GlobalTimerPaused) { timeSpan = gameTime.TotalGameTime; Main.GlobalTime = (float) (timeSpan.TotalSeconds % 3600.0); } if (Player.StopMoneyTroughFromWorking > 0 && !Main.mouseRight && Main.mouseRightRelease) --Player.StopMoneyTroughFromWorking; PlayerInput.SetZoom_UI(); if (!Main.gameMenu || Main.menuMode != 888) Main.MenuUI.SetState((UIState) null); else Main.InGameUI.SetState((UIState) null); if (Main.MenuUI != null) Main.MenuUI.Update(gameTime); if (Main.InGameUI != null) Main.InGameUI.Update(gameTime); PlayerInput.SetZoom_Unscaled(); Main.MouseOversTryToClear(); PlayerInput.ResetInputsOnActiveStateChange(); if (Main.OnTick != null) Main.OnTick(); if (Main._hasPendingNetmodeChange) { Main.netMode = Main._targetNetMode; Main._hasPendingNetmodeChange = false; } if (CaptureManager.Instance.IsCapturing) return; if (Main.ActivePlayerFileData != null) Main.ActivePlayerFileData.UpdatePlayTimer(); if (Main.expertMode) { Main.damageMultiplier = Main.expertDamage; Main.knockBackMultiplier = Main.expertKnockBack; } else { Main.damageMultiplier = 1f; Main.knockBackMultiplier = 1f; } Main.gameInactive = !this.IsActive; if (Main.chTitle) { Main.chTitle = false; this.SetTitle(); } Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); 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; } } if (!Main.dedServ) { 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.DoUpdate_AutoSave(); ++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; Filters.Scene.Update(gameTime); Overlays.Scene.Update(gameTime); SkyManager.Instance.Update(gameTime); LiquidRenderer.Instance.Update(gameTime); this.UpdateAudio(); AchievementCompleteUI.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.maxLiquid = (int) (2500.0 + 2500.0 * (double) Main.gfxQuality); Terraria.Liquid.cycles = (int) (17.0 - 10.0 * (double) Main.gfxQuality); } if (Main.superFast) { Main.graphics.SynchronizeWithVerticalRetrace = false; Main.drawSkip = false; } Lighting.maxRenderCount = (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.maxLiquid = Terraria.Liquid.resLiquid; Terraria.Liquid.cycles = 1; } Main.hasFocus = this.IsActive; Main.hasFocus = Form.ActiveForm == Control.FromHandle(this.Window.Handle) as Form; if (!Main.gameMenu || Main.netMode == 2) { WorldFile.tempRaining = Main.raining; WorldFile.tempRainTime = Main.rainTime; WorldFile.tempMaxRain = Main.maxRaining; } 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; 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.DoUpdate_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(); } if (Main.netMode == 2) Main.cloudAlpha = Main.maxRaining; if (this.IsActive && (double) Main.cloudAlpha > 0.0) Rain.MakeRain(); if (Main.netMode != 1) this.updateCloudLayer(); this.UpdateWeather(gameTime); Main.Ambience(); if (Main.netMode != 2) { if (Main.ignoreErrors) { try { Main.snowing(); } catch { } } else Main.snowing(); Sandstorm.EmitDust(); } if (Main.netMode == 1) { for (int index = 0; index < 59; ++index) { if (Main.player[Main.myPlayer].inventory[index].IsNotTheSameAs(Main.clientPlayer.inventory[index])) 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(Main.clientPlayer.armor[index])) 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(Main.clientPlayer.miscEquips[index])) 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(Main.clientPlayer.miscDyes[index])) 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(Main.clientPlayer.bank.item[index])) 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(Main.clientPlayer.bank2.item[index])) 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(Main.clientPlayer.trashItem)) 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(Main.clientPlayer.bank3.item[index])) 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].dye.Length; ++index) { if (Main.player[Main.myPlayer].dye[index].IsNotTheSameAs(Main.clientPlayer.dye[index])) 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 != Main.clientPlayer.chest && Main.player[Main.myPlayer].chest < 0) { if (Main.player[Main.myPlayer].editedChestName) { if (Main.chest[Main.clientPlayer.chest] != null) NetMessage.SendData(33, text: NetworkText.FromLiteral(Main.chest[Main.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 != Main.clientPlayer.talkNPC) NetMessage.SendData(40, number: Main.myPlayer); bool flag1 = false; if ((int) (byte) Main.player[Main.myPlayer].zone1 != (int) (byte) Main.clientPlayer.zone1) flag1 = true; if ((int) (byte) Main.player[Main.myPlayer].zone2 != (int) (byte) Main.clientPlayer.zone2) flag1 = true; if ((int) (byte) Main.player[Main.myPlayer].zone3 != (int) (byte) Main.clientPlayer.zone3) flag1 = true; if ((int) (byte) Main.player[Main.myPlayer].zone4 != (int) (byte) Main.clientPlayer.zone4) flag1 = true; if (flag1) NetMessage.SendData(36, number: Main.myPlayer); if (Main.player[Main.myPlayer].statLife != Main.clientPlayer.statLife || Main.player[Main.myPlayer].statLifeMax != Main.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 != Main.clientPlayer.statMana || Main.player[Main.myPlayer].statManaMax != Main.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 flag2 = false; for (int index = 0; index < 22; ++index) { if (Main.player[Main.myPlayer].buffType[index] != Main.clientPlayer.buffType[index]) flag2 = true; } if (flag2) { NetMessage.SendData(50, number: Main.myPlayer); NetMessage.SendData(13, number: Main.myPlayer); } bool flag3 = false; if (Main.player[Main.myPlayer].MinionRestTargetPoint != Main.clientPlayer.MinionRestTargetPoint) flag3 = true; if (flag3) NetMessage.SendData(99, number: Main.myPlayer); bool flag4 = false; if (Main.player[Main.myPlayer].MinionAttackTargetNPC != Main.clientPlayer.MinionAttackTargetNPC) flag4 = true; if (flag4) NetMessage.SendData(115, number: Main.myPlayer); } if (Main.netMode == 1) Main.clientPlayer = (Player) Main.player[Main.myPlayer].clientClone(); if (Main.netMode == 0 && (Main.playerInventory || Main.npcChatText != "" || Main.player[Main.myPlayer].sign >= 0 || Main.ingameOptionsWindow || Main.inFancyUI) && Main.autoPause) { 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) { 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; Main.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; Main.player[Main.myPlayer].lastChest = Main.player[Main.myPlayer].chest; if (Main.playerInventory) Main.player[Main.myPlayer].AdjTiles(); Main.gamePaused = true; } else { Main.gamePaused = false; if (!Main.dedServ && (double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0 && Main.netMode != 2) { Star.UpdateStars(); Cloud.UpdateClouds(); } PortalHelper.UpdatePortalPoints(); Main.tileSolid[379] = false; Main.ActivePlayersCount = 0; for (int i = 0; i < (int) byte.MaxValue; ++i) { if (Main.ignoreErrors) { try { Main.player[i].Update(i); } catch { } } else Main.player[i].Update(i); } ++Main._gameUpdateCount; 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].activeNPCs = 0.0f; Main.player[index].townNPCs = 0.0f; } if (Main.wof >= 0 && !Main.npc[Main.wof].active) Main.wof = -1; if (NPC.golemBoss >= 0 && !Main.npc[NPC.golemBoss].active) NPC.golemBoss = -1; if (NPC.plantBoss >= 0 && !Main.npc[NPC.plantBoss].active) NPC.plantBoss = -1; if (NPC.crimsonBoss >= 0 && !Main.npc[NPC.crimsonBoss].active) NPC.crimsonBoss = -1; NPC.taxCollector = false; NPC.ClearFoundActiveNPCs(); NPC.UpdateFoundActiveNPCs(); FixExploitManEaters.Update(); for (int i = 0; i < 200; ++i) { if (Main.ignoreErrors) { try { Main.npc[i].UpdateNPC(i); } catch (Exception ex) { Main.npc[i] = new NPC(); } } else Main.npc[i].UpdateNPC(i); } for (int index = 0; index < 500; ++index) { if (Main.ignoreErrors) { try { Main.gore[index].Update(); } catch { Main.gore[index] = new Gore(); } } else Main.gore[index].Update(); } LockOnHelper.SetUP(); 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; LockOnHelper.SetDOWN(); 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(); ItemText.UpdateItemText(); } if (Main.ignoreErrors) { try { Main.UpdateTime(); } catch { Main.checkForSpawns = 0; } } else Main.UpdateTime(); Main.tileSolid[379] = true; 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(); } if (Main.ignoreErrors) { try { for (int index = 0; index < Main.numChatLines; ++index) { if (Main.chatLine[index].showTime > 0) --Main.chatLine[index].showTime; } } catch { for (int index = 0; index < Main.numChatLines; ++index) Main.chatLine[index] = new ChatLine(); } } else { for (int index = 0; index < Main.numChatLines; ++index) { if (Main.chatLine[index].showTime > 0) --Main.chatLine[index].showTime; } } timeSpan = stopwatch.Elapsed; Main.upTimer = (float) timeSpan.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(); if ((double) Main.cameraLerp > 0.0) { ++Main.cameraLerpTimer; if (Main.cameraLerpTimer >= Main.cameraLerpTimeToggle) Main.cameraLerp += (float) ((Main.cameraLerpTimer - Main.cameraLerpTimeToggle) / 3 + 1) * (1f / 1000f); if ((double) Main.cameraLerp > 1.0) Main.cameraLerp = 1f; } base.Update(gameTime); } } private static void DoUpdate_AnimateCursorColors() { Main.CursorColor(); Main.mouseTextColor += (byte) Main.mouseTextColorChange; if (Main.mouseTextColor >= (byte) 250) Main.mouseTextColorChange = -4; if (Main.mouseTextColor > (byte) 175) return; Main.mouseTextColorChange = 4; } 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) && Main.netMode == 1 && !Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.LeftAlt) && !Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.RightAlt) && Main.hasFocus) { if (Main.chatRelease && !Main.drawingPlayerChat && !Main.editSign && !Main.editChest && !Main.gameMenu && !Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Escape)) { Main.PlaySound(10); Main.drawingPlayerChat = true; Main.clrInput(); Main.chatText = ""; } Main.chatRelease = false; } else Main.chatRelease = true; } private static void DoUpdate_HandleChat() { if (Main.editSign) Main.drawingPlayerChat = false; if (!Main.drawingPlayerChat) { Main.startChatLine = 0; } else { Main.showCount = (int) ((double) (Main.screenHeight / 3) / (double) Main.fontMouseText.MeasureString("1").Y) - 1; if (Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Up)) { ++Main.startChatLine; if (Main.startChatLine + Main.showCount >= Main.numChatLines - 1) Main.startChatLine = Main.numChatLines - Main.showCount - 1; if (Main.chatLine[Main.startChatLine + Main.showCount].text == "") --Main.startChatLine; } else if (Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Down)) { --Main.startChatLine; if (Main.startChatLine < 0) Main.startChatLine = 0; } if (Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Escape)) Main.drawingPlayerChat = false; string chatText1 = Main.chatText; Main.chatText = Main.GetInputText(Main.chatText); int num = (int) ((double) Main.screenWidth * (1.0 / (double) Main.UIScale)) - 330; if (chatText1 != Main.chatText) { while ((double) ChatManager.GetStringSize(Main.fontMouseText, Main.chatText, Vector2.One).X > (double) num) Main.chatText = Main.chatText.Substring(0, Main.chatText.Length - 1); } if (chatText1 != Main.chatText) Main.PlaySound(12); if (!Main.inputTextEnter || !Main.chatRelease) return; if (Main.chatText != "") { ChatMessage chatMessage = new ChatMessage(Main.chatText); ChatManager.Commands.ProcessOutgoingMessage(chatMessage); NetMessage.SendChatMessageFromClient(chatMessage); if (Main.netMode == 0) { Microsoft.Xna.Framework.Color color = Main.player[Main.myPlayer].ChatColor(); string chatText2 = Main.chatText; string text = NameTagHandler.GenerateTag(Main.player[Main.myPlayer].name) + " " + Main.chatText; Main.player[Main.myPlayer].chatOverhead.NewMessage(Main.chatText, Main.chatLength / 2); Microsoft.Xna.Framework.Color c = color; int maxLengthForScreen = Main.TextMaxLengthForScreen; Main.NewTextMultiline(text, c: c, WidthLimit: maxLengthForScreen); } } Main.chatText = ""; Main.drawingPlayerChat = false; Main.chatRelease = false; PlayerInput.WritingText = true; Main.player[Main.myPlayer].releaseHook = false; Main.player[Main.myPlayer].releaseThrow = false; Main.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; 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) { Main.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) { Main.PlaySound(12); Main.netDiag = !Main.netDiag; } Main.netRelease = false; } else Main.netRelease = true; } private static void DoUpdate_F9_ToggleLighting() { if (Main.keyState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.F9) && !Main.drawingPlayerChat && !Main.editSign && !Main.editChest) { if (Main.RGBRelease) { Main.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) { Main.PlaySound(12); Main.showFrameRate = !Main.showFrameRate; } Main.frameRelease = false; } else Main.frameRelease = true; } private static void DoUpdate_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[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.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; } 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[454] >= 10 && (Main.tileFrame[454] != 0 || Main.tileFrameCounter[454] >= 90)) { Main.tileFrameCounter[454] = 0; if (--Main.tileFrame[454] < 0) Main.tileFrame[454] = 4; } 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[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; } Main.CritterCages(); } 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; } ++Main.wallFrameCounter[144]; int num1 = 5; int num2 = 10; if ((int) Main.wallFrameCounter[144] < num1) Main.wallFrame[144] = (byte) 0; else if ((int) Main.wallFrameCounter[144] < num1) Main.wallFrame[144] = (byte) 1; else if ((int) Main.wallFrameCounter[144] < num1 * 2) Main.wallFrame[144] = (byte) 2; else if ((int) Main.wallFrameCounter[144] < num1 * 3) Main.wallFrame[144] = (byte) 3; else if ((int) Main.wallFrameCounter[144] < num1 * 4) Main.wallFrame[144] = (byte) 4; else if ((int) Main.wallFrameCounter[144] < num1 * 5) Main.wallFrame[144] = (byte) 5; else if ((int) Main.wallFrameCounter[144] < num1 * 6) Main.wallFrame[144] = (byte) 6; else if ((int) Main.wallFrameCounter[144] < num1 * 7) Main.wallFrame[144] = (byte) 7; else if ((int) Main.wallFrameCounter[144] < num1 * (8 + num2)) Main.wallFrame[144] = (byte) 8; else if ((int) Main.wallFrameCounter[144] < num1 * (9 + num2)) Main.wallFrame[144] = (byte) 7; else if ((int) Main.wallFrameCounter[144] < num1 * (10 + num2)) Main.wallFrame[144] = (byte) 6; else if ((int) Main.wallFrameCounter[144] < num1 * (11 + num2)) Main.wallFrame[144] = (byte) 5; else if ((int) Main.wallFrameCounter[144] < num1 * (12 + num2)) Main.wallFrame[144] = (byte) 4; else if ((int) Main.wallFrameCounter[144] < num1 * (13 + num2)) Main.wallFrame[144] = (byte) 3; else if ((int) Main.wallFrameCounter[144] < num1 * (14 + num2)) Main.wallFrame[144] = (byte) 2; else if ((int) Main.wallFrameCounter[144] < num1 * (15 + num2)) { Main.wallFrame[144] = (byte) 1; } else { Main.wallFrame[144] = (byte) 0; if ((int) Main.wallFrameCounter[144] <= num1 * (16 + num2 * 2)) return; Main.wallFrameCounter[144] = (byte) 0; } } private void DoUpdate_AnimateWaterfalls() { Main.wFrCounter += Main.windSpeed * 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() { if (Main.treeMntBG[1] == 94 || Main.treeMntBG[1] >= 114 && Main.treeMntBG[1] <= 116) { ++Main.bgFrameCounter[0]; if (Main.bgFrameCounter[0] >= 6) { Main.bgFrameCounter[0] = 0; ++Main.bgFrame[0]; if (Main.bgFrame[0] >= 4) Main.bgFrame[0] = 0; } Main.treeMntBG[1] = Main.bgFrame[0] != 0 ? (Main.bgFrame[0] != 1 ? (Main.bgFrame[0] != 2 ? 116 : 115) : 114) : 94; Main.treeMntBG[0] = Main.bgFrame[0] != 0 ? (Main.bgFrame[0] != 1 ? (Main.bgFrame[0] != 2 ? 170 : 169) : 168) : 93; } if (Main.treeMntBG[1] < 180 || Main.treeMntBG[1] > 183) return; ++Main.bgFrameCounter[0]; if (Main.bgFrameCounter[0] >= 6) { Main.bgFrameCounter[0] = 0; ++Main.bgFrame[0]; if (Main.bgFrame[0] >= 4) Main.bgFrame[0] = 0; } if (Main.bgFrame[0] == 0) Main.treeMntBG[1] = 180; else if (Main.bgFrame[0] == 1) Main.treeMntBG[1] = 181; else if (Main.bgFrame[0] == 2) Main.treeMntBG[1] = 182; else Main.treeMntBG[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) { if (!Main.saveTime.IsRunning) Main.saveTime.Start(); if (Main.saveTime.ElapsedMilliseconds <= 600000L) return; Main.saveTime.Reset(); 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); 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() { Main.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() { AchievementCompleteUI.Clear(); Main.playerInventory = false; Main.exitScale = 0.8f; switch (Main.netMode) { case 0: Main.maxRaining = 0.0f; Main.raining = false; if (Main.grabSky) break; Main.time += 86.4; if (!Main.dayTime) { if (Main.time <= 32400.0) break; Main.bloodMoon = false; Main.time = 0.0; Main.dayTime = true; ++Main.moonPhase; if (Main.moonPhase < 8) 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) { if (!Main.hasFocus) return oldString; Main.inputTextEnter = false; Main.inputTextEscape = false; string str1 = oldString; string str2 = ""; 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) Platform.Current).Clipboard = 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) Platform.Current).Clipboard = oldString; else if (Main.inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.V) && !Main.oldInputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.V)) str2 += ((Platform) Platform.Current).Clipboard; } 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) Platform.Current).Clipboard = oldString; str1 = ""; } if (Main.inputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Insert) && !Main.oldInputText.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.Insert)) { string str3 = ((Platform) Platform.Current).Clipboard; for (int index = 0; index < str3.Length; ++index) { if (str3[index] < ' ' || str3[index] == '\u007F') str3 = str3.Replace(str3[index--].ToString() ?? "", ""); } str2 += str3; } } for (int index = 0; index < Main.keyCount; ++index) { int num = Main.keyInt[index]; string str4 = 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) { str2 += str4; break; } break; } } } Main.keyCount = 0; string text = str1 + str2; 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)) { if (Main.backSpaceCount == 0) { Main.backSpaceCount = 7; flag1 = true; } --Main.backSpaceCount; } else 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; } public void MouseTextHackZoom(string text) => this.MouseTextHackZoom(text, 0); public void MouseTextHackZoom(string text, int itemRarity, byte diff = 0) { 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(); this.MouseText(text, itemRarity, hackedMouseX: mouseX, hackedMouseY: mouseY, hackedScreenWidth: screenWidth, hackedScreenHeight: screenHeight); } public void MouseText( string cursorText, int rare = 0, byte diff = 0, int hackedMouseX = -1, int hackedMouseY = -1, int hackedScreenWidth = -1, int hackedScreenHeight = -1) { if (this.mouseNPC > -1 || cursorText == null) return; int X = Main.mouseX + 10; int Y = Main.mouseY + 10; if (hackedMouseX != -1 && hackedMouseY != -1) { X = hackedMouseX + 10; Y = hackedMouseY + 10; } if (Main.ThickMouse) { X += 6; Y += 6; } 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(rare, diff, X, Y); } else { if (Main.buffString != "" && Main.buffString != null) this.MouseText_DrawBuffString(ref X, ref Y); Vector2 vector2 = Main.fontMouseText.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 == -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, Main.fontMouseText, cursorText, new Vector2((float) X, (float) Y), baseColor, 0.0f, Vector2.Zero, Vector2.One); } } private void MouseText_DrawItemTooltip(int rare, byte diff, int X, int Y) { Microsoft.Xna.Framework.Color color1 = new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor); int num1 = -1; rare = Main.HoverItem.rare; float knockBack = Main.HoverItem.knockBack; float num2 = 1f; if (Main.HoverItem.melee && Main.player[Main.myPlayer].kbGlove) ++num2; if (Main.player[Main.myPlayer].kbBuff) num2 += 0.5f; if ((double) num2 != 1.0) Main.HoverItem.knockBack *= num2; if (Main.HoverItem.ranged && Main.player[Main.myPlayer].shroomiteStealth) Main.HoverItem.knockBack *= (float) (1.0 + (1.0 - (double) Main.player[Main.myPlayer].stealth) * 0.5); int length = 20; int currentLine = 1; string[] lines = new string[length]; bool[] flagArray1 = new bool[length]; bool[] flagArray2 = new bool[length]; for (int index = 0; index < length; ++index) { flagArray1[index] = false; flagArray2[index] = false; } lines[0] = Main.HoverItem.HoverName; if (Main.HoverItem.favorited) { string[] strArray1 = lines; int index1 = currentLine; int num3 = index1 + 1; string str1 = Lang.tip[56].Value; strArray1[index1] = str1; string[] strArray2 = lines; int index2 = num3; currentLine = index2 + 1; string str2 = Lang.tip[57].Value; strArray2[index2] = str2; } if (Main.HoverItem.social) { lines[currentLine] = Lang.tip[0].Value; int index = currentLine + 1; lines[index] = Lang.tip[1].Value; currentLine = index + 1; } else { if (Main.HoverItem.damage > 0 && (!Main.HoverItem.notAmmo || Main.HoverItem.useStyle > 0) && (Main.HoverItem.type < 71 || Main.HoverItem.type > 74 || Main.player[Main.myPlayer].HasItem(905))) { float num4 = 5E-06f; int damage = Main.HoverItem.damage; if (Main.HoverItem.melee) { lines[currentLine] = string.Concat((object) (int) ((double) Main.player[Main.myPlayer].meleeDamage * (double) damage + (double) num4)); // ISSUE: explicit reference operation ^ref lines[currentLine] += Lang.tip[2].Value; } else if (Main.HoverItem.ranged) { float num5 = (float) damage * Main.player[Main.myPlayer].rangedDamage; if (Main.HoverItem.useAmmo == AmmoID.Arrow || Main.HoverItem.useAmmo == AmmoID.Stake) num5 *= Main.player[Main.myPlayer].arrowDamage; if (Main.HoverItem.useAmmo == AmmoID.Arrow && Main.player[Main.myPlayer].archery) num5 *= 1.2f; if (Main.HoverItem.useAmmo == AmmoID.Bullet || Main.HoverItem.useAmmo == AmmoID.CandyCorn) num5 *= Main.player[Main.myPlayer].bulletDamage; if (Main.HoverItem.useAmmo == AmmoID.Rocket || Main.HoverItem.useAmmo == AmmoID.StyngerBolt || Main.HoverItem.useAmmo == AmmoID.JackOLantern || Main.HoverItem.useAmmo == AmmoID.NailFriendly) num5 *= Main.player[Main.myPlayer].rocketDamage; lines[currentLine] = string.Concat((object) (int) ((double) num5 + (double) num4)); // ISSUE: explicit reference operation ^ref lines[currentLine] += Lang.tip[3].Value; } else if (Main.HoverItem.magic) { lines[currentLine] = string.Concat((object) (int) ((double) Main.player[Main.myPlayer].magicDamage * (double) damage + (double) num4)); // ISSUE: explicit reference operation ^ref lines[currentLine] += Lang.tip[4].Value; } else if (Main.HoverItem.thrown) { lines[currentLine] = string.Concat((object) (int) ((double) Main.player[Main.myPlayer].thrownDamage * (double) damage + (double) num4)); // ISSUE: explicit reference operation ^ref lines[currentLine] += Lang.tip[58].Value; } else if (Main.HoverItem.summon) { lines[currentLine] = Main.HoverItem.type == 3829 || Main.HoverItem.type == 3830 || Main.HoverItem.type == 3831 ? string.Concat((object) (int) (((double) Main.player[Main.myPlayer].minionDamage * (double) damage + (double) num4) * 3.0)) : string.Concat((object) (int) ((double) Main.player[Main.myPlayer].minionDamage * (double) damage + (double) num4)); // ISSUE: explicit reference operation ^ref lines[currentLine] += Lang.tip[53].Value; } else { lines[currentLine] = string.Concat((object) damage); // ISSUE: explicit reference operation ^ref lines[currentLine] += Lang.tip[55].Value; } int index = currentLine + 1; if (Main.HoverItem.melee) { int num6 = Main.player[Main.myPlayer].meleeCrit - Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].crit + Main.HoverItem.crit; lines[index] = num6.ToString() + Lang.tip[5].Value; ++index; } else if (Main.HoverItem.ranged) { int num7 = Main.player[Main.myPlayer].rangedCrit - Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].crit + Main.HoverItem.crit; lines[index] = num7.ToString() + Lang.tip[5].Value; ++index; } else if (Main.HoverItem.magic) { int num8 = Main.player[Main.myPlayer].magicCrit - Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].crit + Main.HoverItem.crit; lines[index] = num8.ToString() + Lang.tip[5].Value; ++index; } else if (Main.HoverItem.thrown) { int num9 = Main.player[Main.myPlayer].thrownCrit - Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].crit + Main.HoverItem.crit; lines[index] = num9.ToString() + Lang.tip[5].Value; ++index; } if (Main.HoverItem.useStyle > 0 && !Main.HoverItem.summon) { lines[index] = Main.HoverItem.useAnimation > 8 ? (Main.HoverItem.useAnimation > 20 ? (Main.HoverItem.useAnimation > 25 ? (Main.HoverItem.useAnimation > 30 ? (Main.HoverItem.useAnimation > 35 ? (Main.HoverItem.useAnimation > 45 ? (Main.HoverItem.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; ++index; } float num10 = Main.HoverItem.knockBack; if (Main.HoverItem.summon) num10 += Main.player[Main.myPlayer].minionKB; if (Main.player[Main.myPlayer].magicQuiver && Main.HoverItem.useAmmo == AmmoID.Arrow || Main.HoverItem.useAmmo == AmmoID.Stake) num10 = (float) (int) ((double) num10 * 1.10000002384186); if (Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type == 3106 && Main.HoverItem.type == 3106) num10 += num10 * (1f - Main.player[Main.myPlayer].stealth); lines[index] = (double) num10 != 0.0 ? ((double) num10 > 1.5 ? ((double) num10 > 3.0 ? ((double) num10 > 4.0 ? ((double) num10 > 6.0 ? ((double) num10 > 7.0 ? ((double) num10 > 9.0 ? ((double) num10 > 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; currentLine = index + 1; } if (Main.HoverItem.fishingPole > 0) { lines[currentLine] = Language.GetTextValue("GameUI.PrecentFishingPower", (object) Main.HoverItem.fishingPole); int index = currentLine + 1; lines[index] = Language.GetTextValue("GameUI.BaitRequired"); currentLine = index + 1; } if (Main.HoverItem.bait > 0) { lines[currentLine] = Language.GetTextValue("GameUI.BaitPower", (object) Main.HoverItem.bait); ++currentLine; } if (Main.HoverItem.headSlot > 0 || Main.HoverItem.bodySlot > 0 || Main.HoverItem.legSlot > 0 || Main.HoverItem.accessory || Main.projHook[Main.HoverItem.shoot] || Main.HoverItem.mountType != -1 || Main.HoverItem.buffType > 0 && (Main.lightPet[Main.HoverItem.buffType] || Main.vanityPet[Main.HoverItem.buffType])) { lines[currentLine] = Lang.tip[23].Value; ++currentLine; } if (Main.HoverItem.tileWand > 0) { lines[currentLine] = Lang.tip[52].Value + Lang.GetItemNameValue(Main.HoverItem.tileWand); ++currentLine; } if (Main.HoverItem.questItem) { lines[currentLine] = Lang.inter[65].Value; ++currentLine; } if (Main.HoverItem.vanity) { lines[currentLine] = Lang.tip[24].Value; ++currentLine; } if (Main.HoverItem.defense > 0) { lines[currentLine] = Main.HoverItem.defense.ToString() + Lang.tip[25].Value; ++currentLine; } if (Main.HoverItem.pick > 0) { lines[currentLine] = Main.HoverItem.pick.ToString() + Lang.tip[26].Value; ++currentLine; } if (Main.HoverItem.axe > 0) { lines[currentLine] = (Main.HoverItem.axe * 5).ToString() + Lang.tip[27].Value; ++currentLine; } if (Main.HoverItem.hammer > 0) { lines[currentLine] = Main.HoverItem.hammer.ToString() + Lang.tip[28].Value; ++currentLine; } if (Main.HoverItem.tileBoost != 0) { int tileBoost = Main.HoverItem.tileBoost; lines[currentLine] = tileBoost <= 0 ? tileBoost.ToString() + Lang.tip[54].Value : "+" + (object) tileBoost + Lang.tip[54].Value; ++currentLine; } if (Main.HoverItem.healLife > 0) { lines[currentLine] = Language.GetTextValue("CommonItemTooltip.RestoresLife", (object) Main.HoverItem.healLife); ++currentLine; } if (Main.HoverItem.healMana > 0) { lines[currentLine] = Language.GetTextValue("CommonItemTooltip.RestoresMana", (object) Main.HoverItem.healMana); ++currentLine; } if (Main.HoverItem.mana > 0 && (Main.HoverItem.type != (int) sbyte.MaxValue || !Main.player[Main.myPlayer].spaceGun)) { lines[currentLine] = Language.GetTextValue("CommonItemTooltip.UsesMana", (object) (int) ((double) Main.HoverItem.mana * (double) Main.player[Main.myPlayer].manaCost)); ++currentLine; } if (Main.HoverItem.createWall > 0 || Main.HoverItem.createTile > -1) { if (Main.HoverItem.type != 213 && Main.HoverItem.tileWand < 1) { lines[currentLine] = Lang.tip[33].Value; ++currentLine; } } else if (Main.HoverItem.ammo > 0 && !Main.HoverItem.notAmmo) { lines[currentLine] = Lang.tip[34].Value; ++currentLine; } else if (Main.HoverItem.consumable) { lines[currentLine] = Lang.tip[35].Value; ++currentLine; } if (Main.HoverItem.material) { lines[currentLine] = Lang.tip[36].Value; ++currentLine; } if (Main.HoverItem.ToolTip != null) { for (int line = 0; line < Main.HoverItem.ToolTip.Lines; ++line) { if (line == 0 && Main.HoverItem.type >= 1533 && Main.HoverItem.type <= 1537 && !NPC.downedPlantBoss) { lines[currentLine] = Lang.tip[59].Value; ++currentLine; } else { lines[currentLine] = Main.HoverItem.ToolTip.GetLine(line); ++currentLine; } } } if ((Main.HoverItem.type == 3818 || Main.HoverItem.type == 3819 || Main.HoverItem.type == 3820 || Main.HoverItem.type == 3824 || Main.HoverItem.type == 3825 || Main.HoverItem.type == 3826 || Main.HoverItem.type == 3829 || Main.HoverItem.type == 3830 || Main.HoverItem.type == 3831 || Main.HoverItem.type == 3832 || Main.HoverItem.type == 3833 || Main.HoverItem.type == 3834) && !Main.player[Main.myPlayer].downedDD2EventAnyDifficulty) { lines[currentLine] = Lang.misc[104].Value; ++currentLine; } if (Main.HoverItem.buffType == 26 && Main.expertMode) { lines[currentLine] = Lang.misc[40].Value; ++currentLine; } if (Main.HoverItem.buffTime > 0) { string str = Main.HoverItem.buffTime / 60 < 60 ? Language.GetTextValue("CommonItemTooltip.SecondDuration", (object) Math.Round((double) Main.HoverItem.buffTime / 60.0)) : Language.GetTextValue("CommonItemTooltip.MinuteDuration", (object) Math.Round((double) (Main.HoverItem.buffTime / 60) / 60.0)); lines[currentLine] = str; ++currentLine; } if (Main.HoverItem.type == 3262 || Main.HoverItem.type == 3282 || Main.HoverItem.type == 3283 || Main.HoverItem.type == 3284 || Main.HoverItem.type == 3285 || Main.HoverItem.type == 3286 || Main.HoverItem.type == 3316 || Main.HoverItem.type == 3315 || Main.HoverItem.type == 3317 || Main.HoverItem.type == 3291 || Main.HoverItem.type == 3389) { lines[currentLine] = " "; num1 = currentLine; ++currentLine; } if (Main.HoverItem.prefix > (byte) 0) { if (Main.cpItem == null || Main.cpItem.netID != Main.HoverItem.netID) { Main.cpItem = new Item(); Main.cpItem.netDefaults(Main.HoverItem.netID); } if (Main.cpItem.damage != Main.HoverItem.damage) { double num11 = Math.Round(((double) Main.HoverItem.damage - (double) Main.cpItem.damage) / (double) Main.cpItem.damage * 100.0); lines[currentLine] = num11 <= 0.0 ? num11.ToString() + Lang.tip[39].Value : "+" + (object) num11 + Lang.tip[39].Value; if (num11 < 0.0) flagArray2[currentLine] = true; flagArray1[currentLine] = true; ++currentLine; } if (Main.cpItem.useAnimation != Main.HoverItem.useAnimation) { double num12 = Math.Round(((double) Main.HoverItem.useAnimation - (double) Main.cpItem.useAnimation) / (double) Main.cpItem.useAnimation * 100.0) * -1.0; lines[currentLine] = num12 <= 0.0 ? num12.ToString() + Lang.tip[40].Value : "+" + (object) num12 + Lang.tip[40].Value; if (num12 < 0.0) flagArray2[currentLine] = true; flagArray1[currentLine] = true; ++currentLine; } if (Main.cpItem.crit != Main.HoverItem.crit) { double num13 = (double) Main.HoverItem.crit - (double) Main.cpItem.crit; lines[currentLine] = num13 <= 0.0 ? num13.ToString() + Lang.tip[41].Value : "+" + (object) num13 + Lang.tip[41].Value; if (num13 < 0.0) flagArray2[currentLine] = true; flagArray1[currentLine] = true; ++currentLine; } if (Main.cpItem.mana != Main.HoverItem.mana) { double num14 = Math.Round(((double) Main.HoverItem.mana - (double) Main.cpItem.mana) / (double) Main.cpItem.mana * 100.0); lines[currentLine] = num14 <= 0.0 ? num14.ToString() + Lang.tip[42].Value : "+" + (object) num14 + Lang.tip[42].Value; if (num14 > 0.0) flagArray2[currentLine] = true; flagArray1[currentLine] = true; ++currentLine; } if ((double) Main.cpItem.scale != (double) Main.HoverItem.scale) { double num15 = Math.Round(((double) Main.HoverItem.scale - (double) Main.cpItem.scale) / (double) Main.cpItem.scale * 100.0); lines[currentLine] = num15 <= 0.0 ? num15.ToString() + Lang.tip[43].Value : "+" + (object) num15 + Lang.tip[43].Value; if (num15 < 0.0) flagArray2[currentLine] = true; flagArray1[currentLine] = true; ++currentLine; } if ((double) Main.cpItem.shootSpeed != (double) Main.HoverItem.shootSpeed) { double num16 = Math.Round(((double) Main.HoverItem.shootSpeed - (double) Main.cpItem.shootSpeed) / (double) Main.cpItem.shootSpeed * 100.0); lines[currentLine] = num16 <= 0.0 ? num16.ToString() + Lang.tip[44].Value : "+" + (object) num16 + Lang.tip[44].Value; if (num16 < 0.0) flagArray2[currentLine] = true; flagArray1[currentLine] = true; ++currentLine; } if ((double) Main.cpItem.knockBack != (double) knockBack) { double num17 = Math.Round(((double) knockBack - (double) Main.cpItem.knockBack) / (double) Main.cpItem.knockBack * 100.0); lines[currentLine] = num17 <= 0.0 ? num17.ToString() + Lang.tip[45].Value : "+" + (object) num17 + Lang.tip[45].Value; if (num17 < 0.0) flagArray2[currentLine] = true; flagArray1[currentLine] = true; ++currentLine; } if (Main.HoverItem.prefix == (byte) 62) { lines[currentLine] = "+1" + Lang.tip[25].Value; flagArray1[currentLine] = true; ++currentLine; } if (Main.HoverItem.prefix == (byte) 63) { lines[currentLine] = "+2" + Lang.tip[25].Value; flagArray1[currentLine] = true; ++currentLine; } if (Main.HoverItem.prefix == (byte) 64) { lines[currentLine] = "+3" + Lang.tip[25].Value; flagArray1[currentLine] = true; ++currentLine; } if (Main.HoverItem.prefix == (byte) 65) { lines[currentLine] = "+4" + Lang.tip[25].Value; flagArray1[currentLine] = true; ++currentLine; } if (Main.HoverItem.prefix == (byte) 66) { lines[currentLine] = "+20 " + Lang.tip[31].Value; flagArray1[currentLine] = true; ++currentLine; } if (Main.HoverItem.prefix == (byte) 67) { lines[currentLine] = "+2" + Lang.tip[5].Value; flagArray1[currentLine] = true; ++currentLine; } if (Main.HoverItem.prefix == (byte) 68) { lines[currentLine] = "+4" + Lang.tip[5].Value; flagArray1[currentLine] = true; ++currentLine; } if (Main.HoverItem.prefix == (byte) 69) { lines[currentLine] = "+1" + Lang.tip[39].Value; flagArray1[currentLine] = true; ++currentLine; } if (Main.HoverItem.prefix == (byte) 70) { lines[currentLine] = "+2" + Lang.tip[39].Value; flagArray1[currentLine] = true; ++currentLine; } if (Main.HoverItem.prefix == (byte) 71) { lines[currentLine] = "+3" + Lang.tip[39].Value; flagArray1[currentLine] = true; ++currentLine; } if (Main.HoverItem.prefix == (byte) 72) { lines[currentLine] = "+4" + Lang.tip[39].Value; flagArray1[currentLine] = true; ++currentLine; } if (Main.HoverItem.prefix == (byte) 73) { lines[currentLine] = "+1" + Lang.tip[46].Value; flagArray1[currentLine] = true; ++currentLine; } if (Main.HoverItem.prefix == (byte) 74) { lines[currentLine] = "+2" + Lang.tip[46].Value; flagArray1[currentLine] = true; ++currentLine; } if (Main.HoverItem.prefix == (byte) 75) { lines[currentLine] = "+3" + Lang.tip[46].Value; flagArray1[currentLine] = true; ++currentLine; } if (Main.HoverItem.prefix == (byte) 76) { lines[currentLine] = "+4" + Lang.tip[46].Value; flagArray1[currentLine] = true; ++currentLine; } if (Main.HoverItem.prefix == (byte) 77) { lines[currentLine] = "+1" + Lang.tip[47].Value; flagArray1[currentLine] = true; ++currentLine; } if (Main.HoverItem.prefix == (byte) 78) { lines[currentLine] = "+2" + Lang.tip[47].Value; flagArray1[currentLine] = true; ++currentLine; } if (Main.HoverItem.prefix == (byte) 79) { lines[currentLine] = "+3" + Lang.tip[47].Value; flagArray1[currentLine] = true; ++currentLine; } if (Main.HoverItem.prefix == (byte) 80) { lines[currentLine] = "+4" + Lang.tip[47].Value; flagArray1[currentLine] = true; ++currentLine; } } if (Main.HoverItem.wornArmor && Main.player[Main.myPlayer].setBonus != "") { lines[currentLine] = Lang.tip[48].Value + " " + Main.player[Main.myPlayer].setBonus; ++currentLine; } } if (Main.HoverItem.expert) { lines[currentLine] = Language.GetTextValue("GameUI.Expert"); ++currentLine; } float num18 = (float) Main.mouseTextColor / (float) byte.MaxValue; int mouseTextColor = (int) Main.mouseTextColor; if (Main.npcShop > 0) { int storeValue = Main.HoverItem.GetStoreValue(); if (Main.HoverItem.shopSpecialCurrency != -1) { CustomCurrencyManager.GetPriceText(Main.HoverItem.shopSpecialCurrency, lines, ref currentLine, storeValue); color1 = new Microsoft.Xna.Framework.Color((int) (byte) ((double) byte.MaxValue * (double) num18), (int) (byte) ((double) byte.MaxValue * (double) num18), (int) (byte) ((double) byte.MaxValue * (double) num18), mouseTextColor); } else if (Main.HoverItem.GetStoreValue() > 0) { string str = ""; int num19 = 0; int num20 = 0; int num21 = 0; int num22 = 0; int num23 = storeValue * Main.HoverItem.stack; if (!Main.HoverItem.buy) { int num24 = storeValue / 5; if (num24 < 1) num24 = 1; num23 = num24 * Main.HoverItem.stack; } if (num23 < 1) num23 = 1; if (num23 >= 1000000) { num19 = num23 / 1000000; num23 -= num19 * 1000000; } if (num23 >= 10000) { num20 = num23 / 10000; num23 -= num20 * 10000; } if (num23 >= 100) { num21 = num23 / 100; num23 -= num21 * 100; } if (num23 >= 1) num22 = num23; if (num19 > 0) str = str + (object) num19 + " " + Lang.inter[15].Value + " "; if (num20 > 0) str = str + (object) num20 + " " + Lang.inter[16].Value + " "; if (num21 > 0) str = str + (object) num21 + " " + Lang.inter[17].Value + " "; if (num22 > 0) str = str + (object) num22 + " " + Lang.inter[18].Value + " "; lines[currentLine] = Main.HoverItem.buy ? Lang.tip[50].Value + " " + str : Lang.tip[49].Value + " " + str; ++currentLine; if (num19 > 0) color1 = new Microsoft.Xna.Framework.Color((int) (byte) (220.0 * (double) num18), (int) (byte) (220.0 * (double) num18), (int) (byte) (198.0 * (double) num18), mouseTextColor); else if (num20 > 0) color1 = new Microsoft.Xna.Framework.Color((int) (byte) (224.0 * (double) num18), (int) (byte) (201.0 * (double) num18), (int) (byte) (92.0 * (double) num18), mouseTextColor); else if (num21 > 0) color1 = new Microsoft.Xna.Framework.Color((int) (byte) (181.0 * (double) num18), (int) (byte) (192.0 * (double) num18), (int) (byte) (193.0 * (double) num18), mouseTextColor); else if (num22 > 0) color1 = new Microsoft.Xna.Framework.Color((int) (byte) (246.0 * (double) num18), (int) (byte) (138.0 * (double) num18), (int) (byte) (96.0 * (double) num18), mouseTextColor); } else if (Main.HoverItem.type != 3817) { lines[currentLine] = Lang.tip[51].Value; ++currentLine; color1 = new Microsoft.Xna.Framework.Color((int) (byte) (120.0 * (double) num18), (int) (byte) (120.0 * (double) num18), (int) (byte) (120.0 * (double) num18), mouseTextColor); } } Vector2 zero = Vector2.Zero; int num25 = 0; for (int index = 0; index < currentLine; ++index) { Vector2 vector2 = Main.fontMouseText.MeasureString(lines[index]); if ((double) vector2.X > (double) zero.X) zero.X = vector2.X; zero.Y += vector2.Y + (float) num25; } X += Main.toolTipDistance; Y += Main.toolTipDistance; if ((double) X + (double) zero.X + 4.0 > (double) Main.screenWidth) X = (int) ((double) Main.screenWidth - (double) zero.X - 4.0); if ((double) Y + (double) zero.Y + 4.0 > (double) Main.screenHeight) Y = (int) ((double) Main.screenHeight - (double) zero.Y - 4.0); int num26 = 0; double num27 = (double) Main.mouseTextColor / (double) byte.MaxValue; for (int index3 = 0; index3 < currentLine; ++index3) { if (index3 == num1) { float num28 = 1f; int num29 = (int) ((double) Main.mouseTextColor * (double) num28); Microsoft.Xna.Framework.Color color2 = Microsoft.Xna.Framework.Color.Black; for (int index4 = 0; index4 < 5; ++index4) { int num30 = X; int num31 = Y + num26; if (index4 == 4) color2 = new Microsoft.Xna.Framework.Color(num29, num29, num29, num29); if (index4 == 0) --num30; else if (index4 == 1) ++num30; else if (index4 == 2) --num31; else if (index4 == 3) ++num31; Main.spriteBatch.Draw(Main.oneDropLogo, new Vector2((float) num30, (float) num31), 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(num18, num18, num18, num18); if (index3 == 0) { if (rare == -11) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) byte.MaxValue * (double) num18), (int) (byte) (175.0 * (double) num18), (int) (byte) (0.0 * (double) num18), mouseTextColor); if (rare == -1) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) (130.0 * (double) num18), (int) (byte) (130.0 * (double) num18), (int) (byte) (130.0 * (double) num18), mouseTextColor); if (rare == 1) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) (150.0 * (double) num18), (int) (byte) (150.0 * (double) num18), (int) (byte) ((double) byte.MaxValue * (double) num18), mouseTextColor); if (rare == 2) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) (150.0 * (double) num18), (int) (byte) ((double) byte.MaxValue * (double) num18), (int) (byte) (150.0 * (double) num18), mouseTextColor); if (rare == 3) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) byte.MaxValue * (double) num18), (int) (byte) (200.0 * (double) num18), (int) (byte) (150.0 * (double) num18), mouseTextColor); if (rare == 4) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) byte.MaxValue * (double) num18), (int) (byte) (150.0 * (double) num18), (int) (byte) (150.0 * (double) num18), mouseTextColor); if (rare == 5) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) byte.MaxValue * (double) num18), (int) (byte) (150.0 * (double) num18), (int) (byte) ((double) byte.MaxValue * (double) num18), mouseTextColor); if (rare == 6) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) (210.0 * (double) num18), (int) (byte) (160.0 * (double) num18), (int) (byte) ((double) byte.MaxValue * (double) num18), mouseTextColor); if (rare == 7) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) (150.0 * (double) num18), (int) (byte) ((double) byte.MaxValue * (double) num18), (int) (byte) (10.0 * (double) num18), mouseTextColor); if (rare == 8) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) byte.MaxValue * (double) num18), (int) (byte) ((double) byte.MaxValue * (double) num18), (int) (byte) (10.0 * (double) num18), mouseTextColor); if (rare == 9) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) (5.0 * (double) num18), (int) (byte) (200.0 * (double) num18), (int) (byte) ((double) byte.MaxValue * (double) num18), mouseTextColor); if (rare == 10) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) byte.MaxValue * (double) num18), (int) (byte) (40.0 * (double) num18), (int) (byte) (100.0 * (double) num18), mouseTextColor); if (rare >= 11) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) (180.0 * (double) num18), (int) (byte) (40.0 * (double) num18), (int) (byte) ((double) byte.MaxValue * (double) num18), mouseTextColor); if (diff == (byte) 1) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) Main.mcColor.R * (double) num18), (int) (byte) ((double) Main.mcColor.G * (double) num18), (int) (byte) ((double) Main.mcColor.B * (double) num18), mouseTextColor); if (diff == (byte) 2) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) Main.hcColor.R * (double) num18), (int) (byte) ((double) Main.hcColor.G * (double) num18), (int) (byte) ((double) Main.hcColor.B * (double) num18), mouseTextColor); if (Main.HoverItem.expert || rare == -12) baseColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) Main.DiscoR * (double) num18), (int) (byte) ((double) Main.DiscoG * (double) num18), (int) (byte) ((double) Main.DiscoB * (double) num18), mouseTextColor); } else if (flagArray1[index3]) baseColor = !flagArray2[index3] ? new Microsoft.Xna.Framework.Color((int) (byte) (120.0 * (double) num18), (int) (byte) (190.0 * (double) num18), (int) (byte) (120.0 * (double) num18), mouseTextColor) : new Microsoft.Xna.Framework.Color((int) (byte) (190.0 * (double) num18), (int) (byte) (120.0 * (double) num18), (int) (byte) (120.0 * (double) num18), mouseTextColor); else if (index3 == currentLine - 1) baseColor = color1; ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, lines[index3], new Vector2((float) X, (float) (Y + num26)), baseColor, 0.0f, Vector2.Zero, Vector2.One); } num26 += (int) ((double) Main.fontMouseText.MeasureString(lines[index3]).Y + (double) num25); } } private void MouseText_DrawBuffString(ref int X, ref int Y) { Microsoft.Xna.Framework.Point p = new Microsoft.Xna.Framework.Point(X, Y); int num1 = 220; int num2 = -1; float num3 = 1f / Main.UIScale; List vector2List = new List(); Vector2 vector2_1 = Main.fontMouseText.MeasureString(Main.buffString); vector2List.Add(vector2_1); int num4 = (int) ((double) (Main.screenHeight - 250) * (double) num3) / 20; if (num4 < 1) num4 = 1; if (Main.bannerMouseOver) { int num5 = 0; for (int i = 0; i < 267; ++i) { if (Item.BannerToNPC(i) != 0 && Main.player[Main.myPlayer].NPCBannerBuff[i]) { ++num5; string npcNameValue = Lang.GetNPCNameValue(Item.BannerToNPC(i)); Vector2 vector2_2 = Main.fontMouseText.MeasureString(npcNameValue); int num6 = X; int num7 = Y + (int) vector2_2.Y + num5 * 20 + 10; int num8 = 0; int num9 = (num5 - 1) / num4; for (int index = 0; index < num9; ++index) { ++num8; num6 += num1; num7 -= num4 * 20; } if ((double) num6 + (double) vector2_2.X > (double) Main.screenWidth * (double) num3 && num2 == -1) num2 = num5; vector2List.Add(new Vector2((float) (num6 - num1 * num8), (float) num7) + 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) num3) X = (int) ((double) Main.screenWidth * (double) num3 - (double) zero.X - 24.0); if ((double) Y + (double) zero.Y + 4.0 > (double) Main.screenHeight * (double) num3) Y = (int) ((double) Main.screenHeight * (double) num3 - (double) zero.Y - 4.0); if (num2 != -1) --num2; for (int index = 0; index < 5; ++index) { int num10 = X; int num11 = Y + (int) Main.fontMouseText.MeasureString(Main.buffString).Y; Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.Black; if (index == 0) num10 -= 2; else if (index == 1) num10 += 2; else if (index == 2) num11 -= 2; else if (index == 3) num11 += 2; else color = new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, Main.buffString, new Vector2((float) num10, (float) num11), color, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (!Main.bannerMouseOver) return; int num12 = 0; for (int i = 0; i < 267; ++i) { if (Item.BannerToNPC(i) != 0 && Main.player[Main.myPlayer].NPCBannerBuff[i]) { ++num12; bool flag = false; for (int index = 0; index < 5; ++index) { int num13 = X; int num14 = Y + (int) vector2_1.Y + num12 * 20 + 10; int num15 = (num12 - 1) / num4; int num16 = num13 + num1 * num15; int num17 = num14 - num4 * 20 * num15; string str = Lang.GetNPCNameValue(Item.BannerToNPC(i)); if (num2 == num12) { str = Language.GetTextValue("UI.Ellipsis"); flag = true; } Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.Black; switch (index) { case 0: num16 -= 2; break; case 1: num16 += 2; break; case 2: num17 -= 2; break; case 3: num17 += 2; break; default: float num18 = (float) Main.mouseTextColor / (float) byte.MaxValue; color = new Microsoft.Xna.Framework.Color((int) (byte) (80.0 * (double) num18), (int) (byte) ((double) byte.MaxValue * (double) num18), (int) (byte) (120.0 * (double) num18), (int) Main.mouseTextColor); break; } DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, str, new Vector2((float) num16, (float) num17), color, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (flag) break; } } } protected void DrawFPS() { Main.DrawGamepadInstructions(); 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 = Main.fontMouseText.MeasureString(str); if (PlayerInput.UsingGamepad && !Main.gameMenu) vector2_1.X = (float) (Main.screenWidth - 4) - vector2_3.X; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, 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(Main.fontMouseText, text, new Vector2(1f)); float t2 = num2; Utils.Swap(ref GlyphTagHandler.GlyphsScale, ref t2); ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, 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 bool canDrawColorTree(int i, int j, int treeColor) => Main.tile[i, j] != null && Main.tile[i, j].color() > (byte) 0 && (int) Main.tile[i, j].color() < Main.numTileColors && Main.woodAltTexture[treeColor, (int) Main.tile[i, j].color()] != null && !Main.woodAltTexture[treeColor, (int) Main.tile[i, j].color()].IsContentLost; public static bool canDrawColorTile(int i, int j) => Main.tile[i, j] != null && Main.tile[i, j].color() > (byte) 0 && (int) Main.tile[i, j].color() < Main.numTileColors && Main.tileAltTextureDrawn[(int) Main.tile[i, j].type, (int) Main.tile[i, j].color()] && Main.tileAltTextureInit[(int) Main.tile[i, j].type, (int) Main.tile[i, j].color()]; public static bool canDrawColorTile(ushort type, int color) => color > 0 && color < Main.numTileColors && Main.tileAltTextureDrawn[(int) type, color] && Main.tileAltTextureInit[(int) type, color]; public static bool canDrawColorWall(int i, int j) => Main.tile[i, j] != null && Main.tile[i, j].wallColor() > (byte) 0 && Main.wallAltTextureDrawn[(int) Main.tile[i, j].wall, (int) Main.tile[i, j].wallColor()] && Main.wallAltTextureInit[(int) Main.tile[i, j].wall, (int) Main.tile[i, j].wallColor()]; protected void DrawTiles(bool solidOnly = true, int waterStyleOverride = -1) { if (!solidOnly) Main.critterCage = false; Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); int num1 = (int) ((double) byte.MaxValue * (1.0 - (double) Main.gfxQuality) + 30.0 * (double) Main.gfxQuality); int num2 = (int) (50.0 * (1.0 - (double) Main.gfxQuality) + 2.0 * (double) Main.gfxQuality); Vector2 vector2_1 = new Vector2((float) Main.offScreenRange, (float) Main.offScreenRange); if (Main.drawToScreen) vector2_1 = Vector2.Zero; int index1 = 0; int length = Main.specX.Length; int startX = (int) (((double) Main.screenPosition.X - (double) vector2_1.X) / 16.0 - 1.0); int endX = (int) (((double) Main.screenPosition.X + (double) Main.screenWidth + (double) vector2_1.X) / 16.0) + 2; int startY = (int) (((double) Main.screenPosition.Y - (double) vector2_1.Y) / 16.0 - 1.0); int endY = (int) (((double) Main.screenPosition.Y + (double) Main.screenHeight + (double) vector2_1.Y) / 16.0) + 5; if (startX < 4) startX = 4; if (endX > Main.maxTilesX - 4) endX = Main.maxTilesX - 4; if (startY < 4) startY = 4; if (endY > Main.maxTilesY - 4) endY = Main.maxTilesY - 4; if (Main.sectionManager.FrameSectionsLeft > 0) { TimeLogger.DetailedDrawReset(); WorldGen.SectionTileFrameWithCheck(startX, startY, endX, endY); TimeLogger.DetailedDrawTime(5); } Dictionary dictionary1 = new Dictionary(); Dictionary dictionary2 = new Dictionary(); Dictionary dictionary3 = new Dictionary(); int team = Main.player[Main.myPlayer].team; if (Main.player[Main.myPlayer].active) { int netMode = Main.netMode; } int width1 = 16; Microsoft.Xna.Framework.Color[] slices = new Microsoft.Xna.Framework.Color[9]; for (int index2 = startY; index2 < endY + 4; ++index2) { for (int index3 = startX - 2; index3 < endX + 2; ++index3) { Tile trackTile = Main.tile[index3, index2]; if (trackTile == null) { trackTile = new Tile(); Main.tile[index3, index2] = trackTile; Main.mapTime += 60; } ushort type = trackTile.type; short num3 = trackTile.frameX; short num4 = trackTile.frameY; bool flag1 = Main.tileSolid[(int) type]; if (type == (ushort) 11) flag1 = true; if (trackTile.active() && flag1 == solidOnly) { if (!Main.tileSetsLoaded[(int) type]) this.LoadTiles((int) type); SpriteEffects effects = SpriteEffects.None; switch (type) { case 3: case 13: case 20: case 24: case 49: case 50: case 52: case 61: case 62: case 71: case 73: case 74: case 81: case 82: case 83: case 84: case 91: case 92: case 93: case 110: case 113: case 115: case 135: case 141: case 165: case 174: case 201: case 205: case 227: case 270: case 271: case 372: case 382: if (index3 % 2 == 1) { effects = SpriteEffects.FlipHorizontally; break; } break; case 184: if (num4 < (short) 108) { if (index3 % 2 == 1) { effects = SpriteEffects.FlipHorizontally; break; } break; } if (index2 % 2 == 1) { effects = SpriteEffects.FlipVertically; break; } break; case 185: if (num4 == (short) 0 && index3 % 2 == 1) { effects = SpriteEffects.FlipHorizontally; break; } break; } Microsoft.Xna.Framework.Color color1 = Lighting.GetColor(index3, index2); int num5 = 0; int height1 = 16; if (type >= (ushort) 330 && type <= (ushort) 333) num5 += 2; if (type == (ushort) 4 && WorldGen.SolidTile(index3, index2 - 1)) { num5 = 2; if (WorldGen.SolidTile(index3 - 1, index2 + 1) || WorldGen.SolidTile(index3 + 1, index2 + 1)) num5 = 4; } if (type == (ushort) 336) num5 = 2; if (type == (ushort) 457) num5 = 2; if (type == (ushort) 466) num5 = 2; if (type >= (ushort) 275 && type <= (ushort) 282 || type == (ushort) 414 || type == (ushort) 413) num5 = 2; if (type == (ushort) 285 || type == (ushort) 286 || type == (ushort) 298 || type == (ushort) 299 || type == (ushort) 309 || type == (ushort) 358 || type == (ushort) 359 || type == (ushort) 360 || type == (ushort) 361 || type == (ushort) 362 || type == (ushort) 363 || type == (ushort) 364 || type == (ushort) 391 || type == (ushort) 392 || type == (ushort) 393 || type == (ushort) 394 || type == (ushort) 310) num5 = 2; if (type == (ushort) 100 || type == (ushort) 173 || type == (ushort) 283) num5 = 2; if (type == (ushort) 78 || type == (ushort) 85 || type == (ushort) 210 || type == (ushort) 133 || type == (ushort) 134 || type == (ushort) 233) num5 = 2; if (type == (ushort) 33 || type == (ushort) 49 || type == (ushort) 174 || type == (ushort) 372) num5 = -4; if (type == (ushort) 3 || type == (ushort) 4 || type == (ushort) 5 || type == (ushort) 24 || type == (ushort) 33 || type == (ushort) 49 || type == (ushort) 372 || type == (ushort) 61 || type == (ushort) 71 || type == (ushort) 110 || type == (ushort) 174 || type == (ushort) 201 || type == (ushort) 323 || type == (ushort) 324) height1 = 20; else if (type == (ushort) 16 || type == (ushort) 17 || type == (ushort) 18 || type == (ushort) 20 || type == (ushort) 26 || type == (ushort) 32 || type == (ushort) 352 || type == (ushort) 69 || type == (ushort) 72 || type == (ushort) 77 || type == (ushort) 79 || type == (ushort) 80) height1 = 18; else if (type == (ushort) 14 || type == (ushort) 469 || type == (ushort) 15 || type == (ushort) 21 || type == (ushort) 467 || type == (ushort) 411 || type == (ushort) 441 || type == (ushort) 468) { if (num4 == (short) 18) height1 = 18; } else if (type == (ushort) 172 || type == (ushort) 376) { if ((int) num4 % 38 == 18) height1 = 18; } else { switch (type) { case 27: if ((int) num4 % 74 == 54) { height1 = 18; break; } break; case 132: num5 = 2; height1 = 18; break; case 135: num5 = 2; height1 = 18; break; case 137: height1 = 18; break; case 254: num5 = 2; break; case 378: num5 = 2; break; case 405: height1 = 16; if (num4 > (short) 0) { height1 = 18; break; } break; case 406: height1 = 16; if ((int) num4 % 54 >= 36) { height1 = 18; break; } break; case 462: height1 = 18; break; default: height1 = 16; break; } } if (type == (ushort) 52) num5 -= 2; if (type == (ushort) 324) num5 = -2; if (type == (ushort) 231 || type == (ushort) 238) num5 += 2; if (type == (ushort) 207) num5 = 2; width1 = type == (ushort) 4 || type == (ushort) 5 || type == (ushort) 323 || type == (ushort) 324 ? 20 : 16; if (type == (ushort) 73 || type == (ushort) 74 || type == (ushort) 113) { num5 -= 12; height1 = 32; } if (type == (ushort) 388 || type == (ushort) 389) { int num6 = TileObjectData.GetTileData((int) type, (int) num3 / 18).Height * 18 + 4; num5 = -2; if ((int) num4 == num6 - 20 || (int) num4 == num6 * 2 - 20 || num4 == (short) 0 || (int) num4 == num6) height1 = 18; } if (type == (ushort) 410 && num4 == (short) 36) height1 = 18; if (type == (ushort) 227) { width1 = 32; height1 = 38; if (num3 == (short) 238) num5 -= 6; else num5 -= 20; } if (type == (ushort) 185 || type == (ushort) 186 || type == (ushort) 187) { num5 = 2; switch (type) { case 185: Main.tileShine2[185] = num4 == (short) 18 && num3 >= (short) 576 && num3 <= (short) 882; break; case 186: Main.tileShine2[186] = num3 >= (short) 864 && num3 <= (short) 1170; break; } } if (type == (ushort) 178 && num4 <= (short) 36) num5 = 2; if (type == (ushort) 184) { width1 = 20; if (num4 <= (short) 36) num5 = 2; else if (num4 <= (short) 108) num5 = -2; } if (type == (ushort) 28) num5 += 2; if (type == (ushort) 81) { num5 -= 8; height1 = 26; width1 = 24; } if (type == (ushort) 105) num5 = 2; if (type == (ushort) 124) height1 = 18; if (type == (ushort) 137) height1 = 18; if (type == (ushort) 138) height1 = 18; if (type == (ushort) 139 || type == (ushort) 142 || type == (ushort) 143) num5 = 2; int num7 = 0; if (trackTile.halfBrick()) num7 = 8; int y1 = Main.tileFrame[(int) type] * 38; int num8 = 0; if (type == (ushort) 272) y1 = 0; if (type == (ushort) 106) y1 = Main.tileFrame[(int) type] * 54; if (type >= (ushort) 300 && type <= (ushort) 308) { y1 = Main.tileFrame[(int) type] * 54; num5 = 2; } if (type == (ushort) 354) { y1 = Main.tileFrame[(int) type] * 54; num5 = 2; } if (type == (ushort) 355) { y1 = Main.tileFrame[(int) type] * 54; num5 = 2; } if (type == (ushort) 377) { y1 = Main.tileFrame[(int) type] * 38; num5 = 2; } if (type == (ushort) 463) { y1 = Main.tileFrame[(int) type] * 72; num5 = 2; } if (type == (ushort) 464) { y1 = Main.tileFrame[(int) type] * 72; num5 = 2; } if (type == (ushort) 379) y1 = Main.tileFrame[(int) type] * 90; if (type == (ushort) 349) { int num9 = (int) num3 % 36; int num10 = (int) num4 % 54; int frameData; if (Animation.GetTemporaryFrame(index3 - num9 / 18, index2 - num10 / 18, out frameData)) num3 = (short) (36 * frameData + num9); } if (type == (ushort) 441 || type == (ushort) 468) { int num11 = (int) num3 % 36; int num12 = (int) num4 % 38; int frameData; if (Animation.GetTemporaryFrame(index3 - num11 / 18, index2 - num12 / 18, out frameData)) num4 = (short) (38 * frameData + num12); } if (type == (ushort) 390) y1 = Main.tileFrame[(int) type] * 36; if (type == (ushort) 412) { y1 = 0; num5 = 2; } if (type == (ushort) 455) { y1 = 0; num5 = 2; } if (type == (ushort) 406) { int num13 = Main.tileFrame[(int) type]; if (num4 >= (short) 108) num13 = 6 - (int) num4 / 54; else if (num4 >= (short) 54) num13 = Main.tileFrame[(int) type] - 1; y1 = num13 * 56 + (int) num4 / 54 * 2; } if (type == (ushort) 452) { int num14 = Main.tileFrame[(int) type]; if (num3 >= (short) 54) num14 = 0; y1 = num14 * 54; } if (type == (ushort) 455) { int num15 = 1 + Main.tileFrame[(int) type]; if (!BirthdayParty.PartyIsUp) num15 = 0; y1 = num15 * 54; } if (type == (ushort) 454) y1 = Main.tileFrame[(int) type] * 54; if (type == (ushort) 453) y1 = (Main.tileFrameCounter[(int) type] / 20 + (index2 - (int) trackTile.frameY / 18 + index3)) % 3 * 54; if (type == (ushort) 456) y1 = (Main.tileFrameCounter[(int) type] / 20 + (index2 - (int) trackTile.frameY / 18 + (index3 - (int) trackTile.frameX / 18))) % 4 * 54; if (type == (ushort) 405) { int num16 = Main.tileFrame[(int) type]; if (num3 >= (short) 54) num16 = 0; y1 = num16 * 38; } if (type == (ushort) 12) y1 = Main.tileFrame[(int) type] * 36; if (type == (ushort) 96) y1 = Main.tileFrame[(int) type] * 36; if (type == (ushort) 238) y1 = Main.tileFrame[(int) type] * 36; if (type == (ushort) 31) y1 = Main.tileFrame[(int) type] * 36; if (type == (ushort) 215) { y1 = num4 >= (short) 36 ? 252 : Main.tileFrame[(int) type] * 36; num5 = 2; } if (type == (ushort) 231) { y1 = Main.tileFrame[(int) type] * 54; num5 = 2; } if (type == (ushort) 243) { y1 = Main.tileFrame[(int) type] * 54; num5 = 2; } if (type == (ushort) 247) { y1 = Main.tileFrame[(int) type] * 54; num5 = 2; } if (type == (ushort) 228) { y1 = Main.tileFrame[(int) type] * 54; num5 = 2; } if (type == (ushort) 244) { num5 = 2; y1 = num3 >= (short) 54 ? 0 : Main.tileFrame[(int) type] * 36; } if (type == (ushort) 235) y1 = Main.tileFrame[(int) type] * 18; if (type == (ushort) 217 || type == (ushort) 218) { y1 = Main.tileFrame[(int) type] * 36; num5 = 2; } if (type == (ushort) 219 || type == (ushort) 220) { y1 = Main.tileFrame[(int) type] * 54; num5 = 2; } if (type == (ushort) 270 || type == (ushort) 271) { int num17 = Main.tileFrame[(int) type] + index3 % 6; if (index3 % 2 == 0) num17 += 3; if (index3 % 3 == 0) num17 += 3; if (index3 % 4 == 0) num17 += 3; while (num17 > 5) num17 -= 6; num8 = num17 * 18; y1 = 0; } switch (type) { case 428: num5 += 4; if (PressurePlateHelper.PressurePlatesPressed.ContainsKey(new Microsoft.Xna.Framework.Point(index3, index2))) { num8 += 18; break; } break; case 442: width1 = 20; height1 = 20; switch ((int) num3 / 22) { case 1: num5 = -4; break; case 2: num5 = -2; width1 = 24; break; case 3: num5 = -2; width1 = 16; break; } break; } if (TileID.Sets.TeamTiles[(int) type]) { if (TileID.Sets.Platforms[(int) type]) y1 = y1; else y1 += 90; } if (type == (ushort) 373 || type == (ushort) 374 || type == (ushort) 375 || type == (ushort) 461) { int num18 = 60; switch (type) { case 374: num18 = 120; break; case 375: num18 = 180; break; } if (Main.rand.Next(num18 * 2) == 0 && trackTile.liquid == (byte) 0) { Microsoft.Xna.Framework.Rectangle rectangle1 = new Microsoft.Xna.Framework.Rectangle(index3 * 16, index2 * 16, 16, 16); rectangle1.X -= 34; rectangle1.Width += 68; rectangle1.Y -= 100; rectangle1.Height = 400; bool flag2 = true; for (int index4 = 0; index4 < 500; ++index4) { if (Main.gore[index4].active && (Main.gore[index4].type >= 706 && Main.gore[index4].type <= 717 || Main.gore[index4].type == 943)) { Microsoft.Xna.Framework.Rectangle rectangle2 = new Microsoft.Xna.Framework.Rectangle((int) Main.gore[index4].position.X, (int) Main.gore[index4].position.Y, 16, 16); if (rectangle1.Intersects(rectangle2)) flag2 = false; } } if (flag2) { Vector2 Position = new Vector2((float) (index3 * 16), (float) (index2 * 16)); int Type = 706; if (Main.waterStyle > 1) Type = 706 + Main.waterStyle - 1; if (type == (ushort) 374) Type = 716; if (type == (ushort) 375) Type = 717; if (type == (ushort) 461) Type = 943; if (Type != 943 || Main.rand.Next(3) == 0) { int index5 = Gore.NewGore(Position, new Vector2(), Type); Main.gore[index5].velocity *= 0.0f; } } } } else { if (type >= (ushort) 275 && type <= (ushort) 281 || type == (ushort) 296 || type == (ushort) 297 || type == (ushort) 309 || type == (ushort) 358 || type == (ushort) 359 || type == (ushort) 414 || type == (ushort) 413) { Main.critterCage = true; int index6 = (index3 - (int) num3 / 18) / 6 * ((index2 - (int) num4 / 18) / 4) % Main.cageFrames; if (type == (ushort) 275 || type == (ushort) 359) y1 = Main.bunnyCageFrame[index6] * 54; if (type == (ushort) 276 || type == (ushort) 414) y1 = Main.squirrelCageFrame[index6] * 54; if (type == (ushort) 413) y1 = Main.squirrelCageFrameOrange[index6] * 54; if (type == (ushort) 277) y1 = Main.mallardCageFrame[index6] * 54; if (type == (ushort) 278) y1 = Main.duckCageFrame[index6] * 54; if (type == (ushort) 279 || type == (ushort) 358) y1 = Main.birdCageFrame[index6] * 54; if (type == (ushort) 280) y1 = Main.blueBirdCageFrame[index6] * 54; if (type == (ushort) 281) y1 = Main.redBirdCageFrame[index6] * 54; if (type == (ushort) 296) y1 = Main.scorpionCageFrame[0, index6] * 54; if (type == (ushort) 297) y1 = Main.scorpionCageFrame[0, index6] * 54; if (type == (ushort) 309) y1 = Main.penguinCageFrame[index6] * 54; } else if (type == (ushort) 285 || type == (ushort) 286 || type == (ushort) 298 || type == (ushort) 299 || type == (ushort) 310 || type == (ushort) 339 || type >= (ushort) 361 && type <= (ushort) 364 || type >= (ushort) 391 && type <= (ushort) 394) { Main.critterCage = true; int index7 = (index3 - (int) num3 / 18) / 3 * ((index2 - (int) num4 / 18) / 3) % Main.cageFrames; if (type == (ushort) 285) y1 = Main.snailCageFrame[index7] * 36; if (type == (ushort) 286) y1 = Main.snail2CageFrame[index7] * 36; if (type == (ushort) 298 || type == (ushort) 361) y1 = Main.frogCageFrame[index7] * 36; if (type == (ushort) 299 || type == (ushort) 363) y1 = Main.mouseCageFrame[index7] * 36; if (type == (ushort) 310 || type == (ushort) 364 || type == (ushort) 391) y1 = Main.wormCageFrame[index7] * 36; if (type == (ushort) 339 || type == (ushort) 362) y1 = Main.grasshopperCageFrame[index7] * 36; if (type == (ushort) 392 || type == (ushort) 393 || type == (ushort) 394) y1 = Main.slugCageFrame[(int) type - 392, index7] * 36; } else if (type == (ushort) 282 || type >= (ushort) 288 && type <= (ushort) 295 || type >= (ushort) 316 && type <= (ushort) 318 || type == (ushort) 360) { Main.critterCage = true; int index8 = (index3 - (int) num3 / 18) / 2 * ((index2 - (int) num4 / 18) / 3) % Main.cageFrames; if (type == (ushort) 282) y1 = Main.fishBowlFrame[index8] * 36; else if (type >= (ushort) 288 && type <= (ushort) 295 || type == (ushort) 360) { int index9 = (int) type - 288; if (type == (ushort) 360) index9 = 8; y1 = Main.butterflyCageFrame[index9, index8] * 36; } else if (type >= (ushort) 316 && type <= (ushort) 318) { int index10 = (int) type - 316; y1 = Main.jellyfishCageFrame[index10, index8] * 36; } } else { switch (type) { case 207: if (num4 >= (short) 72) { int num19 = Main.tileFrame[(int) type]; int num20 = index3; if ((int) num3 % 36 != 0) --num20; int num21 = num19 + num20 % 6; if (num21 >= 6) num21 -= 6; y1 = num21 * 72; break; } y1 = 0; break; case 410: y1 = num4 < (short) 56 ? 0 : Main.tileFrame[(int) type] * 56; break; default: if (type == (ushort) 326 || type == (ushort) 327 || type == (ushort) 328 || type == (ushort) 329 || type == (ushort) 336 || type == (ushort) 340 || type == (ushort) 341 || type == (ushort) 342 || type == (ushort) 343 || type == (ushort) 344 || type == (ushort) 345 || type == (ushort) 351 || type == (ushort) 421 || type == (ushort) 422 || type == (ushort) 458 || type == (ushort) 459) { y1 = Main.tileFrame[(int) type] * 90; break; } break; } } Texture2D texture1 = (Texture2D) null; Microsoft.Xna.Framework.Rectangle rectangle3 = Microsoft.Xna.Framework.Rectangle.Empty; Microsoft.Xna.Framework.Color color2 = Microsoft.Xna.Framework.Color.Transparent; byte num22 = (byte) (100.0 + 150.0 * (double) Main.martianLight); Microsoft.Xna.Framework.Color color3 = new Microsoft.Xna.Framework.Color((int) num22, (int) num22, (int) num22, 0); Microsoft.Xna.Framework.Color color4 = new Microsoft.Xna.Framework.Color(100, 100, 100, 0); Microsoft.Xna.Framework.Color color5 = new Microsoft.Xna.Framework.Color(150, 100, 50, 0); if (type <= (ushort) 93) { if (type <= (ushort) 34) { switch ((int) type - 10) { case 0: if ((int) num4 / 54 == 32) { texture1 = Main.glowMaskTexture[57]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4 % 54, width1, height1); color2 = color3; goto label_397; } else goto label_397; case 1: int num23 = (int) num4 / 54; if (num23 == 32) { texture1 = Main.glowMaskTexture[58]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4 % 54, width1, height1); color2 = color3; } if (num23 == 33) { texture1 = Main.glowMaskTexture[119]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4 % 54, width1, height1); color2 = color4; goto label_397; } else goto label_397; case 2: case 3: case 6: case 7: case 10: goto label_397; case 4: int num24 = (int) num3 / 54; if (num24 == 31) { texture1 = Main.glowMaskTexture[67]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3 % 54, (int) num4, width1, height1); color2 = color3; } if (num24 == 32) { texture1 = Main.glowMaskTexture[124]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3 % 54, (int) num4, width1, height1); color2 = color4; goto label_397; } else goto label_397; case 5: int num25 = (int) num4 / 40; if (num25 == 32) { texture1 = Main.glowMaskTexture[54]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4 % 40, width1, height1); color2 = color3; } if (num25 == 33) { texture1 = Main.glowMaskTexture[116]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4 % 40, width1, height1); color2 = color4; goto label_397; } else goto label_397; case 8: int num26 = (int) num3 / 36; if (num26 == 27) { texture1 = Main.glowMaskTexture[69]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3 % 36, (int) num4, width1, height1); color2 = color3; } if (num26 == 28) { texture1 = Main.glowMaskTexture[125]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3 % 36, (int) num4, width1, height1); color2 = color4; goto label_397; } else goto label_397; case 9: int num27 = (int) num4 / 18; if (num27 == 26) { texture1 = Main.glowMaskTexture[65]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4 % 18, width1, height1); color2 = color3; } if (num27 == 27) { texture1 = Main.glowMaskTexture[112]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4 % 18, width1, height1); color2 = color4; goto label_397; } else goto label_397; case 11: break; default: if (type != (ushort) 33) { if (type == (ushort) 34 && (int) num3 / 54 == 0 && (int) num4 / 54 == 33) { texture1 = Main.glowMaskTexture[55]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4 % 54, width1, height1); color2 = color3; goto label_397; } else goto label_397; } else if ((int) num3 / 18 == 0 && (int) num4 / 22 == 26) { texture1 = Main.glowMaskTexture[61]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4 % 22, width1, height1); color2 = color3; goto label_397; } else goto label_397; } } else if (type != (ushort) 42) { if (type != (ushort) 79) { switch ((int) type - 87) { case 0: int num28 = (int) num3 / 54; if (num28 == 26) { texture1 = Main.glowMaskTexture[64]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3 % 54, (int) num4, width1, height1); color2 = color3; } if (num28 == 27) { texture1 = Main.glowMaskTexture[121]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3 % 54, (int) num4, width1, height1); color2 = color4; goto label_397; } else goto label_397; case 1: int num29 = (int) num3 / 54; if (num29 == 24) { texture1 = Main.glowMaskTexture[59]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3 % 54, (int) num4, width1, height1); color2 = color3; } if (num29 == 25) { texture1 = Main.glowMaskTexture[120]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3 % 54, (int) num4, width1, height1); color2 = color4; goto label_397; } else goto label_397; case 2: int num30 = (int) num3 / 54; if (num30 == 29) { texture1 = Main.glowMaskTexture[66]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3 % 54, (int) num4, width1, height1); color2 = color3; } if (num30 == 30) { texture1 = Main.glowMaskTexture[123]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3 % 54, (int) num4, width1, height1); color2 = color4; goto label_397; } else goto label_397; case 3: int num31 = (int) num4 / 36; if (num31 == 27) { texture1 = Main.glowMaskTexture[52]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4 % 36, width1, height1); color2 = color3; } if (num31 == 28) { texture1 = Main.glowMaskTexture[113]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4 % 36, width1, height1); color2 = color4; goto label_397; } else goto label_397; case 6: if ((int) num3 / 54 == 27) { texture1 = Main.glowMaskTexture[62]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4 % 54, width1, height1); color2 = color3; goto label_397; } else goto label_397; default: goto label_397; } } else { int num32 = (int) num4 / 36; if (num32 == 27) { texture1 = Main.glowMaskTexture[53]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4 % 36, width1, height1); color2 = color3; } if (num32 == 28) { texture1 = Main.glowMaskTexture[114]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4 % 36, width1, height1); color2 = color4; goto label_397; } else goto label_397; } } else if ((int) num4 / 36 == 33) { texture1 = Main.glowMaskTexture[63]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4 % 36, width1, height1); color2 = color3; goto label_397; } else goto label_397; } else if (type <= (ushort) 184) { switch ((int) type - 100) { case 0: if ((int) num3 / 36 == 0 && (int) num4 / 36 == 27) { texture1 = Main.glowMaskTexture[68]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4 % 36, width1, height1); color2 = color3; goto label_397; } else goto label_397; case 1: int num33 = (int) num3 / 54; if (num33 == 28) { texture1 = Main.glowMaskTexture[60]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3 % 54, (int) num4, width1, height1); color2 = color3; } if (num33 == 29) { texture1 = Main.glowMaskTexture[115]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3 % 54, (int) num4, width1, height1); color2 = color4; goto label_397; } else goto label_397; case 2: case 3: goto label_397; case 4: int num34 = (int) num3 / 36; if (num34 == 24) { texture1 = Main.glowMaskTexture[51]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3 % 36, (int) num4, width1, height1); color2 = color3; } if (num34 == 25) { texture1 = Main.glowMaskTexture[118]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3 % 36, (int) num4, width1, height1); color2 = color4; goto label_397; } else goto label_397; default: if (type != (ushort) 172) { if (type == (ushort) 184 && trackTile.frameX == (short) 110) { texture1 = Main.glowMaskTexture[(int) sbyte.MaxValue]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1); color2 = color5; goto label_397; } else goto label_397; } else { int num35 = (int) num4 / 38; if (num35 == 28) { texture1 = Main.glowMaskTexture[88]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4 % 38, width1, height1); color2 = color3; } if (num35 == 29) { texture1 = Main.glowMaskTexture[122]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4 % 38, width1, height1); color2 = color4; goto label_397; } else goto label_397; } } } else { if (type <= (ushort) 463) { if (type != (ushort) 441) { if (type == (ushort) 463) { texture1 = Main.glowMaskTexture[243]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4 + y1, width1, height1); color2 = new Microsoft.Xna.Framework.Color((int) sbyte.MaxValue, (int) sbyte.MaxValue, (int) sbyte.MaxValue, 0); goto label_397; } else goto label_397; } } else if (type != (ushort) 467) { if (type != (ushort) 468) goto label_397; } else goto label_351; int num36 = (int) num3 / 36; if (num36 == 48) { texture1 = Main.glowMaskTexture[56]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3 % 36, (int) num4, width1, height1); color2 = color3; } if (num36 == 49) { texture1 = Main.glowMaskTexture[117]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3 % 36, (int) num4, width1, height1); color2 = color4; goto label_397; } else goto label_397; } label_351: int num37 = (int) num3 / 36; if (num37 == 48) { texture1 = Main.glowMaskTexture[56]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3 % 36, (int) num4, width1, height1); color2 = color3; } if (num37 == 49) { texture1 = Main.glowMaskTexture[117]; rectangle3 = new Microsoft.Xna.Framework.Rectangle((int) num3 % 36, (int) num4, width1, height1); color2 = color4; } label_397: Texture2D texture2 = (Texture2D) null; Microsoft.Xna.Framework.Rectangle rectangle4 = Microsoft.Xna.Framework.Rectangle.Empty; Microsoft.Xna.Framework.Color color6 = Microsoft.Xna.Framework.Color.Transparent; if (TileID.Sets.HasOutlines[(int) type] && Collision.InTileBounds(index3, index2, Main.TileInteractionLX, Main.TileInteractionLY, Main.TileInteractionHX, Main.TileInteractionHY) && Main.SmartInteractTileCoords.Contains(new Microsoft.Xna.Framework.Point(index3, index2))) { int num38 = ((int) color1.R + (int) color1.G + (int) color1.B) / 3; bool flag3 = false; if (Main.SmartInteractTileCoordsSelected.Contains(new Microsoft.Xna.Framework.Point(index3, index2))) flag3 = true; if (num38 > 10) { texture2 = Main.highlightMaskTexture[(int) type]; color6 = !flag3 ? new Microsoft.Xna.Framework.Color(num38 / 2, num38 / 2, num38 / 2, num38) : new Microsoft.Xna.Framework.Color(num38, num38, num38 / 3, num38); } } if (Main.player[Main.myPlayer].dangerSense) { bool flag4 = type == (ushort) 135 || type == (ushort) 137 || type == (ushort) 138 || type == (ushort) 141 || type == (ushort) 210 || type == (ushort) 442 || type == (ushort) 443 || type == (ushort) 444; if (trackTile.slope() == (byte) 0 && !trackTile.inActive()) { flag4 = flag4 || type == (ushort) 32 || type == (ushort) 69 || type == (ushort) 48 || type == (ushort) 232 || type == (ushort) 352 || type == (ushort) 51 || type == (ushort) 229; if (!Main.player[Main.myPlayer].fireWalk) flag4 = flag4 || type == (ushort) 37 || type == (ushort) 58 || type == (ushort) 76; if (!Main.player[Main.myPlayer].iceSkate) flag4 = flag4 || type == (ushort) 162; } if (flag4) { if (color1.R < byte.MaxValue) color1.R = byte.MaxValue; if (color1.G < (byte) 50) color1.G = (byte) 50; if (color1.B < (byte) 50) color1.B = (byte) 50; color1.A = Main.mouseTextColor; if (!Main.gamePaused && this.IsActive && Main.rand.Next(30) == 0) { int index11 = Dust.NewDust(new Vector2((float) (index3 * 16), (float) (index2 * 16)), 16, 16, 60, Alpha: 100, Scale: 0.3f); Main.dust[index11].fadeIn = 1f; Main.dust[index11].velocity *= 0.1f; Main.dust[index11].noLight = true; Main.dust[index11].noGravity = true; } } } if (Main.player[Main.myPlayer].findTreasure) { bool flag5 = false; if (type == (ushort) 185 && num4 == (short) 18 && num3 >= (short) 576 && num3 <= (short) 882) flag5 = true; if (type == (ushort) 186 && num3 >= (short) 864 && num3 <= (short) 1170) flag5 = true; if (flag5 || Main.tileSpelunker[(int) type] || Main.tileAlch[(int) type] && type != (ushort) 82) { byte num39 = 200; byte num40 = 170; if ((int) color1.R < (int) num39) color1.R = num39; if ((int) color1.G < (int) num40) color1.G = num40; color1.A = Main.mouseTextColor; if (!Main.gamePaused && this.IsActive && Main.rand.Next(60) == 0) { int index12 = Dust.NewDust(new Vector2((float) (index3 * 16), (float) (index2 * 16)), 16, 16, 204, Alpha: 150, Scale: 0.3f); Main.dust[index12].fadeIn = 1f; Main.dust[index12].velocity *= 0.1f; Main.dust[index12].noLight = true; } } } if (!Main.gamePaused && this.IsActive && (!Lighting.UpdateEveryFrame || Main.rand.Next(4) == 0)) { switch (type) { case 238: if (Main.rand.Next(10) == 0) { int index13 = Dust.NewDust(new Vector2((float) (index3 * 16), (float) (index2 * 16)), 16, 16, 168); Main.dust[index13].noGravity = true; Main.dust[index13].alpha = 200; break; } break; case 463: if (num4 == (short) 54 && num3 == (short) 0) { for (int index14 = 0; index14 < 4; ++index14) { if (Main.rand.Next(2) != 0) { Dust dust = Dust.NewDustDirect(new Vector2((float) (index3 * 16 + 4), (float) (index2 * 16)), 36, 8, 16); dust.noGravity = true; dust.alpha = 140; dust.fadeIn = 1.2f; dust.velocity = Vector2.Zero; } } } if (num4 == (short) 18 && (num3 == (short) 0 || num3 == (short) 36)) { for (int index15 = 0; index15 < 1; ++index15) { if (Main.rand.Next(13) == 0) { Dust dust = Dust.NewDustDirect(new Vector2((float) (index3 * 16), (float) (index2 * 16)), 8, 8, 274); dust.position = new Vector2((float) (index3 * 16 + 8), (float) (index2 * 16 + 8)); dust.position.X += num3 == (short) 36 ? 4f : -4f; dust.noGravity = true; dust.alpha = 128; dust.fadeIn = 1.2f; dust.noLight = true; dust.velocity = new Vector2(0.0f, Main.rand.NextFloatDirection() * 1.2f); } } break; } break; } if (type == (ushort) 139 && trackTile.frameX == (short) 36 && (int) trackTile.frameY % 36 == 0 && (int) Main.time % 7 == 0 && Main.rand.Next(3) == 0) { int Type = Main.rand.Next(570, 573); Vector2 Position = new Vector2((float) (index3 * 16 + 8), (float) (index2 * 16 - 8)); Vector2 Velocity = new Vector2(Main.windSpeed * 2f, -0.5f); Velocity.X *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258); Velocity.Y *= (float) (1.0 + (double) Main.rand.Next(-50, 51) * 0.00999999977648258); if (Type == 572) Position.X -= 8f; if (Type == 571) Position.X -= 4f; Gore.NewGore(Position, Velocity, Type, 0.8f); } if (type == (ushort) 244 && num3 == (short) 18 && num4 == (short) 18 && Main.rand.Next(2) == 0) { if (Main.rand.Next(500) == 0) Gore.NewGore(new Vector2((float) (index3 * 16 + 8), (float) (index2 * 16 + 8)), new Vector2(), 415, (float) Main.rand.Next(51, 101) * 0.01f); else if (Main.rand.Next(250) == 0) Gore.NewGore(new Vector2((float) (index3 * 16 + 8), (float) (index2 * 16 + 8)), new Vector2(), 414, (float) Main.rand.Next(51, 101) * 0.01f); else if (Main.rand.Next(80) == 0) Gore.NewGore(new Vector2((float) (index3 * 16 + 8), (float) (index2 * 16 + 8)), new Vector2(), 413, (float) Main.rand.Next(51, 101) * 0.01f); else if (Main.rand.Next(10) == 0) Gore.NewGore(new Vector2((float) (index3 * 16 + 8), (float) (index2 * 16 + 8)), new Vector2(), 412, (float) Main.rand.Next(51, 101) * 0.01f); else if (Main.rand.Next(3) == 0) Gore.NewGore(new Vector2((float) (index3 * 16 + 8), (float) (index2 * 16 + 8)), new Vector2(), 411, (float) Main.rand.Next(51, 101) * 0.01f); } if (type == (ushort) 165 && num3 >= (short) 162 && num3 <= (short) 214 && num4 == (short) 72 && Main.rand.Next(60) == 0) { int index16 = Dust.NewDust(new Vector2((float) (index3 * 16 + 2), (float) (index2 * 16 + 6)), 8, 4, 153); Main.dust[index16].scale -= (float) Main.rand.Next(3) * 0.1f; Main.dust[index16].velocity.Y = 0.0f; Main.dust[index16].velocity.X *= 0.05f; Main.dust[index16].alpha = 100; } if (type == (ushort) 42 && num3 == (short) 0) { int num41 = (int) num4 / 36; int num42 = (int) num4 / 18 % 2; if (num41 == 7 && num42 == 1) { if (Main.rand.Next(50) == 0) { int index17 = Dust.NewDust(new Vector2((float) (index3 * 16 + 4), (float) (index2 * 16 + 4)), 8, 8, 58, Alpha: 150); Main.dust[index17].velocity *= 0.5f; } if (Main.rand.Next(100) == 0) { int index18 = Gore.NewGore(new Vector2((float) (index3 * 16 - 2), (float) (index2 * 16 - 4)), new Vector2(), Main.rand.Next(16, 18)); Main.gore[index18].scale *= 0.7f; Main.gore[index18].velocity *= 0.25f; } } else if (num41 == 29 && num42 == 1 && Main.rand.Next(40) == 0) { int index19 = Dust.NewDust(new Vector2((float) (index3 * 16 + 4), (float) (index2 * 16)), 8, 8, 59, Alpha: 100); if (Main.rand.Next(3) != 0) Main.dust[index19].noGravity = true; Main.dust[index19].velocity *= 0.3f; Main.dust[index19].velocity.Y -= 1.5f; } } if (type == (ushort) 215 && num4 < (short) 36 && Main.rand.Next(3) == 0 && (Main.drawToScreen && Main.rand.Next(4) == 0 || !Main.drawToScreen) && num4 == (short) 0) { int index20 = Dust.NewDust(new Vector2((float) (index3 * 16 + 2), (float) (index2 * 16 - 4)), 4, 8, 31, Alpha: 100); if (num3 == (short) 0) Main.dust[index20].position.X += (float) Main.rand.Next(8); if (num3 == (short) 36) Main.dust[index20].position.X -= (float) Main.rand.Next(8); Main.dust[index20].alpha += Main.rand.Next(100); Main.dust[index20].velocity *= 0.2f; Main.dust[index20].velocity.Y -= (float) (0.5 + (double) Main.rand.Next(10) * 0.100000001490116); Main.dust[index20].fadeIn = (float) (0.5 + (double) Main.rand.Next(10) * 0.100000001490116); } if (type == (ushort) 4 && Main.rand.Next(40) == 0 && num3 < (short) 66) { int num43 = (int) num4 / 22; int Type; switch (num43) { case 0: Type = 6; break; case 8: Type = 75; break; case 9: Type = 135; break; case 10: Type = 158; break; case 11: Type = 169; break; case 12: Type = 156; break; case 13: Type = 234; break; case 14: Type = 66; break; default: Type = 58 + num43; break; } int index21; switch (num3) { case 22: index21 = Dust.NewDust(new Vector2((float) (index3 * 16 + 6), (float) (index2 * 16)), 4, 4, Type, Alpha: 100); break; case 44: index21 = Dust.NewDust(new Vector2((float) (index3 * 16 + 2), (float) (index2 * 16)), 4, 4, Type, Alpha: 100); break; default: index21 = Dust.NewDust(new Vector2((float) (index3 * 16 + 4), (float) (index2 * 16)), 4, 4, Type, Alpha: 100); break; } if (Main.rand.Next(3) != 0) Main.dust[index21].noGravity = true; Main.dust[index21].velocity *= 0.3f; Main.dust[index21].velocity.Y -= 1.5f; if (Type == 66) { Main.dust[index21].color = new Microsoft.Xna.Framework.Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); Main.dust[index21].noGravity = true; } } if (type == (ushort) 93 && Main.rand.Next(40) == 0 && num3 == (short) 0) { int num44 = (int) num4 / 54; if ((int) num4 / 18 % 3 == 0) { int Type; switch (num44) { case 0: case 6: case 7: case 8: case 10: case 14: case 15: case 16: Type = 6; break; case 20: Type = 59; break; default: Type = -1; break; } if (Type != -1) { int index22 = Dust.NewDust(new Vector2((float) (index3 * 16 + 4), (float) (index2 * 16 + 2)), 4, 4, Type, Alpha: 100); if (Main.rand.Next(3) != 0) Main.dust[index22].noGravity = true; Main.dust[index22].velocity *= 0.3f; Main.dust[index22].velocity.Y -= 1.5f; } } } if (type == (ushort) 100 && Main.rand.Next(40) == 0 && num3 < (short) 36) { int num45 = (int) num4 / 36; if ((int) num4 / 18 % 2 == 0) { int Type; switch (num45) { case 0: case 2: case 5: case 7: case 8: case 10: case 12: case 14: case 15: case 16: Type = 6; break; case 20: Type = 59; break; default: Type = -1; break; } if (Type != -1) { int index23 = Dust.NewDust(num3 != (short) 0 ? (Main.rand.Next(3) != 0 ? new Vector2((float) (index3 * 16), (float) (index2 * 16 + 2)) : new Vector2((float) (index3 * 16 + 6), (float) (index2 * 16 + 2))) : (Main.rand.Next(3) != 0 ? new Vector2((float) (index3 * 16 + 14), (float) (index2 * 16 + 2)) : new Vector2((float) (index3 * 16 + 4), (float) (index2 * 16 + 2))), 4, 4, Type, Alpha: 100); if (Main.rand.Next(3) != 0) Main.dust[index23].noGravity = true; Main.dust[index23].velocity *= 0.3f; Main.dust[index23].velocity.Y -= 1.5f; } } } if (type == (ushort) 98 && Main.rand.Next(40) == 0 && num4 == (short) 0 && num3 == (short) 0) { int index24 = Dust.NewDust(new Vector2((float) (index3 * 16 + 12), (float) (index2 * 16 + 2)), 4, 4, 6, Alpha: 100); if (Main.rand.Next(3) != 0) Main.dust[index24].noGravity = true; Main.dust[index24].velocity *= 0.3f; Main.dust[index24].velocity.Y -= 1.5f; } if (type == (ushort) 49 && Main.rand.Next(2) == 0) { int index25 = Dust.NewDust(new Vector2((float) (index3 * 16 + 4), (float) (index2 * 16 - 4)), 4, 4, 172, Alpha: 100); if (Main.rand.Next(3) == 0) { Main.dust[index25].scale = 0.5f; } else { Main.dust[index25].scale = 0.9f; Main.dust[index25].noGravity = true; } Main.dust[index25].velocity *= 0.3f; Main.dust[index25].velocity.Y -= 1.5f; } if (type == (ushort) 372 && Main.rand.Next(2) == 0) { int index26 = Dust.NewDust(new Vector2((float) (index3 * 16 + 4), (float) (index2 * 16 - 4)), 4, 4, 242, Alpha: 100); if (Main.rand.Next(3) == 0) { Main.dust[index26].scale = 0.5f; } else { Main.dust[index26].scale = 0.9f; Main.dust[index26].noGravity = true; } Main.dust[index26].velocity *= 0.3f; Main.dust[index26].velocity.Y -= 1.5f; } if (type == (ushort) 34 && Main.rand.Next(40) == 0 && num3 < (short) 54) { int num46 = (int) num4 / 54; int num47 = (int) num3 / 18 % 3; if ((int) num4 / 18 % 3 == 1 && num47 != 1) { int Type; switch (num46) { case 0: case 1: case 2: case 3: case 4: case 5: case 12: case 13: case 16: case 19: case 21: Type = 6; break; case 25: Type = 59; break; default: Type = -1; break; } if (Type != -1) { int index27 = Dust.NewDust(new Vector2((float) (index3 * 16), (float) (index2 * 16 + 2)), 14, 6, Type, Alpha: 100); if (Main.rand.Next(3) != 0) Main.dust[index27].noGravity = true; Main.dust[index27].velocity *= 0.3f; Main.dust[index27].velocity.Y -= 1.5f; } } } if (type == (ushort) 22 && Main.rand.Next(400) == 0) Dust.NewDust(new Vector2((float) (index3 * 16), (float) (index2 * 16)), 16, 16, 14); else if ((type == (ushort) 23 || type == (ushort) 24 || type == (ushort) 32) && Main.rand.Next(500) == 0) Dust.NewDust(new Vector2((float) (index3 * 16), (float) (index2 * 16)), 16, 16, 14); else if (type == (ushort) 25 && Main.rand.Next(700) == 0) Dust.NewDust(new Vector2((float) (index3 * 16), (float) (index2 * 16)), 16, 16, 14); else if (type == (ushort) 112 && Main.rand.Next(700) == 0) Dust.NewDust(new Vector2((float) (index3 * 16), (float) (index2 * 16)), 16, 16, 14); else if (type == (ushort) 31 && Main.rand.Next(20) == 0) { if (num3 >= (short) 36) { int index28 = Dust.NewDust(new Vector2((float) (index3 * 16), (float) (index2 * 16)), 16, 16, 5, Alpha: 100); Main.dust[index28].velocity.Y = 0.0f; Main.dust[index28].velocity.X *= 0.3f; } else Dust.NewDust(new Vector2((float) (index3 * 16), (float) (index2 * 16)), 16, 16, 14, Alpha: 100); } else if (type == (ushort) 26 && Main.rand.Next(20) == 0) { if (num3 >= (short) 54) { int index29 = Dust.NewDust(new Vector2((float) (index3 * 16), (float) (index2 * 16)), 16, 16, 5, Alpha: 100); Main.dust[index29].scale = 1.5f; Main.dust[index29].noGravity = true; Main.dust[index29].velocity *= 0.75f; } else Dust.NewDust(new Vector2((float) (index3 * 16), (float) (index2 * 16)), 16, 16, 14, Alpha: 100); } else if ((type == (ushort) 71 || type == (ushort) 72) && Main.rand.Next(500) == 0) Dust.NewDust(new Vector2((float) (index3 * 16), (float) (index2 * 16)), 16, 16, 41, Alpha: 250, Scale: 0.8f); else if ((type == (ushort) 17 || type == (ushort) 77 || type == (ushort) 133) && Main.rand.Next(40) == 0) { if (num3 == (short) 18 & num4 == (short) 18) { int index30 = Dust.NewDust(new Vector2((float) (index3 * 16 - 4), (float) (index2 * 16 - 6)), 8, 6, 6, Alpha: 100); if (Main.rand.Next(3) != 0) Main.dust[index30].noGravity = true; } } else if (type == (ushort) 405 && Main.rand.Next(20) == 0) { if (num3 == (short) 18 & num4 == (short) 18) { int index31 = Dust.NewDust(new Vector2((float) (index3 * 16 - 4), (float) (index2 * 16 - 6)), 24, 10, 6, Alpha: 100); if (Main.rand.Next(5) != 0) Main.dust[index31].noGravity = true; } } else if (type == (ushort) 452 && num4 == (short) 0 && num3 == (short) 0 && Main.rand.Next(3) == 0) { Vector2 Position = new Vector2((float) (index3 * 16 + 16), (float) (index2 * 16 + 8)); Vector2 Velocity = new Vector2(0.0f, 0.0f); if ((double) Main.windSpeed < 0.0) Velocity.X = -Main.windSpeed; int Type = 907 + Main.tileFrame[(int) type] / 5; if (Main.rand.Next(2) == 0) Gore.NewGore(Position, Velocity, Type, (float) ((double) Main.rand.NextFloat() * 0.400000005960464 + 0.400000005960464)); } else if (type == (ushort) 406 && num4 == (short) 54 && num3 == (short) 0 && Main.rand.Next(3) == 0) { Vector2 Position = new Vector2((float) (index3 * 16 + 16), (float) (index2 * 16 + 8)); Vector2 Velocity = new Vector2(0.0f, 0.0f); if ((double) Main.windSpeed < 0.0) Velocity.X = -Main.windSpeed; int Type = Main.rand.Next(825, 828); if (Main.rand.Next(4) == 0) Gore.NewGore(Position, Velocity, Type, (float) ((double) Main.rand.NextFloat() * 0.200000002980232 + 0.200000002980232)); else if (Main.rand.Next(2) == 0) Gore.NewGore(Position, Velocity, Type, (float) ((double) Main.rand.NextFloat() * 0.300000011920929 + 0.300000011920929)); else Gore.NewGore(Position, Velocity, Type, (float) ((double) Main.rand.NextFloat() * 0.400000005960464 + 0.400000005960464)); } else if (type == (ushort) 37 && Main.rand.Next(250) == 0) { int index32 = Dust.NewDust(new Vector2((float) (index3 * 16), (float) (index2 * 16)), 16, 16, 6, Scale: ((float) Main.rand.Next(3))); if ((double) Main.dust[index32].scale > 1.0) Main.dust[index32].noGravity = true; } else if ((type == (ushort) 58 || type == (ushort) 76) && Main.rand.Next(250) == 0) { int index33 = Dust.NewDust(new Vector2((float) (index3 * 16), (float) (index2 * 16)), 16, 16, 6, Scale: ((float) Main.rand.Next(3))); if ((double) Main.dust[index33].scale > 1.0) Main.dust[index33].noGravity = true; Main.dust[index33].noLight = true; } else if (type == (ushort) 61) { if (num3 == (short) 144) { if (Main.rand.Next(60) == 0) { int index34 = Dust.NewDust(new Vector2((float) (index3 * 16), (float) (index2 * 16)), 16, 16, 44, Alpha: 250, Scale: 0.4f); Main.dust[index34].fadeIn = 0.7f; } color1.A = (byte) (245.0 - (double) Main.mouseTextColor * 1.5); color1.R = (byte) (245.0 - (double) Main.mouseTextColor * 1.5); color1.B = (byte) (245.0 - (double) Main.mouseTextColor * 1.5); color1.G = (byte) (245.0 - (double) Main.mouseTextColor * 1.5); } } else if (Main.tileShine[(int) type] > 0) { Main.tileShine[211] = 500; if (color1.R > (byte) 20 || color1.B > (byte) 20 || color1.G > (byte) 20) { int num48 = (int) color1.R; if ((int) color1.G > num48) num48 = (int) color1.G; if ((int) color1.B > num48) num48 = (int) color1.B; int num49 = num48 / 30; if (Main.rand.Next(Main.tileShine[(int) type]) < num49 && (type != (ushort) 21 || num3 >= (short) 36 && num3 < (short) 180 || num3 >= (short) 396 && num3 <= (short) 409) && type != (ushort) 467) { Microsoft.Xna.Framework.Color newColor = Microsoft.Xna.Framework.Color.White; if (type == (ushort) 178) { switch ((int) num3 / 18) { case 0: newColor = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, 0, (int) byte.MaxValue, (int) byte.MaxValue); break; case 1: newColor = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, 0, (int) byte.MaxValue); break; case 2: newColor = new Microsoft.Xna.Framework.Color(0, 0, (int) byte.MaxValue, (int) byte.MaxValue); break; case 3: newColor = new Microsoft.Xna.Framework.Color(0, (int) byte.MaxValue, 0, (int) byte.MaxValue); break; case 4: newColor = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, 0, 0, (int) byte.MaxValue); break; case 5: newColor = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue); break; case 6: newColor = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, 0, (int) byte.MaxValue); break; } int index35 = Dust.NewDust(new Vector2((float) (index3 * 16), (float) (index2 * 16)), 16, 16, 43, Alpha: 254, newColor: newColor, Scale: 0.5f); Main.dust[index35].velocity *= 0.0f; } else { if (type == (ushort) 63) newColor = new Microsoft.Xna.Framework.Color(0, 0, (int) byte.MaxValue, (int) byte.MaxValue); if (type == (ushort) 64) newColor = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, 0, 0, (int) byte.MaxValue); if (type == (ushort) 65) newColor = new Microsoft.Xna.Framework.Color(0, (int) byte.MaxValue, 0, (int) byte.MaxValue); if (type == (ushort) 66) newColor = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, 0, (int) byte.MaxValue); if (type == (ushort) 67) newColor = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, 0, (int) byte.MaxValue, (int) byte.MaxValue); if (type == (ushort) 68) newColor = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue); if (type == (ushort) 12) newColor = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, 0, 0, (int) byte.MaxValue); if (type == (ushort) 204) newColor = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, 0, 0, (int) byte.MaxValue); if (type == (ushort) 211) newColor = new Microsoft.Xna.Framework.Color(50, (int) byte.MaxValue, 100, (int) byte.MaxValue); int index36 = Dust.NewDust(new Vector2((float) (index3 * 16), (float) (index2 * 16)), 16, 16, 43, Alpha: 254, newColor: newColor, Scale: 0.5f); Main.dust[index36].velocity *= 0.0f; } } } } } if (TileID.Sets.BasicChest[(int) type]) { Microsoft.Xna.Framework.Point key = new Microsoft.Xna.Framework.Point(index3, index2); if ((int) num3 % 36 != 0) --key.X; if ((int) num4 % 36 != 0) --key.Y; if (!dictionary1.ContainsKey(key)) dictionary1[key] = Chest.FindChest(key.X, key.Y); int num50 = (int) num3 / 18; int num51 = (int) num4 / 18; int num52 = (int) num3 / 36; num8 = num50 * 18 - (int) num3; int num53 = num51 * 18; if (dictionary1[key] != -1) { int frame = Main.chest[dictionary1[key]].frame; if (frame == 1) num53 += 38; if (frame == 2) num53 += 76; } y1 = num53 - (int) num4; if (num51 != 0) height1 = 18; if (type == (ushort) 21 && (num52 == 48 || num52 == 49)) rectangle3 = new Microsoft.Xna.Framework.Rectangle(16 * (num50 % 2), (int) num4 + y1, width1, height1); } if (type == (ushort) 378) { Microsoft.Xna.Framework.Point key = new Microsoft.Xna.Framework.Point(index3, index2); if ((int) num3 % 36 != 0) --key.X; if ((int) num4 % 54 != 0) key.Y -= (int) num4 / 18; if (!dictionary2.ContainsKey(key)) dictionary2[key] = TETrainingDummy.Find(key.X, key.Y); if (dictionary2[key] != -1) { int npc = ((TETrainingDummy) TileEntity.ByID[dictionary2[key]]).npc; if (npc != -1) y1 = Main.npc[npc].frame.Y / 55 * 54 + (int) num4 - (int) num4; } } if (type == (ushort) 395) { Microsoft.Xna.Framework.Point key = new Microsoft.Xna.Framework.Point(index3, index2); if ((int) num3 % 36 != 0) --key.X; if ((int) num4 % 36 != 0) --key.Y; if (!dictionary3.ContainsKey(key)) { dictionary3[key] = TEItemFrame.Find(key.X, key.Y); if (dictionary3[key] != -1) { Main.specX[index1] = key.X; Main.specY[index1] = key.Y; ++index1; } } } if ((type == (ushort) 269 || type == (ushort) 128) && (int) num4 / 18 == 2) { if (num3 >= (short) 100) { bool flag6 = false; int frameX = (int) Main.tile[index3, index2 - 1].frameX; if (frameX >= 100) { int num54 = 0; for (; frameX >= 100; frameX -= 100) ++num54; switch (num54) { case 15: case 36: case 41: case 42: case 58: case 59: case 60: case 61: case 62: case 63: flag6 = true; break; } } if (!flag6) { Main.specX[index1] = index3; Main.specY[index1] = index2; ++index1; } } if (Main.tile[index3, index2 - 1].frameX >= (short) 100) { Main.specX[index1] = index3; Main.specY[index1] = index2 - 1; ++index1; } if (Main.tile[index3, index2 - 2].frameX >= (short) 100) { Main.specX[index1] = index3; Main.specY[index1] = index2 - 2; ++index1; } } if (type == (ushort) 5 && num4 >= (short) 198 && num3 >= (short) 22) { Main.specX[index1] = index3; Main.specY[index1] = index2; ++index1; } if (type == (ushort) 323 && num3 <= (short) 132 && num3 >= (short) 88) { Main.specX[index1] = index3; Main.specY[index1] = index2; ++index1; } if (type == (ushort) 412 && num3 == (short) 0 && num4 == (short) 0) { Main.specX[index1] = index3; Main.specY[index1] = index2; ++index1; } if (type == (ushort) 237 && num3 == (short) 18 && num4 == (short) 0) { Main.specX[index1] = index3; Main.specY[index1] = index2; ++index1; } if (type == (ushort) 334 && (int) num4 / 18 == 1 && num3 >= (short) 5000) { int frameX = (int) Main.tile[index3, index2].frameX; int num55 = 0; for (; frameX >= 5000; frameX -= 5000) ++num55; if (num55 == 1 || num55 == 4) { Main.specX[index1] = index3; Main.specY[index1] = index2; ++index1; } } if (type == (ushort) 5 && num4 >= (short) 198 && num3 >= (short) 22) { Main.specX[index1] = index3; Main.specY[index1] = index2; ++index1; } if (type == (ushort) 323 && num3 <= (short) 132 && num3 >= (short) 88) { Main.specX[index1] = index3; Main.specY[index1] = index2; ++index1; } if (type == (ushort) 412 && num3 == (short) 0 && num4 == (short) 0) { Main.specX[index1] = index3; Main.specY[index1] = index2; ++index1; } if (type == (ushort) 237 && num3 == (short) 18 && num4 == (short) 0) { Main.specX[index1] = index3; Main.specY[index1] = index2; ++index1; } if (type == (ushort) 72 && num3 >= (short) 36) { int num56 = 0; switch (num4) { case 18: num56 = 1; break; case 36: num56 = 2; break; } Main.spriteBatch.Draw(Main.shroomCapTexture, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X - 22), (float) (index2 * 16 - (int) Main.screenPosition.Y - 26)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(num56 * 62, 0, 60, 42)), Lighting.GetColor(index3, index2), 0.0f, new Vector2(), 1f, effects, 0.0f); } if (color1.R >= (byte) 1 || color1.G >= (byte) 1 || color1.B >= (byte) 1) { Tile tile1 = Main.tile[index3 + 1, index2]; Tile tile2 = Main.tile[index3 - 1, index2]; Tile tile3 = Main.tile[index3, index2 - 1]; Tile tile4 = Main.tile[index3, index2 + 1]; if (tile1 == null) { tile1 = new Tile(); Main.tile[index3 + 1, index2] = tile1; } if (tile2 == null) { tile2 = new Tile(); Main.tile[index3 - 1, index2] = tile2; } if (tile3 == null) { tile3 = new Tile(); Main.tile[index3, index2 - 1] = tile3; } if (tile4 == null) { tile4 = new Tile(); Main.tile[index3, index2 + 1] = tile4; } if (solidOnly & flag1 && !trackTile.inActive() && !Main.tileSolidTop[(int) type]) { bool flag7 = false; if (trackTile.halfBrick()) { int num57 = 160; if (((int) tile2.liquid > num57 || (int) tile1.liquid > num57) && this.waterfallManager.CheckForWaterfall(index3, index2)) flag7 = true; } if (!flag7) { int num58 = 0; bool flag8 = false; bool flag9 = false; bool flag10 = false; bool flag11 = false; int index37 = 0; bool flag12 = false; int num59 = (int) trackTile.slope(); if (tile2.liquid > (byte) 0 && num59 != 1 && num59 != 3) { flag8 = true; switch (tile2.liquidType()) { case 0: flag12 = true; break; case 1: index37 = 1; break; case 2: index37 = 11; break; } if ((int) tile2.liquid > num58) num58 = (int) tile2.liquid; } if (tile1.liquid > (byte) 0 && num59 != 2 && num59 != 4) { flag9 = true; switch (tile1.liquidType()) { case 0: flag12 = true; break; case 1: index37 = 1; break; case 2: index37 = 11; break; } if ((int) tile1.liquid > num58) num58 = (int) tile1.liquid; } if (tile3.liquid > (byte) 0 && num59 != 3 && num59 != 4) { flag10 = true; switch (tile3.liquidType()) { case 0: flag12 = true; break; case 1: index37 = 1; break; case 2: index37 = 11; break; } } if (tile4.liquid > (byte) 0 && num59 != 1 && num59 != 2) { if (tile4.liquid > (byte) 240) flag11 = true; switch (tile4.liquidType()) { case 0: flag12 = true; break; case 1: index37 = 1; break; case 2: index37 = 11; break; } } if (waterStyleOverride != -1) Main.waterStyle = waterStyleOverride; if (index37 == 0) index37 = Main.waterStyle; if (flag10 | flag11 | flag8 | flag9 && (!flag12 || index37 != 1)) { Microsoft.Xna.Framework.Color color7 = Lighting.GetColor(index3, index2); Vector2 vector2_2 = new Vector2((float) (index3 * 16), (float) (index2 * 16)); Microsoft.Xna.Framework.Rectangle rectangle5 = new Microsoft.Xna.Framework.Rectangle(0, 4, 16, 16); if (flag11 && flag8 | flag9) { flag8 = true; flag9 = true; } if ((!flag10 || !(flag8 | flag9)) && !(flag11 & flag10)) { if (flag10) { rectangle5 = new Microsoft.Xna.Framework.Rectangle(0, 4, 16, 4); if (trackTile.halfBrick() || trackTile.slope() != (byte) 0) rectangle5 = new Microsoft.Xna.Framework.Rectangle(0, 4, 16, 12); } else if (flag11 && !flag8 && !flag9) { vector2_2 = new Vector2((float) (index3 * 16), (float) (index2 * 16 + 12)); rectangle5 = new Microsoft.Xna.Framework.Rectangle(0, 4, 16, 4); } else { float num60 = (float) (256 - num58) / 32f; int y2 = 4; if (tile3.liquid == (byte) 0 && !WorldGen.SolidTile(index3, index2 - 1)) y2 = 0; if (flag8 & flag9 || trackTile.halfBrick() || trackTile.slope() != (byte) 0) { vector2_2 = new Vector2((float) (index3 * 16), (float) (index2 * 16 + (int) num60 * 2)); rectangle5 = new Microsoft.Xna.Framework.Rectangle(0, y2, 16, 16 - (int) num60 * 2); } else if (flag8) { vector2_2 = new Vector2((float) (index3 * 16), (float) (index2 * 16 + (int) num60 * 2)); rectangle5 = new Microsoft.Xna.Framework.Rectangle(0, y2, 4, 16 - (int) num60 * 2); } else { vector2_2 = new Vector2((float) (index3 * 16 + 12), (float) (index2 * 16 + (int) num60 * 2)); rectangle5 = new Microsoft.Xna.Framework.Rectangle(0, y2, 4, 16 - (int) num60 * 2); } } } float num61 = 0.5f; switch (index37) { case 1: num61 = 1f; break; case 11: num61 *= 1.7f; if ((double) num61 > 1.0) { num61 = 1f; break; } break; } if ((double) index2 < Main.worldSurface || (double) num61 > 1.0) { num61 = 1f; if (tile3.wall > (byte) 0 || tile2.wall > (byte) 0 || tile1.wall > (byte) 0 || tile4.wall > (byte) 0) num61 = 0.65f; if (trackTile.wall > (byte) 0) num61 = 0.5f; } if (trackTile.halfBrick() && tile3.liquid > (byte) 0 && trackTile.wall > (byte) 0) num61 = 0.0f; color7 = new Microsoft.Xna.Framework.Color((int) (byte) ((float) color7.R * num61), (int) (byte) ((float) color7.G * num61), (int) (byte) ((float) color7.B * num61), (int) (byte) ((float) color7.A * num61)); Main.spriteBatch.Draw(Main.liquidTexture[index37], vector2_2 - Main.screenPosition + vector2_1, new Microsoft.Xna.Framework.Rectangle?(rectangle5), color7, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } } } switch (type) { case 51: Microsoft.Xna.Framework.Color color8 = Lighting.GetColor(index3, index2); float num62 = 0.5f; color8 = new Microsoft.Xna.Framework.Color((int) (byte) ((float) color8.R * num62), (int) (byte) ((float) color8.G * num62), (int) (byte) ((float) color8.B * num62), (int) (byte) ((float) color8.A * num62)); if (Main.canDrawColorTile(index3, index2)) { Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), color8, 0.0f, new Vector2(), 1f, effects, 0.0f); goto label_1285; } else { Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), color8, 0.0f, new Vector2(), 1f, effects, 0.0f); goto label_1285; } case 160: if (!trackTile.halfBrick()) { Microsoft.Xna.Framework.Color color9 = new Microsoft.Xna.Framework.Color(); color9 = new Microsoft.Xna.Framework.Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, (int) byte.MaxValue); if (trackTile.inActive()) color9 = trackTile.actColor(color9); if (trackTile.slope() == (byte) 0) { Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), color9, 0.0f, new Vector2(), 1f, effects, 0.0f); goto label_1285; } else if (trackTile.slope() > (byte) 2) { if (trackTile.slope() == (byte) 3) { for (int index38 = 0; index38 < 8; ++index38) { int width2 = 2; int num63 = index38 * 2; int num64 = index38 * -2; int height2 = 16 - index38 * 2; if (Main.canDrawColorTile(index3, index2)) Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + (float) num63, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + index38 * width2 + num64)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num63, (int) num4 + 16 - height2, width2, height2)), color9, 0.0f, new Vector2(), 1f, effects, 0.0f); else Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + (float) num63, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + index38 * width2 + num64)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num63, (int) num4 + 16 - height2, width2, height2)), color9, 0.0f, new Vector2(), 1f, effects, 0.0f); } } else { for (int index39 = 0; index39 < 8; ++index39) { int width3 = 2; int num65 = 16 - index39 * width3 - width3; int height3 = 16 - index39 * width3; int num66 = index39 * -2; if (Main.canDrawColorTile(index3, index2)) Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + (float) num65, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + index39 * width3 + num66)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num65, (int) num4 + 16 - height3, width3, height3)), color9, 0.0f, new Vector2(), 1f, effects, 0.0f); else Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + (float) num65, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + index39 * width3 + num66)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num65, (int) num4 + 16 - height3, width3, height3)), color9, 0.0f, new Vector2(), 1f, effects, 0.0f); } } if (Main.canDrawColorTile(index3, index2)) { Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, 16, 2)), color9, 0.0f, new Vector2(), 1f, effects, 0.0f); goto label_1285; } else { Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, 16, 2)), color9, 0.0f, new Vector2(), 1f, effects, 0.0f); goto label_1285; } } else { if (trackTile.slope() == (byte) 1) { for (int index40 = 0; index40 < 8; ++index40) { int width4 = 2; int num67 = index40 * 2; int height4 = 14 - index40 * width4; Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + (float) num67, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + index40 * width4)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num67, (int) num4, width4, height4)), color9, 0.0f, new Vector2(), 1f, effects, 0.0f); } } if (trackTile.slope() == (byte) 2) { for (int index41 = 0; index41 < 8; ++index41) { int width5 = 2; int num68 = 16 - index41 * width5 - width5; int height5 = 14 - index41 * width5; Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + (float) num68, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + index41 * width5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num68, (int) num4, width5, height5)), color9, 0.0f, new Vector2(), 1f, effects, 0.0f); } } if (Main.canDrawColorTile(index3, index2)) { Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + 14)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4 + 14, 16, 2)), color9, 0.0f, new Vector2(), 1f, effects, 0.0f); goto label_1285; } else { Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + 14)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4 + 14, 16, 2)), color9, 0.0f, new Vector2(), 1f, effects, 0.0f); goto label_1285; } } } else break; case 171: if (startY > index2 - (int) num4 && num4 == (short) 7) { num5 -= 16 * (int) num4; num3 = Main.tile[index3, index2 - (int) num4].frameX; num4 = Main.tile[index3, index2 - (int) num4].frameY; } if (num3 >= (short) 10) { int num69 = 0; if (((int) num4 & 1) == 1) ++num69; if (((int) num4 & 2) == 2) num69 += 2; if (((int) num4 & 4) == 4) num69 += 4; int num70 = 0; if (((int) num4 & 8) == 8) ++num70; if (((int) num4 & 16) == 16) num70 += 2; if (((int) num4 & 32) == 32) num70 += 4; int num71 = 0; if (((int) num4 & 64) == 64) ++num71; if (((int) num4 & 128) == 128) num71 += 2; if (((int) num4 & 256) == 256) num71 += 4; if (((int) num4 & 512) == 512) num71 += 8; int num72 = 0; if (((int) num4 & 1024) == 1024) ++num72; if (((int) num4 & 2048) == 2048) num72 += 2; if (((int) num4 & 4096) == 4096) num72 += 4; if (((int) num4 & 8192) == 8192) num72 += 8; Microsoft.Xna.Framework.Color color10 = Lighting.GetColor(index3 + 1, index2 + 4); Main.spriteBatch.Draw(Main.xmasTree[0], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 64, 128)), color10, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); if (num69 > 0) { int num73 = num69 - 1; Microsoft.Xna.Framework.Color color11 = color10; if (num73 != 3) color11 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue); Main.spriteBatch.Draw(Main.xmasTree[3], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(66 * num73, 0, 64, 128)), color11, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (num70 > 0) { int num74 = num70 - 1; Main.spriteBatch.Draw(Main.xmasTree[1], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(66 * num74, 0, 64, 128)), color10, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (num71 > 0) { int num75 = num71 - 1; Main.spriteBatch.Draw(Main.xmasTree[2], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(66 * num75, 0, 64, 128)), color10, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (num72 > 0) { int num76 = num72 - 1; Main.spriteBatch.Draw(Main.xmasTree[4], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(66 * num76, 130 * Main.tileFrame[171], 64, 128)), 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); goto label_1285; } else goto label_1285; } else goto label_1285; case 314: if (trackTile.inActive()) color1 = trackTile.actColor(color1); else if (Main.tileShine2[(int) type]) color1 = Main.shine(color1, (int) type); int frontColor; int backColor; Minecart.TrackColors(index3, index2, trackTile, out frontColor, out backColor); Texture2D texture3 = !Main.canDrawColorTile(type, frontColor) ? Main.tileTexture[(int) type] : (Texture2D) Main.tileAltTexture[(int) type, frontColor]; Texture2D texture4 = !Main.canDrawColorTile(type, backColor) ? Main.tileTexture[(int) type] : (Texture2D) Main.tileAltTexture[(int) type, backColor]; int num77 = (int) trackTile.frameNumber(); if (num4 != (short) -1) Main.spriteBatch.Draw(texture4, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X), (float) (index2 * 16 - (int) Main.screenPosition.Y)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(Minecart.GetSourceRect((int) num4, Main.tileFrame[314])), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); Main.spriteBatch.Draw(texture3, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X), (float) (index2 * 16 - (int) Main.screenPosition.Y)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(Minecart.GetSourceRect((int) num3, Main.tileFrame[314])), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); if (Minecart.DrawLeftDecoration((int) num4)) Main.spriteBatch.Draw(texture4, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X), (float) ((index2 + 1) * 16 - (int) Main.screenPosition.Y)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(Minecart.GetSourceRect(36)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); if (Minecart.DrawLeftDecoration((int) num3)) Main.spriteBatch.Draw(texture3, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X), (float) ((index2 + 1) * 16 - (int) Main.screenPosition.Y)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(Minecart.GetSourceRect(36)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); if (Minecart.DrawRightDecoration((int) num4)) Main.spriteBatch.Draw(texture4, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X), (float) ((index2 + 1) * 16 - (int) Main.screenPosition.Y)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(Minecart.GetSourceRect(37, Main.tileFrame[314])), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); if (Minecart.DrawRightDecoration((int) num3)) Main.spriteBatch.Draw(texture3, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X), (float) ((index2 + 1) * 16 - (int) Main.screenPosition.Y)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(Minecart.GetSourceRect(37)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); if (Minecart.DrawBumper((int) num3)) { Main.spriteBatch.Draw(texture3, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X), (float) ((index2 - 1) * 16 - (int) Main.screenPosition.Y)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(Minecart.GetSourceRect(39)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); goto label_1285; } else if (Minecart.DrawBouncyBumper((int) num3)) { Main.spriteBatch.Draw(texture3, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X), (float) ((index2 - 1) * 16 - (int) Main.screenPosition.Y)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(Minecart.GetSourceRect(38)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); goto label_1285; } else goto label_1285; } if (trackTile.slope() > (byte) 0) { if (trackTile.inActive()) color1 = trackTile.actColor(color1); else if (Main.tileShine2[(int) type]) color1 = Main.shine(color1, (int) type); if (TileID.Sets.Platforms[(int) trackTile.type]) { if (Main.canDrawColorTile(index3, index2)) Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, 16, 16)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); else Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, 16, 16)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); if (trackTile.slope() == (byte) 1 && Main.tile[index3 + 1, index2 + 1].active() && Main.tile[index3 + 1, index2 + 1].slope() != (byte) 2 && !Main.tile[index3 + 1, index2 + 1].halfBrick() && !TileID.Sets.BlocksStairs[(int) Main.tile[index3 + 1, index2 + 1].type] && !TileID.Sets.BlocksStairsAbove[(int) Main.tile[index3, index2 + 1].type]) { if (TileID.Sets.Platforms[(int) Main.tile[index3 + 1, index2 + 1].type] && Main.tile[index3 + 1, index2 + 1].slope() == (byte) 0) { if (Main.canDrawColorTile(index3, index2)) Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + 16)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(324, (int) num4, 16, 16)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); else Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + 16)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(324, (int) num4, 16, 16)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); } else if (Main.canDrawColorTile(index3, index2)) Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + 16)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(198, (int) num4, 16, 16)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); else Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + 16)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(198, (int) num4, 16, 16)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); } else if (trackTile.slope() == (byte) 2 && Main.tile[index3 - 1, index2 + 1].active() && Main.tile[index3 - 1, index2 + 1].slope() != (byte) 1 && !Main.tile[index3 - 1, index2 + 1].halfBrick() && !TileID.Sets.BlocksStairs[(int) Main.tile[index3 - 1, index2 + 1].type] && !TileID.Sets.BlocksStairsAbove[(int) Main.tile[index3, index2 + 1].type]) { if (TileID.Sets.Platforms[(int) Main.tile[index3 - 1, index2 + 1].type] && Main.tile[index3 - 1, index2 + 1].slope() == (byte) 0) { if (Main.canDrawColorTile(index3, index2)) Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + 16)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(306, (int) num4, 16, 16)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); else Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + 16)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(306, (int) num4, 16, 16)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); } else if (Main.canDrawColorTile(index3, index2)) Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + 16)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(162, (int) num4, 16, 16)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); else Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + 16)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(162, (int) num4, 16, 16)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); } } else if (TileID.Sets.HasSlopeFrames[(int) trackTile.type]) { if (Main.canDrawColorTile(index3, index2)) Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, (int) num4 + y1, 16, 16)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); else Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, (int) num4 + y1, 16, 16)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); } else if (trackTile.slope() > (byte) 2) { if (trackTile.slope() == (byte) 3) { for (int index42 = 0; index42 < 8; ++index42) { int width6 = 2; int num78 = index42 * 2; int num79 = index42 * -2; int height6 = 16 - index42 * 2; if (Main.canDrawColorTile(index3, index2)) Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + (float) num78, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + index42 * width6 + num79)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num78 + num8, (int) num4 + 16 - height6 + y1, width6, height6)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); else Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + (float) num78, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + index42 * width6 + num79)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num78 + num8, (int) num4 + 16 - height6 + y1, width6, height6)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); } } else { for (int index43 = 0; index43 < 8; ++index43) { int width7 = 2; int num80 = 16 - index43 * width7 - width7; int height7 = 16 - index43 * width7; int num81 = index43 * -2; if (Main.canDrawColorTile(index3, index2)) Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + (float) num80, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + index43 * width7 + num81)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num80 + num8, (int) num4 + 16 - height7 + y1, width7, height7)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); else Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + (float) num80, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + index43 * width7 + num81)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num80 + num8, (int) num4 + 16 - height7 + y1, width7, height7)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); } } if (Main.canDrawColorTile(index3, index2)) Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, (int) num4 + y1, 16, 2)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); else Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, (int) num4 + y1, 16, 2)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); } else { if (trackTile.slope() == (byte) 1) { for (int index44 = 0; index44 < 8; ++index44) { int width8 = 2; int num82 = index44 * 2; int height8 = 14 - index44 * width8; if (Main.canDrawColorTile(index3, index2)) Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + (float) num82, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + index44 * width8)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num82 + num8, (int) num4 + y1, width8, height8)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); else Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + (float) num82, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + index44 * width8)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num82 + num8, (int) num4 + y1, width8, height8)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); } } if (trackTile.slope() == (byte) 2) { for (int index45 = 0; index45 < 8; ++index45) { int width9 = 2; int num83 = 16 - index45 * width9 - width9; int height9 = 14 - index45 * width9; if (Main.canDrawColorTile(index3, index2)) Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + (float) num83, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + index45 * width9)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num83 + num8, (int) num4 + y1, width9, height9)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); else Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + (float) num83, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + index45 * width9)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num83 + num8, (int) num4 + y1, width9, height9)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); } } if (Main.canDrawColorTile(index3, index2)) Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + 14)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, (int) num4 + 14 + y1, 16, 2)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); else Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + 14)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, (int) num4 + 14 + y1, 16, 2)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); } } else if (type == (ushort) 129) { Vector2 vector2_3 = new Vector2(0.0f, 0.0f); if (num4 < (short) 36) vector2_3.Y += (float) (2 * (num4 == (short) 0).ToDirectionInt()); else vector2_3.X += (float) (2 * (num4 == (short) 36).ToDirectionInt()); Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1 + vector2_3, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 100), 0.0f, new Vector2(), 1f, effects, 0.0f); } else if (Main.tileAlch[(int) type]) { height1 = 20; num5 = -2; int i = (int) type; int num84 = (int) num3 / 18; if (i > 82) { if (num84 == 0 && Main.dayTime) i = 84; if (num84 == 1 && !Main.dayTime) i = 84; if (num84 == 3 && !Main.dayTime && (Main.bloodMoon || Main.moonPhase == 0)) i = 84; if (num84 == 4 && (Main.raining || (double) Main.cloudAlpha > 0.0)) i = 84; if (num84 == 5 && !Main.raining && Main.time > 40500.0) i = 84; } if (i == 84) { if (num84 == 0 && Main.rand.Next(100) == 0) { int index46 = Dust.NewDust(new Vector2((float) (index3 * 16), (float) (index2 * 16 - 4)), 16, 16, 19, Alpha: 160, Scale: 0.1f); Main.dust[index46].velocity.X /= 2f; Main.dust[index46].velocity.Y /= 2f; Main.dust[index46].noGravity = true; Main.dust[index46].fadeIn = 1f; } if (num84 == 1 && Main.rand.Next(100) == 0) Dust.NewDust(new Vector2((float) (index3 * 16), (float) (index2 * 16)), 16, 16, 41, Alpha: 250, Scale: 0.8f); if (num84 == 3) { if (Main.rand.Next(200) == 0) { int index47 = Dust.NewDust(new Vector2((float) (index3 * 16), (float) (index2 * 16)), 16, 16, 14, Alpha: 100, Scale: 0.2f); Main.dust[index47].fadeIn = 1.2f; } if (Main.rand.Next(75) == 0) { int index48 = Dust.NewDust(new Vector2((float) (index3 * 16), (float) (index2 * 16)), 16, 16, 27, Alpha: 100); Main.dust[index48].velocity.X /= 2f; Main.dust[index48].velocity.Y /= 2f; } } if (num84 == 4 && Main.rand.Next(150) == 0) { int index49 = Dust.NewDust(new Vector2((float) (index3 * 16), (float) (index2 * 16)), 16, 8, 16); Main.dust[index49].velocity.X /= 3f; Main.dust[index49].velocity.Y /= 3f; Main.dust[index49].velocity.Y -= 0.7f; Main.dust[index49].alpha = 50; Main.dust[index49].scale *= 0.1f; Main.dust[index49].fadeIn = 0.9f; Main.dust[index49].noGravity = true; } if (num84 == 5) { if (Main.rand.Next(40) == 0) { int index50 = Dust.NewDust(new Vector2((float) (index3 * 16), (float) (index2 * 16 - 6)), 16, 16, 6, Scale: 1.5f); Main.dust[index50].velocity.Y -= 2f; Main.dust[index50].noGravity = true; } color1.A = (byte) ((uint) Main.mouseTextColor / 2U); color1.G = Main.mouseTextColor; color1.B = Main.mouseTextColor; } if (num84 == 6) { if (Main.rand.Next(30) == 0) { Microsoft.Xna.Framework.Color newColor = new Microsoft.Xna.Framework.Color(50, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue); int index51 = Dust.NewDust(new Vector2((float) (index3 * 16), (float) (index2 * 16)), 16, 16, 43, Alpha: 254, newColor: newColor, Scale: 0.5f); Main.dust[index51].velocity *= 0.0f; } byte num85 = (byte) (((int) Main.mouseTextColor + (int) color1.G * 2) / 3); byte num86 = (byte) (((int) Main.mouseTextColor + (int) color1.B * 2) / 3); if ((int) num85 > (int) color1.G) color1.G = num85; if ((int) num86 > (int) color1.B) color1.B = num86; } } if (Main.canDrawColorTile(index3, index2)) { Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); } else { this.LoadTiles(i); Main.spriteBatch.Draw(Main.tileTexture[i], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); } } else if (type == (ushort) 80) { bool flag13 = false; bool flag14 = false; bool flag15 = false; if (!Main.canDrawColorTile(index3, index2)) { int index52 = index3; if (num3 == (short) 36) --index52; if (num3 == (short) 54) ++index52; if (num3 == (short) 108) { if (num4 == (short) 18) --index52; else ++index52; } int index53 = index2; bool flag16 = false; if (Main.tile[index52, index53].type == (ushort) 80 && Main.tile[index52, index53].active()) flag16 = true; while (!Main.tile[index52, index53].active() || !Main.tileSolid[(int) Main.tile[index52, index53].type] || !flag16) { if (Main.tile[index52, index53].type == (ushort) 80 && Main.tile[index52, index53].active()) flag16 = true; ++index53; if (index53 > index2 + 20) break; } if (Main.tile[index52, index53].type == (ushort) 112) flag13 = true; if (Main.tile[index52, index53].type == (ushort) 116) flag14 = true; if (Main.tile[index52, index53].type == (ushort) 234) flag15 = true; } if (flag13) Main.spriteBatch.Draw(Main.evilCactusTexture, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); else if (flag15) Main.spriteBatch.Draw(Main.crimsonCactusTexture, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); else if (flag14) Main.spriteBatch.Draw(Main.goodCactusTexture, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); else if (Main.canDrawColorTile(index3, index2)) Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); else Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); } else if (type == (ushort) 272 && !trackTile.halfBrick() && !Main.tile[index3 - 1, index2].halfBrick() && !Main.tile[index3 + 1, index2].halfBrick()) { int num87 = Main.tileFrame[(int) type] + index3 % 2 + index2 % 2 + index3 % 3 + index2 % 3; while (num87 > 1) num87 -= 2; int num88 = num87 * 90; if (trackTile.inActive()) color1 = trackTile.actColor(color1); else if (Main.tileShine2[(int) type]) color1 = Main.shine(color1, (int) type); if (Main.canDrawColorTile(index3, index2)) Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4 + num88, width1, height1)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); else Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4 + num88, width1, height1)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); } else { if (type == (ushort) 160) color1 = new Microsoft.Xna.Framework.Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, (int) byte.MaxValue); if (type != (ushort) 19 && type != (ushort) 380 && Main.tileSolid[(int) type] && !TileID.Sets.NotReallySolid[(int) type] && !trackTile.halfBrick() && (Main.tile[index3 - 1, index2].halfBrick() || Main.tile[index3 + 1, index2].halfBrick())) { if (trackTile.inActive()) color1 = trackTile.actColor(color1); else if (Main.tileShine2[(int) type]) color1 = Main.shine(color1, (int) type); if (Main.tile[index3 - 1, index2].halfBrick() && Main.tile[index3 + 1, index2].halfBrick()) { if (Main.canDrawColorTile(index3, index2)) { Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + 8)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, y1 + (int) num4 + 8, width1, 8)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(126 + num8, y1, 16, 8)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); } else { Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + 8)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, y1 + (int) num4 + 8, width1, 8)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); if (!Main.tile[index3, index2 - 1].bottomSlope() && (int) Main.tile[index3, index2 - 1].type == (int) type) Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(90 + num8, y1, 16, 8)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); else Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(126 + num8, y1, 16, 8)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); } } else if (Main.tile[index3 - 1, index2].halfBrick()) { if (Main.canDrawColorTile(index3, index2)) { Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + 8)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, y1 + (int) num4 + 8, width1, 8)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) ((double) (index3 * 16 - (int) Main.screenPosition.X) - ((double) width1 - 16.0) / 2.0 + 4.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + 4 + num8, y1 + (int) num4, width1 - 4, height1)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(126 + num8, y1, 4, 8)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); } else { Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + 8)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, y1 + (int) num4 + 8, width1, 8)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) ((double) (index3 * 16 - (int) Main.screenPosition.X) - ((double) width1 - 16.0) / 2.0 + 4.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + 4 + num8, y1 + (int) num4, width1 - 4, height1)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(126 + num8, y1, 4, 8)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); } } else if (Main.tile[index3 + 1, index2].halfBrick()) { if (Main.canDrawColorTile(index3, index2)) { Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + 8)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, y1 + (int) num4 + 8, width1, 8)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, y1 + (int) num4, width1 - 4, height1)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) ((double) (index3 * 16 - (int) Main.screenPosition.X) - ((double) width1 - 16.0) / 2.0 + 12.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(138 + num8, y1, 4, 8)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); } else { Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + 8)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, y1 + (int) num4 + 8, width1, 8)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, y1 + (int) num4, width1 - 4, height1)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) ((double) (index3 * 16 - (int) Main.screenPosition.X) - ((double) width1 - 16.0) / 2.0 + 12.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(138, 0, 4, 8)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); } } else if (Main.canDrawColorTile(index3, index2)) Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, y1 + (int) num4, width1, height1)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); else Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, y1 + (int) num4, width1, height1)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); } else if (Lighting.NotRetro && Main.tileSolid[(int) type] && type != (ushort) 137 && type != (ushort) 235 && type != (ushort) 388 && !trackTile.halfBrick() && !trackTile.inActive()) { if ((int) color1.R > num1 || (double) color1.G > (double) num1 * 1.1 || (double) color1.B > (double) num1 * 1.2) { Lighting.GetColor9Slice(index3, index2, ref slices); bool flag17 = trackTile.inActive(); bool flag18 = Main.tileShine2[(int) type]; Texture2D texture5 = !Main.canDrawColorTile(index3, index2) ? Main.tileTexture[(int) type] : (Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()]; for (int index54 = 0; index54 < 9; ++index54) { int num89 = 0; int num90 = 0; int width10 = 4; int height10 = 4; switch (index54) { case 1: width10 = 8; num89 = 4; break; case 2: num89 = 12; break; case 3: height10 = 8; num90 = 4; break; case 4: width10 = 8; height10 = 8; num89 = 4; num90 = 4; break; case 5: num89 = 12; num90 = 4; height10 = 8; break; case 6: num90 = 12; break; case 7: width10 = 8; height10 = 4; num89 = 4; num90 = 12; break; case 8: num89 = 12; num90 = 12; break; } Microsoft.Xna.Framework.Color color12 = color1; Microsoft.Xna.Framework.Color color13 = slices[index54]; color12.R = (byte) (((int) color1.R + (int) color13.R) / 2); color12.G = (byte) (((int) color1.G + (int) color13.G) / 2); color12.B = (byte) (((int) color1.B + (int) color13.B) / 2); if (flag17) color12 = trackTile.actColor(color12); else if (flag18) color12 = Main.shine(color12, (int) type); Main.spriteBatch.Draw(texture5, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + (float) num89, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + num90)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num89 + num8, (int) num4 + num90 + y1, width10, height10)), color12, 0.0f, new Vector2(), 1f, effects, 0.0f); } } else if ((int) color1.R > num2 || (double) color1.G > (double) num2 * 1.1 || (double) color1.B > (double) num2 * 1.2) { Lighting.GetColor4Slice(index3, index2, ref slices); bool flag19 = trackTile.inActive(); bool flag20 = Main.tileShine2[(int) type]; Texture2D texture6 = !Main.canDrawColorTile(index3, index2) ? Main.tileTexture[(int) type] : (Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()]; for (int index55 = 0; index55 < 4; ++index55) { int num91 = 0; int num92 = 0; switch (index55) { case 1: num91 = 8; break; case 2: num92 = 8; break; case 3: num91 = 8; num92 = 8; break; } Microsoft.Xna.Framework.Color color14 = color1; Microsoft.Xna.Framework.Color color15 = slices[index55]; color14.R = (byte) (((int) color1.R + (int) color15.R) / 2); color14.G = (byte) (((int) color1.G + (int) color15.G) / 2); color14.B = (byte) (((int) color1.B + (int) color15.B) / 2); if (flag19) color14 = trackTile.actColor(color14); else if (flag20) color14 = Main.shine(color14, (int) type); Main.spriteBatch.Draw(texture6, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + (float) num91, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + num92)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num91 + num8, (int) num4 + num92 + y1, 8, 8)), color14, 0.0f, new Vector2(), 1f, effects, 0.0f); } } else { if (trackTile.inActive()) color1 = trackTile.actColor(color1); else if (Main.tileShine2[(int) type]) color1 = Main.shine(color1, (int) type); Texture2D texture7 = !Main.canDrawColorTile(index3, index2) ? Main.tileTexture[(int) type] : (Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()]; Main.spriteBatch.Draw(texture7, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, (int) num4 + y1, width1, height1)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); } } else { if (Lighting.NotRetro && Main.tileShine2[(int) type]) { if (type == (ushort) 21) { if (num3 >= (short) 36 && num3 < (short) 178) color1 = Main.shine(color1, (int) type); } else if (!trackTile.inActive()) color1 = Main.shine(color1, (int) type); } if (trackTile.inActive()) color1 = trackTile.actColor(color1); switch (type) { case 5: int x1 = index3; int y3 = index2; if (num3 == (short) 66 && num4 <= (short) 45) ++x1; if (num3 == (short) 88 && num4 >= (short) 66 && num4 <= (short) 110) --x1; if (num3 == (short) 22 && num4 >= (short) 132) --x1; if (num3 == (short) 44 && num4 >= (short) 132) ++x1; while (Main.tile[x1, y3].active() && Main.tile[x1, y3].type == (ushort) 5) ++y3; int treeVariant = Main.GetTreeVariant(x1, y3); if (treeVariant == -1) { if (Main.canDrawColorTile(index3, index2)) { Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); break; } Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); break; } if (Main.canDrawColorTree(index3, index2, treeVariant)) { Main.spriteBatch.Draw((Texture2D) Main.woodAltTexture[treeVariant, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); break; } Main.spriteBatch.Draw(Main.woodTexture[treeVariant], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); break; case 128: case 269: int x2 = (int) num3; while (x2 >= 100) x2 -= 100; Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(x2, (int) num4, width1, height1)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); break; case 323: int num93 = -1; int index56 = index3; int index57 = index2; while (Main.tile[index56, index57].active() && Main.tile[index56, index57].type == (ushort) 323) ++index57; if (Main.tile[index56, index57].active() && Main.tile[index56, index57].type == (ushort) 53) num93 = 0; if (Main.tile[index56, index57].active() && Main.tile[index56, index57].type == (ushort) 234) num93 = 1; if (Main.tile[index56, index57].active() && Main.tile[index56, index57].type == (ushort) 116) num93 = 2; if (Main.tile[index56, index57].active() && Main.tile[index56, index57].type == (ushort) 112) num93 = 3; int y4 = 22 * num93; int num94 = (int) num4; if (Main.canDrawColorTile(index3, index2)) { Main.spriteBatch.Draw((Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + (float) num94, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, y4, width1, height1)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); break; } Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + (float) num94, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, y4, width1, height1)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); break; case 334: int x3 = (int) num3; int num95 = 0; while (x3 >= 5000) { x3 -= 5000; ++num95; } if (num95 != 0) x3 = (num95 - 1) * 18; Main.spriteBatch.Draw(Main.tileTexture[(int) type], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(x3, (int) num4, width1, height1)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); break; default: if (num7 == 8 && (!Main.tile[index3, index2 + 1].active() || !Main.tileSolid[(int) Main.tile[index3, index2 + 1].type] || Main.tile[index3, index2 + 1].halfBrick())) { Texture2D texture8 = !Main.canDrawColorTile(index3, index2) ? Main.tileTexture[(int) type] : (Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()]; if (TileID.Sets.Platforms[(int) type]) { Main.spriteBatch.Draw(texture8, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + num7)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, (int) num4 + y1, width1, height1)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); } else { Main.spriteBatch.Draw(texture8, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + num7)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, (int) num4 + y1, width1, height1 - num7 - 4)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); Main.spriteBatch.Draw(texture8, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + 12)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(144 + num8, 66 + y1, width1, 4)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); } } else { Texture2D texture9 = !Main.canDrawColorTile(index3, index2) ? Main.tileTexture[(int) type] : (Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()]; Main.spriteBatch.Draw(texture9, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + num7)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, (int) num4 + y1, width1, height1 - num7)), color1, 0.0f, new Vector2(), 1f, effects, 0.0f); } if (type == (ushort) 27) { int index58 = 14; Main.spriteBatch.Draw(Main.FlameTexture[index58], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4 + y1, width1, height1)), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue), 0.0f, new Vector2(), 1f, effects, 0.0f); } if (type == (ushort) 215 && num4 < (short) 36) { int index59 = 15; Microsoft.Xna.Framework.Color color16 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0); if ((int) num3 / 54 == 5) color16 = new Microsoft.Xna.Framework.Color((float) Main.DiscoR / (float) byte.MaxValue, (float) Main.DiscoG / (float) byte.MaxValue, (float) Main.DiscoB / (float) byte.MaxValue, 0.0f); Main.spriteBatch.Draw(Main.FlameTexture[index59], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4 + y1, width1, height1)), color16, 0.0f, new Vector2(), 1f, effects, 0.0f); } if (type == (ushort) 286) Main.spriteBatch.Draw(Main.glowSnailTexture, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, (int) num4 + y1, width1, height1)), new Microsoft.Xna.Framework.Color(75, 100, (int) byte.MaxValue, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); if (type == (ushort) 270) Main.spriteBatch.Draw(Main.fireflyJarTexture, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(200, 200, 200, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); if (type == (ushort) 271) Main.spriteBatch.Draw(Main.lightningbugJarTexture, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(200, 200, 200, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); if (type == (ushort) 316 || type == (ushort) 317 || type == (ushort) 318) { int index60 = (index3 - (int) num3 / 18) / 2 * ((index2 - (int) num4 / 18) / 3) % Main.cageFrames; Main.spriteBatch.Draw(Main.jellyfishBowlTexture[(int) type - 316], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, (int) num4 + Main.jellyfishCageFrame[(int) type - 316, index60] * 36, width1, height1)), new Microsoft.Xna.Framework.Color(200, 200, 200, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } if (type == (ushort) 149 && num3 < (short) 54) Main.spriteBatch.Draw(Main.xmasLightTexture, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(200, 200, 200, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); if (type == (ushort) 300 || type == (ushort) 302 || type == (ushort) 303 || type == (ushort) 306) { int index61 = 9; if (type == (ushort) 302) index61 = 10; if (type == (ushort) 303) index61 = 11; if (type == (ushort) 306) index61 = 12; Main.spriteBatch.Draw(Main.FlameTexture[index61], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4 + y1, width1, height1)), new Microsoft.Xna.Framework.Color(200, 200, 200, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } else if (Main.tileFlame[(int) type]) { ulong seed = Main._tileFrameSeed ^ ((ulong) index3 << 32 | (ulong) (uint) index2); int num96 = (int) type; int index62 = 0; switch (num96) { case 4: index62 = 0; break; case 33: case 174: index62 = 1; break; case 34: index62 = 3; break; case 35: index62 = 7; break; case 42: index62 = 13; break; case 49: index62 = 5; break; case 93: index62 = 4; break; case 98: index62 = 6; break; case 100: case 173: index62 = 2; break; case 372: index62 = 16; break; } switch (index62) { case 1: switch ((int) Main.tile[index3, index2].frameY / 22) { case 5: case 6: case 7: case 10: for (int index63 = 0; index63 < 7; ++index63) { float num97 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.075f; float num98 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.075f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num97, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num98) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(50, 50, 50, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; case 8: for (int index64 = 0; index64 < 7; ++index64) { float num99 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.3f; float num100 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.3f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num99, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num100) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(50, 50, 50, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; case 12: for (int index65 = 0; index65 < 7; ++index65) { float num101 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.1f; float num102 = (float) Utils.RandomInt(ref seed, -10, 1) * 0.15f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num101, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num102) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(50, 50, 50, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; case 14: for (int index66 = 0; index66 < 8; ++index66) { float num103 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.1f; float num104 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.1f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num103, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num104) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(75, 75, 75, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; case 16: for (int index67 = 0; index67 < 4; ++index67) { float num105 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.15f; float num106 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.15f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num105, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num106) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(75, 75, 75, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; case 27: case 28: Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(75, 75, 75, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); break; default: for (int index68 = 0; index68 < 7; ++index68) { float num107 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.15f; float num108 = (float) Utils.RandomInt(ref seed, -10, 1) * 0.35f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num107, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num108) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(100, 100, 100, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; } break; case 2: switch ((int) Main.tile[index3, index2].frameY / 36) { case 3: for (int index69 = 0; index69 < 3; ++index69) { float num109 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.05f; float num110 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.15f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num109, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num110) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(50, 50, 50, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; case 6: for (int index70 = 0; index70 < 5; ++index70) { float num111 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.15f; float num112 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.15f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num111, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num112) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(75, 75, 75, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; case 9: for (int index71 = 0; index71 < 7; ++index71) { float num113 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.3f; float num114 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.3f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num113, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num114) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(100, 100, 100, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; case 11: for (int index72 = 0; index72 < 7; ++index72) { float num115 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.1f; float num116 = (float) Utils.RandomInt(ref seed, -10, 1) * 0.15f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num115, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num116) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(50, 50, 50, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; case 13: for (int index73 = 0; index73 < 8; ++index73) { float num117 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.1f; float num118 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.1f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num117, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num118) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(75, 75, 75, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; case 28: case 29: Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(75, 75, 75, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); break; default: for (int index74 = 0; index74 < 7; ++index74) { float num119 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.15f; float num120 = (float) Utils.RandomInt(ref seed, -10, 1) * 0.35f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num119, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num120) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(100, 100, 100, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; } break; case 3: switch ((int) Main.tile[index3, index2].frameY / 54) { case 8: for (int index75 = 0; index75 < 7; ++index75) { float num121 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.075f; float num122 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.075f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num121, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num122) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(50, 50, 50, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; case 9: for (int index76 = 0; index76 < 3; ++index76) { float num123 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.05f; float num124 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.15f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num123, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num124) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(50, 50, 50, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; case 11: for (int index77 = 0; index77 < 7; ++index77) { float num125 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.3f; float num126 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.3f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num125, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num126) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(50, 50, 50, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; case 15: for (int index78 = 0; index78 < 7; ++index78) { float num127 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.1f; float num128 = (float) Utils.RandomInt(ref seed, -10, 1) * 0.15f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num127, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num128) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(50, 50, 50, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; case 17: case 20: for (int index79 = 0; index79 < 7; ++index79) { float num129 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.075f; float num130 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.075f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num129, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num130) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(50, 50, 50, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; case 18: for (int index80 = 0; index80 < 8; ++index80) { float num131 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.1f; float num132 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.1f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num131, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num132) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(75, 75, 75, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; case 34: case 35: Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(75, 75, 75, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); break; default: for (int index81 = 0; index81 < 7; ++index81) { float num133 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.15f; float num134 = (float) Utils.RandomInt(ref seed, -10, 1) * 0.35f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num133, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num134) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(100, 100, 100, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; } break; case 4: switch ((int) Main.tile[index3, index2].frameY / 54) { case 1: for (int index82 = 0; index82 < 3; ++index82) { float num135 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.15f; float num136 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.15f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num135, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num136) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(50, 50, 50, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; case 2: case 4: for (int index83 = 0; index83 < 7; ++index83) { float num137 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.075f; float num138 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.075f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num137, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num138) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(50, 50, 50, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; case 3: for (int index84 = 0; index84 < 7; ++index84) { float num139 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.2f; float num140 = (float) Utils.RandomInt(ref seed, -20, 1) * 0.35f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num139, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num140) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(100, 100, 100, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; case 5: for (int index85 = 0; index85 < 7; ++index85) { float num141 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.3f; float num142 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.3f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num141, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num142) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(50, 50, 50, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; case 9: for (int index86 = 0; index86 < 7; ++index86) { float num143 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.1f; float num144 = (float) Utils.RandomInt(ref seed, -10, 1) * 0.15f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num143, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num144) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(50, 50, 50, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; case 12: float num145 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.01f; float num146 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.01f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num145, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num146) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(Utils.RandomInt(ref seed, 90, 111), Utils.RandomInt(ref seed, 90, 111), Utils.RandomInt(ref seed, 90, 111), 0), 0.0f, new Vector2(), 1f, effects, 0.0f); break; case 13: for (int index87 = 0; index87 < 8; ++index87) { float num147 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.1f; float num148 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.1f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num147, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num148) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(75, 75, 75, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; case 28: case 29: Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(75, 75, 75, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); break; default: for (int index88 = 0; index88 < 7; ++index88) { float num149 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.15f; float num150 = (float) Utils.RandomInt(ref seed, -10, 1) * 0.35f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num149, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num150) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(100, 100, 100, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; } break; case 7: for (int index89 = 0; index89 < 4; ++index89) { float num151 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.15f; float num152 = (float) Utils.RandomInt(ref seed, -10, 10) * 0.15f; float num153 = 0.0f; float num154 = 0.0f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num153, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num154) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(50, 50, 50, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; case 13: int num155 = (int) num4 / 36; if (num155 == 1 || num155 == 3 || num155 == 6 || num155 == 8 || num155 == 19 || num155 == 27 || num155 == 29 || num155 == 30 || num155 == 31 || num155 == 32 || num155 == 36) { for (int index90 = 0; index90 < 7; ++index90) { float num156 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.15f; float num157 = (float) Utils.RandomInt(ref seed, -10, 1) * 0.35f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num156, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num157) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(100, 100, 100, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; } if (num155 == 25 || num155 == 16 || num155 == 2) { for (int index91 = 0; index91 < 7; ++index91) { float num158 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.15f; float num159 = (float) Utils.RandomInt(ref seed, -10, 1) * 0.1f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num158, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num159) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(50, 50, 50, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; } if (num155 == 29) { for (int index92 = 0; index92 < 7; ++index92) { float num160 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.15f; float num161 = (float) Utils.RandomInt(ref seed, -10, 1) * 0.15f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num160, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num161) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(25, 25, 25, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); } break; } if (num155 == 34 || num155 == 35) { Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(75, 75, 75, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); break; } break; default: for (int index93 = 0; index93 < 7; ++index93) { Microsoft.Xna.Framework.Color color17 = new Microsoft.Xna.Framework.Color(100, 100, 100, 0); if ((int) num4 / 22 == 14) color17 = new Microsoft.Xna.Framework.Color((float) Main.DiscoR / (float) byte.MaxValue, (float) Main.DiscoG / (float) byte.MaxValue, (float) Main.DiscoB / (float) byte.MaxValue, 0.0f); float num162 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.15f; float num163 = (float) Utils.RandomInt(ref seed, -10, 1) * 0.35f; Main.spriteBatch.Draw(Main.FlameTexture[index62], new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + num162, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5) + num163) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), color17, 0.0f, new Vector2(), 1f, effects, 0.0f); } break; } } if (type == (ushort) 144) Main.spriteBatch.Draw(Main.timerTexture, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color(200, 200, 200, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); if (type == (ushort) 237) { Main.spriteBatch.Draw(Main.sunAltarTexture, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + num5)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3, (int) num4, width1, height1)), new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor / 2, (int) Main.mouseTextColor / 2, (int) Main.mouseTextColor / 2, 0), 0.0f, new Vector2(), 1f, effects, 0.0f); break; } break; } } } } label_1285: if (Main.tileGlowMask[(int) trackTile.type] != (short) 0) { Texture2D texture10 = Main.glowMaskTexture[(int) Main.tileGlowMask[(int) trackTile.type]]; double num164 = Main.time * 0.08; Microsoft.Xna.Framework.Color color18 = Microsoft.Xna.Framework.Color.White; if (trackTile.type == (ushort) 350) color18 = new Microsoft.Xna.Framework.Color(new Vector4((float) (-Math.Cos((int) (num164 / 6.283) % 3 == 1 ? num164 : 0.0) * 0.2 + 0.2))); if (trackTile.type == (ushort) 381) color18 = color5; if (trackTile.type == (ushort) 370) color18 = color4; if (trackTile.type == (ushort) 390) color18 = color4; if (trackTile.type == (ushort) 391) color18 = new Microsoft.Xna.Framework.Color(250, 250, 250, 200); if (trackTile.type == (ushort) 209) color18 = PortalHelper.GetPortalColor(Main.myPlayer, trackTile.frameX >= (short) 288 ? 1 : 0); if (trackTile.type == (ushort) 429 || trackTile.type == (ushort) 445) { texture10 = !Main.canDrawColorTile(index3, index2) ? Main.tileTexture[(int) type] : (Texture2D) Main.tileAltTexture[(int) type, (int) trackTile.color()]; y1 = 18; } if (trackTile.slope() == (byte) 0 && !trackTile.halfBrick()) Main.spriteBatch.Draw(texture10, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, (int) num4 + y1, width1, height1)), color18, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); else if (trackTile.halfBrick()) { Main.spriteBatch.Draw(texture10, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0), (float) (index2 * 16 - (int) Main.screenPosition.Y + 10)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, (int) num4 + y1 + 10, width1, 6)), color18, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } else { byte num165 = trackTile.slope(); for (int index94 = 0; index94 < 8; ++index94) { int width11 = index94 << 1; Microsoft.Xna.Framework.Rectangle rectangle6 = new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, (int) num4 + y1 + index94 * 2, width11, 2); int num166 = 0; switch (num165) { case 2: rectangle6.X = 16 - width11; num166 = 16 - width11; break; case 3: rectangle6.Width = 16 - width11; break; case 4: rectangle6.Width = 14 - width11; rectangle6.X = width11 + 2; num166 = width11 + 2; break; } Main.spriteBatch.Draw(texture10, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + (float) num166, (float) (index2 * 16 - (int) Main.screenPosition.Y + index94 * 2)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(rectangle6), color18, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } } if (texture1 != null) { int num167 = 0; int num168 = 0; Main.spriteBatch.Draw(texture1, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + (float) num167, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + num168)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(rectangle3), color2, 0.0f, new Vector2(), 1f, effects, 0.0f); } if (texture2 != null) { rectangle4 = new Microsoft.Xna.Framework.Rectangle((int) num3 + num8, (int) num4 + y1, width1, height1); int num169 = 0; int num170 = 0; Main.spriteBatch.Draw(texture2, new Vector2((float) (index3 * 16 - (int) Main.screenPosition.X) - (float) (((double) width1 - 16.0) / 2.0) + (float) num169, (float) (index2 * 16 - (int) Main.screenPosition.Y + num5 + num170)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(rectangle4), color6, 0.0f, new Vector2(), 1f, effects, 0.0f); } } } } } if (solidOnly) this.DrawTileCracks(1); for (int index95 = 0; index95 < index1; ++index95) { int index96 = Main.specX[index95]; int index97 = Main.specY[index95]; Tile tile = Main.tile[index96, index97]; ushort type1 = tile.type; short frameX1 = tile.frameX; short frameY1 = tile.frameY; if (type1 == (ushort) 237) Main.spriteBatch.Draw(Main.sunOrbTexture, new Vector2((float) (index96 * 16 - (int) Main.screenPosition.X) + (float) width1 / 2f, (float) (index97 * 16 - (int) Main.screenPosition.Y - 36)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.sunOrbTexture.Width, Main.sunOrbTexture.Height)), new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, 0), Main.sunCircle, new Vector2((float) (Main.sunOrbTexture.Width / 2), (float) (Main.sunOrbTexture.Height / 2)), 1f, SpriteEffects.None, 0.0f); if ((type1 == (ushort) 128 || type1 == (ushort) 269) && frameX1 >= (short) 100) { int num171 = (int) frameY1 / 18; int num172 = (int) frameX1; int index98 = 0; for (; num172 >= 100; num172 -= 100) ++index98; int num173 = -4; SpriteEffects effects = SpriteEffects.FlipHorizontally; if (num172 >= 36) { effects = SpriteEffects.None; num173 = -4; } switch (num171) { case 0: bool somethingSpecial1 = false; int i1 = Player.SetMatch(0, index98, type1 == (ushort) 128, ref somethingSpecial1); if (i1 == -1) i1 = index98; this.LoadArmorHead(i1); Main.spriteBatch.Draw(Main.armorHeadTexture[i1], new Vector2((float) (index96 * 16 - (int) Main.screenPosition.X + num173), (float) (index97 * 16 - (int) Main.screenPosition.Y - 12)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 40, 54)), Lighting.GetColor(index96, index97), 0.0f, new Vector2(), 1f, effects, 0.0f); break; case 1: bool somethingSpecial2 = false; int i2 = Player.SetMatch(1, index98, type1 == (ushort) 128, ref somethingSpecial2); if (i2 != -1) { this.LoadArmorLegs(i2); Main.spriteBatch.Draw(Main.armorLegTexture[i2], new Vector2((float) (index96 * 16 - (int) Main.screenPosition.X + num173), (float) (index97 * 16 - (int) Main.screenPosition.Y - 28)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 40, 54)), Lighting.GetColor(index96, index97), 0.0f, new Vector2(), 1f, effects, 0.0f); } this.LoadArmorBody(index98); if (type1 == (ushort) 269) Main.spriteBatch.Draw(Main.femaleBodyTexture[index98], new Vector2((float) (index96 * 16 - (int) Main.screenPosition.X + num173), (float) (index97 * 16 - (int) Main.screenPosition.Y - 28)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 40, 54)), Lighting.GetColor(index96, index97), 0.0f, new Vector2(), 1f, effects, 0.0f); else Main.spriteBatch.Draw(Main.armorBodyTexture[index98], new Vector2((float) (index96 * 16 - (int) Main.screenPosition.X + num173), (float) (index97 * 16 - (int) Main.screenPosition.Y - 28)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 40, 54)), Lighting.GetColor(index96, index97), 0.0f, new Vector2(), 1f, effects, 0.0f); if (index98 >= 0 && index98 < 210 && ArmorIDs.Body.Sets.NeedsToDrawArm[index98]) { Main.spriteBatch.Draw(Main.armorArmTexture[index98], new Vector2((float) (index96 * 16 - (int) Main.screenPosition.X + num173), (float) (index97 * 16 - (int) Main.screenPosition.Y - 28)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 40, 54)), Lighting.GetColor(index96, index97), 0.0f, new Vector2(), 1f, effects, 0.0f); break; } break; case 2: bool somethingSpecial3 = false; int i3 = Player.SetMatch(2, index98, type1 == (ushort) 128, ref somethingSpecial3); if (i3 == -1) i3 = index98; this.LoadArmorLegs(i3); Main.spriteBatch.Draw(Main.armorLegTexture[i3], new Vector2((float) (index96 * 16 - (int) Main.screenPosition.X + num173), (float) (index97 * 16 - (int) Main.screenPosition.Y - 44)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 40, 54)), Lighting.GetColor(index96, index97), 0.0f, new Vector2(), 1f, effects, 0.0f); break; } } if (type1 == (ushort) 334 && frameX1 >= (short) 5000) { int num174 = (int) frameY1 / 18; int num175 = (int) frameX1; int num176 = 0; int type2 = num175 % 5000 - 100; for (; num175 >= 5000; num175 -= 5000) ++num176; int frameX2 = (int) Main.tile[index96 + 1, index97].frameX; int pre = frameX2 < 25000 ? frameX2 - 10000 : frameX2 - 25000; Item obj = new Item(); obj.netDefaults(type2); obj.Prefix(pre); Texture2D texture2D = Main.itemTexture[obj.type]; Microsoft.Xna.Framework.Rectangle rectangle = Main.itemAnimations[obj.type] == null ? texture2D.Frame() : Main.itemAnimations[obj.type].GetFrame(texture2D); int width12 = rectangle.Width; int height = rectangle.Height; float num177 = 1f; if (width12 > 40 || height > 40) num177 = width12 <= height ? 40f / (float) height : 40f / (float) width12; float scale = num177 * obj.scale; SpriteEffects effects = SpriteEffects.None; if (num176 >= 3) effects = SpriteEffects.FlipHorizontally; Microsoft.Xna.Framework.Color color = Lighting.GetColor(index96, index97); Main.spriteBatch.Draw(texture2D, new Vector2((float) (index96 * 16 - (int) Main.screenPosition.X + 24), (float) (index97 * 16 - (int) Main.screenPosition.Y + 8)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(rectangle), Lighting.GetColor(index96, index97), 0.0f, new Vector2((float) (width12 / 2), (float) (height / 2)), scale, effects, 0.0f); if (obj.color != new Microsoft.Xna.Framework.Color()) Main.spriteBatch.Draw(texture2D, new Vector2((float) (index96 * 16 - (int) Main.screenPosition.X + 24), (float) (index97 * 16 - (int) Main.screenPosition.Y + 8)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(rectangle), obj.GetColor(color), 0.0f, new Vector2((float) (width12 / 2), (float) (height / 2)), scale, effects, 0.0f); } if (type1 == (ushort) 395) { Item obj = ((TEItemFrame) TileEntity.ByPosition[new Point16(index96, index97)]).item; Texture2D texture2D = Main.itemTexture[obj.type]; Microsoft.Xna.Framework.Rectangle rectangle = Main.itemAnimations[obj.type] == null ? texture2D.Frame() : Main.itemAnimations[obj.type].GetFrame(texture2D); int width13 = rectangle.Width; int height = rectangle.Height; float num178 = 1f; if (width13 > 20 || height > 20) num178 = width13 <= height ? 20f / (float) height : 20f / (float) width13; float num179 = num178 * obj.scale; SpriteEffects effects = SpriteEffects.None; Microsoft.Xna.Framework.Color color = Lighting.GetColor(index96, index97); Microsoft.Xna.Framework.Color currentColor = color; float scale1 = 1f; ItemSlot.GetItemLight(ref currentColor, ref scale1, obj); float scale2 = num179 * scale1; Main.spriteBatch.Draw(texture2D, new Vector2((float) (index96 * 16 - (int) Main.screenPosition.X + 16), (float) (index97 * 16 - (int) Main.screenPosition.Y + 16)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(rectangle), currentColor, 0.0f, new Vector2((float) (width13 / 2), (float) (height / 2)), scale2, effects, 0.0f); if (obj.color != new Microsoft.Xna.Framework.Color()) Main.spriteBatch.Draw(texture2D, new Vector2((float) (index96 * 16 - (int) Main.screenPosition.X + 16), (float) (index97 * 16 - (int) Main.screenPosition.Y + 16)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(rectangle), obj.GetColor(color), 0.0f, new Vector2((float) (width13 / 2), (float) (height / 2)), scale2, effects, 0.0f); } if (type1 == (ushort) 412) { Texture2D texture2D = Main.glowMaskTexture[202]; int frameY2 = Main.tileFrame[(int) type1] / 60; int frameY3 = (frameY2 + 1) % 4; float num180 = (float) (Main.tileFrame[(int) type1] % 60) / 60f; Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue); Main.spriteBatch.Draw(texture2D, new Vector2((float) (index96 * 16 - (int) Main.screenPosition.X), (float) (index97 * 16 - (int) Main.screenPosition.Y + 2)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(texture2D.Frame(verticalFrames: 4, frameY: frameY2)), color * (1f - num180), 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(texture2D, new Vector2((float) (index96 * 16 - (int) Main.screenPosition.X), (float) (index97 * 16 - (int) Main.screenPosition.Y + 2)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(texture2D.Frame(verticalFrames: 4, frameY: frameY3)), color * num180, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } try { if (type1 == (ushort) 5 && frameY1 >= (short) 198 && frameX1 >= (short) 22) { int num181 = 0; switch (frameX1) { case 22: switch (frameY1) { case 220: num181 = 1; break; case 242: num181 = 2; break; } int index99 = 0; int width14 = 80; int height = 80; int num182 = 32; int num183 = 0; for (int index100 = index97; index100 < index97 + 100; ++index100) { if (Main.tile[index96, index100].type == (ushort) 2) { index99 = Main.GetTreeStyle(index96); break; } if (Main.tile[index96, index100].type == (ushort) 23) { index99 = 1; break; } if (Main.tile[index96, index100].type == (ushort) 70) { index99 = 14; break; } if (Main.tile[index96, index100].type == (ushort) 60) { index99 = 2; if (WorldGen.jungleBG == 1) index99 = 11; if ((double) index100 > Main.worldSurface) index99 = 13; width14 = 114; height = 96; num182 = 48; break; } if (Main.tile[index96, index100].type == (ushort) 147) { index99 = 4; if (WorldGen.snowBG == 0) { index99 = 12; if (index96 % 10 == 0) index99 = 18; } if (WorldGen.snowBG == 2 || WorldGen.snowBG == 3 || WorldGen.snowBG == 32 || WorldGen.snowBG == 4 || WorldGen.snowBG == 42) { index99 = WorldGen.snowBG % 2 != 0 ? (index96 <= Main.maxTilesX / 2 ? 17 : 16) : (index96 >= Main.maxTilesX / 2 ? 17 : 16); break; } break; } if (Main.tile[index96, index100].type == (ushort) 199) { index99 = 5; break; } if (Main.tile[index96, index100].type == (ushort) 109) { index99 = 3; height = 140; if (index96 % 3 == 1) { num181 += 3; break; } if (index96 % 3 == 2) { num181 += 6; break; } break; } } if (index99 == 14) { float num184 = (float) Main.rand.Next(28, 42) * 0.005f + (float) (270 - (int) Main.mouseTextColor) / 1000f; Lighting.AddLight(index96, index97, 0.1f, (float) (0.200000002980232 + (double) num184 / 2.0), 0.7f + num184); } if (tile.color() > (byte) 0) Main.checkTreeAlt[index99, (int) tile.color()] = true; if (tile.color() > (byte) 0 && Main.treeAltTextureDrawn[index99, (int) tile.color()]) { Main.spriteBatch.Draw((Texture2D) Main.treeTopAltTexture[index99, (int) tile.color()], new Vector2((float) (index96 * 16 - (int) Main.screenPosition.X - num182), (float) (index97 * 16 - (int) Main.screenPosition.Y - height + 16 + num183)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(num181 * (width14 + 2), 0, width14, height)), Lighting.GetColor(index96, index97), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); break; } Main.spriteBatch.Draw(Main.treeTopTexture[index99], new Vector2((float) (index96 * 16 - (int) Main.screenPosition.X - num182), (float) (index97 * 16 - (int) Main.screenPosition.Y - height + 16 + num183)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(num181 * (width14 + 2), 0, width14, height)), Lighting.GetColor(index96, index97), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); break; case 44: switch (frameY1) { case 220: num181 = 1; break; case 242: num181 = 2; break; } int index101 = 0; for (int index102 = index97; index102 < index97 + 100; ++index102) { if (Main.tile[index96 + 1, index102].type == (ushort) 2) { index101 = Main.GetTreeStyle(index96 + 1); break; } if (Main.tile[index96 + 1, index102].type == (ushort) 23) { index101 = 1; break; } if (Main.tile[index96 + 1, index102].type == (ushort) 70) { index101 = 14; break; } if (Main.tile[index96 + 1, index102].type == (ushort) 60) { index101 = 2; if ((double) index102 > Main.worldSurface) { index101 = 13; break; } break; } if (Main.tile[index96 + 1, index102].type == (ushort) 147) { index101 = 4; if (WorldGen.snowBG == 0) { index101 = 12; break; } break; } if (Main.tile[index96 + 1, index102].type == (ushort) 199) { index101 = 5; break; } if (Main.tile[index96 + 1, index102].type == (ushort) 109) { index101 = 3; if (index96 % 3 == 1) { num181 += 3; break; } if (index96 % 3 == 2) { num181 += 6; break; } break; } } if (index101 == 14) { float num185 = (float) Main.rand.Next(28, 42) * 0.005f + (float) (270 - (int) Main.mouseTextColor) / 1000f; Lighting.AddLight(index96, index97, 0.1f, (float) (0.200000002980232 + (double) num185 / 2.0), 0.7f + num185); } if (tile.color() > (byte) 0) Main.checkTreeAlt[index101, (int) tile.color()] = true; if (tile.color() > (byte) 0 && Main.treeAltTextureDrawn[index101, (int) tile.color()]) { Main.spriteBatch.Draw((Texture2D) Main.treeBranchAltTexture[index101, (int) tile.color()], new Vector2((float) (index96 * 16 - (int) Main.screenPosition.X - 24), (float) (index97 * 16 - (int) Main.screenPosition.Y - 12)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, num181 * 42, 40, 40)), Lighting.GetColor(index96, index97), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); break; } Main.spriteBatch.Draw(Main.treeBranchTexture[index101], new Vector2((float) (index96 * 16 - (int) Main.screenPosition.X - 24), (float) (index97 * 16 - (int) Main.screenPosition.Y - 12)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, num181 * 42, 40, 40)), Lighting.GetColor(index96, index97), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); break; case 66: switch (frameY1) { case 220: num181 = 1; break; case 242: num181 = 2; break; } int index103 = 0; for (int index104 = index97; index104 < index97 + 100; ++index104) { if (Main.tile[index96 - 1, index104].type == (ushort) 2) { index103 = Main.GetTreeStyle(index96 - 1); break; } if (Main.tile[index96 - 1, index104].type == (ushort) 23) { index103 = 1; break; } if (Main.tile[index96 - 1, index104].type == (ushort) 70) { index103 = 14; break; } if (Main.tile[index96 - 1, index104].type == (ushort) 60) { index103 = 2; if ((double) index104 > Main.worldSurface) { index103 = 13; break; } break; } if (Main.tile[index96 - 1, index104].type == (ushort) 147) { index103 = 4; if (WorldGen.snowBG == 0) { index103 = 12; break; } break; } if (Main.tile[index96 - 1, index104].type == (ushort) 199) { index103 = 5; break; } if (Main.tile[index96 - 1, index104].type == (ushort) 109) { index103 = 3; if (index96 % 3 == 1) { num181 += 3; break; } if (index96 % 3 == 2) { num181 += 6; break; } break; } } if (index103 == 14) { float num186 = (float) Main.rand.Next(28, 42) * 0.005f + (float) (270 - (int) Main.mouseTextColor) / 1000f; Lighting.AddLight(index96, index97, 0.1f, (float) (0.200000002980232 + (double) num186 / 2.0), 0.7f + num186); } if (tile.color() > (byte) 0) Main.checkTreeAlt[index103, (int) tile.color()] = true; if (tile.color() > (byte) 0 && Main.treeAltTextureDrawn[index103, (int) tile.color()]) { Main.spriteBatch.Draw((Texture2D) Main.treeBranchAltTexture[index103, (int) tile.color()], new Vector2((float) (index96 * 16 - (int) Main.screenPosition.X), (float) (index97 * 16 - (int) Main.screenPosition.Y - 12)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(42, num181 * 42, 40, 40)), Lighting.GetColor(index96, index97), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); break; } Main.spriteBatch.Draw(Main.treeBranchTexture[index103], new Vector2((float) (index96 * 16 - (int) Main.screenPosition.X), (float) (index97 * 16 - (int) Main.screenPosition.Y - 12)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(42, num181 * 42, 40, 40)), Lighting.GetColor(index96, index97), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); break; } } if (type1 == (ushort) 323) { if (frameX1 >= (short) 88) { if (frameX1 <= (short) 132) { int num187 = 0; if (frameX1 == (short) 110) num187 = 1; else if (frameX1 == (short) 132) num187 = 2; int index105 = 15; int num188 = 0; int width15 = 80; int height = 80; int num189 = 32; int num190 = 0; for (int index106 = index97; index106 < index97 + 100; ++index106) { if (Main.tile[index96, index106].type == (ushort) 53) { num188 = 0; break; } if (Main.tile[index96, index106].type == (ushort) 234) { num188 = 1; break; } if (Main.tile[index96, index106].type == (ushort) 116) { num188 = 2; break; } if (Main.tile[index96, index106].type == (ushort) 112) { num188 = 3; break; } } int frameY4 = (int) Main.tile[index96, index97].frameY; int y = num188 * 82; if (tile.color() > (byte) 0) Main.checkTreeAlt[index105, (int) tile.color()] = true; if (tile.color() > (byte) 0 && Main.treeAltTextureDrawn[index105, (int) tile.color()]) Main.spriteBatch.Draw((Texture2D) Main.treeTopAltTexture[index105, (int) tile.color()], new Vector2((float) (index96 * 16 - (int) Main.screenPosition.X - num189 + frameY4), (float) (index97 * 16 - (int) Main.screenPosition.Y - height + 16 + num190)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(num187 * (width15 + 2), y, width15, height)), Lighting.GetColor(index96, index97), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); else Main.spriteBatch.Draw(Main.treeTopTexture[index105], new Vector2((float) (index96 * 16 - (int) Main.screenPosition.X - num189 + frameY4), (float) (index97 * 16 - (int) Main.screenPosition.Y - height + 16 + num190)) + vector2_1, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(num187 * (width15 + 2), y, width15, height)), Lighting.GetColor(index96, index97), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } } } } catch { } } if (TileObject.objectPreview.Active && Main.player[Main.myPlayer].showItemIcon && Main.placementPreview && !CaptureManager.Instance.Active) { this.LoadTiles((int) TileObject.objectPreview.Type); TileObject.DrawPreview(Main.spriteBatch, TileObject.objectPreview, Main.screenPosition - vector2_1); } if (solidOnly) TimeLogger.DrawTime(0, stopwatch.Elapsed.TotalMilliseconds); else TimeLogger.DrawTime(1, stopwatch.Elapsed.TotalMilliseconds); } private void DrawSpecialTilesDeprecated(Vector2 offSet, int specTop) { for (int index1 = Main.specX.Length - 1; index1 > specTop; --index1) { int x = Main.specX[index1]; int y = Main.specY[index1]; Tile tile = Main.tile[x, y]; ushort type = tile.type; short frameX = tile.frameX; short frameY = tile.frameY; if ((type == (ushort) 128 || type == (ushort) 269) && frameX >= (short) 100) { int num1 = (int) frameY / 18; int num2 = (int) frameX; int index2 = 0; for (; num2 >= 100; num2 -= 100) ++index2; int num3 = -4; SpriteEffects effects = SpriteEffects.FlipHorizontally; if (num2 >= 36) { effects = SpriteEffects.None; num3 = -4; } switch (num1) { case 0: this.LoadArmorHead(index2); Main.spriteBatch.Draw(Main.armorHeadTexture[index2], new Vector2((float) (x * 16 - (int) Main.screenPosition.X + num3), (float) (y * 16 - (int) Main.screenPosition.Y - 12)) + offSet, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 40, 36)), Lighting.GetColor(x, y), 0.0f, new Vector2(), 1f, effects, 0.0f); continue; case 1: bool somethingSpecial = false; int i1 = Player.SetMatch(1, index2, type != (ushort) 128, ref somethingSpecial); if (i1 != -1) { this.LoadArmorLegs(i1); Main.spriteBatch.Draw(Main.armorLegTexture[i1], new Vector2((float) (x * 16 - (int) Main.screenPosition.X + num3), (float) (y * 16 - (int) Main.screenPosition.Y - 28)) + offSet, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 40, 54)), Lighting.GetColor(x, y), 0.0f, new Vector2(), 1f, effects, 0.0f); } this.LoadArmorBody(index2); if (type == (ushort) 269) { Main.spriteBatch.Draw(Main.femaleBodyTexture[index2], new Vector2((float) (x * 16 - (int) Main.screenPosition.X + num3), (float) (y * 16 - (int) Main.screenPosition.Y - 28)) + offSet, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 40, 54)), Lighting.GetColor(x, y), 0.0f, new Vector2(), 1f, effects, 0.0f); continue; } Main.spriteBatch.Draw(Main.armorBodyTexture[index2], new Vector2((float) (x * 16 - (int) Main.screenPosition.X + num3), (float) (y * 16 - (int) Main.screenPosition.Y - 28)) + offSet, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 40, 54)), Lighting.GetColor(x, y), 0.0f, new Vector2(), 1f, effects, 0.0f); continue; case 2: int i2 = index2; switch (i2) { case 83: if (type == (ushort) 128) { i2 = 117; break; } break; case 84: if (type == (ushort) 128) { i2 = 120; break; } break; } this.LoadArmorLegs(i2); Main.spriteBatch.Draw(Main.armorLegTexture[i2], new Vector2((float) (x * 16 - (int) Main.screenPosition.X + num3), (float) (y * 16 - (int) Main.screenPosition.Y - 44)) + offSet, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 40, 54)), Lighting.GetColor(x, y), 0.0f, new Vector2(), 1f, effects, 0.0f); continue; default: continue; } } } } protected void DrawGoreBehind() { for (int index = 0; index < 500; ++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].frame < (byte) 7 || Main.gore[index].frame > (byte) 9)) flag = true; if (flag) { this.LoadGore(Main.gore[index].type); if (Main.gore[index].numFrames > (byte) 1) { int height = Main.goreTexture[Main.gore[index].type].Height / (int) Main.gore[index].numFrames; Microsoft.Xna.Framework.Color alpha = Main.gore[index].GetAlpha(Lighting.GetColor((int) ((double) Main.gore[index].position.X + (double) Main.goreTexture[Main.gore[index].type].Width * 0.5) / 16, (int) (((double) Main.gore[index].position.Y + (double) height * 0.5) / 16.0))); Main.spriteBatch.Draw(Main.goreTexture[Main.gore[index].type], new Vector2(Main.gore[index].position.X - Main.screenPosition.X + (float) (Main.goreTexture[Main.gore[index].type].Width / 2), (float) ((double) Main.gore[index].position.Y - (double) Main.screenPosition.Y + (double) (height / 2) - 2.0)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, height * (int) Main.gore[index].frame, Main.goreTexture[Main.gore[index].type].Width, height)), alpha, Main.gore[index].rotation, new Vector2((float) (Main.goreTexture[Main.gore[index].type].Width / 2), (float) (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) Main.goreTexture[Main.gore[index].type].Width * 0.5) / 16, (int) (((double) Main.gore[index].position.Y + (double) Main.goreTexture[Main.gore[index].type].Height * 0.5) / 16.0))); Main.spriteBatch.Draw(Main.goreTexture[Main.gore[index].type], new Vector2(Main.gore[index].position.X - Main.screenPosition.X + (float) (Main.goreTexture[Main.gore[index].type].Width / 2), Main.gore[index].position.Y - Main.screenPosition.Y + (float) (Main.goreTexture[Main.gore[index].type].Height / 2)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.goreTexture[Main.gore[index].type].Width, Main.goreTexture[Main.gore[index].type].Height)), alpha, Main.gore[index].rotation, new Vector2((float) (Main.goreTexture[Main.gore[index].type].Width / 2), (float) (Main.goreTexture[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 < 500; ++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].frame < (byte) 7 || Main.gore[index].frame > (byte) 9)) { Main.drawBackGore = true; } else { this.LoadGore(Main.gore[index].type); if (Main.gore[index].numFrames > (byte) 1) { int height = Main.goreTexture[Main.gore[index].type].Height / (int) Main.gore[index].numFrames; Microsoft.Xna.Framework.Color alpha = Main.gore[index].GetAlpha(Lighting.GetColor((int) ((double) Main.gore[index].position.X + (double) Main.goreTexture[Main.gore[index].type].Width * 0.5) / 16, (int) (((double) Main.gore[index].position.Y + (double) height * 0.5) / 16.0))); Main.spriteBatch.Draw(Main.goreTexture[Main.gore[index].type], new Vector2(Main.gore[index].position.X - Main.screenPosition.X + (float) (Main.goreTexture[Main.gore[index].type].Width / 2), (float) ((double) Main.gore[index].position.Y - (double) Main.screenPosition.Y + (double) (height / 2) - 2.0)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, height * (int) Main.gore[index].frame, Main.goreTexture[Main.gore[index].type].Width, height)), alpha, Main.gore[index].rotation, new Vector2((float) (Main.goreTexture[Main.gore[index].type].Width / 2), (float) (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) Main.goreTexture[Main.gore[index].type].Width * 0.5) / 16, (int) (((double) Main.gore[index].position.Y + (double) Main.goreTexture[Main.gore[index].type].Height * 0.5) / 16.0))); Main.spriteBatch.Draw(Main.goreTexture[Main.gore[index].type], new Vector2(Main.gore[index].position.X - Main.screenPosition.X + (float) (Main.goreTexture[Main.gore[index].type].Width / 2), Main.gore[index].position.Y - Main.screenPosition.Y + (float) (Main.goreTexture[Main.gore[index].type].Height / 2)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.goreTexture[Main.gore[index].type].Width, Main.goreTexture[Main.gore[index].type].Height)), alpha, Main.gore[index].rotation, new Vector2((float) (Main.goreTexture[Main.gore[index].type].Width / 2), (float) (Main.goreTexture[Main.gore[index].type].Height / 2)), Main.gore[index].scale, SpriteEffects.None, 0.0f); } } } } TimeLogger.DetailedDrawTime(24); } protected void DrawHealthBar( float X, float Y, int Health, int MaxHealth, float alpha, float scale = 1f) { 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) { 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(Main.hbTexture2, 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, Main.hbTexture2.Height)), color, 0.0f, new Vector2(0.0f, 0.0f), scale, SpriteEffects.None, 0.0f); if (num2 < 34) Main.spriteBatch.Draw(Main.hbTexture2, 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, Main.hbTexture2.Height)), color, 0.0f, new Vector2(0.0f, 0.0f), scale, SpriteEffects.None, 0.0f); if (num2 > 2) Main.spriteBatch.Draw(Main.hbTexture1, new Vector2(num3 - Main.screenPosition.X, num4 - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, num2 - 2, Main.hbTexture1.Height)), color, 0.0f, new Vector2(0.0f, 0.0f), scale, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(Main.hbTexture1, 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, Main.hbTexture1.Height)), color, 0.0f, new Vector2(0.0f, 0.0f), scale, SpriteEffects.None, 0.0f); } else { if (num2 < 36) Main.spriteBatch.Draw(Main.hbTexture2, 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, Main.hbTexture2.Height)), color, 0.0f, new Vector2(0.0f, 0.0f), scale, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(Main.hbTexture1, new Vector2(num3 - Main.screenPosition.X, num4 - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, num2, Main.hbTexture1.Height)), color, 0.0f, new Vector2(0.0f, 0.0f), scale, SpriteEffects.None, 0.0f); } } public static float NPCAddHeight(int i) { float num = 0.0f; if (Main.npc[i].type == 125) num = 30f; else if (Main.npc[i].type == 54) num = 2f; else if (Main.npc[i].type == 205) num = 8f; else if (Main.npc[i].type == 182) num = 24f; else if (Main.npc[i].type == 178) num = 2f; else if (Main.npc[i].type == 126) num = 30f; else if (Main.npc[i].type == 6 || Main.npc[i].type == 173) num = 26f; else if (Main.npc[i].type == 94) num = 14f; else if (Main.npc[i].type == 7 || Main.npc[i].type == 8 || Main.npc[i].type == 9) num = 13f; else if (Main.npc[i].type == 98 || Main.npc[i].type == 99 || Main.npc[i].type == 100) num = 13f; else if (Main.npc[i].type == 95 || Main.npc[i].type == 96 || Main.npc[i].type == 97) num = 13f; else if (Main.npc[i].type == 10 || Main.npc[i].type == 11 || Main.npc[i].type == 12) num = 8f; else if (Main.npc[i].type == 13 || Main.npc[i].type == 14 || Main.npc[i].type == 15) num = 26f; else if (Main.npc[i].type == 175) num = 4f; else if (Main.npc[i].type == 520) num = 2f; else if (Main.npc[i].type >= 412 && Main.npc[i].type <= 414) num = 18f; else if (Main.npc[i].type == 48) num = 32f; else if (Main.npc[i].type == 49 || Main.npc[i].type == 51) num = 4f; else if (Main.npc[i].type == 60) num = 10f; else if (Main.npc[i].type == 62 || Main.npc[i].type == 66 || Main.npc[i].type == 156) num = 14f; else if (Main.npc[i].type == 63 || Main.npc[i].type == 64 || Main.npc[i].type == 103) num = 4f; else if (Main.npc[i].type == 65) num = 14f; else if (Main.npc[i].type == 69) num = 4f; else if (Main.npc[i].type == 70) num = -4f; else if (Main.npc[i].type == 72) num = -2f; else if (Main.npc[i].type == 83 || Main.npc[i].type == 84) num = 20f; else if (Main.npc[i].type == 150 || Main.npc[i].type == 151 || Main.npc[i].type == 158) num = 10f; else if (Main.npc[i].type == 152) num = 6f; else if (Main.npc[i].type == 153 || Main.npc[i].type == 154) num = 4f; else if (Main.npc[i].type == 165 || Main.npc[i].type == 237 || Main.npc[i].type == 238 || Main.npc[i].type == 240 || Main.npc[i].type == 531) num = 10f; else if (Main.npc[i].type == 39 || Main.npc[i].type == 40 || Main.npc[i].type == 41) num = 26f; else if (Main.npc[i].type >= 87 && Main.npc[i].type <= 92) num = 56f; else if (Main.npc[i].type >= 134 && Main.npc[i].type <= 136) num = 30f; else if (Main.npc[i].type == 169) num = 8f; else if (Main.npc[i].type == 174) num = 6f; else if (Main.npc[i].type == 369) num = 2f; else if (Main.npc[i].type == 376) num = 6f; else if (Main.npc[i].type == 579) num = -2f; if (Main.npc[i].townNPC && (double) Main.npc[i].ai[0] == 5.0) num -= 4f; return num * Main.npc[i].scale; } protected void DrawProjectiles() { PlayerInput.SetZoom_MouseInWorld(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, this.Rasterizer, (Effect) null, Main.Transform); int num1 = 0; int num2 = 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) { ++num1; try { int shaderId = 0; if (Main.projHook[Main.projectile[i].type] && Main.projectile[i].owner != (int) byte.MaxValue) shaderId = 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]) shaderId = 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]) shaderId = Main.player[Main.projectile[i].owner].cLight; if (Main.projectile[i].type == 623 && Main.projectile[i].owner != (int) byte.MaxValue) shaderId = Main.player[Main.projectile[i].owner].cPet; if (shaderId != 0) { if (num2 == 0) { Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, this.Rasterizer, (Effect) null, Main.Transform); } GameShaders.Armor.ApplySecondary(shaderId, (Entity) Main.player[Main.projectile[i].owner]); } else if (num2 != 0) { Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, this.Rasterizer, (Effect) null, Main.Transform); } num2 = shaderId; 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) { int shaderId = 0; if (Main.projHook[Main.projectile[i].type] && Main.projectile[i].owner != (int) byte.MaxValue) shaderId = 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]) shaderId = 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]) shaderId = Main.player[Main.projectile[i].owner].cLight; if (Main.projectile[i].type == 623 && Main.projectile[i].owner != (int) byte.MaxValue) shaderId = Main.player[Main.projectile[i].owner].cPet; if (shaderId != 0) { if (num2 == 0) { Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, this.Rasterizer, (Effect) null, Main.Transform); } GameShaders.Armor.ApplySecondary(shaderId, (Entity) Main.player[Main.projectile[i].owner]); } else if (num2 != 0) { Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, this.Rasterizer, (Effect) null, Main.Transform); } num2 = shaderId; this.DrawProj(i); } } } Main.spriteBatch.End(); TimeLogger.DetailedDrawTime(20); } protected void DrawPlayers() { for (int index1 = 0; index1 < (int) byte.MaxValue; ++index1) { Player drawPlayer = Main.player[index1]; if (drawPlayer.active && !drawPlayer.outOfRange) { SamplerState samplerState = Main.DefaultSamplerState; if (drawPlayer.mount.Active) samplerState = Main.MountedSamplerState; Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, samplerState, DepthStencilState.None, this.Rasterizer, (Effect) null, Main.Transform); if (Main.gamePaused) drawPlayer.PlayerFrame(); if (drawPlayer.ghost) { for (int index2 = 0; index2 < 3; ++index2) this.DrawGhost(drawPlayer, drawPlayer.shadowPos[index2], (float) (0.5 + 0.200000002980232 * (double) index2)); this.DrawGhost(drawPlayer, drawPlayer.position); Main.spriteBatch.End(); } else { if (drawPlayer.inventory[drawPlayer.selectedItem].flame || drawPlayer.head == 137 || drawPlayer.wings == 22) { --drawPlayer.itemFlameCount; if (drawPlayer.itemFlameCount <= 0) { drawPlayer.itemFlameCount = 5; for (int index3 = 0; index3 < 7; ++index3) { drawPlayer.itemFlamePos[index3].X = (float) Main.rand.Next(-10, 11) * 0.15f; drawPlayer.itemFlamePos[index3].Y = (float) Main.rand.Next(-10, 1) * 0.35f; } } } if (drawPlayer.armorEffectDrawShadowEOCShield) { int num = drawPlayer.eocDash / 4; if (num > 3) num = 3; for (int index4 = 0; index4 < num; ++index4) this.DrawPlayer(drawPlayer, drawPlayer.shadowPos[index4], drawPlayer.shadowRotation[index4], drawPlayer.shadowOrigin[index4], (float) (0.5 + 0.200000002980232 * (double) index4)); } Vector2 Position; if (drawPlayer.invis) { drawPlayer.armorEffectDrawOutlines = false; drawPlayer.armorEffectDrawShadow = false; drawPlayer.armorEffectDrawShadowSubtle = false; Position = drawPlayer.position; if (drawPlayer.aggro <= -750) { this.DrawPlayer(drawPlayer, Position, drawPlayer.fullRotation, drawPlayer.fullRotationOrigin, 1f); } else { drawPlayer.invis = false; this.DrawPlayer(drawPlayer, Position, drawPlayer.fullRotation, drawPlayer.fullRotationOrigin); drawPlayer.invis = true; } } if (drawPlayer.armorEffectDrawOutlines) { Vector2 position = drawPlayer.position; if (!Main.gamePaused) drawPlayer.ghostFade += drawPlayer.ghostDir * 0.075f; if ((double) drawPlayer.ghostFade < 0.1) { drawPlayer.ghostDir = 1f; drawPlayer.ghostFade = 0.1f; } else if ((double) drawPlayer.ghostFade > 0.9) { drawPlayer.ghostDir = -1f; drawPlayer.ghostFade = 0.9f; } float num1 = drawPlayer.ghostFade * 5f; for (int index5 = 0; index5 < 4; ++index5) { float num2; float num3; switch (index5) { case 1: num2 = -num1; num3 = 0.0f; break; case 2: num2 = 0.0f; num3 = num1; break; case 3: num2 = 0.0f; num3 = -num1; break; default: num2 = num1; num3 = 0.0f; break; } Position = new Vector2(drawPlayer.position.X + num2, drawPlayer.position.Y + drawPlayer.gfxOffY + num3); this.DrawPlayer(drawPlayer, Position, drawPlayer.fullRotation, drawPlayer.fullRotationOrigin, drawPlayer.ghostFade); } } if (drawPlayer.armorEffectDrawOutlinesForbidden) { Vector2 position = drawPlayer.position; if (!Main.gamePaused) drawPlayer.ghostFade += drawPlayer.ghostDir * 0.025f; if ((double) drawPlayer.ghostFade < 0.1) { drawPlayer.ghostDir = 1f; drawPlayer.ghostFade = 0.1f; } else if ((double) drawPlayer.ghostFade > 0.9) { drawPlayer.ghostDir = -1f; drawPlayer.ghostFade = 0.9f; } float num4 = drawPlayer.ghostFade * 5f; for (int index6 = 0; index6 < 4; ++index6) { float num5; float num6; switch (index6) { case 1: num5 = -num4; num6 = 0.0f; break; case 2: num5 = 0.0f; num6 = num4; break; case 3: num5 = 0.0f; num6 = -num4; break; default: num5 = num4; num6 = 0.0f; break; } Position = new Vector2(drawPlayer.position.X + num5, drawPlayer.position.Y + drawPlayer.gfxOffY + num6); this.DrawPlayer(drawPlayer, Position, drawPlayer.fullRotation, drawPlayer.fullRotationOrigin, drawPlayer.ghostFade); } } if (drawPlayer.armorEffectDrawShadowBasilisk) { int num = (int) ((double) drawPlayer.basiliskCharge * 3.0); for (int index7 = 0; index7 < num; ++index7) this.DrawPlayer(drawPlayer, drawPlayer.shadowPos[index7], drawPlayer.shadowRotation[index7], drawPlayer.shadowOrigin[index7], (float) (0.5 + 0.200000002980232 * (double) index7)); } else if (drawPlayer.armorEffectDrawShadow) { for (int index8 = 0; index8 < 3; ++index8) this.DrawPlayer(drawPlayer, drawPlayer.shadowPos[index8], drawPlayer.shadowRotation[index8], drawPlayer.shadowOrigin[index8], (float) (0.5 + 0.200000002980232 * (double) index8)); } if (drawPlayer.armorEffectDrawShadowLokis) { for (int index9 = 0; index9 < 3; ++index9) this.DrawPlayer(drawPlayer, Vector2.Lerp(drawPlayer.shadowPos[index9], drawPlayer.position + new Vector2(0.0f, drawPlayer.gfxOffY), 0.5f), drawPlayer.shadowRotation[index9], drawPlayer.shadowOrigin[index9], MathHelper.Lerp(1f, (float) (0.5 + 0.200000002980232 * (double) index9), 0.5f)); } if (drawPlayer.armorEffectDrawShadowSubtle) { for (int index10 = 0; index10 < 4; ++index10) { Position.X = drawPlayer.position.X + (float) Main.rand.Next(-20, 21) * 0.1f; Position.Y = drawPlayer.position.Y + (float) Main.rand.Next(-20, 21) * 0.1f + drawPlayer.gfxOffY; this.DrawPlayer(drawPlayer, Position, drawPlayer.fullRotation, drawPlayer.fullRotationOrigin, 0.9f); } } if (drawPlayer.shadowDodge) { ++drawPlayer.shadowDodgeCount; if ((double) drawPlayer.shadowDodgeCount > 30.0) drawPlayer.shadowDodgeCount = 30f; } else { --drawPlayer.shadowDodgeCount; if ((double) drawPlayer.shadowDodgeCount < 0.0) drawPlayer.shadowDodgeCount = 0.0f; } if ((double) drawPlayer.shadowDodgeCount > 0.0) { Vector2 position = drawPlayer.position; Position.X = drawPlayer.position.X + drawPlayer.shadowDodgeCount; Position.Y = drawPlayer.position.Y + drawPlayer.gfxOffY; this.DrawPlayer(drawPlayer, Position, drawPlayer.fullRotation, drawPlayer.fullRotationOrigin, (float) (0.5 + (double) Main.rand.Next(-10, 11) * 0.00499999988824129)); Position.X = drawPlayer.position.X - drawPlayer.shadowDodgeCount; this.DrawPlayer(drawPlayer, Position, drawPlayer.fullRotation, drawPlayer.fullRotationOrigin, (float) (0.5 + (double) Main.rand.Next(-10, 11) * 0.00499999988824129)); } Position = drawPlayer.position; Position.Y += drawPlayer.gfxOffY; if (drawPlayer.stoned) this.DrawPlayerStoned(drawPlayer, Position); else if (!drawPlayer.invis) this.DrawPlayer(drawPlayer, Position, drawPlayer.fullRotation, drawPlayer.fullRotationOrigin); Main.spriteBatch.End(); } } } TimeLogger.DetailedDrawTime(21); } private static void DrawPlayers_SetArmorEffectsOld( Player drawPlayer, ref bool armorEffectDrawShadow, ref bool armorEffectDrawShadowSubtle, ref bool armorEffectDrawOutlines, ref bool armorEffectDrawShadowLokis, ref bool armorEffectDrawShadowBasilisk, ref bool armorEffectDrawOutlinesForbidden, ref bool armorEffectEOCShield) { if (drawPlayer.head == 111 && drawPlayer.body == 73 && drawPlayer.legs == 62) { armorEffectDrawShadowSubtle = true; armorEffectDrawOutlines = true; } if (drawPlayer.head == 134 && drawPlayer.body == 95 && drawPlayer.legs == 79) { armorEffectDrawShadowSubtle = true; armorEffectDrawOutlines = true; } if (drawPlayer.head == 107 && drawPlayer.body == 69 && drawPlayer.legs == 58) { armorEffectDrawShadowSubtle = true; armorEffectDrawShadow = true; } if (drawPlayer.head == 108 && drawPlayer.body == 70 && drawPlayer.legs == 59) { armorEffectDrawShadowSubtle = true; armorEffectDrawShadow = true; } if (drawPlayer.head == 109 && drawPlayer.body == 71 && drawPlayer.legs == 60) { armorEffectDrawShadowSubtle = true; armorEffectDrawShadow = true; } if (drawPlayer.head == 110 && drawPlayer.body == 72 && drawPlayer.legs == 61) { armorEffectDrawShadowSubtle = true; armorEffectDrawShadow = true; } if (drawPlayer.head == 193 && drawPlayer.body == 194 && drawPlayer.legs == 134) { armorEffectDrawShadowSubtle = true; armorEffectDrawShadowLokis = true; armorEffectDrawOutlines = true; } if (drawPlayer.mount.Active && drawPlayer.mount.Type == 3 && (double) drawPlayer.velocity.Y != 0.0 && !drawPlayer.SlimeDontHyperJump) armorEffectDrawShadow = true; if (drawPlayer.mount.Active && drawPlayer.mount.Type == 10 && (double) Math.Abs(drawPlayer.velocity.X) > (double) drawPlayer.mount.DashSpeed - (double) drawPlayer.mount.RunSpeed / 2.0) armorEffectDrawShadow = true; if (drawPlayer.mount.Active && drawPlayer.mount.Type == 14 && (double) Math.Abs(drawPlayer.velocity.X) > (double) drawPlayer.mount.RunSpeed / 2.0) armorEffectDrawShadowBasilisk = true; if (drawPlayer.body == 67 && drawPlayer.legs == 56 && drawPlayer.head >= 103 && drawPlayer.head <= 105) armorEffectDrawShadow = true; if ((drawPlayer.head == 78 || drawPlayer.head == 79 || drawPlayer.head == 80) && drawPlayer.body == 51 && drawPlayer.legs == 47) armorEffectDrawShadowSubtle = true; if (drawPlayer.head == 200 && drawPlayer.body == 198 && drawPlayer.legs == 142) { armorEffectDrawShadowLokis = true; armorEffectDrawOutlinesForbidden = true; } if (drawPlayer.head == 171 && drawPlayer.body == 177 && drawPlayer.legs == 112) { armorEffectDrawShadow = true; armorEffectDrawOutlines = true; } if (drawPlayer.head == 169 && drawPlayer.body == 175 && drawPlayer.legs == 110) armorEffectDrawShadow = true; if (drawPlayer.head == 170 && drawPlayer.body == 176 && drawPlayer.legs == 111) { armorEffectDrawShadowLokis = true; armorEffectDrawOutlines = true; } if (drawPlayer.eocDash > 0) armorEffectEOCShield = true; else if (drawPlayer.dashDelay < 0) armorEffectDrawShadow = true; if (drawPlayer.head == 5 && drawPlayer.body == 5 && drawPlayer.legs == 5) armorEffectDrawShadow = true; if (drawPlayer.head == 74 && drawPlayer.body == 48 && drawPlayer.legs == 44) armorEffectDrawShadow = true; if (drawPlayer.head == 76 && drawPlayer.body == 49 && drawPlayer.legs == 45) armorEffectDrawShadow = true; if (drawPlayer.head == 7 && drawPlayer.body == 7 && drawPlayer.legs == 7) armorEffectDrawShadow = true; if (drawPlayer.head == 22 && drawPlayer.body == 14 && drawPlayer.legs == 14) armorEffectDrawShadow = true; if (drawPlayer.dye[0].dye == (byte) 30 && drawPlayer.dye[1].dye == (byte) 30 && drawPlayer.dye[2].dye == (byte) 30 && drawPlayer.head == 4 && drawPlayer.body == 27 && drawPlayer.legs == 26) { armorEffectDrawShadow = true; armorEffectDrawOutlines = true; } if (drawPlayer.head == 189 && drawPlayer.body == 190 && drawPlayer.legs == 130) armorEffectDrawOutlines = true; if (drawPlayer.body == 17 && drawPlayer.legs == 16 && (drawPlayer.head == 29 || drawPlayer.head == 30 || drawPlayer.head == 31)) armorEffectDrawShadow = true; if (drawPlayer.body == 19 && drawPlayer.legs == 18 && (drawPlayer.head == 35 || drawPlayer.head == 36 || drawPlayer.head == 37)) armorEffectDrawOutlines = true; if (drawPlayer.body == 24 && drawPlayer.legs == 23 && (drawPlayer.head == 41 || drawPlayer.head == 42 || drawPlayer.head == 43)) { armorEffectDrawOutlines = true; armorEffectDrawShadow = true; } if (drawPlayer.head == 157 && drawPlayer.legs == 98 && drawPlayer.body != 105) { int body = drawPlayer.body; } if (drawPlayer.body == 36 && drawPlayer.head == 56) armorEffectDrawOutlines = true; if (!drawPlayer.stoned && (double) drawPlayer.stealth == 1.0) return; armorEffectDrawOutlines = false; armorEffectDrawShadow = false; armorEffectDrawShadowSubtle = false; } protected void DrawElderEye( SpriteBatch spriteBatch, Vector2 worldPosition, float opacity, float scale, int frameNumber, Microsoft.Xna.Framework.Color passedColor) { Texture2D texture2D = Main.extraTexture[78]; 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 < 580) { if (!Main.npc[iNPCIndex].hide) { Main.npc[iNPCIndex].visualOffset *= 0.95f; NPC npc1 = Main.npc[iNPCIndex]; npc1.position = npc1.position + Main.npc[iNPCIndex].visualOffset; 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) Main.chain12Texture.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(Main.chain12Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain12Texture.Width, Main.chain12Texture.Height)), color, rotation, new Vector2((float) Main.chain12Texture.Width * 0.5f, (float) Main.chain12Texture.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; num10 = Main.npc[NPC.plantBoss].Center.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.spriteBatch.Draw(Main.chain26Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain26Texture.Width, height)), color, rotation, new Vector2((float) Main.chain26Texture.Width * 0.5f, (float) Main.chain26Texture.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; num17 = Main.npc[index].Center.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.spriteBatch.Draw(Main.chain27Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain27Texture.Width, height)), color, rotation, new Vector2((float) Main.chain27Texture.Width * 0.5f, (float) Main.chain27Texture.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].visualOffset; } } } } } catch { Main.npc[iNPCIndex].active = false; } } } protected void DrawNPCCheckAlt(NPC n) { if (NPCID.Sets.ExtraTextureCount[n.type] == 0 || !Main.NPCLoaded[n.type]) return; Main.npcTexture[n.type] = Main.npcAltTextures[n.type][n.altTexture]; } protected void DrawNPC(int iNPCIndex, bool behindTiles) { NPC n = Main.npc[iNPCIndex]; int type = n.type; this.LoadNPC(type); if (n.setFrameSize) { n.frame = new Microsoft.Xna.Framework.Rectangle(0, 0, Main.npcTexture[type].Width, Main.npcTexture[type].Height / Main.npcFrameCount[type]); n.setFrameSize = false; } if (n.realLife == -1 && n.life >= n.lifeMax && !n.boss) { bool flag1 = (double) Lighting.GetColor((int) ((double) n.position.X + (double) n.width * 0.5) / 16, (int) (((double) n.position.Y + (double) n.height * 0.5) / 16.0)).ToVector3().Length() > 0.432500004768372; bool flag2 = false; if (LockOnHelper.AimedTarget == n) flag2 = true; else if ((double) n.Distance(Main.player[Main.myPlayer].Center) < 400.0 & flag1) flag2 = true; if (flag2 && n.lifeMax < 5) flag2 = false; if (flag2 && n.aiStyle == 25 && (double) n.ai[0] == 0.0) flag2 = false; n.nameOver = !flag2 ? MathHelper.Clamp(n.nameOver - 0.025f, 0.0f, 1f) : MathHelper.Clamp(n.nameOver + 0.025f, 0.0f, 1f); } else n.nameOver = MathHelper.Clamp(n.nameOver - 0.025f, 0.0f, 1f); if (type == 101) { bool flag3 = true; Vector2 vector2 = new Vector2(n.position.X + (float) (n.width / 2), n.position.Y + (float) (n.height / 2)); float num1 = (float) ((double) n.ai[0] * 16.0 + 8.0) - vector2.X; float num2 = (float) ((double) n.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) n.ai[0] * 16.0 + 8.0) - vector2.X; num2 = (float) ((double) n.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 (!flag3) { flag3 = true; Main.spriteBatch.Draw(Main.chain10Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain10Texture.Width, height)), color, rotation, new Vector2((float) Main.chain10Texture.Width * 0.5f, (float) Main.chain10Texture.Height * 0.5f), scale, SpriteEffects.None, 0.0f); } else { flag3 = false; Main.spriteBatch.Draw(Main.chain11Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain10Texture.Width, height)), color, rotation, new Vector2((float) Main.chain10Texture.Width * 0.5f, (float) Main.chain10Texture.Height * 0.5f), scale, SpriteEffects.None, 0.0f); } } } else if (n.aiStyle == 13) { Vector2 vector2 = new Vector2(n.position.X + (float) (n.width / 2), n.position.Y + (float) (n.height / 2)); float num7 = (float) ((double) n.ai[0] * 16.0 + 8.0) - vector2.X; float num8 = (float) ((double) n.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) n.ai[0] * 16.0 + 8.0) - vector2.X; num8 = (float) ((double) n.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 (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: Main.spriteBatch.Draw(Main.chain5Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain4Texture.Width, height)), color, rotation, new Vector2((float) Main.chain4Texture.Width * 0.5f, (float) Main.chain4Texture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); continue; case 175: Main.spriteBatch.Draw(Main.chain14Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain14Texture.Width, height)), color, rotation, new Vector2((float) Main.chain14Texture.Width * 0.5f, (float) Main.chain14Texture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); continue; case 259: Main.spriteBatch.Draw(Main.chain24Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain24Texture.Width, height)), color, rotation, new Vector2((float) Main.chain24Texture.Width * 0.5f, (float) Main.chain24Texture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); continue; case 260: Main.spriteBatch.Draw(Main.chain25Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain25Texture.Width, height)), color, rotation, new Vector2((float) Main.chain25Texture.Width * 0.5f, (float) Main.chain25Texture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); continue; default: Main.spriteBatch.Draw(Main.chain4Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain4Texture.Width, height)), color, rotation, new Vector2((float) Main.chain4Texture.Width * 0.5f, (float) Main.chain4Texture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); continue; } } } if (type == 327) { float rotation = 0.0f; Vector2 vector2 = new Vector2(n.Center.X, n.Center.Y + 80f); int num = (int) n.localAI[1]; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.spriteBatch.Draw(Main.pumpkingCloakTexture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.pumpkingCloakTexture.Height / 5 * num, Main.pumpkingCloakTexture.Width, Main.pumpkingCloakTexture.Height / 5)), color, rotation, new Vector2((float) Main.pumpkingCloakTexture.Width * 0.5f, (float) ((double) Main.pumpkingCloakTexture.Height * 0.5 / 5.0)), 1f, SpriteEffects.None, 0.0f); } if (type == 328) { Vector2 vector2 = new Vector2((float) ((double) n.position.X + (double) n.width * 0.5 - 5.0 * (double) n.ai[0]), n.position.Y + 20f); for (int index = 0; index < 2; ++index) { float num14 = Main.npc[(int) n.ai[1]].position.X + (float) (Main.npc[(int) n.ai[1]].width / 2) - vector2.X; float num15 = (float) ((double) Main.npc[(int) n.ai[1]].position.Y + (double) (Main.npc[(int) n.ai[1]].height / 2) - 30.0) - vector2.Y; float num16; float num17; float num18; if (index == 0) { num16 = num14 - 200f * n.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 * n.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)); Main.spriteBatch.Draw(Main.pumpkingArmTexture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.pumpkingArmTexture.Width, Main.pumpkingArmTexture.Height)), color, rotation, new Vector2((float) Main.pumpkingArmTexture.Width * 0.5f, (float) Main.pumpkingArmTexture.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) n.position.X + (double) n.width * 0.5 - 5.0 * (double) n.ai[0]), n.position.Y + 20f); for (int index1 = 0; index1 < 2; ++index1) { float num19 = Main.npc[(int) n.ai[1]].position.X + (float) (Main.npc[(int) n.ai[1]].width / 2) - vector2.X; float num20 = Main.npc[(int) n.ai[1]].position.Y + (float) (Main.npc[(int) n.ai[1]].height / 2) - vector2.Y; float num21; float num22; float num23; if (index1 == 0) { num21 = num19 - 200f * n.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 * n.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)); Main.spriteBatch.Draw(Main.boneArmTexture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.boneArmTexture.Width, Main.boneArmTexture.Height)), color, rotation, new Vector2((float) Main.boneArmTexture.Width * 0.5f, (float) Main.boneArmTexture.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 (n.aiStyle == 47) { Vector2 vector2 = new Vector2(n.Center.X, n.Center.Y); float num24 = Main.npc[NPC.golemBoss].Center.X - vector2.X; float num25 = Main.npc[NPC.golemBoss].Center.Y - vector2.Y - 7f; float num26 = type != 247 ? num24 + 66f : num24 - 70f; 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 / num27; float num29 = num26 * num28; float num30 = num25 * num28; vector2.X += num29; vector2.Y += num30; float num31 = Main.npc[NPC.golemBoss].Center.X - vector2.X; num25 = Main.npc[NPC.golemBoss].Center.Y - vector2.Y - 7f; num26 = type != 247 ? num31 + 66f : num31 - 70f; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.spriteBatch.Draw(Main.chain21Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain21Texture.Width, Main.chain21Texture.Height)), color, rotation, new Vector2((float) Main.chain21Texture.Width * 0.5f, (float) Main.chain21Texture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); } } } if (n.aiStyle >= 33 && n.aiStyle <= 36) { Vector2 vector2 = new Vector2((float) ((double) n.position.X + (double) n.width * 0.5 - 5.0 * (double) n.ai[0]), n.position.Y + 20f); for (int index3 = 0; index3 < 2; ++index3) { float num32 = Main.npc[(int) n.ai[1]].position.X + (float) (Main.npc[(int) n.ai[1]].width / 2) - vector2.X; float num33 = Main.npc[(int) n.ai[1]].position.Y + (float) (Main.npc[(int) n.ai[1]].height / 2) - vector2.Y; float num34; float num35; float num36; if (index3 == 0) { num34 = num32 - 200f * n.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 * n.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)); Main.spriteBatch.Draw(Main.boneArm2Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.boneArmTexture.Width, Main.boneArmTexture.Height)), color, rotation, new Vector2((float) Main.boneArmTexture.Width * 0.5f, (float) Main.boneArmTexture.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 (n.aiStyle == 20) { Vector2 vector2 = new Vector2(n.position.X + (float) (n.width / 2), n.position.Y + (float) (n.height / 2)); float num37 = n.ai[1] - vector2.X; float num38 = n.ai[2] - vector2.Y; float rotation = (float) Math.Atan2((double) num38, (double) num37) - 1.57f; n.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 = n.ai[1] - vector2.X; num38 = n.ai[2] - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.spriteBatch.Draw(Main.chainTexture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chainTexture.Width, height)), color, rotation, new Vector2((float) Main.chainTexture.Width * 0.5f, (float) Main.chainTexture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); } Main.spriteBatch.Draw(Main.spikeBaseTexture, new Vector2(n.ai[1] - Main.screenPosition.X, n.ai[2] - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.spikeBaseTexture.Width, Main.spikeBaseTexture.Height)), Lighting.GetColor((int) n.ai[1] / 16, (int) ((double) n.ai[2] / 16.0)), rotation - 0.75f, new Vector2((float) Main.spikeBaseTexture.Width * 0.5f, (float) Main.spikeBaseTexture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); } Microsoft.Xna.Framework.Color color1 = Lighting.GetColor((int) ((double) n.position.X + (double) n.width * 0.5) / 16, (int) (((double) n.position.Y + (double) n.height * 0.5) / 16.0)); if (type >= 277 && type <= 280) { if (color1.R < byte.MaxValue) color1.R = byte.MaxValue; if (color1.G < (byte) 175) color1.G = (byte) 175; } if (type == -4) { int r1 = (int) color1.R; int g1 = (int) color1.G; int b1 = (int) color1.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; color1 = new Microsoft.Xna.Framework.Color(r2, g2, b2); } if (behindTiles && type != 113 && type != 114) { int num43 = (int) (((double) n.position.X - 8.0) / 16.0); int num44 = (int) (((double) n.position.X + (double) n.width + 8.0) / 16.0); int num45 = (int) (((double) n.position.Y - 8.0) / 16.0); int num46 = (int) (((double) n.position.Y + (double) n.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) color1 = Microsoft.Xna.Framework.Color.Black; } } } float R1 = 1f; float G1 = 1f; float B = 1f; float A = 1f; if (n.poisoned) { if (Main.rand.Next(30) == 0) { int index = Dust.NewDust(n.position, n.width, n.height, 46, Alpha: 120, Scale: 0.2f); Main.dust[index].noGravity = true; Main.dust[index].fadeIn = 1.9f; } R1 *= 0.65f; B *= 0.75f; color1 = Main.buffColor(color1, R1, G1, B, A); } if (n.venom) { if (Main.rand.Next(10) == 0) { int index = Dust.NewDust(n.position, n.width, n.height, 171, Alpha: 100, Scale: 0.5f); Main.dust[index].noGravity = true; Main.dust[index].fadeIn = 1.5f; } G1 *= 0.45f; R1 *= 0.75f; color1 = Main.buffColor(color1, R1, G1, B, A); } if (n.midas) { B *= 0.3f; R1 *= 0.85f; color1 = Main.buffColor(color1, R1, G1, B, A); } if (n.shadowFlame && Main.rand.Next(5) < 4) { int index = Dust.NewDust(new Vector2(n.position.X - 2f, n.position.Y - 2f), n.width + 4, n.height + 4, 27, n.velocity.X * 0.4f, n.velocity.Y * 0.4f, 180, Scale: 1.95f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.75f; Main.dust[index].velocity.X *= 0.75f; --Main.dust[index].velocity.Y; if (Main.rand.Next(4) == 0) { Main.dust[index].noGravity = false; Main.dust[index].scale *= 0.5f; } } if (n.onFire) { if (Main.rand.Next(4) < 3) { int index = Dust.NewDust(new Vector2(n.position.X - 2f, n.position.Y - 2f), n.width + 4, n.height + 4, 6, n.velocity.X * 0.4f, n.velocity.Y * 0.4f, 100, Scale: 3.5f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= 1.8f; Main.dust[index].velocity.Y -= 0.5f; if (Main.rand.Next(4) == 0) { Main.dust[index].noGravity = false; Main.dust[index].scale *= 0.5f; } } Lighting.AddLight((int) ((double) n.position.X / 16.0), (int) ((double) n.position.Y / 16.0 + 1.0), 1f, 0.3f, 0.1f); } if (n.daybreak) { if (Main.rand.Next(4) < 3) { int index = Dust.NewDust(new Vector2(n.position.X - 2f, n.position.Y - 2f), n.width + 4, n.height + 4, 158, n.velocity.X * 0.4f, n.velocity.Y * 0.4f, 100, Scale: 3.5f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= 2.8f; Main.dust[index].velocity.Y -= 0.5f; if (Main.rand.Next(4) == 0) { Main.dust[index].noGravity = false; Main.dust[index].scale *= 0.5f; } } Lighting.AddLight((int) ((double) n.position.X / 16.0), (int) ((double) n.position.Y / 16.0 + 1.0), 1f, 0.3f, 0.1f); } if (n.betsysCurse) { R1 *= 0.8f; G1 *= 0.6f; color1 = Main.buffColor(color1, R1, G1, B, A); if (Main.rand.Next(4) < 3) { int index = Dust.NewDust(new Vector2(n.position.X - 2f, n.position.Y - 2f), n.width + 4, n.height + 4, 55, n.velocity.X * 0.4f, n.velocity.Y * 0.4f, 100, Scale: 3.5f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= 2.8f; Main.dust[index].velocity.Y -= 1.5f; Main.dust[index].noGravity = false; Main.dust[index].scale = 0.9f; Main.dust[index].color = new Microsoft.Xna.Framework.Color(0, 0, 180, (int) byte.MaxValue); Main.dust[index].velocity *= 0.2f; } Lighting.AddLight((int) ((double) n.position.X / 16.0), (int) ((double) n.position.Y / 16.0 + 1.0), 0.6f, 0.1f, 0.9f); } if (n.oiled) { R1 *= 0.7f; G1 *= 0.7f; B *= 0.7f; color1 = Main.buffColor(color1, R1, G1, B, A); if (Main.rand.Next(3) != 0) { int Alpha = 175; Microsoft.Xna.Framework.Color newColor = new Microsoft.Xna.Framework.Color(0, 0, 0, 140); Vector2 position = n.position; position.X -= 2f; position.Y -= 2f; if (Main.rand.Next(2) == 0) { int index = Dust.NewDust(position, n.width + 4, n.height + 2, 4, Alpha: Alpha, newColor: newColor, Scale: 1.4f); if (Main.rand.Next(2) == 0) Main.dust[index].alpha += 25; if (Main.rand.Next(2) == 0) Main.dust[index].alpha += 25; Main.dust[index].noLight = true; Main.dust[index].velocity *= 0.2f; Main.dust[index].velocity.Y += 0.2f; Main.dust[index].velocity += n.velocity; } } } if (n.dryadWard && (double) n.velocity.X != 0.0 && Main.rand.Next(4) == 0) { int index = Dust.NewDust(new Vector2(n.position.X - 2f, (float) ((double) n.position.Y + (double) n.height - 2.0)), n.width + 4, 4, 163, n.velocity.X * 0.4f, n.velocity.Y * 0.4f, 100, Scale: 1.5f); Main.dust[index].noGravity = true; Main.dust[index].noLight = true; Main.dust[index].velocity *= 0.0f; } if (n.dryadBane && Main.rand.Next(4) == 0) { int index = Dust.NewDust(new Vector2(n.position.X - 2f, n.position.Y), n.width + 4, n.height, 163, n.velocity.X * 0.4f, n.velocity.Y * 0.4f, 100, Scale: 1.5f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= new Vector2((float) ((double) Main.rand.NextFloat() * 4.0 - 2.0), 0.0f); Main.dust[index].noLight = true; } if (n.loveStruck && Main.rand.Next(5) == 0) { Vector2 vector2 = new Vector2((float) Main.rand.Next(-10, 11), (float) Main.rand.Next(-10, 11)); vector2.Normalize(); vector2.X *= 0.66f; int index = Gore.NewGore(n.position + new Vector2((float) Main.rand.Next(n.width + 1), (float) Main.rand.Next(n.height + 1)), vector2 * (float) Main.rand.Next(3, 6) * 0.33f, 331, (float) Main.rand.Next(40, 121) * 0.01f); Main.gore[index].sticky = false; Main.gore[index].velocity *= 0.4f; Main.gore[index].velocity.Y -= 0.6f; } if (n.stinky) { R1 *= 0.7f; B *= 0.55f; color1 = Main.buffColor(color1, R1, G1, B, A); if (Main.rand.Next(5) == 0) { Vector2 vector2_1 = new Vector2((float) Main.rand.Next(-10, 11), (float) Main.rand.Next(-10, 11)); vector2_1.Normalize(); vector2_1.X *= 0.66f; vector2_1.Y = Math.Abs(vector2_1.Y); Vector2 vector2_2 = vector2_1 * (float) Main.rand.Next(3, 5) * 0.25f; int index = Dust.NewDust(n.position, n.width, n.height, 188, vector2_2.X, vector2_2.Y * 0.5f, 100, Scale: 1.5f); Main.dust[index].velocity *= 0.1f; Main.dust[index].velocity.Y -= 0.5f; } } if (n.dripping && Main.rand.Next(4) != 0) { Vector2 position = n.position; position.X -= 2f; position.Y -= 2f; if (Main.rand.Next(2) == 0) { int index = Dust.NewDust(position, n.width + 4, n.height + 2, 211, Alpha: 50, Scale: 0.8f); if (Main.rand.Next(2) == 0) Main.dust[index].alpha += 25; if (Main.rand.Next(2) == 0) Main.dust[index].alpha += 25; Main.dust[index].noLight = true; Main.dust[index].velocity *= 0.2f; Main.dust[index].velocity.Y += 0.2f; Main.dust[index].velocity += n.velocity; } else { int index = Dust.NewDust(position, n.width + 8, n.height + 8, 211, Alpha: 50, Scale: 1.1f); if (Main.rand.Next(2) == 0) Main.dust[index].alpha += 25; if (Main.rand.Next(2) == 0) Main.dust[index].alpha += 25; Main.dust[index].noLight = true; Main.dust[index].noGravity = true; Main.dust[index].velocity *= 0.2f; ++Main.dust[index].velocity.Y; Main.dust[index].velocity += n.velocity; } } if (n.drippingSlime) { if (Main.rand.Next(4) != 0) { int Alpha = 175; Microsoft.Xna.Framework.Color newColor = new Microsoft.Xna.Framework.Color(0, 80, (int) byte.MaxValue, 100); Vector2 position = n.position; position.X -= 2f; position.Y -= 2f; if (Main.rand.Next(2) == 0) { int index = Dust.NewDust(position, n.width + 4, n.height + 2, 4, Alpha: Alpha, newColor: newColor, Scale: 1.4f); if (Main.rand.Next(2) == 0) Main.dust[index].alpha += 25; if (Main.rand.Next(2) == 0) Main.dust[index].alpha += 25; Main.dust[index].noLight = true; Main.dust[index].velocity *= 0.2f; Main.dust[index].velocity.Y += 0.2f; Main.dust[index].velocity += n.velocity; } } float R2 = R1 * 0.8f; float G2 = G1 * 0.8f; color1 = Main.buffColor(color1, R2, G2, B, A); } if (n.ichor) color1 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, 0, (int) byte.MaxValue); if (n.onFrostBurn) { if (Main.rand.Next(4) < 3) { int index = Dust.NewDust(new Vector2(n.position.X - 2f, n.position.Y - 2f), n.width + 4, n.height + 4, 135, n.velocity.X * 0.4f, n.velocity.Y * 0.4f, 100, Scale: 3.5f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= 1.8f; Main.dust[index].velocity.Y -= 0.5f; if (Main.rand.Next(4) == 0) { Main.dust[index].noGravity = false; Main.dust[index].scale *= 0.5f; } } Lighting.AddLight((int) ((double) n.position.X / 16.0), (int) ((double) n.position.Y / 16.0 + 1.0), 0.1f, 0.6f, 1f); } if (n.onFire2) { if (Main.rand.Next(4) < 3) { int index = Dust.NewDust(new Vector2(n.position.X - 2f, n.position.Y - 2f), n.width + 4, n.height + 4, 75, n.velocity.X * 0.4f, n.velocity.Y * 0.4f, 100, Scale: 3.5f); Main.dust[index].noGravity = true; Main.dust[index].velocity *= 1.8f; Main.dust[index].velocity.Y -= 0.5f; if (Main.rand.Next(4) == 0) { Main.dust[index].noGravity = false; Main.dust[index].scale *= 0.5f; } } Lighting.AddLight((int) ((double) n.position.X / 16.0), (int) ((double) n.position.Y / 16.0 + 1.0), 1f, 0.3f, 0.1f); } if (Main.player[Main.myPlayer].detectCreature && n.lifeMax > 1) { byte num47; byte num48; byte num49; if (n.friendly || n.catchItem > (short) 0 || n.damage == 0 && n.lifeMax == 5) { num47 = (byte) 50; num48 = byte.MaxValue; num49 = (byte) 50; } else { num47 = byte.MaxValue; num48 = (byte) 50; num49 = (byte) 50; } if ((int) color1.R < (int) num47) color1.R = num47; if ((int) color1.G < (int) num48) color1.G = num48; if ((int) color1.B < (int) num49) color1.B = num49; } if (type == 50) { Vector2 zero = Vector2.Zero; float num = 0.0f; zero.Y -= n.velocity.Y; zero.X -= n.velocity.X * 2f; float rotation = num + n.velocity.X * 0.05f; if (n.frame.Y == 120) zero.Y += 2f; if (n.frame.Y == 360) zero.Y -= 2f; if (n.frame.Y == 480) zero.Y -= 6f; Main.spriteBatch.Draw(Main.ninjaTexture, new Vector2(n.position.X - Main.screenPosition.X + (float) (n.width / 2) + zero.X, n.position.Y - Main.screenPosition.Y + (float) (n.height / 2) + zero.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.ninjaTexture.Width, Main.ninjaTexture.Height)), color1, rotation, new Vector2((float) (Main.ninjaTexture.Width / 2), (float) (Main.ninjaTexture.Height / 2)), 1f, SpriteEffects.None, 0.0f); } if (type == 71) { Vector2 zero = Vector2.Zero; float num = 0.0f; zero.Y -= n.velocity.Y * 0.3f; zero.X -= n.velocity.X * 0.6f; float rotation = num + n.velocity.X * 0.09f; if (n.frame.Y == 120) zero.Y += 2f; if (n.frame.Y == 360) zero.Y -= 2f; if (n.frame.Y == 480) zero.Y -= 6f; Main.spriteBatch.Draw(Main.itemTexture[327], new Vector2(n.position.X - Main.screenPosition.X + (float) (n.width / 2) + zero.X, n.position.Y - Main.screenPosition.Y + (float) (n.height / 2) + zero.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[327].Width, Main.itemTexture[327].Height)), color1, rotation, new Vector2((float) (Main.itemTexture[327].Width / 2), (float) (Main.itemTexture[327].Height / 2)), 1f, SpriteEffects.None, 0.0f); } if (type == 69) Main.spriteBatch.Draw(Main.antLionTexture, new Vector2(n.position.X - Main.screenPosition.X + (float) (n.width / 2), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height + 14.0)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.antLionTexture.Width, Main.antLionTexture.Height)), color1, (float) (-(double) n.rotation * 0.300000011920929), new Vector2((float) (Main.antLionTexture.Width / 2), (float) (Main.antLionTexture.Height / 2)), 1f, SpriteEffects.None, 0.0f); if (type == 1 && (double) n.ai[1] > 0.0) { int index = (int) n.ai[1]; float scale = 1f; float num50 = 22f * n.scale; float num51 = 18f * n.scale; float width = (float) Main.itemTexture[index].Width; float height = (float) Main.itemTexture[index].Height; if ((double) width > (double) num50) { scale *= num50 / width; width *= scale; height *= scale; } if ((double) height > (double) num51) { scale *= num51 / height; float num52 = width * scale; float num53 = height * scale; } float num54 = -1f; float num55 = 1f; int num56 = n.frame.Y / (Main.npcTexture[type].Height / Main.npcFrameCount[type]); float num57 = num55 - (float) num56; float num58 = num54 + (float) (num56 * 2); float rotation = 0.2f - 0.3f * (float) num56; Main.spriteBatch.Draw(Main.itemTexture[index], new Vector2(n.Center.X - Main.screenPosition.X + num58, n.Center.Y - Main.screenPosition.Y + n.gfxOffY + num57), new Microsoft.Xna.Framework.Rectangle?(), color1, rotation, new Vector2((float) (Main.itemTexture[index].Width / 2), (float) (Main.itemTexture[index].Height / 2)), scale, SpriteEffects.None, 0.0f); } float addY = 0.0f; float addHeight = Main.NPCAddHeight(iNPCIndex); Vector2 vector2_3 = new Vector2((float) (Main.npcTexture[type].Width / 2), (float) (Main.npcTexture[type].Height / Main.npcFrameCount[type] / 2)); if (type == 108 || type == 124) { addY = 2f; } else { switch (type) { case 357: addY = n.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 509: addY = -6f; break; case 537: addY = 2f; break; default: if (type == 469 && (double) n.ai[2] == 1.0) { addY = 14f; break; } switch (type) { case 4: vector2_3 = new Vector2(55f, 107f); break; case 125: vector2_3 = new Vector2(55f, 107f); break; case 126: vector2_3 = new Vector2(55f, 107f); break; default: if (type == 63 || type == 64 || type == 103) { vector2_3.Y += 4f; break; } switch (type) { case 69: vector2_3.Y += 8f; break; case 262: vector2_3.Y = 77f; addHeight += 26f; break; case 264: vector2_3.Y = 21f; addHeight += 2f; break; case 266: addHeight += 50f; break; case 268: addHeight += 16f; break; case 288: addHeight += 6f; break; } break; } break; } } if (n.aiStyle == 10 || type == 72) color1 = Microsoft.Xna.Framework.Color.White; SpriteEffects spriteEffects = SpriteEffects.None; if (n.spriteDirection == 1) spriteEffects = SpriteEffects.FlipHorizontally; if (type == 124 && (double) n.localAI[0] == 0.0) { int num = 0; if (n.frame.Y > 56) num += 4; int index = num + n.frame.Y / 56; if (index >= Main.OffsetsPlayerHeadgear.Length) index = 0; float y = Main.OffsetsPlayerHeadgear[index].Y; this.LoadProjectile(582); Texture2D texture2D = Main.projectileTexture[582]; Vector2 position = n.Center - Main.screenPosition - new Vector2((float) texture2D.Width, (float) (texture2D.Height / Main.npcFrameCount[type])) * n.scale / 2f + new Vector2(0.0f, addY + addHeight + n.gfxOffY + y) + new Vector2((float) (-n.spriteDirection * 2), -2f); Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(), n.GetAlpha(color1), n.rotation, texture2D.Size() * new Vector2(0.0f, 0.5f), n.scale, spriteEffects, 0.0f); } if (type == 427 || type == 426 || type == 428 || type == 509 || 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) { Texture2D texture = Main.npcTexture[type]; Microsoft.Xna.Framework.Color secondColor = Microsoft.Xna.Framework.Color.White; float amount1 = 0.0f; float amount2 = 0.0f; int num59 = 0; int num60 = 0; int num61 = 1; int num62 = 15; int num63 = 0; float scale1 = n.scale; float num64 = n.scale; int num65 = 0; float num66 = 0.0f; float num67 = 0.0f; float num68 = 0.0f; Microsoft.Xna.Framework.Color newColor1 = color1; switch (type) { case 426: num65 = 4; num67 = 4f; num66 = (float) (Math.Cos((double) Main.GlobalTime % 1.20000004768372 / 1.20000004768372 * 6.28318548202515) / 2.0 + 0.5); secondColor = Microsoft.Xna.Framework.Color.Turquoise; amount1 = 0.5f; num59 = 6; num60 = 2; num62 = num59; break; case 427: num59 = 8; num60 = 2; num62 = num59 * 3; break; case 509: num59 = 6; num60 = 2; num62 = num59 * 3; break; case 521: num59 = 10; num60 = 2; num62 = num59; num63 = 1; num64 = 0.3f; break; case 523: num65 = 3; num67 = 10f * n.scale; amount1 = 0.5f; amount2 = 0.8f; secondColor = Microsoft.Xna.Framework.Color.HotPink; secondColor.A = (byte) 128; num68 = n.localAI[0]; num66 = n.localAI[1]; break; case 541: num65 = 4; num67 = 6f; num66 = (float) (Math.Cos((double) Main.GlobalTime % 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: num59 = 6; num60 = 3; num62 = num59 * 2; break; case 546: num59 = 8; num60 = 2; num62 = num59 * 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: num59 = 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; num65 = 4; num67 = 4f; num66 = (float) (Math.Cos((double) Main.GlobalTime % 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) n.localAI[3] < 60.0) { float num69 = n.localAI[3] / 60f; num65 = 3; num66 = (float) (1.0 - (double) num69 * (double) num69); num67 = 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, num69 * num69); break; } break; case 558: case 559: case 560: case 574: case 575: if ((double) n.ai[0] != 2.0) { num59 = 0; break; } num59 = 6; num60 = 2; num62 = num59 * 3; num63 = 1; break; case 566: case 567: case 578: num59 = 0; addHeight = -2f; break; } for (int index = num61; index < num59; index += num60) { ref Vector2 local = ref n.oldPos[index]; Microsoft.Xna.Framework.Color newColor2 = Microsoft.Xna.Framework.Color.Lerp(newColor1, secondColor, amount1); Microsoft.Xna.Framework.Color color2 = n.GetAlpha(newColor2) * ((float) (num59 - index) / (float) num62); double rotation = (double) n.rotation; if (num63 == 1) { double num70 = (double) n.oldRot[index]; } float scale2 = MathHelper.Lerp(scale1, num64, (float) (1.0 - (double) (num59 - index) / (double) num62)); Vector2 position = n.oldPos[index] + new Vector2((float) n.width, (float) n.height) / 2f - Main.screenPosition - new Vector2((float) texture.Width, (float) (texture.Height / Main.npcFrameCount[type])) * n.scale / 2f + (vector2_3 * n.scale + new Vector2(0.0f, addY + addHeight + n.gfxOffY)); Main.spriteBatch.Draw(texture, position, new Microsoft.Xna.Framework.Rectangle?(n.frame), color2, n.rotation, vector2_3, scale2, spriteEffects, 0.0f); } for (int index = 0; index < num65; ++index) { Microsoft.Xna.Framework.Color newColor3 = Microsoft.Xna.Framework.Color.Lerp(color1, secondColor, amount1); Microsoft.Xna.Framework.Color color3 = Microsoft.Xna.Framework.Color.Lerp(n.GetAlpha(newColor3), secondColor, amount2) * (1f - num66); Vector2 position = n.Center + ((float) ((double) index / (double) num65 * 6.28318548202515) + n.rotation + num68).ToRotationVector2() * num67 * num66 - Main.screenPosition - new Vector2((float) texture.Width, (float) (texture.Height / Main.npcFrameCount[type])) * n.scale / 2f + (vector2_3 * n.scale + new Vector2(0.0f, addY + addHeight + n.gfxOffY)); Main.spriteBatch.Draw(texture, position, new Microsoft.Xna.Framework.Rectangle?(n.frame), color3, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } Vector2 position1 = n.Center - Main.screenPosition - new Vector2((float) texture.Width, (float) (texture.Height / Main.npcFrameCount[type])) * n.scale / 2f + (vector2_3 * n.scale + new Vector2(0.0f, addY + addHeight + n.gfxOffY)); Main.spriteBatch.Draw(texture, position1, new Microsoft.Xna.Framework.Rectangle?(n.frame), n.GetAlpha(newColor1), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); if (type == 427) Main.spriteBatch.Draw(Main.glowMaskTexture[152], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); else if (type == 426) Main.spriteBatch.Draw(Main.glowMaskTexture[153], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(128 - n.alpha / 2, 128 - n.alpha / 2, 128 - n.alpha / 2, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); if (type == 541) { Microsoft.Xna.Framework.Color color4 = new Microsoft.Xna.Framework.Color((int) sbyte.MaxValue - n.alpha, (int) sbyte.MaxValue - n.alpha, (int) sbyte.MaxValue - n.alpha, 0).MultiplyRGBA(Microsoft.Xna.Framework.Color.Gold); for (int index = 0; index < num65; ++index) { Microsoft.Xna.Framework.Color newColor4 = color4; Microsoft.Xna.Framework.Color color5 = n.GetAlpha(newColor4) * (1f - num66); Vector2 position2 = n.Center + ((float) ((double) index / (double) num65 * 6.28318548202515) + n.rotation + num68).ToRotationVector2() * (float) (4.0 * (double) num66 + 2.0) - Main.screenPosition - new Vector2((float) texture.Width, (float) (texture.Height / Main.npcFrameCount[type])) * n.scale / 2f + (vector2_3 * n.scale + new Vector2(0.0f, addY + addHeight + n.gfxOffY)); Main.spriteBatch.Draw(Main.glowMaskTexture[216], position2, new Microsoft.Xna.Framework.Rectangle?(n.frame), color5, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } Main.spriteBatch.Draw(Main.glowMaskTexture[216], position1, new Microsoft.Xna.Framework.Rectangle?(n.frame), color4, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } if ((type == 568 || type == 569) && (double) n.localAI[3] >= 60.0) { Microsoft.Xna.Framework.Color color6 = new Microsoft.Xna.Framework.Color((int) sbyte.MaxValue - n.alpha, (int) sbyte.MaxValue - n.alpha, (int) sbyte.MaxValue - n.alpha, 0).MultiplyRGBA(secondColor); for (int index = 0; index < num65; ++index) { Microsoft.Xna.Framework.Color newColor5 = color6; Microsoft.Xna.Framework.Color color7 = n.GetAlpha(newColor5) * (1f - num66); Vector2 position3 = n.Center + ((float) ((double) index / (double) num65 * 6.28318548202515) + n.rotation + num68).ToRotationVector2() * (float) (4.0 * (double) num66 + 2.0) - Main.screenPosition - new Vector2((float) texture.Width, (float) (texture.Height / Main.npcFrameCount[type])) * n.scale / 2f + (vector2_3 * n.scale + new Vector2(0.0f, addY + addHeight + n.gfxOffY)); Main.spriteBatch.Draw(Main.glowMaskTexture[224], position3, new Microsoft.Xna.Framework.Rectangle?(n.frame), color7, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } Main.spriteBatch.Draw(Main.glowMaskTexture[224], position1, new Microsoft.Xna.Framework.Rectangle?(n.frame), color6, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); float t = n.localAI[0]; if ((double) t > 0.0) { Microsoft.Xna.Framework.Color color8 = new Microsoft.Xna.Framework.Color(180, 90, (int) byte.MaxValue, (int) (byte) ((Math.Cos((double) t * 6.28318548202515 / 60.0) * 0.5 + 0.5) * 32.0 + 0.0)) * 0.75f; float num71 = 1f; if ((double) t < 60.0) { float num72 = Utils.InverseLerp(0.0f, 60f, t); color8 *= num72; num71 = MathHelper.Lerp(1f, 0.5f, (float) (1.0 - (double) num72 * (double) num72)); } Texture2D texture2D = Main.extraTexture[89]; Vector2 origin = texture2D.Size() / 2f; Vector2 scale3 = new Vector2(num71); float num73 = t * ((float) Math.PI / 750f); float num74 = 1.570796f; scale3.Y *= 1f; scale3.X *= 1f; for (float num75 = 0.0f; (double) num75 < 16.0; ++num75) { float f = num73 + (float) (6.28318548202515 * ((double) num75 / 16.0)); Vector2 position4 = n.Center - Main.screenPosition + f.ToRotationVector2() * 400f * num71; Main.spriteBatch.Draw(texture2D, position4, new Microsoft.Xna.Framework.Rectangle?(), color8, f + 1.570796f + num74, origin, scale3, SpriteEffects.None, 0.0f); } } } if (type == 546) Main.spriteBatch.Draw(Main.extraTexture[76], position1, new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 200), MathHelper.Clamp(n.velocity.X * 0.1f, -0.3926991f, 0.3926991f), vector2_3, n.scale, spriteEffects, 0.0f); if (type != 566 && type != 567 || (double) n.localAI[3] < 115.0) return; int frameY = (int) ((double) Main.GlobalTime % 0.5 / 0.5 * 4.0); Texture2D texture2D1 = Main.extraTexture[80]; Microsoft.Xna.Framework.Rectangle r = texture2D1.Frame(verticalFrames: 4, frameY: frameY); Vector2 vector2_4 = new Vector2((float) (n.spriteDirection * 8), -26f) * n.scale; int num76 = n.frame.Y / n.frame.Height; int num77 = 0; switch (num76) { case 0: num77 = 6; break; case 1: num77 = 4; break; case 2: num77 = 2; break; case 3: num77 = 6; break; case 4: num77 = 8; break; case 5: num77 = 6; break; case 6: num77 = 4; break; case 7: num77 = 6; break; case 8: num77 = 2; break; } Microsoft.Xna.Framework.Color color9 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 130); vector2_4.Y += (float) num77; Main.spriteBatch.Draw(texture2D1, position1 + vector2_4 * n.scale, new Microsoft.Xna.Framework.Rectangle?(r), color9, MathHelper.Clamp(n.velocity.X * 0.1f, -0.3926991f, 0.3926991f), r.Size() / 2f, n.scale * 0.7f, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); } else if (type == 551) { Texture2D texture = Main.npcTexture[type]; Vector2 position5 = n.Center - Main.screenPosition; Microsoft.Xna.Framework.Rectangle frame = n.frame; Vector2 vector2_5 = frame.Size() / 2f; SpriteEffects effects = spriteEffects ^ SpriteEffects.FlipHorizontally; float rotation1 = n.rotation; Microsoft.Xna.Framework.Color color10 = color1; Microsoft.Xna.Framework.Color color11 = Microsoft.Xna.Framework.Color.Lerp(color10, Microsoft.Xna.Framework.Color.White, 0.6f); color11.A = (byte) 66; Vector2 vector2_6 = new Vector2(171f, 44f); Vector2 vector2_7 = new Vector2(230f, 52f); Vector2 origin1 = Vector2.Lerp(vector2_6, vector2_7, 0.5f) + new Vector2(-50f, 30f); int num78 = (int) n.localAI[0] / 4; Vector2 spinningpoint1 = vector2_6 - origin1; Vector2 spinningpoint2 = vector2_7 - origin1; Texture2D texture2D2 = Main.extraTexture[82]; if (effects.HasFlag((Enum) SpriteEffects.FlipHorizontally)) spinningpoint2.X *= -1f; Microsoft.Xna.Framework.Rectangle rectangle1 = texture2D2.Frame(2, 5, num78 / 5, num78 % 5); Vector2 origin2 = new Vector2(16f, 176f); if (effects.HasFlag((Enum) SpriteEffects.FlipHorizontally)) origin2.X = (float) rectangle1.Width - origin2.X; if (effects.HasFlag((Enum) SpriteEffects.FlipHorizontally)) origin1.X = (float) frame.Width - origin1.X; Texture2D texture2D3 = Main.extraTexture[81]; if (effects.HasFlag((Enum) SpriteEffects.FlipHorizontally)) spinningpoint1.X *= -1f; Microsoft.Xna.Framework.Rectangle rectangle2 = texture2D3.Frame(2, 5, num78 / 5, num78 % 5); Vector2 origin3 = new Vector2(215f, 170f); if (effects.HasFlag((Enum) SpriteEffects.FlipHorizontally)) origin3.X = (float) rectangle2.Width - origin3.X; if ((double) Utils.InverseLerp(0.0f, 30f, n.localAI[1], true) == 1.0) Utils.InverseLerp(60f, 30f, n.localAI[1], true); float num79 = 2f; Vector2 vector2_8 = n.Size / 2f - Main.screenPosition; int num80 = -3; int num81 = 0; byte num82 = 2; for (int index = 9; index > num81; index += num80) { Vector2 position6 = n.oldPos[index] + vector2_8; float rotation2 = n.oldRot[index]; Microsoft.Xna.Framework.Color color12 = color10 * (float) (1.0 - (double) index / 10.0) * 0.35f; color12.A /= num82; Main.spriteBatch.Draw(texture2D2, position6 + spinningpoint2.RotatedBy((double) rotation2), new Microsoft.Xna.Framework.Rectangle?(rectangle1), color12, rotation2, origin2, 1f, effects, 0.0f); Main.spriteBatch.Draw(texture, position6, new Microsoft.Xna.Framework.Rectangle?(frame), color12, rotation2, origin1, 1f, effects, 0.0f); Main.spriteBatch.Draw(texture2D3, position6 + spinningpoint1.RotatedBy((double) rotation2), new Microsoft.Xna.Framework.Rectangle?(rectangle2), color12, rotation2, origin3, 1f, effects, 0.0f); } Main.spriteBatch.Draw(texture2D2, position5 + spinningpoint2.RotatedBy((double) rotation1), new Microsoft.Xna.Framework.Rectangle?(rectangle1), color10, rotation1, origin2, 1f, effects, 0.0f); Main.spriteBatch.Draw(texture, position5, new Microsoft.Xna.Framework.Rectangle?(frame), color10, rotation1, origin1, 1f, effects, 0.0f); Main.spriteBatch.Draw(Main.glowMaskTexture[226], position5, new Microsoft.Xna.Framework.Rectangle?(frame), color11 * (float) (0.699999988079071 + 0.300000011920929 * (double) num79), rotation1, origin1, 1f, effects, 0.0f); Main.spriteBatch.Draw(texture2D3, position5 + spinningpoint1.RotatedBy((double) rotation1), new Microsoft.Xna.Framework.Rectangle?(rectangle2), color10, rotation1, origin3, 1f, effects, 0.0f); } else if (type == 576 || type == 577) { Texture2D texture2D = Main.npcTexture[type]; Vector2 position7 = n.Bottom - Main.screenPosition; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(5, 10, n.frame.Y / 10, n.frame.Y % 10); Vector2 origin = r.Size() * new Vector2(0.5f, 1f); origin.Y -= 4f; int num83 = 94; origin.X = n.spriteDirection != 1 ? (float) (r.Width - num83) : (float) num83; Microsoft.Xna.Framework.Color color13 = Microsoft.Xna.Framework.Color.White; float amount3 = 0.0f; float amount4 = 0.0f; int num84 = 0; float num85 = 0.0f; Microsoft.Xna.Framework.Color newColor6 = color1; if ((double) n.localAI[3] < 60.0) { float num86 = n.localAI[3] / 60f; num84 = 3; num85 = (float) (1.0 - (double) num86 * (double) num86); color13 = new Microsoft.Xna.Framework.Color((int) sbyte.MaxValue, 0, (int) byte.MaxValue, 0); amount4 = 1f; newColor6 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, newColor6, num86 * num86); } for (int index = 0; index < num84; ++index) { Microsoft.Xna.Framework.Color newColor7 = Microsoft.Xna.Framework.Color.Lerp(color1, color13, amount3); Microsoft.Xna.Framework.Color color14 = Microsoft.Xna.Framework.Color.Lerp(n.GetAlpha(newColor7), color13, amount4) * (1f - num85); Vector2 position8 = position7 - new Vector2((float) texture2D.Width, (float) (texture2D.Height / Main.npcFrameCount[type])) * n.scale / 2f + (vector2_3 * n.scale + new Vector2(0.0f, addY + addHeight + n.gfxOffY)); Main.spriteBatch.Draw(texture2D, position8, new Microsoft.Xna.Framework.Rectangle?(r), color14, n.rotation, origin, n.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); } Main.spriteBatch.Draw(texture2D, position7, new Microsoft.Xna.Framework.Rectangle?(r), n.GetAlpha(newColor6), n.rotation, origin, n.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); } else if (type == 564 || type == 565) { Texture2D texture2D = Main.npcTexture[type]; Vector2 position9 = n.Bottom - Main.screenPosition; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(5, 9, n.frame.Y / 9, n.frame.Y % 9); Vector2 origin = r.Size() * new Vector2(0.5f, 1f); origin.Y -= 10f; int num87 = 52; origin.X = n.spriteDirection != 1 ? (float) (r.Width - num87) : (float) num87; Microsoft.Xna.Framework.Color color15 = Microsoft.Xna.Framework.Color.White; float amount5 = 0.0f; float amount6 = 0.0f; int num88 = 0; float num89 = 0.0f; float num90 = 0.0f; Microsoft.Xna.Framework.Color newColor8 = color1; if ((double) n.localAI[3] < 60.0) { float num91 = n.localAI[3] / 60f; num88 = 3; num89 = (float) (1.0 - (double) num91 * (double) num91); num90 = 8f; color15 = new Microsoft.Xna.Framework.Color((int) sbyte.MaxValue, 0, (int) byte.MaxValue, 0); amount6 = 1f; newColor8 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, newColor8, num91 * num91); } for (int index = 0; index < num88; ++index) { Microsoft.Xna.Framework.Color newColor9 = Microsoft.Xna.Framework.Color.Lerp(color1, color15, amount5); Microsoft.Xna.Framework.Color color16 = Microsoft.Xna.Framework.Color.Lerp(n.GetAlpha(newColor9), color15, amount6) * (1f - num89); Vector2 position10 = position9 - new Vector2((float) texture2D.Width, (float) (texture2D.Height / Main.npcFrameCount[type])) * n.scale / 2f + (vector2_3 * n.scale + new Vector2(0.0f, addY + addHeight + n.gfxOffY)) + ((float) ((double) index / (double) num88 * 6.28318548202515)).ToRotationVector2() * num90 * num89; Main.spriteBatch.Draw(texture2D, position10, new Microsoft.Xna.Framework.Rectangle?(r), color16, n.rotation, origin, n.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); } Microsoft.Xna.Framework.Color alpha = n.GetAlpha(newColor8); int num92 = 4; float num93 = 4f; float num94 = (float) (0.625 + Math.Sin((double) Main.GlobalTime * 6.28318548202515 * 0.75 + 3.14159274101257) * 0.125); for (int index = 0; index < num92; ++index) { Microsoft.Xna.Framework.Color color17 = alpha * (1f - num94); Vector2 position11 = position9 - new Vector2((float) texture2D.Width, (float) (texture2D.Height / Main.npcFrameCount[type])) * n.scale / 2f + (vector2_3 * n.scale + new Vector2(0.0f, addY + addHeight + n.gfxOffY)) + ((float) ((double) index / (double) num92 * 6.28318548202515)).ToRotationVector2() * num93 * num94; Main.spriteBatch.Draw(texture2D, position11, new Microsoft.Xna.Framework.Rectangle?(r), color17, n.rotation, origin, n.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); } Main.spriteBatch.Draw(texture2D, position9, new Microsoft.Xna.Framework.Rectangle?(r), alpha, n.rotation, origin, n.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); if ((double) n.Opacity <= 0.0) return; Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; white.A /= (byte) 2; Microsoft.Xna.Framework.Color color18 = white * n.Opacity; Main.spriteBatch.Draw(Main.glowMaskTexture[225], position9, new Microsoft.Xna.Framework.Rectangle?(r), color18, n.rotation, origin, n.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); int num95 = 4; float num96 = 4f; float num97 = (float) (0.5 + Math.Sin((double) Main.GlobalTime * 6.28318548202515 * 0.75) * 0.5); for (int index = 0; index < num95; ++index) { Microsoft.Xna.Framework.Color color19 = color18 * 0.35f * (1f - num97); Vector2 position12 = position9 - new Vector2((float) texture2D.Width, (float) (texture2D.Height / Main.npcFrameCount[type])) * n.scale / 2f + (vector2_3 * n.scale + new Vector2(0.0f, addY + addHeight + n.gfxOffY)) + ((float) ((double) index / (double) num95 * 6.28318548202515)).ToRotationVector2() * num96 * num97; Main.spriteBatch.Draw(Main.glowMaskTexture[225], position12, new Microsoft.Xna.Framework.Rectangle?(r), color19, n.rotation, origin, n.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); } } else if (type == 548) { Texture2D texture2D4 = Main.npcTexture[type]; Vector2 position13 = n.Bottom - Main.screenPosition; Microsoft.Xna.Framework.Rectangle r3 = texture2D4.Frame(); Vector2 origin = r3.Size() / 2f; origin.Y += 30f; origin.Y += 8f; --origin.X; Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; float amount7 = 0.0f; float amount8 = 0.0f; int num98 = 0; float num99 = 0.0f; float num100 = 0.0f; Microsoft.Xna.Framework.Color newColor10 = color1; for (int index = 0; index < num98; ++index) { Microsoft.Xna.Framework.Color newColor11 = Microsoft.Xna.Framework.Color.Lerp(color1, white, amount7); Microsoft.Xna.Framework.Color color20 = Microsoft.Xna.Framework.Color.Lerp(n.GetAlpha(newColor11), white, amount8) * (1f - num99); Vector2 position14 = position13 - new Vector2((float) texture2D4.Width, (float) (texture2D4.Height / Main.npcFrameCount[type])) * n.scale / 2f + (vector2_3 * n.scale + new Vector2(0.0f, addY + addHeight + n.gfxOffY)) + ((float) ((double) index / (double) num98 * 6.28318548202515)).ToRotationVector2() * num100 * num99; Main.spriteBatch.Draw(texture2D4, position14, new Microsoft.Xna.Framework.Rectangle?(r3), color20, n.rotation, origin, n.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); } Microsoft.Xna.Framework.Color alpha = n.GetAlpha(newColor10); int num101 = 4; float num102 = 4f; float num103 = (float) (0.625 + Math.Sin((double) Main.GlobalTime * 6.28318548202515 * 0.75 + 3.14159274101257) * 0.125); for (int index = 0; index < num101; ++index) { Microsoft.Xna.Framework.Color color21 = alpha; color21.A = (byte) 0; color21 *= 1f - num103; Vector2 position15 = position13 - new Vector2((float) texture2D4.Width, (float) (texture2D4.Height / Main.npcFrameCount[type])) * n.scale / 2f + (vector2_3 * n.scale + new Vector2(0.0f, addY + addHeight + n.gfxOffY)) + ((float) ((double) index / (double) num101 * 6.28318548202515)).ToRotationVector2() * num102 * num103; Main.spriteBatch.Draw(texture2D4, position15, new Microsoft.Xna.Framework.Rectangle?(r3), color21, n.rotation, origin, n.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); } Main.spriteBatch.Draw(texture2D4, position13, new Microsoft.Xna.Framework.Rectangle?(r3), alpha, n.rotation, origin, n.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); if ((double) n.ai[1] == 2.0) { float num104 = Math.Min(1f, n.ai[0] / 120f); Main.spriteBatch.Draw(texture2D4, position13, new Microsoft.Xna.Framework.Rectangle?(r3), new Microsoft.Xna.Framework.Color(1f, 1f, 1f, 0.0f) * num104, n.rotation, origin, n.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); float progress = MathHelper.Clamp(n.ai[0] / 450f, 0.0f, 1f); if (!Filters.Scene["CrystalWin"].IsActive()) Filters.Scene.Activate("CrystalWin", n.Center); else Filters.Scene["CrystalWin"].GetShader().UseProgress(progress); Filters.Scene["CrystalWin"].GetShader().UseTargetPosition(n.Center); } int num105 = 4; float num106 = 4f; float num107 = (float) (0.625 + Math.Sin((double) Main.GlobalTime * 6.28318548202515 * 0.75) * 0.125); for (int index = 0; index < num105; ++index) { Microsoft.Xna.Framework.Color color22 = alpha; color22.A = (byte) 0; color22 *= 0.3f; color22 *= 1f - num107; Vector2 position16 = position13 - new Vector2((float) texture2D4.Width, (float) (texture2D4.Height / Main.npcFrameCount[type])) * n.scale / 2f + (vector2_3 * n.scale + new Vector2(0.0f, addY + addHeight + n.gfxOffY)) + ((float) ((double) index / (double) num105 * 6.28318548202515)).ToRotationVector2() * num106 * num107; Main.spriteBatch.Draw(texture2D4, position16, new Microsoft.Xna.Framework.Rectangle?(r3), color22, n.rotation, origin, n.scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); } if (n.alpha >= (int) byte.MaxValue) return; float num108 = (float) ((double) Main.GlobalTime % 3.0 / 3.0); float num109 = num108; if ((double) num109 > 0.5) num109 = 1f - num108; if ((double) num109 < 0.0) num109 = 0.0f; float num110 = (float) (((double) num108 + 0.5) % 1.0); float num111 = num110; if ((double) num111 > 0.5) num111 = 1f - num110; if ((double) num111 < 0.0) num111 = 0.0f; Texture2D texture2D5 = Main.glowMaskTexture[239]; Microsoft.Xna.Framework.Rectangle r4 = texture2D5.Frame(); origin = r4.Size() / 2f; Vector2 position17 = position13 + new Vector2(0.0f, -40f); Microsoft.Xna.Framework.Color color23 = new Microsoft.Xna.Framework.Color(140, 50, (int) byte.MaxValue, 0) * 0.6f; Main.spriteBatch.Draw(texture2D5, position17, new Microsoft.Xna.Framework.Rectangle?(r4), color23, n.rotation, origin, n.scale * 0.75f, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); float num112 = 1f + num108 * 0.75f; Main.spriteBatch.Draw(texture2D5, position17, new Microsoft.Xna.Framework.Rectangle?(r4), color23 * num109, n.rotation, origin, n.scale * 0.75f * num112, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); float num113 = 1f + num110 * 0.75f; Main.spriteBatch.Draw(texture2D5, position17, new Microsoft.Xna.Framework.Rectangle?(r4), color23 * num111, n.rotation, origin, n.scale * 0.75f * num113, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); Texture2D texture2D6 = Main.extraTexture[89]; Microsoft.Xna.Framework.Rectangle r5 = texture2D6.Frame(); origin = r5.Size() / 2f; Vector2 scale = new Vector2(0.75f, 1f + num113) * 1.5f; float num114 = 1f + num110 * 0.75f; if (n.dontTakeDamageFromHostiles) scale.Y *= 0.6f; position17.Y -= 6f; Main.spriteBatch.Draw(texture2D6, position17, new Microsoft.Xna.Framework.Rectangle?(r5), color23 * num111, n.rotation + 1.570796f, origin, scale, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); Main.spriteBatch.Draw(texture2D6, position17, new Microsoft.Xna.Framework.Rectangle?(r5), Microsoft.Xna.Framework.Color.Lerp(color23, Microsoft.Xna.Framework.Color.White, 0.5f), n.rotation + 1.570796f, origin, 1.5f, spriteEffects ^ SpriteEffects.FlipHorizontally, 0.0f); } else if (type == 371 || type >= 454 && type <= 459) { Texture2D texture = Main.npcTexture[type]; Vector2 position = n.Center - Main.screenPosition - new Vector2((float) texture.Width, (float) (texture.Height / Main.npcFrameCount[type])) * n.scale / 2f + (vector2_3 * n.scale + new Vector2(0.0f, addY + addHeight + n.gfxOffY)); Main.spriteBatch.Draw(texture, position, new Microsoft.Xna.Framework.Rectangle?(n.frame), n.GetAlpha(color1), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } else if (type == 549) { Texture2D texture = Main.npcTexture[type]; Vector2 position = n.Center - Main.screenPosition; Microsoft.Xna.Framework.Rectangle frame = n.frame; Vector2 origin = new Vector2(70f, (float) sbyte.MaxValue); origin.Y += 8f; Vector2 scale4 = new Vector2(n.scale); float t1 = n.localAI[0]; if ((double) t1 < 120.0) scale4 *= (float) ((double) t1 / 240.0 + 0.5); Microsoft.Xna.Framework.Color alpha = n.GetAlpha(color1); float amount9 = Utils.InverseLerp(0.0f, 120f, t1, true); float num115 = MathHelper.Lerp(32f, 0.0f, amount9); Microsoft.Xna.Framework.Color color24 = alpha; color24.A = (byte) MathHelper.Lerp((float) color24.A, 0.0f, amount9); Microsoft.Xna.Framework.Color color25 = color24 * amount9; if ((double) t1 >= 120.0) color25 = alpha; Main.spriteBatch.Draw(texture, position, new Microsoft.Xna.Framework.Rectangle?(frame), color25, n.rotation, origin, scale4, spriteEffects, 0.0f); float y = ((float) ((((double) n.ai[0] + 54.0) % 180.0 - 120.0) / 180.0 * 2.0 * 6.28318548202515)).ToRotationVector2().Y; if ((double) t1 >= 120.0) { num115 = y * 0.0f; color25.A = (byte) ((double) color25.A * 0.5); color25 *= (float) ((double) y / 2.0 + 0.5); float num116 = 1f; for (float num117 = 0.0f; (double) num117 < (double) num116; ++num117) Main.spriteBatch.Draw(texture, position + (6.283185f / num116 * num117).ToRotationVector2() * num115, new Microsoft.Xna.Framework.Rectangle?(frame), color25, n.rotation, origin, scale4, spriteEffects, 0.0f); } float t2 = (float) ((double) n.ai[0] / 180.0 - 0.759999990463257); if ((double) t2 < 0.0) ++t2; float amount10 = 0.0f; float scale5 = 0.0f; float from1 = 0.6f; float to1 = 0.8f; if ((double) t2 >= (double) from1 && (double) t2 <= (double) to1) { amount10 = Utils.InverseLerp(from1, to1, t2); scale5 = MathHelper.Lerp(0.75f, 0.85f, amount10); } float from2 = to1; float to2 = from2 + 0.13f; if ((double) t2 >= (double) from2 && (double) t2 <= (double) to2) { amount10 = 1f - Utils.InverseLerp(from2, to2, t2); scale5 = MathHelper.Lerp(1.3f, 0.85f, amount10); } Vector2 vector2_9 = new Vector2(0.0f, -150f); int frameNumber = frame.Y / frame.Height; float num118 = MathHelper.Clamp((float) (((double) t1 - 100.0) / 40.0), 0.0f, 1f); this.DrawElderEye(Main.spriteBatch, n.Center + vector2_9, 0.75f * num118, 0.75f, frameNumber, Microsoft.Xna.Framework.Color.White); this.DrawElderEye(Main.spriteBatch, n.Center + vector2_9, 0.75f * num118, 0.75f, frameNumber, new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue) * (float) ((double) y / 2.0 + 0.5)); if ((double) amount10 > 0.0 && (double) scale5 > 0.0) this.DrawElderEye(Main.spriteBatch, n.Center + vector2_9, amount10 * 0.5f, scale5, frameNumber, new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue)); if ((double) t1 >= 120.0) return; float num119 = (float) (6.28318548202515 * (double) amount9 * Math.Pow((double) amount9, 2.0) * 2.0) + amount9; color25.A = (byte) ((double) alpha.A * Math.Pow((double) amount9, 2.0) * 0.5); float num120 = 3f; for (float num121 = 0.0f; (double) num121 < (double) num120; ++num121) Main.spriteBatch.Draw(texture, position + (num119 + 6.283185f / num120 * num121).ToRotationVector2() * num115, new Microsoft.Xna.Framework.Rectangle?(frame), color25, n.rotation, origin, scale4, spriteEffects, 0.0f); } else if (type == 493 || type == 507 || type == 422 || type == 517) { Texture2D texture1 = Main.npcTexture[type]; Vector2 vector2_10 = n.Center - Main.screenPosition; Vector2 vector2_11 = vector2_10 - new Vector2(300f, 310f); Vector2 position = vector2_10 - new Vector2((float) texture1.Width, (float) (texture1.Height / Main.npcFrameCount[type])) * n.scale / 2f + (vector2_3 * n.scale + new Vector2(0.0f, addY + addHeight + n.gfxOffY)); Main.spriteBatch.Draw(texture1, position, new Microsoft.Xna.Framework.Rectangle?(n.frame), n.GetAlpha(color1), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); switch (type) { case 422: Texture2D texture2 = Main.glowMaskTexture[149]; float num122 = (float) (4.0 + (double) (n.GetAlpha(color1).ToVector3() - new Vector3(0.5f)).Length() * 4.0); for (int index = 0; index < 4; ++index) Main.spriteBatch.Draw(texture2, position + n.velocity.RotatedBy((double) index * 1.57079637050629) * num122, new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(64, 64, 64, 0) * n.Opacity, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 493: Texture2D texture3 = Main.glowMaskTexture[132]; float num123 = (float) (4.0 + (double) (n.GetAlpha(color1).ToVector3() - new Vector3(0.5f)).Length() * 4.0); for (int index = 0; index < 4; ++index) Main.spriteBatch.Draw(texture3, position + n.velocity.RotatedBy((double) index * 1.57079637050629) * num123, new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(64, 64, 64, 0) * n.Opacity, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 507: Texture2D texture4 = Main.glowMaskTexture[143]; float num124 = (float) (4.0 + (double) (n.GetAlpha(color1).ToVector3() - new Vector3(0.5f)).Length() * 4.0); for (int index = 0; index < 4; ++index) Main.spriteBatch.Draw(texture4, position + n.velocity.RotatedBy((double) index * 1.57079637050629) * num124, new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(64, 64, 64, 0) * n.Opacity, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 517: Texture2D texture5 = Main.glowMaskTexture[162]; float num125 = (float) (2.0 + (double) (n.GetAlpha(color1).ToVector3() - new Vector3(0.5f)).Length() * 9.0); for (int index = 0; index < 4; ++index) Main.spriteBatch.Draw(texture5, position + n.velocity.RotatedBy((double) index * 1.57079637050629) * num125 + Vector2.UnitX * 2f, new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(64, 64, 64, 0) * n.Opacity, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; } int num126 = 0; string key = ""; if (type <= 493) { if (type != 422) { if (type == 493) { num126 = NPC.ShieldStrengthTowerStardust; key = "Stardust"; } } else { num126 = NPC.ShieldStrengthTowerVortex; key = "Vortex"; } } else if (type != 507) { if (type == 517) { num126 = NPC.ShieldStrengthTowerSolar; key = "Solar"; } } else { num126 = NPC.ShieldStrengthTowerNebula; key = "Nebula"; } float num127 = (float) num126 / (float) NPC.ShieldStrengthTowerMax; if (num126 > 0) { Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.Default, RasterizerState.CullNone, (Effect) null, Main.GameViewMatrix.ZoomMatrix); float num128 = 0.0f; if ((double) n.ai[3] > 0.0 && (double) n.ai[3] <= 30.0) num128 = (float) (1.0 - (double) n.ai[3] / 30.0); Filters.Scene[key].GetShader().UseIntensity(1f + num128).UseProgress(0.0f); DrawData drawData = new DrawData(TextureManager.Load("Images/Misc/Perlin"), vector2_11 + 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) num127 * 0.800000011920929 + 0.200000002980232), n.rotation, new Vector2(300f, 300f), n.scale * (float) (1.0 + (double) num128 * 0.0500000007450581), spriteEffects, 0); GameShaders.Misc["ForceField"].UseColor(new Vector3((float) (1.0 + (double) num128 * 0.5))); GameShaders.Misc["ForceField"].Apply(new DrawData?(drawData)); drawData.Draw(Main.spriteBatch); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, this.Rasterizer, (Effect) null, Main.Transform); } else if ((double) n.ai[3] > 0.0) { Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointWrap, DepthStencilState.Default, RasterizerState.CullNone, (Effect) null, Main.GameViewMatrix.ZoomMatrix); float progress = n.ai[3] / 120f; float num129 = Math.Min(n.ai[3] / 30f, 1f); Filters.Scene[key].GetShader().UseIntensity(Math.Min(5f, 15f * progress) + 1f).UseProgress(progress); DrawData drawData = new DrawData(TextureManager.Load("Images/Misc/Perlin"), vector2_11 + 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) num129))), n.rotation, new Vector2(300f, 300f), n.scale * (1f + num129), spriteEffects, 0); GameShaders.Misc["ForceField"].UseColor(new Vector3(2f)); GameShaders.Misc["ForceField"].Apply(new DrawData?(drawData)); drawData.Draw(Main.spriteBatch); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, this.Rasterizer, (Effect) null, Main.Transform); } else Filters.Scene[key].GetShader().UseIntensity(0.0f).UseProgress(0.0f); } else { switch (type) { case 402: this.LoadNPC(403); this.LoadNPC(404); NPC npc1 = n; Texture2D texture2D7 = Main.npcTexture[npc1.type]; Vector2 position18 = npc1.Center - Main.screenPosition - new Vector2((float) texture2D7.Width, (float) (texture2D7.Height / Main.npcFrameCount[npc1.type])) * npc1.scale / 2f + (vector2_3 * npc1.scale + new Vector2(0.0f, addY + addHeight + npc1.gfxOffY)); int num130 = 0; float num131 = (float) (2.0 / (double) npc1.oldPos.Length * 0.699999988079071); for (int index = npc1.oldPos.Length - 1; (double) index >= 1.0; index -= 2) { Texture2D texture6 = num130 != 0 ? Main.npcTexture[403] : Main.npcTexture[404]; Main.spriteBatch.Draw(texture6, position18 + npc1.oldPos[index] - npc1.position, new Microsoft.Xna.Framework.Rectangle?(), npc1.GetAlpha(color1) * (float) (0.800000011920929 - (double) num131 * (double) index / 2.0), npc1.oldRot[index], vector2_3, npc1.scale, spriteEffects, 0.0f); Texture2D texture7 = num130 != 0 ? Main.glowMaskTexture[133] : Main.glowMaskTexture[134]; Main.spriteBatch.Draw(texture7, position18 + 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) num131 * (double) index / 2.0), npc1.oldRot[index], vector2_3, npc1.scale, spriteEffects, 0.0f); ++num130; } Texture2D texture8 = Main.npcTexture[npc1.type]; Main.spriteBatch.Draw(texture8, position18, new Microsoft.Xna.Framework.Rectangle?(n.frame), n.GetAlpha(color1), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); Texture2D texture9 = Main.glowMaskTexture[135]; Main.spriteBatch.Draw(texture9, position18, new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 488: break; case 519: NPC npc2 = n; Texture2D texture2D8 = Main.npcTexture[npc2.type]; Vector2 position19 = npc2.Center - Main.screenPosition - new Vector2((float) texture2D8.Width, (float) (texture2D8.Height / Main.npcFrameCount[npc2.type])) * npc2.scale / 2f + (vector2_3 * npc2.scale + new Vector2(0.0f, addY + addHeight + npc2.gfxOffY)); Texture2D texture10 = Main.npcTexture[npc2.type]; Main.spriteBatch.Draw(texture10, position19, new Microsoft.Xna.Framework.Rectangle?(n.frame), n.GetAlpha(color1), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); int num132 = 0; float num133 = (float) (1.0 / (double) npc2.oldPos.Length * 0.699999988079071); for (int index = npc2.oldPos.Length - 1; (double) index >= 0.0; --index) { float amount = (float) (npc2.oldPos.Length - index) / (float) npc2.oldPos.Length; Microsoft.Xna.Framework.Color color26 = Microsoft.Xna.Framework.Color.Pink * (float) (1.0 - (double) num133 * (double) index / 1.0); color26.A = (byte) ((double) color26.A * (1.0 - (double) amount)); Main.spriteBatch.Draw(texture10, position19 + npc2.oldPos[index] - npc2.position, new Microsoft.Xna.Framework.Rectangle?(), color26, npc2.oldRot[index], vector2_3, npc2.scale * MathHelper.Lerp(0.3f, 1.1f, amount), spriteEffects, 0.0f); ++num132; } break; case 522: NPC npc3 = n; Texture2D texture11 = Main.npcTexture[npc3.type]; Vector2 position20 = npc3.Center - Main.screenPosition - new Vector2((float) texture11.Width, (float) (texture11.Height / Main.npcFrameCount[npc3.type])) * npc3.scale / 2f + (vector2_3 * npc3.scale + new Vector2(0.0f, addY + addHeight + npc3.gfxOffY)); int num134 = 0; float num135 = (float) (1.0 / (double) npc3.oldPos.Length * 1.10000002384186); for (int index = npc3.oldPos.Length - 1; (double) index >= 0.0; --index) { float amount = (float) (npc3.oldPos.Length - index) / (float) npc3.oldPos.Length; Microsoft.Xna.Framework.Color color27 = Microsoft.Xna.Framework.Color.White * (float) (1.0 - (double) num135 * (double) index / 1.0); color27.A = (byte) ((double) color27.A * (1.0 - (double) amount)); Main.spriteBatch.Draw(texture11, position20 + npc3.oldPos[index] - npc3.position, new Microsoft.Xna.Framework.Rectangle?(), color27, npc3.oldRot[index], vector2_3, npc3.scale * MathHelper.Lerp(0.8f, 0.3f, amount), spriteEffects, 0.0f); ++num134; } Texture2D texture2D9 = Main.extraTexture[57]; Main.spriteBatch.Draw(texture2D9, position20, new Microsoft.Xna.Framework.Rectangle?(), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), 0.0f, texture2D9.Size() / 2f, n.scale, spriteEffects, 0.0f); break; default: if (type == 370 || type == 372 || type == 373) { Texture2D texture12 = Main.npcTexture[type]; Microsoft.Xna.Framework.Color color28 = Microsoft.Xna.Framework.Color.White; float amount11 = 0.0f; bool flag = type == 370 && (double) n.ai[0] > 4.0; int num136 = type != 370 ? 0 : ((double) n.ai[0] > 9.0 ? 1 : 0); int num137 = 120; int num138 = 60; Microsoft.Xna.Framework.Color color29 = color1; if (num136 != 0) color1 = Main.buffColor(color1, 0.4f, 0.8f, 0.4f, 1f); else if (flag) color1 = Main.buffColor(color1, 0.5f, 0.7f, 0.5f, 1f); else if (type == 370 && (double) n.ai[0] == 4.0 && (double) n.ai[2] > (double) num137) { float num139 = (n.ai[2] - (float) num137) / (float) num138; color1 = Main.buffColor(color1, (float) (1.0 - 0.5 * (double) num139), (float) (1.0 - 0.300000011920929 * (double) num139), (float) (1.0 - 0.5 * (double) num139), 1f); } int num140 = 10; int num141 = 2; if (type == 370) { if ((double) n.ai[0] == -1.0) num140 = 0; if ((double) n.ai[0] == 0.0 || (double) n.ai[0] == 5.0 || (double) n.ai[0] == 10.0) num140 = 7; if ((double) n.ai[0] == 1.0) { color28 = Microsoft.Xna.Framework.Color.Blue; amount11 = 0.5f; } else color29 = color1; } else if ((type == 372 || type == 373) && (double) n.ai[0] == 1.0) { color28 = Microsoft.Xna.Framework.Color.Blue; amount11 = 0.5f; } for (int index = 1; index < num140; index += num141) { ref Vector2 local = ref n.oldPos[index]; Microsoft.Xna.Framework.Color newColor = Microsoft.Xna.Framework.Color.Lerp(color29, color28, amount11); Microsoft.Xna.Framework.Color color30 = n.GetAlpha(newColor) * ((float) (num140 - index) / 15f); Vector2 position21 = n.oldPos[index] + new Vector2((float) n.width, (float) n.height) / 2f - Main.screenPosition - new Vector2((float) texture12.Width, (float) (texture12.Height / Main.npcFrameCount[type])) * n.scale / 2f + (vector2_3 * n.scale + new Vector2(0.0f, addY + addHeight + n.gfxOffY)); Main.spriteBatch.Draw(texture12, position21, new Microsoft.Xna.Framework.Rectangle?(n.frame), color30, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } int num142 = 0; float num143 = 0.0f; float num144 = 0.0f; if (type == 370) { if ((double) n.ai[0] == -1.0) num142 = 0; if ((double) n.ai[0] == 3.0 || (double) n.ai[0] == 8.0) { int num145 = 60; int num146 = 30; if ((double) n.ai[2] > (double) num145) { num142 = 6; num143 = (1f - (float) Math.Cos(((double) n.ai[2] - (double) num145) / (double) num146 * 6.28318548202515)) / 3f; num144 = 40f; } } if ((double) n.ai[0] == 4.0 && (double) n.ai[2] > (double) num137) { num142 = 6; num143 = (1f - (float) Math.Cos(((double) n.ai[2] - (double) num137) / (double) num138 * 6.28318548202515)) / 3f; num144 = 60f; } if ((double) n.ai[0] == 9.0 && (double) n.ai[2] > (double) num137) { num142 = 6; num143 = (1f - (float) Math.Cos(((double) n.ai[2] - (double) num137) / (double) num138 * 6.28318548202515)) / 3f; num144 = 60f; } if ((double) n.ai[0] == 12.0) { num142 = 6; num143 = (1f - (float) Math.Cos((double) n.ai[2] / 30.0 * 6.28318548202515)) / 3f; num144 = 20f; } } for (int index = 0; index < num142; ++index) { Microsoft.Xna.Framework.Color newColor = Microsoft.Xna.Framework.Color.Lerp(color1, color28, amount11); Microsoft.Xna.Framework.Color color31 = n.GetAlpha(newColor) * (1f - num143); Vector2 position22 = n.Center + ((float) ((double) index / (double) num142 * 6.28318548202515) + n.rotation).ToRotationVector2() * num144 * num143 - Main.screenPosition - new Vector2((float) texture12.Width, (float) (texture12.Height / Main.npcFrameCount[type])) * n.scale / 2f + (vector2_3 * n.scale + new Vector2(0.0f, addY + addHeight + n.gfxOffY)); Main.spriteBatch.Draw(texture12, position22, new Microsoft.Xna.Framework.Rectangle?(n.frame), color31, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } Vector2 position23 = n.Center - Main.screenPosition - new Vector2((float) texture12.Width, (float) (texture12.Height / Main.npcFrameCount[type])) * n.scale / 2f + (vector2_3 * n.scale + new Vector2(0.0f, addY + addHeight + n.gfxOffY)); Main.spriteBatch.Draw(texture12, position23, new Microsoft.Xna.Framework.Rectangle?(n.frame), n.GetAlpha(color1), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); if (type != 370 || (double) n.ai[0] < 4.0) break; Texture2D dukeFishronTexture = Main.dukeFishronTexture; 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 amount12 = 1f; float num147 = 0.5f; float num148 = 10f; int num149 = 1; if ((double) n.ai[0] == 4.0) { float num150 = (n.ai[2] - (float) num137) / (float) num138; yellow *= num150; color32 *= num150; } if ((double) n.ai[0] == 12.0) { float num151 = n.ai[2] / 30f; if ((double) num151 > 0.5) num151 = 1f - num151; float num152 = 1f - num151 * 2f; yellow *= num152; color32 *= num152; } for (int index = 1; index < num140; index += num149) { ref Vector2 local = ref n.oldPos[index]; Microsoft.Xna.Framework.Color color33 = Microsoft.Xna.Framework.Color.Lerp(color32, yellow, amount12) * ((float) (num140 - index) / 15f); Vector2 position24 = n.oldPos[index] + new Vector2((float) n.width, (float) n.height) / 2f - Main.screenPosition - new Vector2((float) dukeFishronTexture.Width, (float) (dukeFishronTexture.Height / Main.npcFrameCount[type])) * n.scale / 2f + (vector2_3 * n.scale + new Vector2(0.0f, addY + addHeight + n.gfxOffY)); Main.spriteBatch.Draw(dukeFishronTexture, position24, new Microsoft.Xna.Framework.Rectangle?(n.frame), color33, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } for (int index = 1; index < num142; ++index) { Microsoft.Xna.Framework.Color newColor = Microsoft.Xna.Framework.Color.Lerp(color32, yellow, amount12); Microsoft.Xna.Framework.Color color34 = n.GetAlpha(newColor) * (1f - num147); Vector2 position25 = n.Center + ((float) ((double) index / (double) num142 * 6.28318548202515) + n.rotation).ToRotationVector2() * num148 * num147 - Main.screenPosition - new Vector2((float) dukeFishronTexture.Width, (float) (dukeFishronTexture.Height / Main.npcFrameCount[type])) * n.scale / 2f + (vector2_3 * n.scale + new Vector2(0.0f, addY + addHeight + n.gfxOffY)); Main.spriteBatch.Draw(dukeFishronTexture, position25, new Microsoft.Xna.Framework.Rectangle?(n.frame), color34, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } Main.spriteBatch.Draw(dukeFishronTexture, position23, new Microsoft.Xna.Framework.Rectangle?(n.frame), color32, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; } if (type == 439 || type == 440) { int num153 = n.frame.Y / (Main.npcTexture[type].Height / Main.npcFrameCount[type]); Texture2D texture13 = Main.npcTexture[type]; Texture2D texture2D10 = Main.extraTexture[30]; Microsoft.Xna.Framework.Rectangle r = texture2D10.Frame(); r.Height /= 2; if (num153 >= 4) r.Y += r.Height; Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; float amount = 0.0f; Microsoft.Xna.Framework.Color color35 = color1; int num154 = 0; int num155 = 0; int num156 = 0; if ((double) n.ai[0] == -1.0) { if ((double) n.ai[1] >= 320.0 && (double) n.ai[1] < 960.0) { white = Microsoft.Xna.Framework.Color.White; amount = 0.5f; num154 = 6; num155 = 2; num156 = 1; } } else if ((double) n.ai[0] == 1.0) { white = Microsoft.Xna.Framework.Color.White; amount = 0.5f; num154 = 4; num155 = 2; num156 = 1; } else color35 = color1; for (int index = num156; index < num154; index += num155) { ref Vector2 local = ref n.oldPos[index]; Microsoft.Xna.Framework.Color newColor = Microsoft.Xna.Framework.Color.Lerp(color35, white, amount); Microsoft.Xna.Framework.Color color36 = n.GetAlpha(newColor) * ((float) (num154 - index) / (float) num154); color36.A = (byte) 100; Vector2 position26 = n.oldPos[index] + new Vector2((float) n.width, (float) n.height) / 2f - Main.screenPosition - r.Size() * n.scale / 2f + (vector2_3 * n.scale + new Vector2(0.0f, addY + addHeight + n.gfxOffY)); Main.spriteBatch.Draw(texture2D10, position26, new Microsoft.Xna.Framework.Rectangle?(r), color36, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } int num157 = 0; float num158 = 0.0f; float num159 = 0.0f; if ((double) n.ai[0] == 5.0 && (double) n.ai[1] >= 0.0 && (double) n.ai[1] < 30.0) { num157 = 4; num158 = (1f - (float) Math.Cos(((double) n.ai[1] - 0.0) / 30.0 * 3.14159274101257)) / 2f; num159 = 70f; } for (int index = 0; index < num157; ++index) { Microsoft.Xna.Framework.Color newColor = Microsoft.Xna.Framework.Color.Lerp(color1, white, amount); Microsoft.Xna.Framework.Color color37 = n.GetAlpha(newColor) * (1f - num158); Vector2 position27 = n.Center + ((float) ((double) index / (double) num157 * 6.28318548202515) + n.rotation).ToRotationVector2() * num159 * num158 - Main.screenPosition - new Vector2((float) texture13.Width, (float) (texture13.Height / Main.npcFrameCount[type])) * n.scale / 2f + (vector2_3 * n.scale + new Vector2(0.0f, addY + addHeight + n.gfxOffY)); Main.spriteBatch.Draw(texture2D10, position27, new Microsoft.Xna.Framework.Rectangle?(r), color37, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } Vector2 position28 = n.Center - Main.screenPosition - new Vector2((float) texture13.Width, (float) (texture13.Height / Main.npcFrameCount[type])) * n.scale / 2f + (vector2_3 * n.scale + new Vector2(0.0f, addY + addHeight + n.gfxOffY)); Main.spriteBatch.Draw(texture13, position28, new Microsoft.Xna.Framework.Rectangle?(n.frame), n.GetAlpha(color1), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; } if (type == 392 || type == 393 || type == 394 || type == 395) { Texture2D texture14 = Main.npcTexture[type]; Vector2 position29 = (n.Center - Main.screenPosition + Vector2.UnitY * n.gfxOffY).Floor(); float num160 = 0.0f; if (type == 393) num160 = -8f; Main.spriteBatch.Draw(texture14, position29, new Microsoft.Xna.Framework.Rectangle?(n.frame), n.GetAlpha(color1), n.rotation, vector2_3 + Vector2.UnitY * num160, n.scale, spriteEffects, 0.0f); if (type == 392) Main.spriteBatch.Draw(Main.glowMaskTexture[48], position29, new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(200, 200, 200, 0), n.rotation, vector2_3 + Vector2.UnitY * num160, n.scale, spriteEffects, 0.0f); if (type == 395) Main.spriteBatch.Draw(Main.glowMaskTexture[49], position29, new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(200, 200, 200, 0), n.rotation, vector2_3 + Vector2.UnitY * num160, n.scale, spriteEffects, 0.0f); if (type != 394) break; Main.spriteBatch.Draw(Main.glowMaskTexture[50], position29, new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(200, 200, 200, 0), n.rotation, vector2_3 + Vector2.UnitY * num160, n.scale, spriteEffects, 0.0f); break; } if (type == 83 || type == 84 || type == 179) { Main.spriteBatch.Draw(Main.npcTexture[type], new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY), new Microsoft.Xna.Framework.Rectangle?(n.frame), Microsoft.Xna.Framework.Color.White, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; } if (type >= 87 && type <= 92) { Microsoft.Xna.Framework.Color alpha = n.GetAlpha(color1); byte num161 = (byte) (((int) Main.tileColor.R + (int) Main.tileColor.G + (int) Main.tileColor.B) / 3); if ((int) alpha.R < (int) num161) alpha.R = num161; if ((int) alpha.G < (int) num161) alpha.G = num161; if ((int) alpha.B < (int) num161) alpha.B = num161; Main.spriteBatch.Draw(Main.npcTexture[type], new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY), new Microsoft.Xna.Framework.Rectangle?(n.frame), alpha, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; } switch (type) { case 94: for (int index = 1; index < 6; index += 2) { ref Vector2 local = ref n.oldPos[index]; Microsoft.Xna.Framework.Color alpha = n.GetAlpha(color1); alpha.R = (byte) ((int) alpha.R * (10 - index) / 15); alpha.G = (byte) ((int) alpha.G * (10 - index) / 15); alpha.B = (byte) ((int) alpha.B * (10 - index) / 15); alpha.A = (byte) ((int) alpha.A * (10 - index) / 15); Main.spriteBatch.Draw(Main.npcTexture[type], new Vector2((float) ((double) n.oldPos[index].X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.oldPos[index].Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(n.frame), alpha, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } break; case 384: return; case 396: Texture2D texture15 = Main.npcTexture[type]; Vector2 origin4 = new Vector2(191f, 130f); Texture2D texture16 = Main.extraTexture[18]; Texture2D texture17 = Main.extraTexture[19]; Vector2 origin5 = new Vector2(19f, 34f); Vector2 vector2_12 = new Vector2(27f, 59f); Vector2 vector2_13 = new Vector2(0.0f, 0.0f); Texture2D texture2D11 = Main.extraTexture[25]; Vector2 vector2_14 = new Vector2(0.0f, 214f).RotatedBy((double) n.rotation); Microsoft.Xna.Framework.Rectangle r6 = texture2D11.Frame(); r6.Height /= 3; r6.Y += r6.Height * (int) ((double) n.localAI[2] / 7.0); Texture2D texture2D12 = Main.extraTexture[29]; Vector2 vector2_15 = new Vector2(0.0f, 4f).RotatedBy((double) n.rotation); Microsoft.Xna.Framework.Rectangle r7 = texture2D12.Frame(); r7.Height /= 4; r7.Y += r7.Height * (int) ((double) n.localAI[3] / 5.0); Texture2D texture2D13 = Main.extraTexture[26]; Microsoft.Xna.Framework.Rectangle rectangle3 = texture2D13.Frame(); rectangle3.Height /= 4; Vector2 center1 = Main.npc[(int) n.ai[3]].Center; Microsoft.Xna.Framework.Point tileCoordinates1 = n.Center.ToTileCoordinates(); Microsoft.Xna.Framework.Color alpha1 = n.GetAlpha(Microsoft.Xna.Framework.Color.Lerp(Lighting.GetColor(tileCoordinates1.X, tileCoordinates1.Y), Microsoft.Xna.Framework.Color.White, 0.3f)); if ((double) n.ai[0] < 0.0) { int num162 = (int) n.ai[1] / 8; rectangle3.Y += rectangle3.Height * num162; Main.spriteBatch.Draw(texture2D13, n.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangle3), alpha1, n.rotation, origin5 + new Vector2(4f, 4f), 1f, spriteEffects, 0.0f); } else { Main.spriteBatch.Draw(texture16, n.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(), alpha1, n.rotation, origin5, 1f, spriteEffects, 0.0f); Vector2 vector2_16 = Utils.Vector2FromElipse(n.localAI[0].ToRotationVector2(), vector2_12 * n.localAI[1]); Main.spriteBatch.Draw(texture17, n.Center - Main.screenPosition + vector2_16 + vector2_13, new Microsoft.Xna.Framework.Rectangle?(), alpha1, n.rotation, new Vector2((float) texture17.Width, (float) texture17.Height) / 2f, 1f, SpriteEffects.None, 0.0f); } Main.spriteBatch.Draw(texture15, n.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(n.frame), alpha1, n.rotation, origin4, 1f, spriteEffects, 0.0f); Main.spriteBatch.Draw(texture2D12, (n.Center - Main.screenPosition + vector2_15).Floor(), new Microsoft.Xna.Framework.Rectangle?(r7), alpha1, n.rotation, r7.Size() / 2f, 1f, spriteEffects, 0.0f); Main.spriteBatch.Draw(texture2D11, (n.Center - Main.screenPosition + vector2_14).Floor(), new Microsoft.Xna.Framework.Rectangle?(r6), alpha1, n.rotation, r6.Size() / 2f, 1f, spriteEffects, 0.0f); return; case 397: Texture2D texture18 = Main.npcTexture[type]; float num163 = 0.5f; Vector2 vector2_17 = new Vector2(220f, -60f); Vector2 vector2_18 = new Vector2(0.0f, 76f); Texture2D texture19 = Main.extraTexture[15]; Vector2 vector2_19 = new Vector2(60f, 30f); float num164 = 340f; Vector2 center2 = Main.npc[(int) n.ai[3]].Center; Microsoft.Xna.Framework.Point tileCoordinates2 = n.Center.ToTileCoordinates(); Microsoft.Xna.Framework.Color alpha2 = n.GetAlpha(Microsoft.Xna.Framework.Color.Lerp(Lighting.GetColor(tileCoordinates2.X, tileCoordinates2.Y), Microsoft.Xna.Framework.Color.White, 0.3f)); bool flag5 = (double) n.ai[2] == 0.0; Vector2 vector2_20 = new Vector2(flag5 ? -1f : 1f, 1f); Vector2 origin6 = new Vector2(120f, 180f); if (!flag5) origin6.X = (float) texture18.Width - origin6.X; Texture2D texture20 = Main.extraTexture[17]; Texture2D texture21 = Main.extraTexture[19]; Vector2 origin7 = new Vector2(26f, 42f); if (!flag5) origin7.X = (float) texture20.Width - origin7.X; Vector2 vector2_21 = new Vector2(30f, 66f); Vector2 vector2_22 = new Vector2((float) (1.0 * -(double) vector2_20.X), 3f); Texture2D texture2D14 = Main.extraTexture[26]; Microsoft.Xna.Framework.Rectangle rectangle4 = texture2D14.Frame(); rectangle4.Height /= 4; Vector2 vector2_23 = vector2_17 * vector2_20; Vector2 vector2_24 = center2 + vector2_23; Vector2 vector2_25 = n.Center + vector2_18; Vector2 vector2_26 = vector2_25; Vector2 v1 = (vector2_24 - vector2_26) * (1f - num163); Vector2 origin8 = vector2_19; if (!flag5) origin8.X = (float) texture19.Width - origin8.X; float num165 = (float) Math.Acos((double) v1.Length() / (double) num164) * -vector2_20.X; Main.spriteBatch.Draw(texture19, vector2_25 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(), alpha2, (float) ((double) v1.ToRotation() + (double) num165 - 1.57079637050629), origin8, 1f, spriteEffects, 0.0f); if ((double) n.ai[0] == -2.0) { int num166 = (int) n.ai[1] / 8; rectangle4.Y += rectangle4.Height * num166; Main.spriteBatch.Draw(texture2D14, n.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangle4), alpha2, 0.0f, origin7 - new Vector2(4f, 4f), 1f, spriteEffects, 0.0f); } else { Main.spriteBatch.Draw(texture20, n.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(), alpha2, 0.0f, origin7, 1f, spriteEffects, 0.0f); Vector2 vector2_27 = Utils.Vector2FromElipse(n.localAI[0].ToRotationVector2(), vector2_21 * n.localAI[1]); Main.spriteBatch.Draw(texture21, n.Center - Main.screenPosition + vector2_27 + vector2_22, new Microsoft.Xna.Framework.Rectangle?(), alpha2, 0.0f, new Vector2((float) texture21.Width, (float) texture21.Height) / 2f, 1f, SpriteEffects.None, 0.0f); } Main.spriteBatch.Draw(texture18, n.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(n.frame), alpha2, 0.0f, origin6, 1f, spriteEffects, 0.0f); return; case 398: bool flag6 = false; Texture2D texture22 = Main.npcTexture[type]; Texture2D texture23 = Main.extraTexture[16]; Texture2D texture24 = Main.extraTexture[14]; float y1 = 340f; float num167 = 0.5f; Vector2 vector2_28 = new Vector2(220f, -60f); Vector2 vector2_29 = new Vector2(76f, 66f); Texture2D texture25 = Main.extraTexture[13]; Vector2 origin9 = new Vector2((float) texture25.Width, 278f); Vector2 origin10 = new Vector2(0.0f, 278f); Vector2 vector2_30 = new Vector2(0.0f, 76f); Vector2 center3 = n.Center; Microsoft.Xna.Framework.Point tileCoordinates3 = (n.Center + new Vector2(0.0f, -150f)).ToTileCoordinates(); Microsoft.Xna.Framework.Color alpha3 = n.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_31 = 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) iNPCIndex) { index6 = index7; break; } } if (index6 != -1) { Vector2 Position = center3 + vector2_28 * vector2_31; Vector2 v2 = (Main.npc[index6].Center + vector2_30 - Position) * num167; if (flag6) Main.dust[Dust.NewDust(Position + v2, 0, 0, 6)].noGravity = true; float num168 = (float) Math.Acos((double) v2.Length() / (double) y1) * -vector2_31.X; SpriteEffects effects = flag7 ? SpriteEffects.None : SpriteEffects.FlipHorizontally; Vector2 origin11 = vector2_29; if (!flag7) origin11.X = (float) texture24.Width - origin11.X; Main.spriteBatch.Draw(texture24, Position - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(), alpha3, (float) ((double) v2.ToRotation() - (double) num168 - 1.57079637050629), origin11, 1f, effects, 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, y1).RotatedBy((double) v2.ToRotation() - (double) num168 - 1.57079637050629), 0, 0, 6)].noGravity = true; } } Main.spriteBatch.Draw(texture25, center3 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(), alpha3, 0.0f, origin9, 1f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(texture25, center3 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(), alpha3, 0.0f, origin10, 1f, SpriteEffects.FlipHorizontally, 0.0f); Main.spriteBatch.Draw(texture23, center3 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(), alpha3, 0.0f, new Vector2(112f, 101f), 1f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(texture22, center3 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(n.frame), alpha3, 0.0f, n.frame.Size() / 2f, 1f, SpriteEffects.None, 0.0f); return; case 399: Texture2D texture26 = Main.npcTexture[type]; (n.position - Main.screenPosition + Vector2.UnitY * n.gfxOffY).Floor(); float num169 = 5f; for (int index8 = 0; (double) index8 < (double) num169; ++index8) { float num170 = (float) (1.0 - ((double) Main.GlobalTime + (double) index8) % (double) num169 / (double) num169); Microsoft.Xna.Framework.Color color38 = Microsoft.Xna.Framework.Color.LimeGreen; if ((double) n.ai[0] == 1.0) color38 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.LimeGreen, Microsoft.Xna.Framework.Color.Red, MathHelper.Clamp(n.ai[1] / 20f, 0.0f, 1f)); if ((double) n.ai[0] == 2.0) color38 = Microsoft.Xna.Framework.Color.Red; color38 *= 1f - num170; color38.A = (byte) 0; for (int index9 = 0; index9 < 2; ++index9) Main.spriteBatch.Draw(Main.extraTexture[27], n.Center - Main.screenPosition + Vector2.UnitY * (float) ((double) n.gfxOffY - 4.0 + 6.0), new Microsoft.Xna.Framework.Rectangle?(), color38, 1.570796f, new Vector2(10f, 48f), num170 * 4f, SpriteEffects.None, 0.0f); } Main.spriteBatch.Draw(texture26, new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), n.GetAlpha(color1), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); Texture2D texture27 = Main.glowMaskTexture[100]; Main.spriteBatch.Draw(texture27, new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color((int) sbyte.MaxValue - n.alpha / 2, (int) sbyte.MaxValue - n.alpha / 2, (int) sbyte.MaxValue - n.alpha / 2, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); Texture2D texture2D15 = Main.extraTexture[20]; Microsoft.Xna.Framework.Rectangle rectangle5 = texture2D15.Frame(verticalFrames: 4, frameY: ((int) n.ai[0] + 1)); Vector2 position30 = new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) texture2D15.Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale + (double) addHeight + (double) addY + (double) n.gfxOffY + 18.0 + 6.0)); Main.spriteBatch.Draw(texture2D15, position30, new Microsoft.Xna.Framework.Rectangle?(rectangle5), n.GetAlpha(color1), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); Texture2D texture28 = Main.glowMaskTexture[101]; Main.spriteBatch.Draw(texture28, position30, new Microsoft.Xna.Framework.Rectangle?(rectangle5), new Microsoft.Xna.Framework.Color((int) sbyte.MaxValue - n.alpha / 2, (int) sbyte.MaxValue - n.alpha / 2, (int) sbyte.MaxValue - n.alpha / 2, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); return; case 400: Texture2D texture29 = Main.npcTexture[type]; Texture2D texture2D16 = Main.extraTexture[19]; Vector2 origin12 = new Vector2(40f, 40f); Vector2 vector2_32 = new Vector2(30f, 30f); Vector2 center4 = n.Center; Microsoft.Xna.Framework.Point tileCoordinates4 = n.Center.ToTileCoordinates(); Microsoft.Xna.Framework.Color alpha4 = n.GetAlpha(Microsoft.Xna.Framework.Color.Lerp(Lighting.GetColor(tileCoordinates4.X, tileCoordinates4.Y), Microsoft.Xna.Framework.Color.White, 0.3f)); Main.spriteBatch.Draw(texture29, n.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(n.frame), alpha4, n.rotation, origin12, 1f, spriteEffects, 0.0f); Vector2 vector2_33 = Utils.Vector2FromElipse(n.localAI[0].ToRotationVector2(), vector2_32 * n.localAI[1]); Main.spriteBatch.Draw(texture2D16, n.Center - Main.screenPosition + vector2_33, new Microsoft.Xna.Framework.Rectangle?(), alpha4, n.rotation, texture2D16.Size() / 2f, n.localAI[2], SpriteEffects.None, 0.0f); return; case 416: int index10 = -1; int index11 = (int) n.ai[0]; Vector2 position31 = n.position; Vector2 spinningpoint = Vector2.Zero; if (Main.npc[index11].active && Main.npc[index11].type == 415) index10 = index11; if (index10 != -1) { Vector2 position32 = n.position; n.Bottom = Main.npc[index10].Bottom; position31 = n.position; n.position = position32; n.gfxOffY = Main.npc[index10].gfxOffY; spinningpoint = Main.npc[index10].velocity; } Microsoft.Xna.Framework.Rectangle frame1 = n.frame; Main.spriteBatch.Draw(Main.npcTexture[type], new Vector2((float) ((double) position31.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) position31.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame1), n.GetAlpha(color1), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); if (n.color != new Microsoft.Xna.Framework.Color()) Main.spriteBatch.Draw(Main.npcTexture[type], new Vector2((float) ((double) position31.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) position31.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame1), n.GetColor(color1), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); Main.spriteBatch.Draw(Main.glowMaskTexture[156], position31 + n.Size * new Vector2(0.5f, 1f) - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); float num171 = (float) (0.5 + (double) (n.GetAlpha(color1).ToVector3() - new Vector3(0.5f)).Length() * 0.5); for (int index12 = 0; index12 < 4; ++index12) Main.spriteBatch.Draw(Main.glowMaskTexture[156], position31 + n.Size * new Vector2(0.5f, 1f) - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY) + spinningpoint.RotatedBy((double) index12 * 1.57079637050629) * num171, new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(64, 64, 64, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); return; case 491: NPC npc4 = n; Texture2D texture30 = Main.npcTexture[npc4.type]; Microsoft.Xna.Framework.Rectangle frame2 = npc4.frame; Vector2 origin13 = frame2.OriginFlip(new Vector2(208f, 460f), spriteEffects); Vector2 position33 = npc4.Center - Main.screenPosition; Vector2 vector2_34 = new Vector2(spriteEffects.HasFlag((Enum) SpriteEffects.FlipHorizontally) ? -1f : 1f, 1f); Microsoft.Xna.Framework.Color alpha5 = npc4.GetAlpha(color1); Main.spriteBatch.Draw(texture30, position33, new Microsoft.Xna.Framework.Rectangle?(frame2), alpha5, npc4.rotation, origin13, npc4.scale, spriteEffects, 0.0f); int num172 = (int) npc4.localAI[3] / 8; Texture2D texture2D17 = Main.extraTexture[40]; Microsoft.Xna.Framework.Rectangle r8 = texture2D17.Frame(verticalFrames: 4, frameY: (num172 % 4)); Vector2 origin14 = r8.Size() * new Vector2(0.5f, 1f); Main.spriteBatch.Draw(texture2D17, position33 + (new Vector2(102f, -384f) * vector2_34).RotatedBy((double) npc4.rotation), new Microsoft.Xna.Framework.Rectangle?(r8), alpha5, npc4.rotation, origin14, npc4.scale, spriteEffects, 0.0f); Texture2D texture2D18 = Main.extraTexture[41]; Microsoft.Xna.Framework.Rectangle r9 = texture2D18.Frame(verticalFrames: 8, frameY: (num172 % 8)); Vector2 origin15 = r9.Size() * new Vector2(0.5f, 0.0f) + new Vector2(0.0f, 10f); for (int index13 = 0; index13 < 5; ++index13) Main.spriteBatch.Draw(texture2D18, position33 + (new Vector2((float) (34 * index13 - 96), 40f) * vector2_34).RotatedBy((double) npc4.rotation), new Microsoft.Xna.Framework.Rectangle?(r9), alpha5, npc4.rotation, origin15, npc4.scale, spriteEffects, 0.0f); Texture2D texture2D19 = Main.extraTexture[42]; Microsoft.Xna.Framework.Rectangle r10 = texture2D19.Frame(verticalFrames: 4, frameY: (num172 % 4)); Vector2 origin16 = r10.Size() * new Vector2(0.5f, 0.0f); for (int index14 = 0; index14 < 2; ++index14) Main.spriteBatch.Draw(texture2D19, position33 + (new Vector2((float) (158 - 106 * index14), -302f) * vector2_34).RotatedBy((double) npc4.rotation), new Microsoft.Xna.Framework.Rectangle?(r10), alpha5, npc4.rotation, origin16, npc4.scale, spriteEffects, 0.0f); Texture2D texture2D20 = Main.extraTexture[43]; Microsoft.Xna.Framework.Rectangle r11 = texture2D20.Frame(verticalFrames: 4, frameY: (num172 % 4)); Vector2 origin17 = r11.Size() * new Vector2(0.5f, 0.0f); for (int index15 = 0; index15 < 2; ++index15) Main.spriteBatch.Draw(texture2D20, position33 + (new Vector2((float) (42 - 178 * index15), -444f) * vector2_34).RotatedBy((double) npc4.rotation), new Microsoft.Xna.Framework.Rectangle?(r11), alpha5, npc4.rotation, origin17, npc4.scale, spriteEffects, 0.0f); Texture2D texture2D21 = Main.extraTexture[44]; Microsoft.Xna.Framework.Rectangle r12 = texture2D21.Frame(verticalFrames: 4, frameY: (num172 % 4)); Vector2 origin18 = r12.Size() * new Vector2(0.5f, 0.0f); Main.spriteBatch.Draw(texture2D21, position33 + (new Vector2(-134f, -302f) * vector2_34).RotatedBy((double) npc4.rotation), new Microsoft.Xna.Framework.Rectangle?(r12), alpha5, npc4.rotation, origin18, npc4.scale, spriteEffects, 0.0f); Texture2D texture2D22 = Main.extraTexture[45]; Microsoft.Xna.Framework.Rectangle r13 = texture2D22.Frame(verticalFrames: 4, frameY: ((2 + num172) % 4)); Vector2 origin19 = r13.Size() * new Vector2(0.5f, 0.0f); Main.spriteBatch.Draw(texture2D22, position33 + (new Vector2(-60f, -330f) * vector2_34).RotatedBy((double) npc4.rotation), new Microsoft.Xna.Framework.Rectangle?(r13), alpha5, npc4.rotation, origin19, npc4.scale, spriteEffects, 0.0f); this.LoadNPC(492); if (!Main.NPCLoaded[492]) return; Texture2D texture2D23 = Main.npcTexture[492]; Microsoft.Xna.Framework.Rectangle r14 = texture2D23.Frame(verticalFrames: 9); Vector2 origin20 = r14.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) { r14.Y = Main.npc[index17].frame.Y; Main.spriteBatch.Draw(texture2D23, position33 + (new Vector2((float) (68 * index16 - 122), -20f) * vector2_34).RotatedBy((double) npc4.rotation), new Microsoft.Xna.Framework.Rectangle?(r14), alpha5, npc4.rotation, origin20, 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 n.oldPos[index18]; Microsoft.Xna.Framework.Color alpha6 = n.GetAlpha(color1); alpha6.R = (byte) ((int) alpha6.R * (10 - index18) / 20); alpha6.G = (byte) ((int) alpha6.G * (10 - index18) / 20); alpha6.B = (byte) ((int) alpha6.B * (10 - index18) / 20); alpha6.A = (byte) ((int) alpha6.A * (10 - index18) / 20); Main.spriteBatch.Draw(Main.npcTexture[type], new Vector2((float) ((double) n.oldPos[index18].X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.oldPos[index18].Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(n.frame), alpha6, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } } if (type == 417 && (double) n.ai[0] >= 6.0 && (double) n.ai[0] <= 6.0) { for (int index19 = 5; index19 >= 0; --index19) { ref Vector2 local = ref n.oldPos[index19]; Microsoft.Xna.Framework.Color alpha7 = n.GetAlpha(color1); alpha7.R = (byte) ((int) alpha7.R * (10 - index19) / 20); alpha7.G = (byte) ((int) alpha7.G * (10 - index19) / 20); alpha7.B = (byte) ((int) alpha7.B * (10 - index19) / 20); alpha7.A = (byte) ((int) alpha7.A * (10 - index19) / 20); Main.spriteBatch.Draw(Main.npcTexture[type], new Vector2((float) ((double) n.oldPos[index19].X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.oldPos[index19].Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(n.frame), alpha7, n.oldRot[index19], vector2_3, MathHelper.Lerp(0.5f, 1f, (float) ((5.0 - (double) index19) / 6.0)), spriteEffects, 0.0f); } } if (type == 419 && (double) n.ai[2] <= -9.0) { int num173 = Main.glowMaskTexture[154].Height / Main.npcFrameCount[type]; int num174 = n.frame.Y / num173; for (int index20 = 6; index20 >= 0; --index20) { ref Vector2 local = ref n.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 frame3 = n.frame; int num175 = (num174 - 3 - index20) % 3; if (num175 < 0) num175 += 3; int num176 = num175 + 5; frame3.Y = num173 * num176; Main.spriteBatch.Draw(Main.glowMaskTexture[154], new Vector2((float) ((double) n.oldPos[index20].X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.oldPos[index20].Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(frame3), white, n.oldRot[index20], vector2_3, MathHelper.Lerp(0.75f, 1.2f, (float) ((10.0 - (double) index20) / 10.0)), spriteEffects, 0.0f); } } if (type == 418 && ((double) n.ai[0] == 2.0 || (double) n.ai[0] == 4.0)) { Texture2D texture2D24 = Main.extraTexture[55]; Vector2 origin21 = new Vector2((float) (texture2D24.Width / 2), (float) (texture2D24.Height / 8 + 14)); int num177 = (int) n.ai[1] / 2; float num178 = -1.570796f * (float) n.spriteDirection; float amount = n.ai[1] / 45f; if ((double) amount > 1.0) amount = 1f; int num179 = num177 % 4; for (int index21 = 6; index21 >= 0; --index21) { ref Vector2 local = ref n.oldPos[index21]; Microsoft.Xna.Framework.Color color39 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Gold, Microsoft.Xna.Framework.Color.OrangeRed, amount), Microsoft.Xna.Framework.Color.Blue, (float) index21 / 12f); color39.A = (byte) (64.0 * (double) amount); color39.R = (byte) ((int) color39.R * (10 - index21) / 20); color39.G = (byte) ((int) color39.G * (10 - index21) / 20); color39.B = (byte) ((int) color39.B * (10 - index21) / 20); color39.A = (byte) ((int) color39.A * (10 - index21) / 20); Microsoft.Xna.Framework.Color color40 = color39 * amount; int frameY = (num179 - index21) % 4; if (frameY < 0) frameY += 4; Microsoft.Xna.Framework.Rectangle rectangle6 = texture2D24.Frame(verticalFrames: 4, frameY: frameY); Main.spriteBatch.Draw(texture2D24, new Vector2((float) ((double) n.oldPos[index21].X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.oldPos[index21].Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(rectangle6), color40, n.oldRot[index21] + num178, origin21, MathHelper.Lerp(0.1f, 1.2f, (float) ((10.0 - (double) index21) / 10.0)), spriteEffects, 0.0f); } } if (type == 516) { int num180 = Main.npcTexture[type].Height / Main.npcFrameCount[type]; int num181 = n.frame.Y / num180; for (int index22 = 6; index22 >= 0; --index22) { ref Vector2 local = ref n.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 frame4 = n.frame; int num182 = (num181 - 4 - index22) % 4; if (num182 < 0) num182 += 4; frame4.Y = num180 * num182; Main.spriteBatch.Draw(Main.npcTexture[type], new Vector2((float) ((double) n.oldPos[index22].X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.oldPos[index22].Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(frame4), color41, n.rotation, vector2_3, MathHelper.Lerp(0.35f, 1.2f, (float) ((10.0 - (double) index22) / 10.0)), spriteEffects, 0.0f); } } Microsoft.Xna.Framework.Rectangle frame5 = n.frame; if (type == 182 || type == 289) frame5.Height -= 2; if (n.aiStyle == 7) this.DrawNPCExtras(n, true, addHeight, addY, color1, vector2_3, spriteEffects); if (type == 346 && (double) n.life < (double) n.lifeMax * 0.5) { Main.spriteBatch.Draw(Main.santaTankTexture, new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame5), n.GetAlpha(color1), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } else { switch (type) { case 356: --frame5.Height; Main.spriteBatch.Draw(Main.npcTexture[type], new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame5), n.GetAlpha(color1), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 360: float num183 = 0.0f; if ((double) n.ai[2] == 0.0) { if ((double) n.rotation == 3.14000010490417 || (double) n.rotation == -3.14000010490417) addHeight = 2f; if (n.direction < 0 && ((double) n.rotation == 1.57000005245209 || (double) n.rotation == 4.71000003814697)) num183 = 1f; if (n.direction > 0 && ((double) n.rotation == 1.57000005245209 || (double) n.rotation == 4.71000003814697)) num183 = -1f; } Main.spriteBatch.Draw(Main.npcTexture[type], new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale) + num183, (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame5), n.GetAlpha(color1), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; default: if (type == 266 && n.life < n.lifeMax && Main.expertMode) { Microsoft.Xna.Framework.Color alpha8 = n.GetAlpha(color1); float num184 = (float) (1.0 - (double) n.life / (double) n.lifeMax); float num185 = num184 * num184; alpha8.R = (byte) ((double) alpha8.R * (double) num185); alpha8.G = (byte) ((double) alpha8.G * (double) num185); alpha8.B = (byte) ((double) alpha8.B * (double) num185); alpha8.A = (byte) ((double) alpha8.A * (double) num185); for (int index23 = 0; index23 < 4; ++index23) { Vector2 position34 = n.position; float num186 = Math.Abs(n.Center.X - Main.player[Main.myPlayer].Center.X); float num187 = Math.Abs(n.Center.Y - Main.player[Main.myPlayer].Center.Y); position34.X = index23 == 0 || index23 == 2 ? Main.player[Main.myPlayer].Center.X + num186 : Main.player[Main.myPlayer].Center.X - num186; position34.X -= (float) (n.width / 2); position34.Y = index23 == 0 || index23 == 1 ? Main.player[Main.myPlayer].Center.Y + num187 : Main.player[Main.myPlayer].Center.Y - num187; position34.Y -= (float) (n.height / 2); Main.spriteBatch.Draw(Main.npcTexture[type], new Vector2((float) ((double) position34.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) position34.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame5), alpha8, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } Main.spriteBatch.Draw(Main.npcTexture[type], new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame5), n.GetAlpha(color1), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; } if (type == 421 && (double) n.ai[0] == 5.0) { Player player = Main.player[n.target]; if ((double) player.gravDir == -1.0) spriteEffects |= SpriteEffects.FlipVertically; Main.spriteBatch.Draw(Main.npcTexture[type], new Vector2((float) (player.direction * 4), player.gfxOffY) + ((double) player.gravDir == 1.0 ? player.Top : player.Bottom) - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(frame5), n.GetAlpha(color1), n.rotation, frame5.Size() / 2f, n.scale, spriteEffects, 0.0f); Main.spriteBatch.Draw(Main.glowMaskTexture[146], new Vector2((float) (player.direction * 4), player.gfxOffY) + ((double) player.gravDir == 1.0 ? player.Top : player.Bottom) - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(frame5), n.GetAlpha(color1), n.rotation, frame5.Size() / 2f, n.scale, spriteEffects, 0.0f); break; } if (type == 518) { Vector2 vector2_35 = new Vector2(-10f, 0.0f); Main.spriteBatch.Draw(Main.npcTexture[type], new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame5), n.GetAlpha(color1), n.rotation, vector2_3 + vector2_35, n.scale, spriteEffects, 0.0f); if (n.color != new Microsoft.Xna.Framework.Color()) { Main.spriteBatch.Draw(Main.npcTexture[type], new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame5), n.GetColor(color1), n.rotation, vector2_3 + vector2_35, n.scale, spriteEffects, 0.0f); break; } break; } Main.spriteBatch.Draw(Main.npcTexture[type], new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame5), n.GetAlpha(color1), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); if (n.color != new Microsoft.Xna.Framework.Color()) { Main.spriteBatch.Draw(Main.npcTexture[type], new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame5), n.GetColor(color1), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; } break; } } if (n.confused) Main.spriteBatch.Draw(Main.confuseTexture, new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale + (double) addHeight + (double) addY - (double) Main.confuseTexture.Height - 20.0)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.confuseTexture.Width, Main.confuseTexture.Height)), new Microsoft.Xna.Framework.Color(250, 250, 250, 70), n.velocity.X * -0.05f, new Vector2((float) (Main.confuseTexture.Width / 2), (float) (Main.confuseTexture.Height / 2)), Main.essScale + 0.2f, SpriteEffects.None, 0.0f); if (type >= 134 && type <= 136 && color1 != Microsoft.Xna.Framework.Color.Black) { Main.spriteBatch.Draw(Main.destTexture[type - 134], new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0) * (float) (1.0 - (double) n.alpha / (double) byte.MaxValue), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } else { switch (type) { case 120: for (int index24 = 1; index24 < n.oldPos.Length; ++index24) { ref Vector2 local = ref n.oldPos[index24]; Main.spriteBatch.Draw(Main.chaosTexture, new Vector2((float) ((double) n.oldPos[index24].X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.oldPos[index24].Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(n.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) }, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } break; case 125: Main.spriteBatch.Draw(Main.EyeLaserTexture, new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case (int) sbyte.MaxValue: Main.spriteBatch.Draw(Main.BoneEyesTexture, new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(200, 200, 200, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 131: Main.spriteBatch.Draw(Main.BoneLaserTexture, new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(200, 200, 200, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 139: Main.spriteBatch.Draw(Main.probeTexture, new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; default: if (type == 137 || type == 138) { for (int index25 = 1; index25 < n.oldPos.Length; ++index25) { ref Vector2 local = ref n.oldPos[index25]; Main.spriteBatch.Draw(Main.npcTexture[type], new Vector2((float) ((double) n.oldPos[index25].X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.oldPos[index25].Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(n.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) }, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } break; } switch (type) { case 82: Main.spriteBatch.Draw(Main.wraithEyeTexture, new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(n.frame), Microsoft.Xna.Framework.Color.White, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); for (int index26 = 1; index26 < 10; ++index26) { Microsoft.Xna.Framework.Color color42 = new Microsoft.Xna.Framework.Color(110 - index26 * 10, 110 - index26 * 10, 110 - index26 * 10, 110 - index26 * 10); Main.spriteBatch.Draw(Main.wraithEyeTexture, new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight) - n.velocity * (float) index26 * 0.5f, new Microsoft.Xna.Framework.Rectangle?(n.frame), color42, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } break; case 253: Main.spriteBatch.Draw(Main.reaperEyeTexture, new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 3.0 + (double) vector2_3.Y * (double) n.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(n.frame), Microsoft.Xna.Framework.Color.White, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); for (int index27 = 1; index27 < 20; ++index27) { Microsoft.Xna.Framework.Color color43 = new Microsoft.Xna.Framework.Color(210 - index27 * 20, 210 - index27 * 20, 210 - index27 * 20, 210 - index27 * 20); Main.spriteBatch.Draw(Main.reaperEyeTexture, new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 3.0 + (double) vector2_3.Y * (double) n.scale) + addHeight) - n.velocity * (float) index27 * 0.5f, new Microsoft.Xna.Framework.Rectangle?(n.frame), color43, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } break; case 325: Main.spriteBatch.Draw(Main.treeFaceTexture, new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(n.frame), Microsoft.Xna.Framework.Color.White, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); for (int index28 = 1; index28 < 10; ++index28) { Microsoft.Xna.Framework.Color color44 = new Microsoft.Xna.Framework.Color(110 - index28 * 10, 110 - index28 * 10, 110 - index28 * 10, 110 - index28 * 10); Vector2 vector2_36 = new Vector2((float) Main.rand.Next(-10, 11) * 0.2f, (float) Main.rand.Next(-10, 11) * 0.2f); Main.spriteBatch.Draw(Main.treeFaceTexture, new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight) + vector2_36, new Microsoft.Xna.Framework.Rectangle?(n.frame), color44, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } break; case 327: Main.spriteBatch.Draw(Main.pumpkingFaceTexture, new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(n.frame), Microsoft.Xna.Framework.Color.White, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); for (int index29 = 1; index29 < 10; ++index29) { Microsoft.Xna.Framework.Color color45 = new Microsoft.Xna.Framework.Color(110 - index29 * 10, 110 - index29 * 10, 110 - index29 * 10, 110 - index29 * 10); Vector2 vector2_37 = new Vector2((float) Main.rand.Next(-10, 11) * 0.2f, (float) Main.rand.Next(-10, 11) * 0.2f); Main.spriteBatch.Draw(Main.pumpkingFaceTexture, new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight) + vector2_37, new Microsoft.Xna.Framework.Rectangle?(n.frame), color45, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } break; case 345: Main.spriteBatch.Draw(Main.iceQueenTexture, new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(n.frame), Microsoft.Xna.Framework.Color.White, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); for (int index30 = 1; index30 < 5; ++index30) { Microsoft.Xna.Framework.Color color46 = new Microsoft.Xna.Framework.Color(100 - index30 * 10, 100 - index30 * 10, 100 - index30 * 10, 100 - index30 * 10); Main.spriteBatch.Draw(Main.iceQueenTexture, new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight) - n.velocity * (float) index30 * 0.2f, new Microsoft.Xna.Framework.Rectangle?(n.frame), color46, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } break; case 355: Main.spriteBatch.Draw(Main.fireflyTexture, new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 358: Main.spriteBatch.Draw(Main.lightningbugTexture, new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; default: if (type == 245 && n.alpha == 0) { Microsoft.Xna.Framework.Color color47 = new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, 0); Main.spriteBatch.Draw(Main.golemTexture[3], new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame5), color47, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; } switch (type) { case 246: Microsoft.Xna.Framework.Color color48 = new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, 0); if (n.frame.Y < 222) { Main.spriteBatch.Draw(Main.golemTexture[1], new Vector2((float) ((double) n.Center.X - (double) Main.screenPosition.X - 20.0), (float) ((double) n.Center.Y - (double) Main.screenPosition.Y - 27.0)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.golemTexture[1].Width, Main.golemTexture[1].Height / 2)), color48, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); break; } if (n.frame.Y < 444) { Main.spriteBatch.Draw(Main.golemTexture[2], new Vector2((float) ((double) n.Center.X - (double) Main.screenPosition.X + 26.0), (float) ((double) n.Center.Y - (double) Main.screenPosition.Y - 28.0)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.golemTexture[2].Width, Main.golemTexture[2].Height / 4)), color48, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); break; } Main.spriteBatch.Draw(Main.golemTexture[2], new Vector2((float) ((double) n.Center.X - (double) Main.screenPosition.X - 38.0), (float) ((double) n.Center.Y - (double) Main.screenPosition.Y - 28.0)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.golemTexture[2].Height / 2, Main.golemTexture[2].Width, Main.golemTexture[2].Height / 4)), color48, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); break; case 249: Microsoft.Xna.Framework.Color color49 = new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, 0); Main.spriteBatch.Draw(Main.golemTexture[1], new Vector2((float) ((double) n.Center.X - (double) Main.screenPosition.X - 20.0), (float) ((double) n.Center.Y - (double) Main.screenPosition.Y - 47.0)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.golemTexture[1].Width, Main.golemTexture[1].Height / 2)), color49, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); break; case 381: Vector2 zero1 = Vector2.Zero; Vector2 origin22 = Vector2.Zero; int num188 = Main.npcTexture[type].Height / Main.npcFrameCount[type]; int num189 = n.frame.Y / num188; Microsoft.Xna.Framework.Rectangle rectangle7 = new Microsoft.Xna.Framework.Rectangle(0, 0, 32, 42); switch (num189) { 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) (num188 * num189); Vector2 vector2_38 = zero1 - vector2_3; int num190 = 2; if ((double) n.ai[2] > 0.0) num190 = (int) n.ai[2] - 1; if ((double) n.velocity.Y != 0.0) num190 = 3; rectangle7.Y += 44 * num190; switch (num190) { case 0: origin22 = new Vector2(10f, 18f); break; case 1: origin22 = new Vector2(8f, 20f); break; case 2: origin22 = new Vector2(8f, 20f); break; case 3: origin22 = new Vector2(8f, 20f); break; case 4: origin22 = new Vector2(6f, 18f); break; } if (spriteEffects.HasFlag((Enum) SpriteEffects.FlipHorizontally)) { vector2_38.X *= -1f; origin22.X = (float) rectangle7.Width - origin22.X; } Vector2 position35 = vector2_38 + n.Center - Main.screenPosition; position35.Y += n.gfxOffY; Main.spriteBatch.Draw(Main.extraTexture[0], position35, new Microsoft.Xna.Framework.Rectangle?(rectangle7), color1, n.rotation, origin22, n.scale, spriteEffects, 0.0f); Main.spriteBatch.Draw(Main.glowMaskTexture[24], position35, new Microsoft.Xna.Framework.Rectangle?(rectangle7), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), n.rotation, origin22, n.scale, spriteEffects, 0.0f); break; case 382: Vector2 zero2 = Vector2.Zero; Vector2 origin23 = Vector2.Zero; int num191 = Main.npcTexture[type].Height / Main.npcFrameCount[type]; int num192 = n.frame.Y / num191; Microsoft.Xna.Framework.Rectangle rectangle8 = new Microsoft.Xna.Framework.Rectangle(0, 0, 30, 42); switch (num192) { 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) (num191 * num192); Vector2 vector2_39 = zero2 - vector2_3; int num193 = 2; if ((double) n.ai[2] > 0.0) num193 = (int) n.ai[2] - 1; if ((double) n.velocity.Y != 0.0) num193 = 3; rectangle8.Y += 44 * num193; switch (num193) { case 0: origin23 = new Vector2(10f, 18f); break; case 1: origin23 = new Vector2(8f, 20f); break; case 2: origin23 = new Vector2(8f, 20f); break; case 3: origin23 = new Vector2(8f, 20f); break; case 4: origin23 = new Vector2(6f, 18f); break; } if (spriteEffects.HasFlag((Enum) SpriteEffects.FlipHorizontally)) { vector2_39.X *= -1f; origin23.X = (float) rectangle8.Width - origin23.X; } Vector2 position36 = vector2_39 + n.Center - Main.screenPosition; position36.Y += n.gfxOffY; Main.spriteBatch.Draw(Main.extraTexture[1], position36, new Microsoft.Xna.Framework.Rectangle?(rectangle8), color1, n.rotation, origin23, n.scale, spriteEffects, 0.0f); break; case 383: Main.spriteBatch.Draw(Main.glowMaskTexture[11], new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame5), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); if ((double) n.ai[2] != 0.0 && Main.npc[(int) n.ai[2] - 1].active && Main.npc[(int) n.ai[2] - 1].type == 384) { double num194 = (double) n.ai[2]; Main.spriteBatch.Draw(Main.npcTexture[384], new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(), new Microsoft.Xna.Framework.Color(100, 100, 100, 0), n.rotation, new Vector2((float) Main.npcTexture[384].Width, (float) Main.npcTexture[384].Height) / 2f, n.scale, spriteEffects, 0.0f); break; } break; case 386: Main.spriteBatch.Draw(Main.glowMaskTexture[31], new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame5), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 387: Microsoft.Xna.Framework.Color color50 = new Microsoft.Xna.Framework.Color(1f, 1f, 1f, 1f) * 0.75f; if ((double) n.ai[0] > 0.0) { float amount = (float) (((double) n.ai[0] + 1.0) / 60.0); color50 = Microsoft.Xna.Framework.Color.Lerp(color50, Microsoft.Xna.Framework.Color.White, amount); color50.A = (byte) MathHelper.Lerp((float) color50.A, 0.0f, amount); } Microsoft.Xna.Framework.Color color51 = color50 * (float) (((double) byte.MaxValue - (double) n.alpha) / (double) byte.MaxValue); Main.spriteBatch.Draw(Main.glowMaskTexture[32], new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame5), color51, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 388: Main.spriteBatch.Draw(Main.glowMaskTexture[33], new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame5), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 389: Main.spriteBatch.Draw(Main.glowMaskTexture[34], new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame5), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 520: Main.spriteBatch.Draw(Main.glowMaskTexture[164], new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame5), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); Vector2 zero3 = Vector2.Zero; Vector2 origin24 = new Vector2(4f, 4f); int num195 = Main.npcTexture[type].Height / Main.npcFrameCount[type]; int num196 = n.frame.Y / num195; if (spriteEffects.HasFlag((Enum) SpriteEffects.FlipHorizontally)) { zero3.X *= -1f; origin24.X = (float) Main.extraTexture[56].Width - origin24.X; } Vector2 position37 = zero3 + (n.Top + new Vector2(0.0f, 20f)) - Main.screenPosition; position37.Y += n.gfxOffY; float rotation3 = n.localAI[3]; if (spriteEffects.HasFlag((Enum) SpriteEffects.FlipHorizontally)) rotation3 += 3.141593f; Main.spriteBatch.Draw(Main.extraTexture[56], position37, new Microsoft.Xna.Framework.Rectangle?(), color1, rotation3, origin24, n.scale, spriteEffects, 0.0f); Main.spriteBatch.Draw(Main.glowMaskTexture[165], position37, new Microsoft.Xna.Framework.Rectangle?(), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), rotation3, origin24, n.scale, spriteEffects, 0.0f); break; default: if (type == 4 && (double) n.ai[1] >= 4.0 && (double) n.ai[0] == 3.0) { for (int index31 = 1; index31 < n.oldPos.Length; ++index31) { ref Vector2 local = ref n.oldPos[index31]; Microsoft.Xna.Framework.Color color52 = color1; color52.R = (byte) (0.5 * (double) color52.R * (double) (10 - index31) / 20.0); color52.G = (byte) (0.5 * (double) color52.G * (double) (10 - index31) / 20.0); color52.B = (byte) (0.5 * (double) color52.B * (double) (10 - index31) / 20.0); color52.A = (byte) (0.5 * (double) color52.A * (double) (10 - index31) / 20.0); Main.spriteBatch.Draw(Main.npcTexture[type], new Vector2((float) ((double) n.oldPos[index31].X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.oldPos[index31].Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(n.frame), color52, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } break; } if (type == 437) { Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; white.A = (byte) 200; Main.spriteBatch.Draw(Main.glowMaskTexture[109], new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(frame5), white, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); Main.spriteBatch.Draw(Main.glowMaskTexture[108], new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + addY + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(), white, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; } if (type == 471 && (double) n.ai[3] < 0.0) { for (int index32 = 1; index32 < n.oldPos.Length; ++index32) { ref Vector2 local = ref n.oldPos[index32]; Microsoft.Xna.Framework.Color color53 = color1; color53.R = (byte) (0.5 * (double) color53.R * (double) (10 - index32) / 20.0); color53.G = (byte) (0.5 * (double) color53.G * (double) (10 - index32) / 20.0); color53.B = (byte) (0.5 * (double) color53.B * (double) (10 - index32) / 20.0); color53.A = (byte) (0.5 * (double) color53.A * (double) (10 - index32) / 20.0); Main.spriteBatch.Draw(Main.npcTexture[type], new Vector2((float) ((double) n.oldPos[index32].X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.oldPos[index32].Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(n.frame), color53, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } break; } if (type == 477 && (double) n.velocity.Length() > 9.0) { for (int index33 = 1; index33 < n.oldPos.Length; ++index33) { ref Vector2 local = ref n.oldPos[index33]; Microsoft.Xna.Framework.Color color54 = color1; color54.R = (byte) (0.5 * (double) color54.R * (double) (10 - index33) / 20.0); color54.G = (byte) (0.5 * (double) color54.G * (double) (10 - index33) / 20.0); color54.B = (byte) (0.5 * (double) color54.B * (double) (10 - index33) / 20.0); color54.A = (byte) (0.5 * (double) color54.A * (double) (10 - index33) / 20.0); Microsoft.Xna.Framework.Rectangle frame6 = n.frame; int num197 = Main.npcTexture[type].Height / Main.npcFrameCount[type]; frame6.Y -= num197 * index33; while (frame6.Y < 0) frame6.Y += num197 * Main.npcFrameCount[type]; Main.spriteBatch.Draw(Main.npcTexture[type], new Vector2((float) ((double) n.oldPos[index33].X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.oldPos[index33].Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(frame6), color54, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } break; } break; } break; } break; } } if (type == 479 && (double) n.velocity.Length() > 6.5) { for (int index34 = 1; index34 < n.oldPos.Length; ++index34) { ref Vector2 local = ref n.oldPos[index34]; Microsoft.Xna.Framework.Color color55 = color1; color55.R = (byte) (0.5 * (double) color55.R * (double) (10 - index34) / 20.0); color55.G = (byte) (0.5 * (double) color55.G * (double) (10 - index34) / 20.0); color55.B = (byte) (0.5 * (double) color55.B * (double) (10 - index34) / 20.0); color55.A = (byte) (0.5 * (double) color55.A * (double) (10 - index34) / 20.0); Microsoft.Xna.Framework.Rectangle frame7 = n.frame; int num198 = Main.npcTexture[type].Height / Main.npcFrameCount[type]; frame7.Y -= num198 * index34; while (frame7.Y < 0) frame7.Y += num198 * Main.npcFrameCount[type]; Main.spriteBatch.Draw(Main.npcTexture[type], new Vector2((float) ((double) n.oldPos[index34].X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.oldPos[index34].Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(frame7), color55, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } } else if (type == 472) Main.spriteBatch.Draw(Main.glowMaskTexture[110], new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); else if (n.aiStyle == 87) { if ((int) n.ai[0] == 4 || (double) n.ai[0] == 5.0 || (double) n.ai[0] == 6.0) { for (int index35 = 1; index35 < n.oldPos.Length; ++index35) { ref Vector2 local = ref n.oldPos[index35]; Microsoft.Xna.Framework.Color color56 = color1; color56.R = (byte) (0.5 * (double) color56.R * (double) (10 - index35) / 20.0); color56.G = (byte) (0.5 * (double) color56.G * (double) (10 - index35) / 20.0); color56.B = (byte) (0.5 * (double) color56.B * (double) (10 - index35) / 20.0); color56.A = (byte) (0.5 * (double) color56.A * (double) (10 - index35) / 20.0); Main.spriteBatch.Draw(Main.npcTexture[type], new Vector2((float) ((double) n.oldPos[index35].X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) n.oldPos[index35].Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight), new Microsoft.Xna.Framework.Rectangle?(n.frame), color56, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); } } } else { switch (type) { case 50: Texture2D texture2D25 = Main.extraTexture[39]; Vector2 center5 = n.Center; float num199 = 0.0f; switch (n.frame.Y / (Main.npcTexture[type].Height / Main.npcFrameCount[type])) { case 0: num199 = 2f; break; case 1: num199 = -6f; break; case 2: num199 = 2f; break; case 3: num199 = 10f; break; case 4: num199 = 2f; break; case 5: num199 = 0.0f; break; } center5.Y += n.gfxOffY - (70f - num199) * n.scale; Main.spriteBatch.Draw(texture2D25, center5 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(), color1, 0.0f, texture2D25.Size() / 2f, 1f, spriteEffects, 0.0f); break; case 405: Main.spriteBatch.Draw(Main.glowMaskTexture[141], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(128 - n.alpha / 2, 128 - n.alpha / 2, 128 - n.alpha / 2, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 406: Main.spriteBatch.Draw(Main.glowMaskTexture[142], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(128 - n.alpha / 2, 128 - n.alpha / 2, 128 - n.alpha / 2, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 407: Main.spriteBatch.Draw(Main.glowMaskTexture[139], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 409: Main.spriteBatch.Draw(Main.glowMaskTexture[138], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 410: Main.spriteBatch.Draw(Main.glowMaskTexture[137], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 411: Main.spriteBatch.Draw(Main.glowMaskTexture[136], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(128 - n.alpha / 2, 128 - n.alpha / 2, 128 - n.alpha / 2, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 418: Main.spriteBatch.Draw(Main.glowMaskTexture[161], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); float num200 = (float) (0.25 + (double) (n.GetAlpha(color1).ToVector3() - new Vector3(0.5f)).Length() * 0.25); for (int index36 = 0; index36 < 4; ++index36) Main.spriteBatch.Draw(Main.glowMaskTexture[161], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY) + n.velocity.RotatedBy((double) index36 * 1.57079637050629) * num200, new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(64, 64, 64, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 420: Main.spriteBatch.Draw(Main.glowMaskTexture[147], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(128 - n.alpha / 2, 128 - n.alpha / 2, 128 - n.alpha / 2, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 421: Main.spriteBatch.Draw(Main.glowMaskTexture[146], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(128 - n.alpha / 2, 128 - n.alpha / 2, 128 - n.alpha / 2, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 423: Main.spriteBatch.Draw(Main.glowMaskTexture[145], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(128 - n.alpha / 2, 128 - n.alpha / 2, 128 - n.alpha / 2, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 424: Main.spriteBatch.Draw(Main.glowMaskTexture[144], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(128 - n.alpha / 2, 128 - n.alpha / 2, 128 - n.alpha / 2, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 425: Main.spriteBatch.Draw(Main.glowMaskTexture[150], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(128 - n.alpha / 2, 128 - n.alpha / 2, 128 - n.alpha / 2, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 429: Main.spriteBatch.Draw(Main.glowMaskTexture[151], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(128 - n.alpha / 2, 128 - n.alpha / 2, 128 - n.alpha / 2, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; default: if (type >= 412 && type <= 414) { Microsoft.Xna.Framework.Color color57 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha, 0); int index37 = 157 + type - 412; if (type == 414 && (double) n.localAI[2] != 0.0) { int num201 = (int) n.localAI[2]; if ((double) n.localAI[2] < 0.0) num201 = 128 + (int) n.localAI[2]; int num202 = (int) byte.MaxValue - num201; color57 = new Microsoft.Xna.Framework.Color(num202, num201, num201, num202); } Main.spriteBatch.Draw(Main.glowMaskTexture[index37], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), color57, n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; } switch (type) { case 160: Main.spriteBatch.Draw(Main.glowMaskTexture[166], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(128 - n.alpha / 2, 128 - n.alpha / 2, 128 - n.alpha / 2, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 209: Main.spriteBatch.Draw(Main.glowMaskTexture[167], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(128 - n.alpha / 2, 128 - n.alpha / 2, 128 - n.alpha / 2, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 415: Main.spriteBatch.Draw(Main.glowMaskTexture[155], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); float num203 = (float) (0.5 + (double) (n.GetAlpha(color1).ToVector3() - new Vector3(0.5f)).Length() * 0.5); for (int index38 = 0; index38 < 4; ++index38) Main.spriteBatch.Draw(Main.glowMaskTexture[155], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY) + n.velocity.RotatedBy((double) index38 * 1.57079637050629) * num203, new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(64, 64, 64, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 417: Main.spriteBatch.Draw(Main.glowMaskTexture[160], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); float num204 = (float) (0.25 + (double) (n.GetAlpha(color1).ToVector3() - new Vector3(0.5f)).Length() * 0.25); for (int index39 = 0; index39 < 4; ++index39) Main.spriteBatch.Draw(Main.glowMaskTexture[160], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY) + n.velocity.RotatedBy((double) index39 * 1.57079637050629) * num204, new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(64, 64, 64, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 419: Main.spriteBatch.Draw(Main.glowMaskTexture[154], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); if ((double) n.ai[2] >= -6.0) { float num205 = (float) (0.5 + (double) (n.GetAlpha(color1).ToVector3() - new Vector3(0.5f)).Length() * 0.5); for (int index40 = 0; index40 < 4; ++index40) Main.spriteBatch.Draw(Main.glowMaskTexture[154], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY) + n.velocity.RotatedBy((double) index40 * 1.57079637050629) * num205, new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(64, 64, 64, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; } float num206 = 4f; for (int index41 = 0; index41 < 4; ++index41) Main.spriteBatch.Draw(Main.glowMaskTexture[154], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY) + Vector2.UnitX.RotatedBy((double) index41 * 1.57079637050629) * num206, new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(64, 64, 64, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 516: Main.spriteBatch.Draw(Main.npcTexture[type], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); float num207 = (float) (0.5 + (double) (n.GetAlpha(color1).ToVector3() - new Vector3(0.5f)).Length() * 0.5); for (int index42 = 0; index42 < 4; ++index42) Main.spriteBatch.Draw(Main.npcTexture[type], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY) + n.velocity.RotatedBy((double) index42 * 1.57079637050629) * num207, new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(64, 64, 64, 0), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 518: Vector2 vector2_40 = new Vector2(-10f, 0.0f); Main.spriteBatch.Draw(Main.glowMaskTexture[163], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha, (int) byte.MaxValue - n.alpha), n.rotation, vector2_3 + vector2_40, n.scale, spriteEffects, 0.0f); float num208 = (float) (0.5 + (double) (n.GetAlpha(color1).ToVector3() - new Vector3(0.5f)).Length() * 0.5); for (int index43 = 0; index43 < 4; ++index43) Main.spriteBatch.Draw(Main.glowMaskTexture[163], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY) + n.velocity.RotatedBy((double) index43 * 1.57079637050629) * num208, new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(64, 64, 64, 0), n.rotation, vector2_3 + vector2_40, n.scale, spriteEffects, 0.0f); break; case 525: Main.spriteBatch.Draw(Main.glowMaskTexture[169], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(200, 200, 200, 100), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 526: Main.spriteBatch.Draw(Main.glowMaskTexture[170], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(200, 200, 200, 100), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 527: Main.spriteBatch.Draw(Main.glowMaskTexture[171], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color(200, 200, 200, 100), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; case 533: Main.spriteBatch.Draw(Main.glowMaskTexture[172], n.Bottom - Main.screenPosition + new Vector2((float) ((double) -Main.npcTexture[type].Width * (double) n.scale / 2.0 + (double) vector2_3.X * (double) n.scale), (float) ((double) -Main.npcTexture[type].Height * (double) n.scale / (double) Main.npcFrameCount[type] + 4.0 + (double) vector2_3.Y * (double) n.scale) + addHeight + n.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(n.frame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 100), n.rotation, vector2_3, n.scale, spriteEffects, 0.0f); break; } break; } } if (n.aiStyle != 7) break; this.DrawNPCExtras(n, false, addHeight, addY, color1, vector2_3, spriteEffects); break; } } } protected void DrawNPCExtras( NPC n, bool beforeDraw, float addHeight, float addY, Microsoft.Xna.Framework.Color npcColor, Vector2 halfSize, SpriteEffects npcSpriteEffect) { 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 = Main.extraTexture[72]; 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; Vector2 vector2 = n.Top + new Vector2((float) (-2 * n.spriteDirection), n.gfxOffY); vector2.Y += (float) npCsFramingGroup[index]; vector2.Y += (float) NPCID.Sets.HatOffsetY[n.type]; int num2 = 0; if ((double) n.ai[0] == 5.0) { num2 = -4; if (n.type == 38) num2 = -8; if (n.type == 124) num2 = -2; if (n.type == 550) num2 = -4; if (n.type == 108 || n.type == 178) num2 = -6; } vector2.Y += (float) num2; 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 num3 = 0; switch (n.type) { case 17: case 18: case 19: case 20: case 22: case 124: case 229: case 353: num3 = -1; break; case 37: case 38: case 54: case 107: case 108: case 160: case 207: case 209: num3 = -3; break; case 178: case 208: case 369: num3 = 1; break; case 227: num3 = -4; break; case 228: num3 = -2; break; case 550: num3 = -4; break; } vector2.X += (float) (num3 * n.spriteDirection); vector2.X += (float) (4 * n.spriteDirection); Main.spriteBatch.Draw(texture2D, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(r), npcColor, 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 num4 = (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) (num4 * 1.57079637050629) * (float) n.spriteDirection; float num5 = 1f; int itemtype = 0; int num6 = 4; if (n.type == 19) { itemtype = Main.hardMode ? 98 : 95; if (Main.hardMode) { vector2_2.X -= (float) (10 * n.direction); vector2_2.Y += 4f; } } else if (n.type == 22) { itemtype = 39; num6 = 18; } else if (n.type == 178) itemtype = 434; else if (n.type == 227) { itemtype = 3350; num6 = 16; num5 = 0.85f; } else if (n.type == 368) { itemtype = Main.hardMode ? 2223 : 2269; if (Main.hardMode) { num6 = 18; } else { if ((double) n.ai[2] < -0.100000001490116) num6 = 28; num5 = 0.75f; } } Texture2D texture = Main.itemTexture[itemtype]; int num7 = (int) this.DrawPlayerItemPos(1f, itemtype).X - num6; Vector2 origin = new Vector2((float) -num7, (float) (texture.Height / 2)); if (n.spriteDirection == -1) origin = new Vector2((float) (texture.Width + num7), (float) (texture.Height / 2)); Main.spriteBatch.Draw(texture, new Vector2((float) (int) ((double) vector2_2.X - (double) Main.screenPosition.X), (float) (int) ((double) vector2_2.Y - (double) Main.screenPosition.Y)), new Microsoft.Xna.Framework.Rectangle?(), npcColor, rotation, origin, n.scale * num5, npcSpriteEffect ^ SpriteEffects.FlipHorizontally, 0.0f); if (n.type == 22 && n.frame.Y / (Main.npcTexture[n.type].Height / Main.npcFrameCount[n.type]) >= 21) { Texture2D texture2D = Main.extraTexture[52]; Microsoft.Xna.Framework.Rectangle rectangle = texture2D.Frame(verticalFrames: 5, frameY: (n.frame.Y / (Main.npcTexture[n.type].Height / Main.npcFrameCount[n.type]) - 21)); Main.spriteBatch.Draw(texture2D, new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[n.type].Width * (double) n.scale / 2.0 + (double) halfSize.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[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 / (Main.npcTexture[n.type].Height / Main.npcFrameCount[n.type]) >= 21) { Texture2D texture2D = Main.extraTexture[53]; Microsoft.Xna.Framework.Rectangle rectangle = texture2D.Frame(verticalFrames: 5, frameY: (n.frame.Y / (Main.npcTexture[n.type].Height / Main.npcFrameCount[n.type]) - 21)); Main.spriteBatch.Draw(texture2D, new Vector2((float) ((double) n.position.X - (double) Main.screenPosition.X + (double) (n.width / 2) - (double) Main.npcTexture[n.type].Width * (double) n.scale / 2.0 + (double) halfSize.X * (double) n.scale), (float) ((double) n.position.Y - (double) Main.screenPosition.Y + (double) n.height - (double) Main.npcTexture[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 = Main.extraTexture[51]; 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) Main.screenPosition.X), (float) (int) ((double) vector2.Y - (double) Main.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) { Texture2D texture2D = Main.itemTexture[4]; int num8 = 32; float num9 = 0.0f; Vector2 zero = Vector2.Zero; if (n.type == 207) { texture2D = Main.itemTexture[3349]; num9 = 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) { texture2D = Main.itemTexture[3352]; num9 = 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) { texture2D = Main.itemTexture[3351]; num8 = 28; num9 = 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, num8, num8); Vector2 vector2 = swingStats.Item1 + (swingStats.Item1 - n.Center) * num9 + 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) Main.screenPosition.X), (float) (int) ((double) vector2.Y - (double) Main.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) return; Texture2D texture2D1 = Main.itemTexture[353]; int num10 = 32; float num11 = 0.0f; Vector2 zero1 = Vector2.Zero; if (n.type == 550) { texture2D1 = Main.itemTexture[353]; num11 = 0.15f; if (beforeDraw) return; } 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 num12 = (double) player.Hitbox.Distance(n.Center); float num13 = n.localAI[3]; if (num12 < 46.0 & flag) { n.localAI[3] = 1f; if ((double) n.localAI[3] != (double) num13) { 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, num10, num10); Vector2 vector2_5 = swingStats1.Item1 + (swingStats1.Item1 - n.Center) * num11 + zero1; Vector2 origin1 = texture2D1.Size() * new Vector2(n.spriteDirection == 1 ? 0.0f : 1f, 1f); Main.spriteBatch.Draw(texture2D1, new Vector2((float) (int) ((double) vector2_5.X - (double) Main.screenPosition.X), (float) (int) ((double) vector2_5.Y - (double) Main.screenPosition.Y)), new Microsoft.Xna.Framework.Rectangle?(), n.GetAlpha(npcColor), swingStats1.Item2, origin1, n.scale, npcSpriteEffect ^ SpriteEffects.FlipHorizontally, 0.0f); } public void DrawProj(int i) { float x1 = 0.0f; float y1 = 0.0f; Projectile projectile = Main.projectile[i]; this.LoadProjectile(projectile.type); Vector2 mountedCenter = Main.player[projectile.owner].MountedCenter; if (projectile.aiStyle == 99) { Vector2 vector2 = mountedCenter; vector2.Y += Main.player[projectile.owner].gfxOffY; float num1 = projectile.Center.X - vector2.X; float num2 = projectile.Center.Y - vector2.Y; Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); float num3 = (float) Math.Atan2((double) num2, (double) num1) - 1.57f; if (!projectile.counterweight) { int num4 = -1; if ((double) projectile.position.X + (double) (projectile.width / 2) < (double) Main.player[projectile.owner].position.X + (double) (Main.player[projectile.owner].width / 2)) num4 = 1; int num5 = num4 * -1; Main.player[projectile.owner].itemRotation = (float) Math.Atan2((double) num2 * (double) num5, (double) num1 * (double) num5); } bool flag = true; if ((double) num1 == 0.0 && (double) num2 == 0.0) { flag = false; } else { float num6 = 12f / (float) Math.Sqrt((double) num1 * (double) num1 + (double) num2 * (double) num2); float num7 = num1 * num6; float num8 = num2 * num6; vector2.X -= num7 * 0.1f; vector2.Y -= num8 * 0.1f; num1 = projectile.position.X + (float) projectile.width * 0.5f - vector2.X; num2 = projectile.position.Y + (float) projectile.height * 0.5f - vector2.Y; } while (flag) { float num9 = 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) { num9 = f1 - 8f; flag = false; } float num10 = 12f / f1; float num11 = num1 * num10; float num12 = num2 * num10; vector2.X += num11; vector2.Y += num12; num1 = projectile.position.X + (float) projectile.width * 0.5f - vector2.X; num2 = projectile.position.Y + (float) projectile.height * 0.1f - vector2.Y; if ((double) f2 > 12.0) { float num13 = 0.3f; float num14 = Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y); if ((double) num14 > 16.0) num14 = 16f; float num15 = (float) (1.0 - (double) num14 / 16.0); float num16 = num13 * num15; float num17 = f2 / 80f; if ((double) num17 > 1.0) num17 = 1f; float num18 = num16 * num17; if ((double) num18 < 0.0) num18 = 0.0f; float num19 = num18 * num17 * 0.5f; if ((double) num2 > 0.0) { num2 *= 1f + num19; num1 *= 1f - num19; } else { float num20 = Math.Abs(projectile.velocity.X) / 3f; if ((double) num20 > 1.0) num20 = 1f; float num21 = num20 - 0.5f; float num22 = num19 * num21; if ((double) num22 > 0.0) num22 *= 2f; num2 *= 1f + num22; num1 *= 1f - num22; } } float rotation = (float) Math.Atan2((double) num2, (double) num1) - 1.57f; int stringColor = Main.player[projectile.owner].stringColor; Microsoft.Xna.Framework.Color color = WorldGen.paintColor(stringColor); if (color.R < (byte) 75) color.R = (byte) 75; if (color.G < (byte) 75) color.G = (byte) 75; if (color.B < (byte) 75) color.B = (byte) 75; switch (stringColor) { case 0: case 14: color = new Microsoft.Xna.Framework.Color(200, 200, 200); break; case 13: color = new Microsoft.Xna.Framework.Color(20, 20, 20); break; case 27: color = new Microsoft.Xna.Framework.Color(Main.DiscoR, Main.DiscoG, Main.DiscoB); break; case 28: color = new Microsoft.Xna.Framework.Color(163, 116, 91); break; } color.A = (byte) ((double) color.A * 0.400000005960464); float num23 = 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) num23), (int) (byte) ((double) color.G * (double) num23), (int) (byte) ((double) color.B * (double) num23), (int) (byte) ((double) color.A * (double) num23)); Main.spriteBatch.Draw(Main.fishingLineTexture, new Vector2((float) ((double) vector2.X - (double) Main.screenPosition.X + (double) Main.fishingLineTexture.Width * 0.5), (float) ((double) vector2.Y - (double) Main.screenPosition.Y + (double) Main.fishingLineTexture.Height * 0.5)) - new Vector2(6f, 0.0f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.fishingLineTexture.Width, (int) num9)), color, rotation, new Vector2((float) Main.fishingLineTexture.Width * 0.5f, 0.0f), 1f, SpriteEffects.None, 0.0f); } } } if (projectile.bobber && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].holdStyle > 0) { x1 = mountedCenter.X; y1 = mountedCenter.Y + Main.player[projectile.owner].gfxOffY; int type = Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type; float gravDir = Main.player[projectile.owner].gravDir; switch (type) { case 2289: x1 += (float) (43 * Main.player[projectile.owner].direction); if (Main.player[projectile.owner].direction < 0) x1 -= 13f; y1 -= 36f * gravDir; break; case 2291: x1 += (float) (43 * Main.player[projectile.owner].direction); if (Main.player[projectile.owner].direction < 0) x1 -= 13f; y1 -= 34f * gravDir; break; case 2292: x1 += (float) (46 * Main.player[projectile.owner].direction); if (Main.player[projectile.owner].direction < 0) x1 -= 13f; y1 -= 34f * gravDir; break; case 2293: x1 += (float) (43 * Main.player[projectile.owner].direction); if (Main.player[projectile.owner].direction < 0) x1 -= 13f; y1 -= 34f * gravDir; break; case 2294: x1 += (float) (43 * Main.player[projectile.owner].direction); if (Main.player[projectile.owner].direction < 0) x1 -= 13f; y1 -= 30f * gravDir; break; case 2295: x1 += (float) (43 * Main.player[projectile.owner].direction); if (Main.player[projectile.owner].direction < 0) x1 -= 13f; y1 -= 30f * gravDir; break; case 2296: x1 += (float) (43 * Main.player[projectile.owner].direction); if (Main.player[projectile.owner].direction < 0) x1 -= 13f; y1 -= 30f * gravDir; break; case 2421: x1 += (float) (47 * Main.player[projectile.owner].direction); if (Main.player[projectile.owner].direction < 0) x1 -= 13f; y1 -= 36f * gravDir; break; case 2422: x1 += (float) (47 * Main.player[projectile.owner].direction); if (Main.player[projectile.owner].direction < 0) x1 -= 13f; y1 -= 32f * gravDir; break; } if ((double) gravDir == -1.0) y1 -= 12f; Vector2 vector2_1 = new Vector2(x1, y1); Vector2 vector2_2 = Main.player[projectile.owner].RotatedRelativePoint(vector2_1 + new Vector2(8f)) - new Vector2(8f); float num24 = projectile.position.X + (float) projectile.width * 0.5f - vector2_2.X; float num25 = projectile.position.Y + (float) projectile.height * 0.5f - vector2_2.Y; Math.Sqrt((double) num24 * (double) num24 + (double) num25 * (double) num25); float num26 = (float) Math.Atan2((double) num25, (double) num24) - 1.57f; bool flag = true; if ((double) num24 == 0.0 && (double) num25 == 0.0) { flag = false; } else { float num27 = 12f / (float) Math.Sqrt((double) num24 * (double) num24 + (double) num25 * (double) num25); float num28 = num24 * num27; float num29 = num25 * num27; vector2_2.X -= num28; vector2_2.Y -= num29; num24 = projectile.position.X + (float) projectile.width * 0.5f - vector2_2.X; num25 = projectile.position.Y + (float) projectile.height * 0.5f - vector2_2.Y; } while (flag) { float num30 = 12f; float f3 = (float) Math.Sqrt((double) num24 * (double) num24 + (double) num25 * (double) num25); float f4 = f3; if (float.IsNaN(f3) || float.IsNaN(f4)) { flag = false; } else { if ((double) f3 < 20.0) { num30 = f3 - 8f; flag = false; } float num31 = 12f / f3; float num32 = num24 * num31; float num33 = num25 * num31; vector2_2.X += num32; vector2_2.Y += num33; num24 = projectile.position.X + (float) projectile.width * 0.5f - vector2_2.X; num25 = projectile.position.Y + (float) projectile.height * 0.1f - vector2_2.Y; if ((double) f4 > 12.0) { float num34 = 0.3f; float num35 = Math.Abs(projectile.velocity.X) + Math.Abs(projectile.velocity.Y); if ((double) num35 > 16.0) num35 = 16f; float num36 = (float) (1.0 - (double) num35 / 16.0); float num37 = num34 * num36; float num38 = f4 / 80f; if ((double) num38 > 1.0) num38 = 1f; float num39 = num37 * num38; if ((double) num39 < 0.0) num39 = 0.0f; float num40 = (float) (1.0 - (double) projectile.localAI[0] / 100.0); float num41 = num39 * num40; if ((double) num25 > 0.0) { num25 *= 1f + num41; num24 *= 1f - num41; } else { float num42 = Math.Abs(projectile.velocity.X) / 3f; if ((double) num42 > 1.0) num42 = 1f; float num43 = num42 - 0.5f; float num44 = num41 * num43; if ((double) num44 > 0.0) num44 *= 2f; num25 *= 1f + num44; num24 *= 1f - num44; } } float rotation = (float) Math.Atan2((double) num25, (double) num24) - 1.57f; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2_2.X / 16, (int) ((double) vector2_2.Y / 16.0), new Microsoft.Xna.Framework.Color(200, 200, 200, 100)); if (type == 2294) color = Lighting.GetColor((int) vector2_2.X / 16, (int) ((double) vector2_2.Y / 16.0), new Microsoft.Xna.Framework.Color(100, 180, 230, 100)); if (type == 2295) color = Lighting.GetColor((int) vector2_2.X / 16, (int) ((double) vector2_2.Y / 16.0), new Microsoft.Xna.Framework.Color(250, 90, 70, 100)); if (type == 2293) color = Lighting.GetColor((int) vector2_2.X / 16, (int) ((double) vector2_2.Y / 16.0), new Microsoft.Xna.Framework.Color(203, 190, 210, 100)); if (type == 2421) color = Lighting.GetColor((int) vector2_2.X / 16, (int) ((double) vector2_2.Y / 16.0), new Microsoft.Xna.Framework.Color(183, 77, 112, 100)); if (type == 2422) color = Lighting.GetColor((int) vector2_2.X / 16, (int) ((double) vector2_2.Y / 16.0), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, 226, 116, 100)); Main.spriteBatch.Draw(Main.fishingLineTexture, new Vector2((float) ((double) vector2_2.X - (double) Main.screenPosition.X + (double) Main.fishingLineTexture.Width * 0.5), (float) ((double) vector2_2.Y - (double) Main.screenPosition.Y + (double) Main.fishingLineTexture.Height * 0.5)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.fishingLineTexture.Width, (int) num30)), color, rotation, new Vector2((float) Main.fishingLineTexture.Width * 0.5f, 0.0f), 1f, SpriteEffects.None, 0.0f); } } } else if (projectile.type == 32) { Vector2 vector2 = new Vector2(projectile.position.X + (float) projectile.width * 0.5f, projectile.position.Y + (float) projectile.height * 0.5f); float num45 = mountedCenter.X - vector2.X; float num46 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num46, (double) num45) - 1.57f; bool flag = true; if ((double) num45 == 0.0 && (double) num46 == 0.0) { flag = false; } else { float num47 = 8f / (float) Math.Sqrt((double) num45 * (double) num45 + (double) num46 * (double) num46); float num48 = num45 * num47; float num49 = num46 * num47; vector2.X -= num48; vector2.Y -= num49; num45 = mountedCenter.X - vector2.X; num46 = mountedCenter.Y - vector2.Y; } while (flag) { float f = (float) Math.Sqrt((double) num45 * (double) num45 + (double) num46 * (double) num46); if ((double) f < 28.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num50 = 28f / f; float num51 = num45 * num50; float num52 = num46 * num50; vector2.X += num51; vector2.Y += num52; num45 = mountedCenter.X - vector2.X; num46 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.spriteBatch.Draw(Main.chain5Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain5Texture.Width, Main.chain5Texture.Height)), color, rotation, new Vector2((float) Main.chain5Texture.Width * 0.5f, (float) Main.chain5Texture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); } } } else if (projectile.type == 73) { Vector2 vector2 = new Vector2(projectile.position.X + (float) projectile.width * 0.5f, projectile.position.Y + (float) projectile.height * 0.5f); float num53 = mountedCenter.X - vector2.X; float num54 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num54, (double) num53) - 1.57f; bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num53 * (double) num53 + (double) num54 * (double) num54); if ((double) f < 25.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num55 = 12f / f; float num56 = num53 * num55; float num57 = num54 * num55; vector2.X += num56; vector2.Y += num57; num53 = mountedCenter.X - vector2.X; num54 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.spriteBatch.Draw(Main.chain8Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain8Texture.Width, Main.chain8Texture.Height)), color, rotation, new Vector2((float) Main.chain8Texture.Width * 0.5f, (float) Main.chain8Texture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); } } } else if (projectile.type == 186) { Vector2 vector2 = new Vector2(projectile.localAI[0], projectile.localAI[1]); float num58 = Vector2.Distance(projectile.Center, vector2) - projectile.velocity.Length(); float num59 = (float) Main.chain17Texture.Height - num58; if ((double) num58 > 0.0 && (double) projectile.ai[1] > 0.0) { Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) projectile.position.X / 16, (int) projectile.position.Y / 16); Main.spriteBatch.Draw(Main.chain17Texture, vector2 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, (int) num59, Main.chain17Texture.Width, (int) num58)), color, projectile.rotation, new Vector2((float) (Main.chain17Texture.Width / 2), 0.0f), 1f, SpriteEffects.None, 0.0f); } } else if (projectile.type == 74) { Vector2 vector2 = new Vector2(projectile.position.X + (float) projectile.width * 0.5f, projectile.position.Y + (float) projectile.height * 0.5f); float num60 = mountedCenter.X - vector2.X; float num61 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num61, (double) num60) - 1.57f; bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num60 * (double) num60 + (double) num61 * (double) num61); if ((double) f < 25.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num62 = 12f / f; float num63 = num60 * num62; float num64 = num61 * num62; vector2.X += num63; vector2.Y += num64; num60 = mountedCenter.X - vector2.X; num61 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.spriteBatch.Draw(Main.chain9Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain8Texture.Width, Main.chain8Texture.Height)), color, rotation, new Vector2((float) Main.chain8Texture.Width * 0.5f, (float) Main.chain8Texture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); } } } else if (projectile.type == 171) { Vector2 vector2 = new Vector2(projectile.position.X + (float) projectile.width * 0.5f, projectile.position.Y + (float) projectile.height * 0.5f); float num65 = -projectile.velocity.X; float num66 = -projectile.velocity.Y; float num67 = 1f; if ((double) projectile.ai[0] <= 17.0) num67 = projectile.ai[0] / 17f; int length = (int) (30.0 * (double) num67); float num68 = 1f; if ((double) projectile.ai[0] <= 30.0) num68 = projectile.ai[0] / 30f; float num69 = 0.4f * num68; float num70 = num69; float num71 = num66 + num70; Vector2[] vector2Array = new Vector2[length]; float[] numArray = new float[length]; for (int index = 0; index < length; ++index) { float num72 = (float) Math.Sqrt((double) num65 * (double) num65 + (double) num71 * (double) num71); float num73 = 5.6f; if ((double) Math.Abs(num65) + (double) Math.Abs(num71) < 1.0) num73 *= Math.Abs(num65) + Math.Abs(num71) / 1f; float num74 = num73 / num72; float num75 = num65 * num74; float num76 = num71 * num74; float num77 = (float) Math.Atan2((double) num76, (double) num75) - 1.57f; vector2Array[index].X = vector2.X; vector2Array[index].Y = vector2.Y; numArray[index] = num77; vector2.X += num75; vector2.Y += num76; num65 = -projectile.velocity.X; float num78 = -projectile.velocity.Y; num70 += num69; num71 = num78 + num70; } int num79; for (int index = num79 = 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.spriteBatch.Draw(Main.chain16Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain16Texture.Width, Main.chain16Texture.Height)), color, rotation, new Vector2((float) Main.chain16Texture.Width * 0.5f, (float) Main.chain16Texture.Height * 0.5f), 0.8f, SpriteEffects.None, 0.0f); } } else if (projectile.type == 475) { Vector2 vector2 = new Vector2(projectile.position.X + (float) projectile.width * 0.5f, projectile.position.Y + (float) projectile.height * 0.5f); float num80 = -projectile.velocity.X; float num81 = -projectile.velocity.Y; float num82 = 1f; if ((double) projectile.ai[0] <= 17.0) num82 = projectile.ai[0] / 17f; int length = (int) (30.0 * (double) num82); float num83 = 1f; if ((double) projectile.ai[0] <= 30.0) num83 = projectile.ai[0] / 30f; float num84 = 0.4f * num83; float num85 = num84; float num86 = num81 + num85; Vector2[] vector2Array = new Vector2[length]; float[] numArray = new float[length]; for (int index = 0; index < length; ++index) { float num87 = (float) Math.Sqrt((double) num80 * (double) num80 + (double) num86 * (double) num86); float num88 = 5.6f; if ((double) Math.Abs(num80) + (double) Math.Abs(num86) < 1.0) num88 *= Math.Abs(num80) + Math.Abs(num86) / 1f; float num89 = num88 / num87; float num90 = num80 * num89; float num91 = num86 * num89; float num92 = (float) Math.Atan2((double) num91, (double) num90) - 1.57f; vector2Array[index].X = vector2.X; vector2Array[index].Y = vector2.Y; numArray[index] = num92; vector2.X += num90; vector2.Y += num91; num80 = -projectile.velocity.X; float num93 = -projectile.velocity.Y; num85 += num84; num86 = num93 + num85; } int num94 = 0; int num95; for (int index = num95 = 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 (num94 % 2 == 0) Main.spriteBatch.Draw(Main.chain38Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain38Texture.Width, Main.chain38Texture.Height)), color, rotation, new Vector2((float) Main.chain38Texture.Width * 0.5f, (float) Main.chain38Texture.Height * 0.5f), 0.8f, SpriteEffects.None, 0.0f); else Main.spriteBatch.Draw(Main.chain39Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain39Texture.Width, Main.chain39Texture.Height)), color, rotation, new Vector2((float) Main.chain39Texture.Width * 0.5f, (float) Main.chain39Texture.Height * 0.5f), 0.8f, SpriteEffects.None, 0.0f); ++num94; } } else if (projectile.type == 505 || projectile.type == 506) { Vector2 vector2 = new Vector2(projectile.position.X + (float) projectile.width * 0.5f, projectile.position.Y + (float) projectile.height * 0.5f); float num96 = -projectile.velocity.X; float num97 = -projectile.velocity.Y; float num98 = 1f; if ((double) projectile.ai[0] <= 17.0) num98 = projectile.ai[0] / 17f; int length = (int) (30.0 * (double) num98); float num99 = 1f; if ((double) projectile.ai[0] <= 30.0) num99 = projectile.ai[0] / 30f; float num100 = 0.4f * num99; float num101 = num100; float num102 = num97 + num101; Vector2[] vector2Array = new Vector2[length]; float[] numArray = new float[length]; for (int index = 0; index < length; ++index) { float num103 = (float) Math.Sqrt((double) num96 * (double) num96 + (double) num102 * (double) num102); float num104 = 5.6f; if ((double) Math.Abs(num96) + (double) Math.Abs(num102) < 1.0) num104 *= Math.Abs(num96) + Math.Abs(num102) / 1f; float num105 = num104 / num103; float num106 = num96 * num105; float num107 = num102 * num105; float num108 = (float) Math.Atan2((double) num107, (double) num106) - 1.57f; vector2Array[index].X = vector2.X; vector2Array[index].Y = vector2.Y; numArray[index] = num108; vector2.X += num106; vector2.Y += num107; num96 = -projectile.velocity.X; float num109 = -projectile.velocity.Y; num101 += num100; num102 = num109 + num101; } int num110 = 0; int num111; for (int index1 = num111 = 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 num112 = 4; if (projectile.type == 506) num112 = 6; int index2 = num112 + num110 % 2; Main.spriteBatch.Draw(Main.chainsTexture[index2], new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chainsTexture[index2].Width, Main.chainsTexture[index2].Height)), color, rotation, new Vector2((float) Main.chainsTexture[index2].Width * 0.5f, (float) Main.chainsTexture[index2].Height * 0.5f), 0.8f, SpriteEffects.None, 0.0f); ++num110; } } else if (projectile.type == 165) { Vector2 vector2 = new Vector2(projectile.position.X + (float) projectile.width * 0.5f, projectile.position.Y + (float) projectile.height * 0.5f); float num113 = mountedCenter.X - vector2.X; float num114 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num114, (double) num113) - 1.57f; bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num113 * (double) num113 + (double) num114 * (double) num114); if ((double) f < 25.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num115 = 24f / f; float num116 = num113 * num115; float num117 = num114 * num115; vector2.X += num116; vector2.Y += num117; num113 = mountedCenter.X - vector2.X; num114 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.spriteBatch.Draw(Main.chain15Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain15Texture.Width, Main.chain15Texture.Height)), color, rotation, new Vector2((float) Main.chain15Texture.Width * 0.5f, (float) Main.chain15Texture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); } } } else if (projectile.type >= 230 && projectile.type <= 235) { int index = projectile.type - 229; Vector2 vector2 = new Vector2(projectile.position.X + (float) projectile.width * 0.5f, projectile.position.Y + (float) projectile.height * 0.5f); float num118 = mountedCenter.X - vector2.X; float num119 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num119, (double) num118) - 1.57f; bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num118 * (double) num118 + (double) num119 * (double) num119); if ((double) f < 25.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num120 = (float) Main.gemChainTexture[index].Height / f; float num121 = num118 * num120; float num122 = num119 * num120; vector2.X += num121; vector2.Y += num122; num118 = mountedCenter.X - vector2.X; num119 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.spriteBatch.Draw(Main.gemChainTexture[index], new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.gemChainTexture[index].Width, Main.gemChainTexture[index].Height)), color, rotation, new Vector2((float) Main.gemChainTexture[index].Width * 0.5f, (float) Main.gemChainTexture[index].Height * 0.5f), 1f, SpriteEffects.None, 0.0f); } } } else if (projectile.type == 256) { Vector2 vector2 = new Vector2(projectile.position.X + (float) projectile.width * 0.5f, projectile.position.Y + (float) projectile.height * 0.5f); float num123 = mountedCenter.X - vector2.X; float num124 = mountedCenter.Y - vector2.Y; float num125 = (float) Math.Atan2((double) num124, (double) num123) - 1.57f; bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num123 * (double) num123 + (double) num124 * (double) num124); if ((double) f < 26.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num126 = 26f / f; float num127 = num123 * num126; float num128 = num124 * num126; vector2.X += num127; vector2.Y += num128; num123 = Main.player[projectile.owner].position.X + (float) (Main.player[projectile.owner].width / 2) - vector2.X; num124 = Main.player[projectile.owner].position.Y + (float) (Main.player[projectile.owner].height / 2) - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.spriteBatch.Draw(Main.chain20Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain20Texture.Width, Main.chain20Texture.Height)), color, num125 - 0.785f, new Vector2((float) Main.chain20Texture.Width * 0.5f, (float) Main.chain20Texture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); } } } else if (projectile.type == 322) { Vector2 vector2 = new Vector2(projectile.position.X + (float) projectile.width * 0.5f, projectile.position.Y + (float) projectile.height * 0.5f); float num129 = mountedCenter.X - vector2.X; float num130 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num130, (double) num129) - 1.57f; bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num129 * (double) num129 + (double) num130 * (double) num130); if ((double) f < 22.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num131 = 22f / f; float num132 = num129 * num131; float num133 = num130 * num131; vector2.X += num132; vector2.Y += num133; num129 = mountedCenter.X - vector2.X; num130 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.spriteBatch.Draw(Main.chain29Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain29Texture.Width, Main.chain29Texture.Height)), color, rotation, new Vector2((float) Main.chain29Texture.Width * 0.5f, (float) Main.chain29Texture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); } } } else if (projectile.type == 315) { Vector2 vector2 = new Vector2(projectile.position.X + (float) projectile.width * 0.5f, projectile.position.Y + (float) projectile.height * 0.5f); float num134 = mountedCenter.X - vector2.X; float num135 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num135, (double) num134) - 1.57f; bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num134 * (double) num134 + (double) num135 * (double) num135); if ((double) f < 50.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num136 = 40f / f; float num137 = num134 * num136; float num138 = num135 * num136; vector2.X += num137; vector2.Y += num138; num134 = mountedCenter.X - vector2.X; num135 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.spriteBatch.Draw(Main.chain28Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain28Texture.Width, Main.chain28Texture.Height)), color, rotation, new Vector2((float) Main.chain28Texture.Width * 0.5f, (float) Main.chain28Texture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); } } } else if (projectile.type == 331) { Vector2 vector2 = new Vector2(projectile.position.X + (float) projectile.width * 0.5f, projectile.position.Y + (float) projectile.height * 0.5f); float num139 = mountedCenter.X - vector2.X; float num140 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num140, (double) num139) - 1.57f; bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num139 * (double) num139 + (double) num140 * (double) num140); if ((double) f < 30.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num141 = 24f / f; float num142 = num139 * num141; float num143 = num140 * num141; vector2.X += num142; vector2.Y += num143; num139 = mountedCenter.X - vector2.X; num140 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.spriteBatch.Draw(Main.chain30Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain30Texture.Width, Main.chain30Texture.Height)), color, rotation, new Vector2((float) Main.chain30Texture.Width * 0.5f, (float) Main.chain30Texture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); } } } else if (projectile.type == 332) { int num144 = 0; Vector2 vector2 = new Vector2(projectile.position.X + (float) projectile.width * 0.5f, projectile.position.Y + (float) projectile.height * 0.5f); float num145 = mountedCenter.X - vector2.X; float num146 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num146, (double) num145) - 1.57f; bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num145 * (double) num145 + (double) num146 * (double) num146); 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 (num144 == 0) Lighting.AddLight(i1, j, 0.0f, 0.2f, 0.2f); if (num144 == 1) Lighting.AddLight(i1, j, 0.1f, 0.2f, 0.0f); if (num144 == 2) Lighting.AddLight(i1, j, 0.2f, 0.1f, 0.0f); if (num144 == 3) Lighting.AddLight(i1, j, 0.2f, 0.0f, 0.2f); float num147 = 16f / f; float num148 = num145 * num147; float num149 = num146 * num147; vector2.X += num148; vector2.Y += num149; num145 = mountedCenter.X - vector2.X; num146 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.spriteBatch.Draw(Main.chain31Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.chain31Texture.Height / 4 * num144, Main.chain31Texture.Width, Main.chain31Texture.Height / 4)), color, rotation, new Vector2((float) Main.chain30Texture.Width * 0.5f, (float) (Main.chain30Texture.Height / 8)), 1f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(Main.chain32Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.chain31Texture.Height / 4 * num144, Main.chain31Texture.Width, Main.chain31Texture.Height / 4)), new Microsoft.Xna.Framework.Color(200, 200, 200, 0), rotation, new Vector2((float) Main.chain30Texture.Width * 0.5f, (float) (Main.chain30Texture.Height / 8)), 1f, SpriteEffects.None, 0.0f); ++num144; if (num144 > 3) num144 = 0; } } } else if (projectile.type == 372 || projectile.type == 383 || projectile.type == 396 || projectile.type == 403 || projectile.type == 404 || projectile.type == 446 || projectile.type >= 486 && projectile.type <= 489 || projectile.type >= 646 && projectile.type <= 649 || projectile.type == 652) { Texture2D texture1 = (Texture2D) null; Microsoft.Xna.Framework.Color color1 = Microsoft.Xna.Framework.Color.Transparent; Texture2D texture2 = Main.chain33Texture; if (projectile.type == 383) texture2 = Main.chain34Texture; if (projectile.type == 396) texture2 = Main.chain35Texture; if (projectile.type == 403) texture2 = Main.chain36Texture; if (projectile.type == 404) texture2 = Main.chain37Texture; if (projectile.type == 446) texture2 = Main.extraTexture[3]; if (projectile.type >= 486 && projectile.type <= 489) texture2 = Main.chainsTexture[projectile.type - 486]; if (projectile.type >= 646 && projectile.type <= 649) { texture2 = Main.chainsTexture[projectile.type - 646 + 8]; texture1 = Main.chainsTexture[projectile.type - 646 + 12]; color1 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue); } if (projectile.type == 652) texture2 = Main.chainsTexture[16]; Vector2 position = projectile.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 num150 = 0.0f; if (projectile.type == 446) { int num151 = 7; int num152 = (int) projectile.localAI[0] / num151; sourceRectangle = new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, texture2.Height / 4 * num152, texture2.Width, texture2.Height / 4)); origin.Y /= 4f; height /= 4f; } switch (projectile.type) { case 383: num150 = 14f; break; case 446: num150 = 20f; break; case 487: num150 = 8f; break; case 489: num150 = 10f; break; } if ((double) num150 != 0.0) { float num153 = -1.57f; Vector2 vector2_3 = new Vector2((float) Math.Cos((double) projectile.rotation + (double) num153), (float) Math.Sin((double) projectile.rotation + (double) num153)); Vector2 vector2_4 = position - vector2_3 * num150; Vector2 vector2_5 = mountedCenter - vector2_4; vector2_5.Normalize(); position = vector2_4 - vector2_5 * height / 2f; } Vector2 vector2_6 = mountedCenter - position; float rotation = (float) Math.Atan2((double) vector2_6.Y, (double) vector2_6.X) - 1.57f; bool flag = true; if (float.IsNaN(position.X) && float.IsNaN(position.Y)) flag = false; if (float.IsNaN(vector2_6.X) && float.IsNaN(vector2_6.Y)) flag = false; while (flag) { if ((double) vector2_6.Length() < (double) height + 1.0) { flag = false; } else { Vector2 vector2_7 = vector2_6; vector2_7.Normalize(); position += vector2_7 * height; vector2_6 = mountedCenter - position; Microsoft.Xna.Framework.Color color2 = Lighting.GetColor((int) position.X / 16, (int) ((double) position.Y / 16.0)); if (projectile.type == 396) color2 *= (float) ((int) byte.MaxValue - projectile.alpha) / (float) byte.MaxValue; if (projectile.type == 446) color2 = projectile.GetAlpha(color2); if (projectile.type == 488) { Lighting.AddLight(position, 0.2f, 0.0f, 0.175f); color2 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue); } if (projectile.type >= 646 && projectile.type <= 649) color2 = projectile.GetAlpha(color2); Main.spriteBatch.Draw(texture2, position - Main.screenPosition, sourceRectangle, color2, rotation, origin, 1f, SpriteEffects.None, 0.0f); if (texture1 != null) Main.spriteBatch.Draw(texture1, position - Main.screenPosition, sourceRectangle, color1, rotation, origin, 1f, SpriteEffects.None, 0.0f); } } } else if (projectile.aiStyle == 7) { Vector2 vector2 = new Vector2(projectile.position.X + (float) projectile.width * 0.5f, projectile.position.Y + (float) projectile.height * 0.5f); float num154 = mountedCenter.X - vector2.X; float num155 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num155, (double) num154) - 1.57f; bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num154 * (double) num154 + (double) num155 * (double) num155); if ((double) f < 25.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num156 = 12f / f; float num157 = num154 * num156; float num158 = num155 * num156; vector2.X += num157; vector2.Y += num158; num154 = mountedCenter.X - vector2.X; num155 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.spriteBatch.Draw(Main.chainTexture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chainTexture.Width, Main.chainTexture.Height)), color, rotation, new Vector2((float) Main.chainTexture.Width * 0.5f, (float) Main.chainTexture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); } } } else if (projectile.type == 262) { float x2 = projectile.Center.X; float y2 = projectile.Center.Y; float x3 = projectile.velocity.X; float y3 = projectile.velocity.Y; float num159 = 4f / (float) Math.Sqrt((double) x3 * (double) x3 + (double) y3 * (double) y3); float x4; float y4; if ((double) projectile.ai[0] == 0.0) { x4 = x2 - projectile.velocity.X * num159; y4 = y2 - projectile.velocity.Y * num159; } else { x4 = x2 + projectile.velocity.X * num159; y4 = y2 + projectile.velocity.Y * num159; } Vector2 vector2 = new Vector2(x4, y4); float num160 = mountedCenter.X - vector2.X; float num161 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num161, (double) num160) - 1.57f; if (projectile.alpha == 0) { int num162 = -1; if ((double) projectile.position.X + (double) (projectile.width / 2) < (double) mountedCenter.X) num162 = 1; Main.player[projectile.owner].itemRotation = Main.player[projectile.owner].direction != 1 ? (float) Math.Atan2((double) num161 * (double) num162, (double) num160 * (double) num162) : (float) Math.Atan2((double) num161 * (double) num162, (double) num160 * (double) num162); } bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num160 * (double) num160 + (double) num161 * (double) num161); if ((double) f < 25.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num163 = 12f / f; float num164 = num160 * num163; float num165 = num161 * num163; vector2.X += num164; vector2.Y += num165; num160 = mountedCenter.X - vector2.X; num161 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.spriteBatch.Draw(Main.chain22Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain22Texture.Width, Main.chain22Texture.Height)), color, rotation, new Vector2((float) Main.chain22Texture.Width * 0.5f, (float) Main.chain22Texture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); } } } else if (projectile.type == 273) { float x5 = projectile.Center.X; float y5 = projectile.Center.Y; float x6 = projectile.velocity.X; float y6 = projectile.velocity.Y; float num166 = 4f / (float) Math.Sqrt((double) x6 * (double) x6 + (double) y6 * (double) y6); float x7; float y7; if ((double) projectile.ai[0] == 0.0) { x7 = x5 - projectile.velocity.X * num166; y7 = y5 - projectile.velocity.Y * num166; } else { x7 = x5 + projectile.velocity.X * num166; y7 = y5 + projectile.velocity.Y * num166; } Vector2 vector2 = new Vector2(x7, y7); float num167 = mountedCenter.X - vector2.X; float num168 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num168, (double) num167) - 1.57f; if (projectile.alpha == 0) { int num169 = -1; if ((double) projectile.position.X + (double) (projectile.width / 2) < (double) mountedCenter.X) num169 = 1; Main.player[projectile.owner].itemRotation = Main.player[projectile.owner].direction != 1 ? (float) Math.Atan2((double) num168 * (double) num169, (double) num167 * (double) num169) : (float) Math.Atan2((double) num168 * (double) num169, (double) num167 * (double) num169); } bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num167 * (double) num167 + (double) num168 * (double) num168); if ((double) f < 25.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num170 = 12f / f; float num171 = num167 * num170; float num172 = num168 * num170; vector2.X += num171; vector2.Y += num172; num167 = mountedCenter.X - vector2.X; num168 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.spriteBatch.Draw(Main.chain23Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain23Texture.Width, Main.chain23Texture.Height)), color, rotation, new Vector2((float) Main.chain23Texture.Width * 0.5f, (float) Main.chain23Texture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); } } } else if (projectile.type == 481) { float x8 = projectile.Center.X; float y8 = projectile.Center.Y; float x9 = projectile.velocity.X; float y9 = projectile.velocity.Y; float num173 = 4f / (float) Math.Sqrt((double) x9 * (double) x9 + (double) y9 * (double) y9); float x10; float y10; if ((double) projectile.ai[0] == 0.0) { x10 = x8 - projectile.velocity.X * num173; y10 = y8 - projectile.velocity.Y * num173; } else { x10 = x8 + projectile.velocity.X * num173; y10 = y8 + projectile.velocity.Y * num173; } Vector2 vector2 = new Vector2(x10, y10); float num174 = mountedCenter.X - vector2.X; float num175 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num175, (double) num174) - 1.57f; if (projectile.alpha == 0) { int num176 = -1; if ((double) projectile.position.X + (double) (projectile.width / 2) < (double) mountedCenter.X) num176 = 1; Main.player[projectile.owner].itemRotation = Main.player[projectile.owner].direction != 1 ? (float) Math.Atan2((double) num175 * (double) num176, (double) num174 * (double) num176) : (float) Math.Atan2((double) num175 * (double) num176, (double) num174 * (double) num176); } bool flag = true; while (flag) { float scale = 0.85f; float f5 = (float) Math.Sqrt((double) num174 * (double) num174 + (double) num175 * (double) num175); float num177 = f5; if ((double) f5 < (double) Main.chain40Texture.Height * 1.5) flag = false; else if (float.IsNaN(f5)) { flag = false; } else { float num178 = (float) Main.chain40Texture.Height * scale / f5; float num179 = num174 * num178; float num180 = num175 * num178; vector2.X += num179; vector2.Y += num180; num174 = mountedCenter.X - vector2.X; num175 = mountedCenter.Y - vector2.Y; if ((double) num177 > (double) (Main.chain40Texture.Height * 2)) { for (int index = 0; index < 2; ++index) { float num181 = 0.75f; float num182 = index != 0 ? Math.Abs(Main.player[projectile.owner].velocity.Y) : Math.Abs(Main.player[projectile.owner].velocity.X); if ((double) num182 > 10.0) num182 = 10f; float num183 = num182 / 10f; float num184 = num181 * num183; float num185 = num177 / 80f; if ((double) num185 > 1.0) num185 = 1f; float f6 = num184 * num185; if ((double) f6 < 0.0) f6 = 0.0f; if (!float.IsNaN(f6)) { if (index == 0) { if ((double) Main.player[projectile.owner].velocity.X < 0.0 && (double) projectile.Center.X < (double) mountedCenter.X) num175 *= 1f - f6; if ((double) Main.player[projectile.owner].velocity.X > 0.0 && (double) projectile.Center.X > (double) mountedCenter.X) num175 *= 1f - f6; } else { if ((double) Main.player[projectile.owner].velocity.Y < 0.0 && (double) projectile.Center.Y < (double) mountedCenter.Y) num174 *= 1f - f6; if ((double) Main.player[projectile.owner].velocity.Y > 0.0 && (double) projectile.Center.Y > (double) mountedCenter.Y) num174 *= 1f - f6; } } } } Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.spriteBatch.Draw(Main.chain40Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain40Texture.Width, Main.chain40Texture.Height)), color, rotation, new Vector2((float) Main.chain40Texture.Width * 0.5f, (float) Main.chain40Texture.Height * 0.5f), scale, SpriteEffects.None, 0.0f); } } } else if (projectile.type == 271) { float x11 = projectile.Center.X; float y11 = projectile.Center.Y; float x12 = projectile.velocity.X; float y12 = projectile.velocity.Y; float num186 = 4f / (float) Math.Sqrt((double) x12 * (double) x12 + (double) y12 * (double) y12); float x13; float y13; if ((double) projectile.ai[0] == 0.0) { x13 = x11 - projectile.velocity.X * num186; y13 = y11 - projectile.velocity.Y * num186; } else { x13 = x11 + projectile.velocity.X * num186; y13 = y11 + projectile.velocity.Y * num186; } Vector2 vector2 = new Vector2(x13, y13); float num187 = mountedCenter.X - vector2.X; float num188 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num188, (double) num187) - 1.57f; if (projectile.alpha == 0) { int num189 = -1; if ((double) projectile.position.X + (double) (projectile.width / 2) < (double) mountedCenter.X) num189 = 1; Main.player[projectile.owner].itemRotation = Main.player[projectile.owner].direction != 1 ? (float) Math.Atan2((double) num188 * (double) num189, (double) num187 * (double) num189) : (float) Math.Atan2((double) num188 * (double) num189, (double) num187 * (double) num189); } bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num187 * (double) num187 + (double) num188 * (double) num188); if ((double) f < 25.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num190 = 12f / f; float num191 = num187 * num190; float num192 = num188 * num190; vector2.X += num191; vector2.Y += num192; num187 = mountedCenter.X - vector2.X; num188 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.spriteBatch.Draw(Main.chain18Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain18Texture.Width, Main.chain18Texture.Height)), color, rotation, new Vector2((float) Main.chain18Texture.Width * 0.5f, (float) Main.chain18Texture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); } } } else if (projectile.aiStyle == 13) { float num193 = projectile.position.X + 8f; float num194 = projectile.position.Y + 2f; float x14 = projectile.velocity.X; float num195 = projectile.velocity.Y; if ((double) x14 == 0.0 && (double) num195 == 0.0) num195 = 0.0001f; float num196 = 20f / (float) Math.Sqrt((double) x14 * (double) x14 + (double) num195 * (double) num195); float x15; float y14; if ((double) projectile.ai[0] == 0.0) { x15 = num193 - projectile.velocity.X * num196; y14 = num194 - projectile.velocity.Y * num196; } else { x15 = num193 + projectile.velocity.X * num196; y14 = num194 + projectile.velocity.Y * num196; } Vector2 vector2 = new Vector2(x15, y14); float num197 = mountedCenter.X - vector2.X; float num198 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num198, (double) num197) - 1.57f; if (projectile.alpha == 0) { int num199 = -1; if ((double) projectile.position.X + (double) (projectile.width / 2) < (double) mountedCenter.X) num199 = 1; Main.player[projectile.owner].itemRotation = Main.player[projectile.owner].direction != 1 ? (float) Math.Atan2((double) num198 * (double) num199, (double) num197 * (double) num199) : (float) Math.Atan2((double) num198 * (double) num199, (double) num197 * (double) num199); } bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num197 * (double) num197 + (double) num198 * (double) num198); if ((double) f < 25.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num200 = 12f / f; float num201 = num197 * num200; float num202 = num198 * num200; vector2.X += num201; vector2.Y += num202; num197 = mountedCenter.X - vector2.X; num198 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.spriteBatch.Draw(Main.chainTexture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chainTexture.Width, Main.chainTexture.Height)), color, rotation, new Vector2((float) Main.chainTexture.Width * 0.5f, (float) Main.chainTexture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); } } } else if (projectile.type == 190) { float x16 = projectile.position.X + (float) (projectile.width / 2); float y15 = projectile.position.Y + (float) (projectile.height / 2); float x17 = projectile.velocity.X; float y16 = projectile.velocity.Y; Math.Sqrt((double) x17 * (double) x17 + (double) y16 * (double) y16); Vector2 vector2 = new Vector2(x16, y15); float num203 = mountedCenter.X - vector2.X; float num204 = mountedCenter.Y + Main.player[projectile.owner].gfxOffY - vector2.Y; Math.Atan2((double) num204, (double) num203); if (projectile.alpha == 0) { int num205 = -1; if ((double) projectile.position.X + (double) (projectile.width / 2) < (double) mountedCenter.X) num205 = 1; Main.player[projectile.owner].itemRotation = Main.player[projectile.owner].direction != 1 ? (float) Math.Atan2((double) num204 * (double) num205, (double) num203 * (double) num205) : (float) Math.Atan2((double) num204 * (double) num205, (double) num203 * (double) num205); } } else if (projectile.aiStyle == 15) { Vector2 vector2 = new Vector2(projectile.position.X + (float) projectile.width * 0.5f, projectile.position.Y + (float) projectile.height * 0.5f); float num206 = mountedCenter.X - vector2.X; float num207 = mountedCenter.Y - vector2.Y; float rotation = (float) Math.Atan2((double) num207, (double) num206) - 1.57f; if (projectile.alpha == 0) { int num208 = -1; if ((double) projectile.position.X + (double) (projectile.width / 2) < (double) mountedCenter.X) num208 = 1; Main.player[projectile.owner].itemRotation = Main.player[projectile.owner].direction != 1 ? (float) Math.Atan2((double) num207 * (double) num208, (double) num206 * (double) num208) : (float) Math.Atan2((double) num207 * (double) num208, (double) num206 * (double) num208); } bool flag = true; while (flag) { float f = (float) Math.Sqrt((double) num206 * (double) num206 + (double) num207 * (double) num207); if ((double) f < 25.0) flag = false; else if (float.IsNaN(f)) { flag = false; } else { float num209 = projectile.type == 154 || projectile.type == 247 ? 18f / f : 12f / f; float num210 = num206 * num209; float num211 = num207 * num209; vector2.X += num210; vector2.Y += num211; num206 = mountedCenter.X - vector2.X; num207 = mountedCenter.Y - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); if (projectile.type == 25) Main.spriteBatch.Draw(Main.chain2Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain2Texture.Width, Main.chain2Texture.Height)), color, rotation, new Vector2((float) Main.chain2Texture.Width * 0.5f, (float) Main.chain2Texture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); else if (projectile.type == 35) Main.spriteBatch.Draw(Main.chain6Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain6Texture.Width, Main.chain6Texture.Height)), color, rotation, new Vector2((float) Main.chain6Texture.Width * 0.5f, (float) Main.chain6Texture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); else if (projectile.type == 247) Main.spriteBatch.Draw(Main.chain19Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain19Texture.Width, Main.chain19Texture.Height)), color, rotation, new Vector2((float) Main.chain19Texture.Width * 0.5f, (float) Main.chain19Texture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); else if (projectile.type == 63) Main.spriteBatch.Draw(Main.chain7Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain7Texture.Width, Main.chain7Texture.Height)), color, rotation, new Vector2((float) Main.chain7Texture.Width * 0.5f, (float) Main.chain7Texture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); else if (projectile.type == 154) Main.spriteBatch.Draw(Main.chain13Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain13Texture.Width, Main.chain13Texture.Height)), color, rotation, new Vector2((float) Main.chain13Texture.Width * 0.5f, (float) Main.chain13Texture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); else Main.spriteBatch.Draw(Main.chain3Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain3Texture.Width, Main.chain3Texture.Height)), color, rotation, new Vector2((float) Main.chain3Texture.Width * 0.5f, (float) Main.chain3Texture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); } } } Microsoft.Xna.Framework.Color color3 = Lighting.GetColor((int) ((double) projectile.position.X + (double) projectile.width * 0.5) / 16, (int) (((double) projectile.position.Y + (double) projectile.height * 0.5) / 16.0)); if (projectile.hide && !ProjectileID.Sets.DontAttachHideToAlpha[projectile.type]) color3 = Lighting.GetColor((int) mountedCenter.X / 16, (int) ((double) mountedCenter.Y / 16.0)); if (projectile.type == 14) color3 = Microsoft.Xna.Framework.Color.White; int num212 = 0; int num213 = 0; if (projectile.type == 175) num212 = 10; if (projectile.type == 392) num212 = -2; if (projectile.type == 499) num212 = 12; if (projectile.bobber) num212 = 8; if (projectile.type == 519) { num212 = 6; num213 -= 6; } if (projectile.type == 520) num212 = 12; if (projectile.type == 492) { num213 -= 4; num212 += 5; } if (projectile.type == 498) num212 = 6; if (projectile.type == 489) num212 = -2; if (projectile.type == 486) num212 = -6; if (projectile.type == 525) num212 = 5; if (projectile.type == 488) num213 -= 8; if (projectile.type == 373) { num213 = -10; num212 = 6; } if (projectile.type == 375) { num213 = -11; num212 = 12; } if (projectile.type == 423) num213 = -5; if (projectile.type == 346) num212 = 4; if (projectile.type == 331) num213 = -4; if (projectile.type == 254) num212 = 3; if (projectile.type == 273) num213 = 2; if (projectile.type == 335) num212 = 6; if (projectile.type == 162) { num212 = 1; num213 = 1; } if (projectile.type == 377) num212 = -6; if (projectile.type == 353) { num212 = 36; num213 = -12; } if (projectile.type == 324) { num212 = 22; num213 = -6; } if (projectile.type == 266) { num212 = 10; num213 = -10; } if (projectile.type == 319) { num212 = 10; num213 = -12; } if (projectile.type == 315) { num212 = -13; num213 = -6; } if (projectile.type == 313 && projectile.height != 54) { num213 = -12; num212 = 20; } if (projectile.type == 314) { num213 = -8; num212 = 0; } if (projectile.type == 269) { num212 = 18; num213 = -14; } if (projectile.type == 268) { num212 = 22; num213 = -2; } if (projectile.type == 18) { num212 = 3; num213 = 3; } if (projectile.type == 16) num212 = 6; if (projectile.type == 17 || projectile.type == 31) num212 = 2; if (projectile.type == 25 || projectile.type == 26 || projectile.type == 35 || projectile.type == 63 || projectile.type == 154) { num212 = 6; num213 -= 6; } if (projectile.type == 28 || projectile.type == 37 || projectile.type == 75) num212 = 8; if (projectile.type == 29 || projectile.type == 470 || projectile.type == 637) num212 = 11; if (projectile.type == 43) num212 = 4; if (projectile.type == 208) { num212 = 2; num213 -= 12; } if (projectile.type == 209) { num212 = 4; num213 -= 8; } if (projectile.type == 210) { num212 = 2; num213 -= 22; } if (projectile.type == 251) { num212 = 18; num213 -= 10; } if (projectile.type == 163 || projectile.type == 310) num212 = 10; if (projectile.type == 69 || projectile.type == 70) { num212 = 4; num213 = 4; } float x18 = (float) ((double) (Main.projectileTexture[projectile.type].Width - projectile.width) * 0.5 + (double) projectile.width * 0.5); if (projectile.type == 50 || projectile.type == 53 || projectile.type == 515) num213 = -8; if (projectile.type == 473) { num213 = -6; num212 = 2; } if (projectile.type == 72 || projectile.type == 86 || projectile.type == 87) { num213 = -16; num212 = 8; } if (projectile.type == 74) num213 = -6; if (projectile.type == 99) num212 = 1; if (projectile.type == 655) num212 = 1; if (projectile.type == 111) { num212 = 18; num213 = -16; } if (projectile.type == 334) { num213 = -18; num212 = 8; } if (projectile.type == 200) { num212 = 12; num213 = -12; } if (projectile.type == 211) { num212 = 14; num213 = 0; } if (projectile.type == 236) { num212 = 30; num213 = -14; } if (projectile.type >= 191 && projectile.type <= 194) { num212 = 26; num213 = projectile.direction != 1 ? -22 : -10; } if (projectile.type >= 390 && projectile.type <= 392) num213 = 4 * projectile.direction; if (projectile.type == 112) num212 = 12; int type1 = projectile.type; if (projectile.type == 517 || projectile.type == 681) num212 = 6; if (projectile.type == 516) num212 = 6; if (projectile.type == (int) sbyte.MaxValue) num212 = 8; if (projectile.type == 155) { num212 = 3; num213 = 3; } if (projectile.type == 397) { --x18; num212 = -2; num213 = -2; } if (projectile.type == 398) num212 = 8; SpriteEffects effects1 = SpriteEffects.None; if (projectile.spriteDirection == -1) effects1 = SpriteEffects.FlipHorizontally; if (projectile.type == 681 && (double) projectile.velocity.X > 0.0) effects1 ^= SpriteEffects.FlipHorizontally; if (projectile.type == 221) { for (int index = 1; index < 10; ++index) { float num214 = (float) ((double) projectile.velocity.X * (double) index * 0.5); float num215 = (float) ((double) projectile.velocity.Y * (double) index * 0.5); Microsoft.Xna.Framework.Color alpha = projectile.GetAlpha(color3); float num216 = 0.0f; if (index == 1) num216 = 0.9f; if (index == 2) num216 = 0.8f; if (index == 3) num216 = 0.7f; if (index == 4) num216 = 0.6f; if (index == 5) num216 = 0.5f; if (index == 6) num216 = 0.4f; if (index == 7) num216 = 0.3f; if (index == 8) num216 = 0.2f; if (index == 9) num216 = 0.1f; alpha.R = (byte) ((double) alpha.R * (double) num216); alpha.G = (byte) ((double) alpha.G * (double) num216); alpha.B = (byte) ((double) alpha.B * (double) num216); alpha.A = (byte) ((double) alpha.A * (double) num216); int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; int y17 = height * projectile.frame; Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], new Vector2(projectile.position.X - Main.screenPosition.X + x18 + (float) num213 - num214, projectile.position.Y - Main.screenPosition.Y + (float) (projectile.height / 2) + projectile.gfxOffY - num215), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y17, Main.projectileTexture[projectile.type].Width, height)), alpha, projectile.rotation, new Vector2(x18, (float) (projectile.height / 2 + num212)), projectile.scale, effects1, 0.0f); } } if (projectile.type == 408 || projectile.type == 435 || projectile.type == 436 || projectile.type == 438 || projectile.type == 452 || projectile.type == 454 || projectile.type == 459 || projectile.type == 462 || projectile.type == 503 || projectile.type == 532 || projectile.type == 533 || projectile.type == 573 || projectile.type == 582 || projectile.type == 585 || projectile.type == 592 || projectile.type == 601 || projectile.type == 636 || projectile.type == 638 || projectile.type == 640 || projectile.type == 639 || projectile.type == 424 || projectile.type == 425 || projectile.type == 426 || projectile.type == 660 || projectile.type == 661 || projectile.type == 671 || projectile.type == 664 || projectile.type == 666 || projectile.type == 668 || projectile.type == 675 || projectile.type == 680 || projectile.type == 682 || projectile.type == 684 || projectile.type == 686 || projectile.type == 700 || projectile.type == 706 || projectile.type == 709 || projectile.type == 710 || projectile.type == 711) { Texture2D texture = Main.projectileTexture[projectile.type]; int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; Microsoft.Xna.Framework.Rectangle r = new Microsoft.Xna.Framework.Rectangle(0, height * projectile.frame, texture.Width, height); Vector2 origin = r.Size() / 2f; if (projectile.type == 503) origin.Y = 70f; if (projectile.type == 686 || projectile.type == 711) origin.Y = (float) (r.Height - 70); int num217; if (projectile.type == 438) num217 = 0; if (projectile.type == 452) num217 = 0; if (projectile.type == 408) num217 = height; if (projectile.type == 636) origin.Y = 10f; if (projectile.type == 638) origin.Y = 2f; if (projectile.type == 640 || projectile.type == 639 || projectile.type == 710) origin.Y = 5f; if (projectile.type == 700) origin.X = projectile.spriteDirection == 1 ? (float) (r.Width - 20) : 20f; int num218 = 8; int num219 = 2; int num220 = 1; float num221 = 1f; float num222 = 0.0f; if (projectile.type == 503) { num218 = 9; num219 = 3; num221 = 0.5f; } else if (projectile.type == 686 || projectile.type == 711) { num220 = 19; num218 = 0; num219 = -3; num221 = 0.5f; } else if (projectile.type == 671) { num220 = 5; num218 = 0; num219 = -1; num221 = 2.6f; } else if (projectile.type == 700) { num218 = 5; num219 = 1; num221 = 2.6f; } else if (projectile.type == 664 || projectile.type == 666 || projectile.type == 668) { num218 = 8; num219 = 2; num221 = 0.4f; } else if (projectile.type == 582) { num218 = 10; num219 = 2; num221 = 0.7f; num222 = 0.2f; } else if (projectile.type == 675) { num218 = 5; num219 = 1; num221 = 0.4f; } else if (projectile.type == 638) { num218 = 5; num219 = 1; num221 = 1f; } else if (projectile.type == 660) { num218 = 3; num219 = 1; num221 = 8f; r = new Microsoft.Xna.Framework.Rectangle(38 * projectile.frame, 0, 38, 38); origin = r.Size() / 2f; } else if (projectile.type == 684) { num218 = 8; num219 = 1; num221 = 0.75f; } else if (projectile.type == 639) { num218 = 10; num219 = 1; num221 = 1f; } else if (projectile.type == 710) { num220 = 9; num218 = 0; num219 = -2; num221 = 0.5f; } else if (projectile.type == 640) { num218 = 20; num219 = 1; num221 = 1f; } else if (projectile.type == 436) { num219 = 2; num221 = 0.5f; } else if (projectile.type == 424 || projectile.type == 425 || projectile.type == 426) { num218 = 10; num219 = 2; num221 = 0.6f; } else if (projectile.type == 438) { num218 = 10; num219 = 2; num221 = 1f; } else if (projectile.type == 452) { num218 = 10; num219 = 3; num221 = 0.5f; } else if (projectile.type == 454) { num218 = 5; num219 = 1; num221 = 0.2f; } else if (projectile.type == 462) { num218 = 7; num219 = 1; num221 = 0.2f; } else if (projectile.type == 661) { num218 = 0; num219 = 1; num221 = 0.5f; } else if (projectile.type == 706) { num220 = 9; num218 = 0; num219 = -2; num221 = 0.5f; } else if (projectile.type == 585) { num218 = 7; num219 = 1; num221 = 0.2f; } else if (projectile.type == 459) { num218 = (int) ((double) projectile.scale * 8.0); num219 = num218 / 4; if (num219 < 1) num219 = 1; num221 = 0.3f; } else if (projectile.type == 709) { num218 = 8; num219 = num218 / 4; if (num219 < 1) num219 = 1; num221 = 0.5f; } else if (projectile.type == 532) { num218 = 10; num219 = 1; num221 = 0.7f; num222 = 0.2f; } else if (projectile.type == 592) { num218 = 10; num219 = 2; num221 = 1f; } else if (projectile.type == 601) { num218 = 8; num219 = 1; num221 = 0.3f; } else if (projectile.type == 636) { num218 = 20; num219 = 3; num221 = 0.5f; } else if (projectile.type == 680) { num218 = 9; num219 = 3; num221 = 0.5f; } else if (projectile.type == 533) { if ((double) projectile.ai[0] >= 6.0 && (double) projectile.ai[0] <= 8.0) { num218 = (double) projectile.ai[0] == 6.0 ? 8 : 4; num219 = 1; if ((double) projectile.ai[0] != 7.0) num222 = 0.2f; } else num218 = num219 = 0; } for (int index = num220; num219 > 0 && index < num218 || num219 < 0 && index > num218; index += num219) { Microsoft.Xna.Framework.Color newColor = color3; if (projectile.type == 408 || projectile.type == 435 || projectile.type == 682) newColor = Microsoft.Xna.Framework.Color.Lerp(newColor, Microsoft.Xna.Framework.Color.Blue, 0.5f); else if (projectile.type == 436) newColor = Microsoft.Xna.Framework.Color.Lerp(newColor, Microsoft.Xna.Framework.Color.LimeGreen, 0.5f); else if (projectile.type >= 424 && projectile.type <= 426) newColor = Microsoft.Xna.Framework.Color.Lerp(newColor, Microsoft.Xna.Framework.Color.Red, 0.5f); else if (projectile.type == 640 || projectile.type == 639) newColor.A = (byte) 127; else if (projectile.type == 671) newColor = Microsoft.Xna.Framework.Color.Lerp(newColor, Microsoft.Xna.Framework.Color.Purple, (float) index / (float) num218); Microsoft.Xna.Framework.Color color4 = projectile.GetAlpha(newColor); if (projectile.type == 438) { color4.G /= (byte) index; color4.B /= (byte) index; } else if (projectile.type == 682) color4.G /= (byte) index; else if (projectile.type == 686) { if (!(projectile.oldPos[index] == Vector2.Zero)) { float t = (float) index / (float) num220; color4 = (double) t >= 0.5 ? Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Purple, Microsoft.Xna.Framework.Color.Black, Utils.InverseLerp(0.5f, 1f, t)) : Microsoft.Xna.Framework.Color.Lerp(color4, Microsoft.Xna.Framework.Color.Purple, Utils.InverseLerp(0.0f, 0.5f, t)); } else continue; } else if (projectile.type == 711) { if (!(projectile.oldPos[index] == Vector2.Zero)) { float t = (float) index / (float) num220; color4 = (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.InverseLerp(0.5f, 1f, t)) : Microsoft.Xna.Framework.Color.Lerp(color4, new Microsoft.Xna.Framework.Color(128, 0, (int) byte.MaxValue, 180), Utils.InverseLerp(0.0f, 0.5f, t)); } else continue; } else if (projectile.type == 684) { if (index == 1) { color4.B /= (byte) 2; color4.G /= (byte) 2; color4.A /= (byte) 2; } color4.B /= (byte) index; color4.G /= (byte) index; color4.A /= (byte) index; } else if (projectile.type == 706 || projectile.type == 710) { color4.B /= (byte) index; color4.G /= (byte) index; color4.A /= (byte) index; } else if (projectile.type == 592) { color4.R /= (byte) index; color4.G /= (byte) index; } else if (projectile.type == 640) { color4.R /= (byte) index; color4.A /= (byte) index; } else if (projectile.type >= 424 && projectile.type <= 426) { color4.B /= (byte) index; color4.G /= (byte) index; color4.A /= (byte) index; } float num223 = (float) (num218 - index); if (num219 < 0) num223 = (float) (num220 - index); Microsoft.Xna.Framework.Color color5 = color4 * (num223 / ((float) ProjectileID.Sets.TrailCacheLength[projectile.type] * 1.5f)); Vector2 oldPo = projectile.oldPos[index]; float rotation = projectile.rotation; SpriteEffects effects2 = effects1; if (ProjectileID.Sets.TrailingMode[projectile.type] == 2) { rotation = projectile.oldRot[index]; effects2 = projectile.oldSpriteDirection[index] == -1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; } Main.spriteBatch.Draw(texture, oldPo + projectile.Size / 2f - Main.screenPosition + new Vector2(0.0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(r), color5, rotation + projectile.rotation * num222 * (float) (index - 1) * (float) -effects1.HasFlag((Enum) SpriteEffects.FlipHorizontally).ToDirectionInt(), origin, MathHelper.Lerp(projectile.scale, num221, (float) index / 15f), effects2, 0.0f); } if (projectile.type == 661) { Microsoft.Xna.Framework.Color color6 = new Microsoft.Xna.Framework.Color(120, 40, 222, 120); for (int index = 0; index < 4; ++index) Main.spriteBatch.Draw(Main.extraTexture[75], projectile.Center - Main.screenPosition + new Vector2(0.0f, projectile.gfxOffY) + projectile.rotation.ToRotationVector2().RotatedBy(1.57079637050629 * (double) index) * 4f, new Microsoft.Xna.Framework.Rectangle?(r), color6, projectile.rotation, origin, projectile.scale, effects1, 0.0f); } else if (projectile.type == 684) { float x19 = ((float) ((double) projectile.localAI[0] * 6.28318548202515 / 30.0)).ToRotationVector2().X; Microsoft.Xna.Framework.Color color7 = new Microsoft.Xna.Framework.Color(220, 40, 30, 40) * (float) (0.75 + 0.25 * (double) x19); for (int index = 0; index < 8; ++index) Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0.0f, projectile.gfxOffY) + projectile.rotation.ToRotationVector2().RotatedBy(0.785398185253143 * (double) index) * (float) (4.0 + 1.0 * (double) x19), new Microsoft.Xna.Framework.Rectangle?(r), color7, projectile.rotation, origin, projectile.scale, effects1, 0.0f); } Microsoft.Xna.Framework.Color color8 = projectile.GetAlpha(color3); if (projectile.type == 640) color8 = Microsoft.Xna.Framework.Color.Transparent; if (projectile.type == 684) color8.A = (byte) 127; Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0.0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(r), color8, projectile.rotation, origin, projectile.scale, effects1, 0.0f); if (projectile.type == 503) Main.spriteBatch.Draw(Main.extraTexture[36], projectile.Center - Main.screenPosition + new Vector2(0.0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(r), Microsoft.Xna.Framework.Color.White, projectile.localAI[0], origin, projectile.scale, effects1, 0.0f); else if (projectile.type == 533) Main.spriteBatch.Draw(Main.glowMaskTexture[128], projectile.Center - Main.screenPosition + new Vector2(0.0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(r), Microsoft.Xna.Framework.Color.White * 0.3f, projectile.rotation, origin, projectile.scale, effects1, 0.0f); else if (projectile.type == 601) { Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; white.A = (byte) 0; Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0.0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(r), white, projectile.rotation, origin, projectile.scale * 0.7f, effects1, 0.0f); } } else if (projectile.type == 672) { Vector2 position = projectile.Center - Main.screenPosition; if ((double) projectile.localAI[1] == 0.0) { position.Y += 60f; float num224 = projectile.localAI[0] / 120f; for (int index = 0; index < 4; ++index) { float num225 = MathHelper.Clamp((float) ((double) num224 * 2.0 - (double) index / 3.0), 0.0f, 1f); float num226 = 1f - MathHelper.Clamp((float) (((double) num224 - 0.800000011920929) / 0.200000002980232), 0.0f, 1f); Main.spriteBatch.Draw(Main.magicPixel, position, new Microsoft.Xna.Framework.Rectangle?(), new Microsoft.Xna.Framework.Color(0.4f, 0.17f, 0.4f, 0.0f) * (num225 * num226) * 1.3f, 0.0f, new Vector2((float) Main.magicPixel.Width / 2f, (float) Main.magicPixel.Height), new Vector2((float) Math.Sqrt((double) num225) * 100f, num225 * 2f), SpriteEffects.None, 0.0f); } } else if ((double) projectile.localAI[1] == 1.0) { double num227 = (double) projectile.localAI[0] / 300.0; float num228 = Math.Min(1f, projectile.localAI[0] / 30f); int frameNumber = (int) ((double) Main.GlobalTime * 10.0) % 8; this.DrawElderEye(Main.spriteBatch, projectile.Center, 1f, 1f, frameNumber, Microsoft.Xna.Framework.Color.White * num228); this.DrawElderEye(Main.spriteBatch, projectile.Center, 1f, 1f, (frameNumber + 1) % 8, new Microsoft.Xna.Framework.Color(0.2f, 0.2f, 0.2f, 0.0f) * num228); } else if ((double) projectile.localAI[1] == 2.0) { int frameNumber = (int) ((double) Main.GlobalTime * 10.0) % 8; this.DrawElderEye(Main.spriteBatch, projectile.Center, 1f, 1f, frameNumber, Microsoft.Xna.Framework.Color.White); this.DrawElderEye(Main.spriteBatch, projectile.Center, 1f, 1f, (frameNumber + 1) % 8, new Microsoft.Xna.Framework.Color(0.2f, 0.2f, 0.2f, 0.0f)); } } else if (projectile.type != 713) { if (projectile.type == 674) { Texture2D texture = Main.extraTexture[60]; Vector2 origin = new Vector2(66f, 86f); Vector2 position = projectile.Center - Main.screenPosition; Vector2 one = Vector2.One; Vector2 vector2_8 = new Vector2(4f, 1f) * 1.4f; Microsoft.Xna.Framework.Color color9 = new Microsoft.Xna.Framework.Color(115, 0, 155, 0); Microsoft.Xna.Framework.Color color10 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, 180, (int) byte.MaxValue, 0); float t = 0.0f; if ((double) projectile.ai[0] < 30.0) t = Utils.InverseLerp(0.0f, 30f, projectile.ai[0], true); else if ((double) projectile.ai[0] < 40.0) t = 1f + Utils.InverseLerp(30f, 40f, projectile.ai[0], true); Vector2 vector2_9 = new Vector2(1f, 1f); Vector2 vector2_10 = new Vector2(0.8f, 2f); if ((double) t < 1.0) vector2_9.X *= t; Vector2 vector2_11 = vector2_8 * t; if ((double) t < 1.0) { color9 *= t; color10 *= t; } if ((double) t > 1.5) { float num229 = Utils.InverseLerp(2f, 1.5f, t, true); color9 *= num229; color10 *= num229; } float num230 = 0.42f; Microsoft.Xna.Framework.Color color11 = color9 * num230; Microsoft.Xna.Framework.Color color12 = color10 * num230; Main.spriteBatch.Draw(texture, position, new Microsoft.Xna.Framework.Rectangle?(), color11, 0.0f, origin, vector2_11 * vector2_9, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(texture, position, new Microsoft.Xna.Framework.Rectangle?(), color12, 0.0f, origin, vector2_11 * vector2_10, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(Main.extraTexture[59], position, new Microsoft.Xna.Framework.Rectangle?(), color11, 0.0f, origin, vector2_11 * vector2_9 * new Vector2(1f, 0.3f), SpriteEffects.None, 0.0f); } else if (projectile.type == 440 || projectile.type == 449 || projectile.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 (projectile.getRect().Intersects(rectangle)) { Vector2 vector2_12 = new Vector2(projectile.position.X - Main.screenPosition.X + x18 + (float) num213, projectile.position.Y - Main.screenPosition.Y + (float) (projectile.height / 2) + projectile.gfxOffY); float num231 = 100f; float num232 = 3f; if (projectile.type == 606) { num231 = 150f; num232 = 3f; } if ((double) projectile.ai[1] == 1.0) num231 = (float) (int) projectile.localAI[0]; for (int index = 1; index <= (int) projectile.localAI[0]; ++index) { Vector2 vector2_13 = Vector2.Normalize(projectile.velocity) * (float) index * num232; Microsoft.Xna.Framework.Color color13 = projectile.GetAlpha(color3) * ((num231 - (float) index) / num231); color13.A = (byte) 0; Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], vector2_12 - vector2_13, new Microsoft.Xna.Framework.Rectangle?(), color13, projectile.rotation, new Vector2(x18, (float) (projectile.height / 2 + num212)), projectile.scale, effects1, 0.0f); } } } else if (projectile.type == 687) { Vector2 vector2_14 = projectile.Center - Main.screenPosition; float num233 = 40f; float num234 = num233 * 2f; float num235 = (float) projectile.frameCounter / num233; Texture2D texture2D = Main.projectileTexture[projectile.type]; Microsoft.Xna.Framework.Color transparent = Microsoft.Xna.Framework.Color.Transparent; Microsoft.Xna.Framework.Color color14 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0); Microsoft.Xna.Framework.Color color15 = new Microsoft.Xna.Framework.Color(180, 30, 30, 200); Microsoft.Xna.Framework.Color color16 = new Microsoft.Xna.Framework.Color(0, 0, 0, 30); ulong seed = 1; for (float num236 = 0.0f; (double) num236 < 15.0; ++num236) { float num237 = (float) ((double) Utils.RandomFloat(ref seed) * 0.25 - 0.125); Vector2 rotationVector2 = (projectile.rotation + num237).ToRotationVector2(); Vector2 vector2_15 = vector2_14 + rotationVector2 * 400f; float num238 = num235 + num236 * 0.06666667f; int num239 = (int) ((double) num238 / 0.0666666701436043); float num240 = num238 % 1f; if (((double) num240 <= (double) num235 % 1.0 || (double) projectile.frameCounter >= (double) num233) && ((double) num240 >= (double) num235 % 1.0 || (double) projectile.frameCounter < (double) num234 - (double) num233)) { Microsoft.Xna.Framework.Color color17 = (double) num240 >= 0.100000001490116 ? ((double) num240 >= 0.349999994039536 ? ((double) num240 >= 0.699999988079071 ? ((double) num240 >= 0.899999976158142 ? ((double) num240 >= 1.0 ? Microsoft.Xna.Framework.Color.Transparent : Microsoft.Xna.Framework.Color.Lerp(color16, Microsoft.Xna.Framework.Color.Transparent, Utils.InverseLerp(0.9f, 1f, num240, true))) : Microsoft.Xna.Framework.Color.Lerp(color15, color16, Utils.InverseLerp(0.7f, 0.9f, num240, true))) : Microsoft.Xna.Framework.Color.Lerp(color14, color15, Utils.InverseLerp(0.35f, 0.7f, num240, true))) : color14) : Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, color14, Utils.InverseLerp(0.0f, 0.1f, num240, true)); float num241 = (float) (0.899999976158142 + (double) num240 * 0.800000011920929); float scale = num241 * num241 * 0.8f; Vector2 position = Vector2.SmoothStep(vector2_14, vector2_15, num240); Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: 7, frameY: ((int) ((double) num240 * 7.0))); Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(r), color17, (float) ((double) projectile.rotation + 6.28318548202515 * ((double) num240 + (double) Main.GlobalTime * 1.20000004768372) * 0.200000002980232 + (double) num239 * 1.25663709640503), r.Size() / 2f, scale, SpriteEffects.None, 0.0f); } } } else if (projectile.type == 651) { Player player = Main.player[projectile.owner]; Microsoft.Xna.Framework.Point point = new Vector2(projectile.ai[0], projectile.ai[1]).ToPoint(); Microsoft.Xna.Framework.Point tileCoordinates = projectile.Center.ToTileCoordinates(); Microsoft.Xna.Framework.Color color18 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0); Microsoft.Xna.Framework.Color color19 = new Microsoft.Xna.Framework.Color((int) sbyte.MaxValue, (int) sbyte.MaxValue, (int) sbyte.MaxValue, 0); int num242 = 1; float num243 = 0.0f; WiresUI.Settings.MultiToolMode toolMode = WiresUI.Settings.ToolMode; bool flag1 = toolMode.HasFlag((Enum) WiresUI.Settings.MultiToolMode.Actuator); if (toolMode.HasFlag((Enum) WiresUI.Settings.MultiToolMode.Red)) { ++num243; color19 = Microsoft.Xna.Framework.Color.Lerp(color19, Microsoft.Xna.Framework.Color.Red, 1f / num243); } if (toolMode.HasFlag((Enum) WiresUI.Settings.MultiToolMode.Blue)) { ++num243; color19 = Microsoft.Xna.Framework.Color.Lerp(color19, Microsoft.Xna.Framework.Color.Blue, 1f / num243); } if (toolMode.HasFlag((Enum) WiresUI.Settings.MultiToolMode.Green)) { ++num243; color19 = Microsoft.Xna.Framework.Color.Lerp(color19, new Microsoft.Xna.Framework.Color(0, (int) byte.MaxValue, 0), 1f / num243); } if (toolMode.HasFlag((Enum) WiresUI.Settings.MultiToolMode.Yellow)) { float num244 = num243 + 1f; color19 = Microsoft.Xna.Framework.Color.Lerp(color19, new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, 0), 1f / num244); } if (toolMode.HasFlag((Enum) WiresUI.Settings.MultiToolMode.Cutter)) color18 = new Microsoft.Xna.Framework.Color(50, 50, 50, (int) byte.MaxValue); color19.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 (flag1) Main.spriteBatch.Draw(Main.wireUITexture[11], position, new Microsoft.Xna.Framework.Rectangle?(), color18, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], position, new Microsoft.Xna.Framework.Rectangle?(rectangle), color19, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); rectangle.Y = 18; Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], position, new Microsoft.Xna.Framework.Rectangle?(rectangle), color18, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } else if (point.X == tileCoordinates.X) { int num245 = tileCoordinates.Y - point.Y; int num246 = Math.Sign(num245); Vector2 position1 = point.ToVector2() * 16f - Main.screenPosition; Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(num245 * num242 > 0 ? 72 : 18, 0, 16, 16); if (flag1) Main.spriteBatch.Draw(Main.wireUITexture[11], position1, new Microsoft.Xna.Framework.Rectangle?(), color18, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], position1, new Microsoft.Xna.Framework.Rectangle?(rectangle), color19, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); rectangle.Y = 18; Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], position1, new Microsoft.Xna.Framework.Rectangle?(rectangle), color18, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); for (int index = point.Y + num246; index != tileCoordinates.Y; index += num246) { Vector2 position2 = new Vector2((float) (point.X * 16), (float) (index * 16)) - Main.screenPosition; rectangle.Y = 0; rectangle.X = 90; if (flag1) Main.spriteBatch.Draw(Main.wireUITexture[11], position2, new Microsoft.Xna.Framework.Rectangle?(), color18, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], position2, new Microsoft.Xna.Framework.Rectangle?(rectangle), color19, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); rectangle.Y = 18; Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], position2, new Microsoft.Xna.Framework.Rectangle?(rectangle), color18, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } Vector2 position3 = tileCoordinates.ToVector2() * 16f - Main.screenPosition; rectangle = new Microsoft.Xna.Framework.Rectangle(num245 * num242 > 0 ? 18 : 72, 0, 16, 16); if (flag1) Main.spriteBatch.Draw(Main.wireUITexture[11], position3, new Microsoft.Xna.Framework.Rectangle?(), color18, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], position3, new Microsoft.Xna.Framework.Rectangle?(rectangle), color19, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); rectangle.Y = 18; Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], position3, new Microsoft.Xna.Framework.Rectangle?(rectangle), color18, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } else if (point.Y == tileCoordinates.Y) { int num247 = tileCoordinates.X - point.X; int num248 = Math.Sign(num247); Vector2 position4 = point.ToVector2() * 16f - Main.screenPosition; Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(num247 > 0 ? 36 : 144, 0, 16, 16); if (flag1) Main.spriteBatch.Draw(Main.wireUITexture[11], position4, new Microsoft.Xna.Framework.Rectangle?(), color18, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], position4, new Microsoft.Xna.Framework.Rectangle?(rectangle), color19, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); rectangle.Y = 18; Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], position4, new Microsoft.Xna.Framework.Rectangle?(rectangle), color18, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); for (int index = point.X + num248; index != tileCoordinates.X; index += num248) { Vector2 position5 = new Vector2((float) (index * 16), (float) (point.Y * 16)) - Main.screenPosition; rectangle.Y = 0; rectangle.X = 180; if (flag1) Main.spriteBatch.Draw(Main.wireUITexture[11], position5, new Microsoft.Xna.Framework.Rectangle?(), color18, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], position5, new Microsoft.Xna.Framework.Rectangle?(rectangle), color19, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); rectangle.Y = 18; Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], position5, new Microsoft.Xna.Framework.Rectangle?(rectangle), color18, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } Vector2 position6 = tileCoordinates.ToVector2() * 16f - Main.screenPosition; rectangle = new Microsoft.Xna.Framework.Rectangle(num247 > 0 ? 144 : 36, 0, 16, 16); if (flag1) Main.spriteBatch.Draw(Main.wireUITexture[11], position6, new Microsoft.Xna.Framework.Rectangle?(), color18, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], position6, new Microsoft.Xna.Framework.Rectangle?(rectangle), color19, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); rectangle.Y = 18; Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], position6, new Microsoft.Xna.Framework.Rectangle?(rectangle), color18, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } else { Math.Abs(point.X - tileCoordinates.X); Math.Abs(point.Y - tileCoordinates.Y); int num249 = Math.Sign(tileCoordinates.X - point.X); int num250 = Math.Sign(tileCoordinates.Y - point.Y); Microsoft.Xna.Framework.Point p = new Microsoft.Xna.Framework.Point(); bool flag2 = false; bool flag3 = player.direction == 1; int num251; int num252; int num253; if (flag3) { p.X = point.X; num251 = point.Y; num252 = tileCoordinates.Y; num253 = num250; } else { p.Y = point.Y; num251 = point.X; num252 = tileCoordinates.X; num253 = num249; } Vector2 position7 = point.ToVector2() * 16f - Main.screenPosition; Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 16); rectangle.X = flag3 ? (num253 > 0 ? 72 : 18) : (num253 > 0 ? 36 : 144); if (flag1) Main.spriteBatch.Draw(Main.wireUITexture[11], position7, new Microsoft.Xna.Framework.Rectangle?(), color18, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], position7, new Microsoft.Xna.Framework.Rectangle?(rectangle), color19, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); rectangle.Y = 18; Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], position7, new Microsoft.Xna.Framework.Rectangle?(rectangle), color18, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); for (int index = num251 + num253; index != num252 && !flag2; index += num253) { if (flag3) p.Y = index; else p.X = index; if (WorldGen.InWorld(p.X, p.Y, 1) && Main.tile[p.X, p.Y] != null) { Vector2 position8 = p.ToVector2() * 16f - Main.screenPosition; rectangle.Y = 0; rectangle.X = flag3 ? 90 : 180; if (flag1) Main.spriteBatch.Draw(Main.wireUITexture[11], position8, new Microsoft.Xna.Framework.Rectangle?(), color18, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], position8, new Microsoft.Xna.Framework.Rectangle?(rectangle), color19, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); rectangle.Y = 18; Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], position8, new Microsoft.Xna.Framework.Rectangle?(rectangle), color18, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } int num254; int num255; int num256; if (flag3) { p.Y = tileCoordinates.Y; num254 = point.X; num255 = tileCoordinates.X; num256 = num249; } else { p.X = tileCoordinates.X; num254 = point.Y; num255 = tileCoordinates.Y; num256 = num250; } Vector2 position9 = p.ToVector2() * 16f - Main.screenPosition; rectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 16); if (!flag3) { rectangle.X += num249 > 0 ? 144 : 36; rectangle.X += num250 * num242 > 0 ? 72 : 18; } else { rectangle.X += num249 > 0 ? 36 : 144; rectangle.X += num250 * num242 > 0 ? 18 : 72; } if (flag1) Main.spriteBatch.Draw(Main.wireUITexture[11], position9, new Microsoft.Xna.Framework.Rectangle?(), color18, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], position9, new Microsoft.Xna.Framework.Rectangle?(rectangle), color19, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); rectangle.Y = 18; Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], position9, new Microsoft.Xna.Framework.Rectangle?(rectangle), color18, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); for (int index = num254 + num256; index != num255 && !flag2; index += num256) { if (!flag3) 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 = flag3 ? 180 : 90; if (flag1) Main.spriteBatch.Draw(Main.wireUITexture[11], position10, new Microsoft.Xna.Framework.Rectangle?(), color18, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], position10, new Microsoft.Xna.Framework.Rectangle?(rectangle), color19, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); rectangle.Y = 18; Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], position10, new Microsoft.Xna.Framework.Rectangle?(rectangle), color18, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } Vector2 position11 = tileCoordinates.ToVector2() * 16f - Main.screenPosition; rectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 16); if (!flag3) rectangle.X += num250 * num242 > 0 ? 18 : 72; else rectangle.X += num249 > 0 ? 144 : 36; if (flag1) Main.spriteBatch.Draw(Main.wireUITexture[11], position11, new Microsoft.Xna.Framework.Rectangle?(), color18, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], position11, new Microsoft.Xna.Framework.Rectangle?(rectangle), color19, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); rectangle.Y = 18; Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], position11, new Microsoft.Xna.Framework.Rectangle?(rectangle), color18, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } else if (projectile.type == 586) { float num257 = 300f; if ((double) projectile.ai[0] >= 100.0) num257 = MathHelper.Lerp(300f, 600f, (float) (((double) projectile.ai[0] - 100.0) / 200.0)); if ((double) num257 > 600.0) num257 = 600f; if ((double) projectile.ai[0] >= 500.0) num257 = MathHelper.Lerp(600f, 1200f, (float) (((double) projectile.ai[0] - 500.0) / 100.0)); float rotation1 = projectile.rotation; Texture2D texture2D = Main.projectileTexture[projectile.type]; Microsoft.Xna.Framework.Color alpha = projectile.GetAlpha(color3); alpha.A /= (byte) 2; int num258 = (int) ((double) projectile.ai[0] / 6.0); Vector2 spinningpoint = new Vector2(0.0f, -num257); for (int index = 0; (double) index < 10.0; ++index) { Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: 5, frameY: ((num258 + index) % 5)); float rotation2 = rotation1 + 0.6283185f * (float) index; Vector2 position = spinningpoint.RotatedBy((double) rotation2) / 3f + projectile.Center - Main.screenPosition; Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(r), alpha, rotation2, r.Size() / 2f, projectile.scale, SpriteEffects.None, 0.0f); } for (int index = 0; (double) index < 20.0; ++index) { Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: 5, frameY: ((num258 + index) % 5)); float rotation3 = (float) (-(double) rotation1 + 0.314159274101257 * (double) index) * 2f; Vector2 position = spinningpoint.RotatedBy((double) rotation3) + projectile.Center - Main.screenPosition; Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(r), alpha, rotation3, r.Size() / 2f, projectile.scale, SpriteEffects.None, 0.0f); } } else if (projectile.type == 536 || projectile.type == 591 || projectile.type == 607) { Texture2D texture2D = Main.projectileTexture[projectile.type]; Vector2 position = projectile.position + new Vector2((float) projectile.width, (float) projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; Vector2 scale = new Vector2(1f, projectile.velocity.Length() / (float) texture2D.Height); Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(), projectile.GetAlpha(color3), projectile.rotation, texture2D.Frame().Bottom(), scale, effects1, 0.0f); } else if (projectile.type == 688 || projectile.type == 689 || projectile.type == 690) { Texture2D texture2D1 = Main.projectileTexture[projectile.type]; Vector2 position12 = projectile.Top + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; Microsoft.Xna.Framework.Rectangle r1 = texture2D1.Frame(verticalFrames: Main.projFrames[projectile.type], frameY: projectile.frame); Vector2 origin1 = r1.Size() * new Vector2(0.5f, 0.0f); Microsoft.Xna.Framework.Color color20 = Microsoft.Xna.Framework.Color.Lerp(projectile.GetAlpha(color3), Microsoft.Xna.Framework.Color.White, 0.5f); Microsoft.Xna.Framework.Color color21 = color20; color21.A = (byte) 127; Texture2D texture = (Texture2D) null; Texture2D texture2D2 = (Texture2D) null; switch (projectile.type) { case 688: texture = Main.glowMaskTexture[228]; texture2D2 = Main.extraTexture[86]; break; case 689: texture = Main.glowMaskTexture[229]; texture2D2 = Main.extraTexture[87]; break; case 690: texture = Main.glowMaskTexture[230]; texture2D2 = Main.extraTexture[88]; break; } Main.spriteBatch.Draw(texture2D1, position12, new Microsoft.Xna.Framework.Rectangle?(r1), color20, projectile.rotation, origin1, projectile.scale, effects1, 0.0f); if (texture != null) Main.spriteBatch.Draw(texture, position12, new Microsoft.Xna.Framework.Rectangle?(r1), color21, projectile.rotation, origin1, projectile.scale, effects1, 0.0f); if (texture2D2 != null) { Vector2 position13 = projectile.Center + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; Microsoft.Xna.Framework.Rectangle r2 = texture2D2.Frame(); Vector2 origin2 = r2.Size() * new Vector2(0.5f, 1f); origin2.Y -= 2f; Main.spriteBatch.Draw(texture2D2, position13, new Microsoft.Xna.Framework.Rectangle?(r2), color20, projectile.rotation, origin2, projectile.scale, effects1, 0.0f); } } else if (projectile.type == 694 || projectile.type == 695 || projectile.type == 696) { Texture2D texture2D = Main.projectileTexture[projectile.type]; Vector2 position = projectile.Bottom + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: Main.projFrames[projectile.type], frameY: projectile.frame); Vector2 origin = r.Size() * new Vector2(0.5f, 1f); origin.Y -= 8f; switch (projectile.type) { case 694: case 695: origin.X += 3f; break; } Microsoft.Xna.Framework.Color color22 = Microsoft.Xna.Framework.Color.Lerp(projectile.GetAlpha(color3), Microsoft.Xna.Framework.Color.White, 0.0f); Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(r), color22, projectile.rotation, origin, projectile.scale, effects1, 0.0f); Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(r), color22 * 0.3f, projectile.rotation, origin, projectile.scale * 1.1f, effects1, 0.0f); } else if (projectile.type == 409) { Texture2D texture = Main.projectileTexture[projectile.type]; int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; int y18 = height * projectile.frame; int num259 = 10; int num260 = 2; float num261 = 0.5f; for (int index = 1; index < num259; index += num260) { ref Vector2 local = ref projectile.oldPos[index]; Microsoft.Xna.Framework.Color newColor = color3; Microsoft.Xna.Framework.Color color23 = projectile.GetAlpha(newColor) * ((float) (num259 - index) / 15f); Vector2 vector2 = projectile.oldPos[index] - Main.screenPosition + new Vector2(x18 + (float) num213, (float) (projectile.height / 2) + projectile.gfxOffY); Main.spriteBatch.Draw(texture, projectile.oldPos[index] + new Vector2((float) projectile.width, (float) projectile.height) / 2f - Main.screenPosition + new Vector2(0.0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y18, texture.Width, height)), color23, projectile.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), MathHelper.Lerp(projectile.scale, num261, (float) index / 15f), effects1, 0.0f); } Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0.0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y18, texture.Width, height)), projectile.GetAlpha(color3), projectile.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile.scale, effects1, 0.0f); } else if (projectile.type == 437) { Texture2D texture = Main.projectileTexture[projectile.type]; int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; int y19 = height * projectile.frame; int num262 = 10; int num263 = 2; float num264 = 0.2f; for (int index = 1; index < num262; index += num263) { ref Vector2 local = ref Main.npc[i].oldPos[index]; Microsoft.Xna.Framework.Color newColor = color3; Microsoft.Xna.Framework.Color color24 = projectile.GetAlpha(newColor) * ((float) (num262 - index) / 15f); Vector2 vector2 = projectile.oldPos[index] - Main.screenPosition + new Vector2(x18 + (float) num213, (float) (projectile.height / 2) + projectile.gfxOffY); Main.spriteBatch.Draw(texture, projectile.oldPos[index] + new Vector2((float) projectile.width, (float) projectile.height) / 2f - Main.screenPosition + new Vector2(0.0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y19, texture.Width, height)), color24, projectile.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), MathHelper.Lerp(projectile.scale, num264, (float) index / 15f), effects1, 0.0f); } Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0.0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y19, texture.Width, height)), Microsoft.Xna.Framework.Color.White, projectile.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile.scale + 0.2f, effects1, 0.0f); Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0.0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y19, texture.Width, height)), projectile.GetAlpha(Microsoft.Xna.Framework.Color.White), projectile.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile.scale + 0.2f, effects1, 0.0f); } else if (projectile.type == 384 || projectile.type == 386) { Texture2D texture = Main.projectileTexture[projectile.type]; int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; int y20 = height * projectile.frame; Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0.0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y20, texture.Width, height)), projectile.GetAlpha(color3), projectile.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile.scale, effects1, 0.0f); } else if (projectile.type == 439 || projectile.type == 460 || projectile.type == 600 || projectile.type == 615 || projectile.type == 630 || projectile.type == 633 || projectile.type == 705) { Texture2D texture = Main.projectileTexture[projectile.type]; int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; int y21 = height * projectile.frame; Vector2 position = (projectile.position + new Vector2((float) projectile.width, (float) projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition).Floor(); float num265 = 1f; if (Main.player[projectile.owner].shroomiteStealth && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].ranged) { float num266 = Main.player[projectile.owner].stealth; if ((double) num266 < 0.03) num266 = 0.03f; double num267 = (1.0 + (double) num266 * 10.0) / 11.0; color3 *= num266; num265 = num266; } if (Main.player[projectile.owner].setVortex && Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].ranged) { float num268 = Main.player[projectile.owner].stealth; if ((double) num268 < 0.03) num268 = 0.03f; double num269 = (1.0 + (double) num268 * 10.0) / 11.0; color3 = color3.MultiplyRGBA(new Microsoft.Xna.Framework.Color(Vector4.Lerp(Vector4.One, new Vector4(0.0f, 0.12f, 0.16f, 0.0f), 1f - num268))); num265 = num268; } Main.spriteBatch.Draw(texture, position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y21, texture.Width, height)), projectile.GetAlpha(color3), projectile.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile.scale, effects1, 0.0f); if (projectile.type == 439) Main.spriteBatch.Draw(Main.glowMaskTexture[35], position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y21, texture.Width, height)), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0) * num265, projectile.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile.scale, effects1, 0.0f); else if (projectile.type == 615) Main.spriteBatch.Draw(Main.glowMaskTexture[192], position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y21, texture.Width, height)), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue) * num265, projectile.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile.scale, effects1, 0.0f); else if (projectile.type == 630) { Main.spriteBatch.Draw(Main.glowMaskTexture[200], position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y21, texture.Width, height)), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue) * num265, projectile.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile.scale, effects1, 0.0f); if ((double) projectile.localAI[0] > 0.0) { int frameY = 6 - (int) ((double) projectile.localAI[0] / 1.0); Texture2D texture2D = Main.extraTexture[65]; Main.spriteBatch.Draw(texture2D, position + Vector2.Normalize(projectile.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) * num265, projectile.rotation, new Vector2(effects1.HasFlag((Enum) SpriteEffects.FlipHorizontally) ? (float) texture2D.Width : 0.0f, (float) ((double) height / 2.0 - 2.0)), projectile.scale, effects1, 0.0f); } } else if (projectile.type == 600) { Microsoft.Xna.Framework.Color portalColor = PortalHelper.GetPortalColor(projectile.owner, (int) projectile.ai[1]); portalColor.A = (byte) 70; Main.spriteBatch.Draw(Main.glowMaskTexture[173], position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y21, texture.Width, height)), portalColor, projectile.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile.scale, effects1, 0.0f); } else if (projectile.type == 460) { if ((double) Math.Abs(projectile.rotation - 1.570796f) > 1.57079637050629) effects1 |= SpriteEffects.FlipVertically; Main.spriteBatch.Draw(Main.glowMaskTexture[102], position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y21, texture.Width, height)), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), projectile.rotation - 1.570796f, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile.scale, effects1, 0.0f); if ((double) projectile.ai[0] > 180.0 && Main.projectile[(int) projectile.ai[1]].type == 461) this.DrawProj((int) projectile.ai[1]); } else if (projectile.type == 633) { float num270 = (float) (Math.Cos(6.28318548202515 * ((double) projectile.ai[0] / 30.0)) * 2.0 + 2.0); if ((double) projectile.ai[0] > 120.0) num270 = 4f; for (float num271 = 0.0f; (double) num271 < 4.0; ++num271) Main.spriteBatch.Draw(texture, position + Vector2.UnitY.RotatedBy((double) num271 * 6.28318548202515 / 4.0) * num270, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y21, texture.Width, height)), projectile.GetAlpha(color3).MultiplyRGBA(new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0)) * 0.03f, projectile.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile.scale, effects1, 0.0f); } } else if (projectile.type == 442) { Texture2D texture = Main.projectileTexture[projectile.type]; int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; int y22 = height * projectile.frame; Vector2 position = projectile.position + new Vector2((float) projectile.width, (float) projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; Main.spriteBatch.Draw(texture, position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y22, texture.Width, height)), projectile.GetAlpha(color3), projectile.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile.scale, effects1, 0.0f); Main.spriteBatch.Draw(Main.glowMaskTexture[37], position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y22, texture.Width, height)), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0) * (float) (1.0 - (double) projectile.alpha / (double) byte.MaxValue), projectile.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile.scale, effects1, 0.0f); } else if (projectile.type == 447) { Texture2D texture = Main.projectileTexture[projectile.type]; Texture2D texture2D = Main.extraTexture[4]; int num272 = texture.Height / Main.projFrames[projectile.type]; int num273 = num272 * projectile.frame; int height = texture2D.Height / Main.projFrames[projectile.type]; int y23 = height * projectile.frame; Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, y23, texture2D.Width, height); Vector2 position = projectile.position + new Vector2((float) projectile.width, 0.0f) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; Main.spriteBatch.Draw(Main.extraTexture[4], position, new Microsoft.Xna.Framework.Rectangle?(rectangle), projectile.GetAlpha(color3), projectile.rotation, new Vector2((float) (texture2D.Width / 2), 0.0f), projectile.scale, effects1, 0.0f); int num274 = projectile.height - num272 - 14; if (num274 < 0) num274 = 0; if (num274 > 0) { if (y23 == height * 3) y23 = height * 2; Main.spriteBatch.Draw(Main.extraTexture[4], position + Vector2.UnitY * (float) (height - 1), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y23 + height - 1, texture2D.Width, 1)), projectile.GetAlpha(color3), projectile.rotation, new Vector2((float) (texture2D.Width / 2), 0.0f), new Vector2(1f, (float) num274), effects1, 0.0f); } rectangle.Width = texture.Width; rectangle.Y = num273; Main.spriteBatch.Draw(texture, position + Vector2.UnitY * (float) (height - 1 + num274), new Microsoft.Xna.Framework.Rectangle?(rectangle), projectile.GetAlpha(color3), projectile.rotation, new Vector2((float) texture.Width / 2f, 0.0f), projectile.scale, effects1, 0.0f); } else if (projectile.type == 455) { if (projectile.velocity == Vector2.Zero) return; Texture2D texture2D3 = Main.projectileTexture[projectile.type]; Texture2D texture = Main.extraTexture[21]; Texture2D texture2D4 = Main.extraTexture[22]; float num275 = projectile.localAI[1]; Microsoft.Xna.Framework.Color color25 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0) * 0.9f; Main.spriteBatch.Draw(texture2D3, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(), color25, projectile.rotation, texture2D3.Size() / 2f, projectile.scale, SpriteEffects.None, 0.0f); float num276 = num275 - (float) (texture2D3.Height / 2 + texture2D4.Height) * projectile.scale; Vector2 vector2 = projectile.Center + projectile.velocity * projectile.scale * (float) texture2D3.Height / 2f; if ((double) num276 > 0.0) { float num277 = 0.0f; Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, 16 * (projectile.timeLeft / 3 % 5), texture.Width, 16); while ((double) num277 + 1.0 < (double) num276) { if ((double) num276 - (double) num277 < (double) rectangle.Height) rectangle.Height = (int) ((double) num276 - (double) num277); Main.spriteBatch.Draw(texture, vector2 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangle), color25, projectile.rotation, new Vector2((float) (rectangle.Width / 2), 0.0f), projectile.scale, SpriteEffects.None, 0.0f); num277 += (float) rectangle.Height * projectile.scale; vector2 += projectile.velocity * (float) rectangle.Height * projectile.scale; rectangle.Y += 16; if (rectangle.Y + rectangle.Height > texture.Height) rectangle.Y = 0; } } Main.spriteBatch.Draw(texture2D4, vector2 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(), color25, projectile.rotation, texture2D4.Frame().Top(), projectile.scale, SpriteEffects.None, 0.0f); } else if (projectile.type == 461) { if (projectile.velocity == Vector2.Zero) return; Texture2D texture2D = Main.projectileTexture[projectile.type]; float num278 = projectile.localAI[1]; Microsoft.Xna.Framework.Color color26 = 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_16 = new Vector2(0.0f, Main.player[projectile.owner].gfxOffY); Main.spriteBatch.Draw(texture2D, projectile.Center.Floor() - Main.screenPosition + vector2_16, new Microsoft.Xna.Framework.Rectangle?(r), color26, projectile.rotation, r.Size() / 2f, projectile.scale, SpriteEffects.None, 0.0f); float num279 = num278 - 33f * projectile.scale; Vector2 vector2_17 = projectile.Center.Floor() + projectile.velocity * projectile.scale * 10.5f; r = new Microsoft.Xna.Framework.Rectangle(0, 25, texture2D.Width, 28); if ((double) num279 > 0.0) { float num280 = 0.0f; while ((double) num280 + 1.0 < (double) num279) { if ((double) num279 - (double) num280 < (double) r.Height) r.Height = (int) ((double) num279 - (double) num280); Main.spriteBatch.Draw(texture2D, vector2_17 - Main.screenPosition + vector2_16, new Microsoft.Xna.Framework.Rectangle?(r), color26, projectile.rotation, new Vector2((float) (r.Width / 2), 0.0f), projectile.scale, SpriteEffects.None, 0.0f); num280 += (float) r.Height * projectile.scale; vector2_17 += projectile.velocity * (float) r.Height * projectile.scale; } } r = new Microsoft.Xna.Framework.Rectangle(0, 56, texture2D.Width, 22); Main.spriteBatch.Draw(texture2D, vector2_17 - Main.screenPosition + vector2_16, new Microsoft.Xna.Framework.Rectangle?(r), color26, projectile.rotation, texture2D.Frame().Top(), projectile.scale, SpriteEffects.None, 0.0f); } else if (projectile.type == 632) { if (projectile.velocity == Vector2.Zero) return; Texture2D tex = Main.projectileTexture[projectile.type]; float num281 = projectile.localAI[1]; Microsoft.Xna.Framework.Color rgb = Main.hslToRgb(projectile.GetPrismHue(projectile.ai[0]), 1f, 0.5f); rgb.A = (byte) 0; Vector2 vector2_18 = projectile.Center.Floor() + projectile.velocity * projectile.scale * 10.5f; float num282 = num281 - projectile.scale * 14.5f * projectile.scale; Vector2 scale = new Vector2(projectile.scale); DelegateMethods.f_1 = 1f; DelegateMethods.c_1 = rgb * 0.75f * projectile.Opacity; Vector2 vector2_19 = projectile.oldPos[0] + new Vector2((float) projectile.width, (float) projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; Utils.DrawLaser(Main.spriteBatch, tex, vector2_18 - Main.screenPosition, vector2_18 + projectile.velocity * num282 - 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 * projectile.Opacity; Utils.DrawLaser(Main.spriteBatch, tex, vector2_18 - Main.screenPosition, vector2_18 + projectile.velocity * num282 - Main.screenPosition, scale / 2f, new Utils.LaserLineFraming(DelegateMethods.RainbowLaserDraw)); } else if (projectile.type == 642) { if (projectile.velocity == Vector2.Zero) return; Texture2D tex = Main.projectileTexture[projectile.type]; float num283 = projectile.localAI[1]; Microsoft.Xna.Framework.Color color27 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue); Vector2 vector2_20 = projectile.Center.Floor(); float num284 = num283 - projectile.scale * 10.5f; Vector2 scale = new Vector2(projectile.scale); DelegateMethods.f_1 = 1f; DelegateMethods.c_1 = color27; DelegateMethods.i_1 = 54000 - (int) Main.time / 2; Vector2 vector2_21 = projectile.oldPos[0] + new Vector2((float) projectile.width, (float) projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; Utils.DrawLaser(Main.spriteBatch, tex, vector2_20 - Main.screenPosition, vector2_20 + projectile.velocity * num284 - 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 * projectile.Opacity; Utils.DrawLaser(Main.spriteBatch, tex, vector2_20 - Main.screenPosition, vector2_20 + projectile.velocity * num284 - Main.screenPosition, scale / 2f, new Utils.LaserLineFraming(DelegateMethods.TurretLaserDraw)); } else if (projectile.type == 611) { Vector2 vector2_22 = projectile.position + new Vector2((float) projectile.width, (float) projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; Texture2D texture2D = Main.projectileTexture[projectile.type]; Microsoft.Xna.Framework.Color alpha = projectile.GetAlpha(color3); if (projectile.velocity == Vector2.Zero) return; float num285 = projectile.velocity.Length() + 16f; bool flag = (double) num285 < 100.0; Vector2 vector2_23 = Vector2.Normalize(projectile.velocity); Microsoft.Xna.Framework.Rectangle r = new Microsoft.Xna.Framework.Rectangle(0, 2, texture2D.Width, 40); Vector2 vector2_24 = new Vector2(0.0f, Main.player[projectile.owner].gfxOffY); float rotation = projectile.rotation + 3.141593f; Main.spriteBatch.Draw(texture2D, projectile.Center.Floor() - Main.screenPosition + vector2_24, new Microsoft.Xna.Framework.Rectangle?(r), alpha, rotation, r.Size() / 2f - Vector2.UnitY * 4f, projectile.scale, SpriteEffects.None, 0.0f); float num286 = num285 - 40f * projectile.scale; Vector2 vector2_25 = projectile.Center.Floor() + vector2_23 * projectile.scale * 24f; r = new Microsoft.Xna.Framework.Rectangle(0, 68, texture2D.Width, 18); if ((double) num286 > 0.0) { float num287 = 0.0f; while ((double) num287 + 1.0 < (double) num286) { if ((double) num286 - (double) num287 < (double) r.Height) r.Height = (int) ((double) num286 - (double) num287); Main.spriteBatch.Draw(texture2D, vector2_25 - Main.screenPosition + vector2_24, new Microsoft.Xna.Framework.Rectangle?(r), alpha, rotation, new Vector2((float) (r.Width / 2), 0.0f), projectile.scale, SpriteEffects.None, 0.0f); num287 += (float) r.Height * projectile.scale; vector2_25 += vector2_23 * (float) r.Height * projectile.scale; } } Vector2 vector2_26 = vector2_25; Vector2 vector2_27 = projectile.Center.Floor() + vector2_23 * projectile.scale * 24f; r = new Microsoft.Xna.Framework.Rectangle(0, 46, texture2D.Width, 18); int num288 = 18; if (flag) num288 = 9; float num289 = num286; if ((double) num286 > 0.0) { float num290 = 0.0f; float num291 = num289 / (float) num288; float num292 = num290 + num291 * 0.25f; Vector2 vector2_28 = vector2_27 + vector2_23 * num291 * 0.25f; for (int index = 0; index < num288; ++index) { float num293 = num291; if (index == 0) num293 *= 0.75f; Main.spriteBatch.Draw(texture2D, vector2_28 - Main.screenPosition + vector2_24, new Microsoft.Xna.Framework.Rectangle?(r), alpha, rotation, new Vector2((float) (r.Width / 2), 0.0f), projectile.scale, SpriteEffects.None, 0.0f); num292 += num293; vector2_28 += vector2_23 * num293; } } r = new Microsoft.Xna.Framework.Rectangle(0, 90, texture2D.Width, 48); Main.spriteBatch.Draw(texture2D, vector2_26 - Main.screenPosition + vector2_24, new Microsoft.Xna.Framework.Rectangle?(r), alpha, rotation, texture2D.Frame().Top(), projectile.scale, SpriteEffects.None, 0.0f); } else if (projectile.type == 537) { if (projectile.velocity == Vector2.Zero) return; Texture2D texture2D = Main.projectileTexture[projectile.type]; float num294 = projectile.localAI[1]; Microsoft.Xna.Framework.Color color28 = 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_29 = new Vector2(0.0f, Main.npc[(int) projectile.ai[1]].gfxOffY); Main.spriteBatch.Draw(texture2D, projectile.Center.Floor() - Main.screenPosition + vector2_29, new Microsoft.Xna.Framework.Rectangle?(r), color28, projectile.rotation, r.Size() / 2f, projectile.scale, SpriteEffects.None, 0.0f); float num295 = num294 - 33f * projectile.scale; Vector2 vector2_30 = projectile.Center.Floor() + projectile.velocity * projectile.scale * 10.5f; r = new Microsoft.Xna.Framework.Rectangle(0, 25, texture2D.Width, 28); if ((double) num295 > 0.0) { float num296 = 0.0f; while ((double) num296 + 1.0 < (double) num295) { if ((double) num295 - (double) num296 < (double) r.Height) r.Height = (int) ((double) num295 - (double) num296); Main.spriteBatch.Draw(texture2D, vector2_30 - Main.screenPosition + vector2_29, new Microsoft.Xna.Framework.Rectangle?(r), color28, projectile.rotation, new Vector2((float) (r.Width / 2), 0.0f), projectile.scale, SpriteEffects.None, 0.0f); num296 += (float) r.Height * projectile.scale; vector2_30 += projectile.velocity * (float) r.Height * projectile.scale; } } r = new Microsoft.Xna.Framework.Rectangle(0, 56, texture2D.Width, 22); Main.spriteBatch.Draw(texture2D, vector2_30 - Main.screenPosition + vector2_29, new Microsoft.Xna.Framework.Rectangle?(r), color28, projectile.rotation, texture2D.Frame().Top(), projectile.scale, SpriteEffects.None, 0.0f); } else if (projectile.type == 456) { Texture2D texture2D5 = Main.projectileTexture[projectile.type]; Texture2D texture = Main.extraTexture[23]; Texture2D texture2D6 = Main.extraTexture[24]; Vector2 vector2_31 = new Vector2(0.0f, 216f); Vector2 vector2_32 = Main.npc[(int) Math.Abs(projectile.ai[0]) - 1].Center - projectile.Center + vector2_31; float num297 = vector2_32.Length(); Vector2 vector2_33 = Vector2.Normalize(vector2_32); Microsoft.Xna.Framework.Rectangle r3 = texture2D5.Frame(); r3.Height /= 4; r3.Y += projectile.frame * r3.Height; Microsoft.Xna.Framework.Color newColor1 = Microsoft.Xna.Framework.Color.Lerp(color3, Microsoft.Xna.Framework.Color.White, 0.3f); Main.spriteBatch.Draw(texture2D5, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(r3), projectile.GetAlpha(newColor1), projectile.rotation, r3.Size() / 2f, projectile.scale, SpriteEffects.None, 0.0f); float num298 = num297 - (float) (r3.Height / 2 + texture2D6.Height) * projectile.scale; Vector2 vec = projectile.Center + vector2_33 * projectile.scale * (float) r3.Height / 2f; if ((double) num298 > 0.0) { float num299 = 0.0f; Microsoft.Xna.Framework.Rectangle r4 = new Microsoft.Xna.Framework.Rectangle(0, 0, texture.Width, texture.Height); while ((double) num299 + 1.0 < (double) num298) { if ((double) num298 - (double) num299 < (double) r4.Height) r4.Height = (int) ((double) num298 - (double) num299); 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.spriteBatch.Draw(texture, vec - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(r4), projectile.GetAlpha(newColor2), projectile.rotation, r4.Bottom(), projectile.scale, SpriteEffects.None, 0.0f); num299 += (float) r4.Height * projectile.scale; vec += vector2_33 * (float) r4.Height * projectile.scale; } } Microsoft.Xna.Framework.Point tileCoordinates1 = vec.ToTileCoordinates(); Microsoft.Xna.Framework.Color color29 = Microsoft.Xna.Framework.Color.Lerp(Lighting.GetColor(tileCoordinates1.X, tileCoordinates1.Y), Microsoft.Xna.Framework.Color.White, 0.3f); Microsoft.Xna.Framework.Rectangle rectangle = texture2D6.Frame(); if ((double) num298 < 0.0) rectangle.Height += (int) num298; Main.spriteBatch.Draw(texture2D6, vec - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangle), color29, projectile.rotation, new Vector2((float) rectangle.Width / 2f, (float) rectangle.Height), projectile.scale, SpriteEffects.None, 0.0f); } else if (projectile.type == 443) { Texture2D texture = Main.projectileTexture[projectile.type]; float num300 = 30f; float num301 = num300 * 4f; float num302 = 6.283185f * projectile.ai[0] / num300; float num303 = 6.283185f * projectile.ai[0] / num301; Vector2 vector2 = -Vector2.UnitY.RotatedBy((double) num302); float scale1 = (float) (0.75 + (double) vector2.Y * 0.25); float scale2 = (float) (0.800000011920929 - (double) vector2.Y * 0.200000002980232); int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; int y24 = height * projectile.frame; Vector2 position = projectile.position + new Vector2((float) projectile.width, (float) projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; Main.spriteBatch.Draw(texture, position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y24, texture.Width, height)), projectile.GetAlpha(color3), projectile.rotation + num303, new Vector2((float) texture.Width / 2f, (float) height / 2f), scale1, effects1, 0.0f); Main.spriteBatch.Draw(texture, position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y24, texture.Width, height)), projectile.GetAlpha(color3), projectile.rotation + (6.283185f - num303), new Vector2((float) texture.Width / 2f, (float) height / 2f), scale2, effects1, 0.0f); } else if (projectile.type == 656 || projectile.type == 657) { float num304 = 900f; if (projectile.type == 657) num304 = 300f; float num305 = 15f; float num306 = 15f; float num307 = projectile.ai[0]; float num308 = MathHelper.Clamp(num307 / 30f, 0.0f, 1f); if ((double) num307 > (double) num304 - 60.0) num308 = MathHelper.Lerp(1f, 0.0f, (float) (((double) num307 - ((double) num304 - 60.0)) / 60.0)); Microsoft.Xna.Framework.Point tileCoordinates = projectile.Center.ToTileCoordinates(); int topY; int bottomY; Collision.ExpandVertically(tileCoordinates.X, tileCoordinates.Y, out topY, out bottomY, (int) num305, (int) num306); int num309 = topY + 1; --bottomY; float num310 = 0.2f; Vector2 vector2_34 = new Vector2((float) tileCoordinates.X, (float) num309) * 16f + new Vector2(8f); Vector2 vector2_35 = new Vector2((float) tileCoordinates.X, (float) bottomY) * 16f + new Vector2(8f); Vector2.Lerp(vector2_34, vector2_35, 0.5f); Vector2 vector2_36 = new Vector2(0.0f, vector2_35.Y - vector2_34.Y); vector2_36.X = vector2_36.Y * num310; Vector2 vector2_37 = new Vector2(vector2_34.X - vector2_36.X / 2f, vector2_34.Y); Texture2D texture2D = Main.projectileTexture[projectile.type]; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(); Vector2 origin = r.Size() / 2f; float num311 = -0.06283186f * num307; Vector2 spinningpoint = Vector2.UnitY.RotatedBy((double) num307 * 0.100000001490116); float num312 = 0.0f; float num313 = 5.1f; Microsoft.Xna.Framework.Color color30 = new Microsoft.Xna.Framework.Color(212, 192, 100); for (float y25 = (float) (int) vector2_35.Y; (double) y25 > (double) (int) vector2_34.Y; y25 -= num313) { num312 += num313; float num314 = num312 / vector2_36.Y; float num315 = (float) ((double) num312 * 6.28318548202515 / -20.0); float num316 = num314 - 0.15f; Vector2 position = spinningpoint.RotatedBy((double) num315); Vector2 vector2_38 = new Vector2(0.0f, num314 + 1f); vector2_38.X = vector2_38.Y * num310; Microsoft.Xna.Framework.Color color31 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, color30, num314 * 2f); if ((double) num314 > 0.5) color31 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, color30, (float) (2.0 - (double) num314 * 2.0)); color31.A = (byte) ((double) color31.A * 0.5); color31 *= num308; position *= vector2_38 * 100f; position.Y = 0.0f; position.X = 0.0f; position += new Vector2(vector2_35.X, y25) - Main.screenPosition; Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(r), color31, num311 + num315, origin, 1f + num316, SpriteEffects.None, 0.0f); } } else if (projectile.type == 704) { float num317 = 300f; float num318 = projectile.ai[0]; float num319 = MathHelper.Clamp(num318 / 30f, 0.0f, 1f); if ((double) num318 > (double) num317 - 60.0) num319 = MathHelper.Lerp(1f, 0.0f, (float) (((double) num318 - ((double) num317 - 60.0)) / 60.0)); float num320 = 0.2f; Vector2 top = projectile.Top; Vector2 bottom = projectile.Bottom; Vector2.Lerp(top, bottom, 0.5f); Vector2 vector2_39 = new Vector2(0.0f, bottom.Y - top.Y); vector2_39.X = vector2_39.Y * num320; Vector2 vector2_40 = new Vector2(top.X - vector2_39.X / 2f, top.Y); Texture2D texture2D = Main.projectileTexture[projectile.type]; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(); Vector2 origin = r.Size() / 2f; float num321 = (float) (-0.157079637050629 * (double) num318 * ((double) projectile.velocity.X > 0.0 ? -1.0 : 1.0)); SpriteEffects effects3 = (double) projectile.velocity.X > 0.0 ? SpriteEffects.FlipVertically : SpriteEffects.None; bool flag4 = (double) projectile.velocity.X > 0.0; Vector2 spinningpoint = Vector2.UnitY.RotatedBy((double) num318 * 0.140000000596046); float num322 = 0.0f; float num323 = (float) (5.01000022888184 + (double) num318 / 150.0 * -0.899999976158142); if ((double) num323 < 4.1100001335144) num323 = 4.11f; Microsoft.Xna.Framework.Color color32 = new Microsoft.Xna.Framework.Color(160, 140, 100, (int) sbyte.MaxValue); Microsoft.Xna.Framework.Color color33 = new Microsoft.Xna.Framework.Color(140, 160, (int) byte.MaxValue, (int) sbyte.MaxValue); float t = num318 % 60f; Microsoft.Xna.Framework.Color color34 = (double) t >= 30.0 ? color33 * Utils.InverseLerp(38f, 30f, t, true) : color33 * Utils.InverseLerp(22f, 30f, t, true); bool flag5 = color34 != Microsoft.Xna.Framework.Color.Transparent; for (float y26 = (float) (int) bottom.Y; (double) y26 > (double) (int) top.Y; y26 -= num323) { num322 += num323; float num324 = num322 / vector2_39.Y; float num325 = (float) ((double) num322 * 6.28318548202515 / -20.0); if (flag4) num325 *= -1f; float num326 = num324 - 0.35f; Vector2 position = spinningpoint.RotatedBy((double) num325); Vector2 vector2_41 = new Vector2(0.0f, num324 + 1f); vector2_41.X = vector2_41.Y * num320; Microsoft.Xna.Framework.Color color35 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, color32, num324 * 2f); if ((double) num324 > 0.5) color35 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, color32, (float) (2.0 - (double) num324 * 2.0)); color35.A = (byte) ((double) color35.A * 0.5); color35 *= num319; position *= vector2_41 * 100f; position.Y = 0.0f; position.X = 0.0f; position += new Vector2(bottom.X, y26) - Main.screenPosition; if (flag5) { Microsoft.Xna.Framework.Color color36 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, color34, num324 * 2f); if ((double) num324 > 0.5) color36 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, color34, (float) (2.0 - (double) num324 * 2.0)); color36.A = (byte) ((double) color36.A * 0.5); color36 *= num319; Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(r), color36, num321 + num325, origin, (float) ((1.0 + (double) num326) * 0.800000011920929), effects3, 0.0f); } Main.spriteBatch.Draw(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(r), color35, num321 + num325, origin, 1f + num326, effects3, 0.0f); } } else if (projectile.type == 444 || projectile.type == 446 || projectile.type == 490 || projectile.type == 464 || projectile.type == 502 || projectile.type == 538 || projectile.type == 540 || projectile.type == 579 || projectile.type == 578 || projectile.type == 583 || projectile.type == 584 || projectile.type == 616 || projectile.type == 617 || projectile.type == 618 || projectile.type == 641 || projectile.type >= 646 && projectile.type <= 649 || projectile.type == 653 || projectile.type == 186 || projectile.type == 662 || projectile.type == 685 || projectile.type == 673 || projectile.type == 676 || projectile.type == 697 || projectile.type == 699 || projectile.type == 707 || projectile.type == 708) { Vector2 position14 = projectile.position + new Vector2((float) projectile.width, (float) projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; Texture2D texture3 = Main.projectileTexture[projectile.type]; Microsoft.Xna.Framework.Color alpha = projectile.GetAlpha(color3); Vector2 origin3 = new Vector2((float) texture3.Width, (float) texture3.Height) / 2f; if (projectile.type == 446) origin3.Y = 4f; if (projectile.type == 662 || projectile.type == 685) origin3 = new Vector2(6f, 6f); if (projectile.type == 699 || projectile.type == 708) origin3 = new Vector2(projectile.spriteDirection == 1 ? (float) texture3.Width - -8f : -8f, -8f); if (projectile.type == 502) { this.LoadProjectile(250); Texture2D texture4 = Main.projectileTexture[250]; Vector2 origin4 = new Vector2((float) (texture4.Width / 2), 0.0f); Vector2 vector2_42 = new Vector2((float) projectile.width, (float) projectile.height) / 2f; Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; white.A = (byte) 127; for (int index = projectile.oldPos.Length - 1; index > 0; --index) { Vector2 vector2_43 = projectile.oldPos[index] + vector2_42; if (!(vector2_43 == vector2_42)) { Vector2 vector2_44 = projectile.oldPos[index - 1] + vector2_42; float rotation = (vector2_44 - vector2_43).ToRotation() - 1.570796f; Vector2 scale = new Vector2(1f, Vector2.Distance(vector2_43, vector2_44) / (float) texture4.Height); Microsoft.Xna.Framework.Color color37 = white * (float) (1.0 - (double) index / (double) projectile.oldPos.Length); Main.spriteBatch.Draw(texture4, vector2_43 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(), color37, rotation, origin4, scale, effects1, 0.0f); } } } else if (projectile.type == 540 && projectile.velocity != Vector2.Zero) { float num327 = 0.0f; if ((double) projectile.ai[0] >= 10.0) num327 = (float) (((double) projectile.ai[0] - 10.0) / 10.0); if ((double) projectile.ai[0] >= 20.0) num327 = (float) ((20.0 - (double) projectile.ai[0]) / 10.0); if ((double) num327 > 1.0) num327 = 1f; if ((double) num327 < 0.0) num327 = 0.0f; if ((double) num327 != 0.0) { Texture2D texture5 = Main.extraTexture[47]; Vector2 origin5 = new Vector2((float) (texture5.Width / 2), 0.0f); Microsoft.Xna.Framework.Color color38 = alpha * num327 * 0.7f; Vector2 vector2_45 = projectile.Center - Main.screenPosition; Vector2 vector2_46 = projectile.velocity.ToRotation().ToRotationVector2() * (float) texture3.Width / 3f; Vector2 zero = Vector2.Zero; Vector2 position15 = vector2_45 + zero; float rotation = projectile.velocity.ToRotation() - 1.570796f; Vector2 scale = new Vector2(1f, (projectile.velocity.Length() - zero.Length() * 2f) / (float) texture5.Height); Main.spriteBatch.Draw(texture5, position15, new Microsoft.Xna.Framework.Rectangle?(), color38, rotation, origin5, scale, SpriteEffects.None, 0.0f); } } if (projectile.type == 578 || projectile.type == 579 || projectile.type == 641) { Microsoft.Xna.Framework.Color color39 = alpha * 0.8f; color39.A /= (byte) 2; Microsoft.Xna.Framework.Color color40 = Microsoft.Xna.Framework.Color.Lerp(alpha, Microsoft.Xna.Framework.Color.Black, 0.5f); color40.A = alpha.A; float num328 = (float) (0.949999988079071 + (double) (projectile.rotation * 0.75f).ToRotationVector2().Y * 0.100000001490116); Microsoft.Xna.Framework.Color color41 = color40 * num328; float scale = (float) (0.600000023841858 + (double) projectile.scale * 0.600000023841858 * (double) num328); Main.spriteBatch.Draw(Main.extraTexture[50], position14, new Microsoft.Xna.Framework.Rectangle?(), color41, (float) (-(double) projectile.rotation + 0.349999994039536), origin3, scale, effects1 ^ SpriteEffects.FlipHorizontally, 0.0f); Main.spriteBatch.Draw(Main.extraTexture[50], position14, new Microsoft.Xna.Framework.Rectangle?(), alpha, -projectile.rotation, origin3, projectile.scale, effects1 ^ SpriteEffects.FlipHorizontally, 0.0f); Main.spriteBatch.Draw(texture3, position14, new Microsoft.Xna.Framework.Rectangle?(), color39, (float) (-(double) projectile.rotation * 0.699999988079071), origin3, projectile.scale, effects1 ^ SpriteEffects.FlipHorizontally, 0.0f); Main.spriteBatch.Draw(Main.extraTexture[50], position14, new Microsoft.Xna.Framework.Rectangle?(), alpha * 0.8f, projectile.rotation * 0.5f, origin3, projectile.scale * 0.9f, effects1, 0.0f); alpha.A = (byte) 0; } if (projectile.type == 617) { Microsoft.Xna.Framework.Color color42 = alpha * 0.8f; color42.A /= (byte) 2; Microsoft.Xna.Framework.Color color43 = Microsoft.Xna.Framework.Color.Lerp(alpha, Microsoft.Xna.Framework.Color.Black, 0.5f); color43.A = alpha.A; float num329 = (float) (0.949999988079071 + (double) (projectile.rotation * 0.75f).ToRotationVector2().Y * 0.100000001490116); Microsoft.Xna.Framework.Color color44 = color43 * num329; float scale = (float) (0.600000023841858 + (double) projectile.scale * 0.600000023841858 * (double) num329); Main.spriteBatch.Draw(Main.extraTexture[50], position14, new Microsoft.Xna.Framework.Rectangle?(), color44, (float) (-(double) projectile.rotation + 0.349999994039536), origin3, scale, effects1 ^ SpriteEffects.FlipHorizontally, 0.0f); Main.spriteBatch.Draw(Main.extraTexture[50], position14, new Microsoft.Xna.Framework.Rectangle?(), alpha, -projectile.rotation, origin3, projectile.scale, effects1 ^ SpriteEffects.FlipHorizontally, 0.0f); Main.spriteBatch.Draw(texture3, position14, new Microsoft.Xna.Framework.Rectangle?(), color42, (float) (-(double) projectile.rotation * 0.699999988079071), origin3, projectile.scale, effects1 ^ SpriteEffects.FlipHorizontally, 0.0f); Main.spriteBatch.Draw(Main.extraTexture[50], position14, new Microsoft.Xna.Framework.Rectangle?(), alpha * 0.8f, projectile.rotation * 0.5f, origin3, projectile.scale * 0.9f, effects1, 0.0f); alpha.A = (byte) 0; } if ((0 | (projectile.type != 464 ? 0 : ((double) projectile.ai[1] != 1.0 ? 1 : 0))) == 0) Main.spriteBatch.Draw(texture3, position14, new Microsoft.Xna.Framework.Rectangle?(), alpha, projectile.rotation, origin3, projectile.scale, effects1, 0.0f); if (projectile.type == 464 && (double) projectile.ai[1] != 1.0) { Texture2D texture2D = Main.extraTexture[35]; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: 3); Vector2 origin6 = r.Size() / 2f; Vector2 spinningpoint = new Vector2(0.0f, -720f).RotatedBy((double) projectile.velocity.ToRotation()) * (float) ((double) projectile.ai[0] % 45.0 / 45.0); for (int index = 0; index < 6; ++index) { float num330 = (float) ((double) index * 6.28318548202515 / 6.0); Vector2 vector2 = projectile.Center + spinningpoint.RotatedBy((double) num330); Main.spriteBatch.Draw(texture2D, vector2 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(r), alpha, (float) ((double) num330 + (double) projectile.velocity.ToRotation() + 3.14159274101257), origin6, projectile.scale, effects1, 0.0f); r.Y += r.Height; if (r.Y >= texture2D.Height) r.Y = 0; } } else if (projectile.type == 490) { Main.spriteBatch.Draw(Main.extraTexture[34], position14, new Microsoft.Xna.Framework.Rectangle?(), alpha, -projectile.rotation, Main.extraTexture[34].Size() / 2f, projectile.scale, effects1, 0.0f); Main.spriteBatch.Draw(texture3, position14, new Microsoft.Xna.Framework.Rectangle?(), alpha, projectile.rotation, origin3, projectile.scale * 0.42f, effects1, 0.0f); Main.spriteBatch.Draw(Main.extraTexture[34], position14, new Microsoft.Xna.Framework.Rectangle?(), alpha, -projectile.rotation, Main.extraTexture[34].Size() / 2f, projectile.scale * 0.42f, effects1, 0.0f); } else if (projectile.type == 616) { Texture2D texture6 = Main.glowMaskTexture[193]; Main.spriteBatch.Draw(texture6, position14, new Microsoft.Xna.Framework.Rectangle?(), new Microsoft.Xna.Framework.Color((int) sbyte.MaxValue, (int) sbyte.MaxValue, (int) sbyte.MaxValue, 0), projectile.rotation, origin3, projectile.scale, effects1, 0.0f); } else if (projectile.type >= 646 && projectile.type <= 649) { Texture2D texture7 = Main.glowMaskTexture[203 + projectile.type - 646]; Main.spriteBatch.Draw(texture7, position14, new Microsoft.Xna.Framework.Rectangle?(), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue), projectile.rotation, origin3, projectile.scale, effects1, 0.0f); } else if (projectile.type == 699) { Texture2D texture8 = Main.glowMaskTexture[231]; Main.spriteBatch.Draw(texture8, position14, new Microsoft.Xna.Framework.Rectangle?(), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue), projectile.rotation, origin3, projectile.scale, effects1, 0.0f); } else if (projectile.type == 707 || projectile.type == 708) { float num331 = 0.5f; Texture2D texture2D = Main.glowMaskTexture[232]; Microsoft.Xna.Framework.Rectangle rectangle = texture2D.Frame(verticalFrames: 3, frameY: ((int) ((double) projectile.ai[0] % 9.0) / 3)); if (projectile.type == 708) { rectangle = texture2D.Frame(verticalFrames: 3, frameY: (Main.player[projectile.owner].itemAnimation % 9 / 3)); num331 = 0.75f; } Microsoft.Xna.Framework.Color color45 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue) * num331; Vector2 spinningpoint = new Vector2(2f, 0.0f).RotatedBy((double) projectile.rotation); for (float num332 = 0.0f; (double) num332 < 4.0; ++num332) Main.spriteBatch.Draw(texture2D, position14 + spinningpoint.RotatedBy((double) num332 * 1.57079637050629), new Microsoft.Xna.Framework.Rectangle?(rectangle), color45 * 0.5f, projectile.rotation, origin3, projectile.scale, effects1, 0.0f); Main.spriteBatch.Draw(texture2D, position14, new Microsoft.Xna.Framework.Rectangle?(rectangle), color45, projectile.rotation, origin3, projectile.scale, effects1, 0.0f); } } else if (projectile.type == 465 || projectile.type == 467 || projectile.type == 468 || projectile.type == 500 || projectile.type == 518 || projectile.type == 535 || projectile.type == 539 || projectile.type == 575 || projectile.type == 574 || projectile.type == 589 || projectile.type == 590 || projectile.type == 593 || projectile.type == 602 || projectile.type == 596 || projectile.type == 612 || projectile.type == 613 || projectile.type == 614 || projectile.type == 623 || projectile.type == 625 || projectile.type == 626 || projectile.type == 627 || projectile.type == 628 || projectile.type == 634 || projectile.type == 635 || projectile.type == 643 || projectile.type == 644 || projectile.type == 645 || projectile.type == 650 || projectile.type == 652 || projectile.type == 658 || projectile.type == 659 || projectile.type == 663 || projectile.type == 665 || projectile.type == 667 || projectile.type == 677 || projectile.type == 678 || projectile.type == 679 || projectile.type == 691 || projectile.type == 692 || projectile.type == 693 || projectile.type == 702 || projectile.type == 703 || projectile.type == 701 || projectile.type == 712) { Vector2 position16 = projectile.position + new Vector2((float) projectile.width, (float) projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; Texture2D texture2D7 = Main.projectileTexture[projectile.type]; Microsoft.Xna.Framework.Rectangle r = texture2D7.Frame(verticalFrames: Main.projFrames[projectile.type], frameY: projectile.frame); Microsoft.Xna.Framework.Color alpha = projectile.GetAlpha(color3); Vector2 origin7 = r.Size() / 2f; if (projectile.type == 539) { if ((double) projectile.ai[0] >= 210.0) { float num333 = (projectile.ai[0] - 210f) / 20f; if ((double) num333 > 1.0) num333 = 1f; Main.spriteBatch.Draw(Main.extraTexture[46], position16, new Microsoft.Xna.Framework.Rectangle?(), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 128) * num333, projectile.rotation, new Vector2(17f, 22f), projectile.scale, effects1, 0.0f); } } else if (projectile.type == 663 || projectile.type == 665 || projectile.type == 667) { position16 = projectile.Bottom + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; origin7 = r.Size() * new Vector2(0.5f, 1f); origin7.Y -= 2f; origin7.Y -= 2f; } else if (projectile.type == 691 || projectile.type == 692 || projectile.type == 693) { position16 = projectile.Bottom + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; origin7 = r.Size() * new Vector2(0.5f, 1f); origin7.Y -= 2f; origin7.Y -= 2f; } else if (projectile.type == 677 || projectile.type == 678 || projectile.type == 679) { if (projectile.spriteDirection == -1) effects1 ^= SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically; Texture2D texture2D8 = Main.extraTexture[83]; if (projectile.type == 678) texture2D8 = Main.extraTexture[84]; if (projectile.type == 679) texture2D8 = Main.extraTexture[85]; Vector2 position17 = projectile.Bottom + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; Vector2 origin8 = texture2D8.Size() * new Vector2(0.5f, 1f); origin8.Y -= 2f; Main.spriteBatch.Draw(texture2D8, position17, new Microsoft.Xna.Framework.Rectangle?(), alpha, 0.0f, origin8, 1f, effects1 & SpriteEffects.FlipHorizontally, 0.0f); origin7.X += (float) effects1.HasFlag((Enum) SpriteEffects.FlipHorizontally).ToDirectionInt(); ++position16.Y; position16.Y += 2f; if (projectile.type == 678) position16.Y += -4f; if (projectile.type == 679) { position16.Y -= 2f; if (!effects1.HasFlag((Enum) SpriteEffects.FlipVertically)) origin7.Y += 4f; else origin7.Y -= 4f; origin7.X += (float) (effects1.HasFlag((Enum) SpriteEffects.FlipHorizontally).ToDirectionInt() * 4); } } else if (projectile.type == 602) { origin7.X = (float) (r.Width - 6); --origin7.Y; r.Height -= 2; } else if (projectile.type == 589) { r = texture2D7.Frame(5, frameX: ((int) projectile.ai[1])); origin7 = r.Size() / 2f; } else if (projectile.type == 590) { r = texture2D7.Frame(3, frameX: projectile.frame); origin7 = r.Size() / 2f; } else if (projectile.type == 650) origin7.Y -= 4f; else if (projectile.type == 623) alpha.A /= (byte) 2; else if (projectile.type >= 625 && projectile.type <= 628) alpha.A /= (byte) 2; else if (projectile.type == 644) { Microsoft.Xna.Framework.Color color46 = Main.hslToRgb(projectile.ai[0], 1f, 0.5f).MultiplyRGBA(new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0)); Main.spriteBatch.Draw(texture2D7, position16, new Microsoft.Xna.Framework.Rectangle?(r), color46, projectile.rotation, origin7, projectile.scale * 2f, effects1, 0.0f); Main.spriteBatch.Draw(texture2D7, position16, new Microsoft.Xna.Framework.Rectangle?(r), color46, 0.0f, origin7, projectile.scale * 2f, effects1, 0.0f); if ((double) projectile.ai[1] != -1.0 && (double) projectile.Opacity > 0.300000011920929) { Vector2 v = Main.projectile[(int) projectile.ai[1]].Center - projectile.Center; Vector2 scale = new Vector2(1f, v.Length() / (float) texture2D7.Height); float rotation = v.ToRotation() + 1.570796f; float num334 = MathHelper.Clamp(MathHelper.Distance(30f, projectile.localAI[1]) / 20f, 0.0f, 1f); if ((double) num334 > 0.0) { Main.spriteBatch.Draw(texture2D7, position16 + v / 2f, new Microsoft.Xna.Framework.Rectangle?(r), color46 * num334, rotation, origin7, scale, effects1, 0.0f); Main.spriteBatch.Draw(texture2D7, position16 + v / 2f, new Microsoft.Xna.Framework.Rectangle?(r), alpha * num334, rotation, origin7, scale / 2f, effects1, 0.0f); } } } else if (projectile.type == 658) { Microsoft.Xna.Framework.Color color47 = Main.hslToRgb(0.136f, 1f, 0.5f).MultiplyRGBA(new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0)); Main.spriteBatch.Draw(texture2D7, position16, new Microsoft.Xna.Framework.Rectangle?(r), color47, 0.0f, origin7, new Vector2(1f, 5f) * projectile.scale * 2f, effects1, 0.0f); } Main.spriteBatch.Draw(texture2D7, position16, new Microsoft.Xna.Framework.Rectangle?(r), alpha, projectile.rotation, origin7, projectile.scale, effects1, 0.0f); if (projectile.type == 535) { for (int i2 = 0; i2 < 1000; ++i2) { if (Main.projectile[i2].active && Main.projectile[i2].owner == projectile.owner && Main.projectile[i2].type == 536) this.DrawProj(i2); } } else if (projectile.type == 702) { Texture2D texture2D9 = Main.FlameTexture[5]; Vector2 origin9 = texture2D9.Size() / 2f; Vector2 vector2 = new Vector2((float) (5 * projectile.spriteDirection), -10f).RotatedBy((double) projectile.rotation); ulong seed = (ulong) ((double) projectile.localAI[0] / 4.0); for (int index = 0; index < 5; ++index) { Microsoft.Xna.Framework.Color color48 = new Microsoft.Xna.Framework.Color(100, 100, 100, 0); float x20 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.15f; float y27 = (float) Utils.RandomInt(ref seed, -10, 1) * 0.35f; Main.spriteBatch.Draw(texture2D9, position16 + vector2 + new Vector2(x20, y27), new Microsoft.Xna.Framework.Rectangle?(), color48, projectile.rotation, origin9, 1f, effects1, 0.0f); } } else if (projectile.type == 663 || projectile.type == 665 || projectile.type == 667) { Texture2D texture = Main.glowMaskTexture[221]; switch (projectile.type) { case 665: texture = Main.glowMaskTexture[222]; break; case 667: texture = Main.glowMaskTexture[223]; break; } float num335 = (float) ((double) ((float) ((double) projectile.localAI[0] / 100.0 * 6.28318548202515)).ToRotationVector2().X * 1.0 + 1.0); Microsoft.Xna.Framework.Color color49 = new Microsoft.Xna.Framework.Color(140, 100, 40, 0) * (float) ((double) num335 / 4.0 + 0.5) * 1f; for (float num336 = 0.0f; (double) num336 < 4.0; ++num336) Main.spriteBatch.Draw(texture, position16 + (num336 * 1.570796f).ToRotationVector2() * num335, new Microsoft.Xna.Framework.Rectangle?(r), color49, projectile.rotation, origin7, projectile.scale, effects1, 0.0f); } else if (projectile.type == 644) Main.spriteBatch.Draw(texture2D7, position16, new Microsoft.Xna.Framework.Rectangle?(r), alpha, 0.0f, origin7, projectile.scale, effects1, 0.0f); else if (projectile.type == 658) Main.spriteBatch.Draw(texture2D7, position16, new Microsoft.Xna.Framework.Rectangle?(r), alpha, 0.0f, origin7, new Vector2(1f, 8f) * projectile.scale, effects1, 0.0f); else if (projectile.type == 602) { Texture2D texture2D10 = Main.extraTexture[60]; Microsoft.Xna.Framework.Color color50 = alpha; color50.A = (byte) 0; Microsoft.Xna.Framework.Color color51 = color50 * 0.3f; origin7 = texture2D10.Size() / 2f; Main.spriteBatch.Draw(texture2D10, position16, new Microsoft.Xna.Framework.Rectangle?(), color51, projectile.rotation - 1.570796f, origin7, projectile.scale, effects1, 0.0f); Texture2D texture2D11 = Main.extraTexture[59]; Microsoft.Xna.Framework.Color color52 = alpha; color52.A = (byte) 0; color52 *= 0.13f; origin7 = texture2D11.Size() / 2f; Main.spriteBatch.Draw(texture2D11, position16, new Microsoft.Xna.Framework.Rectangle?(), color52, projectile.rotation - 1.570796f, origin7, projectile.scale * 0.9f, effects1, 0.0f); } else if (projectile.type == 539) Main.spriteBatch.Draw(Main.glowMaskTexture[140], position16, new Microsoft.Xna.Framework.Rectangle?(r), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), projectile.rotation, origin7, projectile.scale, effects1, 0.0f); else if (projectile.type == 613) Main.spriteBatch.Draw(Main.glowMaskTexture[189], position16, new Microsoft.Xna.Framework.Rectangle?(r), new Microsoft.Xna.Framework.Color(128 - projectile.alpha / 2, 128 - projectile.alpha / 2, 128 - projectile.alpha / 2, 0), projectile.rotation, origin7, projectile.scale, effects1, 0.0f); else if (projectile.type == 614) Main.spriteBatch.Draw(Main.glowMaskTexture[190], position16, new Microsoft.Xna.Framework.Rectangle?(r), new Microsoft.Xna.Framework.Color(128 - projectile.alpha / 2, 128 - projectile.alpha / 2, 128 - projectile.alpha / 2, 0), projectile.rotation, origin7, projectile.scale, effects1, 0.0f); else if (projectile.type == 574) Main.spriteBatch.Draw(Main.glowMaskTexture[148], position16, new Microsoft.Xna.Framework.Rectangle?(r), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), projectile.rotation, origin7, projectile.scale, effects1, 0.0f); else if (projectile.type == 691 || projectile.type == 692 || projectile.type == 693) { Texture2D texture = Main.glowMaskTexture[235]; switch (projectile.type) { case 692: texture = Main.glowMaskTexture[236]; break; case 693: texture = Main.glowMaskTexture[237]; break; } Main.spriteBatch.Draw(texture, position16, new Microsoft.Xna.Framework.Rectangle?(r), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue), projectile.rotation, origin7, projectile.scale, effects1, 0.0f); } else if (projectile.type == 590) Main.spriteBatch.Draw(Main.glowMaskTexture[168], position16, new Microsoft.Xna.Framework.Rectangle?(r), new Microsoft.Xna.Framework.Color((int) sbyte.MaxValue - projectile.alpha / 2, (int) sbyte.MaxValue - projectile.alpha / 2, (int) sbyte.MaxValue - projectile.alpha / 2, 0), projectile.rotation, origin7, projectile.scale, effects1, 0.0f); else if (projectile.type == 623 || projectile.type >= 625 && projectile.type <= 628) { if ((double) Main.player[projectile.owner].ghostFade != 0.0) { float num337 = Main.player[projectile.owner].ghostFade * 5f; for (float num338 = 0.0f; (double) num338 < 4.0; ++num338) Main.spriteBatch.Draw(texture2D7, position16 + Vector2.UnitY.RotatedBy((double) num338 * 6.28318548202515 / 4.0) * num337, new Microsoft.Xna.Framework.Rectangle?(r), alpha * 0.1f, projectile.rotation, origin7, projectile.scale, effects1, 0.0f); } } else if (projectile.type == 643) { float num339 = (float) (Math.Cos(6.28318548202515 * ((double) projectile.localAI[0] / 60.0)) + 3.0 + 3.0); for (float num340 = 0.0f; (double) num340 < 4.0; ++num340) Main.spriteBatch.Draw(texture2D7, position16 + Vector2.UnitY.RotatedBy((double) num340 * 1.57079637050629) * num339, new Microsoft.Xna.Framework.Rectangle?(r), alpha * 0.2f, projectile.rotation, origin7, projectile.scale, effects1, 0.0f); } else if (projectile.type == 650) { int num341 = (int) ((double) projectile.localAI[0] / 6.28318548202515); float f = (float) ((double) projectile.localAI[0] % 6.28318548202515 - 3.14159274101257); float num342 = (float) Math.IEEERemainder((double) projectile.localAI[1], 1.0); if ((double) num342 < 0.0) ++num342; int num343 = (int) Math.Floor((double) projectile.localAI[1]); float num344 = 5f; float scale = (float) (1.0 + (double) num343 * 0.0199999995529652); if ((double) num341 == 1.0) num344 = 7f; Vector2 vector2 = f.ToRotationVector2() * num342 * num344 * projectile.scale; Texture2D texture2D12 = Main.extraTexture[66]; Main.spriteBatch.Draw(texture2D12, position16 + vector2, new Microsoft.Xna.Framework.Rectangle?(), alpha, projectile.rotation, texture2D12.Size() / 2f, scale, SpriteEffects.None, 0.0f); } } else if (projectile.type == 466) { Vector2 end1 = projectile.position + new Vector2((float) projectile.width, (float) projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; Texture2D tex = Main.extraTexture[33]; projectile.GetAlpha(color3); Vector2 vector2 = new Vector2(projectile.scale) / 2f; for (int index3 = 0; index3 < 3; ++index3) { Vector2 scale; if (index3 == 0) { scale = new Vector2(projectile.scale) * 0.6f; DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(115, 204, 219, 0) * 0.5f; } else if (index3 == 1) { scale = new Vector2(projectile.scale) * 0.4f; DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(113, 251, (int) byte.MaxValue, 0) * 0.5f; } else { scale = new Vector2(projectile.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 = projectile.oldPos.Length - 1; index4 > 0; --index4) { if (!(projectile.oldPos[index4] == Vector2.Zero)) { Vector2 start = projectile.oldPos[index4] + new Vector2((float) projectile.width, (float) projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; Vector2 end2 = projectile.oldPos[index4 - 1] + new Vector2((float) projectile.width, (float) projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; Utils.DrawLaser(Main.spriteBatch, tex, start, end2, scale, new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); } } if (projectile.oldPos[0] != Vector2.Zero) { DelegateMethods.f_1 = 1f; Vector2 start = projectile.oldPos[0] + new Vector2((float) projectile.width, (float) projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; Utils.DrawLaser(Main.spriteBatch, tex, start, end1, scale, new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); } } } else if (projectile.type == 580) { Vector2 end3 = projectile.position + new Vector2((float) projectile.width, (float) projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; Texture2D tex = Main.extraTexture[33]; projectile.GetAlpha(color3); Vector2 vector2 = new Vector2(projectile.scale) / 2f; for (int index5 = 0; index5 < 2; ++index5) { float num345 = (double) projectile.localAI[1] == -1.0 || (double) projectile.localAI[1] == 1.0 ? -0.2f : 0.0f; Vector2 scale; if (index5 == 0) { scale = new Vector2(projectile.scale) * (0.5f + num345); DelegateMethods.c_1 = new Microsoft.Xna.Framework.Color(115, 244, 219, 0) * 0.5f; } else { scale = new Vector2(projectile.scale) * (0.3f + num345); 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 = projectile.oldPos.Length - 1; index6 > 0; --index6) { if (!(projectile.oldPos[index6] == Vector2.Zero)) { Vector2 start = projectile.oldPos[index6] + new Vector2((float) projectile.width, (float) projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; Vector2 end4 = projectile.oldPos[index6 - 1] + new Vector2((float) projectile.width, (float) projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; Utils.DrawLaser(Main.spriteBatch, tex, start, end4, scale, new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); } } if (projectile.oldPos[0] != Vector2.Zero) { DelegateMethods.f_1 = 1f; Vector2 start = projectile.oldPos[0] + new Vector2((float) projectile.width, (float) projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; Utils.DrawLaser(Main.spriteBatch, tex, start, end3, scale, new Utils.LaserLineFraming(DelegateMethods.LightningLaserDraw)); } } } else if (projectile.type == 445) { Vector2 position = projectile.position + new Vector2((float) projectile.width, (float) projectile.height) / 2f + Vector2.UnitY * projectile.gfxOffY - Main.screenPosition; Texture2D texture9 = Main.projectileTexture[projectile.type]; Microsoft.Xna.Framework.Color alpha = projectile.GetAlpha(color3); Vector2 vector2_47 = Main.player[projectile.owner].RotatedRelativePoint(mountedCenter) + Vector2.UnitY * Main.player[projectile.owner].gfxOffY; Vector2 v = position + Main.screenPosition - vector2_47; Vector2 vector2_48 = Vector2.Normalize(v); float num346 = v.Length(); float rotation = v.ToRotation() + 1.570796f; float num347 = -5f; float num348 = num347 + 30f; Vector2 vector2_49 = new Vector2(2f, num346 - num348); Vector2 vector2_50 = Vector2.Lerp(position + Main.screenPosition, vector2_47 + vector2_48 * num348, 0.5f); Vector2 spinningpoint = -Vector2.UnitY.RotatedBy((double) projectile.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) num346 > (double) num348) { for (int index = 0; index < 2; ++index) { Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; Microsoft.Xna.Framework.Color color53; if (index % 2 == 0) { Microsoft.Xna.Framework.Color limeGreen = Microsoft.Xna.Framework.Color.LimeGreen; limeGreen.A = (byte) 128; color53 = limeGreen * 0.5f; } else { Microsoft.Xna.Framework.Color cornflowerBlue = Microsoft.Xna.Framework.Color.CornflowerBlue; cornflowerBlue.A = (byte) 128; color53 = cornflowerBlue * 0.5f; } Vector2 vector2_51 = new Vector2(vector2Array[index].X, 0.0f).RotatedBy((double) rotation) * 4f; Main.spriteBatch.Draw(Main.magicPixel, vector2_50 - Main.screenPosition + vector2_51, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1)), color53, rotation, Vector2.One / 2f, new Vector2(2f, num346 - num348), effects1, 0.0f); } } Texture2D texture10 = Main.itemTexture[Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].type]; Microsoft.Xna.Framework.Color color54 = Lighting.GetColor((int) vector2_47.X / 16, (int) vector2_47.Y / 16); Main.spriteBatch.Draw(texture10, vector2_47 - Main.screenPosition + vector2_48 * num347, new Microsoft.Xna.Framework.Rectangle?(), color54, (float) ((double) projectile.rotation + 1.57079637050629 + (effects1 == SpriteEffects.None ? 3.14159274101257 : 0.0)), new Vector2(effects1 == SpriteEffects.None ? 0.0f : (float) texture10.Width, (float) texture10.Height / 2f) + Vector2.UnitY * 1f, Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].scale, effects1, 0.0f); Main.spriteBatch.Draw(Main.glowMaskTexture[39], vector2_47 - Main.screenPosition + vector2_48 * num347, new Microsoft.Xna.Framework.Rectangle?(), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), (float) ((double) projectile.rotation + 1.57079637050629 + (effects1 == SpriteEffects.None ? 3.14159274101257 : 0.0)), new Vector2(effects1 == SpriteEffects.None ? 0.0f : (float) texture10.Width, (float) texture10.Height / 2f) + Vector2.UnitY * 1f, Main.player[projectile.owner].inventory[Main.player[projectile.owner].selectedItem].scale, effects1, 0.0f); if ((double) num346 > (double) num348) { for (int index = 2; index < 4; ++index) { Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; Microsoft.Xna.Framework.Color color55; if (index % 2 == 0) { Microsoft.Xna.Framework.Color limeGreen = Microsoft.Xna.Framework.Color.LimeGreen; limeGreen.A = (byte) 128; color55 = limeGreen * 0.5f; } else { Microsoft.Xna.Framework.Color cornflowerBlue = Microsoft.Xna.Framework.Color.CornflowerBlue; cornflowerBlue.A = (byte) 128; color55 = cornflowerBlue * 0.5f; } Vector2 vector2_52 = new Vector2(vector2Array[index].X, 0.0f).RotatedBy((double) rotation) * 4f; Main.spriteBatch.Draw(Main.magicPixel, vector2_50 - Main.screenPosition + vector2_52, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1)), color55, rotation, Vector2.One / 2f, new Vector2(2f, num346 - num348), effects1, 0.0f); } } float num349 = projectile.localAI[0] / 60f; if ((double) num349 > 0.5) num349 = 1f - num349; Main.spriteBatch.Draw(texture9, position, new Microsoft.Xna.Framework.Rectangle?(), alpha * num349 * 2f, projectile.rotation, new Vector2((float) texture9.Width, (float) texture9.Height) / 2f, projectile.scale, effects1, 0.0f); Main.spriteBatch.Draw(Main.glowMaskTexture[40], position, new Microsoft.Xna.Framework.Rectangle?(), alpha * (0.5f - num349) * 2f, projectile.rotation, new Vector2((float) texture9.Width, (float) texture9.Height) / 2f, projectile.scale, effects1, 0.0f); } else if (projectile.type >= 393 && projectile.type <= 395 || projectile.type == 398 || projectile.type == 423 || projectile.type == 450) { Texture2D texture11 = Main.projectileTexture[projectile.type]; int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; int y28 = height * projectile.frame; Main.spriteBatch.Draw(texture11, projectile.Center - Main.screenPosition + new Vector2(0.0f, projectile.gfxOffY - 2f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y28, texture11.Width, height)), projectile.GetAlpha(color3), projectile.rotation, new Vector2((float) texture11.Width / 2f, (float) height / 2f), projectile.scale, effects1, 0.0f); if (projectile.type == 398) { Texture2D miniMinotaurTexture = Main.miniMinotaurTexture; Main.spriteBatch.Draw(miniMinotaurTexture, projectile.Center - Main.screenPosition + new Vector2(0.0f, projectile.gfxOffY - 2f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y28, miniMinotaurTexture.Width, height)), new Microsoft.Xna.Framework.Color(250, 250, 250, projectile.alpha), projectile.rotation, new Vector2((float) miniMinotaurTexture.Width / 2f, (float) height / 2f), projectile.scale, effects1, 0.0f); } if (projectile.type == 423) { Texture2D texture12 = Main.glowMaskTexture[0]; Main.spriteBatch.Draw(texture12, projectile.Center - Main.screenPosition + new Vector2(0.0f, projectile.gfxOffY - 2f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y28, texture12.Width, height)), new Microsoft.Xna.Framework.Color(250, 250, 250, projectile.alpha), projectile.rotation, new Vector2((float) texture12.Width / 2f, (float) height / 2f), projectile.scale, effects1, 0.0f); } } else if (projectile.type == 385) { Texture2D texture = Main.projectileTexture[projectile.type]; int height = texture.Height / Main.projFrames[projectile.type]; int y29 = height * projectile.frame; int num350 = 8; int num351 = 2; float num352 = 0.4f; for (int index = 1; index < num350; index += num351) { ref Vector2 local = ref projectile.oldPos[index]; Microsoft.Xna.Framework.Color newColor = color3; Microsoft.Xna.Framework.Color color56 = projectile.GetAlpha(newColor) * ((float) (num350 - index) / 15f); Microsoft.Xna.Framework.Color alpha = projectile.GetAlpha(color3); Vector2 vector2 = projectile.oldPos[index] - Main.screenPosition + new Vector2(x18 + (float) num213, (float) (projectile.height / 2) + projectile.gfxOffY); Main.spriteBatch.Draw(texture, projectile.oldPos[index] + new Vector2((float) projectile.width, (float) projectile.height) / 2f - Main.screenPosition + new Vector2(0.0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y29, texture.Width, height)), Microsoft.Xna.Framework.Color.Lerp(alpha, color56, 0.3f), projectile.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), MathHelper.Lerp(projectile.scale, num352, (float) index / 15f), effects1, 0.0f); } Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition + new Vector2(0.0f, projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y29, texture.Width, height)), projectile.GetAlpha(color3), projectile.rotation, new Vector2((float) texture.Width / 2f, (float) height / 2f), projectile.scale, effects1, 0.0f); } else if (projectile.type == 388) { Texture2D texture = Main.projectileTexture[projectile.type]; int height = texture.Height / Main.projFrames[projectile.type]; int y30 = height * projectile.frame; int num353; int num354; if ((double) projectile.ai[0] == 2.0) { num353 = 10; num354 = 1; } else { num354 = 2; num353 = 5; } for (int index = 1; index < num353; index += num354) { ref Vector2 local = ref Main.npc[i].oldPos[index]; Microsoft.Xna.Framework.Color newColor = color3; Microsoft.Xna.Framework.Color color57 = projectile.GetAlpha(newColor) * ((float) (num353 - index) / 15f); Vector2 position = projectile.oldPos[index] - Main.screenPosition + new Vector2(x18 + (float) num213, (float) (projectile.height / 2) + projectile.gfxOffY); Main.spriteBatch.Draw(texture, position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y30, texture.Width, height)), color57, projectile.rotation, new Vector2(x18, (float) (projectile.height / 2 + num212)), projectile.scale, effects1, 0.0f); } Main.spriteBatch.Draw(texture, projectile.position - Main.screenPosition + new Vector2(x18 + (float) num213, (float) (projectile.height / 2) + projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y30, texture.Width, height)), projectile.GetAlpha(color3), projectile.rotation, new Vector2(x18, (float) (projectile.height / 2 + num212)), projectile.scale, effects1, 0.0f); } else if (Main.projFrames[projectile.type] > 1) { int height = Main.projectileTexture[projectile.type].Height / Main.projFrames[projectile.type]; int y31 = height * projectile.frame; if (projectile.type == 111) { Microsoft.Xna.Framework.Color oldColor = new Microsoft.Xna.Framework.Color((int) Main.player[projectile.owner].shirtColor.R, (int) Main.player[projectile.owner].shirtColor.G, (int) Main.player[projectile.owner].shirtColor.B); Microsoft.Xna.Framework.Color color58 = Lighting.GetColor((int) ((double) projectile.position.X + (double) projectile.width * 0.5) / 16, (int) (((double) projectile.position.Y + (double) projectile.height * 0.5) / 16.0), oldColor); Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], new Vector2(projectile.position.X - Main.screenPosition.X + x18 + (float) num213, projectile.position.Y - Main.screenPosition.Y + (float) (projectile.height / 2) + projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y31, Main.projectileTexture[projectile.type].Width, height)), projectile.GetAlpha(color58), projectile.rotation, new Vector2(x18, (float) (projectile.height / 2 + num212)), projectile.scale, effects1, 0.0f); } else { Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], new Vector2(projectile.position.X - Main.screenPosition.X + x18 + (float) num213, projectile.position.Y - Main.screenPosition.Y + (float) (projectile.height / 2) + projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y31, Main.projectileTexture[projectile.type].Width, height - 1)), projectile.GetAlpha(color3), projectile.rotation, new Vector2(x18, (float) (projectile.height / 2 + num212)), projectile.scale, effects1, 0.0f); if (projectile.type == 387) Main.spriteBatch.Draw(Main.eyeLaserSmallTexture, new Vector2(projectile.position.X - Main.screenPosition.X + x18 + (float) num213, projectile.position.Y - Main.screenPosition.Y + (float) (projectile.height / 2) + projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, y31, Main.projectileTexture[projectile.type].Width, height)), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0), projectile.rotation, new Vector2(x18, (float) (projectile.height / 2 + num212)), projectile.scale, effects1, 0.0f); } } else if (projectile.type == 383 || projectile.type == 399) { Texture2D texture = Main.projectileTexture[projectile.type]; Main.spriteBatch.Draw(texture, projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(), projectile.GetAlpha(color3), projectile.rotation, new Vector2((float) texture.Width, (float) texture.Height) / 2f, projectile.scale, effects1, 0.0f); } else if (projectile.type == 157 || projectile.type == 378) Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], new Vector2(projectile.position.X - Main.screenPosition.X + (float) (projectile.width / 2), projectile.position.Y - Main.screenPosition.Y + (float) (projectile.height / 2)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height)), projectile.GetAlpha(color3), projectile.rotation, new Vector2((float) (Main.projectileTexture[projectile.type].Width / 2), (float) (Main.projectileTexture[projectile.type].Height / 2)), projectile.scale, effects1, 0.0f); else if (projectile.type == 306) Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], new Vector2(projectile.position.X - Main.screenPosition.X + (float) (projectile.width / 2), projectile.position.Y - Main.screenPosition.Y + (float) (projectile.height / 2)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height)), projectile.GetAlpha(color3), projectile.rotation, new Vector2((float) (Main.projectileTexture[projectile.type].Width / 2), (float) (Main.projectileTexture[projectile.type].Height / 2)), projectile.scale, effects1, 0.0f); else if (projectile.type == 256) Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], new Vector2(projectile.position.X - Main.screenPosition.X + (float) (projectile.width / 2), projectile.position.Y - Main.screenPosition.Y + (float) (projectile.height / 2)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height)), projectile.GetAlpha(color3), projectile.rotation, new Vector2((float) (Main.projectileTexture[projectile.type].Width / 2), (float) (Main.projectileTexture[projectile.type].Height / 2)), projectile.scale, effects1, 0.0f); else if (projectile.aiStyle == 27) Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], new Vector2(projectile.position.X - Main.screenPosition.X + (float) (projectile.width / 2), projectile.position.Y - Main.screenPosition.Y + (float) (projectile.height / 2)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height)), projectile.GetAlpha(color3), projectile.rotation, new Vector2((float) Main.projectileTexture[projectile.type].Width, 0.0f), projectile.scale, effects1, 0.0f); else if (projectile.aiStyle == 19) { Vector2 zero = Vector2.Zero; if (projectile.spriteDirection == -1) zero.X = (float) Main.projectileTexture[projectile.type].Width; Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], new Vector2(projectile.position.X - Main.screenPosition.X + (float) (projectile.width / 2), projectile.position.Y - Main.screenPosition.Y + (float) (projectile.height / 2) + projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height)), projectile.GetAlpha(color3), projectile.rotation, zero, projectile.scale, effects1, 0.0f); } else if (projectile.type == 451) Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], projectile.Center - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(), projectile.GetAlpha(color3), projectile.rotation, new Vector2((float) Main.projectileTexture[projectile.type].Width, 0.0f), projectile.scale, effects1, 0.0f); else if (projectile.type == 434) { Vector2 vector2_53 = new Vector2(projectile.ai[0], projectile.ai[1]); Vector2 v = projectile.position - vector2_53; float y32 = (float) Math.Sqrt((double) v.X * (double) v.X + (double) v.Y * (double) v.Y); Vector2 vector2_54 = new Vector2(4f, y32); float rotation = v.ToRotation() + 1.570796f; Vector2 vector2_55 = Vector2.Lerp(projectile.position, vector2_53, 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; red *= projectile.localAI[0]; Microsoft.Xna.Framework.Color color59 = white * projectile.localAI[0]; float num355 = (float) Math.Sqrt((double) (projectile.damage / 50)); Main.spriteBatch.Draw(Main.magicPixel, vector2_55 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1)), red, rotation, Vector2.One / 2f, new Vector2(2f * num355, y32 + 8f), effects1, 0.0f); Main.spriteBatch.Draw(Main.magicPixel, vector2_55 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1)), red, rotation, Vector2.One / 2f, new Vector2(4f * num355, y32), effects1, 0.0f); Main.spriteBatch.Draw(Main.magicPixel, vector2_55 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 1, 1)), color59, rotation, Vector2.One / 2f, new Vector2(2f * num355, y32), effects1, 0.0f); } else { if (projectile.type == 94 && (double) projectile.ai[1] > 6.0) { for (int index = 0; index < 10; ++index) { Microsoft.Xna.Framework.Color alpha = projectile.GetAlpha(color3); float num356 = (float) (9 - index) / 9f; alpha.R = (byte) ((double) alpha.R * (double) num356); alpha.G = (byte) ((double) alpha.G * (double) num356); alpha.B = (byte) ((double) alpha.B * (double) num356); alpha.A = (byte) ((double) alpha.A * (double) num356); float num357 = (float) (9 - index) / 9f; Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], new Vector2(projectile.oldPos[index].X - Main.screenPosition.X + x18 + (float) num213, projectile.oldPos[index].Y - Main.screenPosition.Y + (float) (projectile.height / 2) + projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height)), alpha, projectile.rotation, new Vector2(x18, (float) (projectile.height / 2 + num212)), num357 * projectile.scale, effects1, 0.0f); } } if (projectile.type == 301) { for (int index = 0; index < 10; ++index) { Microsoft.Xna.Framework.Color alpha = projectile.GetAlpha(color3); float num358 = (float) (9 - index) / 9f; alpha.R = (byte) ((double) alpha.R * (double) num358); alpha.G = (byte) ((double) alpha.G * (double) num358); alpha.B = (byte) ((double) alpha.B * (double) num358); alpha.A = (byte) ((double) alpha.A * (double) num358); float num359 = (float) (9 - index) / 9f; Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], new Vector2(projectile.oldPos[index].X - Main.screenPosition.X + x18 + (float) num213, projectile.oldPos[index].Y - Main.screenPosition.Y + (float) (projectile.height / 2) + projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height)), alpha, projectile.rotation, new Vector2(x18, (float) (projectile.height / 2 + num212)), num359 * projectile.scale, effects1, 0.0f); } } if (projectile.type == 323 && projectile.alpha == 0) { for (int index = 1; index < 8; ++index) { float num360 = projectile.velocity.X * (float) index; float num361 = projectile.velocity.Y * (float) index; Microsoft.Xna.Framework.Color alpha = projectile.GetAlpha(color3); float num362 = 0.0f; if (index == 1) num362 = 0.7f; if (index == 2) num362 = 0.6f; if (index == 3) num362 = 0.5f; if (index == 4) num362 = 0.4f; if (index == 5) num362 = 0.3f; if (index == 6) num362 = 0.2f; if (index == 7) num362 = 0.1f; alpha.R = (byte) ((double) alpha.R * (double) num362); alpha.G = (byte) ((double) alpha.G * (double) num362); alpha.B = (byte) ((double) alpha.B * (double) num362); alpha.A = (byte) ((double) alpha.A * (double) num362); Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], new Vector2(projectile.position.X - Main.screenPosition.X + x18 + (float) num213 - num360, projectile.position.Y - Main.screenPosition.Y + (float) (projectile.height / 2) + projectile.gfxOffY - num361), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height)), alpha, projectile.rotation, new Vector2(x18, (float) (projectile.height / 2 + num212)), num362 + 0.2f, effects1, 0.0f); } } if (projectile.type == 117 && (double) projectile.ai[0] > 3.0) { for (int index = 1; index < 5; ++index) { float num363 = projectile.velocity.X * (float) index; float num364 = projectile.velocity.Y * (float) index; Microsoft.Xna.Framework.Color alpha = projectile.GetAlpha(color3); float num365 = 0.0f; if (index == 1) num365 = 0.4f; if (index == 2) num365 = 0.3f; if (index == 3) num365 = 0.2f; if (index == 4) num365 = 0.1f; alpha.R = (byte) ((double) alpha.R * (double) num365); alpha.G = (byte) ((double) alpha.G * (double) num365); alpha.B = (byte) ((double) alpha.B * (double) num365); alpha.A = (byte) ((double) alpha.A * (double) num365); Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], new Vector2(projectile.position.X - Main.screenPosition.X + x18 + (float) num213 - num363, projectile.position.Y - Main.screenPosition.Y + (float) (projectile.height / 2) + projectile.gfxOffY - num364), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height)), alpha, projectile.rotation, new Vector2(x18, (float) (projectile.height / 2 + num212)), projectile.scale, effects1, 0.0f); } } if (projectile.bobber) { if ((double) projectile.ai[1] > 0.0 && (double) projectile.ai[1] < 3930.0 && (double) projectile.ai[0] == 1.0) { int index = (int) projectile.ai[1]; Vector2 center = projectile.Center; float num366 = projectile.rotation; Vector2 vector2 = center; float num367 = x1 - vector2.X; float num368 = y1 - vector2.Y; num366 = (float) Math.Atan2((double) num368, (double) num367); float rotation; if ((double) projectile.velocity.X > 0.0) { effects1 = SpriteEffects.None; rotation = (float) Math.Atan2((double) num368, (double) num367) + 0.785f; if ((double) projectile.ai[1] == 2342.0) rotation -= 0.785f; } else { effects1 = SpriteEffects.FlipHorizontally; rotation = (float) Math.Atan2(-(double) num368, -(double) num367) - 0.785f; if ((double) projectile.ai[1] == 2342.0) rotation += 0.785f; } Main.spriteBatch.Draw(Main.itemTexture[index], new Vector2(center.X - Main.screenPosition.X, center.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[index].Width, Main.itemTexture[index].Height)), color3, rotation, new Vector2((float) (Main.itemTexture[index].Width / 2), (float) (Main.itemTexture[index].Height / 2)), projectile.scale, effects1, 0.0f); } else if ((double) projectile.ai[0] <= 1.0) Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], new Vector2(projectile.position.X - Main.screenPosition.X + x18 + (float) num213, projectile.position.Y - Main.screenPosition.Y + (float) (projectile.height / 2) + projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height)), projectile.GetAlpha(color3), projectile.rotation, new Vector2(x18, (float) (projectile.height / 2 + num212)), projectile.scale, effects1, 0.0f); } else { Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], new Vector2(projectile.position.X - Main.screenPosition.X + x18 + (float) num213, projectile.position.Y - Main.screenPosition.Y + (float) (projectile.height / 2) + projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height)), projectile.GetAlpha(color3), projectile.rotation, new Vector2(x18, (float) (projectile.height / 2 + num212)), projectile.scale, effects1, 0.0f); if (projectile.glowMask != (short) -1) Main.spriteBatch.Draw(Main.glowMaskTexture[(int) projectile.glowMask], new Vector2(projectile.position.X - Main.screenPosition.X + x18 + (float) num213, projectile.position.Y - Main.screenPosition.Y + (float) (projectile.height / 2) + projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height)), new Microsoft.Xna.Framework.Color(250, 250, 250, projectile.alpha), projectile.rotation, new Vector2(x18, (float) (projectile.height / 2 + num212)), projectile.scale, effects1, 0.0f); if (projectile.type == 473) Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], new Vector2(projectile.position.X - Main.screenPosition.X + x18 + (float) num213, projectile.position.Y - Main.screenPosition.Y + (float) (projectile.height / 2) + projectile.gfxOffY), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height)), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, 0, 0), projectile.rotation, new Vector2(x18, (float) (projectile.height / 2 + num212)), projectile.scale, effects1, 0.0f); } if (projectile.type == 106) Main.spriteBatch.Draw(Main.lightDiscTexture, new Vector2(projectile.position.X - Main.screenPosition.X + x18 + (float) num213, projectile.position.Y - Main.screenPosition.Y + (float) (projectile.height / 2)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height)), new Microsoft.Xna.Framework.Color(200, 200, 200, 0), projectile.rotation, new Vector2(x18, (float) (projectile.height / 2 + num212)), projectile.scale, effects1, 0.0f); if (projectile.type == 554 || projectile.type == 603) { for (int index = 1; index < 5; ++index) { float num369 = (float) ((double) projectile.velocity.X * (double) index * 0.5); float num370 = (float) ((double) projectile.velocity.Y * (double) index * 0.5); Microsoft.Xna.Framework.Color alpha = projectile.GetAlpha(color3); float num371 = 0.0f; if (index == 1) num371 = 0.4f; if (index == 2) num371 = 0.3f; if (index == 3) num371 = 0.2f; if (index == 4) num371 = 0.1f; alpha.R = (byte) ((double) alpha.R * (double) num371); alpha.G = (byte) ((double) alpha.G * (double) num371); alpha.B = (byte) ((double) alpha.B * (double) num371); alpha.A = (byte) ((double) alpha.A * (double) num371); Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], new Vector2(projectile.position.X - Main.screenPosition.X + x18 + (float) num213 - num369, projectile.position.Y - Main.screenPosition.Y + (float) (projectile.height / 2) + projectile.gfxOffY - num370), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height)), alpha, projectile.rotation, new Vector2(x18, (float) (projectile.height / 2 + num212)), projectile.scale, effects1, 0.0f); } } else if (projectile.type == 604) { int num372 = (int) projectile.ai[1] + 1; if (num372 > 7) num372 = 7; for (int index = 1; index < num372; ++index) { float num373 = (float) ((double) projectile.velocity.X * (double) index * 1.5); float num374 = (float) ((double) projectile.velocity.Y * (double) index * 1.5); Microsoft.Xna.Framework.Color alpha = projectile.GetAlpha(color3); float num375 = 0.0f; if (index == 1) num375 = 0.4f; if (index == 2) num375 = 0.3f; if (index == 3) num375 = 0.2f; if (index == 4) num375 = 0.1f; float num376 = (float) (0.400000005960464 - (double) index * 0.0599999986588955) * (float) (1.0 - (double) projectile.alpha / (double) byte.MaxValue); alpha.R = (byte) ((double) alpha.R * (double) num376); alpha.G = (byte) ((double) alpha.G * (double) num376); alpha.B = (byte) ((double) alpha.B * (double) num376); alpha.A = (byte) ((double) alpha.A * (double) num376 / 2.0); float scale = projectile.scale - (float) index * 0.1f; Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], new Vector2(projectile.position.X - Main.screenPosition.X + x18 + (float) num213 - num373, projectile.position.Y - Main.screenPosition.Y + (float) (projectile.height / 2) + projectile.gfxOffY - num374), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height)), alpha, projectile.rotation, new Vector2(x18, (float) (projectile.height / 2 + num212)), scale, effects1, 0.0f); } } else if (projectile.type == 553) { for (int index = 1; index < 5; ++index) { float num377 = (float) ((double) projectile.velocity.X * (double) index * 0.400000005960464); float num378 = (float) ((double) projectile.velocity.Y * (double) index * 0.400000005960464); Microsoft.Xna.Framework.Color alpha = projectile.GetAlpha(color3); float num379 = 0.0f; if (index == 1) num379 = 0.4f; if (index == 2) num379 = 0.3f; if (index == 3) num379 = 0.2f; if (index == 4) num379 = 0.1f; alpha.R = (byte) ((double) alpha.R * (double) num379); alpha.G = (byte) ((double) alpha.G * (double) num379); alpha.B = (byte) ((double) alpha.B * (double) num379); alpha.A = (byte) ((double) alpha.A * (double) num379); Main.spriteBatch.Draw(Main.projectileTexture[projectile.type], new Vector2(projectile.position.X - Main.screenPosition.X + x18 + (float) num213 - num377, projectile.position.Y - Main.screenPosition.Y + (float) (projectile.height / 2) + projectile.gfxOffY - num378), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.projectileTexture[projectile.type].Width, Main.projectileTexture[projectile.type].Height)), alpha, projectile.rotation, new Vector2(x18, (float) (projectile.height / 2 + num212)), projectile.scale, effects1, 0.0f); } } } } if (projectile.type != 525 || Main.gamePaused && !Main.gameMenu) return; Vector2 vector2_56 = projectile.position - Main.screenPosition; if ((double) Main.mouseX <= (double) vector2_56.X || (double) Main.mouseX >= (double) vector2_56.X + (double) projectile.width || (double) Main.mouseY <= (double) vector2_56.Y || (double) Main.mouseY >= (double) vector2_56.Y + (double) projectile.height) return; int num380 = (int) ((double) Main.player[Main.myPlayer].Center.X / 16.0); int num381 = (int) ((double) Main.player[Main.myPlayer].Center.Y / 16.0); int num382 = (int) projectile.Center.X / 16; int num383 = (int) projectile.Center.Y / 16; int lastTileRangeX = Main.player[Main.myPlayer].lastTileRangeX; int lastTileRangeY = Main.player[Main.myPlayer].lastTileRangeY; if (num380 < num382 - lastTileRangeX || num380 > num382 + lastTileRangeX + 1 || num381 < num383 - lastTileRangeY || num381 > num383 + lastTileRangeY + 1) return; Main.player[Main.myPlayer].noThrow = 2; Main.player[Main.myPlayer].showItemIcon = true; Main.player[Main.myPlayer].showItemIcon2 = 3213; if (PlayerInput.UsingGamepad) Main.player[Main.myPlayer].GamepadEnableGrappleCooldown(); if (!Main.mouseRight || !Main.mouseRightRelease || Player.StopMoneyTroughFromWorking != 0) return; Main.mouseRightRelease = false; if (Main.player[Main.myPlayer].chest == -2) { Main.PlaySound(SoundID.Item59); Main.player[Main.myPlayer].chest = -1; Recipe.FindRecipes(); } else { Main.player[Main.myPlayer].flyingPigChest = i; Main.player[Main.myPlayer].chest = -2; Main.player[Main.myPlayer].chestX = (int) ((double) projectile.Center.X / 16.0); Main.player[Main.myPlayer].chestY = (int) ((double) projectile.Center.Y / 16.0); Main.player[Main.myPlayer].talkNPC = -1; Main.npcShop = 0; Main.playerInventory = true; Main.PlaySound(SoundID.Item59); Recipe.FindRecipes(); } } private 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(); for (int index1 = 0; index1 < 1000; ++index1) { if (Main.projectile[index1].active) { if (Main.projectile[index1].type == 578 || Main.projectile[index1].type == 579 || Main.projectile[index1].type == 641 || Main.projectile[index1].type == 617) 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) this.DrawCacheProjsBehindProjectiles.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) 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) { 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, this.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 SortDrawCacheWorms() { List behindProjectiles = this.DrawCacheProjsBehindProjectiles; if (behindProjectiles.Count == 0) return; List> intListList = new List>(); for (int index1 = 0; index1 < behindProjectiles.Count; ++index1) { int index2 = behindProjectiles[index1]; if (Main.projectile[index2].type == 628) { behindProjectiles.Remove(index2); List intList = new List(); intList.Insert(0, index2); for (int byUuid = Projectile.GetByUUID(Main.projectile[index2].owner, Main.projectile[index2].ai[0]); byUuid >= 0 && !intList.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])) { intList.Insert(0, byUuid); behindProjectiles.Remove(byUuid); } intListList.Add(intList); index1 = -1; } } List intList1 = new List((IEnumerable) this.DrawCacheProjsBehindProjectiles); intListList.Add(intList1); this.DrawCacheProjsBehindProjectiles.Clear(); for (int index3 = 0; index3 < intListList.Count; ++index3) { for (int index4 = 0; index4 < intListList[index3].Count; ++index4) this.DrawCacheProjsBehindProjectiles.Add(intListList[index3][index4]); } for (int index = 0; index < this.DrawCacheProjsBehindProjectiles.Count; ++index) { Projectile projectile1 = Main.projectile[this.DrawCacheProjsBehindProjectiles[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.wof < 0 || !Main.player[Main.myPlayer].gross) return; for (int index = 0; index < (int) byte.MaxValue; ++index) { if (Main.player[index].active && Main.player[index].tongued && !Main.player[index].dead) { float num1 = Main.npc[Main.wof].position.X + (float) (Main.npc[Main.wof].width / 2); float num2 = Main.npc[Main.wof].position.Y + (float) (Main.npc[Main.wof].height / 2); Vector2 vector2 = new Vector2(Main.player[index].position.X + (float) Main.player[index].width * 0.5f, Main.player[index].position.Y + (float) Main.player[index].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) Main.chain12Texture.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(Main.chain12Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain12Texture.Width, Main.chain12Texture.Height)), color, rotation, new Vector2((float) Main.chain12Texture.Width * 0.5f, (float) Main.chain12Texture.Height * 0.5f), 1f, SpriteEffects.None, 0.0f); } } } } for (int index = 0; index < 200; ++index) { if (Main.npc[index].active && Main.npc[index].aiStyle == 29) { float num9 = Main.npc[Main.wof].position.X + (float) (Main.npc[Main.wof].width / 2); float y = Main.npc[Main.wof].position.Y; float num10 = (float) (Main.wofB - Main.wofT); bool flag1 = false; if (Main.npc[index].frameCounter > 7.0) flag1 = true; float num11 = (float) Main.wofT + num10 * Main.npc[index].ai[0]; Vector2 vector2 = new Vector2(Main.npc[index].position.X + (float) (Main.npc[index].width / 2), Main.npc[index].position.Y + (float) (Main.npc[index].height / 2)); float num12 = num9 - vector2.X; float num13 = num11 - vector2.Y; float rotation = (float) Math.Atan2((double) num13, (double) num12) - 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 num14 = (float) Math.Sqrt((double) num12 * (double) num12 + (double) num13 * (double) num13); if ((double) num14 < 40.0) { height = (int) num14 - 40 + 28; flag2 = false; } float num15 = 28f / num14; float num16 = num12 * num15; float num17 = num13 * num15; vector2.X += num16; vector2.Y += num17; num12 = num9 - vector2.X; num13 = num11 - vector2.Y; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) vector2.X / 16, (int) ((double) vector2.Y / 16.0)); Main.spriteBatch.Draw(Main.chain12Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chain4Texture.Width, height)), color, rotation, new Vector2((float) Main.chain4Texture.Width * 0.5f, (float) Main.chain4Texture.Height * 0.5f), 1f, effects, 0.0f); } } } int num18 = 140; float wofT = (float) Main.wofT; float wofB = (float) Main.wofB; float num19 = Main.screenPosition.Y + (float) Main.screenHeight; float num20 = (float) ((int) (((double) wofT - (double) Main.screenPosition.Y) / (double) num18) + 1) * (float) num18; if ((double) num20 > 0.0) wofT -= num20; float num21 = wofT; float x1 = Main.npc[Main.wof].position.X; float num22 = num19 - wofT; bool flag3 = true; SpriteEffects effects1 = SpriteEffects.None; if (Main.npc[Main.wof].spriteDirection == 1) effects1 = SpriteEffects.FlipHorizontally; if (Main.npc[Main.wof].direction > 0) x1 -= 80f; int num23 = 0; if (!Main.gamePaused) ++Main.wofF; if (Main.wofF > 12) { num23 = 280; if (Main.wofF > 17) Main.wofF = 0; } else if (Main.wofF > 6) num23 = 140; while (flag3) { float num24 = num19 - num21; if ((double) num24 > (double) num18) num24 = (float) num18; bool flag4 = true; int num25 = 0; while (flag4) { int x2 = (int) ((double) x1 + (double) (Main.wofTexture.Width / 2)) / 16; int y = (int) ((double) num21 + (double) num25) / 16; Main.spriteBatch.Draw(Main.wofTexture, new Vector2(x1 - Main.screenPosition.X, num21 + (float) num25 - Main.screenPosition.Y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, num23 + num25, Main.wofTexture.Width, 16)), Lighting.GetColor(x2, y), 0.0f, new Vector2(), 1f, effects1, 0.0f); num25 += 16; if ((double) num25 >= (double) num24) flag4 = false; } num21 += (float) num18; if ((double) num21 >= (double) num19) flag3 = false; } } protected void DrawGhost(Player drawPlayer, Vector2 Position, float shadow = 0.0f) { SpriteEffects effects = drawPlayer.direction != 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; Microsoft.Xna.Framework.Color immuneAlpha = drawPlayer.GetImmuneAlpha(Lighting.GetColor((int) ((double) drawPlayer.position.X + (double) drawPlayer.width * 0.5) / 16, (int) ((double) drawPlayer.position.Y + (double) drawPlayer.height * 0.5) / 16, new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor / 2 + 100, (int) Main.mouseTextColor / 2 + 100, (int) Main.mouseTextColor / 2 + 100, (int) Main.mouseTextColor / 2 + 100)), shadow); Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, Main.ghostTexture.Height / 4 * drawPlayer.ghostFrame, Main.ghostTexture.Width, Main.ghostTexture.Height / 4); Vector2 origin = new Vector2((float) rectangle.Width * 0.5f, (float) rectangle.Height * 0.5f); Main.spriteBatch.Draw(Main.ghostTexture, new Vector2((float) (int) ((double) drawPlayer.position.X - (double) Main.screenPosition.X + (double) (rectangle.Width / 2)), (float) (int) ((double) drawPlayer.position.Y - (double) Main.screenPosition.Y + (double) (rectangle.Height / 2))), new Microsoft.Xna.Framework.Rectangle?(rectangle), immuneAlpha, 0.0f, origin, 1f, effects, 0.0f); } protected Vector2 DrawPlayerItemPos(float gravdir, int itemtype) { float num = 10f; Vector2 vector2 = new Vector2((float) (Main.itemTexture[itemtype].Width / 2), (float) (Main.itemTexture[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 += 4f * gravdir; } else if (itemtype == 3107) { num = 4f; vector2.Y += 2f * gravdir; } else if (itemtype == 3008) { num = -12f; 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 == 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 == 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; 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; } break; } break; } } vector2.X = num; return vector2; } protected 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; } protected void DrawPlayerHead(Player drawPlayer, float X, float Y, float Alpha = 1f, float Scale = 1f) { int shaderId1 = 0; int skinVariant = drawPlayer.skinVariant; short shaderId2 = (short) drawPlayer.hairDye; if (drawPlayer.head == 0 && shaderId2 == (short) 0) shaderId2 = (short) 1; for (int index1 = 0; index1 < 16 + drawPlayer.extraAccessorySlots * 2; ++index1) { int index2 = index1 % 10; if (drawPlayer.dye[index2] != null && drawPlayer.armor[index1].type > 0 && drawPlayer.armor[index1].stack > 0 && drawPlayer.armor[index1].faceSlot > (sbyte) 0 && drawPlayer.armor[index1].faceSlot < (sbyte) 9) { int dye = (int) drawPlayer.dye[index2].dye; } } if (drawPlayer.face > (sbyte) 0 && drawPlayer.face < (sbyte) 9) this.LoadAccFace((int) drawPlayer.face); if (drawPlayer.dye[0] != null) shaderId1 = (int) drawPlayer.dye[0].dye; this.LoadHair(drawPlayer.hair); float scale = Scale; Microsoft.Xna.Framework.Color color1 = this.quickAlpha(Microsoft.Xna.Framework.Color.White, Alpha); Microsoft.Xna.Framework.Color color2 = this.quickAlpha(drawPlayer.eyeColor, Alpha); Microsoft.Xna.Framework.Color color3 = this.quickAlpha(drawPlayer.GetHairColor(false), Alpha); Microsoft.Xna.Framework.Color color4 = this.quickAlpha(drawPlayer.skinColor, Alpha); Microsoft.Xna.Framework.Color color5 = this.quickAlpha(Microsoft.Xna.Framework.Color.White, Alpha); SpriteEffects spriteEffects = SpriteEffects.None; if (drawPlayer.direction < 0) spriteEffects = SpriteEffects.FlipHorizontally; Vector2 origin = new Vector2((float) drawPlayer.legFrame.Width * 0.5f, (float) drawPlayer.legFrame.Height * 0.4f); Vector2 position = drawPlayer.position; Microsoft.Xna.Framework.Rectangle bodyFrame1 = drawPlayer.bodyFrame; drawPlayer.bodyFrame.Y = 0; drawPlayer.position = Main.screenPosition; drawPlayer.position.X += X; drawPlayer.position.Y += Y; drawPlayer.position.X -= 6f; drawPlayer.position.Y -= 4f; float playerHeadOffset = (float) drawPlayer.mount.PlayerHeadOffset; drawPlayer.position.Y -= playerHeadOffset; if (drawPlayer.head > 0 && drawPlayer.head < 216) this.LoadArmorHead(drawPlayer.head); if (drawPlayer.face > (sbyte) 0 && drawPlayer.face < (sbyte) 9) this.LoadAccFace((int) drawPlayer.face); bool flag1 = false; if (drawPlayer.head == 10 || drawPlayer.head == 12 || drawPlayer.head == 28 || drawPlayer.head == 62 || drawPlayer.head == 97 || drawPlayer.head == 106 || drawPlayer.head == 113 || drawPlayer.head == 116 || drawPlayer.head == 119 || drawPlayer.head == 133 || drawPlayer.head == 138 || drawPlayer.head == 139 || drawPlayer.head == 163 || drawPlayer.head == 178 || drawPlayer.head == 181 || drawPlayer.head == 191 || drawPlayer.head == 198) flag1 = true; bool flag2 = false; if (drawPlayer.head == 161 || drawPlayer.head == 14 || drawPlayer.head == 15 || drawPlayer.head == 16 || drawPlayer.head == 18 || drawPlayer.head == 21 || drawPlayer.head == 24 || drawPlayer.head == 25 || drawPlayer.head == 26 || drawPlayer.head == 40 || drawPlayer.head == 44 || drawPlayer.head == 51 || drawPlayer.head == 56 || drawPlayer.head == 59 || drawPlayer.head == 60 || drawPlayer.head == 67 || drawPlayer.head == 68 || drawPlayer.head == 69 || drawPlayer.head == 114 || drawPlayer.head == 121 || drawPlayer.head == 126 || drawPlayer.head == 130 || drawPlayer.head == 136 || drawPlayer.head == 140 || drawPlayer.head == 145 || drawPlayer.head == 158 || drawPlayer.head == 159 || drawPlayer.head == 184 || drawPlayer.head == 190 || (double) drawPlayer.head == 92.0 || drawPlayer.head == 195) flag2 = true; if (drawPlayer.head != 38 && drawPlayer.head != 135) { Main.spriteBatch.Draw(Main.playerTextures[skinVariant, 0], new Vector2(drawPlayer.position.X - Main.screenPosition.X - (float) (drawPlayer.bodyFrame.Width / 2) + (float) (drawPlayer.width / 2), (float) ((double) drawPlayer.position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color4, drawPlayer.headRotation, origin, scale, spriteEffects, 0.0f); Main.spriteBatch.Draw(Main.playerTextures[skinVariant, 1], new Vector2(drawPlayer.position.X - Main.screenPosition.X - (float) (drawPlayer.bodyFrame.Width / 2) + (float) (drawPlayer.width / 2), (float) ((double) drawPlayer.position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color1, drawPlayer.headRotation, origin, scale, spriteEffects, 0.0f); Main.spriteBatch.Draw(Main.playerTextures[skinVariant, 2], new Vector2(drawPlayer.position.X - Main.screenPosition.X - (float) (drawPlayer.bodyFrame.Width / 2) + (float) (drawPlayer.width / 2), (float) ((double) drawPlayer.position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color2, drawPlayer.headRotation, origin, scale, spriteEffects, 0.0f); } if (flag1) { DrawData drawData = new DrawData(Main.armorHeadTexture[drawPlayer.head], new Vector2(drawPlayer.position.X - Main.screenPosition.X - (float) (drawPlayer.bodyFrame.Width / 2) + (float) (drawPlayer.width / 2), (float) ((double) drawPlayer.position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color5, drawPlayer.headRotation, origin, scale, spriteEffects, 0); GameShaders.Armor.Apply(shaderId1, (Entity) drawPlayer, new DrawData?(drawData)); drawData.Draw(Main.spriteBatch); Main.pixelShader.CurrentTechnique.Passes[0].Apply(); if (!drawPlayer.invis) { Microsoft.Xna.Framework.Rectangle bodyFrame2 = drawPlayer.bodyFrame; bodyFrame2.Y -= 336; if (bodyFrame2.Y < 0) bodyFrame2.Y = 0; drawData = new DrawData(Main.playerHairTexture[drawPlayer.hair], new Vector2(drawPlayer.position.X - Main.screenPosition.X - (float) (drawPlayer.bodyFrame.Width / 2) + (float) (drawPlayer.width / 2), (float) ((double) drawPlayer.position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin, new Microsoft.Xna.Framework.Rectangle?(bodyFrame2), color3, drawPlayer.headRotation, origin, scale, spriteEffects, 0); GameShaders.Hair.Apply(shaderId2, drawPlayer, new DrawData?(drawData)); drawData.Draw(Main.spriteBatch); Main.pixelShader.CurrentTechnique.Passes[0].Apply(); } } if (flag2) { Microsoft.Xna.Framework.Rectangle bodyFrame3 = drawPlayer.bodyFrame; bodyFrame3.Y -= 336; if (bodyFrame3.Y < 0) bodyFrame3.Y = 0; if (!drawPlayer.invis) { DrawData drawData = new DrawData(Main.playerHairAltTexture[drawPlayer.hair], new Vector2(drawPlayer.position.X - Main.screenPosition.X - (float) (drawPlayer.bodyFrame.Width / 2) + (float) (drawPlayer.width / 2), (float) ((double) drawPlayer.position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin, new Microsoft.Xna.Framework.Rectangle?(bodyFrame3), color3, drawPlayer.headRotation, origin, scale, spriteEffects, 0); GameShaders.Hair.Apply(shaderId2, drawPlayer, new DrawData?(drawData)); drawData.Draw(Main.spriteBatch); Main.pixelShader.CurrentTechnique.Passes[0].Apply(); } } if (drawPlayer.head == 23) { Microsoft.Xna.Framework.Rectangle bodyFrame4 = drawPlayer.bodyFrame; bodyFrame4.Y -= 336; if (bodyFrame4.Y < 0) bodyFrame4.Y = 0; DrawData drawData; if (!drawPlayer.invis) { drawData = new DrawData(Main.playerHairTexture[drawPlayer.hair], new Vector2(drawPlayer.position.X - Main.screenPosition.X - (float) (drawPlayer.bodyFrame.Width / 2) + (float) (drawPlayer.width / 2), (float) ((double) drawPlayer.position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin, new Microsoft.Xna.Framework.Rectangle?(bodyFrame4), color3, drawPlayer.headRotation, origin, scale, spriteEffects, 0); GameShaders.Hair.Apply(shaderId2, drawPlayer, new DrawData?(drawData)); drawData.Draw(Main.spriteBatch); Main.pixelShader.CurrentTechnique.Passes[0].Apply(); } drawData = new DrawData(Main.armorHeadTexture[drawPlayer.head], new Vector2(drawPlayer.position.X - Main.screenPosition.X - (float) (drawPlayer.bodyFrame.Width / 2) + (float) (drawPlayer.width / 2), (float) ((double) drawPlayer.position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color5, drawPlayer.headRotation, origin, scale, spriteEffects, 0); GameShaders.Armor.Apply(shaderId1, (Entity) drawPlayer, new DrawData?(drawData)); drawData.Draw(Main.spriteBatch); Main.pixelShader.CurrentTechnique.Passes[0].Apply(); } else if (drawPlayer.head == 14 || drawPlayer.head == 56 || drawPlayer.head == 158) { Microsoft.Xna.Framework.Rectangle bodyFrame5 = drawPlayer.bodyFrame; if (drawPlayer.head == 158) bodyFrame5.Height -= 2; int num = 0; if (bodyFrame5.Y == bodyFrame5.Height * 6) bodyFrame5.Height -= 2; else if (bodyFrame5.Y == bodyFrame5.Height * 7) num = -2; else if (bodyFrame5.Y == bodyFrame5.Height * 8) num = -2; else if (bodyFrame5.Y == bodyFrame5.Height * 9) num = -2; else if (bodyFrame5.Y == bodyFrame5.Height * 10) num = -2; else if (bodyFrame5.Y == bodyFrame5.Height * 13) bodyFrame5.Height -= 2; else if (bodyFrame5.Y == bodyFrame5.Height * 14) num = -2; else if (bodyFrame5.Y == bodyFrame5.Height * 15) num = -2; else if (bodyFrame5.Y == bodyFrame5.Height * 16) num = -2; bodyFrame5.Y += num; DrawData drawData = new DrawData(Main.armorHeadTexture[drawPlayer.head], new Vector2(drawPlayer.position.X - Main.screenPosition.X - (float) (drawPlayer.bodyFrame.Width / 2) + (float) (drawPlayer.width / 2), (float) ((double) drawPlayer.position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0) + (float) num) + drawPlayer.headPosition + origin, new Microsoft.Xna.Framework.Rectangle?(bodyFrame5), color5, drawPlayer.headRotation, origin, scale, spriteEffects, 0); GameShaders.Armor.Apply(shaderId1, (Entity) drawPlayer, new DrawData?(drawData)); drawData.Draw(Main.spriteBatch); Main.pixelShader.CurrentTechnique.Passes[0].Apply(); } else if (drawPlayer.head > 0 && drawPlayer.head < 216 && drawPlayer.head != 28) { DrawData drawData = new DrawData(Main.armorHeadTexture[drawPlayer.head], new Vector2(drawPlayer.position.X - Main.screenPosition.X - (float) (drawPlayer.bodyFrame.Width / 2) + (float) (drawPlayer.width / 2), (float) ((double) drawPlayer.position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color5, drawPlayer.headRotation, origin, scale, spriteEffects, 0); GameShaders.Armor.Apply(shaderId1, (Entity) drawPlayer, new DrawData?(drawData)); drawData.Draw(Main.spriteBatch); Main.pixelShader.CurrentTechnique.Passes[0].Apply(); } else { Microsoft.Xna.Framework.Rectangle bodyFrame6 = drawPlayer.bodyFrame; bodyFrame6.Y -= 336; if (bodyFrame6.Y < 0) bodyFrame6.Y = 0; DrawData drawData = new DrawData(Main.playerHairTexture[drawPlayer.hair], new Vector2(drawPlayer.position.X - Main.screenPosition.X - (float) (drawPlayer.bodyFrame.Width / 2) + (float) (drawPlayer.width / 2), (float) ((double) drawPlayer.position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin, new Microsoft.Xna.Framework.Rectangle?(bodyFrame6), color3, drawPlayer.headRotation, origin, scale, spriteEffects, 0); GameShaders.Hair.Apply(shaderId2, drawPlayer, new DrawData?(drawData)); drawData.Draw(Main.spriteBatch); Main.pixelShader.CurrentTechnique.Passes[0].Apply(); } if (drawPlayer.face > (sbyte) 0 && drawPlayer.face < (sbyte) 9) { DrawData drawData = drawPlayer.face != (sbyte) 7 ? new DrawData(Main.accFaceTexture[(int) drawPlayer.face], new Vector2((float) (int) ((double) drawPlayer.position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) drawPlayer.position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color5, drawPlayer.headRotation, origin, scale, spriteEffects, 0) : new DrawData(Main.accFaceTexture[(int) drawPlayer.face], new Vector2((float) (int) ((double) drawPlayer.position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) drawPlayer.position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), new Microsoft.Xna.Framework.Color(200, 200, 200, 150), drawPlayer.headRotation, origin, scale, spriteEffects, 0); GameShaders.Armor.Apply(shaderId1, (Entity) drawPlayer, new DrawData?(drawData)); drawData.Draw(Main.spriteBatch); Main.pixelShader.CurrentTechnique.Passes[0].Apply(); } drawPlayer.position = position; drawPlayer.bodyFrame.Y = bodyFrame1.Y; } protected void DrawPlayerStoned(Player drawPlayer, Vector2 Position) { if (drawPlayer.dead) return; SpriteEffects effects = drawPlayer.direction != 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None; Main.spriteBatch.Draw(Main.extraTexture[37], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 8.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(), Lighting.GetColor((int) ((double) Position.X + (double) drawPlayer.width * 0.5) / 16, (int) ((double) Position.Y + (double) drawPlayer.height * 0.5) / 16, Microsoft.Xna.Framework.Color.White), 0.0f, new Vector2((float) (Main.extraTexture[37].Width / 2), (float) (Main.extraTexture[37].Height / 2)), 1f, effects, 0.0f); } public void DrawPlayer( Player drawPlayer, Vector2 Position, float rotation, Vector2 rotationOrigin, float shadow = 0.0f) { int num1 = drawPlayer.controlDown ? 1 : 0; float num2 = 0.0f; DrawData drawData = new DrawData(); int projectileDrawPosition = -1; Main.playerDrawData.Clear(); Main.playerDrawDust.Clear(); Main.playerDrawGore.Clear(); Vector2 vector2_1 = Position + (drawPlayer.itemLocation - drawPlayer.position); int num3 = 0; bool flag1 = false; bool flag2 = false; bool flag3 = false; int skinVariant = drawPlayer.skinVariant; if (drawPlayer.body == 77 || drawPlayer.body == 103 || drawPlayer.body == 41 || drawPlayer.body == 100 || drawPlayer.body == 10 || drawPlayer.body == 11 || drawPlayer.body == 12 || drawPlayer.body == 13 || drawPlayer.body == 14 || drawPlayer.body == 43 || drawPlayer.body == 15 || drawPlayer.body == 16 || drawPlayer.body == 20 || drawPlayer.body == 39 || drawPlayer.body == 50 || drawPlayer.body == 38 || drawPlayer.body == 40 || drawPlayer.body == 57 || drawPlayer.body == 44 || drawPlayer.body == 52 || drawPlayer.body == 53 || drawPlayer.body == 68 || drawPlayer.body == 81 || drawPlayer.body == 85 || drawPlayer.body == 88 || drawPlayer.body == 98 || drawPlayer.body == 86 || drawPlayer.body == 87 || drawPlayer.body == 99 || drawPlayer.body == 165 || drawPlayer.body == 166 || drawPlayer.body == 167 || drawPlayer.body == 171 || drawPlayer.body == 45 || drawPlayer.body == 168 || drawPlayer.body == 169 || drawPlayer.body == 42 || drawPlayer.body == 180 || drawPlayer.body == 181 || drawPlayer.body == 183 || drawPlayer.body == 186 || drawPlayer.body == 187 || drawPlayer.body == 188 || drawPlayer.body == 64 || drawPlayer.body == 189 || drawPlayer.body == 191 || drawPlayer.body == 192 || drawPlayer.body == 198 || drawPlayer.body == 199 || drawPlayer.body == 202 || drawPlayer.body == 203 || drawPlayer.body == 58 || drawPlayer.body == 59 || drawPlayer.body == 60 || drawPlayer.body == 61 || drawPlayer.body == 62 || drawPlayer.body == 63 || drawPlayer.body == 36 || drawPlayer.body == 104 || drawPlayer.body == 184 || drawPlayer.body == 74 || drawPlayer.body == 78 || drawPlayer.body == 185 || drawPlayer.body == 196 || drawPlayer.body == 197 || drawPlayer.body == 182 || drawPlayer.body == 87 || drawPlayer.body == 76 || drawPlayer.body == 209) flag1 = true; if (drawPlayer.body == 99 || drawPlayer.body == 98 || drawPlayer.body == 100 || drawPlayer.body == 167 || drawPlayer.body == 171 || drawPlayer.body == 183 || drawPlayer.body == 191 || drawPlayer.body == 192 || drawPlayer.body == 198 || drawPlayer.body == 199 || drawPlayer.body == 202 || drawPlayer.body == 201 || drawPlayer.body == 203 || drawPlayer.body == 197 || drawPlayer.body == 182 || drawPlayer.body == 87) flag2 = true; if (drawPlayer.heldProj >= 0 && (double) shadow == 0.0) { switch (Main.projectile[drawPlayer.heldProj].type) { case 460: case 535: case 600: flag3 = true; break; } } bool flag4 = false; if (drawPlayer.head == 10 || drawPlayer.head == 12 || drawPlayer.head == 28 || drawPlayer.head == 62 || drawPlayer.head == 97 || drawPlayer.head == 106 || drawPlayer.head == 113 || drawPlayer.head == 116 || drawPlayer.head == 119 || drawPlayer.head == 133 || drawPlayer.head == 138 || drawPlayer.head == 139 || drawPlayer.head == 163 || drawPlayer.head == 178 || drawPlayer.head == 181 || drawPlayer.head == 191 || drawPlayer.head == 198) flag4 = true; bool flag5 = false; if (drawPlayer.head == 161 || drawPlayer.head == 14 || drawPlayer.head == 15 || drawPlayer.head == 16 || drawPlayer.head == 18 || drawPlayer.head == 21 || drawPlayer.head == 24 || drawPlayer.head == 25 || drawPlayer.head == 26 || drawPlayer.head == 40 || drawPlayer.head == 44 || drawPlayer.head == 51 || drawPlayer.head == 56 || drawPlayer.head == 59 || drawPlayer.head == 60 || drawPlayer.head == 67 || drawPlayer.head == 68 || drawPlayer.head == 69 || drawPlayer.head == 114 || drawPlayer.head == 121 || drawPlayer.head == 126 || drawPlayer.head == 130 || drawPlayer.head == 136 || drawPlayer.head == 140 || drawPlayer.head == 145 || drawPlayer.head == 158 || drawPlayer.head == 159 || drawPlayer.head == 184 || drawPlayer.head == 190 || drawPlayer.head == 92 || drawPlayer.head == 195 || drawPlayer.head == 215) flag5 = true; bool flag6 = false; if (drawPlayer.face == (sbyte) 4 || drawPlayer.face == (sbyte) 3 || drawPlayer.face == (sbyte) 2) flag6 = true; int num4 = (int) drawPlayer.hairDye; if (drawPlayer.head == 0 && num4 == 0) num4 = 1; float playerOffset = (float) drawPlayer.mount.PlayerOffset; Position.Y -= playerOffset; int cHead = 0; if (drawPlayer.dye[0] != null) cHead = (int) drawPlayer.dye[0].dye; int num5 = 0; if (drawPlayer.dye[1] != null) num5 = (int) drawPlayer.dye[1].dye; int num6 = 0; if (drawPlayer.dye[2] != null) num6 = (int) drawPlayer.dye[2].dye; if (drawPlayer.wearsRobe) num6 = num5; 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; for (int index1 = 0; index1 < 20; ++index1) { int index2 = index1 % 10; if (drawPlayer.dye[index2] != null && drawPlayer.armor[index1].type > 0 && drawPlayer.armor[index1].stack > 0 && (index1 / 10 >= 1 || !drawPlayer.hideVisual[index2] || drawPlayer.armor[index1].wingSlot > (sbyte) 0 || drawPlayer.armor[index1].type == 934)) { if (drawPlayer.armor[index1].handOnSlot > (sbyte) 0 && drawPlayer.armor[index1].handOnSlot < (sbyte) 20) num7 = (int) drawPlayer.dye[index2].dye; if (drawPlayer.armor[index1].handOffSlot > (sbyte) 0 && drawPlayer.armor[index1].handOffSlot < (sbyte) 12) num8 = (int) drawPlayer.dye[index2].dye; if (drawPlayer.armor[index1].backSlot > (sbyte) 0 && drawPlayer.armor[index1].backSlot < (sbyte) 14) num9 = (int) drawPlayer.dye[index2].dye; if (drawPlayer.armor[index1].frontSlot > (sbyte) 0 && drawPlayer.armor[index1].frontSlot < (sbyte) 5) num10 = (int) drawPlayer.dye[index2].dye; if (drawPlayer.armor[index1].shoeSlot > (sbyte) 0 && drawPlayer.armor[index1].shoeSlot < (sbyte) 18) num11 = (int) drawPlayer.dye[index2].dye; if (drawPlayer.armor[index1].waistSlot > (sbyte) 0 && drawPlayer.armor[index1].waistSlot < (sbyte) 13) num12 = (int) drawPlayer.dye[index2].dye; if (drawPlayer.armor[index1].shieldSlot > (sbyte) 0 && drawPlayer.armor[index1].shieldSlot < (sbyte) 7) num13 = (int) drawPlayer.dye[index2].dye; if (drawPlayer.armor[index1].neckSlot > (sbyte) 0 && drawPlayer.armor[index1].neckSlot < (sbyte) 10) num14 = (int) drawPlayer.dye[index2].dye; if (drawPlayer.armor[index1].faceSlot > (sbyte) 0 && drawPlayer.armor[index1].faceSlot < (sbyte) 9) num15 = (int) drawPlayer.dye[index2].dye; if (drawPlayer.armor[index1].balloonSlot > (sbyte) 0 && drawPlayer.armor[index1].balloonSlot < (sbyte) 18) num16 = (int) drawPlayer.dye[index2].dye; if (drawPlayer.armor[index1].wingSlot > (sbyte) 0 && drawPlayer.armor[index1].wingSlot < (sbyte) 40) num17 = (int) drawPlayer.dye[index2].dye; if (drawPlayer.armor[index1].type == 934) num18 = (int) drawPlayer.dye[index2].dye; } } Mount.currentShader = !drawPlayer.mount.Active ? 0 : (drawPlayer.mount.Cart ? drawPlayer.cMinecart : drawPlayer.cMount); Microsoft.Xna.Framework.Color color1 = drawPlayer.GetImmuneAlpha(drawPlayer.GetHairColor(), shadow); Microsoft.Xna.Framework.Color color2 = drawPlayer.GetImmuneAlpha(Lighting.GetColor((int) ((double) Position.X + (double) drawPlayer.width * 0.5) / 16, (int) (((double) Position.Y + (double) drawPlayer.height * 0.25) / 16.0), Microsoft.Xna.Framework.Color.White), shadow); Microsoft.Xna.Framework.Color color3 = drawPlayer.GetImmuneAlpha(Lighting.GetColor((int) ((double) Position.X + (double) drawPlayer.width * 0.5) / 16, (int) (((double) Position.Y + (double) drawPlayer.height * 0.25) / 16.0), drawPlayer.eyeColor), shadow); Microsoft.Xna.Framework.Color color4 = drawPlayer.GetImmuneAlpha(Lighting.GetColor((int) ((double) Position.X + (double) drawPlayer.width * 0.5) / 16, (int) (((double) Position.Y + (double) drawPlayer.height * 0.25) / 16.0), drawPlayer.skinColor), shadow); Microsoft.Xna.Framework.Color color5 = drawPlayer.GetImmuneAlpha(Lighting.GetColor((int) ((double) Position.X + (double) drawPlayer.width * 0.5) / 16, (int) (((double) Position.Y + (double) drawPlayer.height * 0.5) / 16.0), drawPlayer.skinColor), shadow); Microsoft.Xna.Framework.Color color6 = drawPlayer.GetImmuneAlpha(Lighting.GetColor((int) ((double) Position.X + (double) drawPlayer.width * 0.5) / 16, (int) (((double) Position.Y + (double) drawPlayer.height * 0.75) / 16.0), drawPlayer.skinColor), shadow); Microsoft.Xna.Framework.Color color7 = drawPlayer.GetImmuneAlphaPure(Lighting.GetColor((int) ((double) Position.X + (double) drawPlayer.width * 0.5) / 16, (int) (((double) Position.Y + (double) drawPlayer.height * 0.5) / 16.0), drawPlayer.shirtColor), shadow); Microsoft.Xna.Framework.Color color8 = drawPlayer.GetImmuneAlphaPure(Lighting.GetColor((int) ((double) Position.X + (double) drawPlayer.width * 0.5) / 16, (int) (((double) Position.Y + (double) drawPlayer.height * 0.5) / 16.0), drawPlayer.underShirtColor), shadow); Microsoft.Xna.Framework.Color color9 = drawPlayer.GetImmuneAlphaPure(Lighting.GetColor((int) ((double) Position.X + (double) drawPlayer.width * 0.5) / 16, (int) (((double) Position.Y + (double) drawPlayer.height * 0.75) / 16.0), drawPlayer.pantsColor), shadow); Microsoft.Xna.Framework.Color color10 = drawPlayer.GetImmuneAlphaPure(Lighting.GetColor((int) ((double) Position.X + (double) drawPlayer.width * 0.5) / 16, (int) (((double) Position.Y + (double) drawPlayer.height * 0.75) / 16.0), drawPlayer.shoeColor), shadow); Microsoft.Xna.Framework.Color color11 = drawPlayer.GetImmuneAlphaPure(Lighting.GetColor((int) ((double) Position.X + (double) drawPlayer.width * 0.5) / 16, (int) ((double) Position.Y + (double) drawPlayer.height * 0.25) / 16, Microsoft.Xna.Framework.Color.White), shadow); Microsoft.Xna.Framework.Color color12 = drawPlayer.GetImmuneAlphaPure(Lighting.GetColor((int) ((double) Position.X + (double) drawPlayer.width * 0.5) / 16, (int) ((double) Position.Y + (double) drawPlayer.height * 0.5) / 16, Microsoft.Xna.Framework.Color.White), shadow); Microsoft.Xna.Framework.Color drawColor = color12; Microsoft.Xna.Framework.Color color13 = drawPlayer.GetImmuneAlphaPure(Lighting.GetColor((int) ((double) Position.X + (double) drawPlayer.width * 0.5) / 16, (int) ((double) Position.Y + (double) drawPlayer.height * 0.75) / 16, Microsoft.Xna.Framework.Color.White), shadow); Microsoft.Xna.Framework.Color color14 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 100); int num19 = 0; int num20 = 0; int num21 = 0; int num22 = 0; int index3 = -1; int index4 = -1; int index5 = -1; int index6 = -1; Microsoft.Xna.Framework.Color color15 = Microsoft.Xna.Framework.Color.Transparent; Microsoft.Xna.Framework.Color color16 = Microsoft.Xna.Framework.Color.Transparent; Microsoft.Xna.Framework.Color color17 = Microsoft.Xna.Framework.Color.Transparent; Microsoft.Xna.Framework.Color color18 = Microsoft.Xna.Framework.Color.Transparent; switch (drawPlayer.head) { case 169: ++num19; break; case 170: ++num20; break; case 171: ++num21; break; case 189: ++num22; break; } switch (drawPlayer.body) { case 175: ++num19; break; case 176: ++num20; break; case 177: ++num21; break; case 190: ++num22; break; } switch (drawPlayer.legs) { case 110: ++num19; break; case 111: ++num20; break; case 112: ++num21; break; case 130: ++num22; break; } Microsoft.Xna.Framework.Color underShirtColor = drawPlayer.underShirtColor; underShirtColor.A = (byte) 180; if (drawPlayer.head == 169) { index3 = 15; byte num23 = (byte) (62.5 * (double) (1 + num19)); color15 = new Microsoft.Xna.Framework.Color((int) num23, (int) num23, (int) num23, 0); } else if (drawPlayer.head == 210) { index3 = 242; byte num24 = 127; color15 = new Microsoft.Xna.Framework.Color((int) num24, (int) num24, (int) num24, 0); } else if (drawPlayer.head == 214) { index3 = 245; color15 = underShirtColor; } else if (drawPlayer.head == 170) { index3 = 16; byte num25 = (byte) (62.5 * (double) (1 + num20)); color15 = new Microsoft.Xna.Framework.Color((int) num25, (int) num25, (int) num25, 0); } else if (drawPlayer.head == 189) { index3 = 184; byte num26 = (byte) (62.5 * (double) (1 + num22)); color15 = new Microsoft.Xna.Framework.Color((int) num26, (int) num26, (int) num26, 0); color11 = drawPlayer.GetImmuneAlphaPure(new Microsoft.Xna.Framework.Color((int) num26, (int) num26, (int) num26, (int) byte.MaxValue), shadow); } else if (drawPlayer.head == 171) { byte num27 = (byte) (62.5 * (double) (1 + num21)); color11 = drawPlayer.GetImmuneAlphaPure(new Microsoft.Xna.Framework.Color((int) num27, (int) num27, (int) num27, (int) byte.MaxValue), shadow); } else if (drawPlayer.head == 175) { index3 = 41; color15 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0); } else if (drawPlayer.head == 193) { index3 = 209; color15 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue); } else if (drawPlayer.head == 109) { index3 = 208; color15 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0); } else if (drawPlayer.head == 178) { index3 = 96; color15 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0); } if (drawPlayer.body == 175) { index4 = !drawPlayer.Male ? 18 : 13; byte num28 = (byte) (62.5 * (double) (1 + num19)); color16 = new Microsoft.Xna.Framework.Color((int) num28, (int) num28, (int) num28, 0); } else if (drawPlayer.body == 208) { index4 = !drawPlayer.Male ? 247 : 246; index5 = 248; color16 = underShirtColor; color17 = underShirtColor; } else if (drawPlayer.body == 190) { index4 = !drawPlayer.Male ? 186 : 185; index5 = 188; byte num29 = (byte) (62.5 * (double) (1 + num22)); color16 = new Microsoft.Xna.Framework.Color((int) num29, (int) num29, (int) num29, 0); color17 = new Microsoft.Xna.Framework.Color((int) num29, (int) num29, (int) num29, 0); color12 = drawPlayer.GetImmuneAlphaPure(new Microsoft.Xna.Framework.Color((int) num29, (int) num29, (int) num29, (int) byte.MaxValue), shadow); } else if (drawPlayer.body == 176) { index4 = !drawPlayer.Male ? 19 : 14; index5 = 12; byte num30 = (byte) (62.5 * (double) (1 + num20)); color16 = new Microsoft.Xna.Framework.Color((int) num30, (int) num30, (int) num30, 0); color17 = new Microsoft.Xna.Framework.Color((int) num30, (int) num30, (int) num30, 0); } else if (drawPlayer.body == 194) { index4 = 210; index5 = 211; color16 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue); color17 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue); } else if (drawPlayer.body == 177) { byte num31 = (byte) (62.5 * (double) (1 + num21)); color12 = drawPlayer.GetImmuneAlphaPure(new Microsoft.Xna.Framework.Color((int) num31, (int) num31, (int) num31, (int) byte.MaxValue), shadow); } else if (drawPlayer.body == 179) { index4 = !drawPlayer.Male ? 43 : 42; index5 = 44; color16 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0); color17 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0); } if (drawPlayer.legs == 111) { index6 = 17; byte num32 = (byte) (62.5 * (double) (1 + num20)); color18 = new Microsoft.Xna.Framework.Color((int) num32, (int) num32, (int) num32, 0); } else if (drawPlayer.legs == 157) { index6 = 249; color18 = underShirtColor; } else if (drawPlayer.legs == 158) { index6 = 250; color18 = underShirtColor; } else if (drawPlayer.legs == 110) { index6 = 199; byte num33 = (byte) (62.5 * (double) (1 + num19)); color18 = new Microsoft.Xna.Framework.Color((int) num33, (int) num33, (int) num33, 0); } else if (drawPlayer.legs == 112) { byte num34 = (byte) (62.5 * (double) (1 + num21)); color13 = drawPlayer.GetImmuneAlphaPure(new Microsoft.Xna.Framework.Color((int) num34, (int) num34, (int) num34, (int) byte.MaxValue), shadow); } else if (drawPlayer.legs == 134) { index6 = 212; color18 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue); } else if (drawPlayer.legs == 130) { byte num35 = (byte) ((int) sbyte.MaxValue * (1 + num22)); index6 = 187; color18 = new Microsoft.Xna.Framework.Color((int) num35, (int) num35, (int) num35, 0); color13 = drawPlayer.GetImmuneAlphaPure(new Microsoft.Xna.Framework.Color((int) num35, (int) num35, (int) num35, (int) byte.MaxValue), shadow); } float alphaReduction = shadow; color15 = drawPlayer.GetImmuneAlphaPure(color15, alphaReduction); color16 = drawPlayer.GetImmuneAlphaPure(color16, alphaReduction); color17 = drawPlayer.GetImmuneAlphaPure(color17, alphaReduction); color18 = drawPlayer.GetImmuneAlphaPure(color18, alphaReduction); if (drawPlayer.head > 0 && drawPlayer.head < 216) this.LoadArmorHead(drawPlayer.head); if (drawPlayer.body > 0 && drawPlayer.body < 210) this.LoadArmorBody(drawPlayer.body); if (drawPlayer.legs > 0 && drawPlayer.legs < 161) this.LoadArmorLegs(drawPlayer.legs); if (drawPlayer.handon > (sbyte) 0 && drawPlayer.handon < (sbyte) 20) this.LoadAccHandsOn((int) drawPlayer.handon); if (drawPlayer.handoff > (sbyte) 0 && drawPlayer.handoff < (sbyte) 12) this.LoadAccHandsOff((int) drawPlayer.handoff); if (drawPlayer.back > (sbyte) 0 && drawPlayer.back < (sbyte) 14) this.LoadAccBack((int) drawPlayer.back); if (drawPlayer.front > (sbyte) 0 && drawPlayer.front < (sbyte) 5) this.LoadAccFront((int) drawPlayer.front); if (drawPlayer.shoe > (sbyte) 0 && drawPlayer.shoe < (sbyte) 18) this.LoadAccShoes((int) drawPlayer.shoe); if (drawPlayer.waist > (sbyte) 0 && drawPlayer.waist < (sbyte) 13) this.LoadAccWaist((int) drawPlayer.waist); if (drawPlayer.shield > (sbyte) 0 && drawPlayer.shield < (sbyte) 7) this.LoadAccShield((int) drawPlayer.shield); if (drawPlayer.neck > (sbyte) 0 && drawPlayer.neck < (sbyte) 10) this.LoadAccNeck((int) drawPlayer.neck); if (drawPlayer.face > (sbyte) 0 && drawPlayer.face < (sbyte) 9) this.LoadAccFace((int) drawPlayer.face); if (drawPlayer.balloon > (sbyte) 0 && drawPlayer.balloon < (sbyte) 18) this.LoadAccBalloon((int) drawPlayer.balloon); this.LoadHair(drawPlayer.hair); if ((drawPlayer.head == 78 || drawPlayer.head == 79 || drawPlayer.head == 80) && drawPlayer.body == 51 && drawPlayer.legs == 47) { float num36 = (float) ((double) Main.mouseTextColor / 200.0 - 0.300000011920929); if ((double) shadow != 0.0) num36 = 0.0f; color11.R = (byte) ((double) color11.R * (double) num36); color11.G = (byte) ((double) color11.G * (double) num36); color11.B = (byte) ((double) color11.B * (double) num36); color12.R = (byte) ((double) color12.R * (double) num36); color12.G = (byte) ((double) color12.G * (double) num36); color12.B = (byte) ((double) color12.B * (double) num36); color13.R = (byte) ((double) color13.R * (double) num36); color13.G = (byte) ((double) color13.G * (double) num36); color13.B = (byte) ((double) color13.B * (double) num36); } if (drawPlayer.head == 193 && drawPlayer.body == 194 && drawPlayer.legs == 134) { float num37 = (float) (0.600000023841858 - (double) drawPlayer.ghostFade * 0.300000011920929); if ((double) shadow != 0.0) num37 = 0.0f; color11.R = (byte) ((double) color11.R * (double) num37); color11.G = (byte) ((double) color11.G * (double) num37); color11.B = (byte) ((double) color11.B * (double) num37); color12.R = (byte) ((double) color12.R * (double) num37); color12.G = (byte) ((double) color12.G * (double) num37); color12.B = (byte) ((double) color12.B * (double) num37); color13.R = (byte) ((double) color13.R * (double) num37); color13.G = (byte) ((double) color13.G * (double) num37); color13.B = (byte) ((double) color13.B * (double) num37); } if ((double) shadow > 0.0) { color6 = Microsoft.Xna.Framework.Color.Transparent; color5 = Microsoft.Xna.Framework.Color.Transparent; color4 = Microsoft.Xna.Framework.Color.Transparent; color1 = Microsoft.Xna.Framework.Color.Transparent; color3 = Microsoft.Xna.Framework.Color.Transparent; color2 = Microsoft.Xna.Framework.Color.Transparent; } float R = 1f; float G = 1f; float B = 1f; float A = 1f; if (drawPlayer.honey && Main.rand.Next(30) == 0 && (double) shadow == 0.0) { int index7 = Dust.NewDust(Position, drawPlayer.width, drawPlayer.height, 152, Alpha: 150); Main.dust[index7].velocity.Y = 0.3f; Main.dust[index7].velocity.X *= 0.1f; Main.dust[index7].scale += (float) Main.rand.Next(3, 4) * 0.1f; Main.dust[index7].alpha = 100; Main.dust[index7].noGravity = true; Main.dust[index7].velocity += drawPlayer.velocity * 0.1f; Main.playerDrawDust.Add(index7); } if (drawPlayer.dryadWard && (double) drawPlayer.velocity.X != 0.0 && Main.rand.Next(4) == 0) { int index8 = Dust.NewDust(new Vector2(drawPlayer.position.X - 2f, (float) ((double) drawPlayer.position.Y + (double) drawPlayer.height - 2.0)), drawPlayer.width + 4, 4, 163, Alpha: 100, Scale: 1.5f); Main.dust[index8].noGravity = true; Main.dust[index8].noLight = true; Main.dust[index8].velocity *= 0.0f; } if (drawPlayer.poisoned) { if (Main.rand.Next(50) == 0 && (double) shadow == 0.0) { int index9 = Dust.NewDust(Position, drawPlayer.width, drawPlayer.height, 46, Alpha: 150, Scale: 0.2f); Main.dust[index9].noGravity = true; Main.dust[index9].fadeIn = 1.9f; Main.playerDrawDust.Add(index9); } R *= 0.65f; B *= 0.75f; } if (drawPlayer.venom) { if (Main.rand.Next(10) == 0 && (double) shadow == 0.0) { int index10 = Dust.NewDust(Position, drawPlayer.width, drawPlayer.height, 171, Alpha: 100, Scale: 0.5f); Main.dust[index10].noGravity = true; Main.dust[index10].fadeIn = 1.5f; Main.playerDrawDust.Add(index10); } G *= 0.45f; R *= 0.75f; } if (drawPlayer.onFire) { if (Main.rand.Next(4) == 0 && (double) shadow == 0.0) { int index11 = Dust.NewDust(new Vector2(Position.X - 2f, Position.Y - 2f), drawPlayer.width + 4, drawPlayer.height + 4, 6, drawPlayer.velocity.X * 0.4f, drawPlayer.velocity.Y * 0.4f, 100, Scale: 3f); Main.dust[index11].noGravity = true; Main.dust[index11].velocity *= 1.8f; Main.dust[index11].velocity.Y -= 0.5f; Main.playerDrawDust.Add(index11); } B *= 0.6f; G *= 0.7f; } if (drawPlayer.dripping && (double) shadow == 0.0 && Main.rand.Next(4) != 0) { Vector2 Position1 = Position; Position1.X -= 2f; Position1.Y -= 2f; if (Main.rand.Next(2) == 0) { int index12 = Dust.NewDust(Position1, drawPlayer.width + 4, drawPlayer.height + 2, 211, Alpha: 50, Scale: 0.8f); if (Main.rand.Next(2) == 0) Main.dust[index12].alpha += 25; if (Main.rand.Next(2) == 0) Main.dust[index12].alpha += 25; Main.dust[index12].noLight = true; Main.dust[index12].velocity *= 0.2f; Main.dust[index12].velocity.Y += 0.2f; Main.dust[index12].velocity += drawPlayer.velocity; Main.playerDrawDust.Add(index12); } else { int index13 = Dust.NewDust(Position1, drawPlayer.width + 8, drawPlayer.height + 8, 211, Alpha: 50, Scale: 1.1f); if (Main.rand.Next(2) == 0) Main.dust[index13].alpha += 25; if (Main.rand.Next(2) == 0) Main.dust[index13].alpha += 25; Main.dust[index13].noLight = true; Main.dust[index13].noGravity = true; Main.dust[index13].velocity *= 0.2f; ++Main.dust[index13].velocity.Y; Main.dust[index13].velocity += drawPlayer.velocity; Main.playerDrawDust.Add(index13); } } if (drawPlayer.drippingSlime) { int Alpha = 175; Microsoft.Xna.Framework.Color newColor = new Microsoft.Xna.Framework.Color(0, 80, (int) byte.MaxValue, 100); if (Main.rand.Next(4) != 0 && (double) shadow == 0.0) { Vector2 Position2 = Position; Position2.X -= 2f; Position2.Y -= 2f; if (Main.rand.Next(2) == 0) { int index14 = Dust.NewDust(Position2, drawPlayer.width + 4, drawPlayer.height + 2, 4, Alpha: Alpha, newColor: newColor, Scale: 1.4f); if (Main.rand.Next(2) == 0) Main.dust[index14].alpha += 25; if (Main.rand.Next(2) == 0) Main.dust[index14].alpha += 25; Main.dust[index14].noLight = true; Main.dust[index14].velocity *= 0.2f; Main.dust[index14].velocity.Y += 0.2f; Main.dust[index14].velocity += drawPlayer.velocity; Main.playerDrawDust.Add(index14); } } R *= 0.8f; G *= 0.8f; } if (drawPlayer.ichor) B = 0.0f; if (drawPlayer.electrified && (double) shadow == 0.0 && Main.rand.Next(3) == 0) { int index15 = Dust.NewDust(new Vector2(Position.X - 2f, Position.Y - 2f), drawPlayer.width + 4, drawPlayer.height + 4, 226, Alpha: 100, Scale: 0.5f); Main.dust[index15].velocity *= 1.6f; --Main.dust[index15].velocity.Y; Main.dust[index15].position = Vector2.Lerp(Main.dust[index15].position, drawPlayer.Center, 0.5f); Main.playerDrawDust.Add(index15); } if (drawPlayer.burned) { if ((double) shadow == 0.0) { int index16 = Dust.NewDust(new Vector2(Position.X - 2f, Position.Y - 2f), drawPlayer.width + 4, drawPlayer.height + 4, 6, drawPlayer.velocity.X * 0.4f, drawPlayer.velocity.Y * 0.4f, 100, Scale: 2f); Main.dust[index16].noGravity = true; Main.dust[index16].velocity *= 1.8f; Main.dust[index16].velocity.Y -= 0.75f; Main.playerDrawDust.Add(index16); } R = 1f; B *= 0.6f; G *= 0.7f; } if (drawPlayer.onFrostBurn) { if (Main.rand.Next(4) == 0 && (double) shadow == 0.0) { int index17 = Dust.NewDust(new Vector2(Position.X - 2f, Position.Y - 2f), drawPlayer.width + 4, drawPlayer.height + 4, 135, drawPlayer.velocity.X * 0.4f, drawPlayer.velocity.Y * 0.4f, 100, Scale: 3f); Main.dust[index17].noGravity = true; Main.dust[index17].velocity *= 1.8f; Main.dust[index17].velocity.Y -= 0.5f; Main.playerDrawDust.Add(index17); } R *= 0.5f; G *= 0.7f; } if (drawPlayer.onFire2) { if (Main.rand.Next(4) == 0 && (double) shadow == 0.0) { int index18 = Dust.NewDust(new Vector2(Position.X - 2f, Position.Y - 2f), drawPlayer.width + 4, drawPlayer.height + 4, 75, drawPlayer.velocity.X * 0.4f, drawPlayer.velocity.Y * 0.4f, 100, Scale: 3f); Main.dust[index18].noGravity = true; Main.dust[index18].velocity *= 1.8f; Main.dust[index18].velocity.Y -= 0.5f; Main.playerDrawDust.Add(index18); } B *= 0.6f; G *= 0.7f; } if (drawPlayer.noItems) { G *= 0.8f; R *= 0.65f; } if (drawPlayer.blind) { G *= 0.65f; R *= 0.7f; } if (drawPlayer.bleed) { G *= 0.9f; B *= 0.9f; if (!drawPlayer.dead && Main.rand.Next(30) == 0 && (double) shadow == 0.0) { int index19 = Dust.NewDust(Position, drawPlayer.width, drawPlayer.height, 5); Main.dust[index19].velocity.Y += 0.5f; Main.dust[index19].velocity *= 0.25f; Main.playerDrawDust.Add(index19); } } if ((double) shadow == 0.0 && drawPlayer.palladiumRegen && drawPlayer.statLife < drawPlayer.statLifeMax2 && this.IsActive && !Main.gamePaused && drawPlayer.miscCounter % 10 == 0 && (double) shadow == 0.0) { Vector2 Position3; Position3.X = Position.X + (float) Main.rand.Next(drawPlayer.width); Position3.Y = Position.Y + (float) Main.rand.Next(drawPlayer.height); Position3.X = (float) ((double) Position.X + (double) (drawPlayer.width / 2) - 6.0); Position3.Y = (float) ((double) Position.Y + (double) (drawPlayer.height / 2) - 6.0); Position3.X -= (float) Main.rand.Next(-10, 11); Position3.Y -= (float) Main.rand.Next(-20, 21); int num38 = Gore.NewGore(Position3, new Vector2((float) Main.rand.Next(-10, 11) * 0.1f, (float) Main.rand.Next(-20, -10) * 0.1f), 331, (float) Main.rand.Next(80, 120) * 0.01f); Main.playerDrawGore.Add(num38); } if ((double) shadow == 0.0 && drawPlayer.loveStruck && this.IsActive && !Main.gamePaused && Main.rand.Next(5) == 0) { Vector2 vector2_2 = new Vector2((float) Main.rand.Next(-10, 11), (float) Main.rand.Next(-10, 11)); vector2_2.Normalize(); vector2_2.X *= 0.66f; int index20 = Gore.NewGore(Position + new Vector2((float) Main.rand.Next(drawPlayer.width + 1), (float) Main.rand.Next(drawPlayer.height + 1)), vector2_2 * (float) Main.rand.Next(3, 6) * 0.33f, 331, (float) Main.rand.Next(40, 121) * 0.01f); Main.gore[index20].sticky = false; Main.gore[index20].velocity *= 0.4f; Main.gore[index20].velocity.Y -= 0.6f; Main.playerDrawGore.Add(index20); } if (drawPlayer.stinky && this.IsActive && !Main.gamePaused) { R *= 0.7f; B *= 0.55f; if (Main.rand.Next(5) == 0 && (double) shadow == 0.0) { Vector2 vector2_3 = new Vector2((float) Main.rand.Next(-10, 11), (float) Main.rand.Next(-10, 11)); vector2_3.Normalize(); vector2_3.X *= 0.66f; vector2_3.Y = Math.Abs(vector2_3.Y); Vector2 vector2_4 = vector2_3 * (float) Main.rand.Next(3, 5) * 0.25f; int index21 = Dust.NewDust(Position, drawPlayer.width, drawPlayer.height, 188, vector2_4.X, vector2_4.Y * 0.5f, 100, Scale: 1.5f); Main.dust[index21].velocity *= 0.1f; Main.dust[index21].velocity.Y -= 0.5f; Main.playerDrawDust.Add(index21); } } if (drawPlayer.slowOgreSpit && this.IsActive && !Main.gamePaused) { R *= 0.6f; B *= 0.45f; if (Main.rand.Next(5) == 0 && (double) shadow == 0.0) { int Type = Utils.SelectRandom(Main.rand, 4, 256); Dust dust = Main.dust[Dust.NewDust(Position, drawPlayer.width, drawPlayer.height, Type, Alpha: 100)]; dust.scale = (float) (0.800000011920929 + (double) Main.rand.NextFloat() * 0.600000023841858); dust.fadeIn = 0.5f; dust.velocity *= 0.05f; dust.noLight = true; if (dust.type == 4) dust.color = new Microsoft.Xna.Framework.Color(80, 170, 40, 120); Main.playerDrawDust.Add(dust.dustIndex); } if (Main.rand.Next(5) == 0 && (double) shadow == 0.0) { int index22 = Gore.NewGore(Position + new Vector2(Main.rand.NextFloat(), Main.rand.NextFloat()) * drawPlayer.Size, Vector2.Zero, Utils.SelectRandom(Main.rand, 1024, 1025, 1026), 0.65f); Main.gore[index22].velocity *= 0.05f; Main.playerDrawGore.Add(index22); } } if (this.IsActive && !Main.gamePaused && (double) shadow == 0.0) { float num39 = (float) drawPlayer.miscCounter / 180f; float num40 = 0.0f; float num41 = 10f; int Type = 90; int num42 = 0; for (int index23 = 0; index23 < 3; ++index23) { switch (index23) { case 0: if (drawPlayer.nebulaLevelLife >= 1) { num40 = 6.283185f / (float) drawPlayer.nebulaLevelLife; num42 = drawPlayer.nebulaLevelLife; goto default; } else break; case 1: if (drawPlayer.nebulaLevelMana >= 1) { num40 = -6.283185f / (float) drawPlayer.nebulaLevelMana; num42 = drawPlayer.nebulaLevelMana; num39 = (float) -drawPlayer.miscCounter / 180f; num41 = 20f; Type = 88; goto default; } else break; case 2: if (drawPlayer.nebulaLevelDamage >= 1) { num40 = 6.283185f / (float) drawPlayer.nebulaLevelDamage; num42 = drawPlayer.nebulaLevelDamage; num39 = (float) drawPlayer.miscCounter / 180f; num41 = 30f; Type = 86; goto default; } else break; default: for (int index24 = 0; index24 < num42; ++index24) { int index25 = Dust.NewDust(Position, drawPlayer.width, drawPlayer.height, Type, Alpha: 100, Scale: 1.5f); Main.dust[index25].noGravity = true; Main.dust[index25].velocity = Vector2.Zero; Main.dust[index25].position = drawPlayer.Center + Vector2.UnitY * drawPlayer.gfxOffY + ((float) ((double) num39 * 6.28318548202515 + (double) num40 * (double) index24)).ToRotationVector2() * num41; Main.dust[index25].customData = (object) drawPlayer; Main.playerDrawDust.Add(index25); } break; } } } if (drawPlayer.witheredArmor && this.IsActive && !Main.gamePaused) { G *= 0.5f; R *= 0.75f; } if (drawPlayer.witheredWeapon && drawPlayer.itemAnimation > 0 && drawPlayer.inventory[drawPlayer.selectedItem].damage > 0 && this.IsActive && !Main.gamePaused && Main.rand.Next(3) == 0) { int index26 = Dust.NewDust(new Vector2(Position.X - 2f, Position.Y - 2f), drawPlayer.width + 4, drawPlayer.height + 4, 272, Alpha: 50, Scale: 0.5f); Main.dust[index26].velocity *= 1.6f; --Main.dust[index26].velocity.Y; Main.dust[index26].position = Vector2.Lerp(Main.dust[index26].position, drawPlayer.Center, 0.5f); Main.playerDrawDust.Add(index26); } if ((double) R != 1.0 || (double) G != 1.0 || (double) B != 1.0 || (double) A != 1.0) { if (drawPlayer.onFire || drawPlayer.onFire2 || drawPlayer.onFrostBurn) { color2 = drawPlayer.GetImmuneAlpha(Microsoft.Xna.Framework.Color.White, shadow); color3 = drawPlayer.GetImmuneAlpha(drawPlayer.eyeColor, shadow); color1 = drawPlayer.GetImmuneAlpha(drawPlayer.GetHairColor(), shadow); color4 = drawPlayer.GetImmuneAlpha(drawPlayer.skinColor, shadow); color5 = drawPlayer.GetImmuneAlpha(drawPlayer.skinColor, shadow); color7 = drawPlayer.GetImmuneAlpha(drawPlayer.shirtColor, shadow); color8 = drawPlayer.GetImmuneAlpha(drawPlayer.underShirtColor, shadow); color9 = drawPlayer.GetImmuneAlpha(drawPlayer.pantsColor, shadow); color6 = drawPlayer.GetImmuneAlpha(drawPlayer.skinColor, shadow); color10 = drawPlayer.GetImmuneAlpha(drawPlayer.shoeColor, shadow); color11 = drawPlayer.GetImmuneAlpha(Microsoft.Xna.Framework.Color.White, shadow); color12 = drawPlayer.GetImmuneAlpha(Microsoft.Xna.Framework.Color.White, shadow); color13 = drawPlayer.GetImmuneAlpha(Microsoft.Xna.Framework.Color.White, shadow); } else { color2 = Main.buffColor(color2, R, G, B, A); color3 = Main.buffColor(color3, R, G, B, A); color1 = Main.buffColor(color1, R, G, B, A); color4 = Main.buffColor(color4, R, G, B, A); color5 = Main.buffColor(color5, R, G, B, A); color7 = Main.buffColor(color7, R, G, B, A); color8 = Main.buffColor(color8, R, G, B, A); color9 = Main.buffColor(color9, R, G, B, A); color6 = Main.buffColor(color6, R, G, B, A); color10 = Main.buffColor(color10, R, G, B, A); color11 = Main.buffColor(color11, R, G, B, A); color12 = Main.buffColor(color12, R, G, B, A); color13 = Main.buffColor(color13, R, G, B, A); } } if (drawPlayer.socialGhost) { color2 = Microsoft.Xna.Framework.Color.Transparent; color3 = Microsoft.Xna.Framework.Color.Transparent; color1 = Microsoft.Xna.Framework.Color.Transparent; color4 = Microsoft.Xna.Framework.Color.Transparent; color5 = Microsoft.Xna.Framework.Color.Transparent; color7 = Microsoft.Xna.Framework.Color.Transparent; color8 = Microsoft.Xna.Framework.Color.Transparent; color9 = Microsoft.Xna.Framework.Color.Transparent; color10 = Microsoft.Xna.Framework.Color.Transparent; color6 = Microsoft.Xna.Framework.Color.Transparent; if ((int) color11.A > (int) Main.gFade) color11.A = Main.gFade; if ((int) color12.A > (int) Main.gFade) color12.A = Main.gFade; if ((int) color13.A > (int) Main.gFade) color13.A = Main.gFade; } if (drawPlayer.socialIgnoreLight) { float num43 = 1.2f; color2 = Microsoft.Xna.Framework.Color.White * num43; color3 = drawPlayer.eyeColor * num43; color1 = GameShaders.Hair.GetColor((short) drawPlayer.hairDye, drawPlayer, Microsoft.Xna.Framework.Color.White); color4 = drawPlayer.skinColor * num43; color5 = drawPlayer.skinColor * num43; color7 = drawPlayer.shirtColor * num43; color8 = drawPlayer.underShirtColor * num43; color9 = drawPlayer.pantsColor * num43; color10 = drawPlayer.shoeColor * num43; color6 = drawPlayer.skinColor * num43; } float num44 = 1f; if (drawPlayer.inventory[drawPlayer.selectedItem].type == 3106) { float num45 = drawPlayer.stealth; if ((double) num45 < 0.03) num45 = 0.03f; float num46 = (float) ((1.0 + (double) num45 * 10.0) / 11.0); if ((double) num45 < 0.0) num45 = 0.0f; if ((double) num45 >= 1.0 - (double) shadow && (double) shadow > 0.0) num45 = shadow * 0.5f; num44 = num46; color11 = new Microsoft.Xna.Framework.Color((int) (byte) ((double) color11.R * (double) num45), (int) (byte) ((double) color11.G * (double) num45), (int) (byte) ((double) color11.B * (double) num46), (int) (byte) ((double) color11.A * (double) num45)); color12 = new Microsoft.Xna.Framework.Color((int) (byte) ((double) color12.R * (double) num45), (int) (byte) ((double) color12.G * (double) num45), (int) (byte) ((double) color12.B * (double) num46), (int) (byte) ((double) color12.A * (double) num45)); color13 = new Microsoft.Xna.Framework.Color((int) (byte) ((double) color13.R * (double) num45), (int) (byte) ((double) color13.G * (double) num45), (int) (byte) ((double) color13.B * (double) num46), (int) (byte) ((double) color13.A * (double) num45)); float scale = num45 * num45; color2 = Microsoft.Xna.Framework.Color.Multiply(color2, scale); color3 = Microsoft.Xna.Framework.Color.Multiply(color3, scale); color1 = Microsoft.Xna.Framework.Color.Multiply(color1, scale); color4 = Microsoft.Xna.Framework.Color.Multiply(color4, scale); color5 = Microsoft.Xna.Framework.Color.Multiply(color5, scale); color7 = Microsoft.Xna.Framework.Color.Multiply(color7, scale); color8 = Microsoft.Xna.Framework.Color.Multiply(color8, scale); color9 = Microsoft.Xna.Framework.Color.Multiply(color9, scale); color10 = Microsoft.Xna.Framework.Color.Multiply(color10, scale); color6 = Microsoft.Xna.Framework.Color.Multiply(color6, scale); drawColor = Microsoft.Xna.Framework.Color.Multiply(drawColor, scale); color15 = Microsoft.Xna.Framework.Color.Multiply(color15, scale); color16 = Microsoft.Xna.Framework.Color.Multiply(color16, scale); color17 = Microsoft.Xna.Framework.Color.Multiply(color17, scale); color18 = Microsoft.Xna.Framework.Color.Multiply(color18, scale); } else if (drawPlayer.shroomiteStealth) { float num47 = drawPlayer.stealth; if ((double) num47 < 0.03) num47 = 0.03f; float num48 = (float) ((1.0 + (double) num47 * 10.0) / 11.0); if ((double) num47 < 0.0) num47 = 0.0f; if ((double) num47 >= 1.0 - (double) shadow && (double) shadow > 0.0) num47 = shadow * 0.5f; num44 = num48; color11 = new Microsoft.Xna.Framework.Color((int) (byte) ((double) color11.R * (double) num47), (int) (byte) ((double) color11.G * (double) num47), (int) (byte) ((double) color11.B * (double) num48), (int) (byte) ((double) color11.A * (double) num47)); color12 = new Microsoft.Xna.Framework.Color((int) (byte) ((double) color12.R * (double) num47), (int) (byte) ((double) color12.G * (double) num47), (int) (byte) ((double) color12.B * (double) num48), (int) (byte) ((double) color12.A * (double) num47)); color13 = new Microsoft.Xna.Framework.Color((int) (byte) ((double) color13.R * (double) num47), (int) (byte) ((double) color13.G * (double) num47), (int) (byte) ((double) color13.B * (double) num48), (int) (byte) ((double) color13.A * (double) num47)); float scale = num47 * num47; color2 = Microsoft.Xna.Framework.Color.Multiply(color2, scale); color3 = Microsoft.Xna.Framework.Color.Multiply(color3, scale); color1 = Microsoft.Xna.Framework.Color.Multiply(color1, scale); color4 = Microsoft.Xna.Framework.Color.Multiply(color4, scale); color5 = Microsoft.Xna.Framework.Color.Multiply(color5, scale); color7 = Microsoft.Xna.Framework.Color.Multiply(color7, scale); color8 = Microsoft.Xna.Framework.Color.Multiply(color8, scale); color9 = Microsoft.Xna.Framework.Color.Multiply(color9, scale); color10 = Microsoft.Xna.Framework.Color.Multiply(color10, scale); color6 = Microsoft.Xna.Framework.Color.Multiply(color6, scale); drawColor = Microsoft.Xna.Framework.Color.Multiply(drawColor, scale); color15 = Microsoft.Xna.Framework.Color.Multiply(color15, scale); color16 = Microsoft.Xna.Framework.Color.Multiply(color16, scale); color17 = Microsoft.Xna.Framework.Color.Multiply(color17, scale); color18 = Microsoft.Xna.Framework.Color.Multiply(color18, scale); } else if (drawPlayer.setVortex) { float num49 = drawPlayer.stealth; if ((double) num49 < 0.03) num49 = 0.03f; if ((double) num49 < 0.0) num49 = 0.0f; if ((double) num49 >= 1.0 - (double) shadow && (double) shadow > 0.0) num49 = shadow * 0.5f; num44 = num49; Microsoft.Xna.Framework.Color secondColor = new Microsoft.Xna.Framework.Color(Vector4.Lerp(Vector4.One, new Vector4(0.0f, 0.12f, 0.16f, 0.0f), 1f - num49)); color11 = color11.MultiplyRGBA(secondColor); color12 = color12.MultiplyRGBA(secondColor); color13 = color13.MultiplyRGBA(secondColor); float scale = num49 * num49; color2 = Microsoft.Xna.Framework.Color.Multiply(color2, scale); color3 = Microsoft.Xna.Framework.Color.Multiply(color3, scale); color1 = Microsoft.Xna.Framework.Color.Multiply(color1, scale); color4 = Microsoft.Xna.Framework.Color.Multiply(color4, scale); color5 = Microsoft.Xna.Framework.Color.Multiply(color5, scale); color7 = Microsoft.Xna.Framework.Color.Multiply(color7, scale); color8 = Microsoft.Xna.Framework.Color.Multiply(color8, scale); color9 = Microsoft.Xna.Framework.Color.Multiply(color9, scale); color10 = Microsoft.Xna.Framework.Color.Multiply(color10, scale); color6 = Microsoft.Xna.Framework.Color.Multiply(color6, scale); drawColor = Microsoft.Xna.Framework.Color.Multiply(drawColor, scale); color15 = Microsoft.Xna.Framework.Color.Multiply(color15, scale); color16 = Microsoft.Xna.Framework.Color.Multiply(color16, scale); color17 = Microsoft.Xna.Framework.Color.Multiply(color17, scale); color18 = Microsoft.Xna.Framework.Color.Multiply(color18, scale); } SpriteEffects spriteEffects; SpriteEffects effect; if ((double) drawPlayer.gravDir == 1.0) { if (drawPlayer.direction == 1) { spriteEffects = SpriteEffects.None; effect = SpriteEffects.None; } else { spriteEffects = SpriteEffects.FlipHorizontally; effect = SpriteEffects.FlipHorizontally; } if (!drawPlayer.dead) { drawPlayer.legPosition.Y = 0.0f; drawPlayer.headPosition.Y = 0.0f; drawPlayer.bodyPosition.Y = 0.0f; } } else { if (drawPlayer.direction == 1) { spriteEffects = SpriteEffects.FlipVertically; effect = SpriteEffects.FlipVertically; } else { spriteEffects = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically; effect = SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically; } if (!drawPlayer.dead) { drawPlayer.legPosition.Y = 6f; drawPlayer.headPosition.Y = 6f; drawPlayer.bodyPosition.Y = 6f; } } Vector2 origin1 = new Vector2((float) drawPlayer.legFrame.Width * 0.5f, (float) drawPlayer.legFrame.Height * 0.75f); Vector2 origin2 = new Vector2((float) drawPlayer.legFrame.Width * 0.5f, (float) drawPlayer.legFrame.Height * 0.5f); Vector2 origin3 = new Vector2((float) drawPlayer.legFrame.Width * 0.5f, (float) drawPlayer.legFrame.Height * 0.4f); if ((drawPlayer.merman || drawPlayer.forceMerman) && !drawPlayer.hideMerman) { drawPlayer.headRotation = (float) ((double) drawPlayer.velocity.Y * (double) drawPlayer.direction * 0.100000001490116); if ((double) drawPlayer.headRotation < -0.3) drawPlayer.headRotation = -0.3f; if ((double) drawPlayer.headRotation > 0.3) drawPlayer.headRotation = 0.3f; } else if (!drawPlayer.dead) drawPlayer.headRotation = 0.0f; Microsoft.Xna.Framework.Rectangle bodyFrame1 = drawPlayer.bodyFrame; bodyFrame1.Y -= 336; if (bodyFrame1.Y < 0) bodyFrame1.Y = 0; int num50 = 26; int hair = drawPlayer.hair; bool flag7 = hair > 50 && (hair < 56 || hair > 63) && (hair < 74 || hair > 77) && (hair < 88 || hair > 89) && hair != 94 && hair != 100 && hair != 104 && hair != 112 && hair < 116; if (hair == 133) flag7 = true; if (flag6) bodyFrame1.Height = 0; else if (flag7) { if (drawPlayer.head == -1 | flag4 || drawPlayer.head == 23 || drawPlayer.head == 0) { drawData = new DrawData(Main.playerHairTexture[drawPlayer.hair], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin3, new Microsoft.Xna.Framework.Rectangle?(bodyFrame1), color1, drawPlayer.headRotation, origin3, 1f, spriteEffects, 0); drawData.shader = -num4; Main.playerDrawData.Add(drawData); } else if (flag5) { drawData = new DrawData(Main.playerHairAltTexture[drawPlayer.hair], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin3, new Microsoft.Xna.Framework.Rectangle?(bodyFrame1), color1, drawPlayer.headRotation, origin3, 1f, spriteEffects, 0); drawData.shader = -num4; Main.playerDrawData.Add(drawData); } if ((double) drawPlayer.gravDir == 1.0) bodyFrame1.Height = num50; } if (drawPlayer.mount.Active) { drawPlayer.mount.Draw(Main.playerDrawData, 0, drawPlayer, Position, drawColor, spriteEffects, shadow); drawPlayer.mount.Draw(Main.playerDrawData, 1, drawPlayer, Position, drawColor, spriteEffects, shadow); } if (drawPlayer.carpetFrame >= 0) { Microsoft.Xna.Framework.Color color19 = color13; float num51 = 0.0f; if ((double) drawPlayer.gravDir == -1.0) num51 = 10f; drawData = new DrawData(Main.flyingCarpetTexture, new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) (drawPlayer.height / 2) + 28.0 * (double) drawPlayer.gravDir + (double) num51)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.flyingCarpetTexture.Height / 6 * drawPlayer.carpetFrame, Main.flyingCarpetTexture.Width, Main.flyingCarpetTexture.Height / 6)), color19, drawPlayer.bodyRotation, new Vector2((float) (Main.flyingCarpetTexture.Width / 2), (float) (Main.flyingCarpetTexture.Height / 8)), 1f, spriteEffects, 0); drawData.shader = num18; Main.playerDrawData.Add(drawData); } Position.Y += num2; if (drawPlayer.electrified && (double) shadow == 0.0) { Texture2D texture = Main.glowMaskTexture[25]; int num52 = drawPlayer.miscCounter / 5; for (int index27 = 0; index27 < 2; ++index27) { int num53 = num52 % 7; if (num53 <= 1 || num53 >= 5) { drawData = new DrawData(texture, new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, num53 * texture.Height / 7, texture.Width, texture.Height / 7)), color14, drawPlayer.bodyRotation, new Vector2((float) (texture.Width / 2), (float) (texture.Height / 14)), 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); } num52 = num53 + 3; } } if (drawPlayer.setForbidden && (double) shadow == 0.0) { Microsoft.Xna.Framework.Color color20 = Microsoft.Xna.Framework.Color.Lerp(color12, Microsoft.Xna.Framework.Color.White, 0.7f); Texture2D texture2D = Main.extraTexture[74]; Texture2D texture = Main.glowMaskTexture[217]; int num54 = !drawPlayer.setForbiddenCooldownLocked ? 1 : 0; int num55 = (int) ((double) ((float) ((double) drawPlayer.miscCounter / 300.0 * 6.28318548202515)).ToRotationVector2().Y * 6.0); float num56 = ((float) ((double) drawPlayer.miscCounter / 75.0 * 6.28318548202515)).ToRotationVector2().X * 4f; Microsoft.Xna.Framework.Color color21 = new Microsoft.Xna.Framework.Color(80, 70, 40, 0) * (float) ((double) num56 / 8.0 + 0.5) * 0.8f; if (num54 == 0) { num55 = 0; num56 = 2f; color21 = new Microsoft.Xna.Framework.Color(80, 70, 40, 0) * 0.3f; color20 = color20.MultiplyRGB(new Microsoft.Xna.Framework.Color(0.5f, 0.5f, 1f)); } Vector2 position = new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)) + new Vector2((float) (-drawPlayer.direction * 10), (float) (num55 - 20)); drawData = new DrawData(texture2D, position, new Microsoft.Xna.Framework.Rectangle?(), color20, drawPlayer.bodyRotation, texture2D.Size() / 2f, 1f, spriteEffects, 0); drawData.shader = num5; Main.playerDrawData.Add(drawData); for (float num57 = 0.0f; (double) num57 < 4.0; ++num57) { drawData = new DrawData(texture, position + (num57 * 1.570796f).ToRotationVector2() * num56, new Microsoft.Xna.Framework.Rectangle?(), color21, drawPlayer.bodyRotation, texture2D.Size() / 2f, 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); } } else if (drawPlayer.webbed && (double) shadow == 0.0 && (double) drawPlayer.velocity.Y != 0.0) { Microsoft.Xna.Framework.Color color22 = color12 * 0.75f; Texture2D texture2D = Main.extraTexture[32]; drawData = new DrawData(texture2D, new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(), color22, drawPlayer.bodyRotation, texture2D.Size() / 2f, 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); } if (drawPlayer.leinforsHair && (flag4 | flag5 || drawPlayer.head == -1 || drawPlayer.head == 0) && drawPlayer.hair != 12 && (double) shadow == 0.0 && (double) Main.rgbToHsl(color4).Z > 0.200000002980232) { if (Main.rand.Next(20) == 0 && !flag5) { Microsoft.Xna.Framework.Rectangle r = Utils.CenteredRectangle(Position + drawPlayer.Size / 2f + new Vector2(0.0f, drawPlayer.gravDir * -20f), new Vector2(20f, 14f)); int index28 = Dust.NewDust(r.TopLeft(), r.Width, r.Height, 204, Alpha: 150, Scale: 0.3f); Main.dust[index28].fadeIn = 1f; Main.dust[index28].velocity *= 0.1f; Main.dust[index28].noLight = true; Main.playerDrawDust.Add(index28); } if (Main.rand.Next(40) == 0 & flag5) { Microsoft.Xna.Framework.Rectangle r = Utils.CenteredRectangle(Position + drawPlayer.Size / 2f + new Vector2((float) (drawPlayer.direction * -10), drawPlayer.gravDir * -10f), new Vector2(5f, 5f)); int index29 = Dust.NewDust(r.TopLeft(), r.Width, r.Height, 204, Alpha: 150, Scale: 0.3f); Main.dust[index29].fadeIn = 1f; Main.dust[index29].velocity *= 0.1f; Main.dust[index29].noLight = true; Main.playerDrawDust.Add(index29); } if ((double) drawPlayer.velocity.X != 0.0 & flag7 && Main.rand.Next(15) == 0) { Microsoft.Xna.Framework.Rectangle r = Utils.CenteredRectangle(Position + drawPlayer.Size / 2f + new Vector2((float) (drawPlayer.direction * -14), 0.0f), new Vector2(4f, 30f)); int index30 = Dust.NewDust(r.TopLeft(), r.Width, r.Height, 204, Alpha: 150, Scale: 0.3f); Main.dust[index30].fadeIn = 1f; Main.dust[index30].velocity *= 0.1f; Main.dust[index30].noLight = true; Main.playerDrawDust.Add(index30); } } Position.Y -= num2; bool flag8 = false; if ((drawPlayer.wings == 0 || (double) drawPlayer.velocity.Y == 0.0) && (drawPlayer.inventory[drawPlayer.selectedItem].type == 1178 || drawPlayer.inventory[drawPlayer.selectedItem].type == 779 || drawPlayer.inventory[drawPlayer.selectedItem].type == 1295 || drawPlayer.inventory[drawPlayer.selectedItem].type == 1910 || drawPlayer.turtleArmor || drawPlayer.body == 106 || drawPlayer.body == 170)) { flag8 = true; int type = drawPlayer.inventory[drawPlayer.selectedItem].type; int index31 = 1; float num58 = -4f; float num59 = -8f; int num60 = 0; if (drawPlayer.turtleArmor) { index31 = 4; num60 = num5; } else if (drawPlayer.body == 106) { index31 = 6; num60 = num5; } else if (drawPlayer.body == 170) { index31 = 7; num60 = num5; } else { switch (type) { case 779: index31 = 2; break; case 1178: index31 = 1; break; case 1295: index31 = 3; break; case 1910: index31 = 5; break; } } switch (index31) { case 4: case 6: drawData = new DrawData(Main.BackPackTexture[index31], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color12, drawPlayer.bodyRotation, origin2, 1f, spriteEffects, 0); drawData.shader = num60; Main.playerDrawData.Add(drawData); break; case 7: drawData = new DrawData(Main.BackPackTexture[index31], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, drawPlayer.bodyFrame.Y, Main.BackPackTexture[index31].Width, drawPlayer.bodyFrame.Height)), color12, drawPlayer.bodyRotation, new Vector2((float) Main.BackPackTexture[index31].Width * 0.5f, origin2.Y), 1f, spriteEffects, 0); drawData.shader = num60; Main.playerDrawData.Add(drawData); break; default: drawData = new DrawData(Main.BackPackTexture[index31], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X + (double) (drawPlayer.width / 2) - (double) (9 * drawPlayer.direction)) + num58 * (float) drawPlayer.direction, (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) (drawPlayer.height / 2) + 2.0 * (double) drawPlayer.gravDir + (double) num59 * (double) drawPlayer.gravDir)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.BackPackTexture[index31].Width, Main.BackPackTexture[index31].Height)), color12, drawPlayer.bodyRotation, new Vector2((float) (Main.BackPackTexture[index31].Width / 2), (float) (Main.BackPackTexture[index31].Height / 2)), 1f, spriteEffects, 0); drawData.shader = num60; Main.playerDrawData.Add(drawData); break; } } if (!flag8 && drawPlayer.back > (sbyte) 0 && drawPlayer.back < (sbyte) 14 && !drawPlayer.mount.Active) { if (drawPlayer.front >= (sbyte) 1 && drawPlayer.front <= (sbyte) 4) { int num61 = drawPlayer.bodyFrame.Y / 56; if (num61 < 1 || num61 > 5) { num3 = 10; } else { if (drawPlayer.front == (sbyte) 1) num3 = 0; if (drawPlayer.front == (sbyte) 2) num3 = 8; if (drawPlayer.front == (sbyte) 3) num3 = 0; if (drawPlayer.front == (sbyte) 4) num3 = 8; } } drawData = new DrawData(Main.accBackTexture[(int) drawPlayer.back], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color12, drawPlayer.bodyRotation, origin2, 1f, spriteEffects, 0); drawData.shader = num9; Main.playerDrawData.Add(drawData); } Position.Y += (float) ((int) playerOffset / 2); if (!flag8 && drawPlayer.wings > 0) { this.LoadWings(drawPlayer.wings); if (drawPlayer.wings == 22) { if (((double) drawPlayer.velocity.Y != 0.0 || drawPlayer.grappling[0] != -1) && !drawPlayer.mount.Active) { this.LoadItemFlames(1866); Microsoft.Xna.Framework.Color color23 = color12; int num62 = 24; int num63 = 0; if ((double) shadow == 0.0 && drawPlayer.grappling[0] == -1) { for (int index32 = 0; index32 < 7; ++index32) { Microsoft.Xna.Framework.Color color24 = new Microsoft.Xna.Framework.Color(250 - index32 * 10, 250 - index32 * 10, 250 - index32 * 10, 150 - index32 * 10); Vector2 vector2_5 = new Vector2((float) Main.rand.Next(-10, 11) * 0.2f, (float) Main.rand.Next(-10, 11) * 0.2f); num44 = num44 * num44 * (1f - shadow); color24 = new Microsoft.Xna.Framework.Color((int) ((double) color24.R * (double) num44), (int) ((double) color24.G * (double) num44), (int) ((double) color24.B * (double) num44), (int) ((double) color24.A * (double) num44)); vector2_5.X = drawPlayer.itemFlamePos[index32].X; vector2_5.Y = -drawPlayer.itemFlamePos[index32].Y; vector2_5 *= 0.5f; drawData = new DrawData(Main.itemFlameTexture[1866], new Vector2((float) ((int) ((double) Position.X - (double) Main.screenPosition.X + (double) (drawPlayer.width / 2) - (double) (9 * drawPlayer.direction)) + num63 * drawPlayer.direction), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) (drawPlayer.height / 2) + 2.0 * (double) drawPlayer.gravDir + (double) num62 * (double) drawPlayer.gravDir)) + vector2_5, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.wingsTexture[drawPlayer.wings].Height / 7 * drawPlayer.wingFrame, Main.wingsTexture[drawPlayer.wings].Width, Main.wingsTexture[drawPlayer.wings].Height / 7 - 2)), color24, drawPlayer.bodyRotation, new Vector2((float) (Main.wingsTexture[drawPlayer.wings].Width / 2), (float) (Main.wingsTexture[drawPlayer.wings].Height / 14)), 1f, spriteEffects, 0); drawData.shader = num17; Main.playerDrawData.Add(drawData); } } drawData = new DrawData(Main.wingsTexture[drawPlayer.wings], new Vector2((float) ((int) ((double) Position.X - (double) Main.screenPosition.X + (double) (drawPlayer.width / 2) - (double) (9 * drawPlayer.direction)) + num63 * drawPlayer.direction), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) (drawPlayer.height / 2) + 2.0 * (double) drawPlayer.gravDir + (double) num62 * (double) drawPlayer.gravDir)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.wingsTexture[drawPlayer.wings].Height / 7 * drawPlayer.wingFrame, Main.wingsTexture[drawPlayer.wings].Width, Main.wingsTexture[drawPlayer.wings].Height / 7)), color23, drawPlayer.bodyRotation, new Vector2((float) (Main.wingsTexture[drawPlayer.wings].Width / 2), (float) (Main.wingsTexture[drawPlayer.wings].Height / 14)), 1f, spriteEffects, 0); drawData.shader = num17; Main.playerDrawData.Add(drawData); } } else if (drawPlayer.wings == 28) { if (((double) drawPlayer.velocity.Y != 0.0 || drawPlayer.grappling[0] != -1) && !drawPlayer.mount.Active) { Microsoft.Xna.Framework.Color color25 = color12; Vector2 vector2_6 = new Vector2(0.0f, 0.0f); Texture2D texture2D = Main.wingsTexture[drawPlayer.wings]; Vector2 vec = Position + drawPlayer.Size * new Vector2(0.5f, 1f) - Main.screenPosition + vector2_6 * drawPlayer.Directions; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: 4, frameY: (drawPlayer.miscCounter / 5 % 4)); r.Width -= 2; r.Height -= 2; drawData = new DrawData(texture2D, vec.Floor(), new Microsoft.Xna.Framework.Rectangle?(r), Microsoft.Xna.Framework.Color.Lerp(color25, Microsoft.Xna.Framework.Color.White, 1f), drawPlayer.bodyRotation, r.Size() / 2f, 1f, spriteEffects, 0); drawData.shader = num17; Main.playerDrawData.Add(drawData); drawData = new DrawData(Main.extraTexture[38], vec.Floor(), new Microsoft.Xna.Framework.Rectangle?(r), Microsoft.Xna.Framework.Color.Lerp(color25, Microsoft.Xna.Framework.Color.White, 0.5f), drawPlayer.bodyRotation, r.Size() / 2f, 1f, spriteEffects, 0); drawData.shader = num17; Main.playerDrawData.Add(drawData); } } else if (drawPlayer.wings == 34) { if (((double) drawPlayer.velocity.Y != 0.0 || drawPlayer.grappling[0] != -1) && !drawPlayer.mount.Active) { num44 = num44 * num44 * (1f - shadow); Microsoft.Xna.Framework.Color color26 = new Microsoft.Xna.Framework.Color((int) (250.0 * (double) num44), (int) (250.0 * (double) num44), (int) (250.0 * (double) num44), (int) (100.0 * (double) num44)); Vector2 vector2_7 = new Vector2(0.0f, 0.0f); Texture2D texture2D = Main.wingsTexture[drawPlayer.wings]; Vector2 vec = Position + drawPlayer.Size / 2f - Main.screenPosition + vector2_7 * drawPlayer.Directions - Vector2.UnitX * (float) drawPlayer.direction * 4f; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: 6, frameY: drawPlayer.wingFrame); r.Width -= 2; r.Height -= 2; drawData = new DrawData(texture2D, vec.Floor(), new Microsoft.Xna.Framework.Rectangle?(r), color26, drawPlayer.bodyRotation, r.Size() / 2f, 1f, spriteEffects, 0); drawData.shader = num17; Main.playerDrawData.Add(drawData); } } else if (drawPlayer.wings == 39) { if (((double) drawPlayer.velocity.Y != 0.0 || drawPlayer.grappling[0] != -1) && !drawPlayer.mount.Active) { num44 = num44 * num44 * (1f - shadow); Microsoft.Xna.Framework.Color color27 = color12; Vector2 vector2_8 = new Vector2(0.0f, 0.0f); Texture2D texture2D = Main.wingsTexture[drawPlayer.wings]; Vector2 vec = Position + drawPlayer.Size / 2f - Main.screenPosition + vector2_8 * drawPlayer.Directions - Vector2.UnitX * (float) drawPlayer.direction * 6f - Vector2.UnitY * 7f * drawPlayer.gravDir; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: 6, frameY: drawPlayer.wingFrame); r.Width -= 2; r.Height -= 2; drawData = new DrawData(texture2D, vec.Floor(), new Microsoft.Xna.Framework.Rectangle?(r), color27, drawPlayer.bodyRotation, r.Size() / 2f, 1f, spriteEffects, 0); drawData.shader = num17; Main.playerDrawData.Add(drawData); } } else { int num64 = 0; int num65 = 0; if (drawPlayer.wings == 5) { num65 = 4; num64 -= 4; } else if (drawPlayer.wings == 27) num65 = 4; Microsoft.Xna.Framework.Color color28 = color12; if (drawPlayer.wings == 9 || drawPlayer.wings == 29) { num44 = num44 * num44 * (1f - shadow); color28 = new Microsoft.Xna.Framework.Color((int) (250.0 * (double) num44), (int) (250.0 * (double) num44), (int) (250.0 * (double) num44), (int) (100.0 * (double) num44)); } if (drawPlayer.wings == 10) { num44 = num44 * num44 * (1f - shadow); color28 = new Microsoft.Xna.Framework.Color((int) (250.0 * (double) num44), (int) (250.0 * (double) num44), (int) (250.0 * (double) num44), (int) (175.0 * (double) num44)); } if (drawPlayer.wings == 11 && (int) color28.A > (int) Main.gFade) color28.A = Main.gFade; if (drawPlayer.wings == 31) color28.A = (byte) (220.0 * (double) num44); if (drawPlayer.wings == 32) color28.A = (byte) ((double) sbyte.MaxValue * (double) num44); drawData = new DrawData(Main.wingsTexture[drawPlayer.wings], new Vector2((float) ((int) ((double) Position.X - (double) Main.screenPosition.X + (double) (drawPlayer.width / 2) - (double) (9 * drawPlayer.direction)) + num65 * drawPlayer.direction), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) (drawPlayer.height / 2) + 2.0 * (double) drawPlayer.gravDir + (double) num64 * (double) drawPlayer.gravDir)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.wingsTexture[drawPlayer.wings].Height / 4 * drawPlayer.wingFrame, Main.wingsTexture[drawPlayer.wings].Width, Main.wingsTexture[drawPlayer.wings].Height / 4)), color28, drawPlayer.bodyRotation, new Vector2((float) (Main.wingsTexture[drawPlayer.wings].Width / 2), (float) (Main.wingsTexture[drawPlayer.wings].Height / 8)), 1f, spriteEffects, 0); drawData.shader = num17; Main.playerDrawData.Add(drawData); if (drawPlayer.wings == 23) { num44 = num44 * num44 * (1f - shadow); color28 = new Microsoft.Xna.Framework.Color((int) (200.0 * (double) num44), (int) (200.0 * (double) num44), (int) (200.0 * (double) num44), (int) (200.0 * (double) num44)); drawData = new DrawData(Main.FlameTexture[8], new Vector2((float) ((int) ((double) Position.X - (double) Main.screenPosition.X + (double) (drawPlayer.width / 2) - (double) (9 * drawPlayer.direction)) + num65 * drawPlayer.direction), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) (drawPlayer.height / 2) + 2.0 * (double) drawPlayer.gravDir + (double) num64 * (double) drawPlayer.gravDir)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.wingsTexture[drawPlayer.wings].Height / 4 * drawPlayer.wingFrame, Main.wingsTexture[drawPlayer.wings].Width, Main.wingsTexture[drawPlayer.wings].Height / 4)), color28, drawPlayer.bodyRotation, new Vector2((float) (Main.wingsTexture[drawPlayer.wings].Width / 2), (float) (Main.wingsTexture[drawPlayer.wings].Height / 8)), 1f, spriteEffects, 0); drawData.shader = num17; Main.playerDrawData.Add(drawData); } else if (drawPlayer.wings == 27) { drawData = new DrawData(Main.glowMaskTexture[92], new Vector2((float) ((int) ((double) Position.X - (double) Main.screenPosition.X + (double) (drawPlayer.width / 2) - (double) (9 * drawPlayer.direction)) + num65 * drawPlayer.direction), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) (drawPlayer.height / 2) + 2.0 * (double) drawPlayer.gravDir + (double) num64 * (double) drawPlayer.gravDir)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.wingsTexture[drawPlayer.wings].Height / 4 * drawPlayer.wingFrame, Main.wingsTexture[drawPlayer.wings].Width, Main.wingsTexture[drawPlayer.wings].Height / 4)), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue) * num44 * (1f - shadow), drawPlayer.bodyRotation, new Vector2((float) (Main.wingsTexture[drawPlayer.wings].Width / 2), (float) (Main.wingsTexture[drawPlayer.wings].Height / 8)), 1f, spriteEffects, 0); drawData.shader = num17; Main.playerDrawData.Add(drawData); } else if (drawPlayer.wings == 30) { drawData = new DrawData(Main.glowMaskTexture[181], new Vector2((float) ((int) ((double) Position.X - (double) Main.screenPosition.X + (double) (drawPlayer.width / 2) - (double) (9 * drawPlayer.direction)) + num65 * drawPlayer.direction), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) (drawPlayer.height / 2) + 2.0 * (double) drawPlayer.gravDir + (double) num64 * (double) drawPlayer.gravDir)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.wingsTexture[drawPlayer.wings].Height / 4 * drawPlayer.wingFrame, Main.wingsTexture[drawPlayer.wings].Width, Main.wingsTexture[drawPlayer.wings].Height / 4)), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue) * num44 * (1f - shadow), drawPlayer.bodyRotation, new Vector2((float) (Main.wingsTexture[drawPlayer.wings].Width / 2), (float) (Main.wingsTexture[drawPlayer.wings].Height / 8)), 1f, spriteEffects, 0); drawData.shader = num17; Main.playerDrawData.Add(drawData); } else if (drawPlayer.wings == 38) { Microsoft.Xna.Framework.Color color29 = underShirtColor * num44 * (1f - shadow); drawData = new DrawData(Main.glowMaskTexture[251], new Vector2((float) ((int) ((double) Position.X - (double) Main.screenPosition.X + (double) (drawPlayer.width / 2) - (double) (9 * drawPlayer.direction)) + num65 * drawPlayer.direction), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) (drawPlayer.height / 2) + 2.0 * (double) drawPlayer.gravDir + (double) num64 * (double) drawPlayer.gravDir)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.wingsTexture[drawPlayer.wings].Height / 4 * drawPlayer.wingFrame, Main.wingsTexture[drawPlayer.wings].Width, Main.wingsTexture[drawPlayer.wings].Height / 4)), color29, drawPlayer.bodyRotation, new Vector2((float) (Main.wingsTexture[drawPlayer.wings].Width / 2), (float) (Main.wingsTexture[drawPlayer.wings].Height / 8)), 1f, spriteEffects, 0); drawData.shader = num17; Main.playerDrawData.Add(drawData); for (int index33 = drawPlayer.shadowPos.Length - 2; index33 >= 0; --index33) { Microsoft.Xna.Framework.Color color30 = color29; color30.A = (byte) 0; color30 *= MathHelper.Lerp(1f, 0.0f, (float) index33 / 3f); color30 *= 0.1f; Vector2 vector2_9 = drawPlayer.shadowPos[index33] - drawPlayer.position; for (float num66 = 0.0f; (double) num66 < 1.0; num66 += 0.01f) { Vector2 vector2_10 = new Vector2(2f, 0.0f).RotatedBy((double) num66 / 0.0399999991059303 * 6.28318548202515); drawData = new DrawData(Main.glowMaskTexture[251], vector2_10 + vector2_9 * num66 + new Vector2((float) ((int) ((double) Position.X - (double) Main.screenPosition.X + (double) (drawPlayer.width / 2) - (double) (9 * drawPlayer.direction)) + num65 * drawPlayer.direction), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) (drawPlayer.height / 2) + 2.0 * (double) drawPlayer.gravDir + (double) num64 * (double) drawPlayer.gravDir)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.wingsTexture[drawPlayer.wings].Height / 4 * drawPlayer.wingFrame, Main.wingsTexture[drawPlayer.wings].Width, Main.wingsTexture[drawPlayer.wings].Height / 4)), color30 * (1f - num66), drawPlayer.bodyRotation, new Vector2((float) (Main.wingsTexture[drawPlayer.wings].Width / 2), (float) (Main.wingsTexture[drawPlayer.wings].Height / 8)), 1f, spriteEffects, 0); drawData.shader = num17; Main.playerDrawData.Add(drawData); } } } else if (drawPlayer.wings == 29) { drawData = new DrawData(Main.wingsTexture[drawPlayer.wings], new Vector2((float) ((int) ((double) Position.X - (double) Main.screenPosition.X + (double) (drawPlayer.width / 2) - (double) (9 * drawPlayer.direction)) + num65 * drawPlayer.direction), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) (drawPlayer.height / 2) + 2.0 * (double) drawPlayer.gravDir + (double) num64 * (double) drawPlayer.gravDir)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.wingsTexture[drawPlayer.wings].Height / 4 * drawPlayer.wingFrame, Main.wingsTexture[drawPlayer.wings].Width, Main.wingsTexture[drawPlayer.wings].Height / 4)), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0) * num44 * (1f - shadow) * 0.5f, drawPlayer.bodyRotation, new Vector2((float) (Main.wingsTexture[drawPlayer.wings].Width / 2), (float) (Main.wingsTexture[drawPlayer.wings].Height / 8)), 1.06f, spriteEffects, 0); drawData.shader = num17; Main.playerDrawData.Add(drawData); } else if (drawPlayer.wings == 36) { drawData = new DrawData(Main.glowMaskTexture[213], new Vector2((float) ((int) ((double) Position.X - (double) Main.screenPosition.X + (double) (drawPlayer.width / 2) - (double) (9 * drawPlayer.direction)) + num65 * drawPlayer.direction), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) (drawPlayer.height / 2) + 2.0 * (double) drawPlayer.gravDir + (double) num64 * (double) drawPlayer.gravDir)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.wingsTexture[drawPlayer.wings].Height / 4 * drawPlayer.wingFrame, Main.wingsTexture[drawPlayer.wings].Width, Main.wingsTexture[drawPlayer.wings].Height / 4)), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0) * num44 * (1f - shadow), drawPlayer.bodyRotation, new Vector2((float) (Main.wingsTexture[drawPlayer.wings].Width / 2), (float) (Main.wingsTexture[drawPlayer.wings].Height / 8)), 1.06f, spriteEffects, 0); drawData.shader = num17; Main.playerDrawData.Add(drawData); Vector2 spinningpoint = new Vector2(0.0f, (float) (2.0 - (double) shadow * 2.0)); for (int index34 = 0; index34 < 4; ++index34) { drawData = new DrawData(Main.glowMaskTexture[213], spinningpoint.RotatedBy(1.57079637050629 * (double) index34) + new Vector2((float) ((int) ((double) Position.X - (double) Main.screenPosition.X + (double) (drawPlayer.width / 2) - (double) (9 * drawPlayer.direction)) + num65 * drawPlayer.direction), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) (drawPlayer.height / 2) + 2.0 * (double) drawPlayer.gravDir + (double) num64 * (double) drawPlayer.gravDir)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.wingsTexture[drawPlayer.wings].Height / 4 * drawPlayer.wingFrame, Main.wingsTexture[drawPlayer.wings].Width, Main.wingsTexture[drawPlayer.wings].Height / 4)), new Microsoft.Xna.Framework.Color((int) sbyte.MaxValue, (int) sbyte.MaxValue, (int) sbyte.MaxValue, (int) sbyte.MaxValue) * num44 * (1f - shadow), drawPlayer.bodyRotation, new Vector2((float) (Main.wingsTexture[drawPlayer.wings].Width / 2), (float) (Main.wingsTexture[drawPlayer.wings].Height / 8)), 1f, spriteEffects, 0); drawData.shader = num17; Main.playerDrawData.Add(drawData); } } else if (drawPlayer.wings == 31) { Microsoft.Xna.Framework.Color color31 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0); Microsoft.Xna.Framework.Color color32 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.HotPink, Microsoft.Xna.Framework.Color.Crimson, (float) (Math.Cos(6.28318548202515 * ((double) drawPlayer.miscCounter / 100.0)) * 0.400000005960464 + 0.5)); color32.A = (byte) 0; for (int index35 = 0; index35 < 4; ++index35) { Vector2 vector2_11 = new Vector2((float) (Math.Cos(6.28318548202515 * ((double) drawPlayer.miscCounter / 60.0)) * 0.5 + 0.5), 0.0f).RotatedBy((double) index35 * 1.57079637050629) * 1f; drawData = new DrawData(Main.wingsTexture[drawPlayer.wings], new Vector2((float) ((int) ((double) Position.X - (double) Main.screenPosition.X + (double) (drawPlayer.width / 2) - (double) (9 * drawPlayer.direction)) + num65 * drawPlayer.direction), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) (drawPlayer.height / 2) + 2.0 * (double) drawPlayer.gravDir + (double) num64 * (double) drawPlayer.gravDir)) + vector2_11, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.wingsTexture[drawPlayer.wings].Height / 4 * drawPlayer.wingFrame, Main.wingsTexture[drawPlayer.wings].Width, Main.wingsTexture[drawPlayer.wings].Height / 4)), color32 * num44 * (1f - shadow) * 0.5f, drawPlayer.bodyRotation, new Vector2((float) (Main.wingsTexture[drawPlayer.wings].Width / 2), (float) (Main.wingsTexture[drawPlayer.wings].Height / 8)), 1f, spriteEffects, 0); drawData.shader = num17; Main.playerDrawData.Add(drawData); } drawData = new DrawData(Main.wingsTexture[drawPlayer.wings], new Vector2((float) ((int) ((double) Position.X - (double) Main.screenPosition.X + (double) (drawPlayer.width / 2) - (double) (9 * drawPlayer.direction)) + num65 * drawPlayer.direction), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) (drawPlayer.height / 2) + 2.0 * (double) drawPlayer.gravDir + (double) num64 * (double) drawPlayer.gravDir)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.wingsTexture[drawPlayer.wings].Height / 4 * drawPlayer.wingFrame, Main.wingsTexture[drawPlayer.wings].Width, Main.wingsTexture[drawPlayer.wings].Height / 4)), color32 * num44 * (1f - shadow) * 1f, drawPlayer.bodyRotation, new Vector2((float) (Main.wingsTexture[drawPlayer.wings].Width / 2), (float) (Main.wingsTexture[drawPlayer.wings].Height / 8)), 1f, spriteEffects, 0); drawData.shader = num17; Main.playerDrawData.Add(drawData); } else if (drawPlayer.wings == 32) { drawData = new DrawData(Main.glowMaskTexture[183], new Vector2((float) ((int) ((double) Position.X - (double) Main.screenPosition.X + (double) (drawPlayer.width / 2) - (double) (9 * drawPlayer.direction)) + num65 * drawPlayer.direction), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) (drawPlayer.height / 2) + 2.0 * (double) drawPlayer.gravDir + (double) num64 * (double) drawPlayer.gravDir)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.wingsTexture[drawPlayer.wings].Height / 4 * drawPlayer.wingFrame, Main.wingsTexture[drawPlayer.wings].Width, Main.wingsTexture[drawPlayer.wings].Height / 4)), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 0) * num44 * (1f - shadow), drawPlayer.bodyRotation, new Vector2((float) (Main.wingsTexture[drawPlayer.wings].Width / 2), (float) (Main.wingsTexture[drawPlayer.wings].Height / 8)), 1.06f, spriteEffects, 0); drawData.shader = num17; Main.playerDrawData.Add(drawData); } } } if (drawPlayer.balloon > (sbyte) 0) { int num67 = DateTime.Now.Millisecond % 800 / 200; Vector2 vector2_12 = Main.OffsetsPlayerOffhand[drawPlayer.bodyFrame.Y / 56]; if (drawPlayer.direction != 1) vector2_12.X = (float) drawPlayer.width - vector2_12.X; if ((double) drawPlayer.gravDir != 1.0) vector2_12.Y -= (float) drawPlayer.height; drawData = new DrawData(Main.accBalloonTexture[(int) drawPlayer.balloon], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X + (double) vector2_12.X), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) vector2_12.Y * (double) drawPlayer.gravDir)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.accBalloonTexture[(int) drawPlayer.balloon].Height / 4 * num67, Main.accBalloonTexture[(int) drawPlayer.balloon].Width, Main.accBalloonTexture[(int) drawPlayer.balloon].Height / 4)), color12, drawPlayer.bodyRotation, new Vector2((float) (26 + drawPlayer.direction * 4), (float) (28.0 + (double) drawPlayer.gravDir * 6.0)), 1f, spriteEffects, 0); drawData.shader = num16; Main.playerDrawData.Add(drawData); } Position.Y -= (float) ((int) playerOffset / 2); int num68 = drawPlayer.body == 82 || drawPlayer.body == 83 || drawPlayer.body == 93 || drawPlayer.body == 21 ? 1 : (drawPlayer.body == 22 ? 1 : 0); bool flag9 = drawPlayer.body == 93 || drawPlayer.legs == 20 || drawPlayer.legs == 21; if (num68 == 0) { Position.Y += num2; drawData = new DrawData(Main.playerTextures[skinVariant, 3], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color5, drawPlayer.bodyRotation, origin2, 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); Position.Y -= num2; } if (!flag9 && drawPlayer.legs != 67 && drawPlayer.legs != 106 && drawPlayer.legs != 140 && drawPlayer.legs != 138 && drawPlayer.shoe != (sbyte) 15 && drawPlayer.legs != 143) { drawData = new DrawData(Main.playerTextures[skinVariant, 10], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(drawPlayer.legFrame), color6, drawPlayer.legRotation, origin2, 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); } if (drawPlayer.wearsRobe) goto label_448; label_434: if (drawPlayer.legs == 140) { if (!drawPlayer.invis && !drawPlayer.mount.Active) { Texture2D texture = Main.extraTexture[73]; bool flag10 = drawPlayer.legFrame.Y == 0; int num69 = drawPlayer.miscCounter / 3 % 8; if (flag10) num69 = drawPlayer.miscCounter / 4 % 8; Microsoft.Xna.Framework.Rectangle r = new Microsoft.Xna.Framework.Rectangle(18 * flag10.ToInt(), num69 * 26, 16, 24); float num70 = 12f; if (drawPlayer.bodyFrame.Height != 0) num70 = 12f - Main.OffsetsPlayerHeadgear[drawPlayer.bodyFrame.Y / drawPlayer.bodyFrame.Height].Y; Vector2 scale = new Vector2(1f, 1f); Vector2 vector2_13 = Position + drawPlayer.Size * new Vector2(0.5f, (float) (0.5 + 0.5 * (double) drawPlayer.gravDir)); int direction = drawPlayer.direction; Vector2 vector2_14 = new Vector2(0.0f, -num70 * drawPlayer.gravDir); Vector2 position = (vector2_13 + vector2_14 - Main.screenPosition + drawPlayer.legPosition).Floor(); drawData = new DrawData(texture, position, new Microsoft.Xna.Framework.Rectangle?(r), color13, drawPlayer.legRotation, r.Size() * new Vector2(0.5f, (float) (0.5 - (double) drawPlayer.gravDir * 0.5)), scale, spriteEffects, 0); drawData.shader = num6; Main.playerDrawData.Add(drawData); } } else if (drawPlayer.legs > 0 && drawPlayer.legs < 161 && (drawPlayer.shoe != (sbyte) 15 || drawPlayer.wearsRobe)) { if (!drawPlayer.invis) { drawData = new DrawData(Main.armorLegTexture[drawPlayer.legs], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.legFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.legFrame.Height + 4.0)) + drawPlayer.legPosition + origin1, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.legFrame), color13, drawPlayer.legRotation, origin1, 1f, spriteEffects, 0); drawData.shader = num6; Main.playerDrawData.Add(drawData); if (index6 != -1) { drawData = new DrawData(Main.glowMaskTexture[index6], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.legFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.legFrame.Height + 4.0)) + drawPlayer.legPosition + origin1, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.legFrame), color18, drawPlayer.legRotation, origin1, 1f, spriteEffects, 0); drawData.shader = num6; Main.playerDrawData.Add(drawData); } } } else if (!drawPlayer.invis && drawPlayer.shoe != (sbyte) 15) { drawData = new DrawData(Main.playerTextures[skinVariant, 11], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.legFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.legFrame.Height + 4.0)) + drawPlayer.legPosition + origin1, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.legFrame), color9, drawPlayer.legRotation, origin1, 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); drawData = new DrawData(Main.playerTextures[skinVariant, 12], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.legFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.legFrame.Height + 4.0)) + drawPlayer.legPosition + origin1, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.legFrame), color10, drawPlayer.legRotation, origin1, 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); } if (drawPlayer.wearsRobe) goto label_451; label_448: if (drawPlayer.shoe > (sbyte) 0 && drawPlayer.shoe < (sbyte) 18) { drawData = new DrawData(Main.accShoesTexture[(int) drawPlayer.shoe], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.legFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.legFrame.Height + 4.0)) + drawPlayer.legPosition + origin1, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.legFrame), color13, drawPlayer.legRotation, origin1, 1f, spriteEffects, 0); drawData.shader = num11; Main.playerDrawData.Add(drawData); } if (drawPlayer.wearsRobe) goto label_434; label_451: Position.Y += num2; if ((skinVariant == 3 || skinVariant == 8 ? 1 : (skinVariant == 7 ? 1 : 0)) != 0 && (drawPlayer.body <= 0 || drawPlayer.body >= 210) && !drawPlayer.invis) { drawData = new DrawData(Main.playerTextures[skinVariant, 14], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.legFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.legFrame.Height + 4.0)) + drawPlayer.legPosition + origin1, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.legFrame), color7, drawPlayer.legRotation, origin1, 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); } int i1 = -1; switch (drawPlayer.body) { case 200: i1 = 149; break; case 201: i1 = 150; break; case 202: i1 = 151; break; case 209: i1 = 160; break; } if (i1 != -1) { this.LoadArmorLegs(i1); drawData = new DrawData(Main.armorLegTexture[i1], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.legFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.legFrame.Height + 4.0)) + drawPlayer.legPosition + origin1, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.legFrame), color12, drawPlayer.legRotation, origin1, 1f, spriteEffects, 0); drawData.shader = num5; Main.playerDrawData.Add(drawData); } if (drawPlayer.body > 0 && drawPlayer.body < 210) { Microsoft.Xna.Framework.Rectangle bodyFrame2 = drawPlayer.bodyFrame; int num71 = num3; bodyFrame2.X += num71; bodyFrame2.Width -= num71; if (drawPlayer.direction == -1) num71 = 0; if (!drawPlayer.invis || drawPlayer.body != 21 && drawPlayer.body != 22) { drawData = new DrawData(drawPlayer.Male ? Main.armorBodyTexture[drawPlayer.body] : Main.femaleBodyTexture[drawPlayer.body], new Vector2((float) ((int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)) + num71), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(bodyFrame2), color12, drawPlayer.bodyRotation, origin2, 1f, spriteEffects, 0); drawData.shader = num5; Main.playerDrawData.Add(drawData); if (index4 != -1) { drawData = new DrawData(Main.glowMaskTexture[index4], new Vector2((float) ((int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)) + num71), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(bodyFrame2), color16, drawPlayer.bodyRotation, origin2, 1f, spriteEffects, 0); drawData.shader = num5; Main.playerDrawData.Add(drawData); } } if (flag1 && !drawPlayer.invis) { drawData = new DrawData(Main.playerTextures[skinVariant, 5], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color5, drawPlayer.bodyRotation, origin2, 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); } } else if (!drawPlayer.invis) { if (!drawPlayer.Male) { drawData = new DrawData(Main.playerTextures[skinVariant, 4], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color8, drawPlayer.bodyRotation, origin2, 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); drawData = new DrawData(Main.playerTextures[skinVariant, 6], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color7, drawPlayer.bodyRotation, origin2, 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); } else { drawData = new DrawData(Main.playerTextures[skinVariant, 4], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color8, drawPlayer.bodyRotation, origin2, 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); drawData = new DrawData(Main.playerTextures[skinVariant, 6], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color7, drawPlayer.bodyRotation, origin2, 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); } drawData = new DrawData(Main.playerTextures[skinVariant, 5], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color5, drawPlayer.bodyRotation, origin2, 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); } if (drawPlayer.handoff > (sbyte) 0 && drawPlayer.handoff < (sbyte) 12) { drawData = new DrawData(Main.accHandsOffTexture[(int) drawPlayer.handoff], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color12, drawPlayer.bodyRotation, origin2, 1f, spriteEffects, 0); drawData.shader = num8; Main.playerDrawData.Add(drawData); } if (drawPlayer.waist > (sbyte) 0 && drawPlayer.waist < (sbyte) 13) { Microsoft.Xna.Framework.Rectangle legFrame = drawPlayer.legFrame; if (legFrame.Y >= 1064) legFrame.Y = 0; drawData = new DrawData(Main.accWaistTexture[(int) drawPlayer.waist], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.legFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.legFrame.Height + 4.0)) + drawPlayer.legPosition + origin1, new Microsoft.Xna.Framework.Rectangle?(legFrame), color13, drawPlayer.legRotation, origin1, 1f, spriteEffects, 0); drawData.shader = num12; Main.playerDrawData.Add(drawData); } if (drawPlayer.neck > (sbyte) 0 && drawPlayer.neck < (sbyte) 10) { drawData = new DrawData(Main.accNeckTexture[(int) drawPlayer.neck], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color12, drawPlayer.bodyRotation, origin2, 1f, spriteEffects, 0); drawData.shader = num14; Main.playerDrawData.Add(drawData); } if (!drawPlayer.invis && drawPlayer.head != 38 && drawPlayer.head != 135) { drawData = new DrawData(Main.playerTextures[skinVariant, 0], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin3, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color4, drawPlayer.headRotation, origin3, 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); drawData = new DrawData(Main.playerTextures[skinVariant, 1], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin3, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color2, drawPlayer.headRotation, origin3, 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); drawData = new DrawData(Main.playerTextures[skinVariant, 2], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin3, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color3, drawPlayer.headRotation, origin3, 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); if (drawPlayer.yoraiz0rDarkness) { drawData = new DrawData(Main.extraTexture[67], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin3, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color4, drawPlayer.headRotation, origin3, 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); } } if (flag4) { drawData = new DrawData(Main.armorHeadTexture[drawPlayer.head], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin3, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color11, drawPlayer.headRotation, origin3, 1f, spriteEffects, 0); drawData.shader = cHead; Main.playerDrawData.Add(drawData); if (!drawPlayer.invis) { drawData = new DrawData(Main.playerHairTexture[drawPlayer.hair], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin3, new Microsoft.Xna.Framework.Rectangle?(bodyFrame1), color1, drawPlayer.headRotation, origin3, 1f, spriteEffects, 0); drawData.shader = -num4; Main.playerDrawData.Add(drawData); } } if (flag5 && !drawPlayer.invis) { drawData = new DrawData(Main.playerHairAltTexture[drawPlayer.hair], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin3, new Microsoft.Xna.Framework.Rectangle?(bodyFrame1), color1, drawPlayer.headRotation, origin3, 1f, spriteEffects, 0); drawData.shader = -num4; Main.playerDrawData.Add(drawData); } if (drawPlayer.head == 23) { if (!drawPlayer.invis) { drawData = new DrawData(Main.playerHairTexture[drawPlayer.hair], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin3, new Microsoft.Xna.Framework.Rectangle?(bodyFrame1), color1, drawPlayer.headRotation, origin3, 1f, spriteEffects, 0); drawData.shader = -num4; Main.playerDrawData.Add(drawData); } drawData = new DrawData(Main.armorHeadTexture[drawPlayer.head], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin3, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color11, drawPlayer.headRotation, origin3, 1f, spriteEffects, 0); drawData.shader = cHead; Main.playerDrawData.Add(drawData); } else if (drawPlayer.head == 14 || drawPlayer.head == 56 || drawPlayer.head == 114 || drawPlayer.head == 158 || drawPlayer.head == 69 || drawPlayer.head == 180) { Microsoft.Xna.Framework.Rectangle bodyFrame3 = drawPlayer.bodyFrame; Vector2 origin4 = origin3; if ((double) drawPlayer.gravDir == 1.0) { if (bodyFrame3.Y != 0) { bodyFrame3.Y -= 2; bodyFrame3.Height -= 8; origin4.Y += 2f; } } else if (bodyFrame3.Y != 0) { bodyFrame3.Y -= 2; origin4.Y -= 10f; bodyFrame3.Height -= 8; } drawData = new DrawData(Main.armorHeadTexture[drawPlayer.head], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin3, new Microsoft.Xna.Framework.Rectangle?(bodyFrame3), color11, drawPlayer.headRotation, origin4, 1f, spriteEffects, 0); drawData.shader = cHead; Main.playerDrawData.Add(drawData); } else if (drawPlayer.head > 0 && drawPlayer.head < 216 && drawPlayer.head != 28) { if (!drawPlayer.invis || drawPlayer.head != 39 && drawPlayer.head != 38) { if (drawPlayer.head == 13) { int num72 = 0; int index36 = 0; if (drawPlayer.armor[index36] != null && drawPlayer.armor[index36].type == 205 && drawPlayer.armor[index36].stack > 0) num72 += drawPlayer.armor[index36].stack; int index37 = 10; if (drawPlayer.armor[index37] != null && drawPlayer.armor[index37].type == 205 && drawPlayer.armor[index37].stack > 0) num72 += drawPlayer.armor[index37].stack; float num73 = (float) Math.PI / 60f; float num74 = (float) ((double) num73 * (double) drawPlayer.position.X % 6.28318548202515); for (int index38 = 0; index38 < num72; ++index38) { float num75 = (float) ((double) Vector2.UnitY.RotatedBy((double) num74 + (double) num73 * (double) index38).X * ((double) index38 / 30.0) * 2.0); drawData = new DrawData(Main.armorHeadTexture[drawPlayer.head], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)) + num75, (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0 - (double) (4 * index38))) + drawPlayer.headPosition + origin3, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color11, drawPlayer.headRotation, origin3, 1f, spriteEffects, 0); drawData.shader = cHead; Main.playerDrawData.Add(drawData); } } else { drawData = new DrawData(Main.armorHeadTexture[drawPlayer.head], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin3, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color11, drawPlayer.headRotation, origin3, 1f, spriteEffects, 0); drawData.shader = cHead; Main.playerDrawData.Add(drawData); if (index3 != -1) { drawData = new DrawData(Main.glowMaskTexture[index3], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin3, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color15, drawPlayer.headRotation, origin3, 1f, spriteEffects, 0); drawData.shader = cHead; Main.playerDrawData.Add(drawData); } if (drawPlayer.head == 211) { Microsoft.Xna.Framework.Color color33 = new Microsoft.Xna.Framework.Color(100, 100, 100, 0); ulong seed = (ulong) (drawPlayer.miscCounter / 4 + 100); int num76 = 4; for (int index39 = 0; index39 < num76; ++index39) { float x = (float) Utils.RandomInt(ref seed, -10, 11) * 0.2f; float y = (float) Utils.RandomInt(ref seed, -14, 1) * 0.15f; drawData = new DrawData(Main.glowMaskTexture[241], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin3 + new Vector2(x, y), new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color33, drawPlayer.headRotation, origin3, 1f, spriteEffects, 0); drawData.shader = cHead; Main.playerDrawData.Add(drawData); } } } } } else if (!drawPlayer.invis && drawPlayer.face != (sbyte) 3 && drawPlayer.face != (sbyte) 2 && drawPlayer.face != (sbyte) 4) { drawData = new DrawData(Main.playerHairTexture[drawPlayer.hair], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin3, new Microsoft.Xna.Framework.Rectangle?(bodyFrame1), color1, drawPlayer.headRotation, origin3, 1f, spriteEffects, 0); drawData.shader = -num4; Main.playerDrawData.Add(drawData); } if (drawPlayer.head == 205) { drawData = new DrawData(Main.extraTexture[77], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin3, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color4, drawPlayer.headRotation, origin3, 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); } if (drawPlayer.head == 214 && !drawPlayer.invis) { Microsoft.Xna.Framework.Rectangle bodyFrame4 = drawPlayer.bodyFrame; bodyFrame4.Y = 0; float t = (float) drawPlayer.miscCounter / 300f; Microsoft.Xna.Framework.Color color34 = new Microsoft.Xna.Framework.Color(0, 0, 0, 0); float from = 0.8f; float to = 0.9f; if ((double) t >= (double) from) color34 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, new Microsoft.Xna.Framework.Color(200, 200, 200, 0), Utils.InverseLerp(from, to, t, true)); if ((double) t >= (double) to) color34 = Microsoft.Xna.Framework.Color.Lerp(Microsoft.Xna.Framework.Color.Transparent, new Microsoft.Xna.Framework.Color(200, 200, 200, 0), Utils.InverseLerp(1f, to, t, true)); color34 *= num44 * (1f - shadow); drawData = new DrawData(Main.extraTexture[90], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin3 - Main.OffsetsPlayerHeadgear[drawPlayer.bodyFrame.Y / drawPlayer.bodyFrame.Height], new Microsoft.Xna.Framework.Rectangle?(bodyFrame4), color34, drawPlayer.headRotation, origin3, 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); } if (drawPlayer.head == 137) { drawData = new DrawData(Main.jackHatTexture, new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin3, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue), drawPlayer.headRotation, origin3, 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); for (int index40 = 0; index40 < 7; ++index40) { Microsoft.Xna.Framework.Color color35 = new Microsoft.Xna.Framework.Color(110 - index40 * 10, 110 - index40 * 10, 110 - index40 * 10, 110 - index40 * 10); Vector2 vector2_15 = new Vector2((float) Main.rand.Next(-10, 11) * 0.2f, (float) Main.rand.Next(-10, 11) * 0.2f); vector2_15.X = drawPlayer.itemFlamePos[index40].X; vector2_15.Y = drawPlayer.itemFlamePos[index40].Y; vector2_15 *= 0.5f; drawData = new DrawData(Main.jackHatTexture, new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin3 + vector2_15, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color35, drawPlayer.headRotation, origin3, 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); } } if (drawPlayer.face > (sbyte) 0 && drawPlayer.face < (sbyte) 9) { if (drawPlayer.face == (sbyte) 7) { drawData = new DrawData(Main.accFaceTexture[(int) drawPlayer.face], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin3, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), new Microsoft.Xna.Framework.Color(200, 200, 200, 150), drawPlayer.headRotation, origin3, 1f, spriteEffects, 0); drawData.shader = num15; Main.playerDrawData.Add(drawData); } else { drawData = new DrawData(Main.accFaceTexture[(int) drawPlayer.face], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.headPosition + origin3, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color11, drawPlayer.headRotation, origin3, 1f, spriteEffects, 0); drawData.shader = num15; Main.playerDrawData.Add(drawData); } } if (drawPlayer.mount.Active) { drawPlayer.mount.Draw(Main.playerDrawData, 2, drawPlayer, Position, drawColor, spriteEffects, shadow); drawPlayer.mount.Draw(Main.playerDrawData, 3, drawPlayer, Position, drawColor, spriteEffects, shadow); } if (drawPlayer.pulley && drawPlayer.itemAnimation == 0) { if (drawPlayer.pulleyDir == (byte) 2) { int num77 = -25; int num78 = 0; float rotation1 = 0.0f; drawData = new DrawData(Main.pulleyTexture, new Vector2((float) ((int) ((double) Position.X - (double) Main.screenPosition.X + (double) (drawPlayer.width / 2) - (double) (9 * drawPlayer.direction)) + num78 * drawPlayer.direction), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) (drawPlayer.height / 2) + 2.0 * (double) drawPlayer.gravDir + (double) num77 * (double) drawPlayer.gravDir)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.pulleyTexture.Height / 2 * drawPlayer.pulleyFrame, Main.pulleyTexture.Width, Main.pulleyTexture.Height / 2)), color11, rotation1, new Vector2((float) (Main.pulleyTexture.Width / 2), (float) (Main.pulleyTexture.Height / 4)), 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); } else { int num79 = -26; int num80 = 10; float rotation2 = 0.35f * (float) -drawPlayer.direction; drawData = new DrawData(Main.pulleyTexture, new Vector2((float) ((int) ((double) Position.X - (double) Main.screenPosition.X + (double) (drawPlayer.width / 2) - (double) (9 * drawPlayer.direction)) + num80 * drawPlayer.direction), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) (drawPlayer.height / 2) + 2.0 * (double) drawPlayer.gravDir + (double) num79 * (double) drawPlayer.gravDir)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.pulleyTexture.Height / 2 * drawPlayer.pulleyFrame, Main.pulleyTexture.Width, Main.pulleyTexture.Height / 2)), color11, rotation2, new Vector2((float) (Main.pulleyTexture.Width / 2), (float) (Main.pulleyTexture.Height / 4)), 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); } } if (drawPlayer.shield > (sbyte) 0 && drawPlayer.shield < (sbyte) 7) { Vector2 zero = Vector2.Zero; if (drawPlayer.shieldRaised) zero.Y -= 4f; if (drawPlayer.shieldRaised) { float num81 = (float) Math.Sin((double) Main.GlobalTime * 6.28318548202515); float x = (float) (2.5 + 1.5 * (double) num81); Microsoft.Xna.Framework.Color color36 = color12; color36.A = (byte) 0; Microsoft.Xna.Framework.Color color37 = color36 * (float) (0.449999988079071 - (double) num81 * 0.150000005960464); for (float num82 = 0.0f; (double) num82 < 4.0; ++num82) { drawData = new DrawData(Main.accShieldTexture[(int) drawPlayer.shield], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)) + zero + new Vector2(x, 0.0f).RotatedBy((double) num82 / 4.0 * 6.28318548202515), new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color37, drawPlayer.bodyRotation, origin2, 1f, spriteEffects, 0); drawData.shader = num13; Main.playerDrawData.Add(drawData); } } drawData = new DrawData(Main.accShieldTexture[(int) drawPlayer.shield], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)) + zero, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color12, drawPlayer.bodyRotation, origin2, 1f, spriteEffects, 0); drawData.shader = num13; Main.playerDrawData.Add(drawData); if (drawPlayer.shieldRaised) { Microsoft.Xna.Framework.Color color38 = color12; float num83 = (float) Math.Sin((double) Main.GlobalTime * 3.14159274101257); color38.A = (byte) ((double) color38.A * (0.5 + 0.5 * (double) num83)); color38 *= (float) (0.5 + 0.5 * (double) num83); drawData = new DrawData(Main.accShieldTexture[(int) drawPlayer.shield], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)) + zero, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color38, drawPlayer.bodyRotation, origin2, 1f, spriteEffects, 0); drawData.shader = num13; } if (drawPlayer.shieldRaised && drawPlayer.shieldParryTimeLeft > 0) { float num84 = (float) drawPlayer.shieldParryTimeLeft / 20f; float num85 = 1.5f * num84; Vector2 vector2_16 = new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)) + zero; Microsoft.Xna.Framework.Color color39 = color12; float num86 = 1f; Vector2 vector2_17 = Position + drawPlayer.Size / 2f - Main.screenPosition; Vector2 vector2_18 = vector2_16 - vector2_17; Vector2 position = vector2_16 + vector2_18 * num85; float scale = num86 + num85; color39.A = (byte) ((double) color39.A * (1.0 - (double) num84)); Microsoft.Xna.Framework.Color color40 = color39 * (1f - num84); drawData = new DrawData(Main.accShieldTexture[(int) drawPlayer.shield], position, new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color40, drawPlayer.bodyRotation, origin2, scale, spriteEffects, 0); drawData.shader = num13; Main.playerDrawData.Add(drawData); } if (drawPlayer.mount.Cart) Main.playerDrawData.Reverse(Main.playerDrawData.Count - 2, 2); } Position.Y += (float) ((int) playerOffset / 2); if (drawPlayer.solarShields > 0 && (double) shadow == 0.0 && !drawPlayer.dead) { Texture2D texture2D = Main.extraTexture[61 + drawPlayer.solarShields - 1]; Microsoft.Xna.Framework.Color color41 = new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue); float rotation3 = (drawPlayer.solarShieldPos[0] * new Vector2(1f, 0.5f)).ToRotation(); if (drawPlayer.direction == -1) rotation3 += 3.141593f; float rotation4 = rotation3 + 0.06283186f * (float) drawPlayer.direction; drawData = new DrawData(texture2D, new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) (drawPlayer.height / 2))) + drawPlayer.solarShieldPos[0], new Microsoft.Xna.Framework.Rectangle?(), color41, rotation4, texture2D.Size() / 2f, 1f, spriteEffects, 0); drawData.shader = num5; Main.playerDrawData.Add(drawData); } Position.Y -= (float) ((int) playerOffset / 2); if (drawPlayer.heldProj >= 0 && (double) shadow == 0.0 && !flag3) projectileDrawPosition = Main.playerDrawData.Count; Microsoft.Xna.Framework.Color currentColor = Lighting.GetColor((int) ((double) Position.X + (double) drawPlayer.width * 0.5) / 16, (int) (((double) Position.Y + (double) drawPlayer.height * 0.5) / 16.0)); if (drawPlayer.inventory[drawPlayer.selectedItem].type == 678) currentColor = Microsoft.Xna.Framework.Color.White; if (drawPlayer.shroomiteStealth && drawPlayer.inventory[drawPlayer.selectedItem].ranged) { float num87 = drawPlayer.stealth; if ((double) num87 < 0.03) num87 = 0.03f; float num88 = (float) ((1.0 + (double) num87 * 10.0) / 11.0); currentColor = new Microsoft.Xna.Framework.Color((int) (byte) ((double) currentColor.R * (double) num87), (int) (byte) ((double) currentColor.G * (double) num87), (int) (byte) ((double) currentColor.B * (double) num88), (int) (byte) ((double) currentColor.A * (double) num87)); } if (drawPlayer.setVortex && drawPlayer.inventory[drawPlayer.selectedItem].ranged) { float num89 = drawPlayer.stealth; if ((double) num89 < 0.03) num89 = 0.03f; double num90 = (1.0 + (double) num89 * 10.0) / 11.0; currentColor = currentColor.MultiplyRGBA(new Microsoft.Xna.Framework.Color(Vector4.Lerp(Vector4.One, new Vector4(0.0f, 0.12f, 0.16f, 0.0f), 1f - num89))); } if ((double) shadow == 0.0 && !drawPlayer.frozen && (drawPlayer.itemAnimation > 0 && drawPlayer.inventory[drawPlayer.selectedItem].useStyle != 0 || drawPlayer.inventory[drawPlayer.selectedItem].holdStyle > 0 && !drawPlayer.pulley) && drawPlayer.inventory[drawPlayer.selectedItem].type > 0 && !drawPlayer.dead && !drawPlayer.inventory[drawPlayer.selectedItem].noUseGraphic && (!drawPlayer.wet || !drawPlayer.inventory[drawPlayer.selectedItem].noWet)) { string name = drawPlayer.name; Microsoft.Xna.Framework.Color color42 = new Microsoft.Xna.Framework.Color(250, 250, 250, drawPlayer.inventory[drawPlayer.selectedItem].alpha); Vector2 vector2_19 = Vector2.Zero; if (drawPlayer.inventory[drawPlayer.selectedItem].type == 3823) vector2_19 = new Vector2((float) (7 * drawPlayer.direction), -7f * drawPlayer.gravDir); if (drawPlayer.inventory[drawPlayer.selectedItem].type == 3827) { vector2_19 = new Vector2((float) (13 * drawPlayer.direction), -13f * drawPlayer.gravDir); color42 = Microsoft.Xna.Framework.Color.Lerp(drawPlayer.inventory[drawPlayer.selectedItem].GetAlpha(currentColor), Microsoft.Xna.Framework.Color.White, 0.6f); color42.A = (byte) 66; } ItemSlot.GetItemLight(ref currentColor, drawPlayer.inventory[drawPlayer.selectedItem]); if (drawPlayer.inventory[drawPlayer.selectedItem].type == 3476) { Texture2D texture2D = Main.extraTexture[64]; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: 9, frameY: (drawPlayer.miscCounter % 54 / 6)); Vector2 vector2_20 = new Vector2((float) (r.Width / 2 * drawPlayer.direction), 0.0f); Vector2 origin5 = r.Size() / 2f; drawData = new DrawData(texture2D, (vector2_1 - Main.screenPosition + vector2_20).Floor(), new Microsoft.Xna.Framework.Rectangle?(r), drawPlayer.inventory[drawPlayer.selectedItem].GetAlpha(currentColor).MultiplyRGBA(new Microsoft.Xna.Framework.Color(new Vector4(0.5f, 0.5f, 0.5f, 0.8f))), drawPlayer.itemRotation, origin5, drawPlayer.inventory[drawPlayer.selectedItem].scale, effect, 0); Main.playerDrawData.Add(drawData); drawData = new DrawData(Main.glowMaskTexture[195], (vector2_1 - Main.screenPosition + vector2_20).Floor(), new Microsoft.Xna.Framework.Rectangle?(r), new Microsoft.Xna.Framework.Color(250, 250, 250, drawPlayer.inventory[drawPlayer.selectedItem].alpha) * 0.5f, drawPlayer.itemRotation, origin5, drawPlayer.inventory[drawPlayer.selectedItem].scale, effect, 0); Main.playerDrawData.Add(drawData); } else if (drawPlayer.inventory[drawPlayer.selectedItem].type == 3779) { Texture2D texture2D = Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type]; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(); Vector2 vector2_21 = new Vector2((float) (r.Width / 2 * drawPlayer.direction), 0.0f); Vector2 origin6 = r.Size() / 2f; Microsoft.Xna.Framework.Color color43 = new Microsoft.Xna.Framework.Color(120, 40, 222, 0) * (float) (((double) ((float) ((double) drawPlayer.miscCounter / 75.0 * 6.28318548202515)).ToRotationVector2().X * 1.0 + 0.0) / 2.0 * 0.300000011920929 + 0.850000023841858) * 0.5f; float num91 = 2f; for (float num92 = 0.0f; (double) num92 < 4.0; ++num92) { drawData = new DrawData(Main.glowMaskTexture[218], (vector2_1 - Main.screenPosition + vector2_21).Floor() + (num92 * 1.570796f).ToRotationVector2() * num91, new Microsoft.Xna.Framework.Rectangle?(r), color43, drawPlayer.itemRotation, origin6, drawPlayer.inventory[drawPlayer.selectedItem].scale, effect, 0); Main.playerDrawData.Add(drawData); } drawData = new DrawData(texture2D, (vector2_1 - Main.screenPosition + vector2_21).Floor(), new Microsoft.Xna.Framework.Rectangle?(r), drawPlayer.inventory[drawPlayer.selectedItem].GetAlpha(currentColor).MultiplyRGBA(new Microsoft.Xna.Framework.Color(new Vector4(0.5f, 0.5f, 0.5f, 0.8f))), drawPlayer.itemRotation, origin6, drawPlayer.inventory[drawPlayer.selectedItem].scale, effect, 0); Main.playerDrawData.Add(drawData); } else if (drawPlayer.inventory[drawPlayer.selectedItem].useStyle == 5) { if (Item.staff[drawPlayer.inventory[drawPlayer.selectedItem].type]) { float rotation5 = drawPlayer.itemRotation + 0.785f * (float) drawPlayer.direction; int num93 = 0; int num94 = 0; Vector2 origin7 = new Vector2(0.0f, (float) Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height); if (drawPlayer.inventory[drawPlayer.selectedItem].type == 3210) { num93 = 8 * -drawPlayer.direction; num94 = 2 * (int) drawPlayer.gravDir; } if (drawPlayer.inventory[drawPlayer.selectedItem].type == 3870) { num93 = 12 * -drawPlayer.direction; num94 = 12 * (int) drawPlayer.gravDir; } if (drawPlayer.inventory[drawPlayer.selectedItem].type == 3787) num94 = (int) ((double) (8 * (int) drawPlayer.gravDir) * Math.Cos((double) rotation5)); if ((double) drawPlayer.gravDir == -1.0) { if (drawPlayer.direction == -1) { rotation5 += 1.57f; origin7 = new Vector2((float) Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width, 0.0f); num93 -= Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width; } else { rotation5 -= 1.57f; origin7 = Vector2.Zero; } } else if (drawPlayer.direction == -1) { origin7 = new Vector2((float) Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width, (float) Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height); num93 -= Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width; } drawData = new DrawData(Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type], new Vector2((float) (int) ((double) vector2_1.X - (double) Main.screenPosition.X + (double) origin7.X + (double) num93), (float) (int) ((double) vector2_1.Y - (double) Main.screenPosition.Y + (double) num94)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height)), drawPlayer.inventory[drawPlayer.selectedItem].GetAlpha(currentColor), rotation5, origin7, drawPlayer.inventory[drawPlayer.selectedItem].scale, effect, 0); Main.playerDrawData.Add(drawData); if (drawPlayer.inventory[drawPlayer.selectedItem].type == 3870) { drawData = new DrawData(Main.glowMaskTexture[238], new Vector2((float) (int) ((double) vector2_1.X - (double) Main.screenPosition.X + (double) origin7.X + (double) num93), (float) (int) ((double) vector2_1.Y - (double) Main.screenPosition.Y + (double) num94)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height)), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, (int) sbyte.MaxValue), rotation5, origin7, drawPlayer.inventory[drawPlayer.selectedItem].scale, effect, 0); Main.playerDrawData.Add(drawData); } } else { Vector2 vector2_22 = new Vector2((float) (Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width / 2), (float) (Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height / 2)); Vector2 vector2_23 = this.DrawPlayerItemPos(drawPlayer.gravDir, drawPlayer.inventory[drawPlayer.selectedItem].type); int x = (int) vector2_23.X; vector2_22.Y = vector2_23.Y; Vector2 origin8 = new Vector2((float) -x, (float) (Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height / 2)); if (drawPlayer.direction == -1) origin8 = new Vector2((float) (Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width + x), (float) (Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height / 2)); drawData = new DrawData(Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type], new Vector2((float) (int) ((double) vector2_1.X - (double) Main.screenPosition.X + (double) vector2_22.X), (float) (int) ((double) vector2_1.Y - (double) Main.screenPosition.Y + (double) vector2_22.Y)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height)), drawPlayer.inventory[drawPlayer.selectedItem].GetAlpha(currentColor), drawPlayer.itemRotation, origin8, drawPlayer.inventory[drawPlayer.selectedItem].scale, effect, 0); Main.playerDrawData.Add(drawData); if (drawPlayer.inventory[drawPlayer.selectedItem].color != new Microsoft.Xna.Framework.Color()) { drawData = new DrawData(Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type], new Vector2((float) (int) ((double) vector2_1.X - (double) Main.screenPosition.X + (double) vector2_22.X), (float) (int) ((double) vector2_1.Y - (double) Main.screenPosition.Y + (double) vector2_22.Y)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height)), drawPlayer.inventory[drawPlayer.selectedItem].GetColor(currentColor), drawPlayer.itemRotation, origin8, drawPlayer.inventory[drawPlayer.selectedItem].scale, effect, 0); Main.playerDrawData.Add(drawData); } if (drawPlayer.inventory[drawPlayer.selectedItem].glowMask != (short) -1) { drawData = new DrawData(Main.glowMaskTexture[(int) drawPlayer.inventory[drawPlayer.selectedItem].glowMask], new Vector2((float) (int) ((double) vector2_1.X - (double) Main.screenPosition.X + (double) vector2_22.X), (float) (int) ((double) vector2_1.Y - (double) Main.screenPosition.Y + (double) vector2_22.Y)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height)), new Microsoft.Xna.Framework.Color(250, 250, 250, drawPlayer.inventory[drawPlayer.selectedItem].alpha), drawPlayer.itemRotation, origin8, drawPlayer.inventory[drawPlayer.selectedItem].scale, effect, 0); Main.playerDrawData.Add(drawData); } if (drawPlayer.inventory[drawPlayer.selectedItem].type == 3788) { float num95 = (float) ((double) ((float) ((double) drawPlayer.miscCounter / 75.0 * 6.28318548202515)).ToRotationVector2().X * 1.0 + 0.0); Microsoft.Xna.Framework.Color color44 = new Microsoft.Xna.Framework.Color(80, 40, 252, 0) * (float) ((double) num95 / 2.0 * 0.300000011920929 + 0.850000023841858) * 0.5f; for (float num96 = 0.0f; (double) num96 < 4.0; ++num96) { drawData = new DrawData(Main.glowMaskTexture[220], new Vector2((float) (int) ((double) vector2_1.X - (double) Main.screenPosition.X + (double) vector2_22.X), (float) (int) ((double) vector2_1.Y - (double) Main.screenPosition.Y + (double) vector2_22.Y)) + (num96 * 1.570796f + drawPlayer.itemRotation).ToRotationVector2() * num95, new Microsoft.Xna.Framework.Rectangle?(), color44, drawPlayer.itemRotation, origin8, drawPlayer.inventory[drawPlayer.selectedItem].scale, effect, 0); Main.playerDrawData.Add(drawData); } } } } else if ((double) drawPlayer.gravDir == -1.0) { drawData = new DrawData(Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type], new Vector2((float) (int) ((double) vector2_1.X - (double) Main.screenPosition.X), (float) (int) ((double) vector2_1.Y - (double) Main.screenPosition.Y)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height)), drawPlayer.inventory[drawPlayer.selectedItem].GetAlpha(currentColor), drawPlayer.itemRotation, new Vector2((float) ((double) Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width * 0.5 - (double) Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width * 0.5 * (double) drawPlayer.direction), 0.0f) + vector2_19, drawPlayer.inventory[drawPlayer.selectedItem].scale, effect, 0); Main.playerDrawData.Add(drawData); if (drawPlayer.inventory[drawPlayer.selectedItem].color != new Microsoft.Xna.Framework.Color()) { drawData = new DrawData(Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type], new Vector2((float) (int) ((double) vector2_1.X - (double) Main.screenPosition.X), (float) (int) ((double) vector2_1.Y - (double) Main.screenPosition.Y)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height)), drawPlayer.inventory[drawPlayer.selectedItem].GetColor(currentColor), drawPlayer.itemRotation, new Vector2((float) ((double) Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width * 0.5 - (double) Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width * 0.5 * (double) drawPlayer.direction), 0.0f) + vector2_19, drawPlayer.inventory[drawPlayer.selectedItem].scale, effect, 0); Main.playerDrawData.Add(drawData); } if (drawPlayer.inventory[drawPlayer.selectedItem].glowMask != (short) -1) { drawData = new DrawData(Main.glowMaskTexture[(int) drawPlayer.inventory[drawPlayer.selectedItem].glowMask], new Vector2((float) (int) ((double) vector2_1.X - (double) Main.screenPosition.X), (float) (int) ((double) vector2_1.Y - (double) Main.screenPosition.Y)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height)), new Microsoft.Xna.Framework.Color(250, 250, 250, drawPlayer.inventory[drawPlayer.selectedItem].alpha), drawPlayer.itemRotation, new Vector2((float) ((double) Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width * 0.5 - (double) Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width * 0.5 * (double) drawPlayer.direction), 0.0f) + vector2_19, drawPlayer.inventory[drawPlayer.selectedItem].scale, effect, 0); Main.playerDrawData.Add(drawData); } } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 425 || drawPlayer.inventory[drawPlayer.selectedItem].type == 507) effect = (double) drawPlayer.gravDir != 1.0 ? (drawPlayer.direction != 1 ? SpriteEffects.FlipHorizontally : SpriteEffects.None) : (drawPlayer.direction != 1 ? SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically : SpriteEffects.FlipVertically); int type = drawPlayer.inventory[drawPlayer.selectedItem].type; drawData = new DrawData(Main.itemTexture[type], new Vector2((float) (int) ((double) vector2_1.X - (double) Main.screenPosition.X), (float) (int) ((double) vector2_1.Y - (double) Main.screenPosition.Y)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[type].Width, Main.itemTexture[type].Height)), drawPlayer.inventory[drawPlayer.selectedItem].GetAlpha(currentColor), drawPlayer.itemRotation, new Vector2((float) ((double) Main.itemTexture[type].Width * 0.5 - (double) Main.itemTexture[type].Width * 0.5 * (double) drawPlayer.direction), (float) Main.itemTexture[type].Height) + vector2_19, drawPlayer.inventory[drawPlayer.selectedItem].scale, effect, 0); Main.playerDrawData.Add(drawData); if (drawPlayer.inventory[drawPlayer.selectedItem].color != new Microsoft.Xna.Framework.Color()) { drawData = new DrawData(Main.itemTexture[type], new Vector2((float) (int) ((double) vector2_1.X - (double) Main.screenPosition.X), (float) (int) ((double) vector2_1.Y - (double) Main.screenPosition.Y)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[type].Width, Main.itemTexture[type].Height)), drawPlayer.inventory[drawPlayer.selectedItem].GetColor(currentColor), drawPlayer.itemRotation, new Vector2((float) ((double) Main.itemTexture[type].Width * 0.5 - (double) Main.itemTexture[type].Width * 0.5 * (double) drawPlayer.direction), (float) Main.itemTexture[type].Height) + vector2_19, drawPlayer.inventory[drawPlayer.selectedItem].scale, effect, 0); Main.playerDrawData.Add(drawData); } if (drawPlayer.inventory[drawPlayer.selectedItem].glowMask != (short) -1) { drawData = new DrawData(Main.glowMaskTexture[(int) drawPlayer.inventory[drawPlayer.selectedItem].glowMask], new Vector2((float) (int) ((double) vector2_1.X - (double) Main.screenPosition.X), (float) (int) ((double) vector2_1.Y - (double) Main.screenPosition.Y)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[type].Width, Main.itemTexture[type].Height)), color42, drawPlayer.itemRotation, new Vector2((float) ((double) Main.itemTexture[type].Width * 0.5 - (double) Main.itemTexture[type].Width * 0.5 * (double) drawPlayer.direction), (float) Main.itemTexture[type].Height) + vector2_19, drawPlayer.inventory[drawPlayer.selectedItem].scale, effect, 0); Main.playerDrawData.Add(drawData); } if (drawPlayer.inventory[drawPlayer.selectedItem].flame) { if ((double) shadow == 0.0) { try { this.LoadItemFlames(type); if (Main.itemFlameTexture[type] != null) { for (int index41 = 0; index41 < 7; ++index41) { Microsoft.Xna.Framework.Color color45 = new Microsoft.Xna.Framework.Color(100, 100, 100, 0); if (type == 3045) color45 = new Microsoft.Xna.Framework.Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 0); float x = drawPlayer.itemFlamePos[index41].X; float y = drawPlayer.itemFlamePos[index41].Y; drawData = new DrawData(Main.itemFlameTexture[type], new Vector2((float) (int) ((double) vector2_1.X - (double) Main.screenPosition.X) + x, (float) (int) ((double) vector2_1.Y - (double) Main.screenPosition.Y) + y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[type].Width, Main.itemTexture[type].Height)), color45, drawPlayer.itemRotation, new Vector2((float) ((double) Main.itemTexture[type].Width * 0.5 - (double) Main.itemTexture[type].Width * 0.5 * (double) drawPlayer.direction), (float) Main.itemTexture[type].Height) + vector2_19, drawPlayer.inventory[drawPlayer.selectedItem].scale, effect, 0); Main.playerDrawData.Add(drawData); } } } catch { } } } } } if (drawPlayer.body > 0 && drawPlayer.body < 210) { Microsoft.Xna.Framework.Rectangle bodyFrame5 = drawPlayer.bodyFrame; int num97 = num3; bodyFrame5.X += num97; bodyFrame5.Width -= num97; if (drawPlayer.direction == -1) num97 = 0; if (!drawPlayer.invis || drawPlayer.body != 21 && drawPlayer.body != 22) { if (flag1 && !drawPlayer.invis) { int body = drawPlayer.body; if (flag2) { drawData = new DrawData(Main.playerTextures[skinVariant, 7], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color5, drawPlayer.bodyRotation, origin2, 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); } drawData = new DrawData(Main.playerTextures[skinVariant, 9], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color5, drawPlayer.bodyRotation, origin2, 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); } drawData = new DrawData(Main.armorArmTexture[drawPlayer.body], new Vector2((float) ((int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)) + num97), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(bodyFrame5), color12, drawPlayer.bodyRotation, origin2, 1f, spriteEffects, 0); drawData.shader = num5; Main.playerDrawData.Add(drawData); if (index5 != -1) { drawData = new DrawData(Main.glowMaskTexture[index5], new Vector2((float) ((int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)) + num97), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(bodyFrame5), color17, drawPlayer.bodyRotation, origin2, 1f, spriteEffects, 0); drawData.shader = num5; Main.playerDrawData.Add(drawData); } if (drawPlayer.body == 205) { Microsoft.Xna.Framework.Color color46 = new Microsoft.Xna.Framework.Color(100, 100, 100, 0); ulong seed = (ulong) (drawPlayer.miscCounter / 4); int num98 = 4; for (int index42 = 0; index42 < num98; ++index42) { float num99 = (float) Utils.RandomInt(ref seed, -10, 11) * 0.2f; float num100 = (float) Utils.RandomInt(ref seed, -10, 1) * 0.15f; drawData = new DrawData(Main.glowMaskTexture[240], new Vector2((float) ((int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)) + num97), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2) + num99, (float) (drawPlayer.bodyFrame.Height / 2) + num100), new Microsoft.Xna.Framework.Rectangle?(bodyFrame5), color46, drawPlayer.bodyRotation, origin2, 1f, spriteEffects, 0); drawData.shader = num5; Main.playerDrawData.Add(drawData); } } } } else if (!drawPlayer.invis) { drawData = new DrawData(Main.playerTextures[skinVariant, 7], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color5, drawPlayer.bodyRotation, origin2, 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); drawData = new DrawData(Main.playerTextures[skinVariant, 8], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color8, drawPlayer.bodyRotation, origin2, 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); drawData = new DrawData(Main.playerTextures[skinVariant, 13], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color7, drawPlayer.bodyRotation, origin2, 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); } if (drawPlayer.handon > (sbyte) 0 && drawPlayer.handon < (sbyte) 20) { drawData = new DrawData(Main.accHandsOnTexture[(int) drawPlayer.handon], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color12, drawPlayer.bodyRotation, origin2, 1f, spriteEffects, 0); drawData.shader = num7; Main.playerDrawData.Add(drawData); } if (drawPlayer.inventory[drawPlayer.selectedItem].type > -1 && Item.claw[drawPlayer.inventory[drawPlayer.selectedItem].type] && (double) shadow == 0.0 && !drawPlayer.frozen && (drawPlayer.itemAnimation > 0 || drawPlayer.inventory[drawPlayer.selectedItem].holdStyle > 0 && !drawPlayer.pulley) && drawPlayer.inventory[drawPlayer.selectedItem].type > 0 && !drawPlayer.dead && !drawPlayer.inventory[drawPlayer.selectedItem].noUseGraphic && (!drawPlayer.wet || !drawPlayer.inventory[drawPlayer.selectedItem].noWet)) { if ((double) drawPlayer.gravDir == -1.0) { drawData = new DrawData(Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type], new Vector2((float) (int) ((double) vector2_1.X - (double) Main.screenPosition.X), (float) (int) ((double) vector2_1.Y - (double) Main.screenPosition.Y)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height)), drawPlayer.inventory[drawPlayer.selectedItem].GetAlpha(currentColor), drawPlayer.itemRotation, new Vector2((float) ((double) Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width * 0.5 - (double) Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width * 0.5 * (double) drawPlayer.direction), 0.0f), drawPlayer.inventory[drawPlayer.selectedItem].scale, effect, 0); Main.playerDrawData.Add(drawData); } else { int type = drawPlayer.inventory[drawPlayer.selectedItem].type; drawData = new DrawData(Main.itemTexture[type], new Vector2((float) (int) ((double) vector2_1.X - (double) Main.screenPosition.X), (float) (int) ((double) vector2_1.Y - (double) Main.screenPosition.Y)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[type].Width, Main.itemTexture[type].Height)), drawPlayer.inventory[drawPlayer.selectedItem].GetAlpha(currentColor), drawPlayer.itemRotation, new Vector2((float) ((double) Main.itemTexture[type].Width * 0.5 - (double) Main.itemTexture[type].Width * 0.5 * (double) drawPlayer.direction), (float) Main.itemTexture[type].Height), drawPlayer.inventory[drawPlayer.selectedItem].scale, effect, 0); Main.playerDrawData.Add(drawData); } } if (((drawPlayer.heldProj < 0 ? 0 : ((double) shadow == 0.0 ? 1 : 0)) & (flag3 ? 1 : 0)) != 0) projectileDrawPosition = Main.playerDrawData.Count; Position.Y -= num2; if (!flag8 && drawPlayer.front > (sbyte) 0 && drawPlayer.front < (sbyte) 5 && !drawPlayer.mount.Active) { drawData = new DrawData(Main.accFrontTexture[(int) drawPlayer.front], new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(drawPlayer.bodyFrame), color12, drawPlayer.bodyRotation, origin2, 1f, spriteEffects, 0); drawData.shader = num10; Main.playerDrawData.Add(drawData); } if (drawPlayer.frozen && (double) shadow == 0.0) { Microsoft.Xna.Framework.Color color47 = color12; color47.R = (byte) ((double) color47.R * 0.55); color47.G = (byte) ((double) color47.G * 0.55); color47.B = (byte) ((double) color47.B * 0.55); color47.A = (byte) ((double) color47.A * 0.55); drawData = new DrawData(Main.frozenTexture, new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.frozenTexture.Width, Main.frozenTexture.Height)), color47, drawPlayer.bodyRotation, new Vector2((float) (Main.frozenTexture.Width / 2), (float) (Main.frozenTexture.Height / 2)), 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); } else if (drawPlayer.webbed && (double) shadow == 0.0 && (double) drawPlayer.velocity.Y == 0.0) { Microsoft.Xna.Framework.Color color48 = color12 * 0.75f; Texture2D texture2D = Main.extraTexture[31]; int num101 = drawPlayer.height / 2; drawData = new DrawData(texture2D, new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0 + (double) num101)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(), color48, drawPlayer.bodyRotation, texture2D.Size() / 2f, 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); } if (drawPlayer.electrified && (double) shadow == 0.0) { Texture2D texture = Main.glowMaskTexture[25]; int num102 = drawPlayer.miscCounter / 5; for (int index43 = 0; index43 < 2; ++index43) { int num103 = num102 % 7; if (num103 > 1 && num103 < 5) { drawData = new DrawData(texture, new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, num103 * texture.Height / 7, texture.Width, texture.Height / 7)), color14, drawPlayer.bodyRotation, new Vector2((float) (texture.Width / 2), (float) (texture.Height / 14)), 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); } num102 = num103 + 3; } } if (drawPlayer.iceBarrier && (double) shadow == 0.0) { int height = this.iceBarrierTexture.Height / 12; Microsoft.Xna.Framework.Color white = Microsoft.Xna.Framework.Color.White; drawData = new DrawData(this.iceBarrierTexture, new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X - (double) (drawPlayer.bodyFrame.Width / 2) + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - (double) drawPlayer.bodyFrame.Height + 4.0)) + drawPlayer.bodyPosition + new Vector2((float) (drawPlayer.bodyFrame.Width / 2), (float) (drawPlayer.bodyFrame.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, height * (int) drawPlayer.iceBarrierFrame, this.iceBarrierTexture.Width, height)), white, 0.0f, new Vector2((float) (Main.frozenTexture.Width / 2), (float) (Main.frozenTexture.Height / 2)), 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); } if ((double) shadow == 0.0 && (byte) drawPlayer.ownedLargeGems > (byte) 0) { bool flag11 = false; BitsByte ownedLargeGems = drawPlayer.ownedLargeGems; float num104 = 0.0f; for (int key = 0; key < 7; ++key) { if (ownedLargeGems[key]) ++num104; } float num105 = (float) (1.0 - (double) num104 * 0.0599999986588955); float num106 = (float) (((double) num104 - 1.0) * 4.0); switch (num104) { case 2f: num106 += 10f; break; case 3f: num106 += 8f; break; case 4f: num106 += 6f; break; case 5f: num106 += 6f; break; case 6f: num106 += 2f; break; case 7f: num106 += 0.0f; break; } float num107 = (float) ((double) drawPlayer.miscCounter / 300.0 * 6.28318548202515); if ((double) num104 > 0.0) { float num108 = 6.283185f / num104; float num109 = 0.0f; Vector2 vector2_24 = new Vector2(1.3f, 0.65f); if (!flag11) vector2_24 = Vector2.One; List drawDataList = new List(); for (int key = 0; key < 7; ++key) { if (!ownedLargeGems[key]) { ++num109; } else { Vector2 rotationVector2 = (num107 + num108 * ((float) key - num109)).ToRotationVector2(); float num110 = num105; if (flag11) num110 = MathHelper.Lerp(num105 * 0.7f, 1f, (float) ((double) rotationVector2.Y / 2.0 + 0.5)); Texture2D texture2D = Main.gemTexture[key]; drawData = new DrawData(texture2D, new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) drawPlayer.height - 80.0)) + rotationVector2 * vector2_24 * num106, new Microsoft.Xna.Framework.Rectangle?(), new Microsoft.Xna.Framework.Color(250, 250, 250, (int) Main.mouseTextColor / 2), 0.0f, texture2D.Size() / 2f, (float) ((double) Main.mouseTextColor / 1000.0 + 0.800000011920929) * num110, SpriteEffects.None, 0); drawDataList.Add(drawData); } } if (flag11) drawDataList.Sort(new Comparison(DelegateMethods.CompareDrawSorterByYScale)); Main.playerDrawData.AddRange((IEnumerable) drawDataList); } } if ((drawPlayer.beetleOffense || drawPlayer.beetleDefense) && (double) shadow == 0.0) { for (int index44 = 0; index44 < drawPlayer.beetleOrbs; ++index44) { for (int index45 = 0; index45 < 5; ++index45) { Microsoft.Xna.Framework.Color color49 = color12; float num111 = 0.5f - (float) index45 * 0.1f; color49.R = (byte) ((double) color49.R * (double) num111); color49.G = (byte) ((double) color49.G * (double) num111); color49.B = (byte) ((double) color49.B * (double) num111); color49.A = (byte) ((double) color49.A * (double) num111); Vector2 vector2_25 = -drawPlayer.beetleVel[index44] * (float) index45; drawData = new DrawData(Main.beetleTexture, new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) (drawPlayer.height / 2))) + drawPlayer.beetlePos[index44] + vector2_25, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.beetleTexture.Height / 3 * drawPlayer.beetleFrame + 1, Main.beetleTexture.Width, Main.beetleTexture.Height / 3 - 2)), color49, 0.0f, new Vector2((float) (Main.beetleTexture.Width / 2), (float) (Main.beetleTexture.Height / 6)), 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); } drawData = new DrawData(Main.beetleTexture, new Vector2((float) (int) ((double) Position.X - (double) Main.screenPosition.X + (double) (drawPlayer.width / 2)), (float) (int) ((double) Position.Y - (double) Main.screenPosition.Y + (double) (drawPlayer.height / 2))) + drawPlayer.beetlePos[index44], new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.beetleTexture.Height / 3 * drawPlayer.beetleFrame + 1, Main.beetleTexture.Width, Main.beetleTexture.Height / 3 - 2)), color12, 0.0f, new Vector2((float) (Main.beetleTexture.Width / 2), (float) (Main.beetleTexture.Height / 6)), 1f, spriteEffects, 0); Main.playerDrawData.Add(drawData); } } if ((double) rotation != 0.0) { Vector2 vector2_26 = Position - Main.screenPosition + rotationOrigin; Vector2 vector2_27 = drawPlayer.position + rotationOrigin; Matrix rotationZ = Matrix.CreateRotationZ(rotation); for (int index46 = 0; index46 < Main.playerDrawDust.Count; ++index46) { Vector2 vector2_28 = Vector2.Transform(Main.dust[Main.playerDrawDust[index46]].position - vector2_27, rotationZ); Main.dust[Main.playerDrawDust[index46]].position = vector2_28 + vector2_27; } for (int index47 = 0; index47 < Main.playerDrawGore.Count; ++index47) { Vector2 vector2_29 = Vector2.Transform(Main.gore[Main.playerDrawGore[index47]].position - vector2_27, rotationZ); Main.gore[Main.playerDrawGore[index47]].position = vector2_29 + vector2_27; } for (int index48 = 0; index48 < Main.playerDrawData.Count; ++index48) { drawData = Main.playerDrawData[index48]; if (!drawData.ignorePlayerRotation) { Vector2 vector2_30 = Vector2.Transform(drawData.position - vector2_26, rotationZ); drawData.position = vector2_30 + vector2_26; drawData.rotation += rotation; Main.playerDrawData[index48] = drawData; } } } this.DrawPlayer_DrawAllLayers(drawPlayer, projectileDrawPosition, cHead); Main.pixelShader.CurrentTechnique.Passes[0].Apply(); if (!drawPlayer.mount.Active || drawPlayer.mount.Type != 11) return; for (int i2 = 0; i2 < 1000; ++i2) { if (Main.projectile[i2].active && Main.projectile[i2].owner == drawPlayer.whoAmI && Main.projectile[i2].type == 591) Main.instance.DrawProj(i2); } } private void DrawPlayer_DrawAllLayers(Player drawPlayer, int projectileDrawPosition, int cHead) { int num = -1; for (int index = 0; index <= Main.playerDrawData.Count; ++index) { if (projectileDrawPosition == index) { if (num != 0) { Main.pixelShader.CurrentTechnique.Passes[0].Apply(); num = 0; } Main.projectile[drawPlayer.heldProj].gfxOffY = drawPlayer.gfxOffY; try { this.DrawProj(drawPlayer.heldProj); } catch { Main.projectile[drawPlayer.heldProj].active = false; } } if (index != Main.playerDrawData.Count) { DrawData drawData = Main.playerDrawData[index]; if (!drawData.sourceRect.HasValue) drawData.sourceRect = new Microsoft.Xna.Framework.Rectangle?(drawData.texture.Frame()); if (drawData.shader >= 0) { GameShaders.Hair.Apply((short) 0, drawPlayer, new DrawData?(drawData)); GameShaders.Armor.Apply(drawData.shader, (Entity) drawPlayer, new DrawData?(drawData)); } else if (drawPlayer.head == 0) { GameShaders.Hair.Apply((short) 0, drawPlayer, new DrawData?(drawData)); GameShaders.Armor.Apply(cHead, (Entity) drawPlayer, new DrawData?(drawData)); } else { GameShaders.Armor.Apply(0, (Entity) drawPlayer, new DrawData?(drawData)); GameShaders.Hair.Apply((short) -drawData.shader, drawPlayer, new DrawData?(drawData)); } num = drawData.shader; if (drawData.texture != null) drawData.Draw(Main.spriteBatch); } } } protected void DrawItem(Item item, int whoami) { int num1 = (int) ((double) item.position.X + (double) item.width * 0.5) / 16; int firstTileX = this.firstTileX; int offScreenTiles1 = Lighting.offScreenTiles; int num2 = (int) ((double) item.position.Y + (double) item.height * 0.5) / 16; int firstTileY = this.firstTileY; int offScreenTiles2 = Lighting.offScreenTiles; Microsoft.Xna.Framework.Color color = Lighting.GetColor((int) ((double) item.position.X + (double) item.width * 0.5) / 16, (int) ((double) item.position.Y + (double) item.height * 0.5) / 16); if (!Main.gamePaused && this.IsActive && item.type >= 71 && item.type <= 74 && (double) Math.Abs(item.velocity.X) + (double) Math.Abs(item.velocity.Y) > 0.2) { float num3 = (float) Main.rand.Next(500) - (float) (((double) Math.Abs(item.velocity.X) + (double) Math.Abs(item.velocity.Y)) * 20.0) - (float) ((item.type - 72) * 20); int Type = 244 + item.type - 71; if (item.isBeingGrabbed) num3 /= 100f; if ((double) num3 < (double) ((int) color.R / 70 + 1)) { int index = Dust.NewDust(item.position - new Vector2(1f, 2f), item.width, item.height, Type, Alpha: 254, Scale: 0.25f); Main.dust[index].velocity *= 0.0f; } } float rotation = item.velocity.X * 0.2f; float scale = 1f; Microsoft.Xna.Framework.Color alpha = item.GetAlpha(color); ItemSlot.GetItemLight(ref alpha, ref scale, item); float num4 = (float) (item.height - Main.itemTexture[item.type].Height); float num5 = (float) (item.width / 2 - Main.itemTexture[item.type].Width / 2); if (item.type >= 71 && item.type <= 74) { int index = item.type - 71; ++Main.itemFrameCounter[whoami]; if (Main.itemFrameCounter[whoami] > 5) { Main.itemFrameCounter[whoami] = 0; ++Main.itemFrame[whoami]; } if (Main.itemFrame[whoami] > 7) Main.itemFrame[whoami] = 0; int width = Main.coinTexture[index].Width; int height = Main.coinTexture[index].Height / 8; float num6 = (float) (item.width / 2 - Main.coinTexture[index].Width / 2); Main.spriteBatch.Draw(Main.coinTexture[index], new Vector2(item.position.X - Main.screenPosition.X + (float) (width / 2) + num6, item.position.Y - Main.screenPosition.Y + (float) (height / 2) + num4), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.itemFrame[whoami] * height + 1, Main.itemTexture[item.type].Width, height)), alpha, rotation, new Vector2((float) (width / 2), (float) (height / 2)), scale, SpriteEffects.None, 0.0f); } else if (ItemID.Sets.NebulaPickup[item.type]) { ++Main.itemFrameCounter[whoami]; if (Main.itemFrameCounter[whoami] > 5) { Main.itemFrameCounter[whoami] = 0; ++Main.itemFrame[whoami]; } if (Main.itemFrame[whoami] >= 4) Main.itemFrame[whoami] = 0; Microsoft.Xna.Framework.Rectangle r = Main.itemTexture[item.type].Frame(verticalFrames: 4, frameY: Main.itemFrame[whoami]); float num7 = (float) (item.width / 2 - r.Width / 2); float num8 = (float) (item.height - r.Height); Main.spriteBatch.Draw(Main.itemTexture[item.type], new Vector2(item.position.X - Main.screenPosition.X + (float) (r.Width / 2) + num7, item.position.Y - Main.screenPosition.Y + (float) (r.Height / 2) + num8), new Microsoft.Xna.Framework.Rectangle?(r), alpha, rotation, r.Size() / 2f, scale, SpriteEffects.None, 0.0f); } else if (ItemID.Sets.AnimatesAsSoul[item.type]) { ++Main.itemFrameCounter[whoami]; if (Main.itemFrameCounter[whoami] > 5) { Main.itemFrameCounter[whoami] = 0; ++Main.itemFrame[whoami]; } if (Main.itemFrame[whoami] >= 4) Main.itemFrame[whoami] = 0; Microsoft.Xna.Framework.Rectangle r = Main.itemTexture[item.type].Frame(verticalFrames: 4, frameY: Main.itemFrame[whoami]); float num9 = (float) (item.width / 2 - r.Width / 2); float num10 = (float) (item.height - r.Height); Main.spriteBatch.Draw(Main.itemTexture[item.type], new Vector2(item.position.X - Main.screenPosition.X + (float) (r.Width / 2) + num9, item.position.Y - Main.screenPosition.Y + (float) (r.Height / 2) + num10), new Microsoft.Xna.Framework.Rectangle?(r), alpha, rotation, r.Size() / 2f, scale, SpriteEffects.None, 0.0f); } else if (item.type == 3858) { ++Main.itemFrameCounter[whoami]; if (Main.itemFrameCounter[whoami] >= 5) { Main.itemFrameCounter[whoami] = 0; ++Main.itemFrame[whoami]; } if (Main.itemFrame[whoami] >= 3) Main.itemFrame[whoami] = 0; Texture2D texture2D = Main.glowMaskTexture[233]; Microsoft.Xna.Framework.Rectangle r = texture2D.Frame(verticalFrames: 3, frameY: Main.itemFrame[whoami]); float num11 = (float) (item.width / 2 - r.Width / 2); float num12 = (float) (item.height - r.Height); Main.spriteBatch.Draw(Main.itemTexture[item.type], new Vector2(item.position.X - Main.screenPosition.X + (float) (r.Width / 2) + num11, item.position.Y - Main.screenPosition.Y + (float) (r.Height / 2) + num12), new Microsoft.Xna.Framework.Rectangle?(), alpha, rotation, r.Size() / 2f, scale, SpriteEffects.None, 0.0f); float num13 = num11 - 2f; float num14 = num12 - 2f; Main.spriteBatch.Draw(texture2D, new Vector2(item.position.X - Main.screenPosition.X + (float) (r.Width / 2) + num13, item.position.Y - Main.screenPosition.Y + (float) (r.Height / 2) + num14), new Microsoft.Xna.Framework.Rectangle?(r), new Microsoft.Xna.Framework.Color((int) byte.MaxValue, (int) byte.MaxValue, (int) byte.MaxValue, 63) * 0.75f, rotation, r.Size() / 2f, scale, SpriteEffects.None, 0.0f); } else if (ItemID.Sets.TrapSigned[item.type]) { Main.spriteBatch.Draw(Main.itemTexture[item.type], new Vector2(item.position.X - Main.screenPosition.X + (float) (Main.itemTexture[item.type].Width / 2) + num5, (float) ((double) item.position.Y - (double) Main.screenPosition.Y + (double) (Main.itemTexture[item.type].Height / 2) + (double) num4 + 2.0)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), alpha, rotation, new Vector2((float) (Main.itemTexture[item.type].Width / 2), (float) (Main.itemTexture[item.type].Height / 2)), scale, SpriteEffects.None, 0.0f); if (item.color != new Microsoft.Xna.Framework.Color()) Main.spriteBatch.Draw(Main.itemTexture[item.type], new Vector2(item.position.X - Main.screenPosition.X + (float) (Main.itemTexture[item.type].Width / 2) + num5, (float) ((double) item.position.Y - (double) Main.screenPosition.Y + (double) (Main.itemTexture[item.type].Height / 2) + (double) num4 + 2.0)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), item.GetColor(color), rotation, new Vector2((float) (Main.itemTexture[item.type].Width / 2), (float) (Main.itemTexture[item.type].Height / 2)), scale, SpriteEffects.None, 0.0f); if (item.glowMask != (short) -1) Main.spriteBatch.Draw(Main.glowMaskTexture[(int) item.glowMask], new Vector2(item.position.X - Main.screenPosition.X + (float) (Main.itemTexture[item.type].Width / 2) + num5, (float) ((double) item.position.Y - (double) Main.screenPosition.Y + (double) (Main.itemTexture[item.type].Height / 2) + (double) num4 + 2.0)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), new Microsoft.Xna.Framework.Color(250, 250, 250, item.alpha), rotation, new Vector2((float) (Main.itemTexture[item.type].Width / 2), (float) (Main.itemTexture[item.type].Height / 2)), scale, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(Main.wireTexture, new Vector2(item.position.X - Main.screenPosition.X + (float) (Main.itemTexture[item.type].Width / 2) + num5, (float) ((double) item.position.Y - (double) Main.screenPosition.Y + (double) (Main.itemTexture[item.type].Height / 2) + (double) num4 + 2.0)) + Main.itemTexture[item.type].Size().RotatedBy((double) rotation) * 0.45f * item.scale, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(4, 58, 8, 8)), alpha, 0.0f, new Vector2(4f), 1f, SpriteEffects.None, 0.0f); } else if (item.type >= 1522 && item.type <= 1527 || item.type == 3643) Main.spriteBatch.Draw(Main.itemTexture[item.type], new Vector2(item.position.X - Main.screenPosition.X + (float) (Main.itemTexture[item.type].Width / 2) + num5, (float) ((double) item.position.Y - (double) Main.screenPosition.Y + (double) (Main.itemTexture[item.type].Height / 2) + (double) num4 + 2.0)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), new Microsoft.Xna.Framework.Color(250, 250, 250, (int) Main.mouseTextColor / 2), rotation, new Vector2((float) (Main.itemTexture[item.type].Width / 2), (float) (Main.itemTexture[item.type].Height / 2)), (float) ((double) Main.mouseTextColor / 1000.0 + 0.800000011920929), SpriteEffects.None, 0.0f); else if (item.type == 3779) { Main.spriteBatch.Draw(Main.itemTexture[item.type], new Vector2(item.position.X - Main.screenPosition.X + (float) (Main.itemTexture[item.type].Width / 2) + num5, (float) ((double) item.position.Y - (double) Main.screenPosition.Y + (double) (Main.itemTexture[item.type].Height / 2) + (double) num4 + 2.0)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), alpha, rotation, new Vector2((float) (Main.itemTexture[item.type].Width / 2), (float) (Main.itemTexture[item.type].Height / 2)), scale, SpriteEffects.None, 0.0f); } else { Main.spriteBatch.Draw(Main.itemTexture[item.type], new Vector2(item.position.X - Main.screenPosition.X + (float) (Main.itemTexture[item.type].Width / 2) + num5, (float) ((double) item.position.Y - (double) Main.screenPosition.Y + (double) (Main.itemTexture[item.type].Height / 2) + (double) num4 + 2.0)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), alpha, rotation, new Vector2((float) (Main.itemTexture[item.type].Width / 2), (float) (Main.itemTexture[item.type].Height / 2)), scale, SpriteEffects.None, 0.0f); if (item.color != new Microsoft.Xna.Framework.Color()) Main.spriteBatch.Draw(Main.itemTexture[item.type], new Vector2(item.position.X - Main.screenPosition.X + (float) (Main.itemTexture[item.type].Width / 2) + num5, (float) ((double) item.position.Y - (double) Main.screenPosition.Y + (double) (Main.itemTexture[item.type].Height / 2) + (double) num4 + 2.0)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), item.GetColor(color), rotation, new Vector2((float) (Main.itemTexture[item.type].Width / 2), (float) (Main.itemTexture[item.type].Height / 2)), scale, SpriteEffects.None, 0.0f); if (item.glowMask == (short) -1) return; Main.spriteBatch.Draw(Main.glowMaskTexture[(int) item.glowMask], new Vector2(item.position.X - Main.screenPosition.X + (float) (Main.itemTexture[item.type].Width / 2) + num5, (float) ((double) item.position.Y - (double) Main.screenPosition.Y + (double) (Main.itemTexture[item.type].Height / 2) + (double) num4 + 2.0)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[item.type].Width, Main.itemTexture[item.type].Height)), new Microsoft.Xna.Framework.Color(250, 250, 250, item.alpha), rotation, new Vector2((float) (Main.itemTexture[item.type].Width / 2), (float) (Main.itemTexture[item.type].Height / 2)), scale, SpriteEffects.None, 0.0f); } } protected void DrawRain() { 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); for (int index = 0; index < Main.maxRain; ++index) { if (Main.rain[index].active) { Rain rain = Main.rain[index]; Main.spriteBatch.Draw(Main.rainTexture, rain.position - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(rectangleArray[(int) rain.type]), Lighting.GetColor((int) ((double) rain.position.X + 4.0) >> 4, (int) ((double) rain.position.Y + 4.0) >> 4) * 0.85f, rain.rotation, Vector2.Zero, rain.scale, SpriteEffects.None, 0.0f); if (isActive) 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) 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(Main.dustTexture, 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 >= 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 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(Main.dustTexture, vector2 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(dust.frame), alpha, dust.rotation, new Vector2(4f, 4f), scale3, 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 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 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(Main.dustTexture, vector2 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(dust.frame), color2, dust.rotation, new Vector2(5f), scale4, SpriteEffects.None, 0.0f); Microsoft.Xna.Framework.Color color3 = dust.GetColor(color2); Main.spriteBatch.Draw(Main.dustTexture, vector2 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(dust.frame), color3, dust.rotation, new Vector2(5f), scale4, 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 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 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(Main.dustTexture, vector2 - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(dust.frame), alpha, dust.rotation, new Vector2(4f, 4f), scale5, 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.noLight && dust.type < 86 && dust.type > 91 || 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(Main.dustTexture, 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 != new Microsoft.Xna.Framework.Color()) Main.spriteBatch.Draw(Main.dustTexture, dust.position - Main.screenPosition, new Microsoft.Xna.Framework.Rectangle?(dust.frame), dust.GetColor(alpha1), 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 > 0) flag2 = true; bool flag3 = true; bool flag4 = false; bool flag5 = false; bool flag6 = false; bool flag7 = false; bool flag8 = false; bool flag9 = 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) 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) 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) flag8 = true; if (Main.player[Main.myPlayer].inventory[index].type == 84) flag9 = true; } bool flag10 = false; bool flag11 = false; bool flag12 = false; bool flag13 = false; bool flag14 = false; bool flag15 = false; bool flag16 = false; bool flag17 = false; bool flag18 = false; for (int index = 0; index < 200; ++index) { if (Main.npc[index].active) { if (Main.npc[index].type == 17) flag10 = true; if (Main.npc[index].type == 18) flag11 = true; if (Main.npc[index].type == 19) flag13 = true; if (Main.npc[index].type == 20) flag12 = true; if (Main.npc[index].type == 54) flag18 = true; if (Main.npc[index].type == 124) flag15 = true; if (Main.npc[index].type == 38) flag14 = true; if (Main.npc[index].type == 108) flag16 = true; if (Main.npc[index].type == 107) flag17 = 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 (!flag10 && !flag11) { 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 (!flag10 && Main.helpText == 61) { Main.npcChatText = Lang.dialog(195); return; } if (!flag11 && Main.helpText == 62) { Main.npcChatText = Lang.dialog(196); return; } if (!flag13 && Main.helpText == 63) { Main.npcChatText = Lang.dialog(197); return; } if (!flag12 && Main.helpText == 64) { Main.npcChatText = Lang.dialog(198); return; } if (!flag15 && Main.helpText == 65 && NPC.downedBoss3) { Main.npcChatText = Lang.dialog(199); return; } if (!flag18 && Main.helpText == 66 && NPC.downedBoss3) { Main.npcChatText = Lang.dialog(200); return; } if (!flag14 && Main.helpText == 67) { Main.npcChatText = Lang.dialog(201); return; } if (!flag17 && NPC.downedBoss2 && Main.helpText == 68) { Main.npcChatText = Lang.dialog(202); return; } if (!flag16 && Main.hardMode && Main.helpText == 69) { Main.npcChatText = Lang.dialog(203); return; } if (flag7 && Main.helpText == 71) { Main.npcChatText = Lang.dialog(204); return; } if (flag8 && Main.helpText == 72) { Main.npcChatText = Lang.dialog(WorldGen.crimson ? 403 : 205); return; } if (flag7 | flag8 && Main.helpText == 80) { Main.npcChatText = Lang.dialog(WorldGen.crimson ? 402 : 206); return; } if (!flag9 && Main.helpText == 201 && !Main.hardMode && !NPC.downedBoss3 && !NPC.downedBoss2) { Main.npcChatText = Lang.dialog(207); 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(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 && Main.player[Main.myPlayer].statLifeMax >= 300) { Main.npcChatText = Lang.dialog(215); return; } if (Main.helpText == 1055 && NPC.downedBoss1 && !NPC.downedBoss2 && 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) { Main.npcChatText = Lang.dialog(WorldGen.crimson ? 401 : 222); return; } if (Main.helpText == 1062 && Main.hardMode) { Main.npcChatText = Lang.dialog(223); return; } } while (Main.helpText <= 1100); Main.helpText = 0; } } protected void GUIChatDrawInner() { if (Main.player[Main.myPlayer].talkNPC < 0 && Main.player[Main.myPlayer].sign == -1) { Main.npcChatText = ""; } else { if (Main.netMode == 0 && Main.autoPause && Main.player[Main.myPlayer].talkNPC >= 0) { if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 105) Main.npc[Main.player[Main.myPlayer].talkNPC].Transform(107); if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 106) Main.npc[Main.player[Main.myPlayer].talkNPC].Transform(108); if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 123) Main.npc[Main.player[Main.myPlayer].talkNPC].Transform(124); if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 354) Main.npc[Main.player[Main.myPlayer].talkNPC].Transform(353); if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 376) Main.npc[Main.player[Main.myPlayer].talkNPC].Transform(369); if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 579) Main.npc[Main.player[Main.myPlayer].talkNPC].Transform(550); } 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 flag = Main.InGameUI.CurrentState is UIVirtualKeyboard && PlayerInput.UsingGamepad; int lineAmount; string[] strArray = Utils.WordwrapString(Main.npcChatText, Main.fontMouseText, 460, 10, out lineAmount); if (Main.editSign) { ++this.textBlinkerCount; if (this.textBlinkerCount >= 20) { this.textBlinkerState = this.textBlinkerState != 0 ? 0 : 1; this.textBlinkerCount = 0; } if (this.textBlinkerState == 1) { // ISSUE: explicit reference operation ^ref strArray[lineAmount] += "|"; } Main.instance.DrawWindowsIMEPanel(new Vector2((float) (Main.screenWidth / 2), 90f), 0.5f); } ++lineAmount; Main.spriteBatch.Draw(Main.chatBackTexture, new Vector2((float) (Main.screenWidth / 2 - Main.chatBackTexture.Width / 2), 100f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chatBackTexture.Width, (lineAmount + 1) * 30)), color1, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(Main.chatBackTexture, new Vector2((float) (Main.screenWidth / 2 - Main.chatBackTexture.Width / 2), (float) (100 + (lineAmount + 1) * 30)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.chatBackTexture.Height - 30, Main.chatBackTexture.Width, 30)), color1, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); for (int index = 0; index < lineAmount; ++index) { if (strArray[index] != null) Utils.DrawBorderStringFourWay(Main.spriteBatch, Main.fontMouseText, strArray[index], (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 - Main.chatBackTexture.Width / 2, 100, Main.chatBackTexture.Width, (lineAmount + 2) * 30); int num2 = 120 + lineAmount * 30 + 30 - 235; if (!PlayerInput.UsingGamepad) num2 = 9999; UIVirtualKeyboard.OffsetDown = num2; if (Main.npcChatCornerItem != 0) { Vector2 position = new Vector2((float) (Main.screenWidth / 2 + Main.chatBackTexture.Width / 2), (float) (100 + (lineAmount + 1) * 30 + 30)) - Vector2.One * 8f; Item obj = new Item(); obj.netDefaults(Main.npcChatCornerItem); float scale = 1f; Texture2D texture = Main.itemTexture[obj.type]; 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] > 5 && index2 != 28 && index2 != 34 && index2 != 87 && index2 != 89 && index2 != 21 && index2 != 86 && index2 != 199) num3 += 1000; } 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 (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 207) { focusText = Lang.inter[28].Value; 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 == 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 == 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 == 208 || 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 str1 = ""; int num4 = 0; int num5 = 0; int num6 = 0; int num7 = 0; int num8 = Main.player[Main.myPlayer].taxMoney; if (num8 < 0) num8 = 0; num3 = num8; if (num8 >= 1000000) { num4 = num8 / 1000000; num8 -= num4 * 1000000; } if (num8 >= 10000) { num5 = num8 / 10000; num8 -= num5 * 10000; } if (num8 >= 100) { num6 = num8 / 100; num8 -= num6 * 100; } if (num8 >= 1) num7 = num8; if (num4 > 0) str1 = str1 + (object) num4 + " " + Lang.inter[15].Value + " "; if (num5 > 0) str1 = str1 + (object) num5 + " " + Lang.inter[16].Value + " "; if (num6 > 0) str1 = str1 + (object) num6 + " " + Lang.inter[17].Value + " "; if (num7 > 0) str1 = str1 + (object) num7 + " " + Lang.inter[18].Value + " "; float num9 = (float) Main.mouseTextColor / (float) byte.MaxValue; if (num4 > 0) color2 = new Microsoft.Xna.Framework.Color((int) (byte) (220.0 * (double) num9), (int) (byte) (220.0 * (double) num9), (int) (byte) (198.0 * (double) num9), (int) Main.mouseTextColor); else if (num5 > 0) color2 = new Microsoft.Xna.Framework.Color((int) (byte) (224.0 * (double) num9), (int) (byte) (201.0 * (double) num9), (int) (byte) (92.0 * (double) num9), (int) Main.mouseTextColor); else if (num6 > 0) color2 = new Microsoft.Xna.Framework.Color((int) (byte) (181.0 * (double) num9), (int) (byte) (192.0 * (double) num9), (int) (byte) (193.0 * (double) num9), (int) Main.mouseTextColor); else if (num7 > 0) color2 = new Microsoft.Xna.Framework.Color((int) (byte) (246.0 * (double) num9), (int) (byte) (138.0 * (double) num9), (int) (byte) (96.0 * (double) num9), (int) Main.mouseTextColor); if (str1 == "") { focusText = Lang.inter[89].Value; } else { string str2 = str1.Substring(0, str1.Length - 1); focusText = Lang.inter[89].Value + " (" + str2 + ")"; } } } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 18) { string str3 = ""; int num10 = 0; int num11 = 0; int num12 = 0; int num13 = 0; int num14 = num3; if (num14 > 0) { num14 = (int) ((double) num14 * 0.75); if (num14 < 1) num14 = 1; } if (num14 < 0) num14 = 0; num3 = num14; if (num14 >= 1000000) { num10 = num14 / 1000000; num14 -= num10 * 1000000; } if (num14 >= 10000) { num11 = num14 / 10000; num14 -= num11 * 10000; } if (num14 >= 100) { num12 = num14 / 100; num14 -= num12 * 100; } if (num14 >= 1) num13 = num14; if (num10 > 0) str3 = str3 + (object) num10 + " " + Lang.inter[15].Value + " "; if (num11 > 0) str3 = str3 + (object) num11 + " " + Lang.inter[16].Value + " "; if (num12 > 0) str3 = str3 + (object) num12 + " " + Lang.inter[17].Value + " "; if (num13 > 0) str3 = str3 + (object) num13 + " " + Lang.inter[18].Value + " "; float num15 = (float) Main.mouseTextColor / (float) byte.MaxValue; if (num10 > 0) color2 = new Microsoft.Xna.Framework.Color((int) (byte) (220.0 * (double) num15), (int) (byte) (220.0 * (double) num15), (int) (byte) (198.0 * (double) num15), (int) Main.mouseTextColor); else if (num11 > 0) color2 = new Microsoft.Xna.Framework.Color((int) (byte) (224.0 * (double) num15), (int) (byte) (201.0 * (double) num15), (int) (byte) (92.0 * (double) num15), (int) Main.mouseTextColor); else if (num12 > 0) color2 = new Microsoft.Xna.Framework.Color((int) (byte) (181.0 * (double) num15), (int) (byte) (192.0 * (double) num15), (int) (byte) (193.0 * (double) num15), (int) Main.mouseTextColor); else if (num13 > 0) color2 = new Microsoft.Xna.Framework.Color((int) (byte) (246.0 * (double) num15), (int) (byte) (138.0 * (double) num15), (int) (byte) (96.0 * (double) num15), (int) Main.mouseTextColor); if (str3 == "") { focusText = Lang.inter[54].Value; } else { string str4 = str3.Substring(0, str3.Length - 1); focusText = Lang.inter[54].Value + " (" + str4 + ")"; } } if (!flag) Main.DrawNPCChatButtons(mouseTextColor, color2, lineAmount, focusText, focusText3); 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 (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 369) { Main.npcChatCornerItem = 0; Main.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; Main.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) { Main.playerInventory = true; Main.npcChatText = ""; Main.npcShop = 1; this.shop[Main.npcShop].SetupShop(Main.npcShop); Main.PlaySound(12); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 19) { Main.playerInventory = true; Main.npcChatText = ""; Main.npcShop = 2; this.shop[Main.npcShop].SetupShop(Main.npcShop); Main.PlaySound(12); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 124) { Main.playerInventory = true; Main.npcChatText = ""; Main.npcShop = 8; this.shop[Main.npcShop].SetupShop(Main.npcShop); Main.PlaySound(12); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 142) { Main.playerInventory = true; Main.npcChatText = ""; Main.npcShop = 9; this.shop[Main.npcShop].SetupShop(Main.npcShop); Main.PlaySound(12); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 353) { Main.playerInventory = true; Main.npcChatText = ""; Main.npcShop = 18; this.shop[Main.npcShop].SetupShop(Main.npcShop); Main.PlaySound(12); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 368) { Main.playerInventory = true; Main.npcChatText = ""; Main.npcShop = 19; this.shop[Main.npcShop].SetupShop(Main.npcShop); Main.PlaySound(12); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 453) { Main.playerInventory = true; Main.npcChatText = ""; Main.npcShop = 20; this.shop[Main.npcShop].SetupShop(Main.npcShop); Main.PlaySound(12); } 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) { Main.playerInventory = true; Main.npcChatText = ""; Main.npcShop = 3; this.shop[Main.npcShop].SetupShop(Main.npcShop); Main.PlaySound(12); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 38) { Main.playerInventory = true; Main.npcChatText = ""; Main.npcShop = 4; this.shop[Main.npcShop].SetupShop(Main.npcShop); Main.PlaySound(12); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 54) { Main.playerInventory = true; Main.npcChatText = ""; Main.npcShop = 5; this.shop[Main.npcShop].SetupShop(Main.npcShop); Main.PlaySound(12); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 107) { Main.playerInventory = true; Main.npcChatText = ""; Main.npcShop = 6; this.shop[Main.npcShop].SetupShop(Main.npcShop); Main.PlaySound(12); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 108) { Main.playerInventory = true; Main.npcChatText = ""; Main.npcShop = 7; this.shop[Main.npcShop].SetupShop(Main.npcShop); Main.PlaySound(12); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 160) { Main.playerInventory = true; Main.npcChatText = ""; Main.npcShop = 10; this.shop[Main.npcShop].SetupShop(Main.npcShop); Main.PlaySound(12); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 178) { Main.playerInventory = true; Main.npcChatText = ""; Main.npcShop = 11; this.shop[Main.npcShop].SetupShop(Main.npcShop); Main.PlaySound(12); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 207) { Main.playerInventory = true; Main.npcChatText = ""; Main.npcShop = 12; this.shop[Main.npcShop].SetupShop(Main.npcShop); Main.PlaySound(12); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 208) { Main.playerInventory = true; Main.npcChatText = ""; Main.npcShop = 13; this.shop[Main.npcShop].SetupShop(Main.npcShop); Main.PlaySound(12); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 209) { Main.playerInventory = true; Main.npcChatText = ""; Main.npcShop = 14; this.shop[Main.npcShop].SetupShop(Main.npcShop); Main.PlaySound(12); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 227) { Main.playerInventory = true; Main.npcChatText = ""; Main.npcShop = 15; this.shop[Main.npcShop].SetupShop(Main.npcShop); Main.PlaySound(12); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 228) { Main.playerInventory = true; Main.npcChatText = ""; Main.npcShop = 16; this.shop[Main.npcShop].SetupShop(Main.npcShop); Main.PlaySound(12); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 229) { Main.playerInventory = true; Main.npcChatText = ""; Main.npcShop = 17; this.shop[Main.npcShop].SetupShop(Main.npcShop); Main.PlaySound(12); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 22) { Main.PlaySound(12); Main.HelpText(); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 441) { if (Main.player[Main.myPlayer].taxMoney > 0) { int taxMoney = Main.player[Main.myPlayer].taxMoney; while (taxMoney > 0) { if (taxMoney > 1000000) { int Stack = taxMoney / 1000000; taxMoney -= 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 (taxMoney > 10000) { int Stack = taxMoney / 10000; taxMoney -= 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 (taxMoney > 100) { int Stack = taxMoney / 100; taxMoney -= 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 = taxMoney; if (Stack < 1) Stack = 1; taxMoney -= 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) { Main.PlaySound(12); if (num3 > 0) { if (Main.player[Main.myPlayer].BuyItem(num3)) { AchievementsHelper.HandleNurseService(num3); Main.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 num16 = Main.rand.Next(3); if (num16 == 0) Main.npcChatText = Lang.dialog(52); if (num16 == 1) Main.npcChatText = Lang.dialog(53); if (num16 != 2) return; Main.npcChatText = Lang.dialog(54); } } else { int num17 = Main.rand.Next(3); if (!ChildSafety.Disabled) num17 = Main.rand.Next(1, 3); switch (num17) { 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.npc[Main.player[Main.myPlayer].talkNPC].type != 550) return; Main.playerInventory = true; Main.npcChatText = ""; Main.npcShop = 21; this.shop[Main.npcShop].SetupShop(Main.npcShop); Main.PlaySound(12); } } else { if (!Main.npcChatFocus3 || Main.player[Main.myPlayer].talkNPC < 0) return; if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 20) { Main.PlaySound(12); Main.npcChatText = Lang.GetDryadWorldStatusDialog(); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 22) { Main.playerInventory = true; Main.npcChatText = ""; Main.PlaySound(12); Main.InGuideCraftMenu = true; UILinkPointNavigator.GoToDefaultPage(); } else if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 107) { Main.playerInventory = true; Main.npcChatText = ""; Main.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; Main.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; Main.PlaySound(24); Main.player[Main.myPlayer].GetDyeTraderReward(); } Main.npcChatText = Lang.DyeTraderQuestChat(gotDye); } else { if (Main.npc[Main.player[Main.myPlayer].talkNPC].type != 550) return; Main.PlaySound(12); Main.HelpText(); Main.npcChatText = Lang.BartenderHelpText(Main.npc[Main.player[Main.myPlayer].talkNPC]); } } } } private static void DrawNPCChatButtons( int superColor, Microsoft.Xna.Framework.Color chatColor, int numLines, string focusText, string focusText3) { float y = (float) (130 + numLines * 30); int num = 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) num, y); string text1 = focusText; DynamicSpriteFont fontMouseText1 = Main.fontMouseText; Vector2 minimum1 = vector2_1; Vector2 baseScale = new Vector2(0.9f); Vector2 stringSize1 = ChatManager.GetStringSize(fontMouseText1, text1, baseScale); Microsoft.Xna.Framework.Color baseColor1 = chatColor; Vector2 vector2_2 = new Vector2(1f); 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 *= 1.1f; if (!Main.npcChatFocus2) Main.PlaySound(12); Main.npcChatFocus2 = true; } else { if (Main.npcChatFocus2) Main.PlaySound(12); Main.npcChatFocus2 = false; } ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, fontMouseText1, 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) num + (double) stringSize1.X * (double) vector2_2.X + 30.0), y); string text2 = Lang.inter[52].Value; DynamicSpriteFont fontMouseText2 = Main.fontMouseText; Vector2 minimum2 = vector2_3; baseScale = new Vector2(0.9f); Vector2 stringSize2 = ChatManager.GetStringSize(fontMouseText2, 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 *= 1.1f; if (!Main.npcChatFocus1) Main.PlaySound(12); Main.npcChatFocus1 = true; } else { if (Main.npcChatFocus1) Main.PlaySound(12); Main.npcChatFocus1 = false; } ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, fontMouseText2, 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)) return; Vector2 vector2_4 = new Vector2((float) ((double) vector2_3.X + (double) stringSize2.X * (double) vector2_2.X + 30.0), y); string text3 = focusText3; DynamicSpriteFont fontMouseText3 = Main.fontMouseText; Vector2 minimum3 = vector2_4; baseScale = new Vector2(0.9f); Vector2 stringSize3 = ChatManager.GetStringSize(fontMouseText3, text3, baseScale); Microsoft.Xna.Framework.Color baseColor2 = chatColor; vector2_2 = new Vector2(1f); if (vec.Between(minimum3, minimum3 + stringSize3 * baseScale * vector2_2.X) && !PlayerInput.IgnoreMouseInterface) { player.mouseInterface = true; player.releaseUseItem = false; baseScale *= 1.1f; if (!Main.npcChatFocus3) Main.PlaySound(12); Main.npcChatFocus3 = true; } else { if (Main.npcChatFocus3) Main.PlaySound(12); Main.npcChatFocus3 = false; } ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, fontMouseText3, text3, minimum3 + stringSize3 * vector2_2 * 0.5f, baseColor2, 0.0f, stringSize3 * 0.5f, baseScale * vector2_2); UILinkPointNavigator.SetPosition(2502, minimum3 + stringSize3 * 0.5f); UILinkPointNavigator.Shortcuts.NPCCHAT_ButtonsRight = true; } private static void DrawNPCChatButtonsOld( int superColor, Microsoft.Xna.Framework.Color chatColor, int numLines, string focusText, string focusText3) { int num1 = 180 + (Main.screenWidth - 800) / 2; int num2 = 130 + numLines * 30; float num3 = 0.9f; Vector2 vector2_1 = new Vector2(0.9f); Vector2 vector2_2 = new Vector2((float) num1, (float) num2); Vector2 vector2_3 = Main.fontMouseText.MeasureString(focusText); if (Main.mouseX > num1 && (double) Main.mouseX < (double) num1 + (double) vector2_3.X && Main.mouseY > num2 && (double) Main.mouseY < (double) num2 + (double) vector2_3.Y && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; num3 = 1.2f; Vector2 vector2_4 = new Vector2(num3); if (!Main.npcChatFocus2) Main.PlaySound(12); Main.npcChatFocus2 = true; Main.player[Main.myPlayer].releaseUseItem = false; } else { if (Main.npcChatFocus2) Main.PlaySound(12); Main.npcChatFocus2 = false; } Vector2 vector2_5 = vector2_3 * 0.5f; float num4 = 1f; if ((double) vector2_3.X > 300.0) num4 *= 300f / vector2_3.X; Vector2 origin1 = vector2_5 * num4; origin1.X *= 0.5f; Utils.DrawBorderStringFourWay(Main.spriteBatch, Main.fontMouseText, focusText, (float) num1 + origin1.X, (float) num2 + origin1.Y, chatColor, Microsoft.Xna.Framework.Color.Black, origin1, num3 * num4); if (focusText.Length > 0) { UILinkPointNavigator.SetPosition(2500, vector2_2 + origin1); UILinkPointNavigator.Shortcuts.NPCCHAT_ButtonsLeft = true; } string text = Lang.inter[52].Value; chatColor = new Microsoft.Xna.Framework.Color(superColor, (int) ((double) superColor / 1.1), superColor / 2, superColor); int num5 = num1 + (int) ((double) Main.fontMouseText.MeasureString(focusText).X * (double) num4) + 20; int num6 = num5 + (int) Main.fontMouseText.MeasureString(text).X; int num7 = 130 + numLines * 30; float scale1 = 0.9f; vector2_2 = new Vector2((float) num5, (float) num7); Vector2 vector2_6 = Main.fontMouseText.MeasureString(text); if (Main.mouseX > num5 && (double) Main.mouseX < (double) num5 + (double) vector2_6.X && Main.mouseY > num7 && (double) Main.mouseY < (double) num7 + (double) vector2_6.Y) { scale1 = 1.1f; if (!Main.npcChatFocus1) Main.PlaySound(12); Main.npcChatFocus1 = true; Main.player[Main.myPlayer].releaseUseItem = false; Main.player[Main.myPlayer].controlUseItem = false; } else { if (Main.npcChatFocus1) Main.PlaySound(12); Main.npcChatFocus1 = false; } Vector2 origin2 = vector2_6 * 0.5f; Utils.DrawBorderStringFourWay(Main.spriteBatch, Main.fontMouseText, text, (float) num5 + origin2.X, (float) num7 + origin2.Y, chatColor, Microsoft.Xna.Framework.Color.Black, origin2, scale1); if (text.Length > 0) { UILinkPointNavigator.SetPosition(2501, vector2_2 + origin2); UILinkPointNavigator.Shortcuts.NPCCHAT_ButtonsMiddle = true; } if (!(focusText3 != "")) return; Main.fontMouseText.MeasureString(focusText3); int num8 = num6 + 20; int num9 = 130 + numLines * 30; float scale2 = 0.9f; vector2_2 = new Vector2((float) num8, (float) num9); Vector2 vector2_7 = Main.fontMouseText.MeasureString(focusText3); if (Main.mouseX > num8 && (double) Main.mouseX < (double) num8 + (double) vector2_7.X && Main.mouseY > num9 && (double) Main.mouseY < (double) num9 + (double) vector2_7.Y && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; scale2 = 1.1f; if (!Main.npcChatFocus3) Main.PlaySound(12); Main.npcChatFocus3 = true; Main.player[Main.myPlayer].releaseUseItem = false; } else { if (Main.npcChatFocus3) Main.PlaySound(12); Main.npcChatFocus3 = false; } Vector2 origin3 = vector2_7 * 0.5f; Utils.DrawBorderStringFourWay(Main.spriteBatch, Main.fontMouseText, focusText3, (float) num8 + origin3.X, (float) num9 + origin3.Y, chatColor, Microsoft.Xna.Framework.Color.Black, origin3, scale2); UILinkPointNavigator.SetPosition(2502, vector2_2 + origin3); UILinkPointNavigator.Shortcuts.NPCCHAT_ButtonsRight = true; } public static void CloseNPCChatOrSign() { Main.player[Main.myPlayer].talkNPC = -1; Main.player[Main.myPlayer].sign = -1; Main.npcChatCornerItem = 0; Main.editSign = false; Main.npcChatText = ""; Main.PlaySound(11); Main.player[Main.myPlayer].releaseMount = false; } public static void SubmitSignText() { Main.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); } public static void MoveCoins(Item[] pInv, Item[] cInv) { int[] numArray1 = new int[4]; List intList1 = new List(); List intList2 = new List(); bool flag = false; int[] numArray2 = new int[40]; for (int index = 0; index < cInv.Length; ++index) { numArray2[index] = -1; if (cInv[index].stack < 1 || cInv[index].type < 1) { intList2.Add(index); cInv[index] = new Item(); } if (cInv[index] != null && cInv[index].stack > 0) { int num = 0; if (cInv[index].type == 71) num = 1; if (cInv[index].type == 72) num = 2; if (cInv[index].type == 73) num = 3; if (cInv[index].type == 74) num = 4; numArray2[index] = num - 1; if (num > 0) { numArray1[num - 1] += cInv[index].stack; intList2.Add(index); cInv[index] = new Item(); flag = true; } } } if (!flag) return; Main.PlaySound(7); for (int index = 0; index < pInv.Length; ++index) { if (index != 58 && pInv[index] != null && pInv[index].stack > 0) { int num = 0; if (pInv[index].type == 71) num = 1; if (pInv[index].type == 72) num = 2; if (pInv[index].type == 73) num = 3; if (pInv[index].type == 74) num = 4; if (num > 0) { numArray1[num - 1] += pInv[index].stack; intList1.Add(index); pInv[index] = new Item(); } } } for (int index = 0; index < 3; ++index) { while (numArray1[index] >= 100) { numArray1[index] -= 100; ++numArray1[index + 1]; } } for (int index1 = 0; index1 < 40; ++index1) { if (numArray2[index1] >= 0 && cInv[index1].type == 0) { int index2 = index1; int index3 = numArray2[index1]; if (numArray1[index3] > 0) { cInv[index2].SetDefaults(71 + index3); cInv[index2].stack = numArray1[index3]; if (cInv[index2].stack > cInv[index2].maxStack) cInv[index2].stack = cInv[index2].maxStack; numArray1[index3] -= cInv[index2].stack; numArray2[index1] = -1; } if (Main.netMode == 1 && Main.player[Main.myPlayer].chest > -1) NetMessage.SendData(32, number: Main.player[Main.myPlayer].chest, number2: ((float) index2)); intList2.Remove(index2); } } for (int index4 = 0; index4 < 40; ++index4) { if (numArray2[index4] >= 0 && cInv[index4].type == 0) { int index5 = index4; for (int index6 = 3; index6 >= 0; --index6) { if (numArray1[index6] > 0) { cInv[index5].SetDefaults(71 + index6); cInv[index5].stack = numArray1[index6]; if (cInv[index5].stack > cInv[index5].maxStack) cInv[index5].stack = cInv[index5].maxStack; numArray1[index6] -= cInv[index5].stack; numArray2[index4] = -1; break; } } if (Main.netMode == 1 && Main.player[Main.myPlayer].chest > -1) NetMessage.SendData(32, number: Main.player[Main.myPlayer].chest, number2: ((float) index5)); intList2.Remove(index5); } } while (intList2.Count > 0) { int index7 = intList2[0]; for (int index8 = 3; index8 >= 0; --index8) { if (numArray1[index8] > 0) { cInv[index7].SetDefaults(71 + index8); cInv[index7].stack = numArray1[index8]; if (cInv[index7].stack > cInv[index7].maxStack) cInv[index7].stack = cInv[index7].maxStack; numArray1[index8] -= cInv[index7].stack; break; } } if (Main.netMode == 1 && Main.player[Main.myPlayer].chest > -1) NetMessage.SendData(32, number: Main.player[Main.myPlayer].chest, number2: ((float) intList2[0])); intList2.RemoveAt(0); } while (intList1.Count > 0) { int index9 = intList1[0]; for (int index10 = 3; index10 >= 0; --index10) { if (numArray1[index10] > 0) { pInv[index9].SetDefaults(71 + index10); pInv[index9].stack = numArray1[index10]; if (pInv[index9].stack > pInv[index9].maxStack) pInv[index9].stack = pInv[index9].maxStack; numArray1[index10] -= pInv[index9].stack; } } intList1.RemoveAt(0); } } protected void DrawNPCHouse() { for (int n = 0; n < 200; ++n) { if (Main.npc[n].active && Main.npc[n].townNPC && !Main.npc[n].homeless && Main.npc[n].homeTileX > 0 && Main.npc[n].homeTileY > 0 && Main.npc[n].type != 37) { int index1 = 0; int homeTileX = Main.npc[n].homeTileX; int index2 = Main.npc[n].homeTileY - 1; if (WorldGen.TownManager.FindOccupation(homeTileX, index2 + 1) == Main.npc[n].type) index1 = 1; 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 num1 = 8; int num2 = 18; if (Main.tile[homeTileX, index2].type == (ushort) 19) num2 -= 8; int y = index2 + 1; int num3 = 0; float num4 = (float) (y * 16); SpriteEffects effects = SpriteEffects.None; Texture2D texture = Main.HouseBannerTexture[index1]; if ((double) Main.player[Main.myPlayer].gravDir == -1.0) { float num5 = num4 - Main.screenPosition.Y; num4 = Main.screenPosition.Y + (float) Main.screenHeight - num5 - (float) texture.Height; effects = SpriteEffects.FlipVertically; num3 = 4; } Main.spriteBatch.Draw(texture, new Vector2((float) (homeTileX * 16 - (int) Main.screenPosition.X + num1), num4 - (float) (int) Main.screenPosition.Y + (float) num2 + (float) num3), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, texture.Width, texture.Height)), Lighting.GetColor(homeTileX, y), 0.0f, new Vector2((float) (texture.Width / 2), (float) (texture.Height / 2)), 1f, effects, 0.0f); int headIndex = NPC.TypeToHeadIndex(Main.npc[n].type); float scale = 1f; float num6 = Main.npcHeadTexture[headIndex].Width <= Main.npcHeadTexture[headIndex].Height ? (float) Main.npcHeadTexture[headIndex].Height : (float) Main.npcHeadTexture[headIndex].Width; if ((double) num6 > 24.0) scale = 24f / num6; Main.spriteBatch.Draw(Main.npcHeadTexture[headIndex], new Vector2((float) (homeTileX * 16 - (int) Main.screenPosition.X + num1), (float) ((double) num4 - (double) (int) Main.screenPosition.Y + (double) num2 + 2.0)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.npcHeadTexture[headIndex].Width, Main.npcHeadTexture[headIndex].Height)), Lighting.GetColor(homeTileX, y), 0.0f, new Vector2((float) (Main.npcHeadTexture[headIndex].Width / 2), (float) (Main.npcHeadTexture[headIndex].Height / 2)), scale, effects, 0.0f); int num7 = homeTileX * 16 - (int) Main.screenPosition.X + num1 - texture.Width / 2; int num8 = y * 16 - (int) Main.screenPosition.Y + num2 - texture.Height / 2; if (Main.mouseX >= num7 && Main.mouseX <= num7 + texture.Width && Main.mouseY >= num8 && Main.mouseY <= num8 + texture.Height) { this.MouseText(Main.npc[n].FullName); if (Main.mouseRightRelease && Main.mouseRight) { Main.mouseRightRelease = false; WorldGen.kickOut(n); Main.PlaySound(12); } } } } } } } public void DrawWindowsIMEPanel(Vector2 position, float xAnchor = 0.0f) { if (!((Platform) Platform.Current).Ime.IsCandidateListVisible) return; List stringList = new List(); for (uint index = 0; index < ((Platform) Platform.Current).Ime.CandidateCount; ++index) { string candidate = ((Platform) Platform.Current).Ime.GetCandidate(index); stringList.Add(candidate); } if (stringList.Count == 0) return; uint selectedCandidate = ((Platform) Platform.Current).Ime.SelectedCandidate; DynamicSpriteFont fontMouseText = Main.fontMouseText; 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 + fontMouseText.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 = fontMouseText.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) Platform.Current).Ime.Enable(); else ((Platform) Platform.Current).Ime.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(Main.textBackTexture, new Vector2((float) num2, (float) (Main.screenHeight - 36)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.textBackTexture.Width - 100, Main.textBackTexture.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(Main.textBackTexture, new Vector2((float) num4, (float) (Main.screenHeight - 36)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(100, 0, Main.textBackTexture.Width - 200, Main.textBackTexture.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(Main.textBackTexture, new Vector2((float) num4, (float) (Main.screenHeight - 36)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(Main.textBackTexture.Width - num3, 0, Main.textBackTexture.Width - (Main.textBackTexture.Width - num3), Main.textBackTexture.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(Main.textBackTexture, new Vector2(78f, (float) (Main.screenHeight - 36)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.textBackTexture.Width, Main.textBackTexture.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) Platform.Current).Ime.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, Main.fontMouseText, 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(); } } int num5 = Main.startChatLine; int num6 = Main.startChatLine + Main.showCount; if (num6 >= Main.numChatLines) { num6 = --Main.numChatLines; num5 = num6 - Main.showCount; } int num7 = 0; int index1 = -1; int index2 = -1; for (int index3 = num5; index3 < num6; ++index3) { if (Main.drawingPlayerChat || Main.chatLine[index3].showTime > 0 && Main.chatLine[index3].text.Length > 0) { int hoveredSnippet = -1; ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, Main.chatLine[index3].parsedText, new Vector2(88f, (float) (Main.screenHeight - 30 - 28 - num7 * 21)), 0.0f, Vector2.Zero, Vector2.One, out hoveredSnippet); if (hoveredSnippet >= 0 && Main.chatLine[index3].parsedText[hoveredSnippet].CheckForHover) { index1 = index3; index2 = hoveredSnippet; } } ++num7; } if (index1 > -1) { Main.chatLine[index1].parsedText[index2].OnHover(); if (Main.mouseLeft && Main.mouseLeftRelease) Main.chatLine[index1].parsedText[index2].OnClick(); } if (Main.drawingPlayerChat && snippets != null) { Vector2 stringSize = ChatManager.GetStringSize(Main.fontMouseText, 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() { if (Main.ShouldPVPDraw) Main.DrawPVPIcons(); Main.inventoryScale = 0.85f; int num1 = 448; int num2 = 258; if ((Main.player[Main.myPlayer].chest != -1 || Main.npcShop > 0) && !Main.recBigList) { num2 += 168; Main.inventoryScale = 0.755f; num1 += 5; } Microsoft.Xna.Framework.Color color1 = new Microsoft.Xna.Framework.Color(150, 150, 150, 150); if (Main.mouseX >= num1 && (double) Main.mouseX <= (double) num1 + (double) Main.inventoryBackTexture.Width * (double) Main.inventoryScale && Main.mouseY >= num2 && (double) Main.mouseY <= (double) num2 + (double) Main.inventoryBackTexture.Height * (double) Main.inventoryScale && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft) { ItemSlot.LeftClick(ref Main.player[Main.myPlayer].trashItem, 6); 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)); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, Lang.inter[4].Value, new Vector2(40f, 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); 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); int num4 = (int) (20.0 + (double) (index2 * 56) * (double) Main.inventoryScale); int slot = index1 + index2 * 10; Microsoft.Xna.Framework.Color color2 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100); if (Main.mouseX >= num3 && (double) Main.mouseX <= (double) num3 + (double) Main.inventoryBackTexture.Width * (double) Main.inventoryScale && Main.mouseY >= num4 && (double) Main.mouseY <= (double) num4 + (double) Main.inventoryBackTexture.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]) { if (Main.mouseLeftRelease && Main.mouseLeft) { ItemSlot.LeftClick(Main.player[Main.myPlayer].inventory, slot: slot); Recipe.FindRecipes(); } else ItemSlot.RightClick(Main.player[Main.myPlayer].inventory, slot: slot); } 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)); } } if (!PlayerInput.UsingGamepad) { int index = 0; int num5 = 2; int num6 = 32; Player player = Main.player[Main.myPlayer]; if (player.InfoAccMechShowWires.ToInt() * 6 + player.rulerLine.ToInt() + player.rulerGrid.ToInt() + player.autoActuator.ToInt() + player.autoPaint.ToInt() >= 8) num6 = 2; if (!Main.player[Main.myPlayer].hbLocked) index = 1; Main.spriteBatch.Draw(Main.HBLockTexture[index], new Vector2((float) num5, (float) num6), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.HBLockTexture[index].Width, Main.HBLockTexture[index].Height)), Main.inventoryBack, 0.0f, new Vector2(), 0.9f, SpriteEffects.None, 0.0f); if (Main.mouseX > num5 && (double) Main.mouseX < (double) num5 + (double) Main.HBLockTexture[index].Width * 0.899999976158142 && Main.mouseY > num6 && (double) Main.mouseY < (double) num6 + (double) Main.HBLockTexture[index].Height * 0.899999976158142) { Main.player[Main.myPlayer].mouseInterface = true; if (!Main.player[Main.myPlayer].hbLocked) { this.MouseText(Lang.inter[5].Value); Main.mouseText = true; } else { this.MouseText(Lang.inter[6].Value); Main.mouseText = true; } if (Main.mouseLeft && Main.mouseLeftRelease) { Main.PlaySound(22); Main.player[Main.myPlayer].hbLocked = !Main.player[Main.myPlayer].hbLocked; } } } 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)); if (Main.mapEnabled) { bool flag = false; int num7 = Main.screenWidth - 440; int num8 = 40; if (Main.screenWidth < 940) flag = true; if (flag) { num7 = Main.screenWidth - 40; num8 = Main.screenHeight - 200; } for (int index3 = 0; index3 < 4; ++index3) { int num9 = num7 + index3 * 32; int num10 = num8; if (flag) { num9 = num7; num10 = num8 + index3 * 32; } int index4 = index3; int num11 = 120; if (index3 > 0 && Main.mapStyle == index3 - 1) num11 = 200; if (Main.mouseX >= num9 && Main.mouseX <= num9 + 32 && Main.mouseY >= num10 && Main.mouseY <= num10 + 30 && !PlayerInput.IgnoreMouseInterface) { num11 = (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].talkNPC = -1; Main.npcChatCornerItem = 0; Main.PlaySound(10); Main.mapFullscreenScale = 2.5f; Main.mapFullscreen = true; Main.resetMapFull = true; } if (index3 == 1) { Main.mapStyle = 0; Main.PlaySound(12); } if (index3 == 2) { Main.mapStyle = 1; Main.PlaySound(12); } if (index3 == 3) { Main.mapStyle = 2; Main.PlaySound(12); } } } Main.spriteBatch.Draw(Main.mapIconTexture[index4], new Vector2((float) num9, (float) num10), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.mapIconTexture[index4].Width, Main.mapIconTexture[index4].Height)), new Microsoft.Xna.Framework.Color(num11, num11, num11, num11), 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 color3 = 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 num12 = Main.DrawPageIcons(); if (num12 > -1) { Main.HoverItem = new Item(); switch (num12) { 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: UILinkPointNavigator.Shortcuts.NPCS_LastHovered = -1; 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 num13 = 0; string cursorText = ""; int num14 = 0; int num15 = 0; for (int index5 = 0; index5 < Main.npcHeadTexture.Length; ++index5) { bool flag = false; int index6 = 0; switch (index5) { case 0: flag = true; break; case 21: flag = false; break; default: for (int index7 = 0; index7 < 200; ++index7) { if (Main.npc[index7].active && NPC.TypeToHeadIndex(Main.npc[index7].type) == index5) { flag = true; index6 = index7; break; } } break; } if (flag) { int num16 = Main.screenWidth - 64 - 28 + num15; int num17 = (int) ((double) (174 + Main.mH) + (double) (num13 * 56) * (double) Main.inventoryScale) + num14; Microsoft.Xna.Framework.Color color4 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100); if (num17 > Main.screenHeight - 80) { num15 -= 48; num14 -= num17 - (174 + Main.mH); num16 = Main.screenWidth - 64 - 28 + num15; num17 = (int) ((double) (174 + Main.mH) + (double) (num13 * 56) * (double) Main.inventoryScale) + num14; if (UILinkPointNavigator.Shortcuts.NPCS_IconsPerColumn == 100) UILinkPointNavigator.Shortcuts.NPCS_IconsPerColumn = num13; } if (Main.mouseX >= num16 && (double) Main.mouseX <= (double) num16 + (double) Main.inventoryBackTexture.Width * (double) Main.inventoryScale && Main.mouseY >= num17 && (double) Main.mouseY <= (double) num17 + (double) Main.inventoryBackTexture.Height * (double) Main.inventoryScale) { UILinkPointNavigator.Shortcuts.NPCS_LastHovered = index6; Main.mouseText = true; cursorText = index5 != 0 ? Main.npc[index6].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) { Main.PlaySound(12); this.mouseNPC = index5; Main.mouseLeftRelease = false; } } } UILinkPointNavigator.SetPosition(600 + num13, new Vector2((float) num16, (float) num17) + Main.inventoryBackTexture.Size() * 0.75f); Texture2D texture = Main.inventoryBack11Texture; Microsoft.Xna.Framework.Color color5 = Main.inventoryBack; if (UILinkPointNavigator.CurrentPoint - 600 == num13) { texture = Main.inventoryBack14Texture; color5 = Microsoft.Xna.Framework.Color.White; } Main.spriteBatch.Draw(texture, new Vector2((float) num16, (float) num17), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height)), color5, 0.0f, new Vector2(), Main.inventoryScale, SpriteEffects.None, 0.0f); color4 = Microsoft.Xna.Framework.Color.White; int index8 = index5; float scale = 1f; float num18 = Main.npcHeadTexture[index8].Width <= Main.npcHeadTexture[index8].Height ? (float) Main.npcHeadTexture[index8].Height : (float) Main.npcHeadTexture[index8].Width; if ((double) num18 > 36.0) scale = 36f / num18; Main.spriteBatch.Draw(Main.npcHeadTexture[index8], new Vector2((float) num16 + 26f * Main.inventoryScale, (float) num17 + 26f * Main.inventoryScale), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.npcHeadTexture[index8].Width, Main.npcHeadTexture[index8].Height)), color4, 0.0f, new Vector2((float) (Main.npcHeadTexture[index8].Width / 2), (float) (Main.npcHeadTexture[index8].Height / 2)), scale, SpriteEffects.None, 0.0f); ++num13; } UILinkPointNavigator.Shortcuts.NPCS_IconsTotal = num13; } if (cursorText != "" && Main.mouseItem.type == 0) { this.MouseText(cursorText); break; } 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) Main.inventoryBackTexture.Width * (double) Main.inventoryScale), (int) ((double) Main.inventoryBackTexture.Height * (double) Main.inventoryScale)); Item[] inv = Main.player[Main.myPlayer].miscEquips; int num19 = Main.screenWidth - 92; int num20 = 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 = num19 + 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 = num20 + slot * 47; Texture2D texture = Main.inventoryTickOnTexture; if (Main.player[Main.myPlayer].hideMisc[key]) texture = Main.inventoryTickOffTexture; Microsoft.Xna.Framework.Rectangle r2 = new Microsoft.Xna.Framework.Rectangle(r1.Left + 34, r1.Top - 2, texture.Width, texture.Height); int num21 = 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; Main.PlaySound(12); if (Main.netMode == 1) NetMessage.SendData(4, number: Main.myPlayer); } num21 = !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 (num21 > 0) { Main.HoverItem = new Item(); Main.hoverItemName = Lang.inter[58 + num21].Value; } } } } int num22 = num20 + 247; int num23 = num19 + 8; int drawBuffText = -1; int num24 = 0; int num25 = 3; int num26 = 260; if (Main.screenHeight > 630 + num26 * (Main.mapStyle == 1).ToInt()) ++num25; if (Main.screenHeight > 680 + num26 * (Main.mapStyle == 1).ToInt()) ++num25; if (Main.screenHeight > 730 + num26 * (Main.mapStyle == 1).ToInt()) ++num25; int num27 = 46; for (int i = 0; i < 22; ++i) { int b = Main.player[Main.myPlayer].buffType[i]; if (b != 0) { int num28 = num24 / num25; int num29 = num24 % num25; Microsoft.Xna.Framework.Point point2 = new Microsoft.Xna.Framework.Point(num23 + num28 * -num27, num22 + num29 * num27); drawBuffText = Main.DrawBuffIcon(drawBuffText, i, b, point2.X, point2.Y); UILinkPointNavigator.SetPosition(9000 + num24, new Vector2((float) (point2.X + 30), (float) (point2.Y + 30))); ++num24; if ((double) Main.buffAlpha[i] < 0.649999976158142) Main.buffAlpha[i] = 0.65f; } } UILinkPointNavigator.Shortcuts.BUFFS_DRAWN = num24; UILinkPointNavigator.Shortcuts.BUFFS_PER_COLUMN = num25; if (drawBuffText >= 0) { int id = Main.player[Main.myPlayer].buffType[drawBuffText]; if (id > 0) { Main.buffString = Lang.GetBuffDescription(id); if (id == 26 && Main.expertMode) Main.buffString = Language.GetTextValue("BuffDescription.WellFed_Expert"); if (id == 147) Main.bannerMouseOver = true; if (id == 94) { int num30 = (int) ((double) Main.player[Main.myPlayer].manaSickReduction * 100.0) + 1; Main.buffString = Main.buffString + (object) num30 + "%"; } if (Main.meleeBuff[id]) { this.MouseTextHackZoom(Lang.GetBuffName(id), -10); break; } this.MouseTextHackZoom(Lang.GetBuffName(id)); break; } break; } break; default: int num31 = 4; 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; float inventoryScale = Main.inventoryScale; int num32 = 8 + Main.player[Main.myPlayer].extraAccessorySlots; bool flag1 = false; int num33 = num32 - 1; if (num32 == 8 && (Main.player[Main.myPlayer].armor[8].type > 0 || Main.player[Main.myPlayer].armor[18].type > 0 || Main.player[Main.myPlayer].dye[8].type > 0)) { num32 = 9; flag1 = true; num33 = 7; } if (Main.screenHeight < 900 && num33 == 8) --num33; Microsoft.Xna.Framework.Color inventoryBack1 = Main.inventoryBack; Microsoft.Xna.Framework.Color color6 = new Microsoft.Xna.Framework.Color(80, 80, 80, 80); for (int slot = 0; slot < num32; ++slot) { bool flag2 = false; if (flag1 && slot == num32 - 1 && Main.mouseItem.type > 0) flag2 = true; int num34 = Main.screenWidth - 64 - 28; int num35 = (int) ((double) (174 + Main.mH) + (double) (slot * 56) * (double) Main.inventoryScale); Microsoft.Xna.Framework.Color color7 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100); if (slot > 2) num35 += num31; if (slot == num33) { Vector2 vector2_1 = new Vector2((float) (num34 - 10 - 47 - 47 - 14), (float) num35 + (float) Main.inventoryBackTexture.Height * 0.5f); Main.spriteBatch.Draw(Main.extraTexture[58], vector2_1, new Microsoft.Xna.Framework.Rectangle?(), Microsoft.Xna.Framework.Color.White, 0.0f, Main.extraTexture[58].Size() / 2f, Main.inventoryScale, SpriteEffects.None, 0.0f); Vector2 vector2_2 = Main.fontMouseText.MeasureString(Main.player[Main.myPlayer].statDefense.ToString()); ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, 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, Main.extraTexture[58].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 + Main.extraTexture[58].Size() * Main.inventoryScale / 4f); } int context = 8; if (slot > 2) context = 10; Texture2D texture = Main.inventoryTickOnTexture; if (Main.player[Main.myPlayer].hideVisual[slot]) texture = Main.inventoryTickOffTexture; int x = Main.screenWidth - 58; int y = (int) ((double) (172 + Main.mH) + (double) (slot * 56) * (double) Main.inventoryScale); if (slot > 2) y += num31; Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(x, y, texture.Width, texture.Height); int num36 = 0; if (slot >= 3 && slot < num32 && 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].hideVisual[slot] = !Main.player[Main.myPlayer].hideVisual[slot]; Main.PlaySound(12); if (Main.netMode == 1) NetMessage.SendData(4, number: Main.myPlayer); } num36 = !Main.player[Main.myPlayer].hideVisual[slot] ? 1 : 2; } else if (Main.mouseX >= num34 && (double) Main.mouseX <= (double) num34 + (double) Main.inventoryBackTexture.Width * (double) Main.inventoryScale && Main.mouseY >= num35 && (double) Main.mouseY <= (double) num35 + (double) Main.inventoryBackTexture.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 (!flag2 && Main.mouseLeftRelease && Main.mouseLeft) ItemSlot.LeftClick(Main.player[Main.myPlayer].armor, context, slot); ItemSlot.MouseHover(Main.player[Main.myPlayer].armor, context, slot); } if (flag1 && slot == num32 - 1) Main.inventoryBack = color6; ItemSlot.Draw(Main.spriteBatch, Main.player[Main.myPlayer].armor, context, slot, new Vector2((float) num34, (float) num35)); if (slot > 2 && slot < num32) { Main.spriteBatch.Draw(texture, new Vector2((float) x, (float) y), Microsoft.Xna.Framework.Color.White * 0.7f); if (num36 > 0) { Main.HoverItem = new Item(); Main.hoverItemName = Lang.inter[58 + num36].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 > 174 + Main.mH && Main.mouseY < (int) ((double) (174 + Main.mH) + 168.0 * (double) Main.inventoryScale) && !PlayerInput.IgnoreMouseInterface) Main.player[Main.myPlayer].mouseInterface = true; for (int slot = 10; slot < 10 + num32; ++slot) { bool flag3 = false; if (flag1 && slot == 10 + num32 - 1 && Main.mouseItem.type > 0) flag3 = true; int num37 = Main.screenWidth - 64 - 28 - 47; int num38 = (int) ((double) (174 + Main.mH) + (double) ((slot - 10) * 56) * (double) Main.inventoryScale); Microsoft.Xna.Framework.Color color8 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100); if (slot > 12) num38 += num31; int context = 9; if (slot > 12) context = 11; if (Main.mouseX >= num37 && (double) Main.mouseX <= (double) num37 + (double) Main.inventoryBackTexture.Width * (double) Main.inventoryScale && Main.mouseY >= num38 && (double) Main.mouseY <= (double) num38 + (double) Main.inventoryBackTexture.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 (!flag3) { if (Main.mouseLeftRelease && Main.mouseLeft) ItemSlot.LeftClick(Main.player[Main.myPlayer].armor, context, slot); else ItemSlot.RightClick(Main.player[Main.myPlayer].armor, context, slot); } ItemSlot.MouseHover(Main.player[Main.myPlayer].armor, context, slot); } if (flag1 && slot == num32 + 10 - 1) Main.inventoryBack = color6; ItemSlot.Draw(Main.spriteBatch, Main.player[Main.myPlayer].armor, context, slot, new Vector2((float) num37, (float) num38)); } 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 > 174 + Main.mH && Main.mouseY < (int) ((double) (174 + Main.mH) + 168.0 * (double) Main.inventoryScale) && !PlayerInput.IgnoreMouseInterface) Main.player[Main.myPlayer].mouseInterface = true; for (int slot = 0; slot < num32; ++slot) { bool flag4 = false; if (flag1 && slot == num32 - 1 && Main.mouseItem.type > 0) flag4 = true; int num39 = Main.screenWidth - 64 - 28 - 47 - 47; int num40 = (int) ((double) (174 + Main.mH) + (double) (slot * 56) * (double) Main.inventoryScale); Microsoft.Xna.Framework.Color color9 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100); if (slot > 2) num40 += num31; if (Main.mouseX >= num39 && (double) Main.mouseX <= (double) num39 + (double) Main.inventoryBackTexture.Width * (double) Main.inventoryScale && Main.mouseY >= num40 && (double) Main.mouseY <= (double) num40 + (double) Main.inventoryBackTexture.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 (!flag4) { if (Main.mouseRightRelease && Main.mouseRight) ItemSlot.RightClick(Main.player[Main.myPlayer].dye, 12, slot); else if (Main.mouseLeftRelease && Main.mouseLeft) ItemSlot.LeftClick(Main.player[Main.myPlayer].dye, 12, slot); } ItemSlot.MouseHover(Main.player[Main.myPlayer].dye, 12, slot); } if (flag1 && slot == num32 - 1) Main.inventoryBack = color6; 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 num41 = (Main.screenHeight - 600) / 2; int num42 = (int) ((double) Main.screenHeight / 600.0 * 250.0); if (Main.screenHeight < 700) { num41 = (Main.screenHeight - 508) / 2; num42 = (int) ((double) Main.screenHeight / 600.0 * 200.0); } else if (Main.screenHeight < 850) num42 = (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 color10 = 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 num43 = 50; int num44 = 270; string text1 = Lang.inter[46].Value + ": "; if (Main.reforgeItem.type > 0) { int num45 = Main.reforgeItem.value; if (Main.player[Main.myPlayer].discount) num45 = (int) ((double) num45 * 0.8); int price = num45 / 3; string text2 = ""; int num46 = 0; int num47 = 0; int num48 = 0; int num49 = 0; int num50 = price; if (num50 < 1) num50 = 1; if (num50 >= 1000000) { num46 = num50 / 1000000; num50 -= num46 * 1000000; } if (num50 >= 10000) { num47 = num50 / 10000; num50 -= num47 * 10000; } if (num50 >= 100) { num48 = num50 / 100; num50 -= num48 * 100; } if (num50 >= 1) num49 = num50; if (num46 > 0) text2 = text2 + "[c/" + Colors.AlphaDarken(Colors.CoinPlatinum).Hex3() + ":" + (object) num46 + " " + Lang.inter[15].Value + "] "; if (num47 > 0) text2 = text2 + "[c/" + Colors.AlphaDarken(Colors.CoinGold).Hex3() + ":" + (object) num47 + " " + Lang.inter[16].Value + "] "; if (num48 > 0) text2 = text2 + "[c/" + Colors.AlphaDarken(Colors.CoinSilver).Hex3() + ":" + (object) num48 + " " + Lang.inter[17].Value + "] "; if (num49 > 0) text2 = text2 + "[c/" + Colors.AlphaDarken(Colors.CoinCopper).Hex3() + ":" + (object) num49 + " " + Lang.inter[18].Value + "] "; ItemSlot.DrawSavings(Main.spriteBatch, (float) (num43 + 130), (float) this.invBottom, true); ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, text2, new Vector2((float) (num43 + 50) + Main.fontMouseText.MeasureString(text1).X, (float) num44), Microsoft.Xna.Framework.Color.White, 0.0f, Vector2.Zero, Vector2.One); int num51 = num43 + 70; int num52 = num44 + 40; int num53 = Main.mouseX <= num51 - 15 || Main.mouseX >= num51 + 15 || Main.mouseY <= num52 - 15 || Main.mouseY >= num52 + 15 ? 0 : (!PlayerInput.IgnoreMouseInterface ? 1 : 0); Texture2D texture2D = Main.reforgeTexture[0]; if (num53 != 0) texture2D = Main.reforgeTexture[1]; Main.spriteBatch.Draw(texture2D, new Vector2((float) num51, (float) num52), 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) num51, (float) num52) + texture2D.Size() / 4f); if (num53 != 0) { Main.hoverItemName = Lang.inter[19].Value; if (!Main.mouseReforge) Main.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; ItemText.NewText(Main.reforgeItem, Main.reforgeItem.stack, true); Main.PlaySound(SoundID.Item37); } } else Main.mouseReforge = false; } else text1 = Lang.inter[20].Value; ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, text1, new Vector2((float) (num43 + 50), (float) num44), 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 >= num43 && (double) Main.mouseX <= (double) num43 + (double) Main.inventoryBackTexture.Width * (double) Main.inventoryScale && Main.mouseY >= num44 && (double) Main.mouseY <= (double) num44 + (double) Main.inventoryBackTexture.Height * (double) Main.inventoryScale && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; Main.craftingHide = true; if (Main.mouseLeftRelease && Main.mouseLeft) { ItemSlot.LeftClick(ref Main.reforgeItem, 5); Recipe.FindRecipes(); } else ItemSlot.RightClick(ref Main.reforgeItem, 5); ItemSlot.MouseHover(ref Main.reforgeItem, 5); } ItemSlot.Draw(Main.spriteBatch, ref Main.reforgeItem, 5, new Vector2((float) num43, (float) num44)); } } 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 num54 = 73; int num55 = 331 + num41; string str; if (Main.guideItem.type > 0) { str = Lang.inter[21].Value + " " + Main.guideItem.Name; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, Lang.inter[22].Value, new Vector2((float) num54, (float) (num55 + 118)), color10, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); int focusRecipe = Main.focusRecipe; int num56 = 0; for (int index = 0; index < Recipe.maxRequirements; ++index) { int num57 = (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) { DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, Lang.inter[23].Value, new Vector2((float) num54, (float) (num55 + 118 + num57)), color10, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); break; } break; } ++num56; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, Lang.GetMapObjectName(MapHelper.TileToLookup(Main.recipe[Main.availableRecipe[focusRecipe]].requiredTile[index], 0)), new Vector2((float) num54, (float) (num55 + 118 + num57)), color10, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (Main.recipe[Main.availableRecipe[focusRecipe]].needWater) { int num58 = (num56 + 1) * 26; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, Lang.inter[53].Value, new Vector2((float) num54, (float) (num55 + 118 + num58)), color10, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (Main.recipe[Main.availableRecipe[focusRecipe]].needHoney) { int num59 = (num56 + 1) * 26; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, Lang.inter[58].Value, new Vector2((float) num54, (float) (num55 + 118 + num59)), color10, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (Main.recipe[Main.availableRecipe[focusRecipe]].needLava) { int num60 = (num56 + 1) * 26; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, Lang.inter[56].Value, new Vector2((float) num54, (float) (num55 + 118 + num60)), color10, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (Main.recipe[Main.availableRecipe[focusRecipe]].needSnowBiome) { int num61 = (num56 + 1) * 26; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, Lang.inter[123].Value, new Vector2((float) num54, (float) (num55 + 118 + num61)), color10, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } } else str = Lang.inter[24].Value; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, str, new Vector2((float) (num54 + 50), (float) (num55 + 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); Microsoft.Xna.Framework.Color color11 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100); if (Main.mouseX >= num54 && (double) Main.mouseX <= (double) num54 + (double) Main.inventoryBackTexture.Width * (double) Main.inventoryScale && Main.mouseY >= num55 && (double) Main.mouseY <= (double) num55 + (double) Main.inventoryBackTexture.Height * (double) Main.inventoryScale && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; Main.craftingHide = true; if (Main.mouseLeftRelease && Main.mouseLeft) { ItemSlot.LeftClick(ref Main.guideItem, 7); Recipe.FindRecipes(); } else ItemSlot.RightClick(ref Main.guideItem, 7); ItemSlot.MouseHover(ref Main.guideItem, 7); } ItemSlot.Draw(Main.spriteBatch, ref Main.guideItem, 7, new Vector2((float) num54, (float) num55)); } } if (!Main.InReforgeMenu) { UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeBig = -1; UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeSmall = -1; if (Main.numAvailableRecipes > 0) DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, Lang.inter[25].Value, new Vector2(76f, (float) (414 + num41)), color10, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); for (int index = 0; index < Recipe.maxRecipes; ++index) { Main.inventoryScale = (float) (100.0 / ((double) Math.Abs(Main.availableRecipeY[index]) + 100.0)); if ((double) Main.inventoryScale < 0.75) Main.inventoryScale = 0.75f; if (Main.recFastScroll) Main.inventoryScale = 0.75f; if ((double) Main.availableRecipeY[index] < (double) ((index - Main.focusRecipe) * 65)) { if ((double) Main.availableRecipeY[index] == 0.0 && !Main.recFastScroll) Main.PlaySound(12); Main.availableRecipeY[index] += 6.5f; if (Main.recFastScroll) Main.availableRecipeY[index] += 130000f; if ((double) Main.availableRecipeY[index] > (double) ((index - Main.focusRecipe) * 65)) Main.availableRecipeY[index] = (float) ((index - Main.focusRecipe) * 65); } else if ((double) Main.availableRecipeY[index] > (double) ((index - Main.focusRecipe) * 65)) { if ((double) Main.availableRecipeY[index] == 0.0 && !Main.recFastScroll) Main.PlaySound(12); Main.availableRecipeY[index] -= 6.5f; if (Main.recFastScroll) Main.availableRecipeY[index] -= 130000f; if ((double) Main.availableRecipeY[index] < (double) ((index - Main.focusRecipe) * 65)) Main.availableRecipeY[index] = (float) ((index - Main.focusRecipe) * 65); } else Main.recFastScroll = false; if (index < Main.numAvailableRecipes && (double) Math.Abs(Main.availableRecipeY[index]) <= (double) num42) { int num62 = (int) (46.0 - 26.0 * (double) Main.inventoryScale); int num63 = (int) (410.0 + (double) Main.availableRecipeY[index] * (double) Main.inventoryScale - 30.0 * (double) Main.inventoryScale + (double) num41); double num64 = (double) ((int) Main.inventoryBack.A + 50); double num65 = (double) byte.MaxValue; if ((double) Math.Abs(Main.availableRecipeY[index]) > (double) num42 - 100.0) { num64 = 150.0 * (100.0 - ((double) Math.Abs(Main.availableRecipeY[index]) - ((double) num42 - 100.0))) * 0.01; num65 = (double) byte.MaxValue * (100.0 - ((double) Math.Abs(Main.availableRecipeY[index]) - ((double) num42 - 100.0))) * 0.01; } Microsoft.Xna.Framework.Color color12 = new Microsoft.Xna.Framework.Color((int) (byte) num64, (int) (byte) num64, (int) (byte) num64, (int) (byte) num64); Microsoft.Xna.Framework.Color lightColor = new Microsoft.Xna.Framework.Color((int) (byte) num65, (int) (byte) num65, (int) (byte) num65, (int) (byte) num65); if (Main.mouseX >= num62 && (double) Main.mouseX <= (double) num62 + (double) Main.inventoryBackTexture.Width * (double) Main.inventoryScale && Main.mouseY >= num63 && (double) Main.mouseY <= (double) num63 + (double) Main.inventoryBackTexture.Height * (double) Main.inventoryScale && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.focusRecipe == index && Main.guideItem.type == 0 && Main.LocalPlayer.itemTime == 0 && Main.LocalPlayer.itemAnimation == 0) { if ((Main.mouseItem.type == 0 || Main.mouseItem.IsTheSameAs(Main.recipe[Main.availableRecipe[index]].createItem) && Main.mouseItem.stack + Main.recipe[Main.availableRecipe[index]].createItem.stack <= Main.mouseItem.maxStack) && !Main.player[Main.myPlayer].IsStackingItems()) { if (Main.mouseLeftRelease && Main.mouseLeft) Main.CraftItem(Main.recipe[Main.availableRecipe[index]]); else if (Main.stackSplit <= 1 && Main.mouseRight && (Main.mouseItem.stack < Main.mouseItem.maxStack || Main.mouseItem.type == 0)) { Main.stackSplit = Main.stackSplit != 0 ? Main.stackDelay : 15; Main.CraftItem(Main.recipe[Main.availableRecipe[index]]); } } } else if (Main.mouseLeftRelease && Main.mouseLeft) Main.focusRecipe = index; Main.craftingHide = true; Main.hoverItemName = Main.recipe[Main.availableRecipe[index]].createItem.Name; Main.HoverItem = Main.recipe[Main.availableRecipe[index]].createItem.Clone(); if (Main.recipe[Main.availableRecipe[index]].createItem.stack > 1) Main.hoverItemName = Main.hoverItemName + " (" + (object) Main.recipe[Main.availableRecipe[index]].createItem.stack + ")"; } if (Main.numAvailableRecipes > 0) { double num66 = num64 - 50.0; if (num66 < 0.0) num66 = 0.0; UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeSmall = index != Main.focusRecipe ? -1 : 0; Microsoft.Xna.Framework.Color inventoryBack2 = Main.inventoryBack; Main.inventoryBack = new Microsoft.Xna.Framework.Color((int) (byte) num66, (int) (byte) num66, (int) (byte) num66, (int) (byte) num66); ItemSlot.Draw(Main.spriteBatch, ref Main.recipe[Main.availableRecipe[index]].createItem, 22, new Vector2((float) num62, (float) num63), lightColor); Main.inventoryBack = inventoryBack2; } } } if (Main.numAvailableRecipes > 0) { UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeBig = -1; UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeSmall = -1; for (int index = 0; index < Recipe.maxRequirements; ++index) { if (Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[index].type == 0) { UILinkPointNavigator.Shortcuts.CRAFT_CurrentIngridientsCount = index + 1; break; } int num67 = 80 + index * 40; int num68 = 380 + num41; double num69 = (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 num70 = (double) ((int) Main.inventoryBack.A + 50) - (double) Math.Abs(Main.availableRecipeY[Main.focusRecipe]) * 2.0; double num71 = (double) byte.MaxValue - (double) Math.Abs(Main.availableRecipeY[Main.focusRecipe]) * 2.0; if (num70 < 0.0) num70 = 0.0; if (num71 < 0.0) num71 = 0.0; white1.R = (byte) num70; white1.G = (byte) num70; white1.B = (byte) num70; white1.A = (byte) num70; white2.R = (byte) num71; white2.G = (byte) num71; white2.B = (byte) num71; white2.A = (byte) num71; Main.inventoryScale = 0.6f; if (num70 != 0.0) { if (Main.mouseX >= num67 && (double) Main.mouseX <= (double) num67 + (double) Main.inventoryBackTexture.Width * (double) Main.inventoryScale && Main.mouseY >= num68 && (double) Main.mouseY <= (double) num68 + (double) Main.inventoryBackTexture.Height * (double) Main.inventoryScale && !PlayerInput.IgnoreMouseInterface) { Main.craftingHide = true; Main.player[Main.myPlayer].mouseInterface = true; Main.hoverItemName = Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[index].Name; Main.HoverItem = Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[index].Clone(); string theText; if (Main.recipe[Main.availableRecipe[Main.focusRecipe]].ProcessGroupsForText(Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[index].type, out theText)) Main.HoverItem.SetNameOverride(theText); if (Main.recipe[Main.availableRecipe[Main.focusRecipe]].anyIronBar && Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[index].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[index].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[index].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[index].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[index].type == 542) Main.HoverItem.SetNameOverride(Lang.misc[37].Value + " " + Lang.misc[38].Value); if (Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[index].stack > 1) Main.hoverItemName = Main.hoverItemName + " (" + (object) Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[index].stack + ")"; } double num72 = num70 - 50.0; if (num72 < 0.0) num72 = 0.0; UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeSmall = 1 + index; Microsoft.Xna.Framework.Color inventoryBack3 = Main.inventoryBack; Main.inventoryBack = new Microsoft.Xna.Framework.Color((int) (byte) num72, (int) (byte) num72, (int) (byte) num72, (int) (byte) num72); ItemSlot.Draw(Main.spriteBatch, ref Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[index], 22, new Vector2((float) num67, (float) num68)); Main.inventoryBack = inventoryBack3; } else break; } } if (Main.numAvailableRecipes == 0) { Main.recBigList = false; } else { int num73 = 94; int num74 = 450 + num41; if (Main.InGuideCraftMenu) num74 -= 150; bool flag5 = Main.mouseX > num73 - 15 && Main.mouseX < num73 + 15 && Main.mouseY > num74 - 15 && Main.mouseY < num74 + 15 && !PlayerInput.IgnoreMouseInterface; int index = Main.recBigList.ToInt() * 2 + flag5.ToInt(); Main.spriteBatch.Draw(Main.craftToggleTexture[index], new Vector2((float) num73, (float) num74), new Microsoft.Xna.Framework.Rectangle?(), Microsoft.Xna.Framework.Color.White, 0.0f, Main.craftToggleTexture[index].Size() / 2f, 1f, SpriteEffects.None, 0.0f); if (flag5) { this.MouseText(Language.GetTextValue("GameUI.CraftingWindow")); Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeft && Main.mouseLeftRelease) { if (!Main.recBigList) { Main.recBigList = true; Main.PlaySound(12); } else { Main.recBigList = false; Main.PlaySound(12); } } } } } if (Main.recBigList) { UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeBig = -1; UILinkPointNavigator.Shortcuts.CRAFT_CurrentRecipeSmall = -1; int num75 = 42; if ((double) Main.inventoryScale < 0.75) Main.inventoryScale = 0.75f; int num76 = 340; int num77 = 310; int num78 = (Main.screenWidth - num77 - 280) / num75; int num79 = (Main.screenHeight - num76 - 20) / num75; UILinkPointNavigator.Shortcuts.CRAFT_IconsPerRow = num78; UILinkPointNavigator.Shortcuts.CRAFT_IconsPerColumn = num79; int num80 = 0; int num81 = 0; int num82 = num77; int num83 = num76; int num84 = num77 - 20; int num85 = num76 + 2; if (Main.recStart > Main.numAvailableRecipes - num78 * num79) { Main.recStart = Main.numAvailableRecipes - num78 * num79; if (Main.recStart < 0) Main.recStart = 0; } if (Main.recStart > 0) { if (Main.mouseX >= num84 && Main.mouseX <= num84 + Main.craftUpButtonTexture.Width && Main.mouseY >= num85 && Main.mouseY <= num85 + Main.craftUpButtonTexture.Height && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft) { Main.recStart -= num78; if (Main.recStart < 0) Main.recStart = 0; Main.PlaySound(12); Main.mouseLeftRelease = false; } } Main.spriteBatch.Draw(Main.craftUpButtonTexture, new Vector2((float) num84, (float) num85), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.craftUpButtonTexture.Width, Main.craftUpButtonTexture.Height)), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (Main.recStart < Main.numAvailableRecipes - num78 * num79) { int num86 = num85 + 20; if (Main.mouseX >= num84 && Main.mouseX <= num84 + Main.craftUpButtonTexture.Width && Main.mouseY >= num86 && Main.mouseY <= num86 + Main.craftUpButtonTexture.Height && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft) { Main.recStart += num78; Main.PlaySound(12); if (Main.recStart > Main.numAvailableRecipes - num78) Main.recStart = Main.numAvailableRecipes - num78; Main.mouseLeftRelease = false; } } Main.spriteBatch.Draw(Main.craftDownButtonTexture, new Vector2((float) num84, (float) num86), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.craftUpButtonTexture.Width, Main.craftUpButtonTexture.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 num87 = num82; int num88 = num83; double num89 = (double) ((int) Main.inventoryBack.A + 50); double maxValue = (double) byte.MaxValue; Microsoft.Xna.Framework.Color color13 = new Microsoft.Xna.Framework.Color((int) (byte) num89, (int) (byte) num89, (int) (byte) num89, (int) (byte) num89); Microsoft.Xna.Framework.Color color14 = new Microsoft.Xna.Framework.Color((int) (byte) maxValue, (int) (byte) maxValue, (int) (byte) maxValue, (int) (byte) maxValue); if (Main.mouseX >= num87 && (double) Main.mouseX <= (double) num87 + (double) Main.inventoryBackTexture.Width * (double) Main.inventoryScale && Main.mouseY >= num88 && (double) Main.mouseY <= (double) num88 + (double) Main.inventoryBackTexture.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; Main.PlaySound(12); Main.mouseLeftRelease = false; if (PlayerInput.UsingGamepadUI) UILinkPointNavigator.ChangePage(9); } 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 num90 = num89 - 50.0; if (num90 < 0.0) num90 = 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) num90, (int) (byte) num90, (int) (byte) num90, (int) (byte) num90); ItemSlot.Draw(Main.spriteBatch, ref Main.recipe[Main.availableRecipe[recStart]].createItem, 22, new Vector2((float) num87, (float) num88)); Main.inventoryBack = inventoryBack4; } num82 += num75; ++num80; if (num80 >= num78) { num82 = num77; num83 += num75; num80 = 0; ++num81; if (num81 >= num79) break; } } } Vector2 vector2_3 = Main.fontMouseText.MeasureString("Coins"); Vector2 vector2_4 = Main.fontMouseText.MeasureString(Lang.inter[26].Value); float num91 = vector2_3.X / vector2_4.X; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, Lang.inter[26].Value, new Vector2(496f, (float) (84.0 + ((double) vector2_3.Y - (double) vector2_3.Y * (double) num91) / 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 * num91, SpriteEffects.None, 0.0f); Main.inventoryScale = 0.6f; for (int index = 0; index < 4; ++index) { int num92 = 497; int num93 = (int) (85.0 + (double) (index * 56) * (double) Main.inventoryScale + 20.0); int slot = index + 50; Microsoft.Xna.Framework.Color color15 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100); if (Main.mouseX >= num92 && (double) Main.mouseX <= (double) num92 + (double) Main.inventoryBackTexture.Width * (double) Main.inventoryScale && Main.mouseY >= num93 && (double) Main.mouseY <= (double) num93 + (double) Main.inventoryBackTexture.Height * (double) Main.inventoryScale && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; ItemSlot.OverrideHover(Main.player[Main.myPlayer].inventory, 1, slot); if (Main.mouseLeftRelease && Main.mouseLeft) { ItemSlot.LeftClick(Main.player[Main.myPlayer].inventory, 1, slot); Recipe.FindRecipes(); } else ItemSlot.RightClick(Main.player[Main.myPlayer].inventory, 1, slot); ItemSlot.MouseHover(Main.player[Main.myPlayer].inventory, 1, slot); } ItemSlot.Draw(Main.spriteBatch, Main.player[Main.myPlayer].inventory, 1, slot, new Vector2((float) num92, (float) num93)); } Vector2 vector2_5 = Main.fontMouseText.MeasureString("Ammo"); Vector2 vector2_6 = Main.fontMouseText.MeasureString(Lang.inter[27].Value); float num94 = vector2_5.X / vector2_6.X; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, Lang.inter[27].Value, new Vector2(532f, (float) (84.0 + ((double) vector2_5.Y - (double) vector2_5.Y * (double) num94) / 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 * num94, SpriteEffects.None, 0.0f); Main.inventoryScale = 0.6f; for (int index = 0; index < 4; ++index) { int num95 = 534; int num96 = (int) (85.0 + (double) (index * 56) * (double) Main.inventoryScale + 20.0); int slot = 54 + index; Microsoft.Xna.Framework.Color color16 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100); if (Main.mouseX >= num95 && (double) Main.mouseX <= (double) num95 + (double) Main.inventoryBackTexture.Width * (double) Main.inventoryScale && Main.mouseY >= num96 && (double) Main.mouseY <= (double) num96 + (double) Main.inventoryBackTexture.Height * (double) Main.inventoryScale && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; ItemSlot.OverrideHover(Main.player[Main.myPlayer].inventory, 2, slot); if (Main.mouseLeftRelease && Main.mouseLeft) { ItemSlot.LeftClick(Main.player[Main.myPlayer].inventory, 2, slot); Recipe.FindRecipes(); } else ItemSlot.RightClick(Main.player[Main.myPlayer].inventory, 2, slot); ItemSlot.MouseHover(Main.player[Main.myPlayer].inventory, 2, slot); } ItemSlot.Draw(Main.spriteBatch, Main.player[Main.myPlayer].inventory, 2, slot, new Vector2((float) num95, (float) num96)); } if (Main.npcShop > 0 && (!Main.playerInventory || Main.player[Main.myPlayer].talkNPC == -1)) Main.npcShop = 0; if (Main.npcShop > 0 && !Main.recBigList) { Utils.DrawBorderStringFourWay(Main.spriteBatch, Main.fontMouseText, 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 index9 = 0; index9 < 10; ++index9) { for (int index10 = 0; index10 < 4; ++index10) { int num97 = (int) (73.0 + (double) (index9 * 56) * (double) Main.inventoryScale); int num98 = (int) ((double) this.invBottom + (double) (index10 * 56) * (double) Main.inventoryScale); int slot = index9 + index10 * 10; Microsoft.Xna.Framework.Color color17 = new Microsoft.Xna.Framework.Color(100, 100, 100, 100); if (Main.mouseX >= num97 && (double) Main.mouseX <= (double) num97 + (double) Main.inventoryBackTexture.Width * (double) Main.inventoryScale && Main.mouseY >= num98 && (double) Main.mouseY <= (double) num98 + (double) Main.inventoryBackTexture.Height * (double) Main.inventoryScale && !PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft) ItemSlot.LeftClick(this.shop[Main.npcShop].item, 15, slot); else 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) num97, (float) num98)); } } } 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 num99 = 0; if (!PlayerInput.UsingGamepad) num99 = 9999; UIVirtualKeyboard.OffsetDown = num99; ChestUI.Draw(Main.spriteBatch); if (Main.player[Main.myPlayer].chest == -1 && Main.npcShop == 0) { int index = 0; int num100 = 498; int num101 = 244; int width = Main.chestStackTexture[index].Width; int height = Main.chestStackTexture[index].Height; UILinkPointNavigator.SetPosition(301, new Vector2((float) num100 + (float) width * 0.75f, (float) num101 + (float) height * 0.75f)); if (Main.mouseX >= num100 && Main.mouseX <= num100 + width && Main.mouseY >= num101 && Main.mouseY <= num101 + height && !PlayerInput.IgnoreMouseInterface) { index = 1; if (!Main.allChestStackHover) { Main.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) { Main.PlaySound(12); Main.allChestStackHover = false; } Main.spriteBatch.Draw(Main.chestStackTexture[index], new Vector2((float) num100, (float) num101), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chestStackTexture[index].Width, Main.chestStackTexture[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 num102 = 0; int num103 = 534; int num104 = 244; int num105 = 30; int num106 = 30; UILinkPointNavigator.SetPosition(302, new Vector2((float) num103 + (float) num105 * 0.75f, (float) num104 + (float) num106 * 0.75f)); bool flag6 = false; if (Main.mouseX >= num103 && Main.mouseX <= num103 + num105 && Main.mouseY >= num104 && Main.mouseY <= num104 + num106 && !PlayerInput.IgnoreMouseInterface) { num102 = 1; flag6 = true; Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeft && Main.mouseLeftRelease) { Main.mouseLeftRelease = false; ItemSorting.SortInventory(); Recipe.FindRecipes(); } } if (flag6 != Main.inventorySortMouseOver) { Main.PlaySound(12); Main.inventorySortMouseOver = flag6; } Texture2D texture1 = Main.inventorySortTexture[Main.inventorySortMouseOver ? 1 : 0]; Main.spriteBatch.Draw(texture1, new Vector2((float) num103, (float) num104), new Microsoft.Xna.Framework.Rectangle?(), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); if (Main.mouseText || num102 != 1) return; this.MouseText(Language.GetTextValue("GameUI.SortInventory")); } 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); ItemText.NewText(Main.mouseItem, r.createItem.stack); r.Create(); if (Main.mouseItem.type <= 0 && r.createItem.type <= 0) return; Main.PlaySound(7); } private static void DrawPVPIcons() { 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 && Main.mouseX < num2 + 34 && Main.mouseY > num3 - 2 && Main.mouseY < num3 + 34 && !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; Main.PlaySound(12); Main.player[Main.myPlayer].hostile = !Main.player[Main.myPlayer].hostile; NetMessage.SendData(30, number: Main.myPlayer); } } Microsoft.Xna.Framework.Rectangle r1 = Main.PVPTexture[0].Frame(4, 6); r1.Location = new Microsoft.Xna.Framework.Point(r1.Width * num4, r1.Height * Main.player[Main.myPlayer].team); r1.Width -= 2; Main.spriteBatch.Draw(Main.PVPTexture[0], 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 = Main.PVPTexture[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; Main.PlaySound(12); Main.player[Main.myPlayer].team = index; NetMessage.SendData(45, number: Main.myPlayer); } } } r2.Width = rectangle1.Width - 2; if (flag) Main.spriteBatch.Draw(Main.PVPTexture[2], r2.Location.ToVector2() + new Vector2(-2f), Microsoft.Xna.Framework.Color.White); Microsoft.Xna.Framework.Rectangle rectangle2 = rectangle1; rectangle2.Width -= 2; Main.spriteBatch.Draw(Main.PVPTexture[1], 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 num = -1; Vector2 vector2 = new Vector2((float) (Main.screenWidth - 162), (float) (142 + Main.mH)); vector2.X += 82f; Texture2D texture2D1 = Main.EquipPageTexture[Main.EquipPage == 2 ? 3 : 2]; 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(Main.EquipPageTexture[6], 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 = Main.EquipPageTexture[Main.EquipPage == 1 ? 5 : 4]; 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(Main.EquipPageTexture[7], 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 = Main.EquipPageTexture[Main.EquipPage == 3 ? 10 : 8]; 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(Main.EquipPageTexture[9], 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) Main.PlaySound(12); } } ItemSlot.EquipPage(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) { this.GUIBarsMouseOverLife(); this.GUIBarsMouseOverMana(); } IngameOptions.MouseOver(); IngameFancyUI.MouseOver(); if (!Main.mouseText) { for (int index = 0; index < 400; ++index) { if (Main.item[index].active) { Microsoft.Xna.Framework.Rectangle rectangle2 = new Microsoft.Xna.Framework.Rectangle((int) ((double) Main.item[index].position.X + (double) Main.item[index].width * 0.5 - (double) Main.itemTexture[Main.item[index].type].Width * 0.5), (int) ((double) Main.item[index].position.Y + (double) Main.item[index].height - (double) Main.itemTexture[Main.item[index].type].Height), Main.itemTexture[Main.item[index].type].Width, Main.itemTexture[Main.item[index].type].Height); if (rectangle1.Intersects(rectangle2)) { Main.player[Main.myPlayer].showItemIcon = false; string text = Main.item[index].AffixName(); if (Main.item[index].stack > 1) text = text + " (" + (object) Main.item[index].stack + ")"; if (Main.item[index].owner < (int) byte.MaxValue && Main.showItemOwner) text = text + " <" + Main.player[Main.item[index].owner].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) { 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].showItemIcon = 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 index1 = 0; index1 < 200; ++index1) { if (Main.npc[index1].active) { this.LoadNPC(Main.npc[index1].type); Microsoft.Xna.Framework.Rectangle rectangle4 = new Microsoft.Xna.Framework.Rectangle((int) Main.npc[index1].Bottom.X - Main.npc[index1].frame.Width / 2, (int) Main.npc[index1].Bottom.Y - Main.npc[index1].frame.Height, Main.npc[index1].frame.Width, Main.npc[index1].frame.Height); if (Main.npc[index1].type >= 87 && Main.npc[index1].type <= 92) rectangle4 = new Microsoft.Xna.Framework.Rectangle((int) ((double) Main.npc[index1].position.X + (double) Main.npc[index1].width * 0.5 - 32.0), (int) ((double) Main.npc[index1].position.Y + (double) Main.npc[index1].height * 0.5 - 32.0), 64, 64); bool flag1 = rectangle1.Intersects(rectangle4); bool flag2 = flag1 || Main.SmartInteractShowingGenuine && Main.SmartInteractNPC == index1; if (flag2 && (Main.npc[index1].type != 85 && Main.npc[index1].type != 341 && Main.npc[index1].aiStyle != 87 || (double) Main.npc[index1].ai[0] != 0.0) && Main.npc[index1].type != 488) { bool flag3 = Main.SmartInteractShowingGenuine && Main.SmartInteractNPC == index1; if ((Main.npc[index1].townNPC || Main.npc[index1].type == 105 || Main.npc[index1].type == 106 || Main.npc[index1].type == 123 || Main.npc[index1].type == 354 || Main.npc[index1].type == 376 || Main.npc[index1].type == 579 || Main.npc[index1].type == 453) && 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[index1].position.X, (int) Main.npc[index1].position.Y, Main.npc[index1].width, Main.npc[index1].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 = index1; if (Main.mouseRight && Main.npcChatRelease) { Main.npcChatRelease = false; if (PlayerInput.UsingGamepad) Main.player[Main.myPlayer].releaseInventory = false; if (Main.player[Main.myPlayer].talkNPC != index1) { Main.CancelHairWindow(); Main.npcShop = 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].talkNPC = index1; Main.playerInventory = false; Main.player[Main.myPlayer].chest = -1; Recipe.FindRecipes(); Main.npcChatText = Main.npc[index1].GetChat(); Main.PlaySound(24); } } } if (flag1) { Main.player[Main.myPlayer].showItemIcon = false; string text = Main.npc[index1].GivenOrTypeName; int index2 = index1; if (Main.npc[index1].realLife >= 0) index2 = Main.npc[index1].realLife; if (Main.npc[index2].lifeMax > 1 && !Main.npc[index2].dontTakeDamage) text = text + ": " + (object) Main.npc[index2].life + "/" + (object) Main.npc[index2].lifeMax; this.MouseTextHackZoom(text); Main.mouseText = true; break; } if (flag2) break; } } } } if (!Main.mouseText && Main.signHover != -1 && Main.sign[Main.signHover] != null && !Main.player[Main.myPlayer].mouseInterface) { int lineAmount; string[] strArray = Utils.WordwrapString(Main.sign[Main.signHover].text, Main.fontMouseText, 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 num = 0.0f; for (int index = 0; index < lineAmount; ++index) { float x = Main.fontMouseText.MeasureString(strArray[index]).X; if ((double) num < (double) x) num = x; } if ((double) num > 460.0) num = 460f; Vector2 vector2 = new Vector2((float) mouseX, (float) mouseY) + new Vector2(16f); if ((double) vector2.Y > (double) (screenHeight - 30 * lineAmount)) vector2.Y = (float) (screenHeight - 30 * lineAmount); if ((double) vector2.X > (double) screenWidth - (double) num) vector2.X = (float) screenWidth - num; for (int index = 0; index < lineAmount; ++index) Utils.DrawBorderStringFourWay(Main.spriteBatch, Main.fontMouseText, strArray[index], vector2.X, vector2.Y + (float) (index * 30), new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor), 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) Main.chatTexture.Height - (float) (int) Main.screenPosition.Y; 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) Main.chatTexture.Height; } Vector2 position = new Vector2(Main.npc[i].position.X + (float) (Main.npc[i].width / 2) - Main.screenPosition.X - (float) (Main.chatTexture.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(Main.chatTexture, position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chatTexture.Width, Main.chatTexture.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); } private void GUIBarsMouseOverLife() { if (Main.mouseText) return; int num1 = 26 * Main.player[Main.myPlayer].statLifeMax2 / (int) Main.UIDisplay_LifePerHeart; int num2 = 0; if (Main.player[Main.myPlayer].statLifeMax2 > 200) { num1 = 260; num2 += 26; } if (Main.mouseX <= 500 + Main.UI_ScreenAnchorX || Main.mouseX >= 500 + num1 + Main.UI_ScreenAnchorX || Main.mouseY <= 32 || Main.mouseY >= 32 + Main.heartTexture.Height + num2) return; Main.player[Main.myPlayer].showItemIcon = false; this.MouseTextHackZoom(Main.player[Main.myPlayer].statLife.ToString() + "/" + (object) Main.player[Main.myPlayer].statLifeMax2); Main.mouseText = true; } private void GUIBarsMouseOverMana() { if (Main.mouseText) return; int num1 = 24; int num2 = 28 * Main.player[Main.myPlayer].statManaMax2 / Main.UIDisplay_ManaPerStar; if (Main.mouseX <= 762 + Main.UI_ScreenAnchorX || Main.mouseX >= 762 + num1 + Main.UI_ScreenAnchorX || Main.mouseY <= 30 || Main.mouseY >= 30 + num2) return; Main.player[Main.myPlayer].showItemIcon = false; this.MouseTextHackZoom(Main.player[Main.myPlayer].statMana.ToString() + "/" + (object) Main.player[Main.myPlayer].statManaMax2); Main.mouseText = true; } public void GUIBarsDraw() { if (Main.ignoreErrors) { try { this.GUIBarsDrawInner(); } catch (Exception ex) { TimeLogger.DrawException(ex); } } else this.GUIBarsDrawInner(); } protected void GUIBarsDrawInner() { Main.UI_ScreenAnchorX = Main.screenWidth - 800; Main.DrawInterface_Resources_Life(); Main.DrawInterface_Resources_Mana(); 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.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, (Effect) null, Main.UIScaleMatrix); 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 static void DrawInterface_Resources_Life() { Main.UIDisplay_LifePerHeart = 20f; if (Main.LocalPlayer.ghost) return; int num1 = Main.player[Main.myPlayer].statLifeMax / 20; int num2 = (Main.player[Main.myPlayer].statLifeMax - 400) / 5; if (num2 < 0) num2 = 0; if (num2 > 0) { num1 = Main.player[Main.myPlayer].statLifeMax / (20 + num2 / 4); Main.UIDisplay_LifePerHeart = (float) Main.player[Main.myPlayer].statLifeMax / 20f; } int num3 = Main.player[Main.myPlayer].statLifeMax2 - Main.player[Main.myPlayer].statLifeMax; Main.UIDisplay_LifePerHeart += (float) (num3 / num1); int num4 = (int) ((double) Main.player[Main.myPlayer].statLifeMax2 / (double) Main.UIDisplay_LifePerHeart); if (num4 >= 10) num4 = 10; string str = Lang.inter[0].Value + " " + (object) Main.player[Main.myPlayer].statLifeMax2 + "/" + (object) Main.player[Main.myPlayer].statLifeMax2; Vector2 vector2 = Main.fontMouseText.MeasureString(str); if (!Main.player[Main.myPlayer].ghost) { DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, Lang.inter[0].Value, new Vector2((float) (500 + 13 * num4) - vector2.X * 0.5f + (float) Main.UI_ScreenAnchorX, 6f), 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); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, Main.player[Main.myPlayer].statLife.ToString() + "/" + (object) Main.player[Main.myPlayer].statLifeMax2, new Vector2((float) (500 + 13 * num4) + vector2.X * 0.5f + (float) Main.UI_ScreenAnchorX, 6f), new Microsoft.Xna.Framework.Color((int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor, (int) Main.mouseTextColor), 0.0f, new Vector2(Main.fontMouseText.MeasureString(Main.player[Main.myPlayer].statLife.ToString() + "/" + (object) Main.player[Main.myPlayer].statLifeMax2).X, 0.0f), 1f, SpriteEffects.None, 0.0f); } for (int index = 1; index < (int) ((double) Main.player[Main.myPlayer].statLifeMax2 / (double) Main.UIDisplay_LifePerHeart) + 1; ++index) { float scale = 1f; bool flag = false; int num5; if ((double) Main.player[Main.myPlayer].statLife >= (double) index * (double) Main.UIDisplay_LifePerHeart) { num5 = (int) byte.MaxValue; if ((double) Main.player[Main.myPlayer].statLife == (double) index * (double) Main.UIDisplay_LifePerHeart) flag = true; } else { float num6 = ((float) Main.player[Main.myPlayer].statLife - (float) (index - 1) * Main.UIDisplay_LifePerHeart) / Main.UIDisplay_LifePerHeart; num5 = (int) (30.0 + 225.0 * (double) num6); if (num5 < 30) num5 = 30; scale = (float) ((double) num6 / 4.0 + 0.75); if ((double) scale < 0.75) scale = 0.75f; if ((double) num6 > 0.0) flag = true; } if (flag) scale += Main.cursorScale - 1f; int num7 = 0; int num8 = 0; if (index > 10) { num7 -= 260; num8 += 26; } int a = (int) ((double) num5 * 0.9); if (!Main.player[Main.myPlayer].ghost) { if (num2 > 0) { --num2; Main.spriteBatch.Draw(Main.heart2Texture, new Vector2((float) (500 + 26 * (index - 1) + num7 + Main.UI_ScreenAnchorX + Main.heartTexture.Width / 2), (float) (32.0 + ((double) Main.heartTexture.Height - (double) Main.heartTexture.Height * (double) scale) / 2.0) + (float) num8 + (float) (Main.heartTexture.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.heartTexture.Width, Main.heartTexture.Height)), new Microsoft.Xna.Framework.Color(num5, num5, num5, a), 0.0f, new Vector2((float) (Main.heartTexture.Width / 2), (float) (Main.heartTexture.Height / 2)), scale, SpriteEffects.None, 0.0f); } else Main.spriteBatch.Draw(Main.heartTexture, new Vector2((float) (500 + 26 * (index - 1) + num7 + Main.UI_ScreenAnchorX + Main.heartTexture.Width / 2), (float) (32.0 + ((double) Main.heartTexture.Height - (double) Main.heartTexture.Height * (double) scale) / 2.0) + (float) num8 + (float) (Main.heartTexture.Height / 2)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.heartTexture.Width, Main.heartTexture.Height)), new Microsoft.Xna.Framework.Color(num5, num5, num5, a), 0.0f, new Vector2((float) (Main.heartTexture.Width / 2), (float) (Main.heartTexture.Height / 2)), scale, SpriteEffects.None, 0.0f); } } } private static void DrawInterface_Resources_Mana() { Main.UIDisplay_ManaPerStar = 20; if (Main.LocalPlayer.ghost || Main.player[Main.myPlayer].statManaMax2 <= 0) return; int num1 = Main.player[Main.myPlayer].statManaMax2 / 20; Vector2 vector2 = Main.fontMouseText.MeasureString(Lang.inter[2].Value); int num2 = 50; if ((double) vector2.X >= 45.0) num2 = (int) vector2.X + 5; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, Lang.inter[2].Value, new Vector2((float) (800 - num2 + Main.UI_ScreenAnchorX), 6f), 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); for (int index = 1; index < Main.player[Main.myPlayer].statManaMax2 / Main.UIDisplay_ManaPerStar + 1; ++index) { bool flag = false; float scale = 1f; int num3; if (Main.player[Main.myPlayer].statMana >= index * Main.UIDisplay_ManaPerStar) { num3 = (int) byte.MaxValue; if (Main.player[Main.myPlayer].statMana == index * Main.UIDisplay_ManaPerStar) flag = true; } else { float num4 = (float) (Main.player[Main.myPlayer].statMana - (index - 1) * Main.UIDisplay_ManaPerStar) / (float) Main.UIDisplay_ManaPerStar; 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; if ((double) num4 > 0.0) flag = true; } if (flag) scale += Main.cursorScale - 1f; int a = (int) ((double) num3 * 0.9); Main.spriteBatch.Draw(Main.manaTexture, new Vector2((float) (775 + Main.UI_ScreenAnchorX), (float) (30 + Main.manaTexture.Height / 2) + (float) (((double) Main.manaTexture.Height - (double) Main.manaTexture.Height * (double) scale) / 2.0) + (float) (28 * (index - 1))), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.manaTexture.Width, Main.manaTexture.Height)), new Microsoft.Xna.Framework.Color(num3, num3, num3, a), 0.0f, new Vector2((float) (Main.manaTexture.Width / 2), (float) (Main.manaTexture.Height / 2)), scale, SpriteEffects.None, 0.0f); } } private void DrawInterface_Resources_Buffs() { Main.recBigList = false; int drawBuffText = -1; int num1 = 11; for (int i = 0; i < 22; ++i) { if (Main.player[Main.myPlayer].buffType[i] > 0) { int b = Main.player[Main.myPlayer].buffType[i]; int x = 32 + i * 38; int y = 76; if (i >= num1) { x = 32 + (i - num1) * 38; y += 50; } drawBuffText = Main.DrawBuffIcon(drawBuffText, i, b, x, y); } else Main.buffAlpha[i] = 0.4f; } if (drawBuffText < 0) return; int id = Main.player[Main.myPlayer].buffType[drawBuffText]; if (id <= 0) return; Main.buffString = Lang.GetBuffDescription(id); if (id == 26 && Main.expertMode) Main.buffString = Language.GetTextValue("BuffDescription.WellFed_Expert"); if (id == 147) Main.bannerMouseOver = true; if (id == 94) { int num2 = (int) ((double) Main.player[Main.myPlayer].manaSickReduction * 100.0) + 1; Main.buffString = Main.buffString + (object) num2 + "%"; } if (Main.meleeBuff[id]) this.MouseTextHackZoom(Lang.GetBuffName(id), -10); else this.MouseTextHackZoom(Lang.GetBuffName(id)); } private static int DrawBuffIcon(int drawBuffText, int i, int b, int x, int y) { if (b == 0) return drawBuffText; Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(Main.buffAlpha[i], Main.buffAlpha[i], Main.buffAlpha[i], Main.buffAlpha[i]); Main.spriteBatch.Draw(Main.buffTexture[b], new Vector2((float) x, (float) y), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.buffTexture[b].Width, Main.buffTexture[b].Height)), color, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); if (!Main.vanityPet[b] && !Main.lightPet[b] && !Main.buffNoTimeDisplay[b] && (!Main.player[Main.myPlayer].honeyWet || b != 48) && (!Main.player[Main.myPlayer].wet || !Main.expertMode || b != 46) && Main.player[Main.myPlayer].buffTime[i] > 2) { string str = Lang.LocalizedDuration(new TimeSpan(0, 0, Main.player[Main.myPlayer].buffTime[i] / 60), true, false); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontItemStack, str, new Vector2((float) x, (float) (y + Main.buffTexture[b].Height)), color, 0.0f, new Vector2(), 0.8f, SpriteEffects.None, 0.0f); } if (Main.mouseX < x + Main.buffTexture[b].Width && Main.mouseY < y + Main.buffTexture[b].Height && Main.mouseX > x && Main.mouseY > y) { drawBuffText = i; Main.buffAlpha[i] += 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(i, b); } else Main.buffAlpha[i] -= 0.05f; if ((double) Main.buffAlpha[i] > 1.0) Main.buffAlpha[i] = 1f; else if ((double) Main.buffAlpha[i] < 0.4) Main.buffAlpha[i] = 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; } if (Main.player[Main.myPlayer].miscEquips[0].buffType == b && !Main.player[Main.myPlayer].hideMisc[0]) Main.player[Main.myPlayer].hideMisc[0] = true; if (Main.player[Main.myPlayer].miscEquips[1].buffType == b && !Main.player[Main.myPlayer].hideMisc[1]) Main.player[Main.myPlayer].hideMisc[1] = true; Main.PlaySound(12); if (flag) return; Main.player[Main.myPlayer].DelBuff(i); } 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(Main.bubbleTexture, vector2_3 + new Vector2((float) (26 * (index - 1) + num5) - 125f, (float) (32.0 + ((double) Main.bubbleTexture.Height - (double) Main.bubbleTexture.Height * (double) scale) / 2.0) + (float) num6), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.bubbleTexture.Width, Main.bubbleTexture.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(Main.flameTexture, vector2_3 + new Vector2((float) (26 * (index - 1) + num11) - 125f, (float) (32.0 + ((double) Main.flameTexture.Height - (double) Main.flameTexture.Height * (double) scale) / 2.0) + (float) num12), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.bubbleTexture.Width, Main.bubbleTexture.Height)), new Microsoft.Xna.Framework.Color(num9, num9, num9, num9), 0.0f, new Vector2(), scale, 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 = Main.fontMouseText.MeasureString(str) / 2f; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, 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) Main.inventoryBackTexture.Width * (double) Main.hotbarScale[slot] && Main.mouseY >= num3 && (double) Main.mouseY <= (double) num3 + (double) Main.inventoryBackTexture.Height * (double) Main.hotbarScale[slot] && !Main.player[Main.myPlayer].channel) { Main.player[Main.myPlayer].mouseInterface = true; Main.player[Main.myPlayer].showItemIcon = 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) Main.inventoryBackTexture.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; Main.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].talkNPC = -1; Main.PlaySound(11); } public static void BuyHairWindow() { Main.PlaySound(18); Main.hairWindow = false; Main.player[Main.myPlayer].talkNPC = -1; Main.npcChatCornerItem = 0; NetMessage.SendData(4, number: Main.myPlayer); } public static int UnlockedMaxHair() { int num = 123; 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 { int num1 = Main.UnlockedMaxHair(); int y1 = Main.screenHeight / 2 + 60; int x1 = Main.screenWidth / 2 - Main.hairStyleBackTexture.Width / 2; int num2 = y1 + 42; int num3 = x1 + 22; int num4 = x1 + 234; int num5 = y1 + 18; Main.selColor = Main.player[Main.myPlayer].hairColor; Main.spriteBatch.Draw(Main.hairStyleBackTexture, new Vector2((float) x1, (float) y1), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.hairStyleBackTexture.Width, Main.hairStyleBackTexture.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, Main.hairStyleBackTexture.Width, Main.hairStyleBackTexture.Height).Contains(Main.MouseScreen.ToPoint())) { int num6 = -(PlayerInput.ScrollWheelDelta / 120); int num7 = Math.Sign(num6); for (; num6 != 0; num6 -= num7) { if (num6 < 0) { Main.hairStart -= 5; Main.PlaySound(12); } else { Main.hairStart += 5; Main.PlaySound(12); } } } if (Main.mouseX > x1 && Main.mouseX < x1 + Main.hairStyleBackTexture.Width && Main.mouseY > y1 && Main.mouseY < y1 + Main.hairStyleBackTexture.Height) Main.player[Main.myPlayer].mouseInterface = true; int num8 = num4 - 18; int num9 = num5 + 74; if (Main.hairStart > 1) { if (Main.mouseX >= num8 && Main.mouseX <= num8 + Main.craftUpButtonTexture.Width && Main.mouseY >= num9 && Main.mouseY <= num9 + Main.craftUpButtonTexture.Height) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft) { Main.hairStart -= 15; Main.PlaySound(12); } } Main.spriteBatch.Draw(Main.scrollLeftButtonTexture, new Vector2((float) num8, (float) num9), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.craftUpButtonTexture.Width, Main.craftUpButtonTexture.Height)), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (Main.hairStart + 15 < num1) { int num10 = num8 + 296; if (Main.mouseX >= num10 && Main.mouseX <= num10 + Main.craftUpButtonTexture.Width && Main.mouseY >= num9 && Main.mouseY <= num9 + Main.craftUpButtonTexture.Height) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft) { Main.hairStart += 15; Main.PlaySound(12); } } Main.spriteBatch.Draw(Main.scrollRightButtonTexture, new Vector2((float) num10, (float) num9), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.craftUpButtonTexture.Width, Main.craftUpButtonTexture.Height)), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (Main.hairStart + 15 >= num1) Main.hairStart = num1 - 15; if (Main.hairStart < 0) Main.hairStart = 0; int num11 = 0; if (Main.oldHairStyle != Main.player[Main.myPlayer].hair) { if (Main.player[Main.myPlayer].hair > 51) num11 += 50000; else num11 += 10000; } if (Main.oldHairColor != Main.player[Main.myPlayer].hairColor) num11 += 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; 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) Main.fontMouseText.MeasureString(str2).X && Main.mouseY > num20 && (double) Main.mouseY < (double) num20 + (double) Main.fontMouseText.MeasureString(str2).Y) { num18 = 1.1f; if (!Main.npcChatFocus1) Main.PlaySound(12); Main.npcChatFocus1 = true; Main.player[Main.myPlayer].releaseUseItem = false; } else { if (Main.npcChatFocus1) Main.PlaySound(12); Main.npcChatFocus1 = false; } Vector2 vector2_1 = Main.fontMouseText.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 (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, Main.fontMouseText, 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; if (Main.mouseX > num24 && (double) Main.mouseX < (double) num24 + (double) Main.fontMouseText.MeasureString(textValue2).X && Main.mouseY > num20 && (double) Main.mouseY < (double) num20 + (double) Main.fontMouseText.MeasureString(textValue2).Y) { num23 = 1.1f; if (!Main.npcChatFocus2) Main.PlaySound(12); Main.npcChatFocus2 = true; Main.player[Main.myPlayer].releaseUseItem = false; } else { if (Main.npcChatFocus2) Main.PlaySound(12); Main.npcChatFocus2 = false; } Vector2 vector2_2 = Main.fontMouseText.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 (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, Main.fontMouseText, 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) num3, (float) num2) + this.hueTexture.Size() / 2f); Main.spriteBatch.Draw(this.hueTexture, new Vector2((float) num3, (float) num2), Microsoft.Xna.Framework.Color.White); if (Main.mouseX > num3 - 4 && Main.mouseX < num3 + this.hueTexture.Width + 4 && Main.mouseY > num2 - 4 && Main.mouseY < num2 + this.hueTexture.Height + 4 || this.grabColorSlider == 1) Main.spriteBatch.Draw(Main.colorHighlightTexture, new Vector2((float) num3, (float) num2), Main.OurFavoriteColor); Main.spriteBatch.Draw(Main.colorSliderTexture, new Vector2((float) num3 + (float) (this.hueTexture.Width - 2) * Main.hBar - (float) (Main.colorSliderTexture.Width / 2), (float) (num2 - Main.colorSliderTexture.Height / 2 + this.hueTexture.Height / 2)), Microsoft.Xna.Framework.Color.White); if ((Main.mouseX > num3 - 4 && Main.mouseX < num3 + this.hueTexture.Width + 4 && Main.mouseY > num2 - 4 && Main.mouseY < num2 + this.hueTexture.Height + 4 || this.grabColorSlider == 1) && Main.mouseLeft && !Main.blockMouse) { this.grabColorSlider = 1; Hue = (float) (Main.mouseX - num3) / (float) this.hueTexture.Width; if ((double) Hue < 0.0) Hue = 0.0f; if ((double) Hue > 1.0) Hue = 1f; Main.hBar = Hue; } int num29 = num2 + 26; UILinkPointNavigator.SetPosition(2601, new Vector2((float) num3, (float) num29) + Main.colorBarTexture.Size() / 2f); Main.spriteBatch.Draw(Main.colorBarTexture, new Vector2((float) num3, (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(Main.colorBlipTexture, new Vector2((float) (num3 + index + 5), (float) (num29 + 4)), rgb); } if (Main.mouseX > num3 - 4 && Main.mouseX < num3 + this.hueTexture.Width + 4 && Main.mouseY > num29 - 4 && Main.mouseY < num29 + this.hueTexture.Height + 4 || this.grabColorSlider == 2) Main.spriteBatch.Draw(Main.colorHighlightTexture, new Vector2((float) num3, (float) num29), Main.OurFavoriteColor); Main.spriteBatch.Draw(Main.colorSliderTexture, new Vector2((float) num3 + (float) (this.hueTexture.Width - 2) * Main.sBar - (float) (Main.colorSliderTexture.Width / 2), (float) (num29 - Main.colorSliderTexture.Height / 2 + this.hueTexture.Height / 2)), Microsoft.Xna.Framework.Color.White); if ((Main.mouseX > num3 - 4 && Main.mouseX < num3 + this.hueTexture.Width + 4 && Main.mouseY > num29 - 4 && Main.mouseY < num29 + this.hueTexture.Height + 4 || this.grabColorSlider == 2) && Main.mouseLeft && !Main.blockMouse) { this.grabColorSlider = 2; Saturation1 = (float) (Main.mouseX - num3) / (float) this.hueTexture.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) num3, (float) num30) + Main.colorBarTexture.Size() / 2f); Main.spriteBatch.Draw(Main.colorBarTexture, new Vector2((float) num3, (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(Main.colorBlipTexture, new Vector2((float) (num3 + index + 5), (float) (num30 + 4)), rgb); } if (Main.mouseX > num3 - 4 && Main.mouseX < num3 + this.hueTexture.Width + 4 && Main.mouseY > num30 - 4 && Main.mouseY < num30 + this.hueTexture.Height + 4 || this.grabColorSlider == 3) Main.spriteBatch.Draw(Main.colorHighlightTexture, new Vector2((float) num3, (float) num30), Main.OurFavoriteColor); Main.spriteBatch.Draw(Main.colorSliderTexture, new Vector2((float) num3 + (float) (this.hueTexture.Width - 2) * (float) (((double) Main.lBar - (double) num31) / (1.0 - (double) num31)) - (float) (Main.colorSliderTexture.Width / 2), (float) (num30 - Main.colorSliderTexture.Height / 2 + this.hueTexture.Height / 2)), Microsoft.Xna.Framework.Color.White); if ((Main.mouseX > num3 - 4 && Main.mouseX < num3 + this.hueTexture.Width + 4 && Main.mouseY > num30 - 4 && Main.mouseY < num30 + this.hueTexture.Height + 4 || this.grabColorSlider == 3) && Main.mouseLeft && !Main.blockMouse) { this.grabColorSlider = 3; float num32 = (float) (Main.mouseX - num3) / (float) this.hueTexture.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 num33 = num4; int num34 = num5; int hairStart = Main.hairStart; int index1 = 0; int num35 = 0; for (int index2 = 0; index2 < 15; ++index2) { int i = Main.hairStart + index2; UILinkPointNavigator.SetPosition(2605 + index2, new Vector2((float) num33, (float) num34) + Main.inventoryBackTexture.Size() * 0.75f); if (Main.player[Main.myPlayer].hair == i) Main.spriteBatch.Draw(Main.inventoryBack14Texture, new Vector2((float) num33, (float) num34), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height)), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); else Main.spriteBatch.Draw(Main.inventoryBack8Texture, new Vector2((float) num33, (float) num34), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height)), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); if (Main.mouseX > num33 && Main.mouseX < num33 + Main.inventoryBackTexture.Width && Main.mouseY > num34 && Main.mouseY < num34 + Main.inventoryBackTexture.Height && Main.mouseLeft && Main.mouseLeftRelease) { Main.mouseLeftRelease = false; Main.player[Main.myPlayer].hair = i; Main.PlaySound(12); } this.LoadHair(i); float x2 = (float) (num33 + Main.inventoryBackTexture.Width / 2 - Main.playerHairTexture[i].Width / 2); float y2 = (float) (num34 + 4); Main.spriteBatch.Draw(Main.playerTextures[index1, 0], new Vector2(x2, y2), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.playerHairTexture[i].Width, 56)), Main.player[Main.myPlayer].skinColor, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(Main.playerTextures[index1, 1], new Vector2(x2, y2), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.playerHairTexture[i].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(Main.playerTextures[index1, 2], new Vector2(x2, y2), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.playerHairTexture[i].Width, 56)), Main.player[Main.myPlayer].eyeColor, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(Main.playerHairTexture[i], new Vector2(x2, y2), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.playerHairTexture[i].Width, 56)), Main.selColor, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); ++num35; num33 += 56; if (num35 >= 5) { num35 = 0; num33 = num4; num34 += 56; } } } } public static void OpenClothesWindow() { Main.hBar = -1f; Main.lBar = -1f; Main.sBar = -1f; Main.playerInventory = false; Main.npcChatText = ""; Main.clothesWindow = true; Main.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; if (Main.dresserDummy == null) Main.dresserDummy = 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) Main.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.dresserDummy.skinVariant = Main.oldClothesStyle; Main.dresserDummy.Male = Main.player[Main.myPlayer].Male; Main.player[Main.myPlayer].skinVariant = Main.dresserDummy.skinVariant; } public static void SaveClothesWindow() { Main.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 { int num1 = (int) (((double) Main.player[Main.myPlayer].position.X + (double) Main.player[Main.myPlayer].width * 0.5) / 16.0); int num2 = (int) (((double) Main.player[Main.myPlayer].position.Y + (double) Main.player[Main.myPlayer].height * 0.5) / 16.0); if (num1 < Main.dresserX - 5 || num1 > Main.dresserX + 6 || num2 < Main.dresserY - 4 || num2 > Main.dresserY + 5 || !Main.tile[Main.dresserX, Main.dresserY].active()) { Main.CancelClothesWindow(); } else { int num3 = 477 / 2; int num4 = 124; int num5 = 511; int width = num5 - (num5 / 2 - num4 - 26); int y1 = Main.screenHeight / 2 + 60; int x1 = Main.screenWidth / 2 - width / 2; int num6 = y1 + 32; int num7 = x1 + 22; int num8 = num6 - 16; int num9 = x1 + width - num4; int num10 = 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; Utils.DrawInvBG(Main.spriteBatch, new Microsoft.Xna.Framework.Rectangle(x1, y1, width, 133)); if (!PlayerInput.IgnoreMouseInterface && Main.mouseX > x1 && Main.mouseX < x1 + Main.clothesStyleBackTexture.Width && Main.mouseY > y1 && Main.mouseY < y1 + Main.clothesStyleBackTexture.Height) Main.player[Main.myPlayer].mouseInterface = true; Vector2 vector2_1 = new Vector2((float) (x1 + width / 2 - 16), (float) (y1 + 66 + Main.dresserDummy.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.dresserDummy.width / 2 - 15, (int) vector2_1.Y - Main.dresserDummy.height - 33, Main.dresserDummy.width + 30, Main.dresserDummy.height + 66); bool flag1 = R.Contains(Main.MouseScreen.ToPoint()); int selClothes = Main.selClothes; int num11 = ((int) Main.mouseTextColor * 2 + (int) byte.MaxValue) / 3; Microsoft.Xna.Framework.Color color1 = new Microsoft.Xna.Framework.Color(num11, (int) ((double) num11 / 1.1), num11 / 2, num11); float num12 = 0.9f; string textValue1 = Language.GetTextValue("GameUI.Change"); int num13 = x1 + width - num4 + 22; int num14 = x1 + 22; int num15 = 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.oldClothesStyle != Main.player[Main.myPlayer].skinVariant) flag2 = true; Vector2 vector2_2 = Main.fontMouseText.MeasureString(textValue1); UILinkPointNavigator.SetPosition(2803, new Vector2((float) num14, (float) num15) + vector2_2 * num12 * 0.5f); if (flag2 && Main.mouseX > num14 && (double) Main.mouseX < (double) num14 + (double) vector2_2.X && Main.mouseY > num15 && (double) Main.mouseY < (double) num15 + (double) vector2_2.Y) { num12 = 1.1f; if (!Main.npcChatFocus1) Main.PlaySound(12); Main.npcChatFocus1 = true; Main.player[Main.myPlayer].releaseUseItem = false; } else { if (Main.npcChatFocus1) Main.PlaySound(12); Main.npcChatFocus1 = false; } for (int index = 0; index < 5; ++index) { int num16 = num14; int num17 = num15; Microsoft.Xna.Framework.Color color2 = Microsoft.Xna.Framework.Color.Black; if (index == 0) num16 -= 2; if (index == 1) num16 += 2; if (index == 2) num17 -= 2; if (index == 3) num17 += 2; if (index == 4) color2 = flag2 ? color1 : new Microsoft.Xna.Framework.Color(100, 100, 100); Vector2 vector2_3 = Main.fontMouseText.MeasureString(textValue1) * 0.5f; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, textValue1, new Vector2((float) num16 + vector2_3.X, (float) num17 + vector2_3.Y), color2, 0.0f, vector2_3, num12, SpriteEffects.None, 0.0f); } float num18 = 0.9f; string textValue2 = Language.GetTextValue("GameUI.Cancel"); int num19 = num14 + 130; Vector2 vector2_4 = Main.fontMouseText.MeasureString(textValue2); UILinkPointNavigator.SetPosition(2804, new Vector2((float) num19, (float) num15) + vector2_4 * num18 * 0.5f); if (Main.mouseX > num19 && (double) Main.mouseX < (double) num19 + (double) vector2_4.X && Main.mouseY > num15 && (double) Main.mouseY < (double) num15 + (double) vector2_4.Y) { num18 = 1.1f; if (!Main.npcChatFocus2) Main.PlaySound(12); Main.npcChatFocus2 = true; Main.player[Main.myPlayer].releaseUseItem = false; } else { if (Main.npcChatFocus2) Main.PlaySound(12); Main.npcChatFocus2 = false; } for (int index = 0; index < 5; ++index) { int num20 = num19; int num21 = num15; Microsoft.Xna.Framework.Color color3 = Microsoft.Xna.Framework.Color.Black; if (index == 0) num20 -= 2; if (index == 1) num20 += 2; if (index == 2) num21 -= 2; if (index == 3) num21 += 2; if (index == 4) color3 = color1; Vector2 vector2_5 = Main.fontMouseText.MeasureString(textValue2) * 0.5f; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, textValue2, new Vector2((float) num20 + vector2_5.X, (float) num21 + vector2_5.Y), color3, 0.0f, vector2_5, num18, 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 num22 = 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(this.hueTexture, new Vector2((float) num7, (float) num8), Microsoft.Xna.Framework.Color.White); if (Main.mouseX > num7 - 4 && Main.mouseX < num7 + this.hueTexture.Width + 4 && Main.mouseY > num8 - 4 && Main.mouseY < num8 + this.hueTexture.Height + 4 || this.grabColorSlider == 1) Main.spriteBatch.Draw(Main.colorHighlightTexture, new Vector2((float) num7, (float) num8), Main.OurFavoriteColor); Main.spriteBatch.Draw(Main.colorSliderTexture, new Vector2((float) num7 + (float) (this.hueTexture.Width - 2) * Main.hBar - (float) (Main.colorSliderTexture.Width / 2), (float) (num8 - Main.colorSliderTexture.Height / 2 + this.hueTexture.Height / 2)), Microsoft.Xna.Framework.Color.White); if ((Main.mouseX > num7 - 4 && Main.mouseX < num7 + this.hueTexture.Width + 4 && Main.mouseY > num8 - 4 && Main.mouseY < num8 + this.hueTexture.Height + 4 || this.grabColorSlider == 1) && Main.mouseLeft && !Main.blockMouse) { this.grabColorSlider = 1; Hue = (float) (Main.mouseX - num7) / (float) this.hueTexture.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) num7, (float) num8) + this.hueTexture.Size() / 2f); int num23 = num8 + 26; Main.spriteBatch.Draw(Main.colorBarTexture, new Vector2((float) num7, (float) num23), Microsoft.Xna.Framework.Color.White); for (int index = 0; index <= num22; ++index) { float Saturation2 = (float) index / (float) num22; Microsoft.Xna.Framework.Color rgb = Main.hslToRgb(Hue, Saturation2, Luminosity1); Main.spriteBatch.Draw(Main.colorBlipTexture, new Vector2((float) (num7 + index + 5), (float) (num23 + 4)), rgb); } if (Main.mouseX > num7 - 4 && Main.mouseX < num7 + this.hueTexture.Width + 4 && Main.mouseY > num23 - 4 && Main.mouseY < num23 + this.hueTexture.Height + 4 || this.grabColorSlider == 2) Main.spriteBatch.Draw(Main.colorHighlightTexture, new Vector2((float) num7, (float) num23), Main.OurFavoriteColor); Main.spriteBatch.Draw(Main.colorSliderTexture, new Vector2((float) num7 + (float) (this.hueTexture.Width - 2) * Main.sBar - (float) (Main.colorSliderTexture.Width / 2), (float) (num23 - Main.colorSliderTexture.Height / 2 + this.hueTexture.Height / 2)), Microsoft.Xna.Framework.Color.White); if ((Main.mouseX > num7 - 4 && Main.mouseX < num7 + this.hueTexture.Width + 4 && Main.mouseY > num23 - 4 && Main.mouseY < num23 + this.hueTexture.Height + 4 || this.grabColorSlider == 2) && Main.mouseLeft && !Main.blockMouse) { this.grabColorSlider = 2; Saturation1 = (float) (Main.mouseX - num7) / (float) this.hueTexture.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) num7, (float) num23) + this.hueTexture.Size() / 2f); int num24 = num23 + 26; Main.spriteBatch.Draw(Main.colorBarTexture, new Vector2((float) num7, (float) num24), Microsoft.Xna.Framework.Color.White); float num25 = 0.15f; for (int index = 0; index <= num22; ++index) { float Luminosity2 = (float) index / (float) num22; Microsoft.Xna.Framework.Color rgb = Main.hslToRgb(Hue, Saturation1, Luminosity2); Main.spriteBatch.Draw(Main.colorBlipTexture, new Vector2((float) (num7 + index + 5), (float) (num24 + 4)), rgb); } if (Main.mouseX > num7 - 4 && Main.mouseX < num7 + this.hueTexture.Width + 4 && Main.mouseY > num24 - 4 && Main.mouseY < num24 + this.hueTexture.Height + 4 || this.grabColorSlider == 3) Main.spriteBatch.Draw(Main.colorHighlightTexture, new Vector2((float) num7, (float) num24), Main.OurFavoriteColor); Main.spriteBatch.Draw(Main.colorSliderTexture, new Vector2((float) num7 + (float) (this.hueTexture.Width - 2) * (float) (((double) Main.lBar - (double) num25) / (1.0 - (double) num25)) - (float) (Main.colorSliderTexture.Width / 2), (float) (num24 - Main.colorSliderTexture.Height / 2 + this.hueTexture.Height / 2)), Microsoft.Xna.Framework.Color.White); if ((Main.mouseX > num7 - 4 && Main.mouseX < num7 + this.hueTexture.Width + 4 && Main.mouseY > num24 - 4 && Main.mouseY < num24 + this.hueTexture.Height + 4 || this.grabColorSlider == 3) && Main.mouseLeft && !Main.blockMouse) { this.grabColorSlider = 3; float num26 = (float) (Main.mouseX - num7) / (float) this.hueTexture.Width; if ((double) num26 < 0.0) num26 = 0.0f; if ((double) num26 > 1.0) num26 = 1f; Main.lBar = num26 * (1f - num25) + num25; } UILinkPointNavigator.SetPosition(2802, new Vector2((float) num7, (float) num24) + this.hueTexture.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; int num27 = num9; int num28 = num10 - 8; for (int index = 0; index < 4; ++index) { if (selClothes == index) Main.spriteBatch.Draw(Main.inventoryBack14Texture, new Vector2((float) num27, (float) num28), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height)), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); else Main.spriteBatch.Draw(Main.inventoryBack8Texture, new Vector2((float) num27, (float) num28), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height)), new Microsoft.Xna.Framework.Color(200, 200, 200, 200), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); if (Main.mouseX > num27 && Main.mouseX < num27 + Main.inventoryBackTexture.Width && Main.mouseY > num28 && Main.mouseY < num28 + Main.inventoryBackTexture.Height && Main.mouseLeft && Main.mouseLeftRelease) { Main.mouseLeftRelease = false; Main.selClothes = index; Main.PlaySound(12); Main.hBar = -1f; Main.lBar = -1f; Main.sBar = -1f; } float x2 = (float) (num27 + Main.inventoryBackTexture.Width / 2 - Main.clothesTexture[index].Width / 2); float y2 = (float) (num28 + Main.inventoryBackTexture.Height / 2 - Main.clothesTexture[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; Main.spriteBatch.Draw(Main.clothesTexture[index], new Vector2(x2, y2), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.clothesTexture[index].Width, Main.clothesTexture[index].Height)), color4, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); UILinkPointNavigator.SetPosition(2806 + index, new Vector2(x2, y2) + Main.clothesTexture[index].Size() * 0.75f); num27 += 56; if (index == 1) { num27 -= 112; num28 += 56; } } Main.dresserDummy.skinVariant = Main.player[Main.myPlayer].skinVariant; Main.dresserDummy.eyeColor = Main.player[Main.myPlayer].eyeColor; Main.dresserDummy.hairColor = Main.player[Main.myPlayer].hairColor; Main.dresserDummy.skinColor = Main.player[Main.myPlayer].skinColor; Main.dresserDummy.shirtColor = Main.player[Main.myPlayer].shirtColor; Main.dresserDummy.underShirtColor = Main.player[Main.myPlayer].underShirtColor; Main.dresserDummy.shoeColor = Main.player[Main.myPlayer].shoeColor; Main.dresserDummy.pantsColor = Main.player[Main.myPlayer].pantsColor; Main.dresserDummy.Bottom = Main.screenPosition + vector2_1; Main.dresserDummy.direction = -1; Main.dresserDummy.gravDir = 1f; Main.dresserDummy.PlayerFrame(); Main.dresserDummy.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; Main.PlaySound(12); Main.CycleClothingStyle(Main.player[Main.myPlayer]); } } UILinkPointNavigator.SetPosition(2805, R.Center.ToVector2()); Utils.DrawInvBG(Main.spriteBatch, R, c); this.DrawPlayer(Main.dresserDummy, Main.dresserDummy.position, Main.dresserDummy.fullRotation, Main.dresserDummy.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[42] { (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Interface Logic 1", (GameInterfaceDrawMethod) (() => { Main.DrawInterface_0_InterfaceLogic1(); return true; })), (GameInterfaceLayer) new LegacyGameInterfaceLayer("Vanilla: Emote Bubbles", (GameInterfaceDrawMethod) (() => { Main.DrawInterface_1_EmoteBubbles(); 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)), (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: MP Player Names", (GameInterfaceDrawMethod) (() => { Main.DrawInterface_20_MultiplayerPlayerNames(); return true; }), InterfaceScaleType.UI), (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; })), (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; })) }); } 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 DrawInterface_41_InterfaceLogic4() { Main.npcChatRelease = !Main.mouseRight; Main.cursorOverride = -1; Main._MouseOversCanClear = true; } private void DrawInterface_40_InteractItemIcon() { int type = Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type; if (Main.player[Main.myPlayer].showItemIcon2 != 0) type = Main.player[Main.myPlayer].showItemIcon2; bool flag1 = Main.player[Main.myPlayer].showItemIcon && (Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type > 0 || (uint) Main.player[Main.myPlayer].showItemIcon2 > 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].showItemIcon2); 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].showItemIcon2 != 0) { currentColor = Microsoft.Xna.Framework.Color.White; color = new Microsoft.Xna.Framework.Color(); } if (Main.player[Main.myPlayer].showItemIcon2 == 269) currentColor = Main.player[Main.myPlayer].shirtColor; float cursorScale = Main.cursorScale; ItemSlot.GetItemLight(ref currentColor, type); SpriteEffects effects = SpriteEffects.None; if ((Main.player[Main.myPlayer].showItemIcon2 == 928 || Main.player[Main.myPlayer].showItemIcon2 == 1337 || Main.player[Main.myPlayer].showItemIcon2 == 3369) && Main.player[Main.myPlayer].showItemIconR) effects = SpriteEffects.FlipHorizontally; if (type > 0) Main.spriteBatch.Draw(Main.itemTexture[type], new Vector2((float) (Main.mouseX + 10), (float) (Main.mouseY + 10)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[type].Width, Main.itemTexture[type].Height)), currentColor, 0.0f, new Vector2(), cursorScale, effects, 0.0f); if (Main.player[Main.myPlayer].showItemIconText != "") this.MouseText(Main.player[Main.myPlayer].showItemIconText); if (Main.player[Main.myPlayer].showItemIcon2 == 0 && Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].color != new Microsoft.Xna.Framework.Color()) Main.spriteBatch.Draw(Main.itemTexture[Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type], new Vector2((float) (Main.mouseX + 10), (float) (Main.mouseY + 10)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type].Width, Main.itemTexture[Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type].Height)), color, 0.0f, new Vector2(), cursorScale, SpriteEffects.None, 0.0f); if (flag1) return; Utils.Swap(ref cacheSelectedItemId, ref Main.player[Main.myPlayer].showItemIcon2); } 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.mouseNPC = -1; Main.player[Main.myPlayer].showItemIcon = false; Main.player[Main.myPlayer].showItemIcon2 = 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.mouseNPC <= -1) return; float scale = 1f * Main.cursorScale; Main.spriteBatch.Draw(Main.npcHeadTexture[this.mouseNPC], new Vector2((float) ((double) Main.mouseX + 26.0 * (double) scale - (double) Main.npcHeadTexture[this.mouseNPC].Width * 0.5 * (double) scale), (float) ((double) Main.mouseY + 26.0 * (double) scale - (double) Main.npcHeadTexture[this.mouseNPC].Height * 0.5 * (double) scale)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.npcHeadTexture[this.mouseNPC].Width, Main.npcHeadTexture[this.mouseNPC].Height)), 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) { Main.PlaySound(12); this.mouseNPC = -1; } if (!Main.mouseLeft || !Main.mouseLeftRelease) return; if (this.mouseNPC == 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 n = 0; for (int index = 0; index < 200; ++index) { if (Main.npc[index].active && Main.npc[index].type == NPC.HeadIndexToType(this.mouseNPC)) { n = index; break; } } if (n >= 0) { 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, n)) return; this.mouseNPC = -1; WorldGen.moveRoom(x, y, n); Main.PlaySound(12); } else this.mouseNPC = 0; } } } private static void DrawInterface_37_DebugStuff() { } private static void DrawInterface_36_Cursor() { 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(Main.cursorTextures[Main.cursorOverride], new Vector2((float) (Main.mouseX + 1), (float) (Main.mouseY + 1)), new Microsoft.Xna.Framework.Rectangle?(), color1, rotation, vector2 * Main.cursorTextures[Main.cursorOverride].Size(), Main.cursorScale * 1.1f * num, SpriteEffects.None, 0.0f); if (!flag2) return; Main.spriteBatch.Draw(Main.cursorTextures[Main.cursorOverride], new Vector2((float) Main.mouseX, (float) Main.mouseY), new Microsoft.Xna.Framework.Rectangle?(), color2, rotation, vector2 * Main.cursorTextures[Main.cursorOverride].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; string str = Lang.inter[38].Value; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontDeathText, str, new Vector2((float) (Main.screenWidth / 2) - Main.fontDeathText.MeasureString(str).X / 2f, (float) (Main.screenHeight / 2 - 20)), 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) return; string textValue = Language.GetTextValue("Game.DroppedCoins", (object) Main.player[Main.myPlayer].lostCoinString); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, textValue, new Vector2((float) (Main.screenWidth / 2) - Main.fontMouseText.MeasureString(textValue).X / 2f, (float) (Main.screenHeight / 2 + 30)), Main.player[Main.myPlayer].GetDeathAlpha(Microsoft.Xna.Framework.Color.Transparent), 0.0f, new Vector2(), 1f, 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) return; Main.player[Main.myPlayer].showItemIcon = false; this.MouseText(Main.hoverItemName, Main.rare); Main.mouseText = true; } 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)); private static void DrawInterface_29_SettingsButton() { if (!Main.playerInventory && !Main.player[Main.myPlayer].ghost) return; string str = Lang.inter[62].Value; Vector2 vector2_1 = Main.fontMouseText.MeasureString("Settings"); Vector2 vector2_2 = Main.fontMouseText.MeasureString(Lang.inter[62].Value); Vector2 vector2_3 = Main.fontDeathText.MeasureString(str); int num1 = Main.screenWidth - 110; int num2 = Main.screenHeight - 20; if (Main.player[Main.myPlayer].ExtraAccessorySlotsShouldShow && (Main.screenHeight < 650 || Main.screenHeight < 900 && Main.mapStyle == 1)) { num1 -= 140; num2 -= PlayerInput.UsingGamepad.ToInt() * 30; } float num3 = vector2_1.X / vector2_2.X; if (Main.mouseExit) { if ((double) Main.exitScale < 0.96) Main.exitScale += 0.02f; } else if ((double) Main.exitScale > 0.8) Main.exitScale -= 0.02f; UILinkPointNavigator.SetPosition(308, new Vector2((float) num1, (float) num2)); for (int index = 0; index < 5; ++index) { int num4 = 0; int num5 = 0; Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.Black; if (index == 0) num4 = -2; if (index == 1) num4 = 2; if (index == 2) num5 = -2; if (index == 3) num5 = 2; if (index == 4) color = Microsoft.Xna.Framework.Color.White; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontDeathText, str, new Vector2((float) (num1 + num4), (float) (num2 + num5)), color, 0.0f, new Vector2(vector2_3.X / 2f, vector2_3.Y / 2f), (Main.exitScale - 0.2f) * num3, SpriteEffects.None, 0.0f); } if ((double) Main.mouseX > (double) num1 - (double) vector2_3.X / 2.0 && (double) Main.mouseX < (double) num1 + (double) vector2_3.X / 2.0 && (double) Main.mouseY > (double) num2 - (double) vector2_3.Y / 2.0 && (double) Main.mouseY < (double) num2 + (double) vector2_3.Y / 2.0 - 10.0 && !Main.LocalPlayer.mouseInterface) { if (PlayerInput.IgnoreMouseInterface) return; if (!Main.mouseExit) Main.PlaySound(12); Main.mouseExit = true; Main.player[Main.myPlayer].mouseInterface = true; if (!Main.mouseLeftRelease || !Main.mouseLeft) return; Main.mouseExit = false; Main.exitScale = 0.8f; IngameOptions.Open(); } else Main.mouseExit = false; } private void DrawInterface_28_InfoAccs() => this.DrawInfoAccs(); private void DrawInterface_27_Inventory() { if (Main.playerInventory) { if (Main.ignoreErrors) { try { this.DrawInventory(); } catch (Exception ex) { TimeLogger.DrawException(ex); } } else this.DrawInventory(); } else { Main.recFastScroll = true; this.mouseNPC = -1; Main.EquipPage = 0; } } private static void DrawInterface_26_InterfaceLogic3() { if (Main.player[Main.myPlayer].dead) Main.playerInventory = false; if (!Main.playerInventory) { Main.player[Main.myPlayer].chest = -1; if (Main.InGuideCraftMenu) Main.InGuideCraftMenu = false; Recipe.FindRecipes(); Main.InReforgeMenu = false; } 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() { PlayerInput.SetZoom_World(); int screenWidth = Main.screenWidth; int screenHeight = Main.screenHeight; Vector2 screenPosition = Main.screenPosition; PlayerInput.SetZoom_UI(); float uiScale = Main.UIScale; for (int index = 0; index < (int) byte.MaxValue; ++index) { if (Main.player[index].active && Main.myPlayer != index && !Main.player[index].dead && Main.player[Main.myPlayer].team > 0 && Main.player[Main.myPlayer].team == Main.player[index].team) { string str = Main.player[index].name; if (Main.player[index].statLife < Main.player[index].statLifeMax2) str = str + ": " + (object) Main.player[index].statLife + "/" + (object) Main.player[index].statLifeMax2; Vector2 vector2_1 = Main.fontMouseText.MeasureString(str); float num1 = 0.0f; if (Main.player[index].chatOverhead.timeLeft > 0) num1 = -vector2_1.Y; Vector2 vector2_2 = new Vector2((float) (screenWidth / 2) + screenPosition.X, (float) (screenHeight / 2) + screenPosition.Y); Vector2 position = Main.player[index].position; Vector2 vector2_3 = position + (position - vector2_2) * (Main.GameViewMatrix.Zoom - Vector2.One); float num2 = 0.0f; float num3 = (float) Main.mouseTextColor / (float) byte.MaxValue; Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color((int) (byte) ((double) Main.teamColor[Main.player[index].team].R * (double) num3), (int) (byte) ((double) Main.teamColor[Main.player[index].team].G * (double) num3), (int) (byte) ((double) Main.teamColor[Main.player[index].team].B * (double) num3), (int) Main.mouseTextColor); float num4 = vector2_3.X + (float) (Main.player[index].width / 2) - vector2_2.X; float num5 = (float) ((double) vector2_3.Y - (double) vector2_1.Y - 2.0) + num1 - vector2_2.Y; float num6 = (float) Math.Sqrt((double) num4 * (double) num4 + (double) num5 * (double) num5); int num7 = screenHeight; if (screenHeight > screenWidth) num7 = screenWidth; int num8 = num7 / 2 - 30; if (num8 < 100) num8 = 100; if ((double) num6 < (double) num8) { vector2_1.X = (float) ((double) vector2_3.X + (double) (Main.player[index].width / 2) - (double) vector2_1.X / 2.0) - screenPosition.X; vector2_1.Y = (float) ((double) vector2_3.Y - (double) vector2_1.Y - 2.0) + num1 - screenPosition.Y; } else { num2 = num6; float num9 = (float) num8 / num6; vector2_1.X = (float) ((double) (screenWidth / 2) + (double) num4 * (double) num9 - (double) vector2_1.X / 2.0); vector2_1.Y = (float) (screenHeight / 2) + num5 * num9; } if ((double) Main.player[Main.myPlayer].gravDir == -1.0) vector2_1.Y = (float) screenHeight - vector2_1.Y; vector2_1 *= 1f / uiScale; Vector2 vector2_4 = Main.fontMouseText.MeasureString(str); vector2_1 += vector2_4 * (1f - uiScale) / 4f; if ((double) num2 > 0.0) { string textValue = Language.GetTextValue("GameUI.PlayerDistance", (object) (int) ((double) num2 / 16.0 * 2.0)); Vector2 vector2_5 = Main.fontMouseText.MeasureString(textValue); vector2_5.X = (float) ((double) vector2_1.X + (double) vector2_4.X / 2.0 - (double) vector2_5.X / 2.0); vector2_5.Y = (float) ((double) vector2_1.Y + (double) vector2_4.Y / 2.0 - (double) vector2_5.Y / 2.0 - 20.0); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, textValue, new Vector2(vector2_5.X - 2f, vector2_5.Y), Microsoft.Xna.Framework.Color.Black, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, textValue, new Vector2(vector2_5.X + 2f, vector2_5.Y), Microsoft.Xna.Framework.Color.Black, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, textValue, new Vector2(vector2_5.X, vector2_5.Y - 2f), Microsoft.Xna.Framework.Color.Black, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, textValue, new Vector2(vector2_5.X, vector2_5.Y + 2f), Microsoft.Xna.Framework.Color.Black, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, textValue, vector2_5, color, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, str, new Vector2(vector2_1.X - 2f, vector2_1.Y), Microsoft.Xna.Framework.Color.Black, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, str, new Vector2(vector2_1.X + 2f, vector2_1.Y), Microsoft.Xna.Framework.Color.Black, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, str, new Vector2(vector2_1.X, vector2_1.Y - 2f), Microsoft.Xna.Framework.Color.Black, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, str, new Vector2(vector2_1.X, vector2_1.Y + 2f), Microsoft.Xna.Framework.Color.Black, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, str, vector2_1, color, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } } } 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 - Main.chat2Texture.Width); } else num3 = num1 + 8; int num4 = num2 - 22; Main.spriteBatch.Draw(Main.chat2Texture, new Vector2((float) num3, (float) num4), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.chat2Texture.Width, Main.chat2Texture.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, Main.fontMouseText, 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, Main.fontMouseText, 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, Main.fontMouseText, 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, Main.fontMouseText, 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, Main.fontMouseText, 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, Main.fontMouseText, 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, Main.fontMouseText, 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, Main.fontMouseText, 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, Main.fontMouseText, 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, Main.fontMouseText, 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, Main.fontMouseText, 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.netDiag) return; for (int index = 0; index < 4; ++index) { string str = ""; int num1 = 20; int num2 = 220; if (index == 0) { str = "RX Msgs: " + string.Format("{0:0,0}", (object) Main.rxMsg); num2 += index * 20; } else if (index == 1) { str = "RX Bytes: " + string.Format("{0:0,0}", (object) Main.rxData); num2 += index * 20; } else if (index == 2) { str = "TX Msgs: " + string.Format("{0:0,0}", (object) Main.txMsg); num2 += index * 20; } else if (index == 3) { str = "TX Bytes: " + string.Format("{0:0,0}", (object) Main.txData); num2 += index * 20; } DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, 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 < Main.maxMsg; ++index) { float num3 = 0.7f; int num4 = 200; int num5 = 120; int num6 = index / 50; int num7 = num4 + num6 * 400; int num8 = num5 + (index - num6 * 50) * 13; string str1 = index.ToString() + ": "; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, str1, new Vector2((float) num7, (float) num8), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2(), num3, SpriteEffects.None, 0.0f); int num9 = num7 + 30; string str2 = "rx:" + string.Format("{0:0,0}", (object) Main.rxMsgType[index]); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, str2, new Vector2((float) num9, (float) num8), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2(), num3, SpriteEffects.None, 0.0f); int num10 = num9 + 70; string str3 = string.Format("{0:0,0}", (object) Main.rxDataType[index]); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, str3, new Vector2((float) num10, (float) num8), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2(), num3, SpriteEffects.None, 0.0f); int num11 = num10 + 70; string str4 = index.ToString() + ": "; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, str4, new Vector2((float) num11, (float) num8), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2(), num3, SpriteEffects.None, 0.0f); int num12 = num11 + 30; string str5 = "tx:" + string.Format("{0:0,0}", (object) Main.txMsgType[index]); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, str5, new Vector2((float) num12, (float) num8), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2(), num3, SpriteEffects.None, 0.0f); int num13 = num12 + 70; string str6 = string.Format("{0:0,0}", (object) Main.txDataType[index]); DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, str6, new Vector2((float) num13, (float) num8), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2(), num3, SpriteEffects.None, 0.0f); } } private void DrawInterface_16_MapOrMinimap() { Main.mH = 0; if (!Main.mapEnabled) return; if (!Main.mapFullscreen && Main.mapStyle == 1) { Main.mH = 256; if (Main.ignoreErrors) { try { this.DrawMap(); } catch (Exception ex) { TimeLogger.DrawException(ex); } } else this.DrawMap(); } PlayerInput.SetZoom_UI(); if (Main.mH + this.RecommendedEquipmentAreaPushUp <= Main.screenHeight) return; Main.mH = Main.screenHeight - this.RecommendedEquipmentAreaPushUp; } public int RecommendedEquipmentAreaPushUp => Main.player[Main.myPlayer].ExtraAccessorySlotsShouldShow ? 610 + PlayerInput.UsingGamepad.ToInt() * 30 : 600; private static void DrawInterface_15_InvasionProgressBars() => Main.DrawInvasionProgress(); private void DrawInterface_14_EntityHealthBars() { if (Main.HealthBarDrawSettings == (byte) 0) return; 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].visualOffset; 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) 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 index = 0; index < 200; ++index) { if (Main.npc[index].active && Main.npc[index].type >= 134 && Main.npc[index].type <= 136) { Vector2 vector2_2 = Main.player[Main.myPlayer].Center - Main.npc[index].Center; if ((double) vector2_2.Length() < (double) num && Collision.CanHit(Main.player[Main.myPlayer].Center, 1, 1, Main.npc[index].Center, 1, 1)) { num = vector2_2.Length(); vector2_1 = Main.npc[index].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 index = i; if (type != 134 && Main.npc[i].realLife != -1) index = 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[index].life, Main.npc[index].lifeMax, alpha, scale2); } else Main.destroyerHB = new Vector2(0.0f, 0.0f); } } else if (type == 7) { Vector2 position = Main.npc[i].position; int index1 = -1; for (int index2 = 0; index2 < 200; ++index2) { if (Main.npc[index2].active && Main.npc[index2].type == 9) index1 = index2; } if (index1 >= 0) { Vector2 vector2 = (position + Main.npc[index1].position) / 2f; this.DrawHealthBar(vector2.X + (float) (Main.npc[i].width / 2), vector2.Y + (float) (Main.npc[i].height / 2), 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); } } else if (type != 8 && type != 9) { if (type == 95) { Vector2 position = Main.npc[i].position; int index3 = -1; for (int index4 = 0; index4 < 200; ++index4) { if (Main.npc[index4].active && Main.npc[index4].type == 97) index3 = index4; } if (index3 >= 0) { Vector2 vector2 = (position + Main.npc[index3].position) / 2f; this.DrawHealthBar(vector2.X + (float) (Main.npc[i].width / 2), vector2.Y + (float) (Main.npc[i].height / 2), 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); } } else if (type != 96 && type != 97) { if (type == 10) { Vector2 position = Main.npc[i].position; int index5 = -1; for (int index6 = 0; index6 < 200; ++index6) { if (Main.npc[index6].active && Main.npc[index6].type == 12) index5 = index6; } if (index5 >= 0) { Vector2 vector2 = (position + Main.npc[index5].position) / 2f; this.DrawHealthBar(vector2.X + (float) (Main.npc[i].width / 2), vector2.Y + (float) (Main.npc[i].height / 2), 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); } } else if (type != 11 && type != 12) { switch (type) { case 87: Vector2 position1 = Main.npc[i].position; int index7 = -1; for (int index8 = 0; index8 < 200; ++index8) { if (Main.npc[index8].active && Main.npc[index8].type == 92) index7 = index8; } if (index7 >= 0) { Vector2 vector2 = (position1 + Main.npc[index7].position) / 2f; this.DrawHealthBar(vector2.X + (float) (Main.npc[i].width / 2), vector2.Y + (float) (Main.npc[i].height / 2), 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; } break; case 412: Vector2 position2 = Main.npc[i].position; int index9 = i; while (index9 > 0 && index9 < 200 && (double) Main.npc[index9].ai[0] > 0.0) index9 = (int) Main.npc[index9].ai[0]; if (index9 >= 0) { Vector2 vector2 = (position2 + Main.npc[index9].position) / 2f; this.DrawHealthBar(vector2.X + (float) (Main.npc[i].width / 2), vector2.Y + (float) (Main.npc[i].height / 2), 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; } break; default: if (type != 414 && type != 413 && (type < 88 || type > 92)) { if (type == 39) { Vector2 position3 = Main.npc[i].position; int index10 = -1; for (int index11 = 0; index11 < 200; ++index11) { if (Main.npc[index11].active && Main.npc[index11].type == 41) index10 = index11; } if (index10 >= 0) { Vector2 vector2 = (position3 + Main.npc[index10].position) / 2f; this.DrawHealthBar(vector2.X + (float) (Main.npc[i].width / 2), vector2.Y + (float) (Main.npc[i].height / 2), 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; } break; } if (type != 40 && type != 41) { if (type == 98) { Vector2 position4 = Main.npc[i].position; int index12 = -1; for (int index13 = 0; index13 < 200; ++index13) { if (Main.npc[index13].active && Main.npc[index13].type == 100) index12 = index13; } if (index12 >= 0) { Vector2 vector2 = (position4 + Main.npc[index12].position) / 2f; this.DrawHealthBar(vector2.X + (float) (Main.npc[i].width / 2), vector2.Y + (float) (Main.npc[i].height / 2), 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; } break; } if (type != 99 && type != 100) { if (type == 454) { Vector2 position5 = Main.npc[i].position; int index14 = -1; for (int index15 = 0; index15 < 200; ++index15) { if (Main.npc[index15].active && Main.npc[index15].type == 459) index14 = index15; } if (index14 >= 0) { Vector2 vector2 = (position5 + Main.npc[index14].position) / 2f; this.DrawHealthBar(vector2.X + (float) (Main.npc[i].width / 2), vector2.Y + (float) (Main.npc[i].height / 2), 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; } break; } if (type < 455 || type > 459) { if (type == 510) { Vector2 position6 = Main.npc[i].position; int index16 = -1; for (int index17 = 0; index17 < 200; ++index17) { if (Main.npc[index17].active && Main.npc[index17].type == 512) index16 = index17; } if (index16 >= 0) { Vector2 vector2 = (position6 + Main.npc[index16].position) / 2f; this.DrawHealthBar(vector2.X + (float) (Main.npc[i].width / 2), vector2.Y + (float) (Main.npc[i].height / 2), 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; } break; } if (type != 511 && type != 512) { if (type == 513) { Vector2 position7 = Main.npc[i].position; int index18 = -1; for (int index19 = 0; index19 < 200; ++index19) { if (Main.npc[index19].active && Main.npc[index19].type == 515) index18 = index19; } if (index18 >= 0) { Vector2 vector2 = (position7 + Main.npc[index18].position) / 2f; this.DrawHealthBar(vector2.X + (float) (Main.npc[i].width / 2), vector2.Y + (float) (Main.npc[i].height / 2), 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; } break; } if (type != 514 && type != 515) { if (type == 117) { Vector2 position8 = Main.npc[i].position; int index20 = -1; for (int index21 = 0; index21 < 200; ++index21) { if (Main.npc[index21].active && Main.npc[index21].type == 119) index20 = index21; } if (index20 >= 0) { Vector2 vector2 = (position8 + Main.npc[index20].position) / 2f; this.DrawHealthBar(vector2.X + (float) (Main.npc[i].width / 2), vector2.Y + (float) (Main.npc[i].height / 2), 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; } break; } if (type != 118 && type != 119) { switch (Main.HealthBarDrawSettings) { case 1: float num1 = 10f + Main.NPCAddHeight(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(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 break; } else break; } else break; } else break; } else break; } else break; } else break; break; } } } } } } else if (!Main.npc[i].dontTakeDamage && (double) Main.npc[i].nameOver > 0.0 && PlayerInput.UsingGamepad) { Vector2 stringSize = ChatManager.GetStringSize(Main.fontMouseText, 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, Main.fontMouseText, 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, Main.fontMouseText, 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 fontMouseText = Main.fontMouseText; float num = 1f; Vector2 origin = fontMouseText.MeasureString(text) * num * new Vector2(0.5f, 0.5f); ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, fontMouseText, 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].visualOffset; } } for (int index = 0; index < (int) byte.MaxValue; ++index) { if (index != Main.myPlayer && Main.player[index].active && !Main.player[index].ghost && !Main.player[index].dead && Main.player[index].statLife != Main.player[index].statLifeMax2) { switch (Main.HealthBarDrawSettings) { case 1: int num3 = 10; this.DrawHealthBar(Main.player[index].position.X + (float) (Main.player[index].width / 2), Main.player[index].position.Y + (float) Main.player[index].height + (float) num3 + Main.player[index].gfxOffY, Main.player[index].statLife, Main.player[index].statLifeMax2, Lighting.Brightness((int) (((double) Main.player[index].position.X + (double) (Main.player[index].width / 2)) / 16.0), (int) (((double) Main.player[index].position.Y + (double) (Main.player[index].height / 2) + (double) Main.player[index].gfxOffY) / 16.0))); continue; case 2: int num4 = -20; this.DrawHealthBar(Main.player[index].position.X + (float) (Main.player[index].width / 2), Main.player[index].position.Y + (float) num4 + Main.player[index].gfxOffY, Main.player[index].statLife, Main.player[index].statLifeMax2, Lighting.Brightness((int) (((double) Main.player[index].position.X + (double) (Main.player[index].width / 2)) / 16.0), (int) (((double) Main.player[index].position.Y + (double) (Main.player[index].height / 2) + (double) Main.player[index].gfxOffY) / 16.0))); continue; default: continue; } } } } private static void DrawInterface_13_AchievementCompletePopups() => AchievementCompleteUI.Draw(Main.spriteBatch); private static bool DrawInterface_12_IngameFancyUI() { Main.InGameUI.Draw(Main.spriteBatch, Main._drawInterfaceGameTime); bool flag = true; if (Main.inFancyUI && !IngameFancyUI.Draw(Main.spriteBatch, Main._drawInterfaceGameTime)) flag = false; return flag; } private bool DrawInterface_11_IngameOptionsMenu() { bool flag = true; if (Main.ingameOptionsWindow) { IngameOptions.Draw(this, Main.spriteBatch); 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; } 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; } return flag; } private static void DrawInterface_9_WireSelection() => 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) return; if (Main.ignoreErrors) { try { this.DrawNPCHouse(); } catch (Exception ex) { TimeLogger.DrawException(ex); } } else this.DrawNPCHouse(); } private static void DrawInterface_6_TileGridOption() { if ((PlayerInput.UsingGamepad && !Main.SmartCursorEnabled && !PlayerInput.UsingGamepadUI || Main.MouseShowBuildingGrid && !Main.SmartCursorEnabled) && !Main.player[Main.myPlayer].dead && !PlayerInput.CursorIsBusy) { float num1 = 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, num1, 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 num2 = 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 cursorRadialTexture = Main.cursorRadialTexture; Main.spriteBatch.Draw(cursorRadialTexture, position, new Microsoft.Xna.Framework.Rectangle?(), Microsoft.Xna.Framework.Color.White * 0.5f * buildingGridAlpha, 0.0f, cursorRadialTexture.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) + (double) (num5 * 4)) / 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; int num8 = num6 + num5; Vector2 mouseWorld = Main.MouseWorld; if ((double) Main.player[Main.myPlayer].gravDir == -1.0) mouseWorld.Y += 16f; Vector2 vector2_1 = mouseWorld / 16f; Vector2 vector2_2 = new Vector2((float) num8, (float) num7); int num9 = (int) vector2_1.X - num8; int num10 = (int) vector2_1.Y - num7; int num11 = Math.Abs(num9) + 1; int num12 = Math.Abs(num10) + 1; if (num9 == 0 && num10 == 0) return; Texture2D texture = Main.extraTexture[2]; Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 16); int num13 = num8; int num14 = num7; if ((double) Main.player[Main.myPlayer].gravDir == -1.0) --num14; float r = 0.24f; float g = 0.8f; float b = 0.9f; float a = 1f; float num15 = 0.8f; Microsoft.Xna.Framework.Color color1 = new Microsoft.Xna.Framework.Color(r, g, b, a) * num15 * num4; Main.spriteBatch.Draw(texture, Main.ReverseGravitySupport(new Vector2((float) num13, (float) num14) * 16f - Main.screenPosition, 16f), new Microsoft.Xna.Framework.Rectangle?(rectangle), color1, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); if (num9 != 0) { int num16 = Math.Sign(num9); rectangle.Y = num16 == 1 ? 16 : 32; while (num9 != 0) { num9 -= num16; num13 += num16; if (num9 == 0) rectangle.Y = 0; Microsoft.Xna.Framework.Color color2 = new Microsoft.Xna.Framework.Color(r, g, b, a) * num15 * num4; Main.spriteBatch.Draw(texture, Main.ReverseGravitySupport(new Vector2((float) num13, (float) num14) * 16f - Main.screenPosition, 16f), new Microsoft.Xna.Framework.Rectangle?(rectangle), color2, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } if (num10 != 0) { int num17 = Math.Sign(num10); rectangle.Y = num17 == 1 ? 48 : 64; while (num10 != 0) { num10 -= num17; num14 += num17; if (num10 == 0) rectangle.Y = 0; Microsoft.Xna.Framework.Color color3 = new Microsoft.Xna.Framework.Color(r, g, b, a) * num15 * num4; Main.spriteBatch.Draw(texture, Main.ReverseGravitySupport(new Vector2((float) num13, (float) num14) * 16f - Main.screenPosition, 16f), new Microsoft.Xna.Framework.Rectangle?(rectangle), color3, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } Utils.DrawBorderString(Main.spriteBatch, num11.ToString() + "x" + num12.ToString(), new Vector2((float) (Main.mouseX + 16), (float) Main.mouseY), new Microsoft.Xna.Framework.Color(r, g, b, a), anchory: 0.8f); } 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 = Main.extraTexture[68]; 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_EmoteBubbles() { 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 MouseOversTryToClear() { if (!Main._MouseOversCanClear) return; Main._MouseOversCanClear = false; Main.MouseOversClear(); } private static void MouseOversClear() { Main.player[Main.myPlayer].showItemIcon = false; Main.player[Main.myPlayer].showItemIcon2 = 0; Main.player[Main.myPlayer].showItemIconText = 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.GlobalTime % (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; Texture2D texture2D = Main.itemTexture[intList[index2]]; 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); } } } 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(Main.magicPixel, 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(Main.magicPixel, 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(Main.magicPixel, 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(Main.magicPixel, 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(Main.magicPixel, 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(Main.magicPixel, 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(Main.magicPixel, 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(Main.magicPixel, 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.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(Main.magicPixel, 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(Main.magicPixel, 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(Main.magicPixel, 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(Main.magicPixel, 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(Main.magicPixel, 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(Main.magicPixel, 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(Main.magicPixel, 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(Main.magicPixel, 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() { if (Main.ignoreErrors) { try { this.GUIHotbarDrawInner(); } catch (Exception ex) { TimeLogger.DrawException(ex); } } else this.GUIHotbarDrawInner(); } 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.mapStyle != 1 || !Main.mapEnabled || Main.screenHeight >= 820) && (Main.mapStyle == 1 || Main.screenWidth >= 855) && !PlayerInput.UsingGamepad; private void DrawInfoAccs() { if (Main.npcChatText != null && !(Main.npcChatText == "") || Main.player[Main.myPlayer].sign >= 0) 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 num2 = 0; string cursorText = ""; float num3 = 215f; int num4 = 0; if (GameCulture.Russian.IsActive) { num4 = -50; num3 += 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 str3 = "AM"; double time = Main.time; if (!Main.dayTime) time += 54000.0; double num5 = time / 86400.0 * 24.0 - 7.5 - 12.0; if (num5 < 0.0) num5 += 24.0; if (num5 >= 12.0) str3 = "PM"; int num6 = (int) num5; double num7 = (double) (int) ((num5 - (double) num6) * 60.0); string str4 = string.Concat((object) num7); if (num7 < 10.0) str4 = "0" + str4; if (num6 > 12) num6 -= 12; if (num6 == 0) num6 = 12; if (Main.player[Main.myPlayer].accWatch == 1) str4 = "00"; else if (Main.player[Main.myPlayer].accWatch == 2) str4 = num7 >= 30.0 ? "30" : "00"; str1 = num6.ToString() + ":" + str4 + " " + str3; 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 = (double) Main.maxRaining <= 0.6 ? ((double) Main.maxRaining < 0.2 ? ((double) Main.maxRaining <= 0.0 ? ((double) Main.cloudBGActive <= 0.0 ? (Main.numClouds <= 120 ? (Main.numClouds <= 80 ? (Main.numClouds <= 20 ? 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"); int num8 = (int) ((double) Main.windSpeed * 100.0); if (num8 < 0) str1 += Language.GetTextValue("GameUI.WestWind", (object) Math.Abs(num8)); else if (num8 > 0) str1 += Language.GetTextValue("GameUI.EastWind", (object) num8); 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 { int num9 = Main.player[Main.myPlayer].FishingLevel(); str1 = num9 != -1 ? (Main.player[Main.myPlayer].displayedFishingInfo = Language.GetTextValue("GameUI.FishingPower", (object) num9)) : 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; str1 = Main.player[Main.myPlayer].bestOre > 0 ? Language.GetTextValue("GameUI.OreDetected", (object) Lang.GetMapObjectName(MapHelper.TileToLookup(Main.player[Main.myPlayer].bestOre, 0))) : Language.GetTextValue("GameUI.NoTreasureNearby"); 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 num10 = 1300; int num11 = 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 > num11) { num11 = Main.npc[index5].rarity; if ((double) (Main.npc[index5].Center - Main.player[Main.myPlayer].Center).Length() < (double) num10) index4 = index5; } } 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 num12 = 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) { int type = Main.npc[index6].type; if ((double) (Main.npc[index6].Center - Main.player[Main.myPlayer].Center).Length() < (double) num12) ++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; int num13 = (int) (1.0 + (double) Main.player[Main.myPlayer].velocity.Length() * 6.0); if (num13 > Main.player[Main.myPlayer].speedSlice.Length) num13 = Main.player[Main.myPlayer].speedSlice.Length; float num14 = 0.0f; for (int index7 = num13 - 1; index7 > 0; --index7) Main.player[Main.myPlayer].speedSlice[index7] = Main.player[Main.myPlayer].speedSlice[index7 - 1]; Main.player[Main.myPlayer].speedSlice[0] = Main.player[Main.myPlayer].velocity.Length(); for (int index8 = 0; index8 < Main.player[Main.myPlayer].speedSlice.Length; ++index8) { if (index8 < num13) num14 += Main.player[Main.myPlayer].speedSlice[index8]; else Main.player[Main.myPlayer].speedSlice[index8] = num14 / (float) num13; } float num15 = num14 / (float) num13; int num16 = 42240; int num17 = 216000; float num18 = num15 * (float) num17 / (float) num16; if (!Main.player[Main.myPlayer].merman && !Main.player[Main.myPlayer].ignoreWater) { if (Main.player[Main.myPlayer].honeyWet) num18 /= 4f; else if (Main.player[Main.myPlayer].wet) num18 /= 2f; } str1 = Language.GetTextValue("GameUI.Speed", (object) Math.Round((double) num18)); 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 num19 = (int) (((double) Main.player[Main.myPlayer].position.X + (double) (Main.player[Main.myPlayer].width / 2)) * 2.0 / 16.0 - (double) Main.maxTilesX); str1 = num19 <= 0 ? (num19 >= 0 ? Language.GetTextValue("GameUI.CompassCenter") : Language.GetTextValue("GameUI.CompassWest", (object) -num19)) : Language.GetTextValue("GameUI.CompassEast", (object) num19); 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 num20 = (int) (((double) Main.player[Main.myPlayer].position.Y + (double) Main.player[Main.myPlayer].height) * 2.0 / 16.0 - Main.worldSurface * 2.0); float num21 = (float) (Main.maxTilesX / 4200); float num22 = num21 * num21; int num23 = 1200; float num24 = (float) ((((double) Main.screenPosition.Y + (double) (Main.screenHeight / 2)) / 16.0 - (65.0 + 10.0 * (double) num22)) / (Main.worldSurface / 5.0)); string str5 = (double) Main.player[Main.myPlayer].position.Y <= (double) ((Main.maxTilesY - 204) * 16) ? ((double) Main.player[Main.myPlayer].position.Y <= Main.rockLayer * 16.0 + (double) (num23 / 2) + 16.0 ? (num20 <= 0 ? ((double) num24 < 1.0 ? Language.GetTextValue("GameUI.LayerSpace") : Language.GetTextValue("GameUI.LayerSurface")) : Language.GetTextValue("GameUI.LayerUnderground")) : Language.GetTextValue("GameUI.LayerCaverns")) : Language.GetTextValue("GameUI.LayerUnderworld"); int num25 = Math.Abs(num20); str1 = (num25 != 0 ? Language.GetTextValue("GameUI.Depth", (object) num25) : Language.GetTextValue("GameUI.DepthLevel")) + " " + str5; flag2 = true; } if (str1 != "") { int num26; int num27; if (!Main.playerInventory) { num26 = Main.screenWidth - 280; num27 = -32; if (Main.mapStyle == 1 && Main.mapEnabled) num27 += 254; } else if (Main.ShouldDrawInfoIconsHorizontally) { num26 = Main.screenWidth - 280 + 20 * num2 - 10; num27 = 94; if (Main.mapStyle == 1 && Main.mapEnabled) num27 += 254; } else { int num28 = (int) (52.0 * (double) Main.inventoryScale); num26 = 697 - num28 * 4 + Main.screenWidth - 800 + 20 * (num2 % 2); num27 = 114 + Main.mH + num28 * 7 + num28 / 2 + 20 * (num2 / 2) + 8 * (num2 / 4) - 20; if (Main.EquipPage == 2) { num26 += num28 + num28 / 2; num27 -= num28; } } int num29 = num26 + num4; if (index1 >= 0) { ++num2; int num30 = 22; if (Main.screenHeight < 650) num30 = 20; Vector2 position = new Vector2((float) num29, (float) (num27 + 74 + num30 * 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) num29, (float) num27); if ((double) Main.mouseX >= (double) position.X && (double) Main.mouseY >= (double) position.Y && (double) Main.mouseX <= (double) position.X + (double) this.infoIconTexture[index1].Width && (double) Main.mouseY <= (double) position.Y + (double) this.infoIconTexture[index1].Height && !PlayerInput.IgnoreMouseInterface) { flag14 = true; Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeft && Main.mouseLeftRelease) { Main.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) this.infoIconTexture[index1].Width && (double) Main.mouseY <= (double) position.Y + (double) this.infoIconTexture[index1].Height && !Main.mouseText) { num1 = index2; cursorText = str2; Main.mouseText = true; } UILinkPointNavigator.SetPosition(1558 + num2 - 1, position + this.infoIconTexture[index1].Size() * 0.75f); Main.spriteBatch.Draw(this.infoIconTexture[index1], position, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, this.infoIconTexture[index1].Width, this.infoIconTexture[index1].Height)), color, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); if (flag14) Main.spriteBatch.Draw(this.infoIconTexture[13], position - Vector2.One * 2f, new Microsoft.Xna.Framework.Rectangle?(), Main.OurFavoriteColor, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); num29 += 20; } UILinkPointNavigator.Shortcuts.INFOACCCOUNT = num2; if (!Main.playerInventory) { Vector2 vector2_1 = new Vector2(1f); Vector2 vector2_2 = Main.fontMouseText.MeasureString(str1); if ((double) vector2_2.X > (double) num3) vector2_1.X = num3 / 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 num31 = 0; int num32 = 0; Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.Black; if (index10 == 0) num31 = -2; if (index10 == 1) num31 = 2; if (index10 == 2) num32 = -2; if (index10 == 3) num32 = 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 num33 = 22; if (Main.screenHeight < 650) num33 = 20; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, str1, new Vector2((float) (num29 + num31), (float) (num27 + 74 + num33 * index2 + num32 + 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 void DrawBuilderAccToggles(Vector2 start) { if (!Main.playerInventory && !string.IsNullOrEmpty(Main.npcChatText) || Main.player[Main.myPlayer].sign >= 0) return; int num1 = 0; Player player = Main.player[Main.myPlayer]; int[] builderAccStatus = Main.player[Main.myPlayer].builderAccStatus; int num2 = player.InfoAccMechShowWires.ToInt() * 6 + player.rulerLine.ToInt() + player.rulerGrid.ToInt() + player.autoActuator.ToInt() + player.autoPaint.ToInt(); for (int index1 = 0; index1 < builderAccStatus.Length; ++index1) { int index2 = index1 - 2; switch (index1) { case 0: index2 = 8; break; case 1: index2 = 9; break; } Texture2D builderAccTexture = Main.builderAccTexture; 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 (num2 > 8) vector2.Y -= 44f; 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 (player.rulerLine) { r.X = index2 * 16; color = builderAccStatus[index2] == 0 ? color : firstColor; if (flag1) { player.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; Main.PlaySound(12); Main.mouseLeftRelease = false; break; } break; } continue; case 1: if (player.rulerGrid) { r.X = index2 * 16; color = builderAccStatus[index2] == 0 ? color : firstColor; if (flag1) { player.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; Main.PlaySound(12); Main.mouseLeftRelease = false; break; } break; } continue; case 2: if (player.autoActuator) { r.X = index2 * 16; color = builderAccStatus[index2] == 0 ? color : firstColor; if (flag1) { player.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; Main.PlaySound(12); Main.mouseLeftRelease = false; break; } break; } continue; case 3: if (player.autoPaint) { r.X = index2 * 16; color = builderAccStatus[index2] == 0 ? color : firstColor; if (flag1) { player.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; Main.PlaySound(12); Main.mouseLeftRelease = false; break; } break; } continue; case 4: case 5: case 6: case 7: case 9: if (player.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) { player.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; Main.PlaySound(12); Main.mouseLeftRelease = false; break; } break; } continue; case 8: if (player.InfoAccMechShowWires) { r.X = index2 * 16; color = builderAccStatus[index2] == 0 ? color : firstColor; if (flag1) { player.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; Main.PlaySound(12); Main.mouseLeftRelease = false; break; } break; } continue; case 11: continue; } Main.spriteBatch.Draw(builderAccTexture, vector2, new Microsoft.Xna.Framework.Rectangle?(r), color, 0.0f, r.Size() / 2f, 1f, SpriteEffects.None, 0.0f); if (flag1) Main.spriteBatch.Draw(this.infoIconTexture[13], vector2, new Microsoft.Xna.Framework.Rectangle?(), Main.OurFavoriteColor, 0.0f, this.infoIconTexture[13].Size() / 2f, 1f, SpriteEffects.None, 0.0f); UILinkPointNavigator.SetPosition(4000 + num1, vector2 + r.Size() * 0.3f); ++num1; } UILinkPointNavigator.Shortcuts.BUILDERACCCOUNT = num1; } 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 ((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 texture = Main.extraTexture[9]; string text = ""; Microsoft.Xna.Framework.Color c = Microsoft.Xna.Framework.Color.White; switch (Main.invasionProgressIcon) { case 1: texture = Main.extraTexture[8]; text = Lang.inter[83].Value; c = new Microsoft.Xna.Framework.Color(64, 109, 164) * 0.5f; break; case 2: texture = Main.extraTexture[12]; text = Lang.inter[84].Value; c = new Microsoft.Xna.Framework.Color(112, 86, 114) * 0.5f; break; case 3: texture = Main.extraTexture[79]; text = Language.GetTextValue("DungeonDefenders2.InvasionProgressTitle"); c = new Microsoft.Xna.Framework.Color(88, 0, 160) * 0.5f; break; case 4: texture = Main.extraTexture[9]; text = Lang.inter[88].Value; c = new Microsoft.Xna.Framework.Color(94, 72, 131) * 0.5f; break; case 5: texture = Main.extraTexture[7]; text = Lang.inter[87].Value; c = new Microsoft.Xna.Framework.Color(173, 135, 140) * 0.5f; break; case 6: texture = Main.extraTexture[11]; text = Lang.inter[86].Value; c = new Microsoft.Xna.Framework.Color(148, 122, 72) * 0.5f; break; case 7: texture = Main.extraTexture[10]; 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 colorBarTexture = Main.colorBarTexture; Texture2D colorBlipTexture = Main.colorBlipTexture; 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(colorBarTexture, position1, new Microsoft.Xna.Framework.Rectangle?(), Microsoft.Xna.Framework.Color.White * Main.invasionProgressAlpha, 0.0f, new Vector2((float) (colorBarTexture.Width / 2), 0.0f), scale1, SpriteEffects.None, 0.0f); Vector2 position2 = pos + Vector2.UnitX * (num1 - 0.5f) * num2; Main.spriteBatch.Draw(Main.magicPixel, 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(Main.magicPixel, 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(Main.magicPixel, 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 colorBarTexture = Main.colorBarTexture; Texture2D colorBlipTexture = Main.colorBlipTexture; if (Main.invasionProgressMax != 0) { Main.spriteBatch.Draw(colorBarTexture, position3, new Microsoft.Xna.Framework.Rectangle?(), Microsoft.Xna.Framework.Color.White * Main.invasionProgressAlpha, 0.0f, new Vector2((float) (colorBarTexture.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 = Main.fontMouseText.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(Main.magicPixel, 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(Main.magicPixel, 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(Main.magicPixel, 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 = Main.fontMouseText.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) (texture.Width + 12), 6f)) * scale1); Utils.DrawInvBG(Main.spriteBatch, rectangle, c); Main.spriteBatch.Draw(texture, 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) (texture.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( 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.player[Main.myPlayer].dead) { Main.SmartInteractShowingGenuine = false; Main.SmartInteractShowingFake = false; Main.SmartInteractNPC = -1; Main.SmartInteractNPCsNearby.Clear(); Main.SmartInteractTileCoords.Clear(); Main.SmartInteractTileCoordsSelected.Clear(); int num; Main.TileInteractionHY = num = -1; Main.TileInteractionLY = num; Main.TileInteractionHX = num; Main.TileInteractionLX = num; } bool flag = 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; if (smart && !flag) { Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.White * Main.GamepadCursorAlpha; int index = 13; int frameX = 0; Main.spriteBatch.Draw(Main.cursorTextures[index], new Vector2((float) Main.mouseX, (float) Main.mouseY) + bonus, new Microsoft.Xna.Framework.Rectangle?(Main.cursorTextures[index].Frame(2, frameX: frameX)), color, 0.0f, Main.cursorTextures[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(Main.cursorTextures[index], new Vector2((float) Main.mouseX, (float) Main.mouseY) + bonus, new Microsoft.Xna.Framework.Rectangle?(), white, 0.0f, Main.cursorTextures[index].Size() / 2f, Main.cursorScale, SpriteEffects.None, 0.0f); } } else { int index = smart.ToInt(); Main.spriteBatch.Draw(Main.cursorTextures[index], 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(Main.cursorTextures[index], 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 Vector2 DrawThickCursor(bool smart = false) { if (!Main.ThickMouse || 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?(Main.cursorTextures[index1].Frame(2, frameX: frameX)); origin = Main.cursorTextures[index1].Frame(2, frameX: frameX).Size() / 2f; mouseBorderColor *= Main.GamepadCursorAlpha; } else { index1 = 15; vector2_2 = Vector2.One; origin = Main.cursorTextures[index1].Size() / 2f; } } Main.spriteBatch.Draw(Main.cursorTextures[index1], 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.expertMode); if (Main.UseSeedUI) Main.menuMode = 5000; else WorldGen.CreateNewWorld(); } private static Action CreateGoToMenuEvent(int menu) => (Action) (() => { Main.menuMode = menu; UILinkPointNavigator.Shortcuts.FANCYUI_SPECIAL_INSTRUCTIONS = 0; }); protected void DrawMenu(GameTime gameTime) { double uiScaleWanted = (double) Main._uiScaleWanted; Main.UIScale = 1f; Main._uiScaleWanted = (float) uiScaleWanted; 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; Star.UpdateStars(); Cloud.UpdateClouds(); Main.holyTiles = 0; Main.evilTiles = 0; Main.shroomTiles = 0; Main.bloodTiles = 0; Main.bloodTiles = 0; Main.jungleTiles = 0; Main.drawingPlayerChat = false; for (int index = 0; index < Main.numChatLines; ++index) Main.chatLine[index] = new ChatLine(); this.DrawFPS(); Main.screenLastPosition = Main.screenPosition; Main.screenPosition.Y = (float) (Main.worldSurface * 16.0) - (float) Main.screenHeight; if (Main.grabSky) Main.screenPosition.X += (float) (Main.mouseX - Main.screenWidth / 2) * 0.02f; else Main.screenPosition.X += 2f; if ((double) Main.screenPosition.X > 2147483520.0) Main.screenPosition.X = 0.0f; if ((double) Main.screenPosition.X < -2147483520.0) Main.screenPosition.X = 0.0f; 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); this.logoRotation += this.logoRotationSpeed * 3E-05f; if ((double) this.logoRotation > 0.1) this.logoRotationDirection = -1f; else if ((double) this.logoRotation < -0.1) 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 * 1E-05f; if ((double) this.logoScale > 1.1) this.logoScaleDirection = -1f; else if ((double) this.logoScale < 0.9) 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))); Main.spriteBatch.Draw(Main.logoTexture, new Vector2((float) (Main.screenWidth / 2), 100f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.logoTexture.Width, Main.logoTexture.Height)), color2, this.logoRotation, new Vector2((float) (Main.logoTexture.Width / 2), (float) (Main.logoTexture.Height / 2)), this.logoScale, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(Main.logo2Texture, new Vector2((float) (Main.screenWidth / 2), 100f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.logoTexture.Width, Main.logoTexture.Height)), color3, this.logoRotation, new Vector2((float) (Main.logoTexture.Width / 2), (float) (Main.logoTexture.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; int num9 = Program.LoadedEverything ? 1 : 0; if (num9 != 0) GamepadMainMenuHandler.CanRun = true; if (num9 == 0) { flagArray1[0] = true; strArray1[0] = string.Format(" {0} {1,-10}", (object) Language.GetTextValue("UI.LoadingCode"), (object) Program.LoadedPercentage.ToString("P0")); num5 = 1; } else { 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.chTitle = true; LanguageManager.Instance.SetLanguage(this.selectedMenu); Main.menuMode = 0; Main.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; Main.PlaySound(11); } else if (this.selectedMenu >= 1) { Main.chTitle = true; LanguageManager.Instance.SetLanguage(this.selectedMenu); Main.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; Main.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) Main.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; Main.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; Main.PlaySound(10); Main.menuMode = 7; } int index3 = index2 + 1; strArray1[index3] = Lang.misc[102].Value; if (this.selectedMenu == index3) { WorldGen.WorldGenParam_Evil = 1; Main.PlaySound(10); Main.menuMode = 7; } int index4 = index3 + 1; strArray1[index4] = Lang.misc[103].Value; if (this.selectedMenu == index4) { WorldGen.WorldGenParam_Evil = -1; Main.PlaySound(10); Main.menuMode = 7; } int index5 = index4 + 1; strArray1[index5] = Language.GetTextValue("UI.Back"); if (this.selectedMenu == index5 | flag5) { flag5 = false; Main.PlaySound(11); Main.menuMode = -7; } int num10 = index5 + 1; Main.clrInput(); goto label_627; case -7: num2 = 200; num4 = 60; numArray1[2] = 30; numArray1[3] = 30; numArray3[3] = (byte) 2; numArray1[4] = 70; if (this.focusMenu == 2) { strArray1[0] = Language.GetTextValue("UI.NormalDescriptionFlavor"); strArray1[1] = Language.GetTextValue("UI.NormalDescription"); } else if (this.focusMenu == 3) { strArray1[0] = Language.GetTextValue("UI.ExpertDescriptionFlavor"); strArray1[1] = Language.GetTextValue("UI.ExpertDescription"); } else 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.Back"); num5 = 5; if (this.selectedMenu == 2) { Main.expertMode = false; Main.PlaySound(10); Main.menuMode = 7; if (Main.SettingsUnlock_WorldEvil) Main.menuMode = -71; } else if (this.selectedMenu == 3) { Main.expertMode = true; Main.PlaySound(10); Main.menuMode = 7; if (Main.SettingsUnlock_WorldEvil) Main.menuMode = -71; } else if (this.selectedMenu == 4 | flag5) { flag5 = false; Main.PlaySound(11); Main.menuMode = 16; } Main.clrInput(); goto label_627; 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; for (int index6 = 0; index6 < 12; ++index6) { string str = ""; switch (index6) { case 0: str = "Solar"; break; case 1: str = "Vortex"; break; case 2: str = "Nebula"; break; case 3: str = "Stardust"; break; case 4: str = "MoonLord"; break; case 5: str = "MonolithSolar"; break; case 6: str = "MonolithVortex"; break; case 7: str = "MonolithNebula"; break; case 8: str = "MonolithStardust"; break; case 9: str = "Blizzard"; break; case 10: str = "HeatDistortion"; break; case 11: str = "Sandstorm"; break; } if (SkyManager.Instance[str] != null && SkyManager.Instance[str].IsActive()) SkyManager.Instance.Deactivate(str); if (Filters.Scene[str].IsActive()) Filters.Scene[str].Deactivate(); } if (Filters.Scene["BloodMoon"].IsActive()) Filters.Scene["BloodMoon"].Deactivate(); if (SkyManager.Instance["Martian"].IsActive()) SkyManager.Instance["Martian"].Deactivate(); if (SkyManager.Instance["Slime"].IsActive()) SkyManager.Instance["Slime"].Deactivate(); int index7 = 0; num5 = 5; num4 = 60; strArray1[index7] = Lang.menu[12].Value; if (this.selectedMenu == index7) { Main.PlaySound(10); Main.menuMode = 1; } int index8 = index7 + 1; strArray1[index8] = Lang.menu[13].Value; if (this.selectedMenu == index8) { Main.PlaySound(10); Main.menuMode = 12; } int index9 = index8 + 1; strArray1[index9] = Lang.menu[131].Value; if (this.selectedMenu == index9) { Main.PlaySound(10); Main.MenuUI.SetState((UIState) Main.AchievementsMenu); Main.menuMode = 888; } int index10 = index9 + 1; strArray1[index10] = Lang.menu[14].Value; if (this.selectedMenu == index10) { Main.PlaySound(10); Main.menuMode = 11; } int index11 = index10 + 1; strArray1[index11] = Lang.menu[15].Value; if (this.selectedMenu == index11) this.QuitGame(); int num11 = index11 + 1; goto label_627; case 1: Main.MenuUI.SetState((UIState) Main._characterSelectMenu); Main.menuMode = 888; goto label_627; case 2: flag4 = true; if (this.selectedMenu == 0) { Main.menuMode = 17; Main.PlaySound(10); Main.selColor = Main.PendingPlayer.hairColor; } if (this.selectedMenu == 1) { Main.menuMode = 18; Main.PlaySound(10); Main.selColor = Main.PendingPlayer.eyeColor; } if (this.selectedMenu == 2) { Main.menuMode = 19; Main.PlaySound(10); Main.selColor = Main.PendingPlayer.skinColor; } if (this.selectedMenu == 3) { Main.menuMode = 20; Main.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) { Main.PlaySound(20); Main.PendingPlayer.Male = false; } else { Main.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) { Main.PlaySound(10); Main.menuMode = 222; } if (this.selectedMenu == 7) { Main.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 num12 = (float) Main.rand.Next(60, 120) * 0.01f; if ((double) num12 > 1.0) num12 = 1f; Main.PendingPlayer.skinColor.R = (byte) ((double) Main.rand.Next(240, (int) byte.MaxValue) * (double) num12); Main.PendingPlayer.skinColor.G = (byte) ((double) Main.rand.Next(110, 140) * (double) num12); Main.PendingPlayer.skinColor.B = (byte) ((double) Main.rand.Next(75, 110) * (double) num12); 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(10); } 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; Main.PlaySound(11); Main.menuMode = 1; goto label_627; } else if (this.selectedMenu == 6) { Main.PlaySound(10); Main.PendingPlayer.name = ""; Main.menuMode = 3; Main.clrInput(); goto label_627; } else goto label_627; case 3: Main.MenuUI.SetState((UIState) new UIVirtualKeyboard(Lang.menu[45].Value, "", new UIVirtualKeyboard.KeyboardSubmitEvent(this.OnCharacterNamed), Main.CreateGoToMenuEvent(2))); Main.menuMode = 888; goto label_627; 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); Main.PlaySound(10); Main.menuMode = 1; goto label_627; } else if (this.selectedMenu == 2 | flag5) { flag5 = false; Main.PlaySound(11); Main.menuMode = 1; goto label_627; } else goto label_627; case 6: Main.MenuUI.SetState((UIState) Main._worldSelectMenu); Main.menuMode = 888; goto label_627; 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_627; 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].IsExpertMode) 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) { Main.PlaySound(12); Main.menuSkip -= 5; if (Main.menuSkip < 0) { Main.menuSkip = 0; goto label_627; } else goto label_627; } else if (this.selectedMenu == 6 && Main.menuSkip < Main.WorldList.Count - 7) { Main.PlaySound(12); Main.menuSkip += 5; if (Main.menuSkip >= Main.PlayerList.Count - 7) { Main.menuSkip = Main.WorldList.Count - 7; goto label_627; } else goto label_627; } else if (this.selectedMenu == 7 | flag5) { flag5 = false; Main.PlaySound(11); Main.menuMode = 6; goto label_627; } else if (this.selectedMenu >= 0) { Main.selectedWorld = this.selectedMenu + Main.menuSkip; Main.PlaySound(10); Main.menuMode = 9; goto label_627; } else goto label_627; 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); Main.PlaySound(10); Main.menuMode = 6; goto label_627; } else if (this.selectedMenu == 2 | flag5) { Main.PlaySound(11); Main.menuMode = 6; goto label_627; } else goto label_627; case 10: num5 = 1; strArray1[0] = Main.statusText; flagArray1[0] = true; num2 = 300; goto label_627; 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) { Main.PlaySound(10); Main.menuMode = 112; } int index17 = index16 + 1; strArray1[index17] = Lang.menu[210].Value; if (this.selectedMenu == index17) { Main.PlaySound(10); Main.menuMode = 1112; } int index18 = index17 + 1; strArray1[index18] = Lang.menu[63].Value; if (this.selectedMenu == index18) { Main.PlaySound(10); Main.menuMode = 1111; } int index19 = index18 + 1; strArray1[index19] = Lang.menu[65].Value; if (this.selectedMenu == index19) { Main.PlaySound(11); Main.menuMode = 26; } int index20 = index19 + 1; strArray1[index20] = Lang.menu[218].Value; if (this.selectedMenu == index20) { Main.PlaySound(10); Main.menuMode = 1125; } int index21 = index20 + 1; strArray1[index21] = Lang.menu[219].Value; if (this.selectedMenu == index21) { Main.PlaySound(10); Main.menuMode = 1127; } int index22 = index21 + 1; strArray1[index22] = Lang.menu[103].Value; if (this.selectedMenu == index22) { Main.PlaySound(10); Main.menuMode = 1213; } int index23 = index22 + 1; strArray1[index23] = Lang.menu[5].Value; if (this.selectedMenu == index23 | flag5) { flag5 = false; Main.PlaySound(11); Main.menuMode = 0; Main.SaveSettings(); goto label_627; } else goto label_627; case 12: int num13 = 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 + num13] = Lang.menu[88].Value; strArray1[2 + num13] = Lang.menu[5].Value; if (this.selectedMenu == 0) { Main.LoadPlayers(); Main.menuMultiplayer = true; Main.PlaySound(10); Main.menuMode = 1; } else if (this.selectedMenu == 1 + num13) { Main.LoadPlayers(); Main.PlaySound(10); Main.menuMode = 1; Main.menuMultiplayer = true; Main.menuServer = true; } else if (this.selectedMenu == 1) { Main.PlaySound(10); SocialAPI.Friends.OpenJoinInterface(); } else if (this.selectedMenu == 2 + num13 | flag5) { flag5 = false; Main.PlaySound(11); Main.menuMode = 0; } num5 = 3 + num13; goto label_627; 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) Main.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]; if (Netplay.SetRemoteIP(Main.getIP)) { Main.menuMode = 10; Netplay.StartTcpClient(); } } if (this.selectedMenu == 10 | flag5) { flag5 = false; Main.PlaySound(11); Main.menuMode = 1; } if (this.selectedMenu == 9 || !flagArray2[2] && Main.inputTextEnter) { Main.PlaySound(12); Main.menuMode = 131; Main.clrInput(); goto label_627; } else goto label_627; 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; Main.PlaySound(11); Main.menuMode = 0; Main.netMode = 0; goto label_627; } else goto label_627; 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; Main.PlaySound(11); goto label_627; } 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; Main.PlaySound(10); WorldGen.setWorldSize(); goto label_627; } else goto label_627; 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 num14 = 51; if (this.focusMenu == 0) UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 9; if (this.selectedMenu == 0) { Main.PlaySound(12); ++Main.PendingPlayer.hair; if (Main.PendingPlayer.hair >= num14) Main.PendingPlayer.hair = 0; } else if (this.selectedMenu2 == 0) { Main.PlaySound(12); --Main.PendingPlayer.hair; if (Main.PendingPlayer.hair < 0) Main.PendingPlayer.hair = num14 - 1; } if (this.selectedMenu == 2 | flag5) { flag5 = false; Main.menuMode = 2; Main.PlaySound(11); goto label_627; } else goto label_627; 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; Main.PlaySound(11); goto label_627; } else goto label_627; 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; Main.PlaySound(11); goto label_627; } else goto label_627; case 20: flag4 = true; if (this.selectedMenu == 0) { Main.menuMode = 21; Main.PlaySound(10); Main.selColor = Main.PendingPlayer.shirtColor; } if (this.selectedMenu == 1) { Main.menuMode = 22; Main.PlaySound(10); Main.selColor = Main.PendingPlayer.underShirtColor; } if (this.selectedMenu == 2) { Main.menuMode = 23; Main.PlaySound(10); Main.selColor = Main.PendingPlayer.pantsColor; } if (this.selectedMenu == 3) { Main.selColor = Main.PendingPlayer.shoeColor; Main.menuMode = 24; Main.PlaySound(10); } if (this.selectedMenu == 5 | flag5) { flag5 = false; Main.PlaySound(11); Main.menuMode = 2; } if (this.selectedMenu == 4) { Main.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_627; 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; Main.PlaySound(11); goto label_627; } else goto label_627; 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; Main.PlaySound(11); goto label_627; } else goto label_627; 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; Main.PlaySound(11); goto label_627; } else goto label_627; 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; Main.PlaySound(11); goto label_627; } else goto label_627; 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; Main.PlaySound(11); goto label_627; } else goto label_627; 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; Main.PlaySound(11); goto label_627; } else goto label_627; 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; Main.PlaySound(11); } else if (this.selectedMenu == 14) { Main.ResetKeyBindings(); Main.setKey = -1; Main.PlaySound(11); } else if (this.selectedMenu >= 0) Main.setKey = this.selectedMenu; if (Main.setKey >= 0) { Microsoft.Xna.Framework.Input.Keys[] pressedKeys = Main.keyState.GetPressedKeys(); if (pressedKeys.Length != 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_627; } else goto label_627; } else goto label_627; } else goto label_627; 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; Main.PlaySound(11); goto label_627; } else goto label_627; 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) Main.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_627; } else if (this.selectedMenu == 2 || Main.inputTextEnter || Main.autoPass) { string str1 = "-autoshutdown -password \"" + Netplay.ServerPassword + "\" -lang " + (object) Language.ActiveCulture.LegacyId; string str2 = !Main.ActiveWorldFileData.IsCloudSave ? str1 + " -world \"" + Main.worldPathName + "\"" : str1 + " -cloudworld \"" + Main.worldPathName + "\""; this.tServer.StartInfo.FileName = "TerrariaServer.exe"; this.tServer.StartInfo.Arguments = str2; if (Main.libPath != "") { ProcessStartInfo startInfo = this.tServer.StartInfo; startInfo.Arguments = startInfo.Arguments + " -loadlib " + Main.libPath; } this.tServer.StartInfo.UseShellExecute = false; this.tServer.StartInfo.CreateNoWindow = true; if (SocialAPI.Network != null) SocialAPI.Network.LaunchLocalServer(this.tServer, Main.MenuServerMode); else this.tServer.Start(); Netplay.SetRemoteIP("127.0.0.1"); Main.autoPass = true; Main.statusText = Lang.menu[8].Value; Netplay.StartTcpClient(); Main.menuMode = 10; goto label_627; } else goto label_627; case 100: num5 = 1; strArray1[0] = Main.statusText; flagArray1[0] = true; num2 = 300; goto label_627; case 111: for (int index30 = 0; index30 < 9; ++index30) numArray4[index30] = 0.85f; bool flag7 = true; System.Drawing.Rectangle bounds = Screen.FromPoint(((Form) Control.FromHandle(Main.instance.Window.Handle)).Location).Bounds; if (bounds.Width > Main.maxScreenW || bounds.Height > Main.maxScreenH) flag7 = false; num2 = 210; num4 = 55; int index31 = 0; strArray1[index31] = Lang.menu[73].Value + ": " + (object) Main.PendingResolutionWidth + "x" + (object) Main.PendingResolutionHeight; if (this.selectedMenu == index31) { Main.PlaySound(12); int num15 = 0; for (int index32 = 0; index32 < Main.numDisplayModes; ++index32) { if (Main.displayWidth[index32] == Main.PendingResolutionWidth && Main.displayHeight[index32] == Main.PendingResolutionHeight) { num15 = index32; break; } } int index33 = (num15 + 1) % Main.numDisplayModes; Main.PendingResolutionWidth = Main.displayWidth[index33]; Main.PendingResolutionHeight = Main.displayHeight[index33]; } int index34 = index31 + 1; if (flag7) { strArray1[index34] = Lang.menu[Main.PendingBorderlessState ? 245 : 246].Value; if (this.selectedMenu == index34) { Main.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.screenBorderless = Main.PendingBorderlessState; Main.screenBorderlessPendingResizes = Main.screenBorderless ? 6 : 0; Main.SetResolution(Main.PendingResolutionWidth, Main.PendingResolutionHeight); } Main.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; Main.PlaySound(11); } num5 = index35 + 1; goto label_627; 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) { Main.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) { Main.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) { Main.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) { Main.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; Main.PlaySound(11); goto label_627; } else goto label_627; case 131: int num16 = 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) Main.PlaySound(12); strArray1[0] = Lang.menu[90].Value; flagArray2[2] = true; if (Main.getPort != "") { bool flag8 = false; try { num16 = Convert.ToInt32(Main.getPort); if (num16 > 0) { if (num16 <= (int) ushort.MaxValue) flag8 = true; } } catch { } if (flag8) 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; Main.PlaySound(11); Main.menuMode = 1; } if (this.selectedMenu == 2 || !flagArray2[2] && Main.inputTextEnter) { Netplay.ListenPort = num16; Main.autoPass = false; if (Netplay.SetRemoteIP(Main.getIP)) { Main.menuMode = 10; Netplay.StartTcpClient(); goto label_627; } else goto label_627; } else goto label_627; 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 + ".bak", Main.worldPathName, Main.ActiveWorldFileData.IsCloudSave); Main.PlaySound(10); WorldGen.playWorld(); Main.menuMode = 10; } else { Main.PlaySound(11); Main.menuMode = 0; Main.netMode = 0; } } if (this.selectedMenu == 2 | flag5) { flag5 = false; Main.PlaySound(11); Main.menuMode = 0; Main.netMode = 0; goto label_627; } else goto label_627; 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; Main.PlaySound(11); Main.menuMode = 0; Main.netMode = 0; goto label_627; } else goto label_627; 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_627; } else if (this.selectedMenu == 2) { Main.menuMode = 2; Main.PendingPlayer.difficulty = (byte) 1; goto label_627; } else if (this.selectedMenu == 3) { Main.PendingPlayer.difficulty = (byte) 2; Main.menuMode = 2; goto label_627; } else goto label_627; 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; Main.PlaySound(11); goto label_627; } else goto label_627; 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; Main.PlaySound(11); Main.menuMode = 0; Main.netMode = 0; if (SocialAPI.Network != null) { SocialAPI.Network.CancelJoin(); goto label_627; } else goto label_627; } else goto label_627; 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; Main.PlaySound(12); goto label_627; case 2: Main.MenuServerMode ^= ServerMode.FriendsCanJoin; Main.PlaySound(12); goto label_627; case 3: Main.MenuServerMode ^= ServerMode.FriendsOfFriends; Main.PlaySound(12); goto label_627; case 4: Main.clrInput(); Netplay.ServerPassword = ""; Main.GetInputText(""); Main.autoPass = false; Main.menuMode = 30; Main.PlaySound(10); goto label_627; case 5: Main.menuMode = 6; Main.PlaySound(11); goto label_627; default: goto label_627; } case 1111: num2 = 186; num4 = 32; for (int index42 = 0; index42 < 11; ++index42) numArray4[index42] = 0.6f; numArray1[11] = 8; num5 = 12; strArray1[0] = !Main.graphics.IsFullScreen ? Lang.menu[50].Value : Lang.menu[49].Value; Main.bgScroll = (int) Math.Round((1.0 - (double) Main.caveParallax) * 500.0); strArray1[1] = Lang.menu[51].Value; strArray1[2] = Lang.menu[52].Value; strArray1[3] = Lang.menu[247 + Main.FrameSkipMode].Value; switch (Lighting.lightMode) { case 0: strArray1[4] = Lang.menu[55].Value; break; case 1: strArray1[4] = Lang.menu[56].Value; break; case 2: strArray1[4] = Lang.menu[57].Value; break; case 3: strArray1[4] = Lang.menu[58].Value; break; } strArray1[5] = Lighting.LightingThreads != 0 ? Lang.menu[116].Value + " " + (object) (Lighting.LightingThreads + 1) : Lang.menu[116].Value + " " + Lang.menu[117].Value; switch (Main.qaStyle) { case 0: strArray1[6] = Lang.menu[59].Value; break; case 1: strArray1[6] = Lang.menu[60].Value; break; case 2: strArray1[6] = Lang.menu[61].Value; break; default: strArray1[6] = Lang.menu[62].Value; break; } strArray1[7] = !Main.BackgroundEnabled ? Lang.menu[101].Value : Lang.menu[100].Value; strArray1[10] = Language.GetTextValue("UI.Effects"); strArray1[11] = Lang.menu[5].Value; if (this.selectedMenu == 7) { Main.PlaySound(12); Main.BackgroundEnabled = !Main.BackgroundEnabled; } if (this.selectedMenu == 11 | flag5) { flag5 = false; Main.PlaySound(11); Main.SaveSettings(); Main.menuMode = 11; } strArray1[9] = Main.SettingsEnabled_MinersWobble ? Lang.menu[250].Value : Lang.menu[251].Value; if (this.selectedMenu == 9) { Main.PlaySound(12); Main.SettingsEnabled_MinersWobble = !Main.SettingsEnabled_MinersWobble; } strArray1[8] = ChildSafety.Disabled ? Lang.menu[132].Value : Lang.menu[133].Value; if (this.selectedMenu == 8) { Main.PlaySound(12); ChildSafety.Disabled = !ChildSafety.Disabled; } if (this.selectedMenu == 6) { Main.PlaySound(12); ++Main.qaStyle; if (Main.qaStyle > 3) Main.qaStyle = 0; } if (this.selectedMenu == 5) { Main.PlaySound(12); ++Lighting.LightingThreads; if (Lighting.LightingThreads > Environment.ProcessorCount - 1) Lighting.LightingThreads = 0; } if (this.selectedMenu == 4) { Main.PlaySound(12); ++Lighting.lightMode; if (Lighting.lightMode >= 4) Lighting.lightMode = 0; } if (this.selectedMenu == 3) { Main.PlaySound(12); ++Main.FrameSkipMode; if (Main.FrameSkipMode < 0 || Main.FrameSkipMode > 2) Main.FrameSkipMode = 0; } if (this.selectedMenu == 2) { Main.PlaySound(11); Main.menuMode = 28; } if (this.selectedMenu == 10) { Main.PlaySound(11); Main.menuMode = 2008; } if (this.selectedMenu == 1) { Main.PlaySound(10); Main.menuMode = 111; } if (this.selectedMenu == 0) { Main.ToggleFullScreen(); goto label_627; } else goto label_627; case 1112: num2 = 210; num4 = 42; num5 = 7; numArray1[num5 - 1] = 18; for (int index43 = 0; index43 < num5; ++index43) numArray4[index43] = 0.75f; int index44 = 0; strArray1[index44] = !Main.showItemText ? Lang.menu[72].Value : Lang.menu[71].Value; if (this.selectedMenu == index44) { Main.PlaySound(12); Main.showItemText = !Main.showItemText; } int index45 = index44 + 1; strArray1[index45] = Lang.menu[123].Value + " " + Lang.menu[124 + Main.invasionProgressMode].Value; if (this.selectedMenu == index45) { Main.PlaySound(12); ++Main.invasionProgressMode; if (Main.invasionProgressMode >= 3) Main.invasionProgressMode = 0; } int index46 = index45 + 1; strArray1[index46] = Main.placementPreview ? Lang.menu[128].Value : Lang.menu[129].Value; if (this.selectedMenu == index46) { Main.PlaySound(12); Main.placementPreview = !Main.placementPreview; } int index47 = index46 + 1; strArray1[index47] = ItemSlot.Options.HighlightNewItems ? Lang.inter[117].Value : Lang.inter[116].Value; if (this.selectedMenu == index47) { Main.PlaySound(12); ItemSlot.Options.HighlightNewItems = !ItemSlot.Options.HighlightNewItems; } int index48 = index47 + 1; strArray1[index48] = Main.MouseShowBuildingGrid ? Lang.menu[229].Value : Lang.menu[230].Value; if (this.selectedMenu == index48) { Main.PlaySound(12); Main.MouseShowBuildingGrid = !Main.MouseShowBuildingGrid; } int index49 = index48 + 1; strArray1[index49] = Main.GamepadDisableInstructionsDisplay ? Lang.menu[241].Value : Lang.menu[242].Value; if (this.selectedMenu == index49) { Main.PlaySound(12); Main.GamepadDisableInstructionsDisplay = !Main.GamepadDisableInstructionsDisplay; } int index50 = index49 + 1; strArray1[index50] = Lang.menu[5].Value; if (this.selectedMenu == index50 | flag5) { flag5 = false; Main.menuMode = 11; Main.PlaySound(11); goto label_627; } else goto label_627; case 1125: num2 = 232; num4 = 38; num5 = 7; numArray1[num5 - 1] = 18; for (int index51 = 0; index51 < num5; ++index51) numArray4[index51] = 0.73f; int index52 = 0; strArray1[index52] = Lang.menu[64].Value; if (this.selectedMenu == index52) { Main.PlaySound(10); Main.selColor = Main.mouseColor; Main.mouseColorSlider.SetHSL(Main.mouseColor); Main.menuMode = 25; } int index53 = index52 + 1; strArray1[index53] = Lang.menu[217].Value; if (this.selectedMenu == index53) { Main.PlaySound(10); Main.selColor = Main.MouseBorderColor; Main.mouseBorderColorSlider.SetHSL(Main.mouseColor); Main.menuMode = 252; } int index54 = index53 + 1; strArray1[index54] = Main.cSmartCursorToggle ? Lang.menu[121].Value : Lang.menu[122].Value; if (this.selectedMenu == index54) { Main.PlaySound(12); Main.cSmartCursorToggle = !Main.cSmartCursorToggle; } int index55 = index54 + 1; strArray1[index55] = Player.SmartCursorSettings.SmartAxeAfterPickaxe ? Lang.menu[214].Value : Lang.menu[213].Value; if (this.selectedMenu == index55) { Main.PlaySound(12); Player.SmartCursorSettings.SmartAxeAfterPickaxe = !Player.SmartCursorSettings.SmartAxeAfterPickaxe; } int index56 = index55 + 1; strArray1[index56] = Player.SmartCursorSettings.SmartBlocksEnabled ? Lang.menu[215].Value : Lang.menu[216].Value; if (this.selectedMenu == index56) { Main.PlaySound(12); Player.SmartCursorSettings.SmartBlocksEnabled = !Player.SmartCursorSettings.SmartBlocksEnabled; } int index57 = index56 + 1; switch (LockOnHelper.UseMode) { case LockOnHelper.LockOnMode.FocusTarget: strArray1[index57] = Lang.menu[232].Value; break; case LockOnHelper.LockOnMode.TargetClosest: strArray1[index57] = Lang.menu[233].Value; break; case LockOnHelper.LockOnMode.ThreeDS: strArray1[index57] = Lang.menu[234].Value; break; } if (this.selectedMenu == index57) { Main.PlaySound(12); LockOnHelper.CycleUseModes(); } int index58 = index57 + 1; strArray1[index58] = Lang.menu[5].Value; if (this.selectedMenu == index58 | flag5) { flag5 = false; Main.menuMode = 11; Main.PlaySound(11); goto label_627; } else goto label_627; case 1127: num2 = 250; num4 = 52; num5 = 5; numArray1[num5 - 1] = 18; for (int index59 = 0; index59 < num5; ++index59) numArray4[index59] = 0.78f; int index60 = 0; strArray1[index60] = Main.ReversedUpDownArmorSetBonuses ? Lang.menu[220].Value : Lang.menu[221].Value; if (this.selectedMenu == index60) { Main.PlaySound(12); Main.ReversedUpDownArmorSetBonuses = !Main.ReversedUpDownArmorSetBonuses; } int index61 = index60 + 1; strArray1[index61] = Player.SmartCursorSettings.SmartWallReplacement ? Lang.menu[226].Value : Lang.menu[225].Value; if (this.selectedMenu == index61) { Main.PlaySound(12); Player.SmartCursorSettings.SmartWallReplacement = !Player.SmartCursorSettings.SmartWallReplacement; } int index62 = index61 + 1; strArray1[index62] = ItemSlot.Options.DisableLeftShiftTrashCan ? Lang.menu[224].Value : Lang.menu[223].Value; if (this.selectedMenu == index62) { Main.PlaySound(12); ItemSlot.Options.DisableLeftShiftTrashCan = !ItemSlot.Options.DisableLeftShiftTrashCan; } int index63 = index62 + 1; strArray1[index63] = Lang.menu[222].Value; if (this.selectedMenu == index63) { Main.PlaySound(10); Main.MenuUI.SetState((UIState) Main.ManageControlsMenu); Main.menuMode = 888; } int index64 = index63 + 1; strArray1[index64] = Lang.menu[5].Value; if (this.selectedMenu == index64 | flag5) { flag5 = false; Main.menuMode = 11; Main.PlaySound(11); goto label_627; } else goto label_627; 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; Main.PlaySound(11); goto label_627; } else goto label_627; 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_627; 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 index65 = 0; index65 < 6; ++index65) { flagArray4[index65] = true; numArray4[index65] = 0.55f; numArray2[index65] = -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; Main.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; Main.PlaySound(11); } else if (this.selectedMenu >= 0) Main.setKey = this.selectedMenu; if (Main.setKey >= 0) { Microsoft.Xna.Framework.Input.Keys[] pressedKeys = Main.keyState.GetPressedKeys(); if (pressedKeys.Length != 0) { string str = string.Concat((object) pressedKeys[0]); if (str != "None") { if (Main.setKey == 0) Main.cMapStyle = str; if (Main.setKey == 1) Main.cMapFull = str; if (Main.setKey == 2) Main.cMapZoomIn = str; if (Main.setKey == 3) Main.cMapZoomOut = str; if (Main.setKey == 4) Main.cMapAlphaUp = str; if (Main.setKey == 5) Main.cMapAlphaDown = str; Main.setKey = -1; goto label_627; } else goto label_627; } else goto label_627; } else goto label_627; default: goto label_627; } } num5 = 2; strArray1[0] = Main.statusText; flagArray1[0] = true; num2 = 300; strArray1[1] = Lang.menu[6].Value; if (this.selectedMenu == 1 | flag5) { flag5 = false; Netplay.disconnect = true; Netplay.Connection.Socket.Close(); Main.PlaySound(11); Main.menuMode = 0; Main.netMode = 0; try { this.tServer.Kill(); break; } catch { break; } } else break; } } label_627: 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 num17 = this.focusMenu; if (Main.menuMode != menuMode2) { Main.blockMouse = true; Main.menuSkip = 0; num5 = 0; if (PlayerInput.UsingGamepad && Main.InvisibleCursorForGamepad) { this.focusMenu = num17 = -1; int num18; PlayerInput.MouseY = num18 = 0; PlayerInput.MouseX = num18; Main.mouseY = num18; Main.mouseX = num18; } for (int index66 = 0; index66 < Main.maxMenuItems; ++index66) this.menuItemScale[index66] = 0.8f; } if (!Main.mouseLeft) Main.blockMouse = true; this.selectedMenu = -1; this.selectedMenu2 = -1; this.focusMenu = -1; 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 num19 = num8; int num20 = Main.screenWidth / 2 - this.hueTexture.Width / 2; int num21 = 167; Vector3 hsl = Main.rgbToHsl(Main.selColor); float Hue = hsl.X; float Saturation1 = hsl.Y; float Luminosity1 = hsl.Z; float num22 = (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 = num22; } else { Hue = Main.hBar; Saturation1 = Main.sBar; Luminosity1 = Main.lBar; float aBar = Main.aBar; } Main.spriteBatch.Draw(this.hueTexture, new Vector2((float) num20, (float) num19), Microsoft.Xna.Framework.Color.White); if (Main.mouseX > num20 - 4 && Main.mouseX < num20 + this.hueTexture.Width + 4 && Main.mouseY > num19 - 4 && Main.mouseY < num19 + this.hueTexture.Height + 4 && this.grabColorSlider == 0 || this.grabColorSlider == 1) Main.spriteBatch.Draw(Main.colorHighlightTexture, new Vector2((float) num20, (float) num19), Main.OurFavoriteColor); Main.spriteBatch.Draw(Main.colorSliderTexture, new Vector2((float) num20 + (float) (this.hueTexture.Width - 2) * Main.hBar - (float) (Main.colorSliderTexture.Width / 2), (float) (num19 - Main.colorSliderTexture.Height / 2 + this.hueTexture.Height / 2)), Microsoft.Xna.Framework.Color.White); if (Main.mouseX > num20 - 4 && Main.mouseX < num20 + this.hueTexture.Width + 4 && Main.mouseY > num19 - 4 && Main.mouseY < num19 + this.hueTexture.Height + 4 && this.grabColorSlider == 0 || this.grabColorSlider == 1) { Main.focusColor = 1; UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 5; if (Main.mouseLeft && !Main.blockMouse) { this.grabColorSlider = 1; Hue = (float) (Main.mouseX - num20) / (float) this.hueTexture.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) num20, (float) num19) + Main.colorBarTexture.Size() / 2f); int num23 = num19 + 26; Main.spriteBatch.Draw(Main.colorBarTexture, new Vector2((float) num20, (float) num23), Microsoft.Xna.Framework.Color.White); for (int index67 = 0; index67 <= num21; ++index67) { float Saturation2 = (float) index67 / (float) num21; Microsoft.Xna.Framework.Color rgb = Main.hslToRgb(Hue, Saturation2, Luminosity1); Main.spriteBatch.Draw(Main.colorBlipTexture, new Vector2((float) (num20 + index67 + 5), (float) (num23 + 4)), rgb); } if (Main.mouseX > num20 - 4 && Main.mouseX < num20 + this.hueTexture.Width + 4 && Main.mouseY > num23 - 4 && Main.mouseY < num23 + this.hueTexture.Height + 4 && this.grabColorSlider == 0 || this.grabColorSlider == 2) Main.spriteBatch.Draw(Main.colorHighlightTexture, new Vector2((float) num20, (float) num23), Main.OurFavoriteColor); Main.spriteBatch.Draw(Main.colorSliderTexture, new Vector2((float) num20 + (float) (this.hueTexture.Width - 2) * Main.sBar - (float) (Main.colorSliderTexture.Width / 2), (float) (num23 - Main.colorSliderTexture.Height / 2 + this.hueTexture.Height / 2)), Microsoft.Xna.Framework.Color.White); if (Main.mouseX > num20 - 4 && Main.mouseX < num20 + this.hueTexture.Width + 4 && Main.mouseY > num23 - 4 && Main.mouseY < num23 + this.hueTexture.Height + 4 && this.grabColorSlider == 0 || this.grabColorSlider == 2) { Main.focusColor = 2; UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 6; if (Main.mouseLeft && !Main.blockMouse) { this.grabColorSlider = 2; Saturation1 = (float) (Main.mouseX - num20) / (float) this.hueTexture.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) num20, (float) num23) + Main.colorBarTexture.Size() / 2f); int num24 = num23 + 26; Main.spriteBatch.Draw(Main.colorBarTexture, new Vector2((float) num20, (float) num24), Microsoft.Xna.Framework.Color.White); float num25 = 0.15f; if (Main.menuMode == 252) num25 = 0.0f; for (int index68 = 0; index68 <= num21; ++index68) { float Luminosity2 = (float) index68 / (float) num21; Microsoft.Xna.Framework.Color rgb = Main.hslToRgb(Hue, Saturation1, Luminosity2); Main.spriteBatch.Draw(Main.colorBlipTexture, new Vector2((float) (num20 + index68 + 5), (float) (num24 + 4)), rgb); } if (Main.mouseX > num20 - 4 && Main.mouseX < num20 + this.hueTexture.Width + 4 && Main.mouseY > num24 - 4 && Main.mouseY < num24 + this.hueTexture.Height + 4 && this.grabColorSlider == 0 || this.grabColorSlider == 3) Main.spriteBatch.Draw(Main.colorHighlightTexture, new Vector2((float) num20, (float) num24), Main.OurFavoriteColor); Main.spriteBatch.Draw(Main.colorSliderTexture, new Vector2((float) num20 + (float) (this.hueTexture.Width - 2) * (float) (((double) Main.lBar - (double) num25) / (1.0 - (double) num25)) - (float) (Main.colorSliderTexture.Width / 2), (float) (num24 - Main.colorSliderTexture.Height / 2 + this.hueTexture.Height / 2)), Microsoft.Xna.Framework.Color.White); if (Main.mouseX > num20 - 4 && Main.mouseX < num20 + this.hueTexture.Width + 4 && Main.mouseY > num24 - 4 && Main.mouseY < num24 + this.hueTexture.Height + 4 && this.grabColorSlider == 0 || this.grabColorSlider == 3) { Main.focusColor = 3; UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 7; if (Main.mouseLeft && !Main.blockMouse) { this.grabColorSlider = 3; float num26 = (float) (Main.mouseX - num20) / (float) this.hueTexture.Width; if ((double) num26 < 0.0) num26 = 0.0f; if ((double) num26 > 1.0) num26 = 1f; Luminosity1 = num26 * (1f - num25) + num25; Main.lBar = Luminosity1; } } GamepadMainMenuHandler.MenuItemPositions.Add(new Vector2((float) num20, (float) num24) + Main.colorBarTexture.Size() / 2f); bool flag9 = false; if (Main.menuMode == 252) { int num27 = num24 + 26; flag9 = true; Main.spriteBatch.Draw(Main.colorBarTexture, new Vector2((float) num20, (float) num27), Microsoft.Xna.Framework.Color.White); Microsoft.Xna.Framework.Color rgb = Main.hslToRgb(Hue, Saturation1, Luminosity1); for (int index69 = 0; index69 <= num21; ++index69) { float num28 = (float) index69 / (float) num21; Microsoft.Xna.Framework.Color color4 = rgb * num28; Main.spriteBatch.Draw(Main.colorBlipTexture, new Vector2((float) (num20 + index69 + 5), (float) (num27 + 4)), color4); } if (Main.mouseX > num20 - 4 && Main.mouseX < num20 + this.hueTexture.Width + 4 && Main.mouseY > num27 - 4 && Main.mouseY < num27 + this.hueTexture.Height + 4 && this.grabColorSlider == 0 || this.grabColorSlider == 4) Main.spriteBatch.Draw(Main.colorHighlightTexture, new Vector2((float) num20, (float) num27), Main.OurFavoriteColor); Main.spriteBatch.Draw(Main.colorSliderTexture, new Vector2((float) num20 + (float) (this.hueTexture.Width - 2) * Main.aBar - (float) (Main.colorSliderTexture.Width / 2), (float) (num27 - Main.colorSliderTexture.Height / 2 + this.hueTexture.Height / 2)), Microsoft.Xna.Framework.Color.White); if (Main.mouseX > num20 - 4 && Main.mouseX < num20 + this.hueTexture.Width + 4 && Main.mouseY > num27 - 4 && Main.mouseY < num27 + this.hueTexture.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 num29 = (float) (Main.mouseX - num20) / (float) this.hueTexture.Width; if ((double) num29 < 0.0) num29 = 0.0f; if ((double) num29 > 1.0) num29 = 1f; Main.aBar = num29; } } GamepadMainMenuHandler.MenuItemPositions.Add(new Vector2((float) num20, (float) num27) + Main.colorBarTexture.Size() / 2f); } if (focusColor != Main.focusColor) Main.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 str3 = ""; for (int index70 = 0; index70 < 6; ++index70) { int num30 = num8; int num31 = 370 + Main.screenWidth / 2 - 400; if (index70 == 0) str3 = Lang.menu[95].Value; if (index70 == 1) { str3 = Lang.menu[96].Value; num30 += 30; } if (index70 == 2) { str3 = Lang.menu[97].Value; num30 += 60; } if (index70 == 3) { str3 = string.Concat((object) Main.selColor.R); num31 += 90; } if (index70 == 4) { str3 = string.Concat((object) Main.selColor.G); num31 += 90; num30 += 30; } if (index70 == 5) { str3 = string.Concat((object) Main.selColor.B); num31 += 90; num30 += 60; } for (int index71 = 0; index71 < 5; ++index71) { Microsoft.Xna.Framework.Color color5 = Microsoft.Xna.Framework.Color.Black; if (index71 == 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 num32 = (int) color5.R - ((int) byte.MaxValue - maxValue); if (num32 < 0) num32 = 0; color5 = new Microsoft.Xna.Framework.Color((int) (byte) num32, (int) (byte) num32, (int) (byte) num32, (int) (byte) maxValue); int num33 = 0; int num34 = 0; if (index71 == 0) num33 = -2; if (index71 == 1) num33 = 2; if (index71 == 2) num34 = -2; if (index71 == 3) num34 = 2; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontDeathText, str3, new Vector2((float) (num31 + num33), (float) (num30 + num34)), color5, 0.0f, new Vector2(), 0.5f, SpriteEffects.None, 0.0f); } } bool flag10 = false; for (int index72 = 0; index72 < 2; ++index72) { for (int index73 = 0; index73 < 3; ++index73) { int num35 = num8 + index73 * 30 - 12; int num36 = 360 + Main.screenWidth / 2 - 400; float num37 = 0.9f; int num38; if (index72 == 0) { num38 = num36 - 70; num35 += 2; } else num38 = num36 - 40; string str4 = "-"; if (index72 == 1) str4 = "+"; Vector2 vector2 = new Vector2(24f, 24f); int num39 = 142; if (Main.mouseX > num38 && (double) Main.mouseX < (double) num38 + (double) vector2.X && Main.mouseY > num35 + 13 && (double) Main.mouseY < (double) (num35 + 13) + (double) vector2.Y) { if (Main.focusColor != (index72 + 1) * (index73 + 10)) Main.PlaySound(12); Main.focusColor = (index72 + 1) * (index73 + 10); flag10 = true; num39 = (int) byte.MaxValue; if (Main.mouseLeft) { if (Main.colorDelay <= 1) { Main.colorDelay = Main.colorDelay != 0 ? 3 : 40; int num40 = index72; if (index72 == 0) { num40 = -1; if ((int) Main.selColor.R + (int) Main.selColor.G + (int) Main.selColor.B <= 150) num40 = 0; } if (index73 == 0 && (int) Main.selColor.R + num40 >= 0 && (int) Main.selColor.R + num40 <= (int) byte.MaxValue) Main.selColor.R += (byte) num40; if (index73 == 1 && (int) Main.selColor.G + num40 >= 0 && (int) Main.selColor.G + num40 <= (int) byte.MaxValue) Main.selColor.G += (byte) num40; if (index73 == 2 && (int) Main.selColor.B + num40 >= 0 && (int) Main.selColor.B + num40 <= (int) byte.MaxValue) Main.selColor.B += (byte) num40; } --Main.colorDelay; } else Main.colorDelay = 0; } for (int index74 = 0; index74 < 5; ++index74) { Microsoft.Xna.Framework.Color color6 = Microsoft.Xna.Framework.Color.Black; if (index74 == 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 num41 = (int) color6.R - ((int) byte.MaxValue - num39); if (num41 < 0) num41 = 0; color6 = new Microsoft.Xna.Framework.Color((int) (byte) num41, (int) (byte) num41, (int) (byte) num41, (int) (byte) num39); int num42 = 0; int num43 = 0; if (index74 == 0) num42 = -2; if (index74 == 1) num42 = 2; if (index74 == 2) num43 = -2; if (index74 == 3) num43 = 2; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontDeathText, str4, new Vector2((float) (num38 + num42), (float) (num35 + num43)), color6, 0.0f, new Vector2(), num37, SpriteEffects.None, 0.0f); } } } if (!flag10) { Main.focusColor = 0; Main.colorDelay = 0; } } if (flag2) { int num44 = 320; string text = ""; for (int index75 = 0; index75 < 6; ++index75) { int num45 = num44; int num46 = 370 + Main.screenWidth / 2 - 400; switch (index75) { case 0: text = Lang.menu[98].Value; num45 += 30; break; case 1: text = Lang.menu[99].Value; break; case 2: text = Lang.menu[119].Value; num45 += 60; break; case 3: text = Math.Round((double) Main.musicVolume * 100.0).ToString() + "%"; num46 += 90; break; case 4: text = Math.Round((double) Main.soundVolume * 100.0).ToString() + "%"; num46 += 90; num45 += 30; break; case 5: text = Math.Round((double) Main.ambientVolume * 100.0).ToString() + "%"; num46 += 90; num45 += 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 num47 = (int) textColor.R - ((int) byte.MaxValue - maxValue); if (num47 < 0) num47 = 0; textColor = new Microsoft.Xna.Framework.Color((int) (byte) num47, (int) (byte) num47, (int) (byte) num47, (int) (byte) maxValue); Utils.DrawBorderStringFourWay(Main.spriteBatch, Main.fontDeathText, text, (float) num46, (float) num45, 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((float) (Main.screenWidth / 2 - 40), (float) (num44 - 18 + 30)); GamepadMainMenuHandler.MenuItemPositions.Add(IngameOptions.valuePosition - Main.colorBarTexture.Size() * new Vector2(0.5f, 0.0f)); float num48 = IngameOptions.DrawValueBar(Main.spriteBatch, 1f, Main.musicVolume); if (IngameOptions.inBar || IngameOptions.rightLock == 3) { UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 2; IngameOptions.rightHover = 3; if (Main.mouseLeft && IngameOptions.rightLock == 3) Main.musicVolume = num48; } IngameOptions.valuePosition = new Vector2((float) (Main.screenWidth / 2 - 40), (float) (num44 - 18 + 60)); GamepadMainMenuHandler.MenuItemPositions.Add(IngameOptions.valuePosition - Main.colorBarTexture.Size() * new Vector2(0.5f, 0.0f)); float num49 = IngameOptions.DrawValueBar(Main.spriteBatch, 1f, Main.soundVolume); if (IngameOptions.inBar || IngameOptions.rightLock == 2) { UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 3; IngameOptions.rightHover = 2; if (Main.mouseLeft && IngameOptions.rightLock == 2) Main.soundVolume = num49; } IngameOptions.valuePosition = new Vector2((float) (Main.screenWidth / 2 - 40), (float) (num44 - 18 + 90)); GamepadMainMenuHandler.MenuItemPositions.Add(IngameOptions.valuePosition - Main.colorBarTexture.Size() * new Vector2(0.5f, 0.0f)); float num50 = IngameOptions.DrawValueBar(Main.spriteBatch, 1f, Main.ambientVolume); if (IngameOptions.inBar || IngameOptions.rightLock == 4) { UILinkPointNavigator.Shortcuts.OPTIONS_BUTTON_SPECIALFEATURE = 4; IngameOptions.rightHover = 4; if (Main.mouseLeft && IngameOptions.rightLock == 4) Main.ambientVolume = num50; } if (IngameOptions.rightHover != -1) IngameOptions.rightLock = IngameOptions.rightHover; if (IngameOptions.rightHover != rightHover) Main.PlaySound(12); } if (flag3) { int num51 = 400; string str = ""; for (int index76 = 0; index76 < 4; ++index76) { int num52 = num51; int num53 = 370 + Main.screenWidth / 2 - 400; if (index76 == 0) str = Lang.menu[52].Value + ": " + (object) Main.bgScroll; for (int index77 = 0; index77 < 5; ++index77) { Microsoft.Xna.Framework.Color color7 = Microsoft.Xna.Framework.Color.Black; if (index77 == 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 num54 = (int) color7.R - ((int) byte.MaxValue - maxValue); if (num54 < 0) num54 = 0; color7 = new Microsoft.Xna.Framework.Color((int) (byte) num54, (int) (byte) num54, (int) (byte) num54, (int) (byte) maxValue); int num55 = 0; int num56 = 0; if (index77 == 0) num55 = -2; if (index77 == 1) num55 = 2; if (index77 == 2) num56 = -2; if (index77 == 3) num56 = 2; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontDeathText, str, new Vector2((float) (num53 + num55), (float) (num52 + num56)), 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) (num51 + 12)); GamepadMainMenuHandler.MenuItemPositions.Add(IngameOptions.valuePosition - Main.colorBarTexture.Size() * new Vector2(0.5f, 0.0f)); float num57 = 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 (Main.mouseLeft && IngameOptions.rightLock == 2) { Main.bgScroll = (int) ((double) num57 * 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 index78 = 0; index78 < num5; ++index78) { if (strArray1[index78] != null) { Vector2 vector2_1 = Main.fontDeathText.MeasureString(strArray1[index78]); vector2_1.X *= 0.5f; vector2_1.Y *= 0.5f; for (int index79 = 0; index79 < 5; ++index79) { Microsoft.Xna.Framework.Color color8 = Microsoft.Xna.Framework.Color.Black; if (index79 == 4) { switch (numArray3[index78]) { 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 num58 = (int) ((double) byte.MaxValue * ((double) this.menuItemScale[index78] * 2.0 - 1.0)); if (flagArray1[index78]) num58 = (int) byte.MaxValue; int num59 = (int) color8.R - ((int) byte.MaxValue - num58); if (num59 < 0) num59 = 0; int num60 = (int) color8.G - ((int) byte.MaxValue - num58); if (num60 < 0) num60 = 0; int num61 = (int) color8.B - ((int) byte.MaxValue - num58); if (num61 < 0) num61 = 0; if (num17 == index78 && index79 == 4) { float num62 = (float) num58 / (float) byte.MaxValue; num59 = (int) ((double) num59 * (1.0 - (double) num62) + (double) byte.MaxValue * (double) num62); num60 = (int) ((double) num60 * (1.0 - (double) num62) + 215.0 * (double) num62); num61 = (int) ((double) num61 * (1.0 - (double) num62) + 0.0 * (double) num62); } color8 = new Microsoft.Xna.Framework.Color((int) (byte) num59, (int) (byte) num60, (int) (byte) num61, (int) (byte) num58); if (flagArray3[index78]) { if (index79 == 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 num63 = 0; int num64 = 0; if (index79 == 0) num63 = -2; if (index79 == 1) num63 = 2; if (index79 == 2) num64 = -2; if (index79 == 3) num64 = 2; float num65 = this.menuItemScale[index78]; if (Main.menuMode == 15 && index78 == 0) num65 *= 0.35f; else if (Main.netMode == 2) num65 *= 0.5f; float num66 = num65 * numArray4[index78]; if (!flagArray4[index78]) DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontDeathText, strArray1[index78], new Vector2((float) (num3 + num63 + numArray2[index78]), (float) (num2 + num4 * index78 + num64) + vector2_1.Y * numArray4[index78] + (float) numArray1[index78]), color8, 0.0f, vector2_1, num66, SpriteEffects.None, 0.0f); else DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontDeathText, strArray1[index78], new Vector2((float) (num3 + num63 + numArray2[index78]), (float) (num2 + num4 * index78 + num64) + vector2_1.Y * numArray4[index78] + (float) numArray1[index78]), color8, 0.0f, new Vector2(0.0f, vector2_1.Y), num66, SpriteEffects.None, 0.0f); } if (!flagArray1[index78] && !flagArray2[index78]) GamepadMainMenuHandler.MenuItemPositions.Add(new Vector2((float) (num3 + numArray2[index78]), (float) (num2 + num4 * index78) + vector2_1.Y * numArray4[index78] + (float) numArray1[index78])); if (!flagArray4[index78]) { int num67 = 0; this.menuWide[index78] = false; Vector2 vector2_2 = Main.fontDeathText.MeasureString(strArray1[index78]) * numArray4[index78]; if ((double) Main.mouseX > (double) num3 - (double) vector2_2.X * 0.5 + (double) numArray2[index78] - (double) num67 && (double) Main.mouseX < (double) num3 + (double) vector2_2.X * 0.5 * (double) numArray4[index78] + (double) numArray2[index78] + (double) num67 && Main.mouseY > num2 + num4 * index78 + numArray1[index78] && (double) Main.mouseY < (double) (num2 + num4 * index78 + numArray1[index78]) + 50.0 * (double) numArray4[index78] && Main.hasFocus) { this.focusMenu = index78; if (flagArray1[index78] || flagArray2[index78]) { this.focusMenu = -1; } else { if (num17 != this.focusMenu) flag11 = true; if (Main.mouseLeftRelease && Main.mouseLeft) this.selectedMenu = index78; if (Main.mouseRightRelease && Main.mouseRight) this.selectedMenu2 = index78; } } } else { Vector2 vector2_3 = Main.fontDeathText.MeasureString(strArray1[index78]) * numArray4[index78]; if (Main.mouseX > num3 + numArray2[index78] && (double) Main.mouseX < (double) num3 + (double) vector2_3.X + (double) numArray2[index78] && Main.mouseY > num2 + num4 * index78 + numArray1[index78] && (double) Main.mouseY < (double) (num2 + num4 * index78 + numArray1[index78]) + 50.0 * (double) numArray4[index78] && Main.hasFocus) { this.focusMenu = index78; if (flagArray1[index78] || flagArray2[index78]) { this.focusMenu = -1; } else { if (num17 != this.focusMenu) flag11 = true; if (Main.mouseLeftRelease && Main.mouseLeft) this.selectedMenu = index78; if (Main.mouseRightRelease && Main.mouseRight) this.selectedMenu2 = index78; } } } } } if (flag11 && num17 != this.focusMenu) Main.PlaySound(12); if (GamepadMainMenuHandler.MenuItemPositions.Count == 0) { Vector2 vector2 = new Vector2((float) Math.Cos((double) Main.GlobalTime * 6.28318548202515), (float) Math.Sin((double) Main.GlobalTime * 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 index80 = 0; index80 < Main.maxMenuItems; ++index80) { if (index80 == this.focusMenu) { if ((double) this.menuItemScale[index80] < 1.0) this.menuItemScale[index80] += 0.02f; if ((double) this.menuItemScale[index80] > 1.0) this.menuItemScale[index80] = 1f; } else if ((double) this.menuItemScale[index80] > 0.8) this.menuItemScale[index80] -= 0.02f; } if (flag4) { Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise); Player pendingPlayer = Main.PendingPlayer; pendingPlayer.PlayerFrame(); pendingPlayer.position.X = (float) num6 + Main.screenPosition.X; pendingPlayer.position.Y = (float) num7 + Main.screenPosition.Y; this.DrawPlayer(pendingPlayer, pendingPlayer.position, 0.0f, Vector2.Zero); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise); } for (int index81 = 0; index81 < 5; ++index81) { Microsoft.Xna.Framework.Color color9 = Microsoft.Xna.Framework.Color.Black; if (index81 == 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 num68 = 0; int num69 = 0; if (index81 == 0) num68 = -2; if (index81 == 1) num68 = 2; if (index81 == 2) num69 = -2; if (index81 == 3) num69 = 2; string str = "Copyright © 2017 Re-Logic"; Vector2 vector2 = Main.fontMouseText.MeasureString(str); vector2.X *= 0.5f; vector2.Y *= 0.5f; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, str, new Vector2((float) ((double) Main.screenWidth - (double) vector2.X + (double) num68 - 10.0), (float) ((double) Main.screenHeight - (double) vector2.Y + (double) num69 - 2.0)), color9, 0.0f, vector2, 1f, SpriteEffects.None, 0.0f); } for (int index82 = 0; index82 < 5; ++index82) { Microsoft.Xna.Framework.Color color10 = Microsoft.Xna.Framework.Color.Black; if (index82 == 4) { color10 = color1; color10.R = (byte) (((int) byte.MaxValue + (int) color10.R) / 2); color10.G = (byte) (((int) byte.MaxValue + (int) color10.R) / 2); color10.B = (byte) (((int) byte.MaxValue + (int) color10.R) / 2); } color10.A = (byte) ((double) color10.A * 0.300000011920929); int num70 = 0; int num71 = 0; if (index82 == 0) num70 = -2; if (index82 == 1) num70 = 2; if (index82 == 2) num71 = -2; if (index82 == 3) num71 = 2; Vector2 vector2 = Main.fontMouseText.MeasureString(Main.versionNumber); vector2.X *= 0.5f; vector2.Y *= 0.5f; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, Main.versionNumber, new Vector2((float) ((double) vector2.X + (double) num70 + 10.0), (float) ((double) Main.screenHeight - (double) vector2.Y + (double) num71 - 2.0)), color10, 0.0f, vector2, 1f, SpriteEffects.None, 0.0f); } Main.DrawCursor(Main.DrawThickCursor()); if (Main.fadeCounter > 0) { Microsoft.Xna.Framework.Color color11 = Microsoft.Xna.Framework.Color.White; --Main.fadeCounter; byte num72 = (byte) ((double) Main.fadeCounter / 75.0 * (double) byte.MaxValue); color11 = new Microsoft.Xna.Framework.Color((int) num72, (int) num72, (int) num72, (int) num72); Main.spriteBatch.Draw(Main.fadeTexture, new Microsoft.Xna.Framework.Rectangle(0, 0, Main.screenWidth, Main.screenHeight), color11); } Main.spriteBatch.End(); Main.mouseLeftRelease = !Main.mouseLeft; Main.mouseRightRelease = !Main.mouseRight; if (Main.menuMode != menuMode1) return; GamepadMainMenuHandler.LastDrew = menuMode1; } private static void CycleClothingStyle(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) { this.GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Black); base.Draw(gameTime); Main.spriteBatch.Begin(); ++this.splashCounter; Microsoft.Xna.Framework.Color color = Microsoft.Xna.Framework.Color.White; byte num = 0; if (this.splashCounter <= 75) num = (byte) ((double) this.splashCounter / 75.0 * (double) byte.MaxValue); else if (this.splashCounter <= 125) num = byte.MaxValue; else if (this.splashCounter <= 200) { num = (byte) ((double) (125 - this.splashCounter) / 75.0 * (double) byte.MaxValue); } else { Main.showSplash = false; Main.fadeCounter = 75; } color = new Microsoft.Xna.Framework.Color((int) num, (int) num, (int) num, (int) num); Main.spriteBatch.Draw(Main.loTexture, new Microsoft.Xna.Framework.Rectangle(0, 0, Main.screenWidth, Main.screenHeight), color); Main.spriteBatch.End(); } protected void DrawUnderworldBackground(bool flat) { if ((double) Main.screenPosition.Y + (double) Main.screenHeight < (double) (Main.maxTilesY - 220) * 16.0) return; Vector2 vector2_1 = Main.screenPosition + new Vector2((float) (Main.screenWidth >> 1), (float) (Main.screenHeight >> 1)); float num1 = (float) (((double) Main.GameViewMatrix.Zoom.Y - 1.0) * 0.5 * 200.0); for (int index1 = 4; index1 >= 0; --index1) { Texture2D texture = Main.underworldTexture[index1]; Vector2 vector2_2 = new Vector2((float) texture.Width, (float) texture.Height) * 0.5f; Vector2 vector2_3 = new Vector2(1f / (flat ? 1f : (float) (index1 * 2) + 3f)); Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, texture.Width, texture.Height); float scale = 1.3f; Vector2 zero = Vector2.Zero; switch (index1) { case 1: int num2 = (int) ((double) Main.GlobalTime * 8.0) % 4; rectangle = new Microsoft.Xna.Framework.Rectangle((num2 >> 1) * (texture.Width >> 1), num2 % 2 * (texture.Height >> 1), texture.Width >> 1, texture.Height >> 1); vector2_2 *= 0.5f; zero.Y += 75f; break; case 2: zero.Y += 75f; break; case 3: zero.Y += 75f; break; case 4: scale = 0.5f; zero.Y -= 25f; break; } if (flat) scale *= 1.5f; Vector2 vector2_4 = vector2_2 * scale; if (flat) zero.Y += (float) (Main.underworldTexture[0].Height >> 1) * 1.3f - vector2_4.Y; zero.Y -= num1; float num3 = scale * (float) rectangle.Width; int num4 = (int) (((double) vector2_1.X * (double) vector2_3.X - (double) vector2_4.X + (double) zero.X - (double) (Main.screenWidth >> 1)) / (double) num3); for (int index2 = num4 - 2; index2 < num4 + 4 + (int) ((double) Main.screenWidth / (double) num3); ++index2) { Vector2 position = (new Vector2((float) ((double) index2 * (double) scale * ((double) rectangle.Width / (double) vector2_3.X)), (float) (Main.maxTilesY - 200) * 16f) + vector2_4 - vector2_1) * vector2_3 + vector2_1 - Main.screenPosition - vector2_4 + zero; 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 (index1 == 0) { int y = (int) ((double) position.Y + (double) rectangle.Height * (double) scale); Main.spriteBatch.Draw(Main.blackTileTexture, 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)); } } } } 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); int num5 = 128; Vector2 vector2 = Main.drawToScreen ? Vector2.Zero : new Vector2((float) Main.offScreenRange, (float) Main.offScreenRange); Vector3 vector3 = new Vector3(0.9f); float num6 = MathHelper.Clamp((float) (((double) Main.screenPosition.Y - Main.worldSurface * 16.0) / 300.0), 0.0f, 1f); Lighting.brightness = (float) ((double) Lighting.defBrightness * (1.0 - (double) num6) + 1.0 * (double) num6); float num7 = MathHelper.Clamp((float) ((double) Main.screenPosition.Y - (double) (Main.screenHeight / 2) + 200.0 - Main.rockLayer * 16.0) / 300f, 0.0f, 1f); int num8 = (int) (((double) Main.screenPosition.X + (double) (Main.screenWidth / 2)) / 16.0); int num9 = (num8 > Main.caveBackX[0] ? (num8 > Main.treeX[1] ? (num8 > Main.treeX[2] ? Main.caveBackStyle[3] : Main.caveBackStyle[2]) : Main.caveBackStyle[1]) : Main.caveBackStyle[0]) + 3; if (Main.snowTiles > 300 && ((double) Main.screenPosition.Y + (double) Main.screenHeight) / 16.0 < (double) (Main.maxTilesY - 250)) num9 = 1; if (Main.jungleTiles > 80) { if (num9 == 1) { if (Main.jungleTiles > Main.snowTiles) num9 = 11; } else num9 = 11; } 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) num9 = 15; else if (Main.player[Main.myPlayer].ZoneCrimson) num9 = 16; else if (Main.player[Main.myPlayer].ZoneHoly) num9 = 17; } else if (Main.player[Main.myPlayer].ZoneCorrupt) num9 = 12; else if (Main.player[Main.myPlayer].ZoneCrimson) num9 = 13; else if (Main.player[Main.myPlayer].ZoneHoly) num9 = 14; } if (Main.shroomTiles > 200) num9 = 2; if (num9 != Main.ugBack) { Main.oldUgBack = Main.ugBack; Main.ugBack = num9; 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 num10 = Main.ugBack; if (index1 == 1) num10 = Main.oldUgBack; int[] numArray3 = new int[7]; switch (num10) { 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; default: if (num10 >= 12 && num10 <= 14) { numArray3[0] = 66; numArray3[1] = 67; numArray3[2] = 68; numArray3[4] = 128 + Main.hellBackStyle; switch (num10) { 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 (num10 >= 15 && num10 <= 17) { numArray3[0] = 40; numArray3[1] = 33; numArray3[2] = 34; numArray3[4] = 128 + Main.hellBackStyle; switch (num10) { 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 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]; } } Lighting.defBrightness = (float) (1.20000004768372 - 0.200000002980232 * (double) num7); float x1 = vector3.X; float y1 = vector3.Y; float z = vector3.Z; this.bgParallax = (double) Main.caveParallax; this.bgStart = (int) (-Math.IEEERemainder((double) num5 + (double) Main.screenPosition.X * this.bgParallax, (double) num5) - (double) (num5 / 2)) - (int) vector2.X; this.bgLoops = Main.screenWidth / num5 + 2; this.bgTop = (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 < num5 / 16; ++index5) { int num11 = (int) (float) Math.Round(-Math.IEEERemainder((double) this.bgStart + (double) Main.screenPosition.X, 16.0)); if (num11 == -8) num11 = 8; double num12 = (double) (this.bgStart + num5 * index4 + index5 * 16 + 8); float bgTop = (float) this.bgTop; double x2 = (double) Main.screenPosition.X; Microsoft.Xna.Framework.Color color1 = Lighting.GetColor((int) ((num12 + x2) / 16.0), (int) (((double) Main.screenPosition.Y + (double) bgTop) / 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); Main.spriteBatch.Draw(Main.backgroundTexture[numArray1[0]], new Vector2((float) (this.bgStart + num5 * index4 + 16 * index5 + num11), (float) this.bgTop) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index5 + num11 + 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(Main.backgroundTexture[numArray2[0]], new Vector2((float) (this.bgStart + num5 * index4 + 16 * index5 + num11), (float) this.bgTop) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index5 + num11 + 16, 0, 16, 16)), color2); } } } bool flag1 = false; bool flag2 = false; this.bgTop = (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.bgStart = (int) (-Math.IEEERemainder((double) num5 + (double) Main.screenPosition.X * this.bgParallax, (double) num5) - (double) (num5 / 2)) - (int) vector2.X; this.bgLoops = (Main.screenWidth + (int) vector2.X * 2) / num5 + 2; if (Main.worldSurface * 16.0 < (double) Main.screenPosition.Y - 16.0) { this.bgStartY = (int) (Math.IEEERemainder((double) this.bgTop, (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.bgTop; this.bgLoopsY = (Main.screenHeight - this.bgTop + (int) vector2.Y * 2) / Main.backgroundHeight[2] + 1; } if (Main.rockLayer * 16.0 < (double) Main.screenPosition.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 num13 = (int) (float) Math.Round(-Math.IEEERemainder((double) this.bgStart + (double) Main.screenPosition.X, 16.0)); if (num13 == -8) num13 = 8; for (int index6 = 0; index6 < this.bgLoops; ++index6) { for (int index7 = 0; index7 < this.bgLoopsY; ++index7) { for (int index8 = 0; index8 < num5 / 16; ++index8) { for (int index9 = 0; index9 < 6; ++index9) { double num14 = (double) (this.bgStartY + index7 * 96 + index9 * 16 + 8); int index10 = (int) (((double) (this.bgStart + num5 * index6 + index8 * 16 + 8) + (double) Main.screenPosition.X) / 16.0); double y2 = (double) Main.screenPosition.Y; int index11 = (int) ((num14 + y2) / 16.0); Microsoft.Xna.Framework.Color color3 = Lighting.GetColor(index10, index11); if (WorldGen.InWorld(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.GetColor4Slice_New(index10, index11, out vertices); Main.tileBatch.Draw(Main.backgroundTexture[numArray1[1]], new Vector2((float) (this.bgStart + num5 * index6 + 16 * index8 + num13), (float) (this.bgStartY + Main.backgroundHeight[numArray2[1]] * index7 + 16 * index9)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index8 + num13 + 16, 16 * index9, 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[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 num15 = 0; int num16 = 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; num15 = 4; if (!Main.tile[index10, index11 - 1].active()) { color5 = slices[index12]; break; } break; case 2: num15 = 12; if (!Main.tile[index10 + 1, index11 - 1].active()) { color5 = slices[index12]; break; } break; case 3: height = 8; num16 = 4; if (!Main.tile[index10 - 1, index11].active()) { color5 = slices[index12]; break; } break; case 4: width = 8; height = 8; num15 = 4; num16 = 4; break; case 5: num15 = 12; num16 = 4; height = 8; if (!Main.tile[index10 + 1, index11].active()) { color5 = slices[index12]; break; } break; case 6: num16 = 12; if (!Main.tile[index10 - 1, index11 + 1].active()) { color5 = slices[index12]; break; } break; case 7: width = 8; height = 4; num15 = 4; num16 = 12; if (!Main.tile[index10, index11 + 1].active()) { color5 = slices[index12]; break; } break; case 8: num15 = 12; num16 = 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) x1); color4.G = (byte) ((double) color4.G * (double) y1); color4.B = (byte) ((double) color4.B * (double) z); Main.spriteBatch.Draw(Main.backgroundTexture[numArray1[1]], new Vector2((float) (this.bgStart + num5 * index6 + 16 * index8 + num15 + num13), (float) (this.bgStartY + Main.backgroundHeight[numArray1[1]] * index7 + 16 * index9 + num16)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index8 + num15 + num13 + 16, 16 * index9 + num16, 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(Main.backgroundTexture[numArray2[1]], new Vector2((float) (this.bgStart + num5 * index6 + 16 * index8 + num15 + num13), (float) (this.bgStartY + Main.backgroundHeight[numArray2[1]] * index7 + 16 * index9 + num16)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index8 + num15 + num13 + 16, 16 * index9 + num16, 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(Main.backgroundTexture[numArray1[1]], new Vector2((float) (this.bgStart + num5 * index6 + 16 * index8 + num13), (float) (this.bgStartY + Main.backgroundHeight[numArray1[1]] * index7 + 16 * index9)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index8 + num13 + 16, 16 * index9, 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(index10, index11, ref slices); for (int index13 = 0; index13 < 4; ++index13) { int num17 = 0; int num18 = 0; Microsoft.Xna.Framework.Color color7 = color3; Microsoft.Xna.Framework.Color color8 = slices[index13]; switch (index13 - 1) { case 0: num17 = 8; break; case 1: num18 = 8; break; case 2: num17 = 8; num18 = 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(Main.backgroundTexture[numArray1[1]], new Vector2((float) (this.bgStart + num5 * index6 + 16 * index8 + num17 + num13), (float) (this.bgStartY + Main.backgroundHeight[numArray1[1]] * index7 + 16 * index9 + num18)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index8 + num17 + num13 + 16, 16 * index9 + num18, 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(Main.backgroundTexture[numArray2[1]], new Vector2((float) (this.bgStart + num5 * index6 + 16 * index8 + num17 + num13), (float) (this.bgStartY + Main.backgroundHeight[numArray2[1]] * index7 + 16 * index9 + num18)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index8 + num17 + num13 + 16, 16 * index9 + num18, 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(Main.backgroundTexture[numArray1[1]], new Vector2((float) (this.bgStart + num5 * index6 + 16 * index8 + num13), (float) (this.bgStartY + Main.backgroundHeight[numArray1[1]] * index7 + 16 * index9)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index8 + num13 + 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(Main.backgroundTexture[numArray2[1]], new Vector2((float) (this.bgStart + num5 * index6 + 16 * index8 + num13), (float) (this.bgStartY + Main.backgroundHeight[numArray2[1]] * index7 + 16 * index9)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index8 + num13 + 16, 16 * index9, 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(Main.backgroundTexture[numArray1[1]], new Vector2((float) (this.bgStart + num5 * index6 + 16 * index8 + num13), (float) (this.bgStartY + Main.backgroundHeight[numArray1[1]] * index7 + 16 * index9)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index8 + num13 + 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 < num5 / 16; ++index16) { for (int index17 = 0; index17 < 6; ++index17) { double num19 = (double) (this.bgStartY + index15 * 96 + index17 * 16 + 8); int index18 = (int) (((double) (this.bgStart + num5 * index14 + index16 * 16 + 8) + (double) Main.screenPosition.X) / 16.0); double y3 = (double) Main.screenPosition.Y; int index19 = (int) ((num19 + y3) / 16.0); if (WorldGen.InWorld(index18, index19)) { 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.GetColor4Slice_New(index18, index19, out vertices, Main.ugBackTransition); byte num20 = (byte) ((double) byte.MaxValue * (double) Main.ugBackTransition); vertices.BottomLeftColor.A = num20; vertices.BottomRightColor.A = num20; vertices.TopLeftColor.A = num20; vertices.TopRightColor.A = num20; Main.tileBatch.Draw(Main.backgroundTexture[numArray2[1]], new Vector2((float) (this.bgStart + num5 * index14 + 16 * index16 + num13), (float) (this.bgStartY + Main.backgroundHeight[numArray2[1]] * index15 + 16 * index17)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index16 + num13 + 16, 16 * index17, 16, 16)), vertices, Vector2.Zero, 1f, SpriteEffects.None); } } } } } } } if (flag2) { this.bgParallax = (double) Main.caveParallax; this.bgStart = (int) (-Math.IEEERemainder((double) num5 + (double) Main.screenPosition.X * this.bgParallax, (double) num5) - (double) (num5 / 2)) - (int) vector2.X; this.bgLoops = (Main.screenWidth + (int) vector2.X * 2) / num5 + 2; this.bgTop = this.bgStartY + this.bgLoopsY * Main.backgroundHeight[2]; if (this.bgTop > -32) { for (int index20 = 0; index20 < this.bgLoops; ++index20) { for (int index21 = 0; index21 < num5 / 16; ++index21) { double num21 = (double) (this.bgStart + num5 * index20 + index21 * 16 + 8); float bgTop = (float) this.bgTop; double x3 = (double) Main.screenPosition.X; Microsoft.Xna.Framework.Color color11 = Lighting.GetColor((int) ((num21 + x3) / 16.0), (int) (((double) Main.screenPosition.Y + (double) bgTop) / 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(Main.backgroundTexture[numArray1[2]], new Vector2((float) (this.bgStart + num5 * index20 + 16 * index21 + num13), (float) this.bgTop) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index21 + num13 + 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(Main.backgroundTexture[numArray2[2]], new Vector2((float) (this.bgStart + num5 * index20 + 16 * index21 + num13), (float) this.bgTop) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index21 + num13 + 16, 0, 16, 16)), color12); } } } } } } this.bgTop = (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.bgStart = (int) (-Math.IEEERemainder((double) num5 + (double) Main.screenPosition.X * this.bgParallax, (double) num5) - (double) (num5 / 2)) - (int) vector2.X; this.bgLoops = (Main.screenWidth + (int) vector2.X * 2) / num5 + 2; if (Main.rockLayer * 16.0 + (double) Main.screenHeight < (double) Main.screenPosition.Y - 16.0) { this.bgStartY = (int) (Math.IEEERemainder((double) this.bgTop, (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.bgTop; this.bgLoopsY = (Main.screenHeight - this.bgTop + (int) vector2.Y * 2) / Main.backgroundHeight[2] + 1; } if (num2 * 16.0 < (double) Main.screenPosition.Y + 600.0) { this.bgLoopsY = (int) (num2 * 16.0 - (double) Main.screenPosition.Y + 600.0 - (double) this.bgStartY) / Main.backgroundHeight[2]; flag1 = true; } int num22 = (int) (float) Math.Round(-Math.IEEERemainder((double) this.bgStart + (double) Main.screenPosition.X, 16.0)); if (num22 == -8) num22 = 8; for (int index22 = 0; index22 < this.bgLoops; ++index22) { for (int index23 = 0; index23 < this.bgLoopsY; ++index23) { for (int index24 = 0; index24 < num5 / 16; ++index24) { for (int index25 = 0; index25 < 6; ++index25) { double num23 = (double) (this.bgStartY + index23 * 96 + index25 * 16 + 8); int index26 = (int) (((double) (this.bgStart + num5 * index22 + index24 * 16 + 8) + (double) Main.screenPosition.X) / 16.0); double y4 = (double) Main.screenPosition.Y; int index27 = (int) ((num23 + y4) / 16.0); if (WorldGen.InWorld(index26, index27, 1)) { 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 > num3 || (double) color13.G > (double) num3 * 1.1 || (double) color13.B > (double) num3 * 1.2) && !Main.tile[index26, index27].active()) { Lighting.GetColor9Slice(index26, index27, ref slices); for (int index28 = 0; index28 < 9; ++index28) { int num24 = 0; int num25 = 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; num24 = 4; if (!Main.tile[index26, index27 - 1].active()) { color15 = slices[index28]; break; } break; case 2: num24 = 12; if (!Main.tile[index26 + 1, index27 - 1].active()) { color15 = slices[index28]; break; } break; case 3: height = 8; num25 = 4; if (!Main.tile[index26 - 1, index27].active()) { color15 = slices[index28]; break; } break; case 4: width = 8; height = 8; num24 = 4; num25 = 4; break; case 5: num24 = 12; num25 = 4; height = 8; if (!Main.tile[index26 + 1, index27].active()) { color15 = slices[index28]; break; } break; case 6: num25 = 12; if (!Main.tile[index26 - 1, index27 + 1].active()) { color15 = slices[index28]; break; } break; case 7: width = 8; height = 4; num24 = 4; num25 = 12; if (!Main.tile[index26, index27 + 1].active()) { color15 = slices[index28]; break; } break; case 8: num24 = 12; num25 = 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) x1); color14.G = (byte) ((double) color14.G * (double) y1); color14.B = (byte) ((double) color14.B * (double) z); Main.spriteBatch.Draw(Main.backgroundTexture[numArray1[3]], new Vector2((float) (this.bgStart + num5 * index22 + 16 * index24 + num24 + num22), (float) (this.bgStartY + Main.backgroundHeight[numArray1[3]] * index23 + 16 * index25 + num25)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index24 + num24 + num22 + 16, 16 * index25 + num25, 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(Main.backgroundTexture[numArray2[3]], new Vector2((float) (this.bgStart + num5 * index22 + 16 * index24 + num24 + num22), (float) (this.bgStartY + Main.backgroundHeight[numArray2[3]] * index23 + 16 * index25 + num25)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index24 + num24 + num22 + 16, 16 * index25 + num25, 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(index26, index27, ref slices); for (int index29 = 0; index29 < 4; ++index29) { int num26 = 0; int num27 = 0; Microsoft.Xna.Framework.Color color17 = color13; Microsoft.Xna.Framework.Color color18 = slices[index29]; switch (index29 - 1) { case 0: num26 = 8; break; case 1: num27 = 8; break; case 2: num26 = 8; num27 = 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(Main.backgroundTexture[numArray1[3]], new Vector2((float) (this.bgStart + num5 * index22 + 16 * index24 + num26 + num22), (float) (this.bgStartY + Main.backgroundHeight[numArray1[3]] * index23 + 16 * index25 + num27)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index24 + num26 + num22 + 16, 16 * index25 + num27, 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(Main.backgroundTexture[numArray2[3]], new Vector2((float) (this.bgStart + num5 * index22 + 16 * index24 + num26 + num22), (float) (this.bgStartY + Main.backgroundHeight[numArray2[3]] * index23 + 16 * index25 + num27)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index24 + num26 + num22 + 16, 16 * index25 + num27, 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(Main.backgroundTexture[numArray1[3]], new Vector2((float) (this.bgStart + num5 * index22 + 16 * index24 + num22), (float) (this.bgStartY + Main.backgroundHeight[numArray1[3]] * index23 + 16 * index25)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index24 + num22 + 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(Main.backgroundTexture[numArray2[3]], new Vector2((float) (this.bgStart + num5 * index22 + 16 * index24 + num22), (float) (this.bgStartY + Main.backgroundHeight[numArray2[3]] * index23 + 16 * index25)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index24 + num22 + 16, 16 * index25, 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(Main.backgroundTexture[numArray1[3]], new Vector2((float) (this.bgStart + num5 * index22 + 16 * index24 + num22), (float) (this.bgStartY + Main.backgroundHeight[numArray1[3]] * index23 + 16 * index25)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index24 + num22 + 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(Main.backgroundTexture[numArray2[3]], new Vector2((float) (this.bgStart + num5 * index22 + 16 * index24 + num22), (float) (this.bgStartY + Main.backgroundHeight[numArray2[3]] * index23 + 16 * index25)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index24 + num22 + 16, 16 * index25, 16, 16)), color21); } } } } } } } } num5 = 128; if (flag1) { this.bgParallax = (double) Main.caveParallax; this.bgStart = (int) (-Math.IEEERemainder((double) num5 + (double) Main.screenPosition.X * this.bgParallax, (double) num5) - (double) (num5 / 2)) - (int) vector2.X; this.bgLoops = (Main.screenWidth + (int) vector2.X * 2) / num5 + 2; this.bgTop = this.bgStartY + this.bgLoopsY * Main.backgroundHeight[2]; for (int index30 = 0; index30 < this.bgLoops; ++index30) { for (int index31 = 0; index31 < num5 / 16; ++index31) { double num28 = (double) (this.bgStart + num5 * index30 + index31 * 16 + 8); float bgTop = (float) this.bgTop; double x4 = (double) Main.screenPosition.X; Microsoft.Xna.Framework.Color color22 = Lighting.GetColor((int) ((num28 + x4) / 16.0), (int) (((double) Main.screenPosition.Y + (double) bgTop) / 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(Main.backgroundTexture[numArray1[4]], new Vector2((float) (this.bgStart + num5 * index30 + 16 * index31 + num22), (float) this.bgTop) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index31 + num22 + 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(Main.backgroundTexture[numArray2[4]], new Vector2((float) (this.bgStart + num5 * index30 + 16 * index31 + num22), (float) this.bgTop) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index31 + num22 + 16, Main.magmaBGFrame * 16, 16, 16)), color23); } } } } } this.bgTop = (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 + 600.0) { this.bgStart = (int) (-Math.IEEERemainder((double) num5 + (double) Main.screenPosition.X * this.bgParallax, (double) num5) - (double) (num5 / 2)) - (int) vector2.X; this.bgLoops = (Main.screenWidth + (int) vector2.X * 2) / num5 + 2; if (num2 * 16.0 + (double) Main.screenHeight < (double) Main.screenPosition.Y - 16.0) { this.bgStartY = (int) (Math.IEEERemainder((double) this.bgTop, (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.bgTop; this.bgLoopsY = (Main.screenHeight - this.bgTop + (int) vector2.Y * 2) / Main.backgroundHeight[2] + 1; } if ((double) (Main.maxTilesY - 200) * 16.0 < (double) Main.screenPosition.Y + (double) Main.screenHeight) { this.bgLoopsY = (int) Math.Ceiling(((double) (Main.maxTilesY - 200) * 16.0 - (double) Main.screenPosition.Y - (double) this.bgStartY) / (double) Main.backgroundHeight[2]); flag4 = true; } int num29 = (int) ((double) num3 * 1.5); int num30 = (int) ((double) num4 * 1.5); int num31 = (int) (float) Math.Round(-Math.IEEERemainder((double) this.bgStart + (double) Main.screenPosition.X, 16.0)); if (num31 == -8) num31 = 8; for (int index32 = 0; index32 < this.bgLoops; ++index32) { for (int index33 = 0; index33 < this.bgLoopsY; ++index33) { for (int index34 = 0; index34 < num5 / 16; ++index34) { for (int index35 = 0; index35 < 6; ++index35) { double num32 = (double) (this.bgStartY + index33 * 96 + index35 * 16 + 8); int index36 = (int) (((double) (this.bgStart + num5 * index32 + index34 * 16 + 8) + (double) Main.screenPosition.X) / 16.0); double y5 = (double) Main.screenPosition.Y; int index37 = (int) ((num32 + y5) / 16.0); if (WorldGen.InWorld(index36, index37, 1)) { Microsoft.Xna.Framework.Color color24 = Lighting.GetColor(index36, index37); if (Main.tile[index36, index37] == null) Main.tile[index36, index37] = new Tile(); bool flag5 = 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]) flag5 = true; } else if (Main.wallLight[(int) Main.tile[index36, index37].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 || index37 > Main.maxTilesY - 300) && (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 > num29 || (double) color24.G > (double) num29 * 1.1 || (double) color24.B > (double) num29 * 1.2) && !Main.tile[index36, index37].active()) { Lighting.GetColor9Slice(index36, index37, ref slices); for (int index38 = 0; index38 < 9; ++index38) { int num33 = 0; int num34 = 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; num33 = 4; if (!Main.tile[index36, index37 - 1].active()) { color26 = slices[index38]; break; } break; case 2: num33 = 12; if (!Main.tile[index36 + 1, index37 - 1].active()) { color26 = slices[index38]; break; } break; case 3: height = 8; num34 = 4; if (!Main.tile[index36 - 1, index37].active()) { color26 = slices[index38]; break; } break; case 4: width = 8; height = 8; num33 = 4; num34 = 4; break; case 5: num33 = 12; num34 = 4; height = 8; if (!Main.tile[index36 + 1, index37].active()) { color26 = slices[index38]; break; } break; case 6: num34 = 12; if (!Main.tile[index36 - 1, index37 + 1].active()) { color26 = slices[index38]; break; } break; case 7: width = 8; height = 4; num33 = 4; num34 = 12; if (!Main.tile[index36, index37 + 1].active()) { color26 = slices[index38]; break; } break; case 8: num33 = 12; num34 = 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) x1); color25.G = (byte) ((double) color25.G * (double) y1); color25.B = (byte) ((double) color25.B * (double) z); Main.spriteBatch.Draw(Main.backgroundTexture[numArray1[5]], new Vector2((float) (this.bgStart + num5 * index32 + 16 * index34 + num33 + num31), (float) (this.bgStartY + Main.backgroundHeight[2] * index33 + 16 * index35 + num34)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index34 + num33 + num31 + 16, 16 * index35 + Main.backgroundHeight[2] * Main.magmaBGFrame + num34, width, height)), color25, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } } else if ((int) color24.R > num30 || (double) color24.G > (double) num30 * 1.1 || (double) color24.B > (double) num30 * 1.2) { Lighting.GetColor4Slice(index36, index37, ref slices); for (int index39 = 0; index39 < 4; ++index39) { int num35 = 0; int num36 = 0; Microsoft.Xna.Framework.Color color27 = color24; Microsoft.Xna.Framework.Color color28 = slices[index39]; switch (index39 - 1) { case 0: num35 = 8; break; case 1: num36 = 8; break; case 2: num35 = 8; num36 = 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(Main.backgroundTexture[numArray1[5]], new Vector2((float) (this.bgStart + num5 * index32 + 16 * index34 + num35 + num31), (float) (this.bgStartY + Main.backgroundHeight[2] * index33 + 16 * index35 + num36)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index34 + num35 + num31 + 16, 16 * index35 + Main.backgroundHeight[2] * Main.magmaBGFrame + num36, 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(Main.backgroundTexture[numArray1[5]], new Vector2((float) (this.bgStart + num5 * index32 + 16 * index34 + num31), (float) (this.bgStartY + Main.backgroundHeight[2] * index33 + 16 * index35)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index34 + num31 + 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) x1); color24.G = (byte) ((double) color24.G * (double) y1); color24.B = (byte) ((double) color24.B * (double) z); Main.spriteBatch.Draw(Main.backgroundTexture[numArray1[5]], new Vector2((float) (this.bgStart + num5 * index32 + 16 * index34 + num31), (float) (this.bgStartY + Main.backgroundHeight[2] * index33 + 16 * index35)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index34 + num31 + 16, 16 * index35 + 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.bgStart = (int) (-Math.IEEERemainder((double) num5 + (double) Main.screenPosition.X * this.bgParallax, (double) num5) - (double) (num5 / 2)) - (int) vector2.X; this.bgLoops = (Main.screenWidth + (int) vector2.X * 2) / num5 + 2; this.bgTop = this.bgStartY + this.bgLoopsY * Main.backgroundHeight[2]; for (int index40 = 0; index40 < this.bgLoops; ++index40) { for (int index41 = 0; index41 < num5 / 16; ++index41) { double num37 = (double) (this.bgStart + num5 * index40 + index41 * 16 + 8); float bgTop = (float) this.bgTop; double x5 = (double) Main.screenPosition.X; Microsoft.Xna.Framework.Color color29 = Lighting.GetColor((int) ((num37 + x5) / 16.0), (int) (((double) Main.screenPosition.Y + (double) bgTop) / 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(Main.backgroundTexture[numArray1[6]], new Vector2((float) (this.bgStart + num5 * index40 + 16 * index41 + num31), (float) this.bgTop) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index41 + num31 + 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(Main.backgroundTexture[numArray2[6]], new Vector2((float) (this.bgStart + num5 * index40 + 16 * index41 + num31), (float) this.bgTop) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index41 + num31 + 16, Main.magmaBGFrame * 16, 16, 16)), color30); } } } } } Lighting.brightness = Lighting.defBrightness; TimeLogger.DrawTime(3, stopwatch.Elapsed.TotalMilliseconds); } } 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.bloodTiles > Main.evilTiles && Main.bloodTiles > Main.holyTiles) num8 = (float) Main.bloodTiles; else if (Main.holyTiles > Main.evilTiles) num8 = (float) Main.holyTiles; else if (Main.evilTiles > Main.holyTiles) num8 = (float) Main.evilTiles; 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.brightness = (float) ((double) Lighting.defBrightness * (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.bloodTiles > Main.evilTiles && Main.bloodTiles > Main.holyTiles) { 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.evilTiles > 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.holyTiles > 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.treeX[1] ? (num16 > Main.treeX[2] ? Main.caveBackStyle[3] : Main.caveBackStyle[2]) : Main.caveBackStyle[1]) : Main.caveBackStyle[0]) + 3; if (Main.snowTiles > 300 && ((double) Main.screenPosition.Y + (double) Main.screenHeight) / 16.0 < (double) (Main.maxTilesY - 250)) num17 = 1; if (Main.jungleTiles > 80) { if (num17 == 1) { if (Main.jungleTiles > Main.snowTiles) num17 = 11; } else num17 = 11; } if (Main.shroomTiles > 200) num17 = 2; if (num17 != Main.ugBack) { Main.oldUgBack = Main.ugBack; Main.ugBack = 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 num18 = Main.ugBack; if (index1 == 1) num18 = Main.oldUgBack; int[] numArray3 = new int[6]; switch (num18) { 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]; } } Lighting.defBrightness = (float) (1.20000004768372 * (1.0 - (double) num12) + 1.0 * (double) num12); this.bgParallax = (double) Main.caveParallax; this.bgStart = (int) (-Math.IEEERemainder((double) num3 + (double) Main.screenPosition.X * this.bgParallax, (double) num3) - (double) (num3 / 2)) - (int) vector2.X; this.bgLoops = Main.screenWidth / num3 + 2; this.bgTop = (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.bgStart + (double) Main.screenPosition.X, 16.0)); if (num19 == -8) num19 = 8; double num20 = (double) (this.bgStart + num3 * index4 + index5 * 16 + 8); float bgTop = (float) this.bgTop; double x = (double) Main.screenPosition.X; Microsoft.Xna.Framework.Color color1 = Lighting.GetColor((int) ((num20 + x) / 16.0), (int) (((double) Main.screenPosition.Y + (double) bgTop) / 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(Main.backgroundTexture[numArray1[0]], new Vector2((float) (this.bgStart + num3 * index4 + 16 * index5 + num19), (float) this.bgTop) + 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(Main.backgroundTexture[numArray2[0]], new Vector2((float) (this.bgStart + num3 * index4 + 16 * index5 + num19), (float) this.bgTop) + 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.bgTop = (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.bgStart = (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.bgTop, (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.bgTop; this.bgLoopsY = (Main.screenHeight - this.bgTop + (int) vector2.Y * 2) / Main.backgroundHeight[2] + 1; } if (Main.rockLayer * 16.0 < (double) Main.screenPosition.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.bgStart + (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.bgStart + 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.GetColor4Slice_New(index10, index11, out vertices); Main.tileBatch.Draw(Main.backgroundTexture[numArray1[1]], new Vector2((float) (this.bgStart + 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(Main.backgroundTexture[numArray1[1]], new Vector2((float) (this.bgStart + 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(Main.backgroundTexture[numArray2[1]], new Vector2((float) (this.bgStart + 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(Main.backgroundTexture[numArray1[1]], new Vector2((float) (this.bgStart + 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(Main.backgroundTexture[numArray1[1]], new Vector2((float) (this.bgStart + 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(Main.backgroundTexture[numArray2[1]], new Vector2((float) (this.bgStart + 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(Main.backgroundTexture[numArray1[1]], new Vector2((float) (this.bgStart + 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(Main.backgroundTexture[numArray2[1]], new Vector2((float) (this.bgStart + 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(Main.backgroundTexture[numArray1[1]], new Vector2((float) (this.bgStart + 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.bgStart + 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.GetColor4Slice_New(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(Main.backgroundTexture[numArray2[1]], new Vector2((float) (this.bgStart + 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.bgStart = (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.bgTop = this.bgStartY + this.bgLoopsY * Main.backgroundHeight[2]; if (this.bgTop > -32) { for (int index20 = 0; index20 < this.bgLoops; ++index20) { for (int index21 = 0; index21 < num3 / 16; ++index21) { double num31 = (double) (this.bgStart + num3 * index20 + index21 * 16 + 8); float bgTop = (float) this.bgTop; double x = (double) Main.screenPosition.X; Microsoft.Xna.Framework.Color color11 = Lighting.GetColor((int) ((num31 + x) / 16.0), (int) (((double) Main.screenPosition.Y + (double) bgTop) / 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(Main.backgroundTexture[numArray1[2]], new Vector2((float) (this.bgStart + num3 * index20 + 16 * index21 + num23), (float) this.bgTop) + 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(Main.backgroundTexture[numArray2[2]], new Vector2((float) (this.bgStart + num3 * index20 + 16 * index21 + num23), (float) this.bgTop) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index21 + num23 + 16, 0, 16, 16)), color12); } } } } } } this.bgTop = (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.bgStart = (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.bgTop, (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.bgTop; this.bgLoopsY = (Main.screenHeight - this.bgTop + (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.bgStart + (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.bgStart + 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(Main.backgroundTexture[numArray1[3]], new Vector2((float) (this.bgStart + 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(Main.backgroundTexture[numArray2[3]], new Vector2((float) (this.bgStart + 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(Main.backgroundTexture[numArray1[3]], new Vector2((float) (this.bgStart + 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(Main.backgroundTexture[numArray2[3]], new Vector2((float) (this.bgStart + 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(Main.backgroundTexture[numArray1[3]], new Vector2((float) (this.bgStart + 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(Main.backgroundTexture[numArray2[3]], new Vector2((float) (this.bgStart + 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(Main.backgroundTexture[numArray1[3]], new Vector2((float) (this.bgStart + 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(Main.backgroundTexture[numArray2[3]], new Vector2((float) (this.bgStart + 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.bgStart = (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.bgTop = 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.bgStart + num3 * index30 + index31 * 16 + 8); float bgTop = (float) this.bgTop; double x = (double) Main.screenPosition.X; Microsoft.Xna.Framework.Color color22 = Lighting.GetColor((int) ((num38 + x) / 16.0), (int) (((double) Main.screenPosition.Y + (double) bgTop) / 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(Main.backgroundTexture[numArray1[4]], new Vector2((float) (this.bgStart + num3 * index30 + 16 * index31 + num32), (float) this.bgTop) + 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(Main.backgroundTexture[numArray2[4]], new Vector2((float) (this.bgStart + num3 * index30 + 16 * index31 + num32), (float) this.bgTop) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(16 * index31 + num32 + 16, Main.magmaBGFrame * 16, 16, 16)), color23); } } } } } this.bgTop = (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.bgStart = (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.bgTop, (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.bgTop; this.bgLoopsY = (Main.screenHeight - this.bgTop + (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.bgStart + (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.bgStart + 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(Main.backgroundTexture[numArray1[5]], new Vector2((float) (this.bgStart + 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(Main.backgroundTexture[numArray1[5]], new Vector2((float) (this.bgStart + 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(Main.backgroundTexture[numArray1[5]], new Vector2((float) (this.bgStart + 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(Main.backgroundTexture[numArray1[5]], new Vector2((float) (this.bgStart + 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.brightness = Lighting.defBrightness; 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; } 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(Main.magicPixel, 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(Main.magicPixel, 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; } protected void DrawMap() { string cursorText = ""; if (!Main.mapEnabled || !Main.mapReady) return; float num1 = 0.0f; float num2 = 0.0f; float num3 = num1; float num4 = num2; byte num5 = byte.MaxValue; int num6 = Main.maxTilesX / Main.textureMaxWidth; int num7 = Main.maxTilesY / Main.textureMaxHeight; float offScreenTiles1 = (float) Lighting.offScreenTiles; float offScreenTiles2 = (float) Lighting.offScreenTiles; float num8 = (float) (Main.maxTilesX - Lighting.offScreenTiles - 1); float num9 = (float) (Main.maxTilesY - Lighting.offScreenTiles - 42); float num10 = 0.0f; float num11 = 0.0f; float num12 = 10f; float num13 = 10f; float num14 = (float) (Main.maxTilesX - 10); float num15 = (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 num16 = 200f; float num17 = 300f; float num18 = 0.0f; float num19 = 0.0f; float num20 = num14 - 1f; float num21 = num15 - 1f; float scale = !Main.mapFullscreen ? (Main.mapStyle != 1 ? Main.mapOverlayScale : Main.mapMinimapScale) : Main.mapFullscreenScale; bool flag1 = false; Matrix transformMatrix = Main.UIScaleMatrix; if (Main.mapStyle != 1) transformMatrix = Matrix.Identity; if (Main.mapFullscreen) transformMatrix = Matrix.Identity; if (!Main.mapFullscreen && (double) scale > 1.0) { Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, (Effect) null, transformMatrix); 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 num22 = (float) Main.mouseX - Main.grabMapX; float num23 = (float) Main.mouseY - Main.grabMapY; Main.grabMapX = (float) Main.mouseX; Main.grabMapY = (float) Main.mouseY; float num24 = num22 * 0.06255f; float num25 = num23 * 0.06255f; Main.mapFullscreenPos.X -= num24 * (16f / Main.mapFullscreenScale); Main.mapFullscreenPos.Y -= num25 * (16f / Main.mapFullscreenScale); } } Main.player[Main.myPlayer].mouseInterface = true; float num26 = (float) ((double) Main.screenWidth / (double) Main.maxTilesX * 0.800000011920929); if ((double) Main.mapFullscreenScale < (double) num26) Main.mapFullscreenScale = num26; if ((double) Main.mapFullscreenScale > 16.0) Main.mapFullscreenScale = 16f; scale = Main.mapFullscreenScale; num5 = byte.MaxValue; if ((double) Main.mapFullscreenPos.X < (double) num12) Main.mapFullscreenPos.X = num12; if ((double) Main.mapFullscreenPos.X > (double) num14) Main.mapFullscreenPos.X = num14; if ((double) Main.mapFullscreenPos.Y < (double) num13) Main.mapFullscreenPos.Y = num13; if ((double) Main.mapFullscreenPos.Y > (double) num15) Main.mapFullscreenPos.Y = num15; float num27 = Main.mapFullscreenPos.X; float num28 = Main.mapFullscreenPos.Y; if (Main.resetMapFull) { Main.resetMapFull = false; num27 = (float) (((double) Main.screenPosition.X + (double) (Main.screenWidth / 2)) / 16.0); num28 = (float) (((double) Main.screenPosition.Y + (double) (Main.screenHeight / 2)) / 16.0); Main.mapFullscreenPos.X = num27; Main.mapFullscreenPos.Y = num28; } float num29 = num27 * scale; float num30 = num28 * scale; float num31 = -num29 + (float) (Main.screenWidth / 2); float num32 = -num30 + (float) (Main.screenHeight / 2); num16 = num31 + num12 * scale; num17 = num32 + num13 * scale; float num33 = (float) (Main.maxTilesX / 840) * Main.mapFullscreenScale; float num34 = num16; float num35 = num17; float num36 = (float) Main.mapTexture.Width; float num37 = (float) Main.mapTexture.Height; switch (Main.maxTilesX) { case 4200: float num38 = num33 * 0.998f; num34 -= 37.3f * num38; num35 -= 1.7f * num38; num36 = (num36 - 16f) * num38; num37 = (num37 - 8.31f) * num38; break; case 6300: float num39 = num33 * 1.09f; num34 -= 39.8f * num39; num35 = num17 - 4.08f * num39; num36 = (num36 - 26.69f) * num39; num37 = (num37 - 6.92f) * num39; if ((double) num39 < 1.2) { num37 += 2f; break; } break; case 6400: float num40 = num33 * 1.09f; num34 -= 38.8f * num40; num35 = num17 - 3.85f * num40; num36 = (num36 - 13.6f) * num40; num37 = (num37 - 6.92f) * num40; if ((double) num40 < 1.2) { num37 += 2f; break; } break; case 8400: float num41 = num33 * 0.999f; num34 -= 40.6f * num41; num35 = num17 - 5f * num41; num36 = (num36 - 8.045f) * num41; num37 = (num37 + 0.12f) * num41; if ((double) num41 < 1.2) { ++num37; break; } break; } Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise); flag1 = true; if ((double) Main.screenPosition.Y > (double) ((Main.maxTilesY - 232) * 16)) Main.spriteBatch.Draw(this.mapBG3Texture, new Microsoft.Xna.Framework.Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Microsoft.Xna.Framework.Color.White); else if (Main.player[Main.myPlayer].ZoneDungeon) Main.spriteBatch.Draw(this.mapBG5Texture, new Microsoft.Xna.Framework.Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Microsoft.Xna.Framework.Color.White); 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 == (byte) 87) Main.spriteBatch.Draw(this.mapBG14Texture, new Microsoft.Xna.Framework.Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Microsoft.Xna.Framework.Color.White); else if ((double) Main.screenPosition.Y > Main.worldSurface * 16.0) { if (Main.player[Main.myPlayer].ZoneSnow) Main.spriteBatch.Draw(this.mapBG4Texture, new Microsoft.Xna.Framework.Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Microsoft.Xna.Framework.Color.White); else if (Main.player[Main.myPlayer].ZoneJungle) Main.spriteBatch.Draw(this.mapBG13Texture, new Microsoft.Xna.Framework.Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Main.bgColor); else if (Main.sandTiles > 1000) Main.spriteBatch.Draw(this.mapBG15Texture, new Microsoft.Xna.Framework.Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Main.bgColor); else Main.spriteBatch.Draw(this.mapBG2Texture, new Microsoft.Xna.Framework.Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Microsoft.Xna.Framework.Color.White); } else { int num42 = (int) (((double) Main.screenPosition.X + (double) (Main.screenWidth / 2)) / 16.0); if (Main.player[Main.myPlayer].ZoneCorrupt) Main.spriteBatch.Draw(this.mapBG6Texture, new Microsoft.Xna.Framework.Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Main.bgColor); else if (Main.player[Main.myPlayer].ZoneCrimson) Main.spriteBatch.Draw(this.mapBG7Texture, new Microsoft.Xna.Framework.Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Main.bgColor); else if (Main.player[Main.myPlayer].ZoneHoly) Main.spriteBatch.Draw(this.mapBG8Texture, new Microsoft.Xna.Framework.Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Main.bgColor); else if ((double) Main.screenPosition.Y / 16.0 < Main.worldSurface + 10.0 && (num42 < 380 || num42 > Main.maxTilesX - 380)) Main.spriteBatch.Draw(this.mapBG11Texture, new Microsoft.Xna.Framework.Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Main.bgColor); else if (Main.player[Main.myPlayer].ZoneSnow) Main.spriteBatch.Draw(this.mapBG12Texture, new Microsoft.Xna.Framework.Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Main.bgColor); else if (Main.player[Main.myPlayer].ZoneJungle) Main.spriteBatch.Draw(this.mapBG9Texture, new Microsoft.Xna.Framework.Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Main.bgColor); else if (Main.sandTiles > 1000) Main.spriteBatch.Draw(this.mapBG10Texture, new Microsoft.Xna.Framework.Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Main.bgColor); else Main.spriteBatch.Draw(this.mapBG1Texture, new Microsoft.Xna.Framework.Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Main.bgColor); } Microsoft.Xna.Framework.Rectangle destinationRectangle = new Microsoft.Xna.Framework.Rectangle((int) num34, (int) num35, (int) num36, (int) num37); Main.spriteBatch.Draw(Main.mapTexture, destinationRectangle, Microsoft.Xna.Framework.Color.White); if ((double) scale < 1.0) { Main.spriteBatch.End(); Main.spriteBatch.Begin(); flag1 = false; } } else { switch (Main.mapStyle) { case 1: Main.miniMapWidth = 240; Main.miniMapHeight = 240; Main.miniMapX = Main.screenWidth - Main.miniMapWidth - 52; Main.miniMapY = 90; 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; scale = Main.mapMinimapScale; num5 = (byte) ((double) byte.MaxValue * (double) Main.mapMinimapAlpha); num16 = (float) Main.miniMapX; num17 = (float) Main.miniMapY; num3 = num16; num4 = num17; 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); num10 = (float) -(num44 - (double) (int) (((double) Main.screenPosition.X + (double) (PlayerInput.RealScreenWidth / 2)) / 16.0)) * scale; num11 = (float) -((double) num45 - (double) (int) (((double) Main.screenPosition.Y + (double) (PlayerInput.RealScreenHeight / 2)) / 16.0)) * scale; num20 = (float) Main.miniMapWidth / scale; num21 = (float) Main.miniMapHeight / scale; num18 = (float) (int) num44 - num20 / 2f; num19 = (float) (int) num45 - num21 / 2f; double num46 = (double) Main.maxTilesY + (double) num19; float x1 = num3 - 6f; float y1 = num4 - 6f; Main.spriteBatch.Draw(Main.miniMapFrame2Texture, new Vector2(x1, y1), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.miniMapFrame2Texture.Width, Main.miniMapFrame2Texture.Height)), new Microsoft.Xna.Framework.Color((int) num5, (int) num5, (int) num5, (int) num5), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); break; case 2: float num47 = (float) Main.screenWidth / (float) Main.maxTilesX; if ((double) Main.mapOverlayScale < (double) num47) Main.mapOverlayScale = num47; if ((double) Main.mapOverlayScale > 16.0) Main.mapOverlayScale = 16f; if ((double) Main.mapOverlayAlpha < 0.01) Main.mapOverlayAlpha = 0.01f; if ((double) Main.mapOverlayAlpha > 1.0) Main.mapOverlayAlpha = 1f; scale = Main.mapOverlayScale; num5 = (byte) ((double) byte.MaxValue * (double) Main.mapOverlayAlpha); int maxTilesX = Main.maxTilesX; int maxTilesY = Main.maxTilesY; float num48 = (float) (((double) Main.screenPosition.X + (double) (Main.screenWidth / 2)) / 16.0); double num49 = ((double) Main.screenPosition.Y + (double) (Main.screenHeight / 2)) / 16.0; float num50 = num48 * scale; double num51 = (double) scale; double num52 = num49 * num51; float num53 = -num50 + (float) (Main.screenWidth / 2); float num54 = (float) -num52 + (float) (Main.screenHeight / 2); num16 = num53 + num12 * scale; num17 = num54 + num13 * scale; break; } } if (Main.mapStyle == 1 && !Main.mapFullscreen) { if ((double) num18 < (double) num12) num16 -= (num18 - num12) * scale; if ((double) num19 < (double) num13) num17 -= (num19 - num13) * scale; } float num55 = num18 + num20; float num56 = num19 + num21; if ((double) num18 > (double) num12) num12 = num18; if ((double) num19 > (double) num13) num13 = num19; if ((double) num55 < (double) num14) num14 = num55; if ((double) num56 < (double) num15) num15 = num56; float num57 = (float) Main.textureMaxWidth * scale; float num58 = (float) Main.textureMaxHeight * scale; float num59 = num16; float num60 = 0.0f; for (int index3 = 0; index3 <= 4; ++index3) { if ((double) ((index3 + 1) * Main.textureMaxWidth) > (double) num12 && (double) (index3 * Main.textureMaxWidth) < (double) num12 + (double) num14) { for (int index4 = 0; index4 <= num7; ++index4) { if ((double) ((index4 + 1) * Main.textureMaxHeight) > (double) num13 && (double) (index4 * Main.textureMaxHeight) < (double) num13 + (double) num15) { float num61 = num16 + (float) (int) ((double) index3 * (double) num57); float num62 = num17 + (float) (int) ((double) index4 * (double) num58); float num63 = (float) (index3 * Main.textureMaxWidth); float num64 = (float) (index4 * Main.textureMaxHeight); float num65 = 0.0f; float num66 = 0.0f; float num67; if ((double) num63 < (double) num12) { num65 = num12 - num63; num67 = num16; } else num67 = num61 - num12 * scale; float num68; if ((double) num64 < (double) num13) { num66 = num13 - num64; num68 = num17; } else num68 = num62 - num13 * scale; float num69 = num59; float textureMaxWidth = (float) Main.textureMaxWidth; float textureMaxHeight = (float) Main.textureMaxHeight; float num70 = (float) ((index3 + 1) * Main.textureMaxWidth); float num71 = (float) ((index4 + 1) * Main.textureMaxHeight); if ((double) num70 >= (double) num14) textureMaxWidth -= num70 - num14; if ((double) num71 >= (double) num15) textureMaxHeight -= num71 - num15; float x2 = num69 + num10; float y2 = num68 + num11; if ((double) textureMaxWidth > (double) num65) Main.spriteBatch.Draw((Texture2D) this.mapTarget[index3, index4], new Vector2(x2, y2), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle((int) num65, (int) num66, (int) textureMaxWidth - (int) num65, (int) textureMaxHeight - (int) num66)), new Microsoft.Xna.Framework.Color((int) num5, (int) num5, (int) num5, (int) num5), 0.0f, new Vector2(), scale, SpriteEffects.None, 0.0f); num60 = (float) ((int) textureMaxWidth - (int) num65) * scale; } if (index4 == num7) num59 += num60; } } } if (flag1) { Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, (Effect) null, transformMatrix); } if (!Main.mapFullscreen) { if (Main.mapStyle == 2) { float num72 = (float) (((double) scale * 0.200000002980232 * 2.0 + 1.0) / 3.0); if ((double) num72 > 1.0) num72 = 1f; float num73 = num72 * Main.UIScale; for (int index5 = 0; index5 < 200; ++index5) { if (Main.npc[index5].active && Main.npc[index5].townNPC) { int headIndex = NPC.TypeToHeadIndex(Main.npc[index5].type); if (headIndex > 0) { SpriteEffects effects = SpriteEffects.None; if (Main.npc[index5].direction > 0) effects = SpriteEffects.FlipHorizontally; float num74 = (float) (((double) Main.npc[index5].position.X + (double) (Main.npc[index5].width / 2)) / 16.0) * scale; float num75 = (float) (((double) Main.npc[index5].position.Y + (double) (Main.npc[index5].height / 2)) / 16.0) * scale; float num76 = num74 + num16; float num77 = num75 + num17; float x3 = num76 - 10f * scale; float y3 = num77 - 10f * scale; Main.spriteBatch.Draw(Main.npcHeadTexture[headIndex], new Vector2(x3, y3), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.npcHeadTexture[headIndex].Width, Main.npcHeadTexture[headIndex].Height)), new Microsoft.Xna.Framework.Color((int) num5, (int) num5, (int) num5, (int) num5), 0.0f, new Vector2((float) (Main.npcHeadTexture[headIndex].Width / 2), (float) (Main.npcHeadTexture[headIndex].Height / 2)), num73, effects, 0.0f); } } if (Main.npc[index5].active && Main.npc[index5].GetBossHeadTextureIndex() != -1) { float bossHeadRotation = Main.npc[index5].GetBossHeadRotation(); SpriteEffects headSpriteEffects = Main.npc[index5].GetBossHeadSpriteEffects(); Vector2 vector2 = Main.npc[index5].Center + new Vector2(0.0f, Main.npc[index5].gfxOffY); if (Main.npc[index5].type == 134) { Vector2 center = Main.npc[index5].Center; int num78 = 1; for (int index6 = (int) Main.npc[index5].ai[0]; num78 < 15 && Main.npc[index6].active && Main.npc[index6].type >= 134 && Main.npc[index6].type <= 136; index6 = (int) Main.npc[index6].ai[0]) { ++num78; center += Main.npc[index6].Center; } vector2 = center / (float) num78; } int headTextureIndex = Main.npc[index5].GetBossHeadTextureIndex(); float num79 = vector2.X / 16f * scale; float num80 = vector2.Y / 16f * scale; float num81 = num79 + num16; float num82 = num80 + num17; float x4 = num81 - 10f * scale; float y4 = num82 - 10f * scale; Main.spriteBatch.Draw(Main.npcHeadBossTexture[headTextureIndex], new Vector2(x4, y4), new Microsoft.Xna.Framework.Rectangle?(), new Microsoft.Xna.Framework.Color((int) num5, (int) num5, (int) num5, (int) num5), bossHeadRotation, Main.npcHeadBossTexture[headTextureIndex].Size() / 2f, num73, headSpriteEffects, 0.0f); } } Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, (Effect) null, transformMatrix); for (int index = 0; index < (int) byte.MaxValue; ++index) { if (Main.player[index].active && !Main.player[index].dead && index != Main.myPlayer && (!Main.player[Main.myPlayer].hostile && !Main.player[index].hostile || Main.player[Main.myPlayer].team == Main.player[index].team && Main.player[index].team != 0 || index == Main.myPlayer)) { float num83 = (float) (((double) Main.player[index].position.X + (double) (Main.player[index].width / 2)) / 16.0) * scale; float num84 = Main.player[index].position.Y / 16f * scale; float num85 = num83 + num16; float num86 = num84 + num17; float num87 = num85 - 6f; float num88 = num86 - 2f - (float) (2.0 - (double) scale / 5.0 * 2.0); float X = num87 - 10f * scale; float Y = num88 - 10f * scale; this.DrawPlayerHead(Main.player[index], X, Y, (float) num5 / (float) byte.MaxValue, num73); } } Main.spriteBatch.End(); Main.spriteBatch.Begin(); } if (Main.mapStyle == 1) { float x5 = num3 - 6f; float y5 = num4 - 6f; float num89 = (float) (((double) scale * 0.25 * 2.0 + 1.0) / 3.0); if ((double) num89 > 1.0) num89 = 1f; for (int index7 = 0; index7 < 200; ++index7) { if (Main.npc[index7].active && Main.npc[index7].townNPC) { int headIndex = NPC.TypeToHeadIndex(Main.npc[index7].type); if (headIndex > 0) { SpriteEffects effects = SpriteEffects.None; if (Main.npc[index7].direction > 0) effects = SpriteEffects.FlipHorizontally; float num90 = ((float) (((double) Main.npc[index7].position.X + (double) (Main.npc[index7].width / 2)) / 16.0) - num18) * scale; float num91 = ((float) (((double) Main.npc[index7].position.Y + (double) Main.npc[index7].gfxOffY + (double) (Main.npc[index7].height / 2)) / 16.0) - num19) * scale; float num92 = num90 + num3; float num93 = num91 + num4 - (float) (2.0 * (double) scale / 5.0); if ((double) num92 > (double) (Main.miniMapX + 12) && (double) num92 < (double) (Main.miniMapX + Main.miniMapWidth - 16) && (double) num93 > (double) (Main.miniMapY + 10) && (double) num93 < (double) (Main.miniMapY + Main.miniMapHeight - 14)) { Main.spriteBatch.Draw(Main.npcHeadTexture[headIndex], new Vector2(num92 + num10, num93 + num11), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.npcHeadTexture[headIndex].Width, Main.npcHeadTexture[headIndex].Height)), new Microsoft.Xna.Framework.Color((int) num5, (int) num5, (int) num5, (int) num5), 0.0f, new Vector2((float) (Main.npcHeadTexture[headIndex].Width / 2), (float) (Main.npcHeadTexture[headIndex].Height / 2)), num89, effects, 0.0f); float num94 = num92 - (float) (Main.npcHeadTexture[headIndex].Width / 2) * num89; float num95 = num93 - (float) (Main.npcHeadTexture[headIndex].Height / 2) * num89; float num96 = num94 + (float) Main.npcHeadTexture[headIndex].Width * num89; float num97 = num95 + (float) Main.npcHeadTexture[headIndex].Height * num89; if ((double) Main.mouseX >= (double) num94 && (double) Main.mouseX <= (double) num96 && (double) Main.mouseY >= (double) num95 && (double) Main.mouseY <= (double) num97) cursorText = Main.npc[index7].FullName; } } } if (Main.npc[index7].active && Main.npc[index7].GetBossHeadTextureIndex() != -1) { float bossHeadRotation = Main.npc[index7].GetBossHeadRotation(); SpriteEffects headSpriteEffects = Main.npc[index7].GetBossHeadSpriteEffects(); Vector2 vector2 = Main.npc[index7].Center + new Vector2(0.0f, Main.npc[index7].gfxOffY); if (Main.npc[index7].type == 134) { Vector2 center = Main.npc[index7].Center; int num98 = 1; for (int index8 = (int) Main.npc[index7].ai[0]; num98 < 15 && Main.npc[index8].active && Main.npc[index8].type >= 134 && Main.npc[index8].type <= 136; index8 = (int) Main.npc[index8].ai[0]) { ++num98; center += Main.npc[index8].Center; } vector2 = center / (float) num98; } int headTextureIndex = Main.npc[index7].GetBossHeadTextureIndex(); float num99 = (vector2.X / 16f - num18) * scale; float num100 = (vector2.Y / 16f - num19) * scale; float num101 = num99 + num3; float num102 = num100 + num4 - (float) (2.0 * (double) scale / 5.0); if ((double) num101 > (double) (Main.miniMapX + 12) && (double) num101 < (double) (Main.miniMapX + Main.miniMapWidth - 16) && (double) num102 > (double) (Main.miniMapY + 10) && (double) num102 < (double) (Main.miniMapY + Main.miniMapHeight - 14)) { Main.spriteBatch.Draw(Main.npcHeadBossTexture[headTextureIndex], new Vector2(num101 + num10, num102 + num11), new Microsoft.Xna.Framework.Rectangle?(), new Microsoft.Xna.Framework.Color((int) num5, (int) num5, (int) num5, (int) num5), bossHeadRotation, Main.npcHeadBossTexture[headTextureIndex].Size() / 2f, num89, headSpriteEffects, 0.0f); float num103 = num101 - (float) (Main.npcHeadBossTexture[headTextureIndex].Width / 2) * num89; float num104 = num102 - (float) (Main.npcHeadBossTexture[headTextureIndex].Height / 2) * num89; float num105 = num103 + (float) Main.npcHeadBossTexture[headTextureIndex].Width * num89; float num106 = num104 + (float) Main.npcHeadBossTexture[headTextureIndex].Height * num89; if ((double) Main.mouseX >= (double) num103 && (double) Main.mouseX <= (double) num105 && (double) Main.mouseY >= (double) num104 && (double) Main.mouseY <= (double) num106) cursorText = Main.npc[index7].GivenOrTypeName; } } } Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, (Effect) null, Main.UIScaleMatrix); for (int index = 0; index < (int) byte.MaxValue; ++index) { if (Main.player[index].active && (!Main.player[Main.myPlayer].hostile && !Main.player[index].hostile || Main.player[Main.myPlayer].team == Main.player[index].team && Main.player[index].team != 0 || index == Main.myPlayer)) { float num107 = ((float) (((double) Main.player[index].position.X + (double) (Main.player[index].width / 2)) / 16.0) - num18) * scale; float num108 = ((float) (((double) Main.player[index].position.Y + (double) Main.player[index].gfxOffY + (double) (Main.player[index].height / 2)) / 16.0) - num19) * scale; float num109 = num107 + num3; float num110 = num108 + num4; float num111 = num109 - 6f; float num112 = num110 - 6f - (float) (2.0 - (double) scale / 5.0 * 2.0); float X = num111 + num10; float Y = num112 + num11; if ((double) Main.screenPosition.X != (double) Main.leftWorld + 640.0 + 16.0 && (double) Main.screenPosition.X + (double) Main.screenWidth != (double) Main.rightWorld - 640.0 - 32.0 && (double) Main.screenPosition.Y != (double) Main.topWorld + 640.0 + 16.0 && (double) Main.screenPosition.Y + (double) Main.screenHeight <= (double) Main.bottomWorld - 640.0 - 32.0 && index == Main.myPlayer && (double) Main.zoomX == 0.0 && (double) Main.zoomY == 0.0) { float num113 = num3 + (float) (Main.miniMapWidth / 2); Y = num4 + (float) (Main.miniMapHeight / 2) - 3f; X = num113 - 4f; } if (!Main.player[index].dead && (double) X > (double) (Main.miniMapX + 6) && (double) X < (double) (Main.miniMapX + Main.miniMapWidth - 16) && (double) Y > (double) (Main.miniMapY + 6) && (double) Y < (double) (Main.miniMapY + Main.miniMapHeight - 14)) { this.DrawPlayerHead(Main.player[index], X, Y, (float) num5 / (float) byte.MaxValue, num89); if (index != Main.myPlayer) { float num114 = (float) ((double) X + 4.0 - 14.0 * (double) num89); float num115 = (float) ((double) Y + 2.0 - 14.0 * (double) num89); float num116 = num114 + 28f * num89; float num117 = num115 + 28f * num89; if ((double) Main.mouseX >= (double) num114 && (double) Main.mouseX <= (double) num116 && (double) Main.mouseY >= (double) num115 && (double) Main.mouseY <= (double) num117) cursorText = Main.player[index].name; } } if (Main.player[index].showLastDeath) { float num118 = (Main.player[index].lastDeathPostion.X / 16f - num18) * scale; float num119 = (Main.player[index].lastDeathPostion.Y / 16f - num19) * scale; float num120 = num118 + num3; float num121 = num119 + num4 - (float) (2.0 - (double) scale / 5.0 * 2.0); float x6 = num120 + num10; float y6 = num121 + num11; if ((double) x6 > (double) (Main.miniMapX + 8) && (double) x6 < (double) (Main.miniMapX + Main.miniMapWidth - 18) && (double) y6 > (double) (Main.miniMapY + 8) && (double) y6 < (double) (Main.miniMapY + Main.miniMapHeight - 16)) { Main.spriteBatch.Draw(this.mapDeathTexture, new Vector2(x6, y6), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, this.mapDeathTexture.Width, this.mapDeathTexture.Height)), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2((float) this.mapDeathTexture.Width * 0.5f, (float) this.mapDeathTexture.Height * 0.5f), num89, SpriteEffects.None, 0.0f); float num122 = (float) ((double) x6 + 4.0 - 14.0 * (double) num89); float num123 = (float) ((double) y6 + 2.0 - 14.0 * (double) num89); float num124 = num122 - 4f; float num125 = num123 - 4f; float num126 = num124 + 28f * num89; float num127 = num125 + 28f * num89; if ((double) Main.mouseX >= (double) num124 && (double) Main.mouseX <= (double) num126 && (double) Main.mouseY >= (double) num125 && (double) Main.mouseY <= (double) num127) { TimeSpan time = DateTime.Now - Main.player[index].lastDeathTime; cursorText = Language.GetTextValue("Game.PlayerDeathTime", (object) Main.player[index].name, (object) Lang.LocalizedDuration(time, false, false)); } } } } } Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, (Effect) null, Main.UIScaleMatrix); Main.spriteBatch.Draw(Main.miniMapFrameTexture, new Vector2(x5, y5), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.miniMapFrameTexture.Width, Main.miniMapFrameTexture.Height)), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); for (int index = 0; index < 3; ++index) { float x7 = x5 + 148f + (float) (index * 26); float y7 = y5 + 234f; if ((double) Main.mouseX > (double) x7 && (double) Main.mouseX < (double) x7 + 22.0 && (double) Main.mouseY > (double) y7 && (double) Main.mouseY < (double) y7 + 22.0) { Main.spriteBatch.Draw(Main.miniMapButtonTexture[index], new Vector2(x7, y7), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.miniMapButtonTexture[index].Width, Main.miniMapButtonTexture[index].Height)), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); if (!PlayerInput.IgnoreMouseInterface) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeft) { if (Main.mouseLeftRelease) Main.PlaySound(12); switch (index) { case 0: Main.mapMinimapScale = 1.25f; continue; case 1: Main.mapMinimapScale *= 0.975f; continue; case 2: Main.mapMinimapScale *= 1.025f; continue; default: continue; } } } } } } } if (Main.mapFullscreen) { int x8 = (int) ((-(double) num16 + (double) Main.mouseX) / (double) scale + (double) num12); int y8 = (int) ((-(double) num17 + (double) Main.mouseY) / (double) scale + (double) num13); bool flag2 = false; if ((double) x8 < (double) num12) flag2 = true; if ((double) x8 >= (double) num14) flag2 = true; if ((double) y8 < (double) num13) flag2 = true; if ((double) y8 >= (double) num15) flag2 = true; if (!flag2 && Main.Map[x8, y8].Light > (byte) 40) { int type = (int) Main.Map[x8, y8].Type; int num128 = (int) MapHelper.tileLookup[21]; int num129 = (int) MapHelper.tileLookup[441]; int tileOptionCount1 = MapHelper.tileOptionCounts[21]; int num130 = (int) MapHelper.tileLookup[467]; int num131 = (int) MapHelper.tileLookup[468]; int tileOptionCount2 = MapHelper.tileOptionCounts[467]; int num132 = (int) MapHelper.tileLookup[88]; int tileOptionCount3 = MapHelper.tileOptionCounts[88]; LocalizedText[] chestType = Lang.chestType; LocalizedText[] chestType2 = Lang.chestType2; if (type >= num128 && type < num128 + tileOptionCount1) { Tile chestTile = Main.tile[x8, y8]; if (chestTile != null) { int x9 = x8; int y9 = y8; if ((int) chestTile.frameX % 36 != 0) --x9; if ((int) chestTile.frameY % 36 != 0) --y9; cursorText = Main.DrawMap_FindChestName(chestType, chestTile, x9, y9); } } else if (type >= num130 && type < num130 + tileOptionCount2) { Tile chestTile = Main.tile[x8, y8]; if (chestTile != null) { int x10 = x8; int y10 = y8; if ((int) chestTile.frameX % 36 != 0) --x10; if ((int) chestTile.frameY % 36 != 0) --y10; cursorText = Main.DrawMap_FindChestName(chestType2, chestTile, x10, y10); } } else if (type >= num129 && type < num129 + tileOptionCount1) { Tile tile = Main.tile[x8, y8]; if (tile != null) { int num133 = x8; int num134 = y8; if ((int) tile.frameX % 36 != 0) { int num135 = num133 - 1; } if ((int) tile.frameY % 36 != 0) { int num136 = num134 - 1; } cursorText = chestType[(int) tile.frameX / 36].Value; } } else if (type >= num131 && type < num131 + tileOptionCount2) { Tile tile = Main.tile[x8, y8]; if (tile != null) { int num137 = x8; int num138 = y8; if ((int) tile.frameX % 36 != 0) { int num139 = num137 - 1; } if ((int) tile.frameY % 36 != 0) { int num140 = num138 - 1; } cursorText = chestType2[(int) tile.frameX / 36].Value; } } else if (type >= num132 && type < num132 + tileOptionCount3) { Tile tile = Main.tile[x8, y8]; if (tile != null) { int num141 = x8; int num142 = y8; int num143 = (int) tile.frameX % 54 / 18; int X = num141 - num143; if ((int) tile.frameY % 36 != 0) --num142; int Y = num142; 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 num144; if (((double) scale * 0.25 * 2.0 + 1.0) / 3.0 > 1.0) num144 = 1f; num144 = 1f; float uiScale = Main.UIScale; for (int index9 = 0; index9 < 200; ++index9) { if (Main.npc[index9].active && Main.npc[index9].townNPC) { int headIndex = NPC.TypeToHeadIndex(Main.npc[index9].type); if (headIndex > 0) { SpriteEffects effects = SpriteEffects.None; if (Main.npc[index9].direction > 0) effects = SpriteEffects.FlipHorizontally; float num145 = (float) (((double) Main.npc[index9].position.X + (double) (Main.npc[index9].width / 2)) / 16.0) * scale; float num146 = (float) (((double) Main.npc[index9].position.Y + (double) Main.npc[index9].gfxOffY + (double) (Main.npc[index9].height / 2)) / 16.0) * scale; float num147 = num145 + num16; float num148 = num146 + num17; float x11 = num147 - 10f * scale; float y11 = num148 - 10f * scale; Main.spriteBatch.Draw(Main.npcHeadTexture[headIndex], new Vector2(x11, y11), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.npcHeadTexture[headIndex].Width, Main.npcHeadTexture[headIndex].Height)), new Microsoft.Xna.Framework.Color((int) num5, (int) num5, (int) num5, (int) num5), 0.0f, new Vector2((float) (Main.npcHeadTexture[headIndex].Width / 2), (float) (Main.npcHeadTexture[headIndex].Height / 2)), uiScale, effects, 0.0f); float num149 = x11 - (float) (Main.npcHeadTexture[headIndex].Width / 2) * uiScale; float num150 = y11 - (float) (Main.npcHeadTexture[headIndex].Height / 2) * uiScale; float num151 = num149 + (float) Main.npcHeadTexture[headIndex].Width * uiScale; float num152 = num150 + (float) Main.npcHeadTexture[headIndex].Height * uiScale; if ((double) Main.mouseX >= (double) num149 && (double) Main.mouseX <= (double) num151 && (double) Main.mouseY >= (double) num150 && (double) Main.mouseY <= (double) num152) cursorText = Main.npc[index9].FullName; } } 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 num153 = 1; for (int index10 = (int) Main.npc[index9].ai[0]; num153 < 15 && Main.npc[index10].active && Main.npc[index10].type >= 134 && Main.npc[index10].type <= 136; index10 = (int) Main.npc[index10].ai[0]) { ++num153; center += Main.npc[index10].Center; } vector2 = center / (float) num153; } int headTextureIndex = Main.npc[index9].GetBossHeadTextureIndex(); float num154 = vector2.X / 16f * scale; float num155 = vector2.Y / 16f * scale; float num156 = num154 + num16; float num157 = num155 + num17; float x12 = num156 - 10f * scale; float y12 = num157 - 10f * scale; Main.spriteBatch.Draw(Main.npcHeadBossTexture[headTextureIndex], new Vector2(x12, y12), new Microsoft.Xna.Framework.Rectangle?(), new Microsoft.Xna.Framework.Color((int) num5, (int) num5, (int) num5, (int) num5), bossHeadRotation, Main.npcHeadBossTexture[headTextureIndex].Size() / 2f, uiScale, headSpriteEffects, 0.0f); float num158 = x12 - (float) (Main.npcHeadBossTexture[headTextureIndex].Width / 2) * uiScale; float num159 = y12 - (float) (Main.npcHeadBossTexture[headTextureIndex].Height / 2) * uiScale; float num160 = num158 + (float) Main.npcHeadBossTexture[headTextureIndex].Width * uiScale; float num161 = num159 + (float) Main.npcHeadBossTexture[headTextureIndex].Height * uiScale; if ((double) Main.mouseX >= (double) num158 && (double) Main.mouseX <= (double) num160 && (double) Main.mouseY >= (double) num159 && (double) Main.mouseY <= (double) num161) cursorText = Main.npc[index9].GivenOrTypeName; } } bool flag3 = false; Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); for (int index = 0; index < (int) byte.MaxValue; ++index) { if (Main.player[index].active && (!Main.player[Main.myPlayer].hostile && !Main.player[index].hostile || Main.player[Main.myPlayer].team == Main.player[index].team && Main.player[index].team != 0 || index == Main.myPlayer) && Main.player[index].showLastDeath) { float num162 = (Main.player[index].lastDeathPostion.X / 16f - num18) * scale; float num163 = (Main.player[index].lastDeathPostion.Y / 16f - num19) * scale; float num164 = num162 + num16; float num165 = num163 + num17 - (float) (2.0 - (double) scale / 5.0 * 2.0); float x13 = num164 - 10f * scale; float y13 = num165 - 10f * scale; Main.spriteBatch.Draw(this.mapDeathTexture, new Vector2(x13, y13), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, this.mapDeathTexture.Width, this.mapDeathTexture.Height)), Microsoft.Xna.Framework.Color.White, 0.0f, new Vector2((float) this.mapDeathTexture.Width * 0.5f, (float) this.mapDeathTexture.Height * 0.5f), uiScale, SpriteEffects.None, 0.0f); float num166 = (float) ((double) x13 + 4.0 - 14.0 * (double) uiScale); float num167 = (float) ((double) y13 + 2.0 - 14.0 * (double) uiScale); float num168 = num166 + 28f * uiScale; float num169 = num167 + 28f * uiScale; if ((double) Main.mouseX >= (double) num166 && (double) Main.mouseX <= (double) num168 && (double) Main.mouseY >= (double) num167 && (double) Main.mouseY <= (double) num169) { TimeSpan time = DateTime.Now - Main.player[index].lastDeathTime; cursorText = Language.GetTextValue("Game.PlayerDeathTime", (object) Main.player[index].name, (object) Lang.LocalizedDuration(time, false, false)); } } } for (int index = 0; index < (int) byte.MaxValue; ++index) { if (Main.player[index].active && (!Main.player[Main.myPlayer].hostile && !Main.player[index].hostile || Main.player[Main.myPlayer].team == Main.player[index].team && Main.player[index].team != 0 || index == Main.myPlayer)) { float num170 = ((float) (((double) Main.player[index].position.X + (double) (Main.player[index].width / 2)) / 16.0) - num18) * scale; float num171 = ((float) (((double) Main.player[index].position.Y + (double) Main.player[index].gfxOffY + (double) (Main.player[index].height / 2)) / 16.0) - num19) * scale; float num172 = num170 + num16; float num173 = num171 + num17; float num174 = num172 - 6f; float num175 = num173 - 2f - (float) (2.0 - (double) scale / 5.0 * 2.0); float X = num174 - 10f * scale; float Y = num175 - 10f * scale; float num176 = (float) ((double) X + 4.0 - 14.0 * (double) uiScale); float num177 = (float) ((double) Y + 2.0 - 14.0 * (double) uiScale); float num178 = num176 + 28f * uiScale; float num179 = num177 + 28f * uiScale; if (!Main.player[index].dead) { this.DrawPlayerHead(Main.player[index], X, Y, (float) num5 / (float) byte.MaxValue, uiScale); if ((double) Main.mouseX >= (double) num176 && (double) Main.mouseX <= (double) num178 && (double) Main.mouseY >= (double) num177 && (double) Main.mouseY <= (double) num179) { cursorText = Main.player[index].name; if (index != Main.myPlayer && Main.player[Main.myPlayer].team > 0 && Main.player[Main.myPlayer].team == Main.player[index].team && Main.netMode == 1 && Main.player[Main.myPlayer].HasUnityPotion()) { flag3 = true; if (!this.unityMouseOver) Main.PlaySound(12); this.unityMouseOver = true; this.DrawPlayerHead(Main.player[index], X, Y, 2f, uiScale + 0.5f); cursorText = Language.GetTextValue("Game.TeleportTo", (object) Main.player[index].name); if (Main.mouseLeft && Main.mouseLeftRelease) { Main.mouseLeftRelease = false; Main.mapFullscreen = false; Main.player[Main.myPlayer].UnityTeleport(Main.player[index].position); Main.player[Main.myPlayer].TakeUnityPotion(); } } } } } } if (!flag3 && this.unityMouseOver) this.unityMouseOver = false; Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise, (Effect) null, Main.UIScaleMatrix); PlayerInput.SetZoom_UI(); int num180 = 10; int num181 = Main.screenHeight - 40; if (Main.showFrameRate) num181 -= 15; int index11 = 0; int num182 = 130; if (Main.mouseX >= num180 && Main.mouseX <= num180 + 32 && Main.mouseY >= num181 && Main.mouseY <= num181 + 30) { num182 = (int) byte.MaxValue; index11 += 4; Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeft && Main.mouseLeftRelease) { Main.PlaySound(10); Main.mapFullscreen = false; } } Main.spriteBatch.Draw(Main.mapIconTexture[index11], new Vector2((float) num180, (float) num181), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.mapIconTexture[index11].Width, Main.mapIconTexture[index11].Height)), new Microsoft.Xna.Framework.Color(num182, num182, num182, num182), 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); Main.DrawCursor(Main.DrawThickCursor()); } if (cursorText != "") this.MouseText(cursorText); Main.spriteBatch.End(); Main.spriteBatch.Begin(); PlayerInput.SetZoom_Unscaled(); TimeLogger.DetailedDrawTime(9); } 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 DrawItems() { for (int whoami = 0; whoami < 400; ++whoami) { if (Main.item[whoami].active && Main.item[whoami].type > 0) this.DrawItem(Main.item[whoami], whoami); } } public void DrawSimpleSurfaceBackground() { float val2 = (float) Main.worldSurface * 16f; float num1 = Math.Min(Main.screenPosition.Y + (float) Main.screenHeight, val2) - Main.screenPosition.Y; float y = Main.screenPosition.Y; float num2 = Main.screenPosition.Y + num1; Vector4 vector4_1 = Main.bgColor.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(Main.blackTileTexture, new Vector4(0.0f, 0.0f, (float) Main.screenWidth, num1), colors); float w = (float) Main.screenHeight - 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(Main.blackTileTexture, new Vector4(0.0f, num1, (float) Main.screenWidth, w), colors); } public void DrawCapture(Microsoft.Xna.Framework.Rectangle area, CaptureSettings settings) { float[] bgAlpha = Main.bgAlpha; Main.bgAlpha = new float[bgAlpha.Length]; for (int index = 0; index < Main.bgAlpha.Length; ++index) Main.bgAlpha[index] = 0.0f; Main.bgAlpha[settings.Biome.BackgroundIndex] = 1f; float[] bgAlpha2 = Main.bgAlpha2; Main.bgAlpha2 = new float[bgAlpha2.Length]; for (int index = 0; index < Main.bgAlpha2.Length; ++index) Main.bgAlpha2[index] = 0.0f; Main.bgAlpha2[settings.Biome.BackgroundIndex2] = 1f; if (settings.Biome.BackgroundIndex2 == 6) Main.bgAlpha2[0] = 1f; int holyTiles = Main.holyTiles; Main.holyTiles = settings.Biome.BackgroundIndex == 6 ? 400 : 0; int offScreenRange = Main.offScreenRange; Main.offScreenRange = 0; SpriteViewMatrix gameViewMatrix = Main.GameViewMatrix; Main.GameViewMatrix = new SpriteViewMatrix(this.GraphicsDevice); this.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; int x1 = area.X; int y1 = area.Y; int num1 = area.X + Main.screenWidth / 16; int num2 = area.Y + Main.screenHeight / 16; Main.bgColor = Microsoft.Xna.Framework.Color.White; double num3 = Main.time / 54000.0; int screenWidth2 = Main.screenWidth; int width1 = Main.sunTexture.Width; int width2 = Main.sunTexture.Width; Microsoft.Xna.Framework.Color white1 = Microsoft.Xna.Framework.Color.White; double num4 = Main.time / 54000.0; double num5 = Main.time / 32400.0; int screenWidth3 = Main.screenWidth; int width3 = Main.moonTexture[Main.moonType].Width; int width4 = Main.moonTexture[Main.moonType].Width; Microsoft.Xna.Framework.Color white2 = Microsoft.Xna.Framework.Color.White; double num6 = Main.time / 32400.0; double num7; double num8; if (Main.dayTime) { if (Main.time < 27000.0) { num7 = Math.Pow(1.0 - Main.time / 54000.0 * 2.0, 2.0); int bgTop = this.bgTop; } else { num7 = Math.Pow((Main.time / 54000.0 - 0.5) * 2.0, 2.0); int bgTop = this.bgTop; } } else if (Main.time < 16200.0) { num8 = Math.Pow(1.0 - Main.time / 32400.0 * 2.0, 2.0); int bgTop = this.bgTop; } else { num8 = Math.Pow((Main.time / 32400.0 - 0.5) * 2.0, 2.0); int bgTop = this.bgTop; } if (Main.dayTime) { if (Main.time < 13500.0) { float num9 = (float) (Main.time / 13500.0); white1.R = (byte) ((double) num9 * 200.0 + 55.0); white1.G = (byte) ((double) num9 * 180.0 + 75.0); white1.B = (byte) ((double) num9 * 250.0 + 5.0); Main.bgColor.R = (byte) ((double) num9 * 230.0 + 25.0); Main.bgColor.G = (byte) ((double) num9 * 220.0 + 35.0); Main.bgColor.B = (byte) ((double) num9 * 220.0 + 35.0); } if (Main.time > 45900.0) { float num10 = (float) (1.0 - (Main.time / 54000.0 - 0.85) * (20.0 / 3.0)); white1.R = (byte) ((double) num10 * 120.0 + 55.0); white1.G = (byte) ((double) num10 * 100.0 + 25.0); white1.B = (byte) ((double) num10 * 120.0 + 55.0); Main.bgColor.R = (byte) ((double) num10 * 200.0 + 35.0); Main.bgColor.G = (byte) ((double) num10 * 85.0 + 35.0); Main.bgColor.B = (byte) ((double) num10 * 135.0 + 35.0); } else if (Main.time > 37800.0) { float num11 = (float) (1.0 - (Main.time / 54000.0 - 0.7) * (20.0 / 3.0)); white1.R = (byte) ((double) num11 * 80.0 + 175.0); white1.G = (byte) ((double) num11 * 130.0 + 125.0); white1.B = (byte) ((double) num11 * 100.0 + 155.0); Main.bgColor.R = (byte) ((double) num11 * 20.0 + 235.0); Main.bgColor.G = (byte) ((double) num11 * 135.0 + 120.0); Main.bgColor.B = (byte) ((double) num11 * 85.0 + 170.0); } } if (!Main.dayTime) { if (Main.bloodMoon) { if (Main.time < 16200.0) { float num12 = (float) (1.0 - Main.time / 16200.0); white2.R = (byte) ((double) num12 * 10.0 + 205.0); white2.G = (byte) ((double) num12 * 170.0 + 55.0); white2.B = (byte) ((double) num12 * 200.0 + 55.0); Main.bgColor.R = (byte) (40.0 - (double) num12 * 40.0 + 35.0); Main.bgColor.G = (byte) ((double) num12 * 20.0 + 15.0); Main.bgColor.B = (byte) ((double) num12 * 20.0 + 15.0); } else if (Main.time >= 16200.0) { float num13 = (float) ((Main.time / 32400.0 - 0.5) * 2.0); white2.R = (byte) ((double) num13 * 50.0 + 205.0); white2.G = (byte) ((double) num13 * 100.0 + 155.0); white2.B = (byte) ((double) num13 * 100.0 + 155.0); white2.R = (byte) ((double) num13 * 10.0 + 205.0); white2.G = (byte) ((double) num13 * 170.0 + 55.0); white2.B = (byte) ((double) num13 * 200.0 + 55.0); Main.bgColor.R = (byte) (40.0 - (double) num13 * 40.0 + 35.0); Main.bgColor.G = (byte) ((double) num13 * 20.0 + 15.0); Main.bgColor.B = (byte) ((double) num13 * 20.0 + 15.0); } } else if (Main.time < 16200.0) { float num14 = (float) (1.0 - Main.time / 16200.0); white2.R = (byte) ((double) num14 * 10.0 + 205.0); white2.G = (byte) ((double) num14 * 70.0 + 155.0); white2.B = (byte) ((double) num14 * 100.0 + 155.0); Main.bgColor.R = (byte) ((double) num14 * 30.0 + 5.0); Main.bgColor.G = (byte) ((double) num14 * 30.0 + 5.0); Main.bgColor.B = (byte) ((double) num14 * 30.0 + 5.0); } else if (Main.time >= 16200.0) { float num15 = (float) ((Main.time / 32400.0 - 0.5) * 2.0); white2.R = (byte) ((double) num15 * 50.0 + 205.0); white2.G = (byte) ((double) num15 * 100.0 + 155.0); white2.B = (byte) ((double) num15 * 100.0 + 155.0); Main.bgColor.R = (byte) ((double) num15 * 20.0 + 5.0); Main.bgColor.G = (byte) ((double) num15 * 30.0 + 5.0); Main.bgColor.B = (byte) ((double) num15 * 30.0 + 5.0); } } if (Main.gameMenu) Main.bgDelay = 1000; if (biome.TileColor == CaptureBiome.TileColorStyle.Corrupt) { float num16 = 1f; int r1 = (int) Main.bgColor.R; int g1 = (int) Main.bgColor.G; int b1 = (int) Main.bgColor.B; int num17 = r1 - (int) (100.0 * (double) num16 * ((double) Main.bgColor.R / (double) byte.MaxValue)); int num18 = g1 - (int) (140.0 * (double) num16 * ((double) Main.bgColor.G / (double) byte.MaxValue)); int num19 = b1 - (int) (80.0 * (double) num16 * ((double) Main.bgColor.B / (double) byte.MaxValue)); if (num17 < 15) num17 = 15; if (num18 < 15) num18 = 15; if (num19 < 15) num19 = 15; Main.bgColor.R = (byte) num17; Main.bgColor.G = (byte) num18; Main.bgColor.B = (byte) num19; int r2 = (int) white1.R; int g2 = (int) white1.G; int b2 = (int) white1.B; int num20 = r2 - (int) (100.0 * (double) num16 * ((double) white1.R / (double) byte.MaxValue)); int num21 = g2 - (int) (100.0 * (double) num16 * ((double) white1.G / (double) byte.MaxValue)); int num22 = b2 - (int) (0.0 * (double) num16 * ((double) white1.B / (double) byte.MaxValue)); if (num20 < 15) num20 = 15; if (num21 < 15) num21 = 15; if (num22 < 15) num22 = 15; white1.R = (byte) num20; white1.G = (byte) num21; white1.B = (byte) num22; int r3 = (int) white2.R; int g3 = (int) white2.G; int b3 = (int) white2.B; int num23 = r3 - (int) (140.0 * (double) num16 * ((double) white2.R / (double) byte.MaxValue)); int num24 = g3 - (int) (190.0 * (double) num16 * ((double) white2.G / (double) byte.MaxValue)); int num25 = b3 - (int) (170.0 * (double) num16 * ((double) white2.B / (double) byte.MaxValue)); if (num23 < 15) num23 = 15; if (num24 < 15) num24 = 15; if (num25 < 15) num25 = 15; white2.R = (byte) num23; white2.G = (byte) num24; white2.B = (byte) num25; } if (biome.TileColor == CaptureBiome.TileColorStyle.Crimson) { float num26 = 1f; int r4 = (int) Main.bgColor.R; int g4 = (int) Main.bgColor.G; int b4 = (int) Main.bgColor.B; int num27 = r4 - (int) (70.0 * (double) num26 * ((double) Main.bgColor.G / (double) byte.MaxValue)); int num28 = g4 - (int) (110.0 * (double) num26 * ((double) Main.bgColor.G / (double) byte.MaxValue)); int num29 = b4 - (int) (150.0 * (double) num26 * ((double) Main.bgColor.B / (double) byte.MaxValue)); if (num27 < 15) num27 = 15; if (num28 < 15) num28 = 15; if (num29 < 15) num29 = 15; Main.bgColor.R = (byte) num27; Main.bgColor.G = (byte) num28; Main.bgColor.B = (byte) num29; int num30 = (int) white1.R; int g5 = (int) white1.G; int b5 = (int) white1.B; int num31 = g5 - (int) (90.0 * (double) num26 * ((double) white1.G / (double) byte.MaxValue)); int num32 = b5 - (int) (110.0 * (double) num26 * ((double) white1.B / (double) byte.MaxValue)); if (num30 < 15) num30 = 15; if (num31 < 15) num31 = 15; if (num32 < 15) num32 = 15; white1.R = (byte) num30; white1.G = (byte) num31; white1.B = (byte) num32; int r5 = (int) white2.R; int g6 = (int) white2.G; int b6 = (int) white2.B; int num33 = r5 - (int) (100.0 * (double) num26 * ((double) white2.R / (double) byte.MaxValue)); int num34 = g6 - (int) (120.0 * (double) num26 * ((double) white2.G / (double) byte.MaxValue)); int num35 = b6 - (int) (180.0 * (double) num26 * ((double) white2.B / (double) byte.MaxValue)); if (num33 < 15) num33 = 15; if (num34 < 15) num34 = 15; if (num35 < 15) num35 = 15; white2.R = (byte) num33; white2.G = (byte) num34; white2.B = (byte) num35; } if (biome.TileColor == CaptureBiome.TileColorStyle.Jungle) { float num36 = 1f; int r6 = (int) Main.bgColor.R; int num37 = (int) Main.bgColor.G; int b7 = (int) Main.bgColor.B; int num38 = r6 - (int) (40.0 * (double) num36 * ((double) Main.bgColor.R / (double) byte.MaxValue)); int num39 = b7 - (int) (70.0 * (double) num36 * ((double) Main.bgColor.B / (double) byte.MaxValue)); if (num37 > (int) byte.MaxValue) num37 = (int) byte.MaxValue; if (num37 < 15) num37 = 15; if (num38 > (int) byte.MaxValue) num38 = (int) byte.MaxValue; if (num38 < 15) num38 = 15; if (num39 < 15) num39 = 15; Main.bgColor.R = (byte) num38; Main.bgColor.G = (byte) num37; Main.bgColor.B = (byte) num39; int r7 = (int) white1.R; int num40 = (int) white1.G; int b8 = (int) white1.B; int num41 = r7 - (int) (30.0 * (double) num36 * ((double) white1.R / (double) byte.MaxValue)); int num42 = b8 - (int) (10.0 * (double) num36 * ((double) white1.B / (double) byte.MaxValue)); if (num41 < 15) num41 = 15; if (num40 < 15) num40 = 15; if (num42 < 15) num42 = 15; white1.R = (byte) num41; white1.G = (byte) num40; white1.B = (byte) num42; int r8 = (int) white2.R; int g = (int) white2.G; int b9 = (int) white2.B; int num43 = g - (int) (140.0 * (double) num36 * ((double) white2.R / (double) byte.MaxValue)); int num44 = r8 - (int) (170.0 * (double) num36 * ((double) white2.G / (double) byte.MaxValue)); int num45 = b9 - (int) (190.0 * (double) num36 * ((double) white2.B / (double) byte.MaxValue)); if (num44 < 15) num44 = 15; if (num43 < 15) num43 = 15; if (num45 < 15) num45 = 15; white2.R = (byte) num44; white2.G = (byte) num43; white2.B = (byte) num45; } if (biome.TileColor == CaptureBiome.TileColorStyle.Mushroom) { float num46 = 1f; int r9 = (int) Main.bgColor.R; int g7 = (int) Main.bgColor.G; int b10 = (int) Main.bgColor.B; int num47 = g7 - (int) (250.0 * (double) num46 * ((double) Main.bgColor.G / (double) byte.MaxValue)); int num48 = r9 - (int) (250.0 * (double) num46 * ((double) Main.bgColor.R / (double) byte.MaxValue)); int num49 = b10 - (int) (250.0 * (double) num46 * ((double) Main.bgColor.B / (double) byte.MaxValue)); if (num47 < 15) num47 = 15; if (num48 < 15) num48 = 15; if (num49 < 15) num49 = 15; Main.bgColor.R = (byte) num48; Main.bgColor.G = (byte) num47; Main.bgColor.B = (byte) num49; int r10 = (int) white1.R; int g8 = (int) white1.G; int b11 = (int) white1.B; int num50 = g8 - (int) (10.0 * (double) num46 * ((double) white1.G / (double) byte.MaxValue)); int num51 = r10 - (int) (30.0 * (double) num46 * ((double) white1.R / (double) byte.MaxValue)); int num52 = b11 - (int) (10.0 * (double) num46 * ((double) white1.B / (double) byte.MaxValue)); if (num51 < 15) num51 = 15; if (num50 < 15) num50 = 15; if (num52 < 15) num52 = 15; white1.R = (byte) num51; white1.G = (byte) num50; white1.B = (byte) num52; int r11 = (int) white2.R; int g9 = (int) white2.G; int b12 = (int) white2.B; int num53 = g9 - (int) (140.0 * (double) num46 * ((double) white2.R / (double) byte.MaxValue)); int num54 = r11 - (int) (170.0 * (double) num46 * ((double) white2.G / (double) byte.MaxValue)); int num55 = b12 - (int) (190.0 * (double) num46 * ((double) white2.B / (double) byte.MaxValue)); if (num54 < 15) num54 = 15; if (num53 < 15) num53 = 15; if (num55 < 15) num55 = 15; white2.R = (byte) num54; white2.G = (byte) num53; white2.B = (byte) num55; } if (Lighting.NotRetro) { if (Main.bgColor.R < (byte) 10) Main.bgColor.R = (byte) 10; if (Main.bgColor.G < (byte) 10) Main.bgColor.G = (byte) 10; if (Main.bgColor.B < (byte) 10) Main.bgColor.B = (byte) 10; } else { if (Main.bgColor.R < (byte) 15) Main.bgColor.R = (byte) 15; if (Main.bgColor.G < (byte) 15) Main.bgColor.G = (byte) 15; if (Main.bgColor.B < (byte) 15) Main.bgColor.B = (byte) 15; } Main.tileColor.A = byte.MaxValue; Main.tileColor.R = (byte) (((int) Main.bgColor.R + (int) Main.bgColor.G + (int) Main.bgColor.B + (int) Main.bgColor.R * 7) / 10); Main.tileColor.G = (byte) (((int) Main.bgColor.R + (int) Main.bgColor.G + (int) Main.bgColor.B + (int) Main.bgColor.G * 7) / 10); Main.tileColor.B = (byte) (((int) Main.bgColor.R + (int) Main.bgColor.G + (int) Main.bgColor.B + (int) Main.bgColor.B * 7) / 10); Main.backColor = Main.bgColor; Main.trueBackColor = Main.backColor; Lighting.Initialize(true); Main.renderCount = 99; for (int index = 0; index < 3; ++index) Lighting.LightTiles(x1, num1, y1, num2); 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 num56 = Math.Min(val1_2, Main.maxTilesX - 5) + 2; int num57 = Math.Min(val1_4, Main.maxTilesY - 5) + 4; Microsoft.Xna.Framework.Rectangle drawArea = new Microsoft.Xna.Framework.Rectangle(x2, y2, num56 - x2, num57 - y2); LiquidRenderer.Instance.PrepareDraw(drawArea); WorldGen.SectionTileFrameWithCheck(x1, y1, num1, num2); if (captureBackground) { Matrix transform = Main.Transform; int screenHeight2 = Main.screenHeight; int screenWidth4 = 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 num58 = 2500f; float scale = MathHelper.Clamp((float) settings.Area.Height * 16f / num58, 1f, 2f); 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) num58 * (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) num58 * (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); } Main.tileBatch.Begin(); this.DrawSimpleSurfaceBackground(); Main.tileBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.AnisotropicClamp, DepthStencilState.Default, RasterizerState.CullNone, (Effect) null, transform); 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 = screenWidth4; 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.drawWaters(true); else this.drawWaters(true, Main.bloodMoon ? 9 : biome.WaterStyle, false); 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 (captureEntities) { Main.spriteBatch.Begin(); this.DrawRain(); 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(); } Main.tileBatch.Begin(); Main.spriteBatch.Begin(); if (biome == null) this.DrawTiles(); else this.DrawTiles(waterStyleOverride: biome.WaterStyle); Main.tileBatch.End(); Main.spriteBatch.End(); Main.tileBatch.Begin(); Main.spriteBatch.Begin(); this.DrawCachedNPCs(this.DrawCacheNPCsBehindNonSolidTiles, true); if (biome == null) this.DrawTiles(false); else this.DrawTiles(false, Main.bloodMoon ? 9 : biome.WaterStyle); Main.tileBatch.End(); Main.spriteBatch.End(); if (captureEntities) { Main.spriteBatch.Begin(); this.waterfallManager.FindWaterfalls(); this.waterfallManager.Draw(Main.spriteBatch); Main.spriteBatch.End(); this.DrawPlayers(); this.DrawCachedProjs(this.DrawCacheProjsBehindNPCsAndTiles); Main.spriteBatch.Begin(); this.DrawNPCs(true); Main.spriteBatch.End(); this.DrawCachedProjs(this.DrawCacheProjsBehindNPCs); Main.spriteBatch.Begin(); this.DrawNPCs(); Main.spriteBatch.End(); Main.spriteBatch.Begin(); this.DrawCachedNPCs(this.DrawCacheNPCProjectiles, false); Main.spriteBatch.End(); Main.spriteBatch.Begin(); this.DrawItems(); Main.spriteBatch.End(); this.DrawProjectiles(); this.DrawDust(); Main.spriteBatch.Begin(); this.DrawGore(); Main.spriteBatch.End(); } Main.tileBatch.Begin(); Main.spriteBatch.Begin(); if (biome == null) this.drawWaters(); else this.drawWaters(styleOverride: biome.WaterStyle, allowUpdate: false); 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(Main.blackTileTexture, 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; Lighting.Initialize(true); Main.offScreenRange = offScreenRange; Main.cloudAlpha = cloudAlpha; Main.bgAlpha = bgAlpha; Main.bgAlpha2 = bgAlpha2; Main.holyTiles = holyTiles; 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(); if (Main.ignoreErrors) { try { this.DrawTiles(); } catch (Exception ex) { TimeLogger.DrawException(ex); } } else this.DrawTiles(); TimeLogger.DetailedDrawReset(); Main.spriteBatch.End(); 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(); if (Main.ignoreErrors) { try { this.DrawTiles(false); } catch (Exception ex) { TimeLogger.DrawException(ex); } } else this.DrawTiles(false); TimeLogger.DetailedDrawReset(); Main.spriteBatch.End(); 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); } protected void drawWaters(bool bg = false, int styleOverride = -1, bool allowUpdate = true) { if (!bg) { Main.waterStyle = Main.bgStyle != 1 ? (Main.bgStyle != 5 ? (Main.bgStyle != 5 || Main.bloodTiles <= Main.holyTiles ? (Main.bgStyle != 3 ? (Main.bgStyle != 8 ? (Main.bgStyle != 6 ? (Main.bgStyle != 7 ? (Main.bgStyle != 2 ? ((double) Main.screenPosition.Y / 16.0 <= Main.rockLayer + 40.0 ? ((double) Main.screenPosition.Y / 16.0 <= Main.worldSurface ? 0 : 7) : (Main.shroomTiles <= 300 ? 8 : 7)) : 6) : 5) : 4) : 10) : 3) : 10) : (Main.evilTiles <= Main.holyTiles ? (Main.bloodTiles <= Main.holyTiles ? 4 : 10) : (Main.bloodTiles <= Main.evilTiles ? 2 : 10))) : 2; if (Main.bgStyle != 4 && Main.bloodMoon && !Main.dayTime) Main.waterStyle = 9; if (Main.fountainColor >= 0) Main.waterStyle = Main.fountainColor; if (Main.waterStyle == 0) { Main.liquidAlpha[2] -= 0.2f; if ((double) Main.liquidAlpha[2] < 0.0) Main.liquidAlpha[2] = 0.0f; Main.liquidAlpha[3] -= 0.2f; if ((double) Main.liquidAlpha[3] < 0.0) Main.liquidAlpha[3] = 0.0f; Main.liquidAlpha[4] -= 0.2f; if ((double) Main.liquidAlpha[4] < 0.0) Main.liquidAlpha[4] = 0.0f; Main.liquidAlpha[5] -= 0.2f; if ((double) Main.liquidAlpha[5] < 0.0) Main.liquidAlpha[5] = 0.0f; Main.liquidAlpha[6] -= 0.2f; if ((double) Main.liquidAlpha[6] < 0.0) Main.liquidAlpha[6] = 0.0f; Main.liquidAlpha[7] -= 0.2f; if ((double) Main.liquidAlpha[7] < 0.0) Main.liquidAlpha[7] = 0.0f; Main.liquidAlpha[8] -= 0.2f; if ((double) Main.liquidAlpha[8] < 0.0) Main.liquidAlpha[8] = 0.0f; Main.liquidAlpha[9] -= 0.2f; if ((double) Main.liquidAlpha[9] < 0.0) Main.liquidAlpha[9] = 0.0f; Main.liquidAlpha[10] -= 0.2f; if ((double) Main.liquidAlpha[10] < 0.0) Main.liquidAlpha[10] = 0.0f; Main.liquidAlpha[0] += 0.2f; if ((double) Main.liquidAlpha[0] > 1.0) Main.liquidAlpha[0] = 1f; } if (Main.waterStyle == 2) { Main.liquidAlpha[0] -= 0.2f; if ((double) Main.liquidAlpha[0] < 0.0) Main.liquidAlpha[0] = 0.0f; Main.liquidAlpha[3] -= 0.2f; if ((double) Main.liquidAlpha[3] < 0.0) Main.liquidAlpha[3] = 0.0f; Main.liquidAlpha[4] -= 0.2f; if ((double) Main.liquidAlpha[4] < 0.0) Main.liquidAlpha[4] = 0.0f; Main.liquidAlpha[5] -= 0.2f; if ((double) Main.liquidAlpha[5] < 0.0) Main.liquidAlpha[5] = 0.0f; Main.liquidAlpha[6] -= 0.2f; if ((double) Main.liquidAlpha[6] < 0.0) Main.liquidAlpha[6] = 0.0f; Main.liquidAlpha[7] -= 0.2f; if ((double) Main.liquidAlpha[7] < 0.0) Main.liquidAlpha[7] = 0.0f; Main.liquidAlpha[8] -= 0.2f; if ((double) Main.liquidAlpha[8] < 0.0) Main.liquidAlpha[8] = 0.0f; Main.liquidAlpha[9] -= 0.2f; if ((double) Main.liquidAlpha[9] < 0.0) Main.liquidAlpha[9] = 0.0f; Main.liquidAlpha[10] -= 0.2f; if ((double) Main.liquidAlpha[10] < 0.0) Main.liquidAlpha[10] = 0.0f; Main.liquidAlpha[2] += 0.2f; if ((double) Main.liquidAlpha[2] > 1.0) Main.liquidAlpha[2] = 1f; } if (Main.waterStyle == 3) { Main.liquidAlpha[0] -= 0.2f; if ((double) Main.liquidAlpha[0] < 0.0) Main.liquidAlpha[0] = 0.0f; Main.liquidAlpha[2] -= 0.2f; if ((double) Main.liquidAlpha[2] < 0.0) Main.liquidAlpha[2] = 0.0f; Main.liquidAlpha[4] -= 0.2f; if ((double) Main.liquidAlpha[4] < 0.0) Main.liquidAlpha[4] = 0.0f; Main.liquidAlpha[5] -= 0.2f; if ((double) Main.liquidAlpha[5] < 0.0) Main.liquidAlpha[5] = 0.0f; Main.liquidAlpha[6] -= 0.2f; if ((double) Main.liquidAlpha[6] < 0.0) Main.liquidAlpha[6] = 0.0f; Main.liquidAlpha[7] -= 0.2f; if ((double) Main.liquidAlpha[7] < 0.0) Main.liquidAlpha[7] = 0.0f; Main.liquidAlpha[8] -= 0.2f; if ((double) Main.liquidAlpha[8] < 0.0) Main.liquidAlpha[8] = 0.0f; Main.liquidAlpha[9] -= 0.2f; if ((double) Main.liquidAlpha[9] < 0.0) Main.liquidAlpha[9] = 0.0f; Main.liquidAlpha[10] -= 0.2f; if ((double) Main.liquidAlpha[10] < 0.0) Main.liquidAlpha[10] = 0.0f; Main.liquidAlpha[3] += 0.2f; if ((double) Main.liquidAlpha[3] > 1.0) Main.liquidAlpha[3] = 1f; } if (Main.waterStyle == 4) { Main.liquidAlpha[0] -= 0.2f; if ((double) Main.liquidAlpha[0] < 0.0) Main.liquidAlpha[0] = 0.0f; Main.liquidAlpha[2] -= 0.2f; if ((double) Main.liquidAlpha[2] < 0.0) Main.liquidAlpha[2] = 0.0f; Main.liquidAlpha[3] -= 0.2f; if ((double) Main.liquidAlpha[3] < 0.0) Main.liquidAlpha[3] = 0.0f; Main.liquidAlpha[5] -= 0.2f; if ((double) Main.liquidAlpha[5] < 0.0) Main.liquidAlpha[5] = 0.0f; Main.liquidAlpha[6] -= 0.2f; if ((double) Main.liquidAlpha[6] < 0.0) Main.liquidAlpha[6] = 0.0f; Main.liquidAlpha[7] -= 0.2f; if ((double) Main.liquidAlpha[7] < 0.0) Main.liquidAlpha[7] = 0.0f; Main.liquidAlpha[8] -= 0.2f; if ((double) Main.liquidAlpha[8] < 0.0) Main.liquidAlpha[8] = 0.0f; Main.liquidAlpha[9] -= 0.2f; if ((double) Main.liquidAlpha[9] < 0.0) Main.liquidAlpha[9] = 0.0f; Main.liquidAlpha[10] -= 0.2f; if ((double) Main.liquidAlpha[10] < 0.0) Main.liquidAlpha[10] = 0.0f; Main.liquidAlpha[4] += 0.2f; if ((double) Main.liquidAlpha[4] > 1.0) Main.liquidAlpha[4] = 1f; } if (Main.waterStyle == 5) { Main.liquidAlpha[0] -= 0.2f; if ((double) Main.liquidAlpha[0] < 0.0) Main.liquidAlpha[0] = 0.0f; Main.liquidAlpha[2] -= 0.2f; if ((double) Main.liquidAlpha[2] < 0.0) Main.liquidAlpha[2] = 0.0f; Main.liquidAlpha[3] -= 0.2f; if ((double) Main.liquidAlpha[3] < 0.0) Main.liquidAlpha[3] = 0.0f; Main.liquidAlpha[4] -= 0.2f; if ((double) Main.liquidAlpha[4] < 0.0) Main.liquidAlpha[4] = 0.0f; Main.liquidAlpha[6] -= 0.2f; if ((double) Main.liquidAlpha[6] < 0.0) Main.liquidAlpha[6] = 0.0f; Main.liquidAlpha[7] -= 0.2f; if ((double) Main.liquidAlpha[7] < 0.0) Main.liquidAlpha[7] = 0.0f; Main.liquidAlpha[8] -= 0.2f; if ((double) Main.liquidAlpha[8] < 0.0) Main.liquidAlpha[8] = 0.0f; Main.liquidAlpha[9] -= 0.2f; if ((double) Main.liquidAlpha[9] < 0.0) Main.liquidAlpha[9] = 0.0f; Main.liquidAlpha[10] -= 0.2f; if ((double) Main.liquidAlpha[10] < 0.0) Main.liquidAlpha[10] = 0.0f; Main.liquidAlpha[5] += 0.2f; if ((double) Main.liquidAlpha[5] > 1.0) Main.liquidAlpha[5] = 1f; } if (Main.waterStyle == 6) { Main.liquidAlpha[0] -= 0.2f; if ((double) Main.liquidAlpha[0] < 0.0) Main.liquidAlpha[0] = 0.0f; Main.liquidAlpha[2] -= 0.2f; if ((double) Main.liquidAlpha[2] < 0.0) Main.liquidAlpha[2] = 0.0f; Main.liquidAlpha[3] -= 0.2f; if ((double) Main.liquidAlpha[3] < 0.0) Main.liquidAlpha[3] = 0.0f; Main.liquidAlpha[4] -= 0.2f; if ((double) Main.liquidAlpha[4] < 0.0) Main.liquidAlpha[4] = 0.0f; Main.liquidAlpha[5] -= 0.2f; if ((double) Main.liquidAlpha[5] < 0.0) Main.liquidAlpha[5] = 0.0f; Main.liquidAlpha[7] -= 0.2f; if ((double) Main.liquidAlpha[7] < 0.0) Main.liquidAlpha[7] = 0.0f; Main.liquidAlpha[8] -= 0.2f; if ((double) Main.liquidAlpha[8] < 0.0) Main.liquidAlpha[8] = 0.0f; Main.liquidAlpha[9] -= 0.2f; if ((double) Main.liquidAlpha[9] < 0.0) Main.liquidAlpha[9] = 0.0f; Main.liquidAlpha[10] -= 0.2f; if ((double) Main.liquidAlpha[10] < 0.0) Main.liquidAlpha[10] = 0.0f; Main.liquidAlpha[6] += 0.2f; if ((double) Main.liquidAlpha[6] > 1.0) Main.liquidAlpha[6] = 1f; } if (Main.waterStyle == 7) { Main.liquidAlpha[0] -= 0.2f; if ((double) Main.liquidAlpha[0] < 0.0) Main.liquidAlpha[0] = 0.0f; Main.liquidAlpha[2] -= 0.2f; if ((double) Main.liquidAlpha[2] < 0.0) Main.liquidAlpha[2] = 0.0f; Main.liquidAlpha[3] -= 0.2f; if ((double) Main.liquidAlpha[3] < 0.0) Main.liquidAlpha[3] = 0.0f; Main.liquidAlpha[4] -= 0.2f; if ((double) Main.liquidAlpha[4] < 0.0) Main.liquidAlpha[4] = 0.0f; Main.liquidAlpha[5] -= 0.2f; if ((double) Main.liquidAlpha[5] < 0.0) Main.liquidAlpha[5] = 0.0f; Main.liquidAlpha[6] -= 0.2f; if ((double) Main.liquidAlpha[6] < 0.0) Main.liquidAlpha[6] = 0.0f; Main.liquidAlpha[8] -= 0.2f; if ((double) Main.liquidAlpha[8] < 0.0) Main.liquidAlpha[8] = 0.0f; Main.liquidAlpha[9] -= 0.2f; if ((double) Main.liquidAlpha[9] < 0.0) Main.liquidAlpha[9] = 0.0f; Main.liquidAlpha[10] -= 0.2f; if ((double) Main.liquidAlpha[10] < 0.0) Main.liquidAlpha[10] = 0.0f; Main.liquidAlpha[7] += 0.2f; if ((double) Main.liquidAlpha[7] > 1.0) Main.liquidAlpha[7] = 1f; } if (Main.waterStyle == 8) { Main.liquidAlpha[0] -= 0.2f; if ((double) Main.liquidAlpha[0] < 0.0) Main.liquidAlpha[0] = 0.0f; Main.liquidAlpha[2] -= 0.2f; if ((double) Main.liquidAlpha[2] < 0.0) Main.liquidAlpha[2] = 0.0f; Main.liquidAlpha[3] -= 0.2f; if ((double) Main.liquidAlpha[3] < 0.0) Main.liquidAlpha[3] = 0.0f; Main.liquidAlpha[4] -= 0.2f; if ((double) Main.liquidAlpha[4] < 0.0) Main.liquidAlpha[4] = 0.0f; Main.liquidAlpha[5] -= 0.2f; if ((double) Main.liquidAlpha[5] < 0.0) Main.liquidAlpha[5] = 0.0f; Main.liquidAlpha[6] -= 0.2f; if ((double) Main.liquidAlpha[6] < 0.0) Main.liquidAlpha[6] = 0.0f; Main.liquidAlpha[7] -= 0.2f; if ((double) Main.liquidAlpha[7] < 0.0) Main.liquidAlpha[7] = 0.0f; Main.liquidAlpha[9] -= 0.2f; if ((double) Main.liquidAlpha[9] < 0.0) Main.liquidAlpha[9] = 0.0f; Main.liquidAlpha[10] -= 0.2f; if ((double) Main.liquidAlpha[10] < 0.0) Main.liquidAlpha[10] = 0.0f; Main.liquidAlpha[8] += 0.2f; if ((double) Main.liquidAlpha[8] > 1.0) Main.liquidAlpha[8] = 1f; } if (Main.waterStyle == 9) { Main.liquidAlpha[0] -= 0.2f; if ((double) Main.liquidAlpha[0] < 0.0) Main.liquidAlpha[0] = 0.0f; Main.liquidAlpha[2] -= 0.2f; if ((double) Main.liquidAlpha[2] < 0.0) Main.liquidAlpha[2] = 0.0f; Main.liquidAlpha[3] -= 0.2f; if ((double) Main.liquidAlpha[3] < 0.0) Main.liquidAlpha[3] = 0.0f; Main.liquidAlpha[4] -= 0.2f; if ((double) Main.liquidAlpha[4] < 0.0) Main.liquidAlpha[4] = 0.0f; Main.liquidAlpha[5] -= 0.2f; if ((double) Main.liquidAlpha[5] < 0.0) Main.liquidAlpha[5] = 0.0f; Main.liquidAlpha[6] -= 0.2f; if ((double) Main.liquidAlpha[6] < 0.0) Main.liquidAlpha[6] = 0.0f; Main.liquidAlpha[7] -= 0.2f; if ((double) Main.liquidAlpha[7] < 0.0) Main.liquidAlpha[7] = 0.0f; Main.liquidAlpha[8] -= 0.2f; if ((double) Main.liquidAlpha[8] < 0.0) Main.liquidAlpha[8] = 0.0f; Main.liquidAlpha[10] -= 0.2f; if ((double) Main.liquidAlpha[10] < 0.0) Main.liquidAlpha[10] = 0.0f; Main.liquidAlpha[9] += 0.2f; if ((double) Main.liquidAlpha[9] > 1.0) Main.liquidAlpha[9] = 1f; } if (Main.waterStyle == 10) { Main.liquidAlpha[0] -= 0.2f; if ((double) Main.liquidAlpha[0] < 0.0) Main.liquidAlpha[0] = 0.0f; Main.liquidAlpha[2] -= 0.2f; if ((double) Main.liquidAlpha[2] < 0.0) Main.liquidAlpha[2] = 0.0f; Main.liquidAlpha[3] -= 0.2f; if ((double) Main.liquidAlpha[3] < 0.0) Main.liquidAlpha[3] = 0.0f; Main.liquidAlpha[4] -= 0.2f; if ((double) Main.liquidAlpha[4] < 0.0) Main.liquidAlpha[4] = 0.0f; Main.liquidAlpha[5] -= 0.2f; if ((double) Main.liquidAlpha[5] < 0.0) Main.liquidAlpha[5] = 0.0f; Main.liquidAlpha[6] -= 0.2f; if ((double) Main.liquidAlpha[6] < 0.0) Main.liquidAlpha[6] = 0.0f; Main.liquidAlpha[7] -= 0.2f; if ((double) Main.liquidAlpha[7] < 0.0) Main.liquidAlpha[7] = 0.0f; Main.liquidAlpha[8] -= 0.2f; if ((double) Main.liquidAlpha[8] < 0.0) Main.liquidAlpha[8] = 0.0f; Main.liquidAlpha[9] -= 0.2f; if ((double) Main.liquidAlpha[9] < 0.0) Main.liquidAlpha[9] = 0.0f; Main.liquidAlpha[10] += 0.2f; if ((double) Main.liquidAlpha[10] > 1.0) Main.liquidAlpha[10] = 1f; } } Main.drewLava = false; if (!Main.drawToScreen) { if ((!bg ^ styleOverride != -1) & allowUpdate) { 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 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); } if (styleOverride != -1) { this.DrawWater(bg, styleOverride); } else { for (int Style = 0; Style < 11; ++Style) { if (Style != 1 && (double) Main.liquidAlpha[Style] > 0.0) this.DrawWater(bg, Style, Main.liquidAlpha[Style]); } } } else if (styleOverride != -1) { this.DrawWater(bg, styleOverride); } else { if ((double) Main.liquidAlpha[0] > 0.0) { if (bg) this.DrawWater(bg); else this.DrawWater(bg, Alpha: Main.liquidAlpha[0]); } if ((double) Main.liquidAlpha[2] > 0.0) { if (bg) { if (Main.waterStyle < 2) this.DrawWater(bg, 2, Main.liquidAlpha[2]); else this.DrawWater(bg, 2); } else this.DrawWater(bg, 2, Main.liquidAlpha[2]); } if ((double) Main.liquidAlpha[3] > 0.0) { if (bg) { if (Main.waterStyle < 3) this.DrawWater(bg, 3, Main.liquidAlpha[3]); else this.DrawWater(bg, 3); } else this.DrawWater(bg, 3, Main.liquidAlpha[3]); } if ((double) Main.liquidAlpha[4] > 0.0) { if (bg) { if (Main.waterStyle < 4) this.DrawWater(bg, 4, Main.liquidAlpha[4]); else this.DrawWater(bg, 4); } else this.DrawWater(bg, 4, Main.liquidAlpha[4]); } if ((double) Main.liquidAlpha[5] > 0.0) { if (bg) { if (Main.waterStyle < 5) this.DrawWater(bg, 5, Main.liquidAlpha[5]); else this.DrawWater(bg, 5); } else this.DrawWater(bg, 5, Main.liquidAlpha[5]); } if ((double) Main.liquidAlpha[6] > 0.0) { if (bg) { if (Main.waterStyle < 6) this.DrawWater(bg, 6, Main.liquidAlpha[6]); else this.DrawWater(bg, 6); } else this.DrawWater(bg, 6, Main.liquidAlpha[6]); } if ((double) Main.liquidAlpha[7] > 0.0) { if (bg) { if (Main.waterStyle < 7) this.DrawWater(bg, 7, Main.liquidAlpha[7]); else this.DrawWater(bg, 7); } else this.DrawWater(bg, 7, Main.liquidAlpha[7]); } if ((double) Main.liquidAlpha[8] > 0.0) { if (bg) { if (Main.waterStyle < 8) this.DrawWater(bg, 8, Main.liquidAlpha[8]); else this.DrawWater(bg, 8); } else this.DrawWater(bg, 8, Main.liquidAlpha[8]); } if ((double) Main.liquidAlpha[9] > 0.0) { if (bg) { if (Main.waterStyle < 9) this.DrawWater(bg, 9, Main.liquidAlpha[9]); else this.DrawWater(bg, 9); } else this.DrawWater(bg, 9, Main.liquidAlpha[9]); } if ((double) Main.liquidAlpha[10] <= 0.0) return; if (bg) { if (Main.waterStyle < 10) this.DrawWater(bg, 10, Main.liquidAlpha[10]); else this.DrawWater(bg, 10); } else this.DrawWater(bg, 10, Main.liquidAlpha[10]); } } 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 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; 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(Main.liquidTexture[index1], 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(Main.liquidTexture[index1], 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(Main.liquidTexture[index1], 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(Main.liquidTexture[index1], 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) 1) { 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.lightMode) { case 2: num2 = (float) ((int) Main.tileColor.R - 55) / (float) byte.MaxValue; if ((double) num2 < 0.0) { num2 = 0.0f; break; } break; case 3: num2 = (float) (num1 - 55) / (float) byte.MaxValue; if ((double) num2 < 0.0) { num2 = 0.0f; break; } break; } int num3 = Main.offScreenRange / 16; int num4 = (int) (((double) Main.screenPosition.X - (double) vector2.X) / 16.0 - 1.0) - num3; int num5 = (int) (((double) Main.screenPosition.X + (double) Main.screenWidth + (double) vector2.X) / 16.0) + 2 + num3; int val1_1 = (int) (((double) Main.screenPosition.Y - (double) vector2.Y) / 16.0 - 1.0) - num3; int val1_2 = (int) (((double) Main.screenPosition.Y + (double) Main.screenHeight + (double) vector2.Y) / 16.0) + 5 + num3; if (num4 < 0) num4 = num3; if (num5 > Main.maxTilesX) num5 = Main.maxTilesX - num3; if (val1_1 < 0) val1_1 = num3; if (val1_2 > Main.maxTilesY) val1_2 = Main.maxTilesY - num3; 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.maxTilesY - 200); val1_1 = Math.Max(val1_1, Main.maxTilesY - 200); } } for (int y = val1_1; y < val1_2; ++y) { bool flag = y >= Main.maxTilesY - 200; if (flag) num2 = 0.2f; for (int x = num4; x < num5; ++x) { int num6 = x; for (; x < num5; ++x) { if (Main.tile[x, y] == null) Main.tile[x, y] = new Tile(); Tile testTile = Main.tile[x, y]; float num7 = (float) Math.Floor((double) Lighting.Brightness(x, y) * (double) byte.MaxValue) / (float) byte.MaxValue; byte liquid = testTile.liquid; if (((((double) num7 > (double) num2 ? 0 : (!flag && liquid < (byte) 250 || WorldGen.SolidTile(testTile) ? 1 : (liquid < (byte) 200 ? 0 : ((double) num7 == 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 : (Lighting.LightingDrawToScreen || !LiquidRenderer.Instance.HasFullWater(x, y) || testTile.wall != (byte) 0 || testTile.halfBrick() ? 1 : ((double) y <= Main.worldSurface ? 1 : 0))) == 0) break; } if (x - num6 > 0) Main.spriteBatch.Draw(Main.blackTileTexture, new Vector2((float) (num6 << 4), (float) (y << 4)) - Main.screenPosition + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, x - num6 << 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() { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); int num1 = (int) (120.0 * (1.0 - (double) Main.gfxQuality) + 40.0 * (double) Main.gfxQuality); Vector2 vector2 = new Vector2((float) Main.offScreenRange, (float) Main.offScreenRange); if (Main.drawToScreen) vector2 = Vector2.Zero; int num2 = (int) (((double) Main.screenPosition.X - (double) vector2.X) / 16.0 - 1.0); int num3 = (int) (((double) Main.screenPosition.X + (double) Main.screenWidth + (double) vector2.X) / 16.0) + 2; int num4 = (int) (((double) Main.screenPosition.Y - (double) vector2.Y) / 16.0 - 1.0); int num5 = (int) (((double) Main.screenPosition.Y + (double) Main.screenHeight + (double) vector2.Y) / 16.0) + 5; int num6 = Main.offScreenRange / 16; int num7 = Main.offScreenRange / 16; if (num2 - num6 < 4) num2 = num6 + 4; if (num3 + num6 > Main.maxTilesX - 4) num3 = Main.maxTilesX - num6 - 4; if (num4 - num7 < 4) num4 = num7 + 4; if (num5 + num7 > Main.maxTilesY - 4) num5 = Main.maxTilesY - num7 - 4; int num8 = Main.maxTilesY - 200; for (int index1 = num4 - num7; index1 < num5 + num7; ++index1) { for (int index2 = num2 - num6; index2 < num3 + num6; ++index2) { Tile testTile = Main.tile[index2, index1]; if (testTile == null) { testTile = new Tile(); Main.tile[index2, index1] = testTile; } byte wall = testTile.wall; if (wall > (byte) 0 && !this.FullTile(index2, index1)) { Microsoft.Xna.Framework.Color color1 = Lighting.GetColor(index2, index1); if (color1.R != (byte) 0 || color1.G != (byte) 0 || color1.B != (byte) 0 || index1 >= num8) { this.LoadWall((int) wall); int num9 = (int) Main.wallFrame[(int) wall] * 180; Microsoft.Xna.Framework.Rectangle rectangle; if (Lighting.NotRetro && !Main.wallLight[(int) wall] && (testTile.wall < (byte) 88 || testTile.wall > (byte) 93) && !WorldGen.SolidTile(testTile)) { Texture2D texture = !Main.canDrawColorWall(index2, index1) ? Main.wallTexture[(int) testTile.wall] : (Texture2D) Main.wallAltTexture[(int) testTile.wall, (int) testTile.wallColor()]; VertexColors vertices; if (testTile.wall == (byte) 44) { Microsoft.Xna.Framework.Color color2 = new Microsoft.Xna.Framework.Color((int) (byte) Main.DiscoR, (int) (byte) Main.DiscoG, (int) (byte) Main.DiscoB); vertices.BottomLeftColor = color2; vertices.BottomRightColor = color2; vertices.TopLeftColor = color2; vertices.TopRightColor = color2; } else Lighting.GetColor4Slice_New(index2, index1, out vertices); Main.tileBatch.Draw(texture, new Vector2((float) (index2 * 16 - (int) Main.screenPosition.X - 8), (float) (index1 * 16 - (int) Main.screenPosition.Y - 8)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(testTile.wallFrameX(), testTile.wallFrameY() + num9, 32, 32)), vertices, Vector2.Zero, 1f, SpriteEffects.None); } else if (testTile.wall == (byte) 44) { Microsoft.Xna.Framework.Color color3 = new Microsoft.Xna.Framework.Color(); color3.R = (byte) Main.DiscoR; color3.G = (byte) Main.DiscoG; color3.B = (byte) Main.DiscoB; color3.A = byte.MaxValue; rectangle = new Microsoft.Xna.Framework.Rectangle(testTile.wallFrameX(), testTile.wallFrameY() + num9, 32, 32); Main.spriteBatch.Draw(Main.wallTexture[(int) testTile.wall], new Vector2((float) (index2 * 16 - (int) Main.screenPosition.X - 8), (float) (index1 * 16 - (int) Main.screenPosition.Y - 8)) + vector2, new Microsoft.Xna.Framework.Rectangle?(rectangle), color3, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } else { rectangle = new Microsoft.Xna.Framework.Rectangle(testTile.wallFrameX(), testTile.wallFrameY() + num9, 32, 32); if (Main.canDrawColorWall(index2, index1)) Main.spriteBatch.Draw((Texture2D) Main.wallAltTexture[(int) testTile.wall, (int) testTile.wallColor()], new Vector2((float) (index2 * 16 - (int) Main.screenPosition.X - 8), (float) (index1 * 16 - (int) Main.screenPosition.Y - 8)) + vector2, new Microsoft.Xna.Framework.Rectangle?(rectangle), color1, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); else Main.spriteBatch.Draw(Main.wallTexture[(int) testTile.wall], new Vector2((float) (index2 * 16 - (int) Main.screenPosition.X - 8), (float) (index1 * 16 - (int) Main.screenPosition.Y - 8)) + vector2, new Microsoft.Xna.Framework.Rectangle?(rectangle), color1, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } if ((double) color1.R > (double) num1 * 0.4 || (double) color1.G > (double) num1 * 0.35 || (double) color1.B > (double) num1 * 0.3) { int num10 = Main.tile[index2 - 1, index1].wall <= (byte) 0 ? 0 : (Main.wallBlend[(int) Main.tile[index2 - 1, index1].wall] != Main.wallBlend[(int) testTile.wall] ? 1 : 0); bool flag1 = Main.tile[index2 + 1, index1].wall > (byte) 0 && Main.wallBlend[(int) Main.tile[index2 + 1, index1].wall] != Main.wallBlend[(int) testTile.wall]; bool flag2 = Main.tile[index2, index1 - 1].wall > (byte) 0 && Main.wallBlend[(int) Main.tile[index2, index1 - 1].wall] != Main.wallBlend[(int) testTile.wall]; bool flag3 = Main.tile[index2, index1 + 1].wall > (byte) 0 && Main.wallBlend[(int) Main.tile[index2, index1 + 1].wall] != Main.wallBlend[(int) testTile.wall]; if (num10 != 0) Main.spriteBatch.Draw(Main.wallOutlineTexture, new Vector2((float) (index2 * 16 - (int) Main.screenPosition.X), (float) (index1 * 16 - (int) Main.screenPosition.Y)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 2, 16)), color1, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); if (flag1) Main.spriteBatch.Draw(Main.wallOutlineTexture, new Vector2((float) (index2 * 16 - (int) Main.screenPosition.X + 14), (float) (index1 * 16 - (int) Main.screenPosition.Y)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(14, 0, 2, 16)), color1, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); if (flag2) Main.spriteBatch.Draw(Main.wallOutlineTexture, new Vector2((float) (index2 * 16 - (int) Main.screenPosition.X), (float) (index1 * 16 - (int) Main.screenPosition.Y)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 2)), color1, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); if (flag3) Main.spriteBatch.Draw(Main.wallOutlineTexture, new Vector2((float) (index2 * 16 - (int) Main.screenPosition.X), (float) (index1 * 16 - (int) Main.screenPosition.Y + 14)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 14, 16, 2)), color1, 0.0f, Vector2.Zero, 1f, SpriteEffects.None, 0.0f); } } } } } this.DrawTileCracks(2); TimeLogger.DrawTime(2, stopwatch.Elapsed.TotalMilliseconds); } 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.Depth16, 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.Depth24, 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.Depth24); this.backWaterTarget = new RenderTarget2D(this.GraphicsDevice, width, height, false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24); this.blackTarget = new RenderTarget2D(this.GraphicsDevice, width, height, false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24); this.tileTarget = new RenderTarget2D(this.GraphicsDevice, width, height, false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24); this.tile2Target = new RenderTarget2D(this.GraphicsDevice, width, height, false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24); this.wallTarget = new RenderTarget2D(this.GraphicsDevice, width, height, false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24); this.backgroundTarget = new RenderTarget2D(this.GraphicsDevice, width, height, false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24); Main.screenTarget = new RenderTarget2D(this.GraphicsDevice, this.GraphicsDevice.PresentationParameters.BackBufferWidth, this.GraphicsDevice.PresentationParameters.BackBufferHeight, false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24); Main.screenTargetSwap = new RenderTarget2D(this.GraphicsDevice, this.GraphicsDevice.PresentationParameters.BackBufferWidth, this.GraphicsDevice.PresentationParameters.BackBufferHeight, false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24); if (Main.OnRenderTargetsInitialized == null) return; Main.OnRenderTargetsInitialized(this.GraphicsDevice.PresentationParameters.BackBufferWidth, this.GraphicsDevice.PresentationParameters.BackBufferHeight); } catch { Lighting.lightMode = 2; 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; for (int y = num9; y < num10; ++y) { for (int x = num7; x < num8; ++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(Main.wireTextureNew, 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(Main.wireTextureNew, 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(Main.wireTextureNew, 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(Main.wireTextureNew, 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(Main.wireTextureNew, 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(Main.wireTextureNew, 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(Main.wireTextureNew, 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(Main.wireTextureNew, 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(Main.wireTextureNew, 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(Main.wireTextureNew, 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(Main.wireTextureNew, 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(Main.wireTextureNew, 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(Main.wireTextureNew, 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(Main.wireTextureNew, 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(Main.wireTextureNew, 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(Main.wireTextureNew, 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(Main.actuatorTexture, 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, Main.actuatorTexture.Width, Main.actuatorTexture.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); } protected void DrawWiresOld() { double gfxQuality1 = (double) Main.gfxQuality; double gfxQuality2 = (double) Main.gfxQuality; Vector2 vector2 = new Vector2((float) Main.offScreenRange, (float) Main.offScreenRange); if (Main.drawToScreen) vector2 = Vector2.Zero; int num1 = (int) (((double) Main.screenPosition.X - (double) vector2.X) / 16.0 - 1.0); int num2 = (int) (((double) Main.screenPosition.X + (double) Main.screenWidth + (double) vector2.X) / 16.0) + 2; int num3 = (int) (((double) Main.screenPosition.Y - (double) vector2.Y) / 16.0 - 1.0); int num4 = (int) (((double) Main.screenPosition.Y + (double) Main.screenHeight + (double) vector2.Y) / 16.0) + 5; if (num1 < 0) num1 = 0; if (num2 > Main.maxTilesX) num2 = Main.maxTilesX; if (num3 < 0) num3 = 0; if (num4 > Main.maxTilesY) num4 = Main.maxTilesY; for (int y = num3; y < num4; ++y) { for (int x = num1; x < num2; ++x) { if (Main.tile[x, y].wire() && (double) Lighting.Brightness(x, y) > 0.0) { Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 16); int num5 = Main.tile[x, y - 1].wire() ? 1 : 0; bool flag1 = Main.tile[x, y + 1].wire(); bool flag2 = Main.tile[x - 1, y].wire(); bool flag3 = Main.tile[x + 1, y].wire(); rectangle = num5 == 0 ? (!flag1 ? (!flag2 ? (!flag3 ? new Microsoft.Xna.Framework.Rectangle(0, 54, 16, 16) : new Microsoft.Xna.Framework.Rectangle(72, 36, 16, 16)) : (!flag3 ? new Microsoft.Xna.Framework.Rectangle(54, 36, 16, 16) : new Microsoft.Xna.Framework.Rectangle(18, 0, 16, 16))) : (!flag2 ? (!flag3 ? new Microsoft.Xna.Framework.Rectangle(18, 36, 16, 16) : new Microsoft.Xna.Framework.Rectangle(0, 36, 16, 16)) : (!flag3 ? new Microsoft.Xna.Framework.Rectangle(72, 18, 16, 16) : new Microsoft.Xna.Framework.Rectangle(72, 0, 16, 16)))) : (!flag1 ? (!flag2 ? (!flag3 ? new Microsoft.Xna.Framework.Rectangle(36, 36, 16, 16) : new Microsoft.Xna.Framework.Rectangle(36, 18, 16, 16)) : (!flag3 ? new Microsoft.Xna.Framework.Rectangle(54, 18, 16, 16) : new Microsoft.Xna.Framework.Rectangle(0, 18, 16, 16))) : (!flag2 ? (!flag3 ? new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 16) : new Microsoft.Xna.Framework.Rectangle(36, 0, 16, 16)) : (!flag3 ? new Microsoft.Xna.Framework.Rectangle(54, 0, 16, 16) : new Microsoft.Xna.Framework.Rectangle(18, 18, 16, 16)))); Microsoft.Xna.Framework.Color color = Lighting.GetColor(x, y); Main.spriteBatch.Draw(Main.wireTexture, new Vector2((float) (x * 16 - (int) Main.screenPosition.X), (float) (y * 16 - (int) Main.screenPosition.Y)) + vector2, new Microsoft.Xna.Framework.Rectangle?(rectangle), color, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (Main.tile[x, y].wire2() && (double) Lighting.Brightness(x, y) > 0.0) { Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 16); int num6 = Main.tile[x, y - 1].wire2() ? 1 : 0; bool flag4 = Main.tile[x, y + 1].wire2(); bool flag5 = Main.tile[x - 1, y].wire2(); bool flag6 = Main.tile[x + 1, y].wire2(); rectangle = num6 == 0 ? (!flag4 ? (!flag5 ? (!flag6 ? new Microsoft.Xna.Framework.Rectangle(0, 54, 16, 16) : new Microsoft.Xna.Framework.Rectangle(72, 36, 16, 16)) : (!flag6 ? new Microsoft.Xna.Framework.Rectangle(54, 36, 16, 16) : new Microsoft.Xna.Framework.Rectangle(18, 0, 16, 16))) : (!flag5 ? (!flag6 ? new Microsoft.Xna.Framework.Rectangle(18, 36, 16, 16) : new Microsoft.Xna.Framework.Rectangle(0, 36, 16, 16)) : (!flag6 ? new Microsoft.Xna.Framework.Rectangle(72, 18, 16, 16) : new Microsoft.Xna.Framework.Rectangle(72, 0, 16, 16)))) : (!flag4 ? (!flag5 ? (!flag6 ? new Microsoft.Xna.Framework.Rectangle(36, 36, 16, 16) : new Microsoft.Xna.Framework.Rectangle(36, 18, 16, 16)) : (!flag6 ? new Microsoft.Xna.Framework.Rectangle(54, 18, 16, 16) : new Microsoft.Xna.Framework.Rectangle(0, 18, 16, 16))) : (!flag5 ? (!flag6 ? new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 16) : new Microsoft.Xna.Framework.Rectangle(36, 0, 16, 16)) : (!flag6 ? new Microsoft.Xna.Framework.Rectangle(54, 0, 16, 16) : new Microsoft.Xna.Framework.Rectangle(18, 18, 16, 16)))); Microsoft.Xna.Framework.Color color = Lighting.GetColor(x, y); int num7 = 1; if (Main.tile[x, y].wire()) ++num7; float num8 = 1f / (float) num7; color = new Microsoft.Xna.Framework.Color((int) (byte) ((double) color.R * (double) num8), (int) (byte) ((double) color.G * (double) num8), (int) (byte) ((double) color.B * (double) num8), (int) (byte) ((double) color.A * (double) num8)); Main.spriteBatch.Draw(Main.wire2Texture, new Vector2((float) (x * 16 - (int) Main.screenPosition.X), (float) (y * 16 - (int) Main.screenPosition.Y)) + vector2, new Microsoft.Xna.Framework.Rectangle?(rectangle), color, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (Main.tile[x, y].wire3() && (double) Lighting.Brightness(x, y) > 0.0) { Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 16); int num9 = Main.tile[x, y - 1].wire3() ? 1 : 0; bool flag7 = Main.tile[x, y + 1].wire3(); bool flag8 = Main.tile[x - 1, y].wire3(); bool flag9 = Main.tile[x + 1, y].wire3(); rectangle = num9 == 0 ? (!flag7 ? (!flag8 ? (!flag9 ? new Microsoft.Xna.Framework.Rectangle(0, 54, 16, 16) : new Microsoft.Xna.Framework.Rectangle(72, 36, 16, 16)) : (!flag9 ? new Microsoft.Xna.Framework.Rectangle(54, 36, 16, 16) : new Microsoft.Xna.Framework.Rectangle(18, 0, 16, 16))) : (!flag8 ? (!flag9 ? new Microsoft.Xna.Framework.Rectangle(18, 36, 16, 16) : new Microsoft.Xna.Framework.Rectangle(0, 36, 16, 16)) : (!flag9 ? new Microsoft.Xna.Framework.Rectangle(72, 18, 16, 16) : new Microsoft.Xna.Framework.Rectangle(72, 0, 16, 16)))) : (!flag7 ? (!flag8 ? (!flag9 ? new Microsoft.Xna.Framework.Rectangle(36, 36, 16, 16) : new Microsoft.Xna.Framework.Rectangle(36, 18, 16, 16)) : (!flag9 ? new Microsoft.Xna.Framework.Rectangle(54, 18, 16, 16) : new Microsoft.Xna.Framework.Rectangle(0, 18, 16, 16))) : (!flag8 ? (!flag9 ? new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 16) : new Microsoft.Xna.Framework.Rectangle(36, 0, 16, 16)) : (!flag9 ? new Microsoft.Xna.Framework.Rectangle(54, 0, 16, 16) : new Microsoft.Xna.Framework.Rectangle(18, 18, 16, 16)))); Microsoft.Xna.Framework.Color color = Lighting.GetColor(x, y); int num10 = 1; if (Main.tile[x, y].wire()) ++num10; if (Main.tile[x, y].wire2()) ++num10; float num11 = 1f / (float) num10; color = new Microsoft.Xna.Framework.Color((int) (byte) ((double) color.R * (double) num11), (int) (byte) ((double) color.G * (double) num11), (int) (byte) ((double) color.B * (double) num11), (int) (byte) ((double) color.A * (double) num11)); Main.spriteBatch.Draw(Main.wire3Texture, new Vector2((float) (x * 16 - (int) Main.screenPosition.X), (float) (y * 16 - (int) Main.screenPosition.Y)) + vector2, new Microsoft.Xna.Framework.Rectangle?(rectangle), color, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (Main.tile[x, y].wire4() && (double) Lighting.Brightness(x, y) > 0.0) { Microsoft.Xna.Framework.Rectangle rectangle = new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 16); int num12 = Main.tile[x, y - 1].wire4() ? 1 : 0; bool flag10 = Main.tile[x, y + 1].wire4(); bool flag11 = Main.tile[x - 1, y].wire4(); bool flag12 = Main.tile[x + 1, y].wire4(); rectangle = num12 == 0 ? (!flag10 ? (!flag11 ? (!flag12 ? new Microsoft.Xna.Framework.Rectangle(0, 54, 16, 16) : new Microsoft.Xna.Framework.Rectangle(72, 36, 16, 16)) : (!flag12 ? new Microsoft.Xna.Framework.Rectangle(54, 36, 16, 16) : new Microsoft.Xna.Framework.Rectangle(18, 0, 16, 16))) : (!flag11 ? (!flag12 ? new Microsoft.Xna.Framework.Rectangle(18, 36, 16, 16) : new Microsoft.Xna.Framework.Rectangle(0, 36, 16, 16)) : (!flag12 ? new Microsoft.Xna.Framework.Rectangle(72, 18, 16, 16) : new Microsoft.Xna.Framework.Rectangle(72, 0, 16, 16)))) : (!flag10 ? (!flag11 ? (!flag12 ? new Microsoft.Xna.Framework.Rectangle(36, 36, 16, 16) : new Microsoft.Xna.Framework.Rectangle(36, 18, 16, 16)) : (!flag12 ? new Microsoft.Xna.Framework.Rectangle(54, 18, 16, 16) : new Microsoft.Xna.Framework.Rectangle(0, 18, 16, 16))) : (!flag11 ? (!flag12 ? new Microsoft.Xna.Framework.Rectangle(0, 0, 16, 16) : new Microsoft.Xna.Framework.Rectangle(36, 0, 16, 16)) : (!flag12 ? new Microsoft.Xna.Framework.Rectangle(54, 0, 16, 16) : new Microsoft.Xna.Framework.Rectangle(18, 18, 16, 16)))); Microsoft.Xna.Framework.Color color = Lighting.GetColor(x, y); int num13 = 1; if (Main.tile[x, y].wire()) ++num13; if (Main.tile[x, y].wire2()) ++num13; if (Main.tile[x, y].wire3()) ++num13; float num14 = 1f / (float) num13; color = new Microsoft.Xna.Framework.Color((int) (byte) ((double) color.R * (double) num14), (int) (byte) ((double) color.G * (double) num14), (int) (byte) ((double) color.B * (double) num14), (int) (byte) ((double) color.A * (double) num14)); Main.spriteBatch.Draw(Main.wire4Texture, new Vector2((float) (x * 16 - (int) Main.screenPosition.X), (float) (y * 16 - (int) Main.screenPosition.Y)) + vector2, new Microsoft.Xna.Framework.Rectangle?(rectangle), color, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } if (Main.tile[x, y].actuator() && (double) Lighting.Brightness(x, y) > 0.0) { Microsoft.Xna.Framework.Color color = Lighting.GetColor(x, y); Main.spriteBatch.Draw(Main.actuatorTexture, new Vector2((float) (x * 16 - (int) Main.screenPosition.X), (float) (y * 16 - (int) Main.screenPosition.Y)) + vector2, new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.actuatorTexture.Width, Main.actuatorTexture.Height)), color, 0.0f, new Vector2(), 1f, SpriteEffects.None, 0.0f); } } } TimeLogger.DetailedDrawTime(34); } public static int GetTreeStyle(int X) { int num = X > Main.treeX[0] ? (X > Main.treeX[1] ? (X > Main.treeX[2] ? Main.treeStyle[3] : Main.treeStyle[2]) : Main.treeStyle[1]) : Main.treeStyle[0]; switch (num) { case 0: return 0; case 5: return 10; default: return 5 + num; } } protected void lookForColorTiles() { int num1 = (int) ((double) Main.screenPosition.X / 16.0 - 2.0); int num2 = (int) (((double) Main.screenPosition.X + (double) Main.screenWidth) / 16.0) + 3; int num3 = (int) ((double) Main.screenPosition.Y / 16.0 - 2.0); int num4 = (int) (((double) Main.screenPosition.Y + (double) Main.screenHeight) / 16.0) + 3; if (num1 < 1) num1 = 1; if (num2 > Main.maxTilesX - 2) num2 = Main.maxTilesX - 2; if (num3 < 1) num3 = 1; if (num4 > Main.maxTilesY - 2) num4 = Main.maxTilesY - 2; for (int x = num1; x < num2; ++x) { if (x > 0) { for (int y = num3; y < num4; ++y) { if (Main.tile[x, y] != null) { int treeVariant = Main.GetTreeVariant(x, y); if (treeVariant != -1) this.woodColorCheck(treeVariant, (int) Main.tile[x, y].color()); if (Main.tile[x, y].active() && Main.tile[x, y].color() > (byte) 0) this.tileColorCheck((int) Main.tile[x, y].type, (int) Main.tile[x, y].color()); if (Main.tile[x, y].wall > (byte) 0 && Main.tile[x, y].wallColor() > (byte) 0) this.wallColorCheck((int) Main.tile[x, y].wall, (int) Main.tile[x, y].wallColor()); } } } } for (int t = 0; t < Main.numTreeStyles; ++t) { for (int c = 0; c < Main.numTileColors; ++c) { if (Main.checkTreeAlt[t, c]) { this.treeColorCheck(t, c); Main.checkTreeAlt[t, c] = false; } } } } protected static int GetTreeVariant(int x, int y) { if (Main.tile[x, y] == null || !Main.tile[x, y].active()) return -1; switch (Main.tile[x, y].type) { case 23: return 0; case 60: return (double) y <= Main.worldSurface ? 1 : 5; case 70: return 6; case 109: return 2; case 147: return 3; case 199: return 4; default: return -1; } } protected void woodColorCheck(int t, int c) { this.LoadTiles(5); if (c >= Main.numTileColors) return; bool flag = false; if (Main.woodAltTexture[t, c] == null) { Main.woodAltTexture[t, c] = new RenderTarget2D(this.GraphicsDevice, Main.woodTexture[t].Width, Main.woodTexture[t].Height, false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents); flag = true; } if (Main.woodAltTexture[t, c].IsContentLost) flag = true; if (!flag) return; this.GraphicsDevice.SetRenderTarget(Main.woodAltTexture[t, c]); this.GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Transparent); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); if (c >= 28) Main.tileShader.CurrentTechnique.Passes[40 + c - 28].Apply(); else if (c > 0 && c < 13) Main.tileShader.CurrentTechnique.Passes[c + 27].Apply(); else Main.tileShader.CurrentTechnique.Passes[c].Apply(); Main.spriteBatch.Draw(Main.woodTexture[t], new Microsoft.Xna.Framework.Rectangle(0, 0, Main.woodTexture[t].Width, Main.woodTexture[t].Height), Microsoft.Xna.Framework.Color.White); Main.spriteBatch.End(); this.GraphicsDevice.SetRenderTarget((RenderTarget2D) null); } protected void tileColorCheck(int t, int c) { this.LoadTiles(t); if (c >= Main.numTileColors) return; if (!Main.tileAltTextureInit[t, c]) { Main.tileAltTexture[t, c] = new RenderTarget2D(this.GraphicsDevice, Main.tileTexture[t].Width, Main.tileTexture[t].Height, false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents); Main.tileAltTextureInit[t, c] = true; } if (Main.tileAltTexture[t, c].IsContentLost) Main.tileAltTextureDrawn[t, c] = false; if (Main.tileAltTextureDrawn[t, c]) return; this.GraphicsDevice.SetRenderTarget(Main.tileAltTexture[t, c]); this.GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Transparent); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); if (c >= 28) Main.tileShader.CurrentTechnique.Passes[40 + c - 28].Apply(); else if (c > 0 && c < 13 && (t == 0 || t == 2 || t == 5 || t == 23 || t == 59 || t == 60 || t == 70 || t == 109 || t == 199)) Main.tileShader.CurrentTechnique.Passes[c + 27].Apply(); else Main.tileShader.CurrentTechnique.Passes[c].Apply(); Main.spriteBatch.Draw(Main.tileTexture[t], new Microsoft.Xna.Framework.Rectangle(0, 0, Main.tileTexture[t].Width, Main.tileTexture[t].Height), Microsoft.Xna.Framework.Color.White); Main.spriteBatch.End(); this.GraphicsDevice.SetRenderTarget((RenderTarget2D) null); Main.tileAltTextureDrawn[t, c] = true; } protected void treeColorCheck(int t, int c) { if (!Main.treeAltTextureInit[t, c]) { Main.treeTopAltTexture[t, c] = new RenderTarget2D(this.GraphicsDevice, Main.treeTopTexture[t].Width, Main.treeTopTexture[t].Height, false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents); Main.treeBranchAltTexture[t, c] = new RenderTarget2D(this.GraphicsDevice, Main.treeBranchTexture[t].Width, Main.treeBranchTexture[t].Height, false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents); Main.treeAltTextureInit[t, c] = true; } if (Main.treeTopAltTexture[t, c].IsContentLost || Main.treeBranchAltTexture[t, c].IsContentLost) Main.treeAltTextureDrawn[t, c] = false; if (Main.treeAltTextureDrawn[t, c]) return; this.GraphicsDevice.SetRenderTarget(Main.treeTopAltTexture[t, c]); this.GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Transparent); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); if (c >= 28) Main.tileShader.CurrentTechnique.Passes[40 + c - 28].Apply(); else if (c > 0 && c < 13) Main.tileShader.CurrentTechnique.Passes[c + 27].Apply(); else Main.tileShader.CurrentTechnique.Passes[c].Apply(); Main.spriteBatch.Draw(Main.treeTopTexture[t], new Microsoft.Xna.Framework.Rectangle(0, 0, Main.treeTopTexture[t].Width, Main.treeTopTexture[t].Height), Microsoft.Xna.Framework.Color.White); Main.spriteBatch.End(); this.GraphicsDevice.SetRenderTarget((RenderTarget2D) null); this.GraphicsDevice.SetRenderTarget(Main.treeBranchAltTexture[t, c]); this.GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Transparent); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); if (c >= 28) Main.tileShader.CurrentTechnique.Passes[40 + c - 28].Apply(); else if (c > 0 && c < 13) Main.tileShader.CurrentTechnique.Passes[c + 27].Apply(); else Main.tileShader.CurrentTechnique.Passes[c].Apply(); Main.spriteBatch.Draw(Main.treeBranchTexture[t], new Microsoft.Xna.Framework.Rectangle(0, 0, Main.treeBranchTexture[t].Width, Main.treeBranchTexture[t].Height), Microsoft.Xna.Framework.Color.White); Main.spriteBatch.End(); this.GraphicsDevice.SetRenderTarget((RenderTarget2D) null); Main.treeAltTextureDrawn[t, c] = true; } protected void wallColorCheck(int t, int c) { this.LoadWall(t); if (!Main.wallAltTextureInit[t, c]) { Main.wallAltTexture[t, c] = new RenderTarget2D(this.GraphicsDevice, Main.wallTexture[t].Width, Main.wallTexture[t].Height, false, this.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents); Main.wallAltTextureInit[t, c] = true; } if (Main.wallAltTexture[t, c].IsContentLost) Main.wallAltTextureDrawn[t, c] = false; if (Main.wallAltTextureDrawn[t, c]) return; this.GraphicsDevice.SetRenderTarget(Main.wallAltTexture[t, c]); this.GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Transparent); Main.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); if (c == 30) Main.tileShader.CurrentTechnique.Passes[43].Apply(); else if (c >= 28) Main.tileShader.CurrentTechnique.Passes[40 + c - 28].Apply(); else Main.tileShader.CurrentTechnique.Passes[c].Apply(); Main.spriteBatch.Draw(Main.wallTexture[t], new Microsoft.Xna.Framework.Rectangle(0, 0, Main.wallTexture[t].Width, Main.wallTexture[t].Height), Microsoft.Xna.Framework.Color.White); Main.spriteBatch.End(); this.GraphicsDevice.SetRenderTarget((RenderTarget2D) null); Main.wallAltTextureDrawn[t, c] = true; } public void UpdateWeather(GameTime gameTime) { Main.cloudLimit = 200; if ((double) Main.windSpeed < (double) Main.windSpeedSet) { Main.windSpeed += 1f / 1000f * (float) Main.dayRate; if ((double) Main.windSpeed > (double) Main.windSpeedSet) Main.windSpeed = Main.windSpeedSet; } else if ((double) Main.windSpeed > (double) Main.windSpeedSet) { Main.windSpeed -= 1f / 1000f * (float) Main.dayRate; if ((double) Main.windSpeed < (double) Main.windSpeedSet) Main.windSpeed = Main.windSpeedSet; } switch (Main.netMode) { case 1: break; case 2: Main.windSpeedSpeed += (float) Main.rand.Next(-10, 11) * 0.0001f; if (!Main.dayTime) Main.windSpeedSpeed += (float) Main.rand.Next(-10, 11) * 0.0002f; if ((double) Main.windSpeedSpeed < -0.002) Main.windSpeedSpeed = -1f / 500f; if ((double) Main.windSpeedSpeed > 0.002) Main.windSpeedSpeed = 1f / 500f; Main.windSpeedTemp += Main.windSpeedSpeed; if (Main.raining) Main.windSpeedTemp += Main.windSpeedSpeed * 2f; float num = (float) (0.300000011920929 + 0.5 * (double) Main.cloudAlpha); if ((double) Main.windSpeedTemp < -(double) num) Main.windSpeedTemp = -num; if ((double) Main.windSpeedTemp > (double) num) Main.windSpeedTemp = num; 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(1000) < 25.0 * (1.0 - (double) Main.cloudBGAlpha)) --Main.numCloudsTemp; if ((double) Main.rand.Next(1000) < 200.0 * (double) Main.cloudAlpha && Main.numCloudsTemp < Main.cloudLimit / 2) ++Main.numCloudsTemp; if ((double) Main.rand.Next(1000) < 50.0 * (double) Main.cloudAlpha) ++Main.numCloudsTemp; if (Main.numCloudsTemp > Main.cloudLimit / 4 && Main.rand.Next(100) == 0) Main.numCloudsTemp -= Main.rand.Next(1, 3); if (Main.numCloudsTemp < Main.cloudLimit / 4 && Main.rand.Next(100) == 0) Main.numCloudsTemp += Main.rand.Next(1, 3); if ((double) Main.cloudBGActive <= 0.0 && Main.numCloudsTemp > Main.cloudLimit / 2 && (double) Main.cloudAlpha == 0.0) Main.numCloudsTemp = Main.cloudLimit / 2; if (Main.numCloudsTemp < 0) Main.numCloudsTemp = 0; if (Main.numCloudsTemp > Main.cloudLimit) Main.numCloudsTemp = Main.cloudLimit; Main.weatherCounter -= Main.dayRate; if (Main.weatherCounter > 0) break; Main.numClouds = Main.numCloudsTemp; Main.windSpeedSet = Main.windSpeedTemp; Main.weatherCounter = Main.rand.Next(3600, 18000); 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 || Main.backgroundLoaded[i]) return; Main.backgroundTexture[i] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "Background_" + (object) i); Main.backgroundWidth[i] = Main.backgroundTexture[i].Width; Main.backgroundHeight[i] = Main.backgroundTexture[i].Height; Main.backgroundLoaded[i] = true; } protected void LoadNPC(int i) { if (Main.NPCLoaded[i] && Main.npcTexture[i] != null) return; Main.npcTexture[i] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "NPC_" + (object) i); Main.NPCLoaded[i] = true; } protected void LoadProjectile(int i) { if (Main.projectileLoaded[i]) return; Main.projectileTexture[i] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "Projectile_" + (object) i); Main.projectileLoaded[i] = true; } protected void LoadGore(int i) { if (Main.goreLoaded[i]) return; Main.goreTexture[i] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "Gore_" + (object) i); Main.goreLoaded[i] = true; } protected void LoadWall(int i) { if (Main.wallLoaded[i]) return; Main.wallTexture[i] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "Wall_" + (object) i); Main.wallLoaded[i] = true; } protected void LoadTiles(int i) { if (Main.tileSetsLoaded[i]) return; Main.tileTexture[i] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "Tiles_" + (object) i); Main.tileSetsLoaded[i] = true; } protected void LoadItemFlames(int i) { if (Main.itemFlameLoaded[i]) return; try { Main.itemFlameTexture[i] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "ItemFlame_" + (object) i); } catch { } Main.itemFlameLoaded[i] = true; } protected void LoadWings(int i) { if (Main.wingsLoaded[i]) return; Main.wingsTexture[i] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "Wings_" + (object) i); Main.wingsLoaded[i] = true; } protected void LoadHair(int i) { if (Main.hairLoaded[i]) return; Main.playerHairTexture[i] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "Player_Hair_" + (object) (i + 1)); Main.playerHairAltTexture[i] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "Player_HairAlt_" + (object) (i + 1)); Main.hairLoaded[i] = true; } protected void LoadArmorHead(int i) { if (Main.armorHeadLoaded[i]) return; Main.armorHeadTexture[i] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "Armor_Head_" + (object) i); Main.armorHeadLoaded[i] = true; } protected void LoadArmorBody(int i) { if (Main.armorBodyLoaded[i]) return; Main.femaleBodyTexture[i] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "Female_Body_" + (object) i); Main.armorBodyTexture[i] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "Armor_Body_" + (object) i); Main.armorArmTexture[i] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "Armor_Arm_" + (object) i); Main.armorBodyLoaded[i] = true; } protected void LoadArmorLegs(int i) { if (Main.armorLegsLoaded[i]) return; Main.armorLegTexture[i] = this.OurLoad("Images" + Path.DirectorySeparatorChar.ToString() + "Armor_Legs_" + (object) i); Main.armorLegsLoaded[i] = true; } protected void LoadAccHandsOn(int i) { if (Main.accHandsOnLoaded[i]) return; Main.accHandsOnTexture[i] = this.OurLoad("Images/Acc_HandsOn_" + (object) i); Main.accHandsOnLoaded[i] = true; } protected void LoadAccHandsOff(int i) { if (Main.accHandsOffLoaded[i]) return; Main.accHandsOffTexture[i] = this.OurLoad("Images/Acc_HandsOff_" + (object) i); Main.accHandsOffLoaded[i] = true; } protected void LoadAccBack(int i) { if (Main.accBackLoaded[i]) return; Main.accBackTexture[i] = this.OurLoad("Images/Acc_Back_" + (object) i); Main.accBackLoaded[i] = true; } protected void LoadAccFront(int i) { if (Main.accFrontLoaded[i]) return; Main.accFrontTexture[i] = this.OurLoad("Images/Acc_Front_" + (object) i); Main.accFrontLoaded[i] = true; } protected void LoadAccShoes(int i) { if (Main.accShoesLoaded[i]) return; Main.accShoesTexture[i] = this.OurLoad("Images/Acc_Shoes_" + (object) i); Main.accShoesLoaded[i] = true; } protected void LoadAccWaist(int i) { if (Main.accWaistLoaded[i]) return; Main.accWaistTexture[i] = this.OurLoad("Images/Acc_Waist_" + (object) i); Main.accWaistLoaded[i] = true; } protected void LoadAccShield(int i) { if (Main.accShieldLoaded[i]) return; Main.accShieldTexture[i] = this.OurLoad("Images/Acc_Shield_" + (object) i); Main.accShieldLoaded[i] = true; } protected void LoadAccNeck(int i) { if (Main.accNeckLoaded[i]) return; Main.accNeckTexture[i] = this.OurLoad("Images/Acc_Neck_" + (object) i); Main.accNeckLoaded[i] = true; } protected void LoadAccFace(int i) { if (Main.accFaceLoaded[i]) return; Main.accFaceTexture[i] = this.OurLoad("Images/Acc_Face_" + (object) i); Main.accFaceLoaded[i] = true; } protected void LoadAccBalloon(int i) { if (Main.accballoonLoaded[i]) return; Main.accBalloonTexture[i] = this.OurLoad("Images/Acc_Balloon_" + (object) i); Main.accballoonLoaded[i] = true; } protected void LoadFlameRing() { if (Main.flameRingLoaded) return; this.flameRingTexture = this.OurLoad("Images/FlameRing"); Main.flameRingLoaded = true; } protected void DrawSurfaceBG() { float num1 = SkyManager.Instance.ProcessCloudAlpha(); 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.bgColor); float num2 = Main.cloud[index].scale * 0.8f; float num3 = (float) (((double) Main.cloud[index].scale + 1.0) / 2.0 * 0.899999976158142); color.R = (byte) ((double) color.R * (double) num2); color.G = (byte) ((double) color.G * (double) num3); Main.atmo = 1f; float num4 = Main.cloud[index].position.Y * ((float) Main.screenHeight / 600f); float num5 = Main.cloud[index].position.Y + (float) (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 750.0 + 830.0) + (float) (int) this.scAdj; Main.spriteBatch.Draw(Main.cloudTexture[Main.cloud[index].type], new Vector2(Main.cloud[index].position.X + (float) Main.cloudTexture[Main.cloud[index].type].Width * 0.5f, num5 + (float) Main.cloudTexture[Main.cloud[index].type].Height * 0.5f), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.cloudTexture[Main.cloud[index].type].Width, Main.cloudTexture[Main.cloud[index].type].Height)), color * num1, Main.cloud[index].rotation, new Vector2((float) Main.cloudTexture[Main.cloud[index].type].Width * 0.5f, (float) Main.cloudTexture[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(); Main.atmo = 1f; Main.bgScale *= 2f; this.bgParallax = 0.15; if ((double) Main.atmo < 1.0) { Main.backColor.R = (byte) ((double) Main.backColor.R * (double) Main.atmo); Main.backColor.G = (byte) ((double) Main.backColor.G * (double) Main.atmo); Main.backColor.B = (byte) ((double) Main.backColor.B * (double) Main.atmo); Main.backColor.A = (byte) ((double) Main.backColor.A * (double) Main.atmo); } if (!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]); Main.bgScale *= 2f; this.bgParallax = 0.15; float num6 = Main.cloudBGAlpha; if ((double) num6 > 1.0) num6 = 1f; Main.bgScale = 1.65f; this.bgParallax = 0.0900000035762787; if (this.IsActive) Main.cloudBGX[0] += (float) ((double) Main.windSpeed * this.bgParallax * 5.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; Main.bgW = (int) ((double) Main.backgroundWidth[Main.cloudBG[0]] * (double) Main.bgScale); this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 900.0 + 600.0) + (int) this.scAdj; if (Main.gameMenu) this.bgTop = -150; this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2) - (double) Main.bgW); this.bgStart += (int) Main.cloudBGX[0]; this.bgLoops = Main.screenWidth / Main.bgW + 2 + 2; Main.backColor = Main.trueBackColor; Main.backColor.R = (byte) ((double) Main.backColor.R * (double) num6); Main.backColor.G = (byte) ((double) Main.backColor.G * (double) num6); Main.backColor.B = (byte) ((double) Main.backColor.B * (double) num6); Main.backColor.A = (byte) ((double) Main.backColor.A * (double) num6); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(Main.backgroundTexture[Main.cloudBG[0]], new Vector2((float) (this.bgStart + Main.bgW * index), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.cloudBG[0]], Main.backgroundHeight[Main.cloudBG[0]])), Main.backColor * num1, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); float num7 = Main.cloudBGAlpha * 1.5f; if ((double) num7 > 1.0) num7 = 1f; Main.backColor = Main.trueBackColor; Main.backColor.R = (byte) ((double) Main.backColor.R * (double) num7); Main.backColor.G = (byte) ((double) Main.backColor.G * (double) num7); Main.backColor.B = (byte) ((double) Main.backColor.B * (double) num7); Main.backColor.A = (byte) ((double) Main.backColor.A * (double) num7); Main.bgScale = 1.85f; this.bgParallax = 0.12; if (this.IsActive) Main.cloudBGX[1] += (float) ((double) Main.windSpeed * this.bgParallax * 5.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; Main.bgW = (int) ((double) Main.backgroundWidth[Main.cloudBG[1]] * (double) Main.bgScale); this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 1100.0 + 750.0) + (int) this.scAdj; if (Main.gameMenu) this.bgTop = -50; this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2) - (double) Main.bgW); this.bgStart += (int) Main.cloudBGX[1]; this.bgLoops = Main.screenWidth / Main.bgW + 2 + 2; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(Main.backgroundTexture[Main.cloudBG[1]], new Vector2((float) (this.bgStart + Main.bgW * index), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.cloudBG[1]], Main.backgroundHeight[Main.cloudBG[1]])), Main.backColor * num1, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } this.LoadBackground(Main.treeMntBG[0]); this.LoadBackground(Main.treeMntBG[1]); Main.bgScale = 1f; this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 1300.0 + 1090.0) + (int) this.scAdj; Main.bgScale *= 2f; this.bgParallax = 0.15; Main.bgW = (int) ((double) Main.backgroundWidth[Main.treeMntBG[0]] * (double) Main.bgScale); SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); if (Main.bgW == 0) Main.bgW = 1024; this.bgLoops = Main.screenWidth / Main.bgW + 2; if (Main.gameMenu) this.bgTop = 100; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { Main.backColor = Main.trueBackColor; Main.backColor.R = (byte) ((double) Main.backColor.R * (double) Main.bgAlpha2[0]); Main.backColor.G = (byte) ((double) Main.backColor.G * (double) Main.bgAlpha2[0]); Main.backColor.B = (byte) ((double) Main.backColor.B * (double) Main.bgAlpha2[0]); Main.backColor.A = (byte) ((double) Main.backColor.A * (double) Main.bgAlpha2[0]); if ((double) Main.bgAlpha2[0] > 0.0) { if (Main.treeMntBG[0] == 93 || Main.treeMntBG[0] >= 168 && Main.treeMntBG[0] <= 170) this.bgTop -= 50; if (Main.treeMntBG[0] == 171) this.bgTop -= 100; if (Main.treeMntBG[0] == 176) this.bgTop += 250; if (Main.treeMntBG[0] == 179) this.bgTop -= 100; for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(Main.backgroundTexture[Main.treeMntBG[0]], new Vector2((float) (this.bgStart + Main.bgW * index), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.treeMntBG[0]], Main.backgroundHeight[Main.treeMntBG[0]])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); if (Main.treeMntBG[0] == 93 || Main.treeMntBG[0] >= 168 && Main.treeMntBG[0] <= 170) this.bgTop += 50; if (Main.treeMntBG[0] == 171) this.bgTop += 100; if (Main.treeMntBG[0] == 176) this.bgTop -= 250; if (Main.treeMntBG[0] == 179) this.bgTop += 100; } Main.backColor = Main.trueBackColor; Main.backColor.R = (byte) ((double) Main.backColor.R * (double) Main.bgAlpha2[1]); Main.backColor.G = (byte) ((double) Main.backColor.G * (double) Main.bgAlpha2[1]); Main.backColor.B = (byte) ((double) Main.backColor.B * (double) Main.bgAlpha2[1]); Main.backColor.A = (byte) ((double) Main.backColor.A * (double) Main.bgAlpha2[1]); if ((double) Main.bgAlpha2[1] > 0.0) { this.LoadBackground(23); for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(Main.backgroundTexture[23], new Vector2((float) (this.bgStart + Main.bgW * index), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[23], Main.backgroundHeight[23])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } Main.backColor = Main.trueBackColor; Main.backColor.R = (byte) ((double) Main.backColor.R * (double) Main.bgAlpha2[2]); Main.backColor.G = (byte) ((double) Main.backColor.G * (double) Main.bgAlpha2[2]); Main.backColor.B = (byte) ((double) Main.backColor.B * (double) Main.bgAlpha2[2]); Main.backColor.A = (byte) ((double) Main.backColor.A * (double) Main.bgAlpha2[2]); if ((double) Main.bgAlpha2[2] > 0.0) { this.LoadBackground(24); for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(Main.backgroundTexture[24], new Vector2((float) (this.bgStart + Main.bgW * index), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[24], Main.backgroundHeight[24])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } Main.backColor = Main.trueBackColor; Main.backColor.R = (byte) ((double) Main.backColor.R * (double) Main.bgAlpha2[4]); Main.backColor.G = (byte) ((double) Main.backColor.G * (double) Main.bgAlpha2[4]); Main.backColor.B = (byte) ((double) Main.backColor.B * (double) Main.bgAlpha2[4]); Main.backColor.A = (byte) ((double) Main.backColor.A * (double) Main.bgAlpha2[4]); if ((double) Main.bgAlpha2[4] > 0.0) { this.LoadBackground(Main.snowMntBG[0]); for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(Main.backgroundTexture[Main.snowMntBG[0]], new Vector2((float) (this.bgStart + Main.bgW * index), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.snowMntBG[0]], Main.backgroundHeight[Main.snowMntBG[0]])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } Main.backColor = Main.trueBackColor; Main.backColor.R = (byte) ((double) Main.backColor.R * (double) Main.bgAlpha2[5]); Main.backColor.G = (byte) ((double) Main.backColor.G * (double) Main.bgAlpha2[5]); Main.backColor.B = (byte) ((double) Main.backColor.B * (double) Main.bgAlpha2[5]); Main.backColor.A = (byte) ((double) Main.backColor.A * (double) Main.bgAlpha2[5]); if ((double) Main.bgAlpha2[5] > 0.0) { this.LoadBackground(24); for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(Main.backgroundTexture[24], new Vector2((float) (this.bgStart + Main.bgW * index), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[24], Main.backgroundHeight[24])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } SkyManager.Instance.DrawToDepth(Main.spriteBatch, 5f); } } this.cTop = (float) (this.bgTop - 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.bgColor); if ((double) Main.atmo < 1.0) { 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); color.A = (byte) ((double) color.A * (double) Main.atmo); } float num8 = Main.cloud[index].position.Y * ((float) Main.screenHeight / 600f); float num9 = (float) (((double) Main.screenPosition.Y / 16.0 - 24.0) / Main.worldSurface); if ((double) num9 < 0.0) num9 = 0.0f; float num10; if ((double) num9 > 1.0) num10 = 1f; if (Main.gameMenu) num10 = 1f; Main.spriteBatch.Draw(Main.cloudTexture[Main.cloud[index].type], new Vector2(Main.cloud[index].position.X + (float) Main.cloudTexture[Main.cloud[index].type].Width * 0.5f, (float) ((double) num8 + (double) Main.cloudTexture[Main.cloud[index].type].Height * 0.5 + (double) this.cTop + 200.0)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.cloudTexture[Main.cloud[index].type].Width, Main.cloudTexture[Main.cloud[index].type].Height)), color * num1, Main.cloud[index].rotation, new Vector2((float) Main.cloudTexture[Main.cloud[index].type].Width * 0.5f, (float) Main.cloudTexture[Main.cloud[index].type].Height * 0.5f), Main.cloud[index].scale, Main.cloud[index].spriteDir, 0.0f); } } } if (Main.holyTiles > 0 && Main.BackgroundEnabled) { this.bgParallax = 0.17; Main.bgScale = 1.1f; Main.bgScale *= 2f; Main.bgW = (int) (3500.0 * (double) Main.bgScale * 1.05); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); this.bgLoops = Main.screenWidth / Main.bgW + 2; this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 1400.0 + 900.0) + (int) this.scAdj; if (Main.gameMenu) { this.bgTop = 230; this.bgStart -= 500; } SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); Microsoft.Xna.Framework.Color trueBackColor = Main.trueBackColor; float num11 = (float) Main.holyTiles / 400f; if ((double) num11 > 0.5) num11 = 0.5f; trueBackColor.R = (byte) ((double) trueBackColor.R * (double) num11); trueBackColor.G = (byte) ((double) trueBackColor.G * (double) num11); trueBackColor.B = (byte) ((double) trueBackColor.B * (double) num11); trueBackColor.A = (byte) ((double) trueBackColor.A * (double) num11 * 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(Main.backgroundTexture[18], new Vector2((float) (this.bgStart + Main.bgW * index), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[18], Main.backgroundHeight[18])), trueBackColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(Main.backgroundTexture[19], new Vector2((float) (this.bgStart + Main.bgW * index + 1700), (float) (this.bgTop + 100)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[19], Main.backgroundHeight[19])), trueBackColor, 0.0f, new Vector2(), Main.bgScale * 0.9f, SpriteEffects.None, 0.0f); } } } if (Main.treeMntBG[1] > -1) { this.LoadBackground(Main.treeMntBG[1]); this.bgParallax = 0.2; Main.bgScale = 1.15f; Main.bgScale *= 2f; Main.bgW = (int) ((double) Main.backgroundWidth[Main.treeMntBG[1]] * (double) Main.bgScale); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); this.bgLoops = Main.screenWidth / Main.bgW + 2; this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 1400.0 + 1260.0) + (int) this.scAdj; } if (Main.BackgroundEnabled) { if (Main.gameMenu) { this.bgTop = 230; this.bgStart -= 500; } SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { Main.backColor = Main.trueBackColor; Main.backColor.R = (byte) ((double) Main.backColor.R * (double) Main.bgAlpha2[0]); Main.backColor.G = (byte) ((double) Main.backColor.G * (double) Main.bgAlpha2[0]); Main.backColor.B = (byte) ((double) Main.backColor.B * (double) Main.bgAlpha2[0]); Main.backColor.A = (byte) ((double) Main.backColor.A * (double) Main.bgAlpha2[0]); if ((double) Main.bgAlpha2[0] > 0.0 && Main.treeMntBG[1] > -1) { if (Main.treeMntBG[1] == 172) this.bgTop += 130; if (Main.treeMntBG[1] == 177) this.bgTop += 200; if (Main.treeMntBG[1] >= 180 && Main.treeMntBG[1] <= 183) this.bgTop -= 350; for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(Main.backgroundTexture[Main.treeMntBG[1]], new Vector2((float) (this.bgStart + Main.bgW * index), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.treeMntBG[1]], Main.backgroundHeight[Main.treeMntBG[1]])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); if (Main.treeMntBG[1] == 172) this.bgTop -= 130; if (Main.treeMntBG[1] == 177) this.bgTop -= 200; if (Main.treeMntBG[1] >= 180 && Main.treeMntBG[1] <= 183) this.bgTop += 350; } Main.backColor = Main.trueBackColor; Main.backColor.R = (byte) ((double) Main.backColor.R * (double) Main.bgAlpha2[1]); Main.backColor.G = (byte) ((double) Main.backColor.G * (double) Main.bgAlpha2[1]); Main.backColor.B = (byte) ((double) Main.backColor.B * (double) Main.bgAlpha2[1]); Main.backColor.A = (byte) ((double) Main.backColor.A * (double) Main.bgAlpha2[1]); if ((double) Main.bgAlpha2[1] > 0.0) { this.LoadBackground(22); for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(Main.backgroundTexture[22], new Vector2((float) (this.bgStart + Main.bgW * index), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[22], Main.backgroundHeight[22])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } Main.backColor = Main.trueBackColor; Main.backColor.R = (byte) ((double) Main.backColor.R * (double) Main.bgAlpha2[2]); Main.backColor.G = (byte) ((double) Main.backColor.G * (double) Main.bgAlpha2[2]); Main.backColor.B = (byte) ((double) Main.backColor.B * (double) Main.bgAlpha2[2]); Main.backColor.A = (byte) ((double) Main.backColor.A * (double) Main.bgAlpha2[2]); if ((double) Main.bgAlpha2[2] > 0.0) { this.LoadBackground(25); for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(Main.backgroundTexture[25], new Vector2((float) (this.bgStart + Main.bgW * index), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[25], Main.backgroundHeight[25])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } Main.backColor = Main.trueBackColor; Main.backColor.R = (byte) ((double) Main.backColor.R * (double) Main.bgAlpha2[3]); Main.backColor.G = (byte) ((double) Main.backColor.G * (double) Main.bgAlpha2[3]); Main.backColor.B = (byte) ((double) Main.backColor.B * (double) Main.bgAlpha2[3]); Main.backColor.A = (byte) ((double) Main.backColor.A * (double) Main.bgAlpha2[3]); if ((double) Main.bgAlpha2[3] > 0.0) { this.LoadBackground(Main.oceanBG); for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(Main.backgroundTexture[Main.oceanBG], new Vector2((float) (this.bgStart + Main.bgW * index), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.oceanBG], Main.backgroundHeight[Main.oceanBG])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } Main.backColor = Main.trueBackColor; Main.backColor.R = (byte) ((double) Main.backColor.R * (double) Main.bgAlpha2[4]); Main.backColor.G = (byte) ((double) Main.backColor.G * (double) Main.bgAlpha2[4]); Main.backColor.B = (byte) ((double) Main.backColor.B * (double) Main.bgAlpha2[4]); Main.backColor.A = (byte) ((double) Main.backColor.A * (double) Main.bgAlpha2[4]); if ((double) Main.bgAlpha2[4] > 0.0) { this.LoadBackground(Main.snowMntBG[1]); for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(Main.backgroundTexture[Main.snowMntBG[1]], new Vector2((float) (this.bgStart + Main.bgW * index), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.snowMntBG[1]], Main.backgroundHeight[Main.snowMntBG[1]])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } Main.backColor = Main.trueBackColor; Main.backColor.R = (byte) ((double) Main.backColor.R * (double) Main.bgAlpha2[5]); Main.backColor.G = (byte) ((double) Main.backColor.G * (double) Main.bgAlpha2[5]); Main.backColor.B = (byte) ((double) Main.backColor.B * (double) Main.bgAlpha2[5]); Main.backColor.A = (byte) ((double) Main.backColor.A * (double) Main.bgAlpha2[5]); if ((double) Main.bgAlpha2[5] > 0.0) { this.LoadBackground(42); for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(Main.backgroundTexture[42], new Vector2((float) (this.bgStart + Main.bgW * index), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[42], Main.backgroundHeight[42])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } } } this.cTop = (float) ((double) this.bgTop * 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.bgColor); if ((double) Main.atmo < 1.0) { 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); color.A = (byte) ((double) color.A * (double) Main.atmo); } float num12 = (float) ((double) Main.cloud[index].position.Y * ((double) Main.screenHeight / 600.0) - 100.0); float num13 = (float) (((double) Main.screenPosition.Y / 16.0 - 24.0) / Main.worldSurface); if ((double) num13 < 0.0) num13 = 0.0f; float num14; if ((double) num13 > 1.0) num14 = 1f; if (Main.gameMenu) num14 = 1f; Main.spriteBatch.Draw(Main.cloudTexture[Main.cloud[index].type], new Vector2(Main.cloud[index].position.X + (float) Main.cloudTexture[Main.cloud[index].type].Width * 0.5f, num12 + (float) Main.cloudTexture[Main.cloud[index].type].Height * 0.5f + this.cTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.cloudTexture[Main.cloud[index].type].Width, Main.cloudTexture[Main.cloud[index].type].Height)), color * num1, Main.cloud[index].rotation, new Vector2((float) Main.cloudTexture[Main.cloud[index].type].Width * 0.5f, (float) Main.cloudTexture[Main.cloud[index].type].Height * 0.5f), Main.cloud[index].scale, Main.cloud[index].spriteDir, 0.0f); } } } } if (!Main.mapFullscreen) { for (int index1 = 0; index1 < 10; ++index1) { if (Main.bgStyle == index1) { Main.bgAlpha[index1] += Main.tranSpeed; if ((double) Main.bgAlpha[index1] > 1.0) Main.bgAlpha[index1] = 1f; } else { Main.bgAlpha[index1] -= Main.tranSpeed; if ((double) Main.bgAlpha[index1] < 0.0) Main.bgAlpha[index1] = 0.0f; } if (Main.BackgroundEnabled) { Main.backColor = Main.trueBackColor; Main.backColor.R = (byte) ((double) Main.backColor.R * (double) Main.bgAlpha[index1]); Main.backColor.G = (byte) ((double) Main.backColor.G * (double) Main.bgAlpha[index1]); Main.backColor.B = (byte) ((double) Main.backColor.B * (double) Main.bgAlpha[index1]); Main.backColor.A = (byte) ((double) Main.backColor.A * (double) Main.bgAlpha[index1]); if ((double) Main.bgAlpha[index1] > 0.0 && index1 == 3) { this.LoadBackground(Main.jungleBG[0]); Main.bgScale = 1.25f; Main.bgScale *= 2f; Main.bgW = (int) ((double) Main.backgroundWidth[Main.jungleBG[0]] * (double) Main.bgScale); this.bgParallax = 0.4; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 1800.0 + 1660.0) + (int) this.scAdj; if (Main.gameMenu) this.bgTop = 320; if (Main.jungleBG[0] == 59) this.bgTop -= 200; this.bgLoops = Main.screenWidth / Main.bgW + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index2 = 0; index2 < this.bgLoops; ++index2) Main.spriteBatch.Draw(Main.backgroundTexture[Main.jungleBG[0]], new Vector2((float) (this.bgStart + Main.bgW * index2), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.jungleBG[0]], Main.backgroundHeight[Main.jungleBG[0]])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } this.LoadBackground(Main.jungleBG[1]); Main.bgScale = 1.31f; Main.bgScale *= 2f; Main.bgW = (int) ((double) Main.backgroundWidth[Main.jungleBG[1]] * (double) Main.bgScale); this.bgParallax = 0.43; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 1950.0 + 1840.0) + (int) this.scAdj; if (Main.gameMenu) { this.bgTop = 400; this.bgStart -= 80; } if (Main.jungleBG[1] == 60) this.bgTop -= 175; this.bgLoops = Main.screenWidth / Main.bgW + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index3 = 0; index3 < this.bgLoops; ++index3) Main.spriteBatch.Draw(Main.backgroundTexture[Main.jungleBG[1]], new Vector2((float) (this.bgStart + Main.bgW * index3), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.jungleBG[1]], Main.backgroundHeight[Main.jungleBG[1]])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.FlipHorizontally, 0.0f); } Main.bgScale = 1.34f; Main.bgScale *= 2f; this.LoadBackground(Main.jungleBG[2]); Main.bgW = (int) ((double) Main.backgroundWidth[Main.jungleBG[2]] * (double) Main.bgScale); this.bgParallax = 0.49; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 2100.0 + 2060.0) + (int) this.scAdj; if (Main.gameMenu) { this.bgTop = 480; this.bgStart -= 120; } if (Main.jungleBG[2] == 61) this.bgTop -= 150; this.bgLoops = Main.screenWidth / Main.bgW + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index4 = 0; index4 < this.bgLoops; ++index4) Main.spriteBatch.Draw(Main.backgroundTexture[Main.jungleBG[2]], new Vector2((float) (this.bgStart + Main.bgW * index4), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.jungleBG[2]], Main.backgroundHeight[Main.jungleBG[2]])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } } if ((double) Main.bgAlpha[index1] > 0.0 && index1 == 2) { this.LoadBackground(Main.desertBG[0]); Main.bgScale = 1.25f; Main.bgScale *= 2f; Main.bgW = (int) ((double) Main.backgroundWidth[Main.desertBG[0]] * (double) Main.bgScale); this.bgParallax = 0.37; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 1800.0 + 1750.0) + (int) this.scAdj; if (Main.gameMenu) this.bgTop = 320; this.bgLoops = Main.screenWidth / Main.bgW + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index5 = 0; index5 < this.bgLoops; ++index5) Main.spriteBatch.Draw(Main.backgroundTexture[Main.desertBG[0]], new Vector2((float) (this.bgStart + Main.bgW * index5), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.desertBG[0]], Main.backgroundHeight[Main.desertBG[0]])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } Main.bgScale = 1.34f; Main.bgScale *= 2f; this.LoadBackground(Main.desertBG[1]); Main.bgW = (int) ((double) Main.backgroundWidth[Main.desertBG[1]] * (double) Main.bgScale); this.bgParallax = 0.49; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 2100.0 + 2150.0) + (int) this.scAdj; if (Main.gameMenu) { this.bgTop = 480; this.bgStart -= 120; } this.bgLoops = Main.screenWidth / Main.bgW + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index6 = 0; index6 < this.bgLoops; ++index6) Main.spriteBatch.Draw(Main.backgroundTexture[Main.desertBG[1]], new Vector2((float) (this.bgStart + Main.bgW * index6), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.desertBG[1]], Main.backgroundHeight[Main.desertBG[1]])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } } if ((double) Main.bgAlpha[index1] > 0.0 && index1 == 5) { this.LoadBackground(26); Main.bgScale = 1.25f; Main.bgScale *= 2f; Main.bgW = (int) ((double) Main.backgroundWidth[26] * (double) Main.bgScale); this.bgParallax = 0.37; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 1800.0 + 1750.0) + (int) this.scAdj; if (Main.gameMenu) this.bgTop = 320; this.bgLoops = Main.screenWidth / Main.bgW + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index7 = 0; index7 < this.bgLoops; ++index7) Main.spriteBatch.Draw(Main.backgroundTexture[26], new Vector2((float) (this.bgStart + Main.bgW * index7), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[26], Main.backgroundHeight[26])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } Main.bgScale = 1.34f; Main.bgScale *= 2f; this.LoadBackground(27); Main.bgW = (int) ((double) Main.backgroundWidth[27] * (double) Main.bgScale); this.bgParallax = 0.49; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 2100.0 + 2150.0) + (int) this.scAdj; if (Main.gameMenu) { this.bgTop = 480; this.bgStart -= 120; } this.bgLoops = Main.screenWidth / Main.bgW + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index8 = 0; index8 < this.bgLoops; ++index8) Main.spriteBatch.Draw(Main.backgroundTexture[27], new Vector2((float) (this.bgStart + Main.bgW * index8), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[27], Main.backgroundHeight[27])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } } if ((double) Main.bgAlpha[index1] > 0.0 && index1 == 1) { Main.bgScale = 1.25f; Main.bgScale *= 2f; this.LoadBackground(Main.corruptBG[0]); Main.bgW = (int) ((double) Main.backgroundWidth[Main.corruptBG[0]] * (double) Main.bgScale); this.bgParallax = 0.4; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 1800.0 + 1500.0) + (int) this.scAdj; if (Main.gameMenu) this.bgTop = 320; if (Main.corruptBG[0] == 56) this.bgTop -= 100; this.bgLoops = Main.screenWidth / Main.bgW + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index9 = 0; index9 < this.bgLoops; ++index9) Main.spriteBatch.Draw(Main.backgroundTexture[Main.corruptBG[0]], new Vector2((float) (this.bgStart + Main.bgW * index9), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.corruptBG[0]], Main.backgroundHeight[Main.corruptBG[0]])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } Main.bgScale = 1.31f; Main.bgScale *= 2f; this.LoadBackground(Main.corruptBG[1]); Main.bgW = (int) ((double) Main.backgroundWidth[Main.corruptBG[1]] * (double) Main.bgScale); this.bgParallax = 0.43; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 1950.0 + 1750.0) + (int) this.scAdj; if (Main.gameMenu) { this.bgTop = 400; this.bgStart -= 80; } if (Main.corruptBG[0] == 56) this.bgTop -= 100; if (Main.bgW == 0) Main.bgW = 1; this.bgLoops = Main.screenWidth / Main.bgW + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { try { for (int index10 = 0; index10 < this.bgLoops; ++index10) Main.spriteBatch.Draw(Main.backgroundTexture[Main.corruptBG[1]], new Vector2((float) (this.bgStart + Main.bgW * index10), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.corruptBG[1]], Main.backgroundHeight[Main.corruptBG[1]])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.FlipHorizontally, 0.0f); } catch { this.LoadBackground(Main.corruptBG[1]); } } Main.bgScale = 1.34f; Main.bgScale *= 2f; this.LoadBackground(Main.corruptBG[2]); Main.bgW = (int) ((double) Main.backgroundWidth[Main.corruptBG[2]] * (double) Main.bgScale); if (Main.bgW == 0) Main.bgW = 150; this.bgParallax = 0.49; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 2100.0 + 2000.0) + (int) this.scAdj; if (Main.gameMenu) { this.bgTop = 480; this.bgStart -= 120; } if (Main.corruptBG[0] == 56) this.bgTop -= 100; this.bgLoops = Main.screenWidth / Main.bgW + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index11 = 0; index11 < this.bgLoops; ++index11) Main.spriteBatch.Draw(Main.backgroundTexture[Main.corruptBG[2]], new Vector2((float) (this.bgStart + Main.bgW * index11), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.corruptBG[2]], Main.backgroundHeight[Main.corruptBG[2]])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } } if ((double) Main.bgAlpha[index1] > 0.0 && index1 == 6) { Main.bgScale = 1.25f; Main.bgScale *= 2f; this.LoadBackground(Main.hallowBG[0]); Main.bgW = (int) ((double) Main.backgroundWidth[Main.hallowBG[0]] * (double) Main.bgScale); this.bgParallax = 0.4; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1.2f / (float) this.bgParallax); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 1800.0 + 1500.0) + (int) this.scAdj; if (Main.gameMenu) this.bgTop = 320; this.bgLoops = Main.screenWidth / Main.bgW + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index12 = 0; index12 < this.bgLoops; ++index12) Main.spriteBatch.Draw(Main.backgroundTexture[Main.hallowBG[0]], new Vector2((float) (this.bgStart + Main.bgW * index12), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.hallowBG[0]], Main.backgroundHeight[Main.hallowBG[0]])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } Main.bgScale = 1.31f; Main.bgScale *= 2f; this.LoadBackground(Main.hallowBG[1]); Main.bgW = (int) ((double) Main.backgroundWidth[Main.hallowBG[1]] * (double) Main.bgScale); this.bgParallax = 0.43; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 1950.0 + 1750.0) + (int) this.scAdj; if (Main.gameMenu) { this.bgTop = 400; this.bgStart -= 80; } this.bgLoops = Main.screenWidth / Main.bgW + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index13 = 0; index13 < this.bgLoops; ++index13) Main.spriteBatch.Draw(Main.backgroundTexture[Main.hallowBG[1]], new Vector2((float) (this.bgStart + Main.bgW * index13), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.hallowBG[1]], Main.backgroundHeight[Main.hallowBG[1]])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } Main.bgScale = 1.34f; Main.bgScale *= 2f; this.LoadBackground(Main.hallowBG[2]); Main.bgW = (int) ((double) Main.backgroundWidth[Main.hallowBG[2]] * (double) Main.bgScale); this.bgParallax = 0.49; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 2100.0 + 2000.0) + (int) this.scAdj; if (Main.gameMenu) { this.bgTop = 480; this.bgStart -= 120; } this.bgLoops = Main.screenWidth / Main.bgW + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index14 = 0; index14 < this.bgLoops; ++index14) Main.spriteBatch.Draw(Main.backgroundTexture[Main.hallowBG[2]], new Vector2((float) (this.bgStart + Main.bgW * index14), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.hallowBG[2]], Main.backgroundHeight[Main.hallowBG[2]])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } } if ((double) Main.bgAlpha[index1] > 0.0 && index1 == 0) { Main.bgScale = 1.25f; Main.bgScale *= 2f; this.bgParallax = 0.4; if (Main.treeBG[0] == 91) { this.bgParallax = 0.270000010728836; Main.bgScale = 1.2f; Main.bgScale *= 2f; } if (Main.treeBG[0] == 173) { this.bgParallax = 0.25; Main.bgScale = 1.3f; Main.bgScale *= 2f; } if (Main.treeBG[0] == 178) { this.bgParallax = 0.300000011920929; Main.bgScale = 1.2f; Main.bgScale *= 2f; } if (Main.treeBG[0] == 184) { this.bgParallax = 0.25; Main.bgScale = 1.2f; Main.bgScale *= 2f; } SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); if (Main.treeBG[0] >= 0) { this.LoadBackground(Main.treeBG[0]); Main.bgW = (int) ((double) Main.backgroundWidth[Main.treeBG[0]] * (double) Main.bgScale); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 1800.0 + 1500.0) + (int) this.scAdj; if (Main.treeBG[0] == 91) this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 1600.0 + 1400.0) + (int) this.scAdj; if (Main.treeBG[0] == 173) this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 1600.0 + 1400.0) + (int) this.scAdj; if (Main.treeBG[0] == 184) this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 1600.0 + 1400.0) + (int) this.scAdj; if (Main.gameMenu) this.bgTop = 320; if (Main.treeBG[0] == 50) this.bgTop -= 50; if (Main.treeBG[0] == 53) this.bgTop -= 100; if (Main.treeBG[0] == 91) this.bgTop += 200; if (Main.treeBG[0] == 173) this.bgTop += 200; if (Main.treeBG[0] == 178) this.bgTop += 75; this.bgLoops = Main.screenWidth / Main.bgW + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index15 = 0; index15 < this.bgLoops; ++index15) { if (Main.backgroundTexture[Main.treeBG[0]] != null) Main.spriteBatch.Draw(Main.backgroundTexture[Main.treeBG[0]], new Vector2((float) (this.bgStart + Main.bgW * index15), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.treeBG[0]], Main.backgroundHeight[Main.treeBG[0]])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } } } if (Main.treeBG[1] >= 0) { this.LoadBackground(Main.treeBG[1]); Main.bgScale = 1.31f; Main.bgScale *= 2f; Main.bgW = (int) ((double) Main.backgroundWidth[Main.treeBG[1]] * (double) Main.bgScale); this.bgParallax = 0.43; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 1950.0 + 1750.0) + (int) this.scAdj; if (Main.gameMenu) { this.bgTop = 400; this.bgStart -= 80; } if (Main.treeBG[1] == 51) this.bgTop -= 50; if (Main.treeBG[1] == 54) this.bgTop -= 100; this.bgLoops = Main.screenWidth / Main.bgW + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index16 = 0; index16 < this.bgLoops; ++index16) Main.spriteBatch.Draw(Main.backgroundTexture[Main.treeBG[1]], new Vector2((float) (this.bgStart + Main.bgW * index16), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.treeBG[1]], Main.backgroundHeight[Main.treeBG[1]])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.FlipHorizontally, 0.0f); } } if (Main.treeBG[2] >= 0) { this.LoadBackground(Main.treeBG[2]); Main.bgScale = 1.34f; Main.bgScale *= 2f; this.bgParallax = 0.49; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); if (Main.treeBG[0] == 91) { Main.bgScale = 1.3f; Main.bgScale *= 2f; this.bgParallax = 0.42; } Main.bgW = (int) ((double) Main.backgroundWidth[Main.treeBG[2]] * (double) Main.bgScale); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 2100.0 + 2000.0) + (int) this.scAdj; if (Main.gameMenu) { this.bgTop = 480; this.bgStart -= 120; } if (Main.treeBG[2] == 52) this.bgTop -= 50; if (Main.treeBG[2] == 55) this.bgTop -= 100; if (Main.treeBG[2] == 92) this.bgTop += 150; this.bgLoops = Main.screenWidth / Main.bgW + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index17 = 0; index17 < this.bgLoops; ++index17) Main.spriteBatch.Draw(Main.backgroundTexture[Main.treeBG[2]], new Vector2((float) (this.bgStart + Main.bgW * index17), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.treeBG[2]], Main.backgroundHeight[Main.treeBG[2]])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } } } if ((double) Main.bgAlpha[index1] > 0.0 && index1 == 7) { if (Main.snowBG[0] >= 0) { Main.bgScale = 1.25f; Main.bgScale *= 2f; this.LoadBackground(Main.snowBG[0]); Main.bgW = (int) ((double) Main.backgroundWidth[Main.snowBG[0]] * (double) Main.bgScale); this.bgParallax = 0.4; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 1800.0 + 1500.0) + (int) this.scAdj; if (Main.gameMenu) this.bgTop = 320; this.bgLoops = Main.screenWidth / Main.bgW + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index18 = 0; index18 < this.bgLoops; ++index18) Main.spriteBatch.Draw(Main.backgroundTexture[Main.snowBG[0]], new Vector2((float) (this.bgStart + Main.bgW * index18), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.snowBG[0]], Main.backgroundHeight[Main.snowBG[0]])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } } if (Main.snowBG[1] >= 0) { Main.bgScale = 1.31f; Main.bgScale *= 2f; this.LoadBackground(Main.snowBG[1]); Main.bgW = (int) ((double) Main.backgroundWidth[Main.snowBG[1]] * (double) Main.bgScale); this.bgParallax = 0.43; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 1950.0 + 1750.0) + (int) this.scAdj; if (Main.gameMenu) { this.bgTop = 400; this.bgStart -= 80; } this.bgLoops = Main.screenWidth / Main.bgW + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index19 = 0; index19 < this.bgLoops; ++index19) Main.spriteBatch.Draw(Main.backgroundTexture[Main.snowBG[1]], new Vector2((float) (this.bgStart + Main.bgW * index19), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.snowBG[1]], Main.backgroundHeight[Main.snowBG[1]])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } } if (Main.snowBG[2] >= 0) { Main.bgScale = 1.34f; Main.bgScale *= 2f; this.LoadBackground(Main.snowBG[2]); Main.bgW = (int) ((double) Main.backgroundWidth[Main.snowBG[2]] * (double) Main.bgScale); this.bgParallax = 0.49; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 2100.0 + 2000.0) + (int) this.scAdj; if (Main.gameMenu) { this.bgTop = 480; this.bgStart -= 120; } this.bgLoops = Main.screenWidth / Main.bgW + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index20 = 0; index20 < this.bgLoops; ++index20) Main.spriteBatch.Draw(Main.backgroundTexture[Main.snowBG[2]], new Vector2((float) (this.bgStart + Main.bgW * index20), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.snowBG[2]], Main.backgroundHeight[Main.snowBG[2]])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } } } if ((double) Main.bgAlpha[index1] > 0.0 && index1 == 8) { Main.bgScale = 1.25f; Main.bgScale *= 2f; this.LoadBackground(Main.crimsonBG[0]); Main.bgW = (int) ((double) Main.backgroundWidth[Main.crimsonBG[0]] * (double) Main.bgScale); this.bgParallax = 0.4; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 1800.0 + 1500.0) + (int) this.scAdj; if (Main.crimsonBG[0] == 105) this.bgTop += 50; if (Main.crimsonBG[0] == 174) this.bgTop -= 350; if (Main.gameMenu) this.bgTop = 320; this.bgLoops = Main.screenWidth / Main.bgW + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index21 = 0; index21 < this.bgLoops; ++index21) Main.spriteBatch.Draw(Main.backgroundTexture[Main.crimsonBG[0]], new Vector2((float) (this.bgStart + Main.bgW * index21), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.crimsonBG[0]], Main.backgroundHeight[Main.crimsonBG[0]])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } Main.bgScale = 1.31f; Main.bgScale *= 2f; if (Main.crimsonBG[1] > -1) { this.LoadBackground(Main.crimsonBG[1]); Main.bgW = (int) ((double) Main.backgroundWidth[Main.crimsonBG[1]] * (double) Main.bgScale); this.bgParallax = 0.43; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 1950.0 + 1750.0) + (int) this.scAdj; if (Main.gameMenu) { this.bgTop = 400; this.bgStart -= 80; } this.bgLoops = Main.screenWidth / Main.bgW + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index22 = 0; index22 < this.bgLoops; ++index22) Main.spriteBatch.Draw(Main.backgroundTexture[Main.crimsonBG[1]], new Vector2((float) (this.bgStart + Main.bgW * index22), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.crimsonBG[1]], Main.backgroundHeight[Main.crimsonBG[1]])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } } Main.bgScale = 1.34f; Main.bgScale *= 2f; this.LoadBackground(Main.crimsonBG[2]); Main.bgW = (int) ((double) Main.backgroundWidth[Main.crimsonBG[2]] * (double) Main.bgScale); this.bgParallax = 0.49; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 2100.0 + 2000.0) + (int) this.scAdj; if (Main.gameMenu) { this.bgTop = 480; this.bgStart -= 120; } if (Main.crimsonBG[2] == 175) { this.bgStart -= 1000; this.bgTop -= 400; } this.bgLoops = Main.screenWidth / Main.bgW + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index23 = 0; index23 < this.bgLoops; ++index23) Main.spriteBatch.Draw(Main.backgroundTexture[Main.crimsonBG[2]], new Vector2((float) (this.bgStart + Main.bgW * index23), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[Main.crimsonBG[2]], Main.backgroundHeight[Main.crimsonBG[2]])), Main.backColor, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } } if ((double) Main.bgAlpha[index1] > 0.0 && index1 == 9) { float num15 = (float) Main.backColor.A / (float) byte.MaxValue; Microsoft.Xna.Framework.Color backColor1 = Main.backColor; float num16 = (float) Main.rand.Next(28, 42) * (1f / 1000f) + (float) (270 - (int) Main.mouseTextColor) / 5000f; float num17 = 0.1f; float num18 = (float) (0.150000005960464 + (double) num16 / 2.0); float num19 = 0.3f + num16; float num20 = num17 * (float) byte.MaxValue; float num21 = num18 * (float) byte.MaxValue; float num22 = num19 * (float) byte.MaxValue; float num23 = num20 * (0.33f * num15); float num24 = num21 * (0.33f * num15); float num25 = num22 * (0.33f * num15); if ((double) num23 > (double) byte.MaxValue) num23 = (float) byte.MaxValue; if ((double) num24 > (double) byte.MaxValue) num24 = (float) byte.MaxValue; if ((double) num25 > (double) byte.MaxValue) num25 = (float) byte.MaxValue; if ((double) num23 > (double) backColor1.R) backColor1.R = (byte) num23; if ((double) num24 > (double) backColor1.G) backColor1.G = (byte) num24; if ((double) num25 > (double) backColor1.B) backColor1.B = (byte) num25; Main.bgScale = 1.25f; Main.bgScale *= 2f; this.LoadBackground(46); Main.bgW = (int) ((double) Main.backgroundWidth[46] * (double) Main.bgScale); this.bgParallax = 0.4; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 1800.0 + 1400.0) + (int) this.scAdj; if (Main.gameMenu) this.bgTop = 320; this.bgLoops = Main.screenWidth / Main.bgW + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index24 = 0; index24 < this.bgLoops; ++index24) Main.spriteBatch.Draw(Main.backgroundTexture[46], new Vector2((float) (this.bgStart + Main.bgW * index24), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[46], Main.backgroundHeight[46])), backColor1, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } Microsoft.Xna.Framework.Color backColor2 = Main.backColor; float num26 = (float) Main.rand.Next(28, 42) * (1f / 1000f) + (float) (270 - (int) Main.mouseTextColor) / 5000f; float num27 = 0.1f; float num28 = (float) (0.174999997019768 + (double) num26 / 2.0); float num29 = 0.3f + num26; float num30 = num27 * (float) byte.MaxValue; float num31 = num28 * (float) byte.MaxValue; float num32 = num29 * (float) byte.MaxValue; float num33 = num30 * (0.5f * num15); float num34 = num31 * (0.5f * num15); float num35 = num32 * (0.5f * num15); if ((double) num33 > (double) byte.MaxValue) num33 = (float) byte.MaxValue; if ((double) num34 > (double) byte.MaxValue) num34 = (float) byte.MaxValue; if ((double) num35 > (double) byte.MaxValue) num35 = (float) byte.MaxValue; if ((double) num33 > (double) backColor2.R) backColor2.R = (byte) num33; if ((double) num34 > (double) backColor2.G) backColor2.G = (byte) num34; if ((double) num35 > (double) backColor2.B) backColor2.B = (byte) num35; Main.bgScale = 1.32f; Main.bgScale *= 2f; this.LoadBackground(47); Main.bgW = (int) ((double) Main.backgroundWidth[47] * (double) Main.bgScale); this.bgParallax = 0.43; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 1950.0 + 1675.0) + (int) this.scAdj; if (Main.gameMenu) { this.bgTop = 400; this.bgStart -= 80; } this.bgLoops = Main.screenWidth / Main.bgW + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index25 = 0; index25 < this.bgLoops; ++index25) Main.spriteBatch.Draw(Main.backgroundTexture[47], new Vector2((float) (this.bgStart + Main.bgW * index25), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[47], Main.backgroundHeight[47])), backColor2, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } Microsoft.Xna.Framework.Color backColor3 = Main.backColor; float num36 = (float) Main.rand.Next(28, 42) * (1f / 1000f) + (float) (270 - (int) Main.mouseTextColor) / 3000f; float num37 = 0.125f; float num38 = (float) (0.200000002980232 + (double) num36 / 2.0); float num39 = 0.3f + num36; float num40 = num37 * (float) ((double) byte.MaxValue * (double) num15 * 0.75); float num41 = num38 * (float) ((double) byte.MaxValue * (double) num15 * 0.75); float num42 = num39 * (float) ((double) byte.MaxValue * (double) num15 * 0.75); if ((double) num40 > (double) byte.MaxValue) num40 = (float) byte.MaxValue; if ((double) num41 > (double) byte.MaxValue) num41 = (float) byte.MaxValue; if ((double) num42 > (double) byte.MaxValue) num42 = (float) byte.MaxValue; if ((double) num40 > (double) backColor3.R) backColor3.R = (byte) num40; if ((double) num41 > (double) backColor3.G) backColor3.G = (byte) num41; if ((double) num42 > (double) backColor3.B) backColor3.B = (byte) num42; Main.bgScale = 1.36f; Main.bgScale *= 2f; this.LoadBackground(48); Main.bgW = (int) ((double) Main.backgroundWidth[48] * (double) Main.bgScale); this.bgParallax = 0.49; SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f / (float) this.bgParallax); this.bgStart = (int) (-Math.IEEERemainder((double) Main.screenPosition.X * this.bgParallax, (double) Main.bgW) - (double) (Main.bgW / 2)); this.bgTop = (int) ((-(double) Main.screenPosition.Y + (double) this.screenOff / 2.0) / (Main.worldSurface * 16.0) * 2100.0 + 1950.0) + (int) this.scAdj; if (Main.gameMenu) { this.bgTop = 480; this.bgStart -= 120; } this.bgLoops = Main.screenWidth / Main.bgW + 2; if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int index26 = 0; index26 < this.bgLoops; ++index26) Main.spriteBatch.Draw(Main.backgroundTexture[48], new Vector2((float) (this.bgStart + Main.bgW * index26), (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.backgroundWidth[48], Main.backgroundHeight[48])), backColor3, 0.0f, new Vector2(), Main.bgScale, SpriteEffects.None, 0.0f); } SkyManager.Instance.DrawToDepth(Main.spriteBatch, 1f); } } } } if (!Main.mapFullscreen && (double) Main.cloudAlpha > 0.0 && (double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { this.bgParallax = 0.1; this.bgStart = (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.bgTop = (int) (-(double) Main.screenPosition.Y / (Main.worldSurface * 16.0 - 600.0) * 200.0); for (int index = 0; index < this.bgLoops; ++index) { Microsoft.Xna.Framework.Color bgColor = Main.bgColor; this.bgStart = 0; float cloudAlpha = Main.cloudAlpha; bgColor.R = (byte) ((double) bgColor.R * (double) cloudAlpha); bgColor.G = (byte) ((double) bgColor.G * (double) cloudAlpha); bgColor.B = (byte) ((double) bgColor.B * (double) cloudAlpha); bgColor.A = (byte) ((double) bgColor.A * (double) cloudAlpha); Main.spriteBatch.Draw(Main.backgroundTexture[49], new Microsoft.Xna.Framework.Rectangle(this.bgStart + Main.backgroundWidth[49] * index, this.bgTop, Main.backgroundWidth[49], Math.Max(Main.screenHeight, Main.backgroundHeight[49])), bgColor); } } if (Main.mapFullscreen) return; SkyManager.Instance.DrawRemainingDepth(Main.spriteBatch); } 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(Main.blackTileTexture, new Microsoft.Xna.Framework.Rectangle(0, (int) num3, Main.screenWidth, (int) ((double) num4 - (double) num3)), Microsoft.Xna.Framework.Color.Black); } private void DrawTileCracks(int crackType) { Vector2 vector2 = new Vector2((float) Main.offScreenRange, (float) Main.offScreenRange); if (Main.drawToScreen) vector2 = Vector2.Zero; for (int index = 0; index < Main.player[Main.myPlayer].hitTile.data.Length; ++index) { if (Main.player[Main.myPlayer].hitTile.data[index].type == crackType) { int damage = Main.player[Main.myPlayer].hitTile.data[index].damage; if (damage >= 20) { int x = Main.player[Main.myPlayer].hitTile.data[index].X; int y = Main.player[Main.myPlayer].hitTile.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 > (byte) 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 (Main.tile[x, y].type == (ushort) 5) { 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(Main.player[Main.myPlayer].hitTile.data[index].crackStyle * 18, num * 18, 16, 16); if (flag3) rectangle.X = (4 + Main.player[Main.myPlayer].hitTile.data[index].crackStyle / 2) * 18; Main.spriteBatch.Draw(Main.tileCrackTexture, 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.monolithType) { if (!Filters.Scene[Main.MonolithFilterNames[Main.monolithType]].IsActive()) Filters.Scene.Activate(Main.MonolithFilterNames[Main.monolithType], new Vector2()); if (!SkyManager.Instance[Main.MonolithSkyNames[index]].IsActive()) SkyManager.Instance.Activate(Main.MonolithSkyNames[index], new Vector2()); } else { if (Filters.Scene[Main.MonolithFilterNames[index]].IsActive()) 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); this._isDrawingOrUpdating = false; } private void DoDraw(GameTime gameTime) { 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(); CaptureManager.Instance.DrawTick(); TimeLogger.NewDrawFrame(); if (!Main.gameMenu) this.lookForColorTiles(); 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(); Stopwatch stopwatch1 = new Stopwatch(); stopwatch1.Start(); ++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; if (false) { num = 30; } else { switch (Main.stackDelay) { case 3: num = 10; break; case 4: num = 15; break; case 5: num = 20; break; case 6: num = 25; 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(); Vector3 vector3 = Vector3.One / new Vector3(1f, 1f, 1f); if (!Main.gameMenu && Main.netMode != 2) { 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; float num2 = 0.0f; float num3 = 0.0f; float num4 = 24f; if (Main.player[Main.myPlayer].noThrow <= 0 && !Main.player[Main.myPlayer].lastMouseInterface || (double) Main.zoomX != 0.0 || (double) Main.zoomY != 0.0) { if (PlayerInput.UsingGamepad) { Player player = Main.player[Main.myPlayer]; if ((double) PlayerInput.GamepadThumbstickRight.Length() != 0.0 || !Main.SmartCursorEnabled) { float num5 = -1f; if (player.inventory[player.selectedItem].type == 1254 && player.scope) num5 = 0.8f; else if (player.inventory[player.selectedItem].type == 1254) num5 = 0.6666667f; else if (player.inventory[player.selectedItem].type == 1299) num5 = 0.6666667f; else if (player.scope) num5 = 0.5f; Vector2 vector2_1 = (Main.MouseScreen - new Vector2((float) Main.screenWidth, (float) Main.screenHeight) / 2f) / (new Vector2((float) Main.screenWidth, (float) Main.screenHeight) / 2f); num4 = 48f; if (vector2_1 != Vector2.Zero && (double) num5 != -1.0) { Vector2 vector2_2 = new Vector2((float) Main.screenWidth, (float) Main.screenHeight) * 0.5f * vector2_1 * num5; num2 = vector2_2.X; num3 = vector2_2.Y; } } } else if (Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type == 1254 && Main.player[Main.myPlayer].scope && Main.mouseRight) { int num6 = Main.mouseX; int num7 = Main.mouseY; if (num6 > Main.screenWidth) num6 = Main.screenWidth; if (num6 < 0) num6 = 0; if (num7 > Main.screenHeight) num7 = Main.screenHeight; if (num7 < 0) num7 = 0; num2 = (float) (num6 - Main.screenWidth / 2) / 1.25f; num3 = (float) (num7 - Main.screenHeight / 2) / 1.25f; } else if (Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type == 1254 && Main.mouseRight) { int num8 = Main.mouseX; int num9 = Main.mouseY; if (num8 > Main.screenWidth) num8 = Main.screenWidth; if (num8 < 0) num8 = 0; if (num9 > Main.screenHeight) num9 = Main.screenHeight; if (num9 < 0) num9 = 0; num2 = (float) (num8 - Main.screenWidth / 2) / 1.5f; num3 = (float) (num9 - Main.screenHeight / 2) / 1.5f; } else if (Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type == 1299 && Main.player[Main.myPlayer].selectedItem != 58) { int num10 = Main.mouseX; int num11 = Main.mouseY; if (num10 > Main.screenWidth) num10 = Main.screenWidth; if (num10 < 0) num10 = 0; if (num11 > Main.screenHeight) num11 = Main.screenHeight; if (num11 < 0) num11 = 0; num2 = (float) (num10 - Main.screenWidth / 2) / 1.5f; num3 = (float) (num11 - Main.screenHeight / 2) / 1.5f; } else if (Main.player[Main.myPlayer].scope && Main.mouseRight) { int num12 = Main.mouseX; int num13 = Main.mouseY; if (num12 > Main.screenWidth) num12 = Main.screenWidth; if (num12 < 0) num12 = 0; if (num13 > Main.screenHeight) num13 = Main.screenHeight; if (num13 < 0) num13 = 0; num2 = (float) (num12 - Main.screenWidth / 2) / 2f; num3 = (float) (num13 - Main.screenHeight / 2) / 2f; } } if (float.IsNaN(Main.zoomX)) Main.zoomX = 0.0f; if (float.IsNaN(Main.zoomY)) Main.zoomY = 0.0f; float num14 = num2 - Main.zoomX; float num15 = num3 - Main.zoomY; float num16 = (float) Math.Sqrt((double) num14 * (double) num14 + (double) num15 * (double) num15); float num17 = (float) Math.Sqrt((double) num14 * (double) num14 + (double) num15 * (double) num15); if ((double) num17 < (double) num4) { Main.zoomX = num2; Main.zoomY = num3; } else { float num18 = num4 / num17; float num19 = num14 * num18; float num20 = num15 * num18; Main.zoomX += num19; Main.zoomY += num20; } Main.screenPosition.X += Main.zoomX; Main.screenPosition.Y += Main.zoomY * 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; } if (!Main.gameMenu && Main.netMode != 2) Main.ClampScreenPositionToWorld(); Main.CheckMonoliths(); if (Main.showSplash) { this.DrawSplash(gameTime); TimeLogger.SplashDrawTime(stopwatch1.Elapsed.TotalMilliseconds); TimeLogger.EndDrawFrame(); } else { 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.bgStart = (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.bgTop = (int) (-(double) Main.screenPosition.Y / (Main.worldSurface * 16.0 - 600.0) * 200.0); Main.bgColor = Microsoft.Xna.Framework.Color.White; if (Main.gameMenu || Main.netMode == 2) this.bgTop = -200; int num21 = (int) (Main.time / 54000.0 * (double) (Main.screenWidth + Main.sunTexture.Width * 2)) - Main.sunTexture.Width; int num22 = 0; Microsoft.Xna.Framework.Color white1 = Microsoft.Xna.Framework.Color.White; float scale1 = 1f; float rotation1 = (float) (Main.time / 54000.0 * 2.0 - 7.30000019073486); int num23 = (int) (Main.time / 32400.0 * (double) (Main.screenWidth + Main.moonTexture[Main.moonType].Width * 2)) - Main.moonTexture[Main.moonType].Width; int num24 = 0; Microsoft.Xna.Framework.Color white2 = Microsoft.Xna.Framework.Color.White; float scale2 = 1f; float rotation2 = (float) (Main.time / 32400.0 * 2.0 - 7.30000019073486); if (Main.dayTime) { double num25; if (Main.time < 27000.0) { num25 = Math.Pow(1.0 - Main.time / 54000.0 * 2.0, 2.0); num22 = (int) ((double) this.bgTop + num25 * 250.0 + 180.0); } else { num25 = Math.Pow((Main.time / 54000.0 - 0.5) * 2.0, 2.0); num22 = (int) ((double) this.bgTop + num25 * 250.0 + 180.0); } scale1 = (float) (1.2 - num25 * 0.4); } else { double num26; if (Main.time < 16200.0) { num26 = Math.Pow(1.0 - Main.time / 32400.0 * 2.0, 2.0); num24 = (int) ((double) this.bgTop + num26 * 250.0 + 180.0); } else { num26 = Math.Pow((Main.time / 32400.0 - 0.5) * 2.0, 2.0); num24 = (int) ((double) this.bgTop + num26 * 250.0 + 180.0); } scale2 = (float) (1.2 - num26 * 0.4); } if (Main.dayTime) { if (Main.time < 13500.0) { float num27 = (float) (Main.time / 13500.0); white1.R = (byte) ((double) num27 * 200.0 + 55.0); white1.G = (byte) ((double) num27 * 180.0 + 75.0); white1.B = (byte) ((double) num27 * 250.0 + 5.0); Main.bgColor.R = (byte) ((double) num27 * 230.0 + 25.0); Main.bgColor.G = (byte) ((double) num27 * 220.0 + 35.0); Main.bgColor.B = (byte) ((double) num27 * 220.0 + 35.0); } if (Main.time > 45900.0) { float num28 = (float) (1.0 - (Main.time / 54000.0 - 0.85) * (20.0 / 3.0)); white1.R = (byte) ((double) num28 * 120.0 + 55.0); white1.G = (byte) ((double) num28 * 100.0 + 25.0); white1.B = (byte) ((double) num28 * 120.0 + 55.0); Main.bgColor.R = (byte) ((double) num28 * 200.0 + 35.0); Main.bgColor.G = (byte) ((double) num28 * 85.0 + 35.0); Main.bgColor.B = (byte) ((double) num28 * 135.0 + 35.0); } else if (Main.time > 37800.0) { float num29 = (float) (1.0 - (Main.time / 54000.0 - 0.7) * (20.0 / 3.0)); white1.R = (byte) ((double) num29 * 80.0 + 175.0); white1.G = (byte) ((double) num29 * 130.0 + 125.0); white1.B = (byte) ((double) num29 * 100.0 + 155.0); Main.bgColor.R = (byte) ((double) num29 * 20.0 + 235.0); Main.bgColor.G = (byte) ((double) num29 * 135.0 + 120.0); Main.bgColor.B = (byte) ((double) num29 * 85.0 + 170.0); } } if (!Main.dayTime) { if (Main.bloodMoon) { if (Main.time < 16200.0) { float num30 = (float) (1.0 - Main.time / 16200.0); white2.R = (byte) ((double) num30 * 10.0 + 205.0); white2.G = (byte) ((double) num30 * 170.0 + 55.0); white2.B = (byte) ((double) num30 * 200.0 + 55.0); Main.bgColor.R = (byte) (40.0 - (double) num30 * 40.0 + 35.0); Main.bgColor.G = (byte) ((double) num30 * 20.0 + 15.0); Main.bgColor.B = (byte) ((double) num30 * 20.0 + 15.0); } else if (Main.time >= 16200.0) { float num31 = (float) ((Main.time / 32400.0 - 0.5) * 2.0); white2.R = (byte) ((double) num31 * 50.0 + 205.0); white2.G = (byte) ((double) num31 * 100.0 + 155.0); white2.B = (byte) ((double) num31 * 100.0 + 155.0); white2.R = (byte) ((double) num31 * 10.0 + 205.0); white2.G = (byte) ((double) num31 * 170.0 + 55.0); white2.B = (byte) ((double) num31 * 200.0 + 55.0); Main.bgColor.R = (byte) (40.0 - (double) num31 * 40.0 + 35.0); Main.bgColor.G = (byte) ((double) num31 * 20.0 + 15.0); Main.bgColor.B = (byte) ((double) num31 * 20.0 + 15.0); } } else if (Main.time < 16200.0) { float num32 = (float) (1.0 - Main.time / 16200.0); white2.R = (byte) ((double) num32 * 10.0 + 205.0); white2.G = (byte) ((double) num32 * 70.0 + 155.0); white2.B = (byte) ((double) num32 * 100.0 + 155.0); Main.bgColor.R = (byte) ((double) num32 * 30.0 + 5.0); Main.bgColor.G = (byte) ((double) num32 * 30.0 + 5.0); Main.bgColor.B = (byte) ((double) num32 * 30.0 + 5.0); } else if (Main.time >= 16200.0) { float num33 = (float) ((Main.time / 32400.0 - 0.5) * 2.0); white2.R = (byte) ((double) num33 * 50.0 + 205.0); white2.G = (byte) ((double) num33 * 100.0 + 155.0); white2.B = (byte) ((double) num33 * 100.0 + 155.0); Main.bgColor.R = (byte) ((double) num33 * 20.0 + 5.0); Main.bgColor.G = (byte) ((double) num33 * 30.0 + 5.0); Main.bgColor.B = (byte) ((double) num33 * 30.0 + 5.0); } } float num34 = 0.0005f * (float) Main.dayRate; if (Main.gameMenu) num34 *= 20f; if (Main.raining) { if ((double) Main.cloudAlpha > (double) Main.maxRaining) { Main.cloudAlpha -= num34; if ((double) Main.cloudAlpha < (double) Main.maxRaining) Main.cloudAlpha = Main.maxRaining; } else if ((double) Main.cloudAlpha < (double) Main.maxRaining) { Main.cloudAlpha += num34; if ((double) Main.cloudAlpha > (double) Main.maxRaining) Main.cloudAlpha = Main.maxRaining; } } else { Main.cloudAlpha -= num34; if ((double) Main.cloudAlpha < 0.0) Main.cloudAlpha = 0.0f; } if ((double) Main.cloudAlpha > 0.0) { float num35 = (float) (1.0 - (double) Main.cloudAlpha * 0.899999976158142); Main.bgColor.R = (byte) ((double) Main.bgColor.R * (double) num35); Main.bgColor.G = (byte) ((double) Main.bgColor.G * (double) num35); Main.bgColor.B = (byte) ((double) Main.bgColor.B * (double) num35); } if (Main.gameMenu || Main.netMode == 2) { this.bgTop = 0; if (!Main.dayTime) { Main.bgColor.R = (byte) 35; Main.bgColor.G = (byte) 35; Main.bgColor.B = (byte) 35; } } if (Main.gameMenu) { Main.bgDelay = 1000; Main.evilTiles = (int) ((double) Main.bgAlpha[1] * 500.0); } if (Main.evilTiles > 0) { float num36 = (float) Main.evilTiles / 500f; if ((double) num36 > 1.0) num36 = 1f; int r1 = (int) Main.bgColor.R; int g1 = (int) Main.bgColor.G; int b1 = (int) Main.bgColor.B; int num37 = r1 - (int) (100.0 * (double) num36 * ((double) Main.bgColor.R / (double) byte.MaxValue)); int num38 = g1 - (int) (140.0 * (double) num36 * ((double) Main.bgColor.G / (double) byte.MaxValue)); int num39 = b1 - (int) (80.0 * (double) num36 * ((double) Main.bgColor.B / (double) byte.MaxValue)); if (num37 < 15) num37 = 15; if (num38 < 15) num38 = 15; if (num39 < 15) num39 = 15; Main.bgColor.R = (byte) num37; Main.bgColor.G = (byte) num38; Main.bgColor.B = (byte) num39; int r2 = (int) white1.R; int g2 = (int) white1.G; int b2 = (int) white1.B; int num40 = r2 - (int) (100.0 * (double) num36 * ((double) white1.R / (double) byte.MaxValue)); int num41 = g2 - (int) (100.0 * (double) num36 * ((double) white1.G / (double) byte.MaxValue)); int num42 = b2 - (int) (0.0 * (double) num36 * ((double) white1.B / (double) byte.MaxValue)); if (num40 < 15) num40 = 15; if (num41 < 15) num41 = 15; if (num42 < 15) num42 = 15; white1.R = (byte) num40; white1.G = (byte) num41; white1.B = (byte) num42; int r3 = (int) white2.R; int g3 = (int) white2.G; int b3 = (int) white2.B; int num43 = r3 - (int) (140.0 * (double) num36 * ((double) white2.R / (double) byte.MaxValue)); int num44 = g3 - (int) (190.0 * (double) num36 * ((double) white2.G / (double) byte.MaxValue)); int num45 = b3 - (int) (170.0 * (double) num36 * ((double) white2.B / (double) byte.MaxValue)); if (num43 < 15) num43 = 15; if (num44 < 15) num44 = 15; if (num45 < 15) num45 = 15; white2.R = (byte) num43; white2.G = (byte) num44; white2.B = (byte) num45; } if (Main.bloodTiles > 0) { float num46 = (float) Main.bloodTiles / 400f; if ((double) num46 > 1.0) num46 = 1f; int r4 = (int) Main.bgColor.R; int g4 = (int) Main.bgColor.G; int b4 = (int) Main.bgColor.B; int num47 = r4 - (int) (70.0 * (double) num46 * ((double) Main.bgColor.G / (double) byte.MaxValue)); int num48 = g4 - (int) (110.0 * (double) num46 * ((double) Main.bgColor.G / (double) byte.MaxValue)); int num49 = b4 - (int) (150.0 * (double) num46 * ((double) Main.bgColor.B / (double) byte.MaxValue)); if (num47 < 15) num47 = 15; if (num48 < 15) num48 = 15; if (num49 < 15) num49 = 15; Main.bgColor.R = (byte) num47; Main.bgColor.G = (byte) num48; Main.bgColor.B = (byte) num49; int num50 = (int) white1.R; int g5 = (int) white1.G; int b5 = (int) white1.B; int num51 = g5 - (int) (90.0 * (double) num46 * ((double) white1.G / (double) byte.MaxValue)); int num52 = b5 - (int) (110.0 * (double) num46 * ((double) white1.B / (double) byte.MaxValue)); if (num50 < 15) num50 = 15; if (num51 < 15) num51 = 15; if (num52 < 15) num52 = 15; white1.R = (byte) num50; white1.G = (byte) num51; white1.B = (byte) num52; int r5 = (int) white2.R; int g6 = (int) white2.G; int b6 = (int) white2.B; int num53 = r5 - (int) (100.0 * (double) num46 * ((double) white2.R / (double) byte.MaxValue)); int num54 = g6 - (int) (120.0 * (double) num46 * ((double) white2.G / (double) byte.MaxValue)); int num55 = b6 - (int) (180.0 * (double) num46 * ((double) white2.B / (double) byte.MaxValue)); if (num53 < 15) num53 = 15; if (num54 < 15) num54 = 15; if (num55 < 15) num55 = 15; white2.R = (byte) num53; white2.G = (byte) num54; white2.B = (byte) num55; } if (Main.jungleTiles > 0) { float num56 = (float) Main.jungleTiles / 200f; if ((double) num56 > 1.0) num56 = 1f; int r6 = (int) Main.bgColor.R; int num57 = (int) Main.bgColor.G; int b7 = (int) Main.bgColor.B; int num58 = r6 - (int) (40.0 * (double) num56 * ((double) Main.bgColor.R / (double) byte.MaxValue)); int num59 = b7 - (int) (70.0 * (double) num56 * ((double) Main.bgColor.B / (double) byte.MaxValue)); if (num57 > (int) byte.MaxValue) num57 = (int) byte.MaxValue; if (num57 < 15) num57 = 15; if (num58 > (int) byte.MaxValue) num58 = (int) byte.MaxValue; if (num58 < 15) num58 = 15; if (num59 < 15) num59 = 15; Main.bgColor.R = (byte) num58; Main.bgColor.G = (byte) num57; Main.bgColor.B = (byte) num59; int r7 = (int) white1.R; int num60 = (int) white1.G; int b8 = (int) white1.B; int num61 = r7 - (int) (30.0 * (double) num56 * ((double) white1.R / (double) byte.MaxValue)); int num62 = b8 - (int) (10.0 * (double) num56 * ((double) white1.B / (double) byte.MaxValue)); if (num61 < 15) num61 = 15; if (num60 < 15) num60 = 15; if (num62 < 15) num62 = 15; white1.R = (byte) num61; white1.G = (byte) num60; white1.B = (byte) num62; int r8 = (int) white2.R; int g = (int) white2.G; int b9 = (int) white2.B; int num63 = g - (int) (140.0 * (double) num56 * ((double) white2.R / (double) byte.MaxValue)); int num64 = r8 - (int) (170.0 * (double) num56 * ((double) white2.G / (double) byte.MaxValue)); int num65 = b9 - (int) (190.0 * (double) num56 * ((double) white2.B / (double) byte.MaxValue)); if (num64 < 15) num64 = 15; if (num63 < 15) num63 = 15; if (num65 < 15) num65 = 15; white2.R = (byte) num64; white2.G = (byte) num63; white2.B = (byte) num65; } if (Main.shroomTiles > 0) { double num66 = (double) Main.shroomTiles / 160.0; if (num66 > (double) Main.shroomLight) Main.shroomLight += 0.01f; if (num66 < (double) Main.shroomLight) Main.shroomLight -= 0.01f; } else Main.shroomLight -= 0.02f; if ((double) Main.shroomLight < 0.0) Main.shroomLight = 0.0f; if ((double) Main.shroomLight > 1.0) Main.shroomLight = 1f; if ((double) Main.shroomLight > 0.0) { float shroomLight = Main.shroomLight; int r9 = (int) Main.bgColor.R; int g7 = (int) Main.bgColor.G; int b10 = (int) Main.bgColor.B; int num67 = g7 - (int) (250.0 * (double) shroomLight * ((double) Main.bgColor.G / (double) byte.MaxValue)); int num68 = r9 - (int) (250.0 * (double) shroomLight * ((double) Main.bgColor.R / (double) byte.MaxValue)); int num69 = b10 - (int) (250.0 * (double) shroomLight * ((double) Main.bgColor.B / (double) byte.MaxValue)); if (num67 < 15) num67 = 15; if (num68 < 15) num68 = 15; if (num69 < 15) num69 = 15; Main.bgColor.R = (byte) num68; Main.bgColor.G = (byte) num67; Main.bgColor.B = (byte) num69; int r10 = (int) white1.R; int g8 = (int) white1.G; int b11 = (int) white1.B; int num70 = g8 - (int) (10.0 * (double) shroomLight * ((double) white1.G / (double) byte.MaxValue)); int num71 = r10 - (int) (30.0 * (double) shroomLight * ((double) white1.R / (double) byte.MaxValue)); int num72 = b11 - (int) (10.0 * (double) shroomLight * ((double) white1.B / (double) byte.MaxValue)); if (num71 < 15) num71 = 15; if (num70 < 15) num70 = 15; if (num72 < 15) num72 = 15; white1.R = (byte) num71; white1.G = (byte) num70; white1.B = (byte) num72; int r11 = (int) white2.R; int g9 = (int) white2.G; int b12 = (int) white2.B; int num73 = g9 - (int) (140.0 * (double) shroomLight * ((double) white2.R / (double) byte.MaxValue)); int num74 = r11 - (int) (170.0 * (double) shroomLight * ((double) white2.G / (double) byte.MaxValue)); int num75 = b12 - (int) (190.0 * (double) shroomLight * ((double) white2.B / (double) byte.MaxValue)); if (num74 < 15) num74 = 15; if (num73 < 15) num73 = 15; if (num75 < 15) num75 = 15; white2.R = (byte) num74; white2.G = (byte) num73; white2.B = (byte) num75; } if (Lighting.NotRetro) { if (Main.bgColor.R < (byte) 10) Main.bgColor.R = (byte) 10; if (Main.bgColor.G < (byte) 10) Main.bgColor.G = (byte) 10; if (Main.bgColor.B < (byte) 10) Main.bgColor.B = (byte) 10; } else { if (Main.bgColor.R < (byte) 15) Main.bgColor.R = (byte) 15; if (Main.bgColor.G < (byte) 15) Main.bgColor.G = (byte) 15; if (Main.bgColor.B < (byte) 15) Main.bgColor.B = (byte) 15; } if (Main.bloodMoon) { if (Main.bgColor.R < (byte) 25) Main.bgColor.R = (byte) 25; if (Main.bgColor.G < (byte) 25) Main.bgColor.G = (byte) 25; if (Main.bgColor.B < (byte) 25) Main.bgColor.B = (byte) 25; } if (Main.eclipse && Main.dayTime) { float num76 = 1242f; Main.eclipseLight = (float) Main.time / num76; 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 num77 = (float) (1.0 - 0.925000011920929 * (double) Main.eclipseLight); float num78 = (float) (1.0 - 0.959999978542328 * (double) Main.eclipseLight); float num79 = (float) (1.0 - 1.0 * (double) Main.eclipseLight); int num80 = (int) ((double) Main.bgColor.R * (double) num77); int num81 = (int) ((double) Main.bgColor.G * (double) num78); int num82 = (int) ((double) Main.bgColor.B * (double) num79); Main.bgColor.R = (byte) num80; Main.bgColor.G = (byte) num81; Main.bgColor.B = (byte) num82; white1.R = byte.MaxValue; white1.G = (byte) 127; white1.B = (byte) 67; if (Main.bgColor.R < (byte) 20) Main.bgColor.R = (byte) 20; if (Main.bgColor.G < (byte) 10) Main.bgColor.G = (byte) 10; if (!Lighting.NotRetro) { if (Main.bgColor.R < (byte) 20) Main.bgColor.R = (byte) 20; if (Main.bgColor.G < (byte) 14) Main.bgColor.G = (byte) 14; if (Main.bgColor.B < (byte) 6) Main.bgColor.B = (byte) 6; } } Main.tileColor.A = byte.MaxValue; Main.tileColor.R = (byte) (((int) Main.bgColor.R + (int) Main.bgColor.G + (int) Main.bgColor.B + (int) Main.bgColor.R * 7) / 10); Main.tileColor.G = (byte) (((int) Main.bgColor.R + (int) Main.bgColor.G + (int) Main.bgColor.B + (int) Main.bgColor.G * 7) / 10); Main.tileColor.B = (byte) (((int) Main.bgColor.R + (int) Main.bgColor.G + (int) Main.bgColor.B + (int) Main.bgColor.B * 7) / 10); Main.tileColor = SkyManager.Instance.ProcessTileColor(Main.tileColor); float num83 = (float) (Main.maxTilesX / 4200); float num84 = num83 * num83; Main.atmo = (float) ((((double) Main.screenPosition.Y + (double) (Main.screenHeight / 2)) / 16.0 - (65.0 + 10.0 * (double) num84)) / (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.atmo = 1f; Main.bgColor.R = (byte) ((double) Main.bgColor.R * (double) Main.atmo); Main.bgColor.G = (byte) ((double) Main.bgColor.G * (double) Main.atmo); Main.bgColor.B = (byte) ((double) Main.bgColor.B * (double) Main.atmo); if ((double) Main.atmo <= 0.05) { Main.bgColor.R = (byte) 0; Main.bgColor.G = (byte) 0; Main.bgColor.B = (byte) 0; Main.bgColor.A = (byte) 0; } this.GraphicsDevice.Clear(Microsoft.Xna.Framework.Color.Black); base.Draw(gameTime); float val2_1 = (float) Main.screenWidth / 1920f; float val2_2 = (float) Main.screenHeight / 1200f; Main.GameViewMatrix.Effects = Main.gameMenu || (double) Main.player[Main.myPlayer].gravDir == 1.0 ? SpriteEffects.None : SpriteEffects.FlipVertically; Main.BackgroundViewMatrix.Effects = Main.GameViewMatrix.Effects; Main.ForcedMinimumZoom = Math.Max(Math.Max(1f, val2_1), val2_2); Main.BackgroundViewMatrix.Zoom = new Vector2(Main.ForcedMinimumZoom); Main.GameViewMatrix.Zoom = new Vector2(Main.ForcedMinimumZoom * MathHelper.Clamp(Main.GameZoomTarget, 1f, 2f)); this.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 && Filters.Scene.CanCapture(); if (flag) Filters.Scene.BeginCapture(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, this.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) { for (int index = 0; index < this.bgLoops; ++index) Main.spriteBatch.Draw(Main.backgroundTexture[Main.background], new Microsoft.Xna.Framework.Rectangle(this.bgStart + Main.backgroundWidth[Main.background] * index, this.bgTop, Main.backgroundWidth[Main.background], Math.Max(Main.screenHeight, Main.backgroundHeight[Main.background])), Main.bgColor); TimeLogger.DetailedDrawTime(6); } Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, this.Rasterizer, (Effect) null, Main.BackgroundViewMatrix.EffectMatrix); if ((double) Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0 && (double) byte.MaxValue * (1.0 - (double) Main.cloudAlpha) - (double) Main.bgColor.R - 25.0 > 0.0 && Main.netMode != 2) { for (int index = 0; index < Main.numStars; ++index) { Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color(); float num85 = (float) Main.evilTiles / 500f; if ((double) num85 > 1.0) num85 = 1f; float num86 = (float) (1.0 - (double) num85 * 0.5); if (Main.evilTiles <= 0) num86 = 1f; int num87 = (int) ((double) ((int) byte.MaxValue - (int) Main.bgColor.R - 100) * (double) Main.star[index].twinkle * (double) num86); int num88 = (int) ((double) ((int) byte.MaxValue - (int) Main.bgColor.G - 100) * (double) Main.star[index].twinkle * (double) num86); int num89 = (int) ((double) ((int) byte.MaxValue - (int) Main.bgColor.B - 100) * (double) Main.star[index].twinkle * (double) num86); if (num87 < 0) num87 = 0; if (num88 < 0) num88 = 0; if (num89 < 0) num89 = 0; color.R = (byte) num87; color.G = (byte) ((double) num88 * (double) num86); color.B = (byte) ((double) num89 * (double) num86); float num90 = Main.star[index].position.X * ((float) Main.screenWidth / 800f); float num91 = Main.star[index].position.Y * ((float) Main.screenHeight / 600f); Main.spriteBatch.Draw(Main.starTexture[Main.star[index].type], new Vector2(num90 + (float) Main.starTexture[Main.star[index].type].Width * 0.5f, num91 + (float) Main.starTexture[Main.star[index].type].Height * 0.5f + (float) this.bgTop), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.starTexture[Main.star[index].type].Width, Main.starTexture[Main.star[index].type].Height)), color, Main.star[index].rotation, new Vector2((float) Main.starTexture[Main.star[index].type].Width * 0.5f, (float) Main.starTexture[Main.star[index].type].Height * 0.5f), Main.star[index].scale * Main.star[index].twinkle, SpriteEffects.None, 0.0f); } } if ((double) Main.screenPosition.Y / 16.0 < Main.worldSurface + 2.0) { if (Main.dayTime) { scale1 *= 1.1f; if (Main.eclipse) { float num92 = 1f - Main.shroomLight - Main.cloudAlpha * 1.5f; if ((double) num92 < 0.0) num92 = 0.0f; Microsoft.Xna.Framework.Color color1 = new Microsoft.Xna.Framework.Color((int) (byte) ((double) byte.MaxValue * (double) num92), (int) (byte) ((double) white1.G * (double) num92), (int) (byte) ((double) white1.B * (double) num92), (int) (byte) ((double) byte.MaxValue * (double) num92)); Microsoft.Xna.Framework.Color color2 = new Microsoft.Xna.Framework.Color((int) (byte) ((double) white1.R * (double) num92), (int) (byte) ((double) white1.G * (double) num92), (int) (byte) ((double) white1.B * (double) num92), (int) (byte) ((double) ((int) white1.B - 60) * (double) num92)); Main.spriteBatch.Draw(Main.sun3Texture, new Vector2((float) num21, (float) (num22 + (int) Main.sunModY)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.sun3Texture.Width, Main.sun3Texture.Height)), color1, rotation1, new Vector2((float) (Main.sun3Texture.Width / 2), (float) (Main.sun3Texture.Height / 2)), scale1, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(Main.sun3Texture, new Vector2((float) num21, (float) (num22 + (int) Main.sunModY)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.sun3Texture.Width, Main.sun3Texture.Height)), color2, rotation1, new Vector2((float) (Main.sun3Texture.Width / 2), (float) (Main.sun3Texture.Height / 2)), scale1, SpriteEffects.None, 0.0f); } else if (!Main.gameMenu && Main.player[Main.myPlayer].head == 12) { float num93 = 1f - Main.shroomLight - Main.cloudAlpha * 1.5f; if ((double) num93 < 0.0) num93 = 0.0f; Microsoft.Xna.Framework.Color color3 = new Microsoft.Xna.Framework.Color((int) (byte) ((double) byte.MaxValue * (double) num93), (int) (byte) ((double) white1.G * (double) num93), (int) (byte) ((double) white1.B * (double) num93), (int) (byte) ((double) byte.MaxValue * (double) num93)); Microsoft.Xna.Framework.Color color4 = new Microsoft.Xna.Framework.Color((int) (byte) ((double) white1.R * (double) num93), (int) (byte) ((double) white1.G * (double) num93), (int) (byte) ((double) white1.B * (double) num93), (int) (byte) ((double) ((int) white1.B - 60) * (double) num93)); Main.spriteBatch.Draw(Main.sun2Texture, new Vector2((float) num21, (float) (num22 + (int) Main.sunModY)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.sun2Texture.Width, Main.sun2Texture.Height)), color3, rotation1, new Vector2((float) (Main.sun2Texture.Width / 2), (float) (Main.sun2Texture.Height / 2)), scale1, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(Main.sun2Texture, new Vector2((float) num21, (float) (num22 + (int) Main.sunModY)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.sun2Texture.Width, Main.sun2Texture.Height)), color4, rotation1, new Vector2((float) (Main.sun2Texture.Width / 2), (float) (Main.sun2Texture.Height / 2)), scale1, SpriteEffects.None, 0.0f); } else { float num94 = 1f - Main.shroomLight - Main.cloudAlpha * 1.5f; if ((double) num94 < 0.0) num94 = 0.0f; Microsoft.Xna.Framework.Color color5 = new Microsoft.Xna.Framework.Color((int) (byte) ((double) byte.MaxValue * (double) num94), (int) (byte) ((double) white1.G * (double) num94), (int) (byte) ((double) white1.B * (double) num94), (int) (byte) ((double) byte.MaxValue * (double) num94)); Microsoft.Xna.Framework.Color color6 = new Microsoft.Xna.Framework.Color((int) (byte) ((double) white1.R * (double) num94), (int) (byte) ((double) white1.G * (double) num94), (int) (byte) ((double) white1.B * (double) num94), (int) (byte) ((double) white1.B * (double) num94)); Main.spriteBatch.Draw(Main.sunTexture, new Vector2((float) num21, (float) (num22 + (int) Main.sunModY)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.sunTexture.Width, Main.sunTexture.Height)), color5, rotation1, new Vector2((float) (Main.sunTexture.Width / 2), (float) (Main.sunTexture.Height / 2)), scale1, SpriteEffects.None, 0.0f); Main.spriteBatch.Draw(Main.sunTexture, new Vector2((float) num21, (float) (num22 + (int) Main.sunModY)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, 0, Main.sunTexture.Width, Main.sunTexture.Height)), color6, rotation1, new Vector2((float) (Main.sunTexture.Width / 2), (float) (Main.sunTexture.Height / 2)), scale1, SpriteEffects.None, 0.0f); } } if (!Main.dayTime) { float num95 = (float) (1.0 - (double) Main.cloudAlpha * 1.5); if ((double) num95 < 0.0) num95 = 0.0f; white2.R = (byte) ((double) white2.R * (double) num95); white2.G = (byte) ((double) white2.G * (double) num95); white2.B = (byte) ((double) white2.B * (double) num95); white2.A = (byte) ((double) white2.A * (double) num95); if (Main.pumpkinMoon) Main.spriteBatch.Draw(Main.pumpkinMoonTexture, new Vector2((float) num23, (float) (num24 + (int) Main.moonModY)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.pumpkinMoonTexture.Width * Main.moonPhase, Main.pumpkinMoonTexture.Width, Main.pumpkinMoonTexture.Width)), white2, rotation2, new Vector2((float) (Main.pumpkinMoonTexture.Width / 2), (float) (Main.pumpkinMoonTexture.Width / 2)), scale2, SpriteEffects.None, 0.0f); else if (Main.snowMoon) Main.spriteBatch.Draw(Main.snowMoonTexture, new Vector2((float) num23, (float) (num24 + (int) Main.moonModY)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.snowMoonTexture.Width * Main.moonPhase, Main.snowMoonTexture.Width, Main.snowMoonTexture.Width)), white2, rotation2, new Vector2((float) (Main.snowMoonTexture.Width / 2), (float) (Main.snowMoonTexture.Width / 2)), scale2, SpriteEffects.None, 0.0f); else Main.spriteBatch.Draw(Main.moonTexture[Main.moonType], new Vector2((float) num23, (float) (num24 + (int) Main.moonModY)), new Microsoft.Xna.Framework.Rectangle?(new Microsoft.Xna.Framework.Rectangle(0, Main.moonTexture[Main.moonType].Width * Main.moonPhase, Main.moonTexture[Main.moonType].Width, Main.moonTexture[Main.moonType].Width)), white2, rotation2, new Vector2((float) (Main.moonTexture[Main.moonType].Width / 2), (float) (Main.moonTexture[Main.moonType].Width / 2)), scale2, SpriteEffects.None, 0.0f); } } Microsoft.Xna.Framework.Rectangle rectangle1 = !Main.dayTime ? new Microsoft.Xna.Framework.Rectangle((int) ((double) num23 - (double) Main.moonTexture[Main.moonType].Width * 0.5 * (double) scale2), (int) ((double) num24 - (double) Main.moonTexture[Main.moonType].Width * 0.5 * (double) scale2 + (double) Main.moonModY), (int) ((double) Main.moonTexture[Main.moonType].Width * (double) scale2), (int) ((double) Main.moonTexture[Main.moonType].Width * (double) scale2)) : new Microsoft.Xna.Framework.Rectangle((int) ((double) num21 - (double) Main.sunTexture.Width * 0.5 * (double) scale1), (int) ((double) num22 - (double) Main.sunTexture.Height * 0.5 * (double) scale1 + (double) Main.sunModY), (int) ((double) Main.sunTexture.Width * (double) scale1), (int) ((double) Main.sunTexture.Width * (double) scale1)); 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 && Main.netMode != 1) { if (Main.mouseLeft && Main.hasFocus) { if (rectangle2.Intersects(rectangle1) || Main.grabSky) { if (Main.dayTime) { Main.time = 54000.0 * ((double) (Main.mouseX + Main.sunTexture.Width) / ((double) Main.screenWidth + (double) (Main.sunTexture.Width * 2))); Main.sunModY = (short) (Main.mouseY - num22); if (Main.time > 53990.0) Main.time = 53990.0; } else { Main.time = 32400.0 * ((double) (Main.mouseX + Main.moonTexture[Main.moonType].Width) / ((double) Main.screenWidth + (double) (Main.moonTexture[Main.moonType].Width * 2))); Main.moonModY = (short) (Main.mouseY - num24); if (Main.time > 32390.0) Main.time = 32390.0; } if (Main.time < 10.0) Main.time = 10.0; if (Main.netMode != 0) NetMessage.SendData(18); Main.grabSky = true; } } else Main.grabSky = false; } TimeLogger.DetailedDrawTime(7); } Overlays.Scene.Draw(Main.spriteBatch, RenderLayers.Sky); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, this.Rasterizer, (Effect) null, Main.BackgroundViewMatrix.TransformationMatrix); this.DrawBG(); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, this.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, this.Rasterizer, (Effect) null, Main.UIScaleMatrix); if (Main.gameMenu || Main.netMode == 2) { 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.bgColor * 0.85f; for (int index = 0; index < Main.maxRain; ++index) { if (Main.rain[index].active) { Rain rain = Main.rain[index]; Main.spriteBatch.Draw(Main.rainTexture, 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(); } } this.DrawMenu(gameTime); TimeLogger.MenuDrawTime(stopwatch1.Elapsed.TotalMilliseconds); TimeLogger.EndDrawFrame(); } else { Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, this.Rasterizer, (Effect) null, Main.Transform); this.firstTileX = (int) Math.Floor((double) Main.screenPosition.X / 16.0) - 1; this.lastTileX = (int) Math.Floor(((double) Main.screenPosition.X + (double) Main.screenWidth) / 16.0) + 2; this.firstTileY = (int) Math.Floor((double) Main.screenPosition.Y / 16.0) - 1; this.lastTileY = (int) Math.Floor(((double) Main.screenPosition.Y + (double) Main.screenHeight) / 16.0) + 2; if (!Main.drawSkip) Lighting.LightTiles(this.firstTileX, this.lastTileX, this.firstTileY, this.lastTileY); 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(); Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, (DepthStencilState) null, (RasterizerState) null, (Effect) null, Main.UIScaleMatrix); PlayerInput.SetZoom_UI(); this.DrawFPS(); this.DrawPlayerChat(); 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 white3 = 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); Sandstorm.DrawGrains(Main.spriteBatch); ScreenDarkness.DrawBack(Main.spriteBatch); ++Main.magmaBGFrameCounter; if (Main.magmaBGFrameCounter >= 8) { Main.magmaBGFrameCounter = 0; ++Main.magmaBGFrame; if (Main.magmaBGFrame >= 3) Main.magmaBGFrame = 0; } try { this.CacheNPCDraws(); this.CacheProjDraws(); this.DrawCachedNPCs(this.DrawCacheNPCsMoonMoon, true); 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); this.DrawWoF(); if (Main.drawBackGore) { Main.drawBackGore = false; if (Main.ignoreErrors) { try { this.DrawGoreBehind(); } catch (Exception ex) { TimeLogger.DrawException(ex); } } else this.DrawGoreBehind(); } MoonlordDeathDrama.DrawPieces(Main.spriteBatch); MoonlordDeathDrama.DrawExplosions(Main.spriteBatch); this.DrawCachedNPCs(this.DrawCacheNPCsBehindNonSolidTiles, true); if (Main.player[Main.myPlayer].detectCreature) { if (Main.drawToScreen) { this.DrawTiles(false); TimeLogger.DetailedDrawReset(); this.waterfallManager.Draw(Main.spriteBatch); TimeLogger.DetailedDrawTime(16); this.DrawTiles(); } else { Main.spriteBatch.Draw((Texture2D) this.tile2Target, Main.sceneTile2Pos - Main.screenPosition, Microsoft.Xna.Framework.Color.White); TimeLogger.DetailedDrawTime(15); this.waterfallManager.Draw(Main.spriteBatch); TimeLogger.DetailedDrawTime(16); Main.spriteBatch.Draw((Texture2D) this.tileTarget, Main.sceneTilePos - Main.screenPosition, Microsoft.Xna.Framework.Color.White); TimeLogger.DetailedDrawTime(17); } TimeLogger.DetailedDrawReset(); Main.spriteBatch.End(); this.DrawCachedProjs(this.DrawCacheProjsBehindNPCsAndTiles); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, this.Rasterizer, (Effect) null, Main.Transform); this.DrawNPCs(true); TimeLogger.DetailedDrawTime(18); Main.spriteBatch.End(); this.DrawCachedProjs(this.DrawCacheProjsBehindNPCs); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, this.Rasterizer, (Effect) null, Main.Transform); Main.player[Main.myPlayer].hitTile.DrawFreshAnimations(Main.spriteBatch); this.DrawNPCs(); this.DrawCachedNPCs(this.DrawCacheNPCProjectiles, false); TimeLogger.DetailedDrawTime(19); } else { if (Main.drawToScreen) { this.DrawCachedNPCs(this.DrawCacheNPCsBehindNonSolidTiles, true); this.DrawTiles(false); TimeLogger.DetailedDrawReset(); this.waterfallManager.Draw(Main.spriteBatch); TimeLogger.DetailedDrawTime(16); Main.spriteBatch.End(); this.DrawCachedProjs(this.DrawCacheProjsBehindNPCsAndTiles); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, this.Rasterizer, (Effect) null, Main.Transform); this.DrawNPCs(true); TimeLogger.DetailedDrawTime(18); this.DrawTiles(); } else { this.DrawCachedNPCs(this.DrawCacheNPCsBehindNonSolidTiles, true); Main.spriteBatch.Draw((Texture2D) this.tile2Target, Main.sceneTile2Pos - Main.screenPosition, Microsoft.Xna.Framework.Color.White); TimeLogger.DetailedDrawTime(15); this.waterfallManager.Draw(Main.spriteBatch); TimeLogger.DetailedDrawTime(16); Main.spriteBatch.End(); this.DrawCachedProjs(this.DrawCacheProjsBehindNPCsAndTiles); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, this.Rasterizer, (Effect) null, Main.Transform); this.DrawNPCs(true); TimeLogger.DetailedDrawTime(18); Main.spriteBatch.Draw((Texture2D) this.tileTarget, Main.sceneTilePos - Main.screenPosition, Microsoft.Xna.Framework.Color.White); TimeLogger.DetailedDrawTime(17); } Main.player[Main.myPlayer].hitTile.DrawFreshAnimations(Main.spriteBatch); Main.spriteBatch.End(); this.DrawCachedProjs(this.DrawCacheProjsBehindNPCs); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, this.Rasterizer, (Effect) null, Main.Transform); TimeLogger.DetailedDrawReset(); this.DrawNPCs(); this.DrawCachedNPCs(this.DrawCacheNPCProjectiles, false); TimeLogger.DetailedDrawTime(19); } } catch (Exception ex) { TimeLogger.DrawException(ex); } Overlays.Scene.Draw(Main.spriteBatch, RenderLayers.TilesAndNPCs); if (!Main.mapFullscreen && Main.mapStyle == 2) { if (Main.ignoreErrors) { try { this.DrawMap(); } catch (Exception ex) { TimeLogger.DrawException(ex); } } else this.DrawMap(); } TimeLogger.DetailedDrawReset(); Main.spriteBatch.End(); TimeLogger.DetailedDrawTime(35); this.SortDrawCacheWorms(); this.DrawCachedProjs(this.DrawCacheProjsBehindProjectiles); this.DrawProjectiles(); this.DrawPlayers(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, DepthStencilState.None, this.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, this.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) Filters.Scene.EndCapture(); TimeLogger.DetailedDrawTime(36); if (!Main.hideUI) { Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, (DepthStencilState) null, (RasterizerState) null, (Effect) null, Main.GameViewMatrix.ZoomMatrix); TimeLogger.DetailedDrawReset(); 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 vec; vec.X = (float) ((double) Main.player[index].position.X + (double) (Main.player[index].width / 2) - (double) messageSize.X / 2.0); vec.Y = (float) ((double) Main.player[index].position.Y - (double) messageSize.Y - 2.0); vec.Y += Main.player[index].gfxOffY; vec = vec.Floor(); if ((double) Main.player[Main.myPlayer].gravDir == -1.0) { vec.Y -= Main.screenPosition.Y; vec.Y = Main.screenPosition.Y + (float) Main.screenHeight - vec.Y; } int hoveredSnippet = 0; ChatManager.DrawColorCodedStringWithShadow(Main.spriteBatch, Main.fontMouseText, Main.player[index].chatOverhead.snippets, vec - Main.screenPosition, 0.0f, Vector2.Zero, Vector2.One, out hoveredSnippet); } } 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_3 = Main.fontCombatText[index2].MeasureString(Main.combatText[index1].text); Vector2 vector2_4 = new Vector2(vector2_3.X * 0.5f, vector2_3.Y * 0.5f); float num96 = 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 num97 = r * (float) ((double) num96 * (double) Main.combatText[index1].alpha * 0.300000011920929); float num98 = b * (float) ((double) num96 * (double) Main.combatText[index1].alpha * 0.300000011920929); float num99 = g * (float) ((double) num96 * (double) Main.combatText[index1].alpha * 0.300000011920929); float num100 = a * (num96 * Main.combatText[index1].alpha); Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color((int) num97, (int) num99, (int) num98, (int) num100); for (int index3 = 0; index3 < 5; ++index3) { float num101 = 0.0f; float num102 = 0.0f; if (index3 == 0) num101 -= targetScale; else if (index3 == 1) num101 += targetScale; else if (index3 == 2) num102 -= targetScale; else if (index3 == 3) { num102 += targetScale; } else { float num103 = (float) Main.combatText[index1].color.R * num96 * Main.combatText[index1].alpha; float num104 = (float) Main.combatText[index1].color.B * num96 * Main.combatText[index1].alpha; float num105 = (float) Main.combatText[index1].color.G * num96 * Main.combatText[index1].alpha; float num106 = (float) Main.combatText[index1].color.A * num96 * Main.combatText[index1].alpha; color = new Microsoft.Xna.Framework.Color((int) num103, (int) num105, (int) num104, (int) num106); } if ((double) Main.player[Main.myPlayer].gravDir == -1.0) { float num107 = Main.combatText[index1].position.Y - Main.screenPosition.Y; float num108 = (float) Main.screenHeight - num107; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontCombatText[index2], Main.combatText[index1].text, new Vector2(Main.combatText[index1].position.X - Main.screenPosition.X + num101 + vector2_4.X, num108 + num102 + vector2_4.Y), color, Main.combatText[index1].rotation, vector2_4, Main.combatText[index1].scale, SpriteEffects.None, 0.0f); } else DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontCombatText[index2], Main.combatText[index1].text, new Vector2(Main.combatText[index1].position.X - Main.screenPosition.X + num101 + vector2_4.X, Main.combatText[index1].position.Y - Main.screenPosition.Y + num102 + vector2_4.Y), color, Main.combatText[index1].rotation, vector2_4, Main.combatText[index1].scale, SpriteEffects.None, 0.0f); } } } float num109 = ItemText.TargetScale; if ((double) num109 == 0.0) num109 = 1f; for (int index4 = 0; index4 < 20; ++index4) { if (Main.itemText[index4].active) { string str = Main.itemText[index4].name; if (Main.itemText[index4].stack > 1) str = str + " (" + (object) Main.itemText[index4].stack + ")"; Vector2 vector2_5 = Main.fontMouseText.MeasureString(str); Vector2 vector2_6 = new Vector2(vector2_5.X * 0.5f, vector2_5.Y * 0.5f); float num110 = Main.itemText[index4].scale / num109; float r = (float) Main.itemText[index4].color.R; float g = (float) Main.itemText[index4].color.G; float b = (float) Main.itemText[index4].color.B; float a = (float) Main.itemText[index4].color.A; float num111 = r * (float) ((double) num110 * (double) Main.itemText[index4].alpha * 0.300000011920929); float num112 = b * (float) ((double) num110 * (double) Main.itemText[index4].alpha * 0.300000011920929); float num113 = g * (float) ((double) num110 * (double) Main.itemText[index4].alpha * 0.300000011920929); float num114 = a * (num110 * Main.itemText[index4].alpha); Microsoft.Xna.Framework.Color color = new Microsoft.Xna.Framework.Color((int) num111, (int) num113, (int) num112, (int) num114); for (int index5 = 0; index5 < 5; ++index5) { float num115 = 0.0f; float num116 = 0.0f; if (index5 == 0) num115 -= num109 * 2f; else if (index5 == 1) num115 += num109 * 2f; else if (index5 == 2) num116 -= num109 * 2f; else if (index5 == 3) { num116 += num109 * 2f; } else { float num117 = (float) Main.itemText[index4].color.R * num110 * Main.itemText[index4].alpha; float num118 = (float) Main.itemText[index4].color.B * num110 * Main.itemText[index4].alpha; float num119 = (float) Main.itemText[index4].color.G * num110 * Main.itemText[index4].alpha; float num120 = (float) Main.itemText[index4].color.A * num110 * Main.itemText[index4].alpha; color = new Microsoft.Xna.Framework.Color((int) num117, (int) num119, (int) num118, (int) num120); } if (index5 < 4) color = new Microsoft.Xna.Framework.Color(0, 0, 0, (int) ((float) Main.itemText[index4].color.A * num110 * Main.itemText[index4].alpha)); float num121 = Main.itemText[index4].position.Y - Main.screenPosition.Y + num116; if ((double) Main.player[Main.myPlayer].gravDir == -1.0) num121 = (float) Main.screenHeight - num121; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, str, new Vector2(Main.itemText[index4].position.X - Main.screenPosition.X + num115 + vector2_6.X, num121 + vector2_6.Y), color, Main.itemText[index4].rotation, vector2_6, Main.itemText[index4].scale, SpriteEffects.None, 0.0f); } } } if (Main.netMode == 1 && Netplay.Connection.StatusText != "" && Netplay.Connection.StatusText != null) { string str = Netplay.Connection.StatusText + ": " + (object) (int) ((double) Netplay.Connection.StatusCount / (double) Netplay.Connection.StatusMax * 100.0) + "%"; DynamicSpriteFontExtensionMethods.DrawString(Main.spriteBatch, Main.fontMouseText, str, new Vector2((float) (628.0 - (double) Main.fontMouseText.MeasureString(str).X * 0.5) + (float) (Main.screenWidth - 800), 84f), 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); } 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(Main.loTexture, new Microsoft.Xna.Framework.Rectangle(0, 0, Main.screenWidth, Main.screenHeight), new Microsoft.Xna.Framework.Color(0, 0, 0, a)); } Main.spriteBatch.End(); Main.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, Main.DefaultSamplerState, (DepthStencilState) null, (RasterizerState) null, (Effect) null, Main.UIScaleMatrix); PlayerInput.SetZoom_UI(); this.DrawFPS(); 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) Main.stackSplit = 0; if (Main.stackSplit > 0) --Main.stackSplit; TimeLogger.RenderTime(Main.renderCount, stopwatch1.Elapsed.TotalMilliseconds); TimeLogger.EndDrawFrame(); } } } } 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() { this.scAdj = 1f - (float) (((double) Main.screenPosition.Y + (double) Main.screenHeight) / (Main.worldSurface * 16.0)); this.scAdj = (float) (Main.worldSurface * 16.0) / (Main.screenPosition.Y + (float) Main.screenHeight); float num1 = (float) ((double) Main.maxTilesY * 0.150000005960464 * 16.0) - Main.screenPosition.Y; if ((double) num1 < 0.0) num1 = 0.0f; float num2 = num1 * 0.00025f; this.scAdj *= 0.45f - num2 * num2; if ((double) Main.maxTilesY <= 1200.0) this.scAdj *= -500f; else if ((double) Main.maxTilesY <= 1800.0) this.scAdj *= -300f; else this.scAdj *= -150f; this.screenOff = (float) (Main.screenHeight - 600); this.bgTop = (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.bgTop - 50); if (Main.resetClouds) { Cloud.resetClouds(); Main.resetClouds = false; } Main.bgScale = 1f; Main.bgW = (int) ((double) Main.backgroundWidth[Main.treeMntBG[0]] * (double) Main.bgScale); Main.backColor = Main.bgColor; Main.trueBackColor = Main.backColor; int bgStyle = Main.bgStyle; int num3 = (int) (((double) Main.screenPosition.X + (double) (Main.screenWidth / 2)) / 16.0); int num4 = (double) Main.screenPosition.Y / 16.0 >= Main.worldSurface + 10.0 || num3 >= 380 && num3 <= Main.maxTilesX - 380 ? (Main.shroomTiles <= 100 ? (Main.sandTiles <= 1000 ? (!Main.player[Main.myPlayer].ZoneHoly ? (!Main.player[Main.myPlayer].ZoneCorrupt ? (!Main.player[Main.myPlayer].ZoneCrimson ? (!Main.player[Main.myPlayer].ZoneJungle ? (!Main.player[Main.myPlayer].ZoneSnow ? 0 : 7) : 3) : 8) : 1) : 6) : (!Main.player[Main.myPlayer].ZoneCorrupt ? (!Main.player[Main.myPlayer].ZoneCrimson ? (!Main.player[Main.myPlayer].ZoneHoly ? 2 : 5) : 5) : 5)) : 9) : 4; int num5 = 30; Main.tranSpeed = 0.05f; if (num4 == 0) num5 = 60; if (Main.bgDelay < 0) ++Main.bgDelay; else if (num4 != Main.bgStyle) { ++Main.bgDelay; if (Main.bgDelay > num5) { Main.bgDelay = -60; Main.bgStyle = num4; if (num4 == 0) Main.bgDelay = 0; } } else if (Main.bgDelay > 0) --Main.bgDelay; if (Main.gameMenu) { Main.tranSpeed = 0.02f; Main.bgStyle = Main.dayTime ? 0 : 1; num4 = Main.bgStyle; } if (Main.quickBG > 0) { --Main.quickBG; Main.bgStyle = num4; Main.tranSpeed = 1f; } switch (Main.bgStyle) { case 1: case 5: case 6: Main.bgAlpha2[0] -= Main.tranSpeed; if ((double) Main.bgAlpha2[0] < 0.0) Main.bgAlpha2[0] = 0.0f; Main.bgAlpha2[1] -= Main.tranSpeed; if ((double) Main.bgAlpha2[1] < 0.0) Main.bgAlpha2[1] = 0.0f; Main.bgAlpha2[2] += Main.tranSpeed; if ((double) Main.bgAlpha2[2] > 1.0) Main.bgAlpha2[2] = 1f; Main.bgAlpha2[3] -= Main.tranSpeed; if ((double) Main.bgAlpha2[3] < 0.0) Main.bgAlpha2[3] = 0.0f; Main.bgAlpha2[4] -= Main.tranSpeed; if ((double) Main.bgAlpha2[4] < 0.0) Main.bgAlpha2[4] = 0.0f; Main.bgAlpha2[5] -= Main.tranSpeed; if ((double) Main.bgAlpha2[5] < 0.0) Main.bgAlpha2[5] = 0.0f; Main.bgAlpha2[6] -= Main.tranSpeed; if ((double) Main.bgAlpha2[6] < 0.0) { Main.bgAlpha2[6] = 0.0f; break; } break; case 2: Main.bgAlpha2[0] -= Main.tranSpeed; if ((double) Main.bgAlpha2[0] < 0.0) Main.bgAlpha2[0] = 0.0f; Main.bgAlpha2[1] += Main.tranSpeed; if ((double) Main.bgAlpha2[1] > 1.0) Main.bgAlpha2[1] = 1f; Main.bgAlpha2[2] -= Main.tranSpeed; if ((double) Main.bgAlpha2[2] < 0.0) Main.bgAlpha2[2] = 0.0f; Main.bgAlpha2[3] -= Main.tranSpeed; if ((double) Main.bgAlpha2[3] < 0.0) Main.bgAlpha2[3] = 0.0f; Main.bgAlpha2[4] -= Main.tranSpeed; if ((double) Main.bgAlpha2[4] < 0.0) Main.bgAlpha2[4] = 0.0f; Main.bgAlpha2[5] -= Main.tranSpeed; if ((double) Main.bgAlpha2[5] < 0.0) Main.bgAlpha2[5] = 0.0f; Main.bgAlpha2[6] -= Main.tranSpeed; if ((double) Main.bgAlpha2[6] < 0.0) { Main.bgAlpha2[6] = 0.0f; break; } break; case 4: Main.bgAlpha2[0] -= Main.tranSpeed; if ((double) Main.bgAlpha2[0] < 0.0) Main.bgAlpha2[0] = 0.0f; Main.bgAlpha2[1] -= Main.tranSpeed; if ((double) Main.bgAlpha2[1] < 0.0) Main.bgAlpha2[1] = 0.0f; Main.bgAlpha2[2] -= Main.tranSpeed; if ((double) Main.bgAlpha2[2] < 0.0) Main.bgAlpha2[2] = 0.0f; Main.bgAlpha2[3] += Main.tranSpeed; if ((double) Main.bgAlpha2[3] > 1.0) Main.bgAlpha2[3] = 1f; Main.bgAlpha2[4] -= Main.tranSpeed; if ((double) Main.bgAlpha2[4] < 0.0) Main.bgAlpha2[4] = 0.0f; Main.bgAlpha2[5] -= Main.tranSpeed; if ((double) Main.bgAlpha2[5] < 0.0) Main.bgAlpha2[5] = 0.0f; Main.bgAlpha2[6] -= Main.tranSpeed; if ((double) Main.bgAlpha2[6] < 0.0) { Main.bgAlpha2[6] = 0.0f; break; } break; case 7: Main.bgAlpha2[0] -= Main.tranSpeed; if ((double) Main.bgAlpha2[0] < 0.0) Main.bgAlpha2[0] = 0.0f; Main.bgAlpha2[1] -= Main.tranSpeed; if ((double) Main.bgAlpha2[1] < 0.0) Main.bgAlpha2[1] = 0.0f; Main.bgAlpha2[2] -= Main.tranSpeed; if ((double) Main.bgAlpha2[2] < 0.0) Main.bgAlpha2[2] = 0.0f; Main.bgAlpha2[3] -= Main.tranSpeed; if ((double) Main.bgAlpha2[3] < 0.0) Main.bgAlpha2[3] = 0.0f; Main.bgAlpha2[4] += Main.tranSpeed; if ((double) Main.bgAlpha2[4] > 1.0) Main.bgAlpha2[4] = 1f; Main.bgAlpha2[5] -= Main.tranSpeed; if ((double) Main.bgAlpha2[5] < 0.0) Main.bgAlpha2[5] = 0.0f; Main.bgAlpha2[6] -= Main.tranSpeed; if ((double) Main.bgAlpha2[6] < 0.0) { Main.bgAlpha2[6] = 0.0f; break; } break; case 8: Main.bgAlpha2[0] -= Main.tranSpeed; if ((double) Main.bgAlpha2[0] < 0.0) Main.bgAlpha2[0] = 0.0f; Main.bgAlpha2[1] -= Main.tranSpeed; if ((double) Main.bgAlpha2[1] < 0.0) Main.bgAlpha2[1] = 0.0f; Main.bgAlpha2[2] -= Main.tranSpeed; if ((double) Main.bgAlpha2[2] < 0.0) Main.bgAlpha2[2] = 0.0f; Main.bgAlpha2[3] -= Main.tranSpeed; if ((double) Main.bgAlpha2[3] < 0.0) Main.bgAlpha2[3] = 0.0f; Main.bgAlpha2[4] -= Main.tranSpeed; if ((double) Main.bgAlpha2[4] < 0.0) Main.bgAlpha2[4] = 0.0f; Main.bgAlpha2[5] += Main.tranSpeed; if ((double) Main.bgAlpha2[5] > 1.0) Main.bgAlpha2[5] = 1f; Main.bgAlpha2[6] -= Main.tranSpeed; if ((double) Main.bgAlpha2[6] < 0.0) { Main.bgAlpha2[6] = 0.0f; break; } break; case 9: Main.bgAlpha2[0] += Main.tranSpeed; if ((double) Main.bgAlpha2[0] > 1.0) Main.bgAlpha2[0] = 1f; Main.bgAlpha2[1] -= Main.tranSpeed; if ((double) Main.bgAlpha2[1] < 0.0) Main.bgAlpha2[1] = 0.0f; Main.bgAlpha2[2] -= Main.tranSpeed; if ((double) Main.bgAlpha2[2] < 0.0) Main.bgAlpha2[2] = 0.0f; Main.bgAlpha2[3] -= Main.tranSpeed; if ((double) Main.bgAlpha2[3] < 0.0) Main.bgAlpha2[3] = 0.0f; Main.bgAlpha2[4] -= Main.tranSpeed; if ((double) Main.bgAlpha2[4] < 0.0) Main.bgAlpha2[4] = 0.0f; Main.bgAlpha2[5] -= Main.tranSpeed; if ((double) Main.bgAlpha2[5] < 0.0) Main.bgAlpha2[5] = 0.0f; Main.bgAlpha2[6] += Main.tranSpeed; if ((double) Main.bgAlpha2[6] > 1.0) { Main.bgAlpha2[6] = 1f; break; } break; default: Main.bgAlpha2[0] += Main.tranSpeed; if ((double) Main.bgAlpha2[0] > 1.0) Main.bgAlpha2[0] = 1f; Main.bgAlpha2[1] -= Main.tranSpeed; if ((double) Main.bgAlpha2[1] < 0.0) Main.bgAlpha2[1] = 0.0f; Main.bgAlpha2[2] -= Main.tranSpeed; if ((double) Main.bgAlpha2[2] < 0.0) Main.bgAlpha2[2] = 0.0f; Main.bgAlpha2[3] -= Main.tranSpeed; if ((double) Main.bgAlpha2[3] < 0.0) Main.bgAlpha2[3] = 0.0f; Main.bgAlpha2[4] -= Main.tranSpeed; if ((double) Main.bgAlpha2[4] < 0.0) Main.bgAlpha2[4] = 0.0f; Main.bgAlpha2[5] -= Main.tranSpeed; if ((double) Main.bgAlpha2[5] < 0.0) Main.bgAlpha2[5] = 0.0f; Main.bgAlpha2[6] -= Main.tranSpeed; if ((double) Main.bgAlpha2[6] < 0.0) { Main.bgAlpha2[6] = 0.0f; break; } break; } if (Main.ignoreErrors) { try { this.DrawSurfaceBG(); if (Main.BackgroundEnabled) this.DrawUnderworldBackground(false); } catch (Exception ex) { TimeLogger.DrawException(ex); } } else { this.DrawSurfaceBG(); if (Main.BackgroundEnabled) this.DrawUnderworldBackground(false); } TimeLogger.DetailedDrawTime(8); } 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(this.flameRingTexture, 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.downedGoblins = true; if (Main.netMode == 2) NetMessage.SendData(7); AchievementsHelper.NotifyProgressionEvent(10); break; case 2: NPC.downedFrost = true; AchievementsHelper.NotifyProgressionEvent(12); break; case 3: NPC.downedPirates = true; AchievementsHelper.NotifyProgressionEvent(11); break; case 4: NPC.downedMartians = true; 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 --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 --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; NetMessage.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].owner == 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].owner == (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) { if (Main.item[whoAmI].active && (Main.item[whoAmI].owner == (int) byte.MaxValue || !Main.player[Main.item[whoAmI].owner].active)) Main.item[whoAmI].FindOwner(whoAmI); } for (int playerIndex = 0; playerIndex < (int) byte.MaxValue; ++playerIndex) { if (Netplay.Clients[playerIndex].IsActive) { ++Netplay.Clients[playerIndex].TimeOutTimer; if (!Main.stopTimeOuts && Netplay.Clients[playerIndex].TimeOutTimer > 7200) Netplay.Clients[playerIndex].PendingTermination = 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, bool force = false) { int num1 = 80; if (!force && newText.Length > num1) { string newText1 = newText; while (newText1.Length > num1) { int num2 = num1; int startIndex = num2; while (newText1.Substring(startIndex, 1) != " ") { --startIndex; if (startIndex < 1) break; } if (startIndex == 0) { while (newText1.Substring(num2, 1) != " ") { ++num2; if (num2 >= newText1.Length - 1) break; } } else num2 = startIndex; if (num2 >= newText1.Length - 1) num2 = newText1.Length; Main.NewText(newText1.Substring(0, num2), R, G, B, true); newText1 = newText1.Substring(num2); if (newText1.Length > 0) { while (newText1.Substring(0, 1) == " ") newText1 = newText1.Substring(1); } } if (newText1.Length <= 0) return; Main.NewText(newText1, R, G, B, true); } else { for (int index = Main.numChatLines - 1; index > 0; --index) { Main.chatLine[index].text = Main.chatLine[index - 1].text; Main.chatLine[index].parsedText = Main.chatLine[index - 1].parsedText; Main.chatLine[index].showTime = Main.chatLine[index - 1].showTime; Main.chatLine[index].color = Main.chatLine[index - 1].color; } Main.chatLine[0].color = R != (byte) 0 || G != (byte) 0 || B != (byte) 0 ? new Microsoft.Xna.Framework.Color((int) R, (int) G, (int) B) : Microsoft.Xna.Framework.Color.White; Main.chatLine[0].text = newText; Main.chatLine[0].parsedText = ChatManager.ParseMessage(Main.chatLine[0].text, Main.chatLine[0].color).ToArray(); Main.chatLine[0].showTime = Main.chatLength; Main.PlaySound(12); } } public static void NewTextMultiline(string text, bool force = false, Microsoft.Xna.Framework.Color c = default (Microsoft.Xna.Framework.Color), int WidthLimit = -1) { if (c == new Microsoft.Xna.Framework.Color()) c = Microsoft.Xna.Framework.Color.White; List> textSnippetListList = WidthLimit == -1 ? Utils.WordwrapStringSmart(text, c, Main.fontMouseText, Main.TextMaxLengthForScreen, 10) : Utils.WordwrapStringSmart(text, c, Main.fontMouseText, WidthLimit, 10); for (int index = 0; index < textSnippetListList.Count; ++index) Main.NewText(textSnippetListList[index]); } public static void NewText(List snippets) { for (int index = Main.numChatLines - 1; index > 0; --index) { Main.chatLine[index].text = Main.chatLine[index - 1].text; Main.chatLine[index].parsedText = Main.chatLine[index - 1].parsedText; Main.chatLine[index].showTime = Main.chatLine[index - 1].showTime; Main.chatLine[index].color = Main.chatLine[index - 1].color; } Main.chatLine[0].text = "whatever"; Main.chatLine[0].parsedText = snippets.ToArray(); Main.chatLine[0].showTime = Main.chatLength; Main.PlaySound(12); } public static void NewTextMultilineOld(string text, bool force = false, Microsoft.Xna.Framework.Color c = default (Microsoft.Xna.Framework.Color)) { if (c == new Microsoft.Xna.Framework.Color()) c = Microsoft.Xna.Framework.Color.White; int lineAmount; string[] strArray = Utils.WordwrapString(text, Main.fontMouseText, 460, 10, out lineAmount); for (int index = 0; index <= lineAmount; ++index) Main.NewText(strArray[index], c.R, c.G, c.B, force); } private static void StopRain() { Main.rainTime = 0; Main.raining = false; Main.maxRaining = 0.0f; } private static void StartRain() { int maxValue1 = 86400; int maxValue2 = maxValue1 / 24; Main.rainTime = Main.rand.Next(maxValue2 * 8, maxValue1); if (Main.rand.Next(3) == 0) Main.rainTime += Main.rand.Next(0, maxValue2); if (Main.rand.Next(4) == 0) Main.rainTime += Main.rand.Next(0, maxValue2 * 2); if (Main.rand.Next(5) == 0) Main.rainTime += Main.rand.Next(0, maxValue2 * 2); if (Main.rand.Next(6) == 0) Main.rainTime += Main.rand.Next(0, maxValue2 * 3); if (Main.rand.Next(7) == 0) Main.rainTime += Main.rand.Next(0, maxValue2 * 4); if (Main.rand.Next(8) == 0) Main.rainTime += Main.rand.Next(0, maxValue2 * 5); float num = 1f; if (Main.rand.Next(2) == 0) num += 0.05f; if (Main.rand.Next(3) == 0) num += 0.1f; if (Main.rand.Next(4) == 0) num += 0.15f; if (Main.rand.Next(5) == 0) num += 0.2f; Main.rainTime = (int) ((double) Main.rainTime * (double) num); Main.ChangeRain(); Main.raining = true; } private static void ChangeRain() { if ((double) Main.cloudBGActive >= 1.0 || (double) Main.numClouds > 150.0) { if (Main.rand.Next(3) == 0) Main.maxRaining = (float) Main.rand.Next(20, 90) * 0.01f; else Main.maxRaining = (float) Main.rand.Next(40, 90) * 0.01f; } else if ((double) Main.numClouds > 100.0) { if (Main.rand.Next(3) == 0) Main.maxRaining = (float) Main.rand.Next(10, 70) * 0.01f; else Main.maxRaining = (float) Main.rand.Next(20, 60) * 0.01f; } else if (Main.rand.Next(3) == 0) Main.maxRaining = (float) Main.rand.Next(5, 40) * 0.01f; else Main.maxRaining = (float) Main.rand.Next(5, 30) * 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; 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 (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) { 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) { int num = 86400 / (Main.dayRate != 0 ? Main.dayRate : 1); if (Main.rand.Next((int) ((double) num * 5.5)) == 0) Main.StartRain(); else if ((double) Main.cloudBGActive >= 1.0 && Main.rand.Next(num * 4) == 0) Main.StartRain(); if (!Main.raining && !NPC.BusyWithAnyInvasionOfSorts()) { int maxValue = (int) (1728000.0 / (double) Main.dayRate); if (!NPC.downedSlimeKing) maxValue /= 2; if (Main.hardMode) maxValue = (int) ((double) maxValue * 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) maxValue *= 5; if (Main.dayRate > 0 && maxValue > 0 && (flag || Main.expertMode) && Main.rand.Next(maxValue) == 0) Main.StartSlimeRain(); } } } if ((double) Main.maxRaining != (double) Main.oldMaxRaining) { if (Main.netMode == 2) NetMessage.SendData(7); Main.oldMaxRaining = Main.maxRaining; } Main.UpdateSundial(); Main.time += (double) Main.dayRate; CultistRitual.UpdateTime(); BirthdayParty.UpdateTime(); Sandstorm.UpdateTime(); DD2Event.UpdateTime(); 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 (!Filters.Scene["MoonLordShake"].IsActive()) Filters.Scene.Activate("MoonLordShake", Main.player[Main.myPlayer].position); Filters.Scene["MoonLordShake"].GetShader().UseIntensity(intensity); } else if (Filters.Scene["MoonLordShake"].IsActive()) 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.slimeWarningTime > 0) { --Main.slimeWarningTime; if (Main.slimeWarningTime <= 0) { 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) NetMessage.BroadcastChatMessage(NetworkText.FromKey(Lang.gen[74].Key), new Microsoft.Xna.Framework.Color(50, (int) byte.MaxValue, 130)); else NetMessage.BroadcastChatMessage(NetworkText.FromKey(Lang.gen[75].Key), new Microsoft.Xna.Framework.Color(50, (int) byte.MaxValue, 130)); } } 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; } if (!Main.dayTime) { Main.eclipse = false; if (!Main.fastForwardTime) { 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_98; case 2: NPC.SpawnOnPlayer(plr, 125); NPC.SpawnOnPlayer(plr, 126); goto label_98; case 3: NPC.SpawnOnPlayer(plr, (int) sbyte.MaxValue); goto label_98; default: goto label_98; } } } } label_98: WorldGen.spawnHardBoss = 0; } } if (Main.time > 32400.0) { if (Main.fastForwardTime) { Main.fastForwardTime = false; Main.UpdateSundial(); } Main.checkXMas(); Main.checkHalloween(); Main.AnglerQuestSwap(); BirthdayParty.CheckMorning(); if (Main.invasionDelay > 0) --Main.invasionDelay; WorldGen.prioritizedTownNPC = 0; Main.checkForSpawns = 0; Main.time = 0.0; if (Main.bloodMoon && Main.netMode != 1) AchievementsHelper.NotifyProgressionEvent(5); Main.bloodMoon = false; Main.stopMoonEvent(); Main.dayTime = true; if (Main.sundialCooldown > 0) --Main.sundialCooldown; ++Main.moonPhase; if (Main.moonPhase >= 8) Main.moonPhase = 0; if (Main.netMode == 2) { NetMessage.SendData(7); WorldGen.saveAndPlay(); } if (Main.netMode != 1) { AchievementsHelper.NotifyProgressionEvent(1); 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) NetMessage.BroadcastChatMessage(Lang.misc[20].ToNetworkText(), new Microsoft.Xna.Framework.Color(50, (int) byte.MaxValue, 130)); } if (Main.netMode == 2) NetMessage.SendData(7); } else if (!Main.snowMoon && !Main.pumpkinMoon && !DD2Event.Ongoing) { 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(50) == 0 || !NPC.downedPirates && Main.rand.Next(30) == 0)) Main.StartInvasion(3); } } } if (Main.time <= 16200.0 || !WorldGen.spawnMeteor) return; WorldGen.spawnMeteor = false; WorldGen.dropMeteor(); } else { Main.bloodMoon = false; Main.stopMoonEvent(); if (Main.time > 54000.0) { NPC.setFireFlyChance(); BirthdayParty.CheckNight(); WorldGen.prioritizedTownNPC = 0; Main.checkForSpawns = 0; if (Main.rand.Next(50) == 0 && Main.netMode != 1 && WorldGen.shadowOrbSmashed) WorldGen.spawnMeteor = true; if (Main.eclipse && Main.netMode != 1) AchievementsHelper.NotifyProgressionEvent(3); Main.eclipse = false; if (Main.netMode != 1) AchievementsHelper.NotifyProgressionEvent(0); if (!Main.fastForwardTime) { 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: NetMessage.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_178; case 2: NetMessage.BroadcastChatMessage(Lang.misc[28].ToNetworkText(), new Microsoft.Xna.Framework.Color(50, (int) byte.MaxValue, 130)); goto label_178; default: goto label_178; } } 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_178; case 2: NetMessage.BroadcastChatMessage(Lang.misc[29].ToNetworkText(), new Microsoft.Xna.Framework.Color(50, (int) byte.MaxValue, 130)); goto label_178; default: goto label_178; } } 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_178; case 2: NetMessage.BroadcastChatMessage(Lang.misc[30].ToNetworkText(), new Microsoft.Xna.Framework.Color(50, (int) byte.MaxValue, 130)); goto label_178; default: goto label_178; } } } } } label_178: 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: NetMessage.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) NetMessage.SendData(7); } Main.UpdateTime_SpawnTownNPCs(); } } private static void UpdateTime_SpawnTownNPCs() { if (Main.netMode == 1 || Main.worldRate <= 0) return; ++Main.checkForSpawns; if (Main.checkForSpawns < 7200 / Main.worldRate) return; int num1 = 0; for (int index = 0; index < (int) byte.MaxValue; ++index) { if (Main.player[index].active) ++num1; } for (int index = 0; index < 580; ++index) Main.townNPCCanSpawn[index] = false; Main.checkForSpawns = 0; WorldGen.prioritizedTownNPC = 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; 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; ++num26; } } if (WorldGen.prioritizedTownNPC != 0) return; int num27 = 0; bool flag1 = false; int num28 = 0; bool flag2 = false; bool flag3 = false; bool flag4 = false; bool flag5 = false; 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 (num27 < 2000000000) { if (Main.player[index1].inventory[index2].type == 71) num27 += Main.player[index1].inventory[index2].stack; if (Main.player[index1].inventory[index2].type == 72) num27 += Main.player[index1].inventory[index2].stack * 100; if (Main.player[index1].inventory[index2].type == 73) num27 += Main.player[index1].inventory[index2].stack * 10000; if (Main.player[index1].inventory[index2].type == 74) num27 += 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 (Main.player[index1].inventory[index2].type == 166 || Main.player[index1].inventory[index2].type == 167 || Main.player[index1].inventory[index2].type == 168 || Main.player[index1].inventory[index2].type == 235 || Main.player[index1].inventory[index2].type == 2896 || Main.player[index1].inventory[index2].type == 3547) 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) { if (Main.player[index1].inventory[index2].type >= 3385 && Main.player[index1].inventory[index2].type <= 3388) flag5 = true; flag4 = true; } } } int num29 = Main.player[index1].statLifeMax / 20; if (num29 > 5) flag1 = true; num28 += num29; 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 flag6 = false; if (Main.rand.Next(40) == 0) flag6 = true; if (num6 < 1) Main.townNPCCanSpawn[22] = true; if ((double) num27 > 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 && ((NPC.downedBoss1 || NPC.downedBoss2 ? 1 : (NPC.downedBoss3 ? 1 : 0)) | (flag5 ? 1 : 0)) != 0) 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 (num26 >= 8 && num19 < 1) Main.townNPCCanSpawn[227] = true; if (flag6 && num17 < 1 && num26 >= 14) Main.townNPCCanSpawn[208] = true; if (NPC.savedBartender && num25 < 1) Main.townNPCCanSpawn[550] = true; if (WorldGen.prioritizedTownNPC == 0 && num6 < 1) WorldGen.prioritizedTownNPC = 22; if (WorldGen.prioritizedTownNPC == 0 && (double) num27 > 5000.0 && num2 < 1) WorldGen.prioritizedTownNPC = 17; if (WorldGen.prioritizedTownNPC == 0 & flag1 && num3 < 1 && num2 > 0) WorldGen.prioritizedTownNPC = 18; if (WorldGen.prioritizedTownNPC == 0 & flag2 && num5 < 1) WorldGen.prioritizedTownNPC = 19; if (WorldGen.prioritizedTownNPC == 0 && NPC.savedGoblin && num11 < 1) WorldGen.prioritizedTownNPC = 107; if (WorldGen.prioritizedTownNPC == 0 && NPC.savedTaxCollector && num24 < 1) WorldGen.prioritizedTownNPC = 441; if (WorldGen.prioritizedTownNPC == 0 && NPC.savedWizard && num10 < 1) WorldGen.prioritizedTownNPC = 108; if (WorldGen.prioritizedTownNPC == 0 && Main.hardMode && num14 < 1) WorldGen.prioritizedTownNPC = 160; if (WorldGen.prioritizedTownNPC == 0 && (NPC.downedBoss1 || NPC.downedBoss2 || NPC.downedBoss3) && num4 < 1) WorldGen.prioritizedTownNPC = 20; if (WorldGen.prioritizedTownNPC == 0 & flag3 && num2 > 0 && num8 < 1) WorldGen.prioritizedTownNPC = 38; if (WorldGen.prioritizedTownNPC == 0 && NPC.downedQueenBee && num20 < 1) WorldGen.prioritizedTownNPC = 228; if (WorldGen.prioritizedTownNPC == 0 && NPC.downedMechBossAny && num15 < 1) WorldGen.prioritizedTownNPC = 178; if (WorldGen.prioritizedTownNPC == 0 && NPC.savedMech && num12 < 1) WorldGen.prioritizedTownNPC = 124; if (WorldGen.prioritizedTownNPC == 0 && NPC.savedAngler && num23 < 1) WorldGen.prioritizedTownNPC = 369; if (WorldGen.prioritizedTownNPC == 0 && Main.hardMode && NPC.downedPlantBoss && num18 < 1) WorldGen.prioritizedTownNPC = 209; if (WorldGen.prioritizedTownNPC == 0 && NPC.downedPirates && num21 < 1) WorldGen.prioritizedTownNPC = 229; if (WorldGen.prioritizedTownNPC == 0 && NPC.downedBoss3 && num9 < 1) WorldGen.prioritizedTownNPC = 54; if (WorldGen.prioritizedTownNPC == 0 && NPC.savedStylist && num22 < 1) WorldGen.prioritizedTownNPC = 353; if (WorldGen.prioritizedTownNPC == 0 & flag4 && num16 < 1) WorldGen.prioritizedTownNPC = 207; if (WorldGen.prioritizedTownNPC == 0 && num26 >= 8 && num19 < 1) WorldGen.prioritizedTownNPC = 227; if (WorldGen.prioritizedTownNPC == 0 & flag6 && num26 >= 14 && num17 < 1) WorldGen.prioritizedTownNPC = 208; if (WorldGen.prioritizedTownNPC == 0 && NPC.downedFrost && num13 < 1 && Main.xMas) WorldGen.prioritizedTownNPC = 142; if (WorldGen.prioritizedTownNPC != 0 || !NPC.savedBartender || num25 >= 1) return; WorldGen.prioritizedTownNPC = 550; } public static int DamageVar(float dmg) => (int) Math.Round((double) dmg * (1.0 + (double) Main.rand.Next(-15, 16) * 0.00999999977648258)); public static double CalculateDamage(int Damage, int Defense) { double num = (double) Damage - (double) Defense * 0.5; if (num < 1.0) num = 1.0; return num; } public static double CalculatePlayerDamage(int Damage, int Defense) { double num = (double) Damage - (double) Defense * 0.5; 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: Main.PlaySound(SoundID.LiquidsWaterLava, x * 16 + count * 8, y * 16 + count * 8); break; case TileChangeType.HoneyWater: Main.PlaySound(SoundID.LiquidsHoneyWater, x * 16 + count * 8, y * 16 + count * 8); break; case TileChangeType.HoneyLava: Main.PlaySound(SoundID.LiquidsHoneyLava, x * 16 + count * 8, y * 16 + count * 8); break; } } public static void PlaySound(int type, Vector2 position, int Style = 1) => Main.PlaySound(type, (int) position.X, (int) position.Y, Style); public static void PlaySoundInstance(SoundEffectInstance sound) => sound.Play(); public static ActiveSound GetActiveSound(SlotId id) => Main._trackedSounds.Has(id) ? Main._trackedSounds[id] : (ActiveSound) null; public static SoundEffectInstance PlaySound( LegacySoundStyle type, Vector2 position) { return type == null ? (SoundEffectInstance) null : Main.PlaySound(type, (int) position.X, (int) position.Y); } public static SoundEffectInstance PlaySound( LegacySoundStyle type, int x = -1, int y = -1) { return type == null ? (SoundEffectInstance) null : Main.PlaySound(type.SoundId, x, y, type.Style, type.Volume, type.GetRandomPitch()); } public static void StopTrackedSounds() { foreach (SlotVector.ItemPair trackedSound in (IEnumerable.ItemPair>) Main._trackedSounds) ((ActiveSound) trackedSound.Value).Stop(); Main._trackedSounds.Clear(); } public static SlotId PlayTrackedSound(SoundStyle style, Vector2 position) { if (Main.dedServ || style == null || !style.IsTrackable) return (SlotId) SlotId.Invalid; if ((double) Vector2.DistanceSquared(Main.screenPosition + new Vector2((float) (Main.screenWidth / 2), (float) (Main.screenHeight / 2)), position) > 100000000.0) return (SlotId) SlotId.Invalid; ActiveSound activeSound = new ActiveSound(style, position); return Main._trackedSounds.Add(activeSound); } public static SlotId PlayTrackedSound(SoundStyle style) { if (Main.dedServ || style == null || !style.IsTrackable) return (SlotId) SlotId.Invalid; ActiveSound activeSound = new ActiveSound(style); return Main._trackedSounds.Add(activeSound); } public static SoundEffectInstance PlaySound( int type, int x = -1, int y = -1, int Style = 1, float volumeScale = 1f, float pitchOffset = 0.0f) { int index1 = Style; try { if (Main.dedServ || (double) Main.soundVolume == 0.0 && (type < 30 || type > 35)) return (SoundEffectInstance) null; bool flag = false; float num1 = 1f; float num2 = 0.0f; if (x == -1 || y == -1) { flag = true; } else { if (WorldGen.gen || Main.netMode == 2) return (SoundEffectInstance) null; Microsoft.Xna.Framework.Rectangle rectangle1 = new Microsoft.Xna.Framework.Rectangle((int) ((double) Main.screenPosition.X - (double) (Main.screenWidth * 2)), (int) ((double) Main.screenPosition.Y - (double) (Main.screenHeight * 2)), Main.screenWidth * 5, Main.screenHeight * 5); Microsoft.Xna.Framework.Rectangle rectangle2 = new Microsoft.Xna.Framework.Rectangle(x, y, 1, 1); Vector2 vector2 = new Vector2(Main.screenPosition.X + (float) Main.screenWidth * 0.5f, Main.screenPosition.Y + (float) Main.screenHeight * 0.5f); if (rectangle2.Intersects(rectangle1)) flag = true; if (flag) { num2 = (float) (((double) x - (double) vector2.X) / ((double) Main.screenWidth * 0.5)); double num3 = (double) Math.Abs((float) x - vector2.X); float num4 = Math.Abs((float) y - vector2.Y); num1 = (float) (1.0 - Math.Sqrt(num3 * num3 + (double) num4 * (double) num4) / ((double) Main.screenWidth * 1.5)); } } if ((double) num2 < -1.0) num2 = -1f; if ((double) num2 > 1.0) num2 = 1f; if ((double) num1 > 1.0) num1 = 1f; if ((double) num1 <= 0.0 && (type < 34 || type > 35 || type > 39)) return (SoundEffectInstance) null; if (flag) { float num5 = type >= 30 && type <= 35 || type == 39 ? num1 * (Main.ambientVolume * (Main.gameInactive ? 0.0f : 1f)) : num1 * Main.soundVolume; if ((double) num5 > 1.0) num5 = 1f; if ((double) num5 <= 0.0 && (type < 30 || type > 35) && type != 39) return (SoundEffectInstance) null; SoundEffectInstance sound = (SoundEffectInstance) null; switch (type) { case 0: int index2 = Main.rand.Next(3); Main.soundInstanceDig[index2].Stop(); Main.soundInstanceDig[index2] = Main.soundDig[index2].CreateInstance(); Main.soundInstanceDig[index2].Volume = num5; Main.soundInstanceDig[index2].Pan = num2; Main.soundInstanceDig[index2].Pitch = (float) Main.rand.Next(-10, 11) * 0.01f; sound = Main.soundInstanceDig[index2]; break; case 1: int index3 = Main.rand.Next(3); Main.soundInstancePlayerHit[index3].Stop(); Main.soundInstancePlayerHit[index3] = Main.soundPlayerHit[index3].CreateInstance(); Main.soundInstancePlayerHit[index3].Volume = num5; Main.soundInstancePlayerHit[index3].Pan = num2; sound = Main.soundInstancePlayerHit[index3]; break; case 2: if (index1 == 123) num5 *= 0.5f; if (index1 == 124 || index1 == 125) num5 *= 0.65f; if (index1 == 116) num5 *= 0.5f; if (index1 == 1) { int num6 = Main.rand.Next(3); if (num6 == 1) index1 = 18; if (num6 == 2) index1 = 19; } else if (index1 == 55 || index1 == 53) { num5 *= 0.75f; if (index1 == 55) num5 *= 0.75f; if (Main.soundInstanceItem[index1].State == SoundState.Playing) return (SoundEffectInstance) null; } else if (index1 == 37) num5 *= 0.5f; if (index1 != 9 && index1 != 10 && index1 != 24 && index1 != 26 && index1 != 34 && index1 != 43 && index1 != 103) Main.soundInstanceItem[index1].Stop(); Main.soundInstanceItem[index1] = Main.soundItem[index1].CreateInstance(); Main.soundInstanceItem[index1].Volume = num5; Main.soundInstanceItem[index1].Pan = num2; Main.soundInstanceItem[index1].Pitch = index1 != 47 ? (index1 != 53 ? (index1 != 55 ? (float) Main.rand.Next(-6, 7) * 0.01f : (float) -Main.rand.Next(-20, -11) * 0.02f) : (float) Main.rand.Next(-20, -11) * 0.02f) : (float) Main.rand.Next(-5, 6) * 0.19f; if (index1 == 26 || index1 == 35) { Main.soundInstanceItem[index1].Volume = num5 * 0.75f; Main.soundInstanceItem[index1].Pitch = Main.harpNote; } sound = Main.soundInstanceItem[index1]; break; case 3: if (index1 >= 20 && index1 <= 54) num5 *= 0.5f; if (index1 == 57 && Main.soundInstanceNPCHit[index1].State == SoundState.Playing) return (SoundEffectInstance) null; if (index1 == 57) num5 *= 0.6f; if (index1 == 55 || index1 == 56) num5 *= 0.5f; Main.soundInstanceNPCHit[index1].Stop(); Main.soundInstanceNPCHit[index1] = Main.soundNPCHit[index1].CreateInstance(); Main.soundInstanceNPCHit[index1].Volume = num5; Main.soundInstanceNPCHit[index1].Pan = num2; Main.soundInstanceNPCHit[index1].Pitch = (float) Main.rand.Next(-10, 11) * 0.01f; sound = Main.soundInstanceNPCHit[index1]; break; case 4: if (index1 >= 23 && index1 <= 57) num5 *= 0.5f; if (index1 == 61) num5 *= 0.6f; if (index1 == 62) num5 *= 0.6f; if (index1 == 10 && Main.soundInstanceNPCKilled[index1].State == SoundState.Playing) return (SoundEffectInstance) null; Main.soundInstanceNPCKilled[index1] = Main.soundNPCKilled[index1].CreateInstance(); Main.soundInstanceNPCKilled[index1].Volume = num5; Main.soundInstanceNPCKilled[index1].Pan = num2; Main.soundInstanceNPCKilled[index1].Pitch = (float) Main.rand.Next(-10, 11) * 0.01f; sound = Main.soundInstanceNPCKilled[index1]; break; case 5: Main.soundInstancePlayerKilled.Stop(); Main.soundInstancePlayerKilled = Main.soundPlayerKilled.CreateInstance(); Main.soundInstancePlayerKilled.Volume = num5; Main.soundInstancePlayerKilled.Pan = num2; sound = Main.soundInstancePlayerKilled; break; case 6: Main.soundInstanceGrass.Stop(); Main.soundInstanceGrass = Main.soundGrass.CreateInstance(); Main.soundInstanceGrass.Volume = num5; Main.soundInstanceGrass.Pan = num2; Main.soundInstanceGrass.Pitch = (float) Main.rand.Next(-30, 31) * 0.01f; sound = Main.soundInstanceGrass; break; case 7: Main.soundInstanceGrab.Stop(); Main.soundInstanceGrab = Main.soundGrab.CreateInstance(); Main.soundInstanceGrab.Volume = num5; Main.soundInstanceGrab.Pan = num2; Main.soundInstanceGrab.Pitch = (float) Main.rand.Next(-10, 11) * 0.01f; sound = Main.soundInstanceGrab; break; case 8: Main.soundInstanceDoorOpen.Stop(); Main.soundInstanceDoorOpen = Main.soundDoorOpen.CreateInstance(); Main.soundInstanceDoorOpen.Volume = num5; Main.soundInstanceDoorOpen.Pan = num2; Main.soundInstanceDoorOpen.Pitch = (float) Main.rand.Next(-20, 21) * 0.01f; sound = Main.soundInstanceDoorOpen; break; case 9: Main.soundInstanceDoorClosed.Stop(); Main.soundInstanceDoorClosed = Main.soundDoorClosed.CreateInstance(); Main.soundInstanceDoorClosed.Volume = num5; Main.soundInstanceDoorClosed.Pan = num2; Main.soundInstanceDoorOpen.Pitch = (float) Main.rand.Next(-20, 21) * 0.01f; sound = Main.soundInstanceDoorClosed; break; case 10: Main.soundInstanceMenuOpen.Stop(); Main.soundInstanceMenuOpen = Main.soundMenuOpen.CreateInstance(); Main.soundInstanceMenuOpen.Volume = num5; Main.soundInstanceMenuOpen.Pan = num2; sound = Main.soundInstanceMenuOpen; break; case 11: Main.soundInstanceMenuClose.Stop(); Main.soundInstanceMenuClose = Main.soundMenuClose.CreateInstance(); Main.soundInstanceMenuClose.Volume = num5; Main.soundInstanceMenuClose.Pan = num2; sound = Main.soundInstanceMenuClose; break; case 12: Main.soundInstanceMenuTick.Stop(); Main.soundInstanceMenuTick = Main.soundMenuTick.CreateInstance(); Main.soundInstanceMenuTick.Volume = num5; Main.soundInstanceMenuTick.Pan = num2; sound = Main.soundInstanceMenuTick; break; case 13: Main.soundInstanceShatter.Stop(); Main.soundInstanceShatter = Main.soundShatter.CreateInstance(); Main.soundInstanceShatter.Volume = num5; Main.soundInstanceShatter.Pan = num2; sound = Main.soundInstanceShatter; break; case 14: switch (Style) { case 489: int index4 = Main.rand.Next(21, 24); Main.soundInstanceZombie[index4] = Main.soundZombie[index4].CreateInstance(); Main.soundInstanceZombie[index4].Volume = num5 * 0.4f; Main.soundInstanceZombie[index4].Pan = num2; sound = Main.soundInstanceZombie[index4]; break; case 542: int index5 = 7; Main.soundInstanceZombie[index5] = Main.soundZombie[index5].CreateInstance(); Main.soundInstanceZombie[index5].Volume = num5 * 0.4f; Main.soundInstanceZombie[index5].Pan = num2; sound = Main.soundInstanceZombie[index5]; break; default: int index6 = Main.rand.Next(3); Main.soundInstanceZombie[index6] = Main.soundZombie[index6].CreateInstance(); Main.soundInstanceZombie[index6].Volume = num5 * 0.4f; Main.soundInstanceZombie[index6].Pan = num2; sound = Main.soundInstanceZombie[index6]; break; } break; case 15: float num7 = 1f; if (index1 == 4) { index1 = 1; num7 = 0.25f; } if (Main.soundInstanceRoar[index1].State == SoundState.Stopped) { Main.soundInstanceRoar[index1] = Main.soundRoar[index1].CreateInstance(); Main.soundInstanceRoar[index1].Volume = num5 * num7; Main.soundInstanceRoar[index1].Pan = num2; sound = Main.soundInstanceRoar[index1]; break; } break; case 16: Main.soundInstanceDoubleJump.Stop(); Main.soundInstanceDoubleJump = Main.soundDoubleJump.CreateInstance(); Main.soundInstanceDoubleJump.Volume = num5; Main.soundInstanceDoubleJump.Pan = num2; Main.soundInstanceDoubleJump.Pitch = (float) Main.rand.Next(-10, 11) * 0.01f; sound = Main.soundInstanceDoubleJump; break; case 17: Main.soundInstanceRun.Stop(); Main.soundInstanceRun = Main.soundRun.CreateInstance(); Main.soundInstanceRun.Volume = num5; Main.soundInstanceRun.Pan = num2; Main.soundInstanceRun.Pitch = (float) Main.rand.Next(-10, 11) * 0.01f; sound = Main.soundInstanceRun; break; case 18: Main.soundInstanceCoins = Main.soundCoins.CreateInstance(); Main.soundInstanceCoins.Volume = num5; Main.soundInstanceCoins.Pan = num2; sound = Main.soundInstanceCoins; break; case 19: if (Main.soundInstanceSplash[index1].State == SoundState.Stopped) { Main.soundInstanceSplash[index1] = Main.soundSplash[index1].CreateInstance(); Main.soundInstanceSplash[index1].Volume = num5; Main.soundInstanceSplash[index1].Pan = num2; Main.soundInstanceSplash[index1].Pitch = (float) Main.rand.Next(-10, 11) * 0.01f; sound = Main.soundInstanceSplash[index1]; break; } break; case 20: int index7 = Main.rand.Next(3); Main.soundInstanceFemaleHit[index7].Stop(); Main.soundInstanceFemaleHit[index7] = Main.soundFemaleHit[index7].CreateInstance(); Main.soundInstanceFemaleHit[index7].Volume = num5; Main.soundInstanceFemaleHit[index7].Pan = num2; sound = Main.soundInstanceFemaleHit[index7]; break; case 21: int index8 = Main.rand.Next(3); Main.soundInstanceTink[index8].Stop(); Main.soundInstanceTink[index8] = Main.soundTink[index8].CreateInstance(); Main.soundInstanceTink[index8].Volume = num5; Main.soundInstanceTink[index8].Pan = num2; sound = Main.soundInstanceTink[index8]; break; case 22: Main.soundInstanceUnlock.Stop(); Main.soundInstanceUnlock = Main.soundUnlock.CreateInstance(); Main.soundInstanceUnlock.Volume = num5; Main.soundInstanceUnlock.Pan = num2; sound = Main.soundInstanceUnlock; break; case 23: Main.soundInstanceDrown.Stop(); Main.soundInstanceDrown = Main.soundDrown.CreateInstance(); Main.soundInstanceDrown.Volume = num5; Main.soundInstanceDrown.Pan = num2; sound = Main.soundInstanceDrown; break; case 24: Main.soundInstanceChat = Main.soundChat.CreateInstance(); Main.soundInstanceChat.Volume = num5; Main.soundInstanceChat.Pan = num2; sound = Main.soundInstanceChat; break; case 25: Main.soundInstanceMaxMana = Main.soundMaxMana.CreateInstance(); Main.soundInstanceMaxMana.Volume = num5; Main.soundInstanceMaxMana.Pan = num2; sound = Main.soundInstanceMaxMana; break; case 26: int index9 = Main.rand.Next(3, 5); Main.soundInstanceZombie[index9] = Main.soundZombie[index9].CreateInstance(); Main.soundInstanceZombie[index9].Volume = num5 * 0.9f; Main.soundInstanceZombie[index9].Pan = num2; Main.soundInstanceZombie[index9].Pitch = (float) Main.rand.Next(-10, 11) * 0.01f; sound = Main.soundInstanceZombie[index9]; break; case 27: if (Main.soundInstancePixie.State == SoundState.Playing) { Main.soundInstancePixie.Volume = num5; Main.soundInstancePixie.Pan = num2; Main.soundInstancePixie.Pitch = (float) Main.rand.Next(-10, 11) * 0.01f; return (SoundEffectInstance) null; } Main.soundInstancePixie.Stop(); Main.soundInstancePixie = Main.soundPixie.CreateInstance(); Main.soundInstancePixie.Volume = num5; Main.soundInstancePixie.Pan = num2; Main.soundInstancePixie.Pitch = (float) Main.rand.Next(-10, 11) * 0.01f; sound = Main.soundInstancePixie; break; case 28: if (Main.soundInstanceMech[index1].State == SoundState.Playing) return (SoundEffectInstance) null; Main.soundInstanceMech[index1] = Main.soundMech[index1].CreateInstance(); Main.soundInstanceMech[index1].Volume = num5; Main.soundInstanceMech[index1].Pan = num2; Main.soundInstanceMech[index1].Pitch = (float) Main.rand.Next(-10, 11) * 0.01f; sound = Main.soundInstanceMech[index1]; break; case 29: if (index1 >= 24 && index1 <= 87) num5 *= 0.5f; if (index1 >= 88 && index1 <= 91) num5 *= 0.7f; if (index1 >= 93 && index1 <= 99) num5 *= 0.4f; if (index1 == 92) num5 *= 0.5f; if (index1 == 103) num5 *= 0.4f; if (index1 == 104) num5 *= 0.55f; if (index1 == 100 || index1 == 101) num5 *= 0.25f; if (index1 == 102) num5 *= 0.4f; if (Main.soundInstanceZombie[index1].State == SoundState.Playing) return (SoundEffectInstance) null; Main.soundInstanceZombie[index1] = Main.soundZombie[index1].CreateInstance(); Main.soundInstanceZombie[index1].Volume = num5; Main.soundInstanceZombie[index1].Pan = num2; Main.soundInstanceZombie[index1].Pitch = (float) Main.rand.Next(-10, 11) * 0.01f; sound = Main.soundInstanceZombie[index1]; break; case 30: int index10 = Main.rand.Next(10, 12); if (Main.rand.Next(300) == 0) { index10 = 12; if (Main.soundInstanceZombie[index10].State == SoundState.Playing) return (SoundEffectInstance) null; } Main.soundInstanceZombie[index10] = Main.soundZombie[index10].CreateInstance(); Main.soundInstanceZombie[index10].Volume = num5 * 0.75f; Main.soundInstanceZombie[index10].Pan = num2; Main.soundInstanceZombie[index10].Pitch = index10 == 12 ? (float) Main.rand.Next(-40, 21) * 0.01f : (float) Main.rand.Next(-70, 1) * 0.01f; sound = Main.soundInstanceZombie[index10]; break; case 31: int index11 = 13; Main.soundInstanceZombie[index11] = Main.soundZombie[index11].CreateInstance(); Main.soundInstanceZombie[index11].Volume = num5 * 0.35f; Main.soundInstanceZombie[index11].Pan = num2; Main.soundInstanceZombie[index11].Pitch = (float) Main.rand.Next(-40, 21) * 0.01f; sound = Main.soundInstanceZombie[index11]; break; case 32: if (Main.soundInstanceZombie[index1].State == SoundState.Playing) return (SoundEffectInstance) null; Main.soundInstanceZombie[index1] = Main.soundZombie[index1].CreateInstance(); Main.soundInstanceZombie[index1].Volume = num5 * 0.15f; Main.soundInstanceZombie[index1].Pan = num2; Main.soundInstanceZombie[index1].Pitch = (float) Main.rand.Next(-70, 26) * 0.01f; sound = Main.soundInstanceZombie[index1]; break; case 33: int index12 = 15; if (Main.soundInstanceZombie[index12].State == SoundState.Playing) return (SoundEffectInstance) null; Main.soundInstanceZombie[index12] = Main.soundZombie[index12].CreateInstance(); Main.soundInstanceZombie[index12].Volume = num5 * 0.2f; Main.soundInstanceZombie[index12].Pan = num2; Main.soundInstanceZombie[index12].Pitch = (float) Main.rand.Next(-10, 31) * 0.01f; sound = Main.soundInstanceZombie[index12]; break; case 34: float num8 = (float) index1 / 50f; if ((double) num8 > 1.0) num8 = 1f; float num9 = num5 * num8 * 0.2f; if ((double) num9 <= 0.0 || x == -1 || y == -1) { if (Main.soundInstanceLiquid[0].State == SoundState.Playing) { Main.soundInstanceLiquid[0].Stop(); break; } break; } if (Main.soundInstanceLiquid[0].State == SoundState.Playing) { Main.soundInstanceLiquid[0].Volume = num9; Main.soundInstanceLiquid[0].Pan = num2; Main.soundInstanceLiquid[0].Pitch = -0.2f; break; } Main.soundInstanceLiquid[0] = Main.soundLiquid[0].CreateInstance(); Main.soundInstanceLiquid[0].Volume = num9; Main.soundInstanceLiquid[0].Pan = num2; sound = Main.soundInstanceLiquid[0]; break; case 35: float num10 = (float) index1 / 50f; if ((double) num10 > 1.0) num10 = 1f; float num11 = num5 * num10 * 0.65f; if ((double) num11 <= 0.0 || x == -1 || y == -1) { if (Main.soundInstanceLiquid[1].State == SoundState.Playing) { Main.soundInstanceLiquid[1].Stop(); break; } break; } if (Main.soundInstanceLiquid[1].State == SoundState.Playing) { Main.soundInstanceLiquid[1].Volume = num11; Main.soundInstanceLiquid[1].Pan = num2; Main.soundInstanceLiquid[1].Pitch = -0.0f; break; } Main.soundInstanceLiquid[1] = Main.soundLiquid[1].CreateInstance(); Main.soundInstanceLiquid[1].Volume = num11; Main.soundInstanceLiquid[1].Pan = num2; sound = Main.soundInstanceLiquid[1]; break; case 36: int index13 = Style; if (Style == -1) index13 = 0; Main.soundInstanceRoar[index13] = Main.soundRoar[index13].CreateInstance(); Main.soundInstanceRoar[index13].Volume = num5; Main.soundInstanceRoar[index13].Pan = num2; if (Style == -1) Main.soundInstanceRoar[index13].Pitch += 0.6f; sound = Main.soundInstanceRoar[index13]; break; case 37: int index14 = Main.rand.Next(57, 59); float num12 = num5 * ((float) Style * 0.05f); Main.soundInstanceItem[index14] = Main.soundItem[index14].CreateInstance(); Main.soundInstanceItem[index14].Volume = num12; Main.soundInstanceItem[index14].Pan = num2; Main.soundInstanceItem[index14].Pitch = (float) Main.rand.Next(-40, 41) * 0.01f; sound = Main.soundInstanceItem[index14]; break; case 38: int index15 = Main.rand.Next(5); Main.soundInstanceCoin[index15] = Main.soundCoin[index15].CreateInstance(); Main.soundInstanceCoin[index15].Volume = num5; Main.soundInstanceCoin[index15].Pan = num2; Main.soundInstanceCoin[index15].Pitch = (float) Main.rand.Next(-40, 41) * (1f / 500f); sound = Main.soundInstanceCoin[index15]; break; case 39: int index16 = Style; Main.soundInstanceDrip[index16] = Main.soundDrip[index16].CreateInstance(); Main.soundInstanceDrip[index16].Volume = num5 * 0.5f; Main.soundInstanceDrip[index16].Pan = num2; Main.soundInstanceDrip[index16].Pitch = (float) Main.rand.Next(-30, 31) * 0.01f; sound = Main.soundInstanceDrip[index16]; break; case 40: Main.soundInstanceCamera.Stop(); Main.soundInstanceCamera = Main.soundCamera.CreateInstance(); Main.soundInstanceCamera.Volume = num5; Main.soundInstanceCamera.Pan = num2; sound = Main.soundInstanceCamera; break; case 41: Main.soundInstanceMoonlordCry = Main.soundNPCKilled[10].CreateInstance(); Main.soundInstanceMoonlordCry.Volume = (float) (1.0 / (1.0 + (double) (new Vector2((float) x, (float) y) - Main.player[Main.myPlayer].position).Length())); Main.soundInstanceMoonlordCry.Pan = num2; Main.soundInstanceMoonlordCry.Pitch = (float) Main.rand.Next(-10, 11) * 0.01f; sound = Main.soundInstanceMoonlordCry; break; case 42: sound = Main.trackableSounds[index1].CreateInstance(); sound.Volume = num5; sound.Pan = num2; Main.trackableSoundInstances[index1] = sound; break; } if (sound != null) { sound.Pitch += pitchOffset; sound.Volume *= volumeScale; Main.PlaySoundInstance(sound); } return sound; } } catch { } return (SoundEffectInstance) null; } 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(); Main.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(); Main.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) { if (Main.graphics.IsFullScreen != fullscreen) Main.graphics.ToggleFullScreen(); 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; if (!Main.instance.IsActive && (Main.screenBorderless || Main.screenMaximized || Main.graphics.IsFullScreen)) return; bool flag2 = false; int num1; int num2; if (Main.screenBorderless || Main.screenMaximized || Main.graphics.IsFullScreen) { form.MinimumSize = new Size(0, 0); if (Main.screenBorderless && !Main.graphics.IsFullScreen && Main.screenBorderlessPendingResizes > 0) { --Main.screenBorderlessPendingResizes; System.Drawing.Rectangle bounds = Screen.FromPoint(form.Location).Bounds; width = bounds.Width; height = bounds.Height; } 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); } 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 { 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 viewport1 = Main.graphics.GraphicsDevice.Viewport; num1 = viewport1.Width; viewport1 = Main.graphics.GraphicsDevice.Viewport; num2 = viewport1.Height; int preferredBackBufferWidth = Main.graphics.PreferredBackBufferWidth; Viewport viewport2 = Main.graphics.GraphicsDevice.Viewport; int width1 = viewport2.Width; int num7; if (preferredBackBufferWidth == width1) { int backBufferHeight = Main.graphics.PreferredBackBufferHeight; viewport2 = Main.graphics.GraphicsDevice.Viewport; int height1 = viewport2.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 (((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) { form.SendToBack(); form.BringToFront(); if (Main.screenBorderless) { if (Main.screenBorderlessPendingResizes > 0) { --Main.screenBorderlessPendingResizes; System.Drawing.Rectangle bounds = Screen.FromPoint(form.Location).Bounds; form.Location = new System.Drawing.Point(bounds.X, bounds.Y); form.Width = bounds.Width; form.Height = bounds.Height; form.FormBorderStyle = FormBorderStyle.None; } } else form.FormBorderStyle = FormBorderStyle.Sizable; } Lighting.Initialize(true); if (!Main.drawToScreen) Main.instance.InitTargets(); UserInterface.ActiveInstance.Recalculate(); Console.WriteLine(Language.GetTextValue("Misc.ResolutionChanged", (object) width, (object) height)); } if (Main.graphics.SynchronizeWithVerticalRetrace) return; Main.graphics.SynchronizeWithVerticalRetrace = true; Main.graphics.ApplyChanges(); } public static void FixUIScale() => Main.UIScale = Main.UIScaleWanted; public void UpdateDisplaySettings() { Viewport viewport = this.GraphicsDevice.Viewport; int width = viewport.Width; viewport = this.GraphicsDevice.Viewport; int height = viewport.Height; Main.SetResolution(width, height); } public static void OpenPlayerSelect(Main.OnPlayerSelected method) { if (Main.gameMenu && (Main.menuMode == 10 || Main.menuMode == 14)) 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 delegate void OnPlayerSelected(PlayerFileData player); } }