using Microsoft.Win32; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using System; using System.Diagnostics; using System.IO; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Text; using System.Threading; namespace Terraria { public class Main : Game { public const int maxItemTypes = 1725; public const int maxProjectileTypes = 311; public const int maxNPCTypes = 301; public const int maxTileSets = 251; public const int maxWallTypes = 113; public const int maxGoreTypes = 438; public const int numArmorHead = 112; public const int numArmorBody = 75; public const int numArmorLegs = 64; public const int maxBuffs = 81; public const int maxWings = 21; public const int maxBackgrounds = 185; private const int MF_BYPOSITION = 1024; public const int sectionWidth = 200; public const int sectionHeight = 150; public const int maxDust = 6000; public const int maxCombatText = 100; public const int maxItemText = 20; public const int maxPlayers = 255; public const int maxChests = 1000; public const int maxItems = 400; public const int maxProjectiles = 1000; public const int maxNPCs = 200; public const int maxGore = 500; public const int realInventory = 50; public const int maxInventory = 58; public const int maxItemSounds = 51; public const int maxNPCHitSounds = 13; public const int maxNPCKilledSounds = 19; public const int maxLiquidTypes = 12; public const int maxMusic = 30; public const double dayLength = 54000.0; public const double nightLength = 32400.0; public const int maxStars = 130; public const int maxStarTypes = 5; public const int maxClouds = 200; public const int maxCloudTypes = 22; public const int maxHair = 51; public static int curRelease = 71; public static string versionNumber = "v1.2.0.3.1"; public static string versionNumber2 = "v1.2.0.3.1"; public static bool ServerSideCharacter = false; public static string clientUUID; public static int maxMsg = 69; public static Effect pixelShader; public static Effect tileShader; 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 static bool[] hairLoaded = new bool[51]; public static bool[] wingsLoaded = new bool[21]; public static bool[] goreLoaded = new bool[438]; public static bool[] projectileLoaded = new bool[311]; public static bool[] itemFlameLoaded = new bool[1725]; public static bool[] backgroundLoaded = new bool[185]; public static bool[] tileSetsLoaded = new bool[251]; public static bool[] wallLoaded = new bool[113]; public static bool[] NPCLoaded = new bool[301]; public static bool[] armorHeadLoaded = new bool[112]; public static bool[] armorBodyLoaded = new bool[75]; public static bool[] armorLegsLoaded = new bool[64]; public static float zoomX; public static float zoomY; public static float sunCircle; public static int BlackFadeIn = 0; public static bool noWindowBorder = false; private Matrix Transform = Matrix.CreateScale(1f, 1f, 1f) * Matrix.CreateRotationZ(0f) * Matrix.CreateTranslation(new Vector3(0f, 0f, 0f)); private RasterizerState Rasterizer = RasterizerState.CullCounterClockwise; 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 int oldTempLightCount = 0; public static bool[] nextNPC = new bool[301]; public static int musicBox = -1; public static int musicBox2 = -1; public static byte hbPosition = 1; public static bool cEd = false; public static float wFrCounter = 0f; public static float wFrame = 0f; public static float wFallFrCounter = 0f; public static float wFallFrame = 0f; public static float wFallFrCounter2 = 0f; public static float wFallFrame2 = 0f; public static float wFallFrCounter3 = 0f; public static float wFallFrame3 = 0f; public static float wFallFrCounter4 = 0f; public static float wFallFrame4 = 0f; public static int findWaterfallCount = 0; public static int waterfallDist = 100; public static float upTimer; public static float upTimerMax; public static float upTimerMaxDelay; public static float[] drawTimer = new float[10]; public static float[] drawTimerMax = new float[10]; public static float[] drawTimerMaxDelay = new float[10]; public static float[] renderTimer = new float[10]; public static float[] lightTimer = new float[10]; public static bool drawDiag = false; public static bool drawRelease = 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 bool mouseLeft; public static bool mouseRight; 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[] { 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 int snowDust = 0; public static bool chTitle = false; public static int keyCount = 0; public static string[] keyString = new string[10]; public static int[] keyInt = new int[10]; public static int wfTileMax = 200; public static int[] wfTileX = new int[Main.wfTileMax]; public static int[] wfTileY = new int[Main.wfTileMax]; public static int[] wfTileType = new int[Main.wfTileMax]; public static int wfTileNum = 0; public static byte gFade = 0; public static float gFader = 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 float uCarry = 0f; public static bool drawSkip = false; public static int fpsCount = 0; public static Stopwatch fpsTimer = new Stopwatch(); public static Stopwatch updateTimer = new Stopwatch(); public bool gammaTest; public static int fountainColor = -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 minScreenW = 800; public static int maxScreenH = 1200; 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 = 0f; public static bool[] projHostile = new bool[311]; public static bool[] pvpBuff = new bool[81]; public static bool[] vanityPet = new bool[81]; public static bool[] lightPet = new bool[81]; public static bool[] meleeBuff = new bool[81]; public static bool[] debuff = new bool[81]; public static string[] buffName = new string[81]; public static string[] buffTip = new string[81]; 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 owBack = 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 bool showNPCs; public int mouseNPC = -1; public static int wof = -1; public static int wofT; public static int wofB; public static int wofF = 0; private static int offScreenRange = 200; private RenderTarget2D backWaterTarget; private RenderTarget2D waterTarget; private RenderTarget2D tileTarget; private RenderTarget2D blackTarget; private RenderTarget2D tile2Target; private RenderTarget2D wallTarget; private RenderTarget2D backgroundTarget; 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 textureMax = 2000; 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 bool mapUnfinished; public static int mapTimeMax = 30; public static int mapTime = Main.mapTimeMax; public static bool clearMap; public static int mapTargetX = 5; public static int mapTargetY = 2; private RenderTarget2D[,] mapTarget = new RenderTarget2D[Main.mapTargetX, Main.mapTargetY]; public static bool[,] initMap = new bool[Main.mapTargetX, Main.mapTargetY]; private Texture2D[] mapIconTexture = new Texture2D[9]; private 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 hueTexture; private Texture2D colorSliderTexture; private Texture2D colorBarTexture; private Texture2D colorBlipTexture; private Texture2D iceBarrierTexture; public static bool mapInit = false; public static bool mapEnabled = true; public static int mapStyle = 1; public static float grabMapX = 0f; public static float grabMapY = 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 int firstTileX; private int lastTileX; private int firstTileY; private int lastTileY; private double bgParrallax; private int bgStart; private int bgLoops; private int bgStartY; private int bgLoopsY; private int bgTop; public static int renderCount = 99; private GraphicsDeviceManager graphics; private SpriteBatch spriteBatch; private Process tServer = new Process(); private static Stopwatch saveTime = new Stopwatch(); public static MouseState mouseState = Mouse.GetState(); public static MouseState oldMouseState = Mouse.GetState(); public static KeyboardState keyState = Keyboard.GetState(); public static Color mcColor = new Color(125, 125, 255); public static Color hcColor = new Color(200, 125, 255); public static Color bgColor; public static bool mouseHC = false; public static string chestText = "Chest"; 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[81]; public static Item trashItem = new Item(); 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 static bool drawScene = false; public static Vector2 sceneWaterPos = default(Vector2); public static Vector2 sceneTilePos = default(Vector2); public static Vector2 sceneTile2Pos = default(Vector2); public static Vector2 sceneWallPos = default(Vector2); public static Vector2 sceneBackgroundPos = default(Vector2); public static bool maxQ = true; public static float gfxQuality = 1f; public static float gfxRate = 0.01f; public int DiscoStyle; public static int DiscoR = 255; 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 int updateTime = 0; public static int drawTime = 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 = 0f; public static float rightWorld = 134400f; public static float topWorld = 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 static int maxSectionsX = Main.maxTilesX / 200; public static int maxSectionsY = Main.maxTilesY / 150; public static int numDust = 6000; public static int numPlayers = 0; public static int maxNetPlayers = 255; public static string[] chrName = new string[301]; public static int maxRain = 750; public int invBottom = 210; public static float cameraX = 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 caveParrallax = 1f; public static string[] tileName = new string[251]; public static int dungeonX; public static int dungeonY; public static Liquid[] liquid = new Liquid[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 int newMusic; public static bool showItemText = true; public static bool autoSave = true; public static string buffString = ""; public static string libPath = ""; public static int lo = 0; public static int LogoA = 255; 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 = 0f; public static Color tileColor; public static double worldSurface; public static double rockLayer; public static Color[] teamColor = new Color[5]; 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 float cloudAlpha = 0f; public static float maxRaining = 0f; public static float oldMaxRaining = 0f; public static int rainTime = 0; public static bool raining = false; public static bool eclipse = false; public static float eclipseLight = 0f; public static int checkForSpawns = 0; public static int helpText = 0; public static bool autoGen = false; public static bool autoPause = false; public static int[] projFrames = new int[311]; public static bool[] projPet = new bool[311]; public static float demonTorch = 1f; public static int demonTorchDir = 1; public static int numStars; 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 = 0f; public static float windSpeed = 0f; public static float windSpeedSet = 0f; public static float windSpeedSpeed = 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 meteorTiles; public static int bloodTiles; public static int jungleTiles; public static int dungeonTiles; public static bool campfire; public static int fadeCounter = 0; public static float invAlpha = 1f; public static float invDir = 1f; [ThreadStatic] public static Random rand; public static Texture2D[] bannerTexture = new Texture2D[3]; public static Texture2D[] npcHeadTexture = new Texture2D[20]; public static Texture2D craftButtonTexture; public static Texture2D craftUpButtonTexture; public static Texture2D craftDownButtonTexture; public static Texture2D frozenTexture; public static Texture2D magicPixel; 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[6]; public static Texture2D[] wingsTexture = new Texture2D[21]; public static Texture2D[] armorHeadTexture = new Texture2D[112]; public static Texture2D[] armorBodyTexture = new Texture2D[75]; public static Texture2D[] femaleBodyTexture = new Texture2D[75]; public static Texture2D[] armorArmTexture = new Texture2D[75]; public static Texture2D[] armorLegTexture = new Texture2D[64]; public static Texture2D pulleyTexture; public static Texture2D[] FlameTexture = new Texture2D[7]; public static Texture2D timerTexture; public static Texture2D reforgeTexture; public static Texture2D wallOutlineTexture; public static Texture2D actuatorTexture; public static Texture2D wireTexture; public static Texture2D wire2Texture; public static Texture2D wire3Texture; public static Texture2D flyingCarpetTexture; public static Texture2D gridTexture; public static Texture2D lightDiscTexture; public static Texture2D MusicBoxTexture; public static Texture2D EyeLaserTexture; public static Texture2D BoneEyesTexture; public static Texture2D BoneLaserTexture; public static Texture2D trashTexture; public static Texture2D chainTexture; public static Texture2D probeTexture; public static Texture2D[] golemTexture = new Texture2D[4]; public static Texture2D confuseTexture; public static Texture2D[] gemChainTexture = new Texture2D[7]; public static Texture2D sunOrbTexture; public static Texture2D sunAltarTexture; 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 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[] npcToggleTexture = new Texture2D[2]; public static Texture2D[] HBLockTexture = new Texture2D[2]; public static Texture2D[] buffTexture = new Texture2D[81]; public static Texture2D[] itemTexture = new Texture2D[1725]; public static Texture2D[] itemFlameTexture = new Texture2D[1725]; public static Texture2D[] npcTexture = new Texture2D[301]; public static Texture2D[] projectileTexture = new Texture2D[311]; public static Texture2D[] goreTexture = new Texture2D[438]; public static Texture2D[] BackPackTexture = new Texture2D[5]; public static Texture2D[] rainTexture = new Texture2D[3]; public static Texture2D cursorTexture; 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 int numTileColors = 28; public static RenderTarget2D[,] tileAltTexture = new RenderTarget2D[251, Main.numTileColors]; public static bool[,] tileAltTextureInit = new bool[251, Main.numTileColors]; public static bool[,] tileAltTextureDrawn = new bool[251, Main.numTileColors]; public static int numTreeStyles = 15; 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[113, Main.numTileColors]; public static bool[,] wallAltTextureInit = new bool[113, Main.numTileColors]; public static bool[,] wallAltTextureDrawn = new bool[113, Main.numTileColors]; public static Texture2D[] tileTexture = new Texture2D[251]; public static Texture2D blackTileTexture; public static Texture2D[] wallTexture = new Texture2D[113]; public static Texture2D[] backgroundTexture = new Texture2D[185]; public static Texture2D[] cloudTexture = new Texture2D[22]; public static Texture2D[] starTexture = new Texture2D[5]; public static Texture2D[] liquidTexture = new Texture2D[12]; public static Texture2D[] waterfallTexture = new Texture2D[15]; 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 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 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 reaperEyeTexture; public static Texture2D skinBodyTexture; public static Texture2D skinLegsTexture; public static Texture2D playerEyeWhitesTexture; public static Texture2D playerEyesTexture; public static Texture2D playerHandsTexture; public static Texture2D playerHands2Texture; public static Texture2D playerHeadTexture; public static Texture2D playerPantsTexture; public static Texture2D playerShirtTexture; public static Texture2D playerShoesTexture; public static Texture2D playerUnderShirtTexture; public static Texture2D playerUnderShirt2Texture; public static Texture2D femaleShirt2Texture; public static Texture2D femalePantsTexture; public static Texture2D femaleShirtTexture; public static Texture2D femaleShoesTexture; public static Texture2D femaleUnderShirtTexture; public static Texture2D femaleUnderShirt2Texture; public static Texture2D[] playerHairTexture = new Texture2D[51]; public static Texture2D[] playerHairAltTexture = new Texture2D[51]; 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[] 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[52]; public static SoundEffectInstance[] soundInstanceItem = new SoundEffectInstance[52]; public static SoundEffect[] soundNPCHit = new SoundEffect[14]; public static SoundEffectInstance[] soundInstanceNPCHit = new SoundEffectInstance[14]; public static SoundEffect[] soundNPCKilled = new SoundEffect[20]; public static SoundEffectInstance[] soundInstanceNPCKilled = new SoundEffectInstance[20]; 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[] soundZombie = new SoundEffect[10]; public static SoundEffectInstance[] soundInstanceZombie = new SoundEffectInstance[10]; public static SoundEffect[] soundRoar = new SoundEffect[2]; public static SoundEffectInstance[] soundInstanceRoar = new SoundEffectInstance[2]; 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 AudioEngine engine; public static SoundBank soundBank; public static WaveBank waveBank; public static Cue[] music = new Cue[30]; public static float[] musicFade = new float[30]; public static float musicVolume = 0.75f; public static float soundVolume = 1f; public static SpriteFont fontItemStack; public static SpriteFont fontMouseText; public static SpriteFont fontDeathText; public static SpriteFont[] fontCombatText = new SpriteFont[2]; public static bool[] tileLighted = new bool[251]; public static bool[] tileMergeDirt = new bool[251]; public static bool[] tileCut = new bool[251]; public static bool[] tileAlch = new bool[251]; public static int[] tileShine = new int[251]; public static bool[] tileShine2 = new bool[251]; public static bool[] wallHouse = new bool[113]; public static bool[] wallDungeon = new bool[113]; public static bool[] wallLight = new bool[113]; public static int[] wallBlend = new int[113]; public static bool[] tileStone = new bool[251]; public static bool[] tilePick = new bool[251]; public static bool[] tileAxe = new bool[251]; public static bool[] tileHammer = new bool[251]; public static bool[] tileWaterDeath = new bool[251]; public static bool[] tileLavaDeath = new bool[251]; public static bool[] tileTable = new bool[251]; public static bool[] tileBlockLight = new bool[251]; public static bool[] tileNoSunLight = new bool[251]; public static bool[] tileDungeon = new bool[251]; public static bool[] tileSolidTop = new bool[251]; public static bool[] tileSolid = new bool[251]; public static bool[] tileRope = new bool[251]; public static bool[] tileBrick = new bool[251]; public static bool[] tileMoss = new bool[251]; public static bool[] tileNoAttach = new bool[251]; public static bool[] tileNoFail = new bool[251]; public static bool[] tileFrameImportant = new bool[251]; public static bool[] tileSand = new bool[251]; public static bool[] tileFlame = new bool[251]; public static int[] tileFrame = new int[251]; public static int[] tileFrameCounter = new int[251]; public static int[] backgroundWidth = new int[185]; public static int[] backgroundHeight = new int[185]; public static bool tilesLoaded = false; public static Map[,] map = new Map[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 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 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 Vector2 screenPosition; public static Vector2 screenLastPosition; public static int screenWidth = 1152; public static int screenHeight = 864; public static int chatLength = 600; public static bool chatMode = 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 float[] hotbarScale = new float[] { 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(); private static float inventoryScale = 0.75f; public static bool hasFocus = true; 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 int spawnTileX; public static int spawnTileY; public static bool npcChatRelease = false; public static bool editSign = false; public static string signText = ""; 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 numShops = 18; public Chest[] shop = new Chest[Main.numShops]; public static bool craftGuide = false; public static bool reforge = false; private static Item toolTip = new Item(); private static int backSpaceCount = 0; public static string motd = ""; public bool toggleFullscreen; private int numDisplayModes; private int[] displayWidth = new int[99]; private int[] displayHeight = new int[99]; public static bool gameMenu = true; private static int maxLoadPlayer = 1000; private static int maxLoadWorld = 1000; public static Player[] loadPlayer = new Player[Main.maxLoadPlayer]; public static string[] loadPlayerPath = new string[Main.maxLoadPlayer]; private static int numLoadPlayers = 0; public static string playerPathName; public static string[] loadWorld = new string[Main.maxLoadWorld]; public static string[] loadWorldPath = new string[Main.maxLoadWorld]; private static int numLoadWorlds = 0; public static string worldPathName; public static string SavePath = string.Concat(new object[] { Environment.GetFolderPath(Environment.SpecialFolder.Personal), Path.DirectorySeparatorChar, "My Games", Path.DirectorySeparatorChar, "Terraria" }); public static string WorldPath = Main.SavePath + Path.DirectorySeparatorChar + "Worlds"; public static string PlayerPath = Main.SavePath + Path.DirectorySeparatorChar + "Players"; public static string[] itemName = new string[1725]; public static string[] npcName = new string[301]; private static KeyboardState inputText; private static KeyboardState oldInputText; 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[] npcFrameCount = new int[] { 1, 2, 2, 3, 6, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 16, 14, 16, 14, 15, 16, 2, 10, 1, 16, 16, 16, 3, 1, 15, 3, 1, 3, 1, 1, 16, 16, 1, 1, 1, 3, 3, 15, 3, 7, 7, 4, 5, 5, 5, 3, 3, 16, 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, 16, 16, 12, 20, 21, 1, 2, 2, 3, 6, 1, 1, 1, 15, 4, 11, 1, 14, 6, 6, 3, 1, 2, 2, 1, 3, 4, 1, 2, 1, 4, 2, 1, 15, 3, 16, 4, 5, 7, 3, 2, 12, 12, 4, 4, 4, 8, 8, 9, 2, 6, 4, 15, 16, 3, 3, 8, 5, 4, 3, 15, 12, 4, 14, 14, 3, 2, 5, 3, 2, 3, 14, 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, 16, 14, 16, 4, 4, 16, 16, 20, 20, 20, 2, 2, 2, 2, 8, 12, 3, 4, 2, 4, 16, 16, 15, 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 }; 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.serverPort); public static bool menuMultiplayer = false; public static bool menuServer = false; public static int netMode = 0; public static int timeOut = 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 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 Color mouseColor = new Color(255, 50, 95); public static Color cursorColor = Color.White; public static int cursorColorDirection = 1; public static float cursorAlpha = 0f; public static float cursorScale = 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 bool fixedTiming = false; private int splashCounter; public static string oldStatusText = ""; public static bool autoShutdown = false; public int a; public int b; 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 = 14; private float[] menuItemScale = new float[Main.maxMenuItems]; private int focusMenu = -1; private int selectedMenu = -1; private int selectedMenu2 = -1; private int selectedPlayer; private int selectedWorld; public static int menuMode = 0; public static int menuSkip = 0; private static Item cpItem = new Item(); private int textBlinkerCount; private int textBlinkerState; public static string newWorldName = ""; private static int dyeSlotCount = 0; private static int accSlotCount = 0; private static string hoverItemName = ""; private static Color inventoryBack = new Color(220, 220, 220, 220); private static bool mouseText = false; private static int mH = 0; private static int sX = Main.screenWidth - 800; private static int starMana = 20; private static float heartLife = 20f; private static int rare = 0; private Color selColor = Color.White; private int focusColor; private int colorDelay; private int setKey = -1; private int bgScroll; public static bool autoPass = false; public static int menuFocus = 0; private float hBar = -1f; private float sBar = -1f; private float lBar = 1f; private int grabColorSlider; private bool blockMouse; private bool[] menuWide = new bool[100]; private static float tranSpeed = 0.05f; private static float atmo = 0f; private static float bgScale = 1f; private static int bgW = (int)(1024f * Main.bgScale); private static Color backColor = Color.White; private static Color trueBackColor = Main.backColor; private float screenOff; private float scAdj; private float cTop; [CompilerGenerated] private static Action CachedAnonymousMethodDelegate1; [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 void LoadWorlds() { Directory.CreateDirectory(Main.WorldPath); string[] files = Directory.GetFiles(Main.WorldPath, "*.wld"); int num = files.Length; if (!Main.dedServ && num > Main.maxLoadWorld) { num = Main.maxLoadWorld; } for (int i = 0; i < num; i++) { Main.loadWorldPath[i] = files[i]; try { using (FileStream fileStream = new FileStream(Main.loadWorldPath[i], FileMode.Open)) { using (BinaryReader binaryReader = new BinaryReader(fileStream)) { binaryReader.ReadInt32(); Main.loadWorld[i] = binaryReader.ReadString(); binaryReader.Close(); } } } catch { Main.loadWorld[i] = Main.loadWorldPath[i]; } } Main.numLoadWorlds = num; } private static void LoadPlayers() { Directory.CreateDirectory(Main.PlayerPath); string[] files = Directory.GetFiles(Main.PlayerPath, "*.plr"); int num = files.Length; if (num > Main.maxLoadPlayer) { num = Main.maxLoadPlayer; } for (int i = 0; i < num; i++) { Main.loadPlayer[i] = new Player(); if (i < num) { Main.loadPlayerPath[i] = files[i]; Main.loadPlayer[i] = Player.LoadPlayer(Main.loadPlayerPath[i]); } } Main.numLoadPlayers = num; } protected void OpenRecent() { try { if (File.Exists(Main.SavePath + Path.DirectorySeparatorChar + "servers.dat")) { using (FileStream fileStream = new FileStream(Main.SavePath + Path.DirectorySeparatorChar + "servers.dat", FileMode.Open)) { using (BinaryReader binaryReader = new BinaryReader(fileStream)) { binaryReader.ReadInt32(); for (int i = 0; i < 10; i++) { Main.recentWorld[i] = binaryReader.ReadString(); Main.recentIP[i] = binaryReader.ReadString(); Main.recentPort[i] = binaryReader.ReadInt32(); } } } } } catch { } } public static void SaveRecent() { Directory.CreateDirectory(Main.SavePath); try { File.SetAttributes(Main.SavePath + Path.DirectorySeparatorChar + "servers.dat", FileAttributes.Normal); } catch { } try { using (FileStream fileStream = new FileStream(Main.SavePath + Path.DirectorySeparatorChar + "servers.dat", FileMode.Create)) { using (BinaryWriter binaryWriter = new BinaryWriter(fileStream)) { binaryWriter.Write(Main.curRelease); for (int i = 0; i < 10; i++) { binaryWriter.Write(Main.recentWorld[i]); binaryWriter.Write(Main.recentIP[i]); binaryWriter.Write(Main.recentPort[i]); } } } } catch { } } protected void SaveSettings() { Directory.CreateDirectory(Main.SavePath); try { File.SetAttributes(Main.SavePath + Path.DirectorySeparatorChar + "config.dat", FileAttributes.Normal); } catch { } try { using (FileStream fileStream = new FileStream(Main.SavePath + Path.DirectorySeparatorChar + "config.dat", FileMode.Create)) { using (BinaryWriter binaryWriter = new BinaryWriter(fileStream)) { binaryWriter.Write(Main.curRelease); binaryWriter.Write(Main.clientUUID); binaryWriter.Write(this.graphics.IsFullScreen); binaryWriter.Write(Main.mouseColor.R); binaryWriter.Write(Main.mouseColor.G); binaryWriter.Write(Main.mouseColor.B); binaryWriter.Write(Main.soundVolume); binaryWriter.Write(Main.musicVolume); binaryWriter.Write(Main.cUp); binaryWriter.Write(Main.cDown); binaryWriter.Write(Main.cLeft); binaryWriter.Write(Main.cRight); binaryWriter.Write(Main.cJump); binaryWriter.Write(Main.cThrowItem); binaryWriter.Write(Main.cInv); binaryWriter.Write(Main.cHeal); binaryWriter.Write(Main.cMana); binaryWriter.Write(Main.cBuff); binaryWriter.Write(Main.cHook); binaryWriter.Write(Main.caveParrallax); binaryWriter.Write(Main.fixedTiming); binaryWriter.Write(this.graphics.PreferredBackBufferWidth); binaryWriter.Write(this.graphics.PreferredBackBufferHeight); binaryWriter.Write(Main.autoSave); binaryWriter.Write(Main.autoPause); binaryWriter.Write(Main.showItemText); binaryWriter.Write(Main.cTorch); binaryWriter.Write((byte)Lighting.lightMode); binaryWriter.Write((byte)Main.qaStyle); binaryWriter.Write(Main.owBack); binaryWriter.Write((byte)Lang.lang); binaryWriter.Write(Main.mapEnabled); binaryWriter.Write(Main.cMapStyle); binaryWriter.Write(Main.cMapFull); binaryWriter.Write(Main.cMapZoomIn); binaryWriter.Write(Main.cMapZoomOut); binaryWriter.Write(Main.cMapAlphaUp); binaryWriter.Write(Main.cMapAlphaDown); binaryWriter.Close(); } } } catch { } } protected void CheckBunny() { try { RegistryKey registryKey = Registry.CurrentUser; registryKey = registryKey.CreateSubKey("Software\\Terraria"); if (registryKey != null && registryKey.GetValue("Bunny") != null && registryKey.GetValue("Bunny").ToString() == "1") { Main.cEd = true; } } catch { Main.cEd = false; } } protected void OpenSettings() { try { bool flag = false; if (File.Exists(Main.SavePath + Path.DirectorySeparatorChar + "config.dat")) { using (FileStream fileStream = new FileStream(Main.SavePath + Path.DirectorySeparatorChar + "config.dat", FileMode.Open)) { using (BinaryReader binaryReader = new BinaryReader(fileStream)) { int num = binaryReader.ReadInt32(); if (num < 68) { flag = true; } else { if (num >= 67) { Main.clientUUID = binaryReader.ReadString(); } else { flag = true; } bool flag2 = binaryReader.ReadBoolean(); Main.mouseColor.R = binaryReader.ReadByte(); Main.mouseColor.G = binaryReader.ReadByte(); Main.mouseColor.B = binaryReader.ReadByte(); Main.soundVolume = 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 (num >= 1) { Main.cInv = binaryReader.ReadString(); } if (num >= 12) { Main.cHeal = binaryReader.ReadString(); Main.cMana = binaryReader.ReadString(); Main.cBuff = binaryReader.ReadString(); } if (num >= 13) { Main.cHook = binaryReader.ReadString(); } Main.caveParrallax = binaryReader.ReadSingle(); if (num >= 2) { Main.fixedTiming = binaryReader.ReadBoolean(); } if (num >= 4) { this.graphics.PreferredBackBufferWidth = binaryReader.ReadInt32(); this.graphics.PreferredBackBufferHeight = binaryReader.ReadInt32(); } if (num >= 8) { Main.autoSave = binaryReader.ReadBoolean(); } if (num >= 9) { Main.autoPause = binaryReader.ReadBoolean(); } if (num >= 19) { Main.showItemText = binaryReader.ReadBoolean(); } if (num >= 30) { Main.cTorch = binaryReader.ReadString(); Lighting.lightMode = (int)binaryReader.ReadByte(); Main.qaStyle = (int)binaryReader.ReadByte(); } if (num >= 37) { Main.owBack = binaryReader.ReadBoolean(); } if (num >= 39) { Lang.lang = (int)binaryReader.ReadByte(); } if (num >= 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 (flag2 && !this.graphics.IsFullScreen) { this.graphics.ToggleFullScreen(); } } binaryReader.Close(); } } } if (flag) { this.SaveSettings(); } } catch { } } private static void ErasePlayer(int i) { try { File.Delete(Main.loadPlayerPath[i]); File.Delete(Main.loadPlayerPath[i] + ".bak"); } catch { } try { string path = Main.loadPlayerPath[i].Substring(0, Main.loadPlayerPath[i].Length - 4); if (Directory.Exists(path)) { Directory.Delete(path, true); } Main.LoadPlayers(); } catch { } } private static void EraseWorld(int i) { try { File.Delete(Main.loadWorldPath[i]); File.Delete(Main.loadWorldPath[i] + ".bak"); Main.LoadWorlds(); } catch { } } private static string getPlayerPathName(string playerName) { string text = ""; for (int i = 0; i < playerName.Length; i++) { string text2 = playerName.Substring(i, 1); string str; if (text2 == "a" || text2 == "b" || text2 == "c" || text2 == "d" || text2 == "e" || text2 == "f" || text2 == "g" || text2 == "h" || text2 == "i" || text2 == "j" || text2 == "k" || text2 == "l" || text2 == "m" || text2 == "n" || text2 == "o" || text2 == "p" || text2 == "q" || text2 == "r" || text2 == "s" || text2 == "t" || text2 == "u" || text2 == "v" || text2 == "w" || text2 == "x" || text2 == "y" || text2 == "z" || text2 == "A" || text2 == "B" || text2 == "C" || text2 == "D" || text2 == "E" || text2 == "F" || text2 == "G" || text2 == "H" || text2 == "I" || text2 == "J" || text2 == "K" || text2 == "L" || text2 == "M" || text2 == "N" || text2 == "O" || text2 == "P" || text2 == "Q" || text2 == "R" || text2 == "S" || text2 == "T" || text2 == "U" || text2 == "V" || text2 == "W" || text2 == "X" || text2 == "Y" || text2 == "Z" || text2 == "1" || text2 == "2" || text2 == "3" || text2 == "4" || text2 == "5" || text2 == "6" || text2 == "7" || text2 == "8" || text2 == "9" || text2 == "0") { str = text2; } else { if (text2 == " ") { str = "_"; } else { str = "-"; } } text += str; } if (File.Exists(string.Concat(new object[] { Main.PlayerPath, Path.DirectorySeparatorChar, text, ".plr" }))) { int num = 2; while (File.Exists(string.Concat(new object[] { Main.PlayerPath, Path.DirectorySeparatorChar, text, num, ".plr" }))) { num++; } text += num; } return string.Concat(new object[] { Main.PlayerPath, Path.DirectorySeparatorChar, text, ".plr" }); } private static string getWorldPathName(string worldName) { string text = ""; for (int i = 0; i < worldName.Length; i++) { string text2 = worldName.Substring(i, 1); string str; if (text2 == "a" || text2 == "b" || text2 == "c" || text2 == "d" || text2 == "e" || text2 == "f" || text2 == "g" || text2 == "h" || text2 == "i" || text2 == "j" || text2 == "k" || text2 == "l" || text2 == "m" || text2 == "n" || text2 == "o" || text2 == "p" || text2 == "q" || text2 == "r" || text2 == "s" || text2 == "t" || text2 == "u" || text2 == "v" || text2 == "w" || text2 == "x" || text2 == "y" || text2 == "z" || text2 == "A" || text2 == "B" || text2 == "C" || text2 == "D" || text2 == "E" || text2 == "F" || text2 == "G" || text2 == "H" || text2 == "I" || text2 == "J" || text2 == "K" || text2 == "L" || text2 == "M" || text2 == "N" || text2 == "O" || text2 == "P" || text2 == "Q" || text2 == "R" || text2 == "S" || text2 == "T" || text2 == "U" || text2 == "V" || text2 == "W" || text2 == "X" || text2 == "Y" || text2 == "Z" || text2 == "1" || text2 == "2" || text2 == "3" || text2 == "4" || text2 == "5" || text2 == "6" || text2 == "7" || text2 == "8" || text2 == "9" || text2 == "0") { str = text2; } else { if (text2 == " ") { str = "_"; } else { str = "-"; } } text += str; } if (File.Exists(string.Concat(new object[] { Main.WorldPath, Path.DirectorySeparatorChar, text, ".wld" }))) { int num = 2; while (File.Exists(string.Concat(new object[] { Main.WorldPath, Path.DirectorySeparatorChar, text, num, ".wld" }))) { num++; } text += num; } return string.Concat(new object[] { Main.WorldPath, Path.DirectorySeparatorChar, text, ".wld" }); } public void autoCreate(string newOpt) { if (newOpt == "0") { Main.autoGen = false; return; } if (newOpt == "1") { Main.maxTilesX = 4200; Main.maxTilesY = 1200; Main.autoGen = true; return; } if (newOpt == "2") { Main.maxTilesX = 6300; Main.maxTilesY = 1800; Main.autoGen = true; return; } if (newOpt == "3") { 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)) { using (StreamReader streamReader = new StreamReader(configPath)) { string text; while ((text = streamReader.ReadLine()) != null) { try { if (text.Length > 6 && text.Substring(0, 6).ToLower() == "world=") { string text2 = text.Substring(6); Main.worldPathName = text2; } if (text.Length > 5 && text.Substring(0, 5).ToLower() == "port=") { string value = text.Substring(5); try { int serverPort = Convert.ToInt32(value); Netplay.serverPort = serverPort; } catch { } } if (text.Length > 11 && text.Substring(0, 11).ToLower() == "maxplayers=") { string value2 = text.Substring(11); try { int num = Convert.ToInt32(value2); Main.maxNetPlayers = num; } catch { } } if (text.Length > 11 && text.Substring(0, 9).ToLower() == "priority=") { string value3 = text.Substring(9); try { int num2 = Convert.ToInt32(value3); if (num2 >= 0 && num2 <= 5) { Process currentProcess = Process.GetCurrentProcess(); if (num2 == 0) { currentProcess.PriorityClass = ProcessPriorityClass.RealTime; } else { if (num2 == 1) { currentProcess.PriorityClass = ProcessPriorityClass.High; } else { if (num2 == 2) { currentProcess.PriorityClass = ProcessPriorityClass.AboveNormal; } else { if (num2 == 3) { currentProcess.PriorityClass = ProcessPriorityClass.Normal; } else { if (num2 == 4) { currentProcess.PriorityClass = ProcessPriorityClass.BelowNormal; } else { if (num2 == 5) { currentProcess.PriorityClass = ProcessPriorityClass.Idle; } } } } } } } } catch { } } if (text.Length > 9 && text.Substring(0, 9).ToLower() == "password=") { string password = text.Substring(9); Netplay.password = password; } if (text.Length > 5 && text.Substring(0, 5).ToLower() == "motd=") { string text3 = text.Substring(5); Main.motd = text3; } if (text.Length > 5 && text.Substring(0, 5).ToLower() == "lang=") { string value4 = text.Substring(5); Lang.lang = Convert.ToInt32(value4); } if (text.Length >= 10 && text.Substring(0, 10).ToLower() == "worldpath=") { string worldPath = text.Substring(10); Main.WorldPath = worldPath; } if (text.Length >= 10 && text.Substring(0, 10).ToLower() == "worldname=") { string text4 = text.Substring(10); Main.worldName = text4; } if (text.Length > 8 && text.Substring(0, 8).ToLower() == "banlist=") { string banFile = text.Substring(8); Netplay.banFile = banFile; } if (text.Length > 11 && text.Substring(0, 11).ToLower() == "autocreate=") { string text5 = text.Substring(11); if (text5 == "0") { Main.autoGen = false; } else { if (text5 == "1") { Main.maxTilesX = 4200; Main.maxTilesY = 1200; Main.autoGen = true; } else { if (text5 == "2") { Main.maxTilesX = 6300; Main.maxTilesY = 1800; Main.autoGen = true; } else { if (text5 == "3") { Main.maxTilesX = 8400; Main.maxTilesY = 2400; Main.autoGen = true; } } } } } if (text.Length > 7 && text.Substring(0, 7).ToLower() == "secure=") { string text6 = text.Substring(7); if (text6 == "1") { Netplay.spamCheck = true; } } if (text.Length > 5 && text.Substring(0, 5).ToLower() == "upnp=") { string text7 = text.Substring(5); if (text7 != "1") { Netplay.uPNP = false; } } if (text.Length > 5 && text.Substring(0, 10).ToLower() == "npcstream=") { string value5 = text.Substring(10); try { int num3 = Convert.ToInt32(value5); Main.npcStreamSpeed = num3; } catch { } } } catch { } } } } } public void SetNetPlayers(int mPlayers) { Main.maxNetPlayers = mPlayers; } public void SetWorld(string wrold) { Main.worldPathName = wrold; } public void SetWorldName(string wrold) { Main.worldName = wrold; } public void autoShut() { 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.SetIP(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 Random(); if (Main.autoShutdown) { string text = "terraria" + Main.rand.Next(2147483647); Console.Title = text; IntPtr intPtr = Main.FindWindow(null, text); if (intPtr != IntPtr.Zero) { Main.ShowWindow(intPtr, 0); } } else { Console.Title = "Terraria Server " + Main.versionNumber2; } Main.dedServ = true; Main.showSplash = false; this.Initialize(); Lang.setLang(false); for (int i = 0; i < 301; i++) { NPC nPC = new NPC(); nPC.SetDefaults(i, -1f); Main.npcName[i] = nPC.name; } while (Main.worldPathName == null || Main.worldPathName == "") { Main.LoadWorlds(); bool flag = true; while (flag) { Console.WriteLine("Terraria Server " + Main.versionNumber2); Console.WriteLine(""); for (int j = 0; j < Main.numLoadWorlds; j++) { Console.WriteLine(string.Concat(new object[] { j + 1, '\t', '\t', Main.loadWorld[j] })); } Console.WriteLine(string.Concat(new object[] { "n", '\t', '\t', "New World" })); Console.WriteLine("d " + '\t' + "Delete World"); Console.WriteLine(""); Console.Write("Choose World: "); string text2 = Console.ReadLine(); try { Console.Clear(); } catch { } if (text2.Length >= 2 && text2.Substring(0, 2).ToLower() == "d ") { try { int num = Convert.ToInt32(text2.Substring(2)) - 1; if (num < Main.numLoadWorlds) { Console.WriteLine("Terraria Server " + Main.versionNumber2); Console.WriteLine(""); Console.WriteLine("Really delete " + Main.loadWorld[num] + "?"); Console.Write("(y/n): "); string text3 = Console.ReadLine(); if (text3.ToLower() == "y") { Main.EraseWorld(num); } } } catch { } try { Console.Clear(); continue; } catch { continue; } } if (text2 == "n" || text2 == "N") { bool flag2 = true; while (flag2) { Console.WriteLine("Terraria Server " + Main.versionNumber2); Console.WriteLine(""); Console.WriteLine("1" + '\t' + "Small"); Console.WriteLine("2" + '\t' + "Medium"); Console.WriteLine("3" + '\t' + "Large"); Console.WriteLine(""); Console.Write("Choose size: "); string value = Console.ReadLine(); try { int num2 = Convert.ToInt32(value); if (num2 == 1) { Main.maxTilesX = 4200; Main.maxTilesY = 1200; flag2 = false; } else { if (num2 == 2) { Main.maxTilesX = 6400; Main.maxTilesY = 1800; flag2 = false; } else { if (num2 == 3) { Main.maxTilesX = 8400; Main.maxTilesY = 2400; flag2 = false; } } } } catch { } try { Console.Clear(); } catch { } } flag2 = true; while (flag2) { Console.WriteLine("Terraria Server " + Main.versionNumber2); Console.WriteLine(""); Console.Write("Enter world name: "); Main.newWorldName = Console.ReadLine(); if (Main.newWorldName != "" && Main.newWorldName != " " && Main.newWorldName != null) { flag2 = false; } try { Console.Clear(); } catch { } } Main.worldName = Main.newWorldName; Main.worldPathName = Main.getWorldPathName(Main.worldName); Main.menuMode = 10; WorldGen.CreateNewWorld(); flag2 = false; while (Main.menuMode == 10) { if (Main.oldStatusText != Main.statusText) { Main.oldStatusText = Main.statusText; Console.WriteLine(Main.statusText); } } try { Console.Clear(); continue; } catch { continue; } } try { int num3 = Convert.ToInt32(text2); num3--; if (num3 >= 0 && num3 < Main.numLoadWorlds) { bool flag3 = true; while (flag3) { Console.WriteLine("Terraria Server " + Main.versionNumber2); Console.WriteLine(""); Console.Write("Max players (press enter for 8): "); string value2 = Console.ReadLine(); try { if (value2 == "") { value2 = "8"; } int num4 = Convert.ToInt32(value2); if (num4 <= 255 && num4 >= 1) { Main.maxNetPlayers = num4; flag3 = false; } flag3 = false; } catch { } try { Console.Clear(); } catch { } } flag3 = true; while (flag3) { Console.WriteLine("Terraria Server " + Main.versionNumber2); Console.WriteLine(""); Console.Write("Server port (press enter for 7777): "); string value3 = Console.ReadLine(); try { if (value3 == "") { value3 = "7777"; } int num5 = Convert.ToInt32(value3); if (num5 <= 65535) { Netplay.serverPort = num5; flag3 = false; } } catch { } try { Console.Clear(); } catch { } } flag3 = true; while (flag3) { Console.WriteLine("Terraria Server " + Main.versionNumber2); Console.WriteLine(""); Console.Write("Automatically forward port? (y/n): "); string text4 = Console.ReadLine(); try { if (text4 == "" || text4.ToLower() == "y" || text4.ToLower() == "yes") { Netplay.uPNP = true; flag3 = false; } else { if (text4.ToLower() == "n" || text4.ToLower() == "no") { Netplay.uPNP = false; flag3 = false; } } } catch { } try { Console.Clear(); } catch { } } Console.WriteLine("Terraria Server " + Main.versionNumber2); Console.WriteLine(""); Console.Write("Server password (press enter for none): "); Netplay.password = Console.ReadLine(); Main.worldPathName = Main.loadWorldPath[num3]; flag = false; try { Console.Clear(); } catch { } } } catch { } } } try { Console.Clear(); } catch { } WorldGen.serverLoadWorld(); Console.WriteLine("Terraria Server " + Main.versionNumber); Console.WriteLine(""); while (!Netplay.ServerUp) { if (Main.oldStatusText != Main.statusText) { Main.oldStatusText = Main.statusText; Console.WriteLine(Main.statusText); } } try { Console.Clear(); } catch { } Console.WriteLine("Terraria Server " + Main.versionNumber); Console.WriteLine(""); Console.WriteLine("Listening on port " + Netplay.serverPort); Console.WriteLine("Type 'help' for a list of commands."); Console.WriteLine(""); Console.Title = "Terraria Server: " + Main.worldName; Stopwatch stopwatch = new Stopwatch(); if (!Main.autoShutdown) { Main.startDedInput(); } stopwatch.Start(); double num6 = 16.666666666666668; double num7 = 0.0; int num8 = 0; Stopwatch stopwatch2 = new Stopwatch(); stopwatch2.Start(); while (!Netplay.disconnect) { double num9 = (double)stopwatch.ElapsedMilliseconds; if (num9 + num7 >= num6) { num8++; num7 += num9 - num6; stopwatch.Reset(); stopwatch.Start(); if (Main.oldStatusText != Main.statusText) { Main.oldStatusText = Main.statusText; Console.WriteLine(Main.statusText); } if (Netplay.anyClients) { this.Update(new GameTime()); } double num10 = (double)stopwatch.ElapsedMilliseconds + num7; if (num10 < num6) { int num11 = (int)(num6 - num10) - 1; if (num11 > 1) { Thread.Sleep(num11 - 1); if (!Netplay.anyClients) { num7 = 0.0; Thread.Sleep(10); } } } } Thread.Sleep(0); } } public static void startDedInput() { ThreadPool.QueueUserWorkItem(new WaitCallback(Main.startDedInputCallBack), 1); } public static void startDedInputCallBack(object threadContext) { while (!Netplay.disconnect) { Console.Write(": "); string text = Console.ReadLine(); string text2 = text; text = text.ToLower(); try { if (text == "help") { Console.WriteLine("Available commands:"); Console.WriteLine(""); Console.WriteLine(string.Concat(new object[] { "help ", '\t', '\t', " Displays a list of commands." })); Console.WriteLine("playing " + '\t' + " Shows the list of players"); Console.WriteLine(string.Concat(new object[] { "clear ", '\t', '\t', " Clear the console window." })); Console.WriteLine(string.Concat(new object[] { "exit ", '\t', '\t', " Shutdown the server and save." })); Console.WriteLine("exit-nosave " + '\t' + " Shutdown the server without saving."); Console.WriteLine(string.Concat(new object[] { "save ", '\t', '\t', " Save the game world." })); Console.WriteLine("kick " + '\t' + " Kicks a player from the server."); Console.WriteLine("ban " + '\t' + " Bans a player from the server."); Console.WriteLine("password" + '\t' + " Show password."); Console.WriteLine("password " + '\t' + " Change password."); Console.WriteLine(string.Concat(new object[] { "version", '\t', '\t', " Print version number." })); Console.WriteLine(string.Concat(new object[] { "time", '\t', '\t', " Display game time." })); Console.WriteLine(string.Concat(new object[] { "port", '\t', '\t', " Print the listening port." })); Console.WriteLine("maxplayers" + '\t' + " Print the max number of players."); Console.WriteLine("say " + '\t' + " Send a message."); Console.WriteLine(string.Concat(new object[] { "motd", '\t', '\t', " Print MOTD." })); Console.WriteLine("motd " + '\t' + " Change MOTD."); Console.WriteLine(string.Concat(new object[] { "dawn", '\t', '\t', " Change time to dawn." })); Console.WriteLine(string.Concat(new object[] { "noon", '\t', '\t', " Change time to noon." })); Console.WriteLine(string.Concat(new object[] { "dusk", '\t', '\t', " Change time to dusk." })); Console.WriteLine("midnight" + '\t' + " Change time to midnight."); Console.WriteLine(string.Concat(new object[] { "settle", '\t', '\t', " Settle all water." })); } else { if (text == "settle") { if (!Liquid.panicMode) { Liquid.StartPanic(); } else { Console.WriteLine("Water is already settling"); } } else { if (text == "dawn") { Main.dayTime = true; Main.time = 0.0; NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0); } else { if (text == "dusk") { Main.dayTime = false; Main.time = 0.0; NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0); } else { if (text == "noon") { Main.dayTime = true; Main.time = 27000.0; NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0); } else { if (text == "midnight") { Main.dayTime = false; Main.time = 16200.0; NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0); } else { if (text == "exit-nosave") { Netplay.disconnect = true; } else { if (text == "exit") { WorldGen.saveWorld(false); Netplay.disconnect = true; } else { if (text == "fps") { if (!Main.dedServFPS) { Main.dedServFPS = true; Main.fpsTimer.Reset(); } else { Main.dedServCount1 = 0; Main.dedServCount2 = 0; Main.dedServFPS = false; } } else { if (text == "save") { WorldGen.saveWorld(false); } else { if (text == "time") { string text3 = "AM"; double num = Main.time; if (!Main.dayTime) { num += 54000.0; } num = num / 86400.0 * 24.0; double num2 = 7.5; num = num - num2 - 12.0; if (num < 0.0) { num += 24.0; } if (num >= 12.0) { text3 = "PM"; } int num3 = (int)num; double num4 = num - (double)num3; num4 = (double)((int)(num4 * 60.0)); string text4 = string.Concat(num4); if (num4 < 10.0) { text4 = "0" + text4; } if (num3 > 12) { num3 -= 12; } if (num3 == 0) { num3 = 12; } Console.WriteLine(string.Concat(new object[] { "Time: ", num3, ":", text4, " ", text3 })); } else { if (text == "maxplayers") { Console.WriteLine("Player limit: " + Main.maxNetPlayers); } else { if (text == "port") { Console.WriteLine("Port: " + Netplay.serverPort); } else { if (text == "version") { Console.WriteLine("Terraria Server " + Main.versionNumber); } else { if (text == "clear") { try { Console.Clear(); continue; } catch { continue; } } if (text == "playing") { int num5 = 0; for (int i = 0; i < 255; i++) { if (Main.player[i].active) { num5++; Console.WriteLine(string.Concat(new object[] { Main.player[i].name, " (", Netplay.serverSock[i].tcpClient.Client.RemoteEndPoint, ")" })); } } if (num5 == 0) { Console.WriteLine("No players connected."); } else { if (num5 == 1) { Console.WriteLine("1 player connected."); } else { Console.WriteLine(num5 + " players connected."); } } } else { if (!(text == "")) { if (text == "motd") { if (Main.motd == "") { Console.WriteLine("Welcome to " + Main.worldName + "!"); } else { Console.WriteLine("MOTD: " + Main.motd); } } else { if (text.Length >= 5 && text.Substring(0, 5) == "motd ") { string text5 = text2.Substring(5); Main.motd = text5; } else { if (text.Length == 8 && text.Substring(0, 8) == "password") { if (Netplay.password == "") { Console.WriteLine("No password set."); } else { Console.WriteLine("Password: " + Netplay.password); } } else { if (text.Length >= 9 && text.Substring(0, 9) == "password ") { string password = text2.Substring(9); if (password == "") { Netplay.password = ""; Console.WriteLine("Password disabled."); } else { Netplay.password = password; Console.WriteLine("Password: " + Netplay.password); } } else { if (text == "say") { Console.WriteLine("Usage: say "); } else { if (text.Length >= 4 && text.Substring(0, 4) == "say ") { string str = text2.Substring(4); if (str == "") { Console.WriteLine("Usage: say "); } else { Console.WriteLine(" " + str); NetMessage.SendData(25, -1, -1, " " + str, 255, 255f, 240f, 20f, 0); } } else { if (text.Length == 4 && text.Substring(0, 4) == "kick") { Console.WriteLine("Usage: kick "); } else { if (text.Length >= 5 && text.Substring(0, 5) == "kick ") { string text6 = text.Substring(5); text6 = text6.ToLower(); if (text6 == "") { Console.WriteLine("Usage: kick "); } else { for (int j = 0; j < 255; j++) { if (Main.player[j].active && Main.player[j].name.ToLower() == text6) { NetMessage.SendData(2, j, -1, "Kicked from server.", 0, 0f, 0f, 0f, 0); } } } } else { if (text.Length == 3 && text.Substring(0, 3) == "ban") { Console.WriteLine("Usage: ban "); } else { if (text.Length >= 4 && text.Substring(0, 4) == "ban ") { string text7 = text.Substring(4); text7 = text7.ToLower(); if (text7 == "") { Console.WriteLine("Usage: ban "); } else { for (int k = 0; k < 255; k++) { if (Main.player[k].active && Main.player[k].name.ToLower() == text7) { Netplay.AddBan(k); NetMessage.SendData(2, k, -1, "Banned from server.", 0, 0f, 0f, 0f, 0); } } } } else { Console.WriteLine("Invalid command."); } } } } } } } } } } } } } } } } } } } } } } } } } } } catch { Console.WriteLine("Invalid command."); } } } public Main() { this.graphics = new GraphicsDeviceManager(this); base.Content.RootDirectory = "Content"; } protected void SetTitle() { base.Window.Title = Lang.title(); } protected override void Initialize() { NPC.clrNames(); NPC.setNames(); WorldGen.randomBackgrounds(); WorldGen.setCaveBacks(); WorldGen.randMoon(); Main.bgAlpha[0] = 1f; Main.bgAlpha2[0] = 1f; this.invBottom = 258; for (int i = 0; i < 311; i++) { Main.projFrames[i] = 1; } Main.projFrames[308] = 10; 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[127] = 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.projPet[266] = true; Main.tileLighted[237] = true; Main.projPet[175] = true; Main.projPet[111] = true; Main.projPet[112] = true; Main.projPet[127] = 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.pvpBuff[20] = true; Main.pvpBuff[24] = true; Main.pvpBuff[31] = true; Main.pvpBuff[39] = true; Main.pvpBuff[44] = 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.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.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[65] = true; Main.vanityPet[66] = true; Main.lightPet[19] = true; Main.lightPet[27] = true; Main.lightPet[57] = true; Main.tileFlame[4] = true; Main.tileFlame[33] = true; Main.tileFlame[34] = true; Main.tileFlame[35] = true; Main.tileFlame[36] = true; Main.tileFlame[49] = true; Main.tileFlame[93] = true; Main.tileFlame[98] = true; Main.tileFlame[100] = true; Main.tileFlame[170] = true; Main.tileFlame[171] = true; Main.tileFlame[172] = true; Main.tileFlame[173] = true; Main.tileFlame[174] = true; Main.tileRope[213] = true; Main.tileRope[214] = true; Main.tileSolid[232] = true; Main.tileShine[239] = 1100; Main.tileSolid[239] = true; Main.tileSolidTop[239] = 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.tileSolid[221] = true; Main.tileBlockLight[221] = true; Main.tileMergeDirt[221] = 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.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.tileBlockLight[248] = true; Main.tileBlockLight[249] = true; Main.tileBlockLight[250] = true; Main.wallHouse[109] = true; Main.wallHouse[110] = true; Main.wallHouse[111] = true; Main.wallHouse[112] = true; for (int j = 0; j < 113; j++) { Main.wallDungeon[j] = false; } Main.wallLight[0] = true; Main.wallLight[21] = true; Main.wallLight[106] = true; Main.wallLight[107] = true; 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; Main.wallHouse[108] = 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; for (int k = 0; k < 10; k++) { Main.recentWorld[k] = ""; Main.recentIP[k] = ""; Main.recentPort[k] = 0; } if (Main.rand == null) { Main.rand = new Random((int)DateTime.Now.Ticks); } if (WorldGen.genRand == null) { WorldGen.genRand = new Random((int)DateTime.Now.Ticks); } this.SetTitle(); Main.lo = Main.rand.Next(6); 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[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.wallHouse[82] = true; Main.wallHouse[77] = 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[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.wallHouse[75] = true; Main.wallHouse[76] = true; Main.wallHouse[78] = 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.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[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[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.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[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[170] = true; Main.tileFrameImportant[171] = true; Main.tileFrameImportant[172] = true; Main.tileFrameImportant[173] = true; Main.tileFrameImportant[174] = true; Main.tileLighted[170] = true; Main.tileLighted[171] = true; Main.tileLighted[172] = 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.tileBlockLight[138] = 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.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[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[36] = 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.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[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[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[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[36] = 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[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[141] = 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.tileAlch[82] = true; Main.tileAlch[83] = true; Main.tileAlch[84] = true; Main.tileLavaDeath[104] = true; Main.tileLavaDeath[110] = true; Main.tileLavaDeath[113] = true; Main.tileLavaDeath[115] = true; Main.tileSolid[127] = 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.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.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.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.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[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[15] = true; Main.tileNoAttach[16] = true; Main.tileNoAttach[134] = true; Main.tileNoAttach[17] = true; Main.tileNoAttach[18] = true; Main.tileNoAttach[19] = true; Main.tileNoAttach[21] = true; Main.tileNoAttach[27] = true; Main.tileNoAttach[114] = true; Main.tileTable[14] = 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.tileLavaDeath[86] = true; Main.tileLavaDeath[87] = true; Main.tileLavaDeath[88] = true; Main.tileLavaDeath[89] = true; Main.tileLavaDeath[125] = true; Main.tileLavaDeath[126] = true; Main.tileLavaDeath[101] = true; Main.tileTable[101] = true; Main.tileNoAttach[101] = true; Main.tileLavaDeath[102] = 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.tileLavaDeath[94] = true; Main.tileLavaDeath[95] = true; Main.tileLavaDeath[96] = true; Main.tileLavaDeath[97] = true; Main.tileLavaDeath[98] = true; Main.tileLavaDeath[99] = true; Main.tileLavaDeath[100] = true; Main.tileLavaDeath[103] = 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.tileLavaDeath[91] = true; Main.tileNoAttach[92] = true; Main.tileLavaDeath[92] = true; Main.tileNoAttach[93] = true; Main.tileLavaDeath[93] = true; Main.tileLighted[190] = true; Main.tileBlockLight[192] = true; Main.tileBrick[192] = false; Main.tileWaterDeath[4] = true; Main.tileWaterDeath[51] = true; Main.tileWaterDeath[93] = true; Main.tileWaterDeath[98] = true; Main.tileLavaDeath[201] = 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[15] = true; Main.tileLavaDeath[16] = true; Main.tileLavaDeath[17] = true; Main.tileLavaDeath[18] = true; Main.tileLavaDeath[19] = true; Main.tileLavaDeath[20] = 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[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[106] = true; Main.tileLavaDeath[205] = 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; for (int l = 0; l < 113; l++) { if (l == 20) { Main.wallBlend[l] = 14; } else { if (l == 19) { Main.wallBlend[l] = 9; } else { if (l == 18) { Main.wallBlend[l] = 8; } else { if (l == 17) { Main.wallBlend[l] = 7; } else { if (l == 16 || l == 59) { Main.wallBlend[l] = 2; } else { if (l == 1 || (l >= 48 && l <= 53)) { Main.wallBlend[l] = 1; } else { Main.wallBlend[l] = l; } } } } } } } 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; for (int m = 0; m < 251; m++) { Main.tileName[m] = ""; if (Main.tileSolid[m]) { Main.tileNoSunLight[m] = true; } Main.tileFrame[m] = 0; Main.tileFrameCounter[m] = 0; } Main.tileNoSunLight[19] = false; Main.tileNoSunLight[11] = true; Main.tileNoSunLight[189] = false; Main.tileNoSunLight[196] = false; for (int n = 0; n < Main.maxMenuItems; n++) { this.menuItemScale[n] = 0.8f; } for (int num = 0; num < 6001; num++) { Main.dust[num] = new Dust(); } for (int num2 = 0; num2 < 401; num2++) { Main.item[num2] = new Item(); } for (int num3 = 0; num3 < 201; num3++) { Main.npc[num3] = new NPC(); Main.npc[num3].whoAmI = num3; } for (int num4 = 0; num4 < 256; num4++) { Main.player[num4] = new Player(); } for (int num5 = 0; num5 < 1001; num5++) { Main.projectile[num5] = new Projectile(); } for (int num6 = 0; num6 < 501; num6++) { Main.gore[num6] = new Gore(); } for (int num7 = 0; num7 < Main.maxRain + 1; num7++) { Main.rain[num7] = new Rain(); } for (int num8 = 0; num8 < 200; num8++) { Main.cloud[num8] = new Cloud(); } for (int num9 = 0; num9 < 100; num9++) { Main.combatText[num9] = new CombatText(); } for (int num10 = 0; num10 < 20; num10++) { Main.itemText[num10] = new ItemText(); } for (int num11 = 0; num11 < 1725; num11++) { Item item = new Item(); item.SetDefaults(num11, false); Main.itemName[num11] = item.name; if (item.headSlot > 0) { Item.headType[item.headSlot] = item.type; } if (item.bodySlot > 0) { Item.bodyType[item.bodySlot] = item.type; } if (item.legSlot > 0) { Item.legType[item.legSlot] = item.type; } } for (int num12 = 0; num12 < Recipe.maxRecipes; num12++) { Main.recipe[num12] = new Recipe(); Main.availableRecipeY[num12] = (float)(65 * num12); } Recipe.SetupRecipes(); for (int num13 = 0; num13 < Main.numChatLines; num13++) { Main.chatLine[num13] = new ChatLine(); } for (int num14 = 0; num14 < Liquid.resLiquid; num14++) { Main.liquid[num14] = new Liquid(); } for (int num15 = 0; num15 < 10000; num15++) { Main.liquidBuffer[num15] = new LiquidBuffer(); } this.shop[0] = new Chest(); for (int num16 = 1; num16 < Main.numShops; num16++) { this.shop[num16] = new Chest(); this.shop[num16].SetupShop(num16); } Main.teamColor[0] = Color.White; Main.teamColor[1] = new Color(230, 40, 20); Main.teamColor[2] = new Color(20, 200, 30); Main.teamColor[3] = new Color(75, 90, 255); Main.teamColor[4] = new Color(200, 180, 0); if (Main.menuMode == 1) { Main.LoadPlayers(); } for (int num17 = 1; num17 < 311; num17++) { Projectile projectile = new Projectile(); projectile.SetDefaults(num17); if (projectile.hostile) { Main.projHostile[num17] = true; } } Netplay.Init(); if (Main.skipMenu) { WorldGen.clearWorld(); Main.gameMenu = false; Main.LoadPlayers(); Main.player[Main.myPlayer] = (Player)Main.loadPlayer[0].Clone(); Main.PlayerPath = Main.loadPlayerPath[0]; Main.LoadWorlds(); WorldGen.generateWorld(-1); WorldGen.EveryTileFrame(); Main.player[Main.myPlayer].Spawn(); } else { IntPtr systemMenu = Main.GetSystemMenu(base.Window.Handle, false); int menuItemCount = Main.GetMenuItemCount(systemMenu); Main.RemoveMenu(systemMenu, menuItemCount - 1, 1024); } if (Main.dedServ) { return; } Main.clientUUID = Guid.NewGuid().ToString(); if (Main.CachedAnonymousMethodDelegate1 == null) { Main.CachedAnonymousMethodDelegate1 = new Action(Main.b__0); } keyBoardInput.newKeyEvent += Main.CachedAnonymousMethodDelegate1; 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; } this.graphics.PreferredBackBufferWidth = Main.screenWidth; this.graphics.PreferredBackBufferHeight = Main.screenHeight; this.graphics.ApplyChanges(); base.Initialize(); base.Window.AllowUserResizing = true; this.OpenSettings(); this.CheckBunny(); if (Lang.lang > 1) { Lang.setLang(true); } Lang.setLang(false); if (Lang.lang == 0) { Main.menuMode = 1212; } this.SetTitle(); this.OpenRecent(); Star.SpawnStars(); WorldGen.RandomWeather(); foreach (DisplayMode current in GraphicsAdapter.DefaultAdapter.SupportedDisplayModes) { if (current.Width >= Main.minScreenW && current.Height >= Main.minScreenH && current.Width <= Main.maxScreenW && current.Height <= Main.maxScreenH) { bool flag = true; for (int num18 = 0; num18 < this.numDisplayModes; num18++) { if (current.Width == this.displayWidth[num18] && current.Height == this.displayHeight[num18]) { flag = false; break; } } if (flag) { this.displayHeight[this.numDisplayModes] = current.Height; this.displayWidth[this.numDisplayModes] = current.Width; this.numDisplayModes++; } } } if (Main.autoJoin) { Main.LoadPlayers(); Main.menuMode = 1; Main.menuMultiplayer = true; } Main.fpsTimer.Start(); Main.updateTimer.Start(); } protected override void LoadContent() { try { Main.pixelShader = base.Content.Load("pixelShader"); Main.tileShader = base.Content.Load("tileShader"); Main.engine = new AudioEngine("Content" + Path.DirectorySeparatorChar + "TerrariaMusic.xgs"); Main.soundBank = new SoundBank(Main.engine, "Content" + Path.DirectorySeparatorChar + "Sound Bank.xsb"); Main.waveBank = new WaveBank(Main.engine, "Content" + Path.DirectorySeparatorChar + "Wave Bank.xwb"); for (int i = 1; i < 30; i++) { Main.music[i] = Main.soundBank.GetCue("Music_" + i); } Main.soundMech[0] = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Mech_0"); Main.soundInstanceMech[0] = Main.soundMech[0].CreateInstance(); Main.soundGrab = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Grab"); Main.soundInstanceGrab = Main.soundGrab.CreateInstance(); Main.soundPixie = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Pixie"); Main.soundInstancePixie = Main.soundGrab.CreateInstance(); Main.soundDig[0] = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Dig_0"); Main.soundInstanceDig[0] = Main.soundDig[0].CreateInstance(); Main.soundDig[1] = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Dig_1"); Main.soundInstanceDig[1] = Main.soundDig[1].CreateInstance(); Main.soundDig[2] = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Dig_2"); Main.soundInstanceDig[2] = Main.soundDig[2].CreateInstance(); Main.soundTink[0] = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Tink_0"); Main.soundInstanceTink[0] = Main.soundTink[0].CreateInstance(); Main.soundTink[1] = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Tink_1"); Main.soundInstanceTink[1] = Main.soundTink[1].CreateInstance(); Main.soundTink[2] = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Tink_2"); Main.soundInstanceTink[2] = Main.soundTink[2].CreateInstance(); Main.soundPlayerHit[0] = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Player_Hit_0"); Main.soundInstancePlayerHit[0] = Main.soundPlayerHit[0].CreateInstance(); Main.soundPlayerHit[1] = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Player_Hit_1"); Main.soundInstancePlayerHit[1] = Main.soundPlayerHit[1].CreateInstance(); Main.soundPlayerHit[2] = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Player_Hit_2"); Main.soundInstancePlayerHit[2] = Main.soundPlayerHit[2].CreateInstance(); Main.soundFemaleHit[0] = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Female_Hit_0"); Main.soundInstanceFemaleHit[0] = Main.soundFemaleHit[0].CreateInstance(); Main.soundFemaleHit[1] = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Female_Hit_1"); Main.soundInstanceFemaleHit[1] = Main.soundFemaleHit[1].CreateInstance(); Main.soundFemaleHit[2] = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Female_Hit_2"); Main.soundInstanceFemaleHit[2] = Main.soundFemaleHit[2].CreateInstance(); Main.soundPlayerKilled = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Player_Killed"); Main.soundInstancePlayerKilled = Main.soundPlayerKilled.CreateInstance(); Main.soundChat = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Chat"); Main.soundInstanceChat = Main.soundChat.CreateInstance(); Main.soundGrass = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Grass"); Main.soundInstanceGrass = Main.soundGrass.CreateInstance(); Main.soundDoorOpen = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Door_Opened"); Main.soundInstanceDoorOpen = Main.soundDoorOpen.CreateInstance(); Main.soundDoorClosed = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Door_Closed"); Main.soundInstanceDoorClosed = Main.soundDoorClosed.CreateInstance(); Main.soundMenuTick = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Menu_Tick"); Main.soundInstanceMenuTick = Main.soundMenuTick.CreateInstance(); Main.soundMenuOpen = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Menu_Open"); Main.soundInstanceMenuOpen = Main.soundMenuOpen.CreateInstance(); Main.soundMenuClose = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Menu_Close"); Main.soundInstanceMenuClose = Main.soundMenuClose.CreateInstance(); Main.soundShatter = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Shatter"); Main.soundInstanceShatter = Main.soundShatter.CreateInstance(); Main.soundZombie[0] = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Zombie_0"); Main.soundInstanceZombie[0] = Main.soundZombie[0].CreateInstance(); Main.soundZombie[1] = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Zombie_1"); Main.soundInstanceZombie[1] = Main.soundZombie[1].CreateInstance(); Main.soundZombie[2] = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Zombie_2"); Main.soundInstanceZombie[2] = Main.soundZombie[2].CreateInstance(); Main.soundZombie[3] = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Zombie_3"); Main.soundInstanceZombie[3] = Main.soundZombie[3].CreateInstance(); Main.soundZombie[4] = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Zombie_4"); Main.soundInstanceZombie[4] = Main.soundZombie[4].CreateInstance(); Main.soundRoar[0] = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Roar_0"); Main.soundInstanceRoar[0] = Main.soundRoar[0].CreateInstance(); Main.soundRoar[1] = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Roar_1"); Main.soundInstanceRoar[1] = Main.soundRoar[1].CreateInstance(); Main.soundSplash[0] = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Splash_0"); Main.soundInstanceSplash[0] = Main.soundRoar[0].CreateInstance(); Main.soundSplash[1] = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Splash_1"); Main.soundInstanceSplash[1] = Main.soundSplash[1].CreateInstance(); Main.soundDoubleJump = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Double_Jump"); Main.soundInstanceDoubleJump = Main.soundRoar[0].CreateInstance(); Main.soundRun = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Run"); Main.soundInstanceRun = Main.soundRun.CreateInstance(); Main.soundCoins = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Coins"); Main.soundInstanceCoins = Main.soundCoins.CreateInstance(); Main.soundUnlock = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Unlock"); Main.soundInstanceUnlock = Main.soundUnlock.CreateInstance(); Main.soundMaxMana = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "MaxMana"); Main.soundInstanceMaxMana = Main.soundMaxMana.CreateInstance(); Main.soundDrown = base.Content.Load("Sounds" + Path.DirectorySeparatorChar + "Drown"); Main.soundInstanceDrown = Main.soundDrown.CreateInstance(); for (int j = 1; j < 52; j++) { Main.soundItem[j] = base.Content.Load(string.Concat(new object[] { "Sounds", Path.DirectorySeparatorChar, "Item_", j })); Main.soundInstanceItem[j] = Main.soundItem[j].CreateInstance(); } for (int k = 1; k < 14; k++) { Main.soundNPCHit[k] = base.Content.Load(string.Concat(new object[] { "Sounds", Path.DirectorySeparatorChar, "NPC_Hit_", k })); Main.soundInstanceNPCHit[k] = Main.soundNPCHit[k].CreateInstance(); } for (int l = 1; l < 20; l++) { Main.soundNPCKilled[l] = base.Content.Load(string.Concat(new object[] { "Sounds", Path.DirectorySeparatorChar, "NPC_Killed_", l })); Main.soundInstanceNPCKilled[l] = Main.soundNPCKilled[l].CreateInstance(); } } catch { Main.musicVolume = 0f; Main.soundVolume = 0f; } this.iceBarrierTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "IceBarrier"); Main.frozenTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Frozen"); Main.craftButtonTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "CraftButton"); Main.craftUpButtonTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "RecUp"); Main.craftDownButtonTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "RecDown"); Main.pulleyTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "PlayerPulley"); Main.reforgeTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Reforge"); Main.timerTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Timer"); Main.wofTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "WallOfFlesh"); Main.wallOutlineTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Wall_Outline"); Main.fadeTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "fade-out"); Main.ghostTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Ghost"); Main.evilCactusTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Evil_Cactus"); Main.goodCactusTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Good_Cactus"); Main.crimsonCactusTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Crimson_Cactus"); Main.wraithEyeTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Wraith_Eyes"); Main.reaperEyeTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Reaper_Eyes"); Main.MusicBoxTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Music_Box"); this.mapTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Map"); this.mapBG1Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "MapBG1"); this.mapBG2Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "MapBG2"); this.mapBG3Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "MapBG3"); this.mapBG4Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "MapBG4"); this.mapBG5Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "MapBG5"); this.mapBG6Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "MapBG6"); this.mapBG7Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "MapBG7"); this.mapBG8Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "MapBG8"); this.mapBG9Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "MapBG9"); this.mapBG10Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "MapBG10"); this.mapBG11Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "MapBG11"); this.mapBG12Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "MapBG12"); this.hueTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Hue"); this.colorSliderTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "ColorSlider"); this.colorBarTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "ColorBar"); this.colorBlipTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "ColorBlip"); Main.rainTexture[0] = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Rain_0"); Main.rainTexture[1] = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Rain_1"); Main.rainTexture[2] = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Rain_2"); Main.magicPixel = base.Content.Load("Images" + Path.DirectorySeparatorChar + "MagicPixel"); Main.miniMapFrameTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "MiniMapFrame"); Main.miniMapFrame2Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "MiniMapFrame2"); for (int m = 0; m < Main.FlameTexture.Length; m++) { Main.FlameTexture[m] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Flame_", m })); } for (int n = 0; n < 3; n++) { Main.miniMapButtonTexture[n] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "MiniMapButton_", n })); } for (int num = 0; num < 8; num++) { this.mapIconTexture[num] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Map_", num })); } Main.destTexture[0] = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Dest1"); Main.destTexture[1] = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Dest2"); Main.destTexture[2] = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Dest3"); Main.actuatorTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Actuator"); Main.wireTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Wires"); Main.wire2Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Wires2"); Main.wire3Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Wires3"); Main.flyingCarpetTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "FlyingCarpet"); Main.hbTexture1 = base.Content.Load("Images" + Path.DirectorySeparatorChar + "HealthBar1"); Main.hbTexture2 = base.Content.Load("Images" + Path.DirectorySeparatorChar + "HealthBar2"); Main.loTexture = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "logo_", Main.rand.Next(1, 9) })); this.spriteBatch = new SpriteBatch(base.GraphicsDevice); for (int num2 = 1; num2 < 2; num2++) { Main.bannerTexture[num2] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "House_Banner_", num2 })); } for (int num3 = 0; num3 < Main.npcHeadTexture.Length; num3++) { Main.npcHeadTexture[num3] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "NPC_Head_", num3 })); } for (int num4 = 1; num4 < Main.BackPackTexture.Length; num4++) { Main.BackPackTexture[num4] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "BackPack_", num4 })); } for (int num5 = 1; num5 < 81; num5++) { Main.buffTexture[num5] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Buff_", num5 })); } this.LoadBackground(0); this.LoadBackground(49); for (int num6 = 0; num6 < 1725; num6++) { Main.itemTexture[num6] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Item_", num6 })); } for (int num7 = 0; num7 < 6; num7++) { Main.gemTexture[num7] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Gem_", num7 })); } for (int num8 = 0; num8 < 301; num8++) { NPC nPC = new NPC(); nPC.SetDefaults(num8, -1f); Main.npcName[num8] = nPC.name; } for (int num9 = 0; num9 < 22; num9++) { Main.cloudTexture[num9] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Cloud_", num9 })); } for (int num10 = 0; num10 < 5; num10++) { Main.starTexture[num10] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Star_", num10 })); } for (int num11 = 0; num11 < 12; num11++) { Main.liquidTexture[num11] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Liquid_", num11 })); Main.waterfallTexture[num11] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Waterfall_", num11 })); } Main.waterfallTexture[12] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Waterfall_", 12 })); Main.waterfallTexture[13] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Waterfall_", 13 })); Main.waterfallTexture[14] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Waterfall_", 14 })); Main.npcToggleTexture[0] = base.Content.Load("Images" + Path.DirectorySeparatorChar + "House_1"); Main.npcToggleTexture[1] = base.Content.Load("Images" + Path.DirectorySeparatorChar + "House_2"); Main.HBLockTexture[0] = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Lock_0"); Main.HBLockTexture[1] = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Lock_1"); Main.gridTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Grid"); Main.trashTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Trash"); Main.cdTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "CoolDown"); Main.logoTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Logo"); Main.logo2Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Logo2"); Main.dustTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Dust"); Main.sunTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Sun"); Main.sun2Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Sun2"); Main.sun3Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Sun3"); Main.blackTileTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Black_Tile"); Main.heartTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Heart"); Main.heart2Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Heart2"); Main.bubbleTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Bubble"); Main.flameTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Flame"); Main.manaTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Mana"); Main.cursorTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Cursor"); Main.ninjaTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Ninja"); Main.antLionTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "AntlionBody"); Main.spikeBaseTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Spike_Base"); Main.woodTexture[0] = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Tiles_5_0"); Main.woodTexture[1] = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Tiles_5_1"); Main.woodTexture[2] = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Tiles_5_2"); Main.woodTexture[3] = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Tiles_5_3"); Main.woodTexture[4] = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Tiles_5_4"); Main.woodTexture[5] = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Tiles_5_5"); Main.woodTexture[6] = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Tiles_5_6"); for (int num12 = 0; num12 < Main.moonTexture.Length; num12++) { Main.moonTexture[num12] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Moon_", num12 })); } for (int num13 = 0; num13 < Main.treeTopTexture.Length; num13++) { Main.treeTopTexture[num13] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Tree_Tops_", num13 })); } for (int num14 = 0; num14 < Main.treeBranchTexture.Length; num14++) { Main.treeBranchTexture[num14] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Tree_Branches_", num14 })); } Main.shroomCapTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Shroom_Tops"); Main.inventoryBackTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Inventory_Back"); Main.inventoryBack2Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Inventory_Back2"); Main.inventoryBack3Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Inventory_Back3"); Main.inventoryBack4Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Inventory_Back4"); Main.inventoryBack5Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Inventory_Back5"); Main.inventoryBack6Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Inventory_Back6"); Main.inventoryBack7Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Inventory_Back7"); Main.inventoryBack8Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Inventory_Back8"); Main.inventoryBack9Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Inventory_Back9"); Main.inventoryBack10Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Inventory_Back10"); Main.inventoryBack11Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Inventory_Back11"); Main.inventoryBack12Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Inventory_Back12"); Main.textBackTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Text_Back"); Main.chatTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chat"); Main.chat2Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chat2"); Main.chatBackTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chat_Back"); Main.teamTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Team"); Main.skinBodyTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Skin_Body"); Main.skinLegsTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Skin_Legs"); Main.playerEyeWhitesTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Player_Eye_Whites"); Main.playerEyesTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Player_Eyes"); Main.playerHandsTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Player_Hands"); Main.playerHands2Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Player_Hands2"); Main.playerHeadTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Player_Head"); Main.playerPantsTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Player_Pants"); Main.playerShirtTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Player_Shirt"); Main.playerShoesTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Player_Shoes"); Main.playerUnderShirtTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Player_Undershirt"); Main.playerUnderShirt2Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Player_Undershirt2"); Main.femalePantsTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Female_Pants"); Main.femaleShirtTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Female_Shirt"); Main.femaleShoesTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Female_Shoes"); Main.femaleUnderShirtTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Female_Undershirt"); Main.femaleUnderShirt2Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Female_Undershirt2"); Main.femaleShirt2Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Female_Shirt2"); Main.chaosTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chaos"); Main.EyeLaserTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Eye_Laser"); Main.BoneEyesTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Bone_eyes"); Main.BoneLaserTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Bone_Laser"); Main.lightDiscTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Light_Disc"); Main.confuseTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Confuse"); Main.probeTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Probe"); Main.sunOrbTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "SunOrb"); Main.sunAltarTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "SunAltar"); Main.chainTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chain"); Main.chain2Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chain2"); Main.chain3Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chain3"); Main.chain4Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chain4"); Main.chain5Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chain5"); Main.chain6Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chain6"); Main.chain7Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chain7"); Main.chain8Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chain8"); Main.chain9Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chain9"); Main.chain10Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chain10"); Main.chain11Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chain11"); Main.chain12Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chain12"); Main.chain13Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chain13"); Main.chain14Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chain14"); Main.chain15Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chain15"); Main.chain16Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chain16"); Main.chain17Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chain17"); Main.chain18Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chain18"); Main.chain19Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chain19"); Main.chain20Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chain20"); Main.chain21Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chain21"); Main.chain22Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chain22"); Main.chain23Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chain23"); Main.chain24Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chain24"); Main.chain25Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chain25"); Main.chain26Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chain26"); Main.chain27Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Chain27"); Main.boneArmTexture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Arm_Bone"); Main.boneArm2Texture = base.Content.Load("Images" + Path.DirectorySeparatorChar + "Arm_Bone_2"); for (int num15 = 1; num15 < Main.gemChainTexture.Length; num15++) { Main.gemChainTexture[num15] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "GemChain_", num15 })); } for (int num16 = 1; num16 < Main.golemTexture.Length; num16++) { Main.golemTexture[num16] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "GolemLights", num16 })); } Main.fontItemStack = base.Content.Load("Fonts" + Path.DirectorySeparatorChar + "Item_Stack"); Main.fontMouseText = base.Content.Load("Fonts" + Path.DirectorySeparatorChar + "Mouse_Text"); Main.fontDeathText = base.Content.Load("Fonts" + Path.DirectorySeparatorChar + "Death_Text"); Main.fontCombatText[0] = base.Content.Load("Fonts" + Path.DirectorySeparatorChar + "Combat_Text"); Main.fontCombatText[1] = base.Content.Load("Fonts" + Path.DirectorySeparatorChar + "Combat_Crit"); } protected override void UnloadContent() { } protected void UpdateMusic() { if (Main.musicVolume == 0f) { Main.curMusic = 0; } try { if (!Main.dedServ) { if (Main.curMusic > 0) { if (!base.IsActive) { if (!Main.music[Main.curMusic].IsPaused && Main.music[Main.curMusic].IsPlaying) { try { Main.music[Main.curMusic].Pause(); } catch { } } return; } if (Main.music[Main.curMusic].IsPaused) { Main.music[Main.curMusic].Resume(); } } bool flag = false; bool flag2 = false; bool flag3 = false; bool flag4 = false; bool flag5 = false; bool flag6 = false; Rectangle rectangle = new Rectangle((int)Main.screenPosition.X, (int)Main.screenPosition.Y, Main.screenWidth, Main.screenHeight); int num = 5000; for (int i = 0; i < 200; i++) { if (Main.npc[i].active) { if (Main.npc[i].type == 262 || Main.npc[i].type == 263 || Main.npc[i].type == 264) { Rectangle value = new Rectangle((int)(Main.npc[i].position.X + (float)(Main.npc[i].width / 2)) - num, (int)(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2)) - num, num * 2, num * 2); if (rectangle.Intersects(value)) { flag6 = true; break; } } else { if (Main.npc[i].type == 134 || Main.npc[i].type == 143 || Main.npc[i].type == 144 || Main.npc[i].type == 145 || Main.npc[i].type == 266) { Rectangle value2 = new Rectangle((int)(Main.npc[i].position.X + (float)(Main.npc[i].width / 2)) - num, (int)(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2)) - num, num * 2, num * 2); if (rectangle.Intersects(value2)) { flag3 = true; break; } } else { if ((Main.npc[i].type >= 212 && Main.npc[i].type <= 216) || Main.npc[i].type == 245) { Rectangle value3 = new Rectangle((int)(Main.npc[i].position.X + (float)(Main.npc[i].width / 2)) - num, (int)(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2)) - num, num * 2, num * 2); if (rectangle.Intersects(value3)) { flag4 = true; break; } } else { if (Main.npc[i].type == 113 || Main.npc[i].type == 114 || Main.npc[i].type == 125 || Main.npc[i].type == 126) { Rectangle value4 = new Rectangle((int)(Main.npc[i].position.X + (float)(Main.npc[i].width / 2)) - num, (int)(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2)) - num, num * 2, num * 2); if (rectangle.Intersects(value4)) { flag2 = true; break; } } else { if (Main.npc[i].type == 222) { Rectangle value5 = new Rectangle((int)(Main.npc[i].position.X + (float)(Main.npc[i].width / 2)) - num, (int)(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2)) - num, num * 2, num * 2); if (rectangle.Intersects(value5)) { flag5 = true; break; } } else { if (Main.npc[i].boss || Main.npc[i].type == 13 || Main.npc[i].type == 14 || Main.npc[i].type == 15 || Main.npc[i].type == 134 || Main.npc[i].type == 26 || Main.npc[i].type == 27 || Main.npc[i].type == 28 || Main.npc[i].type == 29 || Main.npc[i].type == 111) { Rectangle value6 = new Rectangle((int)(Main.npc[i].position.X + (float)(Main.npc[i].width / 2)) - num, (int)(Main.npc[i].position.Y + (float)(Main.npc[i].height / 2)) - num, num * 2, num * 2); if (rectangle.Intersects(value6)) { flag = true; break; } } } } } } } } } int num2 = (int)((Main.screenPosition.X + (float)(Main.screenWidth / 2)) / 16f); if (Main.musicVolume == 0f) { this.newMusic = 0; } else { if (Main.gameMenu) { if (Main.netMode != 2) { this.newMusic = 6; } else { this.newMusic = 0; } } else { float num3 = (float)(Main.maxTilesX / 4200); num3 *= num3; float num4 = (float)((double)((Main.screenPosition.Y + (float)(Main.screenHeight / 2)) / 16f - (65f + 10f * num3)) / (Main.worldSurface / 5.0)); if (flag6) { this.newMusic = 24; } else { if (flag2) { this.newMusic = 12; } else { if (flag) { this.newMusic = 5; } else { if (flag3) { this.newMusic = 13; } else { if (flag4) { this.newMusic = 17; } else { if (flag5) { this.newMusic = 25; } else { if (Main.player[Main.myPlayer].position.Y > (float)((Main.maxTilesY - 200) * 16)) { this.newMusic = 2; } else { if (Main.eclipse && (double)Main.player[Main.myPlayer].position.Y < Main.worldSurface * 16.0 + (double)(Main.screenHeight / 2)) { this.newMusic = 27; } else { if (num4 < 1f) { this.newMusic = 15; } else { if (Main.tile[(int)(Main.player[Main.myPlayer].Center().X / 16f), (int)(Main.player[Main.myPlayer].Center().Y / 16f)].wall == 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].zoneEvil) { if ((double)Main.player[Main.myPlayer].position.Y > Main.worldSurface * 16.0 + (double)(Main.screenHeight / 2)) { this.newMusic = 10; } else { this.newMusic = 8; } } else { if (Main.player[Main.myPlayer].zoneBlood) { if ((double)Main.player[Main.myPlayer].position.Y > Main.worldSurface * 16.0 + (double)(Main.screenHeight / 2)) { this.newMusic = 16; } else { this.newMusic = 16; } } 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) { if ((double)Main.player[Main.myPlayer].position.Y > Main.worldSurface * 16.0 + (double)(Main.screenHeight / 2)) { this.newMusic = 20; } else { this.newMusic = 14; } } 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 { this.newMusic = 4; } } else { if (Main.dayTime && Main.player[Main.myPlayer].zoneHoly) { if (Main.cloudAlpha > 0f && !Main.gameMenu) { this.newMusic = 19; } else { this.newMusic = 9; } } else { if ((double)(Main.screenPosition.Y / 16f) < Main.worldSurface + 10.0 && (num2 < 380 || num2 > Main.maxTilesX - 380)) { this.newMusic = 22; } else { if (Main.sandTiles > 1000) { this.newMusic = 21; } else { if (Main.dayTime) { if (Main.cloudAlpha > 0f && !Main.gameMenu) { this.newMusic = 19; } else { if (Main.dayMusic == 0) { Main.dayMusic = 1; } if (!Main.music[1].IsPlaying && !Main.music[18].IsPlaying) { int num5 = Main.rand.Next(2); if (num5 == 0) { Main.dayMusic = 1; } else { if (num5 == 1) { Main.dayMusic = 18; } } } this.newMusic = Main.dayMusic; } } else { if (!Main.dayTime) { if (Main.bloodMoon) { this.newMusic = 2; } else { if (Main.cloudAlpha > 0f && !Main.gameMenu) { this.newMusic = 19; } else { this.newMusic = 3; } } } } } } } } } } } } } } } } } } } } } } } } } } } if (Main.gameMenu || Main.musicVolume == 0f) { 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; } } Main.curMusic = this.newMusic; for (int j = 1; j < 30; j++) { if (j == 28) { if (Main.cloudAlpha > 0f && (double)Main.player[Main.myPlayer].position.Y < Main.worldSurface * 16.0 + (double)(Main.screenHeight / 2) && !Main.player[Main.myPlayer].zoneSnow) { if (!Main.music[j].IsPlaying) { Main.music[j] = Main.soundBank.GetCue("Music_" + j); Main.music[j].Play(); Main.music[j].SetVariable("Volume", Main.musicFade[j] * Main.musicVolume); } else { Main.musicFade[j] += 0.005f; if (Main.musicFade[j] > 1f) { Main.musicFade[j] = 1f; } Main.music[j].SetVariable("Volume", Main.musicFade[j] * Main.musicVolume); } } else { if (Main.music[j].IsPlaying) { if (Main.musicFade[Main.curMusic] > 0.25f) { Main.musicFade[j] -= 0.005f; } else { if (Main.curMusic == 0) { Main.musicFade[j] = 0f; } } if (Main.musicFade[j] <= 0f) { Main.musicFade[j] -= 0f; Main.music[j].Stop(AudioStopOptions.Immediate); } else { Main.music[j].SetVariable("Volume", Main.musicFade[j] * Main.musicVolume); } } else { Main.musicFade[j] = 0f; } } } else { if (j == Main.curMusic) { if (!Main.music[j].IsPlaying) { Main.music[j] = Main.soundBank.GetCue("Music_" + j); Main.music[j].Play(); Main.music[j].SetVariable("Volume", Main.musicFade[j] * Main.musicVolume); } else { Main.musicFade[j] += 0.005f; if (Main.musicFade[j] > 1f) { Main.musicFade[j] = 1f; } Main.music[j].SetVariable("Volume", Main.musicFade[j] * Main.musicVolume); } } else { if (Main.music[j].IsPlaying) { if (Main.musicFade[Main.curMusic] > 0.25f) { Main.musicFade[j] -= 0.005f; } else { if (Main.curMusic == 0) { Main.musicFade[j] = 0f; } } if (Main.musicFade[j] <= 0f) { Main.musicFade[j] -= 0f; Main.music[j].Stop(AudioStopOptions.Immediate); } else { Main.music[j].SetVariable("Volume", Main.musicFade[j] * Main.musicVolume); } } else { Main.musicFade[j] = 0f; } } } } if (Main.musicError > 0) { Main.musicError--; } } } catch { Main.musicError++; if (Main.musicError >= 100) { Main.musicError = 0; Main.musicVolume = 0f; } } } public static void snowing() { if (Main.gamePaused) { return; } if (Main.snowTiles > 0 && (double)Main.player[Main.myPlayer].position.Y < Main.worldSurface * 16.0) { int maxValue = 800 / Main.snowTiles; float num = (float)Main.screenWidth / 1920f; int num2 = (int)(500f * num); num2 = (int)((float)num2 * (1f + 2f * Main.cloudAlpha)); float num3 = 1f + 50f * Main.cloudAlpha; int num4 = 0; while ((float)num4 < num3) { try { if ((float)Main.snowDust >= (float)num2 * (Main.gfxQuality / 2f + 0.5f) + (float)num2 * 0.1f) { break; } if (Main.rand.Next(maxValue) == 0) { int num5 = Main.rand.Next(Main.screenWidth + 1000) - 500; int num6 = (int)Main.screenPosition.Y - Main.rand.Next(50); if (Main.player[Main.myPlayer].velocity.Y > 0f) { num6 -= (int)Main.player[Main.myPlayer].velocity.Y; } if (Main.rand.Next(5) == 0) { num5 = Main.rand.Next(500) - 500; } else { if (Main.rand.Next(5) == 0) { num5 = Main.rand.Next(500) + Main.screenWidth; } } if (num5 < 0 || num5 > Main.screenWidth) { num6 += Main.rand.Next((int)((double)Main.screenHeight * 0.5)) + (int)((double)Main.screenHeight * 0.1); } num5 += (int)Main.screenPosition.X; int num7 = num5 / 16; int num8 = num6 / 16; if (Main.tile[num7, num8] != null && Main.tile[num7, num8].wall == 0) { int num9 = Dust.NewDust(new Vector2((float)num5, (float)num6), 10, 10, 76, 0f, 0f, 0, default(Color), 1f); Main.dust[num9].scale += Main.cloudAlpha * 0.2f; Main.dust[num9].velocity.Y = 3f + (float)Main.rand.Next(30) * 0.1f; Dust expr_291_cp_0 = Main.dust[num9]; expr_291_cp_0.velocity.Y = expr_291_cp_0.velocity.Y * Main.dust[num9].scale; Main.dust[num9].velocity.X = Main.windSpeed + (float)Main.rand.Next(-10, 10) * 0.1f; Dust expr_2E4_cp_0 = Main.dust[num9]; expr_2E4_cp_0.velocity.X = expr_2E4_cp_0.velocity.X + Main.windSpeed * Main.cloudAlpha * 10f; Dust expr_30E_cp_0 = Main.dust[num9]; expr_30E_cp_0.velocity.Y = expr_30E_cp_0.velocity.Y * (1f + 0.3f * Main.cloudAlpha); Main.dust[num9].scale += Main.cloudAlpha * 0.2f; Main.dust[num9].velocity *= 1f + Main.cloudAlpha * 0.5f; } } } catch { } num4++; } } } public static void checkXMas() { DateTime now = DateTime.Now; int day = now.Day; int month = now.Month; if (day >= 15 && month == 12) { Main.xMas = true; return; } Main.xMas = false; } public void updateCloudLayer() { if (Main.netMode == 1) { return; } if (Main.netMode == 0 && Main.gameMenu) { return; } int num = 86400; int num2 = num / 24; float num3 = 1f + 4f * Main.cloudAlpha; if (Main.cloudBGActive > 0f) { if (Main.cloudBGActive > 1f) { Main.cloudBGActive -= (float)Main.dayRate / num3; } if (Main.cloudBGActive < 1f) { Main.cloudBGActive = 1f; } if (Main.cloudBGActive == 1f && Main.rand.Next((int)((float)(num2 * 2 / Main.dayRate) * num3)) == 0) { Main.cloudBGActive = (float)(-(float)Main.rand.Next(num2 * 4, num * 4)); if (Main.netMode == 2) { NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0); return; } } } else { if (Main.cloudBGActive < 0f) { Main.cloudBGActive += (float)Main.dayRate * num3; if (Main.raining) { Main.cloudBGActive += (float)(2 * Main.dayRate) * num3; } } if (Main.cloudBGActive > 0f) { Main.cloudBGActive = 0f; } if (Main.cloudBGActive == 0f && Main.rand.Next((int)((float)(num2 * 8 / Main.dayRate) / num3)) == 0) { Main.cloudBGActive = (float)Main.rand.Next(num2 * 3, num * 2); if (Main.netMode == 2) { NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0); } } } } public static void TeleportEffect(Rectangle effectRect, int Style) { if (Style == 1) { Main.PlaySound(2, effectRect.X + effectRect.Width / 2, effectRect.Y + effectRect.Height / 2, 8); int num = effectRect.Width * effectRect.Height / 5; for (int i = 0; i < num; i++) { int num2 = Dust.NewDust(new Vector2((float)effectRect.X, (float)effectRect.Y), effectRect.Width, effectRect.Height, 164, 0f, 0f, 0, default(Color), 1f); Main.dust[num2].scale = (float)Main.rand.Next(20, 70) * 0.01f; if (i < 10) { Main.dust[num2].scale += 0.25f; } if (i < 5) { Main.dust[num2].scale += 0.25f; } } return; } Main.PlaySound(2, effectRect.X + effectRect.Width / 2, effectRect.Y + effectRect.Height / 2, 6); int num3 = effectRect.Width * effectRect.Height / 5; for (int j = 0; j < num3; j++) { int num4 = Dust.NewDust(new Vector2((float)effectRect.X, (float)effectRect.Y), effectRect.Width, effectRect.Height, 159, 0f, 0f, 0, default(Color), 1f); Main.dust[num4].scale = (float)Main.rand.Next(20, 70) * 0.01f; if (j < 10) { Main.dust[num4].scale += 0.25f; } if (j < 5) { Main.dust[num4].scale += 0.25f; } } } protected override void Update(GameTime gameTime) { Main.ignoreErrors = true; if (Main.netMode == 2) { Main.cloudAlpha = Main.maxRaining; } if (base.IsActive && Main.cloudAlpha > 0f) { Rain.MakeRain(); } if (Main.netMode != 1) { this.updateCloudLayer(); } this.UpdateWeather(); if (Main.netMode != 2) { if (Main.ignoreErrors) { try { Main.snowing(); goto IL_63; } catch { goto IL_63; } } Main.snowing(); } IL_63: if (Main.chTitle) { Main.chTitle = false; this.SetTitle(); } Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); WorldGen.destroyObject = false; if (Main.gameMenu) { Main.mapFullscreen = false; } if (Main.dedServ) { if (Main.dedServFPS) { Main.updateTime++; if (!Main.fpsTimer.IsRunning) { Main.fpsTimer.Restart(); } if (Main.fpsTimer.ElapsedMilliseconds >= 1000L) { Main.dedServCount1 += Main.updateTime; Main.dedServCount2++; float num = (float)Main.dedServCount1 / (float)Main.dedServCount2; Console.WriteLine(string.Concat(new object[] { Main.updateTime, " (", num, ")" })); Main.updateTime = 0; Main.fpsTimer.Restart(); } } else { if (Main.fpsTimer.IsRunning) { Main.fpsTimer.Stop(); } Main.updateTime = 0; } } if (!Main.dedServ) { if (Main.superFast) { base.IsFixedTimeStep = false; this.graphics.SynchronizeWithVerticalRetrace = false; } else { if (Main.fixedTiming) { if (base.IsActive) { base.IsFixedTimeStep = false; } else { base.IsFixedTimeStep = true; } } else { base.IsFixedTimeStep = true; this.graphics.SynchronizeWithVerticalRetrace = true; } this.graphics.SynchronizeWithVerticalRetrace = true; } 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; } } if (Main.bgFrame[0] == 0) { Main.treeMntBG[1] = 94; } else { if (Main.bgFrame[0] == 1) { Main.treeMntBG[1] = 114; } else { if (Main.bgFrame[0] == 2) { Main.treeMntBG[1] = 115; } else { Main.treeMntBG[1] = 116; } } } if (Main.bgFrame[0] == 0) { Main.treeMntBG[0] = 93; } else { if (Main.bgFrame[0] == 1) { Main.treeMntBG[0] = 168; } else { if (Main.bgFrame[0] == 2) { Main.treeMntBG[0] = 169; } else { Main.treeMntBG[0] = 170; } } } } if (Main.treeMntBG[1] >= 180 && Main.treeMntBG[1] <= 183) { 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; } } } } this.UpdateMusic(); if (Main.showSplash) { return; } if (!Main.gameMenu && Main.netMode == 1) { if (!Main.saveTime.IsRunning) { Main.saveTime.Start(); } if (Main.saveTime.ElapsedMilliseconds > 300000L) { Main.saveTime.Reset(); WorldGen.saveToonWhilePlaying(); } } else { if (!Main.gameMenu && Main.autoSave) { if (!Main.saveTime.IsRunning) { Main.saveTime.Start(); } if (Main.saveTime.ElapsedMilliseconds > 600000L) { Main.saveTime.Reset(); WorldGen.saveToonWhilePlaying(); WorldGen.saveAndPlay(); } } else { if (Main.saveTime.IsRunning) { Main.saveTime.Stop(); } } } if (Main.teamCooldown > 0) { Main.teamCooldown--; } Main.updateTime++; if (Main.fpsTimer.ElapsedMilliseconds >= 1000L) { if ((float)Main.fpsCount >= 30f + 30f * Main.gfxQuality) { Main.gfxQuality += Main.gfxRate; Main.gfxRate += 0.005f; } else { if ((float)Main.fpsCount < 29f + 30f * Main.gfxQuality) { Main.gfxRate = 0.01f; Main.gfxQuality -= 0.1f; } } if (Main.gfxQuality < 0f) { Main.gfxQuality = 0f; } if (Main.gfxQuality > 1f) { Main.gfxQuality = 1f; } if (Main.maxQ && base.IsActive) { Main.gfxQuality = 1f; Main.maxQ = false; } Main.updateRate = Main.uCount; Main.frameRate = Main.fpsCount; Main.fpsCount = 0; Main.fpsTimer.Restart(); Main.updateTime = 0; Main.drawTime = 0; Main.uCount = 0; if ((double)Main.gfxQuality < 0.8) { Main.mapTimeMax = (int)((1f - Main.gfxQuality) * 60f); } else { Main.mapTimeMax = 0; } int arg_5CA_0 = Main.netMode; } if (Main.fixedTiming) { float num2 = 16f; float num3 = (float)Main.updateTimer.ElapsedMilliseconds; if (num3 + Main.uCarry < num2 && !Main.superFast) { Main.drawSkip = true; return; } Main.uCarry += num3 - num2; if (Main.uCarry > 1000f) { Main.uCarry = 1000f; } Main.updateTimer.Restart(); } Main.uCount++; Main.drawSkip = false; if (Main.qaStyle == 1) { Main.gfxQuality = 1f; } else { if (Main.qaStyle == 2) { Main.gfxQuality = 0.5f; } else { if (Main.qaStyle == 3) { Main.gfxQuality = 0f; } } } Main.numDust = (int)(6000f * (Main.gfxQuality * 0.7f + 0.3f)); if ((double)Main.gfxQuality < 0.9) { Main.numDust = (int)((float)Main.numDust * Main.gfxQuality); } if (Main.numDust < 1000) { Main.numDust = 1000; } Gore.goreTime = (int)(600f * Main.gfxQuality); Liquid.maxLiquid = (int)(2500f + 2500f * Main.gfxQuality); Liquid.cycles = (int)(17f - 10f * Main.gfxQuality); if ((double)Main.gfxQuality < 0.5) { this.graphics.SynchronizeWithVerticalRetrace = false; } else { this.graphics.SynchronizeWithVerticalRetrace = true; } if (Main.superFast) { this.graphics.SynchronizeWithVerticalRetrace = false; Main.drawSkip = false; } if ((double)Main.gfxQuality < 0.2) { Lighting.maxRenderCount = 8; } else { if ((double)Main.gfxQuality < 0.4) { Lighting.maxRenderCount = 7; } else { if ((double)Main.gfxQuality < 0.6) { Lighting.maxRenderCount = 6; } else { if ((double)Main.gfxQuality < 0.8) { Lighting.maxRenderCount = 5; } else { Lighting.maxRenderCount = 4; } } } } if (Liquid.quickSettle) { Liquid.maxLiquid = Liquid.resLiquid; Liquid.cycles = 1; } if (!base.IsActive) { Main.hasFocus = false; } else { Main.hasFocus = true; } if (!Main.gameMenu || Main.netMode == 2) { WorldGen.tempRaining = Main.raining; WorldGen.tempRainTime = Main.rainTime; WorldGen.tempMaxRain = Main.maxRaining; } if (!base.IsActive && Main.netMode == 0) { base.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; } base.IsMouseVisible = false; Main.demonTorch += (float)Main.demonTorchDir * 0.01f; if (Main.demonTorch > 1f) { Main.demonTorch = 1f; Main.demonTorchDir = -1; } if (Main.demonTorch < 0f) { Main.demonTorch = 0f; Main.demonTorchDir = 1; } int num4 = 7; if (this.DiscoStyle == 0) { Main.DiscoG += num4; if (Main.DiscoG >= 255) { Main.DiscoG = 255; this.DiscoStyle++; } Main.DiscoR -= num4; if (Main.DiscoR <= 0) { Main.DiscoR = 0; } } else { if (this.DiscoStyle == 1) { Main.DiscoB += num4; if (Main.DiscoB >= 255) { Main.DiscoB = 255; this.DiscoStyle++; } Main.DiscoG -= num4; if (Main.DiscoG <= 0) { Main.DiscoG = 0; } } else { Main.DiscoR += num4; if (Main.DiscoR >= 255) { Main.DiscoR = 255; this.DiscoStyle = 0; } Main.DiscoB -= num4; if (Main.DiscoB <= 0) { Main.DiscoB = 0; } } } if (Main.gFadeDir == 1) { Main.gFader += 0.1f; Main.gFade = (byte)Main.gFader; if (Main.gFade > 150) { Main.gFadeDir = 0; } } else { Main.gFader -= 0.1f; Main.gFade = (byte)Main.gFader; if (Main.gFade < 100) { Main.gFadeDir = 1; } } Main.wFrCounter += Main.windSpeed * 2f; if (Main.wFrCounter > 4f) { Main.wFrCounter = 0f; Main.wFrame += 1f; } if (Main.wFrCounter < 0f) { Main.wFrCounter = 4f; Main.wFrame -= 1f; } if (Main.wFrame > 16f) { Main.wFrame = 1f; } if (Main.wFrame < 1f) { Main.wFrame = 16f; } Main.wFallFrCounter += 1f; if (Main.wFallFrCounter > 2f) { Main.wFallFrCounter = 0f; Main.wFallFrame += 1f; } if (Main.wFallFrame > 15f) { Main.wFallFrame = 0f; } Main.wFallFrCounter2 += 1f; if (Main.wFallFrCounter2 > 6f) { Main.wFallFrCounter2 = 0f; Main.wFallFrame2 += 1f; } if (Main.wFallFrame2 > 15f) { Main.wFallFrame2 = 0f; } Main.wFallFrCounter3 += 1f; if (Main.wFallFrCounter3 > 0f) { Main.wFallFrCounter3 = 0f; Main.wFallFrame3 += 1f; } if (Main.wFallFrame3 > 7f) { Main.wFallFrame3 -= 8f; } Main.wFallFrCounter4 += 1f; if (Main.wFallFrCounter4 > 2f) { Main.wFallFrCounter4 = 0f; Main.wFallFrame4 -= 1f; } if (Main.wFallFrame4 < 0f) { Main.wFallFrame4 += 8f; } 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; } } 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[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] >= 4) { 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; } if (Main.tileFrame[235] > 1) { Main.tileLighted[235] = true; } else { Main.tileLighted[235] = false; } } 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; } } if (Main.keyState.IsKeyDown(Keys.F10) && !Main.chatMode && !Main.editSign) { if (Main.frameRelease) { Main.PlaySound(12, -1, -1, 1); if (Main.showFrameRate) { Main.showFrameRate = false; } else { Main.showFrameRate = true; } } Main.frameRelease = false; } else { Main.frameRelease = true; } if (Main.keyState.IsKeyDown(Keys.F9) && !Main.chatMode && !Main.editSign) { if (Main.RGBRelease) { Lighting.lightCounter += 100; Main.PlaySound(12, -1, -1, 1); Lighting.lightMode++; if (Lighting.lightMode >= 4) { Lighting.lightMode = 0; } if (Lighting.lightMode == 2 || Lighting.lightMode == 0) { Main.renderCount = 0; Main.renderNow = true; int num5 = Main.screenWidth / 16 + Lighting.offScreenTiles * 2; int num6 = Main.screenHeight / 16 + Lighting.offScreenTiles * 2; for (int i = 0; i < num5; i++) { for (int j = 0; j < num6; j++) { Lighting.color[i, j] = 0f; Lighting.colorG[i, j] = 0f; Lighting.colorB[i, j] = 0f; } } } } Main.RGBRelease = false; } else { Main.RGBRelease = true; } if (Main.keyState.IsKeyDown(Keys.F8) && !Main.chatMode && !Main.editSign) { if (Main.netRelease) { Main.PlaySound(12, -1, -1, 1); if (Main.netDiag) { Main.netDiag = false; } else { Main.netDiag = true; } } Main.netRelease = false; } else { Main.netRelease = true; } if (Main.keyState.IsKeyDown(Keys.F7) && !Main.chatMode && !Main.editSign) { if (Main.drawRelease) { Main.PlaySound(12, -1, -1, 1); if (Main.drawDiag) { Main.drawDiag = false; } else { Main.drawDiag = true; } } Main.drawRelease = false; } else { Main.drawRelease = true; } if (Main.keyState.IsKeyDown(Keys.F11)) { if (Main.releaseUI) { if (Main.hideUI) { Main.hideUI = false; } else { Main.hideUI = true; } } Main.releaseUI = false; } else { Main.releaseUI = true; } if ((Main.keyState.IsKeyDown(Keys.LeftAlt) || Main.keyState.IsKeyDown(Keys.RightAlt)) && Main.keyState.IsKeyDown(Keys.Enter)) { if (this.toggleFullscreen) { this.graphics.ToggleFullScreen(); Main.chatRelease = false; } this.toggleFullscreen = false; } else { this.toggleFullscreen = true; } if (!Main.gamePad || Main.gameMenu) { Main.oldMouseState = Main.mouseState; Main.mouseState = Mouse.GetState(); Main.mouseX = Main.mouseState.X; Main.mouseY = Main.mouseState.Y; Main.mouseLeft = false; Main.mouseRight = false; if (Main.mouseState.LeftButton == ButtonState.Pressed) { Main.mouseLeft = true; } if (Main.mouseState.RightButton == ButtonState.Pressed) { Main.mouseRight = true; } } Main.keyState = Keyboard.GetState(); if (Main.editSign) { Main.chatMode = false; } if (!Main.chatMode) { Main.startChatLine = 0; } if (Main.chatMode) { Main.showCount = (int)((float)(Main.screenHeight / 3) / Main.fontMouseText.MeasureString("1").Y) - 1; if (Main.keyState.IsKeyDown(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(Keys.Down)) { Main.startChatLine--; if (Main.startChatLine < 0) { Main.startChatLine = 0; } } } if (Main.keyState.IsKeyDown(Keys.Escape)) { Main.chatMode = false; } string text = Main.chatText; Main.chatText = Main.GetInputText(Main.chatText); int num7 = Main.screenWidth - 330; while (Main.fontMouseText.MeasureString(Main.chatText).X > (float)num7) { Main.chatText = Main.chatText.Substring(0, Main.chatText.Length - 1); } if (text != Main.chatText) { Main.PlaySound(12, -1, -1, 1); } if (Main.inputTextEnter && Main.chatRelease) { if (Main.chatText != "") { NetMessage.SendData(25, -1, -1, Main.chatText, Main.myPlayer, 0f, 0f, 0f, 0); } Main.chatText = ""; Main.chatMode = false; Main.chatRelease = false; Main.player[Main.myPlayer].releaseHook = false; Main.player[Main.myPlayer].releaseThrow = false; Main.PlaySound(11, -1, -1, 1); } } if (Main.keyState.IsKeyDown(Keys.Enter) && Main.netMode == 1 && !Main.keyState.IsKeyDown(Keys.LeftAlt) && !Main.keyState.IsKeyDown(Keys.RightAlt)) { if (Main.chatRelease && !Main.chatMode && !Main.editSign && !Main.gameMenu && !Main.keyState.IsKeyDown(Keys.Escape)) { Main.PlaySound(10, -1, -1, 1); Main.chatMode = true; Main.clrInput(); Main.chatText = ""; } Main.chatRelease = false; } else { Main.chatRelease = true; } if (Main.gameMenu) { Main.UpdateMenu(); if (Main.netMode != 2) { return; } Main.gamePaused = false; } } if (Main.netMode == 1) { for (int k = 0; k < 59; k++) { if (Main.player[Main.myPlayer].inventory[k].IsNotTheSameAs(Main.clientPlayer.inventory[k])) { NetMessage.SendData(5, -1, -1, Main.player[Main.myPlayer].inventory[k].name, Main.myPlayer, (float)k, (float)Main.player[Main.myPlayer].inventory[k].prefix, 0f, 0); } } if (Main.player[Main.myPlayer].armor[0].IsNotTheSameAs(Main.clientPlayer.armor[0])) { NetMessage.SendData(5, -1, -1, Main.player[Main.myPlayer].armor[0].name, Main.myPlayer, 59f, (float)Main.player[Main.myPlayer].armor[0].prefix, 0f, 0); } if (Main.player[Main.myPlayer].armor[1].IsNotTheSameAs(Main.clientPlayer.armor[1])) { NetMessage.SendData(5, -1, -1, Main.player[Main.myPlayer].armor[1].name, Main.myPlayer, 60f, (float)Main.player[Main.myPlayer].armor[1].prefix, 0f, 0); } if (Main.player[Main.myPlayer].armor[2].IsNotTheSameAs(Main.clientPlayer.armor[2])) { NetMessage.SendData(5, -1, -1, Main.player[Main.myPlayer].armor[2].name, Main.myPlayer, 61f, (float)Main.player[Main.myPlayer].armor[2].prefix, 0f, 0); } if (Main.player[Main.myPlayer].armor[3].IsNotTheSameAs(Main.clientPlayer.armor[3])) { NetMessage.SendData(5, -1, -1, Main.player[Main.myPlayer].armor[3].name, Main.myPlayer, 62f, (float)Main.player[Main.myPlayer].armor[3].prefix, 0f, 0); } if (Main.player[Main.myPlayer].armor[4].IsNotTheSameAs(Main.clientPlayer.armor[4])) { NetMessage.SendData(5, -1, -1, Main.player[Main.myPlayer].armor[4].name, Main.myPlayer, 63f, (float)Main.player[Main.myPlayer].armor[4].prefix, 0f, 0); } if (Main.player[Main.myPlayer].armor[5].IsNotTheSameAs(Main.clientPlayer.armor[5])) { NetMessage.SendData(5, -1, -1, Main.player[Main.myPlayer].armor[5].name, Main.myPlayer, 64f, (float)Main.player[Main.myPlayer].armor[5].prefix, 0f, 0); } if (Main.player[Main.myPlayer].armor[6].IsNotTheSameAs(Main.clientPlayer.armor[6])) { NetMessage.SendData(5, -1, -1, Main.player[Main.myPlayer].armor[6].name, Main.myPlayer, 65f, (float)Main.player[Main.myPlayer].armor[6].prefix, 0f, 0); } if (Main.player[Main.myPlayer].armor[7].IsNotTheSameAs(Main.clientPlayer.armor[7])) { NetMessage.SendData(5, -1, -1, Main.player[Main.myPlayer].armor[7].name, Main.myPlayer, 66f, (float)Main.player[Main.myPlayer].armor[7].prefix, 0f, 0); } if (Main.player[Main.myPlayer].armor[8].IsNotTheSameAs(Main.clientPlayer.armor[8])) { NetMessage.SendData(5, -1, -1, Main.player[Main.myPlayer].armor[8].name, Main.myPlayer, 67f, (float)Main.player[Main.myPlayer].armor[8].prefix, 0f, 0); } if (Main.player[Main.myPlayer].armor[9].IsNotTheSameAs(Main.clientPlayer.armor[9])) { NetMessage.SendData(5, -1, -1, Main.player[Main.myPlayer].armor[9].name, Main.myPlayer, 68f, (float)Main.player[Main.myPlayer].armor[9].prefix, 0f, 0); } if (Main.player[Main.myPlayer].armor[10].IsNotTheSameAs(Main.clientPlayer.armor[10])) { NetMessage.SendData(5, -1, -1, Main.player[Main.myPlayer].armor[10].name, Main.myPlayer, 69f, (float)Main.player[Main.myPlayer].armor[10].prefix, 0f, 0); } if (Main.player[Main.myPlayer].dye[0].IsNotTheSameAs(Main.clientPlayer.dye[0])) { NetMessage.SendData(5, -1, -1, Main.player[Main.myPlayer].dye[0].name, Main.myPlayer, 70f, (float)Main.player[Main.myPlayer].dye[0].prefix, 0f, 0); } if (Main.player[Main.myPlayer].dye[1].IsNotTheSameAs(Main.clientPlayer.dye[1])) { NetMessage.SendData(5, -1, -1, Main.player[Main.myPlayer].dye[1].name, Main.myPlayer, 71f, (float)Main.player[Main.myPlayer].dye[1].prefix, 0f, 0); } if (Main.player[Main.myPlayer].dye[2].IsNotTheSameAs(Main.clientPlayer.dye[2])) { NetMessage.SendData(5, -1, -1, Main.player[Main.myPlayer].dye[2].name, Main.myPlayer, 72f, (float)Main.player[Main.myPlayer].dye[2].prefix, 0f, 0); } if (Main.player[Main.myPlayer].chest != Main.clientPlayer.chest) { NetMessage.SendData(33, -1, -1, "", Main.player[Main.myPlayer].chest, 0f, 0f, 0f, 0); } if (Main.player[Main.myPlayer].talkNPC != Main.clientPlayer.talkNPC) { NetMessage.SendData(40, -1, -1, "", Main.myPlayer, 0f, 0f, 0f, 0); } if (Main.player[Main.myPlayer].zoneEvil != Main.clientPlayer.zoneEvil) { NetMessage.SendData(36, -1, -1, "", Main.myPlayer, 0f, 0f, 0f, 0); } if (Main.player[Main.myPlayer].zoneMeteor != Main.clientPlayer.zoneMeteor) { NetMessage.SendData(36, -1, -1, "", Main.myPlayer, 0f, 0f, 0f, 0); } if (Main.player[Main.myPlayer].zoneDungeon != Main.clientPlayer.zoneDungeon) { NetMessage.SendData(36, -1, -1, "", Main.myPlayer, 0f, 0f, 0f, 0); } if (Main.player[Main.myPlayer].zoneJungle != Main.clientPlayer.zoneJungle) { NetMessage.SendData(36, -1, -1, "", Main.myPlayer, 0f, 0f, 0f, 0); } if (Main.player[Main.myPlayer].zoneHoly != Main.clientPlayer.zoneHoly) { NetMessage.SendData(36, -1, -1, "", Main.myPlayer, 0f, 0f, 0f, 0); } if (Main.player[Main.myPlayer].zoneSnow != Main.clientPlayer.zoneSnow) { NetMessage.SendData(36, -1, -1, "", Main.myPlayer, 0f, 0f, 0f, 0); } if (Main.player[Main.myPlayer].zoneBlood != Main.clientPlayer.zoneBlood) { NetMessage.SendData(36, -1, -1, "", Main.myPlayer, 0f, 0f, 0f, 0); } if (Main.player[Main.myPlayer].zoneCandle != Main.clientPlayer.zoneCandle) { NetMessage.SendData(36, -1, -1, "", Main.myPlayer, 0f, 0f, 0f, 0); } bool flag = false; for (int l = 0; l < 10; l++) { if (Main.player[Main.myPlayer].buffType[l] != Main.clientPlayer.buffType[l]) { flag = true; } } if (flag) { NetMessage.SendData(50, -1, -1, "", Main.myPlayer, 0f, 0f, 0f, 0); NetMessage.SendData(13, -1, -1, "", Main.myPlayer, 0f, 0f, 0f, 0); } } 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.autoPause) { Keys[] pressedKeys = Main.keyState.GetPressedKeys(); Main.player[Main.myPlayer].controlInv = false; for (int m = 0; m < pressedKeys.Length; m++) { string text2 = string.Concat(pressedKeys[m]); if (text2 == Main.cInv) { Main.player[Main.myPlayer].controlInv = true; } } 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 num8 = (Main.mouseState.ScrollWheelValue - Main.oldMouseState.ScrollWheelValue) / 120; Main.focusRecipe += num8; 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[8].headSlot >= 0) { Main.player[Main.myPlayer].head = Main.player[Main.myPlayer].armor[8].headSlot; } if (Main.player[Main.myPlayer].armor[9].bodySlot >= 0) { Main.player[Main.myPlayer].body = Main.player[Main.myPlayer].armor[9].bodySlot; } if (Main.player[Main.myPlayer].armor[10].legSlot >= 0) { Main.player[Main.myPlayer].legs = Main.player[Main.myPlayer].armor[10].legSlot; } } if (Main.editSign) { if (Main.player[Main.myPlayer].sign == -1) { Main.editSign = false; } else { Main.npcChatText = Main.GetInputText(Main.npcChatText); if (Main.inputTextEnter) { byte[] bytes = new byte[] { 10 }; Main.npcChatText += Encoding.ASCII.GetString(bytes); } } } Main.gamePaused = true; return; } Main.gamePaused = false; if (!Main.dedServ && (double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0 && Main.netMode != 2) { Star.UpdateStars(); Cloud.UpdateClouds(); } Main.numPlayers = 0; int n = 0; while (n < 255) { if (Main.ignoreErrors) { try { Main.player[n].UpdatePlayer(n); goto IL_2568; } catch { goto IL_2568; } goto IL_2559; } goto IL_2559; IL_2568: n++; continue; IL_2559: Main.player[n].UpdatePlayer(n); goto IL_2568; } if (Main.netMode != 1) { NPC.SpawnNPC(); } for (int num9 = 0; num9 < 255; num9++) { Main.player[num9].activeNPCs = 0f; Main.player[num9].townNPCs = 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; } int num10 = 0; while (num10 < 200) { if (Main.ignoreErrors) { try { Main.npc[num10].UpdateNPC(num10); goto IL_2678; } catch (Exception) { Main.npc[num10] = new NPC(); goto IL_2678; } goto IL_2669; } goto IL_2669; IL_2678: num10++; continue; IL_2669: Main.npc[num10].UpdateNPC(num10); goto IL_2678; } int num11 = 0; while (num11 < 500) { if (Main.ignoreErrors) { try { Main.gore[num11].Update(); goto IL_26BF; } catch { Main.gore[num11] = new Gore(); goto IL_26BF; } goto IL_26B2; } goto IL_26B2; IL_26BF: num11++; continue; IL_26B2: Main.gore[num11].Update(); goto IL_26BF; } int num12 = 0; while (num12 < 1000) { if (Main.ignoreErrors) { try { Main.projectile[num12].Update(num12); goto IL_270A; } catch { Main.projectile[num12] = new Projectile(); goto IL_270A; } goto IL_26FB; } goto IL_26FB; IL_270A: num12++; continue; IL_26FB: Main.projectile[num12].Update(num12); goto IL_270A; } int num13 = 0; while (num13 < 400) { if (Main.ignoreErrors) { try { Main.item[num13].UpdateItem(num13); goto IL_2755; } catch { Main.item[num13] = new Item(); goto IL_2755; } goto IL_2746; } goto IL_2746; IL_2755: num13++; continue; IL_2746: Main.item[num13].UpdateItem(num13); goto IL_2755; } if (Main.ignoreErrors) { try { Dust.UpdateDust(); goto IL_279B; } catch { for (int num14 = 0; num14 < 6000; num14++) { Main.dust[num14] = new Dust(); } goto IL_279B; } } Dust.UpdateDust(); IL_279B: if (Main.netMode != 2) { CombatText.UpdateCombatText(); ItemText.UpdateItemText(); } if (Main.ignoreErrors) { try { Main.UpdateTime(); goto IL_27C9; } catch { Main.checkForSpawns = 0; goto IL_27C9; } } Main.UpdateTime(); IL_27C9: if (Main.netMode != 1) { if (Main.ignoreErrors) { try { WorldGen.UpdateWorld(); Main.UpdateInvasion(); goto IL_27F1; } catch { goto IL_27F1; } } WorldGen.UpdateWorld(); Main.UpdateInvasion(); } IL_27F1: if (Main.ignoreErrors) { try { if (Main.netMode == 2) { Main.UpdateServer(); } if (Main.netMode == 1) { Main.UpdateClient(); } goto IL_2839; } catch { int arg_281C_0 = Main.netMode; goto IL_2839; } } if (Main.netMode == 2) { Main.UpdateServer(); } if (Main.netMode == 1) { Main.UpdateClient(); } IL_2839: if (Main.ignoreErrors) { try { for (int num15 = 0; num15 < Main.numChatLines; num15++) { if (Main.chatLine[num15].showTime > 0) { Main.chatLine[num15].showTime--; } } goto IL_28D8; } catch { for (int num16 = 0; num16 < Main.numChatLines; num16++) { Main.chatLine[num16] = new ChatLine(); } goto IL_28D8; } } for (int num17 = 0; num17 < Main.numChatLines; num17++) { if (Main.chatLine[num17].showTime > 0) { Main.chatLine[num17].showTime--; } } IL_28D8: Main.upTimer = (float)stopwatch.ElapsedMilliseconds; if (Main.upTimerMaxDelay > 0f) { Main.upTimerMaxDelay -= 1f; } else { Main.upTimerMax = 0f; } if (Main.upTimer > Main.upTimerMax) { Main.upTimerMax = Main.upTimer; Main.upTimerMaxDelay = 400f; } base.Update(gameTime); } private static void UpdateMenu() { Main.playerInventory = false; Main.exitScale = 0.8f; if (Main.netMode == 0) { Main.maxRaining = 0f; Main.raining = false; if (!Main.grabSky) { Main.time += 86.4; if (!Main.dayTime) { if (Main.time > 32400.0) { Main.bloodMoon = false; Main.time = 0.0; Main.dayTime = true; Main.moonPhase++; if (Main.moonPhase >= 8) { Main.moonPhase = 0; return; } } } else { if (Main.time > 54000.0) { Main.time = 0.0; Main.dayTime = false; return; } } } } else { if (Main.netMode == 1) { Main.UpdateTime(); } } } public static void clrInput() { Main.keyCount = 0; } [DllImport("user32.dll", CharSet = CharSet.Auto, ExactSpelling = true)] public static extern short GetKeyState(int keyCode); public static string GetInputText(string oldString) { if (!Main.hasFocus) { return oldString; } Main.inputTextEnter = false; string text = oldString; string text2 = ""; if (text == null) { text = ""; } bool flag = false; for (int i = 0; i < Main.keyCount; i++) { int num = Main.keyInt[i]; string str = Main.keyString[i]; if (num == 13) { Main.inputTextEnter = true; } else { if (num >= 32 && num != 127) { text2 += str; } } } Main.keyCount = 0; text += text2; Main.oldInputText = Main.inputText; Main.inputText = Keyboard.GetState(); Keys[] pressedKeys = Main.inputText.GetPressedKeys(); Keys[] pressedKeys2 = Main.oldInputText.GetPressedKeys(); if (Main.inputText.IsKeyDown(Keys.Back) && Main.oldInputText.IsKeyDown(Keys.Back)) { if (Main.backSpaceCount == 0) { Main.backSpaceCount = 7; flag = true; } Main.backSpaceCount--; } else { Main.backSpaceCount = 15; } for (int j = 0; j < pressedKeys.Length; j++) { bool flag2 = true; for (int k = 0; k < pressedKeys2.Length; k++) { if (pressedKeys[j] == pressedKeys2[k]) { flag2 = false; } } string text3 = string.Concat(pressedKeys[j]); if (text3 == "Back" && (flag2 || flag) && text.Length > 0) { text = text.Substring(0, text.Length - 1); } } return text; } protected void MouseText(string cursorText, int rare = 0, byte diff = 0) { if (this.mouseNPC > -1) { return; } if (cursorText == null) { return; } int num = Main.mouseX + 10; int num2 = Main.mouseY + 10; Color color = new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor); float num22; if (Main.toolTip.type > 0) { rare = Main.toolTip.rare; float knockBack = Main.toolTip.knockBack; if (Main.player[Main.myPlayer].kbGlove) { Main.toolTip.knockBack *= 1.7f; } if (Main.toolTip.ranged && Main.player[Main.myPlayer].armorSteath) { Main.toolTip.knockBack *= 1f + (1f - Main.player[Main.myPlayer].stealth) * 0.5f; } int num3 = 20; int num4 = 1; string[] array = new string[num3]; bool[] array2 = new bool[num3]; bool[] array3 = new bool[num3]; for (int i = 0; i < num3; i++) { array2[i] = false; array3[i] = false; } array[0] = Main.toolTip.AffixName(); if (Main.toolTip.stack > 1) { string[] array4; string[] expr_138 = array4 = array; int arg_17C_1 = 0; object obj = array4[0]; expr_138[arg_17C_1] = string.Concat(new object[] { obj, " (", Main.toolTip.stack, ")" }); } if (Main.toolTip.social) { array[num4] = Lang.tip[0]; num4++; array[num4] = Lang.tip[1]; num4++; } else { if (Main.toolTip.damage > 0 && !Main.toolTip.notAmmo) { int damage = Main.toolTip.damage; if (Main.toolTip.melee) { array[num4] = string.Concat((int)(Main.player[Main.myPlayer].meleeDamage * (float)damage)); string[] array5; IntPtr intPtr; (array5 = array)[(int)(intPtr = (IntPtr)num4)] = array5[(int)intPtr] + Lang.tip[2]; } else { if (Main.toolTip.ranged) { float num5 = (float)damage * Main.player[Main.myPlayer].rangedDamage; if (Main.toolTip.useAmmo == 1) { num5 *= Main.player[Main.myPlayer].arrowDamage; } if (Main.toolTip.useAmmo == 14) { num5 *= Main.player[Main.myPlayer].bulletDamage; } if (Main.toolTip.useAmmo == 771 || Main.toolTip.useAmmo == 246) { num5 *= Main.player[Main.myPlayer].rocketDamage; } array[num4] = string.Concat((int)num5); string[] array6; IntPtr intPtr2; (array6 = array)[(int)(intPtr2 = (IntPtr)num4)] = array6[(int)intPtr2] + Lang.tip[3]; } else { if (Main.toolTip.magic) { array[num4] = string.Concat((int)(Main.player[Main.myPlayer].magicDamage * (float)damage)); string[] array7; IntPtr intPtr3; (array7 = array)[(int)(intPtr3 = (IntPtr)num4)] = array7[(int)intPtr3] + Lang.tip[4]; } else { if (Main.toolTip.summon) { array[num4] = string.Concat((int)(Main.player[Main.myPlayer].minionDamage * (float)damage)); string[] array8; IntPtr intPtr4; (array8 = array)[(int)(intPtr4 = (IntPtr)num4)] = array8[(int)intPtr4] + Lang.tip[53]; } else { array[num4] = string.Concat(damage); string[] array9; IntPtr intPtr5; (array9 = array)[(int)(intPtr5 = (IntPtr)num4)] = array9[(int)intPtr5] + Lang.tip[55]; } } } } num4++; if (Main.toolTip.melee) { int num6 = Main.player[Main.myPlayer].meleeCrit - Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].crit + Main.toolTip.crit; array[num4] = num6 + Lang.tip[5]; num4++; } else { if (Main.toolTip.ranged) { int num7 = Main.player[Main.myPlayer].rangedCrit - Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].crit + Main.toolTip.crit; array[num4] = num7 + Lang.tip[5]; num4++; } else { if (Main.toolTip.magic) { int num8 = Main.player[Main.myPlayer].magicCrit - Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].crit + Main.toolTip.crit; array[num4] = num8 + Lang.tip[5]; num4++; } } } if (Main.toolTip.useStyle > 0) { if (Main.toolTip.useAnimation <= 8) { array[num4] = Lang.tip[6]; } else { if (Main.toolTip.useAnimation <= 20) { array[num4] = Lang.tip[7]; } else { if (Main.toolTip.useAnimation <= 25) { array[num4] = Lang.tip[8]; } else { if (Main.toolTip.useAnimation <= 30) { array[num4] = Lang.tip[9]; } else { if (Main.toolTip.useAnimation <= 35) { array[num4] = Lang.tip[10]; } else { if (Main.toolTip.useAnimation <= 45) { array[num4] = Lang.tip[11]; } else { if (Main.toolTip.useAnimation <= 55) { array[num4] = Lang.tip[12]; } else { array[num4] = Lang.tip[13]; } } } } } } } num4++; } float num9 = Main.toolTip.knockBack; if (Main.toolTip.summon) { num9 += Main.player[Main.myPlayer].minionKB; } if (num9 == 0f) { array[num4] = Lang.tip[14]; } else { if ((double)num9 <= 1.5) { array[num4] = Lang.tip[15]; } else { if (num9 <= 3f) { array[num4] = Lang.tip[16]; } else { if (num9 <= 4f) { array[num4] = Lang.tip[17]; } else { if (num9 <= 6f) { array[num4] = Lang.tip[18]; } else { if (num9 <= 7f) { array[num4] = Lang.tip[19]; } else { if (num9 <= 9f) { array[num4] = Lang.tip[20]; } else { if (num9 <= 11f) { array[num4] = Lang.tip[21]; } else { array[num4] = Lang.tip[22]; } } } } } } } } num4++; } if (Main.toolTip.headSlot > 0 || Main.toolTip.bodySlot > 0 || Main.toolTip.legSlot > 0 || Main.toolTip.accessory) { array[num4] = Lang.tip[23]; num4++; } if (Main.toolTip.tileWand > 0) { array[num4] = Lang.tip[52] + Lang.itemName(Main.toolTip.tileWand, false); num4++; } if (Main.toolTip.vanity) { array[num4] = Lang.tip[24]; num4++; } if (Main.toolTip.defense > 0) { array[num4] = Main.toolTip.defense + Lang.tip[25]; num4++; } if (Main.toolTip.pick > 0) { array[num4] = Main.toolTip.pick + Lang.tip[26]; num4++; } if (Main.toolTip.axe > 0) { array[num4] = Main.toolTip.axe * 5 + Lang.tip[27]; num4++; } if (Main.toolTip.hammer > 0) { array[num4] = Main.toolTip.hammer + Lang.tip[28]; num4++; } if (Main.toolTip.tileBoost != 0) { int tileBoost = Main.toolTip.tileBoost; if (tileBoost > 0) { array[num4] = "+" + tileBoost + Lang.tip[54]; } else { array[num4] = tileBoost + Lang.tip[54]; } num4++; } if (Main.toolTip.healLife > 0) { array[num4] = string.Concat(new object[] { Lang.tip[29], " ", Main.toolTip.healLife, " ", Lang.tip[30] }); num4++; } if (Main.toolTip.healMana > 0) { array[num4] = string.Concat(new object[] { Lang.tip[29], " ", Main.toolTip.healMana, " ", Lang.tip[31] }); num4++; } if (Main.toolTip.mana > 0 && (Main.toolTip.type != 127 || !Main.player[Main.myPlayer].spaceGun)) { array[num4] = string.Concat(new object[] { Lang.tip[32], " ", (int)((float)Main.toolTip.mana * Main.player[Main.myPlayer].manaCost), " ", Lang.tip[31] }); num4++; } if (Main.toolTip.createWall > 0 || Main.toolTip.createTile > -1) { if (Main.toolTip.type != 213 && Main.toolTip.type != 832) { array[num4] = Lang.tip[33]; num4++; } } else { if (Main.toolTip.ammo > 0 && !Main.toolTip.notAmmo) { array[num4] = Lang.tip[34]; num4++; } else { if (Main.toolTip.consumable) { array[num4] = Lang.tip[35]; num4++; } } } if (Main.toolTip.material) { array[num4] = Lang.tip[36]; num4++; } if (Main.toolTip.toolTip != null) { array[num4] = Main.toolTip.toolTip; num4++; } if (Main.toolTip.toolTip2 != null) { array[num4] = Main.toolTip.toolTip2; num4++; } if (Main.toolTip.buffTime > 0) { string text; if (Main.toolTip.buffTime / 60 >= 60) { text = Math.Round((double)(Main.toolTip.buffTime / 60) / 60.0) + Lang.tip[37]; } else { text = Math.Round((double)Main.toolTip.buffTime / 60.0) + Lang.tip[38]; } array[num4] = text; num4++; } if (Main.toolTip.prefix > 0) { if (Main.cpItem == null || Main.cpItem.netID != Main.toolTip.netID) { Main.cpItem = new Item(); Main.cpItem.netDefaults(Main.toolTip.netID); } if (Main.cpItem.damage != Main.toolTip.damage) { double num10 = (double)((float)Main.toolTip.damage - (float)Main.cpItem.damage); num10 = num10 / (double)((float)Main.cpItem.damage) * 100.0; num10 = Math.Round(num10); if (num10 > 0.0) { array[num4] = "+" + num10 + Lang.tip[39]; } else { array[num4] = num10 + Lang.tip[39]; } if (num10 < 0.0) { array3[num4] = true; } array2[num4] = true; num4++; } if (Main.cpItem.useAnimation != Main.toolTip.useAnimation) { double num11 = (double)((float)Main.toolTip.useAnimation - (float)Main.cpItem.useAnimation); num11 = num11 / (double)((float)Main.cpItem.useAnimation) * 100.0; num11 = Math.Round(num11); num11 *= -1.0; if (num11 > 0.0) { array[num4] = "+" + num11 + Lang.tip[40]; } else { array[num4] = num11 + Lang.tip[40]; } if (num11 < 0.0) { array3[num4] = true; } array2[num4] = true; num4++; } if (Main.cpItem.crit != Main.toolTip.crit) { double num12 = (double)((float)Main.toolTip.crit - (float)Main.cpItem.crit); if (num12 > 0.0) { array[num4] = "+" + num12 + Lang.tip[41]; } else { array[num4] = num12 + Lang.tip[41]; } if (num12 < 0.0) { array3[num4] = true; } array2[num4] = true; num4++; } if (Main.cpItem.mana != Main.toolTip.mana) { double num13 = (double)((float)Main.toolTip.mana - (float)Main.cpItem.mana); num13 = num13 / (double)((float)Main.cpItem.mana) * 100.0; num13 = Math.Round(num13); if (num13 > 0.0) { array[num4] = "+" + num13 + Lang.tip[42]; } else { array[num4] = num13 + Lang.tip[42]; } if (num13 > 0.0) { array3[num4] = true; } array2[num4] = true; num4++; } if (Main.cpItem.scale != Main.toolTip.scale) { double num14 = (double)(Main.toolTip.scale - Main.cpItem.scale); num14 = num14 / (double)Main.cpItem.scale * 100.0; num14 = Math.Round(num14); if (num14 > 0.0) { array[num4] = "+" + num14 + Lang.tip[43]; } else { array[num4] = num14 + Lang.tip[43]; } if (num14 < 0.0) { array3[num4] = true; } array2[num4] = true; num4++; } if (Main.cpItem.shootSpeed != Main.toolTip.shootSpeed) { double num15 = (double)(Main.toolTip.shootSpeed - Main.cpItem.shootSpeed); num15 = num15 / (double)Main.cpItem.shootSpeed * 100.0; num15 = Math.Round(num15); if (num15 > 0.0) { array[num4] = "+" + num15 + Lang.tip[44]; } else { array[num4] = num15 + Lang.tip[44]; } if (num15 < 0.0) { array3[num4] = true; } array2[num4] = true; num4++; } if (Main.cpItem.knockBack != knockBack) { double num16 = (double)(knockBack - Main.cpItem.knockBack); num16 = num16 / (double)Main.cpItem.knockBack * 100.0; num16 = Math.Round(num16); if (num16 > 0.0) { array[num4] = "+" + num16 + Lang.tip[45]; } else { array[num4] = num16 + Lang.tip[45]; } if (num16 < 0.0) { array3[num4] = true; } array2[num4] = true; num4++; } if (Main.toolTip.prefix == 62) { array[num4] = "+1" + Lang.tip[25]; array2[num4] = true; num4++; } if (Main.toolTip.prefix == 63) { array[num4] = "+2" + Lang.tip[25]; array2[num4] = true; num4++; } if (Main.toolTip.prefix == 64) { array[num4] = "+3" + Lang.tip[25]; array2[num4] = true; num4++; } if (Main.toolTip.prefix == 65) { array[num4] = "+4" + Lang.tip[25]; array2[num4] = true; num4++; } if (Main.toolTip.prefix == 66) { array[num4] = "+20 " + Lang.tip[31]; array2[num4] = true; num4++; } if (Main.toolTip.prefix == 67) { array[num4] = "+1" + Lang.tip[5]; array2[num4] = true; num4++; } if (Main.toolTip.prefix == 68) { array[num4] = "+2" + Lang.tip[5]; array2[num4] = true; num4++; } if (Main.toolTip.prefix == 69) { array[num4] = "+1" + Lang.tip[39]; array2[num4] = true; num4++; } if (Main.toolTip.prefix == 70) { array[num4] = "+2" + Lang.tip[39]; array2[num4] = true; num4++; } if (Main.toolTip.prefix == 71) { array[num4] = "+3" + Lang.tip[39]; array2[num4] = true; num4++; } if (Main.toolTip.prefix == 72) { array[num4] = "+4" + Lang.tip[39]; array2[num4] = true; num4++; } if (Main.toolTip.prefix == 73) { array[num4] = "+1" + Lang.tip[46]; array2[num4] = true; num4++; } if (Main.toolTip.prefix == 74) { array[num4] = "+2" + Lang.tip[46]; array2[num4] = true; num4++; } if (Main.toolTip.prefix == 75) { array[num4] = "+3" + Lang.tip[46]; array2[num4] = true; num4++; } if (Main.toolTip.prefix == 76) { array[num4] = "+4" + Lang.tip[46]; array2[num4] = true; num4++; } if (Main.toolTip.prefix == 77) { array[num4] = "+1" + Lang.tip[47]; array2[num4] = true; num4++; } if (Main.toolTip.prefix == 78) { array[num4] = "+2" + Lang.tip[47]; array2[num4] = true; num4++; } if (Main.toolTip.prefix == 79) { array[num4] = "+3" + Lang.tip[47]; array2[num4] = true; num4++; } if (Main.toolTip.prefix == 80) { array[num4] = "+4" + Lang.tip[47]; array2[num4] = true; num4++; } } if (Main.toolTip.wornArmor && Main.player[Main.myPlayer].setBonus != "") { array[num4] = Lang.tip[48] + " " + Main.player[Main.myPlayer].setBonus; num4++; } } if (Main.npcShop > 0) { if (Main.toolTip.value > 0) { string text2 = ""; int num17 = 0; int num18 = 0; int num19 = 0; int num20 = 0; int num21 = Main.toolTip.value * Main.toolTip.stack; if (!Main.toolTip.buy) { num21 = Main.toolTip.value / 5 * Main.toolTip.stack; } if (num21 < 1) { num21 = 1; } if (num21 >= 1000000) { num17 = num21 / 1000000; num21 -= num17 * 1000000; } if (num21 >= 10000) { num18 = num21 / 10000; num21 -= num18 * 10000; } if (num21 >= 100) { num19 = num21 / 100; num21 -= num19 * 100; } if (num21 >= 1) { num20 = num21; } if (num17 > 0) { object obj = text2; text2 = string.Concat(new object[] { obj, num17, " ", Lang.inter[15], " " }); } if (num18 > 0) { object obj = text2; text2 = string.Concat(new object[] { obj, num18, " ", Lang.inter[16], " " }); } if (num19 > 0) { object obj = text2; text2 = string.Concat(new object[] { obj, num19, " ", Lang.inter[17], " " }); } if (num20 > 0) { object obj = text2; text2 = string.Concat(new object[] { obj, num20, " ", Lang.inter[18], " " }); } if (!Main.toolTip.buy) { array[num4] = Lang.tip[49] + " " + text2; } else { array[num4] = Lang.tip[50] + " " + text2; } num4++; num22 = (float)Main.mouseTextColor / 255f; if (num17 > 0) { color = new Color((int)((byte)(220f * num22)), (int)((byte)(220f * num22)), (int)((byte)(198f * num22)), (int)Main.mouseTextColor); } else { if (num18 > 0) { color = new Color((int)((byte)(224f * num22)), (int)((byte)(201f * num22)), (int)((byte)(92f * num22)), (int)Main.mouseTextColor); } else { if (num19 > 0) { color = new Color((int)((byte)(181f * num22)), (int)((byte)(192f * num22)), (int)((byte)(193f * num22)), (int)Main.mouseTextColor); } else { if (num20 > 0) { color = new Color((int)((byte)(246f * num22)), (int)((byte)(138f * num22)), (int)((byte)(96f * num22)), (int)Main.mouseTextColor); } } } } } else { num22 = (float)Main.mouseTextColor / 255f; array[num4] = Lang.tip[51]; num4++; color = new Color((int)((byte)(120f * num22)), (int)((byte)(120f * num22)), (int)((byte)(120f * num22)), (int)Main.mouseTextColor); } } Vector2 vector = default(Vector2); int num23 = 0; for (int j = 0; j < num4; j++) { Vector2 vector2 = Main.fontMouseText.MeasureString(array[j]); if (vector2.X > vector.X) { vector.X = vector2.X; } vector.Y += vector2.Y + (float)num23; } if ((float)num + vector.X + 4f > (float)Main.screenWidth) { num = (int)((float)Main.screenWidth - vector.X - 4f); } if ((float)num2 + vector.Y + 4f > (float)Main.screenHeight) { num2 = (int)((float)Main.screenHeight - vector.Y - 4f); } int num24 = 0; num22 = (float)Main.mouseTextColor / 255f; for (int k = 0; k < num4; k++) { for (int l = 0; l < 5; l++) { int num25 = num; int num26 = num2 + num24; Color color2 = Color.Black; if (l == 0) { num25 -= 2; } else { if (l == 1) { num25 += 2; } else { if (l == 2) { num26 -= 2; } else { if (l == 3) { num26 += 2; } else { color2 = new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor); if (k == 0) { if (rare == -1) { color2 = new Color((int)((byte)(130f * num22)), (int)((byte)(130f * num22)), (int)((byte)(130f * num22)), (int)Main.mouseTextColor); } if (rare == 1) { color2 = new Color((int)((byte)(150f * num22)), (int)((byte)(150f * num22)), (int)((byte)(255f * num22)), (int)Main.mouseTextColor); } if (rare == 2) { color2 = new Color((int)((byte)(150f * num22)), (int)((byte)(255f * num22)), (int)((byte)(150f * num22)), (int)Main.mouseTextColor); } if (rare == 3) { color2 = new Color((int)((byte)(255f * num22)), (int)((byte)(200f * num22)), (int)((byte)(150f * num22)), (int)Main.mouseTextColor); } if (rare == 4) { color2 = new Color((int)((byte)(255f * num22)), (int)((byte)(150f * num22)), (int)((byte)(150f * num22)), (int)Main.mouseTextColor); } if (rare == 5) { color2 = new Color((int)((byte)(255f * num22)), (int)((byte)(150f * num22)), (int)((byte)(255f * num22)), (int)Main.mouseTextColor); } if (rare == 6) { color2 = new Color((int)((byte)(210f * num22)), (int)((byte)(160f * num22)), (int)((byte)(255f * num22)), (int)Main.mouseTextColor); } if (rare == 7) { color2 = new Color((int)((byte)(150f * num22)), (int)((byte)(255f * num22)), (int)((byte)(10f * num22)), (int)Main.mouseTextColor); } if (rare == 8) { color2 = new Color((int)((byte)(255f * num22)), (int)((byte)(255f * num22)), (int)((byte)(10f * num22)), (int)Main.mouseTextColor); } if (rare >= 9) { color2 = new Color((int)((byte)(5f * num22)), (int)((byte)(200f * num22)), (int)((byte)(255f * num22)), (int)Main.mouseTextColor); } if (diff == 1) { color2 = new Color((int)((byte)((float)Main.mcColor.R * num22)), (int)((byte)((float)Main.mcColor.G * num22)), (int)((byte)((float)Main.mcColor.B * num22)), (int)Main.mouseTextColor); } if (diff == 2) { color2 = new Color((int)((byte)((float)Main.hcColor.R * num22)), (int)((byte)((float)Main.hcColor.G * num22)), (int)((byte)((float)Main.hcColor.B * num22)), (int)Main.mouseTextColor); } } else { if (array2[k]) { if (array3[k]) { color2 = new Color((int)((byte)(190f * num22)), (int)((byte)(120f * num22)), (int)((byte)(120f * num22)), (int)Main.mouseTextColor); } else { color2 = new Color((int)((byte)(120f * num22)), (int)((byte)(190f * num22)), (int)((byte)(120f * num22)), (int)Main.mouseTextColor); } } else { if (k == num4 - 1) { color2 = color; } } } } } } } this.spriteBatch.DrawString(Main.fontMouseText, array[k], new Vector2((float)num25, (float)num26), color2, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } num24 += (int)(Main.fontMouseText.MeasureString(array[k]).Y + (float)num23); } return; } if (Main.buffString != "" && Main.buffString != null) { for (int m = 0; m < 5; m++) { int num27 = num; int num28 = num2 + (int)Main.fontMouseText.MeasureString(Main.buffString).Y; Color black = Color.Black; if (m == 0) { num27 -= 2; } else { if (m == 1) { num27 += 2; } else { if (m == 2) { num28 -= 2; } else { if (m == 3) { num28 += 2; } else { black = new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor); } } } } this.spriteBatch.DrawString(Main.fontMouseText, Main.buffString, new Vector2((float)num27, (float)num28), black, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } Vector2 vector3 = Main.fontMouseText.MeasureString(cursorText); if ((float)num + vector3.X + 4f > (float)Main.screenWidth) { num = (int)((float)Main.screenWidth - vector3.X - 4f); } if ((float)num2 + vector3.Y + 4f > (float)Main.screenHeight) { num2 = (int)((float)Main.screenHeight - vector3.Y - 4f); } this.spriteBatch.DrawString(Main.fontMouseText, cursorText, new Vector2((float)num, (float)(num2 - 2)), Color.Black, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); this.spriteBatch.DrawString(Main.fontMouseText, cursorText, new Vector2((float)num, (float)(num2 + 2)), Color.Black, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); this.spriteBatch.DrawString(Main.fontMouseText, cursorText, new Vector2((float)(num - 2), (float)num2), Color.Black, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); this.spriteBatch.DrawString(Main.fontMouseText, cursorText, new Vector2((float)(num + 2), (float)num2), Color.Black, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); num22 = (float)Main.mouseTextColor / 255f; Color color3 = new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor); if (rare == -10) { color3 = new Color((int)((byte)(65f * num22)), (int)((byte)(255f * num22)), (int)((byte)(110f * num22)), (int)Main.mouseTextColor); } if (rare == -1) { color3 = new Color((int)((byte)(130f * num22)), (int)((byte)(130f * num22)), (int)((byte)(130f * num22)), (int)Main.mouseTextColor); } if (rare == 1) { color3 = new Color((int)((byte)(150f * num22)), (int)((byte)(150f * num22)), (int)((byte)(255f * num22)), (int)Main.mouseTextColor); } if (rare == 2) { color3 = new Color((int)((byte)(150f * num22)), (int)((byte)(255f * num22)), (int)((byte)(150f * num22)), (int)Main.mouseTextColor); } if (rare == 3) { color3 = new Color((int)((byte)(255f * num22)), (int)((byte)(200f * num22)), (int)((byte)(150f * num22)), (int)Main.mouseTextColor); } if (rare == 4) { color3 = new Color((int)((byte)(255f * num22)), (int)((byte)(150f * num22)), (int)((byte)(150f * num22)), (int)Main.mouseTextColor); } if (rare == 5) { color3 = new Color((int)((byte)(255f * num22)), (int)((byte)(150f * num22)), (int)((byte)(255f * num22)), (int)Main.mouseTextColor); } if (rare == 6) { color3 = new Color((int)((byte)(210f * num22)), (int)((byte)(160f * num22)), (int)((byte)(255f * num22)), (int)Main.mouseTextColor); } if (rare == 7) { color3 = new Color((int)((byte)(150f * num22)), (int)((byte)(255f * num22)), (int)((byte)(10f * num22)), (int)Main.mouseTextColor); } if (rare == 8) { color3 = new Color((int)((byte)(255f * num22)), (int)((byte)(255f * num22)), (int)((byte)(10f * num22)), (int)Main.mouseTextColor); } if (rare >= 9) { color3 = new Color((int)((byte)(5f * num22)), (int)((byte)(200f * num22)), (int)((byte)(255f * num22)), (int)Main.mouseTextColor); } if (diff == 1) { color3 = new Color((int)((byte)((float)Main.mcColor.R * num22)), (int)((byte)((float)Main.mcColor.G * num22)), (int)((byte)((float)Main.mcColor.B * num22)), (int)Main.mouseTextColor); } if (diff == 2) { color3 = new Color((int)((byte)((float)Main.hcColor.R * num22)), (int)((byte)((float)Main.hcColor.G * num22)), (int)((byte)((float)Main.hcColor.B * num22)), (int)Main.mouseTextColor); } this.spriteBatch.DrawString(Main.fontMouseText, cursorText, new Vector2((float)num, (float)num2), color3, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } protected void DrawFPS() { if (Main.showFrameRate) { string text = string.Concat(Main.frameRate); object obj = text; text = string.Concat(new object[] { obj, " (", Liquid.numLiquid + LiquidBuffer.numLiquidBuffer, ")" }); object obj2 = text; text = string.Concat(new object[] { obj2, " (", (int)(Main.gfxQuality * 100f), "%)" }); int num = 4; if (!Main.gameMenu) { num = Main.screenHeight - 24; } this.spriteBatch.DrawString(Main.fontMouseText, text + " " + Main.debugWords, new Vector2(4f, (float)num), new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } public static Color shine(Color newColor, int type) { int num = (int)newColor.R; int num2 = (int)newColor.G; int num3 = (int)newColor.B; float num4 = 0.6f; if (type == 25) { num = (int)((float)newColor.R * 0.95f); num2 = (int)((float)newColor.G * 0.85f); num3 = (int)((double)((float)newColor.B) * 1.1); } else { if (type == 117) { num = (int)((float)newColor.R * 1.1f); num2 = (int)((float)newColor.G * 1f); num3 = (int)((double)((float)newColor.B) * 1.2); } else { if (type == 204) { num4 = 0.3f + (float)Main.mouseTextColor / 300f; num = (int)((float)newColor.R * (1.3f * num4)); if (num > 255) { num = 255; } return new Color(num, num2, num3, 255); } if (type == 211) { num4 = 0.3f + (float)Main.mouseTextColor / 300f; num2 = (int)((float)newColor.G * (1.5f * num4)); num3 = (int)((float)newColor.B * (1.1f * num4)); } else { if (type == 147 || type == 161) { num = (int)((float)newColor.R * 1.1f); num2 = (int)((float)newColor.G * 1.12f); num3 = (int)((double)((float)newColor.B) * 1.15); } else { if (type == 163) { num = (int)((float)newColor.R * 1.05f); num2 = (int)((float)newColor.G * 1.1f); num3 = (int)((double)((float)newColor.B) * 1.15); } else { if (type == 164) { num = (int)((float)newColor.R * 1.1f); num2 = (int)((float)newColor.G * 1.1f); num3 = (int)((double)((float)newColor.B) * 1.2); } else { if (type == 178) { num4 = 0.5f; num = (int)((float)newColor.R * (1f + num4)); num2 = (int)((float)newColor.G * (1f + num4)); num3 = (int)((float)newColor.B * (1f + num4)); } else { if (type == 185 || type == 186) { num4 = 0.3f; num = (int)((float)newColor.R * (1f + num4)); num2 = (int)((float)newColor.G * (1f + num4)); num3 = (int)((float)newColor.B * (1f + num4)); } else { num = (int)((float)newColor.R * (1f + num4)); num2 = (int)((float)newColor.G * (1f + num4)); num3 = (int)((float)newColor.B * (1f + num4)); } } } } } } } } if (num > 255) { num = 255; } if (num2 > 255) { num2 = 255; } if (num3 > 255) { num3 = 255; } newColor.R = (byte)num; newColor.G = (byte)num2; newColor.B = (byte)num3; return new Color((int)((byte)num), (int)((byte)num2), (int)((byte)num3), (int)newColor.A); } public static bool canDrawColorTile(int i, int j) { return Main.tile[i, j] != null && Main.tile[i, j].color() > 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 canDrawColorWall(int i, int j) { return Main.tile[i, j] != null && Main.tile[i, j].wallColor() > 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) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); int num = (int)(255f * (1f - Main.gfxQuality) + 30f * Main.gfxQuality); int num2 = (int)(50f * (1f - Main.gfxQuality) + 2f * Main.gfxQuality); Vector2 value = new Vector2((float)Main.offScreenRange, (float)Main.offScreenRange); if (Main.drawToScreen) { value = default(Vector2); } int num3 = 0; int[] array = new int[1000]; int[] array2 = new int[1000]; int num4 = (int)((Main.screenPosition.X - value.X) / 16f - 1f); int num5 = (int)((Main.screenPosition.X + (float)Main.screenWidth + value.X) / 16f) + 2; int num6 = (int)((Main.screenPosition.Y - value.Y) / 16f - 1f); int num7 = (int)((Main.screenPosition.Y + (float)Main.screenHeight + value.Y) / 16f) + 5; if (num4 < 0) { num4 = 0; } if (num5 > Main.maxTilesX) { num5 = Main.maxTilesX; } if (num6 < 0) { num6 = 0; } if (num7 > Main.maxTilesY) { num7 = Main.maxTilesY; } int num8 = 16; for (int i = num6; i < num7 + 4; i++) { for (int j = num4 - 2; j < num5 + 2; j++) { if (Main.tile[j, i] == null) { Main.tile[j, i] = new Tile(); Main.mapTime += 60; } bool flag = Main.tileSolid[(int)Main.tile[j, i].type]; if (Main.tile[j, i].type == 11) { flag = true; } if (Main.tile[j, i].active() && flag == solidOnly) { this.LoadTiles((int)Main.tile[j, i].type); SpriteEffects effects = SpriteEffects.None; if (Main.tile[j, i].type == 3 || Main.tile[j, i].type == 13 || Main.tile[j, i].type == 20 || Main.tile[j, i].type == 24 || Main.tile[j, i].type == 49 || Main.tile[j, i].type == 50 || Main.tile[j, i].type == 52 || Main.tile[j, i].type == 61 || Main.tile[j, i].type == 62 || Main.tile[j, i].type == 71 || Main.tile[j, i].type == 73 || Main.tile[j, i].type == 74 || Main.tile[j, i].type == 81 || Main.tile[j, i].type == 82 || Main.tile[j, i].type == 83 || Main.tile[j, i].type == 84 || Main.tile[j, i].type == 91 || Main.tile[j, i].type == 92 || Main.tile[j, i].type == 93 || Main.tile[j, i].type == 110 || Main.tile[j, i].type == 113 || Main.tile[j, i].type == 115 || Main.tile[j, i].type == 135 || Main.tile[j, i].type == 141 || Main.tile[j, i].type == 165 || Main.tile[j, i].type == 174 || Main.tile[j, i].type == 201 || Main.tile[j, i].type == 205 || Main.tile[j, i].type == 227) { if (j % 2 == 1) { effects = SpriteEffects.FlipHorizontally; } } else { if (Main.tile[j, i].type == 184) { if (Main.tile[j, i].frameY < 108) { if (j % 2 == 1) { effects = SpriteEffects.FlipHorizontally; } } else { if (i % 2 == 1) { effects = SpriteEffects.FlipVertically; } } } else { if (Main.tile[j, i].type == 185 && Main.tile[j, i].frameY == 0 && j % 2 == 1) { effects = SpriteEffects.FlipHorizontally; } } } Color color = Lighting.GetColor(j, i); int num9 = 0; if (Main.tile[j, i].type == 4 && WorldGen.SolidTile(j, i - 1)) { num9 = 2; if (WorldGen.SolidTile(j - 1, i + 1) || WorldGen.SolidTile(j + 1, i + 1)) { num9 = 4; } } if (Main.tile[j, i].type == 78 || Main.tile[j, i].type == 85 || Main.tile[j, i].type == 210 || Main.tile[j, i].type == 133 || Main.tile[j, i].type == 134 || Main.tile[j, i].type == 233) { num9 = 2; } if (Main.tile[j, i].type == 33 || Main.tile[j, i].type == 49 || Main.tile[j, i].type == 174) { num9 = -4; } int num10; if (Main.tile[j, i].type == 3 || Main.tile[j, i].type == 4 || Main.tile[j, i].type == 5 || Main.tile[j, i].type == 24 || Main.tile[j, i].type == 33 || Main.tile[j, i].type == 49 || Main.tile[j, i].type == 61 || Main.tile[j, i].type == 71 || Main.tile[j, i].type == 110 || Main.tile[j, i].type == 174 || Main.tile[j, i].type == 201) { num10 = 20; } else { if (Main.tile[j, i].type == 15 || Main.tile[j, i].type == 14 || Main.tile[j, i].type == 16 || Main.tile[j, i].type == 17 || Main.tile[j, i].type == 18 || Main.tile[j, i].type == 20 || Main.tile[j, i].type == 21 || Main.tile[j, i].type == 26 || Main.tile[j, i].type == 27 || Main.tile[j, i].type == 32 || Main.tile[j, i].type == 69 || Main.tile[j, i].type == 72 || Main.tile[j, i].type == 77 || Main.tile[j, i].type == 80) { num10 = 18; } else { if (Main.tile[j, i].type == 137) { num10 = 18; } else { if (Main.tile[j, i].type == 135) { num9 = 2; num10 = 18; } else { if (Main.tile[j, i].type == 132) { num9 = 2; num10 = 18; } else { num10 = 16; } } } } } if (Main.tile[j, i].type == 52) { num9 -= 2; } if (Main.tile[j, i].type == 231 || Main.tile[j, i].type == 238) { num9 += 2; } if (Main.tile[j, i].type == 207) { num9 = 2; } if (Main.tile[j, i].type == 4 || Main.tile[j, i].type == 5) { num8 = 20; } else { num8 = 16; } if (Main.tile[j, i].type == 73 || Main.tile[j, i].type == 74 || Main.tile[j, i].type == 113) { num9 -= 12; num10 = 32; } if (Main.tile[j, i].type == 227) { num8 = 32; num10 = 38; if (Main.tile[j, i].frameX == 238) { num9 -= 6; } else { num9 -= 20; } } if (Main.tile[j, i].type == 185 || Main.tile[j, i].type == 186 || Main.tile[j, i].type == 187) { num9 = 2; if (Main.tile[j, i].type == 185) { if (Main.tile[j, i].frameY == 18 && Main.tile[j, i].frameX >= 576 && Main.tile[j, i].frameX <= 882) { Main.tileShine2[185] = true; } else { Main.tileShine2[185] = false; } } else { if (Main.tile[j, i].type == 186) { if (Main.tile[j, i].frameX >= 864 && Main.tile[j, i].frameX <= 1170) { Main.tileShine2[186] = true; } else { Main.tileShine2[186] = false; } } } } if (Main.tile[j, i].type == 178 && Main.tile[j, i].frameY <= 36) { num9 = 2; } if (Main.tile[j, i].type == 184) { num8 = 20; if (Main.tile[j, i].frameY <= 36) { num9 = 2; } else { if (Main.tile[j, i].frameY <= 108) { num9 = -2; } } } if (Main.tile[j, i].type == 28) { num9 += 2; } if (Main.tile[j, i].type == 81) { num9 -= 8; num10 = 26; num8 = 24; } if (Main.tile[j, i].type == 105) { num9 = 2; } if (Main.tile[j, i].type == 124) { num10 = 18; } if (Main.tile[j, i].type == 137) { num10 = 18; } if (Main.tile[j, i].type == 138) { num10 = 18; } if (Main.tile[j, i].type == 139 || Main.tile[j, i].type == 142 || Main.tile[j, i].type == 143) { num9 = 2; } int num11 = 0; if (Main.tile[j, i].halfBrick()) { num11 = 8; } int num12 = Main.tileFrame[(int)Main.tile[j, i].type] * 38; if (Main.tile[j, i].type == 12) { num12 = Main.tileFrame[(int)Main.tile[j, i].type] * 36; } if (Main.tile[j, i].type == 238) { num12 = Main.tileFrame[(int)Main.tile[j, i].type] * 36; } if (Main.tile[j, i].type == 31) { num12 = Main.tileFrame[(int)Main.tile[j, i].type] * 36; } if (Main.tile[j, i].type == 215) { num12 = Main.tileFrame[(int)Main.tile[j, i].type] * 36; num9 = 2; } if (Main.tile[j, i].type == 231) { num12 = Main.tileFrame[(int)Main.tile[j, i].type] * 54; num9 = 2; } if (Main.tile[j, i].type == 243) { num12 = Main.tileFrame[(int)Main.tile[j, i].type] * 54; num9 = 2; } if (Main.tile[j, i].type == 247) { num12 = Main.tileFrame[(int)Main.tile[j, i].type] * 54; num9 = 2; } if (Main.tile[j, i].type == 244) { num9 = 2; if (Main.tile[j, i].frameX < 54) { num12 = Main.tileFrame[(int)Main.tile[j, i].type] * 36; } else { num12 = 0; } } if (Main.tile[j, i].type == 235) { num12 = Main.tileFrame[(int)Main.tile[j, i].type] * 18; } if (Main.tile[j, i].type == 217 || Main.tile[j, i].type == 218) { num12 = Main.tileFrame[(int)Main.tile[j, i].type] * 36; num9 = 2; } if (Main.tile[j, i].type == 219 || Main.tile[j, i].type == 220) { num12 = Main.tileFrame[(int)Main.tile[j, i].type] * 54; num9 = 2; } if (Main.tile[j, i].type == 207) { if (Main.tile[j, i].frameY >= 72) { num12 = Main.tileFrame[(int)Main.tile[j, i].type]; int num13 = j; if (Main.tile[j, i].frameX % 36 != 0) { num13--; } num12 += num13 % 6; if (num12 >= 6) { num12 -= 6; } num12 *= 72; } else { num12 = 0; } } if (Main.player[Main.myPlayer].findTreasure) { bool flag2 = false; if (Main.tile[j, i].type == 185 && Main.tile[j, i].frameY == 18 && Main.tile[j, i].frameX >= 576 && Main.tile[j, i].frameX <= 882) { flag2 = true; } if (Main.tile[j, i].type == 186 && Main.tile[j, i].frameX >= 864 && Main.tile[j, i].frameX <= 1170) { flag2 = true; } if (flag2 || Main.tile[j, i].type == 6 || Main.tile[j, i].type == 7 || Main.tile[j, i].type == 8 || Main.tile[j, i].type == 9 || Main.tile[j, i].type == 12 || Main.tile[j, i].type == 21 || Main.tile[j, i].type == 22 || Main.tile[j, i].type == 28 || Main.tile[j, i].type == 107 || Main.tile[j, i].type == 108 || Main.tile[j, i].type == 111 || (Main.tile[j, i].type >= 63 && Main.tile[j, i].type <= 68) || Main.tileAlch[(int)Main.tile[j, i].type] || Main.tile[j, i].type == 166 || Main.tile[j, i].type == 167 || Main.tile[j, i].type == 168 || Main.tile[j, i].type == 169 || Main.tile[j, i].type == 178 || Main.tile[j, i].type == 211 || Main.tile[j, i].type == 221 || Main.tile[j, i].type == 222 || Main.tile[j, i].type == 223 || Main.tile[j, i].type == 236) { if (color.R < Main.mouseTextColor / 2) { color.R = (byte)(Main.mouseTextColor / 2); } if (color.G < 70) { color.G = 70; } if (color.B < 210) { color.B = 210; } color.A = Main.mouseTextColor; if (!Main.gamePaused && base.IsActive && Main.rand.Next(150) == 0) { int num14 = Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16)), 16, 16, 15, 0f, 0f, 150, default(Color), 0.8f); Main.dust[num14].velocity *= 0.1f; Main.dust[num14].noLight = true; } } } if (!Main.gamePaused && base.IsActive && (Lighting.lightMode < 2 || Main.rand.Next(4) == 0)) { if (Main.tile[j, i].type == 238 && Main.rand.Next(10) == 0) { int num15 = Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16)), 16, 16, 168, 0f, 0f, 0, default(Color), 1f); Main.dust[num15].noGravity = true; Main.dust[num15].alpha = 200; } if (Main.tile[j, i].type == 244 && Main.tile[j, i].frameX == 18 && Main.tile[j, i].frameY == 18 && Main.rand.Next(2) == 0) { if (Main.rand.Next(500) == 0) { Gore.NewGore(new Vector2((float)(j * 16 + 8), (float)(i * 16 + 8)), default(Vector2), 415, (float)Main.rand.Next(51, 101) * 0.01f); } else { if (Main.rand.Next(250) == 0) { Gore.NewGore(new Vector2((float)(j * 16 + 8), (float)(i * 16 + 8)), default(Vector2), 414, (float)Main.rand.Next(51, 101) * 0.01f); } else { if (Main.rand.Next(80) == 0) { Gore.NewGore(new Vector2((float)(j * 16 + 8), (float)(i * 16 + 8)), default(Vector2), 413, (float)Main.rand.Next(51, 101) * 0.01f); } else { if (Main.rand.Next(10) == 0) { Gore.NewGore(new Vector2((float)(j * 16 + 8), (float)(i * 16 + 8)), default(Vector2), 412, (float)Main.rand.Next(51, 101) * 0.01f); } else { if (Main.rand.Next(3) == 0) { Gore.NewGore(new Vector2((float)(j * 16 + 8), (float)(i * 16 + 8)), default(Vector2), 411, (float)Main.rand.Next(51, 101) * 0.01f); } } } } } } if (Main.tile[j, i].type == 165 && Main.tile[j, i].frameX >= 162 && Main.tile[j, i].frameX <= 214 && Main.tile[j, i].frameY == 72 && Main.rand.Next(60) == 0) { int num16 = Dust.NewDust(new Vector2((float)(j * 16 + 2), (float)(i * 16 + 6)), 8, 4, 153, 0f, 0f, 0, default(Color), 1f); Main.dust[num16].scale -= (float)Main.rand.Next(3) * 0.1f; Main.dust[num16].velocity.Y = 0f; Dust expr_192E_cp_0 = Main.dust[num16]; expr_192E_cp_0.velocity.X = expr_192E_cp_0.velocity.X * 0.05f; Main.dust[num16].alpha = 100; } if (Main.tile[j, i].type == 42 && Main.tile[j, i].frameX == 0 && Main.tile[j, i].frameY == 270) { if (Main.rand.Next(50) == 0) { int num17 = Dust.NewDust(new Vector2((float)(j * 16 + 4), (float)(i * 16 + 4)), 8, 8, 58, 0f, 0f, 150, default(Color), 1f); Main.dust[num17].velocity *= 0.5f; } if (Main.rand.Next(100) == 0) { int num18 = Gore.NewGore(new Vector2((float)(j * 16 - 2), (float)(i * 16 - 4)), default(Vector2), Main.rand.Next(16, 18), 1f); Main.gore[num18].scale *= 0.7f; Main.gore[num18].velocity *= 0.25f; } } if (Main.tile[j, i].type == 215 && Main.rand.Next(2) == 0 && ((Main.drawToScreen && Main.rand.Next(4) == 0) || !Main.drawToScreen) && Main.tile[j, i].frameY == 0) { int num19 = Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16 - 4)), 8, 8, 31, 0f, 0f, 100, default(Color), 1f); if (Main.tile[j, i].frameX == 0) { Dust expr_1B41_cp_0 = Main.dust[num19]; expr_1B41_cp_0.position.X = expr_1B41_cp_0.position.X + (float)Main.rand.Next(8); } if (Main.tile[j, i].frameX == 36) { Dust expr_1B7D_cp_0 = Main.dust[num19]; expr_1B7D_cp_0.position.X = expr_1B7D_cp_0.position.X - (float)Main.rand.Next(8); } Main.dust[num19].alpha += Main.rand.Next(100); Main.dust[num19].velocity *= 0.2f; Dust expr_1BDF_cp_0 = Main.dust[num19]; expr_1BDF_cp_0.velocity.Y = expr_1BDF_cp_0.velocity.Y - (0.5f + (float)Main.rand.Next(10) * 0.1f); Main.dust[num19].fadeIn = 0.5f + (float)Main.rand.Next(10) * 0.1f; if (Main.rand.Next(4) == 0) { num19 = Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16)), 8, 8, 6, 0f, 0f, 0, default(Color), 1f); if (Main.tile[j, i].frameX == 0) { Dust expr_1C91_cp_0 = Main.dust[num19]; expr_1C91_cp_0.position.X = expr_1C91_cp_0.position.X + (float)Main.rand.Next(8); } if (Main.tile[j, i].frameX == 36) { Dust expr_1CCD_cp_0 = Main.dust[num19]; expr_1CCD_cp_0.position.X = expr_1CCD_cp_0.position.X - (float)Main.rand.Next(8); } if (Main.rand.Next(20) != 0) { Main.dust[num19].noGravity = true; Main.dust[num19].scale *= 1f + (float)Main.rand.Next(10) * 0.1f; Dust expr_1D3B_cp_0 = Main.dust[num19]; expr_1D3B_cp_0.velocity.Y = expr_1D3B_cp_0.velocity.Y - 1f; } } } if (Main.tile[j, i].type == 4 && Main.rand.Next(40) == 0 && Main.tile[j, i].frameX < 66) { int num20 = (int)(Main.tile[j, i].frameY / 22); if (num20 == 0) { num20 = 6; } else { if (num20 == 8) { num20 = 75; } else { if (num20 == 9) { num20 = 135; } else { if (num20 == 10) { num20 = 158; } else { if (num20 == 11) { num20 = 169; } else { num20 = 58 + num20; } } } } } int num21; if (Main.tile[j, i].frameX == 22) { num21 = Dust.NewDust(new Vector2((float)(j * 16 + 6), (float)(i * 16)), 4, 4, num20, 0f, 0f, 100, default(Color), 1f); } if (Main.tile[j, i].frameX == 44) { num21 = Dust.NewDust(new Vector2((float)(j * 16 + 2), (float)(i * 16)), 4, 4, num20, 0f, 0f, 100, default(Color), 1f); } else { num21 = Dust.NewDust(new Vector2((float)(j * 16 + 4), (float)(i * 16)), 4, 4, num20, 0f, 0f, 100, default(Color), 1f); } if (Main.rand.Next(3) != 0) { Main.dust[num21].noGravity = true; } Main.dust[num21].velocity *= 0.3f; Dust expr_1F13_cp_0 = Main.dust[num21]; expr_1F13_cp_0.velocity.Y = expr_1F13_cp_0.velocity.Y - 1.5f; } if (Main.tile[j, i].type == 93 && Main.rand.Next(40) == 0 && Main.tile[j, i].frameX == 0 && Main.tile[j, i].frameY == 0) { int num22 = Dust.NewDust(new Vector2((float)(j * 16 + 4), (float)(i * 16 + 2)), 4, 4, 6, 0f, 0f, 100, default(Color), 1f); if (Main.rand.Next(3) != 0) { Main.dust[num22].noGravity = true; } Main.dust[num22].velocity *= 0.3f; Dust expr_1FFE_cp_0 = Main.dust[num22]; expr_1FFE_cp_0.velocity.Y = expr_1FFE_cp_0.velocity.Y - 1.5f; } if (Main.tile[j, i].type == 100 && Main.rand.Next(40) == 0 && Main.tile[j, i].frameX < 36 && Main.tile[j, i].frameY == 0) { int num23; if (Main.tile[j, i].frameX == 0) { if (Main.rand.Next(3) == 0) { num23 = Dust.NewDust(new Vector2((float)(j * 16 + 4), (float)(i * 16 + 2)), 4, 4, 6, 0f, 0f, 100, default(Color), 1f); } else { num23 = Dust.NewDust(new Vector2((float)(j * 16 + 14), (float)(i * 16 + 2)), 4, 4, 6, 0f, 0f, 100, default(Color), 1f); } } else { if (Main.rand.Next(3) == 0) { num23 = Dust.NewDust(new Vector2((float)(j * 16 + 6), (float)(i * 16 + 2)), 4, 4, 6, 0f, 0f, 100, default(Color), 1f); } else { num23 = Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16 + 2)), 4, 4, 6, 0f, 0f, 100, default(Color), 1f); } } if (Main.rand.Next(3) != 0) { Main.dust[num23].noGravity = true; } Main.dust[num23].velocity *= 0.3f; Dust expr_21D9_cp_0 = Main.dust[num23]; expr_21D9_cp_0.velocity.Y = expr_21D9_cp_0.velocity.Y - 1.5f; } if (Main.tile[j, i].type == 98 && Main.rand.Next(40) == 0 && Main.tile[j, i].frameY == 0 && Main.tile[j, i].frameX == 0) { int num24 = Dust.NewDust(new Vector2((float)(j * 16 + 12), (float)(i * 16 + 2)), 4, 4, 6, 0f, 0f, 100, default(Color), 1f); if (Main.rand.Next(3) != 0) { Main.dust[num24].noGravity = true; } Main.dust[num24].velocity *= 0.3f; Dust expr_22C5_cp_0 = Main.dust[num24]; expr_22C5_cp_0.velocity.Y = expr_22C5_cp_0.velocity.Y - 1.5f; } if (Main.tile[j, i].type == 49 && Main.rand.Next(2) == 0) { int num25 = Dust.NewDust(new Vector2((float)(j * 16 + 4), (float)(i * 16 - 4)), 4, 4, 172, 0f, 0f, 100, default(Color), 1f); if (Main.rand.Next(3) == 0) { Main.dust[num25].scale = 0.5f; } else { Main.dust[num25].scale = 0.9f; Main.dust[num25].noGravity = true; } Main.dust[num25].velocity *= 0.3f; Dust expr_23A9_cp_0 = Main.dust[num25]; expr_23A9_cp_0.velocity.Y = expr_23A9_cp_0.velocity.Y - 1.5f; } if ((Main.tile[j, i].type == 34 || Main.tile[j, i].type == 35 || Main.tile[j, i].type == 36) && Main.rand.Next(40) == 0 && Main.tile[j, i].frameX < 54 && Main.tile[j, i].frameY == 18 && (Main.tile[j, i].frameX == 0 || Main.tile[j, i].frameX == 36)) { int num26 = Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16 + 2)), 14, 6, 6, 0f, 0f, 100, default(Color), 1f); if (Main.rand.Next(3) != 0) { Main.dust[num26].noGravity = true; } Main.dust[num26].velocity *= 0.3f; Dust expr_24F4_cp_0 = Main.dust[num26]; expr_24F4_cp_0.velocity.Y = expr_24F4_cp_0.velocity.Y - 1.5f; } if (Main.tile[j, i].type == 22 && Main.rand.Next(400) == 0) { Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16)), 16, 16, 14, 0f, 0f, 0, default(Color), 1f); } else { if ((Main.tile[j, i].type == 23 || Main.tile[j, i].type == 24 || Main.tile[j, i].type == 32) && Main.rand.Next(500) == 0) { Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16)), 16, 16, 14, 0f, 0f, 0, default(Color), 1f); } else { if (Main.tile[j, i].type == 25 && Main.rand.Next(700) == 0) { Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16)), 16, 16, 14, 0f, 0f, 0, default(Color), 1f); } else { if (Main.tile[j, i].type == 112 && Main.rand.Next(700) == 0) { Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16)), 16, 16, 14, 0f, 0f, 0, default(Color), 1f); } else { if (Main.tile[j, i].type == 31 && Main.rand.Next(20) == 0) { if (Main.tile[j, i].frameX >= 36) { int num27 = Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16)), 16, 16, 5, 0f, 0f, 100, default(Color), 1f); Main.dust[num27].velocity.Y = 0f; Dust expr_2761_cp_0 = Main.dust[num27]; expr_2761_cp_0.velocity.X = expr_2761_cp_0.velocity.X * 0.3f; } else { Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16)), 16, 16, 14, 0f, 0f, 100, default(Color), 1f); } } else { if (Main.tile[j, i].type == 26 && Main.rand.Next(20) == 0) { if (Main.tile[j, i].frameX >= 54) { int num28 = Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16)), 16, 16, 5, 0f, 0f, 100, default(Color), 1f); Main.dust[num28].scale = 1.5f; Main.dust[num28].noGravity = true; Main.dust[num28].velocity *= 0.75f; } else { Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16)), 16, 16, 14, 0f, 0f, 100, default(Color), 1f); } } else { if ((Main.tile[j, i].type == 71 || Main.tile[j, i].type == 72) && Main.rand.Next(500) == 0) { Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16)), 16, 16, 41, 0f, 0f, 250, default(Color), 0.8f); } else { if ((Main.tile[j, i].type == 17 || Main.tile[j, i].type == 77 || Main.tile[j, i].type == 133) && Main.rand.Next(40) == 0) { if (Main.tile[j, i].frameX == 18 & Main.tile[j, i].frameY == 18) { int num29 = Dust.NewDust(new Vector2((float)(j * 16 - 4), (float)(i * 16 - 6)), 8, 6, 6, 0f, 0f, 100, default(Color), 1f); if (Main.rand.Next(3) != 0) { Main.dust[num29].noGravity = true; } } } else { if (Main.tile[j, i].type == 37 && Main.rand.Next(250) == 0) { int num30 = Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16)), 16, 16, 6, 0f, 0f, 0, default(Color), (float)Main.rand.Next(3)); if (Main.dust[num30].scale > 1f) { Main.dust[num30].noGravity = true; } } else { if ((Main.tile[j, i].type == 58 || Main.tile[j, i].type == 76) && Main.rand.Next(250) == 0) { int num31 = Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16)), 16, 16, 6, 0f, 0f, 0, default(Color), (float)Main.rand.Next(3)); if (Main.dust[num31].scale > 1f) { Main.dust[num31].noGravity = true; } Main.dust[num31].noLight = true; } else { if (Main.tile[j, i].type == 61) { if (Main.tile[j, i].frameX == 144) { if (Main.rand.Next(60) == 0) { int num32 = Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16)), 16, 16, 44, 0f, 0f, 250, default(Color), 0.4f); Main.dust[num32].fadeIn = 0.7f; } color.A = (byte)(245f - (float)Main.mouseTextColor * 1.5f); color.R = (byte)(245f - (float)Main.mouseTextColor * 1.5f); color.B = (byte)(245f - (float)Main.mouseTextColor * 1.5f); color.G = (byte)(245f - (float)Main.mouseTextColor * 1.5f); } } else { if (Main.tileShine[(int)Main.tile[j, i].type] > 0) { Main.tileShine[211] = 500; if (color.R > 20 || color.B > 20 || color.G > 20) { int num33 = (int)color.R; if ((int)color.G > num33) { num33 = (int)color.G; } if ((int)color.B > num33) { num33 = (int)color.B; } num33 /= 30; if (Main.rand.Next(Main.tileShine[(int)Main.tile[j, i].type]) < num33 && (Main.tile[j, i].type != 21 || (Main.tile[j, i].frameX >= 36 && Main.tile[j, i].frameX < 180) || Main.tile[j, i].frameX >= 360)) { Color white = Color.White; if (Main.tile[j, i].type == 178) { int num34 = (int)(Main.tile[j, i].frameX / 18); if (num34 == 0) { white = new Color(255, 0, 255, 255); } else { if (num34 == 1) { white = new Color(255, 255, 0, 255); } else { if (num34 == 2) { white = new Color(0, 0, 255, 255); } else { if (num34 == 3) { white = new Color(0, 255, 0, 255); } else { if (num34 == 4) { white = new Color(255, 0, 0, 255); } else { if (num34 == 5) { white = new Color(255, 255, 255, 255); } else { if (num34 == 6) { white = new Color(255, 255, 0, 255); } } } } } } } int num35 = Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16)), 16, 16, 43, 0f, 0f, 254, white, 0.5f); Main.dust[num35].velocity *= 0f; } else { if (Main.tile[j, i].type == 63) { white = new Color(0, 0, 255, 255); } if (Main.tile[j, i].type == 64) { white = new Color(255, 0, 0, 255); } if (Main.tile[j, i].type == 65) { white = new Color(0, 255, 0, 255); } if (Main.tile[j, i].type == 66) { white = new Color(255, 255, 0, 255); } if (Main.tile[j, i].type == 67) { white = new Color(255, 0, 255, 255); } if (Main.tile[j, i].type == 68) { white = new Color(255, 255, 255, 255); } if (Main.tile[j, i].type == 12) { white = new Color(255, 0, 0, 255); } if (Main.tile[j, i].type == 204) { white = new Color(255, 0, 0, 255); } if (Main.tile[j, i].type == 211) { white = new Color(50, 255, 100, 255); } int num36 = Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16)), 16, 16, 43, 0f, 0f, 254, white, 0.5f); Main.dust[num36].velocity *= 0f; } } } } } } } } } } } } } } } } if (Main.tile[j, i].type == 128 && Main.tile[j, i].frameX >= 100) { array[num3] = j; array2[num3] = i; num3++; } if (Main.tile[j, i].type == 5 && Main.tile[j, i].frameY >= 198 && Main.tile[j, i].frameX >= 22) { array[num3] = j; array2[num3] = i; num3++; } if (Main.tile[j, i].type == 237 && Main.tile[j, i].frameX == 18 && Main.tile[j, i].frameY == 0) { array[num3] = j; array2[num3] = i; num3++; } if (Main.tile[j, i].type == 72 && Main.tile[j, i].frameX >= 36) { int num37 = 0; if (Main.tile[j, i].frameY == 18) { num37 = 1; } else { if (Main.tile[j, i].frameY == 36) { num37 = 2; } } this.spriteBatch.Draw(Main.shroomCapTexture, new Vector2((float)(j * 16 - (int)Main.screenPosition.X - 22), (float)(i * 16 - (int)Main.screenPosition.Y - 26)) + value, new Rectangle?(new Rectangle(num37 * 62, 0, 60, 42)), Lighting.GetColor(j, i), 0f, default(Vector2), 1f, effects, 0f); } if (color.R > 1 || color.G > 1 || color.B > 1) { if (Main.tile[j - 1, i] == null) { Main.tile[j - 1, i] = new Tile(); } if (Main.tile[j + 1, i] == null) { Main.tile[j + 1, i] = new Tile(); } if (Main.tile[j, i - 1] == null) { Main.tile[j, i - 1] = new Tile(); } if (Main.tile[j, i + 1] == null) { Main.tile[j, i + 1] = new Tile(); } if (solidOnly && flag && !Main.tile[j, i].inActive() && !Main.tileSolidTop[(int)Main.tile[j, i].type] && (Main.tile[j - 1, i].liquid > 0 || Main.tile[j + 1, i].liquid > 0 || Main.tile[j, i - 1].liquid > 0 || Main.tile[j, i + 1].liquid > 0)) { bool flag3 = false; if (Main.tile[j, i].halfBrick()) { int num38 = 160; if ((int)Main.tile[j - 1, i].liquid > num38 || (int)Main.tile[j + 1, i].liquid > num38) { for (int k = 0; k < Main.wfTileNum; k++) { if (Main.wfTileX[k] == j && Main.wfTileY[k] == i) { flag3 = true; } } } } if (!flag3) { Color color2 = Lighting.GetColor(j, i); int num39 = 0; bool flag4 = false; bool flag5 = false; bool flag6 = false; bool flag7 = false; int num40 = 0; bool flag8 = false; if ((int)Main.tile[j - 1, i].liquid > num39) { num39 = (int)Main.tile[j - 1, i].liquid; flag4 = true; } else { if (Main.tile[j - 1, i].liquid > 0) { flag4 = true; } } if ((int)Main.tile[j + 1, i].liquid > num39) { num39 = (int)Main.tile[j + 1, i].liquid; flag5 = true; } else { if (Main.tile[j + 1, i].liquid > 0) { num39 = (int)Main.tile[j + 1, i].liquid; flag5 = true; } } if (Main.tile[j, i - 1].liquid > 0) { flag6 = true; } if (Main.tile[j, i + 1].liquid > 240) { flag7 = true; } if (Main.tile[j - 1, i].liquid > 0) { if (Main.tile[j - 1, i].lava()) { num40 = 1; } else { if (Main.tile[j - 1, i].honey()) { num40 = 11; } else { flag8 = true; } } } if (Main.tile[j + 1, i].liquid > 0) { if (Main.tile[j + 1, i].lava()) { num40 = 1; } else { if (Main.tile[j + 1, i].honey()) { num40 = 11; } else { flag8 = true; } } } if (Main.tile[j, i - 1].liquid > 0) { if (Main.tile[j, i - 1].lava()) { num40 = 1; } else { if (Main.tile[j, i - 1].honey()) { num40 = 11; } else { flag8 = true; } } } if (Main.tile[j, i + 1].liquid > 0) { if (Main.tile[j, i + 1].lava()) { num40 = 1; } else { if (Main.tile[j, i + 1].honey()) { num40 = 11; } else { flag8 = true; } } } if (num40 == 0) { num40 = Main.waterStyle; } if (!flag8 || num40 != 1) { Vector2 value2 = new Vector2((float)(j * 16), (float)(i * 16)); Rectangle value3 = new Rectangle(0, 4, 16, 16); if (flag7 && (flag4 || flag5)) { flag4 = true; flag5 = true; } if ((!flag6 || (!flag4 && !flag5)) && (!flag7 || !flag6)) { if (flag6) { value3 = new Rectangle(0, 4, 16, 4); if (Main.tile[j, i].halfBrick() || Main.tile[j, i].slope() != 0) { value3 = new Rectangle(0, 4, 16, 12); } } else { if (flag7 && !flag4 && !flag5) { value2 = new Vector2((float)(j * 16), (float)(i * 16 + 12)); value3 = new Rectangle(0, 4, 16, 4); } else { float num41 = (float)(256 - num39); num41 /= 32f; int y = 4; if (Main.tile[j, i - 1].liquid == 0 && !WorldGen.SolidTile(j, i - 1)) { y = 0; } if ((flag4 && flag5) || Main.tile[j, i].halfBrick() || Main.tile[j, i].slope() != 0) { value2 = new Vector2((float)(j * 16), (float)(i * 16 + (int)num41 * 2)); value3 = new Rectangle(0, y, 16, 16 - (int)num41 * 2); } else { if (flag4) { value2 = new Vector2((float)(j * 16), (float)(i * 16 + (int)num41 * 2)); value3 = new Rectangle(0, y, 4, 16 - (int)num41 * 2); } else { value2 = new Vector2((float)(j * 16 + 12), (float)(i * 16 + (int)num41 * 2)); value3 = new Rectangle(0, y, 4, 16 - (int)num41 * 2); } } } } } float num42 = 0.5f; if (num40 == 1) { num42 = 2f; } if (num40 == 1) { num42 = 1f; } if (num40 == 11) { num42 *= 1.7f; if (num42 > 1f) { num42 = 1f; } } if ((double)i < Main.worldSurface || num42 > 1f) { num42 = 1f; if (Main.tile[j + 1, i].wall > 0 || Main.tile[j - 1, i].wall > 0 || Main.tile[j, i + 1].wall > 0 || Main.tile[j, i - 1].wall > 0) { num42 = 0.65f; } if (Main.tile[j, i].wall > 0) { num42 = 0.5f; } } if (Main.tile[j, i].halfBrick() && Main.tile[j, i - 1].liquid > 0 && Main.tile[j, i].wall > 0) { num42 = 0f; } float num43 = (float)color2.R * num42; float num44 = (float)color2.G * num42; float num45 = (float)color2.B * num42; float num46 = (float)color2.A * num42; color2 = new Color((int)((byte)num43), (int)((byte)num44), (int)((byte)num45), (int)((byte)num46)); this.spriteBatch.Draw(Main.liquidTexture[num40], value2 - Main.screenPosition + value, new Rectangle?(value3), color2, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } } if (Main.tile[j, i].type == 51) { Color color3 = Lighting.GetColor(j, i); float num47 = 0.5f; float num48 = (float)color3.R * num47; float num49 = (float)color3.G * num47; float num50 = (float)color3.B * num47; float num51 = (float)color3.A * num47; color3 = new Color((int)((byte)num48), (int)((byte)num49), (int)((byte)num50), (int)((byte)num51)); if (Main.canDrawColorTile(j, i)) { this.spriteBatch.Draw(Main.tileAltTexture[(int)Main.tile[j, i].type, (int)Main.tile[j, i].color()], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, num10)), color3, 0f, default(Vector2), 1f, effects, 0f); } else { this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, num10)), color3, 0f, default(Vector2), 1f, effects, 0f); } } else { if (Main.tile[j, i].type == 160 && !Main.tile[j, i].halfBrick()) { Color color4 = default(Color); color4 = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 255); if (Main.tile[j, i].inActive()) { color4 = Main.tile[j, i].actColor(color4); } if (Main.tile[j, i].slope() == 0) { this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, num10)), color4, 0f, default(Vector2), 1f, effects, 0f); } else { if (Main.tile[j, i].slope() == 1) { for (int l = 0; l < 8; l++) { int num52 = 2; int num53 = l * 2; int height = 14 - l * num52; this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f + (float)num53, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + l * num52)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX + num53, (int)Main.tile[j, i].frameY, num52, height)), color4, 0f, default(Vector2), 1f, effects, 0f); } } if (Main.tile[j, i].slope() == 2) { for (int m = 0; m < 8; m++) { int num54 = 2; int num55 = 16 - m * num54 - num54; int height2 = 14 - m * num54; this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f + (float)num55, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + m * num54)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX + num55, (int)Main.tile[j, i].frameY, num54, height2)), color4, 0f, default(Vector2), 1f, effects, 0f); } } this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + 14)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)(Main.tile[j, i].frameY + 14), 16, 2)), color4, 0f, default(Vector2), 1f, effects, 0f); } } else { if (Main.tile[j, i].slope() > 0) { if (Main.tile[j, i].inActive()) { color = Main.tile[j, i].actColor(color); } else { if (Main.tileShine2[(int)Main.tile[j, i].type]) { color = Main.shine(color, (int)Main.tile[j, i].type); } } if (Main.tile[j, i].slope() == 1) { for (int n = 0; n < 8; n++) { int num56 = 2; int num57 = n * 2; int height3 = 14 - n * num56; if (Main.canDrawColorTile(j, i)) { this.spriteBatch.Draw(Main.tileAltTexture[(int)Main.tile[j, i].type, (int)Main.tile[j, i].color()], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f + (float)num57, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + n * num56)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX + num57, (int)Main.tile[j, i].frameY, num56, height3)), color, 0f, default(Vector2), 1f, effects, 0f); } else { this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f + (float)num57, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + n * num56)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX + num57, (int)Main.tile[j, i].frameY, num56, height3)), color, 0f, default(Vector2), 1f, effects, 0f); } } } if (Main.tile[j, i].slope() == 2) { for (int num58 = 0; num58 < 8; num58++) { int num59 = 2; int num60 = 16 - num58 * num59 - num59; int height4 = 14 - num58 * num59; if (Main.canDrawColorTile(j, i)) { this.spriteBatch.Draw(Main.tileAltTexture[(int)Main.tile[j, i].type, (int)Main.tile[j, i].color()], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f + (float)num60, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + num58 * num59)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX + num60, (int)Main.tile[j, i].frameY, num59, height4)), color, 0f, default(Vector2), 1f, effects, 0f); } else { this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f + (float)num60, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + num58 * num59)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX + num60, (int)Main.tile[j, i].frameY, num59, height4)), color, 0f, default(Vector2), 1f, effects, 0f); } } } if (Main.canDrawColorTile(j, i)) { this.spriteBatch.Draw(Main.tileAltTexture[(int)Main.tile[j, i].type, (int)Main.tile[j, i].color()], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + 14)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)(Main.tile[j, i].frameY + 14), 16, 2)), color, 0f, default(Vector2), 1f, effects, 0f); } else { this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + 14)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)(Main.tile[j, i].frameY + 14), 16, 2)), color, 0f, default(Vector2), 1f, effects, 0f); } } else { if (Main.tile[j, i].type == 129) { this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, num10)), new Color(200, 200, 200, 0), 0f, default(Vector2), 1f, effects, 0f); } else { if (Main.tileAlch[(int)Main.tile[j, i].type]) { num10 = 20; num9 = -1; int num61 = (int)Main.tile[j, i].type; int num62 = (int)(Main.tile[j, i].frameX / 18); if (num61 > 82) { if (num62 == 0 && Main.dayTime) { num61 = 84; } if (num62 == 1 && !Main.dayTime) { num61 = 84; } if (num62 == 3 && Main.bloodMoon) { num61 = 84; } } if (num61 == 84) { if (num62 == 0 && Main.rand.Next(100) == 0) { int num63 = Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16 - 4)), 16, 16, 19, 0f, 0f, 160, default(Color), 0.1f); Dust expr_48C1_cp_0 = Main.dust[num63]; expr_48C1_cp_0.velocity.X = expr_48C1_cp_0.velocity.X / 2f; Dust expr_48DF_cp_0 = Main.dust[num63]; expr_48DF_cp_0.velocity.Y = expr_48DF_cp_0.velocity.Y / 2f; Main.dust[num63].noGravity = true; Main.dust[num63].fadeIn = 1f; } if (num62 == 1 && Main.rand.Next(100) == 0) { Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16)), 16, 16, 41, 0f, 0f, 250, default(Color), 0.8f); } if (num62 == 3) { if (Main.rand.Next(200) == 0) { int num64 = Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16)), 16, 16, 14, 0f, 0f, 100, default(Color), 0.2f); Main.dust[num64].fadeIn = 1.2f; } if (Main.rand.Next(75) == 0) { int num65 = Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16)), 16, 16, 27, 0f, 0f, 100, default(Color), 1f); Dust expr_4A16_cp_0 = Main.dust[num65]; expr_4A16_cp_0.velocity.X = expr_4A16_cp_0.velocity.X / 2f; Dust expr_4A34_cp_0 = Main.dust[num65]; expr_4A34_cp_0.velocity.Y = expr_4A34_cp_0.velocity.Y / 2f; } } if (num62 == 4 && Main.rand.Next(150) == 0) { int num66 = Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16)), 16, 8, 16, 0f, 0f, 0, default(Color), 1f); Dust expr_4AA5_cp_0 = Main.dust[num66]; expr_4AA5_cp_0.velocity.X = expr_4AA5_cp_0.velocity.X / 3f; Dust expr_4AC3_cp_0 = Main.dust[num66]; expr_4AC3_cp_0.velocity.Y = expr_4AC3_cp_0.velocity.Y / 3f; Dust expr_4AE1_cp_0 = Main.dust[num66]; expr_4AE1_cp_0.velocity.Y = expr_4AE1_cp_0.velocity.Y - 0.7f; Main.dust[num66].alpha = 50; Main.dust[num66].scale *= 0.1f; Main.dust[num66].fadeIn = 0.9f; Main.dust[num66].noGravity = true; } if (num62 == 5) { if (Main.rand.Next(40) == 0) { int num67 = Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16 - 6)), 16, 16, 6, 0f, 0f, 0, default(Color), 1.5f); Dust expr_4B96_cp_0 = Main.dust[num67]; expr_4B96_cp_0.velocity.Y = expr_4B96_cp_0.velocity.Y - 2f; Main.dust[num67].noGravity = true; } color.A = (byte)(Main.mouseTextColor / 2); color.G = Main.mouseTextColor; color.B = Main.mouseTextColor; } } if (Main.canDrawColorTile(j, i)) { this.spriteBatch.Draw(Main.tileAltTexture[(int)Main.tile[j, i].type, (int)Main.tile[j, i].color()], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, num10)), color, 0f, default(Vector2), 1f, effects, 0f); } else { this.LoadTiles(num61); this.spriteBatch.Draw(Main.tileTexture[num61], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, num10)), color, 0f, default(Vector2), 1f, effects, 0f); } } else { if (Main.tile[j, i].type == 80) { bool flag9 = false; bool flag10 = false; bool flag11 = false; if (!Main.canDrawColorTile(j, i)) { int num68 = j; if (Main.tile[j, i].frameX == 36) { num68--; } if (Main.tile[j, i].frameX == 54) { num68++; } if (Main.tile[j, i].frameX == 108) { if (Main.tile[j, i].frameY == 18) { num68--; } else { num68++; } } int num69 = i; bool flag12 = false; if (Main.tile[num68, num69].type == 80 && Main.tile[num68, num69].active()) { flag12 = true; } while (!Main.tile[num68, num69].active() || !Main.tileSolid[(int)Main.tile[num68, num69].type] || !flag12) { if (Main.tile[num68, num69].type == 80 && Main.tile[num68, num69].active()) { flag12 = true; } num69++; if (num69 > i + 20) { break; } } if (Main.tile[num68, num69].type == 112) { flag9 = true; } if (Main.tile[num68, num69].type == 116) { flag10 = true; } if (Main.tile[num68, num69].type == 234) { flag11 = true; } } if (flag9) { this.spriteBatch.Draw(Main.evilCactusTexture, new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, num10)), color, 0f, default(Vector2), 1f, effects, 0f); } else { if (flag11) { this.spriteBatch.Draw(Main.crimsonCactusTexture, new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, num10)), color, 0f, default(Vector2), 1f, effects, 0f); } else { if (flag10) { this.spriteBatch.Draw(Main.goodCactusTexture, new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, num10)), color, 0f, default(Vector2), 1f, effects, 0f); } else { if (Main.canDrawColorTile(j, i)) { this.spriteBatch.Draw(Main.tileAltTexture[(int)Main.tile[j, i].type, (int)Main.tile[j, i].color()], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, num10)), color, 0f, default(Vector2), 1f, effects, 0f); } else { this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, num10)), color, 0f, default(Vector2), 1f, effects, 0f); } } } } } else { if (Main.tile[j, i].type == 160) { color = new Color(Main.DiscoR, Main.DiscoG, Main.DiscoB, 255); } if (Main.tile[j, i].type != 19 && Main.tileSolid[(int)Main.tile[j, i].type] && !Main.tile[j, i].halfBrick() && (Main.tile[j - 1, i].halfBrick() || Main.tile[j + 1, i].halfBrick())) { if (Main.tile[j, i].inActive()) { color = Main.tile[j, i].actColor(color); } else { if (Main.tileShine2[(int)Main.tile[j, i].type]) { color = Main.shine(color, (int)Main.tile[j, i].type); } } if (Main.tile[j - 1, i].halfBrick() && Main.tile[j + 1, i].halfBrick()) { if (Main.canDrawColorTile(j, i)) { this.spriteBatch.Draw(Main.tileAltTexture[(int)Main.tile[j, i].type, (int)Main.tile[j, i].color()], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + 8)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)(Main.tile[j, i].frameY + 8), num8, 8)), color, 0f, default(Vector2), 1f, effects, 0f); this.spriteBatch.Draw(Main.tileAltTexture[(int)Main.tile[j, i].type, (int)Main.tile[j, i].color()], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle(126, 0, 16, 8)), color, 0f, default(Vector2), 1f, effects, 0f); } else { this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + 8)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)(Main.tile[j, i].frameY + 8), num8, 8)), color, 0f, default(Vector2), 1f, effects, 0f); this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle(126, 0, 16, 8)), color, 0f, default(Vector2), 1f, effects, 0f); } } else { if (Main.tile[j - 1, i].halfBrick()) { if (Main.canDrawColorTile(j, i)) { this.spriteBatch.Draw(Main.tileAltTexture[(int)Main.tile[j, i].type, (int)Main.tile[j, i].color()], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + 8)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)(Main.tile[j, i].frameY + 8), num8, 8)), color, 0f, default(Vector2), 1f, effects, 0f); this.spriteBatch.Draw(Main.tileAltTexture[(int)Main.tile[j, i].type, (int)Main.tile[j, i].color()], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f + 4f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle((int)(Main.tile[j, i].frameX + 4), (int)Main.tile[j, i].frameY, num8 - 4, num10)), color, 0f, default(Vector2), 1f, effects, 0f); this.spriteBatch.Draw(Main.tileAltTexture[(int)Main.tile[j, i].type, (int)Main.tile[j, i].color()], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle(126, 0, 4, 8)), color, 0f, default(Vector2), 1f, effects, 0f); } else { this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + 8)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)(Main.tile[j, i].frameY + 8), num8, 8)), color, 0f, default(Vector2), 1f, effects, 0f); this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f + 4f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle((int)(Main.tile[j, i].frameX + 4), (int)Main.tile[j, i].frameY, num8 - 4, num10)), color, 0f, default(Vector2), 1f, effects, 0f); this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle(126, 0, 4, 8)), color, 0f, default(Vector2), 1f, effects, 0f); } } else { if (Main.tile[j + 1, i].halfBrick()) { if (Main.canDrawColorTile(j, i)) { this.spriteBatch.Draw(Main.tileAltTexture[(int)Main.tile[j, i].type, (int)Main.tile[j, i].color()], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + 8)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)(Main.tile[j, i].frameY + 8), num8, 8)), color, 0f, default(Vector2), 1f, effects, 0f); this.spriteBatch.Draw(Main.tileAltTexture[(int)Main.tile[j, i].type, (int)Main.tile[j, i].color()], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8 - 4, num10)), color, 0f, default(Vector2), 1f, effects, 0f); this.spriteBatch.Draw(Main.tileAltTexture[(int)Main.tile[j, i].type, (int)Main.tile[j, i].color()], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f + 12f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle(138, 0, 4, 8)), color, 0f, default(Vector2), 1f, effects, 0f); } else { this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + 8)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)(Main.tile[j, i].frameY + 8), num8, 8)), color, 0f, default(Vector2), 1f, effects, 0f); this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8 - 4, num10)), color, 0f, default(Vector2), 1f, effects, 0f); this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f + 12f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle(138, 0, 4, 8)), color, 0f, default(Vector2), 1f, effects, 0f); } } else { if (Main.canDrawColorTile(j, i)) { this.spriteBatch.Draw(Main.tileAltTexture[(int)Main.tile[j, i].type, (int)Main.tile[j, i].color()], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, num10)), color, 0f, default(Vector2), 1f, effects, 0f); } else { this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, num10)), color, 0f, default(Vector2), 1f, effects, 0f); } } } } } else { if (Lighting.lightMode < 2 && Main.tileSolid[(int)Main.tile[j, i].type] && Main.tile[j, i].type != 137 && Main.tile[j, i].type != 235 && !Main.tile[j, i].halfBrick() && !Main.tile[j, i].inActive()) { if ((int)color.R > num || (double)color.G > (double)num * 1.1 || (double)color.B > (double)num * 1.2) { for (int num70 = 0; num70 < 9; num70++) { int num71 = 0; int num72 = 0; int width = 4; int height5 = 4; Color color5 = color; Color color6 = color; if (num70 == 0) { color6 = Lighting.GetColor(j - 1, i - 1); } if (num70 == 1) { width = 8; num71 = 4; color6 = Lighting.GetColor(j, i - 1); } if (num70 == 2) { color6 = Lighting.GetColor(j + 1, i - 1); num71 = 12; } if (num70 == 3) { color6 = Lighting.GetColor(j - 1, i); height5 = 8; num72 = 4; } if (num70 == 4) { width = 8; height5 = 8; num71 = 4; num72 = 4; } if (num70 == 5) { num71 = 12; num72 = 4; height5 = 8; color6 = Lighting.GetColor(j + 1, i); } if (num70 == 6) { color6 = Lighting.GetColor(j - 1, i + 1); num72 = 12; } if (num70 == 7) { width = 8; height5 = 4; num71 = 4; num72 = 12; color6 = Lighting.GetColor(j, i + 1); } if (num70 == 8) { color6 = Lighting.GetColor(j + 1, i + 1); num71 = 12; num72 = 12; } color5.R = (byte)((color.R + color6.R) / 2); color5.G = (byte)((color.G + color6.G) / 2); color5.B = (byte)((color.B + color6.B) / 2); if (Main.tile[j, i].inActive()) { color5 = Main.tile[j, i].actColor(color5); } else { if (Main.tileShine2[(int)Main.tile[j, i].type]) { color5 = Main.shine(color5, (int)Main.tile[j, i].type); } } if (Main.canDrawColorTile(j, i)) { this.spriteBatch.Draw(Main.tileAltTexture[(int)Main.tile[j, i].type, (int)Main.tile[j, i].color()], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f + (float)num71, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + num72)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX + num71, (int)Main.tile[j, i].frameY + num72, width, height5)), color5, 0f, default(Vector2), 1f, effects, 0f); } else { this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f + (float)num71, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + num72)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX + num71, (int)Main.tile[j, i].frameY + num72, width, height5)), color5, 0f, default(Vector2), 1f, effects, 0f); } } } else { if ((int)color.R > num2 || (double)color.G > (double)num2 * 1.1 || (double)color.B > (double)num2 * 1.2) { for (int num73 = 0; num73 < 4; num73++) { int num74 = 0; int num75 = 0; Color color7 = color; Color color8 = color; if (num73 == 0) { if (Lighting.Brighter(j, i - 1, j - 1, i)) { color8 = Lighting.GetColor(j - 1, i); } else { color8 = Lighting.GetColor(j, i - 1); } } if (num73 == 1) { if (Lighting.Brighter(j, i - 1, j + 1, i)) { color8 = Lighting.GetColor(j + 1, i); } else { color8 = Lighting.GetColor(j, i - 1); } num74 = 8; } if (num73 == 2) { if (Lighting.Brighter(j, i + 1, j - 1, i)) { color8 = Lighting.GetColor(j - 1, i); } else { color8 = Lighting.GetColor(j, i + 1); } num75 = 8; } if (num73 == 3) { if (Lighting.Brighter(j, i + 1, j + 1, i)) { color8 = Lighting.GetColor(j + 1, i); } else { color8 = Lighting.GetColor(j, i + 1); } num74 = 8; num75 = 8; } color7.R = (byte)((color.R + color8.R) / 2); color7.G = (byte)((color.G + color8.G) / 2); color7.B = (byte)((color.B + color8.B) / 2); if (Main.tile[j, i].inActive()) { color7 = Main.tile[j, i].actColor(color7); } else { if (Main.tileShine2[(int)Main.tile[j, i].type]) { color7 = Main.shine(color7, (int)Main.tile[j, i].type); } } if (Main.canDrawColorTile(j, i)) { this.spriteBatch.Draw(Main.tileAltTexture[(int)Main.tile[j, i].type, (int)Main.tile[j, i].color()], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f + (float)num74, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + num75)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX + num74, (int)Main.tile[j, i].frameY + num75, 8, 8)), color7, 0f, default(Vector2), 1f, effects, 0f); } else { this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f + (float)num74, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + num75)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX + num74, (int)Main.tile[j, i].frameY + num75, 8, 8)), color7, 0f, default(Vector2), 1f, effects, 0f); } } } else { if (Main.tile[j, i].inActive()) { color = Main.tile[j, i].actColor(color); } else { if (Main.tileShine2[(int)Main.tile[j, i].type]) { color = Main.shine(color, (int)Main.tile[j, i].type); } } if (Main.canDrawColorTile(j, i)) { this.spriteBatch.Draw(Main.tileAltTexture[(int)Main.tile[j, i].type, (int)Main.tile[j, i].color()], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, num10)), color, 0f, default(Vector2), 1f, effects, 0f); } else { this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, num10)), color, 0f, default(Vector2), 1f, effects, 0f); } } } } else { if (Lighting.lightMode < 2 && Main.tileShine2[(int)Main.tile[j, i].type]) { if (Main.tile[j, i].type == 21) { if (Main.tile[j, i].frameX >= 36 && Main.tile[j, i].frameX < 178) { color = Main.shine(color, (int)Main.tile[j, i].type); } } else { if (!Main.tile[j, i].inActive()) { color = Main.shine(color, (int)Main.tile[j, i].type); } } } if (Main.tile[j, i].inActive()) { color = Main.tile[j, i].actColor(color); } if (Main.tile[j, i].type == 128) { int num76; for (num76 = (int)Main.tile[j, i].frameX; num76 >= 100; num76 -= 100) { } this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle(num76, (int)Main.tile[j, i].frameY, num8, num10)), color, 0f, default(Vector2), 1f, effects, 0f); } else { if (Main.tile[j, i].type == 5) { int num77 = -1; int num78 = j; int num79 = i; if (Main.tile[j, i].frameX == 66 && Main.tile[j, i].frameY <= 45) { num78++; } if (Main.tile[j, i].frameX == 88 && Main.tile[j, i].frameY >= 66 && Main.tile[j, i].frameY <= 110) { num78--; } if (Main.tile[j, i].frameX == 22 && Main.tile[j, i].frameY >= 132) { num78--; } if (Main.tile[j, i].frameX == 44 && Main.tile[j, i].frameY >= 132) { num78++; } while (Main.tile[num78, num79].active() && Main.tile[num78, num79].type == 5) { num79++; } if (Main.tile[num78, num79].active() && Main.tile[num78, num79].type == 23) { num77 = 0; } if (Main.tile[num78, num79].active() && Main.tile[num78, num79].type == 60) { num77 = 1; } if (Main.tile[num78, num79].active() && Main.tile[num78, num79].type == 70) { num77 = 6; } if (Main.tile[num78, num79].active() && Main.tile[num78, num79].type == 60 && (double)num79 > Main.worldSurface) { num77 = 5; } if (Main.tile[num78, num79].active() && Main.tile[num78, num79].type == 109) { num77 = 2; } if (Main.tile[num78, num79].active() && Main.tile[num78, num79].type == 147) { num77 = 3; if (WorldGen.snowBG == 0) { num77 = -1; } } if (Main.tile[num78, num79].active() && Main.tile[num78, num79].type == 199) { num77 = 4; } if (num77 == -1 || Main.canDrawColorTile(j, i)) { if (Main.canDrawColorTile(j, i)) { this.spriteBatch.Draw(Main.tileAltTexture[(int)Main.tile[j, i].type, (int)Main.tile[j, i].color()], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, num10)), color, 0f, default(Vector2), 1f, effects, 0f); } else { this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, num10)), color, 0f, default(Vector2), 1f, effects, 0f); } } else { this.spriteBatch.Draw(Main.woodTexture[num77], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, num10)), color, 0f, default(Vector2), 1f, effects, 0f); } } else { if (num11 == 8 && (!Main.tile[j, i + 1].active() || !Main.tileSolid[(int)Main.tile[j, i + 1].type] || Main.tile[j, i + 1].halfBrick())) { if (Main.tile[j, i].type == 19) { if (Main.canDrawColorTile(j, i)) { this.spriteBatch.Draw(Main.tileAltTexture[(int)Main.tile[j, i].type, (int)Main.tile[j, i].color()], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + num11)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, num10)), color, 0f, default(Vector2), 1f, effects, 0f); } else { this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + num11)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, num10)), color, 0f, default(Vector2), 1f, effects, 0f); } } else { if (Main.canDrawColorTile(j, i)) { this.spriteBatch.Draw(Main.tileAltTexture[(int)Main.tile[j, i].type, (int)Main.tile[j, i].color()], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + num11)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, num10 - num11 - 4)), color, 0f, default(Vector2), 1f, effects, 0f); this.spriteBatch.Draw(Main.tileAltTexture[(int)Main.tile[j, i].type, (int)Main.tile[j, i].color()], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + 12)) + value, new Rectangle?(new Rectangle(144, 66, num8, 4)), color, 0f, default(Vector2), 1f, effects, 0f); } else { this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + num11)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, num10 - num11 - 4)), color, 0f, default(Vector2), 1f, effects, 0f); this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + 12)) + value, new Rectangle?(new Rectangle(144, 66, num8, 4)), color, 0f, default(Vector2), 1f, effects, 0f); } } } else { if (Main.canDrawColorTile(j, i)) { this.spriteBatch.Draw(Main.tileAltTexture[(int)Main.tile[j, i].type, (int)Main.tile[j, i].color()], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + num11)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY + num12, num8, num10 - num11)), color, 0f, default(Vector2), 1f, effects, 0f); } else { this.spriteBatch.Draw(Main.tileTexture[(int)Main.tile[j, i].type], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9 + num11)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY + num12, num8, num10 - num11)), color, 0f, default(Vector2), 1f, effects, 0f); } } if (Main.tile[j, i].type == 139) { this.spriteBatch.Draw(Main.MusicBoxTexture, new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, num10)), new Color(200, 200, 200, 0), 0f, default(Vector2), 1f, effects, 0f); } if (Main.tileFlame[(int)Main.tile[j, i].type]) { int type = (int)Main.tile[j, i].type; int num80 = 0; if (type == 4) { num80 = 0; } else { if (type == 33 || type == 174) { num80 = 1; } else { if (type == 100 || type == 173) { num80 = 2; } else { if (type == 34 || type == 35 || type == 36 || type == 170 || type == 171 || type == 172) { num80 = 3; } else { if (type == 93) { num80 = 4; } else { if (type == 49) { num80 = 5; } else { if (type == 98) { num80 = 6; } } } } } } } for (int num81 = 0; num81 < 7; num81++) { float num82 = (float)Main.rand.Next(-10, 11) * 0.15f; float num83 = (float)Main.rand.Next(-10, 1) * 0.35f; this.spriteBatch.Draw(Main.FlameTexture[num80], new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f + num82, (float)(i * 16 - (int)Main.screenPosition.Y + num9) + num83) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, num10)), new Color(100, 100, 100, 0), 0f, default(Vector2), 1f, effects, 0f); } } if (Main.tile[j, i].type == 144) { this.spriteBatch.Draw(Main.timerTexture, new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, num10)), new Color(200, 200, 200, 0), 0f, default(Vector2), 1f, effects, 0f); } if (Main.tile[j, i].type == 237) { this.spriteBatch.Draw(Main.sunAltarTexture, new Vector2((float)(j * 16 - (int)Main.screenPosition.X) - ((float)num8 - 16f) / 2f, (float)(i * 16 - (int)Main.screenPosition.Y + num9)) + value, new Rectangle?(new Rectangle((int)Main.tile[j, i].frameX, (int)Main.tile[j, i].frameY, num8, num10)), new Color((int)(Main.mouseTextColor / 2), (int)(Main.mouseTextColor / 2), (int)(Main.mouseTextColor / 2), 0), 0f, default(Vector2), 1f, effects, 0f); } } } } } } } } } } } } } } } for (int num84 = 0; num84 < num3; num84++) { int num85 = array[num84]; int num86 = array2[num84]; if (Main.tile[num85, num86].type == 237) { this.spriteBatch.Draw(Main.sunOrbTexture, new Vector2((float)(num85 * 16 - (int)Main.screenPosition.X) + (float)num8 / 2f, (float)(num86 * 16 - (int)Main.screenPosition.Y - 36)) + value, new Rectangle?(new Rectangle(0, 0, Main.sunOrbTexture.Width, Main.sunOrbTexture.Height)), new 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, 0f); } if (Main.tile[num85, num86].type == 128 && Main.tile[num85, num86].frameX >= 100) { int num87 = (int)(Main.tile[num85, num86].frameY / 18); int num88 = (int)Main.tile[num85, num86].frameX; int num89 = 0; while (num88 >= 100) { num89++; num88 -= 100; } int num90 = -4; SpriteEffects effects2 = SpriteEffects.FlipHorizontally; if (num88 >= 36) { effects2 = SpriteEffects.None; num90 = -4; } if (num87 == 0) { this.LoadArmorHead(num89); this.spriteBatch.Draw(Main.armorHeadTexture[num89], new Vector2((float)(num85 * 16 - (int)Main.screenPosition.X + num90), (float)(num86 * 16 - (int)Main.screenPosition.Y - 12)) + value, new Rectangle?(new Rectangle(0, 0, 40, 36)), Lighting.GetColor(num85, num86), 0f, default(Vector2), 1f, effects2, 0f); } else { if (num87 == 1) { this.LoadArmorBody(num89); this.spriteBatch.Draw(Main.armorBodyTexture[num89], new Vector2((float)(num85 * 16 - (int)Main.screenPosition.X + num90), (float)(num86 * 16 - (int)Main.screenPosition.Y - 28)) + value, new Rectangle?(new Rectangle(0, 0, 40, 54)), Lighting.GetColor(num85, num86), 0f, default(Vector2), 1f, effects2, 0f); } else { if (num87 == 2) { this.LoadArmorLegs(num89); this.spriteBatch.Draw(Main.armorLegTexture[num89], new Vector2((float)(num85 * 16 - (int)Main.screenPosition.X + num90), (float)(num86 * 16 - (int)Main.screenPosition.Y - 44)) + value, new Rectangle?(new Rectangle(0, 0, 40, 54)), Lighting.GetColor(num85, num86), 0f, default(Vector2), 1f, effects2, 0f); } } } } try { if (Main.tile[num85, num86].type == 5 && Main.tile[num85, num86].frameY >= 198 && Main.tile[num85, num86].frameX >= 22) { int num91 = 0; if (Main.tile[num85, num86].frameX == 22) { if (Main.tile[num85, num86].frameY == 220) { num91 = 1; } else { if (Main.tile[num85, num86].frameY == 242) { num91 = 2; } } int num92 = 0; int num93 = 80; int num94 = 80; int num95 = 32; int num96 = 0; int num97 = num86; while (num97 < num86 + 100) { if (Main.tile[num85, num97].type == 2) { num92 = Main.GetTreeStyle(num85); break; } if (Main.tile[num85, num97].type == 23) { num92 = 1; break; } if (Main.tile[num85, num97].type == 70) { num92 = 14; break; } if (Main.tile[num85, num97].type == 60) { num92 = 2; if (WorldGen.jungleBG == 1) { num92 = 11; } if ((double)num97 > Main.worldSurface) { num92 = 13; } num93 = 114; num94 = 96; num95 = 48; break; } if (Main.tile[num85, num97].type == 147) { num92 = 4; if (WorldGen.snowBG == 0) { num92 = 12; break; } break; } else { if (Main.tile[num85, num97].type == 199) { num92 = 5; break; } if (Main.tile[num85, num97].type == 109) { num92 = 3; num94 = 140; if (num85 % 3 == 1) { num91 += 3; break; } if (num85 % 3 == 2) { num91 += 6; break; } break; } else { num97++; } } } if (num92 == 14) { float num98 = (float)Main.rand.Next(28, 42) * 0.005f; num98 += (float)(270 - (int)Main.mouseTextColor) / 1000f; Lighting.addLight(num85, num86, 0.1f, 0.2f + num98 / 2f, 0.7f + num98); } if (Main.tile[num85, num86].color() > 0) { Main.checkTreeAlt[num92, (int)Main.tile[num85, num86].color()] = true; } if (Main.tile[num85, num86].color() > 0 && Main.treeAltTextureDrawn[num92, (int)Main.tile[num85, num86].color()]) { this.spriteBatch.Draw(Main.treeTopAltTexture[num92, (int)Main.tile[num85, num86].color()], new Vector2((float)(num85 * 16 - (int)Main.screenPosition.X - num95), (float)(num86 * 16 - (int)Main.screenPosition.Y - num94 + 16 + num96)) + value, new Rectangle?(new Rectangle(num91 * (num93 + 2), 0, num93, num94)), Lighting.GetColor(num85, num86), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } else { this.spriteBatch.Draw(Main.treeTopTexture[num92], new Vector2((float)(num85 * 16 - (int)Main.screenPosition.X - num95), (float)(num86 * 16 - (int)Main.screenPosition.Y - num94 + 16 + num96)) + value, new Rectangle?(new Rectangle(num91 * (num93 + 2), 0, num93, num94)), Lighting.GetColor(num85, num86), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } else { if (Main.tile[num85, num86].frameX == 44) { if (Main.tile[num85, num86].frameY == 220) { num91 = 1; } else { if (Main.tile[num85, num86].frameY == 242) { num91 = 2; } } int num99 = 0; int num100 = num86; while (num100 < num86 + 100) { if (Main.tile[num85 + 1, num100].type == 2) { num99 = Main.GetTreeStyle(num85 + 1); break; } if (Main.tile[num85 + 1, num100].type == 23) { num99 = 1; break; } if (Main.tile[num85 + 1, num100].type == 70) { num99 = 14; break; } if (Main.tile[num85 + 1, num100].type == 60) { num99 = 2; if ((double)num100 > Main.worldSurface) { num99 = 13; break; } break; } else { if (Main.tile[num85 + 1, num100].type == 147) { num99 = 4; if (WorldGen.snowBG == 0) { num99 = 12; break; } break; } else { if (Main.tile[num85 + 1, num100].type == 199) { num99 = 5; break; } if (Main.tile[num85 + 1, num100].type == 109) { num99 = 3; if (num85 % 3 == 1) { num91 += 3; break; } if (num85 % 3 == 2) { num91 += 6; break; } break; } else { num100++; } } } } if (num99 == 14) { float num101 = (float)Main.rand.Next(28, 42) * 0.005f; num101 += (float)(270 - (int)Main.mouseTextColor) / 1000f; Lighting.addLight(num85, num86, 0.1f, 0.2f + num101 / 2f, 0.7f + num101); } if (Main.tile[num85, num86].color() > 0) { Main.checkTreeAlt[num99, (int)Main.tile[num85, num86].color()] = true; } if (Main.tile[num85, num86].color() > 0 && Main.treeAltTextureDrawn[num99, (int)Main.tile[num85, num86].color()]) { this.spriteBatch.Draw(Main.treeBranchAltTexture[num99, (int)Main.tile[num85, num86].color()], new Vector2((float)(num85 * 16 - (int)Main.screenPosition.X - 24), (float)(num86 * 16 - (int)Main.screenPosition.Y - 12)) + value, new Rectangle?(new Rectangle(0, num91 * 42, 40, 40)), Lighting.GetColor(num85, num86), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } else { this.spriteBatch.Draw(Main.treeBranchTexture[num99], new Vector2((float)(num85 * 16 - (int)Main.screenPosition.X - 24), (float)(num86 * 16 - (int)Main.screenPosition.Y - 12)) + value, new Rectangle?(new Rectangle(0, num91 * 42, 40, 40)), Lighting.GetColor(num85, num86), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } else { if (Main.tile[num85, num86].frameX == 66) { if (Main.tile[num85, num86].frameY == 220) { num91 = 1; } else { if (Main.tile[num85, num86].frameY == 242) { num91 = 2; } } int num102 = 0; int num103 = num86; while (num103 < num86 + 100) { if (Main.tile[num85 - 1, num103].type == 2) { num102 = Main.GetTreeStyle(num85 - 1); break; } if (Main.tile[num85 - 1, num103].type == 23) { num102 = 1; break; } if (Main.tile[num85 - 1, num103].type == 70) { num102 = 14; break; } if (Main.tile[num85 - 1, num103].type == 60) { num102 = 2; if ((double)num103 > Main.worldSurface) { num102 = 13; break; } break; } else { if (Main.tile[num85 - 1, num103].type == 147) { num102 = 4; if (WorldGen.snowBG == 0) { num102 = 12; break; } break; } else { if (Main.tile[num85 - 1, num103].type == 199) { num102 = 5; break; } if (Main.tile[num85 - 1, num103].type == 109) { num102 = 3; if (num85 % 3 == 1) { num91 += 3; break; } if (num85 % 3 == 2) { num91 += 6; break; } break; } else { num103++; } } } } if (num102 == 14) { float num104 = (float)Main.rand.Next(28, 42) * 0.005f; num104 += (float)(270 - (int)Main.mouseTextColor) / 1000f; Lighting.addLight(num85, num86, 0.1f, 0.2f + num104 / 2f, 0.7f + num104); } if (Main.tile[num85, num86].color() > 0) { Main.checkTreeAlt[num102, (int)Main.tile[num85, num86].color()] = true; } if (Main.tile[num85, num86].color() > 0 && Main.treeAltTextureDrawn[num102, (int)Main.tile[num85, num86].color()]) { this.spriteBatch.Draw(Main.treeBranchAltTexture[num102, (int)Main.tile[num85, num86].color()], new Vector2((float)(num85 * 16 - (int)Main.screenPosition.X), (float)(num86 * 16 - (int)Main.screenPosition.Y - 12)) + value, new Rectangle?(new Rectangle(42, num91 * 42, 40, 40)), Lighting.GetColor(num85, num86), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } else { this.spriteBatch.Draw(Main.treeBranchTexture[num102], new Vector2((float)(num85 * 16 - (int)Main.screenPosition.X), (float)(num86 * 16 - (int)Main.screenPosition.Y - 12)) + value, new Rectangle?(new Rectangle(42, num91 * 42, 40, 40)), Lighting.GetColor(num85, num86), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } } } } } catch { } } if (solidOnly) { Main.renderTimer[0] = (float)stopwatch.ElapsedMilliseconds; return; } Main.renderTimer[1] = (float)stopwatch.ElapsedMilliseconds; } protected void DrawWater(bool bg = false, int Style = 0, float Alpha = 1f) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); Vector2 value = new Vector2((float)Main.offScreenRange, (float)Main.offScreenRange); if (Main.drawToScreen) { value = default(Vector2); } int num = (int)(255f * (1f - Main.gfxQuality) + 40f * Main.gfxQuality); float arg_52_0 = Main.gfxQuality; float arg_58_0 = Main.gfxQuality; int num2 = (int)((Main.screenPosition.X - value.X) / 16f - 1f); int num3 = (int)((Main.screenPosition.X + (float)Main.screenWidth + value.X) / 16f) + 2; int num4 = (int)((Main.screenPosition.Y - value.Y) / 16f - 1f); int num5 = (int)((Main.screenPosition.Y + (float)Main.screenHeight + value.Y) / 16f) + 5; if (num2 < 5) { num2 = 5; } if (num3 > Main.maxTilesX - 5) { num3 = Main.maxTilesX - 5; } if (num4 < 5) { num4 = 5; } if (num5 > Main.maxTilesY - 5) { num5 = Main.maxTilesY - 5; } for (int i = num4; i < num5 + 4; i++) { for (int j = num2 - 2; j < num3 + 2; j++) { if (Main.tile[j, i] == null) { Main.tile[j, i] = new Tile(); } if (Main.tile[j, i].liquid > 0 && (!Main.tile[j, i].nactive() || !Main.tileSolid[(int)Main.tile[j, i].type] || Main.tileSolidTop[(int)Main.tile[j, i].type]) && (Lighting.Brightness(j, i) > 0f || bg)) { Color color = Lighting.GetColor(j, i); float num6 = (float)(256 - (int)Main.tile[j, i].liquid); num6 /= 32f; int num7 = 0; if (Main.tile[j, i].lava()) { num7 = 1; } else { if (Main.tile[j, i].honey()) { num7 = 11; } } if (num7 == 0) { num7 = Style; } if ((num7 != 1 && num7 != 11) || !Main.drewLava) { float num8 = 0.5f; if (bg) { num8 = 1f; } if (num7 != 1 && num7 != 11) { num8 *= Alpha; } Vector2 value2 = new Vector2((float)(j * 16), (float)(i * 16 + (int)num6 * 2)); Rectangle value3 = new Rectangle(0, 0, 16, 16 - (int)num6 * 2); if (Main.tile[j, i + 1].liquid < 245 && (!Main.tile[j, i + 1].nactive() || !Main.tileSolid[(int)Main.tile[j, i + 1].type] || Main.tileSolidTop[(int)Main.tile[j, i + 1].type])) { float num9 = (float)(256 - (int)Main.tile[j, i + 1].liquid); num9 /= 32f; num8 = 0.5f * (8f - num6) / 4f; if ((double)num8 > 0.55) { num8 = 0.55f; } if ((double)num8 < 0.35) { num8 = 0.35f; } float num10 = num6 / 2f; if (Main.tile[j, i + 1].liquid < 200) { if (bg) { goto IL_DA9; } if (Main.tile[j, i - 1].liquid > 0 && Main.tile[j, i - 1].liquid > 0) { value3 = new Rectangle(0, 4, 16, 16); num8 = 0.5f; } else { if (Main.tile[j, i - 1].liquid > 0) { value2 = new Vector2((float)(j * 16), (float)(i * 16 + 4)); value3 = new Rectangle(0, 4, 16, 12); num8 = 0.5f; } else { if (Main.tile[j, i + 1].liquid > 0) { value2 = new Vector2((float)(j * 16), (float)(i * 16 + (int)num6 * 2 + (int)num9 * 2)); value3 = new Rectangle(0, 4, 16, 16 - (int)num6 * 2); } else { value2 = new Vector2((float)(j * 16 + (int)num10), (float)(i * 16 + (int)num10 * 2 + (int)num9 * 2)); value3 = new Rectangle(0, 4, 16 - (int)num10 * 2, 16 - (int)num10 * 2); } } } } else { num8 = 0.5f; value3 = new Rectangle(0, 4, 16, 16 - (int)num6 * 2 + (int)num9 * 2); } } else { if (Main.tile[j, i - 1].liquid > 32) { value3 = new Rectangle(0, 4, value3.Width, value3.Height); } else { if (num6 < 1f && Main.tile[j, i - 1].nactive() && Main.tileSolid[(int)Main.tile[j, i - 1].type] && !Main.tileSolidTop[(int)Main.tile[j, i - 1].type]) { value2 = new Vector2((float)(j * 16), (float)(i * 16)); value3 = new Rectangle(0, 4, 16, 16); } else { bool flag = true; int num11 = i + 1; while (num11 < i + 6 && (!Main.tile[j, num11].nactive() || !Main.tileSolid[(int)Main.tile[j, num11].type] || Main.tileSolidTop[(int)Main.tile[j, num11].type])) { if (Main.tile[j, num11].liquid < 200) { flag = false; break; } num11++; } if (!flag) { num8 = 0.5f; value3 = new Rectangle(0, 4, 16, 16); } else { if (Main.tile[j, i - 1].liquid > 0) { value3 = new Rectangle(0, 2, value3.Width, value3.Height); } } } } } if ((color.R > 20 || color.B > 20 || color.G > 20) && value3.Y < 4) { int num12 = (int)color.R; if ((int)color.G > num12) { num12 = (int)color.G; } if ((int)color.B > num12) { num12 = (int)color.B; } num12 /= 30; if (Main.rand.Next(20000) < num12) { Color newColor = new Color(255, 255, 255); if (Main.tile[j, i].honey()) { newColor = new Color(255, 255, 50); } int num13 = Dust.NewDust(new Vector2((float)(j * 16), value2.Y - 2f), 16, 8, 43, 0f, 0f, 254, newColor, 0.75f); Main.dust[num13].velocity *= 0f; } } if (Main.tile[j, i].honey()) { num8 *= 1.6f; if (num8 > 1f) { num8 = 1f; } } if (Main.tile[j, i].lava()) { num8 *= 1.8f; if (num8 > 1f) { num8 = 1f; } if (base.IsActive && !Main.gamePaused && Dust.lavaBubbles < 200) { if (Main.tile[j, i].liquid > 200 && Main.rand.Next(700) == 0) { Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16)), 16, 16, 35, 0f, 0f, 0, default(Color), 1f); } if (value3.Y == 0 && Main.rand.Next(350) == 0) { int num14 = Dust.NewDust(new Vector2((float)(j * 16), (float)(i * 16) + num6 * 2f - 8f), 16, 8, 35, 0f, 0f, 50, default(Color), 1.5f); Main.dust[num14].velocity *= 0.8f; Dust expr_8F6_cp_0 = Main.dust[num14]; expr_8F6_cp_0.velocity.X = expr_8F6_cp_0.velocity.X * 2f; Dust expr_914_cp_0 = Main.dust[num14]; expr_914_cp_0.velocity.Y = expr_914_cp_0.velocity.Y - (float)Main.rand.Next(1, 7) * 0.1f; if (Main.rand.Next(10) == 0) { Dust expr_94E_cp_0 = Main.dust[num14]; expr_94E_cp_0.velocity.Y = expr_94E_cp_0.velocity.Y * (float)Main.rand.Next(2, 5); } Main.dust[num14].noGravity = true; } } } float num15 = (float)color.R * num8; float num16 = (float)color.G * num8; float num17 = (float)color.B * num8; float num18 = (float)color.A * num8; color = new Color((int)((byte)num15), (int)((byte)num16), (int)((byte)num17), (int)((byte)num18)); if (Lighting.lightMode < 2 && !bg) { Color color2 = color; if (num7 != 1 && ((double)color2.R > (double)num * 0.6 || (double)color2.G > (double)num * 0.65 || (double)color2.B > (double)num * 0.7)) { for (int k = 0; k < 4; k++) { int num19 = 0; int num20 = 0; int width = 8; int height = 8; Color color3 = color2; Color color4 = Lighting.GetColor(j, i); if (k == 0) { color4 = Lighting.GetColor(j - 1, i - 1); if (value3.Height < 8) { height = value3.Height; } } if (k == 1) { color4 = Lighting.GetColor(j + 1, i - 1); num19 = 8; if (value3.Height < 8) { height = value3.Height; } } if (k == 2) { color4 = Lighting.GetColor(j - 1, i + 1); num20 = 8; height = 8 - (16 - value3.Height); } if (k == 3) { color4 = Lighting.GetColor(j + 1, i + 1); num19 = 8; num20 = 8; height = 8 - (16 - value3.Height); } num15 = (float)color4.R * num8; num16 = (float)color4.G * num8; num17 = (float)color4.B * num8; num18 = (float)color4.A * num8; color4 = new Color((int)((byte)num15), (int)((byte)num16), (int)((byte)num17), (int)((byte)num18)); color3.R = (byte)((color2.R * 3 + color4.R * 2) / 5); color3.G = (byte)((color2.G * 3 + color4.G * 2) / 5); color3.B = (byte)((color2.B * 3 + color4.B * 2) / 5); color3.A = (byte)((color2.A * 3 + color4.A * 2) / 5); this.spriteBatch.Draw(Main.liquidTexture[num7], value2 - Main.screenPosition + new Vector2((float)num19, (float)num20) + value, new Rectangle?(new Rectangle(value3.X + num19, value3.Y + num20, width, height)), color3, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } else { this.spriteBatch.Draw(Main.liquidTexture[num7], value2 - Main.screenPosition + value, new Rectangle?(value3), color, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } else { if (value3.Y < 4) { value3.X += (int)(Main.wFrame * 18f); } this.spriteBatch.Draw(Main.liquidTexture[num7], value2 - Main.screenPosition + value, new Rectangle?(value3), color, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } if (Main.tile[j, i + 1].halfBrick()) { color = Lighting.GetColor(j, i + 1); num15 = (float)color.R * num8; num16 = (float)color.G * num8; num17 = (float)color.B * num8; num18 = (float)color.A * num8; color = new Color((int)((byte)num15), (int)((byte)num16), (int)((byte)num17), (int)((byte)num18)); value2 = new Vector2((float)(j * 16), (float)(i * 16 + 16)); this.spriteBatch.Draw(Main.liquidTexture[num7], value2 - Main.screenPosition + value, new Rectangle?(new Rectangle(0, 4, 16, 8)), color, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } } IL_DA9:; } } Main.drewLava = true; if (!bg) { Main.renderTimer[4] = (float)stopwatch.ElapsedMilliseconds; } } protected void DrawGore() { for (int i = 0; i < 500; i++) { if (Main.gore[i].active && Main.gore[i].type > 0) { this.LoadGore(Main.gore[i].type); Color alpha = Main.gore[i].GetAlpha(Lighting.GetColor((int)((double)Main.gore[i].position.X + (double)Main.goreTexture[Main.gore[i].type].Width * 0.5) / 16, (int)(((double)Main.gore[i].position.Y + (double)Main.goreTexture[Main.gore[i].type].Height * 0.5) / 16.0))); this.spriteBatch.Draw(Main.goreTexture[Main.gore[i].type], new Vector2(Main.gore[i].position.X - Main.screenPosition.X + (float)(Main.goreTexture[Main.gore[i].type].Width / 2), Main.gore[i].position.Y - Main.screenPosition.Y + (float)(Main.goreTexture[Main.gore[i].type].Height / 2)), new Rectangle?(new Rectangle(0, 0, Main.goreTexture[Main.gore[i].type].Width, Main.goreTexture[Main.gore[i].type].Height)), alpha, Main.gore[i].rotation, new Vector2((float)(Main.goreTexture[Main.gore[i].type].Width / 2), (float)(Main.goreTexture[Main.gore[i].type].Height / 2)), Main.gore[i].scale, SpriteEffects.None, 0f); } } } protected void DrawHB(float X, float Y, int Health, int MaxHealth, float alpha, float scale = 1f) { if (Health <= 0) { return; } float num = (float)Health / (float)MaxHealth; int num2 = (int)(36f * num); float num3 = X - 18f * scale; float num4 = Y; if (Main.player[Main.myPlayer].gravDir == -1f) { num4 -= Main.screenPosition.Y; num4 = Main.screenPosition.Y + (float)Main.screenHeight - num4; } float num5 = 0f; float num6 = 255f; num -= 0.1f; float num7; float num8; if ((double)num > 0.5) { num7 = 255f; num8 = 255f * (1f - num) * 2f; } else { num7 = 255f * num * 2f; num8 = 255f; } if (num8 < 0f) { num8 = 0f; } if (num8 > 255f) { num8 = 255f; } if (num7 < 0f) { num7 = 0f; } if (num7 > 255f) { num7 = 255f; } float num9 = 0.95f; num8 = num8 * alpha * num9; num7 = num7 * alpha * num9; num6 = num6 * alpha * num9; Color color = new Color((int)((byte)num8), (int)((byte)num7), (int)((byte)num5), (int)((byte)num6)); if (num2 < 3) { num2 = 3; } if (num2 < 34) { if (num2 < 36) { this.spriteBatch.Draw(Main.hbTexture2, new Vector2(num3 - Main.screenPosition.X + (float)num2 * scale, num4 - Main.screenPosition.Y), new Rectangle?(new Rectangle(2, 0, 2, Main.hbTexture2.Height)), color, 0f, new Vector2(0f, 0f), scale, SpriteEffects.None, 0f); } if (num2 < 34) { this.spriteBatch.Draw(Main.hbTexture2, new Vector2(num3 - Main.screenPosition.X + (float)(num2 + 2) * scale, num4 - Main.screenPosition.Y), new Rectangle?(new Rectangle(num2 + 2, 0, 36 - num2 - 2, Main.hbTexture2.Height)), color, 0f, new Vector2(0f, 0f), scale, SpriteEffects.None, 0f); } if (num2 > 2) { this.spriteBatch.Draw(Main.hbTexture1, new Vector2(num3 - Main.screenPosition.X, num4 - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, num2 - 2, Main.hbTexture1.Height)), color, 0f, new Vector2(0f, 0f), scale, SpriteEffects.None, 0f); } this.spriteBatch.Draw(Main.hbTexture1, new Vector2(num3 - Main.screenPosition.X + (float)(num2 - 2) * scale, num4 - Main.screenPosition.Y), new Rectangle?(new Rectangle(32, 0, 2, Main.hbTexture1.Height)), color, 0f, new Vector2(0f, 0f), scale, SpriteEffects.None, 0f); return; } if (num2 < 36) { this.spriteBatch.Draw(Main.hbTexture2, new Vector2(num3 - Main.screenPosition.X + (float)num2 * scale, num4 - Main.screenPosition.Y), new Rectangle?(new Rectangle(num2, 0, 36 - num2, Main.hbTexture2.Height)), color, 0f, new Vector2(0f, 0f), scale, SpriteEffects.None, 0f); } this.spriteBatch.Draw(Main.hbTexture1, new Vector2(num3 - Main.screenPosition.X, num4 - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, num2, Main.hbTexture1.Height)), color, 0f, new Vector2(0f, 0f), scale, SpriteEffects.None, 0f); } public static float NPCAddHeight(int i) { float num = 0f; if (Main.npc[i].type == 125) { num = 30f; } 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 == 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) { 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; } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } return num * Main.npc[i].scale; } protected void DrawNPCs(bool behindTiles = false) { bool flag = false; Rectangle rectangle = new Rectangle((int)Main.screenPosition.X - 300, (int)Main.screenPosition.Y - 300, Main.screenWidth + 600, Main.screenHeight + 600); for (int i = 199; i >= 0; i--) { try { if (Main.npc[i].active && Main.npc[i].type > 0 && Main.npc[i].type < 301) { this.LoadNPC(Main.npc[i].type); if (Main.npc[i].behindTiles == behindTiles) { if (Main.npc[i].setFrameSize) { Main.npc[i].frame = new Rectangle(0, 0, Main.npcTexture[Main.npc[i].type].Width, Main.npcTexture[Main.npc[i].type].Height / Main.npcFrameCount[Main.npc[i].type]); Main.npc[i].setFrameSize = false; } if (Main.npc[i].type == 125 || Main.npc[i].type == 126) { if (!flag) { flag = true; for (int j = 0; j < 200; j++) { if (Main.npc[j].active && i != j && (Main.npc[j].type == 125 || Main.npc[j].type == 126)) { float num = Main.npc[j].position.X + (float)Main.npc[j].width * 0.5f; float num2 = Main.npc[j].position.Y + (float)Main.npc[j].height * 0.5f; Vector2 vector = new Vector2(Main.npc[i].position.X + (float)Main.npc[i].width * 0.5f, Main.npc[i].position.Y + (float)Main.npc[i].height * 0.5f); float num3 = num - vector.X; float num4 = num2 - vector.Y; float rotation = (float)Math.Atan2((double)num4, (double)num3) - 1.57f; bool flag2 = true; float num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); if (num5 > 2000f) { flag2 = false; } while (flag2) { num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); if (num5 < 40f) { flag2 = false; } else { num5 = (float)Main.chain12Texture.Height / num5; num3 *= num5; num4 *= num5; vector.X += num3; vector.Y += num4; num3 = num - vector.X; num4 = num2 - vector.Y; Color color = Lighting.GetColor((int)vector.X / 16, (int)(vector.Y / 16f)); this.spriteBatch.Draw(Main.chain12Texture, new Vector2(vector.X - Main.screenPosition.X, vector.Y - Main.screenPosition.Y), new Rectangle?(new 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, 0f); } } } } } } else { if (Main.npc[i].type == 263 && Main.npc[i].aiStyle == 52 && NPC.plantBoss >= 0) { Vector2 vector2 = new Vector2(Main.npc[i].position.X + (float)(Main.npc[i].width / 2), Main.npc[i].position.Y + (float)(Main.npc[i].height / 2)); float num6 = Main.npc[NPC.plantBoss].center().X - vector2.X; float num7 = Main.npc[NPC.plantBoss].center().Y - vector2.Y; float rotation2 = (float)Math.Atan2((double)num7, (double)num6) - 1.57f; bool flag3 = true; while (flag3) { int num8 = 16; int num9 = 32; float num10 = (float)Math.Sqrt((double)(num6 * num6 + num7 * num7)); if (num10 < (float)num9) { num8 = (int)num10 - num9 + num8; flag3 = false; } num10 = (float)num8 / num10; num6 *= num10; num7 *= num10; vector2.X += num6; vector2.Y += num7; num6 = Main.npc[NPC.plantBoss].center().X - vector2.X; num7 = Main.npc[NPC.plantBoss].center().Y - vector2.Y; Color color2 = Lighting.GetColor((int)vector2.X / 16, (int)(vector2.Y / 16f)); this.spriteBatch.Draw(Main.chain26Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chain26Texture.Width, num8)), color2, rotation2, new Vector2((float)Main.chain26Texture.Width * 0.5f, (float)Main.chain26Texture.Height * 0.5f), 1f, SpriteEffects.None, 0f); } } else { if (Main.npc[i].type == 264 && Main.npc[i].aiStyle == 53 && NPC.plantBoss >= 0) { int plantBoss = NPC.plantBoss; Vector2 vector3 = new Vector2(Main.npc[i].position.X + (float)(Main.npc[i].width / 2), Main.npc[i].position.Y + (float)(Main.npc[i].height / 2)); float num11 = Main.npc[plantBoss].center().X - vector3.X; float num12 = Main.npc[plantBoss].center().Y - vector3.Y; float rotation3 = (float)Math.Atan2((double)num12, (double)num11) - 1.57f; bool flag4 = true; while (flag4) { int num13 = 16; int num14 = 32; float num15 = (float)Math.Sqrt((double)(num11 * num11 + num12 * num12)); if (num15 < (float)num14) { num13 = (int)num15 - num14 + num13; flag4 = false; } num15 = (float)num13 / num15; num11 *= num15; num12 *= num15; vector3.X += num11; vector3.Y += num12; num11 = Main.npc[plantBoss].center().X - vector3.X; num12 = Main.npc[plantBoss].center().Y - vector3.Y; Color color3 = Lighting.GetColor((int)vector3.X / 16, (int)(vector3.Y / 16f)); this.spriteBatch.Draw(Main.chain27Texture, new Vector2(vector3.X - Main.screenPosition.X, vector3.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chain27Texture.Width, num13)), color3, rotation3, new Vector2((float)Main.chain27Texture.Width * 0.5f, (float)Main.chain27Texture.Height * 0.5f), 1f, SpriteEffects.None, 0f); } } } } if (rectangle.Intersects(new Rectangle((int)Main.npc[i].position.X, (int)Main.npc[i].position.Y, Main.npc[i].width, Main.npc[i].height))) { if (Main.npc[i].type == 101) { bool flag5 = true; Vector2 vector4 = new Vector2(Main.npc[i].position.X + (float)(Main.npc[i].width / 2), Main.npc[i].position.Y + (float)(Main.npc[i].height / 2)); float num16 = Main.npc[i].ai[0] * 16f + 8f - vector4.X; float num17 = Main.npc[i].ai[1] * 16f + 8f - vector4.Y; float rotation4 = (float)Math.Atan2((double)num17, (double)num16) - 1.57f; bool flag6 = true; while (flag6) { float num18 = 0.75f; int height = 28; float num19 = (float)Math.Sqrt((double)(num16 * num16 + num17 * num17)); if (num19 < 28f * num18) { height = (int)num19 - 40 + 28; flag6 = false; } num19 = 20f * num18 / num19; num16 *= num19; num17 *= num19; vector4.X += num16; vector4.Y += num17; num16 = Main.npc[i].ai[0] * 16f + 8f - vector4.X; num17 = Main.npc[i].ai[1] * 16f + 8f - vector4.Y; Color color4 = Lighting.GetColor((int)vector4.X / 16, (int)(vector4.Y / 16f)); if (!flag5) { flag5 = true; this.spriteBatch.Draw(Main.chain10Texture, new Vector2(vector4.X - Main.screenPosition.X, vector4.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chain10Texture.Width, height)), color4, rotation4, new Vector2((float)Main.chain10Texture.Width * 0.5f, (float)Main.chain10Texture.Height * 0.5f), num18, SpriteEffects.None, 0f); } else { flag5 = false; this.spriteBatch.Draw(Main.chain11Texture, new Vector2(vector4.X - Main.screenPosition.X, vector4.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chain10Texture.Width, height)), color4, rotation4, new Vector2((float)Main.chain10Texture.Width * 0.5f, (float)Main.chain10Texture.Height * 0.5f), num18, SpriteEffects.None, 0f); } } } else { if (Main.npc[i].aiStyle == 13) { Vector2 vector5 = new Vector2(Main.npc[i].position.X + (float)(Main.npc[i].width / 2), Main.npc[i].position.Y + (float)(Main.npc[i].height / 2)); float num20 = Main.npc[i].ai[0] * 16f + 8f - vector5.X; float num21 = Main.npc[i].ai[1] * 16f + 8f - vector5.Y; float rotation5 = (float)Math.Atan2((double)num21, (double)num20) - 1.57f; bool flag7 = true; while (flag7) { int num22 = 28; int num23 = 40; if (Main.npc[i].type == 259 || Main.npc[i].type == 260) { num23 = 20; num22 = 12; } float num24 = (float)Math.Sqrt((double)(num20 * num20 + num21 * num21)); if (num24 < (float)num23) { num22 = (int)num24 - num23 + num22; flag7 = false; } num24 = (float)num22 / num24; num20 *= num24; num21 *= num24; vector5.X += num20; vector5.Y += num21; num20 = Main.npc[i].ai[0] * 16f + 8f - vector5.X; num21 = Main.npc[i].ai[1] * 16f + 8f - vector5.Y; Color color5 = Lighting.GetColor((int)vector5.X / 16, (int)(vector5.Y / 16f)); if (Main.npc[i].type == 259 || Main.npc[i].type == 260) { color5.B = 255; if (color5.R < 100) { color5.R = 100; } if (color5.G < 150) { color5.G = 150; } } if (Main.npc[i].type == 56) { this.spriteBatch.Draw(Main.chain5Texture, new Vector2(vector5.X - Main.screenPosition.X, vector5.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chain4Texture.Width, num22)), color5, rotation5, new Vector2((float)Main.chain4Texture.Width * 0.5f, (float)Main.chain4Texture.Height * 0.5f), 1f, SpriteEffects.None, 0f); } else { if (Main.npc[i].type == 175) { this.spriteBatch.Draw(Main.chain14Texture, new Vector2(vector5.X - Main.screenPosition.X, vector5.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chain14Texture.Width, num22)), color5, rotation5, new Vector2((float)Main.chain14Texture.Width * 0.5f, (float)Main.chain14Texture.Height * 0.5f), 1f, SpriteEffects.None, 0f); } else { if (Main.npc[i].type == 259) { this.spriteBatch.Draw(Main.chain24Texture, new Vector2(vector5.X - Main.screenPosition.X, vector5.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chain24Texture.Width, num22)), color5, rotation5, new Vector2((float)Main.chain24Texture.Width * 0.5f, (float)Main.chain24Texture.Height * 0.5f), 1f, SpriteEffects.None, 0f); } else { if (Main.npc[i].type == 260) { this.spriteBatch.Draw(Main.chain25Texture, new Vector2(vector5.X - Main.screenPosition.X, vector5.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chain25Texture.Width, num22)), color5, rotation5, new Vector2((float)Main.chain25Texture.Width * 0.5f, (float)Main.chain25Texture.Height * 0.5f), 1f, SpriteEffects.None, 0f); } else { this.spriteBatch.Draw(Main.chain4Texture, new Vector2(vector5.X - Main.screenPosition.X, vector5.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chain4Texture.Width, num22)), color5, rotation5, new Vector2((float)Main.chain4Texture.Width * 0.5f, (float)Main.chain4Texture.Height * 0.5f), 1f, SpriteEffects.None, 0f); } } } } } } } if (Main.npc[i].type == 36) { Vector2 vector6 = new Vector2(Main.npc[i].position.X + (float)Main.npc[i].width * 0.5f - 5f * Main.npc[i].ai[0], Main.npc[i].position.Y + 20f); for (int k = 0; k < 2; k++) { float num25 = Main.npc[(int)Main.npc[i].ai[1]].position.X + (float)(Main.npc[(int)Main.npc[i].ai[1]].width / 2) - vector6.X; float num26 = Main.npc[(int)Main.npc[i].ai[1]].position.Y + (float)(Main.npc[(int)Main.npc[i].ai[1]].height / 2) - vector6.Y; float num27; if (k == 0) { num25 -= 200f * Main.npc[i].ai[0]; num26 += 130f; num27 = (float)Math.Sqrt((double)(num25 * num25 + num26 * num26)); num27 = 92f / num27; vector6.X += num25 * num27; vector6.Y += num26 * num27; } else { num25 -= 50f * Main.npc[i].ai[0]; num26 += 80f; num27 = (float)Math.Sqrt((double)(num25 * num25 + num26 * num26)); num27 = 60f / num27; vector6.X += num25 * num27; vector6.Y += num26 * num27; } float rotation6 = (float)Math.Atan2((double)num26, (double)num25) - 1.57f; Color color6 = Lighting.GetColor((int)vector6.X / 16, (int)(vector6.Y / 16f)); this.spriteBatch.Draw(Main.boneArmTexture, new Vector2(vector6.X - Main.screenPosition.X, vector6.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.boneArmTexture.Width, Main.boneArmTexture.Height)), color6, rotation6, new Vector2((float)Main.boneArmTexture.Width * 0.5f, (float)Main.boneArmTexture.Height * 0.5f), 1f, SpriteEffects.None, 0f); if (k == 0) { vector6.X += num25 * num27 / 2f; vector6.Y += num26 * num27 / 2f; } else { if (base.IsActive) { vector6.X += num25 * num27 - 16f; vector6.Y += num26 * num27 - 6f; int num28 = Dust.NewDust(new Vector2(vector6.X, vector6.Y), 30, 10, 5, num25 * 0.02f, num26 * 0.02f, 0, default(Color), 2f); Main.dust[num28].noGravity = true; } } } } if (Main.npc[i].aiStyle == 47) { Vector2 vector7 = new Vector2(Main.npc[i].center().X, Main.npc[i].center().Y); float num29 = Main.npc[NPC.golemBoss].center().X - vector7.X; float num30 = Main.npc[NPC.golemBoss].center().Y - vector7.Y; num30 -= 7f; if (Main.npc[i].type == 247) { num29 -= 70f; } else { num29 += 66f; } float rotation7 = (float)Math.Atan2((double)num30, (double)num29) - 1.57f; bool flag8 = true; while (flag8) { float num31 = (float)Math.Sqrt((double)(num29 * num29 + num30 * num30)); if (num31 < 16f) { flag8 = false; } else { num31 = 16f / num31; num29 *= num31; num30 *= num31; vector7.X += num29; vector7.Y += num30; num29 = Main.npc[NPC.golemBoss].center().X - vector7.X; num30 = Main.npc[NPC.golemBoss].center().Y - vector7.Y; num30 -= 7f; if (Main.npc[i].type == 247) { num29 -= 70f; } else { num29 += 66f; } Color color7 = Lighting.GetColor((int)vector7.X / 16, (int)(vector7.Y / 16f)); this.spriteBatch.Draw(Main.chain21Texture, new Vector2(vector7.X - Main.screenPosition.X, vector7.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chain21Texture.Width, Main.chain21Texture.Height)), color7, rotation7, new Vector2((float)Main.chain21Texture.Width * 0.5f, (float)Main.chain21Texture.Height * 0.5f), 1f, SpriteEffects.None, 0f); } } } if (Main.npc[i].aiStyle >= 33 && Main.npc[i].aiStyle <= 36) { Vector2 vector8 = new Vector2(Main.npc[i].position.X + (float)Main.npc[i].width * 0.5f - 5f * Main.npc[i].ai[0], Main.npc[i].position.Y + 20f); for (int l = 0; l < 2; l++) { float num32 = Main.npc[(int)Main.npc[i].ai[1]].position.X + (float)(Main.npc[(int)Main.npc[i].ai[1]].width / 2) - vector8.X; float num33 = Main.npc[(int)Main.npc[i].ai[1]].position.Y + (float)(Main.npc[(int)Main.npc[i].ai[1]].height / 2) - vector8.Y; float num34; if (l == 0) { num32 -= 200f * Main.npc[i].ai[0]; num33 += 130f; num34 = (float)Math.Sqrt((double)(num32 * num32 + num33 * num33)); num34 = 92f / num34; vector8.X += num32 * num34; vector8.Y += num33 * num34; } else { num32 -= 50f * Main.npc[i].ai[0]; num33 += 80f; num34 = (float)Math.Sqrt((double)(num32 * num32 + num33 * num33)); num34 = 60f / num34; vector8.X += num32 * num34; vector8.Y += num33 * num34; } float rotation8 = (float)Math.Atan2((double)num33, (double)num32) - 1.57f; Color color8 = Lighting.GetColor((int)vector8.X / 16, (int)(vector8.Y / 16f)); this.spriteBatch.Draw(Main.boneArm2Texture, new Vector2(vector8.X - Main.screenPosition.X, vector8.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.boneArmTexture.Width, Main.boneArmTexture.Height)), color8, rotation8, new Vector2((float)Main.boneArmTexture.Width * 0.5f, (float)Main.boneArmTexture.Height * 0.5f), 1f, SpriteEffects.None, 0f); if (l == 0) { vector8.X += num32 * num34 / 2f; vector8.Y += num33 * num34 / 2f; } else { if (base.IsActive) { vector8.X += num32 * num34 - 16f; vector8.Y += num33 * num34 - 6f; int num35 = Dust.NewDust(new Vector2(vector8.X, vector8.Y), 30, 10, 6, num32 * 0.02f, num33 * 0.02f, 0, default(Color), 2.5f); Main.dust[num35].noGravity = true; } } } } if (Main.npc[i].aiStyle == 20) { Vector2 vector9 = new Vector2(Main.npc[i].position.X + (float)(Main.npc[i].width / 2), Main.npc[i].position.Y + (float)(Main.npc[i].height / 2)); float num36 = Main.npc[i].ai[1] - vector9.X; float num37 = Main.npc[i].ai[2] - vector9.Y; float num38 = (float)Math.Atan2((double)num37, (double)num36) - 1.57f; Main.npc[i].rotation = num38; bool flag9 = true; while (flag9) { int height2 = 12; float num39 = (float)Math.Sqrt((double)(num36 * num36 + num37 * num37)); if (num39 < 20f) { height2 = (int)num39 - 20 + 12; flag9 = false; } num39 = 12f / num39; num36 *= num39; num37 *= num39; vector9.X += num36; vector9.Y += num37; num36 = Main.npc[i].ai[1] - vector9.X; num37 = Main.npc[i].ai[2] - vector9.Y; Color color9 = Lighting.GetColor((int)vector9.X / 16, (int)(vector9.Y / 16f)); this.spriteBatch.Draw(Main.chainTexture, new Vector2(vector9.X - Main.screenPosition.X, vector9.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chainTexture.Width, height2)), color9, num38, new Vector2((float)Main.chainTexture.Width * 0.5f, (float)Main.chainTexture.Height * 0.5f), 1f, SpriteEffects.None, 0f); } this.spriteBatch.Draw(Main.spikeBaseTexture, new Vector2(Main.npc[i].ai[1] - Main.screenPosition.X, Main.npc[i].ai[2] - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.spikeBaseTexture.Width, Main.spikeBaseTexture.Height)), Lighting.GetColor((int)Main.npc[i].ai[1] / 16, (int)(Main.npc[i].ai[2] / 16f)), num38 - 0.75f, new Vector2((float)Main.spikeBaseTexture.Width * 0.5f, (float)Main.spikeBaseTexture.Height * 0.5f), 1f, SpriteEffects.None, 0f); } Color color10 = Lighting.GetColor((int)((double)Main.npc[i].position.X + (double)Main.npc[i].width * 0.5) / 16, (int)(((double)Main.npc[i].position.Y + (double)Main.npc[i].height * 0.5) / 16.0)); if (Main.npc[i].type >= 277 && Main.npc[i].type <= 280) { if (color10.R < 255) { color10.R = 255; } if (color10.G < 175) { color10.G = 175; } } if (behindTiles && Main.npc[i].type != 113 && Main.npc[i].type != 114) { int num40 = (int)((Main.npc[i].position.X - 8f) / 16f); int num41 = (int)((Main.npc[i].position.X + (float)Main.npc[i].width + 8f) / 16f); int num42 = (int)((Main.npc[i].position.Y - 8f) / 16f); int num43 = (int)((Main.npc[i].position.Y + (float)Main.npc[i].height + 8f) / 16f); for (int m = num40; m <= num41; m++) { for (int n = num42; n <= num43; n++) { if (Lighting.Brightness(m, n) == 0f) { color10 = Color.Black; } } } } float num44 = 1f; float num45 = 1f; float num46 = 1f; float num47 = 1f; if (Main.npc[i].poisoned) { if (Main.rand.Next(30) == 0) { int num48 = Dust.NewDust(Main.npc[i].position, Main.npc[i].width, Main.npc[i].height, 46, 0f, 0f, 120, default(Color), 0.2f); Main.dust[num48].noGravity = true; Main.dust[num48].fadeIn = 1.9f; } num44 *= 0.65f; num46 *= 0.75f; color10 = Main.buffColor(color10, num44, num45, num46, num47); } if (Main.npc[i].venom) { if (Main.rand.Next(10) == 0) { int num49 = Dust.NewDust(Main.npc[i].position, Main.npc[i].width, Main.npc[i].height, 171, 0f, 0f, 100, default(Color), 0.5f); Main.dust[num49].noGravity = true; Main.dust[num49].fadeIn = 1.5f; } num45 *= 0.45f; num44 *= 0.75f; color10 = Main.buffColor(color10, num44, num45, num46, num47); } if (Main.npc[i].midas) { num46 *= 0.3f; num44 *= 0.85f; color10 = Main.buffColor(color10, num44, num45, num46, num47); } if (Main.npc[i].onFire) { if (Main.rand.Next(4) < 3) { int num50 = Dust.NewDust(new Vector2(Main.npc[i].position.X - 2f, Main.npc[i].position.Y - 2f), Main.npc[i].width + 4, Main.npc[i].height + 4, 6, Main.npc[i].velocity.X * 0.4f, Main.npc[i].velocity.Y * 0.4f, 100, default(Color), 3.5f); Main.dust[num50].noGravity = true; Main.dust[num50].velocity *= 1.8f; Dust expr_20BD_cp_0 = Main.dust[num50]; expr_20BD_cp_0.velocity.Y = expr_20BD_cp_0.velocity.Y - 0.5f; if (Main.rand.Next(4) == 0) { Main.dust[num50].noGravity = false; Main.dust[num50].scale *= 0.5f; } } Lighting.addLight((int)(Main.npc[i].position.X / 16f), (int)(Main.npc[i].position.Y / 16f + 1f), 1f, 0.3f, 0.1f); } if (Main.npc[i].ichor) { color10 = new Color(255, 255, 0, 255); } if (Main.npc[i].onFrostBurn) { if (Main.rand.Next(4) < 3) { int num51 = Dust.NewDust(new Vector2(Main.npc[i].position.X - 2f, Main.npc[i].position.Y - 2f), Main.npc[i].width + 4, Main.npc[i].height + 4, 135, Main.npc[i].velocity.X * 0.4f, Main.npc[i].velocity.Y * 0.4f, 100, default(Color), 3.5f); Main.dust[num51].noGravity = true; Main.dust[num51].velocity *= 1.8f; Dust expr_2265_cp_0 = Main.dust[num51]; expr_2265_cp_0.velocity.Y = expr_2265_cp_0.velocity.Y - 0.5f; if (Main.rand.Next(4) == 0) { Main.dust[num51].noGravity = false; Main.dust[num51].scale *= 0.5f; } } Lighting.addLight((int)(Main.npc[i].position.X / 16f), (int)(Main.npc[i].position.Y / 16f + 1f), 0.1f, 0.6f, 1f); } if (Main.npc[i].onFire2) { if (Main.rand.Next(4) < 3) { int num52 = Dust.NewDust(new Vector2(Main.npc[i].position.X - 2f, Main.npc[i].position.Y - 2f), Main.npc[i].width + 4, Main.npc[i].height + 4, 75, Main.npc[i].velocity.X * 0.4f, Main.npc[i].velocity.Y * 0.4f, 100, default(Color), 3.5f); Main.dust[num52].noGravity = true; Main.dust[num52].velocity *= 1.8f; Dust expr_23E5_cp_0 = Main.dust[num52]; expr_23E5_cp_0.velocity.Y = expr_23E5_cp_0.velocity.Y - 0.5f; if (Main.rand.Next(4) == 0) { Main.dust[num52].noGravity = false; Main.dust[num52].scale *= 0.5f; } } Lighting.addLight((int)(Main.npc[i].position.X / 16f), (int)(Main.npc[i].position.Y / 16f + 1f), 1f, 0.3f, 0.1f); } if (Main.player[Main.myPlayer].detectCreature && Main.npc[i].lifeMax > 1) { if (color10.R < 150) { color10.A = Main.mouseTextColor; } if (color10.R < 50) { color10.R = 50; } if (color10.G < 200) { color10.G = 200; } if (color10.B < 100) { color10.B = 100; } if (!Main.gamePaused && base.IsActive && Main.rand.Next(50) == 0) { int num53 = Dust.NewDust(new Vector2(Main.npc[i].position.X, Main.npc[i].position.Y), Main.npc[i].width, Main.npc[i].height, 15, 0f, 0f, 150, default(Color), 0.8f); Main.dust[num53].velocity *= 0.1f; Main.dust[num53].noLight = true; } } if (Main.npc[i].type == 50) { Vector2 vector10 = default(Vector2); float num54 = 0f; vector10.Y -= Main.npc[i].velocity.Y; vector10.X -= Main.npc[i].velocity.X * 2f; num54 += Main.npc[i].velocity.X * 0.05f; if (Main.npc[i].frame.Y == 120) { vector10.Y += 2f; } if (Main.npc[i].frame.Y == 360) { vector10.Y -= 2f; } if (Main.npc[i].frame.Y == 480) { vector10.Y -= 6f; } this.spriteBatch.Draw(Main.ninjaTexture, new Vector2(Main.npc[i].position.X - Main.screenPosition.X + (float)(Main.npc[i].width / 2) + vector10.X, Main.npc[i].position.Y - Main.screenPosition.Y + (float)(Main.npc[i].height / 2) + vector10.Y), new Rectangle?(new Rectangle(0, 0, Main.ninjaTexture.Width, Main.ninjaTexture.Height)), color10, num54, new Vector2((float)(Main.ninjaTexture.Width / 2), (float)(Main.ninjaTexture.Height / 2)), 1f, SpriteEffects.None, 0f); } if (Main.npc[i].type == 71) { Vector2 vector11 = default(Vector2); float num55 = 0f; vector11.Y -= Main.npc[i].velocity.Y * 0.3f; vector11.X -= Main.npc[i].velocity.X * 0.6f; num55 += Main.npc[i].velocity.X * 0.09f; if (Main.npc[i].frame.Y == 120) { vector11.Y += 2f; } if (Main.npc[i].frame.Y == 360) { vector11.Y -= 2f; } if (Main.npc[i].frame.Y == 480) { vector11.Y -= 6f; } this.spriteBatch.Draw(Main.itemTexture[327], new Vector2(Main.npc[i].position.X - Main.screenPosition.X + (float)(Main.npc[i].width / 2) + vector11.X, Main.npc[i].position.Y - Main.screenPosition.Y + (float)(Main.npc[i].height / 2) + vector11.Y), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[327].Width, Main.itemTexture[327].Height)), color10, num55, new Vector2((float)(Main.itemTexture[327].Width / 2), (float)(Main.itemTexture[327].Height / 2)), 1f, SpriteEffects.None, 0f); } if (Main.npc[i].type == 69) { this.spriteBatch.Draw(Main.antLionTexture, new Vector2(Main.npc[i].position.X - Main.screenPosition.X + (float)(Main.npc[i].width / 2), Main.npc[i].position.Y - Main.screenPosition.Y + (float)Main.npc[i].height + 14f), new Rectangle?(new Rectangle(0, 0, Main.antLionTexture.Width, Main.antLionTexture.Height)), color10, -Main.npc[i].rotation * 0.3f, new Vector2((float)(Main.antLionTexture.Width / 2), (float)(Main.antLionTexture.Height / 2)), 1f, SpriteEffects.None, 0f); } float num56 = 0f; float num57 = Main.NPCAddHeight(i); Vector2 origin = new Vector2((float)(Main.npcTexture[Main.npc[i].type].Width / 2), (float)(Main.npcTexture[Main.npc[i].type].Height / Main.npcFrameCount[Main.npc[i].type] / 2)); if (Main.npc[i].type == 108 || Main.npc[i].type == 124) { num56 = 2f; } if (Main.npc[i].type == 4) { origin = new Vector2(55f, 107f); } else { if (Main.npc[i].type == 125) { origin = new Vector2(55f, 107f); } else { if (Main.npc[i].type == 126) { origin = new Vector2(55f, 107f); } else { if (Main.npc[i].type == 63 || Main.npc[i].type == 64 || Main.npc[i].type == 103) { origin.Y += 4f; } else { if (Main.npc[i].type == 69) { origin.Y += 8f; } else { if (Main.npc[i].type == 262) { origin.Y = 77f; num57 += 26f; } else { if (Main.npc[i].type == 264) { origin.Y = 21f; num57 += 2f; } else { if (Main.npc[i].type == 266) { num57 += 50f; } else { if (Main.npc[i].type == 268) { num57 += 16f; } else { if (Main.npc[i].type == 288) { num57 += 6f; } } } } } } } } } } if (Main.npc[i].aiStyle == 10 || Main.npc[i].type == 72) { color10 = Color.White; } SpriteEffects effects = SpriteEffects.None; if (Main.npc[i].spriteDirection == 1) { effects = SpriteEffects.FlipHorizontally; } if (Main.npc[i].type == 83 || Main.npc[i].type == 84 || Main.npc[i].type == 179) { this.spriteBatch.Draw(Main.npcTexture[Main.npc[i].type], new Vector2(Main.npc[i].position.X - Main.screenPosition.X + (float)(Main.npc[i].width / 2) - (float)Main.npcTexture[Main.npc[i].type].Width * Main.npc[i].scale / 2f + origin.X * Main.npc[i].scale, Main.npc[i].position.Y - Main.screenPosition.Y + (float)Main.npc[i].height - (float)Main.npcTexture[Main.npc[i].type].Height * Main.npc[i].scale / (float)Main.npcFrameCount[Main.npc[i].type] + 4f + origin.Y * Main.npc[i].scale + num57 + num56), new Rectangle?(Main.npc[i].frame), Color.White, Main.npc[i].rotation, origin, Main.npc[i].scale, effects, 0f); } else { if (Main.npc[i].type >= 87 && Main.npc[i].type <= 92) { Color alpha = Main.npc[i].GetAlpha(color10); byte b = (byte)((Main.tileColor.R + Main.tileColor.G + Main.tileColor.B) / 3); if (alpha.R < b) { alpha.R = b; } if (alpha.G < b) { alpha.G = b; } if (alpha.B < b) { alpha.B = b; } this.spriteBatch.Draw(Main.npcTexture[Main.npc[i].type], new Vector2(Main.npc[i].position.X - Main.screenPosition.X + (float)(Main.npc[i].width / 2) - (float)Main.npcTexture[Main.npc[i].type].Width * Main.npc[i].scale / 2f + origin.X * Main.npc[i].scale, Main.npc[i].position.Y - Main.screenPosition.Y + (float)Main.npc[i].height - (float)Main.npcTexture[Main.npc[i].type].Height * Main.npc[i].scale / (float)Main.npcFrameCount[Main.npc[i].type] + 4f + origin.Y * Main.npc[i].scale + num57 + num56), new Rectangle?(Main.npc[i].frame), alpha, Main.npc[i].rotation, origin, Main.npc[i].scale, effects, 0f); } else { if (Main.npc[i].type == 94) { for (int num58 = 1; num58 < 6; num58 += 2) { Vector2 arg_303D_0 = Main.npc[i].oldPos[num58]; Color alpha2 = Main.npc[i].GetAlpha(color10); alpha2.R = (byte)((int)alpha2.R * (10 - num58) / 15); alpha2.G = (byte)((int)alpha2.G * (10 - num58) / 15); alpha2.B = (byte)((int)alpha2.B * (10 - num58) / 15); alpha2.A = (byte)((int)alpha2.A * (10 - num58) / 15); this.spriteBatch.Draw(Main.npcTexture[Main.npc[i].type], new Vector2(Main.npc[i].oldPos[num58].X - Main.screenPosition.X + (float)(Main.npc[i].width / 2) - (float)Main.npcTexture[Main.npc[i].type].Width * Main.npc[i].scale / 2f + origin.X * Main.npc[i].scale, Main.npc[i].oldPos[num58].Y - Main.screenPosition.Y + (float)Main.npc[i].height - (float)Main.npcTexture[Main.npc[i].type].Height * Main.npc[i].scale / (float)Main.npcFrameCount[Main.npc[i].type] + 4f + origin.Y * Main.npc[i].scale + num57), new Rectangle?(Main.npc[i].frame), alpha2, Main.npc[i].rotation, origin, Main.npc[i].scale, effects, 0f); } } if (Main.npc[i].type == 125 || Main.npc[i].type == 126 || Main.npc[i].type == 127 || Main.npc[i].type == 128 || Main.npc[i].type == 129 || Main.npc[i].type == 130 || Main.npc[i].type == 131 || Main.npc[i].type == 139 || Main.npc[i].type == 140) { for (int num59 = 9; num59 >= 0; num59 -= 2) { Vector2 arg_32DB_0 = Main.npc[i].oldPos[num59]; Color alpha3 = Main.npc[i].GetAlpha(color10); alpha3.R = (byte)((int)alpha3.R * (10 - num59) / 20); alpha3.G = (byte)((int)alpha3.G * (10 - num59) / 20); alpha3.B = (byte)((int)alpha3.B * (10 - num59) / 20); alpha3.A = (byte)((int)alpha3.A * (10 - num59) / 20); this.spriteBatch.Draw(Main.npcTexture[Main.npc[i].type], new Vector2(Main.npc[i].oldPos[num59].X - Main.screenPosition.X + (float)(Main.npc[i].width / 2) - (float)Main.npcTexture[Main.npc[i].type].Width * Main.npc[i].scale / 2f + origin.X * Main.npc[i].scale, Main.npc[i].oldPos[num59].Y - Main.screenPosition.Y + (float)Main.npc[i].height - (float)Main.npcTexture[Main.npc[i].type].Height * Main.npc[i].scale / (float)Main.npcFrameCount[Main.npc[i].type] + 4f + origin.Y * Main.npc[i].scale + num57), new Rectangle?(Main.npc[i].frame), alpha3, Main.npc[i].rotation, origin, Main.npc[i].scale, effects, 0f); } } Rectangle frame = Main.npc[i].frame; if (Main.npc[i].type == 182 || Main.npc[i].type == 289) { frame.Height -= 2; } this.spriteBatch.Draw(Main.npcTexture[Main.npc[i].type], new Vector2(Main.npc[i].position.X - Main.screenPosition.X + (float)(Main.npc[i].width / 2) - (float)Main.npcTexture[Main.npc[i].type].Width * Main.npc[i].scale / 2f + origin.X * Main.npc[i].scale, Main.npc[i].position.Y - Main.screenPosition.Y + (float)Main.npc[i].height - (float)Main.npcTexture[Main.npc[i].type].Height * Main.npc[i].scale / (float)Main.npcFrameCount[Main.npc[i].type] + 4f + origin.Y * Main.npc[i].scale + num57 + num56 + Main.npc[i].gfxOffY), new Rectangle?(frame), Main.npc[i].GetAlpha(color10), Main.npc[i].rotation, origin, Main.npc[i].scale, effects, 0f); if (Main.npc[i].color != default(Color)) { this.spriteBatch.Draw(Main.npcTexture[Main.npc[i].type], new Vector2(Main.npc[i].position.X - Main.screenPosition.X + (float)(Main.npc[i].width / 2) - (float)Main.npcTexture[Main.npc[i].type].Width * Main.npc[i].scale / 2f + origin.X * Main.npc[i].scale, Main.npc[i].position.Y - Main.screenPosition.Y + (float)Main.npc[i].height - (float)Main.npcTexture[Main.npc[i].type].Height * Main.npc[i].scale / (float)Main.npcFrameCount[Main.npc[i].type] + 4f + origin.Y * Main.npc[i].scale + num57 + num56 + Main.npc[i].gfxOffY), new Rectangle?(frame), Main.npc[i].GetColor(color10), Main.npc[i].rotation, origin, Main.npc[i].scale, effects, 0f); } if (Main.npc[i].confused) { this.spriteBatch.Draw(Main.confuseTexture, new Vector2(Main.npc[i].position.X - Main.screenPosition.X + (float)(Main.npc[i].width / 2) - (float)Main.npcTexture[Main.npc[i].type].Width * Main.npc[i].scale / 2f + origin.X * Main.npc[i].scale, Main.npc[i].position.Y - Main.screenPosition.Y + (float)Main.npc[i].height - (float)Main.npcTexture[Main.npc[i].type].Height * Main.npc[i].scale / (float)Main.npcFrameCount[Main.npc[i].type] + 4f + origin.Y * Main.npc[i].scale + num57 + num56 - (float)Main.confuseTexture.Height - 20f), new Rectangle?(new Rectangle(0, 0, Main.confuseTexture.Width, Main.confuseTexture.Height)), new Color(250, 250, 250, 70), Main.npc[i].velocity.X * -0.05f, new Vector2((float)(Main.confuseTexture.Width / 2), (float)(Main.confuseTexture.Height / 2)), Main.essScale + 0.2f, SpriteEffects.None, 0f); } if (Main.npc[i].type >= 134 && Main.npc[i].type <= 136 && color10 != Color.Black) { this.spriteBatch.Draw(Main.destTexture[Main.npc[i].type - 134], new Vector2(Main.npc[i].position.X - Main.screenPosition.X + (float)(Main.npc[i].width / 2) - (float)Main.npcTexture[Main.npc[i].type].Width * Main.npc[i].scale / 2f + origin.X * Main.npc[i].scale, Main.npc[i].position.Y - Main.screenPosition.Y + (float)Main.npc[i].height - (float)Main.npcTexture[Main.npc[i].type].Height * Main.npc[i].scale / (float)Main.npcFrameCount[Main.npc[i].type] + 4f + origin.Y * Main.npc[i].scale + num57 + num56), new Rectangle?(Main.npc[i].frame), new Color(255, 255, 255, 0), Main.npc[i].rotation, origin, Main.npc[i].scale, effects, 0f); } if (Main.npc[i].type == 125) { this.spriteBatch.Draw(Main.EyeLaserTexture, new Vector2(Main.npc[i].position.X - Main.screenPosition.X + (float)(Main.npc[i].width / 2) - (float)Main.npcTexture[Main.npc[i].type].Width * Main.npc[i].scale / 2f + origin.X * Main.npc[i].scale, Main.npc[i].position.Y - Main.screenPosition.Y + (float)Main.npc[i].height - (float)Main.npcTexture[Main.npc[i].type].Height * Main.npc[i].scale / (float)Main.npcFrameCount[Main.npc[i].type] + 4f + origin.Y * Main.npc[i].scale + num57 + num56), new Rectangle?(Main.npc[i].frame), new Color(255, 255, 255, 0), Main.npc[i].rotation, origin, Main.npc[i].scale, effects, 0f); } if (Main.npc[i].type == 139) { this.spriteBatch.Draw(Main.probeTexture, new Vector2(Main.npc[i].position.X - Main.screenPosition.X + (float)(Main.npc[i].width / 2) - (float)Main.npcTexture[Main.npc[i].type].Width * Main.npc[i].scale / 2f + origin.X * Main.npc[i].scale, Main.npc[i].position.Y - Main.screenPosition.Y + (float)Main.npc[i].height - (float)Main.npcTexture[Main.npc[i].type].Height * Main.npc[i].scale / (float)Main.npcFrameCount[Main.npc[i].type] + 4f + origin.Y * Main.npc[i].scale + num57 + num56), new Rectangle?(Main.npc[i].frame), new Color(255, 255, 255, 0), Main.npc[i].rotation, origin, Main.npc[i].scale, effects, 0f); } if (Main.npc[i].type == 127) { this.spriteBatch.Draw(Main.BoneEyesTexture, new Vector2(Main.npc[i].position.X - Main.screenPosition.X + (float)(Main.npc[i].width / 2) - (float)Main.npcTexture[Main.npc[i].type].Width * Main.npc[i].scale / 2f + origin.X * Main.npc[i].scale, Main.npc[i].position.Y - Main.screenPosition.Y + (float)Main.npc[i].height - (float)Main.npcTexture[Main.npc[i].type].Height * Main.npc[i].scale / (float)Main.npcFrameCount[Main.npc[i].type] + 4f + origin.Y * Main.npc[i].scale + num57 + num56), new Rectangle?(Main.npc[i].frame), new Color(200, 200, 200, 0), Main.npc[i].rotation, origin, Main.npc[i].scale, effects, 0f); } if (Main.npc[i].type == 131) { this.spriteBatch.Draw(Main.BoneLaserTexture, new Vector2(Main.npc[i].position.X - Main.screenPosition.X + (float)(Main.npc[i].width / 2) - (float)Main.npcTexture[Main.npc[i].type].Width * Main.npc[i].scale / 2f + origin.X * Main.npc[i].scale, Main.npc[i].position.Y - Main.screenPosition.Y + (float)Main.npc[i].height - (float)Main.npcTexture[Main.npc[i].type].Height * Main.npc[i].scale / (float)Main.npcFrameCount[Main.npc[i].type] + 4f + origin.Y * Main.npc[i].scale + num57 + num56), new Rectangle?(Main.npc[i].frame), new Color(200, 200, 200, 0), Main.npc[i].rotation, origin, Main.npc[i].scale, effects, 0f); } if (Main.npc[i].type == 120) { for (int num60 = 1; num60 < Main.npc[i].oldPos.Length; num60++) { Vector2 arg_40C0_0 = Main.npc[i].oldPos[num60]; Color color11 = default(Color); color11.R = (byte)(150 * (10 - num60) / 15); color11.G = (byte)(100 * (10 - num60) / 15); color11.B = (byte)(150 * (10 - num60) / 15); color11.A = (byte)(50 * (10 - num60) / 15); this.spriteBatch.Draw(Main.chaosTexture, new Vector2(Main.npc[i].oldPos[num60].X - Main.screenPosition.X + (float)(Main.npc[i].width / 2) - (float)Main.npcTexture[Main.npc[i].type].Width * Main.npc[i].scale / 2f + origin.X * Main.npc[i].scale, Main.npc[i].oldPos[num60].Y - Main.screenPosition.Y + (float)Main.npc[i].height - (float)Main.npcTexture[Main.npc[i].type].Height * Main.npc[i].scale / (float)Main.npcFrameCount[Main.npc[i].type] + 4f + origin.Y * Main.npc[i].scale + num57), new Rectangle?(Main.npc[i].frame), color11, Main.npc[i].rotation, origin, Main.npc[i].scale, effects, 0f); } } else { if (Main.npc[i].type == 137 || Main.npc[i].type == 138) { for (int num61 = 1; num61 < Main.npc[i].oldPos.Length; num61++) { Vector2 arg_42CA_0 = Main.npc[i].oldPos[num61]; Color color12 = default(Color); color12.R = (byte)(150 * (10 - num61) / 15); color12.G = (byte)(100 * (10 - num61) / 15); color12.B = (byte)(150 * (10 - num61) / 15); color12.A = (byte)(50 * (10 - num61) / 15); this.spriteBatch.Draw(Main.npcTexture[Main.npc[i].type], new Vector2(Main.npc[i].oldPos[num61].X - Main.screenPosition.X + (float)(Main.npc[i].width / 2) - (float)Main.npcTexture[Main.npc[i].type].Width * Main.npc[i].scale / 2f + origin.X * Main.npc[i].scale, Main.npc[i].oldPos[num61].Y - Main.screenPosition.Y + (float)Main.npc[i].height - (float)Main.npcTexture[Main.npc[i].type].Height * Main.npc[i].scale / (float)Main.npcFrameCount[Main.npc[i].type] + 4f + origin.Y * Main.npc[i].scale + num57), new Rectangle?(Main.npc[i].frame), color12, Main.npc[i].rotation, origin, Main.npc[i].scale, effects, 0f); } } else { if (Main.npc[i].type == 82) { this.spriteBatch.Draw(Main.wraithEyeTexture, new Vector2(Main.npc[i].position.X - Main.screenPosition.X + (float)(Main.npc[i].width / 2) - (float)Main.npcTexture[Main.npc[i].type].Width * Main.npc[i].scale / 2f + origin.X * Main.npc[i].scale, Main.npc[i].position.Y - Main.screenPosition.Y + (float)Main.npc[i].height - (float)Main.npcTexture[Main.npc[i].type].Height * Main.npc[i].scale / (float)Main.npcFrameCount[Main.npc[i].type] + 4f + origin.Y * Main.npc[i].scale + num57), new Rectangle?(Main.npc[i].frame), Color.White, Main.npc[i].rotation, origin, Main.npc[i].scale, effects, 0f); for (int num62 = 1; num62 < 10; num62++) { Color color13 = new Color(110 - num62 * 10, 110 - num62 * 10, 110 - num62 * 10, 110 - num62 * 10); this.spriteBatch.Draw(Main.wraithEyeTexture, new Vector2(Main.npc[i].position.X - Main.screenPosition.X + (float)(Main.npc[i].width / 2) - (float)Main.npcTexture[Main.npc[i].type].Width * Main.npc[i].scale / 2f + origin.X * Main.npc[i].scale, Main.npc[i].position.Y - Main.screenPosition.Y + (float)Main.npc[i].height - (float)Main.npcTexture[Main.npc[i].type].Height * Main.npc[i].scale / (float)Main.npcFrameCount[Main.npc[i].type] + 4f + origin.Y * Main.npc[i].scale + num57) - Main.npc[i].velocity * (float)num62 * 0.5f, new Rectangle?(Main.npc[i].frame), color13, Main.npc[i].rotation, origin, Main.npc[i].scale, effects, 0f); } } else { if (Main.npc[i].type == 253) { this.spriteBatch.Draw(Main.reaperEyeTexture, new Vector2(Main.npc[i].position.X - Main.screenPosition.X + (float)(Main.npc[i].width / 2) - (float)Main.npcTexture[Main.npc[i].type].Width * Main.npc[i].scale / 2f + origin.X * Main.npc[i].scale, Main.npc[i].position.Y - Main.screenPosition.Y + (float)Main.npc[i].height - (float)Main.npcTexture[Main.npc[i].type].Height * Main.npc[i].scale / (float)Main.npcFrameCount[Main.npc[i].type] + 3f + origin.Y * Main.npc[i].scale + num57), new Rectangle?(Main.npc[i].frame), Color.White, Main.npc[i].rotation, origin, Main.npc[i].scale, effects, 0f); for (int num63 = 1; num63 < 20; num63++) { Color color14 = new Color(210 - num63 * 20, 210 - num63 * 20, 210 - num63 * 20, 210 - num63 * 20); this.spriteBatch.Draw(Main.reaperEyeTexture, new Vector2(Main.npc[i].position.X - Main.screenPosition.X + (float)(Main.npc[i].width / 2) - (float)Main.npcTexture[Main.npc[i].type].Width * Main.npc[i].scale / 2f + origin.X * Main.npc[i].scale, Main.npc[i].position.Y - Main.screenPosition.Y + (float)Main.npc[i].height - (float)Main.npcTexture[Main.npc[i].type].Height * Main.npc[i].scale / (float)Main.npcFrameCount[Main.npc[i].type] + 3f + origin.Y * Main.npc[i].scale + num57) - Main.npc[i].velocity * (float)num63 * 0.5f, new Rectangle?(Main.npc[i].frame), color14, Main.npc[i].rotation, origin, Main.npc[i].scale, effects, 0f); } } else { if (Main.npc[i].type == 245 && Main.npc[i].alpha == 0) { Color color15 = new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, 0); this.spriteBatch.Draw(Main.golemTexture[3], new Vector2(Main.npc[i].position.X - Main.screenPosition.X + (float)(Main.npc[i].width / 2) - (float)Main.npcTexture[Main.npc[i].type].Width * Main.npc[i].scale / 2f + origin.X * Main.npc[i].scale, Main.npc[i].position.Y - Main.screenPosition.Y + (float)Main.npc[i].height - (float)Main.npcTexture[Main.npc[i].type].Height * Main.npc[i].scale / (float)Main.npcFrameCount[Main.npc[i].type] + 4f + origin.Y * Main.npc[i].scale + num57 + num56 + Main.npc[i].gfxOffY), new Rectangle?(frame), color15, Main.npc[i].rotation, origin, Main.npc[i].scale, effects, 0f); } else { if (Main.npc[i].type == 246) { Color color16 = new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, 0); if (Main.npc[i].frame.Y < 222) { this.spriteBatch.Draw(Main.golemTexture[1], new Vector2(Main.npc[i].center().X - Main.screenPosition.X - 20f, Main.npc[i].center().Y - Main.screenPosition.Y - 27f), new Rectangle?(new Rectangle(0, 0, Main.golemTexture[1].Width, Main.golemTexture[1].Height / 2)), color16, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } else { if (Main.npc[i].frame.Y < 444) { this.spriteBatch.Draw(Main.golemTexture[2], new Vector2(Main.npc[i].center().X - Main.screenPosition.X + 26f, Main.npc[i].center().Y - Main.screenPosition.Y - 28f), new Rectangle?(new Rectangle(0, 0, Main.golemTexture[2].Width, Main.golemTexture[2].Height / 4)), color16, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } else { this.spriteBatch.Draw(Main.golemTexture[2], new Vector2(Main.npc[i].center().X - Main.screenPosition.X - 38f, Main.npc[i].center().Y - Main.screenPosition.Y - 28f), new Rectangle?(new Rectangle(0, Main.golemTexture[2].Height / 2, Main.golemTexture[2].Width, Main.golemTexture[2].Height / 4)), color16, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } } else { if (Main.npc[i].type == 249) { Color color17 = new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, 0); this.spriteBatch.Draw(Main.golemTexture[1], new Vector2(Main.npc[i].center().X - Main.screenPosition.X - 20f, Main.npc[i].center().Y - Main.screenPosition.Y - 47f), new Rectangle?(new Rectangle(0, 0, Main.golemTexture[1].Width, Main.golemTexture[1].Height / 2)), color17, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } } } } } } } } } } } } catch { Main.npc[i].active = false; } } } protected void DrawProj(int i) { this.LoadProjectile(Main.projectile[i].type); if (Main.projectile[i].type == 32) { Vector2 vector = new Vector2(Main.projectile[i].position.X + (float)Main.projectile[i].width * 0.5f, Main.projectile[i].position.Y + (float)Main.projectile[i].height * 0.5f); float num = Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2) - vector.X; float num2 = Main.player[Main.projectile[i].owner].position.Y + (float)(Main.player[Main.projectile[i].owner].height / 2) - vector.Y; float rotation = (float)Math.Atan2((double)num2, (double)num) - 1.57f; bool flag = true; if (num == 0f && num2 == 0f) { flag = false; } else { float num3 = (float)Math.Sqrt((double)(num * num + num2 * num2)); num3 = 8f / num3; num *= num3; num2 *= num3; vector.X -= num; vector.Y -= num2; num = Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2) - vector.X; num2 = Main.player[Main.projectile[i].owner].position.Y + (float)(Main.player[Main.projectile[i].owner].height / 2) - vector.Y; } while (flag) { float num4 = (float)Math.Sqrt((double)(num * num + num2 * num2)); if (num4 < 28f) { flag = false; } else { if (num4 == float.NaN) { flag = false; } else { num4 = 28f / num4; num *= num4; num2 *= num4; vector.X += num; vector.Y += num2; num = Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2) - vector.X; num2 = Main.player[Main.projectile[i].owner].position.Y + (float)(Main.player[Main.projectile[i].owner].height / 2) - vector.Y; Color color = Lighting.GetColor((int)vector.X / 16, (int)(vector.Y / 16f)); this.spriteBatch.Draw(Main.chain5Texture, new Vector2(vector.X - Main.screenPosition.X, vector.Y - Main.screenPosition.Y), new Rectangle?(new 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, 0f); } } } } else { if (Main.projectile[i].type == 73) { Vector2 vector2 = new Vector2(Main.projectile[i].position.X + (float)Main.projectile[i].width * 0.5f, Main.projectile[i].position.Y + (float)Main.projectile[i].height * 0.5f); float num5 = Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2) - vector2.X; float num6 = Main.player[Main.projectile[i].owner].position.Y + (float)(Main.player[Main.projectile[i].owner].height / 2) - vector2.Y; float rotation2 = (float)Math.Atan2((double)num6, (double)num5) - 1.57f; bool flag2 = true; while (flag2) { float num7 = (float)Math.Sqrt((double)(num5 * num5 + num6 * num6)); if (num7 < 25f) { flag2 = false; } else { if (num7 == float.NaN) { flag2 = false; } else { num7 = 12f / num7; num5 *= num7; num6 *= num7; vector2.X += num5; vector2.Y += num6; num5 = Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2) - vector2.X; num6 = Main.player[Main.projectile[i].owner].position.Y + (float)(Main.player[Main.projectile[i].owner].height / 2) - vector2.Y; Color color2 = Lighting.GetColor((int)vector2.X / 16, (int)(vector2.Y / 16f)); this.spriteBatch.Draw(Main.chain8Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chain8Texture.Width, Main.chain8Texture.Height)), color2, rotation2, new Vector2((float)Main.chain8Texture.Width * 0.5f, (float)Main.chain8Texture.Height * 0.5f), 1f, SpriteEffects.None, 0f); } } } } else { if (Main.projectile[i].type == 186) { float num8 = Main.projectile[i].ai[1]; float num9 = Main.projectile[i].position.Y - num8; float num10 = (float)Main.chain17Texture.Height - num9; Color color3 = Lighting.GetColor((int)Main.projectile[i].position.X / 16, (int)Main.projectile[i].position.Y / 16); this.spriteBatch.Draw(Main.chain17Texture, new Vector2(Main.projectile[i].position.X - Main.screenPosition.X, num8 - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, (int)num10, Main.chain17Texture.Width, (int)num9)), color3, 0f, new Vector2(0f, 0f), 1f, SpriteEffects.None, 0f); } else { if (Main.projectile[i].type == 74) { Vector2 vector3 = new Vector2(Main.projectile[i].position.X + (float)Main.projectile[i].width * 0.5f, Main.projectile[i].position.Y + (float)Main.projectile[i].height * 0.5f); float num11 = Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2) - vector3.X; float num12 = Main.player[Main.projectile[i].owner].position.Y + (float)(Main.player[Main.projectile[i].owner].height / 2) - vector3.Y; float rotation3 = (float)Math.Atan2((double)num12, (double)num11) - 1.57f; bool flag3 = true; while (flag3) { float num13 = (float)Math.Sqrt((double)(num11 * num11 + num12 * num12)); if (num13 < 25f) { flag3 = false; } else { if (num13 == float.NaN) { flag3 = false; } else { num13 = 12f / num13; num11 *= num13; num12 *= num13; vector3.X += num11; vector3.Y += num12; num11 = Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2) - vector3.X; num12 = Main.player[Main.projectile[i].owner].position.Y + (float)(Main.player[Main.projectile[i].owner].height / 2) - vector3.Y; Color color4 = Lighting.GetColor((int)vector3.X / 16, (int)(vector3.Y / 16f)); this.spriteBatch.Draw(Main.chain9Texture, new Vector2(vector3.X - Main.screenPosition.X, vector3.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chain8Texture.Width, Main.chain8Texture.Height)), color4, rotation3, new Vector2((float)Main.chain8Texture.Width * 0.5f, (float)Main.chain8Texture.Height * 0.5f), 1f, SpriteEffects.None, 0f); } } } } else { if (Main.projectile[i].type == 171) { Vector2 vector4 = new Vector2(Main.projectile[i].position.X + (float)Main.projectile[i].width * 0.5f, Main.projectile[i].position.Y + (float)Main.projectile[i].height * 0.5f); float num14 = -Main.projectile[i].velocity.X; float num15 = -Main.projectile[i].velocity.Y; float num16 = 1f; if (Main.projectile[i].ai[0] <= 17f) { num16 = Main.projectile[i].ai[0] / 17f; } int num17 = (int)(30f * num16); float num18 = 1f; if (Main.projectile[i].ai[0] <= 30f) { num18 = Main.projectile[i].ai[0] / 30f; } float num19 = 0.4f * num18; float num20 = num19; num15 += num20; Vector2[] array = new Vector2[num17]; float[] array2 = new float[num17]; for (int j = 0; j < num17; j++) { float num21 = (float)Math.Sqrt((double)(num14 * num14 + num15 * num15)); float num22 = 5.6f; if (Math.Abs(num14) + Math.Abs(num15) < 1f) { num22 *= Math.Abs(num14) + Math.Abs(num15) / 1f; } num21 = num22 / num21; num14 *= num21; num15 *= num21; float num23 = (float)Math.Atan2((double)num15, (double)num14) - 1.57f; array[j].X = vector4.X; array[j].Y = vector4.Y; array2[j] = num23; vector4.X += num14; vector4.Y += num15; num14 = -Main.projectile[i].velocity.X; num15 = -Main.projectile[i].velocity.Y; num20 += num19; num15 += num20; } for (int k = num17 - 1; k >= 0; k--) { vector4.X = array[k].X; vector4.Y = array[k].Y; float rotation4 = array2[k]; Color color5 = Lighting.GetColor((int)vector4.X / 16, (int)(vector4.Y / 16f)); this.spriteBatch.Draw(Main.chain16Texture, new Vector2(vector4.X - Main.screenPosition.X, vector4.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chain16Texture.Width, Main.chain16Texture.Height)), color5, rotation4, new Vector2((float)Main.chain16Texture.Width * 0.5f, (float)Main.chain16Texture.Height * 0.5f), 0.8f, SpriteEffects.None, 0f); } } else { if (Main.projectile[i].type == 165) { Vector2 vector5 = new Vector2(Main.projectile[i].position.X + (float)Main.projectile[i].width * 0.5f, Main.projectile[i].position.Y + (float)Main.projectile[i].height * 0.5f); float num24 = Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2) - vector5.X; float num25 = Main.player[Main.projectile[i].owner].position.Y + (float)(Main.player[Main.projectile[i].owner].height / 2) - vector5.Y; float rotation5 = (float)Math.Atan2((double)num25, (double)num24) - 1.57f; bool flag4 = true; while (flag4) { float num26 = (float)Math.Sqrt((double)(num24 * num24 + num25 * num25)); if (num26 < 25f) { flag4 = false; } else { if (num26 == float.NaN) { flag4 = false; } else { num26 = 24f / num26; num24 *= num26; num25 *= num26; vector5.X += num24; vector5.Y += num25; num24 = Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2) - vector5.X; num25 = Main.player[Main.projectile[i].owner].position.Y + (float)(Main.player[Main.projectile[i].owner].height / 2) - vector5.Y; Color color6 = Lighting.GetColor((int)vector5.X / 16, (int)(vector5.Y / 16f)); this.spriteBatch.Draw(Main.chain15Texture, new Vector2(vector5.X - Main.screenPosition.X, vector5.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chain15Texture.Width, Main.chain15Texture.Height)), color6, rotation5, new Vector2((float)Main.chain15Texture.Width * 0.5f, (float)Main.chain15Texture.Height * 0.5f), 1f, SpriteEffects.None, 0f); } } } } else { if (Main.projectile[i].type >= 230 && Main.projectile[i].type <= 235) { int num27 = Main.projectile[i].type - 229; Vector2 vector6 = new Vector2(Main.projectile[i].position.X + (float)Main.projectile[i].width * 0.5f, Main.projectile[i].position.Y + (float)Main.projectile[i].height * 0.5f); float num28 = Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2) - vector6.X; float num29 = Main.player[Main.projectile[i].owner].position.Y + (float)(Main.player[Main.projectile[i].owner].height / 2) - vector6.Y; float rotation6 = (float)Math.Atan2((double)num29, (double)num28) - 1.57f; bool flag5 = true; while (flag5) { float num30 = (float)Math.Sqrt((double)(num28 * num28 + num29 * num29)); if (num30 < 25f) { flag5 = false; } else { if (num30 == float.NaN) { flag5 = false; } else { num30 = (float)Main.gemChainTexture[num27].Height / num30; num28 *= num30; num29 *= num30; vector6.X += num28; vector6.Y += num29; num28 = Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2) - vector6.X; num29 = Main.player[Main.projectile[i].owner].position.Y + (float)(Main.player[Main.projectile[i].owner].height / 2) - vector6.Y; Color color7 = Lighting.GetColor((int)vector6.X / 16, (int)(vector6.Y / 16f)); this.spriteBatch.Draw(Main.gemChainTexture[num27], new Vector2(vector6.X - Main.screenPosition.X, vector6.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.gemChainTexture[num27].Width, Main.gemChainTexture[num27].Height)), color7, rotation6, new Vector2((float)Main.gemChainTexture[num27].Width * 0.5f, (float)Main.gemChainTexture[num27].Height * 0.5f), 1f, SpriteEffects.None, 0f); } } } } else { if (Main.projectile[i].type == 256) { Vector2 vector7 = new Vector2(Main.projectile[i].position.X + (float)Main.projectile[i].width * 0.5f, Main.projectile[i].position.Y + (float)Main.projectile[i].height * 0.5f); float num31 = Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2) - vector7.X; float num32 = Main.player[Main.projectile[i].owner].position.Y + (float)(Main.player[Main.projectile[i].owner].height / 2) - vector7.Y; float num33 = (float)Math.Atan2((double)num32, (double)num31) - 1.57f; bool flag6 = true; while (flag6) { float num34 = (float)Math.Sqrt((double)(num31 * num31 + num32 * num32)); if (num34 < 26f) { flag6 = false; } else { if (num34 == float.NaN) { flag6 = false; } else { num34 = 26f / num34; num31 *= num34; num32 *= num34; vector7.X += num31; vector7.Y += num32; num31 = Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2) - vector7.X; num32 = Main.player[Main.projectile[i].owner].position.Y + (float)(Main.player[Main.projectile[i].owner].height / 2) - vector7.Y; Color color8 = Lighting.GetColor((int)vector7.X / 16, (int)(vector7.Y / 16f)); this.spriteBatch.Draw(Main.chain20Texture, new Vector2(vector7.X - Main.screenPosition.X, vector7.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chain20Texture.Width, Main.chain20Texture.Height)), color8, num33 - 0.785f, new Vector2((float)Main.chain20Texture.Width * 0.5f, (float)Main.chain20Texture.Height * 0.5f), 1f, SpriteEffects.None, 0f); } } } } else { if (Main.projectile[i].aiStyle == 7) { Vector2 vector8 = new Vector2(Main.projectile[i].position.X + (float)Main.projectile[i].width * 0.5f, Main.projectile[i].position.Y + (float)Main.projectile[i].height * 0.5f); float num35 = Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2) - vector8.X; float num36 = Main.player[Main.projectile[i].owner].position.Y + (float)(Main.player[Main.projectile[i].owner].height / 2) - vector8.Y; float rotation7 = (float)Math.Atan2((double)num36, (double)num35) - 1.57f; bool flag7 = true; while (flag7) { float num37 = (float)Math.Sqrt((double)(num35 * num35 + num36 * num36)); if (num37 < 25f) { flag7 = false; } else { if (num37 == float.NaN) { flag7 = false; } else { num37 = 12f / num37; num35 *= num37; num36 *= num37; vector8.X += num35; vector8.Y += num36; num35 = Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2) - vector8.X; num36 = Main.player[Main.projectile[i].owner].position.Y + (float)(Main.player[Main.projectile[i].owner].height / 2) - vector8.Y; Color color9 = Lighting.GetColor((int)vector8.X / 16, (int)(vector8.Y / 16f)); this.spriteBatch.Draw(Main.chainTexture, new Vector2(vector8.X - Main.screenPosition.X, vector8.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chainTexture.Width, Main.chainTexture.Height)), color9, rotation7, new Vector2((float)Main.chainTexture.Width * 0.5f, (float)Main.chainTexture.Height * 0.5f), 1f, SpriteEffects.None, 0f); } } } } else { if (Main.projectile[i].type == 262) { float num38 = Main.projectile[i].center().X; float num39 = Main.projectile[i].center().Y; float num40 = Main.projectile[i].velocity.X; float num41 = Main.projectile[i].velocity.Y; float num42 = (float)Math.Sqrt((double)(num40 * num40 + num41 * num41)); num42 = 4f / num42; if (Main.projectile[i].ai[0] == 0f) { num38 -= Main.projectile[i].velocity.X * num42; num39 -= Main.projectile[i].velocity.Y * num42; } else { num38 += Main.projectile[i].velocity.X * num42; num39 += Main.projectile[i].velocity.Y * num42; } Vector2 vector9 = new Vector2(num38, num39); num40 = Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2) - vector9.X; num41 = Main.player[Main.projectile[i].owner].position.Y + (float)(Main.player[Main.projectile[i].owner].height / 2) - vector9.Y; float rotation8 = (float)Math.Atan2((double)num41, (double)num40) - 1.57f; if (Main.projectile[i].alpha == 0) { int num43 = -1; if (Main.projectile[i].position.X + (float)(Main.projectile[i].width / 2) < Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2)) { num43 = 1; } if (Main.player[Main.projectile[i].owner].direction == 1) { Main.player[Main.projectile[i].owner].itemRotation = (float)Math.Atan2((double)(num41 * (float)num43), (double)(num40 * (float)num43)); } else { Main.player[Main.projectile[i].owner].itemRotation = (float)Math.Atan2((double)(num41 * (float)num43), (double)(num40 * (float)num43)); } } bool flag8 = true; while (flag8) { float num44 = (float)Math.Sqrt((double)(num40 * num40 + num41 * num41)); if (num44 < 25f) { flag8 = false; } else { if (num44 == float.NaN) { flag8 = false; } else { num44 = 12f / num44; num40 *= num44; num41 *= num44; vector9.X += num40; vector9.Y += num41; num40 = Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2) - vector9.X; num41 = Main.player[Main.projectile[i].owner].position.Y + (float)(Main.player[Main.projectile[i].owner].height / 2) - vector9.Y; Color color10 = Lighting.GetColor((int)vector9.X / 16, (int)(vector9.Y / 16f)); this.spriteBatch.Draw(Main.chain22Texture, new Vector2(vector9.X - Main.screenPosition.X, vector9.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chain22Texture.Width, Main.chain22Texture.Height)), color10, rotation8, new Vector2((float)Main.chain22Texture.Width * 0.5f, (float)Main.chain22Texture.Height * 0.5f), 1f, SpriteEffects.None, 0f); } } } } else { if (Main.projectile[i].type == 273) { float num45 = Main.projectile[i].center().X; float num46 = Main.projectile[i].center().Y; float num47 = Main.projectile[i].velocity.X; float num48 = Main.projectile[i].velocity.Y; float num49 = (float)Math.Sqrt((double)(num47 * num47 + num48 * num48)); num49 = 4f / num49; if (Main.projectile[i].ai[0] == 0f) { num45 -= Main.projectile[i].velocity.X * num49; num46 -= Main.projectile[i].velocity.Y * num49; } else { num45 += Main.projectile[i].velocity.X * num49; num46 += Main.projectile[i].velocity.Y * num49; } Vector2 vector10 = new Vector2(num45, num46); num47 = Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2) - vector10.X; num48 = Main.player[Main.projectile[i].owner].position.Y + (float)(Main.player[Main.projectile[i].owner].height / 2) - vector10.Y; float rotation9 = (float)Math.Atan2((double)num48, (double)num47) - 1.57f; if (Main.projectile[i].alpha == 0) { int num50 = -1; if (Main.projectile[i].position.X + (float)(Main.projectile[i].width / 2) < Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2)) { num50 = 1; } if (Main.player[Main.projectile[i].owner].direction == 1) { Main.player[Main.projectile[i].owner].itemRotation = (float)Math.Atan2((double)(num48 * (float)num50), (double)(num47 * (float)num50)); } else { Main.player[Main.projectile[i].owner].itemRotation = (float)Math.Atan2((double)(num48 * (float)num50), (double)(num47 * (float)num50)); } } bool flag9 = true; while (flag9) { float num51 = (float)Math.Sqrt((double)(num47 * num47 + num48 * num48)); if (num51 < 25f) { flag9 = false; } else { if (num51 == float.NaN) { flag9 = false; } else { num51 = 12f / num51; num47 *= num51; num48 *= num51; vector10.X += num47; vector10.Y += num48; num47 = Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2) - vector10.X; num48 = Main.player[Main.projectile[i].owner].position.Y + (float)(Main.player[Main.projectile[i].owner].height / 2) - vector10.Y; Color color11 = Lighting.GetColor((int)vector10.X / 16, (int)(vector10.Y / 16f)); this.spriteBatch.Draw(Main.chain23Texture, new Vector2(vector10.X - Main.screenPosition.X, vector10.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chain23Texture.Width, Main.chain23Texture.Height)), color11, rotation9, new Vector2((float)Main.chain23Texture.Width * 0.5f, (float)Main.chain23Texture.Height * 0.5f), 1f, SpriteEffects.None, 0f); } } } } else { if (Main.projectile[i].type == 271) { float num52 = Main.projectile[i].center().X; float num53 = Main.projectile[i].center().Y; float num54 = Main.projectile[i].velocity.X; float num55 = Main.projectile[i].velocity.Y; float num56 = (float)Math.Sqrt((double)(num54 * num54 + num55 * num55)); num56 = 4f / num56; if (Main.projectile[i].ai[0] == 0f) { num52 -= Main.projectile[i].velocity.X * num56; num53 -= Main.projectile[i].velocity.Y * num56; } else { num52 += Main.projectile[i].velocity.X * num56; num53 += Main.projectile[i].velocity.Y * num56; } Vector2 vector11 = new Vector2(num52, num53); num54 = Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2) - vector11.X; num55 = Main.player[Main.projectile[i].owner].position.Y + (float)(Main.player[Main.projectile[i].owner].height / 2) - vector11.Y; float rotation10 = (float)Math.Atan2((double)num55, (double)num54) - 1.57f; if (Main.projectile[i].alpha == 0) { int num57 = -1; if (Main.projectile[i].position.X + (float)(Main.projectile[i].width / 2) < Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2)) { num57 = 1; } if (Main.player[Main.projectile[i].owner].direction == 1) { Main.player[Main.projectile[i].owner].itemRotation = (float)Math.Atan2((double)(num55 * (float)num57), (double)(num54 * (float)num57)); } else { Main.player[Main.projectile[i].owner].itemRotation = (float)Math.Atan2((double)(num55 * (float)num57), (double)(num54 * (float)num57)); } } bool flag10 = true; while (flag10) { float num58 = (float)Math.Sqrt((double)(num54 * num54 + num55 * num55)); if (num58 < 25f) { flag10 = false; } else { if (num58 == float.NaN) { flag10 = false; } else { num58 = 12f / num58; num54 *= num58; num55 *= num58; vector11.X += num54; vector11.Y += num55; num54 = Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2) - vector11.X; num55 = Main.player[Main.projectile[i].owner].position.Y + (float)(Main.player[Main.projectile[i].owner].height / 2) - vector11.Y; Color color12 = Lighting.GetColor((int)vector11.X / 16, (int)(vector11.Y / 16f)); this.spriteBatch.Draw(Main.chain18Texture, new Vector2(vector11.X - Main.screenPosition.X, vector11.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chain18Texture.Width, Main.chain18Texture.Height)), color12, rotation10, new Vector2((float)Main.chain18Texture.Width * 0.5f, (float)Main.chain18Texture.Height * 0.5f), 1f, SpriteEffects.None, 0f); } } } } else { if (Main.projectile[i].aiStyle == 13) { float num59 = Main.projectile[i].position.X + 8f; float num60 = Main.projectile[i].position.Y + 2f; float num61 = Main.projectile[i].velocity.X; float num62 = Main.projectile[i].velocity.Y; if (num61 == 0f && num62 == 0f) { num62 = 0.0001f; } float num63 = (float)Math.Sqrt((double)(num61 * num61 + num62 * num62)); num63 = 20f / num63; if (Main.projectile[i].ai[0] == 0f) { num59 -= Main.projectile[i].velocity.X * num63; num60 -= Main.projectile[i].velocity.Y * num63; } else { num59 += Main.projectile[i].velocity.X * num63; num60 += Main.projectile[i].velocity.Y * num63; } Vector2 vector12 = new Vector2(num59, num60); num61 = Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2) - vector12.X; num62 = Main.player[Main.projectile[i].owner].position.Y + (float)(Main.player[Main.projectile[i].owner].height / 2) - vector12.Y; float rotation11 = (float)Math.Atan2((double)num62, (double)num61) - 1.57f; if (Main.projectile[i].alpha == 0) { int num64 = -1; if (Main.projectile[i].position.X + (float)(Main.projectile[i].width / 2) < Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2)) { num64 = 1; } if (Main.player[Main.projectile[i].owner].direction == 1) { Main.player[Main.projectile[i].owner].itemRotation = (float)Math.Atan2((double)(num62 * (float)num64), (double)(num61 * (float)num64)); } else { Main.player[Main.projectile[i].owner].itemRotation = (float)Math.Atan2((double)(num62 * (float)num64), (double)(num61 * (float)num64)); } } bool flag11 = true; while (flag11) { float num65 = (float)Math.Sqrt((double)(num61 * num61 + num62 * num62)); if (num65 < 25f) { flag11 = false; } else { if (num65 == float.NaN) { flag11 = false; } else { num65 = 12f / num65; num61 *= num65; num62 *= num65; vector12.X += num61; vector12.Y += num62; num61 = Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2) - vector12.X; num62 = Main.player[Main.projectile[i].owner].position.Y + (float)(Main.player[Main.projectile[i].owner].height / 2) - vector12.Y; Color color13 = Lighting.GetColor((int)vector12.X / 16, (int)(vector12.Y / 16f)); this.spriteBatch.Draw(Main.chainTexture, new Vector2(vector12.X - Main.screenPosition.X, vector12.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chainTexture.Width, Main.chainTexture.Height)), color13, rotation11, new Vector2((float)Main.chainTexture.Width * 0.5f, (float)Main.chainTexture.Height * 0.5f), 1f, SpriteEffects.None, 0f); } } } } else { if (Main.projectile[i].type == 190) { float x = Main.projectile[i].position.X + (float)(Main.projectile[i].width / 2); float y = Main.projectile[i].position.Y + (float)(Main.projectile[i].height / 2); float num66 = Main.projectile[i].velocity.X; float num67 = Main.projectile[i].velocity.Y; Math.Sqrt((double)(num66 * num66 + num67 * num67)); Vector2 vector13 = new Vector2(x, y); num66 = Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2) - vector13.X; num67 = Main.player[Main.projectile[i].owner].position.Y + (float)(Main.player[Main.projectile[i].owner].height / 2) + Main.player[Main.projectile[i].owner].gfxOffY - vector13.Y; Math.Atan2((double)num67, (double)num66); if (Main.projectile[i].alpha == 0) { int num68 = -1; if (Main.projectile[i].position.X + (float)(Main.projectile[i].width / 2) < Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2)) { num68 = 1; } if (Main.player[Main.projectile[i].owner].direction == 1) { Main.player[Main.projectile[i].owner].itemRotation = (float)Math.Atan2((double)(num67 * (float)num68), (double)(num66 * (float)num68)); } else { Main.player[Main.projectile[i].owner].itemRotation = (float)Math.Atan2((double)(num67 * (float)num68), (double)(num66 * (float)num68)); } } } else { if (Main.projectile[i].aiStyle == 15) { Vector2 vector14 = new Vector2(Main.projectile[i].position.X + (float)Main.projectile[i].width * 0.5f, Main.projectile[i].position.Y + (float)Main.projectile[i].height * 0.5f); float num69 = Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2) - vector14.X; float num70 = Main.player[Main.projectile[i].owner].position.Y + (float)(Main.player[Main.projectile[i].owner].height / 2) - vector14.Y; float rotation12 = (float)Math.Atan2((double)num70, (double)num69) - 1.57f; if (Main.projectile[i].alpha == 0) { int num71 = -1; if (Main.projectile[i].position.X + (float)(Main.projectile[i].width / 2) < Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2)) { num71 = 1; } if (Main.player[Main.projectile[i].owner].direction == 1) { Main.player[Main.projectile[i].owner].itemRotation = (float)Math.Atan2((double)(num70 * (float)num71), (double)(num69 * (float)num71)); } else { Main.player[Main.projectile[i].owner].itemRotation = (float)Math.Atan2((double)(num70 * (float)num71), (double)(num69 * (float)num71)); } } bool flag12 = true; while (flag12) { float num72 = (float)Math.Sqrt((double)(num69 * num69 + num70 * num70)); if (num72 < 25f) { flag12 = false; } else { if (num72 == float.NaN) { flag12 = false; } else { if (Main.projectile[i].type == 154 || Main.projectile[i].type == 247) { num72 = 18f / num72; } else { num72 = 12f / num72; } num69 *= num72; num70 *= num72; vector14.X += num69; vector14.Y += num70; num69 = Main.player[Main.projectile[i].owner].position.X + (float)(Main.player[Main.projectile[i].owner].width / 2) - vector14.X; num70 = Main.player[Main.projectile[i].owner].position.Y + (float)(Main.player[Main.projectile[i].owner].height / 2) - vector14.Y; Color color14 = Lighting.GetColor((int)vector14.X / 16, (int)(vector14.Y / 16f)); if (Main.projectile[i].type == 25) { this.spriteBatch.Draw(Main.chain2Texture, new Vector2(vector14.X - Main.screenPosition.X, vector14.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chain2Texture.Width, Main.chain2Texture.Height)), color14, rotation12, new Vector2((float)Main.chain2Texture.Width * 0.5f, (float)Main.chain2Texture.Height * 0.5f), 1f, SpriteEffects.None, 0f); } else { if (Main.projectile[i].type == 35) { this.spriteBatch.Draw(Main.chain6Texture, new Vector2(vector14.X - Main.screenPosition.X, vector14.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chain6Texture.Width, Main.chain6Texture.Height)), color14, rotation12, new Vector2((float)Main.chain6Texture.Width * 0.5f, (float)Main.chain6Texture.Height * 0.5f), 1f, SpriteEffects.None, 0f); } else { if (Main.projectile[i].type == 247) { this.spriteBatch.Draw(Main.chain19Texture, new Vector2(vector14.X - Main.screenPosition.X, vector14.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chain19Texture.Width, Main.chain19Texture.Height)), color14, rotation12, new Vector2((float)Main.chain19Texture.Width * 0.5f, (float)Main.chain19Texture.Height * 0.5f), 1f, SpriteEffects.None, 0f); } else { if (Main.projectile[i].type == 63) { this.spriteBatch.Draw(Main.chain7Texture, new Vector2(vector14.X - Main.screenPosition.X, vector14.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chain7Texture.Width, Main.chain7Texture.Height)), color14, rotation12, new Vector2((float)Main.chain7Texture.Width * 0.5f, (float)Main.chain7Texture.Height * 0.5f), 1f, SpriteEffects.None, 0f); } else { if (Main.projectile[i].type == 154) { this.spriteBatch.Draw(Main.chain13Texture, new Vector2(vector14.X - Main.screenPosition.X, vector14.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chain13Texture.Width, Main.chain13Texture.Height)), color14, rotation12, new Vector2((float)Main.chain13Texture.Width * 0.5f, (float)Main.chain13Texture.Height * 0.5f), 1f, SpriteEffects.None, 0f); } else { this.spriteBatch.Draw(Main.chain3Texture, new Vector2(vector14.X - Main.screenPosition.X, vector14.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chain3Texture.Width, Main.chain3Texture.Height)), color14, rotation12, new Vector2((float)Main.chain3Texture.Width * 0.5f, (float)Main.chain3Texture.Height * 0.5f), 1f, SpriteEffects.None, 0f); } } } } } } } } } } } } } } } } } } } } } } } Color newColor = Lighting.GetColor((int)((double)Main.projectile[i].position.X + (double)Main.projectile[i].width * 0.5) / 16, (int)(((double)Main.projectile[i].position.Y + (double)Main.projectile[i].height * 0.5) / 16.0)); if (Main.projectile[i].hide) { newColor = Lighting.GetColor((int)((double)Main.player[Main.projectile[i].owner].position.X + (double)Main.player[Main.projectile[i].owner].width * 0.5) / 16, (int)(((double)Main.player[Main.projectile[i].owner].position.Y + (double)Main.player[Main.projectile[i].owner].height * 0.5) / 16.0)); } if (Main.projectile[i].type == 14) { newColor = Color.White; } int num73 = 0; int num74 = 0; if (Main.projectile[i].type == 175) { num73 = 10; } if (Main.projectile[i].type == 254) { num73 = 3; } if (Main.projectile[i].type == 273) { num74 = 2; } if (Main.projectile[i].type == 162) { num73 = 1; num74 = 1; } if (Main.projectile[i].type == 266) { num73 = 10; num74 = -10; } if (Main.projectile[i].type == 269) { num73 = 18; num74 = -14; } if (Main.projectile[i].type == 268) { num73 = 22; num74 = -2; } if (Main.projectile[i].type == 18) { num73 = 3; num74 = 3; } if (Main.projectile[i].type == 16) { num73 = 6; } if (Main.projectile[i].type == 17 || Main.projectile[i].type == 31) { num73 = 2; } if (Main.projectile[i].type == 25 || Main.projectile[i].type == 26 || Main.projectile[i].type == 35 || Main.projectile[i].type == 63 || Main.projectile[i].type == 154) { num73 = 6; num74 -= 6; } if (Main.projectile[i].type == 28 || Main.projectile[i].type == 37 || Main.projectile[i].type == 75) { num73 = 8; } if (Main.projectile[i].type == 29) { num73 = 11; } if (Main.projectile[i].type == 43) { num73 = 4; } if (Main.projectile[i].type == 208) { num73 = 2; num74 -= 12; } if (Main.projectile[i].type == 209) { num73 = 4; num74 -= 8; } if (Main.projectile[i].type == 210) { num73 = 2; num74 -= 22; } if (Main.projectile[i].type == 251) { num73 = 18; num74 -= 10; } if (Main.projectile[i].type == 163 || Main.projectile[i].type == 310) { num73 = 10; } if (Main.projectile[i].type == 69 || Main.projectile[i].type == 70) { num73 = 4; num74 = 4; } float num75 = (float)(Main.projectileTexture[Main.projectile[i].type].Width - Main.projectile[i].width) * 0.5f + (float)Main.projectile[i].width * 0.5f; if (Main.projectile[i].type == 50 || Main.projectile[i].type == 53) { num74 = -8; } if (Main.projectile[i].type == 72 || Main.projectile[i].type == 86 || Main.projectile[i].type == 87) { num74 = -16; num73 = 8; } if (Main.projectile[i].type == 74) { num74 = -6; } if (Main.projectile[i].type == 99) { num73 = 1; } if (Main.projectile[i].type == 111) { num73 = 18; num74 = -16; } if (Main.projectile[i].type == 200) { num73 = 12; num74 = -12; } if (Main.projectile[i].type == 211) { num73 = 14; num74 = 0; } if (Main.projectile[i].type == 236) { num73 = 30; num74 = -14; } if (Main.projectile[i].type >= 191 && Main.projectile[i].type <= 194) { num73 = 26; if (Main.projectile[i].direction == 1) { num74 = -10; } else { num74 = -22; } } if (Main.projectile[i].type == 112) { num73 = 12; } int arg_3772_0 = Main.projectile[i].type; if (Main.projectile[i].type == 127) { num73 = 8; } if (Main.projectile[i].type == 155) { num73 = 3; num74 = 3; } SpriteEffects effects = SpriteEffects.None; if (Main.projectile[i].spriteDirection == -1) { effects = SpriteEffects.FlipHorizontally; } if (Main.projectile[i].type == 221) { for (int l = 1; l < 10; l++) { float num76 = Main.projectile[i].velocity.X * (float)l * 0.5f; float num77 = Main.projectile[i].velocity.Y * (float)l * 0.5f; Color alpha = Main.projectile[i].GetAlpha(newColor); float num78 = 0f; if (l == 1) { num78 = 0.9f; } if (l == 2) { num78 = 0.8f; } if (l == 3) { num78 = 0.7f; } if (l == 4) { num78 = 0.6f; } if (l == 5) { num78 = 0.5f; } if (l == 6) { num78 = 0.4f; } if (l == 7) { num78 = 0.3f; } if (l == 8) { num78 = 0.2f; } if (l == 9) { num78 = 0.1f; } alpha.R = (byte)((float)alpha.R * num78); alpha.G = (byte)((float)alpha.G * num78); alpha.B = (byte)((float)alpha.B * num78); alpha.A = (byte)((float)alpha.A * num78); int num79 = Main.projectileTexture[Main.projectile[i].type].Height / Main.projFrames[Main.projectile[i].type]; int y2 = num79 * Main.projectile[i].frame; this.spriteBatch.Draw(Main.projectileTexture[Main.projectile[i].type], new Vector2(Main.projectile[i].position.X - Main.screenPosition.X + num75 + (float)num74 - num76, Main.projectile[i].position.Y - Main.screenPosition.Y + (float)(Main.projectile[i].height / 2) + Main.projectile[i].gfxOffY - num77), new Rectangle?(new Rectangle(0, y2, Main.projectileTexture[Main.projectile[i].type].Width, num79)), alpha, Main.projectile[i].rotation, new Vector2(num75, (float)(Main.projectile[i].height / 2 + num73)), Main.projectile[i].scale, effects, 0f); } } if (Main.projFrames[Main.projectile[i].type] > 1) { int num80 = Main.projectileTexture[Main.projectile[i].type].Height / Main.projFrames[Main.projectile[i].type]; int y3 = num80 * Main.projectile[i].frame; if (Main.projectile[i].type == 111) { int r = (int)Main.player[Main.projectile[i].owner].shirtColor.R; int g = (int)Main.player[Main.projectile[i].owner].shirtColor.G; int num81 = (int)Main.player[Main.projectile[i].owner].shirtColor.B; Color oldColor = new Color((int)((byte)r), (int)((byte)g), (int)((byte)num81)); newColor = Lighting.GetColor((int)((double)Main.projectile[i].position.X + (double)Main.projectile[i].width * 0.5) / 16, (int)(((double)Main.projectile[i].position.Y + (double)Main.projectile[i].height * 0.5) / 16.0), oldColor); this.spriteBatch.Draw(Main.projectileTexture[Main.projectile[i].type], new Vector2(Main.projectile[i].position.X - Main.screenPosition.X + num75 + (float)num74, Main.projectile[i].position.Y - Main.screenPosition.Y + (float)(Main.projectile[i].height / 2) + Main.projectile[i].gfxOffY), new Rectangle?(new Rectangle(0, y3, Main.projectileTexture[Main.projectile[i].type].Width, num80)), Main.projectile[i].GetAlpha(newColor), Main.projectile[i].rotation, new Vector2(num75, (float)(Main.projectile[i].height / 2 + num73)), Main.projectile[i].scale, effects, 0f); return; } this.spriteBatch.Draw(Main.projectileTexture[Main.projectile[i].type], new Vector2(Main.projectile[i].position.X - Main.screenPosition.X + num75 + (float)num74, Main.projectile[i].position.Y - Main.screenPosition.Y + (float)(Main.projectile[i].height / 2) + Main.projectile[i].gfxOffY), new Rectangle?(new Rectangle(0, y3, Main.projectileTexture[Main.projectile[i].type].Width, num80)), Main.projectile[i].GetAlpha(newColor), Main.projectile[i].rotation, new Vector2(num75, (float)(Main.projectile[i].height / 2 + num73)), Main.projectile[i].scale, effects, 0f); return; } else { if (Main.projectile[i].type == 157) { this.spriteBatch.Draw(Main.projectileTexture[Main.projectile[i].type], new Vector2(Main.projectile[i].position.X - Main.screenPosition.X + (float)(Main.projectile[i].width / 2), Main.projectile[i].position.Y - Main.screenPosition.Y + (float)(Main.projectile[i].height / 2)), new Rectangle?(new Rectangle(0, 0, Main.projectileTexture[Main.projectile[i].type].Width, Main.projectileTexture[Main.projectile[i].type].Height)), Main.projectile[i].GetAlpha(newColor), Main.projectile[i].rotation, new Vector2((float)(Main.projectileTexture[Main.projectile[i].type].Width / 2), (float)(Main.projectileTexture[Main.projectile[i].type].Height / 2)), Main.projectile[i].scale, effects, 0f); return; } if (Main.projectile[i].type == 306) { this.spriteBatch.Draw(Main.projectileTexture[Main.projectile[i].type], new Vector2(Main.projectile[i].position.X - Main.screenPosition.X + (float)(Main.projectile[i].width / 2), Main.projectile[i].position.Y - Main.screenPosition.Y + (float)(Main.projectile[i].height / 2)), new Rectangle?(new Rectangle(0, 0, Main.projectileTexture[Main.projectile[i].type].Width, Main.projectileTexture[Main.projectile[i].type].Height)), Main.projectile[i].GetAlpha(newColor), Main.projectile[i].rotation, new Vector2((float)(Main.projectileTexture[Main.projectile[i].type].Width / 2), (float)(Main.projectileTexture[Main.projectile[i].type].Height / 2)), Main.projectile[i].scale, effects, 0f); return; } if (Main.projectile[i].type == 256) { this.spriteBatch.Draw(Main.projectileTexture[Main.projectile[i].type], new Vector2(Main.projectile[i].position.X - Main.screenPosition.X + (float)(Main.projectile[i].width / 2), Main.projectile[i].position.Y - Main.screenPosition.Y + (float)(Main.projectile[i].height / 2)), new Rectangle?(new Rectangle(0, 0, Main.projectileTexture[Main.projectile[i].type].Width, Main.projectileTexture[Main.projectile[i].type].Height)), Main.projectile[i].GetAlpha(newColor), Main.projectile[i].rotation, new Vector2((float)(Main.projectileTexture[Main.projectile[i].type].Width / 2), (float)(Main.projectileTexture[Main.projectile[i].type].Height / 2)), Main.projectile[i].scale, effects, 0f); return; } if (Main.projectile[i].aiStyle == 27) { this.spriteBatch.Draw(Main.projectileTexture[Main.projectile[i].type], new Vector2(Main.projectile[i].position.X - Main.screenPosition.X + (float)(Main.projectile[i].width / 2), Main.projectile[i].position.Y - Main.screenPosition.Y + (float)(Main.projectile[i].height / 2)), new Rectangle?(new Rectangle(0, 0, Main.projectileTexture[Main.projectile[i].type].Width, Main.projectileTexture[Main.projectile[i].type].Height)), Main.projectile[i].GetAlpha(newColor), Main.projectile[i].rotation, new Vector2((float)Main.projectileTexture[Main.projectile[i].type].Width, 0f), Main.projectile[i].scale, effects, 0f); return; } if (Main.projectile[i].aiStyle == 19) { Vector2 origin = new Vector2(0f, 0f); if (Main.projectile[i].spriteDirection == -1) { origin.X = (float)Main.projectileTexture[Main.projectile[i].type].Width; } this.spriteBatch.Draw(Main.projectileTexture[Main.projectile[i].type], new Vector2(Main.projectile[i].position.X - Main.screenPosition.X + (float)(Main.projectile[i].width / 2), Main.projectile[i].position.Y - Main.screenPosition.Y + (float)(Main.projectile[i].height / 2) + Main.projectile[i].gfxOffY), new Rectangle?(new Rectangle(0, 0, Main.projectileTexture[Main.projectile[i].type].Width, Main.projectileTexture[Main.projectile[i].type].Height)), Main.projectile[i].GetAlpha(newColor), Main.projectile[i].rotation, origin, Main.projectile[i].scale, effects, 0f); return; } if (Main.projectile[i].type == 94 && Main.projectile[i].ai[1] > 6f) { for (int m = 0; m < 10; m++) { Color alpha2 = Main.projectile[i].GetAlpha(newColor); float num82 = (float)(9 - m) / 9f; alpha2.R = (byte)((float)alpha2.R * num82); alpha2.G = (byte)((float)alpha2.G * num82); alpha2.B = (byte)((float)alpha2.B * num82); alpha2.A = (byte)((float)alpha2.A * num82); float num83 = (float)(9 - m) / 9f; this.spriteBatch.Draw(Main.projectileTexture[Main.projectile[i].type], new Vector2(Main.projectile[i].oldPos[m].X - Main.screenPosition.X + num75 + (float)num74, Main.projectile[i].oldPos[m].Y - Main.screenPosition.Y + (float)(Main.projectile[i].height / 2) + Main.projectile[i].gfxOffY), new Rectangle?(new Rectangle(0, 0, Main.projectileTexture[Main.projectile[i].type].Width, Main.projectileTexture[Main.projectile[i].type].Height)), alpha2, Main.projectile[i].rotation, new Vector2(num75, (float)(Main.projectile[i].height / 2 + num73)), num83 * Main.projectile[i].scale, effects, 0f); } } if (Main.projectile[i].type == 301) { for (int n = 0; n < 10; n++) { Color alpha3 = Main.projectile[i].GetAlpha(newColor); float num84 = (float)(9 - n) / 9f; alpha3.R = (byte)((float)alpha3.R * num84); alpha3.G = (byte)((float)alpha3.G * num84); alpha3.B = (byte)((float)alpha3.B * num84); alpha3.A = (byte)((float)alpha3.A * num84); float num85 = (float)(9 - n) / 9f; this.spriteBatch.Draw(Main.projectileTexture[Main.projectile[i].type], new Vector2(Main.projectile[i].oldPos[n].X - Main.screenPosition.X + num75 + (float)num74, Main.projectile[i].oldPos[n].Y - Main.screenPosition.Y + (float)(Main.projectile[i].height / 2) + Main.projectile[i].gfxOffY), new Rectangle?(new Rectangle(0, 0, Main.projectileTexture[Main.projectile[i].type].Width, Main.projectileTexture[Main.projectile[i].type].Height)), alpha3, Main.projectile[i].rotation, new Vector2(num75, (float)(Main.projectile[i].height / 2 + num73)), num85 * Main.projectile[i].scale, effects, 0f); } } if (Main.projectile[i].type == 117 && Main.projectile[i].ai[0] > 3f) { for (int num86 = 1; num86 < 5; num86++) { float num87 = Main.projectile[i].velocity.X * (float)num86; float num88 = Main.projectile[i].velocity.Y * (float)num86; Color alpha4 = Main.projectile[i].GetAlpha(newColor); float num89 = 0f; if (num86 == 1) { num89 = 0.4f; } if (num86 == 2) { num89 = 0.3f; } if (num86 == 3) { num89 = 0.2f; } if (num86 == 4) { num89 = 0.1f; } alpha4.R = (byte)((float)alpha4.R * num89); alpha4.G = (byte)((float)alpha4.G * num89); alpha4.B = (byte)((float)alpha4.B * num89); alpha4.A = (byte)((float)alpha4.A * num89); this.spriteBatch.Draw(Main.projectileTexture[Main.projectile[i].type], new Vector2(Main.projectile[i].position.X - Main.screenPosition.X + num75 + (float)num74 - num87, Main.projectile[i].position.Y - Main.screenPosition.Y + (float)(Main.projectile[i].height / 2) + Main.projectile[i].gfxOffY - num88), new Rectangle?(new Rectangle(0, 0, Main.projectileTexture[Main.projectile[i].type].Width, Main.projectileTexture[Main.projectile[i].type].Height)), alpha4, Main.projectile[i].rotation, new Vector2(num75, (float)(Main.projectile[i].height / 2 + num73)), Main.projectile[i].scale, effects, 0f); } } this.spriteBatch.Draw(Main.projectileTexture[Main.projectile[i].type], new Vector2(Main.projectile[i].position.X - Main.screenPosition.X + num75 + (float)num74, Main.projectile[i].position.Y - Main.screenPosition.Y + (float)(Main.projectile[i].height / 2) + Main.projectile[i].gfxOffY), new Rectangle?(new Rectangle(0, 0, Main.projectileTexture[Main.projectile[i].type].Width, Main.projectileTexture[Main.projectile[i].type].Height)), Main.projectile[i].GetAlpha(newColor), Main.projectile[i].rotation, new Vector2(num75, (float)(Main.projectile[i].height / 2 + num73)), Main.projectile[i].scale, effects, 0f); if (Main.projectile[i].type == 106) { this.spriteBatch.Draw(Main.lightDiscTexture, new Vector2(Main.projectile[i].position.X - Main.screenPosition.X + num75 + (float)num74, Main.projectile[i].position.Y - Main.screenPosition.Y + (float)(Main.projectile[i].height / 2)), new Rectangle?(new Rectangle(0, 0, Main.projectileTexture[Main.projectile[i].type].Width, Main.projectileTexture[Main.projectile[i].type].Height)), new Color(200, 200, 200, 0), Main.projectile[i].rotation, new Vector2(num75, (float)(Main.projectile[i].height / 2 + num73)), Main.projectile[i].scale, effects, 0f); } return; } } private static Color buffColor(Color newColor, float R, float G, float B, float A) { newColor.R = (byte)((float)newColor.R * R); newColor.G = (byte)((float)newColor.G * G); newColor.B = (byte)((float)newColor.B * B); newColor.A = (byte)((float)newColor.A * A); return newColor; } protected void DrawWoF() { if (Main.wof >= 0 && Main.player[Main.myPlayer].gross) { for (int i = 0; i < 255; i++) { if (Main.player[i].active && Main.player[i].tongued && !Main.player[i].dead) { float num = 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 vector = new Vector2(Main.player[i].position.X + (float)Main.player[i].width * 0.5f, Main.player[i].position.Y + (float)Main.player[i].height * 0.5f); float num3 = num - vector.X; float num4 = num2 - vector.Y; float rotation = (float)Math.Atan2((double)num4, (double)num3) - 1.57f; bool flag = true; while (flag) { float num5 = (float)Math.Sqrt((double)(num3 * num3 + num4 * num4)); if (num5 < 40f) { flag = false; } else { num5 = (float)Main.chain12Texture.Height / num5; num3 *= num5; num4 *= num5; vector.X += num3; vector.Y += num4; num3 = num - vector.X; num4 = num2 - vector.Y; Color color = Lighting.GetColor((int)vector.X / 16, (int)(vector.Y / 16f)); this.spriteBatch.Draw(Main.chain12Texture, new Vector2(vector.X - Main.screenPosition.X, vector.Y - Main.screenPosition.Y), new Rectangle?(new 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, 0f); } } } } for (int j = 0; j < 200; j++) { if (Main.npc[j].active && Main.npc[j].aiStyle == 29) { float num6 = Main.npc[Main.wof].position.X + (float)(Main.npc[Main.wof].width / 2); float num7 = Main.npc[Main.wof].position.Y; float num8 = (float)(Main.wofB - Main.wofT); bool flag2 = false; if (Main.npc[j].frameCounter > 7.0) { flag2 = true; } num7 = (float)Main.wofT + num8 * Main.npc[j].ai[0]; Vector2 vector2 = new Vector2(Main.npc[j].position.X + (float)(Main.npc[j].width / 2), Main.npc[j].position.Y + (float)(Main.npc[j].height / 2)); float num9 = num6 - vector2.X; float num10 = num7 - vector2.Y; float rotation2 = (float)Math.Atan2((double)num10, (double)num9) - 1.57f; bool flag3 = true; while (flag3) { SpriteEffects effects = SpriteEffects.None; if (flag2) { effects = SpriteEffects.FlipHorizontally; flag2 = false; } else { flag2 = true; } int height = 28; float num11 = (float)Math.Sqrt((double)(num9 * num9 + num10 * num10)); if (num11 < 40f) { height = (int)num11 - 40 + 28; flag3 = false; } num11 = 28f / num11; num9 *= num11; num10 *= num11; vector2.X += num9; vector2.Y += num10; num9 = num6 - vector2.X; num10 = num7 - vector2.Y; Color color2 = Lighting.GetColor((int)vector2.X / 16, (int)(vector2.Y / 16f)); this.spriteBatch.Draw(Main.chain12Texture, new Vector2(vector2.X - Main.screenPosition.X, vector2.Y - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chain4Texture.Width, height)), color2, rotation2, new Vector2((float)Main.chain4Texture.Width * 0.5f, (float)Main.chain4Texture.Height * 0.5f), 1f, effects, 0f); } } } int num12 = 140; float num13 = (float)Main.wofT; float num14 = (float)Main.wofB; num14 = Main.screenPosition.Y + (float)Main.screenHeight; float num15 = (float)((int)((num13 - Main.screenPosition.Y) / (float)num12) + 1); num15 *= (float)num12; if (num15 > 0f) { num13 -= num15; } float num16 = num13; float num17 = Main.npc[Main.wof].position.X; float num18 = num14 - num13; bool flag4 = true; SpriteEffects effects2 = SpriteEffects.None; if (Main.npc[Main.wof].spriteDirection == 1) { effects2 = SpriteEffects.FlipHorizontally; } if (Main.npc[Main.wof].direction > 0) { num17 -= 80f; } int num19 = 0; if (!Main.gamePaused) { Main.wofF++; } if (Main.wofF > 12) { num19 = 280; if (Main.wofF > 17) { Main.wofF = 0; } } else { if (Main.wofF > 6) { num19 = 140; } } while (flag4) { num18 = num14 - num16; if (num18 > (float)num12) { num18 = (float)num12; } bool flag5 = true; int num20 = 0; while (flag5) { int x = (int)(num17 + (float)(Main.wofTexture.Width / 2)) / 16; int y = (int)(num16 + (float)num20) / 16; this.spriteBatch.Draw(Main.wofTexture, new Vector2(num17 - Main.screenPosition.X, num16 + (float)num20 - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, num19 + num20, Main.wofTexture.Width, 16)), Lighting.GetColor(x, y), 0f, default(Vector2), 1f, effects2, 0f); num20 += 16; if ((float)num20 >= num18) { flag5 = false; } } num16 += (float)num12; if (num16 >= num14) { flag4 = false; } } } } protected void DrawGhost(Player drawPlayer) { SpriteEffects effects; if (drawPlayer.direction == 1) { effects = SpriteEffects.None; } else { effects = SpriteEffects.FlipHorizontally; } 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 Color((int)(Main.mouseTextColor / 2 + 100), (int)(Main.mouseTextColor / 2 + 100), (int)(Main.mouseTextColor / 2 + 100), (int)(Main.mouseTextColor / 2 + 100)))); Rectangle value = new Rectangle(0, Main.ghostTexture.Height / 4 * drawPlayer.ghostFrame, Main.ghostTexture.Width, Main.ghostTexture.Height / 4); Vector2 origin = new Vector2((float)value.Width * 0.5f, (float)value.Height * 0.5f); this.spriteBatch.Draw(Main.ghostTexture, new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X + (float)(value.Width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)(value.Height / 2)))), new Rectangle?(value), immuneAlpha, 0f, origin, 1f, effects, 0f); } protected Vector2 DrawPlayerItemPos(Player drawPlayer) { float num = 10f; Vector2 result = new Vector2((float)(Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width / 2), (float)(Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height / 2)); if (drawPlayer.inventory[drawPlayer.selectedItem].type == 95) { num = 6f; result.Y += 2f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 1295) { num = 4f; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 1255) { num = 6f; result.Y += 0f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 1265) { num = -8f; result.Y += 4f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 1000) { num = 6f; result.Y += 0f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 1178) { num = 4f; result.Y += 0f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 1319) { num = 0f; result.Y += 0f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 1297) { num = -8f; result.Y += 0f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 1121) { num = 6f; result.Y -= 2f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 1314) { num = 2f; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 1258) { num = 2f; result.Y -= 2f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 1155) { num = -10f; result.Y -= 2f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 1156) { num = -2f; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 96) { num = -8f; result.Y += 2f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 1260) { num = -8f; result.Y += 2f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 1254) { num = -6f; result.Y += 2f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 98) { num = -5f; result.Y -= 2f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 534) { num = -2f; result.Y += 1f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 679) { num = 0f; result.Y += 2f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 964) { num = 0f; result.Y += 0f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 533) { num = -7f; result.Y -= 2f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 1553) { num = -10f; result.Y -= 2f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 506) { num = 0f; result.Y -= 2f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 494 || drawPlayer.inventory[drawPlayer.selectedItem].type == 508) { num = -2f; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 434) { num = 0f; result.Y -= 2f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 514) { num = 0f; result.Y += 3f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 435 || drawPlayer.inventory[drawPlayer.selectedItem].type == 436 || drawPlayer.inventory[drawPlayer.selectedItem].type == 481 || drawPlayer.inventory[drawPlayer.selectedItem].type == 578 || drawPlayer.inventory[drawPlayer.selectedItem].type == 1187 || drawPlayer.inventory[drawPlayer.selectedItem].type == 1194 || drawPlayer.inventory[drawPlayer.selectedItem].type == 1201 || drawPlayer.inventory[drawPlayer.selectedItem].type == 1229) { num = -2f; result.Y -= 2f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 197) { num = -5f; result.Y += 4f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 126) { num = 4f; result.Y += 4f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 800) { num = 4f; result.Y += 2f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 127) { num = 4f; result.Y += 2f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 157) { num = 6f; result.Y += 2f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 160) { num = -8f; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 164 || drawPlayer.inventory[drawPlayer.selectedItem].type == 219) { num = 0f; result.Y += 2f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 165 || drawPlayer.inventory[drawPlayer.selectedItem].type == 272) { num = 4f; result.Y += 4f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 266) { num = 0f; result.Y += 2f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 281) { num = 6f; result.Y -= 6f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 986) { num = 6f; result.Y -= 10f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 682) { num = 4f; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 758) { num -= 20f; result.Y += 0f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 759) { num -= 18f; result.Y += 2f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 760) { num -= 12f; result.Y += 2f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 779) { num = 0f; result.Y += 2f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 905) { num = -5f; result.Y += 0f * drawPlayer.gravDir; } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 930) { num = 4f; result.Y += 2f * drawPlayer.gravDir; } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } result.X = num; return result; } protected Color quickAlpha(Color oldColor, float Alpha) { Color result = oldColor; result.R = (byte)((float)result.R * Alpha); result.G = (byte)((float)result.G * Alpha); result.B = (byte)((float)result.B * Alpha); result.A = (byte)((float)result.A * Alpha); return result; } protected void DrawPlayerHead(Player drawPlayer, float X, float Y, float Alpha = 1f, float Scale = 1f) { int index = 0; if (drawPlayer.dye[0] != null) { index = (int)drawPlayer.dye[0].dye; } this.LoadHair(drawPlayer.hair); Color color = this.quickAlpha(Color.White, Alpha); Color color2 = this.quickAlpha(drawPlayer.eyeColor, Alpha); Color color3 = this.quickAlpha(drawPlayer.hairColor, Alpha); Color color4 = this.quickAlpha(drawPlayer.skinColor, Alpha); Color color5 = this.quickAlpha(Color.White, Alpha); SpriteEffects effects = SpriteEffects.None; if (drawPlayer.direction < 0) { effects = SpriteEffects.FlipHorizontally; } Vector2 vector = new Vector2((float)drawPlayer.legFrame.Width * 0.5f, (float)drawPlayer.legFrame.Height * 0.4f); Vector2 position = drawPlayer.position; Rectangle bodyFrame = drawPlayer.bodyFrame; drawPlayer.bodyFrame.Y = 0; drawPlayer.position = Main.screenPosition; drawPlayer.position.X = drawPlayer.position.X + X; drawPlayer.position.Y = drawPlayer.position.Y + Y; drawPlayer.position.X = drawPlayer.position.X - 6f; drawPlayer.position.Y = drawPlayer.position.Y - 4f; if (drawPlayer.head > 0 && drawPlayer.head < 112) { this.LoadArmorHead(drawPlayer.head); } if (drawPlayer.head != 38) { this.spriteBatch.Draw(Main.playerHeadTexture, new Vector2(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2), drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f) + drawPlayer.headPosition + vector, new Rectangle?(drawPlayer.bodyFrame), color4, drawPlayer.headRotation, vector, Scale, effects, 0f); this.spriteBatch.Draw(Main.playerEyeWhitesTexture, new Vector2(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2), drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f) + drawPlayer.headPosition + vector, new Rectangle?(drawPlayer.bodyFrame), color, drawPlayer.headRotation, vector, Scale, effects, 0f); this.spriteBatch.Draw(Main.playerEyesTexture, new Vector2(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2), drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f) + drawPlayer.headPosition + vector, new Rectangle?(drawPlayer.bodyFrame), color2, drawPlayer.headRotation, vector, Scale, effects, 0f); } if (drawPlayer.head == 10 || drawPlayer.head == 12 || drawPlayer.head == 28 || drawPlayer.head == 62 || drawPlayer.head == 97 || drawPlayer.head == 106) { Main.pixelShader.CurrentTechnique.Passes[index].Apply(); this.spriteBatch.Draw(Main.armorHeadTexture[drawPlayer.head], new Vector2(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2), drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f) + drawPlayer.headPosition + vector, new Rectangle?(drawPlayer.bodyFrame), color5, drawPlayer.headRotation, vector, Scale, effects, 0f); Main.pixelShader.CurrentTechnique.Passes[0].Apply(); if (!drawPlayer.invis) { Rectangle bodyFrame2 = drawPlayer.bodyFrame; bodyFrame2.Y -= 336; if (bodyFrame2.Y < 0) { bodyFrame2.Y = 0; } this.spriteBatch.Draw(Main.playerHairTexture[drawPlayer.hair], new Vector2(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2), drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f) + drawPlayer.headPosition + vector, new Rectangle?(bodyFrame2), color3, drawPlayer.headRotation, vector, Scale, effects, 0f); } } if (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) { Rectangle bodyFrame3 = drawPlayer.bodyFrame; bodyFrame3.Y -= 336; if (bodyFrame3.Y < 0) { bodyFrame3.Y = 0; } if (!drawPlayer.invis) { this.spriteBatch.Draw(Main.playerHairAltTexture[drawPlayer.hair], new Vector2(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2), drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f) + drawPlayer.headPosition + vector, new Rectangle?(bodyFrame3), color3, drawPlayer.headRotation, vector, Scale, effects, 0f); } } if (drawPlayer.head == 23) { Rectangle bodyFrame4 = drawPlayer.bodyFrame; bodyFrame4.Y -= 336; if (bodyFrame4.Y < 0) { bodyFrame4.Y = 0; } if (!drawPlayer.invis) { this.spriteBatch.Draw(Main.playerHairTexture[drawPlayer.hair], new Vector2(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2), drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f) + drawPlayer.headPosition + vector, new Rectangle?(bodyFrame4), color3, drawPlayer.headRotation, vector, Scale, effects, 0f); } Main.pixelShader.CurrentTechnique.Passes[index].Apply(); this.spriteBatch.Draw(Main.armorHeadTexture[drawPlayer.head], new Vector2(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2), drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f) + drawPlayer.headPosition + vector, new Rectangle?(drawPlayer.bodyFrame), color5, drawPlayer.headRotation, vector, Scale, effects, 0f); Main.pixelShader.CurrentTechnique.Passes[0].Apply(); } else { if (drawPlayer.head == 14 || drawPlayer.head == 56) { Rectangle bodyFrame5 = drawPlayer.bodyFrame; 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; Main.pixelShader.CurrentTechnique.Passes[index].Apply(); this.spriteBatch.Draw(Main.armorHeadTexture[drawPlayer.head], new Vector2(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2), drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f + (float)num) + drawPlayer.headPosition + vector, new Rectangle?(bodyFrame5), color5, drawPlayer.headRotation, vector, Scale, effects, 0f); Main.pixelShader.CurrentTechnique.Passes[0].Apply(); } else { if (drawPlayer.head > 0 && drawPlayer.head < 112 && drawPlayer.head != 28) { Main.pixelShader.CurrentTechnique.Passes[index].Apply(); this.spriteBatch.Draw(Main.armorHeadTexture[drawPlayer.head], new Vector2(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2), drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f) + drawPlayer.headPosition + vector, new Rectangle?(drawPlayer.bodyFrame), color5, drawPlayer.headRotation, vector, Scale, effects, 0f); Main.pixelShader.CurrentTechnique.Passes[0].Apply(); } else { Rectangle bodyFrame6 = drawPlayer.bodyFrame; bodyFrame6.Y -= 336; if (bodyFrame6.Y < 0) { bodyFrame6.Y = 0; } this.spriteBatch.Draw(Main.playerHairTexture[drawPlayer.hair], new Vector2(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2), drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f) + drawPlayer.headPosition + vector, new Rectangle?(bodyFrame6), color3, drawPlayer.headRotation, vector, Scale, effects, 0f); } } } drawPlayer.position = position; drawPlayer.bodyFrame.Y = bodyFrame.Y; } protected void DrawPlayer(Player drawPlayer) { int index = 0; int index2 = 0; int index3 = 0; if (drawPlayer.dye[0] != null) { index = (int)drawPlayer.dye[0].dye; } if (drawPlayer.dye[1] != null) { index2 = (int)drawPlayer.dye[1].dye; } if (drawPlayer.dye[2] != null) { index3 = (int)drawPlayer.dye[2].dye; } if (drawPlayer.shadow == 0f) { drawPlayer.position.Y = drawPlayer.position.Y + drawPlayer.gfxOffY; } drawPlayer.itemLocation.Y = drawPlayer.itemLocation.Y + drawPlayer.gfxOffY; SpriteEffects effects = SpriteEffects.None; Color color = drawPlayer.GetImmuneAlpha(Lighting.GetColor((int)((double)drawPlayer.position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)drawPlayer.position.Y + (double)drawPlayer.height * 0.25) / 16.0), Color.White)); Color color2 = drawPlayer.GetImmuneAlpha(Lighting.GetColor((int)((double)drawPlayer.position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)drawPlayer.position.Y + (double)drawPlayer.height * 0.25) / 16.0), drawPlayer.eyeColor)); Color color3 = drawPlayer.GetImmuneAlpha(Lighting.GetColor((int)((double)drawPlayer.position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)drawPlayer.position.Y + (double)drawPlayer.height * 0.25) / 16.0), drawPlayer.hairColor)); Color color4 = drawPlayer.GetImmuneAlpha(Lighting.GetColor((int)((double)drawPlayer.position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)drawPlayer.position.Y + (double)drawPlayer.height * 0.25) / 16.0), drawPlayer.skinColor)); Color color5 = 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.0), drawPlayer.skinColor)); 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.75) / 16.0), drawPlayer.skinColor)); Color color6 = drawPlayer.GetImmuneAlpha2(Lighting.GetColor((int)((double)drawPlayer.position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)drawPlayer.position.Y + (double)drawPlayer.height * 0.5) / 16.0), drawPlayer.shirtColor)); Color color7 = drawPlayer.GetImmuneAlpha2(Lighting.GetColor((int)((double)drawPlayer.position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)drawPlayer.position.Y + (double)drawPlayer.height * 0.5) / 16.0), drawPlayer.underShirtColor)); Color color8 = drawPlayer.GetImmuneAlpha2(Lighting.GetColor((int)((double)drawPlayer.position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)drawPlayer.position.Y + (double)drawPlayer.height * 0.75) / 16.0), drawPlayer.pantsColor)); Color color9 = drawPlayer.GetImmuneAlpha2(Lighting.GetColor((int)((double)drawPlayer.position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)drawPlayer.position.Y + (double)drawPlayer.height * 0.75) / 16.0), drawPlayer.shoeColor)); Color color10 = drawPlayer.GetImmuneAlpha2(Lighting.GetColor((int)((double)drawPlayer.position.X + (double)drawPlayer.width * 0.5) / 16, (int)((double)drawPlayer.position.Y + (double)drawPlayer.height * 0.25) / 16, Color.White)); Color color11 = drawPlayer.GetImmuneAlpha2(Lighting.GetColor((int)((double)drawPlayer.position.X + (double)drawPlayer.width * 0.5) / 16, (int)((double)drawPlayer.position.Y + (double)drawPlayer.height * 0.5) / 16, Color.White)); Color color12 = drawPlayer.GetImmuneAlpha2(Lighting.GetColor((int)((double)drawPlayer.position.X + (double)drawPlayer.width * 0.5) / 16, (int)((double)drawPlayer.position.Y + (double)drawPlayer.height * 0.75) / 16, Color.White)); if (drawPlayer.head > 0 && drawPlayer.head < 112) { this.LoadArmorHead(drawPlayer.head); } if (drawPlayer.body > 0 && drawPlayer.body < 75) { this.LoadArmorBody(drawPlayer.body); } if (drawPlayer.legs > 0 && drawPlayer.legs < 64) { this.LoadArmorLegs(drawPlayer.legs); } this.LoadHair(drawPlayer.hair); if ((drawPlayer.head == 78 || drawPlayer.head == 79 || drawPlayer.head == 80) && drawPlayer.body == 51 && drawPlayer.legs == 47) { float num = (float)Main.mouseTextColor / 200f - 0.3f; if (drawPlayer.shadow != 0f) { num = 0f; } color10.G = (byte)((float)color10.G * num); color11.G = (byte)((float)color11.G * num); color12.G = (byte)((float)color12.G * num); color10.B = (byte)((float)color10.B * num); color10.R = (byte)((float)color10.R * num); color11.B = (byte)((float)color11.B * num); color11.R = (byte)((float)color11.R * num); color12.B = (byte)((float)color12.B * num); color12.R = (byte)((float)color12.R * num); } if (drawPlayer.shadow > 0f) { immuneAlpha = new Color(0, 0, 0, 0); color5 = new Color(0, 0, 0, 0); color4 = new Color(0, 0, 0, 0); color3 = new Color(0, 0, 0, 0); color2 = new Color(0, 0, 0, 0); color = new Color(0, 0, 0, 0); } float num2 = 1f; float num3 = 1f; float num4 = 1f; float num5 = 1f; if (drawPlayer.honey && Main.rand.Next(30) == 0) { int num6 = Dust.NewDust(drawPlayer.position, drawPlayer.width, drawPlayer.height, 152, 0f, 0f, 150, default(Color), 1f); Main.dust[num6].velocity.Y = 0.3f; Dust expr_79B_cp_0 = Main.dust[num6]; expr_79B_cp_0.velocity.X = expr_79B_cp_0.velocity.X * 0.1f; Main.dust[num6].scale += (float)Main.rand.Next(3, 4) * 0.1f; Main.dust[num6].alpha = 100; Main.dust[num6].noGravity = true; Main.dust[num6].velocity += drawPlayer.velocity * 0.1f; } if (drawPlayer.poisoned) { if (Main.rand.Next(50) == 0) { int num7 = Dust.NewDust(drawPlayer.position, drawPlayer.width, drawPlayer.height, 46, 0f, 0f, 150, default(Color), 0.2f); Main.dust[num7].noGravity = true; Main.dust[num7].fadeIn = 1.9f; } num2 *= 0.65f; num4 *= 0.75f; } if (drawPlayer.venom) { if (Main.rand.Next(10) == 0) { int num8 = Dust.NewDust(drawPlayer.position, drawPlayer.width, drawPlayer.height, 171, 0f, 0f, 100, default(Color), 0.5f); Main.dust[num8].noGravity = true; Main.dust[num8].fadeIn = 1.5f; } num3 *= 0.45f; num2 *= 0.75f; } if (drawPlayer.onFire) { if (Main.rand.Next(4) == 0) { int num9 = Dust.NewDust(new Vector2(drawPlayer.position.X - 2f, drawPlayer.position.Y - 2f), drawPlayer.width + 4, drawPlayer.height + 4, 6, drawPlayer.velocity.X * 0.4f, drawPlayer.velocity.Y * 0.4f, 100, default(Color), 3f); Main.dust[num9].noGravity = true; Main.dust[num9].velocity *= 1.8f; Dust expr_9E3_cp_0 = Main.dust[num9]; expr_9E3_cp_0.velocity.Y = expr_9E3_cp_0.velocity.Y - 0.5f; } num4 *= 0.6f; num3 *= 0.7f; } if (drawPlayer.ichor) { num4 = 0f; } if (drawPlayer.burned) { int num10 = Dust.NewDust(new Vector2(drawPlayer.position.X - 2f, drawPlayer.position.Y - 2f), drawPlayer.width + 4, drawPlayer.height + 4, 6, drawPlayer.velocity.X * 0.4f, drawPlayer.velocity.Y * 0.4f, 100, default(Color), 2f); Main.dust[num10].noGravity = true; Main.dust[num10].velocity *= 1.8f; Dust expr_ACC_cp_0 = Main.dust[num10]; expr_ACC_cp_0.velocity.Y = expr_ACC_cp_0.velocity.Y - 0.75f; num2 = 1f; num4 *= 0.6f; num3 *= 0.7f; } if (drawPlayer.onFrostBurn) { if (Main.rand.Next(4) == 0) { int num11 = Dust.NewDust(new Vector2(drawPlayer.position.X - 2f, drawPlayer.position.Y - 2f), drawPlayer.width + 4, drawPlayer.height + 4, 135, drawPlayer.velocity.X * 0.4f, drawPlayer.velocity.Y * 0.4f, 100, default(Color), 3f); Main.dust[num11].noGravity = true; Main.dust[num11].velocity *= 1.8f; Dust expr_BC1_cp_0 = Main.dust[num11]; expr_BC1_cp_0.velocity.Y = expr_BC1_cp_0.velocity.Y - 0.5f; } num2 *= 0.5f; num3 *= 0.7f; } if (drawPlayer.onFire2) { if (Main.rand.Next(4) == 0) { int num12 = Dust.NewDust(new Vector2(drawPlayer.position.X - 2f, drawPlayer.position.Y - 2f), drawPlayer.width + 4, drawPlayer.height + 4, 75, drawPlayer.velocity.X * 0.4f, drawPlayer.velocity.Y * 0.4f, 100, default(Color), 3f); Main.dust[num12].noGravity = true; Main.dust[num12].velocity *= 1.8f; Dust expr_CAC_cp_0 = Main.dust[num12]; expr_CAC_cp_0.velocity.Y = expr_CAC_cp_0.velocity.Y - 0.5f; } num4 *= 0.6f; num3 *= 0.7f; } if (drawPlayer.noItems) { num3 *= 0.8f; num2 *= 0.65f; } if (drawPlayer.blind) { num3 *= 0.65f; num2 *= 0.7f; } if (drawPlayer.bleed) { num3 *= 0.9f; num4 *= 0.9f; if (!drawPlayer.dead && Main.rand.Next(30) == 0) { int num13 = Dust.NewDust(drawPlayer.position, drawPlayer.width, drawPlayer.height, 5, 0f, 0f, 0, default(Color), 1f); Dust expr_D7F_cp_0 = Main.dust[num13]; expr_D7F_cp_0.velocity.Y = expr_D7F_cp_0.velocity.Y + 0.5f; Main.dust[num13].velocity *= 0.25f; } } if (drawPlayer.shadow == 0f && drawPlayer.palladiumRegen && drawPlayer.statLife < drawPlayer.statLifeMax && base.IsActive && !Main.gamePaused && drawPlayer.miscCounter % 10 == 0) { Vector2 position; position.X = drawPlayer.position.X + (float)Main.rand.Next(drawPlayer.width); position.Y = drawPlayer.position.Y + (float)Main.rand.Next(drawPlayer.height); position.X = drawPlayer.position.X + (float)(drawPlayer.width / 2) - 6f; position.Y = drawPlayer.position.Y + (float)(drawPlayer.height / 2) - 6f; position.X -= (float)Main.rand.Next(-10, 11); position.Y -= (float)Main.rand.Next(-20, 21); Gore.NewGore(position, 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); } if (num2 != 1f || num3 != 1f || num4 != 1f || num5 != 1f) { if (drawPlayer.onFire || drawPlayer.onFire2 || drawPlayer.onFrostBurn) { color = drawPlayer.GetImmuneAlpha(Color.White); color2 = drawPlayer.GetImmuneAlpha(drawPlayer.eyeColor); color3 = drawPlayer.GetImmuneAlpha(drawPlayer.hairColor); color4 = drawPlayer.GetImmuneAlpha(drawPlayer.skinColor); color5 = drawPlayer.GetImmuneAlpha(drawPlayer.skinColor); color6 = drawPlayer.GetImmuneAlpha(drawPlayer.shirtColor); color7 = drawPlayer.GetImmuneAlpha(drawPlayer.underShirtColor); color8 = drawPlayer.GetImmuneAlpha(drawPlayer.pantsColor); color9 = drawPlayer.GetImmuneAlpha(drawPlayer.shoeColor); color10 = drawPlayer.GetImmuneAlpha(Color.White); color11 = drawPlayer.GetImmuneAlpha(Color.White); color12 = drawPlayer.GetImmuneAlpha(Color.White); } else { color = Main.buffColor(color, num2, num3, num4, num5); color2 = Main.buffColor(color2, num2, num3, num4, num5); color3 = Main.buffColor(color3, num2, num3, num4, num5); color4 = Main.buffColor(color4, num2, num3, num4, num5); color5 = Main.buffColor(color5, num2, num3, num4, num5); color6 = Main.buffColor(color6, num2, num3, num4, num5); color7 = Main.buffColor(color7, num2, num3, num4, num5); color8 = Main.buffColor(color8, num2, num3, num4, num5); color9 = Main.buffColor(color9, num2, num3, num4, num5); color10 = Main.buffColor(color10, num2, num3, num4, num5); color11 = Main.buffColor(color11, num2, num3, num4, num5); color12 = Main.buffColor(color12, num2, num3, num4, num5); } } if (drawPlayer.socialGhost) { color = new Color(0, 0, 0, 0); color2 = new Color(0, 0, 0, 0); color3 = new Color(0, 0, 0, 0); color4 = new Color(0, 0, 0, 0); color5 = new Color(0, 0, 0, 0); color6 = new Color(0, 0, 0, 0); color7 = new Color(0, 0, 0, 0); color8 = new Color(0, 0, 0, 0); color9 = new Color(0, 0, 0, 0); immuneAlpha = new Color(0, 0, 0, 0); if (color10.A > Main.gFade) { color10.A = Main.gFade; } if (color11.A > Main.gFade) { color11.A = Main.gFade; } if (color12.A > Main.gFade) { color12.A = Main.gFade; } } if (drawPlayer.armorSteath) { float num14 = drawPlayer.stealth; if ((double)num14 < 0.03) { num14 = 0.03f; } float num15 = (1f + num14 * 10f) / 11f; if (num14 < 0f) { num14 = 0f; } if (num14 >= 1f - drawPlayer.shadow && drawPlayer.shadow > 0f) { num14 = drawPlayer.shadow * 0.5f; } color10 = new Color((int)((byte)((float)color10.R * num14)), (int)((byte)((float)color10.G * num14)), (int)((byte)((float)color10.B * num15)), (int)((byte)((float)color10.A * num14))); color11 = new Color((int)((byte)((float)color11.R * num14)), (int)((byte)((float)color11.G * num14)), (int)((byte)((float)color11.B * num15)), (int)((byte)((float)color11.A * num14))); color12 = new Color((int)((byte)((float)color12.R * num14)), (int)((byte)((float)color12.G * num14)), (int)((byte)((float)color12.B * num15)), (int)((byte)((float)color12.A * num14))); num14 *= num14; color = new Color((int)((byte)((float)color.R * num14)), (int)((byte)((float)color.G * num14)), (int)((byte)((float)color.B * num14)), (int)((byte)((float)color.A * num14))); color2 = new Color((int)((byte)((float)color2.R * num14)), (int)((byte)((float)color2.G * num14)), (int)((byte)((float)color2.B * num14)), (int)((byte)((float)color2.A * num14))); color3 = new Color((int)((byte)((float)color3.R * num14)), (int)((byte)((float)color3.G * num14)), (int)((byte)((float)color3.B * num14)), (int)((byte)((float)color3.A * num14))); color4 = new Color((int)((byte)((float)color4.R * num14)), (int)((byte)((float)color4.G * num14)), (int)((byte)((float)color4.B * num14)), (int)((byte)((float)color4.A * num14))); color5 = new Color((int)((byte)((float)color5.R * num14)), (int)((byte)((float)color5.G * num14)), (int)((byte)((float)color5.B * num14)), (int)((byte)((float)color5.A * num14))); color6 = new Color((int)((byte)((float)color6.R * num14)), (int)((byte)((float)color6.G * num14)), (int)((byte)((float)color6.B * num14)), (int)((byte)((float)color6.A * num14))); color7 = new Color((int)((byte)((float)color7.R * num14)), (int)((byte)((float)color7.G * num14)), (int)((byte)((float)color7.B * num14)), (int)((byte)((float)color7.A * num14))); color8 = new Color((int)((byte)((float)color8.R * num14)), (int)((byte)((float)color8.G * num14)), (int)((byte)((float)color8.B * num14)), (int)((byte)((float)color8.A * num14))); color9 = new Color((int)((byte)((float)color9.R * num14)), (int)((byte)((float)color9.G * num14)), (int)((byte)((float)color9.B * num14)), (int)((byte)((float)color9.A * num14))); immuneAlpha = new Color((int)((byte)((float)immuneAlpha.R * num14)), (int)((byte)((float)immuneAlpha.G * num14)), (int)((byte)((float)immuneAlpha.B * num14)), (int)((byte)((float)immuneAlpha.A * num14))); } SpriteEffects effects2; if (drawPlayer.gravDir == 1f) { if (drawPlayer.direction == 1) { effects = SpriteEffects.None; effects2 = SpriteEffects.None; } else { effects = SpriteEffects.FlipHorizontally; effects2 = SpriteEffects.FlipHorizontally; } if (!drawPlayer.dead) { drawPlayer.legPosition.Y = 0f; drawPlayer.headPosition.Y = 0f; drawPlayer.bodyPosition.Y = 0f; } } else { if (drawPlayer.direction == 1) { effects = SpriteEffects.FlipVertically; effects2 = SpriteEffects.FlipVertically; } else { effects = (SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically); effects2 = (SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically); } if (!drawPlayer.dead) { drawPlayer.legPosition.Y = 6f; drawPlayer.headPosition.Y = 6f; drawPlayer.bodyPosition.Y = 6f; } } Vector2 vector = new Vector2((float)drawPlayer.legFrame.Width * 0.5f, (float)drawPlayer.legFrame.Height * 0.75f); Vector2 origin = new Vector2((float)drawPlayer.legFrame.Width * 0.5f, (float)drawPlayer.legFrame.Height * 0.5f); Vector2 vector2 = new Vector2((float)drawPlayer.legFrame.Width * 0.5f, (float)drawPlayer.legFrame.Height * 0.4f); if (drawPlayer.merman) { drawPlayer.headRotation = drawPlayer.velocity.Y * (float)drawPlayer.direction * 0.1f; 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 = 0f; } } if (drawPlayer.carpetFrame >= 0) { Color color13 = color12; float num16 = 0f; if (drawPlayer.gravDir == -1f) { num16 = 10f; } this.spriteBatch.Draw(Main.flyingCarpetTexture, new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)(drawPlayer.height / 2) + 28f * drawPlayer.gravDir + num16))), new Rectangle?(new Rectangle(0, Main.flyingCarpetTexture.Height / 6 * drawPlayer.carpetFrame, Main.flyingCarpetTexture.Width, Main.flyingCarpetTexture.Height / 6)), color13, drawPlayer.bodyRotation, new Vector2((float)(Main.flyingCarpetTexture.Width / 2), (float)(Main.flyingCarpetTexture.Height / 8)), 1f, effects, 0f); } bool flag = false; if ((drawPlayer.wings == 0 || drawPlayer.velocity.Y == 0f) && (drawPlayer.inventory[drawPlayer.selectedItem].type == 1178 || drawPlayer.inventory[drawPlayer.selectedItem].type == 779 || drawPlayer.inventory[drawPlayer.selectedItem].type == 1295 || drawPlayer.turtleArmor)) { flag = true; int type = drawPlayer.inventory[drawPlayer.selectedItem].type; int num17 = 1; float num18 = -4f; float num19 = -8f; if (drawPlayer.turtleArmor) { num17 = 4; } else { if (type == 1178) { num17 = 1; } else { if (type == 779) { num17 = 2; } else { if (type == 1295) { num17 = 3; } } } } if (num17 == 4) { this.spriteBatch.Draw(Main.BackPackTexture[num17], new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.bodyPosition + new Vector2((float)(drawPlayer.bodyFrame.Width / 2), (float)(drawPlayer.bodyFrame.Height / 2)), new Rectangle?(drawPlayer.bodyFrame), color11, drawPlayer.bodyRotation, origin, 1f, effects, 0f); } else { this.spriteBatch.Draw(Main.BackPackTexture[num17], new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X + (float)(drawPlayer.width / 2) - (float)(9 * drawPlayer.direction))) + num18 * (float)drawPlayer.direction, (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)(drawPlayer.height / 2) + 2f * drawPlayer.gravDir + num19 * drawPlayer.gravDir))), new Rectangle?(new Rectangle(0, 0, Main.BackPackTexture[num17].Width, Main.BackPackTexture[num17].Height)), color11, drawPlayer.bodyRotation, new Vector2((float)(Main.BackPackTexture[num17].Width / 2), (float)(Main.BackPackTexture[num17].Height / 2)), 1f, effects, 0f); } } if (!flag && drawPlayer.wings > 0) { this.LoadWings(drawPlayer.wings); int num20 = 0; int num21 = 0; if (drawPlayer.wings == 5) { num21 = 4; num20 -= 4; } Color color14 = color11; if (drawPlayer.wings == 9) { color14 = new Color(250, 250, 250, 100); } if (drawPlayer.wings == 10) { color14.A = 175; } if (drawPlayer.wings == 11 && color14.A > Main.gFade) { color14.A = Main.gFade; } if (drawPlayer.wings == 3) { Main.pixelShader.CurrentTechnique.Passes[index2].Apply(); } this.spriteBatch.Draw(Main.wingsTexture[drawPlayer.wings], new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X + (float)(drawPlayer.width / 2) - (float)(9 * drawPlayer.direction)) + num21 * drawPlayer.direction), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)(drawPlayer.height / 2) + 2f * drawPlayer.gravDir + (float)num20 * drawPlayer.gravDir))), new Rectangle?(new Rectangle(0, Main.wingsTexture[drawPlayer.wings].Height / 4 * drawPlayer.wingFrame, Main.wingsTexture[drawPlayer.wings].Width, Main.wingsTexture[drawPlayer.wings].Height / 4)), color14, drawPlayer.bodyRotation, new Vector2((float)(Main.wingsTexture[drawPlayer.wings].Width / 2), (float)(Main.wingsTexture[drawPlayer.wings].Height / 8)), 1f, effects, 0f); if (drawPlayer.wings == 3) { Main.pixelShader.CurrentTechnique.Passes[0].Apply(); } } if (!drawPlayer.invis) { this.spriteBatch.Draw(Main.skinBodyTexture, new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.bodyPosition + new Vector2((float)(drawPlayer.bodyFrame.Width / 2), (float)(drawPlayer.bodyFrame.Height / 2)), new Rectangle?(drawPlayer.bodyFrame), color5, drawPlayer.bodyRotation, origin, 1f, effects, 0f); this.spriteBatch.Draw(Main.skinLegsTexture, new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.bodyPosition + new Vector2((float)(drawPlayer.bodyFrame.Width / 2), (float)(drawPlayer.bodyFrame.Height / 2)), new Rectangle?(drawPlayer.legFrame), immuneAlpha, drawPlayer.legRotation, origin, 1f, effects, 0f); } if (drawPlayer.legs > 0 && drawPlayer.legs < 64) { Main.pixelShader.CurrentTechnique.Passes[index3].Apply(); this.spriteBatch.Draw(Main.armorLegTexture[drawPlayer.legs], new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.legFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.legFrame.Height + 4f))) + drawPlayer.legPosition + vector, new Rectangle?(drawPlayer.legFrame), color12, drawPlayer.legRotation, vector, 1f, effects, 0f); Main.pixelShader.CurrentTechnique.Passes[0].Apply(); } else { if (!drawPlayer.invis) { if (!drawPlayer.male) { this.spriteBatch.Draw(Main.femalePantsTexture, new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.legFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.legFrame.Height + 4f))) + drawPlayer.legPosition + vector, new Rectangle?(drawPlayer.legFrame), color8, drawPlayer.legRotation, vector, 1f, effects, 0f); this.spriteBatch.Draw(Main.femaleShoesTexture, new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.legFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.legFrame.Height + 4f))) + drawPlayer.legPosition + vector, new Rectangle?(drawPlayer.legFrame), color9, drawPlayer.legRotation, vector, 1f, effects, 0f); } else { this.spriteBatch.Draw(Main.playerPantsTexture, new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.legFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.legFrame.Height + 4f))) + drawPlayer.legPosition + vector, new Rectangle?(drawPlayer.legFrame), color8, drawPlayer.legRotation, vector, 1f, effects, 0f); this.spriteBatch.Draw(Main.playerShoesTexture, new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.legFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.legFrame.Height + 4f))) + drawPlayer.legPosition + vector, new Rectangle?(drawPlayer.legFrame), color9, drawPlayer.legRotation, vector, 1f, effects, 0f); } } } if (drawPlayer.body > 0 && drawPlayer.body < 75) { Main.pixelShader.CurrentTechnique.Passes[index2].Apply(); if (!drawPlayer.male) { this.spriteBatch.Draw(Main.femaleBodyTexture[drawPlayer.body], new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.bodyPosition + new Vector2((float)(drawPlayer.bodyFrame.Width / 2), (float)(drawPlayer.bodyFrame.Height / 2)), new Rectangle?(drawPlayer.bodyFrame), color11, drawPlayer.bodyRotation, origin, 1f, effects, 0f); } else { this.spriteBatch.Draw(Main.armorBodyTexture[drawPlayer.body], new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.bodyPosition + new Vector2((float)(drawPlayer.bodyFrame.Width / 2), (float)(drawPlayer.bodyFrame.Height / 2)), new Rectangle?(drawPlayer.bodyFrame), color11, drawPlayer.bodyRotation, origin, 1f, effects, 0f); } Main.pixelShader.CurrentTechnique.Passes[0].Apply(); if ((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.invis) { this.spriteBatch.Draw(Main.playerHandsTexture, new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.bodyPosition + new Vector2((float)(drawPlayer.bodyFrame.Width / 2), (float)(drawPlayer.bodyFrame.Height / 2)), new Rectangle?(drawPlayer.bodyFrame), color5, drawPlayer.bodyRotation, origin, 1f, effects, 0f); } } else { if (!drawPlayer.invis) { if (!drawPlayer.male) { this.spriteBatch.Draw(Main.femaleUnderShirtTexture, new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.bodyPosition + new Vector2((float)(drawPlayer.bodyFrame.Width / 2), (float)(drawPlayer.bodyFrame.Height / 2)), new Rectangle?(drawPlayer.bodyFrame), color7, drawPlayer.bodyRotation, origin, 1f, effects, 0f); this.spriteBatch.Draw(Main.femaleShirtTexture, new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.bodyPosition + new Vector2((float)(drawPlayer.bodyFrame.Width / 2), (float)(drawPlayer.bodyFrame.Height / 2)), new Rectangle?(drawPlayer.bodyFrame), color6, drawPlayer.bodyRotation, origin, 1f, effects, 0f); } else { this.spriteBatch.Draw(Main.playerUnderShirtTexture, new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.bodyPosition + new Vector2((float)(drawPlayer.bodyFrame.Width / 2), (float)(drawPlayer.bodyFrame.Height / 2)), new Rectangle?(drawPlayer.bodyFrame), color7, drawPlayer.bodyRotation, origin, 1f, effects, 0f); this.spriteBatch.Draw(Main.playerShirtTexture, new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.bodyPosition + new Vector2((float)(drawPlayer.bodyFrame.Width / 2), (float)(drawPlayer.bodyFrame.Height / 2)), new Rectangle?(drawPlayer.bodyFrame), color6, drawPlayer.bodyRotation, origin, 1f, effects, 0f); } this.spriteBatch.Draw(Main.playerHandsTexture, new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.bodyPosition + new Vector2((float)(drawPlayer.bodyFrame.Width / 2), (float)(drawPlayer.bodyFrame.Height / 2)), new Rectangle?(drawPlayer.bodyFrame), color5, drawPlayer.bodyRotation, origin, 1f, effects, 0f); } } if (!drawPlayer.invis && drawPlayer.head != 38) { this.spriteBatch.Draw(Main.playerHeadTexture, new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.headPosition + vector2, new Rectangle?(drawPlayer.bodyFrame), color4, drawPlayer.headRotation, vector2, 1f, effects, 0f); this.spriteBatch.Draw(Main.playerEyeWhitesTexture, new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.headPosition + vector2, new Rectangle?(drawPlayer.bodyFrame), color, drawPlayer.headRotation, vector2, 1f, effects, 0f); this.spriteBatch.Draw(Main.playerEyesTexture, new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.headPosition + vector2, new Rectangle?(drawPlayer.bodyFrame), color2, drawPlayer.headRotation, vector2, 1f, effects, 0f); } if (drawPlayer.head == 10 || drawPlayer.head == 12 || drawPlayer.head == 28 || drawPlayer.head == 62 || drawPlayer.head == 97 || drawPlayer.head == 106) { Main.pixelShader.CurrentTechnique.Passes[index].Apply(); this.spriteBatch.Draw(Main.armorHeadTexture[drawPlayer.head], new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.headPosition + vector2, new Rectangle?(drawPlayer.bodyFrame), color10, drawPlayer.headRotation, vector2, 1f, effects, 0f); Main.pixelShader.CurrentTechnique.Passes[0].Apply(); if (!drawPlayer.invis) { Rectangle bodyFrame = drawPlayer.bodyFrame; bodyFrame.Y -= 336; if (bodyFrame.Y < 0) { bodyFrame.Y = 0; } this.spriteBatch.Draw(Main.playerHairTexture[drawPlayer.hair], new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.headPosition + vector2, new Rectangle?(bodyFrame), color3, drawPlayer.headRotation, vector2, 1f, effects, 0f); } } if (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) { Rectangle bodyFrame2 = drawPlayer.bodyFrame; bodyFrame2.Y -= 336; if (bodyFrame2.Y < 0) { bodyFrame2.Y = 0; } if (!drawPlayer.invis) { this.spriteBatch.Draw(Main.playerHairAltTexture[drawPlayer.hair], new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.headPosition + vector2, new Rectangle?(bodyFrame2), color3, drawPlayer.headRotation, vector2, 1f, effects, 0f); } } if (drawPlayer.head == 23) { Rectangle bodyFrame3 = drawPlayer.bodyFrame; bodyFrame3.Y -= 336; if (bodyFrame3.Y < 0) { bodyFrame3.Y = 0; } if (!drawPlayer.invis) { this.spriteBatch.Draw(Main.playerHairTexture[drawPlayer.hair], new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.headPosition + vector2, new Rectangle?(bodyFrame3), color3, drawPlayer.headRotation, vector2, 1f, effects, 0f); } Main.pixelShader.CurrentTechnique.Passes[index].Apply(); this.spriteBatch.Draw(Main.armorHeadTexture[drawPlayer.head], new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.headPosition + vector2, new Rectangle?(drawPlayer.bodyFrame), color10, drawPlayer.headRotation, vector2, 1f, effects, 0f); Main.pixelShader.CurrentTechnique.Passes[0].Apply(); } else { if (drawPlayer.head == 14 || drawPlayer.head == 56) { Rectangle bodyFrame4 = drawPlayer.bodyFrame; int num22 = 0; if (bodyFrame4.Y == bodyFrame4.Height * 6) { bodyFrame4.Height -= 2; } else { if (bodyFrame4.Y == bodyFrame4.Height * 7) { num22 = -2; } else { if (bodyFrame4.Y == bodyFrame4.Height * 8) { num22 = -2; } else { if (bodyFrame4.Y == bodyFrame4.Height * 9) { num22 = -2; } else { if (bodyFrame4.Y == bodyFrame4.Height * 10) { num22 = -2; } else { if (bodyFrame4.Y == bodyFrame4.Height * 13) { bodyFrame4.Height -= 2; } else { if (bodyFrame4.Y == bodyFrame4.Height * 14) { num22 = -2; } else { if (bodyFrame4.Y == bodyFrame4.Height * 15) { num22 = -2; } else { if (bodyFrame4.Y == bodyFrame4.Height * 16) { num22 = -2; } } } } } } } } } bodyFrame4.Y += num22; Main.pixelShader.CurrentTechnique.Passes[index].Apply(); this.spriteBatch.Draw(Main.armorHeadTexture[drawPlayer.head], new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f + (float)num22))) + drawPlayer.headPosition + vector2, new Rectangle?(bodyFrame4), color10, drawPlayer.headRotation, vector2, 1f, effects, 0f); Main.pixelShader.CurrentTechnique.Passes[0].Apply(); } else { if (drawPlayer.head > 0 && drawPlayer.head < 112 && drawPlayer.head != 28) { Main.pixelShader.CurrentTechnique.Passes[index].Apply(); if (drawPlayer.head > 0 && drawPlayer.head < 112) { this.LoadArmorHead(drawPlayer.head); } this.spriteBatch.Draw(Main.armorHeadTexture[drawPlayer.head], new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.headPosition + vector2, new Rectangle?(drawPlayer.bodyFrame), color10, drawPlayer.headRotation, vector2, 1f, effects, 0f); Main.pixelShader.CurrentTechnique.Passes[0].Apply(); } else { if (!drawPlayer.invis) { Rectangle bodyFrame5 = drawPlayer.bodyFrame; bodyFrame5.Y -= 336; if (bodyFrame5.Y < 0) { bodyFrame5.Y = 0; } this.spriteBatch.Draw(Main.playerHairTexture[drawPlayer.hair], new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.headPosition + vector2, new Rectangle?(bodyFrame5), color3, drawPlayer.headRotation, vector2, 1f, effects, 0f); } } } } if (drawPlayer.pulley && drawPlayer.itemAnimation == 0) { if (drawPlayer.pulleyDir == 2) { int num23 = -26; int num24 = 0; float rotation = 0f; this.spriteBatch.Draw(Main.pulleyTexture, new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X + (float)(drawPlayer.width / 2) - (float)(9 * drawPlayer.direction)) + num24 * drawPlayer.direction), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)(drawPlayer.height / 2) + 2f * drawPlayer.gravDir + (float)num23 * drawPlayer.gravDir))), new Rectangle?(new Rectangle(0, Main.pulleyTexture.Height / 2 * drawPlayer.pulleyFrame, Main.pulleyTexture.Width, Main.pulleyTexture.Height / 2)), color10, rotation, new Vector2((float)(Main.pulleyTexture.Width / 2), (float)(Main.pulleyTexture.Height / 4)), 1f, effects, 0f); } else { int num25 = -26; int num26 = 10; float rotation2 = 0.35f * (float)(-(float)drawPlayer.direction); this.spriteBatch.Draw(Main.pulleyTexture, new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X + (float)(drawPlayer.width / 2) - (float)(9 * drawPlayer.direction)) + num26 * drawPlayer.direction), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)(drawPlayer.height / 2) + 2f * drawPlayer.gravDir + (float)num25 * drawPlayer.gravDir))), new Rectangle?(new Rectangle(0, Main.pulleyTexture.Height / 2 * drawPlayer.pulleyFrame, Main.pulleyTexture.Width, Main.pulleyTexture.Height / 2)), color10, rotation2, new Vector2((float)(Main.pulleyTexture.Width / 2), (float)(Main.pulleyTexture.Height / 4)), 1f, effects, 0f); } } if (drawPlayer.heldProj >= 0) { Main.projectile[drawPlayer.heldProj].gfxOffY = drawPlayer.gfxOffY; this.DrawProj(drawPlayer.heldProj); } Color newColor = Lighting.GetColor((int)((double)drawPlayer.position.X + (double)drawPlayer.width * 0.5) / 16, (int)(((double)drawPlayer.position.Y + (double)drawPlayer.height * 0.5) / 16.0)); if (drawPlayer.inventory[drawPlayer.selectedItem].type == 678) { newColor = Color.White; } if (drawPlayer.armorSteath && drawPlayer.inventory[drawPlayer.selectedItem].ranged) { float num27 = drawPlayer.stealth; if ((double)num27 < 0.03) { num27 = 0.03f; } float num28 = (1f + num27 * 10f) / 11f; newColor = new Color((int)((byte)((float)newColor.R * num27)), (int)((byte)((float)newColor.G * num27)), (int)((byte)((float)newColor.B * num28)), (int)((byte)((float)newColor.A * num27))); } if (!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)) { string arg_38A2_0 = drawPlayer.name; if (drawPlayer.inventory[drawPlayer.selectedItem].type == 662 || drawPlayer.inventory[drawPlayer.selectedItem].type == 663) { newColor.R = (byte)Main.DiscoR; newColor.G = (byte)Main.DiscoG; newColor.B = (byte)Main.DiscoB; newColor.A = 255; } if (drawPlayer.inventory[drawPlayer.selectedItem].useStyle == 5) { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 1308 || drawPlayer.inventory[drawPlayer.selectedItem].type == 683 || drawPlayer.inventory[drawPlayer.selectedItem].type == 723 || drawPlayer.inventory[drawPlayer.selectedItem].type == 726 || (drawPlayer.inventory[drawPlayer.selectedItem].type >= 739 && drawPlayer.inventory[drawPlayer.selectedItem].type <= 744) || drawPlayer.inventory[drawPlayer.selectedItem].type == 788 || drawPlayer.inventory[drawPlayer.selectedItem].type == 1326 || drawPlayer.inventory[drawPlayer.selectedItem].type == 1444 || drawPlayer.inventory[drawPlayer.selectedItem].type == 1445 || drawPlayer.inventory[drawPlayer.selectedItem].type == 1446) { float num29 = drawPlayer.itemRotation + 0.785f * (float)drawPlayer.direction; int num30 = 0; int num31 = 0; Vector2 origin2 = new Vector2(0f, (float)Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height); if (drawPlayer.gravDir == -1f) { if (drawPlayer.direction == -1) { num29 += 1.57f; origin2 = new Vector2((float)Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width, 0f); num30 -= Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width; } else { num29 -= 1.57f; origin2 = new Vector2(0f, 0f); } } else { if (drawPlayer.direction == -1) { origin2 = new Vector2((float)Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width, (float)Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height); num30 -= Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width; } } this.spriteBatch.Draw(Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type], new Vector2((float)((int)(drawPlayer.position.X + (float)(drawPlayer.width / 2) - Main.screenPosition.X + origin2.X + (float)num30)), (float)((int)(drawPlayer.position.Y + (float)(drawPlayer.height / 2) - Main.screenPosition.Y + (float)num31))), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height)), drawPlayer.inventory[drawPlayer.selectedItem].GetAlpha(newColor), num29, origin2, drawPlayer.inventory[drawPlayer.selectedItem].scale, effects2, 0f); } else { Vector2 vector3 = new Vector2((float)(Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width / 2), (float)(Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height / 2)); Vector2 vector4 = this.DrawPlayerItemPos(drawPlayer); int num32 = (int)vector4.X; vector3.Y = vector4.Y; Vector2 origin3 = new Vector2((float)(-(float)num32), (float)(Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height / 2)); if (drawPlayer.direction == -1) { origin3 = new Vector2((float)(Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width + num32), (float)(Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height / 2)); } this.spriteBatch.Draw(Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type], new Vector2((float)((int)(drawPlayer.itemLocation.X - Main.screenPosition.X + vector3.X)), (float)((int)(drawPlayer.itemLocation.Y - Main.screenPosition.Y + vector3.Y))), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height)), drawPlayer.inventory[drawPlayer.selectedItem].GetAlpha(newColor), drawPlayer.itemRotation, origin3, drawPlayer.inventory[drawPlayer.selectedItem].scale, effects2, 0f); if (drawPlayer.inventory[drawPlayer.selectedItem].color != default(Color)) { this.spriteBatch.Draw(Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type], new Vector2((float)((int)(drawPlayer.itemLocation.X - Main.screenPosition.X + vector3.X)), (float)((int)(drawPlayer.itemLocation.Y - Main.screenPosition.Y + vector3.Y))), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height)), drawPlayer.inventory[drawPlayer.selectedItem].GetColor(newColor), drawPlayer.itemRotation, origin3, drawPlayer.inventory[drawPlayer.selectedItem].scale, effects2, 0f); } } } else { if (drawPlayer.gravDir == -1f) { this.spriteBatch.Draw(Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type], new Vector2((float)((int)(drawPlayer.itemLocation.X - Main.screenPosition.X)), (float)((int)(drawPlayer.itemLocation.Y - Main.screenPosition.Y))), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height)), drawPlayer.inventory[drawPlayer.selectedItem].GetAlpha(newColor), drawPlayer.itemRotation, new Vector2((float)Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width * 0.5f - (float)Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width * 0.5f * (float)drawPlayer.direction, 0f), drawPlayer.inventory[drawPlayer.selectedItem].scale, effects2, 0f); if (drawPlayer.inventory[drawPlayer.selectedItem].color != default(Color)) { this.spriteBatch.Draw(Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type], new Vector2((float)((int)(drawPlayer.itemLocation.X - Main.screenPosition.X)), (float)((int)(drawPlayer.itemLocation.Y - Main.screenPosition.Y))), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width, Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height)), drawPlayer.inventory[drawPlayer.selectedItem].GetColor(newColor), drawPlayer.itemRotation, new Vector2((float)Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width * 0.5f - (float)Main.itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width * 0.5f * (float)drawPlayer.direction, 0f), drawPlayer.inventory[drawPlayer.selectedItem].scale, effects2, 0f); } } else { if (drawPlayer.inventory[drawPlayer.selectedItem].type == 425 || drawPlayer.inventory[drawPlayer.selectedItem].type == 507) { if (drawPlayer.gravDir == 1f) { if (drawPlayer.direction == 1) { effects2 = SpriteEffects.FlipVertically; } else { effects2 = (SpriteEffects.FlipHorizontally | SpriteEffects.FlipVertically); } } else { if (drawPlayer.direction == 1) { effects2 = SpriteEffects.None; } else { effects2 = SpriteEffects.FlipHorizontally; } } } int type2 = drawPlayer.inventory[drawPlayer.selectedItem].type; this.spriteBatch.Draw(Main.itemTexture[type2], new Vector2((float)((int)(drawPlayer.itemLocation.X - Main.screenPosition.X)), (float)((int)(drawPlayer.itemLocation.Y - Main.screenPosition.Y))), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[type2].Width, Main.itemTexture[type2].Height)), drawPlayer.inventory[drawPlayer.selectedItem].GetAlpha(newColor), drawPlayer.itemRotation, new Vector2((float)Main.itemTexture[type2].Width * 0.5f - (float)Main.itemTexture[type2].Width * 0.5f * (float)drawPlayer.direction, (float)Main.itemTexture[type2].Height), drawPlayer.inventory[drawPlayer.selectedItem].scale, effects2, 0f); if (drawPlayer.inventory[drawPlayer.selectedItem].color != default(Color)) { this.spriteBatch.Draw(Main.itemTexture[type2], new Vector2((float)((int)(drawPlayer.itemLocation.X - Main.screenPosition.X)), (float)((int)(drawPlayer.itemLocation.Y - Main.screenPosition.Y))), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[type2].Width, Main.itemTexture[type2].Height)), drawPlayer.inventory[drawPlayer.selectedItem].GetColor(newColor), drawPlayer.itemRotation, new Vector2((float)Main.itemTexture[type2].Width * 0.5f - (float)Main.itemTexture[type2].Width * 0.5f * (float)drawPlayer.direction, (float)Main.itemTexture[type2].Height), drawPlayer.inventory[drawPlayer.selectedItem].scale, effects2, 0f); } if (drawPlayer.inventory[drawPlayer.selectedItem].flame && drawPlayer.shadow == 0f) { try { this.LoadItemFlames(type2); if (Main.itemFlameTexture[type2] != null) { for (int i = 0; i < 7; i++) { float x = drawPlayer.itemFlamePos[i].X; float y = drawPlayer.itemFlamePos[i].Y; this.spriteBatch.Draw(Main.itemFlameTexture[type2], new Vector2((float)((int)(drawPlayer.itemLocation.X - Main.screenPosition.X)) + x, (float)((int)(drawPlayer.itemLocation.Y - Main.screenPosition.Y)) + y), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[type2].Width, Main.itemTexture[type2].Height)), new Color(100, 100, 100, 0), drawPlayer.itemRotation, new Vector2((float)Main.itemTexture[type2].Width * 0.5f - (float)Main.itemTexture[type2].Width * 0.5f * (float)drawPlayer.direction, (float)Main.itemTexture[type2].Height), drawPlayer.inventory[drawPlayer.selectedItem].scale, effects2, 0f); } } } catch { } } } } } if (drawPlayer.body > 0 && drawPlayer.body < 75) { Main.pixelShader.CurrentTechnique.Passes[index2].Apply(); if (drawPlayer.body > 0 && drawPlayer.body < 75) { this.LoadArmorBody(drawPlayer.body); } this.spriteBatch.Draw(Main.armorArmTexture[drawPlayer.body], new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.bodyPosition + new Vector2((float)(drawPlayer.bodyFrame.Width / 2), (float)(drawPlayer.bodyFrame.Height / 2)), new Rectangle?(drawPlayer.bodyFrame), color11, drawPlayer.bodyRotation, origin, 1f, effects, 0f); Main.pixelShader.CurrentTechnique.Passes[0].Apply(); if ((drawPlayer.body == 10 || drawPlayer.body == 11 || drawPlayer.body == 43 || drawPlayer.body == 12 || drawPlayer.body == 13 || drawPlayer.body == 14 || 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.invis) { this.spriteBatch.Draw(Main.playerHands2Texture, new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.bodyPosition + new Vector2((float)(drawPlayer.bodyFrame.Width / 2), (float)(drawPlayer.bodyFrame.Height / 2)), new Rectangle?(drawPlayer.bodyFrame), color5, drawPlayer.bodyRotation, origin, 1f, effects, 0f); } } else { if (!drawPlayer.invis) { if (!drawPlayer.male) { this.spriteBatch.Draw(Main.femaleUnderShirt2Texture, new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.bodyPosition + new Vector2((float)(drawPlayer.bodyFrame.Width / 2), (float)(drawPlayer.bodyFrame.Height / 2)), new Rectangle?(drawPlayer.bodyFrame), color7, drawPlayer.bodyRotation, origin, 1f, effects, 0f); this.spriteBatch.Draw(Main.femaleShirt2Texture, new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.bodyPosition + new Vector2((float)(drawPlayer.bodyFrame.Width / 2), (float)(drawPlayer.bodyFrame.Height / 2)), new Rectangle?(drawPlayer.bodyFrame), color6, drawPlayer.bodyRotation, origin, 1f, effects, 0f); } else { this.spriteBatch.Draw(Main.playerUnderShirt2Texture, new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.bodyPosition + new Vector2((float)(drawPlayer.bodyFrame.Width / 2), (float)(drawPlayer.bodyFrame.Height / 2)), new Rectangle?(drawPlayer.bodyFrame), color7, drawPlayer.bodyRotation, origin, 1f, effects, 0f); } this.spriteBatch.Draw(Main.playerHands2Texture, new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.bodyPosition + new Vector2((float)(drawPlayer.bodyFrame.Width / 2), (float)(drawPlayer.bodyFrame.Height / 2)), new Rectangle?(drawPlayer.bodyFrame), color5, drawPlayer.bodyRotation, origin, 1f, effects, 0f); } } if (drawPlayer.frozen) { Color color15 = color11; color15.R = (byte)((double)color15.R * 0.55); color15.G = (byte)((double)color15.G * 0.55); color15.B = (byte)((double)color15.B * 0.55); color15.A = (byte)((double)color15.A * 0.55); this.spriteBatch.Draw(Main.frozenTexture, new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.bodyPosition + new Vector2((float)(drawPlayer.bodyFrame.Width / 2), (float)(drawPlayer.bodyFrame.Height / 2)), new Rectangle?(new Rectangle(0, 0, Main.frozenTexture.Width, Main.frozenTexture.Height)), color15, drawPlayer.bodyRotation, new Vector2((float)(Main.frozenTexture.Width / 2), (float)(Main.frozenTexture.Height / 2)), 1f, effects, 0f); } if (drawPlayer.iceBarrier && drawPlayer.shadow == 0f) { int num33 = this.iceBarrierTexture.Height / 12; Color white = Color.White; this.spriteBatch.Draw(this.iceBarrierTexture, new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X - (float)(drawPlayer.bodyFrame.Width / 2) + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - (float)drawPlayer.bodyFrame.Height + 4f))) + drawPlayer.bodyPosition + new Vector2((float)(drawPlayer.bodyFrame.Width / 2), (float)(drawPlayer.bodyFrame.Height / 2)), new Rectangle?(new Rectangle(0, num33 * (int)drawPlayer.iceBarrierFrame, this.iceBarrierTexture.Width, num33)), white, 0f, new Vector2((float)(Main.frozenTexture.Width / 2), (float)(Main.frozenTexture.Height / 2)), 1f, effects, 0f); } if (drawPlayer.gem >= 0 && drawPlayer.shadow == 0f) { this.spriteBatch.Draw(Main.gemTexture[drawPlayer.gem], new Vector2((float)((int)(drawPlayer.position.X - Main.screenPosition.X + (float)(drawPlayer.width / 2))), (float)((int)(drawPlayer.position.Y - Main.screenPosition.Y + (float)drawPlayer.height - 80f))), new Rectangle?(new Rectangle(0, 0, Main.gemTexture[drawPlayer.gem].Width, Main.gemTexture[drawPlayer.gem].Height)), new Color(250, 250, 250, (int)(Main.mouseTextColor / 2)), 0f, new Vector2((float)(Main.gemTexture[drawPlayer.gem].Width / 2), (float)(Main.gemTexture[drawPlayer.gem].Height / 2)), (float)Main.mouseTextColor / 1000f + 0.8f, SpriteEffects.None, 0f); } if (drawPlayer.shadow == 0f) { drawPlayer.position.Y = drawPlayer.position.Y - drawPlayer.gfxOffY; } drawPlayer.itemLocation.Y = drawPlayer.itemLocation.Y - drawPlayer.gfxOffY; } private static void HelpText() { bool flag = false; if (Main.player[Main.myPlayer].statLifeMax > 100) { flag = 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 i = 0; i < 58; i++) { if (Main.player[Main.myPlayer].inventory[i].pick > 0 && Main.player[Main.myPlayer].inventory[i].name != "Copper Pickaxe") { flag3 = false; } if (Main.player[Main.myPlayer].inventory[i].axe > 0 && Main.player[Main.myPlayer].inventory[i].name != "Copper Axe") { flag3 = false; } if (Main.player[Main.myPlayer].inventory[i].hammer > 0) { flag3 = false; } if (Main.player[Main.myPlayer].inventory[i].type == 11 || Main.player[Main.myPlayer].inventory[i].type == 12 || Main.player[Main.myPlayer].inventory[i].type == 13 || Main.player[Main.myPlayer].inventory[i].type == 14) { flag4 = true; } if (Main.player[Main.myPlayer].inventory[i].type == 19 || Main.player[Main.myPlayer].inventory[i].type == 20 || Main.player[Main.myPlayer].inventory[i].type == 21 || Main.player[Main.myPlayer].inventory[i].type == 22) { flag5 = true; } if (Main.player[Main.myPlayer].inventory[i].type == 75) { flag6 = true; } if (Main.player[Main.myPlayer].inventory[i].type == 75) { flag7 = true; } if (Main.player[Main.myPlayer].inventory[i].type == 68 || Main.player[Main.myPlayer].inventory[i].type == 70) { flag8 = true; } if (Main.player[Main.myPlayer].inventory[i].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 j = 0; j < 200; j++) { if (Main.npc[j].active) { if (Main.npc[j].type == 17) { flag10 = true; } if (Main.npc[j].type == 18) { flag11 = true; } if (Main.npc[j].type == 19) { flag13 = true; } if (Main.npc[j].type == 20) { flag12 = true; } if (Main.npc[j].type == 54) { flag18 = true; } if (Main.npc[j].type == 124) { flag15 = true; } if (Main.npc[j].type == 107) { flag14 = true; } if (Main.npc[j].type == 108) { flag16 = true; } if (Main.npc[j].type == 38) { flag17 = true; } } } while (true) { Main.helpText++; if (flag3) { if (Main.helpText == 1) { break; } if (Main.helpText == 2) { goto Block_31; } if (Main.helpText == 3) { goto Block_32; } if (Main.helpText == 4) { goto Block_33; } if (Main.helpText == 5) { goto Block_34; } if (Main.helpText == 6) { goto Block_35; } } if (flag3 && !flag4 && !flag5 && Main.helpText == 11) { goto Block_39; } if (flag3 && flag4 && !flag5) { if (Main.helpText == 21) { goto Block_43; } if (Main.helpText == 22) { goto Block_44; } } if (flag3 && flag5) { if (Main.helpText == 31) { goto Block_47; } if (Main.helpText == 32) { goto Block_48; } } if (!flag && Main.helpText == 41) { goto Block_50; } if (!flag2 && Main.helpText == 42) { goto Block_52; } if (!flag2 && !flag6 && Main.helpText == 43) { goto Block_55; } if (!flag10 && !flag11) { if (Main.helpText == 51) { goto Block_58; } if (Main.helpText == 52) { goto Block_59; } if (Main.helpText == 53) { goto Block_60; } if (Main.helpText == 54) { goto Block_61; } } if (!flag10 && Main.helpText == 61) { goto Block_63; } if (!flag11 && Main.helpText == 62) { goto Block_65; } if (!flag13 && Main.helpText == 63) { goto Block_67; } if (!flag12 && Main.helpText == 64) { goto Block_69; } if (!flag15 && Main.helpText == 65 && NPC.downedBoss3) { goto Block_72; } if (!flag18 && Main.helpText == 66 && NPC.downedBoss3) { goto Block_75; } if (!flag14 && Main.helpText == 67) { goto Block_77; } if (!flag17 && NPC.downedBoss2 && Main.helpText == 68) { goto Block_80; } if (!flag16 && Main.hardMode && Main.helpText == 69) { goto Block_83; } if (flag7 && Main.helpText == 71) { goto Block_85; } if (flag8 && Main.helpText == 72) { goto Block_87; } if ((flag7 || flag8) && Main.helpText == 80) { goto Block_89; } if (!flag9 && Main.helpText == 201 && !Main.hardMode && !NPC.downedBoss3 && !NPC.downedBoss2) { goto Block_94; } if (Main.helpText == 1000 && !NPC.downedBoss1 && !NPC.downedBoss2) { goto Block_97; } if (Main.helpText == 1001 && !NPC.downedBoss1 && !NPC.downedBoss2) { goto Block_100; } if (Main.helpText == 1002 && !NPC.downedBoss3) { goto Block_102; } if (Main.helpText == 1050 && !NPC.downedBoss1 && Main.player[Main.myPlayer].statLifeMax < 200) { goto Block_105; } if (Main.helpText == 1051 && !NPC.downedBoss1 && Main.player[Main.myPlayer].statDefense <= 10) { goto Block_108; } if (Main.helpText == 1052 && !NPC.downedBoss1 && Main.player[Main.myPlayer].statLifeMax >= 200 && Main.player[Main.myPlayer].statDefense > 10) { goto Block_112; } if (Main.helpText == 1053 && NPC.downedBoss1 && !NPC.downedBoss2 && Main.player[Main.myPlayer].statLifeMax < 300) { goto Block_116; } if (Main.helpText == 1054 && NPC.downedBoss1 && !NPC.downedBoss2 && Main.player[Main.myPlayer].statLifeMax >= 300) { goto Block_120; } if (Main.helpText == 1055 && NPC.downedBoss1 && !NPC.downedBoss2 && Main.player[Main.myPlayer].statLifeMax >= 300) { goto Block_124; } if (Main.helpText == 1056 && NPC.downedBoss1 && NPC.downedBoss2 && !NPC.downedBoss3) { goto Block_128; } if (Main.helpText == 1057 && NPC.downedBoss1 && NPC.downedBoss2 && NPC.downedBoss3 && !Main.hardMode && Main.player[Main.myPlayer].statLifeMax < 400) { goto Block_134; } if (Main.helpText == 1058 && NPC.downedBoss1 && NPC.downedBoss2 && NPC.downedBoss3 && !Main.hardMode && Main.player[Main.myPlayer].statLifeMax >= 400) { goto Block_140; } if (Main.helpText == 1059 && NPC.downedBoss1 && NPC.downedBoss2 && NPC.downedBoss3 && !Main.hardMode && Main.player[Main.myPlayer].statLifeMax >= 400) { goto Block_146; } if (Main.helpText == 1060 && NPC.downedBoss1 && NPC.downedBoss2 && NPC.downedBoss3 && !Main.hardMode && Main.player[Main.myPlayer].statLifeMax >= 400) { goto Block_152; } if (Main.helpText == 1061 && Main.hardMode) { goto Block_154; } if (Main.helpText == 1062 && Main.hardMode) { goto Block_156; } if (Main.helpText > 1100) { Main.helpText = 0; } } Main.npcChatText = Lang.dialog(177, false); return; Block_31: Main.npcChatText = Lang.dialog(178, false); return; Block_32: Main.npcChatText = Lang.dialog(179, false); return; Block_33: Main.npcChatText = Lang.dialog(180, false); return; Block_34: Main.npcChatText = Lang.dialog(181, false); return; Block_35: Main.npcChatText = Lang.dialog(182, false); return; Block_39: Main.npcChatText = Lang.dialog(183, false); return; Block_43: Main.npcChatText = Lang.dialog(184, false); return; Block_44: Main.npcChatText = Lang.dialog(185, false); return; Block_47: Main.npcChatText = Lang.dialog(186, false); return; Block_48: Main.npcChatText = Lang.dialog(187, false); return; Block_50: Main.npcChatText = Lang.dialog(188, false); return; Block_52: Main.npcChatText = Lang.dialog(189, false); return; Block_55: Main.npcChatText = Lang.dialog(190, false); return; Block_58: Main.npcChatText = Lang.dialog(191, false); return; Block_59: Main.npcChatText = Lang.dialog(192, false); return; Block_60: Main.npcChatText = Lang.dialog(193, false); return; Block_61: Main.npcChatText = Lang.dialog(194, false); return; Block_63: Main.npcChatText = Lang.dialog(195, false); return; Block_65: Main.npcChatText = Lang.dialog(196, false); return; Block_67: Main.npcChatText = Lang.dialog(197, false); return; Block_69: Main.npcChatText = Lang.dialog(198, false); return; Block_72: Main.npcChatText = Lang.dialog(199, false); return; Block_75: Main.npcChatText = Lang.dialog(200, false); return; Block_77: Main.npcChatText = Lang.dialog(201, false); return; Block_80: Main.npcChatText = Lang.dialog(202, false); return; Block_83: Main.npcChatText = Lang.dialog(203, false); return; Block_85: Main.npcChatText = Lang.dialog(204, false); return; Block_87: Main.npcChatText = Lang.dialog(205, false); return; Block_89: Main.npcChatText = Lang.dialog(206, false); return; Block_94: Main.npcChatText = Lang.dialog(207, false); return; Block_97: Main.npcChatText = Lang.dialog(208, false); return; Block_100: Main.npcChatText = Lang.dialog(209, false); return; Block_102: Main.npcChatText = Lang.dialog(210, false); return; Block_105: Main.npcChatText = Lang.dialog(211, false); return; Block_108: Main.npcChatText = Lang.dialog(212, false); return; Block_112: Main.npcChatText = Lang.dialog(213, false); return; Block_116: Main.npcChatText = Lang.dialog(214, false); return; Block_120: Main.npcChatText = Lang.dialog(215, false); return; Block_124: Main.npcChatText = Lang.dialog(216, false); return; Block_128: Main.npcChatText = Lang.dialog(217, false); return; Block_134: Main.npcChatText = Lang.dialog(218, false); return; Block_140: Main.npcChatText = Lang.dialog(219, false); return; Block_146: Main.npcChatText = Lang.dialog(220, false); return; Block_152: Main.npcChatText = Lang.dialog(221, false); return; Block_154: Main.npcChatText = Lang.dialog(222, false); return; Block_156: Main.npcChatText = Lang.dialog(223, false); } protected void DrawChat() { if (Main.player[Main.myPlayer].talkNPC < 0 && Main.player[Main.myPlayer].sign == -1) { Main.npcChatText = ""; return; } 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); } } Color color = new Color(200, 200, 200, 200); int num = (int)((Main.mouseTextColor * 2 + 255) / 3); Color color2 = new Color(num, num, num, num); int num2 = 10; int num3 = 0; string[] array = new string[num2]; int num4 = 0; int num5 = 0; if (Main.npcChatText == null) { Main.npcChatText = ""; } for (int i = 0; i < Main.npcChatText.Length; i++) { byte[] bytes = Encoding.ASCII.GetBytes(Main.npcChatText.Substring(i, 1)); if (bytes[0] == 10) { array[num3] = Main.npcChatText.Substring(num4, i - num4); num3++; num4 = i + 1; num5 = i + 1; } else { if (Main.npcChatText.Substring(i, 1) == " " || i == Main.npcChatText.Length - 1) { if (Main.fontMouseText.MeasureString(Main.npcChatText.Substring(num4, i - num4)).X > 470f) { array[num3] = Main.npcChatText.Substring(num4, num5 - num4); num3++; num4 = num5 + 1; } num5 = i; } } if (num3 == 10) { Main.npcChatText = Main.npcChatText.Substring(0, i - 1); num4 = i - 1; num3 = 9; break; } } if (num3 < 10) { array[num3] = Main.npcChatText.Substring(num4, Main.npcChatText.Length - num4); } if (Main.editSign) { this.textBlinkerCount++; if (this.textBlinkerCount >= 20) { if (this.textBlinkerState == 0) { this.textBlinkerState = 1; } else { this.textBlinkerState = 0; } this.textBlinkerCount = 0; } if (this.textBlinkerState == 1) { string[] array2; IntPtr intPtr; (array2 = array)[(int)(intPtr = (IntPtr)num3)] = array2[(int)intPtr] + "|"; } } num3++; this.spriteBatch.Draw(Main.chatBackTexture, new Vector2((float)(Main.screenWidth / 2 - Main.chatBackTexture.Width / 2), 100f), new Rectangle?(new Rectangle(0, 0, Main.chatBackTexture.Width, (num3 + 1) * 30)), color, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); this.spriteBatch.Draw(Main.chatBackTexture, new Vector2((float)(Main.screenWidth / 2 - Main.chatBackTexture.Width / 2), (float)(100 + (num3 + 1) * 30)), new Rectangle?(new Rectangle(0, Main.chatBackTexture.Height - 30, Main.chatBackTexture.Width, 30)), color, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); for (int j = 0; j < num3; j++) { for (int k = 0; k < 5; k++) { Color color3 = Color.Black; int num6 = 170 + (Main.screenWidth - 800) / 2; int num7 = 120 + j * 30; if (k == 0) { num6 -= 2; } if (k == 1) { num6 += 2; } if (k == 2) { num7 -= 2; } if (k == 3) { num7 += 2; } if (k == 4) { color3 = color2; } this.spriteBatch.DrawString(Main.fontMouseText, array[j], new Vector2((float)num6, (float)num7), color3, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } num = (int)Main.mouseTextColor; color2 = new Color(num, (int)((double)num / 1.1), num / 2, num); string text = ""; string text2 = ""; int num8 = Main.player[Main.myPlayer].statLifeMax - Main.player[Main.myPlayer].statLife; for (int l = 0; l < 10; l++) { int num9 = Main.player[Main.myPlayer].buffType[l]; if (Main.debuff[num9] && Main.player[Main.myPlayer].buffTime[l] > 0 && num9 != 28 && num9 != 34) { num8 += 1000; } } if (Main.player[Main.myPlayer].sign > -1) { if (Main.editSign) { text = Lang.inter[47]; } else { text = Lang.inter[48]; } } else { if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 20) { text = Lang.inter[28]; text2 = Lang.inter[49]; } 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) { text = Lang.inter[28]; if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 107) { text2 = Lang.inter[19]; } } else { if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 37) { if (!Main.dayTime) { text = Lang.inter[50]; } } else { if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 22) { text = Lang.inter[51]; text2 = Lang.inter[25]; } else { if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 18) { string text3 = ""; int num10 = 0; int num11 = 0; int num12 = 0; int num13 = 0; int num14 = num8; if (num14 > 0) { num14 = (int)((double)num14 * 0.75); if (num14 < 1) { num14 = 1; } } if (num14 < 0) { num14 = 0; } num8 = 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) { object obj = text3; text3 = string.Concat(new object[] { obj, num10, " ", Lang.inter[15], " " }); } if (num11 > 0) { object obj2 = text3; text3 = string.Concat(new object[] { obj2, num11, " ", Lang.inter[16], " " }); } if (num12 > 0) { object obj = text3; text3 = string.Concat(new object[] { obj, num12, " ", Lang.inter[17], " " }); } if (num13 > 0) { object obj = text3; text3 = string.Concat(new object[] { obj, num13, " ", Lang.inter[18], " " }); } float num15 = (float)Main.mouseTextColor / 255f; if (num10 > 0) { color2 = new Color((int)((byte)(220f * num15)), (int)((byte)(220f * num15)), (int)((byte)(198f * num15)), (int)Main.mouseTextColor); } else { if (num11 > 0) { color2 = new Color((int)((byte)(224f * num15)), (int)((byte)(201f * num15)), (int)((byte)(92f * num15)), (int)Main.mouseTextColor); } else { if (num12 > 0) { color2 = new Color((int)((byte)(181f * num15)), (int)((byte)(192f * num15)), (int)((byte)(193f * num15)), (int)Main.mouseTextColor); } else { if (num13 > 0) { color2 = new Color((int)((byte)(246f * num15)), (int)((byte)(138f * num15)), (int)((byte)(96f * num15)), (int)Main.mouseTextColor); } } } } text = Lang.inter[54] + " (" + text3 + ")"; if (num14 == 0) { text = Lang.inter[54]; } } } } } } } int num16 = 180 + (Main.screenWidth - 800) / 2; int num17 = 130 + num3 * 30; float scale = 0.9f; if (Main.mouseX > num16 && (float)Main.mouseX < (float)num16 + Main.fontMouseText.MeasureString(text).X && Main.mouseY > num17 && (float)Main.mouseY < (float)num17 + Main.fontMouseText.MeasureString(text).Y) { Main.player[Main.myPlayer].mouseInterface = true; scale = 1.1f; if (!Main.npcChatFocus2) { Main.PlaySound(12, -1, -1, 1); } Main.npcChatFocus2 = true; Main.player[Main.myPlayer].releaseUseItem = false; } else { if (Main.npcChatFocus2) { Main.PlaySound(12, -1, -1, 1); } Main.npcChatFocus2 = false; } for (int m = 0; m < 5; m++) { int num18 = num16; int num19 = num17; Color color4 = Color.Black; if (m == 0) { num18 -= 2; } if (m == 1) { num18 += 2; } if (m == 2) { num19 -= 2; } if (m == 3) { num19 += 2; } if (m == 4) { color4 = color2; } Vector2 vector = Main.fontMouseText.MeasureString(text); vector *= 0.5f; this.spriteBatch.DrawString(Main.fontMouseText, text, new Vector2((float)num18 + vector.X, (float)num19 + vector.Y), color4, 0f, vector, scale, SpriteEffects.None, 0f); } string text4 = Lang.inter[52]; color2 = new Color(num, (int)((double)num / 1.1), num / 2, num); num16 = num16 + (int)Main.fontMouseText.MeasureString(text).X + 20; int num20 = num16 + (int)Main.fontMouseText.MeasureString(text4).X; num17 = 130 + num3 * 30; scale = 0.9f; if (Main.mouseX > num16 && (float)Main.mouseX < (float)num16 + Main.fontMouseText.MeasureString(text4).X && Main.mouseY > num17 && (float)Main.mouseY < (float)num17 + Main.fontMouseText.MeasureString(text4).Y) { scale = 1.1f; if (!Main.npcChatFocus1) { Main.PlaySound(12, -1, -1, 1); } Main.npcChatFocus1 = true; Main.player[Main.myPlayer].releaseUseItem = false; Main.player[Main.myPlayer].controlUseItem = false; } else { if (Main.npcChatFocus1) { Main.PlaySound(12, -1, -1, 1); } Main.npcChatFocus1 = false; } for (int n = 0; n < 5; n++) { int num21 = num16; int num22 = num17; Color color5 = Color.Black; if (n == 0) { num21 -= 2; } if (n == 1) { num21 += 2; } if (n == 2) { num22 -= 2; } if (n == 3) { num22 += 2; } if (n == 4) { color5 = color2; } Vector2 vector2 = Main.fontMouseText.MeasureString(text4); vector2 *= 0.5f; this.spriteBatch.DrawString(Main.fontMouseText, text4, new Vector2((float)num21 + vector2.X, (float)num22 + vector2.Y), color5, 0f, vector2, scale, SpriteEffects.None, 0f); } if (text2 != "") { num16 = num20 + (int)Main.fontMouseText.MeasureString(text2).X / 3; num17 = 130 + num3 * 30; scale = 0.9f; if (Main.mouseX > num16 && (float)Main.mouseX < (float)num16 + Main.fontMouseText.MeasureString(text2).X && Main.mouseY > num17 && (float)Main.mouseY < (float)num17 + Main.fontMouseText.MeasureString(text2).Y) { Main.player[Main.myPlayer].mouseInterface = true; scale = 1.1f; if (!Main.npcChatFocus3) { Main.PlaySound(12, -1, -1, 1); } Main.npcChatFocus3 = true; Main.player[Main.myPlayer].releaseUseItem = false; } else { if (Main.npcChatFocus3) { Main.PlaySound(12, -1, -1, 1); } Main.npcChatFocus3 = false; } for (int num23 = 0; num23 < 5; num23++) { int num24 = num16; int num25 = num17; Color color6 = Color.Black; if (num23 == 0) { num24 -= 2; } if (num23 == 1) { num24 += 2; } if (num23 == 2) { num25 -= 2; } if (num23 == 3) { num25 += 2; } if (num23 == 4) { color6 = color2; } Vector2 vector3 = Main.fontMouseText.MeasureString(text); vector3 *= 0.5f; this.spriteBatch.DrawString(Main.fontMouseText, text2, new Vector2((float)num24 + vector3.X, (float)num25 + vector3.Y), color6, 0f, vector3, scale, SpriteEffects.None, 0f); } } if (Main.mouseLeft && Main.mouseLeftRelease) { Main.mouseLeftRelease = false; Main.player[Main.myPlayer].releaseUseItem = false; Main.player[Main.myPlayer].mouseInterface = true; if (Main.npcChatFocus1) { Main.player[Main.myPlayer].talkNPC = -1; Main.player[Main.myPlayer].sign = -1; Main.editSign = false; Main.npcChatText = ""; Main.PlaySound(11, -1, -1, 1); return; } if (Main.npcChatFocus2) { if (Main.player[Main.myPlayer].sign != -1) { if (!Main.editSign) { Main.PlaySound(12, -1, -1, 1); Main.editSign = true; Main.clrInput(); return; } Main.PlaySound(12, -1, -1, 1); int num26 = Main.player[Main.myPlayer].sign; Sign.TextSign(num26, Main.npcChatText); Main.editSign = false; if (Main.netMode == 1) { NetMessage.SendData(47, -1, -1, "", num26, 0f, 0f, 0f, 0); return; } } 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, -1, -1, 1); return; } 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, -1, -1, 1); return; } 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, -1, -1, 1); return; } 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, -1, -1, 1); return; } if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 37) { if (Main.netMode == 0) { NPC.SpawnSkeletron(); } else { NetMessage.SendData(51, -1, -1, "", Main.myPlayer, 1f, 0f, 0f, 0); } Main.npcChatText = ""; return; } 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, -1, -1, 1); return; } 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, -1, -1, 1); return; } 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, -1, -1, 1); return; } 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, -1, -1, 1); return; } 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, -1, -1, 1); return; } 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, -1, -1, 1); return; } 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, -1, -1, 1); return; } 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, -1, -1, 1); return; } 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, -1, -1, 1); return; } 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, -1, -1, 1); return; } 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, -1, -1, 1); return; } 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, -1, -1, 1); return; } 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, -1, -1, 1); return; } if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 22) { Main.PlaySound(12, -1, -1, 1); Main.HelpText(); return; } if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 18) { Main.PlaySound(12, -1, -1, 1); if (num8 > 0) { if (Main.player[Main.myPlayer].BuyItem(num8)) { Main.PlaySound(2, -1, -1, 4); Main.player[Main.myPlayer].HealEffect(Main.player[Main.myPlayer].statLifeMax - Main.player[Main.myPlayer].statLife, true); if ((double)Main.player[Main.myPlayer].statLife < (double)Main.player[Main.myPlayer].statLifeMax * 0.25) { Main.npcChatText = Lang.dialog(227, false); } else { if ((double)Main.player[Main.myPlayer].statLife < (double)Main.player[Main.myPlayer].statLifeMax * 0.5) { Main.npcChatText = Lang.dialog(228, false); } else { if ((double)Main.player[Main.myPlayer].statLife < (double)Main.player[Main.myPlayer].statLifeMax * 0.75) { Main.npcChatText = Lang.dialog(229, false); } else { Main.npcChatText = Lang.dialog(230, false); } } } Main.player[Main.myPlayer].statLife = Main.player[Main.myPlayer].statLifeMax; for (int num27 = 0; num27 < 10; num27++) { int num28 = Main.player[Main.myPlayer].buffType[num27]; if (Main.debuff[num28] && Main.player[Main.myPlayer].buffTime[num27] > 0 && num28 != 28 && num28 != 34) { Main.player[Main.myPlayer].DelBuff(num27); } } return; } int num29 = Main.rand.Next(3); if (num29 == 0) { Main.npcChatText = Lang.dialog(52, false); } if (num29 == 1) { Main.npcChatText = Lang.dialog(53, false); } if (num29 == 2) { Main.npcChatText = Lang.dialog(54, false); return; } } else { int num30 = Main.rand.Next(3); if (num30 == 0) { Main.npcChatText = Lang.dialog(55, false); } if (num30 == 1) { Main.npcChatText = Lang.dialog(56, false); } if (num30 == 2) { Main.npcChatText = Lang.dialog(57, false); return; } } } } } else { if (Main.npcChatFocus3 && Main.player[Main.myPlayer].talkNPC >= 0) { if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 20) { Main.PlaySound(12, -1, -1, 1); Main.npcChatText = Lang.evilGood(); return; } if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 22) { Main.playerInventory = true; Main.npcChatText = ""; Main.PlaySound(12, -1, -1, 1); Main.craftGuide = true; return; } if (Main.npc[Main.player[Main.myPlayer].talkNPC].type == 107) { Main.playerInventory = true; Main.npcChatText = ""; Main.PlaySound(12, -1, -1, 1); Main.reforge = true; } } } } } private static bool AccCheck(Item newItem, int slot) { if (Main.player[Main.myPlayer].armor[slot].IsTheSameAs(newItem)) { return false; } for (int i = 0; i < Main.player[Main.myPlayer].armor.Length; i++) { if (newItem.IsTheSameAs(Main.player[Main.myPlayer].armor[i])) { return true; } } return false; } public static Item dyeSwap(Item newItem) { if (newItem.dye <= 0) { return newItem; } for (int i = 0; i < 3; i++) { if (Main.player[Main.myPlayer].dye[i].type == 0) { Main.dyeSlotCount = i; break; } } if (Main.dyeSlotCount >= 3) { Main.dyeSlotCount = 0; } if (Main.dyeSlotCount < 0) { Main.dyeSlotCount = 2; } Item result = (Item)Main.player[Main.myPlayer].dye[Main.dyeSlotCount].Clone(); Main.player[Main.myPlayer].dye[Main.dyeSlotCount] = (Item)newItem.Clone(); Main.dyeSlotCount++; if (Main.dyeSlotCount >= 3) { Main.accSlotCount = 0; } Main.PlaySound(7, -1, -1, 1); Recipe.FindRecipes(); return result; } public static Item armorSwap(Item newItem) { for (int i = 0; i < Main.player[Main.myPlayer].armor.Length; i++) { if (newItem.IsTheSameAs(Main.player[Main.myPlayer].armor[i])) { Main.accSlotCount = i; } } if (newItem.headSlot == -1 && newItem.bodySlot == -1 && newItem.legSlot == -1 && !newItem.accessory) { return newItem; } Item result = newItem; if (newItem.headSlot != -1) { result = (Item)Main.player[Main.myPlayer].armor[0].Clone(); Main.player[Main.myPlayer].armor[0] = (Item)newItem.Clone(); } else { if (newItem.bodySlot != -1) { result = (Item)Main.player[Main.myPlayer].armor[1].Clone(); Main.player[Main.myPlayer].armor[1] = (Item)newItem.Clone(); } else { if (newItem.legSlot != -1) { result = (Item)Main.player[Main.myPlayer].armor[2].Clone(); Main.player[Main.myPlayer].armor[2] = (Item)newItem.Clone(); } else { if (newItem.accessory) { for (int j = 3; j < 8; j++) { if (Main.player[Main.myPlayer].armor[j].type == 0) { Main.accSlotCount = j - 3; break; } } for (int k = 0; k < Main.player[Main.myPlayer].armor.Length; k++) { if (newItem.IsTheSameAs(Main.player[Main.myPlayer].armor[k])) { Main.accSlotCount = k - 3; } } if (Main.accSlotCount >= 5) { Main.accSlotCount = 0; } if (Main.accSlotCount < 0) { Main.accSlotCount = 4; } result = (Item)Main.player[Main.myPlayer].armor[3 + Main.accSlotCount].Clone(); Main.player[Main.myPlayer].armor[3 + Main.accSlotCount] = (Item)newItem.Clone(); Main.accSlotCount++; if (Main.accSlotCount >= 5) { Main.accSlotCount = 0; } } } } } Main.PlaySound(7, -1, -1, 1); Recipe.FindRecipes(); return result; } public static void BankCoins() { for (int i = 0; i < 40; i++) { if (Main.player[Main.myPlayer].bank[i].type >= 71 && Main.player[Main.myPlayer].bank[i].type <= 73 && Main.player[Main.myPlayer].bank[i].stack == Main.player[Main.myPlayer].bank[i].maxStack) { Main.player[Main.myPlayer].bank[i].SetDefaults(Main.player[Main.myPlayer].bank[i].type + 1, false); for (int j = 0; j < 40; j++) { if (j != i && Main.player[Main.myPlayer].bank[j].type == Main.player[Main.myPlayer].bank[i].type && Main.player[Main.myPlayer].bank[j].stack < Main.player[Main.myPlayer].bank[j].maxStack) { Main.player[Main.myPlayer].bank[j].stack++; Main.player[Main.myPlayer].bank[i].SetDefaults(0, false); Main.BankCoins(); } } } } } public static void ChestCoins() { for (int i = 0; i < 40; i++) { if (Main.chest[Main.player[Main.myPlayer].chest].item[i].type >= 71 && Main.chest[Main.player[Main.myPlayer].chest].item[i].type <= 73 && Main.chest[Main.player[Main.myPlayer].chest].item[i].stack == Main.chest[Main.player[Main.myPlayer].chest].item[i].maxStack) { Main.chest[Main.player[Main.myPlayer].chest].item[i].SetDefaults(Main.chest[Main.player[Main.myPlayer].chest].item[i].type + 1, false); for (int j = 0; j < 40; j++) { if (j != i && Main.chest[Main.player[Main.myPlayer].chest].item[j].type == Main.chest[Main.player[Main.myPlayer].chest].item[i].type && Main.chest[Main.player[Main.myPlayer].chest].item[j].stack < Main.chest[Main.player[Main.myPlayer].chest].item[j].maxStack) { if (Main.netMode == 1) { NetMessage.SendData(32, -1, -1, "", Main.player[Main.myPlayer].chest, (float)j, 0f, 0f, 0); } Main.chest[Main.player[Main.myPlayer].chest].item[j].stack++; Main.chest[Main.player[Main.myPlayer].chest].item[i].SetDefaults(0, false); Main.ChestCoins(); } } } } } protected void DrawNPCHouse() { for (int i = 0; i < 200; i++) { if (Main.npc[i].active && Main.npc[i].townNPC && !Main.npc[i].homeless && Main.npc[i].homeTileX > 0 && Main.npc[i].homeTileY > 0 && Main.npc[i].type != 37) { int num = 1; int num2 = Main.npc[i].homeTileX; int num3 = Main.npc[i].homeTileY - 1; if (Main.tile[num2, num3] != null) { bool flag = false; while (!Main.tile[num2, num3].active() || !Main.tileSolid[(int)Main.tile[num2, num3].type]) { num3--; if (num3 < 10) { break; } if (Main.tile[num2, num3] == null) { flag = true; break; } } if (!flag) { int num4 = 8; int num5 = 18; if (Main.tile[num2, num3].type == 19) { num5 -= 8; } num3++; int num6 = 0; float num7 = (float)(num3 * 16); SpriteEffects effects = SpriteEffects.None; if (Main.player[Main.myPlayer].gravDir == -1f) { num7 -= Main.screenPosition.Y; num7 = Main.screenPosition.Y + (float)Main.screenHeight - num7; num7 -= (float)Main.bannerTexture[num].Height; effects = SpriteEffects.FlipVertically; num6 = 4; } this.spriteBatch.Draw(Main.bannerTexture[num], new Vector2((float)(num2 * 16 - (int)Main.screenPosition.X + num4), num7 - (float)((int)Main.screenPosition.Y) + (float)num5 + (float)num6), new Rectangle?(new Rectangle(0, 0, Main.bannerTexture[num].Width, Main.bannerTexture[num].Height)), Lighting.GetColor(num2, num3), 0f, new Vector2((float)(Main.bannerTexture[num].Width / 2), (float)(Main.bannerTexture[num].Height / 2)), 1f, effects, 0f); int num8 = NPC.TypeToNum(Main.npc[i].type); float scale = 1f; float num9; if (Main.npcHeadTexture[num8].Width > Main.npcHeadTexture[num8].Height) { num9 = (float)Main.npcHeadTexture[num8].Width; } else { num9 = (float)Main.npcHeadTexture[num8].Height; } if (num9 > 24f) { scale = 24f / num9; } this.spriteBatch.Draw(Main.npcHeadTexture[num8], new Vector2((float)(num2 * 16 - (int)Main.screenPosition.X + num4), num7 - (float)((int)Main.screenPosition.Y) + (float)num5 + 2f), new Rectangle?(new Rectangle(0, 0, Main.npcHeadTexture[num8].Width, Main.npcHeadTexture[num8].Height)), Lighting.GetColor(num2, num3), 0f, new Vector2((float)(Main.npcHeadTexture[num8].Width / 2), (float)(Main.npcHeadTexture[num8].Height / 2)), scale, effects, 0f); num2 = num2 * 16 - (int)Main.screenPosition.X + num4 - Main.bannerTexture[num].Width / 2; num3 = num3 * 16 - (int)Main.screenPosition.Y + num5 - Main.bannerTexture[num].Height / 2; if (Main.mouseX >= num2 && Main.mouseX <= num2 + Main.bannerTexture[num].Width && Main.mouseY >= num3 && Main.mouseY <= num3 + Main.bannerTexture[num].Height) { this.MouseText(Main.npc[i].displayName + " the " + Main.npc[i].name, 0, 0); if (Main.mouseRightRelease && Main.mouseRight) { Main.mouseRightRelease = false; WorldGen.kickOut(i); Main.PlaySound(12, -1, -1, 1); } } } } } } } protected void DrawPlayerChat() { if (Main.chatMode) { this.textBlinkerCount++; if (this.textBlinkerCount >= 20) { if (this.textBlinkerState == 0) { this.textBlinkerState = 1; } else { this.textBlinkerState = 0; } this.textBlinkerCount = 0; } string text = Main.chatText; if (this.textBlinkerState == 1) { text += "|"; } if (Main.screenWidth > 800) { int i = Main.screenWidth - 300; int num = 78; this.spriteBatch.Draw(Main.textBackTexture, new Vector2((float)num, (float)(Main.screenHeight - 36)), new Rectangle?(new Rectangle(0, 0, Main.textBackTexture.Width - 100, Main.textBackTexture.Height)), new Color(100, 100, 100, 100), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); i -= 400; num += 400; while (i > 0) { if (i > 300) { this.spriteBatch.Draw(Main.textBackTexture, new Vector2((float)num, (float)(Main.screenHeight - 36)), new Rectangle?(new Rectangle(100, 0, Main.textBackTexture.Width - 200, Main.textBackTexture.Height)), new Color(100, 100, 100, 100), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); i -= 300; num += 300; } else { this.spriteBatch.Draw(Main.textBackTexture, new Vector2((float)num, (float)(Main.screenHeight - 36)), new Rectangle?(new Rectangle(Main.textBackTexture.Width - i, 0, Main.textBackTexture.Width - (Main.textBackTexture.Width - i), Main.textBackTexture.Height)), new Color(100, 100, 100, 100), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); i = 0; } } } else { this.spriteBatch.Draw(Main.textBackTexture, new Vector2(78f, (float)(Main.screenHeight - 36)), new Rectangle?(new Rectangle(0, 0, Main.textBackTexture.Width, Main.textBackTexture.Height)), new Color(100, 100, 100, 100), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } for (int j = 0; j < 5; j++) { int num2 = 0; int num3 = 0; Color black = Color.Black; if (j == 0) { num2 = -2; } if (j == 1) { num2 = 2; } if (j == 2) { num3 = -2; } if (j == 3) { num3 = 2; } if (j == 4) { black = new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor); } this.spriteBatch.DrawString(Main.fontMouseText, text, new Vector2((float)(88 + num2), (float)(Main.screenHeight - 30 + num3)), black, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } int num4 = Main.startChatLine; int num5 = Main.startChatLine + Main.showCount; if (num5 >= Main.numChatLines) { num5 = --Main.numChatLines; num4 = num5 - Main.showCount; } int num6 = 0; for (int k = num4; k < num5; k++) { if (Main.chatMode || Main.chatLine[k].showTime > 0) { float num7 = (float)Main.mouseTextColor / 255f; for (int l = 0; l < 5; l++) { int num8 = 0; int num9 = 0; Color black2 = Color.Black; if (l == 0) { num8 = -2; } if (l == 1) { num8 = 2; } if (l == 2) { num9 = -2; } if (l == 3) { num9 = 2; } if (l == 4) { black2 = new Color((int)((byte)((float)Main.chatLine[k].color.R * num7)), (int)((byte)((float)Main.chatLine[k].color.G * num7)), (int)((byte)((float)Main.chatLine[k].color.B * num7)), (int)Main.mouseTextColor); } this.spriteBatch.DrawString(Main.fontMouseText, Main.chatLine[k].text, new Vector2((float)(88 + num8), (float)(Main.screenHeight - 30 + num9 - 28 - num6 * 21)), black2, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } num6++; } } protected void DrawInventory() { if (Main.netMode == 1) { int num = 675 + Main.screenWidth - 800; int num2 = 114 + Main.mH; if (Main.player[Main.myPlayer].hostile) { this.spriteBatch.Draw(Main.itemTexture[4], new Vector2((float)(num - 2), (float)num2), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[4].Width, Main.itemTexture[4].Height)), Main.teamColor[Main.player[Main.myPlayer].team], 0f, default(Vector2), 1f, SpriteEffects.None, 0f); this.spriteBatch.Draw(Main.itemTexture[4], new Vector2((float)(num + 2), (float)num2), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[4].Width, Main.itemTexture[4].Height)), Main.teamColor[Main.player[Main.myPlayer].team], 0f, default(Vector2), 1f, SpriteEffects.FlipHorizontally, 0f); } else { this.spriteBatch.Draw(Main.itemTexture[4], new Vector2((float)(num - 16), (float)(num2 + 14)), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[4].Width, Main.itemTexture[4].Height)), Main.teamColor[Main.player[Main.myPlayer].team], -0.785f, default(Vector2), 1f, SpriteEffects.None, 0f); this.spriteBatch.Draw(Main.itemTexture[4], new Vector2((float)(num + 2), (float)(num2 + 14)), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[4].Width, Main.itemTexture[4].Height)), Main.teamColor[Main.player[Main.myPlayer].team], -0.785f, default(Vector2), 1f, SpriteEffects.None, 0f); } if (Main.mouseX > num && Main.mouseX < num + 34 && Main.mouseY > num2 - 2 && Main.mouseY < num2 + 34) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeft && Main.mouseLeftRelease && Main.teamCooldown == 0) { Main.teamCooldown = Main.teamCooldownLen; Main.PlaySound(12, -1, -1, 1); if (Main.player[Main.myPlayer].hostile) { Main.player[Main.myPlayer].hostile = false; } else { Main.player[Main.myPlayer].hostile = true; } NetMessage.SendData(30, -1, -1, "", Main.myPlayer, 0f, 0f, 0f, 0); } } num -= 3; Rectangle value = new Rectangle(Main.mouseX, Main.mouseY, 1, 1); int width = Main.teamTexture.Width; int height = Main.teamTexture.Height; for (int i = 0; i < 5; i++) { Rectangle rectangle = default(Rectangle); if (i == 0) { rectangle = new Rectangle(num + 50, num2 - 20, width, height); } if (i == 1) { rectangle = new Rectangle(num + 40, num2, width, height); } if (i == 2) { rectangle = new Rectangle(num + 60, num2, width, height); } if (i == 3) { rectangle = new Rectangle(num + 40, num2 + 20, width, height); } if (i == 4) { rectangle = new Rectangle(num + 60, num2 + 20, width, height); } if (rectangle.Intersects(value)) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeft && Main.mouseLeftRelease && Main.player[Main.myPlayer].team != i && Main.teamCooldown == 0) { Main.teamCooldown = Main.teamCooldownLen; Main.PlaySound(12, -1, -1, 1); Main.player[Main.myPlayer].team = i; NetMessage.SendData(45, -1, -1, "", Main.myPlayer, 0f, 0f, 0f, 0); } } } this.spriteBatch.Draw(Main.teamTexture, new Vector2((float)(num + 50), (float)(num2 - 20)), new Rectangle?(new Rectangle(0, 0, Main.teamTexture.Width, Main.teamTexture.Height)), Main.teamColor[0], 0f, default(Vector2), 1f, SpriteEffects.None, 0f); this.spriteBatch.Draw(Main.teamTexture, new Vector2((float)(num + 40), (float)num2), new Rectangle?(new Rectangle(0, 0, Main.teamTexture.Width, Main.teamTexture.Height)), Main.teamColor[1], 0f, default(Vector2), 1f, SpriteEffects.None, 0f); this.spriteBatch.Draw(Main.teamTexture, new Vector2((float)(num + 60), (float)num2), new Rectangle?(new Rectangle(0, 0, Main.teamTexture.Width, Main.teamTexture.Height)), Main.teamColor[2], 0f, default(Vector2), 1f, SpriteEffects.None, 0f); this.spriteBatch.Draw(Main.teamTexture, new Vector2((float)(num + 40), (float)(num2 + 20)), new Rectangle?(new Rectangle(0, 0, Main.teamTexture.Width, Main.teamTexture.Height)), Main.teamColor[3], 0f, default(Vector2), 1f, SpriteEffects.None, 0f); this.spriteBatch.Draw(Main.teamTexture, new Vector2((float)(num + 60), (float)(num2 + 20)), new Rectangle?(new Rectangle(0, 0, Main.teamTexture.Width, Main.teamTexture.Height)), Main.teamColor[4], 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } bool flag = false; Main.inventoryScale = 0.85f; int num3 = 448; int num4 = 258; if (Main.player[Main.myPlayer].chest != -1 || Main.npcShop > 0) { num4 += 168; Main.inventoryScale = 0.755f; num3 += 5; } Color white = new Color(150, 150, 150, 150); if (Main.mouseX >= num3 && (float)Main.mouseX <= (float)num3 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num4 && (float)Main.mouseY <= (float)num4 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft) { if (Main.mouseItem.type != 0) { Main.trashItem.SetDefaults(0, false); } Item item = Main.mouseItem; Main.mouseItem = Main.trashItem; Main.trashItem = item; if (Main.trashItem.type == 0 || Main.trashItem.stack < 1) { Main.trashItem = new Item(); } if (Main.mouseItem.IsTheSameAs(Main.trashItem) && Main.trashItem.stack != Main.trashItem.maxStack && Main.mouseItem.stack != Main.mouseItem.maxStack) { if (Main.mouseItem.stack + Main.trashItem.stack <= Main.mouseItem.maxStack) { Main.trashItem.stack += Main.mouseItem.stack; Main.mouseItem.stack = 0; } else { int num5 = Main.mouseItem.maxStack - Main.trashItem.stack; Main.trashItem.stack += num5; Main.mouseItem.stack -= num5; } } if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1) { Main.mouseItem = new Item(); } if (Main.mouseItem.type > 0 || Main.trashItem.type > 0) { Main.PlaySound(7, -1, -1, 1); } } if (!flag) { Main.hoverItemName = Main.trashItem.name; if (Main.trashItem.stack > 1) { object obj = Main.hoverItemName; Main.hoverItemName = string.Concat(new object[] { obj, " (", Main.trashItem.stack, ")" }); } Main.toolTip = (Item)Main.trashItem.Clone(); if (Main.hoverItemName == null) { Main.hoverItemName = Lang.inter[3]; } } else { Main.hoverItemName = Lang.inter[3]; } } this.spriteBatch.Draw(Main.inventoryBack7Texture, new Vector2((float)num3, (float)num4), new Rectangle?(new Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height)), Main.inventoryBack, 0f, default(Vector2), Main.inventoryScale, SpriteEffects.None, 0f); white = Color.White; if (Main.trashItem.type == 0 || Main.trashItem.stack == 0 || flag) { white = new Color(100, 100, 100, 100); float num6 = Main.inventoryScale; this.spriteBatch.Draw(Main.trashTexture, new Vector2((float)num3 + 26f * Main.inventoryScale - (float)Main.trashTexture.Width * 0.5f * num6, (float)num4 + 26f * Main.inventoryScale - (float)Main.trashTexture.Height * 0.5f * num6), new Rectangle?(new Rectangle(0, 0, Main.trashTexture.Width, Main.trashTexture.Height)), white, 0f, default(Vector2), num6, SpriteEffects.None, 0f); } else { float num7 = 1f; if (Main.itemTexture[Main.trashItem.type].Width > 32 || Main.itemTexture[Main.trashItem.type].Height > 32) { if (Main.itemTexture[Main.trashItem.type].Width > Main.itemTexture[Main.trashItem.type].Height) { num7 = 32f / (float)Main.itemTexture[Main.trashItem.type].Width; } else { num7 = 32f / (float)Main.itemTexture[Main.trashItem.type].Height; } } num7 *= Main.inventoryScale; if (Main.trashItem.type == 662 || Main.trashItem.type == 663) { white.R = (byte)Main.DiscoR; white.G = (byte)Main.DiscoG; white.B = (byte)Main.DiscoB; white.A = 255; } this.spriteBatch.Draw(Main.itemTexture[Main.trashItem.type], new Vector2((float)num3 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.trashItem.type].Width * 0.5f * num7, (float)num4 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.trashItem.type].Height * 0.5f * num7), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.trashItem.type].Width, Main.itemTexture[Main.trashItem.type].Height)), Main.trashItem.GetAlpha(white), 0f, default(Vector2), num7, SpriteEffects.None, 0f); if (Main.trashItem.color != default(Color)) { this.spriteBatch.Draw(Main.itemTexture[Main.trashItem.type], new Vector2((float)num3 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.trashItem.type].Width * 0.5f * num7, (float)num4 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.trashItem.type].Height * 0.5f * num7), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.trashItem.type].Width, Main.itemTexture[Main.trashItem.type].Height)), Main.trashItem.GetColor(white), 0f, default(Vector2), num7, SpriteEffects.None, 0f); } white = Color.White; if (Main.trashItem.stack > 1) { this.spriteBatch.DrawString(Main.fontItemStack, string.Concat(Main.trashItem.stack), new Vector2((float)num3 + 10f * Main.inventoryScale, (float)num4 + 26f * Main.inventoryScale), white, 0f, default(Vector2), num7, SpriteEffects.None, 0f); } } this.spriteBatch.DrawString(Main.fontMouseText, Lang.inter[4], new Vector2(40f, 0f), new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); Main.inventoryScale = 0.85f; if (Main.mouseX > 20 && Main.mouseX < (int)(20f + 560f * Main.inventoryScale) && Main.mouseY > 20 && Main.mouseY < (int)(20f + 224f * Main.inventoryScale)) { Main.player[Main.myPlayer].mouseInterface = true; } for (int j = 0; j < 10; j++) { for (int k = 0; k < 5; k++) { int num8 = (int)(20f + (float)(j * 56) * Main.inventoryScale); int num9 = (int)(20f + (float)(k * 56) * Main.inventoryScale); int num10 = j + k * 10; Color white2 = new Color(100, 100, 100, 100); if (Main.mouseX >= num8 && (float)Main.mouseX <= (float)num8 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num9 && (float)Main.mouseY <= (float)num9 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft) { if (Main.keyState.IsKeyDown(Keys.LeftShift)) { if (Main.player[Main.myPlayer].inventory[num10].type > 0) { if (Main.npcShop > 0) { if (Main.player[Main.myPlayer].inventory[num10].type < 71 || Main.player[Main.myPlayer].inventory[num10].type > 74) { if (Main.player[Main.myPlayer].SellItem(Main.player[Main.myPlayer].inventory[num10].value, Main.player[Main.myPlayer].inventory[num10].stack)) { this.shop[Main.npcShop].AddShop(Main.player[Main.myPlayer].inventory[num10]); Main.player[Main.myPlayer].inventory[num10].SetDefaults(0, false); Main.PlaySound(18, -1, -1, 1); } else { if (Main.player[Main.myPlayer].inventory[num10].value == 0) { this.shop[Main.npcShop].AddShop(Main.player[Main.myPlayer].inventory[num10]); Main.player[Main.myPlayer].inventory[num10].SetDefaults(0, false); Main.PlaySound(7, -1, -1, 1); } } } } else { Main.PlaySound(7, -1, -1, 1); Main.trashItem = (Item)Main.player[Main.myPlayer].inventory[num10].Clone(); Main.player[Main.myPlayer].inventory[num10].SetDefaults(0, false); Recipe.FindRecipes(); } } } else { if ((Main.player[Main.myPlayer].selectedItem != num10 || Main.player[Main.myPlayer].itemAnimation <= 0) && Main.player[Main.myPlayer].itemTime == 0) { Item item2 = Main.mouseItem; Main.mouseItem = Main.player[Main.myPlayer].inventory[num10]; Main.player[Main.myPlayer].inventory[num10] = item2; if (Main.player[Main.myPlayer].inventory[num10].type == 0 || Main.player[Main.myPlayer].inventory[num10].stack < 1) { Main.player[Main.myPlayer].inventory[num10] = new Item(); } if (Main.mouseItem.IsTheSameAs(Main.player[Main.myPlayer].inventory[num10]) && Main.player[Main.myPlayer].inventory[num10].stack != Main.player[Main.myPlayer].inventory[num10].maxStack && Main.mouseItem.stack != Main.mouseItem.maxStack) { if (Main.mouseItem.stack + Main.player[Main.myPlayer].inventory[num10].stack <= Main.mouseItem.maxStack) { Main.player[Main.myPlayer].inventory[num10].stack += Main.mouseItem.stack; Main.mouseItem.stack = 0; } else { int num11 = Main.mouseItem.maxStack - Main.player[Main.myPlayer].inventory[num10].stack; Main.player[Main.myPlayer].inventory[num10].stack += num11; Main.mouseItem.stack -= num11; } } if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1) { Main.mouseItem = new Item(); } if (Main.mouseItem.type > 0 || Main.player[Main.myPlayer].inventory[num10].type > 0) { Recipe.FindRecipes(); Main.PlaySound(7, -1, -1, 1); } } } Recipe.FindRecipes(); } else { if (Main.mouseRight && Main.mouseRightRelease && (Main.player[Main.myPlayer].inventory[num10].type == 599 || Main.player[Main.myPlayer].inventory[num10].type == 600 || Main.player[Main.myPlayer].inventory[num10].type == 601)) { Main.PlaySound(7, -1, -1, 1); Main.stackSplit = 30; Main.mouseRightRelease = false; int num12 = Main.rand.Next(14); if (num12 == 0 && Main.hardMode) { Main.player[Main.myPlayer].inventory[num10].SetDefaults(602, false); } else { if (num12 <= 7) { Main.player[Main.myPlayer].inventory[num10].SetDefaults(586, false); Main.player[Main.myPlayer].inventory[num10].stack = Main.rand.Next(20, 50); } else { Main.player[Main.myPlayer].inventory[num10].SetDefaults(591, false); Main.player[Main.myPlayer].inventory[num10].stack = Main.rand.Next(20, 50); } } Recipe.FindRecipes(); } else { if (Main.mouseRight && Main.mouseRightRelease && Main.player[Main.myPlayer].inventory[num10].maxStack == 1) { if (Main.player[Main.myPlayer].inventory[num10].dye > 0) { Main.player[Main.myPlayer].inventory[num10] = Main.dyeSwap(Main.player[Main.myPlayer].inventory[num10]); } else { Main.player[Main.myPlayer].inventory[num10] = Main.armorSwap(Main.player[Main.myPlayer].inventory[num10]); } } else { if (Main.stackSplit <= 1 && Main.mouseRight && Main.player[Main.myPlayer].inventory[num10].maxStack > 1 && Main.player[Main.myPlayer].inventory[num10].type > 0 && (Main.mouseItem.IsTheSameAs(Main.player[Main.myPlayer].inventory[num10]) || Main.mouseItem.type == 0) && (Main.mouseItem.stack < Main.mouseItem.maxStack || Main.mouseItem.type == 0)) { if (Main.mouseItem.type == 0) { Main.mouseItem = (Item)Main.player[Main.myPlayer].inventory[num10].Clone(); Main.mouseItem.stack = 0; } Main.mouseItem.stack++; Main.player[Main.myPlayer].inventory[num10].stack--; if (Main.player[Main.myPlayer].inventory[num10].stack <= 0) { Main.player[Main.myPlayer].inventory[num10] = new Item(); } Recipe.FindRecipes(); Main.soundInstanceMenuTick.Stop(); Main.soundInstanceMenuTick = Main.soundMenuTick.CreateInstance(); Main.PlaySound(12, -1, -1, 1); if (Main.stackSplit == 0) { Main.stackSplit = 15; } else { Main.stackSplit = Main.stackDelay; } } } } } Main.hoverItemName = Main.player[Main.myPlayer].inventory[num10].name; Main.toolTip = (Item)Main.player[Main.myPlayer].inventory[num10].Clone(); if (Main.player[Main.myPlayer].inventory[num10].stack > 1) { object obj = Main.hoverItemName; Main.hoverItemName = string.Concat(new object[] { obj, " (", Main.player[Main.myPlayer].inventory[num10].stack, ")" }); } } if (k != 0) { this.spriteBatch.Draw(Main.inventoryBackTexture, new Vector2((float)num8, (float)num9), new Rectangle?(new Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height)), Main.inventoryBack, 0f, default(Vector2), Main.inventoryScale, SpriteEffects.None, 0f); } else { this.spriteBatch.Draw(Main.inventoryBack9Texture, new Vector2((float)num8, (float)num9), new Rectangle?(new Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height)), Main.inventoryBack, 0f, default(Vector2), Main.inventoryScale, SpriteEffects.None, 0f); } white2 = Color.White; if (Main.player[Main.myPlayer].inventory[num10].type > 0 && Main.player[Main.myPlayer].inventory[num10].stack > 0) { float num13 = 1f; if (Main.itemTexture[Main.player[Main.myPlayer].inventory[num10].type].Width > 32 || Main.itemTexture[Main.player[Main.myPlayer].inventory[num10].type].Height > 32) { if (Main.itemTexture[Main.player[Main.myPlayer].inventory[num10].type].Width > Main.itemTexture[Main.player[Main.myPlayer].inventory[num10].type].Height) { num13 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num10].type].Width; } else { num13 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num10].type].Height; } } num13 *= Main.inventoryScale; if (Main.player[Main.myPlayer].inventory[num10].type == 662 || Main.player[Main.myPlayer].inventory[num10].type == 663) { white2.R = (byte)Main.DiscoR; white2.G = (byte)Main.DiscoG; white2.B = (byte)Main.DiscoB; white2.A = 255; } this.spriteBatch.Draw(Main.itemTexture[Main.player[Main.myPlayer].inventory[num10].type], new Vector2((float)num8 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num10].type].Width * 0.5f * num13, (float)num9 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num10].type].Height * 0.5f * num13), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].inventory[num10].type].Width, Main.itemTexture[Main.player[Main.myPlayer].inventory[num10].type].Height)), Main.player[Main.myPlayer].inventory[num10].GetAlpha(white2), 0f, default(Vector2), num13, SpriteEffects.None, 0f); white2 = Color.White; if (Main.player[Main.myPlayer].inventory[num10].color != default(Color)) { this.spriteBatch.Draw(Main.itemTexture[Main.player[Main.myPlayer].inventory[num10].type], new Vector2((float)num8 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num10].type].Width * 0.5f * num13, (float)num9 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num10].type].Height * 0.5f * num13), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].inventory[num10].type].Width, Main.itemTexture[Main.player[Main.myPlayer].inventory[num10].type].Height)), Main.player[Main.myPlayer].inventory[num10].GetColor(white2), 0f, default(Vector2), num13, SpriteEffects.None, 0f); } if (Main.player[Main.myPlayer].inventory[num10].stack > 1) { this.spriteBatch.DrawString(Main.fontItemStack, string.Concat(Main.player[Main.myPlayer].inventory[num10].stack), new Vector2((float)num8 + 10f * Main.inventoryScale, (float)num9 + 26f * Main.inventoryScale), white2, 0f, default(Vector2), num13, SpriteEffects.None, 0f); } } if (k == 0) { string text = string.Concat(num10 + 1); if (text == "10") { text = "0"; } Color color = Main.inventoryBack; if (Main.player[Main.myPlayer].selectedItem == num10) { color.R = 0; color.B = 0; color.G = 255; color.A = 50; } this.spriteBatch.DrawString(Main.fontItemStack, text, new Vector2((float)(num8 + 6), (float)(num9 + 4)), color, 0f, default(Vector2), Main.inventoryScale * 0.8f, SpriteEffects.None, 0f); } } } int num14 = 0; int num15 = 2; int num16 = 32; if (!Main.player[Main.myPlayer].hbLocked) { num14 = 1; } this.spriteBatch.Draw(Main.HBLockTexture[num14], new Vector2((float)num15, (float)num16), new Rectangle?(new Rectangle(0, 0, Main.HBLockTexture[num14].Width, Main.HBLockTexture[num14].Height)), Main.inventoryBack, 0f, default(Vector2), 0.9f, SpriteEffects.None, 0f); if (Main.mouseX > num15 && (float)Main.mouseX < (float)num15 + (float)Main.HBLockTexture[num14].Width * 0.9f && Main.mouseY > num16 && (float)Main.mouseY < (float)num16 + (float)Main.HBLockTexture[num14].Height * 0.9f) { Main.player[Main.myPlayer].mouseInterface = true; if (!Main.player[Main.myPlayer].hbLocked) { this.MouseText(Lang.inter[5], 0, 0); Main.mouseText = true; } else { this.MouseText(Lang.inter[6], 0, 0); Main.mouseText = true; } if (Main.mouseLeft && Main.mouseLeftRelease) { Main.PlaySound(22, -1, -1, 1); if (!Main.player[Main.myPlayer].hbLocked) { Main.player[Main.myPlayer].hbLocked = true; } else { Main.player[Main.myPlayer].hbLocked = false; } } } if (Main.mapEnabled) { bool flag2 = false; int num17 = Main.screenWidth - 440; int num18 = 40; if (Main.screenWidth < 940) { flag2 = true; } if (flag2) { num17 = Main.screenWidth - 40; num18 = Main.screenHeight - 200; } for (int l = 0; l < 4; l++) { int num19 = num17 + l * 32; int num20 = num18; if (flag2) { num19 = num17; num20 = num18 + l * 32; } int num21 = l; int num22 = 120; if (l > 0 && Main.mapStyle == l - 1) { num22 = 200; } if (Main.mouseX >= num19 && Main.mouseX <= num19 + 32 && Main.mouseY >= num20 && Main.mouseY <= num20 + 30) { num22 = 255; num21 += 4; Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeft && Main.mouseLeftRelease) { if (l == 0) { Main.playerInventory = false; Main.player[Main.myPlayer].talkNPC = -1; Main.PlaySound(10, -1, -1, 1); float num23 = 2.5f; Main.mapFullscreenScale = num23; Main.mapFullscreen = true; Main.resetMapFull = true; } if (l == 1) { Main.mapStyle = 0; Main.PlaySound(12, -1, -1, 1); } if (l == 2) { Main.mapStyle = 1; Main.PlaySound(12, -1, -1, 1); } if (l == 3) { Main.mapStyle = 2; Main.PlaySound(12, -1, -1, 1); } } } this.spriteBatch.Draw(this.mapIconTexture[num21], new Vector2((float)num19, (float)num20), new Rectangle?(new Rectangle(0, 0, this.mapIconTexture[num21].Width, this.mapIconTexture[num21].Height)), new Color(num22, num22, num22, num22), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } if (Main.armorHide) { Main.armorAlpha -= 0.1f; if (Main.armorAlpha < 0f) { Main.armorAlpha = 0f; } } else { Main.armorAlpha += 0.025f; if (Main.armorAlpha > 1f) { Main.armorAlpha = 1f; } } Color color2 = new Color((int)((byte)((float)Main.mouseTextColor * Main.armorAlpha)), (int)((byte)((float)Main.mouseTextColor * Main.armorAlpha)), (int)((byte)((float)Main.mouseTextColor * Main.armorAlpha)), (int)((byte)((float)Main.mouseTextColor * Main.armorAlpha))); Main.armorHide = false; int num24 = 1; int num25 = Main.screenWidth - 152; int num26 = 128 + Main.mH; if (Main.netMode == 0) { num25 += 72; } if (this.showNPCs) { num24 = 0; } this.spriteBatch.Draw(Main.npcToggleTexture[num24], new Vector2((float)num25, (float)num26), new Rectangle?(new Rectangle(0, 0, Main.npcToggleTexture[num24].Width, Main.npcToggleTexture[num24].Height)), Color.White, 0f, default(Vector2), 0.9f, SpriteEffects.None, 0f); if (Main.mouseX > num25 && (float)Main.mouseX < (float)num25 + (float)Main.npcToggleTexture[num24].Width * 0.9f && Main.mouseY > num26 && (float)Main.mouseY < (float)num26 + (float)Main.npcToggleTexture[num24].Height * 0.9f) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeft && Main.mouseLeftRelease) { Main.PlaySound(12, -1, -1, 1); if (!this.showNPCs) { this.showNPCs = true; } else { this.showNPCs = false; } } } if (this.showNPCs) { this.spriteBatch.DrawString(Main.fontMouseText, Lang.inter[7], new Vector2((float)(Main.screenWidth - 64 - 28 - 3), (float)(152 + Main.mH)), new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), 0f, default(Vector2), 0.8f, SpriteEffects.None, 0f); if (Main.mouseX > Main.screenWidth - 64 - 28 && Main.mouseX < (int)((float)(Main.screenWidth - 64 - 28) + 56f * Main.inventoryScale) && Main.mouseY > 174 + Main.mH && Main.mouseY < (int)((float)(174 + Main.mH) + 448f * Main.inventoryScale)) { Main.player[Main.myPlayer].mouseInterface = true; } int num27 = 0; string cursorText = ""; int num28 = 0; int num29 = 0; for (int m = 0; m < Main.npcHeadTexture.Length; m++) { bool flag3 = false; int num30 = 0; if (m == 0) { flag3 = true; } else { for (int n = 0; n < 200; n++) { if (Main.npc[n].active && NPC.TypeToNum(Main.npc[n].type) == m) { flag3 = true; num30 = n; break; } } } if (flag3) { int num31 = Main.screenWidth - 64 - 28 + num29; int num32 = (int)((float)(174 + Main.mH) + (float)(num27 * 56) * Main.inventoryScale) + num28; Color white3 = new Color(100, 100, 100, 100); if (num32 > Main.screenHeight - 80) { num29 -= 48; num28 -= num32 - (174 + Main.mH); num31 = Main.screenWidth - 64 - 28 + num29; num32 = (int)((float)(174 + Main.mH) + (float)(num27 * 56) * Main.inventoryScale) + num28; } if (Main.mouseX >= num31 && (float)Main.mouseX <= (float)num31 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num32 && (float)Main.mouseY <= (float)num32 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale) { Main.mouseText = true; if (m == 0) { cursorText = Lang.inter[8]; } else { if (m == 11) { cursorText = Main.npc[num30].displayName; } else { cursorText = Main.npc[num30].displayName + " the " + Main.npc[num30].name; } } Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft && Main.mouseItem.type == 0) { Main.PlaySound(12, -1, -1, 1); this.mouseNPC = m; Main.mouseLeftRelease = false; } } this.spriteBatch.Draw(Main.inventoryBack11Texture, new Vector2((float)num31, (float)num32), new Rectangle?(new Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height)), Main.inventoryBack, 0f, default(Vector2), Main.inventoryScale, SpriteEffects.None, 0f); white3 = Color.White; int num33 = m; float scale = 1f; float num34; if (Main.npcHeadTexture[num33].Width > Main.npcHeadTexture[num33].Height) { num34 = (float)Main.npcHeadTexture[num33].Width; } else { num34 = (float)Main.npcHeadTexture[num33].Height; } if (num34 > 36f) { scale = 36f / num34; } this.spriteBatch.Draw(Main.npcHeadTexture[num33], new Vector2((float)num31 + 26f * Main.inventoryScale, (float)num32 + 26f * Main.inventoryScale), new Rectangle?(new Rectangle(0, 0, Main.npcHeadTexture[num33].Width, Main.npcHeadTexture[num33].Height)), white3, 0f, new Vector2((float)(Main.npcHeadTexture[num33].Width / 2), (float)(Main.npcHeadTexture[num33].Height / 2)), scale, SpriteEffects.None, 0f); num27++; } } if (cursorText != "" && Main.mouseItem.type == 0) { this.MouseText(cursorText, 0, 0); } } else { Vector2 vector = Main.fontMouseText.MeasureString("Equip"); Vector2 vector2 = Main.fontMouseText.MeasureString(Lang.inter[45]); float num35 = vector.X / vector2.X; this.spriteBatch.DrawString(Main.fontMouseText, Lang.inter[45], new Vector2((float)(Main.screenWidth - 64 - 28 + 4), (float)(152 + Main.mH) + (vector.Y - vector.Y * num35) / 2f), new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), 0f, default(Vector2), 0.8f * num35, SpriteEffects.None, 0f); if (Main.mouseX > Main.screenWidth - 64 - 28 && Main.mouseX < (int)((float)(Main.screenWidth - 64 - 28) + 56f * Main.inventoryScale) && Main.mouseY > 174 + Main.mH && Main.mouseY < (int)((float)(174 + Main.mH) + 448f * Main.inventoryScale)) { Main.player[Main.myPlayer].mouseInterface = true; } for (int num36 = 0; num36 < 8; num36++) { int num37 = Main.screenWidth - 64 - 28; int num38 = (int)((float)(174 + Main.mH) + (float)(num36 * 56) * Main.inventoryScale); Color white4 = new Color(100, 100, 100, 100); string text2 = ""; if (num36 == 3) { text2 = Lang.inter[9]; } if (num36 == 7) { text2 = Main.player[Main.myPlayer].statDefense + " " + Lang.inter[10]; } Vector2 vector3 = Main.fontMouseText.MeasureString(text2); this.spriteBatch.DrawString(Main.fontMouseText, text2, new Vector2((float)num37 - vector3.X - 10f, (float)num38 + (float)Main.inventoryBackTexture.Height * 0.5f - vector3.Y * 0.5f), color2, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); if (Main.mouseX >= num37 && (float)Main.mouseX <= (float)num37 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num38 && (float)Main.mouseY <= (float)num38 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale) { Main.armorHide = true; Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft && (Main.mouseItem.type == 0 || (Main.mouseItem.headSlot > -1 && num36 == 0) || (Main.mouseItem.bodySlot > -1 && num36 == 1) || (Main.mouseItem.legSlot > -1 && num36 == 2) || (Main.mouseItem.accessory && num36 > 2 && !Main.AccCheck(Main.mouseItem, num36)))) { Item item3 = Main.mouseItem; Main.mouseItem = Main.player[Main.myPlayer].armor[num36]; Main.player[Main.myPlayer].armor[num36] = item3; if (Main.player[Main.myPlayer].armor[num36].type == 0 || Main.player[Main.myPlayer].armor[num36].stack < 1) { Main.player[Main.myPlayer].armor[num36] = new Item(); } if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1) { Main.mouseItem = new Item(); } if (Main.mouseItem.type > 0 || Main.player[Main.myPlayer].armor[num36].type > 0) { Recipe.FindRecipes(); Main.PlaySound(7, -1, -1, 1); } } Main.hoverItemName = Main.player[Main.myPlayer].armor[num36].name; Main.toolTip = (Item)Main.player[Main.myPlayer].armor[num36].Clone(); if (num36 <= 2) { Main.toolTip.wornArmor = true; } if (Main.player[Main.myPlayer].armor[num36].stack > 1) { object obj = Main.hoverItemName; Main.hoverItemName = string.Concat(new object[] { obj, " (", Main.player[Main.myPlayer].armor[num36].stack, ")" }); } } this.spriteBatch.Draw(Main.inventoryBack3Texture, new Vector2((float)num37, (float)num38), new Rectangle?(new Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height)), Main.inventoryBack, 0f, default(Vector2), Main.inventoryScale, SpriteEffects.None, 0f); white4 = Color.White; if (Main.player[Main.myPlayer].armor[num36].type > 0 && Main.player[Main.myPlayer].armor[num36].stack > 0) { float num39 = 1f; if (Main.itemTexture[Main.player[Main.myPlayer].armor[num36].type].Width > 32 || Main.itemTexture[Main.player[Main.myPlayer].armor[num36].type].Height > 32) { if (Main.itemTexture[Main.player[Main.myPlayer].armor[num36].type].Width > Main.itemTexture[Main.player[Main.myPlayer].armor[num36].type].Height) { num39 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].armor[num36].type].Width; } else { num39 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].armor[num36].type].Height; } } num39 *= Main.inventoryScale; this.spriteBatch.Draw(Main.itemTexture[Main.player[Main.myPlayer].armor[num36].type], new Vector2((float)num37 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].armor[num36].type].Width * 0.5f * num39, (float)num38 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].armor[num36].type].Height * 0.5f * num39), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].armor[num36].type].Width, Main.itemTexture[Main.player[Main.myPlayer].armor[num36].type].Height)), Main.player[Main.myPlayer].armor[num36].GetAlpha(white4), 0f, default(Vector2), num39, SpriteEffects.None, 0f); if (Main.player[Main.myPlayer].armor[num36].color != default(Color)) { this.spriteBatch.Draw(Main.itemTexture[Main.player[Main.myPlayer].armor[num36].type], new Vector2((float)num37 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].armor[num36].type].Width * 0.5f * num39, (float)num38 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].armor[num36].type].Height * 0.5f * num39), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].armor[num36].type].Width, Main.itemTexture[Main.player[Main.myPlayer].armor[num36].type].Height)), Main.player[Main.myPlayer].armor[num36].GetColor(white4), 0f, default(Vector2), num39, SpriteEffects.None, 0f); } if (Main.player[Main.myPlayer].armor[num36].stack > 1) { this.spriteBatch.DrawString(Main.fontItemStack, string.Concat(Main.player[Main.myPlayer].armor[num36].stack), new Vector2((float)num37 + 10f * Main.inventoryScale, (float)num38 + 26f * Main.inventoryScale), white4, 0f, default(Vector2), num39, SpriteEffects.None, 0f); } } } Vector2 vector4 = Main.fontMouseText.MeasureString("Social"); Vector2 vector5 = Main.fontMouseText.MeasureString(Lang.inter[11]); float num40 = vector4.X / vector5.X; this.spriteBatch.DrawString(Main.fontMouseText, Lang.inter[11], new Vector2((float)(Main.screenWidth - 64 - 28 - 44), (float)(152 + Main.mH) + (vector4.Y - vector4.Y * num40) / 2f), new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), 0f, default(Vector2), 0.8f * num40, SpriteEffects.None, 0f); if (Main.mouseX > Main.screenWidth - 64 - 28 - 47 && Main.mouseX < (int)((float)(Main.screenWidth - 64 - 20 - 47) + 56f * Main.inventoryScale) && Main.mouseY > 174 + Main.mH && Main.mouseY < (int)((float)(174 + Main.mH) + 168f * Main.inventoryScale)) { Main.player[Main.myPlayer].mouseInterface = true; } for (int num41 = 8; num41 < 11; num41++) { int num42 = Main.screenWidth - 64 - 28 - 47; int num43 = (int)((float)(174 + Main.mH) + (float)((num41 - 8) * 56) * Main.inventoryScale); Color white5 = new Color(100, 100, 100, 100); string text3 = ""; if (num41 == 8) { text3 = Lang.inter[12]; } else { if (num41 == 9) { text3 = Lang.inter[13]; } else { if (num41 == 10) { text3 = Lang.inter[14]; } } } Vector2 vector6 = Main.fontMouseText.MeasureString(text3); this.spriteBatch.DrawString(Main.fontMouseText, text3, new Vector2((float)num42 - vector6.X - 10f - 47f, (float)num43 + (float)Main.inventoryBackTexture.Height * 0.5f - vector6.Y * 0.5f), color2, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); if (Main.mouseX >= num42 && (float)Main.mouseX <= (float)num42 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num43 && (float)Main.mouseY <= (float)num43 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale) { Main.player[Main.myPlayer].mouseInterface = true; Main.armorHide = true; if (Main.mouseLeftRelease && Main.mouseLeft) { if (Main.mouseItem.type == 0 || (Main.mouseItem.headSlot > -1 && num41 == 8) || (Main.mouseItem.bodySlot > -1 && num41 == 9) || (Main.mouseItem.legSlot > -1 && num41 == 10)) { Item item4 = Main.mouseItem; Main.mouseItem = Main.player[Main.myPlayer].armor[num41]; Main.player[Main.myPlayer].armor[num41] = item4; if (Main.player[Main.myPlayer].armor[num41].type == 0 || Main.player[Main.myPlayer].armor[num41].stack < 1) { Main.player[Main.myPlayer].armor[num41] = new Item(); } if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1) { Main.mouseItem = new Item(); } if (Main.mouseItem.type > 0 || Main.player[Main.myPlayer].armor[num41].type > 0) { Recipe.FindRecipes(); Main.PlaySound(7, -1, -1, 1); } } } else { if (Main.mouseRight && Main.mouseRightRelease && Main.player[Main.myPlayer].armor[num41].maxStack == 1) { Main.player[Main.myPlayer].armor[num41] = Main.armorSwap(Main.player[Main.myPlayer].armor[num41]); } } Main.hoverItemName = Main.player[Main.myPlayer].armor[num41].name; Main.toolTip = (Item)Main.player[Main.myPlayer].armor[num41].Clone(); Main.toolTip.social = true; if (num41 <= 2) { Main.toolTip.wornArmor = true; } if (Main.player[Main.myPlayer].armor[num41].stack > 1) { object obj = Main.hoverItemName; Main.hoverItemName = string.Concat(new object[] { obj, " (", Main.player[Main.myPlayer].armor[num41].stack, ")" }); } } this.spriteBatch.Draw(Main.inventoryBack8Texture, new Vector2((float)num42, (float)num43), new Rectangle?(new Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height)), Main.inventoryBack, 0f, default(Vector2), Main.inventoryScale, SpriteEffects.None, 0f); white5 = Color.White; if (Main.player[Main.myPlayer].armor[num41].type > 0 && Main.player[Main.myPlayer].armor[num41].stack > 0) { float num44 = 1f; if (Main.itemTexture[Main.player[Main.myPlayer].armor[num41].type].Width > 32 || Main.itemTexture[Main.player[Main.myPlayer].armor[num41].type].Height > 32) { if (Main.itemTexture[Main.player[Main.myPlayer].armor[num41].type].Width > Main.itemTexture[Main.player[Main.myPlayer].armor[num41].type].Height) { num44 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].armor[num41].type].Width; } else { num44 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].armor[num41].type].Height; } } num44 *= Main.inventoryScale; this.spriteBatch.Draw(Main.itemTexture[Main.player[Main.myPlayer].armor[num41].type], new Vector2((float)num42 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].armor[num41].type].Width * 0.5f * num44, (float)num43 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].armor[num41].type].Height * 0.5f * num44), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].armor[num41].type].Width, Main.itemTexture[Main.player[Main.myPlayer].armor[num41].type].Height)), Main.player[Main.myPlayer].armor[num41].GetAlpha(white5), 0f, default(Vector2), num44, SpriteEffects.None, 0f); if (Main.player[Main.myPlayer].armor[num41].color != default(Color)) { this.spriteBatch.Draw(Main.itemTexture[Main.player[Main.myPlayer].armor[num41].type], new Vector2((float)num42 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].armor[num41].type].Width * 0.5f * num44, (float)num43 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].armor[num41].type].Height * 0.5f * num44), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].armor[num41].type].Width, Main.itemTexture[Main.player[Main.myPlayer].armor[num41].type].Height)), Main.player[Main.myPlayer].armor[num41].GetColor(white5), 0f, default(Vector2), num44, SpriteEffects.None, 0f); } if (Main.player[Main.myPlayer].armor[num41].stack > 1) { this.spriteBatch.DrawString(Main.fontItemStack, string.Concat(Main.player[Main.myPlayer].armor[num41].stack), new Vector2((float)num42 + 10f * Main.inventoryScale, (float)num43 + 26f * Main.inventoryScale), white5, 0f, default(Vector2), num44, SpriteEffects.None, 0f); } } } Vector2 vector7 = Main.fontMouseText.MeasureString("Dye"); Vector2 vector8 = Main.fontMouseText.MeasureString(Lang.inter[57]); float num45 = vector7.X / vector8.X; this.spriteBatch.DrawString(Main.fontMouseText, Lang.inter[57], new Vector2((float)(Main.screenWidth - 64 - 28 - 44 - 40), (float)(152 + Main.mH) + (vector7.Y - vector7.Y * num45) / 2f), new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), 0f, default(Vector2), 0.8f * num45, SpriteEffects.None, 0f); if (Main.mouseX > Main.screenWidth - 64 - 28 - 47 && Main.mouseX < (int)((float)(Main.screenWidth - 64 - 20 - 47) + 56f * Main.inventoryScale) && Main.mouseY > 174 + Main.mH && Main.mouseY < (int)((float)(174 + Main.mH) + 168f * Main.inventoryScale)) { Main.player[Main.myPlayer].mouseInterface = true; } for (int num46 = 0; num46 < 3; num46++) { int num47 = Main.screenWidth - 64 - 28 - 47 - 47; int num48 = (int)((float)(174 + Main.mH) + (float)(num46 * 56) * Main.inventoryScale); Color white6 = new Color(100, 100, 100, 100); if (Main.mouseX >= num47 && (float)Main.mouseX <= (float)num47 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num48 && (float)Main.mouseY <= (float)num48 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale) { Main.player[Main.myPlayer].mouseInterface = true; Main.armorHide = true; if (Main.mouseLeftRelease && Main.mouseLeft && (Main.mouseItem.type == 0 || Main.mouseItem.dye > 0)) { Item item5 = Main.mouseItem; Main.mouseItem = Main.player[Main.myPlayer].dye[num46]; Main.player[Main.myPlayer].dye[num46] = item5; if (Main.player[Main.myPlayer].dye[num46].type == 0 || Main.player[Main.myPlayer].dye[num46].stack < 1) { Main.player[Main.myPlayer].dye[num46] = new Item(); } if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1) { Main.mouseItem = new Item(); } if (Main.mouseItem.type > 0 || Main.player[Main.myPlayer].dye[num46].type > 0) { Recipe.FindRecipes(); Main.PlaySound(7, -1, -1, 1); } } Main.hoverItemName = Main.player[Main.myPlayer].dye[num46].name; Main.toolTip = (Item)Main.player[Main.myPlayer].dye[num46].Clone(); if (Main.player[Main.myPlayer].dye[num46].stack > 1) { object obj = Main.hoverItemName; Main.hoverItemName = string.Concat(new object[] { obj, " (", Main.player[Main.myPlayer].dye[num46].stack, ")" }); } } this.spriteBatch.Draw(Main.inventoryBack12Texture, new Vector2((float)num47, (float)num48), new Rectangle?(new Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height)), Main.inventoryBack, 0f, default(Vector2), Main.inventoryScale, SpriteEffects.None, 0f); white6 = Color.White; if (Main.player[Main.myPlayer].dye[num46].type > 0 && Main.player[Main.myPlayer].dye[num46].stack > 0) { float num49 = 1f; if (Main.itemTexture[Main.player[Main.myPlayer].dye[num46].type].Width > 32 || Main.itemTexture[Main.player[Main.myPlayer].dye[num46].type].Height > 32) { if (Main.itemTexture[Main.player[Main.myPlayer].dye[num46].type].Width > Main.itemTexture[Main.player[Main.myPlayer].dye[num46].type].Height) { num49 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].dye[num46].type].Width; } else { num49 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].dye[num46].type].Height; } } num49 *= Main.inventoryScale; this.spriteBatch.Draw(Main.itemTexture[Main.player[Main.myPlayer].dye[num46].type], new Vector2((float)num47 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].dye[num46].type].Width * 0.5f * num49, (float)num48 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].dye[num46].type].Height * 0.5f * num49), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].dye[num46].type].Width, Main.itemTexture[Main.player[Main.myPlayer].dye[num46].type].Height)), Main.player[Main.myPlayer].dye[num46].GetAlpha(white6), 0f, default(Vector2), num49, SpriteEffects.None, 0f); if (Main.player[Main.myPlayer].dye[num46].color != default(Color)) { this.spriteBatch.Draw(Main.itemTexture[Main.player[Main.myPlayer].dye[num46].type], new Vector2((float)num47 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].dye[num46].type].Width * 0.5f * num49, (float)num48 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].dye[num46].type].Height * 0.5f * num49), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].dye[num46].type].Width, Main.itemTexture[Main.player[Main.myPlayer].dye[num46].type].Height)), Main.player[Main.myPlayer].dye[num46].GetColor(white6), 0f, default(Vector2), num49, SpriteEffects.None, 0f); } if (Main.player[Main.myPlayer].dye[num46].stack > 1) { this.spriteBatch.DrawString(Main.fontItemStack, string.Concat(Main.player[Main.myPlayer].dye[num46].stack), new Vector2((float)num47 + 10f * Main.inventoryScale, (float)num48 + 26f * Main.inventoryScale), white6, 0f, default(Vector2), num49, SpriteEffects.None, 0f); } } } } int num50 = (Main.screenHeight - 600) / 2; int num51 = (int)((float)Main.screenHeight / 600f * 250f); if (Main.screenHeight < 700) { num50 = (Main.screenHeight - 508) / 2; num51 = (int)((float)Main.screenHeight / 600f * 200f); } else { if (Main.screenHeight < 850) { num51 = (int)((float)Main.screenHeight / 600f * 225f); } } if (Main.craftingHide) { Main.craftingAlpha -= 0.1f; if (Main.craftingAlpha < 0f) { Main.craftingAlpha = 0f; } } else { Main.craftingAlpha += 0.025f; if (Main.craftingAlpha > 1f) { Main.craftingAlpha = 1f; } } Color color3 = new Color((int)((byte)((float)Main.mouseTextColor * Main.craftingAlpha)), (int)((byte)((float)Main.mouseTextColor * Main.craftingAlpha)), (int)((byte)((float)Main.mouseTextColor * Main.craftingAlpha)), (int)((byte)((float)Main.mouseTextColor * Main.craftingAlpha))); Main.craftingHide = false; if (Main.reforge) { if (Main.mouseReforge) { if ((double)Main.reforgeScale < 1.3) { Main.reforgeScale += 0.02f; } } else { if (Main.reforgeScale > 1f) { Main.reforgeScale -= 0.02f; } } if (Main.player[Main.myPlayer].chest != -1 || Main.npcShop != 0 || Main.player[Main.myPlayer].talkNPC == -1 || Main.craftGuide) { Main.reforge = false; Main.player[Main.myPlayer].dropItemCheck(); Recipe.FindRecipes(); } else { int num52 = 50; int num53 = 270; string text4 = Lang.inter[46] + ": "; if (Main.reforgeItem.type > 0) { int num54 = Main.reforgeItem.value; if (Main.player[Main.myPlayer].discount) { num54 = (int)((double)num54 * 0.8); } num54 /= 2; string text5 = ""; int num55 = 0; int num56 = 0; int num57 = 0; int num58 = 0; int num59 = num54; if (num59 < 1) { num59 = 1; } if (num59 >= 1000000) { num55 = num59 / 1000000; num59 -= num55 * 1000000; } if (num59 >= 10000) { num56 = num59 / 10000; num59 -= num56 * 10000; } if (num59 >= 100) { num57 = num59 / 100; num59 -= num57 * 100; } if (num59 >= 1) { num58 = num59; } if (num55 > 0) { object obj = text5; text5 = string.Concat(new object[] { obj, num55, " ", Lang.inter[15], " " }); } if (num56 > 0) { object obj = text5; text5 = string.Concat(new object[] { obj, num56, " ", Lang.inter[16], " " }); } if (num57 > 0) { object obj = text5; text5 = string.Concat(new object[] { obj, num57, " ", Lang.inter[17], " " }); } if (num58 > 0) { object obj = text5; text5 = string.Concat(new object[] { obj, num58, " ", Lang.inter[18], " " }); } float num60 = (float)Main.mouseTextColor / 255f; Color white7 = Color.White; if (num55 > 0) { white7 = new Color((int)((byte)(220f * num60)), (int)((byte)(220f * num60)), (int)((byte)(198f * num60)), (int)Main.mouseTextColor); } else { if (num56 > 0) { white7 = new Color((int)((byte)(224f * num60)), (int)((byte)(201f * num60)), (int)((byte)(92f * num60)), (int)Main.mouseTextColor); } else { if (num57 > 0) { white7 = new Color((int)((byte)(181f * num60)), (int)((byte)(192f * num60)), (int)((byte)(193f * num60)), (int)Main.mouseTextColor); } else { if (num58 > 0) { white7 = new Color((int)((byte)(246f * num60)), (int)((byte)(138f * num60)), (int)((byte)(96f * num60)), (int)Main.mouseTextColor); } } } } this.spriteBatch.DrawString(Main.fontMouseText, text5, new Vector2((float)(num52 + 50) + Main.fontMouseText.MeasureString(text4).X, (float)num53), white7, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); int num61 = num52 + 70; int num62 = num53 + 40; this.spriteBatch.Draw(Main.reforgeTexture, new Vector2((float)num61, (float)num62), new Rectangle?(new Rectangle(0, 0, Main.reforgeTexture.Width, Main.reforgeTexture.Height)), Color.White, 0f, new Vector2((float)(Main.reforgeTexture.Width / 2), (float)(Main.reforgeTexture.Height / 2)), Main.reforgeScale, SpriteEffects.None, 0f); if (Main.mouseX > num61 - Main.reforgeTexture.Width / 2 && Main.mouseX < num61 + Main.reforgeTexture.Width / 2 && Main.mouseY > num62 - Main.reforgeTexture.Height / 2 && Main.mouseY < num62 + Main.reforgeTexture.Height / 2) { Main.hoverItemName = Lang.inter[19]; if (!Main.mouseReforge) { Main.PlaySound(12, -1, -1, 1); } Main.mouseReforge = true; Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft && Main.player[Main.myPlayer].BuyItem(num54)) { 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); ItemText.NewText(Main.reforgeItem, Main.reforgeItem.stack); Main.PlaySound(2, -1, -1, 37); } } else { Main.mouseReforge = false; } } else { text4 = Lang.inter[20]; } this.spriteBatch.DrawString(Main.fontMouseText, text4, new Vector2((float)(num52 + 50), (float)num53), new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); Color white8 = new Color(100, 100, 100, 100); if (Main.mouseX >= num52 && (float)Main.mouseX <= (float)num52 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num53 && (float)Main.mouseY <= (float)num53 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale) { Main.player[Main.myPlayer].mouseInterface = true; Main.craftingHide = true; if (Main.mouseItem.Prefix(-3) || Main.mouseItem.type == 0) { if (Main.mouseLeftRelease && Main.mouseLeft && Main.player[Main.myPlayer].itemTime == 0) { Item item6 = Main.mouseItem; Main.mouseItem = Main.reforgeItem; Main.reforgeItem = item6; if (Main.reforgeItem.type == 0 || Main.reforgeItem.stack < 1) { Main.reforgeItem = new Item(); } if (Main.mouseItem.IsTheSameAs(Main.reforgeItem) && Main.reforgeItem.stack != Main.reforgeItem.maxStack && Main.mouseItem.stack != Main.mouseItem.maxStack) { if (Main.mouseItem.stack + Main.reforgeItem.stack <= Main.mouseItem.maxStack) { Main.reforgeItem.stack += Main.mouseItem.stack; Main.mouseItem.stack = 0; } else { int num63 = Main.mouseItem.maxStack - Main.reforgeItem.stack; Main.reforgeItem.stack += num63; Main.mouseItem.stack -= num63; } } if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1) { Main.mouseItem = new Item(); } if (Main.mouseItem.type > 0 || Main.reforgeItem.type > 0) { Recipe.FindRecipes(); Main.PlaySound(7, -1, -1, 1); } } else { if (Main.stackSplit <= 1 && Main.mouseRight && (Main.mouseItem.IsTheSameAs(Main.reforgeItem) || Main.mouseItem.type == 0) && (Main.mouseItem.stack < Main.mouseItem.maxStack || Main.mouseItem.type == 0)) { if (Main.mouseItem.type == 0) { Main.mouseItem = (Item)Main.reforgeItem.Clone(); Main.mouseItem.stack = 0; } Main.mouseItem.stack++; Main.reforgeItem.stack--; if (Main.reforgeItem.stack <= 0) { Main.reforgeItem = new Item(); } Recipe.FindRecipes(); Main.soundInstanceMenuTick.Stop(); Main.soundInstanceMenuTick = Main.soundMenuTick.CreateInstance(); Main.PlaySound(12, -1, -1, 1); if (Main.stackSplit == 0) { Main.stackSplit = 15; } else { Main.stackSplit = Main.stackDelay; } } } } Main.hoverItemName = Main.reforgeItem.name; Main.toolTip = (Item)Main.reforgeItem.Clone(); if (Main.reforgeItem.stack > 1) { object obj = Main.hoverItemName; Main.hoverItemName = string.Concat(new object[] { obj, " (", Main.reforgeItem.stack, ")" }); } } this.spriteBatch.Draw(Main.inventoryBack4Texture, new Vector2((float)num52, (float)num53), new Rectangle?(new Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height)), Main.inventoryBack, 0f, default(Vector2), Main.inventoryScale, SpriteEffects.None, 0f); white8 = Color.White; if (Main.reforgeItem.type > 0 && Main.reforgeItem.stack > 0) { float num64 = 1f; if (Main.itemTexture[Main.reforgeItem.type].Width > 32 || Main.itemTexture[Main.reforgeItem.type].Height > 32) { if (Main.itemTexture[Main.reforgeItem.type].Width > Main.itemTexture[Main.reforgeItem.type].Height) { num64 = 32f / (float)Main.itemTexture[Main.reforgeItem.type].Width; } else { num64 = 32f / (float)Main.itemTexture[Main.reforgeItem.type].Height; } } num64 *= Main.inventoryScale; this.spriteBatch.Draw(Main.itemTexture[Main.reforgeItem.type], new Vector2((float)num52 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.reforgeItem.type].Width * 0.5f * num64, (float)num53 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.reforgeItem.type].Height * 0.5f * num64), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.reforgeItem.type].Width, Main.itemTexture[Main.reforgeItem.type].Height)), Main.reforgeItem.GetAlpha(white8), 0f, default(Vector2), num64, SpriteEffects.None, 0f); if (Main.reforgeItem.color != default(Color)) { this.spriteBatch.Draw(Main.itemTexture[Main.reforgeItem.type], new Vector2((float)num52 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.reforgeItem.type].Width * 0.5f * num64, (float)num53 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.reforgeItem.type].Height * 0.5f * num64), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.reforgeItem.type].Width, Main.itemTexture[Main.reforgeItem.type].Height)), Main.reforgeItem.GetColor(white8), 0f, default(Vector2), num64, SpriteEffects.None, 0f); } if (Main.reforgeItem.stack > 1) { this.spriteBatch.DrawString(Main.fontItemStack, string.Concat(Main.reforgeItem.stack), new Vector2((float)num52 + 10f * Main.inventoryScale, (float)num53 + 26f * Main.inventoryScale), white8, 0f, default(Vector2), num64, SpriteEffects.None, 0f); } } } } else { if (Main.craftGuide) { if (Main.player[Main.myPlayer].chest != -1 || Main.npcShop != 0 || Main.player[Main.myPlayer].talkNPC == -1 || Main.reforge) { Main.craftGuide = false; Main.player[Main.myPlayer].dropItemCheck(); Recipe.FindRecipes(); } else { int num65 = 73; int num66 = 331; num66 += num50; string text6; if (Main.guideItem.type > 0) { text6 = Lang.inter[21] + " " + Main.guideItem.name; this.spriteBatch.DrawString(Main.fontMouseText, Lang.inter[22], new Vector2((float)num65, (float)(num66 + 118)), color3, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); int num67 = Main.focusRecipe; int num68 = 0; int num69 = 0; while (num69 < Recipe.maxRequirements) { int num70 = (num69 + 1) * 26; if (Main.recipe[Main.availableRecipe[num67]].requiredTile[num69] == -1) { if (num69 == 0 && !Main.recipe[Main.availableRecipe[num67]].needWater && !Main.recipe[Main.availableRecipe[num67]].needHoney) { this.spriteBatch.DrawString(Main.fontMouseText, Lang.inter[23], new Vector2((float)num65, (float)(num66 + 118 + num70)), color3, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); break; } break; } else { num68++; this.spriteBatch.DrawString(Main.fontMouseText, Main.tileName[Main.recipe[Main.availableRecipe[num67]].requiredTile[num69]], new Vector2((float)num65, (float)(num66 + 118 + num70)), color3, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); num69++; } } if (Main.recipe[Main.availableRecipe[num67]].needWater) { int num71 = (num68 + 1) * 26; this.spriteBatch.DrawString(Main.fontMouseText, Lang.inter[53], new Vector2((float)num65, (float)(num66 + 118 + num71)), color3, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } if (Main.recipe[Main.availableRecipe[num67]].needHoney) { int num72 = (num68 + 1) * 26; this.spriteBatch.DrawString(Main.fontMouseText, Lang.inter[58], new Vector2((float)num65, (float)(num66 + 118 + num72)), color3, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } else { text6 = Lang.inter[24]; } this.spriteBatch.DrawString(Main.fontMouseText, text6, new Vector2((float)(num65 + 50), (float)(num66 + 12)), new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); Color white9 = new Color(100, 100, 100, 100); if (Main.mouseX >= num65 && (float)Main.mouseX <= (float)num65 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num66 && (float)Main.mouseY <= (float)num66 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale) { Main.player[Main.myPlayer].mouseInterface = true; Main.craftingHide = true; if (Main.mouseItem.material || Main.mouseItem.type == 0) { if (Main.mouseLeftRelease && Main.mouseLeft) { Item item7 = Main.mouseItem; Main.mouseItem = Main.guideItem; Main.guideItem = item7; if (Main.guideItem.type == 0 || Main.guideItem.stack < 1) { Main.guideItem = new Item(); } if (Main.mouseItem.IsTheSameAs(Main.guideItem) && Main.guideItem.stack != Main.guideItem.maxStack && Main.mouseItem.stack != Main.mouseItem.maxStack) { if (Main.mouseItem.stack + Main.guideItem.stack <= Main.mouseItem.maxStack) { Main.guideItem.stack += Main.mouseItem.stack; Main.mouseItem.stack = 0; } else { int num73 = Main.mouseItem.maxStack - Main.guideItem.stack; Main.guideItem.stack += num73; Main.mouseItem.stack -= num73; } } if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1) { Main.mouseItem = new Item(); } if (Main.mouseItem.type > 0 || Main.guideItem.type > 0) { Recipe.FindRecipes(); Main.PlaySound(7, -1, -1, 1); } } else { if (Main.stackSplit <= 1 && Main.mouseRight && (Main.mouseItem.IsTheSameAs(Main.guideItem) || Main.mouseItem.type == 0) && (Main.mouseItem.stack < Main.mouseItem.maxStack || Main.mouseItem.type == 0)) { if (Main.mouseItem.type == 0) { Main.mouseItem = (Item)Main.guideItem.Clone(); Main.mouseItem.stack = 0; } Main.mouseItem.stack++; Main.guideItem.stack--; if (Main.guideItem.stack <= 0) { Main.guideItem = new Item(); } Recipe.FindRecipes(); Main.soundInstanceMenuTick.Stop(); Main.soundInstanceMenuTick = Main.soundMenuTick.CreateInstance(); Main.PlaySound(12, -1, -1, 1); if (Main.stackSplit == 0) { Main.stackSplit = 15; } else { Main.stackSplit = Main.stackDelay; } } } } Main.hoverItemName = Main.guideItem.name; Main.toolTip = (Item)Main.guideItem.Clone(); if (Main.guideItem.stack > 1) { object obj = Main.hoverItemName; Main.hoverItemName = string.Concat(new object[] { obj, " (", Main.guideItem.stack, ")" }); } } this.spriteBatch.Draw(Main.inventoryBack4Texture, new Vector2((float)num65, (float)num66), new Rectangle?(new Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height)), Main.inventoryBack, 0f, default(Vector2), Main.inventoryScale, SpriteEffects.None, 0f); white9 = Color.White; if (Main.guideItem.type > 0 && Main.guideItem.stack > 0) { float num74 = 1f; if (Main.itemTexture[Main.guideItem.type].Width > 32 || Main.itemTexture[Main.guideItem.type].Height > 32) { if (Main.itemTexture[Main.guideItem.type].Width > Main.itemTexture[Main.guideItem.type].Height) { num74 = 32f / (float)Main.itemTexture[Main.guideItem.type].Width; } else { num74 = 32f / (float)Main.itemTexture[Main.guideItem.type].Height; } } num74 *= Main.inventoryScale; if (Main.guideItem.type == 662 || Main.guideItem.type == 663) { white9.R = (byte)Main.DiscoR; white9.G = (byte)Main.DiscoG; white9.B = (byte)Main.DiscoB; white9.A = 255; } this.spriteBatch.Draw(Main.itemTexture[Main.guideItem.type], new Vector2((float)num65 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.guideItem.type].Width * 0.5f * num74, (float)num66 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.guideItem.type].Height * 0.5f * num74), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.guideItem.type].Width, Main.itemTexture[Main.guideItem.type].Height)), Main.guideItem.GetAlpha(white9), 0f, default(Vector2), num74, SpriteEffects.None, 0f); white9 = Color.White; if (Main.guideItem.color != default(Color)) { this.spriteBatch.Draw(Main.itemTexture[Main.guideItem.type], new Vector2((float)num65 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.guideItem.type].Width * 0.5f * num74, (float)num66 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.guideItem.type].Height * 0.5f * num74), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.guideItem.type].Width, Main.itemTexture[Main.guideItem.type].Height)), Main.guideItem.GetColor(white9), 0f, default(Vector2), num74, SpriteEffects.None, 0f); } if (Main.guideItem.stack > 1) { this.spriteBatch.DrawString(Main.fontItemStack, string.Concat(Main.guideItem.stack), new Vector2((float)num65 + 10f * Main.inventoryScale, (float)num66 + 26f * Main.inventoryScale), white9, 0f, default(Vector2), num74, SpriteEffects.None, 0f); } } } } } if (!Main.reforge) { if (Main.numAvailableRecipes > 0) { this.spriteBatch.DrawString(Main.fontMouseText, Lang.inter[25], new Vector2(76f, (float)(414 + num50)), color3, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } for (int num75 = 0; num75 < Recipe.maxRecipes; num75++) { Main.inventoryScale = 100f / (Math.Abs(Main.availableRecipeY[num75]) + 100f); if ((double)Main.inventoryScale < 0.75) { Main.inventoryScale = 0.75f; } if (Main.recFastScroll) { Main.inventoryScale = 0.75f; } if (Main.availableRecipeY[num75] < (float)((num75 - Main.focusRecipe) * 65)) { if (Main.availableRecipeY[num75] == 0f && !Main.recFastScroll) { Main.PlaySound(12, -1, -1, 1); } Main.availableRecipeY[num75] += 6.5f; if (Main.recFastScroll) { Main.availableRecipeY[num75] += 130000f; } if (Main.availableRecipeY[num75] > (float)((num75 - Main.focusRecipe) * 65)) { Main.availableRecipeY[num75] = (float)((num75 - Main.focusRecipe) * 65); } } else { if (Main.availableRecipeY[num75] > (float)((num75 - Main.focusRecipe) * 65)) { if (Main.availableRecipeY[num75] == 0f && !Main.recFastScroll) { Main.PlaySound(12, -1, -1, 1); } Main.availableRecipeY[num75] -= 6.5f; if (Main.recFastScroll) { Main.availableRecipeY[num75] -= 130000f; } if (Main.availableRecipeY[num75] < (float)((num75 - Main.focusRecipe) * 65)) { Main.availableRecipeY[num75] = (float)((num75 - Main.focusRecipe) * 65); } } else { Main.recFastScroll = false; } } if (num75 < Main.numAvailableRecipes && Math.Abs(Main.availableRecipeY[num75]) <= (float)num51) { int num76 = (int)(46f - 26f * Main.inventoryScale); int num77 = (int)(410f + Main.availableRecipeY[num75] * Main.inventoryScale - 30f * Main.inventoryScale + (float)num50); double num78 = (double)(Main.inventoryBack.A + 50); double num79 = 255.0; if (Math.Abs(Main.availableRecipeY[num75]) > (float)(num51 - 100)) { num78 = (double)(150f * (100f - (Math.Abs(Main.availableRecipeY[num75]) - (float)(num51 - 100)))) * 0.01; num79 = (double)(255f * (100f - (Math.Abs(Main.availableRecipeY[num75]) - (float)(num51 - 100)))) * 0.01; } new Color((int)((byte)num78), (int)((byte)num78), (int)((byte)num78), (int)((byte)num78)); Color color4 = new Color((int)((byte)num79), (int)((byte)num79), (int)((byte)num79), (int)((byte)num79)); if (Main.mouseX >= num76 && (float)Main.mouseX <= (float)num76 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num77 && (float)Main.mouseY <= (float)num77 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.focusRecipe == num75 && Main.guideItem.type == 0) { if (Main.mouseItem.type == 0 || (Main.mouseItem.IsTheSameAs(Main.recipe[Main.availableRecipe[num75]].createItem) && Main.mouseItem.stack + Main.recipe[Main.availableRecipe[num75]].createItem.stack <= Main.mouseItem.maxStack)) { if (Main.mouseLeftRelease && Main.mouseLeft) { int stack = Main.mouseItem.stack; Main.mouseItem = (Item)Main.recipe[Main.availableRecipe[num75]].createItem.Clone(); Main.mouseItem.Prefix(-1); Main.mouseItem.stack += stack; 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, Main.recipe[Main.availableRecipe[num75]].createItem.stack); Main.recipe[Main.availableRecipe[num75]].Create(); if (Main.mouseItem.type > 0 || Main.recipe[Main.availableRecipe[num75]].createItem.type > 0) { Main.PlaySound(7, -1, -1, 1); } } else { if (Main.stackSplit <= 1 && Main.mouseRight && (Main.mouseItem.stack < Main.mouseItem.maxStack || Main.mouseItem.type == 0)) { if (Main.stackSplit == 0) { Main.stackSplit = 15; } else { Main.stackSplit = Main.stackDelay; } int stack2 = Main.mouseItem.stack; Main.mouseItem = (Item)Main.recipe[Main.availableRecipe[num75]].createItem.Clone(); Main.mouseItem.stack += stack2; 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, Main.recipe[Main.availableRecipe[num75]].createItem.stack); Main.recipe[Main.availableRecipe[num75]].Create(); if (Main.mouseItem.type > 0 || Main.recipe[Main.availableRecipe[num75]].createItem.type > 0) { Main.PlaySound(7, -1, -1, 1); } } } } } else { if (Main.mouseLeftRelease && Main.mouseLeft) { Main.focusRecipe = num75; } } Main.craftingHide = true; Main.hoverItemName = Main.recipe[Main.availableRecipe[num75]].createItem.name; Main.toolTip = (Item)Main.recipe[Main.availableRecipe[num75]].createItem.Clone(); if (Main.recipe[Main.availableRecipe[num75]].createItem.stack > 1) { object obj = Main.hoverItemName; Main.hoverItemName = string.Concat(new object[] { obj, " (", Main.recipe[Main.availableRecipe[num75]].createItem.stack, ")" }); } } if (Main.numAvailableRecipes > 0) { num78 -= 50.0; if (num78 < 0.0) { num78 = 0.0; } this.spriteBatch.Draw(Main.inventoryBack4Texture, new Vector2((float)num76, (float)num77), new Rectangle?(new Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height)), new Color((int)((byte)num78), (int)((byte)num78), (int)((byte)num78), (int)((byte)num78)), 0f, default(Vector2), Main.inventoryScale, SpriteEffects.None, 0f); if (Main.recipe[Main.availableRecipe[num75]].createItem.type > 0 && Main.recipe[Main.availableRecipe[num75]].createItem.stack > 0) { float num80 = 1f; if (Main.itemTexture[Main.recipe[Main.availableRecipe[num75]].createItem.type].Width > 32 || Main.itemTexture[Main.recipe[Main.availableRecipe[num75]].createItem.type].Height > 32) { if (Main.itemTexture[Main.recipe[Main.availableRecipe[num75]].createItem.type].Width > Main.itemTexture[Main.recipe[Main.availableRecipe[num75]].createItem.type].Height) { num80 = 32f / (float)Main.itemTexture[Main.recipe[Main.availableRecipe[num75]].createItem.type].Width; } else { num80 = 32f / (float)Main.itemTexture[Main.recipe[Main.availableRecipe[num75]].createItem.type].Height; } } num80 *= Main.inventoryScale; Color color5 = color4; if (Main.recipe[Main.availableRecipe[num75]].createItem.type == 662 || Main.recipe[Main.availableRecipe[num75]].createItem.type == 663) { color4.R = (byte)Main.DiscoR; color4.G = (byte)Main.DiscoG; color4.B = (byte)Main.DiscoB; color4.A = 255; } this.spriteBatch.Draw(Main.itemTexture[Main.recipe[Main.availableRecipe[num75]].createItem.type], new Vector2((float)num76 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.recipe[Main.availableRecipe[num75]].createItem.type].Width * 0.5f * num80, (float)num77 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.recipe[Main.availableRecipe[num75]].createItem.type].Height * 0.5f * num80), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.recipe[Main.availableRecipe[num75]].createItem.type].Width, Main.itemTexture[Main.recipe[Main.availableRecipe[num75]].createItem.type].Height)), Main.recipe[Main.availableRecipe[num75]].createItem.GetAlpha(color4), 0f, default(Vector2), num80, SpriteEffects.None, 0f); color4 = color5; if (Main.recipe[Main.availableRecipe[num75]].createItem.color != default(Color)) { this.spriteBatch.Draw(Main.itemTexture[Main.recipe[Main.availableRecipe[num75]].createItem.type], new Vector2((float)num76 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.recipe[Main.availableRecipe[num75]].createItem.type].Width * 0.5f * num80, (float)num77 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.recipe[Main.availableRecipe[num75]].createItem.type].Height * 0.5f * num80), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.recipe[Main.availableRecipe[num75]].createItem.type].Width, Main.itemTexture[Main.recipe[Main.availableRecipe[num75]].createItem.type].Height)), Main.recipe[Main.availableRecipe[num75]].createItem.GetColor(color4), 0f, default(Vector2), num80, SpriteEffects.None, 0f); } if (Main.recipe[Main.availableRecipe[num75]].createItem.stack > 1) { this.spriteBatch.DrawString(Main.fontItemStack, string.Concat(Main.recipe[Main.availableRecipe[num75]].createItem.stack), new Vector2((float)num76 + 10f * Main.inventoryScale, (float)num77 + 26f * Main.inventoryScale), color4, 0f, default(Vector2), num80, SpriteEffects.None, 0f); } } } } } if (Main.numAvailableRecipes > 0) { int num81 = 0; while (num81 < Recipe.maxRequirements && Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].type != 0) { int num82 = 80 + num81 * 40; int num83 = 380 + num50; double num84 = (double)(Main.inventoryBack.A + 50); Color white10 = Color.White; Color color6 = Color.White; num84 = (double)((float)(Main.inventoryBack.A + 50) - Math.Abs(Main.availableRecipeY[Main.focusRecipe]) * 2f); double num85 = (double)(255f - Math.Abs(Main.availableRecipeY[Main.focusRecipe]) * 2f); if (num84 < 0.0) { num84 = 0.0; } if (num85 < 0.0) { num85 = 0.0; } white10.R = (byte)num84; white10.G = (byte)num84; white10.B = (byte)num84; white10.A = (byte)num84; color6.R = (byte)num85; color6.G = (byte)num85; color6.B = (byte)num85; color6.A = (byte)num85; Main.inventoryScale = 0.6f; if (num84 == 0.0) { break; } if (Main.mouseX >= num82 && (float)Main.mouseX <= (float)num82 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num83 && (float)Main.mouseY <= (float)num83 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale) { Main.craftingHide = true; Main.player[Main.myPlayer].mouseInterface = true; Main.hoverItemName = Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].name; Main.toolTip = (Item)Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].Clone(); if (Main.recipe[Main.availableRecipe[Main.focusRecipe]].anyIronBar && Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].type == 22) { Main.toolTip.name = Main.itemName[22] + ", or " + Main.itemName[704]; } else { if (Main.recipe[Main.availableRecipe[Main.focusRecipe]].anyWood && Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].type == 9) { Main.toolTip.name = string.Concat(new string[] { Main.itemName[9], ", ", Main.itemName[620], ", ", Main.itemName[619], ", ", Main.itemName[911], ", or ", Main.itemName[621] }); } } if (Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].stack > 1) { object obj = Main.hoverItemName; Main.hoverItemName = string.Concat(new object[] { obj, " (", Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].stack, ")" }); } } num84 -= 50.0; if (num84 < 0.0) { num84 = 0.0; } this.spriteBatch.Draw(Main.inventoryBack4Texture, new Vector2((float)num82, (float)num83), new Rectangle?(new Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height)), new Color((int)((byte)num84), (int)((byte)num84), (int)((byte)num84), (int)((byte)num84)), 0f, default(Vector2), Main.inventoryScale, SpriteEffects.None, 0f); if (Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].type > 0 && Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].stack > 0) { float num86 = 1f; if (Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].type].Width > 32 || Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].type].Height > 32) { if (Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].type].Width > Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].type].Height) { num86 = 32f / (float)Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].type].Width; } else { num86 = 32f / (float)Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].type].Height; } } num86 *= Main.inventoryScale; Color color7 = color6; if (Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].type == 662 || Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].type == 663) { color6.R = (byte)Main.DiscoR; color6.G = (byte)Main.DiscoG; color6.B = (byte)Main.DiscoB; color6.A = 255; } this.spriteBatch.Draw(Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].type], new Vector2((float)num82 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].type].Width * 0.5f * num86, (float)num83 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].type].Height * 0.5f * num86), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].type].Width, Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].type].Height)), Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].GetAlpha(color6), 0f, default(Vector2), num86, SpriteEffects.None, 0f); if (Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].color != default(Color)) { this.spriteBatch.Draw(Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].type], new Vector2((float)num82 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].type].Width * 0.5f * num86, (float)num83 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].type].Height * 0.5f * num86), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].type].Width, Main.itemTexture[Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].type].Height)), Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].GetColor(color6), 0f, default(Vector2), num86, SpriteEffects.None, 0f); } color6 = color7; if (Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].stack > 1) { this.spriteBatch.DrawString(Main.fontItemStack, string.Concat(Main.recipe[Main.availableRecipe[Main.focusRecipe]].requiredItem[num81].stack), new Vector2((float)num82 + 10f * Main.inventoryScale, (float)num83 + 26f * Main.inventoryScale), color6, 0f, default(Vector2), num86, SpriteEffects.None, 0f); } } num81++; } } if (Main.player[Main.myPlayer].chest != -1 || Main.numAvailableRecipes == 0) { Main.recBigList = false; } else { int num87 = 94; int num88 = 364 + num50; if (Main.craftGuide) { num88 -= 50; } this.spriteBatch.Draw(Main.craftButtonTexture, new Vector2((float)num87, (float)num88), new Rectangle?(new Rectangle(0, 0, Main.craftButtonTexture.Width, Main.craftButtonTexture.Height)), Color.White, 0f, new Vector2((float)(Main.craftButtonTexture.Width / 2), (float)(Main.craftButtonTexture.Height / 2)), Main.reforgeScale, SpriteEffects.None, 0f); if (Main.mouseX > num87 - Main.craftButtonTexture.Width / 2 && Main.mouseX < num87 + Main.craftButtonTexture.Width / 2 && Main.mouseY > num88 - Main.craftButtonTexture.Height / 2 && Main.mouseY < num88 + Main.craftButtonTexture.Height / 2) { this.MouseText("Crafting window", 0, 0); Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeft && Main.mouseLeftRelease) { if (!Main.recBigList) { Main.recBigList = true; Main.PlaySound(12, -1, -1, 1); } else { Main.recBigList = false; Main.PlaySound(12, -1, -1, 1); } } } } } if (Main.recBigList) { int num89 = 42; if ((double)Main.inventoryScale < 0.75) { Main.inventoryScale = 0.75f; } int num90 = 340; int num91 = 310; int num92 = (Main.screenWidth - num91 - 280) / num89; int num93 = (Main.screenHeight - num90 - 20) / num89; int num94 = 0; int num95 = 0; int num96 = num91; int num97 = num90; int num98 = num91 - 20; int num99 = num90 + 2; if (Main.recStart > Main.numAvailableRecipes - num92 * num93) { Main.recStart = Main.numAvailableRecipes - num92 * num93; if (Main.recStart < 0) { Main.recStart = 0; } } if (Main.recStart > 0) { if (Main.mouseX >= num98 && Main.mouseX <= num98 + Main.craftUpButtonTexture.Width && Main.mouseY >= num99 && Main.mouseY <= num99 + Main.craftUpButtonTexture.Height) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft) { Main.recStart -= num92; if (Main.recStart < 0) { Main.recStart = 0; } Main.PlaySound(12, -1, -1, 1); } } this.spriteBatch.Draw(Main.craftUpButtonTexture, new Vector2((float)num98, (float)num99), new Rectangle?(new Rectangle(0, 0, Main.craftUpButtonTexture.Width, Main.craftUpButtonTexture.Height)), new Color(200, 200, 200, 200), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } if (Main.recStart < Main.numAvailableRecipes - num92 * num93) { num99 += 20; if (Main.mouseX >= num98 && Main.mouseX <= num98 + Main.craftUpButtonTexture.Width && Main.mouseY >= num99 && Main.mouseY <= num99 + Main.craftUpButtonTexture.Height) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft) { Main.recStart += num92; Main.PlaySound(12, -1, -1, 1); if (Main.recStart > Main.numAvailableRecipes - num92) { Main.recStart = Main.numAvailableRecipes - num92; } } } this.spriteBatch.Draw(Main.craftDownButtonTexture, new Vector2((float)num98, (float)num99), new Rectangle?(new Rectangle(0, 0, Main.craftUpButtonTexture.Width, Main.craftUpButtonTexture.Height)), new Color(200, 200, 200, 200), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } int num100 = Main.recStart; while (num100 < Recipe.maxRecipes && num100 < Main.numAvailableRecipes) { int num101 = num96; int num102 = num97; double num103 = (double)(Main.inventoryBack.A + 50); double num104 = 255.0; new Color((int)((byte)num103), (int)((byte)num103), (int)((byte)num103), (int)((byte)num103)); Color color8 = new Color((int)((byte)num104), (int)((byte)num104), (int)((byte)num104), (int)((byte)num104)); if (Main.mouseX >= num101 && (float)Main.mouseX <= (float)num101 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num102 && (float)Main.mouseY <= (float)num102 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft) { Main.focusRecipe = num100; Main.recFastScroll = true; Main.recBigList = false; Main.PlaySound(12, -1, -1, 1); } Main.craftingHide = true; Main.hoverItemName = Main.recipe[Main.availableRecipe[num100]].createItem.name; Main.toolTip = (Item)Main.recipe[Main.availableRecipe[num100]].createItem.Clone(); if (Main.recipe[Main.availableRecipe[num100]].createItem.stack > 1) { object obj = Main.hoverItemName; Main.hoverItemName = string.Concat(new object[] { obj, " (", Main.recipe[Main.availableRecipe[num100]].createItem.stack, ")" }); } } if (Main.numAvailableRecipes > 0) { num103 -= 50.0; if (num103 < 0.0) { num103 = 0.0; } this.spriteBatch.Draw(Main.inventoryBack4Texture, new Vector2((float)num101, (float)num102), new Rectangle?(new Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height)), new Color((int)((byte)num103), (int)((byte)num103), (int)((byte)num103), (int)((byte)num103)), 0f, default(Vector2), Main.inventoryScale, SpriteEffects.None, 0f); if (Main.recipe[Main.availableRecipe[num100]].createItem.type > 0 && Main.recipe[Main.availableRecipe[num100]].createItem.stack > 0) { float num105 = 1f; if (Main.itemTexture[Main.recipe[Main.availableRecipe[num100]].createItem.type].Width > 32 || Main.itemTexture[Main.recipe[Main.availableRecipe[num100]].createItem.type].Height > 32) { if (Main.itemTexture[Main.recipe[Main.availableRecipe[num100]].createItem.type].Width > Main.itemTexture[Main.recipe[Main.availableRecipe[num100]].createItem.type].Height) { num105 = 32f / (float)Main.itemTexture[Main.recipe[Main.availableRecipe[num100]].createItem.type].Width; } else { num105 = 32f / (float)Main.itemTexture[Main.recipe[Main.availableRecipe[num100]].createItem.type].Height; } } num105 *= Main.inventoryScale; Color color9 = color8; if (Main.recipe[Main.availableRecipe[num100]].createItem.type == 662 || Main.recipe[Main.availableRecipe[num100]].createItem.type == 663) { color8.R = (byte)Main.DiscoR; color8.G = (byte)Main.DiscoG; color8.B = (byte)Main.DiscoB; color8.A = 255; } this.spriteBatch.Draw(Main.itemTexture[Main.recipe[Main.availableRecipe[num100]].createItem.type], new Vector2((float)num101 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.recipe[Main.availableRecipe[num100]].createItem.type].Width * 0.5f * num105, (float)num102 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.recipe[Main.availableRecipe[num100]].createItem.type].Height * 0.5f * num105), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.recipe[Main.availableRecipe[num100]].createItem.type].Width, Main.itemTexture[Main.recipe[Main.availableRecipe[num100]].createItem.type].Height)), Main.recipe[Main.availableRecipe[num100]].createItem.GetAlpha(color8), 0f, default(Vector2), num105, SpriteEffects.None, 0f); color8 = color9; if (Main.recipe[Main.availableRecipe[num100]].createItem.color != default(Color)) { this.spriteBatch.Draw(Main.itemTexture[Main.recipe[Main.availableRecipe[num100]].createItem.type], new Vector2((float)num101 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.recipe[Main.availableRecipe[num100]].createItem.type].Width * 0.5f * num105, (float)num102 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.recipe[Main.availableRecipe[num100]].createItem.type].Height * 0.5f * num105), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.recipe[Main.availableRecipe[num100]].createItem.type].Width, Main.itemTexture[Main.recipe[Main.availableRecipe[num100]].createItem.type].Height)), Main.recipe[Main.availableRecipe[num100]].createItem.GetColor(color8), 0f, default(Vector2), num105, SpriteEffects.None, 0f); } if (Main.recipe[Main.availableRecipe[num100]].createItem.stack > 1) { this.spriteBatch.DrawString(Main.fontItemStack, string.Concat(Main.recipe[Main.availableRecipe[num100]].createItem.stack), new Vector2((float)num101 + 10f * Main.inventoryScale, (float)num102 + 26f * Main.inventoryScale), color8, 0f, default(Vector2), num105, SpriteEffects.None, 0f); } } } num96 += num89; num94++; if (num94 >= num92) { num96 = num91; num97 += num89; num94 = 0; num95++; if (num95 >= num93) { break; } } num100++; } } Vector2 vector9 = Main.fontMouseText.MeasureString("Coins"); Vector2 vector10 = Main.fontMouseText.MeasureString(Lang.inter[26]); float num106 = vector9.X / vector10.X; this.spriteBatch.DrawString(Main.fontMouseText, Lang.inter[26], new Vector2(496f, 84f + (vector9.Y - vector9.Y * num106) / 2f), new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), 0f, default(Vector2), 0.75f * num106, SpriteEffects.None, 0f); Main.inventoryScale = 0.6f; for (int num107 = 0; num107 < 4; num107++) { int num108 = 497; int num109 = (int)(85f + (float)(num107 * 56) * Main.inventoryScale + 20f); int num110 = num107 + 50; Color white11 = new Color(100, 100, 100, 100); if (Main.mouseX >= num108 && (float)Main.mouseX <= (float)num108 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num109 && (float)Main.mouseY <= (float)num109 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft) { if (Main.keyState.IsKeyDown(Keys.LeftShift)) { if (Main.player[Main.myPlayer].inventory[num110].type > 0) { if (Main.npcShop > 0) { if (Main.player[Main.myPlayer].inventory[num110].type < 71 || Main.player[Main.myPlayer].inventory[num110].type > 74) { if (Main.player[Main.myPlayer].SellItem(Main.player[Main.myPlayer].inventory[num110].value, Main.player[Main.myPlayer].inventory[num110].stack)) { this.shop[Main.npcShop].AddShop(Main.player[Main.myPlayer].inventory[num110]); Main.player[Main.myPlayer].inventory[num110].SetDefaults(0, false); Main.PlaySound(18, -1, -1, 1); } else { if (Main.player[Main.myPlayer].inventory[num110].value == 0) { this.shop[Main.npcShop].AddShop(Main.player[Main.myPlayer].inventory[num110]); Main.player[Main.myPlayer].inventory[num110].SetDefaults(0, false); Main.PlaySound(7, -1, -1, 1); } } } } else { Main.PlaySound(7, -1, -1, 1); Main.trashItem = (Item)Main.player[Main.myPlayer].inventory[num110].Clone(); Main.player[Main.myPlayer].inventory[num110].SetDefaults(0, false); Recipe.FindRecipes(); } } } else { if ((Main.player[Main.myPlayer].selectedItem != num110 || Main.player[Main.myPlayer].itemAnimation <= 0) && Main.player[Main.myPlayer].itemTime == 0 && (Main.mouseItem.type == 0 || Main.mouseItem.type == 71 || Main.mouseItem.type == 72 || Main.mouseItem.type == 73 || Main.mouseItem.type == 74)) { Item item8 = Main.mouseItem; Main.mouseItem = Main.player[Main.myPlayer].inventory[num110]; Main.player[Main.myPlayer].inventory[num110] = item8; if (Main.player[Main.myPlayer].inventory[num110].type == 0 || Main.player[Main.myPlayer].inventory[num110].stack < 1) { Main.player[Main.myPlayer].inventory[num110] = new Item(); } if (Main.mouseItem.IsTheSameAs(Main.player[Main.myPlayer].inventory[num110]) && Main.player[Main.myPlayer].inventory[num110].stack != Main.player[Main.myPlayer].inventory[num110].maxStack && Main.mouseItem.stack != Main.mouseItem.maxStack) { if (Main.mouseItem.stack + Main.player[Main.myPlayer].inventory[num110].stack <= Main.mouseItem.maxStack) { Main.player[Main.myPlayer].inventory[num110].stack += Main.mouseItem.stack; Main.mouseItem.stack = 0; } else { int num111 = Main.mouseItem.maxStack - Main.player[Main.myPlayer].inventory[num110].stack; Main.player[Main.myPlayer].inventory[num110].stack += num111; Main.mouseItem.stack -= num111; } } if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1) { Main.mouseItem = new Item(); } if (Main.mouseItem.type > 0 || Main.player[Main.myPlayer].inventory[num110].type > 0) { Main.PlaySound(7, -1, -1, 1); } Recipe.FindRecipes(); } } } else { if (Main.stackSplit <= 1 && Main.mouseRight && (Main.mouseItem.IsTheSameAs(Main.player[Main.myPlayer].inventory[num110]) || Main.mouseItem.type == 0) && (Main.mouseItem.stack < Main.mouseItem.maxStack || Main.mouseItem.type == 0)) { if (Main.mouseItem.type == 0) { Main.mouseItem = (Item)Main.player[Main.myPlayer].inventory[num110].Clone(); Main.mouseItem.stack = 0; } Main.mouseItem.stack++; Main.player[Main.myPlayer].inventory[num110].stack--; if (Main.player[Main.myPlayer].inventory[num110].stack <= 0) { Main.player[Main.myPlayer].inventory[num110] = new Item(); } Recipe.FindRecipes(); Main.soundInstanceMenuTick.Stop(); Main.soundInstanceMenuTick = Main.soundMenuTick.CreateInstance(); Main.PlaySound(12, -1, -1, 1); if (Main.stackSplit == 0) { Main.stackSplit = 15; } else { Main.stackSplit = Main.stackDelay; } } } Main.hoverItemName = Main.player[Main.myPlayer].inventory[num110].name; Main.toolTip = (Item)Main.player[Main.myPlayer].inventory[num110].Clone(); if (Main.player[Main.myPlayer].inventory[num110].stack > 1) { object obj = Main.hoverItemName; Main.hoverItemName = string.Concat(new object[] { obj, " (", Main.player[Main.myPlayer].inventory[num110].stack, ")" }); } } this.spriteBatch.Draw(Main.inventoryBackTexture, new Vector2((float)num108, (float)num109), new Rectangle?(new Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height)), Main.inventoryBack, 0f, default(Vector2), Main.inventoryScale, SpriteEffects.None, 0f); white11 = Color.White; if (Main.player[Main.myPlayer].inventory[num110].type > 0 && Main.player[Main.myPlayer].inventory[num110].stack > 0) { float num112 = 1f; if (Main.itemTexture[Main.player[Main.myPlayer].inventory[num110].type].Width > 32 || Main.itemTexture[Main.player[Main.myPlayer].inventory[num110].type].Height > 32) { if (Main.itemTexture[Main.player[Main.myPlayer].inventory[num110].type].Width > Main.itemTexture[Main.player[Main.myPlayer].inventory[num110].type].Height) { num112 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num110].type].Width; } else { num112 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num110].type].Height; } } num112 *= Main.inventoryScale; this.spriteBatch.Draw(Main.itemTexture[Main.player[Main.myPlayer].inventory[num110].type], new Vector2((float)num108 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num110].type].Width * 0.5f * num112, (float)num109 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num110].type].Height * 0.5f * num112), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].inventory[num110].type].Width, Main.itemTexture[Main.player[Main.myPlayer].inventory[num110].type].Height)), Main.player[Main.myPlayer].inventory[num110].GetAlpha(white11), 0f, default(Vector2), num112, SpriteEffects.None, 0f); if (Main.player[Main.myPlayer].inventory[num110].color != default(Color)) { this.spriteBatch.Draw(Main.itemTexture[Main.player[Main.myPlayer].inventory[num110].type], new Vector2((float)num108 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num110].type].Width * 0.5f * num112, (float)num109 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num110].type].Height * 0.5f * num112), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].inventory[num110].type].Width, Main.itemTexture[Main.player[Main.myPlayer].inventory[num110].type].Height)), Main.player[Main.myPlayer].inventory[num110].GetColor(white11), 0f, default(Vector2), num112, SpriteEffects.None, 0f); } if (Main.player[Main.myPlayer].inventory[num110].stack > 1) { this.spriteBatch.DrawString(Main.fontItemStack, string.Concat(Main.player[Main.myPlayer].inventory[num110].stack), new Vector2((float)num108 + 10f * Main.inventoryScale, (float)num109 + 26f * Main.inventoryScale), white11, 0f, default(Vector2), num112, SpriteEffects.None, 0f); } } } Vector2 vector11 = Main.fontMouseText.MeasureString("Ammo"); Vector2 vector12 = Main.fontMouseText.MeasureString(Lang.inter[27]); float num113 = vector11.X / vector12.X; this.spriteBatch.DrawString(Main.fontMouseText, Lang.inter[27], new Vector2(532f, 84f + (vector11.Y - vector11.Y * num113) / 2f), new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), 0f, default(Vector2), 0.75f * num113, SpriteEffects.None, 0f); Main.inventoryScale = 0.6f; for (int num114 = 0; num114 < 4; num114++) { int num115 = 534; int num116 = (int)(85f + (float)(num114 * 56) * Main.inventoryScale + 20f); int num117 = 54 + num114; Color white12 = new Color(100, 100, 100, 100); if (Main.mouseX >= num115 && (float)Main.mouseX <= (float)num115 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num116 && (float)Main.mouseY <= (float)num116 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft) { if (Main.keyState.IsKeyDown(Keys.LeftShift)) { if (Main.player[Main.myPlayer].inventory[num117].type > 0) { if (Main.npcShop > 0) { if (Main.player[Main.myPlayer].inventory[num117].type < 71 || Main.player[Main.myPlayer].inventory[num117].type > 74) { if (Main.player[Main.myPlayer].SellItem(Main.player[Main.myPlayer].inventory[num117].value, Main.player[Main.myPlayer].inventory[num117].stack)) { this.shop[Main.npcShop].AddShop(Main.player[Main.myPlayer].inventory[num117]); Main.player[Main.myPlayer].inventory[num117].SetDefaults(0, false); Main.PlaySound(18, -1, -1, 1); } else { if (Main.player[Main.myPlayer].inventory[num117].value == 0) { this.shop[Main.npcShop].AddShop(Main.player[Main.myPlayer].inventory[num117]); Main.player[Main.myPlayer].inventory[num117].SetDefaults(0, false); Main.PlaySound(7, -1, -1, 1); } } } } else { Main.PlaySound(7, -1, -1, 1); Main.trashItem = (Item)Main.player[Main.myPlayer].inventory[num117].Clone(); Main.player[Main.myPlayer].inventory[num117].SetDefaults(0, false); Recipe.FindRecipes(); } } } else { if ((Main.player[Main.myPlayer].selectedItem != num117 || Main.player[Main.myPlayer].itemAnimation <= 0) && Main.player[Main.myPlayer].itemTime == 0 && (Main.mouseItem.type == 0 || Main.mouseItem.ammo > 0 || Main.mouseItem.type == 530) && !Main.mouseItem.notAmmo) { Item item9 = Main.mouseItem; Main.mouseItem = Main.player[Main.myPlayer].inventory[num117]; Main.player[Main.myPlayer].inventory[num117] = item9; if (Main.player[Main.myPlayer].inventory[num117].type == 0 || Main.player[Main.myPlayer].inventory[num117].stack < 1) { Main.player[Main.myPlayer].inventory[num117] = new Item(); } if (Main.mouseItem.IsTheSameAs(Main.player[Main.myPlayer].inventory[num117]) && Main.player[Main.myPlayer].inventory[num117].stack != Main.player[Main.myPlayer].inventory[num117].maxStack && Main.mouseItem.stack != Main.mouseItem.maxStack) { if (Main.mouseItem.stack + Main.player[Main.myPlayer].inventory[num117].stack <= Main.mouseItem.maxStack) { Main.player[Main.myPlayer].inventory[num117].stack += Main.mouseItem.stack; Main.mouseItem.stack = 0; } else { int num118 = Main.mouseItem.maxStack - Main.player[Main.myPlayer].inventory[num117].stack; Main.player[Main.myPlayer].inventory[num117].stack += num118; Main.mouseItem.stack -= num118; } } if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1) { Main.mouseItem = new Item(); } if (Main.mouseItem.type > 0 || Main.player[Main.myPlayer].inventory[num117].type > 0) { Main.PlaySound(7, -1, -1, 1); } Recipe.FindRecipes(); } } Recipe.FindRecipes(); } else { if (Main.stackSplit <= 1 && Main.mouseRight && (Main.mouseItem.IsTheSameAs(Main.player[Main.myPlayer].inventory[num117]) || Main.mouseItem.type == 0) && (Main.mouseItem.stack < Main.mouseItem.maxStack || Main.mouseItem.type == 0)) { if (Main.mouseItem.type == 0) { Main.mouseItem = (Item)Main.player[Main.myPlayer].inventory[num117].Clone(); Main.mouseItem.stack = 0; } Main.mouseItem.stack++; Main.player[Main.myPlayer].inventory[num117].stack--; if (Main.player[Main.myPlayer].inventory[num117].stack <= 0) { Main.player[Main.myPlayer].inventory[num117] = new Item(); } Recipe.FindRecipes(); Main.soundInstanceMenuTick.Stop(); Main.soundInstanceMenuTick = Main.soundMenuTick.CreateInstance(); Main.PlaySound(12, -1, -1, 1); if (Main.stackSplit == 0) { Main.stackSplit = 15; } else { Main.stackSplit = Main.stackDelay; } } } Main.hoverItemName = Main.player[Main.myPlayer].inventory[num117].name; Main.toolTip = (Item)Main.player[Main.myPlayer].inventory[num117].Clone(); if (Main.player[Main.myPlayer].inventory[num117].stack > 1) { object obj = Main.hoverItemName; Main.hoverItemName = string.Concat(new object[] { obj, " (", Main.player[Main.myPlayer].inventory[num117].stack, ")" }); } } this.spriteBatch.Draw(Main.inventoryBackTexture, new Vector2((float)num115, (float)num116), new Rectangle?(new Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height)), Main.inventoryBack, 0f, default(Vector2), Main.inventoryScale, SpriteEffects.None, 0f); white12 = Color.White; if (Main.player[Main.myPlayer].inventory[num117].type > 0 && Main.player[Main.myPlayer].inventory[num117].stack > 0) { float num119 = 1f; if (Main.itemTexture[Main.player[Main.myPlayer].inventory[num117].type].Width > 32 || Main.itemTexture[Main.player[Main.myPlayer].inventory[num117].type].Height > 32) { if (Main.itemTexture[Main.player[Main.myPlayer].inventory[num117].type].Width > Main.itemTexture[Main.player[Main.myPlayer].inventory[num117].type].Height) { num119 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num117].type].Width; } else { num119 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num117].type].Height; } } num119 *= Main.inventoryScale; this.spriteBatch.Draw(Main.itemTexture[Main.player[Main.myPlayer].inventory[num117].type], new Vector2((float)num115 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num117].type].Width * 0.5f * num119, (float)num116 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num117].type].Height * 0.5f * num119), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].inventory[num117].type].Width, Main.itemTexture[Main.player[Main.myPlayer].inventory[num117].type].Height)), Main.player[Main.myPlayer].inventory[num117].GetAlpha(white12), 0f, default(Vector2), num119, SpriteEffects.None, 0f); if (Main.player[Main.myPlayer].inventory[num117].color != default(Color)) { this.spriteBatch.Draw(Main.itemTexture[Main.player[Main.myPlayer].inventory[num117].type], new Vector2((float)num115 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num117].type].Width * 0.5f * num119, (float)num116 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[num117].type].Height * 0.5f * num119), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].inventory[num117].type].Width, Main.itemTexture[Main.player[Main.myPlayer].inventory[num117].type].Height)), Main.player[Main.myPlayer].inventory[num117].GetColor(white12), 0f, default(Vector2), num119, SpriteEffects.None, 0f); } if (Main.player[Main.myPlayer].inventory[num117].stack > 1) { this.spriteBatch.DrawString(Main.fontItemStack, string.Concat(Main.player[Main.myPlayer].inventory[num117].stack), new Vector2((float)num115 + 10f * Main.inventoryScale, (float)num116 + 26f * Main.inventoryScale), white12, 0f, default(Vector2), num119, SpriteEffects.None, 0f); } } } if (Main.npcShop > 0 && (!Main.playerInventory || Main.player[Main.myPlayer].talkNPC == -1)) { Main.npcShop = 0; } if (Main.npcShop > 0) { this.spriteBatch.DrawString(Main.fontMouseText, Lang.inter[28], new Vector2(504f, (float)this.invBottom), new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); Main.inventoryScale = 0.755f; if (Main.mouseX > 73 && Main.mouseX < (int)(73f + 560f * Main.inventoryScale) && Main.mouseY > this.invBottom && Main.mouseY < (int)((float)this.invBottom + 224f * Main.inventoryScale)) { Main.player[Main.myPlayer].mouseInterface = true; } for (int num120 = 0; num120 < 10; num120++) { for (int num121 = 0; num121 < 4; num121++) { int num122 = (int)(73f + (float)(num120 * 56) * Main.inventoryScale); int num123 = (int)((float)this.invBottom + (float)(num121 * 56) * Main.inventoryScale); int num124 = num120 + num121 * 10; Color white13 = new Color(100, 100, 100, 100); if (Main.mouseX >= num122 && (float)Main.mouseX <= (float)num122 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num123 && (float)Main.mouseY <= (float)num123 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft) { if (Main.mouseItem.type == 0 && this.shop[Main.npcShop].item[num124].type > 0) { if ((Main.player[Main.myPlayer].selectedItem != num124 || Main.player[Main.myPlayer].itemAnimation <= 0) && Main.player[Main.myPlayer].itemTime == 0 && Main.player[Main.myPlayer].BuyItem(this.shop[Main.npcShop].item[num124].value)) { if (this.shop[Main.npcShop].item[num124].buyOnce) { int prefix = (int)this.shop[Main.npcShop].item[num124].prefix; Main.mouseItem.netDefaults(this.shop[Main.npcShop].item[num124].netID); Main.mouseItem.Prefix(prefix); } else { Main.mouseItem.netDefaults(this.shop[Main.npcShop].item[num124].netID); 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, Main.mouseItem.stack); if (this.shop[Main.npcShop].item[num124].buyOnce) { this.shop[Main.npcShop].item[num124].stack--; if (this.shop[Main.npcShop].item[num124].stack <= 0) { this.shop[Main.npcShop].item[num124].SetDefaults(0, false); } } if (this.shop[Main.npcShop].item[num124].value > 0) { Main.PlaySound(18, -1, -1, 1); } else { Main.PlaySound(7, -1, -1, 1); } } } else { if (this.shop[Main.npcShop].item[num124].type == 0 && Main.mouseItem.type > 0 && (Main.mouseItem.type < 71 || Main.mouseItem.type > 74)) { if (Main.player[Main.myPlayer].SellItem(Main.mouseItem.value, Main.mouseItem.stack)) { this.shop[Main.npcShop].AddShop(Main.mouseItem); Main.mouseItem.stack = 0; Main.mouseItem.type = 0; Main.PlaySound(18, -1, -1, 1); } else { if (Main.mouseItem.value == 0) { this.shop[Main.npcShop].AddShop(Main.mouseItem); Main.mouseItem.stack = 0; Main.mouseItem.type = 0; Main.PlaySound(7, -1, -1, 1); } } Recipe.FindRecipes(); } } } else { if (Main.stackSplit <= 1 && Main.mouseRight && this.shop[Main.npcShop].item[num124].type > 0 && (Main.mouseItem.IsTheSameAs(this.shop[Main.npcShop].item[num124]) || Main.mouseItem.type == 0)) { int num125 = Main.superFastStack + 1; for (int num126 = 0; num126 < num125; num126++) { if ((Main.mouseItem.stack < Main.mouseItem.maxStack || Main.mouseItem.type == 0) && Main.player[Main.myPlayer].BuyItem(this.shop[Main.npcShop].item[num124].value)) { if (num126 == 0) { Main.PlaySound(18, -1, -1, 1); } if (Main.mouseItem.type == 0) { Main.mouseItem.netDefaults(this.shop[Main.npcShop].item[num124].netID); Main.mouseItem.stack = 0; } Main.mouseItem.stack++; if (Main.stackSplit == 0) { Main.stackSplit = 15; } else { Main.stackSplit = Main.stackDelay; } if (this.shop[Main.npcShop].item[num124].buyOnce) { this.shop[Main.npcShop].item[num124].stack--; if (this.shop[Main.npcShop].item[num124].stack <= 0) { this.shop[Main.npcShop].item[num124].SetDefaults(0, false); } } } } } } Main.hoverItemName = this.shop[Main.npcShop].item[num124].name; Main.toolTip = (Item)this.shop[Main.npcShop].item[num124].Clone(); Main.toolTip.buy = true; if (this.shop[Main.npcShop].item[num124].stack > 1) { object obj = Main.hoverItemName; Main.hoverItemName = string.Concat(new object[] { obj, " (", this.shop[Main.npcShop].item[num124].stack, ")" }); } } this.spriteBatch.Draw(Main.inventoryBack6Texture, new Vector2((float)num122, (float)num123), new Rectangle?(new Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height)), Main.inventoryBack, 0f, default(Vector2), Main.inventoryScale, SpriteEffects.None, 0f); white13 = Color.White; if (this.shop[Main.npcShop].item[num124].type > 0 && this.shop[Main.npcShop].item[num124].stack > 0) { float num127 = 1f; if (Main.itemTexture[this.shop[Main.npcShop].item[num124].type].Width > 32 || Main.itemTexture[this.shop[Main.npcShop].item[num124].type].Height > 32) { if (Main.itemTexture[this.shop[Main.npcShop].item[num124].type].Width > Main.itemTexture[this.shop[Main.npcShop].item[num124].type].Height) { num127 = 32f / (float)Main.itemTexture[this.shop[Main.npcShop].item[num124].type].Width; } else { num127 = 32f / (float)Main.itemTexture[this.shop[Main.npcShop].item[num124].type].Height; } } num127 *= Main.inventoryScale; if (this.shop[Main.npcShop].item[num124].type == 662 || this.shop[Main.npcShop].item[num124].type == 663) { white13.R = (byte)Main.DiscoR; white13.G = (byte)Main.DiscoG; white13.B = (byte)Main.DiscoB; white13.A = 255; } this.spriteBatch.Draw(Main.itemTexture[this.shop[Main.npcShop].item[num124].type], new Vector2((float)num122 + 26f * Main.inventoryScale - (float)Main.itemTexture[this.shop[Main.npcShop].item[num124].type].Width * 0.5f * num127, (float)num123 + 26f * Main.inventoryScale - (float)Main.itemTexture[this.shop[Main.npcShop].item[num124].type].Height * 0.5f * num127), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[this.shop[Main.npcShop].item[num124].type].Width, Main.itemTexture[this.shop[Main.npcShop].item[num124].type].Height)), this.shop[Main.npcShop].item[num124].GetAlpha(white13), 0f, default(Vector2), num127, SpriteEffects.None, 0f); white13 = Color.White; if (this.shop[Main.npcShop].item[num124].color != default(Color)) { this.spriteBatch.Draw(Main.itemTexture[this.shop[Main.npcShop].item[num124].type], new Vector2((float)num122 + 26f * Main.inventoryScale - (float)Main.itemTexture[this.shop[Main.npcShop].item[num124].type].Width * 0.5f * num127, (float)num123 + 26f * Main.inventoryScale - (float)Main.itemTexture[this.shop[Main.npcShop].item[num124].type].Height * 0.5f * num127), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[this.shop[Main.npcShop].item[num124].type].Width, Main.itemTexture[this.shop[Main.npcShop].item[num124].type].Height)), this.shop[Main.npcShop].item[num124].GetColor(white13), 0f, default(Vector2), num127, SpriteEffects.None, 0f); } if (this.shop[Main.npcShop].item[num124].stack > 1) { this.spriteBatch.DrawString(Main.fontItemStack, string.Concat(this.shop[Main.npcShop].item[num124].stack), new Vector2((float)num122 + 10f * Main.inventoryScale, (float)num123 + 26f * Main.inventoryScale), white13, 0f, default(Vector2), num127, SpriteEffects.None, 0f); } } } } } if (Main.player[Main.myPlayer].chest > -1 && Main.tile[Main.player[Main.myPlayer].chestX, Main.player[Main.myPlayer].chestY].type != 21) { Main.player[Main.myPlayer].chest = -1; } if (Main.player[Main.myPlayer].chest != -1) { Main.inventoryScale = 0.755f; if (Main.mouseX > 73 && Main.mouseX < (int)(73f + 560f * Main.inventoryScale) && Main.mouseY > this.invBottom && Main.mouseY < (int)((float)this.invBottom + 224f * Main.inventoryScale)) { Main.player[Main.myPlayer].mouseInterface = true; } for (int num128 = 0; num128 < 3; num128++) { int num129 = 506; int num130 = this.invBottom + 40; float num131 = this.chestLootScale; string text7 = Lang.inter[29]; if (num128 == 1) { num130 += 26; num131 = this.chestDepositScale; text7 = Lang.inter[30]; } else { if (num128 == 2) { num130 += 52; num131 = this.chestStackScale; text7 = Lang.inter[31]; } } Vector2 vector13 = Main.fontMouseText.MeasureString(text7) / 2f; Color color10 = new Color((int)((byte)((float)Main.mouseTextColor * num131)), (int)((byte)((float)Main.mouseTextColor * num131)), (int)((byte)((float)Main.mouseTextColor * num131)), (int)((byte)((float)Main.mouseTextColor * num131))); num129 += (int)(vector13.X * num131); this.spriteBatch.DrawString(Main.fontMouseText, text7, new Vector2((float)num129, (float)num130), color10, 0f, vector13, num131, SpriteEffects.None, 0f); vector13 *= num131; if ((float)Main.mouseX > (float)num129 - vector13.X && (float)Main.mouseX < (float)num129 + vector13.X && (float)Main.mouseY > (float)num130 - vector13.Y && (float)Main.mouseY < (float)num130 + vector13.Y) { if (num128 == 0) { if (!this.chestLootHover) { Main.PlaySound(12, -1, -1, 1); } this.chestLootHover = true; } else { if (num128 == 1) { if (!this.chestDepositHover) { Main.PlaySound(12, -1, -1, 1); } this.chestDepositHover = true; } else { if (!this.chestStackHover) { Main.PlaySound(12, -1, -1, 1); } this.chestStackHover = true; } } Main.player[Main.myPlayer].mouseInterface = true; num131 += 0.05f; if (Main.mouseLeft && Main.mouseLeftRelease) { if (num128 == 0) { if (Main.player[Main.myPlayer].chest > -1) { for (int num132 = 0; num132 < Chest.maxItems; num132++) { if (Main.chest[Main.player[Main.myPlayer].chest].item[num132].type > 0) { Main.chest[Main.player[Main.myPlayer].chest].item[num132] = Main.player[Main.myPlayer].GetItem(Main.myPlayer, Main.chest[Main.player[Main.myPlayer].chest].item[num132]); if (Main.netMode == 1) { NetMessage.SendData(32, -1, -1, "", Main.player[Main.myPlayer].chest, (float)num132, 0f, 0f, 0); } } } } else { if (Main.player[Main.myPlayer].chest == -3) { for (int num133 = 0; num133 < Chest.maxItems; num133++) { if (Main.player[Main.myPlayer].bank2[num133].type > 0) { Main.player[Main.myPlayer].bank2[num133] = Main.player[Main.myPlayer].GetItem(Main.myPlayer, Main.player[Main.myPlayer].bank2[num133]); } } } else { for (int num134 = 0; num134 < Chest.maxItems; num134++) { if (Main.player[Main.myPlayer].bank[num134].type > 0) { Main.player[Main.myPlayer].bank[num134] = Main.player[Main.myPlayer].GetItem(Main.myPlayer, Main.player[Main.myPlayer].bank[num134]); } } } } } else { if (num128 == 1) { for (int num135 = 49; num135 >= 10; num135--) { if (Main.player[Main.myPlayer].inventory[num135].stack > 0 && Main.player[Main.myPlayer].inventory[num135].type > 0) { if (Main.player[Main.myPlayer].inventory[num135].maxStack > 1) { for (int num136 = 0; num136 < Chest.maxItems; num136++) { if (Main.player[Main.myPlayer].chest > -1) { if (Main.chest[Main.player[Main.myPlayer].chest].item[num136].stack < Main.chest[Main.player[Main.myPlayer].chest].item[num136].maxStack && Main.player[Main.myPlayer].inventory[num135].IsTheSameAs(Main.chest[Main.player[Main.myPlayer].chest].item[num136])) { int num137 = Main.player[Main.myPlayer].inventory[num135].stack; if (Main.player[Main.myPlayer].inventory[num135].stack + Main.chest[Main.player[Main.myPlayer].chest].item[num136].stack > Main.chest[Main.player[Main.myPlayer].chest].item[num136].maxStack) { num137 = Main.chest[Main.player[Main.myPlayer].chest].item[num136].maxStack - Main.chest[Main.player[Main.myPlayer].chest].item[num136].stack; } Main.player[Main.myPlayer].inventory[num135].stack -= num137; Main.chest[Main.player[Main.myPlayer].chest].item[num136].stack += num137; Main.ChestCoins(); Main.PlaySound(7, -1, -1, 1); if (Main.player[Main.myPlayer].inventory[num135].stack <= 0) { Main.player[Main.myPlayer].inventory[num135].SetDefaults(0, false); if (Main.netMode == 1) { NetMessage.SendData(32, -1, -1, "", Main.player[Main.myPlayer].chest, (float)num136, 0f, 0f, 0); break; } break; } else { if (Main.chest[Main.player[Main.myPlayer].chest].item[num136].type == 0) { Main.chest[Main.player[Main.myPlayer].chest].item[num136] = (Item)Main.player[Main.myPlayer].inventory[num135].Clone(); Main.player[Main.myPlayer].inventory[num135].SetDefaults(0, false); } if (Main.netMode == 1) { NetMessage.SendData(32, -1, -1, "", Main.player[Main.myPlayer].chest, (float)num136, 0f, 0f, 0); } } } } else { if (Main.player[Main.myPlayer].chest == -3) { if (Main.player[Main.myPlayer].bank2[num136].stack < Main.player[Main.myPlayer].bank2[num136].maxStack && Main.player[Main.myPlayer].inventory[num135].IsTheSameAs(Main.player[Main.myPlayer].bank2[num136])) { int num138 = Main.player[Main.myPlayer].inventory[num135].stack; if (Main.player[Main.myPlayer].inventory[num135].stack + Main.player[Main.myPlayer].bank2[num136].stack > Main.player[Main.myPlayer].bank2[num136].maxStack) { num138 = Main.player[Main.myPlayer].bank2[num136].maxStack - Main.player[Main.myPlayer].bank2[num136].stack; } Main.player[Main.myPlayer].inventory[num135].stack -= num138; Main.player[Main.myPlayer].bank2[num136].stack += num138; Main.PlaySound(7, -1, -1, 1); Main.BankCoins(); if (Main.player[Main.myPlayer].inventory[num135].stack <= 0) { Main.player[Main.myPlayer].inventory[num135].SetDefaults(0, false); break; } if (Main.player[Main.myPlayer].bank2[num136].type == 0) { Main.player[Main.myPlayer].bank2[num136] = (Item)Main.player[Main.myPlayer].inventory[num135].Clone(); Main.player[Main.myPlayer].inventory[num135].SetDefaults(0, false); } } } else { if (Main.player[Main.myPlayer].bank[num136].stack < Main.player[Main.myPlayer].bank[num136].maxStack && Main.player[Main.myPlayer].inventory[num135].IsTheSameAs(Main.player[Main.myPlayer].bank[num136])) { int num139 = Main.player[Main.myPlayer].inventory[num135].stack; if (Main.player[Main.myPlayer].inventory[num135].stack + Main.player[Main.myPlayer].bank[num136].stack > Main.player[Main.myPlayer].bank[num136].maxStack) { num139 = Main.player[Main.myPlayer].bank[num136].maxStack - Main.player[Main.myPlayer].bank[num136].stack; } Main.player[Main.myPlayer].inventory[num135].stack -= num139; Main.player[Main.myPlayer].bank[num136].stack += num139; Main.PlaySound(7, -1, -1, 1); Main.BankCoins(); if (Main.player[Main.myPlayer].inventory[num135].stack <= 0) { Main.player[Main.myPlayer].inventory[num135].SetDefaults(0, false); break; } if (Main.player[Main.myPlayer].bank[num136].type == 0) { Main.player[Main.myPlayer].bank[num136] = (Item)Main.player[Main.myPlayer].inventory[num135].Clone(); Main.player[Main.myPlayer].inventory[num135].SetDefaults(0, false); } } } } } } if (Main.player[Main.myPlayer].inventory[num135].stack > 0) { if (Main.player[Main.myPlayer].chest > -1) { int num140 = 0; while (num140 < Chest.maxItems) { if (Main.chest[Main.player[Main.myPlayer].chest].item[num140].stack == 0) { Main.PlaySound(7, -1, -1, 1); Main.chest[Main.player[Main.myPlayer].chest].item[num140] = (Item)Main.player[Main.myPlayer].inventory[num135].Clone(); Main.player[Main.myPlayer].inventory[num135].SetDefaults(0, false); if (Main.netMode == 1) { NetMessage.SendData(32, -1, -1, "", Main.player[Main.myPlayer].chest, (float)num140, 0f, 0f, 0); break; } break; } else { num140++; } } } else { if (Main.player[Main.myPlayer].chest == -3) { for (int num141 = 0; num141 < Chest.maxItems; num141++) { if (Main.player[Main.myPlayer].bank2[num141].stack == 0) { Main.PlaySound(7, -1, -1, 1); Main.player[Main.myPlayer].bank2[num141] = (Item)Main.player[Main.myPlayer].inventory[num135].Clone(); Main.player[Main.myPlayer].inventory[num135].SetDefaults(0, false); break; } } } else { for (int num142 = 0; num142 < Chest.maxItems; num142++) { if (Main.player[Main.myPlayer].bank[num142].stack == 0) { Main.PlaySound(7, -1, -1, 1); Main.player[Main.myPlayer].bank[num142] = (Item)Main.player[Main.myPlayer].inventory[num135].Clone(); Main.player[Main.myPlayer].inventory[num135].SetDefaults(0, false); break; } } } } } } } } else { if (Main.player[Main.myPlayer].chest > -1) { for (int num143 = 0; num143 < Chest.maxItems; num143++) { if (Main.chest[Main.player[Main.myPlayer].chest].item[num143].type > 0 && Main.chest[Main.player[Main.myPlayer].chest].item[num143].stack < Main.chest[Main.player[Main.myPlayer].chest].item[num143].maxStack) { for (int num144 = 0; num144 < 58; num144++) { if (Main.chest[Main.player[Main.myPlayer].chest].item[num143].IsTheSameAs(Main.player[Main.myPlayer].inventory[num144])) { int num145 = Main.player[Main.myPlayer].inventory[num144].stack; if (Main.chest[Main.player[Main.myPlayer].chest].item[num143].stack + num145 > Main.chest[Main.player[Main.myPlayer].chest].item[num143].maxStack) { num145 = Main.chest[Main.player[Main.myPlayer].chest].item[num143].maxStack - Main.chest[Main.player[Main.myPlayer].chest].item[num143].stack; } Main.PlaySound(7, -1, -1, 1); Main.chest[Main.player[Main.myPlayer].chest].item[num143].stack += num145; Main.player[Main.myPlayer].inventory[num144].stack -= num145; Main.ChestCoins(); if (Main.player[Main.myPlayer].inventory[num144].stack == 0) { Main.player[Main.myPlayer].inventory[num144].SetDefaults(0, false); } else { if (Main.chest[Main.player[Main.myPlayer].chest].item[num143].type == 0) { Main.chest[Main.player[Main.myPlayer].chest].item[num143] = (Item)Main.player[Main.myPlayer].inventory[num144].Clone(); Main.player[Main.myPlayer].inventory[num144].SetDefaults(0, false); } } if (Main.netMode == 1) { NetMessage.SendData(32, -1, -1, "", Main.player[Main.myPlayer].chest, (float)num143, 0f, 0f, 0); } } } } } } else { if (Main.player[Main.myPlayer].chest == -3) { for (int num146 = 0; num146 < Chest.maxItems; num146++) { if (Main.player[Main.myPlayer].bank2[num146].type > 0 && Main.player[Main.myPlayer].bank2[num146].stack < Main.player[Main.myPlayer].bank2[num146].maxStack) { for (int num147 = 0; num147 < 58; num147++) { if (Main.player[Main.myPlayer].bank2[num146].IsTheSameAs(Main.player[Main.myPlayer].inventory[num147])) { int num148 = Main.player[Main.myPlayer].inventory[num147].stack; if (Main.player[Main.myPlayer].bank2[num146].stack + num148 > Main.player[Main.myPlayer].bank2[num146].maxStack) { num148 = Main.player[Main.myPlayer].bank2[num146].maxStack - Main.player[Main.myPlayer].bank2[num146].stack; } Main.PlaySound(7, -1, -1, 1); Main.player[Main.myPlayer].bank2[num146].stack += num148; Main.player[Main.myPlayer].inventory[num147].stack -= num148; Main.BankCoins(); if (Main.player[Main.myPlayer].inventory[num147].stack == 0) { Main.player[Main.myPlayer].inventory[num147].SetDefaults(0, false); } else { if (Main.player[Main.myPlayer].bank2[num146].type == 0) { Main.player[Main.myPlayer].bank2[num146] = (Item)Main.player[Main.myPlayer].inventory[num147].Clone(); Main.player[Main.myPlayer].inventory[num147].SetDefaults(0, false); } } } } } } } else { for (int num149 = 0; num149 < Chest.maxItems; num149++) { if (Main.player[Main.myPlayer].bank[num149].type > 0 && Main.player[Main.myPlayer].bank[num149].stack < Main.player[Main.myPlayer].bank[num149].maxStack) { for (int num150 = 0; num150 < 58; num150++) { if (Main.player[Main.myPlayer].bank[num149].IsTheSameAs(Main.player[Main.myPlayer].inventory[num150])) { int num151 = Main.player[Main.myPlayer].inventory[num150].stack; if (Main.player[Main.myPlayer].bank[num149].stack + num151 > Main.player[Main.myPlayer].bank[num149].maxStack) { num151 = Main.player[Main.myPlayer].bank[num149].maxStack - Main.player[Main.myPlayer].bank[num149].stack; } Main.PlaySound(7, -1, -1, 1); Main.player[Main.myPlayer].bank[num149].stack += num151; Main.player[Main.myPlayer].inventory[num150].stack -= num151; Main.BankCoins(); if (Main.player[Main.myPlayer].inventory[num150].stack == 0) { Main.player[Main.myPlayer].inventory[num150].SetDefaults(0, false); } else { if (Main.player[Main.myPlayer].bank[num149].type == 0) { Main.player[Main.myPlayer].bank[num149] = (Item)Main.player[Main.myPlayer].inventory[num150].Clone(); Main.player[Main.myPlayer].inventory[num150].SetDefaults(0, false); } } } } } } } } } } Recipe.FindRecipes(); } } else { num131 -= 0.05f; if (num128 == 0) { this.chestLootHover = false; } else { if (num128 == 1) { this.chestDepositHover = false; } else { this.chestStackHover = false; } } } if ((double)num131 < 0.75) { num131 = 0.75f; } if (num131 > 1f) { num131 = 1f; } if (num128 == 0) { this.chestLootScale = num131; } else { if (num128 == 1) { this.chestDepositScale = num131; } else { this.chestStackScale = num131; } } } } else { this.chestLootScale = 0.75f; this.chestDepositScale = 0.75f; this.chestStackScale = 0.75f; this.chestLootHover = false; this.chestDepositHover = false; this.chestStackHover = false; } if (Main.player[Main.myPlayer].chest > -1) { this.spriteBatch.DrawString(Main.fontMouseText, Main.chestText, new Vector2(504f, (float)this.invBottom), new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); Main.inventoryScale = 0.755f; if (Main.mouseX > 73 && Main.mouseX < (int)(73f + 280f * Main.inventoryScale) && Main.mouseY > this.invBottom && Main.mouseY < (int)((float)this.invBottom + 224f * Main.inventoryScale)) { Main.player[Main.myPlayer].mouseInterface = true; } for (int num152 = 0; num152 < 10; num152++) { for (int num153 = 0; num153 < 4; num153++) { int num154 = (int)(73f + (float)(num152 * 56) * Main.inventoryScale); int num155 = (int)((float)this.invBottom + (float)(num153 * 56) * Main.inventoryScale); int num156 = num152 + num153 * 10; Color white14 = new Color(100, 100, 100, 100); if (Main.mouseX >= num154 && (float)Main.mouseX <= (float)num154 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num155 && (float)Main.mouseY <= (float)num155 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft) { if ((Main.player[Main.myPlayer].selectedItem != num156 || Main.player[Main.myPlayer].itemAnimation <= 0) && Main.player[Main.myPlayer].itemTime == 0) { Item item10 = Main.mouseItem; Main.mouseItem = Main.chest[Main.player[Main.myPlayer].chest].item[num156]; Main.chest[Main.player[Main.myPlayer].chest].item[num156] = item10; if (Main.chest[Main.player[Main.myPlayer].chest].item[num156].type == 0 || Main.chest[Main.player[Main.myPlayer].chest].item[num156].stack < 1) { Main.chest[Main.player[Main.myPlayer].chest].item[num156] = new Item(); } if (Main.mouseItem.IsTheSameAs(Main.chest[Main.player[Main.myPlayer].chest].item[num156]) && Main.chest[Main.player[Main.myPlayer].chest].item[num156].stack != Main.chest[Main.player[Main.myPlayer].chest].item[num156].maxStack && Main.mouseItem.stack != Main.mouseItem.maxStack) { if (Main.mouseItem.stack + Main.chest[Main.player[Main.myPlayer].chest].item[num156].stack <= Main.mouseItem.maxStack) { Main.chest[Main.player[Main.myPlayer].chest].item[num156].stack += Main.mouseItem.stack; Main.mouseItem.stack = 0; } else { int num157 = Main.mouseItem.maxStack - Main.chest[Main.player[Main.myPlayer].chest].item[num156].stack; Main.chest[Main.player[Main.myPlayer].chest].item[num156].stack += num157; Main.mouseItem.stack -= num157; } } if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1) { Main.mouseItem = new Item(); } if (Main.mouseItem.type > 0 || Main.chest[Main.player[Main.myPlayer].chest].item[num156].type > 0) { Recipe.FindRecipes(); Main.PlaySound(7, -1, -1, 1); } if (Main.netMode == 1) { NetMessage.SendData(32, -1, -1, "", Main.player[Main.myPlayer].chest, (float)num156, 0f, 0f, 0); } } } else { if (Main.mouseRight && Main.mouseRightRelease && Main.chest[Main.player[Main.myPlayer].chest].item[num156].maxStack == 1) { Main.chest[Main.player[Main.myPlayer].chest].item[num156] = Main.armorSwap(Main.chest[Main.player[Main.myPlayer].chest].item[num156]); if (Main.netMode == 1) { NetMessage.SendData(32, -1, -1, "", Main.player[Main.myPlayer].chest, (float)num156, 0f, 0f, 0); } } else { if (Main.stackSplit <= 1 && Main.mouseRight && Main.chest[Main.player[Main.myPlayer].chest].item[num156].maxStack > 1 && (Main.mouseItem.IsTheSameAs(Main.chest[Main.player[Main.myPlayer].chest].item[num156]) || Main.mouseItem.type == 0) && (Main.mouseItem.stack < Main.mouseItem.maxStack || Main.mouseItem.type == 0)) { if (Main.mouseItem.type == 0) { Main.mouseItem = (Item)Main.chest[Main.player[Main.myPlayer].chest].item[num156].Clone(); Main.mouseItem.stack = 0; } Main.mouseItem.stack++; Main.chest[Main.player[Main.myPlayer].chest].item[num156].stack--; if (Main.chest[Main.player[Main.myPlayer].chest].item[num156].stack <= 0) { Main.chest[Main.player[Main.myPlayer].chest].item[num156] = new Item(); } Recipe.FindRecipes(); Main.soundInstanceMenuTick.Stop(); Main.soundInstanceMenuTick = Main.soundMenuTick.CreateInstance(); Main.PlaySound(12, -1, -1, 1); if (Main.stackSplit == 0) { Main.stackSplit = 15; } else { Main.stackSplit = Main.stackDelay; } if (Main.netMode == 1) { NetMessage.SendData(32, -1, -1, "", Main.player[Main.myPlayer].chest, (float)num156, 0f, 0f, 0); } } } } Main.hoverItemName = Main.chest[Main.player[Main.myPlayer].chest].item[num156].name; Main.toolTip = (Item)Main.chest[Main.player[Main.myPlayer].chest].item[num156].Clone(); if (Main.chest[Main.player[Main.myPlayer].chest].item[num156].stack > 1) { object obj = Main.hoverItemName; Main.hoverItemName = string.Concat(new object[] { obj, " (", Main.chest[Main.player[Main.myPlayer].chest].item[num156].stack, ")" }); } } this.spriteBatch.Draw(Main.inventoryBack5Texture, new Vector2((float)num154, (float)num155), new Rectangle?(new Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height)), Main.inventoryBack, 0f, default(Vector2), Main.inventoryScale, SpriteEffects.None, 0f); white14 = Color.White; if (Main.chest[Main.player[Main.myPlayer].chest].item[num156].type > 0 && Main.chest[Main.player[Main.myPlayer].chest].item[num156].stack > 0) { float num158 = 1f; if (Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num156].type].Width > 32 || Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num156].type].Height > 32) { if (Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num156].type].Width > Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num156].type].Height) { num158 = 32f / (float)Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num156].type].Width; } else { num158 = 32f / (float)Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num156].type].Height; } } num158 *= Main.inventoryScale; if (Main.chest[Main.player[Main.myPlayer].chest].item[num156].type == 662 || Main.chest[Main.player[Main.myPlayer].chest].item[num156].type == 663) { white14.R = (byte)Main.DiscoR; white14.G = (byte)Main.DiscoG; white14.B = (byte)Main.DiscoB; white14.A = 255; } this.spriteBatch.Draw(Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num156].type], new Vector2((float)num154 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num156].type].Width * 0.5f * num158, (float)num155 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num156].type].Height * 0.5f * num158), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num156].type].Width, Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num156].type].Height)), Main.chest[Main.player[Main.myPlayer].chest].item[num156].GetAlpha(white14), 0f, default(Vector2), num158, SpriteEffects.None, 0f); white14 = Color.White; if (Main.chest[Main.player[Main.myPlayer].chest].item[num156].color != default(Color)) { this.spriteBatch.Draw(Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num156].type], new Vector2((float)num154 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num156].type].Width * 0.5f * num158, (float)num155 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num156].type].Height * 0.5f * num158), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num156].type].Width, Main.itemTexture[Main.chest[Main.player[Main.myPlayer].chest].item[num156].type].Height)), Main.chest[Main.player[Main.myPlayer].chest].item[num156].GetColor(white14), 0f, default(Vector2), num158, SpriteEffects.None, 0f); } if (Main.chest[Main.player[Main.myPlayer].chest].item[num156].stack > 1) { this.spriteBatch.DrawString(Main.fontItemStack, string.Concat(Main.chest[Main.player[Main.myPlayer].chest].item[num156].stack), new Vector2((float)num154 + 10f * Main.inventoryScale, (float)num155 + 26f * Main.inventoryScale), white14, 0f, default(Vector2), num158, SpriteEffects.None, 0f); } } } } } if (Main.player[Main.myPlayer].chest == -2) { this.spriteBatch.DrawString(Main.fontMouseText, Lang.inter[32], new Vector2(504f, (float)this.invBottom), new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); Main.inventoryScale = 0.755f; if (Main.mouseX > 73 && Main.mouseX < (int)(73f + 560f * Main.inventoryScale) && Main.mouseY > this.invBottom && Main.mouseY < (int)((float)this.invBottom + 224f * Main.inventoryScale)) { Main.player[Main.myPlayer].mouseInterface = true; } for (int num159 = 0; num159 < 10; num159++) { for (int num160 = 0; num160 < 4; num160++) { int num161 = (int)(73f + (float)(num159 * 56) * Main.inventoryScale); int num162 = (int)((float)this.invBottom + (float)(num160 * 56) * Main.inventoryScale); int num163 = num159 + num160 * 10; Color white15 = new Color(100, 100, 100, 100); if (Main.mouseX >= num161 && (float)Main.mouseX <= (float)num161 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num162 && (float)Main.mouseY <= (float)num162 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft) { if ((Main.player[Main.myPlayer].selectedItem != num163 || Main.player[Main.myPlayer].itemAnimation <= 0) && Main.player[Main.myPlayer].itemTime == 0) { Item item11 = Main.mouseItem; Main.mouseItem = Main.player[Main.myPlayer].bank[num163]; Main.player[Main.myPlayer].bank[num163] = item11; if (Main.player[Main.myPlayer].bank[num163].type == 0 || Main.player[Main.myPlayer].bank[num163].stack < 1) { Main.player[Main.myPlayer].bank[num163] = new Item(); } if (Main.mouseItem.IsTheSameAs(Main.player[Main.myPlayer].bank[num163]) && Main.player[Main.myPlayer].bank[num163].stack != Main.player[Main.myPlayer].bank[num163].maxStack && Main.mouseItem.stack != Main.mouseItem.maxStack) { if (Main.mouseItem.stack + Main.player[Main.myPlayer].bank[num163].stack <= Main.mouseItem.maxStack) { Main.player[Main.myPlayer].bank[num163].stack += Main.mouseItem.stack; Main.mouseItem.stack = 0; } else { int num164 = Main.mouseItem.maxStack - Main.player[Main.myPlayer].bank[num163].stack; Main.player[Main.myPlayer].bank[num163].stack += num164; Main.mouseItem.stack -= num164; } } if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1) { Main.mouseItem = new Item(); } if (Main.mouseItem.type > 0 || Main.player[Main.myPlayer].bank[num163].type > 0) { Recipe.FindRecipes(); Main.PlaySound(7, -1, -1, 1); } } } else { if (Main.mouseRight && Main.mouseRightRelease && Main.player[Main.myPlayer].bank[num163].maxStack == 1) { Main.player[Main.myPlayer].bank[num163] = Main.armorSwap(Main.player[Main.myPlayer].bank[num163]); } else { if (Main.stackSplit <= 1 && Main.mouseRight && Main.player[Main.myPlayer].bank[num163].maxStack > 1 && (Main.mouseItem.IsTheSameAs(Main.player[Main.myPlayer].bank[num163]) || Main.mouseItem.type == 0) && (Main.mouseItem.stack < Main.mouseItem.maxStack || Main.mouseItem.type == 0)) { if (Main.mouseItem.type == 0) { Main.mouseItem = (Item)Main.player[Main.myPlayer].bank[num163].Clone(); Main.mouseItem.stack = 0; } Main.mouseItem.stack++; Main.player[Main.myPlayer].bank[num163].stack--; if (Main.player[Main.myPlayer].bank[num163].stack <= 0) { Main.player[Main.myPlayer].bank[num163] = new Item(); } Recipe.FindRecipes(); Main.soundInstanceMenuTick.Stop(); Main.soundInstanceMenuTick = Main.soundMenuTick.CreateInstance(); Main.PlaySound(12, -1, -1, 1); if (Main.stackSplit == 0) { Main.stackSplit = 15; } else { Main.stackSplit = Main.stackDelay; } } } } Main.hoverItemName = Main.player[Main.myPlayer].bank[num163].name; Main.toolTip = (Item)Main.player[Main.myPlayer].bank[num163].Clone(); if (Main.player[Main.myPlayer].bank[num163].stack > 1) { object obj = Main.hoverItemName; Main.hoverItemName = string.Concat(new object[] { obj, " (", Main.player[Main.myPlayer].bank[num163].stack, ")" }); } } this.spriteBatch.Draw(Main.inventoryBack2Texture, new Vector2((float)num161, (float)num162), new Rectangle?(new Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height)), Main.inventoryBack, 0f, default(Vector2), Main.inventoryScale, SpriteEffects.None, 0f); white15 = Color.White; if (Main.player[Main.myPlayer].bank[num163].type > 0 && Main.player[Main.myPlayer].bank[num163].stack > 0) { float num165 = 1f; if (Main.itemTexture[Main.player[Main.myPlayer].bank[num163].type].Width > 32 || Main.itemTexture[Main.player[Main.myPlayer].bank[num163].type].Height > 32) { if (Main.itemTexture[Main.player[Main.myPlayer].bank[num163].type].Width > Main.itemTexture[Main.player[Main.myPlayer].bank[num163].type].Height) { num165 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].bank[num163].type].Width; } else { num165 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].bank[num163].type].Height; } } num165 *= Main.inventoryScale; if (Main.player[Main.myPlayer].bank[num163].type == 662 || Main.player[Main.myPlayer].bank[num163].type == 663) { white15.R = (byte)Main.DiscoR; white15.G = (byte)Main.DiscoG; white15.B = (byte)Main.DiscoB; white15.A = 255; } this.spriteBatch.Draw(Main.itemTexture[Main.player[Main.myPlayer].bank[num163].type], new Vector2((float)num161 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].bank[num163].type].Width * 0.5f * num165, (float)num162 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].bank[num163].type].Height * 0.5f * num165), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].bank[num163].type].Width, Main.itemTexture[Main.player[Main.myPlayer].bank[num163].type].Height)), Main.player[Main.myPlayer].bank[num163].GetAlpha(white15), 0f, default(Vector2), num165, SpriteEffects.None, 0f); white15 = Color.White; if (Main.player[Main.myPlayer].bank[num163].color != default(Color)) { this.spriteBatch.Draw(Main.itemTexture[Main.player[Main.myPlayer].bank[num163].type], new Vector2((float)num161 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].bank[num163].type].Width * 0.5f * num165, (float)num162 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].bank[num163].type].Height * 0.5f * num165), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].bank[num163].type].Width, Main.itemTexture[Main.player[Main.myPlayer].bank[num163].type].Height)), Main.player[Main.myPlayer].bank[num163].GetColor(white15), 0f, default(Vector2), num165, SpriteEffects.None, 0f); } if (Main.player[Main.myPlayer].bank[num163].stack > 1) { this.spriteBatch.DrawString(Main.fontItemStack, string.Concat(Main.player[Main.myPlayer].bank[num163].stack), new Vector2((float)num161 + 10f * Main.inventoryScale, (float)num162 + 26f * Main.inventoryScale), white15, 0f, default(Vector2), num165, SpriteEffects.None, 0f); } } } } } if (Main.player[Main.myPlayer].chest == -3) { this.spriteBatch.DrawString(Main.fontMouseText, Lang.inter[33], new Vector2(504f, (float)this.invBottom), new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); Main.inventoryScale = 0.755f; if (Main.mouseX > 73 && Main.mouseX < (int)(73f + 560f * Main.inventoryScale) && Main.mouseY > this.invBottom && Main.mouseY < (int)((float)this.invBottom + 224f * Main.inventoryScale)) { Main.player[Main.myPlayer].mouseInterface = true; } for (int num166 = 0; num166 < 10; num166++) { for (int num167 = 0; num167 < 4; num167++) { int num168 = (int)(73f + (float)(num166 * 56) * Main.inventoryScale); int num169 = (int)((float)this.invBottom + (float)(num167 * 56) * Main.inventoryScale); int num170 = num166 + num167 * 10; Color white16 = new Color(100, 100, 100, 100); if (Main.mouseX >= num168 && (float)Main.mouseX <= (float)num168 + (float)Main.inventoryBackTexture.Width * Main.inventoryScale && Main.mouseY >= num169 && (float)Main.mouseY <= (float)num169 + (float)Main.inventoryBackTexture.Height * Main.inventoryScale) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft) { if ((Main.player[Main.myPlayer].selectedItem != num170 || Main.player[Main.myPlayer].itemAnimation <= 0) && Main.player[Main.myPlayer].itemTime == 0) { Item item12 = Main.mouseItem; Main.mouseItem = Main.player[Main.myPlayer].bank2[num170]; Main.player[Main.myPlayer].bank2[num170] = item12; if (Main.player[Main.myPlayer].bank2[num170].type == 0 || Main.player[Main.myPlayer].bank2[num170].stack < 1) { Main.player[Main.myPlayer].bank2[num170] = new Item(); } if (Main.mouseItem.IsTheSameAs(Main.player[Main.myPlayer].bank2[num170]) && Main.player[Main.myPlayer].bank2[num170].stack != Main.player[Main.myPlayer].bank2[num170].maxStack && Main.mouseItem.stack != Main.mouseItem.maxStack) { if (Main.mouseItem.stack + Main.player[Main.myPlayer].bank2[num170].stack <= Main.mouseItem.maxStack) { Main.player[Main.myPlayer].bank2[num170].stack += Main.mouseItem.stack; Main.mouseItem.stack = 0; } else { int num171 = Main.mouseItem.maxStack - Main.player[Main.myPlayer].bank2[num170].stack; Main.player[Main.myPlayer].bank2[num170].stack += num171; Main.mouseItem.stack -= num171; } } if (Main.mouseItem.type == 0 || Main.mouseItem.stack < 1) { Main.mouseItem = new Item(); } if (Main.mouseItem.type > 0 || Main.player[Main.myPlayer].bank2[num170].type > 0) { Recipe.FindRecipes(); Main.PlaySound(7, -1, -1, 1); } } } else { if (Main.mouseRight && Main.mouseRightRelease && Main.player[Main.myPlayer].bank2[num170].maxStack == 1) { Main.player[Main.myPlayer].bank2[num170] = Main.armorSwap(Main.player[Main.myPlayer].bank2[num170]); } else { if (Main.stackSplit <= 1 && Main.mouseRight && Main.player[Main.myPlayer].bank2[num170].maxStack > 1 && (Main.mouseItem.IsTheSameAs(Main.player[Main.myPlayer].bank2[num170]) || Main.mouseItem.type == 0) && (Main.mouseItem.stack < Main.mouseItem.maxStack || Main.mouseItem.type == 0)) { if (Main.mouseItem.type == 0) { Main.mouseItem = (Item)Main.player[Main.myPlayer].bank2[num170].Clone(); Main.mouseItem.stack = 0; } Main.mouseItem.stack++; Main.player[Main.myPlayer].bank2[num170].stack--; if (Main.player[Main.myPlayer].bank2[num170].stack <= 0) { Main.player[Main.myPlayer].bank2[num170] = new Item(); } Recipe.FindRecipes(); Main.soundInstanceMenuTick.Stop(); Main.soundInstanceMenuTick = Main.soundMenuTick.CreateInstance(); Main.PlaySound(12, -1, -1, 1); if (Main.stackSplit == 0) { Main.stackSplit = 15; } else { Main.stackSplit = Main.stackDelay; } } } } Main.hoverItemName = Main.player[Main.myPlayer].bank2[num170].name; Main.toolTip = (Item)Main.player[Main.myPlayer].bank2[num170].Clone(); if (Main.player[Main.myPlayer].bank2[num170].stack > 1) { object obj = Main.hoverItemName; Main.hoverItemName = string.Concat(new object[] { obj, " (", Main.player[Main.myPlayer].bank2[num170].stack, ")" }); } } this.spriteBatch.Draw(Main.inventoryBack2Texture, new Vector2((float)num168, (float)num169), new Rectangle?(new Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height)), Main.inventoryBack, 0f, default(Vector2), Main.inventoryScale, SpriteEffects.None, 0f); white16 = Color.White; if (Main.player[Main.myPlayer].bank2[num170].type > 0 && Main.player[Main.myPlayer].bank2[num170].stack > 0) { float num172 = 1f; if (Main.itemTexture[Main.player[Main.myPlayer].bank2[num170].type].Width > 32 || Main.itemTexture[Main.player[Main.myPlayer].bank2[num170].type].Height > 32) { if (Main.itemTexture[Main.player[Main.myPlayer].bank2[num170].type].Width > Main.itemTexture[Main.player[Main.myPlayer].bank2[num170].type].Height) { num172 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].bank2[num170].type].Width; } else { num172 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].bank2[num170].type].Height; } } num172 *= Main.inventoryScale; if (Main.player[Main.myPlayer].bank2[num170].type == 662 || Main.player[Main.myPlayer].bank2[num170].type == 663) { white16.R = (byte)Main.DiscoR; white16.G = (byte)Main.DiscoG; white16.B = (byte)Main.DiscoB; white16.A = 255; } this.spriteBatch.Draw(Main.itemTexture[Main.player[Main.myPlayer].bank2[num170].type], new Vector2((float)num168 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].bank2[num170].type].Width * 0.5f * num172, (float)num169 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].bank2[num170].type].Height * 0.5f * num172), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].bank2[num170].type].Width, Main.itemTexture[Main.player[Main.myPlayer].bank2[num170].type].Height)), Main.player[Main.myPlayer].bank2[num170].GetAlpha(white16), 0f, default(Vector2), num172, SpriteEffects.None, 0f); white16 = Color.White; if (Main.player[Main.myPlayer].bank2[num170].color != default(Color)) { this.spriteBatch.Draw(Main.itemTexture[Main.player[Main.myPlayer].bank2[num170].type], new Vector2((float)num168 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].bank2[num170].type].Width * 0.5f * num172, (float)num169 + 26f * Main.inventoryScale - (float)Main.itemTexture[Main.player[Main.myPlayer].bank2[num170].type].Height * 0.5f * num172), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].bank2[num170].type].Width, Main.itemTexture[Main.player[Main.myPlayer].bank2[num170].type].Height)), Main.player[Main.myPlayer].bank2[num170].GetColor(white16), 0f, default(Vector2), num172, SpriteEffects.None, 0f); } if (Main.player[Main.myPlayer].bank2[num170].stack > 1) { this.spriteBatch.DrawString(Main.fontItemStack, string.Concat(Main.player[Main.myPlayer].bank2[num170].stack), new Vector2((float)num168 + 10f * Main.inventoryScale, (float)num169 + 26f * Main.inventoryScale), white16, 0f, default(Vector2), num172, SpriteEffects.None, 0f); } } } } } } protected void DrawMouseOver() { Rectangle rectangle = new Rectangle((int)((float)Main.mouseX + Main.screenPosition.X), (int)((float)Main.mouseY + Main.screenPosition.Y), 1, 1); if (Main.player[Main.myPlayer].gravDir == -1f) { rectangle.Y = (int)Main.screenPosition.Y + Main.screenHeight - Main.mouseY; } if (!Main.mouseText) { int num = 26 * Main.player[Main.myPlayer].statLifeMax / (int)Main.heartLife; int num2 = 0; if (Main.player[Main.myPlayer].statLifeMax > 200) { num = 260; num2 += 26; } if (Main.mouseX > 500 + Main.sX && Main.mouseX < 500 + num + Main.sX && Main.mouseY > 32 && Main.mouseY < 32 + Main.heartTexture.Height + num2) { Main.player[Main.myPlayer].showItemIcon = false; string cursorText = Main.player[Main.myPlayer].statLife + "/" + Main.player[Main.myPlayer].statLifeMax; this.MouseText(cursorText, 0, 0); Main.mouseText = true; } } if (!Main.mouseText) { int num3 = 24; int num4 = 28 * Main.player[Main.myPlayer].statManaMax2 / Main.starMana; if (Main.mouseX > 762 + Main.sX && Main.mouseX < 762 + num3 + Main.sX && Main.mouseY > 30 && Main.mouseY < 30 + num4) { Main.player[Main.myPlayer].showItemIcon = false; string cursorText2 = Main.player[Main.myPlayer].statMana + "/" + Main.player[Main.myPlayer].statManaMax2; this.MouseText(cursorText2, 0, 0); Main.mouseText = true; } } if (!Main.mouseText) { for (int i = 0; i < 400; i++) { if (Main.item[i].active) { Rectangle value = new Rectangle((int)((double)Main.item[i].position.X + (double)Main.item[i].width * 0.5 - (double)Main.itemTexture[Main.item[i].type].Width * 0.5), (int)(Main.item[i].position.Y + (float)Main.item[i].height - (float)Main.itemTexture[Main.item[i].type].Height), Main.itemTexture[Main.item[i].type].Width, Main.itemTexture[Main.item[i].type].Height); if (rectangle.Intersects(value)) { Main.player[Main.myPlayer].showItemIcon = false; string text = Main.item[i].AffixName(); if (Main.item[i].stack > 1) { object obj = text; text = string.Concat(new object[] { obj, " (", Main.item[i].stack, ")" }); } if (Main.item[i].owner < 255 && Main.showItemOwner) { text = text + " <" + Main.player[Main.item[i].owner].name + ">"; } Main.rare = Main.item[i].rare; this.MouseText(text, Main.rare, 0); Main.mouseText = true; break; } } } } for (int j = 0; j < 255; j++) { if (Main.player[j].active && Main.myPlayer != j && !Main.player[j].dead) { Rectangle value2 = new Rectangle((int)((double)Main.player[j].position.X + (double)Main.player[j].width * 0.5 - 16.0), (int)(Main.player[j].position.Y + (float)Main.player[j].height - 48f), 32, 48); if (!Main.mouseText && rectangle.Intersects(value2)) { Main.player[Main.myPlayer].showItemIcon = false; int num5 = Main.player[j].statLife; if (num5 < 0) { num5 = 0; } string text2 = string.Concat(new object[] { Main.player[j].name, ": ", num5, "/", Main.player[j].statLifeMax }); if (Main.player[j].hostile) { text2 += " (PvP)"; } this.MouseText(text2, 0, Main.player[j].difficulty); } } } if (!Main.mouseText) { for (int k = 0; k < 200; k++) { if (Main.npc[k].active) { this.LoadNPC(Main.npc[k].type); Rectangle value3 = new Rectangle((int)((double)Main.npc[k].position.X + (double)Main.npc[k].width * 0.5 - (double)Main.npcTexture[Main.npc[k].type].Width * 0.5), (int)(Main.npc[k].position.Y + (float)Main.npc[k].height - (float)(Main.npcTexture[Main.npc[k].type].Height / Main.npcFrameCount[Main.npc[k].type])), Main.npcTexture[Main.npc[k].type].Width, Main.npcTexture[Main.npc[k].type].Height / Main.npcFrameCount[Main.npc[k].type]); if (Main.npc[k].type >= 87 && Main.npc[k].type <= 92) { value3 = new Rectangle((int)((double)Main.npc[k].position.X + (double)Main.npc[k].width * 0.5 - 32.0), (int)((double)Main.npc[k].position.Y + (double)Main.npc[k].height * 0.5 - 32.0), 64, 64); } if (rectangle.Intersects(value3) && (Main.npc[k].type != 85 || Main.npc[k].ai[0] != 0f)) { bool flag = false; if (Main.npc[k].townNPC || Main.npc[k].type == 105 || Main.npc[k].type == 106 || Main.npc[k].type == 123) { Rectangle rectangle2 = new Rectangle((int)(Main.player[Main.myPlayer].position.X + (float)(Main.player[Main.myPlayer].width / 2) - (float)(Player.tileRangeX * 16)), (int)(Main.player[Main.myPlayer].position.Y + (float)(Main.player[Main.myPlayer].height / 2) - (float)(Player.tileRangeY * 16)), Player.tileRangeX * 16 * 2, Player.tileRangeY * 16 * 2); Rectangle value4 = new Rectangle((int)Main.npc[k].position.X, (int)Main.npc[k].position.Y, Main.npc[k].width, Main.npc[k].height); if (rectangle2.Intersects(value4)) { flag = true; } } if (flag && !Main.player[Main.myPlayer].dead) { int num6 = -(Main.npc[k].width / 2 + 8); SpriteEffects effects = SpriteEffects.None; if (Main.npc[k].spriteDirection == -1) { effects = SpriteEffects.FlipHorizontally; num6 = Main.npc[k].width / 2 + 8; } this.spriteBatch.Draw(Main.chatTexture, new Vector2(Main.npc[k].position.X + (float)(Main.npc[k].width / 2) - Main.screenPosition.X - (float)(Main.chatTexture.Width / 2) - (float)num6, Main.npc[k].position.Y - (float)Main.chatTexture.Height - Main.screenPosition.Y), new Rectangle?(new Rectangle(0, 0, Main.chatTexture.Width, Main.chatTexture.Height)), new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), 0f, default(Vector2), 1f, effects, 0f); if (Main.mouseRight && Main.npcChatRelease) { Main.npcChatRelease = false; if (Main.player[Main.myPlayer].talkNPC != k) { Main.npcShop = 0; Main.craftGuide = false; Main.player[Main.myPlayer].dropItemCheck(); Recipe.FindRecipes(); Main.player[Main.myPlayer].sign = -1; Main.editSign = false; Main.player[Main.myPlayer].talkNPC = k; Main.playerInventory = false; Main.player[Main.myPlayer].chest = -1; Main.npcChatText = Main.npc[k].GetChat(); Main.PlaySound(24, -1, -1, 1); } } } Main.player[Main.myPlayer].showItemIcon = false; string text3 = Main.npc[k].displayName; int num7 = k; if (Main.npc[k].realLife >= 0) { num7 = Main.npc[k].realLife; } if (Main.npc[num7].lifeMax > 1 && !Main.npc[num7].dontTakeDamage) { object obj2 = text3; text3 = string.Concat(new object[] { obj2, ": ", Main.npc[num7].life, "/", Main.npc[num7].lifeMax }); } this.MouseText(text3, 0, 0); return; } } } } } protected void DrawInterfaceBars() { Main.sX = Main.screenWidth - 800; int num = Main.player[Main.myPlayer].statLifeMax / 20; if (num >= 10) { num = 10; } string text = string.Concat(new object[] { Lang.inter[0], " ", Main.player[Main.myPlayer].statLifeMax, "/", Main.player[Main.myPlayer].statLifeMax }); Vector2 vector = Main.fontMouseText.MeasureString(text); if (!Main.player[Main.myPlayer].ghost) { this.spriteBatch.DrawString(Main.fontMouseText, Lang.inter[0], new Vector2((float)(500 + 13 * num) - vector.X * 0.5f + (float)Main.sX, 6f), new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); this.spriteBatch.DrawString(Main.fontMouseText, Main.player[Main.myPlayer].statLife + "/" + Main.player[Main.myPlayer].statLifeMax, new Vector2((float)(500 + 13 * num) + vector.X * 0.5f + (float)Main.sX, 6f), new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), 0f, new Vector2(Main.fontMouseText.MeasureString(Main.player[Main.myPlayer].statLife + "/" + Main.player[Main.myPlayer].statLifeMax).X, 0f), 1f, SpriteEffects.None, 0f); } Main.heartLife = 20f; if (Main.player[Main.myPlayer].statLifeMax > 400) { Main.heartLife = (float)Main.player[Main.myPlayer].statLifeMax / 20f; } int num2 = (Main.player[Main.myPlayer].statLifeMax - 400) / 5; if (num2 < 0) { num2 = 0; } int num3 = 1; while ((float)num3 < (float)Main.player[Main.myPlayer].statLifeMax / Main.heartLife + 1f) { float num4 = 1f; bool flag = false; int num5; if ((float)Main.player[Main.myPlayer].statLife >= (float)num3 * Main.heartLife) { num5 = 255; if ((float)Main.player[Main.myPlayer].statLife == (float)num3 * Main.heartLife) { flag = true; } } else { float num6 = ((float)Main.player[Main.myPlayer].statLife - (float)(num3 - 1) * Main.heartLife) / Main.heartLife; num5 = (int)(30f + 225f * num6); if (num5 < 30) { num5 = 30; } num4 = num6 / 4f + 0.75f; if ((double)num4 < 0.75) { num4 = 0.75f; } if (num6 > 0f) { flag = true; } } if (flag) { num4 += Main.cursorScale - 1f; } int num7 = 0; int num8 = 0; if (num3 > 10) { num7 -= 260; num8 += 26; } int num9 = (int)((double)((float)num5) * 0.9); if (!Main.player[Main.myPlayer].ghost) { if (num2 > 0) { num2--; this.spriteBatch.Draw(Main.heart2Texture, new Vector2((float)(500 + 26 * (num3 - 1) + num7 + Main.sX + Main.heartTexture.Width / 2), 32f + ((float)Main.heartTexture.Height - (float)Main.heartTexture.Height * num4) / 2f + (float)num8 + (float)(Main.heartTexture.Height / 2)), new Rectangle?(new Rectangle(0, 0, Main.heartTexture.Width, Main.heartTexture.Height)), new Color(num5, num5, num5, num9), 0f, new Vector2((float)(Main.heartTexture.Width / 2), (float)(Main.heartTexture.Height / 2)), num4, SpriteEffects.None, 0f); } else { this.spriteBatch.Draw(Main.heartTexture, new Vector2((float)(500 + 26 * (num3 - 1) + num7 + Main.sX + Main.heartTexture.Width / 2), 32f + ((float)Main.heartTexture.Height - (float)Main.heartTexture.Height * num4) / 2f + (float)num8 + (float)(Main.heartTexture.Height / 2)), new Rectangle?(new Rectangle(0, 0, Main.heartTexture.Width, Main.heartTexture.Height)), new Color(num5, num5, num5, num9), 0f, new Vector2((float)(Main.heartTexture.Width / 2), (float)(Main.heartTexture.Height / 2)), num4, SpriteEffects.None, 0f); } } num3++; } Main.starMana = 20; if (Main.player[Main.myPlayer].statManaMax2 > 0) { int arg_585_0 = Main.player[Main.myPlayer].statManaMax2 / 20; this.spriteBatch.DrawString(Main.fontMouseText, Lang.inter[2], new Vector2((float)(750 + Main.sX), 6f), new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); for (int i = 1; i < Main.player[Main.myPlayer].statManaMax2 / Main.starMana + 1; i++) { bool flag2 = false; float num10 = 1f; int num11; if (Main.player[Main.myPlayer].statMana >= i * Main.starMana) { num11 = 255; if (Main.player[Main.myPlayer].statMana == i * Main.starMana) { flag2 = true; } } else { float num12 = (float)(Main.player[Main.myPlayer].statMana - (i - 1) * Main.starMana) / (float)Main.starMana; num11 = (int)(30f + 225f * num12); if (num11 < 30) { num11 = 30; } num10 = num12 / 4f + 0.75f; if ((double)num10 < 0.75) { num10 = 0.75f; } if (num12 > 0f) { flag2 = true; } } if (flag2) { num10 += Main.cursorScale - 1f; } int num13 = (int)((double)((float)num11) * 0.9); this.spriteBatch.Draw(Main.manaTexture, new Vector2((float)(775 + Main.sX), (float)(30 + Main.manaTexture.Height / 2) + ((float)Main.manaTexture.Height - (float)Main.manaTexture.Height * num10) / 2f + (float)(28 * (i - 1))), new Rectangle?(new Rectangle(0, 0, Main.manaTexture.Width, Main.manaTexture.Height)), new Color(num11, num11, num11, num13), 0f, new Vector2((float)(Main.manaTexture.Width / 2), (float)(Main.manaTexture.Height / 2)), num10, SpriteEffects.None, 0f); } } bool flag3 = false; if (Main.player[Main.myPlayer].lavaTime < Main.player[Main.myPlayer].lavaMax && Main.player[Main.myPlayer].lavaWet) { flag3 = true; } else { if (Main.player[Main.myPlayer].lavaTime < Main.player[Main.myPlayer].lavaMax && Main.player[Main.myPlayer].breath == Main.player[Main.myPlayer].breathMax) { flag3 = true; } } if (Main.player[Main.myPlayer].breath < Main.player[Main.myPlayer].breathMax && !Main.player[Main.myPlayer].ghost && !flag3) { int num14 = 76 + Main.mH; int arg_88F_0 = Main.player[Main.myPlayer].breathMax / 20; this.spriteBatch.DrawString(Main.fontMouseText, Lang.inter[1], new Vector2((float)(500 + 13 * num) - Main.fontMouseText.MeasureString(Lang.inter[1]).X * 0.5f + (float)Main.sX, (float)(6 + num14)), new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); int num15 = 20; for (int j = 1; j < Main.player[Main.myPlayer].breathMax / num15 + 1; j++) { float num16 = 1f; int num17; if (Main.player[Main.myPlayer].breath >= j * num15) { num17 = 255; } else { float num18 = (float)(Main.player[Main.myPlayer].breath - (j - 1) * num15) / (float)num15; num17 = (int)(30f + 225f * num18); if (num17 < 30) { num17 = 30; } num16 = num18 / 4f + 0.75f; if ((double)num16 < 0.75) { num16 = 0.75f; } } int num19 = 0; int num20 = 0; if (j > 10) { num19 -= 260; num20 += 26; } this.spriteBatch.Draw(Main.bubbleTexture, new Vector2((float)(500 + 26 * (j - 1) + num19 + Main.sX), 32f + ((float)Main.bubbleTexture.Height - (float)Main.bubbleTexture.Height * num16) / 2f + (float)num20 + (float)num14), new Rectangle?(new Rectangle(0, 0, Main.bubbleTexture.Width, Main.bubbleTexture.Height)), new Color(num17, num17, num17, num17), 0f, default(Vector2), num16, SpriteEffects.None, 0f); } } if (Main.player[Main.myPlayer].lavaTime < Main.player[Main.myPlayer].lavaMax && !Main.player[Main.myPlayer].ghost && flag3) { int num21 = 76 + Main.mH; int num22 = Main.player[Main.myPlayer].lavaMax / 10; int arg_AFC_0 = Main.player[Main.myPlayer].breathMax / num22; this.spriteBatch.DrawString(Main.fontMouseText, Lang.inter[56], new Vector2(630f - Main.fontMouseText.MeasureString(Lang.inter[56]).X * 0.5f + (float)Main.sX, (float)(6 + num21)), new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); for (int k = 1; k < Main.player[Main.myPlayer].lavaMax / num22 + 1; k++) { float num23 = 1f; int num24; if (Main.player[Main.myPlayer].lavaTime >= k * num22) { num24 = 255; } else { float num25 = (float)(Main.player[Main.myPlayer].lavaTime - (k - 1) * num22) / (float)num22; num24 = (int)(30f + 225f * num25); if (num24 < 30) { num24 = 30; } num23 = num25 / 4f + 0.75f; if ((double)num23 < 0.75) { num23 = 0.75f; } } int num26 = 0; int num27 = 0; if (k > 10) { num26 -= 260; num27 += 26; } this.spriteBatch.Draw(Main.flameTexture, new Vector2((float)(500 + 26 * (k - 1) + num26 + Main.sX), 32f + ((float)Main.flameTexture.Height - (float)Main.flameTexture.Height * num23) / 2f + (float)num27 + (float)num21), new Rectangle?(new Rectangle(0, 0, Main.bubbleTexture.Width, Main.bubbleTexture.Height)), new Color(num24, num24, num24, num24), 0f, default(Vector2), num23, SpriteEffects.None, 0f); } } Main.buffString = ""; if (!Main.recBigList) { Main.recStart = 0; } if (!Main.playerInventory) { Main.recBigList = false; int num28 = -1; for (int l = 0; l < 10; l++) { if (Main.player[Main.myPlayer].buffType[l] > 0) { int num29 = Main.player[Main.myPlayer].buffType[l]; int num30 = 32 + l * 38; int num31 = 76; Color color = new Color(Main.buffAlpha[l], Main.buffAlpha[l], Main.buffAlpha[l], Main.buffAlpha[l]); this.spriteBatch.Draw(Main.buffTexture[num29], new Vector2((float)num30, (float)num31), new Rectangle?(new Rectangle(0, 0, Main.buffTexture[num29].Width, Main.buffTexture[num29].Height)), color, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); if (!Main.vanityPet[num29] && !Main.lightPet[num29] && num29 != 64 && num29 != 60 && num29 != 49 && num29 != 28 && num29 != 34 && num29 != 37 && num29 != 38 && num29 != 40 && num29 != 41 && num29 != 27 && num29 != 19 && num29 != 42 && num29 != 43 && num29 != 45 && (!Main.player[Main.myPlayer].honeyWet || num29 != 48) && num29 != 62 && num29 != 67 && num29 != 68 && Main.player[Main.myPlayer].buffTime[l] > 2) { string text2; if (Main.player[Main.myPlayer].buffTime[l] / 60 >= 60) { text2 = Math.Round((double)(Main.player[Main.myPlayer].buffTime[l] / 60) / 60.0) + " m"; } else { text2 = Math.Round((double)Main.player[Main.myPlayer].buffTime[l] / 60.0) + " s"; } this.spriteBatch.DrawString(Main.fontItemStack, text2, new Vector2((float)num30, (float)(num31 + Main.buffTexture[num29].Height)), color, 0f, default(Vector2), 0.8f, SpriteEffects.None, 0f); } if (Main.mouseX < num30 + Main.buffTexture[num29].Width && Main.mouseY < num31 + Main.buffTexture[num29].Height && Main.mouseX > num30 && Main.mouseY > num31) { num28 = l; Main.buffAlpha[l] += 0.1f; if (Main.mouseRight && Main.mouseRightRelease && !Main.debuff[num29] && num29 != 60) { Main.PlaySound(12, -1, -1, 1); Main.player[Main.myPlayer].DelBuff(l); } } else { Main.buffAlpha[l] -= 0.05f; } if (Main.buffAlpha[l] > 1f) { Main.buffAlpha[l] = 1f; } else { if ((double)Main.buffAlpha[l] < 0.4) { Main.buffAlpha[l] = 0.4f; } } } else { Main.buffAlpha[l] = 0.4f; } } if (num28 >= 0) { int num32 = Main.player[Main.myPlayer].buffType[num28]; if (num32 > 0) { Main.buffString = Main.buffTip[num32]; if (Main.meleeBuff[num32]) { this.MouseText(Main.buffName[num32], -10, 0); return; } this.MouseText(Main.buffName[num32], 0, 0); } } } } protected void DrawHotbar() { if (!Main.playerInventory && !Main.player[Main.myPlayer].ghost) { string text = Lang.inter[37]; if (Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].name != null && Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].name != "") { text = Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].AffixName(); } Vector2 vector = Main.fontMouseText.MeasureString(text) / 2f; this.spriteBatch.DrawString(Main.fontMouseText, text, new Vector2(236f - vector.X, 0f), new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); int num = 20; for (int i = 0; i < 10; i++) { if (i == Main.player[Main.myPlayer].selectedItem) { if (Main.hotbarScale[i] < 1f) { Main.hotbarScale[i] += 0.05f; } } else { if ((double)Main.hotbarScale[i] > 0.75) { Main.hotbarScale[i] -= 0.05f; } } float num2 = Main.hotbarScale[i]; int num3 = (int)(20f + 22f * (1f - num2)); int num4 = (int)(75f + 150f * num2); Color color = new Color(255, 255, 255, num4); this.spriteBatch.Draw(Main.inventoryBackTexture, new Vector2((float)num, (float)num3), new Rectangle?(new Rectangle(0, 0, Main.inventoryBackTexture.Width, Main.inventoryBackTexture.Height)), new Color(100, 100, 100, 100), 0f, default(Vector2), num2, SpriteEffects.None, 0f); if (!Main.player[Main.myPlayer].hbLocked && Main.mouseX >= num && (float)Main.mouseX <= (float)num + (float)Main.inventoryBackTexture.Width * Main.hotbarScale[i] && Main.mouseY >= num3 && (float)Main.mouseY <= (float)num3 + (float)Main.inventoryBackTexture.Height * Main.hotbarScale[i] && !Main.player[Main.myPlayer].channel) { Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeft && !Main.player[Main.myPlayer].hbLocked) { Main.player[Main.myPlayer].changeItem = i; } Main.player[Main.myPlayer].showItemIcon = false; Main.hoverItemName = Main.player[Main.myPlayer].inventory[i].AffixName(); if (Main.player[Main.myPlayer].inventory[i].stack > 1) { object obj = Main.hoverItemName; Main.hoverItemName = string.Concat(new object[] { obj, " (", Main.player[Main.myPlayer].inventory[i].stack, ")" }); } Main.rare = Main.player[Main.myPlayer].inventory[i].rare; } if (Main.player[Main.myPlayer].inventory[i].type > 0 && Main.player[Main.myPlayer].inventory[i].stack > 0) { float num5 = 1f; if (Main.itemTexture[Main.player[Main.myPlayer].inventory[i].type].Width > 32 || Main.itemTexture[Main.player[Main.myPlayer].inventory[i].type].Height > 32) { if (Main.itemTexture[Main.player[Main.myPlayer].inventory[i].type].Width > Main.itemTexture[Main.player[Main.myPlayer].inventory[i].type].Height) { num5 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[i].type].Width; } else { num5 = 32f / (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[i].type].Height; } } num5 *= num2; Color color2 = color; if (Main.player[Main.myPlayer].inventory[i].type == 662 || Main.player[Main.myPlayer].inventory[i].type == 663) { color.R = (byte)Main.DiscoR; color.G = (byte)Main.DiscoG; color.B = (byte)Main.DiscoB; color.A = 255; } this.spriteBatch.Draw(Main.itemTexture[Main.player[Main.myPlayer].inventory[i].type], new Vector2((float)num + 26f * num2 - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[i].type].Width * 0.5f * num5, (float)num3 + 26f * num2 - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[i].type].Height * 0.5f * num5), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].inventory[i].type].Width, Main.itemTexture[Main.player[Main.myPlayer].inventory[i].type].Height)), Main.player[Main.myPlayer].inventory[i].GetAlpha(color), 0f, default(Vector2), num5, SpriteEffects.None, 0f); color = color2; if (Main.player[Main.myPlayer].inventory[i].color != default(Color)) { this.spriteBatch.Draw(Main.itemTexture[Main.player[Main.myPlayer].inventory[i].type], new Vector2((float)num + 26f * num2 - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[i].type].Width * 0.5f * num5, (float)num3 + 26f * num2 - (float)Main.itemTexture[Main.player[Main.myPlayer].inventory[i].type].Height * 0.5f * num5), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.player[Main.myPlayer].inventory[i].type].Width, Main.itemTexture[Main.player[Main.myPlayer].inventory[i].type].Height)), Main.player[Main.myPlayer].inventory[i].GetColor(color), 0f, default(Vector2), num5, SpriteEffects.None, 0f); } if (Main.player[Main.myPlayer].inventory[i].stack > 1) { this.spriteBatch.DrawString(Main.fontItemStack, string.Concat(Main.player[Main.myPlayer].inventory[i].stack), new Vector2((float)num + 10f * num2, (float)num3 + 26f * num2), color, 0f, default(Vector2), num5, SpriteEffects.None, 0f); } if (Main.player[Main.myPlayer].inventory[i].useAmmo > 0) { int useAmmo = Main.player[Main.myPlayer].inventory[i].useAmmo; int num6 = 0; for (int j = 0; j < 58; j++) { if (Main.player[Main.myPlayer].inventory[j].ammo == useAmmo) { num6 += Main.player[Main.myPlayer].inventory[j].stack; } } this.spriteBatch.DrawString(Main.fontItemStack, string.Concat(num6), new Vector2((float)num + 8f * num2, (float)num3 + 30f * num2), color, 0f, default(Vector2), num2 * 0.8f, SpriteEffects.None, 0f); } else { if (Main.player[Main.myPlayer].inventory[i].tileWand > 0) { int tileWand = Main.player[Main.myPlayer].inventory[i].tileWand; int num7 = 0; for (int k = 0; k < 58; k++) { if (Main.player[Main.myPlayer].inventory[k].type == tileWand) { num7 += Main.player[Main.myPlayer].inventory[k].stack; } } this.spriteBatch.DrawString(Main.fontItemStack, string.Concat(num7), new Vector2((float)num + 8f * num2, (float)num3 + 30f * num2), color, 0f, default(Vector2), num2 * 0.8f, SpriteEffects.None, 0f); } else { if (Main.player[Main.myPlayer].inventory[i].type == 509 || Main.player[Main.myPlayer].inventory[i].type == 850 || Main.player[Main.myPlayer].inventory[i].type == 851) { int num8 = 0; for (int l = 0; l < 58; l++) { if (Main.player[Main.myPlayer].inventory[l].type == 530) { num8 += Main.player[Main.myPlayer].inventory[l].stack; } } this.spriteBatch.DrawString(Main.fontItemStack, string.Concat(num8), new Vector2((float)num + 8f * num2, (float)num3 + 30f * num2), color, 0f, default(Vector2), num2 * 0.8f, SpriteEffects.None, 0f); } } } string text2 = string.Concat(i + 1); if (text2 == "10") { text2 = "0"; } this.spriteBatch.DrawString(Main.fontItemStack, text2, new Vector2((float)num + 8f * Main.hotbarScale[i], (float)num3 + 4f * Main.hotbarScale[i]), new Color((int)(color.R / 2), (int)(color.G / 2), (int)(color.B / 2), (int)(color.A / 2)), 0f, default(Vector2), num5, SpriteEffects.None, 0f); if (Main.player[Main.myPlayer].inventory[i].potion) { Color alpha = Main.player[Main.myPlayer].inventory[i].GetAlpha(color); float num9 = (float)Main.player[Main.myPlayer].potionDelay / (float)Main.player[Main.myPlayer].potionDelayTime; float num10 = (float)alpha.R * num9; float num11 = (float)alpha.G * num9; float num12 = (float)alpha.B * num9; float num13 = (float)alpha.A * num9; alpha = new Color((int)((byte)num10), (int)((byte)num11), (int)((byte)num12), (int)((byte)num13)); this.spriteBatch.Draw(Main.cdTexture, new Vector2((float)num + 26f * Main.hotbarScale[i] - (float)Main.cdTexture.Width * 0.5f * num5, (float)num3 + 26f * Main.hotbarScale[i] - (float)Main.cdTexture.Height * 0.5f * num5), new Rectangle?(new Rectangle(0, 0, Main.cdTexture.Width, Main.cdTexture.Height)), alpha, 0f, default(Vector2), num5, SpriteEffects.None, 0f); } } num += (int)((float)Main.inventoryBackTexture.Width * Main.hotbarScale[i]) + 4; } } } protected void DrawInterface() { if (Main.player[Main.myPlayer].rulerAcc) { int num = (int)((float)((int)(Main.screenPosition.X / 16f) * 16) - Main.screenPosition.X); int num2 = (int)((float)((int)(Main.screenPosition.Y / 16f) * 16) - Main.screenPosition.Y); int num3 = Main.screenWidth / Main.gridTexture.Width; int num4 = Main.screenHeight / Main.gridTexture.Height; for (int i = 0; i <= num3 + 1; i++) { for (int j = 0; j <= num4 + 1; j++) { this.spriteBatch.Draw(Main.gridTexture, new Vector2((float)(i * Main.gridTexture.Width + num), (float)(j * Main.gridTexture.Height + num2)), new Rectangle?(new Rectangle(0, 0, Main.gridTexture.Width, Main.gridTexture.Height)), new Color(100, 100, 100, 15), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } } if (this.showNPCs) { if (Main.ignoreErrors) { try { this.DrawNPCHouse(); goto IL_147; } catch { goto IL_147; } } this.DrawNPCHouse(); } IL_147: Main.mH = 0; if (Main.mapEnabled) { if (!Main.mapFullscreen && Main.mapStyle == 1) { Main.mH = 256; if (Main.ignoreErrors) { try { this.DrawMap(); goto IL_185; } catch { goto IL_185; } } this.DrawMap(); } IL_185: if (Main.mH + 600 > Main.screenHeight) { Main.mH = Main.screenHeight - 600; } } if (Main.hbPosition != 0) { for (int k = 199; k >= 0; k--) { if (Main.npc[k].active && Main.npc[k].type > 0 && Main.npc[k].life != Main.npc[k].lifeMax && !Main.npc[k].dontTakeDamage) { float scale = 1f; int type = Main.npc[k].type; if (type == 4) { scale = 1.5f; } if (type == 35) { scale = 1.5f; } if (type == 36) { scale = 1.5f; } if (type == 50) { scale = 1.5f; } if (type == 113) { scale = 1.5f; } if (type == 114) { scale = 1.5f; } if (type == 125) { scale = 1.5f; } if (type == 126) { scale = 1.5f; } if (type == 127) { scale = 1.5f; } if (type == 128) { scale = 1.5f; } if (type == 129) { scale = 1.5f; } if (type == 130) { scale = 1.5f; } if (type == 131) { scale = 1.5f; } if (type == 222) { scale = 1.5f; } if (type >= 245 && type <= 249) { scale = 1.5f; } if (type == 262) { scale = 1.5f; } if (type == 266) { scale = 1.5f; } if (Main.hbPosition == 1) { float num5 = 10f; num5 += Main.NPCAddHeight(k); this.DrawHB(Main.npc[k].position.X + (float)(Main.npc[k].width / 2), Main.npc[k].position.Y + (float)Main.npc[k].height + num5 + Main.npc[k].gfxOffY, Main.npc[k].life, Main.npc[k].lifeMax, Lighting.Brightness((int)((Main.npc[k].position.X + (float)(Main.npc[k].width / 2)) / 16f), (int)((Main.npc[k].position.Y + (float)(Main.npc[k].height / 2) + Main.npc[k].gfxOffY) / 16f)), scale); } else { if (Main.hbPosition == 2) { float num6 = -24f; num6 -= Main.NPCAddHeight(k) / 2f; this.DrawHB(Main.npc[k].position.X + (float)(Main.npc[k].width / 2), Main.npc[k].position.Y + num6 + Main.npc[k].gfxOffY, Main.npc[k].life, Main.npc[k].lifeMax, Lighting.Brightness((int)((Main.npc[k].position.X + (float)(Main.npc[k].width / 2)) / 16f), (int)((Main.npc[k].position.Y + (float)(Main.npc[k].height / 2) + Main.npc[k].gfxOffY) / 16f)), scale); } } } } for (int l = 0; l < 255; l++) { if (l != Main.myPlayer && Main.player[l].active && !Main.player[l].ghost && !Main.player[l].dead && Main.player[l].statLife != Main.player[l].statLifeMax) { if (Main.hbPosition == 1) { int num7 = 10; this.DrawHB(Main.player[l].position.X + (float)(Main.player[l].width / 2), Main.player[l].position.Y + (float)Main.player[l].height + (float)num7 + Main.player[l].gfxOffY, Main.player[l].statLife, Main.player[l].statLifeMax, Lighting.Brightness((int)((Main.player[l].position.X + (float)(Main.player[l].width / 2)) / 16f), (int)((Main.player[l].position.Y + (float)(Main.player[l].height / 2) + Main.player[l].gfxOffY) / 16f)), 1f); } else { if (Main.hbPosition == 2) { int num8 = -20; this.DrawHB(Main.player[l].position.X + (float)(Main.player[l].width / 2), Main.player[l].position.Y + (float)num8 + Main.player[l].gfxOffY, Main.player[l].statLife, Main.player[l].statLifeMax, Lighting.Brightness((int)((Main.player[l].position.X + (float)(Main.player[l].width / 2)) / 16f), (int)((Main.player[l].position.Y + (float)(Main.player[l].height / 2) + Main.player[l].gfxOffY) / 16f)), 1f); } } } } } if (Main.player[Main.myPlayer].selectedItem == 58 && Main.player[Main.myPlayer].itemAnimation > 0) { Main.mouseLeftRelease = false; } Main.mouseHC = false; if (Main.hideUI) { Main.maxQ = true; return; } if (Main.netDiag) { for (int m = 0; m < 4; m++) { string text = ""; int num9 = 20; int num10 = 220; if (m == 0) { text = "RX Msgs: " + string.Format("{0:0,0}", Main.rxMsg); num10 += m * 20; } else { if (m == 1) { text = "RX Bytes: " + string.Format("{0:0,0}", Main.rxData); num10 += m * 20; } else { if (m == 2) { text = "TX Msgs: " + string.Format("{0:0,0}", Main.txMsg); num10 += m * 20; } else { if (m == 3) { text = "TX Bytes: " + string.Format("{0:0,0}", Main.txData); num10 += m * 20; } } } } this.spriteBatch.DrawString(Main.fontMouseText, text, new Vector2((float)num9, (float)num10), Color.White, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } for (int n = 0; n < Main.maxMsg; n++) { float scale2 = 0.7f; int num11 = 200; int num12 = 120; num12 += n * 13; string text2 = n + ": "; this.spriteBatch.DrawString(Main.fontMouseText, text2, new Vector2((float)num11, (float)num12), Color.White, 0f, default(Vector2), scale2, SpriteEffects.None, 0f); num11 += 30; text2 = "rx:" + string.Format("{0:0,0}", Main.rxMsgType[n]); this.spriteBatch.DrawString(Main.fontMouseText, text2, new Vector2((float)num11, (float)num12), Color.White, 0f, default(Vector2), scale2, SpriteEffects.None, 0f); num11 += 70; text2 = string.Format("{0:0,0}", Main.rxDataType[n]); this.spriteBatch.DrawString(Main.fontMouseText, text2, new Vector2((float)num11, (float)num12), Color.White, 0f, default(Vector2), scale2, SpriteEffects.None, 0f); num11 += 70; text2 = n + ": "; this.spriteBatch.DrawString(Main.fontMouseText, text2, new Vector2((float)num11, (float)num12), Color.White, 0f, default(Vector2), scale2, SpriteEffects.None, 0f); num11 += 30; text2 = "tx:" + string.Format("{0:0,0}", Main.txMsgType[n]); this.spriteBatch.DrawString(Main.fontMouseText, text2, new Vector2((float)num11, (float)num12), Color.White, 0f, default(Vector2), scale2, SpriteEffects.None, 0f); num11 += 70; text2 = string.Format("{0:0,0}", Main.txDataType[n]); this.spriteBatch.DrawString(Main.fontMouseText, text2, new Vector2((float)num11, (float)num12), Color.White, 0f, default(Vector2), scale2, SpriteEffects.None, 0f); } } if (Main.drawDiag) { for (int num13 = 0; num13 < 7; num13++) { string text3 = ""; int num14 = 20; int num15 = 220; num15 += num13 * 16; if (num13 == 0) { text3 = "Solid Tiles:"; } if (num13 == 1) { text3 = "Misc. Tiles:"; } if (num13 == 2) { text3 = "Walls Tiles:"; } if (num13 == 3) { text3 = "Background Tiles:"; } if (num13 == 4) { text3 = "Water Tiles:"; } if (num13 == 5) { text3 = "Black Tiles:"; } if (num13 == 6) { text3 = "Total Render:"; } this.spriteBatch.DrawString(Main.fontMouseText, text3, new Vector2((float)num14, (float)num15), Color.White, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } for (int num16 = 0; num16 < 7; num16++) { string text4 = ""; int num17 = 180; int num18 = 220; num18 += num16 * 16; if (num16 == 0) { text4 = Main.renderTimer[num16] + "ms"; } if (num16 == 1) { text4 = Main.renderTimer[num16] + "ms"; } if (num16 == 2) { text4 = Main.renderTimer[num16] + "ms"; } if (num16 == 3) { text4 = Main.renderTimer[num16] + "ms"; } if (num16 == 4) { text4 = Main.renderTimer[num16] + "ms"; } if (num16 == 5) { text4 = Main.renderTimer[num16] + "ms"; } if (num16 == 6) { text4 = Main.renderTimer[0] + Main.renderTimer[1] + Main.renderTimer[2] + Main.renderTimer[3] + Main.renderTimer[4] + Main.renderTimer[5] + "ms"; } this.spriteBatch.DrawString(Main.fontMouseText, text4, new Vector2((float)num17, (float)num18), Color.White, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } for (int num19 = 0; num19 < 6; num19++) { string text5 = ""; int num20 = 20; int num21 = 346; num21 += num19 * 16; if (num19 == 0) { text5 = "Lighting Init:"; } if (num19 == 1) { text5 = "Lighting Phase #1:"; } if (num19 == 2) { text5 = "Lighting Phase #2:"; } if (num19 == 3) { text5 = "Lighting Phase #3"; } if (num19 == 4) { text5 = "Lighting Phase #4"; } if (num19 == 5) { text5 = "Total Lighting:"; } this.spriteBatch.DrawString(Main.fontMouseText, text5, new Vector2((float)num20, (float)num21), Color.White, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } for (int num22 = 0; num22 < 6; num22++) { string text6 = ""; int num23 = 180; int num24 = 346; num24 += num22 * 16; if (num22 == 0) { text6 = Main.lightTimer[num22] + "ms"; } if (num22 == 1) { text6 = Main.lightTimer[num22] + "ms"; } if (num22 == 2) { text6 = Main.lightTimer[num22] + "ms"; } if (num22 == 3) { text6 = Main.lightTimer[num22] + "ms"; } if (num22 == 4) { text6 = Main.lightTimer[num22] + "ms"; } if (num22 == 5) { text6 = Main.lightTimer[0] + Main.lightTimer[1] + Main.lightTimer[2] + Main.lightTimer[3] + Main.lightTimer[4] + "ms"; } this.spriteBatch.DrawString(Main.fontMouseText, text6, new Vector2((float)num23, (float)num24), Color.White, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } int num25 = 5; for (int num26 = 0; num26 < num25; num26++) { int num27 = 20; int num28 = 456; num28 += num26 * 16; string text7 = "Render #" + num26 + ":"; this.spriteBatch.DrawString(Main.fontMouseText, text7, new Vector2((float)num27, (float)num28), Color.White, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } for (int num29 = 0; num29 < num25; num29++) { int num30 = 180; int num31 = 456; num31 += num29 * 16; string text8 = Main.drawTimer[num29] + "ms"; this.spriteBatch.DrawString(Main.fontMouseText, text8, new Vector2((float)num30, (float)num31), Color.White, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } for (int num32 = 0; num32 < num25; num32++) { int num33 = 230; int num34 = 456; num34 += num32 * 16; string text9 = Main.drawTimerMax[num32] + "ms"; this.spriteBatch.DrawString(Main.fontMouseText, text9, new Vector2((float)num33, (float)num34), Color.White, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } int num35 = 20; int num36 = 456 + 16 * num25 + 16; string text10 = "Update:"; this.spriteBatch.DrawString(Main.fontMouseText, text10, new Vector2((float)num35, (float)num36), Color.White, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); num35 = 180; text10 = Main.upTimer + "ms"; this.spriteBatch.DrawString(Main.fontMouseText, text10, new Vector2((float)num35, (float)num36), Color.White, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); num35 = 230; text10 = Main.upTimerMax + "ms"; this.spriteBatch.DrawString(Main.fontMouseText, text10, new Vector2((float)num35, (float)num36), Color.White, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } if (Main.signBubble) { int num37 = (int)((float)Main.signX - Main.screenPosition.X); int num38 = (int)((float)Main.signY - Main.screenPosition.Y); SpriteEffects effects = SpriteEffects.None; if ((float)Main.signX > Main.player[Main.myPlayer].position.X + (float)Main.player[Main.myPlayer].width) { effects = SpriteEffects.FlipHorizontally; num37 += -8 - Main.chat2Texture.Width; } else { num37 += 8; } num38 -= 22; this.spriteBatch.Draw(Main.chat2Texture, new Vector2((float)num37, (float)num38), new Rectangle?(new Rectangle(0, 0, Main.chat2Texture.Width, Main.chat2Texture.Height)), new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), 0f, default(Vector2), 1f, effects, 0f); Main.signBubble = false; } for (int num39 = 0; num39 < 255; num39++) { if (Main.player[num39].active && Main.myPlayer != num39 && !Main.player[num39].dead) { new Rectangle((int)((double)Main.player[num39].position.X + (double)Main.player[num39].width * 0.5 - 16.0), (int)(Main.player[num39].position.Y + (float)Main.player[num39].height - 48f), 32, 48); if (Main.player[Main.myPlayer].team > 0 && Main.player[Main.myPlayer].team == Main.player[num39].team) { new Rectangle((int)Main.screenPosition.X, (int)Main.screenPosition.Y, Main.screenWidth, Main.screenHeight); string text11 = Main.player[num39].name; if (Main.player[num39].statLife < Main.player[num39].statLifeMax) { object obj = text11; text11 = string.Concat(new object[] { obj, ": ", Main.player[num39].statLife, "/", Main.player[num39].statLifeMax }); } Vector2 position = Main.fontMouseText.MeasureString(text11); float num40 = 0f; if (Main.player[num39].chatShowTime > 0) { num40 = -position.Y; } float num41 = 0f; float num42 = (float)Main.mouseTextColor / 255f; Color color = new Color((int)((byte)((float)Main.teamColor[Main.player[num39].team].R * num42)), (int)((byte)((float)Main.teamColor[Main.player[num39].team].G * num42)), (int)((byte)((float)Main.teamColor[Main.player[num39].team].B * num42)), (int)Main.mouseTextColor); Vector2 vector = new Vector2((float)(Main.screenWidth / 2) + Main.screenPosition.X, (float)(Main.screenHeight / 2) + Main.screenPosition.Y); float num43 = Main.player[num39].position.X + (float)(Main.player[num39].width / 2) - vector.X; float num44 = Main.player[num39].position.Y - position.Y - 2f + num40 - vector.Y; float num45 = (float)Math.Sqrt((double)(num43 * num43 + num44 * num44)); int num46 = Main.screenHeight; if (Main.screenHeight > Main.screenWidth) { num46 = Main.screenWidth; } num46 = num46 / 2 - 30; if (num46 < 100) { num46 = 100; } if (num45 < (float)num46) { position.X = Main.player[num39].position.X + (float)(Main.player[num39].width / 2) - position.X / 2f - Main.screenPosition.X; position.Y = Main.player[num39].position.Y - position.Y - 2f + num40 - Main.screenPosition.Y; } else { num41 = num45; num45 = (float)num46 / num45; position.X = (float)(Main.screenWidth / 2) + num43 * num45 - position.X / 2f; position.Y = (float)(Main.screenHeight / 2) + num44 * num45; } if (Main.player[Main.myPlayer].gravDir == -1f) { position.Y = (float)Main.screenHeight - position.Y; } if (num41 > 0f) { string text12 = "(" + (int)(num41 / 16f * 2f) + " ft)"; Vector2 position2 = Main.fontMouseText.MeasureString(text12); position2.X = position.X + Main.fontMouseText.MeasureString(text11).X / 2f - position2.X / 2f; position2.Y = position.Y + Main.fontMouseText.MeasureString(text11).Y / 2f - position2.Y / 2f - 20f; this.spriteBatch.DrawString(Main.fontMouseText, text12, new Vector2(position2.X - 2f, position2.Y), Color.Black, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); this.spriteBatch.DrawString(Main.fontMouseText, text12, new Vector2(position2.X + 2f, position2.Y), Color.Black, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); this.spriteBatch.DrawString(Main.fontMouseText, text12, new Vector2(position2.X, position2.Y - 2f), Color.Black, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); this.spriteBatch.DrawString(Main.fontMouseText, text12, new Vector2(position2.X, position2.Y + 2f), Color.Black, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); this.spriteBatch.DrawString(Main.fontMouseText, text12, position2, color, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } this.spriteBatch.DrawString(Main.fontMouseText, text11, new Vector2(position.X - 2f, position.Y), Color.Black, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); this.spriteBatch.DrawString(Main.fontMouseText, text11, new Vector2(position.X + 2f, position.Y), Color.Black, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); this.spriteBatch.DrawString(Main.fontMouseText, text11, new Vector2(position.X, position.Y - 2f), Color.Black, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); this.spriteBatch.DrawString(Main.fontMouseText, text11, new Vector2(position.X, position.Y + 2f), Color.Black, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); this.spriteBatch.DrawString(Main.fontMouseText, text11, position, color, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } } if (Main.playerInventory) { Main.npcChatText = ""; Main.player[Main.myPlayer].sign = -1; } if (Main.ignoreErrors) { try { if (Main.npcChatText != "" || Main.player[Main.myPlayer].sign != -1) { this.DrawChat(); } goto IL_1AF7; } catch { goto IL_1AF7; } } if (Main.npcChatText != "" || Main.player[Main.myPlayer].sign != -1) { this.DrawChat(); } IL_1AF7: Main.inventoryBack = new Color(220, 220, 220, 220); Main.invAlpha += Main.invDir * 0.2f; if (Main.invAlpha > 240f) { Main.invAlpha = 240f; Main.invDir = -1f; } if (Main.invAlpha < 180f) { Main.invAlpha = 180f; Main.invDir = 1f; } Main.inventoryBack = new Color((int)((byte)Main.invAlpha), (int)((byte)Main.invAlpha), (int)((byte)Main.invAlpha), (int)((byte)Main.invAlpha)); Main.mouseText = false; Main.rare = 0; if (Main.ignoreErrors) { try { this.DrawInterfaceBars(); goto IL_1BB1; } catch { goto IL_1BB1; } } this.DrawInterfaceBars(); IL_1BB1: if (Main.player[Main.myPlayer].dead) { Main.playerInventory = false; } if (!Main.playerInventory) { Main.player[Main.myPlayer].chest = -1; if (Main.craftGuide) { Main.craftGuide = false; Recipe.FindRecipes(); } Main.reforge = false; } Main.hoverItemName = ""; if (Main.playerInventory) { if (Main.ignoreErrors) { try { this.DrawInventory(); goto IL_20A1; } catch { goto IL_20A1; } } this.DrawInventory(); } else { if (Main.npcChatText == null || Main.npcChatText == "") { bool flag = false; bool flag2 = false; bool flag3 = false; for (int num47 = 0; num47 < 3; num47++) { string text13 = ""; if (Main.player[Main.myPlayer].accCompass > 0 && !flag3) { int num48 = (int)((Main.player[Main.myPlayer].position.X + (float)(Main.player[Main.myPlayer].width / 2)) * 2f / 16f - (float)Main.maxTilesX); if (num48 > 0) { text13 = "Position: " + num48 + " feet east"; if (num48 == 1) { text13 = "Position: " + num48 + " foot east"; } } else { if (num48 < 0) { num48 *= -1; text13 = "Position: " + num48 + " feet west"; if (num48 == 1) { text13 = "Position: " + num48 + " foot west"; } } else { text13 = "Position: center"; } } flag3 = true; } else { if (Main.player[Main.myPlayer].accDepthMeter > 0 && !flag2) { int num49 = (int)((double)((Main.player[Main.myPlayer].position.Y + (float)Main.player[Main.myPlayer].height) * 2f / 16f) - Main.worldSurface * 2.0); if (num49 > 0) { text13 = "Depth: " + num49 + " feet below"; if (num49 == 1) { text13 = "Depth: " + num49 + " foot below"; } } else { if (num49 < 0) { num49 *= -1; text13 = "Depth: " + num49 + " feet above"; if (num49 == 1) { text13 = "Depth: " + num49 + " foot above"; } } else { text13 = "Depth: Level"; } } flag2 = true; } else { if (Main.player[Main.myPlayer].accWatch > 0 && !flag) { string text14 = "AM"; double num50 = Main.time; if (!Main.dayTime) { num50 += 54000.0; } num50 = num50 / 86400.0 * 24.0; double num51 = 7.5; num50 = num50 - num51 - 12.0; if (num50 < 0.0) { num50 += 24.0; } if (num50 >= 12.0) { text14 = "PM"; } int num52 = (int)num50; double num53 = num50 - (double)num52; num53 = (double)((int)(num53 * 60.0)); string text15 = string.Concat(num53); if (num53 < 10.0) { text15 = "0" + text15; } if (num52 > 12) { num52 -= 12; } if (num52 == 0) { num52 = 12; } if (Main.player[Main.myPlayer].accWatch == 1) { text15 = "00"; } else { if (Main.player[Main.myPlayer].accWatch == 2) { if (num53 < 30.0) { text15 = "00"; } else { text15 = "30"; } } } text13 = string.Concat(new object[] { Lang.inter[34], ": ", num52, ":", text15, " ", text14 }); flag = true; } } } if (text13 != "") { for (int num54 = 0; num54 < 5; num54++) { int num55 = 0; int num56 = 0; Color black = Color.Black; if (num54 == 0) { num55 = -2; } if (num54 == 1) { num55 = 2; } if (num54 == 2) { num56 = -2; } if (num54 == 3) { num56 = 2; } if (num54 == 4) { black = new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor); } this.spriteBatch.DrawString(Main.fontMouseText, text13, new Vector2((float)(22 + num55), (float)(110 + 22 * num47 + num56 + 48)), black, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } } } } IL_20A1: if (Main.playerInventory || Main.player[Main.myPlayer].ghost) { string text16 = Lang.inter[35]; Vector2 vector2 = Main.fontMouseText.MeasureString("Save & Exit"); Vector2 vector3 = Main.fontMouseText.MeasureString(Lang.inter[35]); if (Main.netMode != 0) { text16 = Lang.inter[36]; vector2 = Main.fontMouseText.MeasureString("Disconnect"); vector3 = Main.fontMouseText.MeasureString(Lang.inter[36]); } Vector2 vector4 = Main.fontDeathText.MeasureString(text16); int num57 = Main.screenWidth - 110; int num58 = Main.screenHeight - 20; float num59 = vector2.X / vector3.X; if (Main.mouseExit) { if (Main.exitScale < 1f) { Main.exitScale += 0.02f; } } else { if ((double)Main.exitScale > 0.8) { Main.exitScale -= 0.02f; } } for (int num60 = 0; num60 < 5; num60++) { int num61 = 0; int num62 = 0; Color color2 = Color.Black; if (num60 == 0) { num61 = -2; } if (num60 == 1) { num61 = 2; } if (num60 == 2) { num62 = -2; } if (num60 == 3) { num62 = 2; } if (num60 == 4) { color2 = Color.White; } this.spriteBatch.DrawString(Main.fontDeathText, text16, new Vector2((float)(num57 + num61), (float)(num58 + num62)), color2, 0f, new Vector2(vector4.X / 2f, vector4.Y / 2f), (Main.exitScale - 0.2f) * num59, SpriteEffects.None, 0f); } if ((float)Main.mouseX > (float)num57 - vector4.X / 2f && (float)Main.mouseX < (float)num57 + vector4.X / 2f && (float)Main.mouseY > (float)num58 - vector4.Y / 2f && (float)Main.mouseY < (float)num58 + vector4.Y / 2f - 10f) { if (!Main.mouseExit) { Main.PlaySound(12, -1, -1, 1); } Main.mouseExit = true; Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeftRelease && Main.mouseLeft) { Main.menuMode = 10; WorldGen.SaveAndQuit(); } } else { Main.mouseExit = false; } } if (Main.ignoreErrors) { try { this.DrawHotbar(); goto IL_2317; } catch { goto IL_2317; } } this.DrawHotbar(); IL_2317: if (Main.mouseItem.stack <= 0) { Main.mouseItem.type = 0; } if (Main.hoverItemName != null && Main.hoverItemName != "" && Main.mouseItem.type == 0) { Main.player[Main.myPlayer].showItemIcon = false; this.MouseText(Main.hoverItemName, Main.rare, 0); Main.mouseText = true; } if (Main.ignoreErrors) { try { this.DrawPlayerChat(); goto IL_2393; } catch { goto IL_2393; } } this.DrawPlayerChat(); IL_2393: if (Main.player[Main.myPlayer].dead) { string text17 = Lang.inter[38]; this.spriteBatch.DrawString(Main.fontDeathText, text17, new Vector2((float)(Main.screenWidth / 2 - text17.Length * 10), (float)(Main.screenHeight / 2 - 20)), Main.player[Main.myPlayer].GetDeathAlpha(new Color(0, 0, 0, 0)), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } this.spriteBatch.Draw(Main.cursorTexture, new Vector2((float)(Main.mouseX + 1), (float)(Main.mouseY + 1)), new Rectangle?(new Rectangle(0, 0, Main.cursorTexture.Width, Main.cursorTexture.Height)), new Color((int)((float)Main.cursorColor.R * 0.2f), (int)((float)Main.cursorColor.G * 0.2f), (int)((float)Main.cursorColor.B * 0.2f), (int)((float)Main.cursorColor.A * 0.5f)), 0f, default(Vector2), Main.cursorScale * 1.1f, SpriteEffects.None, 0f); this.spriteBatch.Draw(Main.cursorTexture, new Vector2((float)Main.mouseX, (float)Main.mouseY), new Rectangle?(new Rectangle(0, 0, Main.cursorTexture.Width, Main.cursorTexture.Height)), Main.cursorColor, 0f, default(Vector2), Main.cursorScale, SpriteEffects.None, 0f); 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; float num63 = 1f; if (Main.itemTexture[Main.mouseItem.type].Width > 32 || Main.itemTexture[Main.mouseItem.type].Height > 32) { if (Main.itemTexture[Main.mouseItem.type].Width > Main.itemTexture[Main.mouseItem.type].Height) { num63 = 32f / (float)Main.itemTexture[Main.mouseItem.type].Width; } else { num63 = 32f / (float)Main.itemTexture[Main.mouseItem.type].Height; } } float num64 = 1f; num64 *= Main.cursorScale; Color white = Color.White; if (Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type == 662 || Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type == 663) { white.R = (byte)Main.DiscoR; white.G = (byte)Main.DiscoG; white.B = (byte)Main.DiscoB; white.A = 255; } num63 *= num64; this.spriteBatch.Draw(Main.itemTexture[Main.mouseItem.type], new Vector2((float)Main.mouseX + 26f * num64 - (float)Main.itemTexture[Main.mouseItem.type].Width * 0.5f * num63, (float)Main.mouseY + 26f * num64 - (float)Main.itemTexture[Main.mouseItem.type].Height * 0.5f * num63), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.mouseItem.type].Width, Main.itemTexture[Main.mouseItem.type].Height)), Main.mouseItem.GetAlpha(white), 0f, default(Vector2), num63, SpriteEffects.None, 0f); if (Main.mouseItem.color != default(Color)) { this.spriteBatch.Draw(Main.itemTexture[Main.mouseItem.type], new Vector2((float)Main.mouseX + 26f * num64 - (float)Main.itemTexture[Main.mouseItem.type].Width * 0.5f * num63, (float)Main.mouseY + 26f * num64 - (float)Main.itemTexture[Main.mouseItem.type].Height * 0.5f * num63), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.mouseItem.type].Width, Main.itemTexture[Main.mouseItem.type].Height)), Main.mouseItem.GetColor(white), 0f, default(Vector2), num63, SpriteEffects.None, 0f); } if (Main.mouseItem.stack > 1) { white = Color.White; this.spriteBatch.DrawString(Main.fontItemStack, string.Concat(Main.mouseItem.stack), new Vector2((float)Main.mouseX + 10f * num64, (float)Main.mouseY + 26f * num64), white, 0f, default(Vector2), num63, SpriteEffects.None, 0f); } } else { if (this.mouseNPC > -1) { Main.player[Main.myPlayer].mouseInterface = true; Main.mouseText = false; float num65 = 1f; num65 *= Main.cursorScale; this.spriteBatch.Draw(Main.npcHeadTexture[this.mouseNPC], new Vector2((float)Main.mouseX + 26f * num65 - (float)Main.npcHeadTexture[this.mouseNPC].Width * 0.5f * num65, (float)Main.mouseY + 26f * num65 - (float)Main.npcHeadTexture[this.mouseNPC].Height * 0.5f * num65), new Rectangle?(new Rectangle(0, 0, Main.npcHeadTexture[this.mouseNPC].Width, Main.npcHeadTexture[this.mouseNPC].Height)), Color.White, 0f, default(Vector2), num65, SpriteEffects.None, 0f); if (Main.mouseRight && Main.mouseRightRelease) { Main.PlaySound(12, -1, -1, 1); this.mouseNPC = -1; } if (Main.mouseLeft && Main.mouseLeftRelease) { if (this.mouseNPC == 0) { int x = (int)(((float)Main.mouseX + Main.screenPosition.X) / 16f); int y = (int)(((float)Main.mouseY + Main.screenPosition.Y) / 16f); int n2 = -1; if (WorldGen.MoveNPC(x, y, n2)) { Main.NewText(Lang.inter[39], 255, 240, 20, false); } } else { int num66 = 0; for (int num67 = 0; num67 < 200; num67++) { if (Main.npc[num67].active && Main.npc[num67].type == NPC.NumToType(this.mouseNPC)) { num66 = num67; break; } } if (num66 >= 0) { int x2 = (int)(((float)Main.mouseX + Main.screenPosition.X) / 16f); int y2 = (int)(((float)Main.mouseY + Main.screenPosition.Y) / 16f); if (WorldGen.MoveNPC(x2, y2, num66)) { this.mouseNPC = -1; WorldGen.moveRoom(x2, y2, num66); Main.PlaySound(12, -1, -1, 1); } } else { this.mouseNPC = 0; } } } } } if (Main.ignoreErrors) { try { this.DrawMouseOver(); goto IL_2B69; } catch { goto IL_2B69; } } this.DrawMouseOver(); IL_2B69: if (Main.mouseRight) { Main.npcChatRelease = false; } else { Main.npcChatRelease = true; } if (Main.player[Main.myPlayer].showItemIcon && (Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type > 0 || Main.player[Main.myPlayer].showItemIcon2 > 0)) { int num68 = Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type; Color color3 = Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].GetAlpha(Color.White); Color color4 = Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].GetColor(Color.White); if (Main.player[Main.myPlayer].showItemIcon2 > 0) { num68 = Main.player[Main.myPlayer].showItemIcon2; color3 = Color.White; color4 = default(Color); } float scale3 = Main.cursorScale; if (num68 == 662 || num68 == 663) { color3.R = (byte)Main.DiscoR; color3.G = (byte)Main.DiscoG; color3.B = (byte)Main.DiscoB; color3.A = 255; } SpriteEffects effects2 = SpriteEffects.None; if ((Main.player[Main.myPlayer].showItemIcon2 == 928 || Main.player[Main.myPlayer].showItemIcon2 == 1337) && Main.player[Main.myPlayer].showItemIconR) { effects2 = SpriteEffects.FlipHorizontally; } this.spriteBatch.Draw(Main.itemTexture[num68], new Vector2((float)(Main.mouseX + 10), (float)(Main.mouseY + 10)), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[num68].Width, Main.itemTexture[num68].Height)), color3, 0f, default(Vector2), scale3, effects2, 0f); if (Main.player[Main.myPlayer].showItemIcon2 == 0 && Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].color != default(Color)) { this.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 Rectangle?(new 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)), color4, 0f, default(Vector2), scale3, SpriteEffects.None, 0f); } } Main.player[Main.myPlayer].showItemIcon = false; Main.player[Main.myPlayer].showItemIcon2 = 0; } protected void QuitGame() { Steam.Kill(); base.Exit(); } protected Color randColor() { int num = 0; int num2 = 0; int num3 = 0; while (num + num3 + num2 <= 150) { num = Main.rand.Next(256); num2 = Main.rand.Next(256); num3 = Main.rand.Next(256); } return new Color(num, num2, num3, 255); } public static Color hslToRgb(float Hue, float Saturation, float Luminosity) { byte r; byte g; byte b; if (Saturation == 0f) { r = (byte)Math.Round((double)Luminosity * 255.0); g = (byte)Math.Round((double)Luminosity * 255.0); b = (byte)Math.Round((double)Luminosity * 255.0); } else { double num = (double)Hue; double num2; if ((double)Luminosity < 0.5) { num2 = (double)Luminosity * (1.0 + (double)Saturation); } else { num2 = (double)(Luminosity + Saturation - Luminosity * Saturation); } double t = 2.0 * (double)Luminosity - num2; double num3 = num + 0.33333333333333331; double num4 = num; double num5 = num - 0.33333333333333331; num3 = Main.hue2rgb(num3, t, num2); num4 = Main.hue2rgb(num4, t, num2); num5 = Main.hue2rgb(num5, t, num2); r = (byte)Math.Round(num3 * 255.0); g = (byte)Math.Round(num4 * 255.0); b = (byte)Math.Round(num5 * 255.0); } return new Color((int)r, (int)g, (int)b); } public static double hue2rgb(double c, double t1, double t2) { if (c < 0.0) { c += 1.0; } if (c > 1.0) { c -= 1.0; } if (6.0 * c < 1.0) { return t1 + (t2 - t1) * 6.0 * c; } if (2.0 * c < 1.0) { return t2; } if (3.0 * c < 2.0) { return t1 + (t2 - t1) * (0.66666666666666663 - c) * 6.0; } return t1; } public static Vector3 rgbToHsl(Color newColor) { float num = (float)newColor.R; float num2 = (float)newColor.G; float num3 = (float)newColor.B; num /= 255f; num2 /= 255f; num3 /= 255f; float num4 = Math.Max(num, num2); num4 = Math.Max(num4, num3); float num5 = Math.Min(num, num2); num5 = Math.Min(num5, num3); float num6 = 0f; float num7 = (num4 + num5) / 2f; float y; if (num4 == num5) { y = (num6 = 0f); } else { float num8 = num4 - num5; y = (((double)num7 > 0.5) ? (num8 / (2f - num4 - num5)) : (num8 / (num4 + num5))); if (num4 == num) { num6 = (num2 - num3) / num8 + (float)((num2 < num3) ? 6 : 0); } if (num4 == num2) { num6 = (num3 - num) / num8 + 2f; } if (num4 == num3) { num6 = (num - num2) / num8 + 4f; } num6 /= 6f; } return new Vector3(num6, y, num7); } protected void DrawMenu() { 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.chatMode = false; for (int i = 0; i < Main.numChatLines; i++) { Main.chatLine[i] = new ChatLine(); } this.DrawFPS(); Main.screenLastPosition = Main.screenPosition; Main.screenPosition.Y = (float)(Main.worldSurface * 16.0 - (double)Main.screenHeight); if (Main.grabSky) { Main.screenPosition.X = Main.screenPosition.X + (float)(Main.mouseX - Main.screenWidth / 2) * 0.02f; } else { Main.screenPosition.X = Main.screenPosition.X + 2f; } if (Main.screenPosition.X > 2.14748352E+09f) { Main.screenPosition.X = 0f; } if (Main.screenPosition.X < -2.14748352E+09f) { Main.screenPosition.X = 0f; } Main.background = 0; byte b = (byte)((255 + Main.tileColor.R * 2) / 3); Color color = new Color((int)b, (int)b, (int)b, 255); 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 (this.logoRotationSpeed < 20f & this.logoRotationDirection == 1f) { this.logoRotationSpeed += 1f; } else { if (this.logoRotationSpeed > -20f & this.logoRotationDirection == -1f) { this.logoRotationSpeed -= 1f; } } 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 (this.logoScaleSpeed < 50f & this.logoScaleDirection == 1f) { this.logoScaleSpeed += 1f; } else { if (this.logoScaleSpeed > -50f & this.logoScaleDirection == -1f) { this.logoScaleSpeed -= 1f; } } Color color2 = new Color((int)((byte)((float)color.R * ((float)Main.LogoA / 255f))), (int)((byte)((float)color.G * ((float)Main.LogoA / 255f))), (int)((byte)((float)color.B * ((float)Main.LogoA / 255f))), (int)((byte)((float)color.A * ((float)Main.LogoA / 255f)))); Color color3 = new Color((int)((byte)((float)color.R * ((float)Main.LogoB / 255f))), (int)((byte)((float)color.G * ((float)Main.LogoB / 255f))), (int)((byte)((float)color.B * ((float)Main.LogoB / 255f))), (int)((byte)((float)color.A * ((float)Main.LogoB / 255f)))); this.spriteBatch.Draw(Main.logoTexture, new Vector2((float)(Main.screenWidth / 2), 100f), new Rectangle?(new 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, 0f); this.spriteBatch.Draw(Main.logo2Texture, new Vector2((float)(Main.screenWidth / 2), 100f), new Rectangle?(new 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, 0f); if (Main.dayTime) { Main.LogoA += 2; if (Main.LogoA > 255) { Main.LogoA = 255; } Main.LogoB--; if (Main.LogoB < 0) { Main.LogoB = 0; } } else { Main.LogoB += 2; if (Main.LogoB > 255) { Main.LogoB = 255; } Main.LogoA--; if (Main.LogoA < 0) { Main.LogoA = 0; Main.LogoT = true; } } int num = 250; int num2 = Main.screenWidth / 2; int num3 = 80; int num4 = 0; int num5 = Main.menuMode; int num6 = -1; int num7 = 0; int num8 = 0; bool flag = false; bool flag2 = false; bool flag3 = false; int num9 = 0; bool[] array = new bool[Main.maxMenuItems]; bool[] array2 = new bool[Main.maxMenuItems]; bool[] array3 = new bool[Main.maxMenuItems]; int[] array4 = new int[Main.maxMenuItems]; int[] array5 = new int[Main.maxMenuItems]; byte[] array6 = new byte[Main.maxMenuItems]; float[] array7 = new float[Main.maxMenuItems]; bool[] array8 = new bool[Main.maxMenuItems]; for (int j = 0; j < Main.maxMenuItems; j++) { array[j] = false; array2[j] = false; array4[j] = 0; array5[j] = 0; array7[j] = 1f; } string[] array9 = new string[Main.maxMenuItems]; if (Main.menuMode == -1) { Main.menuMode = 0; } if (Main.menuMode == 1212) { if (this.focusMenu == 2) { array9[0] = "Wählen Sie die Sprache"; } else { if (this.focusMenu == 3) { array9[0] = "Selezionare la lingua"; } else { if (this.focusMenu == 4) { array9[0] = "Sélectionnez la langue"; } else { if (this.focusMenu == 5) { array9[0] = "Seleccione el idioma"; } else { array9[0] = "Select language"; } } } } num3 = 50; num = 200; array4[1] = 25; array4[2] = 25; array4[3] = 25; array4[4] = 25; array4[5] = 25; array[0] = true; array9[1] = "English"; array9[2] = "Deutsch"; array9[3] = "Italiano"; array9[4] = "Française"; array9[5] = "Español"; num4 = 6; if (this.selectedMenu >= 1) { Lang.lang = this.selectedMenu; Lang.setLang(false); Main.menuMode = 0; Main.PlaySound(10, -1, -1, 1); this.SaveSettings(); } } else { if (Main.menuMode == 1213) { if (this.focusMenu == 1) { array9[0] = "Select language"; } else { if (this.focusMenu == 2) { array9[0] = "Wählen Sie die Sprache"; } else { if (this.focusMenu == 3) { array9[0] = "Selezionare la lingua"; } else { if (this.focusMenu == 4) { array9[0] = "Sélectionnez la langue"; } else { if (this.focusMenu == 5) { array9[0] = "Seleccione el idioma"; } else { array9[0] = Lang.menu[102]; } } } } } num3 = 48; num = 180; array4[1] = 25; array4[2] = 25; array4[3] = 25; array4[4] = 25; array4[5] = 25; array4[6] = 50; array[0] = true; array9[1] = "English"; array9[2] = "Deutsch"; array9[3] = "Italiano"; array9[4] = "Française"; array9[5] = "Español"; array9[6] = Lang.menu[5]; num4 = 7; if (this.selectedMenu == 6) { Main.menuMode = 11; Main.PlaySound(11, -1, -1, 1); } else { if (this.selectedMenu >= 1) { Lang.lang = this.selectedMenu; Lang.setLang(false); Main.PlaySound(12, -1, -1, 1); this.SaveSettings(); } } } else { if (Main.netMode == 2) { bool flag4 = true; for (int k = 0; k < 8; k++) { if (k < 255) { try { array9[k] = Netplay.serverSock[k].statusText; if (Netplay.serverSock[k].active && Main.showSpam) { string[] array10; string[] expr_83A = array10 = array9; IntPtr intPtr; int expr_83F = (int)(intPtr = (IntPtr)k); object obj = array10[(int)intPtr]; expr_83A[expr_83F] = string.Concat(new object[] { obj, " (", NetMessage.buffer[k].spamCount, ")" }); } } catch { array9[k] = ""; } array[k] = true; if (array9[k] != "" && array9[k] != null) { flag4 = false; } } } if (flag4) { array9[0] = Lang.menu[0]; array9[1] = Lang.menu[1] + Netplay.serverPort + "."; } num4 = 11; array9[9] = Main.statusText; array[9] = true; num = 170; num3 = 30; array4[10] = 20; array4[10] = 40; array9[10] = Lang.menu[2]; if (this.selectedMenu == 10) { Netplay.disconnect = true; Main.PlaySound(11, -1, -1, 1); } } else { if (Main.menuMode == 31) { string password = Netplay.password; Netplay.password = Main.GetInputText(Netplay.password); if (password != Netplay.password) { Main.PlaySound(12, -1, -1, 1); } array9[0] = Lang.menu[3]; this.textBlinkerCount++; if (this.textBlinkerCount >= 20) { if (this.textBlinkerState == 0) { this.textBlinkerState = 1; } else { this.textBlinkerState = 0; } this.textBlinkerCount = 0; } array9[1] = Netplay.password; if (this.textBlinkerState == 1) { string[] array10; (array10 = array9)[1] = array10[1] + "|"; array5[1] = 1; } else { string[] array10; (array10 = array9)[1] = array10[1] + " "; } array[0] = true; array[1] = true; array4[1] = -20; array4[2] = 20; array9[2] = Lang.menu[4]; array9[3] = Lang.menu[5]; num4 = 4; if (this.selectedMenu == 3) { Main.PlaySound(11, -1, -1, 1); Main.menuMode = 0; Netplay.disconnect = true; Netplay.password = ""; } else { if (this.selectedMenu == 2 || Main.inputTextEnter) { NetMessage.SendData(38, -1, -1, Netplay.password, 0, 0f, 0f, 0f, 0); Main.menuMode = 14; } } } else { if (Main.netMode == 1 || Main.menuMode == 14) { num4 = 2; array9[0] = Main.statusText; array[0] = true; num = 300; array9[1] = Lang.menu[6]; if (this.selectedMenu != 1) { goto IL_443A; } Netplay.disconnect = true; Netplay.clientSock.tcpClient.Close(); Main.PlaySound(11, -1, -1, 1); Main.menuMode = 0; Main.netMode = 0; try { this.tServer.Kill(); goto IL_443A; } catch { goto IL_443A; } } if (Main.menuMode == 30) { string password2 = Netplay.password; Netplay.password = Main.GetInputText(Netplay.password); if (password2 != Netplay.password) { Main.PlaySound(12, -1, -1, 1); } array9[0] = Lang.menu[7]; this.textBlinkerCount++; if (this.textBlinkerCount >= 20) { if (this.textBlinkerState == 0) { this.textBlinkerState = 1; } else { this.textBlinkerState = 0; } this.textBlinkerCount = 0; } array9[1] = Netplay.password; if (this.textBlinkerState == 1) { string[] array10; (array10 = array9)[1] = array10[1] + "|"; array5[1] = 1; } else { string[] array10; (array10 = array9)[1] = array10[1] + " "; } array[0] = true; array[1] = true; array4[1] = -20; array4[2] = 20; array9[2] = Lang.menu[4]; array9[3] = Lang.menu[5]; num4 = 4; if (this.selectedMenu == 3) { Main.PlaySound(11, -1, -1, 1); Main.menuMode = 6; Netplay.password = ""; } else { if (this.selectedMenu == 2 || Main.inputTextEnter || Main.autoPass) { this.tServer.StartInfo.FileName = "TerrariaServer.exe"; this.tServer.StartInfo.Arguments = string.Concat(new object[] { "-autoshutdown -world \"", Main.worldPathName, "\" -password \"", Netplay.password, "\" -lang ", Lang.lang }); if (Main.libPath != "") { ProcessStartInfo expr_CE4 = this.tServer.StartInfo; expr_CE4.Arguments = expr_CE4.Arguments + " -loadlib " + Main.libPath; } this.tServer.StartInfo.UseShellExecute = false; this.tServer.StartInfo.CreateNoWindow = true; this.tServer.Start(); Netplay.SetIP("127.0.0.1"); Main.autoPass = true; Main.statusText = Lang.menu[8]; Netplay.StartClient(); Main.menuMode = 10; } } } else { if (Main.menuMode == 15) { num4 = 2; array9[0] = Main.statusText; array[0] = true; num = 80; num3 = 400; array9[1] = Lang.menu[5]; if (this.selectedMenu == 1) { Netplay.disconnect = true; Main.PlaySound(11, -1, -1, 1); Main.menuMode = 0; Main.netMode = 0; } } else { if (Main.menuMode == 200) { num4 = 3; array9[0] = Lang.menu[9]; array[0] = true; num -= 30; array4[1] = 70; array4[2] = 50; array9[1] = Lang.menu[10]; array9[2] = Lang.menu[6]; if (this.selectedMenu == 1) { if (File.Exists(Main.worldPathName + ".bak")) { File.Copy(Main.worldPathName + ".bak", Main.worldPathName, true); File.Delete(Main.worldPathName + ".bak"); Main.PlaySound(10, -1, -1, 1); WorldGen.playWorld(); Main.menuMode = 10; } else { Main.PlaySound(11, -1, -1, 1); Main.menuMode = 0; Main.netMode = 0; } } if (this.selectedMenu == 2) { Main.PlaySound(11, -1, -1, 1); Main.menuMode = 0; Main.netMode = 0; } } else { if (Main.menuMode == 201) { num4 = 3; array9[0] = Lang.menu[9]; array[0] = true; array[1] = true; num -= 30; array4[1] = -30; array4[2] = 50; array9[1] = Lang.menu[11]; array9[2] = Lang.menu[5]; if (this.selectedMenu == 2) { Main.PlaySound(11, -1, -1, 1); Main.menuMode = 0; Main.netMode = 0; } } else { if (Main.menuMode == 10) { num4 = 1; array9[0] = Main.statusText; array[0] = true; num = 300; } else { if (Main.menuMode == 100) { num4 = 1; array9[0] = Main.statusText; array[0] = true; num = 300; } else { if (Main.menuMode == 0) { Main.eclipse = false; Main.ServerSideCharacter = false; Main.menuMultiplayer = false; Main.menuServer = false; Main.netMode = 0; array9[0] = Lang.menu[12]; array9[1] = Lang.menu[13]; array9[2] = Lang.menu[14]; array9[3] = Lang.menu[15]; num4 = 4; if (this.selectedMenu == 3) { this.QuitGame(); } if (this.selectedMenu == 1) { Main.PlaySound(10, -1, -1, 1); Main.menuMode = 12; } if (this.selectedMenu == 2) { Main.PlaySound(10, -1, -1, 1); Main.menuMode = 11; } if (this.selectedMenu == 0) { Main.PlaySound(10, -1, -1, 1); Main.menuMode = 1; Main.LoadPlayers(); } } else { if (Main.menuMode == 1) { Main.ServerSideCharacter = false; Main.myPlayer = 0; num = 180; num3 = 40; num4 = 10; array4[7] += 10; array4[8] += 10; array4[9] += 10; for (int l = 0; l < num4; l++) { array7[l] = 0.8f; } array9[7] = Lang.menu[16]; array9[8] = Lang.menu[17]; if (Main.numLoadPlayers >= Main.maxLoadPlayer) { array2[7] = true; array9[7] = ""; } else { if (Main.numLoadPlayers == 0) { array2[8] = true; array9[8] = ""; } } array9[9] = Lang.menu[5]; for (int m = 0; m < 7; m++) { if (m + Main.menuSkip < Main.numLoadPlayers) { array9[m] = Main.loadPlayer[m + Main.menuSkip].name; array6[m] = Main.loadPlayer[m + Main.menuSkip].difficulty; } else { array9[m] = null; } } bool[] array11 = new bool[num4]; if (Main.numLoadPlayers > 7 + Main.menuSkip) { this.menuWide[6] = true; array6[6] = 0; array11[6] = true; array9[6] = "▼"; array7[6] = 0.6f; array4[6] += 8; array3[6] = true; } if (Main.menuSkip > 0) { this.menuWide[0] = true; array6[0] = 0; array11[0] = true; array9[0] = "▲"; array7[0] = 0.6f; array4[0] += 8; array3[0] = true; } array11[7] = true; array11[8] = true; array11[9] = true; if (this.focusMenu >= 0 && this.focusMenu < Main.numLoadPlayers && !array11[this.focusMenu]) { num6 = this.focusMenu + Main.menuSkip; Vector2 vector = Main.fontDeathText.MeasureString(array9[num6 - Main.menuSkip]); num7 = (int)((double)(Main.screenWidth / 2) + (double)vector.X * 0.5 + 10.0); num8 = num + num3 * this.focusMenu + 4; } if (this.selectedMenu == 0 && Main.menuSkip > 0) { Main.PlaySound(12, -1, -1, 1); Main.menuSkip -= 5; if (Main.menuSkip < 0) { Main.menuSkip = 0; } } else { if (this.selectedMenu == 6 && Main.menuSkip < Main.numLoadPlayers - 7) { Main.PlaySound(12, -1, -1, 1); Main.menuSkip += 5; if (Main.menuSkip >= Main.numLoadPlayers - 7) { Main.menuSkip = Main.numLoadPlayers - 7; } } else { if (this.selectedMenu == 9) { Main.autoJoin = false; Main.autoPass = false; Main.PlaySound(11, -1, -1, 1); if (Main.menuMultiplayer) { Main.menuMode = 12; Main.menuMultiplayer = false; Main.menuServer = false; } else { Main.menuMode = 0; } } else { if (this.selectedMenu == 7) { Main.loadPlayer[Main.numLoadPlayers] = new Player(); Main.loadPlayer[Main.numLoadPlayers].inventory[0].SetDefaults("Copper Shortsword"); Main.loadPlayer[Main.numLoadPlayers].inventory[0].Prefix(-1); Main.loadPlayer[Main.numLoadPlayers].inventory[1].SetDefaults("Copper Pickaxe"); Main.loadPlayer[Main.numLoadPlayers].inventory[1].Prefix(-1); Main.loadPlayer[Main.numLoadPlayers].inventory[2].SetDefaults("Copper Axe"); Main.loadPlayer[Main.numLoadPlayers].inventory[2].Prefix(-1); Main.PlaySound(10, -1, -1, 1); Main.menuMode = 2; } else { if (this.selectedMenu == 8) { Main.PlaySound(10, -1, -1, 1); Main.menuMode = 4; } else { if (this.selectedMenu >= 0) { if (Main.menuMultiplayer) { Main.ServerSideCharacter = false; this.selectedPlayer = this.selectedMenu + Main.menuSkip; Main.player[Main.myPlayer] = (Player)Main.loadPlayer[this.selectedPlayer].Clone(); Main.playerPathName = Main.loadPlayerPath[this.selectedPlayer]; Main.PlaySound(10, -1, -1, 1); if (Main.autoJoin) { if (Netplay.SetIP(Main.getIP)) { Main.menuMode = 10; Netplay.StartClient(); } else { if (Netplay.SetIP2(Main.getIP)) { Main.menuMode = 10; Netplay.StartClient(); } } 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; this.selectedPlayer = this.selectedMenu + Main.menuSkip; Main.player[Main.myPlayer] = (Player)Main.loadPlayer[this.selectedPlayer].Clone(); Main.playerPathName = Main.loadPlayerPath[this.selectedPlayer]; Main.LoadWorlds(); Main.PlaySound(10, -1, -1, 1); Main.menuMode = 6; } } } } } } } } else { if (Main.menuMode == 2) { if (this.selectedMenu == 0) { Main.menuMode = 17; Main.PlaySound(10, -1, -1, 1); this.selColor = Main.loadPlayer[Main.numLoadPlayers].hairColor; } if (this.selectedMenu == 1) { Main.menuMode = 18; Main.PlaySound(10, -1, -1, 1); this.selColor = Main.loadPlayer[Main.numLoadPlayers].eyeColor; } if (this.selectedMenu == 2) { Main.menuMode = 19; Main.PlaySound(10, -1, -1, 1); this.selColor = Main.loadPlayer[Main.numLoadPlayers].skinColor; } if (this.selectedMenu == 3) { Main.menuMode = 20; Main.PlaySound(10, -1, -1, 1); } array9[0] = Lang.menu[18]; array9[1] = Lang.menu[19]; array9[2] = Lang.menu[20]; array9[3] = Lang.menu[21]; num = 220; for (int n = 0; n < 9; n++) { if (n < 6) { array7[n] = 0.75f; } else { array7[n] = 0.9f; } } num3 = 38; array4[6] = 6; array4[7] = 12; array4[8] = 18; num6 = Main.numLoadPlayers; num7 = Main.screenWidth / 2 - 16; num8 = 176; if (Main.loadPlayer[num6].male) { array9[4] = Lang.menu[22]; } else { array9[4] = Lang.menu[23]; } if (this.selectedMenu == 4) { if (Main.loadPlayer[num6].male) { Main.PlaySound(20, -1, -1, 1); Main.loadPlayer[num6].male = false; } else { Main.PlaySound(1, -1, -1, 1); Main.loadPlayer[num6].male = true; } } if (Main.loadPlayer[num6].difficulty == 2) { array9[5] = Lang.menu[24]; array6[5] = Main.loadPlayer[num6].difficulty; } else { if (Main.loadPlayer[num6].difficulty == 1) { array9[5] = Lang.menu[25]; array6[5] = Main.loadPlayer[num6].difficulty; } else { array9[5] = Lang.menu[26]; } } if (this.selectedMenu == 5) { Main.PlaySound(10, -1, -1, 1); Main.menuMode = 222; } if (this.selectedMenu == 7) { Main.PlaySound(12, -1, -1, 1); Main.loadPlayer[num6].hair = Main.rand.Next(51); Main.loadPlayer[num6].eyeColor = this.randColor(); while ((int)(Main.loadPlayer[num6].eyeColor.R + Main.loadPlayer[num6].eyeColor.G + Main.loadPlayer[num6].eyeColor.B) > 300) { Main.loadPlayer[num6].eyeColor = this.randColor(); } Main.loadPlayer[num6].hairColor = this.randColor(); Main.loadPlayer[num6].pantsColor = this.randColor(); Main.loadPlayer[num6].shirtColor = this.randColor(); Main.loadPlayer[num6].shoeColor = this.randColor(); Main.loadPlayer[num6].skinColor = this.randColor(); float num10 = (float)Main.rand.Next(60, 120) * 0.01f; if (num10 > 1f) { num10 = 1f; } Main.loadPlayer[num6].skinColor.R = (byte)((float)Main.rand.Next(240, 255) * num10); Main.loadPlayer[num6].skinColor.G = (byte)((float)Main.rand.Next(110, 140) * num10); Main.loadPlayer[num6].skinColor.B = (byte)((float)Main.rand.Next(75, 110) * num10); Main.loadPlayer[num6].underShirtColor = this.randColor(); int num11 = Main.loadPlayer[num6].hair + 1; if (num11 == 5 || num11 == 6 || num11 == 7 || num11 == 10 || num11 == 12 || num11 == 19 || num11 == 22 || num11 == 23 || num11 == 26 || num11 == 27 || num11 == 30 || num11 == 33) { Main.loadPlayer[num6].male = false; } else { Main.loadPlayer[num6].male = true; } } array9[7] = Lang.menu[27]; array9[6] = Lang.menu[28]; array9[8] = Lang.menu[5]; num4 = 9; if (this.selectedMenu == 8) { Main.PlaySound(11, -1, -1, 1); Main.menuMode = 1; } else { if (this.selectedMenu == 6) { Main.PlaySound(10, -1, -1, 1); Main.loadPlayer[Main.numLoadPlayers].name = ""; Main.menuMode = 3; Main.clrInput(); } } } else { if (Main.menuMode == 222) { if (this.focusMenu == 3) { array9[0] = Lang.menu[29]; } else { if (this.focusMenu == 2) { array9[0] = Lang.menu[30]; } else { if (this.focusMenu == 1) { array9[0] = Lang.menu[31]; } else { array9[0] = Lang.menu[32]; } } } num3 = 50; array4[1] = 25; array4[2] = 25; array4[3] = 25; array[0] = true; array9[1] = Lang.menu[26]; array9[2] = Lang.menu[25]; array6[2] = 1; array9[3] = Lang.menu[24]; array6[3] = 2; num4 = 4; if (this.selectedMenu == 1) { Main.loadPlayer[Main.numLoadPlayers].difficulty = 0; Main.menuMode = 2; } else { if (this.selectedMenu == 2) { Main.menuMode = 2; Main.loadPlayer[Main.numLoadPlayers].difficulty = 1; } else { if (this.selectedMenu == 3) { Main.loadPlayer[Main.numLoadPlayers].difficulty = 2; Main.menuMode = 2; } } } } else { if (Main.menuMode == 20) { if (this.selectedMenu == 0) { Main.menuMode = 21; Main.PlaySound(10, -1, -1, 1); this.selColor = Main.loadPlayer[Main.numLoadPlayers].shirtColor; } if (this.selectedMenu == 1) { Main.menuMode = 22; Main.PlaySound(10, -1, -1, 1); this.selColor = Main.loadPlayer[Main.numLoadPlayers].underShirtColor; } if (this.selectedMenu == 2) { Main.menuMode = 23; Main.PlaySound(10, -1, -1, 1); this.selColor = Main.loadPlayer[Main.numLoadPlayers].pantsColor; } if (this.selectedMenu == 3) { this.selColor = Main.loadPlayer[Main.numLoadPlayers].shoeColor; Main.menuMode = 24; Main.PlaySound(10, -1, -1, 1); } array9[0] = Lang.menu[33]; array9[1] = Lang.menu[34]; array9[2] = Lang.menu[35]; array9[3] = Lang.menu[36]; num = 260; num3 = 50; array4[5] = 20; array9[5] = Lang.menu[5]; num4 = 6; num6 = Main.numLoadPlayers; num7 = Main.screenWidth / 2 - 16; num8 = 210; if (this.selectedMenu == 5) { Main.PlaySound(11, -1, -1, 1); Main.menuMode = 2; } } else { if (Main.menuMode == 17) { num6 = Main.numLoadPlayers; num7 = Main.screenWidth / 2 - 16; num8 = 210; flag = true; num9 = 390; num = 260; num3 = 60; Main.loadPlayer[num6].hairColor = this.selColor; num4 = 3; array9[0] = Lang.menu[37] + " " + (Main.loadPlayer[num6].hair + 1); array9[1] = Lang.menu[38]; array[1] = true; array4[2] = 150; array4[1] = 10; array9[2] = Lang.menu[5]; if (this.selectedMenu == 0) { Main.PlaySound(12, -1, -1, 1); Main.loadPlayer[num6].hair++; if (Main.loadPlayer[num6].hair >= 51) { Main.loadPlayer[num6].hair = 0; } } else { if (this.selectedMenu2 == 0) { Main.PlaySound(12, -1, -1, 1); Main.loadPlayer[num6].hair--; if (Main.loadPlayer[num6].hair < 0) { Main.loadPlayer[num6].hair = 50; } } } if (this.selectedMenu == 2) { Main.menuMode = 2; Main.PlaySound(11, -1, -1, 1); } } else { if (Main.menuMode == 18) { num6 = Main.numLoadPlayers; num7 = Main.screenWidth / 2 - 16; num8 = 210; flag = true; num9 = 370; num = 240; num3 = 60; Main.loadPlayer[num6].eyeColor = this.selColor; num4 = 3; array9[0] = ""; array9[1] = Lang.menu[39]; array[1] = true; array4[2] = 170; array4[1] = 10; array9[2] = Lang.menu[5]; if (this.selectedMenu == 2) { Main.menuMode = 2; Main.PlaySound(11, -1, -1, 1); } } else { if (Main.menuMode == 19) { num6 = Main.numLoadPlayers; num7 = Main.screenWidth / 2 - 16; num8 = 210; flag = true; num9 = 370; num = 240; num3 = 60; Main.loadPlayer[num6].skinColor = this.selColor; num4 = 3; array9[0] = ""; array9[1] = Lang.menu[40]; array[1] = true; array4[2] = 170; array4[1] = 10; array9[2] = Lang.menu[5]; if (this.selectedMenu == 2) { Main.menuMode = 2; Main.PlaySound(11, -1, -1, 1); } } else { if (Main.menuMode == 21) { num6 = Main.numLoadPlayers; num7 = Main.screenWidth / 2 - 16; num8 = 210; flag = true; num9 = 370; num = 240; num3 = 60; Main.loadPlayer[num6].shirtColor = this.selColor; num4 = 3; array9[0] = ""; array9[1] = Lang.menu[41]; array[1] = true; array4[2] = 170; array4[1] = 10; array9[2] = Lang.menu[5]; if (this.selectedMenu == 2) { Main.menuMode = 20; Main.PlaySound(11, -1, -1, 1); } } else { if (Main.menuMode == 22) { num6 = Main.numLoadPlayers; num7 = Main.screenWidth / 2 - 16; num8 = 210; flag = true; num9 = 370; num = 240; num3 = 60; Main.loadPlayer[num6].underShirtColor = this.selColor; num4 = 3; array9[0] = ""; array9[1] = Lang.menu[42]; array[1] = true; array4[2] = 170; array4[1] = 10; array9[2] = Lang.menu[5]; if (this.selectedMenu == 2) { Main.menuMode = 20; Main.PlaySound(11, -1, -1, 1); } } else { if (Main.menuMode == 23) { num6 = Main.numLoadPlayers; num7 = Main.screenWidth / 2 - 16; num8 = 210; flag = true; num9 = 370; num = 240; num3 = 60; Main.loadPlayer[num6].pantsColor = this.selColor; num4 = 3; array9[0] = ""; array9[1] = Lang.menu[43]; array[1] = true; array4[2] = 170; array4[1] = 10; array9[2] = Lang.menu[5]; if (this.selectedMenu == 2) { Main.menuMode = 20; Main.PlaySound(11, -1, -1, 1); } } else { if (Main.menuMode == 24) { num6 = Main.numLoadPlayers; num7 = Main.screenWidth / 2 - 16; num8 = 210; flag = true; num9 = 370; num = 240; num3 = 60; Main.loadPlayer[num6].shoeColor = this.selColor; num4 = 3; array9[0] = ""; array9[1] = Lang.menu[44]; array[1] = true; array4[2] = 170; array4[1] = 10; array9[2] = Lang.menu[5]; if (this.selectedMenu == 2) { Main.menuMode = 20; Main.PlaySound(11, -1, -1, 1); } } else { if (Main.menuMode == 3) { string name = Main.loadPlayer[Main.numLoadPlayers].name; Main.loadPlayer[Main.numLoadPlayers].name = Main.GetInputText(Main.loadPlayer[Main.numLoadPlayers].name); if (Main.loadPlayer[Main.numLoadPlayers].name.Length > Player.nameLen) { Main.loadPlayer[Main.numLoadPlayers].name = Main.loadPlayer[Main.numLoadPlayers].name.Substring(0, Player.nameLen); } if (name != Main.loadPlayer[Main.numLoadPlayers].name) { Main.PlaySound(12, -1, -1, 1); } array9[0] = Lang.menu[45]; array2[2] = true; if (Main.loadPlayer[Main.numLoadPlayers].name != "") { if (Main.loadPlayer[Main.numLoadPlayers].name.Substring(0, 1) == " ") { Main.loadPlayer[Main.numLoadPlayers].name = ""; } for (int num12 = 0; num12 < Main.loadPlayer[Main.numLoadPlayers].name.Length; num12++) { if (Main.loadPlayer[Main.numLoadPlayers].name.Substring(num12, 1) != " ") { array2[2] = false; } } } this.textBlinkerCount++; if (this.textBlinkerCount >= 20) { if (this.textBlinkerState == 0) { this.textBlinkerState = 1; } else { this.textBlinkerState = 0; } this.textBlinkerCount = 0; } array9[1] = Main.loadPlayer[Main.numLoadPlayers].name; if (this.textBlinkerState == 1) { string[] array10; (array10 = array9)[1] = array10[1] + "|"; array5[1] = 1; } else { string[] array10; (array10 = array9)[1] = array10[1] + " "; } array[0] = true; array[1] = true; array4[1] = -20; array4[2] = 20; array9[2] = Lang.menu[4]; array9[3] = Lang.menu[5]; num4 = 4; if (this.selectedMenu == 3) { Main.PlaySound(11, -1, -1, 1); Main.menuMode = 2; } if (this.selectedMenu == 2 || (!array2[2] && Main.inputTextEnter)) { Main.loadPlayer[Main.numLoadPlayers].name.Trim(); Main.loadPlayerPath[Main.numLoadPlayers] = Main.getPlayerPathName(Main.loadPlayer[Main.numLoadPlayers].name); Player.SavePlayer(Main.loadPlayer[Main.numLoadPlayers], Main.loadPlayerPath[Main.numLoadPlayers]); Main.LoadPlayers(); Main.PlaySound(10, -1, -1, 1); Main.menuMode = 1; } } else { if (Main.menuMode == 4) { num = 180; num3 = 40; num4 = 8; array9[7] = Lang.menu[5]; array4[7] += 40; for (int num13 = 0; num13 < num4; num13++) { array7[num13] = 0.8f; } for (int num14 = 0; num14 < 7; num14++) { if (num14 + Main.menuSkip < Main.numLoadPlayers) { array9[num14] = Main.loadPlayer[num14 + Main.menuSkip].name; array6[num14] = Main.loadPlayer[num14 + Main.menuSkip].difficulty; } else { array9[num14] = null; } } bool[] array12 = new bool[num4]; array12[7] = true; if (Main.numLoadPlayers > 7 + Main.menuSkip) { this.menuWide[6] = true; array6[6] = 0; array12[6] = true; array9[6] = "▼"; array7[6] = 0.6f; array4[6] += 8; array3[6] = true; } if (Main.menuSkip > 0) { this.menuWide[0] = true; array6[0] = 0; array12[0] = true; array9[0] = "▲"; array7[0] = 0.6f; array4[0] += 8; array3[0] = true; } if (this.focusMenu >= 0 && this.focusMenu < Main.numLoadPlayers && !array12[this.focusMenu]) { num6 = this.focusMenu + Main.menuSkip; Vector2 vector2 = Main.fontDeathText.MeasureString(array9[num6 - Main.menuSkip]); num7 = (int)((double)(Main.screenWidth / 2) + (double)vector2.X * 0.5 + 10.0); num8 = num + num3 * this.focusMenu + 4; } if (this.selectedMenu == 0 && Main.menuSkip > 0) { Main.PlaySound(12, -1, -1, 1); Main.menuSkip -= 5; if (Main.menuSkip < 0) { Main.menuSkip = 0; } } else { if (this.selectedMenu == 6 && Main.menuSkip < Main.numLoadPlayers - 7) { Main.PlaySound(12, -1, -1, 1); Main.menuSkip += 5; if (Main.menuSkip >= Main.numLoadPlayers - 7) { Main.menuSkip = Main.numLoadPlayers - 7; } } else { if (this.selectedMenu == 7) { Main.PlaySound(11, -1, -1, 1); Main.menuMode = 1; } else { if (this.selectedMenu >= 0) { this.selectedPlayer = this.selectedMenu + Main.menuSkip; Main.PlaySound(10, -1, -1, 1); Main.menuMode = 5; } } } } } else { if (Main.menuMode == 5) { array9[0] = Lang.menu[46] + " " + Main.loadPlayer[this.selectedPlayer].name + "?"; array[0] = true; array9[1] = Lang.menu[104]; array9[2] = Lang.menu[105]; num4 = 3; if (this.selectedMenu == 1) { Main.ErasePlayer(this.selectedPlayer); Main.PlaySound(10, -1, -1, 1); Main.menuMode = 1; } else { if (this.selectedMenu == 2) { Main.PlaySound(11, -1, -1, 1); Main.menuMode = 1; } } } else { if (Main.menuMode == 6) { num = 180; num3 = 40; num4 = 10; array4[7] += 10; array4[8] += 10; array4[9] += 10; for (int num15 = 0; num15 < num4; num15++) { array7[num15] = 0.8f; } array9[7] = Lang.menu[47]; array9[8] = Lang.menu[17]; if (Main.numLoadWorlds >= Main.maxLoadWorld) { array2[7] = true; array9[7] = ""; } else { if (Main.numLoadWorlds == 0) { array2[8] = true; array9[8] = ""; } } array9[9] = Lang.menu[5]; for (int num16 = 0; num16 < 7; num16++) { if (num16 + Main.menuSkip < Main.numLoadWorlds) { array9[num16] = Main.loadWorld[num16 + Main.menuSkip]; } else { array9[num16] = null; } } if (Main.numLoadWorlds > 7 + Main.menuSkip) { this.menuWide[6] = true; array9[6] = "more"; array9[6] = "▼"; array7[6] = 0.6f; array4[6] += 8; } if (Main.menuSkip > 0) { array9[0] = "▲"; array7[0] = 0.6f; array4[0] += 8; this.menuWide[0] = true; } if (this.selectedMenu == 0 && Main.menuSkip > 0) { Main.PlaySound(12, -1, -1, 1); Main.menuSkip -= 5; if (Main.menuSkip < 0) { Main.menuSkip = 0; } } else { if (this.selectedMenu == 6 && Main.menuSkip < Main.numLoadWorlds - 7) { Main.PlaySound(12, -1, -1, 1); Main.menuSkip += 5; if (Main.menuSkip >= Main.numLoadWorlds - 7) { Main.menuSkip = Main.numLoadWorlds - 7; } } else { if (this.selectedMenu == 9) { if (Main.menuMultiplayer) { Main.menuMode = 12; } else { Main.menuMode = 1; } Main.PlaySound(11, -1, -1, 1); } else { if (this.selectedMenu == 7) { Main.PlaySound(10, -1, -1, 1); Main.menuMode = 16; Main.newWorldName = Lang.gen[57] + " " + (Main.numLoadWorlds + 1); } else { if (this.selectedMenu == 8) { Main.PlaySound(10, -1, -1, 1); Main.menuMode = 8; } else { if (this.selectedMenu >= 0) { if (Main.menuMultiplayer) { Main.PlaySound(10, -1, -1, 1); Main.worldPathName = Main.loadWorldPath[this.selectedMenu + Main.menuSkip]; Main.menuMode = 30; Main.GetInputText(""); } else { Main.PlaySound(10, -1, -1, 1); Main.worldPathName = Main.loadWorldPath[this.selectedMenu + Main.menuSkip]; WorldGen.playWorld(); Main.menuMode = 10; } } } } } } } } else { if (Main.menuMode == 7) { string text = Main.newWorldName; Main.newWorldName = Main.GetInputText(Main.newWorldName); if (Main.newWorldName.Length > 20) { Main.newWorldName = Main.newWorldName.Substring(0, 20); } if (text != Main.newWorldName) { Main.PlaySound(12, -1, -1, 1); } array9[0] = Lang.menu[48]; array2[2] = true; if (Main.newWorldName != "") { if (Main.newWorldName.Substring(0, 1) == " ") { Main.newWorldName = ""; } for (int num17 = 0; num17 < Main.newWorldName.Length; num17++) { if (Main.newWorldName != " ") { array2[2] = false; } } } this.textBlinkerCount++; if (this.textBlinkerCount >= 20) { if (this.textBlinkerState == 0) { this.textBlinkerState = 1; } else { this.textBlinkerState = 0; } this.textBlinkerCount = 0; } array9[1] = Main.newWorldName; if (this.textBlinkerState == 1) { string[] array10; (array10 = array9)[1] = array10[1] + "|"; array5[1] = 1; } else { string[] array10; (array10 = array9)[1] = array10[1] + " "; } array[0] = true; array[1] = true; array4[1] = -20; array4[2] = 20; array9[2] = Lang.menu[4]; array9[3] = Lang.menu[5]; num4 = 4; if (this.selectedMenu == 3) { Main.PlaySound(11, -1, -1, 1); Main.menuMode = 16; } if (this.selectedMenu == 2 || (!array2[2] && Main.inputTextEnter)) { Main.menuMode = 10; Main.worldName = Main.newWorldName; Main.worldPathName = Main.getWorldPathName(Main.worldName); WorldGen.CreateNewWorld(); } } else { if (Main.menuMode == 8) { num = 180; num3 = 40; num4 = 8; array4[7] += 30; for (int num18 = 0; num18 < num4; num18++) { array7[num18] = 0.8f; } array9[7] = Lang.menu[5]; for (int num19 = 0; num19 < 7; num19++) { if (num19 < Main.numLoadWorlds) { array9[num19] = Main.loadWorld[num19 + Main.menuSkip]; } else { array9[num19] = null; } } if (Main.numLoadWorlds > 7 + Main.menuSkip) { array9[6] = "more"; array9[6] = "▼"; array7[6] = 0.6f; array4[6] += 8; this.menuWide[6] = true; } if (Main.menuSkip > 0) { array9[0] = "▲"; array7[0] = 0.6f; array4[0] += 8; this.menuWide[0] = true; } if (this.selectedMenu == 0 && Main.menuSkip > 0) { Main.PlaySound(12, -1, -1, 1); Main.menuSkip -= 5; if (Main.menuSkip < 0) { Main.menuSkip = 0; } } else { if (this.selectedMenu == 6 && Main.menuSkip < Main.numLoadWorlds - 7) { Main.PlaySound(12, -1, -1, 1); Main.menuSkip += 5; if (Main.menuSkip >= Main.numLoadPlayers - 7) { Main.menuSkip = Main.numLoadWorlds - 7; } } else { if (this.selectedMenu == 7) { Main.PlaySound(11, -1, -1, 1); Main.menuMode = 6; } else { if (this.selectedMenu >= 0) { this.selectedWorld = this.selectedMenu + Main.menuSkip; Main.PlaySound(10, -1, -1, 1); Main.menuMode = 9; } } } } } else { if (Main.menuMode == 9) { array9[0] = Lang.menu[46] + " " + Main.loadWorld[this.selectedWorld] + "?"; array[0] = true; array9[1] = Lang.menu[104]; array9[2] = Lang.menu[105]; num4 = 3; if (this.selectedMenu == 1) { Main.EraseWorld(this.selectedWorld); Main.PlaySound(10, -1, -1, 1); Main.menuMode = 6; } else { if (this.selectedMenu == 2) { Main.PlaySound(11, -1, -1, 1); Main.menuMode = 6; } } } else { if (Main.menuMode == 1111) { num = 210; num3 = 46; for (int num20 = 0; num20 < 7; num20++) { array7[num20] = 0.9f; } array4[7] = 10; num4 = 8; if (this.graphics.IsFullScreen) { array9[0] = Lang.menu[49]; } else { array9[0] = Lang.menu[50]; } this.bgScroll = (int)Math.Round((double)((1f - Main.caveParrallax) * 500f)); array9[1] = Lang.menu[51]; array9[2] = Lang.menu[52]; if (Main.fixedTiming) { array9[3] = Lang.menu[53]; } else { array9[3] = Lang.menu[54]; } if (Lighting.lightMode == 0) { array9[4] = Lang.menu[55]; } else { if (Lighting.lightMode == 1) { array9[4] = Lang.menu[56]; } else { if (Lighting.lightMode == 2) { array9[4] = Lang.menu[57]; } else { if (Lighting.lightMode == 3) { array9[4] = Lang.menu[58]; } } } } if (Main.qaStyle == 0) { array9[5] = Lang.menu[59]; } else { if (Main.qaStyle == 1) { array9[5] = Lang.menu[60]; } else { if (Main.qaStyle == 2) { array9[5] = Lang.menu[61]; } else { array9[5] = Lang.menu[62]; } } } if (Main.owBack) { array9[6] = Lang.menu[100]; } else { array9[6] = Lang.menu[101]; } if (this.selectedMenu == 6) { Main.PlaySound(12, -1, -1, 1); if (Main.owBack) { Main.owBack = false; } else { Main.owBack = true; } } array9[7] = Lang.menu[5]; if (this.selectedMenu == 7) { Main.PlaySound(11, -1, -1, 1); this.SaveSettings(); Main.menuMode = 11; } if (this.selectedMenu == 5) { Main.PlaySound(12, -1, -1, 1); Main.qaStyle++; if (Main.qaStyle > 3) { Main.qaStyle = 0; } } if (this.selectedMenu == 4) { Main.PlaySound(12, -1, -1, 1); Lighting.lightMode++; if (Lighting.lightMode >= 4) { Lighting.lightMode = 0; } } if (this.selectedMenu == 3) { Main.PlaySound(12, -1, -1, 1); if (Main.fixedTiming) { Main.fixedTiming = false; } else { Main.fixedTiming = true; } } if (this.selectedMenu == 2) { Main.PlaySound(11, -1, -1, 1); Main.menuMode = 28; } if (this.selectedMenu == 1) { Main.PlaySound(10, -1, -1, 1); Main.menuMode = 111; } if (this.selectedMenu == 0) { this.graphics.ToggleFullScreen(); } } else { if (Main.menuMode == 11) { num = 176; num3 = 37; array4[10] = 8; num4 = 11; for (int num21 = 0; num21 < 11; num21++) { array7[num21] = 0.73f; } array9[0] = Lang.menu[63]; array9[1] = Lang.menu[64]; array9[2] = Lang.menu[65]; array9[3] = Lang.menu[66]; array9[4] = "Map Controls"; if (Main.autoSave) { array9[5] = Lang.menu[67]; } else { array9[5] = Lang.menu[68]; } if (Main.autoPause) { array9[6] = Lang.menu[69]; } else { array9[6] = Lang.menu[70]; } if (Main.showItemText) { array9[7] = Lang.menu[71]; } else { array9[7] = Lang.menu[72]; } if (Main.mapEnabled) { array9[8] = Lang.menu[112]; } else { array9[8] = Lang.menu[113]; } array9[10] = Lang.menu[5]; array9[9] = Lang.menu[103]; if (this.selectedMenu == 9) { Main.PlaySound(10, -1, -1, 1); Main.menuMode = 1213; } if (this.selectedMenu == 10) { Main.PlaySound(11, -1, -1, 1); this.SaveSettings(); Main.menuMode = 0; } if (this.selectedMenu == 8) { Main.PlaySound(12, -1, -1, 1); if (Main.mapEnabled) { Main.mapEnabled = false; } else { Main.mapEnabled = true; } } if (this.selectedMenu == 7) { Main.PlaySound(12, -1, -1, 1); if (Main.showItemText) { Main.showItemText = false; } else { Main.showItemText = true; } } if (this.selectedMenu == 6) { Main.PlaySound(12, -1, -1, 1); if (Main.autoPause) { Main.autoPause = false; } else { Main.autoPause = true; } } if (this.selectedMenu == 5) { Main.PlaySound(12, -1, -1, 1); if (Main.autoSave) { Main.autoSave = false; } else { Main.autoSave = true; } } if (this.selectedMenu == 4) { Main.PlaySound(11, -1, -1, 1); Main.menuMode = 272727; } if (this.selectedMenu == 3) { Main.PlaySound(11, -1, -1, 1); Main.menuMode = 27; } if (this.selectedMenu == 2) { Main.PlaySound(11, -1, -1, 1); Main.menuMode = 26; } if (this.selectedMenu == 1) { Main.PlaySound(10, -1, -1, 1); this.selColor = Main.mouseColor; Main.menuMode = 25; } if (this.selectedMenu == 0) { Main.PlaySound(10, -1, -1, 1); Main.menuMode = 1111; } } else { if (Main.menuMode == 111) { num = 240; num3 = 60; num4 = 3; array9[0] = Lang.menu[73]; array9[1] = this.graphics.PreferredBackBufferWidth + "x" + this.graphics.PreferredBackBufferHeight; array[0] = true; array4[2] = 170; array4[1] = 10; array9[2] = Lang.menu[5]; if (this.selectedMenu == 1) { Main.PlaySound(12, -1, -1, 1); int num22 = 0; for (int num23 = 0; num23 < this.numDisplayModes; num23++) { if (this.displayWidth[num23] == this.graphics.PreferredBackBufferWidth && this.displayHeight[num23] == this.graphics.PreferredBackBufferHeight) { num22 = num23; break; } } num22++; if (num22 >= this.numDisplayModes) { num22 = 0; } this.graphics.PreferredBackBufferWidth = this.displayWidth[num22]; this.graphics.PreferredBackBufferHeight = this.displayHeight[num22]; } if (this.selectedMenu == 2) { if (this.graphics.IsFullScreen) { this.graphics.ApplyChanges(); } Main.menuMode = 1111; Main.PlaySound(11, -1, -1, 1); } } else { if (Main.menuMode == 25) { flag = true; num9 = 370; num = 240; num3 = 60; Main.mouseColor = this.selColor; num4 = 3; array9[0] = ""; array9[1] = Lang.menu[64]; array[1] = true; array4[2] = 170; array4[1] = 10; array9[2] = Lang.menu[5]; if (this.selectedMenu == 2) { Main.menuMode = 11; Main.PlaySound(11, -1, -1, 1); } } else { if (Main.menuMode == 26) { flag2 = true; num = 240; num3 = 60; num4 = 3; array9[0] = ""; array9[1] = Lang.menu[65]; array[1] = true; array4[2] = 170; array4[1] = 10; array9[2] = Lang.menu[5]; if (this.selectedMenu == 2) { Main.menuMode = 11; Main.PlaySound(11, -1, -1, 1); } } else { if (Main.menuMode == 28) { Main.caveParrallax = 1f - (float)this.bgScroll / 500f; flag3 = true; num = 240; num3 = 60; num4 = 3; array9[0] = ""; array9[1] = Lang.menu[52]; array[1] = true; array4[2] = 170; array4[1] = 10; array9[2] = Lang.menu[5]; if (this.selectedMenu == 2) { Main.menuMode = 1111; Main.PlaySound(11, -1, -1, 1); } } else { if (Main.menuMode == 272727) { num = 200; num3 = 30; num4 = 14; string[] array13 = new string[12]; array13[0] = Main.cMapStyle; array13[1] = Main.cMapFull; array13[2] = Main.cMapZoomIn; array13[3] = Main.cMapZoomOut; array13[4] = Main.cMapAlphaUp; array13[5] = Main.cMapAlphaDown; if (this.setKey >= 0) { array13[this.setKey] = "_"; } array9[0] = Lang.menu[106] + array13[0]; array9[1] = Lang.menu[107] + array13[1]; array9[2] = Lang.menu[108] + array13[2]; array9[3] = Lang.menu[109] + array13[3]; array9[4] = Lang.menu[110] + array13[4]; array9[5] = Lang.menu[111] + array13[5]; for (int num24 = 0; num24 < 6; num24++) { array8[num24] = true; array7[num24] = 0.55f; array5[num24] = -140; } array7[6] = 0.8f; array7[6] = 0.8f; array4[6] = 6; array9[6] = Lang.menu[86]; array4[7] = 16; array9[7] = Lang.menu[5]; if (this.selectedMenu == 7) { Main.menuMode = 11; Main.PlaySound(11, -1, -1, 1); } else { if (this.selectedMenu == 6) { Main.cMapStyle = "Tab"; Main.cMapFull = "M"; Main.cMapZoomIn = "Add"; Main.cMapZoomOut = "Subtract"; Main.cMapAlphaUp = "PageUp"; Main.cMapAlphaDown = "PageDown"; this.setKey = -1; Main.PlaySound(11, -1, -1, 1); } else { if (this.selectedMenu >= 0) { this.setKey = this.selectedMenu; } } } if (this.setKey >= 0) { Keys[] pressedKeys = Main.keyState.GetPressedKeys(); if (pressedKeys.Length > 0) { string text2 = string.Concat(pressedKeys[0]); if (text2 != "None") { if (this.setKey == 0) { Main.cMapStyle = text2; } if (this.setKey == 1) { Main.cMapFull = text2; } if (this.setKey == 2) { Main.cMapZoomIn = text2; } if (this.setKey == 3) { Main.cMapZoomOut = text2; } if (this.setKey == 4) { Main.cMapAlphaUp = text2; } if (this.setKey == 5) { Main.cMapAlphaDown = text2; } this.setKey = -1; } } } } else { if (Main.menuMode == 27) { num = 176; num3 = 28; num4 = 14; string[] array14 = new string[] { Main.cUp, Main.cDown, Main.cLeft, Main.cRight, Main.cJump, Main.cThrowItem, Main.cInv, Main.cHeal, Main.cMana, Main.cBuff, Main.cHook, Main.cTorch }; if (this.setKey >= 0) { array14[this.setKey] = "_"; } array9[0] = Lang.menu[74] + array14[0]; array9[1] = Lang.menu[75] + array14[1]; array9[2] = Lang.menu[76] + array14[2]; array9[3] = Lang.menu[77] + array14[3]; array9[4] = Lang.menu[78] + array14[4]; array9[5] = Lang.menu[79] + array14[5]; array9[6] = Lang.menu[80] + array14[6]; array9[7] = Lang.menu[81] + array14[7]; array9[8] = Lang.menu[82] + array14[8]; array9[9] = Lang.menu[83] + array14[9]; array9[10] = Lang.menu[84] + array14[10]; array9[11] = Lang.menu[85] + array14[11]; for (int num25 = 0; num25 < 12; num25++) { array8[num25] = true; array7[num25] = 0.55f; array5[num25] = -80; } array7[12] = 0.8f; array7[13] = 0.8f; array4[12] = 6; array9[12] = Lang.menu[86]; array4[13] = 16; array9[13] = Lang.menu[5]; if (this.selectedMenu == 13) { Main.menuMode = 11; Main.PlaySound(11, -1, -1, 1); } else { if (this.selectedMenu == 12) { 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 = "M"; Main.cBuff = "B"; Main.cHook = "E"; Main.cTorch = "LeftShift"; this.setKey = -1; Main.PlaySound(11, -1, -1, 1); } else { if (this.selectedMenu >= 0) { this.setKey = this.selectedMenu; } } } if (this.setKey >= 0) { Keys[] pressedKeys2 = Main.keyState.GetPressedKeys(); if (pressedKeys2.Length > 0) { string text3 = string.Concat(pressedKeys2[0]); if (text3 != "None") { if (this.setKey == 0) { Main.cUp = text3; } if (this.setKey == 1) { Main.cDown = text3; } if (this.setKey == 2) { Main.cLeft = text3; } if (this.setKey == 3) { Main.cRight = text3; } if (this.setKey == 4) { Main.cJump = text3; } if (this.setKey == 5) { Main.cThrowItem = text3; } if (this.setKey == 6) { Main.cInv = text3; } if (this.setKey == 7) { Main.cHeal = text3; } if (this.setKey == 8) { Main.cMana = text3; } if (this.setKey == 9) { Main.cBuff = text3; } if (this.setKey == 10) { Main.cHook = text3; } if (this.setKey == 11) { Main.cTorch = text3; } this.setKey = -1; } } } } else { if (Main.menuMode == 12) { Main.menuServer = false; array9[0] = Lang.menu[87]; array9[1] = Lang.menu[88]; array9[2] = Lang.menu[5]; if (this.selectedMenu == 0) { Main.LoadPlayers(); Main.menuMultiplayer = true; Main.PlaySound(10, -1, -1, 1); Main.menuMode = 1; } else { if (this.selectedMenu == 1) { Main.LoadPlayers(); Main.PlaySound(10, -1, -1, 1); Main.menuMode = 1; Main.menuMultiplayer = true; Main.menuServer = true; } } if (this.selectedMenu == 2) { Main.PlaySound(11, -1, -1, 1); Main.menuMode = 0; } num4 = 3; } else { if (Main.menuMode == 13) { string text4 = Main.getIP; Main.getIP = Main.GetInputText(Main.getIP); if (text4 != Main.getIP) { Main.PlaySound(12, -1, -1, 1); } array9[0] = Lang.menu[89]; array2[9] = true; if (Main.getIP != "") { if (Main.getIP.Substring(0, 1) == " ") { Main.getIP = ""; } for (int num26 = 0; num26 < Main.getIP.Length; num26++) { if (Main.getIP != " ") { array2[9] = false; } } } this.textBlinkerCount++; if (this.textBlinkerCount >= 20) { if (this.textBlinkerState == 0) { this.textBlinkerState = 1; } else { this.textBlinkerState = 0; } this.textBlinkerCount = 0; } array9[1] = Main.getIP; if (this.textBlinkerState == 1) { string[] array10; (array10 = array9)[1] = array10[1] + "|"; array5[1] = 1; } else { string[] array10; (array10 = array9)[1] = array10[1] + " "; } array[0] = true; array[1] = true; array4[9] = 44; array4[10] = 64; array9[9] = Lang.menu[4]; array9[10] = Lang.menu[5]; num4 = 11; num = 180; num3 = 30; array4[1] = 19; for (int num27 = 2; num27 < 9; num27++) { int num28 = num27 - 2; if (Main.recentWorld[num28] != null && Main.recentWorld[num28] != "") { array9[num27] = string.Concat(new object[] { Main.recentWorld[num28], " (", Main.recentIP[num28], ":", Main.recentPort[num28], ")" }); } else { array9[num27] = ""; array[num27] = true; } array7[num27] = 0.6f; array4[num27] = 40; } if (this.selectedMenu >= 2 && this.selectedMenu < 9) { Main.autoPass = false; int num29 = this.selectedMenu - 2; Netplay.serverPort = Main.recentPort[num29]; Main.getIP = Main.recentIP[num29]; if (Netplay.SetIP(Main.getIP)) { Main.menuMode = 10; Netplay.StartClient(); } else { if (Netplay.SetIP2(Main.getIP)) { Main.menuMode = 10; Netplay.StartClient(); } } } if (this.selectedMenu == 10) { Main.PlaySound(11, -1, -1, 1); Main.menuMode = 1; } if (this.selectedMenu == 9 || (!array2[2] && Main.inputTextEnter)) { Main.PlaySound(12, -1, -1, 1); Main.menuMode = 131; Main.clrInput(); } } else { if (Main.menuMode == 131) { int num30 = 7777; string text5 = Main.getPort; Main.getPort = Main.GetInputText(Main.getPort); if (text5 != Main.getPort) { Main.PlaySound(12, -1, -1, 1); } array9[0] = Lang.menu[90]; array2[2] = true; if (Main.getPort != "") { bool flag5 = false; try { num30 = Convert.ToInt32(Main.getPort); if (num30 > 0 && num30 <= 65535) { flag5 = true; } } catch { } if (flag5) { array2[2] = false; } } this.textBlinkerCount++; if (this.textBlinkerCount >= 20) { if (this.textBlinkerState == 0) { this.textBlinkerState = 1; } else { this.textBlinkerState = 0; } this.textBlinkerCount = 0; } array9[1] = Main.getPort; if (this.textBlinkerState == 1) { string[] array10; (array10 = array9)[1] = array10[1] + "|"; array5[1] = 1; } else { string[] array10; (array10 = array9)[1] = array10[1] + " "; } array[0] = true; array[1] = true; array4[1] = -20; array4[2] = 20; array9[2] = Lang.menu[4]; array9[3] = Lang.menu[5]; num4 = 4; if (this.selectedMenu == 3) { Main.PlaySound(11, -1, -1, 1); Main.menuMode = 1; } if (this.selectedMenu == 2 || (!array2[2] && Main.inputTextEnter)) { Netplay.serverPort = num30; Main.autoPass = false; if (Netplay.SetIP(Main.getIP)) { Main.menuMode = 10; Netplay.StartClient(); } else { if (Netplay.SetIP2(Main.getIP)) { Main.menuMode = 10; Netplay.StartClient(); } } } } else { if (Main.menuMode == 16) { num = 200; num3 = 60; array4[1] = 30; array4[2] = 30; array4[3] = 30; array4[4] = 70; array9[0] = Lang.menu[91]; array[0] = true; array9[1] = Lang.menu[92]; array9[2] = Lang.menu[93]; array9[3] = Lang.menu[94]; array9[4] = Lang.menu[5]; num4 = 5; if (this.selectedMenu == 4) { Main.menuMode = 6; Main.PlaySound(11, -1, -1, 1); } 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, -1, -1, 1); WorldGen.setWorldSize(); } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } IL_443A: if (Main.menuMode != num5) { this.blockMouse = true; Main.menuSkip = 0; num4 = 0; for (int num31 = 0; num31 < Main.maxMenuItems; num31++) { this.menuItemScale[num31] = 0.8f; } } if (!Main.mouseLeft) { this.blockMouse = true; } int num32 = this.focusMenu; this.selectedMenu = -1; this.selectedMenu2 = -1; this.focusMenu = -1; for (int num33 = 0; num33 < num4; num33++) { if (array9[num33] != null) { if (!flag) { this.grabColorSlider = 0; this.hBar = -1f; this.sBar = -1f; this.lBar = -1f; } if (flag) { if (!Main.mouseLeft) { this.grabColorSlider = 0; this.blockMouse = false; } int num34 = num9; int num35 = Main.screenWidth / 2 - this.hueTexture.Width / 2; int num36 = 167; Vector3 vector3 = Main.rgbToHsl(this.selColor); float num37 = vector3.X; float num38 = vector3.Y; float num39 = vector3.Z; if (this.hBar == -1f || this.sBar == -1f || this.lBar == -1f) { this.hBar = num37; this.sBar = num38; this.lBar = num39; } else { num37 = this.hBar; num38 = this.sBar; num39 = this.lBar; } this.spriteBatch.Draw(this.hueTexture, new Vector2((float)num35, (float)num34), Color.White); this.spriteBatch.Draw(this.colorSliderTexture, new Vector2((float)num35 + (float)(this.hueTexture.Width - 2) * this.hBar - (float)(this.colorSliderTexture.Width / 2), (float)(num34 - this.colorSliderTexture.Height / 2 + this.hueTexture.Height / 2)), Color.White); if (((Main.mouseX > num35 - 4 && Main.mouseX < num35 + this.hueTexture.Width + 4 && Main.mouseY > num34 - 4 && Main.mouseY < num34 + this.hueTexture.Height + 4) || this.grabColorSlider == 1) && Main.mouseLeft && !this.blockMouse) { this.grabColorSlider = 1; num37 = (float)(Main.mouseX - num35); num37 /= (float)this.hueTexture.Width; if (num37 < 0f) { num37 = 0f; } if (num37 > 1f) { num37 = 1f; } this.hBar = num37; } num34 += 26; this.spriteBatch.Draw(this.colorBarTexture, new Vector2((float)num35, (float)num34), Color.White); for (int num40 = 0; num40 <= num36; num40++) { float saturation = (float)num40 / (float)num36; Color color4 = Main.hslToRgb(num37, saturation, num39); this.spriteBatch.Draw(this.colorBlipTexture, new Vector2((float)(num35 + num40 + 5), (float)(num34 + 4)), color4); } this.spriteBatch.Draw(this.colorSliderTexture, new Vector2((float)num35 + (float)(this.hueTexture.Width - 2) * this.sBar - (float)(this.colorSliderTexture.Width / 2), (float)(num34 - this.colorSliderTexture.Height / 2 + this.hueTexture.Height / 2)), Color.White); if (((Main.mouseX > num35 - 4 && Main.mouseX < num35 + this.hueTexture.Width + 4 && Main.mouseY > num34 - 4 && Main.mouseY < num34 + this.hueTexture.Height + 4) || this.grabColorSlider == 2) && Main.mouseLeft && !this.blockMouse) { this.grabColorSlider = 2; num38 = (float)(Main.mouseX - num35); num38 /= (float)this.hueTexture.Width; if (num38 < 0f) { num38 = 0f; } if (num38 > 1f) { num38 = 1f; } this.sBar = num38; } num34 += 26; this.spriteBatch.Draw(this.colorBarTexture, new Vector2((float)num35, (float)num34), Color.White); float num41 = 0.15f; for (int num42 = 0; num42 <= num36; num42++) { float luminosity = (float)num42 / (float)num36; Color color5 = Main.hslToRgb(num37, num38, luminosity); this.spriteBatch.Draw(this.colorBlipTexture, new Vector2((float)(num35 + num42 + 5), (float)(num34 + 4)), color5); } this.spriteBatch.Draw(this.colorSliderTexture, new Vector2((float)num35 + (float)(this.hueTexture.Width - 2) * ((this.lBar - num41) / (1f - num41)) - (float)(this.colorSliderTexture.Width / 2), (float)(num34 - this.colorSliderTexture.Height / 2 + this.hueTexture.Height / 2)), Color.White); if (((Main.mouseX > num35 - 4 && Main.mouseX < num35 + this.hueTexture.Width + 4 && Main.mouseY > num34 - 4 && Main.mouseY < num34 + this.hueTexture.Height + 4) || this.grabColorSlider == 3) && Main.mouseLeft && !this.blockMouse) { this.grabColorSlider = 3; num39 = (float)(Main.mouseX - num35); num39 /= (float)this.hueTexture.Width; if (num39 < 0f) { num39 = 0f; } if (num39 > 1f) { num39 = 1f; } num39 = num39 * (1f - num41) + num41; this.lBar = num39; } this.selColor = Main.hslToRgb(this.hBar, this.sBar, this.lBar); } else { if (flag) { string text6 = ""; for (int num43 = 0; num43 < 6; num43++) { int num44 = num9; int num45 = 370 + Main.screenWidth / 2 - 400; if (num43 == 0) { text6 = Lang.menu[95]; } if (num43 == 1) { text6 = Lang.menu[96]; num44 += 30; } if (num43 == 2) { text6 = Lang.menu[97]; num44 += 60; } if (num43 == 3) { text6 = string.Concat(this.selColor.R); num45 += 90; } if (num43 == 4) { text6 = string.Concat(this.selColor.G); num45 += 90; num44 += 30; } if (num43 == 5) { text6 = string.Concat(this.selColor.B); num45 += 90; num44 += 60; } for (int num46 = 0; num46 < 5; num46++) { Color color6 = Color.Black; if (num46 == 4) { color6 = color; color6.R = (byte)((255 + color6.R) / 2); color6.G = (byte)((255 + color6.R) / 2); color6.B = (byte)((255 + color6.R) / 2); } int num47 = 255; int num48 = (int)color6.R - (255 - num47); if (num48 < 0) { num48 = 0; } color6 = new Color((int)((byte)num48), (int)((byte)num48), (int)((byte)num48), (int)((byte)num47)); int num49 = 0; int num50 = 0; if (num46 == 0) { num49 = -2; } if (num46 == 1) { num49 = 2; } if (num46 == 2) { num50 = -2; } if (num46 == 3) { num50 = 2; } this.spriteBatch.DrawString(Main.fontDeathText, text6, new Vector2((float)(num45 + num49), (float)(num44 + num50)), color6, 0f, default(Vector2), 0.5f, SpriteEffects.None, 0f); } } bool flag6 = false; for (int num51 = 0; num51 < 2; num51++) { for (int num52 = 0; num52 < 3; num52++) { int num53 = num9 + num52 * 30 - 12; int num54 = 360 + Main.screenWidth / 2 - 400; float scale = 0.9f; if (num51 == 0) { num54 -= 70; num53 += 2; } else { num54 -= 40; } text6 = "-"; if (num51 == 1) { text6 = "+"; } Vector2 vector4 = new Vector2(24f, 24f); int num55 = 142; if (Main.mouseX > num54 && (float)Main.mouseX < (float)num54 + vector4.X && Main.mouseY > num53 + 13 && (float)Main.mouseY < (float)(num53 + 13) + vector4.Y) { if (this.focusColor != (num51 + 1) * (num52 + 10)) { Main.PlaySound(12, -1, -1, 1); } this.focusColor = (num51 + 1) * (num52 + 10); flag6 = true; num55 = 255; if (Main.mouseLeft) { if (this.colorDelay <= 1) { if (this.colorDelay == 0) { this.colorDelay = 40; } else { this.colorDelay = 3; } int num56 = num51; if (num51 == 0) { num56 = -1; if (this.selColor.R + this.selColor.G + this.selColor.B <= 150) { num56 = 0; } } if (num52 == 0 && (int)this.selColor.R + num56 >= 0 && (int)this.selColor.R + num56 <= 255) { this.selColor.R = (byte)((int)this.selColor.R + num56); } if (num52 == 1 && (int)this.selColor.G + num56 >= 0 && (int)this.selColor.G + num56 <= 255) { this.selColor.G = (byte)((int)this.selColor.G + num56); } if (num52 == 2 && (int)this.selColor.B + num56 >= 0 && (int)this.selColor.B + num56 <= 255) { this.selColor.B = (byte)((int)this.selColor.B + num56); } } this.colorDelay--; } else { this.colorDelay = 0; } } for (int num57 = 0; num57 < 5; num57++) { Color color7 = Color.Black; if (num57 == 4) { color7 = color; color7.R = (byte)((255 + color7.R) / 2); color7.G = (byte)((255 + color7.R) / 2); color7.B = (byte)((255 + color7.R) / 2); } int num58 = (int)color7.R - (255 - num55); if (num58 < 0) { num58 = 0; } color7 = new Color((int)((byte)num58), (int)((byte)num58), (int)((byte)num58), (int)((byte)num55)); int num59 = 0; int num60 = 0; if (num57 == 0) { num59 = -2; } if (num57 == 1) { num59 = 2; } if (num57 == 2) { num60 = -2; } if (num57 == 3) { num60 = 2; } this.spriteBatch.DrawString(Main.fontDeathText, text6, new Vector2((float)(num54 + num59), (float)(num53 + num60)), color7, 0f, default(Vector2), scale, SpriteEffects.None, 0f); } } } if (!flag6) { this.focusColor = 0; this.colorDelay = 0; } } } if (flag3) { int num61 = 400; string text7 = ""; for (int num62 = 0; num62 < 4; num62++) { int num63 = num61; int num64 = 370 + Main.screenWidth / 2 - 400; if (num62 == 0) { text7 = Lang.menu[52] + ": " + this.bgScroll; } for (int num65 = 0; num65 < 5; num65++) { Color color8 = Color.Black; if (num65 == 4) { color8 = color; color8.R = (byte)((255 + color8.R) / 2); color8.G = (byte)((255 + color8.R) / 2); color8.B = (byte)((255 + color8.R) / 2); } int num66 = 255; int num67 = (int)color8.R - (255 - num66); if (num67 < 0) { num67 = 0; } color8 = new Color((int)((byte)num67), (int)((byte)num67), (int)((byte)num67), (int)((byte)num66)); int num68 = 0; int num69 = 0; if (num65 == 0) { num68 = -2; } if (num65 == 1) { num68 = 2; } if (num65 == 2) { num69 = -2; } if (num65 == 3) { num69 = 2; } this.spriteBatch.DrawString(Main.fontDeathText, text7, new Vector2((float)(num64 + num68), (float)(num63 + num69)), color8, 0f, default(Vector2), 0.5f, SpriteEffects.None, 0f); } } bool flag7 = false; for (int num70 = 0; num70 < 2; num70++) { for (int num71 = 0; num71 < 1; num71++) { int num72 = num61 + num71 * 30 - 12; int num73 = 360 + Main.screenWidth / 2 - 400; float scale2 = 0.9f; if (num70 == 0) { num73 -= 70; num72 += 2; } else { num73 -= 40; } text7 = "-"; if (num70 == 1) { text7 = "+"; } Vector2 vector5 = new Vector2(24f, 24f); int num74 = 142; if (Main.mouseX > num73 && (float)Main.mouseX < (float)num73 + vector5.X && Main.mouseY > num72 + 13 && (float)Main.mouseY < (float)(num72 + 13) + vector5.Y) { if (this.focusColor != (num70 + 1) * (num71 + 10)) { Main.PlaySound(12, -1, -1, 1); } this.focusColor = (num70 + 1) * (num71 + 10); flag7 = true; num74 = 255; if (Main.mouseLeft) { if (this.colorDelay <= 1) { if (this.colorDelay == 0) { this.colorDelay = 40; } else { this.colorDelay = 3; } int num75 = (num70 != null) ? num70 : -1; if (num71 == 0) { this.bgScroll += num75; if (this.bgScroll > 100) { this.bgScroll = 100; } if (this.bgScroll < 0) { this.bgScroll = 0; } } } this.colorDelay--; } else { this.colorDelay = 0; } } for (int num76 = 0; num76 < 5; num76++) { Color color9 = Color.Black; if (num76 == 4) { color9 = color; color9.R = (byte)((255 + color9.R) / 2); color9.G = (byte)((255 + color9.R) / 2); color9.B = (byte)((255 + color9.R) / 2); } int num77 = (int)color9.R - (255 - num74); if (num77 < 0) { num77 = 0; } color9 = new Color((int)((byte)num77), (int)((byte)num77), (int)((byte)num77), (int)((byte)num74)); int num78 = 0; int num79 = 0; if (num76 == 0) { num78 = -2; } if (num76 == 1) { num78 = 2; } if (num76 == 2) { num79 = -2; } if (num76 == 3) { num79 = 2; } this.spriteBatch.DrawString(Main.fontDeathText, text7, new Vector2((float)(num73 + num78), (float)(num72 + num79)), color9, 0f, default(Vector2), scale2, SpriteEffects.None, 0f); } } } if (!flag7) { this.focusColor = 0; this.colorDelay = 0; } } if (flag2) { int num80 = 400; string text8 = ""; for (int num81 = 0; num81 < 4; num81++) { int num82 = num80; int num83 = 370 + Main.screenWidth / 2 - 400; if (num81 == 0) { text8 = Lang.menu[98]; } if (num81 == 1) { text8 = Lang.menu[99]; num82 += 30; } if (num81 == 2) { text8 = Math.Round((double)(Main.soundVolume * 100f)) + "%"; num83 += 90; } if (num81 == 3) { text8 = Math.Round((double)(Main.musicVolume * 100f)) + "%"; num83 += 90; num82 += 30; } for (int num84 = 0; num84 < 5; num84++) { Color color10 = Color.Black; if (num84 == 4) { color10 = color; color10.R = (byte)((255 + color10.R) / 2); color10.G = (byte)((255 + color10.R) / 2); color10.B = (byte)((255 + color10.R) / 2); } int num85 = 255; int num86 = (int)color10.R - (255 - num85); if (num86 < 0) { num86 = 0; } color10 = new Color((int)((byte)num86), (int)((byte)num86), (int)((byte)num86), (int)((byte)num85)); int num87 = 0; int num88 = 0; if (num84 == 0) { num87 = -2; } if (num84 == 1) { num87 = 2; } if (num84 == 2) { num88 = -2; } if (num84 == 3) { num88 = 2; } this.spriteBatch.DrawString(Main.fontDeathText, text8, new Vector2((float)(num83 + num87), (float)(num82 + num88)), color10, 0f, default(Vector2), 0.5f, SpriteEffects.None, 0f); } } bool flag8 = false; for (int num89 = 0; num89 < 2; num89++) { for (int num90 = 0; num90 < 2; num90++) { int num91 = num80 + num90 * 30 - 12; int num92 = 360 + Main.screenWidth / 2 - 400; float scale3 = 0.9f; if (num89 == 0) { num92 -= 70; num91 += 2; } else { num92 -= 40; } text8 = "-"; if (num89 == 1) { text8 = "+"; } Vector2 vector6 = new Vector2(24f, 24f); int num93 = 142; if (Main.mouseX > num92 && (float)Main.mouseX < (float)num92 + vector6.X && Main.mouseY > num91 + 13 && (float)Main.mouseY < (float)(num91 + 13) + vector6.Y) { if (this.focusColor != (num89 + 1) * (num90 + 10)) { Main.PlaySound(12, -1, -1, 1); } this.focusColor = (num89 + 1) * (num90 + 10); flag8 = true; num93 = 255; if (Main.mouseLeft) { if (this.colorDelay <= 1) { if (this.colorDelay == 0) { this.colorDelay = 40; } else { this.colorDelay = 3; } int num94 = (num89 != null) ? num89 : -1; if (num90 == 0) { Main.soundVolume += (float)num94 * 0.01f; if (Main.soundVolume > 1f) { Main.soundVolume = 1f; } if (Main.soundVolume < 0f) { Main.soundVolume = 0f; } } if (num90 == 1) { Main.musicVolume += (float)num94 * 0.01f; if (Main.musicVolume > 1f) { Main.musicVolume = 1f; } if (Main.musicVolume < 0f) { Main.musicVolume = 0f; } } } this.colorDelay--; } else { this.colorDelay = 0; } } for (int num95 = 0; num95 < 5; num95++) { Color color11 = Color.Black; if (num95 == 4) { color11 = color; color11.R = (byte)((255 + color11.R) / 2); color11.G = (byte)((255 + color11.R) / 2); color11.B = (byte)((255 + color11.R) / 2); } int num96 = (int)color11.R - (255 - num93); if (num96 < 0) { num96 = 0; } color11 = new Color((int)((byte)num96), (int)((byte)num96), (int)((byte)num96), (int)((byte)num93)); int num97 = 0; int num98 = 0; if (num95 == 0) { num97 = -2; } if (num95 == 1) { num97 = 2; } if (num95 == 2) { num98 = -2; } if (num95 == 3) { num98 = 2; } this.spriteBatch.DrawString(Main.fontDeathText, text8, new Vector2((float)(num92 + num97), (float)(num91 + num98)), color11, 0f, default(Vector2), scale3, SpriteEffects.None, 0f); } } } if (!flag8) { this.focusColor = 0; this.colorDelay = 0; } } for (int num99 = 0; num99 < 5; num99++) { Color color12 = Color.Black; if (num99 == 4) { color12 = color; if (array6[num33] == 2) { color12 = Main.hcColor; } else { if (array6[num33] == 1) { color12 = Main.mcColor; } } color12.R = (byte)((255 + color12.R) / 2); color12.G = (byte)((255 + color12.G) / 2); color12.B = (byte)((255 + color12.B) / 2); } int num100 = (int)(255f * (this.menuItemScale[num33] * 2f - 1f)); if (array[num33]) { num100 = 255; } int num101 = (int)color12.R - (255 - num100); if (num101 < 0) { num101 = 0; } int num102 = (int)color12.G - (255 - num100); if (num102 < 0) { num102 = 0; } int num103 = (int)color12.B - (255 - num100); if (num103 < 0) { num103 = 0; } color12 = new Color((int)((byte)num101), (int)((byte)num102), (int)((byte)num103), (int)((byte)num100)); if (array3[num33]) { if (num99 == 4) { color12.R = (byte)((int)(color12.R * Main.mouseTextColor) / 300); color12.G = (byte)((int)(color12.G * Main.mouseTextColor) / 300); color12.B = (byte)((int)(color12.B * Main.mouseTextColor) / 300); color12.A = (byte)((int)(color12.A * Main.mouseTextColor) / 300); } else { color12.A -= (byte)(Main.mouseTextColor / 5); } } int num104 = 0; int num105 = 0; if (num99 == 0) { num104 = -2; } if (num99 == 1) { num104 = 2; } if (num99 == 2) { num105 = -2; } if (num99 == 3) { num105 = 2; } Vector2 origin = Main.fontDeathText.MeasureString(array9[num33]); origin.X *= 0.5f; origin.Y *= 0.5f; float num106 = this.menuItemScale[num33]; if (Main.menuMode == 15 && num33 == 0) { num106 *= 0.35f; } else { if (Main.netMode == 2) { num106 *= 0.5f; } } num106 *= array7[num33]; if (!array8[num33]) { this.spriteBatch.DrawString(Main.fontDeathText, array9[num33], new Vector2((float)(num2 + num104 + array5[num33]), (float)(num + num3 * num33 + num105) + origin.Y * array7[num33] + (float)array4[num33]), color12, 0f, origin, num106, SpriteEffects.None, 0f); } else { this.spriteBatch.DrawString(Main.fontDeathText, array9[num33], new Vector2((float)(num2 + num104 + array5[num33]), (float)(num + num3 * num33 + num105) + origin.Y * array7[num33] + (float)array4[num33]), color12, 0f, new Vector2(0f, origin.Y), num106, SpriteEffects.None, 0f); } } if (!array8[num33]) { int num107 = 0; if (this.menuWide[num33]) { num107 = 14; } this.menuWide[num33] = false; if ((float)Main.mouseX > (float)num2 - (float)(array9[num33].Length * 10) * array7[num33] + (float)array5[num33] - (float)num107 && (float)Main.mouseX < (float)num2 + (float)(array9[num33].Length * 10) * array7[num33] + (float)array5[num33] + (float)num107 && Main.mouseY > num + num3 * num33 + array4[num33] && (float)Main.mouseY < (float)(num + num3 * num33 + array4[num33]) + 50f * array7[num33] && Main.hasFocus) { this.focusMenu = num33; if (array[num33] || array2[num33]) { this.focusMenu = -1; } else { if (num32 != this.focusMenu) { Main.PlaySound(12, -1, -1, 1); } if (Main.mouseLeftRelease && Main.mouseLeft) { this.selectedMenu = num33; } if (Main.mouseRightRelease && Main.mouseRight) { this.selectedMenu2 = num33; } } } } else { if (Main.mouseX > num2 + array5[num33] && (float)Main.mouseX < (float)num2 + (float)(array9[num33].Length * 20) * array7[num33] + (float)array5[num33] && Main.mouseY > num + num3 * num33 + array4[num33] && (float)Main.mouseY < (float)(num + num3 * num33 + array4[num33]) + 50f * array7[num33] && Main.hasFocus) { this.focusMenu = num33; if (array[num33] || array2[num33]) { this.focusMenu = -1; } else { if (num32 != this.focusMenu) { Main.PlaySound(12, -1, -1, 1); } if (Main.mouseLeftRelease && Main.mouseLeft) { this.selectedMenu = num33; } if (Main.mouseRightRelease && Main.mouseRight) { this.selectedMenu2 = num33; } } } } } } for (int num108 = 0; num108 < Main.maxMenuItems; num108++) { if (num108 == this.focusMenu) { if (this.menuItemScale[num108] < 1f) { this.menuItemScale[num108] += 0.02f; } if (this.menuItemScale[num108] > 1f) { this.menuItemScale[num108] = 1f; } } else { if ((double)this.menuItemScale[num108] > 0.8) { this.menuItemScale[num108] -= 0.02f; } } } if (num6 >= 0 && num6 <= Main.numLoadPlayers) { this.spriteBatch.End(); this.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise); Main.loadPlayer[num6].PlayerFrame(); Main.loadPlayer[num6].position.X = (float)num7 + Main.screenPosition.X; Main.loadPlayer[num6].position.Y = (float)num8 + Main.screenPosition.Y; this.DrawPlayer(Main.loadPlayer[num6]); this.spriteBatch.End(); this.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise); } for (int num109 = 0; num109 < 5; num109++) { Color color13 = Color.Black; if (num109 == 4) { color13 = color; color13.R = (byte)((255 + color13.R) / 2); color13.G = (byte)((255 + color13.R) / 2); color13.B = (byte)((255 + color13.R) / 2); } color13.A = (byte)((float)color13.A * 0.3f); int num110 = 0; int num111 = 0; if (num109 == 0) { num110 = -2; } if (num109 == 1) { num110 = 2; } if (num109 == 2) { num111 = -2; } if (num109 == 3) { num111 = 2; } string text9 = "Copyright © 2013 Re-Logic"; Vector2 origin2 = Main.fontMouseText.MeasureString(text9); origin2.X *= 0.5f; origin2.Y *= 0.5f; this.spriteBatch.DrawString(Main.fontMouseText, text9, new Vector2((float)Main.screenWidth - origin2.X + (float)num110 - 10f, (float)Main.screenHeight - origin2.Y + (float)num111 - 2f), color13, 0f, origin2, 1f, SpriteEffects.None, 0f); } for (int num112 = 0; num112 < 5; num112++) { Color color14 = Color.Black; if (num112 == 4) { color14 = color; color14.R = (byte)((255 + color14.R) / 2); color14.G = (byte)((255 + color14.R) / 2); color14.B = (byte)((255 + color14.R) / 2); } color14.A = (byte)((float)color14.A * 0.3f); int num113 = 0; int num114 = 0; if (num112 == 0) { num113 = -2; } if (num112 == 1) { num113 = 2; } if (num112 == 2) { num114 = -2; } if (num112 == 3) { num114 = 2; } Vector2 origin3 = Main.fontMouseText.MeasureString(Main.versionNumber); origin3.X *= 0.5f; origin3.Y *= 0.5f; this.spriteBatch.DrawString(Main.fontMouseText, Main.versionNumber, new Vector2(origin3.X + (float)num113 + 10f, (float)Main.screenHeight - origin3.Y + (float)num114 - 2f), color14, 0f, origin3, 1f, SpriteEffects.None, 0f); } this.spriteBatch.Draw(Main.cursorTexture, new Vector2((float)(Main.mouseX + 1), (float)(Main.mouseY + 1)), new Rectangle?(new Rectangle(0, 0, Main.cursorTexture.Width, Main.cursorTexture.Height)), new Color((int)((float)Main.cursorColor.R * 0.2f), (int)((float)Main.cursorColor.G * 0.2f), (int)((float)Main.cursorColor.B * 0.2f), (int)((float)Main.cursorColor.A * 0.5f)), 0f, default(Vector2), Main.cursorScale * 1.1f, SpriteEffects.None, 0f); this.spriteBatch.Draw(Main.cursorTexture, new Vector2((float)Main.mouseX, (float)Main.mouseY), new Rectangle?(new Rectangle(0, 0, Main.cursorTexture.Width, Main.cursorTexture.Height)), Main.cursorColor, 0f, default(Vector2), Main.cursorScale, SpriteEffects.None, 0f); if (Main.fadeCounter > 0) { Color white = Color.White; Main.fadeCounter--; float num115 = (float)Main.fadeCounter / 75f * 255f; byte b2 = (byte)num115; white = new Color((int)b2, (int)b2, (int)b2, (int)b2); this.spriteBatch.Draw(Main.fadeTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), white); } this.spriteBatch.End(); if (Main.mouseLeft) { Main.mouseLeftRelease = false; } else { Main.mouseLeftRelease = true; } if (Main.mouseRight) { Main.mouseRightRelease = false; return; } Main.mouseRightRelease = true; } public static void CursorColor() { Main.cursorAlpha += (float)Main.cursorColorDirection * 0.015f; if (Main.cursorAlpha >= 1f) { Main.cursorAlpha = 1f; Main.cursorColorDirection = -1; } if ((double)Main.cursorAlpha <= 0.6) { Main.cursorAlpha = 0.6f; Main.cursorColorDirection = 1; } float num = Main.cursorAlpha * 0.3f + 0.7f; byte r = (byte)((float)Main.mouseColor.R * Main.cursorAlpha); byte g = (byte)((float)Main.mouseColor.G * Main.cursorAlpha); byte b = (byte)((float)Main.mouseColor.B * Main.cursorAlpha); byte b2 = (byte)(255f * num); Main.cursorColor = new Color((int)r, (int)g, (int)b, (int)b2); Main.cursorScale = Main.cursorAlpha * 0.3f + 0.7f + 0.1f; } protected void DrawSplash(GameTime gameTime) { base.GraphicsDevice.Clear(Color.Black); base.Draw(gameTime); this.spriteBatch.Begin(); this.splashCounter++; Color white = Color.White; byte b = 0; if (this.splashCounter <= 75) { float num = (float)this.splashCounter / 75f * 255f; b = (byte)num; } else { if (this.splashCounter <= 125) { b = 255; } else { if (this.splashCounter <= 200) { int num2 = 125 - this.splashCounter; float num3 = (float)num2 / 75f * 255f; b = (byte)num3; } else { Main.showSplash = false; Main.fadeCounter = 75; } } } white = new Color((int)b, (int)b, (int)b, (int)b); this.spriteBatch.Draw(Main.loTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), white); this.spriteBatch.End(); } protected void DrawBackground() { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); int num = (int)(255f * (1f - Main.gfxQuality) + 140f * Main.gfxQuality); int num2 = (int)(200f * (1f - Main.gfxQuality) + 40f * Main.gfxQuality); int num3 = 128; Vector2 value = new Vector2((float)Main.offScreenRange, (float)Main.offScreenRange); if (Main.drawToScreen) { value = default(Vector2); } float num4 = 0.9f; float num5 = num4; float num6 = num4; float num7 = num4; float num8 = 0f; if (Main.bloodTiles > Main.evilTiles && Main.bloodTiles > Main.holyTiles) { num8 = (float)Main.bloodTiles / 800f; } else { if (Main.holyTiles > Main.evilTiles) { num8 = (float)Main.holyTiles / 800f; } else { if (Main.evilTiles > Main.holyTiles) { num8 = (float)Main.evilTiles / 800f; } } } if (num8 > 1f) { num8 = 1f; } if (num8 < 0f) { num8 = 0f; } float num9 = (float)((double)Main.screenPosition.Y - Main.worldSurface * 16.0) / 300f; if (num9 < 0f) { num9 = 0f; } else { if (num9 > 1f) { num9 = 1f; } } float num10 = 1f * (1f - num9) + num5 * num9; Lighting.brightness = Lighting.defBrightness * (1f - num9) + 1f * num9; float num11 = (float)((double)(Main.screenPosition.Y - (float)(Main.screenHeight / 2) + 200f) - Main.rockLayer * 16.0) / 300f; if (num11 < 0f) { num11 = 0f; } else { if (num11 > 1f) { num11 = 1f; } } if (Main.bloodTiles > Main.evilTiles && Main.bloodTiles > Main.holyTiles) { num5 = 1f * num8 + num5 * (1f - num8); num6 = 0.55f * num8 + num6 * (1f - num8); num7 = 0.5f * num8 + num7 * (1f - num8); } else { if (Main.evilTiles > 0) { num5 = 0.8f * num8 + num5 * (1f - num8); num6 = 0.75f * num8 + num6 * (1f - num8); num7 = 1.1f * num8 + num7 * (1f - num8); } else { if (Main.holyTiles > 0) { num5 = 1f * num8 + num5 * (1f - num8); num6 = 0.7f * num8 + num6 * (1f - num8); num7 = 0.9f * num8 + num7 * (1f - num8); } } } num5 = 1f * (num10 - num11) + num5 * num11; num6 = 1f * (num10 - num11) + num6 * num11; num7 = 1f * (num10 - num11) + num7 * num11; int num12 = (int)((Main.screenPosition.X + (float)(Main.screenWidth / 2)) / 16f); int num13; if (num12 <= Main.caveBackX[0]) { num13 = Main.caveBackStyle[0]; } else { if (num12 <= Main.treeX[1]) { num13 = Main.caveBackStyle[1]; } else { if (num12 <= Main.treeX[2]) { num13 = Main.caveBackStyle[2]; } else { num13 = Main.caveBackStyle[3]; } } } num13 += 3; if (Main.snowTiles > 300 && (Main.screenPosition.Y + (float)Main.screenHeight) / 16f < (float)(Main.maxTilesY - 250)) { num13 = 1; } if (Main.jungleTiles > 80) { if (num13 == 1) { if (Main.jungleTiles > Main.snowTiles) { num13 = 11; } } else { num13 = 11; } } if (Main.shroomTiles > 200) { num13 = 2; } if (num13 != Main.ugBack) { Main.oldUgBack = Main.ugBack; Main.ugBack = num13; Main.ugBackTransition = 1f; } if (Main.ugBackTransition > 0f) { Main.ugBackTransition -= 0.25f; } if (Main.ugBackTransition < 0f) { Main.ugBackTransition = 0f; } int[] array = new int[6]; int[] array2 = new int[6]; for (int i = 0; i < 2; i++) { int num14 = Main.ugBack; if (i == 1) { num14 = Main.oldUgBack; } int[] array3 = new int[6]; if (num14 == 0) { array3[0] = 1; array3[1] = 2; array3[2] = 4; array3[3] = 3; array3[4] = 6; array3[5] = 5; } else { if (num14 == 1) { if (Main.iceBackStyle == 0) { array3[1] = 33; array3[3] = 32; array3[0] = 40; array3[2] = 34; } else { if (Main.iceBackStyle == 1) { array3[1] = 118; array3[3] = 117; array3[0] = 160; array3[2] = 161; } else { if (Main.iceBackStyle == 2) { array3[1] = 165; array3[3] = 167; array3[0] = 164; array3[2] = 166; } else { array3[1] = 120; array3[3] = 119; array3[0] = 162; array3[2] = 163; } } } array3[4] = array3[3]; } else { if (num14 == 2) { array3[0] = 62; array3[1] = 63; array3[2] = 64; array3[3] = 65; array3[4] = 143 + Main.hellBackStyle; } else { if (num14 == 3) { array3[0] = 66; array3[1] = 67; array3[2] = 68; array3[3] = 69; array3[4] = 128 + Main.hellBackStyle; } else { if (num14 == 4) { array3[0] = 70; array3[1] = 71; array3[2] = 68; array3[3] = 72; array3[4] = 128 + Main.hellBackStyle; } else { if (num14 == 5) { array3[0] = 73; array3[1] = 74; array3[2] = 75; array3[3] = 76; array3[4] = 131 + Main.hellBackStyle; } else { if (num14 == 6) { array3[0] = 77; array3[1] = 78; array3[2] = 79; array3[3] = 80; array3[4] = 134 + Main.hellBackStyle; } else { if (num14 == 7) { array3[0] = 77; array3[1] = 81; array3[2] = 79; array3[3] = 82; array3[4] = 134 + Main.hellBackStyle; } else { if (num14 == 8) { array3[0] = 83; array3[1] = 84; array3[2] = 85; array3[3] = 86; array3[4] = 137 + Main.hellBackStyle; } else { if (num14 == 9) { array3[0] = 83; array3[1] = 87; array3[2] = 88; array3[3] = 89; array3[4] = 137 + Main.hellBackStyle; } else { if (num14 == 10) { array3[0] = 121; array3[1] = 122; array3[2] = 123; array3[3] = 124; array3[4] = 140 + Main.hellBackStyle; } else { if (num14 == 11) { if (Main.jungleBackStyle == 0) { array3[0] = 153; array3[1] = 147; array3[2] = 148; array3[3] = 149; array3[4] = 150 + Main.hellBackStyle; } else { array3[0] = 146; array3[1] = 154; array3[2] = 155; array3[3] = 156; array3[4] = 157 + Main.hellBackStyle; } } } } } } } } } } } } } if (Main.hellBackStyle == 0) { array3[5] = 125; } if (Main.hellBackStyle == 1) { array3[5] = 126; } if (Main.hellBackStyle == 2) { array3[5] = 127; } this.LoadBackground(array3[0]); this.LoadBackground(array3[1]); this.LoadBackground(array3[2]); this.LoadBackground(array3[3]); this.LoadBackground(array3[4]); this.LoadBackground(array3[5]); if (i == 0) { for (int j = 0; j < 6; j++) { array[j] = array3[j]; } } else { for (int k = 0; k < 6; k++) { array2[k] = array3[k]; } } } Lighting.defBrightness = 1.2f * (1f - num11) + 1f * num11; this.bgParrallax = (double)Main.caveParrallax; this.bgStart = (int)(-Math.IEEERemainder((double)num3 + (double)Main.screenPosition.X * this.bgParrallax, (double)num3) - (double)(num3 / 2)) - (int)value.X; this.bgLoops = Main.screenWidth / num3 + 2; this.bgTop = (int)((float)((int)Main.worldSurface * 16 - 16) - Main.screenPosition.Y + 16f); for (int l = 0; l < this.bgLoops; l++) { for (int m = 0; m < num3 / 16; m++) { float num15 = (float)this.bgStart + Main.screenPosition.X; num15 = -(float)Math.IEEERemainder((double)num15, 16.0); num15 = (float)Math.Round((double)num15); int num16 = (int)num15; if (num16 == -8) { num16 = 8; } float num17 = (float)(this.bgStart + num3 * l + m * 16 + 8); float num18 = (float)this.bgTop; Color color = Lighting.GetColor((int)((num17 + Main.screenPosition.X) / 16f), (int)((Main.screenPosition.Y + num18) / 16f)); color.R = (byte)((float)color.R * num5); color.G = (byte)((float)color.G * num6); color.B = (byte)((float)color.B * num7); this.spriteBatch.Draw(Main.backgroundTexture[array[0]], new Vector2((float)(this.bgStart + num3 * l + 16 * m + num16), (float)this.bgTop) + value, new Rectangle?(new Rectangle(16 * m + num16 + 16, 0, 16, 16)), color); if (Main.ugBackTransition > 0f) { Color color2 = color; color2.R = (byte)((float)color2.R * Main.ugBackTransition); color2.G = (byte)((float)color2.G * Main.ugBackTransition); color2.B = (byte)((float)color2.B * Main.ugBackTransition); color2.A = (byte)((float)color2.A * Main.ugBackTransition); this.spriteBatch.Draw(Main.backgroundTexture[array2[0]], new Vector2((float)(this.bgStart + num3 * l + 16 * m + num16), (float)this.bgTop) + value, new Rectangle?(new Rectangle(16 * m + num16 + 16, 0, 16, 16)), color2); } } } double num19 = (double)(Main.maxTilesY - 230); double num20 = (double)((int)((num19 - Main.worldSurface) / 6.0) * 6); num19 = Main.worldSurface + num20 - 5.0; bool flag = false; bool flag2 = false; this.bgTop = (int)((float)((int)Main.worldSurface * 16) - Main.screenPosition.Y + 16f); if (Main.worldSurface * 16.0 <= (double)(Main.screenPosition.Y + (float)Main.screenHeight + (float)Main.offScreenRange)) { this.bgParrallax = (double)Main.caveParrallax; this.bgStart = (int)(-Math.IEEERemainder((double)num3 + (double)Main.screenPosition.X * this.bgParrallax, (double)num3) - (double)(num3 / 2)) - (int)value.X; this.bgLoops = (Main.screenWidth + (int)value.X * 2) / num3 + 2; if (Main.worldSurface * 16.0 < (double)(Main.screenPosition.Y - 16f)) { this.bgStartY = (int)(Math.IEEERemainder((double)this.bgTop, (double)Main.backgroundHeight[2]) - (double)Main.backgroundHeight[2]); this.bgLoopsY = (Main.screenHeight - this.bgStartY + (int)value.Y * 2) / Main.backgroundHeight[2] + 1; } else { this.bgStartY = this.bgTop; this.bgLoopsY = (Main.screenHeight - this.bgTop + (int)value.Y * 2) / Main.backgroundHeight[2] + 1; } if (Main.rockLayer * 16.0 < (double)(Main.screenPosition.Y + 600f)) { this.bgLoopsY = (int)(Main.rockLayer * 16.0 - (double)Main.screenPosition.Y + 600.0 - (double)this.bgStartY) / Main.backgroundHeight[2]; flag2 = true; } float num21 = (float)this.bgStart + Main.screenPosition.X; num21 = -(float)Math.IEEERemainder((double)num21, 16.0); num21 = (float)Math.Round((double)num21); int num22 = (int)num21; if (num22 == -8) { num22 = 8; } for (int n = 0; n < this.bgLoops; n++) { for (int num23 = 0; num23 < this.bgLoopsY; num23++) { for (int num24 = 0; num24 < num3 / 16; num24++) { for (int num25 = 0; num25 < 6; num25++) { float num26 = (float)(this.bgStartY + num23 * 96 + num25 * 16 + 8); float num27 = (float)(this.bgStart + num3 * n + num24 * 16 + 8); int num28 = (int)((num27 + Main.screenPosition.X) / 16f); int num29 = (int)((num26 + Main.screenPosition.Y) / 16f); Color color3 = Lighting.GetColor(num28, num29); if (Main.tile[num28, num29] == null) { Main.tile[num28, num29] = new Tile(); } if (color3.R > 0 || color3.G > 0 || color3.B > 0) { if (((int)color3.R > num || (double)color3.G > (double)num * 1.1 || (double)color3.B > (double)num * 1.2) && !Main.tile[num28, num29].active() && Main.wallLight[(int)Main.tile[num28, num29].wall] && Main.ugBackTransition == 0f) { try { for (int num30 = 0; num30 < 9; num30++) { int num31 = 0; int num32 = 0; int width = 4; int height = 4; Color color4 = color3; Color color5 = color3; if (num30 == 0 && !Main.tile[num28 - 1, num29 - 1].active()) { color5 = Lighting.GetColor(num28 - 1, num29 - 1); } if (num30 == 1) { width = 8; num31 = 4; if (!Main.tile[num28, num29 - 1].active()) { color5 = Lighting.GetColor(num28, num29 - 1); } } if (num30 == 2) { if (!Main.tile[num28 + 1, num29 - 1].active()) { color5 = Lighting.GetColor(num28 + 1, num29 - 1); } if (Main.tile[num28 + 1, num29 - 1] == null) { Main.tile[num28 + 1, num29 - 1] = new Tile(); } num31 = 12; } if (num30 == 3) { if (!Main.tile[num28 - 1, num29].active()) { color5 = Lighting.GetColor(num28 - 1, num29); } height = 8; num32 = 4; } if (num30 == 4) { width = 8; height = 8; num31 = 4; num32 = 4; } if (num30 == 5) { num31 = 12; num32 = 4; height = 8; if (!Main.tile[num28 + 1, num29].active()) { color5 = Lighting.GetColor(num28 + 1, num29); } } if (num30 == 6) { if (!Main.tile[num28 - 1, num29 + 1].active()) { color5 = Lighting.GetColor(num28 - 1, num29 + 1); } num32 = 12; } if (num30 == 7) { width = 8; height = 4; num31 = 4; num32 = 12; if (!Main.tile[num28, num29 + 1].active()) { color5 = Lighting.GetColor(num28, num29 + 1); } } if (num30 == 8) { if (!Main.tile[num28 + 1, num29 + 1].active()) { color5 = Lighting.GetColor(num28 + 1, num29 + 1); } num31 = 12; num32 = 12; } color4.R = (byte)((color3.R + color5.R) / 2); color4.G = (byte)((color3.G + color5.G) / 2); color4.B = (byte)((color3.B + color5.B) / 2); color4.R = (byte)((float)color4.R * num5); color4.G = (byte)((float)color4.G * num6); color4.B = (byte)((float)color4.B * num7); this.spriteBatch.Draw(Main.backgroundTexture[array[1]], new Vector2((float)(this.bgStart + num3 * n + 16 * num24 + num31 + num22), (float)(this.bgStartY + Main.backgroundHeight[array[1]] * num23 + 16 * num25 + num32)) + value, new Rectangle?(new Rectangle(16 * num24 + num31 + num22 + 16, 16 * num25 + num32, width, height)), color4); if (Main.ugBackTransition > 0f) { Color color6 = color4; color6.R = (byte)((float)color6.R * Main.ugBackTransition); color6.G = (byte)((float)color6.G * Main.ugBackTransition); color6.B = (byte)((float)color6.B * Main.ugBackTransition); color6.A = (byte)((float)color6.A * Main.ugBackTransition); this.spriteBatch.Draw(Main.backgroundTexture[array2[1]], new Vector2((float)(this.bgStart + num3 * n + 16 * num24 + num31 + num22), (float)(this.bgStartY + Main.backgroundHeight[array2[1]] * num23 + 16 * num25 + num32)) + value, new Rectangle?(new Rectangle(16 * num24 + num31 + num22 + 16, 16 * num25 + num32, width, height)), color6); } } goto IL_181F; } catch { color3.R = (byte)((float)color3.R * num5); color3.G = (byte)((float)color3.G * num6); color3.B = (byte)((float)color3.B * num7); this.spriteBatch.Draw(Main.backgroundTexture[array[1]], new Vector2((float)(this.bgStart + num3 * n + 16 * num24 + num22), (float)(this.bgStartY + Main.backgroundHeight[array[1]] * num23 + 16 * num25)) + value, new Rectangle?(new Rectangle(16 * num24 + num22 + 16, 16 * num25, 16, 16)), color3); goto IL_181F; } } if (((int)color3.R > num2 || (double)color3.G > (double)num2 * 1.1 || (double)color3.B > (double)num2 * 1.2) && Main.ugBackTransition == 0f) { for (int num33 = 0; num33 < 4; num33++) { int num34 = 0; int num35 = 0; Color color7 = color3; Color color8 = color3; if (num33 == 0) { if (Lighting.Brighter(num28, num29 - 1, num28 - 1, num29)) { color8 = Lighting.GetColor(num28 - 1, num29); } else { color8 = Lighting.GetColor(num28, num29 - 1); } } if (num33 == 1) { if (Lighting.Brighter(num28, num29 - 1, num28 + 1, num29)) { color8 = Lighting.GetColor(num28 + 1, num29); } else { color8 = Lighting.GetColor(num28, num29 - 1); } num34 = 8; } if (num33 == 2) { if (Lighting.Brighter(num28, num29 + 1, num28 - 1, num29)) { color8 = Lighting.GetColor(num28 - 1, num29); } else { color8 = Lighting.GetColor(num28, num29 + 1); } num35 = 8; } if (num33 == 3) { if (Lighting.Brighter(num28, num29 + 1, num28 + 1, num29)) { color8 = Lighting.GetColor(num28 + 1, num29); } else { color8 = Lighting.GetColor(num28, num29 + 1); } num34 = 8; num35 = 8; } color7.R = (byte)((color3.R + color8.R) / 2); color7.G = (byte)((color3.G + color8.G) / 2); color7.B = (byte)((color3.B + color8.B) / 2); color7.R = (byte)((float)color7.R * num5); color7.G = (byte)((float)color7.G * num6); color7.B = (byte)((float)color7.B * num7); this.spriteBatch.Draw(Main.backgroundTexture[array[1]], new Vector2((float)(this.bgStart + num3 * n + 16 * num24 + num34 + num22), (float)(this.bgStartY + Main.backgroundHeight[array[1]] * num23 + 16 * num25 + num35)) + value, new Rectangle?(new Rectangle(16 * num24 + num34 + num22 + 16, 16 * num25 + num35, 8, 8)), color7); if (Main.ugBackTransition > 0f) { Color color9 = color7; color9.R = (byte)((float)color9.R * Main.ugBackTransition); color9.G = (byte)((float)color9.G * Main.ugBackTransition); color9.B = (byte)((float)color9.B * Main.ugBackTransition); color9.A = (byte)((float)color9.A * Main.ugBackTransition); this.spriteBatch.Draw(Main.backgroundTexture[array2[1]], new Vector2((float)(this.bgStart + num3 * n + 16 * num24 + num34 + num22), (float)(this.bgStartY + Main.backgroundHeight[array2[1]] * num23 + 16 * num25 + num35)) + value, new Rectangle?(new Rectangle(16 * num24 + num34 + num22 + 16, 16 * num25 + num35, 8, 8)), color9); } } } else { color3.R = (byte)((float)color3.R * num5); color3.G = (byte)((float)color3.G * num6); color3.B = (byte)((float)color3.B * num7); this.spriteBatch.Draw(Main.backgroundTexture[array[1]], new Vector2((float)(this.bgStart + num3 * n + 16 * num24 + num22), (float)(this.bgStartY + Main.backgroundHeight[array[1]] * num23 + 16 * num25)) + value, new Rectangle?(new Rectangle(16 * num24 + num22 + 16, 16 * num25, 16, 16)), color3); if (Main.ugBackTransition > 0f) { Color color10 = color3; color10.R = (byte)((float)color10.R * Main.ugBackTransition); color10.G = (byte)((float)color10.G * Main.ugBackTransition); color10.B = (byte)((float)color10.B * Main.ugBackTransition); color10.A = (byte)((float)color10.A * Main.ugBackTransition); this.spriteBatch.Draw(Main.backgroundTexture[array2[1]], new Vector2((float)(this.bgStart + num3 * n + 16 * num24 + num22), (float)(this.bgStartY + Main.backgroundHeight[array2[1]] * num23 + 16 * num25)) + value, new Rectangle?(new Rectangle(16 * num24 + num22 + 16, 16 * num25, 16, 16)), color10); } } } else { color3.R = (byte)((float)color3.R * num5); color3.G = (byte)((float)color3.G * num6); color3.B = (byte)((float)color3.B * num7); this.spriteBatch.Draw(Main.backgroundTexture[array[1]], new Vector2((float)(this.bgStart + num3 * n + 16 * num24 + num22), (float)(this.bgStartY + Main.backgroundHeight[array[1]] * num23 + 16 * num25)) + value, new Rectangle?(new Rectangle(16 * num24 + num22 + 16, 16 * num25, 16, 16)), color3); } IL_181F:; } } } } if (flag2) { this.bgParrallax = (double)Main.caveParrallax; this.bgStart = (int)(-Math.IEEERemainder((double)num3 + (double)Main.screenPosition.X * this.bgParrallax, (double)num3) - (double)(num3 / 2)) - (int)value.X; this.bgLoops = (Main.screenWidth + (int)value.X * 2) / num3 + 2; this.bgTop = this.bgStartY + this.bgLoopsY * Main.backgroundHeight[2]; if (this.bgTop > -32) { for (int num36 = 0; num36 < this.bgLoops; num36++) { for (int num37 = 0; num37 < num3 / 16; num37++) { float num38 = (float)(this.bgStart + num3 * num36 + num37 * 16 + 8); float num39 = (float)this.bgTop; Color color11 = Lighting.GetColor((int)((num38 + Main.screenPosition.X) / 16f), (int)((Main.screenPosition.Y + num39) / 16f)); color11.R = (byte)((float)color11.R * num5); color11.G = (byte)((float)color11.G * num6); color11.B = (byte)((float)color11.B * num7); this.spriteBatch.Draw(Main.backgroundTexture[array[2]], new Vector2((float)(this.bgStart + num3 * num36 + 16 * num37 + num22), (float)this.bgTop) + value, new Rectangle?(new Rectangle(16 * num37 + num22 + 16, 0, 16, 16)), color11); if (Main.ugBackTransition > 0f) { Color color12 = color11; color12.R = (byte)((float)color12.R * Main.ugBackTransition); color12.G = (byte)((float)color12.G * Main.ugBackTransition); color12.B = (byte)((float)color12.B * Main.ugBackTransition); color12.A = (byte)((float)color12.A * Main.ugBackTransition); this.spriteBatch.Draw(Main.backgroundTexture[array2[2]], new Vector2((float)(this.bgStart + num3 * num36 + 16 * num37 + num22), (float)this.bgTop) + value, new Rectangle?(new Rectangle(16 * num37 + num22 + 16, 0, 16, 16)), color12); } } } } } } this.bgTop = (int)((float)((int)Main.rockLayer * 16) - Main.screenPosition.Y + 16f + 600f - 8f); if (Main.rockLayer * 16.0 <= (double)(Main.screenPosition.Y + 600f)) { this.bgParrallax = (double)Main.caveParrallax; this.bgStart = (int)(-Math.IEEERemainder((double)num3 + (double)Main.screenPosition.X * this.bgParrallax, (double)num3) - (double)(num3 / 2)) - (int)value.X; this.bgLoops = (Main.screenWidth + (int)value.X * 2) / num3 + 2; if (Main.rockLayer * 16.0 + (double)Main.screenHeight < (double)(Main.screenPosition.Y - 16f)) { this.bgStartY = (int)(Math.IEEERemainder((double)this.bgTop, (double)Main.backgroundHeight[3]) - (double)Main.backgroundHeight[3]); this.bgLoopsY = (Main.screenHeight - this.bgStartY + (int)value.Y * 2) / Main.backgroundHeight[2] + 1; } else { this.bgStartY = this.bgTop; this.bgLoopsY = (Main.screenHeight - this.bgTop + (int)value.Y * 2) / Main.backgroundHeight[2] + 1; } if (num19 * 16.0 < (double)(Main.screenPosition.Y + 600f)) { this.bgLoopsY = (int)(num19 * 16.0 - (double)Main.screenPosition.Y + 600.0 - (double)this.bgStartY) / Main.backgroundHeight[2]; flag = true; } float num40 = (float)this.bgStart + Main.screenPosition.X; num40 = -(float)Math.IEEERemainder((double)num40, 16.0); num40 = (float)Math.Round((double)num40); int num41 = (int)num40; if (num41 == -8) { num41 = 8; } for (int num42 = 0; num42 < this.bgLoops; num42++) { for (int num43 = 0; num43 < this.bgLoopsY; num43++) { for (int num44 = 0; num44 < num3 / 16; num44++) { for (int num45 = 0; num45 < 6; num45++) { float num46 = (float)(this.bgStartY + num43 * 96 + num45 * 16 + 8); float num47 = (float)(this.bgStart + num3 * num42 + num44 * 16 + 8); int num48 = (int)((num47 + Main.screenPosition.X) / 16f); int num49 = (int)((num46 + Main.screenPosition.Y) / 16f); Color color13 = Lighting.GetColor(num48, num49); if (Main.tile[num48, num49] == null) { Main.tile[num48, num49] = new Tile(); } bool flag3 = false; if (Main.caveParrallax != 0f) { if (Main.tile[num48 - 1, num49] == null) { Main.tile[num48 - 1, num49] = new Tile(); } if (Main.tile[num48 + 1, num49] == null) { Main.tile[num48 + 1, num49] = new Tile(); } if (Main.wallLight[(int)Main.tile[num48, num49].wall] || Main.wallLight[(int)Main.tile[num48 - 1, num49].wall] || Main.wallLight[(int)Main.tile[num48 + 1, num49].wall]) { flag3 = true; } } else { if (Main.wallLight[(int)Main.tile[num48, num49].wall]) { flag3 = true; } } if ((flag3 || color13.R == 0 || color13.G == 0 || color13.B == 0) && (color13.R > 0 || color13.G > 0 || color13.B > 0) && (Main.wallLight[(int)Main.tile[num48, num49].wall] || Main.caveParrallax != 0f)) { if (Lighting.lightMode < 2 && color13.R < 230 && color13.G < 230 && color13.B < 230 && Main.ugBackTransition == 0f) { if (((int)color13.R > num || (double)color13.G > (double)num * 1.1 || (double)color13.B > (double)num * 1.2) && !Main.tile[num48, num49].active()) { for (int num50 = 0; num50 < 9; num50++) { int num51 = 0; int num52 = 0; int width2 = 4; int height2 = 4; Color color14 = color13; Color color15 = color13; if (num50 == 0 && !Main.tile[num48 - 1, num49 - 1].active()) { color15 = Lighting.GetColor(num48 - 1, num49 - 1); } if (num50 == 1) { width2 = 8; num51 = 4; if (!Main.tile[num48, num49 - 1].active()) { color15 = Lighting.GetColor(num48, num49 - 1); } } if (num50 == 2) { if (!Main.tile[num48 + 1, num49 - 1].active()) { color15 = Lighting.GetColor(num48 + 1, num49 - 1); } num51 = 12; } if (num50 == 3) { if (!Main.tile[num48 - 1, num49].active()) { color15 = Lighting.GetColor(num48 - 1, num49); } height2 = 8; num52 = 4; } if (num50 == 4) { width2 = 8; height2 = 8; num51 = 4; num52 = 4; } if (num50 == 5) { num51 = 12; num52 = 4; height2 = 8; if (!Main.tile[num48 + 1, num49].active()) { color15 = Lighting.GetColor(num48 + 1, num49); } } if (num50 == 6) { if (!Main.tile[num48 - 1, num49 + 1].active()) { color15 = Lighting.GetColor(num48 - 1, num49 + 1); } num52 = 12; } if (num50 == 7) { width2 = 8; height2 = 4; num51 = 4; num52 = 12; if (!Main.tile[num48, num49 + 1].active()) { color15 = Lighting.GetColor(num48, num49 + 1); } } if (num50 == 8) { if (!Main.tile[num48 + 1, num49 + 1].active()) { color15 = Lighting.GetColor(num48 + 1, num49 + 1); } num51 = 12; num52 = 12; } color14.R = (byte)((color13.R + color15.R) / 2); color14.G = (byte)((color13.G + color15.G) / 2); color14.B = (byte)((color13.B + color15.B) / 2); color14.R = (byte)((float)color14.R * num5); color14.G = (byte)((float)color14.G * num6); color14.B = (byte)((float)color14.B * num7); this.spriteBatch.Draw(Main.backgroundTexture[array[3]], new Vector2((float)(this.bgStart + num3 * num42 + 16 * num44 + num51 + num41), (float)(this.bgStartY + Main.backgroundHeight[array[3]] * num43 + 16 * num45 + num52)) + value, new Rectangle?(new Rectangle(16 * num44 + num51 + num41 + 16, 16 * num45 + num52, width2, height2)), color14); if (Main.ugBackTransition > 0f) { Color color16 = color14; color16.R = (byte)((float)color16.R * Main.ugBackTransition); color16.G = (byte)((float)color16.G * Main.ugBackTransition); color16.B = (byte)((float)color16.B * Main.ugBackTransition); color16.A = (byte)((float)color16.A * Main.ugBackTransition); this.spriteBatch.Draw(Main.backgroundTexture[array2[3]], new Vector2((float)(this.bgStart + num3 * num42 + 16 * num44 + num51 + num41), (float)(this.bgStartY + Main.backgroundHeight[array2[3]] * num43 + 16 * num45 + num52)) + value, new Rectangle?(new Rectangle(16 * num44 + num51 + num41 + 16, 16 * num45 + num52, width2, height2)), color16); } } } else { if ((int)color13.R > num2 || (double)color13.G > (double)num2 * 1.1 || (double)color13.B > (double)num2 * 1.2) { for (int num53 = 0; num53 < 4; num53++) { int num54 = 0; int num55 = 0; Color color17 = color13; Color color18 = color13; if (num53 == 0) { if (Lighting.Brighter(num48, num49 - 1, num48 - 1, num49)) { color18 = Lighting.GetColor(num48 - 1, num49); } else { color18 = Lighting.GetColor(num48, num49 - 1); } } if (num53 == 1) { if (Lighting.Brighter(num48, num49 - 1, num48 + 1, num49)) { color18 = Lighting.GetColor(num48 + 1, num49); } else { color18 = Lighting.GetColor(num48, num49 - 1); } num54 = 8; } if (num53 == 2) { if (Lighting.Brighter(num48, num49 + 1, num48 - 1, num49)) { color18 = Lighting.GetColor(num48 - 1, num49); } else { color18 = Lighting.GetColor(num48, num49 + 1); } num55 = 8; } if (num53 == 3) { if (Lighting.Brighter(num48, num49 + 1, num48 + 1, num49)) { color18 = Lighting.GetColor(num48 + 1, num49); } else { color18 = Lighting.GetColor(num48, num49 + 1); } num54 = 8; num55 = 8; } color17.R = (byte)((color13.R + color18.R) / 2); color17.G = (byte)((color13.G + color18.G) / 2); color17.B = (byte)((color13.B + color18.B) / 2); color17.R = (byte)((float)color17.R * num5); color17.G = (byte)((float)color17.G * num6); color17.B = (byte)((float)color17.B * num7); this.spriteBatch.Draw(Main.backgroundTexture[array[3]], new Vector2((float)(this.bgStart + num3 * num42 + 16 * num44 + num54 + num41), (float)(this.bgStartY + Main.backgroundHeight[array[3]] * num43 + 16 * num45 + num55)) + value, new Rectangle?(new Rectangle(16 * num44 + num54 + num41 + 16, 16 * num45 + num55, 8, 8)), color17); if (Main.ugBackTransition > 0f) { Color color19 = color17; color19.R = (byte)((float)color19.R * Main.ugBackTransition); color19.G = (byte)((float)color19.G * Main.ugBackTransition); color19.B = (byte)((float)color19.B * Main.ugBackTransition); color19.A = (byte)((float)color19.A * Main.ugBackTransition); this.spriteBatch.Draw(Main.backgroundTexture[array2[3]], new Vector2((float)(this.bgStart + num3 * num42 + 16 * num44 + num54 + num41), (float)(this.bgStartY + Main.backgroundHeight[array2[3]] * num43 + 16 * num45 + num55)) + value, new Rectangle?(new Rectangle(16 * num44 + num54 + num41 + 16, 16 * num45 + num55, 8, 8)), color19); } } } else { color13.R = (byte)((float)color13.R * num5); color13.G = (byte)((float)color13.G * num6); color13.B = (byte)((float)color13.B * num7); this.spriteBatch.Draw(Main.backgroundTexture[array[3]], new Vector2((float)(this.bgStart + num3 * num42 + 16 * num44 + num41), (float)(this.bgStartY + Main.backgroundHeight[array[3]] * num43 + 16 * num45)) + value, new Rectangle?(new Rectangle(16 * num44 + num41 + 16, 16 * num45, 16, 16)), color13); if (Main.ugBackTransition > 0f) { Color color20 = color13; color20.R = (byte)((float)color20.R * Main.ugBackTransition); color20.G = (byte)((float)color20.G * Main.ugBackTransition); color20.B = (byte)((float)color20.B * Main.ugBackTransition); color20.A = (byte)((float)color20.A * Main.ugBackTransition); this.spriteBatch.Draw(Main.backgroundTexture[array2[3]], new Vector2((float)(this.bgStart + num3 * num42 + 16 * num44 + num41), (float)(this.bgStartY + Main.backgroundHeight[array2[3]] * num43 + 16 * num45)) + value, new Rectangle?(new Rectangle(16 * num44 + num41 + 16, 16 * num45, 16, 16)), color20); } } } } else { color13.R = (byte)((float)color13.R * num5); color13.G = (byte)((float)color13.G * num6); color13.B = (byte)((float)color13.B * num7); this.spriteBatch.Draw(Main.backgroundTexture[array[3]], new Vector2((float)(this.bgStart + num3 * num42 + 16 * num44 + num41), (float)(this.bgStartY + Main.backgroundHeight[array[3]] * num43 + 16 * num45)) + value, new Rectangle?(new Rectangle(16 * num44 + num41 + 16, 16 * num45, 16, 16)), color13); if (Main.ugBackTransition > 0f) { Color color21 = color13; color21.R = (byte)((float)color21.R * Main.ugBackTransition); color21.G = (byte)((float)color21.G * Main.ugBackTransition); color21.B = (byte)((float)color21.B * Main.ugBackTransition); color21.A = (byte)((float)color21.A * Main.ugBackTransition); this.spriteBatch.Draw(Main.backgroundTexture[array2[3]], new Vector2((float)(this.bgStart + num3 * num42 + 16 * num44 + num41), (float)(this.bgStartY + Main.backgroundHeight[array2[3]] * num43 + 16 * num45)) + value, new Rectangle?(new Rectangle(16 * num44 + num41 + 16, 16 * num45, 16, 16)), color21); } } } } } } } num3 = 128; if (flag) { this.bgParrallax = (double)Main.caveParrallax; this.bgStart = (int)(-Math.IEEERemainder((double)num3 + (double)Main.screenPosition.X * this.bgParrallax, (double)num3) - (double)(num3 / 2)) - (int)value.X; this.bgLoops = (Main.screenWidth + (int)value.X * 2) / num3 + 2; this.bgTop = this.bgStartY + this.bgLoopsY * Main.backgroundHeight[2]; for (int num56 = 0; num56 < this.bgLoops; num56++) { for (int num57 = 0; num57 < num3 / 16; num57++) { float num58 = (float)(this.bgStart + num3 * num56 + num57 * 16 + 8); float num59 = (float)this.bgTop; Color color22 = Lighting.GetColor((int)((num58 + Main.screenPosition.X) / 16f), (int)((Main.screenPosition.Y + num59) / 16f)); color22.R = (byte)((float)color22.R * num5); color22.G = (byte)((float)color22.G * num6); color22.B = (byte)((float)color22.B * num7); this.spriteBatch.Draw(Main.backgroundTexture[array[4]], new Vector2((float)(this.bgStart + num3 * num56 + 16 * num57 + num41), (float)this.bgTop) + value, new Rectangle?(new Rectangle(16 * num57 + num41 + 16, Main.magmaBGFrame * 16, 16, 16)), color22); if (Main.ugBackTransition > 0f) { Color color23 = color22; color23.R = (byte)((float)color23.R * Main.ugBackTransition); color23.G = (byte)((float)color23.G * Main.ugBackTransition); color23.B = (byte)((float)color23.B * Main.ugBackTransition); color23.A = (byte)((float)color23.A * Main.ugBackTransition); this.spriteBatch.Draw(Main.backgroundTexture[array2[4]], new Vector2((float)(this.bgStart + num3 * num56 + 16 * num57 + num41), (float)this.bgTop) + value, new Rectangle?(new Rectangle(16 * num57 + num41 + 16, Main.magmaBGFrame * 16, 16, 16)), color23); } } } } } this.bgTop = (int)((float)((int)num19 * 16) - Main.screenPosition.Y + 16f + 600f) - 8; if (num19 * 16.0 <= (double)(Main.screenPosition.Y + 600f)) { this.bgStart = (int)(-Math.IEEERemainder((double)num3 + (double)Main.screenPosition.X * this.bgParrallax, (double)num3) - (double)(num3 / 2)) - (int)value.X; this.bgLoops = (Main.screenWidth + (int)value.X * 2) / num3 + 2; if (num19 * 16.0 + (double)Main.screenHeight < (double)(Main.screenPosition.Y - 16f)) { this.bgStartY = (int)(Math.IEEERemainder((double)this.bgTop, (double)Main.backgroundHeight[2]) - (double)Main.backgroundHeight[2]); this.bgLoopsY = (Main.screenHeight - this.bgStartY + (int)value.Y * 2) / Main.backgroundHeight[2] + 1; } else { this.bgStartY = this.bgTop; this.bgLoopsY = (Main.screenHeight - this.bgTop + (int)value.Y * 2) / Main.backgroundHeight[2] + 1; } num = (int)((double)num * 1.5); num2 = (int)((double)num2 * 1.5); float num60 = (float)this.bgStart + Main.screenPosition.X; num60 = -(float)Math.IEEERemainder((double)num60, 16.0); num60 = (float)Math.Round((double)num60); int num61 = (int)num60; if (num61 == -8) { num61 = 8; } for (int num62 = 0; num62 < this.bgLoops; num62++) { for (int num63 = 0; num63 < this.bgLoopsY; num63++) { for (int num64 = 0; num64 < num3 / 16; num64++) { for (int num65 = 0; num65 < 6; num65++) { float num66 = (float)(this.bgStartY + num63 * 96 + num65 * 16 + 8); float num67 = (float)(this.bgStart + num3 * num62 + num64 * 16 + 8); int num68 = (int)((num67 + Main.screenPosition.X) / 16f); int num69 = (int)((num66 + Main.screenPosition.Y) / 16f); Color color24 = Lighting.GetColor(num68, num69); if (Main.tile[num68, num69] == null) { Main.tile[num68, num69] = new Tile(); } bool flag4 = false; if (Main.caveParrallax != 0f) { if (Main.tile[num68 - 1, num69] == null) { Main.tile[num68 - 1, num69] = new Tile(); } if (Main.tile[num68 + 1, num69] == null) { Main.tile[num68 + 1, num69] = new Tile(); } if (Main.wallLight[(int)Main.tile[num68, num69].wall] || Main.wallLight[(int)Main.tile[num68 - 1, num69].wall] || Main.wallLight[(int)Main.tile[num68 + 1, num69].wall]) { flag4 = true; } } else { if (Main.wallLight[(int)Main.tile[num68, num69].wall]) { flag4 = true; } } if ((flag4 || color24.R == 0 || color24.G == 0 || color24.B == 0) && (color24.R > 0 || color24.G > 0 || color24.B > 0) && (Main.wallLight[(int)Main.tile[num68, num69].wall] || Main.caveParrallax != 0f)) { if (Lighting.lightMode < 2 && color24.R < 230 && color24.G < 230 && color24.B < 230) { if (((int)color24.R > num || (double)color24.G > (double)num * 1.1 || (double)color24.B > (double)num * 1.2) && !Main.tile[num68, num69].active()) { for (int num70 = 0; num70 < 9; num70++) { int num71 = 0; int num72 = 0; int width3 = 4; int height3 = 4; Color color25 = color24; Color color26 = color24; if (num70 == 0 && !Main.tile[num68 - 1, num69 - 1].active()) { color26 = Lighting.GetColor(num68 - 1, num69 - 1); } if (num70 == 1) { width3 = 8; num71 = 4; if (!Main.tile[num68, num69 - 1].active()) { color26 = Lighting.GetColor(num68, num69 - 1); } } if (num70 == 2) { if (!Main.tile[num68 + 1, num69 - 1].active()) { color26 = Lighting.GetColor(num68 + 1, num69 - 1); } num71 = 12; } if (num70 == 3) { if (!Main.tile[num68 - 1, num69].active()) { color26 = Lighting.GetColor(num68 - 1, num69); } height3 = 8; num72 = 4; } if (num70 == 4) { width3 = 8; height3 = 8; num71 = 4; num72 = 4; } if (num70 == 5) { num71 = 12; num72 = 4; height3 = 8; if (!Main.tile[num68 + 1, num69].active()) { color26 = Lighting.GetColor(num68 + 1, num69); } } if (num70 == 6) { if (!Main.tile[num68 - 1, num69 + 1].active()) { color26 = Lighting.GetColor(num68 - 1, num69 + 1); } num72 = 12; } if (num70 == 7) { width3 = 8; height3 = 4; num71 = 4; num72 = 12; if (!Main.tile[num68, num69 + 1].active()) { color26 = Lighting.GetColor(num68, num69 + 1); } } if (num70 == 8) { if (!Main.tile[num68 + 1, num69 + 1].active()) { color26 = Lighting.GetColor(num68 + 1, num69 + 1); } num71 = 12; num72 = 12; } color25.R = (byte)((color24.R + color26.R) / 2); color25.G = (byte)((color24.G + color26.G) / 2); color25.B = (byte)((color24.B + color26.B) / 2); color25.R = (byte)((float)color25.R * num5); color25.G = (byte)((float)color25.G * num6); color25.B = (byte)((float)color25.B * num7); this.spriteBatch.Draw(Main.backgroundTexture[array[5]], new Vector2((float)(this.bgStart + num3 * num62 + 16 * num64 + num71 + num61), (float)(this.bgStartY + Main.backgroundHeight[2] * num63 + 16 * num65 + num72)) + value, new Rectangle?(new Rectangle(16 * num64 + num71 + num61 + 16, 16 * num65 + Main.backgroundHeight[2] * Main.magmaBGFrame + num72, width3, height3)), color25, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } else { if ((int)color24.R > num2 || (double)color24.G > (double)num2 * 1.1 || (double)color24.B > (double)num2 * 1.2) { for (int num73 = 0; num73 < 4; num73++) { int num74 = 0; int num75 = 0; Color color27 = color24; Color color28 = color24; if (num73 == 0) { if (Lighting.Brighter(num68, num69 - 1, num68 - 1, num69)) { color28 = Lighting.GetColor(num68 - 1, num69); } else { color28 = Lighting.GetColor(num68, num69 - 1); } } if (num73 == 1) { if (Lighting.Brighter(num68, num69 - 1, num68 + 1, num69)) { color28 = Lighting.GetColor(num68 + 1, num69); } else { color28 = Lighting.GetColor(num68, num69 - 1); } num74 = 8; } if (num73 == 2) { if (Lighting.Brighter(num68, num69 + 1, num68 - 1, num69)) { color28 = Lighting.GetColor(num68 - 1, num69); } else { color28 = Lighting.GetColor(num68, num69 + 1); } num75 = 8; } if (num73 == 3) { if (Lighting.Brighter(num68, num69 + 1, num68 + 1, num69)) { color28 = Lighting.GetColor(num68 + 1, num69); } else { color28 = Lighting.GetColor(num68, num69 + 1); } num74 = 8; num75 = 8; } color27.R = (byte)((color24.R + color28.R) / 2); color27.G = (byte)((color24.G + color28.G) / 2); color27.B = (byte)((color24.B + color28.B) / 2); color27.R = (byte)((float)color27.R * num5); color27.G = (byte)((float)color27.G * num6); color27.B = (byte)((float)color27.B * num7); this.spriteBatch.Draw(Main.backgroundTexture[array[5]], new Vector2((float)(this.bgStart + num3 * num62 + 16 * num64 + num74 + num61), (float)(this.bgStartY + Main.backgroundHeight[2] * num63 + 16 * num65 + num75)) + value, new Rectangle?(new Rectangle(16 * num64 + num74 + num61 + 16, 16 * num65 + Main.backgroundHeight[2] * Main.magmaBGFrame + num75, 8, 8)), color27, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } else { color24.R = (byte)((float)color24.R * num5); color24.G = (byte)((float)color24.G * num6); color24.B = (byte)((float)color24.B * num7); this.spriteBatch.Draw(Main.backgroundTexture[array[5]], new Vector2((float)(this.bgStart + num3 * num62 + 16 * num64 + num61), (float)(this.bgStartY + Main.backgroundHeight[2] * num63 + 16 * num65)) + value, new Rectangle?(new Rectangle(16 * num64 + num61 + 16, 16 * num65 + Main.backgroundHeight[2] * Main.magmaBGFrame, 16, 16)), color24, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } } else { color24.R = (byte)((float)color24.R * num5); color24.G = (byte)((float)color24.G * num6); color24.B = (byte)((float)color24.B * num7); this.spriteBatch.Draw(Main.backgroundTexture[array[5]], new Vector2((float)(this.bgStart + num3 * num62 + 16 * num64 + num61), (float)(this.bgStartY + Main.backgroundHeight[2] * num63 + 16 * num65)) + value, new Rectangle?(new Rectangle(16 * num64 + num61 + 16, 16 * num65 + Main.backgroundHeight[2] * Main.magmaBGFrame, 16, 16)), color24, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } } } } } } Lighting.brightness = Lighting.defBrightness; Main.renderTimer[3] = (float)stopwatch.ElapsedMilliseconds; } protected void RenderBackground() { if (Main.drawToScreen) { return; } base.GraphicsDevice.SetRenderTarget(this.backWaterTarget); base.GraphicsDevice.Clear(new Color(0, 0, 0, 0)); this.spriteBatch.Begin(); try { this.drawWaters(true); } catch { } this.spriteBatch.End(); base.GraphicsDevice.SetRenderTarget(null); base.GraphicsDevice.SetRenderTarget(this.backgroundTarget); base.GraphicsDevice.Clear(new Color(0, 0, 0, 0)); this.spriteBatch.Begin(); if (Main.ignoreErrors) { try { this.DrawBackground(); goto IL_A3; } catch { goto IL_A3; } } this.DrawBackground(); IL_A3: this.spriteBatch.End(); base.GraphicsDevice.SetRenderTarget(null); } protected void DrawToMap() { if (!Main.mapEnabled) { return; } int num = Main.maxTilesX / Main.textureMax; int num2 = Main.maxTilesY / Main.textureMax; for (int i = 0; i <= num; i++) { for (int j = 0; j <= num2; j++) { if (!this.checkMap(i, j)) { return; } } } if (Main.clearMap) { int num3 = Main.maxTilesX / Main.textureMax; int num4 = Main.maxTilesY / Main.textureMax; for (int k = 0; k <= num3; k++) { for (int l = 0; l <= num4; l++) { base.GraphicsDevice.SetRenderTarget(this.mapTarget[k, l]); base.GraphicsDevice.Clear(new Color(0, 0, 0, 0)); base.GraphicsDevice.SetRenderTarget(null); } } Main.clearMap = false; } int num5 = -1; int num6 = -1; bool flag = false; int num7 = 0; Main.mapUnfinished = false; int num8 = Main.mapMinY; int num9 = Main.mapMinY; int num10 = Main.mapMaxY; int num11 = Main.mapMaxY; int num12 = 1; if (Main.mapMinY / Main.textureMax != Main.mapMaxY / Main.textureMax) { num10 = Main.textureMax; num9 = Main.textureMax; num12 = 2; } for (int m = 0; m < num12; m++) { if (m == 0) { Main.mapMinY = num8; Main.mapMaxY = num10; } else { if (m == 1) { Main.mapMinY = num9; Main.mapMaxY = num11; } } for (int n = Main.mapMinX; n < Main.mapMaxX; n++) { for (int num13 = Main.mapMinY; num13 < Main.mapMaxY; num13++) { if (Main.map[n, num13] != null && Main.map[n, num13].changed()) { num7++; if (num7 < Main.maxMapUpdates) { if (Main.loadMap) { Main.loadMapLastX = n; } Main.map[n, num13].changed(false); int num14 = n / Main.textureMax; int num15 = num13 / Main.textureMax; if (num14 != num5 || num15 != num6) { num5 = num14; num6 = num15; if (flag) { this.spriteBatch.End(); base.GraphicsDevice.SetRenderTarget(null); } flag = true; base.GraphicsDevice.SetRenderTarget(this.mapTarget[num14, num15]); this.spriteBatch.Begin(); } int num16 = n - num14 * Main.textureMax; int num17 = num13 - num15 * Main.textureMax; Color color = Main.map[n, num13].getColor(num13); int num18 = 1; int num19 = 1; int num20 = num13 + 1; while (num20 < Main.mapMaxY && Main.map[n, num20] != null && Main.map[n, num20].changed() && Main.map[n, num13].isTheSameAs(Main.map[n, num20], num13, num20) && num20 / Main.textureMax == num15) { Main.map[n, num20].changed(false); num18++; num20++; num13++; } if (num20 == num13 + 1) { num20 = n + 1; while (num20 < Main.mapMaxX && Main.map[num20, num13] != null && Main.map[num20, num13].changed() && Main.map[n, num13].isTheSameAs(Main.map[num20, num13], num13, num13) && num20 / Main.textureMax == num14) { Main.map[num20, num13].changed(false); num19++; num20++; } } this.spriteBatch.Draw(Main.magicPixel, new Vector2((float)num16, (float)num17), new Rectangle?(new Rectangle(0, 0, num19, num18)), color, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } else { Main.mapUnfinished = true; } } } } } for (int num21 = 0; num21 < Map.numUpdateTile; num21++) { int num22 = (int)Map.updateTileX[num21]; int num23 = (int)Map.updateTileY[num21]; if (Main.map[num22, num23] != null && Main.map[num22, num23].changed()) { Main.map[num22, num23].changed(false); int num24 = num22 / Main.textureMax; int num25 = num23 / Main.textureMax; if (num24 != num5 || num25 != num6) { num5 = num24; num6 = num25; if (flag) { this.spriteBatch.End(); base.GraphicsDevice.SetRenderTarget(null); } flag = true; base.GraphicsDevice.SetRenderTarget(this.mapTarget[num24, num25]); this.spriteBatch.Begin(); } int num26 = num22 - num24 * Main.textureMax; int num27 = num23 - num25 * Main.textureMax; Color color2 = Main.map[num22, num23].getColor(num23); this.spriteBatch.Draw(Main.magicPixel, new Vector2((float)num26, (float)num27), new Rectangle?(new Rectangle(0, 0, 1, 1)), color2, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } Map.numUpdateTile = 0; if (flag) { this.spriteBatch.End(); base.GraphicsDevice.SetRenderTarget(null); } Main.mapReady = true; if (!Main.mapUnfinished) { Main.loadMapLastX = 0; Main.loadMap = false; Main.loadMapLock = false; } } protected void DrawMap() { string cursorText = ""; if (!Main.mapEnabled) { return; } if (!Main.mapReady) { return; } float num = 0f; float num2 = 0f; float num3 = num; float num4 = num2; byte b = 255; int arg_40_0 = Main.maxTilesX / Main.textureMax; int num5 = Main.maxTilesY / Main.textureMax; float num6 = (float)Lighting.offScreenTiles; float num7 = (float)Lighting.offScreenTiles; float num8 = (float)(Main.maxTilesX - Lighting.offScreenTiles - 1); float num9 = (float)(Main.maxTilesY - Lighting.offScreenTiles - 42); float num10 = 0f; float num11 = 0f; num6 = 10f; num7 = 10f; num8 = (float)(Main.maxTilesX - 10); num9 = (float)(Main.maxTilesY - 10); num = 200f; num2 = 300f; float num12 = 0f; float num13 = 0f; float num14 = num8 - 1f; float num15 = num9 - 1f; float num16; if (Main.mapFullscreen) { num16 = Main.mapFullscreenScale; } else { if (Main.mapStyle == 1) { num16 = Main.mapMinimapScale; } else { num16 = Main.mapOverlayScale; } } bool flag = false; if (!Main.mapFullscreen && num16 > 1f) { this.spriteBatch.End(); this.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise); flag = true; } if (Main.mapFullscreen) { if (Main.mouseLeft && base.IsActive) { if (Main.mouseLeftRelease) { Main.grabMapX = (float)Main.mouseX; Main.grabMapY = (float)Main.mouseY; } else { float num17 = (float)Main.mouseX - Main.grabMapX; float num18 = (float)Main.mouseY - Main.grabMapY; Main.grabMapX = (float)Main.mouseX; Main.grabMapY = (float)Main.mouseY; num17 *= 0.06255f; num18 *= 0.06255f; Main.mapFullscreenPos.X = Main.mapFullscreenPos.X - num17 * (16f / Main.mapFullscreenScale); Main.mapFullscreenPos.Y = Main.mapFullscreenPos.Y - num18 * (16f / Main.mapFullscreenScale); } } Main.player[Main.myPlayer].mouseInterface = true; float num19 = (float)Main.screenWidth / (float)Main.maxTilesX * 0.8f; if (Main.mapFullscreenScale < num19) { Main.mapFullscreenScale = num19; } if (Main.mapFullscreenScale > 16f) { Main.mapFullscreenScale = 16f; } num16 = Main.mapFullscreenScale; b = 255; if (Main.mapFullscreenPos.X < num6) { Main.mapFullscreenPos.X = num6; } if (Main.mapFullscreenPos.X > num8) { Main.mapFullscreenPos.X = num8; } if (Main.mapFullscreenPos.Y < num7) { Main.mapFullscreenPos.Y = num7; } if (Main.mapFullscreenPos.Y > num9) { Main.mapFullscreenPos.Y = num9; } float num20 = Main.mapFullscreenPos.X; float num21 = Main.mapFullscreenPos.Y; if (Main.resetMapFull) { Main.resetMapFull = false; num20 = (Main.screenPosition.X + (float)(Main.screenWidth / 2)) / 16f; num21 = (Main.screenPosition.Y + (float)(Main.screenHeight / 2)) / 16f; Main.mapFullscreenPos.X = num20; Main.mapFullscreenPos.Y = num21; } num20 *= num16; num21 *= num16; num = -num20 + (float)(Main.screenWidth / 2); num2 = -num21 + (float)(Main.screenHeight / 2); num += num6 * num16; num2 += num7 * num16; float num22 = (float)(Main.maxTilesX / 840); num22 *= Main.mapFullscreenScale; float num23 = num; float num24 = num2; float num25 = (float)this.mapTexture.Width; float num26 = (float)this.mapTexture.Height; if (Main.maxTilesX == 8400) { num22 *= 0.999f; num23 -= 40.6f * num22; num24 = num2 - 5f * num22; num25 -= 8.045f; num25 *= num22; num26 += 0.12f; num26 *= num22; if ((double)num22 < 1.2) { num26 += 1f; } } else { if (Main.maxTilesX == 6400) { num22 *= 1.09f; num23 -= 38.8f * num22; num24 = num2 - 3.85f * num22; num25 -= 13.6f; num25 *= num22; num26 -= 6.92f; num26 *= num22; if ((double)num22 < 1.2) { num26 += 2f; } } else { if (Main.maxTilesX == 6300) { num22 *= 1.09f; num23 -= 39.8f * num22; num24 = num2 - 4.08f * num22; num25 -= 26.69f; num25 *= num22; num26 -= 6.92f; num26 *= num22; if ((double)num22 < 1.2) { num26 += 2f; } } else { if (Main.maxTilesX == 4200) { num22 *= 0.998f; num23 -= 37.3f * num22; num24 -= 1.7f * num22; num25 -= 16f; num25 *= num22; num26 -= 8.31f; num26 *= num22; } } } } this.spriteBatch.End(); this.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.PointClamp, DepthStencilState.None, RasterizerState.CullCounterClockwise); flag = true; if (Main.screenPosition.Y > (float)((Main.maxTilesY - 232) * 16)) { this.spriteBatch.Draw(this.mapBG3Texture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.White); } else { if (Main.player[Main.myPlayer].zoneDungeon) { this.spriteBatch.Draw(this.mapBG5Texture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.White); } else { if ((double)Main.screenPosition.Y > Main.worldSurface * 16.0) { if (Main.player[Main.myPlayer].zoneSnow) { this.spriteBatch.Draw(this.mapBG4Texture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.White); } else { this.spriteBatch.Draw(this.mapBG2Texture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Color.White); } } else { int num27 = (int)((Main.screenPosition.X + (float)(Main.screenWidth / 2)) / 16f); if (Main.player[Main.myPlayer].zoneEvil) { this.spriteBatch.Draw(this.mapBG6Texture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Main.bgColor); } else { if (Main.player[Main.myPlayer].zoneBlood) { this.spriteBatch.Draw(this.mapBG7Texture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Main.bgColor); } else { if (Main.player[Main.myPlayer].zoneHoly) { this.spriteBatch.Draw(this.mapBG8Texture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Main.bgColor); } else { if ((double)(Main.screenPosition.Y / 16f) < Main.worldSurface + 10.0 && (num27 < 380 || num27 > Main.maxTilesX - 380)) { this.spriteBatch.Draw(this.mapBG11Texture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Main.bgColor); } else { if (Main.player[Main.myPlayer].zoneSnow) { this.spriteBatch.Draw(this.mapBG12Texture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Main.bgColor); } else { if (Main.player[Main.myPlayer].zoneJungle) { this.spriteBatch.Draw(this.mapBG9Texture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Main.bgColor); } else { if (Main.sandTiles > 1000) { this.spriteBatch.Draw(this.mapBG10Texture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Main.bgColor); } else { this.spriteBatch.Draw(this.mapBG1Texture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), Main.bgColor); } } } } } } } } } } Rectangle destinationRectangle = new Rectangle((int)num23, (int)num24, (int)num25, (int)num26); this.spriteBatch.Draw(this.mapTexture, destinationRectangle, Color.White); if (num16 < 1f) { this.spriteBatch.End(); this.spriteBatch.Begin(); flag = false; } } else { if (Main.mapStyle == 1) { Main.miniMapWidth = 240; Main.miniMapHeight = 240; Main.miniMapX = Main.screenWidth - Main.miniMapWidth - 52; Main.miniMapY = 90; float arg_938_0 = (float)Main.miniMapHeight / (float)Main.maxTilesY; if ((double)Main.mapMinimapScale < 0.2) { Main.mapMinimapScale = 0.2f; } if (Main.mapMinimapScale > 3f) { Main.mapMinimapScale = 3f; } if ((double)Main.mapMinimapAlpha < 0.01) { Main.mapMinimapAlpha = 0.01f; } if (Main.mapMinimapAlpha > 1f) { Main.mapMinimapAlpha = 1f; } num16 = Main.mapMinimapScale; b = (byte)(255f * Main.mapMinimapAlpha); num = (float)Main.miniMapX; num2 = (float)Main.miniMapY; num3 = num; num4 = num2; float num28 = (Main.screenPosition.X + (float)(Main.screenWidth / 2)) / 16f; float num29 = (Main.screenPosition.Y + (float)(Main.screenHeight / 2)) / 16f; num10 = -(num28 - (float)((int)((Main.screenPosition.X + (float)(Main.screenWidth / 2)) / 16f))) * num16; num11 = -(num29 - (float)((int)((Main.screenPosition.Y + (float)(Main.screenHeight / 2)) / 16f))) * num16; num14 = (float)Main.miniMapWidth / num16; num15 = (float)Main.miniMapHeight / num16; num12 = (float)((int)num28) - num14 / 2f; num13 = (float)((int)num29) - num15 / 2f; float num30 = (float)Main.maxTilesY + num13; num30 *= num16; float x = num3 - 6f; float y = num4 - 6f; this.spriteBatch.Draw(Main.miniMapFrame2Texture, new Vector2(x, y), new Rectangle?(new Rectangle(0, 0, Main.miniMapFrame2Texture.Width, Main.miniMapFrame2Texture.Height)), new Color((int)b, (int)b, (int)b, (int)b), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } else { if (Main.mapStyle == 2) { float num31 = (float)Main.screenWidth / (float)Main.maxTilesX; if (Main.mapOverlayScale < num31) { Main.mapOverlayScale = num31; } if (Main.mapOverlayScale > 16f) { Main.mapOverlayScale = 16f; } if ((double)Main.mapOverlayAlpha < 0.01) { Main.mapOverlayAlpha = 0.01f; } if (Main.mapOverlayAlpha > 1f) { Main.mapOverlayAlpha = 1f; } num16 = Main.mapOverlayScale; b = (byte)(255f * Main.mapOverlayAlpha); int arg_B8A_0 = Main.maxTilesX; int arg_B90_0 = Main.maxTilesY; float num32 = (Main.screenPosition.X + (float)(Main.screenWidth / 2)) / 16f; float num33 = (Main.screenPosition.Y + (float)(Main.screenHeight / 2)) / 16f; num32 *= num16; num33 *= num16; num = -num32 + (float)(Main.screenWidth / 2); num2 = -num33 + (float)(Main.screenHeight / 2); num += num6 * num16; num2 += num7 * num16; } } } if (Main.mapStyle == 1 && !Main.mapFullscreen) { if (num12 < num6) { num -= (num12 - num6) * num16; } if (num13 < num7) { num2 -= (num13 - num7) * num16; } } num14 = num12 + num14; num15 = num13 + num15; if (num12 > num6) { num6 = num12; } if (num13 > num7) { num7 = num13; } if (num14 < num8) { num8 = num14; } if (num15 < num9) { num9 = num15; } float num34 = (float)Main.textureMax * num16; float num35 = num; float num36 = 0f; for (int i = 0; i <= 4; i++) { if ((float)((i + 1) * Main.textureMax) > num6 && (float)(i * Main.textureMax) < num6 + num8) { for (int j = 0; j <= num5; j++) { if ((float)((j + 1) * Main.textureMax) > num7 && (float)(j * Main.textureMax) < num7 + num9) { float num37 = num + (float)((int)((float)i * num34)); float num38 = num2 + (float)((int)((float)j * num34)); float num39 = (float)(i * Main.textureMax); float num40 = (float)(j * Main.textureMax); float num41 = 0f; float num42 = 0f; if (num39 < num6) { num41 = num6 - num39; } else { num37 -= num6 * num16; } if (num40 < num7) { num42 = num7 - num40; num38 = num2; } else { num38 -= num7 * num16; } num37 = num35; float num43 = (float)Main.textureMax; float num44 = (float)Main.textureMax; float num45 = (float)((i + 1) * Main.textureMax); float num46 = (float)((j + 1) * Main.textureMax); if (num45 >= num8) { num43 -= num45 - num8; } if (num46 >= num9) { num44 -= num46 - num9; } num37 += num10; num38 += num11; if (num43 > num41) { if (this.mapTarget[i, j].IsContentLost) { Main.refreshMap = true; Main.clearMap = true; } this.spriteBatch.Draw(this.mapTarget[i, j], new Vector2(num37, num38), new Rectangle?(new Rectangle((int)num41, (int)num42, (int)num43 - (int)num41, (int)num44 - (int)num42)), new Color((int)b, (int)b, (int)b, (int)b), 0f, default(Vector2), num16, SpriteEffects.None, 0f); } num36 = (float)((int)num43 - (int)num41) * num16; } if (j == num5) { num35 += num36; } } } } if (flag) { this.spriteBatch.End(); this.spriteBatch.Begin(); } if (!Main.mapFullscreen) { if (Main.mapStyle == 2) { float num47 = (num16 * 0.2f * 2f + 1f) / 3f; if (num47 > 1f) { num47 = 1f; } if (num16 < 10f) { for (int k = 0; k < 200; k++) { if (Main.npc[k].active && Main.npc[k].townNPC) { int num48 = NPC.TypeToNum(Main.npc[k].type); if (num48 > 0) { SpriteEffects effects = SpriteEffects.None; if (Main.npc[k].direction > 0) { effects = SpriteEffects.FlipHorizontally; } float num49 = (Main.npc[k].position.X + (float)(Main.npc[k].width / 2)) / 16f * num16; float num50 = (Main.npc[k].position.Y + (float)(Main.npc[k].height / 2)) / 16f * num16; num49 += num; num50 += num2; num49 -= 10f * num16; num50 -= 10f * num16; this.spriteBatch.Draw(Main.npcHeadTexture[num48], new Vector2(num49, num50), new Rectangle?(new Rectangle(0, 0, Main.npcHeadTexture[num48].Width, Main.npcHeadTexture[num48].Height)), new Color((int)b, (int)b, (int)b, (int)b), 0f, new Vector2((float)(Main.npcHeadTexture[num48].Width / 2), (float)(Main.npcHeadTexture[num48].Height / 2)), num47, effects, 0f); } } } this.spriteBatch.End(); this.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); for (int l = 0; l < 255; l++) { if (Main.player[l].active && !Main.player[l].dead && l != Main.myPlayer && ((!Main.player[Main.myPlayer].hostile && !Main.player[l].hostile) || Main.player[Main.myPlayer].team == Main.player[l].team)) { float num51 = (Main.player[l].position.X + (float)(Main.player[l].width / 2)) / 16f * num16; float num52 = Main.player[l].position.Y / 16f * num16; num51 += num; num52 += num2; num51 -= 6f; num52 -= 2f; num52 -= 2f - num16 / 5f * 2f; num51 -= 10f * num16; num52 -= 10f * num16; this.DrawPlayerHead(Main.player[l], num51, num52, (float)b / 255f, num47); } } this.spriteBatch.End(); this.spriteBatch.Begin(); } } if (Main.mapStyle == 1) { float num53 = num3 - 6f; float num54 = num4 - 6f; float num55 = (num16 * 0.25f * 2f + 1f) / 3f; if (num55 > 1f) { num55 = 1f; } for (int m = 0; m < 200; m++) { if (Main.npc[m].active && Main.npc[m].townNPC) { int num56 = NPC.TypeToNum(Main.npc[m].type); if (num56 > 0) { SpriteEffects effects2 = SpriteEffects.None; if (Main.npc[m].direction > 0) { effects2 = SpriteEffects.FlipHorizontally; } float num57 = ((Main.npc[m].position.X + (float)(Main.npc[m].width / 2)) / 16f - num12) * num16; float num58 = ((Main.npc[m].position.Y + Main.npc[m].gfxOffY + (float)(Main.npc[m].height / 2)) / 16f - num13) * num16; num57 += num3; num58 += num4; num58 -= 2f * num16 / 5f; if (num57 > (float)(Main.miniMapX + 12) && num57 < (float)(Main.miniMapX + Main.miniMapWidth - 16) && num58 > (float)(Main.miniMapY + 10) && num58 < (float)(Main.miniMapY + Main.miniMapHeight - 14)) { this.spriteBatch.Draw(Main.npcHeadTexture[num56], new Vector2(num57 + num10, num58 + num11), new Rectangle?(new Rectangle(0, 0, Main.npcHeadTexture[num56].Width, Main.npcHeadTexture[num56].Height)), new Color((int)b, (int)b, (int)b, (int)b), 0f, new Vector2((float)(Main.npcHeadTexture[num56].Width / 2), (float)(Main.npcHeadTexture[num56].Height / 2)), num55, effects2, 0f); float num59 = num57 - (float)(Main.npcHeadTexture[num56].Width / 2) * num55; float num60 = num58 - (float)(Main.npcHeadTexture[num56].Height / 2) * num55; float num61 = num59 + (float)Main.npcHeadTexture[num56].Width * num55; float num62 = num60 + (float)Main.npcHeadTexture[num56].Height * num55; if ((float)Main.mouseX >= num59 && (float)Main.mouseX <= num61 && (float)Main.mouseY >= num60 && (float)Main.mouseY <= num62) { string text; if (num56 == 11) { text = Main.npc[m].displayName; } else { text = Main.npc[m].displayName + " the " + Main.npc[m].name; } cursorText = text; } } } } } this.spriteBatch.End(); this.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); for (int n = 0; n < 255; n++) { if (Main.player[n].active && !Main.player[n].dead && ((!Main.player[Main.myPlayer].hostile && !Main.player[n].hostile) || Main.player[Main.myPlayer].team == Main.player[n].team)) { float num63 = ((Main.player[n].position.X + (float)(Main.player[n].width / 2)) / 16f - num12) * num16; float num64 = ((Main.player[n].position.Y + Main.player[n].gfxOffY + (float)(Main.player[n].height / 2)) / 16f - num13) * num16; num63 += num3; num64 += num4; num63 -= 6f; num64 -= 6f; num64 -= 2f - num16 / 5f * 2f; num63 += num10; num64 += num11; if (n == Main.myPlayer && Main.zoomX == 0f && Main.zoomY == 0f) { num63 = num3 + (float)(Main.miniMapWidth / 2); num64 = num4 + (float)(Main.miniMapHeight / 2); num64 -= 3f; num63 -= 4f; } if (num63 > (float)(Main.miniMapX + 6) && num63 < (float)(Main.miniMapX + Main.miniMapWidth - 16) && num64 > (float)(Main.miniMapY + 6) && num64 < (float)(Main.miniMapY + Main.miniMapHeight - 14)) { this.DrawPlayerHead(Main.player[n], num63, num64, (float)b / 255f, num55); if (n != Main.myPlayer) { float num65 = num63 + 4f - 14f * num55; float num66 = num64 + 2f - 14f * num55; float num67 = num65 + 28f * num55; float num68 = num66 + 28f * num55; if ((float)Main.mouseX >= num65 && (float)Main.mouseX <= num67 && (float)Main.mouseY >= num66 && (float)Main.mouseY <= num68) { cursorText = Main.player[n].name; } } } } } this.spriteBatch.End(); this.spriteBatch.Begin(); this.spriteBatch.Draw(Main.miniMapFrameTexture, new Vector2(num53, num54), new Rectangle?(new Rectangle(0, 0, Main.miniMapFrameTexture.Width, Main.miniMapFrameTexture.Height)), Color.White, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); for (int num69 = 0; num69 < 3; num69++) { float num70 = num53 + 148f + (float)(num69 * 26); float num71 = num54 + 234f; if ((float)Main.mouseX > num70 && (float)Main.mouseX < num70 + 22f && (float)Main.mouseY > num71 && (float)Main.mouseY < num71 + 22f) { Main.player[Main.myPlayer].mouseInterface = true; this.spriteBatch.Draw(Main.miniMapButtonTexture[num69], new Vector2(num70, num71), new Rectangle?(new Rectangle(0, 0, Main.miniMapButtonTexture[num69].Width, Main.miniMapButtonTexture[num69].Height)), Color.White, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); if (Main.mouseLeft) { if (Main.mouseLeftRelease) { Main.PlaySound(12, -1, -1, 1); } if (num69 == 0) { Main.mapMinimapScale = 1.25f; } else { if (num69 == 1) { Main.mapMinimapScale *= 0.975f; } else { if (num69 == 2) { Main.mapMinimapScale *= 1.025f; } } } } } } } } if (Main.mapFullscreen) { int num72 = (int)((-num + (float)Main.mouseX) / num16 + num6); int num73 = (int)((-num2 + (float)Main.mouseY) / num16 + num7); bool flag2 = false; if ((float)num72 < num6) { flag2 = true; } if ((float)num72 >= num8) { flag2 = true; } if ((float)num73 < num7) { flag2 = true; } if ((float)num73 >= num9) { flag2 = true; } if (!flag2 && Main.map[num72, num73] != null && Main.map[num72, num73].active()) { int type = (int)Main.map[num72, num73].type; if (type == 105) { if (Main.map[num72, num73].option() == 2) { cursorText = "Vase"; } else { cursorText = Main.tileName[type]; } } else { if (type == 240) { if (Main.map[num72, num73].option() == 0) { cursorText = "Trophy"; } else { if (Main.map[num72, num73].option() == 2) { cursorText = Main.npcName[21]; } else { cursorText = Main.tileName[type]; } } } else { if (type == 241) { if (Main.map[num72, num73].option() == 0) { cursorText = Main.itemName[1417]; } else { cursorText = Main.tileName[type]; } } else { if (Main.tileName[type] != null && Main.tileName[type] != "") { cursorText = Main.tileName[type]; } else { if (type == 178) { if (Main.map[num72, num73].option() == 0) { cursorText = Main.itemName[181]; } if (Main.map[num72, num73].option() == 1) { cursorText = Main.itemName[180]; } if (Main.map[num72, num73].option() == 2) { cursorText = Main.itemName[177]; } if (Main.map[num72, num73].option() == 3) { cursorText = Main.itemName[179]; } if (Main.map[num72, num73].option() == 4) { cursorText = Main.itemName[178]; } if (Main.map[num72, num73].option() == 5) { cursorText = Main.itemName[182]; } if (Main.map[num72, num73].option() == 6) { cursorText = Main.itemName[999]; } } else { if (type == 82 || type == 83 || type == 84) { if (Main.map[num72, num73].option() == 0) { cursorText = Main.itemName[313]; } if (Main.map[num72, num73].option() == 1) { cursorText = Main.itemName[314]; } if (Main.map[num72, num73].option() == 2) { cursorText = Main.itemName[315]; } if (Main.map[num72, num73].option() == 3) { cursorText = Main.itemName[316]; } if (Main.map[num72, num73].option() == 4) { cursorText = Main.itemName[317]; } if (Main.map[num72, num73].option() == 5) { cursorText = Main.itemName[318]; } } else { if (type == 227) { cursorText = Main.itemName[1107 + (int)Main.map[num72, num73].option()]; } } } } } } } } float num74 = (num16 * 0.25f * 2f + 1f) / 3f; if (num74 > 1f) { num74 = 1f; } for (int num75 = 0; num75 < 200; num75++) { if (Main.npc[num75].active && Main.npc[num75].townNPC) { int num76 = NPC.TypeToNum(Main.npc[num75].type); if (num76 > 0) { SpriteEffects effects3 = SpriteEffects.None; if (Main.npc[num75].direction > 0) { effects3 = SpriteEffects.FlipHorizontally; } float num77 = (Main.npc[num75].position.X + (float)(Main.npc[num75].width / 2)) / 16f * num16; float num78 = (Main.npc[num75].position.Y + Main.npc[num75].gfxOffY + (float)(Main.npc[num75].height / 2)) / 16f * num16; num77 += num; num78 += num2; num77 -= 10f * num16; num78 -= 10f * num16; this.spriteBatch.Draw(Main.npcHeadTexture[num76], new Vector2(num77, num78), new Rectangle?(new Rectangle(0, 0, Main.npcHeadTexture[num76].Width, Main.npcHeadTexture[num76].Height)), new Color((int)b, (int)b, (int)b, (int)b), 0f, new Vector2((float)(Main.npcHeadTexture[num76].Width / 2), (float)(Main.npcHeadTexture[num76].Height / 2)), num74, effects3, 0f); float num79 = num77 - (float)(Main.npcHeadTexture[num76].Width / 2) * num74; float num80 = num78 - (float)(Main.npcHeadTexture[num76].Height / 2) * num74; float num81 = num79 + (float)Main.npcHeadTexture[num76].Width * num74; float num82 = num80 + (float)Main.npcHeadTexture[num76].Height * num74; if ((float)Main.mouseX >= num79 && (float)Main.mouseX <= num81 && (float)Main.mouseY >= num80 && (float)Main.mouseY <= num82) { string text2; if (num76 == 11) { text2 = Main.npc[num75].displayName; } else { text2 = Main.npc[num75].displayName + " the " + Main.npc[num75].name; } cursorText = text2; } } } } this.spriteBatch.End(); this.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); for (int num83 = 0; num83 < 255; num83++) { if (Main.player[num83].active && !Main.player[num83].dead) { float num84 = ((Main.player[num83].position.X + (float)(Main.player[num83].width / 2)) / 16f - num12) * num16; float num85 = ((Main.player[num83].position.Y + Main.player[num83].gfxOffY + (float)(Main.player[num83].height / 2)) / 16f - num13) * num16; num84 += num; num85 += num2; num84 -= 6f; num85 -= 2f; num85 -= 2f - num16 / 5f * 2f; num84 -= 10f * num16; num85 -= 10f * num16; this.DrawPlayerHead(Main.player[num83], num84, num85, (float)b / 255f, num74); float num86 = num84 + 4f - 14f * num74; float num87 = num85 + 2f - 14f * num74; float num88 = num86 + 28f * num74; float num89 = num87 + 28f * num74; if ((float)Main.mouseX >= num86 && (float)Main.mouseX <= num88 && (float)Main.mouseY >= num87 && (float)Main.mouseY <= num89) { cursorText = Main.player[num83].name; } } } this.spriteBatch.End(); this.spriteBatch.Begin(); int num90 = 10; int num91 = Main.screenHeight - 40; int num92 = 0; int num93 = 130; if (Main.mouseX >= num90 && Main.mouseX <= num90 + 32 && Main.mouseY >= num91 && Main.mouseY <= num91 + 30) { num93 = 255; num92 += 4; Main.player[Main.myPlayer].mouseInterface = true; if (Main.mouseLeft && Main.mouseLeftRelease) { Main.PlaySound(10, -1, -1, 1); Main.mapFullscreen = false; } } this.spriteBatch.Draw(this.mapIconTexture[num92], new Vector2((float)num90, (float)num91), new Rectangle?(new Rectangle(0, 0, this.mapIconTexture[num92].Width, this.mapIconTexture[num92].Height)), new Color(num93, num93, num93, num93), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); this.spriteBatch.Draw(Main.cursorTexture, new Vector2((float)(Main.mouseX + 1), (float)(Main.mouseY + 1)), new Rectangle?(new Rectangle(0, 0, Main.cursorTexture.Width, Main.cursorTexture.Height)), new Color((int)((float)Main.cursorColor.R * 0.2f), (int)((float)Main.cursorColor.G * 0.2f), (int)((float)Main.cursorColor.B * 0.2f), (int)((float)Main.cursorColor.A * 0.5f)), 0f, default(Vector2), Main.cursorScale * 1.1f, SpriteEffects.None, 0f); this.spriteBatch.Draw(Main.cursorTexture, new Vector2((float)Main.mouseX, (float)Main.mouseY), new Rectangle?(new Rectangle(0, 0, Main.cursorTexture.Width, Main.cursorTexture.Height)), Main.cursorColor, 0f, default(Vector2), Main.cursorScale, SpriteEffects.None, 0f); } if (cursorText != "") { this.MouseText(cursorText, 0, 0); } } protected void RenderTiles() { if (Main.drawToScreen) { return; } this.RenderBlack(); base.GraphicsDevice.SetRenderTarget(this.tileTarget); base.GraphicsDevice.Clear(new Color(0, 0, 0, 0)); this.spriteBatch.Begin(); if (Main.ignoreErrors) { try { this.DrawTiles(true); goto IL_58; } catch { goto IL_58; } } this.DrawTiles(true); IL_58: this.spriteBatch.End(); base.GraphicsDevice.SetRenderTarget(null); } protected void RenderTiles2() { if (Main.drawToScreen) { return; } base.GraphicsDevice.SetRenderTarget(this.tile2Target); base.GraphicsDevice.Clear(new Color(0, 0, 0, 0)); this.spriteBatch.Begin(); if (Main.ignoreErrors) { try { this.DrawTiles(false); goto IL_52; } catch { goto IL_52; } } this.DrawTiles(false); IL_52: this.spriteBatch.End(); base.GraphicsDevice.SetRenderTarget(null); } protected void RenderWater() { if (Main.drawToScreen) { return; } base.GraphicsDevice.SetRenderTarget(this.waterTarget); base.GraphicsDevice.Clear(new Color(0, 0, 0, 0)); this.spriteBatch.Begin(); try { this.drawWaters(false); if (Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].mech) { this.DrawWires(); } } catch { } this.spriteBatch.End(); base.GraphicsDevice.SetRenderTarget(null); } protected bool FullTile(int x, int y) { if (Main.tile[x - 1, y].halfBrick() || Main.tile[x - 1, y].slope() != 0) { return false; } if (Main.tile[x + 1, y].halfBrick() || Main.tile[x + 1, y].slope() != 0) { return false; } if (Main.tile[x, y].active() && Main.tileSolid[(int)Main.tile[x, y].type] && !Main.tileSolidTop[(int)Main.tile[x, y].type] && Main.tile[x, y].type != 10 && Main.tile[x, y].type != 54 && Main.tile[x, y].type != 138 && Main.tile[x, y].type != 191) { int frameX = (int)Main.tile[x, y].frameX; int frameY = (int)Main.tile[x, y].frameY; if (frameY == 18) { if (frameX >= 18 && frameX <= 54) { return true; } if (frameX >= 108 && frameX <= 144) { return true; } } else { if (frameY >= 90 && frameY <= 196) { if (frameX <= 70) { return true; } if (frameX >= 144 && frameX <= 232) { return true; } } } } return false; } protected void DrawBlack() { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); Vector2 value = new Vector2((float)Main.offScreenRange, (float)Main.offScreenRange); if (Main.drawToScreen) { value = default(Vector2); } int num = (int)((Main.tileColor.R + Main.tileColor.G + Main.tileColor.B) / 3); float num2 = (float)((double)num * 0.4) / 255f; if (Lighting.lightMode == 2) { num2 = (float)(Main.tileColor.R - 55) / 255f; if (num2 < 0f) { num2 = 0f; } } else { if (Lighting.lightMode == 3) { num2 = (float)(num - 55) / 255f; if (num2 < 0f) { num2 = 0f; } } } int num3 = (int)((Main.screenPosition.X - value.X) / 16f - 1f); int num4 = (int)((Main.screenPosition.X + (float)Main.screenWidth + value.X) / 16f) + 2; int num5 = (int)((Main.screenPosition.Y - value.Y) / 16f - 1f); int num6 = (int)((Main.screenPosition.Y + (float)Main.screenHeight + value.Y) / 16f) + 5; int num7 = Main.offScreenRange / 16; int num8 = Main.offScreenRange / 16; if (num3 - num7 < 0) { num3 = num7; } if (num4 + num7 > Main.maxTilesX) { num4 = Main.maxTilesX - num7; } if (num5 - num8 < 0) { num5 = num8; } if (num6 + num8 > Main.maxTilesY) { num6 = Main.maxTilesY - num8; } for (int i = num5 - num8; i < num6 + num8; i++) { if ((double)i <= Main.worldSurface) { for (int j = num3 - num7; j < num4 + num7; j++) { if (Main.tile[j, i] == null) { Main.tile[j, i] = new Tile(); } if (Lighting.Brightness(j, i) <= num2 && (Main.tile[j, i].liquid < 250 || WorldGen.SolidTile(j, i) || (Main.tile[j, i].liquid > 250 && Lighting.Brightness(j, i) == 0f)) && (Main.tile[j, i].wall < 88 || Main.tile[j, i].wall > 92 || (Main.tile[j, i].active() && Main.tileBlockLight[(int)Main.tile[j, i].type]))) { int num9 = j; j++; while (Main.tile[j, i] != null && Lighting.Brightness(j, i) < num2 && (Main.tile[j, i].liquid < 250 || WorldGen.SolidTile(j, i) || (Main.tile[j, i].liquid > 250 && Lighting.Brightness(j, i) == 0f))) { j++; if (j >= num4 + num7) { break; } } j--; int width = (j - num9 + 1) * 16; this.spriteBatch.Draw(Main.blackTileTexture, new Vector2((float)(num9 * 16 - (int)Main.screenPosition.X), (float)(i * 16 - (int)Main.screenPosition.Y)) + value, new Rectangle?(new Rectangle(0, 0, width, 16)), Color.Black, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } } } Main.renderTimer[5] = (float)stopwatch.ElapsedMilliseconds; } protected void RenderBlack() { if (Main.drawToScreen) { return; } base.GraphicsDevice.SetRenderTarget(this.blackTarget); base.GraphicsDevice.DepthStencilState = new DepthStencilState { DepthBufferEnable = true }; base.GraphicsDevice.Clear(new Color(0, 0, 0, 0)); this.spriteBatch.Begin(); this.DrawBlack(); this.spriteBatch.End(); base.GraphicsDevice.SetRenderTarget(null); } protected void DrawWalls() { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); int num = (int)(255f * (1f - Main.gfxQuality) + 100f * Main.gfxQuality); int num2 = (int)(120f * (1f - Main.gfxQuality) + 40f * Main.gfxQuality); Vector2 value = new Vector2((float)Main.offScreenRange, (float)Main.offScreenRange); if (Main.drawToScreen) { value = default(Vector2); } int num3 = (int)((Main.tileColor.R + Main.tileColor.G + Main.tileColor.B) / 3); float num4 = (float)((double)num3 * 0.53) / 255f; if (Lighting.lightMode == 2) { num4 = (float)(Main.tileColor.R - 12) / 255f; } if (Lighting.lightMode == 3) { num4 = (float)(num3 - 12) / 255f; } int num5 = (int)((Main.screenPosition.X - value.X) / 16f - 1f); int num6 = (int)((Main.screenPosition.X + (float)Main.screenWidth + value.X) / 16f) + 2; int num7 = (int)((Main.screenPosition.Y - value.Y) / 16f - 1f); int num8 = (int)((Main.screenPosition.Y + (float)Main.screenHeight + value.Y) / 16f) + 5; int num9 = Main.offScreenRange / 16; int num10 = Main.offScreenRange / 16; if (num5 - num9 < 0) { num5 = num9; } if (num6 + num9 > Main.maxTilesX) { num6 = Main.maxTilesX - num9; } if (num7 - num10 < 0) { num7 = num10; } if (num8 + num10 > Main.maxTilesY) { num8 = Main.maxTilesY - num10; } for (int i = num7 - num10; i < num8 + num10; i++) { if ((double)i <= Main.worldSurface) { for (int j = num5 - num9; j < num6 + num9; j++) { if (Main.tile[j, i] == null) { Main.tile[j, i] = new Tile(); } if (Lighting.Brightness(j, i) < num4 && (Main.tile[j, i].liquid < 250 || WorldGen.SolidTile(j, i) || (Main.tile[j, i].liquid > 250 && Lighting.Brightness(j, i) == 0f)) && (Lighting.Brightness(j, i) == 0f || Main.tile[j, i].wall < 88 || Main.tile[j, i].wall > 93)) { this.spriteBatch.Draw(Main.blackTileTexture, new Vector2((float)(j * 16 - (int)Main.screenPosition.X), (float)(i * 16 - (int)Main.screenPosition.Y)) + value, Lighting.GetBlackness(j, i)); } } } } for (int k = num7 - num10; k < num8 + num10; k++) { for (int l = num5 - num9; l < num6 + num9; l++) { if (Main.tile[l, k] == null) { Main.tile[l, k] = new Tile(); } if (Main.tile[l, k].wall > 0 && Lighting.Brightness(l, k) > 0f && !this.FullTile(l, k)) { this.LoadWall((int)Main.tile[l, k].wall); Color color = Lighting.GetColor(l, k); if (Lighting.lightMode < 2 && !Main.wallLight[(int)Main.tile[l, k].wall] && (Main.tile[l, k].wall < 88 || Main.tile[l, k].wall > 93) && !WorldGen.SolidTile(l, k)) { if ((int)color.R > num || (double)color.G > (double)num * 1.1 || (double)color.B > (double)num * 1.2) { for (int m = 0; m < 9; m++) { int num11 = 0; int num12 = 0; int width = 12; int height = 12; Color color2 = color; Color color3 = color; if (m == 0) { color3 = Lighting.GetColor(l - 1, k - 1); } if (m == 1) { width = 8; num11 = 12; color3 = Lighting.GetColor(l, k - 1); } if (m == 2) { color3 = Lighting.GetColor(l + 1, k - 1); num11 = 20; } if (m == 3) { color3 = Lighting.GetColor(l - 1, k); height = 8; num12 = 12; } if (m == 4) { width = 8; height = 8; num11 = 12; num12 = 12; } if (m == 5) { num11 = 20; num12 = 12; height = 8; color3 = Lighting.GetColor(l + 1, k); } if (m == 6) { color3 = Lighting.GetColor(l - 1, k + 1); num12 = 20; } if (m == 7) { width = 12; num11 = 12; num12 = 20; color3 = Lighting.GetColor(l, k + 1); } if (m == 8) { color3 = Lighting.GetColor(l + 1, k + 1); num11 = 20; num12 = 20; } color2.R = (byte)((color.R + color3.R) / 2); color2.G = (byte)((color.G + color3.G) / 2); color2.B = (byte)((color.B + color3.B) / 2); if (Main.tile[l, k].wall == 44) { color2.R = (byte)Main.DiscoR; color2.G = (byte)Main.DiscoG; color2.B = (byte)Main.DiscoB; } if (Main.canDrawColorWall(l, k)) { this.spriteBatch.Draw(Main.wallAltTexture[(int)Main.tile[l, k].wall, (int)Main.tile[l, k].wallColor()], new Vector2((float)(l * 16 - (int)Main.screenPosition.X - 8 + num11), (float)(k * 16 - (int)Main.screenPosition.Y - 8 + num12)) + value, new Rectangle?(new Rectangle((int)(Main.tile[l, k].wallFrameX() * 2) + num11, (int)(Main.tile[l, k].wallFrameY() * 2) + num12, width, height)), color2, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } else { this.spriteBatch.Draw(Main.wallTexture[(int)Main.tile[l, k].wall], new Vector2((float)(l * 16 - (int)Main.screenPosition.X - 8 + num11), (float)(k * 16 - (int)Main.screenPosition.Y - 8 + num12)) + value, new Rectangle?(new Rectangle((int)(Main.tile[l, k].wallFrameX() * 2) + num11, (int)(Main.tile[l, k].wallFrameY() * 2) + num12, width, height)), color2, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } } else { if ((int)color.R > num2 || (double)color.G > (double)num2 * 1.1 || (double)color.B > (double)num2 * 1.2) { for (int n = 0; n < 4; n++) { int num13 = 0; int num14 = 0; Color color4 = color; Color color5 = color; if (n == 0) { if (Lighting.Brighter(l, k - 1, l - 1, k)) { color5 = Lighting.GetColor(l - 1, k); } else { color5 = Lighting.GetColor(l, k - 1); } } if (n == 1) { if (Lighting.Brighter(l, k - 1, l + 1, k)) { color5 = Lighting.GetColor(l + 1, k); } else { color5 = Lighting.GetColor(l, k - 1); } num13 = 16; } if (n == 2) { if (Lighting.Brighter(l, k + 1, l - 1, k)) { color5 = Lighting.GetColor(l - 1, k); } else { color5 = Lighting.GetColor(l, k + 1); } num14 = 16; } if (n == 3) { if (Lighting.Brighter(l, k + 1, l + 1, k)) { color5 = Lighting.GetColor(l + 1, k); } else { color5 = Lighting.GetColor(l, k + 1); } num13 = 16; num14 = 16; } color4.R = (byte)((color.R + color5.R) / 2); color4.G = (byte)((color.G + color5.G) / 2); color4.B = (byte)((color.B + color5.B) / 2); if (Main.tile[l, k].wall == 44) { color4.R = (byte)Main.DiscoR; color4.G = (byte)Main.DiscoG; color4.B = (byte)Main.DiscoB; } if (Main.canDrawColorWall(l, k)) { this.spriteBatch.Draw(Main.wallAltTexture[(int)Main.tile[l, k].wall, (int)Main.tile[l, k].wallColor()], new Vector2((float)(l * 16 - (int)Main.screenPosition.X - 8 + num13), (float)(k * 16 - (int)Main.screenPosition.Y - 8 + num14)) + value, new Rectangle?(new Rectangle((int)(Main.tile[l, k].wallFrameX() * 2) + num13, (int)(Main.tile[l, k].wallFrameY() * 2) + num14, 16, 16)), color4, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } else { this.spriteBatch.Draw(Main.wallTexture[(int)Main.tile[l, k].wall], new Vector2((float)(l * 16 - (int)Main.screenPosition.X - 8 + num13), (float)(k * 16 - (int)Main.screenPosition.Y - 8 + num14)) + value, new Rectangle?(new Rectangle((int)(Main.tile[l, k].wallFrameX() * 2) + num13, (int)(Main.tile[l, k].wallFrameY() * 2) + num14, 16, 16)), color4, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } } else { if (Main.tile[l, k].wall == 44) { Color color6 = default(Color); color6.R = (byte)Main.DiscoR; color6.G = (byte)Main.DiscoG; color6.B = (byte)Main.DiscoB; color6.A = 255; Rectangle value2 = new Rectangle((int)(Main.tile[l, k].wallFrameX() * 2), (int)(Main.tile[l, k].wallFrameY() * 2), 32, 32); this.spriteBatch.Draw(Main.wallTexture[(int)Main.tile[l, k].wall], new Vector2((float)(l * 16 - (int)Main.screenPosition.X - 8), (float)(k * 16 - (int)Main.screenPosition.Y - 8)) + value, new Rectangle?(value2), color6, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } else { Rectangle value2 = new Rectangle((int)(Main.tile[l, k].wallFrameX() * 2), (int)(Main.tile[l, k].wallFrameY() * 2), 32, 32); if (Main.canDrawColorWall(l, k)) { this.spriteBatch.Draw(Main.wallAltTexture[(int)Main.tile[l, k].wall, (int)Main.tile[l, k].wallColor()], new Vector2((float)(l * 16 - (int)Main.screenPosition.X - 8), (float)(k * 16 - (int)Main.screenPosition.Y - 8)) + value, new Rectangle?(value2), Lighting.GetColor(l, k), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } else { this.spriteBatch.Draw(Main.wallTexture[(int)Main.tile[l, k].wall], new Vector2((float)(l * 16 - (int)Main.screenPosition.X - 8), (float)(k * 16 - (int)Main.screenPosition.Y - 8)) + value, new Rectangle?(value2), Lighting.GetColor(l, k), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } } } } else { if (Main.tile[l, k].wall == 44) { Color color7 = default(Color); color7.R = (byte)Main.DiscoR; color7.G = (byte)Main.DiscoG; color7.B = (byte)Main.DiscoB; color7.A = 255; Rectangle value2 = new Rectangle((int)(Main.tile[l, k].wallFrameX() * 2), (int)(Main.tile[l, k].wallFrameY() * 2), 32, 32); this.spriteBatch.Draw(Main.wallTexture[(int)Main.tile[l, k].wall], new Vector2((float)(l * 16 - (int)Main.screenPosition.X - 8), (float)(k * 16 - (int)Main.screenPosition.Y - 8)) + value, new Rectangle?(value2), color7, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } else { Rectangle value2 = new Rectangle((int)(Main.tile[l, k].wallFrameX() * 2), (int)(Main.tile[l, k].wallFrameY() * 2), 32, 32); if (Main.canDrawColorWall(l, k)) { this.spriteBatch.Draw(Main.wallAltTexture[(int)Main.tile[l, k].wall, (int)Main.tile[l, k].wallColor()], new Vector2((float)(l * 16 - (int)Main.screenPosition.X - 8), (float)(k * 16 - (int)Main.screenPosition.Y - 8)) + value, new Rectangle?(value2), Lighting.GetColor(l, k), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } else { this.spriteBatch.Draw(Main.wallTexture[(int)Main.tile[l, k].wall], new Vector2((float)(l * 16 - (int)Main.screenPosition.X - 8), (float)(k * 16 - (int)Main.screenPosition.Y - 8)) + value, new Rectangle?(value2), Lighting.GetColor(l, k), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } } if ((double)color.R > (double)num2 * 0.4 || (double)color.G > (double)num2 * 0.35 || (double)color.B > (double)num2 * 0.3) { bool flag = false; if (Main.tile[l - 1, k].wall > 0 && Main.wallBlend[(int)Main.tile[l - 1, k].wall] != Main.wallBlend[(int)Main.tile[l, k].wall]) { flag = true; } bool flag2 = false; if (Main.tile[l + 1, k].wall > 0 && Main.wallBlend[(int)Main.tile[l + 1, k].wall] != Main.wallBlend[(int)Main.tile[l, k].wall]) { flag2 = true; } bool flag3 = false; if (Main.tile[l, k - 1].wall > 0 && Main.wallBlend[(int)Main.tile[l, k - 1].wall] != Main.wallBlend[(int)Main.tile[l, k].wall]) { flag3 = true; } bool flag4 = false; if (Main.tile[l, k + 1].wall > 0 && Main.wallBlend[(int)Main.tile[l, k + 1].wall] != Main.wallBlend[(int)Main.tile[l, k].wall]) { flag4 = true; } if (flag) { this.spriteBatch.Draw(Main.wallOutlineTexture, new Vector2((float)(l * 16 - (int)Main.screenPosition.X), (float)(k * 16 - (int)Main.screenPosition.Y)) + value, new Rectangle?(new Rectangle(0, 0, 2, 16)), Lighting.GetColor(l, k), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } if (flag2) { this.spriteBatch.Draw(Main.wallOutlineTexture, new Vector2((float)(l * 16 - (int)Main.screenPosition.X + 14), (float)(k * 16 - (int)Main.screenPosition.Y)) + value, new Rectangle?(new Rectangle(14, 0, 2, 16)), Lighting.GetColor(l, k), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } if (flag3) { this.spriteBatch.Draw(Main.wallOutlineTexture, new Vector2((float)(l * 16 - (int)Main.screenPosition.X), (float)(k * 16 - (int)Main.screenPosition.Y)) + value, new Rectangle?(new Rectangle(0, 0, 16, 2)), Lighting.GetColor(l, k), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } if (flag4) { this.spriteBatch.Draw(Main.wallOutlineTexture, new Vector2((float)(l * 16 - (int)Main.screenPosition.X), (float)(k * 16 - (int)Main.screenPosition.Y + 14)) + value, new Rectangle?(new Rectangle(0, 14, 16, 2)), Lighting.GetColor(l, k), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } } } } Main.renderTimer[2] = (float)stopwatch.ElapsedMilliseconds; } protected void RenderWalls() { if (Main.drawToScreen) { return; } base.GraphicsDevice.SetRenderTarget(this.wallTarget); base.GraphicsDevice.DepthStencilState = new DepthStencilState { DepthBufferEnable = true }; base.GraphicsDevice.Clear(new Color(0, 0, 0, 0)); this.spriteBatch.Begin(); if (Main.ignoreErrors) { try { this.DrawWalls(); goto IL_69; } catch { goto IL_69; } } this.DrawWalls(); IL_69: this.spriteBatch.End(); base.GraphicsDevice.SetRenderTarget(null); } protected void ReleaseTargets() { try { if (!Main.dedServ) { Main.offScreenRange = 0; Main.targetSet = false; this.waterTarget.Dispose(); this.backWaterTarget.Dispose(); this.blackTarget.Dispose(); this.tileTarget.Dispose(); this.tile2Target.Dispose(); this.wallTarget.Dispose(); this.backgroundTarget.Dispose(); } } catch { } } protected bool checkMap(int i, int j) { if (!Main.initMap[i, j]) { try { int width = Main.textureMax; int height = Main.textureMax; if (i == Main.mapTargetX - 1) { width = 400; } if (j == Main.mapTargetY - 1) { height = 400; } this.mapTarget[i, j] = new RenderTarget2D(base.GraphicsDevice, width, height, false, base.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth16, 0, RenderTargetUsage.PreserveContents); } catch { Main.mapEnabled = false; for (int k = 0; k < Main.mapTargetX; k++) { for (int l = 0; l < Main.mapTargetY; l++) { try { Main.initMap[k, l] = false; this.mapTarget[k, l].Dispose(); } catch { } } } return false; } Main.initMap[i, j] = true; return true; } return true; } protected void InitMap() { int num = Main.mapTargetX; int num2 = Main.mapTargetY; if (Main.mapEnabled) { try { for (int i = 0; i < num; i++) { for (int j = 0; j < num2; j++) { this.mapTarget[i, j] = new RenderTarget2D(base.GraphicsDevice, Main.textureMax, Main.textureMax, false, base.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents); } } Main.mapInit = true; } catch { Main.mapEnabled = false; for (int k = 0; k < num; k++) { for (int l = 0; l < num2; l++) { try { if (this.mapTarget[k, l] != null) { this.mapTarget[k, l].Dispose(); } } catch { } } } } } } protected void InitTargets() { try { if (!Main.dedServ) { Main.offScreenRange = 192; Main.targetSet = true; if (base.GraphicsDevice.PresentationParameters.BackBufferWidth + Main.offScreenRange * 2 > 2048) { Main.offScreenRange = (2048 - base.GraphicsDevice.PresentationParameters.BackBufferWidth) / 2; } this.waterTarget = new RenderTarget2D(base.GraphicsDevice, base.GraphicsDevice.PresentationParameters.BackBufferWidth + Main.offScreenRange * 2, base.GraphicsDevice.PresentationParameters.BackBufferHeight + Main.offScreenRange * 2, false, base.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24); this.backWaterTarget = new RenderTarget2D(base.GraphicsDevice, base.GraphicsDevice.PresentationParameters.BackBufferWidth + Main.offScreenRange * 2, base.GraphicsDevice.PresentationParameters.BackBufferHeight + Main.offScreenRange * 2, false, base.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24); this.blackTarget = new RenderTarget2D(base.GraphicsDevice, base.GraphicsDevice.PresentationParameters.BackBufferWidth + Main.offScreenRange * 2, base.GraphicsDevice.PresentationParameters.BackBufferHeight + Main.offScreenRange * 2, false, base.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24); this.tileTarget = new RenderTarget2D(base.GraphicsDevice, base.GraphicsDevice.PresentationParameters.BackBufferWidth + Main.offScreenRange * 2, base.GraphicsDevice.PresentationParameters.BackBufferHeight + Main.offScreenRange * 2, false, base.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24); this.tile2Target = new RenderTarget2D(base.GraphicsDevice, base.GraphicsDevice.PresentationParameters.BackBufferWidth + Main.offScreenRange * 2, base.GraphicsDevice.PresentationParameters.BackBufferHeight + Main.offScreenRange * 2, false, base.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24); this.wallTarget = new RenderTarget2D(base.GraphicsDevice, base.GraphicsDevice.PresentationParameters.BackBufferWidth + Main.offScreenRange * 2, base.GraphicsDevice.PresentationParameters.BackBufferHeight + Main.offScreenRange * 2, false, base.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24); this.backgroundTarget = new RenderTarget2D(base.GraphicsDevice, base.GraphicsDevice.PresentationParameters.BackBufferWidth + Main.offScreenRange * 2, base.GraphicsDevice.PresentationParameters.BackBufferHeight + Main.offScreenRange * 2, false, base.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24); } } catch { Lighting.lightMode = 2; Main.mapEnabled = false; this.SaveSettings(); try { this.ReleaseTargets(); } catch { } } } protected void DrawWires() { float arg_05_0 = Main.gfxQuality; float arg_0B_0 = Main.gfxQuality; Vector2 value = new Vector2((float)Main.offScreenRange, (float)Main.offScreenRange); if (Main.drawToScreen) { value = default(Vector2); } int num = (int)((Main.screenPosition.X - value.X) / 16f - 1f); int num2 = (int)((Main.screenPosition.X + (float)Main.screenWidth + value.X) / 16f) + 2; int num3 = (int)((Main.screenPosition.Y - value.Y) / 16f - 1f); int num4 = (int)((Main.screenPosition.Y + (float)Main.screenHeight + value.Y) / 16f) + 5; if (num < 0) { num = 0; } if (num2 > Main.maxTilesX) { num2 = Main.maxTilesX; } if (num3 < 0) { num3 = 0; } if (num4 > Main.maxTilesY) { num4 = Main.maxTilesY; } for (int i = num3; i < num4; i++) { for (int j = num; j < num2; j++) { if (Main.tile[j, i].wire() && Lighting.Brightness(j, i) > 0f) { Rectangle value2 = new Rectangle(0, 0, 16, 16); bool flag = Main.tile[j, i - 1].wire(); bool flag2 = Main.tile[j, i + 1].wire(); bool flag3 = Main.tile[j - 1, i].wire(); bool flag4 = Main.tile[j + 1, i].wire(); if (flag) { if (flag2) { if (flag3) { if (flag4) { value2 = new Rectangle(18, 18, 16, 16); } else { value2 = new Rectangle(54, 0, 16, 16); } } else { if (flag4) { value2 = new Rectangle(36, 0, 16, 16); } else { value2 = new Rectangle(0, 0, 16, 16); } } } else { if (flag3) { if (flag4) { value2 = new Rectangle(0, 18, 16, 16); } else { value2 = new Rectangle(54, 18, 16, 16); } } else { if (flag4) { value2 = new Rectangle(36, 18, 16, 16); } else { value2 = new Rectangle(36, 36, 16, 16); } } } } else { if (flag2) { if (flag3) { if (flag4) { value2 = new Rectangle(72, 0, 16, 16); } else { value2 = new Rectangle(72, 18, 16, 16); } } else { if (flag4) { value2 = new Rectangle(0, 36, 16, 16); } else { value2 = new Rectangle(18, 36, 16, 16); } } } else { if (flag3) { if (flag4) { value2 = new Rectangle(18, 0, 16, 16); } else { value2 = new Rectangle(54, 36, 16, 16); } } else { if (flag4) { value2 = new Rectangle(72, 36, 16, 16); } else { value2 = new Rectangle(0, 54, 16, 16); } } } } Color color = Lighting.GetColor(j, i); this.spriteBatch.Draw(Main.wireTexture, new Vector2((float)(j * 16 - (int)Main.screenPosition.X), (float)(i * 16 - (int)Main.screenPosition.Y)) + value, new Rectangle?(value2), color, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } if (Main.tile[j, i].wire2() && Lighting.Brightness(j, i) > 0f) { Rectangle value3 = new Rectangle(0, 0, 16, 16); bool flag5 = Main.tile[j, i - 1].wire2(); bool flag6 = Main.tile[j, i + 1].wire2(); bool flag7 = Main.tile[j - 1, i].wire2(); bool flag8 = Main.tile[j + 1, i].wire2(); if (flag5) { if (flag6) { if (flag7) { if (flag8) { value3 = new Rectangle(18, 18, 16, 16); } else { value3 = new Rectangle(54, 0, 16, 16); } } else { if (flag8) { value3 = new Rectangle(36, 0, 16, 16); } else { value3 = new Rectangle(0, 0, 16, 16); } } } else { if (flag7) { if (flag8) { value3 = new Rectangle(0, 18, 16, 16); } else { value3 = new Rectangle(54, 18, 16, 16); } } else { if (flag8) { value3 = new Rectangle(36, 18, 16, 16); } else { value3 = new Rectangle(36, 36, 16, 16); } } } } else { if (flag6) { if (flag7) { if (flag8) { value3 = new Rectangle(72, 0, 16, 16); } else { value3 = new Rectangle(72, 18, 16, 16); } } else { if (flag8) { value3 = new Rectangle(0, 36, 16, 16); } else { value3 = new Rectangle(18, 36, 16, 16); } } } else { if (flag7) { if (flag8) { value3 = new Rectangle(18, 0, 16, 16); } else { value3 = new Rectangle(54, 36, 16, 16); } } else { if (flag8) { value3 = new Rectangle(72, 36, 16, 16); } else { value3 = new Rectangle(0, 54, 16, 16); } } } } Color color2 = Lighting.GetColor(j, i); int num5 = 1; if (Main.tile[j, i].wire()) { num5++; } float num6 = 1f / (float)num5; byte r = (byte)((float)color2.R * num6); byte g = (byte)((float)color2.G * num6); byte b = (byte)((float)color2.B * num6); byte b2 = (byte)((float)color2.A * num6); color2 = new Color((int)r, (int)g, (int)b, (int)b2); this.spriteBatch.Draw(Main.wire2Texture, new Vector2((float)(j * 16 - (int)Main.screenPosition.X), (float)(i * 16 - (int)Main.screenPosition.Y)) + value, new Rectangle?(value3), color2, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } if (Main.tile[j, i].wire3() && Lighting.Brightness(j, i) > 0f) { Rectangle value4 = new Rectangle(0, 0, 16, 16); bool flag9 = Main.tile[j, i - 1].wire3(); bool flag10 = Main.tile[j, i + 1].wire3(); bool flag11 = Main.tile[j - 1, i].wire3(); bool flag12 = Main.tile[j + 1, i].wire3(); if (flag9) { if (flag10) { if (flag11) { if (flag12) { value4 = new Rectangle(18, 18, 16, 16); } else { value4 = new Rectangle(54, 0, 16, 16); } } else { if (flag12) { value4 = new Rectangle(36, 0, 16, 16); } else { value4 = new Rectangle(0, 0, 16, 16); } } } else { if (flag11) { if (flag12) { value4 = new Rectangle(0, 18, 16, 16); } else { value4 = new Rectangle(54, 18, 16, 16); } } else { if (flag12) { value4 = new Rectangle(36, 18, 16, 16); } else { value4 = new Rectangle(36, 36, 16, 16); } } } } else { if (flag10) { if (flag11) { if (flag12) { value4 = new Rectangle(72, 0, 16, 16); } else { value4 = new Rectangle(72, 18, 16, 16); } } else { if (flag12) { value4 = new Rectangle(0, 36, 16, 16); } else { value4 = new Rectangle(18, 36, 16, 16); } } } else { if (flag11) { if (flag12) { value4 = new Rectangle(18, 0, 16, 16); } else { value4 = new Rectangle(54, 36, 16, 16); } } else { if (flag12) { value4 = new Rectangle(72, 36, 16, 16); } else { value4 = new Rectangle(0, 54, 16, 16); } } } } Color color3 = Lighting.GetColor(j, i); int num7 = 1; if (Main.tile[j, i].wire()) { num7++; } if (Main.tile[j, i].wire2()) { num7++; } float num8 = 1f / (float)num7; byte r2 = (byte)((float)color3.R * num8); byte g2 = (byte)((float)color3.G * num8); byte b3 = (byte)((float)color3.B * num8); byte b4 = (byte)((float)color3.A * num8); color3 = new Color((int)r2, (int)g2, (int)b3, (int)b4); this.spriteBatch.Draw(Main.wire3Texture, new Vector2((float)(j * 16 - (int)Main.screenPosition.X), (float)(i * 16 - (int)Main.screenPosition.Y)) + value, new Rectangle?(value4), color3, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } if (Main.tile[j, i].actuator() && Lighting.Brightness(j, i) > 0f) { Color color4 = Lighting.GetColor(j, i); this.spriteBatch.Draw(Main.actuatorTexture, new Vector2((float)(j * 16 - (int)Main.screenPosition.X), (float)(i * 16 - (int)Main.screenPosition.Y)) + value, new Rectangle?(new Rectangle(0, 0, Main.actuatorTexture.Width, Main.actuatorTexture.Height)), color4, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } } } public static void FindWaterfalls() { Main.waterfallDist = (int)(75f * Main.gfxQuality) + 25; Main.wfTileMax = (int)(175f * Main.gfxQuality) + 25; int num = 160; Main.wfTileNum = 0; int num2 = (int)(Main.screenPosition.X / 16f - 1f); int num3 = (int)((Main.screenPosition.X + (float)Main.screenWidth) / 16f) + 2; int num4 = (int)(Main.screenPosition.Y / 16f - 1f); int num5 = (int)((Main.screenPosition.Y + (float)Main.screenHeight) / 16f) + 2; num2 -= Main.waterfallDist; num3 += Main.waterfallDist; num4 -= Main.waterfallDist; num5 += 20; if (num2 < 0) { num2 = 0; } if (num3 > Main.maxTilesX) { num3 = Main.maxTilesX; } if (num4 < 0) { num4 = 0; } if (num5 > Main.maxTilesY) { num5 = Main.maxTilesY; } for (int i = num2; i < num3; i++) { for (int j = num4; j < num5; j++) { if (Main.tile[i, j] == null) { Main.tile[i, j] = new Tile(); } if (Main.tile[i, j].active()) { if (Main.tile[i, j].halfBrick() && (Main.tile[i, j - 1].liquid < 16 || WorldGen.SolidTile(i, j - 1))) { if (Main.tile[i - 1, j] == null) { return; } if (Main.tile[i + 1, j] == null) { return; } if (((int)Main.tile[i - 1, j].liquid > num || (int)Main.tile[i + 1, j].liquid > num) && ((Main.tile[i - 1, j].liquid == 0 && !WorldGen.SolidTile(i - 1, j) && Main.tile[i - 1, j].slope() == 0) || (Main.tile[i + 1, j].liquid == 0 && !WorldGen.SolidTile(i + 1, j) && Main.tile[i + 1, j].slope() == 0)) && Main.wfTileNum < Main.wfTileMax) { Main.wfTileType[Main.wfTileNum] = 0; if (Main.tile[i, j - 1].lava()) { Main.wfTileType[Main.wfTileNum] = 1; } if (Main.tile[i + 1, j].lava()) { Main.wfTileType[Main.wfTileNum] = 1; } if (Main.tile[i - 1, j].lava()) { Main.wfTileType[Main.wfTileNum] = 1; } if (Main.tile[i, j - 1].honey()) { Main.wfTileType[Main.wfTileNum] = 14; } if (Main.tile[i + 1, j].honey()) { Main.wfTileType[Main.wfTileNum] = 14; } if (Main.tile[i - 1, j].honey()) { Main.wfTileType[Main.wfTileNum] = 14; } Main.wfTileX[Main.wfTileNum] = i; Main.wfTileY[Main.wfTileNum] = j; Main.wfTileNum++; } } if (Main.tile[i, j].type == 196 && !WorldGen.SolidTile(i, j + 1) && Main.wfTileNum < Main.wfTileMax) { Main.wfTileType[Main.wfTileNum] = 11; Main.wfTileX[Main.wfTileNum] = i; Main.wfTileY[Main.wfTileNum] = j + 1; Main.wfTileNum++; } } } } } protected void drawWaterfalls() { Main.drewLava = false; if (Main.liquidAlpha[0] > 0f) { this.DrawWaterfall(0, Main.liquidAlpha[0]); } if (Main.liquidAlpha[2] > 0f) { this.DrawWaterfall(3, Main.liquidAlpha[2]); } if (Main.liquidAlpha[3] > 0f) { this.DrawWaterfall(4, Main.liquidAlpha[3]); } if (Main.liquidAlpha[4] > 0f) { this.DrawWaterfall(5, Main.liquidAlpha[4]); } if (Main.liquidAlpha[5] > 0f) { this.DrawWaterfall(6, Main.liquidAlpha[5]); } if (Main.liquidAlpha[6] > 0f) { this.DrawWaterfall(7, Main.liquidAlpha[6]); } if (Main.liquidAlpha[7] > 0f) { this.DrawWaterfall(8, Main.liquidAlpha[7]); } if (Main.liquidAlpha[8] > 0f) { this.DrawWaterfall(9, Main.liquidAlpha[8]); } if (Main.liquidAlpha[9] > 0f) { this.DrawWaterfall(10, Main.liquidAlpha[9]); } if (Main.liquidAlpha[10] > 0f) { this.DrawWaterfall(13, Main.liquidAlpha[10]); } } protected void drawWaters(bool bg = false) { if (!bg) { if (Main.bgStyle == 1 || (Main.bgStyle == 5 && Main.evilTiles > Main.holyTiles)) { Main.waterStyle = 2; } else { if (Main.bgStyle == 3) { Main.waterStyle = 3; } else { if (Main.bgStyle == 8) { Main.waterStyle = 10; } else { if (Main.bgStyle == 6 || (Main.bgStyle == 5 && Main.evilTiles < Main.holyTiles)) { Main.waterStyle = 4; } else { if (Main.bgStyle == 7) { Main.waterStyle = 5; } else { if (Main.bgStyle == 2) { Main.waterStyle = 6; } else { if ((double)(Main.screenPosition.Y / 16f) > Main.rockLayer + 40.0) { if (Main.shroomTiles > 300) { Main.waterStyle = 7; } else { Main.waterStyle = 8; } } else { if ((double)(Main.screenPosition.Y / 16f) > Main.worldSurface) { Main.waterStyle = 7; } else { Main.waterStyle = 0; } } } } } } } } 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 (Main.liquidAlpha[2] < 0f) { Main.liquidAlpha[2] = 0f; } Main.liquidAlpha[3] -= 0.2f; if (Main.liquidAlpha[3] < 0f) { Main.liquidAlpha[3] = 0f; } Main.liquidAlpha[4] -= 0.2f; if (Main.liquidAlpha[4] < 0f) { Main.liquidAlpha[4] = 0f; } Main.liquidAlpha[5] -= 0.2f; if (Main.liquidAlpha[5] < 0f) { Main.liquidAlpha[5] = 0f; } Main.liquidAlpha[6] -= 0.2f; if (Main.liquidAlpha[6] < 0f) { Main.liquidAlpha[6] = 0f; } Main.liquidAlpha[7] -= 0.2f; if (Main.liquidAlpha[7] < 0f) { Main.liquidAlpha[7] = 0f; } Main.liquidAlpha[8] -= 0.2f; if (Main.liquidAlpha[8] < 0f) { Main.liquidAlpha[8] = 0f; } Main.liquidAlpha[9] -= 0.2f; if (Main.liquidAlpha[9] < 0f) { Main.liquidAlpha[9] = 0f; } Main.liquidAlpha[10] -= 0.2f; if (Main.liquidAlpha[10] < 0f) { Main.liquidAlpha[10] = 0f; } Main.liquidAlpha[0] += 0.2f; if (Main.liquidAlpha[0] > 1f) { Main.liquidAlpha[0] = 1f; } } if (Main.waterStyle == 2) { Main.liquidAlpha[0] -= 0.2f; if (Main.liquidAlpha[0] < 0f) { Main.liquidAlpha[0] = 0f; } Main.liquidAlpha[3] -= 0.2f; if (Main.liquidAlpha[3] < 0f) { Main.liquidAlpha[3] = 0f; } Main.liquidAlpha[4] -= 0.2f; if (Main.liquidAlpha[4] < 0f) { Main.liquidAlpha[4] = 0f; } Main.liquidAlpha[5] -= 0.2f; if (Main.liquidAlpha[5] < 0f) { Main.liquidAlpha[5] = 0f; } Main.liquidAlpha[6] -= 0.2f; if (Main.liquidAlpha[6] < 0f) { Main.liquidAlpha[6] = 0f; } Main.liquidAlpha[7] -= 0.2f; if (Main.liquidAlpha[7] < 0f) { Main.liquidAlpha[7] = 0f; } Main.liquidAlpha[8] -= 0.2f; if (Main.liquidAlpha[8] < 0f) { Main.liquidAlpha[8] = 0f; } Main.liquidAlpha[9] -= 0.2f; if (Main.liquidAlpha[9] < 0f) { Main.liquidAlpha[9] = 0f; } Main.liquidAlpha[10] -= 0.2f; if (Main.liquidAlpha[10] < 0f) { Main.liquidAlpha[10] = 0f; } Main.liquidAlpha[2] += 0.2f; if (Main.liquidAlpha[2] > 1f) { Main.liquidAlpha[2] = 1f; } } if (Main.waterStyle == 3) { Main.liquidAlpha[0] -= 0.2f; if (Main.liquidAlpha[0] < 0f) { Main.liquidAlpha[0] = 0f; } Main.liquidAlpha[2] -= 0.2f; if (Main.liquidAlpha[2] < 0f) { Main.liquidAlpha[2] = 0f; } Main.liquidAlpha[4] -= 0.2f; if (Main.liquidAlpha[4] < 0f) { Main.liquidAlpha[4] = 0f; } Main.liquidAlpha[5] -= 0.2f; if (Main.liquidAlpha[5] < 0f) { Main.liquidAlpha[5] = 0f; } Main.liquidAlpha[6] -= 0.2f; if (Main.liquidAlpha[6] < 0f) { Main.liquidAlpha[6] = 0f; } Main.liquidAlpha[7] -= 0.2f; if (Main.liquidAlpha[7] < 0f) { Main.liquidAlpha[7] = 0f; } Main.liquidAlpha[8] -= 0.2f; if (Main.liquidAlpha[8] < 0f) { Main.liquidAlpha[8] = 0f; } Main.liquidAlpha[9] -= 0.2f; if (Main.liquidAlpha[9] < 0f) { Main.liquidAlpha[9] = 0f; } Main.liquidAlpha[10] -= 0.2f; if (Main.liquidAlpha[10] < 0f) { Main.liquidAlpha[10] = 0f; } Main.liquidAlpha[3] += 0.2f; if (Main.liquidAlpha[3] > 1f) { Main.liquidAlpha[3] = 1f; } } if (Main.waterStyle == 4) { Main.liquidAlpha[0] -= 0.2f; if (Main.liquidAlpha[0] < 0f) { Main.liquidAlpha[0] = 0f; } Main.liquidAlpha[2] -= 0.2f; if (Main.liquidAlpha[2] < 0f) { Main.liquidAlpha[2] = 0f; } Main.liquidAlpha[3] -= 0.2f; if (Main.liquidAlpha[3] < 0f) { Main.liquidAlpha[3] = 0f; } Main.liquidAlpha[5] -= 0.2f; if (Main.liquidAlpha[5] < 0f) { Main.liquidAlpha[5] = 0f; } Main.liquidAlpha[6] -= 0.2f; if (Main.liquidAlpha[6] < 0f) { Main.liquidAlpha[6] = 0f; } Main.liquidAlpha[7] -= 0.2f; if (Main.liquidAlpha[7] < 0f) { Main.liquidAlpha[7] = 0f; } Main.liquidAlpha[8] -= 0.2f; if (Main.liquidAlpha[8] < 0f) { Main.liquidAlpha[8] = 0f; } Main.liquidAlpha[9] -= 0.2f; if (Main.liquidAlpha[9] < 0f) { Main.liquidAlpha[9] = 0f; } Main.liquidAlpha[10] -= 0.2f; if (Main.liquidAlpha[10] < 0f) { Main.liquidAlpha[10] = 0f; } Main.liquidAlpha[4] += 0.2f; if (Main.liquidAlpha[4] > 1f) { Main.liquidAlpha[4] = 1f; } } if (Main.waterStyle == 5) { Main.liquidAlpha[0] -= 0.2f; if (Main.liquidAlpha[0] < 0f) { Main.liquidAlpha[0] = 0f; } Main.liquidAlpha[2] -= 0.2f; if (Main.liquidAlpha[2] < 0f) { Main.liquidAlpha[2] = 0f; } Main.liquidAlpha[3] -= 0.2f; if (Main.liquidAlpha[3] < 0f) { Main.liquidAlpha[3] = 0f; } Main.liquidAlpha[4] -= 0.2f; if (Main.liquidAlpha[4] < 0f) { Main.liquidAlpha[4] = 0f; } Main.liquidAlpha[6] -= 0.2f; if (Main.liquidAlpha[6] < 0f) { Main.liquidAlpha[6] = 0f; } Main.liquidAlpha[7] -= 0.2f; if (Main.liquidAlpha[7] < 0f) { Main.liquidAlpha[7] = 0f; } Main.liquidAlpha[8] -= 0.2f; if (Main.liquidAlpha[8] < 0f) { Main.liquidAlpha[8] = 0f; } Main.liquidAlpha[9] -= 0.2f; if (Main.liquidAlpha[9] < 0f) { Main.liquidAlpha[9] = 0f; } Main.liquidAlpha[10] -= 0.2f; if (Main.liquidAlpha[10] < 0f) { Main.liquidAlpha[10] = 0f; } Main.liquidAlpha[5] += 0.2f; if (Main.liquidAlpha[5] > 1f) { Main.liquidAlpha[5] = 1f; } } if (Main.waterStyle == 6) { Main.liquidAlpha[0] -= 0.2f; if (Main.liquidAlpha[0] < 0f) { Main.liquidAlpha[0] = 0f; } Main.liquidAlpha[2] -= 0.2f; if (Main.liquidAlpha[2] < 0f) { Main.liquidAlpha[2] = 0f; } Main.liquidAlpha[3] -= 0.2f; if (Main.liquidAlpha[3] < 0f) { Main.liquidAlpha[3] = 0f; } Main.liquidAlpha[4] -= 0.2f; if (Main.liquidAlpha[4] < 0f) { Main.liquidAlpha[4] = 0f; } Main.liquidAlpha[5] -= 0.2f; if (Main.liquidAlpha[5] < 0f) { Main.liquidAlpha[5] = 0f; } Main.liquidAlpha[7] -= 0.2f; if (Main.liquidAlpha[7] < 0f) { Main.liquidAlpha[7] = 0f; } Main.liquidAlpha[8] -= 0.2f; if (Main.liquidAlpha[8] < 0f) { Main.liquidAlpha[8] = 0f; } Main.liquidAlpha[9] -= 0.2f; if (Main.liquidAlpha[9] < 0f) { Main.liquidAlpha[9] = 0f; } Main.liquidAlpha[10] -= 0.2f; if (Main.liquidAlpha[10] < 0f) { Main.liquidAlpha[10] = 0f; } Main.liquidAlpha[6] += 0.2f; if (Main.liquidAlpha[6] > 1f) { Main.liquidAlpha[6] = 1f; } } if (Main.waterStyle == 7) { Main.liquidAlpha[0] -= 0.2f; if (Main.liquidAlpha[0] < 0f) { Main.liquidAlpha[0] = 0f; } Main.liquidAlpha[2] -= 0.2f; if (Main.liquidAlpha[2] < 0f) { Main.liquidAlpha[2] = 0f; } Main.liquidAlpha[3] -= 0.2f; if (Main.liquidAlpha[3] < 0f) { Main.liquidAlpha[3] = 0f; } Main.liquidAlpha[4] -= 0.2f; if (Main.liquidAlpha[4] < 0f) { Main.liquidAlpha[4] = 0f; } Main.liquidAlpha[5] -= 0.2f; if (Main.liquidAlpha[5] < 0f) { Main.liquidAlpha[5] = 0f; } Main.liquidAlpha[6] -= 0.2f; if (Main.liquidAlpha[6] < 0f) { Main.liquidAlpha[6] = 0f; } Main.liquidAlpha[8] -= 0.2f; if (Main.liquidAlpha[8] < 0f) { Main.liquidAlpha[8] = 0f; } Main.liquidAlpha[9] -= 0.2f; if (Main.liquidAlpha[9] < 0f) { Main.liquidAlpha[9] = 0f; } Main.liquidAlpha[10] -= 0.2f; if (Main.liquidAlpha[10] < 0f) { Main.liquidAlpha[10] = 0f; } Main.liquidAlpha[7] += 0.2f; if (Main.liquidAlpha[7] > 1f) { Main.liquidAlpha[7] = 1f; } } if (Main.waterStyle == 8) { Main.liquidAlpha[0] -= 0.2f; if (Main.liquidAlpha[0] < 0f) { Main.liquidAlpha[0] = 0f; } Main.liquidAlpha[2] -= 0.2f; if (Main.liquidAlpha[2] < 0f) { Main.liquidAlpha[2] = 0f; } Main.liquidAlpha[3] -= 0.2f; if (Main.liquidAlpha[3] < 0f) { Main.liquidAlpha[3] = 0f; } Main.liquidAlpha[4] -= 0.2f; if (Main.liquidAlpha[4] < 0f) { Main.liquidAlpha[4] = 0f; } Main.liquidAlpha[5] -= 0.2f; if (Main.liquidAlpha[5] < 0f) { Main.liquidAlpha[5] = 0f; } Main.liquidAlpha[6] -= 0.2f; if (Main.liquidAlpha[6] < 0f) { Main.liquidAlpha[6] = 0f; } Main.liquidAlpha[7] -= 0.2f; if (Main.liquidAlpha[7] < 0f) { Main.liquidAlpha[7] = 0f; } Main.liquidAlpha[9] -= 0.2f; if (Main.liquidAlpha[9] < 0f) { Main.liquidAlpha[9] = 0f; } Main.liquidAlpha[10] -= 0.2f; if (Main.liquidAlpha[10] < 0f) { Main.liquidAlpha[10] = 0f; } Main.liquidAlpha[8] += 0.2f; if (Main.liquidAlpha[8] > 1f) { Main.liquidAlpha[8] = 1f; } } if (Main.waterStyle == 9) { Main.liquidAlpha[0] -= 0.2f; if (Main.liquidAlpha[0] < 0f) { Main.liquidAlpha[0] = 0f; } Main.liquidAlpha[2] -= 0.2f; if (Main.liquidAlpha[2] < 0f) { Main.liquidAlpha[2] = 0f; } Main.liquidAlpha[3] -= 0.2f; if (Main.liquidAlpha[3] < 0f) { Main.liquidAlpha[3] = 0f; } Main.liquidAlpha[4] -= 0.2f; if (Main.liquidAlpha[4] < 0f) { Main.liquidAlpha[4] = 0f; } Main.liquidAlpha[5] -= 0.2f; if (Main.liquidAlpha[5] < 0f) { Main.liquidAlpha[5] = 0f; } Main.liquidAlpha[6] -= 0.2f; if (Main.liquidAlpha[6] < 0f) { Main.liquidAlpha[6] = 0f; } Main.liquidAlpha[7] -= 0.2f; if (Main.liquidAlpha[7] < 0f) { Main.liquidAlpha[7] = 0f; } Main.liquidAlpha[8] -= 0.2f; if (Main.liquidAlpha[8] < 0f) { Main.liquidAlpha[8] = 0f; } Main.liquidAlpha[10] -= 0.2f; if (Main.liquidAlpha[10] < 0f) { Main.liquidAlpha[10] = 0f; } Main.liquidAlpha[9] += 0.2f; if (Main.liquidAlpha[9] > 1f) { Main.liquidAlpha[9] = 1f; } } if (Main.waterStyle == 10) { Main.liquidAlpha[0] -= 0.2f; if (Main.liquidAlpha[0] < 0f) { Main.liquidAlpha[0] = 0f; } Main.liquidAlpha[2] -= 0.2f; if (Main.liquidAlpha[2] < 0f) { Main.liquidAlpha[2] = 0f; } Main.liquidAlpha[3] -= 0.2f; if (Main.liquidAlpha[3] < 0f) { Main.liquidAlpha[3] = 0f; } Main.liquidAlpha[4] -= 0.2f; if (Main.liquidAlpha[4] < 0f) { Main.liquidAlpha[4] = 0f; } Main.liquidAlpha[5] -= 0.2f; if (Main.liquidAlpha[5] < 0f) { Main.liquidAlpha[5] = 0f; } Main.liquidAlpha[6] -= 0.2f; if (Main.liquidAlpha[6] < 0f) { Main.liquidAlpha[6] = 0f; } Main.liquidAlpha[7] -= 0.2f; if (Main.liquidAlpha[7] < 0f) { Main.liquidAlpha[7] = 0f; } Main.liquidAlpha[8] -= 0.2f; if (Main.liquidAlpha[8] < 0f) { Main.liquidAlpha[8] = 0f; } Main.liquidAlpha[9] -= 0.2f; if (Main.liquidAlpha[9] < 0f) { Main.liquidAlpha[9] = 0f; } Main.liquidAlpha[10] += 0.2f; if (Main.liquidAlpha[10] > 1f) { Main.liquidAlpha[10] = 1f; } } } Main.drewLava = false; if (Main.liquidAlpha[0] > 0f) { if (bg) { this.DrawWater(bg, 0, 1f); } else { this.DrawWater(bg, 0, Main.liquidAlpha[0]); } } if (Main.liquidAlpha[2] > 0f) { if (bg) { if (Main.waterStyle < 2) { this.DrawWater(bg, 2, Main.liquidAlpha[2]); } else { this.DrawWater(bg, 2, 1f); } } else { this.DrawWater(bg, 2, Main.liquidAlpha[2]); } } if (Main.liquidAlpha[3] > 0f) { if (bg) { if (Main.waterStyle < 3) { this.DrawWater(bg, 3, Main.liquidAlpha[3]); } else { this.DrawWater(bg, 3, 1f); } } else { this.DrawWater(bg, 3, Main.liquidAlpha[3]); } } if (Main.liquidAlpha[4] > 0f) { if (bg) { if (Main.waterStyle < 4) { this.DrawWater(bg, 4, Main.liquidAlpha[4]); } else { this.DrawWater(bg, 4, 1f); } } else { this.DrawWater(bg, 4, Main.liquidAlpha[4]); } } if (Main.liquidAlpha[5] > 0f) { if (bg) { if (Main.waterStyle < 5) { this.DrawWater(bg, 5, Main.liquidAlpha[5]); } else { this.DrawWater(bg, 5, 1f); } } else { this.DrawWater(bg, 5, Main.liquidAlpha[5]); } } if (Main.liquidAlpha[6] > 0f) { if (bg) { if (Main.waterStyle < 6) { this.DrawWater(bg, 6, Main.liquidAlpha[6]); } else { this.DrawWater(bg, 6, 1f); } } else { this.DrawWater(bg, 6, Main.liquidAlpha[6]); } } if (Main.liquidAlpha[7] > 0f) { if (bg) { if (Main.waterStyle < 7) { this.DrawWater(bg, 7, Main.liquidAlpha[7]); } else { this.DrawWater(bg, 7, 1f); } } else { this.DrawWater(bg, 7, Main.liquidAlpha[7]); } } if (Main.liquidAlpha[8] > 0f) { if (bg) { if (Main.waterStyle < 8) { this.DrawWater(bg, 8, Main.liquidAlpha[8]); } else { this.DrawWater(bg, 8, 1f); } } else { this.DrawWater(bg, 8, Main.liquidAlpha[8]); } } if (Main.liquidAlpha[9] > 0f) { if (bg) { if (Main.waterStyle < 9) { this.DrawWater(bg, 9, Main.liquidAlpha[9]); } else { this.DrawWater(bg, 9, 1f); } } else { this.DrawWater(bg, 9, Main.liquidAlpha[9]); } } if (Main.liquidAlpha[10] > 0f) { if (bg) { if (Main.waterStyle < 10) { this.DrawWater(bg, 10, Main.liquidAlpha[10]); return; } this.DrawWater(bg, 10, 1f); return; } else { this.DrawWater(bg, 10, Main.liquidAlpha[10]); } } } protected void DrawWaterfall(int Style = 0, float Alpha = 1f) { for (int i = 0; i < Main.wfTileNum; i++) { float num = 0f; int num2 = Main.waterfallDist; int num3 = 0; int num4 = Main.wfTileType[i]; int num5 = Main.wfTileX[i]; int num6 = Main.wfTileY[i]; int num7 = 0; int num8 = 0; int num9 = 0; int num10 = 0; int num11 = 0; int num12 = (int)(32f * Main.wFallFrame); if (num4 == 1 || num4 == 14) { num12 = (int)(32f * Main.wFallFrame2); } if (num4 == 11) { num12 = (int)(14f * Main.wFallFrame3); } if (num4 == 0) { num4 = Style; } if ((num4 != 1 && num4 != 2 && num4 != 11 && num4 != 14) || !Main.drewLava) { if (num4 == 11) { num2 /= 4; if ((float)(num6 + num2) >= Main.screenPosition.Y / 16f && (float)num5 >= Main.screenPosition.X / 16f - 1f && (float)num5 <= (Main.screenPosition.X + (float)Main.screenWidth) / 16f + 1f) { float num13 = Main.wFallFrame3; if (num5 % 2 == 0) { num13 += 3f; } while (num13 > 7f) { num13 -= 8f; } num12 = (int)(18f * num13); float num14 = Main.wFallFrame4; if (num5 % 2 == 0) { num14 += 2f; } if (num14 > 7f) { num14 -= 8f; } int x = (int)(18f * num14); for (int j = 0; j < num2; j++) { if (num <= -16f) { num5--; num += 16f; } if (num >= 16f) { num5++; num -= 16f; } if (num6 % 2 == 0) { num += 1f; } else { num -= 1f; } Color color = Lighting.GetColor(num5, num6); float num15 = 0.3f; num15 *= Alpha; if (j > num2 - 8) { float num16 = (float)(num2 - j) / 8f; num15 *= num16; } float num17 = (float)color.R * num15; float num18 = (float)color.G * num15; float num19 = (float)color.B * num15; float num20 = (float)color.A * num15; color = new Color((int)num17, (int)num18, (int)num19, (int)num20); SpriteEffects effects = SpriteEffects.None; this.spriteBatch.Draw(Main.waterfallTexture[12], new Vector2((float)(num5 * 16 + 8) + num, (float)(num6 * 16 + 8)) - Main.screenPosition, new Rectangle?(new Rectangle(x, 0, 16, 16)), color, 0f, new Vector2(8f, 8f), 1f, SpriteEffects.None, 0f); color = Lighting.GetColor(num5, num6); num15 = 0.6f; num15 *= Alpha; if (j > num2 - 8) { float num21 = (float)(num2 - j) / 8f; num15 *= num21; } num17 = (float)color.R * num15; num18 = (float)color.G * num15; num19 = (float)color.B * num15; num20 = (float)color.A * num15; color = new Color((int)num17, (int)num18, (int)num19, (int)num20); this.spriteBatch.Draw(Main.waterfallTexture[num4], new Vector2((float)(num5 * 16 + 8) + num, (float)(num6 * 16 + 8)) - Main.screenPosition, new Rectangle?(new Rectangle(num12, 0, 16, 16)), color, (float)Main.rand.Next(-100, 100) * 0.001f, new Vector2(8f, 8f), 1f, effects, 0f); num6++; if (WorldGen.SolidTile(num5, num6) || Main.tile[num5, num6].liquid > 64) { break; } } } } else { int num22 = 0; for (int k = 0; k < num2; k++) { if (num22 < 2) { if (num4 == 1) { float num23 = 0.55f; num23 += (float)(270 - (int)Main.mouseTextColor) / 900f; num23 *= 0.4f; float r = num23; float g = num23 * 0.3f; float num24 = num23 * 0.1f; Lighting.addLight(num5, num6, r, g, num24); } else { if (num4 == 2) { float num25 = (float)Main.DiscoR / 255f; float num26 = (float)Main.DiscoG / 255f; float num27 = (float)Main.DiscoB / 255f; num25 *= 0.2f; num26 *= 0.2f; num27 *= 0.2f; Lighting.addLight(num5, num6, num25, num26, num27); } } int num28 = (int)(Main.tile[num5, num6].liquid / 16); int num29 = 0; int num30 = num10; int num31; int num32; if (Main.tile[num5, num6 + 1].slope() != 0) { if (Main.tile[num5, num6 + 1].slope() == 1) { num29 = 1; num31 = 1; num9 = 1; num10 = num9; } else { num29 = -1; num31 = -1; num9 = -1; num10 = num9; } num32 = 1; } else { if (((!WorldGen.SolidTile(num5, num6 + 1) || Main.tile[num5, num6 + 1].type == 162) && !Main.tile[num5, num6].halfBrick()) || (!Main.tile[num5, num6 + 1].active() && !Main.tile[num5, num6].halfBrick())) { num22 = 0; num32 = 1; num31 = 0; } else { if ((WorldGen.SolidTile(num5 - 1, num6) || Main.tile[num5 - 1, num6].slope() != 0 || Main.tile[num5 - 1, num6].liquid > 0) && !WorldGen.SolidTile(num5 + 1, num6) && Main.tile[num5 + 1, num6].liquid == 0) { if (num9 == -1) { num22++; } num31 = 1; num32 = 0; num9 = 1; } else { if ((WorldGen.SolidTile(num5 + 1, num6) || Main.tile[num5 + 1, num6].slope() != 0 || Main.tile[num5 + 1, num6].liquid > 0) && !WorldGen.SolidTile(num5 - 1, num6) && Main.tile[num5 - 1, num6].liquid == 0) { if (num9 == 1) { num22++; } num31 = -1; num32 = 0; num9 = -1; } else { if (((!WorldGen.SolidTile(num5 + 1, num6) && Main.tile[num5, num6].slope() == 0) || Main.tile[num5 + 1, num6].liquid == 0) && !WorldGen.SolidTile(num5 - 1, num6) && Main.tile[num5, num6].slope() == 0 && Main.tile[num5 - 1, num6].liquid == 0) { num32 = 0; num31 = num9; } else { num22++; num32 = 0; num31 = 0; } } } } } if (num22 >= 2) { num9 *= -1; num31 *= -1; } if (Main.tile[num5, num6 + 1].active() && Main.tile[num5, num6 + 1].type == 160) { num4 = 2; } if (Main.tile[num5, num6].active() && Main.tile[num5, num6].type == 160) { num4 = 2; } if (WorldGen.SolidTile(num5, num6 + 1) && !Main.tile[num5, num6].halfBrick()) { num3 = 8; } else { if (num8 != 0) { num3 = 0; } } Color color2 = Lighting.GetColor(num5, num6); Color color3 = color2; float num33 = 0.6f; if (Main.tile[num5, num6].wall == 0 && (double)num6 < Main.worldSurface) { num33 = 1f; } num33 *= Alpha; if (num4 == 1) { num33 = 1f; } if (num4 == 14) { num33 = 0.8f; } if (k > num2 - 10) { float num34 = (float)(num2 - k) / 10f; num33 *= num34; } float num35 = (float)color2.R * num33; float num36 = (float)color2.G * num33; float num37 = (float)color2.B * num33; float num38 = (float)color2.A * num33; if (num4 == 1) { if (num35 < 190f * num33) { num35 = 190f * num33; } if (num36 < 190f * num33) { num36 = 190f * num33; } if (num37 < 190f * num33) { num37 = 190f * num33; } } else { if (num4 == 2) { num35 = (float)Main.DiscoR * num33; num36 = (float)Main.DiscoG * num33; num37 = (float)Main.DiscoB * num33; } } color2 = new Color((int)num35, (int)num36, (int)num37, (int)num38); if (k > 50 && (color3.R > 20 || color3.B > 20 || color3.G > 20)) { float num39 = (float)color3.R; if ((float)color3.G > num39) { num39 = (float)color3.G; } if ((float)color3.B > num39) { num39 = (float)color3.B; } num39 /= 30f; int num40 = Main.rand.Next(20000); if ((float)num40 < num39) { Color newColor = new Color(255, 255, 255); int num41 = Dust.NewDust(new Vector2((float)(num5 * 16 - num9 * 7), (float)(num6 * 16 + 6)), 10, 8, 43, 0f, 0f, 254, newColor, 0.5f); Main.dust[num41].velocity *= 0f; } } if (num7 == 0 && num29 != 0 && num8 == 1 && num9 != num10) { num29 = 0; num9 = num10; if (num9 == 1) { this.spriteBatch.Draw(Main.waterfallTexture[num4], new Vector2((float)(num5 * 16 - 16), (float)(num6 * 16 + 16)) - Main.screenPosition, new Rectangle?(new Rectangle(num12, 24, 32, 16 - num28)), color2, 0f, default(Vector2), 1f, SpriteEffects.FlipHorizontally, 0f); } else { this.spriteBatch.Draw(Main.waterfallTexture[num4], new Vector2((float)(num5 * 16 - 16), (float)(num6 * 16 + 16)) - Main.screenPosition, new Rectangle?(new Rectangle(num12, 24, 32, 8)), color2, 0f, default(Vector2), 1f, SpriteEffects.FlipHorizontally, 0f); } } if (num11 != 0 && num31 == 0 && num32 == 1) { if (num9 == 1) { this.spriteBatch.Draw(Main.waterfallTexture[num4], new Vector2((float)(num5 * 16), (float)(num6 * 16 + num3 + 8)) - Main.screenPosition, new Rectangle?(new Rectangle(num12, 0, 16, 16 - num28 - 8)), color2, 0f, default(Vector2), 1f, SpriteEffects.FlipHorizontally, 0f); } else { this.spriteBatch.Draw(Main.waterfallTexture[num4], new Vector2((float)(num5 * 16), (float)(num6 * 16 + num3 + 8)) - Main.screenPosition, new Rectangle?(new Rectangle(num12, 0, 16, 16 - num28 - 8)), color2, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } if (num3 == 8 && num8 == 1 && num11 == 0) { if (num10 == -1) { this.spriteBatch.Draw(Main.waterfallTexture[num4], new Vector2((float)(num5 * 16), (float)(num6 * 16)) - Main.screenPosition, new Rectangle?(new Rectangle(num12, 24, 32, 8)), color2, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } else { this.spriteBatch.Draw(Main.waterfallTexture[num4], new Vector2((float)(num5 * 16 - 16), (float)(num6 * 16)) - Main.screenPosition, new Rectangle?(new Rectangle(num12, 24, 32, 8)), color2, 0f, default(Vector2), 1f, SpriteEffects.FlipHorizontally, 0f); } } if (num29 != 0 && num7 == 0) { if (num30 == 1) { this.spriteBatch.Draw(Main.waterfallTexture[num4], new Vector2((float)(num5 * 16 - 16), (float)(num6 * 16)) - Main.screenPosition, new Rectangle?(new Rectangle(num12, 24, 32, 16 - num28)), color2, 0f, default(Vector2), 1f, SpriteEffects.FlipHorizontally, 0f); } else { this.spriteBatch.Draw(Main.waterfallTexture[num4], new Vector2((float)(num5 * 16), (float)(num6 * 16)) - Main.screenPosition, new Rectangle?(new Rectangle(num12, 24, 32, 16 - num28)), color2, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } if (num32 == 1 && num29 == 0 && num11 == 0) { if (num9 == -1) { if (num8 == 0) { this.spriteBatch.Draw(Main.waterfallTexture[num4], new Vector2((float)(num5 * 16), (float)(num6 * 16 + num3)) - Main.screenPosition, new Rectangle?(new Rectangle(num12, 0, 16, 16 - num28)), color2, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } else { this.spriteBatch.Draw(Main.waterfallTexture[num4], new Vector2((float)(num5 * 16), (float)(num6 * 16)) - Main.screenPosition, new Rectangle?(new Rectangle(num12, 24, 32, 16 - num28)), color2, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } else { if (num8 == 0) { this.spriteBatch.Draw(Main.waterfallTexture[num4], new Vector2((float)(num5 * 16), (float)(num6 * 16 + num3)) - Main.screenPosition, new Rectangle?(new Rectangle(num12, 0, 16, 16 - num28)), color2, 0f, default(Vector2), 1f, SpriteEffects.FlipHorizontally, 0f); } else { this.spriteBatch.Draw(Main.waterfallTexture[num4], new Vector2((float)(num5 * 16 - 16), (float)(num6 * 16)) - Main.screenPosition, new Rectangle?(new Rectangle(num12, 24, 32, 16 - num28)), color2, 0f, default(Vector2), 1f, SpriteEffects.FlipHorizontally, 0f); } } } else { if (num31 == 1) { if (Main.tile[num5, num6].liquid <= 0 || Main.tile[num5, num6].halfBrick()) { if (num29 == 1) { for (int l = 0; l < 8; l++) { int num42 = l * 2; int num43 = 14 - l * 2; int num44 = num42; num3 = 8; if (num7 == 0 && l < 2) { num44 = 4; } this.spriteBatch.Draw(Main.waterfallTexture[num4], new Vector2((float)(num5 * 16 + num42), (float)(num6 * 16 + num3 + num44)) - Main.screenPosition, new Rectangle?(new Rectangle(16 + num12 + num43, 0, 2, 16 - num3)), color2, 0f, default(Vector2), 1f, SpriteEffects.FlipHorizontally, 0f); } } else { this.spriteBatch.Draw(Main.waterfallTexture[num4], new Vector2((float)(num5 * 16), (float)(num6 * 16 + num3)) - Main.screenPosition, new Rectangle?(new Rectangle(16 + num12, 0, 16, 16)), color2, 0f, default(Vector2), 1f, SpriteEffects.FlipHorizontally, 0f); } } } else { if (num31 == -1) { if (Main.tile[num5, num6].liquid <= 0 || Main.tile[num5, num6].halfBrick()) { if (num29 == -1) { for (int m = 0; m < 8; m++) { int num45 = m * 2; int num46 = m * 2; int num47 = 14 - m * 2; num3 = 8; if (num7 == 0 && m > 5) { num47 = 4; } this.spriteBatch.Draw(Main.waterfallTexture[num4], new Vector2((float)(num5 * 16 + num45), (float)(num6 * 16 + num3 + num47)) - Main.screenPosition, new Rectangle?(new Rectangle(16 + num12 + num46, 0, 2, 16 - num3)), color2, 0f, default(Vector2), 1f, SpriteEffects.FlipHorizontally, 0f); } } else { this.spriteBatch.Draw(Main.waterfallTexture[num4], new Vector2((float)(num5 * 16), (float)(num6 * 16 + num3)) - Main.screenPosition, new Rectangle?(new Rectangle(16 + num12, 0, 16, 16)), color2, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } } else { if (num31 == 0 && num32 == 0) { if (Main.tile[num5, num6].liquid <= 0 || Main.tile[num5, num6].halfBrick()) { this.spriteBatch.Draw(Main.waterfallTexture[num4], new Vector2((float)(num5 * 16), (float)(num6 * 16 + num3)) - Main.screenPosition, new Rectangle?(new Rectangle(16 + num12, 0, 16, 16)), color2, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } k = 1000; } } } } if (Main.tile[num5, num6].liquid > 0 && !Main.tile[num5, num6].halfBrick()) { k = 1000; } num8 = num32; num10 = num9; num7 = num31; num5 += num31; num6 += num32; num11 = num29; if ((Main.tile[num5 - 1, num6].active() && (Main.tile[num5 - 1, num6].type == 189 || Main.tile[num5 - 1, num6].type == 196)) || (Main.tile[num5 + 1, num6].active() && (Main.tile[num5 + 1, num6].type == 189 || Main.tile[num5 + 1, num6].type == 196)) || (Main.tile[num5, num6 + 1].active() && (Main.tile[num5, num6 + 1].type == 189 || Main.tile[num5, num6 + 1].type == 196))) { float num48 = (float)(Main.maxTilesX / 4200); num2 = (int)(40f * num48 * Main.gfxQuality); } } } } } } } public static int GetTreeStyle(int X) { int num; if (X <= Main.treeX[0]) { num = Main.treeStyle[0]; } else { if (X <= Main.treeX[1]) { num = Main.treeStyle[1]; } else { if (X <= Main.treeX[2]) { num = Main.treeStyle[2]; } else { num = Main.treeStyle[3]; } } } if (num == 0) { return 0; } if (num == 5) { return 10; } return 5 + num; } protected void lookForColorTiles() { int num = (int)(Main.screenPosition.X / 16f - 2f); int num2 = (int)((Main.screenPosition.X + (float)Main.screenWidth) / 16f) + 3; int num3 = (int)(Main.screenPosition.Y / 16f - 2f); int num4 = (int)((Main.screenPosition.Y + (float)Main.screenHeight) / 16f) + 3; if (num < 1) { num = 1; } if (num2 > Main.maxTilesX - 2) { num = Main.maxTilesX - 2; } for (int i = num; i < num2; i++) { if (i > 0) { for (int j = num3; j < num4; j++) { if (Main.tile[i, j] != null) { if (Main.tile[i, j].active() && Main.tile[i, j].color() > 0) { this.tileColorCheck((int)Main.tile[i, j].type, (int)Main.tile[i, j].color()); } if (Main.tile[i, j].wall > 0 && Main.tile[i, j].wallColor() > 0) { this.wallColorCheck((int)Main.tile[i, j].wall, (int)Main.tile[i, j].wallColor()); } } } } } for (int k = 0; k < Main.numTreeStyles; k++) { for (int l = 0; l < Main.numTileColors; l++) { if (Main.checkTreeAlt[k, l]) { this.treeColorCheck(k, l); Main.checkTreeAlt[k, l] = false; } } } } 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(base.GraphicsDevice, Main.tileTexture[t].Width, Main.tileTexture[t].Height, false, base.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]) { base.GraphicsDevice.SetRenderTarget(Main.tileAltTexture[t, c]); base.GraphicsDevice.Clear(new Color(0, 0, 0, 0)); this.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); if (c > 0 && c < 13 && (t == 0 || t == 2 || t == 5 || t == 23 || t == 59 || t == 60 || t == 70 || t == 109 || t == 199)) { int index = c + 27; Main.tileShader.CurrentTechnique.Passes[index].Apply(); } else { Main.tileShader.CurrentTechnique.Passes[c].Apply(); } this.spriteBatch.Draw(Main.tileTexture[t], new Rectangle(0, 0, Main.tileTexture[t].Width, Main.tileTexture[t].Height), Color.White); this.spriteBatch.End(); base.GraphicsDevice.SetRenderTarget(null); Main.tileAltTextureDrawn[t, c] = true; } } protected void treeColorCheck(int t, int c) { if (!Main.treeAltTextureInit[t, c]) { Main.treeTopAltTexture[t, c] = new RenderTarget2D(base.GraphicsDevice, Main.treeTopTexture[t].Width, Main.treeTopTexture[t].Height, false, base.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24, 0, RenderTargetUsage.PreserveContents); Main.treeBranchAltTexture[t, c] = new RenderTarget2D(base.GraphicsDevice, Main.treeBranchTexture[t].Width, Main.treeBranchTexture[t].Height, false, base.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]) { base.GraphicsDevice.SetRenderTarget(Main.treeTopAltTexture[t, c]); base.GraphicsDevice.Clear(new Color(0, 0, 0, 0)); this.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); if (c > 0 && c < 13) { int index = c + 27; Main.tileShader.CurrentTechnique.Passes[index].Apply(); } else { Main.tileShader.CurrentTechnique.Passes[c].Apply(); } this.spriteBatch.Draw(Main.treeTopTexture[t], new Rectangle(0, 0, Main.treeTopTexture[t].Width, Main.treeTopTexture[t].Height), Color.White); this.spriteBatch.End(); base.GraphicsDevice.SetRenderTarget(null); base.GraphicsDevice.SetRenderTarget(Main.treeBranchAltTexture[t, c]); base.GraphicsDevice.Clear(new Color(0, 0, 0, 0)); this.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); if (c > 0 && c < 13) { int index2 = c + 27; Main.tileShader.CurrentTechnique.Passes[index2].Apply(); } else { Main.tileShader.CurrentTechnique.Passes[c].Apply(); } this.spriteBatch.Draw(Main.treeBranchTexture[t], new Rectangle(0, 0, Main.treeBranchTexture[t].Width, Main.treeBranchTexture[t].Height), Color.White); this.spriteBatch.End(); base.GraphicsDevice.SetRenderTarget(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(base.GraphicsDevice, Main.wallTexture[t].Width, Main.wallTexture[t].Height, false, base.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]) { base.GraphicsDevice.SetRenderTarget(Main.wallAltTexture[t, c]); base.GraphicsDevice.Clear(new Color(0, 0, 0, 0)); this.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend); Main.tileShader.CurrentTechnique.Passes[c].Apply(); this.spriteBatch.Draw(Main.wallTexture[t], new Rectangle(0, 0, Main.wallTexture[t].Width, Main.wallTexture[t].Height), Color.White); this.spriteBatch.End(); base.GraphicsDevice.SetRenderTarget(null); Main.wallAltTextureDrawn[t, c] = true; } } public void UpdateWeather() { Main.cloudLimit = 200; if (Main.windSpeed < Main.windSpeedSet) { Main.windSpeed += 0.001f * (float)Main.dayRate; if (Main.windSpeed > Main.windSpeedSet) { Main.windSpeed = Main.windSpeedSet; } } else { if (Main.windSpeed > Main.windSpeedSet) { Main.windSpeed -= 0.001f * (float)Main.dayRate; if (Main.windSpeed < Main.windSpeedSet) { Main.windSpeed = Main.windSpeedSet; } } } if (Main.netMode == 1) { return; } if (Main.netMode != 2 && Main.gameMenu) { return; } 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 = -0.002f; } if ((double)Main.windSpeedSpeed > 0.002) { Main.windSpeedSpeed = 0.002f; } Main.windSpeedTemp += Main.windSpeedSpeed; if (Main.raining) { Main.windSpeedTemp += Main.windSpeedSpeed * 2f; } float num = 0.3f + 0.5f * Main.cloudAlpha; if (Main.windSpeedTemp < -num) { Main.windSpeedTemp = -num; } if (Main.windSpeedTemp > num) { Main.windSpeedTemp = num; } if (Main.rand.Next(60) == 0) { Main.numCloudsTemp += Main.rand.Next(-1, 2); } if ((float)Main.rand.Next(1000) < 50f * Main.cloudBGAlpha) { Main.numCloudsTemp++; } if ((float)Main.rand.Next(1000) < 25f * (1f - Main.cloudBGAlpha)) { Main.numCloudsTemp--; } if ((float)Main.rand.Next(1000) < 200f * Main.cloudAlpha && Main.numCloudsTemp < Main.cloudLimit / 2) { Main.numCloudsTemp++; } if ((float)Main.rand.Next(1000) < 50f * 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 (Main.cloudBGActive <= 0f && Main.numCloudsTemp > Main.cloudLimit / 2 && Main.cloudAlpha == 0f) { 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) { Main.numClouds = Main.numCloudsTemp; Main.windSpeedSet = Main.windSpeedTemp; Main.weatherCounter = Main.rand.Next(3600, 18000); if (Main.netMode == 2) { NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0); } } } protected void LoadBackground(int i) { if (i >= 0 && !Main.backgroundLoaded[i]) { Main.backgroundTexture[i] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Background_", 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) { Main.npcTexture[i] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "NPC_", i })); Main.NPCLoaded[i] = true; } } protected void LoadProjectile(int i) { if (!Main.projectileLoaded[i]) { Main.projectileTexture[i] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Projectile_", i })); Main.projectileLoaded[i] = true; } } protected void LoadGore(int i) { if (!Main.goreLoaded[i]) { Main.goreTexture[i] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Gore_", i })); Main.goreLoaded[i] = true; } } protected void LoadWall(int i) { if (!Main.wallLoaded[i]) { Main.wallTexture[i] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Wall_", i })); Main.wallLoaded[i] = true; } } protected void LoadTiles(int i) { if (!Main.tileSetsLoaded[i]) { Main.tileTexture[i] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Tiles_", i })); Main.tileSetsLoaded[i] = true; } } protected void LoadItemFlames(int i) { if (!Main.itemFlameLoaded[i]) { try { Main.itemFlameTexture[i] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "ItemFlame_", i })); } catch { } Main.itemFlameLoaded[i] = true; } } protected void LoadWings(int i) { if (!Main.wingsLoaded[i]) { Main.wingsTexture[i] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Wings_", i })); Main.wingsLoaded[i] = true; } } protected void LoadHair(int i) { if (!Main.hairLoaded[i]) { Main.playerHairTexture[i] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Player_Hair_", i + 1 })); Main.playerHairAltTexture[i] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Player_HairAlt_", i + 1 })); Main.hairLoaded[i] = true; } } protected void LoadArmorHead(int i) { if (!Main.armorHeadLoaded[i]) { Main.armorHeadTexture[i] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Armor_Head_", i })); Main.armorHeadLoaded[i] = true; } } protected void LoadArmorBody(int i) { if (!Main.armorBodyLoaded[i]) { Main.femaleBodyTexture[i] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Female_Body_", i })); Main.armorBodyTexture[i] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Armor_Body_", i })); Main.armorArmTexture[i] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Armor_Arm_", i })); Main.armorBodyLoaded[i] = true; } } protected void LoadArmorLegs(int i) { if (!Main.armorLegsLoaded[i]) { Main.armorLegTexture[i] = base.Content.Load(string.Concat(new object[] { "Images", Path.DirectorySeparatorChar, "Armor_Legs_", i })); Main.armorLegsLoaded[i] = true; } } protected void DrawSurfaceBG() { if (!Main.mapFullscreen && (double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int i = 0; i < 200; i++) { if (Main.cloud[i].active && Main.cloud[i].scale < 1f) { Color color = Main.cloud[i].cloudColor(Main.bgColor); float num = Main.cloud[i].scale * 0.8f; float num2 = (Main.cloud[i].scale + 1f) / 2f * 0.9f; color.R = (byte)((float)color.R * num); color.G = (byte)((float)color.G * num2); Main.atmo = 1f; if (Main.atmo < 1f) { color.R = (byte)((float)color.R * Main.atmo); color.G = (byte)((float)color.G * Main.atmo); color.B = (byte)((float)color.B * Main.atmo); color.A = (byte)((float)color.A * Main.atmo); } float num3 = Main.cloud[i].position.Y * ((float)Main.screenHeight / 600f); num3 = Main.cloud[i].position.Y + (float)((int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (Main.worldSurface * 16.0) * 750.0 + 830.0)) + (float)((int)this.scAdj); this.spriteBatch.Draw(Main.cloudTexture[Main.cloud[i].type], new Vector2(Main.cloud[i].position.X + (float)Main.cloudTexture[Main.cloud[i].type].Width * 0.5f, num3 + (float)Main.cloudTexture[Main.cloud[i].type].Height * 0.5f), new Rectangle?(new Rectangle(0, 0, Main.cloudTexture[Main.cloud[i].type].Width, Main.cloudTexture[Main.cloud[i].type].Height)), color, Main.cloud[i].rotation, new Vector2((float)Main.cloudTexture[Main.cloud[i].type].Width * 0.5f, (float)Main.cloudTexture[Main.cloud[i].type].Height * 0.5f), Main.cloud[i].scale, Main.cloud[i].spriteDir, 0f); } } } Main.atmo = 1f; Main.bgScale *= 2f; this.bgParrallax = 0.15; if (Main.atmo < 1f) { Main.backColor.R = (byte)((float)Main.backColor.R * Main.atmo); Main.backColor.G = (byte)((float)Main.backColor.G * Main.atmo); Main.backColor.B = (byte)((float)Main.backColor.B * Main.atmo); Main.backColor.A = (byte)((float)Main.backColor.A * Main.atmo); } if (!Main.mapFullscreen && (double)(Main.screenPosition.Y / 16f) <= Main.worldSurface + 10.0) { if (Main.owBack) { if (Main.cloudBGActive > 0f) { Main.cloudBGAlpha += 0.0005f * (float)Main.dayRate; if (Main.cloudBGAlpha > 1f) { Main.cloudBGAlpha = 1f; } } else { Main.cloudBGAlpha -= 0.0005f * (float)Main.dayRate; if (Main.cloudBGAlpha < 0f) { Main.cloudBGAlpha = 0f; } } if (Main.cloudBGAlpha > 0f) { this.LoadBackground(Main.cloudBG[0]); this.LoadBackground(Main.cloudBG[1]); Main.bgScale *= 2f; this.bgParrallax = 0.15; float num4 = Main.cloudBGAlpha; if (num4 > 1f) { num4 = 1f; } Main.bgScale = 1.65f; this.bgParrallax = 0.090000003576278687; if (base.IsActive) { Main.cloudBGX[0] += Main.windSpeed * (float)this.bgParrallax * 5f * (float)Main.dayRate; } if (Main.cloudBGX[0] > (float)Main.backgroundWidth[Main.cloudBG[0]] * Main.bgScale) { Main.cloudBGX[0] -= (float)Main.backgroundWidth[Main.cloudBG[0]] * Main.bgScale; } if (Main.cloudBGX[0] < (float)(-(float)Main.backgroundWidth[Main.cloudBG[0]]) * Main.bgScale) { Main.cloudBGX[0] += (float)Main.backgroundWidth[Main.cloudBG[0]] * Main.bgScale; } Main.bgW = (int)((float)Main.backgroundWidth[Main.cloudBG[0]] * Main.bgScale); this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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.bgParrallax, (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)((float)Main.backColor.R * num4); Main.backColor.G = (byte)((float)Main.backColor.G * num4); Main.backColor.B = (byte)((float)Main.backColor.B * num4); Main.backColor.A = (byte)((float)Main.backColor.A * num4); for (int j = 0; j < this.bgLoops; j++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.cloudBG[0]], new Vector2((float)(this.bgStart + Main.bgW * j), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[Main.cloudBG[0]], Main.backgroundHeight[Main.cloudBG[0]])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } num4 = Main.cloudBGAlpha * 1.5f; if (num4 > 1f) { num4 = 1f; } Main.backColor = Main.trueBackColor; Main.backColor.R = (byte)((float)Main.backColor.R * num4); Main.backColor.G = (byte)((float)Main.backColor.G * num4); Main.backColor.B = (byte)((float)Main.backColor.B * num4); Main.backColor.A = (byte)((float)Main.backColor.A * num4); Main.bgScale = 1.85f; this.bgParrallax = 0.12; if (base.IsActive) { Main.cloudBGX[1] += Main.windSpeed * (float)this.bgParrallax * 5f * (float)Main.dayRate; } if (Main.cloudBGX[1] > (float)Main.backgroundWidth[Main.cloudBG[1]] * Main.bgScale) { Main.cloudBGX[1] -= (float)Main.backgroundWidth[Main.cloudBG[1]] * Main.bgScale; } if (Main.cloudBGX[1] < (float)(-(float)Main.backgroundWidth[Main.cloudBG[1]]) * Main.bgScale) { Main.cloudBGX[1] += (float)Main.backgroundWidth[Main.cloudBG[1]] * Main.bgScale; } Main.bgW = (int)((float)Main.backgroundWidth[Main.cloudBG[1]] * Main.bgScale); this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2) - (double)Main.bgW); this.bgStart += (int)Main.cloudBGX[1]; this.bgLoops = Main.screenWidth / Main.bgW + 2 + 2; for (int k = 0; k < this.bgLoops; k++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.cloudBG[1]], new Vector2((float)(this.bgStart + Main.bgW * k), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[Main.cloudBG[1]], Main.backgroundHeight[Main.cloudBG[1]])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } this.LoadBackground(Main.treeMntBG[0]); this.LoadBackground(Main.treeMntBG[1]); Main.bgScale = 1f; this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (Main.worldSurface * 16.0) * 1300.0 + 1090.0) + (int)this.scAdj; Main.bgScale *= 2f; this.bgParrallax = 0.15; Main.bgW = (int)((float)Main.backgroundWidth[Main.treeMntBG[0]] * Main.bgScale); this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); 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)((float)Main.backColor.R * Main.bgAlpha2[0]); Main.backColor.G = (byte)((float)Main.backColor.G * Main.bgAlpha2[0]); Main.backColor.B = (byte)((float)Main.backColor.B * Main.bgAlpha2[0]); Main.backColor.A = (byte)((float)Main.backColor.A * Main.bgAlpha2[0]); if (Main.bgAlpha2[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; } for (int l = 0; l < this.bgLoops; l++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.treeMntBG[0]], new Vector2((float)(this.bgStart + Main.bgW * l), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[Main.treeMntBG[0]], Main.backgroundHeight[Main.treeMntBG[0]])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 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)((float)Main.backColor.R * Main.bgAlpha2[1]); Main.backColor.G = (byte)((float)Main.backColor.G * Main.bgAlpha2[1]); Main.backColor.B = (byte)((float)Main.backColor.B * Main.bgAlpha2[1]); Main.backColor.A = (byte)((float)Main.backColor.A * Main.bgAlpha2[1]); if (Main.bgAlpha2[1] > 0f) { this.LoadBackground(23); for (int m = 0; m < this.bgLoops; m++) { this.spriteBatch.Draw(Main.backgroundTexture[23], new Vector2((float)(this.bgStart + Main.bgW * m), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[23], Main.backgroundHeight[23])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } Main.backColor = Main.trueBackColor; Main.backColor.R = (byte)((float)Main.backColor.R * Main.bgAlpha2[2]); Main.backColor.G = (byte)((float)Main.backColor.G * Main.bgAlpha2[2]); Main.backColor.B = (byte)((float)Main.backColor.B * Main.bgAlpha2[2]); Main.backColor.A = (byte)((float)Main.backColor.A * Main.bgAlpha2[2]); if (Main.bgAlpha2[2] > 0f) { this.LoadBackground(24); for (int n = 0; n < this.bgLoops; n++) { this.spriteBatch.Draw(Main.backgroundTexture[24], new Vector2((float)(this.bgStart + Main.bgW * n), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[24], Main.backgroundHeight[24])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } Main.backColor = Main.trueBackColor; Main.backColor.R = (byte)((float)Main.backColor.R * Main.bgAlpha2[4]); Main.backColor.G = (byte)((float)Main.backColor.G * Main.bgAlpha2[4]); Main.backColor.B = (byte)((float)Main.backColor.B * Main.bgAlpha2[4]); Main.backColor.A = (byte)((float)Main.backColor.A * Main.bgAlpha2[4]); if (Main.bgAlpha2[4] > 0f) { this.LoadBackground(Main.snowMntBG[0]); for (int num5 = 0; num5 < this.bgLoops; num5++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.snowMntBG[0]], new Vector2((float)(this.bgStart + Main.bgW * num5), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[Main.snowMntBG[0]], Main.backgroundHeight[Main.snowMntBG[0]])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } Main.backColor = Main.trueBackColor; Main.backColor.R = (byte)((float)Main.backColor.R * Main.bgAlpha2[5]); Main.backColor.G = (byte)((float)Main.backColor.G * Main.bgAlpha2[5]); Main.backColor.B = (byte)((float)Main.backColor.B * Main.bgAlpha2[5]); Main.backColor.A = (byte)((float)Main.backColor.A * Main.bgAlpha2[5]); if (Main.bgAlpha2[5] > 0f) { this.LoadBackground(24); for (int num6 = 0; num6 < this.bgLoops; num6++) { this.spriteBatch.Draw(Main.backgroundTexture[24], new Vector2((float)(this.bgStart + Main.bgW * num6), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[24], Main.backgroundHeight[24])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } } } this.cTop = (float)(this.bgTop - 50); if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int num7 = 0; num7 < 200; num7++) { if (Main.cloud[num7].active && (double)Main.cloud[num7].scale < 1.15 && Main.cloud[num7].scale >= 1f) { Color color2 = Main.cloud[num7].cloudColor(Main.bgColor); if (Main.atmo < 1f) { color2.R = (byte)((float)color2.R * Main.atmo); color2.G = (byte)((float)color2.G * Main.atmo); color2.B = (byte)((float)color2.B * Main.atmo); color2.A = (byte)((float)color2.A * Main.atmo); } float num8 = Main.cloud[num7].position.Y * ((float)Main.screenHeight / 600f); float num9 = (float)((double)(Main.screenPosition.Y / 16f - 24f) / Main.worldSurface); if (num9 < 0f) { num9 = 0f; } if (num9 > 1f) { } if (Main.gameMenu) { } this.spriteBatch.Draw(Main.cloudTexture[Main.cloud[num7].type], new Vector2(Main.cloud[num7].position.X + (float)Main.cloudTexture[Main.cloud[num7].type].Width * 0.5f, num8 + (float)Main.cloudTexture[Main.cloud[num7].type].Height * 0.5f + this.cTop + 200f), new Rectangle?(new Rectangle(0, 0, Main.cloudTexture[Main.cloud[num7].type].Width, Main.cloudTexture[Main.cloud[num7].type].Height)), color2, Main.cloud[num7].rotation, new Vector2((float)Main.cloudTexture[Main.cloud[num7].type].Width * 0.5f, (float)Main.cloudTexture[Main.cloud[num7].type].Height * 0.5f), Main.cloud[num7].scale, Main.cloud[num7].spriteDir, 0f); } } } if (Main.holyTiles > 0 && Main.owBack) { this.bgParrallax = 0.17; Main.bgScale = 1.1f; Main.bgScale *= 2f; Main.bgW = (int)((double)(3500f * Main.bgScale) * 1.05); this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); this.bgLoops = Main.screenWidth / Main.bgW + 2; this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (Main.worldSurface * 16.0) * 1400.0 + 900.0) + (int)this.scAdj; if (Main.gameMenu) { this.bgTop = 230; this.bgStart -= 500; } Color color3 = Main.trueBackColor; float num10 = (float)Main.holyTiles / 400f; if (num10 > 0.5f) { num10 = 0.5f; } color3.R = (byte)((float)color3.R * num10); color3.G = (byte)((float)color3.G * num10); color3.B = (byte)((float)color3.B * num10); color3.A = (byte)((float)color3.A * num10 * 0.8f); if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { this.LoadBackground(18); this.LoadBackground(19); for (int num11 = 0; num11 < this.bgLoops; num11++) { this.spriteBatch.Draw(Main.backgroundTexture[18], new Vector2((float)(this.bgStart + Main.bgW * num11), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[18], Main.backgroundHeight[18])), color3, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); this.spriteBatch.Draw(Main.backgroundTexture[19], new Vector2((float)(this.bgStart + Main.bgW * num11 + 1700), (float)(this.bgTop + 100)), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[19], Main.backgroundHeight[19])), color3, 0f, default(Vector2), Main.bgScale * 0.9f, SpriteEffects.None, 0f); } } } if (Main.treeMntBG[1] > -1) { this.LoadBackground(Main.treeMntBG[1]); this.bgParrallax = 0.2; Main.bgScale = 1.15f; Main.bgScale *= 2f; Main.bgW = (int)((float)Main.backgroundWidth[Main.treeMntBG[1]] * Main.bgScale); this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); this.bgLoops = Main.screenWidth / Main.bgW + 2; this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (Main.worldSurface * 16.0) * 1400.0 + 1260.0) + (int)this.scAdj; } if (Main.owBack) { if (Main.gameMenu) { this.bgTop = 230; this.bgStart -= 500; } if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { Main.backColor = Main.trueBackColor; Main.backColor.R = (byte)((float)Main.backColor.R * Main.bgAlpha2[0]); Main.backColor.G = (byte)((float)Main.backColor.G * Main.bgAlpha2[0]); Main.backColor.B = (byte)((float)Main.backColor.B * Main.bgAlpha2[0]); Main.backColor.A = (byte)((float)Main.backColor.A * Main.bgAlpha2[0]); if (Main.bgAlpha2[0] > 0f && 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 num12 = 0; num12 < this.bgLoops; num12++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.treeMntBG[1]], new Vector2((float)(this.bgStart + Main.bgW * num12), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[Main.treeMntBG[1]], Main.backgroundHeight[Main.treeMntBG[1]])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 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)((float)Main.backColor.R * Main.bgAlpha2[1]); Main.backColor.G = (byte)((float)Main.backColor.G * Main.bgAlpha2[1]); Main.backColor.B = (byte)((float)Main.backColor.B * Main.bgAlpha2[1]); Main.backColor.A = (byte)((float)Main.backColor.A * Main.bgAlpha2[1]); if (Main.bgAlpha2[1] > 0f) { this.LoadBackground(22); for (int num13 = 0; num13 < this.bgLoops; num13++) { this.spriteBatch.Draw(Main.backgroundTexture[22], new Vector2((float)(this.bgStart + Main.bgW * num13), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[22], Main.backgroundHeight[22])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } Main.backColor = Main.trueBackColor; Main.backColor.R = (byte)((float)Main.backColor.R * Main.bgAlpha2[2]); Main.backColor.G = (byte)((float)Main.backColor.G * Main.bgAlpha2[2]); Main.backColor.B = (byte)((float)Main.backColor.B * Main.bgAlpha2[2]); Main.backColor.A = (byte)((float)Main.backColor.A * Main.bgAlpha2[2]); if (Main.bgAlpha2[2] > 0f) { this.LoadBackground(25); for (int num14 = 0; num14 < this.bgLoops; num14++) { this.spriteBatch.Draw(Main.backgroundTexture[25], new Vector2((float)(this.bgStart + Main.bgW * num14), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[25], Main.backgroundHeight[25])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } Main.backColor = Main.trueBackColor; Main.backColor.R = (byte)((float)Main.backColor.R * Main.bgAlpha2[3]); Main.backColor.G = (byte)((float)Main.backColor.G * Main.bgAlpha2[3]); Main.backColor.B = (byte)((float)Main.backColor.B * Main.bgAlpha2[3]); Main.backColor.A = (byte)((float)Main.backColor.A * Main.bgAlpha2[3]); if (Main.bgAlpha2[3] > 0f) { this.LoadBackground(Main.oceanBG); for (int num15 = 0; num15 < this.bgLoops; num15++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.oceanBG], new Vector2((float)(this.bgStart + Main.bgW * num15), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[Main.oceanBG], Main.backgroundHeight[Main.oceanBG])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } Main.backColor = Main.trueBackColor; Main.backColor.R = (byte)((float)Main.backColor.R * Main.bgAlpha2[4]); Main.backColor.G = (byte)((float)Main.backColor.G * Main.bgAlpha2[4]); Main.backColor.B = (byte)((float)Main.backColor.B * Main.bgAlpha2[4]); Main.backColor.A = (byte)((float)Main.backColor.A * Main.bgAlpha2[4]); if (Main.bgAlpha2[4] > 0f) { this.LoadBackground(Main.snowMntBG[1]); for (int num16 = 0; num16 < this.bgLoops; num16++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.snowMntBG[1]], new Vector2((float)(this.bgStart + Main.bgW * num16), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[Main.snowMntBG[1]], Main.backgroundHeight[Main.snowMntBG[1]])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } Main.backColor = Main.trueBackColor; Main.backColor.R = (byte)((float)Main.backColor.R * Main.bgAlpha2[5]); Main.backColor.G = (byte)((float)Main.backColor.G * Main.bgAlpha2[5]); Main.backColor.B = (byte)((float)Main.backColor.B * Main.bgAlpha2[5]); Main.backColor.A = (byte)((float)Main.backColor.A * Main.bgAlpha2[5]); if (Main.bgAlpha2[5] > 0f) { this.LoadBackground(42); for (int num17 = 0; num17 < this.bgLoops; num17++) { this.spriteBatch.Draw(Main.backgroundTexture[42], new Vector2((float)(this.bgStart + Main.bgW * num17), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[42], Main.backgroundHeight[42])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } } } this.cTop = (float)this.bgTop * 1.01f - 150f; if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int num18 = 0; num18 < 200; num18++) { if (Main.cloud[num18].active && Main.cloud[num18].scale >= 1.15f) { Color color4 = Main.cloud[num18].cloudColor(Main.bgColor); if (Main.atmo < 1f) { color4.R = (byte)((float)color4.R * Main.atmo); color4.G = (byte)((float)color4.G * Main.atmo); color4.B = (byte)((float)color4.B * Main.atmo); color4.A = (byte)((float)color4.A * Main.atmo); } float num19 = Main.cloud[num18].position.Y * ((float)Main.screenHeight / 600f) - 100f; float num20 = (float)((double)(Main.screenPosition.Y / 16f - 24f) / Main.worldSurface); if (num20 < 0f) { num20 = 0f; } if (num20 > 1f) { } if (Main.gameMenu) { } this.spriteBatch.Draw(Main.cloudTexture[Main.cloud[num18].type], new Vector2(Main.cloud[num18].position.X + (float)Main.cloudTexture[Main.cloud[num18].type].Width * 0.5f, num19 + (float)Main.cloudTexture[Main.cloud[num18].type].Height * 0.5f + this.cTop), new Rectangle?(new Rectangle(0, 0, Main.cloudTexture[Main.cloud[num18].type].Width, Main.cloudTexture[Main.cloud[num18].type].Height)), color4, Main.cloud[num18].rotation, new Vector2((float)Main.cloudTexture[Main.cloud[num18].type].Width * 0.5f, (float)Main.cloudTexture[Main.cloud[num18].type].Height * 0.5f), Main.cloud[num18].scale, Main.cloud[num18].spriteDir, 0f); } } } } if (!Main.mapFullscreen) { for (int num21 = 0; num21 < 10; num21++) { if (Main.bgStyle == num21) { Main.bgAlpha[num21] += Main.tranSpeed; if (Main.bgAlpha[num21] > 1f) { Main.bgAlpha[num21] = 1f; } } else { Main.bgAlpha[num21] -= Main.tranSpeed; if (Main.bgAlpha[num21] < 0f) { Main.bgAlpha[num21] = 0f; } } if (Main.owBack) { Main.backColor = Main.trueBackColor; Main.backColor.R = (byte)((float)Main.backColor.R * Main.bgAlpha[num21]); Main.backColor.G = (byte)((float)Main.backColor.G * Main.bgAlpha[num21]); Main.backColor.B = (byte)((float)Main.backColor.B * Main.bgAlpha[num21]); Main.backColor.A = (byte)((float)Main.backColor.A * Main.bgAlpha[num21]); if (Main.bgAlpha[num21] > 0f && num21 == 3) { this.LoadBackground(Main.jungleBG[0]); Main.bgScale = 1.25f; Main.bgScale *= 2f; Main.bgW = (int)((float)Main.backgroundWidth[Main.jungleBG[0]] * Main.bgScale); this.bgParrallax = 0.4; this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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 num22 = 0; num22 < this.bgLoops; num22++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.jungleBG[0]], new Vector2((float)(this.bgStart + Main.bgW * num22), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[Main.jungleBG[0]], Main.backgroundHeight[Main.jungleBG[0]])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } this.LoadBackground(Main.jungleBG[1]); Main.bgScale = 1.31f; Main.bgScale *= 2f; Main.bgW = (int)((float)Main.backgroundWidth[Main.jungleBG[1]] * Main.bgScale); this.bgParrallax = 0.43; this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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 num23 = 0; num23 < this.bgLoops; num23++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.jungleBG[1]], new Vector2((float)(this.bgStart + Main.bgW * num23), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[Main.jungleBG[1]], Main.backgroundHeight[Main.jungleBG[1]])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.FlipHorizontally, 0f); } } Main.bgScale = 1.34f; Main.bgScale *= 2f; this.LoadBackground(Main.jungleBG[2]); Main.bgW = (int)((float)Main.backgroundWidth[Main.jungleBG[2]] * Main.bgScale); this.bgParrallax = 0.49; this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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 num24 = 0; num24 < this.bgLoops; num24++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.jungleBG[2]], new Vector2((float)(this.bgStart + Main.bgW * num24), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[Main.jungleBG[2]], Main.backgroundHeight[Main.jungleBG[2]])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } } if (Main.bgAlpha[num21] > 0f && num21 == 2) { this.LoadBackground(Main.desertBG[0]); Main.bgScale = 1.25f; Main.bgScale *= 2f; Main.bgW = (int)((float)Main.backgroundWidth[Main.desertBG[0]] * Main.bgScale); this.bgParrallax = 0.37; this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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 num25 = 0; num25 < this.bgLoops; num25++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.desertBG[0]], new Vector2((float)(this.bgStart + Main.bgW * num25), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[Main.desertBG[0]], Main.backgroundHeight[Main.desertBG[0]])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } Main.bgScale = 1.34f; Main.bgScale *= 2f; this.LoadBackground(Main.desertBG[1]); Main.bgW = (int)((float)Main.backgroundWidth[Main.desertBG[1]] * Main.bgScale); this.bgParrallax = 0.49; this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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 num26 = 0; num26 < this.bgLoops; num26++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.desertBG[1]], new Vector2((float)(this.bgStart + Main.bgW * num26), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[Main.desertBG[1]], Main.backgroundHeight[Main.desertBG[1]])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } } if (Main.bgAlpha[num21] > 0f && num21 == 5) { this.LoadBackground(26); Main.bgScale = 1.25f; Main.bgScale *= 2f; Main.bgW = (int)((float)Main.backgroundWidth[26] * Main.bgScale); this.bgParrallax = 0.37; this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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 num27 = 0; num27 < this.bgLoops; num27++) { this.spriteBatch.Draw(Main.backgroundTexture[26], new Vector2((float)(this.bgStart + Main.bgW * num27), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[26], Main.backgroundHeight[26])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } Main.bgScale = 1.34f; Main.bgScale *= 2f; this.LoadBackground(27); Main.bgW = (int)((float)Main.backgroundWidth[27] * Main.bgScale); this.bgParrallax = 0.49; this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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 num28 = 0; num28 < this.bgLoops; num28++) { this.spriteBatch.Draw(Main.backgroundTexture[27], new Vector2((float)(this.bgStart + Main.bgW * num28), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[27], Main.backgroundHeight[27])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } } if (Main.bgAlpha[num21] > 0f && num21 == 1) { Main.bgScale = 1.25f; Main.bgScale *= 2f; this.LoadBackground(Main.corruptBG[0]); Main.bgW = (int)((float)Main.backgroundWidth[Main.corruptBG[0]] * Main.bgScale); this.bgParrallax = 0.4; this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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 num29 = 0; num29 < this.bgLoops; num29++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.corruptBG[0]], new Vector2((float)(this.bgStart + Main.bgW * num29), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[Main.corruptBG[0]], Main.backgroundHeight[Main.corruptBG[0]])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } Main.bgScale = 1.31f; Main.bgScale *= 2f; this.LoadBackground(Main.corruptBG[1]); Main.bgW = (int)((float)Main.backgroundWidth[Main.corruptBG[1]] * Main.bgScale); this.bgParrallax = 0.43; this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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; } this.bgLoops = Main.screenWidth / Main.bgW + 2; if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { try { for (int num30 = 0; num30 < this.bgLoops; num30++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.corruptBG[1]], new Vector2((float)(this.bgStart + Main.bgW * num30), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[Main.corruptBG[1]], Main.backgroundHeight[Main.corruptBG[1]])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.FlipHorizontally, 0f); } } catch { this.LoadBackground(Main.corruptBG[1]); } } Main.bgScale = 1.34f; Main.bgScale *= 2f; this.LoadBackground(Main.corruptBG[2]); Main.bgW = (int)((float)Main.backgroundWidth[Main.corruptBG[2]] * Main.bgScale); this.bgParrallax = 0.49; this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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 num31 = 0; num31 < this.bgLoops; num31++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.corruptBG[2]], new Vector2((float)(this.bgStart + Main.bgW * num31), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[Main.corruptBG[2]], Main.backgroundHeight[Main.corruptBG[2]])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } } if (Main.bgAlpha[num21] > 0f && num21 == 6) { Main.bgScale = 1.25f; Main.bgScale *= 2f; this.LoadBackground(Main.hallowBG[0]); Main.bgW = (int)((float)Main.backgroundWidth[Main.hallowBG[0]] * Main.bgScale); this.bgParrallax = 0.4; this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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 num32 = 0; num32 < this.bgLoops; num32++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.hallowBG[0]], new Vector2((float)(this.bgStart + Main.bgW * num32), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[Main.hallowBG[0]], Main.backgroundHeight[Main.hallowBG[0]])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } Main.bgScale = 1.31f; Main.bgScale *= 2f; this.LoadBackground(Main.hallowBG[1]); Main.bgW = (int)((float)Main.backgroundWidth[Main.hallowBG[1]] * Main.bgScale); this.bgParrallax = 0.43; this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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 num33 = 0; num33 < this.bgLoops; num33++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.hallowBG[1]], new Vector2((float)(this.bgStart + Main.bgW * num33), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[Main.hallowBG[1]], Main.backgroundHeight[Main.hallowBG[1]])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } Main.bgScale = 1.34f; Main.bgScale *= 2f; this.LoadBackground(Main.hallowBG[2]); Main.bgW = (int)((float)Main.backgroundWidth[Main.hallowBG[2]] * Main.bgScale); this.bgParrallax = 0.49; this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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 num34 = 0; num34 < this.bgLoops; num34++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.hallowBG[2]], new Vector2((float)(this.bgStart + Main.bgW * num34), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[Main.hallowBG[2]], Main.backgroundHeight[Main.hallowBG[2]])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } } if (Main.bgAlpha[num21] > 0f && num21 == 0) { Main.bgScale = 1.25f; Main.bgScale *= 2f; this.bgParrallax = 0.4; if (Main.treeBG[0] == 91) { this.bgParrallax = 0.27000001072883606; Main.bgScale = 1.2f; Main.bgScale *= 2f; } if (Main.treeBG[0] == 173) { this.bgParrallax = 0.25; Main.bgScale = 1.3f; Main.bgScale *= 2f; } if (Main.treeBG[0] == 178) { this.bgParrallax = 0.30000001192092896; Main.bgScale = 1.2f; Main.bgScale *= 2f; } if (Main.treeBG[0] == 184) { this.bgParrallax = 0.25; Main.bgScale = 1.2f; Main.bgScale *= 2f; } if (Main.treeBG[0] >= 0) { this.LoadBackground(Main.treeBG[0]); Main.bgW = (int)((float)Main.backgroundWidth[Main.treeBG[0]] * Main.bgScale); this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (Main.worldSurface * 16.0) * 1800.0 + 1500.0) + (int)this.scAdj; if (Main.treeBG[0] == 91) { this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (Main.worldSurface * 16.0) * 1600.0 + 1400.0) + (int)this.scAdj; } if (Main.treeBG[0] == 173) { this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (Main.worldSurface * 16.0) * 1600.0 + 1400.0) + (int)this.scAdj; } if (Main.treeBG[0] == 184) { this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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 num35 = 0; num35 < this.bgLoops; num35++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.treeBG[0]], new Vector2((float)(this.bgStart + Main.bgW * num35), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[Main.treeBG[0]], Main.backgroundHeight[Main.treeBG[0]])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } } if (Main.treeBG[1] >= 0) { this.LoadBackground(Main.treeBG[1]); Main.bgScale = 1.31f; Main.bgScale *= 2f; Main.bgW = (int)((float)Main.backgroundWidth[Main.treeBG[1]] * Main.bgScale); this.bgParrallax = 0.43; this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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 num36 = 0; num36 < this.bgLoops; num36++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.treeBG[1]], new Vector2((float)(this.bgStart + Main.bgW * num36), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[Main.treeBG[1]], Main.backgroundHeight[Main.treeBG[1]])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.FlipHorizontally, 0f); } } } if (Main.treeBG[2] >= 0) { this.LoadBackground(Main.treeBG[2]); Main.bgScale = 1.34f; Main.bgScale *= 2f; this.bgParrallax = 0.49; if (Main.treeBG[0] == 91) { Main.bgScale = 1.3f; Main.bgScale *= 2f; this.bgParrallax = 0.42; } Main.bgW = (int)((float)Main.backgroundWidth[Main.treeBG[2]] * Main.bgScale); this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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 num37 = 0; num37 < this.bgLoops; num37++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.treeBG[2]], new Vector2((float)(this.bgStart + Main.bgW * num37), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[Main.treeBG[2]], Main.backgroundHeight[Main.treeBG[2]])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } } } if (Main.bgAlpha[num21] > 0f && num21 == 7) { if (Main.snowBG[0] >= 0) { Main.bgScale = 1.25f; Main.bgScale *= 2f; this.LoadBackground(Main.snowBG[0]); Main.bgW = (int)((float)Main.backgroundWidth[Main.snowBG[0]] * Main.bgScale); this.bgParrallax = 0.4; this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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 num38 = 0; num38 < this.bgLoops; num38++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.snowBG[0]], new Vector2((float)(this.bgStart + Main.bgW * num38), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[Main.snowBG[0]], Main.backgroundHeight[Main.snowBG[0]])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } } if (Main.snowBG[1] >= 0) { Main.bgScale = 1.31f; Main.bgScale *= 2f; this.LoadBackground(Main.snowBG[1]); Main.bgW = (int)((float)Main.backgroundWidth[Main.snowBG[1]] * Main.bgScale); this.bgParrallax = 0.43; this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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 num39 = 0; num39 < this.bgLoops; num39++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.snowBG[1]], new Vector2((float)(this.bgStart + Main.bgW * num39), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[Main.snowBG[1]], Main.backgroundHeight[Main.snowBG[1]])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } } if (Main.snowBG[2] >= 0) { Main.bgScale = 1.34f; Main.bgScale *= 2f; this.LoadBackground(Main.snowBG[2]); Main.bgW = (int)((float)Main.backgroundWidth[Main.snowBG[2]] * Main.bgScale); this.bgParrallax = 0.49; this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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 num40 = 0; num40 < this.bgLoops; num40++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.snowBG[2]], new Vector2((float)(this.bgStart + Main.bgW * num40), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[Main.snowBG[2]], Main.backgroundHeight[Main.snowBG[2]])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } } } if (Main.bgAlpha[num21] > 0f && num21 == 8) { Main.bgScale = 1.25f; Main.bgScale *= 2f; this.LoadBackground(Main.crimsonBG[0]); Main.bgW = (int)((float)Main.backgroundWidth[Main.crimsonBG[0]] * Main.bgScale); this.bgParrallax = 0.4; this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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 num41 = 0; num41 < this.bgLoops; num41++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.crimsonBG[0]], new Vector2((float)(this.bgStart + Main.bgW * num41), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[Main.crimsonBG[0]], Main.backgroundHeight[Main.crimsonBG[0]])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } Main.bgScale = 1.31f; Main.bgScale *= 2f; if (Main.crimsonBG[1] > -1) { this.LoadBackground(Main.crimsonBG[1]); Main.bgW = (int)((float)Main.backgroundWidth[Main.crimsonBG[1]] * Main.bgScale); this.bgParrallax = 0.43; this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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 num42 = 0; num42 < this.bgLoops; num42++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.crimsonBG[1]], new Vector2((float)(this.bgStart + Main.bgW * num42), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[Main.crimsonBG[1]], Main.backgroundHeight[Main.crimsonBG[1]])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } } Main.bgScale = 1.34f; Main.bgScale *= 2f; this.LoadBackground(Main.crimsonBG[2]); Main.bgW = (int)((float)Main.backgroundWidth[Main.crimsonBG[2]] * Main.bgScale); this.bgParrallax = 0.49; this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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 num43 = 0; num43 < this.bgLoops; num43++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.crimsonBG[2]], new Vector2((float)(this.bgStart + Main.bgW * num43), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[Main.crimsonBG[2]], Main.backgroundHeight[Main.crimsonBG[2]])), Main.backColor, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } } if (Main.bgAlpha[num21] > 0f && num21 == 9) { float num44 = (float)Main.backColor.A / 255f; Color color5 = Main.backColor; float num45 = (float)Main.rand.Next(28, 42) * 0.001f; num45 += (float)(270 - (int)Main.mouseTextColor) / 5000f; float num46 = 0.1f; float num47 = 0.15f + num45 / 2f; float num48 = 0.3f + num45; num46 *= 255f; num47 *= 255f; num48 *= 255f; num46 *= 0.33f * num44; num47 *= 0.33f * num44; num48 *= 0.33f * num44; if (num46 > 255f) { num46 = 255f; } if (num47 > 255f) { num47 = 255f; } if (num48 > 255f) { num48 = 255f; } if (num46 > (float)color5.R) { color5.R = (byte)num46; } if (num47 > (float)color5.G) { color5.G = (byte)num47; } if (num48 > (float)color5.B) { color5.B = (byte)num48; } Main.bgScale = 1.25f; Main.bgScale *= 2f; this.LoadBackground(46); Main.bgW = (int)((float)Main.backgroundWidth[46] * Main.bgScale); this.bgParrallax = 0.4; this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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 num49 = 0; num49 < this.bgLoops; num49++) { this.spriteBatch.Draw(Main.backgroundTexture[46], new Vector2((float)(this.bgStart + Main.bgW * num49), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[46], Main.backgroundHeight[46])), color5, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } color5 = Main.backColor; num45 = (float)Main.rand.Next(28, 42) * 0.001f; num45 += (float)(270 - (int)Main.mouseTextColor) / 5000f; num46 = 0.1f; num47 = 0.175f + num45 / 2f; num48 = 0.3f + num45; num46 *= 255f; num47 *= 255f; num48 *= 255f; num46 *= 0.5f * num44; num47 *= 0.5f * num44; num48 *= 0.5f * num44; if (num46 > 255f) { num46 = 255f; } if (num47 > 255f) { num47 = 255f; } if (num48 > 255f) { num48 = 255f; } if (num46 > (float)color5.R) { color5.R = (byte)num46; } if (num47 > (float)color5.G) { color5.G = (byte)num47; } if (num48 > (float)color5.B) { color5.B = (byte)num48; } Main.bgScale = 1.32f; Main.bgScale *= 2f; this.LoadBackground(47); Main.bgW = (int)((float)Main.backgroundWidth[47] * Main.bgScale); this.bgParrallax = 0.43; this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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 num50 = 0; num50 < this.bgLoops; num50++) { this.spriteBatch.Draw(Main.backgroundTexture[47], new Vector2((float)(this.bgStart + Main.bgW * num50), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[47], Main.backgroundHeight[47])), color5, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } color5 = Main.backColor; num45 = (float)Main.rand.Next(28, 42) * 0.001f; num45 += (float)(270 - (int)Main.mouseTextColor) / 3000f; num46 = 0.125f; num47 = 0.2f + num45 / 2f; num48 = 0.3f + num45; num46 *= 255f * num44 * 0.75f; num47 *= 255f * num44 * 0.75f; num48 *= 255f * num44 * 0.75f; if (num46 > 255f) { num46 = 255f; } if (num47 > 255f) { num47 = 255f; } if (num48 > 255f) { num48 = 255f; } if (num46 > (float)color5.R) { color5.R = (byte)num46; } if (num47 > (float)color5.G) { color5.G = (byte)num47; } if (num48 > (float)color5.B) { color5.B = (byte)num48; } Main.bgScale = 1.36f; Main.bgScale *= 2f; this.LoadBackground(48); Main.bgW = (int)((float)Main.backgroundWidth[48] * Main.bgScale); this.bgParrallax = 0.49; this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (double)Main.bgW) - (double)(Main.bgW / 2)); this.bgTop = (int)((double)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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 num51 = 0; num51 < this.bgLoops; num51++) { this.spriteBatch.Draw(Main.backgroundTexture[48], new Vector2((float)(this.bgStart + Main.bgW * num51), (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.backgroundWidth[48], Main.backgroundHeight[48])), color5, 0f, default(Vector2), Main.bgScale, SpriteEffects.None, 0f); } } } } } } if (!Main.mapFullscreen && Main.cloudAlpha > 0f && (double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { this.bgParrallax = 0.1; this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (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)(-(double)Main.screenPosition.Y) / (Main.worldSurface * 16.0 - 600.0) * 200.0); for (int num52 = 0; num52 < this.bgLoops; num52++) { Color color6 = Main.bgColor; this.bgStart = 0; float num53 = Main.cloudAlpha; color6.R = (byte)((float)color6.R * num53); color6.G = (byte)((float)color6.G * num53); color6.B = (byte)((float)color6.B * num53); color6.A = (byte)((float)color6.A * num53); this.spriteBatch.Draw(Main.backgroundTexture[49], new Rectangle(this.bgStart + Main.backgroundWidth[49] * num52, this.bgTop, Main.backgroundWidth[49], Main.backgroundHeight[49]), color6); } } } protected override void Draw(GameTime gameTime) { if (!Main.gameMenu) { this.lookForColorTiles(); } if (Main.loadMap) { Main.mapMinX = 0; Main.mapMaxX = Main.maxTilesX; Main.mapMinY = 0; Main.mapMaxY = Main.maxTilesY; Main.refreshMap = false; this.DrawToMap(); } if (Lighting.lightMode >= 2) { Main.drawToScreen = true; } else { Main.drawToScreen = false; } if (Main.drawToScreen && Main.targetSet) { this.ReleaseTargets(); } if (!Main.drawToScreen && !Main.targetSet) { this.InitTargets(); } Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); Main.fpsCount++; if (!base.IsActive) { Main.maxQ = true; } if (!Main.dedServ) { bool flag = false; if (Main.screenWidth != base.GraphicsDevice.Viewport.Width || Main.screenHeight != base.GraphicsDevice.Viewport.Height) { Main.mapTime = Main.mapTimeMax + 30; flag = true; if (Main.gamePaused) { Main.renderNow = true; } } Main.screenWidth = base.GraphicsDevice.Viewport.Width; Main.screenHeight = base.GraphicsDevice.Viewport.Height; if (Main.screenWidth > Main.maxScreenW) { Main.screenWidth = Main.maxScreenW; flag = true; } if (Main.screenHeight > Main.maxScreenH) { Main.screenHeight = Main.maxScreenH; flag = true; } if (Main.screenWidth < Main.minScreenW) { Main.screenWidth = Main.minScreenW; flag = true; } if (Main.screenHeight < Main.minScreenH) { Main.screenHeight = Main.minScreenH; flag = true; } if (flag) { this.graphics.PreferredBackBufferWidth = Main.screenWidth; this.graphics.PreferredBackBufferHeight = Main.screenHeight; this.graphics.ApplyChanges(); if (!Main.drawToScreen) { this.InitTargets(); } } } Main.CursorColor(); Main.drawTime++; Main.screenLastPosition = Main.screenPosition; if (Main.stackSplit == 0) { Main.stackCounter = 0; Main.stackDelay = 7; Main.superFastStack = 0; } else { Main.stackCounter++; int num = 30; if (num == 7) { num = 30; } else { if (Main.stackDelay == 6) { num = 25; } else { if (Main.stackDelay == 5) { num = 20; } else { if (Main.stackDelay == 4) { num = 15; } else { if (Main.stackDelay == 3) { num = 10; } else { num = 5; } } } } } if (Main.stackCounter >= num) { Main.stackDelay--; if (Main.stackDelay < 2) { Main.stackDelay = 2; Main.superFastStack++; } Main.stackCounter = 0; } } Main.mouseTextColor += (byte)Main.mouseTextColorChange; if (Main.mouseTextColor >= 250) { Main.mouseTextColorChange = -4; } if (Main.mouseTextColor <= 175) { Main.mouseTextColorChange = 4; } if (Main.myPlayer >= 0) { Main.player[Main.myPlayer].mouseInterface = false; } if (Main.mapTime > 0) { Main.mapTime--; } if (Main.gameMenu) { Main.mapTime = Main.mapTimeMax; } Main.toolTip = new Item(); if (!Main.gameMenu && Main.netMode != 2) { if (Main.cameraX != 0f && !Main.player[Main.myPlayer].pulley) { Main.cameraX = 0f; } if (Main.cameraX > 0f) { Main.cameraX -= 1f; if (Main.cameraX < 0f) { Main.cameraX = 0f; } } if (Main.cameraX < 0f) { Main.cameraX += 1f; if (Main.cameraX > 0f) { Main.cameraX = 0f; } } Main.screenPosition.X = Main.player[Main.myPlayer].position.X + (float)Main.player[Main.myPlayer].width * 0.5f - (float)Main.screenWidth * 0.5f + Main.cameraX; Main.screenPosition.Y = Main.player[Main.myPlayer].position.Y + (float)Main.player[Main.myPlayer].height * 0.5f - (float)Main.screenHeight * 0.5f + Main.player[Main.myPlayer].gfxOffY; float num2 = 0f; float num3 = 0f; if (Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type == 1254 && Main.player[Main.myPlayer].scope && Main.mouseRight) { int num4 = Main.mouseX; int num5 = Main.mouseY; if (num4 > Main.screenWidth) { num4 = Main.screenWidth; } if (num4 < 0) { num4 = 0; } if (num5 > Main.screenHeight) { num5 = Main.screenHeight; } if (num5 < 0) { num5 = 0; } num2 = (float)(num4 - Main.screenWidth / 2) / 1.25f; num3 += (float)(num5 - Main.screenHeight / 2) / 1.25f; } else { if (Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type == 1254 && 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.5f; num3 += (float)(num7 - Main.screenHeight / 2) / 1.5f; } else { if (Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].type == 1299) { 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].scope && Main.mouseRight) { 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) / 2f; num3 += (float)(num11 - Main.screenHeight / 2) / 2f; } } } } float num12 = 24f; float num13 = num2 - Main.zoomX; float num14 = num3 - Main.zoomY; float num15 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); num15 = (float)Math.Sqrt((double)(num13 * num13 + num14 * num14)); if (num15 < num12) { Main.zoomX = num2; Main.zoomY = num3; } else { num15 = num12 / num15; num13 *= num15; num14 *= num15; Main.zoomX += num13; Main.zoomY += num14; } Main.screenPosition.X = Main.screenPosition.X + Main.zoomX; Main.screenPosition.Y = Main.screenPosition.Y + Main.zoomY; Main.screenPosition.X = (float)((int)Main.screenPosition.X); Main.screenPosition.Y = (float)((int)Main.screenPosition.Y); } if (!Main.gameMenu && Main.netMode != 2) { if (Main.screenPosition.X < Main.leftWorld + 640f + 16f) { Main.screenPosition.X = Main.leftWorld + 640f + 16f; } else { if (Main.screenPosition.X + (float)Main.screenWidth > Main.rightWorld - 640f - 32f) { Main.screenPosition.X = Main.rightWorld - (float)Main.screenWidth - 640f - 32f; } } if (Main.screenPosition.Y < Main.topWorld + 640f + 16f) { Main.screenPosition.Y = Main.topWorld + 640f + 16f; } else { if (Main.screenPosition.Y + (float)Main.screenHeight > Main.bottomWorld - 640f - 32f) { Main.screenPosition.Y = Main.bottomWorld - (float)Main.screenHeight - 640f - 32f; } } } if (Main.showSplash) { this.DrawSplash(gameTime); return; } Main.sunCircle += 0.01f; if ((double)Main.sunCircle > 6.285) { Main.sunCircle -= 6.285f; } if (!Main.gameMenu) { Main.findWaterfallCount++; if (Main.findWaterfallCount >= 30) { Main.findWaterfallCount = 0; Main.FindWaterfalls(); } if (Main.renderNow) { Main.screenLastPosition = Main.screenPosition; Main.renderNow = false; Main.renderCount = 99; int tempLightCount = Lighting.tempLightCount; this.Draw(gameTime); Lighting.tempLightCount = tempLightCount; 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 == 2) { this.RenderBackground(); Main.sceneBackgroundPos.X = Main.screenPosition.X - (float)Main.offScreenRange; Main.sceneBackgroundPos.Y = Main.screenPosition.Y - (float)Main.offScreenRange; } if (Main.renderCount == 2) { this.RenderWalls(); Main.sceneWallPos.X = Main.screenPosition.X - (float)Main.offScreenRange; Main.sceneWallPos.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 == 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 (Math.Abs(Main.sceneTilePos.X - (Main.screenPosition.X - (float)Main.offScreenRange)) > (float)Main.offScreenRange || Math.Abs(Main.sceneTilePos.Y - (Main.screenPosition.Y - (float)Main.offScreenRange)) > (float)Main.offScreenRange) { this.RenderTiles(); Main.sceneTilePos.X = Main.screenPosition.X - (float)Main.offScreenRange; Main.sceneTilePos.Y = Main.screenPosition.Y - (float)Main.offScreenRange; } if (Math.Abs(Main.sceneTile2Pos.X - (Main.screenPosition.X - (float)Main.offScreenRange)) > (float)Main.offScreenRange || Math.Abs(Main.sceneTile2Pos.Y - (Main.screenPosition.Y - (float)Main.offScreenRange)) > (float)Main.offScreenRange) { this.RenderTiles2(); Main.sceneTile2Pos.X = Main.screenPosition.X - (float)Main.offScreenRange; Main.sceneTile2Pos.Y = Main.screenPosition.Y - (float)Main.offScreenRange; } if (Math.Abs(Main.sceneBackgroundPos.X - (Main.screenPosition.X - (float)Main.offScreenRange)) > (float)Main.offScreenRange || Math.Abs(Main.sceneBackgroundPos.Y - (Main.screenPosition.Y - (float)Main.offScreenRange)) > (float)Main.offScreenRange) { this.RenderBackground(); Main.sceneBackgroundPos.X = Main.screenPosition.X - (float)Main.offScreenRange; Main.sceneBackgroundPos.Y = Main.screenPosition.Y - (float)Main.offScreenRange; } if (Math.Abs(Main.sceneWallPos.X - (Main.screenPosition.X - (float)Main.offScreenRange)) > (float)Main.offScreenRange || Math.Abs(Main.sceneWallPos.Y - (Main.screenPosition.Y - (float)Main.offScreenRange)) > (float)Main.offScreenRange) { this.RenderWalls(); Main.sceneWallPos.X = Main.screenPosition.X - (float)Main.offScreenRange; Main.sceneWallPos.Y = Main.screenPosition.Y - (float)Main.offScreenRange; } if (Math.Abs(Main.sceneWaterPos.X - (Main.screenPosition.X - (float)Main.offScreenRange)) > (float)Main.offScreenRange || Math.Abs(Main.sceneWaterPos.Y - (Main.screenPosition.Y - (float)Main.offScreenRange)) > (float)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.updateMap) { if (base.IsActive || Main.netMode == 1) { if (Main.refreshMap || Main.mapUnfinished) { if (Main.refreshMap) { Main.refreshMap = false; for (int i = 0; i < Main.maxTilesX; i++) { for (int j = 0; j < Main.maxTilesY; j++) { if (Main.map[i, j] != null) { Main.map[i, j].changed(true); } } } } Main.mapMinX = 0; Main.mapMaxX = Main.maxTilesX; Main.mapMinY = 0; Main.mapMaxY = Main.maxTilesY; } this.DrawToMap(); Main.updateMap = false; } else { if (Main.mapUnfinished) { Main.mapMinX = 0; Main.mapMaxX = Main.maxTilesX; Main.mapMinY = 0; Main.mapMaxY = Main.maxTilesY; this.DrawToMap(); } else { if (Map.numUpdateTile > 0) { this.DrawToMap(); } } } } else { if (Main.mapUnfinished) { Main.mapMinX = 0; Main.mapMaxX = Main.maxTilesX; Main.mapMinY = 0; Main.mapMaxY = Main.maxTilesY; this.DrawToMap(); } } } this.bgParrallax = 0.1; this.bgStart = (int)(-Math.IEEERemainder((double)Main.screenPosition.X * this.bgParrallax, (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)(-(double)Main.screenPosition.Y) / (Main.worldSurface * 16.0 - 600.0) * 200.0); Main.bgColor = Color.White; if (Main.gameMenu || Main.netMode == 2) { this.bgTop = -200; } int num16 = (int)(Main.time / 54000.0 * (double)(Main.screenWidth + Main.sunTexture.Width * 2)) - Main.sunTexture.Width; int num17 = 0; Color white = Color.White; float num18 = 1f; float rotation = (float)(Main.time / 54000.0) * 2f - 7.3f; int num19 = (int)(Main.time / 32400.0 * (double)(Main.screenWidth + Main.moonTexture[Main.moonType].Width * 2)) - Main.moonTexture[Main.moonType].Width; int num20 = 0; Color white2 = Color.White; float num21 = 1f; float rotation2 = (float)(Main.time / 32400.0) * 2f - 7.3f; if (Main.dayTime) { double num22; if (Main.time < 27000.0) { num22 = Math.Pow(1.0 - Main.time / 54000.0 * 2.0, 2.0); num17 = (int)((double)this.bgTop + num22 * 250.0 + 180.0); } else { num22 = Math.Pow((Main.time / 54000.0 - 0.5) * 2.0, 2.0); num17 = (int)((double)this.bgTop + num22 * 250.0 + 180.0); } num18 = (float)(1.2 - num22 * 0.4); } else { double num23; if (Main.time < 16200.0) { num23 = Math.Pow(1.0 - Main.time / 32400.0 * 2.0, 2.0); num20 = (int)((double)this.bgTop + num23 * 250.0 + 180.0); } else { num23 = Math.Pow((Main.time / 32400.0 - 0.5) * 2.0, 2.0); num20 = (int)((double)this.bgTop + num23 * 250.0 + 180.0); } num21 = (float)(1.2 - num23 * 0.4); } if (Main.dayTime) { if (Main.time < 13500.0) { float num24 = (float)(Main.time / 13500.0); white.R = (byte)(num24 * 200f + 55f); white.G = (byte)(num24 * 180f + 75f); white.B = (byte)(num24 * 250f + 5f); Main.bgColor.R = (byte)(num24 * 230f + 25f); Main.bgColor.G = (byte)(num24 * 220f + 35f); Main.bgColor.B = (byte)(num24 * 220f + 35f); } if (Main.time > 45900.0) { float num24 = (float)(1.0 - (Main.time / 54000.0 - 0.85) * 6.666666666666667); white.R = (byte)(num24 * 120f + 55f); white.G = (byte)(num24 * 100f + 25f); white.B = (byte)(num24 * 120f + 55f); Main.bgColor.R = (byte)(num24 * 200f + 35f); Main.bgColor.G = (byte)(num24 * 85f + 35f); Main.bgColor.B = (byte)(num24 * 135f + 35f); } else { if (Main.time > 37800.0) { float num24 = (float)(1.0 - (Main.time / 54000.0 - 0.7) * 6.666666666666667); white.R = (byte)(num24 * 80f + 175f); white.G = (byte)(num24 * 130f + 125f); white.B = (byte)(num24 * 100f + 155f); Main.bgColor.R = (byte)(num24 * 20f + 235f); Main.bgColor.G = (byte)(num24 * 135f + 120f); Main.bgColor.B = (byte)(num24 * 85f + 170f); } } } if (!Main.dayTime) { if (Main.bloodMoon) { if (Main.time < 16200.0) { float num24 = (float)(1.0 - Main.time / 16200.0); white2.R = (byte)(num24 * 10f + 205f); white2.G = (byte)(num24 * 170f + 55f); white2.B = (byte)(num24 * 200f + 55f); Main.bgColor.R = (byte)(40f - num24 * 40f + 35f); Main.bgColor.G = (byte)(num24 * 20f + 15f); Main.bgColor.B = (byte)(num24 * 20f + 15f); } else { if (Main.time >= 16200.0) { float num24 = (float)((Main.time / 32400.0 - 0.5) * 2.0); white2.R = (byte)(num24 * 50f + 205f); white2.G = (byte)(num24 * 100f + 155f); white2.B = (byte)(num24 * 100f + 155f); white2.R = (byte)(num24 * 10f + 205f); white2.G = (byte)(num24 * 170f + 55f); white2.B = (byte)(num24 * 200f + 55f); Main.bgColor.R = (byte)(40f - num24 * 40f + 35f); Main.bgColor.G = (byte)(num24 * 20f + 15f); Main.bgColor.B = (byte)(num24 * 20f + 15f); } } } else { if (Main.time < 16200.0) { float num24 = (float)(1.0 - Main.time / 16200.0); white2.R = (byte)(num24 * 10f + 205f); white2.G = (byte)(num24 * 70f + 155f); white2.B = (byte)(num24 * 100f + 155f); Main.bgColor.R = (byte)(num24 * 30f + 5f); Main.bgColor.G = (byte)(num24 * 30f + 5f); Main.bgColor.B = (byte)(num24 * 30f + 5f); } else { if (Main.time >= 16200.0) { float num24 = (float)((Main.time / 32400.0 - 0.5) * 2.0); white2.R = (byte)(num24 * 50f + 205f); white2.G = (byte)(num24 * 100f + 155f); white2.B = (byte)(num24 * 100f + 155f); Main.bgColor.R = (byte)(num24 * 20f + 5f); Main.bgColor.G = (byte)(num24 * 30f + 5f); Main.bgColor.B = (byte)(num24 * 30f + 5f); } } } } float num25 = 0.0005f * (float)Main.dayRate; if (Main.gameMenu) { num25 *= 20f; } if (Main.raining) { if (Main.cloudAlpha > Main.maxRaining) { Main.cloudAlpha -= num25; if (Main.cloudAlpha < Main.maxRaining) { Main.cloudAlpha = Main.maxRaining; } } else { if (Main.cloudAlpha < Main.maxRaining) { Main.cloudAlpha += num25; if (Main.cloudAlpha > Main.maxRaining) { Main.cloudAlpha = Main.maxRaining; } } } } else { Main.cloudAlpha -= num25; if (Main.cloudAlpha < 0f) { Main.cloudAlpha = 0f; } } if (Main.cloudAlpha > 0f) { float num26 = 1f - Main.cloudAlpha * 0.9f; Main.bgColor.R = (byte)((float)Main.bgColor.R * num26); Main.bgColor.G = (byte)((float)Main.bgColor.G * num26); Main.bgColor.B = (byte)((float)Main.bgColor.B * num26); } if (Main.gameMenu || Main.netMode == 2) { this.bgTop = 0; if (!Main.dayTime) { Main.bgColor.R = 35; Main.bgColor.G = 35; Main.bgColor.B = 35; } } if (Main.gameMenu) { Main.bgDelay = 1000; Main.evilTiles = (int)(Main.bgAlpha[1] * 500f); } if (Main.evilTiles > 0) { float num27 = (float)Main.evilTiles / 500f; if (num27 > 1f) { num27 = 1f; } int num28 = (int)Main.bgColor.R; int num29 = (int)Main.bgColor.G; int num30 = (int)Main.bgColor.B; num28 -= (int)(100f * num27 * ((float)Main.bgColor.R / 255f)); num29 -= (int)(140f * num27 * ((float)Main.bgColor.G / 255f)); num30 -= (int)(80f * num27 * ((float)Main.bgColor.B / 255f)); if (num28 < 15) { num28 = 15; } if (num29 < 15) { num29 = 15; } if (num30 < 15) { num30 = 15; } Main.bgColor.R = (byte)num28; Main.bgColor.G = (byte)num29; Main.bgColor.B = (byte)num30; num28 = (int)white.R; num29 = (int)white.G; num30 = (int)white.B; num28 -= (int)(100f * num27 * ((float)white.R / 255f)); num29 -= (int)(100f * num27 * ((float)white.G / 255f)); num30 -= (int)(0f * num27 * ((float)white.B / 255f)); if (num28 < 15) { num28 = 15; } if (num29 < 15) { num29 = 15; } if (num30 < 15) { num30 = 15; } white.R = (byte)num28; white.G = (byte)num29; white.B = (byte)num30; num28 = (int)white2.R; num29 = (int)white2.G; num30 = (int)white2.B; num28 -= (int)(140f * num27 * ((float)white2.R / 255f)); num29 -= (int)(190f * num27 * ((float)white2.G / 255f)); num30 -= (int)(170f * num27 * ((float)white2.B / 255f)); if (num28 < 15) { num28 = 15; } if (num29 < 15) { num29 = 15; } if (num30 < 15) { num30 = 15; } white2.R = (byte)num28; white2.G = (byte)num29; white2.B = (byte)num30; } if (Main.bloodTiles > 0) { float num31 = (float)Main.bloodTiles / 400f; if (num31 > 1f) { num31 = 1f; } int num32 = (int)Main.bgColor.R; int num33 = (int)Main.bgColor.G; int num34 = (int)Main.bgColor.B; num32 -= (int)(70f * num31 * ((float)Main.bgColor.G / 255f)); num33 -= (int)(110f * num31 * ((float)Main.bgColor.G / 255f)); num34 -= (int)(150f * num31 * ((float)Main.bgColor.B / 255f)); if (num32 < 15) { num32 = 15; } if (num33 < 15) { num33 = 15; } if (num34 < 15) { num34 = 15; } Main.bgColor.R = (byte)num32; Main.bgColor.G = (byte)num33; Main.bgColor.B = (byte)num34; num32 = (int)white.R; num33 = (int)white.G; num34 = (int)white.B; num33 -= (int)(90f * num31 * ((float)white.G / 255f)); num34 -= (int)(110f * num31 * ((float)white.B / 255f)); if (num32 < 15) { num32 = 15; } if (num33 < 15) { num33 = 15; } if (num34 < 15) { num34 = 15; } white.R = (byte)num32; white.G = (byte)num33; white.B = (byte)num34; num32 = (int)white2.R; num33 = (int)white2.G; num34 = (int)white2.B; num32 -= (int)(100f * num31 * ((float)white2.R / 255f)); num33 -= (int)(120f * num31 * ((float)white2.G / 255f)); num34 -= (int)(180f * num31 * ((float)white2.B / 255f)); if (num32 < 15) { num32 = 15; } if (num33 < 15) { num33 = 15; } if (num34 < 15) { num34 = 15; } white2.R = (byte)num32; white2.G = (byte)num33; white2.B = (byte)num34; } if (Main.jungleTiles > 0) { float num35 = (float)Main.jungleTiles / 200f; if (num35 > 1f) { num35 = 1f; } int num36 = (int)Main.bgColor.R; int num37 = (int)Main.bgColor.G; int num38 = (int)Main.bgColor.B; num36 -= (int)(40f * num35 * ((float)Main.bgColor.R / 255f)); num38 -= (int)(70f * num35 * ((float)Main.bgColor.B / 255f)); if (num37 > 255) { num37 = 255; } if (num37 < 15) { num37 = 15; } if (num36 > 255) { num36 = 255; } if (num36 < 15) { num36 = 15; } if (num38 < 15) { num38 = 15; } Main.bgColor.R = (byte)num36; Main.bgColor.G = (byte)num37; Main.bgColor.B = (byte)num38; num36 = (int)white.R; num37 = (int)white.G; num38 = (int)white.B; num36 -= (int)(30f * num35 * ((float)white.R / 255f)); num38 -= (int)(10f * num35 * ((float)white.B / 255f)); if (num36 < 15) { num36 = 15; } if (num37 < 15) { num37 = 15; } if (num38 < 15) { num38 = 15; } white.R = (byte)num36; white.G = (byte)num37; white.B = (byte)num38; num36 = (int)white2.R; num37 = (int)white2.G; num38 = (int)white2.B; num37 -= (int)(140f * num35 * ((float)white2.R / 255f)); num36 -= (int)(170f * num35 * ((float)white2.G / 255f)); num38 -= (int)(190f * num35 * ((float)white2.B / 255f)); if (num36 < 15) { num36 = 15; } if (num37 < 15) { num37 = 15; } if (num38 < 15) { num38 = 15; } white2.R = (byte)num36; white2.G = (byte)num37; white2.B = (byte)num38; } if (Main.shroomTiles > 0) { float num39 = (float)Main.shroomTiles / 160f; if (num39 > Main.shroomLight) { Main.shroomLight += 0.01f; } if (num39 < Main.shroomLight) { Main.shroomLight -= 0.01f; } } else { Main.shroomLight -= 0.02f; } if (Main.shroomLight < 0f) { Main.shroomLight = 0f; } if (Main.shroomLight > 1f) { Main.shroomLight = 1f; } if (Main.shroomLight > 0f) { float num40 = Main.shroomLight; int num41 = (int)Main.bgColor.R; int num42 = (int)Main.bgColor.G; int num43 = (int)Main.bgColor.B; num42 -= (int)(250f * num40 * ((float)Main.bgColor.G / 255f)); num41 -= (int)(250f * num40 * ((float)Main.bgColor.R / 255f)); num43 -= (int)(250f * num40 * ((float)Main.bgColor.B / 255f)); if (num42 < 15) { num42 = 15; } if (num41 < 15) { num41 = 15; } if (num43 < 15) { num43 = 15; } Main.bgColor.R = (byte)num41; Main.bgColor.G = (byte)num42; Main.bgColor.B = (byte)num43; num41 = (int)white.R; num42 = (int)white.G; num43 = (int)white.B; num42 -= (int)(10f * num40 * ((float)white.G / 255f)); num41 -= (int)(30f * num40 * ((float)white.R / 255f)); num43 -= (int)(10f * num40 * ((float)white.B / 255f)); if (num41 < 15) { num41 = 15; } if (num42 < 15) { num42 = 15; } if (num43 < 15) { num43 = 15; } white.R = (byte)num41; white.G = (byte)num42; white.B = (byte)num43; num41 = (int)white2.R; num42 = (int)white2.G; num43 = (int)white2.B; num42 -= (int)(140f * num40 * ((float)white2.R / 255f)); num41 -= (int)(170f * num40 * ((float)white2.G / 255f)); num43 -= (int)(190f * num40 * ((float)white2.B / 255f)); if (num41 < 15) { num41 = 15; } if (num42 < 15) { num42 = 15; } if (num43 < 15) { num43 = 15; } white2.R = (byte)num41; white2.G = (byte)num42; white2.B = (byte)num43; } if (Lighting.lightMode < 2) { if (Main.bgColor.R < 10) { Main.bgColor.R = 10; } if (Main.bgColor.G < 10) { Main.bgColor.G = 10; } if (Main.bgColor.B < 10) { Main.bgColor.B = 10; } } else { if (Main.bgColor.R < 15) { Main.bgColor.R = 15; } if (Main.bgColor.G < 15) { Main.bgColor.G = 15; } if (Main.bgColor.B < 15) { Main.bgColor.B = 15; } } if (Main.bloodMoon) { if (Main.bgColor.R < 25) { Main.bgColor.R = 25; } if (Main.bgColor.G < 25) { Main.bgColor.G = 25; } if (Main.bgColor.B < 25) { Main.bgColor.B = 25; } } if (Main.eclipse && Main.dayTime) { float num44 = 1242f; Main.eclipseLight = (float)(Main.time / (double)num44); if (Main.eclipseLight > 1f) { Main.eclipseLight = 1f; } } else { if (Main.eclipseLight > 0f) { Main.eclipseLight -= 0.01f; if (Main.eclipseLight < 0f) { Main.eclipseLight = 0f; } } } if (Main.eclipseLight > 0f) { float num45 = 1f - 0.925f * Main.eclipseLight; float num46 = 1f - 0.96f * Main.eclipseLight; float num47 = 1f - 1f * Main.eclipseLight; int num48 = (int)((float)Main.bgColor.R * num45); int num49 = (int)((float)Main.bgColor.G * num46); int num50 = (int)((float)Main.bgColor.B * num47); Main.bgColor.R = (byte)num48; Main.bgColor.G = (byte)num49; Main.bgColor.B = (byte)num50; white.R = 255; white.G = 127; white.B = 67; if (Main.bgColor.R < 20) { Main.bgColor.R = 20; } if (Main.bgColor.G < 10) { Main.bgColor.G = 10; } if (Lighting.lightMode >= 2) { if (Main.bgColor.R < 20) { Main.bgColor.R = 20; } if (Main.bgColor.G < 14) { Main.bgColor.G = 14; } if (Main.bgColor.B < 6) { Main.bgColor.B = 6; } } } Main.tileColor.A = 255; Main.tileColor.R = (byte)((Main.bgColor.R + Main.bgColor.B + Main.bgColor.G) / 3); Main.tileColor.G = (byte)((Main.bgColor.R + Main.bgColor.B + Main.bgColor.G) / 3); Main.tileColor.B = (byte)((Main.bgColor.R + Main.bgColor.B + Main.bgColor.G) / 3); Main.tileColor.R = (byte)((Main.bgColor.R + Main.bgColor.G + Main.bgColor.B + Main.bgColor.R * 7) / 10); Main.tileColor.G = (byte)((Main.bgColor.R + Main.bgColor.G + Main.bgColor.B + Main.bgColor.G * 7) / 10); Main.tileColor.B = (byte)((Main.bgColor.R + Main.bgColor.G + Main.bgColor.B + Main.bgColor.B * 7) / 10); if (Main.tileColor.R >= 255 && Main.tileColor.G >= 255) { byte arg_2856_0 = Main.tileColor.B; } float num51 = (float)(Main.maxTilesX / 4200); num51 *= num51; Main.atmo = (float)((double)((Main.screenPosition.Y + (float)(Main.screenHeight / 2)) / 16f - (65f + 10f * num51)) / (Main.worldSurface / 5.0)); if (Main.atmo < 0f) { Main.atmo = 0f; } if (Main.atmo > 1f) { Main.atmo = 1f; } if (Main.gameMenu) { Main.atmo = 1f; } Main.bgColor.R = (byte)((float)Main.bgColor.R * Main.atmo); Main.bgColor.G = (byte)((float)Main.bgColor.G * Main.atmo); Main.bgColor.B = (byte)((float)Main.bgColor.B * Main.atmo); if ((double)Main.atmo <= 0.05) { Main.bgColor.R = 0; Main.bgColor.G = 0; Main.bgColor.B = 0; Main.bgColor.A = 0; } base.GraphicsDevice.Clear(Color.Black); base.Draw(gameTime); if (Main.gameMenu || Main.player[Main.myPlayer].gravDir == 1f) { this.Transform = Matrix.CreateScale(1f, 1f, 1f) * Matrix.CreateRotationZ(0f) * Matrix.CreateTranslation(new Vector3(0f, 0f, 0f)); this.Rasterizer = RasterizerState.CullCounterClockwise; } else { this.Transform = Matrix.CreateScale(1f, -1f, 1f) * Matrix.CreateRotationZ(0f) * Matrix.CreateTranslation(new Vector3(0f, (float)Main.screenHeight, 0f)); this.Rasterizer = RasterizerState.CullClockwise; } this.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, this.Rasterizer, null, this.Transform); if (!Main.mapFullscreen) { if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0) { for (int k = 0; k < this.bgLoops; k++) { this.spriteBatch.Draw(Main.backgroundTexture[Main.background], new Rectangle(this.bgStart + Main.backgroundWidth[Main.background] * k, this.bgTop, Main.backgroundWidth[Main.background], Main.backgroundHeight[Main.background]), Main.bgColor); } } if ((double)Main.screenPosition.Y < Main.worldSurface * 16.0 + 16.0 && 255f * (1f - Main.cloudAlpha) - (float)Main.bgColor.R - 25f > 0f && Main.netMode != 2) { for (int l = 0; l < Main.numStars; l++) { Color color = default(Color); float num52 = (float)Main.evilTiles / 500f; if (num52 > 1f) { num52 = 1f; } num52 = 1f - num52 * 0.5f; if (Main.evilTiles <= 0) { num52 = 1f; } int num53 = (int)((float)(255 - Main.bgColor.R - 100) * Main.star[l].twinkle * num52); int num54 = (int)((float)(255 - Main.bgColor.G - 100) * Main.star[l].twinkle * num52); int num55 = (int)((float)(255 - Main.bgColor.B - 100) * Main.star[l].twinkle * num52); if (num53 < 0) { num53 = 0; } if (num54 < 0) { num54 = 0; } if (num55 < 0) { num55 = 0; } color.R = (byte)num53; color.G = (byte)((float)num54 * num52); color.B = (byte)((float)num55 * num52); float num56 = Main.star[l].position.X * ((float)Main.screenWidth / 800f); float num57 = Main.star[l].position.Y * ((float)Main.screenHeight / 600f); this.spriteBatch.Draw(Main.starTexture[Main.star[l].type], new Vector2(num56 + (float)Main.starTexture[Main.star[l].type].Width * 0.5f, num57 + (float)Main.starTexture[Main.star[l].type].Height * 0.5f + (float)this.bgTop), new Rectangle?(new Rectangle(0, 0, Main.starTexture[Main.star[l].type].Width, Main.starTexture[Main.star[l].type].Height)), color, Main.star[l].rotation, new Vector2((float)Main.starTexture[Main.star[l].type].Width * 0.5f, (float)Main.starTexture[Main.star[l].type].Height * 0.5f), Main.star[l].scale * Main.star[l].twinkle, SpriteEffects.None, 0f); } } if ((double)(Main.screenPosition.Y / 16f) < Main.worldSurface + 2.0) { if (Main.dayTime) { num18 *= 1.1f; if (Main.eclipse) { float num58 = 1f - Main.shroomLight; num58 -= Main.cloudAlpha * 1.5f; if (num58 < 0f) { num58 = 0f; } Color color2 = new Color((int)((byte)(255f * num58)), (int)((byte)((float)white.G * num58)), (int)((byte)((float)white.B * num58)), (int)((byte)(255f * num58))); Color color3 = new Color((int)((byte)((float)white.R * num58)), (int)((byte)((float)white.G * num58)), (int)((byte)((float)white.B * num58)), (int)((byte)((float)(white.B - 60) * num58))); this.spriteBatch.Draw(Main.sun3Texture, new Vector2((float)num16, (float)(num17 + (int)Main.sunModY)), new Rectangle?(new Rectangle(0, 0, Main.sun3Texture.Width, Main.sun3Texture.Height)), color2, rotation, new Vector2((float)(Main.sun3Texture.Width / 2), (float)(Main.sun3Texture.Height / 2)), num18, SpriteEffects.None, 0f); this.spriteBatch.Draw(Main.sun3Texture, new Vector2((float)num16, (float)(num17 + (int)Main.sunModY)), new Rectangle?(new Rectangle(0, 0, Main.sun3Texture.Width, Main.sun3Texture.Height)), color3, rotation, new Vector2((float)(Main.sun3Texture.Width / 2), (float)(Main.sun3Texture.Height / 2)), num18, SpriteEffects.None, 0f); } else { if (!Main.gameMenu && Main.player[Main.myPlayer].head == 12) { float num59 = 1f - Main.shroomLight; num59 -= Main.cloudAlpha * 1.5f; if (num59 < 0f) { num59 = 0f; } Color color4 = new Color((int)((byte)(255f * num59)), (int)((byte)((float)white.G * num59)), (int)((byte)((float)white.B * num59)), (int)((byte)(255f * num59))); Color color5 = new Color((int)((byte)((float)white.R * num59)), (int)((byte)((float)white.G * num59)), (int)((byte)((float)white.B * num59)), (int)((byte)((float)(white.B - 60) * num59))); this.spriteBatch.Draw(Main.sun2Texture, new Vector2((float)num16, (float)(num17 + (int)Main.sunModY)), new Rectangle?(new Rectangle(0, 0, Main.sun2Texture.Width, Main.sun2Texture.Height)), color4, rotation, new Vector2((float)(Main.sun2Texture.Width / 2), (float)(Main.sun2Texture.Height / 2)), num18, SpriteEffects.None, 0f); this.spriteBatch.Draw(Main.sun2Texture, new Vector2((float)num16, (float)(num17 + (int)Main.sunModY)), new Rectangle?(new Rectangle(0, 0, Main.sun2Texture.Width, Main.sun2Texture.Height)), color5, rotation, new Vector2((float)(Main.sun2Texture.Width / 2), (float)(Main.sun2Texture.Height / 2)), num18, SpriteEffects.None, 0f); } else { float num60 = 1f - Main.shroomLight; num60 -= Main.cloudAlpha * 1.5f; if (num60 < 0f) { num60 = 0f; } Color color6 = new Color((int)((byte)(255f * num60)), (int)((byte)((float)white.G * num60)), (int)((byte)((float)white.B * num60)), (int)((byte)(255f * num60))); Color color7 = new Color((int)((byte)((float)white.R * num60)), (int)((byte)((float)white.G * num60)), (int)((byte)((float)white.B * num60)), (int)((byte)((float)white.B * num60))); this.spriteBatch.Draw(Main.sunTexture, new Vector2((float)num16, (float)(num17 + (int)Main.sunModY)), new Rectangle?(new Rectangle(0, 0, Main.sunTexture.Width, Main.sunTexture.Height)), color6, rotation, new Vector2((float)(Main.sunTexture.Width / 2), (float)(Main.sunTexture.Height / 2)), num18, SpriteEffects.None, 0f); this.spriteBatch.Draw(Main.sunTexture, new Vector2((float)num16, (float)(num17 + (int)Main.sunModY)), new Rectangle?(new Rectangle(0, 0, Main.sunTexture.Width, Main.sunTexture.Height)), color7, rotation, new Vector2((float)(Main.sunTexture.Width / 2), (float)(Main.sunTexture.Height / 2)), num18, SpriteEffects.None, 0f); } } } if (!Main.dayTime) { float num61 = 1f - Main.cloudAlpha * 1.5f; if (num61 < 0f) { num61 = 0f; } white2.R = (byte)((float)white2.R * num61); white2.G = (byte)((float)white2.G * num61); white2.B = (byte)((float)white2.B * num61); white2.A = (byte)((float)white2.A * num61); this.spriteBatch.Draw(Main.moonTexture[Main.moonType], new Vector2((float)num19, (float)(num20 + (int)Main.moonModY)), new Rectangle?(new 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)), num21, SpriteEffects.None, 0f); } } Rectangle value; if (Main.dayTime) { value = new Rectangle((int)((double)num16 - (double)Main.sunTexture.Width * 0.5 * (double)num18), (int)((double)num17 - (double)Main.sunTexture.Height * 0.5 * (double)num18 + (double)Main.sunModY), (int)((float)Main.sunTexture.Width * num18), (int)((float)Main.sunTexture.Width * num18)); } else { value = new Rectangle((int)((double)num19 - (double)Main.moonTexture[Main.moonType].Width * 0.5 * (double)num21), (int)((double)num20 - (double)Main.moonTexture[Main.moonType].Width * 0.5 * (double)num21 + (double)Main.moonModY), (int)((float)Main.moonTexture[Main.moonType].Width * num21), (int)((float)Main.moonTexture[Main.moonType].Width * num21)); } Rectangle rectangle = new 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 (rectangle.Intersects(value) || Main.grabSky) { if (Main.dayTime) { Main.time = 54000.0 * (double)((float)(Main.mouseX + Main.sunTexture.Width) / ((float)Main.screenWidth + (float)(Main.sunTexture.Width * 2))); Main.sunModY = (short)(Main.mouseY - num17); if (Main.time > 53990.0) { Main.time = 53990.0; } } else { Main.time = 32400.0 * (double)((float)(Main.mouseX + Main.moonTexture[Main.moonType].Width) / ((float)Main.screenWidth + (float)(Main.moonTexture[Main.moonType].Width * 2))); Main.moonModY = (short)(Main.mouseY - num20); 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, -1, -1, "", 0, 0f, 0f, 0f, 0); } Main.grabSky = true; } } else { Main.grabSky = false; } } } this.scAdj = 1f - (float)((double)(Main.screenPosition.Y + (float)Main.screenHeight) / (Main.worldSurface * 16.0)); this.scAdj = (float)(Main.worldSurface * 16.0) / (Main.screenPosition.Y + (float)Main.screenHeight); float num62 = (float)Main.maxTilesY * 0.15f * 16f; num62 -= Main.screenPosition.Y; if (num62 < 0f) { num62 = 0f; } num62 *= 0.00025f; float num63 = num62 * num62; this.scAdj *= 0.45f - num63; 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)(-(double)Main.screenPosition.Y + this.screenOff / 2f) / (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)((float)Main.backgroundWidth[Main.treeMntBG[0]] * Main.bgScale); Main.backColor = Main.bgColor; Main.trueBackColor = Main.backColor; int num64 = Main.bgStyle; int num65 = (int)((Main.screenPosition.X + (float)(Main.screenWidth / 2)) / 16f); if ((double)(Main.screenPosition.Y / 16f) < Main.worldSurface + 10.0 && (num65 < 380 || num65 > Main.maxTilesX - 380)) { num64 = 4; } else { if (Main.shroomTiles > 100) { num64 = 9; } else { if (Main.sandTiles > 1000) { if (Main.player[Main.myPlayer].zoneEvil) { num64 = 5; } else { if (Main.player[Main.myPlayer].zoneBlood) { num64 = 5; } else { if (Main.player[Main.myPlayer].zoneHoly) { num64 = 5; } else { num64 = 2; } } } } else { if (Main.player[Main.myPlayer].zoneHoly) { num64 = 6; } else { if (Main.player[Main.myPlayer].zoneEvil) { num64 = 1; } else { if (Main.player[Main.myPlayer].zoneBlood) { num64 = 8; } else { if (Main.player[Main.myPlayer].zoneJungle) { num64 = 3; } else { if (Main.player[Main.myPlayer].zoneSnow) { num64 = 7; } else { num64 = 0; } } } } } } } } int num66 = 30; Main.tranSpeed = 0.05f; if (num64 == 0) { num66 = 60; } if (Main.bgDelay < 0) { Main.bgDelay++; } else { if (num64 != Main.bgStyle) { Main.bgDelay++; if (Main.bgDelay > num66) { Main.bgDelay = -60; Main.bgStyle = num64; if (num64 == 0) { Main.bgDelay = 0; } } } else { if (Main.bgDelay > 0) { Main.bgDelay--; } } } if (Main.gameMenu) { Main.tranSpeed = 0.02f; if (!Main.dayTime) { Main.bgStyle = 1; } else { Main.bgStyle = 0; } num64 = Main.bgStyle; } if (Main.quickBG > 0) { Main.quickBG--; Main.bgStyle = num64; Main.tranSpeed = 1f; } if (Main.bgStyle == 2) { Main.bgAlpha2[0] -= Main.tranSpeed; if (Main.bgAlpha2[0] < 0f) { Main.bgAlpha2[0] = 0f; } Main.bgAlpha2[1] += Main.tranSpeed; if (Main.bgAlpha2[1] > 1f) { Main.bgAlpha2[1] = 1f; } Main.bgAlpha2[2] -= Main.tranSpeed; if (Main.bgAlpha2[2] < 0f) { Main.bgAlpha2[2] = 0f; } Main.bgAlpha2[3] -= Main.tranSpeed; if (Main.bgAlpha2[3] < 0f) { Main.bgAlpha2[3] = 0f; } Main.bgAlpha2[4] -= Main.tranSpeed; if (Main.bgAlpha2[4] < 0f) { Main.bgAlpha2[4] = 0f; } Main.bgAlpha2[5] -= Main.tranSpeed; if (Main.bgAlpha2[5] < 0f) { Main.bgAlpha2[5] = 0f; } Main.bgAlpha2[6] -= Main.tranSpeed; if (Main.bgAlpha2[6] < 0f) { Main.bgAlpha2[6] = 0f; } } else { if (Main.bgStyle == 5 || Main.bgStyle == 1 || Main.bgStyle == 6) { Main.bgAlpha2[0] -= Main.tranSpeed; if (Main.bgAlpha2[0] < 0f) { Main.bgAlpha2[0] = 0f; } Main.bgAlpha2[1] -= Main.tranSpeed; if (Main.bgAlpha2[1] < 0f) { Main.bgAlpha2[1] = 0f; } Main.bgAlpha2[2] += Main.tranSpeed; if (Main.bgAlpha2[2] > 1f) { Main.bgAlpha2[2] = 1f; } Main.bgAlpha2[3] -= Main.tranSpeed; if (Main.bgAlpha2[3] < 0f) { Main.bgAlpha2[3] = 0f; } Main.bgAlpha2[4] -= Main.tranSpeed; if (Main.bgAlpha2[4] < 0f) { Main.bgAlpha2[4] = 0f; } Main.bgAlpha2[5] -= Main.tranSpeed; if (Main.bgAlpha2[5] < 0f) { Main.bgAlpha2[5] = 0f; } Main.bgAlpha2[6] -= Main.tranSpeed; if (Main.bgAlpha2[6] < 0f) { Main.bgAlpha2[6] = 0f; } } else { if (Main.bgStyle == 4) { Main.bgAlpha2[0] -= Main.tranSpeed; if (Main.bgAlpha2[0] < 0f) { Main.bgAlpha2[0] = 0f; } Main.bgAlpha2[1] -= Main.tranSpeed; if (Main.bgAlpha2[1] < 0f) { Main.bgAlpha2[1] = 0f; } Main.bgAlpha2[2] -= Main.tranSpeed; if (Main.bgAlpha2[2] < 0f) { Main.bgAlpha2[2] = 0f; } Main.bgAlpha2[3] += Main.tranSpeed; if (Main.bgAlpha2[3] > 1f) { Main.bgAlpha2[3] = 1f; } Main.bgAlpha2[4] -= Main.tranSpeed; if (Main.bgAlpha2[4] < 0f) { Main.bgAlpha2[4] = 0f; } Main.bgAlpha2[5] -= Main.tranSpeed; if (Main.bgAlpha2[5] < 0f) { Main.bgAlpha2[5] = 0f; } Main.bgAlpha2[6] -= Main.tranSpeed; if (Main.bgAlpha2[6] < 0f) { Main.bgAlpha2[6] = 0f; } } else { if (Main.bgStyle == 7) { Main.bgAlpha2[0] -= Main.tranSpeed; if (Main.bgAlpha2[0] < 0f) { Main.bgAlpha2[0] = 0f; } Main.bgAlpha2[1] -= Main.tranSpeed; if (Main.bgAlpha2[1] < 0f) { Main.bgAlpha2[1] = 0f; } Main.bgAlpha2[2] -= Main.tranSpeed; if (Main.bgAlpha2[2] < 0f) { Main.bgAlpha2[2] = 0f; } Main.bgAlpha2[3] -= Main.tranSpeed; if (Main.bgAlpha2[3] < 0f) { Main.bgAlpha2[3] = 0f; } Main.bgAlpha2[4] += Main.tranSpeed; if (Main.bgAlpha2[4] > 1f) { Main.bgAlpha2[4] = 1f; } Main.bgAlpha2[5] -= Main.tranSpeed; if (Main.bgAlpha2[5] < 0f) { Main.bgAlpha2[5] = 0f; } Main.bgAlpha2[6] -= Main.tranSpeed; if (Main.bgAlpha2[6] < 0f) { Main.bgAlpha2[6] = 0f; } } else { if (Main.bgStyle == 8) { Main.bgAlpha2[0] -= Main.tranSpeed; if (Main.bgAlpha2[0] < 0f) { Main.bgAlpha2[0] = 0f; } Main.bgAlpha2[1] -= Main.tranSpeed; if (Main.bgAlpha2[1] < 0f) { Main.bgAlpha2[1] = 0f; } Main.bgAlpha2[2] -= Main.tranSpeed; if (Main.bgAlpha2[2] < 0f) { Main.bgAlpha2[2] = 0f; } Main.bgAlpha2[3] -= Main.tranSpeed; if (Main.bgAlpha2[3] < 0f) { Main.bgAlpha2[3] = 0f; } Main.bgAlpha2[4] -= Main.tranSpeed; if (Main.bgAlpha2[4] < 0f) { Main.bgAlpha2[4] = 0f; } Main.bgAlpha2[5] += Main.tranSpeed; if (Main.bgAlpha2[5] > 1f) { Main.bgAlpha2[5] = 1f; } Main.bgAlpha2[6] -= Main.tranSpeed; if (Main.bgAlpha2[6] < 0f) { Main.bgAlpha2[6] = 0f; } } else { if (Main.bgStyle == 9) { Main.bgAlpha2[0] += Main.tranSpeed; if (Main.bgAlpha2[0] > 1f) { Main.bgAlpha2[0] = 1f; } Main.bgAlpha2[1] -= Main.tranSpeed; if (Main.bgAlpha2[1] < 0f) { Main.bgAlpha2[1] = 0f; } Main.bgAlpha2[2] -= Main.tranSpeed; if (Main.bgAlpha2[2] < 0f) { Main.bgAlpha2[2] = 0f; } Main.bgAlpha2[3] -= Main.tranSpeed; if (Main.bgAlpha2[3] < 0f) { Main.bgAlpha2[3] = 0f; } Main.bgAlpha2[4] -= Main.tranSpeed; if (Main.bgAlpha2[4] < 0f) { Main.bgAlpha2[4] = 0f; } Main.bgAlpha2[5] -= Main.tranSpeed; if (Main.bgAlpha2[5] < 0f) { Main.bgAlpha2[5] = 0f; } Main.bgAlpha2[6] += Main.tranSpeed; if (Main.bgAlpha2[6] > 1f) { Main.bgAlpha2[6] = 1f; } } else { Main.bgAlpha2[0] += Main.tranSpeed; if (Main.bgAlpha2[0] > 1f) { Main.bgAlpha2[0] = 1f; } Main.bgAlpha2[1] -= Main.tranSpeed; if (Main.bgAlpha2[1] < 0f) { Main.bgAlpha2[1] = 0f; } Main.bgAlpha2[2] -= Main.tranSpeed; if (Main.bgAlpha2[2] < 0f) { Main.bgAlpha2[2] = 0f; } Main.bgAlpha2[3] -= Main.tranSpeed; if (Main.bgAlpha2[3] < 0f) { Main.bgAlpha2[3] = 0f; } Main.bgAlpha2[4] -= Main.tranSpeed; if (Main.bgAlpha2[4] < 0f) { Main.bgAlpha2[4] = 0f; } Main.bgAlpha2[5] -= Main.tranSpeed; if (Main.bgAlpha2[5] < 0f) { Main.bgAlpha2[5] = 0f; } Main.bgAlpha2[6] -= Main.tranSpeed; if (Main.bgAlpha2[6] < 0f) { Main.bgAlpha2[6] = 0f; } } } } } } } if (Main.ignoreErrors) { try { this.DrawSurfaceBG(); goto IL_4520; } catch { goto IL_4520; } } this.DrawSurfaceBG(); IL_4520: if (Main.gameMenu || Main.netMode == 2) { for (int m = 0; m < Main.maxRain; m++) { if (Main.rain[m].active) { Color color8 = Main.bgColor; float num67 = 0.85f; color8.R = (byte)((float)color8.R * num67); color8.G = (byte)((float)color8.G * num67); color8.B = (byte)((float)color8.B * num67); color8.A = (byte)((float)color8.A * num67); float rotation3 = (float)Math.Atan2((double)Main.rain[m].velocity.X, (double)(-(double)Main.rain[m].velocity.Y)); this.spriteBatch.Draw(Main.rainTexture[(int)Main.rain[m].type], Main.rain[m].position - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, Main.rainTexture[(int)Main.rain[m].type].Width, Main.rainTexture[(int)Main.rain[m].type].Height)), color8, rotation3, default(Vector2), Main.rain[m].scale, SpriteEffects.None, 0f); if (base.IsActive) { Main.rain[m].Update(); } } } this.DrawMenu(); return; } this.firstTileX = (int)(Main.screenPosition.X / 16f - 1f); this.lastTileX = (int)((Main.screenPosition.X + (float)Main.screenWidth) / 16f) + 2; this.firstTileY = (int)(Main.screenPosition.Y / 16f - 1f); this.lastTileY = (int)((Main.screenPosition.Y + (float)Main.screenHeight) / 16f) + 2; if (this.firstTileX < 0) { this.firstTileX = 0; } if (this.lastTileX > Main.maxTilesX) { this.lastTileX = Main.maxTilesX; } if (this.firstTileY < 0) { this.firstTileY = 0; } if (this.lastTileY > Main.maxTilesY) { this.lastTileY = Main.maxTilesY; } if (!Main.drawSkip) { Lighting.LightTiles(this.firstTileX, this.lastTileX, this.firstTileY, this.lastTileY); } if (!Main.mapFullscreen) { Color arg_47FE_0 = Color.White; if (Main.drawToScreen) { this.drawWaters(true); } else { this.spriteBatch.Draw(this.backWaterTarget, Main.sceneBackgroundPos - Main.screenPosition, Color.White); } float x = (Main.sceneBackgroundPos.X - Main.screenPosition.X + (float)Main.offScreenRange) * Main.caveParrallax - (float)Main.offScreenRange; if (Main.drawToScreen) { this.DrawBackground(); } else { this.spriteBatch.Draw(this.backgroundTarget, new Vector2(x, Main.sceneBackgroundPos.Y - Main.screenPosition.Y), Color.White); } Main.magmaBGFrameCounter++; if (Main.magmaBGFrameCounter >= 8) { Main.magmaBGFrameCounter = 0; Main.magmaBGFrame++; if (Main.magmaBGFrame >= 3) { Main.magmaBGFrame = 0; } } try { if (Main.drawToScreen) { this.DrawBlack(); this.DrawWalls(); } else { this.spriteBatch.Draw(this.blackTarget, Main.sceneTilePos - Main.screenPosition, Color.White); this.spriteBatch.Draw(this.wallTarget, Main.sceneWallPos - Main.screenPosition, Color.White); } this.DrawWoF(); if (Main.player[Main.myPlayer].detectCreature) { if (Main.drawToScreen) { this.DrawTiles(false); this.drawWaterfalls(); this.DrawTiles(true); } else { this.spriteBatch.Draw(this.tile2Target, Main.sceneTile2Pos - Main.screenPosition, Color.White); this.drawWaterfalls(); this.spriteBatch.Draw(this.tileTarget, Main.sceneTilePos - Main.screenPosition, Color.White); } this.DrawNPCs(true); this.DrawNPCs(false); } else { if (Main.drawToScreen) { this.DrawTiles(false); this.drawWaterfalls(); this.DrawNPCs(true); this.DrawTiles(true); } else { this.spriteBatch.Draw(this.tile2Target, Main.sceneTile2Pos - Main.screenPosition, Color.White); this.drawWaterfalls(); this.DrawNPCs(true); this.spriteBatch.Draw(this.tileTarget, Main.sceneTilePos - Main.screenPosition, Color.White); } this.DrawNPCs(false); } } catch { } if (Main.ignoreErrors) { for (int n = 0; n < 1000; n++) { if (Main.projectile[n].active && Main.projectile[n].type > 0 && !Main.projectile[n].hide) { try { this.DrawProj(n); } catch { Main.projectile[n].active = false; } } } } else { for (int num68 = 0; num68 < 1000; num68++) { if (Main.projectile[num68].active && Main.projectile[num68].type > 0 && !Main.projectile[num68].hide) { this.DrawProj(num68); } } } this.spriteBatch.End(); this.spriteBatch.Begin(SpriteSortMode.Immediate, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, this.Rasterizer, null, this.Transform); for (int num69 = 0; num69 < 255; num69++) { if (Main.player[num69].active && !Main.player[num69].outOfRange) { if (Main.player[num69].ghost) { Vector2 position = Main.player[num69].position; Main.player[num69].position = Main.player[num69].shadowPos[0]; Main.player[num69].shadow = 0.5f; this.DrawGhost(Main.player[num69]); Main.player[num69].position = Main.player[num69].shadowPos[1]; Main.player[num69].shadow = 0.7f; this.DrawGhost(Main.player[num69]); Main.player[num69].position = Main.player[num69].shadowPos[2]; Main.player[num69].shadow = 0.9f; this.DrawGhost(Main.player[num69]); Main.player[num69].position = position; Main.player[num69].shadow = 0f; this.DrawGhost(Main.player[num69]); } else { if (Main.player[num69].inventory[Main.player[num69].selectedItem].flame) { Main.player[num69].itemFlameCount--; if (Main.player[num69].itemFlameCount <= 0) { Main.player[num69].itemFlameCount = 5; for (int num70 = 0; num70 < 7; num70++) { Main.player[num69].itemFlamePos[num70].X = (float)Main.rand.Next(-10, 11) * 0.15f; Main.player[num69].itemFlamePos[num70].Y = (float)Main.rand.Next(-10, 1) * 0.35f; } } } bool flag2 = false; bool flag3 = false; bool flag4 = false; if (Main.player[num69].head == 111 && Main.player[num69].body == 73 && Main.player[num69].legs == 62) { flag3 = true; flag4 = true; } if (Main.player[num69].head == 107 && Main.player[num69].body == 69 && Main.player[num69].legs == 58) { flag3 = true; flag2 = true; } if (Main.player[num69].head == 108 && Main.player[num69].body == 70 && Main.player[num69].legs == 59) { flag3 = true; flag2 = true; } if (Main.player[num69].head == 109 && Main.player[num69].body == 71 && Main.player[num69].legs == 60) { flag3 = true; flag2 = true; } if (Main.player[num69].head == 110 && Main.player[num69].body == 72 && Main.player[num69].legs == 61) { flag3 = true; flag2 = true; } if (Main.player[num69].body == 67 && Main.player[num69].legs == 56 && Main.player[num69].head >= 103 && Main.player[num69].head <= 105) { flag2 = true; } if ((Main.player[num69].head == 78 || Main.player[num69].head == 79 || Main.player[num69].head == 80) && Main.player[num69].body == 51 && Main.player[num69].legs == 47) { flag3 = true; } if (Main.player[num69].dashDelay < 0) { flag2 = true; } if (Main.player[num69].head == 5 && Main.player[num69].body == 5 && Main.player[num69].legs == 5) { flag2 = true; } if (Main.player[num69].head == 74 && Main.player[num69].body == 48 && Main.player[num69].legs == 44) { flag2 = true; } if (Main.player[num69].head == 76 && Main.player[num69].body == 49 && Main.player[num69].legs == 45) { flag2 = true; } if (Main.player[num69].head == 7 && Main.player[num69].body == 7 && Main.player[num69].legs == 7) { flag2 = true; } if (Main.player[num69].head == 22 && Main.player[num69].body == 14 && Main.player[num69].legs == 14) { flag2 = true; } if (Main.player[num69].dye[0].dye == 30 && Main.player[num69].dye[1].dye == 30 && Main.player[num69].dye[2].dye == 30 && Main.player[num69].head == 4 && Main.player[num69].body == 27 && Main.player[num69].legs == 26) { flag2 = true; flag4 = true; } if (Main.player[num69].body == 17 && Main.player[num69].legs == 16 && (Main.player[num69].head == 29 || Main.player[num69].head == 30 || Main.player[num69].head == 31)) { flag2 = true; } if (Main.player[num69].body == 19 && Main.player[num69].legs == 18 && (Main.player[num69].head == 35 || Main.player[num69].head == 36 || Main.player[num69].head == 37)) { flag4 = true; } if (Main.myPlayer == num69) { bool flag5 = false; if (Main.player[num69].wings == 3 || (Main.player[num69].wings >= 16 && Main.player[num69].wings <= 19)) { flag5 = true; } else { if (Main.player[num69].head == 45 || (Main.player[num69].head >= 106 && Main.player[num69].head <= 110)) { flag5 = true; } else { if (Main.player[num69].body == 26 || (Main.player[num69].body >= 68 && Main.player[num69].body <= 74)) { flag5 = true; } else { if (Main.player[num69].legs == 25 || (Main.player[num69].legs >= 57 && Main.player[num69].legs <= 63)) { flag5 = true; } } } } if (flag5) { Player expr_525E_cp_0 = Main.player[num69]; expr_525E_cp_0.velocity.X = expr_525E_cp_0.velocity.X * 0.9f; if (Main.player[num69].velocity.Y < 0f) { Player expr_5295_cp_0 = Main.player[num69]; expr_5295_cp_0.velocity.Y = expr_5295_cp_0.velocity.Y + 0.2f; } Main.player[num69].jump = 0; Main.player[num69].statDefense = -1000; Main.player[num69].AddBuff(23, 2, false); Main.player[num69].AddBuff(80, 2, false); Main.player[num69].AddBuff(67, 2, false); Main.player[num69].AddBuff(32, 2, false); Main.player[num69].AddBuff(31, 2, false); Main.player[num69].AddBuff(33, 2, false); } } if (Main.player[num69].body == 26 && Main.player[num69].legs == 25 && Main.player[num69].head == 45) { flag4 = true; flag2 = true; } if (Main.player[num69].body == 26 && Main.player[num69].legs == 25 && Main.player[num69].head == 63) { flag4 = true; flag2 = true; } if (Main.player[num69].body == 24 && Main.player[num69].legs == 23 && (Main.player[num69].head == 41 || Main.player[num69].head == 42 || Main.player[num69].head == 43)) { flag4 = true; flag2 = true; } if (Main.player[num69].body == 36 && Main.player[num69].head == 56) { flag4 = true; } if (flag4) { Vector2 position2 = Main.player[num69].position; if (!Main.gamePaused) { Main.player[num69].ghostFade += Main.player[num69].ghostDir * 0.075f; } if ((double)Main.player[num69].ghostFade < 0.1) { Main.player[num69].ghostDir = 1f; Main.player[num69].ghostFade = 0.1f; } if ((double)Main.player[num69].ghostFade > 0.9) { Main.player[num69].ghostDir = -1f; Main.player[num69].ghostFade = 0.9f; } Main.player[num69].position.X = position2.X - Main.player[num69].ghostFade * 5f; Player expr_5516_cp_0 = Main.player[num69]; expr_5516_cp_0.position.Y = expr_5516_cp_0.position.Y + Main.player[num69].gfxOffY; Main.player[num69].shadow = Main.player[num69].ghostFade; this.DrawPlayer(Main.player[num69]); Main.player[num69].position.X = position2.X + Main.player[num69].ghostFade * 5f; Main.player[num69].shadow = Main.player[num69].ghostFade; this.DrawPlayer(Main.player[num69]); Main.player[num69].position = position2; Main.player[num69].position.Y = position2.Y - Main.player[num69].ghostFade * 5f; Player expr_55F5_cp_0 = Main.player[num69]; expr_55F5_cp_0.position.Y = expr_55F5_cp_0.position.Y + Main.player[num69].gfxOffY; Main.player[num69].shadow = Main.player[num69].ghostFade; this.DrawPlayer(Main.player[num69]); Main.player[num69].position.Y = position2.Y + Main.player[num69].ghostFade * 5f; Player expr_5670_cp_0 = Main.player[num69]; expr_5670_cp_0.position.Y = expr_5670_cp_0.position.Y + Main.player[num69].gfxOffY; Main.player[num69].shadow = Main.player[num69].ghostFade; this.DrawPlayer(Main.player[num69]); Main.player[num69].position = position2; Main.player[num69].shadow = 0f; } if (flag2) { Vector2 position3 = Main.player[num69].position; Main.player[num69].position = Main.player[num69].shadowPos[0]; Main.player[num69].shadow = 0.5f; this.DrawPlayer(Main.player[num69]); Main.player[num69].position = Main.player[num69].shadowPos[1]; Main.player[num69].shadow = 0.7f; this.DrawPlayer(Main.player[num69]); Main.player[num69].position = Main.player[num69].shadowPos[2]; Main.player[num69].shadow = 0.9f; this.DrawPlayer(Main.player[num69]); Main.player[num69].position = position3; Main.player[num69].shadow = 0f; } if (flag3) { for (int num71 = 0; num71 < 4; num71++) { Vector2 position4 = Main.player[num69].position; Player expr_5803_cp_0 = Main.player[num69]; expr_5803_cp_0.position.X = expr_5803_cp_0.position.X + (float)Main.rand.Next(-20, 21) * 0.1f; Player expr_5831_cp_0 = Main.player[num69]; expr_5831_cp_0.position.Y = expr_5831_cp_0.position.Y + (float)Main.rand.Next(-20, 21) * 0.1f; Player expr_585F_cp_0 = Main.player[num69]; expr_585F_cp_0.position.Y = expr_585F_cp_0.position.Y + Main.player[num69].gfxOffY; Main.player[num69].shadow = 0.9f; this.DrawPlayer(Main.player[num69]); Main.player[num69].position = position4; Main.player[num69].shadow = 0f; } } if (Main.player[num69].shadowDodge) { Main.player[num69].shadowDodgeCount += 1f; if (Main.player[num69].shadowDodgeCount > 30f) { Main.player[num69].shadowDodgeCount = 30f; } } else { Main.player[num69].shadowDodgeCount -= 1f; if (Main.player[num69].shadowDodgeCount < 0f) { Main.player[num69].shadowDodgeCount = 0f; } } if (Main.player[num69].shadowDodgeCount > 0f) { Vector2 position5 = Main.player[num69].position; Player expr_5989_cp_0 = Main.player[num69]; expr_5989_cp_0.position.Y = expr_5989_cp_0.position.Y + Main.player[num69].gfxOffY; Player expr_59AF_cp_0 = Main.player[num69]; expr_59AF_cp_0.position.X = expr_59AF_cp_0.position.X + Main.player[num69].shadowDodgeCount; Main.player[num69].shadow = 0.5f + (float)Main.rand.Next(-10, 11) * 0.005f; this.DrawPlayer(Main.player[num69]); Player expr_5A0B_cp_0 = Main.player[num69]; expr_5A0B_cp_0.position.X = expr_5A0B_cp_0.position.X - Main.player[num69].shadowDodgeCount * 2f; Main.player[num69].shadow = 0.5f + (float)Main.rand.Next(-10, 11) * 0.005f; this.DrawPlayer(Main.player[num69]); Main.player[num69].shadow = 0f; Main.player[num69].position = position5; } this.DrawPlayer(Main.player[num69]); } } } this.spriteBatch.End(); this.spriteBatch.Begin(SpriteSortMode.Deferred, BlendState.AlphaBlend, SamplerState.LinearClamp, DepthStencilState.None, this.Rasterizer, null, this.Transform); if (!Main.gamePaused) { Main.essScale += (float)Main.essDir * 0.01f; if (Main.essScale > 1f) { Main.essDir = -1; Main.essScale = 1f; } if ((double)Main.essScale < 0.7) { Main.essDir = 1; Main.essScale = 0.7f; } } for (int num72 = 0; num72 < 400; num72++) { if (Main.item[num72].active && Main.item[num72].type > 0) { int arg_5B8C_0 = (int)((double)Main.item[num72].position.X + (double)Main.item[num72].width * 0.5) / 16; int arg_5B92_0 = Lighting.offScreenTiles; int arg_5BC3_0 = (int)((double)Main.item[num72].position.Y + (double)Main.item[num72].height * 0.5) / 16; int arg_5BC9_0 = Lighting.offScreenTiles; Color color9 = Lighting.GetColor((int)((double)Main.item[num72].position.X + (double)Main.item[num72].width * 0.5) / 16, (int)((double)Main.item[num72].position.Y + (double)Main.item[num72].height * 0.5) / 16); if (!Main.gamePaused && base.IsActive && ((Main.item[num72].type >= 71 && Main.item[num72].type <= 74) || Main.item[num72].type == 58 || Main.item[num72].type == 109) && color9.R > 60) { float num73 = (float)Main.rand.Next(500) - (Math.Abs(Main.item[num72].velocity.X) + Math.Abs(Main.item[num72].velocity.Y)) * 10f; if (num73 < (float)(color9.R / 50)) { int num74 = Dust.NewDust(Main.item[num72].position, Main.item[num72].width, Main.item[num72].height, 43, 0f, 0f, 254, default(Color), 0.5f); Main.dust[num74].velocity *= 0f; } } float rotation4 = Main.item[num72].velocity.X * 0.2f; float num75 = 1f; Color alpha = Main.item[num72].GetAlpha(color9); if (Main.item[num72].type == 662 || Main.item[num72].type == 663) { alpha.R = (byte)Main.DiscoR; alpha.G = (byte)Main.DiscoG; alpha.B = (byte)Main.DiscoB; alpha.A = 255; } if (Main.item[num72].type == 520 || Main.item[num72].type == 521 || Main.item[num72].type == 547 || Main.item[num72].type == 548 || Main.item[num72].type == 549) { num75 = Main.essScale; alpha.R = (byte)((float)alpha.R * num75); alpha.G = (byte)((float)alpha.G * num75); alpha.B = (byte)((float)alpha.B * num75); alpha.A = (byte)((float)alpha.A * num75); } else { if (Main.item[num72].type == 58 || Main.item[num72].type == 184) { num75 = Main.essScale * 0.25f + 0.75f; alpha.R = (byte)((float)alpha.R * num75); alpha.G = (byte)((float)alpha.G * num75); alpha.B = (byte)((float)alpha.B * num75); alpha.A = (byte)((float)alpha.A * num75); } } float num76 = (float)(Main.item[num72].height - Main.itemTexture[Main.item[num72].type].Height); float num77 = (float)(Main.item[num72].width / 2 - Main.itemTexture[Main.item[num72].type].Width / 2); if (Main.item[num72].type >= 1522 && Main.item[num72].type <= 1527) { this.spriteBatch.Draw(Main.itemTexture[Main.item[num72].type], new Vector2(Main.item[num72].position.X - Main.screenPosition.X + (float)(Main.itemTexture[Main.item[num72].type].Width / 2) + num77, Main.item[num72].position.Y - Main.screenPosition.Y + (float)(Main.itemTexture[Main.item[num72].type].Height / 2) + num76 + 2f), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.item[num72].type].Width, Main.itemTexture[Main.item[num72].type].Height)), new Color(250, 250, 250, (int)(Main.mouseTextColor / 2)), rotation4, new Vector2((float)(Main.itemTexture[Main.item[num72].type].Width / 2), (float)(Main.itemTexture[Main.item[num72].type].Height / 2)), (float)Main.mouseTextColor / 1000f + 0.8f, SpriteEffects.None, 0f); } else { this.spriteBatch.Draw(Main.itemTexture[Main.item[num72].type], new Vector2(Main.item[num72].position.X - Main.screenPosition.X + (float)(Main.itemTexture[Main.item[num72].type].Width / 2) + num77, Main.item[num72].position.Y - Main.screenPosition.Y + (float)(Main.itemTexture[Main.item[num72].type].Height / 2) + num76 + 2f), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.item[num72].type].Width, Main.itemTexture[Main.item[num72].type].Height)), alpha, rotation4, new Vector2((float)(Main.itemTexture[Main.item[num72].type].Width / 2), (float)(Main.itemTexture[Main.item[num72].type].Height / 2)), num75, SpriteEffects.None, 0f); if (Main.item[num72].color != default(Color)) { this.spriteBatch.Draw(Main.itemTexture[Main.item[num72].type], new Vector2(Main.item[num72].position.X - Main.screenPosition.X + (float)(Main.itemTexture[Main.item[num72].type].Width / 2) + num77, Main.item[num72].position.Y - Main.screenPosition.Y + (float)(Main.itemTexture[Main.item[num72].type].Height / 2) + num76 + 2f), new Rectangle?(new Rectangle(0, 0, Main.itemTexture[Main.item[num72].type].Width, Main.itemTexture[Main.item[num72].type].Height)), Main.item[num72].GetColor(color9), rotation4, new Vector2((float)(Main.itemTexture[Main.item[num72].type].Width / 2), (float)(Main.itemTexture[Main.item[num72].type].Height / 2)), num75, SpriteEffects.None, 0f); } } } } for (int num78 = 0; num78 < Main.maxRain; num78++) { if (Main.rain[num78].active) { Color color10 = Lighting.GetColor((int)((double)Main.rain[num78].position.X + 4.0) / 16, (int)((double)Main.rain[num78].position.Y + 4.0) / 16); float num79 = 0.85f; color10.R = (byte)((float)color10.R * num79); color10.G = (byte)((float)color10.G * num79); color10.B = (byte)((float)color10.B * num79); color10.A = (byte)((float)color10.A * num79); float rotation5 = (float)Math.Atan2((double)Main.rain[num78].velocity.X, (double)(-(double)Main.rain[num78].velocity.Y)); this.spriteBatch.Draw(Main.rainTexture[(int)Main.rain[num78].type], Main.rain[num78].position - Main.screenPosition, new Rectangle?(new Rectangle(0, 0, Main.rainTexture[(int)Main.rain[num78].type].Width, Main.rainTexture[(int)Main.rain[num78].type].Height)), color10, rotation5, default(Vector2), Main.rain[num78].scale, SpriteEffects.None, 0f); if (base.IsActive) { Main.rain[num78].Update(); } } } if (Main.ignoreErrors) { try { this.DrawGore(); goto IL_653E; } catch { goto IL_653E; } } this.DrawGore(); IL_653E: Rectangle value2 = new Rectangle((int)Main.screenPosition.X - 500, (int)Main.screenPosition.Y - 50, Main.screenWidth + 1000, Main.screenHeight + 100); for (int num80 = 0; num80 < Main.numDust; num80++) { if (Main.dust[num80].active) { if (Main.dust[num80].type >= 130 && Main.dust[num80].type <= 134) { value2.X -= 500; value2.Y -= 500; value2.Width += 1000; value2.Height += 1000; } if (new Rectangle((int)Main.dust[num80].position.X, (int)Main.dust[num80].position.Y, 4, 4).Intersects(value2)) { if (Main.dust[num80].type >= 130 && Main.dust[num80].type <= 134) { float num81 = Math.Abs(Main.dust[num80].velocity.X) + Math.Abs(Main.dust[num80].velocity.Y); num81 *= 0.3f; num81 *= 10f; if (num81 > 10f) { num81 = 10f; } int num82 = 0; while ((float)num82 < num81) { Vector2 velocity = Main.dust[num80].velocity; Vector2 value3 = Main.dust[num80].position - velocity * (float)num82; float scale = Main.dust[num80].scale * (1f - (float)num82 / 10f); Color color11 = Lighting.GetColor((int)((double)Main.dust[num80].position.X + 4.0) / 16, (int)((double)Main.dust[num80].position.Y + 4.0) / 16); color11 = Main.dust[num80].GetAlpha(color11); this.spriteBatch.Draw(Main.dustTexture, value3 - Main.screenPosition, new Rectangle?(Main.dust[num80].frame), color11, Main.dust[num80].rotation, new Vector2(4f, 4f), scale, SpriteEffects.None, 0f); num82++; } } Color color12 = Lighting.GetColor((int)((double)Main.dust[num80].position.X + 4.0) / 16, (int)((double)Main.dust[num80].position.Y + 4.0) / 16); if (Main.dust[num80].type == 6 || Main.dust[num80].type == 15 || (Main.dust[num80].noLight && Main.dust[num80].type < 86 && Main.dust[num80].type > 91) || (Main.dust[num80].type >= 59 && Main.dust[num80].type <= 64)) { color12 = Color.White; } color12 = Main.dust[num80].GetAlpha(color12); this.spriteBatch.Draw(Main.dustTexture, Main.dust[num80].position - Main.screenPosition, new Rectangle?(Main.dust[num80].frame), color12, Main.dust[num80].rotation, new Vector2(4f, 4f), Main.dust[num80].scale, SpriteEffects.None, 0f); if (Main.dust[num80].color != default(Color)) { this.spriteBatch.Draw(Main.dustTexture, Main.dust[num80].position - Main.screenPosition, new Rectangle?(Main.dust[num80].frame), Main.dust[num80].GetColor(color12), Main.dust[num80].rotation, new Vector2(4f, 4f), Main.dust[num80].scale, SpriteEffects.None, 0f); } if (color12 == Color.Black) { Main.dust[num80].active = false; } } else { Main.dust[num80].active = false; } } } if (Main.drawToScreen) { this.drawWaters(false); if (Main.player[Main.myPlayer].inventory[Main.player[Main.myPlayer].selectedItem].mech) { this.DrawWires(); } } else { this.spriteBatch.Draw(this.waterTarget, Main.sceneWaterPos - Main.screenPosition, Color.White); } if (!Main.mapFullscreen && Main.mapStyle == 2) { if (Main.ignoreErrors) { try { this.DrawMap(); goto IL_6A73; } catch { goto IL_6A73; } } this.DrawMap(); } IL_6A73: this.spriteBatch.End(); this.spriteBatch.Begin(); if (!Main.hideUI) { for (int num83 = 0; num83 < 255; num83++) { if (Main.player[num83].active && Main.player[num83].chatShowTime > 0 && num83 != Main.myPlayer && !Main.player[num83].dead) { Vector2 vector = Main.fontMouseText.MeasureString(Main.player[num83].chatText); Vector2 vector2; vector2.X = Main.player[num83].position.X + (float)(Main.player[num83].width / 2) - vector.X / 2f; vector2.Y = Main.player[num83].position.Y - vector.Y - 2f; if (Main.player[Main.myPlayer].gravDir == -1f) { vector2.Y -= Main.screenPosition.Y; vector2.Y = Main.screenPosition.Y + (float)Main.screenHeight - vector2.Y; } for (int num84 = 0; num84 < 5; num84++) { int num85 = 0; int num86 = 0; Color black = Color.Black; if (num84 == 0) { num85 = -2; } if (num84 == 1) { num85 = 2; } if (num84 == 2) { num86 = -2; } if (num84 == 3) { num86 = 2; } if (num84 == 4) { black = new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor); } this.spriteBatch.DrawString(Main.fontMouseText, Main.player[num83].chatText, new Vector2(vector2.X + (float)num85 - Main.screenPosition.X, vector2.Y + (float)num86 - Main.screenPosition.Y), black, 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } } } for (int num87 = 0; num87 < 100; num87++) { if (Main.combatText[num87].active) { int num88 = 0; if (Main.combatText[num87].crit) { num88 = 1; } Vector2 vector3 = Main.fontCombatText[num88].MeasureString(Main.combatText[num87].text); Vector2 origin = new Vector2(vector3.X * 0.5f, vector3.Y * 0.5f); float arg_6CFF_0 = Main.combatText[num87].scale; float num89 = (float)Main.combatText[num87].color.R; float num90 = (float)Main.combatText[num87].color.G; float num91 = (float)Main.combatText[num87].color.B; float num92 = (float)Main.combatText[num87].color.A; num89 *= Main.combatText[num87].scale * Main.combatText[num87].alpha * 0.3f; num91 *= Main.combatText[num87].scale * Main.combatText[num87].alpha * 0.3f; num90 *= Main.combatText[num87].scale * Main.combatText[num87].alpha * 0.3f; num92 *= Main.combatText[num87].scale * Main.combatText[num87].alpha; Color color13 = new Color((int)num89, (int)num90, (int)num91, (int)num92); for (int num93 = 0; num93 < 5; num93++) { int num94 = 0; int num95 = 0; if (num93 == 0) { num94--; } else { if (num93 == 1) { num94++; } else { if (num93 == 2) { num95--; } else { if (num93 == 3) { num95++; } else { num89 = (float)Main.combatText[num87].color.R * Main.combatText[num87].scale * Main.combatText[num87].alpha; num91 = (float)Main.combatText[num87].color.B * Main.combatText[num87].scale * Main.combatText[num87].alpha; num90 = (float)Main.combatText[num87].color.G * Main.combatText[num87].scale * Main.combatText[num87].alpha; num92 = (float)Main.combatText[num87].color.A * Main.combatText[num87].scale * Main.combatText[num87].alpha; color13 = new Color((int)num89, (int)num90, (int)num91, (int)num92); } } } } if (Main.player[Main.myPlayer].gravDir == -1f) { float num96 = Main.combatText[num87].position.Y - Main.screenPosition.Y; num96 = (float)Main.screenHeight - num96; this.spriteBatch.DrawString(Main.fontCombatText[num88], Main.combatText[num87].text, new Vector2(Main.combatText[num87].position.X - Main.screenPosition.X + (float)num94 + origin.X, num96 + (float)num95 + origin.Y), color13, Main.combatText[num87].rotation, origin, Main.combatText[num87].scale, SpriteEffects.None, 0f); } else { this.spriteBatch.DrawString(Main.fontCombatText[num88], Main.combatText[num87].text, new Vector2(Main.combatText[num87].position.X - Main.screenPosition.X + (float)num94 + origin.X, Main.combatText[num87].position.Y - Main.screenPosition.Y + (float)num95 + origin.Y), color13, Main.combatText[num87].rotation, origin, Main.combatText[num87].scale, SpriteEffects.None, 0f); } } } } for (int num97 = 0; num97 < 20; num97++) { if (Main.itemText[num97].active) { string text = Main.itemText[num97].name; if (Main.itemText[num97].stack > 1) { text = string.Concat(new object[] { text, " (", Main.itemText[num97].stack, ")" }); } Vector2 vector4 = Main.fontMouseText.MeasureString(text); Vector2 origin2 = new Vector2(vector4.X * 0.5f, vector4.Y * 0.5f); float arg_7152_0 = Main.itemText[num97].scale; float num98 = (float)Main.itemText[num97].color.R; float num99 = (float)Main.itemText[num97].color.G; float num100 = (float)Main.itemText[num97].color.B; float num101 = (float)Main.itemText[num97].color.A; num98 *= Main.itemText[num97].scale * Main.itemText[num97].alpha * 0.3f; num100 *= Main.itemText[num97].scale * Main.itemText[num97].alpha * 0.3f; num99 *= Main.itemText[num97].scale * Main.itemText[num97].alpha * 0.3f; num101 *= Main.itemText[num97].scale * Main.itemText[num97].alpha; Color color14 = new Color((int)num98, (int)num99, (int)num100, (int)num101); for (int num102 = 0; num102 < 5; num102++) { int num103 = 0; int num104 = 0; if (num102 == 0) { num103 -= 2; } else { if (num102 == 1) { num103 += 2; } else { if (num102 == 2) { num104 -= 2; } else { if (num102 == 3) { num104 += 2; } else { num98 = (float)Main.itemText[num97].color.R * Main.itemText[num97].scale * Main.itemText[num97].alpha; num100 = (float)Main.itemText[num97].color.B * Main.itemText[num97].scale * Main.itemText[num97].alpha; num99 = (float)Main.itemText[num97].color.G * Main.itemText[num97].scale * Main.itemText[num97].alpha; num101 = (float)Main.itemText[num97].color.A * Main.itemText[num97].scale * Main.itemText[num97].alpha; color14 = new Color((int)num98, (int)num99, (int)num100, (int)num101); } } } } if (num102 < 4) { num101 = (float)Main.itemText[num97].color.A * Main.itemText[num97].scale * Main.itemText[num97].alpha; color14 = new Color(0, 0, 0, (int)num101); } float num105 = Main.itemText[num97].position.Y - Main.screenPosition.Y + (float)num104; if (Main.player[Main.myPlayer].gravDir == -1f) { num105 = (float)Main.screenHeight - num105; } this.spriteBatch.DrawString(Main.fontMouseText, text, new Vector2(Main.itemText[num97].position.X - Main.screenPosition.X + (float)num103 + origin2.X, num105 + origin2.Y), color14, Main.itemText[num97].rotation, origin2, Main.itemText[num97].scale, SpriteEffects.None, 0f); } } } if (Main.netMode == 1 && Netplay.clientSock.statusText != "" && Netplay.clientSock.statusText != null) { string text2 = string.Concat(new object[] { Netplay.clientSock.statusText, ": ", (int)((float)Netplay.clientSock.statusCount / (float)Netplay.clientSock.statusMax * 100f), "%" }); this.spriteBatch.DrawString(Main.fontMouseText, text2, new Vector2(628f - Main.fontMouseText.MeasureString(text2).X * 0.5f + (float)(Main.screenWidth - 800), 84f), new Color((int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor, (int)Main.mouseTextColor), 0f, default(Vector2), 1f, SpriteEffects.None, 0f); } if (Main.BlackFadeIn > 0) { if (Main.BlackFadeIn < 0) { Main.BlackFadeIn = 0; } int num106 = Main.BlackFadeIn; if (num106 > 255) { num106 = 255; } Main.BlackFadeIn -= 25; this.spriteBatch.Draw(Main.loTexture, new Rectangle(0, 0, Main.screenWidth, Main.screenHeight), new Color(0, 0, 0, num106)); } this.DrawFPS(); if (!Main.mapFullscreen) { if (Main.ignoreErrors) { try { this.DrawInterface(); goto IL_7619; } catch { goto IL_7619; } } this.DrawInterface(); } } else { Main.maxQ = true; } IL_7619: this.spriteBatch.End(); if (Main.mouseLeft) { Main.mouseLeftRelease = false; } else { Main.mouseLeftRelease = true; } if (Main.mouseRight) { Main.mouseRightRelease = false; } else { Main.mouseRightRelease = true; } if (Main.mouseState.RightButton != ButtonState.Pressed) { Main.stackSplit = 0; } if (Main.stackSplit > 0) { Main.stackSplit--; } if (Main.renderCount < 10) { Main.drawTimer[Main.renderCount] = (float)stopwatch.ElapsedMilliseconds; if (Main.drawTimerMaxDelay[Main.renderCount] > 0f) { Main.drawTimerMaxDelay[Main.renderCount] -= 1f; } else { Main.drawTimerMax[Main.renderCount] = 0f; } if (Main.drawTimer[Main.renderCount] > Main.drawTimerMax[Main.renderCount]) { Main.drawTimerMax[Main.renderCount] = Main.drawTimer[Main.renderCount]; Main.drawTimerMaxDelay[Main.renderCount] = 100f; } } return; } if (Main.player[Main.myPlayer].talkNPC >= 0 || Main.player[Main.myPlayer].sign >= 0 || Main.playerInventory) { Main.player[Main.myPlayer].toggleInv(); } this.DrawMap(); this.DrawFPS(); this.DrawPlayerChat(); this.spriteBatch.End(); if (Main.mouseLeft) { Main.mouseLeftRelease = false; return; } Main.mouseLeftRelease = true; } private static void UpdateInvasion() { if (Main.invasionType > 0) { if (Main.invasionSize <= 0) { if (Main.invasionType == 1) { NPC.downedGoblins = true; if (Main.netMode == 2) { NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0); } } else { if (Main.invasionType == 2) { NPC.downedFrost = true; } else { if (Main.invasionType == 3) { NPC.downedPirates = true; } } } Main.InvasionWarning(); Main.invasionType = 0; Main.invasionDelay = 7; } if (Main.invasionX == (double)Main.spawnTileX) { return; } float num = (float)Main.dayRate; if (Main.invasionX > (double)Main.spawnTileX) { Main.invasionX -= (double)num; 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)num; if (Main.invasionX >= (double)Main.spawnTileX) { Main.invasionX = (double)Main.spawnTileX; Main.InvasionWarning(); } else { Main.invasionWarn--; } } } if (Main.invasionWarn <= 0) { Main.invasionWarn = 3600; Main.InvasionWarning(); } } } private static void InvasionWarning() { string text; if (Main.invasionSize <= 0) { if (Main.invasionType == 2) { text = Lang.misc[4]; } else { if (Main.invasionType == 3) { text = Lang.misc[24]; } else { text = Lang.misc[0]; } } } else { if (Main.invasionX < (double)Main.spawnTileX) { if (Main.invasionType == 2) { text = Lang.misc[5]; } else { if (Main.invasionType == 3) { text = Lang.misc[25]; } else { text = Lang.misc[1]; } } } else { if (Main.invasionX > (double)Main.spawnTileX) { if (Main.invasionType == 2) { text = Lang.misc[6]; } else { if (Main.invasionType == 3) { text = Lang.misc[26]; } else { text = Lang.misc[2]; } } } else { if (Main.invasionType == 2) { text = Lang.misc[7]; } else { if (Main.invasionType == 3) { text = Lang.misc[27]; } else { text = Lang.misc[3]; } } } } } if (Main.netMode == 0) { Main.NewText(text, 175, 75, 255, false); return; } if (Main.netMode == 2) { NetMessage.SendData(25, -1, -1, text, 255, 175f, 75f, 255f, 0); } } public static void StartInvasion(int type = 1) { if (Main.invasionType == 0 && Main.invasionDelay == 0) { int num = 0; for (int i = 0; i < 255; i++) { if (Main.player[i].active && Main.player[i].statLifeMax >= 200) { num++; } } if (num > 0) { Main.invasionType = type; Main.invasionSize = 80 + 40 * num; if (type == 3) { Main.invasionSize += 40 + 20 * num; } Main.invasionWarn = 0; if (Main.rand.Next(2) == 0) { Main.invasionX = 0.0; return; } Main.invasionX = (double)Main.maxTilesX; } } } private static void UpdateClient() { if (Main.myPlayer == 255) { Netplay.disconnect = true; } Main.netPlayCounter++; if (Main.netPlayCounter > 3600) { Main.netPlayCounter = 0; } if (Math.IEEERemainder((double)Main.netPlayCounter, 420.0) == 0.0) { NetMessage.SendData(13, -1, -1, "", Main.myPlayer, 0f, 0f, 0f, 0); } if (Math.IEEERemainder((double)Main.netPlayCounter, 900.0) == 0.0) { NetMessage.SendData(36, -1, -1, "", Main.myPlayer, 0f, 0f, 0f, 0); NetMessage.SendData(16, -1, -1, "", Main.myPlayer, 0f, 0f, 0f, 0); NetMessage.SendData(40, -1, -1, "", Main.myPlayer, 0f, 0f, 0f, 0); } if (Netplay.clientSock.active) { Netplay.clientSock.timeOut++; if (!Main.stopTimeOuts && Netplay.clientSock.timeOut > 60 * Main.timeOut) { Main.statusText = Lang.inter[43]; Netplay.disconnect = true; } } for (int i = 0; i < 400; i++) { if (Main.item[i].active && Main.item[i].owner == Main.myPlayer) { Main.item[i].FindOwner(i); } } } private static void UpdateServer() { Main.netPlayCounter++; if (Main.netPlayCounter > 3600) { NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0); NetMessage.syncPlayers(); Main.netPlayCounter = 0; } for (int i = 0; i < Main.maxNetPlayers; i++) { if (Main.player[i].active && Netplay.serverSock[i].active) { Netplay.serverSock[i].SpamUpdate(); } } if (Math.IEEERemainder((double)Main.netPlayCounter, 900.0) == 0.0) { bool flag = true; int num = Main.lastItemUpdate; int num2 = 0; while (flag) { num++; if (num >= 400) { num = 0; } num2++; if (!Main.item[num].active || Main.item[num].owner == 255) { NetMessage.SendData(21, -1, -1, "", num, 0f, 0f, 0f, 0); } if (num2 >= Main.maxItemUpdates || num == Main.lastItemUpdate) { flag = false; } } Main.lastItemUpdate = num; } for (int j = 0; j < 400; j++) { if (Main.item[j].active && (Main.item[j].owner == 255 || !Main.player[Main.item[j].owner].active)) { Main.item[j].FindOwner(j); } } for (int k = 0; k < 255; k++) { if (Netplay.serverSock[k].active) { Netplay.serverSock[k].timeOut++; if (!Main.stopTimeOuts && Netplay.serverSock[k].timeOut > 60 * Main.timeOut) { Netplay.serverSock[k].kill = true; } } if (Main.player[k].active) { ServerSock.CheckSection(k, Main.player[k].position); } } } public static void NewText(string newText, byte R = 255, byte G = 255, byte B = 255, bool force = false) { int num = 80; if (!force && newText.Length > num) { string text = newText; while (text.Length > num) { int num2 = num; int num3 = num2; while (text.Substring(num3, 1) != " ") { num3--; if (num3 < 1) { break; } } if (num3 == 0) { while (text.Substring(num2, 1) != " ") { num2++; if (num2 >= text.Length - 1) { break; } } } else { num2 = num3; } if (num2 >= text.Length - 1) { num2 = text.Length; } string newText2 = text.Substring(0, num2); Main.NewText(newText2, R, G, B, true); text = text.Substring(num2); if (text.Length > 0) { while (text.Substring(0, 1) == " ") { text = text.Substring(1); } } } if (text.Length > 0) { Main.NewText(text, R, G, B, true); } return; } for (int i = Main.numChatLines - 1; i > 0; i--) { Main.chatLine[i].text = Main.chatLine[i - 1].text; Main.chatLine[i].showTime = Main.chatLine[i - 1].showTime; Main.chatLine[i].color = Main.chatLine[i - 1].color; } if (R == 0 && G == 0 && B == 0) { Main.chatLine[0].color = Color.White; } else { Main.chatLine[0].color = new Color((int)R, (int)G, (int)B); } Main.chatLine[0].text = newText; Main.chatLine[0].showTime = Main.chatLength; Main.PlaySound(12, -1, -1, 1); } private static void StopRain() { Main.rainTime = 0; Main.raining = false; Main.maxRaining = 0f; } private static void StartRain() { int num = 86400; int num2 = num / 24; Main.rainTime = Main.rand.Next(num2 * 8, num); if (Main.rand.Next(3) == 0) { Main.rainTime += Main.rand.Next(0, num2); } if (Main.rand.Next(4) == 0) { Main.rainTime += Main.rand.Next(0, num2 * 2); } if (Main.rand.Next(5) == 0) { Main.rainTime += Main.rand.Next(0, num2 * 3); } if (Main.rand.Next(6) == 0) { Main.rainTime += Main.rand.Next(0, num2 * 4); } if (Main.rand.Next(7) == 0) { Main.rainTime += Main.rand.Next(0, num2 * 5); } if (Main.rand.Next(8) == 0) { Main.rainTime += Main.rand.Next(0, num2 * 6); } float num3 = 1f; if (Main.rand.Next(2) == 0) { num3 += 0.1f; } if (Main.rand.Next(3) == 0) { num3 += 0.2f; } if (Main.rand.Next(4) == 0) { num3 += 0.3f; } if (Main.rand.Next(5) == 0) { num3 += 0.4f; } Main.rainTime = (int)((float)Main.rainTime * num3); Main.ChangeRain(); Main.raining = true; } private static void ChangeRain() { if (Main.cloudBGActive >= 1f || (double)Main.numClouds > 150.0) { if (Main.rand.Next(3) == 0) { Main.maxRaining = (float)Main.rand.Next(20, 90) * 0.01f; return; } Main.maxRaining = (float)Main.rand.Next(40, 90) * 0.01f; return; } else { if ((double)Main.numClouds > 100.0) { if (Main.rand.Next(3) == 0) { Main.maxRaining = (float)Main.rand.Next(10, 70) * 0.01f; return; } Main.maxRaining = (float)Main.rand.Next(20, 60) * 0.01f; return; } else { if (Main.rand.Next(3) == 0) { Main.maxRaining = (float)Main.rand.Next(5, 40) * 0.01f; return; } Main.maxRaining = (float)Main.rand.Next(5, 30) * 0.01f; return; } } } private static void UpdateTime() { if ((Main.netMode != 1 && !Main.gameMenu) || Main.netMode == 2) { if (Main.raining) { Main.rainTime -= Main.dayRate; int num = 86400; num /= Main.dayRate; int num2 = num / 24; if (Main.rainTime <= 0) { Main.StopRain(); } else { if (Main.rand.Next(num2 * 2) == 0) { Main.ChangeRain(); } } } else { int num3 = 86400; num3 /= Main.dayRate; if (Main.rand.Next(num3 * 5) == 0) { Main.StartRain(); } else { if (Main.cloudBGActive >= 1f && Main.rand.Next(num3 * 4) == 0) { Main.StartRain(); } } } } if (Main.maxRaining != Main.oldMaxRaining) { if (Main.netMode == 2) { NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0); } Main.oldMaxRaining = Main.maxRaining; } Main.time += (double)Main.dayRate; if (!Main.dayTime) { Main.eclipse = false; if (WorldGen.spawnEye && Main.netMode != 1 && Main.time > 4860.0) { for (int i = 0; i < 255; i++) { if (Main.player[i].active && !Main.player[i].dead && (double)Main.player[i].position.Y < Main.worldSurface * 16.0) { NPC.SpawnOnPlayer(i, 4); WorldGen.spawnEye = false; break; } } } if (WorldGen.spawnHardBoss > 0 && Main.netMode != 1 && Main.time > 4860.0) { for (int j = 0; j < 255; j++) { if (Main.player[j].active && !Main.player[j].dead && (double)Main.player[j].position.Y < Main.worldSurface * 16.0) { if (WorldGen.spawnHardBoss == 1) { NPC.SpawnOnPlayer(j, 134); } else { if (WorldGen.spawnHardBoss == 2) { NPC.SpawnOnPlayer(j, 125); NPC.SpawnOnPlayer(j, 126); } else { if (WorldGen.spawnHardBoss == 3) { NPC.SpawnOnPlayer(j, 127); } } } WorldGen.spawnHardBoss = 0; break; } } } if (Main.time > 32400.0) { Main.checkXMas(); if (Main.invasionDelay > 0) { Main.invasionDelay--; } WorldGen.spawnNPC = 0; Main.checkForSpawns = 0; Main.time = 0.0; Main.bloodMoon = false; Main.dayTime = true; Main.moonPhase++; if (Main.moonPhase >= 8) { Main.moonPhase = 0; } if (Main.netMode == 2) { NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0); WorldGen.saveAndPlay(); } if (Main.netMode != 1 && WorldGen.shadowOrbSmashed) { if (!NPC.downedGoblins) { if (Main.rand.Next(3) == 0) { Main.StartInvasion(1); } } else { if ((Main.hardMode && Main.rand.Next(60) == 0) || (!Main.hardMode && Main.rand.Next(30) == 0)) { Main.StartInvasion(1); } } if (Main.invasionType == 0 && Main.hardMode && NPC.downedPirates && Main.rand.Next(60) == 0) { Main.StartInvasion(3); } } if (Main.hardMode && NPC.downedMechBossAny && Main.rand.Next(25) == 0 && Main.netMode != 1) { Main.eclipse = true; if (Main.eclipse) { if (Main.netMode == 0) { Main.NewText(Lang.misc[20], 50, 255, 130, false); } else { if (Main.netMode == 2) { NetMessage.SendData(25, -1, -1, Lang.misc[20], 255, 50f, 255f, 130f, 0); } } } if (Main.netMode == 2) { NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0); } } } if (Main.time > 16200.0 && WorldGen.spawnMeteor) { WorldGen.spawnMeteor = false; WorldGen.dropMeteor(); return; } } else { Main.bloodMoon = false; if (Main.time > 54000.0) { WorldGen.spawnNPC = 0; Main.checkForSpawns = 0; if (Main.rand.Next(50) == 0 && Main.netMode != 1 && WorldGen.shadowOrbSmashed) { WorldGen.spawnMeteor = true; } Main.eclipse = false; if (!NPC.downedBoss1 && Main.netMode != 1) { bool flag = false; for (int k = 0; k < 255; k++) { if (Main.player[k].active && Main.player[k].statLifeMax >= 200 && Main.player[k].statDefense > 10) { flag = true; break; } } if (flag && Main.rand.Next(3) == 0) { int num4 = 0; for (int l = 0; l < 200; l++) { if (Main.npc[l].active && Main.npc[l].townNPC) { num4++; } } if (num4 >= 4) { WorldGen.spawnEye = true; if (Main.netMode == 0) { Main.NewText(Lang.misc[9], 50, 255, 130, false); } else { if (Main.netMode == 2) { NetMessage.SendData(25, -1, -1, Lang.misc[9], 255, 50f, 255f, 130f, 0); } } } } } if (Main.netMode != 1 && WorldGen.altarCount > 0 && Main.hardMode && !WorldGen.spawnEye && Main.rand.Next(10) == 0 && (!NPC.downedMechBoss1 || !NPC.downedMechBoss2 || !NPC.downedMechBoss3)) { int m = 0; while (m < 1000) { int num5 = Main.rand.Next(3) + 1; if (num5 == 1 && !NPC.downedMechBoss1) { WorldGen.spawnHardBoss = num5; if (Main.netMode == 0) { Main.NewText(Lang.misc[28], 50, 255, 130, false); break; } if (Main.netMode == 2) { NetMessage.SendData(25, -1, -1, Lang.misc[28], 255, 50f, 255f, 130f, 0); break; } break; } else { if (num5 == 2 && !NPC.downedMechBoss2) { WorldGen.spawnHardBoss = num5; if (Main.netMode == 0) { Main.NewText(Lang.misc[29], 50, 255, 130, false); break; } if (Main.netMode == 2) { NetMessage.SendData(25, -1, -1, Lang.misc[29], 255, 50f, 255f, 130f, 0); break; } break; } else { if (num5 == 3 && !NPC.downedMechBoss3) { WorldGen.spawnHardBoss = num5; if (Main.netMode == 0) { Main.NewText(Lang.misc[30], 50, 255, 130, false); break; } if (Main.netMode == 2) { NetMessage.SendData(25, -1, -1, Lang.misc[30], 255, 50f, 255f, 130f, 0); break; } break; } else { m++; } } } } } if (!WorldGen.spawnEye && Main.moonPhase != 4 && Main.rand.Next(9) == 0 && Main.netMode != 1) { for (int n = 0; n < 255; n++) { if (Main.player[n].active && Main.player[n].statLifeMax > 120) { Main.bloodMoon = true; break; } } if (Main.bloodMoon) { if (Main.netMode == 0) { Main.NewText(Lang.misc[8], 50, 255, 130, false); } else { if (Main.netMode == 2) { NetMessage.SendData(25, -1, -1, Lang.misc[8], 255, 50f, 255f, 130f, 0); } } } } Main.time = 0.0; Main.dayTime = false; if (Main.netMode == 2) { NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f, 0); } } if (Main.netMode != 1) { Main.checkForSpawns++; if (Main.checkForSpawns >= 7200 / Main.worldRate) { int num6 = 0; for (int num7 = 0; num7 < 255; num7++) { if (Main.player[num7].active) { num6++; } } for (int num8 = 0; num8 < 301; num8++) { Main.nextNPC[num8] = false; } Main.checkForSpawns = 0; WorldGen.spawnNPC = 0; int num9 = 0; int num10 = 0; int num11 = 0; int num12 = 0; int num13 = 0; int num14 = 0; int num15 = 0; int num16 = 0; int num17 = 0; int num18 = 0; int num19 = 0; int num20 = 0; int num21 = 0; int num22 = 0; int num23 = 0; int num24 = 0; int num25 = 0; int num26 = 0; int num27 = 0; int num28 = 0; int num29 = 0; for (int num30 = 0; num30 < 200; num30++) { if (Main.npc[num30].active && Main.npc[num30].townNPC) { if (Main.npc[num30].type != 37 && !Main.npc[num30].homeless) { WorldGen.QuickFindHome(num30); } if (Main.npc[num30].type == 37) { num14++; } if (Main.npc[num30].type == 17) { num9++; } if (Main.npc[num30].type == 18) { num10++; } if (Main.npc[num30].type == 19) { num12++; } if (Main.npc[num30].type == 20) { num11++; } if (Main.npc[num30].type == 22) { num13++; } if (Main.npc[num30].type == 38) { num15++; } if (Main.npc[num30].type == 54) { num16++; } if (Main.npc[num30].type == 107) { num18++; } if (Main.npc[num30].type == 108) { num17++; } if (Main.npc[num30].type == 124) { num19++; } if (Main.npc[num30].type == 142) { num20++; } if (Main.npc[num30].type == 160) { num21++; } if (Main.npc[num30].type == 178) { num22++; } if (Main.npc[num30].type == 207) { num23++; } if (Main.npc[num30].type == 208) { num24++; } if (Main.npc[num30].type == 209) { num25++; } if (Main.npc[num30].type == 227) { num26++; } if (Main.npc[num30].type == 228) { num27++; } if (Main.npc[num30].type == 229) { num28++; } num29++; } } if (WorldGen.spawnNPC == 0) { int num31 = 0; bool flag2 = false; int num32 = 0; bool flag3 = false; bool flag4 = false; bool flag5 = false; for (int num33 = 0; num33 < 255; num33++) { if (Main.player[num33].active) { for (int num34 = 0; num34 < 58; num34++) { if (Main.player[num33].inventory[num34] != null & Main.player[num33].inventory[num34].stack > 0) { if (Main.player[num33].inventory[num34].type == 71) { num31 += Main.player[num33].inventory[num34].stack; } if (Main.player[num33].inventory[num34].type == 72) { num31 += Main.player[num33].inventory[num34].stack * 100; } if (Main.player[num33].inventory[num34].type == 73) { num31 += Main.player[num33].inventory[num34].stack * 10000; } if (Main.player[num33].inventory[num34].type == 74) { num31 += Main.player[num33].inventory[num34].stack * 1000000; } if (Main.player[num33].inventory[num34].ammo == 14 || Main.player[num33].inventory[num34].useAmmo == 14) { flag3 = true; } if (Main.player[num33].inventory[num34].type == 166 || Main.player[num33].inventory[num34].type == 167 || Main.player[num33].inventory[num34].type == 168 || Main.player[num33].inventory[num34].type == 235) { flag4 = true; } if (Main.player[num33].inventory[num34].dye > 0 || (Main.player[num33].inventory[num34].type >= 1107 && Main.player[num33].inventory[num34].type <= 1120)) { flag5 = true; } } } int num35 = Main.player[num33].statLifeMax / 20; if (num35 > 5) { flag2 = true; } num32 += num35; if (!flag5) { for (int num36 = 0; num36 < 3; num36++) { if (Main.player[num33].dye[num36] != null && Main.player[num33].dye[num36].stack > 0 && Main.player[num33].dye[num36].dye > 0) { flag5 = true; } } } } } if (!NPC.downedBoss3 && num14 == 0) { int num37 = NPC.NewNPC(Main.dungeonX * 16 + 8, Main.dungeonY * 16, 37, 0); Main.npc[num37].homeless = false; Main.npc[num37].homeTileX = Main.dungeonX; Main.npc[num37].homeTileY = Main.dungeonY; } bool flag6 = false; if (Main.rand.Next(50) == 0) { flag6 = true; } if (num13 < 1) { Main.nextNPC[22] = true; } if ((double)num31 > 5000.0 && num9 < 1) { Main.nextNPC[17] = true; } if (flag2 && num10 < 1 && num9 > 0) { Main.nextNPC[18] = true; } if (flag3 && num12 < 1) { Main.nextNPC[19] = true; } if ((NPC.downedBoss1 || NPC.downedBoss2 || NPC.downedBoss3) && num11 < 1) { Main.nextNPC[20] = true; } if (flag4 && num9 > 0 && num15 < 1) { Main.nextNPC[38] = true; } if (NPC.downedBoss3 && num16 < 1) { Main.nextNPC[54] = true; } if (NPC.savedGoblin && num18 < 1) { Main.nextNPC[107] = true; } if (NPC.savedWizard && num17 < 1) { Main.nextNPC[108] = true; } if (NPC.savedMech && num19 < 1) { Main.nextNPC[124] = true; } if (NPC.downedFrost && num20 < 1 && Main.xMas) { Main.nextNPC[142] = true; } if (NPC.downedMechBossAny && num22 < 1) { Main.nextNPC[178] = true; } if (flag5 && num23 < 1) { Main.nextNPC[207] = true; } if (NPC.downedQueenBee && num27 < 1) { Main.nextNPC[228] = true; } if (NPC.downedPirates && num28 < 1) { Main.nextNPC[229] = true; } if (num21 < 1 && Main.hardMode) { Main.nextNPC[160] = true; } if (Main.hardMode && NPC.downedPlantBoss && num25 < 1) { Main.nextNPC[209] = true; } if (num29 >= 4 && num26 < 1) { Main.nextNPC[227] = true; } if (flag6 && num24 < 1 && num29 >= 8) { Main.nextNPC[208] = true; } if (WorldGen.spawnNPC == 0 && num13 < 1) { WorldGen.spawnNPC = 22; } if (WorldGen.spawnNPC == 0 && (double)num31 > 5000.0 && num9 < 1) { WorldGen.spawnNPC = 17; } if (WorldGen.spawnNPC == 0 && flag2 && num10 < 1 && num9 > 0) { WorldGen.spawnNPC = 18; } if (WorldGen.spawnNPC == 0 && flag3 && num12 < 1) { WorldGen.spawnNPC = 19; } if (WorldGen.spawnNPC == 0 && (NPC.downedBoss1 || NPC.downedBoss2 || NPC.downedBoss3) && num11 < 1) { WorldGen.spawnNPC = 20; } if (WorldGen.spawnNPC == 0 && flag4 && num9 > 0 && num15 < 1) { WorldGen.spawnNPC = 38; } if (WorldGen.spawnNPC == 0 && NPC.downedBoss3 && num16 < 1) { WorldGen.spawnNPC = 54; } if (WorldGen.spawnNPC == 0 && NPC.savedGoblin && num18 < 1) { WorldGen.spawnNPC = 107; } if (WorldGen.spawnNPC == 0 && NPC.savedWizard && num17 < 1) { WorldGen.spawnNPC = 108; } if (WorldGen.spawnNPC == 0 && NPC.savedMech && num19 < 1) { WorldGen.spawnNPC = 124; } if (WorldGen.spawnNPC == 0 && NPC.downedFrost && num20 < 1 && Main.xMas) { WorldGen.spawnNPC = 142; } if (WorldGen.spawnNPC == 0 && NPC.downedMechBossAny && num22 < 1) { WorldGen.spawnNPC = 178; } if (WorldGen.spawnNPC == 0 && flag5 && num23 < 1) { WorldGen.spawnNPC = 207; } if (NPC.downedQueenBee && WorldGen.spawnNPC == 0 && num27 < 1) { WorldGen.spawnNPC = 228; } if (NPC.downedPirates && WorldGen.spawnNPC == 0 && num28 < 1) { WorldGen.spawnNPC = 229; } if (WorldGen.spawnNPC == 0 && Main.hardMode && num21 < 1) { WorldGen.spawnNPC = 160; } if (Main.hardMode && NPC.downedPlantBoss && WorldGen.spawnNPC == 0 && num25 < 1) { WorldGen.spawnNPC = 209; } if (WorldGen.spawnNPC == 0 && num29 >= 4 && num26 < 1) { WorldGen.spawnNPC = 227; } if (flag6 && WorldGen.spawnNPC == 0 && num29 >= 8 && num24 < 1) { WorldGen.spawnNPC = 208; } } } } } } public static int DamageVar(float dmg) { float num = dmg * (1f + (float)Main.rand.Next(-15, 16) * 0.01f); return (int)Math.Round((double)num); } 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 void PlaySound(int type, int x = -1, int y = -1, int Style = 1) { int num = Style; try { if (!Main.dedServ) { if (Main.soundVolume != 0f) { bool flag = false; float num2 = 1f; float num3 = 0f; if (x == -1 || y == -1) { flag = true; } else { if (WorldGen.gen) { return; } if (Main.netMode == 2) { return; } Rectangle value = new Rectangle((int)(Main.screenPosition.X - (float)(Main.screenWidth * 2)), (int)(Main.screenPosition.Y - (float)(Main.screenHeight * 2)), Main.screenWidth * 5, Main.screenHeight * 5); Rectangle rectangle = new Rectangle(x, y, 1, 1); Vector2 vector = new Vector2(Main.screenPosition.X + (float)Main.screenWidth * 0.5f, Main.screenPosition.Y + (float)Main.screenHeight * 0.5f); if (rectangle.Intersects(value)) { flag = true; } if (flag) { num3 = ((float)x - vector.X) / ((float)Main.screenWidth * 0.5f); float num4 = Math.Abs((float)x - vector.X); float num5 = Math.Abs((float)y - vector.Y); float num6 = (float)Math.Sqrt((double)(num4 * num4 + num5 * num5)); num2 = 1f - num6 / ((float)Main.screenWidth * 1.5f); } } if (num3 < -1f) { num3 = -1f; } if (num3 > 1f) { num3 = 1f; } if (num2 > 1f) { num2 = 1f; } if (num2 > 0f) { if (flag) { num2 *= Main.soundVolume; if (type == 0) { int num7 = Main.rand.Next(3); Main.soundInstanceDig[num7].Stop(); Main.soundInstanceDig[num7] = Main.soundDig[num7].CreateInstance(); Main.soundInstanceDig[num7].Volume = num2; Main.soundInstanceDig[num7].Pan = num3; Main.soundInstanceDig[num7].Pitch = (float)Main.rand.Next(-10, 11) * 0.01f; Main.soundInstanceDig[num7].Play(); } else { if (type == 1) { int num8 = Main.rand.Next(3); Main.soundInstancePlayerHit[num8].Stop(); Main.soundInstancePlayerHit[num8] = Main.soundPlayerHit[num8].CreateInstance(); Main.soundInstancePlayerHit[num8].Volume = num2; Main.soundInstancePlayerHit[num8].Pan = num3; Main.soundInstancePlayerHit[num8].Play(); } else { if (type == 2) { if (num == 1) { int num9 = Main.rand.Next(3); if (num9 == 1) { num = 18; } if (num9 == 2) { num = 19; } } if (num != 9 && num != 10 && num != 24 && num != 26 && num != 34) { Main.soundInstanceItem[num].Stop(); } Main.soundInstanceItem[num] = Main.soundItem[num].CreateInstance(); Main.soundInstanceItem[num].Volume = num2; Main.soundInstanceItem[num].Pan = num3; if (num == 47) { Main.soundInstanceItem[num].Pitch = (float)Main.rand.Next(-5, 6) * 0.19f; } else { Main.soundInstanceItem[num].Pitch = (float)Main.rand.Next(-6, 7) * 0.01f; } if (num == 26 || num == 35) { Main.soundInstanceItem[num].Volume = num2 * 0.75f; Main.soundInstanceItem[num].Pitch = Main.harpNote; } Main.soundInstanceItem[num].Play(); } else { if (type == 3) { Main.soundInstanceNPCHit[num].Stop(); Main.soundInstanceNPCHit[num] = Main.soundNPCHit[num].CreateInstance(); Main.soundInstanceNPCHit[num].Volume = num2; Main.soundInstanceNPCHit[num].Pan = num3; Main.soundInstanceNPCHit[num].Pitch = (float)Main.rand.Next(-10, 11) * 0.01f; Main.soundInstanceNPCHit[num].Play(); } else { if (type == 4) { if (num != 10 || Main.soundInstanceNPCKilled[num].State != SoundState.Playing) { Main.soundInstanceNPCKilled[num] = Main.soundNPCKilled[num].CreateInstance(); Main.soundInstanceNPCKilled[num].Volume = num2; Main.soundInstanceNPCKilled[num].Pan = num3; Main.soundInstanceNPCKilled[num].Pitch = (float)Main.rand.Next(-10, 11) * 0.01f; Main.soundInstanceNPCKilled[num].Play(); } } else { if (type == 5) { Main.soundInstancePlayerKilled.Stop(); Main.soundInstancePlayerKilled = Main.soundPlayerKilled.CreateInstance(); Main.soundInstancePlayerKilled.Volume = num2; Main.soundInstancePlayerKilled.Pan = num3; Main.soundInstancePlayerKilled.Play(); } else { if (type == 6) { Main.soundInstanceGrass.Stop(); Main.soundInstanceGrass = Main.soundGrass.CreateInstance(); Main.soundInstanceGrass.Volume = num2; Main.soundInstanceGrass.Pan = num3; Main.soundInstanceGrass.Pitch = (float)Main.rand.Next(-30, 31) * 0.01f; Main.soundInstanceGrass.Play(); } else { if (type == 7) { Main.soundInstanceGrab.Stop(); Main.soundInstanceGrab = Main.soundGrab.CreateInstance(); Main.soundInstanceGrab.Volume = num2; Main.soundInstanceGrab.Pan = num3; Main.soundInstanceGrab.Pitch = (float)Main.rand.Next(-10, 11) * 0.01f; Main.soundInstanceGrab.Play(); } else { if (type == 8) { Main.soundInstanceDoorOpen.Stop(); Main.soundInstanceDoorOpen = Main.soundDoorOpen.CreateInstance(); Main.soundInstanceDoorOpen.Volume = num2; Main.soundInstanceDoorOpen.Pan = num3; Main.soundInstanceDoorOpen.Pitch = (float)Main.rand.Next(-20, 21) * 0.01f; Main.soundInstanceDoorOpen.Play(); } else { if (type == 9) { Main.soundInstanceDoorClosed.Stop(); Main.soundInstanceDoorClosed = Main.soundDoorClosed.CreateInstance(); Main.soundInstanceDoorClosed.Volume = num2; Main.soundInstanceDoorClosed.Pan = num3; Main.soundInstanceDoorOpen.Pitch = (float)Main.rand.Next(-20, 21) * 0.01f; Main.soundInstanceDoorClosed.Play(); } else { if (type == 10) { Main.soundInstanceMenuOpen.Stop(); Main.soundInstanceMenuOpen = Main.soundMenuOpen.CreateInstance(); Main.soundInstanceMenuOpen.Volume = num2; Main.soundInstanceMenuOpen.Pan = num3; Main.soundInstanceMenuOpen.Play(); } else { if (type == 11) { Main.soundInstanceMenuClose.Stop(); Main.soundInstanceMenuClose = Main.soundMenuClose.CreateInstance(); Main.soundInstanceMenuClose.Volume = num2; Main.soundInstanceMenuClose.Pan = num3; Main.soundInstanceMenuClose.Play(); } else { if (type == 12) { Main.soundInstanceMenuTick.Stop(); Main.soundInstanceMenuTick = Main.soundMenuTick.CreateInstance(); Main.soundInstanceMenuTick.Volume = num2; Main.soundInstanceMenuTick.Pan = num3; Main.soundInstanceMenuTick.Play(); } else { if (type == 13) { Main.soundInstanceShatter.Stop(); Main.soundInstanceShatter = Main.soundShatter.CreateInstance(); Main.soundInstanceShatter.Volume = num2; Main.soundInstanceShatter.Pan = num3; Main.soundInstanceShatter.Play(); } else { if (type == 14) { int num10 = Main.rand.Next(3); Main.soundInstanceZombie[num10] = Main.soundZombie[num10].CreateInstance(); Main.soundInstanceZombie[num10].Volume = num2 * 0.4f; Main.soundInstanceZombie[num10].Pan = num3; Main.soundInstanceZombie[num10].Play(); } else { if (type == 15) { if (Main.soundInstanceRoar[num].State == SoundState.Stopped) { Main.soundInstanceRoar[num] = Main.soundRoar[num].CreateInstance(); Main.soundInstanceRoar[num].Volume = num2; Main.soundInstanceRoar[num].Pan = num3; Main.soundInstanceRoar[num].Play(); } } else { if (type == 16) { Main.soundInstanceDoubleJump.Stop(); Main.soundInstanceDoubleJump = Main.soundDoubleJump.CreateInstance(); Main.soundInstanceDoubleJump.Volume = num2; Main.soundInstanceDoubleJump.Pan = num3; Main.soundInstanceDoubleJump.Pitch = (float)Main.rand.Next(-10, 11) * 0.01f; Main.soundInstanceDoubleJump.Play(); } else { if (type == 17) { Main.soundInstanceRun.Stop(); Main.soundInstanceRun = Main.soundRun.CreateInstance(); Main.soundInstanceRun.Volume = num2; Main.soundInstanceRun.Pan = num3; Main.soundInstanceRun.Pitch = (float)Main.rand.Next(-10, 11) * 0.01f; Main.soundInstanceRun.Play(); } else { if (type == 18) { Main.soundInstanceCoins = Main.soundCoins.CreateInstance(); Main.soundInstanceCoins.Volume = num2; Main.soundInstanceCoins.Pan = num3; Main.soundInstanceCoins.Play(); } else { if (type == 19) { if (Main.soundInstanceSplash[num].State == SoundState.Stopped) { Main.soundInstanceSplash[num] = Main.soundSplash[num].CreateInstance(); Main.soundInstanceSplash[num].Volume = num2; Main.soundInstanceSplash[num].Pan = num3; Main.soundInstanceSplash[num].Pitch = (float)Main.rand.Next(-10, 11) * 0.01f; Main.soundInstanceSplash[num].Play(); } } else { if (type == 20) { int num11 = Main.rand.Next(3); Main.soundInstanceFemaleHit[num11].Stop(); Main.soundInstanceFemaleHit[num11] = Main.soundFemaleHit[num11].CreateInstance(); Main.soundInstanceFemaleHit[num11].Volume = num2; Main.soundInstanceFemaleHit[num11].Pan = num3; Main.soundInstanceFemaleHit[num11].Play(); } else { if (type == 21) { int num12 = Main.rand.Next(3); Main.soundInstanceTink[num12].Stop(); Main.soundInstanceTink[num12] = Main.soundTink[num12].CreateInstance(); Main.soundInstanceTink[num12].Volume = num2; Main.soundInstanceTink[num12].Pan = num3; Main.soundInstanceTink[num12].Play(); } else { if (type == 22) { Main.soundInstanceUnlock.Stop(); Main.soundInstanceUnlock = Main.soundUnlock.CreateInstance(); Main.soundInstanceUnlock.Volume = num2; Main.soundInstanceUnlock.Pan = num3; Main.soundInstanceUnlock.Play(); } else { if (type == 23) { Main.soundInstanceDrown.Stop(); Main.soundInstanceDrown = Main.soundDrown.CreateInstance(); Main.soundInstanceDrown.Volume = num2; Main.soundInstanceDrown.Pan = num3; Main.soundInstanceDrown.Play(); } else { if (type == 24) { Main.soundInstanceChat = Main.soundChat.CreateInstance(); Main.soundInstanceChat.Volume = num2; Main.soundInstanceChat.Pan = num3; Main.soundInstanceChat.Play(); } else { if (type == 25) { Main.soundInstanceMaxMana = Main.soundMaxMana.CreateInstance(); Main.soundInstanceMaxMana.Volume = num2; Main.soundInstanceMaxMana.Pan = num3; Main.soundInstanceMaxMana.Play(); } else { if (type == 26) { int num13 = Main.rand.Next(3, 5); Main.soundInstanceZombie[num13] = Main.soundZombie[num13].CreateInstance(); Main.soundInstanceZombie[num13].Volume = num2 * 0.9f; Main.soundInstanceZombie[num13].Pan = num3; Main.soundInstanceSplash[num].Pitch = (float)Main.rand.Next(-10, 11) * 0.01f; Main.soundInstanceZombie[num13].Play(); } else { if (type == 27) { if (Main.soundInstancePixie.State == SoundState.Playing) { Main.soundInstancePixie.Volume = num2; Main.soundInstancePixie.Pan = num3; Main.soundInstancePixie.Pitch = (float)Main.rand.Next(-10, 11) * 0.01f; } else { Main.soundInstancePixie.Stop(); Main.soundInstancePixie = Main.soundPixie.CreateInstance(); Main.soundInstancePixie.Volume = num2; Main.soundInstancePixie.Pan = num3; Main.soundInstancePixie.Pitch = (float)Main.rand.Next(-10, 11) * 0.01f; Main.soundInstancePixie.Play(); } } else { if (type == 28) { if (Main.soundInstanceMech[num].State != SoundState.Playing) { Main.soundInstanceMech[num] = Main.soundMech[num].CreateInstance(); Main.soundInstanceMech[num].Volume = num2; Main.soundInstanceMech[num].Pan = num3; Main.soundInstanceMech[num].Pitch = (float)Main.rand.Next(-10, 11) * 0.01f; Main.soundInstanceMech[num].Play(); } } else { if (type == 29) { if (Main.soundInstanceMech[num].State != SoundState.Playing) { Main.soundInstanceMech[num] = Main.soundZombie[num].CreateInstance(); Main.soundInstanceMech[num].Volume = num2; Main.soundInstanceMech[num].Pan = num3; Main.soundInstanceMech[num].Pitch = (float)Main.rand.Next(-10, 11) * 0.01f; Main.soundInstanceMech[num].Play(); } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } catch { } } [CompilerGenerated] private static void b__0(char keyStroke) { if (Main.keyCount < 10) { Main.keyInt[Main.keyCount] = (int)keyStroke; Main.keyString[Main.keyCount] = string.Concat(keyStroke); Main.keyCount++; } } } }