From f3ff33db62ddb0149237d3d5175e92a80150435f Mon Sep 17 00:00:00 2001 From: Shank Date: Wed, 1 Jun 2011 00:57:57 -0600 Subject: [PATCH] Removing old crap --- Terraria/ChatLine.cs | 13 - Terraria/Chest.cs | 150 - Terraria/ClientSock.cs | 56 - Terraria/Cloud.cs | 210 - Terraria/Collision.cs | 681 - Terraria/CombatText.cs | 99 - Terraria/Dust.cs | 415 - Terraria/Game.ico | Bin 99678 -> 0 bytes Terraria/GameThumbnail.png | Bin 5734 -> 0 bytes Terraria/Gore.cs | 173 - Terraria/Item.cs | 3880 ------ Terraria/Lighting.cs | 395 - Terraria/Liquid.cs | 947 -- Terraria/LiquidBuffer.cs | 31 - Terraria/Main.cs | 9490 -------------- Terraria/NPC.cs | 6233 --------- Terraria/NetMessage.cs | 1335 -- Terraria/Netplay.cs | 465 - Terraria/Player.cs | 4565 ------- Terraria/Program.cs | 16 - Terraria/Projectile.cs | 2539 ---- Terraria/Recipe.cs | 996 -- Terraria/ServerSock.cs | 110 - Terraria/ShankShock.cs | 488 - Terraria/ShankShockCommandProcessor.cs | 31 - Terraria/Sign.cs | 78 - Terraria/Star.cs | 78 - Terraria/Tile.cs | 23 - Terraria/WorldGen.cs | 15666 ----------------------- Terraria/lbolt.ico | Bin 1150 -> 0 bytes Terraria/messageBuffer.cs | 1879 --- 31 files changed, 51042 deletions(-) delete mode 100644 Terraria/ChatLine.cs delete mode 100644 Terraria/Chest.cs delete mode 100644 Terraria/ClientSock.cs delete mode 100644 Terraria/Cloud.cs delete mode 100644 Terraria/Collision.cs delete mode 100644 Terraria/CombatText.cs delete mode 100644 Terraria/Dust.cs delete mode 100644 Terraria/Game.ico delete mode 100644 Terraria/GameThumbnail.png delete mode 100644 Terraria/Gore.cs delete mode 100644 Terraria/Item.cs delete mode 100644 Terraria/Lighting.cs delete mode 100644 Terraria/Liquid.cs delete mode 100644 Terraria/LiquidBuffer.cs delete mode 100644 Terraria/Main.cs delete mode 100644 Terraria/NPC.cs delete mode 100644 Terraria/NetMessage.cs delete mode 100644 Terraria/Netplay.cs delete mode 100644 Terraria/Player.cs delete mode 100644 Terraria/Program.cs delete mode 100644 Terraria/Projectile.cs delete mode 100644 Terraria/Recipe.cs delete mode 100644 Terraria/ServerSock.cs delete mode 100644 Terraria/ShankShock.cs delete mode 100644 Terraria/ShankShockCommandProcessor.cs delete mode 100644 Terraria/Sign.cs delete mode 100644 Terraria/Star.cs delete mode 100644 Terraria/Tile.cs delete mode 100644 Terraria/WorldGen.cs delete mode 100644 Terraria/lbolt.ico delete mode 100644 Terraria/messageBuffer.cs diff --git a/Terraria/ChatLine.cs b/Terraria/ChatLine.cs deleted file mode 100644 index d0fd1abe..00000000 --- a/Terraria/ChatLine.cs +++ /dev/null @@ -1,13 +0,0 @@ -namespace Terraria -{ - using Microsoft.Xna.Framework; - using System; - - public class ChatLine - { - public Color color = Color.White; - public int showTime; - public string text = ""; - } -} - diff --git a/Terraria/Chest.cs b/Terraria/Chest.cs deleted file mode 100644 index ad4f6057..00000000 --- a/Terraria/Chest.cs +++ /dev/null @@ -1,150 +0,0 @@ -namespace Terraria -{ - using System; - - public class Chest - { - public Item[] item = new Item[maxItems]; - public static int maxItems = 20; - public int x; - public int y; - - public static int CreateChest(int X, int Y) - { - for (int i = 0; i < 0x3e8; i++) - { - if (((Main.chest[i] != null) && (Main.chest[i].x == X)) && (Main.chest[i].y == Y)) - { - return -1; - } - } - for (int j = 0; j < 0x3e8; j++) - { - if (Main.chest[j] == null) - { - Main.chest[j] = new Chest(); - Main.chest[j].x = X; - Main.chest[j].y = Y; - for (int k = 0; k < maxItems; k++) - { - Main.chest[j].item[k] = new Item(); - } - return j; - } - } - return -1; - } - - public static bool DestroyChest(int X, int Y) - { - for (int i = 0; i < 0x3e8; i++) - { - if (((Main.chest[i] != null) && (Main.chest[i].x == X)) && (Main.chest[i].y == Y)) - { - for (int j = 0; j < maxItems; j++) - { - if ((Main.chest[i].item[j].type > 0) && (Main.chest[i].item[j].stack > 0)) - { - return false; - } - } - Main.chest[i] = null; - return true; - } - } - return true; - } - - public static int FindChest(int X, int Y) - { - for (int i = 0; i < 0x3e8; i++) - { - if (((Main.chest[i] != null) && (Main.chest[i].x == X)) && (Main.chest[i].y == Y)) - { - return i; - } - } - return -1; - } - - public void SetupShop(int type) - { - for (int i = 0; i < maxItems; i++) - { - this.item[i] = new Item(); - } - if (type == 1) - { - int index = 0; - this.item[index].SetDefaults("Mining Helmet"); - index++; - this.item[index].SetDefaults("Piggy Bank"); - index++; - this.item[index].SetDefaults("Iron Anvil"); - index++; - this.item[index].SetDefaults("Copper Pickaxe"); - index++; - this.item[index].SetDefaults("Copper Axe"); - index++; - this.item[index].SetDefaults("Torch"); - index++; - this.item[index].SetDefaults("Lesser Healing Potion"); - index++; - this.item[index].SetDefaults("Wooden Arrow"); - index++; - this.item[index].SetDefaults("Shuriken"); - index++; - } - else if (type == 2) - { - int num3 = 0; - this.item[num3].SetDefaults("Musket Ball"); - num3++; - this.item[num3].SetDefaults("Flintlock Pistol"); - num3++; - this.item[num3].SetDefaults("Minishark"); - num3++; - } - else if (type == 3) - { - int num4 = 0; - this.item[num4].SetDefaults("Purification Powder"); - num4++; - this.item[num4].SetDefaults("Acorn"); - num4++; - this.item[num4].SetDefaults("Grass Seeds"); - num4++; - this.item[num4].SetDefaults("Sunflower"); - num4++; - this.item[num4].SetDefaults(0x72); - num4++; - } - else if (type == 4) - { - int num5 = 0; - this.item[num5].SetDefaults("Grenade"); - num5++; - this.item[num5].SetDefaults("Bomb"); - num5++; - this.item[num5].SetDefaults("Dynamite"); - num5++; - } - } - - public static int UsingChest(int i) - { - if (Main.chest[i] != null) - { - for (int j = 0; j < 8; j++) - { - if (Main.player[j].chest == i) - { - return j; - } - } - } - return -1; - } - } -} - diff --git a/Terraria/ClientSock.cs b/Terraria/ClientSock.cs deleted file mode 100644 index 246b55e8..00000000 --- a/Terraria/ClientSock.cs +++ /dev/null @@ -1,56 +0,0 @@ -namespace Terraria -{ - using System; - using System.Net.Sockets; - - public class ClientSock - { - public bool active; - public bool locked; - public NetworkStream networkStream; - public byte[] readBuffer; - public int state; - public int statusCount; - public int statusMax; - public string statusText; - public TcpClient tcpClient = new TcpClient(); - public int timeOut; - public byte[] writeBuffer; - - public void ClientReadCallBack(IAsyncResult ar) - { - int streamLength = 0; - if (!Netplay.disconnect) - { - streamLength = this.networkStream.EndRead(ar); - if (streamLength == 0) - { - Netplay.disconnect = true; - Main.statusText = "Lost connection"; - } - else if (Main.ignoreErrors) - { - try - { - NetMessage.RecieveBytes(this.readBuffer, streamLength, 9); - } - catch - { - } - } - else - { - NetMessage.RecieveBytes(this.readBuffer, streamLength, 9); - } - } - this.locked = false; - } - - public void ClientWriteCallBack(IAsyncResult ar) - { - messageBuffer buffer1 = NetMessage.buffer[9]; - buffer1.spamCount--; - } - } -} - diff --git a/Terraria/Cloud.cs b/Terraria/Cloud.cs deleted file mode 100644 index b2404347..00000000 --- a/Terraria/Cloud.cs +++ /dev/null @@ -1,210 +0,0 @@ -namespace Terraria -{ - using Microsoft.Xna.Framework; - using System; - - public class Cloud - { - public bool active; - public int height; - public Vector2 position; - private static Random rand = new Random(); - public float rotation; - public float rSpeed; - public float scale; - public float sSpeed; - public int type; - public int width; - - public static void addCloud() - { - int index = -1; - for (int i = 0; i < 100; i++) - { - if (!Main.cloud[i].active) - { - index = i; - break; - } - } - if (index >= 0) - { - Main.cloud[index].rSpeed = 0f; - Main.cloud[index].sSpeed = 0f; - Main.cloud[index].type = rand.Next(4); - Main.cloud[index].scale = rand.Next(8, 13) * 0.1f; - Main.cloud[index].rotation = rand.Next(-10, 11) * 0.01f; - Main.cloud[index].width = (int) (Main.cloudTexture[Main.cloud[index].type].Width * Main.cloud[index].scale); - Main.cloud[index].height = (int) (Main.cloudTexture[Main.cloud[index].type].Height * Main.cloud[index].scale); - if (Main.windSpeed > 0f) - { - Main.cloud[index].position.X = (-Main.cloud[index].width - Main.cloudTexture[Main.cloud[index].type].Width) - rand.Next(Main.screenWidth * 2); - } - else - { - Main.cloud[index].position.X = (Main.screenWidth + Main.cloudTexture[Main.cloud[index].type].Width) + rand.Next(Main.screenWidth * 2); - } - Main.cloud[index].position.Y = rand.Next((int) (-Main.screenHeight * 0.25f), (int) (Main.screenHeight * 1.25)); - Main.cloud[index].position.Y -= rand.Next((int) (Main.screenHeight * 0.25f)); - Main.cloud[index].position.Y -= rand.Next((int) (Main.screenHeight * 0.25f)); - Cloud cloud1 = Main.cloud[index]; - cloud1.scale *= 2.2f - ((float) ((((double) (Main.cloud[index].position.Y + (Main.screenHeight * 0.25f))) / (Main.screenHeight * 1.5)) + 0.699999988079071)); - if (Main.cloud[index].scale > 1.4) - { - Main.cloud[index].scale = 1.4f; - } - if (Main.cloud[index].scale < 0.6) - { - Main.cloud[index].scale = 0.6f; - } - Main.cloud[index].active = true; - Rectangle rectangle = new Rectangle((int) Main.cloud[index].position.X, (int) Main.cloud[index].position.Y, Main.cloud[index].width, Main.cloud[index].height); - for (int j = 0; j < 100; j++) - { - if ((index != j) && Main.cloud[j].active) - { - Rectangle rectangle2 = new Rectangle((int) Main.cloud[j].position.X, (int) Main.cloud[j].position.Y, Main.cloud[j].width, Main.cloud[j].height); - if (rectangle.Intersects(rectangle2)) - { - Main.cloud[index].active = false; - } - } - } - } - } - - public object Clone() - { - return base.MemberwiseClone(); - } - - public static void resetClouds() - { - if (Main.cloudLimit >= 10) - { - Main.numClouds = rand.Next(10, Main.cloudLimit); - Main.windSpeed = 0f; - while (Main.windSpeed == 0f) - { - Main.windSpeed = rand.Next(-100, 0x65) * 0.01f; - } - for (int i = 0; i < 100; i++) - { - Main.cloud[i].active = false; - } - for (int j = 0; j < Main.numClouds; j++) - { - addCloud(); - } - for (int k = 0; k < Main.numClouds; k++) - { - if (Main.windSpeed < 0f) - { - Main.cloud[k].position.X -= Main.screenWidth * 2; - } - else - { - Main.cloud[k].position.X += Main.screenWidth * 2; - } - } - } - } - - public void Update() - { - if (Main.gameMenu) - { - this.position.X += (Main.windSpeed * this.scale) * 3f; - } - else - { - this.position.X += (Main.windSpeed - (Main.player[Main.myPlayer].velocity.X * 0.1f)) * this.scale; - } - if (Main.windSpeed > 0f) - { - if ((this.position.X - Main.cloudTexture[this.type].Width) > Main.screenWidth) - { - this.active = false; - } - } - else if (((this.position.X + this.width) + Main.cloudTexture[this.type].Width) < 0f) - { - this.active = false; - } - this.rSpeed += rand.Next(-10, 11) * 2E-05f; - if (this.rSpeed > 0.0007) - { - this.rSpeed = 0.0007f; - } - if (this.rSpeed < -0.0007) - { - this.rSpeed = -0.0007f; - } - if (this.rotation > 0.05) - { - this.rotation = 0.05f; - } - if (this.rotation < -0.05) - { - this.rotation = -0.05f; - } - this.sSpeed += rand.Next(-10, 11) * 2E-05f; - if (this.sSpeed > 0.0007) - { - this.sSpeed = 0.0007f; - } - if (this.sSpeed < -0.0007) - { - this.sSpeed = -0.0007f; - } - if (this.scale > 1.4) - { - this.scale = 1.4f; - } - if (this.scale < 0.6) - { - this.scale = 0.6f; - } - this.rotation += this.rSpeed; - this.scale += this.sSpeed; - this.width = (int) (Main.cloudTexture[this.type].Width * this.scale); - this.height = (int) (Main.cloudTexture[this.type].Height * this.scale); - } - - public static void UpdateClouds() - { - int num = 0; - for (int i = 0; i < 100; i++) - { - if (Main.cloud[i].active) - { - Main.cloud[i].Update(); - num++; - } - } - for (int j = 0; j < 100; j++) - { - if (Main.cloud[j].active) - { - if ((j > 1) && (!Main.cloud[j - 1].active || (Main.cloud[j - 1].scale > (Main.cloud[j].scale + 0.02)))) - { - Cloud cloud = (Cloud) Main.cloud[j - 1].Clone(); - Main.cloud[j - 1] = (Cloud) Main.cloud[j].Clone(); - Main.cloud[j] = cloud; - } - if ((j < 0x63) && (!Main.cloud[j].active || (Main.cloud[j + 1].scale < (Main.cloud[j].scale - 0.02)))) - { - Cloud cloud2 = (Cloud) Main.cloud[j + 1].Clone(); - Main.cloud[j + 1] = (Cloud) Main.cloud[j].Clone(); - Main.cloud[j] = cloud2; - } - } - } - if (num < Main.numClouds) - { - addCloud(); - } - } - } -} - diff --git a/Terraria/Collision.cs b/Terraria/Collision.cs deleted file mode 100644 index 995d5245..00000000 --- a/Terraria/Collision.cs +++ /dev/null @@ -1,681 +0,0 @@ -namespace Terraria -{ - using Microsoft.Xna.Framework; - using System; - using System.Runtime.InteropServices; - - public class Collision - { - public static Vector2 AnyCollision(Vector2 Position, Vector2 Velocity, int Width, int Height) - { - Vector2 vector = Velocity; - Vector2 vector2 = Velocity; - Vector2 vector4 = Position + Velocity; - Vector2 vector5 = Position; - int num = ((int) (Position.X / 16f)) - 1; - int maxTilesX = ((int) ((Position.X + Width) / 16f)) + 2; - int num3 = ((int) (Position.Y / 16f)) - 1; - int maxTilesY = ((int) ((Position.Y + Height) / 16f)) + 2; - int num5 = -1; - int num6 = -1; - int num7 = -1; - int num8 = -1; - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num3 < 0) - { - num3 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int i = num; i < maxTilesX; i++) - { - for (int j = num3; j < maxTilesY; j++) - { - if ((Main.tile[i, j] != null) && Main.tile[i, j].active) - { - Vector2 vector3; - vector3.X = i * 0x10; - vector3.Y = j * 0x10; - if ((((vector4.X + Width) > vector3.X) && (vector4.X < (vector3.X + 16f))) && (((vector4.Y + Height) > vector3.Y) && (vector4.Y < (vector3.Y + 16f)))) - { - if ((vector5.Y + Height) <= vector3.Y) - { - num7 = i; - num8 = j; - if (num7 != num5) - { - vector.Y = vector3.Y - (vector5.Y + Height); - } - } - else if (((vector5.X + Width) <= vector3.X) && !Main.tileSolidTop[Main.tile[i, j].type]) - { - num5 = i; - num6 = j; - if (num6 != num8) - { - vector.X = vector3.X - (vector5.X + Width); - } - if (num7 == num5) - { - vector.Y = vector2.Y; - } - } - else if ((vector5.X >= (vector3.X + 16f)) && !Main.tileSolidTop[Main.tile[i, j].type]) - { - num5 = i; - num6 = j; - if (num6 != num8) - { - vector.X = (vector3.X + 16f) - vector5.X; - } - if (num7 == num5) - { - vector.Y = vector2.Y; - } - } - else if ((vector5.Y >= (vector3.Y + 16f)) && !Main.tileSolidTop[Main.tile[i, j].type]) - { - num7 = i; - num8 = j; - vector.Y = ((vector3.Y + 16f) - vector5.Y) + 0.01f; - if (num8 == num6) - { - vector.X = vector2.X + 0.01f; - } - } - } - } - } - } - return vector; - } - - public static bool CanHit(Vector2 Position1, int Width1, int Height1, Vector2 Position2, int Width2, int Height2) - { - int num = (int) ((Position1.X + (Width1 / 2)) / 16f); - int num2 = (int) ((Position1.Y + (Height1 / 2)) / 16f); - int num3 = (int) ((Position2.X + (Width2 / 2)) / 16f); - int num4 = (int) ((Position2.Y + (Height2 / 2)) / 16f); - do - { - int num5 = Math.Abs((int) (num - num3)); - int num6 = Math.Abs((int) (num2 - num4)); - if ((num == num3) && (num2 == num4)) - { - return true; - } - if (num5 > num6) - { - if (num < num3) - { - num++; - } - else - { - num--; - } - if (Main.tile[num, num2 - 1] == null) - { - Main.tile[num, num2 - 1] = new Tile(); - } - if (Main.tile[num, num2 + 1] == null) - { - Main.tile[num, num2 + 1] = new Tile(); - } - if (((Main.tile[num, num2 - 1].active && Main.tileSolid[Main.tile[num, num2 - 1].type]) && (!Main.tileSolidTop[Main.tile[num, num2 - 1].type] && Main.tile[num, num2 + 1].active)) && (Main.tileSolid[Main.tile[num, num2 + 1].type] && !Main.tileSolidTop[Main.tile[num, num2 + 1].type])) - { - return false; - } - } - else - { - if (num2 < num4) - { - num2++; - } - else - { - num2--; - } - if (Main.tile[num - 1, num2] == null) - { - Main.tile[num - 1, num2] = new Tile(); - } - if (Main.tile[num + 1, num2] == null) - { - Main.tile[num + 1, num2] = new Tile(); - } - if (((Main.tile[num - 1, num2].active && Main.tileSolid[Main.tile[num - 1, num2].type]) && (!Main.tileSolidTop[Main.tile[num - 1, num2].type] && Main.tile[num + 1, num2].active)) && (Main.tileSolid[Main.tile[num + 1, num2].type] && !Main.tileSolidTop[Main.tile[num + 1, num2].type])) - { - return false; - } - } - if (Main.tile[num, num2] == null) - { - Main.tile[num, num2] = new Tile(); - } - } - while ((!Main.tile[num, num2].active || !Main.tileSolid[Main.tile[num, num2].type]) || Main.tileSolidTop[Main.tile[num, num2].type]); - return false; - } - - public static bool DrownCollision(Vector2 Position, int Width, int Height) - { - Vector2 vector2 = new Vector2(Position.X + (Width / 2), Position.Y + (Height / 2)); - int num = 10; - int num2 = 12; - if (num > Width) - { - num = Width; - } - if (num2 > Height) - { - num2 = Height; - } - vector2 = new Vector2(vector2.X - (num / 2), Position.Y + 2f); - int num3 = ((int) (Position.X / 16f)) - 1; - int maxTilesX = ((int) ((Position.X + Width) / 16f)) + 2; - int num5 = ((int) (Position.Y / 16f)) - 1; - int maxTilesY = ((int) ((Position.Y + Height) / 16f)) + 2; - if (num3 < 0) - { - num3 = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num5 < 0) - { - num5 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int i = num3; i < maxTilesX; i++) - { - for (int j = num5; j < maxTilesY; j++) - { - if ((Main.tile[i, j] != null) && (Main.tile[i, j].liquid > 0)) - { - Vector2 vector; - vector.X = i * 0x10; - vector.Y = j * 0x10; - int num9 = 0x10; - float num10 = 0x100 - Main.tile[i, j].liquid; - num10 /= 32f; - vector.Y += num10 * 2f; - num9 -= (int) (num10 * 2f); - if ((((vector2.X + num) > vector.X) && (vector2.X < (vector.X + 16f))) && (((vector2.Y + num2) > vector.Y) && (vector2.Y < (vector.Y + num9)))) - { - return true; - } - } - } - } - return false; - } - - public static bool EmptyTile(int i, int j, bool ignoreTiles = false) - { - Rectangle rectangle = new Rectangle(i * 0x10, j * 0x10, 0x10, 0x10); - if (Main.tile[i, j].active && !ignoreTiles) - { - return false; - } - for (int k = 0; k < 8; k++) - { - if (Main.player[k].active && rectangle.Intersects(new Rectangle((int) Main.player[k].position.X, (int) Main.player[k].position.Y, Main.player[k].width, Main.player[k].height))) - { - return false; - } - } - for (int m = 0; m < 200; m++) - { - if (Main.item[m].active && rectangle.Intersects(new Rectangle((int) Main.item[m].position.X, (int) Main.item[m].position.Y, Main.item[m].width, Main.item[m].height))) - { - return false; - } - } - for (int n = 0; n < 0x3e8; n++) - { - if (Main.npc[n].active && rectangle.Intersects(new Rectangle((int) Main.npc[n].position.X, (int) Main.npc[n].position.Y, Main.npc[n].width, Main.npc[n].height))) - { - return false; - } - } - return true; - } - - public static void HitTiles(Vector2 Position, Vector2 Velocity, int Width, int Height) - { - Vector2 vector2 = Position + Velocity; - int num = ((int) (Position.X / 16f)) - 1; - int maxTilesX = ((int) ((Position.X + Width) / 16f)) + 2; - int num3 = ((int) (Position.Y / 16f)) - 1; - int maxTilesY = ((int) ((Position.Y + Height) / 16f)) + 2; - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num3 < 0) - { - num3 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int i = num; i < maxTilesX; i++) - { - for (int j = num3; j < maxTilesY; j++) - { - if (((Main.tile[i, j] != null) && Main.tile[i, j].active) && (Main.tileSolid[Main.tile[i, j].type] || (Main.tileSolidTop[Main.tile[i, j].type] && (Main.tile[i, j].frameY == 0)))) - { - Vector2 vector; - vector.X = i * 0x10; - vector.Y = j * 0x10; - if ((((vector2.X + Width) >= vector.X) && (vector2.X <= (vector.X + 16f))) && (((vector2.Y + Height) >= vector.Y) && (vector2.Y <= (vector.Y + 16f)))) - { - WorldGen.KillTile(i, j, true, true, false); - } - } - } - } - } - - public static Vector2 HurtTiles(Vector2 Position, Vector2 Velocity, int Width, int Height, bool fireImmune = false) - { - Vector2 vector2 = Position; - int num = ((int) (Position.X / 16f)) - 1; - int maxTilesX = ((int) ((Position.X + Width) / 16f)) + 2; - int num3 = ((int) (Position.Y / 16f)) - 1; - int maxTilesY = ((int) ((Position.Y + Height) / 16f)) + 2; - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num3 < 0) - { - num3 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int i = num; i < maxTilesX; i++) - { - for (int j = num3; j < maxTilesY; j++) - { - if (((Main.tile[i, j] != null) && Main.tile[i, j].active) && ((((Main.tile[i, j].type == 0x20) || (Main.tile[i, j].type == 0x25)) || ((Main.tile[i, j].type == 0x30) || (Main.tile[i, j].type == 0x35))) || (((Main.tile[i, j].type == 0x3a) || (Main.tile[i, j].type == 0x45)) || (Main.tile[i, j].type == 0x4c)))) - { - Vector2 vector; - vector.X = i * 0x10; - vector.Y = j * 0x10; - int num7 = 0; - int type = Main.tile[i, j].type; - switch (type) - { - case 0x20: - case 0x45: - if ((((vector2.X + Width) > vector.X) && (vector2.X < (vector.X + 16f))) && (((vector2.Y + Height) > vector.Y) && (vector2.Y < (vector.Y + 16.01)))) - { - int num9 = 1; - if ((vector2.X + (Width / 2)) < (vector.X + 8f)) - { - num9 = -1; - } - num7 = 10; - if (type == 0x45) - { - num7 = 0x19; - } - return new Vector2((float) num9, (float) num7); - } - break; - - case 0x35: - if (((((vector2.X + Width) - 2f) >= vector.X) && ((vector2.X + 2f) <= (vector.X + 16f))) && ((((vector2.Y + Height) - 2f) >= vector.Y) && ((vector2.Y + 2f) <= (vector.Y + 16f)))) - { - int num10 = 1; - if ((vector2.X + (Width / 2)) < (vector.X + 8f)) - { - num10 = -1; - } - if (type == 0x35) - { - num7 = 20; - } - return new Vector2((float) num10, (float) num7); - } - break; - - default: - if ((((vector2.X + Width) >= vector.X) && (vector2.X <= (vector.X + 16f))) && (((vector2.Y + Height) >= vector.Y) && (vector2.Y <= (vector.Y + 16.01)))) - { - int num11 = 1; - if ((vector2.X + (Width / 2)) < (vector.X + 8f)) - { - num11 = -1; - } - if (!fireImmune && (((type == 0x25) || (type == 0x3a)) || (type == 0x4c))) - { - num7 = 20; - } - if (type == 0x30) - { - num7 = 40; - } - return new Vector2((float) num11, (float) num7); - } - break; - } - } - } - } - return new Vector2(); - } - - public static bool LavaCollision(Vector2 Position, int Width, int Height) - { - int num = ((int) (Position.X / 16f)) - 1; - int maxTilesX = ((int) ((Position.X + Width) / 16f)) + 2; - int num3 = ((int) (Position.Y / 16f)) - 1; - int maxTilesY = ((int) ((Position.Y + Height) / 16f)) + 2; - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num3 < 0) - { - num3 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int i = num; i < maxTilesX; i++) - { - for (int j = num3; j < maxTilesY; j++) - { - if (((Main.tile[i, j] != null) && (Main.tile[i, j].liquid > 0)) && Main.tile[i, j].lava) - { - Vector2 vector; - vector.X = i * 0x10; - vector.Y = j * 0x10; - int num7 = 0x10; - float num8 = 0x100 - Main.tile[i, j].liquid; - num8 /= 32f; - vector.Y += num8 * 2f; - num7 -= (int) (num8 * 2f); - if ((((Position.X + Width) > vector.X) && (Position.X < (vector.X + 16f))) && (((Position.Y + Height) > vector.Y) && (Position.Y < (vector.Y + num7)))) - { - return true; - } - } - } - } - return false; - } - - public static bool SolidTiles(int startX, int endX, int startY, int endY) - { - if (startX < 0) - { - return true; - } - if (endX >= Main.maxTilesX) - { - return true; - } - if (startY < 0) - { - return true; - } - if (endY >= Main.maxTilesY) - { - return true; - } - for (int i = startX; i < (endX + 1); i++) - { - for (int j = startY; j < (endY + 1); j++) - { - if (Main.tile[i, j] == null) - { - return false; - } - if ((Main.tile[i, j].active && Main.tileSolid[Main.tile[i, j].type]) && !Main.tileSolidTop[Main.tile[i, j].type]) - { - return true; - } - } - } - return false; - } - - public static bool StickyTiles(Vector2 Position, Vector2 Velocity, int Width, int Height) - { - Vector2 vector2 = Position; - bool flag = false; - int num = ((int) (Position.X / 16f)) - 1; - int maxTilesX = ((int) ((Position.X + Width) / 16f)) + 2; - int num3 = ((int) (Position.Y / 16f)) - 1; - int maxTilesY = ((int) ((Position.Y + Height) / 16f)) + 2; - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num3 < 0) - { - num3 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int i = num; i < maxTilesX; i++) - { - for (int j = num3; j < maxTilesY; j++) - { - if (((Main.tile[i, j] != null) && Main.tile[i, j].active) && (Main.tile[i, j].type == 0x33)) - { - Vector2 vector; - vector.X = i * 0x10; - vector.Y = j * 0x10; - if ((((vector2.X + Width) > vector.X) && (vector2.X < (vector.X + 16f))) && (((vector2.Y + Height) > vector.Y) && (vector2.Y < (vector.Y + 16.01)))) - { - if (((Math.Abs(Velocity.X) + Math.Abs(Velocity.Y)) > 0.7) && (Main.rand.Next(30) == 0)) - { - Color newColor = new Color(); - Dust.NewDust(new Vector2((float) (i * 0x10), (float) (j * 0x10)), 0x10, 0x10, 30, 0f, 0f, 0, newColor, 1f); - } - flag = true; - } - } - } - } - return flag; - } - - public static Vector2 TileCollision(Vector2 Position, Vector2 Velocity, int Width, int Height, bool fallThrough = false, bool fall2 = false) - { - Vector2 vector = Velocity; - Vector2 vector2 = Velocity; - Vector2 vector4 = Position + Velocity; - Vector2 vector5 = Position; - int num = ((int) (Position.X / 16f)) - 1; - int maxTilesX = ((int) ((Position.X + Width) / 16f)) + 2; - int num3 = ((int) (Position.Y / 16f)) - 1; - int maxTilesY = ((int) ((Position.Y + Height) / 16f)) + 2; - int num5 = -1; - int num6 = -1; - int num7 = -1; - int num8 = -1; - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num3 < 0) - { - num3 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int i = num; i < maxTilesX; i++) - { - for (int j = num3; j < maxTilesY; j++) - { - if (((Main.tile[i, j] != null) && Main.tile[i, j].active) && (Main.tileSolid[Main.tile[i, j].type] || (Main.tileSolidTop[Main.tile[i, j].type] && (Main.tile[i, j].frameY == 0)))) - { - Vector2 vector3; - vector3.X = i * 0x10; - vector3.Y = j * 0x10; - if ((((vector4.X + Width) > vector3.X) && (vector4.X < (vector3.X + 16f))) && (((vector4.Y + Height) > vector3.Y) && (vector4.Y < (vector3.Y + 16f)))) - { - if ((vector5.Y + Height) <= vector3.Y) - { - if ((!Main.tileSolidTop[Main.tile[i, j].type] || !fallThrough) || ((Velocity.Y > 1f) && !fall2)) - { - num7 = i; - num8 = j; - if (num7 != num5) - { - vector.Y = vector3.Y - (vector5.Y + Height); - } - } - } - else if (((vector5.X + Width) <= vector3.X) && !Main.tileSolidTop[Main.tile[i, j].type]) - { - num5 = i; - num6 = j; - if (num6 != num8) - { - vector.X = vector3.X - (vector5.X + Width); - } - if (num7 == num5) - { - vector.Y = vector2.Y; - } - } - else if ((vector5.X >= (vector3.X + 16f)) && !Main.tileSolidTop[Main.tile[i, j].type]) - { - num5 = i; - num6 = j; - if (num6 != num8) - { - vector.X = (vector3.X + 16f) - vector5.X; - } - if (num7 == num5) - { - vector.Y = vector2.Y; - } - } - else if ((vector5.Y >= (vector3.Y + 16f)) && !Main.tileSolidTop[Main.tile[i, j].type]) - { - num7 = i; - num8 = j; - vector.Y = ((vector3.Y + 16f) - vector5.Y) + 0.01f; - if (num8 == num6) - { - vector.X = vector2.X + 0.01f; - } - } - } - } - } - } - return vector; - } - - public static bool WetCollision(Vector2 Position, int Width, int Height) - { - Vector2 vector2 = new Vector2(Position.X + (Width / 2), Position.Y + (Height / 2)); - int num = 10; - int num2 = Height / 2; - if (num > Width) - { - num = Width; - } - if (num2 > Height) - { - num2 = Height; - } - vector2 = new Vector2(vector2.X - (num / 2), vector2.Y - (num2 / 2)); - int num3 = ((int) (Position.X / 16f)) - 1; - int maxTilesX = ((int) ((Position.X + Width) / 16f)) + 2; - int num5 = ((int) (Position.Y / 16f)) - 1; - int maxTilesY = ((int) ((Position.Y + Height) / 16f)) + 2; - if (num3 < 0) - { - num3 = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num5 < 0) - { - num5 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int i = num3; i < maxTilesX; i++) - { - for (int j = num5; j < maxTilesY; j++) - { - if ((Main.tile[i, j] != null) && (Main.tile[i, j].liquid > 0)) - { - Vector2 vector; - vector.X = i * 0x10; - vector.Y = j * 0x10; - int num9 = 0x10; - float num10 = 0x100 - Main.tile[i, j].liquid; - num10 /= 32f; - vector.Y += num10 * 2f; - num9 -= (int) (num10 * 2f); - if ((((vector2.X + num) > vector.X) && (vector2.X < (vector.X + 16f))) && (((vector2.Y + num2) > vector.Y) && (vector2.Y < (vector.Y + num9)))) - { - return true; - } - } - } - } - return false; - } - } -} - diff --git a/Terraria/CombatText.cs b/Terraria/CombatText.cs deleted file mode 100644 index 8c72d726..00000000 --- a/Terraria/CombatText.cs +++ /dev/null @@ -1,99 +0,0 @@ -namespace Terraria -{ - using Microsoft.Xna.Framework; - using System; - - public class CombatText - { - public bool active; - public float alpha; - public int alphaDir = 1; - public Color color; - public int lifeTime; - public Vector2 position; - public float rotation; - public float scale = 1f; - public string text; - public Vector2 velocity; - - public static void NewText(Rectangle location, Color color, string text) - { - for (int i = 0; i < 100; i++) - { - if (!Main.combatText[i].active) - { - Vector2 vector = Main.fontCombatText.MeasureString(text); - Main.combatText[i].alpha = 1f; - Main.combatText[i].alphaDir = -1; - Main.combatText[i].active = true; - Main.combatText[i].scale = 0f; - Main.combatText[i].rotation = 0f; - Main.combatText[i].position.X = (location.X + (location.Width * 0.5f)) - (vector.X * 0.5f); - Main.combatText[i].position.Y = (location.Y + (location.Height * 0.25f)) - (vector.Y * 0.5f); - Main.combatText[i].position.X += Main.rand.Next(-((int) (location.Width * 0.5)), ((int) (location.Width * 0.5)) + 1); - Main.combatText[i].position.Y += Main.rand.Next(-((int) (location.Height * 0.5)), ((int) (location.Height * 0.5)) + 1); - Main.combatText[i].color = color; - Main.combatText[i].text = text; - Main.combatText[i].velocity.Y = -7f; - Main.combatText[i].lifeTime = 60; - return; - } - } - } - - public void Update() - { - if (this.active) - { - this.alpha += this.alphaDir * 0.05f; - if (this.alpha <= 0.6) - { - this.alpha = 0.6f; - this.alphaDir = 1; - } - if (this.alpha >= 1f) - { - this.alpha = 1f; - this.alphaDir = -1; - } - this.velocity.Y *= 0.92f; - this.velocity.X *= 0.93f; - this.position += this.velocity; - this.lifeTime--; - if (this.lifeTime <= 0) - { - this.scale -= 0.1f; - if (this.scale < 0.1) - { - this.active = false; - } - this.lifeTime = 0; - } - else - { - if (this.scale < 1f) - { - this.scale += 0.1f; - } - if (this.scale > 1f) - { - this.scale = 1f; - } - } - } - } - - public static void UpdateCombatText() - { - for (int i = 0; i < 100; i++) - { - if (Main.combatText[i].active) - { - Main.combatText[i].Update(); - } - } - } - - } -} - diff --git a/Terraria/Dust.cs b/Terraria/Dust.cs deleted file mode 100644 index 12ea244e..00000000 --- a/Terraria/Dust.cs +++ /dev/null @@ -1,415 +0,0 @@ -namespace Terraria -{ - using Microsoft.Xna.Framework; - using System; - using System.Runtime.InteropServices; - - public class Dust - { - public bool active; - public int alpha; - public Color color; - public Rectangle frame; - public bool noGravity; - public bool noLight; - public Vector2 position; - public float rotation; - public float scale; - public int type; - public Vector2 velocity; - - public Color GetAlpha(Color newColor) - { - int num; - int num2; - int num3; - if ((((this.type == 15) || (this.type == 20)) || ((this.type == 0x15) || (this.type == 0x1d))) || ((this.type == 0x23) || (this.type == 0x29))) - { - num = newColor.R - (this.alpha / 3); - num2 = newColor.G - (this.alpha / 3); - num3 = newColor.B - (this.alpha / 3); - } - else - { - num = newColor.R - this.alpha; - num2 = newColor.G - this.alpha; - num3 = newColor.B - this.alpha; - } - int a = newColor.A - this.alpha; - if (a < 0) - { - a = 0; - } - if (a > 0xff) - { - a = 0xff; - } - return new Color(num, num2, num3, a); - } - - public Color GetColor(Color newColor) - { - int r = this.color.R - (0xff - newColor.R); - int g = this.color.G - (0xff - newColor.G); - int b = this.color.B - (0xff - newColor.B); - int a = this.color.A - (0xff - newColor.A); - if (r < 0) - { - r = 0; - } - if (r > 0xff) - { - r = 0xff; - } - if (g < 0) - { - g = 0; - } - if (g > 0xff) - { - g = 0xff; - } - if (b < 0) - { - b = 0; - } - if (b > 0xff) - { - b = 0xff; - } - if (a < 0) - { - a = 0; - } - if (a > 0xff) - { - a = 0xff; - } - return new Color(r, g, b, a); - } - - public static int NewDust(Vector2 Position, int Width, int Height, int Type, float SpeedX = 0f, float SpeedY = 0f, int Alpha = 0, Color newColor = new Color(), float Scale = 1f) - { - if (WorldGen.gen) - { - return 0; - } - if (Main.netMode == 2) - { - return 0; - } - int num = 0; - for (int i = 0; i < 0x7d0; i++) - { - if (!Main.dust[i].active) - { - num = i; - Main.dust[i].active = true; - Main.dust[i].type = Type; - Main.dust[i].noGravity = false; - Main.dust[i].color = newColor; - Main.dust[i].alpha = Alpha; - Main.dust[i].position.X = (Position.X + Main.rand.Next(Width - 4)) + 4f; - Main.dust[i].position.Y = (Position.Y + Main.rand.Next(Height - 4)) + 4f; - Main.dust[i].velocity.X = (Main.rand.Next(-20, 0x15) * 0.1f) + SpeedX; - Main.dust[i].velocity.Y = (Main.rand.Next(-20, 0x15) * 0.1f) + SpeedY; - Main.dust[i].frame.X = 10 * Type; - Main.dust[i].frame.Y = 10 * Main.rand.Next(3); - Main.dust[i].frame.Width = 8; - Main.dust[i].frame.Height = 8; - Main.dust[i].rotation = 0f; - Main.dust[i].scale = 1f + (Main.rand.Next(-20, 0x15) * 0.01f); - Dust dust1 = Main.dust[i]; - dust1.scale *= Scale; - Main.dust[i].noLight = false; - if ((Main.dust[i].type == 6) || (Main.dust[i].type == 0x1d)) - { - Main.dust[i].velocity.Y = Main.rand.Next(-10, 6) * 0.1f; - Main.dust[i].velocity.X *= 0.3f; - Dust dust2 = Main.dust[i]; - dust2.scale *= 0.7f; - } - if (Main.dust[i].type == 0x21) - { - Main.dust[i].alpha = 170; - Dust dust3 = Main.dust[i]; - dust3.velocity = (Vector2) (dust3.velocity * 0.5f); - Main.dust[i].velocity.Y++; - } - if (Main.dust[i].type == 0x29) - { - Dust dust4 = Main.dust[i]; - dust4.velocity = (Vector2) (dust4.velocity * 0f); - } - if ((Main.dust[i].type == 0x22) || (Main.dust[i].type == 0x23)) - { - Dust dust5 = Main.dust[i]; - dust5.velocity = (Vector2) (dust5.velocity * 0.1f); - Main.dust[i].velocity.Y = -0.5f; - if ((Main.dust[i].type == 0x22) && !Collision.WetCollision(new Vector2(Main.dust[i].position.X, Main.dust[i].position.Y - 8f), 4, 4)) - { - Main.dust[i].active = false; - } - } - return num; - } - } - return num; - } - - public static void UpdateDust() - { - for (int i = 0; i < 0x7d0; i++) - { - if (Main.dust[i].active) - { - Dust dust1 = Main.dust[i]; - dust1.position += Main.dust[i].velocity; - if ((Main.dust[i].type == 6) || (Main.dust[i].type == 0x1d)) - { - if (!Main.dust[i].noGravity) - { - Main.dust[i].velocity.Y += 0.05f; - } - if (!Main.dust[i].noLight) - { - float lightness = Main.dust[i].scale * 1.6f; - if (Main.dust[i].type == 0x1d) - { - lightness *= 0.3f; - } - if (lightness > 1f) - { - lightness = 1f; - } - Lighting.addLight((int) (Main.dust[i].position.X / 16f), (int) (Main.dust[i].position.Y / 16f), lightness); - } - } - else if (((Main.dust[i].type == 14) || (Main.dust[i].type == 0x10)) || (Main.dust[i].type == 0x1f)) - { - Main.dust[i].velocity.Y *= 0.98f; - Main.dust[i].velocity.X *= 0.98f; - } - else if (Main.dust[i].type == 0x20) - { - Dust dust2 = Main.dust[i]; - dust2.scale -= 0.01f; - Main.dust[i].velocity.X *= 0.96f; - Main.dust[i].velocity.Y += 0.1f; - } - else if (Main.dust[i].type == 15) - { - Main.dust[i].velocity.Y *= 0.98f; - Main.dust[i].velocity.X *= 0.98f; - float scale = Main.dust[i].scale; - if (scale > 1f) - { - scale = 1f; - } - Lighting.addLight((int) (Main.dust[i].position.X / 16f), (int) (Main.dust[i].position.Y / 16f), scale); - } - else if ((Main.dust[i].type == 20) || (Main.dust[i].type == 0x15)) - { - Dust dust3 = Main.dust[i]; - dust3.scale += 0.005f; - Main.dust[i].velocity.Y *= 0.94f; - Main.dust[i].velocity.X *= 0.94f; - float num4 = Main.dust[i].scale * 0.8f; - if (Main.dust[i].type == 0x15) - { - num4 = Main.dust[i].scale * 0.4f; - } - if (num4 > 1f) - { - num4 = 1f; - } - Lighting.addLight((int) (Main.dust[i].position.X / 16f), (int) (Main.dust[i].position.Y / 16f), num4); - } - else if (Main.dust[i].type == 0x1b) - { - Dust dust4 = Main.dust[i]; - dust4.velocity = (Vector2) (dust4.velocity * 0.94f); - Dust dust5 = Main.dust[i]; - dust5.scale += 0.002f; - float num5 = Main.dust[i].scale; - if (num5 > 1f) - { - num5 = 1f; - } - Lighting.addLight((int) (Main.dust[i].position.X / 16f), (int) (Main.dust[i].position.Y / 16f), num5); - } - else if (!Main.dust[i].noGravity && (Main.dust[i].type != 0x29)) - { - Main.dust[i].velocity.Y += 0.1f; - } - if ((Main.dust[i].type == 5) && Main.dust[i].noGravity) - { - Dust dust6 = Main.dust[i]; - dust6.scale -= 0.04f; - } - if (Main.dust[i].type == 0x21) - { - if (Collision.WetCollision(new Vector2(Main.dust[i].position.X, Main.dust[i].position.Y), 4, 4)) - { - Dust dust7 = Main.dust[i]; - dust7.alpha += 20; - Dust dust8 = Main.dust[i]; - dust8.scale -= 0.1f; - } - Dust dust9 = Main.dust[i]; - dust9.alpha += 2; - Dust dust10 = Main.dust[i]; - dust10.scale -= 0.005f; - if (Main.dust[i].alpha > 0xff) - { - Main.dust[i].scale = 0f; - } - Main.dust[i].velocity.X *= 0.93f; - if (Main.dust[i].velocity.Y > 4f) - { - Main.dust[i].velocity.Y = 4f; - } - if (Main.dust[i].noGravity) - { - if (Main.dust[i].velocity.X < 0f) - { - Dust dust11 = Main.dust[i]; - dust11.rotation -= 0.2f; - } - else - { - Dust dust12 = Main.dust[i]; - dust12.rotation += 0.2f; - } - Dust dust13 = Main.dust[i]; - dust13.scale += 0.03f; - Main.dust[i].velocity.X *= 1.05f; - Main.dust[i].velocity.Y += 0.15f; - } - } - if ((Main.dust[i].type == 0x23) && Main.dust[i].noGravity) - { - Dust dust14 = Main.dust[i]; - dust14.scale += 0.02f; - if (Main.dust[i].scale < 1f) - { - Main.dust[i].velocity.Y += 0.075f; - } - Main.dust[i].velocity.X *= 1.08f; - if (Main.dust[i].velocity.X > 0f) - { - Dust dust15 = Main.dust[i]; - dust15.rotation += 0.01f; - } - else - { - Dust dust16 = Main.dust[i]; - dust16.rotation -= 0.01f; - } - } - else if ((Main.dust[i].type == 0x22) || (Main.dust[i].type == 0x23)) - { - if (!Collision.WetCollision(new Vector2(Main.dust[i].position.X, Main.dust[i].position.Y - 8f), 4, 4)) - { - Main.dust[i].scale = 0f; - } - else - { - Dust dust17 = Main.dust[i]; - dust17.alpha += Main.rand.Next(2); - if (Main.dust[i].alpha > 0xff) - { - Main.dust[i].scale = 0f; - } - Main.dust[i].velocity.Y = -0.5f; - if (Main.dust[i].type == 0x22) - { - Dust dust18 = Main.dust[i]; - dust18.scale += 0.005f; - } - else - { - Dust dust19 = Main.dust[i]; - dust19.alpha++; - Dust dust20 = Main.dust[i]; - dust20.scale -= 0.01f; - Main.dust[i].velocity.Y = -0.2f; - } - Main.dust[i].velocity.X += Main.rand.Next(-10, 10) * 0.002f; - if (Main.dust[i].velocity.X < -0.25) - { - Main.dust[i].velocity.X = -0.25f; - } - if (Main.dust[i].velocity.X > 0.25) - { - Main.dust[i].velocity.X = 0.25f; - } - } - if (Main.dust[i].type == 0x23) - { - float num6 = Main.dust[i].scale * 1.6f; - if (num6 > 1f) - { - num6 = 1f; - } - Lighting.addLight((int) (Main.dust[i].position.X / 16f), (int) (Main.dust[i].position.Y / 16f), num6); - } - } - if (Main.dust[i].type == 0x29) - { - Main.dust[i].velocity.X += Main.rand.Next(-10, 11) * 0.01f; - Main.dust[i].velocity.Y += Main.rand.Next(-10, 11) * 0.01f; - if (Main.dust[i].velocity.X > 0.75) - { - Main.dust[i].velocity.X = 0.75f; - } - if (Main.dust[i].velocity.X < -0.75) - { - Main.dust[i].velocity.X = -0.75f; - } - if (Main.dust[i].velocity.Y > 0.75) - { - Main.dust[i].velocity.Y = 0.75f; - } - if (Main.dust[i].velocity.Y < -0.75) - { - Main.dust[i].velocity.Y = -0.75f; - } - Dust dust21 = Main.dust[i]; - dust21.scale += 0.007f; - float num7 = Main.dust[i].scale * 0.7f; - if (num7 > 1f) - { - num7 = 1f; - } - Lighting.addLight((int) (Main.dust[i].position.X / 16f), (int) (Main.dust[i].position.Y / 16f), num7); - } - else - { - Main.dust[i].velocity.X *= 0.99f; - } - Dust dust22 = Main.dust[i]; - dust22.rotation += Main.dust[i].velocity.X * 0.5f; - Dust dust23 = Main.dust[i]; - dust23.scale -= 0.01f; - if (Main.dust[i].noGravity) - { - Dust dust24 = Main.dust[i]; - dust24.velocity = (Vector2) (dust24.velocity * 0.92f); - Dust dust25 = Main.dust[i]; - dust25.scale -= 0.04f; - } - if (Main.dust[i].position.Y > (Main.screenPosition.Y + Main.screenHeight)) - { - Main.dust[i].active = false; - } - if (Main.dust[i].scale < 0.1) - { - Main.dust[i].active = false; - } - } - } - } - } -} - diff --git a/Terraria/Game.ico b/Terraria/Game.ico deleted file mode 100644 index 1a149ebb8c6c6a2200040b818e49c49993c4e342..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 99678 zcmeIb32aod6*T5FmsA zA!I@b3f`Tu@(U8dc!laM&J1Km>T z_N`mDZdIK+r%s)%CQSIngc~MIojL*6#0e|@*Mtcj6DCYZOf>GFLH?hSXR-9(r%jl! zEMme0uh+QGESoT4vS-4CUAy}4|MxE@ICo5#kcm3*Drz+Hahc#nJ)u7l`9)~5IEog! zYkK}!P`l*Q)>Vi8RWonfKdM@n9tbUWv3skhX0fMrlg!zAN_@3*n=e*&xMwc^qR*Q9 z4*uIw=$pba`T6-b3|Drje3yUWr`@+c^<8D>E$>+Zxeu8-V$PX8*^`DUtMl-UU-G}h zT`~#pe~JEo>hgFaOEx8cS9VX_*XDxUI9)dMigzcP+TzZb8#9mKo9}wNZvU>i@19SQ zACc7@{d~dvw9UHy(06%nwwvM#Z;$!9=C0iD+$EJU&g$Mzo0i}8=}={d%0t~ZWYxrN zx6Y4y*@~a7YQeWHEAPGR_k-)i>k}PS^Z#A9X!nnLU$vnuVSQ#G`rXXBR56#k|C1L; zS)5y$QW{+UaQ`zZVz;NZPy5EaZo0U4%@WVvC@I_6LkXGr#j4jF#F{vC{BtoCF?^mCD2MQqYyYQI{L;it&pvEsprMXzy(C z9gLB{6R}eDK%5lzrX3sZozQ$!Sz4nhkhCgqPV76*6>)!ewP!5PFEHO2T8{S$(!z~IUl+!JKl4a_)ohkI{p)wv*x|Z=7lf2 zD_UPDsax=2VD5(hpsahSI<7Vk-@o5h((qAn`&Mz(u9VWQJ7oTj=cN0#r=@Mf329ok z|BKqLHSgm4X;=HL;oe8xarvdqpF8VTiErK>>DY2w7VmvY{Bzd6gJ&7Ty*HBiSO*R` zYgb6goE_40$8!=`d_WupC9Na*jf>R<8gxT`k^ckVyuH%9^Lg<#F8P3Y7kg){S+wURsaw3~-_`9a-}3j~A&%mT56nH$;@A`^>9tYMV_mh5 zbl+K@+2wnm^MC%1XQiTL+5710jRnOOwRuIRZ~Z4@rT*C%vE33W=E9ubtNlLeo)}yQ zcmR{FIPjUPVXgYUzjM|5e9ksFI+MThKN>G}PsK^`@{GSD@2chj-cQLaNqW!Z&fJLq zH#j^Mo2%w-`J}vOuM~IOCUb86wbadBr@!Bt6qxb7X~j$_SeE!j;k=CVcxO=CgZpu* z|9CemyFBr~9Y4}a7G`<)s6+O-07J6&CFvllZ3M$_B&EG2xs~;Zd|8VtOX+GLN zEw?`5@8$Q!NYe{gYZs(_g*?Rvnq6h@+XE|P-tEsyW$Q9E{#W{);oifyCS`cz-^^;8 z{grd`Y%wjK^*!>skTR?#&7ZqlHcHpFrw5JyaCKd2KE5>r$(&b`xfifiG#>XpTjhMQ zRP-wPr{~|5e&ff!2l$)veI5TM{&jA7>YDa{xVBmBh3^+MtdW{U2LS)&*988d-_G`= zo;Ta`nlpA6#2V9#F*RwxZH^A72|v8_w+sLoq~F!GW^lsqy}b6 z&it8@(tERHHbhHCMIzeZ5K~RctLBE3w{rps@1gvN@;}+dsi#tX(f^9Aze$qk-YoeW zXNvRo2r0ccTHJfo9zY8A%u>m|Jwi-#W4}flMuZ2+!pqYj$DUxww{_BzMI$F|C~@_N_Ce z5PO*Nd%*wS7l-}KZ0u*^rQ&cb+7cdKa|is zNwWKO_q55BbFTR6uuKP8{|5>Bo{9kb-Myij-Ny*lP@ADnjR?rN!R$l3M z^?UffHFr+bS2p0D8~x|LSIxmAgacszn`rbqR%(C;r90xdM()?|j>Hx9c`}=4f1S5x zx|HmR78`J|1hleP!~dpUIjN z`6b&ym=x`Z7H50L8?Mf@_pzT(3VnB^?g7t9Xh$ULvpDmX=9Z_t=V(rU&)JxH63>2x zXOn*Hw?f1Lqkc;{1w^P579b7CDIiM?{r%W}1((OTOa#Ah(rR<J^*aLH@4QUD1LvHOEW+onLv%>rb+d;5tY1e}DT=n+t2i z6<7kf!)_^U-z3hO1!Aw5CtlpoS^tnMyYpqKnYUF+npa8v>PH|KxKozygKVO6HEHp% z^3l=g3%-AYHQ#nH-)28=F7$s<(zQbh8gGFdr%%dy_Dkp1Uqg=aBKYYukmsD0c^e;+ z>eeNHvpZbpkw#6naXDjQ&9}d9_b*rbKkh-wdhb+xc=z^aWch(tq;181aX8(pfRkC5 zQ{QNp0UV;Re;4jwY&A=zV&UBw|I;!Tao$je zKR@4op5yOn-J-^S(ViED_!?Snyxs#3&Qpd*8q~7k2}M7h#Z})pJ>^?TuR`06ytwfM z8;(Ee5EJEaeRuysn${kZvW|_CZ*v?$TL<=F_`fZyFy-AmNAB*>evQ>V*8Ow}d;If0w>b(*(f0e312ex%@181ozI4j;6c033?bhGr{IOOo zl&Zz|Dmg6IFIQRf-+|jZtJ+t7)3D;86qL83%^Bj@8Y$j8Vn z`n#I`kpG!?`#D*0*Q*!MA4^Hr=Y`v6OZ_vk((y^3rv#ao}0z79ec-h z@ltXt^sOz~Z=;?lUFWs9qW(#y!px6SI;Ki$?W}JtF4K05ZB{`=+dnJk-ysWbKO@x( z@07sGhlIRn+r}ql^}VkTnm?!`CD)z#ab{!G*Ct=u=a};comHk6kbg~iY1H2hef7&3 z3#LiweUaka9U)nDvEuSIN@L$)33PAz7GrzVTu|{Z%HTT5;1 zDm{p<>vFD`H}54kPZ!UDNNN2;oV5G_^10iSrFq%z@3EIUi?$TA9?~DKU2K1O?|$(A zzZWx(LJj$H& z*Uutve~fKHnKak~d_dYm{-JHtDK-Ct>E~FqU4Ikp%g8Cncnk9DlcuVa?@V)}zlYrD zOXQpT+rKc+Q-}T6619gJihk<4#`=mjQwP->+z!BDVL@P#dOh zp(t_gi4gmWI5BO4jsy2utEPy1?<{fco+arW5t7r8@Hy(M9L+w!?zJ|S74(P4@k3o-g zSB#Y26Qzz+uIibH_G;TS1|KH7r$WCQO+y|`sV1orJYuMhXl zk<4fN6ROevcFg&%n^pTfJ7Gfu8{ok41Svy%%I-E&;K>-NdL&AG7<=mQ{7>K>dQ8Hh z=6IZBubiUveYv+xqdnP&BiYX3>O%YbK=1#N*fbfoSJNaHwg=V?GsF$uznbqDV~#s@ z@6FF8Dtou8V`%>a(NYK9wEvNK@$QXQctN`W;tTt4_nJnf{p=U|kd{%LAjuei+9}w# zMX2_$%~jYJFx5SS_C6Iat&olIT95q>_4<|2@$xxg;Xf9Sxi>}i-&&MAD(y$xXF&J= zYMg(vSk}!D+J4(NMo8}3smcbt`dGBmJvYAyxfJZd11Hh`Q}NRLN~|>h9(ZsnLD{WU z9yN5txof71XV+}8jnepY{wFt1mxT6-lCl6cGoXjrpy`1V35upP!Je++H!-l8z?eUo zC~dD{pY~hm(=q;>SA5=l-Y8?(RABFe`ByM6?K99I&v5g0r1H`Jm|R!pTWP+Sf2V== z6x{(@xf%3h<8(#e{U>1m@?ea#y@9dj_&**mjn5>i|4lDq-aH0-!TX|>t%RR)E8@ex zSaGjRpk2)Rk!t6q>cO|RX3Uuh`w{R9OD8GY4DWu->4#yraV}N@@CD%bH@*lPn&)We z7$dc?D`E1(KY%tqq*oPpB~Whl7U~;SehA--gY4;J+8)vF$PIqLyFXegkHjhZS@Q(& z7vtY>Cee^pyb3#vW3g)fkiOCurF1uJlU5~uhq^{x=8SJzb8C|Rl?VLgI^=?FPWb~d z3J0n|W4L~i&eT2;FYSLtdry<*!;S^dNOydYnHO|sf-lYAdns67i|6?6*7Qz;Z!oQ! zCdJ?xD(;IF-{EK}I|3gTtOJ4L@yhN;&6kI;1^_mk?_9%*HpP?X90Sgd3f~ht255h6 zb|CJH^p2TgUJKrG7kD4oagmoOfSs6oXQULvW{mBn?GR~CDeP)0!N-xGC|a8S8R{5S zzB9BB7`sMGLGCx{b7p*>y?m{WK}s({KCMlk#0*PsX>d zc`4t)9>*VA-&oya9CxBGXK*#K4Y23kO1PxAM~G!nw3O_O63?P^%JxfH25C&k{ZiwE z_T31%I(0z@F~<)&{8^H3x0YV&y(@Wc*aOigiofu6w8w#VT3)1GNZL+o0(@LUe^&zA zOTB}67GbqHxc`l@Io-8(r$_P~1*hyT&k?(`kiMHSc>W>oX?J5S@RW+Hu#|QbF-*v3 zS>d}*ck!o4l!HfH>bv9RIof*GR9N?&)$Ue0pmNw771k}0(iYfW_08&Cfq$E@}{G zHTqjQ4|>Ntq9)>g`Z^k0SU&n!H{3zYBJB`=nv*qq6GYAE8S= zr*z7+E1I|I5$RZY05*<^7bo3GV3(1%8|(IHy)Gn`tFzU&TjPkn(A$@RewY4MPHII2hLhcTa*nY`%fJt?fAO4pH*{U z(ViESKA@^&4RO6Mw2tfjo_)$Is1Oh4zo%^rbeM~!X8HZfj*EI&&ilZkz2Yhjoa1<1 z@BIyJKl&7Du@^jU^|mTMFycRLF=zu!+z+gHK-_@^+&7IId#}(wTQQM!T;9DMx;*z;mbu#RjOX_O-xGO7^{}6~Q`sZ0zV}aR{cm1=Ct-hLJhy!$ z+QvRAo&a`Kv?r$>6?M6^AIG!j0sm`iXEYLhxSBfHe^X(t&<-fi*RAG1ZQf|~3x;dM)#S7P`QA2V!<%2d7o3SO^*C&-1!I2m<_CMd(u52i4mOp^? z@Av5UZ)G0%pumD%f_Na(+;^`uuYE+y=WG(YtLP-&c|6aZBdPGIw62{YmZi{3`O^N1 zeCtTGX*BC#|B3$vP3y(K;;8aRC;#8P@?NofD!2!3Ev{^StrYvhmNiGEs9}Xz9TwPC zLDmGFP$~TB9Ps6(Zauke>N~JkBF!8Z_SKg&j=KNc`;Z6H`ya%D8Cd^NCI!jk@zs9h zC@dG7+ag~0kv5)7koxB!i$**j%GZ;7C&GpRGOX)}U)25Q-k1E(Q2p2A2)M=|eU?}| zRmu)VN!#nteLx4&`3~joG2&>+5cn0+Z}bNJ&Un6}ofDBxx%>+h4_pa5(w;k>g&pso zqs1(}=|OYwZbJ~H^d(f*HiM51rghWjp_ z&u|oakJ;U&n6nL1*t%KC0m%O}uYX)xR@`+#|M5-==>BJ}jgiVepzdU%vJb6+E{v(5 zDTnV|bKT-_ebV`8L!8N#bq4k#2l2lWX;RQLu3we5g3|lT+HX;OFYWiLmK;)RU>*D( zx$gDze}nj6y!UQg^<<$xe-`xFC3i(ZM-LzVjj>XCTY|Xib3R0w9R01ax}pth(o5nb zy*gU5OHu^()Z3AFBho~ht7tdvz{}g$Nf%=H)h<7*`d+*07}mh$O3p_+@L~GDGu0dY zbw=}SNu57gVAn1=)rtRbw`YFXy$@ZV->k{s;4aZ5tj_GO+8d{~QxSK`u=#j zM_*jR4ET5pvz*^WpW+&)J;0FKCJ>bRozwy-9q1uAJ zS<(Mb6JT?f(ha+>RS{B*IHSe8q9kp}Bq_N=?Ni^??*bK|7j!-6s#ys9-yqdXkEs50 z?>iL#qu(3PSBya^{B-{g|DAs#-pFUP4Jd&BVrEx_WVFow2G5oM3;TfoyYt-Dk_Wiw zmUhC9ev@2`{~6Ey4sILzRgKh$v>fRSeBb_UapXOZ|ATaPxZiCpX$0TXCwbnvN(MyU zmvI=bNBS2$2EqT)&yAStgYcfu+5dv-c}o99KOD-xsQ+Rdgr8FXgU2HHe`xGsRucHK0o@c8AzN2P@`o`$@qc{r@~ZFqyJ|53v^Xfj?0GMD!`j zDoz%Y$1i!ZDwt>VOcB?nS&}h-iexN-58QJ22Gu4)PB2vxTPKOBELZZ1OC`HC zRmHeLCI6z`9cybXxUc?V)H?}rZ~{OGcm!$+zYaZxu-Q+c^~PCuvu_|vgWQs*St z5CdnbQb|w7rHw7xwLiTkN>VB#B^Gmv|)Rx?-3@TZ+}Z^n<{Zl zh`qXank2MMl*Bm`CADXg6y5)7Ovwe7vVW0`1=UpNV$x)$q4bcKnc;C|@tg513!D4Zdrz|EEtyG2&->?u72Q zQN?N9KU)2})OXPT*34pKZKLm$W%Ue6oikba`ev?xFCO5=G2nmB0p&{wzd`o5;dGK@ zAfNs`^ef?&z9rOcST;|`nIo~v?;&eBWdFN4Hkd2hW=n2e677M#N z^l_!%F@4cE2QpS;?PyFO9awWI*o?+=_8;;OiLJR=5`gcCz-y*4Z8G6VhdzouutH6Z-?)$3I4D2ttQQ5f7t)J#}nWW2H&-(;m>wD zQTekqzih}$YfeNfpEmk{(T|zq#PK37&@Y>F$+KfN;_9c5oBr!LhIz0*#T%v8J;wSq zt$}~fzS;0I1T5j(Og~}vpL4$gKDSNh;nQ~lK4g#=(;trhpN!c_OKqB|;#1_VgbomJGOdR1H~iNacb;pyqU(>wDEkfi{Wd%ce{AqKN^gSm zDwszz<-?k!ga3U*NM{fJbZXDE=@1s9`k{*(aY}xKa4V!M?nKX6aDn- z#X9M}4RQNhGdKrY$D+@n-vs@SKwHeP)p#kr4Y1z=UKczIW8jkqD7_Q@zlROK**eT; z#v7=CKX$`Y@FT}KFg|}RXdivZ)i{AB5cUmEV;unRN4|)>5@UmvZb}hbsYz@_c?a;# zVeL&q+c+BcXwTyrt+T%8dY!Tm=UwzoR&$&@JpFD-1Lz~%{-)7?&VSNG>I++5BW}bZ zu0gzlwGa4Syc2dm;1kFnvG3lk$+Y=7i|^3ZX3XMyUu-PVwpY{Uz;73D_ud^XjAP(M zU%2Lz$KjRsOf7$auRU;rW59V(`|DWPcg3l>P!F2l{DQ#)kWb>+6>flE^`a!|lMY?% z`(ybGZA*b%=bfw`#7;mAkb+z3s~n})Kf;~-3}c{F;5-Dy>tT(fuC(qf;Qo5F_+dj3 zIA!pPEW;sUQfw7FecQQb8n#NLqCtmwNd%w&clHZKV<>j&t(BWs=?E9UDI@t|BJyh^UM_HaSz~G z0$$%{-8>%pcR6jq82FJs!C4n--+QAl z&KZ&k{($2^I|jYS=3yRAPB#6HG-0%AhF zmDV*~OeL^i_GK!0MTz5~f^7R0@v z?f6w0aNIz{nXPpCO@L$PkLDy*itMfk!Zddrf{9>fW0Arkl zWP^>#KcQD9->lalo1@Tox05k83d`VIS4w~5Ehp=oA)kNAL~@#^3i79R#;l|VWHPAMymN||9d|wD=C|B;3~> zd2=8II#&&Phh;F2RC&I`#BVacb@gH8>q&pl_FEoQd2H*I_A~t6&@=;My%_04UP0x* z2}8ymu@;nzqqH9J6&9+vBaA=qo4-#ADm%sLZ7|^9yHAzPF9dx+SuX zf2^n1at>n-e1v%G1M%*O?>sk(FfBz48sa9;5n(?6GZu@s$z>jGbA#becrQQjsw&Gf zqRuVZUJ4ZxoFE%kNX` z1kZ!xxri*Yc<)Q1q zUU^^B5BrP3pEQ7J?cqPm;vHu~@qNu$_BH(N3;E1Y_!G`LY50@=lb<86$Y-SO#Bn_j z2=Cdcky$WFMthWOMYl7418lMYE-_s^hYP0HT;V^ zwgLC=S1~&|7YOeQ;s1(S>-+A0P5CeZ_SapU)}I5shwCHf0QLxq-kZzj4}yOv{l6Ie zTQ;0jbb+!Y);Zkw!uc1{;;|f)VE9`qdX-$zh)udk#b$Bftiq}#hZSr)wmgM66;Hue z_h}WYl=Go?=ksbWSktpZe28rW_>-^LJ(hh6fBW+1STOv#=jYl^c`w(2Q2CEu_k;I; zTDIdVsn$H-brFXvJV%T<0$l9^{aKS!JsEa8K|54c2kL3I%%m_Qm1GMaCDESZZUdL&toR9Q?azWAx zyW1Ov|8)lU;5h{Nd#pC+VvD^Hw$)84E-_=%6UK~JPZ;w|0>Yi^zJ`Bs{Sv_5hjS_l zsdMrK*BSnQ`Rnj_7%RY!GCHLvAiOL4^}ZVZoC}om2E(6neZIqY$3q{&ZMgC|r{Pat zU?}>(=Fl6E@i6^a$$cmfDsRGB>|yv{Q$6lz&1nsP3v30b11#zQ4S?*QJRs@8s)Mhq z^?$`(e^Bunsr##FUJ{1?b-eBe&n*pq>WK+&z5ipJZr%sWf3*HT$o?lx|F83Tpy6*T z@{1F4AI2zlHLNlI&>OPqN zqwNRxgF*1u>p*z_{}X{f?SClupwnYghZJw1?L)3s|ARKXg+yBN zlk|HU&vQt_-(G^VS$IYz?10SWJ&F(DJ>kzYDQU+^eJ}C97x(QOABWA~X?2cOVf_jz zsOkMrKO6~5reR|g;8}HWS;SBIDzO6bLTncLikunGYQz?$L43g0BpsCfq=>|+8q5&q2kc)0h%`ByII8E))`gFo%U11ldIp#O~5 z&9f?r{~G=)?|Dthg?Nt5vi-luxdu4L4Dw?S&UkTp8|j0@*aZW7MEuWT9^z(w8^bt> z{V8cK;>RqQ7>55C@Q{QLk~m5bn;*O%b%2xu@thL!{yd+S=kzt*!g%H9aAwi#vH*FV zTTaQMJ8*vSu5&6a-0`%EX-(aruY0Ey)^x+)%*S)g;A@tj)t~4KF4;who7R9Bkxhu3 z)_gPKWa5k$#KU83RI@vmK4L7d{Go@Nx8eMep#>Oc1%JK&)BK;d|0KTa#Pcdh@BK^f zRWv_H|0nL!YV}O72|w5f)C|yh!k!87OjUf>e8fpA+K#w@_r$6=X^fwf)`i$%M!7H_ zFbeeGQt;;)#Y^^`S93tazZ!Nw;P>cD`WoIp!{jche7SznPSL4x)qP54cVPY&MGwk*44+f(5zU?)h4)s#o^cTw7c?0EGgeKO zRKyM!|)#&7+(xmLg9Zo z{$E4kf9N+*?@=U;yXxxjZF|#5O^6B1__?lC@i-eGlY4?= z{q>A`jG)jt{ZqWZR`Azj1^82@Coz7|^p=~|dS7)sO5r`@z7ppNd(r`>j<=1N$t7zM z1I?fx8+Bdb>&Vjr4S&Xd@U(7${C9~upI6C$`X0ib|E!V$kpH6%5bc42^nU}go#9}k z;qTspSZ|1l$he<%i2YcF825|;+4OXhq6LI~HTZz?{Wu50Wnp>_ZJUDk!#bgBv=7Ai zrXjT=^~--Y_RD|fD*JDqRm}Z7Wk8hu)6bXkAAbjRerj#MZ1{U_MLb}{L2dlChCgEe zf(PV%`=4>P_kRQah>KW$XQJ3k&0;SxpYLy9nC@Q#_+xBu=!c<#WvKjTDE*(I13o90 z!~bb|pz)vZ=lKq#_nQA>+)v)?L|VZ4!22-$ADY%+&$~JMA zBZg10U#!IqO5e*^0KR#9p#Set_rdl*JhOfA-WR2+b?GJXAK$RCoj4!h?>HYxEPXit zX6;NV+#9K4;WEB6&v@WmV9a12VgmC&<0XgTKQ!!#Qy9~UNF4vSG>-k)E9TCJl*e#y zPaQt>ciR6~@Bc2-{%2VFkM^nkpVsYBrW4zE(;)c|=|A^@KE?)z9GFSdh%o+NI0rDM z8?E`4Lung$= zzEs?cxbM3Mf2v;l+=Fg zu3d_=HaAK|_jZ|g>uFgCo}T*q1+eAeTnL3f{lOUvi1UHAzbs4MpZmbe+5h3Y)Ztd< zx-vh?DacSUuNe!Su+M0lrS2IAo5@^|yPjoTf!uGL{#??vN~}>P-H-6qSPL*N1Na}; zY^ox$6 zO8&!knB6%F{+W$Yx~=+J%c{izC`@|?^AmwOWJar3)+9ingeGH z@ji7SbZ7HnL*dT(ie;HxB{g69VUN+Y?l^3B&Ony)w36o(S2T*Vz@w5KHX5eVIm!o| zxK5o23U?@x1!nx&v&HSD*Js=XiSfwuqP z|H|I|p#6VR{(rqYpZihp55{49k2(Q<_fT+t`2S#DALHXg(l{n5zS)Y#Q#Vc>IrqoZ zn^0!T^8|U%Gi85(zfI9}>fR~8qb@$UKKwW9F~@(U|JVLsgm)6cf(Iwc?Cqo|#46N#}pXNz2QSqvO8#z6i1J zn=1LGxroJPm%8Ogq<;Cm(zs-gKo3uwy61yZFpsFo{Gmu zI4!*Gq{jQB!;Lw@R{;~O3{}TY0?K$qWSJR8*C4KIU z3*g`JUpO}z^3%q1I7jV|I9sqkdDo{&(V{GA?Agp1y#K>`kgA7k!=>O~-*>;%t$ZL1 z|B$`-aN{|W`GCzvB+2f;8L%PvPo25q1E5189ngtqYE~Rl=LRw+-`kgJ&!yl`{z1oo z4CDXk;J=0$V8cCt-&~sYW}Ytt=Rs080=z$kHUCtc)SpU}<`)yB^Z$Ss=uc%hL$Blx zoE?aHb2ad%FStFh0(Sq8DLFB1fEn9;(ViEivgOkHAKi!W_3GygV0nh{q->Np&s6=8 zVM7C+7I#kXr3W|_4Gds|B;7hD10w<57?{qe_;QQGc(Bt_;5C^@1Sw6 zGWF%^Jn4s_N5^@|%=bcDt(gwi4 z8R@0;lDJQj%VtSp$0SMYnkX49k&-<(QtTUMiW5Fmg}ZUyIL^`KdGQ&`0Ds7VnOCsR zSO-wY1^a*G{Sv9sYIAM2IEo=RY7$rdnt@c_djK(@52<}0eLwr|{sUqF{65V8jmco4k|KqcZ?f>z75d0bUgL#(tz@l3(r<|di~ee zu>5y?!g~mKP6JG12-nbOL)~8r{cm~LtLw|z(=jHo<1%EUAfBejy9|Qle{BQigZKQAr@TdIeJYx8~yG+s}|g; z`2Mi||EEU>H2f`&BEh-9Vyo&^Iv~byCG0Jg3&dI5C$-BCOUt@PjF@iW^M8J!>F4!+ z)$k9s|0V31lq?WDA^-cA91O$%I-vKE1^x~vXrBLI@^+~_>WBHiuw{etCn^ri3$OpoF`_7L;WvkT%+s( z!sq{uUp@fv{RlB4LSqCd{Xd?aM3RKcY3e!shILBy8aBh4|KomuW%-=t`QKC16^8#f z#d}TX0Vf6jxF*DisGTY~1?d7G{FjjLM8D-*Ijd;t9(ZF)LOfdX4kI1X8tN(g|&I$QPL(1G3hV#h5 zdAPB}m|p<@#ER)cKQc>Qia6Uq4|)+VWZ^VnOdh8AcF+pg6>>gk_@^|_P^gVaQ}&F=HUkmghFZr<~_- z5bio@_-FP+C|mQ3!C#jF{6p!1C2`n zxFz>uZuCr1dAWfM#O^4TTz}@EGFfw?)IHy`E=26c^(kUm6FCU}$>p9{+s#xP zo)1?xA24>>{_p;N_$&LL_)6Fa_v5?1>a{(8y>Z@365=rP8F4;)rQuIhuxr*Jcxk*1 zzGk<^Dm>>kI6wG5;}g&h*>>B^L1p+owhiqLPV2((|8elg_)SFm7kK*5;;NL#pGrzUY%-A#4Eo;;xx6^~DHR*jg=L_$t|Cmp?fn-e!RQ#_nEx0r-(C}x>MB+5h zO3`$lSNe!C)?#p;{_ofvp>RE`Z;E=Ccwc;{VK;8sG+jMoUT9)W0m85ZbA#V>-ER1r z1eYs0&~JZ^I7H0Xv0Zgs0@4Ngrtq12kHH&+;eTm(2jc`_?}2Qup79j3$`S{`pJywi zbWRqYrO2~$$n)ux*pB!y^QMUV_DD7U8vdTWvxR;`xofa4ga6}wXd=8S5OaWQ0BO2; z(=>HH2lMHJUIV|=BD_Z)lF#g*4XmRIbB6H=bh2!o4jyy5dS*izt_PX*v5+xk2;v;A zN8c)u!ZM>bc( z!os;dV&EC`y?4flXXosJJpCT8eC|Mb#%V6QFIvHv>jB?kUDZe9)H4s_5Y|4HAVqi1 zRxq}2nW@UK98)!76_g*w{sDE`!AG#Z?3GhhOlXrQ4F6y{ANn7#KZB&s#vE>K*YMYI z)Pr%4xJaDVKBB?T$`69B(~o?w;YS|)jQ{yw?m7dv^;%wmI0O1Syb`w?P8;Vo@Ed%` zddm;8CS6v?cGu@W6zn(loQQ7|#{VJkUe5y!|HQhfO0GkEkF7Ukwiyeih-Kvr$zA|? z&D<%Hy&O89zNwOj_^>+Jw$4=RGjUJnZvan~Y7t zvOEJ$%^A=Uw!ySYR-qkpD?DrM$v%IiIR@}wsTvAl-`N>4~P*&e$0D! zw8D9gd)}I9QoI9e|NV#^_C&mt9m1N7=gcEbX50v_(TpGC#aSG@*QsD@q`0?58fEZ| zWfa}Ox=)%`r?4jaa{pCnzkM1+4D;uTjvV#p52 z`xWmWEF-Xkugq9&=!eq!FfYRJAJVQg6#l{VU(0`ZwhCcgit|&6TZET$v%!mn!k@6_ zbK)-daD=DtfN=(orvG!^G2+ZJu58<%jq;&9BIgF{>3Tm}Sf2H9jxnzW>pSmtqWp*L zW8ylb=Mb+stBp0HUq=|m{}5hK!=G`$^m$5p|DS^MA5st(D5(qbeb{>x?}?H!#0PUg zMsGuWAdap1mg(xAavaKIbgU@ChUcvj=6WBX;otFQoI010aYmbQCTsb9QP{sltGZb~ zQ~43B%22gAP-_)dP2w1D3s{8N`;Ey7w)`44Fmbr7tF>jB#t#{Z$^fg1j} zDm{8I{)h5^&JDAKx_#nVHqKcheueJ;xaMp8*Z4Uc|Ht?Jj~TR};dz4&@Li_XH=wtBgu}3V!{(;}gcPKl8F#cbN|J{K7AtuOw z?@ud@m6VD|CI3msxgQpcW8SLiV(ObN7U=kS&%GYcTIU&yWk+JfwL3zJ_eCi_kNbD- z_b9v3sqAip{?|SkEA5CWUjGzyfPh`YZxCz#d7Rb!yBMiMoO!;-{Tum&=9l869cOqG zb~+X%{}c8;%7^$3>=l)a2>U_Le#nSWr`{uGV_(R&l7Aro8HWGR_#e#sVh$MkKgdi; z2gv^s*R^a%#s32TPdMnkoyKwU=7dc>_UV+_XdDf`634mb6X#h6|F{2_A?x!WH`eq} z`7g`q#B&^3pI-mDpWr=piJ>wg%?~)SRS@SCfjL8ow8u7SMw(I}Hx$SQarV(oY37l^IlR;04us0;%$@=vAPdxN!G9sut2=bK2_(;rLY zJg>RSrzyP}={;f0J%8c0*(z}lmR(E$SQzoGBA{G+wRI?SO69 z|Lb4>p&Q_NGdf*RhVVxjmhb#;@Q7IB>rO&9jCXi074x}2RQnCgH!tK4EW>uNt>pdK zR_*~Qvk1d~Soja<|1{5}eLFP&r}KladjH2g0O{^f{9hShL0V3lu6a0KHT~x^oizQ| z<+T2vb!*;6d;C6=jzoFr-`9I*kf`3Z;H09Gn z*i+s|8BhY`{~Sxwey*cTggf*2pL>7+&Iux{^d7I_Ecm$>6CuBelB(m7-$2IG_*?AZ zQI`9-VEFT#DV{CDGTa05+&P`UGvY)05d%BeU9oPiv1R-66@{iSVlmhS)0{i@+Vl>SfSk>39icI3U7 zPu&}FlWQ{bwcM}mO@k*RUbp{M^KAx=;2tj+{=v9S-cZv5UiJFV@--)nXB~er^A|&Y#JvFPC0*jXoC9nxbp+w_pD&~Zfd71?`(f+-Wm;*BFr`!) z@*mOyj-B(?2qkl&+{FuiigH2g2FTa$1}^{|J9%x&Ta{e)4EK4_(gE2`^Y0-0$2)$& zk7vm=y$ITm{T=szoHr^#j!RfIJQJ_pX?fLH-?{%&`6y305!d{B(0}Uo1E;W$#5bxQ z#5w@D)}4!%T6~xP$xpK00O%6mx5GYx?e&6>E!h^YZ9&fb-0?oN|Cj@e|E$J`Hgn|v z^!l%TJBVvKY5k9;5rg=Dlp_w-Jz=cLHIEy7fW~hv{~>;A*)Gd7h01?|_kUXcquZe6 zze>m0&;L`dz_43-rs`4957 z{71=)&fs0Zwf+qDeyFb&XO!_9T#NV}{wJ=hIoA(=(h16n3VYJUQI~0?+N{s|`&b-0 z|HJn`tPL0=<^KhnP(}YW{MGp{SPzKvn*S%RG3oU`SpIuC{J)m}>Uu)uKg`!OqU{w! zj@0%C1J=RvUrj$W{_FajH8``jpRVB=*8hay{ZR8h6#i+8;k(JRfBIq1Ywj&m)xL~- zGbYMoNn?ZI&o!5FpSD-Aw*MdCG<7_Hr{4e7JPJK7WW#)>6Y-z3nX=N#ZZ zo@dapUe31wY{j|nqs)tWsMTm5T1*MG`^I6rhMoI7Cm9j5h{ zf%8M*0OkQ>une64K{=|XtJ>a5`+sQqPdSh-qvwQ%SE&9^(`>bFgIDBxn*LLUzz zyT{-k_5M%G|26-|_q6;;f6LjNq3M1Y{v!ncf}OLJon0Alo%(+A0JH_*Tqp%iCJk2h zJ9y4A#8>9gCYNyG9*r`)0ObFa2T``86ZeGvCn(#AQF@)$^Uw`q4k-9T#!ne=>npGy z2hLOX&w9z`K)5uCHPL z|0~CPp7pWDRFd(0PGyqh_P~z-$=5SGukE8E_1 z{I4rq??Z87IQUZ!O#glt?0;wr#Ie`#r%Z->aN3H{U!VTq-g}~zOonzG#C67R;4|O7 zhOCBkowQulfqBJyo%GsHdBQ*$@DrS0@0IL_ z@*kZb`=bpQlZHR}Z_;7rX*r>m!{{sFWdZ+4x}akPkWOeF5$QbdnTYG$JFtGrk2nYT zUzeedNY#6od?nU>yY)M?`NNC#Dg5lm&k>BNlK(cQ*$OGu_@oFy{knM-#zm5>?55^O~y$k7G zq%V*pvk9>qJ7*}E5YMRt)+u)pV)AtkPI|tW5HEnSpp+dc_=YO*c9i=tuM|8b<9n5Z zf27YJue|4)LHM)I+=Y=6IFcq62Mjt;xFJ^DtK!A(%l)XoeZLBBcliI0$MuVi8RTfE z2!AH}QHJ6-?{mwI*v`5fuX&!VL1pv%<91LktZ`e{W!Y%>ZIV_nk8^`%@@+rFe|6Mn zD*Sgg4ajyq7i)L;*~rWTz@Pi7V@!bmiLCk<2~8$%`kT6pzM2cOpJ%!Bb|XfN^25L! za3b!HjtND7a>CrTeU_5rFrW8@tCFO+FOBd&uIqDDXTRy1pCS%_)?58~DPb6o42&;# z95L=UA}LxBa#gW{gX_U_7t7>SB90eudZ?7uA0t-#h-(?Kv(lu$af7ZCb#Wdte~r!y zUq>DOJlk{W5Gf-R7AO8+hOxgj9mo#Et61>NGdICzAN%_f_-T@-D_oi^?#?W6 zc=Pu6e`6qSAMP{y^DgTg^3e8#??-p8=<&w-(FeFmW<#{10cKCO#%-~AO@nxPXXC)y z?$YmvuVVwZks5ame~Zf`ggvhGIkz#{+~#i1fq_(00009a7bBm000XU z000XU0RWnu7ytkYO=&|zP*7-ZbZ>KLZ*U+5Lu!Sk^o_Z5E4Meg@_7P6crJiNL9pw)e1;Xm069{HJUZAPk55R%$-RIA z6-eL&AQ0xu!e<4=008gy@A0LT~suv4>S3ILP<0Bm`DLLvaF4FK%)Nj?Pt*r}7;7Xa9z9H|HZjR63e zC`Tj$K)V27Re@400>HumpsYY5E(E}?0f1SyGDiY{y#)Yvj#!WnKwtoXnL;eg03bL5 z07D)V%>y7z1E4U{zu>7~aD})?0RX_umCct+(lZpemCzb@^6=o|A>zVpu|i=NDG+7} zl4`aK{0#b-!z=TL9Wt0BGO&T{GJWpjryhdijfaIQ&2!o}p04JRKYg3k&Tf zVxhe-O!X z{f;To;xw^bEES6JSc$k$B2CA6xl)ltA<32E66t?3@gJ7`36pmX0IY^jz)rRYwaaY4 ze(nJRiw;=Qb^t(r^DT@T3y}a2XEZW-_W%Hszxj_qD**t_m!#tW0KDiJT&R>6OvVTR z07RgHDzHHZ48atvzz&?j9lXF70$~P3Knx_nJP<+#`N z#-MZ2bTkiLfR>_b(HgWKJ%F~Nr_oF3b#wrIijHG|(J>BYjM-sajE6;FiC7vY#};Gd zST$CUHDeuEH+B^pz@B062qXfFfD`NpUW5?BY=V%GM_5c)L#QR}BeW8_2v-S%gfYS= zB9o|3v?Y2H`NVi)In3rTB8+ej^> zQ=~r95NVuDChL%G$=>7$vVg20myx%S50Foi`^m%Pw-h?Xh~i8Mq9jtJloCocWk2Nv zrJpiFnV_ms&8eQ$2&#xWpIS+6pmtC%Q-`S&GF4Q#^mhymh7E(qNMa}%YZ-ePrx>>xFPTiH1=E+A$W$=bG8>s^ zm=Bn5Rah$aDtr}@$`X}2l~$F0mFKEdRdZE8)p@E5RI61Ft6o-prbbn>P~)iy)E2AN zsU20jsWz_8Qg>31P|s0cqrPALg8E|(vWA65poU1JRAaZs8I2(p#xiB`SVGovRs-uS zYnV-9TeA7=Om+qP8+I>yOjAR1s%ETak!GFdam@h^# z)@rS0t$wXH+Irf)+G6c;?H29p+V6F6oj{!|o%K3xI`?%6x;DB|x`n#ibhIR?(H}Q3Gzd138Ei2)WAMz7W9Vy`X}HnwgyEn!VS)>mv$8&{hQn>w4zwy3R}t;BYlZQm5)6pty=DfLrs+A-|>>;~;Q z_F?uV_HFjh9n2gO9o9Q^JA86v({H5aB!kjoO6 zc9$1ZZKsN-Zl8L~mE{`ly3)1N^`o1+o7}D0ZPeY&J;i;i`%NyJ8_8Y6J?}yE@b_5a zam?eLr<8@mESk|3$_SkmS{wQ>%qC18))9_|&j{ZT zes8AvOzF(F2#DZEY>2oYX&IRp`F#{ADl)1r>QS^)ba8a|EY_^#S^HO&t^Rgqwv=MZThqqEWH8 zxJo>d=ABlR_Bh=;eM9Tw|Ih34~oTE|= zX_mAr*D$vzw@+p(E0Yc6dFE}(8oqt`+R{gE3x4zjX+Sb3_cYE^= zgB=w+-tUy`ytONMS8KgRef4hA?t0j zufM;t32jm~jUGrkaOInTZ`zyfns>EuS}G30LFK_G-==(f<51|K&cocp&EJ`SxAh3? zNO>#LI=^+SEu(FqJ)ynt=!~PC9bO$rzPJB=?=j6w@a-(u02P7 zaQ)#(uUl{HW%tYNS3ItC^iAtK(eKlL`f9+{bJzISE?u8_z3;~C8@FyI-5j_jy7l;W z_U#vU3hqqYU3!mrul&B+{ptt$59)uk{;_4iZQ%G|z+lhASr6|H35TBkl>gI*;nGLU zN7W-nBaM%pA0HbH8olyl&XeJ%vZoWz%6?Y=dFykl=imL}`%BMQ{Mhgd`HRoLu6e2R za__6DuR6yg#~-}Tc|Gx_{H@O0eebyMy5GmWADJlpK>kqk(fVV@r_fLLKIeS?{4e)} z^ZO;zpECde00d`2O+f$vv5tKEQIh}w03c&XQcVB=dL;k=fP(-4`Tqa_faw4Lbua(` z>RI+y?e7jKeZ#YO-C3xi2SK~#9!j9Sf(CP`8>^NiYA4O%WBB!mPPBp!fg;0btt zAr73-g0#aTx+}wsL;QI}W=&5?-BsUDW_tLKxw%E~pa11wNrD6jqW?Jm;ql5IAEm#5 z$9LO5&(HEDPM3MUw|`&WuK+wRGXTqgCD|$h@vxaC-6iaO08#)7m*Cab@Y7Gf|EGWahjNuYC!Uu1SPmX$ zRKZa~B)u0GJ63iSWBS_wv_J{Iu86n* z+iEp%MO+3LbOOzsIQ{BnbSi*mP0I5Qqa6$Zc`cb-QEWiVRJ9`@1Z6k01_4Hgp=J}W zxQbzhO2be_5cELx19|#l_`rve7IP`RN32rlR&Oxm7A(W<%X?4kmjeN7SY&n>>hbA6 z5mDH^Lia}Il|2Rsb>Lt!SR}ntg=a`cfuzdkTIq<8a-q4q-vbFov5f0_P62NA2ZIoc z*%~O}4rb4coqk&YGJrWp!PpYQ&QLUOVsH1{D8@p2*qZCL4M@)D!tSVo@hI8y)`6U% z#~aqO!;bd;weh5r4S8Wzr#vz?<5!;+l<>4IY{a4CDH{1H^Ldgb9{`^F{UbO}boI#a zxt_%BjFZi+x3B{0&ef(1`m2#k+CyJ@pl!p_=27nrJ=@Aj8Qb`wl4P}naC%fvBxXOh zE}ub;CsFS9ZEWvERRORrpgIp}lB%>_<5?6b6A8B>o}a1uCFgVDC)n6i$VVmHFEi*4 zspD0xh-+rnK=Yms<33sy(}?Y8w`EpWl`qRjT6p=km(c4lqdcGBoo77eA4{XR4x(+; zT5FvVagKyXT4^BBr4a>eBQPgr|lrZJ{vr#)K;59A$FS+4a|M=b&wcqh%8W#KjPqqOzVmZU+}cULFp zC=;KRH;Z2_*D4dy^nWkN6Q+FdFIQQTs%70(?Mdxrz3b$?WrPK;7IS*R8_L+`#%@<0 z^GLZ?l*yW>V1_p`3(I${wbuKtvJb}U)r>VmQ2NAaR8@!*Qa8Nr-t8QRgUUA4Yx7>N zN`RhSj$7JsG(?UWpc{Ql(oFRSYGqEcaojQ*gC$eB&8>CL_!4A9LSC0D818%`mU zOD3s>iQo#TwSL}pG04MY`xKhCx4N$ih5{oCl|!aMn&4UPtKiP z!T6N*S=AtFtBJWnJ{q47>~nHI;4%rSq+yMi@@(*0@RA+1dh?f@h+yJKqZC>IYgJY4 zr8QKHCS3U7w~v|D+eEna2lR=|y&OAx)BfeT>Wb^~Xv>>OUaKsbd{Ojjty0qg+APkj z;}1mepg^4}er^5HNK1!sTN1rzprI~6H1t8OB2RvN-?d7x(8RT&s?_ci1BeI)xkS;a z#Ir4e;Kf#K8qJ$HtT&#^DN{a@95KDHqS_(%Kw_UKx7KER4m1l!_ZF1%4pK>;@n4BZ7 za$Q%nt)Q%x5rK#gO1kg6--Kk)Ri0nYq%VO;vE7hBG9$S@%_iHtgq$oL$<+nf(WaX+ z9x>~`e0*GSWeUniPYuRL`S`r=s@l_xghm|FS5s745s#t9b+2}BgTYY$xDEQ}cEVI? zW6%wJe0((VI5!6KoPC<-OZo7pt9qjpgdxSRLh!1b(!=lBb2k9Cb``vHA)k9oiT1Q* zMsz*-Dy3~ZIMIsfe!gs>pp;U-eIHV9s8%qEMf;XSNr@tu59P@|n+md`<(C~DlhLOd z^180AxpLQupF3==cCPEb?+&mhFPd|`ZI|VVwG(pcil?k)_~q%z$-#E@bzLpMoC3Y_ z#?H&-4HB-nZrpYw2h2jdy$Mx~PTRY>{h}hgy8MM=ZK_0!O}n9|zu4`y?>rKGAiUe|`DP#Y%^mG)U>+{nx6GX;)ueDwi-xqA ztbfsRe9+k4?>kH97coJe?bl?#J7tRo$0pw~pQn*}4fUPSJ_5R3UYitZq!b zZA@`E`^JFL{tT}1$bRk!Y(UCg2szb@F@RxO@Hqd%=P8RM=C?;kLrAtC^2;jsg2Ri4 z3W`(xJa#;ul|9$cWZJQLzU7M_HT%?0rMlAHd)$+9Rc5{B4cudrITOgw!ysEFPEK^+ zH6n7s_HlwQfSgfHb;w8F^>`#k;IuzLB5!;=PKz80)Ol#){3S82KEKzxonY{BF<+0o z+@GJF+jLct@4dU%K;FuIbGu)T3qAJ2w<8pNl!1NU_Z5NMVepoA>CalLsyc^|9y@K@ zx8n)<+aITV_LU6suuB>vo4ncBOj$oCjl;aq-9jf5CR%%r#yL zxvKv~YkY~A#t(ir_fS<4Z4Cx+f8O_f z2csP@Nyh6`W7|8q2^{-V16#}1+x<8m@t7(fA$S8sXIZFO9Ah&I6%}>Agj)}hYU-DM zD>E5QRPN%gq+s;ZQ75zYuQxD%0WIrYsiM}1Xz7%>|5U3-$W)x7Bve3RKm0FA%+z=``jyE#Nm;{~HSbt0f%+t=zXVYLP{89_#}6LZ*M5 z{eIC&@S_FzH(LKZ%qqLDp>*}F!r@0(emi&RcTVyH-xH6}@kiEwHTrvOZp{UVU^^wj zeXxEWkNKi}zr?#=wdBhM_(wq)BCOT=fNUW6a$MW*+QY9U!w(nmYgYcSQ|2R8w*CJD Y0L3g3-xp*i%>V!Z07*qoM6N<$f>>Wb>;M1& diff --git a/Terraria/Gore.cs b/Terraria/Gore.cs deleted file mode 100644 index 968170d8..00000000 --- a/Terraria/Gore.cs +++ /dev/null @@ -1,173 +0,0 @@ -namespace Terraria -{ - using Microsoft.Xna.Framework; - using System; - - public class Gore - { - public bool active; - public int alpha; - public static int goreTime = 600; - public float light; - public Vector2 position; - public float rotation; - public float scale; - public bool sticky = true; - public int timeLeft = goreTime; - public int type; - public Vector2 velocity; - - public Color GetAlpha(Color newColor) - { - int num; - int num2; - int num3; - if ((this.type == 0x10) || (this.type == 0x11)) - { - num = newColor.R - (this.alpha / 2); - num2 = newColor.G - (this.alpha / 2); - num3 = newColor.B - (this.alpha / 2); - } - else - { - num = newColor.R - this.alpha; - num2 = newColor.G - this.alpha; - num3 = newColor.B - this.alpha; - } - int a = newColor.A - this.alpha; - if (a < 0) - { - a = 0; - } - if (a > 0xff) - { - a = 0xff; - } - return new Color(num, num2, num3, a); - } - - public static int NewGore(Vector2 Position, Vector2 Velocity, int Type) - { - if (Main.rand == null) - { - Main.rand = new Random(); - } - if (Main.netMode == 2) - { - return 0; - } - int index = 200; - for (int i = 0; i < 200; i++) - { - if (!Main.gore[i].active) - { - index = i; - break; - } - } - if (index != 200) - { - Main.gore[index].light = 0f; - Main.gore[index].position = Position; - Main.gore[index].velocity = Velocity; - Main.gore[index].velocity.Y -= Main.rand.Next(10, 0x1f) * 0.1f; - Main.gore[index].velocity.X += Main.rand.Next(-20, 0x15) * 0.1f; - Main.gore[index].type = Type; - Main.gore[index].active = true; - Main.gore[index].alpha = 0; - Main.gore[index].rotation = 0f; - Main.gore[index].scale = 1f; - if ((((goreTime == 0) || (Type == 11)) || ((Type == 12) || (Type == 13))) || (((Type == 0x10) || (Type == 0x11)) || (((Type == 0x3d) || (Type == 0x3e)) || (Type == 0x3f)))) - { - Main.gore[index].sticky = false; - } - else - { - Main.gore[index].sticky = true; - Main.gore[index].timeLeft = goreTime; - } - if ((Type == 0x10) || (Type == 0x11)) - { - Main.gore[index].alpha = 100; - Main.gore[index].scale = 0.7f; - Main.gore[index].light = 1f; - } - } - return index; - } - - public void Update() - { - if (this.active) - { - if ((((this.type == 11) || (this.type == 12)) || ((this.type == 13) || (this.type == 0x3d))) || ((this.type == 0x3e) || (this.type == 0x3f))) - { - this.velocity.Y *= 0.98f; - this.velocity.X *= 0.98f; - this.scale -= 0.007f; - if (this.scale < 0.1) - { - this.scale = 0.1f; - this.alpha = 0xff; - } - } - else if ((this.type == 0x10) || (this.type == 0x11)) - { - this.velocity.Y *= 0.98f; - this.velocity.X *= 0.98f; - this.scale -= 0.01f; - if (this.scale < 0.1) - { - this.scale = 0.1f; - this.alpha = 0xff; - } - } - else - { - this.velocity.Y += 0.2f; - } - this.rotation += this.velocity.X * 0.1f; - if (this.sticky) - { - int width = Main.goreTexture[this.type].Width; - if (Main.goreTexture[this.type].Height < width) - { - width = Main.goreTexture[this.type].Height; - } - width = (int) (width * 0.9f); - this.velocity = Collision.TileCollision(this.position, this.velocity, (int) (width * this.scale), (int) (width * this.scale), false, false); - if (this.velocity.Y == 0f) - { - this.velocity.X *= 0.97f; - if ((this.velocity.X > -0.01) && (this.velocity.X < 0.01)) - { - this.velocity.X = 0f; - } - } - if (this.timeLeft > 0) - { - this.timeLeft--; - } - else - { - this.alpha++; - } - } - else - { - this.alpha += 2; - } - this.position += this.velocity; - if (this.alpha >= 0xff) - { - this.active = false; - } - if (this.light > 0f) - { - Lighting.addLight((int) ((this.position.X + ((Main.goreTexture[this.type].Width * this.scale) / 2f)) / 16f), (int) ((this.position.Y + ((Main.goreTexture[this.type].Height * this.scale) / 2f)) / 16f), this.light); - } - } - } - } -} - diff --git a/Terraria/Item.cs b/Terraria/Item.cs deleted file mode 100644 index a263d853..00000000 --- a/Terraria/Item.cs +++ /dev/null @@ -1,3880 +0,0 @@ -namespace Terraria -{ - using Microsoft.Xna.Framework; - using System; - using System.Runtime.InteropServices; - - public class Item - { - public bool accessory; - public bool active; - public int alpha; - public int ammo; - public bool autoReuse; - public int axe; - public bool beingGrabbed; - public int bodySlot = -1; - public bool buy; - public bool channel; - public Color color; - public bool consumable; - public int createTile = -1; - public int createWall = -1; - public int damage; - public int defense; - public int hammer; - public int headSlot = -1; - public int healLife; - public int healMana; - public int height; - public int holdStyle; - public int keepTime; - public float knockBack; - public bool lavaWet; - public int legSlot = -1; - public int lifeRegen; - public int mana; - public int manaRegen; - public int maxStack; - public string name; - public int noGrabDelay; - public bool noMelee; - public bool noUseGraphic; - public int owner = 8; - public int ownIgnore = -1; - public int ownTime; - public int pick; - public Vector2 position; - public bool potion; - public static int potionDelay = 720; - public int rare; - public int release; - public float scale = 1f; - public int shoot; - public float shootSpeed; - public int spawnTime; - public int stack; - public int tileBoost; - public string toolTip; - public int type; - public int useAmmo; - public int useAnimation; - public int useSound; - public int useStyle; - public int useTime; - public bool useTurn; - public int value; - public Vector2 velocity; - public bool wet; - public byte wetCount; - public int width; - public bool wornArmor; - - public object Clone() - { - return base.MemberwiseClone(); - } - - public void FindOwner(int whoAmI) - { - if (this.keepTime <= 0) - { - int owner = this.owner; - this.owner = 8; - float num2 = -1f; - for (int i = 0; i < 8; i++) - { - if (((this.ownIgnore != i) && Main.player[i].active) && Main.player[i].ItemSpace(Main.item[whoAmI])) - { - float num4 = Math.Abs((float) (((Main.player[i].position.X + (Main.player[i].width / 2)) - this.position.X) - (this.width / 2))) + Math.Abs((float) (((Main.player[i].position.Y + (Main.player[i].height / 2)) - this.position.Y) - this.height)); - if ((num4 < ((Main.screenWidth / 2) + (Main.screenHeight / 2))) && ((num2 == -1f) || (num4 < num2))) - { - num2 = num4; - this.owner = i; - } - } - } - if ((this.owner != owner) && ((((owner == Main.myPlayer) && (Main.netMode == 1)) || ((owner == 8) && (Main.netMode == 2))) || !Main.player[owner].active)) - { - NetMessage.SendData(0x15, -1, -1, "", whoAmI, 0f, 0f, 0f); - if (this.active) - { - NetMessage.SendData(0x16, -1, -1, "", whoAmI, 0f, 0f, 0f); - } - } - } - } - - public Color GetAlpha(Color newColor) - { - int r = newColor.R - this.alpha; - int g = newColor.G - this.alpha; - int b = newColor.B - this.alpha; - int a = newColor.A - this.alpha; - if (a < 0) - { - a = 0; - } - if (a > 0xff) - { - a = 0xff; - } - if ((this.type >= 0xc6) && (this.type <= 0xcb)) - { - return Color.White; - } - return new Color(r, g, b, a); - } - - public Color GetColor(Color newColor) - { - int r = this.color.R - (0xff - newColor.R); - int g = this.color.G - (0xff - newColor.G); - int b = this.color.B - (0xff - newColor.B); - int a = this.color.A - (0xff - newColor.A); - if (r < 0) - { - r = 0; - } - if (r > 0xff) - { - r = 0xff; - } - if (g < 0) - { - g = 0; - } - if (g > 0xff) - { - g = 0xff; - } - if (b < 0) - { - b = 0; - } - if (b > 0xff) - { - b = 0xff; - } - if (a < 0) - { - a = 0; - } - if (a > 0xff) - { - a = 0xff; - } - return new Color(r, g, b, a); - } - - public bool IsNotTheSameAs(Item compareItem) - { - if (!(this.name != compareItem.name) && (this.stack == compareItem.stack)) - { - return false; - } - return true; - } - - public bool IsTheSameAs(Item compareItem) - { - return (this.name == compareItem.name); - } - - public static int NewItem(int X, int Y, int Width, int Height, int Type, int Stack = 1, bool noBroadcast = false) - { - if (WorldGen.gen) - { - return 0; - } - int index = 200; - Main.item[200] = new Item(); - if (Main.netMode != 1) - { - for (int i = 0; i < 200; i++) - { - if (!Main.item[i].active) - { - index = i; - break; - } - } - } - if ((index == 200) && (Main.netMode != 1)) - { - int spawnTime = 0; - for (int j = 0; j < 200; j++) - { - if (Main.item[j].spawnTime > spawnTime) - { - spawnTime = Main.item[j].spawnTime; - index = j; - } - } - } - Main.item[index] = new Item(); - Main.item[index].SetDefaults(Type); - Main.item[index].position.X = (X + (Width / 2)) - (Main.item[index].width / 2); - Main.item[index].position.Y = (Y + (Height / 2)) - (Main.item[index].height / 2); - Main.item[index].wet = Collision.WetCollision(Main.item[index].position, Main.item[index].width, Main.item[index].height); - Main.item[index].velocity.X = Main.rand.Next(-20, 0x15) * 0.1f; - Main.item[index].velocity.Y = Main.rand.Next(-30, -10) * 0.1f; - Main.item[index].active = true; - Main.item[index].spawnTime = 0; - Main.item[index].stack = Stack; - if ((Main.netMode == 2) && !noBroadcast) - { - NetMessage.SendData(0x15, -1, -1, "", index, 0f, 0f, 0f); - Main.item[index].FindOwner(index); - return index; - } - if (Main.netMode == 0) - { - Main.item[index].owner = Main.myPlayer; - } - return index; - } - - public void SetDefaults(int Type) - { - if ((Main.netMode == 1) || (Main.netMode == 2)) - { - this.owner = 8; - } - else - { - this.owner = Main.myPlayer; - } - this.mana = 0; - this.wet = false; - this.wetCount = 0; - this.lavaWet = false; - this.channel = false; - this.manaRegen = 0; - this.release = 0; - this.noMelee = false; - this.noUseGraphic = false; - this.lifeRegen = 0; - this.shootSpeed = 0f; - this.active = true; - this.alpha = 0; - this.ammo = 0; - this.useAmmo = 0; - this.autoReuse = false; - this.accessory = false; - this.axe = 0; - this.healMana = 0; - this.bodySlot = -1; - this.legSlot = -1; - this.headSlot = -1; - this.potion = false; - this.color = new Color(); - this.consumable = false; - this.createTile = -1; - this.createWall = -1; - this.damage = -1; - this.defense = 0; - this.hammer = 0; - this.healLife = 0; - this.holdStyle = 0; - this.knockBack = 0f; - this.maxStack = 1; - this.pick = 0; - this.rare = 0; - this.scale = 1f; - this.shoot = 0; - this.stack = 1; - this.toolTip = null; - this.tileBoost = 0; - this.type = Type; - this.useStyle = 0; - this.useSound = 0; - this.useTime = 100; - this.useAnimation = 100; - this.value = 0; - this.useTurn = false; - this.buy = false; - if (this.type == 1) - { - this.name = "Iron Pickaxe"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 20; - this.useTime = 13; - this.autoReuse = true; - this.width = 0x18; - this.height = 0x1c; - this.damage = 5; - this.pick = 0x2d; - this.useSound = 1; - this.knockBack = 2f; - this.value = 0x7d0; - } - else if (this.type == 2) - { - this.name = "Dirt Block"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createTile = 0; - this.width = 12; - this.height = 12; - } - else if (this.type == 3) - { - this.name = "Stone Block"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createTile = 1; - this.width = 12; - this.height = 12; - } - else if (this.type == 4) - { - this.name = "Iron Broadsword"; - this.useStyle = 1; - this.useTurn = false; - this.useAnimation = 0x15; - this.useTime = 0x15; - this.width = 0x18; - this.height = 0x1c; - this.damage = 10; - this.knockBack = 5f; - this.useSound = 1; - this.scale = 1f; - this.value = 0x708; - } - else if (this.type == 5) - { - this.name = "Mushroom"; - this.useStyle = 2; - this.useSound = 2; - this.useTurn = false; - this.useAnimation = 0x11; - this.useTime = 0x11; - this.width = 0x10; - this.height = 0x12; - this.healLife = 20; - this.maxStack = 0x63; - this.consumable = true; - this.potion = true; - this.value = 50; - } - else if (this.type == 6) - { - this.name = "Iron Shortsword"; - this.useStyle = 3; - this.useTurn = false; - this.useAnimation = 12; - this.useTime = 12; - this.width = 0x18; - this.height = 0x1c; - this.damage = 8; - this.knockBack = 4f; - this.scale = 0.9f; - this.useSound = 1; - this.useTurn = true; - this.value = 0x578; - } - else if (this.type == 7) - { - this.name = "Iron Hammer"; - this.autoReuse = true; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 30; - this.useTime = 20; - this.hammer = 0x2d; - this.width = 0x18; - this.height = 0x1c; - this.damage = 7; - this.knockBack = 5.5f; - this.scale = 1.2f; - this.useSound = 1; - this.value = 0x640; - } - else if (this.type == 8) - { - this.name = "Torch"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.holdStyle = 1; - this.autoReuse = true; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 4; - this.width = 10; - this.height = 12; - this.toolTip = "Provides light"; - this.value = 50; - } - else if (this.type == 9) - { - this.name = "Wood"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createTile = 30; - this.width = 8; - this.height = 10; - } - else if (this.type == 10) - { - this.name = "Iron Axe"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 0x1b; - this.knockBack = 4.5f; - this.useTime = 0x13; - this.autoReuse = true; - this.width = 0x18; - this.height = 0x1c; - this.damage = 5; - this.axe = 9; - this.scale = 1.1f; - this.useSound = 1; - this.value = 0x640; - } - else if (this.type == 11) - { - this.name = "Iron Ore"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 6; - this.width = 12; - this.height = 12; - this.value = 500; - } - else if (this.type == 12) - { - this.name = "Copper Ore"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 7; - this.width = 12; - this.height = 12; - this.value = 250; - } - else if (this.type == 13) - { - this.name = "Gold Ore"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 8; - this.width = 12; - this.height = 12; - this.value = 0x7d0; - } - else if (this.type == 14) - { - this.name = "Silver Ore"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 9; - this.width = 12; - this.height = 12; - this.value = 0x3e8; - } - else if (this.type == 15) - { - this.name = "Copper Watch"; - this.width = 0x18; - this.height = 0x1c; - this.accessory = true; - this.toolTip = "Tells the time"; - this.value = 0x3e8; - } - else if (this.type == 0x10) - { - this.name = "Silver Watch"; - this.width = 0x18; - this.height = 0x1c; - this.accessory = true; - this.toolTip = "Tells the time"; - this.value = 0x1388; - } - else if (this.type == 0x11) - { - this.name = "Gold Watch"; - this.width = 0x18; - this.height = 0x1c; - this.accessory = true; - this.rare = 1; - this.toolTip = "Tells the time"; - this.value = 0x2710; - } - else if (this.type == 0x12) - { - this.name = "Depth Meter"; - this.width = 0x18; - this.height = 0x12; - this.accessory = true; - this.rare = 1; - this.toolTip = "Shows depth"; - this.value = 0x2710; - } - else if (this.type == 0x13) - { - this.name = "Gold Bar"; - this.width = 20; - this.height = 20; - this.maxStack = 0x63; - this.value = 0x1770; - } - else if (this.type == 20) - { - this.name = "Copper Bar"; - this.width = 20; - this.height = 20; - this.maxStack = 0x63; - this.value = 750; - } - else if (this.type == 0x15) - { - this.name = "Silver Bar"; - this.width = 20; - this.height = 20; - this.maxStack = 0x63; - this.value = 0xbb8; - } - else if (this.type == 0x16) - { - this.name = "Iron Bar"; - this.width = 20; - this.height = 20; - this.maxStack = 0x63; - this.value = 0x5dc; - } - else if (this.type == 0x17) - { - this.name = "Gel"; - this.width = 10; - this.height = 12; - this.maxStack = 0x63; - this.alpha = 0xaf; - this.color = new Color(0, 80, 0xff, 100); - this.toolTip = "'Both tasty and flammable'"; - this.value = 5; - } - else if (this.type == 0x18) - { - this.name = "Wooden Sword"; - this.useStyle = 1; - this.useTurn = false; - this.useAnimation = 0x19; - this.width = 0x18; - this.height = 0x1c; - this.damage = 7; - this.knockBack = 4f; - this.scale = 0.95f; - this.useSound = 1; - this.value = 100; - } - else if (this.type == 0x19) - { - this.name = "Wooden Door"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 10; - this.width = 14; - this.height = 0x1c; - this.value = 200; - } - else if (this.type == 0x1a) - { - this.name = "Stone Wall"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createWall = 1; - this.width = 12; - this.height = 12; - } - else if (this.type == 0x1b) - { - this.name = "Acorn"; - this.useTurn = true; - this.useStyle = 1; - this.useAnimation = 15; - this.useTime = 10; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 20; - this.width = 0x12; - this.height = 0x12; - this.value = 10; - } - else if (this.type == 0x1c) - { - this.name = "Lesser Healing Potion"; - this.useSound = 3; - this.healLife = 100; - this.useStyle = 2; - this.useTurn = true; - this.useAnimation = 0x11; - this.useTime = 0x11; - this.maxStack = 30; - this.consumable = true; - this.width = 14; - this.height = 0x18; - this.potion = true; - this.value = 200; - } - else if (this.type == 0x1d) - { - this.name = "Life Crystal"; - this.maxStack = 0x63; - this.consumable = true; - this.width = 0x12; - this.height = 0x12; - this.useStyle = 4; - this.useTime = 30; - this.useSound = 4; - this.useAnimation = 30; - this.toolTip = "Increases maximum life"; - this.rare = 2; - } - else if (this.type == 30) - { - this.name = "Dirt Wall"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createWall = 2; - this.width = 12; - this.height = 12; - } - else if (this.type == 0x1f) - { - this.name = "Bottle"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 13; - this.width = 0x10; - this.height = 0x18; - this.value = 100; - } - else if (this.type == 0x20) - { - this.name = "Wooden Table"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 14; - this.width = 0x1a; - this.height = 20; - this.value = 300; - } - else if (this.type == 0x21) - { - this.name = "Furnace"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 0x11; - this.width = 0x1a; - this.height = 0x18; - this.value = 300; - } - else if (this.type == 0x22) - { - this.name = "Wooden Chair"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 15; - this.width = 12; - this.height = 30; - this.value = 150; - } - else if (this.type == 0x23) - { - this.name = "Iron Anvil"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 0x10; - this.width = 0x1c; - this.height = 14; - this.value = 0x1388; - } - else if (this.type == 0x24) - { - this.name = "Work Bench"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 0x12; - this.width = 0x1c; - this.height = 14; - this.value = 150; - } - else if (this.type == 0x25) - { - this.name = "Goggles"; - this.width = 0x1c; - this.height = 12; - this.defense = 1; - this.headSlot = 10; - this.rare = 1; - this.value = 0x3e8; - } - else if (this.type == 0x26) - { - this.name = "Lens"; - this.width = 12; - this.height = 20; - this.maxStack = 0x63; - this.value = 500; - } - else if (this.type == 0x27) - { - this.useStyle = 5; - this.useAnimation = 30; - this.useTime = 30; - this.name = "Wooden Bow"; - this.width = 12; - this.height = 0x1c; - this.shoot = 1; - this.useAmmo = 1; - this.useSound = 5; - this.damage = 5; - this.shootSpeed = 6.1f; - this.noMelee = true; - this.value = 100; - } - else if (this.type == 40) - { - this.name = "Wooden Arrow"; - this.shootSpeed = 3f; - this.shoot = 1; - this.damage = 5; - this.width = 10; - this.height = 0x1c; - this.maxStack = 250; - this.consumable = true; - this.ammo = 1; - this.knockBack = 2f; - this.value = 10; - } - else if (this.type == 0x29) - { - this.name = "Flaming Arrow"; - this.shootSpeed = 3.5f; - this.shoot = 2; - this.damage = 7; - this.width = 10; - this.height = 0x1c; - this.maxStack = 250; - this.consumable = true; - this.ammo = 1; - this.knockBack = 2f; - this.value = 15; - } - else if (this.type == 0x2a) - { - this.useStyle = 1; - this.name = "Shuriken"; - this.shootSpeed = 9f; - this.shoot = 3; - this.damage = 10; - this.width = 0x12; - this.height = 20; - this.maxStack = 250; - this.consumable = true; - this.useSound = 1; - this.useAnimation = 15; - this.useTime = 15; - this.noUseGraphic = true; - this.noMelee = true; - this.value = 20; - } - else if (this.type == 0x2b) - { - this.useStyle = 4; - this.name = "Suspicious Looking Eye"; - this.width = 0x16; - this.height = 14; - this.consumable = true; - this.useAnimation = 0x2d; - this.useTime = 0x2d; - this.toolTip = "May cause terrible things to occur"; - } - else if (this.type == 0x2c) - { - this.useStyle = 5; - this.useAnimation = 0x19; - this.useTime = 0x19; - this.name = "Demon Bow"; - this.width = 12; - this.height = 0x1c; - this.shoot = 1; - this.useAmmo = 1; - this.useSound = 5; - this.damage = 13; - this.shootSpeed = 6.7f; - this.knockBack = 1f; - this.alpha = 30; - this.rare = 1; - this.noMelee = true; - this.value = 0x4650; - } - else if (this.type == 0x2d) - { - this.name = "War Axe of the Night"; - this.autoReuse = true; - this.useStyle = 1; - this.useAnimation = 30; - this.knockBack = 6f; - this.useTime = 15; - this.width = 0x18; - this.height = 0x1c; - this.damage = 0x15; - this.axe = 15; - this.scale = 1.2f; - this.useSound = 1; - this.rare = 1; - this.value = 0x34bc; - } - else if (this.type == 0x2e) - { - this.name = "Light's Bane"; - this.useStyle = 1; - this.useAnimation = 20; - this.knockBack = 5f; - this.width = 0x18; - this.height = 0x1c; - this.damage = 0x10; - this.scale = 1.1f; - this.useSound = 1; - this.rare = 1; - this.value = 0x34bc; - } - else if (this.type == 0x2f) - { - this.name = "Unholy Arrow"; - this.shootSpeed = 3.4f; - this.shoot = 4; - this.damage = 8; - this.width = 10; - this.height = 0x1c; - this.maxStack = 250; - this.consumable = true; - this.ammo = 1; - this.knockBack = 3f; - this.alpha = 30; - this.rare = 1; - this.value = 40; - } - else if (this.type == 0x30) - { - this.name = "Chest"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 0x15; - this.width = 0x1a; - this.height = 0x16; - this.value = 500; - } - else if (this.type == 0x31) - { - this.name = "Band of Regeneration"; - this.width = 0x16; - this.height = 0x16; - this.accessory = true; - this.lifeRegen = 1; - this.rare = 1; - this.toolTip = "Slowly regenerates life"; - this.value = 0xc350; - } - else if (this.type == 50) - { - this.name = "Magic Mirror"; - this.useTurn = true; - this.width = 20; - this.height = 20; - this.useStyle = 4; - this.useTime = 90; - this.useSound = 6; - this.useAnimation = 90; - this.toolTip = "Gaze in the mirror to return home"; - this.rare = 1; - this.value = 0xc350; - } - else if (this.type == 0x33) - { - this.name = "Jester's Arrow"; - this.shootSpeed = 0.5f; - this.shoot = 5; - this.damage = 9; - this.width = 10; - this.height = 0x1c; - this.maxStack = 250; - this.consumable = true; - this.ammo = 1; - this.knockBack = 4f; - this.rare = 1; - this.value = 100; - } - else if (this.type == 0x34) - { - this.name = "Angel Statue"; - this.width = 0x18; - this.height = 0x1c; - this.toolTip = "It doesn't do anything"; - this.value = 1; - } - else if (this.type == 0x35) - { - this.name = "Cloud in a Bottle"; - this.width = 0x10; - this.height = 0x18; - this.accessory = true; - this.rare = 1; - this.toolTip = "Allows the holder to double jump"; - this.value = 0xc350; - } - else if (this.type == 0x36) - { - this.name = "Hermes Boots"; - this.width = 0x1c; - this.height = 0x18; - this.accessory = true; - this.rare = 1; - this.toolTip = "The wearer can run super fast"; - this.value = 0xc350; - } - else if (this.type == 0x37) - { - this.noMelee = true; - this.useStyle = 1; - this.name = "Enchanted Boomerang"; - this.shootSpeed = 10f; - this.shoot = 6; - this.damage = 13; - this.knockBack = 8f; - this.width = 14; - this.height = 0x1c; - this.useSound = 1; - this.useAnimation = 15; - this.useTime = 15; - this.noUseGraphic = true; - this.rare = 1; - this.value = 0xc350; - } - else if (this.type == 0x38) - { - this.name = "Demonite Ore"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 0x16; - this.width = 12; - this.height = 12; - this.rare = 1; - this.toolTip = "Pulsing with dark energy"; - this.value = 0xfa0; - } - else if (this.type == 0x39) - { - this.name = "Demonite Bar"; - this.width = 20; - this.height = 20; - this.maxStack = 0x63; - this.rare = 1; - this.toolTip = "Pulsing with dark energy"; - this.value = 0x3e80; - } - else if (this.type == 0x3a) - { - this.name = "Heart"; - this.width = 12; - this.height = 12; - } - else if (this.type == 0x3b) - { - this.name = "Corrupt Seeds"; - this.useTurn = true; - this.useStyle = 1; - this.useAnimation = 15; - this.useTime = 10; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 0x17; - this.width = 14; - this.height = 14; - this.value = 500; - } - else if (this.type == 60) - { - this.name = "Vile Mushroom"; - this.width = 0x10; - this.height = 0x12; - this.maxStack = 0x63; - this.value = 50; - } - else if (this.type == 0x3d) - { - this.name = "Ebonstone Block"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createTile = 0x19; - this.width = 12; - this.height = 12; - } - else if (this.type == 0x3e) - { - this.name = "Grass Seeds"; - this.useTurn = true; - this.useStyle = 1; - this.useAnimation = 15; - this.useTime = 10; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 2; - this.width = 14; - this.height = 14; - this.value = 20; - } - else if (this.type == 0x3f) - { - this.name = "Sunflower"; - this.useTurn = true; - this.useStyle = 1; - this.useAnimation = 15; - this.useTime = 10; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 0x1b; - this.width = 0x1a; - this.height = 0x1a; - this.value = 200; - } - else if (this.type == 0x40) - { - this.mana = 5; - this.damage = 8; - this.useStyle = 1; - this.name = "Vilethorn"; - this.shootSpeed = 32f; - this.shoot = 7; - this.width = 0x1a; - this.height = 0x1c; - this.useSound = 8; - this.useAnimation = 30; - this.useTime = 30; - this.rare = 1; - this.noMelee = true; - this.toolTip = "Summons a vile thorn"; - this.value = 0x2710; - } - else if (this.type == 0x41) - { - this.mana = 11; - this.knockBack = 5f; - this.alpha = 100; - this.color = new Color(150, 150, 150, 0); - this.damage = 15; - this.useStyle = 1; - this.scale = 1.15f; - this.name = "Starfury"; - this.shootSpeed = 12f; - this.shoot = 9; - this.width = 14; - this.height = 0x1c; - this.useSound = 9; - this.useAnimation = 0x19; - this.useTime = 10; - this.rare = 1; - this.toolTip = "Forged with the fury of heaven"; - this.value = 0xc350; - } - else if (this.type == 0x42) - { - this.useStyle = 1; - this.name = "Purification Powder"; - this.shootSpeed = 4f; - this.shoot = 10; - this.width = 0x10; - this.height = 0x18; - this.maxStack = 0x63; - this.consumable = true; - this.useSound = 1; - this.useAnimation = 15; - this.useTime = 15; - this.noMelee = true; - this.toolTip = "Cleanses the corruption"; - this.value = 0x4b; - } - else if (this.type == 0x43) - { - this.damage = 8; - this.useStyle = 1; - this.name = "Vile Powder"; - this.shootSpeed = 4f; - this.shoot = 11; - this.width = 0x10; - this.height = 0x18; - this.maxStack = 0x63; - this.consumable = true; - this.useSound = 1; - this.useAnimation = 15; - this.useTime = 15; - this.noMelee = true; - this.value = 100; - } - else if (this.type == 0x44) - { - this.name = "Rotten Chunk"; - this.width = 0x12; - this.height = 20; - this.maxStack = 0x63; - this.toolTip = "Looks tasty!"; - this.value = 10; - } - else if (this.type == 0x45) - { - this.name = "Worm Tooth"; - this.width = 8; - this.height = 20; - this.maxStack = 0x63; - this.value = 100; - } - else if (this.type == 70) - { - this.useStyle = 4; - this.consumable = true; - this.useAnimation = 0x2d; - this.useTime = 0x2d; - this.name = "Worm Food"; - this.width = 0x1c; - this.height = 0x1c; - this.toolTip = "May attract giant worms"; - } - else if (this.type == 0x47) - { - this.name = "Copper Coin"; - this.width = 10; - this.height = 12; - this.maxStack = 100; - } - else if (this.type == 0x48) - { - this.name = "Silver Coin"; - this.width = 10; - this.height = 12; - this.maxStack = 100; - } - else if (this.type == 0x49) - { - this.name = "Gold Coin"; - this.width = 10; - this.height = 12; - this.maxStack = 100; - } - else if (this.type == 0x4a) - { - this.name = "Platinum Coin"; - this.width = 10; - this.height = 12; - this.maxStack = 100; - } - else if (this.type == 0x4b) - { - this.name = "Fallen Star"; - this.width = 0x12; - this.height = 20; - this.maxStack = 100; - this.alpha = 0x4b; - this.ammo = 15; - this.toolTip = "Disappears after the sunrise"; - this.value = 500; - this.useStyle = 4; - this.useSound = 4; - this.useTurn = false; - this.useAnimation = 0x11; - this.useTime = 0x11; - this.healMana = 20; - this.consumable = true; - this.rare = 1; - this.potion = true; - } - else if (this.type == 0x4c) - { - this.name = "Copper Greaves"; - this.width = 0x12; - this.height = 0x1c; - this.defense = 1; - this.legSlot = 1; - this.value = 750; - } - else if (this.type == 0x4d) - { - this.name = "Iron Greaves"; - this.width = 0x12; - this.height = 0x1c; - this.defense = 2; - this.legSlot = 2; - this.value = 0xbb8; - } - else if (this.type == 0x4e) - { - this.name = "Silver Greaves"; - this.width = 0x12; - this.height = 0x1c; - this.defense = 3; - this.legSlot = 3; - this.value = 0x1d4c; - } - else if (this.type == 0x4f) - { - this.name = "Gold Greaves"; - this.width = 0x12; - this.height = 0x1c; - this.defense = 4; - this.legSlot = 4; - this.value = 0x3a98; - } - else if (this.type == 80) - { - this.name = "Copper Chainmail"; - this.width = 0x1a; - this.height = 0x1c; - this.defense = 2; - this.bodySlot = 1; - this.value = 0x3e8; - } - else if (this.type == 0x51) - { - this.name = "Iron Chainmail"; - this.width = 0x1a; - this.height = 0x1c; - this.defense = 3; - this.bodySlot = 2; - this.value = 0xfa0; - } - else if (this.type == 0x52) - { - this.name = "Silver Chainmail"; - this.width = 0x1a; - this.height = 0x1c; - this.defense = 4; - this.bodySlot = 3; - this.value = 0x2710; - } - else if (this.type == 0x53) - { - this.name = "Gold Chainmail"; - this.width = 0x1a; - this.height = 0x1c; - this.defense = 5; - this.bodySlot = 4; - this.value = 0x4e20; - } - else if (this.type == 0x54) - { - this.noUseGraphic = true; - this.damage = 0; - this.knockBack = 7f; - this.useStyle = 5; - this.name = "Grappling Hook"; - this.shootSpeed = 11f; - this.shoot = 13; - this.width = 0x12; - this.height = 0x1c; - this.useSound = 1; - this.useAnimation = 20; - this.useTime = 20; - this.rare = 1; - this.noMelee = true; - this.value = 0x4e20; - } - else if (this.type == 0x55) - { - this.name = "Iron Chain"; - this.width = 14; - this.height = 20; - this.maxStack = 0x63; - this.value = 0x3e8; - } - else if (this.type == 0x56) - { - this.name = "Shadow Scale"; - this.width = 14; - this.height = 0x12; - this.maxStack = 0x63; - this.rare = 1; - this.value = 500; - } - else if (this.type == 0x57) - { - this.name = "Piggy Bank"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 0x1d; - this.width = 20; - this.height = 12; - this.value = 0x2710; - } - else if (this.type == 0x58) - { - this.name = "Mining Helmet"; - this.width = 0x16; - this.height = 0x10; - this.defense = 1; - this.headSlot = 11; - this.rare = 1; - this.value = 0x13880; - this.toolTip = "Provides light when worn"; - } - else if (this.type == 0x59) - { - this.name = "Copper Helmet"; - this.width = 0x16; - this.height = 0x16; - this.defense = 1; - this.headSlot = 1; - this.value = 0x4e2; - } - else if (this.type == 90) - { - this.name = "Iron Helmet"; - this.width = 0x16; - this.height = 0x16; - this.defense = 2; - this.headSlot = 2; - this.value = 0x1388; - } - else if (this.type == 0x5b) - { - this.name = "Silver Helmet"; - this.width = 0x16; - this.height = 0x16; - this.defense = 3; - this.headSlot = 3; - this.value = 0x30d4; - } - else if (this.type == 0x5c) - { - this.name = "Gold Helmet"; - this.width = 0x16; - this.height = 0x16; - this.defense = 4; - this.headSlot = 4; - this.value = 0x61a8; - } - else if (this.type == 0x5d) - { - this.name = "Wood Wall"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createWall = 4; - this.width = 12; - this.height = 12; - } - else if (this.type == 0x5e) - { - this.name = "Wood Platform"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 0x13; - this.width = 8; - this.height = 10; - } - else if (this.type == 0x5f) - { - this.useStyle = 5; - this.useAnimation = 20; - this.useTime = 20; - this.name = "Flintlock Pistol"; - this.width = 0x18; - this.height = 0x1c; - this.shoot = 14; - this.useAmmo = 14; - this.useSound = 11; - this.damage = 7; - this.shootSpeed = 5f; - this.noMelee = true; - this.value = 0xc350; - this.scale = 0.9f; - this.rare = 1; - } - else if (this.type == 0x60) - { - this.useStyle = 5; - this.autoReuse = true; - this.useAnimation = 0x2d; - this.useTime = 0x2d; - this.name = "Musket"; - this.width = 0x2c; - this.height = 14; - this.shoot = 10; - this.useAmmo = 14; - this.useSound = 11; - this.damage = 14; - this.shootSpeed = 8f; - this.noMelee = true; - this.value = 0x186a0; - this.knockBack = 4f; - this.rare = 1; - } - else if (this.type == 0x61) - { - this.name = "Musket Ball"; - this.shootSpeed = 4f; - this.shoot = 14; - this.damage = 7; - this.width = 8; - this.height = 8; - this.maxStack = 250; - this.consumable = true; - this.ammo = 14; - this.knockBack = 2f; - this.value = 8; - } - else if (this.type == 0x62) - { - this.useStyle = 5; - this.autoReuse = true; - this.useAnimation = 8; - this.useTime = 8; - this.name = "Minishark"; - this.width = 50; - this.height = 0x12; - this.shoot = 10; - this.useAmmo = 14; - this.useSound = 11; - this.damage = 5; - this.shootSpeed = 7f; - this.noMelee = true; - this.value = 0x7a120; - this.rare = 2; - this.toolTip = "Half shark, half gun, completely awesome."; - } - else if (this.type == 0x63) - { - this.useStyle = 5; - this.useAnimation = 0x1c; - this.useTime = 0x1c; - this.name = "Iron Bow"; - this.width = 12; - this.height = 0x1c; - this.shoot = 1; - this.useAmmo = 1; - this.useSound = 5; - this.damage = 9; - this.shootSpeed = 6.6f; - this.noMelee = true; - this.value = 0x578; - } - else if (this.type == 100) - { - this.name = "Shadow Greaves"; - this.width = 0x12; - this.height = 0x1c; - this.defense = 6; - this.legSlot = 5; - this.rare = 1; - this.value = 0x57e4; - } - else if (this.type == 0x65) - { - this.name = "Shadow Scalemail"; - this.width = 0x1a; - this.height = 0x1c; - this.defense = 7; - this.bodySlot = 5; - this.rare = 1; - this.value = 0x7530; - } - else if (this.type == 0x66) - { - this.name = "Shadow Helmet"; - this.width = 0x16; - this.height = 0x16; - this.defense = 6; - this.headSlot = 5; - this.rare = 1; - this.value = 0x927c; - } - else if (this.type == 0x67) - { - this.name = "Nightmare Pickaxe"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 20; - this.useTime = 15; - this.autoReuse = true; - this.width = 0x18; - this.height = 0x1c; - this.damage = 11; - this.pick = 0x41; - this.useSound = 1; - this.knockBack = 3f; - this.rare = 1; - this.value = 0x4650; - this.scale = 1.15f; - } - else if (this.type == 0x68) - { - this.name = "The Breaker"; - this.autoReuse = true; - this.useStyle = 1; - this.useAnimation = 40; - this.useTime = 0x13; - this.hammer = 0x37; - this.width = 0x18; - this.height = 0x1c; - this.damage = 0x1c; - this.knockBack = 6.5f; - this.scale = 1.3f; - this.useSound = 1; - this.rare = 1; - this.value = 0x3a98; - } - else if (this.type == 0x69) - { - this.name = "Candle"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 0x21; - this.width = 8; - this.height = 0x12; - this.holdStyle = 1; - } - else if (this.type == 0x6a) - { - this.name = "Copper Chandelier"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 0x22; - this.width = 0x1a; - this.height = 0x1a; - } - else if (this.type == 0x6b) - { - this.name = "Silver Chandelier"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 0x23; - this.width = 0x1a; - this.height = 0x1a; - } - else if (this.type == 0x6c) - { - this.name = "Gold Chandelier"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 0x24; - this.width = 0x1a; - this.height = 0x1a; - } - else if (this.type == 0x6d) - { - this.name = "Mana Crystal"; - this.maxStack = 0x63; - this.consumable = true; - this.width = 0x12; - this.height = 0x12; - this.useStyle = 4; - this.useTime = 30; - this.useSound = 4; - this.useAnimation = 30; - this.toolTip = "Increases maximum mana"; - this.rare = 2; - } - else if (this.type == 110) - { - this.name = "Lesser Mana Potion"; - this.useSound = 3; - this.healMana = 100; - this.useStyle = 2; - this.useTurn = true; - this.useAnimation = 0x11; - this.useTime = 0x11; - this.maxStack = 30; - this.consumable = true; - this.width = 14; - this.height = 0x18; - this.potion = true; - this.value = 0x3e8; - } - else if (this.type == 0x6f) - { - this.name = "Band of Starpower"; - this.width = 0x16; - this.height = 0x16; - this.accessory = true; - this.manaRegen = 3; - this.rare = 1; - this.toolTip = "Slowly regenerates mana"; - this.value = 0xc350; - } - else if (this.type == 0x70) - { - this.mana = 10; - this.damage = 30; - this.useStyle = 1; - this.name = "Flower of Fire"; - this.shootSpeed = 6f; - this.shoot = 15; - this.width = 0x1a; - this.height = 0x1c; - this.useSound = 8; - this.useAnimation = 30; - this.useTime = 30; - this.rare = 3; - this.noMelee = true; - this.knockBack = 5f; - this.toolTip = "Throws balls of fire"; - this.value = 0x2710; - } - else if (this.type == 0x71) - { - this.mana = 0x12; - this.channel = true; - this.damage = 30; - this.useStyle = 1; - this.name = "Magic Missile"; - this.shootSpeed = 6f; - this.shoot = 0x10; - this.width = 0x1a; - this.height = 0x1c; - this.useSound = 9; - this.useAnimation = 20; - this.useTime = 20; - this.rare = 2; - this.noMelee = true; - this.knockBack = 5f; - this.toolTip = "Casts a controllable missile"; - this.value = 0x2710; - } - else if (this.type == 0x72) - { - this.mana = 5; - this.channel = true; - this.damage = 0; - this.useStyle = 1; - this.name = "Dirt Rod"; - this.shoot = 0x11; - this.width = 0x1a; - this.height = 0x1c; - this.useSound = 8; - this.useAnimation = 20; - this.useTime = 20; - this.rare = 1; - this.noMelee = true; - this.knockBack = 5f; - this.toolTip = "Magically move dirt"; - this.value = 0x30d40; - } - else if (this.type == 0x73) - { - this.mana = 40; - this.channel = true; - this.damage = 0; - this.useStyle = 4; - this.name = "Orb of Light"; - this.shoot = 0x12; - this.width = 0x18; - this.height = 0x18; - this.useSound = 8; - this.useAnimation = 20; - this.useTime = 20; - this.rare = 1; - this.noMelee = true; - this.toolTip = "Creates a magical orb of light"; - this.value = 0x2710; - } - else if (this.type == 0x74) - { - this.name = "Meteorite"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createTile = 0x25; - this.width = 12; - this.height = 12; - this.value = 0x3e8; - } - else if (this.type == 0x75) - { - this.name = "Meteorite Bar"; - this.width = 20; - this.height = 20; - this.maxStack = 0x63; - this.rare = 1; - this.toolTip = "Warm to the touch"; - this.value = 0x1b58; - } - else if (this.type == 0x76) - { - this.name = "Hook"; - this.maxStack = 0x63; - this.width = 0x12; - this.height = 0x12; - this.value = 0x3e8; - this.toolTip = "Combine with chains to making a grappling hook"; - } - else if (this.type == 0x77) - { - this.noMelee = true; - this.useStyle = 1; - this.name = "Flamarang"; - this.shootSpeed = 11f; - this.shoot = 0x13; - this.damage = 0x20; - this.knockBack = 8f; - this.width = 14; - this.height = 0x1c; - this.useSound = 1; - this.useAnimation = 15; - this.useTime = 15; - this.noUseGraphic = true; - this.rare = 3; - this.value = 0x186a0; - } - else if (this.type == 120) - { - this.useStyle = 5; - this.useAnimation = 0x19; - this.useTime = 0x19; - this.name = "Molten Fury"; - this.width = 14; - this.height = 0x20; - this.shoot = 1; - this.useAmmo = 1; - this.useSound = 5; - this.damage = 0x1d; - this.shootSpeed = 8f; - this.knockBack = 2f; - this.alpha = 30; - this.rare = 3; - this.noMelee = true; - this.scale = 1.1f; - this.value = 0x6978; - this.toolTip = "Lights wooden arrows ablaze"; - } - else if (this.type == 0x79) - { - this.name = "Fiery Greatsword"; - this.useStyle = 1; - this.useAnimation = 0x23; - this.knockBack = 6.5f; - this.width = 0x18; - this.height = 0x1c; - this.damage = 0x22; - this.scale = 1.3f; - this.useSound = 1; - this.rare = 3; - this.value = 0x6978; - this.toolTip = "It's made out of fire!"; - } - if (this.type == 0x7a) - { - this.name = "Molten Pickaxe"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 0x19; - this.useTime = 0x19; - this.autoReuse = true; - this.width = 0x18; - this.height = 0x1c; - this.damage = 0x12; - this.pick = 100; - this.scale = 1.15f; - this.useSound = 1; - this.knockBack = 2f; - this.rare = 3; - this.value = 0x6978; - } - else if (this.type == 0x7b) - { - this.name = "Meteor Helmet"; - this.width = 0x16; - this.height = 0x16; - this.defense = 4; - this.headSlot = 6; - this.rare = 1; - this.value = 0xafc8; - this.manaRegen = 3; - this.toolTip = "Slowly regenerates mana"; - } - else if (this.type == 0x7c) - { - this.name = "Meteor Suit"; - this.width = 0x1a; - this.height = 0x1c; - this.defense = 5; - this.bodySlot = 6; - this.rare = 1; - this.value = 0x7530; - this.manaRegen = 3; - this.toolTip = "Slowly regenerates mana"; - } - else if (this.type == 0x7d) - { - this.name = "Meteor Leggings"; - this.width = 0x12; - this.height = 0x1c; - this.defense = 4; - this.legSlot = 6; - this.rare = 1; - this.manaRegen = 3; - this.value = 0x7530; - this.toolTip = "Slowly regenerates mana"; - } - else if (this.type == 0x7e) - { - this.name = "Angel Statue"; - this.width = 0x18; - this.height = 0x1c; - this.toolTip = "It doesn't do anything"; - this.value = 1; - } - else if (this.type == 0x7f) - { - this.autoReuse = true; - this.useStyle = 5; - this.useAnimation = 0x12; - this.useTime = 0x12; - this.name = "Space Gun"; - this.width = 0x18; - this.height = 0x1c; - this.shoot = 20; - this.mana = 9; - this.useSound = 12; - this.knockBack = 1f; - this.damage = 15; - this.shootSpeed = 10f; - this.noMelee = true; - this.scale = 0.8f; - this.rare = 1; - } - else if (this.type == 0x80) - { - this.mana = 7; - this.name = "Rocket Boots"; - this.width = 0x1c; - this.height = 0x18; - this.accessory = true; - this.rare = 3; - this.toolTip = "Allows flight"; - this.value = 0xc350; - } - else if (this.type == 0x81) - { - this.name = "Gray Brick"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createTile = 0x26; - this.width = 12; - this.height = 12; - } - else if (this.type == 130) - { - this.name = "Gray Brick Wall"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createWall = 5; - this.width = 12; - this.height = 12; - } - else if (this.type == 0x83) - { - this.name = "Red Brick"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createTile = 0x27; - this.width = 12; - this.height = 12; - } - else if (this.type == 0x84) - { - this.name = "Red Brick Wall"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createWall = 6; - this.width = 12; - this.height = 12; - } - else if (this.type == 0x85) - { - this.name = "Clay Block"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createTile = 40; - this.width = 12; - this.height = 12; - } - else if (this.type == 0x86) - { - this.name = "Blue Brick"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createTile = 0x29; - this.width = 12; - this.height = 12; - } - else if (this.type == 0x87) - { - this.name = "Blue Brick Wall"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createWall = 7; - this.width = 12; - this.height = 12; - } - else if (this.type == 0x88) - { - this.name = "Chain Lantern"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createTile = 0x2a; - this.width = 12; - this.height = 0x1c; - } - else if (this.type == 0x89) - { - this.name = "Green Brick"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createTile = 0x2b; - this.width = 12; - this.height = 12; - } - else if (this.type == 0x8a) - { - this.name = "Green Brick Wall"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createWall = 8; - this.width = 12; - this.height = 12; - } - else if (this.type == 0x8b) - { - this.name = "Pink Brick"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createTile = 0x2c; - this.width = 12; - this.height = 12; - } - else if (this.type == 140) - { - this.name = "Pink Brick Wall"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createWall = 9; - this.width = 12; - this.height = 12; - } - else if (this.type == 0x8d) - { - this.name = "Gold Brick"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createTile = 0x2d; - this.width = 12; - this.height = 12; - } - else if (this.type == 0x8e) - { - this.name = "Gold Brick Wall"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createWall = 10; - this.width = 12; - this.height = 12; - } - else if (this.type == 0x8f) - { - this.name = "Silver Brick"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createTile = 0x2e; - this.width = 12; - this.height = 12; - } - else if (this.type == 0x90) - { - this.name = "Silver Brick Wall"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createWall = 11; - this.width = 12; - this.height = 12; - } - else if (this.type == 0x91) - { - this.name = "Copper Brick"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createTile = 0x2f; - this.width = 12; - this.height = 12; - } - else if (this.type == 0x92) - { - this.name = "Copper Brick Wall"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createWall = 12; - this.width = 12; - this.height = 12; - } - else if (this.type == 0x93) - { - this.name = "Spike"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createTile = 0x30; - this.width = 12; - this.height = 12; - } - else if (this.type == 0x94) - { - this.name = "Water Candle"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 0x31; - this.width = 8; - this.height = 0x12; - this.holdStyle = 1; - this.toolTip = "Holding this may attract unwanted attention"; - } - else if (this.type == 0x95) - { - this.name = "Book"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 50; - this.width = 0x18; - this.height = 0x1c; - this.toolTip = "It contains strange symbols"; - } - else if (this.type == 150) - { - this.name = "Cobweb"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createTile = 0x33; - this.width = 20; - this.height = 0x18; - this.alpha = 100; - } - else if (this.type == 0x97) - { - this.name = "Necro Helmet"; - this.width = 0x16; - this.height = 0x16; - this.defense = 6; - this.headSlot = 7; - this.rare = 2; - this.value = 0xafc8; - } - else if (this.type == 0x98) - { - this.name = "Necro Breastplate"; - this.width = 0x1a; - this.height = 0x1c; - this.defense = 7; - this.bodySlot = 7; - this.rare = 2; - this.value = 0x7530; - } - else if (this.type == 0x99) - { - this.name = "Necro Greaves"; - this.width = 0x12; - this.height = 0x1c; - this.defense = 6; - this.legSlot = 7; - this.rare = 2; - this.value = 0x7530; - } - else if (this.type == 0x9a) - { - this.name = "Bone"; - this.maxStack = 0x63; - this.consumable = true; - this.width = 12; - this.height = 14; - this.value = 50; - this.useAnimation = 12; - this.useTime = 12; - this.useStyle = 1; - this.useSound = 1; - this.shootSpeed = 8f; - this.noUseGraphic = true; - this.damage = 0x16; - this.knockBack = 4f; - this.shoot = 0x15; - } - else if (this.type == 0x9b) - { - this.autoReuse = true; - this.useTurn = true; - this.name = "Muramasa"; - this.useStyle = 1; - this.useAnimation = 20; - this.knockBack = 3f; - this.width = 40; - this.height = 40; - this.damage = 0x16; - this.scale = 1.2f; - this.useSound = 1; - this.rare = 2; - this.value = 0x6978; - } - else if (this.type == 0x9c) - { - this.name = "Cobalt Shield"; - this.width = 0x18; - this.height = 0x1c; - this.rare = 2; - this.value = 0x6978; - this.accessory = true; - this.defense = 2; - this.toolTip = "Grants immunity to knockback"; - } - else if (this.type == 0x9d) - { - this.mana = 12; - this.autoReuse = true; - this.name = "Aqua Scepter"; - this.useStyle = 5; - this.useAnimation = 30; - this.useTime = 5; - this.knockBack = 3f; - this.width = 0x26; - this.height = 10; - this.damage = 15; - this.scale = 1f; - this.shoot = 0x16; - this.shootSpeed = 10f; - this.useSound = 13; - this.rare = 2; - this.value = 0x6978; - this.toolTip = "Sprays out a shower of water"; - } - else if (this.type == 0x9e) - { - this.name = "Lucky Horseshoe"; - this.width = 20; - this.height = 0x16; - this.rare = 1; - this.value = 0x6978; - this.accessory = true; - this.toolTip = "Negate fall damage"; - } - else if (this.type == 0x9f) - { - this.name = "Shiny Red Balloon"; - this.width = 14; - this.height = 0x1c; - this.rare = 1; - this.value = 0x6978; - this.accessory = true; - this.toolTip = "Increases jump height"; - } - else if (this.type == 160) - { - this.autoReuse = true; - this.name = "Harpoon"; - this.useStyle = 5; - this.useAnimation = 30; - this.useTime = 30; - this.knockBack = 6f; - this.width = 30; - this.height = 10; - this.damage = 15; - this.scale = 1.1f; - this.shoot = 0x17; - this.shootSpeed = 10f; - this.useSound = 10; - this.rare = 2; - this.value = 0x6978; - } - else if (this.type == 0xa1) - { - this.useStyle = 1; - this.name = "Spiky Ball"; - this.shootSpeed = 5f; - this.shoot = 0x18; - this.knockBack = 1f; - this.damage = 12; - this.width = 10; - this.height = 10; - this.maxStack = 250; - this.consumable = true; - this.useSound = 1; - this.useAnimation = 15; - this.useTime = 15; - this.noUseGraphic = true; - this.noMelee = true; - this.value = 20; - } - else if (this.type == 0xa2) - { - this.name = "Ball 'O Hurt"; - this.useStyle = 5; - this.useAnimation = 30; - this.useTime = 30; - this.knockBack = 7f; - this.width = 30; - this.height = 10; - this.damage = 15; - this.scale = 1.1f; - this.noUseGraphic = true; - this.shoot = 0x19; - this.shootSpeed = 12f; - this.useSound = 1; - this.rare = 1; - this.value = 0x6978; - } - else if (this.type == 0xa3) - { - this.name = "Blue Moon"; - this.useStyle = 5; - this.useAnimation = 30; - this.useTime = 30; - this.knockBack = 7f; - this.width = 30; - this.height = 10; - this.damage = 30; - this.scale = 1.1f; - this.noUseGraphic = true; - this.shoot = 0x1a; - this.shootSpeed = 12f; - this.useSound = 1; - this.rare = 2; - this.value = 0x6978; - } - else if (this.type == 0xa4) - { - this.autoReuse = false; - this.useStyle = 5; - this.useAnimation = 10; - this.useTime = 10; - this.name = "Handgun"; - this.width = 0x18; - this.height = 0x1c; - this.shoot = 14; - this.knockBack = 3f; - this.useAmmo = 14; - this.useSound = 11; - this.damage = 12; - this.shootSpeed = 10f; - this.noMelee = true; - this.value = 0xc350; - this.scale = 0.8f; - this.rare = 2; - } - else if (this.type == 0xa5) - { - this.rare = 2; - this.mana = 20; - this.useSound = 8; - this.name = "Water Bolt"; - this.useStyle = 5; - this.damage = 15; - this.useAnimation = 20; - this.useTime = 20; - this.width = 0x18; - this.height = 0x1c; - this.shoot = 0x1b; - this.scale = 0.8f; - this.shootSpeed = 4f; - this.knockBack = 5f; - this.toolTip = "Casts a slow moving bolt of water"; - } - else if (this.type == 0xa6) - { - this.useStyle = 1; - this.name = "Bomb"; - this.shootSpeed = 5f; - this.shoot = 0x1c; - this.width = 20; - this.height = 20; - this.maxStack = 20; - this.consumable = true; - this.useSound = 1; - this.useAnimation = 0x19; - this.useTime = 0x19; - this.noUseGraphic = true; - this.noMelee = true; - this.value = 500; - this.damage = 0; - this.toolTip = "A small explosion that will destroy some tiles"; - } - else if (this.type == 0xa7) - { - this.useStyle = 1; - this.name = "Dynamite"; - this.shootSpeed = 4f; - this.shoot = 0x1d; - this.width = 8; - this.height = 0x1c; - this.maxStack = 3; - this.consumable = true; - this.useSound = 1; - this.useAnimation = 40; - this.useTime = 40; - this.noUseGraphic = true; - this.noMelee = true; - this.value = 0x1388; - this.rare = 1; - this.toolTip = "A large explosion that will destroy most tiles"; - } - else if (this.type == 0xa8) - { - this.useStyle = 1; - this.name = "Grenade"; - this.shootSpeed = 5.5f; - this.shoot = 30; - this.width = 20; - this.height = 20; - this.maxStack = 20; - this.consumable = true; - this.useSound = 1; - this.useAnimation = 60; - this.useTime = 60; - this.noUseGraphic = true; - this.noMelee = true; - this.value = 500; - this.damage = 60; - this.knockBack = 8f; - this.toolTip = "A small explosion that will not destroy tiles"; - } - else if (this.type == 0xa9) - { - this.name = "Sand Block"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createTile = 0x35; - this.width = 12; - this.height = 12; - } - else if (this.type == 170) - { - this.name = "Glass"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createTile = 0x36; - this.width = 12; - this.height = 12; - } - else if (this.type == 0xab) - { - this.name = "Sign"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createTile = 0x37; - this.width = 0x1c; - this.height = 0x1c; - } - else if (this.type == 0xac) - { - this.name = "Ash Block"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createTile = 0x39; - this.width = 12; - this.height = 12; - } - else if (this.type == 0xad) - { - this.name = "Obsidian"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createTile = 0x38; - this.width = 12; - this.height = 12; - } - else if (this.type == 0xae) - { - this.name = "Hellstone"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createTile = 0x3a; - this.width = 12; - this.height = 12; - } - else if (this.type == 0xaf) - { - this.name = "Hellstone Bar"; - this.width = 20; - this.height = 20; - this.maxStack = 0x63; - this.rare = 2; - this.toolTip = "Hot to the touch"; - this.value = 0x4e20; - } - else if (this.type == 0xb0) - { - this.name = "Mud Block"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createTile = 0x3b; - this.width = 12; - this.height = 12; - } - else if (this.type == 0xb1) - { - this.name = "Sapphire"; - this.maxStack = 0x63; - this.alpha = 50; - this.width = 10; - this.height = 14; - this.value = 0x1b58; - } - else if (this.type == 0xb2) - { - this.name = "Ruby"; - this.maxStack = 0x63; - this.alpha = 50; - this.width = 10; - this.height = 14; - this.value = 0x4e20; - } - else if (this.type == 0xb3) - { - this.name = "Emerald"; - this.maxStack = 0x63; - this.alpha = 50; - this.width = 10; - this.height = 14; - this.value = 0x3a98; - } - else if (this.type == 180) - { - this.name = "Topaz"; - this.maxStack = 0x63; - this.alpha = 50; - this.width = 10; - this.height = 14; - this.value = 0x1388; - } - else if (this.type == 0xb5) - { - this.name = "Amethyst"; - this.maxStack = 0x63; - this.alpha = 50; - this.width = 10; - this.height = 14; - this.value = 0x9c4; - } - else if (this.type == 0xb6) - { - this.name = "Diamond"; - this.maxStack = 0x63; - this.alpha = 50; - this.width = 10; - this.height = 14; - this.value = 0x9c40; - } - else if (this.type == 0xb7) - { - this.name = "Glowing Mushroom"; - this.useStyle = 2; - this.useSound = 2; - this.useTurn = false; - this.useAnimation = 0x11; - this.useTime = 0x11; - this.width = 0x10; - this.height = 0x12; - this.healLife = 50; - this.maxStack = 0x63; - this.consumable = true; - this.potion = true; - this.value = 50; - } - else if (this.type == 0xb8) - { - this.name = "Star"; - this.width = 12; - this.height = 12; - } - else if (this.type == 0xb9) - { - this.noUseGraphic = true; - this.damage = 0; - this.knockBack = 7f; - this.useStyle = 5; - this.name = "Ivy Whip"; - this.shootSpeed = 13f; - this.shoot = 0x20; - this.width = 0x12; - this.height = 0x1c; - this.useSound = 1; - this.useAnimation = 20; - this.useTime = 20; - this.rare = 3; - this.noMelee = true; - this.value = 0x4e20; - } - else if (this.type == 0xba) - { - this.name = "Breathing Reed"; - this.width = 0x2c; - this.height = 0x2c; - this.rare = 1; - this.value = 0x2710; - this.holdStyle = 2; - } - else if (this.type == 0xbb) - { - this.name = "Flipper"; - this.width = 0x1c; - this.height = 0x1c; - this.rare = 1; - this.value = 0x2710; - this.accessory = true; - this.toolTip = "Grants the ability to swim"; - } - else if (this.type == 0xbc) - { - this.name = "Healing Potion"; - this.useSound = 3; - this.healLife = 200; - this.useStyle = 2; - this.useTurn = true; - this.useAnimation = 0x11; - this.useTime = 0x11; - this.maxStack = 30; - this.consumable = true; - this.width = 14; - this.height = 0x18; - this.rare = 1; - this.potion = true; - this.value = 0x3e8; - } - else if (this.type == 0xbd) - { - this.name = "Mana Potion"; - this.useSound = 3; - this.healMana = 200; - this.useStyle = 2; - this.useTurn = true; - this.useAnimation = 0x11; - this.useTime = 0x11; - this.maxStack = 30; - this.consumable = true; - this.width = 14; - this.height = 0x18; - this.rare = 1; - this.potion = true; - this.value = 0x3e8; - } - else if (this.type == 190) - { - this.name = "Blade of Grass"; - this.useStyle = 1; - this.useAnimation = 30; - this.knockBack = 3f; - this.width = 40; - this.height = 40; - this.damage = 0x1c; - this.scale = 1.4f; - this.useSound = 1; - this.rare = 3; - this.value = 0x6978; - } - else if (this.type == 0xbf) - { - this.noMelee = true; - this.useStyle = 1; - this.name = "Thorn Chakrum"; - this.shootSpeed = 11f; - this.shoot = 0x21; - this.damage = 0x19; - this.knockBack = 8f; - this.width = 14; - this.height = 0x1c; - this.useSound = 1; - this.useAnimation = 15; - this.useTime = 15; - this.noUseGraphic = true; - this.rare = 3; - this.value = 0xc350; - } - else if (this.type == 0xc0) - { - this.name = "Obsidian Brick"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createTile = 0x4b; - this.width = 12; - this.height = 12; - } - else if (this.type == 0xc1) - { - this.name = "Obsidian Skull"; - this.width = 20; - this.height = 0x16; - this.rare = 2; - this.value = 0x6978; - this.accessory = true; - this.defense = 2; - this.toolTip = "Grants immunity to fire blocks"; - } - else if (this.type == 0xc2) - { - this.name = "Mushroom Grass Seeds"; - this.useTurn = true; - this.useStyle = 1; - this.useAnimation = 15; - this.useTime = 10; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 70; - this.width = 14; - this.height = 14; - this.value = 150; - } - else if (this.type == 0xc3) - { - this.name = "Jungle Grass Seeds"; - this.useTurn = true; - this.useStyle = 1; - this.useAnimation = 15; - this.useTime = 10; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 60; - this.width = 14; - this.height = 14; - this.value = 150; - } - else if (this.type == 0xc4) - { - this.name = "Wooden Hammer"; - this.autoReuse = true; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 0x25; - this.useTime = 0x19; - this.hammer = 0x19; - this.width = 0x18; - this.height = 0x1c; - this.damage = 2; - this.knockBack = 5.5f; - this.scale = 1.2f; - this.useSound = 1; - this.tileBoost = -1; - this.value = 50; - } - else if (this.type == 0xc5) - { - this.autoReuse = true; - this.useStyle = 5; - this.useAnimation = 12; - this.useTime = 12; - this.name = "Star Cannon"; - this.width = 50; - this.height = 0x12; - this.shoot = 12; - this.useAmmo = 15; - this.useSound = 9; - this.damage = 0x4b; - this.shootSpeed = 14f; - this.noMelee = true; - this.value = 0x7a120; - this.rare = 2; - this.toolTip = "Shoots fallen stars"; - } - else if (this.type == 0xc6) - { - this.name = "Blue Phaseblade"; - this.useStyle = 1; - this.useAnimation = 0x19; - this.knockBack = 3f; - this.width = 40; - this.height = 40; - this.damage = 0x15; - this.scale = 1f; - this.useSound = 15; - this.rare = 1; - this.value = 0x6978; - } - else if (this.type == 0xc7) - { - this.name = "Red Phaseblade"; - this.useStyle = 1; - this.useAnimation = 0x19; - this.knockBack = 3f; - this.width = 40; - this.height = 40; - this.damage = 0x15; - this.scale = 1f; - this.useSound = 15; - this.rare = 1; - this.value = 0x6978; - } - else if (this.type == 200) - { - this.name = "Green Phaseblade"; - this.useStyle = 1; - this.useAnimation = 0x19; - this.knockBack = 3f; - this.width = 40; - this.height = 40; - this.damage = 0x15; - this.scale = 1f; - this.useSound = 15; - this.rare = 1; - this.value = 0x6978; - } - else if (this.type == 0xc9) - { - this.name = "Purple Phaseblade"; - this.useStyle = 1; - this.useAnimation = 0x19; - this.knockBack = 3f; - this.width = 40; - this.height = 40; - this.damage = 0x15; - this.scale = 1f; - this.useSound = 15; - this.rare = 1; - this.value = 0x6978; - } - else if (this.type == 0xca) - { - this.name = "White Phaseblade"; - this.useStyle = 1; - this.useAnimation = 0x19; - this.knockBack = 3f; - this.width = 40; - this.height = 40; - this.damage = 0x15; - this.scale = 1f; - this.useSound = 15; - this.rare = 1; - this.value = 0x6978; - } - else if (this.type == 0xcb) - { - this.name = "Yellow Phaseblade"; - this.useStyle = 1; - this.useAnimation = 0x19; - this.knockBack = 3f; - this.width = 40; - this.height = 40; - this.damage = 0x15; - this.scale = 1f; - this.useSound = 15; - this.rare = 1; - this.value = 0x6978; - } - else if (this.type == 0xcc) - { - this.name = "Meteor Hamaxe"; - this.useTurn = true; - this.autoReuse = true; - this.useStyle = 1; - this.useAnimation = 30; - this.useTime = 0x10; - this.hammer = 60; - this.axe = 20; - this.width = 0x18; - this.height = 0x1c; - this.damage = 20; - this.knockBack = 7f; - this.scale = 1.2f; - this.useSound = 1; - this.rare = 1; - this.value = 0x3a98; - } - else if (this.type == 0xcd) - { - this.name = "Empty Bucket"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.width = 20; - this.height = 20; - } - else if (this.type == 0xce) - { - this.name = "Water Bucket"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.width = 20; - this.height = 20; - } - else if (this.type == 0xcf) - { - this.name = "Lava Bucket"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.width = 20; - this.height = 20; - } - else if (this.type == 0xd0) - { - this.name = "Jungle Rose"; - this.width = 20; - this.height = 20; - this.maxStack = 0x63; - this.value = 100; - } - else if (this.type == 0xd1) - { - this.name = "Stinger"; - this.width = 0x10; - this.height = 0x12; - this.maxStack = 0x63; - this.value = 200; - } - else if (this.type == 210) - { - this.name = "Vine"; - this.width = 14; - this.height = 20; - this.maxStack = 0x63; - this.value = 0x3e8; - } - else if (this.type == 0xd3) - { - this.name = "Feral Claws"; - this.width = 20; - this.height = 20; - this.accessory = true; - this.rare = 3; - this.toolTip = "10 % increased melee speed"; - this.value = 0xc350; - } - else if (this.type == 0xd4) - { - this.name = "Anklet of the Wind"; - this.width = 20; - this.height = 20; - this.accessory = true; - this.rare = 3; - this.toolTip = "10% increased movement speed"; - this.value = 0xc350; - } - if (this.type == 0xd5) - { - this.name = "Staff of Regrowth"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 20; - this.useTime = 13; - this.autoReuse = true; - this.width = 0x18; - this.height = 0x1c; - this.damage = 20; - this.createTile = 2; - this.scale = 1.2f; - this.useSound = 1; - this.knockBack = 3f; - this.rare = 3; - this.value = 0x7d0; - this.toolTip = "Creates grass on dirt"; - } - else if (this.type == 0xd6) - { - this.name = "Hellstone Brick"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 250; - this.consumable = true; - this.createTile = 0x4c; - this.width = 12; - this.height = 12; - } - else if (this.type == 0xd7) - { - this.name = "Whoopie Cushion"; - this.width = 0x12; - this.height = 0x12; - this.useTurn = true; - this.useTime = 30; - this.useAnimation = 30; - this.noUseGraphic = true; - this.useStyle = 10; - this.useSound = 0x10; - this.rare = 2; - this.toolTip = "May annoy others"; - this.value = 100; - } - else if (this.type == 0xd8) - { - this.name = "Shackle"; - this.width = 20; - this.height = 20; - this.rare = 1; - this.value = 0x5dc; - this.accessory = true; - this.defense = 1; - } - else if (this.type == 0xd9) - { - this.name = "Molten Hamaxe"; - this.useTurn = true; - this.autoReuse = true; - this.useStyle = 1; - this.useAnimation = 0x1b; - this.useTime = 14; - this.hammer = 70; - this.axe = 30; - this.width = 0x18; - this.height = 0x1c; - this.damage = 20; - this.knockBack = 7f; - this.scale = 1.4f; - this.useSound = 1; - this.rare = 3; - this.value = 0x3a98; - } - else if (this.type == 0xda) - { - this.mana = 20; - this.channel = true; - this.damage = 0x23; - this.useStyle = 1; - this.name = "Flamelash"; - this.shootSpeed = 6f; - this.shoot = 0x22; - this.width = 0x1a; - this.height = 0x1c; - this.useSound = 8; - this.useAnimation = 20; - this.useTime = 20; - this.rare = 3; - this.noMelee = true; - this.knockBack = 5f; - this.toolTip = "Summons a controllable ball of fire"; - this.value = 0x2710; - } - else if (this.type == 0xdb) - { - this.autoReuse = false; - this.useStyle = 5; - this.useAnimation = 10; - this.useTime = 10; - this.name = "Phoenix Blaster"; - this.width = 0x18; - this.height = 0x1c; - this.shoot = 14; - this.knockBack = 4f; - this.useAmmo = 14; - this.useSound = 11; - this.damage = 0x1c; - this.shootSpeed = 13f; - this.noMelee = true; - this.value = 0xc350; - this.scale = 0.9f; - this.rare = 3; - } - else if (this.type == 220) - { - this.name = "Sunfury"; - this.useStyle = 5; - this.useAnimation = 30; - this.useTime = 30; - this.knockBack = 7f; - this.width = 30; - this.height = 10; - this.damage = 40; - this.scale = 1.1f; - this.noUseGraphic = true; - this.shoot = 0x23; - this.shootSpeed = 12f; - this.useSound = 1; - this.rare = 3; - this.value = 0x6978; - } - else if (this.type == 0xdd) - { - this.name = "Hellforge"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 0x4d; - this.width = 0x1a; - this.height = 0x18; - this.value = 0xbb8; - } - else if (this.type == 0xde) - { - this.name = "Clay Pot"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.autoReuse = true; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 0x4e; - this.width = 14; - this.height = 14; - this.value = 100; - } - else if (this.type == 0xdf) - { - this.name = "Nature's Gift"; - this.width = 20; - this.height = 0x16; - this.rare = 3; - this.value = 0x6978; - this.accessory = true; - this.toolTip = "Spawn with max life and mana after death"; - } - else if (this.type == 0xe0) - { - this.name = "Bed"; - this.useStyle = 1; - this.useTurn = true; - this.useAnimation = 15; - this.useTime = 10; - this.maxStack = 0x63; - this.consumable = true; - this.createTile = 0x4f; - this.width = 0x1c; - this.height = 20; - this.value = 0x7d0; - } - else if (this.type == 0xe1) - { - this.name = "Silk"; - this.maxStack = 0x63; - this.width = 0x16; - this.height = 0x16; - this.value = 0x3e8; - } - else if (this.type == 0xe2) - { - this.name = "Lesser Restoration Potion"; - this.useSound = 3; - this.healMana = 100; - this.healLife = 100; - this.useStyle = 2; - this.useTurn = true; - this.useAnimation = 0x11; - this.useTime = 0x11; - this.maxStack = 20; - this.consumable = true; - this.width = 14; - this.height = 0x18; - this.potion = true; - this.value = 0x7d0; - } - else if (this.type == 0xe3) - { - this.name = "Restoration Potion"; - this.useSound = 3; - this.healMana = 200; - this.healLife = 200; - this.useStyle = 2; - this.useTurn = true; - this.useAnimation = 0x11; - this.useTime = 0x11; - this.maxStack = 20; - this.consumable = true; - this.width = 14; - this.height = 0x18; - this.potion = true; - this.value = 0xfa0; - } - else if (this.type == 0xe4) - { - this.name = "Cobalt Helmet"; - this.width = 0x16; - this.height = 0x16; - this.defense = 6; - this.headSlot = 8; - this.rare = 3; - this.value = 0xafc8; - this.toolTip = "Slowly regenerates mana"; - this.manaRegen = 4; - } - else if (this.type == 0xe5) - { - this.name = "Cobalt Breastplate"; - this.width = 0x1a; - this.height = 0x1c; - this.defense = 7; - this.bodySlot = 8; - this.rare = 3; - this.value = 0x7530; - this.toolTip = "Slowly regenerates mana"; - this.manaRegen = 4; - } - else if (this.type == 230) - { - this.name = "Cobalt Greaves"; - this.width = 0x12; - this.height = 0x1c; - this.defense = 6; - this.legSlot = 8; - this.rare = 3; - this.value = 0x7530; - this.toolTip = "Slowly regenerates mana"; - this.manaRegen = 3; - } - else if (this.type == 0xe7) - { - this.name = "Molten Helmet"; - this.width = 0x16; - this.height = 0x16; - this.defense = 9; - this.headSlot = 9; - this.rare = 3; - this.value = 0xafc8; - } - else if (this.type == 0xe8) - { - this.name = "Molten Breastplate"; - this.width = 0x1a; - this.height = 0x1c; - this.defense = 10; - this.bodySlot = 9; - this.rare = 3; - this.value = 0x7530; - } - else if (this.type == 0xe9) - { - this.name = "Molten Greaves"; - this.width = 0x12; - this.height = 0x1c; - this.defense = 9; - this.legSlot = 9; - this.rare = 3; - this.value = 0x7530; - } - else if (this.type == 0xea) - { - this.name = "Meteor Shot"; - this.shootSpeed = 3f; - this.shoot = 0x24; - this.damage = 9; - this.width = 8; - this.height = 8; - this.maxStack = 250; - this.consumable = true; - this.ammo = 14; - this.knockBack = 1f; - this.value = 8; - this.rare = 1; - } - else if (this.type == 0xeb) - { - this.useStyle = 1; - this.name = "Sticky Bomb"; - this.shootSpeed = 5f; - this.shoot = 0x25; - this.width = 20; - this.height = 20; - this.maxStack = 20; - this.consumable = true; - this.useSound = 1; - this.useAnimation = 0x19; - this.useTime = 0x19; - this.noUseGraphic = true; - this.noMelee = true; - this.value = 500; - this.damage = 0; - this.toolTip = "Tossing may be difficult."; - } - } - - public void SetDefaults(string ItemName) - { - this.name = ""; - if (ItemName == "Gold Pickaxe") - { - this.SetDefaults(1); - this.color = new Color(210, 190, 0, 100); - this.useTime = 0x11; - this.pick = 0x37; - this.useAnimation = 20; - this.scale = 1.05f; - this.damage = 6; - this.value = 0x2710; - } - else if (ItemName == "Gold Broadsword") - { - this.SetDefaults(4); - this.color = new Color(210, 190, 0, 100); - this.useAnimation = 20; - this.damage = 13; - this.scale = 1.05f; - this.value = 0x2328; - } - else if (ItemName == "Gold Shortsword") - { - this.SetDefaults(6); - this.color = new Color(210, 190, 0, 100); - this.damage = 11; - this.useAnimation = 11; - this.scale = 0.95f; - this.value = 0x1b58; - } - else if (ItemName == "Gold Axe") - { - this.SetDefaults(10); - this.color = new Color(210, 190, 0, 100); - this.useTime = 0x12; - this.axe = 11; - this.useAnimation = 0x1a; - this.scale = 1.15f; - this.damage = 7; - this.value = 0x1f40; - } - else if (ItemName == "Gold Hammer") - { - this.SetDefaults(7); - this.color = new Color(210, 190, 0, 100); - this.useAnimation = 0x1c; - this.useTime = 0x17; - this.scale = 1.25f; - this.damage = 9; - this.hammer = 0x37; - this.value = 0x1f40; - } - else if (ItemName == "Gold Bow") - { - this.SetDefaults(0x63); - this.useAnimation = 0x1a; - this.useTime = 0x1a; - this.color = new Color(210, 190, 0, 100); - this.damage = 11; - this.value = 0x1b58; - } - else if (ItemName == "Silver Pickaxe") - { - this.SetDefaults(1); - this.color = new Color(180, 180, 180, 100); - this.useTime = 11; - this.pick = 0x2d; - this.useAnimation = 0x13; - this.scale = 1.05f; - this.damage = 6; - this.value = 0x1388; - } - else if (ItemName == "Silver Broadsword") - { - this.SetDefaults(4); - this.color = new Color(180, 180, 180, 100); - this.useAnimation = 0x15; - this.damage = 11; - this.value = 0x1194; - } - else if (ItemName == "Silver Shortsword") - { - this.SetDefaults(6); - this.color = new Color(180, 180, 180, 100); - this.damage = 9; - this.useAnimation = 12; - this.scale = 0.95f; - this.value = 0xdac; - } - else if (ItemName == "Silver Axe") - { - this.SetDefaults(10); - this.color = new Color(180, 180, 180, 100); - this.useTime = 0x12; - this.axe = 10; - this.useAnimation = 0x1a; - this.scale = 1.15f; - this.damage = 6; - this.value = 0xfa0; - } - else if (ItemName == "Silver Hammer") - { - this.SetDefaults(7); - this.color = new Color(180, 180, 180, 100); - this.useAnimation = 0x1d; - this.useTime = 0x13; - this.scale = 1.25f; - this.damage = 9; - this.hammer = 0x2d; - this.value = 0xfa0; - } - else if (ItemName == "Silver Bow") - { - this.SetDefaults(0x63); - this.useAnimation = 0x1b; - this.useTime = 0x1b; - this.color = new Color(180, 180, 180, 100); - this.damage = 10; - this.value = 0xdac; - } - else if (ItemName == "Copper Pickaxe") - { - this.SetDefaults(1); - this.color = new Color(180, 100, 0x2d, 80); - this.useTime = 15; - this.pick = 0x23; - this.useAnimation = 0x17; - this.scale = 0.9f; - this.tileBoost = -1; - this.value = 500; - } - else if (ItemName == "Copper Broadsword") - { - this.SetDefaults(4); - this.color = new Color(180, 100, 0x2d, 80); - this.useAnimation = 0x17; - this.damage = 8; - this.value = 450; - } - else if (ItemName == "Copper Shortsword") - { - this.SetDefaults(6); - this.color = new Color(180, 100, 0x2d, 80); - this.damage = 6; - this.useAnimation = 13; - this.scale = 0.8f; - this.value = 350; - } - else if (ItemName == "Copper Axe") - { - this.SetDefaults(10); - this.color = new Color(180, 100, 0x2d, 80); - this.useTime = 0x15; - this.axe = 8; - this.useAnimation = 30; - this.scale = 1f; - this.damage = 3; - this.tileBoost = -1; - this.value = 400; - } - else if (ItemName == "Copper Hammer") - { - this.SetDefaults(7); - this.color = new Color(180, 100, 0x2d, 80); - this.useAnimation = 0x21; - this.useTime = 0x17; - this.scale = 1.1f; - this.damage = 4; - this.hammer = 0x23; - this.tileBoost = -1; - this.value = 400; - } - else if (ItemName == "Copper Bow") - { - this.SetDefaults(0x63); - this.useAnimation = 0x1d; - this.useTime = 0x1d; - this.color = new Color(180, 100, 0x2d, 80); - this.damage = 8; - this.value = 350; - } - else if (ItemName != "") - { - for (int i = 0; i < 0xec; i++) - { - this.SetDefaults(i); - if (this.name == ItemName) - { - break; - } - if (i == 0xeb) - { - this.SetDefaults(0); - this.name = ""; - } - } - } - if (this.type != 0) - { - this.name = ItemName; - } - } - - public void UpdateItem(int i) - { - if (this.active) - { - if (Main.netMode == 0) - { - this.owner = Main.myPlayer; - } - float num = 0.1f; - float num2 = 7f; - if (this.wet) - { - num2 = 5f; - num = 0.08f; - } - Vector2 vector = (Vector2) (this.velocity * 0.5f); - if (this.ownTime > 0) - { - this.ownTime--; - } - else - { - this.ownIgnore = -1; - } - if (this.keepTime > 0) - { - this.keepTime--; - } - if (!this.beingGrabbed) - { - this.velocity.Y += num; - if (this.velocity.Y > num2) - { - this.velocity.Y = num2; - } - this.velocity.X *= 0.95f; - if ((this.velocity.X < 0.1) && (this.velocity.X > -0.1)) - { - this.velocity.X = 0f; - } - bool flag = Collision.LavaCollision(this.position, this.width, this.height); - if (flag) - { - this.lavaWet = true; - } - if (Collision.WetCollision(this.position, this.width, this.height)) - { - if (!this.wet) - { - if (this.wetCount == 0) - { - this.wetCount = 20; - if (!flag) - { - for (int j = 0; j < 10; j++) - { - Color newColor = new Color(); - int index = Dust.NewDust(new Vector2(this.position.X - 6f, (this.position.Y + (this.height / 2)) - 8f), this.width + 12, 0x18, 0x21, 0f, 0f, 0, newColor, 1f); - Main.dust[index].velocity.Y -= 4f; - Main.dust[index].velocity.X *= 2.5f; - Main.dust[index].scale = 1.3f; - Main.dust[index].alpha = 100; - Main.dust[index].noGravity = true; - } - Main.PlaySound(0x13, (int) this.position.X, (int) this.position.Y, 1); - } - else - { - for (int k = 0; k < 5; k++) - { - Color color2 = new Color(); - int num6 = Dust.NewDust(new Vector2(this.position.X - 6f, (this.position.Y + (this.height / 2)) - 8f), this.width + 12, 0x18, 0x23, 0f, 0f, 0, color2, 1f); - Main.dust[num6].velocity.Y -= 1.5f; - Main.dust[num6].velocity.X *= 2.5f; - Main.dust[num6].scale = 1.3f; - Main.dust[num6].alpha = 100; - Main.dust[num6].noGravity = true; - } - Main.PlaySound(0x13, (int) this.position.X, (int) this.position.Y, 1); - } - } - this.wet = true; - } - } - else if (this.wet) - { - this.wet = false; - } - if (!this.wet) - { - this.lavaWet = false; - } - if (this.wetCount > 0) - { - this.wetCount = (byte) (this.wetCount - 1); - } - if (this.wet) - { - if (this.wet) - { - Vector2 velocity = this.velocity; - this.velocity = Collision.TileCollision(this.position, this.velocity, this.width, this.height, false, false); - if (this.velocity.X != velocity.X) - { - vector.X = this.velocity.X; - } - if (this.velocity.Y != velocity.Y) - { - vector.Y = this.velocity.Y; - } - } - } - else - { - this.velocity = Collision.TileCollision(this.position, this.velocity, this.width, this.height, false, false); - } - if ((this.owner == Main.myPlayer) && this.lavaWet) - { - this.active = false; - this.type = 0; - this.name = ""; - this.stack = 0; - if (Main.netMode != 0) - { - NetMessage.SendData(0x15, -1, -1, "", i, 0f, 0f, 0f); - } - } - if ((this.type == 0x4b) && Main.dayTime) - { - for (int m = 0; m < 10; m++) - { - Color color5 = new Color(); - Dust.NewDust(this.position, this.width, this.height, 15, this.velocity.X, this.velocity.Y, 150, color5, 1.2f); - } - for (int n = 0; n < 3; n++) - { - Gore.NewGore(this.position, new Vector2(this.velocity.X, this.velocity.Y), Main.rand.Next(0x10, 0x12)); - } - this.active = false; - this.type = 0; - this.stack = 0; - if (Main.netMode == 2) - { - NetMessage.SendData(0x15, -1, -1, "", i, 0f, 0f, 0f); - } - } - } - else - { - this.beingGrabbed = false; - } - if (((this.type == 8) || (this.type == 0x29)) || (((this.type == 0x4b) || (this.type == 0x69)) || (this.type == 0x74))) - { - if (!this.wet) - { - Lighting.addLight((int) ((this.position.X - 7f) / 16f), (int) ((this.position.Y - 7f) / 16f), 1f); - } - } - else if (this.type == 0xb7) - { - Lighting.addLight((int) ((this.position.X - 7f) / 16f), (int) ((this.position.Y - 7f) / 16f), 0.5f); - } - if (this.type == 0x4b) - { - if (Main.rand.Next(0x19) == 0) - { - Dust.NewDust(this.position, this.width, this.height, 15, this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 150, new Color(), 1.2f); - } - if (Main.rand.Next(50) == 0) - { - Gore.NewGore(this.position, new Vector2(this.velocity.X * 0.2f, this.velocity.Y * 0.2f), Main.rand.Next(0x10, 0x12)); - } - } - if (this.spawnTime < 0x7ffffffe) - { - this.spawnTime++; - } - if ((Main.netMode == 2) && (this.owner != Main.myPlayer)) - { - this.release++; - if (this.release >= 300) - { - this.release = 0; - NetMessage.SendData(0x27, this.owner, -1, "", i, 0f, 0f, 0f); - } - } - if (this.wet) - { - this.position += vector; - } - else - { - this.position += this.velocity; - } - if (this.noGrabDelay > 0) - { - this.noGrabDelay--; - } - } - } - } -} - diff --git a/Terraria/Lighting.cs b/Terraria/Lighting.cs deleted file mode 100644 index bce22c98..00000000 --- a/Terraria/Lighting.cs +++ /dev/null @@ -1,395 +0,0 @@ -namespace Terraria -{ - using Microsoft.Xna.Framework; - using System; - - public class Lighting - { - public static float[,] color = new float[((Main.screenWidth / 0x10) + 0x2a) + 10, ((Main.screenHeight / 0x10) + 0x2a) + 10]; - private static int firstTileX; - private static int firstTileY; - private static int firstToLightX; - private static int firstToLightY; - private static int lastTileX; - private static int lastTileY; - private static int lastToLightX; - private static int lastToLightY; - private static float lightColor = 0f; - public static int lightCounter = 0; - public static int lightPasses = 2; - public static int lightSkip = 1; - private static int maxTempLights = 100; - public const int offScreenTiles = 0x15; - private static float[] tempLight = new float[maxTempLights]; - private static int tempLightCount; - private static int[] tempLightX = new int[maxTempLights]; - private static int[] tempLightY = new int[maxTempLights]; - - public static void addLight(int i, int j, float Lightness) - { - if ((tempLightCount != maxTempLights) && (((((i - firstTileX) + 0x15) >= 0) && (((i - firstTileX) + 0x15) < (((Main.screenWidth / 0x10) + 0x2a) + 10))) && ((((j - firstTileY) + 0x15) >= 0) && (((j - firstTileY) + 0x15) < (((Main.screenHeight / 0x10) + 0x2a) + 10))))) - { - for (int k = 0; k < tempLightCount; k++) - { - if (((tempLightX[k] == i) && (tempLightY[k] == j)) && (Lightness <= tempLight[k])) - { - return; - } - } - tempLightX[tempLightCount] = i; - tempLightY[tempLightCount] = j; - tempLight[tempLightCount] = Lightness; - tempLightCount++; - } - } - - public static float Brightness(int x, int y) - { - int num = (x - firstTileX) + 0x15; - int num2 = (y - firstTileY) + 0x15; - if (((num >= 0) && (num2 >= 0)) && ((num < (((Main.screenWidth / 0x10) + 0x2a) + 10)) && (num2 < (((Main.screenHeight / 0x10) + 0x2a) + 10)))) - { - return color[num, num2]; - } - return 0f; - } - - public static Color GetBlackness(int x, int y) - { - int num = (x - firstTileX) + 0x15; - int num2 = (y - firstTileY) + 0x15; - if (((num < 0) || (num2 < 0)) || ((num >= (((Main.screenWidth / 0x10) + 0x2a) + 10)) || (num2 >= (((Main.screenHeight / 0x10) + 0x2a) + 10)))) - { - return Color.Black; - } - return new Color(0, 0, 0, (byte) (255f - (255f * color[num, num2]))); - } - - public static Color GetColor(int x, int y) - { - int num = (x - firstTileX) + 0x15; - int num2 = (y - firstTileY) + 0x15; - if (((num < 0) || (num2 < 0)) || ((num >= (((Main.screenWidth / 0x10) + 0x2a) + 10)) || (num2 >= (((Main.screenHeight / 0x10) + 0x2a) + 10)))) - { - return Color.Black; - } - return new Color((byte) (255f * color[num, num2]), (byte) (255f * color[num, num2]), (byte) (255f * color[num, num2]), 0xff); - } - - public static Color GetColor(int x, int y, Color oldColor) - { - int num = (x - firstTileX) + 0x15; - int num2 = (y - firstTileY) + 0x15; - if (Main.gameMenu) - { - return oldColor; - } - if (((num < 0) || (num2 < 0)) || ((num >= (((Main.screenWidth / 0x10) + 0x2a) + 10)) || (num2 >= (((Main.screenHeight / 0x10) + 0x2a) + 10)))) - { - return Color.Black; - } - Color white = Color.White; - white.R = (byte) (oldColor.R * color[num, num2]); - white.G = (byte) (oldColor.G * color[num, num2]); - white.B = (byte) (oldColor.B * color[num, num2]); - return white; - } - - private static void LightColor(int i, int j) - { - int num = i - firstToLightX; - int num2 = j - firstToLightY; - try - { - if (color[num, num2] > lightColor) - { - lightColor = color[num, num2]; - } - else - { - if (lightColor == 0f) - { - return; - } - color[num, num2] = lightColor; - } - float num3 = 0.04f; - if (Main.tile[i, j].active && Main.tileBlockLight[Main.tile[i, j].type]) - { - num3 = 0.16f; - } - float num4 = lightColor - num3; - if (num4 < 0f) - { - lightColor = 0f; - } - else - { - lightColor -= num3; - if (((lightColor > 0f) && (!Main.tile[i, j].active || !Main.tileSolid[Main.tile[i, j].type])) && (j < Main.worldSurface)) - { - Main.tile[i, j].lighted = true; - } - } - } - catch - { - } - } - - public static int LightingX(int lightX) - { - if (lightX < 0) - { - return 0; - } - if (lightX >= (((Main.screenWidth / 0x10) + 0x2a) + 10)) - { - return ((((Main.screenWidth / 0x10) + 0x2a) + 10) - 1); - } - return lightX; - } - - public static int LightingY(int lightY) - { - if (lightY < 0) - { - return 0; - } - if (lightY >= (((Main.screenHeight / 0x10) + 0x2a) + 10)) - { - return ((((Main.screenHeight / 0x10) + 0x2a) + 10) - 1); - } - return lightY; - } - - public static void LightTiles(int firstX, int lastX, int firstY, int lastY) - { - firstTileX = firstX; - lastTileX = lastX; - firstTileY = firstY; - lastTileY = lastY; - lightCounter++; - if (lightCounter <= lightSkip) - { - tempLightCount = 0; - int num = ((Main.screenWidth / 0x10) + 0x2a) + 10; - int num2 = ((Main.screenHeight / 0x10) + 0x2a) + 10; - if (((int) (Main.screenPosition.X / 16f)) < ((int) (Main.screenLastPosition.X / 16f))) - { - for (int i = num - 1; i > 1; i--) - { - for (int j = 0; j < num2; j++) - { - color[i, j] = color[i - 1, j]; - } - } - } - else if (((int) (Main.screenPosition.X / 16f)) > ((int) (Main.screenLastPosition.X / 16f))) - { - for (int k = 0; k < (num - 1); k++) - { - for (int m = 0; m < num2; m++) - { - color[k, m] = color[k + 1, m]; - } - } - } - if (((int) (Main.screenPosition.Y / 16f)) < ((int) (Main.screenLastPosition.Y / 16f))) - { - for (int n = num2 - 1; n > 1; n--) - { - for (int num8 = 0; num8 < num; num8++) - { - color[num8, n] = color[num8, n - 1]; - } - } - } - else if (((int) (Main.screenPosition.Y / 16f)) > ((int) (Main.screenLastPosition.Y / 16f))) - { - for (int num9 = 0; num9 < (num2 - 1); num9++) - { - for (int num10 = 0; num10 < num; num10++) - { - color[num10, num9] = color[num10, num9 + 1]; - } - } - } - } - else - { - lightCounter = 0; - firstToLightX = firstTileX - 0x15; - firstToLightY = firstTileY - 0x15; - lastToLightX = lastTileX + 0x15; - lastToLightY = lastTileY + 0x15; - for (int num11 = 0; num11 < (((Main.screenWidth / 0x10) + 0x2a) + 10); num11++) - { - for (int num12 = 0; num12 < (((Main.screenHeight / 0x10) + 0x2a) + 10); num12++) - { - color[num11, num12] = 0f; - } - } - for (int num13 = 0; num13 < tempLightCount; num13++) - { - if (((((tempLightX[num13] - firstTileX) + 0x15) >= 0) && (((tempLightX[num13] - firstTileX) + 0x15) < (((Main.screenWidth / 0x10) + 0x2a) + 10))) && ((((tempLightY[num13] - firstTileY) + 0x15) >= 0) && (((tempLightY[num13] - firstTileY) + 0x15) < (((Main.screenHeight / 0x10) + 0x2a) + 10)))) - { - color[(tempLightX[num13] - firstTileX) + 0x15, (tempLightY[num13] - firstTileY) + 0x15] = tempLight[num13]; - } - } - tempLightCount = 0; - Main.evilTiles = 0; - Main.meteorTiles = 0; - Main.jungleTiles = 0; - Main.dungeonTiles = 0; - for (int num14 = firstToLightX; num14 < lastToLightX; num14++) - { - for (int num15 = firstToLightY; num15 < lastToLightY; num15++) - { - if (((num14 >= 0) && (num14 < Main.maxTilesX)) && ((num15 >= 0) && (num15 < Main.maxTilesY))) - { - if (Main.tile[num14, num15] == null) - { - Main.tile[num14, num15] = new Tile(); - } - if (Main.tile[num14, num15].active) - { - if (((Main.tile[num14, num15].type == 0x17) || (Main.tile[num14, num15].type == 0x18)) || ((Main.tile[num14, num15].type == 0x19) || (Main.tile[num14, num15].type == 0x20))) - { - Main.evilTiles++; - } - else if (Main.tile[num14, num15].type == 0x1b) - { - Main.evilTiles -= 5; - } - else if (Main.tile[num14, num15].type == 0x25) - { - Main.meteorTiles++; - } - else if (Main.tileDungeon[Main.tile[num14, num15].type]) - { - Main.dungeonTiles++; - } - else if ((Main.tile[num14, num15].type == 60) || (Main.tile[num14, num15].type == 0x3d)) - { - Main.jungleTiles++; - } - } - if (Main.tile[num14, num15] == null) - { - Main.tile[num14, num15] = new Tile(); - } - if (Main.lightTiles) - { - color[(num14 - firstTileX) + 0x15, (num15 - firstTileY) + 0x15] = ((float) Main.tileColor.R) / 255f; - } - if (Main.tile[num14, num15].lava) - { - float num16 = ((Main.tile[num14, num15].liquid / 0xff) * 0.6f) + 0.1f; - if (color[num14 - firstToLightX, num15 - firstToLightY] < num16) - { - color[num14 - firstToLightX, num15 - firstToLightY] = num16; - } - } - if ((((!Main.tile[num14, num15].active || !Main.tileSolid[Main.tile[num14, num15].type]) || ((Main.tile[num14, num15].type == 0x25) || (Main.tile[num14, num15].type == 0x3a))) || ((Main.tile[num14, num15].type == 70) || (Main.tile[num14, num15].type == 0x4c))) && ((((Main.tile[num14, num15].lighted || (Main.tile[num14, num15].type == 4)) || ((Main.tile[num14, num15].type == 0x11) || (Main.tile[num14, num15].type == 0x1f))) || (((Main.tile[num14, num15].type == 0x21) || (Main.tile[num14, num15].type == 0x22)) || ((Main.tile[num14, num15].type == 0x23) || (Main.tile[num14, num15].type == 0x24)))) || (((((Main.tile[num14, num15].type == 0x25) || (Main.tile[num14, num15].type == 0x2a)) || ((Main.tile[num14, num15].type == 0x31) || (Main.tile[num14, num15].type == 0x3a))) || (((Main.tile[num14, num15].type == 0x3d) || (Main.tile[num14, num15].type == 70)) || ((Main.tile[num14, num15].type == 0x47) || (Main.tile[num14, num15].type == 0x48)))) || (((Main.tile[num14, num15].type == 0x4c) || (Main.tile[num14, num15].type == 0x4d)) || ((Main.tile[num14, num15].type == 0x13) || (Main.tile[num14, num15].type == 0x1a)))))) - { - if (((((color[num14 - firstToLightX, num15 - firstToLightY] * 255f) < Main.tileColor.R) && (Main.tileColor.R > (color[num14 - firstToLightX, num15 - firstToLightY] * 255f))) && ((Main.tile[num14, num15].wall == 0) && (num15 < Main.worldSurface))) && (Main.tile[num14, num15].liquid < 0xff)) - { - color[num14 - firstToLightX, num15 - firstToLightY] = ((float) Main.tileColor.R) / 255f; - } - if (((Main.tile[num14, num15].type == 4) || (Main.tile[num14, num15].type == 0x21)) || (((Main.tile[num14, num15].type == 0x22) || (Main.tile[num14, num15].type == 0x23)) || (Main.tile[num14, num15].type == 0x24))) - { - color[num14 - firstToLightX, num15 - firstToLightY] = 1f; - } - else if ((Main.tile[num14, num15].type == 0x11) && (color[num14 - firstToLightX, num15 - firstToLightY] < 0.8f)) - { - color[num14 - firstToLightX, num15 - firstToLightY] = 0.8f; - } - else if ((Main.tile[num14, num15].type == 0x4d) && (color[num14 - firstToLightX, num15 - firstToLightY] < 0.8f)) - { - color[num14 - firstToLightX, num15 - firstToLightY] = 0.8f; - } - else if ((Main.tile[num14, num15].type == 0x25) && (color[num14 - firstToLightX, num15 - firstToLightY] < 0.6f)) - { - color[num14 - firstToLightX, num15 - firstToLightY] = 0.6f; - } - else if ((Main.tile[num14, num15].type == 0x3a) && (color[num14 - firstToLightX, num15 - firstToLightY] < 0.6f)) - { - color[num14 - firstToLightX, num15 - firstToLightY] = 0.6f; - } - else if ((Main.tile[num14, num15].type == 0x4c) && (color[num14 - firstToLightX, num15 - firstToLightY] < 0.6f)) - { - color[num14 - firstToLightX, num15 - firstToLightY] = 0.6f; - } - else if ((Main.tile[num14, num15].type == 0x2a) && (color[num14 - firstToLightX, num15 - firstToLightY] < 0.75f)) - { - color[num14 - firstToLightX, num15 - firstToLightY] = 0.75f; - } - else if ((Main.tile[num14, num15].type == 0x31) && (color[num14 - firstToLightX, num15 - firstToLightY] < 0.75f)) - { - color[num14 - firstToLightX, num15 - firstToLightY] = 0.75f; - } - else if (((Main.tile[num14, num15].type == 70) || (Main.tile[num14, num15].type == 0x47)) || (Main.tile[num14, num15].type == 0x48)) - { - float num17 = Main.rand.Next(0x30, 0x34) * 0.01f; - if (color[num14 - firstToLightX, num15 - firstToLightY] < num17) - { - color[num14 - firstToLightX, num15 - firstToLightY] = num17; - } - } - else if (((Main.tile[num14, num15].type == 0x3d) && (Main.tile[num14, num15].frameX == 0x90)) && (color[num14 - firstToLightX, num15 - firstToLightY] < 0.75f)) - { - color[num14 - firstToLightX, num15 - firstToLightY] = 0.75f; - } - else if ((Main.tile[num14, num15].type == 0x1f) || (Main.tile[num14, num15].type == 0x1a)) - { - float num18 = Main.rand.Next(-5, 6) * 0.01f; - if (color[num14 - firstToLightX, num15 - firstToLightY] < (0.4f + num18)) - { - color[num14 - firstToLightX, num15 - firstToLightY] = 0.4f + num18; - } - } - } - } - } - } - for (int num19 = 0; num19 < lightPasses; num19++) - { - for (int num20 = firstToLightX; num20 < lastToLightX; num20++) - { - lightColor = 0f; - for (int num21 = firstToLightY; num21 < lastToLightY; num21++) - { - LightColor(num20, num21); - } - } - for (int num22 = firstToLightX; num22 < lastToLightX; num22++) - { - lightColor = 0f; - for (int num23 = lastToLightY; num23 >= firstToLightY; num23--) - { - LightColor(num22, num23); - } - } - for (int num24 = firstToLightY; num24 < lastToLightY; num24++) - { - lightColor = 0f; - for (int num25 = firstToLightX; num25 < lastToLightX; num25++) - { - LightColor(num25, num24); - } - } - for (int num26 = firstToLightY; num26 < lastToLightY; num26++) - { - lightColor = 0f; - for (int num27 = lastToLightX; num27 >= firstToLightX; num27--) - { - LightColor(num27, num26); - } - } - } - } - } - } -} - diff --git a/Terraria/Liquid.cs b/Terraria/Liquid.cs deleted file mode 100644 index 411da496..00000000 --- a/Terraria/Liquid.cs +++ /dev/null @@ -1,947 +0,0 @@ -namespace Terraria -{ - using System; - using System.Runtime.InteropServices; - - public class Liquid - { - public static int cycles = 10; - public int delay; - public int kill; - public static int maxLiquid = 0x1388; - public static int numLiquid; - public static int panicCounter = 0; - public static bool panicMode = false; - public static int panicY = 0; - public static bool quickFall = false; - public static bool quickSettle = false; - public static int resLiquid = 0x1388; - public static int skipCount = 0; - public static bool stuck = false; - public static int stuckAmount = 0; - public static int stuckCount = 0; - private static int wetCounter; - public int x; - public int y; - - public static void AddWater(int x, int y) - { - if ((((!Main.tile[x, y].checkingLiquid && ((x < (Main.maxTilesX - 5)) && (y < (Main.maxTilesY - 5)))) && ((x >= 5) && (y >= 5))) && (Main.tile[x, y] != null)) && (Main.tile[x, y].liquid != 0)) - { - if (numLiquid >= (maxLiquid - 1)) - { - LiquidBuffer.AddBuffer(x, y); - } - else - { - Main.tile[x, y].checkingLiquid = true; - Main.liquid[numLiquid].kill = 0; - Main.liquid[numLiquid].x = x; - Main.liquid[numLiquid].y = y; - Main.liquid[numLiquid].delay = 0; - Main.tile[x, y].skipLiquid = false; - numLiquid++; - if (Main.netMode == 2) - { - NetMessage.sendWater(x, y); - } - if (Main.tile[x, y].active && (Main.tileWaterDeath[Main.tile[x, y].type] || (Main.tile[x, y].lava && Main.tileLavaDeath[Main.tile[x, y].type]))) - { - if (WorldGen.gen) - { - Main.tile[x, y].active = false; - } - else - { - WorldGen.KillTile(x, y, false, false, false); - if (Main.netMode == 2) - { - NetMessage.SendData(0x11, -1, -1, "", 0, (float) x, (float) y, 0f); - } - } - } - } - } - } - - public static void DelWater(int l) - { - int x = Main.liquid[l].x; - int y = Main.liquid[l].y; - if (Main.tile[x, y].liquid < 2) - { - Main.tile[x, y].liquid = 0; - } - else if (Main.tile[x, y].liquid < 20) - { - if ((((Main.tile[x - 1, y].liquid < Main.tile[x, y].liquid) && ((!Main.tile[x - 1, y].active || !Main.tileSolid[Main.tile[x - 1, y].type]) || Main.tileSolidTop[Main.tile[x - 1, y].type])) || ((Main.tile[x + 1, y].liquid < Main.tile[x, y].liquid) && ((!Main.tile[x + 1, y].active || !Main.tileSolid[Main.tile[x + 1, y].type]) || Main.tileSolidTop[Main.tile[x + 1, y].type]))) || ((Main.tile[x, y + 1].liquid < 0xff) && ((!Main.tile[x, y + 1].active || !Main.tileSolid[Main.tile[x, y + 1].type]) || Main.tileSolidTop[Main.tile[x, y + 1].type]))) - { - Main.tile[x, y].liquid = 0; - } - } - else if (((Main.tile[x, y + 1].liquid < 0xff) && ((!Main.tile[x, y + 1].active || !Main.tileSolid[Main.tile[x, y + 1].type]) || Main.tileSolidTop[Main.tile[x, y + 1].type])) && !stuck) - { - Main.liquid[l].kill = 0; - return; - } - if (Main.tile[x, y].liquid == 0) - { - Main.tile[x, y].lava = false; - } - else if (Main.tile[x, y].lava) - { - LavaCheck(x, y); - } - if (Main.netMode == 2) - { - NetMessage.sendWater(x, y); - } - numLiquid--; - Main.tile[Main.liquid[l].x, Main.liquid[l].y].checkingLiquid = false; - Main.liquid[l].x = Main.liquid[numLiquid].x; - Main.liquid[l].y = Main.liquid[numLiquid].y; - Main.liquid[l].kill = Main.liquid[numLiquid].kill; - } - - public static void LavaCheck(int x, int y) - { - if ((((Main.tile[x - 1, y].liquid > 0) && !Main.tile[x - 1, y].lava) || ((Main.tile[x + 1, y].liquid > 0) && !Main.tile[x + 1, y].lava)) || ((Main.tile[x, y - 1].liquid > 0) && !Main.tile[x, y - 1].lava)) - { - int num = 0; - if (!Main.tile[x - 1, y].lava) - { - num += Main.tile[x - 1, y].liquid; - Main.tile[x - 1, y].liquid = 0; - } - if (!Main.tile[x + 1, y].lava) - { - num += Main.tile[x + 1, y].liquid; - Main.tile[x + 1, y].liquid = 0; - } - if (!Main.tile[x, y - 1].lava) - { - num += Main.tile[x, y - 1].liquid; - Main.tile[x, y - 1].liquid = 0; - } - if (num >= 0x80) - { - Main.tile[x, y].liquid = 0; - Main.tile[x, y].lava = false; - WorldGen.PlaceTile(x, y, 0x38, true, true, -1); - WorldGen.SquareTileFrame(x, y, true); - if (Main.netMode == 2) - { - NetMessage.SendTileSquare(-1, x - 1, y - 1, 3); - } - } - } - else if ((Main.tile[x, y + 1].liquid > 0) && !Main.tile[x, y + 1].lava) - { - Main.tile[x, y].liquid = 0; - Main.tile[x, y].lava = false; - WorldGen.PlaceTile(x, y + 1, 0x38, true, true, -1); - WorldGen.SquareTileFrame(x, y, true); - if (Main.netMode == 2) - { - NetMessage.SendTileSquare(-1, x - 1, y, 3); - } - } - } - - public static void NetAddWater(int x, int y) - { - if (((((x < (Main.maxTilesX - 5)) && (y < (Main.maxTilesY - 5))) && ((x >= 5) && (y >= 5))) && (Main.tile[x, y] != null)) && (Main.tile[x, y].liquid != 0)) - { - for (int i = 0; i < numLiquid; i++) - { - if ((Main.liquid[i].x == x) && (Main.liquid[i].y == y)) - { - Main.liquid[i].kill = 0; - Main.tile[x, y].skipLiquid = true; - return; - } - } - if (numLiquid >= (maxLiquid - 1)) - { - LiquidBuffer.AddBuffer(x, y); - } - else - { - Main.tile[x, y].checkingLiquid = true; - Main.tile[x, y].skipLiquid = true; - Main.liquid[numLiquid].kill = 0; - Main.liquid[numLiquid].x = x; - Main.liquid[numLiquid].y = y; - numLiquid++; - if (Main.netMode == 2) - { - NetMessage.sendWater(x, y); - } - if (Main.tile[x, y].active && (Main.tileWaterDeath[Main.tile[x, y].type] || (Main.tile[x, y].lava && Main.tileLavaDeath[Main.tile[x, y].type]))) - { - WorldGen.KillTile(x, y, false, false, false); - if (Main.netMode == 2) - { - NetMessage.SendData(0x11, -1, -1, "", 0, (float) x, (float) y, 0f); - } - } - } - } - } - - public static double QuickWater(int verbose = 0, int minY = -1, int maxY = -1) - { - int num = 0; - if (minY == -1) - { - minY = 3; - } - if (maxY == -1) - { - maxY = Main.maxTilesY - 3; - } - for (int i = maxY; i >= minY; i--) - { - if (verbose > 0) - { - float num3 = ((float) (maxY - i)) / ((float) ((maxY - minY) + 1)); - num3 /= (float) verbose; - Main.statusText = "Settling liquids: " + ((int) ((num3 * 100f) + 1f)) + "%"; - } - else if (verbose < 0) - { - float num4 = ((float) (maxY - i)) / ((float) ((maxY - minY) + 1)); - num4 /= (float) -verbose; - Main.statusText = "Creating underworld: " + ((int) ((num4 * 100f) + 1f)) + "%"; - } - for (int j = 0; j < 2; j++) - { - int num6 = 2; - int num7 = Main.maxTilesX - 2; - int num8 = 1; - if (j == 1) - { - num6 = Main.maxTilesX - 2; - num7 = 2; - num8 = -1; - } - for (int k = num6; k != num7; k += num8) - { - if (Main.tile[k, i].liquid <= 0) - { - continue; - } - int num10 = -num8; - bool flag = false; - int x = k; - int y = i; - bool lava = Main.tile[k, i].lava; - byte liquid = Main.tile[k, i].liquid; - Main.tile[k, i].liquid = 0; - bool flag3 = true; - int num14 = 0; - while ((flag3 && (x > 3)) && ((x < (Main.maxTilesX - 3)) && (y < (Main.maxTilesY - 3)))) - { - flag3 = false; - while (((Main.tile[x, y + 1].liquid == 0) && (y < (Main.maxTilesY - 5))) && ((!Main.tile[x, y + 1].active || !Main.tileSolid[Main.tile[x, y + 1].type]) || Main.tileSolidTop[Main.tile[x, y + 1].type])) - { - flag = true; - num10 = num8; - num14 = 0; - flag3 = true; - y++; - if (y > WorldGen.waterLine) - { - lava = true; - } - } - if (((Main.tile[x, y + 1].liquid > 0) && (Main.tile[x, y + 1].liquid < 0xff)) && (Main.tile[x, y + 1].lava == lava)) - { - int num15 = 0xff - Main.tile[x, y + 1].liquid; - if (num15 > liquid) - { - num15 = liquid; - } - Tile tile1 = Main.tile[x, y + 1]; - tile1.liquid = (byte) (tile1.liquid + ((byte) num15)); - liquid = (byte) (liquid - ((byte) num15)); - if (liquid <= 0) - { - num++; - break; - } - } - if (num14 == 0) - { - if ((Main.tile[x + num10, y].liquid == 0) && ((!Main.tile[x + num10, y].active || !Main.tileSolid[Main.tile[x + num10, y].type]) || Main.tileSolidTop[Main.tile[x + num10, y].type])) - { - num14 = num10; - } - else if ((Main.tile[x - num10, y].liquid == 0) && ((!Main.tile[x - num10, y].active || !Main.tileSolid[Main.tile[x - num10, y].type]) || Main.tileSolidTop[Main.tile[x - num10, y].type])) - { - num14 = -num10; - } - } - if (((num14 != 0) && (Main.tile[x + num14, y].liquid == 0)) && ((!Main.tile[x + num14, y].active || !Main.tileSolid[Main.tile[x + num14, y].type]) || Main.tileSolidTop[Main.tile[x + num14, y].type])) - { - flag3 = true; - x += num14; - } - if (flag && !flag3) - { - flag = false; - flag3 = true; - num10 = -num8; - num14 = 0; - } - } - if ((k != x) && (i != y)) - { - num++; - } - Main.tile[x, y].liquid = liquid; - Main.tile[x, y].lava = lava; - if ((Main.tile[x - 1, y].liquid > 0) && (Main.tile[x - 1, y].lava != lava)) - { - if (lava) - { - LavaCheck(x, y); - } - else - { - LavaCheck(x - 1, y); - } - } - else if ((Main.tile[x + 1, y].liquid > 0) && (Main.tile[x + 1, y].lava != lava)) - { - if (lava) - { - LavaCheck(x, y); - } - else - { - LavaCheck(x + 1, y); - } - } - else if ((Main.tile[x, y - 1].liquid > 0) && (Main.tile[x, y - 1].lava != lava)) - { - if (lava) - { - LavaCheck(x, y); - } - else - { - LavaCheck(x, y - 1); - } - } - else if ((Main.tile[x, y + 1].liquid > 0) && (Main.tile[x, y + 1].lava != lava)) - { - if (lava) - { - LavaCheck(x, y); - } - else - { - LavaCheck(x, y + 1); - } - } - } - } - } - return (double) num; - } - - public void Update() - { - if ((Main.tile[this.x, this.y].active && Main.tileSolid[Main.tile[this.x, this.y].type]) && !Main.tileSolidTop[Main.tile[this.x, this.y].type]) - { - if (Main.tile[this.x, this.y].type != 10) - { - Main.tile[this.x, this.y].liquid = 0; - } - this.kill = 9; - } - else - { - byte liquid = Main.tile[this.x, this.y].liquid; - float num2 = 0f; - if (Main.tile[this.x, this.y].liquid == 0) - { - this.kill = 9; - } - else - { - if (Main.tile[this.x, this.y].lava) - { - LavaCheck(this.x, this.y); - if (!quickFall) - { - if (this.delay < 5) - { - this.delay++; - return; - } - this.delay = 0; - } - } - else - { - if (Main.tile[this.x - 1, this.y].lava) - { - AddWater(this.x - 1, this.y); - } - if (Main.tile[this.x + 1, this.y].lava) - { - AddWater(this.x + 1, this.y); - } - if (Main.tile[this.x, this.y - 1].lava) - { - AddWater(this.x, this.y - 1); - } - if (Main.tile[this.x, this.y + 1].lava) - { - AddWater(this.x, this.y + 1); - } - } - if ((((!Main.tile[this.x, this.y + 1].active || !Main.tileSolid[Main.tile[this.x, this.y + 1].type]) || Main.tileSolidTop[Main.tile[this.x, this.y + 1].type]) && ((Main.tile[this.x, this.y + 1].liquid <= 0) || (Main.tile[this.x, this.y + 1].lava == Main.tile[this.x, this.y].lava))) && (Main.tile[this.x, this.y + 1].liquid < 0xff)) - { - num2 = 0xff - Main.tile[this.x, this.y + 1].liquid; - if (num2 > Main.tile[this.x, this.y].liquid) - { - num2 = Main.tile[this.x, this.y].liquid; - } - Tile tile1 = Main.tile[this.x, this.y]; - tile1.liquid = (byte) (tile1.liquid - ((byte) num2)); - Tile tile2 = Main.tile[this.x, this.y + 1]; - tile2.liquid = (byte) (tile2.liquid + ((byte) num2)); - Main.tile[this.x, this.y + 1].lava = Main.tile[this.x, this.y].lava; - AddWater(this.x, this.y + 1); - Main.tile[this.x, this.y + 1].skipLiquid = true; - Main.tile[this.x, this.y].skipLiquid = true; - if (Main.tile[this.x, this.y].liquid > 250) - { - Main.tile[this.x, this.y].liquid = 0xff; - } - else - { - AddWater(this.x - 1, this.y); - AddWater(this.x + 1, this.y); - } - } - if (Main.tile[this.x, this.y].liquid > 0) - { - bool flag = true; - bool flag2 = true; - bool flag3 = true; - bool flag4 = true; - if ((Main.tile[this.x - 1, this.y].active && Main.tileSolid[Main.tile[this.x - 1, this.y].type]) && !Main.tileSolidTop[Main.tile[this.x - 1, this.y].type]) - { - flag = false; - } - else if ((Main.tile[this.x - 1, this.y].liquid > 0) && (Main.tile[this.x - 1, this.y].lava != Main.tile[this.x, this.y].lava)) - { - flag = false; - } - else if ((Main.tile[this.x - 2, this.y].active && Main.tileSolid[Main.tile[this.x - 2, this.y].type]) && !Main.tileSolidTop[Main.tile[this.x - 2, this.y].type]) - { - flag3 = false; - } - else if (Main.tile[this.x - 2, this.y].liquid == 0) - { - flag3 = false; - } - else if ((Main.tile[this.x - 2, this.y].liquid > 0) && (Main.tile[this.x - 2, this.y].lava != Main.tile[this.x, this.y].lava)) - { - flag3 = false; - } - if ((Main.tile[this.x + 1, this.y].active && Main.tileSolid[Main.tile[this.x + 1, this.y].type]) && !Main.tileSolidTop[Main.tile[this.x + 1, this.y].type]) - { - flag2 = false; - } - else if ((Main.tile[this.x + 1, this.y].liquid > 0) && (Main.tile[this.x + 1, this.y].lava != Main.tile[this.x, this.y].lava)) - { - flag2 = false; - } - else if ((Main.tile[this.x + 2, this.y].active && Main.tileSolid[Main.tile[this.x + 2, this.y].type]) && !Main.tileSolidTop[Main.tile[this.x + 2, this.y].type]) - { - flag4 = false; - } - else if (Main.tile[this.x + 2, this.y].liquid == 0) - { - flag4 = false; - } - else if ((Main.tile[this.x + 2, this.y].liquid > 0) && (Main.tile[this.x + 2, this.y].lava != Main.tile[this.x, this.y].lava)) - { - flag4 = false; - } - int num3 = 0; - if (Main.tile[this.x, this.y].liquid < 3) - { - num3 = -1; - } - if (flag && flag2) - { - if (flag3 && flag4) - { - bool flag5 = true; - bool flag6 = true; - if ((Main.tile[this.x - 3, this.y].active && Main.tileSolid[Main.tile[this.x - 3, this.y].type]) && !Main.tileSolidTop[Main.tile[this.x - 3, this.y].type]) - { - flag5 = false; - } - else if (Main.tile[this.x - 3, this.y].liquid == 0) - { - flag5 = false; - } - else if (Main.tile[this.x - 3, this.y].lava != Main.tile[this.x, this.y].lava) - { - flag5 = false; - } - if ((Main.tile[this.x + 3, this.y].active && Main.tileSolid[Main.tile[this.x + 3, this.y].type]) && !Main.tileSolidTop[Main.tile[this.x + 3, this.y].type]) - { - flag6 = false; - } - else if (Main.tile[this.x + 3, this.y].liquid == 0) - { - flag6 = false; - } - else if (Main.tile[this.x + 3, this.y].lava != Main.tile[this.x, this.y].lava) - { - flag6 = false; - } - if (flag5 && flag6) - { - num2 = ((((((Main.tile[this.x - 1, this.y].liquid + Main.tile[this.x + 1, this.y].liquid) + Main.tile[this.x - 2, this.y].liquid) + Main.tile[this.x + 2, this.y].liquid) + Main.tile[this.x - 3, this.y].liquid) + Main.tile[this.x + 3, this.y].liquid) + Main.tile[this.x, this.y].liquid) + num3; - num2 = (float) Math.Round((double) (num2 / 7f)); - int num4 = 0; - if (Main.tile[this.x - 1, this.y].liquid != ((byte) num2)) - { - AddWater(this.x - 1, this.y); - Main.tile[this.x - 1, this.y].liquid = (byte) num2; - } - else - { - num4++; - } - Main.tile[this.x - 1, this.y].lava = Main.tile[this.x, this.y].lava; - if (Main.tile[this.x + 1, this.y].liquid != ((byte) num2)) - { - AddWater(this.x + 1, this.y); - Main.tile[this.x + 1, this.y].liquid = (byte) num2; - } - else - { - num4++; - } - Main.tile[this.x + 1, this.y].lava = Main.tile[this.x, this.y].lava; - if (Main.tile[this.x - 2, this.y].liquid != ((byte) num2)) - { - AddWater(this.x - 2, this.y); - Main.tile[this.x - 2, this.y].liquid = (byte) num2; - } - else - { - num4++; - } - Main.tile[this.x - 2, this.y].lava = Main.tile[this.x, this.y].lava; - if (Main.tile[this.x + 2, this.y].liquid != ((byte) num2)) - { - AddWater(this.x + 2, this.y); - Main.tile[this.x + 2, this.y].liquid = (byte) num2; - } - else - { - num4++; - } - Main.tile[this.x + 2, this.y].lava = Main.tile[this.x, this.y].lava; - if (Main.tile[this.x - 3, this.y].liquid != ((byte) num2)) - { - AddWater(this.x - 3, this.y); - Main.tile[this.x - 3, this.y].liquid = (byte) num2; - } - else - { - num4++; - } - Main.tile[this.x - 3, this.y].lava = Main.tile[this.x, this.y].lava; - if (Main.tile[this.x + 3, this.y].liquid != ((byte) num2)) - { - AddWater(this.x + 3, this.y); - Main.tile[this.x + 3, this.y].liquid = (byte) num2; - } - else - { - num4++; - } - Main.tile[this.x + 3, this.y].lava = Main.tile[this.x, this.y].lava; - if ((Main.tile[this.x - 1, this.y].liquid != ((byte) num2)) || (Main.tile[this.x, this.y].liquid != ((byte) num2))) - { - AddWater(this.x - 1, this.y); - } - if ((Main.tile[this.x + 1, this.y].liquid != ((byte) num2)) || (Main.tile[this.x, this.y].liquid != ((byte) num2))) - { - AddWater(this.x + 1, this.y); - } - if ((Main.tile[this.x - 2, this.y].liquid != ((byte) num2)) || (Main.tile[this.x, this.y].liquid != ((byte) num2))) - { - AddWater(this.x - 2, this.y); - } - if ((Main.tile[this.x + 2, this.y].liquid != ((byte) num2)) || (Main.tile[this.x, this.y].liquid != ((byte) num2))) - { - AddWater(this.x + 2, this.y); - } - if ((Main.tile[this.x - 3, this.y].liquid != ((byte) num2)) || (Main.tile[this.x, this.y].liquid != ((byte) num2))) - { - AddWater(this.x - 3, this.y); - } - if ((Main.tile[this.x + 3, this.y].liquid != ((byte) num2)) || (Main.tile[this.x, this.y].liquid != ((byte) num2))) - { - AddWater(this.x + 3, this.y); - } - if ((num4 != 6) || (Main.tile[this.x, this.y - 1].liquid <= 0)) - { - Main.tile[this.x, this.y].liquid = (byte) num2; - } - } - else - { - int num5 = 0; - num2 = ((((Main.tile[this.x - 1, this.y].liquid + Main.tile[this.x + 1, this.y].liquid) + Main.tile[this.x - 2, this.y].liquid) + Main.tile[this.x + 2, this.y].liquid) + Main.tile[this.x, this.y].liquid) + num3; - num2 = (float) Math.Round((double) (num2 / 5f)); - if (Main.tile[this.x - 1, this.y].liquid != ((byte) num2)) - { - AddWater(this.x - 1, this.y); - Main.tile[this.x - 1, this.y].liquid = (byte) num2; - } - else - { - num5++; - } - Main.tile[this.x - 1, this.y].lava = Main.tile[this.x, this.y].lava; - if (Main.tile[this.x + 1, this.y].liquid != ((byte) num2)) - { - AddWater(this.x + 1, this.y); - Main.tile[this.x + 1, this.y].liquid = (byte) num2; - } - else - { - num5++; - } - Main.tile[this.x + 1, this.y].lava = Main.tile[this.x, this.y].lava; - if (Main.tile[this.x - 2, this.y].liquid != ((byte) num2)) - { - AddWater(this.x - 2, this.y); - Main.tile[this.x - 2, this.y].liquid = (byte) num2; - } - else - { - num5++; - } - Main.tile[this.x - 2, this.y].lava = Main.tile[this.x, this.y].lava; - if (Main.tile[this.x + 2, this.y].liquid != ((byte) num2)) - { - AddWater(this.x + 2, this.y); - Main.tile[this.x + 2, this.y].liquid = (byte) num2; - } - else - { - num5++; - } - if ((Main.tile[this.x - 1, this.y].liquid != ((byte) num2)) || (Main.tile[this.x, this.y].liquid != ((byte) num2))) - { - AddWater(this.x - 1, this.y); - } - if ((Main.tile[this.x + 1, this.y].liquid != ((byte) num2)) || (Main.tile[this.x, this.y].liquid != ((byte) num2))) - { - AddWater(this.x + 1, this.y); - } - if ((Main.tile[this.x - 2, this.y].liquid != ((byte) num2)) || (Main.tile[this.x, this.y].liquid != ((byte) num2))) - { - AddWater(this.x - 2, this.y); - } - if ((Main.tile[this.x + 2, this.y].liquid != ((byte) num2)) || (Main.tile[this.x, this.y].liquid != ((byte) num2))) - { - AddWater(this.x + 2, this.y); - } - Main.tile[this.x + 2, this.y].lava = Main.tile[this.x, this.y].lava; - if ((num5 != 4) || (Main.tile[this.x, this.y - 1].liquid <= 0)) - { - Main.tile[this.x, this.y].liquid = (byte) num2; - } - } - } - else if (flag3) - { - num2 = (((Main.tile[this.x - 1, this.y].liquid + Main.tile[this.x + 1, this.y].liquid) + Main.tile[this.x - 2, this.y].liquid) + Main.tile[this.x, this.y].liquid) + num3; - num2 = (float) Math.Round((double) ((num2 / 4f) + 0.001)); - if ((Main.tile[this.x - 1, this.y].liquid != ((byte) num2)) || (Main.tile[this.x, this.y].liquid != ((byte) num2))) - { - AddWater(this.x - 1, this.y); - Main.tile[this.x - 1, this.y].liquid = (byte) num2; - } - Main.tile[this.x - 1, this.y].lava = Main.tile[this.x, this.y].lava; - if ((Main.tile[this.x + 1, this.y].liquid != ((byte) num2)) || (Main.tile[this.x, this.y].liquid != ((byte) num2))) - { - AddWater(this.x + 1, this.y); - Main.tile[this.x + 1, this.y].liquid = (byte) num2; - } - Main.tile[this.x + 1, this.y].lava = Main.tile[this.x, this.y].lava; - if ((Main.tile[this.x - 2, this.y].liquid != ((byte) num2)) || (Main.tile[this.x, this.y].liquid != ((byte) num2))) - { - Main.tile[this.x - 2, this.y].liquid = (byte) num2; - AddWater(this.x - 2, this.y); - } - Main.tile[this.x - 2, this.y].lava = Main.tile[this.x, this.y].lava; - Main.tile[this.x, this.y].liquid = (byte) num2; - } - else if (flag4) - { - num2 = (((Main.tile[this.x - 1, this.y].liquid + Main.tile[this.x + 1, this.y].liquid) + Main.tile[this.x + 2, this.y].liquid) + Main.tile[this.x, this.y].liquid) + num3; - num2 = (float) Math.Round((double) ((num2 / 4f) + 0.001)); - if ((Main.tile[this.x - 1, this.y].liquid != ((byte) num2)) || (Main.tile[this.x, this.y].liquid != ((byte) num2))) - { - AddWater(this.x - 1, this.y); - Main.tile[this.x - 1, this.y].liquid = (byte) num2; - } - Main.tile[this.x - 1, this.y].lava = Main.tile[this.x, this.y].lava; - if ((Main.tile[this.x + 1, this.y].liquid != ((byte) num2)) || (Main.tile[this.x, this.y].liquid != ((byte) num2))) - { - AddWater(this.x + 1, this.y); - Main.tile[this.x + 1, this.y].liquid = (byte) num2; - } - Main.tile[this.x + 1, this.y].lava = Main.tile[this.x, this.y].lava; - if ((Main.tile[this.x + 2, this.y].liquid != ((byte) num2)) || (Main.tile[this.x, this.y].liquid != ((byte) num2))) - { - Main.tile[this.x + 2, this.y].liquid = (byte) num2; - AddWater(this.x + 2, this.y); - } - Main.tile[this.x + 2, this.y].lava = Main.tile[this.x, this.y].lava; - Main.tile[this.x, this.y].liquid = (byte) num2; - } - else - { - num2 = ((Main.tile[this.x - 1, this.y].liquid + Main.tile[this.x + 1, this.y].liquid) + Main.tile[this.x, this.y].liquid) + num3; - num2 = (float) Math.Round((double) ((num2 / 3f) + 0.001)); - if (Main.tile[this.x - 1, this.y].liquid != ((byte) num2)) - { - Main.tile[this.x - 1, this.y].liquid = (byte) num2; - } - if ((Main.tile[this.x, this.y].liquid != ((byte) num2)) || (Main.tile[this.x - 1, this.y].liquid != ((byte) num2))) - { - AddWater(this.x - 1, this.y); - } - Main.tile[this.x - 1, this.y].lava = Main.tile[this.x, this.y].lava; - if (Main.tile[this.x + 1, this.y].liquid != ((byte) num2)) - { - Main.tile[this.x + 1, this.y].liquid = (byte) num2; - } - if ((Main.tile[this.x, this.y].liquid != ((byte) num2)) || (Main.tile[this.x + 1, this.y].liquid != ((byte) num2))) - { - AddWater(this.x + 1, this.y); - } - Main.tile[this.x + 1, this.y].lava = Main.tile[this.x, this.y].lava; - Main.tile[this.x, this.y].liquid = (byte) num2; - } - } - else if (flag) - { - num2 = (Main.tile[this.x - 1, this.y].liquid + Main.tile[this.x, this.y].liquid) + num3; - num2 = (float) Math.Round((double) ((num2 / 2f) + 0.001)); - if (Main.tile[this.x - 1, this.y].liquid != ((byte) num2)) - { - Main.tile[this.x - 1, this.y].liquid = (byte) num2; - } - if ((Main.tile[this.x, this.y].liquid != ((byte) num2)) || (Main.tile[this.x - 1, this.y].liquid != ((byte) num2))) - { - AddWater(this.x - 1, this.y); - } - Main.tile[this.x - 1, this.y].lava = Main.tile[this.x, this.y].lava; - Main.tile[this.x, this.y].liquid = (byte) num2; - } - else if (flag2) - { - num2 = (Main.tile[this.x + 1, this.y].liquid + Main.tile[this.x, this.y].liquid) + num3; - num2 = (float) Math.Round((double) ((num2 / 2f) + 0.001)); - if (Main.tile[this.x + 1, this.y].liquid != ((byte) num2)) - { - Main.tile[this.x + 1, this.y].liquid = (byte) num2; - } - if ((Main.tile[this.x, this.y].liquid != ((byte) num2)) || (Main.tile[this.x + 1, this.y].liquid != ((byte) num2))) - { - AddWater(this.x + 1, this.y); - } - Main.tile[this.x + 1, this.y].lava = Main.tile[this.x, this.y].lava; - Main.tile[this.x, this.y].liquid = (byte) num2; - } - } - if (Main.tile[this.x, this.y].liquid != liquid) - { - if ((Main.tile[this.x, this.y].liquid == 0xfe) && (liquid == 0xff)) - { - Main.tile[this.x, this.y].liquid = 0xff; - this.kill++; - } - else - { - AddWater(this.x, this.y - 1); - this.kill = 0; - } - } - else - { - this.kill++; - } - } - } - } - - public static void UpdateLiquid() - { - if (Main.netMode == 2) - { - cycles = 0x19; - maxLiquid = 0x1388; - } - if (!WorldGen.gen) - { - if (!panicMode) - { - if ((Liquid.numLiquid + LiquidBuffer.numLiquidBuffer) > 0xfa0) - { - panicCounter++; - if ((panicCounter > 0x708) || ((Liquid.numLiquid + LiquidBuffer.numLiquidBuffer) > 0x34bc)) - { - WorldGen.waterLine = Main.maxTilesY; - Liquid.numLiquid = 0; - LiquidBuffer.numLiquidBuffer = 0; - panicCounter = 0; - panicMode = true; - panicY = Main.maxTilesY - 3; - } - } - else - { - panicCounter = 0; - } - } - if (panicMode) - { - int num = 0; - while ((panicY >= 3) && (num < 5)) - { - num++; - QuickWater(0, panicY, panicY); - panicY--; - if (panicY < 3) - { - panicCounter = 0; - panicMode = false; - WorldGen.WaterCheck(); - if (Main.netMode == 2) - { - for (int i = 0; i < 8; i++) - { - for (int j = 0; j < Main.maxSectionsX; j++) - { - for (int k = 0; k < Main.maxSectionsY; k++) - { - Netplay.serverSock[i].tileSection[j, k] = false; - } - } - } - } - } - } - return; - } - } - if (quickSettle || (Liquid.numLiquid > 0x7d0)) - { - quickFall = true; - } - else - { - quickFall = false; - } - wetCounter++; - int num5 = maxLiquid / cycles; - int num6 = num5 * (wetCounter - 1); - int numLiquid = num5 * wetCounter; - if (wetCounter == cycles) - { - numLiquid = Liquid.numLiquid; - } - if (numLiquid > Liquid.numLiquid) - { - numLiquid = Liquid.numLiquid; - int netMode = Main.netMode; - wetCounter = cycles; - } - if (quickFall) - { - for (int m = num6; m < numLiquid; m++) - { - Main.liquid[m].delay = 10; - Main.liquid[m].Update(); - Main.tile[Main.liquid[m].x, Main.liquid[m].y].skipLiquid = false; - } - } - else - { - for (int n = num6; n < numLiquid; n++) - { - if (!Main.tile[Main.liquid[n].x, Main.liquid[n].y].skipLiquid) - { - Main.liquid[n].Update(); - } - else - { - Main.tile[Main.liquid[n].x, Main.liquid[n].y].skipLiquid = false; - } - } - } - if (wetCounter >= cycles) - { - wetCounter = 0; - for (int num10 = Liquid.numLiquid - 1; num10 >= 0; num10--) - { - if (Main.liquid[num10].kill > 3) - { - DelWater(num10); - } - } - int numLiquidBuffer = maxLiquid - (maxLiquid - Liquid.numLiquid); - if (numLiquidBuffer > LiquidBuffer.numLiquidBuffer) - { - numLiquidBuffer = LiquidBuffer.numLiquidBuffer; - } - for (int num12 = 0; num12 < numLiquidBuffer; num12++) - { - Main.tile[Main.liquidBuffer[0].x, Main.liquidBuffer[0].y].checkingLiquid = false; - AddWater(Main.liquidBuffer[0].x, Main.liquidBuffer[0].y); - LiquidBuffer.DelBuffer(0); - } - if (((Liquid.numLiquid > 0) && (Liquid.numLiquid > (stuckAmount - 50))) && (Liquid.numLiquid < (stuckAmount + 50))) - { - stuckCount++; - if (stuckCount >= 0x2710) - { - stuck = true; - for (int num13 = Liquid.numLiquid - 1; num13 >= 0; num13--) - { - DelWater(num13); - } - stuck = false; - stuckCount = 0; - } - } - else - { - stuckCount = 0; - stuckAmount = Liquid.numLiquid; - } - } - } - } -} - diff --git a/Terraria/LiquidBuffer.cs b/Terraria/LiquidBuffer.cs deleted file mode 100644 index 913173bc..00000000 --- a/Terraria/LiquidBuffer.cs +++ /dev/null @@ -1,31 +0,0 @@ -namespace Terraria -{ - using System; - - public class LiquidBuffer - { - public const int maxLiquidBuffer = 0x2710; - public static int numLiquidBuffer; - public int x; - public int y; - - public static void AddBuffer(int x, int y) - { - if ((numLiquidBuffer != 0x270f) && !Main.tile[x, y].checkingLiquid) - { - Main.tile[x, y].checkingLiquid = true; - Main.liquidBuffer[numLiquidBuffer].x = x; - Main.liquidBuffer[numLiquidBuffer].y = y; - numLiquidBuffer++; - } - } - - public static void DelBuffer(int l) - { - numLiquidBuffer--; - Main.liquidBuffer[l].x = Main.liquidBuffer[numLiquidBuffer].x; - Main.liquidBuffer[l].y = Main.liquidBuffer[numLiquidBuffer].y; - } - } -} - diff --git a/Terraria/Main.cs b/Terraria/Main.cs deleted file mode 100644 index fda03884..00000000 --- a/Terraria/Main.cs +++ /dev/null @@ -1,9490 +0,0 @@ -namespace Terraria -{ - using Microsoft.Xna.Framework; - using Microsoft.Xna.Framework.Audio; - using Microsoft.Xna.Framework.Graphics; - using Microsoft.Xna.Framework.Input; - using System; - using System.IO; - using System.Net; - using System.Runtime.InteropServices; - using System.Text; - - public class Main : Game - { - private static KeyboardState inputText; - public static int numChatLines = 7; - public static Texture2D[] armorArmTexture = new Texture2D[10]; - public static Texture2D[] armorBodyTexture = new Texture2D[10]; - public static Texture2D[] armorHeadTexture = new Texture2D[12]; - public static Texture2D[] armorLegTexture = new Texture2D[10]; - public static int[] availableRecipe = new int[Recipe.maxRecipes]; - public static float[] availableRecipeY = new float[Recipe.maxRecipes]; - public static int background = 0; - public static int[] backgroundHeight = new int[7]; - public static Texture2D[] backgroundTexture = new Texture2D[7]; - public static int[] backgroundWidth = new int[7]; - private static int backSpaceCount = 0; - private int bgScroll; - public static Texture2D blackTileTexture; - public static bool bloodMoon = false; - public static Texture2D boneArmTexture; - public static float bottomWorld = 38400f; - public static Texture2D bubbleTexture; - public static float caveParrallax = 1f; - public static string cDown = "S"; - public static Texture2D cdTexture; - public static Texture2D chain2Texture; - public static Texture2D chain3Texture; - public static Texture2D chain4Texture; - public static Texture2D chain5Texture; - public static Texture2D chain6Texture; - public static Texture2D chainTexture; - public static Texture2D chat2Texture; - public static Texture2D chatBackTexture; - public static int chatLength = 600; - public static ChatLine[] chatLine = new ChatLine[8]; - public static bool chatMode = false; - public static bool chatRelease = false; - public static string chatText = ""; - public static Texture2D chatTexture; - public static int checkForSpawns = 0; - public static Chest[] chest = new Chest[0x3e8]; - public static string cInv = "Escape"; - public static string cJump = "Space"; - public static string cLeft = "A"; - public static Player clientPlayer = new Player(); - public static Cloud[] cloud = new Cloud[100]; - public static int cloudLimit = 100; - public static Texture2D[] cloudTexture = new Texture2D[4]; - private int colorDelay; - public static CombatText[] combatText = new CombatText[100]; - public static string cRight = "D"; - public static string cThrowItem = "Q"; - public static string cUp = "W"; - public int curMusic; - public static int curRelease = 3; - public static float cursorAlpha = 0f; - public static Color cursorColor = Color.White; - public static int cursorColorDirection = 1; - public static float cursorScale = 0f; - public static Texture2D cursorTexture; - public const double dayLength = 54000.0; - public static bool dayTime = true; - public static bool debugMode = false; - public static string defaultIP = ""; - public static int drawTime = 0; - public static bool dumbAI = false; - public static int dungeonTiles; - public static int dungeonX; - public static int dungeonY; - public static Dust[] dust = new Dust[0x7d0]; - public static Texture2D dustTexture; - public static bool editSign = false; - public static AudioEngine engine; - public static int evilTiles; - private static float exitScale = 0.8f; - public static int fadeCounter = 0; - public static Texture2D fadeTexture; - public static bool fixedTiming = false; - private int focusColor; - private int focusMenu = -1; - public static int focusRecipe; - public static SpriteFont fontCombatText; - public static SpriteFont fontDeathText; - public static SpriteFont fontItemStack; - public static SpriteFont fontMouseText; - public static int frameRate = 0; - public static bool frameRelease = false; - public static bool gameMenu = true; - public static string getIP = defaultIP; - public static bool godMode = false; - public static Gore[] gore = new Gore[0xc9]; - public static Texture2D[] goreTexture = new Texture2D[0x49]; - public static bool grabSky = false; - public static bool grabSun = false; - private GraphicsDeviceManager graphics; - public static bool hasFocus = true; - public static Texture2D heartTexture; - public static int helpText = 0; - public static bool hideUI = 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 bool ignoreErrors = true; - public static bool inputTextEnter = false; - public static int invasionDelay = 0; - public static int invasionSize = 0; - public static int invasionType = 0; - public static int invasionWarn = 0; - public static double invasionX = 0.0; - public static Texture2D inventoryBackTexture; - private static float inventoryScale = 0.75f; - public static Item[] item = new Item[0xc9]; - public static Texture2D[] itemTexture = new Texture2D[0xec]; - public static int jungleTiles; - public static KeyboardState keyState = Keyboard.GetState(); - public static int lastItemUpdate; - public static int lastNPCUpdate; - public static float leftWorld = 0f; - public static bool lightTiles = false; - public static Liquid[] liquid = new Liquid[Liquid.resLiquid]; - public static LiquidBuffer[] liquidBuffer = new LiquidBuffer[0x2710]; - public static Texture2D[] liquidTexture = new Texture2D[2]; - public static Player[] loadPlayer = new Player[5]; - public static string[] loadPlayerPath = new string[5]; - public static string[] loadWorld = new string[5]; - public static string[] loadWorldPath = new string[5]; - private float logoRotation; - private float logoRotationDirection = 1f; - private float logoRotationSpeed = 1f; - private float logoScale = 1f; - private float logoScaleDirection = 1f; - private float logoScaleSpeed = 1f; - public static Texture2D logoTexture; - public static int magmaBGFrame = 0; - public static int magmaBGFrameCounter = 0; - public static Texture2D manaTexture; - public const int maxBackgrounds = 7; - public const int maxChests = 0x3e8; - public const int maxClouds = 100; - public const int maxCloudTypes = 4; - public const int maxCombatText = 100; - public const int maxDust = 0x7d0; - public const int maxGore = 200; - public const int maxGoreTypes = 0x49; - public const int maxHair = 0x11; - public const int maxInventory = 0x2c; - public const int maxItems = 200; - public const int maxItemSounds = 0x10; - public const int maxItemTypes = 0xec; - public static int maxItemUpdates = 10; - public const int maxLiquidTypes = 2; - private static int maxMenuItems = 11; - public const int maxMusic = 7; - public const int maxNPCHitSounds = 3; - public const int maxNPCKilledSounds = 3; - public const int maxNPCs = 0x3e8; - public const int maxNPCTypes = 0x2c; - public static int maxNPCUpdates = 15; - public const int maxPlayers = 8; - public const int maxProjectiles = 0x3e8; - public const int maxProjectileTypes = 0x26; - public const int maxStars = 130; - public const int maxStarTypes = 5; - public const int maxTileSets = 80; - public const int maxWallTypes = 14; - private float[] menuItemScale = new float[maxMenuItems]; - public static int menuMode = 0; - public static bool menuMultiplayer = false; - public static int meteorTiles; - private const int MF_BYPOSITION = 0x400; - public static short moonModY = 0; - public static int moonPhase = 0; - public static Texture2D moonTexture; - public static Color mouseColor = new Color(0xff, 50, 0x5f); - private static bool mouseExit = false; - public static Item mouseItem = new Item(); - public static bool mouseLeftRelease = false; - public static bool mouseRightRelease = false; - public static MouseState mouseState = Mouse.GetState(); - public static byte mouseTextColor = 0; - public static int mouseTextColorChange = 1; - public static Microsoft.Xna.Framework.Audio.Cue[] music = new Microsoft.Xna.Framework.Audio.Cue[7]; - public static float[] musicFade = new float[7]; - public static float musicVolume = 0.75f; - public static int myPlayer = 0; - public static int netMode = 0; - public static int netPlayCounter; - public int newMusic; - public static string newWorldName = ""; - public const double nightLength = 32400.0; - public static NPC[] npc = new NPC[0x3e9]; - public static bool npcChatFocus1 = false; - public static bool npcChatFocus2 = false; - public static bool npcChatRelease = false; - public static string npcChatText = ""; - public static int[] npcFrameCount = new int[] { - 1, 2, 2, 3, 6, 2, 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, - 2, 0x10, 14, 0x10, 14, 14, 0x10, 2, 10, 1, 0x10, 0x10, 0x10, 3, 1, 14, - 3, 1, 3, 1, 1, 0x10, 0x10, 1, 1, 1, 3, 3 - }; - public static int npcShop = 0; - public static Texture2D[] npcTexture = new Texture2D[0x2c]; - public const int numArmorBody = 10; - public const int numArmorHead = 12; - public const int numArmorLegs = 10; - public static int numAvailableRecipes; - - public static int numClouds = cloudLimit; - private static int numLoadPlayers = 0; - private static int numLoadWorlds = 0; - public static int numStars; - private static KeyboardState oldInputText; - public static MouseState oldMouseState = Mouse.GetState(); - public static Player[] player = new Player[9]; - public static Texture2D playerBeltTexture; - public static Texture2D playerEyesTexture; - public static Texture2D playerEyeWhitesTexture; - public static Texture2D[] playerHairTexture = new Texture2D[0x11]; - public static Texture2D playerHands2Texture; - public static Texture2D playerHandsTexture; - public static Texture2D playerHeadTexture; - public static bool playerInventory = false; - public static Texture2D playerPantsTexture; - public static string playerPathName; - public static Texture2D playerShirtTexture; - public static Texture2D playerShoesTexture; - public static Texture2D playerUnderShirt2Texture; - public static Texture2D playerUnderShirtTexture; - public static Projectile[] projectile = new Projectile[0x3e9]; - public static Texture2D[] projectileTexture = new Texture2D[0x26]; - [ThreadStatic] - public static Random rand; - public static Texture2D raTexture; - public static Recipe[] recipe = new Recipe[Recipe.maxRecipes]; - public static bool releaseUI = false; - public static bool resetClouds = true; - public static Texture2D reTexture; - public static float rightWorld = 134400f; - public static int maxTilesX = ((((int)rightWorld) / 0x10) + 1); - public static int maxTilesY = ((((int)bottomWorld) / 0x10) + 1); - public static int maxSectionsX = (maxTilesX / 200); - public static int maxSectionsY = (maxTilesY / 150); - public static double rockLayer; - public static string SavePath = (Environment.GetFolderPath(Environment.SpecialFolder.Personal) + @"\My Games\Terraria"); - public static string PlayerPath = (SavePath + @"\Players"); - public static int saveTimer = 0; - public static int screenHeight = 600; - public static Vector2 screenLastPosition; - public static Vector2 screenPosition; - public static int screenWidth = 800; - public const int sectionHeight = 150; - public const int sectionWidth = 200; - private Color selColor = Color.White; - private int selectedMenu = -1; - private int selectedPlayer; - private int selectedWorld; - private int setKey = -1; - public Chest[] shop = new Chest[5]; - public static bool showFrameRate = false; - public static bool showItemOwner = false; - public static bool showSpam = false; - public static bool showSplash = false; - public static Texture2D shroomCapTexture; - public static Sign[] sign = new Sign[0x3e8]; - public static bool signBubble = false; - public static string signText = ""; - public static int signX = 0; - public static int signY = 0; - public static bool skipMenu = false; - public static Microsoft.Xna.Framework.Audio.SoundBank soundBank; - public static SoundEffect soundCoins; - public static SoundEffect[] soundDig = new SoundEffect[3]; - public static SoundEffect soundDoorClosed; - public static SoundEffect soundDoorOpen; - public static SoundEffect soundDoubleJump; - public static SoundEffect[] soundFemaleHit = new SoundEffect[3]; - public static SoundEffect soundGrab; - public static SoundEffect soundGrass; - public static SoundEffectInstance soundInstanceCoins; - public static SoundEffectInstance[] soundInstanceDig = new SoundEffectInstance[3]; - public static SoundEffectInstance soundInstanceDoorClosed; - public static SoundEffectInstance soundInstanceDoorOpen; - public static SoundEffectInstance soundInstanceDoubleJump; - public static SoundEffectInstance[] soundInstanceFemaleHit = new SoundEffectInstance[3]; - public static SoundEffectInstance soundInstanceGrab; - public static SoundEffectInstance soundInstanceGrass; - public static SoundEffectInstance[] soundInstanceItem = new SoundEffectInstance[0x11]; - public static SoundEffectInstance soundInstanceMenuClose; - public static SoundEffectInstance soundInstanceMenuOpen; - public static SoundEffectInstance soundInstanceMenuTick; - public static SoundEffectInstance[] soundInstanceNPCHit = new SoundEffectInstance[4]; - public static SoundEffectInstance[] soundInstanceNPCKilled = new SoundEffectInstance[4]; - public static SoundEffectInstance[] soundInstancePlayerHit = new SoundEffectInstance[3]; - public static SoundEffectInstance soundInstancePlayerKilled; - public static SoundEffectInstance[] soundInstanceRoar = new SoundEffectInstance[2]; - public static SoundEffectInstance soundInstanceRun; - public static SoundEffectInstance soundInstanceShatter; - public static SoundEffectInstance[] soundInstanceSplash = new SoundEffectInstance[2]; - public static SoundEffectInstance[] soundInstanceTink = new SoundEffectInstance[3]; - public static SoundEffectInstance[] soundInstanceZombie = new SoundEffectInstance[3]; - public static SoundEffect[] soundItem = new SoundEffect[0x11]; - public static SoundEffect soundMenuClose; - public static SoundEffect soundMenuOpen; - public static SoundEffect soundMenuTick; - public static SoundEffect[] soundNPCHit = new SoundEffect[4]; - public static SoundEffect[] soundNPCKilled = new SoundEffect[4]; - public static SoundEffect[] soundPlayerHit = new SoundEffect[3]; - public static SoundEffect soundPlayerKilled; - public static SoundEffect[] soundRoar = new SoundEffect[2]; - public static SoundEffect soundRun; - public static SoundEffect soundShatter; - public static SoundEffect[] soundSplash = new SoundEffect[2]; - public static SoundEffect[] soundTink = new SoundEffect[3]; - public static float soundVolume = 0f; - public static SoundEffect[] soundZombie = new SoundEffect[3]; - public static int spawnTileX; - public static int spawnTileY; - private int splashCounter; - public static Texture2D splashTexture; - private SpriteBatch spriteBatch; - public static int stackCounter = 0; - public static int stackDelay = 7; - public static int stackSplit; - public static Star[] star = new Star[130]; - public static Texture2D[] starTexture = new Texture2D[5]; - public static string statusText = ""; - public static bool stopSpawns = false; - public static bool stopTimeOuts = false; - public static short sunModY = 0; - public static Texture2D sunTexture; - public static Color[] teamColor = new Color[5]; - public static Texture2D teamTexture; - public static Texture2D textBackTexture; - private int textBlinkerCount; - private int textBlinkerState; - public static Tile[,] tile = new Tile[maxTilesX, maxTilesY]; - public static bool[] tileBlockLight = new bool[80]; - public static Color tileColor; - public static bool[] tileDungeon = new bool[80]; - public static bool[] tileFrameImportant = new bool[80]; - public static bool[] tileLavaDeath = new bool[80]; - public static bool[] tileNoAttach = new bool[80]; - public static bool[] tileNoFail = new bool[80]; - public static bool tilesLoaded = false; - public static bool[] tileSolid = new bool[80]; - public static bool[] tileSolidTop = new bool[80]; - public static bool[] tileStone = new bool[80]; - public static bool[] tileTable = new bool[80]; - public static Texture2D[] tileTexture = new Texture2D[80]; - public static bool[] tileWaterDeath = new bool[80]; - public static double time = 13500.0; - public static int timeOut = 120; - public bool toggleFullscreen; - private static Item toolTip = new Item(); - public static float topWorld = 0f; - public static Texture2D treeBranchTexture; - public static Texture2D treeTopTexture; - public static int updateTime = 0; - public static bool verboseNetplay = true; - public static string versionNumber = "v1.0.2"; - public static bool[] wallHouse = new bool[14]; - public static Texture2D[] wallTexture = new Texture2D[14]; - public static Microsoft.Xna.Framework.Audio.WaveBank waveBank; - private static bool webAuth = false; - public static bool webProtect = false; - public static float windSpeed = 0f; - public static float windSpeedSpeed = 0f; - public static int worldID; - public static string worldName = ""; - public static string WorldPath = (SavePath + @"\Worlds"); - public static string worldPathName; - public static double worldSurface; - - public Main() - { - this.graphics = new GraphicsDeviceManager(this); - base.Content.RootDirectory = "Content"; - ShankShock.SetupConfig(); - } - - public static double CalculateDamage(int Damage, int Defense) - { - double num = Damage - (Defense * 0.5); - if (num < 1.0) - { - num = 1.0; - } - return num; - } - - public static void CursorColor() - { - cursorAlpha += cursorColorDirection * 0.015f; - if (cursorAlpha >= 1f) - { - cursorAlpha = 1f; - cursorColorDirection = -1; - } - if (cursorAlpha <= 0.6) - { - cursorAlpha = 0.6f; - cursorColorDirection = 1; - } - float num = (cursorAlpha * 0.3f) + 0.7f; - byte r = (byte) (mouseColor.R * cursorAlpha); - byte g = (byte) (mouseColor.G * cursorAlpha); - byte b = (byte) (mouseColor.B * cursorAlpha); - byte a = (byte) (255f * num); - cursorColor = new Color(r, g, b, a); - cursorScale = ((cursorAlpha * 0.3f) + 0.7f) + 0.1f; - } - - protected override void Draw(GameTime gameTime) - { - CursorColor(); - drawTime++; - screenLastPosition = screenPosition; - if (stackSplit == 0) - { - stackCounter = 0; - stackDelay = 7; - } - else - { - stackCounter++; - if (stackCounter >= 30) - { - stackDelay--; - if (stackDelay < 2) - { - stackDelay = 2; - } - stackCounter = 0; - } - } - mouseTextColor = (byte) (mouseTextColor + ((byte) mouseTextColorChange)); - if (mouseTextColor >= 250) - { - mouseTextColorChange = -4; - } - if (mouseTextColor <= 0xaf) - { - mouseTextColorChange = 4; - } - if (myPlayer >= 0) - { - player[myPlayer].mouseInterface = false; - } - toolTip = new Item(); - if ((!debugMode && !gameMenu) && (netMode != 2)) - { - int x = mouseState.X; - int y = mouseState.Y; - if (x < 0) - { - x = 0; - } - if (x > screenWidth) - { - x = screenWidth; - } - if (y < 0) - { - y = 0; - } - if (y > screenHeight) - { - y = screenHeight; - } - screenPosition.X = (player[myPlayer].position.X + (player[myPlayer].width * 0.5f)) - (screenWidth * 0.5f); - screenPosition.Y = (player[myPlayer].position.Y + (player[myPlayer].height * 0.5f)) - (screenHeight * 0.5f); - screenPosition.X = (int) screenPosition.X; - screenPosition.Y = (int) screenPosition.Y; - } - if (!gameMenu && (netMode != 2)) - { - if (screenPosition.X < ((leftWorld + 336f) + 16f)) - { - screenPosition.X = (leftWorld + 336f) + 16f; - } - else if ((screenPosition.X + screenWidth) > ((rightWorld - 336f) - 32f)) - { - screenPosition.X = ((rightWorld - screenWidth) - 336f) - 32f; - } - if (screenPosition.Y < ((topWorld + 336f) + 16f)) - { - screenPosition.Y = (topWorld + 336f) + 16f; - } - else if ((screenPosition.Y + screenHeight) > ((bottomWorld - 336f) - 32f)) - { - screenPosition.Y = ((bottomWorld - screenHeight) - 336f) - 32f; - } - } - if (showSplash) - { - this.DrawSplash(gameTime); - } - else - { - Rectangle rectangle; - base.GraphicsDevice.Clear(Color.Black); - base.Draw(gameTime); - this.spriteBatch.Begin(); - double caveParrallax = 0.5; - int num4 = ((int) -Math.IEEERemainder(screenPosition.X * caveParrallax, (double) backgroundWidth[background])) - (backgroundWidth[background] / 2); - int num5 = (screenWidth / backgroundWidth[background]) + 2; - int num6 = 0; - int num7 = 0; - int num8 = (int) ((((double) -screenPosition.Y) / ((worldSurface * 16.0) - screenHeight)) * (backgroundHeight[background] - screenHeight)); - if (gameMenu || (netMode == 2)) - { - num8 = -200; - } - Color white = Color.White; - int num9 = ((int) ((time / 54000.0) * (screenWidth + (sunTexture.Width * 2)))) - sunTexture.Width; - int num10 = 0; - Color color = Color.White; - float scale = 1f; - float rotation = (((float) (time / 54000.0)) * 2f) - 7.3f; - int num14 = ((int) ((time / 32400.0) * (screenWidth + (moonTexture.Width * 2)))) - moonTexture.Width; - int num15 = 0; - Color color3 = Color.White; - float num16 = 1f; - float num17 = (((float) (time / 32400.0)) * 2f) - 7.3f; - float num19 = 0f; - if (dayTime) - { - double num13; - if (time < 27000.0) - { - num13 = Math.Pow(1.0 - ((time / 54000.0) * 2.0), 2.0); - num10 = (int) ((num8 + (num13 * 250.0)) + 180.0); - } - else - { - num13 = Math.Pow(((time / 54000.0) - 0.5) * 2.0, 2.0); - num10 = (int) ((num8 + (num13 * 250.0)) + 180.0); - } - scale = (float) (1.2 - (num13 * 0.4)); - } - else - { - double num18; - if (time < 16200.0) - { - num18 = Math.Pow(1.0 - ((time / 32400.0) * 2.0), 2.0); - num15 = (int) ((num8 + (num18 * 250.0)) + 180.0); - } - else - { - num18 = Math.Pow(((time / 32400.0) - 0.5) * 2.0, 2.0); - num15 = (int) ((num8 + (num18 * 250.0)) + 180.0); - } - num16 = (float) (1.2 - (num18 * 0.4)); - } - if (dayTime) - { - if (time < 13500.0) - { - num19 = (float) (time / 13500.0); - color.R = (byte) ((num19 * 200f) + 55f); - color.G = (byte) ((num19 * 180f) + 75f); - color.B = (byte) ((num19 * 250f) + 5f); - white.R = (byte) ((num19 * 200f) + 55f); - white.G = (byte) ((num19 * 200f) + 55f); - white.B = (byte) ((num19 * 200f) + 55f); - } - if (time > 45900.0) - { - num19 = (float) (1.0 - (((time / 54000.0) - 0.85) * 6.666666666666667)); - color.R = (byte) ((num19 * 120f) + 55f); - color.G = (byte) ((num19 * 100f) + 25f); - color.B = (byte) ((num19 * 120f) + 55f); - white.R = (byte) ((num19 * 200f) + 55f); - white.G = (byte) ((num19 * 85f) + 55f); - white.B = (byte) ((num19 * 135f) + 55f); - } - else if (time > 37800.0) - { - num19 = (float) (1.0 - (((time / 54000.0) - 0.7) * 6.666666666666667)); - color.R = (byte) ((num19 * 80f) + 175f); - color.G = (byte) ((num19 * 130f) + 125f); - color.B = (byte) ((num19 * 100f) + 155f); - white.R = (byte) ((num19 * 0f) + 255f); - white.G = (byte) ((num19 * 115f) + 140f); - white.B = (byte) ((num19 * 75f) + 180f); - } - } - if (!dayTime) - { - if (bloodMoon) - { - if (time < 16200.0) - { - num19 = (float) (1.0 - (time / 16200.0)); - color3.R = (byte) ((num19 * 10f) + 205f); - color3.G = (byte) ((num19 * 170f) + 55f); - color3.B = (byte) ((num19 * 200f) + 55f); - white.R = (byte) ((60f - (num19 * 60f)) + 55f); - white.G = (byte) ((num19 * 40f) + 15f); - white.B = (byte) ((num19 * 40f) + 15f); - } - else if (time >= 16200.0) - { - num19 = (float) (((time / 32400.0) - 0.5) * 2.0); - color3.R = (byte) ((num19 * 50f) + 205f); - color3.G = (byte) ((num19 * 100f) + 155f); - color3.B = (byte) ((num19 * 100f) + 155f); - color3.R = (byte) ((num19 * 10f) + 205f); - color3.G = (byte) ((num19 * 170f) + 55f); - color3.B = (byte) ((num19 * 200f) + 55f); - white.R = (byte) ((60f - (num19 * 60f)) + 55f); - white.G = (byte) ((num19 * 40f) + 15f); - white.B = (byte) ((num19 * 40f) + 15f); - } - } - else if (time < 16200.0) - { - num19 = (float) (1.0 - (time / 16200.0)); - color3.R = (byte) ((num19 * 10f) + 205f); - color3.G = (byte) ((num19 * 70f) + 155f); - color3.B = (byte) ((num19 * 100f) + 155f); - white.R = (byte) ((num19 * 40f) + 15f); - white.G = (byte) ((num19 * 40f) + 15f); - white.B = (byte) ((num19 * 40f) + 15f); - } - else if (time >= 16200.0) - { - num19 = (float) (((time / 32400.0) - 0.5) * 2.0); - color3.R = (byte) ((num19 * 50f) + 205f); - color3.G = (byte) ((num19 * 100f) + 155f); - color3.B = (byte) ((num19 * 100f) + 155f); - white.R = (byte) ((num19 * 40f) + 15f); - white.G = (byte) ((num19 * 40f) + 15f); - white.B = (byte) ((num19 * 40f) + 15f); - } - } - if (gameMenu || (netMode == 2)) - { - num8 = 0; - if (!dayTime) - { - white.R = 0x37; - white.G = 0x37; - white.B = 0x37; - } - } - if (evilTiles > 0) - { - float num20 = ((float) evilTiles) / 500f; - if (num20 > 1f) - { - num20 = 1f; - } - int r = white.R; - int g = white.G; - int b = white.B; - r += (int) (10f * num20); - g -= (int) ((90f * num20) * (((float) white.G) / 255f)); - b -= (int) ((190f * num20) * (((float) white.B) / 255f)); - if (r > 0xff) - { - r = 0xff; - } - if (g < 15) - { - g = 15; - } - if (b < 15) - { - b = 15; - } - white.R = (byte) r; - white.G = (byte) g; - white.B = (byte) b; - r = color.R; - g = color.G; - b = color.B; - r -= (int) ((100f * num20) * (((float) color.R) / 255f)); - g -= (int) ((160f * num20) * (((float) color.G) / 255f)); - b -= (int) ((170f * num20) * (((float) color.B) / 255f)); - if (r < 15) - { - r = 15; - } - if (g < 15) - { - g = 15; - } - if (b < 15) - { - b = 15; - } - color.R = (byte) r; - color.G = (byte) g; - color.B = (byte) b; - r = color3.R; - g = color3.G; - b = color3.B; - r -= (int) ((140f * num20) * (((float) color3.R) / 255f)); - g -= (int) ((170f * num20) * (((float) color3.G) / 255f)); - b -= (int) ((190f * num20) * (((float) color3.B) / 255f)); - if (r < 15) - { - r = 15; - } - if (g < 15) - { - g = 15; - } - if (b < 15) - { - b = 15; - } - color3.R = (byte) r; - color3.G = (byte) g; - color3.B = (byte) b; - } - tileColor.A = 0xff; - tileColor.R = (byte) (((white.R + white.B) + white.G) / 3); - tileColor.G = (byte) (((white.R + white.B) + white.G) / 3); - tileColor.B = (byte) (((white.R + white.B) + white.G) / 3); - if (screenPosition.Y < ((worldSurface * 16.0) + 16.0)) - { - for (int i = 0; i < num5; i++) - { - this.spriteBatch.Draw(backgroundTexture[background], new Rectangle(num4 + (backgroundWidth[background] * i), num8, backgroundWidth[background], backgroundHeight[background]), white); - } - } - if (((screenPosition.Y < ((worldSurface * 16.0) + 16.0)) && (((0xff - tileColor.R) - 100) > 0)) && (netMode != 2)) - { - Star.UpdateStars(); - for (int j = 0; j < numStars; j++) - { - Color color4 = new Color(); - float num26 = ((float) evilTiles) / 500f; - if (num26 > 1f) - { - num26 = 1f; - } - num26 = 1f - (num26 * 0.5f); - if (evilTiles <= 0) - { - num26 = 1f; - } - int num27 = (int) ((((0xff - tileColor.R) - 100) * star[j].twinkle) * num26); - int num28 = (int) ((((0xff - tileColor.G) - 100) * star[j].twinkle) * num26); - int num29 = (int) ((((0xff - tileColor.B) - 100) * star[j].twinkle) * num26); - if (num27 < 0) - { - num27 = 0; - } - if (num28 < 0) - { - num28 = 0; - } - if (num29 < 0) - { - num29 = 0; - } - color4.R = (byte) num27; - color4.G = (byte) (num28 * num26); - color4.B = (byte) (num29 * num26); - this.spriteBatch.Draw(starTexture[star[j].type], new Vector2(star[j].position.X + (starTexture[star[j].type].Width * 0.5f), (star[j].position.Y + (starTexture[star[j].type].Height * 0.5f)) + num8), new Rectangle(0, 0, starTexture[star[j].type].Width, starTexture[star[j].type].Height), color4, star[j].rotation, new Vector2(starTexture[star[j].type].Width * 0.5f, starTexture[star[j].type].Height * 0.5f), (float) (star[j].scale * star[j].twinkle), SpriteEffects.None, 0f); - } - } - if (dayTime) - { - this.spriteBatch.Draw(sunTexture, new Vector2((float) num9, (float) (num10 + sunModY)), new Rectangle(0, 0, sunTexture.Width, sunTexture.Height), color, rotation, new Vector2((float) (sunTexture.Width / 2), (float) (sunTexture.Height / 2)), scale, SpriteEffects.None, 0f); - } - if (!dayTime) - { - this.spriteBatch.Draw(moonTexture, new Vector2((float) num14, (float) (num15 + moonModY)), new Rectangle(0, moonTexture.Width * moonPhase, moonTexture.Width, moonTexture.Width), color3, num17, new Vector2((float) (moonTexture.Width / 2), (float) (moonTexture.Width / 2)), num16, SpriteEffects.None, 0f); - } - if (dayTime) - { - rectangle = new Rectangle(num9 - ((int) ((sunTexture.Width * 0.5) * scale)), (int) ((num10 - ((sunTexture.Height * 0.5) * scale)) + sunModY), (int) (sunTexture.Width * scale), (int) (sunTexture.Width * scale)); - } - else - { - rectangle = new Rectangle(num14 - ((int) ((moonTexture.Width * 0.5) * num16)), (int) ((num15 - ((moonTexture.Width * 0.5) * num16)) + moonModY), (int) (moonTexture.Width * num16), (int) (moonTexture.Width * num16)); - } - Rectangle rectangle2 = new Rectangle(mouseState.X, mouseState.Y, 1, 1); - sunModY = (short) (sunModY * 0.999); - moonModY = (short) (moonModY * 0.999); - if ((gameMenu && (netMode != 1)) || grabSun) - { - if ((mouseState.LeftButton == ButtonState.Pressed) && hasFocus) - { - if (rectangle2.Intersects(rectangle) || grabSky) - { - if (dayTime) - { - time = 54000.0 * (((float) (mouseState.X + sunTexture.Width)) / (screenWidth + (sunTexture.Width * 2))); - sunModY = (short) (mouseState.Y - num10); - if (time > 53990.0) - { - time = 53990.0; - } - } - else - { - time = 32400.0 * (((float) (mouseState.X + moonTexture.Width)) / (screenWidth + (moonTexture.Width * 2))); - moonModY = (short) (mouseState.Y - num15); - if (time > 32390.0) - { - time = 32390.0; - } - } - if (time < 10.0) - { - time = 10.0; - } - if (netMode != 0) - { - NetMessage.SendData(0x12, -1, -1, "", 0, 0f, 0f, 0f); - } - grabSky = true; - } - } - else - { - grabSky = false; - } - } - if (resetClouds) - { - Cloud.resetClouds(); - resetClouds = false; - } - if (base.IsActive || (netMode != 0)) - { - Cloud.UpdateClouds(); - windSpeedSpeed += rand.Next(-10, 11) * 0.0001f; - if (windSpeedSpeed < -0.002) - { - windSpeedSpeed = -0.002f; - } - if (windSpeedSpeed > 0.002) - { - windSpeedSpeed = 0.002f; - } - windSpeed += windSpeedSpeed; - if (windSpeed < -0.3) - { - windSpeed = -0.3f; - } - if (windSpeed > 0.3) - { - windSpeed = 0.3f; - } - numClouds += rand.Next(-1, 2); - if (numClouds < 0) - { - numClouds = 0; - } - if (numClouds > cloudLimit) - { - numClouds = cloudLimit; - } - } - if (screenPosition.Y < ((worldSurface * 16.0) + 16.0)) - { - for (int k = 0; k < 100; k++) - { - if (cloud[k].active) - { - int num31 = (int) (40f * (2f - cloud[k].scale)); - int num32 = 0; - Color color5 = new Color(); - num32 = white.R - num31; - if (num32 <= 0) - { - num32 = 0; - } - color5.R = (byte) num32; - num32 = white.G - num31; - if (num32 <= 0) - { - num32 = 0; - } - color5.G = (byte) num32; - num32 = white.B - num31; - if (num32 <= 0) - { - num32 = 0; - } - color5.B = (byte) num32; - color5.A = (byte) (0xff - num31); - this.spriteBatch.Draw(cloudTexture[cloud[k].type], new Vector2(cloud[k].position.X + (cloudTexture[cloud[k].type].Width * 0.5f), (cloud[k].position.Y + (cloudTexture[cloud[k].type].Height * 0.5f)) + num8), new Rectangle(0, 0, cloudTexture[cloud[k].type].Width, cloudTexture[cloud[k].type].Height), color5, cloud[k].rotation, new Vector2(cloudTexture[cloud[k].type].Width * 0.5f, cloudTexture[cloud[k].type].Height * 0.5f), cloud[k].scale, SpriteEffects.None, 0f); - } - } - } - if (gameMenu || (netMode == 2)) - { - this.DrawMenu(); - } - else - { - Vector2 vector10; - Color color16; - int firstX = (int) ((screenPosition.X / 16f) - 1f); - int lastX = ((int) ((screenPosition.X + screenWidth) / 16f)) + 2; - int firstY = (int) ((screenPosition.Y / 16f) - 1f); - int lastY = ((int) ((screenPosition.Y + screenHeight) / 16f)) + 2; - if (firstX < 0) - { - firstX = 0; - } - if (lastX > maxTilesX) - { - lastX = maxTilesX; - } - if (firstY < 0) - { - firstY = 0; - } - if (lastY > maxTilesY) - { - lastY = maxTilesY; - } - Lighting.LightTiles(firstX, lastX, firstY, lastY); - Color color1 = Color.White; - this.DrawWater(true); - caveParrallax = Main.caveParrallax; - num4 = ((int) -Math.IEEERemainder(screenPosition.X * caveParrallax, (double) backgroundWidth[1])) - (backgroundWidth[1] / 2); - num5 = (screenWidth / backgroundWidth[1]) + 2; - num8 = (int) ((((((int) worldSurface) * 0x10) - backgroundHeight[1]) - screenPosition.Y) + 16f); - for (int m = 0; m < num5; m++) - { - for (int num38 = 0; num38 < 6; num38++) - { - int num39 = ((num4 + (backgroundWidth[1] * m)) + (num38 * 0x10)) / 0x10; - int num40 = num8 / 0x10; - Color color6 = Lighting.GetColor(num39 + ((int) (screenPosition.X / 16f)), num40 + ((int) (screenPosition.Y / 16f))); - this.spriteBatch.Draw(backgroundTexture[1], new Vector2((float) ((num4 + (backgroundWidth[1] * m)) + (0x10 * num38)), (float) num8), new Rectangle(0x10 * num38, 0, 0x10, 0x10), color6); - } - } - double num41 = maxTilesY - 230; - double num42 = ((int) ((num41 - worldSurface) / 6.0)) * 6; - num41 = (worldSurface + num42) - 5.0; - bool flag = false; - bool flag2 = false; - num8 = (int) (((((int) worldSurface) * 0x10) - screenPosition.Y) + 16f); - if ((worldSurface * 16.0) <= (screenPosition.Y + screenHeight)) - { - caveParrallax = Main.caveParrallax; - num4 = ((int) -Math.IEEERemainder(100.0 + (screenPosition.X * caveParrallax), (double) backgroundWidth[2])) - (backgroundWidth[2] / 2); - num5 = (screenWidth / backgroundWidth[2]) + 2; - if ((worldSurface * 16.0) < (screenPosition.Y - 16f)) - { - num6 = ((int) Math.IEEERemainder((double) num8, (double) backgroundHeight[2])) - backgroundHeight[2]; - num7 = (screenHeight / backgroundHeight[2]) + 2; - } - else - { - num6 = num8; - num7 = ((screenHeight - num8) / backgroundHeight[2]) + 1; - } - if ((rockLayer * 16.0) < (screenPosition.Y + screenHeight)) - { - num7 = ((((int) ((rockLayer * 16.0) - screenPosition.Y)) + screenHeight) - num6) / backgroundHeight[2]; - flag2 = true; - } - for (int num43 = 0; num43 < num5; num43++) - { - for (int num44 = 0; num44 < num7; num44++) - { - this.spriteBatch.Draw(backgroundTexture[2], new Rectangle(num4 + (backgroundWidth[2] * num43), num6 + (backgroundHeight[2] * num44), backgroundWidth[2], backgroundHeight[2]), Color.White); - } - } - if (flag2) - { - caveParrallax = Main.caveParrallax; - num4 = ((int) -Math.IEEERemainder(screenPosition.X * caveParrallax, (double) backgroundWidth[1])) - (backgroundWidth[1] / 2); - num5 = (screenWidth / backgroundWidth[1]) + 2; - num8 = num6 + (num7 * backgroundHeight[2]); - for (int num45 = 0; num45 < num5; num45++) - { - for (int num46 = 0; num46 < 6; num46++) - { - int num1 = ((num4 + (backgroundWidth[4] * num45)) + (num46 * 0x10)) / 0x10; - int num97 = num8 / 0x10; - this.spriteBatch.Draw(backgroundTexture[4], new Vector2((float) ((num4 + (backgroundWidth[4] * num45)) + (0x10 * num46)), (float) num8), new Rectangle(0x10 * num46, 0, 0x10, 0x18), Color.White); - } - } - } - } - num8 = ((int) (((((int) rockLayer) * 0x10) - screenPosition.Y) + 16f)) + screenHeight; - if ((rockLayer * 16.0) <= (screenPosition.Y + screenHeight)) - { - caveParrallax = Main.caveParrallax; - num4 = ((int) -Math.IEEERemainder(100.0 + (screenPosition.X * caveParrallax), (double) backgroundWidth[3])) - (backgroundWidth[3] / 2); - num5 = (screenWidth / backgroundWidth[3]) + 2; - if (((rockLayer * 16.0) + screenHeight) < (screenPosition.Y - 16f)) - { - num6 = ((int) Math.IEEERemainder((double) num8, (double) backgroundHeight[3])) - backgroundHeight[3]; - num7 = (screenHeight / backgroundHeight[3]) + 2; - } - else - { - num6 = num8; - num7 = ((screenHeight - num8) / backgroundHeight[3]) + 1; - } - if ((num41 * 16.0) < (screenPosition.Y + screenHeight)) - { - num7 = ((((int) ((num41 * 16.0) - screenPosition.Y)) + screenHeight) - num6) / backgroundHeight[2]; - flag = true; - } - for (int num47 = 0; num47 < num5; num47++) - { - for (int num48 = 0; num48 < num7; num48++) - { - this.spriteBatch.Draw(backgroundTexture[3], new Rectangle(num4 + (backgroundWidth[2] * num47), num6 + (backgroundHeight[2] * num48), backgroundWidth[2], backgroundHeight[2]), Color.White); - } - } - if (flag) - { - caveParrallax = Main.caveParrallax; - num4 = (int) ((-Math.IEEERemainder(screenPosition.X * caveParrallax, (double) backgroundWidth[1]) - (backgroundWidth[1] / 2)) - 4.0); - num5 = (screenWidth / backgroundWidth[1]) + 2; - num8 = num6 + (num7 * backgroundHeight[2]); - for (int num49 = 0; num49 < num5; num49++) - { - for (int num50 = 0; num50 < 6; num50++) - { - int num51 = ((num4 + (backgroundWidth[1] * num49)) + (num50 * 0x10)) / 0x10; - int num52 = num8 / 0x10; - Lighting.GetColor(num51 + ((int) (screenPosition.X / 16f)), num52 + ((int) (screenPosition.Y / 16f))); - this.spriteBatch.Draw(backgroundTexture[6], new Vector2((float) ((num4 + (backgroundWidth[1] * num49)) + (0x10 * num50)), (float) num8), new Rectangle(0x10 * num50, magmaBGFrame * 0x18, 0x10, 0x18), Color.White); - } - } - } - } - num8 = (((int) (((((int) num41) * 0x10) - screenPosition.Y) + 16f)) + screenHeight) + 8; - if ((num41 * 16.0) <= (screenPosition.Y + screenHeight)) - { - num4 = ((int) -Math.IEEERemainder(100.0 + (screenPosition.X * caveParrallax), (double) backgroundWidth[3])) - (backgroundWidth[3] / 2); - num5 = (screenWidth / backgroundWidth[3]) + 2; - if (((num41 * 16.0) + screenHeight) < (screenPosition.Y - 16f)) - { - num6 = ((int) Math.IEEERemainder((double) num8, (double) backgroundHeight[3])) - backgroundHeight[3]; - num7 = (screenHeight / backgroundHeight[3]) + 2; - } - else - { - num6 = num8; - num7 = ((screenHeight - num8) / backgroundHeight[3]) + 1; - } - for (int num53 = 0; num53 < num5; num53++) - { - for (int num54 = 0; num54 < num7; num54++) - { - vector10 = new Vector2(); - this.spriteBatch.Draw(backgroundTexture[5], new Vector2((float) (num4 + (backgroundWidth[2] * num53)), (float) (num6 + (backgroundHeight[2] * num54))), new Rectangle(0, backgroundHeight[2] * magmaBGFrame, backgroundWidth[2], backgroundHeight[2]), Color.White, 0f, vector10, (float) 1f, SpriteEffects.None, 0f); - } - } - } - magmaBGFrameCounter++; - if (magmaBGFrameCounter >= 8) - { - magmaBGFrameCounter = 0; - magmaBGFrame++; - if (magmaBGFrame >= 3) - { - magmaBGFrame = 0; - } - } - try - { - for (int num55 = firstY; num55 < (lastY + 4); num55++) - { - for (int num56 = firstX - 2; num56 < (lastX + 2); num56++) - { - if (tile[num56, num55] == null) - { - tile[num56, num55] = new Tile(); - } - if (((Lighting.Brightness(num56, num55) * 255f) < (tileColor.R - 12)) || (num55 > worldSurface)) - { - vector10 = new Vector2(); - this.spriteBatch.Draw(blackTileTexture, new Vector2((float) ((num56 * 0x10) - ((int) screenPosition.X)), (float) ((num55 * 0x10) - ((int) screenPosition.Y))), new Rectangle(tile[num56, num55].frameX, tile[num56, num55].frameY, 0x10, 0x10), Lighting.GetBlackness(num56, num55), 0f, vector10, (float) 1f, SpriteEffects.None, 0f); - } - } - } - for (int num57 = firstY; num57 < (lastY + 4); num57++) - { - for (int num58 = firstX - 2; num58 < (lastX + 2); num58++) - { - if ((tile[num58, num57].wall > 0) && (Lighting.Brightness(num58, num57) > 0f)) - { - if ((tile[num58, num57].wallFrameY == 0x12) && (tile[num58, num57].wallFrameX >= 0x12)) - { - byte wallFrameY = tile[num58, num57].wallFrameY; - } - Rectangle rectangle3 = new Rectangle(tile[num58, num57].wallFrameX * 2, tile[num58, num57].wallFrameY * 2, 0x20, 0x20); - vector10 = new Vector2(); - this.spriteBatch.Draw(wallTexture[tile[num58, num57].wall], new Vector2((float) (((num58 * 0x10) - ((int) screenPosition.X)) - 8), (float) (((num57 * 0x10) - ((int) screenPosition.Y)) - 8)), new Rectangle?(rectangle3), Lighting.GetColor(num58, num57), 0f, vector10, (float) 1f, SpriteEffects.None, 0f); - } - } - } - this.DrawTiles(false); - this.DrawNPCs(true); - this.DrawTiles(true); - this.DrawGore(); - this.DrawNPCs(false); - } - catch - { - } - for (int n = 0; n < 0x3e8; n++) - { - if (!projectile[n].active || (projectile[n].type <= 0)) - { - continue; - } - if (projectile[n].type == 0x20) - { - Vector2 vector = new Vector2(projectile[n].position.X + (projectile[n].width * 0.5f), projectile[n].position.Y + (projectile[n].height * 0.5f)); - float num60 = (player[projectile[n].owner].position.X + (player[projectile[n].owner].width / 2)) - vector.X; - float num61 = (player[projectile[n].owner].position.Y + (player[projectile[n].owner].height / 2)) - vector.Y; - float num62 = ((float) Math.Atan2((double) num61, (double) num60)) - 1.57f; - bool flag3 = true; - if ((num60 == 0f) && (num61 == 0f)) - { - flag3 = false; - } - else - { - float num63 = (float) Math.Sqrt((double) ((num60 * num60) + (num61 * num61))); - num63 = 8f / num63; - num60 *= num63; - num61 *= num63; - vector.X -= num60; - vector.Y -= num61; - num60 = (player[projectile[n].owner].position.X + (player[projectile[n].owner].width / 2)) - vector.X; - num61 = (player[projectile[n].owner].position.Y + (player[projectile[n].owner].height / 2)) - vector.Y; - } - while (flag3) - { - float num64 = (float) Math.Sqrt((double) ((num60 * num60) + (num61 * num61))); - if (num64 < 28f) - { - flag3 = false; - } - else - { - num64 = 28f / num64; - num60 *= num64; - num61 *= num64; - vector.X += num60; - vector.Y += num61; - num60 = (player[projectile[n].owner].position.X + (player[projectile[n].owner].width / 2)) - vector.X; - num61 = (player[projectile[n].owner].position.Y + (player[projectile[n].owner].height / 2)) - vector.Y; - Color color7 = Lighting.GetColor(((int) vector.X) / 0x10, (int) (vector.Y / 16f)); - this.spriteBatch.Draw(chain5Texture, new Vector2(vector.X - screenPosition.X, vector.Y - screenPosition.Y), new Rectangle(0, 0, chain5Texture.Width, chain5Texture.Height), color7, num62, new Vector2(chain5Texture.Width * 0.5f, chain5Texture.Height * 0.5f), (float) 1f, SpriteEffects.None, 0f); - } - } - } - else if (projectile[n].aiStyle == 7) - { - Vector2 vector2 = new Vector2(projectile[n].position.X + (projectile[n].width * 0.5f), projectile[n].position.Y + (projectile[n].height * 0.5f)); - float num65 = (player[projectile[n].owner].position.X + (player[projectile[n].owner].width / 2)) - vector2.X; - float num66 = (player[projectile[n].owner].position.Y + (player[projectile[n].owner].height / 2)) - vector2.Y; - float num67 = ((float) Math.Atan2((double) num66, (double) num65)) - 1.57f; - bool flag4 = true; - while (flag4) - { - float num68 = (float) Math.Sqrt((double) ((num65 * num65) + (num66 * num66))); - if (num68 < 25f) - { - flag4 = false; - } - else - { - num68 = 12f / num68; - num65 *= num68; - num66 *= num68; - vector2.X += num65; - vector2.Y += num66; - num65 = (player[projectile[n].owner].position.X + (player[projectile[n].owner].width / 2)) - vector2.X; - num66 = (player[projectile[n].owner].position.Y + (player[projectile[n].owner].height / 2)) - vector2.Y; - Color color8 = Lighting.GetColor(((int) vector2.X) / 0x10, (int) (vector2.Y / 16f)); - this.spriteBatch.Draw(chainTexture, new Vector2(vector2.X - screenPosition.X, vector2.Y - screenPosition.Y), new Rectangle(0, 0, chainTexture.Width, chainTexture.Height), color8, num67, new Vector2(chainTexture.Width * 0.5f, chainTexture.Height * 0.5f), (float) 1f, SpriteEffects.None, 0f); - } - } - } - else if (projectile[n].aiStyle == 13) - { - float num69 = projectile[n].position.X + 8f; - float num70 = projectile[n].position.Y + 2f; - float num71 = projectile[n].velocity.X; - float num72 = projectile[n].velocity.Y; - float num73 = (float) Math.Sqrt((double) ((num71 * num71) + (num72 * num72))); - num73 = 20f / num73; - if (projectile[n].ai[0] == 0f) - { - num69 -= projectile[n].velocity.X * num73; - num70 -= projectile[n].velocity.Y * num73; - } - else - { - num69 += projectile[n].velocity.X * num73; - num70 += projectile[n].velocity.Y * num73; - } - Vector2 vector3 = new Vector2(num69, num70); - num71 = (player[projectile[n].owner].position.X + (player[projectile[n].owner].width / 2)) - vector3.X; - num72 = (player[projectile[n].owner].position.Y + (player[projectile[n].owner].height / 2)) - vector3.Y; - float num74 = ((float) Math.Atan2((double) num72, (double) num71)) - 1.57f; - if (projectile[n].alpha == 0) - { - if (player[projectile[n].owner].direction == 1) - { - player[projectile[n].owner].itemRotation = num74 - 1.57f; - } - else - { - player[projectile[n].owner].itemRotation = num74 + 1.57f; - } - } - bool flag5 = true; - while (flag5) - { - float num75 = (float) Math.Sqrt((double) ((num71 * num71) + (num72 * num72))); - if (num75 < 25f) - { - flag5 = false; - } - else - { - num75 = 12f / num75; - num71 *= num75; - num72 *= num75; - vector3.X += num71; - vector3.Y += num72; - num71 = (player[projectile[n].owner].position.X + (player[projectile[n].owner].width / 2)) - vector3.X; - num72 = (player[projectile[n].owner].position.Y + (player[projectile[n].owner].height / 2)) - vector3.Y; - Color color9 = Lighting.GetColor(((int) vector3.X) / 0x10, (int) (vector3.Y / 16f)); - this.spriteBatch.Draw(chainTexture, new Vector2(vector3.X - screenPosition.X, vector3.Y - screenPosition.Y), new Rectangle(0, 0, chainTexture.Width, chainTexture.Height), color9, num74, new Vector2(chainTexture.Width * 0.5f, chainTexture.Height * 0.5f), (float) 1f, SpriteEffects.None, 0f); - } - } - } - else if (projectile[n].aiStyle == 15) - { - Vector2 vector4 = new Vector2(projectile[n].position.X + (projectile[n].width * 0.5f), projectile[n].position.Y + (projectile[n].height * 0.5f)); - float num76 = (player[projectile[n].owner].position.X + (player[projectile[n].owner].width / 2)) - vector4.X; - float num77 = (player[projectile[n].owner].position.Y + (player[projectile[n].owner].height / 2)) - vector4.Y; - float num78 = ((float) Math.Atan2((double) num77, (double) num76)) - 1.57f; - if (projectile[n].alpha == 0) - { - if (player[projectile[n].owner].direction == 1) - { - player[projectile[n].owner].itemRotation = num78 - 1.57f; - } - else - { - player[projectile[n].owner].itemRotation = num78 + 1.57f; - } - } - bool flag6 = true; - while (flag6) - { - float num79 = (float) Math.Sqrt((double) ((num76 * num76) + (num77 * num77))); - if (num79 < 25f) - { - flag6 = false; - } - else - { - num79 = 12f / num79; - num76 *= num79; - num77 *= num79; - vector4.X += num76; - vector4.Y += num77; - num76 = (player[projectile[n].owner].position.X + (player[projectile[n].owner].width / 2)) - vector4.X; - num77 = (player[projectile[n].owner].position.Y + (player[projectile[n].owner].height / 2)) - vector4.Y; - Color color10 = Lighting.GetColor(((int) vector4.X) / 0x10, (int) (vector4.Y / 16f)); - if (projectile[n].type == 0x19) - { - this.spriteBatch.Draw(chain2Texture, new Vector2(vector4.X - screenPosition.X, vector4.Y - screenPosition.Y), new Rectangle(0, 0, chain2Texture.Width, chain2Texture.Height), color10, num78, new Vector2(chain2Texture.Width * 0.5f, chain2Texture.Height * 0.5f), (float) 1f, SpriteEffects.None, 0f); - continue; - } - if (projectile[n].type == 0x23) - { - this.spriteBatch.Draw(chain6Texture, new Vector2(vector4.X - screenPosition.X, vector4.Y - screenPosition.Y), new Rectangle(0, 0, chain6Texture.Width, chain6Texture.Height), color10, num78, new Vector2(chain6Texture.Width * 0.5f, chain6Texture.Height * 0.5f), (float) 1f, SpriteEffects.None, 0f); - continue; - } - this.spriteBatch.Draw(chain3Texture, new Vector2(vector4.X - screenPosition.X, vector4.Y - screenPosition.Y), new Rectangle(0, 0, chain3Texture.Width, chain3Texture.Height), color10, num78, new Vector2(chain3Texture.Width * 0.5f, chain3Texture.Height * 0.5f), (float) 1f, SpriteEffects.None, 0f); - } - } - } - Color newColor = Lighting.GetColor(((int) (projectile[n].position.X + (projectile[n].width * 0.5))) / 0x10, (int) ((projectile[n].position.Y + (projectile[n].height * 0.5)) / 16.0)); - if (projectile[n].type == 14) - { - newColor = Color.White; - } - int num80 = 0; - if (projectile[n].type == 0x10) - { - num80 = 6; - } - if ((projectile[n].type == 0x11) || (projectile[n].type == 0x1f)) - { - num80 = 2; - } - if (((projectile[n].type == 0x19) || (projectile[n].type == 0x1a)) || (projectile[n].type == 30)) - { - num80 = 6; - } - if ((projectile[n].type == 0x1c) || (projectile[n].type == 0x25)) - { - num80 = 8; - } - if (projectile[n].type == 0x1d) - { - num80 = 11; - } - float num81 = ((projectileTexture[projectile[n].type].Width - projectile[n].width) * 0.5f) + (projectile[n].width * 0.5f); - this.spriteBatch.Draw(projectileTexture[projectile[n].type], new Vector2((projectile[n].position.X - screenPosition.X) + num81, (projectile[n].position.Y - screenPosition.Y) + (projectile[n].height / 2)), new Rectangle(0, 0, projectileTexture[projectile[n].type].Width, projectileTexture[projectile[n].type].Height), projectile[n].GetAlpha(newColor), projectile[n].rotation, new Vector2(num81, (float) ((projectile[n].height / 2) + num80)), projectile[n].scale, SpriteEffects.None, 0f); - } - for (int num82 = 0; num82 < 8; num82++) - { - if (player[num82].active) - { - if (((((player[num82].head == 5) && (player[num82].body == 5)) && (player[num82].legs == 5)) || (((player[num82].head == 7) && (player[num82].body == 7)) && (player[num82].legs == 7))) || (((player[num82].head == 8) && (player[num82].body == 8)) && (player[num82].legs == 8))) - { - Vector2 position = player[num82].position; - player[num82].position = player[num82].shadowPos[0]; - player[num82].shadow = 0.5f; - this.DrawPlayer(player[num82]); - player[num82].position = player[num82].shadowPos[1]; - player[num82].shadow = 0.7f; - this.DrawPlayer(player[num82]); - player[num82].position = player[num82].shadowPos[2]; - player[num82].shadow = 0.9f; - this.DrawPlayer(player[num82]); - player[num82].position = position; - player[num82].shadow = 0f; - } - this.DrawPlayer(player[num82]); - } - } - for (int num83 = 0; num83 < 200; num83++) - { - if (item[num83].active && (item[num83].type > 0)) - { - int num99 = ((int) (item[num83].position.X + (item[num83].width * 0.5))) / 0x10; - int num100 = ((int) (item[num83].position.Y + (item[num83].height * 0.5))) / 0x10; - Color color12 = Lighting.GetColor(((int) (item[num83].position.X + (item[num83].width * 0.5))) / 0x10, ((int) (item[num83].position.Y + (item[num83].height * 0.5))) / 0x10); - vector10 = new Vector2(); - this.spriteBatch.Draw(itemTexture[item[num83].type], new Vector2(((item[num83].position.X - screenPosition.X) + (item[num83].width / 2)) - (itemTexture[item[num83].type].Width / 2), ((item[num83].position.Y - screenPosition.Y) + (item[num83].height / 2)) - (itemTexture[item[num83].type].Height / 2)), new Rectangle(0, 0, itemTexture[item[num83].type].Width, itemTexture[item[num83].type].Height), item[num83].GetAlpha(color12), 0f, vector10, (float) 1f, SpriteEffects.None, 0f); - color16 = new Color(); - if (item[num83].color != color16) - { - vector10 = new Vector2(); - this.spriteBatch.Draw(itemTexture[item[num83].type], new Vector2(((item[num83].position.X - screenPosition.X) + (item[num83].width / 2)) - (itemTexture[item[num83].type].Width / 2), ((item[num83].position.Y - screenPosition.Y) + (item[num83].height / 2)) - (itemTexture[item[num83].type].Height / 2)), new Rectangle(0, 0, itemTexture[item[num83].type].Width, itemTexture[item[num83].type].Height), item[num83].GetColor(color12), 0f, vector10, (float) 1f, SpriteEffects.None, 0f); - } - } - } - Rectangle rectangle4 = new Rectangle(((int) screenPosition.X) - 50, ((int) screenPosition.Y) - 50, screenWidth + 100, screenHeight + 100); - for (int num84 = 0; num84 < 0x7d0; num84++) - { - if (dust[num84].active) - { - Rectangle rectangle5 = new Rectangle((int) dust[num84].position.X, (int) dust[num84].position.Y, 4, 4); - if (rectangle5.Intersects(rectangle4)) - { - Color color13 = Lighting.GetColor(((int) (dust[num84].position.X + 4.0)) / 0x10, ((int) (dust[num84].position.Y + 4.0)) / 0x10); - if (((dust[num84].type == 6) || (dust[num84].type == 15)) || dust[num84].noLight) - { - color13 = Color.White; - } - this.spriteBatch.Draw(dustTexture, dust[num84].position - screenPosition, new Rectangle?(dust[num84].frame), dust[num84].GetAlpha(color13), dust[num84].rotation, new Vector2(4f, 4f), dust[num84].scale, SpriteEffects.None, 0f); - color16 = new Color(); - if (dust[num84].color != color16) - { - this.spriteBatch.Draw(dustTexture, dust[num84].position - screenPosition, new Rectangle?(dust[num84].frame), dust[num84].GetColor(color13), dust[num84].rotation, new Vector2(4f, 4f), dust[num84].scale, SpriteEffects.None, 0f); - } - } - else - { - dust[num84].active = false; - } - } - } - this.DrawWater(false); - if (!hideUI) - { - for (int num85 = 0; num85 < 8; num85++) - { - if ((player[num85].active && (player[num85].chatShowTime > 0)) && ((num85 != myPlayer) && !player[num85].dead)) - { - Vector2 vector6; - Vector2 vector7 = fontMouseText.MeasureString(player[num85].chatText); - vector6.X = (player[num85].position.X + (player[num85].width / 2)) - (vector7.X / 2f); - vector6.Y = (player[num85].position.Y - vector7.Y) - 2f; - for (int num86 = 0; num86 < 5; num86++) - { - int num87 = 0; - int num88 = 0; - Color black = Color.Black; - switch (num86) - { - case 0: - num87 = -2; - break; - - case 1: - num87 = 2; - break; - - case 2: - num88 = -2; - break; - - case 3: - num88 = 2; - break; - - case 4: - black = new Color((int) mouseTextColor, (int) mouseTextColor, (int) mouseTextColor, (int) mouseTextColor); - break; - } - vector10 = new Vector2(); - this.spriteBatch.DrawString(fontMouseText, player[num85].chatText, new Vector2((vector6.X + num87) - screenPosition.X, (vector6.Y + num88) - screenPosition.Y), black, 0f, vector10, (float) 1f, SpriteEffects.None, 0f); - } - } - } - for (int num89 = 0; num89 < 100; num89++) - { - if (combatText[num89].active) - { - Vector2 vector8 = fontCombatText.MeasureString(combatText[num89].text); - Vector2 origin = new Vector2(vector8.X * 0.5f, vector8.Y * 0.5f); - float single1 = combatText[num89].scale; - float num90 = combatText[num89].color.R; - float num91 = combatText[num89].color.G; - float num92 = combatText[num89].color.B; - float a = combatText[num89].color.A; - num90 *= (combatText[num89].scale * combatText[num89].alpha) * 0.3f; - num92 *= (combatText[num89].scale * combatText[num89].alpha) * 0.3f; - num91 *= (combatText[num89].scale * combatText[num89].alpha) * 0.3f; - a *= combatText[num89].scale * combatText[num89].alpha; - Color color15 = new Color((int) num90, (int) num91, (int) num92, (int) a); - for (int num94 = 0; num94 < 5; num94++) - { - int num95 = 0; - int num96 = 0; - switch (num94) - { - case 0: - num95--; - break; - - case 1: - num95++; - break; - - case 2: - num96--; - break; - - case 3: - num96++; - break; - - default: - num90 = (combatText[num89].color.R * combatText[num89].scale) * combatText[num89].alpha; - num92 = (combatText[num89].color.B * combatText[num89].scale) * combatText[num89].alpha; - num91 = (combatText[num89].color.G * combatText[num89].scale) * combatText[num89].alpha; - a = (combatText[num89].color.A * combatText[num89].scale) * combatText[num89].alpha; - color15 = new Color((int) num90, (int) num91, (int) num92, (int) a); - break; - } - this.spriteBatch.DrawString(fontCombatText, combatText[num89].text, new Vector2(((combatText[num89].position.X - screenPosition.X) + num95) + origin.X, ((combatText[num89].position.Y - screenPosition.Y) + num96) + origin.Y), color15, combatText[num89].rotation, origin, combatText[num89].scale, SpriteEffects.None, 0f); - } - } - } - if (((netMode == 1) && (Netplay.clientSock.statusText != "")) && (Netplay.clientSock.statusText != null)) - { - string text = string.Concat(new object[] { Netplay.clientSock.statusText, ": ", (int) ((((float) Netplay.clientSock.statusCount) / ((float) Netplay.clientSock.statusMax)) * 100f), "%" }); - this.spriteBatch.DrawString(fontMouseText, text, new Vector2(628f - (fontMouseText.MeasureString(text).X * 0.5f), 84f), new Color(mouseTextColor, mouseTextColor, mouseTextColor, mouseTextColor), 0f, new Vector2(), (float) 1f, SpriteEffects.None, 0f); - } - this.DrawFPS(); - this.DrawInterface(); - } - this.spriteBatch.End(); - if (mouseState.LeftButton == ButtonState.Pressed) - { - mouseLeftRelease = false; - } - else - { - mouseLeftRelease = true; - } - if (mouseState.RightButton == ButtonState.Pressed) - { - mouseRightRelease = false; - } - else - { - mouseRightRelease = true; - } - if (mouseState.RightButton != ButtonState.Pressed) - { - stackSplit = 0; - } - if (stackSplit > 0) - { - stackSplit--; - } - } - } - } - - protected void DrawChat() - { - if ((player[myPlayer].talkNPC < 0) && (player[myPlayer].sign == -1)) - { - npcChatText = ""; - } - else - { - Color color = new Color(200, 200, 200, 200); - int r = ((mouseTextColor * 2) + 0xff) / 3; - Color color2 = new Color(r, r, r, r); - int num2 = 10; - int index = 0; - string[] strArray = new string[num2]; - int startIndex = 0; - int num5 = 0; - if (npcChatText == null) - { - npcChatText = ""; - } - for (int i = 0; i < npcChatText.Length; i++) - { - if (Encoding.ASCII.GetBytes(npcChatText.Substring(i, 1))[0] == 10) - { - strArray[index] = npcChatText.Substring(startIndex, i - startIndex); - index++; - startIndex = i + 1; - num5 = i + 1; - } - else if ((npcChatText.Substring(i, 1) == " ") || (i == (npcChatText.Length - 1))) - { - if (fontMouseText.MeasureString(npcChatText.Substring(startIndex, i - startIndex)).X > 470f) - { - strArray[index] = npcChatText.Substring(startIndex, num5 - startIndex); - index++; - startIndex = num5 + 1; - } - num5 = i; - } - if (index == 10) - { - npcChatText = npcChatText.Substring(0, i - 1); - startIndex = i - 1; - index = 9; - break; - } - } - if (index < 10) - { - strArray[index] = npcChatText.Substring(startIndex, npcChatText.Length - startIndex); - } - if (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[] strArray2; - IntPtr ptr; - (strArray2 = strArray)[(int) (ptr = (IntPtr) index)] = strArray2[(int) ptr] + "|"; - } - } - index++; - this.spriteBatch.Draw(chatBackTexture, new Vector2((float) ((screenWidth / 2) - (chatBackTexture.Width / 2)), 100f), new Rectangle(0, 0, chatBackTexture.Width, (index + 1) * 30), color, 0f, new Vector2(), (float) 1f, SpriteEffects.None, 0f); - this.spriteBatch.Draw(chatBackTexture, new Vector2((float) ((screenWidth / 2) - (chatBackTexture.Width / 2)), (float) (100 + ((index + 1) * 30))), new Rectangle(0, chatBackTexture.Height - 30, chatBackTexture.Width, 30), color, 0f, new Vector2(), (float) 1f, SpriteEffects.None, 0f); - for (int j = 0; j < index; j++) - { - for (int n = 0; n < 5; n++) - { - Color black = Color.Black; - int num9 = 170; - int num10 = 120 + (j * 30); - switch (n) - { - case 0: - num9 -= 2; - break; - - case 1: - num9 += 2; - break; - - case 2: - num10 -= 2; - break; - - case 3: - num10 += 2; - break; - - case 4: - black = color2; - break; - } - Vector2 origin = new Vector2(); - this.spriteBatch.DrawString(fontMouseText, strArray[j], new Vector2((float) num9, (float) num10), black, 0f, origin, (float) 1f, SpriteEffects.None, 0f); - } - } - r = mouseTextColor; - color2 = new Color(r, (int) (((double) r) / 1.1), r / 2, r); - string text = ""; - int price = player[myPlayer].statLifeMax - player[myPlayer].statLife; - if (player[myPlayer].sign > -1) - { - if (editSign) - { - text = "Save"; - } - else - { - text = "Edit"; - } - } - else if (((npc[player[myPlayer].talkNPC].type == 0x11) || (npc[player[myPlayer].talkNPC].type == 0x13)) || ((npc[player[myPlayer].talkNPC].type == 20) || (npc[player[myPlayer].talkNPC].type == 0x26))) - { - text = "Shop"; - } - else if (npc[player[myPlayer].talkNPC].type == 0x16) - { - text = "Help"; - } - else if (npc[player[myPlayer].talkNPC].type == 0x12) - { - string str2 = ""; - int num12 = 0; - int num13 = 0; - int num14 = 0; - int num15 = 0; - int num16 = price; - if (num16 > 0) - { - num16 = (int) (num16 * 0.75); - if (num16 < 1) - { - num16 = 1; - } - } - if (num16 < 0) - { - num16 = 0; - } - if (num16 >= 0xf4240) - { - num12 = num16 / 0xf4240; - num16 -= num12 * 0xf4240; - } - if (num16 >= 0x2710) - { - num13 = num16 / 0x2710; - num16 -= num13 * 0x2710; - } - if (num16 >= 100) - { - num14 = num16 / 100; - num16 -= num14 * 100; - } - if (num16 >= 1) - { - num15 = num16; - } - if (num12 > 0) - { - str2 = str2 + num12 + " platinum "; - } - if (num13 > 0) - { - str2 = str2 + num13 + " gold "; - } - if (num14 > 0) - { - str2 = str2 + num14 + " silver "; - } - if (num15 > 0) - { - str2 = str2 + num15 + " copper "; - } - float num17 = ((float) mouseTextColor) / 255f; - if (num12 > 0) - { - color2 = new Color((int) ((byte) (220f * num17)), (int) ((byte) (220f * num17)), (int) ((byte) (198f * num17)), (int) mouseTextColor); - } - else if (num13 > 0) - { - color2 = new Color((int) ((byte) (224f * num17)), (int) ((byte) (201f * num17)), (int) ((byte) (92f * num17)), (int) mouseTextColor); - } - else if (num14 > 0) - { - color2 = new Color((int) ((byte) (181f * num17)), (int) ((byte) (192f * num17)), (int) ((byte) (193f * num17)), (int) mouseTextColor); - } - else if (num15 > 0) - { - color2 = new Color((int) ((byte) (246f * num17)), (int) ((byte) (138f * num17)), (int) ((byte) (96f * num17)), (int) mouseTextColor); - } - text = "Heal (" + str2 + ")"; - if (num16 == 0) - { - text = "Heal"; - } - } - int num18 = 180; - int num19 = 130 + (index * 30); - float scale = 0.9f; - if (((mouseState.X > num18) && (mouseState.X < (num18 + fontMouseText.MeasureString(text).X))) && ((mouseState.Y > num19) && (mouseState.Y < (num19 + fontMouseText.MeasureString(text).Y)))) - { - player[myPlayer].mouseInterface = true; - scale = 1.1f; - if (!npcChatFocus2) - { - PlaySound(12, -1, -1, 1); - } - npcChatFocus2 = true; - player[myPlayer].releaseUseItem = false; - } - else - { - if (npcChatFocus2) - { - PlaySound(12, -1, -1, 1); - } - npcChatFocus2 = false; - } - for (int k = 0; k < 5; k++) - { - int num22 = num18; - int num23 = num19; - Color color4 = Color.Black; - switch (k) - { - case 0: - num22 -= 2; - break; - - case 1: - num22 += 2; - break; - - case 2: - num23 -= 2; - break; - - case 3: - num23 += 2; - break; - - case 4: - color4 = color2; - break; - } - Vector2 vector = (Vector2) (fontMouseText.MeasureString(text) * 0.5f); - this.spriteBatch.DrawString(fontMouseText, text, new Vector2(num22 + vector.X, num23 + vector.Y), color4, 0f, vector, scale, SpriteEffects.None, 0f); - } - color2 = new Color(r, (int) (((double) r) / 1.1), r / 2, r); - num18 = (num18 + ((int) fontMouseText.MeasureString(text).X)) + 20; - num19 = 130 + (index * 30); - scale = 0.9f; - if (((mouseState.X > num18) && (mouseState.X < (num18 + fontMouseText.MeasureString("Close").X))) && ((mouseState.Y > num19) && (mouseState.Y < (num19 + fontMouseText.MeasureString("Close").Y)))) - { - scale = 1.1f; - if (!npcChatFocus1) - { - PlaySound(12, -1, -1, 1); - } - npcChatFocus1 = true; - player[myPlayer].releaseUseItem = false; - } - else - { - if (npcChatFocus1) - { - PlaySound(12, -1, -1, 1); - } - npcChatFocus1 = false; - } - for (int m = 0; m < 5; m++) - { - int num25 = num18; - int num26 = num19; - Color color5 = Color.Black; - switch (m) - { - case 0: - num25 -= 2; - break; - - case 1: - num25 += 2; - break; - - case 2: - num26 -= 2; - break; - - case 3: - num26 += 2; - break; - - case 4: - color5 = color2; - break; - } - Vector2 vector2 = (Vector2) (fontMouseText.MeasureString("Close") * 0.5f); - this.spriteBatch.DrawString(fontMouseText, "Close", new Vector2(num25 + vector2.X, num26 + vector2.Y), color5, 0f, vector2, scale, SpriteEffects.None, 0f); - } - if ((mouseState.LeftButton == ButtonState.Pressed) && mouseLeftRelease) - { - mouseLeftRelease = false; - player[myPlayer].releaseUseItem = false; - player[myPlayer].mouseInterface = true; - if (npcChatFocus1) - { - player[myPlayer].talkNPC = -1; - player[myPlayer].sign = -1; - editSign = false; - npcChatText = ""; - PlaySound(11, -1, -1, 1); - } - else if (npcChatFocus2) - { - if (player[myPlayer].sign != -1) - { - if (!editSign) - { - PlaySound(12, -1, -1, 1); - editSign = true; - } - else - { - PlaySound(12, -1, -1, 1); - int sign = player[myPlayer].sign; - Sign.TextSign(sign, npcChatText); - editSign = false; - if (netMode == 1) - { - NetMessage.SendData(0x2f, -1, -1, "", sign, 0f, 0f, 0f); - } - } - } - else if (npc[player[myPlayer].talkNPC].type == 0x11) - { - playerInventory = true; - npcChatText = ""; - npcShop = 1; - PlaySound(12, -1, -1, 1); - } - else if (npc[player[myPlayer].talkNPC].type == 0x13) - { - playerInventory = true; - npcChatText = ""; - npcShop = 2; - PlaySound(12, -1, -1, 1); - } - else if (npc[player[myPlayer].talkNPC].type == 20) - { - playerInventory = true; - npcChatText = ""; - npcShop = 3; - PlaySound(12, -1, -1, 1); - } - else if (npc[player[myPlayer].talkNPC].type == 0x26) - { - playerInventory = true; - npcChatText = ""; - npcShop = 4; - PlaySound(12, -1, -1, 1); - } - else if (npc[player[myPlayer].talkNPC].type == 0x16) - { - PlaySound(12, -1, -1, 1); - HelpText(); - } - else if (npc[player[myPlayer].talkNPC].type == 0x12) - { - PlaySound(12, -1, -1, 1); - if (price > 0) - { - if (player[myPlayer].BuyItem(price)) - { - PlaySound(2, -1, -1, 4); - player[myPlayer].HealEffect(player[myPlayer].statLifeMax - player[myPlayer].statLife); - if (player[myPlayer].statLife < (player[myPlayer].statLifeMax * 0.25)) - { - npcChatText = "I managed to sew your face back on. Be more careful next time."; - } - else if (player[myPlayer].statLife < (player[myPlayer].statLifeMax * 0.5)) - { - npcChatText = "That's probably going to leave a scar."; - } - else if (player[myPlayer].statLife < (player[myPlayer].statLifeMax * 0.75)) - { - npcChatText = "All better. I don't want to see you jumping off anymore cliffs."; - } - else - { - npcChatText = "That didn't hurt too bad, now did it?"; - } - player[myPlayer].statLife = player[myPlayer].statLifeMax; - } - else - { - switch (rand.Next(3)) - { - case 0: - npcChatText = "I'm sorry, but you can't afford me."; - break; - - case 1: - npcChatText = "I'm gonna need more gold then that."; - break; - - case 2: - npcChatText = "I don't work for free you know."; - return; - } - } - } - else - { - switch (rand.Next(3)) - { - case 0: - npcChatText = "I don't give happy endings."; - break; - - case 1: - npcChatText = "I can't do anymore for you without plastic surgery."; - break; - - case 2: - npcChatText = "Quit wasting my time."; - break; - } - } - } - } - } - } - } - - protected void DrawFPS() - { - if (showFrameRate) - { - string text = frameRate.ToString(); - this.spriteBatch.DrawString(fontMouseText, text, new Vector2(4f, (float) (screenHeight - 0x18)), new Color(mouseTextColor, mouseTextColor, mouseTextColor, mouseTextColor), 0f, new Vector2(), (float) 1f, SpriteEffects.None, 0f); - } - } - - protected void DrawGore() - { - for (int i = 0; i < 200; i++) - { - if (gore[i].active && (gore[i].type > 0)) - { - Color alpha = gore[i].GetAlpha(Lighting.GetColor(((int) (gore[i].position.X + (goreTexture[gore[i].type].Width * 0.5))) / 0x10, (int) ((gore[i].position.Y + (goreTexture[gore[i].type].Height * 0.5)) / 16.0))); - this.spriteBatch.Draw(goreTexture[gore[i].type], new Vector2((gore[i].position.X - screenPosition.X) + (goreTexture[gore[i].type].Width / 2), (gore[i].position.Y - screenPosition.Y) + (goreTexture[gore[i].type].Height / 2)), new Rectangle(0, 0, goreTexture[gore[i].type].Width, goreTexture[gore[i].type].Height), alpha, gore[i].rotation, new Vector2((float) (goreTexture[gore[i].type].Width / 2), (float) (goreTexture[gore[i].type].Height / 2)), gore[i].scale, SpriteEffects.None, 0f); - } - } - } - - protected void DrawInterface() - { - if (!hideUI) - { - Vector2 vector6; - object obj2; - Color color22; - if (signBubble) - { - int num = signX - ((int) screenPosition.X); - int num2 = signY - ((int) screenPosition.Y); - SpriteEffects none = SpriteEffects.None; - if (signX > (player[myPlayer].position.X + player[myPlayer].width)) - { - none = SpriteEffects.FlipHorizontally; - num += -8 - chat2Texture.Width; - } - else - { - num += 8; - } - num2 -= 0x16; - vector6 = new Vector2(); - this.spriteBatch.Draw(chat2Texture, new Vector2((float) num, (float) num2), new Rectangle(0, 0, chat2Texture.Width, chat2Texture.Height), new Color(mouseTextColor, mouseTextColor, mouseTextColor, mouseTextColor), 0f, vector6, (float) 1f, none, 0f); - signBubble = false; - } - for (int i = 0; i < 8; i++) - { - if ((player[i].active && (myPlayer != i)) && !player[i].dead) - { - new Rectangle((int) ((player[i].position.X + (player[i].width * 0.5)) - 16.0), (int) ((player[i].position.Y + player[i].height) - 48f), 0x20, 0x30); - if ((player[myPlayer].team > 0) && (player[myPlayer].team == player[i].team)) - { - new Rectangle((int) screenPosition.X, (int) screenPosition.Y, screenWidth, screenHeight); - string name = player[i].name; - if (player[i].statLife < player[i].statLifeMax) - { - obj2 = name; - name = string.Concat(new object[] { obj2, ": ", player[i].statLife, "/", player[i].statLifeMax }); - } - Vector2 position = fontMouseText.MeasureString(name); - float num4 = 0f; - if (player[i].chatShowTime > 0) - { - num4 = -position.Y; - } - float num5 = 0f; - float num6 = ((float) mouseTextColor) / 255f; - Color color = new Color((int) ((byte) (teamColor[player[i].team].R * num6)), (int) ((byte) (teamColor[player[i].team].G * num6)), (int) ((byte) (teamColor[player[i].team].B * num6)), (int) mouseTextColor); - Vector2 vector2 = new Vector2((screenWidth / 2) + screenPosition.X, (screenHeight / 2) + screenPosition.Y); - float num7 = (player[i].position.X + (player[i].width / 2)) - vector2.X; - float num8 = (((player[i].position.Y - position.Y) - 2f) + num4) - vector2.Y; - float num9 = (float) Math.Sqrt((double) ((num7 * num7) + (num8 * num8))); - if (num9 < 270f) - { - position.X = ((player[i].position.X + (player[i].width / 2)) - (position.X / 2f)) - screenPosition.X; - position.Y = (((player[i].position.Y - position.Y) - 2f) + num4) - screenPosition.Y; - } - else - { - num5 = num9; - num9 = 270f / num9; - position.X = ((screenWidth / 2) + (num7 * num9)) - (position.X / 2f); - position.Y = (screenHeight / 2) + (num8 * num9); - } - if (num5 > 0f) - { - string text = "(" + ((int) ((num5 / 16f) * 2f)) + " ft)"; - Vector2 vector3 = fontMouseText.MeasureString(text); - vector3.X = (position.X + (fontMouseText.MeasureString(name).X / 2f)) - (vector3.X / 2f); - vector3.Y = ((position.Y + (fontMouseText.MeasureString(name).Y / 2f)) - (vector3.Y / 2f)) - 20f; - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontMouseText, text, new Vector2(vector3.X - 2f, vector3.Y), Color.Black, 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontMouseText, text, new Vector2(vector3.X + 2f, vector3.Y), Color.Black, 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontMouseText, text, new Vector2(vector3.X, vector3.Y - 2f), Color.Black, 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontMouseText, text, new Vector2(vector3.X, vector3.Y + 2f), Color.Black, 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontMouseText, text, vector3, color, 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - } - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontMouseText, name, new Vector2(position.X - 2f, position.Y), Color.Black, 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontMouseText, name, new Vector2(position.X + 2f, position.Y), Color.Black, 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontMouseText, name, new Vector2(position.X, position.Y - 2f), Color.Black, 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontMouseText, name, new Vector2(position.X, position.Y + 2f), Color.Black, 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontMouseText, name, position, color, 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - } - } - } - if ((npcChatText != "") || (player[myPlayer].sign != -1)) - { - this.DrawChat(); - } - Color color2 = new Color(200, 200, 200, 200); - bool flag = false; - int rare = 0; - int num11 = player[myPlayer].statLifeMax / 20; - if (num11 >= 10) - { - num11 = 10; - } - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontMouseText, "Life", new Vector2((500 + (13 * num11)) - (fontMouseText.MeasureString("Life").X * 0.5f), 6f), new Color(mouseTextColor, mouseTextColor, mouseTextColor, mouseTextColor), 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - int num12 = 20; - for (int j = 1; j < ((player[myPlayer].statLifeMax / num12) + 1); j++) - { - int r = 0xff; - float scale = 1f; - if (player[myPlayer].statLife >= (j * num12)) - { - r = 0xff; - } - else - { - float num16 = ((float) (player[myPlayer].statLife - ((j - 1) * num12))) / ((float) num12); - r = (int) (30f + (225f * num16)); - if (r < 30) - { - r = 30; - } - scale = (num16 / 4f) + 0.75f; - if (scale < 0.75) - { - scale = 0.75f; - } - } - int num17 = 0; - int num18 = 0; - if (j > 10) - { - num17 -= 260; - num18 += 0x1a; - } - vector6 = new Vector2(); - this.spriteBatch.Draw(heartTexture, new Vector2((float) ((500 + (0x1a * (j - 1))) + num17), (32f + ((heartTexture.Height - (heartTexture.Height * scale)) / 2f)) + num18), new Rectangle(0, 0, heartTexture.Width, heartTexture.Height), new Color(r, r, r, r), 0f, vector6, scale, SpriteEffects.None, 0f); - } - int num19 = 20; - if (player[myPlayer].statManaMax > 0) - { - int num1 = player[myPlayer].statManaMax / 20; - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontMouseText, "Mana", new Vector2(750f, 6f), new Color(mouseTextColor, mouseTextColor, mouseTextColor, mouseTextColor), 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - for (int n = 1; n < ((player[myPlayer].statManaMax / num19) + 1); n++) - { - int num21 = 0xff; - float num22 = 1f; - if (player[myPlayer].statMana >= (n * num19)) - { - num21 = 0xff; - } - else - { - float num23 = ((float) (player[myPlayer].statMana - ((n - 1) * num19))) / ((float) num19); - num21 = (int) (30f + (225f * num23)); - if (num21 < 30) - { - num21 = 30; - } - num22 = (num23 / 4f) + 0.75f; - if (num22 < 0.75) - { - num22 = 0.75f; - } - } - this.spriteBatch.Draw(manaTexture, new Vector2(775f, ((30 + (manaTexture.Height / 2)) + ((manaTexture.Height - (manaTexture.Height * num22)) / 2f)) + (0x1c * (n - 1))), new Rectangle(0, 0, manaTexture.Width, manaTexture.Height), new Color(num21, num21, num21, num21), 0f, new Vector2((float) (manaTexture.Width / 2), (float) (manaTexture.Height / 2)), num22, SpriteEffects.None, 0f); - } - } - if (player[myPlayer].breath < player[myPlayer].breathMax) - { - int num24 = 0x4c; - int num131 = player[myPlayer].breathMax / 20; - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontMouseText, "Breath", new Vector2((500 + (13 * num11)) - (fontMouseText.MeasureString("Breath").X * 0.5f), (float) (6 + num24)), new Color(mouseTextColor, mouseTextColor, mouseTextColor, mouseTextColor), 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - int num25 = 20; - for (int num26 = 1; num26 < ((player[myPlayer].breathMax / num25) + 1); num26++) - { - int num27 = 0xff; - float num28 = 1f; - if (player[myPlayer].breath >= (num26 * num25)) - { - num27 = 0xff; - } - else - { - float num29 = ((float) (player[myPlayer].breath - ((num26 - 1) * num25))) / ((float) num25); - num27 = (int) (30f + (225f * num29)); - if (num27 < 30) - { - num27 = 30; - } - num28 = (num29 / 4f) + 0.75f; - if (num28 < 0.75) - { - num28 = 0.75f; - } - } - int num30 = 0; - int num31 = 0; - if (num26 > 10) - { - num30 -= 260; - num31 += 0x1a; - } - vector6 = new Vector2(); - this.spriteBatch.Draw(bubbleTexture, new Vector2((float) ((500 + (0x1a * (num26 - 1))) + num30), ((32f + ((bubbleTexture.Height - (bubbleTexture.Height * num28)) / 2f)) + num31) + num24), new Rectangle(0, 0, bubbleTexture.Width, bubbleTexture.Height), new Color(num27, num27, num27, num27), 0f, vector6, num28, SpriteEffects.None, 0f); - } - } - if (player[myPlayer].dead) - { - playerInventory = false; - } - if (!playerInventory) - { - player[myPlayer].chest = -1; - } - string cursorText = ""; - if (!playerInventory) - { - bool flag2 = false; - bool flag3 = false; - for (int num93 = 0; num93 < 3; num93++) - { - string str6 = ""; - if ((player[myPlayer].accDepthMeter > 0) && !flag3) - { - int num94 = (int) ((((player[myPlayer].position.Y + player[myPlayer].height) * 2f) / 16f) - (worldSurface * 2.0)); - if (num94 > 0) - { - str6 = "Depth: " + num94 + " feet below"; - if (num94 == 1) - { - str6 = "Depth: " + num94 + " foot below"; - } - } - else if (num94 < 0) - { - num94 *= -1; - str6 = "Depth: " + num94 + " feet above"; - if (num94 == 1) - { - str6 = "Depth: " + num94 + " foot above"; - } - } - else - { - str6 = "Depth: Level"; - } - flag3 = true; - } - else if ((player[myPlayer].accWatch > 0) && !flag2) - { - string str7 = "AM"; - double time = Main.time; - if (!dayTime) - { - time += 54000.0; - } - time = (time / 86400.0) * 24.0; - double num96 = 7.5; - time = (time - num96) - 12.0; - if (time < 0.0) - { - time += 24.0; - } - if (time >= 12.0) - { - str7 = "PM"; - } - int num97 = (int) time; - double num98 = time - num97; - num98 = (int) (num98 * 60.0); - string str8 = num98.ToString(); - if (num98 < 10.0) - { - str8 = "0" + str8; - } - if (num97 > 12) - { - num97 -= 12; - } - if (num97 == 0) - { - num97 = 12; - } - if (player[myPlayer].accWatch == 1) - { - str8 = "00"; - } - else if (player[myPlayer].accWatch == 2) - { - if (num98 < 30.0) - { - str8 = "00"; - } - else - { - str8 = "30"; - } - } - str6 = string.Concat(new object[] { "Time: ", num97, ":", str8, " ", str7 }); - flag2 = true; - } - if (str6 != "") - { - for (int num99 = 0; num99 < 5; num99++) - { - int num100 = 0; - int num101 = 0; - Color black = Color.Black; - switch (num99) - { - case 0: - num100 = -2; - break; - - case 1: - num100 = 2; - break; - - case 2: - num101 = -2; - break; - - case 3: - num101 = 2; - break; - - case 4: - black = new Color((int) mouseTextColor, (int) mouseTextColor, (int) mouseTextColor, (int) mouseTextColor); - break; - } - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontMouseText, str6, new Vector2((float) (0x16 + num100), (float) ((0x4a + (0x16 * num93)) + num101)), black, 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - } - } - } - } - else - { - if (netMode == 1) - { - int num32 = 0x2a3; - int y = 0x86; - if (player[myPlayer].hostile) - { - vector6 = new Vector2(); - this.spriteBatch.Draw(itemTexture[4], new Vector2((float) (num32 - 2), (float) y), new Rectangle(0, 0, itemTexture[4].Width, itemTexture[4].Height), teamColor[player[myPlayer].team], 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - vector6 = new Vector2(); - this.spriteBatch.Draw(itemTexture[4], new Vector2((float) (num32 + 2), (float) y), new Rectangle(0, 0, itemTexture[4].Width, itemTexture[4].Height), teamColor[player[myPlayer].team], 0f, vector6, (float) 1f, SpriteEffects.FlipHorizontally, 0f); - } - else - { - vector6 = new Vector2(); - this.spriteBatch.Draw(itemTexture[4], new Vector2((float) (num32 - 0x10), (float) (y + 14)), new Rectangle(0, 0, itemTexture[4].Width, itemTexture[4].Height), teamColor[player[myPlayer].team], -0.785f, vector6, (float) 1f, SpriteEffects.None, 0f); - vector6 = new Vector2(); - this.spriteBatch.Draw(itemTexture[4], new Vector2((float) (num32 + 2), (float) (y + 14)), new Rectangle(0, 0, itemTexture[4].Width, itemTexture[4].Height), teamColor[player[myPlayer].team], -0.785f, vector6, (float) 1f, SpriteEffects.None, 0f); - } - if (((mouseState.X > num32) && (mouseState.X < (num32 + 0x22))) && ((mouseState.Y > (y - 2)) && (mouseState.Y < (y + 0x22)))) - { - player[myPlayer].mouseInterface = true; - if ((mouseState.LeftButton == ButtonState.Pressed) && mouseLeftRelease) - { - PlaySound(12, -1, -1, 1); - if (player[myPlayer].hostile) - { - player[myPlayer].hostile = false; - } - else - { - player[myPlayer].hostile = true; - } - NetMessage.SendData(30, -1, -1, "", myPlayer, 0f, 0f, 0f); - } - } - num32 -= 3; - Rectangle rectangle = new Rectangle(mouseState.X, mouseState.Y, 1, 1); - int width = teamTexture.Width; - int height = teamTexture.Height; - for (int num36 = 0; num36 < 5; num36++) - { - Rectangle rectangle2 = new Rectangle(); - switch (num36) - { - case 0: - rectangle2 = new Rectangle(num32 + 50, y - 20, width, height); - break; - - case 1: - rectangle2 = new Rectangle(num32 + 40, y, width, height); - break; - - case 2: - rectangle2 = new Rectangle(num32 + 60, y, width, height); - break; - - case 3: - rectangle2 = new Rectangle(num32 + 40, y + 20, width, height); - break; - - case 4: - rectangle2 = new Rectangle(num32 + 60, y + 20, width, height); - break; - } - if (rectangle2.Intersects(rectangle)) - { - player[myPlayer].mouseInterface = true; - if (((mouseState.LeftButton == ButtonState.Pressed) && mouseLeftRelease) && (player[myPlayer].team != num36)) - { - PlaySound(12, -1, -1, 1); - player[myPlayer].team = num36; - NetMessage.SendData(0x2d, -1, -1, "", myPlayer, 0f, 0f, 0f); - } - } - } - vector6 = new Vector2(); - this.spriteBatch.Draw(teamTexture, new Vector2((float) (num32 + 50), (float) (y - 20)), new Rectangle(0, 0, teamTexture.Width, teamTexture.Height), teamColor[0], 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - vector6 = new Vector2(); - this.spriteBatch.Draw(teamTexture, new Vector2((float) (num32 + 40), (float) y), new Rectangle(0, 0, teamTexture.Width, teamTexture.Height), teamColor[1], 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - vector6 = new Vector2(); - this.spriteBatch.Draw(teamTexture, new Vector2((float) (num32 + 60), (float) y), new Rectangle(0, 0, teamTexture.Width, teamTexture.Height), teamColor[2], 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - vector6 = new Vector2(); - this.spriteBatch.Draw(teamTexture, new Vector2((float) (num32 + 40), (float) (y + 20)), new Rectangle(0, 0, teamTexture.Width, teamTexture.Height), teamColor[3], 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - vector6 = new Vector2(); - this.spriteBatch.Draw(teamTexture, new Vector2((float) (num32 + 60), (float) (y + 20)), new Rectangle(0, 0, teamTexture.Width, teamTexture.Height), teamColor[4], 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - } - string str4 = "Save & Exit"; - if (netMode != 0) - { - str4 = "Disconnect"; - } - Vector2 vector4 = fontDeathText.MeasureString(str4); - int num37 = screenWidth - 110; - int num38 = screenHeight - 20; - if (mouseExit) - { - if (exitScale < 1f) - { - exitScale += 0.02f; - } - } - else if (exitScale > 0.8) - { - exitScale -= 0.02f; - } - for (int num39 = 0; num39 < 5; num39++) - { - int num40 = 0; - int num41 = 0; - Color white = Color.Black; - switch (num39) - { - case 0: - num40 = -2; - break; - - case 1: - num40 = 2; - break; - - case 2: - num41 = -2; - break; - - case 3: - num41 = 2; - break; - - case 4: - white = Color.White; - break; - } - this.spriteBatch.DrawString(fontDeathText, str4, new Vector2((float) (num37 + num40), (float) (num38 + num41)), white, 0f, new Vector2(vector4.X / 2f, vector4.Y / 2f), (float) (exitScale - 0.2f), SpriteEffects.None, 0f); - } - if (((mouseState.X > (num37 - (vector4.X / 2f))) && (mouseState.X < (num37 + (vector4.X / 2f)))) && ((mouseState.Y > (num38 - (vector4.Y / 2f))) && (mouseState.Y < ((num38 + (vector4.Y / 2f)) - 10f)))) - { - if (!mouseExit) - { - PlaySound(12, -1, -1, 1); - } - mouseExit = true; - player[myPlayer].mouseInterface = true; - if (mouseLeftRelease && (mouseState.LeftButton == ButtonState.Pressed)) - { - menuMode = 10; - WorldGen.SaveAndQuit(); - } - } - else - { - mouseExit = false; - } - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontMouseText, "Inventory", new Vector2(40f, 0f), new Color(mouseTextColor, mouseTextColor, mouseTextColor, mouseTextColor), 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - inventoryScale = 0.85f; - for (int num42 = 0; num42 < 10; num42++) - { - for (int num43 = 0; num43 < 4; num43++) - { - int num44 = (int) (20f + ((num42 * 0x38) * inventoryScale)); - int num45 = (int) (20f + ((num43 * 0x38) * inventoryScale)); - int index = num42 + (num43 * 10); - Color newColor = new Color(100, 100, 100, 100); - if (((mouseState.X >= num44) && (mouseState.X <= (num44 + (inventoryBackTexture.Width * inventoryScale)))) && ((mouseState.Y >= num45) && (mouseState.Y <= (num45 + (inventoryBackTexture.Height * inventoryScale))))) - { - player[myPlayer].mouseInterface = true; - if (mouseLeftRelease && (mouseState.LeftButton == ButtonState.Pressed)) - { - if ((player[myPlayer].selectedItem != index) || (player[myPlayer].itemAnimation <= 0)) - { - Item mouseItem = Main.mouseItem; - Main.mouseItem = player[myPlayer].inventory[index]; - player[myPlayer].inventory[index] = mouseItem; - if ((player[myPlayer].inventory[index].type == 0) || (player[myPlayer].inventory[index].stack < 1)) - { - player[myPlayer].inventory[index] = new Item(); - } - if ((Main.mouseItem.IsTheSameAs(player[myPlayer].inventory[index]) && (player[myPlayer].inventory[index].stack != player[myPlayer].inventory[index].maxStack)) && (Main.mouseItem.stack != Main.mouseItem.maxStack)) - { - if ((Main.mouseItem.stack + player[myPlayer].inventory[index].stack) <= Main.mouseItem.maxStack) - { - Item item1 = player[myPlayer].inventory[index]; - item1.stack += Main.mouseItem.stack; - Main.mouseItem.stack = 0; - } - else - { - int num47 = Main.mouseItem.maxStack - player[myPlayer].inventory[index].stack; - Item item6 = player[myPlayer].inventory[index]; - item6.stack += num47; - Main.mouseItem.stack -= num47; - } - } - if ((Main.mouseItem.type == 0) || (Main.mouseItem.stack < 1)) - { - Main.mouseItem = new Item(); - } - if ((Main.mouseItem.type > 0) || (player[myPlayer].inventory[index].type > 0)) - { - Recipe.FindRecipes(); - PlaySound(7, -1, -1, 1); - } - } - } - else if ((((stackSplit <= 1) && (mouseState.RightButton == ButtonState.Pressed)) && (Main.mouseItem.IsTheSameAs(player[myPlayer].inventory[index]) || (Main.mouseItem.type == 0))) && ((Main.mouseItem.stack < Main.mouseItem.maxStack) || (Main.mouseItem.type == 0))) - { - if (Main.mouseItem.type == 0) - { - Main.mouseItem = (Item) player[myPlayer].inventory[index].Clone(); - Main.mouseItem.stack = 0; - } - Main.mouseItem.stack++; - Item item7 = player[myPlayer].inventory[index]; - item7.stack--; - if (player[myPlayer].inventory[index].stack <= 0) - { - player[myPlayer].inventory[index] = new Item(); - } - Recipe.FindRecipes(); - soundInstanceMenuTick.Stop(); - soundInstanceMenuTick = soundMenuTick.CreateInstance(); - PlaySound(12, -1, -1, 1); - if (stackSplit == 0) - { - stackSplit = 15; - } - else - { - stackSplit = stackDelay; - } - } - cursorText = player[myPlayer].inventory[index].name; - toolTip = (Item) player[myPlayer].inventory[index].Clone(); - if (player[myPlayer].inventory[index].stack > 1) - { - obj2 = cursorText; - cursorText = string.Concat(new object[] { obj2, " (", player[myPlayer].inventory[index].stack, ")" }); - } - } - vector6 = new Vector2(); - this.spriteBatch.Draw(inventoryBackTexture, new Vector2((float) num44, (float) num45), new Rectangle(0, 0, inventoryBackTexture.Width, inventoryBackTexture.Height), color2, 0f, vector6, inventoryScale, SpriteEffects.None, 0f); - newColor = Color.White; - if ((player[myPlayer].inventory[index].type > 0) && (player[myPlayer].inventory[index].stack > 0)) - { - float num48 = 1f; - if ((itemTexture[player[myPlayer].inventory[index].type].Width > 0x20) || (itemTexture[player[myPlayer].inventory[index].type].Height > 0x20)) - { - if (itemTexture[player[myPlayer].inventory[index].type].Width > itemTexture[player[myPlayer].inventory[index].type].Height) - { - num48 = 32f / ((float) itemTexture[player[myPlayer].inventory[index].type].Width); - } - else - { - num48 = 32f / ((float) itemTexture[player[myPlayer].inventory[index].type].Height); - } - } - num48 *= inventoryScale; - vector6 = new Vector2(); - this.spriteBatch.Draw(itemTexture[player[myPlayer].inventory[index].type], new Vector2((num44 + (26f * inventoryScale)) - ((itemTexture[player[myPlayer].inventory[index].type].Width * 0.5f) * num48), (num45 + (26f * inventoryScale)) - ((itemTexture[player[myPlayer].inventory[index].type].Height * 0.5f) * num48)), new Rectangle(0, 0, itemTexture[player[myPlayer].inventory[index].type].Width, itemTexture[player[myPlayer].inventory[index].type].Height), player[myPlayer].inventory[index].GetAlpha(newColor), 0f, vector6, num48, SpriteEffects.None, 0f); - color22 = new Color(); - if (player[myPlayer].inventory[index].color != color22) - { - vector6 = new Vector2(); - this.spriteBatch.Draw(itemTexture[player[myPlayer].inventory[index].type], new Vector2((num44 + (26f * inventoryScale)) - ((itemTexture[player[myPlayer].inventory[index].type].Width * 0.5f) * num48), (num45 + (26f * inventoryScale)) - ((itemTexture[player[myPlayer].inventory[index].type].Height * 0.5f) * num48)), new Rectangle(0, 0, itemTexture[player[myPlayer].inventory[index].type].Width, itemTexture[player[myPlayer].inventory[index].type].Height), player[myPlayer].inventory[index].GetColor(newColor), 0f, vector6, num48, SpriteEffects.None, 0f); - } - if (player[myPlayer].inventory[index].stack > 1) - { - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontItemStack, player[myPlayer].inventory[index].stack.ToString(), new Vector2(num44 + (10f * inventoryScale), num45 + (26f * inventoryScale)), newColor, 0f, vector6, num48, SpriteEffects.None, 0f); - } - } - } - } - for (int num49 = 0; num49 < 8; num49++) - { - int num50 = (screenWidth - 0x40) - 0x1c; - int num51 = (int) (174f + ((num49 * 0x38) * inventoryScale)); - Color color5 = new Color(100, 100, 100, 100); - string str5 = ""; - switch (num49) - { - case 0: - str5 = "Helmet"; - break; - - case 1: - str5 = "Shirt"; - break; - - case 2: - str5 = "Pants"; - break; - - case 3: - str5 = "Accessories"; - break; - } - Vector2 vector5 = fontMouseText.MeasureString(str5); - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontMouseText, str5, new Vector2((num50 - vector5.X) - 10f, (num51 + (inventoryBackTexture.Height * 0.5f)) - (vector5.Y * 0.5f)), new Color(mouseTextColor, mouseTextColor, mouseTextColor, mouseTextColor), 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - if (((mouseState.X >= num50) && (mouseState.X <= (num50 + (inventoryBackTexture.Width * inventoryScale)))) && ((mouseState.Y >= num51) && (mouseState.Y <= (num51 + (inventoryBackTexture.Height * inventoryScale))))) - { - player[myPlayer].mouseInterface = true; - if ((mouseLeftRelease && (mouseState.LeftButton == ButtonState.Pressed)) && ((((Main.mouseItem.type == 0) || ((Main.mouseItem.headSlot > -1) && (num49 == 0))) || ((Main.mouseItem.bodySlot > -1) && (num49 == 1))) || (((Main.mouseItem.legSlot > -1) && (num49 == 2)) || (Main.mouseItem.accessory && (num49 > 2))))) - { - Item item2 = Main.mouseItem; - Main.mouseItem = player[myPlayer].armor[num49]; - player[myPlayer].armor[num49] = item2; - if ((player[myPlayer].armor[num49].type == 0) || (player[myPlayer].armor[num49].stack < 1)) - { - player[myPlayer].armor[num49] = new Item(); - } - if ((Main.mouseItem.type == 0) || (Main.mouseItem.stack < 1)) - { - Main.mouseItem = new Item(); - } - if ((Main.mouseItem.type > 0) || (player[myPlayer].armor[num49].type > 0)) - { - Recipe.FindRecipes(); - PlaySound(7, -1, -1, 1); - } - } - cursorText = player[myPlayer].armor[num49].name; - toolTip = (Item) player[myPlayer].armor[num49].Clone(); - if (num49 <= 2) - { - toolTip.wornArmor = true; - } - if (player[myPlayer].armor[num49].stack > 1) - { - obj2 = cursorText; - cursorText = string.Concat(new object[] { obj2, " (", player[myPlayer].armor[num49].stack, ")" }); - } - } - vector6 = new Vector2(); - this.spriteBatch.Draw(inventoryBackTexture, new Vector2((float) num50, (float) num51), new Rectangle(0, 0, inventoryBackTexture.Width, inventoryBackTexture.Height), color2, 0f, vector6, inventoryScale, SpriteEffects.None, 0f); - color5 = Color.White; - if ((player[myPlayer].armor[num49].type > 0) && (player[myPlayer].armor[num49].stack > 0)) - { - float num52 = 1f; - if ((itemTexture[player[myPlayer].armor[num49].type].Width > 0x20) || (itemTexture[player[myPlayer].armor[num49].type].Height > 0x20)) - { - if (itemTexture[player[myPlayer].armor[num49].type].Width > itemTexture[player[myPlayer].armor[num49].type].Height) - { - num52 = 32f / ((float) itemTexture[player[myPlayer].armor[num49].type].Width); - } - else - { - num52 = 32f / ((float) itemTexture[player[myPlayer].armor[num49].type].Height); - } - } - num52 *= inventoryScale; - vector6 = new Vector2(); - this.spriteBatch.Draw(itemTexture[player[myPlayer].armor[num49].type], new Vector2((num50 + (26f * inventoryScale)) - ((itemTexture[player[myPlayer].armor[num49].type].Width * 0.5f) * num52), (num51 + (26f * inventoryScale)) - ((itemTexture[player[myPlayer].armor[num49].type].Height * 0.5f) * num52)), new Rectangle(0, 0, itemTexture[player[myPlayer].armor[num49].type].Width, itemTexture[player[myPlayer].armor[num49].type].Height), player[myPlayer].armor[num49].GetAlpha(color5), 0f, vector6, num52, SpriteEffects.None, 0f); - color22 = new Color(); - if (player[myPlayer].armor[num49].color != color22) - { - vector6 = new Vector2(); - this.spriteBatch.Draw(itemTexture[player[myPlayer].armor[num49].type], new Vector2((num50 + (26f * inventoryScale)) - ((itemTexture[player[myPlayer].armor[num49].type].Width * 0.5f) * num52), (num51 + (26f * inventoryScale)) - ((itemTexture[player[myPlayer].armor[num49].type].Height * 0.5f) * num52)), new Rectangle(0, 0, itemTexture[player[myPlayer].armor[num49].type].Width, itemTexture[player[myPlayer].armor[num49].type].Height), player[myPlayer].armor[num49].GetColor(color5), 0f, vector6, num52, SpriteEffects.None, 0f); - } - if (player[myPlayer].armor[num49].stack > 1) - { - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontItemStack, player[myPlayer].armor[num49].stack.ToString(), new Vector2(num50 + (10f * inventoryScale), num51 + (26f * inventoryScale)), color5, 0f, vector6, num52, SpriteEffects.None, 0f); - } - } - } - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontMouseText, "Crafting", new Vector2(76f, 414f), new Color(mouseTextColor, mouseTextColor, mouseTextColor, mouseTextColor), 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - for (int num53 = 0; num53 < Recipe.maxRecipes; num53++) - { - inventoryScale = 100f / (Math.Abs(availableRecipeY[num53]) + 100f); - if (inventoryScale < 0.75) - { - inventoryScale = 0.75f; - } - if (availableRecipeY[num53] < ((num53 - focusRecipe) * 0x41)) - { - if (availableRecipeY[num53] == 0f) - { - PlaySound(12, -1, -1, 1); - } - availableRecipeY[num53] += 6.5f; - } - else if (availableRecipeY[num53] > ((num53 - focusRecipe) * 0x41)) - { - if (availableRecipeY[num53] == 0f) - { - PlaySound(12, -1, -1, 1); - } - availableRecipeY[num53] -= 6.5f; - } - if ((num53 < numAvailableRecipes) && (Math.Abs(availableRecipeY[num53]) <= 250f)) - { - int num54 = (int) (46f - (26f * inventoryScale)); - int num55 = (int) ((410f + (availableRecipeY[num53] * inventoryScale)) - (30f * inventoryScale)); - double num56 = color2.A + 50; - double num57 = 255.0; - if (Math.Abs(availableRecipeY[num53]) > 150f) - { - num56 = (150f * (100f - (Math.Abs(availableRecipeY[num53]) - 150f))) * 0.01; - num57 = (255f * (100f - (Math.Abs(availableRecipeY[num53]) - 150f))) * 0.01; - } - Color color6 = new Color((int) ((byte) num56), (int) ((byte) num56), (int) ((byte) num56), (int) ((byte) num56)); - Color color7 = new Color((int) ((byte) num57), (int) ((byte) num57), (int) ((byte) num57), (int) ((byte) num57)); - if (((mouseState.X >= num54) && (mouseState.X <= (num54 + (inventoryBackTexture.Width * inventoryScale)))) && ((mouseState.Y >= num55) && (mouseState.Y <= (num55 + (inventoryBackTexture.Height * inventoryScale))))) - { - player[myPlayer].mouseInterface = true; - if (focusRecipe == num53) - { - if ((Main.mouseItem.type == 0) || (Main.mouseItem.IsTheSameAs(recipe[availableRecipe[num53]].createItem) && ((Main.mouseItem.stack + recipe[availableRecipe[num53]].createItem.stack) <= Main.mouseItem.maxStack))) - { - if (mouseLeftRelease && (mouseState.LeftButton == ButtonState.Pressed)) - { - int stack = Main.mouseItem.stack; - Main.mouseItem = (Item) recipe[availableRecipe[num53]].createItem.Clone(); - Main.mouseItem.stack += stack; - recipe[availableRecipe[num53]].Create(); - if ((Main.mouseItem.type > 0) || (recipe[availableRecipe[num53]].createItem.type > 0)) - { - PlaySound(7, -1, -1, 1); - } - } - else if (((stackSplit <= 1) && (mouseState.RightButton == ButtonState.Pressed)) && ((Main.mouseItem.stack < Main.mouseItem.maxStack) || (Main.mouseItem.type == 0))) - { - if (stackSplit == 0) - { - stackSplit = 15; - } - else - { - stackSplit = stackDelay; - } - int num59 = Main.mouseItem.stack; - Main.mouseItem = (Item) recipe[availableRecipe[num53]].createItem.Clone(); - Main.mouseItem.stack += num59; - recipe[availableRecipe[num53]].Create(); - if ((Main.mouseItem.type > 0) || (recipe[availableRecipe[num53]].createItem.type > 0)) - { - PlaySound(7, -1, -1, 1); - } - } - } - } - else if (mouseLeftRelease && (mouseState.LeftButton == ButtonState.Pressed)) - { - focusRecipe = num53; - } - cursorText = recipe[availableRecipe[num53]].createItem.name; - toolTip = (Item) recipe[availableRecipe[num53]].createItem.Clone(); - if (recipe[availableRecipe[num53]].createItem.stack > 1) - { - obj2 = cursorText; - cursorText = string.Concat(new object[] { obj2, " (", recipe[availableRecipe[num53]].createItem.stack, ")" }); - } - } - if (numAvailableRecipes > 0) - { - num56 -= 50.0; - if (num56 < 0.0) - { - num56 = 0.0; - } - vector6 = new Vector2(); - this.spriteBatch.Draw(inventoryBackTexture, new Vector2((float) num54, (float) num55), new Rectangle(0, 0, inventoryBackTexture.Width, inventoryBackTexture.Height), new Color((byte) num56, (byte) num56, (byte) num56, (byte) num56), 0f, vector6, inventoryScale, SpriteEffects.None, 0f); - if ((recipe[availableRecipe[num53]].createItem.type > 0) && (recipe[availableRecipe[num53]].createItem.stack > 0)) - { - float num60 = 1f; - if ((itemTexture[recipe[availableRecipe[num53]].createItem.type].Width > 0x20) || (itemTexture[recipe[availableRecipe[num53]].createItem.type].Height > 0x20)) - { - if (itemTexture[recipe[availableRecipe[num53]].createItem.type].Width > itemTexture[recipe[availableRecipe[num53]].createItem.type].Height) - { - num60 = 32f / ((float) itemTexture[recipe[availableRecipe[num53]].createItem.type].Width); - } - else - { - num60 = 32f / ((float) itemTexture[recipe[availableRecipe[num53]].createItem.type].Height); - } - } - num60 *= inventoryScale; - vector6 = new Vector2(); - this.spriteBatch.Draw(itemTexture[recipe[availableRecipe[num53]].createItem.type], new Vector2((num54 + (26f * inventoryScale)) - ((itemTexture[recipe[availableRecipe[num53]].createItem.type].Width * 0.5f) * num60), (num55 + (26f * inventoryScale)) - ((itemTexture[recipe[availableRecipe[num53]].createItem.type].Height * 0.5f) * num60)), new Rectangle(0, 0, itemTexture[recipe[availableRecipe[num53]].createItem.type].Width, itemTexture[recipe[availableRecipe[num53]].createItem.type].Height), recipe[availableRecipe[num53]].createItem.GetAlpha(color7), 0f, vector6, num60, SpriteEffects.None, 0f); - color22 = new Color(); - if (recipe[availableRecipe[num53]].createItem.color != color22) - { - vector6 = new Vector2(); - this.spriteBatch.Draw(itemTexture[recipe[availableRecipe[num53]].createItem.type], new Vector2((num54 + (26f * inventoryScale)) - ((itemTexture[recipe[availableRecipe[num53]].createItem.type].Width * 0.5f) * num60), (num55 + (26f * inventoryScale)) - ((itemTexture[recipe[availableRecipe[num53]].createItem.type].Height * 0.5f) * num60)), new Rectangle(0, 0, itemTexture[recipe[availableRecipe[num53]].createItem.type].Width, itemTexture[recipe[availableRecipe[num53]].createItem.type].Height), recipe[availableRecipe[num53]].createItem.GetColor(color7), 0f, vector6, num60, SpriteEffects.None, 0f); - } - if (recipe[availableRecipe[num53]].createItem.stack > 1) - { - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontItemStack, recipe[availableRecipe[num53]].createItem.stack.ToString(), new Vector2(num54 + (10f * inventoryScale), num55 + (26f * inventoryScale)), color6, 0f, vector6, num60, SpriteEffects.None, 0f); - } - } - } - } - } - if (numAvailableRecipes > 0) - { - for (int num61 = 0; num61 < Recipe.maxRequirements; num61++) - { - if (recipe[availableRecipe[focusRecipe]].requiredItem[num61].type == 0) - { - break; - } - int num62 = 80 + (num61 * 40); - int num63 = 380; - double num64 = color2.A + 50; - double num65 = 255.0; - Color color8 = Color.White; - Color color9 = Color.White; - num64 = (color2.A + 50) - (Math.Abs(availableRecipeY[focusRecipe]) * 2f); - num65 = 255f - (Math.Abs(availableRecipeY[focusRecipe]) * 2f); - if (num64 < 0.0) - { - num64 = 0.0; - } - if (num65 < 0.0) - { - num65 = 0.0; - } - color8.R = (byte) num64; - color8.G = (byte) num64; - color8.B = (byte) num64; - color8.A = (byte) num64; - color9.R = (byte) num65; - color9.G = (byte) num65; - color9.B = (byte) num65; - color9.A = (byte) num65; - inventoryScale = 0.6f; - if (num64 == 0.0) - { - break; - } - if (((mouseState.X >= num62) && (mouseState.X <= (num62 + (inventoryBackTexture.Width * inventoryScale)))) && ((mouseState.Y >= num63) && (mouseState.Y <= (num63 + (inventoryBackTexture.Height * inventoryScale))))) - { - player[myPlayer].mouseInterface = true; - cursorText = recipe[availableRecipe[focusRecipe]].requiredItem[num61].name; - toolTip = (Item) recipe[availableRecipe[focusRecipe]].requiredItem[num61].Clone(); - if (recipe[availableRecipe[focusRecipe]].requiredItem[num61].stack > 1) - { - obj2 = cursorText; - cursorText = string.Concat(new object[] { obj2, " (", recipe[availableRecipe[focusRecipe]].requiredItem[num61].stack, ")" }); - } - } - num64 -= 50.0; - if (num64 < 0.0) - { - num64 = 0.0; - } - vector6 = new Vector2(); - this.spriteBatch.Draw(inventoryBackTexture, new Vector2((float) num62, (float) num63), new Rectangle(0, 0, inventoryBackTexture.Width, inventoryBackTexture.Height), new Color((byte) num64, (byte) num64, (byte) num64, (byte) num64), 0f, vector6, inventoryScale, SpriteEffects.None, 0f); - if ((recipe[availableRecipe[focusRecipe]].requiredItem[num61].type > 0) && (recipe[availableRecipe[focusRecipe]].requiredItem[num61].stack > 0)) - { - float num66 = 1f; - if ((itemTexture[recipe[availableRecipe[focusRecipe]].requiredItem[num61].type].Width > 0x20) || (itemTexture[recipe[availableRecipe[focusRecipe]].requiredItem[num61].type].Height > 0x20)) - { - if (itemTexture[recipe[availableRecipe[focusRecipe]].requiredItem[num61].type].Width > itemTexture[recipe[availableRecipe[focusRecipe]].requiredItem[num61].type].Height) - { - num66 = 32f / ((float) itemTexture[recipe[availableRecipe[focusRecipe]].requiredItem[num61].type].Width); - } - else - { - num66 = 32f / ((float) itemTexture[recipe[availableRecipe[focusRecipe]].requiredItem[num61].type].Height); - } - } - num66 *= inventoryScale; - vector6 = new Vector2(); - this.spriteBatch.Draw(itemTexture[recipe[availableRecipe[focusRecipe]].requiredItem[num61].type], new Vector2((num62 + (26f * inventoryScale)) - ((itemTexture[recipe[availableRecipe[focusRecipe]].requiredItem[num61].type].Width * 0.5f) * num66), (num63 + (26f * inventoryScale)) - ((itemTexture[recipe[availableRecipe[focusRecipe]].requiredItem[num61].type].Height * 0.5f) * num66)), new Rectangle(0, 0, itemTexture[recipe[availableRecipe[focusRecipe]].requiredItem[num61].type].Width, itemTexture[recipe[availableRecipe[focusRecipe]].requiredItem[num61].type].Height), recipe[availableRecipe[focusRecipe]].requiredItem[num61].GetAlpha(color9), 0f, vector6, num66, SpriteEffects.None, 0f); - color22 = new Color(); - if (recipe[availableRecipe[focusRecipe]].requiredItem[num61].color != color22) - { - vector6 = new Vector2(); - this.spriteBatch.Draw(itemTexture[recipe[availableRecipe[focusRecipe]].requiredItem[num61].type], new Vector2((num62 + (26f * inventoryScale)) - ((itemTexture[recipe[availableRecipe[focusRecipe]].requiredItem[num61].type].Width * 0.5f) * num66), (num63 + (26f * inventoryScale)) - ((itemTexture[recipe[availableRecipe[focusRecipe]].requiredItem[num61].type].Height * 0.5f) * num66)), new Rectangle(0, 0, itemTexture[recipe[availableRecipe[focusRecipe]].requiredItem[num61].type].Width, itemTexture[recipe[availableRecipe[focusRecipe]].requiredItem[num61].type].Height), recipe[availableRecipe[focusRecipe]].requiredItem[num61].GetColor(color9), 0f, vector6, num66, SpriteEffects.None, 0f); - } - if (recipe[availableRecipe[focusRecipe]].requiredItem[num61].stack > 1) - { - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontItemStack, recipe[availableRecipe[focusRecipe]].requiredItem[num61].stack.ToString(), new Vector2(num62 + (10f * inventoryScale), num63 + (26f * inventoryScale)), color8, 0f, vector6, num66, SpriteEffects.None, 0f); - } - } - } - } - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontMouseText, "Coins", new Vector2(528f, 84f), new Color(mouseTextColor, mouseTextColor, mouseTextColor, mouseTextColor), 0f, vector6, (float) 0.8f, SpriteEffects.None, 0f); - inventoryScale = 0.55f; - for (int num67 = 0; num67 < 4; num67++) - { - int num68 = 0x1f1; - int num69 = (int) (85f + ((num67 * 0x38) * inventoryScale)); - int num70 = num67 + 40; - Color color10 = new Color(100, 100, 100, 100); - if (((mouseState.X >= num68) && (mouseState.X <= (num68 + (inventoryBackTexture.Width * inventoryScale)))) && ((mouseState.Y >= num69) && (mouseState.Y <= (num69 + (inventoryBackTexture.Height * inventoryScale))))) - { - player[myPlayer].mouseInterface = true; - if (mouseLeftRelease && (mouseState.LeftButton == ButtonState.Pressed)) - { - if (((player[myPlayer].selectedItem != num70) || (player[myPlayer].itemAnimation <= 0)) && (((Main.mouseItem.type == 0) || (Main.mouseItem.type == 0x47)) || (((Main.mouseItem.type == 0x48) || (Main.mouseItem.type == 0x49)) || (Main.mouseItem.type == 0x4a)))) - { - Item item3 = Main.mouseItem; - Main.mouseItem = player[myPlayer].inventory[num70]; - player[myPlayer].inventory[num70] = item3; - if ((player[myPlayer].inventory[num70].type == 0) || (player[myPlayer].inventory[num70].stack < 1)) - { - player[myPlayer].inventory[num70] = new Item(); - } - if ((Main.mouseItem.IsTheSameAs(player[myPlayer].inventory[num70]) && (player[myPlayer].inventory[num70].stack != player[myPlayer].inventory[num70].maxStack)) && (Main.mouseItem.stack != Main.mouseItem.maxStack)) - { - if ((Main.mouseItem.stack + player[myPlayer].inventory[num70].stack) <= Main.mouseItem.maxStack) - { - Item item8 = player[myPlayer].inventory[num70]; - item8.stack += Main.mouseItem.stack; - Main.mouseItem.stack = 0; - } - else - { - int num71 = Main.mouseItem.maxStack - player[myPlayer].inventory[num70].stack; - Item item9 = player[myPlayer].inventory[num70]; - item9.stack += num71; - Main.mouseItem.stack -= num71; - } - } - if ((Main.mouseItem.type == 0) || (Main.mouseItem.stack < 1)) - { - Main.mouseItem = new Item(); - } - if ((Main.mouseItem.type > 0) || (player[myPlayer].inventory[num70].type > 0)) - { - PlaySound(7, -1, -1, 1); - } - } - } - else if ((((stackSplit <= 1) && (mouseState.RightButton == ButtonState.Pressed)) && (Main.mouseItem.IsTheSameAs(player[myPlayer].inventory[num70]) || (Main.mouseItem.type == 0))) && ((Main.mouseItem.stack < Main.mouseItem.maxStack) || (Main.mouseItem.type == 0))) - { - if (Main.mouseItem.type == 0) - { - Main.mouseItem = (Item) player[myPlayer].inventory[num70].Clone(); - Main.mouseItem.stack = 0; - } - Main.mouseItem.stack++; - Item item10 = player[myPlayer].inventory[num70]; - item10.stack--; - if (player[myPlayer].inventory[num70].stack <= 0) - { - player[myPlayer].inventory[num70] = new Item(); - } - Recipe.FindRecipes(); - soundInstanceMenuTick.Stop(); - soundInstanceMenuTick = soundMenuTick.CreateInstance(); - PlaySound(12, -1, -1, 1); - if (stackSplit == 0) - { - stackSplit = 15; - } - else - { - stackSplit = stackDelay; - } - } - cursorText = player[myPlayer].inventory[num70].name; - toolTip = (Item) player[myPlayer].inventory[num70].Clone(); - if (player[myPlayer].inventory[num70].stack > 1) - { - obj2 = cursorText; - cursorText = string.Concat(new object[] { obj2, " (", player[myPlayer].inventory[num70].stack, ")" }); - } - } - vector6 = new Vector2(); - this.spriteBatch.Draw(inventoryBackTexture, new Vector2((float) num68, (float) num69), new Rectangle(0, 0, inventoryBackTexture.Width, inventoryBackTexture.Height), color2, 0f, vector6, inventoryScale, SpriteEffects.None, 0f); - color10 = Color.White; - if ((player[myPlayer].inventory[num70].type > 0) && (player[myPlayer].inventory[num70].stack > 0)) - { - float num72 = 1f; - if ((itemTexture[player[myPlayer].inventory[num70].type].Width > 0x20) || (itemTexture[player[myPlayer].inventory[num70].type].Height > 0x20)) - { - if (itemTexture[player[myPlayer].inventory[num70].type].Width > itemTexture[player[myPlayer].inventory[num70].type].Height) - { - num72 = 32f / ((float) itemTexture[player[myPlayer].inventory[num70].type].Width); - } - else - { - num72 = 32f / ((float) itemTexture[player[myPlayer].inventory[num70].type].Height); - } - } - num72 *= inventoryScale; - vector6 = new Vector2(); - this.spriteBatch.Draw(itemTexture[player[myPlayer].inventory[num70].type], new Vector2((num68 + (26f * inventoryScale)) - ((itemTexture[player[myPlayer].inventory[num70].type].Width * 0.5f) * num72), (num69 + (26f * inventoryScale)) - ((itemTexture[player[myPlayer].inventory[num70].type].Height * 0.5f) * num72)), new Rectangle(0, 0, itemTexture[player[myPlayer].inventory[num70].type].Width, itemTexture[player[myPlayer].inventory[num70].type].Height), player[myPlayer].inventory[num70].GetAlpha(color10), 0f, vector6, num72, SpriteEffects.None, 0f); - color22 = new Color(); - if (player[myPlayer].inventory[num70].color != color22) - { - vector6 = new Vector2(); - this.spriteBatch.Draw(itemTexture[player[myPlayer].inventory[num70].type], new Vector2((num68 + (26f * inventoryScale)) - ((itemTexture[player[myPlayer].inventory[num70].type].Width * 0.5f) * num72), (num69 + (26f * inventoryScale)) - ((itemTexture[player[myPlayer].inventory[num70].type].Height * 0.5f) * num72)), new Rectangle(0, 0, itemTexture[player[myPlayer].inventory[num70].type].Width, itemTexture[player[myPlayer].inventory[num70].type].Height), player[myPlayer].inventory[num70].GetColor(color10), 0f, vector6, num72, SpriteEffects.None, 0f); - } - if (player[myPlayer].inventory[num70].stack > 1) - { - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontItemStack, player[myPlayer].inventory[num70].stack.ToString(), new Vector2(num68 + (10f * inventoryScale), num69 + (26f * inventoryScale)), color10, 0f, vector6, num72, SpriteEffects.None, 0f); - } - } - } - if ((npcShop > 0) && (!playerInventory || (player[myPlayer].talkNPC == -1))) - { - npcShop = 0; - } - if (npcShop > 0) - { - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontMouseText, "Shop", new Vector2(284f, 210f), new Color(mouseTextColor, mouseTextColor, mouseTextColor, mouseTextColor), 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - inventoryScale = 0.75f; - for (int num73 = 0; num73 < 5; num73++) - { - for (int num74 = 0; num74 < 4; num74++) - { - int num75 = (int) (73f + ((num73 * 0x38) * inventoryScale)); - int num76 = (int) (210f + ((num74 * 0x38) * inventoryScale)); - int num77 = num73 + (num74 * 5); - Color color11 = new Color(100, 100, 100, 100); - if (((mouseState.X >= num75) && (mouseState.X <= (num75 + (inventoryBackTexture.Width * inventoryScale)))) && ((mouseState.Y >= num76) && (mouseState.Y <= (num76 + (inventoryBackTexture.Height * inventoryScale))))) - { - player[myPlayer].mouseInterface = true; - if (mouseLeftRelease && (mouseState.LeftButton == ButtonState.Pressed)) - { - if (Main.mouseItem.type == 0) - { - if (((player[myPlayer].selectedItem != num77) || (player[myPlayer].itemAnimation <= 0)) && player[myPlayer].BuyItem(this.shop[npcShop].item[num77].value)) - { - Main.mouseItem.SetDefaults(this.shop[npcShop].item[num77].name); - PlaySound(0x12, -1, -1, 1); - } - } - else if (this.shop[npcShop].item[num77].type == 0) - { - if (player[myPlayer].SellItem(Main.mouseItem.value * Main.mouseItem.stack)) - { - Main.mouseItem.stack = 0; - Main.mouseItem.type = 0; - PlaySound(0x12, -1, -1, 1); - } - else if (Main.mouseItem.value == 0) - { - Main.mouseItem.stack = 0; - Main.mouseItem.type = 0; - PlaySound(7, -1, -1, 1); - } - } - } - else if (((((stackSplit <= 1) && (mouseState.RightButton == ButtonState.Pressed)) && (Main.mouseItem.IsTheSameAs(this.shop[npcShop].item[num77]) || (Main.mouseItem.type == 0))) && ((Main.mouseItem.stack < Main.mouseItem.maxStack) || (Main.mouseItem.type == 0))) && player[myPlayer].BuyItem(this.shop[npcShop].item[num77].value)) - { - PlaySound(0x12, -1, -1, 1); - if (Main.mouseItem.type == 0) - { - Main.mouseItem = (Item) this.shop[npcShop].item[num77].Clone(); - Main.mouseItem.stack = 0; - } - Main.mouseItem.stack++; - if (stackSplit == 0) - { - stackSplit = 15; - } - else - { - stackSplit = stackDelay; - } - } - cursorText = this.shop[npcShop].item[num77].name; - toolTip = (Item) this.shop[npcShop].item[num77].Clone(); - toolTip.buy = true; - if (this.shop[npcShop].item[num77].stack > 1) - { - obj2 = cursorText; - cursorText = string.Concat(new object[] { obj2, " (", this.shop[npcShop].item[num77].stack, ")" }); - } - } - vector6 = new Vector2(); - this.spriteBatch.Draw(inventoryBackTexture, new Vector2((float) num75, (float) num76), new Rectangle(0, 0, inventoryBackTexture.Width, inventoryBackTexture.Height), color2, 0f, vector6, inventoryScale, SpriteEffects.None, 0f); - color11 = Color.White; - if ((this.shop[npcShop].item[num77].type > 0) && (this.shop[npcShop].item[num77].stack > 0)) - { - float num78 = 1f; - if ((itemTexture[this.shop[npcShop].item[num77].type].Width > 0x20) || (itemTexture[this.shop[npcShop].item[num77].type].Height > 0x20)) - { - if (itemTexture[this.shop[npcShop].item[num77].type].Width > itemTexture[this.shop[npcShop].item[num77].type].Height) - { - num78 = 32f / ((float) itemTexture[this.shop[npcShop].item[num77].type].Width); - } - else - { - num78 = 32f / ((float) itemTexture[this.shop[npcShop].item[num77].type].Height); - } - } - num78 *= inventoryScale; - vector6 = new Vector2(); - this.spriteBatch.Draw(itemTexture[this.shop[npcShop].item[num77].type], new Vector2((num75 + (26f * inventoryScale)) - ((itemTexture[this.shop[npcShop].item[num77].type].Width * 0.5f) * num78), (num76 + (26f * inventoryScale)) - ((itemTexture[this.shop[npcShop].item[num77].type].Height * 0.5f) * num78)), new Rectangle(0, 0, itemTexture[this.shop[npcShop].item[num77].type].Width, itemTexture[this.shop[npcShop].item[num77].type].Height), this.shop[npcShop].item[num77].GetAlpha(color11), 0f, vector6, num78, SpriteEffects.None, 0f); - color22 = new Color(); - if (this.shop[npcShop].item[num77].color != color22) - { - vector6 = new Vector2(); - this.spriteBatch.Draw(itemTexture[this.shop[npcShop].item[num77].type], new Vector2((num75 + (26f * inventoryScale)) - ((itemTexture[this.shop[npcShop].item[num77].type].Width * 0.5f) * num78), (num76 + (26f * inventoryScale)) - ((itemTexture[this.shop[npcShop].item[num77].type].Height * 0.5f) * num78)), new Rectangle(0, 0, itemTexture[this.shop[npcShop].item[num77].type].Width, itemTexture[this.shop[npcShop].item[num77].type].Height), this.shop[npcShop].item[num77].GetColor(color11), 0f, vector6, num78, SpriteEffects.None, 0f); - } - if (this.shop[npcShop].item[num77].stack > 1) - { - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontItemStack, this.shop[npcShop].item[num77].stack.ToString(), new Vector2(num75 + (10f * inventoryScale), num76 + (26f * inventoryScale)), color11, 0f, vector6, num78, SpriteEffects.None, 0f); - } - } - } - } - } - if ((player[myPlayer].chest > -1) && (tile[player[myPlayer].chestX, player[myPlayer].chestY].type != 0x15)) - { - player[myPlayer].chest = -1; - } - if (player[myPlayer].chest > -1) - { - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontMouseText, "Chest", new Vector2(284f, 210f), new Color(mouseTextColor, mouseTextColor, mouseTextColor, mouseTextColor), 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - inventoryScale = 0.75f; - for (int num79 = 0; num79 < 5; num79++) - { - for (int num80 = 0; num80 < 4; num80++) - { - int num81 = (int) (73f + ((num79 * 0x38) * inventoryScale)); - int num82 = (int) (210f + ((num80 * 0x38) * inventoryScale)); - int num83 = num79 + (num80 * 5); - Color color12 = new Color(100, 100, 100, 100); - if (((mouseState.X >= num81) && (mouseState.X <= (num81 + (inventoryBackTexture.Width * inventoryScale)))) && ((mouseState.Y >= num82) && (mouseState.Y <= (num82 + (inventoryBackTexture.Height * inventoryScale))))) - { - player[myPlayer].mouseInterface = true; - if (mouseLeftRelease && (mouseState.LeftButton == ButtonState.Pressed)) - { - if ((player[myPlayer].selectedItem != num83) || (player[myPlayer].itemAnimation <= 0)) - { - Item item4 = Main.mouseItem; - Main.mouseItem = chest[player[myPlayer].chest].item[num83]; - chest[player[myPlayer].chest].item[num83] = item4; - if ((chest[player[myPlayer].chest].item[num83].type == 0) || (chest[player[myPlayer].chest].item[num83].stack < 1)) - { - chest[player[myPlayer].chest].item[num83] = new Item(); - } - if ((Main.mouseItem.IsTheSameAs(chest[player[myPlayer].chest].item[num83]) && (chest[player[myPlayer].chest].item[num83].stack != chest[player[myPlayer].chest].item[num83].maxStack)) && (Main.mouseItem.stack != Main.mouseItem.maxStack)) - { - if ((Main.mouseItem.stack + chest[player[myPlayer].chest].item[num83].stack) <= Main.mouseItem.maxStack) - { - Item item11 = chest[player[myPlayer].chest].item[num83]; - item11.stack += Main.mouseItem.stack; - Main.mouseItem.stack = 0; - } - else - { - int num84 = Main.mouseItem.maxStack - chest[player[myPlayer].chest].item[num83].stack; - Item item12 = chest[player[myPlayer].chest].item[num83]; - item12.stack += num84; - Main.mouseItem.stack -= num84; - } - } - if ((Main.mouseItem.type == 0) || (Main.mouseItem.stack < 1)) - { - Main.mouseItem = new Item(); - } - if ((Main.mouseItem.type > 0) || (chest[player[myPlayer].chest].item[num83].type > 0)) - { - Recipe.FindRecipes(); - PlaySound(7, -1, -1, 1); - } - if (netMode == 1) - { - NetMessage.SendData(0x20, -1, -1, "", player[myPlayer].chest, (float) num83, 0f, 0f); - } - } - } - else if ((((stackSplit <= 1) && (mouseState.RightButton == ButtonState.Pressed)) && (Main.mouseItem.IsTheSameAs(chest[player[myPlayer].chest].item[num83]) || (Main.mouseItem.type == 0))) && ((Main.mouseItem.stack < Main.mouseItem.maxStack) || (Main.mouseItem.type == 0))) - { - if (Main.mouseItem.type == 0) - { - Main.mouseItem = (Item) chest[player[myPlayer].chest].item[num83].Clone(); - Main.mouseItem.stack = 0; - } - Main.mouseItem.stack++; - Item item13 = chest[player[myPlayer].chest].item[num83]; - item13.stack--; - if (chest[player[myPlayer].chest].item[num83].stack <= 0) - { - chest[player[myPlayer].chest].item[num83] = new Item(); - } - Recipe.FindRecipes(); - soundInstanceMenuTick.Stop(); - soundInstanceMenuTick = soundMenuTick.CreateInstance(); - PlaySound(12, -1, -1, 1); - if (stackSplit == 0) - { - stackSplit = 15; - } - else - { - stackSplit = stackDelay; - } - if (netMode == 1) - { - NetMessage.SendData(0x20, -1, -1, "", player[myPlayer].chest, (float) num83, 0f, 0f); - } - } - cursorText = chest[player[myPlayer].chest].item[num83].name; - toolTip = (Item) chest[player[myPlayer].chest].item[num83].Clone(); - if (chest[player[myPlayer].chest].item[num83].stack > 1) - { - obj2 = cursorText; - cursorText = string.Concat(new object[] { obj2, " (", chest[player[myPlayer].chest].item[num83].stack, ")" }); - } - } - vector6 = new Vector2(); - this.spriteBatch.Draw(inventoryBackTexture, new Vector2((float) num81, (float) num82), new Rectangle(0, 0, inventoryBackTexture.Width, inventoryBackTexture.Height), color2, 0f, vector6, inventoryScale, SpriteEffects.None, 0f); - color12 = Color.White; - if ((chest[player[myPlayer].chest].item[num83].type > 0) && (chest[player[myPlayer].chest].item[num83].stack > 0)) - { - float num85 = 1f; - if ((itemTexture[chest[player[myPlayer].chest].item[num83].type].Width > 0x20) || (itemTexture[chest[player[myPlayer].chest].item[num83].type].Height > 0x20)) - { - if (itemTexture[chest[player[myPlayer].chest].item[num83].type].Width > itemTexture[chest[player[myPlayer].chest].item[num83].type].Height) - { - num85 = 32f / ((float) itemTexture[chest[player[myPlayer].chest].item[num83].type].Width); - } - else - { - num85 = 32f / ((float) itemTexture[chest[player[myPlayer].chest].item[num83].type].Height); - } - } - num85 *= inventoryScale; - vector6 = new Vector2(); - this.spriteBatch.Draw(itemTexture[chest[player[myPlayer].chest].item[num83].type], new Vector2((num81 + (26f * inventoryScale)) - ((itemTexture[chest[player[myPlayer].chest].item[num83].type].Width * 0.5f) * num85), (num82 + (26f * inventoryScale)) - ((itemTexture[chest[player[myPlayer].chest].item[num83].type].Height * 0.5f) * num85)), new Rectangle(0, 0, itemTexture[chest[player[myPlayer].chest].item[num83].type].Width, itemTexture[chest[player[myPlayer].chest].item[num83].type].Height), chest[player[myPlayer].chest].item[num83].GetAlpha(color12), 0f, vector6, num85, SpriteEffects.None, 0f); - color22 = new Color(); - if (chest[player[myPlayer].chest].item[num83].color != color22) - { - vector6 = new Vector2(); - this.spriteBatch.Draw(itemTexture[chest[player[myPlayer].chest].item[num83].type], new Vector2((num81 + (26f * inventoryScale)) - ((itemTexture[chest[player[myPlayer].chest].item[num83].type].Width * 0.5f) * num85), (num82 + (26f * inventoryScale)) - ((itemTexture[chest[player[myPlayer].chest].item[num83].type].Height * 0.5f) * num85)), new Rectangle(0, 0, itemTexture[chest[player[myPlayer].chest].item[num83].type].Width, itemTexture[chest[player[myPlayer].chest].item[num83].type].Height), chest[player[myPlayer].chest].item[num83].GetColor(color12), 0f, vector6, num85, SpriteEffects.None, 0f); - } - if (chest[player[myPlayer].chest].item[num83].stack > 1) - { - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontItemStack, chest[player[myPlayer].chest].item[num83].stack.ToString(), new Vector2(num81 + (10f * inventoryScale), num82 + (26f * inventoryScale)), color12, 0f, vector6, num85, SpriteEffects.None, 0f); - } - } - } - } - } - if (player[myPlayer].chest == -2) - { - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontMouseText, "Piggy Bank", new Vector2(284f, 210f), new Color(mouseTextColor, mouseTextColor, mouseTextColor, mouseTextColor), 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - inventoryScale = 0.75f; - for (int num86 = 0; num86 < 5; num86++) - { - for (int num87 = 0; num87 < 4; num87++) - { - int num88 = (int) (73f + ((num86 * 0x38) * inventoryScale)); - int num89 = (int) (210f + ((num87 * 0x38) * inventoryScale)); - int num90 = num86 + (num87 * 5); - Color color13 = new Color(100, 100, 100, 100); - if (((mouseState.X >= num88) && (mouseState.X <= (num88 + (inventoryBackTexture.Width * inventoryScale)))) && ((mouseState.Y >= num89) && (mouseState.Y <= (num89 + (inventoryBackTexture.Height * inventoryScale))))) - { - player[myPlayer].mouseInterface = true; - if (mouseLeftRelease && (mouseState.LeftButton == ButtonState.Pressed)) - { - if ((player[myPlayer].selectedItem != num90) || (player[myPlayer].itemAnimation <= 0)) - { - Item item5 = Main.mouseItem; - Main.mouseItem = player[myPlayer].bank[num90]; - player[myPlayer].bank[num90] = item5; - if ((player[myPlayer].bank[num90].type == 0) || (player[myPlayer].bank[num90].stack < 1)) - { - player[myPlayer].bank[num90] = new Item(); - } - if ((Main.mouseItem.IsTheSameAs(player[myPlayer].bank[num90]) && (player[myPlayer].bank[num90].stack != player[myPlayer].bank[num90].maxStack)) && (Main.mouseItem.stack != Main.mouseItem.maxStack)) - { - if ((Main.mouseItem.stack + player[myPlayer].bank[num90].stack) <= Main.mouseItem.maxStack) - { - Item item14 = player[myPlayer].bank[num90]; - item14.stack += Main.mouseItem.stack; - Main.mouseItem.stack = 0; - } - else - { - int num91 = Main.mouseItem.maxStack - player[myPlayer].bank[num90].stack; - Item item15 = player[myPlayer].bank[num90]; - item15.stack += num91; - Main.mouseItem.stack -= num91; - } - } - if ((Main.mouseItem.type == 0) || (Main.mouseItem.stack < 1)) - { - Main.mouseItem = new Item(); - } - if ((Main.mouseItem.type > 0) || (player[myPlayer].bank[num90].type > 0)) - { - Recipe.FindRecipes(); - PlaySound(7, -1, -1, 1); - } - } - } - else if ((((stackSplit <= 1) && (mouseState.RightButton == ButtonState.Pressed)) && (Main.mouseItem.IsTheSameAs(player[myPlayer].bank[num90]) || (Main.mouseItem.type == 0))) && ((Main.mouseItem.stack < Main.mouseItem.maxStack) || (Main.mouseItem.type == 0))) - { - if (Main.mouseItem.type == 0) - { - Main.mouseItem = (Item) player[myPlayer].bank[num90].Clone(); - Main.mouseItem.stack = 0; - } - Main.mouseItem.stack++; - Item item16 = player[myPlayer].bank[num90]; - item16.stack--; - if (player[myPlayer].bank[num90].stack <= 0) - { - player[myPlayer].bank[num90] = new Item(); - } - Recipe.FindRecipes(); - soundInstanceMenuTick.Stop(); - soundInstanceMenuTick = soundMenuTick.CreateInstance(); - PlaySound(12, -1, -1, 1); - if (stackSplit == 0) - { - stackSplit = 15; - } - else - { - stackSplit = stackDelay; - } - } - cursorText = player[myPlayer].bank[num90].name; - toolTip = (Item) player[myPlayer].bank[num90].Clone(); - if (player[myPlayer].bank[num90].stack > 1) - { - obj2 = cursorText; - cursorText = string.Concat(new object[] { obj2, " (", player[myPlayer].bank[num90].stack, ")" }); - } - } - vector6 = new Vector2(); - this.spriteBatch.Draw(inventoryBackTexture, new Vector2((float) num88, (float) num89), new Rectangle(0, 0, inventoryBackTexture.Width, inventoryBackTexture.Height), color2, 0f, vector6, inventoryScale, SpriteEffects.None, 0f); - color13 = Color.White; - if ((player[myPlayer].bank[num90].type > 0) && (player[myPlayer].bank[num90].stack > 0)) - { - float num92 = 1f; - if ((itemTexture[player[myPlayer].bank[num90].type].Width > 0x20) || (itemTexture[player[myPlayer].bank[num90].type].Height > 0x20)) - { - if (itemTexture[player[myPlayer].bank[num90].type].Width > itemTexture[player[myPlayer].bank[num90].type].Height) - { - num92 = 32f / ((float) itemTexture[player[myPlayer].bank[num90].type].Width); - } - else - { - num92 = 32f / ((float) itemTexture[player[myPlayer].bank[num90].type].Height); - } - } - num92 *= inventoryScale; - vector6 = new Vector2(); - this.spriteBatch.Draw(itemTexture[player[myPlayer].bank[num90].type], new Vector2((num88 + (26f * inventoryScale)) - ((itemTexture[player[myPlayer].bank[num90].type].Width * 0.5f) * num92), (num89 + (26f * inventoryScale)) - ((itemTexture[player[myPlayer].bank[num90].type].Height * 0.5f) * num92)), new Rectangle(0, 0, itemTexture[player[myPlayer].bank[num90].type].Width, itemTexture[player[myPlayer].bank[num90].type].Height), player[myPlayer].bank[num90].GetAlpha(color13), 0f, vector6, num92, SpriteEffects.None, 0f); - color22 = new Color(); - if (player[myPlayer].bank[num90].color != color22) - { - vector6 = new Vector2(); - this.spriteBatch.Draw(itemTexture[player[myPlayer].bank[num90].type], new Vector2((num88 + (26f * inventoryScale)) - ((itemTexture[player[myPlayer].bank[num90].type].Width * 0.5f) * num92), (num89 + (26f * inventoryScale)) - ((itemTexture[player[myPlayer].bank[num90].type].Height * 0.5f) * num92)), new Rectangle(0, 0, itemTexture[player[myPlayer].bank[num90].type].Width, itemTexture[player[myPlayer].bank[num90].type].Height), player[myPlayer].bank[num90].GetColor(color13), 0f, vector6, num92, SpriteEffects.None, 0f); - } - if (player[myPlayer].bank[num90].stack > 1) - { - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontItemStack, player[myPlayer].bank[num90].stack.ToString(), new Vector2(num88 + (10f * inventoryScale), num89 + (26f * inventoryScale)), color13, 0f, vector6, num92, SpriteEffects.None, 0f); - } - } - } - } - } - } - if (!playerInventory) - { - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontMouseText, "Items", new Vector2(215f, 0f), new Color(mouseTextColor, mouseTextColor, mouseTextColor, mouseTextColor), 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - int num102 = 20; - float num103 = 1f; - for (int num104 = 0; num104 < 10; num104++) - { - if (num104 == player[myPlayer].selectedItem) - { - if (hotbarScale[num104] < 1f) - { - hotbarScale[num104] += 0.05f; - } - } - else if (hotbarScale[num104] > 0.75) - { - hotbarScale[num104] -= 0.05f; - } - int num105 = (int) (20f + (22f * (1f - hotbarScale[num104]))); - int a = (int) (75f + (150f * hotbarScale[num104])); - Color color15 = new Color(0xff, 0xff, 0xff, a); - vector6 = new Vector2(); - this.spriteBatch.Draw(inventoryBackTexture, new Vector2((float) num102, (float) num105), new Rectangle(0, 0, inventoryBackTexture.Width, inventoryBackTexture.Height), new Color(100, 100, 100, 100), 0f, vector6, hotbarScale[num104], SpriteEffects.None, 0f); - if ((((mouseState.X >= num102) && (mouseState.X <= (num102 + (inventoryBackTexture.Width * hotbarScale[num104])))) && ((mouseState.Y >= num105) && (mouseState.Y <= (num105 + (inventoryBackTexture.Height * hotbarScale[num104]))))) && !player[myPlayer].channel) - { - player[myPlayer].mouseInterface = true; - if (mouseState.LeftButton == ButtonState.Pressed) - { - player[myPlayer].changeItem = num104; - } - player[myPlayer].showItemIcon = false; - cursorText = player[myPlayer].inventory[num104].name; - if (player[myPlayer].inventory[num104].stack > 1) - { - obj2 = cursorText; - cursorText = string.Concat(new object[] { obj2, " (", player[myPlayer].inventory[num104].stack, ")" }); - } - rare = player[myPlayer].inventory[num104].rare; - } - if ((player[myPlayer].inventory[num104].type > 0) && (player[myPlayer].inventory[num104].stack > 0)) - { - num103 = 1f; - if ((itemTexture[player[myPlayer].inventory[num104].type].Width > 0x20) || (itemTexture[player[myPlayer].inventory[num104].type].Height > 0x20)) - { - if (itemTexture[player[myPlayer].inventory[num104].type].Width > itemTexture[player[myPlayer].inventory[num104].type].Height) - { - num103 = 32f / ((float) itemTexture[player[myPlayer].inventory[num104].type].Width); - } - else - { - num103 = 32f / ((float) itemTexture[player[myPlayer].inventory[num104].type].Height); - } - } - num103 *= hotbarScale[num104]; - vector6 = new Vector2(); - this.spriteBatch.Draw(itemTexture[player[myPlayer].inventory[num104].type], new Vector2((num102 + (26f * hotbarScale[num104])) - ((itemTexture[player[myPlayer].inventory[num104].type].Width * 0.5f) * num103), (num105 + (26f * hotbarScale[num104])) - ((itemTexture[player[myPlayer].inventory[num104].type].Height * 0.5f) * num103)), new Rectangle(0, 0, itemTexture[player[myPlayer].inventory[num104].type].Width, itemTexture[player[myPlayer].inventory[num104].type].Height), player[myPlayer].inventory[num104].GetAlpha(color15), 0f, vector6, num103, SpriteEffects.None, 0f); - color22 = new Color(); - if (player[myPlayer].inventory[num104].color != color22) - { - vector6 = new Vector2(); - this.spriteBatch.Draw(itemTexture[player[myPlayer].inventory[num104].type], new Vector2((num102 + (26f * hotbarScale[num104])) - ((itemTexture[player[myPlayer].inventory[num104].type].Width * 0.5f) * num103), (num105 + (26f * hotbarScale[num104])) - ((itemTexture[player[myPlayer].inventory[num104].type].Height * 0.5f) * num103)), new Rectangle(0, 0, itemTexture[player[myPlayer].inventory[num104].type].Width, itemTexture[player[myPlayer].inventory[num104].type].Height), player[myPlayer].inventory[num104].GetColor(color15), 0f, vector6, num103, SpriteEffects.None, 0f); - } - if (player[myPlayer].inventory[num104].stack > 1) - { - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontItemStack, player[myPlayer].inventory[num104].stack.ToString(), new Vector2(num102 + (10f * hotbarScale[num104]), num105 + (26f * hotbarScale[num104])), color15, 0f, vector6, num103, SpriteEffects.None, 0f); - } - if (player[myPlayer].inventory[num104].potion) - { - Color alpha = player[myPlayer].inventory[num104].GetAlpha(color15); - float num107 = ((float) player[myPlayer].potionDelay) / ((float) Item.potionDelay); - float num108 = alpha.R * num107; - float num109 = alpha.G * num107; - float num110 = alpha.B * num107; - float num111 = alpha.A * num107; - alpha = new Color((int) ((byte) num108), (int) ((byte) num109), (int) ((byte) num110), (int) ((byte) num111)); - vector6 = new Vector2(); - this.spriteBatch.Draw(cdTexture, new Vector2((num102 + (26f * hotbarScale[num104])) - ((cdTexture.Width * 0.5f) * num103), (num105 + (26f * hotbarScale[num104])) - ((cdTexture.Height * 0.5f) * num103)), new Rectangle(0, 0, cdTexture.Width, cdTexture.Height), alpha, 0f, vector6, num103, SpriteEffects.None, 0f); - } - } - num102 += ((int) (inventoryBackTexture.Width * hotbarScale[num104])) + 4; - } - } - if (((cursorText != null) && (cursorText != "")) && (Main.mouseItem.type == 0)) - { - player[myPlayer].showItemIcon = false; - this.MouseText(cursorText, rare); - flag = true; - } - if (chatMode) - { - this.textBlinkerCount++; - if (this.textBlinkerCount >= 20) - { - if (this.textBlinkerState == 0) - { - this.textBlinkerState = 1; - } - else - { - this.textBlinkerState = 0; - } - this.textBlinkerCount = 0; - } - string chatText = Main.chatText; - if (this.textBlinkerState == 1) - { - chatText = chatText + "|"; - } - vector6 = new Vector2(); - this.spriteBatch.Draw(textBackTexture, new Vector2(78f, (float) (screenHeight - 0x24)), new Rectangle(0, 0, textBackTexture.Width, textBackTexture.Height), new Color(100, 100, 100, 100), 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - for (int num112 = 0; num112 < 5; num112++) - { - int num113 = 0; - int num114 = 0; - Color color17 = Color.Black; - switch (num112) - { - case 0: - num113 = -2; - break; - - case 1: - num113 = 2; - break; - - case 2: - num114 = -2; - break; - - case 3: - num114 = 2; - break; - - case 4: - color17 = new Color((int) mouseTextColor, (int) mouseTextColor, (int) mouseTextColor, (int) mouseTextColor); - break; - } - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontMouseText, chatText, new Vector2((float) (0x58 + num113), (float) ((screenHeight - 30) + num114)), color17, 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - } - } - for (int k = 0; k < numChatLines; k++) - { - if (chatMode || (chatLine[k].showTime > 0)) - { - float num116 = ((float) mouseTextColor) / 255f; - for (int num117 = 0; num117 < 5; num117++) - { - int num118 = 0; - int num119 = 0; - Color color18 = Color.Black; - switch (num117) - { - case 0: - num118 = -2; - break; - - case 1: - num118 = 2; - break; - - case 2: - num119 = -2; - break; - - case 3: - num119 = 2; - break; - - case 4: - color18 = new Color((int) ((byte) (chatLine[k].color.R * num116)), (int) ((byte) (chatLine[k].color.G * num116)), (int) ((byte) (chatLine[k].color.B * num116)), (int) mouseTextColor); - break; - } - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontMouseText, chatLine[k].text, new Vector2((float) (0x58 + num118), (float) ((((screenHeight - 30) + num119) - 0x1c) - (k * 0x15))), color18, 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - } - } - } - if (player[myPlayer].dead) - { - string str10 = "You were slain..."; - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontDeathText, str10, new Vector2((float) ((screenWidth / 2) - (str10.Length * 10)), (float) ((screenHeight / 2) - 20)), player[myPlayer].GetDeathAlpha(new Color(0, 0, 0, 0)), 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - } - vector6 = new Vector2(); - this.spriteBatch.Draw(cursorTexture, new Vector2((float) (mouseState.X + 1), (float) (mouseState.Y + 1)), new Rectangle(0, 0, cursorTexture.Width, cursorTexture.Height), new Color((int) (cursorColor.R * 0.2f), (int) (cursorColor.G * 0.2f), (int) (cursorColor.B * 0.2f), (int) (cursorColor.A * 0.5f)), 0f, vector6, (float) (cursorScale * 1.1f), SpriteEffects.None, 0f); - vector6 = new Vector2(); - this.spriteBatch.Draw(cursorTexture, new Vector2((float) mouseState.X, (float) mouseState.Y), new Rectangle(0, 0, cursorTexture.Width, cursorTexture.Height), cursorColor, 0f, vector6, cursorScale, SpriteEffects.None, 0f); - if ((Main.mouseItem.type > 0) && (Main.mouseItem.stack > 0)) - { - player[myPlayer].showItemIcon = false; - player[myPlayer].showItemIcon2 = 0; - flag = true; - float num120 = 1f; - if ((itemTexture[Main.mouseItem.type].Width > 0x20) || (itemTexture[Main.mouseItem.type].Height > 0x20)) - { - if (itemTexture[Main.mouseItem.type].Width > itemTexture[Main.mouseItem.type].Height) - { - num120 = 32f / ((float) itemTexture[Main.mouseItem.type].Width); - } - else - { - num120 = 32f / ((float) itemTexture[Main.mouseItem.type].Height); - } - } - float num121 = 1f; - Color color19 = Color.White; - num120 *= num121; - vector6 = new Vector2(); - this.spriteBatch.Draw(itemTexture[Main.mouseItem.type], new Vector2((mouseState.X + (26f * num121)) - ((itemTexture[Main.mouseItem.type].Width * 0.5f) * num120), (mouseState.Y + (26f * num121)) - ((itemTexture[Main.mouseItem.type].Height * 0.5f) * num120)), new Rectangle(0, 0, itemTexture[Main.mouseItem.type].Width, itemTexture[Main.mouseItem.type].Height), Main.mouseItem.GetAlpha(color19), 0f, vector6, num120, SpriteEffects.None, 0f); - color22 = new Color(); - if (Main.mouseItem.color != color22) - { - vector6 = new Vector2(); - this.spriteBatch.Draw(itemTexture[Main.mouseItem.type], new Vector2((mouseState.X + (26f * num121)) - ((itemTexture[Main.mouseItem.type].Width * 0.5f) * num120), (mouseState.Y + (26f * num121)) - ((itemTexture[Main.mouseItem.type].Height * 0.5f) * num120)), new Rectangle(0, 0, itemTexture[Main.mouseItem.type].Width, itemTexture[Main.mouseItem.type].Height), Main.mouseItem.GetColor(color19), 0f, vector6, num120, SpriteEffects.None, 0f); - } - if (Main.mouseItem.stack > 1) - { - vector6 = new Vector2(); - this.spriteBatch.DrawString(fontItemStack, Main.mouseItem.stack.ToString(), new Vector2(mouseState.X + (10f * num121), mouseState.Y + (26f * num121)), color19, 0f, vector6, num120, SpriteEffects.None, 0f); - } - } - Rectangle rectangle3 = new Rectangle(mouseState.X + ((int) screenPosition.X), mouseState.Y + ((int) screenPosition.Y), 1, 1); - if (!flag) - { - int num122 = (0x1a * player[myPlayer].statLifeMax) / num12; - int num123 = 0; - if (player[myPlayer].statLifeMax > 200) - { - num122 = 260; - num123 += 0x1a; - } - if (((mouseState.X > 500) && (mouseState.X < (500 + num122))) && ((mouseState.Y > 0x20) && (mouseState.Y < ((0x20 + heartTexture.Height) + num123)))) - { - player[myPlayer].showItemIcon = false; - string str11 = player[myPlayer].statLife + "/" + player[myPlayer].statLifeMax; - this.MouseText(str11, 0); - flag = true; - } - } - if (!flag) - { - int num124 = 0x18; - int num125 = (0x1c * player[myPlayer].statManaMax) / num19; - if (((mouseState.X > 0x2fa) && (mouseState.X < (0x2fa + num124))) && ((mouseState.Y > 30) && (mouseState.Y < (30 + num125)))) - { - player[myPlayer].showItemIcon = false; - string str12 = player[myPlayer].statMana + "/" + player[myPlayer].statManaMax; - this.MouseText(str12, 0); - flag = true; - } - } - if (!flag) - { - for (int num126 = 0; num126 < 200; num126++) - { - if (item[num126].active) - { - Rectangle rectangle4 = new Rectangle((int) ((item[num126].position.X + (item[num126].width * 0.5)) - (itemTexture[item[num126].type].Width * 0.5)), (((int) item[num126].position.Y) + item[num126].height) - itemTexture[item[num126].type].Height, itemTexture[item[num126].type].Width, itemTexture[item[num126].type].Height); - if (rectangle3.Intersects(rectangle4)) - { - player[myPlayer].showItemIcon = false; - string str13 = item[num126].name; - if (item[num126].stack > 1) - { - obj2 = str13; - str13 = string.Concat(new object[] { obj2, " (", item[num126].stack, ")" }); - } - if ((item[num126].owner < 8) && showItemOwner) - { - str13 = str13 + " <" + player[item[num126].owner].name + ">"; - } - rare = item[num126].rare; - this.MouseText(str13, rare); - flag = true; - break; - } - } - } - } - for (int m = 0; m < 8; m++) - { - if ((player[m].active && (myPlayer != m)) && !player[m].dead) - { - Rectangle rectangle5 = new Rectangle((int) ((player[m].position.X + (player[m].width * 0.5)) - 16.0), (int) ((player[m].position.Y + player[m].height) - 48f), 0x20, 0x30); - if (!flag && rectangle3.Intersects(rectangle5)) - { - player[myPlayer].showItemIcon = false; - string str14 = string.Concat(new object[] { player[m].name, ": ", player[m].statLife, "/", player[m].statLifeMax }); - if (player[m].hostile) - { - str14 = str14 + " (PvP)"; - } - this.MouseText(str14, 0); - } - } - } - if (!flag) - { - for (int num128 = 0; num128 < 0x3e8; num128++) - { - if (npc[num128].active) - { - Rectangle rectangle6 = new Rectangle((int) ((npc[num128].position.X + (npc[num128].width * 0.5)) - (npcTexture[npc[num128].type].Width * 0.5)), (((int) npc[num128].position.Y) + npc[num128].height) - (npcTexture[npc[num128].type].Height / npcFrameCount[npc[num128].type]), npcTexture[npc[num128].type].Width, npcTexture[npc[num128].type].Height / npcFrameCount[npc[num128].type]); - if (rectangle3.Intersects(rectangle6)) - { - bool flag4 = false; - if (npc[num128].townNPC) - { - Rectangle rectangle7 = new Rectangle((((int) player[myPlayer].position.X) + (player[myPlayer].width / 2)) - (Player.tileRangeX * 0x10), (((int) player[myPlayer].position.Y) + (player[myPlayer].height / 2)) - (Player.tileRangeY * 0x10), (Player.tileRangeX * 0x10) * 2, (Player.tileRangeY * 0x10) * 2); - Rectangle rectangle8 = new Rectangle((int) npc[num128].position.X, (int) npc[num128].position.Y, npc[num128].width, npc[num128].height); - if (rectangle7.Intersects(rectangle8)) - { - flag4 = true; - } - } - if (flag4) - { - int num129 = -((npc[num128].width / 2) + 8); - SpriteEffects effects = SpriteEffects.None; - if (npc[num128].spriteDirection == -1) - { - effects = SpriteEffects.FlipHorizontally; - num129 = (npc[num128].width / 2) + 8; - } - vector6 = new Vector2(); - this.spriteBatch.Draw(chatTexture, new Vector2((((npc[num128].position.X + (npc[num128].width / 2)) - screenPosition.X) - (chatTexture.Width / 2)) - num129, (npc[num128].position.Y - chatTexture.Height) - screenPosition.Y), new Rectangle(0, 0, chatTexture.Width, chatTexture.Height), new Color(mouseTextColor, mouseTextColor, mouseTextColor, mouseTextColor), 0f, vector6, (float) 1f, effects, 0f); - if ((mouseState.RightButton == ButtonState.Pressed) && npcChatRelease) - { - npcChatRelease = false; - if (player[myPlayer].talkNPC != num128) - { - player[myPlayer].sign = -1; - editSign = false; - player[myPlayer].talkNPC = num128; - playerInventory = false; - player[myPlayer].chest = -1; - npcChatText = npc[num128].GetChat(); - PlaySound(10, -1, -1, 1); - } - } - } - player[myPlayer].showItemIcon = false; - string str15 = string.Concat(new object[] { npc[num128].name, ": ", npc[num128].life, "/", npc[num128].lifeMax }); - this.MouseText(str15, 0); - break; - } - } - } - } - if (mouseState.RightButton == ButtonState.Pressed) - { - npcChatRelease = false; - } - else - { - npcChatRelease = true; - } - if (player[myPlayer].showItemIcon && ((player[myPlayer].inventory[player[myPlayer].selectedItem].type > 0) || (player[myPlayer].showItemIcon2 > 0))) - { - int type = player[myPlayer].inventory[player[myPlayer].selectedItem].type; - Color color20 = player[myPlayer].inventory[player[myPlayer].selectedItem].GetAlpha(Color.White); - Color color21 = player[myPlayer].inventory[player[myPlayer].selectedItem].GetColor(Color.White); - if (player[myPlayer].showItemIcon2 > 0) - { - type = player[myPlayer].showItemIcon2; - color20 = Color.White; - color21 = new Color(); - } - vector6 = new Vector2(); - this.spriteBatch.Draw(itemTexture[type], new Vector2((float) (mouseState.X + 10), (float) (mouseState.Y + 10)), new Rectangle(0, 0, itemTexture[type].Width, itemTexture[type].Height), color20, 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - if ((player[myPlayer].showItemIcon2 == 0) && (player[myPlayer].inventory[player[myPlayer].selectedItem].color != new Color())) - { - this.spriteBatch.Draw(itemTexture[player[myPlayer].inventory[player[myPlayer].selectedItem].type], new Vector2((float) (mouseState.X + 10), (float) (mouseState.Y + 10)), new Rectangle(0, 0, itemTexture[player[myPlayer].inventory[player[myPlayer].selectedItem].type].Width, itemTexture[player[myPlayer].inventory[player[myPlayer].selectedItem].type].Height), color21, 0f, new Vector2(), (float) 1f, SpriteEffects.None, 0f); - } - } - player[myPlayer].showItemIcon = false; - player[myPlayer].showItemIcon2 = 0; - } - } - - protected void DrawMenu() - { - string[] strArray3; - Vector2 vector9; - evilTiles = 0; - chatMode = false; - for (int i = 0; i < numChatLines; i++) - { - chatLine[i] = new ChatLine(); - } - this.DrawFPS(); - screenPosition.Y = (float) ((worldSurface * 16.0) - screenHeight); - background = 0; - byte r = (byte) ((0xff + (tileColor.R * 2)) / 3); - Color color = new Color(r, r, r, 0xff); - this.logoRotation += this.logoRotationSpeed * 3E-05f; - if (this.logoRotation > 0.1) - { - this.logoRotationDirection = -1f; - } - else if (this.logoRotation < -0.1) - { - this.logoRotationDirection = 1f; - } - if ((this.logoRotationSpeed < 20f) & (this.logoRotationDirection == 1f)) - { - this.logoRotationSpeed++; - } - else if ((this.logoRotationSpeed > -20f) & (this.logoRotationDirection == -1f)) - { - this.logoRotationSpeed--; - } - this.logoScale += this.logoScaleSpeed * 1E-05f; - if (this.logoScale > 1.1) - { - this.logoScaleDirection = -1f; - } - else if (this.logoScale < 0.9) - { - this.logoScaleDirection = 1f; - } - if ((this.logoScaleSpeed < 50f) & (this.logoScaleDirection == 1f)) - { - this.logoScaleSpeed++; - } - else if ((this.logoScaleSpeed > -50f) & (this.logoScaleDirection == -1f)) - { - this.logoScaleSpeed--; - } - this.spriteBatch.Draw(logoTexture, new Vector2((float) (screenWidth / 2), 100f), new Rectangle(0, 0, logoTexture.Width, logoTexture.Height), color, this.logoRotation, new Vector2((float) (logoTexture.Width / 2), (float) (logoTexture.Height / 2)), this.logoScale, SpriteEffects.None, 0f); - int num3 = 250; - int num4 = screenWidth / 2; - int num5 = 80; - int num6 = 0; - int menuMode = Main.menuMode; - int index = -1; - int num9 = 0; - int num10 = 0; - bool flag = false; - bool flag2 = false; - bool flag3 = false; - int num11 = 0; - bool[] flagArray = new bool[maxMenuItems]; - bool[] flagArray2 = new bool[maxMenuItems]; - int[] numArray = new int[maxMenuItems]; - int[] numArray2 = new int[maxMenuItems]; - for (int j = 0; j < maxMenuItems; j++) - { - flagArray[j] = false; - flagArray2[j] = false; - numArray[j] = 0; - numArray2[j] = 0; - } - string[] strArray = new string[maxMenuItems]; - if (Main.menuMode == -1) - { - Main.menuMode = 0; - } - if (netMode == 2) - { - bool flag4 = true; - for (int num13 = 0; num13 < 8; num13++) - { - if (num13 < 8) - { - try - { - strArray[num13] = Netplay.serverSock[num13].statusText; - if (Netplay.serverSock[num13].active && showSpam) - { - IntPtr ptr = (IntPtr) 12; - strArray3 = strArray; - object obj2 = strArray3[(int)ptr]; - (strArray3 = strArray)[(int) (ptr = (IntPtr) num13)] = string.Concat(new object[] { obj2, " (", NetMessage.buffer[num13].spamCount, ")" }); - } - } - catch - { - strArray[num13] = ""; - } - flagArray[num13] = true; - if ((strArray[num13] != "") && (strArray[num13] != null)) - { - flag4 = false; - } - } - } - if (flag4) - { - strArray[0] = "Start a new instance of Terraria to join!"; - strArray[1] = "Running on port " + Netplay.serverPort; - } - num6 = 11; - strArray[9] = statusText; - flagArray[9] = true; - num3 = 170; - num5 = 30; - numArray[10] = 20; - numArray[10] = 40; - strArray[10] = "Disconnect"; - if (this.selectedMenu == 10) - { - Netplay.disconnect = true; - PlaySound(11, -1, -1, 1); - } - } - else if (Main.menuMode == 0x1f) - { - string password = Netplay.password; - Netplay.password = GetInputText(Netplay.password); - if (password != Netplay.password) - { - PlaySound(12, -1, -1, 1); - } - strArray[0] = "Server Requires Password:"; - this.textBlinkerCount++; - if (this.textBlinkerCount >= 20) - { - if (this.textBlinkerState == 0) - { - this.textBlinkerState = 1; - } - else - { - this.textBlinkerState = 0; - } - this.textBlinkerCount = 0; - } - strArray[1] = Netplay.password; - if (this.textBlinkerState == 1) - { - (strArray3 = strArray)[1] = strArray3[1] + "|"; - numArray2[1] = 1; - } - else - { - (strArray3 = strArray)[1] = strArray3[1] + " "; - } - flagArray[0] = true; - flagArray[1] = true; - numArray[1] = -20; - numArray[2] = 20; - strArray[2] = "Accept"; - strArray[3] = "Back"; - num6 = 4; - if (this.selectedMenu == 3) - { - PlaySound(11, -1, -1, 1); - Main.menuMode = 0; - Netplay.disconnect = true; - Netplay.password = ""; - } - else if ((this.selectedMenu == 2) || inputTextEnter) - { - NetMessage.SendData(0x26, -1, -1, Netplay.password, 0, 0f, 0f, 0f); - Main.menuMode = 14; - } - } - else if ((netMode == 1) || (Main.menuMode == 14)) - { - num6 = 2; - strArray[0] = statusText; - flagArray[0] = true; - num3 = 300; - strArray[1] = "Cancel"; - if (this.selectedMenu == 1) - { - Netplay.disconnect = true; - Netplay.clientSock.tcpClient.Close(); - PlaySound(11, -1, -1, 1); - Main.menuMode = 0; - netMode = 0; - } - } - else if (Main.menuMode == 30) - { - string str2 = Netplay.password; - Netplay.password = GetInputText(Netplay.password); - if (str2 != Netplay.password) - { - PlaySound(12, -1, -1, 1); - } - strArray[0] = "Enter Server Password:"; - this.textBlinkerCount++; - if (this.textBlinkerCount >= 20) - { - if (this.textBlinkerState == 0) - { - this.textBlinkerState = 1; - } - else - { - this.textBlinkerState = 0; - } - this.textBlinkerCount = 0; - } - strArray[1] = Netplay.password; - if (this.textBlinkerState == 1) - { - (strArray3 = strArray)[1] = strArray3[1] + "|"; - numArray2[1] = 1; - } - else - { - (strArray3 = strArray)[1] = strArray3[1] + " "; - } - flagArray[0] = true; - flagArray[1] = true; - numArray[1] = -20; - numArray[2] = 20; - strArray[2] = "Accept"; - strArray[3] = "Back"; - num6 = 4; - if (this.selectedMenu == 3) - { - PlaySound(11, -1, -1, 1); - Main.menuMode = 6; - Netplay.password = ""; - } - else if ((this.selectedMenu == 2) || inputTextEnter) - { - WorldGen.serverLoadWorld(); - Main.menuMode = 10; - } - } - else if (Main.menuMode == 15) - { - num6 = 2; - strArray[0] = statusText; - flagArray[0] = true; - num3 = 80; - num5 = 400; - strArray[1] = "Back"; - if (this.selectedMenu == 1) - { - Netplay.disconnect = true; - PlaySound(11, -1, -1, 1); - Main.menuMode = 0; - netMode = 0; - } - } - else if (Main.menuMode == 10) - { - num6 = 1; - strArray[0] = statusText; - flagArray[0] = true; - num3 = 300; - } - else if (Main.menuMode == 0) - { - menuMultiplayer = false; - netMode = 0; - strArray[0] = "Start Server"; - strArray[1] = "Settings"; - strArray[2] = "Exit"; - num6 = 4; - if (this.selectedMenu == 2) - { - this.QuitGame(); - } - if (this.selectedMenu == 0) - { - LoadWorlds(); - PlaySound(10, -1, -1, 1); - Main.menuMode = 6; - menuMultiplayer = true; - } - if (this.selectedMenu == 1) - { - PlaySound(10, -1, -1, 1); - Main.menuMode = 11; - } - } - else if (Main.menuMode == 1) - { - //This isn't Free Terraria - } - else if (Main.menuMode == 2) - { - //Nor is this - } - else if (Main.menuMode == 20) - { - //Or this - } - else if (Main.menuMode == 0x11) - { - //Especially not this - } - else if (Main.menuMode == 0x13) - { - //Nope - } - else if (Main.menuMode == 0x15) - { - // - } - else if (Main.menuMode == 0x16) - { - // - } - else if (Main.menuMode == 0x17) - { - // - } - else if (Main.menuMode == 0x18) - { - // - } - else if (Main.menuMode == 3) - { - - } - else if (Main.menuMode == 4) - { - num3 = 220; - num5 = 60; - strArray[5] = "Back"; - for (int num16 = 0; num16 < 5; num16++) - { - if (num16 < numLoadPlayers) - { - strArray[num16] = loadPlayer[num16].name; - } - else - { - strArray[num16] = null; - } - } - num6 = 6; - if ((this.focusMenu >= 0) && (this.focusMenu < numLoadPlayers)) - { - index = this.focusMenu; - Vector2 vector2 = fontDeathText.MeasureString(strArray[index]); - num9 = (int) (((screenWidth / 2) + (vector2.X * 0.5)) + 10.0); - num10 = (num3 + (num5 * this.focusMenu)) + 4; - } - if (this.selectedMenu == 5) - { - PlaySound(11, -1, -1, 1); - Main.menuMode = 1; - } - else if (this.selectedMenu >= 0) - { - this.selectedPlayer = this.selectedMenu; - PlaySound(10, -1, -1, 1); - Main.menuMode = 5; - } - } - else if (Main.menuMode == 5) - { - strArray[0] = "Delete " + loadPlayer[this.selectedPlayer].name + "?"; - flagArray[0] = true; - strArray[1] = "Yes"; - strArray[2] = "No"; - num6 = 3; - if (this.selectedMenu == 1) - { - ErasePlayer(this.selectedPlayer); - PlaySound(10, -1, -1, 1); - Main.menuMode = 1; - } - else if (this.selectedMenu == 2) - { - PlaySound(11, -1, -1, 1); - Main.menuMode = 1; - } - } - else if (Main.menuMode == 6) - { - num3 = 190; - num5 = 50; - strArray[5] = "Create World"; - strArray[6] = "Delete"; - if (numLoadWorlds == 5) - { - flagArray2[5] = true; - strArray[5] = ""; - } - else if (numLoadWorlds == 0) - { - flagArray2[6] = true; - strArray[6] = ""; - } - strArray[7] = "Back"; - for (int num17 = 0; num17 < 5; num17++) - { - if (num17 < numLoadWorlds) - { - strArray[num17] = loadWorld[num17]; - } - else - { - strArray[num17] = null; - } - } - num6 = 8; - if (this.selectedMenu == 7) - { - if (menuMultiplayer) - { - Main.menuMode = 12; - } - else - { - Main.menuMode = 1; - } - PlaySound(11, -1, -1, 1); - } - else if (this.selectedMenu == 5) - { - PlaySound(10, -1, -1, 1); - Main.menuMode = 0x10; - Main.newWorldName = "World " + (numLoadWorlds + 1); - } - else if (this.selectedMenu == 6) - { - PlaySound(10, -1, -1, 1); - Main.menuMode = 8; - } - else if (this.selectedMenu >= 0) - { - if (menuMultiplayer) - { - PlaySound(10, -1, -1, 1); - worldPathName = loadWorldPath[this.selectedMenu]; - Main.menuMode = 30; - } - else - { - PlaySound(10, -1, -1, 1); - worldPathName = loadWorldPath[this.selectedMenu]; - WorldGen.playWorld(); - Main.menuMode = 10; - } - } - } - else if (Main.menuMode == 7) - { - string newWorldName = Main.newWorldName; - Main.newWorldName = GetInputText(Main.newWorldName); - if (Main.newWorldName.Length > 20) - { - Main.newWorldName = Main.newWorldName.Substring(0, 20); - } - if (newWorldName != Main.newWorldName) - { - PlaySound(12, -1, -1, 1); - } - strArray[0] = "Enter World Name:"; - flagArray2[2] = true; - if (Main.newWorldName != "") - { - if (Main.newWorldName.Substring(0, 1) == " ") - { - Main.newWorldName = ""; - } - for (int num18 = 0; num18 < Main.newWorldName.Length; num18++) - { - if (Main.newWorldName != " ") - { - flagArray2[2] = false; - } - } - } - this.textBlinkerCount++; - if (this.textBlinkerCount >= 20) - { - if (this.textBlinkerState == 0) - { - this.textBlinkerState = 1; - } - else - { - this.textBlinkerState = 0; - } - this.textBlinkerCount = 0; - } - strArray[1] = Main.newWorldName; - if (this.textBlinkerState == 1) - { - (strArray3 = strArray)[1] = strArray3[1] + "|"; - numArray2[1] = 1; - } - else - { - (strArray3 = strArray)[1] = strArray3[1] + " "; - } - flagArray[0] = true; - flagArray[1] = true; - numArray[1] = -20; - numArray[2] = 20; - strArray[2] = "Accept"; - strArray[3] = "Back"; - num6 = 4; - if (this.selectedMenu == 3) - { - PlaySound(11, -1, -1, 1); - Main.menuMode = 0x10; - } - if ((this.selectedMenu == 2) || (!flagArray2[2] && inputTextEnter)) - { - Main.menuMode = 10; - worldName = Main.newWorldName; - worldPathName = nextLoadWorld(); - WorldGen.CreateNewWorld(); - } - } - else if (Main.menuMode == 8) - { - num3 = 220; - num5 = 60; - strArray[5] = "Back"; - for (int num19 = 0; num19 < 5; num19++) - { - if (num19 < numLoadWorlds) - { - strArray[num19] = loadWorld[num19]; - } - else - { - strArray[num19] = null; - } - } - num6 = 6; - if (this.selectedMenu == 5) - { - PlaySound(11, -1, -1, 1); - Main.menuMode = 1; - } - else if (this.selectedMenu >= 0) - { - this.selectedWorld = this.selectedMenu; - PlaySound(10, -1, -1, 1); - Main.menuMode = 9; - } - } - else if (Main.menuMode == 9) - { - strArray[0] = "Delete " + loadWorld[this.selectedWorld] + "?"; - flagArray[0] = true; - strArray[1] = "Yes"; - strArray[2] = "No"; - num6 = 3; - if (this.selectedMenu == 1) - { - EraseWorld(this.selectedWorld); - PlaySound(10, -1, -1, 1); - Main.menuMode = 6; - } - else if (this.selectedMenu == 2) - { - PlaySound(11, -1, -1, 1); - Main.menuMode = 6; - } - } - else if (Main.menuMode == 11) - { - num3 = 180; - num5 = 60; - numArray[6] = 10; - num6 = 7; - if (this.graphics.IsFullScreen) - { - strArray[0] = "Fullscreen Mode"; - } - else - { - strArray[0] = "Windowed Mode"; - } - this.bgScroll = (int) Math.Round((double) ((1f - caveParrallax) * 500f)); - strArray[1] = "Cursor Color"; - strArray[2] = "Volume"; - strArray[3] = "Controls"; - strArray[4] = "Parallax"; - if (fixedTiming) - { - strArray[5] = "Frame Skip Off"; - } - else - { - strArray[5] = "Frame Skip On"; - } - strArray[6] = "Back"; - if (this.selectedMenu == 6) - { - PlaySound(11, -1, -1, 1); - this.SaveSettings(); - Main.menuMode = 0; - } - if (this.selectedMenu == 5) - { - PlaySound(12, -1, -1, 1); - if (fixedTiming) - { - fixedTiming = false; - } - else - { - fixedTiming = true; - } - } - if (this.selectedMenu == 4) - { - PlaySound(11, -1, -1, 1); - Main.menuMode = 0x1c; - } - if (this.selectedMenu == 3) - { - PlaySound(11, -1, -1, 1); - Main.menuMode = 0x1b; - } - if (this.selectedMenu == 2) - { - PlaySound(11, -1, -1, 1); - Main.menuMode = 0x1a; - } - if (this.selectedMenu == 1) - { - PlaySound(10, -1, -1, 1); - this.selColor = mouseColor; - Main.menuMode = 0x19; - } - if (this.selectedMenu == 0) - { - this.graphics.ToggleFullScreen(); - } - } - else if (Main.menuMode == 0x19) - { - flag = true; - num11 = 370; - num3 = 240; - num5 = 60; - mouseColor = this.selColor; - num6 = 3; - strArray[0] = ""; - strArray[1] = "Cursor Color"; - flagArray[1] = true; - numArray[2] = 170; - numArray[1] = 10; - strArray[2] = "Back"; - if (this.selectedMenu == 2) - { - Main.menuMode = 11; - PlaySound(11, -1, -1, 1); - } - } - else if (Main.menuMode == 0x1a) - { - flag2 = true; - num3 = 240; - num5 = 60; - num6 = 3; - strArray[0] = ""; - strArray[1] = "Volume"; - flagArray[1] = true; - numArray[2] = 170; - numArray[1] = 10; - strArray[2] = "Back"; - if (this.selectedMenu == 2) - { - Main.menuMode = 11; - PlaySound(11, -1, -1, 1); - } - } - else if (Main.menuMode == 0x1c) - { - caveParrallax = 1f - (((float) this.bgScroll) / 500f); - flag3 = true; - num3 = 240; - num5 = 60; - num6 = 3; - strArray[0] = ""; - strArray[1] = "Parallax"; - flagArray[1] = true; - numArray[2] = 170; - numArray[1] = 10; - strArray[2] = "Back"; - if (this.selectedMenu == 2) - { - Main.menuMode = 11; - PlaySound(11, -1, -1, 1); - } - } - else if (Main.menuMode == 0x1b) - { - num3 = 190; - num5 = 50; - num6 = 8; - string[] strArray2 = new string[] { cUp, cDown, cLeft, cRight, cJump, cThrowItem, cInv }; - if (this.setKey >= 0) - { - strArray2[this.setKey] = "_"; - } - strArray[0] = "Up........." + strArray2[0]; - strArray[1] = "Down......." + strArray2[1]; - strArray[2] = "Left......." + strArray2[2]; - strArray[3] = "Right......" + strArray2[3]; - strArray[4] = "Jump......." + strArray2[4]; - strArray[5] = "Throw......" + strArray2[5]; - strArray[6] = "Inventory.." + strArray2[6]; - numArray[7] = 10; - strArray[7] = "Back"; - if (this.selectedMenu == 7) - { - Main.menuMode = 11; - PlaySound(11, -1, -1, 1); - } - else if (this.selectedMenu >= 0) - { - this.setKey = this.selectedMenu; - } - if (this.setKey >= 0) - { - Keys[] pressedKeys = keyState.GetPressedKeys(); - if (pressedKeys.Length > 0) - { - string str5 = Convert.ToString(pressedKeys.GetValue(0)); - if (this.setKey == 0) - { - cUp = str5; - } - if (this.setKey == 1) - { - cDown = str5; - } - if (this.setKey == 2) - { - cLeft = str5; - } - if (this.setKey == 3) - { - cRight = str5; - } - if (this.setKey == 4) - { - cJump = str5; - } - if (this.setKey == 5) - { - cThrowItem = str5; - } - if (this.setKey == 6) - { - cInv = str5; - } - this.setKey = -1; - } - } - } - else if (Main.menuMode == 12) - { - PlaySound(11, -1, -1, 1); - Main.menuMode = 0; - } - else if (Main.menuMode == 13) - { - string getIP = Main.getIP; - Main.getIP = GetInputText(Main.getIP); - if (getIP != Main.getIP) - { - PlaySound(12, -1, -1, 1); - } - strArray[0] = "Enter Server IP Address:"; - flagArray2[2] = true; - if (Main.getIP != "") - { - if (Main.getIP.Substring(0, 1) == " ") - { - Main.getIP = ""; - } - for (int num20 = 0; num20 < Main.getIP.Length; num20++) - { - if (Main.getIP != " ") - { - flagArray2[2] = false; - } - } - } - this.textBlinkerCount++; - if (this.textBlinkerCount >= 20) - { - if (this.textBlinkerState == 0) - { - this.textBlinkerState = 1; - } - else - { - this.textBlinkerState = 0; - } - this.textBlinkerCount = 0; - } - strArray[1] = Main.getIP; - if (this.textBlinkerState == 1) - { - (strArray3 = strArray)[1] = strArray3[1] + "|"; - numArray2[1] = 1; - } - else - { - (strArray3 = strArray)[1] = strArray3[1] + " "; - } - flagArray[0] = true; - flagArray[1] = true; - numArray[1] = -20; - numArray[2] = 20; - strArray[2] = "Accept"; - strArray[3] = "Back"; - num6 = 4; - if (this.selectedMenu == 3) - { - PlaySound(11, -1, -1, 1); - Main.menuMode = 1; - } - if ((this.selectedMenu == 2) || (!flagArray2[2] && inputTextEnter)) - { - 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 == 0x10) - { - num3 = 200; - num5 = 60; - numArray[1] = 30; - numArray[2] = 30; - numArray[3] = 30; - numArray[4] = 70; - strArray[0] = "Choose world size:"; - flagArray[0] = true; - strArray[1] = "Small"; - strArray[2] = "Medium"; - strArray[3] = "Large"; - strArray[4] = "Back"; - num6 = 5; - if (this.selectedMenu == 4) - { - Main.menuMode = 6; - PlaySound(11, -1, -1, 1); - } - else if (this.selectedMenu > 0) - { - if (this.selectedMenu == 1) - { - maxTilesX = 0x1068; - maxTilesY = 0x4b0; - } - else if (this.selectedMenu == 2) - { - maxTilesX = 0x189c; - maxTilesY = 0x708; - } - else - { - maxTilesX = 0x20d0; - maxTilesY = 0x960; - } - Main.menuMode = 7; - PlaySound(10, -1, -1, 1); - WorldGen.setWorldSize(); - } - } - if (Main.menuMode != menuMode) - { - num6 = 0; - for (int num21 = 0; num21 < maxMenuItems; num21++) - { - this.menuItemScale[num21] = 0.8f; - } - } - int focusMenu = this.focusMenu; - this.selectedMenu = -1; - this.focusMenu = -1; - for (int k = 0; k < num6; k++) - { - if (strArray[k] != null) - { - if (flag) - { - string text = ""; - for (int num24 = 0; num24 < 6; num24++) - { - int num25 = num11; - int num26 = 370; - switch (num24) - { - case 0: - text = "Red:"; - break; - - case 1: - text = "Green:"; - num25 += 30; - break; - - case 2: - text = "Blue:"; - num25 += 60; - break; - - case 3: - text = this.selColor.R.ToString(); - num26 += 90; - break; - - case 4: - text = this.selColor.G.ToString(); - num26 += 90; - num25 += 30; - break; - - case 5: - text = this.selColor.B.ToString();; - num26 += 90; - num25 += 60; - break; - } - for (int num27 = 0; num27 < 5; num27++) - { - Color black = Color.Black; - if (num27 == 4) - { - black = color; - black.R = (byte) ((0xff + black.R) / 2); - black.G = (byte) ((0xff + black.R) / 2); - black.B = (byte) ((0xff + black.R) / 2); - } - int num28 = 0xff; - int num29 = black.R - (0xff - num28); - if (num29 < 0) - { - num29 = 0; - } - black = new Color((int) ((byte) num29), (int) ((byte) num29), (int) ((byte) num29), (int) ((byte) num28)); - int num30 = 0; - int num31 = 0; - switch (num27) - { - case 0: - num30 = -2; - break; - - case 1: - num30 = 2; - break; - - case 2: - num31 = -2; - break; - - case 3: - num31 = 2; - break; - } - vector9 = new Vector2(); - this.spriteBatch.DrawString(fontDeathText, text, new Vector2((float) (num26 + num30), (float) (num25 + num31)), black, 0f, vector9, (float) 0.5f, SpriteEffects.None, 0f); - } - } - bool flag5 = false; - for (int num32 = 0; num32 < 2; num32++) - { - for (int num33 = 0; num33 < 3; num33++) - { - int num34 = (num11 + (num33 * 30)) - 12; - int num35 = 360; - float scale = 0.9f; - if (num32 == 0) - { - num35 -= 70; - num34 += 2; - } - else - { - num35 -= 40; - } - text = "-"; - if (num32 == 1) - { - text = "+"; - } - Vector2 vector3 = new Vector2(24f, 24f); - int num37 = 0x8e; - if (((mouseState.X > num35) && (mouseState.X < (num35 + vector3.X))) && ((mouseState.Y > (num34 + 13)) && (mouseState.Y < ((num34 + 13) + vector3.Y)))) - { - if (this.focusColor != ((num32 + 1) * (num33 + 10))) - { - PlaySound(12, -1, -1, 1); - } - this.focusColor = (num32 + 1) * (num33 + 10); - flag5 = true; - num37 = 0xff; - if (mouseState.LeftButton == ButtonState.Pressed) - { - if (this.colorDelay <= 1) - { - if (this.colorDelay == 0) - { - this.colorDelay = 40; - } - else - { - this.colorDelay = 3; - } - int num38 = num32; - if (num32 == 0) - { - num38 = -1; - if (((this.selColor.R + this.selColor.G) + this.selColor.B) < 0xff) - { - num38 = 0; - } - } - if (((num33 == 0) && ((this.selColor.R + num38) >= 0)) && ((this.selColor.R + num38) <= 0xff)) - { - this.selColor.R = (byte) (this.selColor.R + num38); - } - if (((num33 == 1) && ((this.selColor.G + num38) >= 0)) && ((this.selColor.G + num38) <= 0xff)) - { - this.selColor.G = (byte) (this.selColor.G + num38); - } - if (((num33 == 2) && ((this.selColor.B + num38) >= 0)) && ((this.selColor.B + num38) <= 0xff)) - { - this.selColor.B = (byte) (this.selColor.B + num38); - } - } - this.colorDelay--; - } - else - { - this.colorDelay = 0; - } - } - for (int num39 = 0; num39 < 5; num39++) - { - Color color3 = Color.Black; - if (num39 == 4) - { - color3 = color; - color3.R = (byte) ((0xff + color3.R) / 2); - color3.G = (byte) ((0xff + color3.R) / 2); - color3.B = (byte) ((0xff + color3.R) / 2); - } - int num40 = color3.R - (0xff - num37); - if (num40 < 0) - { - num40 = 0; - } - color3 = new Color((int) ((byte) num40), (int) ((byte) num40), (int) ((byte) num40), (int) ((byte) num37)); - int num41 = 0; - int num42 = 0; - switch (num39) - { - case 0: - num41 = -2; - break; - - case 1: - num41 = 2; - break; - - case 2: - num42 = -2; - break; - - case 3: - num42 = 2; - break; - } - vector9 = new Vector2(); - this.spriteBatch.DrawString(fontDeathText, text, new Vector2((float) (num35 + num41), (float) (num34 + num42)), color3, 0f, vector9, scale, SpriteEffects.None, 0f); - } - } - } - if (!flag5) - { - this.focusColor = 0; - this.colorDelay = 0; - } - } - if (flag3) - { - int num43 = 400; - string str8 = ""; - for (int num44 = 0; num44 < 4; num44++) - { - int num45 = num43; - int num46 = 370; - if (num44 == 0) - { - str8 = "Parallax: " + this.bgScroll; - } - for (int num47 = 0; num47 < 5; num47++) - { - Color color4 = Color.Black; - if (num47 == 4) - { - color4 = color; - color4.R = (byte) ((0xff + color4.R) / 2); - color4.G = (byte) ((0xff + color4.R) / 2); - color4.B = (byte) ((0xff + color4.R) / 2); - } - int num48 = 0xff; - int num49 = color4.R - (0xff - num48); - if (num49 < 0) - { - num49 = 0; - } - color4 = new Color((int) ((byte) num49), (int) ((byte) num49), (int) ((byte) num49), (int) ((byte) num48)); - int num50 = 0; - int num51 = 0; - switch (num47) - { - case 0: - num50 = -2; - break; - - case 1: - num50 = 2; - break; - - case 2: - num51 = -2; - break; - - case 3: - num51 = 2; - break; - } - vector9 = new Vector2(); - this.spriteBatch.DrawString(fontDeathText, str8, new Vector2((float) (num46 + num50), (float) (num45 + num51)), color4, 0f, vector9, (float) 0.5f, SpriteEffects.None, 0f); - } - } - bool flag6 = false; - for (int num52 = 0; num52 < 2; num52++) - { - for (int num53 = 0; num53 < 1; num53++) - { - int num54 = (num43 + (num53 * 30)) - 12; - int num55 = 360; - float num56 = 0.9f; - if (num52 == 0) - { - num55 -= 70; - num54 += 2; - } - else - { - num55 -= 40; - } - str8 = "-"; - if (num52 == 1) - { - str8 = "+"; - } - Vector2 vector4 = new Vector2(24f, 24f); - int num57 = 0x8e; - if (((mouseState.X > num55) && (mouseState.X < (num55 + vector4.X))) && ((mouseState.Y > (num54 + 13)) && (mouseState.Y < ((num54 + 13) + vector4.Y)))) - { - if (this.focusColor != ((num52 + 1) * (num53 + 10))) - { - PlaySound(12, -1, -1, 1); - } - this.focusColor = (num52 + 1) * (num53 + 10); - flag6 = true; - num57 = 0xff; - if (mouseState.LeftButton == ButtonState.Pressed) - { - if (this.colorDelay <= 1) - { - if (this.colorDelay == 0) - { - this.colorDelay = 40; - } - else - { - this.colorDelay = 3; - } - int num58 = num52; - if (num52 == 0) - { - num58 = -1; - } - if (num53 == 0) - { - this.bgScroll += num58; - if (this.bgScroll > 100) - { - this.bgScroll = 100; - } - if (this.bgScroll < 0) - { - this.bgScroll = 0; - } - } - } - this.colorDelay--; - } - else - { - this.colorDelay = 0; - } - } - for (int num59 = 0; num59 < 5; num59++) - { - Color color5 = Color.Black; - if (num59 == 4) - { - color5 = color; - color5.R = (byte) ((0xff + color5.R) / 2); - color5.G = (byte) ((0xff + color5.R) / 2); - color5.B = (byte) ((0xff + color5.R) / 2); - } - int num60 = color5.R - (0xff - num57); - if (num60 < 0) - { - num60 = 0; - } - color5 = new Color((int) ((byte) num60), (int) ((byte) num60), (int) ((byte) num60), (int) ((byte) num57)); - int num61 = 0; - int num62 = 0; - switch (num59) - { - case 0: - num61 = -2; - break; - - case 1: - num61 = 2; - break; - - case 2: - num62 = -2; - break; - - case 3: - num62 = 2; - break; - } - vector9 = new Vector2(); - this.spriteBatch.DrawString(fontDeathText, str8, new Vector2((float) (num55 + num61), (float) (num54 + num62)), color5, 0f, vector9, num56, SpriteEffects.None, 0f); - } - } - } - if (!flag6) - { - this.focusColor = 0; - this.colorDelay = 0; - } - } - if (flag2) - { - int num63 = 400; - string str9 = ""; - for (int num64 = 0; num64 < 4; num64++) - { - int num65 = num63; - int num66 = 370; - switch (num64) - { - case 0: - str9 = "Sound:"; - break; - - case 1: - str9 = "Music:"; - num65 += 30; - break; - - case 2: - str9 = Math.Round((double) (soundVolume * 100f)) + "%"; - num66 += 90; - break; - - case 3: - str9 = Math.Round((double) (musicVolume * 100f)) + "%"; - num66 += 90; - num65 += 30; - break; - } - for (int num67 = 0; num67 < 5; num67++) - { - Color color6 = Color.Black; - if (num67 == 4) - { - color6 = color; - color6.R = (byte) ((0xff + color6.R) / 2); - color6.G = (byte) ((0xff + color6.R) / 2); - color6.B = (byte) ((0xff + color6.R) / 2); - } - int num68 = 0xff; - int num69 = color6.R - (0xff - num68); - if (num69 < 0) - { - num69 = 0; - } - color6 = new Color((int) ((byte) num69), (int) ((byte) num69), (int) ((byte) num69), (int) ((byte) num68)); - int num70 = 0; - int num71 = 0; - switch (num67) - { - case 0: - num70 = -2; - break; - - case 1: - num70 = 2; - break; - - case 2: - num71 = -2; - break; - - case 3: - num71 = 2; - break; - } - vector9 = new Vector2(); - this.spriteBatch.DrawString(fontDeathText, str9, new Vector2((float) (num66 + num70), (float) (num65 + num71)), color6, 0f, vector9, (float) 0.5f, SpriteEffects.None, 0f); - } - } - bool flag7 = false; - for (int num72 = 0; num72 < 2; num72++) - { - for (int num73 = 0; num73 < 2; num73++) - { - int num79; - int num74 = (num63 + (num73 * 30)) - 12; - int num75 = 360; - float num76 = 0.9f; - if (num72 == 0) - { - num75 -= 70; - num74 += 2; - } - else - { - num75 -= 40; - } - str9 = "-"; - if (num72 == 1) - { - str9 = "+"; - } - Vector2 vector5 = new Vector2(24f, 24f); - int num77 = 0x8e; - if (((mouseState.X <= num75) || (mouseState.X >= (num75 + vector5.X))) || ((mouseState.Y <= (num74 + 13)) || (mouseState.Y >= ((num74 + 13) + vector5.Y)))) - { - goto Label_3001; - } - if (this.focusColor != ((num72 + 1) * (num73 + 10))) - { - PlaySound(12, -1, -1, 1); - } - this.focusColor = (num72 + 1) * (num73 + 10); - flag7 = true; - num77 = 0xff; - if (mouseState.LeftButton != ButtonState.Pressed) - { - goto Label_2FFA; - } - if (this.colorDelay <= 1) - { - if (this.colorDelay == 0) - { - this.colorDelay = 40; - } - else - { - this.colorDelay = 3; - } - int num78 = num72; - if (num72 == 0) - { - num78 = -1; - } - switch (num73) - { - case 0: - soundVolume += num78 * 0.01f; - if (soundVolume > 1f) - { - soundVolume = 1f; - } - if (soundVolume < 0f) - { - soundVolume = 0f; - } - break; - - case 1: - musicVolume += num78 * 0.01f; - if (musicVolume > 1f) - { - musicVolume = 1f; - } - if (musicVolume < 0f) - { - musicVolume = 0f; - } - goto Label_2FEA; - } - } - Label_2FEA: - this.colorDelay--; - goto Label_3001; - Label_2FFA: - this.colorDelay = 0; - Label_3001: - num79 = 0; - while (num79 < 5) - { - Color color7 = Color.Black; - if (num79 == 4) - { - color7 = color; - color7.R = (byte) ((0xff + color7.R) / 2); - color7.G = (byte) ((0xff + color7.R) / 2); - color7.B = (byte) ((0xff + color7.R) / 2); - } - int num80 = color7.R - (0xff - num77); - if (num80 < 0) - { - num80 = 0; - } - color7 = new Color((int) ((byte) num80), (int) ((byte) num80), (int) ((byte) num80), (int) ((byte) num77)); - int num81 = 0; - int num82 = 0; - switch (num79) - { - case 0: - num81 = -2; - break; - - case 1: - num81 = 2; - break; - - case 2: - num82 = -2; - break; - - case 3: - num82 = 2; - break; - } - vector9 = new Vector2(); - this.spriteBatch.DrawString(fontDeathText, str9, new Vector2((float) (num75 + num81), (float) (num74 + num82)), color7, 0f, vector9, num76, SpriteEffects.None, 0f); - num79++; - } - } - } - if (!flag7) - { - this.focusColor = 0; - this.colorDelay = 0; - } - } - for (int num83 = 0; num83 < 5; num83++) - { - Color color8 = Color.Black; - if (num83 == 4) - { - color8 = color; - color8.R = (byte) ((0xff + color8.R) / 2); - color8.G = (byte) ((0xff + color8.R) / 2); - color8.B = (byte) ((0xff + color8.R) / 2); - } - int num84 = (int) (255f * ((this.menuItemScale[k] * 2f) - 1f)); - if (flagArray[k]) - { - num84 = 0xff; - } - int num85 = color8.R - (0xff - num84); - if (num85 < 0) - { - num85 = 0; - } - color8 = new Color((int) ((byte) num85), (int) ((byte) num85), (int) ((byte) num85), (int) ((byte) num84)); - int num86 = 0; - int num87 = 0; - switch (num83) - { - case 0: - num86 = -2; - break; - - case 1: - num86 = 2; - break; - - case 2: - num87 = -2; - break; - - case 3: - num87 = 2; - break; - } - Vector2 origin = fontDeathText.MeasureString(strArray[k]); - origin.X *= 0.5f; - origin.Y *= 0.5f; - float num88 = this.menuItemScale[k]; - if ((Main.menuMode == 15) && (k == 0)) - { - num88 *= 0.35f; - } - else if (netMode == 2) - { - num88 *= 0.5f; - } - this.spriteBatch.DrawString(fontDeathText, strArray[k], new Vector2((float) ((num4 + num86) + numArray2[k]), (((num3 + (num5 * k)) + num87) + origin.Y) + numArray[k]), color8, 0f, origin, num88, SpriteEffects.None, 0f); - } - if ((((mouseState.X > ((num4 - (strArray[k].Length * 10)) + numArray2[k])) && (mouseState.X < ((num4 + (strArray[k].Length * 10)) + numArray2[k]))) && ((mouseState.Y > ((num3 + (num5 * k)) + numArray[k])) && (mouseState.Y < (((num3 + (num5 * k)) + 50) + numArray[k])))) && hasFocus) - { - this.focusMenu = k; - if (flagArray[k] || flagArray2[k]) - { - this.focusMenu = -1; - } - else - { - if (focusMenu != this.focusMenu) - { - PlaySound(12, -1, -1, 1); - } - if (mouseLeftRelease && (mouseState.LeftButton == ButtonState.Pressed)) - { - this.selectedMenu = k; - } - } - } - } - } - for (int m = 0; m < maxMenuItems; m++) - { - if (m == this.focusMenu) - { - if (this.menuItemScale[m] < 1f) - { - this.menuItemScale[m] += 0.02f; - } - if (this.menuItemScale[m] > 1f) - { - this.menuItemScale[m] = 1f; - } - } - else if (this.menuItemScale[m] > 0.8) - { - this.menuItemScale[m] -= 0.02f; - } - } - if (index >= 0) - { - loadPlayer[index].PlayerFrame(); - loadPlayer[index].position.X = num9 + screenPosition.X; - loadPlayer[index].position.Y = num10 + screenPosition.Y; - this.DrawPlayer(loadPlayer[index]); - } - for (int n = 0; n < 5; n++) - { - Color color9 = Color.Black; - if (n == 4) - { - color9 = color; - color9.R = (byte) ((0xff + color9.R) / 2); - color9.G = (byte) ((0xff + color9.R) / 2); - color9.B = (byte) ((0xff + color9.R) / 2); - } - color9.A = (byte) (color9.A * 0.3f); - int num91 = 0; - int num92 = 0; - switch (n) - { - case 0: - num91 = -2; - break; - - case 1: - num91 = 2; - break; - - case 2: - num92 = -2; - break; - - case 3: - num92 = 2; - break; - } - string str10 = "Copyright 2011 Re-Logic | TShock By: Zach & Shank | Help from: High & MMavipc"; - Vector2 vector7 = fontMouseText.MeasureString(str10); - vector7.X *= 0.5f; - vector7.Y *= 0.5f; - this.spriteBatch.DrawString(fontMouseText, str10, new Vector2(((screenWidth - vector7.X) + num91) - 10f, ((screenHeight - vector7.Y) + num92) - 2f), color9, 0f, vector7, (float) 1f, SpriteEffects.None, 0f); - } - for (int num93 = 0; num93 < 5; num93++) - { - Color color10 = Color.Black; - if (num93 == 4) - { - color10 = color; - color10.R = (byte) ((0xff + color10.R) / 2); - color10.G = (byte) ((0xff + color10.R) / 2); - color10.B = (byte) ((0xff + color10.R) / 2); - } - color10.A = (byte) (color10.A * 0.3f); - int num94 = 0; - int num95 = 0; - switch (num93) - { - case 0: - num94 = -2; - break; - - case 1: - num94 = 2; - break; - - case 2: - num95 = -2; - break; - - case 3: - num95 = 2; - break; - } - Vector2 vector8 = fontMouseText.MeasureString(versionNumber); - vector8.X *= 0.5f; - vector8.Y *= 0.5f; - this.spriteBatch.DrawString(fontMouseText, versionNumber, new Vector2((vector8.X + num94) + 10f, ((screenHeight - vector8.Y) + num95) - 2f), color10, 0f, vector8, (float) 1f, SpriteEffects.None, 0f); - } - vector9 = new Vector2(); - this.spriteBatch.Draw(cursorTexture, new Vector2((float) (mouseState.X + 1), (float) (mouseState.Y + 1)), new Rectangle(0, 0, cursorTexture.Width, cursorTexture.Height), new Color((int) (cursorColor.R * 0.2f), (int) (cursorColor.G * 0.2f), (int) (cursorColor.B * 0.2f), (int) (cursorColor.A * 0.5f)), 0f, vector9, (float) (cursorScale * 1.1f), SpriteEffects.None, 0f); - vector9 = new Vector2(); - this.spriteBatch.Draw(cursorTexture, new Vector2((float) mouseState.X, (float) mouseState.Y), new Rectangle(0, 0, cursorTexture.Width, cursorTexture.Height), cursorColor, 0f, vector9, cursorScale, SpriteEffects.None, 0f); - if (fadeCounter > 0) - { - Color white = Color.White; - byte num96 = 0; - fadeCounter--; - float num97 = (((float) fadeCounter) / 75f) * 255f; - num96 = (byte) num97; - white = new Color((int) num96, (int) num96, (int) num96, (int) num96); - this.spriteBatch.Draw(fadeTexture, new Vector2(0f, 0f), new Rectangle(0, 0, splashTexture.Width, splashTexture.Height), white, 0f, new Vector2(), (float) 1f, SpriteEffects.None, 0f); - } - this.spriteBatch.End(); - if (mouseState.LeftButton == ButtonState.Pressed) - { - mouseLeftRelease = false; - } - else - { - mouseLeftRelease = true; - } - if (mouseState.RightButton == ButtonState.Pressed) - { - mouseRightRelease = false; - } - else - { - mouseRightRelease = true; - } - } - - protected void DrawNPCs(bool behindTiles = false) - { - Rectangle rectangle = new Rectangle(((int) screenPosition.X) - 300, ((int) screenPosition.Y) - 300, screenWidth + 600, screenHeight + 600); - for (int i = 0x3e7; i >= 0; i--) - { - if ((npc[i].active && (npc[i].type > 0)) && ((npc[i].behindTiles == behindTiles) && rectangle.Intersects(new Rectangle((int) npc[i].position.X, (int) npc[i].position.Y, npc[i].width, npc[i].height)))) - { - if (npc[i].aiStyle == 13) - { - Vector2 vector = new Vector2(npc[i].position.X + (npc[i].width / 2), npc[i].position.Y + (npc[i].height / 2)); - float num2 = ((npc[i].ai[0] * 16f) + 8f) - vector.X; - float num3 = ((npc[i].ai[1] * 16f) + 8f) - vector.Y; - float rotation = ((float) Math.Atan2((double) num3, (double) num2)) - 1.57f; - bool flag = true; - while (flag) - { - int height = 0x1c; - float num6 = (float) Math.Sqrt((double) ((num2 * num2) + (num3 * num3))); - if (num6 < 40f) - { - height = (((int) num6) - 40) + 0x1c; - flag = false; - } - num6 = 28f / num6; - num2 *= num6; - num3 *= num6; - vector.X += num2; - vector.Y += num3; - num2 = ((npc[i].ai[0] * 16f) + 8f) - vector.X; - num3 = ((npc[i].ai[1] * 16f) + 8f) - vector.Y; - Color color = Lighting.GetColor(((int) vector.X) / 0x10, (int) (vector.Y / 16f)); - this.spriteBatch.Draw(chain4Texture, new Vector2(vector.X - screenPosition.X, vector.Y - screenPosition.Y), new Rectangle(0, 0, chain4Texture.Width, height), color, rotation, new Vector2(chain4Texture.Width * 0.5f, chain4Texture.Height * 0.5f), (float) 1f, SpriteEffects.None, 0f); - } - } - if (npc[i].type == 0x24) - { - Vector2 vector2 = new Vector2((npc[i].position.X + (npc[i].width * 0.5f)) - (5f * npc[i].ai[0]), npc[i].position.Y + 20f); - for (int j = 0; j < 2; j++) - { - float num8 = (npc[(int) npc[i].ai[1]].position.X + (npc[(int) npc[i].ai[1]].width / 2)) - vector2.X; - float num9 = (npc[(int) npc[i].ai[1]].position.Y + (npc[(int) npc[i].ai[1]].height / 2)) - vector2.Y; - float num10 = 0f; - if (j == 0) - { - num8 -= 200f * npc[i].ai[0]; - num9 += 130f; - num10 = (float) Math.Sqrt((double) ((num8 * num8) + (num9 * num9))); - num10 = 92f / num10; - vector2.X += num8 * num10; - vector2.Y += num9 * num10; - } - else - { - num8 -= 50f * npc[i].ai[0]; - num9 += 80f; - num10 = (float) Math.Sqrt((double) ((num8 * num8) + (num9 * num9))); - num10 = 60f / num10; - vector2.X += num8 * num10; - vector2.Y += num9 * num10; - } - float num11 = ((float) Math.Atan2((double) num9, (double) num8)) - 1.57f; - Color color2 = Lighting.GetColor(((int) vector2.X) / 0x10, (int) (vector2.Y / 16f)); - this.spriteBatch.Draw(boneArmTexture, new Vector2(vector2.X - screenPosition.X, vector2.Y - screenPosition.Y), new Rectangle(0, 0, boneArmTexture.Width, boneArmTexture.Height), color2, num11, new Vector2(boneArmTexture.Width * 0.5f, boneArmTexture.Height * 0.5f), (float) 1f, SpriteEffects.None, 0f); - if (j == 0) - { - vector2.X += (num8 * num10) / 2f; - vector2.Y += (num9 * num10) / 2f; - } - else if (base.IsActive) - { - vector2.X += (num8 * num10) - 16f; - vector2.Y += (num9 * num10) - 6f; - Color color4 = new Color(); - int index = Dust.NewDust(new Vector2(vector2.X, vector2.Y), 30, 10, 5, num8 * 0.02f, num9 * 0.02f, 0, color4, 2f); - dust[index].noGravity = true; - } - } - } - float num13 = 0f; - Vector2 origin = new Vector2((float) (npcTexture[npc[i].type].Width / 2), (float) ((npcTexture[npc[i].type].Height / npcFrameCount[npc[i].type]) / 2)); - if (npc[i].type == 4) - { - origin = new Vector2(55f, 107f); - } - if (npc[i].type == 6) - { - num13 = 26f; - } - if (((npc[i].type == 7) || (npc[i].type == 8)) || (npc[i].type == 9)) - { - num13 = 13f; - } - if (((npc[i].type == 10) || (npc[i].type == 11)) || (npc[i].type == 12)) - { - num13 = 8f; - } - if (((npc[i].type == 13) || (npc[i].type == 14)) || (npc[i].type == 15)) - { - num13 = 26f; - } - num13 *= npc[i].scale; - Color newColor = Lighting.GetColor(((int) (npc[i].position.X + (npc[i].width * 0.5))) / 0x10, (int) ((npc[i].position.Y + (npc[i].height * 0.5)) / 16.0)); - if (npc[i].aiStyle == 10) - { - newColor = Color.White; - } - SpriteEffects none = SpriteEffects.None; - if (npc[i].spriteDirection == 1) - { - none = SpriteEffects.FlipHorizontally; - } - this.spriteBatch.Draw(npcTexture[npc[i].type], new Vector2((((npc[i].position.X - screenPosition.X) + (npc[i].width / 2)) - ((npcTexture[npc[i].type].Width * npc[i].scale) / 2f)) + (origin.X * npc[i].scale), (((((npc[i].position.Y - screenPosition.Y) + npc[i].height) - ((npcTexture[npc[i].type].Height * npc[i].scale) / ((float) npcFrameCount[npc[i].type]))) + 4f) + (origin.Y * npc[i].scale)) + num13), new Rectangle?(npc[i].frame), npc[i].GetAlpha(newColor), npc[i].rotation, origin, npc[i].scale, none, 0f); - Color color5 = new Color(); - if (npc[i].color != color5) - { - this.spriteBatch.Draw(npcTexture[npc[i].type], new Vector2((((npc[i].position.X - screenPosition.X) + (npc[i].width / 2)) - ((npcTexture[npc[i].type].Width * npc[i].scale) / 2f)) + (origin.X * npc[i].scale), (((((npc[i].position.Y - screenPosition.Y) + npc[i].height) - ((npcTexture[npc[i].type].Height * npc[i].scale) / ((float) npcFrameCount[npc[i].type]))) + 4f) + (origin.Y * npc[i].scale)) + num13), new Rectangle?(npc[i].frame), npc[i].GetColor(newColor), npc[i].rotation, origin, npc[i].scale, none, 0f); - } - } - } - } - - protected void DrawPlayer(Player drawPlayer) - { - SpriteEffects none = SpriteEffects.None; - SpriteEffects flipHorizontally = SpriteEffects.FlipHorizontally; - Color immuneAlpha = drawPlayer.GetImmuneAlpha(Lighting.GetColor(((int) (drawPlayer.position.X + (drawPlayer.width * 0.5))) / 0x10, (int) ((drawPlayer.position.Y + (drawPlayer.height * 0.25)) / 16.0), Color.White)); - Color color = drawPlayer.GetImmuneAlpha(Lighting.GetColor(((int) (drawPlayer.position.X + (drawPlayer.width * 0.5))) / 0x10, (int) ((drawPlayer.position.Y + (drawPlayer.height * 0.25)) / 16.0), drawPlayer.eyeColor)); - Color color3 = drawPlayer.GetImmuneAlpha(Lighting.GetColor(((int) (drawPlayer.position.X + (drawPlayer.width * 0.5))) / 0x10, (int) ((drawPlayer.position.Y + (drawPlayer.height * 0.25)) / 16.0), drawPlayer.hairColor)); - Color color4 = drawPlayer.GetImmuneAlpha(Lighting.GetColor(((int) (drawPlayer.position.X + (drawPlayer.width * 0.5))) / 0x10, (int) ((drawPlayer.position.Y + (drawPlayer.height * 0.25)) / 16.0), drawPlayer.skinColor)); - Color color5 = drawPlayer.GetImmuneAlpha(Lighting.GetColor(((int) (drawPlayer.position.X + (drawPlayer.width * 0.5))) / 0x10, (int) ((drawPlayer.position.Y + (drawPlayer.height * 0.5)) / 16.0), drawPlayer.skinColor)); - Color color6 = drawPlayer.GetImmuneAlpha(Lighting.GetColor(((int) (drawPlayer.position.X + (drawPlayer.width * 0.5))) / 0x10, (int) ((drawPlayer.position.Y + (drawPlayer.height * 0.5)) / 16.0), drawPlayer.shirtColor)); - Color color7 = drawPlayer.GetImmuneAlpha(Lighting.GetColor(((int) (drawPlayer.position.X + (drawPlayer.width * 0.5))) / 0x10, (int) ((drawPlayer.position.Y + (drawPlayer.height * 0.5)) / 16.0), drawPlayer.underShirtColor)); - Color color8 = drawPlayer.GetImmuneAlpha(Lighting.GetColor(((int) (drawPlayer.position.X + (drawPlayer.width * 0.5))) / 0x10, (int) ((drawPlayer.position.Y + (drawPlayer.height * 0.75)) / 16.0), drawPlayer.pantsColor)); - Color color9 = drawPlayer.GetImmuneAlpha(Lighting.GetColor(((int) (drawPlayer.position.X + (drawPlayer.width * 0.5))) / 0x10, (int) ((drawPlayer.position.Y + (drawPlayer.height * 0.75)) / 16.0), drawPlayer.shoeColor)); - Color color10 = drawPlayer.GetImmuneAlpha(Lighting.GetColor(((int) (drawPlayer.position.X + (drawPlayer.width * 0.5))) / 0x10, ((int) (drawPlayer.position.Y + (drawPlayer.height * 0.75))) / 0x10, Color.White)); - Color color11 = drawPlayer.GetImmuneAlpha(Lighting.GetColor(((int) (drawPlayer.position.X + (drawPlayer.width * 0.5))) / 0x10, ((int) (drawPlayer.position.Y + (drawPlayer.height * 0.5))) / 0x10, Color.White)); - Color color12 = drawPlayer.GetImmuneAlpha(Lighting.GetColor(((int) (drawPlayer.position.X + (drawPlayer.width * 0.5))) / 0x10, ((int) (drawPlayer.position.Y + (drawPlayer.height * 0.25))) / 0x10, Color.White)); - if (drawPlayer.direction == 1) - { - none = SpriteEffects.None; - flipHorizontally = SpriteEffects.None; - } - else - { - none = SpriteEffects.FlipHorizontally; - flipHorizontally = SpriteEffects.FlipHorizontally; - } - Vector2 origin = new Vector2(drawPlayer.legFrame.Width * 0.5f, drawPlayer.legFrame.Height * 0.75f); - Vector2 vector2 = new Vector2(drawPlayer.legFrame.Width * 0.5f, drawPlayer.legFrame.Height * 0.5f); - Vector2 vector3 = new Vector2(drawPlayer.legFrame.Width * 0.5f, drawPlayer.legFrame.Height * 0.25f); - if ((drawPlayer.legs > 0) && (drawPlayer.legs < 10)) - { - this.spriteBatch.Draw(armorLegTexture[drawPlayer.legs], (new Vector2((float) ((((int) (drawPlayer.position.X - screenPosition.X)) - (drawPlayer.legFrame.Width / 2)) + (drawPlayer.width / 2)), (float) ((int) ((((drawPlayer.position.Y - screenPosition.Y) + drawPlayer.height) - drawPlayer.legFrame.Height) + 4f))) + drawPlayer.legPosition) + origin, new Rectangle?(drawPlayer.legFrame), color12, drawPlayer.legRotation, origin, (float) 1f, none, 0f); - } - else - { - this.spriteBatch.Draw(playerPantsTexture, (new Vector2((float) ((((int) (drawPlayer.position.X - screenPosition.X)) - (drawPlayer.legFrame.Width / 2)) + (drawPlayer.width / 2)), (float) ((int) ((((drawPlayer.position.Y - screenPosition.Y) + drawPlayer.height) - drawPlayer.legFrame.Height) + 4f))) + drawPlayer.legPosition) + origin, new Rectangle?(drawPlayer.legFrame), color8, drawPlayer.legRotation, origin, (float) 1f, none, 0f); - this.spriteBatch.Draw(playerShoesTexture, (new Vector2((float) ((((int) (drawPlayer.position.X - screenPosition.X)) - (drawPlayer.legFrame.Width / 2)) + (drawPlayer.width / 2)), (float) ((int) ((((drawPlayer.position.Y - screenPosition.Y) + drawPlayer.height) - drawPlayer.legFrame.Height) + 4f))) + drawPlayer.legPosition) + origin, new Rectangle?(drawPlayer.legFrame), color9, drawPlayer.legRotation, origin, (float) 1f, none, 0f); - } - if ((drawPlayer.body > 0) && (drawPlayer.body < 10)) - { - this.spriteBatch.Draw(armorBodyTexture[drawPlayer.body], (new Vector2((float) ((((int) (drawPlayer.position.X - screenPosition.X)) - (drawPlayer.bodyFrame.Width / 2)) + (drawPlayer.width / 2)), (float) ((int) ((((drawPlayer.position.Y - screenPosition.Y) + drawPlayer.height) - 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, vector2, (float) 1f, none, 0f); - } - else - { - this.spriteBatch.Draw(playerUnderShirtTexture, (new Vector2((float) ((((int) (drawPlayer.position.X - screenPosition.X)) - (drawPlayer.bodyFrame.Width / 2)) + (drawPlayer.width / 2)), (float) ((int) ((((drawPlayer.position.Y - screenPosition.Y) + drawPlayer.height) - 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, vector2, (float) 1f, none, 0f); - this.spriteBatch.Draw(playerShirtTexture, (new Vector2((float) ((((int) (drawPlayer.position.X - screenPosition.X)) - (drawPlayer.bodyFrame.Width / 2)) + (drawPlayer.width / 2)), (float) ((int) ((((drawPlayer.position.Y - screenPosition.Y) + drawPlayer.height) - 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, vector2, (float) 1f, none, 0f); - this.spriteBatch.Draw(playerHandsTexture, (new Vector2((float) ((((int) (drawPlayer.position.X - screenPosition.X)) - (drawPlayer.bodyFrame.Width / 2)) + (drawPlayer.width / 2)), (float) ((int) ((((drawPlayer.position.Y - screenPosition.Y) + drawPlayer.height) - 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, vector2, (float) 1f, none, 0f); - } - this.spriteBatch.Draw(playerHeadTexture, (new Vector2((float) ((((int) (drawPlayer.position.X - screenPosition.X)) - (drawPlayer.bodyFrame.Width / 2)) + (drawPlayer.width / 2)), (float) ((int) ((((drawPlayer.position.Y - screenPosition.Y) + drawPlayer.height) - drawPlayer.bodyFrame.Height) + 4f))) + drawPlayer.headPosition) + vector3, new Rectangle?(drawPlayer.bodyFrame), color4, drawPlayer.headRotation, vector3, (float) 1f, none, 0f); - this.spriteBatch.Draw(playerEyeWhitesTexture, (new Vector2((float) ((((int) (drawPlayer.position.X - screenPosition.X)) - (drawPlayer.bodyFrame.Width / 2)) + (drawPlayer.width / 2)), (float) ((int) ((((drawPlayer.position.Y - screenPosition.Y) + drawPlayer.height) - drawPlayer.bodyFrame.Height) + 4f))) + drawPlayer.headPosition) + vector3, new Rectangle?(drawPlayer.bodyFrame), immuneAlpha, drawPlayer.headRotation, vector3, (float) 1f, none, 0f); - this.spriteBatch.Draw(playerEyesTexture, (new Vector2((float) ((((int) (drawPlayer.position.X - screenPosition.X)) - (drawPlayer.bodyFrame.Width / 2)) + (drawPlayer.width / 2)), (float) ((int) ((((drawPlayer.position.Y - screenPosition.Y) + drawPlayer.height) - drawPlayer.bodyFrame.Height) + 4f))) + drawPlayer.headPosition) + vector3, new Rectangle?(drawPlayer.bodyFrame), color, drawPlayer.headRotation, vector3, (float) 1f, none, 0f); - if (drawPlayer.head == 10) - { - this.spriteBatch.Draw(armorHeadTexture[drawPlayer.head], (new Vector2((float) ((((int) (drawPlayer.position.X - screenPosition.X)) - (drawPlayer.bodyFrame.Width / 2)) + (drawPlayer.width / 2)), (float) ((int) ((((drawPlayer.position.Y - screenPosition.Y) + drawPlayer.height) - drawPlayer.bodyFrame.Height) + 4f))) + drawPlayer.headPosition) + vector3, new Rectangle?(drawPlayer.bodyFrame), color10, drawPlayer.headRotation, vector3, (float) 1f, none, 0f); - Rectangle bodyFrame = drawPlayer.bodyFrame; - bodyFrame.Y -= 0x150; - if (bodyFrame.Y < 0) - { - bodyFrame.Y = 0; - } - this.spriteBatch.Draw(playerHairTexture[drawPlayer.hair], (new Vector2((float) ((((int) (drawPlayer.position.X - screenPosition.X)) - (drawPlayer.bodyFrame.Width / 2)) + (drawPlayer.width / 2)), (float) ((int) ((((drawPlayer.position.Y - screenPosition.Y) + drawPlayer.height) - drawPlayer.bodyFrame.Height) + 4f))) + drawPlayer.headPosition) + vector3, new Rectangle?(bodyFrame), color3, drawPlayer.headRotation, vector3, (float) 1f, none, 0f); - } - else if ((drawPlayer.head > 0) && (drawPlayer.head < 12)) - { - this.spriteBatch.Draw(armorHeadTexture[drawPlayer.head], (new Vector2((float) ((((int) (drawPlayer.position.X - screenPosition.X)) - (drawPlayer.bodyFrame.Width / 2)) + (drawPlayer.width / 2)), (float) ((int) ((((drawPlayer.position.Y - screenPosition.Y) + drawPlayer.height) - drawPlayer.bodyFrame.Height) + 4f))) + drawPlayer.headPosition) + vector3, new Rectangle?(drawPlayer.bodyFrame), color10, drawPlayer.headRotation, vector3, (float) 1f, none, 0f); - } - else - { - Rectangle rectangle2 = drawPlayer.bodyFrame; - rectangle2.Y -= 0x150; - if (rectangle2.Y < 0) - { - rectangle2.Y = 0; - } - this.spriteBatch.Draw(playerHairTexture[drawPlayer.hair], (new Vector2((float) ((((int) (drawPlayer.position.X - screenPosition.X)) - (drawPlayer.bodyFrame.Width / 2)) + (drawPlayer.width / 2)), (float) ((int) ((((drawPlayer.position.Y - screenPosition.Y) + drawPlayer.height) - drawPlayer.bodyFrame.Height) + 4f))) + drawPlayer.headPosition) + vector3, new Rectangle?(rectangle2), color3, drawPlayer.headRotation, vector3, (float) 1f, none, 0f); - } - Color newColor = Lighting.GetColor(((int) (drawPlayer.position.X + (drawPlayer.width * 0.5))) / 0x10, (int) ((drawPlayer.position.Y + (drawPlayer.height * 0.5)) / 16.0)); - if (((drawPlayer.itemAnimation > 0) || (drawPlayer.inventory[drawPlayer.selectedItem].holdStyle > 0)) && (((drawPlayer.inventory[drawPlayer.selectedItem].type > 0) && !drawPlayer.dead) && !drawPlayer.inventory[drawPlayer.selectedItem].noUseGraphic)) - { - if (drawPlayer.inventory[drawPlayer.selectedItem].useStyle == 5) - { - int num = 10; - Vector2 vector4 = new Vector2((float) (itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width / 2), (float) (itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height / 2)); - if (drawPlayer.inventory[drawPlayer.selectedItem].type == 0x5f) - { - num = 10; - vector4.Y += 2f; - } - else if (drawPlayer.inventory[drawPlayer.selectedItem].type == 0x60) - { - num = -5; - } - else if (drawPlayer.inventory[drawPlayer.selectedItem].type == 0x62) - { - num = -5; - vector4.Y -= 2f; - } - else if (drawPlayer.inventory[drawPlayer.selectedItem].type == 0xc5) - { - num = -5; - vector4.Y += 4f; - } - else if (drawPlayer.inventory[drawPlayer.selectedItem].type == 0x7e) - { - num = 4; - vector4.Y += 4f; - } - else if (drawPlayer.inventory[drawPlayer.selectedItem].type == 0x7f) - { - num = 4; - vector4.Y += 2f; - } - else if (drawPlayer.inventory[drawPlayer.selectedItem].type == 0x9d) - { - num = 6; - vector4.Y += 2f; - } - else if (drawPlayer.inventory[drawPlayer.selectedItem].type == 160) - { - num = -8; - } - else if ((drawPlayer.inventory[drawPlayer.selectedItem].type == 0xa4) || (drawPlayer.inventory[drawPlayer.selectedItem].type == 0xdb)) - { - num = 2; - vector4.Y += 4f; - } - else if (drawPlayer.inventory[drawPlayer.selectedItem].type == 0xa5) - { - num = 12; - vector4.Y += 6f; - } - Vector2 vector5 = new Vector2((float) -num, (float) (itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height / 2)); - if (drawPlayer.direction == -1) - { - vector5 = new Vector2((float) (itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width + num), (float) (itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height / 2)); - } - this.spriteBatch.Draw(itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type], new Vector2((float) ((int) ((drawPlayer.itemLocation.X - screenPosition.X) + vector4.X)), (float) ((int) ((drawPlayer.itemLocation.Y - screenPosition.Y) + vector4.Y))), new Rectangle(0, 0, itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width, itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height), drawPlayer.inventory[drawPlayer.selectedItem].GetAlpha(newColor), drawPlayer.itemRotation, vector5, drawPlayer.inventory[drawPlayer.selectedItem].scale, flipHorizontally, 0f); - if (drawPlayer.inventory[drawPlayer.selectedItem].color != new Color()) - { - this.spriteBatch.Draw(itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type], new Vector2((float) ((int) ((drawPlayer.itemLocation.X - screenPosition.X) + vector4.X)), (float) ((int) ((drawPlayer.itemLocation.Y - screenPosition.Y) + vector4.Y))), new Rectangle(0, 0, itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width, itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height), drawPlayer.inventory[drawPlayer.selectedItem].GetColor(newColor), drawPlayer.itemRotation, vector5, drawPlayer.inventory[drawPlayer.selectedItem].scale, flipHorizontally, 0f); - } - } - else - { - this.spriteBatch.Draw(itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type], new Vector2((float) ((int) (drawPlayer.itemLocation.X - screenPosition.X)), (float) ((int) (drawPlayer.itemLocation.Y - screenPosition.Y))), new Rectangle(0, 0, itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width, itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height), drawPlayer.inventory[drawPlayer.selectedItem].GetAlpha(newColor), drawPlayer.itemRotation, new Vector2((itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width * 0.5f) - ((itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width * 0.5f) * drawPlayer.direction), (float) itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height), drawPlayer.inventory[drawPlayer.selectedItem].scale, flipHorizontally, 0f); - if (drawPlayer.inventory[drawPlayer.selectedItem].color != new Color()) - { - this.spriteBatch.Draw(itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type], new Vector2((float) ((int) (drawPlayer.itemLocation.X - screenPosition.X)), (float) ((int) (drawPlayer.itemLocation.Y - screenPosition.Y))), new Rectangle(0, 0, itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width, itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height), drawPlayer.inventory[drawPlayer.selectedItem].GetColor(newColor), drawPlayer.itemRotation, new Vector2((itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width * 0.5f) - ((itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Width * 0.5f) * drawPlayer.direction), (float) itemTexture[drawPlayer.inventory[drawPlayer.selectedItem].type].Height), drawPlayer.inventory[drawPlayer.selectedItem].scale, flipHorizontally, 0f); - } - } - } - if ((drawPlayer.body > 0) && (drawPlayer.body < 10)) - { - this.spriteBatch.Draw(armorArmTexture[drawPlayer.body], (new Vector2((float) ((((int) (drawPlayer.position.X - screenPosition.X)) - (drawPlayer.bodyFrame.Width / 2)) + (drawPlayer.width / 2)), (float) ((int) ((((drawPlayer.position.Y - screenPosition.Y) + drawPlayer.height) - 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, vector2, (float) 1f, none, 0f); - } - else - { - this.spriteBatch.Draw(playerUnderShirt2Texture, (new Vector2((float) ((((int) (drawPlayer.position.X - screenPosition.X)) - (drawPlayer.bodyFrame.Width / 2)) + (drawPlayer.width / 2)), (float) ((int) ((((drawPlayer.position.Y - screenPosition.Y) + drawPlayer.height) - 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, vector2, (float) 1f, none, 0f); - this.spriteBatch.Draw(playerHands2Texture, (new Vector2((float) ((((int) (drawPlayer.position.X - screenPosition.X)) - (drawPlayer.bodyFrame.Width / 2)) + (drawPlayer.width / 2)), (float) ((int) ((((drawPlayer.position.Y - screenPosition.Y) + drawPlayer.height) - 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, vector2, (float) 1f, none, 0f); - } - } - - protected void DrawSplash(GameTime gameTime) - { - base.GraphicsDevice.Clear(Color.Black); - base.Draw(gameTime); - this.spriteBatch.Begin(); - this.splashCounter++; - Color white = Color.White; - byte num = 0; - if (this.splashCounter <= 0x4b) - { - float num2 = (((float) this.splashCounter) / 75f) * 255f; - num = (byte) num2; - } - else if (this.splashCounter <= 200) - { - num = 0xff; - } - else if (this.splashCounter <= 0x113) - { - int num3 = 0x113 - this.splashCounter; - float num4 = (((float) num3) / 75f) * 255f; - num = (byte) num4; - } - else - { - showSplash = false; - fadeCounter = 0x4b; - } - white = new Color((int) num, (int) num, (int) num, (int) num); - this.spriteBatch.Draw(splashTexture, new Vector2(0f, 0f), new Rectangle(0, 0, splashTexture.Width, splashTexture.Height), white, 0f, new Vector2(), (float) 1f, SpriteEffects.None, 0f); - this.spriteBatch.End(); - } - - protected void DrawTiles(bool solidOnly = true) - { - int num = (int) ((screenPosition.X / 16f) - 1f); - int maxTilesX = ((int) ((screenPosition.X + screenWidth) / 16f)) + 2; - int num3 = (int) ((screenPosition.Y / 16f) - 1f); - int maxTilesY = ((int) ((screenPosition.Y + screenHeight) / 16f)) + 2; - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num3 < 0) - { - num3 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - int height = 0x10; - int width = 0x10; - for (int i = num3; i < (maxTilesY + 4); i++) - { - for (int j = num - 2; j < (maxTilesX + 2); j++) - { - if (tile[j, i].active && (tileSolid[tile[j, i].type] == solidOnly)) - { - int num9 = 0; - if (tile[j, i].type == 0x4e) - { - num9 = 2; - } - if ((tile[j, i].type == 0x21) || (tile[j, i].type == 0x31)) - { - num9 = -4; - } - if ((((tile[j, i].type == 3) || (tile[j, i].type == 4)) || ((tile[j, i].type == 5) || (tile[j, i].type == 0x18))) || (((tile[j, i].type == 0x21) || (tile[j, i].type == 0x31)) || ((tile[j, i].type == 0x3d) || (tile[j, i].type == 0x47)))) - { - height = 20; - } - else if (((((tile[j, i].type == 15) || (tile[j, i].type == 14)) || ((tile[j, i].type == 0x10) || (tile[j, i].type == 0x11))) || (((tile[j, i].type == 0x12) || (tile[j, i].type == 20)) || ((tile[j, i].type == 0x15) || (tile[j, i].type == 0x1a)))) || (((tile[j, i].type == 0x1b) || (tile[j, i].type == 0x20)) || (((tile[j, i].type == 0x45) || (tile[j, i].type == 0x48)) || (tile[j, i].type == 0x4d)))) - { - height = 0x12; - } - else - { - height = 0x10; - } - if ((tile[j, i].type == 4) || (tile[j, i].type == 5)) - { - width = 20; - } - else - { - width = 0x10; - } - if ((tile[j, i].type == 0x49) || (tile[j, i].type == 0x4a)) - { - num9 -= 12; - height = 0x20; - } - if (((tile[j, i].type == 4) && (rand.Next(40) == 0)) && base.IsActive) - { - if (tile[j, i].frameX == 0x16) - { - Color newColor = new Color(); - Dust.NewDust(new Vector2((float) ((j * 0x10) + 6), (float) (i * 0x10)), 4, 4, 6, 0f, 0f, 100, newColor, 1f); - } - if (tile[j, i].frameX == 0x2c) - { - Color color4 = new Color(); - Dust.NewDust(new Vector2((float) ((j * 0x10) + 2), (float) (i * 0x10)), 4, 4, 6, 0f, 0f, 100, color4, 1f); - } - else - { - Color color5 = new Color(); - Dust.NewDust(new Vector2((float) ((j * 0x10) + 4), (float) (i * 0x10)), 4, 4, 6, 0f, 0f, 100, color5, 1f); - } - } - if (((tile[j, i].type == 0x21) && (rand.Next(40) == 0)) && base.IsActive) - { - Color color6 = new Color(); - Dust.NewDust(new Vector2((float) ((j * 0x10) + 4), (float) ((i * 0x10) - 4)), 4, 4, 6, 0f, 0f, 100, color6, 1f); - } - if (((tile[j, i].type == 0x31) && (rand.Next(20) == 0)) && base.IsActive) - { - Color color7 = new Color(); - Dust.NewDust(new Vector2((float) ((j * 0x10) + 4), (float) ((i * 0x10) - 4)), 4, 4, 0x1d, 0f, 0f, 100, color7, 1f); - } - if ((((tile[j, i].type == 0x22) || (tile[j, i].type == 0x23)) || (tile[j, i].type == 0x24)) && ((((rand.Next(40) == 0) && base.IsActive) && (tile[j, i].frameY == 0x12)) && ((tile[j, i].frameX == 0) || (tile[j, i].frameX == 0x24)))) - { - Color color8 = new Color(); - Dust.NewDust(new Vector2((float) (j * 0x10), (float) ((i * 0x10) + 2)), 14, 6, 6, 0f, 0f, 100, color8, 1f); - } - if (((tile[j, i].type == 0x16) && (rand.Next(400) == 0)) && base.IsActive) - { - Color color9 = new Color(); - Dust.NewDust(new Vector2((float) (j * 0x10), (float) (i * 0x10)), 0x10, 0x10, 14, 0f, 0f, 0, color9, 1f); - } - else if ((((tile[j, i].type == 0x17) || (tile[j, i].type == 0x18)) || (tile[j, i].type == 0x20)) && ((rand.Next(500) == 0) && base.IsActive)) - { - Color color10 = new Color(); - Dust.NewDust(new Vector2((float) (j * 0x10), (float) (i * 0x10)), 0x10, 0x10, 14, 0f, 0f, 0, color10, 1f); - } - else if (((tile[j, i].type == 0x19) && (rand.Next(700) == 0)) && base.IsActive) - { - Color color11 = new Color(); - Dust.NewDust(new Vector2((float) (j * 0x10), (float) (i * 0x10)), 0x10, 0x10, 14, 0f, 0f, 0, color11, 1f); - } - else if (((tile[j, i].type == 0x1f) && (rand.Next(20) == 0)) && base.IsActive) - { - Color color12 = new Color(); - Dust.NewDust(new Vector2((float) (j * 0x10), (float) (i * 0x10)), 0x10, 0x10, 14, 0f, 0f, 100, color12, 1f); - } - else if (((tile[j, i].type == 0x1a) && (rand.Next(20) == 0)) && base.IsActive) - { - Color color13 = new Color(); - Dust.NewDust(new Vector2((float) (j * 0x10), (float) (i * 0x10)), 0x10, 0x10, 14, 0f, 0f, 100, color13, 1f); - } - else if (((tile[j, i].type == 0x47) || (tile[j, i].type == 0x48)) && ((rand.Next(500) == 0) && base.IsActive)) - { - Color color14 = new Color(); - Dust.NewDust(new Vector2((float) (j * 0x10), (float) (i * 0x10)), 0x10, 0x10, 0x29, 0f, 0f, 250, color14, 0.8f); - } - else if (((tile[j, i].type == 0x11) || (tile[j, i].type == 0x4d)) && ((rand.Next(40) == 0) && base.IsActive)) - { - if ((tile[j, i].frameX == 0x12) & (tile[j, i].frameY == 0x12)) - { - Color color15 = new Color(); - Dust.NewDust(new Vector2((float) ((j * 0x10) + 2), (float) (i * 0x10)), 8, 6, 6, 0f, 0f, 100, color15, 1f); - } - } - else if ((((tile[j, i].type == 0x25) || (tile[j, i].type == 0x3a)) || (tile[j, i].type == 0x4c)) && ((rand.Next(200) == 0) && base.IsActive)) - { - Color color16 = new Color(); - int index = Dust.NewDust(new Vector2((float) (j * 0x10), (float) (i * 0x10)), 0x10, 0x10, 6, 0f, 0f, 0, color16, (float) rand.Next(3)); - if (dust[index].scale > 1f) - { - dust[index].noGravity = true; - } - } - if (((tile[j, i].type == 5) && (tile[j, i].frameY >= 0xc6)) && (tile[j, i].frameX >= 0x16)) - { - int num11 = 0; - if (tile[j, i].frameX == 0x16) - { - if (tile[j, i].frameY == 220) - { - num11 = 1; - } - else if (tile[j, i].frameY == 0xf2) - { - num11 = 2; - } - Vector2 origin = new Vector2(); - this.spriteBatch.Draw(treeTopTexture, new Vector2((float) (((j * 0x10) - ((int) screenPosition.X)) - 0x20), (float) (((i * 0x10) - ((int) screenPosition.Y)) - 0x40)), new Rectangle(num11 * 0x52, 0, 80, 80), Lighting.GetColor(j, i), 0f, origin, (float) 1f, SpriteEffects.None, 0f); - } - else if (tile[j, i].frameX == 0x2c) - { - if (tile[j, i].frameY == 220) - { - num11 = 1; - } - else if (tile[j, i].frameY == 0xf2) - { - num11 = 2; - } - Vector2 vector3 = new Vector2(); - this.spriteBatch.Draw(treeBranchTexture, new Vector2((float) (((j * 0x10) - ((int) screenPosition.X)) - 0x18), (float) (((i * 0x10) - ((int) screenPosition.Y)) - 12)), new Rectangle(0, num11 * 0x2a, 40, 40), Lighting.GetColor(j, i), 0f, vector3, (float) 1f, SpriteEffects.None, 0f); - } - else if (tile[j, i].frameX == 0x42) - { - if (tile[j, i].frameY == 220) - { - num11 = 1; - } - else if (tile[j, i].frameY == 0xf2) - { - num11 = 2; - } - Vector2 vector4 = new Vector2(); - this.spriteBatch.Draw(treeBranchTexture, new Vector2((float) ((j * 0x10) - ((int) screenPosition.X)), (float) (((i * 0x10) - ((int) screenPosition.Y)) - 12)), new Rectangle(0x2a, num11 * 0x2a, 40, 40), Lighting.GetColor(j, i), 0f, vector4, (float) 1f, SpriteEffects.None, 0f); - } - } - if ((tile[j, i].type == 0x48) && (tile[j, i].frameX >= 0x24)) - { - int num12 = 0; - if (tile[j, i].frameY == 0x12) - { - num12 = 1; - } - else if (tile[j, i].frameY == 0x24) - { - num12 = 2; - } - Vector2 vector5 = new Vector2(); - this.spriteBatch.Draw(shroomCapTexture, new Vector2((float) (((j * 0x10) - ((int) screenPosition.X)) - 0x16), (float) (((i * 0x10) - ((int) screenPosition.Y)) - 0x1a)), new Rectangle(num12 * 0x3e, 0, 60, 0x2a), Lighting.GetColor(j, i), 0f, vector5, (float) 1f, SpriteEffects.None, 0f); - } - if (Lighting.Brightness(j, i) > 0f) - { - if (solidOnly && (((tile[j - 1, i].liquid > 0) || (tile[j + 1, i].liquid > 0)) || ((tile[j, i - 1].liquid > 0) || (tile[j, i + 1].liquid > 0)))) - { - Color color = Lighting.GetColor(j, i); - int liquid = 0; - bool flag = false; - bool flag2 = false; - bool flag3 = false; - bool flag4 = false; - int num14 = 0; - bool flag5 = false; - if (tile[j - 1, i].liquid > liquid) - { - liquid = tile[j - 1, i].liquid; - flag = true; - } - else if (tile[j - 1, i].liquid > 0) - { - flag = true; - } - if (tile[j + 1, i].liquid > liquid) - { - liquid = tile[j + 1, i].liquid; - flag2 = true; - } - else if (tile[j + 1, i].liquid > 0) - { - liquid = tile[j + 1, i].liquid; - flag2 = true; - } - if (tile[j, i - 1].liquid > 0) - { - flag3 = true; - } - if (tile[j, i + 1].liquid > 240) - { - flag4 = true; - } - if (tile[j - 1, i].liquid > 0) - { - if (tile[j - 1, i].lava) - { - num14 = 1; - } - else - { - flag5 = true; - } - } - if (tile[j + 1, i].liquid > 0) - { - if (tile[j + 1, i].lava) - { - num14 = 1; - } - else - { - flag5 = true; - } - } - if (tile[j, i - 1].liquid > 0) - { - if (tile[j, i - 1].lava) - { - num14 = 1; - } - else - { - flag5 = true; - } - } - if (tile[j, i + 1].liquid > 0) - { - if (tile[j, i + 1].lava) - { - num14 = 1; - } - else - { - flag5 = true; - } - } - if (!flag5 || (num14 != 1)) - { - float num15 = 0f; - Vector2 vector = new Vector2((float) (j * 0x10), (float) (i * 0x10)); - Rectangle rectangle = new Rectangle(0, 4, 0x10, 0x10); - if (flag4 && (flag || flag2)) - { - flag = true; - flag2 = true; - } - if ((!flag3 || (!flag && !flag2)) && (!flag4 || !flag3)) - { - if (flag3) - { - rectangle = new Rectangle(0, 4, 0x10, 4); - } - else if ((flag4 && !flag) && !flag2) - { - vector = new Vector2((float) (j * 0x10), (float) ((i * 0x10) + 12)); - rectangle = new Rectangle(0, 4, 0x10, 4); - } - else - { - num15 = 0x100 - liquid; - num15 /= 32f; - if (flag && flag2) - { - vector = new Vector2((float) (j * 0x10), (float) ((i * 0x10) + (((int) num15) * 2))); - rectangle = new Rectangle(0, 4, 0x10, 0x10 - (((int) num15) * 2)); - } - else if (flag) - { - vector = new Vector2((float) (j * 0x10), (float) ((i * 0x10) + (((int) num15) * 2))); - rectangle = new Rectangle(0, 4, 4, 0x10 - (((int) num15) * 2)); - } - else - { - vector = new Vector2((float) ((j * 0x10) + 12), (float) ((i * 0x10) + (((int) num15) * 2))); - rectangle = new Rectangle(0, 4, 4, 0x10 - (((int) num15) * 2)); - } - } - } - float num16 = 0.5f; - if (num14 == 1) - { - num16 *= 1.6f; - } - if ((i < worldSurface) || (num16 > 1f)) - { - num16 = 1f; - } - float num17 = color.R * num16; - float num18 = color.G * num16; - float num19 = color.B * num16; - float num20 = color.A * num16; - color = new Color((int) ((byte) num17), (int) ((byte) num18), (int) ((byte) num19), (int) ((byte) num20)); - Vector2 vector6 = new Vector2(); - this.spriteBatch.Draw(liquidTexture[num14], vector - screenPosition, new Rectangle?(rectangle), color, 0f, vector6, (float) 1f, SpriteEffects.None, 0f); - } - } - if (tile[j, i].type == 0x33) - { - Color color2 = Lighting.GetColor(j, i); - float num21 = 0.5f; - float num22 = color2.R * num21; - float num23 = color2.G * num21; - float num24 = color2.B * num21; - float num25 = color2.A * num21; - color2 = new Color((int) ((byte) num22), (int) ((byte) num23), (int) ((byte) num24), (int) ((byte) num25)); - Vector2 vector7 = new Vector2(); - this.spriteBatch.Draw(tileTexture[tile[j, i].type], new Vector2(((j * 0x10) - ((int) screenPosition.X)) - ((width - 16f) / 2f), (float) (((i * 0x10) - ((int) screenPosition.Y)) + num9)), new Rectangle(tile[j, i].frameX, tile[j, i].frameY, width, height), color2, 0f, vector7, (float) 1f, SpriteEffects.None, 0f); - } - else - { - Vector2 vector8 = new Vector2(); - this.spriteBatch.Draw(tileTexture[tile[j, i].type], new Vector2(((j * 0x10) - ((int) screenPosition.X)) - ((width - 16f) / 2f), (float) (((i * 0x10) - ((int) screenPosition.Y)) + num9)), new Rectangle(tile[j, i].frameX, tile[j, i].frameY, width, height), Lighting.GetColor(j, i), 0f, vector8, (float) 1f, SpriteEffects.None, 0f); - } - } - } - } - } - } - - protected void DrawWater(bool bg = false) - { - int num = (int) ((screenPosition.X / 16f) - 1f); - int maxTilesX = ((int) ((screenPosition.X + screenWidth) / 16f)) + 2; - int num3 = (int) ((screenPosition.Y / 16f) - 1f); - int maxTilesY = ((int) ((screenPosition.Y + screenHeight) / 16f)) + 2; - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num3 < 0) - { - num3 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int i = num3; i < (maxTilesY + 4); i++) - { - for (int j = num - 2; j < (maxTilesX + 2); j++) - { - if ((tile[j, i].liquid <= 0) || (Lighting.Brightness(j, i) <= 0f)) - { - continue; - } - Color color = Lighting.GetColor(j, i); - float num7 = 0x100 - tile[j, i].liquid; - num7 /= 32f; - int index = 0; - if (tile[j, i].lava) - { - index = 1; - } - float num9 = 0.5f; - if (bg) - { - num9 = 1f; - } - Vector2 vector = new Vector2((float) (j * 0x10), (float) ((i * 0x10) + (((int) num7) * 2))); - Rectangle rectangle = new Rectangle(0, 0, 0x10, 0x10 - (((int) num7) * 2)); - if ((tile[j, i + 1].liquid < 0xf5) && ((!tile[j, i + 1].active || !tileSolid[tile[j, i + 1].type]) || tileSolidTop[tile[j, i + 1].type])) - { - float num10 = 0x100 - tile[j, i + 1].liquid; - num10 /= 32f; - num9 = (0.5f * (8f - num7)) / 4f; - if (num9 > 0.55) - { - num9 = 0.55f; - } - if (num9 < 0.35) - { - num9 = 0.35f; - } - float num11 = num7 / 2f; - if (tile[j, i + 1].liquid < 200) - { - if (bg) - { - continue; - } - if ((tile[j, i - 1].liquid > 0) && (tile[j, i - 1].liquid > 0)) - { - rectangle = new Rectangle(0, 4, 0x10, 0x10); - num9 = 0.5f; - } - else if (tile[j, i - 1].liquid > 0) - { - vector = new Vector2((float) (j * 0x10), (float) ((i * 0x10) + 4)); - rectangle = new Rectangle(0, 4, 0x10, 12); - num9 = 0.5f; - } - else if (tile[j, i + 1].liquid > 0) - { - vector = new Vector2((float) (j * 0x10), (float) (((i * 0x10) + (((int) num7) * 2)) + (((int) num10) * 2))); - rectangle = new Rectangle(0, 4, 0x10, 0x10 - (((int) num7) * 2)); - } - else - { - vector = new Vector2((float) ((j * 0x10) + ((int) num11)), (float) (((i * 0x10) + (((int) num11) * 2)) + (((int) num10) * 2))); - rectangle = new Rectangle(0, 4, 0x10 - (((int) num11) * 2), 0x10 - (((int) num11) * 2)); - } - } - else - { - num9 = 0.5f; - rectangle = new Rectangle(0, 4, 0x10, (0x10 - (((int) num7) * 2)) + (((int) num10) * 2)); - } - } - else if (tile[j, i - 1].liquid > 0x20) - { - rectangle = new Rectangle(0, 4, rectangle.Width, rectangle.Height); - } - else if (((num7 < 1f) && tile[j, i - 1].active) && (tileSolid[tile[j, i - 1].type] && !tileSolidTop[tile[j, i - 1].type])) - { - vector = new Vector2((float) (j * 0x10), (float) (i * 0x10)); - rectangle = new Rectangle(0, 4, 0x10, 0x10); - } - else - { - bool flag = true; - for (int k = i + 1; k < (i + 6); k++) - { - if ((tile[j, k].active && tileSolid[tile[j, k].type]) && !tileSolidTop[tile[j, k].type]) - { - break; - } - if (tile[j, k].liquid < 200) - { - flag = false; - break; - } - } - if (!flag) - { - num9 = 0.5f; - rectangle = new Rectangle(0, 4, 0x10, 0x10); - } - else if (tile[j, i - 1].liquid > 0) - { - rectangle = new Rectangle(0, 2, rectangle.Width, rectangle.Height); - } - } - if (tile[j, i].lava) - { - num9 *= 1.6f; - if (num9 > 1f) - { - num9 = 1f; - } - if (base.IsActive) - { - if ((tile[j, i].liquid > 200) && (rand.Next(700) == 0)) - { - Color newColor = new Color(); - Dust.NewDust(new Vector2((float) (j * 0x10), (float) (i * 0x10)), 0x10, 0x10, 0x23, 0f, 0f, 0, newColor, 1f); - } - if (((rectangle.Y == 0) && base.IsActive) && (rand.Next(300) == 0)) - { - Color color3 = new Color(); - int num13 = Dust.NewDust(new Vector2((float) (j * 0x10), ((i * 0x10) + (num7 * 2f)) - 8f), 0x10, 8, 0x23, 0f, 0f, 50, color3, 1.5f); - Dust dust1 = dust[num13]; - dust1.velocity = (Vector2) (dust1.velocity * 0.8f); - dust[num13].velocity.X *= 2f; - dust[num13].velocity.Y -= rand.Next(1, 7) * 0.1f; - if (rand.Next(10) == 0) - { - dust[num13].velocity.Y *= rand.Next(2, 5); - } - dust[num13].noGravity = true; - } - } - } - float num14 = color.R * num9; - float num15 = color.G * num9; - float num16 = color.B * num9; - float num17 = color.A * num9; - color = new Color((int) ((byte) num14), (int) ((byte) num15), (int) ((byte) num16), (int) ((byte) num17)); - Vector2 origin = new Vector2(); - this.spriteBatch.Draw(liquidTexture[index], vector - screenPosition, new Rectangle?(rectangle), color, 0f, origin, (float) 1f, SpriteEffects.None, 0f); - } - } - } - - private static void ErasePlayer(int i) - { - try - { - System.IO.File.Delete(loadPlayerPath[i]); - System.IO.File.Delete(loadPlayerPath[i] + ".bak"); - LoadPlayers(); - } - catch - { - } - } - - private static void EraseWorld(int i) - { - try - { - System.IO.File.Delete(loadWorldPath[i]); - System.IO.File.Delete(loadWorldPath[i] + ".bak"); - LoadWorlds(); - } - catch - { - } - } - - protected void getAuth() - { - try - { - string requestUriString = ""; - StringBuilder builder = new StringBuilder(); - byte[] buffer = new byte[0x2000]; - HttpWebRequest request = (HttpWebRequest) WebRequest.Create(requestUriString); - Stream responseStream = ((HttpWebResponse) request.GetResponse()).GetResponseStream(); - string str2 = null; - int count = 0; - do - { - count = responseStream.Read(buffer, 0, buffer.Length); - if (count != 0) - { - str2 = Encoding.ASCII.GetString(buffer, 0, count); - builder.Append(str2); - } - } - while (count > 0); - if (builder.ToString() == "") - { - webAuth = true; - } - } - catch - { - this.QuitGame(); - } - } - - public static string GetInputText(string oldString) - { - if (!hasFocus) - { - return oldString; - } - inputTextEnter = false; - string str = oldString; - if (str == null) - { - str = ""; - } - oldInputText = inputText; - inputText = Keyboard.GetState(); - bool flag = (((ushort) GetKeyState(20)) & 0xffff) != 0; - bool flag2 = false; - if (inputText.IsKeyDown(Keys.LeftShift) || inputText.IsKeyDown(Keys.RightShift)) - { - flag2 = true; - } - Keys[] pressedKeys = inputText.GetPressedKeys(); - Keys[] keysArray2 = oldInputText.GetPressedKeys(); - bool flag3 = false; - if (inputText.IsKeyDown(Keys.Back) && oldInputText.IsKeyDown(Keys.Back)) - { - if (backSpaceCount == 0) - { - backSpaceCount = 7; - flag3 = true; - } - backSpaceCount--; - } - else - { - backSpaceCount = 15; - } - for (int i = 0; i < pressedKeys.Length; i++) - { - bool flag4 = true; - for (int j = 0; j < keysArray2.Length; j++) - { - if (pressedKeys[i] == keysArray2[j]) - { - flag4 = false; - } - } - string str2 = pressedKeys[i].ToString(); - if ((str2 == "Back") && (flag4 || flag3)) - { - if (str.Length > 0) - { - str = str.Substring(0, str.Length - 1); - } - } - else if (flag4) - { - if (str2 == "Space") - { - str2 = " "; - } - else if (str2.Length == 1) - { - int num3 = Convert.ToInt32(Convert.ToChar(str2)); - if (((num3 >= 0x41) && (num3 <= 90)) && ((!flag2 && !flag) || (flag2 && flag))) - { - num3 += 0x20; - str2 = Convert.ToChar(num3).ToString(); - } - } - else if ((str2.Length == 2) && (str2.Substring(0, 1) == "D")) - { - str2 = str2.Substring(1, 1); - if (flag2) - { - switch (str2) - { - case "1": - str2 = "!"; - break; - - case "2": - str2 = "@"; - break; - - case "3": - str2 = "#"; - break; - - case "4": - str2 = "$"; - break; - - case "5": - str2 = "%"; - break; - - case "6": - str2 = "^"; - break; - - case "7": - str2 = "&"; - break; - - case "8": - str2 = "*"; - break; - - case "9": - str2 = "("; - break; - - case "0": - str2 = ")"; - break; - } - } - } - else if ((str2.Length == 7) && (str2.Substring(0, 6) == "NumPad")) - { - str2 = str2.Substring(6, 1); - } - else if (str2 == "Divide") - { - str2 = "/"; - } - else if (str2 == "Multiply") - { - str2 = "*"; - } - else if (str2 == "Subtract") - { - str2 = "-"; - } - else if (str2 == "Add") - { - str2 = "+"; - } - else if (str2 == "Decimal") - { - str2 = "."; - } - else - { - if (str2 == "OemSemicolon") - { - str2 = ";"; - } - else if (str2 == "OemPlus") - { - str2 = "="; - } - else if (str2 == "OemComma") - { - str2 = ","; - } - else if (str2 == "OemMinus") - { - str2 = "-"; - } - else if (str2 == "OemPeriod") - { - str2 = "."; - } - else if (str2 == "OemQuestion") - { - str2 = "/"; - } - else if (str2 == "OemTilde") - { - str2 = "`"; - } - else if (str2 == "OemOpenBrackets") - { - str2 = "["; - } - else if (str2 == "OemPipe") - { - str2 = @"\"; - } - else if (str2 == "OemCloseBrackets") - { - str2 = "]"; - } - else if (str2 == "OemQuotes") - { - str2 = "'"; - } - else if (str2 == "OemBackslash") - { - str2 = @"\"; - } - if (flag2) - { - if (str2 == ";") - { - str2 = ":"; - } - else if (str2 == "=") - { - str2 = "+"; - } - else if (str2 == ",") - { - str2 = "<"; - } - else if (str2 == "-") - { - str2 = "_"; - } - else if (str2 == ".") - { - str2 = ">"; - } - else if (str2 == "/") - { - str2 = "?"; - } - else if (str2 == "`") - { - str2 = "~"; - } - else if (str2 == "[") - { - str2 = "{"; - } - else if (str2 == @"\") - { - str2 = "|"; - } - else if (str2 == "]") - { - str2 = "}"; - } - else if (str2 == "'") - { - str2 = "\""; - } - } - } - if (str2 == "Enter") - { - inputTextEnter = true; - } - if (str2.Length == 1) - { - str = str + str2; - } - } - } - return str; - } - - [DllImport("user32.dll", CharSet=CharSet.Auto, ExactSpelling=true)] - public static extern short GetKeyState(int keyCode); - [DllImport("User32")] - private static extern int GetMenuItemCount(IntPtr hWnd); - [DllImport("User32")] - private static extern IntPtr GetSystemMenu(IntPtr hWnd, bool bRevert); - private static void HelpText() - { - bool flag = false; - if (player[myPlayer].statLifeMax > 100) - { - flag = true; - } - bool flag2 = false; - if (player[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; - bool flag10 = false; - for (int i = 0; i < 0x2c; i++) - { - if ((player[myPlayer].inventory[i].pick > 0) && (player[myPlayer].inventory[i].name != "Copper Pickaxe")) - { - flag3 = false; - } - if ((player[myPlayer].inventory[i].axe > 0) && (player[myPlayer].inventory[i].name != "Copper Axe")) - { - flag3 = false; - } - if (player[myPlayer].inventory[i].hammer > 0) - { - flag3 = false; - } - if (((player[myPlayer].inventory[i].type == 11) || (player[myPlayer].inventory[i].type == 12)) || ((player[myPlayer].inventory[i].type == 13) || (player[myPlayer].inventory[i].type == 14))) - { - flag4 = true; - } - if (((player[myPlayer].inventory[i].type == 0x13) || (player[myPlayer].inventory[i].type == 20)) || ((player[myPlayer].inventory[i].type == 0x15) || (player[myPlayer].inventory[i].type == 0x16))) - { - flag5 = true; - } - if (player[myPlayer].inventory[i].type == 0x4b) - { - flag6 = true; - } - if (player[myPlayer].inventory[i].type == 0x4b) - { - flag8 = true; - } - if ((player[myPlayer].inventory[i].type == 0x44) || (player[myPlayer].inventory[i].type == 70)) - { - flag9 = true; - } - if (player[myPlayer].inventory[i].type == 0x54) - { - flag10 = true; - } - if (player[myPlayer].inventory[i].type == 0x75) - { - flag7 = true; - } - } - bool flag11 = false; - bool flag12 = false; - bool flag13 = false; - bool flag14 = false; - for (int j = 0; j < 0x3e8; j++) - { - if (npc[j].active) - { - if (npc[j].type == 0x11) - { - flag11 = true; - } - if (npc[j].type == 0x12) - { - flag12 = true; - } - if (npc[j].type == 0x13) - { - flag14 = true; - } - if (npc[j].type == 20) - { - flag13 = true; - } - } - } - Label_0316: - helpText++; - if (flag3) - { - if (helpText == 1) - { - npcChatText = "You can use your pickaxe to dig through dirt, and your axe to chop down trees. Just place your cursor over the tile and click!"; - return; - } - if (helpText == 2) - { - npcChatText = "If you want to survive, you will need to create weapons and shelter. Start by chopping down trees and gathering wood."; - return; - } - if (helpText == 3) - { - npcChatText = "Press ESC to access your crafting menu. When you have enough wood, create a workbench. This will allow you to create more complicated things, as long as you are standing close to it."; - return; - } - if (helpText == 4) - { - npcChatText = "You can build a shelter by placing wood or other blocks in the world. Don't forget to create and place walls."; - return; - } - if (helpText == 5) - { - npcChatText = "Once you have a wooden sword, you might try to gather some gel from the slimes. Combine wood and gel to make a torch!"; - return; - } - if (helpText == 6) - { - npcChatText = "To interact with backgrounds and placed objects, use a hammer!"; - return; - } - } - if ((flag3 && !flag4) && (!flag5 && (helpText == 11))) - { - npcChatText = "You should do some mining to find metal ore. You can craft very useful things with it."; - } - else - { - if ((flag3 && flag4) && !flag5) - { - if (helpText == 0x15) - { - npcChatText = "Now that you have some ore, you will need to turn it into a bar in order to make items with it. This requires a furnace!"; - return; - } - if (helpText == 0x16) - { - npcChatText = "You can create a furnace out of torches, wood, and stone. Make sure you are standing near a work bench."; - return; - } - } - if (flag3 && flag5) - { - if (helpText == 0x1f) - { - npcChatText = "You will need an anvil to make most things out of metal bars."; - return; - } - if (helpText == 0x20) - { - npcChatText = "Anvils can be crafted out of iron, or purchased from a merchant."; - return; - } - } - if (!flag && (helpText == 0x29)) - { - npcChatText = "Underground are crystal hearts that can be used to increase your max life. You will need a hammer to obtain them."; - } - else if (!flag2 && (helpText == 0x2a)) - { - npcChatText = "If you gather 10 fallen stars, they can be combined to create an item that will increase your magic capacity."; - } - else if ((!flag2 && !flag6) && (helpText == 0x2b)) - { - npcChatText = "Stars fall all over the world at night. They can be used for all sorts of usefull things. If you see one, be sure to grab it because they disappear after sunrise."; - } - else - { - if (!flag11 && !flag12) - { - if (helpText == 0x33) - { - npcChatText = "There are many different ways you can attract people to move in to our town. They will of course need a home to live in."; - return; - } - if (helpText == 0x34) - { - npcChatText = "In order for a room to be considered a home, it needs to have a door, chair, table, and a light source. Make sure the house has walls as well."; - return; - } - if (helpText == 0x35) - { - npcChatText = "Two people will not live in the same home. Also, if their home is destroyed, they will look for a new place to live."; - return; - } - } - if (!flag11 && (helpText == 0x3d)) - { - npcChatText = "If you want a merchant to move in, you will need to gather plenty of money. 50 silver coins should do the trick!"; - } - else if (!flag12 && (helpText == 0x3e)) - { - npcChatText = "For a nurse to move in, you might want to increase your maximum life."; - } - else if (!flag14 && (helpText == 0x3f)) - { - npcChatText = "If you had a gun, I bet an arms dealer might show up to sell you some ammo!"; - } - else if (!flag13 && (helpText == 0x40)) - { - npcChatText = "You should prove yourself by defeating a strong monster. That will get the attention of a dryad."; - } - else if (flag8 && (helpText == 0x47)) - { - npcChatText = "If you combine lenses at a demon alter, you might be able to find a way to summon a powerful monster. You will want to wait until night before using it, though."; - } - else if (flag9 && (helpText == 0x48)) - { - npcChatText = "You can create worm bait with rotten chunks and vile powder. Make sure you are in a corrupt area before using it."; - } - else if ((flag8 || flag9) && (helpText == 80)) - { - npcChatText = "Demonic alters can usually be found in the corruption. You will need to be near them to craft some items."; - } - else if (!flag10 && (helpText == 0xc9)) - { - npcChatText = "You can make a grappling hook from a hook and 3 chains. Skeletons found deep underground usually carry hooks, and chains can be made from iron bars."; - } - else if (flag7 && (helpText == 0xca)) - { - npcChatText = "You can craft a space gun using a flintlock pistol, 10 fallen stars, and 30 meteorite bars."; - } - else if (helpText == 0x3e8) - { - npcChatText = "If you see a pot, be sure to smash it open. They contain all sorts of useful supplies."; - } - else if (helpText == 0x3e9) - { - npcChatText = "There is treasure hidden all over the world. Some amazing things can be found deep underground!"; - } - else if (helpText == 0x3ea) - { - npcChatText = "Smashing a shadow orb will cause a meteor to fall out of the sky. Shadow orbs can usually be found in the chasms around corrupt areas."; - } - else - { - if (helpText > 0x44c) - { - helpText = 0; - } - goto Label_0316; - } - } - } - } - - protected override void Initialize() - { - if (webProtect) - { - this.getAuth(); - while (!webAuth) - { - base.Exit(); - } - } - if (rand == null) - { - rand = new Random((int) DateTime.Now.Ticks); - } - if (WorldGen.genRand == null) - { - WorldGen.genRand = new Random((int) DateTime.Now.Ticks); - } - this.OpenSettings(); - switch (rand.Next(5)) - { - case 0: - base.Window.Title = "Terraria: ShankShock owns your soul!"; - break; - - case 1: - base.Window.Title = "Terraria: ShankShock owns your soul!"; - break; - - case 2: - base.Window.Title = "Terraria: ShankShock owns your soul!"; - break; - - case 3: - base.Window.Title = "Terraria: ShankShock owns your soul!"; - goto Label_00CF; - } - base.Window.Title = "Terraria: ShankShock owns your soul!"; - Label_00CF: - tileSolid[0] = true; - tileBlockLight[0] = true; - tileSolid[1] = true; - tileBlockLight[1] = true; - tileSolid[2] = true; - tileBlockLight[2] = true; - tileSolid[3] = false; - tileNoAttach[3] = true; - tileNoFail[3] = true; - tileSolid[4] = false; - tileNoAttach[4] = true; - tileNoFail[4] = true; - tileNoFail[0x18] = true; - tileSolid[5] = false; - tileSolid[6] = true; - tileBlockLight[6] = true; - tileSolid[7] = true; - tileBlockLight[7] = true; - tileSolid[8] = true; - tileBlockLight[8] = true; - tileSolid[9] = true; - tileBlockLight[9] = true; - tileBlockLight[10] = true; - tileSolid[10] = true; - tileNoAttach[10] = true; - tileBlockLight[10] = true; - tileSolid[11] = false; - tileSolidTop[0x13] = true; - tileSolid[0x13] = true; - tileSolid[0x16] = true; - tileSolid[0x17] = true; - tileSolid[0x19] = true; - tileSolid[30] = true; - tileNoFail[0x20] = true; - tileBlockLight[0x20] = true; - tileSolid[0x25] = true; - tileBlockLight[0x25] = true; - tileSolid[0x26] = true; - tileBlockLight[0x26] = true; - tileSolid[0x27] = true; - tileBlockLight[0x27] = true; - tileSolid[40] = true; - tileBlockLight[40] = true; - tileSolid[0x29] = true; - tileBlockLight[0x29] = true; - tileSolid[0x2b] = true; - tileBlockLight[0x2b] = true; - tileSolid[0x2c] = true; - tileBlockLight[0x2c] = true; - tileSolid[0x2d] = true; - tileBlockLight[0x2d] = true; - tileSolid[0x2e] = true; - tileBlockLight[0x2e] = true; - tileSolid[0x2f] = true; - tileBlockLight[0x2f] = true; - tileSolid[0x30] = true; - tileBlockLight[0x30] = true; - tileSolid[0x35] = true; - tileBlockLight[0x35] = true; - tileSolid[0x36] = true; - tileBlockLight[0x34] = true; - tileSolid[0x38] = true; - tileBlockLight[0x38] = true; - tileSolid[0x39] = true; - tileBlockLight[0x39] = true; - tileSolid[0x3a] = true; - tileBlockLight[0x3a] = true; - tileSolid[0x3b] = true; - tileBlockLight[0x3b] = true; - tileSolid[60] = true; - tileBlockLight[60] = true; - tileSolid[0x3f] = true; - tileBlockLight[0x3f] = true; - tileStone[0x3f] = true; - tileSolid[0x40] = true; - tileBlockLight[0x40] = true; - tileStone[0x40] = true; - tileSolid[0x41] = true; - tileBlockLight[0x41] = true; - tileStone[0x41] = true; - tileSolid[0x42] = true; - tileBlockLight[0x42] = true; - tileStone[0x42] = true; - tileSolid[0x43] = true; - tileBlockLight[0x43] = true; - tileStone[0x43] = true; - tileSolid[0x44] = true; - tileBlockLight[0x44] = true; - tileStone[0x44] = true; - tileSolid[0x4b] = true; - tileBlockLight[0x4b] = true; - tileSolid[0x4c] = true; - tileBlockLight[0x4c] = true; - tileSolid[70] = true; - tileBlockLight[70] = true; - tileBlockLight[0x33] = true; - tileNoFail[50] = true; - tileNoAttach[50] = true; - tileDungeon[0x29] = true; - tileDungeon[0x2b] = true; - tileDungeon[0x2c] = true; - tileBlockLight[30] = true; - tileBlockLight[0x19] = true; - tileBlockLight[0x17] = true; - tileBlockLight[0x16] = true; - tileBlockLight[0x3e] = true; - tileSolidTop[0x12] = true; - tileSolidTop[14] = true; - tileSolidTop[0x10] = true; - tileNoAttach[20] = true; - tileNoAttach[0x13] = true; - tileNoAttach[13] = true; - tileNoAttach[14] = true; - tileNoAttach[15] = true; - tileNoAttach[0x10] = true; - tileNoAttach[0x11] = true; - tileNoAttach[0x12] = true; - tileNoAttach[0x13] = true; - tileNoAttach[0x15] = true; - tileNoAttach[0x1b] = true; - tileFrameImportant[3] = true; - tileFrameImportant[5] = true; - tileFrameImportant[10] = true; - tileFrameImportant[11] = true; - tileFrameImportant[12] = true; - tileFrameImportant[13] = true; - tileFrameImportant[14] = true; - tileFrameImportant[15] = true; - tileFrameImportant[0x10] = true; - tileFrameImportant[0x11] = true; - tileFrameImportant[0x12] = true; - tileFrameImportant[20] = true; - tileFrameImportant[0x15] = true; - tileFrameImportant[0x18] = true; - tileFrameImportant[0x1a] = true; - tileFrameImportant[0x1b] = true; - tileFrameImportant[0x1c] = true; - tileFrameImportant[0x1d] = true; - tileFrameImportant[0x1f] = true; - tileFrameImportant[0x21] = true; - tileFrameImportant[0x22] = true; - tileFrameImportant[0x23] = true; - tileFrameImportant[0x24] = true; - tileFrameImportant[0x2a] = true; - tileFrameImportant[50] = true; - tileFrameImportant[0x37] = true; - tileFrameImportant[0x3d] = true; - tileFrameImportant[0x47] = true; - tileFrameImportant[0x48] = true; - tileFrameImportant[0x49] = true; - tileFrameImportant[0x4a] = true; - tileFrameImportant[0x4d] = true; - tileFrameImportant[0x4e] = true; - tileFrameImportant[0x4f] = true; - tileTable[14] = true; - tileTable[0x12] = true; - tileTable[0x13] = true; - tileWaterDeath[4] = true; - tileWaterDeath[0x33] = true; - tileLavaDeath[3] = true; - tileLavaDeath[5] = true; - tileLavaDeath[10] = true; - tileLavaDeath[11] = true; - tileLavaDeath[12] = true; - tileLavaDeath[13] = true; - tileLavaDeath[14] = true; - tileLavaDeath[15] = true; - tileLavaDeath[0x10] = true; - tileLavaDeath[0x11] = true; - tileLavaDeath[0x12] = true; - tileLavaDeath[0x13] = true; - tileLavaDeath[20] = true; - tileLavaDeath[0x1b] = true; - tileLavaDeath[0x1c] = true; - tileLavaDeath[0x1d] = true; - tileLavaDeath[0x20] = true; - tileLavaDeath[0x21] = true; - tileLavaDeath[0x22] = true; - tileLavaDeath[0x23] = true; - tileLavaDeath[0x24] = true; - tileLavaDeath[0x2a] = true; - tileLavaDeath[0x31] = true; - tileLavaDeath[50] = true; - tileLavaDeath[0x34] = true; - tileLavaDeath[0x37] = true; - tileLavaDeath[0x3d] = true; - tileLavaDeath[0x3e] = true; - tileLavaDeath[0x45] = true; - tileLavaDeath[0x47] = true; - tileLavaDeath[0x48] = true; - tileLavaDeath[0x49] = true; - tileLavaDeath[0x4a] = true; - tileLavaDeath[0x4e] = true; - tileLavaDeath[0x4f] = true; - wallHouse[1] = true; - wallHouse[4] = true; - wallHouse[5] = true; - wallHouse[6] = true; - wallHouse[10] = true; - wallHouse[11] = true; - wallHouse[12] = true; - for (int i = 0; i < maxMenuItems; i++) - { - this.menuItemScale[i] = 0.8f; - } - for (int j = 0; j < 0x7d0; j++) - { - dust[j] = new Dust(); - } - for (int k = 0; k < 0xc9; k++) - { - item[k] = new Item(); - } - for (int m = 0; m < 0x3e9; m++) - { - npc[m] = new NPC(); - npc[m].whoAmI = m; - } - for (int n = 0; n < 9; n++) - { - player[n] = new Player(); - } - for (int num7 = 0; num7 < 0x3e9; num7++) - { - projectile[num7] = new Projectile(); - } - for (int num8 = 0; num8 < 0xc9; num8++) - { - gore[num8] = new Gore(); - } - for (int num9 = 0; num9 < 100; num9++) - { - cloud[num9] = new Cloud(); - } - for (int num10 = 0; num10 < 100; num10++) - { - combatText[num10] = new CombatText(); - } - for (int num11 = 0; num11 < Recipe.maxRecipes; num11++) - { - recipe[num11] = new Recipe(); - availableRecipeY[num11] = 0x41 * num11; - } - Recipe.SetupRecipes(); - for (int num12 = 0; num12 < 7; num12++) - { - chatLine[num12] = new ChatLine(); - } - for (int num13 = 0; num13 < Liquid.resLiquid; num13++) - { - liquid[num13] = new Liquid(); - } - for (int num14 = 0; num14 < 0x2710; num14++) - { - liquidBuffer[num14] = new LiquidBuffer(); - } - this.graphics.PreferredBackBufferWidth = screenWidth; - this.graphics.PreferredBackBufferHeight = screenHeight; - this.graphics.ApplyChanges(); - this.shop[0] = new Chest(); - this.shop[1] = new Chest(); - this.shop[1].SetupShop(1); - this.shop[2] = new Chest(); - this.shop[2].SetupShop(2); - this.shop[3] = new Chest(); - this.shop[3].SetupShop(3); - this.shop[4] = new Chest(); - this.shop[4].SetupShop(4); - teamColor[0] = Color.White; - teamColor[1] = new Color(230, 40, 20); - teamColor[2] = new Color(20, 200, 30); - teamColor[3] = new Color(0x4b, 90, 0xff); - teamColor[4] = new Color(200, 180, 0); - Netplay.Init(); - if (skipMenu) - { - WorldGen.clearWorld(); - gameMenu = false; - LoadPlayers(); - player[myPlayer] = (Player) loadPlayer[0].Clone(); - PlayerPath = loadPlayerPath[0]; - LoadWorlds(); - WorldGen.generateWorld(-1); - WorldGen.EveryTileFrame(); - player[myPlayer].Spawn(); - } - else - { - IntPtr systemMenu = GetSystemMenu(base.Window.Handle, false); - int menuItemCount = GetMenuItemCount(systemMenu); - RemoveMenu(systemMenu, menuItemCount - 1, 0x400); - } - base.Initialize(); - Star.SpawnStars(); - } - - private static void InvasionWarning() - { - if (invasionType != 0) - { - string newText = ""; - if (invasionSize <= 0) - { - newText = "The goblin army has been defeated!"; - } - else if (invasionX < spawnTileX) - { - newText = "A goblin army is approaching from the west!"; - } - else if (invasionX > spawnTileX) - { - newText = "A goblin army is approaching from the east!"; - } - else - { - newText = "The goblin army has arrived!"; - } - if (netMode == 0) - { - NewText(newText, 0xaf, 0x4b, 0xff); - } - else if (netMode == 2) - { - NetMessage.SendData(0x19, -1, -1, newText, 8, 175f, 75f, 255f); - } - } - } - - protected override void LoadContent() - { - engine = new AudioEngine(@"Content\TerrariaMusic.xgs"); - soundBank = new Microsoft.Xna.Framework.Audio.SoundBank(engine, @"Content\Sound Bank.xsb"); - waveBank = new Microsoft.Xna.Framework.Audio.WaveBank(engine, @"Content\Wave Bank.xwb"); - raTexture = base.Content.Load(@"Images\ra-logo"); - reTexture = base.Content.Load(@"Images\re-logo"); - splashTexture = base.Content.Load(@"Images\splash"); - fadeTexture = base.Content.Load(@"Images\fade-out"); - for (int i = 1; i < 7; i++) - { - music[i] = soundBank.GetCue("Music_" + i); - } - this.spriteBatch = new SpriteBatch(base.GraphicsDevice); - for (int j = 0; j < 80; j++) - { - tileTexture[j] = base.Content.Load(@"Images\Tiles_" + j); - } - for (int k = 1; k < 14; k++) - { - wallTexture[k] = base.Content.Load(@"Images\Wall_" + k); - } - for (int m = 0; m < 7; m++) - { - backgroundTexture[m] = base.Content.Load(@"Images\Background_" + m); - backgroundWidth[m] = backgroundTexture[m].Width; - backgroundHeight[m] = backgroundTexture[m].Height; - } - for (int n = 0; n < 0xec; n++) - { - itemTexture[n] = base.Content.Load(@"Images\Item_" + n); - } - for (int num6 = 0; num6 < 0x2c; num6++) - { - npcTexture[num6] = base.Content.Load(@"Images\NPC_" + num6); - } - for (int num7 = 0; num7 < 0x26; num7++) - { - projectileTexture[num7] = base.Content.Load(@"Images\Projectile_" + num7); - } - for (int num8 = 1; num8 < 0x49; num8++) - { - goreTexture[num8] = base.Content.Load(@"Images\Gore_" + num8); - } - for (int num9 = 0; num9 < 4; num9++) - { - cloudTexture[num9] = base.Content.Load(@"Images\Cloud_" + num9); - } - for (int num10 = 0; num10 < 5; num10++) - { - starTexture[num10] = base.Content.Load(@"Images\Star_" + num10); - } - for (int num11 = 0; num11 < 2; num11++) - { - liquidTexture[num11] = base.Content.Load(@"Images\Liquid_" + num11); - } - cdTexture = base.Content.Load(@"Images\CoolDown"); - logoTexture = base.Content.Load(@"Images\Logo"); - dustTexture = base.Content.Load(@"Images\Dust"); - sunTexture = base.Content.Load(@"Images\Sun"); - moonTexture = base.Content.Load(@"Images\Moon"); - blackTileTexture = base.Content.Load(@"Images\Black_Tile"); - heartTexture = base.Content.Load(@"Images\Heart"); - bubbleTexture = base.Content.Load(@"Images\Bubble"); - manaTexture = base.Content.Load(@"Images\Mana"); - cursorTexture = base.Content.Load(@"Images\Cursor"); - treeTopTexture = base.Content.Load(@"Images\Tree_Tops"); - treeBranchTexture = base.Content.Load(@"Images\Tree_Branches"); - shroomCapTexture = base.Content.Load(@"Images\Shroom_Tops"); - inventoryBackTexture = base.Content.Load(@"Images\Inventory_Back"); - textBackTexture = base.Content.Load(@"Images\Text_Back"); - chatTexture = base.Content.Load(@"Images\Chat"); - chat2Texture = base.Content.Load(@"Images\Chat2"); - chatBackTexture = base.Content.Load(@"Images\Chat_Back"); - teamTexture = base.Content.Load(@"Images\Team"); - for (int num12 = 1; num12 < 10; num12++) - { - armorBodyTexture[num12] = base.Content.Load(@"Images\Armor_Body_" + num12); - armorArmTexture[num12] = base.Content.Load(@"Images\Armor_Arm_" + num12); - } - for (int num13 = 1; num13 < 12; num13++) - { - armorHeadTexture[num13] = base.Content.Load(@"Images\Armor_Head_" + num13); - } - for (int num14 = 1; num14 < 10; num14++) - { - armorLegTexture[num14] = base.Content.Load(@"Images\Armor_Legs_" + num14); - } - for (int num15 = 0; num15 < 0x11; num15++) - { - playerHairTexture[num15] = base.Content.Load(@"Images\Player_Hair_" + (num15 + 1)); - } - playerEyeWhitesTexture = base.Content.Load(@"Images\Player_Eye_Whites"); - playerEyesTexture = base.Content.Load(@"Images\Player_Eyes"); - playerHandsTexture = base.Content.Load(@"Images\Player_Hands"); - playerHands2Texture = base.Content.Load(@"Images\Player_Hands2"); - playerHeadTexture = base.Content.Load(@"Images\Player_Head"); - playerPantsTexture = base.Content.Load(@"Images\Player_Pants"); - playerShirtTexture = base.Content.Load(@"Images\Player_Shirt"); - playerShoesTexture = base.Content.Load(@"Images\Player_Shoes"); - playerUnderShirtTexture = base.Content.Load(@"Images\Player_Undershirt"); - playerUnderShirt2Texture = base.Content.Load(@"Images\Player_Undershirt2"); - chainTexture = base.Content.Load(@"Images\Chain"); - chain2Texture = base.Content.Load(@"Images\Chain2"); - chain3Texture = base.Content.Load(@"Images\Chain3"); - chain4Texture = base.Content.Load(@"Images\Chain4"); - chain5Texture = base.Content.Load(@"Images\Chain5"); - chain6Texture = base.Content.Load(@"Images\Chain6"); - boneArmTexture = base.Content.Load(@"Images\Arm_Bone"); - soundGrab = base.Content.Load(@"Sounds\Grab"); - soundInstanceGrab = soundGrab.CreateInstance(); - soundDig[0] = base.Content.Load(@"Sounds\Dig_0"); - soundInstanceDig[0] = soundDig[0].CreateInstance(); - soundDig[1] = base.Content.Load(@"Sounds\Dig_1"); - soundInstanceDig[1] = soundDig[1].CreateInstance(); - soundDig[2] = base.Content.Load(@"Sounds\Dig_2"); - soundInstanceDig[2] = soundDig[2].CreateInstance(); - soundTink[0] = base.Content.Load(@"Sounds\Tink_0"); - soundInstanceTink[0] = soundTink[0].CreateInstance(); - soundTink[1] = base.Content.Load(@"Sounds\Tink_1"); - soundInstanceTink[1] = soundTink[1].CreateInstance(); - soundTink[2] = base.Content.Load(@"Sounds\Tink_2"); - soundInstanceTink[2] = soundTink[2].CreateInstance(); - soundPlayerHit[0] = base.Content.Load(@"Sounds\Player_Hit_0"); - soundInstancePlayerHit[0] = soundPlayerHit[0].CreateInstance(); - soundPlayerHit[1] = base.Content.Load(@"Sounds\Player_Hit_1"); - soundInstancePlayerHit[1] = soundPlayerHit[1].CreateInstance(); - soundPlayerHit[2] = base.Content.Load(@"Sounds\Player_Hit_2"); - soundInstancePlayerHit[2] = soundPlayerHit[2].CreateInstance(); - soundFemaleHit[0] = base.Content.Load(@"Sounds\Female_Hit_0"); - soundInstanceFemaleHit[0] = soundFemaleHit[0].CreateInstance(); - soundFemaleHit[1] = base.Content.Load(@"Sounds\Female_Hit_1"); - soundInstanceFemaleHit[1] = soundFemaleHit[1].CreateInstance(); - soundFemaleHit[2] = base.Content.Load(@"Sounds\Female_Hit_2"); - soundInstanceFemaleHit[2] = soundFemaleHit[2].CreateInstance(); - soundPlayerKilled = base.Content.Load(@"Sounds\Player_Killed"); - soundInstancePlayerKilled = soundPlayerKilled.CreateInstance(); - soundGrass = base.Content.Load(@"Sounds\Grass"); - soundInstanceGrass = soundGrass.CreateInstance(); - soundDoorOpen = base.Content.Load(@"Sounds\Door_Opened"); - soundInstanceDoorOpen = soundDoorOpen.CreateInstance(); - soundDoorClosed = base.Content.Load(@"Sounds\Door_Closed"); - soundInstanceDoorClosed = soundDoorClosed.CreateInstance(); - soundMenuTick = base.Content.Load(@"Sounds\Menu_Tick"); - soundInstanceMenuTick = soundMenuTick.CreateInstance(); - soundMenuOpen = base.Content.Load(@"Sounds\Menu_Open"); - soundInstanceMenuOpen = soundMenuOpen.CreateInstance(); - soundMenuClose = base.Content.Load(@"Sounds\Menu_Close"); - soundInstanceMenuClose = soundMenuClose.CreateInstance(); - soundShatter = base.Content.Load(@"Sounds\Shatter"); - soundInstanceShatter = soundShatter.CreateInstance(); - soundZombie[0] = base.Content.Load(@"Sounds\Zombie_0"); - soundInstanceZombie[0] = soundZombie[0].CreateInstance(); - soundZombie[1] = base.Content.Load(@"Sounds\Zombie_1"); - soundInstanceZombie[1] = soundZombie[1].CreateInstance(); - soundZombie[2] = base.Content.Load(@"Sounds\Zombie_2"); - soundInstanceZombie[2] = soundZombie[2].CreateInstance(); - soundRoar[0] = base.Content.Load(@"Sounds\Roar_0"); - soundInstanceRoar[0] = soundRoar[0].CreateInstance(); - soundRoar[1] = base.Content.Load(@"Sounds\Roar_1"); - soundInstanceRoar[1] = soundRoar[1].CreateInstance(); - soundSplash[0] = base.Content.Load(@"Sounds\Splash_0"); - soundInstanceSplash[0] = soundRoar[0].CreateInstance(); - soundSplash[1] = base.Content.Load(@"Sounds\Splash_1"); - soundInstanceSplash[1] = soundSplash[1].CreateInstance(); - soundDoubleJump = base.Content.Load(@"Sounds\Double_Jump"); - soundInstanceDoubleJump = soundRoar[0].CreateInstance(); - soundRun = base.Content.Load(@"Sounds\Run"); - soundInstanceRun = soundRun.CreateInstance(); - soundCoins = base.Content.Load(@"Sounds\Coins"); - soundInstanceCoins = soundCoins.CreateInstance(); - for (int num16 = 1; num16 < 0x11; num16++) - { - soundItem[num16] = base.Content.Load(@"Sounds\Item_" + num16); - soundInstanceItem[num16] = soundItem[num16].CreateInstance(); - } - for (int num17 = 1; num17 < 4; num17++) - { - soundNPCHit[num17] = base.Content.Load(@"Sounds\NPC_Hit_" + num17); - soundInstanceNPCHit[num17] = soundNPCHit[num17].CreateInstance(); - } - for (int num18 = 1; num18 < 4; num18++) - { - soundNPCKilled[num18] = base.Content.Load(@"Sounds\NPC_Killed_" + num18); - soundInstanceNPCKilled[num18] = soundNPCKilled[num18].CreateInstance(); - } - fontItemStack = base.Content.Load(@"Fonts\Item_Stack"); - fontMouseText = base.Content.Load(@"Fonts\Mouse_Text"); - fontDeathText = base.Content.Load(@"Fonts\Death_Text"); - fontCombatText = base.Content.Load(@"Fonts\Combat_Text"); - } - - private static void LoadPlayers() - { - Directory.CreateDirectory(PlayerPath); - string[] files = Directory.GetFiles(PlayerPath, "*.plr"); - int length = files.Length; - if (length > 5) - { - length = 5; - } - for (int i = 0; i < 5; i++) - { - loadPlayer[i] = new Player(); - if (i < length) - { - loadPlayerPath[i] = files[i]; - loadPlayer[i] = Player.LoadPlayer(loadPlayerPath[i]); - } - } - numLoadPlayers = length; - } - - public static void LoadWorlds() - { - Directory.CreateDirectory(WorldPath); - string[] files = Directory.GetFiles(WorldPath, "*.wld"); - int length = files.Length; - if (length > 5) - { - length = 5; - } - for (int i = 0; i < length; i++) - { - loadWorldPath[i] = files[i]; - using (FileStream stream = new FileStream(loadWorldPath[i], FileMode.Open)) - { - using (BinaryReader reader = new BinaryReader(stream)) - { - reader.ReadInt32(); - loadWorld[i] = reader.ReadString(); - reader.Close(); - } - } - } - numLoadWorlds = length; - } - - protected void MouseText(string cursorText, int rare = 0) - { - float num3; - int num = mouseState.X + 10; - int num2 = mouseState.Y + 10; - Color color = new Color((int) mouseTextColor, (int) mouseTextColor, (int) mouseTextColor, (int) mouseTextColor); - if (toolTip.type > 0) - { - rare = toolTip.rare; - int num4 = 20; - int index = 1; - string[] strArray = new string[num4]; - strArray[0] = toolTip.name; - if (toolTip.stack > 1) - { - string[] strArray2 = new string[strArray.Length]; - object obj2 = strArray2[0]; - (strArray2 = strArray)[0] = string.Concat(new object[] { obj2, " (", toolTip.stack, ")" }); - } - if (toolTip.damage > 0) - { - strArray[index] = toolTip.damage + " damage"; - index++; - if (toolTip.useStyle > 0) - { - string[] strArray3; - IntPtr ptr; - if (toolTip.useAnimation <= 8) - { - strArray[index] = "Insanely fast"; - } - else if (toolTip.useAnimation <= 15) - { - strArray[index] = "Very fast"; - } - else if (toolTip.useAnimation <= 20) - { - strArray[index] = "Fast"; - } - else if (toolTip.useAnimation <= 0x19) - { - strArray[index] = "Average"; - } - else if (toolTip.useAnimation <= 30) - { - strArray[index] = "Slow"; - } - else if (toolTip.useAnimation <= 40) - { - strArray[index] = "Very slow"; - } - else if (toolTip.useAnimation <= 50) - { - strArray[index] = "Extremly slow"; - } - else - { - strArray[index] = "Snail"; - } - (strArray3 = strArray)[(int) (ptr = (IntPtr) index)] = strArray3[(int) ptr] + " speed"; - index++; - } - } - if (((toolTip.headSlot > 0) || (toolTip.bodySlot > 0)) || ((toolTip.legSlot > 0) || toolTip.accessory)) - { - strArray[index] = "Equipable"; - index++; - } - if (toolTip.defense > 0) - { - strArray[index] = toolTip.defense + " defense"; - index++; - } - if (toolTip.pick > 0) - { - strArray[index] = toolTip.pick + "% pickaxe power"; - index++; - } - if (toolTip.axe > 0) - { - strArray[index] = toolTip.axe + "% axe power"; - index++; - } - if (toolTip.hammer > 0) - { - strArray[index] = toolTip.hammer + "% hammer power"; - index++; - } - if (toolTip.healLife > 0) - { - strArray[index] = "Restores " + toolTip.healLife + " life"; - index++; - } - if (toolTip.healMana > 0) - { - strArray[index] = "Restores " + toolTip.healMana + " mana"; - index++; - } - if (toolTip.mana > 0) - { - strArray[index] = "Uses " + ((int) (toolTip.mana * player[myPlayer].manaCost)) + " mana"; - index++; - } - if (((toolTip.createWall > 0) || (toolTip.createTile > -1)) && (toolTip.type != 0xd5)) - { - strArray[index] = "Can be placed"; - index++; - } - if (toolTip.consumable) - { - strArray[index] = "Consumable"; - index++; - } - if (toolTip.toolTip != null) - { - strArray[index] = toolTip.toolTip; - index++; - } - if (toolTip.wornArmor && (player[myPlayer].setBonus != "")) - { - strArray[index] = "Set bonus: " + player[myPlayer].setBonus; - index++; - } - if (npcShop > 0) - { - if (toolTip.value > 0) - { - string str = ""; - int num6 = 0; - int num7 = 0; - int num8 = 0; - int num9 = 0; - int num10 = toolTip.value * toolTip.stack; - if (!toolTip.buy) - { - num10 /= 5; - } - if (num10 < 1) - { - num10 = 1; - } - if (num10 >= 0xf4240) - { - num6 = num10 / 0xf4240; - num10 -= num6 * 0xf4240; - } - if (num10 >= 0x2710) - { - num7 = num10 / 0x2710; - num10 -= num7 * 0x2710; - } - if (num10 >= 100) - { - num8 = num10 / 100; - num10 -= num8 * 100; - } - if (num10 >= 1) - { - num9 = num10; - } - if (num6 > 0) - { - str = str + num6 + " platinum "; - } - if (num7 > 0) - { - str = str + num7 + " gold "; - } - if (num8 > 0) - { - str = str + num8 + " silver "; - } - if (num9 > 0) - { - str = str + num9 + " copper "; - } - if (!toolTip.buy) - { - strArray[index] = "Sell price: " + str; - } - else - { - strArray[index] = "Buy price: " + str; - } - index++; - num3 = ((float) mouseTextColor) / 255f; - if (num6 > 0) - { - color = new Color((int) ((byte) (220f * num3)), (int) ((byte) (220f * num3)), (int) ((byte) (198f * num3)), (int) mouseTextColor); - } - else if (num7 > 0) - { - color = new Color((int) ((byte) (224f * num3)), (int) ((byte) (201f * num3)), (int) ((byte) (92f * num3)), (int) mouseTextColor); - } - else if (num8 > 0) - { - color = new Color((int) ((byte) (181f * num3)), (int) ((byte) (192f * num3)), (int) ((byte) (193f * num3)), (int) mouseTextColor); - } - else if (num9 > 0) - { - color = new Color((int) ((byte) (246f * num3)), (int) ((byte) (138f * num3)), (int) ((byte) (96f * num3)), (int) mouseTextColor); - } - } - else - { - num3 = ((float) mouseTextColor) / 255f; - strArray[index] = "No value"; - index++; - color = new Color((int) ((byte) (120f * num3)), (int) ((byte) (120f * num3)), (int) ((byte) (120f * num3)), (int) mouseTextColor); - } - } - Vector2 vector = new Vector2(); - int num11 = 0; - for (int i = 0; i < index; i++) - { - Vector2 vector2 = fontMouseText.MeasureString(strArray[i]); - if (vector2.X > vector.X) - { - vector.X = vector2.X; - } - vector.Y += vector2.Y + num11; - } - if (((num + vector.X) + 4f) > screenWidth) - { - num = (int) ((screenWidth - vector.X) - 4f); - } - if (((num2 + vector.Y) + 4f) > screenHeight) - { - num2 = (int) ((screenHeight - vector.Y) - 4f); - } - int num13 = 0; - num3 = ((float) mouseTextColor) / 255f; - for (int j = 0; j < index; j++) - { - for (int k = 0; k < 5; k++) - { - int num16 = num; - int num17 = num2 + num13; - Color black = Color.Black; - switch (k) - { - case 0: - num16 -= 2; - break; - - case 1: - num16 += 2; - break; - - case 2: - num17 -= 2; - break; - - case 3: - num17 += 2; - break; - - default: - black = new Color((int) mouseTextColor, (int) mouseTextColor, (int) mouseTextColor, (int) mouseTextColor); - if (j == 0) - { - if (rare == 1) - { - black = new Color((int) ((byte) (150f * num3)), (int) ((byte) (150f * num3)), (int) ((byte) (255f * num3)), (int) mouseTextColor); - } - if (rare == 2) - { - black = new Color((int) ((byte) (150f * num3)), (int) ((byte) (255f * num3)), (int) ((byte) (150f * num3)), (int) mouseTextColor); - } - if (rare == 3) - { - black = new Color((int) ((byte) (255f * num3)), (int) ((byte) (200f * num3)), (int) ((byte) (150f * num3)), (int) mouseTextColor); - } - if (rare == 4) - { - black = new Color((int) ((byte) (255f * num3)), (int) ((byte) (150f * num3)), (int) ((byte) (150f * num3)), (int) mouseTextColor); - } - } - else if (j == (index - 1)) - { - black = color; - } - break; - } - Vector2 origin = new Vector2(); - this.spriteBatch.DrawString(fontMouseText, strArray[j], new Vector2((float) num16, (float) num17), black, 0f, origin, (float) 1f, SpriteEffects.None, 0f); - } - num13 += ((int) fontMouseText.MeasureString(strArray[j]).Y) + num11; - } - } - else - { - Vector2 vector3 = fontMouseText.MeasureString(cursorText); - if (((num + vector3.X) + 4f) > screenWidth) - { - num = (int) ((screenWidth - vector3.X) - 4f); - } - if (((num2 + vector3.Y) + 4f) > screenHeight) - { - num2 = (int) ((screenHeight - vector3.Y) - 4f); - } - this.spriteBatch.DrawString(fontMouseText, cursorText, new Vector2((float) num, (float) (num2 - 2)), Color.Black, 0f, new Vector2(), (float) 1f, SpriteEffects.None, 0f); - this.spriteBatch.DrawString(fontMouseText, cursorText, new Vector2((float) num, (float) (num2 + 2)), Color.Black, 0f, new Vector2(), (float) 1f, SpriteEffects.None, 0f); - this.spriteBatch.DrawString(fontMouseText, cursorText, new Vector2((float) (num - 2), (float) num2), Color.Black, 0f, new Vector2(), (float) 1f, SpriteEffects.None, 0f); - this.spriteBatch.DrawString(fontMouseText, cursorText, new Vector2((float) (num + 2), (float) num2), Color.Black, 0f, new Vector2(), (float) 1f, SpriteEffects.None, 0f); - num3 = ((float) mouseTextColor) / 255f; - Color color3 = new Color((int) mouseTextColor, (int) mouseTextColor, (int) mouseTextColor, (int) mouseTextColor); - if (rare == 1) - { - color3 = new Color((int) ((byte) (150f * num3)), (int) ((byte) (150f * num3)), (int) ((byte) (255f * num3)), (int) mouseTextColor); - } - if (rare == 2) - { - color3 = new Color((int) ((byte) (150f * num3)), (int) ((byte) (255f * num3)), (int) ((byte) (150f * num3)), (int) mouseTextColor); - } - if (rare == 3) - { - color3 = new Color((int) ((byte) (255f * num3)), (int) ((byte) (200f * num3)), (int) ((byte) (150f * num3)), (int) mouseTextColor); - } - if (rare == 4) - { - color3 = new Color((int) ((byte) (255f * num3)), (int) ((byte) (150f * num3)), (int) ((byte) (150f * num3)), (int) mouseTextColor); - } - this.spriteBatch.DrawString(fontMouseText, cursorText, new Vector2((float) num, (float) num2), color3, 0f, new Vector2(), (float) 1f, SpriteEffects.None, 0f); - } - } - - public static void NewText(string newText, byte R = 0xff, byte G = 0xff, byte B = 0xff) - { - for (int i = numChatLines - 1; i > 0; i--) - { - chatLine[i].text = chatLine[i - 1].text; - chatLine[i].showTime = chatLine[i - 1].showTime; - chatLine[i].color = chatLine[i - 1].color; - } - if (((R == 0) && (G == 0)) && (B == 0)) - { - chatLine[0].color = Color.White; - } - else - { - chatLine[0].color = new Color(R, G, B); - } - chatLine[0].text = newText; - chatLine[0].showTime = chatLength; - PlaySound(12, -1, -1, 1); - } - - private static string nextLoadPlayer() - { - int num = 1; - Label_0008:; - if (System.IO.File.Exists(string.Concat(new object[] { PlayerPath, @"\player", num, ".plr" }))) - { - num++; - goto Label_0008; - } - return string.Concat(new object[] { PlayerPath, @"\player", num, ".plr" }); - } - - private static string nextLoadWorld() - { - int num = 1; - Label_0008:; - if (System.IO.File.Exists(string.Concat(new object[] { WorldPath, @"\world", num, ".wld" }))) - { - num++; - goto Label_0008; - } - return string.Concat(new object[] { WorldPath, @"\world", num, ".wld" }); - } - - protected void OpenSettings() - { - try - { - if (System.IO.File.Exists(SavePath + @"\config.dat")) - { - using (FileStream stream = new FileStream(SavePath + @"\config.dat", FileMode.Open)) - { - using (BinaryReader reader = new BinaryReader(stream)) - { - int num = reader.ReadInt32(); - bool flag = reader.ReadBoolean(); - mouseColor.R = reader.ReadByte(); - mouseColor.G = reader.ReadByte(); - mouseColor.B = reader.ReadByte(); - soundVolume = reader.ReadSingle(); - musicVolume = reader.ReadSingle(); - cUp = reader.ReadString(); - cDown = reader.ReadString(); - cLeft = reader.ReadString(); - cRight = reader.ReadString(); - cJump = reader.ReadString(); - cThrowItem = reader.ReadString(); - if (num >= 1) - { - cInv = reader.ReadString(); - } - caveParrallax = reader.ReadSingle(); - if (num >= 2) - { - fixedTiming = reader.ReadBoolean(); - } - reader.Close(); - if (flag && !this.graphics.IsFullScreen) - { - this.graphics.ToggleFullScreen(); - } - } - } - } - } - catch - { - } - } - - public static void PlaySound(int type, int x = -1, int y = -1, int style = 1) - { - if (soundVolume != 0f) - { - bool flag = false; - float num = 1f; - float num2 = 0f; - if ((x == -1) || (y == -1)) - { - flag = true; - } - else - { - if (WorldGen.gen) - { - return; - } - if (netMode == 2) - { - return; - } - Rectangle rectangle = new Rectangle(((int) screenPosition.X) - (screenWidth * 2), ((int) screenPosition.Y) - (screenHeight * 2), screenWidth * 5, screenHeight * 5); - Rectangle rectangle2 = new Rectangle(x, y, 1, 1); - Vector2 vector = new Vector2(screenPosition.X + (screenWidth * 0.5f), screenPosition.Y + (screenHeight * 0.5f)); - if (rectangle2.Intersects(rectangle)) - { - flag = true; - } - if (flag) - { - num2 = (x - vector.X) / (screenWidth * 0.5f); - float num3 = Math.Abs((float) (x - vector.X)); - float num4 = Math.Abs((float) (y - vector.Y)); - float num5 = (float) Math.Sqrt((double) ((num3 * num3) + (num4 * num4))); - num = 1f - (num5 / (screenWidth * 1.5f)); - } - } - if (num2 < -1f) - { - num2 = -1f; - } - if (num2 > 1f) - { - num2 = 1f; - } - if (num > 1f) - { - num = 1f; - } - if ((num > 0f) && flag) - { - num *= soundVolume; - if (type == 0) - { - int index = rand.Next(3); - soundInstanceDig[index].Stop(); - soundInstanceDig[index] = soundDig[index].CreateInstance(); - soundInstanceDig[index].Volume = num; - soundInstanceDig[index].Pan = num2; - soundInstanceDig[index].Play(); - } - else if (type == 1) - { - int num7 = rand.Next(3); - soundInstancePlayerHit[num7].Stop(); - soundInstancePlayerHit[num7] = soundPlayerHit[num7].CreateInstance(); - soundInstancePlayerHit[num7].Volume = num; - soundInstancePlayerHit[num7].Pan = num2; - soundInstancePlayerHit[num7].Play(); - } - else if (type == 2) - { - if ((style != 9) && (style != 10)) - { - soundInstanceItem[style].Stop(); - } - soundInstanceItem[style] = soundItem[style].CreateInstance(); - soundInstanceItem[style].Volume = num; - soundInstanceItem[style].Pan = num2; - soundInstanceItem[style].Play(); - } - else if (type == 3) - { - soundInstanceNPCHit[style].Stop(); - soundInstanceNPCHit[style] = soundNPCHit[style].CreateInstance(); - soundInstanceNPCHit[style].Volume = num; - soundInstanceNPCHit[style].Pan = num2; - soundInstanceNPCHit[style].Play(); - } - else if (type == 4) - { - soundInstanceNPCKilled[style] = soundNPCKilled[style].CreateInstance(); - soundInstanceNPCKilled[style].Volume = num; - soundInstanceNPCKilled[style].Pan = num2; - soundInstanceNPCKilled[style].Play(); - } - else if (type == 5) - { - soundInstancePlayerKilled.Stop(); - soundInstancePlayerKilled = soundPlayerKilled.CreateInstance(); - soundInstancePlayerKilled.Volume = num; - soundInstancePlayerKilled.Pan = num2; - soundInstancePlayerKilled.Play(); - } - else if (type == 6) - { - soundInstanceGrass.Stop(); - soundInstanceGrass = soundGrass.CreateInstance(); - soundInstanceGrass.Volume = num; - soundInstanceGrass.Pan = num2; - soundInstanceGrass.Play(); - } - else if (type == 7) - { - soundInstanceGrab.Stop(); - soundInstanceGrab = soundGrab.CreateInstance(); - soundInstanceGrab.Volume = num; - soundInstanceGrab.Pan = num2; - soundInstanceGrab.Play(); - } - else if (type == 8) - { - soundInstanceDoorOpen.Stop(); - soundInstanceDoorOpen = soundDoorOpen.CreateInstance(); - soundInstanceDoorOpen.Volume = num; - soundInstanceDoorOpen.Pan = num2; - soundInstanceDoorOpen.Play(); - } - else if (type == 9) - { - soundInstanceDoorClosed.Stop(); - soundInstanceDoorClosed = soundDoorClosed.CreateInstance(); - soundInstanceDoorClosed.Volume = num; - soundInstanceDoorClosed.Pan = num2; - soundInstanceDoorClosed.Play(); - } - else if (type == 10) - { - soundInstanceMenuOpen.Stop(); - soundInstanceMenuOpen = soundMenuOpen.CreateInstance(); - soundInstanceMenuOpen.Volume = num; - soundInstanceMenuOpen.Pan = num2; - soundInstanceMenuOpen.Play(); - } - else if (type == 11) - { - soundInstanceMenuClose.Stop(); - soundInstanceMenuClose = soundMenuClose.CreateInstance(); - soundInstanceMenuClose.Volume = num; - soundInstanceMenuClose.Pan = num2; - soundInstanceMenuClose.Play(); - } - else if (type == 12) - { - soundInstanceMenuTick.Stop(); - soundInstanceMenuTick = soundMenuTick.CreateInstance(); - soundInstanceMenuTick.Volume = num; - soundInstanceMenuTick.Pan = num2; - soundInstanceMenuTick.Play(); - } - else if (type == 13) - { - soundInstanceShatter.Stop(); - soundInstanceShatter = soundShatter.CreateInstance(); - soundInstanceShatter.Volume = num; - soundInstanceShatter.Pan = num2; - soundInstanceShatter.Play(); - } - else if (type == 14) - { - int num8 = rand.Next(3); - soundInstanceZombie[num8] = soundZombie[num8].CreateInstance(); - soundInstanceZombie[num8].Volume = num * 0.4f; - soundInstanceZombie[num8].Pan = num2; - soundInstanceZombie[num8].Play(); - } - else if (type == 15) - { - soundInstanceRoar[style] = soundRoar[style].CreateInstance(); - soundInstanceRoar[style].Volume = num; - soundInstanceRoar[style].Pan = num2; - soundInstanceRoar[style].Play(); - } - else if (type == 0x10) - { - soundInstanceDoubleJump.Stop(); - soundInstanceDoubleJump = soundDoubleJump.CreateInstance(); - soundInstanceDoubleJump.Volume = num; - soundInstanceDoubleJump.Pan = num2; - soundInstanceDoubleJump.Play(); - } - else if (type == 0x11) - { - soundInstanceRun.Stop(); - soundInstanceRun = soundRun.CreateInstance(); - soundInstanceRun.Volume = num; - soundInstanceRun.Pan = num2; - soundInstanceRun.Play(); - } - else if (type == 0x12) - { - soundInstanceCoins = soundCoins.CreateInstance(); - soundInstanceCoins.Volume = num; - soundInstanceCoins.Pan = num2; - soundInstanceCoins.Play(); - } - else if (type == 0x13) - { - soundInstanceSplash[style] = soundSplash[style].CreateInstance(); - soundInstanceSplash[style].Volume = num; - soundInstanceSplash[style].Pan = num2; - soundInstanceSplash[style].Play(); - } - else if (type == 20) - { - int num9 = rand.Next(3); - soundInstanceFemaleHit[num9].Stop(); - soundInstanceFemaleHit[num9] = soundFemaleHit[num9].CreateInstance(); - soundInstanceFemaleHit[num9].Volume = num; - soundInstanceFemaleHit[num9].Pan = num2; - soundInstanceFemaleHit[num9].Play(); - } - else if (type == 0x15) - { - int num10 = rand.Next(3); - soundInstanceTink[num10].Stop(); - soundInstanceTink[num10] = soundTink[num10].CreateInstance(); - soundInstanceTink[num10].Volume = num; - soundInstanceTink[num10].Pan = num2; - soundInstanceTink[num10].Play(); - } - } - } - } - - protected void QuitGame() - { - base.Exit(); - } - - [DllImport("User32")] - private static extern int RemoveMenu(IntPtr hMenu, int nPosition, int wFlags); - protected void SaveSettings() - { - Directory.CreateDirectory(SavePath); - try - { - System.IO.File.SetAttributes(SavePath + @"\config.dat", FileAttributes.Normal); - } - catch - { - } - try - { - using (FileStream stream = new FileStream(SavePath + @"\config.dat", FileMode.Create)) - { - using (BinaryWriter writer = new BinaryWriter(stream)) - { - writer.Write(curRelease); - writer.Write(this.graphics.IsFullScreen); - writer.Write(mouseColor.R); - writer.Write(mouseColor.G); - writer.Write(mouseColor.B); - writer.Write(soundVolume); - writer.Write(musicVolume); - writer.Write(cUp); - writer.Write(cDown); - writer.Write(cLeft); - writer.Write(cRight); - writer.Write(cJump); - writer.Write(cThrowItem); - writer.Write(cInv); - writer.Write(caveParrallax); - writer.Write(fixedTiming); - writer.Close(); - } - } - } - catch - { - } - } - - private static void StartInvasion() - { - if (WorldGen.shadowOrbSmashed && ((invasionType == 0) && (invasionDelay == 0))) - { - int num = 0; - for (int i = 0; i < 8; i++) - { - if (player[i].active) - { - num++; - } - } - if (num > 0) - { - invasionType = 1; - invasionSize = 100 + (ShankShock.invasionMultiplier * num); - invasionWarn = 0; - if (rand.Next(2) == 0) - { - invasionX = 0.0; - } - else - { - invasionX = maxTilesX; - } - } - } - } - - protected override void UnloadContent() - { - } - - protected override void Update(GameTime gameTime) - { - if (fixedTiming) - { - if (base.IsActive) - { - base.IsFixedTimeStep = false; - this.graphics.SynchronizeWithVerticalRetrace = true; - } - else - { - base.IsFixedTimeStep = true; - } - } - else - { - base.IsFixedTimeStep = true; - } - this.UpdateMusic(); - if (!showSplash) - { - if (!gameMenu && (Main.netMode != 2)) - { - saveTimer++; - if (saveTimer > 0x4650) - { - saveTimer = 0; - WorldGen.saveToonWhilePlaying(); - } - } - else - { - saveTimer = 0; - } - if (rand.Next(0x1869f) == 0) - { - rand = new Random((int) DateTime.Now.Ticks); - } - updateTime++; - if (updateTime >= 60) - { - frameRate = drawTime; - updateTime = 0; - drawTime = 0; - if (frameRate == 60) - { - Lighting.lightPasses = 2; - Lighting.lightSkip = 0; - cloudLimit = 100; - Gore.goreTime = 0x4b0; - } - else if (frameRate >= 0x3a) - { - Lighting.lightPasses = 2; - Lighting.lightSkip = 0; - cloudLimit = 100; - Gore.goreTime = 600; - } - else if (frameRate >= 0x2b) - { - Lighting.lightPasses = 2; - Lighting.lightSkip = 1; - cloudLimit = 0x4b; - Gore.goreTime = 300; - } - else if (frameRate >= 0x1c) - { - if (!gameMenu) - { - Liquid.maxLiquid = 0xbb8; - Liquid.cycles = 6; - } - Lighting.lightPasses = 2; - Lighting.lightSkip = 2; - cloudLimit = 50; - Gore.goreTime = 180; - } - else - { - Lighting.lightPasses = 2; - Lighting.lightSkip = 4; - cloudLimit = 0; - Gore.goreTime = 0; - } - if (Liquid.quickSettle) - { - Liquid.maxLiquid = Liquid.resLiquid; - Liquid.cycles = 1; - } - else if (frameRate == 60) - { - Liquid.maxLiquid = 0x1388; - Liquid.cycles = 7; - } - else if (frameRate >= 0x3a) - { - Liquid.maxLiquid = 0x1388; - Liquid.cycles = 12; - } - else if (frameRate >= 0x2b) - { - Liquid.maxLiquid = 0xfa0; - Liquid.cycles = 13; - } - else if (frameRate >= 0x1c) - { - Liquid.maxLiquid = 0xdac; - Liquid.cycles = 15; - } - else - { - Liquid.maxLiquid = 0xbb8; - Liquid.cycles = 0x11; - } - if (Main.netMode == 2) - { - cloudLimit = 0; - } - } - if (!base.IsActive) - { - hasFocus = false; - } - else - { - hasFocus = true; - } - if (!base.IsActive && (Main.netMode == 0)) - { - base.IsMouseVisible = true; - if ((Main.netMode != 2) && (myPlayer >= 0)) - { - player[myPlayer].delayUseItem = true; - } - mouseLeftRelease = false; - mouseRightRelease = false; - if (gameMenu) - { - UpdateMenu(); - } - } - else - { - base.IsMouseVisible = false; - if ((keyState.IsKeyDown(Keys.F10) && !chatMode) && !editSign) - { - if (frameRelease) - { - PlaySound(12, -1, -1, 1); - if (showFrameRate) - { - showFrameRate = false; - } - else - { - showFrameRate = true; - } - } - frameRelease = false; - } - else - { - frameRelease = true; - } - if (keyState.IsKeyDown(Keys.F11)) - { - if (releaseUI) - { - if (hideUI) - { - hideUI = false; - } - else - { - hideUI = true; - } - } - releaseUI = false; - } - else - { - releaseUI = true; - } - if ((keyState.IsKeyDown(Keys.LeftAlt) || keyState.IsKeyDown(Keys.RightAlt)) && keyState.IsKeyDown(Keys.Enter)) - { - if (this.toggleFullscreen) - { - this.graphics.ToggleFullScreen(); - chatRelease = false; - } - this.toggleFullscreen = false; - } - else - { - this.toggleFullscreen = true; - } - oldMouseState = mouseState; - mouseState = Mouse.GetState(); - keyState = Keyboard.GetState(); - if (editSign) - { - chatMode = false; - } - if (chatMode) - { - string chatText = Main.chatText; - Main.chatText = GetInputText(Main.chatText); - while (fontMouseText.MeasureString(Main.chatText).X > 470f) - { - Main.chatText = Main.chatText.Substring(0, Main.chatText.Length - 1); - } - if (chatText != Main.chatText) - { - PlaySound(12, -1, -1, 1); - } - if (inputTextEnter && chatRelease) - { - if (Main.chatText != "") - { - NetMessage.SendData(0x19, -1, -1, Main.chatText, myPlayer, 0f, 0f, 0f); - } - Main.chatText = ""; - chatMode = false; - chatRelease = false; - PlaySound(11, -1, -1, 1); - } - } - if (keyState.IsKeyDown(Keys.Enter) && (Main.netMode == 1)) - { - if ((chatRelease && !chatMode) && !editSign) - { - PlaySound(10, -1, -1, 1); - chatMode = true; - Main.chatText = ""; - } - chatRelease = false; - } - else - { - chatRelease = true; - } - if (gameMenu) - { - UpdateMenu(); - if (Main.netMode != 2) - { - return; - } - } - if (debugMode) - { - UpdateDebug(); - } - if (Main.netMode == 1) - { - for (int num = 0; num < 0x2c; num++) - { - if (player[myPlayer].inventory[num].IsNotTheSameAs(clientPlayer.inventory[num])) - { - NetMessage.SendData(5, -1, -1, player[myPlayer].inventory[num].name, myPlayer, (float) num, 0f, 0f); - } - } - if (player[myPlayer].armor[0].IsNotTheSameAs(clientPlayer.armor[0])) - { - NetMessage.SendData(5, -1, -1, player[myPlayer].armor[0].name, myPlayer, 44f, 0f, 0f); - } - if (player[myPlayer].armor[1].IsNotTheSameAs(clientPlayer.armor[1])) - { - NetMessage.SendData(5, -1, -1, player[myPlayer].armor[1].name, myPlayer, 45f, 0f, 0f); - } - if (player[myPlayer].armor[2].IsNotTheSameAs(clientPlayer.armor[2])) - { - NetMessage.SendData(5, -1, -1, player[myPlayer].armor[2].name, myPlayer, 46f, 0f, 0f); - } - if (player[myPlayer].armor[3].IsNotTheSameAs(clientPlayer.armor[3])) - { - NetMessage.SendData(5, -1, -1, player[myPlayer].armor[3].name, myPlayer, 47f, 0f, 0f); - } - if (player[myPlayer].armor[4].IsNotTheSameAs(clientPlayer.armor[4])) - { - NetMessage.SendData(5, -1, -1, player[myPlayer].armor[4].name, myPlayer, 48f, 0f, 0f); - } - if (player[myPlayer].armor[5].IsNotTheSameAs(clientPlayer.armor[5])) - { - NetMessage.SendData(5, -1, -1, player[myPlayer].armor[5].name, myPlayer, 49f, 0f, 0f); - } - if (player[myPlayer].chest != clientPlayer.chest) - { - NetMessage.SendData(0x21, -1, -1, "", player[myPlayer].chest, 0f, 0f, 0f); - } - if (player[myPlayer].talkNPC != clientPlayer.talkNPC) - { - NetMessage.SendData(40, -1, -1, "", myPlayer, 0f, 0f, 0f); - } - if (player[myPlayer].zoneEvil != clientPlayer.zoneEvil) - { - NetMessage.SendData(0x24, -1, -1, "", myPlayer, 0f, 0f, 0f); - } - if (player[myPlayer].zoneMeteor != clientPlayer.zoneMeteor) - { - NetMessage.SendData(0x24, -1, -1, "", myPlayer, 0f, 0f, 0f); - } - if (player[myPlayer].zoneDungeon != clientPlayer.zoneDungeon) - { - NetMessage.SendData(0x24, -1, -1, "", myPlayer, 0f, 0f, 0f); - } - if (player[myPlayer].zoneJungle != clientPlayer.zoneJungle) - { - NetMessage.SendData(0x24, -1, -1, "", myPlayer, 0f, 0f, 0f); - } - } - if (Main.netMode == 1) - { - clientPlayer = (Player) player[myPlayer].clientClone(); - } - for (int i = 0; i < 8; i++) - { - if (ignoreErrors) - { - try - { - player[i].UpdatePlayer(i); - } - catch - { - } - } - else - { - player[i].UpdatePlayer(i); - } - } - if (Main.netMode != 1) - { - NPC.SpawnNPC(); - } - for (int j = 0; j < 8; j++) - { - player[j].activeNPCs = 0; - player[j].townNPCs = 0; - } - for (int k = 0; k < 0x3e8; k++) - { - if (ignoreErrors) - { - try - { - npc[k].UpdateNPC(k); - } - catch - { - npc[k] = new NPC(); - } - } - else - { - npc[k].UpdateNPC(k); - } - } - for (int m = 0; m < 200; m++) - { - if (ignoreErrors) - { - try - { - gore[m].Update(); - } - catch - { - gore[m] = new Gore(); - } - } - else - { - gore[m].Update(); - } - } - for (int n = 0; n < 0x3e8; n++) - { - if (ignoreErrors) - { - try - { - projectile[n].Update(n); - } - catch - { - projectile[n] = new Projectile(); - } - } - else - { - projectile[n].Update(n); - } - } - for (int num7 = 0; num7 < 200; num7++) - { - if (ignoreErrors) - { - try - { - item[num7].UpdateItem(num7); - } - catch - { - item[num7] = new Item(); - } - } - else - { - item[num7].UpdateItem(num7); - } - } - if (ignoreErrors) - { - try - { - Dust.UpdateDust(); - } - catch - { - for (int num8 = 0; num8 < 0x7d0; num8++) - { - dust[num8] = new Dust(); - } - } - } - else - { - Dust.UpdateDust(); - } - if (Main.netMode != 2) - { - CombatText.UpdateCombatText(); - } - if (ignoreErrors) - { - try - { - UpdateTime(); - } - catch - { - checkForSpawns = 0; - } - } - else - { - UpdateTime(); - } - if (Main.netMode != 1) - { - if (ignoreErrors) - { - try - { - WorldGen.UpdateWorld(); - UpdateInvasion(); - } - catch - { - } - } - else - { - WorldGen.UpdateWorld(); - UpdateInvasion(); - } - } - if (ignoreErrors) - { - try - { - if (Main.netMode == 2) - { - UpdateServer(); - } - if (Main.netMode == 1) - { - UpdateClient(); - } - } - catch - { - int netMode = Main.netMode; - } - } - else - { - if (Main.netMode == 2) - { - UpdateServer(); - } - if (Main.netMode == 1) - { - UpdateClient(); - if (this.graphics.PreferredBackBufferHeight == 600) - { - this.QuitGame(); - } - if (this.graphics.PreferredBackBufferWidth == 800) - { - this.QuitGame(); - } - } - } - if (ignoreErrors) - { - try - { - for (int num9 = 0; num9 < numChatLines; num9++) - { - if (chatLine[num9].showTime > 0) - { - ChatLine line1 = chatLine[num9]; - line1.showTime--; - } - } - } - catch - { - for (int num10 = 0; num10 < numChatLines; num10++) - { - chatLine[num10] = new ChatLine(); - } - } - } - else - { - for (int num11 = 0; num11 < numChatLines; num11++) - { - if (chatLine[num11].showTime > 0) - { - ChatLine line2 = chatLine[num11]; - line2.showTime--; - } - } - } - base.Update(gameTime); - } - } - } - - private static void UpdateClient() - { - if (myPlayer == 8) - { - Netplay.disconnect = true; - } - netPlayCounter++; - if (netPlayCounter > 0xe10) - { - netPlayCounter = 0; - } - if (Math.IEEERemainder((double) netPlayCounter, 300.0) == 0.0) - { - NetMessage.SendData(13, -1, -1, "", myPlayer, 0f, 0f, 0f); - NetMessage.SendData(0x24, -1, -1, "", myPlayer, 0f, 0f, 0f); - } - if (Math.IEEERemainder((double) netPlayCounter, 600.0) == 0.0) - { - NetMessage.SendData(0x10, -1, -1, "", myPlayer, 0f, 0f, 0f); - NetMessage.SendData(40, -1, -1, "", myPlayer, 0f, 0f, 0f); - } - if (Netplay.clientSock.active) - { - Netplay.clientSock.timeOut++; - if (!stopTimeOuts && (Netplay.clientSock.timeOut > (60 * timeOut))) - { - statusText = "Connection timed out"; - Netplay.disconnect = true; - } - } - for (int i = 0; i < 200; i++) - { - if (item[i].active && (item[i].owner == myPlayer)) - { - item[i].FindOwner(i); - } - } - } - - private static void UpdateDebug() - { - if (netMode != 2) - { - if (keyState.IsKeyDown(Keys.Left)) - { - screenPosition.X -= 32f; - } - if (keyState.IsKeyDown(Keys.Right)) - { - screenPosition.X += 32f; - } - if (keyState.IsKeyDown(Keys.Up)) - { - screenPosition.Y -= 32f; - } - if (keyState.IsKeyDown(Keys.Down)) - { - screenPosition.Y += 32f; - } - int i = 0; - int j = 0; - i = (int) ((mouseState.X + screenPosition.X) / 16f); - j = (int) ((mouseState.Y + screenPosition.Y) / 16f); - if ((((mouseState.X < screenWidth) && (mouseState.Y < screenHeight)) && ((i >= 0) && (j >= 0))) && ((i < maxTilesX) && (j < maxTilesY))) - { - Lighting.addLight(i, j, 1f); - if (mouseState.RightButton == ButtonState.Pressed) - { - ButtonState leftButton = mouseState.LeftButton; - } - if (mouseState.RightButton == ButtonState.Pressed) - { - int myPlayer = Main.myPlayer; - if (player[myPlayer].active) - { - player[myPlayer].position.X = i * 0x10; - player[myPlayer].position.Y = j * 0x10; - player[myPlayer].fallStart = (int) (player[myPlayer].position.Y / 16f); - NetMessage.SendData(13, -1, -1, "", myPlayer, 0f, 0f, 0f); - } - for (int k = -1; k < 2; k++) - { - for (int m = -1; m < 2; m++) - { - } - } - } - else if (mouseState.LeftButton == ButtonState.Pressed) - { - for (int n = -5; n <= 5; n++) - { - for (int num7 = 5; num7 >= -5; num7--) - { - if (netMode != 1) - { - Liquid.AddWater(i + n, j + num7); - } - } - } - } - } - } - } - - private static void UpdateInvasion() - { - if (invasionType > 0) - { - if (invasionSize <= 0) - { - InvasionWarning(); - invasionType = 0; - invasionDelay = 7; - } - if (invasionX != spawnTileX) - { - float num = 0.2f; - if (invasionX > spawnTileX) - { - invasionX -= num; - if (invasionX <= spawnTileX) - { - invasionX = spawnTileX; - InvasionWarning(); - } - else - { - invasionWarn--; - } - } - else if (invasionX < spawnTileX) - { - invasionX += num; - if (invasionX >= spawnTileX) - { - invasionX = spawnTileX; - InvasionWarning(); - } - else - { - invasionWarn--; - } - } - if (invasionWarn <= 0) - { - invasionWarn = 0xe10; - InvasionWarning(); - } - } - } - } - - private static void UpdateMenu() - { - playerInventory = false; - exitScale = 0.8f; - if (netMode == 0) - { - if (!grabSky) - { - time += 86.4; - if (dayTime) - { - if (time > 54000.0) - { - time = 0.0; - dayTime = false; - } - } - else if (time > 32400.0) - { - bloodMoon = false; - time = 0.0; - dayTime = true; - moonPhase++; - if (moonPhase >= 8) - { - moonPhase = 0; - } - } - } - } - else if (netMode == 1) - { - UpdateTime(); - } - } - - protected void UpdateMusic() - { - if (this.curMusic > 0) - { - if (!base.IsActive) - { - if (!music[this.curMusic].IsPaused && music[this.curMusic].IsPlaying) - { - music[this.curMusic].Pause(); - } - return; - } - if (music[this.curMusic].IsPaused) - { - music[this.curMusic].Resume(); - } - } - bool flag = false; - Rectangle rectangle = new Rectangle((int) screenPosition.X, (int) screenPosition.Y, screenWidth, screenHeight); - int num = 0x1388; - for (int i = 0; i < 0x3e8; i++) - { - if (npc[i].active && (((npc[i].boss || (npc[i].type == 13)) || ((npc[i].type == 14) || (npc[i].type == 15))) || (((npc[i].type == 0x1a) || (npc[i].type == 0x1b)) || ((npc[i].type == 0x1c) || (npc[i].type == 0x1d))))) - { - Rectangle rectangle2 = new Rectangle((((int) npc[i].position.X) + (npc[i].width / 2)) - num, (((int) npc[i].position.Y) + (npc[i].height / 2)) - num, num * 2, num * 2); - if (rectangle.Intersects(rectangle2)) - { - flag = true; - break; - } - } - } - if (musicVolume == 0f) - { - this.newMusic = 0; - } - else if (gameMenu) - { - if (netMode != 2) - { - this.newMusic = 6; - } - else - { - this.newMusic = 0; - } - } - else if (flag) - { - this.newMusic = 5; - } - else if ((player[myPlayer].zoneEvil || player[myPlayer].zoneMeteor) || player[myPlayer].zoneDungeon) - { - this.newMusic = 2; - } - else if (player[myPlayer].position.Y > ((maxTilesY - 200) * 0x10)) - { - this.newMusic = 2; - } - else if (player[myPlayer].position.Y > ((worldSurface * 16.0) + screenHeight)) - { - this.newMusic = 4; - } - else if (dayTime) - { - this.newMusic = 1; - } - else if (!dayTime) - { - if (bloodMoon) - { - this.newMusic = 2; - } - else - { - this.newMusic = 3; - } - } - this.curMusic = this.newMusic; - for (int j = 1; j < 7; j++) - { - if (j == this.curMusic) - { - if (!music[j].IsPlaying) - { - music[j] = soundBank.GetCue("Music_" + j); - music[j].Play(); - music[j].SetVariable("Volume", musicFade[j] * musicVolume); - } - else - { - musicFade[j] += 0.005f; - if (musicFade[j] > 1f) - { - musicFade[j] = 1f; - } - music[j].SetVariable("Volume", musicFade[j] * musicVolume); - } - } - else if (music[j].IsPlaying) - { - if (musicFade[this.curMusic] > 0.25f) - { - musicFade[j] -= 0.005f; - } - else if (this.curMusic == 0) - { - musicFade[j] = 0f; - } - if (musicFade[j] <= 0f) - { - musicFade[j] -= 0f; - music[j].Stop(AudioStopOptions.Immediate); - } - else - { - music[j].SetVariable("Volume", musicFade[j] * musicVolume); - } - } - else - { - musicFade[j] = 0f; - } - } - } - - private static void UpdateServer() - { - netPlayCounter++; - if (netPlayCounter > 0xe10) - { - NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f); - NetMessage.syncPlayers(); - netPlayCounter = 0; - } - Math.IEEERemainder((double) netPlayCounter, 60.0); - if (Math.IEEERemainder((double) netPlayCounter, 360.0) == 0.0) - { - bool flag2 = true; - int lastItemUpdate = Main.lastItemUpdate; - int num4 = 0; - while (flag2) - { - lastItemUpdate++; - if (lastItemUpdate >= 200) - { - lastItemUpdate = 0; - } - num4++; - if (!item[lastItemUpdate].active || (item[lastItemUpdate].owner == 8)) - { - NetMessage.SendData(0x15, -1, -1, "", lastItemUpdate, 0f, 0f, 0f); - } - if ((num4 >= maxItemUpdates) || (lastItemUpdate == Main.lastItemUpdate)) - { - flag2 = false; - } - } - Main.lastItemUpdate = lastItemUpdate; - } - for (int i = 0; i < 200; i++) - { - if (item[i].active && ((item[i].owner == 8) || !player[item[i].owner].active)) - { - item[i].FindOwner(i); - } - } - for (int j = 0; j < 8; j++) - { - if (Netplay.serverSock[j].active) - { - ServerSock sock1 = Netplay.serverSock[j]; - sock1.timeOut++; - if (!stopTimeOuts && (Netplay.serverSock[j].timeOut > (60 * timeOut))) - { - Netplay.serverSock[j].kill = true; - } - } - if (player[j].active) - { - int sectionX = Netplay.GetSectionX((int) (player[j].position.X / 16f)); - int sectionY = Netplay.GetSectionY((int) (player[j].position.Y / 16f)); - int num9 = 0; - for (int k = sectionX - 1; k < (sectionX + 2); k++) - { - for (int m = sectionY - 1; m < (sectionY + 2); m++) - { - if ((((k >= 0) && (k < maxSectionsX)) && ((m >= 0) && (m < maxSectionsY))) && !Netplay.serverSock[j].tileSection[k, m]) - { - num9++; - } - } - } - if (num9 > 0) - { - int number = num9 * 150; - NetMessage.SendData(9, j, -1, "Recieving tile data", number, 0f, 0f, 0f); - Netplay.serverSock[j].statusText2 = "is recieving tile data"; - ServerSock sock2 = Netplay.serverSock[j]; - sock2.statusMax += number; - for (int n = sectionX - 1; n < (sectionX + 2); n++) - { - for (int num14 = sectionY - 1; num14 < (sectionY + 2); num14++) - { - if ((((n >= 0) && (n < maxSectionsX)) && ((num14 >= 0) && (num14 < maxSectionsY))) && !Netplay.serverSock[j].tileSection[n, num14]) - { - NetMessage.SendSection(j, n, num14); - NetMessage.SendData(11, j, -1, "", n, (float) num14, (float) n, (float) num14); - } - } - } - } - } - } - } - - public static void startInv() - { - invasionDelay = 0; - invasionType = 0; - WorldGen.shadowOrbSmashed = true; - StartInvasion(); - } - - public static void UpdateT() - { - UpdateTime(); - } - - private static void UpdateTime() - { - bool flag; - time++; - if (dayTime) - { - if (time <= 54000.0) - { - goto Label_0380; - } - WorldGen.spawnNPC = 0; - checkForSpawns = 0; - if (((rand.Next(50) == 0) && (netMode != 1)) && WorldGen.shadowOrbSmashed) - { - WorldGen.spawnMeteor = true; - } - if (NPC.downedBoss1 || (netMode == 1)) - { - goto Label_0293; - } - flag = false; - for (int i = 0; i < 8; i++) - { - if (player[i].active && (player[i].statLifeMax >= 200)) - { - flag = true; - break; - } - } - } - else - { - if ((WorldGen.spawnEye && (netMode != 1)) && (time > 4860.0)) - { - for (int j = 0; j < 8; j++) - { - if ((player[j].active && !player[j].dead) && (player[j].position.Y < (worldSurface * 16.0))) - { - NPC.SpawnOnPlayer(j, 4); - WorldGen.spawnEye = false; - break; - } - } - } - if (time > 32400.0) - { - if (invasionDelay > 0) - { - invasionDelay--; - } - WorldGen.spawnNPC = 0; - checkForSpawns = 0; - time = 0.0; - bloodMoon = false; - dayTime = true; - moonPhase++; - if (moonPhase >= 8) - { - moonPhase = 0; - } - if (netMode == 2) - { - NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f); - WorldGen.saveAndPlay(); - } - if ((netMode != 1) && (rand.Next(15) == 0)) - { - StartInvasion(); - } - } - if ((time > 16200.0) && WorldGen.spawnMeteor) - { - WorldGen.spawnMeteor = false; - WorldGen.dropMeteor(); - } - return; - } - if (flag && (rand.Next(3) == 0)) - { - int num3 = 0; - for (int k = 0; k < 0x3e8; k++) - { - if (npc[k].active && npc[k].townNPC) - { - num3++; - } - } - if (num3 >= 4) - { - WorldGen.spawnEye = true; - if (netMode == 0) - { - NewText("You feel an evil presence watching you...", 50, 0xff, 130); - } - else if (netMode == 2) - { - NetMessage.SendData(0x19, -1, -1, "You feel an evil presence watching you...", 8, 50f, 255f, 130f); - } - } - } - Label_0293: - if (((moonPhase != 4)) && ((rand.Next(7) == 0) && (netMode != 1))) - { - for (int m = 0; m < 8; m++) - { - if (player[m].active && (player[m].statLifeMax > 100)) - { - bloodMoon = true; - break; - } - } - } - if (bloodMoon) - { - if (netMode == 0) - { - NewText("The Blood Moon is rising...", 50, 0xff, 130); - } - else if (netMode == 2) - { - NetMessage.SendData(0x19, -1, -1, "The Blood Moon is rising...", 8, 50f, 255f, 130f); - } - } - time = 0.0; - dayTime = false; - if (netMode == 2) - { - NetMessage.SendData(7, -1, -1, "", 0, 0f, 0f, 0f); - } - Label_0380: - if (netMode != 1) - { - checkForSpawns++; - if (checkForSpawns >= 0x1c20) - { - int num6 = 0; - for (int n = 0; n < 8; n++) - { - if (player[n].active) - { - num6++; - } - } - checkForSpawns = 0; - WorldGen.spawnNPC = 0; - int num8 = 0; - int num9 = 0; - int num10 = 0; - int num11 = 0; - int num12 = 0; - int num13 = 0; - int num14 = 0; - int num15 = 0; - for (int num16 = 0; num16 < 0x3e8; num16++) - { - if (npc[num16].active && npc[num16].townNPC) - { - if ((npc[num16].type != 0x25) && !npc[num16].homeless) - { - WorldGen.QuickFindHome(num16); - } - else - { - num13++; - } - if (npc[num16].type == 0x11) - { - num8++; - } - if (npc[num16].type == 0x12) - { - num9++; - } - if (npc[num16].type == 0x13) - { - num11++; - } - if (npc[num16].type == 20) - { - num10++; - } - if (npc[num16].type == 0x16) - { - num12++; - } - if (npc[num16].type == 0x26) - { - num14++; - } - num15++; - } - } - if (WorldGen.spawnNPC == 0) - { - int num17 = 0; - bool flag2 = false; - int num18 = 0; - bool flag3 = false; - bool flag4 = false; - for (int num19 = 0; num19 < 8; num19++) - { - if (player[num19].active) - { - for (int num20 = 0; num20 < 0x2c; num20++) - { - if ((player[num19].inventory[num20] != null) & (player[num19].inventory[num20].stack > 0)) - { - if (player[num19].inventory[num20].type == 0x47) - { - num17 += player[num19].inventory[num20].stack; - } - if (player[num19].inventory[num20].type == 0x48) - { - num17 += player[num19].inventory[num20].stack * 100; - } - if (player[num19].inventory[num20].type == 0x49) - { - num17 += player[num19].inventory[num20].stack * 0x2710; - } - if (player[num19].inventory[num20].type == 0x4a) - { - num17 += player[num19].inventory[num20].stack * 0xf4240; - } - if (((player[num19].inventory[num20].type == 0x5f) || (player[num19].inventory[num20].type == 0x60)) || (((player[num19].inventory[num20].type == 0x61) || (player[num19].inventory[num20].type == 0x62)) || (player[num19].inventory[num20].useAmmo == 14))) - { - flag3 = true; - } - if ((player[num19].inventory[num20].type == 0xa6) || (player[num19].inventory[num20].type == 0xa7)) - { - flag4 = true; - } - } - } - int num21 = player[num19].statLifeMax / 20; - if (num21 > 5) - { - flag2 = true; - } - num18 += num21; - } - } - if ((WorldGen.spawnNPC == 0) && (num12 < 1)) - { - WorldGen.spawnNPC = 0x16; - } - if (((WorldGen.spawnNPC == 0) && (num17 > 5000.0)) && (num8 < 1)) - { - WorldGen.spawnNPC = 0x11; - } - if (((WorldGen.spawnNPC == 0) && flag2) && (num9 < 1)) - { - WorldGen.spawnNPC = 0x12; - } - if (((WorldGen.spawnNPC == 0) && flag3) && (num11 < 1)) - { - WorldGen.spawnNPC = 0x13; - } - if (((WorldGen.spawnNPC == 0) && ((NPC.downedBoss1 || NPC.downedBoss2) || NPC.downedBoss3)) && (num10 < 1)) - { - WorldGen.spawnNPC = 20; - } - if (((WorldGen.spawnNPC == 0) && flag4) && ((num8 > 0) && (num14 < 1))) - { - WorldGen.spawnNPC = 0x26; - } - if (((WorldGen.spawnNPC == 0) && (num17 > 0x186a0)) && ((num8 < 2) && (num6 > 2))) - { - WorldGen.spawnNPC = 0x11; - } - if (((WorldGen.spawnNPC == 0) && (num18 >= 20)) && ((num9 < 2) && (num6 > 2))) - { - WorldGen.spawnNPC = 0x12; - } - if (((WorldGen.spawnNPC == 0) && (num17 > 0x4c4b40)) && ((num8 < 3) && (num6 > 4))) - { - WorldGen.spawnNPC = 0x11; - } - if (!NPC.downedBoss3 && (num13 == 0)) - { - int index = NPC.NewNPC((dungeonX * 0x10) + 8, dungeonY * 0x10, 0x25, 0); - npc[index].homeless = false; - npc[index].homeTileX = dungeonX; - npc[index].homeTileY = dungeonY; - } - } - } - } - } - } -} - diff --git a/Terraria/NPC.cs b/Terraria/NPC.cs deleted file mode 100644 index c948c67f..00000000 --- a/Terraria/NPC.cs +++ /dev/null @@ -1,6233 +0,0 @@ -namespace Terraria -{ - using Microsoft.Xna.Framework; - using System; - using System.Runtime.InteropServices; - - public class NPC - { - public bool active; - private static int activeRangeX = (Main.screenWidth * 2); - private static int activeRangeY = (Main.screenHeight * 2); - private static int activeTime = 0x3e8; - - public int aiAction; - public int aiStyle; - public int alpha; - public bool behindTiles; - public bool boss; - public bool closeDoor; - public bool collideX; - public bool collideY; - public Color color; - public int damage; - private static int defaultMaxSpawns = ShankShock.defaultMaxSpawns; - private static int defaultSpawnRate = ShankShock.defaultSpawnRate; - public int defense; - public int direction = 1; - public int directionY = 1; - public int doorX; - public int doorY; - public static bool downedBoss1 = false; - public static bool downedBoss2 = false; - public static bool downedBoss3 = false; - public Rectangle frame; - public double frameCounter; - public bool friendly; - public int friendlyRegen; - public int height; - public bool homeless; - public int homeTileX = -1; - public int homeTileY = -1; - public int[] immune = new int[9]; - public static int immuneTime = 20; - public float knockBackResist = 1f; - public bool lavaWet; - public int life; - public int lifeMax; - public static int maxAI = 4; - private static int maxSpawns = defaultMaxSpawns; - public string name; - public bool netUpdate; - public bool noGravity; - public bool noTileCollide; - public int oldDirection; - public int oldDirectionY; - public Vector2 oldPosition; - public int oldTarget; - public Vector2 oldVelocity; - public Vector2 position; - public float rotation; - public static int safeRangeX = ((int) ((Main.screenWidth / 0x10) * 0.55)); - public static int safeRangeY = ((int) ((Main.screenHeight / 0x10) * 0.55)); - public float scale = 1f; - public int soundDelay; - public int soundHit; - public int soundKilled; - private static int spawnRangeX = ((int) ((Main.screenWidth / 0x10) * 1.2)); - private static int spawnRangeY = ((int) ((Main.screenHeight / 0x10) * 1.2)); - private static int spawnRate = defaultSpawnRate; - private static int spawnSpaceX = 4; - private static int spawnSpaceY = 4; - public int spriteDirection = -1; - public int target = -1; - public Rectangle targetRect; - public int timeLeft; - public bool townNPC; - private static int townRangeX = (Main.screenWidth * 3); - private static int townRangeY = (Main.screenHeight * 3); - public int type; - public float value; - public Vector2 velocity; - public bool wet; - public byte wetCount; - public int whoAmI; - public int width; - public float[] ai = new float[maxAI]; - public void AI() - { - int num66; - int num67; - bool flag7; - bool flag8; - Color color; - if (this.aiStyle == 0) - { - this.velocity.X *= 0.93f; - if ((this.velocity.X > -0.1) && (this.velocity.X < 0.1)) - { - this.velocity.X = 0f; - return; - } - return; - } - if (this.aiStyle == 1) - { - this.aiAction = 0; - if (this.ai[2] == 0f) - { - this.ai[0] = -100f; - this.ai[2] = 1f; - this.TargetClosest(); - } - if (this.velocity.Y != 0f) - { - if ((this.target < 8) && (((this.direction == 1) && (this.velocity.X < 3f)) || ((this.direction == -1) && (this.velocity.X > -3f)))) - { - if (((this.direction == -1) && (this.velocity.X < 0.1)) || ((this.direction == 1) && (this.velocity.X > -0.1))) - { - this.velocity.X += 0.2f * this.direction; - return; - } - this.velocity.X *= 0.93f; - return; - } - } - else - { - if (this.ai[3] == this.position.X) - { - this.direction *= -1; - } - this.ai[3] = 0f; - this.velocity.X *= 0.8f; - if ((this.velocity.X > -0.1) && (this.velocity.X < 0.1)) - { - this.velocity.X = 0f; - } - if ((!Main.dayTime || (this.life != this.lifeMax)) || (this.position.Y > (Main.worldSurface * 16.0))) - { - this.ai[0]++; - } - this.ai[0]++; - if (this.ai[0] >= 0f) - { - if ((!Main.dayTime || (this.life != this.lifeMax)) || (this.position.Y > (Main.worldSurface * 16.0))) - { - this.TargetClosest(); - } - if (this.ai[1] == 2f) - { - this.velocity.Y = -8f; - this.velocity.X += 3 * this.direction; - this.ai[0] = -200f; - this.ai[1] = 0f; - this.ai[3] = this.position.X; - return; - } - this.velocity.Y = -6f; - this.velocity.X += 2 * this.direction; - this.ai[0] = -120f; - this.ai[1]++; - return; - } - if (this.ai[0] >= -30f) - { - this.aiAction = 1; - return; - } - } - return; - } - if (this.aiStyle == 2) - { - this.noGravity = true; - if (this.collideX) - { - this.velocity.X = this.oldVelocity.X * -0.5f; - if (((this.direction == -1) && (this.velocity.X > 0f)) && (this.velocity.X < 2f)) - { - this.velocity.X = 2f; - } - if (((this.direction == 1) && (this.velocity.X < 0f)) && (this.velocity.X > -2f)) - { - this.velocity.X = -2f; - } - } - if (this.collideY) - { - this.velocity.Y = this.oldVelocity.Y * -0.5f; - if ((this.velocity.Y > 0f) && (this.velocity.Y < 1f)) - { - this.velocity.Y = 1f; - } - if ((this.velocity.Y < 0f) && (this.velocity.Y > -1f)) - { - this.velocity.Y = -1f; - } - } - if ((Main.dayTime && (this.position.Y <= (Main.worldSurface * 16.0))) && (this.type == 2)) - { - if (this.timeLeft > 10) - { - this.timeLeft = 10; - } - this.directionY = -1; - if (this.velocity.Y > 0f) - { - this.direction = 1; - } - this.direction = -1; - if (this.velocity.X > 0f) - { - this.direction = 1; - } - } - else - { - this.TargetClosest(); - } - if ((this.direction == -1) && (this.velocity.X > -4f)) - { - this.velocity.X -= 0.1f; - if (this.velocity.X > 4f) - { - this.velocity.X -= 0.1f; - } - else if (this.velocity.X > 0f) - { - this.velocity.X += 0.05f; - } - if (this.velocity.X < -4f) - { - this.velocity.X = -4f; - } - } - else if ((this.direction == 1) && (this.velocity.X < 4f)) - { - this.velocity.X += 0.1f; - if (this.velocity.X < -4f) - { - this.velocity.X += 0.1f; - } - else if (this.velocity.X < 0f) - { - this.velocity.X -= 0.05f; - } - if (this.velocity.X > 4f) - { - this.velocity.X = 4f; - } - } - if ((this.directionY == -1) && (this.velocity.Y > -1.5)) - { - this.velocity.Y -= 0.04f; - if (this.velocity.Y > 1.5) - { - this.velocity.Y -= 0.05f; - } - else if (this.velocity.Y > 0f) - { - this.velocity.Y += 0.03f; - } - if (this.velocity.Y < -1.5) - { - this.velocity.Y = -1.5f; - } - } - else if ((this.directionY == 1) && (this.velocity.Y < 1.5)) - { - this.velocity.Y += 0.04f; - if (this.velocity.Y < -1.5) - { - this.velocity.Y += 0.05f; - } - else if (this.velocity.Y < 0f) - { - this.velocity.Y -= 0.03f; - } - if (this.velocity.Y > 1.5) - { - this.velocity.Y = 1.5f; - } - } - if ((this.type == 2) && (Main.rand.Next(40) == 0)) - { - int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (this.height * 0.25f)), this.width, (int) (this.height * 0.5f), 5, this.velocity.X, 2f, 0, new Color(), 1f); - Main.dust[index].velocity.X *= 0.5f; - Main.dust[index].velocity.Y *= 0.1f; - return; - } - return; - } - if (this.aiStyle == 3) - { - int num2 = 60; - bool flag = false; - if ((this.velocity.Y == 0f) && (((this.velocity.X > 0f) && (this.direction < 0)) || ((this.velocity.X < 0f) && (this.direction > 0)))) - { - flag = true; - } - if (((this.position.X == this.oldPosition.X) || (this.ai[3] >= num2)) || flag) - { - this.ai[3]++; - } - else if ((Math.Abs(this.velocity.X) > 0.9) && (this.ai[3] > 0f)) - { - this.ai[3]--; - } - if (this.ai[3] > (num2 * 10)) - { - this.ai[3] = 0f; - } - if (this.ai[3] == num2) - { - this.netUpdate = true; - } - if ((((!Main.dayTime || (this.position.Y > (Main.worldSurface * 16.0))) || ((this.type == 0x1a) || (this.type == 0x1b))) || ((this.type == 0x1c) || (this.type == 0x1f))) && (this.ai[3] < num2)) - { - if ((((this.type == 3) || (this.type == 0x15)) || (this.type == 0x1f)) && (Main.rand.Next(0x3e8) == 0)) - { - Main.PlaySound(14, (int) this.position.X, (int) this.position.Y, 1); - } - this.TargetClosest(); - } - else - { - if (this.timeLeft > 10) - { - this.timeLeft = 10; - } - if (this.velocity.X == 0f) - { - if (this.velocity.Y == 0f) - { - this.ai[0]++; - if (this.ai[0] >= 2f) - { - this.direction *= -1; - this.spriteDirection = this.direction; - this.ai[0] = 0f; - } - } - } - else - { - this.ai[0] = 0f; - } - if (this.direction == 0) - { - this.direction = 1; - } - } - if (this.type == 0x1b) - { - if ((this.velocity.X < -2f) || (this.velocity.X > 2f)) - { - if (this.velocity.Y == 0f) - { - this.velocity = (Vector2) (this.velocity * 0.8f); - } - } - else if ((this.velocity.X < 2f) && (this.direction == 1)) - { - this.velocity.X += 0.07f; - if (this.velocity.X > 2f) - { - this.velocity.X = 2f; - } - } - else if ((this.velocity.X > -2f) && (this.direction == -1)) - { - this.velocity.X -= 0.07f; - if (this.velocity.X < -2f) - { - this.velocity.X = -2f; - } - } - } - else if (((this.type == 0x15) || (this.type == 0x1a)) || (this.type == 0x1f)) - { - if ((this.velocity.X < -1.5f) || (this.velocity.X > 1.5f)) - { - if (this.velocity.Y == 0f) - { - this.velocity = (Vector2) (this.velocity * 0.8f); - } - } - else if ((this.velocity.X < 1.5f) && (this.direction == 1)) - { - this.velocity.X += 0.07f; - if (this.velocity.X > 1.5f) - { - this.velocity.X = 1.5f; - } - } - else if ((this.velocity.X > -1.5f) && (this.direction == -1)) - { - this.velocity.X -= 0.07f; - if (this.velocity.X < -1.5f) - { - this.velocity.X = -1.5f; - } - } - } - else if ((this.velocity.X < -1f) || (this.velocity.X > 1f)) - { - if (this.velocity.Y == 0f) - { - this.velocity = (Vector2) (this.velocity * 0.8f); - } - } - else if ((this.velocity.X < 1f) && (this.direction == 1)) - { - this.velocity.X += 0.07f; - if (this.velocity.X > 1f) - { - this.velocity.X = 1f; - } - } - else if ((this.velocity.X > -1f) && (this.direction == -1)) - { - this.velocity.X -= 0.07f; - if (this.velocity.X < -1f) - { - this.velocity.X = -1f; - } - } - if (this.velocity.Y != 0f) - { - this.ai[1] = 0f; - this.ai[2] = 0f; - return; - } - int i = (int) (((this.position.X + (this.width / 2)) + (15 * this.direction)) / 16f); - int j = (int) (((this.position.Y + this.height) - 16f) / 16f); - if (Main.tile[i, j] == null) - { - Main.tile[i, j] = new Tile(); - } - if (Main.tile[i, j - 1] == null) - { - Main.tile[i, j - 1] = new Tile(); - } - if (Main.tile[i, j - 2] == null) - { - Main.tile[i, j - 2] = new Tile(); - } - if (Main.tile[i, j - 3] == null) - { - Main.tile[i, j - 3] = new Tile(); - } - if (Main.tile[i, j + 1] == null) - { - Main.tile[i, j + 1] = new Tile(); - } - if (Main.tile[i + this.direction, j - 1] == null) - { - Main.tile[i + this.direction, j - 1] = new Tile(); - } - if (Main.tile[i + this.direction, j + 1] == null) - { - Main.tile[i + this.direction, j + 1] = new Tile(); - } - if (!Main.tile[i, j - 1].active || (Main.tile[i, j - 1].type != 10)) - { - if (((this.velocity.X < 0f) && (this.spriteDirection == -1)) || ((this.velocity.X > 0f) && (this.spriteDirection == 1))) - { - if (Main.tile[i, j - 2].active && Main.tileSolid[Main.tile[i, j - 2].type]) - { - if (Main.tile[i, j - 3].active && Main.tileSolid[Main.tile[i, j - 3].type]) - { - this.velocity.Y = -8f; - this.netUpdate = true; - } - else - { - this.velocity.Y = -7f; - this.netUpdate = true; - } - } - else if (Main.tile[i, j - 1].active && Main.tileSolid[Main.tile[i, j - 1].type]) - { - this.velocity.Y = -6f; - this.netUpdate = true; - } - else if (Main.tile[i, j].active && Main.tileSolid[Main.tile[i, j].type]) - { - this.velocity.Y = -5f; - this.netUpdate = true; - } - else if (((this.directionY < 0) && (!Main.tile[i, j + 1].active || !Main.tileSolid[Main.tile[i, j + 1].type])) && (!Main.tile[i + this.direction, j + 1].active || !Main.tileSolid[Main.tile[i + this.direction, j + 1].type])) - { - this.velocity.Y = -8f; - this.velocity.X *= 1.5f; - this.netUpdate = true; - } - else - { - this.ai[1] = 0f; - this.ai[2] = 0f; - } - } - if ((((this.type == 0x1f) && (this.velocity.Y == 0f)) && ((Math.Abs((float) ((this.position.X + (this.width / 2)) - (Main.player[this.target].position.X - (Main.player[this.target].width / 2)))) < 100f) && (Math.Abs((float) ((this.position.Y + (this.height / 2)) - (Main.player[this.target].position.Y - (Main.player[this.target].height / 2)))) < 50f))) && (((this.direction > 0) && (this.velocity.X > 1f)) || ((this.direction < 0) && (this.velocity.X < -1f)))) - { - this.velocity.X *= 2f; - if (this.velocity.X > 3f) - { - this.velocity.X = 3f; - } - if (this.velocity.X < -3f) - { - this.velocity.X = -3f; - } - this.velocity.Y = -4f; - this.netUpdate = true; - return; - } - } - else - { - this.ai[2]++; - this.ai[3] = 0f; - if (this.ai[2] >= 60f) - { - if (!Main.bloodMoon && (this.type == 3)) - { - this.ai[1] = 0f; - } - this.velocity.X = 0.5f * -this.direction; - this.ai[1]++; - if (this.type == 0x1b) - { - this.ai[1]++; - } - if (this.type == 0x1f) - { - this.ai[1] += 6f; - } - this.ai[2] = 0f; - bool flag2 = false; - if (this.ai[1] >= 10f) - { - flag2 = true; - this.ai[1] = 10f; - } - WorldGen.KillTile(i, j - 1, true, false, false); - if (((Main.netMode != 1) || !flag2) && (flag2 && (Main.netMode != 1))) - { - if (this.type != 0x1a) - { - bool flag3 = WorldGen.OpenDoor(i, j, this.direction); - if (!flag3) - { - this.ai[3] = num2; - this.netUpdate = true; - } - if ((Main.netMode == 2) && flag3) - { - NetMessage.SendData(0x13, -1, -1, "", 0, (float) i, (float) j, (float) this.direction); - return; - } - } - else - { - WorldGen.KillTile(i, j - 1, false, false, false); - if (Main.netMode == 2) - { - NetMessage.SendData(0x11, -1, -1, "", 0, (float) i, (float) (j - 1), 0f); - return; - } - } - } - } - } - return; - } - if (this.aiStyle == 4) - { - if (((this.target < 0) || (this.target == 8)) || (Main.player[this.target].dead || !Main.player[this.target].active)) - { - this.TargetClosest(); - } - bool dead = Main.player[this.target].dead; - float num5 = ((this.position.X + (this.width / 2)) - Main.player[this.target].position.X) - (Main.player[this.target].width / 2); - float num6 = (((this.position.Y + this.height) - 59f) - Main.player[this.target].position.Y) - (Main.player[this.target].height / 2); - float num7 = ((float) Math.Atan2((double) num6, (double) num5)) + 1.57f; - if (num7 < 0f) - { - num7 += 6.283f; - } - else if (num7 > 6.283) - { - num7 -= 6.283f; - } - float num8 = 0f; - if ((this.ai[0] == 0f) && (this.ai[1] == 0f)) - { - num8 = 0.02f; - } - if (((this.ai[0] == 0f) && (this.ai[1] == 2f)) && (this.ai[2] > 40f)) - { - num8 = 0.05f; - } - if ((this.ai[0] == 3f) && (this.ai[1] == 0f)) - { - num8 = 0.05f; - } - if (((this.ai[0] == 3f) && (this.ai[1] == 2f)) && (this.ai[2] > 40f)) - { - num8 = 0.08f; - } - if (this.rotation < num7) - { - if ((num7 - this.rotation) > 3.1415) - { - this.rotation -= num8; - } - else - { - this.rotation += num8; - } - } - else if (this.rotation > num7) - { - if ((this.rotation - num7) > 3.1415) - { - this.rotation += num8; - } - else - { - this.rotation -= num8; - } - } - if ((this.rotation > (num7 - num8)) && (this.rotation < (num7 + num8))) - { - this.rotation = num7; - } - if (this.rotation < 0f) - { - this.rotation += 6.283f; - } - else if (this.rotation > 6.283) - { - this.rotation -= 6.283f; - } - if ((this.rotation > (num7 - num8)) && (this.rotation < (num7 + num8))) - { - this.rotation = num7; - } - if (Main.rand.Next(5) == 0) - { - color = new Color(); - int num9 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (this.height * 0.25f)), this.width, (int) (this.height * 0.5f), 5, this.velocity.X, 2f, 0, color, 1f); - Main.dust[num9].velocity.X *= 0.5f; - Main.dust[num9].velocity.Y *= 0.1f; - } - if (!Main.dayTime && !dead) - { - if (this.ai[0] != 0f) - { - if ((this.ai[0] != 1f) && (this.ai[0] != 2f)) - { - this.damage = 30; - this.defense = 6; - if (this.ai[1] != 0f) - { - if (this.ai[1] == 1f) - { - Main.PlaySound(15, (int) this.position.X, (int) this.position.Y, 0); - this.rotation = num7; - float num33 = 8f; - Vector2 vector6 = new Vector2(this.position.X + (this.width * 0.5f), this.position.Y + (this.height * 0.5f)); - float num34 = (Main.player[this.target].position.X + (Main.player[this.target].width / 2)) - vector6.X; - float num35 = (Main.player[this.target].position.Y + (Main.player[this.target].height / 2)) - vector6.Y; - float num36 = (float) Math.Sqrt((double) ((num34 * num34) + (num35 * num35))); - num36 = num33 / num36; - this.velocity.X = num34 * num36; - this.velocity.Y = num35 * num36; - this.ai[1] = 2f; - return; - } - if (this.ai[1] == 2f) - { - this.ai[2]++; - if (this.ai[2] >= 40f) - { - this.velocity.X *= 0.97f; - this.velocity.Y *= 0.97f; - if ((this.velocity.X > -0.1) && (this.velocity.X < 0.1)) - { - this.velocity.X = 0f; - } - if ((this.velocity.Y > -0.1) && (this.velocity.Y < 0.1)) - { - this.velocity.Y = 0f; - } - } - else - { - this.rotation = ((float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X)) - 1.57f; - } - if (this.ai[2] >= 100f) - { - this.ai[3]++; - this.ai[2] = 0f; - this.target = 8; - this.rotation = num7; - if (this.ai[3] >= 3f) - { - this.ai[1] = 0f; - this.ai[3] = 0f; - return; - } - this.ai[1] = 1f; - return; - } - } - } - else - { - float num28 = 6f; - float num29 = 0.07f; - Vector2 vector5 = new Vector2(this.position.X + (this.width * 0.5f), this.position.Y + (this.height * 0.5f)); - float num30 = (Main.player[this.target].position.X + (Main.player[this.target].width / 2)) - vector5.X; - float num31 = ((Main.player[this.target].position.Y + (Main.player[this.target].height / 2)) - 120f) - vector5.Y; - float num32 = (float) Math.Sqrt((double) ((num30 * num30) + (num31 * num31))); - num32 = num28 / num32; - num30 *= num32; - num31 *= num32; - if (this.velocity.X < num30) - { - this.velocity.X += num29; - if ((this.velocity.X < 0f) && (num30 > 0f)) - { - this.velocity.X += num29; - } - } - else if (this.velocity.X > num30) - { - this.velocity.X -= num29; - if ((this.velocity.X > 0f) && (num30 < 0f)) - { - this.velocity.X -= num29; - } - } - if (this.velocity.Y < num31) - { - this.velocity.Y += num29; - if ((this.velocity.Y < 0f) && (num31 > 0f)) - { - this.velocity.Y += num29; - } - } - else if (this.velocity.Y > num31) - { - this.velocity.Y -= num29; - if ((this.velocity.Y > 0f) && (num31 < 0f)) - { - this.velocity.Y -= num29; - } - } - this.ai[2]++; - if (this.ai[2] >= 200f) - { - this.ai[1] = 1f; - this.ai[2] = 0f; - this.ai[3] = 0f; - this.target = 8; - this.netUpdate = true; - return; - } - } - } - else - { - if (this.ai[0] == 1f) - { - this.ai[2] += 0.005f; - if (this.ai[2] > 0.5) - { - this.ai[2] = 0.5f; - } - } - else - { - this.ai[2] -= 0.005f; - if (this.ai[2] < 0f) - { - this.ai[2] = 0f; - } - } - this.rotation += this.ai[2]; - this.ai[1]++; - if (this.ai[1] == 100f) - { - this.ai[0]++; - this.ai[1] = 0f; - if (this.ai[0] == 3f) - { - this.ai[2] = 0f; - } - else - { - Main.PlaySound(3, (int) this.position.X, (int) this.position.Y, 1); - for (int k = 0; k < 2; k++) - { - Gore.NewGore(this.position, new Vector2(Main.rand.Next(-30, 0x1f) * 0.2f, Main.rand.Next(-30, 0x1f) * 0.2f), 8); - Gore.NewGore(this.position, new Vector2(Main.rand.Next(-30, 0x1f) * 0.2f, Main.rand.Next(-30, 0x1f) * 0.2f), 7); - Gore.NewGore(this.position, new Vector2(Main.rand.Next(-30, 0x1f) * 0.2f, Main.rand.Next(-30, 0x1f) * 0.2f), 6); - } - for (int m = 0; m < 20; m++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 5, Main.rand.Next(-30, 0x1f) * 0.2f, Main.rand.Next(-30, 0x1f) * 0.2f, 0, color, 1f); - } - Main.PlaySound(15, (int) this.position.X, (int) this.position.Y, 0); - } - } - Dust.NewDust(this.position, this.width, this.height, 5, Main.rand.Next(-30, 0x1f) * 0.2f, Main.rand.Next(-30, 0x1f) * 0.2f, 0, new Color(), 1f); - this.velocity.X *= 0.98f; - this.velocity.Y *= 0.98f; - if ((this.velocity.X > -0.1) && (this.velocity.X < 0.1)) - { - this.velocity.X = 0f; - } - if ((this.velocity.Y > -0.1) && (this.velocity.Y < 0.1)) - { - this.velocity.Y = 0f; - return; - } - } - } - else - { - if (this.ai[1] == 0f) - { - float num10 = 5f; - float num11 = 0.04f; - Vector2 vector = new Vector2(this.position.X + (this.width * 0.5f), this.position.Y + (this.height * 0.5f)); - float num12 = (Main.player[this.target].position.X + (Main.player[this.target].width / 2)) - vector.X; - float num13 = ((Main.player[this.target].position.Y + (Main.player[this.target].height / 2)) - 200f) - vector.Y; - float num14 = (float) Math.Sqrt((double) ((num12 * num12) + (num13 * num13))); - float num15 = num14; - num14 = num10 / num14; - num12 *= num14; - num13 *= num14; - if (this.velocity.X < num12) - { - this.velocity.X += num11; - if ((this.velocity.X < 0f) && (num12 > 0f)) - { - this.velocity.X += num11; - } - } - else if (this.velocity.X > num12) - { - this.velocity.X -= num11; - if ((this.velocity.X > 0f) && (num12 < 0f)) - { - this.velocity.X -= num11; - } - } - if (this.velocity.Y < num13) - { - this.velocity.Y += num11; - if ((this.velocity.Y < 0f) && (num13 > 0f)) - { - this.velocity.Y += num11; - } - } - else if (this.velocity.Y > num13) - { - this.velocity.Y -= num11; - if ((this.velocity.Y > 0f) && (num13 < 0f)) - { - this.velocity.Y -= num11; - } - } - this.ai[2]++; - if (this.ai[2] >= 600f) - { - this.ai[1] = 1f; - this.ai[2] = 0f; - this.ai[3] = 0f; - this.target = 8; - this.netUpdate = true; - } - else if (((this.position.Y + this.height) < Main.player[this.target].position.Y) && (num15 < 500f)) - { - if (!Main.player[this.target].dead) - { - this.ai[3]++; - } - if (this.ai[3] >= 90f) - { - Vector2 vector3; - this.ai[3] = 0f; - this.rotation = num7; - float num16 = 5f; - float num17 = (Main.player[this.target].position.X + (Main.player[this.target].width / 2)) - vector.X; - float num18 = (Main.player[this.target].position.Y + (Main.player[this.target].height / 2)) - vector.Y; - float num19 = (float) Math.Sqrt((double) ((num17 * num17) + (num18 * num18))); - num19 = num16 / num19; - Vector2 position = vector; - vector3.X = num17 * num19; - vector3.Y = num18 * num19; - position.X += vector3.X * 10f; - position.Y += vector3.Y * 10f; - if (Main.netMode != 1) - { - int num20 = NewNPC((int) position.X, (int) position.Y, 5, 0); - Main.npc[num20].velocity.X = vector3.X; - Main.npc[num20].velocity.Y = vector3.Y; - if ((Main.netMode == 2) && (num20 < 0x3e8)) - { - NetMessage.SendData(0x17, -1, -1, "", num20, 0f, 0f, 0f); - } - } - Main.PlaySound(3, (int) position.X, (int) position.Y, 1); - for (int n = 0; n < 10; n++) - { - color = new Color(); - Dust.NewDust(position, 20, 20, 5, vector3.X * 0.4f, vector3.Y * 0.4f, 0, color, 1f); - } - } - } - } - else if (this.ai[1] == 1f) - { - this.rotation = num7; - float num22 = 7f; - Vector2 vector4 = new Vector2(this.position.X + (this.width * 0.5f), this.position.Y + (this.height * 0.5f)); - float num23 = (Main.player[this.target].position.X + (Main.player[this.target].width / 2)) - vector4.X; - float num24 = (Main.player[this.target].position.Y + (Main.player[this.target].height / 2)) - vector4.Y; - float num25 = (float) Math.Sqrt((double) ((num23 * num23) + (num24 * num24))); - num25 = num22 / num25; - this.velocity.X = num23 * num25; - this.velocity.Y = num24 * num25; - this.ai[1] = 2f; - } - else if (this.ai[1] == 2f) - { - this.ai[2]++; - if (this.ai[2] >= 40f) - { - this.velocity.X *= 0.98f; - this.velocity.Y *= 0.98f; - if ((this.velocity.X > -0.1) && (this.velocity.X < 0.1)) - { - this.velocity.X = 0f; - } - if ((this.velocity.Y > -0.1) && (this.velocity.Y < 0.1)) - { - this.velocity.Y = 0f; - } - } - else - { - this.rotation = ((float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X)) - 1.57f; - } - if (this.ai[2] >= 120f) - { - this.ai[3]++; - this.ai[2] = 0f; - this.target = 8; - this.rotation = num7; - if (this.ai[3] >= 3f) - { - this.ai[1] = 0f; - this.ai[3] = 0f; - } - else - { - this.ai[1] = 1f; - } - } - } - if (this.life < (this.lifeMax * 0.5)) - { - this.ai[0] = 1f; - this.ai[1] = 0f; - this.ai[2] = 0f; - this.ai[3] = 0f; - this.netUpdate = true; - return; - } - } - } - else - { - this.velocity.Y -= 0.04f; - if (this.timeLeft > 10) - { - this.timeLeft = 10; - return; - } - } - return; - } - if (this.aiStyle == 5) - { - if (((this.target < 0) || (this.target == 8)) || Main.player[this.target].dead) - { - this.TargetClosest(); - } - float num37 = 6f; - float num38 = 0.05f; - if (this.type == 6) - { - num37 = 4f; - num38 = 0.02f; - } - else if (this.type == 0x17) - { - num37 = 2.5f; - num38 = 0.02f; - } - Vector2 vector7 = new Vector2(this.position.X + (this.width * 0.5f), this.position.Y + (this.height * 0.5f)); - float num39 = (Main.player[this.target].position.X + (Main.player[this.target].width / 2)) - vector7.X; - float num40 = (Main.player[this.target].position.Y + (Main.player[this.target].height / 2)) - vector7.Y; - float num41 = (float) Math.Sqrt((double) ((num39 * num39) + (num40 * num40))); - num41 = num37 / num41; - num39 *= num41; - num40 *= num41; - if (Main.player[this.target].dead) - { - num39 = (this.direction * num37) / 2f; - num40 = -num37 / 2f; - } - if (this.velocity.X < num39) - { - this.velocity.X += num38; - if ((this.velocity.X < 0f) && (num39 > 0f)) - { - this.velocity.X += num38; - } - } - else if (this.velocity.X > num39) - { - this.velocity.X -= num38; - if ((this.velocity.X > 0f) && (num39 < 0f)) - { - this.velocity.X -= num38; - } - } - if (this.velocity.Y < num40) - { - this.velocity.Y += num38; - if ((this.velocity.Y < 0f) && (num40 > 0f)) - { - this.velocity.Y += num38; - } - } - else if (this.velocity.Y > num40) - { - this.velocity.Y -= num38; - if ((this.velocity.Y > 0f) && (num40 < 0f)) - { - this.velocity.Y -= num38; - } - } - if (this.type == 0x17) - { - this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X); - } - else - { - this.rotation = ((float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X)) - 1.57f; - } - if ((this.type == 6) || (this.type == 0x17)) - { - if (this.collideX) - { - this.netUpdate = true; - this.velocity.X = this.oldVelocity.X * -0.7f; - if (((this.direction == -1) && (this.velocity.X > 0f)) && (this.velocity.X < 2f)) - { - this.velocity.X = 2f; - } - if (((this.direction == 1) && (this.velocity.X < 0f)) && (this.velocity.X > -2f)) - { - this.velocity.X = -2f; - } - } - if (this.collideY) - { - this.netUpdate = true; - this.velocity.Y = this.oldVelocity.Y * -0.7f; - if ((this.velocity.Y > 0f) && (this.velocity.Y < 2f)) - { - this.velocity.Y = 2f; - } - if ((this.velocity.Y < 0f) && (this.velocity.Y > -2f)) - { - this.velocity.Y = -2f; - } - } - if (this.type == 0x17) - { - int num42 = Dust.NewDust(new Vector2(this.position.X - this.velocity.X, this.position.Y - this.velocity.Y), this.width, this.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, new Color(), 2f); - Main.dust[num42].noGravity = true; - Main.dust[num42].velocity.X *= 0.3f; - Main.dust[num42].velocity.Y *= 0.3f; - } - else if (Main.rand.Next(20) == 0) - { - int num43 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (this.height * 0.25f)), this.width, (int) (this.height * 0.5f), 0x12, this.velocity.X, 2f, this.alpha, this.color, this.scale); - Main.dust[num43].velocity.X *= 0.5f; - Main.dust[num43].velocity.Y *= 0.1f; - } - } - else if (Main.rand.Next(40) == 0) - { - int num44 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + (this.height * 0.25f)), this.width, (int) (this.height * 0.5f), 5, this.velocity.X, 2f, 0, new Color(), 1f); - Main.dust[num44].velocity.X *= 0.5f; - Main.dust[num44].velocity.Y *= 0.1f; - } - if (((Main.dayTime && (this.type != 6)) && (this.type != 0x17)) || Main.player[this.target].dead) - { - this.velocity.Y -= num38 * 2f; - if (this.timeLeft > 10) - { - this.timeLeft = 10; - return; - } - } - return; - } - if (this.aiStyle != 6) - { - if (this.aiStyle != 7) - { - if (this.aiStyle != 8) - { - if (this.aiStyle == 9) - { - if (this.target == 8) - { - this.TargetClosest(); - float num95 = 6f; - if (this.type == 30) - { - maxSpawns = 8; - } - Vector2 vector10 = new Vector2(this.position.X + (this.width * 0.5f), this.position.Y + (this.height * 0.5f)); - float num96 = (Main.player[this.target].position.X + (Main.player[this.target].width / 2)) - vector10.X; - float num97 = (Main.player[this.target].position.Y + (Main.player[this.target].height / 2)) - vector10.Y; - float num98 = (float) Math.Sqrt((double) ((num96 * num96) + (num97 * num97))); - num98 = num95 / num98; - this.velocity.X = num96 * num98; - this.velocity.Y = num97 * num98; - } - if (this.timeLeft > 100) - { - this.timeLeft = 100; - } - for (int num99 = 0; num99 < 2; num99++) - { - if (this.type == 30) - { - color = new Color(); - int num100 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 2f), this.width, this.height, 0x1b, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, color, 2f); - Main.dust[num100].noGravity = true; - Dust dust7 = Main.dust[num100]; - dust7.velocity = (Vector2) (dust7.velocity * 0.3f); - Main.dust[num100].velocity.X -= this.velocity.X * 0.2f; - Main.dust[num100].velocity.Y -= this.velocity.Y * 0.2f; - } - else if (this.type == 0x21) - { - color = new Color(); - int num101 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 2f), this.width, this.height, 0x1d, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, color, 2f); - Main.dust[num101].noGravity = true; - Main.dust[num101].velocity.X *= 0.3f; - Main.dust[num101].velocity.Y *= 0.3f; - } - else - { - color = new Color(); - int num102 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 2f), this.width, this.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, color, 2f); - Main.dust[num102].noGravity = true; - Main.dust[num102].velocity.X *= 0.3f; - Main.dust[num102].velocity.Y *= 0.3f; - } - } - this.rotation += 0.4f * this.direction; - return; - } - if (this.aiStyle == 10) - { - if (this.collideX) - { - this.velocity.X = this.oldVelocity.X * -0.5f; - if (((this.direction == -1) && (this.velocity.X > 0f)) && (this.velocity.X < 2f)) - { - this.velocity.X = 2f; - } - if (((this.direction == 1) && (this.velocity.X < 0f)) && (this.velocity.X > -2f)) - { - this.velocity.X = -2f; - } - } - if (this.collideY) - { - this.velocity.Y = this.oldVelocity.Y * -0.5f; - if ((this.velocity.Y > 0f) && (this.velocity.Y < 1f)) - { - this.velocity.Y = 1f; - } - if ((this.velocity.Y < 0f) && (this.velocity.Y > -1f)) - { - this.velocity.Y = -1f; - } - } - this.TargetClosest(); - if ((this.direction == -1) && (this.velocity.X > -4f)) - { - this.velocity.X -= 0.1f; - if (this.velocity.X > 4f) - { - this.velocity.X -= 0.1f; - } - else if (this.velocity.X > 0f) - { - this.velocity.X += 0.05f; - } - if (this.velocity.X < -4f) - { - this.velocity.X = -4f; - } - } - else if ((this.direction == 1) && (this.velocity.X < 4f)) - { - this.velocity.X += 0.1f; - if (this.velocity.X < -4f) - { - this.velocity.X += 0.1f; - } - else if (this.velocity.X < 0f) - { - this.velocity.X -= 0.05f; - } - if (this.velocity.X > 4f) - { - this.velocity.X = 4f; - } - } - if ((this.directionY == -1) && (this.velocity.Y > -1.5)) - { - this.velocity.Y -= 0.04f; - if (this.velocity.Y > 1.5) - { - this.velocity.Y -= 0.05f; - } - else if (this.velocity.Y > 0f) - { - this.velocity.Y += 0.03f; - } - if (this.velocity.Y < -1.5) - { - this.velocity.Y = -1.5f; - } - } - else if ((this.directionY == 1) && (this.velocity.Y < 1.5)) - { - this.velocity.Y += 0.04f; - if (this.velocity.Y < -1.5) - { - this.velocity.Y += 0.05f; - } - else if (this.velocity.Y < 0f) - { - this.velocity.Y -= 0.03f; - } - if (this.velocity.Y > 1.5) - { - this.velocity.Y = 1.5f; - } - } - this.rotation = ((float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X)) - 1.57f; - int num103 = Dust.NewDust(new Vector2(this.position.X - this.velocity.X, this.position.Y - this.velocity.Y), this.width, this.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, new Color(), 2f); - Main.dust[num103].noGravity = true; - Main.dust[num103].noLight = true; - Main.dust[num103].velocity.X *= 0.3f; - Main.dust[num103].velocity.Y *= 0.3f; - return; - } - if (this.aiStyle == 11) - { - if ((this.ai[0] == 0f) && (Main.netMode != 1)) - { - this.TargetClosest(); - this.ai[0] = 1f; - int num104 = NewNPC(((int) this.position.X) + (this.width / 2), ((int) this.position.Y) + (this.height / 2), 0x24, this.whoAmI); - Main.npc[num104].ai[0] = -1f; - Main.npc[num104].ai[1] = this.whoAmI; - Main.npc[num104].target = this.target; - Main.npc[num104].netUpdate = true; - num104 = NewNPC(((int) this.position.X) + (this.width / 2), ((int) this.position.Y) + (this.height / 2), 0x24, this.whoAmI); - Main.npc[num104].ai[0] = 1f; - Main.npc[num104].ai[1] = this.whoAmI; - Main.npc[num104].ai[3] = 150f; - Main.npc[num104].target = this.target; - Main.npc[num104].netUpdate = true; - } - if ((Main.player[this.target].dead || (Math.Abs((float) (this.position.X - Main.player[this.target].position.X)) > 2000f)) || (Math.Abs((float) (this.position.Y - Main.player[this.target].position.Y)) > 2000f)) - { - this.TargetClosest(); - if ((Main.player[this.target].dead || (Math.Abs((float) (this.position.X - Main.player[this.target].position.X)) > 2000f)) || (Math.Abs((float) (this.position.Y - Main.player[this.target].position.Y)) > 2000f)) - { - this.ai[1] = 3f; - } - } - if ((Main.dayTime && (this.ai[1] != 3f)) && (this.ai[1] != 2f)) - { - this.ai[1] = 2f; - Main.PlaySound(15, (int) this.position.X, (int) this.position.Y, 0); - } - if (this.ai[1] == 0f) - { - this.ai[2]++; - if (this.ai[2] >= 800f) - { - this.ai[2] = 0f; - this.ai[1] = 1f; - this.TargetClosest(); - this.netUpdate = true; - } - this.rotation = this.velocity.X / 15f; - if (this.position.Y > (Main.player[this.target].position.Y - 250f)) - { - if (this.velocity.Y > 0f) - { - this.velocity.Y *= 0.98f; - } - this.velocity.Y -= 0.02f; - if (this.velocity.Y > 2f) - { - this.velocity.Y = 2f; - } - } - else if (this.position.Y < (Main.player[this.target].position.Y - 250f)) - { - if (this.velocity.Y < 0f) - { - this.velocity.Y *= 0.98f; - } - this.velocity.Y += 0.02f; - if (this.velocity.Y < -2f) - { - this.velocity.Y = -2f; - } - } - if ((this.position.X + (this.width / 2)) > (Main.player[this.target].position.X + (Main.player[this.target].width / 2))) - { - if (this.velocity.X > 0f) - { - this.velocity.X *= 0.98f; - } - this.velocity.X -= 0.05f; - if (this.velocity.X > 8f) - { - this.velocity.X = 8f; - } - } - if ((this.position.X + (this.width / 2)) < (Main.player[this.target].position.X + (Main.player[this.target].width / 2))) - { - if (this.velocity.X < 0f) - { - this.velocity.X *= 0.98f; - } - this.velocity.X += 0.05f; - if (this.velocity.X < -8f) - { - this.velocity.X = -8f; - } - } - } - else if (this.ai[1] == 1f) - { - this.ai[2]++; - if (this.ai[2] == 2f) - { - Main.PlaySound(15, (int) this.position.X, (int) this.position.Y, 0); - } - if (this.ai[2] >= 400f) - { - this.ai[2] = 0f; - this.ai[1] = 0f; - } - this.rotation += this.direction * 0.3f; - Vector2 vector11 = new Vector2(this.position.X + (this.width * 0.5f), this.position.Y + (this.height * 0.5f)); - float num105 = (Main.player[this.target].position.X + (Main.player[this.target].width / 2)) - vector11.X; - float num106 = (Main.player[this.target].position.Y + (Main.player[this.target].height / 2)) - vector11.Y; - float num107 = (float) Math.Sqrt((double) ((num105 * num105) + (num106 * num106))); - num107 = 2.5f / num107; - this.velocity.X = num105 * num107; - this.velocity.Y = num106 * num107; - } - else if (this.ai[1] == 2f) - { - this.damage = 0x270f; - this.defense = 0x270f; - this.rotation += this.direction * 0.3f; - Vector2 vector12 = new Vector2(this.position.X + (this.width * 0.5f), this.position.Y + (this.height * 0.5f)); - float num108 = (Main.player[this.target].position.X + (Main.player[this.target].width / 2)) - vector12.X; - float num109 = (Main.player[this.target].position.Y + (Main.player[this.target].height / 2)) - vector12.Y; - float num110 = (float) Math.Sqrt((double) ((num108 * num108) + (num109 * num109))); - num110 = 8f / num110; - this.velocity.X = num108 * num110; - this.velocity.Y = num109 * num110; - } - else if (this.ai[1] == 3f) - { - this.velocity.Y -= 0.1f; - if (this.velocity.Y > 0f) - { - this.velocity.Y *= 0.95f; - } - this.velocity.X *= 0.95f; - if (this.timeLeft > 50) - { - this.timeLeft = 50; - } - } - if ((this.ai[1] != 2f) && (this.ai[1] != 3f)) - { - color = new Color(); - int num111 = Dust.NewDust(new Vector2(((this.position.X + (this.width / 2)) - 15f) - (this.velocity.X * 5f), (this.position.Y + this.height) - 2f), 30, 10, 5, -this.velocity.X * 0.2f, 3f, 0, color, 2f); - Main.dust[num111].noGravity = true; - Main.dust[num111].velocity.X *= 1.3f; - Main.dust[num111].velocity.X += this.velocity.X * 0.4f; - Main.dust[num111].velocity.Y += 2f + this.velocity.Y; - for (int num112 = 0; num112 < 2; num112++) - { - color = new Color(); - num111 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 120f), this.width, 60, 5, this.velocity.X, this.velocity.Y, 0, color, 2f); - Main.dust[num111].noGravity = true; - Dust dust8 = Main.dust[num111]; - dust8.velocity -= this.velocity; - Main.dust[num111].velocity.Y += 5f; - } - return; - } - } - else if (this.aiStyle == 12) - { - this.spriteDirection = -((int) this.ai[0]); - if (!Main.npc[(int) this.ai[1]].active || (Main.npc[(int) this.ai[1]].aiStyle != 11)) - { - this.ai[2] += 10f; - if ((this.ai[2] > 50f) || (Main.netMode != 2)) - { - this.life = -1; - this.HitEffect(0, 10.0); - this.active = false; - } - } - if ((this.ai[2] == 0f) || (this.ai[2] == 3f)) - { - if ((Main.npc[(int) this.ai[1]].ai[1] == 3f) && (this.timeLeft > 10)) - { - this.timeLeft = 10; - } - if (Main.npc[(int) this.ai[1]].ai[1] != 0f) - { - if (this.position.Y > (Main.npc[(int) this.ai[1]].position.Y - 100f)) - { - if (this.velocity.Y > 0f) - { - this.velocity.Y *= 0.96f; - } - this.velocity.Y -= 0.07f; - if (this.velocity.Y > 6f) - { - this.velocity.Y = 6f; - } - } - else if (this.position.Y < (Main.npc[(int) this.ai[1]].position.Y - 100f)) - { - if (this.velocity.Y < 0f) - { - this.velocity.Y *= 0.96f; - } - this.velocity.Y += 0.07f; - if (this.velocity.Y < -6f) - { - this.velocity.Y = -6f; - } - } - if ((this.position.X + (this.width / 2)) > ((Main.npc[(int) this.ai[1]].position.X + (Main.npc[(int) this.ai[1]].width / 2)) - (120f * this.ai[0]))) - { - if (this.velocity.X > 0f) - { - this.velocity.X *= 0.96f; - } - this.velocity.X -= 0.1f; - if (this.velocity.X > 8f) - { - this.velocity.X = 8f; - } - } - if ((this.position.X + (this.width / 2)) < ((Main.npc[(int) this.ai[1]].position.X + (Main.npc[(int) this.ai[1]].width / 2)) - (120f * this.ai[0]))) - { - if (this.velocity.X < 0f) - { - this.velocity.X *= 0.96f; - } - this.velocity.X += 0.1f; - if (this.velocity.X < -8f) - { - this.velocity.X = -8f; - } - } - } - else - { - this.ai[3]++; - if (this.ai[3] >= 300f) - { - this.ai[2]++; - this.ai[3] = 0f; - this.netUpdate = true; - } - if (this.position.Y > (Main.npc[(int) this.ai[1]].position.Y + 230f)) - { - if (this.velocity.Y > 0f) - { - this.velocity.Y *= 0.96f; - } - this.velocity.Y -= 0.04f; - if (this.velocity.Y > 3f) - { - this.velocity.Y = 3f; - } - } - else if (this.position.Y < (Main.npc[(int) this.ai[1]].position.Y + 230f)) - { - if (this.velocity.Y < 0f) - { - this.velocity.Y *= 0.96f; - } - this.velocity.Y += 0.04f; - if (this.velocity.Y < -3f) - { - this.velocity.Y = -3f; - } - } - if ((this.position.X + (this.width / 2)) > ((Main.npc[(int) this.ai[1]].position.X + (Main.npc[(int) this.ai[1]].width / 2)) - (200f * this.ai[0]))) - { - if (this.velocity.X > 0f) - { - this.velocity.X *= 0.96f; - } - this.velocity.X -= 0.07f; - if (this.velocity.X > 8f) - { - this.velocity.X = 8f; - } - } - if ((this.position.X + (this.width / 2)) < ((Main.npc[(int) this.ai[1]].position.X + (Main.npc[(int) this.ai[1]].width / 2)) - (200f * this.ai[0]))) - { - if (this.velocity.X < 0f) - { - this.velocity.X *= 0.96f; - } - this.velocity.X += 0.07f; - if (this.velocity.X < -8f) - { - this.velocity.X = -8f; - } - } - } - Vector2 vector13 = new Vector2(this.position.X + (this.width * 0.5f), this.position.Y + (this.height * 0.5f)); - float num113 = ((Main.npc[(int) this.ai[1]].position.X + (Main.npc[(int) this.ai[1]].width / 2)) - (200f * this.ai[0])) - vector13.X; - float num114 = (Main.npc[(int) this.ai[1]].position.Y + 230f) - vector13.Y; - Math.Sqrt((double) ((num113 * num113) + (num114 * num114))); - this.rotation = ((float) Math.Atan2((double) num114, (double) num113)) + 1.57f; - return; - } - if (this.ai[2] != 1f) - { - if (this.ai[2] != 2f) - { - if (this.ai[2] != 4f) - { - if ((this.ai[2] == 5f) && (((this.velocity.X > 0f) && ((this.position.X + (this.width / 2)) > (Main.player[this.target].position.X + (Main.player[this.target].width / 2)))) || ((this.velocity.X < 0f) && ((this.position.X + (this.width / 2)) < (Main.player[this.target].position.X + (Main.player[this.target].width / 2)))))) - { - this.ai[2] = 0f; - return; - } - } - else - { - Vector2 vector15 = new Vector2(this.position.X + (this.width * 0.5f), this.position.Y + (this.height * 0.5f)); - float num118 = ((Main.npc[(int) this.ai[1]].position.X + (Main.npc[(int) this.ai[1]].width / 2)) - (200f * this.ai[0])) - vector15.X; - float num119 = (Main.npc[(int) this.ai[1]].position.Y + 230f) - vector15.Y; - float num120 = (float) Math.Sqrt((double) ((num118 * num118) + (num119 * num119))); - this.rotation = ((float) Math.Atan2((double) num119, (double) num118)) + 1.57f; - this.velocity.Y *= 0.95f; - this.velocity.X += 0.1f * -this.ai[0]; - if (this.velocity.X < -8f) - { - this.velocity.X = -8f; - } - if (this.velocity.X > 8f) - { - this.velocity.X = 8f; - } - if (((this.position.X + (this.width / 2)) < ((Main.npc[(int) this.ai[1]].position.X + (Main.npc[(int) this.ai[1]].width / 2)) - 500f)) || ((this.position.X + (this.width / 2)) > ((Main.npc[(int) this.ai[1]].position.X + (Main.npc[(int) this.ai[1]].width / 2)) + 500f))) - { - this.TargetClosest(); - this.ai[2] = 5f; - vector15 = new Vector2(this.position.X + (this.width * 0.5f), this.position.Y + (this.height * 0.5f)); - num118 = (Main.player[this.target].position.X + (Main.player[this.target].width / 2)) - vector15.X; - num119 = (Main.player[this.target].position.Y + (Main.player[this.target].height / 2)) - vector15.Y; - num120 = (float) Math.Sqrt((double) ((num118 * num118) + (num119 * num119))); - num120 = 20f / num120; - this.velocity.X = num118 * num120; - this.velocity.Y = num119 * num120; - this.netUpdate = true; - return; - } - } - } - else if ((this.position.Y > Main.player[this.target].position.Y) || (this.velocity.Y < 0f)) - { - this.ai[2] = 3f; - return; - } - } - else - { - Vector2 vector14 = new Vector2(this.position.X + (this.width * 0.5f), this.position.Y + (this.height * 0.5f)); - float num115 = ((Main.npc[(int) this.ai[1]].position.X + (Main.npc[(int) this.ai[1]].width / 2)) - (200f * this.ai[0])) - vector14.X; - float num116 = (Main.npc[(int) this.ai[1]].position.Y + 230f) - vector14.Y; - float num117 = (float) Math.Sqrt((double) ((num115 * num115) + (num116 * num116))); - this.rotation = ((float) Math.Atan2((double) num116, (double) num115)) + 1.57f; - this.velocity.X *= 0.95f; - this.velocity.Y -= 0.1f; - if (this.velocity.Y < -8f) - { - this.velocity.Y = -8f; - } - if (this.position.Y < (Main.npc[(int) this.ai[1]].position.Y - 200f)) - { - this.TargetClosest(); - this.ai[2] = 2f; - vector14 = new Vector2(this.position.X + (this.width * 0.5f), this.position.Y + (this.height * 0.5f)); - num115 = (Main.player[this.target].position.X + (Main.player[this.target].width / 2)) - vector14.X; - num116 = (Main.player[this.target].position.Y + (Main.player[this.target].height / 2)) - vector14.Y; - num117 = (float) Math.Sqrt((double) ((num115 * num115) + (num116 * num116))); - num117 = 20f / num117; - this.velocity.X = num115 * num117; - this.velocity.Y = num116 * num117; - this.netUpdate = true; - return; - } - } - } - else if (this.aiStyle == 13) - { - if (Main.tile[(int) this.ai[0], (int) this.ai[1]] == null) - { - Main.tile[(int) this.ai[0], (int) this.ai[1]] = new Tile(); - } - if (!Main.tile[(int) this.ai[0], (int) this.ai[1]].active) - { - this.life = -1; - this.HitEffect(0, 10.0); - this.active = false; - return; - } - this.TargetClosest(); - float num121 = 0.05f; - Vector2 vector16 = new Vector2((this.ai[0] * 16f) + 8f, (this.ai[1] * 16f) + 8f); - float num122 = ((Main.player[this.target].position.X + (Main.player[this.target].width / 2)) - (this.width / 2)) - vector16.X; - float num123 = ((Main.player[this.target].position.Y + (Main.player[this.target].height / 2)) - (this.height / 2)) - vector16.Y; - float num124 = (float) Math.Sqrt((double) ((num122 * num122) + (num123 * num123))); - if (num124 > 150f) - { - num124 = 150f / num124; - num122 *= num124; - num123 *= num124; - } - if (this.position.X < (((this.ai[0] * 16f) + 8f) + num122)) - { - this.velocity.X += num121; - if ((this.velocity.X < 0f) && (num122 > 0f)) - { - this.velocity.X += num121 * 2f; - } - } - else if (this.position.X > (((this.ai[0] * 16f) + 8f) + num122)) - { - this.velocity.X -= num121; - if ((this.velocity.X > 0f) && (num122 < 0f)) - { - this.velocity.X -= num121 * 2f; - } - } - if (this.position.Y < (((this.ai[1] * 16f) + 8f) + num123)) - { - this.velocity.Y += num121; - if ((this.velocity.Y < 0f) && (num123 > 0f)) - { - this.velocity.Y += num121 * 2f; - } - } - else if (this.position.Y > (((this.ai[1] * 16f) + 8f) + num123)) - { - this.velocity.Y -= num121; - if ((this.velocity.Y > 0f) && (num123 < 0f)) - { - this.velocity.Y -= num121 * 2f; - } - } - if (this.velocity.X > 2f) - { - this.velocity.X = 2f; - } - if (this.velocity.X < -2f) - { - this.velocity.X = -2f; - } - if (this.velocity.Y > 2f) - { - this.velocity.Y = 2f; - } - if (this.velocity.Y < -2f) - { - this.velocity.Y = -2f; - } - if (num122 > 0f) - { - this.spriteDirection = 1; - this.rotation = (float) Math.Atan2((double) num123, (double) num122); - } - if (num122 < 0f) - { - this.spriteDirection = -1; - this.rotation = ((float) Math.Atan2((double) num123, (double) num122)) + 3.14f; - } - if (this.collideX) - { - this.netUpdate = true; - this.velocity.X = this.oldVelocity.X * -0.7f; - if ((this.velocity.X > 0f) && (this.velocity.X < 2f)) - { - this.velocity.X = 2f; - } - if ((this.velocity.X < 0f) && (this.velocity.X > -2f)) - { - this.velocity.X = -2f; - } - } - if (this.collideY) - { - this.netUpdate = true; - this.velocity.Y = this.oldVelocity.Y * -0.7f; - if ((this.velocity.Y > 0f) && (this.velocity.Y < 2f)) - { - this.velocity.Y = 2f; - } - if ((this.velocity.Y < 0f) && (this.velocity.Y > -2f)) - { - this.velocity.Y = -2f; - } - } - } - return; - } - this.TargetClosest(); - this.velocity.X *= 0.93f; - if ((this.velocity.X > -0.1) && (this.velocity.X < 0.1)) - { - this.velocity.X = 0f; - } - if (this.ai[0] == 0f) - { - this.ai[0] = 500f; - } - if ((this.ai[2] != 0f) && (this.ai[3] != 0f)) - { - Main.PlaySound(2, (int) this.position.X, (int) this.position.Y, 8); - for (int num75 = 0; num75 < 50; num75++) - { - if (this.type == 0x1d) - { - color = new Color(); - int num76 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 0x1b, 0f, 0f, 100, color, (float) Main.rand.Next(1, 3)); - Dust dust1 = Main.dust[num76]; - dust1.velocity = (Vector2) (dust1.velocity * 3f); - if (Main.dust[num76].scale > 1f) - { - Main.dust[num76].noGravity = true; - } - } - else if (this.type == 0x20) - { - color = new Color(); - int num77 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 0x1d, 0f, 0f, 100, color, 2.5f); - Dust dust2 = Main.dust[num77]; - dust2.velocity = (Vector2) (dust2.velocity * 3f); - Main.dust[num77].noGravity = true; - } - else - { - color = new Color(); - int num78 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, color, 2.5f); - Dust dust3 = Main.dust[num78]; - dust3.velocity = (Vector2) (dust3.velocity * 3f); - Main.dust[num78].noGravity = true; - } - } - this.position.X = ((this.ai[2] * 16f) - (this.width / 2)) + 8f; - this.position.Y = (this.ai[3] * 16f) - this.height; - this.velocity.X = 0f; - this.velocity.Y = 0f; - this.ai[2] = 0f; - this.ai[3] = 0f; - Main.PlaySound(2, (int) this.position.X, (int) this.position.Y, 8); - for (int num79 = 0; num79 < 50; num79++) - { - if (this.type == 0x1d) - { - color = new Color(); - int num80 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 0x1b, 0f, 0f, 100, color, (float) Main.rand.Next(1, 3)); - Dust dust4 = Main.dust[num80]; - dust4.velocity = (Vector2) (dust4.velocity * 3f); - if (Main.dust[num80].scale > 1f) - { - Main.dust[num80].noGravity = true; - } - } - else if (this.type == 0x20) - { - color = new Color(); - int num81 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 0x1d, 0f, 0f, 100, color, 2.5f); - Dust dust5 = Main.dust[num81]; - dust5.velocity = (Vector2) (dust5.velocity * 3f); - Main.dust[num81].noGravity = true; - } - else - { - color = new Color(); - int num82 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, color, 2.5f); - Dust dust6 = Main.dust[num82]; - dust6.velocity = (Vector2) (dust6.velocity * 3f); - Main.dust[num82].noGravity = true; - } - } - } - this.ai[0]++; - if (((this.ai[0] == 75f) || (this.ai[0] == 150f)) || (this.ai[0] == 225f)) - { - this.ai[1] = 30f; - this.netUpdate = true; - goto Label_5D99; - } - if ((this.ai[0] < 450f) || (Main.netMode == 1)) - { - goto Label_5D99; - } - this.ai[0] = 1f; - int num83 = ((int) Main.player[this.target].position.X) / 0x10; - int num84 = ((int) Main.player[this.target].position.Y) / 0x10; - int num85 = ((int) this.position.X) / 0x10; - int num86 = ((int) this.position.Y) / 0x10; - int num87 = 20; - int num88 = 0; - bool flag12 = false; - if ((Math.Abs((float) (this.position.X - Main.player[this.target].position.X)) + Math.Abs((float) (this.position.Y - Main.player[this.target].position.Y))) > 2000f) - { - num88 = 100; - flag12 = true; - } - Label_5D85: - while (!flag12 && (num88 < 100)) - { - num88++; - int num89 = Main.rand.Next(num83 - num87, num83 + num87); - for (int num91 = Main.rand.Next(num84 - num87, num84 + num87); num91 < (num84 + num87); num91++) - { - if (((((num91 < (num84 - 4)) || (num91 > (num84 + 4))) || ((num89 < (num83 - 4)) || (num89 > (num83 + 4)))) && (((num91 < (num86 - 1)) || (num91 > (num86 + 1))) || ((num89 < (num85 - 1)) || (num89 > (num85 + 1))))) && Main.tile[num89, num91].active) - { - bool flag13 = true; - if ((this.type == 0x20) && (Main.tile[num89, num91 - 1].wall == 0)) - { - flag13 = false; - } - else if (Main.tile[num89, num91 - 1].lava) - { - flag13 = false; - } - if ((flag13 && Main.tileSolid[Main.tile[num89, num91].type]) && !Collision.SolidTiles(num89 - 1, num89 + 1, num91 - 4, num91 - 1)) - { - this.ai[1] = 20f; - this.ai[2] = num89; - this.ai[3] = num91; - flag12 = true; - goto Label_5D85; - } - } - } - } - this.netUpdate = true; - goto Label_5D99; - } - num66 = (((int) this.position.X) + (this.width / 2)) / 0x10; - num67 = ((int) ((this.position.Y + this.height) + 1f)) / 0x10; - flag7 = false; - this.directionY = -1; - if (this.direction == 0) - { - this.direction = 1; - } - for (int num68 = 0; num68 < 8; num68++) - { - if (Main.player[num68].active && (Main.player[num68].talkNPC == this.whoAmI)) - { - flag7 = true; - if (this.ai[0] != 0f) - { - this.netUpdate = true; - } - this.ai[0] = 0f; - this.ai[1] = 300f; - this.ai[2] = 100f; - if ((Main.player[num68].position.X + (Main.player[num68].width / 2)) < (this.position.X + (this.width / 2))) - { - this.direction = -1; - } - else - { - this.direction = 1; - } - } - } - if (this.ai[3] > 0f) - { - this.life = -1; - this.HitEffect(0, 10.0); - this.active = false; - if (this.type == 0x25) - { - Main.PlaySound(15, (int) this.position.X, (int) this.position.Y, 0); - } - } - if ((this.type != 0x25) || (Main.netMode == 1)) - { - goto Label_4417; - } - this.homeless = false; - this.homeTileX = Main.dungeonX; - this.homeTileY = Main.dungeonY; - if (downedBoss3) - { - this.ai[3] = 1f; - this.netUpdate = true; - } - if ((Main.dayTime || !flag7) || (this.ai[3] != 0f)) - { - goto Label_4417; - } - flag8 = true; - for (int num69 = 0; num69 < 0x3e8; num69++) - { - if (Main.npc[num69].active && (Main.npc[num69].type == 0x23)) - { - flag8 = false; - break; - } - } - } - else - { - if (((this.target < 0) || (this.target == 8)) || Main.player[this.target].dead) - { - this.TargetClosest(); - } - if (Main.player[this.target].dead && (this.timeLeft > 10)) - { - this.timeLeft = 10; - } - if (Main.netMode != 1) - { - if (((((this.type == 7) || (this.type == 8)) || ((this.type == 10) || (this.type == 11))) || (((this.type == 13) || (this.type == 14)) || ((this.type == 0x27) || (this.type == 40)))) && (this.ai[0] == 0f)) - { - if (((this.type == 7) || (this.type == 10)) || ((this.type == 13) || (this.type == 0x27))) - { - this.ai[2] = 10f; - if (this.type == 10) - { - this.ai[2] = 5f; - } - if (this.type == 13) - { - this.ai[2] = 50f; - } - if (this.type == 0x27) - { - this.ai[2] = 15f; - } - this.ai[0] = NewNPC((int) this.position.X, (int) this.position.Y, this.type + 1, this.whoAmI); - } - else if ((((this.type == 8) || (this.type == 11)) || ((this.type == 14) || (this.type == 40))) && (this.ai[2] > 0f)) - { - this.ai[0] = NewNPC((int) this.position.X, (int) this.position.Y, this.type, this.whoAmI); - } - else - { - this.ai[0] = NewNPC((int) this.position.X, (int) this.position.Y, this.type + 1, this.whoAmI); - } - Main.npc[(int) this.ai[0]].ai[1] = this.whoAmI; - Main.npc[(int) this.ai[0]].ai[2] = this.ai[2] - 1f; - this.netUpdate = true; - } - if (((((this.type == 8) || (this.type == 9)) || ((this.type == 11) || (this.type == 12))) || ((this.type == 40) || (this.type == 0x29))) && !Main.npc[(int) this.ai[1]].active) - { - this.life = 0; - this.HitEffect(0, 10.0); - this.active = false; - } - if (((((this.type == 7) || (this.type == 8)) || ((this.type == 10) || (this.type == 11))) || ((this.type == 0x27) || (this.type == 40))) && !Main.npc[(int) this.ai[0]].active) - { - this.life = 0; - this.HitEffect(0, 10.0); - this.active = false; - } - if (((this.type == 13) || (this.type == 14)) || (this.type == 15)) - { - if (!Main.npc[(int) this.ai[1]].active && !Main.npc[(int) this.ai[0]].active) - { - this.life = 0; - this.HitEffect(0, 10.0); - this.active = false; - } - if ((this.type == 13) && !Main.npc[(int) this.ai[0]].active) - { - this.life = 0; - this.HitEffect(0, 10.0); - this.active = false; - } - if ((this.type == 15) && !Main.npc[(int) this.ai[1]].active) - { - this.life = 0; - this.HitEffect(0, 10.0); - this.active = false; - } - if ((this.type == 14) && !Main.npc[(int) this.ai[1]].active) - { - this.type = 13; - int whoAmI = this.whoAmI; - int life = this.life; - float num47 = this.ai[0]; - this.SetDefaults(this.type); - this.life = life; - if (this.life > this.lifeMax) - { - this.life = this.lifeMax; - } - this.ai[0] = num47; - this.TargetClosest(); - this.netUpdate = true; - this.whoAmI = whoAmI; - } - if ((this.type == 14) && !Main.npc[(int) this.ai[0]].active) - { - int num48 = this.life; - int num49 = this.whoAmI; - float num50 = this.ai[1]; - this.SetDefaults(this.type); - this.life = num48; - if (this.life > this.lifeMax) - { - this.life = this.lifeMax; - } - this.ai[1] = num50; - this.TargetClosest(); - this.netUpdate = true; - this.whoAmI = num49; - } - if (this.life == 0) - { - bool flag5 = true; - for (int num51 = 0; num51 < 0x3e8; num51++) - { - if (Main.npc[num51].active && (((Main.npc[num51].type == 13) || (Main.npc[num51].type == 14)) || (Main.npc[num51].type == 15))) - { - flag5 = false; - break; - } - } - if (flag5) - { - this.boss = true; - this.NPCLoot(); - } - } - } - if (!this.active && (Main.netMode == 2)) - { - NetMessage.SendData(0x1c, -1, -1, "", this.whoAmI, -1f, 0f, 0f); - } - } - int num52 = ((int) (this.position.X / 16f)) - 1; - int maxTilesX = ((int) ((this.position.X + this.width) / 16f)) + 2; - int num54 = ((int) (this.position.Y / 16f)) - 1; - int maxTilesY = ((int) ((this.position.Y + this.height) / 16f)) + 2; - if (num52 < 0) - { - num52 = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num54 < 0) - { - num54 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - bool flag6 = false; - for (int num56 = num52; num56 < maxTilesX; num56++) - { - for (int num57 = num54; num57 < maxTilesY; num57++) - { - if ((Main.tile[num56, num57] != null) && ((Main.tile[num56, num57].active && (Main.tileSolid[Main.tile[num56, num57].type] || (Main.tileSolidTop[Main.tile[num56, num57].type] && (Main.tile[num56, num57].frameY == 0)))) || (Main.tile[num56, num57].liquid > 0x40))) - { - Vector2 vector8; - vector8.X = num56 * 0x10; - vector8.Y = num57 * 0x10; - if ((((this.position.X + this.width) > vector8.X) && (this.position.X < (vector8.X + 16f))) && (((this.position.Y + this.height) > vector8.Y) && (this.position.Y < (vector8.Y + 16f)))) - { - flag6 = true; - if ((Main.rand.Next(40) == 0) && Main.tile[num56, num57].active) - { - WorldGen.KillTile(num56, num57, true, true, false); - } - if ((Main.netMode != 1) && (Main.tile[num56, num57].type == 2)) - { - byte type = Main.tile[num56, num57 - 1].type; - } - } - } - } - } - float num58 = 8f; - float num59 = 0.07f; - if (this.type == 10) - { - num58 = 6f; - num59 = 0.05f; - } - if (this.type == 13) - { - num58 = 11f; - num59 = 0.08f; - } - Vector2 vector9 = new Vector2(this.position.X + (this.width * 0.5f), this.position.Y + (this.height * 0.5f)); - float num60 = (Main.player[this.target].position.X + (Main.player[this.target].width / 2)) - vector9.X; - float num61 = (Main.player[this.target].position.Y + (Main.player[this.target].height / 2)) - vector9.Y; - float num62 = (float) Math.Sqrt((double) ((num60 * num60) + (num61 * num61))); - if (this.ai[1] > 0f) - { - num60 = (Main.npc[(int) this.ai[1]].position.X + (Main.npc[(int) this.ai[1]].width / 2)) - vector9.X; - num61 = (Main.npc[(int) this.ai[1]].position.Y + (Main.npc[(int) this.ai[1]].height / 2)) - vector9.Y; - this.rotation = ((float) Math.Atan2((double) num61, (double) num60)) + 1.57f; - num62 = (float) Math.Sqrt((double) ((num60 * num60) + (num61 * num61))); - num62 = (num62 - this.width) / num62; - num60 *= num62; - num61 *= num62; - this.velocity = new Vector2(); - this.position.X += num60; - this.position.Y += num61; - return; - } - if (!flag6) - { - this.TargetClosest(); - this.velocity.Y += 0.11f; - if (this.velocity.Y > num58) - { - this.velocity.Y = num58; - } - if ((Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) < (num58 * 0.4)) - { - if (this.velocity.X < 0f) - { - this.velocity.X -= num59 * 1.1f; - } - else - { - this.velocity.X += num59 * 1.1f; - } - } - else if (this.velocity.Y == num58) - { - if (this.velocity.X < num60) - { - this.velocity.X += num59; - } - else if (this.velocity.X > num60) - { - this.velocity.X -= num59; - } - } - else if (this.velocity.Y > 4f) - { - if (this.velocity.X < 0f) - { - this.velocity.X += num59 * 0.9f; - } - else - { - this.velocity.X -= num59 * 0.9f; - } - } - } - else - { - if (this.soundDelay == 0) - { - float num63 = num62 / 40f; - if (num63 < 10f) - { - num63 = 10f; - } - if (num63 > 20f) - { - num63 = 20f; - } - this.soundDelay = (int) num63; - Main.PlaySound(15, (int) this.position.X, (int) this.position.Y, 1); - } - num62 = (float) Math.Sqrt((double) ((num60 * num60) + (num61 * num61))); - float num64 = Math.Abs(num60); - float num65 = Math.Abs(num61); - num62 = num58 / num62; - num60 *= num62; - num61 *= num62; - if ((((this.velocity.X > 0f) && (num60 > 0f)) || ((this.velocity.X < 0f) && (num60 < 0f))) || (((this.velocity.Y > 0f) && (num61 > 0f)) || ((this.velocity.Y < 0f) && (num61 < 0f)))) - { - if (this.velocity.X < num60) - { - this.velocity.X += num59; - } - else if (this.velocity.X > num60) - { - this.velocity.X -= num59; - } - if (this.velocity.Y < num61) - { - this.velocity.Y += num59; - } - else if (this.velocity.Y > num61) - { - this.velocity.Y -= num59; - } - } - else if (num64 > num65) - { - if (this.velocity.X < num60) - { - this.velocity.X += num59 * 1.1f; - } - else if (this.velocity.X > num60) - { - this.velocity.X -= num59 * 1.1f; - } - if ((Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) < (num58 * 0.5)) - { - if (this.velocity.Y > 0f) - { - this.velocity.Y += num59; - } - else - { - this.velocity.Y -= num59; - } - } - } - else - { - if (this.velocity.Y < num61) - { - this.velocity.Y += num59 * 1.1f; - } - else if (this.velocity.Y > num61) - { - this.velocity.Y -= num59 * 1.1f; - } - if ((Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) < (num58 * 0.5)) - { - if (this.velocity.X > 0f) - { - this.velocity.X += num59; - } - else - { - this.velocity.X -= num59; - } - } - } - } - this.rotation = ((float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X)) + 1.57f; - return; - } - if (flag8) - { - int num70 = NewNPC(((int) this.position.X) + (this.width / 2), ((int) this.position.Y) + (this.height / 2), 0x23, 0); - Main.npc[num70].netUpdate = true; - string str = "Skeletron"; - if (Main.netMode == 0) - { - Main.NewText(str + " has awoken!", 0xaf, 0x4b, 0xff); - } - else if (Main.netMode == 2) - { - NetMessage.SendData(0x19, -1, -1, str + " has awoken!", 8, 175f, 75f, 255f); - } - } - this.ai[3] = 1f; - this.netUpdate = true; - Label_4417: - if ((((Main.netMode != 1) && !Main.dayTime) && ((num66 != this.homeTileX) || (num67 != this.homeTileY))) && !this.homeless) - { - bool flag9 = true; - for (int num71 = 0; num71 < 2; num71++) - { - Rectangle rectangle = new Rectangle(((((int) this.position.X) + (this.width / 2)) - (Main.screenWidth / 2)) - safeRangeX, ((((int) this.position.Y) + (this.height / 2)) - (Main.screenHeight / 2)) - safeRangeY, Main.screenWidth + (safeRangeX * 2), Main.screenHeight + (safeRangeY * 2)); - if (num71 == 1) - { - rectangle = new Rectangle((((this.homeTileX * 0x10) + 8) - (Main.screenWidth / 2)) - safeRangeX, (((this.homeTileY * 0x10) + 8) - (Main.screenHeight / 2)) - safeRangeY, Main.screenWidth + (safeRangeX * 2), Main.screenHeight + (safeRangeY * 2)); - } - for (int num72 = 0; num72 < 8; num72++) - { - if (Main.player[num72].active) - { - Rectangle rectangle2 = new Rectangle((int) Main.player[num72].position.X, (int) Main.player[num72].position.Y, Main.player[num72].width, Main.player[num72].height); - if (rectangle2.Intersects(rectangle)) - { - flag9 = false; - break; - } - } - if (!flag9) - { - break; - } - } - } - if (flag9) - { - if ((this.type == 0x25) || !Collision.SolidTiles(this.homeTileX - 1, this.homeTileX + 1, this.homeTileY - 3, this.homeTileY - 1)) - { - this.velocity.X = 0f; - this.velocity.Y = 0f; - this.position.X = ((this.homeTileX * 0x10) + 8) - (this.width / 2); - this.position.Y = ((this.homeTileY * 0x10) - this.height) - 0.1f; - this.netUpdate = true; - } - else - { - this.homeless = true; - WorldGen.QuickFindHome(this.whoAmI); - } - } - } - if (this.ai[0] == 0f) - { - if (this.ai[2] > 0f) - { - this.ai[2]--; - } - if (!Main.dayTime && !flag7) - { - if (Main.netMode != 1) - { - if ((num66 == this.homeTileX) && (num67 == this.homeTileY)) - { - if (this.velocity.X != 0f) - { - this.netUpdate = true; - } - if (this.velocity.X > 0.1) - { - this.velocity.X -= 0.1f; - } - else if (this.velocity.X < -0.1) - { - this.velocity.X += 0.1f; - } - else - { - this.velocity.X = 0f; - } - } - else if (!flag7) - { - if (num66 > this.homeTileX) - { - this.direction = -1; - } - else - { - this.direction = 1; - } - this.ai[0] = 1f; - this.ai[1] = 200 + Main.rand.Next(200); - this.ai[2] = 0f; - this.netUpdate = true; - } - } - } - else - { - if (this.velocity.X > 0.1) - { - this.velocity.X -= 0.1f; - } - else if (this.velocity.X < -0.1) - { - this.velocity.X += 0.1f; - } - else - { - this.velocity.X = 0f; - } - if (this.ai[1] > 0f) - { - this.ai[1]--; - } - if (this.ai[1] <= 0f) - { - this.ai[0] = 1f; - this.ai[1] = 200 + Main.rand.Next(200); - this.ai[2] = 0f; - this.netUpdate = true; - } - } - if ((Main.netMode != 1) && (Main.dayTime || ((num66 == this.homeTileX) && (num67 == this.homeTileY)))) - { - if ((num66 >= (this.homeTileX - 0x19)) && (num66 <= (this.homeTileX + 0x19))) - { - if ((Main.rand.Next(80) == 0) && (this.ai[2] == 0f)) - { - this.ai[2] = 200f; - this.direction *= -1; - this.netUpdate = true; - return; - } - } - else if (this.ai[2] == 0f) - { - if ((num66 < (this.homeTileX - 50)) && (this.direction == -1)) - { - this.direction = 1; - this.netUpdate = true; - return; - } - if ((num66 > (this.homeTileX + 50)) && (this.direction == 1)) - { - this.direction = -1; - this.netUpdate = true; - return; - } - } - } - return; - } - if (this.ai[0] == 1f) - { - if (((Main.netMode != 1) && !Main.dayTime) && ((num66 == this.homeTileX) && (num67 == this.homeTileY))) - { - this.ai[0] = 0f; - this.ai[1] = 200 + Main.rand.Next(200); - this.ai[2] = 60f; - this.netUpdate = true; - return; - } - if (((Main.netMode != 1) && !this.homeless) && ((num66 < (this.homeTileX - 0x23)) || (num66 > (this.homeTileX + 0x23)))) - { - if ((this.position.X < (this.homeTileX * 0x10)) && (this.direction == -1)) - { - this.direction = 1; - this.velocity.X = 0.1f; - this.netUpdate = true; - } - else if ((this.position.X > (this.homeTileX * 0x10)) && (this.direction == 1)) - { - this.direction = -1; - this.velocity.X = -0.1f; - this.netUpdate = true; - } - } - this.ai[1]--; - if (this.ai[1] <= 0f) - { - this.ai[0] = 0f; - this.ai[1] = 300 + Main.rand.Next(300); - this.ai[2] = 60f; - this.netUpdate = true; - } - if (this.closeDoor && ((((this.position.X + (this.width / 2)) / 16f) > (this.doorX + 2)) || (((this.position.X + (this.width / 2)) / 16f) < (this.doorX - 2)))) - { - if (WorldGen.CloseDoor(this.doorX, this.doorY, false)) - { - this.closeDoor = false; - NetMessage.SendData(0x13, -1, -1, "", 1, (float) this.doorX, (float) this.doorY, (float) this.direction); - } - if (((((this.position.X + (this.width / 2)) / 16f) > (this.doorX + 4)) || (((this.position.X + (this.width / 2)) / 16f) < (this.doorX - 4))) || ((((this.position.Y + (this.height / 2)) / 16f) > (this.doorY + 4)) || (((this.position.Y + (this.height / 2)) / 16f) < (this.doorY - 4)))) - { - this.closeDoor = false; - } - } - if ((this.velocity.X < -1f) || (this.velocity.X > 1f)) - { - if (this.velocity.Y == 0f) - { - this.velocity = (Vector2) (this.velocity * 0.8f); - } - } - else if ((this.velocity.X < 1.15) && (this.direction == 1)) - { - this.velocity.X += 0.07f; - if (this.velocity.X > 1f) - { - this.velocity.X = 1f; - } - } - else if ((this.velocity.X > -1f) && (this.direction == -1)) - { - this.velocity.X -= 0.07f; - if (this.velocity.X > 1f) - { - this.velocity.X = 1f; - } - } - if (this.velocity.Y != 0f) - { - return; - } - if (this.position.X == this.ai[2]) - { - this.direction *= -1; - } - this.ai[2] = -1f; - int num73 = (int) (((this.position.X + (this.width / 2)) + (15 * this.direction)) / 16f); - int num74 = (int) (((this.position.Y + this.height) - 16f) / 16f); - if (Main.tile[num73, num74] == null) - { - Main.tile[num73, num74] = new Tile(); - } - if (Main.tile[num73, num74 - 1] == null) - { - Main.tile[num73, num74 - 1] = new Tile(); - } - if (Main.tile[num73, num74 - 2] == null) - { - Main.tile[num73, num74 - 2] = new Tile(); - } - if (Main.tile[num73, num74 - 3] == null) - { - Main.tile[num73, num74 - 3] = new Tile(); - } - if (Main.tile[num73, num74 + 1] == null) - { - Main.tile[num73, num74 + 1] = new Tile(); - } - if (Main.tile[num73 + this.direction, num74 - 1] == null) - { - Main.tile[num73 + this.direction, num74 - 1] = new Tile(); - } - if (Main.tile[num73 + this.direction, num74 + 1] == null) - { - Main.tile[num73 + this.direction, num74 + 1] = new Tile(); - } - if ((Main.tile[num73, num74 - 2].active && (Main.tile[num73, num74 - 2].type == 10)) && ((Main.rand.Next(10) == 0) || !Main.dayTime)) - { - if (Main.netMode != 1) - { - if (WorldGen.OpenDoor(num73, num74 - 2, this.direction)) - { - this.closeDoor = true; - this.doorX = num73; - this.doorY = num74 - 2; - NetMessage.SendData(0x13, -1, -1, "", 0, (float) num73, (float) (num74 - 2), (float) this.direction); - this.netUpdate = true; - this.ai[1] += 80f; - return; - } - if (WorldGen.OpenDoor(num73, num74 - 2, -this.direction)) - { - this.closeDoor = true; - this.doorX = num73; - this.doorY = num74 - 2; - NetMessage.SendData(0x13, -1, -1, "", 0, (float) num73, (float) (num74 - 2), (float) -this.direction); - this.netUpdate = true; - this.ai[1] += 80f; - return; - } - this.direction *= -1; - this.netUpdate = true; - return; - } - return; - } - if (((this.velocity.X < 0f) && (this.spriteDirection == -1)) || ((this.velocity.X > 0f) && (this.spriteDirection == 1))) - { - if ((Main.tile[num73, num74 - 2].active && Main.tileSolid[Main.tile[num73, num74 - 2].type]) && !Main.tileSolidTop[Main.tile[num73, num74 - 2].type]) - { - if (((this.direction == 1) && !Collision.SolidTiles(num73 - 2, num73 - 1, num74 - 5, num74 - 1)) || ((this.direction == -1) && !Collision.SolidTiles(num73 + 1, num73 + 2, num74 - 5, num74 - 1))) - { - if (!Collision.SolidTiles(num73, num73, num74 - 5, num74 - 3)) - { - this.velocity.Y = -6f; - this.netUpdate = true; - } - else - { - this.direction *= -1; - this.netUpdate = true; - } - } - else - { - this.direction *= -1; - this.netUpdate = true; - } - } - else if ((Main.tile[num73, num74 - 1].active && Main.tileSolid[Main.tile[num73, num74 - 1].type]) && !Main.tileSolidTop[Main.tile[num73, num74 - 1].type]) - { - if (((this.direction == 1) && !Collision.SolidTiles(num73 - 2, num73 - 1, num74 - 4, num74 - 1)) || ((this.direction == -1) && !Collision.SolidTiles(num73 + 1, num73 + 2, num74 - 4, num74 - 1))) - { - if (!Collision.SolidTiles(num73, num73, num74 - 4, num74 - 2)) - { - this.velocity.Y = -5f; - this.netUpdate = true; - } - else - { - this.direction *= -1; - this.netUpdate = true; - } - } - else - { - this.direction *= -1; - this.netUpdate = true; - } - } - else if ((Main.tile[num73, num74].active && Main.tileSolid[Main.tile[num73, num74].type]) && !Main.tileSolidTop[Main.tile[num73, num74].type]) - { - if (((this.direction == 1) && !Collision.SolidTiles(num73 - 2, num73, num74 - 3, num74 - 1)) || ((this.direction == -1) && !Collision.SolidTiles(num73, num73 + 2, num74 - 3, num74 - 1))) - { - this.velocity.Y = -3.6f; - this.netUpdate = true; - } - else - { - this.direction *= -1; - this.netUpdate = true; - } - } - else if (((((((Main.netMode != 1) && (num66 >= (this.homeTileX - 0x23))) && (num66 <= (this.homeTileX + 0x23))) && (!Main.tile[num73, num74 + 1].active || !Main.tileSolid[Main.tile[num73, num74 + 1].type])) && (!Main.tile[num73 - this.direction, num74 + 1].active || !Main.tileSolid[Main.tile[num73 - this.direction, num74 + 1].type])) && ((!Main.tile[num73, num74 + 2].active || !Main.tileSolid[Main.tile[num73, num74 + 2].type]) && (!Main.tile[num73 - this.direction, num74 + 2].active || !Main.tileSolid[Main.tile[num73 - this.direction, num74 + 2].type]))) && (((!Main.tile[num73, num74 + 3].active || !Main.tileSolid[Main.tile[num73, num74 + 3].type]) && (!Main.tile[num73 - this.direction, num74 + 3].active || !Main.tileSolid[Main.tile[num73 - this.direction, num74 + 3].type])) && ((!Main.tile[num73, num74 + 4].active || !Main.tileSolid[Main.tile[num73, num74 + 4].type]) && (!Main.tile[num73 - this.direction, num74 + 4].active || !Main.tileSolid[Main.tile[num73 - this.direction, num74 + 4].type])))) - { - this.direction *= -1; - this.velocity.X *= -1f; - this.netUpdate = true; - } - if (this.velocity.Y < 0f) - { - this.ai[2] = this.position.X; - } - } - if ((this.velocity.Y >= 0f) || !this.wet) - { - return; - } - this.velocity.Y *= 1.2f; - } - return; - Label_5D99: - if (this.ai[1] > 0f) - { - this.ai[1]--; - if (this.ai[1] == 25f) - { - Main.PlaySound(2, (int) this.position.X, (int) this.position.Y, 8); - if (Main.netMode != 1) - { - if (this.type == 0x1d) - { - NewNPC(((int) this.position.X) + (this.width / 2), ((int) this.position.Y) - 8, 30, 0); - } - else if (this.type == 0x20) - { - NewNPC(((int) this.position.X) + (this.width / 2), ((int) this.position.Y) - 8, 0x21, 0); - } - else - { - NewNPC((((int) this.position.X) + (this.width / 2)) + (this.direction * 8), ((int) this.position.Y) + 20, 0x19, 0); - } - } - } - } - if (this.type == 0x1d) - { - if (Main.rand.Next(5) == 0) - { - int num92 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 2f), this.width, this.height, 0x1b, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, new Color(), 1.5f); - Main.dust[num92].noGravity = true; - Main.dust[num92].velocity.X *= 0.5f; - Main.dust[num92].velocity.Y = -2f; - } - } - else if (this.type == 0x20) - { - if (Main.rand.Next(2) == 0) - { - int num93 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 2f), this.width, this.height, 0x1d, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, new Color(), 2f); - Main.dust[num93].noGravity = true; - Main.dust[num93].velocity.X *= 1f; - Main.dust[num93].velocity.Y *= 1f; - } - } - else if (Main.rand.Next(2) == 0) - { - int num94 = Dust.NewDust(new Vector2(this.position.X, this.position.Y + 2f), this.width, this.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, new Color(), 2f); - Main.dust[num94].noGravity = true; - Main.dust[num94].velocity.X *= 1f; - Main.dust[num94].velocity.Y *= 1f; - } - } - - public void CheckActive() - { - if (this.active && ((((this.type != 8) && (this.type != 9)) && ((this.type != 11) && (this.type != 12))) && (((this.type != 14) && (this.type != 15)) && ((this.type != 40) && (this.type != 0x29))))) - { - if (this.townNPC) - { - if (this.position.Y < (Main.worldSurface * 18.0)) - { - Rectangle rectangle = new Rectangle((((int) this.position.X) + (this.width / 2)) - townRangeX, (((int) this.position.Y) + (this.height / 2)) - townRangeY, townRangeX * 2, townRangeY * 2); - for (int i = 0; i < 8; i++) - { - if (Main.player[i].active && rectangle.Intersects(new Rectangle((int) Main.player[i].position.X, (int) Main.player[i].position.Y, Main.player[i].width, Main.player[i].height))) - { - Player player1 = Main.player[i]; - player1.townNPCs++; - } - } - } - } - else - { - bool flag = false; - Rectangle rectangle2 = new Rectangle((((int) this.position.X) + (this.width / 2)) - activeRangeX, (((int) this.position.Y) + (this.height / 2)) - activeRangeY, activeRangeX * 2, activeRangeY * 2); - Rectangle rectangle3 = new Rectangle(((int) ((this.position.X + (this.width / 2)) - (Main.screenWidth * 0.5))) - this.width, ((int) ((this.position.Y + (this.height / 2)) - (Main.screenHeight * 0.5))) - this.height, Main.screenWidth + (this.width * 2), Main.screenHeight + (this.height * 2)); - for (int j = 0; j < 8; j++) - { - if (Main.player[j].active) - { - if (rectangle2.Intersects(new Rectangle((int) Main.player[j].position.X, (int) Main.player[j].position.Y, Main.player[j].width, Main.player[j].height))) - { - flag = true; - if (((this.type != 0x19) && (this.type != 30)) && (this.type != 0x21)) - { - Player player2 = Main.player[j]; - player2.activeNPCs++; - } - } - if (rectangle3.Intersects(new Rectangle((int) Main.player[j].position.X, (int) Main.player[j].position.Y, Main.player[j].width, Main.player[j].height))) - { - this.timeLeft = activeTime; - } - if (((this.type == 7) || (this.type == 10)) || (this.type == 13)) - { - flag = true; - } - if ((this.boss || (this.type == 0x23)) || (this.type == 0x24)) - { - flag = true; - } - } - } - this.timeLeft--; - if (this.timeLeft <= 0) - { - flag = false; - } - if (!flag && (Main.netMode != 1)) - { - this.active = false; - if (Main.netMode == 2) - { - this.life = 0; - NetMessage.SendData(0x17, -1, -1, "", this.whoAmI, 0f, 0f, 0f); - } - } - } - } - } - - public void FindFrame() - { - int num = Main.npcTexture[this.type].Height / Main.npcFrameCount[this.type]; - int num2 = 0; - if (this.aiAction == 0) - { - if (this.velocity.Y < 0f) - { - num2 = 2; - } - else if (this.velocity.Y > 0f) - { - num2 = 3; - } - else if (this.velocity.X != 0f) - { - num2 = 1; - } - else - { - num2 = 0; - } - } - else if (this.aiAction == 1) - { - num2 = 4; - } - if ((this.type == 1) || (this.type == 0x10)) - { - this.frameCounter++; - if (num2 > 0) - { - this.frameCounter++; - } - if (num2 == 4) - { - this.frameCounter++; - } - if (this.frameCounter >= 8.0) - { - this.frame.Y += num; - this.frameCounter = 0.0; - } - if (this.frame.Y >= (num * Main.npcFrameCount[this.type])) - { - this.frame.Y = 0; - } - } - if ((this.type == 2) || (this.type == 0x17)) - { - if (this.velocity.X > 0f) - { - this.spriteDirection = 1; - this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X); - } - if (this.velocity.X < 0f) - { - this.spriteDirection = -1; - this.rotation = ((float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X)) + 3.14f; - } - this.frameCounter++; - if (this.frameCounter >= 8.0) - { - this.frame.Y += num; - this.frameCounter = 0.0; - } - if (this.frame.Y >= (num * Main.npcFrameCount[this.type])) - { - this.frame.Y = 0; - } - } - if (this.type == 0x2a) - { - if (this.velocity.X > 0f) - { - this.spriteDirection = 1; - this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X); - } - if (this.velocity.X < 0f) - { - this.spriteDirection = -1; - this.rotation = ((float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X)) + 3.14f; - } - this.frameCounter++; - if (this.frameCounter < 4.0) - { - this.frame.Y = 0; - } - else if (this.frameCounter < 8.0) - { - this.frame.Y = num; - } - else if (this.frameCounter < 12.0) - { - this.frame.Y = num * 2; - } - else if (this.frameCounter < 16.0) - { - this.frame.Y = num; - } - if (this.frameCounter == 15.0) - { - this.frameCounter = 0.0; - } - } - if (this.type == 0x2b) - { - this.frameCounter++; - if (this.frameCounter < 6.0) - { - this.frame.Y = 0; - } - else if (this.frameCounter < 12.0) - { - this.frame.Y = num; - } - else if (this.frameCounter < 18.0) - { - this.frame.Y = num * 2; - } - else if (this.frameCounter < 24.0) - { - this.frame.Y = num; - } - if (this.frameCounter == 23.0) - { - this.frameCounter = 0.0; - } - } - if ((((this.type == 0x11) || (this.type == 0x12)) || ((this.type == 0x13) || (this.type == 20))) || ((((this.type == 0x16) || (this.type == 0x26)) || ((this.type == 0x1a) || (this.type == 0x1b))) || (((this.type == 0x1c) || (this.type == 0x1f)) || (this.type == 0x15)))) - { - if (this.velocity.Y == 0f) - { - if (this.direction == 1) - { - this.spriteDirection = 1; - } - if (this.direction == -1) - { - this.spriteDirection = -1; - } - if (this.velocity.X == 0f) - { - this.frame.Y = 0; - this.frameCounter = 0.0; - } - else - { - this.frameCounter += Math.Abs(this.velocity.X) * 2f; - this.frameCounter++; - if (this.frameCounter > 6.0) - { - this.frame.Y += num; - this.frameCounter = 0.0; - } - if ((this.frame.Y / num) >= Main.npcFrameCount[this.type]) - { - this.frame.Y = num * 2; - } - } - } - else - { - this.frameCounter = 0.0; - this.frame.Y = num; - } - } - else if ((((this.type == 3) || this.townNPC) || ((this.type == 0x15) || (this.type == 0x1a))) || (((this.type == 0x1b) || (this.type == 0x1c)) || (this.type == 0x1f))) - { - if (this.velocity.Y == 0f) - { - if (this.direction == 1) - { - this.spriteDirection = 1; - } - if (this.direction == -1) - { - this.spriteDirection = -1; - } - } - if (((this.velocity.Y != 0f) || ((this.direction == -1) && (this.velocity.X > 0f))) || ((this.direction == 1) && (this.velocity.X < 0f))) - { - this.frameCounter = 0.0; - this.frame.Y = num * 2; - } - else if (this.velocity.X == 0f) - { - this.frameCounter = 0.0; - this.frame.Y = 0; - } - else - { - this.frameCounter += Math.Abs(this.velocity.X); - if (this.frameCounter < 8.0) - { - this.frame.Y = 0; - } - else if (this.frameCounter < 16.0) - { - this.frame.Y = num; - } - else if (this.frameCounter < 24.0) - { - this.frame.Y = num * 2; - } - else if (this.frameCounter < 32.0) - { - this.frame.Y = num; - } - else - { - this.frameCounter = 0.0; - } - } - } - else if (this.type == 4) - { - this.frameCounter++; - if (this.frameCounter < 7.0) - { - this.frame.Y = 0; - } - else if (this.frameCounter < 14.0) - { - this.frame.Y = num; - } - else if (this.frameCounter < 21.0) - { - this.frame.Y = num * 2; - } - else - { - this.frameCounter = 0.0; - this.frame.Y = 0; - } - if (this.ai[0] > 1f) - { - this.frame.Y += num * 3; - } - } - else if (this.type == 5) - { - this.frameCounter++; - if (this.frameCounter >= 8.0) - { - this.frame.Y += num; - this.frameCounter = 0.0; - } - if (this.frame.Y >= (num * Main.npcFrameCount[this.type])) - { - this.frame.Y = 0; - } - } - else if (this.type == 6) - { - this.frameCounter++; - if (this.frameCounter >= 8.0) - { - this.frame.Y += num; - this.frameCounter = 0.0; - } - if (this.frame.Y >= (num * Main.npcFrameCount[this.type])) - { - this.frame.Y = 0; - } - } - else if (this.type == 0x18) - { - if (this.velocity.Y == 0f) - { - if (this.direction == 1) - { - this.spriteDirection = 1; - } - if (this.direction == -1) - { - this.spriteDirection = -1; - } - } - if (this.ai[1] > 0f) - { - if (this.frame.Y < 4) - { - this.frameCounter = 0.0; - } - this.frameCounter++; - if (this.frameCounter <= 4.0) - { - this.frame.Y = num * 4; - } - else if (this.frameCounter <= 8.0) - { - this.frame.Y = num * 5; - } - else if (this.frameCounter <= 12.0) - { - this.frame.Y = num * 6; - } - else if (this.frameCounter <= 16.0) - { - this.frame.Y = num * 7; - } - else if (this.frameCounter <= 20.0) - { - this.frame.Y = num * 8; - } - else - { - this.frame.Y = num * 9; - this.frameCounter = 100.0; - } - } - else - { - this.frameCounter++; - if (this.frameCounter <= 4.0) - { - this.frame.Y = 0; - } - else if (this.frameCounter <= 8.0) - { - this.frame.Y = num; - } - else if (this.frameCounter <= 12.0) - { - this.frame.Y = num * 2; - } - else - { - this.frame.Y = num * 3; - if (this.frameCounter >= 16.0) - { - this.frameCounter = 0.0; - } - } - } - } - else if ((this.type == 0x1d) || (this.type == 0x20)) - { - if (this.velocity.Y == 0f) - { - if (this.direction == 1) - { - this.spriteDirection = 1; - } - if (this.direction == -1) - { - this.spriteDirection = -1; - } - } - this.frame.Y = 0; - if (this.velocity.Y != 0f) - { - this.frame.Y += num; - } - else if (this.ai[1] > 0f) - { - this.frame.Y += num * 2; - } - } - if (this.type == 0x22) - { - if (this.velocity.X > 0f) - { - this.spriteDirection = -1; - this.rotation = (float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X); - } - if (this.velocity.X < 0f) - { - this.spriteDirection = 1; - this.rotation = ((float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X)) + 3.14f; - } - this.frameCounter++; - if (this.frameCounter >= 4.0) - { - this.frame.Y += num; - this.frameCounter = 0.0; - } - if (this.frame.Y >= (num * Main.npcFrameCount[this.type])) - { - this.frame.Y = 0; - } - } - } - - public Color GetAlpha(Color newColor) - { - int r = newColor.R - this.alpha; - int g = newColor.G - this.alpha; - int b = newColor.B - this.alpha; - int a = newColor.A - this.alpha; - if (((this.type == 0x19) || (this.type == 30)) || (this.type == 0x21)) - { - r = newColor.R; - g = newColor.G; - b = newColor.B; - } - if (a < 0) - { - a = 0; - } - if (a > 0xff) - { - a = 0xff; - } - return new Color(r, g, b, a); - } - - public string GetChat() - { - bool flag = false; - bool flag2 = false; - bool flag3 = false; - bool flag4 = false; - bool flag5 = false; - bool flag6 = false; - for (int i = 0; i < 0x3e8; i++) - { - if (Main.npc[i].type == 0x11) - { - flag = true; - } - else if (Main.npc[i].type == 0x12) - { - flag2 = true; - } - else if (Main.npc[i].type == 0x13) - { - flag3 = true; - } - else if (Main.npc[i].type == 20) - { - flag4 = true; - } - else if (Main.npc[i].type == 0x25) - { - flag5 = true; - } - else if (Main.npc[i].type == 0x26) - { - flag6 = true; - } - } - string str = ""; - if (this.type == 0x11) - { - if (Main.dayTime) - { - if (Main.time < 16200.0) - { - if (Main.rand.Next(2) == 0) - { - return "Sword beats paper, get one today."; - } - return "Lovely morning, wouldn't you say? Was there something you needed?"; - } - if (Main.time > 37800.0) - { - if (Main.rand.Next(2) == 0) - { - return "Night be upon us soon, friend. Make your choices while you can."; - } - return ("Ah, they will tell tales of " + Main.player[Main.myPlayer].name + " some day... good ones I'm sure."); - } - switch (Main.rand.Next(3)) - { - case 0: - str = "Check out my dirt blocks, they are extra dirty."; - break; - - case 1: - return "Boy, that sun is hot! I do have some perfectly ventilated armor."; - } - return "The sun is high, but my prices are not."; - } - if (Main.bloodMoon) - { - if (Main.rand.Next(2) == 0) - { - return "Have you seen Chith...Shith.. Chat... The big eye?"; - } - return "Keep your eye on the prize, buy a lense!"; - } - if (Main.time < 9720.0) - { - if (Main.rand.Next(2) == 0) - { - return "Kosh, kapleck Mog. Oh sorry, thats klingon for 'Buy something or die.'"; - } - return (Main.player[Main.myPlayer].name + " is it? I've heard good things, friend!"); - } - if (Main.time > 22680.0) - { - if (Main.rand.Next(2) == 0) - { - return "I hear there's a secret treasure... oh never mind."; - } - return "Angel Statue you say? I'm sorry, I'm not a junk dealer."; - } - int num8 = Main.rand.Next(3); - if (num8 == 0) - { - str = "The last guy who was here left me some junk..er I mean.. treasures!"; - } - if (num8 == 1) - { - return "I wonder if the moon is made of cheese...huh, what? Oh yes, buy something!"; - } - return "Did you say gold? I'll take that off of ya'."; - } - if (this.type == 0x12) - { - if (flag6 && (Main.rand.Next(4) == 0)) - { - return "I wish that bomb maker would be more careful. I'm getting tired of having to sew his limbs back on every day."; - } - if (Main.player[Main.myPlayer].statLife < (Main.player[Main.myPlayer].statLifeMax * 0.33)) - { - switch (Main.rand.Next(5)) - { - case 0: - return "I think you look better this way."; - - case 1: - return "Eww.. What happened to your face?"; - - case 2: - return "MY GOODNESS! I'm good but I'm not THAT good."; - - case 3: - return "Dear friends we are gathered here today to bid farewell... oh, you'll be fine."; - } - return "You left your arm over there. Let me get that for you.."; - } - if (Main.player[Main.myPlayer].statLife < (Main.player[Main.myPlayer].statLifeMax * 0.66)) - { - switch (Main.rand.Next(4)) - { - case 0: - return "Quit being such a baby! I've seen worse."; - - case 1: - return "That's gonna need stitches!"; - - case 2: - return "Trouble with those bullies again?"; - } - return "You look half digested. Have you been chasing slimes again?"; - } - switch (Main.rand.Next(3)) - { - case 0: - return "Turn your head and cough."; - - case 1: - return "Thats not the biggest I've ever seen... Yes, I've seen bigger wounds for sure."; - } - return "Show me where it hurts."; - } - if (this.type == 0x13) - { - if (flag2 && (Main.rand.Next(4) == 0)) - { - return "Make it quick! I've got a date with the nurse in an hour."; - } - if (flag4 && (Main.rand.Next(4) == 0)) - { - return "That dryad is a looker. Too bad she's such a prude."; - } - if (flag6 && (Main.rand.Next(4) == 0)) - { - return "Don't bother with that firework vendor, I've got all you need right here."; - } - if (Main.bloodMoon) - { - return "I love nights like tonight. There is never a shortage of things to kill!"; - } - switch (Main.rand.Next(2)) - { - case 0: - return "I see you're eyeballin' the Minishark.. You really don't want to know how it was made."; - - case 1: - str = "Keep your hands off my gun, buddy!"; - break; - } - return str; - } - if (this.type == 20) - { - if (flag3 && (Main.rand.Next(4) == 0)) - { - return "I wish that gun seller would stop talking to me. Doesn't he realize I'm 500 years old?"; - } - if (flag && (Main.rand.Next(4) == 0)) - { - return "That merchant keeps trying to sell me an angel statue. Everyone knows that they don't do anything."; - } - if (flag5 && (Main.rand.Next(4) == 0)) - { - return "Have you seen the old man walking around the dungeon? He doesn't look well at all..."; - } - if (Main.bloodMoon) - { - return "It is an evil moon tonight. Be careful."; - } - int num13 = Main.rand.Next(6); - if (num13 == 0) - { - return "You must cleanse the world of this corruption."; - } - if (num13 != 1) - { - if (num13 == 2) - { - return "The sands of time are flowing. And well, you are not aging very gracefully."; - } - if (num13 == 3) - { - return "Whats this about me having more 'bark' than bite?"; - } - if (num13 == 4) - { - return "So two goblins walk into a bar, and one says to the other, 'Want to get a Gobblet of beer?!'"; - } - } - return "Be safe; Terraria needs you!"; - } - if (this.type == 0x16) - { - if (Main.bloodMoon) - { - return "You can tell a Blood Moon is out when the sky turns red. There is something about it that causes monsters to swarm."; - } - if (!Main.dayTime) - { - return "You should stay indoors at night. It is very dangerous to be wandering around in the dark."; - } - switch (Main.rand.Next(3)) - { - case 0: - return ("Greetings, " + Main.player[Main.myPlayer].name + ". Is there something I can help you with?"); - - case 1: - return "I am here to give you advice on what to do next. It is recommended that you talk with me anytime you get stuck."; - - case 2: - str = "They say there is a person who will tell you how to survive in this land... oh wait. Thats me."; - break; - } - return str; - } - if (this.type == 0x25) - { - if (Main.dayTime) - { - switch (Main.rand.Next(2)) - { - case 0: - return "I cannot let you enter until you free me of my curse."; - - case 1: - str = "Come back at night if you wish to enter."; - break; - } - } - return str; - } - if (this.type != 0x26) - { - return str; - } - if (Main.bloodMoon) - { - return "I've got something for them zombies alright!"; - } - if (flag3 && (Main.rand.Next(4) == 0)) - { - return "Even the gun dealer wants what I'm selling!"; - } - if (flag2 && (Main.rand.Next(4) == 0)) - { - return "I'm sure the nurse will help if you accidentally lose a limb to these."; - } - if (flag4 && (Main.rand.Next(4) == 0)) - { - return "Why purify the world when you can just blow it up?"; - } - int num16 = Main.rand.Next(4); - if (num16 == 0) - { - return "Explosives are da' bomb these days. Buy some now!"; - } - if (num16 == 1) - { - return "It's a good day to die!"; - } - if (num16 == 2) - { - return "I wonder what happens if I... (BOOM!)... Oh, sorry, did you need that leg?"; - } - if (num16 == 3) - { - return "Dynamite, my own special cure-all for what ails ya."; - } - return "Check out my goods; they have explosive prices!"; - } - - public Color GetColor(Color newColor) - { - int r = this.color.R - (0xff - newColor.R); - int g = this.color.G - (0xff - newColor.G); - int b = this.color.B - (0xff - newColor.B); - int a = this.color.A - (0xff - newColor.A); - if (r < 0) - { - r = 0; - } - if (r > 0xff) - { - r = 0xff; - } - if (g < 0) - { - g = 0; - } - if (g > 0xff) - { - g = 0xff; - } - if (b < 0) - { - b = 0; - } - if (b > 0xff) - { - b = 0xff; - } - if (a < 0) - { - a = 0; - } - if (a > 0xff) - { - a = 0xff; - } - return new Color(r, g, b, a); - } - - public void HitEffect(int hitDirection = 0, double dmg = 10.0) - { - if ((this.type == 1) || (this.type == 0x10)) - { - if (this.life > 0) - { - for (int i = 0; i < ((dmg / ((double) this.lifeMax)) * 100.0); i++) - { - Dust.NewDust(this.position, this.width, this.height, 4, (float) hitDirection, -1f, this.alpha, this.color, 1f); - } - } - else - { - for (int j = 0; j < 50; j++) - { - Dust.NewDust(this.position, this.width, this.height, 4, (float) (2 * hitDirection), -2f, this.alpha, this.color, 1f); - } - if ((Main.netMode != 1) && (this.type == 0x10)) - { - int num3 = Main.rand.Next(2) + 2; - for (int k = 0; k < num3; k++) - { - int index = NewNPC(((int) this.position.X) + (this.width / 2), ((int) this.position.Y) + this.height, 1, 0); - Main.npc[index].SetDefaults("Baby Slime"); - Main.npc[index].velocity.X = this.velocity.X * 2f; - Main.npc[index].velocity.Y = this.velocity.Y; - Main.npc[index].velocity.X += (Main.rand.Next(-20, 20) * 0.1f) + ((k * this.direction) * 0.3f); - Main.npc[index].velocity.Y -= (Main.rand.Next(0, 10) * 0.1f) + k; - Main.npc[index].ai[1] = k; - if ((Main.netMode == 2) && (index < 0x3e8)) - { - NetMessage.SendData(0x17, -1, -1, "", index, 0f, 0f, 0f); - } - } - } - } - } - else - { - Color color; - if (this.type == 2) - { - if (this.life > 0) - { - for (int m = 0; m < ((dmg / ((double) this.lifeMax)) * 100.0); m++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 5, (float) hitDirection, -1f, 0, color, 1f); - } - } - else - { - for (int n = 0; n < 50; n++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 5, (float) (2 * hitDirection), -2f, 0, color, 1f); - } - Gore.NewGore(this.position, this.velocity, 1); - Gore.NewGore(new Vector2(this.position.X + 14f, this.position.Y), this.velocity, 2); - } - } - else if (this.type == 3) - { - if (this.life > 0) - { - for (int num8 = 0; num8 < ((dmg / ((double) this.lifeMax)) * 100.0); num8++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 5, (float) hitDirection, -1f, 0, color, 1f); - } - } - else - { - for (int num9 = 0; num9 < 50; num9++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * hitDirection, -2.5f, 0, color, 1f); - } - Gore.NewGore(this.position, this.velocity, 3); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 4); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 4); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 5); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 5); - } - } - else if (this.type == 4) - { - if (this.life > 0) - { - for (int num10 = 0; num10 < ((dmg / ((double) this.lifeMax)) * 100.0); num10++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 5, (float) hitDirection, -1f, 0, color, 1f); - } - } - else - { - for (int num11 = 0; num11 < 150; num11++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 5, (float) (2 * hitDirection), -2f, 0, color, 1f); - } - for (int num12 = 0; num12 < 2; num12++) - { - Gore.NewGore(this.position, new Vector2(Main.rand.Next(-30, 0x1f) * 0.2f, Main.rand.Next(-30, 0x1f) * 0.2f), 2); - Gore.NewGore(this.position, new Vector2(Main.rand.Next(-30, 0x1f) * 0.2f, Main.rand.Next(-30, 0x1f) * 0.2f), 7); - Gore.NewGore(this.position, new Vector2(Main.rand.Next(-30, 0x1f) * 0.2f, Main.rand.Next(-30, 0x1f) * 0.2f), 9); - Gore.NewGore(this.position, new Vector2(Main.rand.Next(-30, 0x1f) * 0.2f, Main.rand.Next(-30, 0x1f) * 0.2f), 10); - } - Main.PlaySound(15, (int) this.position.X, (int) this.position.Y, 0); - } - } - else if (this.type == 5) - { - if (this.life > 0) - { - for (int num13 = 0; num13 < ((dmg / ((double) this.lifeMax)) * 50.0); num13++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 5, (float) hitDirection, -1f, 0, color, 1f); - } - } - else - { - for (int num14 = 0; num14 < 20; num14++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 5, (float) (2 * hitDirection), -2f, 0, color, 1f); - } - Gore.NewGore(this.position, this.velocity, 6); - Gore.NewGore(this.position, this.velocity, 7); - } - } - else if (this.type == 6) - { - if (this.life > 0) - { - for (int num15 = 0; num15 < ((dmg / ((double) this.lifeMax)) * 100.0); num15++) - { - Dust.NewDust(this.position, this.width, this.height, 0x12, (float) hitDirection, -1f, this.alpha, this.color, this.scale); - } - } - else - { - for (int num16 = 0; num16 < 50; num16++) - { - Dust.NewDust(this.position, this.width, this.height, 0x12, (float) hitDirection, -2f, this.alpha, this.color, this.scale); - } - int num17 = Gore.NewGore(this.position, this.velocity, 14); - Main.gore[num17].alpha = this.alpha; - num17 = Gore.NewGore(this.position, this.velocity, 15); - Main.gore[num17].alpha = this.alpha; - } - } - else if (((this.type == 7) || (this.type == 8)) || (this.type == 9)) - { - if (this.life > 0) - { - for (int num18 = 0; num18 < ((dmg / ((double) this.lifeMax)) * 100.0); num18++) - { - Dust.NewDust(this.position, this.width, this.height, 0x12, (float) hitDirection, -1f, this.alpha, this.color, this.scale); - } - } - else - { - for (int num19 = 0; num19 < 50; num19++) - { - Dust.NewDust(this.position, this.width, this.height, 0x12, (float) hitDirection, -2f, this.alpha, this.color, this.scale); - } - int num20 = Gore.NewGore(this.position, this.velocity, (this.type - 7) + 0x12); - Main.gore[num20].alpha = this.alpha; - } - } - else if (((this.type == 10) || (this.type == 11)) || (this.type == 12)) - { - if (this.life > 0) - { - for (int num21 = 0; num21 < ((dmg / ((double) this.lifeMax)) * 50.0); num21++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 5, (float) hitDirection, -1f, 0, color, 1f); - } - } - else - { - for (int num22 = 0; num22 < 10; num22++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * hitDirection, -2.5f, 0, color, 1f); - } - Gore.NewGore(this.position, this.velocity, (this.type - 7) + 0x12); - } - } - else if (((this.type == 13) || (this.type == 14)) || (this.type == 15)) - { - if (this.life > 0) - { - for (int num23 = 0; num23 < ((dmg / ((double) this.lifeMax)) * 100.0); num23++) - { - Dust.NewDust(this.position, this.width, this.height, 0x12, (float) hitDirection, -1f, this.alpha, this.color, this.scale); - } - } - else - { - for (int num24 = 0; num24 < 50; num24++) - { - Dust.NewDust(this.position, this.width, this.height, 0x12, (float) hitDirection, -2f, this.alpha, this.color, this.scale); - } - if (this.type == 13) - { - Gore.NewGore(this.position, this.velocity, 0x18); - Gore.NewGore(this.position, this.velocity, 0x19); - } - else if (this.type == 14) - { - Gore.NewGore(this.position, this.velocity, 0x1a); - Gore.NewGore(this.position, this.velocity, 0x1b); - } - else - { - Gore.NewGore(this.position, this.velocity, 0x1c); - Gore.NewGore(this.position, this.velocity, 0x1d); - } - } - } - else if (this.type == 0x11) - { - if (this.life > 0) - { - for (int num25 = 0; num25 < ((dmg / ((double) this.lifeMax)) * 100.0); num25++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 5, (float) hitDirection, -1f, 0, color, 1f); - } - } - else - { - for (int num26 = 0; num26 < 50; num26++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * hitDirection, -2.5f, 0, color, 1f); - } - Gore.NewGore(this.position, this.velocity, 30); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 0x1f); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 0x1f); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 0x20); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 0x20); - } - } - else if (this.type == 0x25) - { - if (this.life > 0) - { - for (int num27 = 0; num27 < ((dmg / ((double) this.lifeMax)) * 100.0); num27++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 5, (float) hitDirection, -1f, 0, color, 1f); - } - } - else - { - for (int num28 = 0; num28 < 50; num28++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * hitDirection, -2.5f, 0, color, 1f); - } - Gore.NewGore(this.position, this.velocity, 0x3a); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 0x3b); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 0x3b); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 60); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 60); - } - } - else if (this.type == 0x12) - { - if (this.life > 0) - { - for (int num29 = 0; num29 < ((dmg / ((double) this.lifeMax)) * 100.0); num29++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 5, (float) hitDirection, -1f, 0, color, 1f); - } - } - else - { - for (int num30 = 0; num30 < 50; num30++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * hitDirection, -2.5f, 0, color, 1f); - } - Gore.NewGore(this.position, this.velocity, 0x21); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 0x22); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 0x22); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 0x23); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 0x23); - } - } - else if (this.type == 0x13) - { - if (this.life > 0) - { - for (int num31 = 0; num31 < ((dmg / ((double) this.lifeMax)) * 100.0); num31++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 5, (float) hitDirection, -1f, 0, color, 1f); - } - } - else - { - for (int num32 = 0; num32 < 50; num32++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * hitDirection, -2.5f, 0, color, 1f); - } - Gore.NewGore(this.position, this.velocity, 0x24); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 0x25); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 0x25); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 0x26); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 0x26); - } - } - else if (this.type == 0x26) - { - if (this.life > 0) - { - for (int num33 = 0; num33 < ((dmg / ((double) this.lifeMax)) * 100.0); num33++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 5, (float) hitDirection, -1f, 0, color, 1f); - } - } - else - { - for (int num34 = 0; num34 < 50; num34++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * hitDirection, -2.5f, 0, color, 1f); - } - Gore.NewGore(this.position, this.velocity, 0x40); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 0x41); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 0x41); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 0x42); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 0x42); - } - } - else if (this.type == 20) - { - if (this.life > 0) - { - for (int num35 = 0; num35 < ((dmg / ((double) this.lifeMax)) * 100.0); num35++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 5, (float) hitDirection, -1f, 0, color, 1f); - } - } - else - { - for (int num36 = 0; num36 < 50; num36++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * hitDirection, -2.5f, 0, color, 1f); - } - Gore.NewGore(this.position, this.velocity, 0x27); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 40); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 40); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 0x29); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 0x29); - } - } - else if (((this.type == 0x15) || (this.type == 0x1f)) || (this.type == 0x20)) - { - if (this.life > 0) - { - for (int num37 = 0; num37 < ((dmg / ((double) this.lifeMax)) * 50.0); num37++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 0x1a, (float) hitDirection, -1f, 0, color, 1f); - } - } - else - { - for (int num38 = 0; num38 < 20; num38++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 0x1a, 2.5f * hitDirection, -2.5f, 0, color, 1f); - } - Gore.NewGore(this.position, this.velocity, 0x2a); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 0x2b); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 0x2b); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 0x2c); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 0x2c); - } - } - else if (((this.type == 0x27) || (this.type == 40)) || (this.type == 0x29)) - { - if (this.life > 0) - { - for (int num39 = 0; num39 < ((dmg / ((double) this.lifeMax)) * 50.0); num39++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 0x1a, (float) hitDirection, -1f, 0, color, 1f); - } - } - else - { - for (int num40 = 0; num40 < 20; num40++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 0x1a, 2.5f * hitDirection, -2.5f, 0, color, 1f); - } - Gore.NewGore(this.position, this.velocity, (this.type - 0x27) + 0x43); - } - } - else if (this.type == 0x22) - { - if (this.life > 0) - { - for (int num41 = 0; num41 < ((dmg / ((double) this.lifeMax)) * 50.0); num41++) - { - color = new Color(); - int num42 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, color, 3f); - Main.dust[num42].noLight = true; - Main.dust[num42].noGravity = true; - Dust dust1 = Main.dust[num42]; - dust1.velocity = (Vector2) (dust1.velocity * 2f); - color = new Color(); - num42 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, color, 2f); - Main.dust[num42].noLight = true; - Dust dust2 = Main.dust[num42]; - dust2.velocity = (Vector2) (dust2.velocity * 2f); - } - } - else - { - for (int num43 = 0; num43 < 20; num43++) - { - color = new Color(); - int num44 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, color, 3f); - Main.dust[num44].noLight = true; - Main.dust[num44].noGravity = true; - Dust dust3 = Main.dust[num44]; - dust3.velocity = (Vector2) (dust3.velocity * 2f); - color = new Color(); - num44 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, color, 2f); - Main.dust[num44].noLight = true; - Dust dust4 = Main.dust[num44]; - dust4.velocity = (Vector2) (dust4.velocity * 2f); - } - } - } - else if ((this.type == 0x23) || (this.type == 0x24)) - { - if (this.life > 0) - { - for (int num45 = 0; num45 < ((dmg / ((double) this.lifeMax)) * 100.0); num45++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 0x1a, (float) hitDirection, -1f, 0, color, 1f); - } - } - else - { - for (int num46 = 0; num46 < 150; num46++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 0x1a, 2.5f * hitDirection, -2.5f, 0, color, 1f); - } - if (this.type == 0x23) - { - Gore.NewGore(this.position, this.velocity, 0x36); - Gore.NewGore(this.position, this.velocity, 0x37); - } - else - { - Gore.NewGore(this.position, this.velocity, 0x38); - Gore.NewGore(this.position, this.velocity, 0x39); - Gore.NewGore(this.position, this.velocity, 0x39); - Gore.NewGore(this.position, this.velocity, 0x39); - } - } - } - else if (this.type == 0x17) - { - if (this.life > 0) - { - for (int num47 = 0; num47 < ((dmg / ((double) this.lifeMax)) * 100.0); num47++) - { - int type = 0x19; - if (Main.rand.Next(2) == 0) - { - type = 6; - } - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, type, (float) hitDirection, -1f, 0, color, 1f); - color = new Color(); - int num49 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, color, 2f); - Main.dust[num49].noGravity = true; - } - } - else - { - for (int num50 = 0; num50 < 50; num50++) - { - int num51 = 0x19; - if (Main.rand.Next(2) == 0) - { - num51 = 6; - } - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, num51, (float) (2 * hitDirection), -2f, 0, color, 1f); - } - for (int num52 = 0; num52 < 50; num52++) - { - color = new Color(); - int num53 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, color, 2.5f); - Dust dust5 = Main.dust[num53]; - dust5.velocity = (Vector2) (dust5.velocity * 6f); - Main.dust[num53].noGravity = true; - } - } - } - else if (this.type == 0x18) - { - if (this.life > 0) - { - for (int num54 = 0; num54 < ((dmg / ((double) this.lifeMax)) * 100.0); num54++) - { - color = new Color(); - int num55 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, this.velocity.X, this.velocity.Y, 100, color, 2.5f); - Main.dust[num55].noGravity = true; - } - } - else - { - for (int num56 = 0; num56 < 50; num56++) - { - color = new Color(); - int num57 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, this.velocity.X, this.velocity.Y, 100, color, 2.5f); - Main.dust[num57].noGravity = true; - Dust dust6 = Main.dust[num57]; - dust6.velocity = (Vector2) (dust6.velocity * 2f); - } - Gore.NewGore(this.position, this.velocity, 0x2d); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 0x2e); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 0x2e); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 0x2f); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 0x2f); - } - } - else if (this.type == 0x19) - { - Main.PlaySound(2, (int) this.position.X, (int) this.position.Y, 10); - for (int num58 = 0; num58 < 20; num58++) - { - color = new Color(); - int num59 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, color, 2f); - Main.dust[num59].noGravity = true; - Dust dust7 = Main.dust[num59]; - dust7.velocity = (Vector2) (dust7.velocity * 2f); - color = new Color(); - num59 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, color, 1f); - Dust dust8 = Main.dust[num59]; - dust8.velocity = (Vector2) (dust8.velocity * 2f); - } - } - else if (this.type == 0x21) - { - Main.PlaySound(2, (int) this.position.X, (int) this.position.Y, 10); - for (int num60 = 0; num60 < 20; num60++) - { - color = new Color(); - int num61 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 0x1d, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, color, 2f); - Main.dust[num61].noGravity = true; - Dust dust9 = Main.dust[num61]; - dust9.velocity = (Vector2) (dust9.velocity * 2f); - color = new Color(); - num61 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 0x1d, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, color, 1f); - Dust dust10 = Main.dust[num61]; - dust10.velocity = (Vector2) (dust10.velocity * 2f); - } - } - else if (((this.type == 0x1a) || (this.type == 0x1b)) || ((this.type == 0x1c) || (this.type == 0x1d))) - { - if (this.life > 0) - { - for (int num62 = 0; num62 < ((dmg / ((double) this.lifeMax)) * 100.0); num62++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 5, (float) hitDirection, -1f, 0, color, 1f); - } - } - else - { - for (int num63 = 0; num63 < 50; num63++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 5, 2.5f * hitDirection, -2.5f, 0, color, 1f); - } - Gore.NewGore(this.position, this.velocity, 0x30); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 0x31); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 20f), this.velocity, 0x31); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 50); - Gore.NewGore(new Vector2(this.position.X, this.position.Y + 34f), this.velocity, 50); - } - } - else if (this.type == 30) - { - Main.PlaySound(2, (int) this.position.X, (int) this.position.Y, 10); - for (int num64 = 0; num64 < 20; num64++) - { - color = new Color(); - int num65 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 0x1b, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, color, 2f); - Main.dust[num65].noGravity = true; - Dust dust11 = Main.dust[num65]; - dust11.velocity = (Vector2) (dust11.velocity * 2f); - color = new Color(); - num65 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 0x1b, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, color, 1f); - Dust dust12 = Main.dust[num65]; - dust12.velocity = (Vector2) (dust12.velocity * 2f); - } - } - else if (this.type == 0x2a) - { - if (this.life > 0) - { - for (int num66 = 0; num66 < ((dmg / ((double) this.lifeMax)) * 100.0); num66++) - { - Dust.NewDust(this.position, this.width, this.height, 0x12, (float) hitDirection, -1f, this.alpha, this.color, this.scale); - } - } - else - { - for (int num67 = 0; num67 < 50; num67++) - { - Dust.NewDust(this.position, this.width, this.height, 0x12, (float) hitDirection, -2f, this.alpha, this.color, this.scale); - } - Gore.NewGore(this.position, this.velocity, 70); - Gore.NewGore(this.position, this.velocity, 0x47); - } - } - else if (this.type == 0x2b) - { - if (this.life > 0) - { - for (int num68 = 0; num68 < ((dmg / ((double) this.lifeMax)) * 100.0); num68++) - { - Dust.NewDust(this.position, this.width, this.height, 40, (float) hitDirection, -1f, this.alpha, this.color, 1.2f); - } - } - else - { - for (int num69 = 0; num69 < 50; num69++) - { - Dust.NewDust(this.position, this.width, this.height, 40, (float) hitDirection, -2f, this.alpha, this.color, 1.2f); - } - Gore.NewGore(this.position, this.velocity, 0x48); - Gore.NewGore(this.position, this.velocity, 0x48); - } - } - } - } - - public static int NewNPC(int X, int Y, int Type, int Start = 0) - { - int index = -1; - for (int i = Start; i < 0x3e8; i++) - { - if (!Main.npc[i].active) - { - index = i; - break; - } - } - if (index >= 0) - { - Main.npc[index] = new NPC(); - Main.npc[index].SetDefaults(Type); - Main.npc[index].position.X = X - (Main.npc[index].width / 2); - Main.npc[index].position.Y = Y - Main.npc[index].height; - Main.npc[index].active = true; - Main.npc[index].timeLeft = (int) (activeTime * 1.25); - Main.npc[index].wet = Collision.WetCollision(Main.npc[index].position, Main.npc[index].width, Main.npc[index].height); - return index; - } - return 0x3e8; - } - - public void NPCLoot() - { - if ((this.type == 1) || (this.type == 0x10)) - { - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x17, Main.rand.Next(1, 3), false); - } - if ((this.type == 2) && (Main.rand.Next(3) == 0)) - { - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x26, 1, false); - } - if ((this.type == 3) && (Main.rand.Next(50) == 0)) - { - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0xd8, 1, false); - } - if (this.type == 4) - { - int stack = Main.rand.Next(30) + 20; - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x2f, stack, false); - stack = Main.rand.Next(20) + 10; - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x38, stack, false); - stack = Main.rand.Next(20) + 10; - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x38, stack, false); - stack = Main.rand.Next(20) + 10; - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x38, stack, false); - stack = Main.rand.Next(3) + 1; - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x3b, stack, false); - } - if ((this.type == 6) && (Main.rand.Next(3) == 0)) - { - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x44, 1, false); - } - if (((this.type == 7) || (this.type == 8)) || (this.type == 9)) - { - if (Main.rand.Next(3) == 0) - { - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x44, Main.rand.Next(1, 3), false); - } - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x45, Main.rand.Next(3, 9), false); - } - if ((((this.type == 10) || (this.type == 11)) || (this.type == 12)) && (Main.rand.Next(500) == 0)) - { - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0xd7, 1, false); - } - if (((this.type == 0x27) || (this.type == 40)) || (this.type == 0x29)) - { - if (Main.rand.Next(100) == 0) - { - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 220, 1, false); - } - else if (Main.rand.Next(100) == 0) - { - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0xda, 1, false); - } - } - if (((this.type == 13) || (this.type == 14)) || (this.type == 15)) - { - int num2 = Main.rand.Next(1, 4); - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x56, num2, false); - if (Main.rand.Next(2) == 0) - { - num2 = Main.rand.Next(2, 6); - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x38, num2, false); - } - if (this.boss) - { - num2 = Main.rand.Next(15, 30); - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x38, num2, false); - num2 = Main.rand.Next(15, 0x1f); - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x38, num2, false); - int type = Main.rand.Next(100, 0x67); - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, type, 1, false); - } - } - if ((this.type == 0x15) && (Main.rand.Next(30) == 0)) - { - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x76, 1, false); - } - if (this.type == 0x17) - { - Main.rand.Next(3); - } - if ((this.type == 0x18) && (Main.rand.Next(50) == 0)) - { - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x70, 1, false); - } - if ((this.type == 0x1f) || (this.type == 0x20)) - { - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x9a, 1, false); - } - if (((this.type == 0x1a) || (this.type == 0x1b)) || ((this.type == 0x1c) || (this.type == 0x1d))) - { - if (Main.rand.Next(400) == 0) - { - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x80, 1, false); - } - else if (Main.rand.Next(200) == 0) - { - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 160, 1, false); - } - else if (Main.rand.Next(2) == 0) - { - int num4 = Main.rand.Next(1, 6); - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0xa1, num4, false); - } - } - if (this.type == 0x2a) - { - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0xd1, 1, false); - } - if ((this.type == 0x2b) && (Main.rand.Next(5) == 0)) - { - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 210, 1, false); - } - if (((this.type == 0x2a) || (this.type == 0x2b)) && (Main.rand.Next(150) == 0)) - { - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, Main.rand.Next(0xe4, 0xe7), 1, false); - } - if (this.boss) - { - if (this.type == 4) - { - downedBoss1 = true; - } - if (((this.type == 13) || (this.type == 14)) || (this.type == 15)) - { - downedBoss2 = true; - this.name = "Eater of Worlds"; - } - if (this.type == 0x23) - { - downedBoss3 = true; - this.name = "Skeletron"; - } - int num5 = Main.rand.Next(5, 0x10); - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x1c, num5, false); - int num6 = Main.rand.Next(5) + 5; - for (int i = 0; i < num6; i++) - { - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x3a, 1, false); - } - if (Main.netMode == 0) - { - Main.NewText(this.name + " has been defeated!", 0xaf, 0x4b, 0xff); - } - else if (Main.netMode == 2) - { - NetMessage.SendData(0x19, -1, -1, this.name + " has been defeated!", 8, 175f, 75f, 255f); - } - } - if (Main.rand.Next(7) == 0) - { - if ((Main.rand.Next(2) == 0) && (Main.player[Player.FindClosest(this.position, this.width, this.height)].statMana < Main.player[Player.FindClosest(this.position, this.width, this.height)].statManaMax)) - { - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0xb8, 1, false); - } - else if ((Main.rand.Next(2) == 0) && (Main.player[Player.FindClosest(this.position, this.width, this.height)].statLife < Main.player[Player.FindClosest(this.position, this.width, this.height)].statLifeMax)) - { - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x3a, 1, false); - } - } - float num8 = this.value * (1f + (Main.rand.Next(-20, 0x15) * 0.01f)); - if (Main.rand.Next(5) == 0) - { - num8 *= 1f + (Main.rand.Next(5, 11) * 0.01f); - } - if (Main.rand.Next(10) == 0) - { - num8 *= 1f + (Main.rand.Next(10, 0x15) * 0.01f); - } - if (Main.rand.Next(15) == 0) - { - num8 *= 1f + (Main.rand.Next(15, 0x1f) * 0.01f); - } - if (Main.rand.Next(20) == 0) - { - num8 *= 1f + (Main.rand.Next(20, 0x29) * 0.01f); - } - while (((int) num8) > 0) - { - if (num8 > 1000000f) - { - int num9 = (int) (num8 / 1000000f); - if ((num9 > 50) && (Main.rand.Next(2) == 0)) - { - num9 /= Main.rand.Next(3) + 1; - } - if (Main.rand.Next(2) == 0) - { - num9 /= Main.rand.Next(3) + 1; - } - num8 -= 0xf4240 * num9; - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x4a, num9, false); - } - else - { - if (num8 > 10000f) - { - int num10 = (int) (num8 / 10000f); - if ((num10 > 50) && (Main.rand.Next(2) == 0)) - { - num10 /= Main.rand.Next(3) + 1; - } - if (Main.rand.Next(2) == 0) - { - num10 /= Main.rand.Next(3) + 1; - } - num8 -= 0x2710 * num10; - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x49, num10, false); - continue; - } - if (num8 > 100f) - { - int num11 = (int) (num8 / 100f); - if ((num11 > 50) && (Main.rand.Next(2) == 0)) - { - num11 /= Main.rand.Next(3) + 1; - } - if (Main.rand.Next(2) == 0) - { - num11 /= Main.rand.Next(3) + 1; - } - num8 -= 100 * num11; - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x48, num11, false); - continue; - } - int num12 = (int) num8; - if ((num12 > 50) && (Main.rand.Next(2) == 0)) - { - num12 /= Main.rand.Next(3) + 1; - } - if (Main.rand.Next(2) == 0) - { - num12 /= Main.rand.Next(4) + 1; - } - if (num12 < 1) - { - num12 = 1; - } - num8 -= num12; - Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x47, num12, false); - } - } - } - - public void SetDefaults(int Type) - { - this.lavaWet = false; - this.wetCount = 0; - this.wet = false; - this.townNPC = false; - this.homeless = false; - this.homeTileX = -1; - this.homeTileY = -1; - this.friendly = false; - this.behindTiles = false; - this.boss = false; - this.noTileCollide = false; - this.rotation = 0f; - this.active = true; - this.alpha = 0; - this.color = new Color(); - this.collideX = false; - this.collideY = false; - this.direction = 0; - this.oldDirection = this.direction; - this.frameCounter = 0.0; - this.netUpdate = false; - this.knockBackResist = 1f; - this.name = ""; - this.noGravity = false; - this.scale = 1f; - this.soundHit = 0; - this.soundKilled = 0; - this.spriteDirection = -1; - this.target = 8; - this.oldTarget = this.target; - this.targetRect = new Rectangle(); - this.timeLeft = activeTime; - this.type = Type; - this.value = 0f; - for (int i = 0; i < maxAI; i++) - { - this.ai[i] = 0f; - } - if (this.type == 1) - { - this.name = "Blue Slime"; - this.width = 0x18; - this.height = 0x12; - this.aiStyle = 1; - this.damage = 7; - this.defense = 2; - this.lifeMax = 0x19; - this.soundHit = 1; - this.soundKilled = 1; - this.alpha = 0xaf; - this.color = new Color(0, 80, 0xff, 100); - this.value = 25f; - } - if (this.type == 2) - { - this.name = "Demon Eye"; - this.width = 30; - this.height = 0x20; - this.aiStyle = 2; - this.damage = 0x12; - this.defense = 2; - this.lifeMax = 60; - this.soundHit = 1; - this.knockBackResist = 0.8f; - this.soundKilled = 1; - this.value = 75f; - } - if (this.type == 3) - { - this.name = "Zombie"; - this.width = 0x12; - this.height = 40; - this.aiStyle = 3; - this.damage = 14; - this.defense = 6; - this.lifeMax = 0x2d; - this.soundHit = 1; - this.soundKilled = 2; - this.knockBackResist = 0.5f; - this.value = 60f; - } - if (this.type == 4) - { - this.name = "Eye of Cthulhu"; - this.width = 100; - this.height = 110; - this.aiStyle = 4; - this.damage = 0x12; - this.defense = 12; - this.lifeMax = 0xbb8; - this.soundHit = 1; - this.soundKilled = 1; - this.knockBackResist = 0f; - this.noGravity = true; - this.noTileCollide = true; - this.timeLeft = activeTime * 30; - this.boss = true; - this.value = 30000f; - } - if (this.type == 5) - { - this.name = "Servant of Cthulhu"; - this.width = 20; - this.height = 20; - this.aiStyle = 5; - this.damage = 0x17; - this.defense = 0; - this.lifeMax = 8; - this.soundHit = 1; - this.soundKilled = 1; - this.noGravity = true; - this.noTileCollide = true; - } - if (this.type == 6) - { - this.name = "Eater of Souls"; - this.width = 30; - this.height = 30; - this.aiStyle = 5; - this.damage = 15; - this.defense = 8; - this.lifeMax = 40; - this.soundHit = 1; - this.soundKilled = 1; - this.noGravity = true; - this.knockBackResist = 0.5f; - this.value = 90f; - } - if (this.type == 7) - { - this.name = "Devourer Head"; - this.width = 0x16; - this.height = 0x16; - this.aiStyle = 6; - this.damage = 0x1c; - this.defense = 2; - this.lifeMax = 40; - this.soundHit = 1; - this.soundKilled = 1; - this.noGravity = true; - this.noTileCollide = true; - this.knockBackResist = 0f; - this.behindTiles = true; - this.value = 300f; - } - if (this.type == 8) - { - this.name = "Devourer Body"; - this.width = 0x16; - this.height = 0x16; - this.aiStyle = 6; - this.damage = 0x12; - this.defense = 6; - this.lifeMax = 60; - this.soundHit = 1; - this.soundKilled = 1; - this.noGravity = true; - this.noTileCollide = true; - this.knockBackResist = 0f; - this.behindTiles = true; - this.value = 300f; - } - if (this.type == 9) - { - this.name = "Devourer Tail"; - this.width = 0x16; - this.height = 0x16; - this.aiStyle = 6; - this.damage = 13; - this.defense = 10; - this.lifeMax = 100; - this.soundHit = 1; - this.soundKilled = 1; - this.noGravity = true; - this.noTileCollide = true; - this.knockBackResist = 0f; - this.behindTiles = true; - this.value = 300f; - } - if (this.type == 10) - { - this.name = "Giant Worm Head"; - this.width = 14; - this.height = 14; - this.aiStyle = 6; - this.damage = 8; - this.defense = 0; - this.lifeMax = 10; - this.soundHit = 1; - this.soundKilled = 1; - this.noGravity = true; - this.noTileCollide = true; - this.knockBackResist = 0f; - this.behindTiles = true; - this.value = 200f; - } - if (this.type == 11) - { - this.name = "Giant Worm Body"; - this.width = 14; - this.height = 14; - this.aiStyle = 6; - this.damage = 4; - this.defense = 4; - this.lifeMax = 15; - this.soundHit = 1; - this.soundKilled = 1; - this.noGravity = true; - this.noTileCollide = true; - this.knockBackResist = 0f; - this.behindTiles = true; - this.value = 200f; - } - if (this.type == 12) - { - this.name = "Giant Worm Tail"; - this.width = 14; - this.height = 14; - this.aiStyle = 6; - this.damage = 4; - this.defense = 6; - this.lifeMax = 20; - this.soundHit = 1; - this.soundKilled = 1; - this.noGravity = true; - this.noTileCollide = true; - this.knockBackResist = 0f; - this.behindTiles = true; - this.value = 200f; - } - if (this.type == 13) - { - this.name = "Eater of Worlds Head"; - this.width = 0x26; - this.height = 0x26; - this.aiStyle = 6; - this.damage = 40; - this.defense = 0; - this.lifeMax = 120; - this.soundHit = 1; - this.soundKilled = 1; - this.noGravity = true; - this.noTileCollide = true; - this.knockBackResist = 0f; - this.behindTiles = true; - this.value = 300f; - } - if (this.type == 14) - { - this.name = "Eater of Worlds Body"; - this.width = 0x26; - this.height = 0x26; - this.aiStyle = 6; - this.damage = 15; - this.defense = 4; - this.lifeMax = 200; - this.soundHit = 1; - this.soundKilled = 1; - this.noGravity = true; - this.noTileCollide = true; - this.knockBackResist = 0f; - this.behindTiles = true; - this.value = 300f; - } - if (this.type == 15) - { - this.name = "Eater of Worlds Tail"; - this.width = 0x26; - this.height = 0x26; - this.aiStyle = 6; - this.damage = 10; - this.defense = 8; - this.lifeMax = 300; - this.soundHit = 1; - this.soundKilled = 1; - this.noGravity = true; - this.noTileCollide = true; - this.knockBackResist = 0f; - this.behindTiles = true; - this.value = 300f; - } - if (this.type == 0x10) - { - this.name = "Mother Slime"; - this.width = 0x24; - this.height = 0x18; - this.aiStyle = 1; - this.damage = 20; - this.defense = 7; - this.lifeMax = 90; - this.soundHit = 1; - this.soundKilled = 1; - this.alpha = 120; - this.color = new Color(0, 0, 0, 50); - this.value = 75f; - this.scale = 1.25f; - this.knockBackResist = 0.6f; - } - if (this.type == 0x11) - { - this.townNPC = true; - this.friendly = true; - this.name = "Merchant"; - this.width = 0x12; - this.height = 40; - this.aiStyle = 7; - this.damage = 10; - this.defense = 15; - this.lifeMax = 250; - this.soundHit = 1; - this.soundKilled = 1; - this.knockBackResist = 0.5f; - } - if (this.type == 0x12) - { - this.townNPC = true; - this.friendly = true; - this.name = "Nurse"; - this.width = 0x12; - this.height = 40; - this.aiStyle = 7; - this.damage = 10; - this.defense = 15; - this.lifeMax = 250; - this.soundHit = 1; - this.soundKilled = 1; - this.knockBackResist = 0.5f; - } - if (this.type == 0x13) - { - this.townNPC = true; - this.friendly = true; - this.name = "Arms Dealer"; - this.width = 0x12; - this.height = 40; - this.aiStyle = 7; - this.damage = 10; - this.defense = 15; - this.lifeMax = 250; - this.soundHit = 1; - this.soundKilled = 1; - this.knockBackResist = 0.5f; - } - if (this.type == 20) - { - this.townNPC = true; - this.friendly = true; - this.name = "Dryad"; - this.width = 0x12; - this.height = 40; - this.aiStyle = 7; - this.damage = 10; - this.defense = 15; - this.lifeMax = 250; - this.soundHit = 1; - this.soundKilled = 1; - this.knockBackResist = 0.5f; - } - if (this.type == 0x15) - { - this.name = "Skeleton"; - this.width = 0x12; - this.height = 40; - this.aiStyle = 3; - this.damage = 20; - this.defense = 8; - this.lifeMax = 60; - this.soundHit = 2; - this.soundKilled = 2; - this.knockBackResist = 0.5f; - this.value = 250f; - } - if (this.type == 0x16) - { - this.townNPC = true; - if (ShankShock.killGuide) - { - this.friendly = false; - this.damage = 0; - this.defense = 0; - this.lifeMax = 1; - this.name = "(Stupid) Guide"; - } - else - { - this.friendly = true; - this.damage = 10; - this.defense = 100; - this.lifeMax = 250; - this.name = "Guide"; - } - this.width = 0x12; - this.height = 40; - this.aiStyle = 7; - this.soundHit = 1; - this.soundKilled = 1; - this.knockBackResist = 0.5f; - } - if (this.type == 0x17) - { - this.name = "Meteor Head"; - this.width = 0x16; - this.height = 0x16; - this.aiStyle = 5; - this.damage = 0x19; - this.defense = 10; - this.lifeMax = 50; - this.soundHit = 3; - this.soundKilled = 3; - this.noGravity = true; - this.noTileCollide = true; - this.value = 300f; - this.knockBackResist = 0.8f; - } - else if (this.type == 0x18) - { - this.name = "Fire Imp"; - this.width = 0x12; - this.height = 40; - this.aiStyle = 8; - this.damage = 30; - this.defense = 20; - this.lifeMax = 80; - this.soundHit = 1; - this.soundKilled = 1; - this.knockBackResist = 0.5f; - this.value = 800f; - } - if (this.type == 0x19) - { - this.name = "Burning Sphere"; - this.width = 0x10; - this.height = 0x10; - this.aiStyle = 9; - this.damage = 0x19; - this.defense = 0; - this.lifeMax = 1; - this.soundHit = 3; - this.soundKilled = 3; - this.noGravity = true; - this.noTileCollide = true; - this.knockBackResist = 0f; - this.alpha = 100; - } - if (this.type == 0x1a) - { - this.name = "Goblin Peon"; - this.width = 0x12; - this.height = 40; - this.aiStyle = 3; - this.damage = 12; - this.defense = 4; - this.lifeMax = 60; - this.soundHit = 1; - this.soundKilled = 1; - this.knockBackResist = 0.8f; - this.value = 250f; - } - if (this.type == 0x1b) - { - this.name = "Goblin Thief"; - this.width = 0x12; - this.height = 40; - this.aiStyle = 3; - this.damage = 20; - this.defense = 6; - this.lifeMax = 80; - this.soundHit = 1; - this.soundKilled = 1; - this.knockBackResist = 0.7f; - this.value = 600f; - } - if (this.type == 0x1c) - { - this.name = "Goblin Warrior"; - this.width = 0x12; - this.height = 40; - this.aiStyle = 3; - this.damage = 0x19; - this.defense = 8; - this.lifeMax = 110; - this.soundHit = 1; - this.soundKilled = 1; - this.knockBackResist = 0.5f; - this.value = 500f; - } - else if (this.type == 0x1d) - { - this.name = "Goblin Sorcerer"; - this.width = 0x12; - this.height = 40; - this.aiStyle = 8; - this.damage = 20; - this.defense = 2; - this.lifeMax = 40; - this.soundHit = 1; - this.soundKilled = 1; - this.knockBackResist = 0.6f; - this.value = 800f; - } - else if (this.type == 30) - { - this.name = "Chaos Ball"; - this.width = 0x10; - this.height = 0x10; - this.aiStyle = 9; - this.damage = 20; - this.defense = 0; - this.lifeMax = 1; - this.soundHit = 3; - this.soundKilled = 3; - this.noGravity = true; - this.noTileCollide = true; - this.alpha = 100; - this.knockBackResist = 0f; - } - else if (this.type == 0x1f) - { - this.name = "Angry Bones"; - this.width = 0x12; - this.height = 40; - this.aiStyle = 3; - this.damage = 30; - this.defense = 10; - this.lifeMax = 100; - this.soundHit = 2; - this.soundKilled = 2; - this.knockBackResist = 0.7f; - this.value = 500f; - } - else if (this.type == 0x20) - { - this.name = "Dark Caster"; - this.width = 0x12; - this.height = 40; - this.aiStyle = 8; - this.damage = 20; - this.defense = 4; - this.lifeMax = 50; - this.soundHit = 2; - this.soundKilled = 2; - this.knockBackResist = 0.6f; - this.value = 800f; - } - else if (this.type == 0x21) - { - this.name = "Water Sphere"; - this.width = 0x10; - this.height = 0x10; - this.aiStyle = 9; - this.damage = 20; - this.defense = 0; - this.lifeMax = 1; - this.soundHit = 3; - this.soundKilled = 3; - this.noGravity = true; - this.noTileCollide = true; - this.alpha = 100; - this.knockBackResist = 0f; - } - if (this.type == 0x22) - { - this.name = "Burning Skull"; - this.width = 0x1a; - this.height = 0x1c; - this.aiStyle = 10; - this.damage = 0x19; - this.defense = 30; - this.lifeMax = 30; - this.soundHit = 2; - this.soundKilled = 2; - this.noGravity = true; - this.value = 300f; - this.knockBackResist = 1.2f; - } - if (this.type == 0x23) - { - this.name = "Skeletron Head"; - this.width = 80; - this.height = 0x66; - this.aiStyle = 11; - this.damage = 0x23; - this.defense = 12; - this.lifeMax = 0x1770; - this.soundHit = 2; - this.soundKilled = 2; - this.noGravity = true; - this.noTileCollide = true; - this.value = 50000f; - this.knockBackResist = 0f; - this.boss = true; - } - if (this.type == 0x24) - { - this.name = "Skeletron Hand"; - this.width = 0x34; - this.height = 0x34; - this.aiStyle = 12; - this.damage = 30; - this.defense = 0x12; - this.lifeMax = 0x4b0; - this.soundHit = 2; - this.soundKilled = 2; - this.noGravity = true; - this.noTileCollide = true; - this.knockBackResist = 0f; - } - if (this.type == 0x25) - { - this.townNPC = true; - this.friendly = true; - this.name = "Old Man"; - this.width = 0x12; - this.height = 40; - this.aiStyle = 7; - this.damage = 10; - this.defense = 100; - this.lifeMax = 250; - this.soundHit = 1; - this.soundKilled = 1; - this.knockBackResist = 0.5f; - } - if (this.type == 0x26) - { - this.townNPC = true; - this.friendly = true; - this.name = "Demolitionist"; - this.width = 0x12; - this.height = 40; - this.aiStyle = 7; - this.damage = 10; - this.defense = 15; - this.lifeMax = 250; - this.soundHit = 1; - this.soundKilled = 1; - this.knockBackResist = 0.5f; - } - if (this.type == 0x27) - { - this.name = "Bone Serpent Head"; - this.width = 0x16; - this.height = 0x16; - this.aiStyle = 6; - this.damage = 40; - this.defense = 10; - this.lifeMax = 120; - this.soundHit = 2; - this.soundKilled = 2; - this.noGravity = true; - this.noTileCollide = true; - this.knockBackResist = 0f; - this.behindTiles = true; - this.value = 1000f; - } - if (this.type == 40) - { - this.name = "Bone Serpent Body"; - this.width = 0x16; - this.height = 0x16; - this.aiStyle = 6; - this.damage = 30; - this.defense = 12; - this.lifeMax = 150; - this.soundHit = 2; - this.soundKilled = 2; - this.noGravity = true; - this.noTileCollide = true; - this.knockBackResist = 0f; - this.behindTiles = true; - this.value = 1000f; - } - if (this.type == 0x29) - { - this.name = "Bone Serpent Tail"; - this.width = 0x16; - this.height = 0x16; - this.aiStyle = 6; - this.damage = 20; - this.defense = 0x12; - this.lifeMax = 200; - this.soundHit = 2; - this.soundKilled = 2; - this.noGravity = true; - this.noTileCollide = true; - this.knockBackResist = 0f; - this.behindTiles = true; - this.value = 1000f; - } - if (this.type == 0x2a) - { - this.name = "Hornet"; - this.width = 0x22; - this.height = 0x20; - this.aiStyle = 2; - this.damage = 40; - this.defense = 14; - this.lifeMax = 100; - this.soundHit = 1; - this.knockBackResist = 0.8f; - this.soundKilled = 1; - this.value = 750f; - } - if (this.type == 0x2b) - { - this.noGravity = true; - this.name = "Man Eater"; - this.width = 30; - this.height = 30; - this.aiStyle = 13; - this.damage = 60; - this.defense = 0x12; - this.lifeMax = 200; - this.soundHit = 1; - this.knockBackResist = 0.7f; - this.soundKilled = 1; - this.value = 750f; - } - this.frame = new Rectangle(0, 0, Main.npcTexture[this.type].Width, Main.npcTexture[this.type].Height / Main.npcFrameCount[this.type]); - this.width = (int) (this.width * this.scale); - this.height = (int) (this.height * this.scale); - this.life = this.lifeMax; - if (Main.dumbAI) - { - this.aiStyle = 0; - } - } - - public void SetDefaults(string Name) - { - this.SetDefaults(0); - if (Name == "Green Slime") - { - this.SetDefaults(1); - this.name = Name; - this.scale = 0.9f; - this.damage = 8; - this.defense = 2; - this.life = 15; - this.knockBackResist = 1.1f; - this.color = new Color(0, 220, 40, 100); - this.value = 3f; - } - else if (Name == "Pinky") - { - this.SetDefaults(1); - this.name = Name; - this.scale = 0.6f; - this.damage = 5; - this.defense = 5; - this.life = 150; - this.knockBackResist = 1.4f; - this.color = new Color(250, 30, 90, 90); - this.value = 10000f; - } - else if (Name == "Baby Slime") - { - this.SetDefaults(1); - this.name = Name; - this.scale = 0.9f; - this.damage = 13; - this.defense = 4; - this.life = 30; - this.knockBackResist = 0.95f; - this.alpha = 120; - this.color = new Color(0, 0, 0, 50); - this.value = 10f; - } - else if (Name == "Black Slime") - { - this.SetDefaults(1); - this.name = Name; - this.damage = 15; - this.defense = 4; - this.life = 0x2d; - this.color = new Color(0, 0, 0, 50); - this.value = 20f; - } - else if (Name == "Purple Slime") - { - this.SetDefaults(1); - this.name = Name; - this.scale = 1.2f; - this.damage = 12; - this.defense = 6; - this.life = 40; - this.knockBackResist = 0.9f; - this.color = new Color(200, 0, 0xff, 150); - this.value = 10f; - } - else if (Name == "Red Slime") - { - this.SetDefaults(1); - this.name = Name; - this.damage = 12; - this.defense = 4; - this.life = 0x23; - this.color = new Color(0xff, 30, 0, 100); - this.value = 8f; - } - else if (Name == "Yellow Slime") - { - this.SetDefaults(1); - this.name = Name; - this.scale = 1.2f; - this.damage = 15; - this.defense = 7; - this.life = 0x2d; - this.color = new Color(0xff, 0xff, 0, 100); - this.value = 10f; - } - else if (Name != "") - { - for (int i = 1; i < 0x2c; i++) - { - this.SetDefaults(i); - if (this.name == Name) - { - break; - } - if (i == 0x2b) - { - this.SetDefaults(0); - this.active = false; - } - } - } - else - { - this.active = false; - } - this.lifeMax = this.life; - } - - public static void SpawnNPC() - { - if (!Main.stopSpawns) - { - bool flag = false; - int num = 0; - int num2 = 0; - int num3 = 0; - for (int i = 0; i < 8; i++) - { - if (Main.player[i].active) - { - num3++; - } - } - for (int j = 0; j < 8; j++) - { - bool flag2 = false; - if (((Main.player[j].active && (Main.invasionType > 0)) && ((Main.invasionDelay == 0) && (Main.invasionSize > 0))) && (Main.player[j].position.Y < ((Main.worldSurface * 16.0) + Main.screenHeight))) - { - int num6 = 0xbb8; - if ((Main.player[j].position.X > ((Main.invasionX * 16.0) - num6)) && (Main.player[j].position.X < ((Main.invasionX * 16.0) + num6))) - { - flag2 = true; - } - } - flag = false; - spawnRate = ShankShock.defaultSpawnRate; - maxSpawns = ShankShock.defaultMaxSpawns; - if (Main.player[j].position.Y > ((Main.maxTilesY - 200) * 0x10)) - { - spawnRate = (int) (spawnRate * 1.5f); - maxSpawns = (int) (maxSpawns * 0.5f); - } - else if (Main.player[j].position.Y > ((Main.rockLayer * 16.0) + Main.screenHeight)) - { - spawnRate = (int) (spawnRate * 0.7); - maxSpawns = (int) (maxSpawns * 1.35f); - } - else if (Main.player[j].position.Y > ((Main.worldSurface * 16.0) + Main.screenHeight)) - { - spawnRate = (int) (spawnRate * 0.8); - maxSpawns = (int) (maxSpawns * 1.1f); - } - else if (!Main.dayTime) - { - spawnRate = (int) (spawnRate * 0.6); - maxSpawns = (int) (maxSpawns * 1.3f); - if (Main.bloodMoon) - { - spawnRate = (int) (spawnRate * 0.3); - maxSpawns = (int) (maxSpawns * 1.8f); - } - } - if (Main.player[j].zoneDungeon) - { - spawnRate = (int) (defaultSpawnRate * 0.1); - maxSpawns = (int) (defaultMaxSpawns * 2.1); - } - else if (Main.player[j].zoneEvil) - { - spawnRate = (int) (spawnRate * 0.5); - maxSpawns = (int) (maxSpawns * 1.4f); - } - else if (Main.player[j].zoneMeteor) - { - spawnRate = (int) (spawnRate * 0.5); - } - else if (Main.player[j].zoneJungle) - { - spawnRate = (int) (spawnRate * 0.3); - maxSpawns = (int) (maxSpawns * 1.6f); - } - if (spawnRate < (defaultSpawnRate * 0.1)) - { - spawnRate = (int) (defaultSpawnRate * 0.1); - } - if (maxSpawns > (defaultMaxSpawns * 2.5)) - { - maxSpawns = (int) (defaultMaxSpawns * 2.5); - } - if (Main.player[j].inventory[Main.player[j].selectedItem].type == 0x31) - { - spawnRate = (int) (spawnRate * 0.75); - maxSpawns = (int) (maxSpawns * 1.5f); - } - if (flag2) - { - maxSpawns = (int) (defaultMaxSpawns * (1.0 + (0.4 * num3))); - spawnRate = 30; - } - if ((!flag2 && (!Main.bloodMoon || Main.dayTime)) && ((!Main.player[j].zoneDungeon && !Main.player[j].zoneEvil) && !Main.player[j].zoneMeteor)) - { - if (Main.player[j].townNPCs == 1) - { - maxSpawns = (int) (maxSpawns * 0.6); - spawnRate = (int) (spawnRate * 2f); - } - else if (Main.player[j].townNPCs == 2) - { - maxSpawns = (int) (maxSpawns * 0.3); - spawnRate = (int) (spawnRate * 3f); - } - else if (Main.player[j].townNPCs >= 3) - { - maxSpawns = 0; - spawnRate = 0x1869f; - } - } - if ((Main.player[j].active && !Main.player[j].dead) && ((Main.player[j].activeNPCs < maxSpawns) && (Main.rand.Next(spawnRate) == 0))) - { - int minValue = ((int) (Main.player[j].position.X / 16f)) - spawnRangeX; - int maxValue = ((int) (Main.player[j].position.X / 16f)) + spawnRangeX; - int num9 = ((int) (Main.player[j].position.Y / 16f)) - spawnRangeY; - int maxTilesY = ((int) (Main.player[j].position.Y / 16f)) + spawnRangeY; - int num11 = ((int) (Main.player[j].position.X / 16f)) - safeRangeX; - int num12 = ((int) (Main.player[j].position.X / 16f)) + safeRangeX; - int num13 = ((int) (Main.player[j].position.Y / 16f)) - safeRangeY; - int num14 = ((int) (Main.player[j].position.Y / 16f)) + safeRangeY; - if (minValue < 0) - { - minValue = 0; - } - if (maxValue > Main.maxTilesX) - { - maxValue = Main.maxTilesX; - } - if (num9 < 0) - { - num9 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int k = 0; k < 50; k++) - { - int num16 = Main.rand.Next(minValue, maxValue); - int num17 = Main.rand.Next(num9, maxTilesY); - if (!Main.tile[num16, num17].active || !Main.tileSolid[Main.tile[num16, num17].type]) - { - if (Main.wallHouse[Main.tile[num16, num17].wall]) - { - goto Label_0846; - } - for (int m = num17; m < Main.maxTilesY; m++) - { - if (Main.tile[num16, m].active && Main.tileSolid[Main.tile[num16, m].type]) - { - if (((num16 < num11) || (num16 > num12)) || ((m < num13) || (m > num14))) - { - byte num1 = Main.tile[num16, m].type; - num = num16; - num2 = m; - flag = true; - } - break; - } - } - if (flag) - { - int num19 = num - (spawnSpaceX / 2); - int num20 = num + (spawnSpaceX / 2); - int num21 = num2 - spawnSpaceY; - int num22 = num2; - if (num19 < 0) - { - flag = false; - } - if (num20 > Main.maxTilesX) - { - flag = false; - } - if (num21 < 0) - { - flag = false; - } - if (num22 > Main.maxTilesY) - { - flag = false; - } - if (flag) - { - for (int n = num19; n < num20; n++) - { - for (int num24 = num21; num24 < num22; num24++) - { - if (Main.tile[n, num24].active && Main.tileSolid[Main.tile[n, num24].type]) - { - flag = false; - break; - } - if (Main.tile[n, num24].lava && (num24 < (Main.maxTilesY - 200))) - { - flag = false; - break; - } - } - } - } - } - } - if (flag || flag) - { - break; - } - Label_0846:; - } - } - if (flag) - { - Rectangle rectangle = new Rectangle(num * 0x10, num2 * 0x10, 0x10, 0x10); - for (int num25 = 0; num25 < 8; num25++) - { - if (Main.player[num25].active) - { - Rectangle rectangle2 = new Rectangle(((((int) Main.player[num25].position.X) + (Main.player[num25].width / 2)) - (Main.screenWidth / 2)) - safeRangeX, ((((int) Main.player[num25].position.Y) + (Main.player[num25].height / 2)) - (Main.screenHeight / 2)) - safeRangeY, Main.screenWidth + (safeRangeX * 2), Main.screenHeight + (safeRangeY * 2)); - if (rectangle.Intersects(rectangle2)) - { - flag = false; - } - } - } - } - if ((flag && Main.player[j].zoneDungeon) && (!Main.tileDungeon[Main.tile[num, num2].type] || (Main.tile[num, num2 - 1].wall == 0))) - { - flag = false; - } - if (!flag) - { - continue; - } - flag = false; - int type = Main.tile[num, num2].type; - int index = 0x3e8; - if (flag2) - { - if (Main.rand.Next(9) == 0) - { - NewNPC((num * 0x10) + 8, num2 * 0x10, 0x1d, 0); - } - else if (Main.rand.Next(5) == 0) - { - NewNPC((num * 0x10) + 8, num2 * 0x10, 0x1a, 0); - } - else if (Main.rand.Next(3) == 0) - { - NewNPC((num * 0x10) + 8, num2 * 0x10, 0x1b, 0); - } - else - { - NewNPC((num * 0x10) + 8, num2 * 0x10, 0x1c, 0); - } - } - else if (Main.player[j].zoneDungeon) - { - if (!downedBoss3) - { - index = NewNPC((num * 0x10) + 8, num2 * 0x10, 0x23, 0); - Main.npc[index].ai[0] = 1f; - Main.npc[index].ai[2] = 2f; - } - else if (Main.rand.Next(4) == 0) - { - index = NewNPC((num * 0x10) + 8, num2 * 0x10, 0x22, 0); - } - else if (Main.rand.Next(5) == 0) - { - index = NewNPC((num * 0x10) + 8, num2 * 0x10, 0x20, 0); - } - else - { - index = NewNPC((num * 0x10) + 8, num2 * 0x10, 0x1f, 0); - } - } - else if (Main.player[j].zoneMeteor) - { - index = NewNPC((num * 0x10) + 8, num2 * 0x10, 0x17, 0); - } - else if (Main.player[j].zoneEvil && (Main.rand.Next(50) == 0)) - { - index = NewNPC((num * 0x10) + 8, num2 * 0x10, 7, 1); - } - else if (type == 60) - { - if (Main.rand.Next(3) == 0) - { - index = NewNPC((num * 0x10) + 8, num2 * 0x10, 0x2b, 0); - Main.npc[index].ai[0] = num; - Main.npc[index].ai[1] = num2; - Main.npc[index].netUpdate = true; - } - else - { - index = NewNPC((num * 0x10) + 8, num2 * 0x10, 0x2a, 0); - } - } - else if (num2 <= Main.worldSurface) - { - switch (type) - { - case 0x17: - case 0x19: - index = NewNPC((num * 0x10) + 8, num2 * 0x10, 6, 0); - goto Label_0E3E; - } - if (Main.dayTime) - { - int num28 = Math.Abs((int) (num - Main.spawnTileX)); - index = NewNPC((num * 0x10) + 8, num2 * 0x10, 1, 0); - if ((Main.rand.Next(3) == 0) || (num28 < 200)) - { - Main.npc[index].SetDefaults("Green Slime"); - } - else if ((Main.rand.Next(10) == 0) && (num28 > 400)) - { - Main.npc[index].SetDefaults("Purple Slime"); - } - } - else if ((Main.rand.Next(6) == 0) || ((Main.moonPhase == 4) && (Main.rand.Next(2) == 0))) - { - index = NewNPC((num * 0x10) + 8, num2 * 0x10, 2, 0); - } - else - { - NewNPC((num * 0x10) + 8, num2 * 0x10, 3, 0); - } - } - else if (num2 <= Main.rockLayer) - { - if (Main.rand.Next(30) == 0) - { - index = NewNPC((num * 0x10) + 8, num2 * 0x10, 10, 1); - } - else - { - index = NewNPC((num * 0x10) + 8, num2 * 0x10, 1, 0); - if (Main.rand.Next(5) == 0) - { - Main.npc[index].SetDefaults("Yellow Slime"); - } - else if (Main.rand.Next(2) == 0) - { - Main.npc[index].SetDefaults("Blue Slime"); - } - else - { - Main.npc[index].SetDefaults("Red Slime"); - } - } - } - else if (num2 > (Main.maxTilesY - 190)) - { - if (Main.rand.Next(5) == 0) - { - index = NewNPC((num * 0x10) + 8, num2 * 0x10, 0x27, 1); - } - else - { - index = NewNPC((num * 0x10) + 8, num2 * 0x10, 0x18, 0); - } - } - else if (Main.rand.Next(0x23) == 0) - { - index = NewNPC((num * 0x10) + 8, num2 * 0x10, 10, 1); - } - else if (Main.rand.Next(5) == 0) - { - index = NewNPC((num * 0x10) + 8, num2 * 0x10, 0x10, 0); - } - else if (Main.rand.Next(2) == 0) - { - index = NewNPC((num * 0x10) + 8, num2 * 0x10, 0x15, 0); - } - else - { - index = NewNPC((num * 0x10) + 8, num2 * 0x10, 1, 0); - Main.npc[index].SetDefaults("Black Slime"); - } - Label_0E3E: - if ((Main.npc[index].type == 1) && (Main.rand.Next(250) == 0)) - { - Main.npc[index].SetDefaults("Pinky"); - } - if ((Main.netMode != 2) || (index >= 0x3e8)) - { - break; - } - NetMessage.SendData(0x17, -1, -1, "", index, 0f, 0f, 0f); - return; - } - } - } - - public static void SpawnOnPlayer(int plr, int Type) - { - bool flag = false; - int num = 0; - int num2 = 0; - int minValue = ((int) (Main.player[plr].position.X / 16f)) - (spawnRangeX * 3); - int maxValue = ((int) (Main.player[plr].position.X / 16f)) + (spawnRangeX * 3); - int num5 = ((int) (Main.player[plr].position.Y / 16f)) - (spawnRangeY * 3); - int maxTilesY = ((int) (Main.player[plr].position.Y / 16f)) + (spawnRangeY * 3); - int num7 = ((int) (Main.player[plr].position.X / 16f)) - safeRangeX; - int num8 = ((int) (Main.player[plr].position.X / 16f)) + safeRangeX; - int num9 = ((int) (Main.player[plr].position.Y / 16f)) - safeRangeY; - int num10 = ((int) (Main.player[plr].position.Y / 16f)) + safeRangeY; - if (minValue < 0) - { - minValue = 0; - } - if (maxValue > Main.maxTilesX) - { - maxValue = Main.maxTilesX; - } - if (num5 < 0) - { - num5 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int i = 0; i < 0x3e8; i++) - { - for (int j = 0; j < 100; j++) - { - int num13 = Main.rand.Next(minValue, maxValue); - int num14 = Main.rand.Next(num5, maxTilesY); - if (!Main.tile[num13, num14].active || !Main.tileSolid[Main.tile[num13, num14].type]) - { - if (Main.tile[num13, num14].wall == 1) - { - continue; - } - for (int k = num14; k < Main.maxTilesY; k++) - { - if (Main.tile[num13, k].active && Main.tileSolid[Main.tile[num13, k].type]) - { - if (((num13 < num7) || (num13 > num8)) || ((k < num9) || (k > num10))) - { - byte type = Main.tile[num13, k].type; - num = num13; - num2 = k; - flag = true; - } - break; - } - } - if (flag) - { - int num16 = num - (spawnSpaceX / 2); - int num17 = num + (spawnSpaceX / 2); - int num18 = num2 - spawnSpaceY; - int num19 = num2; - if (num16 < 0) - { - flag = false; - } - if (num17 > Main.maxTilesX) - { - flag = false; - } - if (num18 < 0) - { - flag = false; - } - if (num19 > Main.maxTilesY) - { - flag = false; - } - if (flag) - { - for (int m = num16; m < num17; m++) - { - for (int n = num18; n < num19; n++) - { - if (Main.tile[m, n].active && Main.tileSolid[Main.tile[m, n].type]) - { - flag = false; - break; - } - } - } - } - } - } - if (flag || flag) - { - break; - } - } - if (flag) - { - Rectangle rectangle = new Rectangle(num * 0x10, num2 * 0x10, 0x10, 0x10); - for (int num22 = 0; num22 < 8; num22++) - { - if (Main.player[num22].active) - { - Rectangle rectangle2 = new Rectangle(((((int) Main.player[num22].position.X) + (Main.player[num22].width / 2)) - (Main.screenWidth / 2)) - safeRangeX, ((((int) Main.player[num22].position.Y) + (Main.player[num22].height / 2)) - (Main.screenHeight / 2)) - safeRangeY, Main.screenWidth + (safeRangeX * 2), Main.screenHeight + (safeRangeY * 2)); - if (rectangle.Intersects(rectangle2)) - { - flag = false; - } - } - } - } - if (flag) - { - break; - } - } - if (flag) - { - int index = 0x3e8; - index = NewNPC((num * 0x10) + 8, num2 * 0x10, Type, 1); - Main.npc[index].target = plr; - string name = Main.npc[index].name; - if (Main.npc[index].type == 13) - { - name = "Eater of Worlds"; - } - if (Main.npc[index].type == 0x23) - { - name = "Skeletron"; - } - if ((Main.netMode == 2) && (index < 0x3e8)) - { - NetMessage.SendData(0x17, -1, -1, "", index, 0f, 0f, 0f); - } - if (Main.netMode == 0) - { - Main.NewText(name + " has awoken!", 0xaf, 0x4b, 0xff); - } - else if (Main.netMode == 2) - { - NetMessage.SendData(0x19, -1, -1, name + " has awoken!", 8, 175f, 75f, 255f); - } - } - } - - public double StrikeNPC(int Damage, float knockBack, int hitDirection) - { - if (!this.active || (this.life <= 0)) - { - return 0.0; - } - double dmg = Main.CalculateDamage(Damage, this.defense); - if (this.friendly) - { - CombatText.NewText(new Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height), new Color(0xff, 80, 90, 0xff), ((int) dmg).ToString()); - } - else - { - CombatText.NewText(new Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height), new Color(0xff, 160, 80, 0xff), ((int) dmg).ToString()); - } - if (dmg < 1.0) - { - return 0.0; - } - if (this.townNPC) - { - this.ai[0] = 1f; - this.ai[1] = 300 + Main.rand.Next(300); - this.ai[2] = 0f; - this.direction = hitDirection; - this.netUpdate = true; - } - if ((this.aiStyle == 8) && (Main.netMode != 1)) - { - this.ai[0] = 400f; - this.TargetClosest(); - } - this.life -= (int) dmg; - if ((knockBack > 0f) && (this.knockBackResist > 0f)) - { - if (!this.noGravity) - { - this.velocity.Y = (-knockBack * 0.75f) * this.knockBackResist; - } - else - { - this.velocity.Y = (-knockBack * 0.5f) * this.knockBackResist; - } - this.velocity.X = (knockBack * hitDirection) * this.knockBackResist; - } - this.HitEffect(hitDirection, dmg); - if (this.soundHit > 0) - { - Main.PlaySound(3, (int) this.position.X, (int) this.position.Y, this.soundHit); - } - if (this.life <= 0) - { - if (this.townNPC && (this.type != 0x25)) - { - if (Main.netMode == 0) - { - Main.NewText(this.name + " was slain...", 0xff, 0x19, 0x19); - } - else if (Main.netMode == 2) - { - NetMessage.SendData(0x19, -1, -1, this.name + " was slain...", 8, 255f, 25f, 25f); - } - } - if ((this.townNPC && (Main.netMode != 1)) && (this.homeless && (WorldGen.spawnNPC == this.type))) - { - WorldGen.spawnNPC = 0; - } - if (this.soundKilled > 0) - { - Main.PlaySound(4, (int) this.position.X, (int) this.position.Y, this.soundKilled); - } - this.NPCLoot(); - this.active = false; - if (((this.type != 0x1a) && (this.type != 0x1b)) && ((this.type != 0x1c) && (this.type != 0x1d))) - { - return dmg; - } - if (!ShankShock.infinateInvasion) - { - Main.invasionSize--; - } - if (ShankShock.infinateInvasion) - { - ShankShock.IncrementKills(); - } - } - return dmg; - } - - public void TargetClosest() - { - float num = -1f; - for (int i = 0; i < 8; i++) - { - if ((Main.player[i].active && !Main.player[i].dead) && ((num == -1f) || ((Math.Abs((float) (((Main.player[i].position.X + (Main.player[i].width / 2)) - this.position.X) + (this.width / 2))) + Math.Abs((float) (((Main.player[i].position.Y + (Main.player[i].height / 2)) - this.position.Y) + (this.height / 2)))) < num))) - { - num = Math.Abs((float) (((Main.player[i].position.X + (Main.player[i].width / 2)) - this.position.X) + (this.width / 2))) + Math.Abs((float) (((Main.player[i].position.Y + (Main.player[i].height / 2)) - this.position.Y) + (this.height / 2))); - this.target = i; - } - } - if ((this.target < 0) || (this.target >= 8)) - { - this.target = 0; - } - this.targetRect = new Rectangle((int) Main.player[this.target].position.X, (int) Main.player[this.target].position.Y, Main.player[this.target].width, Main.player[this.target].height); - this.direction = 1; - if ((this.targetRect.X + (this.targetRect.Width / 2)) < (this.position.X + (this.width / 2))) - { - this.direction = -1; - } - this.directionY = 1; - if ((this.targetRect.Y + (this.targetRect.Height / 2)) < (this.position.Y + (this.height / 2))) - { - this.directionY = -1; - } - if (((this.direction != this.oldDirection) || (this.directionY != this.oldDirectionY)) || (this.target != this.oldTarget)) - { - this.netUpdate = true; - } - } - - public void UpdateNPC(int i) - { - this.whoAmI = i; - if (this.active) - { - float num = 10f; - float num2 = 0.3f; - if (this.wet) - { - num2 = 0.2f; - num = 7f; - } - if (this.soundDelay > 0) - { - this.soundDelay--; - } - if (this.life <= 0) - { - this.active = false; - } - this.oldTarget = this.target; - this.oldDirection = this.direction; - this.oldDirectionY = this.directionY; - this.AI(); - for (int j = 0; j < 9; j++) - { - if (this.immune[j] > 0) - { - this.immune[j]--; - } - } - if (!this.noGravity) - { - this.velocity.Y += num2; - if (this.velocity.Y > num) - { - this.velocity.Y = num; - } - } - if ((this.velocity.X < 0.005) && (this.velocity.X > -0.005)) - { - this.velocity.X = 0f; - } - if (((Main.netMode != 1) && this.friendly) && ((this.type != 0x16) && (this.type != 0x25))) - { - if (this.life < this.lifeMax) - { - this.friendlyRegen++; - if (this.friendlyRegen > 300) - { - this.friendlyRegen = 0; - this.life++; - this.netUpdate = true; - } - } - if (this.immune[8] == 0) - { - Rectangle rectangle = new Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height); - for (int k = 0; k < 0x3e8; k++) - { - if (Main.npc[k].active && !Main.npc[k].friendly) - { - Rectangle rectangle2 = new Rectangle((int) Main.npc[k].position.X, (int) Main.npc[k].position.Y, Main.npc[k].width, Main.npc[k].height); - if (rectangle.Intersects(rectangle2)) - { - int damage = Main.npc[k].damage; - int num6 = 6; - int hitDirection = 1; - if ((Main.npc[k].position.X + (Main.npc[k].width / 2)) > (this.position.X + (this.width / 2))) - { - hitDirection = -1; - } - Main.npc[i].StrikeNPC(damage, (float) num6, hitDirection); - if (Main.netMode != 0) - { - NetMessage.SendData(0x1c, -1, -1, "", i, (float) damage, (float) num6, (float) hitDirection); - } - this.netUpdate = true; - this.immune[8] = 30; - } - } - } - } - } - if (!this.noTileCollide) - { - bool flag = Collision.LavaCollision(this.position, this.width, this.height); - if (flag) - { - this.lavaWet = true; - if ((Main.netMode != 1) && (this.immune[8] == 0)) - { - this.immune[8] = 30; - this.StrikeNPC(50, 0f, 0); - if ((Main.netMode == 2) && (Main.netMode != 0)) - { - NetMessage.SendData(0x1c, -1, -1, "", this.whoAmI, 50f, 0f, 0f); - } - } - } - if (Collision.WetCollision(this.position, this.width, this.height)) - { - if (!this.wet && (this.wetCount == 0)) - { - this.wetCount = 10; - if (!flag) - { - for (int m = 0; m < 50; m++) - { - Color newColor = new Color(); - int index = Dust.NewDust(new Vector2(this.position.X - 6f, (this.position.Y + (this.height / 2)) - 8f), this.width + 12, 0x18, 0x21, 0f, 0f, 0, newColor, 1f); - Main.dust[index].velocity.Y -= 4f; - Main.dust[index].velocity.X *= 2.5f; - Main.dust[index].scale = 1.3f; - Main.dust[index].alpha = 100; - Main.dust[index].noGravity = true; - } - Main.PlaySound(0x13, (int) this.position.X, (int) this.position.Y, 0); - } - else - { - for (int n = 0; n < 20; n++) - { - Color color2 = new Color(); - int num11 = Dust.NewDust(new Vector2(this.position.X - 6f, (this.position.Y + (this.height / 2)) - 8f), this.width + 12, 0x18, 0x23, 0f, 0f, 0, color2, 1f); - Main.dust[num11].velocity.Y -= 1.5f; - Main.dust[num11].velocity.X *= 2.5f; - Main.dust[num11].scale = 1.3f; - Main.dust[num11].alpha = 100; - Main.dust[num11].noGravity = true; - } - Main.PlaySound(0x13, (int) this.position.X, (int) this.position.Y, 1); - } - } - this.wet = true; - } - else if (this.wet) - { - this.velocity.X *= 0.5f; - this.wet = false; - if (this.wetCount == 0) - { - this.wetCount = 10; - if (!this.lavaWet) - { - for (int num12 = 0; num12 < 50; num12++) - { - Color color3 = new Color(); - int num13 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (this.height / 2)), this.width + 12, 0x18, 0x21, 0f, 0f, 0, color3, 1f); - Main.dust[num13].velocity.Y -= 4f; - Main.dust[num13].velocity.X *= 2.5f; - Main.dust[num13].scale = 1.3f; - Main.dust[num13].alpha = 100; - Main.dust[num13].noGravity = true; - } - Main.PlaySound(0x13, (int) this.position.X, (int) this.position.Y, 0); - } - else - { - for (int num14 = 0; num14 < 20; num14++) - { - Color color4 = new Color(); - int num15 = Dust.NewDust(new Vector2(this.position.X - 6f, (this.position.Y + (this.height / 2)) - 8f), this.width + 12, 0x18, 0x23, 0f, 0f, 0, color4, 1f); - Main.dust[num15].velocity.Y -= 1.5f; - Main.dust[num15].velocity.X *= 2.5f; - Main.dust[num15].scale = 1.3f; - Main.dust[num15].alpha = 100; - Main.dust[num15].noGravity = true; - } - Main.PlaySound(0x13, (int) this.position.X, (int) this.position.Y, 1); - } - } - } - if (!this.wet) - { - this.lavaWet = false; - } - if (this.wetCount > 0) - { - this.wetCount = (byte) (this.wetCount - 1); - } - bool fallThrough = false; - if (this.aiStyle == 10) - { - fallThrough = true; - } - if ((this.aiStyle == 3) && (this.directionY == 1)) - { - fallThrough = true; - } - this.oldVelocity = this.velocity; - this.collideX = false; - this.collideY = false; - if (this.wet) - { - Vector2 velocity = this.velocity; - this.velocity = Collision.TileCollision(this.position, this.velocity, this.width, this.height, fallThrough, fallThrough); - Vector2 vector2 = (Vector2) (this.velocity * 0.5f); - if (this.velocity.X != velocity.X) - { - vector2.X = this.velocity.X; - this.collideX = true; - } - if (this.velocity.Y != velocity.Y) - { - vector2.Y = this.velocity.Y; - this.collideY = true; - } - this.oldPosition = this.position; - this.position += vector2; - } - else - { - this.velocity = Collision.TileCollision(this.position, this.velocity, this.width, this.height, fallThrough, fallThrough); - if (this.oldVelocity.X != this.velocity.X) - { - this.collideX = true; - } - if (this.oldVelocity.Y != this.velocity.Y) - { - this.collideY = true; - } - this.oldPosition = this.position; - this.position += this.velocity; - } - } - else - { - this.oldPosition = this.position; - this.position += this.velocity; - } - if (!this.active) - { - this.netUpdate = true; - } - if ((Main.netMode == 2) && this.netUpdate) - { - NetMessage.SendData(0x17, -1, -1, "", i, 0f, 0f, 0f); - } - this.FindFrame(); - this.CheckActive(); - this.netUpdate = false; - } - } - } -} - diff --git a/Terraria/NetMessage.cs b/Terraria/NetMessage.cs deleted file mode 100644 index ab4b8aed..00000000 --- a/Terraria/NetMessage.cs +++ /dev/null @@ -1,1335 +0,0 @@ -namespace Terraria -{ - using System; - using System.Runtime.InteropServices; - using System.Text; - using System.IO; - - public class NetMessage - { - public static messageBuffer[] buffer = new messageBuffer[10]; - - public static void CheckBytes(int i = 9) - { - lock (buffer[i]) - { - int startIndex = 0; - if (buffer[i].totalData >= 4) - { - if (buffer[i].messageLength == 0) - { - buffer[i].messageLength = BitConverter.ToInt32(buffer[i].readBuffer, 0) + 4; - } - while ((buffer[i].totalData >= (buffer[i].messageLength + startIndex)) && (buffer[i].messageLength > 0)) - { - if (!Main.ignoreErrors) - { - buffer[i].GetData(startIndex + 4, buffer[i].messageLength - 4); - } - else - { - try - { - buffer[i].GetData(startIndex + 4, buffer[i].messageLength - 4); - } - catch - { - } - } - startIndex += buffer[i].messageLength; - if ((buffer[i].totalData - startIndex) >= 4) - { - buffer[i].messageLength = BitConverter.ToInt32(buffer[i].readBuffer, startIndex) + 4; - } - else - { - buffer[i].messageLength = 0; - } - } - if (startIndex == buffer[i].totalData) - { - buffer[i].totalData = 0; - } - else if (startIndex > 0) - { - Buffer.BlockCopy(buffer[i].readBuffer, startIndex, buffer[i].readBuffer, 0, buffer[i].totalData - startIndex); - messageBuffer buffer1 = buffer[i]; - buffer1.totalData -= startIndex; - } - buffer[i].checkBytes = false; - } - } - } - - - - public static void greetPlayer(int plr) - { - if (Main.player[plr].statLifeMax > 400 || Main.player[plr].statManaMax > 200 || Main.player[plr].statLife > 400 || Main.player[plr].statMana > 200) - { - ShankShock.HandleCheater(plr); - } - ShankShock.ShowMOTD(plr); - ShankShock.ShowUpdateReminder(plr); - if (ShankShock.IsAdmin(Main.player[plr].name)) - { - if (!ShankShock.shownOneTimeInvasionMinder && ShankShock.infinateInvasion) - { - ShankShock.SendMessage(plr, "You must run /invade to start the infinite invasion.", new float[] { 255, 0, 0 }); - } - } - if (ShankShock.permaPvp) - { - Main.player[plr].hostile = true; - NetMessage.SendData(30, -1, -1, "", plr); - } - } - - public static void RecieveBytes(byte[] bytes, int streamLength, int i = 9) - { - lock (buffer[i]) - { - try - { - Buffer.BlockCopy(bytes, 0, buffer[i].readBuffer, buffer[i].totalData, streamLength); - messageBuffer buffer1 = buffer[i]; - buffer1.totalData += streamLength; - buffer[i].checkBytes = true; - } - catch - { - if (Main.netMode == 1) - { - Main.menuMode = 15; - Main.statusText = "Bad header lead to a read buffer overflow."; - Netplay.disconnect = true; - } - else - { - Netplay.serverSock[i].kill = true; - } - } - } - } - - public static void SendData(int msgType, int remoteClient = -1, int ignoreClient = -1, string text = "", int number = 0, float number2 = 0f, float number3 = 0f, float number4 = 0f) - { - int index = 9; - if ((Main.netMode == 2) && (remoteClient >= 0)) - { - index = remoteClient; - } - lock (buffer[index]) - { - int count = 5; - int num3 = count; - if (msgType == 1) - { - byte[] bytes = BitConverter.GetBytes(msgType); - byte[] src = Encoding.ASCII.GetBytes("Terraria" + Main.curRelease); - count += src.Length; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(bytes, 0, buffer[index].writeBuffer, 4, 1); - Buffer.BlockCopy(src, 0, buffer[index].writeBuffer, 5, src.Length); - } - else if (msgType == 2) - { - byte[] buffer4 = BitConverter.GetBytes(msgType); - byte[] buffer5 = Encoding.ASCII.GetBytes(text); - count += buffer5.Length; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer4, 0, buffer[index].writeBuffer, 4, 1); - Buffer.BlockCopy(buffer5, 0, buffer[index].writeBuffer, 5, buffer5.Length); - } - else if (msgType == 3) - { - byte[] buffer7 = BitConverter.GetBytes(msgType); - byte[] buffer8 = BitConverter.GetBytes(remoteClient); - count += buffer8.Length; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer7, 0, buffer[index].writeBuffer, 4, 1); - Buffer.BlockCopy(buffer8, 0, buffer[index].writeBuffer, 5, buffer8.Length); - } - else if (msgType == 4) - { - byte[] buffer10 = BitConverter.GetBytes(msgType); - byte num4 = (byte) number; - byte hair = (byte) Main.player[num4].hair; - byte[] buffer11 = Encoding.ASCII.GetBytes(text); - count += 0x17 + buffer11.Length; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer10, 0, buffer[index].writeBuffer, 4, 1); - buffer[index].writeBuffer[5] = num4; - num3++; - buffer[index].writeBuffer[6] = hair; - num3++; - buffer[index].writeBuffer[num3] = Main.player[num4].hairColor.R; - num3++; - buffer[index].writeBuffer[num3] = Main.player[num4].hairColor.G; - num3++; - buffer[index].writeBuffer[num3] = Main.player[num4].hairColor.B; - num3++; - buffer[index].writeBuffer[num3] = Main.player[num4].skinColor.R; - num3++; - buffer[index].writeBuffer[num3] = Main.player[num4].skinColor.G; - num3++; - buffer[index].writeBuffer[num3] = Main.player[num4].skinColor.B; - num3++; - buffer[index].writeBuffer[num3] = Main.player[num4].eyeColor.R; - num3++; - buffer[index].writeBuffer[num3] = Main.player[num4].eyeColor.G; - num3++; - buffer[index].writeBuffer[num3] = Main.player[num4].eyeColor.B; - num3++; - buffer[index].writeBuffer[num3] = Main.player[num4].shirtColor.R; - num3++; - buffer[index].writeBuffer[num3] = Main.player[num4].shirtColor.G; - num3++; - buffer[index].writeBuffer[num3] = Main.player[num4].shirtColor.B; - num3++; - buffer[index].writeBuffer[num3] = Main.player[num4].underShirtColor.R; - num3++; - buffer[index].writeBuffer[num3] = Main.player[num4].underShirtColor.G; - num3++; - buffer[index].writeBuffer[num3] = Main.player[num4].underShirtColor.B; - num3++; - buffer[index].writeBuffer[num3] = Main.player[num4].pantsColor.R; - num3++; - buffer[index].writeBuffer[num3] = Main.player[num4].pantsColor.G; - num3++; - buffer[index].writeBuffer[num3] = Main.player[num4].pantsColor.B; - num3++; - buffer[index].writeBuffer[num3] = Main.player[num4].shoeColor.R; - num3++; - buffer[index].writeBuffer[num3] = Main.player[num4].shoeColor.G; - num3++; - buffer[index].writeBuffer[num3] = Main.player[num4].shoeColor.B; - num3++; - Buffer.BlockCopy(buffer11, 0, buffer[index].writeBuffer, num3, buffer11.Length); - } - else if (msgType == 5) - { - byte stack; - byte[] buffer13 = BitConverter.GetBytes(msgType); - byte num6 = (byte) number; - byte num7 = (byte) number2; - if (number2 < 44f) - { - stack = (byte) Main.player[number].inventory[(int) number2].stack; - if (Main.player[number].inventory[(int) number2].stack < 0) - { - stack = 0; - } - } - else - { - stack = (byte) Main.player[number].armor[((int) number2) - 0x2c].stack; - if (Main.player[number].armor[((int) number2) - 0x2c].stack < 0) - { - stack = 0; - } - } - string s = text; - if (s == null) - { - s = ""; - } - byte[] buffer14 = Encoding.ASCII.GetBytes(s); - count += 3 + buffer14.Length; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer13, 0, buffer[index].writeBuffer, 4, 1); - buffer[index].writeBuffer[5] = num6; - num3++; - buffer[index].writeBuffer[6] = num7; - num3++; - buffer[index].writeBuffer[7] = stack; - num3++; - Buffer.BlockCopy(buffer14, 0, buffer[index].writeBuffer, num3, buffer14.Length); - } - else if (msgType == 6) - { - byte[] buffer16 = BitConverter.GetBytes(msgType); - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer16, 0, buffer[index].writeBuffer, 4, 1); - } - else if (msgType == 7) - { - byte[] buffer18 = BitConverter.GetBytes(msgType); - byte[] buffer19 = BitConverter.GetBytes((int) Main.time); - byte num9 = 0; - if (Main.dayTime) - { - num9 = 1; - } - byte moonPhase = (byte) Main.moonPhase; - byte num11 = 0; - if (Main.bloodMoon) - { - num11 = 1; - } - byte[] buffer20 = BitConverter.GetBytes(Main.maxTilesX); - byte[] buffer21 = BitConverter.GetBytes(Main.maxTilesY); - byte[] buffer22 = BitConverter.GetBytes(Main.spawnTileX); - byte[] buffer23 = BitConverter.GetBytes(Main.spawnTileY); - byte[] buffer24 = BitConverter.GetBytes((int) Main.worldSurface); - byte[] buffer25 = BitConverter.GetBytes((int) Main.rockLayer); - byte[] buffer26 = BitConverter.GetBytes(Main.worldID); - byte[] buffer27 = Encoding.ASCII.GetBytes(Main.worldName); - count += ((((((((((buffer19.Length + 1) + 1) + 1) + buffer20.Length) + buffer21.Length) + buffer22.Length) + buffer23.Length) + buffer24.Length) + buffer25.Length) + buffer26.Length) + buffer27.Length; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer18, 0, buffer[index].writeBuffer, 4, 1); - Buffer.BlockCopy(buffer19, 0, buffer[index].writeBuffer, 5, buffer19.Length); - num3 += buffer19.Length; - buffer[index].writeBuffer[num3] = num9; - num3++; - buffer[index].writeBuffer[num3] = moonPhase; - num3++; - buffer[index].writeBuffer[num3] = num11; - num3++; - Buffer.BlockCopy(buffer20, 0, buffer[index].writeBuffer, num3, buffer20.Length); - num3 += buffer20.Length; - Buffer.BlockCopy(buffer21, 0, buffer[index].writeBuffer, num3, buffer21.Length); - num3 += buffer21.Length; - Buffer.BlockCopy(buffer22, 0, buffer[index].writeBuffer, num3, buffer22.Length); - num3 += buffer22.Length; - Buffer.BlockCopy(buffer23, 0, buffer[index].writeBuffer, num3, buffer23.Length); - num3 += buffer23.Length; - Buffer.BlockCopy(buffer24, 0, buffer[index].writeBuffer, num3, buffer24.Length); - num3 += buffer24.Length; - Buffer.BlockCopy(buffer25, 0, buffer[index].writeBuffer, num3, buffer25.Length); - num3 += buffer25.Length; - Buffer.BlockCopy(buffer26, 0, buffer[index].writeBuffer, num3, buffer26.Length); - num3 += buffer26.Length; - Buffer.BlockCopy(buffer27, 0, buffer[index].writeBuffer, num3, buffer27.Length); - num3 += buffer27.Length; - } - else if (msgType == 8) - { - byte[] buffer29 = BitConverter.GetBytes(msgType); - byte[] buffer30 = BitConverter.GetBytes(number); - byte[] buffer31 = BitConverter.GetBytes((int) number2); - count += buffer30.Length + buffer31.Length; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer29, 0, buffer[index].writeBuffer, 4, 1); - Buffer.BlockCopy(buffer30, 0, buffer[index].writeBuffer, num3, 4); - num3 += 4; - Buffer.BlockCopy(buffer31, 0, buffer[index].writeBuffer, num3, 4); - } - else if (msgType == 9) - { - byte[] buffer33 = BitConverter.GetBytes(msgType); - byte[] buffer34 = BitConverter.GetBytes(number); - byte[] buffer35 = Encoding.ASCII.GetBytes(text); - count += buffer34.Length + buffer35.Length; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer33, 0, buffer[index].writeBuffer, 4, 1); - Buffer.BlockCopy(buffer34, 0, buffer[index].writeBuffer, num3, 4); - num3 += 4; - Buffer.BlockCopy(buffer35, 0, buffer[index].writeBuffer, num3, buffer35.Length); - } - else if (msgType == 10) - { - short num12 = (short) number; - int num13 = (int) number2; - int num14 = (int) number3; - Buffer.BlockCopy(BitConverter.GetBytes(msgType), 0, buffer[index].writeBuffer, 4, 1); - Buffer.BlockCopy(BitConverter.GetBytes(num12), 0, buffer[index].writeBuffer, num3, 2); - num3 += 2; - Buffer.BlockCopy(BitConverter.GetBytes(num13), 0, buffer[index].writeBuffer, num3, 4); - num3 += 4; - Buffer.BlockCopy(BitConverter.GetBytes(num14), 0, buffer[index].writeBuffer, num3, 4); - num3 += 4; - for (int i = num13; i < (num13 + num12); i++) - { - byte num16 = 0; - if (Main.tile[i, num14].active) - { - num16 = (byte) (num16 + 1); - } - if (Main.tile[i, num14].lighted) - { - num16 = (byte) (num16 + 2); - } - if (Main.tile[i, num14].wall > 0) - { - num16 = (byte) (num16 + 4); - } - if (Main.tile[i, num14].liquid > 0) - { - num16 = (byte) (num16 + 8); - } - buffer[index].writeBuffer[num3] = num16; - num3++; - byte[] buffer41 = BitConverter.GetBytes(Main.tile[i, num14].frameX); - byte[] buffer42 = BitConverter.GetBytes(Main.tile[i, num14].frameY); - byte wall = Main.tile[i, num14].wall; - if (Main.tile[i, num14].active) - { - buffer[index].writeBuffer[num3] = Main.tile[i, num14].type; - num3++; - if (Main.tileFrameImportant[Main.tile[i, num14].type]) - { - Buffer.BlockCopy(buffer41, 0, buffer[index].writeBuffer, num3, 2); - num3 += 2; - Buffer.BlockCopy(buffer42, 0, buffer[index].writeBuffer, num3, 2); - num3 += 2; - } - } - if (wall > 0) - { - buffer[index].writeBuffer[num3] = wall; - num3++; - } - if (Main.tile[i, num14].liquid > 0) - { - buffer[index].writeBuffer[num3] = Main.tile[i, num14].liquid; - num3++; - byte num18 = 0; - if (Main.tile[i, num14].lava) - { - num18 = 1; - } - buffer[index].writeBuffer[num3] = num18; - num3++; - } - } - Buffer.BlockCopy(BitConverter.GetBytes((int) (num3 - 4)), 0, buffer[index].writeBuffer, 0, 4); - count = num3; - } - else if (msgType == 11) - { - byte[] buffer44 = BitConverter.GetBytes(msgType); - byte[] buffer45 = BitConverter.GetBytes(number); - byte[] buffer46 = BitConverter.GetBytes((int) number2); - byte[] buffer47 = BitConverter.GetBytes((int) number3); - byte[] buffer48 = BitConverter.GetBytes((int) number4); - count += ((buffer45.Length + buffer46.Length) + buffer47.Length) + buffer48.Length; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer44, 0, buffer[index].writeBuffer, 4, 1); - Buffer.BlockCopy(buffer45, 0, buffer[index].writeBuffer, num3, 4); - num3 += 4; - Buffer.BlockCopy(buffer46, 0, buffer[index].writeBuffer, num3, 4); - num3 += 4; - Buffer.BlockCopy(buffer47, 0, buffer[index].writeBuffer, num3, 4); - num3 += 4; - Buffer.BlockCopy(buffer48, 0, buffer[index].writeBuffer, num3, 4); - num3 += 4; - } - else if (msgType == 12) - { - byte[] buffer50 = BitConverter.GetBytes(msgType); - byte num19 = (byte) number; - byte[] buffer51 = BitConverter.GetBytes(Main.player[num19].SpawnX); - byte[] buffer52 = BitConverter.GetBytes(Main.player[num19].SpawnY); - count += (1 + buffer51.Length) + buffer52.Length; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer50, 0, buffer[index].writeBuffer, 4, 1); - buffer[index].writeBuffer[num3] = num19; - num3++; - Buffer.BlockCopy(buffer51, 0, buffer[index].writeBuffer, num3, 4); - num3 += 4; - Buffer.BlockCopy(buffer52, 0, buffer[index].writeBuffer, num3, 4); - num3 += 4; - } - else if (msgType == 13) - { - byte[] buffer54 = BitConverter.GetBytes(msgType); - byte num20 = (byte) number; - byte num21 = 0; - if (Main.player[num20].controlUp) - { - num21 = (byte) (num21 + 1); - } - if (Main.player[num20].controlDown) - { - num21 = (byte) (num21 + 2); - } - if (Main.player[num20].controlLeft) - { - num21 = (byte) (num21 + 4); - } - if (Main.player[num20].controlRight) - { - num21 = (byte) (num21 + 8); - } - if (Main.player[num20].controlJump) - { - num21 = (byte) (num21 + 0x10); - } - if (Main.player[num20].controlUseItem) - { - num21 = (byte) (num21 + 0x20); - } - if (Main.player[num20].direction == 1) - { - num21 = (byte) (num21 + 0x40); - } - byte selectedItem = (byte) Main.player[num20].selectedItem; - byte[] buffer55 = BitConverter.GetBytes(Main.player[number].position.X); - byte[] buffer56 = BitConverter.GetBytes(Main.player[number].position.Y); - byte[] buffer57 = BitConverter.GetBytes(Main.player[number].velocity.X); - byte[] buffer58 = BitConverter.GetBytes(Main.player[number].velocity.Y); - count += (((3 + buffer55.Length) + buffer56.Length) + buffer57.Length) + buffer58.Length; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer54, 0, buffer[index].writeBuffer, 4, 1); - buffer[index].writeBuffer[5] = num20; - num3++; - buffer[index].writeBuffer[6] = num21; - num3++; - buffer[index].writeBuffer[7] = selectedItem; - num3++; - Buffer.BlockCopy(buffer55, 0, buffer[index].writeBuffer, num3, 4); - num3 += 4; - Buffer.BlockCopy(buffer56, 0, buffer[index].writeBuffer, num3, 4); - num3 += 4; - Buffer.BlockCopy(buffer57, 0, buffer[index].writeBuffer, num3, 4); - num3 += 4; - Buffer.BlockCopy(buffer58, 0, buffer[index].writeBuffer, num3, 4); - } - else if (msgType == 14) - { - byte[] buffer60 = BitConverter.GetBytes(msgType); - byte num23 = (byte) number; - byte num24 = (byte) number2; - count += 2; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer60, 0, buffer[index].writeBuffer, 4, 1); - buffer[index].writeBuffer[5] = num23; - buffer[index].writeBuffer[6] = num24; - } - else if (msgType == 15) - { - byte[] buffer62 = BitConverter.GetBytes(msgType); - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer62, 0, buffer[index].writeBuffer, 4, 1); - } - else if (msgType == 0x10) - { - byte[] buffer64 = BitConverter.GetBytes(msgType); - byte num25 = (byte) number; - byte[] buffer65 = BitConverter.GetBytes((short) Main.player[num25].statLife); - byte[] buffer66 = BitConverter.GetBytes((short) Main.player[num25].statLifeMax); - count += (1 + buffer65.Length) + buffer66.Length; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer64, 0, buffer[index].writeBuffer, 4, 1); - buffer[index].writeBuffer[5] = num25; - num3++; - Buffer.BlockCopy(buffer65, 0, buffer[index].writeBuffer, num3, 2); - num3 += 2; - Buffer.BlockCopy(buffer66, 0, buffer[index].writeBuffer, num3, 2); - } - else if (msgType == 0x11) - { - byte[] buffer68 = BitConverter.GetBytes(msgType); - byte num26 = (byte)number; - byte[] buffer69 = BitConverter.GetBytes((int)number2); - byte[] buffer70 = BitConverter.GetBytes((int)number3); - byte num27 = (byte)number4; - count += ((1 + buffer69.Length) + buffer70.Length) + 1; - Buffer.BlockCopy(BitConverter.GetBytes((int)(count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer68, 0, buffer[index].writeBuffer, 4, 1); - buffer[index].writeBuffer[num3] = num26; - num3++; - Buffer.BlockCopy(buffer69, 0, buffer[index].writeBuffer, num3, 4); - num3 += 4; - Buffer.BlockCopy(buffer70, 0, buffer[index].writeBuffer, num3, 4); - num3 += 4; - buffer[index].writeBuffer[num3] = num27; - } - else if (msgType == 0x12) - { - byte[] buffer72 = BitConverter.GetBytes(msgType); - BitConverter.GetBytes((int) Main.time); - byte num28 = 0; - if (Main.dayTime) - { - num28 = 1; - } - byte[] buffer73 = BitConverter.GetBytes((int) Main.time); - byte[] buffer74 = BitConverter.GetBytes(Main.sunModY); - byte[] buffer75 = BitConverter.GetBytes(Main.moonModY); - count += ((1 + buffer73.Length) + buffer74.Length) + buffer75.Length; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer72, 0, buffer[index].writeBuffer, 4, 1); - buffer[index].writeBuffer[num3] = num28; - num3++; - Buffer.BlockCopy(buffer73, 0, buffer[index].writeBuffer, num3, 4); - num3 += 4; - Buffer.BlockCopy(buffer74, 0, buffer[index].writeBuffer, num3, 2); - num3 += 2; - Buffer.BlockCopy(buffer75, 0, buffer[index].writeBuffer, num3, 2); - num3 += 2; - } - else if (msgType == 0x13) - { - byte[] buffer77 = BitConverter.GetBytes(msgType); - byte num29 = (byte) number; - byte[] buffer78 = BitConverter.GetBytes((int) number2); - byte[] buffer79 = BitConverter.GetBytes((int) number3); - byte num30 = 0; - if (number4 == 1f) - { - num30 = 1; - } - count += ((1 + buffer78.Length) + buffer79.Length) + 1; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer77, 0, buffer[index].writeBuffer, 4, 1); - buffer[index].writeBuffer[num3] = num29; - num3++; - Buffer.BlockCopy(buffer78, 0, buffer[index].writeBuffer, num3, 4); - num3 += 4; - Buffer.BlockCopy(buffer79, 0, buffer[index].writeBuffer, num3, 4); - num3 += 4; - buffer[index].writeBuffer[num3] = num30; - } - else if (msgType == 20) - { - short num31 = (short) number; - int num32 = (int) number2; - int num33 = (int) number3; - Buffer.BlockCopy(BitConverter.GetBytes(msgType), 0, buffer[index].writeBuffer, 4, 1); - Buffer.BlockCopy(BitConverter.GetBytes(num31), 0, buffer[index].writeBuffer, num3, 2); - num3 += 2; - Buffer.BlockCopy(BitConverter.GetBytes(num32), 0, buffer[index].writeBuffer, num3, 4); - num3 += 4; - Buffer.BlockCopy(BitConverter.GetBytes(num33), 0, buffer[index].writeBuffer, num3, 4); - num3 += 4; - for (int j = num32; j < (num32 + num31); j++) - { - for (int k = num33; k < (num33 + num31); k++) - { - byte num36 = 0; - if (Main.tile[j, k].active) - { - num36 = (byte) (num36 + 1); - } - if (Main.tile[j, k].lighted) - { - num36 = (byte) (num36 + 2); - } - if (Main.tile[j, k].wall > 0) - { - num36 = (byte) (num36 + 4); - } - if ((Main.tile[j, k].liquid > 0) && (Main.netMode == 2)) - { - num36 = (byte) (num36 + 8); - } - buffer[index].writeBuffer[num3] = num36; - num3++; - byte[] buffer85 = BitConverter.GetBytes(Main.tile[j, k].frameX); - byte[] buffer86 = BitConverter.GetBytes(Main.tile[j, k].frameY); - byte num37 = Main.tile[j, k].wall; - if (Main.tile[j, k].active) - { - buffer[index].writeBuffer[num3] = Main.tile[j, k].type; - num3++; - if (Main.tileFrameImportant[Main.tile[j, k].type]) - { - Buffer.BlockCopy(buffer85, 0, buffer[index].writeBuffer, num3, 2); - num3 += 2; - Buffer.BlockCopy(buffer86, 0, buffer[index].writeBuffer, num3, 2); - num3 += 2; - } - } - if (num37 > 0) - { - buffer[index].writeBuffer[num3] = num37; - num3++; - } - if ((Main.tile[j, k].liquid > 0) && (Main.netMode == 2)) - { - buffer[index].writeBuffer[num3] = Main.tile[j, k].liquid; - num3++; - byte num38 = 0; - if (Main.tile[j, k].lava) - { - num38 = 1; - } - buffer[index].writeBuffer[num3] = num38; - num3++; - } - } - } - Buffer.BlockCopy(BitConverter.GetBytes((int) (num3 - 4)), 0, buffer[index].writeBuffer, 0, 4); - count = num3; - } - else if (msgType == 0x15) - { - byte[] buffer88 = BitConverter.GetBytes(msgType); - byte[] buffer89 = BitConverter.GetBytes((short) number); - byte[] buffer90 = BitConverter.GetBytes(Main.item[number].position.X); - byte[] buffer91 = BitConverter.GetBytes(Main.item[number].position.Y); - byte[] buffer92 = BitConverter.GetBytes(Main.item[number].velocity.X); - byte[] buffer93 = BitConverter.GetBytes(Main.item[number].velocity.Y); - byte num39 = (byte) Main.item[number].stack; - string name = "0"; - if (Main.item[number].active && (Main.item[number].stack > 0)) - { - name = Main.item[number].name; - } - if (name == null) - { - name = "0"; - } - byte[] buffer94 = Encoding.ASCII.GetBytes(name); - count += (((((buffer89.Length + buffer90.Length) + buffer91.Length) + buffer92.Length) + buffer93.Length) + 1) + buffer94.Length; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer88, 0, buffer[index].writeBuffer, 4, 1); - Buffer.BlockCopy(buffer89, 0, buffer[index].writeBuffer, num3, buffer89.Length); - num3 += 2; - Buffer.BlockCopy(buffer90, 0, buffer[index].writeBuffer, num3, buffer90.Length); - num3 += 4; - Buffer.BlockCopy(buffer91, 0, buffer[index].writeBuffer, num3, buffer91.Length); - num3 += 4; - Buffer.BlockCopy(buffer92, 0, buffer[index].writeBuffer, num3, buffer92.Length); - num3 += 4; - Buffer.BlockCopy(buffer93, 0, buffer[index].writeBuffer, num3, buffer93.Length); - num3 += 4; - buffer[index].writeBuffer[num3] = num39; - num3++; - Buffer.BlockCopy(buffer94, 0, buffer[index].writeBuffer, num3, buffer94.Length); - } - else if (msgType == 0x16) - { - byte[] buffer96 = BitConverter.GetBytes(msgType); - byte[] buffer97 = BitConverter.GetBytes((short) number); - byte owner = (byte) Main.item[number].owner; - count += buffer97.Length + 1; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer96, 0, buffer[index].writeBuffer, 4, 1); - Buffer.BlockCopy(buffer97, 0, buffer[index].writeBuffer, num3, buffer97.Length); - num3 += 2; - buffer[index].writeBuffer[num3] = owner; - } - else if (msgType == 0x17) - { - byte[] buffer99 = BitConverter.GetBytes(msgType); - byte[] buffer100 = BitConverter.GetBytes((short) number); - byte[] buffer101 = BitConverter.GetBytes(Main.npc[number].position.X); - byte[] buffer102 = BitConverter.GetBytes(Main.npc[number].position.Y); - byte[] buffer103 = BitConverter.GetBytes(Main.npc[number].velocity.X); - byte[] buffer104 = BitConverter.GetBytes(Main.npc[number].velocity.Y); - byte[] buffer105 = BitConverter.GetBytes((short) Main.npc[number].target); - byte[] buffer106 = BitConverter.GetBytes((short) Main.npc[number].life); - if (!Main.npc[number].active) - { - buffer106 = BitConverter.GetBytes((short) 0); - } - byte[] buffer107 = Encoding.ASCII.GetBytes(Main.npc[number].name); - count += (((((((((buffer100.Length + buffer101.Length) + buffer102.Length) + buffer103.Length) + buffer104.Length) + buffer105.Length) + buffer106.Length) + (NPC.maxAI * 4)) + buffer107.Length) + 1) + 1; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer99, 0, buffer[index].writeBuffer, 4, 1); - Buffer.BlockCopy(buffer100, 0, buffer[index].writeBuffer, num3, buffer100.Length); - num3 += 2; - Buffer.BlockCopy(buffer101, 0, buffer[index].writeBuffer, num3, buffer101.Length); - num3 += 4; - Buffer.BlockCopy(buffer102, 0, buffer[index].writeBuffer, num3, buffer102.Length); - num3 += 4; - Buffer.BlockCopy(buffer103, 0, buffer[index].writeBuffer, num3, buffer103.Length); - num3 += 4; - Buffer.BlockCopy(buffer104, 0, buffer[index].writeBuffer, num3, buffer104.Length); - num3 += 4; - Buffer.BlockCopy(buffer105, 0, buffer[index].writeBuffer, num3, buffer105.Length); - num3 += 2; - buffer[index].writeBuffer[num3] = (byte) (Main.npc[number].direction + 1); - num3++; - buffer[index].writeBuffer[num3] = (byte) (Main.npc[number].directionY + 1); - num3++; - Buffer.BlockCopy(buffer106, 0, buffer[index].writeBuffer, num3, buffer106.Length); - num3 += 2; - for (int m = 0; m < NPC.maxAI; m++) - { - byte[] buffer109 = BitConverter.GetBytes(Main.npc[number].ai[m]); - Buffer.BlockCopy(buffer109, 0, buffer[index].writeBuffer, num3, buffer109.Length); - num3 += 4; - } - Buffer.BlockCopy(buffer107, 0, buffer[index].writeBuffer, num3, buffer107.Length); - } - else if (msgType == 0x18) - { - byte[] buffer110 = BitConverter.GetBytes(msgType); - byte[] buffer111 = BitConverter.GetBytes((short) number); - byte num42 = (byte) number2; - count += buffer111.Length + 1; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer110, 0, buffer[index].writeBuffer, 4, 1); - Buffer.BlockCopy(buffer111, 0, buffer[index].writeBuffer, num3, buffer111.Length); - num3 += 2; - buffer[index].writeBuffer[num3] = num42; - } - else if (msgType == 0x19) - { - byte[] buffer113 = BitConverter.GetBytes(msgType); - byte num43 = (byte) number; - byte[] buffer114 = Encoding.ASCII.GetBytes(text); - byte num44 = (byte) number2; - byte num45 = (byte) number3; - byte num46 = (byte) number4; - count += (1 + buffer114.Length) + 3; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer113, 0, buffer[index].writeBuffer, 4, 1); - buffer[index].writeBuffer[num3] = num43; - num3++; - buffer[index].writeBuffer[num3] = num44; - num3++; - buffer[index].writeBuffer[num3] = num45; - num3++; - buffer[index].writeBuffer[num3] = num46; - num3++; - Buffer.BlockCopy(buffer114, 0, buffer[index].writeBuffer, num3, buffer114.Length); - } - else if (msgType == 0x1a) - { - byte[] buffer116 = BitConverter.GetBytes(msgType); - byte num47 = (byte)number; - byte num48 = (byte)(number2 + 1f); - byte[] buffer117 = BitConverter.GetBytes((short)number3); - byte num49 = (byte)number4; - count += (2 + buffer117.Length) + 1; - Buffer.BlockCopy(BitConverter.GetBytes((int)(count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer116, 0, buffer[index].writeBuffer, 4, 1); - buffer[index].writeBuffer[num3] = num47; - num3++; - buffer[index].writeBuffer[num3] = num48; - num3++; - Buffer.BlockCopy(buffer117, 0, buffer[index].writeBuffer, num3, buffer117.Length); - num3 += 2; - buffer[index].writeBuffer[num3] = num49; - } - else if (msgType == 0x1b) - { - byte[] buffer119 = BitConverter.GetBytes(msgType); - byte[] buffer120 = BitConverter.GetBytes((short)Main.projectile[number].identity); - byte[] buffer121 = BitConverter.GetBytes(Main.projectile[number].position.X); - byte[] buffer122 = BitConverter.GetBytes(Main.projectile[number].position.Y); - byte[] buffer123 = BitConverter.GetBytes(Main.projectile[number].velocity.X); - byte[] buffer124 = BitConverter.GetBytes(Main.projectile[number].velocity.Y); - byte[] buffer125 = BitConverter.GetBytes(Main.projectile[number].knockBack); - byte[] buffer126 = BitConverter.GetBytes((short)Main.projectile[number].damage); - Buffer.BlockCopy(buffer119, 0, buffer[index].writeBuffer, 4, 1); - Buffer.BlockCopy(buffer120, 0, buffer[index].writeBuffer, num3, buffer120.Length); - num3 += 2; - Buffer.BlockCopy(buffer121, 0, buffer[index].writeBuffer, num3, buffer121.Length); - num3 += 4; - Buffer.BlockCopy(buffer122, 0, buffer[index].writeBuffer, num3, buffer122.Length); - num3 += 4; - Buffer.BlockCopy(buffer123, 0, buffer[index].writeBuffer, num3, buffer123.Length); - num3 += 4; - Buffer.BlockCopy(buffer124, 0, buffer[index].writeBuffer, num3, buffer124.Length); - num3 += 4; - Buffer.BlockCopy(buffer125, 0, buffer[index].writeBuffer, num3, buffer125.Length); - num3 += 4; - Buffer.BlockCopy(buffer126, 0, buffer[index].writeBuffer, num3, buffer126.Length); - num3 += 2; - buffer[index].writeBuffer[num3] = (byte)Main.projectile[number].owner; - num3++; - buffer[index].writeBuffer[num3] = (byte)Main.projectile[number].type; - num3++; - for (int n = 0; n < Projectile.maxAI; n++) - { - byte[] buffer127 = BitConverter.GetBytes(Main.projectile[number].ai[n]); - Buffer.BlockCopy(buffer127, 0, buffer[index].writeBuffer, num3, buffer127.Length); - num3 += 4; - } - count += num3; - Buffer.BlockCopy(BitConverter.GetBytes((int)(count - 4)), 0, buffer[index].writeBuffer, 0, 4); - } - else if (msgType == 0x1c) - { - byte[] buffer129 = BitConverter.GetBytes(msgType); - byte[] buffer130 = BitConverter.GetBytes((short) number); - byte[] buffer131 = BitConverter.GetBytes((short) number2); - byte[] buffer132 = BitConverter.GetBytes(number3); - byte num51 = (byte) (number4 + 1f); - count += ((buffer130.Length + buffer131.Length) + buffer132.Length) + 1; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer129, 0, buffer[index].writeBuffer, 4, 1); - Buffer.BlockCopy(buffer130, 0, buffer[index].writeBuffer, num3, buffer130.Length); - num3 += 2; - Buffer.BlockCopy(buffer131, 0, buffer[index].writeBuffer, num3, buffer131.Length); - num3 += 2; - Buffer.BlockCopy(buffer132, 0, buffer[index].writeBuffer, num3, buffer132.Length); - num3 += 4; - buffer[index].writeBuffer[num3] = num51; - } - else if (msgType == 0x1d) - { - byte[] buffer134 = BitConverter.GetBytes(msgType); - byte[] buffer135 = BitConverter.GetBytes((short) number); - byte num52 = (byte) number2; - count += buffer135.Length + 1; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer134, 0, buffer[index].writeBuffer, 4, 1); - Buffer.BlockCopy(buffer135, 0, buffer[index].writeBuffer, num3, buffer135.Length); - num3 += 2; - buffer[index].writeBuffer[num3] = num52; - } - else if (msgType == 30) - { - byte[] buffer137 = BitConverter.GetBytes(msgType); - byte num53 = (byte) number; - byte num54 = 0; - if (Main.player[num53].hostile) - { - num54 = 1; - } - count += 2; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer137, 0, buffer[index].writeBuffer, 4, 1); - buffer[index].writeBuffer[num3] = num53; - num3++; - buffer[index].writeBuffer[num3] = num54; - } - else if (msgType == 0x1f) - { - byte[] buffer139 = BitConverter.GetBytes(msgType); - byte[] buffer140 = BitConverter.GetBytes(number); - byte[] buffer141 = BitConverter.GetBytes((int) number2); - count += buffer140.Length + buffer141.Length; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer139, 0, buffer[index].writeBuffer, 4, 1); - Buffer.BlockCopy(buffer140, 0, buffer[index].writeBuffer, num3, buffer140.Length); - num3 += 4; - Buffer.BlockCopy(buffer141, 0, buffer[index].writeBuffer, num3, buffer141.Length); - } - else if (msgType == 0x20) - { - byte[] buffer145; - byte[] buffer143 = BitConverter.GetBytes(msgType); - byte[] buffer144 = BitConverter.GetBytes((short) number); - byte num55 = (byte) number2; - byte num56 = (byte) Main.chest[number].item[(int) number2].stack; - if (Main.chest[number].item[(int) number2].name == null) - { - buffer145 = Encoding.ASCII.GetBytes(""); - } - else - { - buffer145 = Encoding.ASCII.GetBytes(Main.chest[number].item[(int) number2].name); - } - count += ((buffer144.Length + 1) + 1) + buffer145.Length; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer143, 0, buffer[index].writeBuffer, 4, 1); - Buffer.BlockCopy(buffer144, 0, buffer[index].writeBuffer, num3, buffer144.Length); - num3 += 2; - buffer[index].writeBuffer[num3] = num55; - num3++; - buffer[index].writeBuffer[num3] = num56; - num3++; - Buffer.BlockCopy(buffer145, 0, buffer[index].writeBuffer, num3, buffer145.Length); - } - else if (msgType == 0x21) - { - byte[] buffer149; - byte[] buffer150; - byte[] buffer147 = BitConverter.GetBytes(msgType); - byte[] buffer148 = BitConverter.GetBytes((short) number); - if (number > -1) - { - buffer149 = BitConverter.GetBytes(Main.chest[number].x); - buffer150 = BitConverter.GetBytes(Main.chest[number].y); - } - else - { - buffer149 = BitConverter.GetBytes(0); - buffer150 = BitConverter.GetBytes(0); - } - count += (buffer148.Length + buffer149.Length) + buffer150.Length; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer147, 0, buffer[index].writeBuffer, 4, 1); - Buffer.BlockCopy(buffer148, 0, buffer[index].writeBuffer, num3, buffer148.Length); - num3 += 2; - Buffer.BlockCopy(buffer149, 0, buffer[index].writeBuffer, num3, buffer149.Length); - num3 += 4; - Buffer.BlockCopy(buffer150, 0, buffer[index].writeBuffer, num3, buffer150.Length); - } - else if (msgType == 0x22) - { - byte[] buffer152 = BitConverter.GetBytes(msgType); - byte[] buffer153 = BitConverter.GetBytes(number); - byte[] buffer154 = BitConverter.GetBytes((int) number2); - count += buffer153.Length + buffer154.Length; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer152, 0, buffer[index].writeBuffer, 4, 1); - Buffer.BlockCopy(buffer153, 0, buffer[index].writeBuffer, num3, buffer153.Length); - num3 += 4; - Buffer.BlockCopy(buffer154, 0, buffer[index].writeBuffer, num3, buffer154.Length); - } - else if (msgType == 0x23) - { - byte[] buffer156 = BitConverter.GetBytes(msgType); - byte num57 = (byte) number; - byte[] buffer157 = BitConverter.GetBytes((short) number2); - count += 1 + buffer157.Length; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer156, 0, buffer[index].writeBuffer, 4, 1); - buffer[index].writeBuffer[5] = num57; - num3++; - Buffer.BlockCopy(buffer157, 0, buffer[index].writeBuffer, num3, 2); - } - else if (msgType == 0x24) - { - byte[] buffer159 = BitConverter.GetBytes(msgType); - byte num58 = (byte) number; - byte num59 = 0; - if (Main.player[num58].zoneEvil) - { - num59 = 1; - } - byte num60 = 0; - if (Main.player[num58].zoneMeteor) - { - num60 = 1; - } - byte num61 = 0; - if (Main.player[num58].zoneDungeon) - { - num61 = 1; - } - byte num62 = 0; - if (Main.player[num58].zoneJungle) - { - num62 = 1; - } - count += 4; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer159, 0, buffer[index].writeBuffer, 4, 1); - buffer[index].writeBuffer[num3] = num58; - num3++; - buffer[index].writeBuffer[num3] = num59; - num3++; - buffer[index].writeBuffer[num3] = num60; - num3++; - buffer[index].writeBuffer[num3] = num61; - num3++; - buffer[index].writeBuffer[num3] = num62; - num3++; - } - else if (msgType == 0x25) - { - byte[] buffer161 = BitConverter.GetBytes(msgType); - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer161, 0, buffer[index].writeBuffer, 4, 1); - } - else if (msgType == 0x26) - { - byte[] buffer163 = BitConverter.GetBytes(msgType); - byte[] buffer164 = Encoding.ASCII.GetBytes(text); - count += buffer164.Length; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer163, 0, buffer[index].writeBuffer, 4, 1); - Buffer.BlockCopy(buffer164, 0, buffer[index].writeBuffer, num3, buffer164.Length); - } - else if (msgType == 0x27) - { - byte[] buffer166 = BitConverter.GetBytes(msgType); - byte[] buffer167 = BitConverter.GetBytes((short) number); - count += buffer167.Length; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer166, 0, buffer[index].writeBuffer, 4, 1); - Buffer.BlockCopy(buffer167, 0, buffer[index].writeBuffer, num3, buffer167.Length); - } - else if (msgType == 40) - { - byte[] buffer169 = BitConverter.GetBytes(msgType); - byte num63 = (byte) number; - byte[] buffer170 = BitConverter.GetBytes((short) Main.player[num63].talkNPC); - count += 1 + buffer170.Length; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer169, 0, buffer[index].writeBuffer, 4, 1); - buffer[index].writeBuffer[num3] = num63; - num3++; - Buffer.BlockCopy(buffer170, 0, buffer[index].writeBuffer, num3, buffer170.Length); - num3 += 2; - } - else if (msgType == 0x29) - { - byte[] buffer172 = BitConverter.GetBytes(msgType); - byte num64 = (byte) number; - byte[] buffer173 = BitConverter.GetBytes(Main.player[num64].itemRotation); - byte[] buffer174 = BitConverter.GetBytes((short) Main.player[num64].itemAnimation); - count += (1 + buffer173.Length) + buffer174.Length; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer172, 0, buffer[index].writeBuffer, 4, 1); - buffer[index].writeBuffer[num3] = num64; - num3++; - Buffer.BlockCopy(buffer173, 0, buffer[index].writeBuffer, num3, buffer173.Length); - num3 += 4; - Buffer.BlockCopy(buffer174, 0, buffer[index].writeBuffer, num3, buffer174.Length); - } - else if (msgType == 0x2a) - { - byte[] buffer176 = BitConverter.GetBytes(msgType); - byte num65 = (byte) number; - byte[] buffer177 = BitConverter.GetBytes((short) Main.player[num65].statMana); - byte[] buffer178 = BitConverter.GetBytes((short) Main.player[num65].statManaMax); - count += (1 + buffer177.Length) + buffer178.Length; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer176, 0, buffer[index].writeBuffer, 4, 1); - buffer[index].writeBuffer[5] = num65; - num3++; - Buffer.BlockCopy(buffer177, 0, buffer[index].writeBuffer, num3, 2); - num3 += 2; - Buffer.BlockCopy(buffer178, 0, buffer[index].writeBuffer, num3, 2); - } - else if (msgType == 0x2b) - { - byte[] buffer180 = BitConverter.GetBytes(msgType); - byte num66 = (byte) number; - byte[] buffer181 = BitConverter.GetBytes((short) number2); - count += 1 + buffer181.Length; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer180, 0, buffer[index].writeBuffer, 4, 1); - buffer[index].writeBuffer[5] = num66; - num3++; - Buffer.BlockCopy(buffer181, 0, buffer[index].writeBuffer, num3, 2); - } - else if (msgType == 0x2c) - { - byte[] buffer183 = BitConverter.GetBytes(msgType); - byte num67 = (byte) number; - byte num68 = (byte) (number2 + 1f); - byte[] buffer184 = BitConverter.GetBytes((short) number3); - byte num69 = (byte) number4; - count += (2 + buffer184.Length) + 1; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer183, 0, buffer[index].writeBuffer, 4, 1); - buffer[index].writeBuffer[num3] = num67; - num3++; - buffer[index].writeBuffer[num3] = num68; - num3++; - Buffer.BlockCopy(buffer184, 0, buffer[index].writeBuffer, num3, buffer184.Length); - num3 += 2; - buffer[index].writeBuffer[num3] = num69; - } - else if (msgType == 0x2d) - { - byte[] buffer186 = BitConverter.GetBytes(msgType); - byte num70 = (byte) number; - byte team = (byte) Main.player[num70].team; - count += 2; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer186, 0, buffer[index].writeBuffer, 4, 1); - buffer[index].writeBuffer[5] = num70; - num3++; - buffer[index].writeBuffer[num3] = team; - } - else if (msgType == 0x2e) - { - byte[] buffer188 = BitConverter.GetBytes(msgType); - byte[] buffer189 = BitConverter.GetBytes(number); - byte[] buffer190 = BitConverter.GetBytes((int) number2); - count += buffer189.Length + buffer190.Length; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer188, 0, buffer[index].writeBuffer, 4, 1); - Buffer.BlockCopy(buffer189, 0, buffer[index].writeBuffer, num3, buffer189.Length); - num3 += 4; - Buffer.BlockCopy(buffer190, 0, buffer[index].writeBuffer, num3, buffer190.Length); - } - else if (msgType == 0x2f) - { - byte[] buffer192 = BitConverter.GetBytes(msgType); - byte[] buffer193 = BitConverter.GetBytes((short) number); - byte[] buffer194 = BitConverter.GetBytes(Main.sign[number].x); - byte[] buffer195 = BitConverter.GetBytes(Main.sign[number].y); - byte[] buffer196 = Encoding.ASCII.GetBytes(Main.sign[number].text); - count += ((buffer193.Length + buffer194.Length) + buffer195.Length) + buffer196.Length; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer192, 0, buffer[index].writeBuffer, 4, 1); - Buffer.BlockCopy(buffer193, 0, buffer[index].writeBuffer, num3, buffer193.Length); - num3 += buffer193.Length; - Buffer.BlockCopy(buffer194, 0, buffer[index].writeBuffer, num3, buffer194.Length); - num3 += buffer194.Length; - Buffer.BlockCopy(buffer195, 0, buffer[index].writeBuffer, num3, buffer195.Length); - num3 += buffer195.Length; - Buffer.BlockCopy(buffer196, 0, buffer[index].writeBuffer, num3, buffer196.Length); - num3 += buffer196.Length; - } - else if (msgType == 0x30) - { - byte[] buffer198 = BitConverter.GetBytes(msgType); - byte[] buffer199 = BitConverter.GetBytes(number); - byte[] buffer200 = BitConverter.GetBytes((int) number2); - byte liquid = Main.tile[number, (int) number2].liquid; - byte num73 = 0; - if (Main.tile[number, (int) number2].lava) - { - num73 = 1; - } - count += ((buffer199.Length + buffer200.Length) + 1) + 1; - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer198, 0, buffer[index].writeBuffer, 4, 1); - Buffer.BlockCopy(buffer199, 0, buffer[index].writeBuffer, num3, 4); - num3 += 4; - Buffer.BlockCopy(buffer200, 0, buffer[index].writeBuffer, num3, 4); - num3 += 4; - buffer[index].writeBuffer[num3] = liquid; - num3++; - buffer[index].writeBuffer[num3] = num73; - num3++; - } - else if (msgType == 0x31) - { - byte[] buffer202 = BitConverter.GetBytes(msgType); - Buffer.BlockCopy(BitConverter.GetBytes((int) (count - 4)), 0, buffer[index].writeBuffer, 0, 4); - Buffer.BlockCopy(buffer202, 0, buffer[index].writeBuffer, 4, 1); - } - if (Main.netMode == 1) - { - if (Netplay.clientSock.tcpClient.Connected) - { - try - { - messageBuffer buffer1 = buffer[index]; - buffer1.spamCount++; - Netplay.clientSock.networkStream.BeginWrite(buffer[index].writeBuffer, 0, count, new AsyncCallback(Netplay.clientSock.ClientWriteCallBack), Netplay.clientSock.networkStream); - } - catch - { - } - } - } - else if (remoteClient == -1) - { - for (int num74 = 0; num74 < 9; num74++) - { - if (((num74 != ignoreClient) && (buffer[num74].broadcast || ((Netplay.serverSock[num74].state >= 3) && (msgType == 10)))) && Netplay.serverSock[num74].tcpClient.Connected) - { - try - { - messageBuffer buffer205 = buffer[num74]; - buffer205.spamCount++; - Netplay.serverSock[num74].networkStream.BeginWrite(buffer[index].writeBuffer, 0, count, new AsyncCallback(Netplay.serverSock[num74].ServerWriteCallBack), Netplay.serverSock[num74].networkStream); - } - catch - { - } - } - } - } - else if (Netplay.serverSock[remoteClient].tcpClient.Connected) - { - try - { - messageBuffer buffer206 = buffer[remoteClient]; - buffer206.spamCount++; - Netplay.serverSock[remoteClient].networkStream.BeginWrite(buffer[index].writeBuffer, 0, count, new AsyncCallback(Netplay.serverSock[remoteClient].ServerWriteCallBack), Netplay.serverSock[remoteClient].networkStream); - } - catch - { - } - } - if (Main.verboseNetplay) - { - for (int num75 = 0; num75 < count; num75++) - { - } - for (int num76 = 0; num76 < count; num76++) - { - byte num1 = buffer[index].writeBuffer[num76]; - } - } - buffer[index].writeLocked = false; - if ((msgType == 0x13) && (Main.netMode == 1)) - { - int size = 5; - SendTileSquare(index, (int) number2, (int) number3, size); - } - if ((msgType == 2) && (Main.netMode == 2)) - { - Netplay.serverSock[index].kill = true; - } - } - } - - public static void SendSection(int whoAmi, int sectionX, int sectionY) - { - Netplay.serverSock[whoAmi].tileSection[sectionX, sectionY] = true; - int num = sectionX * 200; - int num2 = sectionY * 150; - for (int i = num2; i < (num2 + 150); i++) - { - SendData(10, whoAmi, -1, "", 200, (float) num, (float) i, 0f); - } - } - - public static void SendTileSquare(int whoAmi, int tileX, int tileY, int size) - { - int num = (size - 1) / 2; - SendData(20, whoAmi, -1, "", size, (float) (tileX - num), (float) (tileY - num), 0f); - } - - public static void sendWater(int x, int y) - { - if (Main.netMode == 1) - { - SendData(0x30, -1, -1, "", x, (float) y, 0f, 0f); - } - else - { - for (int i = 0; i < 9; i++) - { - if ((buffer[i].broadcast || (Netplay.serverSock[i].state >= 3)) && Netplay.serverSock[i].tcpClient.Connected) - { - int num2 = x / 200; - int num3 = y / 150; - if (Netplay.serverSock[i].tileSection[num2, num3]) - { - SendData(0x30, i, -1, "", x, (float) y, 0f, 0f); - } - } - } - } - } - - public static void syncPlayers() - { - for (int i = 0; i < 8; i++) - { - int num2 = 0; - if (Main.player[i].active) - { - num2 = 1; - } - if (Netplay.serverSock[i].state == 10) - { - SendData(14, -1, i, "", i, (float) num2, 0f, 0f); - SendData(13, -1, i, "", i, 0f, 0f, 0f); - SendData(0x10, -1, i, "", i, 0f, 0f, 0f); - SendData(30, -1, i, "", i, 0f, 0f, 0f); - SendData(0x2d, -1, i, "", i, 0f, 0f, 0f); - SendData(0x2a, -1, i, "", i, 0f, 0f, 0f); - SendData(4, -1, i, Main.player[i].name, i, 0f, 0f, 0f); - for (int j = 0; j < 0x2c; j++) - { - SendData(5, -1, i, Main.player[i].inventory[j].name, i, (float) j, 0f, 0f); - } - SendData(5, -1, i, Main.player[i].armor[0].name, i, 44f, 0f, 0f); - SendData(5, -1, i, Main.player[i].armor[1].name, i, 45f, 0f, 0f); - SendData(5, -1, i, Main.player[i].armor[2].name, i, 46f, 0f, 0f); - SendData(5, -1, i, Main.player[i].armor[3].name, i, 47f, 0f, 0f); - SendData(5, -1, i, Main.player[i].armor[4].name, i, 48f, 0f, 0f); - SendData(5, -1, i, Main.player[i].armor[5].name, i, 49f, 0f, 0f); - SendData(5, -1, i, Main.player[i].armor[6].name, i, 50f, 0f, 0f); - SendData(5, -1, i, Main.player[i].armor[7].name, i, 51f, 0f, 0f); - if (!Netplay.serverSock[i].announced) - { - Netplay.serverSock[i].announced = true; - SendData(0x19, -1, i, Main.player[i].name + " has joined.", 8, 255f, 240f, 20f); - } - } - else - { - SendData(14, -1, i, "", i, (float) num2, 0f, 0f); - if (Netplay.serverSock[i].announced) - { - Netplay.serverSock[i].announced = false; - SendData(0x19, -1, i, Netplay.serverSock[i].oldName + " has left.", 8, 255f, 240f, 20f); - } - } - } - } - } -} - diff --git a/Terraria/Netplay.cs b/Terraria/Netplay.cs deleted file mode 100644 index 26947116..00000000 --- a/Terraria/Netplay.cs +++ /dev/null @@ -1,465 +0,0 @@ -namespace Terraria -{ - using System; - using System.Net; - using System.Net.Sockets; - using System.Threading; - using System.IO; - - public class Netplay - { - public const int bufferSize = 0x400; - public static ClientSock clientSock = new ClientSock(); - public static bool disconnect = false; - public const int maxConnections = 9; - public static string password = ""; - public static IPAddress serverIP; - public static IPAddress serverListenIP; - public static int serverPort = 0x1e61; //0x1e61 = 7777 - public static ServerSock[] serverSock = new ServerSock[9]; - public static bool stopListen = false; - public static TcpListener tcpListener; - - public static void ClientLoop(object threadContext) - { - if (Main.rand == null) - { - Main.rand = new Random((int)DateTime.Now.Ticks); - } - if (WorldGen.genRand == null) - { - WorldGen.genRand = new Random((int)DateTime.Now.Ticks); - } - Main.player[Main.myPlayer].hostile = false; - Main.clientPlayer = (Player)Main.player[Main.myPlayer].clientClone(); - Main.menuMode = 10; - Main.menuMode = 14; - Main.statusText = "Connecting to " + serverIP; - Main.netMode = 1; - disconnect = false; - clientSock = new ClientSock(); - clientSock.tcpClient.NoDelay = true; - clientSock.readBuffer = new byte[0x400]; - clientSock.writeBuffer = new byte[0x400]; - try - { - clientSock.tcpClient.Connect(serverIP, serverPort); - clientSock.networkStream = clientSock.tcpClient.GetStream(); - } - catch (Exception exception) - { - if (!disconnect && Main.gameMenu) - { - Main.menuMode = 15; - Main.statusText = exception.ToString(); - disconnect = true; - } - } - NetMessage.buffer[9].Reset(); - for (int i = -1; !disconnect; i = clientSock.state) - { - if (clientSock.tcpClient.Connected) - { - if (NetMessage.buffer[9].checkBytes) - { - NetMessage.CheckBytes(9); - } - clientSock.active = true; - if (clientSock.state == 0) - { - Main.statusText = "Found server"; - clientSock.state = 1; - NetMessage.SendData(1, -1, -1, "", 0, 0f, 0f, 0f); - } - if ((clientSock.state == 2) && (i != clientSock.state)) - { - Main.statusText = "Sending player data..."; - } - if ((clientSock.state == 3) && (i != clientSock.state)) - { - Main.statusText = "Requesting world information"; - } - if (clientSock.state == 4) - { - WorldGen.worldCleared = false; - clientSock.state = 5; - WorldGen.clearWorld(); - } - if ((clientSock.state == 5) && WorldGen.worldCleared) - { - clientSock.state = 6; - Main.player[Main.myPlayer].FindSpawn(); - NetMessage.SendData(8, -1, -1, "", Main.player[Main.myPlayer].SpawnX, (float)Main.player[Main.myPlayer].SpawnY, 0f, 0f); - } - if ((clientSock.state == 6) && (i != clientSock.state)) - { - Main.statusText = "Requesting tile data"; - } - if ((!clientSock.locked && !disconnect) && clientSock.networkStream.DataAvailable) - { - clientSock.locked = true; - clientSock.networkStream.BeginRead(clientSock.readBuffer, 0, clientSock.readBuffer.Length, new AsyncCallback(clientSock.ClientReadCallBack), clientSock.networkStream); - } - if ((clientSock.statusMax > 0) && (clientSock.statusText != "")) - { - if (clientSock.statusCount >= clientSock.statusMax) - { - Main.statusText = clientSock.statusText + ": Complete!"; - clientSock.statusText = ""; - clientSock.statusMax = 0; - clientSock.statusCount = 0; - } - else - { - Main.statusText = string.Concat(new object[] { clientSock.statusText, ": ", (int)((((float)clientSock.statusCount) / ((float)clientSock.statusMax)) * 100f), "%" }); - } - } - Thread.Sleep(1); - } - else if (clientSock.active) - { - Main.statusText = "Lost connection"; - disconnect = true; - } - } - try - { - clientSock.networkStream.Close(); - clientSock.networkStream = clientSock.tcpClient.GetStream(); - } - catch - { - } - if (!Main.gameMenu) - { - Main.netMode = 0; - Player.SavePlayer(Main.player[Main.myPlayer], Main.playerPathName); - Main.gameMenu = true; - Main.menuMode = 14; - } - NetMessage.buffer[9].Reset(); - if ((Main.menuMode == 15) && (Main.statusText == "Lost connection")) - { - Main.menuMode = 14; - } - if ((clientSock.statusText != "") && (clientSock.statusText != null)) - { - Main.statusText = "Lost connection"; - } - clientSock.statusCount = 0; - clientSock.statusMax = 0; - clientSock.statusText = ""; - Main.netMode = 0; - } - - public static int GetSectionX(int x) - { - return (x / 200); - } - - public static int GetSectionY(int y) - { - return (y / 150); - } - - public static void Init() - { - for (int i = 0; i < 10; i++) - { - if (i < 9) - { - serverSock[i] = new ServerSock(); - serverSock[i].tcpClient.NoDelay = true; - } - NetMessage.buffer[i] = new messageBuffer(); - NetMessage.buffer[i].whoAmI = i; - } - clientSock.tcpClient.NoDelay = true; - } - - public static void ListenForClients(object threadContext) - { - while (!disconnect && !stopListen) - { - int index = -1; - for (int i = 0; i < 8; i++) - { - if (!serverSock[i].tcpClient.Connected) - { - index = i; - break; - } - } - if (index >= 0) - { - try - { - serverSock[index].tcpClient = tcpListener.AcceptTcpClient(); - serverSock[index].tcpClient.NoDelay = true; - } - catch (Exception exception) - { - if (!disconnect) - { - Main.menuMode = 15; - Main.statusText = exception.ToString(); - disconnect = true; - } - } - } - else - { - stopListen = true; - tcpListener.Stop(); - } - } - } - - public static void ServerLoop(object threadContext) - { - if (Main.rand == null) - { - Main.rand = new Random((int)DateTime.Now.Ticks); - } - if (WorldGen.genRand == null) - { - WorldGen.genRand = new Random((int)DateTime.Now.Ticks); - } - Main.myPlayer = 8; - serverIP = IPAddress.Any; - serverListenIP = serverIP; - Main.menuMode = 14; - Main.statusText = "Starting server..."; - Main.netMode = 2; - disconnect = false; - for (int i = 0; i < 9; i++) - { - serverSock[i] = new ServerSock(); - serverSock[i].Reset(); - serverSock[i].whoAmI = i; - serverSock[i].tcpClient = new TcpClient(); - serverSock[i].tcpClient.NoDelay = true; - serverSock[i].readBuffer = new byte[0x400]; - serverSock[i].writeBuffer = new byte[0x400]; - } - tcpListener = new TcpListener(serverListenIP, serverPort); - try - { - tcpListener.Start(); - } - catch (Exception exception) - { - Main.menuMode = 15; - Main.statusText = exception.ToString(); - disconnect = true; - } - if (!disconnect) - { - ThreadPool.QueueUserWorkItem(new WaitCallback(Netplay.ListenForClients), 1); - Main.statusText = "Server started"; - } - while (!disconnect) - { - if (stopListen) - { - int num2 = -1; - for (int m = 0; m < 8; m++) - { - if (!serverSock[m].tcpClient.Connected) - { - num2 = m; - break; - } - } - if (num2 >= 0) - { - tcpListener.Start(); - stopListen = false; - ThreadPool.QueueUserWorkItem(new WaitCallback(Netplay.ListenForClients), 1); - } - } - int num4 = 0; - for (int k = 0; k < 9; k++) - { - if (NetMessage.buffer[k].checkBytes) - { - NetMessage.CheckBytes(k); - } - if (serverSock[k].kill) - { - serverSock[k].Reset(); - NetMessage.syncPlayers(); - } - else if (serverSock[k].tcpClient.Connected) - { - if (!serverSock[k].active) - { - serverSock[k].state = 0; - } - serverSock[k].active = true; - num4++; - if (!serverSock[k].locked) - { - try - { - serverSock[k].networkStream = serverSock[k].tcpClient.GetStream(); - if (serverSock[k].networkStream.DataAvailable) - { - serverSock[k].locked = true; - serverSock[k].networkStream.BeginRead(serverSock[k].readBuffer, 0, serverSock[k].readBuffer.Length, new AsyncCallback(serverSock[k].ServerReadCallBack), serverSock[k].networkStream); - } - } - catch - { - serverSock[k].kill = true; - } - } - if ((serverSock[k].statusMax > 0) && (serverSock[k].statusText2 != "")) - { - if (serverSock[k].statusCount >= serverSock[k].statusMax) - { - serverSock[k].statusText = string.Concat(new object[] { "(", serverSock[k].tcpClient.Client.RemoteEndPoint, ") ", serverSock[k].name, " ", serverSock[k].statusText2, ": Complete!" }); - serverSock[k].statusText2 = ""; - serverSock[k].statusMax = 0; - serverSock[k].statusCount = 0; - } - else - { - serverSock[k].statusText = string.Concat(new object[] { "(", serverSock[k].tcpClient.Client.RemoteEndPoint, ") ", serverSock[k].name, " ", serverSock[k].statusText2, ": ", (int)((((float)serverSock[k].statusCount) / ((float)serverSock[k].statusMax)) * 100f), "%" }); - } - } - else if (serverSock[k].state == 0) - { - serverSock[k].statusText = string.Concat(new object[] { "(", serverSock[k].tcpClient.Client.RemoteEndPoint, ") ", serverSock[k].name, " is connecting..." }); - } - else if (serverSock[k].state == 1) - { - serverSock[k].statusText = string.Concat(new object[] { "(", serverSock[k].tcpClient.Client.RemoteEndPoint, ") ", serverSock[k].name, " is sending player data..." }); - } - else if (serverSock[k].state == 2) - { - serverSock[k].statusText = string.Concat(new object[] { "(", serverSock[k].tcpClient.Client.RemoteEndPoint, ") ", serverSock[k].name, " requested world information" }); - String s = serverSock[k].tcpClient.Client.RemoteEndPoint.ToString(); - if (ShankShock.CheckBanned(s) || ShankShock.CheckCheat(s) || !ShankShock.OnWhitelist(s) || ShankShock.CheckGreif(s)) - { - serverSock[k].statusText = "b;ah"; - serverSock[k].statusText2 = "blah2"; - serverSock[k].tcpClient.Close(); - serverSock[k].active = true; - } - } - else if ((serverSock[k].state != 3) && (serverSock[k].state == 10)) - { - serverSock[k].statusText = string.Concat(new object[] { "(", serverSock[k].tcpClient.Client.RemoteEndPoint, ") ", serverSock[k].name, " is playing" }); - //bbc - for (int i = 0; i < Main.maxPlayers; i++) - { - if (Main.player[i].active) - { - if (!(Main.player[i].breakTicks <= 0)) - { - Main.player[i].breakTicks -= 1f; - Console.WriteLine(ShankShock.FindPlayer(i) + " breakTicks: " + Main.player[i].breakTicks); - if (Main.player[i].breakTicks >= 5) - { - ShankShock.HandleGrief(i); - - } - } - } - } - } - } - else if (serverSock[k].active) - { - serverSock[k].kill = true; - } - else - { - serverSock[k].statusText2 = ""; - if (k < 8) - { - Main.player[k].active = false; - } - } - Thread.Sleep(1); - } - if (!WorldGen.saveLock) - { - if (num4 == 0) - { - Main.statusText = "Waiting for clients..."; - } - else - { - Main.statusText = num4 + " clients connected"; - } - } - } - tcpListener.Stop(); - for (int j = 0; j < 9; j++) - { - serverSock[j].Reset(); - } - if (Main.menuMode != 15) - { - Main.netMode = 0; - Main.menuMode = 10; - WorldGen.saveWorld(false); - while (WorldGen.saveLock) - { - } - Main.menuMode = 0; - } - else - { - Main.netMode = 0; - } - Main.myPlayer = 0; - } - - public static bool SetIP(string newIP) - { - try - { - serverIP = IPAddress.Parse(newIP); - } - catch - { - return false; - } - return true; - } - - public static bool SetIP2(string newIP) - { - try - { - IPAddress[] addressList = Dns.GetHostEntry(newIP).AddressList; - for (int i = 0; i < addressList.Length; i++) - { - if (addressList[i].AddressFamily == AddressFamily.InterNetwork) - { - serverIP = addressList[i]; - return true; - } - } - return false; - } - catch - { - return false; - } - } - - public static void StartClient() - { - ThreadPool.QueueUserWorkItem(new WaitCallback(Netplay.ClientLoop), 1); - } - - public static void StartServer() - { - ThreadPool.QueueUserWorkItem(new WaitCallback(Netplay.ServerLoop), 1); - } - } -} diff --git a/Terraria/Player.cs b/Terraria/Player.cs deleted file mode 100644 index a521b823..00000000 --- a/Terraria/Player.cs +++ /dev/null @@ -1,4565 +0,0 @@ -namespace Terraria -{ - using Microsoft.Xna.Framework; - using Microsoft.Xna.Framework.Input; - using System; - using System.IO; - using System.Runtime.InteropServices; - using System.Security.Cryptography; - using System.Text; - - public class Player - { - public int accDepthMeter; - public bool accFlipper; - public int accWatch; - public bool active; - public int activeNPCs; - public bool[] adjTile = new bool[80]; - public Item[] armor = new Item[8]; - public int attackCD; - public Item[] bank = new Item[Chest.maxItems]; - public int body = -1; - public Rectangle bodyFrame; - public double bodyFrameCounter; - public Vector2 bodyPosition; - public float bodyRotation; - public Vector2 bodyVelocity; - public bool boneArmor; - public int breath = 200; - public int breathCD; - public int breathMax = 200; - public bool canRocket; - public int changeItem = -1; - public bool channel; - public int chatShowTime; - public string chatText = ""; - public int chest = -1; - public int chestX; - public int chestY; - public bool controlDown; - public bool controlInv; - public bool controlJump; - public bool controlLeft; - public bool controlRight; - public bool controlThrow; - public bool controlUp; - public bool controlUseItem; - public bool controlUseTile; - public bool dead; - public bool delayUseItem; - public int direction = 1; - public bool doubleJump; - public Color eyeColor = new Color(0x69, 90, 0x4b); - public int fallStart; - public bool fireWalk; - public int grapCount; - public int[] grappling = new int[20]; - public int hair; - public Color hairColor = new Color(0xd7, 90, 0x37); - public Rectangle hairFrame; - public int head = -1; - public Rectangle headFrame; - public double headFrameCounter; - public Vector2 headPosition; - public float headRotation; - public Vector2 headVelocity; - public int height = 0x2a; - public int hitTile; - public int hitTileX; - public int hitTileY; - public bool hostile; - public bool immune; - public int immuneAlpha; - public int immuneAlphaDirection; - public int immuneTime; - public Item[] inventory = new Item[0x2c]; - public int itemAnimation; - public int itemAnimationMax; - private static int itemGrabRange = 0x26; - private static float itemGrabSpeed = 0.45f; - private static float itemGrabSpeedMax = 4f; - public int itemHeight; - public Vector2 itemLocation; - public float itemRotation; - public int itemTime; - public int itemWidth; - public int jump; - public bool jumpAgain; - public bool jumpBoost; - private static int jumpHeight = 15; - private static float jumpSpeed = 5.01f; - public bool lavaWet; - public Rectangle legFrame; - public double legFrameCounter; - public Vector2 legPosition; - public float legRotation; - public int legs = -1; - public Vector2 legVelocity; - public int lifeRegen; - public int lifeRegenCount; - public float manaCost = 1f; - public int manaRegen; - public int manaRegenCount; - public int manaRegenDelay; - public float meleeSpeed = 1f; - public bool mouseInterface; - public string name = ""; - public bool noFallDmg; - public bool noKnockback; - public bool[] oldAdjTile = new bool[80]; - public Vector2 oldVelocity; - public Color pantsColor = new Color(0xff, 230, 0xaf); - public Vector2 position; - public int potionDelay; - public bool pvpDeath; - public bool releaseInventory; - public bool releaseJump; - public bool releaseUseItem; - public bool releaseUseTile; - public int respawnTimer; - public bool rocketBoots; - public int rocketDelay; - public int rocketDelay2; - public bool rocketFrame; - public bool rocketRelease; - public int runSoundDelay; - public int selectedItem; - public string setBonus = ""; - public float shadow; - public int shadowCount; - public Vector2[] shadowPos = new Vector2[3]; - public Color shirtColor = new Color(0xaf, 0xa5, 140); - public Color shoeColor = new Color(160, 0x69, 60); - public bool showItemIcon; - public int showItemIcon2; - public int sign = -1; - public Color skinColor = new Color(0xff, 0x7d, 90); - public int slowCount; - public bool spawnMax; - public int SpawnX = -1; - public int SpawnY = -1; - public int[] spI = new int[200]; - public string[] spN = new string[200]; - public int[] spX = new int[200]; - public int[] spY = new int[200]; - public int statAttack; - public int statDefense; - public int statLife = 100; - public int statLifeMax = 100; - public int statMana; - public int statManaMax; - public int step = -1; - public int swimTime; - public int talkNPC = -1; - public int team; - public static int tileRangeX = 5; - public static int tileRangeY = 4; - private static int tileTargetX; - private static int tileTargetY; - public int townNPCs; - public Color underShirtColor = new Color(160, 180, 0xd7); - public Vector2 velocity; - public bool wet; - public byte wetCount; - public int whoAmi; - public int width = 20; - public bool zoneDungeon; - public bool zoneEvil; - public bool zoneJungle; - public bool zoneMeteor; - public float breakTicks = 0; - - public Player() - { - for (int i = 0; i < 0x2c; i++) - { - if (i < 8) - { - this.armor[i] = new Item(); - this.armor[i].name = ""; - } - this.inventory[i] = new Item(); - this.inventory[i].name = ""; - } - for (int j = 0; j < Chest.maxItems; j++) - { - this.bank[j] = new Item(); - this.bank[j].name = ""; - } - this.grappling[0] = -1; - this.inventory[0].SetDefaults("Copper Pickaxe"); - this.inventory[1].SetDefaults("Copper Axe"); - for (int k = 0; k < 80; k++) - { - this.adjTile[k] = false; - this.oldAdjTile[k] = false; - } - } - - public void AdjTiles() - { - int num = 4; - int num2 = 3; - for (int i = 0; i < 80; i++) - { - this.oldAdjTile[i] = this.adjTile[i]; - this.adjTile[i] = false; - } - int num4 = (int) ((this.position.X + (this.width / 2)) / 16f); - int num5 = (int) ((this.position.Y + this.height) / 16f); - for (int j = num4 - num; j <= (num4 + num); j++) - { - for (int k = num5 - num2; k < (num5 + num2); k++) - { - if (Main.tile[j, k].active) - { - this.adjTile[Main.tile[j, k].type] = true; - if (Main.tile[j, k].type == 0x4d) - { - this.adjTile[0x11] = true; - } - } - } - } - if (Main.playerInventory) - { - bool flag = false; - for (int m = 0; m < 80; m++) - { - if (this.oldAdjTile[m] != this.adjTile[m]) - { - flag = true; - break; - } - } - if (flag) - { - Recipe.FindRecipes(); - } - } - } - - public bool BuyItem(int price) - { - if (price == 0) - { - return false; - } - int num = 0; - int num2 = price; - Item[] itemArray = new Item[0x2c]; - for (int i = 0; i < 0x2c; i++) - { - itemArray[i] = new Item(); - itemArray[i] = (Item) this.inventory[i].Clone(); - if (this.inventory[i].type == 0x47) - { - num += this.inventory[i].stack; - } - if (this.inventory[i].type == 0x48) - { - num += this.inventory[i].stack * 100; - } - if (this.inventory[i].type == 0x49) - { - num += this.inventory[i].stack * 0x2710; - } - if (this.inventory[i].type == 0x4a) - { - num += this.inventory[i].stack * 0xf4240; - } - } - if (num < price) - { - return false; - } - num2 = price; - while (num2 > 0) - { - if (num2 >= 0xf4240) - { - for (int j = 0; j < 0x2c; j++) - { - if (this.inventory[j].type == 0x4a) - { - while ((this.inventory[j].stack > 0) && (num2 >= 0xf4240)) - { - num2 -= 0xf4240; - Item item1 = this.inventory[j]; - item1.stack--; - if (this.inventory[j].stack == 0) - { - this.inventory[j].type = 0; - } - } - } - } - } - if (num2 >= 0x2710) - { - for (int k = 0; k < 0x2c; k++) - { - if (this.inventory[k].type == 0x49) - { - while ((this.inventory[k].stack > 0) && (num2 >= 0x2710)) - { - num2 -= 0x2710; - Item item2 = this.inventory[k]; - item2.stack--; - if (this.inventory[k].stack == 0) - { - this.inventory[k].type = 0; - } - } - } - } - } - if (num2 >= 100) - { - for (int m = 0; m < 0x2c; m++) - { - if (this.inventory[m].type == 0x48) - { - while ((this.inventory[m].stack > 0) && (num2 >= 100)) - { - num2 -= 100; - Item item3 = this.inventory[m]; - item3.stack--; - if (this.inventory[m].stack == 0) - { - this.inventory[m].type = 0; - } - } - } - } - } - if (num2 >= 1) - { - for (int n = 0; n < 0x2c; n++) - { - if (this.inventory[n].type == 0x47) - { - while ((this.inventory[n].stack > 0) && (num2 >= 1)) - { - num2--; - Item item4 = this.inventory[n]; - item4.stack--; - if (this.inventory[n].stack == 0) - { - this.inventory[n].type = 0; - } - } - } - } - } - if (num2 > 0) - { - int index = -1; - for (int num9 = 0x2b; num9 >= 0; num9--) - { - if ((this.inventory[num9].type == 0) || (this.inventory[num9].stack == 0)) - { - index = num9; - break; - } - } - if (index >= 0) - { - bool flag = true; - if (num2 >= 0x2710) - { - for (int num10 = 0; num10 < 0x2c; num10++) - { - if ((this.inventory[num10].type == 0x4a) && (this.inventory[num10].stack >= 1)) - { - Item item5 = this.inventory[num10]; - item5.stack--; - if (this.inventory[num10].stack == 0) - { - this.inventory[num10].type = 0; - } - this.inventory[index].SetDefaults(0x49); - this.inventory[index].stack = 100; - flag = false; - break; - } - } - } - else if (num2 >= 100) - { - for (int num11 = 0; num11 < 0x2c; num11++) - { - if ((this.inventory[num11].type == 0x49) && (this.inventory[num11].stack >= 1)) - { - Item item6 = this.inventory[num11]; - item6.stack--; - if (this.inventory[num11].stack == 0) - { - this.inventory[num11].type = 0; - } - this.inventory[index].SetDefaults(0x48); - this.inventory[index].stack = 100; - flag = false; - break; - } - } - } - else if (num2 >= 1) - { - for (int num12 = 0; num12 < 0x2c; num12++) - { - if ((this.inventory[num12].type == 0x48) && (this.inventory[num12].stack >= 1)) - { - Item item7 = this.inventory[num12]; - item7.stack--; - if (this.inventory[num12].stack == 0) - { - this.inventory[num12].type = 0; - } - this.inventory[index].SetDefaults(0x47); - this.inventory[index].stack = 100; - flag = false; - break; - } - } - } - if (!flag) - { - continue; - } - if (num2 < 0x2710) - { - for (int num13 = 0; num13 < 0x2c; num13++) - { - if ((this.inventory[num13].type == 0x49) && (this.inventory[num13].stack >= 1)) - { - Item item8 = this.inventory[num13]; - item8.stack--; - if (this.inventory[num13].stack == 0) - { - this.inventory[num13].type = 0; - } - this.inventory[index].SetDefaults(0x48); - this.inventory[index].stack = 100; - flag = false; - break; - } - } - } - if (flag && (num2 < 0xf4240)) - { - for (int num14 = 0; num14 < 0x2c; num14++) - { - if ((this.inventory[num14].type == 0x4a) && (this.inventory[num14].stack >= 1)) - { - Item item9 = this.inventory[num14]; - item9.stack--; - if (this.inventory[num14].stack == 0) - { - this.inventory[num14].type = 0; - } - this.inventory[index].SetDefaults(0x49); - this.inventory[index].stack = 100; - flag = false; - break; - } - } - } - continue; - } - for (int num15 = 0; num15 < 0x2c; num15++) - { - this.inventory[num15] = (Item) itemArray[num15].Clone(); - } - return false; - } - } - return true; - } - - public void ChangeSpawn(int x, int y) - { - for (int i = 0; i < 200; i++) - { - if (this.spN[i] == null) - { - break; - } - if ((this.spN[i] == Main.worldName) && (this.spI[i] == Main.worldID)) - { - for (int k = i; k > 0; k--) - { - this.spN[k] = this.spN[k - 1]; - this.spI[k] = this.spI[k - 1]; - this.spX[k] = this.spX[k - 1]; - this.spY[k] = this.spY[k - 1]; - } - this.spN[0] = Main.worldName; - this.spI[0] = Main.worldID; - this.spX[0] = x; - this.spY[0] = y; - return; - } - } - for (int j = 0xc7; j > 0; j--) - { - if (this.spN[j - 1] != null) - { - this.spN[j] = this.spN[j - 1]; - this.spI[j] = this.spI[j - 1]; - this.spX[j] = this.spX[j - 1]; - this.spY[j] = this.spY[j - 1]; - } - } - this.spN[0] = Main.worldName; - this.spI[0] = Main.worldID; - this.spX[0] = x; - this.spY[0] = y; - } - - public static bool CheckSpawn(int x, int y) - { - if (((x < 10) || (x > (Main.maxTilesX - 10))) || ((y < 10) || (y > (Main.maxTilesX - 10)))) - { - return false; - } - if (Main.tile[x, y - 1] == null) - { - return false; - } - if (!Main.tile[x, y - 1].active || (Main.tile[x, y - 1].type != 0x4f)) - { - return false; - } - for (int i = x - 1; i <= (x + 1); i++) - { - for (int j = y - 3; j < y; j++) - { - if (Main.tile[i, j] == null) - { - return false; - } - if ((Main.tile[i, j].active && Main.tileSolid[Main.tile[i, j].type]) && !Main.tileSolidTop[Main.tile[i, j].type]) - { - return false; - } - } - } - if (!WorldGen.StartRoomCheck(x, y - 1)) - { - return false; - } - return true; - } - - public object clientClone() - { - Player player = new Player { - zoneEvil = this.zoneEvil, - zoneMeteor = this.zoneMeteor, - zoneDungeon = this.zoneDungeon, - zoneJungle = this.zoneJungle, - direction = this.direction, - selectedItem = this.selectedItem, - controlUp = this.controlUp, - controlDown = this.controlDown, - controlLeft = this.controlLeft, - controlRight = this.controlRight, - controlJump = this.controlJump, - controlUseItem = this.controlUseItem, - statLife = this.statLife, - statLifeMax = this.statLifeMax, - statMana = this.statMana, - statManaMax = this.statManaMax - }; - player.position.X = this.position.X; - player.chest = this.chest; - player.talkNPC = this.talkNPC; - for (int i = 0; i < 0x2c; i++) - { - player.inventory[i] = (Item) this.inventory[i].Clone(); - if (i < 8) - { - player.armor[i] = (Item) this.armor[i].Clone(); - } - } - return player; - } - - public object Clone() - { - return base.MemberwiseClone(); - } - - private static bool DecryptFile(string inputFile, string outputFile) - { - string s = "h3y_gUyZ"; - byte[] bytes = new UnicodeEncoding().GetBytes(s); - FileStream stream = new FileStream(inputFile, FileMode.Open); - RijndaelManaged managed = new RijndaelManaged(); - CryptoStream stream2 = new CryptoStream(stream, managed.CreateDecryptor(bytes, bytes), CryptoStreamMode.Read); - FileStream stream3 = new FileStream(outputFile, FileMode.Create); - try - { - int num; - while ((num = stream2.ReadByte()) != -1) - { - stream3.WriteByte((byte) num); - } - stream3.Close(); - stream2.Close(); - stream.Close(); - } - catch - { - stream3.Close(); - stream.Close(); - File.Delete(outputFile); - return true; - } - return false; - } - - public void DoCoins(int i) - { - if ((this.inventory[i].stack == 100) && (((this.inventory[i].type == 0x47) || (this.inventory[i].type == 0x48)) || (this.inventory[i].type == 0x49))) - { - this.inventory[i].SetDefaults((int) (this.inventory[i].type + 1)); - for (int j = 0; j < 0x2c; j++) - { - if ((this.inventory[j].IsTheSameAs(this.inventory[i]) && (j != i)) && (this.inventory[j].stack < this.inventory[j].maxStack)) - { - Item item1 = this.inventory[j]; - item1.stack++; - this.inventory[i].SetDefaults(""); - this.inventory[i].active = false; - this.inventory[i].name = ""; - this.inventory[i].type = 0; - this.inventory[i].stack = 0; - this.DoCoins(j); - } - } - } - } - - public void DropItems() - { - for (int i = 0; i < 0x2c; i++) - { - if ((this.inventory[i].type >= 0x47) && (this.inventory[i].type <= 0x4a)) - { - int index = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, this.inventory[i].type, 1, false); - int num3 = this.inventory[i].stack / 2; - num3 = this.inventory[i].stack - num3; - Item item1 = this.inventory[i]; - item1.stack -= num3; - if (this.inventory[i].stack <= 0) - { - this.inventory[i] = new Item(); - } - Main.item[index].stack = num3; - Main.item[index].velocity.Y = Main.rand.Next(-20, 1) * 0.2f; - Main.item[index].velocity.X = Main.rand.Next(-20, 0x15) * 0.2f; - Main.item[index].noGrabDelay = 100; - if (Main.netMode == 1) - { - NetMessage.SendData(0x15, -1, -1, "", index, 0f, 0f, 0f); - } - } - } - } - - private static void EncryptFile(string inputFile, string outputFile) - { - int num; - string s = "h3y_gUyZ"; - byte[] bytes = new UnicodeEncoding().GetBytes(s); - string path = outputFile; - FileStream stream = new FileStream(path, FileMode.Create); - RijndaelManaged managed = new RijndaelManaged(); - CryptoStream stream2 = new CryptoStream(stream, managed.CreateEncryptor(bytes, bytes), CryptoStreamMode.Write); - FileStream stream3 = new FileStream(inputFile, FileMode.Open); - while ((num = stream3.ReadByte()) != -1) - { - stream2.WriteByte((byte) num); - } - stream3.Close(); - stream2.Close(); - stream.Close(); - } - - public static byte FindClosest(Vector2 Position, int Width, int Height) - { - byte num = 0; - for (int i = 0; i < 8; i++) - { - if (Main.player[i].active) - { - num = (byte) i; - break; - } - } - float num3 = -1f; - for (int j = 0; j < 8; j++) - { - if ((Main.player[j].active && !Main.player[j].dead) && ((num3 == -1f) || ((Math.Abs((float) (((Main.player[j].position.X + (Main.player[j].width / 2)) - Position.X) + (Width / 2))) + Math.Abs((float) (((Main.player[j].position.Y + (Main.player[j].height / 2)) - Position.Y) + (Height / 2)))) < num3))) - { - num3 = Math.Abs((float) (((Main.player[j].position.X + (Main.player[j].width / 2)) - Position.X) + (Width / 2))) + Math.Abs((float) (((Main.player[j].position.Y + (Main.player[j].height / 2)) - Position.Y) + (Height / 2))); - num = (byte) j; - } - } - return num; - } - - public void FindSpawn() - { - for (int i = 0; i < 200; i++) - { - if (this.spN[i] == null) - { - this.SpawnX = -1; - this.SpawnY = -1; - return; - } - if ((this.spN[i] == Main.worldName) && (this.spI[i] == Main.worldID)) - { - this.SpawnX = this.spX[i]; - this.SpawnY = this.spY[i]; - return; - } - } - } - - public Color GetDeathAlpha(Color newColor) - { - int r = newColor.R + ((int) (this.immuneAlpha * 0.9)); - int g = newColor.G + ((int) (this.immuneAlpha * 0.5)); - int b = newColor.B + ((int) (this.immuneAlpha * 0.5)); - int a = newColor.A + ((int) (this.immuneAlpha * 0.4)); - if (a < 0) - { - a = 0; - } - if (a > 0xff) - { - a = 0xff; - } - return new Color(r, g, b, a); - } - - public Color GetImmuneAlpha(Color newColor) - { - float num = ((float) (0xff - this.immuneAlpha)) / 255f; - if (this.shadow > 0f) - { - num *= 1f - this.shadow; - } - int r = (int) (newColor.R * num); - int g = (int) (newColor.G * num); - int b = (int) (newColor.B * num); - int a = (int) (newColor.A * num); - if (a < 0) - { - a = 0; - } - if (a > 0xff) - { - a = 0xff; - } - return new Color(r, g, b, a); - } - - public Item GetItem(int plr, Item newItem) - { - Item item = newItem; - if (newItem.noGrabDelay <= 0) - { - int num = 0; - if (((newItem.type == 0x47) || (newItem.type == 0x48)) || ((newItem.type == 0x49) || (newItem.type == 0x4a))) - { - num = -4; - } - for (int i = num; i < 40; i++) - { - int index = i; - if (index < 0) - { - index = 0x2c + i; - } - if (((this.inventory[index].type > 0) && (this.inventory[index].stack < this.inventory[index].maxStack)) && item.IsTheSameAs(this.inventory[index])) - { - Main.PlaySound(7, (int) this.position.X, (int) this.position.Y, 1); - if ((item.stack + this.inventory[index].stack) <= this.inventory[index].maxStack) - { - Item item1 = this.inventory[index]; - item1.stack += item.stack; - this.DoCoins(index); - if (plr == Main.myPlayer) - { - Recipe.FindRecipes(); - } - return new Item(); - } - item.stack -= this.inventory[index].maxStack - this.inventory[index].stack; - this.inventory[index].stack = this.inventory[index].maxStack; - this.DoCoins(index); - if (plr == Main.myPlayer) - { - Recipe.FindRecipes(); - } - } - } - for (int j = num; j < 40; j++) - { - int num5 = j; - if (num5 < 0) - { - num5 = 0x2c + j; - } - if (this.inventory[num5].type == 0) - { - this.inventory[num5] = item; - this.DoCoins(num5); - Main.PlaySound(7, (int) this.position.X, (int) this.position.Y, 1); - if (plr == Main.myPlayer) - { - Recipe.FindRecipes(); - } - return new Item(); - } - } - } - return item; - } - - public void HealEffect(int healAmount) - { - CombatText.NewText(new Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height), new Color(100, 100, 0xff, 0xff), healAmount.ToString()); - if ((Main.netMode == 1) && (this.whoAmi == Main.myPlayer)) - { - NetMessage.SendData(0x23, -1, -1, "", this.whoAmi, (float) healAmount, 0f, 0f); - } - } - - public double Hurt(int Damage, int hitDirection, bool pvp = false, bool quiet = false) - { - if (this.immune || Main.godMode) - { - return 0.0; - } - int damage = Damage; - if (pvp) - { - damage *= 2; - } - double dmg = Main.CalculateDamage(damage, this.statDefense); - if (dmg >= 1.0) - { - if (((Main.netMode == 1) && (this.whoAmi == Main.myPlayer)) && !quiet) - { - int num3 = 0; - if (pvp) - { - num3 = 1; - } - NetMessage.SendData(13, -1, -1, "", this.whoAmi, 0f, 0f, 0f); - NetMessage.SendData(0x10, -1, -1, "", this.whoAmi, 0f, 0f, 0f); - NetMessage.SendData(0x1a, -1, -1, "", this.whoAmi, (float) hitDirection, (float) Damage, (float) num3); - } - CombatText.NewText(new Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height), new Color(0xff, 80, 90, 0xff), ((int) dmg).ToString()); - this.statLife -= (int) dmg; - this.immune = true; - this.immuneTime = 40; - if (pvp) - { - this.immuneTime = 8; - } - if (!this.noKnockback && (hitDirection != 0)) - { - this.velocity.X = 4.5f * hitDirection; - this.velocity.Y = -3.5f; - } - if (this.boneArmor) - { - Main.PlaySound(3, (int) this.position.X, (int) this.position.Y, 2); - } - else if (((this.hair == 5) || (this.hair == 6)) || ((this.hair == 9) || (this.hair == 11))) - { - Main.PlaySound(20, (int) this.position.X, (int) this.position.Y, 1); - } - else - { - Main.PlaySound(1, (int) this.position.X, (int) this.position.Y, 1); - } - if (this.statLife > 0) - { - for (int i = 0; i < ((dmg / ((double) this.statLifeMax)) * 100.0); i++) - { - if (this.boneArmor) - { - Color newColor = new Color(); - Dust.NewDust(this.position, this.width, this.height, 0x1a, (float) (2 * hitDirection), -2f, 0, newColor, 1f); - } - else - { - Color color2 = new Color(); - Dust.NewDust(this.position, this.width, this.height, 5, (float) (2 * hitDirection), -2f, 0, color2, 1f); - } - } - } - else - { - this.statLife = 0; - if (this.whoAmi == Main.myPlayer) - { - this.KillMe(dmg, hitDirection, pvp); - } - } - } - if (pvp) - { - dmg = Main.CalculateDamage(damage, this.statDefense); - } - return dmg; - } - - public void ItemCheck(int i) - { - Color color; - if (this.inventory[this.selectedItem].autoReuse) - { - this.releaseUseItem = true; - if ((this.itemAnimation == 1) && (this.inventory[this.selectedItem].stack > 0)) - { - this.itemAnimation = 0; - } - } - if ((this.controlUseItem && (this.itemAnimation == 0)) && (this.releaseUseItem && (this.inventory[this.selectedItem].useStyle > 0))) - { - bool flag = true; - if (((this.inventory[this.selectedItem].shoot == 6) || (this.inventory[this.selectedItem].shoot == 0x13)) || (this.inventory[this.selectedItem].shoot == 0x21)) - { - for (int j = 0; j < 0x3e8; j++) - { - if ((Main.projectile[j].active && (Main.projectile[j].owner == Main.myPlayer)) && (Main.projectile[j].type == this.inventory[this.selectedItem].shoot)) - { - flag = false; - } - } - } - if (this.inventory[this.selectedItem].potion) - { - if (this.potionDelay <= 0) - { - this.potionDelay = Item.potionDelay; - } - else - { - flag = false; - } - } - if (this.inventory[this.selectedItem].mana > 0) - { - if (this.statMana >= ((int) (this.inventory[this.selectedItem].mana * this.manaCost))) - { - this.statMana -= (int) (this.inventory[this.selectedItem].mana * this.manaCost); - } - else - { - flag = false; - } - } - if ((this.inventory[this.selectedItem].type == 0x2b) && Main.dayTime) - { - flag = false; - } - if ((this.inventory[this.selectedItem].type == 70) && !this.zoneEvil) - { - flag = false; - } - if (((this.inventory[this.selectedItem].shoot == 0x11) && flag) && (i == Main.myPlayer)) - { - int num2 = (Main.mouseState.X + ((int) Main.screenPosition.X)) / 0x10; - int num3 = (Main.mouseState.Y + ((int) Main.screenPosition.Y)) / 0x10; - if (Main.tile[num2, num3].active && (((Main.tile[num2, num3].type == 0) || (Main.tile[num2, num3].type == 2)) || (Main.tile[num2, num3].type == 0x17))) - { - WorldGen.KillTile(num2, num3, false, false, true); - if (!Main.tile[num2, num3].active) - { - if (Main.netMode == 1) - { - NetMessage.SendData(0x11, -1, -1, "", 4, (float) num2, (float) num3, 0f); - } - } - else - { - flag = false; - } - } - else - { - flag = false; - } - } - if (flag && (this.inventory[this.selectedItem].useAmmo > 0)) - { - flag = false; - for (int k = 0; k < 0x2c; k++) - { - if ((this.inventory[k].ammo == this.inventory[this.selectedItem].useAmmo) && (this.inventory[k].stack > 0)) - { - flag = true; - break; - } - } - } - if (flag) - { - if (this.grappling[0] > -1) - { - if (this.controlRight) - { - this.direction = 1; - } - else if (this.controlLeft) - { - this.direction = -1; - } - } - this.channel = this.inventory[this.selectedItem].channel; - this.attackCD = 0; - if ((this.inventory[this.selectedItem].shoot > 0) || (this.inventory[this.selectedItem].damage == 0)) - { - this.meleeSpeed = 1f; - } - this.itemAnimation = (int) (this.inventory[this.selectedItem].useAnimation * this.meleeSpeed); - this.itemAnimationMax = (int) (this.inventory[this.selectedItem].useAnimation * this.meleeSpeed); - if (this.inventory[this.selectedItem].useSound > 0) - { - Main.PlaySound(2, (int) this.position.X, (int) this.position.Y, this.inventory[this.selectedItem].useSound); - } - } - if (flag && (this.inventory[this.selectedItem].shoot == 0x12)) - { - for (int m = 0; m < 0x3e8; m++) - { - if ((Main.projectile[m].active && (Main.projectile[m].owner == i)) && (Main.projectile[m].type == this.inventory[this.selectedItem].shoot)) - { - Main.projectile[m].Kill(); - } - } - } - } - if (!this.controlUseItem) - { - this.channel = false; - } - if (this.itemAnimation > 0) - { - if (this.inventory[this.selectedItem].mana > 0) - { - this.manaRegenDelay = 180; - } - this.itemHeight = Main.itemTexture[this.inventory[this.selectedItem].type].Height; - this.itemWidth = Main.itemTexture[this.inventory[this.selectedItem].type].Width; - this.itemAnimation--; - if (this.inventory[this.selectedItem].useStyle == 1) - { - if (this.itemAnimation < (this.itemAnimationMax * 0.333)) - { - float num6 = 10f; - if (Main.itemTexture[this.inventory[this.selectedItem].type].Width > 0x20) - { - num6 = 14f; - } - this.itemLocation.X = (this.position.X + (this.width * 0.5f)) + (((Main.itemTexture[this.inventory[this.selectedItem].type].Width * 0.5f) - num6) * this.direction); - this.itemLocation.Y = this.position.Y + 24f; - } - else if (this.itemAnimation < (this.itemAnimationMax * 0.666)) - { - float num7 = 10f; - if (Main.itemTexture[this.inventory[this.selectedItem].type].Width > 0x20) - { - num7 = 18f; - } - this.itemLocation.X = (this.position.X + (this.width * 0.5f)) + (((Main.itemTexture[this.inventory[this.selectedItem].type].Width * 0.5f) - num7) * this.direction); - num7 = 10f; - if (Main.itemTexture[this.inventory[this.selectedItem].type].Height > 0x20) - { - num7 = 8f; - } - this.itemLocation.Y = this.position.Y + num7; - } - else - { - float num8 = 6f; - if (Main.itemTexture[this.inventory[this.selectedItem].type].Width > 0x20) - { - num8 = 14f; - } - this.itemLocation.X = (this.position.X + (this.width * 0.5f)) - (((Main.itemTexture[this.inventory[this.selectedItem].type].Width * 0.5f) - num8) * this.direction); - num8 = 10f; - if (Main.itemTexture[this.inventory[this.selectedItem].type].Height > 0x20) - { - num8 = 10f; - } - this.itemLocation.Y = this.position.Y + num8; - } - this.itemRotation = ((((((float) this.itemAnimation) / ((float) this.itemAnimationMax)) - 0.5f) * -this.direction) * 3.5f) - (this.direction * 0.3f); - } - else if (this.inventory[this.selectedItem].useStyle == 2) - { - this.itemRotation = (((((float) this.itemAnimation) / ((float) this.itemAnimationMax)) * this.direction) * 2f) + (-1.4f * this.direction); - if (this.itemAnimation < (this.itemAnimationMax * 0.5)) - { - this.itemLocation.X = (this.position.X + (this.width * 0.5f)) + ((((Main.itemTexture[this.inventory[this.selectedItem].type].Width * 0.5f) - 9f) - ((this.itemRotation * 12f) * this.direction)) * this.direction); - this.itemLocation.Y = (this.position.Y + 38f) + ((this.itemRotation * this.direction) * 4f); - } - else - { - this.itemLocation.X = (this.position.X + (this.width * 0.5f)) + ((((Main.itemTexture[this.inventory[this.selectedItem].type].Width * 0.5f) - 9f) - ((this.itemRotation * 16f) * this.direction)) * this.direction); - this.itemLocation.Y = (this.position.Y + 38f) + (this.itemRotation * this.direction); - } - } - else if (this.inventory[this.selectedItem].useStyle == 3) - { - if (this.itemAnimation > (this.itemAnimationMax * 0.666)) - { - this.itemLocation.X = -1000f; - this.itemLocation.Y = -1000f; - this.itemRotation = -1.3f * this.direction; - } - else - { - this.itemLocation.X = (this.position.X + (this.width * 0.5f)) + (((Main.itemTexture[this.inventory[this.selectedItem].type].Width * 0.5f) - 4f) * this.direction); - this.itemLocation.Y = this.position.Y + 24f; - float num9 = (((((((float) this.itemAnimation) / ((float) this.itemAnimationMax)) * Main.itemTexture[this.inventory[this.selectedItem].type].Width) * this.direction) * this.inventory[this.selectedItem].scale) * 1.2f) - (10 * this.direction); - if ((num9 > -4f) && (this.direction == -1)) - { - num9 = -8f; - } - if ((num9 < 4f) && (this.direction == 1)) - { - num9 = 8f; - } - this.itemLocation.X -= num9; - this.itemRotation = 0.8f * this.direction; - } - } - else if (this.inventory[this.selectedItem].useStyle == 4) - { - this.itemRotation = 0f; - this.itemLocation.X = (this.position.X + (this.width * 0.5f)) + ((((Main.itemTexture[this.inventory[this.selectedItem].type].Width * 0.5f) - 9f) - ((this.itemRotation * 14f) * this.direction)) * this.direction); - this.itemLocation.Y = this.position.Y + (Main.itemTexture[this.inventory[this.selectedItem].type].Height * 0.5f); - } - else if (this.inventory[this.selectedItem].useStyle == 5) - { - this.itemLocation.X = ((this.position.X + (this.width * 0.5f)) - (Main.itemTexture[this.inventory[this.selectedItem].type].Width * 0.5f)) - (this.direction * 2); - this.itemLocation.Y = (this.position.Y + (this.height * 0.5f)) - (Main.itemTexture[this.inventory[this.selectedItem].type].Height * 0.5f); - } - } - else if (this.inventory[this.selectedItem].holdStyle == 1) - { - this.itemLocation.X = (this.position.X + (this.width * 0.5f)) + (((Main.itemTexture[this.inventory[this.selectedItem].type].Width * 0.5f) + 4f) * this.direction); - this.itemLocation.Y = this.position.Y + 24f; - this.itemRotation = 0f; - } - else if (this.inventory[this.selectedItem].holdStyle == 2) - { - this.itemLocation.X = (this.position.X + (this.width * 0.5f)) + (6 * this.direction); - this.itemLocation.Y = this.position.Y + 16f; - this.itemRotation = 0.79f * -this.direction; - } - if (this.inventory[this.selectedItem].type == 8) - { - int maxValue = 20; - if (this.itemAnimation > 0) - { - maxValue = 7; - } - if (this.direction == -1) - { - if (Main.rand.Next(maxValue) == 0) - { - color = new Color(); - Dust.NewDust(new Vector2(this.itemLocation.X - 16f, this.itemLocation.Y - 14f), 4, 4, 6, 0f, 0f, 100, color, 1f); - } - Lighting.addLight((int) (((this.itemLocation.X - 16f) + this.velocity.X) / 16f), (int) ((this.itemLocation.Y - 14f) / 16f), 1f); - } - else - { - if (Main.rand.Next(maxValue) == 0) - { - color = new Color(); - Dust.NewDust(new Vector2(this.itemLocation.X + 6f, this.itemLocation.Y - 14f), 4, 4, 6, 0f, 0f, 100, color, 1f); - } - Lighting.addLight((int) (((this.itemLocation.X + 6f) + this.velocity.X) / 16f), (int) ((this.itemLocation.Y - 14f) / 16f), 1f); - } - } - else if (this.inventory[this.selectedItem].type == 0x69) - { - int num11 = 20; - if (this.itemAnimation > 0) - { - num11 = 7; - } - if (this.direction == -1) - { - if (Main.rand.Next(num11) == 0) - { - color = new Color(); - Dust.NewDust(new Vector2(this.itemLocation.X - 12f, this.itemLocation.Y - 20f), 4, 4, 6, 0f, 0f, 100, color, 1f); - } - Lighting.addLight((int) (((this.itemLocation.X - 16f) + this.velocity.X) / 16f), (int) ((this.itemLocation.Y - 14f) / 16f), 1f); - } - else - { - if (Main.rand.Next(num11) == 0) - { - color = new Color(); - Dust.NewDust(new Vector2(this.itemLocation.X + 4f, this.itemLocation.Y - 20f), 4, 4, 6, 0f, 0f, 100, color, 1f); - } - Lighting.addLight((int) (((this.itemLocation.X + 6f) + this.velocity.X) / 16f), (int) ((this.itemLocation.Y - 14f) / 16f), 1f); - } - } - else if (this.inventory[this.selectedItem].type == 0x94) - { - int num12 = 10; - if (this.itemAnimation > 0) - { - num12 = 7; - } - if (this.direction == -1) - { - if (Main.rand.Next(num12) == 0) - { - color = new Color(); - Dust.NewDust(new Vector2(this.itemLocation.X - 12f, this.itemLocation.Y - 20f), 4, 4, 0x1d, 0f, 0f, 100, color, 1f); - } - Lighting.addLight((int) (((this.itemLocation.X - 16f) + this.velocity.X) / 16f), (int) ((this.itemLocation.Y - 14f) / 16f), 1f); - } - else - { - if (Main.rand.Next(num12) == 0) - { - color = new Color(); - Dust.NewDust(new Vector2(this.itemLocation.X + 4f, this.itemLocation.Y - 20f), 4, 4, 0x1d, 0f, 0f, 100, color, 1f); - } - Lighting.addLight((int) (((this.itemLocation.X + 6f) + this.velocity.X) / 16f), (int) ((this.itemLocation.Y - 14f) / 16f), 1f); - } - } - if (this.controlUseItem) - { - this.releaseUseItem = false; - } - else - { - this.releaseUseItem = true; - } - if (this.itemTime > 0) - { - this.itemTime--; - } - if (i == Main.myPlayer) - { - if (((this.inventory[this.selectedItem].shoot > 0) && (this.itemAnimation > 0)) && (this.itemTime == 0)) - { - int shoot = this.inventory[this.selectedItem].shoot; - float shootSpeed = this.inventory[this.selectedItem].shootSpeed; - bool flag2 = false; - int damage = this.inventory[this.selectedItem].damage; - float knockBack = this.inventory[this.selectedItem].knockBack; - switch (shoot) - { - case 13: - case 0x20: - this.grappling[0] = -1; - this.grapCount = 0; - for (int n = 0; n < 0x3e8; n++) - { - if ((Main.projectile[n].active && (Main.projectile[n].owner == i)) && (Main.projectile[n].type == 13)) - { - Main.projectile[n].Kill(); - } - } - break; - } - if (this.inventory[this.selectedItem].useAmmo > 0) - { - for (int num18 = 0; num18 < 0x2c; num18++) - { - if ((this.inventory[num18].ammo == this.inventory[this.selectedItem].useAmmo) && (this.inventory[num18].stack > 0)) - { - if (this.inventory[num18].shoot > 0) - { - shoot = this.inventory[num18].shoot; - } - shootSpeed += this.inventory[num18].shootSpeed; - damage += this.inventory[num18].damage; - knockBack += this.inventory[num18].knockBack; - Item item1 = this.inventory[num18]; - item1.stack--; - if (this.inventory[num18].stack <= 0) - { - this.inventory[num18].active = false; - this.inventory[num18].name = ""; - this.inventory[num18].type = 0; - } - flag2 = true; - break; - } - } - } - else - { - flag2 = true; - } - if ((shoot == 9) && (this.position.Y > ((Main.worldSurface * 16.0) + (Main.screenHeight / 2)))) - { - flag2 = false; - } - if (flag2) - { - if ((shoot == 1) && (this.inventory[this.selectedItem].type == 120)) - { - shoot = 2; - } - this.itemTime = this.inventory[this.selectedItem].useTime; - if ((Main.mouseState.X + Main.screenPosition.X) > (this.position.X + (this.width * 0.5f))) - { - this.direction = 1; - } - else - { - this.direction = -1; - } - Vector2 vector = new Vector2(this.position.X + (this.width * 0.5f), this.position.Y + (this.height * 0.5f)); - if (shoot == 9) - { - vector = new Vector2((this.position.X + (this.width * 0.5f)) + (Main.rand.Next(0x259) * -this.direction), ((this.position.Y + (this.height * 0.5f)) - 300f) - Main.rand.Next(100)); - knockBack = 0f; - } - float speedX = (Main.mouseState.X + Main.screenPosition.X) - vector.X; - float speedY = (Main.mouseState.Y + Main.screenPosition.Y) - vector.Y; - float num21 = (float) Math.Sqrt((double) ((speedX * speedX) + (speedY * speedY))); - num21 = shootSpeed / num21; - speedX *= num21; - speedY *= num21; - if (shoot == 12) - { - vector.X += speedX * 3f; - vector.Y += speedY * 3f; - } - if (this.inventory[this.selectedItem].useStyle == 5) - { - this.itemRotation = (float) Math.Atan2((double) (speedY * this.direction), (double) (speedX * this.direction)); - NetMessage.SendData(13, -1, -1, "", this.whoAmi, 0f, 0f, 0f); - NetMessage.SendData(0x29, -1, -1, "", this.whoAmi, 0f, 0f, 0f); - } - if (shoot == 0x11) - { - vector.X = Main.mouseState.X + Main.screenPosition.X; - vector.Y = Main.mouseState.Y + Main.screenPosition.Y; - } - Projectile.NewProjectile(vector.X, vector.Y, speedX, speedY, shoot, damage, knockBack, i); - } - else if (this.inventory[this.selectedItem].useStyle == 5) - { - this.itemRotation = 0f; - NetMessage.SendData(0x29, -1, -1, "", this.whoAmi, 0f, 0f, 0f); - } - } - if ((((this.inventory[this.selectedItem].type >= 0xcd) && (this.inventory[this.selectedItem].type <= 0xcf)) && (((((this.position.X / 16f) - tileRangeX) - this.inventory[this.selectedItem].tileBoost) <= tileTargetX) && ((((((this.position.X + this.width) / 16f) + tileRangeX) + this.inventory[this.selectedItem].tileBoost) - 1f) >= tileTargetX))) && (((((this.position.Y / 16f) - tileRangeY) - this.inventory[this.selectedItem].tileBoost) <= tileTargetY) && ((((((this.position.Y + this.height) / 16f) + tileRangeY) + this.inventory[this.selectedItem].tileBoost) - 2f) >= tileTargetY))) - { - this.showItemIcon = true; - if (((this.itemTime == 0) && (this.itemAnimation > 0)) && this.controlUseItem) - { - if (this.inventory[this.selectedItem].type == 0xcd) - { - bool lava = Main.tile[tileTargetX, tileTargetY].lava; - int num22 = 0; - for (int num23 = tileTargetX - 1; num23 <= (tileTargetX + 1); num23++) - { - for (int num24 = tileTargetY - 1; num24 <= (tileTargetY + 1); num24++) - { - if (Main.tile[num23, num24].lava == lava) - { - num22 += Main.tile[num23, num24].liquid; - } - } - } - if ((Main.tile[tileTargetX, tileTargetY].liquid > 0) && (num22 > 100)) - { - bool flag4 = Main.tile[tileTargetX, tileTargetY].lava; - if (!Main.tile[tileTargetX, tileTargetY].lava) - { - this.inventory[this.selectedItem].SetDefaults(0xce); - } - else - { - this.inventory[this.selectedItem].SetDefaults(0xcf); - } - Main.PlaySound(0x13, (int) this.position.X, (int) this.position.Y, 1); - this.itemTime = this.inventory[this.selectedItem].useTime; - int liquid = Main.tile[tileTargetX, tileTargetY].liquid; - Main.tile[tileTargetX, tileTargetY].liquid = 0; - Main.tile[tileTargetX, tileTargetY].lava = false; - WorldGen.SquareTileFrame(tileTargetX, tileTargetY, false); - if (Main.netMode == 1) - { - NetMessage.sendWater(tileTargetX, tileTargetY); - } - else - { - Liquid.AddWater(tileTargetX, tileTargetY); - } - for (int num26 = tileTargetX - 1; num26 <= (tileTargetX + 1); num26++) - { - for (int num27 = tileTargetY - 1; num27 <= (tileTargetY + 1); num27++) - { - if ((liquid < 0x100) && (Main.tile[num26, num27].lava == lava)) - { - int num28 = Main.tile[num26, num27].liquid; - if ((num28 + liquid) > 0xff) - { - num28 = 0xff - liquid; - } - liquid += num28; - Tile tile1 = Main.tile[num26, num27]; - tile1.liquid = (byte) (tile1.liquid - ((byte) num28)); - Main.tile[num26, num27].lava = flag4; - if (Main.tile[num26, num27].liquid == 0) - { - Main.tile[num26, num27].lava = false; - } - WorldGen.SquareTileFrame(num26, num27, false); - if (Main.netMode == 1) - { - NetMessage.sendWater(num26, num27); - } - else - { - Liquid.AddWater(num26, num27); - } - } - } - } - } - } - else if ((Main.tile[tileTargetX, tileTargetY].liquid < 200) && ((!Main.tile[tileTargetX, tileTargetY].active || !Main.tileSolid[Main.tile[tileTargetX, tileTargetY].type]) || !Main.tileSolidTop[Main.tile[tileTargetX, tileTargetY].type])) - { - if (this.inventory[this.selectedItem].type == 0xcf) - { - if ((Main.tile[tileTargetX, tileTargetY].liquid == 0) || Main.tile[tileTargetX, tileTargetY].lava) - { - Main.PlaySound(0x13, (int) this.position.X, (int) this.position.Y, 1); - Main.tile[tileTargetX, tileTargetY].lava = true; - Main.tile[tileTargetX, tileTargetY].liquid = 0xff; - WorldGen.SquareTileFrame(tileTargetX, tileTargetY, true); - this.inventory[this.selectedItem].SetDefaults(0xcd); - this.itemTime = this.inventory[this.selectedItem].useTime; - if (Main.netMode == 1) - { - NetMessage.sendWater(tileTargetX, tileTargetY); - } - } - } - else if ((Main.tile[tileTargetX, tileTargetY].liquid == 0) || !Main.tile[tileTargetX, tileTargetY].lava) - { - Main.PlaySound(0x13, (int) this.position.X, (int) this.position.Y, 1); - Main.tile[tileTargetX, tileTargetY].lava = false; - Main.tile[tileTargetX, tileTargetY].liquid = 0xff; - WorldGen.SquareTileFrame(tileTargetX, tileTargetY, true); - this.inventory[this.selectedItem].SetDefaults(0xcd); - this.itemTime = this.inventory[this.selectedItem].useTime; - if (Main.netMode == 1) - { - NetMessage.sendWater(tileTargetX, tileTargetY); - } - } - } - } - } - if ((((this.inventory[this.selectedItem].pick > 0) || (this.inventory[this.selectedItem].axe > 0)) || (this.inventory[this.selectedItem].hammer > 0)) && ((((((this.position.X / 16f) - tileRangeX) - this.inventory[this.selectedItem].tileBoost) <= tileTargetX) && ((((((this.position.X + this.width) / 16f) + tileRangeX) + this.inventory[this.selectedItem].tileBoost) - 1f) >= tileTargetX)) && (((((this.position.Y / 16f) - tileRangeY) - this.inventory[this.selectedItem].tileBoost) <= tileTargetY) && ((((((this.position.Y + this.height) / 16f) + tileRangeY) + this.inventory[this.selectedItem].tileBoost) - 2f) >= tileTargetY)))) - { - this.showItemIcon = true; - if ((Main.tile[tileTargetX, tileTargetY].active && (this.itemTime == 0)) && ((this.itemAnimation > 0) && this.controlUseItem)) - { - if ((this.hitTileX != tileTargetX) || (this.hitTileY != tileTargetY)) - { - this.hitTile = 0; - this.hitTileX = tileTargetX; - this.hitTileY = tileTargetY; - } - if (Main.tileNoFail[Main.tile[tileTargetX, tileTargetY].type]) - { - this.hitTile = 100; - } - if (Main.tile[tileTargetX, tileTargetY].type != 0x1b) - { - if ((((((Main.tile[tileTargetX, tileTargetY].type == 4) || (Main.tile[tileTargetX, tileTargetY].type == 10)) || ((Main.tile[tileTargetX, tileTargetY].type == 11) || (Main.tile[tileTargetX, tileTargetY].type == 12))) || (((Main.tile[tileTargetX, tileTargetY].type == 13) || (Main.tile[tileTargetX, tileTargetY].type == 14)) || ((Main.tile[tileTargetX, tileTargetY].type == 15) || (Main.tile[tileTargetX, tileTargetY].type == 0x10)))) || ((((Main.tile[tileTargetX, tileTargetY].type == 0x11) || (Main.tile[tileTargetX, tileTargetY].type == 0x12)) || ((Main.tile[tileTargetX, tileTargetY].type == 0x13) || (Main.tile[tileTargetX, tileTargetY].type == 0x15))) || (((Main.tile[tileTargetX, tileTargetY].type == 0x1a) || (Main.tile[tileTargetX, tileTargetY].type == 0x1c)) || ((Main.tile[tileTargetX, tileTargetY].type == 0x1d) || (Main.tile[tileTargetX, tileTargetY].type == 0x1f))))) || (((((Main.tile[tileTargetX, tileTargetY].type == 0x21) || (Main.tile[tileTargetX, tileTargetY].type == 0x22)) || ((Main.tile[tileTargetX, tileTargetY].type == 0x23) || (Main.tile[tileTargetX, tileTargetY].type == 0x24))) || (((Main.tile[tileTargetX, tileTargetY].type == 0x2a) || (Main.tile[tileTargetX, tileTargetY].type == 0x30)) || ((Main.tile[tileTargetX, tileTargetY].type == 0x31) || (Main.tile[tileTargetX, tileTargetY].type == 50)))) || (((Main.tile[tileTargetX, tileTargetY].type == 0x36) || (Main.tile[tileTargetX, tileTargetY].type == 0x37)) || (((Main.tile[tileTargetX, tileTargetY].type == 0x4d) || (Main.tile[tileTargetX, tileTargetY].type == 0x4e)) || (Main.tile[tileTargetX, tileTargetY].type == 0x4f))))) - { - if (Main.tile[tileTargetX, tileTargetY].type == 0x30) - { - this.hitTile += this.inventory[this.selectedItem].hammer / 3; - } - else - { - this.hitTile += this.inventory[this.selectedItem].hammer; - } - if ((Main.tile[tileTargetX, tileTargetY].type == 0x4d) && (this.inventory[this.selectedItem].hammer < 60)) - { - this.hitTile = 0; - } - if (this.inventory[this.selectedItem].hammer > 0) - { - if (Main.tile[tileTargetX, tileTargetY].type == 0x1a) - { - this.Hurt(this.statLife / 2, -this.direction, false, false); - WorldGen.KillTile(tileTargetX, tileTargetY, true, false, false); - if (Main.netMode == 1) - { - NetMessage.SendData(0x11, -1, -1, "", 0, (float) tileTargetX, (float) tileTargetY, 1f); - } - } - else if (this.hitTile >= 100) - { - if ((Main.netMode == 1) && (Main.tile[tileTargetX, tileTargetY].type == 0x15)) - { - WorldGen.KillTile(tileTargetX, tileTargetY, true, false, false); - NetMessage.SendData(0x11, -1, -1, "", 0, (float) tileTargetX, (float) tileTargetY, 1f); - NetMessage.SendData(0x22, -1, -1, "", tileTargetX, (float) tileTargetY, 0f, 0f); - } - else - { - this.hitTile = 0; - WorldGen.KillTile(tileTargetX, tileTargetY, false, false, false); - if (Main.netMode == 1) - { - NetMessage.SendData(0x11, -1, -1, "", 0, (float) tileTargetX, (float) tileTargetY, 0f); - } - } - } - else - { - WorldGen.KillTile(tileTargetX, tileTargetY, true, false, false); - if (Main.netMode == 1) - { - NetMessage.SendData(0x11, -1, -1, "", 0, (float) tileTargetX, (float) tileTargetY, 1f); - } - } - this.itemTime = this.inventory[this.selectedItem].useTime; - } - } - else if (((Main.tile[tileTargetX, tileTargetY].type == 5) || (Main.tile[tileTargetX, tileTargetY].type == 30)) || (Main.tile[tileTargetX, tileTargetY].type == 0x48)) - { - if (Main.tile[tileTargetX, tileTargetY].type == 30) - { - this.hitTile += this.inventory[this.selectedItem].axe * 5; - } - else - { - this.hitTile += this.inventory[this.selectedItem].axe; - } - if (this.inventory[this.selectedItem].axe > 0) - { - if (this.hitTile >= 100) - { - this.hitTile = 0; - WorldGen.KillTile(tileTargetX, tileTargetY, false, false, false); - if (Main.netMode == 1) - { - NetMessage.SendData(0x11, -1, -1, "", 0, (float) tileTargetX, (float) tileTargetY, 0f); - } - } - else - { - WorldGen.KillTile(tileTargetX, tileTargetY, true, false, false); - if (Main.netMode == 1) - { - NetMessage.SendData(0x11, -1, -1, "", 0, (float) tileTargetX, (float) tileTargetY, 1f); - } - } - this.itemTime = this.inventory[this.selectedItem].useTime; - } - } - else if (this.inventory[this.selectedItem].pick > 0) - { - if ((Main.tileDungeon[Main.tile[tileTargetX, tileTargetY].type] || (Main.tile[tileTargetX, tileTargetY].type == 0x25)) || ((Main.tile[tileTargetX, tileTargetY].type == 0x19) || (Main.tile[tileTargetX, tileTargetY].type == 0x3a))) - { - this.hitTile += this.inventory[this.selectedItem].pick / 2; - } - else - { - this.hitTile += this.inventory[this.selectedItem].pick; - } - if ((Main.tile[tileTargetX, tileTargetY].type == 0x19) && (this.inventory[this.selectedItem].pick < 0x41)) - { - this.hitTile = 0; - } - else if ((Main.tile[tileTargetX, tileTargetY].type == 0x25) && (this.inventory[this.selectedItem].pick < 0x37)) - { - this.hitTile = 0; - } - else if ((Main.tile[tileTargetX, tileTargetY].type == 0x38) && (this.inventory[this.selectedItem].pick < 0x41)) - { - this.hitTile = 0; - } - else if ((Main.tile[tileTargetX, tileTargetY].type == 0x3a) && (this.inventory[this.selectedItem].pick < 0x41)) - { - this.hitTile = 0; - } - if (((Main.tile[tileTargetX, tileTargetY].type == 0) || (Main.tile[tileTargetX, tileTargetY].type == 40)) || ((Main.tile[tileTargetX, tileTargetY].type == 0x35) || (Main.tile[tileTargetX, tileTargetY].type == 0x3b))) - { - this.hitTile += this.inventory[this.selectedItem].pick; - } - if (this.hitTile >= 100) - { - this.hitTile = 0; - WorldGen.KillTile(tileTargetX, tileTargetY, false, false, false); - if (Main.netMode == 1) - { - NetMessage.SendData(0x11, -1, -1, "", 0, (float) tileTargetX, (float) tileTargetY, 0f); - } - } - else - { - WorldGen.KillTile(tileTargetX, tileTargetY, true, false, false); - if (Main.netMode == 1) - { - NetMessage.SendData(0x11, -1, -1, "", 0, (float) tileTargetX, (float) tileTargetY, 1f); - } - } - this.itemTime = this.inventory[this.selectedItem].useTime; - } - } - } - if ((((Main.tile[tileTargetX, tileTargetY].wall > 0) && (this.itemTime == 0)) && ((this.itemAnimation > 0) && this.controlUseItem)) && (this.inventory[this.selectedItem].hammer > 0)) - { - bool flag5 = true; - if (!Main.wallHouse[Main.tile[tileTargetX, tileTargetY].wall]) - { - flag5 = false; - for (int num29 = tileTargetX - 1; num29 < (tileTargetX + 2); num29++) - { - for (int num30 = tileTargetY - 1; num30 < (tileTargetY + 2); num30++) - { - if (Main.tile[num29, num30].wall != Main.tile[tileTargetX, tileTargetY].wall) - { - flag5 = true; - break; - } - } - } - } - if (flag5) - { - if ((this.hitTileX != tileTargetX) || (this.hitTileY != tileTargetY)) - { - this.hitTile = 0; - this.hitTileX = tileTargetX; - this.hitTileY = tileTargetY; - } - this.hitTile += this.inventory[this.selectedItem].hammer; - if (this.hitTile >= 100) - { - this.hitTile = 0; - WorldGen.KillWall(tileTargetX, tileTargetY, false); - if (Main.netMode == 1) - { - NetMessage.SendData(0x11, -1, -1, "", 2, (float) tileTargetX, (float) tileTargetY, 0f); - } - } - else - { - WorldGen.KillWall(tileTargetX, tileTargetY, true); - if (Main.netMode == 1) - { - NetMessage.SendData(0x11, -1, -1, "", 2, (float) tileTargetX, (float) tileTargetY, 1f); - } - } - this.itemTime = this.inventory[this.selectedItem].useTime; - } - } - } - if (((this.inventory[this.selectedItem].type == 0x1d) && (this.itemAnimation > 0)) && ((this.statLifeMax < 400) && (this.itemTime == 0))) - { - this.itemTime = this.inventory[this.selectedItem].useTime; - this.statLifeMax += 20; - this.statLife += 20; - if (Main.myPlayer == this.whoAmi) - { - this.HealEffect(20); - } - } - if (((this.inventory[this.selectedItem].type == 0x6d) && (this.itemAnimation > 0)) && ((this.statManaMax < 200) && (this.itemTime == 0))) - { - this.itemTime = this.inventory[this.selectedItem].useTime; - this.statManaMax += 20; - this.statMana += 20; - if (Main.myPlayer == this.whoAmi) - { - this.ManaEffect(20); - } - } - if ((((this.inventory[this.selectedItem].createTile >= 0) && ((((this.position.X / 16f) - tileRangeX) - this.inventory[this.selectedItem].tileBoost) <= tileTargetX)) && (((((((this.position.X + this.width) / 16f) + tileRangeX) + this.inventory[this.selectedItem].tileBoost) - 1f) >= tileTargetX) && ((((this.position.Y / 16f) - tileRangeY) - this.inventory[this.selectedItem].tileBoost) <= tileTargetY))) && ((((((this.position.Y + this.height) / 16f) + tileRangeY) + this.inventory[this.selectedItem].tileBoost) - 2f) >= tileTargetY)) - { - this.showItemIcon = true; - if (((!Main.tile[tileTargetX, tileTargetY].active || (this.inventory[this.selectedItem].createTile == 0x17)) || (((this.inventory[this.selectedItem].createTile == 2) || (this.inventory[this.selectedItem].createTile == 60)) || (this.inventory[this.selectedItem].createTile == 70))) && (((this.itemTime == 0) && (this.itemAnimation > 0)) && this.controlUseItem)) - { - bool flag6 = false; - if ((this.inventory[this.selectedItem].createTile == 0x17) || (this.inventory[this.selectedItem].createTile == 2)) - { - if (Main.tile[tileTargetX, tileTargetY].active && (Main.tile[tileTargetX, tileTargetY].type == 0)) - { - flag6 = true; - } - } - else if ((this.inventory[this.selectedItem].createTile == 60) || (this.inventory[this.selectedItem].createTile == 70)) - { - if (Main.tile[tileTargetX, tileTargetY].active && (Main.tile[tileTargetX, tileTargetY].type == 0x3b)) - { - flag6 = true; - } - } - else if (this.inventory[this.selectedItem].createTile == 4) - { - int type = Main.tile[tileTargetX, tileTargetY + 1].type; - int index = Main.tile[tileTargetX - 1, tileTargetY].type; - int num33 = Main.tile[tileTargetX + 1, tileTargetY].type; - int num34 = Main.tile[tileTargetX - 1, tileTargetY - 1].type; - int num35 = Main.tile[tileTargetX + 1, tileTargetY - 1].type; - int num36 = Main.tile[tileTargetX - 1, tileTargetY - 1].type; - int num37 = Main.tile[tileTargetX + 1, tileTargetY + 1].type; - if (!Main.tile[tileTargetX, tileTargetY + 1].active) - { - type = -1; - } - if (!Main.tile[tileTargetX - 1, tileTargetY].active) - { - index = -1; - } - if (!Main.tile[tileTargetX + 1, tileTargetY].active) - { - num33 = -1; - } - if (!Main.tile[tileTargetX - 1, tileTargetY - 1].active) - { - num34 = -1; - } - if (!Main.tile[tileTargetX + 1, tileTargetY - 1].active) - { - num35 = -1; - } - if (!Main.tile[tileTargetX - 1, tileTargetY + 1].active) - { - num36 = -1; - } - if (!Main.tile[tileTargetX + 1, tileTargetY + 1].active) - { - num37 = -1; - } - if (((type >= 0) && Main.tileSolid[type]) && !Main.tileNoAttach[type]) - { - flag6 = true; - } - else if ((((index >= 0) && Main.tileSolid[index]) && !Main.tileNoAttach[index]) || (((index == 5) && (num34 == 5)) && (num36 == 5))) - { - flag6 = true; - } - else if ((((num33 >= 0) && Main.tileSolid[num33]) && !Main.tileNoAttach[num33]) || (((num33 == 5) && (num35 == 5)) && (num37 == 5))) - { - flag6 = true; - } - } - else if (this.inventory[this.selectedItem].createTile == 0x4e) - { - if (Main.tile[tileTargetX, tileTargetY + 1].active && (Main.tileSolid[Main.tile[tileTargetX, tileTargetY + 1].type] || Main.tileTable[Main.tile[tileTargetX, tileTargetY + 1].type])) - { - flag6 = true; - } - } - else if (((this.inventory[this.selectedItem].createTile == 13) || (this.inventory[this.selectedItem].createTile == 0x1d)) || ((this.inventory[this.selectedItem].createTile == 0x21) || (this.inventory[this.selectedItem].createTile == 0x31))) - { - if (Main.tile[tileTargetX, tileTargetY + 1].active && Main.tileTable[Main.tile[tileTargetX, tileTargetY + 1].type]) - { - flag6 = true; - } - } - else if (this.inventory[this.selectedItem].createTile == 0x33) - { - if (((Main.tile[tileTargetX + 1, tileTargetY].active || (Main.tile[tileTargetX + 1, tileTargetY].wall > 0)) || (Main.tile[tileTargetX - 1, tileTargetY].active || (Main.tile[tileTargetX - 1, tileTargetY].wall > 0))) || ((Main.tile[tileTargetX, tileTargetY + 1].active || (Main.tile[tileTargetX, tileTargetY + 1].wall > 0)) || (Main.tile[tileTargetX, tileTargetY - 1].active || (Main.tile[tileTargetX, tileTargetY - 1].wall > 0)))) - { - flag6 = true; - } - } - else if (((Main.tile[tileTargetX + 1, tileTargetY].active && Main.tileSolid[Main.tile[tileTargetX + 1, tileTargetY].type]) || ((Main.tile[tileTargetX + 1, tileTargetY].wall > 0) || (Main.tile[tileTargetX - 1, tileTargetY].active && Main.tileSolid[Main.tile[tileTargetX - 1, tileTargetY].type]))) || ((((Main.tile[tileTargetX - 1, tileTargetY].wall > 0) || (Main.tile[tileTargetX, tileTargetY + 1].active && Main.tileSolid[Main.tile[tileTargetX, tileTargetY + 1].type])) || ((Main.tile[tileTargetX, tileTargetY + 1].wall > 0) || (Main.tile[tileTargetX, tileTargetY - 1].active && Main.tileSolid[Main.tile[tileTargetX, tileTargetY - 1].type]))) || (Main.tile[tileTargetX, tileTargetY - 1].wall > 0))) - { - flag6 = true; - } - if (flag6 && WorldGen.PlaceTile(tileTargetX, tileTargetY, this.inventory[this.selectedItem].createTile, false, false, this.whoAmi)) - { - this.itemTime = this.inventory[this.selectedItem].useTime; - if (Main.netMode == 1) - { - NetMessage.SendData(0x11, -1, -1, "", 1, (float) tileTargetX, (float) tileTargetY, (float) this.inventory[this.selectedItem].createTile); - } - if (this.inventory[this.selectedItem].createTile == 15) - { - if (this.direction == 1) - { - Tile tile2 = Main.tile[tileTargetX, tileTargetY]; - tile2.frameX = (short) (tile2.frameX + 0x12); - Tile tile3 = Main.tile[tileTargetX, tileTargetY - 1]; - tile3.frameX = (short) (tile3.frameX + 0x12); - } - if (Main.netMode == 1) - { - NetMessage.SendTileSquare(-1, tileTargetX - 1, tileTargetY - 1, 3); - } - } - else if ((this.inventory[this.selectedItem].createTile == 0x4f) && (Main.netMode == 1)) - { - NetMessage.SendTileSquare(-1, tileTargetX, tileTargetY, 5); - } - } - } - } - if (this.inventory[this.selectedItem].createWall >= 0) - { - tileTargetX = (int) ((Main.mouseState.X + Main.screenPosition.X) / 16f); - tileTargetY = (int) ((Main.mouseState.Y + Main.screenPosition.Y) / 16f); - if ((((((this.position.X / 16f) - tileRangeX) - this.inventory[this.selectedItem].tileBoost) <= tileTargetX) && ((((((this.position.X + this.width) / 16f) + tileRangeX) + this.inventory[this.selectedItem].tileBoost) - 1f) >= tileTargetX)) && (((((this.position.Y / 16f) - tileRangeY) - this.inventory[this.selectedItem].tileBoost) <= tileTargetY) && ((((((this.position.Y + this.height) / 16f) + tileRangeY) + this.inventory[this.selectedItem].tileBoost) - 2f) >= tileTargetY))) - { - this.showItemIcon = true; - if (((((this.itemTime == 0) && (this.itemAnimation > 0)) && this.controlUseItem) && (((Main.tile[tileTargetX + 1, tileTargetY].active || (Main.tile[tileTargetX + 1, tileTargetY].wall > 0)) || (Main.tile[tileTargetX - 1, tileTargetY].active || (Main.tile[tileTargetX - 1, tileTargetY].wall > 0))) || ((Main.tile[tileTargetX, tileTargetY + 1].active || (Main.tile[tileTargetX, tileTargetY + 1].wall > 0)) || (Main.tile[tileTargetX, tileTargetY - 1].active || (Main.tile[tileTargetX, tileTargetY - 1].wall > 0))))) && (Main.tile[tileTargetX, tileTargetY].wall != this.inventory[this.selectedItem].createWall)) - { - WorldGen.PlaceWall(tileTargetX, tileTargetY, this.inventory[this.selectedItem].createWall, false); - if (Main.tile[tileTargetX, tileTargetY].wall == this.inventory[this.selectedItem].createWall) - { - this.itemTime = this.inventory[this.selectedItem].useTime; - if (Main.netMode == 1) - { - NetMessage.SendData(0x11, -1, -1, "", 3, (float) tileTargetX, (float) tileTargetY, (float) this.inventory[this.selectedItem].createWall); - } - } - } - } - } - } - if (((this.inventory[this.selectedItem].damage >= 0) && (this.inventory[this.selectedItem].type > 0)) && (!this.inventory[this.selectedItem].noMelee && (this.itemAnimation > 0))) - { - Rectangle rectangle = new Rectangle(); - bool flag7 = false; - rectangle = new Rectangle((int) this.itemLocation.X, (int) this.itemLocation.Y, Main.itemTexture[this.inventory[this.selectedItem].type].Width, Main.itemTexture[this.inventory[this.selectedItem].type].Height) { - Width = (int) (rectangle.Width * this.inventory[this.selectedItem].scale), - Height = (int) (rectangle.Height * this.inventory[this.selectedItem].scale) - }; - if (this.direction == -1) - { - rectangle.X -= rectangle.Width; - } - rectangle.Y -= rectangle.Height; - if (this.inventory[this.selectedItem].useStyle == 1) - { - if (this.itemAnimation < (this.itemAnimationMax * 0.333)) - { - if (this.direction == -1) - { - rectangle.X -= ((int) (rectangle.Width * 1.4)) - rectangle.Width; - } - rectangle.Width = (int) (rectangle.Width * 1.4); - rectangle.Y += (int) (rectangle.Height * 0.5); - rectangle.Height = (int) (rectangle.Height * 1.1); - } - else if (this.itemAnimation >= (this.itemAnimationMax * 0.666)) - { - if (this.direction == 1) - { - rectangle.X -= (int) (rectangle.Width * 1.2); - } - rectangle.Width *= 2; - rectangle.Y -= ((int) (rectangle.Height * 1.4)) - rectangle.Height; - rectangle.Height = (int) (rectangle.Height * 1.4); - } - } - else if (this.inventory[this.selectedItem].useStyle == 3) - { - if (this.itemAnimation > (this.itemAnimationMax * 0.666)) - { - flag7 = true; - } - else - { - if (this.direction == -1) - { - rectangle.X -= ((int) (rectangle.Width * 1.4)) - rectangle.Width; - } - rectangle.Width = (int) (rectangle.Width * 1.4); - rectangle.Y += (int) (rectangle.Height * 0.6); - rectangle.Height = (int) (rectangle.Height * 0.6); - } - } - if (!flag7) - { - if ((((this.inventory[this.selectedItem].type == 0x2c) || (this.inventory[this.selectedItem].type == 0x2d)) || (((this.inventory[this.selectedItem].type == 0x2e) || (this.inventory[this.selectedItem].type == 0x67)) || (this.inventory[this.selectedItem].type == 0x68))) && (Main.rand.Next(15) == 0)) - { - color = new Color(); - Dust.NewDust(new Vector2((float) rectangle.X, (float) rectangle.Y), rectangle.Width, rectangle.Height, 14, (float) (this.direction * 2), 0f, 150, color, 1.3f); - } - if (this.inventory[this.selectedItem].type == 0x41) - { - if (Main.rand.Next(5) == 0) - { - color = new Color(); - Dust.NewDust(new Vector2((float) rectangle.X, (float) rectangle.Y), rectangle.Width, rectangle.Height, 15, 0f, 0f, 150, color, 1.2f); - } - if (Main.rand.Next(10) == 0) - { - Gore.NewGore(new Vector2((float) rectangle.X, (float) rectangle.Y), new Vector2(), Main.rand.Next(0x10, 0x12)); - } - } - if ((this.inventory[this.selectedItem].type == 190) || (this.inventory[this.selectedItem].type == 0xd5)) - { - color = new Color(); - int num38 = Dust.NewDust(new Vector2((float) rectangle.X, (float) rectangle.Y), rectangle.Width, rectangle.Height, 40, (this.velocity.X * 0.2f) + (this.direction * 3), this.velocity.Y * 0.2f, 0, color, 1.2f); - Main.dust[num38].noGravity = true; - } - if (this.inventory[this.selectedItem].type == 0x79) - { - for (int num39 = 0; num39 < 2; num39++) - { - color = new Color(); - int num40 = Dust.NewDust(new Vector2((float) rectangle.X, (float) rectangle.Y), rectangle.Width, rectangle.Height, 6, (this.velocity.X * 0.2f) + (this.direction * 3), this.velocity.Y * 0.2f, 100, color, 2.5f); - Main.dust[num40].noGravity = true; - Main.dust[num40].velocity.X *= 2f; - Main.dust[num40].velocity.Y *= 2f; - } - } - if ((this.inventory[this.selectedItem].type == 0x7a) || (this.inventory[this.selectedItem].type == 0xd9)) - { - color = new Color(); - int num41 = Dust.NewDust(new Vector2((float) rectangle.X, (float) rectangle.Y), rectangle.Width, rectangle.Height, 6, (this.velocity.X * 0.2f) + (this.direction * 3), this.velocity.Y * 0.2f, 100, color, 1.9f); - Main.dust[num41].noGravity = true; - } - if (this.inventory[this.selectedItem].type == 0x9b) - { - color = new Color(); - int num42 = Dust.NewDust(new Vector2((float) rectangle.X, (float) rectangle.Y), rectangle.Width, rectangle.Height, 0x1d, (this.velocity.X * 0.2f) + (this.direction * 3), this.velocity.Y * 0.2f, 100, color, 2f); - Main.dust[num42].noGravity = true; - Main.dust[num42].velocity.X /= 2f; - Main.dust[num42].velocity.Y /= 2f; - } - if ((this.inventory[this.selectedItem].type >= 0xc6) && (this.inventory[this.selectedItem].type <= 0xcb)) - { - Lighting.addLight((int) (((this.itemLocation.X + 6f) + this.velocity.X) / 16f), (int) ((this.itemLocation.Y - 14f) / 16f), 0.5f); - } - if (Main.myPlayer == i) - { - int num43 = rectangle.X / 0x10; - int num44 = ((rectangle.X + rectangle.Width) / 0x10) + 1; - int num45 = rectangle.Y / 0x10; - int num46 = ((rectangle.Y + rectangle.Height) / 0x10) + 1; - for (int num47 = num43; num47 < num44; num47++) - { - for (int num48 = num45; num48 < num46; num48++) - { - if (((((Main.tile[num47, num48].type == 3) || (Main.tile[num47, num48].type == 0x18)) || ((Main.tile[num47, num48].type == 0x1c) || (Main.tile[num47, num48].type == 0x20))) || (((Main.tile[num47, num48].type == 0x33) || (Main.tile[num47, num48].type == 0x34)) || ((Main.tile[num47, num48].type == 0x3d) || (Main.tile[num47, num48].type == 0x3e)))) || (((Main.tile[num47, num48].type == 0x45) || (Main.tile[num47, num48].type == 0x47)) || ((Main.tile[num47, num48].type == 0x49) || (Main.tile[num47, num48].type == 0x4a)))) - { - WorldGen.KillTile(num47, num48, false, false, false); - if (Main.netMode == 1) - { - NetMessage.SendData(0x11, -1, -1, "", 0, (float) num47, (float) num48, 0f); - } - } - } - } - for (int num49 = 0; num49 < 0x3e8; num49++) - { - if ((Main.npc[num49].active && (Main.npc[num49].immune[i] == 0)) && ((this.attackCD == 0) && !Main.npc[num49].friendly)) - { - Rectangle rectangle2 = new Rectangle((int) Main.npc[num49].position.X, (int) Main.npc[num49].position.Y, Main.npc[num49].width, Main.npc[num49].height); - if (rectangle.Intersects(rectangle2) && (Main.npc[num49].noTileCollide || Collision.CanHit(this.position, this.width, this.height, Main.npc[num49].position, Main.npc[num49].width, Main.npc[num49].height))) - { - Main.npc[num49].StrikeNPC(this.inventory[this.selectedItem].damage, this.inventory[this.selectedItem].knockBack, this.direction); - if (Main.netMode == 1) - { - NetMessage.SendData(0x18, -1, -1, "", num49, (float) i, 0f, 0f); - } - Main.npc[num49].immune[i] = this.itemAnimation; - this.attackCD = (int) (this.itemAnimationMax * 0.33); - } - } - } - if (this.hostile) - { - for (int num50 = 0; num50 < 8; num50++) - { - if ((((num50 != i) && Main.player[num50].active) && (Main.player[num50].hostile && !Main.player[num50].immune)) && (!Main.player[num50].dead && ((Main.player[i].team == 0) || (Main.player[i].team != Main.player[num50].team)))) - { - Rectangle rectangle3 = new Rectangle((int) Main.player[num50].position.X, (int) Main.player[num50].position.Y, Main.player[num50].width, Main.player[num50].height); - if (rectangle.Intersects(rectangle3) && Collision.CanHit(this.position, this.width, this.height, Main.player[num50].position, Main.player[num50].width, Main.player[num50].height)) - { - Main.player[num50].Hurt(this.inventory[this.selectedItem].damage, this.direction, true, false); - if (Main.netMode != 0) - { - NetMessage.SendData(0x1a, -1, -1, "", num50, (float) this.direction, (float) this.inventory[this.selectedItem].damage, 1f); - } - this.attackCD = (int) (this.itemAnimationMax * 0.33); - } - } - } - } - } - } - } - if ((this.itemTime == 0) && (this.itemAnimation > 0)) - { - if (this.inventory[this.selectedItem].healLife > 0) - { - this.statLife += this.inventory[this.selectedItem].healLife; - this.itemTime = this.inventory[this.selectedItem].useTime; - if (Main.myPlayer == this.whoAmi) - { - this.HealEffect(this.inventory[this.selectedItem].healLife); - } - } - if (this.inventory[this.selectedItem].healMana > 0) - { - this.statMana += this.inventory[this.selectedItem].healMana; - this.itemTime = this.inventory[this.selectedItem].useTime; - if (Main.myPlayer == this.whoAmi) - { - this.ManaEffect(this.inventory[this.selectedItem].healMana); - } - } - } - if (((this.itemTime == 0) && (this.itemAnimation > 0)) && ((this.inventory[this.selectedItem].type == 0x2b) || (this.inventory[this.selectedItem].type == 70))) - { - this.itemTime = this.inventory[this.selectedItem].useTime; - bool flag8 = false; - int num51 = 4; - if (this.inventory[this.selectedItem].type == 0x2b) - { - num51 = 4; - } - else if (this.inventory[this.selectedItem].type == 70) - { - num51 = 13; - } - for (int num52 = 0; num52 < 0x3e8; num52++) - { - if (Main.npc[num52].active && (Main.npc[num52].type == num51)) - { - flag8 = true; - break; - } - } - if (flag8) - { - if (Main.myPlayer == this.whoAmi) - { - this.Hurt(this.statLife * (this.statDefense + 1), -this.direction, false, false); - } - } - else if (this.inventory[this.selectedItem].type == 0x2b) - { - if (!Main.dayTime) - { - Main.PlaySound(15, (int) this.position.X, (int) this.position.Y, 0); - if (Main.netMode != 1) - { - NPC.SpawnOnPlayer(i, 4); - } - } - } - else if ((this.inventory[this.selectedItem].type == 70) && this.zoneEvil) - { - Main.PlaySound(15, (int) this.position.X, (int) this.position.Y, 0); - if (Main.netMode != 1) - { - NPC.SpawnOnPlayer(i, 13); - } - } - } - if ((this.inventory[this.selectedItem].type == 50) && (this.itemAnimation > 0)) - { - if (Main.rand.Next(2) == 0) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 15, 0f, 0f, 150, color, 1.1f); - } - if (this.itemTime == 0) - { - this.itemTime = this.inventory[this.selectedItem].useTime; - } - else if (this.itemTime == (this.inventory[this.selectedItem].useTime / 2)) - { - for (int num53 = 0; num53 < 70; num53++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 15, this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 150, color, 1.5f); - } - this.grappling[0] = -1; - this.grapCount = 0; - for (int num54 = 0; num54 < 0x3e8; num54++) - { - if ((Main.projectile[num54].active && (Main.projectile[num54].owner == i)) && (Main.projectile[num54].aiStyle == 7)) - { - Main.projectile[num54].Kill(); - } - } - this.Spawn(); - for (int num55 = 0; num55 < 70; num55++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 15, 0f, 0f, 150, color, 1.5f); - } - } - } - if (i == Main.myPlayer) - { - if ((this.itemTime == this.inventory[this.selectedItem].useTime) && this.inventory[this.selectedItem].consumable) - { - Item item2 = this.inventory[this.selectedItem]; - item2.stack--; - if (this.inventory[this.selectedItem].stack <= 0) - { - this.itemTime = this.itemAnimation; - } - } - if ((this.inventory[this.selectedItem].stack <= 0) && (this.itemAnimation == 0)) - { - this.inventory[this.selectedItem] = new Item(); - } - } - } - - public bool ItemSpace(Item newItem) - { - if (newItem.type == 0x3a) - { - return true; - } - if (newItem.type == 0xb8) - { - return true; - } - int num = 40; - if (((newItem.type == 0x47) || (newItem.type == 0x48)) || ((newItem.type == 0x49) || (newItem.type == 0x4a))) - { - num = 0x2c; - } - for (int i = 0; i < num; i++) - { - if (this.inventory[i].type == 0) - { - return true; - } - } - for (int j = 0; j < num; j++) - { - if (((this.inventory[j].type > 0) && (this.inventory[j].stack < this.inventory[j].maxStack)) && newItem.IsTheSameAs(this.inventory[j])) - { - return true; - } - } - return false; - } - - public void KillMe(double dmg, int hitDirection, bool pvp = false) - { - if ((!Main.godMode || (Main.myPlayer != this.whoAmi)) && !this.dead) - { - if (pvp) - { - this.pvpDeath = true; - } - Main.PlaySound(5, (int) this.position.X, (int) this.position.Y, 1); - this.headVelocity.Y = Main.rand.Next(-40, -10) * 0.1f; - this.bodyVelocity.Y = Main.rand.Next(-40, -10) * 0.1f; - this.legVelocity.Y = Main.rand.Next(-40, -10) * 0.1f; - this.headVelocity.X = (Main.rand.Next(-20, 0x15) * 0.1f) + (2 * hitDirection); - this.bodyVelocity.X = (Main.rand.Next(-20, 0x15) * 0.1f) + (2 * hitDirection); - this.legVelocity.X = (Main.rand.Next(-20, 0x15) * 0.1f) + (2 * hitDirection); - for (int i = 0; i < (20.0 + ((dmg / ((double) this.statLifeMax)) * 100.0)); i++) - { - if (this.boneArmor) - { - Color newColor = new Color(); - Dust.NewDust(this.position, this.width, this.height, 0x1a, (float) (2 * hitDirection), -2f, 0, newColor, 1f); - } - else - { - Color color2 = new Color(); - Dust.NewDust(this.position, this.width, this.height, 5, (float) (2 * hitDirection), -2f, 0, color2, 1f); - } - } - this.dead = true; - this.respawnTimer = 600; - this.immuneAlpha = 0; - if (Main.netMode == 2) - { - NetMessage.SendData(0x19, -1, -1, this.name + " was slain...", 8, 225f, 25f, 25f); - } - if (this.whoAmi == Main.myPlayer) - { - WorldGen.saveToonWhilePlaying(); - } - if ((Main.netMode == 1) && (this.whoAmi == Main.myPlayer)) - { - int num2 = 0; - if (pvp) - { - num2 = 1; - } - NetMessage.SendData(0x2c, -1, -1, "", this.whoAmi, (float) hitDirection, (float) ((int) dmg), (float) num2); - } - if (!pvp && (this.whoAmi == Main.myPlayer)) - { - this.DropItems(); - } - } - } - - public static Player LoadPlayer(string playerPath) - { - bool flag = false; - if (Main.rand == null) - { - Main.rand = new Random((int) DateTime.Now.Ticks); - } - Player player = new Player(); - try - { - string outputFile = playerPath + ".dat"; - flag = DecryptFile(playerPath, outputFile); - if (!flag) - { - using (FileStream stream = new FileStream(outputFile, FileMode.Open)) - { - using (BinaryReader reader = new BinaryReader(stream)) - { - reader.ReadInt32(); - player.name = reader.ReadString(); - player.hair = reader.ReadInt32(); - player.statLife = reader.ReadInt32(); - player.statLifeMax = reader.ReadInt32(); - if (player.statLife > player.statLifeMax) - { - player.statLife = player.statLifeMax; - } - player.statMana = reader.ReadInt32(); - player.statManaMax = reader.ReadInt32(); - if (player.statMana > player.statManaMax) - { - player.statMana = player.statManaMax; - } - player.hairColor.R = reader.ReadByte(); - player.hairColor.G = reader.ReadByte(); - player.hairColor.B = reader.ReadByte(); - player.skinColor.R = reader.ReadByte(); - player.skinColor.G = reader.ReadByte(); - player.skinColor.B = reader.ReadByte(); - player.eyeColor.R = reader.ReadByte(); - player.eyeColor.G = reader.ReadByte(); - player.eyeColor.B = reader.ReadByte(); - player.shirtColor.R = reader.ReadByte(); - player.shirtColor.G = reader.ReadByte(); - player.shirtColor.B = reader.ReadByte(); - player.underShirtColor.R = reader.ReadByte(); - player.underShirtColor.G = reader.ReadByte(); - player.underShirtColor.B = reader.ReadByte(); - player.pantsColor.R = reader.ReadByte(); - player.pantsColor.G = reader.ReadByte(); - player.pantsColor.B = reader.ReadByte(); - player.shoeColor.R = reader.ReadByte(); - player.shoeColor.G = reader.ReadByte(); - player.shoeColor.B = reader.ReadByte(); - for (int i = 0; i < 8; i++) - { - player.armor[i].SetDefaults(reader.ReadString()); - } - for (int j = 0; j < 0x2c; j++) - { - player.inventory[j].SetDefaults(reader.ReadString()); - player.inventory[j].stack = reader.ReadInt32(); - } - for (int k = 0; k < Chest.maxItems; k++) - { - player.bank[k].SetDefaults(reader.ReadString()); - player.bank[k].stack = reader.ReadInt32(); - } - for (int m = 0; m < 200; m++) - { - int num5 = reader.ReadInt32(); - if (num5 == -1) - { - break; - } - player.spX[m] = num5; - player.spY[m] = reader.ReadInt32(); - player.spI[m] = reader.ReadInt32(); - player.spN[m] = reader.ReadString(); - } - reader.Close(); - } - } - player.PlayerFrame(); - File.Delete(outputFile); - return player; - } - } - catch - { - flag = true; - } - if (flag) - { - string path = playerPath + ".bak"; - if (File.Exists(path)) - { - File.Delete(playerPath); - File.Move(path, playerPath); - return LoadPlayer(playerPath); - } - } - return new Player(); - } - - public void ManaEffect(int manaAmount) - { - CombatText.NewText(new Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height), new Color(180, 50, 0xff, 0xff), manaAmount.ToString()); - if ((Main.netMode == 1) && (this.whoAmi == Main.myPlayer)) - { - NetMessage.SendData(0x2b, -1, -1, "", this.whoAmi, (float) manaAmount, 0f, 0f); - } - } - - public void PlayerFrame() - { - if (this.swimTime > 0) - { - this.swimTime--; - if (!this.wet) - { - this.swimTime = 0; - } - } - this.head = this.armor[0].headSlot; - this.body = this.armor[1].bodySlot; - this.legs = this.armor[2].legSlot; - this.bodyFrame.Width = 40; - this.bodyFrame.Height = 0x38; - this.legFrame.Width = 40; - this.legFrame.Height = 0x38; - this.bodyFrame.X = 0; - this.legFrame.X = 0; - if ((this.itemAnimation > 0) && (this.inventory[this.selectedItem].useStyle != 10)) - { - if ((this.inventory[this.selectedItem].useStyle == 1) || (this.inventory[this.selectedItem].type == 0)) - { - if (this.itemAnimation < (this.itemAnimationMax * 0.333)) - { - this.bodyFrame.Y = this.bodyFrame.Height * 3; - } - else if (this.itemAnimation < (this.itemAnimationMax * 0.666)) - { - this.bodyFrame.Y = this.bodyFrame.Height * 2; - } - else - { - this.bodyFrame.Y = this.bodyFrame.Height; - } - } - else if (this.inventory[this.selectedItem].useStyle == 2) - { - if (this.itemAnimation < (this.itemAnimationMax * 0.5)) - { - this.bodyFrame.Y = this.bodyFrame.Height * 4; - } - else - { - this.bodyFrame.Y = this.bodyFrame.Height * 5; - } - } - else if (this.inventory[this.selectedItem].useStyle == 3) - { - if (this.itemAnimation > (this.itemAnimationMax * 0.666)) - { - this.bodyFrame.Y = this.bodyFrame.Height * 3; - } - else - { - this.bodyFrame.Y = this.bodyFrame.Height * 3; - } - } - else if (this.inventory[this.selectedItem].useStyle == 4) - { - this.bodyFrame.Y = this.bodyFrame.Height * 2; - } - else if (this.inventory[this.selectedItem].useStyle == 5) - { - float num = this.itemRotation * this.direction; - this.bodyFrame.Y = this.bodyFrame.Height * 3; - if (num < -0.75) - { - this.bodyFrame.Y = this.bodyFrame.Height * 2; - } - if (num > 0.6) - { - this.bodyFrame.Y = this.bodyFrame.Height * 4; - } - } - } - else if (this.inventory[this.selectedItem].holdStyle == 1) - { - this.bodyFrame.Y = this.bodyFrame.Height * 3; - } - else if (this.inventory[this.selectedItem].holdStyle == 2) - { - this.bodyFrame.Y = this.bodyFrame.Height * 2; - } - else if (this.grappling[0] >= 0) - { - Vector2 vector = new Vector2(this.position.X + (this.width * 0.5f), this.position.Y + (this.height * 0.5f)); - float num2 = 0f; - float num3 = 0f; - for (int i = 0; i < this.grapCount; i++) - { - num2 += Main.projectile[this.grappling[i]].position.X + (Main.projectile[this.grappling[i]].width / 2); - num3 += Main.projectile[this.grappling[i]].position.Y + (Main.projectile[this.grappling[i]].height / 2); - } - num2 /= (float) this.grapCount; - num3 /= (float) this.grapCount; - num2 -= vector.X; - num3 -= vector.Y; - if ((num3 < 0f) && (Math.Abs(num3) > Math.Abs(num2))) - { - this.bodyFrame.Y = this.bodyFrame.Height * 2; - } - else if ((num3 > 0f) && (Math.Abs(num3) > Math.Abs(num2))) - { - this.bodyFrame.Y = this.bodyFrame.Height * 4; - } - else - { - this.bodyFrame.Y = this.bodyFrame.Height * 3; - } - } - else if (this.swimTime > 0) - { - if (this.swimTime > 20) - { - this.bodyFrame.Y = 0; - } - else if (this.swimTime > 10) - { - this.bodyFrame.Y = this.bodyFrame.Height * 5; - } - else - { - this.bodyFrame.Y = 0; - } - } - else if (this.velocity.Y != 0f) - { - this.bodyFrameCounter = 0.0; - this.bodyFrame.Y = this.bodyFrame.Height * 5; - } - else if (this.velocity.X != 0f) - { - this.bodyFrameCounter += Math.Abs(this.velocity.X) * 1.5; - this.bodyFrame.Y = this.legFrame.Y; - } - else - { - this.bodyFrameCounter = 0.0; - this.bodyFrame.Y = 0; - } - if (this.swimTime > 0) - { - this.legFrameCounter += 2.0; - while (this.legFrameCounter > 8.0) - { - this.legFrameCounter -= 8.0; - this.legFrame.Y += this.legFrame.Height; - } - if (this.legFrame.Y < (this.legFrame.Height * 7)) - { - this.legFrame.Y = this.legFrame.Height * 0x13; - } - else if (this.legFrame.Y > (this.legFrame.Height * 0x13)) - { - this.legFrame.Y = this.legFrame.Height * 7; - } - } - else if ((this.velocity.Y != 0f) || (this.grappling[0] > -1)) - { - this.legFrameCounter = 0.0; - this.legFrame.Y = this.legFrame.Height * 5; - } - else if (this.velocity.X != 0f) - { - this.legFrameCounter += Math.Abs(this.velocity.X) * 1.3; - while (this.legFrameCounter > 8.0) - { - this.legFrameCounter -= 8.0; - this.legFrame.Y += this.legFrame.Height; - } - if (this.legFrame.Y < (this.legFrame.Height * 7)) - { - this.legFrame.Y = this.legFrame.Height * 0x13; - } - else if (this.legFrame.Y > (this.legFrame.Height * 0x13)) - { - this.legFrame.Y = this.legFrame.Height * 7; - } - } - else - { - this.legFrameCounter = 0.0; - this.legFrame.Y = 0; - } - } - - public static void SavePlayer(Player newPlayer, string playerPath) - { - try - { - Directory.CreateDirectory(Main.SavePath); - } - catch - { - } - if (playerPath != null) - { - string destFileName = playerPath + ".bak"; - if (File.Exists(playerPath)) - { - File.Copy(playerPath, destFileName, true); - } - string path = playerPath + ".dat"; - using (FileStream stream = new FileStream(path, FileMode.Create)) - { - using (BinaryWriter writer = new BinaryWriter(stream)) - { - writer.Write(Main.curRelease); - writer.Write(newPlayer.name); - writer.Write(newPlayer.hair); - writer.Write(newPlayer.statLife); - writer.Write(newPlayer.statLifeMax); - writer.Write(newPlayer.statMana); - writer.Write(newPlayer.statManaMax); - writer.Write(newPlayer.hairColor.R); - writer.Write(newPlayer.hairColor.G); - writer.Write(newPlayer.hairColor.B); - writer.Write(newPlayer.skinColor.R); - writer.Write(newPlayer.skinColor.G); - writer.Write(newPlayer.skinColor.B); - writer.Write(newPlayer.eyeColor.R); - writer.Write(newPlayer.eyeColor.G); - writer.Write(newPlayer.eyeColor.B); - writer.Write(newPlayer.shirtColor.R); - writer.Write(newPlayer.shirtColor.G); - writer.Write(newPlayer.shirtColor.B); - writer.Write(newPlayer.underShirtColor.R); - writer.Write(newPlayer.underShirtColor.G); - writer.Write(newPlayer.underShirtColor.B); - writer.Write(newPlayer.pantsColor.R); - writer.Write(newPlayer.pantsColor.G); - writer.Write(newPlayer.pantsColor.B); - writer.Write(newPlayer.shoeColor.R); - writer.Write(newPlayer.shoeColor.G); - writer.Write(newPlayer.shoeColor.B); - for (int i = 0; i < 8; i++) - { - if (newPlayer.armor[i].name == null) - { - newPlayer.armor[i].name = ""; - } - writer.Write(newPlayer.armor[i].name); - } - for (int j = 0; j < 0x2c; j++) - { - if (newPlayer.inventory[j].name == null) - { - newPlayer.inventory[j].name = ""; - } - writer.Write(newPlayer.inventory[j].name); - writer.Write(newPlayer.inventory[j].stack); - } - for (int k = 0; k < Chest.maxItems; k++) - { - if (newPlayer.bank[k].name == null) - { - newPlayer.bank[k].name = ""; - } - writer.Write(newPlayer.bank[k].name); - writer.Write(newPlayer.bank[k].stack); - } - for (int m = 0; m < 200; m++) - { - if (newPlayer.spN[m] == null) - { - writer.Write(-1); - break; - } - writer.Write(newPlayer.spX[m]); - writer.Write(newPlayer.spY[m]); - writer.Write(newPlayer.spI[m]); - writer.Write(newPlayer.spN[m]); - } - writer.Close(); - } - } - EncryptFile(path, playerPath); - File.Delete(path); - } - } - - public bool SellItem(int price) - { - if (price > 0) - { - Item[] itemArray = new Item[0x2c]; - for (int i = 0; i < 0x2c; i++) - { - itemArray[i] = new Item(); - itemArray[i] = (Item) this.inventory[i].Clone(); - } - int num2 = price / 5; - if (num2 < 1) - { - num2 = 1; - } - bool flag = false; - while ((num2 >= 0xf4240) && !flag) - { - int index = -1; - for (int k = 0x2b; k >= 0; k--) - { - if ((index == -1) && ((this.inventory[k].type == 0) || (this.inventory[k].stack == 0))) - { - index = k; - } - while (((this.inventory[k].type == 0x4a) && (this.inventory[k].stack < this.inventory[k].maxStack)) && (num2 >= 0xf4240)) - { - Item item1 = this.inventory[k]; - item1.stack++; - num2 -= 0xf4240; - this.DoCoins(k); - if ((this.inventory[k].stack == 0) && (index == -1)) - { - index = k; - } - } - } - if (num2 >= 0xf4240) - { - if (index == -1) - { - flag = true; - } - else - { - this.inventory[index].SetDefaults(0x4a); - num2 -= 0xf4240; - } - } - } - while ((num2 >= 0x2710) && !flag) - { - int num5 = -1; - for (int m = 0x2b; m >= 0; m--) - { - if ((num5 == -1) && ((this.inventory[m].type == 0) || (this.inventory[m].stack == 0))) - { - num5 = m; - } - while (((this.inventory[m].type == 0x49) && (this.inventory[m].stack < this.inventory[m].maxStack)) && (num2 >= 0x2710)) - { - Item item2 = this.inventory[m]; - item2.stack++; - num2 -= 0x2710; - this.DoCoins(m); - if ((this.inventory[m].stack == 0) && (num5 == -1)) - { - num5 = m; - } - } - } - if (num2 >= 0x2710) - { - if (num5 == -1) - { - flag = true; - } - else - { - this.inventory[num5].SetDefaults(0x49); - num2 -= 0x2710; - } - } - } - while ((num2 >= 100) && !flag) - { - int num7 = -1; - for (int n = 0x2b; n >= 0; n--) - { - if ((num7 == -1) && ((this.inventory[n].type == 0) || (this.inventory[n].stack == 0))) - { - num7 = n; - } - while (((this.inventory[n].type == 0x48) && (this.inventory[n].stack < this.inventory[n].maxStack)) && (num2 >= 100)) - { - Item item3 = this.inventory[n]; - item3.stack++; - num2 -= 100; - this.DoCoins(n); - if ((this.inventory[n].stack == 0) && (num7 == -1)) - { - num7 = n; - } - } - } - if (num2 >= 100) - { - if (num7 == -1) - { - flag = true; - } - else - { - this.inventory[num7].SetDefaults(0x48); - num2 -= 100; - } - } - } - while ((num2 >= 1) && !flag) - { - int num9 = -1; - for (int num10 = 0x2b; num10 >= 0; num10--) - { - if ((num9 == -1) && ((this.inventory[num10].type == 0) || (this.inventory[num10].stack == 0))) - { - num9 = num10; - } - while (((this.inventory[num10].type == 0x47) && (this.inventory[num10].stack < this.inventory[num10].maxStack)) && (num2 >= 1)) - { - Item item4 = this.inventory[num10]; - item4.stack++; - num2--; - this.DoCoins(num10); - if ((this.inventory[num10].stack == 0) && (num9 == -1)) - { - num9 = num10; - } - } - } - if (num2 >= 1) - { - if (num9 == -1) - { - flag = true; - } - else - { - this.inventory[num9].SetDefaults(0x47); - num2--; - } - } - } - if (!flag) - { - return true; - } - for (int j = 0; j < 0x2c; j++) - { - this.inventory[j] = (Item) itemArray[j].Clone(); - } - } - return false; - } - - public void Spawn() - { - if (this.whoAmi == Main.myPlayer) - { - this.FindSpawn(); - if (!CheckSpawn(this.SpawnX, this.SpawnY)) - { - this.SpawnX = -1; - this.SpawnY = -1; - } - } - if ((Main.netMode == 1) && (this.whoAmi == Main.myPlayer)) - { - NetMessage.SendData(12, -1, -1, "", Main.myPlayer, 0f, 0f, 0f); - Main.gameMenu = false; - } - this.headPosition = new Vector2(); - this.bodyPosition = new Vector2(); - this.legPosition = new Vector2(); - this.headRotation = 0f; - this.bodyRotation = 0f; - this.legRotation = 0f; - if (this.statLife <= 0) - { - this.statLife = 100; - this.breath = this.breathMax; - if (this.spawnMax) - { - this.statLife = this.statLifeMax; - this.statMana = this.statManaMax; - } - } - this.immune = true; - this.dead = false; - this.immuneTime = 0; - this.active = true; - if ((this.SpawnX >= 0) && (this.SpawnY >= 0)) - { - this.position.X = ((this.SpawnX * 0x10) + 8) - (this.width / 2); - this.position.Y = (this.SpawnY * 0x10) - this.height; - } - else - { - this.position.X = ((Main.spawnTileX * 0x10) + 8) - (this.width / 2); - this.position.Y = (Main.spawnTileY * 0x10) - this.height; - for (int i = Main.spawnTileX - 1; i < (Main.spawnTileX + 2); i++) - { - for (int j = Main.spawnTileY - 3; j < Main.spawnTileY; j++) - { - if (Main.tileSolid[Main.tile[i, j].type] && !Main.tileSolidTop[Main.tile[i, j].type]) - { - if (Main.tile[i, j].liquid > 0) - { - Main.tile[i, j].lava = false; - Main.tile[i, j].liquid = 0; - WorldGen.SquareTileFrame(i, j, true); - } - WorldGen.KillTile(i, j, false, false, false); - } - } - } - } - this.wet = Collision.WetCollision(this.position, this.width, this.height); - this.wetCount = 0; - this.lavaWet = false; - this.fallStart = (int) (this.position.Y / 16f); - this.velocity.X = 0f; - this.velocity.Y = 0f; - this.talkNPC = -1; - if (this.pvpDeath) - { - this.pvpDeath = false; - this.immuneTime = 300; - this.statLife = this.statLifeMax; - } - if (this.whoAmi == Main.myPlayer) - { - Lighting.lightCounter = Lighting.lightSkip + 1; - Main.screenPosition.X = (this.position.X + (this.width / 2)) - (Main.screenWidth / 2); - Main.screenPosition.Y = (this.position.Y + (this.height / 2)) - (Main.screenHeight / 2); - } - } - - public void UpdatePlayer(int i) - { - float num = 10f; - float num2 = 0.4f; - jumpHeight = 15; - jumpSpeed = 5.01f; - if (this.wet) - { - num2 = 0.2f; - num = 5f; - jumpHeight = 30; - jumpSpeed = 6.01f; - } - float num3 = 3f; - float num4 = 0.08f; - float num5 = 0.2f; - float num6 = num3; - if (this.active) - { - this.shadowCount++; - if (this.shadowCount == 1) - { - this.shadowPos[2] = this.shadowPos[1]; - } - else if (this.shadowCount == 2) - { - this.shadowPos[1] = this.shadowPos[0]; - } - else if (this.shadowCount >= 3) - { - this.shadowCount = 0; - this.shadowPos[0] = this.position; - } - this.whoAmi = i; - if (this.runSoundDelay > 0) - { - this.runSoundDelay--; - } - if (this.attackCD > 0) - { - this.attackCD--; - } - if (this.itemAnimation == 0) - { - this.attackCD = 0; - } - if (this.chatShowTime > 0) - { - this.chatShowTime--; - } - if (this.potionDelay > 0) - { - this.potionDelay--; - } - if (this.dead) - { - if (i == Main.myPlayer) - { - Main.npcChatText = ""; - Main.editSign = false; - } - this.sign = -1; - this.talkNPC = -1; - this.statLife = 0; - this.channel = false; - this.potionDelay = 0; - this.chest = -1; - this.changeItem = -1; - this.itemAnimation = 0; - this.immuneAlpha += 2; - if (this.immuneAlpha > 0xff) - { - this.immuneAlpha = 0xff; - } - this.respawnTimer--; - this.headPosition += this.headVelocity; - this.bodyPosition += this.bodyVelocity; - this.legPosition += this.legVelocity; - this.headRotation += this.headVelocity.X * 0.1f; - this.bodyRotation += this.bodyVelocity.X * 0.1f; - this.legRotation += this.legVelocity.X * 0.1f; - this.headVelocity.Y += 0.1f; - this.bodyVelocity.Y += 0.1f; - this.legVelocity.Y += 0.1f; - this.headVelocity.X *= 0.99f; - this.bodyVelocity.X *= 0.99f; - this.legVelocity.X *= 0.99f; - if ((this.respawnTimer <= 0) && (Main.myPlayer == this.whoAmi)) - { - this.Spawn(); - } - } - else - { - Color color; - if (i == Main.myPlayer) - { - this.zoneEvil = false; - if (Main.evilTiles >= 500) - { - this.zoneEvil = true; - } - this.zoneMeteor = false; - if (Main.meteorTiles >= 50) - { - this.zoneMeteor = true; - } - this.zoneDungeon = false; - if ((Main.dungeonTiles >= 250) && (this.position.Y > ((Main.worldSurface * 16.0) + Main.screenHeight))) - { - int num7 = ((int) this.position.X) / 0x10; - int num8 = ((int) this.position.Y) / 0x10; - if ((Main.tile[num7, num8].wall > 0) && !Main.wallHouse[Main.tile[num7, num8].wall]) - { - this.zoneDungeon = true; - } - } - this.zoneJungle = false; - if (Main.jungleTiles >= 200) - { - this.zoneJungle = true; - } - this.controlUp = false; - this.controlLeft = false; - this.controlDown = false; - this.controlRight = false; - this.controlJump = false; - this.controlUseItem = false; - this.controlUseTile = false; - this.controlThrow = false; - this.controlInv = false; - if (Main.hasFocus) - { - if (!Main.chatMode && !Main.editSign) - { - Keys[] pressedKeys = Main.keyState.GetPressedKeys(); - for (int n = 0; n < pressedKeys.Length; n++) - { - string str = Convert.ToString(pressedKeys.GetValue(n)); - if (str == Main.cUp) - { - this.controlUp = true; - } - if (str == Main.cLeft) - { - this.controlLeft = true; - } - if (str == Main.cDown) - { - this.controlDown = true; - } - if (str == Main.cRight) - { - this.controlRight = true; - } - if (str == Main.cJump) - { - this.controlJump = true; - } - if (str == Main.cThrowItem) - { - this.controlThrow = true; - } - if (str == Main.cInv) - { - this.controlInv = true; - } - } - if (this.controlLeft && this.controlRight) - { - this.controlLeft = false; - this.controlRight = false; - } - } - if ((Main.mouseState.LeftButton == ButtonState.Pressed) && !this.mouseInterface) - { - this.controlUseItem = true; - } - if ((Main.mouseState.RightButton == ButtonState.Pressed) && !this.mouseInterface) - { - this.controlUseTile = true; - } - if (this.controlInv) - { - if (this.releaseInventory) - { - if (this.talkNPC >= 0) - { - this.talkNPC = -1; - Main.npcChatText = ""; - Main.PlaySound(11, -1, -1, 1); - } - else if (this.sign >= 0) - { - this.sign = -1; - Main.editSign = false; - Main.npcChatText = ""; - Main.PlaySound(11, -1, -1, 1); - } - else if (!Main.playerInventory) - { - Recipe.FindRecipes(); - Main.playerInventory = true; - Main.PlaySound(10, -1, -1, 1); - } - else - { - Main.playerInventory = false; - Main.PlaySound(11, -1, -1, 1); - } - } - this.releaseInventory = false; - } - else - { - this.releaseInventory = true; - } - if (this.delayUseItem) - { - if (!this.controlUseItem) - { - this.delayUseItem = false; - } - this.controlUseItem = false; - } - if ((this.itemAnimation == 0) && (this.itemTime == 0)) - { - if (((this.controlThrow && (this.inventory[this.selectedItem].type > 0)) && !Main.chatMode) || (((((Main.mouseState.LeftButton == ButtonState.Pressed) && !this.mouseInterface) && Main.mouseLeftRelease) || !Main.playerInventory) && (Main.mouseItem.type > 0))) - { - Item item = new Item(); - bool flag = false; - if (((((Main.mouseState.LeftButton == ButtonState.Pressed) && !this.mouseInterface) && Main.mouseLeftRelease) || !Main.playerInventory) && (Main.mouseItem.type > 0)) - { - item = this.inventory[this.selectedItem]; - this.inventory[this.selectedItem] = Main.mouseItem; - this.delayUseItem = true; - this.controlUseItem = false; - flag = true; - } - int index = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, this.inventory[this.selectedItem].type, 1, false); - if ((!flag && (this.inventory[this.selectedItem].type == 8)) && (this.inventory[this.selectedItem].stack > 1)) - { - Item item1 = this.inventory[this.selectedItem]; - item1.stack--; - } - else - { - this.inventory[this.selectedItem].position = Main.item[index].position; - Main.item[index] = this.inventory[this.selectedItem]; - this.inventory[this.selectedItem] = new Item(); - } - if (Main.netMode == 0) - { - Main.item[index].noGrabDelay = 100; - } - Main.item[index].velocity.Y = -2f; - Main.item[index].velocity.X = (4 * this.direction) + this.velocity.X; - if ((((Main.mouseState.LeftButton == ButtonState.Pressed) && !this.mouseInterface) || !Main.playerInventory) && (Main.mouseItem.type > 0)) - { - this.inventory[this.selectedItem] = item; - Main.mouseItem = new Item(); - } - else - { - this.itemAnimation = 10; - this.itemAnimationMax = 10; - } - Recipe.FindRecipes(); - if (Main.netMode == 1) - { - NetMessage.SendData(0x15, -1, -1, "", index, 0f, 0f, 0f); - } - } - if (!Main.playerInventory) - { - int selectedItem = this.selectedItem; - if (!Main.chatMode) - { - if (Main.keyState.IsKeyDown(Keys.D1)) - { - this.selectedItem = 0; - } - if (Main.keyState.IsKeyDown(Keys.D2)) - { - this.selectedItem = 1; - } - if (Main.keyState.IsKeyDown(Keys.D3)) - { - this.selectedItem = 2; - } - if (Main.keyState.IsKeyDown(Keys.D4)) - { - this.selectedItem = 3; - } - if (Main.keyState.IsKeyDown(Keys.D5)) - { - this.selectedItem = 4; - } - if (Main.keyState.IsKeyDown(Keys.D6)) - { - this.selectedItem = 5; - } - if (Main.keyState.IsKeyDown(Keys.D7)) - { - this.selectedItem = 6; - } - if (Main.keyState.IsKeyDown(Keys.D8)) - { - this.selectedItem = 7; - } - if (Main.keyState.IsKeyDown(Keys.D9)) - { - this.selectedItem = 8; - } - if (Main.keyState.IsKeyDown(Keys.D0)) - { - this.selectedItem = 9; - } - } - if (selectedItem != this.selectedItem) - { - Main.PlaySound(12, -1, -1, 1); - } - int num12 = (Main.mouseState.ScrollWheelValue - Main.oldMouseState.ScrollWheelValue) / 120; - while (num12 > 9) - { - num12 -= 10; - } - while (num12 < 0) - { - num12 += 10; - } - this.selectedItem -= num12; - if (num12 != 0) - { - Main.PlaySound(12, -1, -1, 1); - } - if (this.changeItem >= 0) - { - if (this.selectedItem != this.changeItem) - { - Main.PlaySound(12, -1, -1, 1); - } - this.selectedItem = this.changeItem; - this.changeItem = -1; - } - while (this.selectedItem > 9) - { - this.selectedItem -= 10; - } - while (this.selectedItem < 0) - { - this.selectedItem += 10; - } - } - else - { - int num13 = (Main.mouseState.ScrollWheelValue - Main.oldMouseState.ScrollWheelValue) / 120; - Main.focusRecipe += num13; - if (Main.focusRecipe > (Main.numAvailableRecipes - 1)) - { - Main.focusRecipe = Main.numAvailableRecipes - 1; - } - if (Main.focusRecipe < 0) - { - Main.focusRecipe = 0; - } - } - } - } - if (Main.netMode == 1) - { - bool flag2 = false; - if ((this.statLife != Main.clientPlayer.statLife) || (this.statLifeMax != Main.clientPlayer.statLifeMax)) - { - NetMessage.SendData(0x10, -1, -1, "", Main.myPlayer, 0f, 0f, 0f); - flag2 = true; - } - if ((this.statMana != Main.clientPlayer.statMana) || (this.statManaMax != Main.clientPlayer.statManaMax)) - { - NetMessage.SendData(0x2a, -1, -1, "", Main.myPlayer, 0f, 0f, 0f); - flag2 = true; - } - if (this.controlUp != Main.clientPlayer.controlUp) - { - flag2 = true; - } - if (this.controlDown != Main.clientPlayer.controlDown) - { - flag2 = true; - } - if (this.controlLeft != Main.clientPlayer.controlLeft) - { - flag2 = true; - } - if (this.controlRight != Main.clientPlayer.controlRight) - { - flag2 = true; - } - if (this.controlJump != Main.clientPlayer.controlJump) - { - flag2 = true; - } - if (this.controlUseItem != Main.clientPlayer.controlUseItem) - { - flag2 = true; - } - if (this.selectedItem != Main.clientPlayer.selectedItem) - { - flag2 = true; - } - if (flag2) - { - NetMessage.SendData(13, -1, -1, "", Main.myPlayer, 0f, 0f, 0f); - } - } - if (Main.playerInventory) - { - this.AdjTiles(); - } - if (this.chest != -1) - { - int num14 = (int) ((this.position.X + (this.width * 0.5)) / 16.0); - int num15 = (int) ((this.position.Y + (this.height * 0.5)) / 16.0); - if (((num14 < (this.chestX - 5)) || (num14 > (this.chestX + 6))) || ((num15 < (this.chestY - 4)) || (num15 > (this.chestY + 5)))) - { - if (this.chest != -1) - { - Main.PlaySound(11, -1, -1, 1); - } - this.chest = -1; - } - if (!Main.tile[this.chestX, this.chestY].active) - { - Main.PlaySound(11, -1, -1, 1); - this.chest = -1; - } - } - if (this.velocity.Y == 0f) - { - int num16 = ((int) (this.position.Y / 16f)) - this.fallStart; - if ((num16 > 0x19) && !this.noFallDmg) - { - int damage = (num16 - 0x19) * 10; - this.immune = false; - this.Hurt(damage, -this.direction, false, false); - } - this.fallStart = (int) (this.position.Y / 16f); - } - if ((this.rocketDelay > 0) || this.wet) - { - this.fallStart = (int) (this.position.Y / 16f); - } - } - if (this.mouseInterface) - { - this.delayUseItem = true; - } - Player.tileTargetX = (int) ((Main.mouseState.X + Main.screenPosition.X) / 16f); - Player.tileTargetY = (int) ((Main.mouseState.Y + Main.screenPosition.Y) / 16f); - if (this.immune) - { - this.immuneTime--; - if (this.immuneTime <= 0) - { - this.immune = false; - } - this.immuneAlpha += this.immuneAlphaDirection * 50; - if (this.immuneAlpha <= 50) - { - this.immuneAlphaDirection = 1; - } - else if (this.immuneAlpha >= 0xcd) - { - this.immuneAlphaDirection = -1; - } - } - else - { - this.immuneAlpha = 0; - } - if (this.manaRegenDelay > 0) - { - this.manaRegenDelay--; - } - this.statDefense = 0; - this.accWatch = 0; - this.accDepthMeter = 0; - this.lifeRegen = 0; - this.manaCost = 1f; - this.meleeSpeed = 1f; - this.boneArmor = false; - this.rocketBoots = false; - this.fireWalk = false; - this.noKnockback = false; - this.jumpBoost = false; - this.noFallDmg = false; - this.accFlipper = false; - this.spawnMax = false; - if (this.manaRegenDelay == 0) - { - this.manaRegen = (this.statManaMax / 30) + 1; - } - else - { - this.manaRegen = 0; - } - this.doubleJump = false; - for (int j = 0; j < 8; j++) - { - this.statDefense += this.armor[j].defense; - this.lifeRegen += this.armor[j].lifeRegen; - this.manaRegen += this.armor[j].manaRegen; - if (this.armor[j].type == 0xc1) - { - this.fireWalk = true; - } - } - this.head = this.armor[0].headSlot; - this.body = this.armor[1].bodySlot; - this.legs = this.armor[2].legSlot; - for (int k = 3; k < 8; k++) - { - if ((this.armor[k].type == 15) && (this.accWatch < 1)) - { - this.accWatch = 1; - } - if ((this.armor[k].type == 0x10) && (this.accWatch < 2)) - { - this.accWatch = 2; - } - if ((this.armor[k].type == 0x11) && (this.accWatch < 3)) - { - this.accWatch = 3; - } - if ((this.armor[k].type == 0x12) && (this.accDepthMeter < 1)) - { - this.accDepthMeter = 1; - } - if (this.armor[k].type == 0x35) - { - this.doubleJump = true; - } - if (this.armor[k].type == 0x36) - { - num6 = 6f; - } - if (this.armor[k].type == 0x80) - { - this.rocketBoots = true; - } - if (this.armor[k].type == 0x9c) - { - this.noKnockback = true; - } - if (this.armor[k].type == 0x9e) - { - this.noFallDmg = true; - } - if (this.armor[k].type == 0x9f) - { - this.jumpBoost = true; - } - if (this.armor[k].type == 0xbb) - { - this.accFlipper = true; - } - if (this.armor[k].type == 0xd3) - { - this.meleeSpeed *= 0.9f; - } - if (this.armor[k].type == 0xdf) - { - this.spawnMax = true; - } - if (this.armor[k].type == 0xd4) - { - num4 *= 1.1f; - num3 *= 1.1f; - } - } - this.lifeRegenCount += this.lifeRegen; - while (this.lifeRegenCount >= 120) - { - this.lifeRegenCount -= 120; - if (this.statLife < this.statLifeMax) - { - this.statLife++; - } - if (this.statLife > this.statLifeMax) - { - this.statLife = this.statLifeMax; - } - } - this.manaRegenCount += this.manaRegen; - while (this.manaRegenCount >= 120) - { - this.manaRegenCount -= 120; - if (this.statMana < this.statManaMax) - { - this.statMana++; - } - if (this.statMana > this.statManaMax) - { - this.statMana = this.statManaMax; - } - } - if (this.head == 11) - { - int num20 = ((((int) this.position.X) + (this.width / 2)) + (8 * this.direction)) / 0x10; - int num21 = ((int) (this.position.Y + 2f)) / 0x10; - Lighting.addLight(num20, num21, 0.8f); - } - if (this.jumpBoost) - { - jumpHeight = 20; - jumpSpeed = 6.51f; - } - this.setBonus = ""; - if ((((this.head == 1) && (this.body == 1)) && (this.legs == 1)) || (((this.head == 2) && (this.body == 2)) && (this.legs == 2))) - { - this.setBonus = "2 defense"; - this.statDefense++; - } - if ((((this.head == 3) && (this.body == 3)) && (this.legs == 3)) || (((this.head == 4) && (this.body == 4)) && (this.legs == 4))) - { - this.setBonus = "3 defense"; - this.statDefense += 2; - } - if (((this.head == 5) && (this.body == 5)) && (this.legs == 5)) - { - this.setBonus = "15 % increased melee speed"; - this.meleeSpeed *= 0.85f; - if (Main.rand.Next(10) == 0) - { - color = new Color(); - Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 14, 0f, 0f, 200, color, 1.2f); - } - } - if (((this.head == 6) && (this.body == 6)) && (this.legs == 6)) - { - this.setBonus = "20% reduced mana usage"; - this.manaCost *= 0.8f; - if (((Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) > 1f) && !this.rocketFrame) - { - for (int num22 = 0; num22 < 2; num22++) - { - color = new Color(); - int num23 = Dust.NewDust(new Vector2(this.position.X - (this.velocity.X * 2f), (this.position.Y - 2f) - (this.velocity.Y * 2f)), this.width, this.height, 6, 0f, 0f, 100, color, 2f); - Main.dust[num23].noGravity = true; - Main.dust[num23].velocity.X -= this.velocity.X * 0.5f; - Main.dust[num23].velocity.Y -= this.velocity.Y * 0.5f; - } - } - } - if (((this.head == 7) && (this.body == 7)) && (this.legs == 7)) - { - num4 *= 1.3f; - num3 *= 1.3f; - this.setBonus = "30% increased movement speed"; - this.boneArmor = true; - } - if (((this.head == 8) && (this.body == 8)) && (this.legs == 8)) - { - this.setBonus = "25% reduced mana usage"; - this.manaCost *= 0.75f; - this.meleeSpeed *= 0.9f; - if (Main.rand.Next(10) == 0) - { - color = new Color(); - Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 14, 0f, 0f, 200, color, 1.2f); - } - } - if (((this.head == 9) && (this.body == 9)) && (this.legs == 9)) - { - this.setBonus = "10 defense"; - if (((Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) > 1f) && !this.rocketFrame) - { - for (int num24 = 0; num24 < 2; num24++) - { - color = new Color(); - int num25 = Dust.NewDust(new Vector2(this.position.X - (this.velocity.X * 2f), (this.position.Y - 2f) - (this.velocity.Y * 2f)), this.width, this.height, 6, 0f, 0f, 100, color, 2f); - Main.dust[num25].noGravity = true; - Main.dust[num25].velocity.X -= this.velocity.X * 0.5f; - Main.dust[num25].velocity.Y -= this.velocity.Y * 0.5f; - } - } - } - if (!this.doubleJump) - { - this.jumpAgain = false; - } - else if (this.velocity.Y == 0f) - { - this.jumpAgain = true; - } - if (this.meleeSpeed < 0.7) - { - this.meleeSpeed = 0.7f; - } - if (this.grappling[0] == -1) - { - if (this.controlLeft && (this.velocity.X > -num3)) - { - if (this.velocity.X > num5) - { - this.velocity.X -= num5; - } - this.velocity.X -= num4; - if ((this.itemAnimation == 0) || this.inventory[this.selectedItem].useTurn) - { - this.direction = -1; - } - } - else if (this.controlRight && (this.velocity.X < num3)) - { - if (this.velocity.X < -num5) - { - this.velocity.X += num5; - } - this.velocity.X += num4; - if ((this.itemAnimation == 0) || this.inventory[this.selectedItem].useTurn) - { - this.direction = 1; - } - } - else if (this.controlLeft && (this.velocity.X > -num6)) - { - if ((this.itemAnimation == 0) || this.inventory[this.selectedItem].useTurn) - { - this.direction = -1; - } - if (this.velocity.Y == 0f) - { - if (this.velocity.X > num5) - { - this.velocity.X -= num5; - } - this.velocity.X -= num4 * 0.2f; - } - if ((this.velocity.X < (-(num6 + num3) / 2f)) && (this.velocity.Y == 0f)) - { - if ((this.runSoundDelay == 0) && (this.velocity.Y == 0f)) - { - Main.PlaySound(0x11, (int) this.position.X, (int) this.position.Y, 1); - this.runSoundDelay = 9; - } - color = new Color(); - int num26 = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y + this.height), this.width + 8, 4, 0x10, -this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 50, color, 1.5f); - Main.dust[num26].velocity.X *= 0.2f; - Main.dust[num26].velocity.Y *= 0.2f; - } - } - else if (this.controlRight && (this.velocity.X < num6)) - { - if ((this.itemAnimation == 0) || this.inventory[this.selectedItem].useTurn) - { - this.direction = 1; - } - if (this.velocity.Y == 0f) - { - if (this.velocity.X < -num5) - { - this.velocity.X += num5; - } - this.velocity.X += num4 * 0.2f; - } - if ((this.velocity.X > ((num6 + num3) / 2f)) && (this.velocity.Y == 0f)) - { - if ((this.runSoundDelay == 0) && (this.velocity.Y == 0f)) - { - Main.PlaySound(0x11, (int) this.position.X, (int) this.position.Y, 1); - this.runSoundDelay = 9; - } - color = new Color(); - int num27 = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y + this.height), this.width + 8, 4, 0x10, -this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 50, color, 1.5f); - Main.dust[num27].velocity.X *= 0.2f; - Main.dust[num27].velocity.Y *= 0.2f; - } - } - else if (this.velocity.Y == 0f) - { - if (this.velocity.X > num5) - { - this.velocity.X -= num5; - } - else if (this.velocity.X < -num5) - { - this.velocity.X += num5; - } - else - { - this.velocity.X = 0f; - } - } - else if (this.velocity.X > (num5 * 0.5)) - { - this.velocity.X -= num5 * 0.5f; - } - else if (this.velocity.X < (-num5 * 0.5)) - { - this.velocity.X += num5 * 0.5f; - } - else - { - this.velocity.X = 0f; - } - if (this.controlJump) - { - if (this.jump > 0) - { - if (this.velocity.Y > (-jumpSpeed + (num2 * 2f))) - { - this.jump = 0; - } - else - { - this.velocity.Y = -jumpSpeed; - this.jump--; - } - } - else if ((((this.velocity.Y == 0f) || this.jumpAgain) || (this.wet && this.accFlipper)) && this.releaseJump) - { - bool flag3 = false; - if (this.wet && this.accFlipper) - { - if (this.swimTime == 0) - { - this.swimTime = 30; - } - flag3 = true; - } - this.jumpAgain = false; - this.canRocket = false; - this.rocketRelease = false; - if ((this.velocity.Y == 0f) && this.doubleJump) - { - this.jumpAgain = true; - } - if ((this.velocity.Y == 0f) || flag3) - { - this.velocity.Y = -jumpSpeed; - this.jump = jumpHeight; - } - else - { - Main.PlaySound(0x10, (int) this.position.X, (int) this.position.Y, 1); - this.velocity.Y = -jumpSpeed; - this.jump = jumpHeight / 2; - for (int num28 = 0; num28 < 10; num28++) - { - color = new Color(); - int num29 = Dust.NewDust(new Vector2(this.position.X - 34f, (this.position.Y + this.height) - 16f), 0x66, 0x20, 0x10, -this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 100, color, 1.5f); - Main.dust[num29].velocity.X = (Main.dust[num29].velocity.X * 0.5f) - (this.velocity.X * 0.1f); - Main.dust[num29].velocity.Y = (Main.dust[num29].velocity.Y * 0.5f) - (this.velocity.Y * 0.3f); - } - int num30 = Gore.NewGore(new Vector2((this.position.X + (this.width / 2)) - 16f, (this.position.Y + this.height) - 16f), new Vector2(-this.velocity.X, -this.velocity.Y), Main.rand.Next(11, 14)); - Main.gore[num30].velocity.X = (Main.gore[num30].velocity.X * 0.1f) - (this.velocity.X * 0.1f); - Main.gore[num30].velocity.Y = (Main.gore[num30].velocity.Y * 0.1f) - (this.velocity.Y * 0.05f); - num30 = Gore.NewGore(new Vector2(this.position.X - 36f, (this.position.Y + this.height) - 16f), new Vector2(-this.velocity.X, -this.velocity.Y), Main.rand.Next(11, 14)); - Main.gore[num30].velocity.X = (Main.gore[num30].velocity.X * 0.1f) - (this.velocity.X * 0.1f); - Main.gore[num30].velocity.Y = (Main.gore[num30].velocity.Y * 0.1f) - (this.velocity.Y * 0.05f); - num30 = Gore.NewGore(new Vector2((this.position.X + this.width) + 4f, (this.position.Y + this.height) - 16f), new Vector2(-this.velocity.X, -this.velocity.Y), Main.rand.Next(11, 14)); - Main.gore[num30].velocity.X = (Main.gore[num30].velocity.X * 0.1f) - (this.velocity.X * 0.1f); - Main.gore[num30].velocity.Y = (Main.gore[num30].velocity.Y * 0.1f) - (this.velocity.Y * 0.05f); - } - } - this.releaseJump = false; - } - else - { - this.jump = 0; - this.releaseJump = true; - this.rocketRelease = true; - } - if (((this.doubleJump && !this.jumpAgain) && ((this.velocity.Y < 0f) && !this.rocketBoots)) && !this.accFlipper) - { - color = new Color(); - int num31 = Dust.NewDust(new Vector2(this.position.X - 4f, this.position.Y + this.height), this.width + 8, 4, 0x10, -this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 100, color, 1.5f); - Main.dust[num31].velocity.X = (Main.dust[num31].velocity.X * 0.5f) - (this.velocity.X * 0.1f); - Main.dust[num31].velocity.Y = (Main.dust[num31].velocity.Y * 0.5f) - (this.velocity.Y * 0.3f); - } - if ((this.velocity.Y > -jumpSpeed) && (this.velocity.Y != 0f)) - { - this.canRocket = true; - } - if (((this.rocketBoots && this.controlJump) && ((this.rocketDelay == 0) && this.canRocket)) && (this.rocketRelease && !this.jumpAgain)) - { - int num32 = 7; - if (this.statMana >= ((int) (num32 * this.manaCost))) - { - this.manaRegenDelay = 180; - this.statMana -= (int) (num32 * this.manaCost); - this.rocketDelay = 10; - if (this.rocketDelay2 <= 0) - { - Main.PlaySound(2, (int) this.position.X, (int) this.position.Y, 13); - this.rocketDelay2 = 30; - } - } - else - { - this.canRocket = false; - } - } - if (this.rocketDelay2 > 0) - { - this.rocketDelay2--; - } - if (this.rocketDelay == 0) - { - this.rocketFrame = false; - } - if (this.rocketDelay > 0) - { - this.rocketFrame = true; - for (int num33 = 0; num33 < 2; num33++) - { - if (num33 == 0) - { - color = new Color(); - int num34 = Dust.NewDust(new Vector2(this.position.X - 4f, (this.position.Y + this.height) - 10f), 8, 8, 6, 0f, 0f, 100, color, 2.5f); - Main.dust[num34].noGravity = true; - Main.dust[num34].velocity.X = ((Main.dust[num34].velocity.X * 1f) - 2f) - (this.velocity.X * 0.3f); - Main.dust[num34].velocity.Y = ((Main.dust[num34].velocity.Y * 1f) + 2f) - (this.velocity.Y * 0.3f); - } - else - { - color = new Color(); - int num35 = Dust.NewDust(new Vector2((this.position.X + this.width) - 4f, (this.position.Y + this.height) - 10f), 8, 8, 6, 0f, 0f, 100, color, 2.5f); - Main.dust[num35].noGravity = true; - Main.dust[num35].velocity.X = ((Main.dust[num35].velocity.X * 1f) + 2f) - (this.velocity.X * 0.3f); - Main.dust[num35].velocity.Y = ((Main.dust[num35].velocity.Y * 1f) + 2f) - (this.velocity.Y * 0.3f); - } - } - if (this.rocketDelay == 0) - { - this.releaseJump = true; - } - this.rocketDelay--; - this.velocity.Y -= 0.1f; - if (this.velocity.Y > 0f) - { - this.velocity.Y -= 0.3f; - } - if (this.velocity.Y < -jumpSpeed) - { - this.velocity.Y = -jumpSpeed; - } - } - else - { - this.velocity.Y += num2; - } - if (this.velocity.Y > num) - { - this.velocity.Y = num; - } - } - for (int m = 0; m < 200; m++) - { - if ((Main.item[m].active && (Main.item[m].noGrabDelay == 0)) && (Main.item[m].owner == i)) - { - Rectangle rectangle6 = new Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height); - if (rectangle6.Intersects(new Rectangle((int) Main.item[m].position.X, (int) Main.item[m].position.Y, Main.item[m].width, Main.item[m].height))) - { - if ((i == Main.myPlayer) && ((this.inventory[this.selectedItem].type != 0) || (this.itemAnimation <= 0))) - { - if (Main.item[m].type == 0x3a) - { - Main.PlaySound(7, (int) this.position.X, (int) this.position.Y, 1); - this.statLife += 20; - if (Main.myPlayer == this.whoAmi) - { - this.HealEffect(20); - } - if (this.statLife > this.statLifeMax) - { - this.statLife = this.statLifeMax; - } - Main.item[m] = new Item(); - if (Main.netMode == 1) - { - NetMessage.SendData(0x15, -1, -1, "", m, 0f, 0f, 0f); - } - } - else if (Main.item[m].type == 0xb8) - { - Main.PlaySound(7, (int) this.position.X, (int) this.position.Y, 1); - this.statMana += 20; - if (Main.myPlayer == this.whoAmi) - { - this.ManaEffect(20); - } - if (this.statMana > this.statManaMax) - { - this.statMana = this.statManaMax; - } - Main.item[m] = new Item(); - if (Main.netMode == 1) - { - NetMessage.SendData(0x15, -1, -1, "", m, 0f, 0f, 0f); - } - } - else - { - Main.item[m] = this.GetItem(i, Main.item[m]); - if (Main.netMode == 1) - { - NetMessage.SendData(0x15, -1, -1, "", m, 0f, 0f, 0f); - } - } - } - } - else - { - rectangle6 = new Rectangle(((int) this.position.X) - itemGrabRange, ((int) this.position.Y) - itemGrabRange, this.width + (itemGrabRange * 2), this.height + (itemGrabRange * 2)); - if (rectangle6.Intersects(new Rectangle((int) Main.item[m].position.X, (int) Main.item[m].position.Y, Main.item[m].width, Main.item[m].height)) && this.ItemSpace(Main.item[m])) - { - Main.item[m].beingGrabbed = true; - if ((this.position.X + (this.width * 0.5)) > (Main.item[m].position.X + (Main.item[m].width * 0.5))) - { - if (Main.item[m].velocity.X < (itemGrabSpeedMax + this.velocity.X)) - { - Main.item[m].velocity.X += itemGrabSpeed; - } - if (Main.item[m].velocity.X < 0f) - { - Main.item[m].velocity.X += itemGrabSpeed * 0.75f; - } - } - else - { - if (Main.item[m].velocity.X > (-itemGrabSpeedMax + this.velocity.X)) - { - Main.item[m].velocity.X -= itemGrabSpeed; - } - if (Main.item[m].velocity.X > 0f) - { - Main.item[m].velocity.X -= itemGrabSpeed * 0.75f; - } - } - if ((this.position.Y + (this.height * 0.5)) > (Main.item[m].position.Y + (Main.item[m].height * 0.5))) - { - if (Main.item[m].velocity.Y < itemGrabSpeedMax) - { - Main.item[m].velocity.Y += itemGrabSpeed; - } - if (Main.item[m].velocity.Y < 0f) - { - Main.item[m].velocity.Y += itemGrabSpeed * 0.75f; - } - } - else - { - if (Main.item[m].velocity.Y > -itemGrabSpeedMax) - { - Main.item[m].velocity.Y -= itemGrabSpeed; - } - if (Main.item[m].velocity.Y > 0f) - { - Main.item[m].velocity.Y -= itemGrabSpeed * 0.75f; - } - } - } - } - } - } - if ((((((this.position.X / 16f) - tileRangeX) <= Player.tileTargetX) && (((((this.position.X + this.width) / 16f) + tileRangeX) - 1f) >= Player.tileTargetX)) && ((((this.position.Y / 16f) - tileRangeY) <= Player.tileTargetY) && (((((this.position.Y + this.height) / 16f) + tileRangeY) - 2f) >= Player.tileTargetY))) && Main.tile[Player.tileTargetX, Player.tileTargetY].active) - { - if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 0x4f) - { - this.showItemIcon = true; - this.showItemIcon2 = 0xe0; - } - if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 0x15) - { - this.showItemIcon = true; - this.showItemIcon2 = 0x30; - } - if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 4) - { - this.showItemIcon = true; - this.showItemIcon2 = 8; - } - if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 13) - { - this.showItemIcon = true; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX == 0x12) - { - this.showItemIcon2 = 0x1c; - } - else if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX == 0x24) - { - this.showItemIcon2 = 110; - } - else - { - this.showItemIcon2 = 0x1f; - } - } - if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 0x1d) - { - this.showItemIcon = true; - this.showItemIcon2 = 0x57; - } - if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 0x21) - { - this.showItemIcon = true; - this.showItemIcon2 = 0x69; - } - if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 0x31) - { - this.showItemIcon = true; - this.showItemIcon2 = 0x94; - } - if ((Main.tile[Player.tileTargetX, Player.tileTargetY].type == 50) && (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX == 90)) - { - this.showItemIcon = true; - this.showItemIcon2 = 0xa5; - } - if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 0x37) - { - int num37 = Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 0x12; - int num38 = Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 0x12; - while (num37 > 1) - { - num37 -= 2; - } - int num39 = Player.tileTargetX - num37; - int num40 = Player.tileTargetY - num38; - Main.signBubble = true; - Main.signX = (num39 * 0x10) + 0x10; - Main.signY = num40 * 0x10; - } - if ((Main.tile[Player.tileTargetX, Player.tileTargetY].type == 10) || (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 11)) - { - this.showItemIcon = true; - this.showItemIcon2 = 0x19; - } - if (this.controlUseTile) - { - if (this.releaseUseTile) - { - if (((Main.tile[Player.tileTargetX, Player.tileTargetY].type == 4) || (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 13)) || (((Main.tile[Player.tileTargetX, Player.tileTargetY].type == 0x21) || (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 0x31)) || ((Main.tile[Player.tileTargetX, Player.tileTargetY].type == 50) && (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX == 90)))) - { - WorldGen.KillTile(Player.tileTargetX, Player.tileTargetY, false, false, false); - if (Main.netMode == 1) - { - NetMessage.SendData(0x11, -1, -1, "", 0, (float) Player.tileTargetX, (float) Player.tileTargetY, 0f); - } - } - else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 0x4f) - { - int tileTargetX = Player.tileTargetX; - int tileTargetY = Player.tileTargetY; - tileTargetX += (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 0x12) * -1; - if (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX >= 0x48) - { - tileTargetX += 4; - tileTargetX++; - } - else - { - tileTargetX += 2; - } - tileTargetY += (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 0x12) * -1; - tileTargetY += 2; - if (CheckSpawn(tileTargetX, tileTargetY)) - { - this.ChangeSpawn(tileTargetX, tileTargetY); - Main.NewText("Spawn point set!", 0xff, 240, 20); - } - } - else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 0x37) - { - bool flag4 = true; - if ((this.sign >= 0) && (Sign.ReadSign(Player.tileTargetX, Player.tileTargetY) == this.sign)) - { - this.sign = -1; - Main.npcChatText = ""; - Main.editSign = false; - Main.PlaySound(11, -1, -1, 1); - flag4 = false; - } - if (flag4) - { - if (Main.netMode == 0) - { - this.talkNPC = -1; - Main.playerInventory = false; - Main.editSign = false; - Main.PlaySound(10, -1, -1, 1); - int num44 = Sign.ReadSign(Player.tileTargetX, Player.tileTargetY); - this.sign = num44; - Main.npcChatText = Main.sign[num44].text; - } - else - { - int num45 = Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 0x12; - int num46 = Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 0x12; - while (num45 > 1) - { - num45 -= 2; - } - int number = Player.tileTargetX - num45; - int num48 = Player.tileTargetY - num46; - if (Main.tile[number, num48].type == 0x37) - { - NetMessage.SendData(0x2e, -1, -1, "", number, (float) num48, 0f, 0f); - } - } - } - } - else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 10) - { - WorldGen.OpenDoor(Player.tileTargetX, Player.tileTargetY, this.direction); - NetMessage.SendData(0x13, -1, -1, "", 0, (float) Player.tileTargetX, (float) Player.tileTargetY, (float) this.direction); - } - else if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 11) - { - if (WorldGen.CloseDoor(Player.tileTargetX, Player.tileTargetY, false)) - { - NetMessage.SendData(0x13, -1, -1, "", 1, (float) Player.tileTargetX, (float) Player.tileTargetY, (float) this.direction); - } - } - else if (((Main.tile[Player.tileTargetX, Player.tileTargetY].type == 0x15) || (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 0x1d)) && (this.talkNPC == -1)) - { - bool flag5 = false; - int num49 = Player.tileTargetX - (Main.tile[Player.tileTargetX, Player.tileTargetY].frameX / 0x12); - int y = Player.tileTargetY - (Main.tile[Player.tileTargetX, Player.tileTargetY].frameY / 0x12); - if (Main.tile[Player.tileTargetX, Player.tileTargetY].type == 0x1d) - { - flag5 = true; - } - if ((Main.netMode == 1) && !flag5) - { - if (((num49 == this.chestX) && (y == this.chestY)) && (this.chest != -1)) - { - this.chest = -1; - Main.PlaySound(11, -1, -1, 1); - } - else - { - NetMessage.SendData(0x1f, -1, -1, "", num49, (float) y, 0f, 0f); - } - } - else - { - int num51 = -1; - if (flag5) - { - num51 = -2; - } - else - { - num51 = Chest.FindChest(num49, y); - } - if (num51 != -1) - { - if (num51 == this.chest) - { - this.chest = -1; - Main.PlaySound(11, -1, -1, 1); - } - else if ((num51 != this.chest) && (this.chest == -1)) - { - this.chest = num51; - Main.playerInventory = true; - Main.PlaySound(10, -1, -1, 1); - this.chestX = num49; - this.chestY = y; - } - else - { - this.chest = num51; - Main.playerInventory = true; - Main.PlaySound(12, -1, -1, 1); - this.chestX = num49; - this.chestY = y; - } - } - } - } - } - this.releaseUseTile = false; - } - else - { - this.releaseUseTile = true; - } - } - if (Main.myPlayer == this.whoAmi) - { - if (this.talkNPC >= 0) - { - Rectangle rectangle = new Rectangle((((int) this.position.X) + (this.width / 2)) - (tileRangeX * 0x10), (((int) this.position.Y) + (this.height / 2)) - (tileRangeY * 0x10), (tileRangeX * 0x10) * 2, (tileRangeY * 0x10) * 2); - Rectangle rectangle2 = new Rectangle((int) Main.npc[this.talkNPC].position.X, (int) Main.npc[this.talkNPC].position.Y, Main.npc[this.talkNPC].width, Main.npc[this.talkNPC].height); - if ((!rectangle.Intersects(rectangle2) || (this.chest != -1)) || !Main.npc[this.talkNPC].active) - { - if (this.chest == -1) - { - Main.PlaySound(11, -1, -1, 1); - } - this.talkNPC = -1; - Main.npcChatText = ""; - } - } - if (this.sign >= 0) - { - Rectangle rectangle3 = new Rectangle((((int) this.position.X) + (this.width / 2)) - (tileRangeX * 0x10), (((int) this.position.Y) + (this.height / 2)) - (tileRangeY * 0x10), (tileRangeX * 0x10) * 2, (tileRangeY * 0x10) * 2); - Rectangle rectangle4 = new Rectangle(Main.sign[this.sign].x * 0x10, Main.sign[this.sign].y * 0x10, 0x20, 0x20); - if (!rectangle3.Intersects(rectangle4)) - { - Main.PlaySound(11, -1, -1, 1); - this.sign = -1; - Main.editSign = false; - Main.npcChatText = ""; - } - } - if (Main.editSign) - { - if (this.sign == -1) - { - Main.editSign = false; - } - else - { - Main.npcChatText = Main.GetInputText(Main.npcChatText); - if (Main.inputTextEnter) - { - byte[] bytes = new byte[] { 10 }; - Main.npcChatText = Main.npcChatText + Encoding.ASCII.GetString(bytes); - } - } - } - Rectangle rectangle5 = new Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height); - for (int num52 = 0; num52 < 0x3e8; num52++) - { - if ((Main.npc[num52].active && !Main.npc[num52].friendly) && rectangle5.Intersects(new Rectangle((int) Main.npc[num52].position.X, (int) Main.npc[num52].position.Y, Main.npc[num52].width, Main.npc[num52].height))) - { - int hitDirection = -1; - if ((Main.npc[num52].position.X + (Main.npc[num52].width / 2)) < (this.position.X + (this.width / 2))) - { - hitDirection = 1; - } - this.Hurt(Main.npc[num52].damage, hitDirection, false, false); - } - } - Vector2 vector = Collision.HurtTiles(this.position, this.velocity, this.width, this.height, this.fireWalk); - if (vector.Y != 0f) - { - this.Hurt((int) vector.Y, (int) vector.X, false, false); - } - } - if (this.grappling[0] >= 0) - { - this.rocketDelay = 0; - this.rocketFrame = false; - this.canRocket = false; - this.rocketRelease = false; - this.fallStart = (int) (this.position.Y / 16f); - float num54 = 0f; - float num55 = 0f; - for (int num56 = 0; num56 < this.grapCount; num56++) - { - num54 += Main.projectile[this.grappling[num56]].position.X + (Main.projectile[this.grappling[num56]].width / 2); - num55 += Main.projectile[this.grappling[num56]].position.Y + (Main.projectile[this.grappling[num56]].height / 2); - } - num54 /= (float) this.grapCount; - num55 /= (float) this.grapCount; - Vector2 vector2 = new Vector2(this.position.X + (this.width * 0.5f), this.position.Y + (this.height * 0.5f)); - float num57 = num54 - vector2.X; - float num58 = num55 - vector2.Y; - float num59 = (float) Math.Sqrt((double) ((num57 * num57) + (num58 * num58))); - float num60 = 11f; - float num61 = num59; - if (num59 > num60) - { - num61 = num60 / num59; - } - else - { - num61 = 1f; - } - num57 *= num61; - num58 *= num61; - this.velocity.X = num57; - this.velocity.Y = num58; - if (this.itemAnimation == 0) - { - if (this.velocity.X > 0f) - { - this.direction = 1; - } - if (this.velocity.X < 0f) - { - this.direction = -1; - } - } - if (this.controlJump) - { - if (this.releaseJump) - { - if ((this.velocity.Y == 0f) || ((this.wet && (this.velocity.Y > -0.02)) && (this.velocity.Y < 0.02))) - { - this.velocity.Y = -jumpSpeed; - this.jump = jumpHeight / 2; - this.releaseJump = false; - } - else - { - this.velocity.Y += 0.01f; - this.releaseJump = false; - } - if (this.doubleJump) - { - this.jumpAgain = true; - } - this.grappling[0] = 0; - this.grapCount = 0; - for (int num62 = 0; num62 < 0x3e8; num62++) - { - if ((Main.projectile[num62].active && (Main.projectile[num62].owner == i)) && (Main.projectile[num62].aiStyle == 7)) - { - Main.projectile[num62].Kill(); - } - } - } - } - else - { - this.releaseJump = true; - } - } - if (Collision.StickyTiles(this.position, this.velocity, this.width, this.height)) - { - this.fallStart = (int) (this.position.Y / 16f); - this.jump = 0; - if (this.velocity.X > 1f) - { - this.velocity.X = 1f; - } - if (this.velocity.X < -1f) - { - this.velocity.X = -1f; - } - if (this.velocity.Y > 1f) - { - this.velocity.Y = 1f; - } - if (this.velocity.Y < -5f) - { - this.velocity.Y = -5f; - } - if ((this.velocity.X > 0.75) || (this.velocity.X < -0.75)) - { - this.velocity.X *= 0.85f; - } - else - { - this.velocity.X *= 0.6f; - } - if (this.velocity.Y < 0f) - { - this.velocity.Y *= 0.96f; - } - else - { - this.velocity.Y *= 0.3f; - } - } - bool flag6 = Collision.DrownCollision(this.position, this.width, this.height); - if (this.inventory[this.selectedItem].type == 0xba) - { - try - { - int num63 = (int) (((this.position.X + (this.width / 2)) + (6 * this.direction)) / 16f); - int num64 = (int) ((this.position.Y - 44f) / 16f); - if (Main.tile[num63, num64].liquid < 0x80) - { - if (Main.tile[num63, num64] == null) - { - Main.tile[num63, num64] = new Tile(); - } - if ((!Main.tile[num63, num64].active || !Main.tileSolid[Main.tile[num63, num64].type]) || Main.tileSolidTop[Main.tile[num63, num64].type]) - { - flag6 = false; - } - } - } - catch - { - } - } - if (Main.myPlayer == i) - { - if (flag6) - { - this.breathCD++; - int num65 = 7; - if (this.inventory[this.selectedItem].type == 0xba) - { - num65 *= 2; - } - if (this.breathCD >= num65) - { - this.breathCD = 0; - this.breath--; - if (this.breath <= 0) - { - this.breath = 0; - this.statLife -= 2; - if (this.statLife <= 0) - { - this.statLife = 0; - this.KillMe(10.0, 0, false); - } - } - } - } - else - { - this.breath += 3; - if (this.breath > this.breathMax) - { - this.breath = this.breathMax; - } - this.breathCD = 0; - } - } - if (flag6 && (Main.rand.Next(20) == 0)) - { - if (this.inventory[this.selectedItem].type == 0xba) - { - color = new Color(); - Dust.NewDust(new Vector2((this.position.X + (10 * this.direction)) + 4f, this.position.Y - 54f), this.width - 8, 8, 0x22, 0f, 0f, 0, color, 1.2f); - } - else - { - color = new Color(); - Dust.NewDust(new Vector2(this.position.X + (12 * this.direction), this.position.Y + 4f), this.width - 8, 8, 0x22, 0f, 0f, 0, color, 1.2f); - } - } - bool flag7 = Collision.LavaCollision(this.position, this.width, this.height); - if (flag7) - { - if (Main.myPlayer == i) - { - this.Hurt(100, 0, false, false); - } - this.lavaWet = true; - } - if (Collision.WetCollision(this.position, this.width, this.height)) - { - if (!this.wet) - { - if (this.wetCount == 0) - { - this.wetCount = 10; - if (!flag7) - { - for (int num66 = 0; num66 < 50; num66++) - { - color = new Color(); - int num67 = Dust.NewDust(new Vector2(this.position.X - 6f, (this.position.Y + (this.height / 2)) - 8f), this.width + 12, 0x18, 0x21, 0f, 0f, 0, color, 1f); - Main.dust[num67].velocity.Y -= 4f; - Main.dust[num67].velocity.X *= 2.5f; - Main.dust[num67].scale = 1.3f; - Main.dust[num67].alpha = 100; - Main.dust[num67].noGravity = true; - } - Main.PlaySound(0x13, (int) this.position.X, (int) this.position.Y, 0); - } - else - { - for (int num68 = 0; num68 < 20; num68++) - { - color = new Color(); - int num69 = Dust.NewDust(new Vector2(this.position.X - 6f, (this.position.Y + (this.height / 2)) - 8f), this.width + 12, 0x18, 0x23, 0f, 0f, 0, color, 1f); - Main.dust[num69].velocity.Y -= 1.5f; - Main.dust[num69].velocity.X *= 2.5f; - Main.dust[num69].scale = 1.3f; - Main.dust[num69].alpha = 100; - Main.dust[num69].noGravity = true; - } - Main.PlaySound(0x13, (int) this.position.X, (int) this.position.Y, 1); - } - } - this.wet = true; - } - } - else if (this.wet) - { - this.wet = false; - if (this.jump > (jumpHeight / 5)) - { - this.jump = jumpHeight / 5; - } - if (this.wetCount == 0) - { - this.wetCount = 10; - if (!this.lavaWet) - { - for (int num70 = 0; num70 < 50; num70++) - { - color = new Color(); - int num71 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (this.height / 2)), this.width + 12, 0x18, 0x21, 0f, 0f, 0, color, 1f); - Main.dust[num71].velocity.Y -= 4f; - Main.dust[num71].velocity.X *= 2.5f; - Main.dust[num71].scale = 1.3f; - Main.dust[num71].alpha = 100; - Main.dust[num71].noGravity = true; - } - Main.PlaySound(0x13, (int) this.position.X, (int) this.position.Y, 0); - } - else - { - for (int num72 = 0; num72 < 20; num72++) - { - color = new Color(); - int num73 = Dust.NewDust(new Vector2(this.position.X - 6f, (this.position.Y + (this.height / 2)) - 8f), this.width + 12, 0x18, 0x23, 0f, 0f, 0, color, 1f); - Main.dust[num73].velocity.Y -= 1.5f; - Main.dust[num73].velocity.X *= 2.5f; - Main.dust[num73].scale = 1.3f; - Main.dust[num73].alpha = 100; - Main.dust[num73].noGravity = true; - } - Main.PlaySound(0x13, (int) this.position.X, (int) this.position.Y, 1); - } - } - } - if (!this.wet) - { - this.lavaWet = false; - } - if (this.wetCount > 0) - { - this.wetCount = (byte) (this.wetCount - 1); - } - if (this.wet) - { - if (this.wet) - { - Vector2 velocity = this.velocity; - this.velocity = Collision.TileCollision(this.position, this.velocity, this.width, this.height, this.controlDown, false); - Vector2 vector4 = (Vector2) (this.velocity * 0.5f); - if (this.velocity.X != velocity.X) - { - vector4.X = this.velocity.X; - } - if (this.velocity.Y != velocity.Y) - { - vector4.Y = this.velocity.Y; - } - this.position += vector4; - } - } - else - { - this.velocity = Collision.TileCollision(this.position, this.velocity, this.width, this.height, this.controlDown, false); - this.position += this.velocity; - } - if (this.position.X < ((Main.leftWorld + 336f) + 16f)) - { - this.position.X = (Main.leftWorld + 336f) + 16f; - this.velocity.X = 0f; - } - if ((this.position.X + this.width) > ((Main.rightWorld - 336f) - 32f)) - { - this.position.X = ((Main.rightWorld - 336f) - 32f) - this.width; - this.velocity.X = 0f; - } - if (this.position.Y < ((Main.topWorld + 336f) + 16f)) - { - this.position.Y = (Main.topWorld + 336f) + 16f; - this.velocity.Y = 0f; - } - if (this.position.Y > (((Main.bottomWorld - 336f) - 32f) - this.height)) - { - this.position.Y = ((Main.bottomWorld - 336f) - 32f) - this.height; - this.velocity.Y = 0f; - } - this.ItemCheck(i); - this.PlayerFrame(); - if (this.statLife > this.statLifeMax) - { - this.statLife = this.statLifeMax; - } - this.grappling[0] = -1; - this.grapCount = 0; - } - } - } - } -} - diff --git a/Terraria/Program.cs b/Terraria/Program.cs deleted file mode 100644 index a87762aa..00000000 --- a/Terraria/Program.cs +++ /dev/null @@ -1,16 +0,0 @@ -namespace Terraria -{ - using System; - - internal static class Program - { - private static void Main(string[] args) - { - using (Terraria.Main main = new Terraria.Main()) - { - main.Run(); - } - } - } -} - diff --git a/Terraria/Projectile.cs b/Terraria/Projectile.cs deleted file mode 100644 index 20a310bf..00000000 --- a/Terraria/Projectile.cs +++ /dev/null @@ -1,2539 +0,0 @@ -namespace Terraria -{ - using Microsoft.Xna.Framework; - using System; - using System.Runtime.InteropServices; - - public class Projectile - { - public bool active; - - public int aiStyle; - public int alpha; - public int damage; - public int direction; - public bool friendly; - public int height; - public bool hostile; - public int identity; - public bool ignoreWater; - public float knockBack; - public bool lavaWet; - public float light; - public static int maxAI = 2; - public int maxUpdates; - public string name = ""; - public bool netUpdate; - public int numUpdates; - public int owner = 8; - public int penetrate = 1; - public int[] playerImmune = new int[8]; - public Vector2 position; - public int restrikeDelay; - public float rotation; - public float scale = 1f; - public int soundDelay; - public bool tileCollide; - public int timeLeft; - public int type; - public Vector2 velocity; - public bool wet; - public byte wetCount; - public int whoAmI; - public int width; - public float[] ai = new float[maxAI]; - public void AI() - { - if (this.aiStyle == 1) - { - if (((this.type == 20) || (this.type == 14)) || (this.type == 0x24)) - { - if (this.alpha > 0) - { - this.alpha -= 15; - } - if (this.alpha < 0) - { - this.alpha = 0; - } - } - if (((this.type != 5) && (this.type != 14)) && ((this.type != 20) && (this.type != 0x24))) - { - this.ai[0]++; - } - if (this.ai[0] >= 15f) - { - this.ai[0] = 15f; - this.velocity.Y += 0.1f; - } - this.rotation = ((float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X)) + 1.57f; - if (this.velocity.Y > 16f) - { - this.velocity.Y = 16f; - } - } - else if (this.aiStyle == 2) - { - this.ai[0]++; - if (this.ai[0] >= 20f) - { - this.velocity.Y += 0.4f; - this.velocity.X *= 0.97f; - } - this.rotation += ((Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) * 0.03f) * this.direction; - if (this.velocity.Y > 16f) - { - this.velocity.Y = 16f; - } - } - else - { - Color color; - if (this.aiStyle == 3) - { - if (this.soundDelay == 0) - { - this.soundDelay = 8; - Main.PlaySound(2, (int) this.position.X, (int) this.position.Y, 7); - } - if (this.type == 0x13) - { - for (int i = 0; i < 2; i++) - { - color = new Color(); - int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, color, 2f); - Main.dust[index].noGravity = true; - Main.dust[index].velocity.X *= 0.3f; - Main.dust[index].velocity.Y *= 0.3f; - } - } - else if (this.type == 0x21) - { - if (Main.rand.Next(1) == 0) - { - int num3 = Dust.NewDust(this.position, this.width, this.height, 40, this.velocity.X * 0.25f, this.velocity.Y * 0.25f, 0, new Color(), 1.4f); - Main.dust[num3].noGravity = true; - } - } - else if (Main.rand.Next(5) == 0) - { - Dust.NewDust(this.position, this.width, this.height, 15, this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 150, new Color(), 0.9f); - } - if (this.ai[0] == 0f) - { - this.ai[1]++; - if (this.ai[1] >= 30f) - { - this.ai[0] = 1f; - this.ai[1] = 0f; - this.netUpdate = true; - } - } - else - { - this.tileCollide = false; - float num4 = 9f; - float num5 = 0.4f; - if (this.type == 0x13) - { - num4 = 13f; - num5 = 0.6f; - } - else if (this.type == 0x21) - { - num4 = 15f; - num5 = 0.8f; - } - Vector2 vector = new Vector2(this.position.X + (this.width * 0.5f), this.position.Y + (this.height * 0.5f)); - float num6 = (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2)) - vector.X; - float num7 = (Main.player[this.owner].position.Y + (Main.player[this.owner].height / 2)) - vector.Y; - float num8 = (float) Math.Sqrt((double) ((num6 * num6) + (num7 * num7))); - num8 = num4 / num8; - num6 *= num8; - num7 *= num8; - if (this.velocity.X < num6) - { - this.velocity.X += num5; - if ((this.velocity.X < 0f) && (num6 > 0f)) - { - this.velocity.X += num5; - } - } - else if (this.velocity.X > num6) - { - this.velocity.X -= num5; - if ((this.velocity.X > 0f) && (num6 < 0f)) - { - this.velocity.X -= num5; - } - } - if (this.velocity.Y < num7) - { - this.velocity.Y += num5; - if ((this.velocity.Y < 0f) && (num7 > 0f)) - { - this.velocity.Y += num5; - } - } - else if (this.velocity.Y > num7) - { - this.velocity.Y -= num5; - if ((this.velocity.Y > 0f) && (num7 < 0f)) - { - this.velocity.Y -= num5; - } - } - if (Main.myPlayer == this.owner) - { - Rectangle rectangle = new Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height); - Rectangle rectangle2 = new Rectangle((int) Main.player[this.owner].position.X, (int) Main.player[this.owner].position.Y, Main.player[this.owner].width, Main.player[this.owner].height); - if (rectangle.Intersects(rectangle2)) - { - this.Kill(); - } - } - } - this.rotation += 0.4f * this.direction; - } - else if (this.aiStyle == 4) - { - this.rotation = ((float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X)) + 1.57f; - if (this.ai[0] != 0f) - { - if ((this.alpha < 170) && ((this.alpha + 5) >= 170)) - { - for (int j = 0; j < 3; j++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 0x12, this.velocity.X * 0.025f, this.velocity.Y * 0.025f, 170, color, 1.2f); - } - Dust.NewDust(this.position, this.width, this.height, 14, 0f, 0f, 170, new Color(), 1.1f); - } - this.alpha += 5; - if (this.alpha >= 0xff) - { - this.Kill(); - } - } - else - { - this.alpha -= 50; - if (this.alpha <= 0) - { - this.alpha = 0; - this.ai[0] = 1f; - if (this.ai[1] == 0f) - { - this.ai[1]++; - this.position += (Vector2) (this.velocity * 1f); - } - if ((this.type == 7) && (Main.myPlayer == this.owner)) - { - int type = this.type; - if (this.ai[1] >= 6f) - { - type++; - } - int num10 = NewProjectile((this.position.X + this.velocity.X) + (this.width / 2), (this.position.Y + this.velocity.Y) + (this.height / 2), this.velocity.X, this.velocity.Y, type, this.damage, this.knockBack, this.owner); - Main.projectile[num10].damage = this.damage; - Main.projectile[num10].ai[1] = this.ai[1] + 1f; - NetMessage.SendData(0x1b, -1, -1, "", num10, 0f, 0f, 0f); - } - } - } - } - else if (this.aiStyle == 5) - { - if (this.soundDelay == 0) - { - this.soundDelay = 20 + Main.rand.Next(40); - Main.PlaySound(2, (int) this.position.X, (int) this.position.Y, 9); - } - if (this.ai[0] == 0f) - { - this.ai[0] = 1f; - } - this.alpha += (int) (25f * this.ai[0]); - if (this.alpha > 200) - { - this.alpha = 200; - this.ai[0] = -1f; - } - if (this.alpha < 0) - { - this.alpha = 0; - this.ai[0] = 1f; - } - this.rotation += ((Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) * 0.01f) * this.direction; - if (Main.rand.Next(10) == 0) - { - Dust.NewDust(this.position, this.width, this.height, 15, this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 150, new Color(), 1.2f); - } - if (Main.rand.Next(20) == 0) - { - Gore.NewGore(this.position, new Vector2(this.velocity.X * 0.2f, this.velocity.Y * 0.2f), Main.rand.Next(0x10, 0x12)); - } - } - else if (this.aiStyle == 6) - { - this.velocity = (Vector2) (this.velocity * 0.95f); - this.ai[0]++; - if (this.ai[0] == 180f) - { - this.Kill(); - } - if (this.ai[1] == 0f) - { - this.ai[1] = 1f; - for (int k = 0; k < 30; k++) - { - color = new Color(); - Dust.NewDust(this.position, this.width, this.height, 10 + this.type, this.velocity.X, this.velocity.Y, 50, color, 1f); - } - } - if (this.type == 10) - { - int num13 = ((int) (this.position.X / 16f)) - 1; - int maxTilesX = ((int) ((this.position.X + this.width) / 16f)) + 2; - int num15 = ((int) (this.position.Y / 16f)) - 1; - int maxTilesY = ((int) ((this.position.Y + this.height) / 16f)) + 2; - if (num13 < 0) - { - num13 = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num15 < 0) - { - num15 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int m = num13; m < maxTilesX; m++) - { - for (int n = num15; n < maxTilesY; n++) - { - Vector2 vector2; - vector2.X = m * 0x10; - vector2.Y = n * 0x10; - if (((((this.position.X + this.width) > vector2.X) && (this.position.X < (vector2.X + 16f))) && (((this.position.Y + this.height) > vector2.Y) && (this.position.Y < (vector2.Y + 16f)))) && ((Main.myPlayer == this.owner) && Main.tile[m, n].active)) - { - if (Main.tile[m, n].type == 0x17) - { - Main.tile[m, n].type = 2; - WorldGen.SquareTileFrame(m, n, true); - if (Main.netMode == 1) - { - NetMessage.SendTileSquare(-1, m - 1, n - 1, 3); - } - } - if (Main.tile[m, n].type == 0x19) - { - Main.tile[m, n].type = 1; - WorldGen.SquareTileFrame(m, n, true); - if (Main.netMode == 1) - { - NetMessage.SendTileSquare(-1, m - 1, n - 1, 3); - } - } - } - } - } - } - } - else if (this.aiStyle == 7) - { - if (Main.player[this.owner].dead) - { - this.Kill(); - } - else - { - Vector2 vector3 = new Vector2(this.position.X + (this.width * 0.5f), this.position.Y + (this.height * 0.5f)); - float num19 = (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2)) - vector3.X; - float num20 = (Main.player[this.owner].position.Y + (Main.player[this.owner].height / 2)) - vector3.Y; - float num21 = (float) Math.Sqrt((double) ((num19 * num19) + (num20 * num20))); - this.rotation = ((float) Math.Atan2((double) num20, (double) num19)) - 1.57f; - if (this.ai[0] == 0f) - { - if (((num21 > 300f) && (this.type == 13)) || ((num21 > 400f) && (this.type == 0x20))) - { - this.ai[0] = 1f; - } - int num22 = ((int) (this.position.X / 16f)) - 1; - int num23 = ((int) ((this.position.X + this.width) / 16f)) + 2; - int num24 = ((int) (this.position.Y / 16f)) - 1; - int num25 = ((int) ((this.position.Y + this.height) / 16f)) + 2; - if (num22 < 0) - { - num22 = 0; - } - if (num23 > Main.maxTilesX) - { - num23 = Main.maxTilesX; - } - if (num24 < 0) - { - num24 = 0; - } - if (num25 > Main.maxTilesY) - { - num25 = Main.maxTilesY; - } - for (int num26 = num22; num26 < num23; num26++) - { - for (int num27 = num24; num27 < num25; num27++) - { - Vector2 vector4; - if (Main.tile[num26, num27] == null) - { - Main.tile[num26, num27] = new Tile(); - } - vector4.X = num26 * 0x10; - vector4.Y = num27 * 0x10; - if (((((this.position.X + this.width) > vector4.X) && (this.position.X < (vector4.X + 16f))) && (((this.position.Y + this.height) > vector4.Y) && (this.position.Y < (vector4.Y + 16f)))) && (Main.tile[num26, num27].active && Main.tileSolid[Main.tile[num26, num27].type])) - { - if (Main.player[this.owner].grapCount < 10) - { - Main.player[this.owner].grappling[Main.player[this.owner].grapCount] = this.whoAmI; - Player player1 = Main.player[this.owner]; - player1.grapCount++; - } - if (Main.myPlayer == this.owner) - { - int num28 = 0; - int num29 = -1; - int timeLeft = 0x186a0; - for (int num31 = 0; num31 < 0x3e8; num31++) - { - if ((Main.projectile[num31].active && (Main.projectile[num31].owner == this.owner)) && (Main.projectile[num31].aiStyle == 7)) - { - if (Main.projectile[num31].timeLeft < timeLeft) - { - num29 = num31; - timeLeft = Main.projectile[num31].timeLeft; - } - num28++; - } - } - if (num28 > 3) - { - Main.projectile[num29].Kill(); - } - } - WorldGen.KillTile(num26, num27, true, true, false); - Main.PlaySound(0, num26 * 0x10, num27 * 0x10, 1); - this.velocity.X = 0f; - this.velocity.Y = 0f; - this.ai[0] = 2f; - this.position.X = ((num26 * 0x10) + 8) - (this.width / 2); - this.position.Y = ((num27 * 0x10) + 8) - (this.height / 2); - this.damage = 0; - this.netUpdate = true; - if (Main.myPlayer == this.owner) - { - NetMessage.SendData(13, -1, -1, "", this.owner, 0f, 0f, 0f); - } - break; - } - } - if (this.ai[0] == 2f) - { - return; - } - } - } - else if (this.ai[0] == 1f) - { - float num32 = 11f; - if (this.type == 0x20) - { - num32 = 15f; - } - if (num21 < 24f) - { - this.Kill(); - } - num21 = num32 / num21; - num19 *= num21; - num20 *= num21; - this.velocity.X = num19; - this.velocity.Y = num20; - } - else if (this.ai[0] == 2f) - { - int num33 = ((int) (this.position.X / 16f)) - 1; - int num34 = ((int) ((this.position.X + this.width) / 16f)) + 2; - int num35 = ((int) (this.position.Y / 16f)) - 1; - int num36 = ((int) ((this.position.Y + this.height) / 16f)) + 2; - if (num33 < 0) - { - num33 = 0; - } - if (num34 > Main.maxTilesX) - { - num34 = Main.maxTilesX; - } - if (num35 < 0) - { - num35 = 0; - } - if (num36 > Main.maxTilesY) - { - num36 = Main.maxTilesY; - } - bool flag = true; - for (int num37 = num33; num37 < num34; num37++) - { - for (int num38 = num35; num38 < num36; num38++) - { - Vector2 vector5; - if (Main.tile[num37, num38] == null) - { - Main.tile[num37, num38] = new Tile(); - } - vector5.X = num37 * 0x10; - vector5.Y = num38 * 0x10; - if (((((this.position.X + (this.width / 2)) > vector5.X) && ((this.position.X + (this.width / 2)) < (vector5.X + 16f))) && (((this.position.Y + (this.height / 2)) > vector5.Y) && ((this.position.Y + (this.height / 2)) < (vector5.Y + 16f)))) && (Main.tile[num37, num38].active && Main.tileSolid[Main.tile[num37, num38].type])) - { - flag = false; - } - } - } - if (flag) - { - this.ai[0] = 1f; - } - else if (Main.player[this.owner].grapCount < 10) - { - Main.player[this.owner].grappling[Main.player[this.owner].grapCount] = this.whoAmI; - Player player2 = Main.player[this.owner]; - player2.grapCount++; - } - } - } - } - else if (this.aiStyle == 8) - { - if (this.type == 0x1b) - { - color = new Color(); - int num39 = Dust.NewDust(new Vector2(this.position.X + this.velocity.X, this.position.Y + this.velocity.Y), this.width, this.height, 0x1d, this.velocity.X, this.velocity.Y, 100, color, 3f); - Main.dust[num39].noGravity = true; - num39 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 0x1d, this.velocity.X, this.velocity.Y, 100, new Color(), 1.5f); - } - else - { - for (int num40 = 0; num40 < 2; num40++) - { - color = new Color(); - int num41 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, color, 2f); - Main.dust[num41].noGravity = true; - Main.dust[num41].velocity.X *= 0.3f; - Main.dust[num41].velocity.Y *= 0.3f; - } - } - if (this.type != 0x1b) - { - this.ai[1]++; - } - if (this.ai[1] >= 20f) - { - this.velocity.Y += 0.2f; - } - this.rotation += 0.3f * this.direction; - if (this.velocity.Y > 16f) - { - this.velocity.Y = 16f; - } - } - else if (this.aiStyle == 9) - { - if (this.type == 0x22) - { - color = new Color(); - int num42 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, color, 3.5f); - Main.dust[num42].noGravity = true; - Dust dust1 = Main.dust[num42]; - dust1.velocity = (Vector2) (dust1.velocity * 1.4f); - num42 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, this.velocity.X * 0.2f, this.velocity.Y * 0.2f, 100, new Color(), 1.5f); - } - else - { - if ((this.soundDelay == 0) && ((Math.Abs(this.velocity.X) + Math.Abs(this.velocity.Y)) > 2f)) - { - this.soundDelay = 10; - Main.PlaySound(2, (int) this.position.X, (int) this.position.Y, 9); - } - int num43 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 15, 0f, 0f, 100, new Color(), 2f); - Dust dust2 = Main.dust[num43]; - dust2.velocity = (Vector2) (dust2.velocity * 0.3f); - Main.dust[num43].position.X = ((this.position.X + (this.width / 2)) + 4f) + Main.rand.Next(-4, 5); - Main.dust[num43].position.Y = (this.position.Y + (this.height / 2)) + Main.rand.Next(-4, 5); - Main.dust[num43].noGravity = true; - } - if ((Main.myPlayer == this.owner) && (this.ai[0] == 0f)) - { - if (Main.player[this.owner].channel) - { - float num44 = 12f; - Vector2 vector6 = new Vector2(this.position.X + (this.width * 0.5f), this.position.Y + (this.height * 0.5f)); - float num45 = (Main.mouseState.X + Main.screenPosition.X) - vector6.X; - float num46 = (Main.mouseState.Y + Main.screenPosition.Y) - vector6.Y; - float num47 = (float) Math.Sqrt((double) ((num45 * num45) + (num46 * num46))); - num47 = (float) Math.Sqrt((double) ((num45 * num45) + (num46 * num46))); - if (num47 > num44) - { - num47 = num44 / num47; - num45 *= num47; - num46 *= num47; - if ((num45 != this.velocity.X) || (num46 != this.velocity.Y)) - { - this.netUpdate = true; - } - this.velocity.X = num45; - this.velocity.Y = num46; - } - else - { - if ((num45 != this.velocity.X) || (num46 != this.velocity.Y)) - { - this.netUpdate = true; - } - this.velocity.X = num45; - this.velocity.Y = num46; - } - } - else - { - this.Kill(); - } - } - if (this.type == 0x22) - { - this.rotation += 0.3f * this.direction; - } - else if ((this.velocity.X != 0f) || (this.velocity.Y != 0f)) - { - this.rotation = ((float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X)) - 2.355f; - } - if (this.velocity.Y > 16f) - { - this.velocity.Y = 16f; - } - } - else if (this.aiStyle == 10) - { - if (this.type == 0x1f) - { - if (Main.rand.Next(2) == 0) - { - int num48 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 0x20, 0f, this.velocity.Y / 2f, 0, new Color(), 1f); - Main.dust[num48].velocity.X *= 0.4f; - } - } - else if (Main.rand.Next(20) == 0) - { - Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 0, 0f, 0f, 0, new Color(), 1f); - } - if ((Main.myPlayer == this.owner) && (this.ai[0] == 0f)) - { - if (Main.player[this.owner].channel) - { - float num49 = 12f; - Vector2 vector7 = new Vector2(this.position.X + (this.width * 0.5f), this.position.Y + (this.height * 0.5f)); - float num50 = (Main.mouseState.X + Main.screenPosition.X) - vector7.X; - float num51 = (Main.mouseState.Y + Main.screenPosition.Y) - vector7.Y; - float num52 = (float) Math.Sqrt((double) ((num50 * num50) + (num51 * num51))); - num52 = (float) Math.Sqrt((double) ((num50 * num50) + (num51 * num51))); - if (num52 > num49) - { - num52 = num49 / num52; - num50 *= num52; - num51 *= num52; - if ((num50 != this.velocity.X) || (num51 != this.velocity.Y)) - { - this.netUpdate = true; - } - this.velocity.X = num50; - this.velocity.Y = num51; - } - else - { - if ((num50 != this.velocity.X) || (num51 != this.velocity.Y)) - { - this.netUpdate = true; - } - this.velocity.X = num50; - this.velocity.Y = num51; - } - } - else - { - this.ai[0] = 1f; - this.netUpdate = true; - } - } - if (this.ai[0] == 1f) - { - this.velocity.Y += 0.41f; - } - this.rotation += 0.1f; - if (this.velocity.Y > 10f) - { - this.velocity.Y = 10f; - } - } - else if (this.aiStyle == 11) - { - this.rotation += 0.02f; - if (Main.myPlayer == this.owner) - { - if (!Main.player[this.owner].dead) - { - float num53 = 4f; - Vector2 vector8 = new Vector2(this.position.X + (this.width * 0.5f), this.position.Y + (this.height * 0.5f)); - float num54 = (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2)) - vector8.X; - float num55 = (Main.player[this.owner].position.Y + (Main.player[this.owner].height / 2)) - vector8.Y; - float num56 = (float) Math.Sqrt((double) ((num54 * num54) + (num55 * num55))); - num56 = (float) Math.Sqrt((double) ((num54 * num54) + (num55 * num55))); - if (num56 > Main.screenWidth) - { - this.position.X = (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2)) - (this.width / 2); - this.position.Y = (Main.player[this.owner].position.Y + (Main.player[this.owner].height / 2)) - (this.height / 2); - } - else if (num56 > 64f) - { - num56 = num53 / num56; - num54 *= num56; - num55 *= num56; - if ((num54 != this.velocity.X) || (num55 != this.velocity.Y)) - { - this.netUpdate = true; - } - this.velocity.X = num54; - this.velocity.Y = num55; - } - else - { - if ((this.velocity.X != 0f) || (this.velocity.Y != 0f)) - { - this.netUpdate = true; - } - this.velocity.X = 0f; - this.velocity.Y = 0f; - } - } - else - { - this.Kill(); - } - } - } - else if (this.aiStyle == 12) - { - this.scale -= 0.05f; - if (this.scale <= 0f) - { - this.Kill(); - } - if (this.ai[0] > 4f) - { - this.alpha = 150; - this.light = 0.8f; - color = new Color(); - int num57 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 0x1d, this.velocity.X, this.velocity.Y, 100, color, 2.5f); - Main.dust[num57].noGravity = true; - Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 0x1d, this.velocity.X, this.velocity.Y, 100, new Color(), 1.5f); - } - else - { - this.ai[0]++; - } - this.rotation += 0.3f * this.direction; - } - else if (this.aiStyle == 13) - { - if (Main.player[this.owner].dead) - { - this.Kill(); - } - else - { - Main.player[this.owner].itemAnimation = 5; - Main.player[this.owner].itemTime = 5; - if ((this.position.X + (this.width / 2)) > (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2))) - { - Main.player[this.owner].direction = 1; - } - else - { - Main.player[this.owner].direction = -1; - } - Vector2 vector9 = new Vector2(this.position.X + (this.width * 0.5f), this.position.Y + (this.height * 0.5f)); - float num58 = (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2)) - vector9.X; - float num59 = (Main.player[this.owner].position.Y + (Main.player[this.owner].height / 2)) - vector9.Y; - float num60 = (float) Math.Sqrt((double) ((num58 * num58) + (num59 * num59))); - if (this.ai[0] != 0f) - { - if (this.ai[0] == 1f) - { - this.tileCollide = false; - this.rotation = ((float) Math.Atan2((double) num59, (double) num58)) - 1.57f; - float num61 = 11f; - if (num60 < 50f) - { - this.Kill(); - } - num60 = num61 / num60; - num58 *= num60; - num59 *= num60; - this.velocity.X = num58; - this.velocity.Y = num59; - } - } - else - { - if (num60 > 600f) - { - this.ai[0] = 1f; - } - this.rotation = ((float) Math.Atan2((double) this.velocity.Y, (double) this.velocity.X)) + 1.57f; - this.ai[1]++; - if (this.ai[1] > 2f) - { - this.alpha = 0; - } - if (this.ai[1] >= 10f) - { - this.ai[1] = 15f; - this.velocity.Y += 0.3f; - } - } - } - } - else if (this.aiStyle == 14) - { - this.ai[0]++; - if (this.ai[0] > 5f) - { - this.ai[0] = 5f; - if ((this.velocity.Y == 0f) && (this.velocity.X != 0f)) - { - this.velocity.X *= 0.97f; - if ((this.velocity.X > -0.01) && (this.velocity.X < 0.01)) - { - this.velocity.X = 0f; - this.netUpdate = true; - } - } - this.velocity.Y += 0.2f; - } - this.rotation += this.velocity.X * 0.1f; - } - else if (this.aiStyle == 15) - { - if (this.type == 0x19) - { - if (Main.rand.Next(15) == 0) - { - Dust.NewDust(this.position, this.width, this.height, 14, 0f, 0f, 150, new Color(), 1.3f); - } - } - else if (this.type == 0x1a) - { - int num62 = Dust.NewDust(this.position, this.width, this.height, 0x1d, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 100, new Color(), 2.5f); - Main.dust[num62].noGravity = true; - Main.dust[num62].velocity.X /= 2f; - Main.dust[num62].velocity.Y /= 2f; - } - else if (this.type == 0x23) - { - int num63 = Dust.NewDust(this.position, this.width, this.height, 6, this.velocity.X * 0.4f, this.velocity.Y * 0.4f, 100, new Color(), 3f); - Main.dust[num63].noGravity = true; - Main.dust[num63].velocity.X *= 2f; - Main.dust[num63].velocity.Y *= 2f; - } - if (Main.player[this.owner].dead) - { - this.Kill(); - } - else - { - Main.player[this.owner].itemAnimation = 5; - Main.player[this.owner].itemTime = 5; - if ((this.position.X + (this.width / 2)) > (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2))) - { - Main.player[this.owner].direction = 1; - } - else - { - Main.player[this.owner].direction = -1; - } - Vector2 vector10 = new Vector2(this.position.X + (this.width * 0.5f), this.position.Y + (this.height * 0.5f)); - float num64 = (Main.player[this.owner].position.X + (Main.player[this.owner].width / 2)) - vector10.X; - float num65 = (Main.player[this.owner].position.Y + (Main.player[this.owner].height / 2)) - vector10.Y; - float num66 = (float) Math.Sqrt((double) ((num64 * num64) + (num65 * num65))); - if (this.ai[0] == 0f) - { - this.tileCollide = true; - if (num66 > 300f) - { - this.ai[0] = 1f; - } - else - { - this.ai[1]++; - if (this.ai[1] > 2f) - { - this.alpha = 0; - } - if (this.ai[1] >= 5f) - { - this.ai[1] = 15f; - this.velocity.Y += 0.5f; - this.velocity.X *= 0.95f; - } - } - } - else if (this.ai[0] == 1f) - { - this.tileCollide = false; - float num67 = 11f; - if (num66 < 20f) - { - this.Kill(); - } - num66 = num67 / num66; - num64 *= num66; - num65 *= num66; - this.velocity.X = num64; - this.velocity.Y = num65; - } - this.rotation += this.velocity.X * 0.03f; - } - } - else if (this.aiStyle == 0x10) - { - if (((this.owner == Main.myPlayer) && (this.timeLeft <= 3)) && (this.ai[1] == 0f)) - { - this.ai[1] = 1f; - this.netUpdate = true; - } - if (this.type == 0x25) - { - try - { - int num68 = ((int) (this.position.X / 16f)) - 1; - int num69 = ((int) ((this.position.X + this.width) / 16f)) + 2; - int num70 = ((int) (this.position.Y / 16f)) - 1; - int num71 = ((int) ((this.position.Y + this.height) / 16f)) + 2; - if (num68 < 0) - { - num68 = 0; - } - if (num69 > Main.maxTilesX) - { - num69 = Main.maxTilesX; - } - if (num70 < 0) - { - num70 = 0; - } - if (num71 > Main.maxTilesY) - { - num71 = Main.maxTilesY; - } - for (int num72 = num68; num72 < num69; num72++) - { - for (int num73 = num70; num73 < num71; num73++) - { - if (((Main.tile[num72, num73] != null) && Main.tile[num72, num73].active) && (Main.tileSolid[Main.tile[num72, num73].type] || (Main.tileSolidTop[Main.tile[num72, num73].type] && (Main.tile[num72, num73].frameY == 0)))) - { - Vector2 vector11; - vector11.X = num72 * 0x10; - vector11.Y = num73 * 0x10; - if (((((this.position.X + this.width) - 4f) > vector11.X) && ((this.position.X + 4f) < (vector11.X + 16f))) && ((((this.position.Y + this.height) - 4f) > vector11.Y) && ((this.position.Y + 4f) < (vector11.Y + 16f)))) - { - this.velocity.X = 0f; - this.velocity.Y = -0.2f; - } - } - } - } - } - catch - { - } - } - if (this.ai[1] > 0f) - { - this.alpha = 0xff; - if ((this.type == 0x1c) || (this.type == 0x25)) - { - this.position.X += this.width / 2; - this.position.Y += this.height / 2; - this.width = 0x80; - this.height = 0x80; - this.position.X -= this.width / 2; - this.position.Y -= this.height / 2; - this.damage = 100; - this.knockBack = 8f; - } - else if (this.type == 0x1d) - { - this.position.X += this.width / 2; - this.position.Y += this.height / 2; - this.width = 250; - this.height = 250; - this.position.X -= this.width / 2; - this.position.Y -= this.height / 2; - this.damage = 250; - this.knockBack = 10f; - } - else if (this.type == 30) - { - this.position.X += this.width / 2; - this.position.Y += this.height / 2; - this.width = 0x80; - this.height = 0x80; - this.position.X -= this.width / 2; - this.position.Y -= this.height / 2; - this.knockBack = 8f; - } - } - else if ((this.type != 30) && (Main.rand.Next(4) == 0)) - { - if (this.type != 30) - { - this.damage = 0; - } - Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, new Color(), 1f); - } - this.ai[0]++; - if (((this.type == 30) && (this.ai[0] > 10f)) || ((this.type != 30) && (this.ai[0] > 5f))) - { - this.ai[0] = 10f; - if ((this.velocity.Y == 0f) && (this.velocity.X != 0f)) - { - this.velocity.X *= 0.97f; - if (this.type == 0x1d) - { - this.velocity.X *= 0.99f; - } - if ((this.velocity.X > -0.01) && (this.velocity.X < 0.01)) - { - this.velocity.X = 0f; - this.netUpdate = true; - } - } - this.velocity.Y += 0.2f; - } - this.rotation += this.velocity.X * 0.1f; - } - } - } - - public Color GetAlpha(Color newColor) - { - int r; - int g; - int b; - if (((this.type == 9) || (this.type == 15)) || (this.type == 0x22)) - { - r = newColor.R - (this.alpha / 3); - g = newColor.G - (this.alpha / 3); - b = newColor.B - (this.alpha / 3); - } - else if ((this.type == 0x10) || (this.type == 0x12)) - { - r = newColor.R; - g = newColor.G; - b = newColor.B; - } - else - { - r = newColor.R - this.alpha; - g = newColor.G - this.alpha; - b = newColor.B - this.alpha; - } - int a = newColor.A - this.alpha; - if (a < 0) - { - a = 0; - } - if (a > 0xff) - { - a = 0xff; - } - return new Color(r, g, b, a); - } - - public void Kill() - { - if (this.active) - { - Color color; - if (this.type == 1) - { - Main.PlaySound(0, (int) this.position.X, (int) this.position.Y, 1); - for (int i = 0; i < 10; i++) - { - color = new Color(); - Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 7, 0f, 0f, 0, color, 1f); - } - } - else if (this.type == 2) - { - Main.PlaySound(0, (int) this.position.X, (int) this.position.Y, 1); - for (int j = 0; j < 20; j++) - { - Color newColor = new Color(); - Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, newColor, 1f); - } - } - else if (this.type == 3) - { - Main.PlaySound(0, (int) this.position.X, (int) this.position.Y, 1); - for (int k = 0; k < 10; k++) - { - Color color3 = new Color(); - Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 1, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 0, color3, 0.75f); - } - } - else if (this.type == 4) - { - Main.PlaySound(0, (int) this.position.X, (int) this.position.Y, 1); - for (int m = 0; m < 10; m++) - { - Color color4 = new Color(); - Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 14, 0f, 0f, 150, color4, 1.1f); - } - } - else if (this.type == 5) - { - Main.PlaySound(2, (int) this.position.X, (int) this.position.Y, 10); - for (int n = 0; n < 60; n++) - { - Color color5 = new Color(); - Dust.NewDust(this.position, this.width, this.height, 15, this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 150, color5, 1.5f); - } - } - else if ((this.type == 9) || (this.type == 12)) - { - Main.PlaySound(2, (int) this.position.X, (int) this.position.Y, 10); - for (int num6 = 0; num6 < 10; num6++) - { - Color color6 = new Color(); - Dust.NewDust(this.position, this.width, this.height, 15, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 150, color6, 1.2f); - } - for (int num7 = 0; num7 < 3; num7++) - { - Gore.NewGore(this.position, new Vector2(this.velocity.X * 0.05f, this.velocity.Y * 0.05f), Main.rand.Next(0x10, 0x12)); - } - if ((this.type == 12) && (this.damage < 100)) - { - for (int num8 = 0; num8 < 10; num8++) - { - Color color7 = new Color(); - Dust.NewDust(this.position, this.width, this.height, 15, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 150, color7, 1.2f); - } - for (int num9 = 0; num9 < 3; num9++) - { - Gore.NewGore(this.position, new Vector2(this.velocity.X * 0.05f, this.velocity.Y * 0.05f), Main.rand.Next(0x10, 0x12)); - } - } - } - else if (((this.type == 14) || (this.type == 20)) || (this.type == 0x24)) - { - Collision.HitTiles(this.position, this.velocity, this.width, this.height); - Main.PlaySound(2, (int) this.position.X, (int) this.position.Y, 10); - } - else if ((this.type == 15) || (this.type == 0x22)) - { - Main.PlaySound(2, (int) this.position.X, (int) this.position.Y, 10); - for (int num10 = 0; num10 < 20; num10++) - { - Color color8 = new Color(); - int index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, color8, 2f); - Main.dust[index].noGravity = true; - Dust dust1 = Main.dust[index]; - dust1.velocity = (Vector2) (dust1.velocity * 2f); - color = new Color(); - index = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, -this.velocity.X * 0.2f, -this.velocity.Y * 0.2f, 100, color, 1f); - Dust dust2 = Main.dust[index]; - dust2.velocity = (Vector2) (dust2.velocity * 2f); - } - } - else if (this.type == 0x10) - { - Main.PlaySound(2, (int) this.position.X, (int) this.position.Y, 10); - for (int num12 = 0; num12 < 20; num12++) - { - color = new Color(); - int num13 = Dust.NewDust(new Vector2(this.position.X - this.velocity.X, this.position.Y - this.velocity.Y), this.width, this.height, 15, 0f, 0f, 100, color, 2f); - Main.dust[num13].noGravity = true; - Dust dust3 = Main.dust[num13]; - dust3.velocity = (Vector2) (dust3.velocity * 2f); - color = new Color(); - num13 = Dust.NewDust(new Vector2(this.position.X - this.velocity.X, this.position.Y - this.velocity.Y), this.width, this.height, 15, 0f, 0f, 100, color, 1f); - } - } - else if (this.type == 0x11) - { - Main.PlaySound(0, (int) this.position.X, (int) this.position.Y, 1); - for (int num14 = 0; num14 < 5; num14++) - { - color = new Color(); - Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 0, 0f, 0f, 0, color, 1f); - } - } - else if (this.type == 0x1f) - { - Main.PlaySound(0, (int) this.position.X, (int) this.position.Y, 1); - for (int num15 = 0; num15 < 5; num15++) - { - color = new Color(); - int num16 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 0x20, 0f, 0f, 0, color, 1f); - Dust dust4 = Main.dust[num16]; - dust4.velocity = (Vector2) (dust4.velocity * 0.6f); - } - } - else if (this.type == 0x15) - { - Main.PlaySound(0, (int) this.position.X, (int) this.position.Y, 1); - for (int num17 = 0; num17 < 10; num17++) - { - color = new Color(); - Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 0x1a, 0f, 0f, 0, color, 0.8f); - } - } - else if (this.type == 0x18) - { - for (int num18 = 0; num18 < 10; num18++) - { - color = new Color(); - Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 1, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 0, color, 0.75f); - } - } - else if (this.type == 0x1b) - { - Main.PlaySound(2, (int) this.position.X, (int) this.position.Y, 10); - for (int num19 = 0; num19 < 30; num19++) - { - color = new Color(); - int num20 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 0x1d, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 100, color, 3f); - Main.dust[num20].noGravity = true; - color = new Color(); - Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 0x1d, this.velocity.X * 0.1f, this.velocity.Y * 0.1f, 100, color, 2f); - } - } - else - { - Vector2 vector; - if (((this.type == 0x1c) || (this.type == 30)) || (this.type == 0x25)) - { - Main.PlaySound(2, (int) this.position.X, (int) this.position.Y, 14); - this.position.X += this.width / 2; - this.position.Y += this.height / 2; - this.width = 0x16; - this.height = 0x16; - this.position.X -= this.width / 2; - this.position.Y -= this.height / 2; - for (int num21 = 0; num21 < 20; num21++) - { - color = new Color(); - int num22 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 0x1f, 0f, 0f, 100, color, 1.5f); - Dust dust5 = Main.dust[num22]; - dust5.velocity = (Vector2) (dust5.velocity * 1.4f); - } - for (int num23 = 0; num23 < 10; num23++) - { - color = new Color(); - int num24 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, color, 2.5f); - Main.dust[num24].noGravity = true; - Dust dust6 = Main.dust[num24]; - dust6.velocity = (Vector2) (dust6.velocity * 5f); - color = new Color(); - num24 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, color, 1.5f); - Dust dust7 = Main.dust[num24]; - dust7.velocity = (Vector2) (dust7.velocity * 3f); - } - vector = new Vector2(); - int num25 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), vector, Main.rand.Next(0x3d, 0x40)); - Gore gore1 = Main.gore[num25]; - gore1.velocity = (Vector2) (gore1.velocity * 0.4f); - Main.gore[num25].velocity.X++; - Main.gore[num25].velocity.Y++; - vector = new Vector2(); - num25 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), vector, Main.rand.Next(0x3d, 0x40)); - Gore gore2 = Main.gore[num25]; - gore2.velocity = (Vector2) (gore2.velocity * 0.4f); - Main.gore[num25].velocity.X--; - Main.gore[num25].velocity.Y++; - vector = new Vector2(); - num25 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), vector, Main.rand.Next(0x3d, 0x40)); - Gore gore3 = Main.gore[num25]; - gore3.velocity = (Vector2) (gore3.velocity * 0.4f); - Main.gore[num25].velocity.X++; - Main.gore[num25].velocity.Y--; - num25 = Gore.NewGore(new Vector2(this.position.X, this.position.Y), new Vector2(), Main.rand.Next(0x3d, 0x40)); - Gore gore4 = Main.gore[num25]; - gore4.velocity = (Vector2) (gore4.velocity * 0.4f); - Main.gore[num25].velocity.X--; - Main.gore[num25].velocity.Y--; - } - else if (this.type == 0x1d) - { - Main.PlaySound(2, (int) this.position.X, (int) this.position.Y, 14); - this.position.X += this.width / 2; - this.position.Y += this.height / 2; - this.width = 200; - this.height = 200; - this.position.X -= this.width / 2; - this.position.Y -= this.height / 2; - for (int num26 = 0; num26 < 50; num26++) - { - color = new Color(); - int num27 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 0x1f, 0f, 0f, 100, color, 2f); - Dust dust8 = Main.dust[num27]; - dust8.velocity = (Vector2) (dust8.velocity * 1.4f); - } - for (int num28 = 0; num28 < 80; num28++) - { - color = new Color(); - int num29 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, color, 3f); - Main.dust[num29].noGravity = true; - Dust dust9 = Main.dust[num29]; - dust9.velocity = (Vector2) (dust9.velocity * 5f); - color = new Color(); - num29 = Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, color, 2f); - Dust dust10 = Main.dust[num29]; - dust10.velocity = (Vector2) (dust10.velocity * 3f); - } - for (int num31 = 0; num31 < 2; num31++) - { - vector = new Vector2(); - int num30 = Gore.NewGore(new Vector2((this.position.X + (this.width / 2)) - 24f, (this.position.Y + (this.height / 2)) - 24f), vector, Main.rand.Next(0x3d, 0x40)); - Main.gore[num30].scale = 1.5f; - Main.gore[num30].velocity.X += 1.5f; - Main.gore[num30].velocity.Y += 1.5f; - vector = new Vector2(); - num30 = Gore.NewGore(new Vector2((this.position.X + (this.width / 2)) - 24f, (this.position.Y + (this.height / 2)) - 24f), vector, Main.rand.Next(0x3d, 0x40)); - Main.gore[num30].scale = 1.5f; - Main.gore[num30].velocity.X -= 1.5f; - Main.gore[num30].velocity.Y += 1.5f; - vector = new Vector2(); - num30 = Gore.NewGore(new Vector2((this.position.X + (this.width / 2)) - 24f, (this.position.Y + (this.height / 2)) - 24f), vector, Main.rand.Next(0x3d, 0x40)); - Main.gore[num30].scale = 1.5f; - Main.gore[num30].velocity.X += 1.5f; - Main.gore[num30].velocity.Y -= 1.5f; - vector = new Vector2(); - num30 = Gore.NewGore(new Vector2((this.position.X + (this.width / 2)) - 24f, (this.position.Y + (this.height / 2)) - 24f), vector, Main.rand.Next(0x3d, 0x40)); - Main.gore[num30].scale = 1.5f; - Main.gore[num30].velocity.X -= 1.5f; - Main.gore[num30].velocity.Y -= 1.5f; - } - this.position.X += this.width / 2; - this.position.Y += this.height / 2; - this.width = 10; - this.height = 10; - this.position.X -= this.width / 2; - this.position.Y -= this.height / 2; - } - } - if (this.owner == Main.myPlayer) - { - if (((this.type == 0x1c) || (this.type == 0x1d)) || (this.type == 0x25) && (true == false)) - { - int num32 = 3; - if (this.type == 0x1d) - { - num32 = 7; - } - int num33 = ((int) (this.position.X / 16f)) - num32; - int maxTilesX = ((int) (this.position.X / 16f)) + num32; - int num35 = ((int) (this.position.Y / 16f)) - num32; - int maxTilesY = ((int) (this.position.Y / 16f)) + num32; - if (num33 < 0) - { - num33 = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num35 < 0) - { - num35 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - bool flag = false; - for (int num37 = num33; num37 <= maxTilesX; num37++) - { - for (int num38 = num35; num38 <= maxTilesY; num38++) - { - float num39 = Math.Abs((float) (num37 - (this.position.X / 16f))); - float num40 = Math.Abs((float) (num38 - (this.position.Y / 16f))); - if (((Math.Sqrt((double) ((num39 * num39) + (num40 * num40))) < num32) && (Main.tile[num37, num38] != null)) && (Main.tile[num37, num38].wall == 0)) - { - flag = true; - goto Label_1605; - } - } - Label_1605:; - } - for (int num42 = num33; num42 <= maxTilesX; num42++) - { - for (int num43 = num35; num43 <= maxTilesY; num43++) - { - float num44 = Math.Abs((float) (num42 - (this.position.X / 16f))); - float num45 = Math.Abs((float) (num43 - (this.position.Y / 16f))); - if (Math.Sqrt((double) ((num44 * num44) + (num45 * num45))) < num32) - { - bool flag2 = true; - if ((Main.tile[num42, num43] != null) && Main.tile[num42, num43].active) - { - flag2 = false; - if ((this.type == 0x1c) || (this.type == 0x25)) - { - if (((((!Main.tileSolid[Main.tile[num42, num43].type] || Main.tileSolidTop[Main.tile[num42, num43].type]) || ((Main.tile[num42, num43].type == 0) || (Main.tile[num42, num43].type == 1))) || (((Main.tile[num42, num43].type == 2) || (Main.tile[num42, num43].type == 0x17)) || ((Main.tile[num42, num43].type == 30) || (Main.tile[num42, num43].type == 40)))) || ((((Main.tile[num42, num43].type == 6) || (Main.tile[num42, num43].type == 7)) || ((Main.tile[num42, num43].type == 8) || (Main.tile[num42, num43].type == 9))) || (((Main.tile[num42, num43].type == 10) || (Main.tile[num42, num43].type == 0x35)) || ((Main.tile[num42, num43].type == 0x36) || (Main.tile[num42, num43].type == 0x39))))) || ((((Main.tile[num42, num43].type == 0x3b) || (Main.tile[num42, num43].type == 60)) || ((Main.tile[num42, num43].type == 0x3f) || (Main.tile[num42, num43].type == 0x40))) || ((((Main.tile[num42, num43].type == 0x41) || (Main.tile[num42, num43].type == 0x42)) || ((Main.tile[num42, num43].type == 0x43) || (Main.tile[num42, num43].type == 0x44))) || ((Main.tile[num42, num43].type == 70) || (Main.tile[num42, num43].type == 0x25))))) - { - flag2 = true; - } - } - else if (this.type == 0x1d) - { - flag2 = true; - } - if ((Main.tileDungeon[Main.tile[num42, num43].type] || (Main.tile[num42, num43].type == 0x1a)) || ((Main.tile[num42, num43].type == 0x3a) || (Main.tile[num42, num43].type == 0x15))) - { - flag2 = false; - } - if (flag2) - { - WorldGen.KillTile(num42, num43, false, false, false); - if (!Main.tile[num42, num43].active && (Main.netMode == 1)) - { - NetMessage.SendData(0x11, -1, -1, "", 0, (float) num42, (float) num43, 0f); - } - } - } - if ((flag2 && (Main.tile[num42, num43] != null)) && ((Main.tile[num42, num43].wall > 0) && flag)) - { - WorldGen.KillWall(num42, num43, false); - if ((Main.tile[num42, num43].wall == 0) && (Main.netMode == 1)) - { - NetMessage.SendData(0x11, -1, -1, "", 2, (float) num42, (float) num43, 0f); - } - } - } - } - } - } - if (Main.netMode != 0) - { - NetMessage.SendData(0x1d, -1, -1, "", this.identity, (float) this.owner, 0f, 0f); - } - int number = -1; - if (this.aiStyle == 10) - { - int num48 = (((int) this.position.X) + (this.width / 2)) / 0x10; - int num49 = (((int) this.position.Y) + (this.width / 2)) / 0x10; - int type = 0; - int num51 = 2; - if (this.type == 0x1f) - { - type = 0x35; - num51 = 0xa9; - } - if (!Main.tile[num48, num49].active) - { - WorldGen.PlaceTile(num48, num49, type, false, true, -1); - if (Main.tile[num48, num49].active && (Main.tile[num48, num49].type == type)) - { - NetMessage.SendData(0x11, -1, -1, "", 1, (float) num48, (float) num49, (float) type); - } - else - { - number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, num51, 1, false); - } - } - else - { - number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, num51, 1, false); - } - } - if ((this.type == 1) && (Main.rand.Next(3) < 2)) - { - number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 40, 1, false); - } - if ((this.type == 2) && (Main.rand.Next(5) < 4)) - { - if (Main.rand.Next(4) == 0) - { - number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x29, 1, false); - } - else - { - number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 40, 1, false); - } - } - if ((this.type == 3) && (Main.rand.Next(5) < 4)) - { - number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x2a, 1, false); - } - if ((this.type == 4) && (Main.rand.Next(5) < 4)) - { - number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x2f, 1, false); - } - if ((this.type == 12) && (this.damage > 100)) - { - number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x4b, 1, false); - } - if ((this.type == 0x15) && (Main.rand.Next(5) < 4)) - { - number = Item.NewItem((int) this.position.X, (int) this.position.Y, this.width, this.height, 0x9a, 1, false); - } - if ((Main.netMode == 1) && (number >= 0)) - { - NetMessage.SendData(0x15, -1, -1, "", number, 0f, 0f, 0f); - } - } - this.active = false; - } - } - - public static int NewProjectile(float X, float Y, float SpeedX, float SpeedY, int Type, int Damage, float KnockBack, int Owner = 8) - { - int index = 0x3e8; - for (int i = 0; i < 0x3e8; i++) - { - if (!Main.projectile[i].active) - { - index = i; - break; - } - } - if (index != 0x3e8) - { - Main.projectile[index].SetDefaults(Type); - Main.projectile[index].position.X = X - (Main.projectile[index].width * 0.5f); - Main.projectile[index].position.Y = Y - (Main.projectile[index].height * 0.5f); - Main.projectile[index].owner = Owner; - Main.projectile[index].velocity.X = SpeedX; - Main.projectile[index].velocity.Y = SpeedY; - Main.projectile[index].damage = Damage; - Main.projectile[index].knockBack = KnockBack; - Main.projectile[index].identity = index; - Main.projectile[index].wet = Collision.WetCollision(Main.projectile[index].position, Main.projectile[index].width, Main.projectile[index].height); - if ((Main.netMode != 0) && (Owner == Main.myPlayer)) - { - NetMessage.SendData(0x1b, -1, -1, "", index, 0f, 0f, 0f); - } - if (Owner != Main.myPlayer) - { - return index; - } - if (Type == 0x1c) - { - Main.projectile[index].timeLeft = 180; - } - if (Type == 0x1d) - { - Main.projectile[index].timeLeft = 300; - } - if (Type == 30) - { - Main.projectile[index].timeLeft = 180; - } - if (Type == 0x25) - { - Main.projectile[index].timeLeft = 180; - } - } - return index; - } - - public void SetDefaults(int Type) - { - for (int i = 0; i < maxAI; i++) - { - this.ai[i] = 0f; - } - for (int j = 0; j < 8; j++) - { - this.playerImmune[j] = 0; - } - this.lavaWet = false; - this.wetCount = 0; - this.wet = false; - this.ignoreWater = false; - this.hostile = false; - this.netUpdate = false; - this.numUpdates = 0; - this.maxUpdates = 0; - this.identity = 0; - this.restrikeDelay = 0; - this.light = 0f; - this.penetrate = 1; - this.tileCollide = true; - this.position = new Vector2(); - this.velocity = new Vector2(); - this.aiStyle = 0; - this.alpha = 0; - this.type = Type; - this.active = true; - this.rotation = 0f; - this.scale = 1f; - this.owner = 8; - this.timeLeft = 0xe10; - this.name = ""; - this.friendly = false; - this.damage = 0; - this.knockBack = 0f; - if (this.type == 1) - { - this.name = "Wooden Arrow"; - this.width = 10; - this.height = 10; - this.aiStyle = 1; - this.friendly = true; - } - else if (this.type == 2) - { - this.name = "Fire Arrow"; - this.width = 10; - this.height = 10; - this.aiStyle = 1; - this.friendly = true; - this.light = 1f; - } - else if (this.type == 3) - { - this.name = "Shuriken"; - this.width = 0x16; - this.height = 0x16; - this.aiStyle = 2; - this.friendly = true; - this.penetrate = 4; - } - else if (this.type == 4) - { - this.name = "Unholy Arrow"; - this.width = 10; - this.height = 10; - this.aiStyle = 1; - this.friendly = true; - this.light = 0.2f; - this.penetrate = 3; - } - else if (this.type == 5) - { - this.name = "Jester's Arrow"; - this.width = 10; - this.height = 10; - this.aiStyle = 1; - this.friendly = true; - this.light = 0.4f; - this.penetrate = -1; - this.timeLeft = 40; - this.alpha = 100; - this.ignoreWater = true; - } - else if (this.type == 6) - { - this.name = "Enchanted Boomerang"; - this.width = 0x16; - this.height = 0x16; - this.aiStyle = 3; - this.friendly = true; - this.penetrate = -1; - } - else if ((this.type == 7) || (this.type == 8)) - { - this.name = "Vilethorn"; - this.width = 0x1c; - this.height = 0x1c; - this.aiStyle = 4; - this.friendly = true; - this.penetrate = -1; - this.tileCollide = false; - this.alpha = 0xff; - this.ignoreWater = true; - } - else if (this.type == 9) - { - this.name = "Starfury"; - this.width = 0x18; - this.height = 0x18; - this.aiStyle = 5; - this.friendly = true; - this.penetrate = 2; - this.alpha = 50; - this.scale = 0.8f; - this.light = 1f; - } - else if (this.type == 10) - { - this.name = "Purification Powder"; - this.width = 0x40; - this.height = 0x40; - this.aiStyle = 6; - this.friendly = true; - this.tileCollide = false; - this.penetrate = -1; - this.alpha = 0xff; - this.ignoreWater = true; - } - else if (this.type == 11) - { - this.name = "Vile Powder"; - this.width = 0x30; - this.height = 0x30; - this.aiStyle = 6; - this.friendly = true; - this.tileCollide = false; - this.penetrate = -1; - this.alpha = 0xff; - this.ignoreWater = true; - } - else if (this.type == 12) - { - this.name = "Fallen Star"; - this.width = 0x10; - this.height = 0x10; - this.aiStyle = 5; - this.friendly = true; - this.penetrate = -1; - this.alpha = 50; - this.light = 1f; - } - else if (this.type == 13) - { - this.name = "Hook"; - this.width = 0x12; - this.height = 0x12; - this.aiStyle = 7; - this.friendly = true; - this.penetrate = -1; - this.tileCollide = false; - } - else if (this.type == 14) - { - this.name = "Musket Ball"; - this.width = 4; - this.height = 4; - this.aiStyle = 1; - this.friendly = true; - this.penetrate = 1; - this.light = 0.5f; - this.alpha = 0xff; - this.maxUpdates = 1; - this.scale = 1.2f; - this.timeLeft = 600; - } - else if (this.type == 15) - { - this.name = "Ball of Fire"; - this.width = 0x10; - this.height = 0x10; - this.aiStyle = 8; - this.friendly = true; - this.light = 0.8f; - this.alpha = 100; - } - else if (this.type == 0x10) - { - this.name = "Magic Missile"; - this.width = 10; - this.height = 10; - this.aiStyle = 9; - this.friendly = true; - this.light = 0.8f; - this.alpha = 100; - } - else if (this.type == 0x11) - { - this.name = "Dirt Ball"; - this.width = 10; - this.height = 10; - this.aiStyle = 10; - this.friendly = true; - } - else if (this.type == 0x12) - { - this.name = "Orb of Light"; - this.width = 0x20; - this.height = 0x20; - this.aiStyle = 11; - this.friendly = true; - this.light = 1f; - this.alpha = 150; - this.tileCollide = false; - this.penetrate = -1; - this.timeLeft *= 5; - this.ignoreWater = true; - } - else if (this.type == 0x13) - { - this.name = "Flamarang"; - this.width = 0x16; - this.height = 0x16; - this.aiStyle = 3; - this.friendly = true; - this.penetrate = -1; - this.light = 1f; - } - else if (this.type == 20) - { - this.name = "Green Laser"; - this.width = 4; - this.height = 4; - this.aiStyle = 1; - this.friendly = true; - this.penetrate = -1; - this.light = 0.75f; - this.alpha = 0xff; - this.maxUpdates = 2; - this.scale = 1.4f; - this.timeLeft = 600; - } - else if (this.type == 0x15) - { - this.name = "Bone"; - this.width = 0x10; - this.height = 0x10; - this.aiStyle = 2; - this.scale = 1.2f; - this.friendly = true; - } - else if (this.type == 0x16) - { - this.name = "Water Stream"; - this.width = 12; - this.height = 12; - this.aiStyle = 12; - this.friendly = true; - this.alpha = 0xff; - this.penetrate = -1; - this.maxUpdates = 1; - this.ignoreWater = true; - } - else if (this.type == 0x17) - { - this.name = "Harpoon"; - this.width = 4; - this.height = 4; - this.aiStyle = 13; - this.friendly = true; - this.penetrate = -1; - this.alpha = 0xff; - } - else if (this.type == 0x18) - { - this.name = "Spiky Ball"; - this.width = 14; - this.height = 14; - this.aiStyle = 14; - this.friendly = true; - this.penetrate = 3; - } - else if (this.type == 0x19) - { - this.name = "Ball 'O Hurt"; - this.width = 0x16; - this.height = 0x16; - this.aiStyle = 15; - this.friendly = true; - this.penetrate = -1; - } - else if (this.type == 0x1a) - { - this.name = "Blue Moon"; - this.width = 0x16; - this.height = 0x16; - this.aiStyle = 15; - this.friendly = true; - this.penetrate = -1; - } - else if (this.type == 0x1b) - { - this.name = "Water Bolt"; - this.width = 0x10; - this.height = 0x10; - this.aiStyle = 8; - this.friendly = true; - this.light = 0.8f; - this.alpha = 200; - this.timeLeft /= 2; - this.penetrate = 10; - } - else if (this.type == 0x1c) - { - this.name = "Bomb"; - this.width = 0x16; - this.height = 0x16; - this.aiStyle = 0x10; - this.friendly = true; - this.penetrate = -1; - } - else if (this.type == 0x1d) - { - this.name = "Dynamite"; - this.width = 10; - this.height = 10; - this.aiStyle = 0x10; - this.friendly = true; - this.penetrate = -1; - } - else if (this.type == 30) - { - this.name = "Grenade"; - this.width = 14; - this.height = 14; - this.aiStyle = 0x10; - this.friendly = true; - this.penetrate = -1; - } - else if (this.type == 0x1f) - { - this.name = "Sand Ball"; - this.knockBack = 6f; - this.width = 10; - this.height = 10; - this.aiStyle = 10; - this.friendly = true; - this.hostile = true; - this.penetrate = -1; - } - else if (this.type == 0x20) - { - this.name = "Ivy Whip"; - this.width = 0x12; - this.height = 0x12; - this.aiStyle = 7; - this.friendly = true; - this.penetrate = -1; - this.tileCollide = false; - } - else if (this.type == 0x21) - { - this.name = "Thorn Chakrum"; - this.width = 0x1c; - this.height = 0x1c; - this.aiStyle = 3; - this.friendly = true; - this.scale = 0.9f; - this.penetrate = -1; - } - else if (this.type == 0x22) - { - this.name = "Flamelash"; - this.width = 14; - this.height = 14; - this.aiStyle = 9; - this.friendly = true; - this.light = 0.8f; - this.alpha = 100; - this.penetrate = 2; - } - else if (this.type == 0x23) - { - this.name = "Sunfury"; - this.width = 0x16; - this.height = 0x16; - this.aiStyle = 15; - this.friendly = true; - this.penetrate = -1; - } - else if (this.type == 0x24) - { - this.name = "Meteor Shot"; - this.width = 4; - this.height = 4; - this.aiStyle = 1; - this.friendly = true; - this.penetrate = 2; - this.light = 0.6f; - this.alpha = 0xff; - this.maxUpdates = 1; - this.scale = 1.4f; - this.timeLeft = 600; - } - else if (this.type == 0x25) - { - this.name = "Bomb"; - this.width = 0x16; - this.height = 0x16; - this.aiStyle = 0x10; - this.friendly = true; - this.penetrate = -1; - this.tileCollide = false; - } - else - { - this.active = false; - } - this.width = (int) (this.width * this.scale); - this.height = (int) (this.height * this.scale); - } - - public void Update(int i) - { - if (this.active) - { - Vector2 velocity = this.velocity; - if (((this.position.X <= Main.leftWorld) || ((this.position.X + this.width) >= Main.rightWorld)) || ((this.position.Y <= Main.topWorld) || ((this.position.Y + this.height) >= Main.bottomWorld))) - { - this.Kill(); - } - else - { - this.whoAmI = i; - if (this.soundDelay > 0) - { - this.soundDelay--; - } - this.netUpdate = false; - for (int j = 0; j < 8; j++) - { - if (this.playerImmune[j] > 0) - { - this.playerImmune[j]--; - } - } - this.AI(); - if ((this.owner < 8) && !Main.player[this.owner].active) - { - this.Kill(); - } - if (!this.ignoreWater) - { - bool flag = Collision.LavaCollision(this.position, this.width, this.height); - if (flag) - { - this.lavaWet = true; - } - if (Collision.WetCollision(this.position, this.width, this.height)) - { - if (this.wetCount == 0) - { - this.wetCount = 10; - if (!this.wet) - { - if (!flag) - { - for (int k = 0; k < 10; k++) - { - Color newColor = new Color(); - int index = Dust.NewDust(new Vector2(this.position.X - 6f, (this.position.Y + (this.height / 2)) - 8f), this.width + 12, 0x18, 0x21, 0f, 0f, 0, newColor, 1f); - Main.dust[index].velocity.Y -= 4f; - Main.dust[index].velocity.X *= 2.5f; - Main.dust[index].scale = 1.3f; - Main.dust[index].alpha = 100; - Main.dust[index].noGravity = true; - } - Main.PlaySound(0x13, (int) this.position.X, (int) this.position.Y, 1); - } - else - { - for (int m = 0; m < 10; m++) - { - Color color2 = new Color(); - int num5 = Dust.NewDust(new Vector2(this.position.X - 6f, (this.position.Y + (this.height / 2)) - 8f), this.width + 12, 0x18, 0x23, 0f, 0f, 0, color2, 1f); - Main.dust[num5].velocity.Y -= 1.5f; - Main.dust[num5].velocity.X *= 2.5f; - Main.dust[num5].scale = 1.3f; - Main.dust[num5].alpha = 100; - Main.dust[num5].noGravity = true; - } - Main.PlaySound(0x13, (int) this.position.X, (int) this.position.Y, 1); - } - } - this.wet = true; - } - } - else if (this.wet) - { - this.wet = false; - if (this.wetCount == 0) - { - this.wetCount = 10; - if (!this.lavaWet) - { - for (int n = 0; n < 10; n++) - { - Color color3 = new Color(); - int num7 = Dust.NewDust(new Vector2(this.position.X - 6f, this.position.Y + (this.height / 2)), this.width + 12, 0x18, 0x21, 0f, 0f, 0, color3, 1f); - Main.dust[num7].velocity.Y -= 4f; - Main.dust[num7].velocity.X *= 2.5f; - Main.dust[num7].scale = 1.3f; - Main.dust[num7].alpha = 100; - Main.dust[num7].noGravity = true; - } - Main.PlaySound(0x13, (int) this.position.X, (int) this.position.Y, 1); - } - else - { - for (int num8 = 0; num8 < 10; num8++) - { - Color color4 = new Color(); - int num9 = Dust.NewDust(new Vector2(this.position.X - 6f, (this.position.Y + (this.height / 2)) - 8f), this.width + 12, 0x18, 0x23, 0f, 0f, 0, color4, 1f); - Main.dust[num9].velocity.Y -= 1.5f; - Main.dust[num9].velocity.X *= 2.5f; - Main.dust[num9].scale = 1.3f; - Main.dust[num9].alpha = 100; - Main.dust[num9].noGravity = true; - } - Main.PlaySound(0x13, (int) this.position.X, (int) this.position.Y, 1); - } - } - } - if (!this.wet) - { - this.lavaWet = false; - } - if (this.wetCount > 0) - { - this.wetCount = (byte) (this.wetCount - 1); - } - } - if (this.tileCollide) - { - Vector2 vector2 = this.velocity; - bool fallThrough = true; - if (((this.type == 9) || (this.type == 12)) || (((this.type == 15) || (this.type == 13)) || (this.type == 0x1f))) - { - fallThrough = false; - } - if (this.aiStyle == 10) - { - this.velocity = Collision.AnyCollision(this.position, this.velocity, this.width, this.height); - } - else if (this.wet) - { - Vector2 vector3 = this.velocity; - this.velocity = Collision.TileCollision(this.position, this.velocity, this.width, this.height, fallThrough, fallThrough); - velocity = (Vector2) (this.velocity * 0.5f); - if (this.velocity.X != vector3.X) - { - velocity.X = this.velocity.X; - } - if (this.velocity.Y != vector3.Y) - { - velocity.Y = this.velocity.Y; - } - } - else - { - this.velocity = Collision.TileCollision(this.position, this.velocity, this.width, this.height, fallThrough, fallThrough); - } - if (vector2 != this.velocity) - { - if (this.type == 0x24) - { - if (this.penetrate > 1) - { - Collision.HitTiles(this.position, this.velocity, this.width, this.height); - Main.PlaySound(2, (int) this.position.X, (int) this.position.Y, 10); - this.penetrate--; - if (this.velocity.X != vector2.X) - { - this.velocity.X = -vector2.X; - } - if (this.velocity.Y != vector2.Y) - { - this.velocity.Y = -vector2.Y; - } - } - else - { - this.Kill(); - } - } - else if (((this.aiStyle == 3) || (this.aiStyle == 13)) || (this.aiStyle == 15)) - { - Collision.HitTiles(this.position, this.velocity, this.width, this.height); - if (this.type == 0x21) - { - if (this.velocity.X != vector2.X) - { - this.velocity.X = -vector2.X; - } - if (this.velocity.Y != vector2.Y) - { - this.velocity.Y = -vector2.Y; - } - } - else - { - this.ai[0] = 1f; - if (this.aiStyle == 3) - { - this.velocity.X = -vector2.X; - this.velocity.Y = -vector2.Y; - } - } - this.netUpdate = true; - Main.PlaySound(0, (int) this.position.X, (int) this.position.Y, 1); - } - else if (this.aiStyle == 8) - { - Main.PlaySound(2, (int) this.position.X, (int) this.position.Y, 10); - this.ai[0]++; - if (this.ai[0] >= 5f) - { - this.position += this.velocity; - this.Kill(); - } - else - { - if (this.velocity.Y != vector2.Y) - { - this.velocity.Y = -vector2.Y; - } - if (this.velocity.X != vector2.X) - { - this.velocity.X = -vector2.X; - } - } - } - else if (this.aiStyle == 14) - { - if (this.velocity.X != vector2.X) - { - this.velocity.X = vector2.X * -0.5f; - } - if ((this.velocity.Y != vector2.Y) && (vector2.Y > 1f)) - { - this.velocity.Y = vector2.Y * -0.5f; - } - } - else if (this.aiStyle == 0x10) - { - if (this.velocity.X != vector2.X) - { - this.velocity.X = vector2.X * -0.4f; - if (this.type == 0x1d) - { - this.velocity.X *= 0.8f; - } - } - if ((this.velocity.Y != vector2.Y) && (vector2.Y > 0.7)) - { - this.velocity.Y = vector2.Y * -0.4f; - if (this.type == 0x1d) - { - this.velocity.Y *= 0.8f; - } - } - } - else - { - this.position += this.velocity; - this.Kill(); - } - } - } - if ((this.type != 7) && (this.type != 8)) - { - if (this.wet) - { - this.position += velocity; - } - else - { - this.position += this.velocity; - } - } - if ((((this.aiStyle != 3) || (this.ai[0] != 1f)) && ((this.aiStyle != 7) || (this.ai[0] != 1f))) && (((this.aiStyle != 13) || (this.ai[0] != 1f)) && ((this.aiStyle != 15) || (this.ai[0] != 1f)))) - { - if (this.velocity.X < 0f) - { - this.direction = -1; - } - else - { - this.direction = 1; - } - } - if (this.active) - { - if (this.light > 0f) - { - Lighting.addLight((int) ((this.position.X + (this.width / 2)) / 16f), (int) ((this.position.Y + (this.height / 2)) / 16f), this.light); - } - if (this.type == 2) - { - Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 6, 0f, 0f, 100, new Color(), 1f); - } - else if (this.type == 4) - { - if (Main.rand.Next(5) == 0) - { - Dust.NewDust(new Vector2(this.position.X, this.position.Y), this.width, this.height, 14, 0f, 0f, 150, new Color(), 1.1f); - } - } - else if (this.type == 5) - { - Dust.NewDust(this.position, this.width, this.height, 15, this.velocity.X * 0.5f, this.velocity.Y * 0.5f, 150, new Color(), 1.2f); - } - Rectangle rectangle = new Rectangle((int) this.position.X, (int) this.position.Y, this.width, this.height); - if ((this.hostile && (Main.myPlayer < 8)) && (this.damage > 0)) - { - int myPlayer = Main.myPlayer; - if ((Main.player[myPlayer].active && !Main.player[myPlayer].dead) && !Main.player[myPlayer].immune) - { - Rectangle rectangle2 = new Rectangle((int) Main.player[myPlayer].position.X, (int) Main.player[myPlayer].position.Y, Main.player[myPlayer].width, Main.player[myPlayer].height); - if (rectangle.Intersects(rectangle2)) - { - int direction = this.direction; - if ((Main.player[myPlayer].position.X + (Main.player[myPlayer].width / 2)) < (this.position.X + (this.width / 2))) - { - direction = -1; - } - else - { - direction = 1; - } - Main.player[myPlayer].Hurt(this.damage * 2, direction, false, false); - if (Main.netMode != 0) - { - NetMessage.SendData(0x1a, -1, -1, "", myPlayer, (float) this.direction, (float) (this.damage * 2), 0f); - } - } - } - } - if ((this.friendly && (this.type != 0x12)) && (this.owner == Main.myPlayer)) - { - if ((this.aiStyle == 0x10) && (this.ai[1] > 0f)) - { - for (int num12 = 0; num12 < 8; num12++) - { - if ((Main.player[num12].active && !Main.player[num12].dead) && !Main.player[num12].immune) - { - Rectangle rectangle3 = new Rectangle((int) Main.player[num12].position.X, (int) Main.player[num12].position.Y, Main.player[num12].width, Main.player[num12].height); - if (rectangle.Intersects(rectangle3)) - { - if ((Main.player[num12].position.X + (Main.player[num12].width / 2)) < (this.position.X + (this.width / 2))) - { - this.direction = -1; - } - else - { - this.direction = 1; - } - Main.player[num12].Hurt(this.damage, this.direction, true, false); - if (Main.netMode != 0) - { - NetMessage.SendData(0x1a, -1, -1, "", num12, (float) this.direction, (float) this.damage, 1f); - } - } - } - } - } - int num13 = (int) (this.position.X / 16f); - int maxTilesX = ((int) ((this.position.X + this.width) / 16f)) + 1; - int num15 = (int) (this.position.Y / 16f); - int maxTilesY = ((int) ((this.position.Y + this.height) / 16f)) + 1; - if (num13 < 0) - { - num13 = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num15 < 0) - { - num15 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int num17 = num13; num17 < maxTilesX; num17++) - { - for (int num18 = num15; num18 < maxTilesY; num18++) - { - if ((Main.tile[num17, num18] != null) && (((((Main.tile[num17, num18].type == 3) || (Main.tile[num17, num18].type == 0x18)) || ((Main.tile[num17, num18].type == 0x1c) || (Main.tile[num17, num18].type == 0x20))) || (((Main.tile[num17, num18].type == 0x33) || (Main.tile[num17, num18].type == 0x34)) || ((Main.tile[num17, num18].type == 0x3d) || (Main.tile[num17, num18].type == 0x3e)))) || (((Main.tile[num17, num18].type == 0x45) || (Main.tile[num17, num18].type == 0x47)) || ((Main.tile[num17, num18].type == 0x49) || (Main.tile[num17, num18].type == 0x4a))))) - { - WorldGen.KillTile(num17, num18, false, false, false); - if (Main.netMode == 1) - { - NetMessage.SendData(0x11, -1, -1, "", 0, (float) num17, (float) num18, 0f); - } - } - } - } - if (this.damage > 0) - { - for (int num19 = 0; num19 < 0x3e8; num19++) - { - if ((Main.npc[num19].active && !Main.npc[num19].friendly) && ((this.owner < 0) || (Main.npc[num19].immune[this.owner] == 0))) - { - Rectangle rectangle4 = new Rectangle((int) Main.npc[num19].position.X, (int) Main.npc[num19].position.Y, Main.npc[num19].width, Main.npc[num19].height); - if (rectangle.Intersects(rectangle4)) - { - if (this.aiStyle == 3) - { - if (this.ai[0] == 0f) - { - this.velocity.X = -this.velocity.X; - this.velocity.Y = -this.velocity.Y; - this.netUpdate = true; - } - this.ai[0] = 1f; - } - else if (this.aiStyle == 0x10) - { - if (this.timeLeft > 3) - { - this.timeLeft = 3; - } - if ((Main.npc[num19].position.X + (Main.npc[num19].width / 2)) < (this.position.X + (this.width / 2))) - { - this.direction = -1; - } - else - { - this.direction = 1; - } - } - Main.npc[num19].StrikeNPC(this.damage, this.knockBack, this.direction); - if (Main.netMode != 0) - { - NetMessage.SendData(0x1c, -1, -1, "", num19, (float) this.damage, this.knockBack, (float) this.direction); - } - if (this.penetrate != 1) - { - Main.npc[num19].immune[this.owner] = 10; - } - if (this.penetrate > 0) - { - this.penetrate--; - if (this.penetrate == 0) - { - break; - } - } - if (this.aiStyle == 7) - { - this.ai[0] = 1f; - this.damage = 0; - this.netUpdate = true; - } - else if (this.aiStyle == 13) - { - this.ai[0] = 1f; - this.netUpdate = true; - } - } - } - } - } - if ((this.damage > 0) && Main.player[Main.myPlayer].hostile) - { - for (int num20 = 0; num20 < 8; num20++) - { - if ((((num20 != this.owner) && Main.player[num20].active) && (!Main.player[num20].dead && !Main.player[num20].immune)) && ((Main.player[num20].hostile && (this.playerImmune[num20] <= 0)) && ((Main.player[Main.myPlayer].team == 0) || (Main.player[Main.myPlayer].team != Main.player[num20].team)))) - { - Rectangle rectangle5 = new Rectangle((int) Main.player[num20].position.X, (int) Main.player[num20].position.Y, Main.player[num20].width, Main.player[num20].height); - if (rectangle.Intersects(rectangle5)) - { - if (this.aiStyle == 3) - { - if (this.ai[0] == 0f) - { - this.velocity.X = -this.velocity.X; - this.velocity.Y = -this.velocity.Y; - this.netUpdate = true; - } - this.ai[0] = 1f; - } - else if (this.aiStyle == 0x10) - { - if (this.timeLeft > 3) - { - this.timeLeft = 3; - } - if ((Main.player[num20].position.X + (Main.player[num20].width / 2)) < (this.position.X + (this.width / 2))) - { - this.direction = -1; - } - else - { - this.direction = 1; - } - } - Main.player[num20].Hurt(this.damage, this.direction, true, false); - if (Main.netMode != 0) - { - NetMessage.SendData(0x1a, -1, -1, "", num20, (float) this.direction, (float) this.damage, 1f); - } - this.playerImmune[num20] = 40; - if (this.penetrate > 0) - { - this.penetrate--; - if (this.penetrate == 0) - { - break; - } - } - if (this.aiStyle == 7) - { - this.ai[0] = 1f; - this.damage = 0; - this.netUpdate = true; - } - else if (this.aiStyle == 13) - { - this.ai[0] = 1f; - this.netUpdate = true; - } - } - } - } - } - } - this.timeLeft--; - if (this.timeLeft <= 0) - { - this.Kill(); - } - if (this.penetrate == 0) - { - this.Kill(); - } - if ((this.active && this.netUpdate) && (this.owner == Main.myPlayer)) - { - NetMessage.SendData(0x1b, -1, -1, "", i, 0f, 0f, 0f); - } - if (this.active && (this.maxUpdates > 0)) - { - this.numUpdates--; - if (this.numUpdates >= 0) - { - this.Update(i); - } - else - { - this.numUpdates = this.maxUpdates; - } - } - this.netUpdate = false; - } - } - } - } - } -} - diff --git a/Terraria/Recipe.cs b/Terraria/Recipe.cs deleted file mode 100644 index 2629a0b6..00000000 --- a/Terraria/Recipe.cs +++ /dev/null @@ -1,996 +0,0 @@ -namespace Terraria -{ - using System; - - public class Recipe - { - public Item createItem = new Item(); - public static int maxRecipes = 200; - public static int maxRequirements = 10; - private static Recipe newRecipe = new Recipe(); - public static int numRecipes = 0; - public Item[] requiredItem = new Item[maxRequirements]; - public int[] requiredTile = new int[maxRequirements]; - - public Recipe() - { - for (int i = 0; i < maxRequirements; i++) - { - this.requiredItem[i] = new Item(); - this.requiredTile[i] = -1; - } - } - - private static void addRecipe() - { - Main.recipe[numRecipes] = newRecipe; - newRecipe = new Recipe(); - numRecipes++; - } - - public void Create() - { - for (int i = 0; i < maxRequirements; i++) - { - if (this.requiredItem[i].type == 0) - { - break; - } - int stack = this.requiredItem[i].stack; - for (int j = 0; j < 0x2c; j++) - { - if (Main.player[Main.myPlayer].inventory[j].IsTheSameAs(this.requiredItem[i])) - { - if (Main.player[Main.myPlayer].inventory[j].stack > stack) - { - Item item1 = Main.player[Main.myPlayer].inventory[j]; - item1.stack -= stack; - stack = 0; - } - else - { - stack -= Main.player[Main.myPlayer].inventory[j].stack; - Main.player[Main.myPlayer].inventory[j] = new Item(); - } - } - if (stack <= 0) - { - break; - } - } - } - FindRecipes(); - } - - public static void FindRecipes() - { - int num = Main.availableRecipe[Main.focusRecipe]; - float num2 = Main.availableRecipeY[Main.focusRecipe]; - for (int i = 0; i < maxRecipes; i++) - { - Main.availableRecipe[i] = 0; - } - Main.numAvailableRecipes = 0; - for (int j = 0; j < maxRecipes; j++) - { - if (Main.recipe[j].createItem.type == 0) - { - break; - } - bool flag = true; - for (int n = 0; n < maxRequirements; n++) - { - if (Main.recipe[j].requiredItem[n].type == 0) - { - break; - } - int stack = Main.recipe[j].requiredItem[n].stack; - for (int num7 = 0; num7 < 0x2c; num7++) - { - if (Main.player[Main.myPlayer].inventory[num7].IsTheSameAs(Main.recipe[j].requiredItem[n])) - { - stack -= Main.player[Main.myPlayer].inventory[num7].stack; - } - if (stack <= 0) - { - break; - } - } - if (stack > 0) - { - flag = false; - break; - } - } - if (flag) - { - bool flag2 = true; - for (int num8 = 0; num8 < maxRequirements; num8++) - { - if (Main.recipe[j].requiredTile[num8] == -1) - { - break; - } - if (!Main.player[Main.myPlayer].adjTile[Main.recipe[j].requiredTile[num8]]) - { - flag2 = false; - break; - } - } - if (flag2) - { - Main.availableRecipe[Main.numAvailableRecipes] = j; - Main.numAvailableRecipes++; - } - } - } - for (int k = 0; k < Main.numAvailableRecipes; k++) - { - if (num == Main.availableRecipe[k]) - { - Main.focusRecipe = k; - break; - } - } - if (Main.focusRecipe >= Main.numAvailableRecipes) - { - Main.focusRecipe = Main.numAvailableRecipes - 1; - } - if (Main.focusRecipe < 0) - { - Main.focusRecipe = 0; - } - float num10 = Main.availableRecipeY[Main.focusRecipe] - num2; - for (int m = 0; m < maxRecipes; m++) - { - Main.availableRecipeY[m] -= num10; - } - } - - public static void SetupRecipes() - { - newRecipe.createItem.SetDefaults(0x1c); - newRecipe.createItem.stack = 2; - newRecipe.requiredItem[0].SetDefaults(5); - newRecipe.requiredItem[1].SetDefaults(0x17); - newRecipe.requiredItem[1].stack = 2; - newRecipe.requiredItem[2].SetDefaults(0x1f); - newRecipe.requiredItem[2].stack = 2; - newRecipe.requiredTile[0] = 13; - addRecipe(); - newRecipe.createItem.SetDefaults("Healing Potion"); - newRecipe.requiredItem[0].SetDefaults(0x1c); - newRecipe.requiredItem[0].stack = 2; - newRecipe.requiredItem[1].SetDefaults(0xb7); - newRecipe.requiredTile[0] = 13; - addRecipe(); - newRecipe.createItem.SetDefaults(110); - newRecipe.createItem.stack = 2; - newRecipe.requiredItem[0].SetDefaults(0x4b); - newRecipe.requiredItem[1].SetDefaults(0x17); - newRecipe.requiredItem[1].stack = 2; - newRecipe.requiredItem[2].SetDefaults(0x1f); - newRecipe.requiredItem[2].stack = 2; - newRecipe.requiredTile[0] = 13; - addRecipe(); - newRecipe.createItem.SetDefaults("Mana Potion"); - newRecipe.requiredItem[0].SetDefaults(110); - newRecipe.requiredItem[0].stack = 2; - newRecipe.requiredItem[1].SetDefaults(0xb7); - newRecipe.requiredTile[0] = 13; - addRecipe(); - newRecipe.createItem.SetDefaults(0xe2); - newRecipe.requiredItem[0].SetDefaults(0x1c); - newRecipe.requiredItem[1].SetDefaults(110); - newRecipe.requiredTile[0] = 13; - addRecipe(); - newRecipe.createItem.SetDefaults(0xe3); - newRecipe.requiredItem[0].SetDefaults("Healing Potion"); - newRecipe.requiredItem[1].SetDefaults("Mana Potion"); - newRecipe.requiredTile[0] = 13; - addRecipe(); - newRecipe.createItem.SetDefaults(0x43); - newRecipe.createItem.stack = 5; - newRecipe.requiredItem[0].SetDefaults(60); - newRecipe.requiredTile[0] = 13; - addRecipe(); - newRecipe.createItem.SetDefaults("Bottle"); - newRecipe.createItem.stack = 2; - newRecipe.requiredItem[0].SetDefaults("Glass"); - newRecipe.requiredTile[0] = 0x11; - addRecipe(); - newRecipe.createItem.SetDefaults(8); - newRecipe.createItem.stack = 3; - newRecipe.requiredItem[0].SetDefaults(0x17); - newRecipe.requiredItem[0].stack = 1; - newRecipe.requiredItem[1].SetDefaults(9); - addRecipe(); - newRecipe.createItem.SetDefaults(0xeb); - newRecipe.requiredItem[0].SetDefaults(0xa6); - newRecipe.requiredItem[1].SetDefaults(0x17); - newRecipe.requiredItem[1].stack = 5; - addRecipe(); - newRecipe.createItem.SetDefaults("Glass"); - newRecipe.createItem.stack = 1; - newRecipe.requiredItem[0].SetDefaults(0xa9); - newRecipe.requiredItem[0].stack = 2; - newRecipe.requiredTile[0] = 0x11; - addRecipe(); - newRecipe.createItem.SetDefaults("Clay Pot"); - newRecipe.requiredItem[0].SetDefaults(0x85); - newRecipe.requiredItem[0].stack = 6; - newRecipe.requiredTile[0] = 0x11; - addRecipe(); - newRecipe.createItem.SetDefaults("Gray Brick"); - newRecipe.requiredItem[0].SetDefaults(3); - newRecipe.requiredItem[0].stack = 2; - newRecipe.requiredTile[0] = 0x11; - addRecipe(); - newRecipe.createItem.SetDefaults("Gray Brick Wall"); - newRecipe.createItem.stack = 4; - newRecipe.requiredItem[0].SetDefaults("Gray Brick"); - newRecipe.requiredTile[0] = 0x12; - addRecipe(); - newRecipe.createItem.SetDefaults("Red Brick"); - newRecipe.requiredItem[0].SetDefaults(0x85); - newRecipe.requiredItem[0].stack = 2; - newRecipe.requiredTile[0] = 0x11; - addRecipe(); - newRecipe.createItem.SetDefaults("Red Brick Wall"); - newRecipe.createItem.stack = 4; - newRecipe.requiredItem[0].SetDefaults("Red Brick"); - newRecipe.requiredTile[0] = 0x12; - addRecipe(); - newRecipe.createItem.SetDefaults("Copper Brick"); - newRecipe.requiredItem[0].SetDefaults(3); - newRecipe.requiredItem[0].stack = 1; - newRecipe.requiredItem[1].SetDefaults("Copper Ore"); - newRecipe.requiredItem[1].stack = 1; - newRecipe.requiredTile[0] = 0x11; - addRecipe(); - newRecipe.createItem.SetDefaults("Copper Brick Wall"); - newRecipe.createItem.stack = 4; - newRecipe.requiredItem[0].SetDefaults("Copper Brick"); - newRecipe.requiredTile[0] = 0x12; - addRecipe(); - newRecipe.createItem.SetDefaults("Silver Brick Wall"); - newRecipe.createItem.stack = 4; - newRecipe.requiredItem[0].SetDefaults("Silver Brick"); - newRecipe.requiredTile[0] = 0x12; - addRecipe(); - newRecipe.createItem.SetDefaults("Silver Brick"); - newRecipe.requiredItem[0].SetDefaults(3); - newRecipe.requiredItem[0].stack = 1; - newRecipe.requiredItem[1].SetDefaults("Silver Ore"); - newRecipe.requiredItem[1].stack = 1; - newRecipe.requiredTile[0] = 0x11; - addRecipe(); - newRecipe.createItem.SetDefaults("Gold Brick Wall"); - newRecipe.createItem.stack = 4; - newRecipe.requiredItem[0].SetDefaults("Gold Brick"); - newRecipe.requiredTile[0] = 0x12; - addRecipe(); - newRecipe.createItem.SetDefaults("Gold Brick"); - newRecipe.requiredItem[0].SetDefaults(3); - newRecipe.requiredItem[0].stack = 1; - newRecipe.requiredItem[1].SetDefaults("Gold Ore"); - newRecipe.requiredItem[1].stack = 1; - newRecipe.requiredTile[0] = 0x11; - addRecipe(); - newRecipe.createItem.SetDefaults("Hellstone Brick"); - newRecipe.requiredItem[0].SetDefaults(0xae); - newRecipe.requiredItem[1].SetDefaults(1); - newRecipe.requiredTile[0] = 0x11; - addRecipe(); - newRecipe.createItem.SetDefaults(0xc0); - newRecipe.requiredItem[0].SetDefaults(0xad); - newRecipe.requiredItem[0].stack = 2; - newRecipe.requiredTile[0] = 0x11; - addRecipe(); - newRecipe.createItem.SetDefaults(30); - newRecipe.createItem.stack = 4; - newRecipe.requiredItem[0].SetDefaults(2); - newRecipe.requiredTile[0] = 0x12; - addRecipe(); - newRecipe.createItem.SetDefaults(0x1a); - newRecipe.createItem.stack = 4; - newRecipe.requiredItem[0].SetDefaults(3); - newRecipe.requiredTile[0] = 0x12; - addRecipe(); - newRecipe.createItem.SetDefaults(0x5d); - newRecipe.createItem.stack = 4; - newRecipe.requiredItem[0].SetDefaults(9); - newRecipe.requiredTile[0] = 0x12; - addRecipe(); - newRecipe.createItem.SetDefaults(0x5e); - newRecipe.requiredItem[0].SetDefaults(9); - addRecipe(); - newRecipe.createItem.SetDefaults(0x19); - newRecipe.requiredItem[0].SetDefaults(9); - newRecipe.requiredItem[0].stack = 6; - newRecipe.requiredTile[0] = 0x12; - addRecipe(); - newRecipe.createItem.SetDefaults(0x22); - newRecipe.requiredItem[0].SetDefaults(9); - newRecipe.requiredItem[0].stack = 4; - newRecipe.requiredTile[0] = 0x12; - addRecipe(); - newRecipe.createItem.SetDefaults("Sign"); - newRecipe.requiredItem[0].SetDefaults(9); - newRecipe.requiredItem[0].stack = 6; - newRecipe.requiredTile[0] = 0x12; - addRecipe(); - newRecipe.createItem.SetDefaults(0x30); - newRecipe.requiredItem[0].SetDefaults(9); - newRecipe.requiredItem[0].stack = 8; - newRecipe.requiredItem[1].SetDefaults(0x16); - newRecipe.requiredItem[1].stack = 2; - newRecipe.requiredTile[0] = 0x12; - addRecipe(); - newRecipe.createItem.SetDefaults(0x20); - newRecipe.requiredItem[0].SetDefaults(9); - newRecipe.requiredItem[0].stack = 8; - newRecipe.requiredTile[0] = 0x12; - addRecipe(); - newRecipe.createItem.SetDefaults(0x24); - newRecipe.requiredItem[0].SetDefaults(9); - newRecipe.requiredItem[0].stack = 10; - addRecipe(); - newRecipe.createItem.SetDefaults(0x18); - newRecipe.requiredItem[0].SetDefaults(9); - newRecipe.requiredItem[0].stack = 7; - newRecipe.requiredTile[0] = 0x12; - addRecipe(); - newRecipe.createItem.SetDefaults(0xc4); - newRecipe.requiredItem[0].SetDefaults(9); - newRecipe.requiredItem[0].stack = 8; - newRecipe.requiredTile[0] = 0x12; - addRecipe(); - newRecipe.createItem.SetDefaults(40); - newRecipe.createItem.stack = 3; - newRecipe.requiredItem[0].SetDefaults(9); - newRecipe.requiredItem[1].SetDefaults(3); - newRecipe.requiredTile[0] = 0x12; - addRecipe(); - newRecipe.createItem.SetDefaults(0x27); - newRecipe.requiredItem[0].SetDefaults(9); - newRecipe.requiredItem[0].stack = 10; - newRecipe.requiredTile[0] = 0x12; - addRecipe(); - newRecipe.createItem.SetDefaults("Bed"); - newRecipe.requiredItem[0].SetDefaults(9); - newRecipe.requiredItem[0].stack = 15; - newRecipe.requiredItem[1].SetDefaults("Silk"); - newRecipe.requiredItem[1].stack = 5; - newRecipe.requiredTile[0] = 0x12; - addRecipe(); - newRecipe.createItem.SetDefaults("Silk"); - newRecipe.requiredItem[0].SetDefaults(150); - newRecipe.requiredItem[0].stack = 10; - newRecipe.requiredTile[0] = 0x12; - addRecipe(); - newRecipe.createItem.SetDefaults("Flaming Arrow"); - newRecipe.createItem.stack = 5; - newRecipe.requiredItem[0].SetDefaults(40); - newRecipe.requiredItem[0].stack = 5; - newRecipe.requiredItem[1].SetDefaults(8); - addRecipe(); - newRecipe.createItem.SetDefaults(0x21); - newRecipe.requiredItem[0].SetDefaults(3); - newRecipe.requiredItem[0].stack = 20; - newRecipe.requiredItem[1].SetDefaults(9); - newRecipe.requiredItem[1].stack = 4; - newRecipe.requiredItem[2].SetDefaults(8); - newRecipe.requiredItem[2].stack = 3; - newRecipe.requiredTile[0] = 0x12; - addRecipe(); - newRecipe.createItem.SetDefaults(20); - newRecipe.requiredItem[0].SetDefaults(12); - newRecipe.requiredItem[0].stack = 3; - newRecipe.requiredTile[0] = 0x11; - addRecipe(); - newRecipe.createItem.SetDefaults("Copper Pickaxe"); - newRecipe.requiredItem[0].SetDefaults(20); - newRecipe.requiredItem[0].stack = 12; - newRecipe.requiredItem[1].SetDefaults(9); - newRecipe.requiredItem[1].stack = 4; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Copper Axe"); - newRecipe.requiredItem[0].SetDefaults(20); - newRecipe.requiredItem[0].stack = 9; - newRecipe.requiredItem[1].SetDefaults(9); - newRecipe.requiredItem[1].stack = 3; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Copper Hammer"); - newRecipe.requiredItem[0].SetDefaults(20); - newRecipe.requiredItem[0].stack = 10; - newRecipe.requiredItem[1].SetDefaults(9); - newRecipe.requiredItem[1].stack = 3; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Copper Broadsword"); - newRecipe.requiredItem[0].SetDefaults(20); - newRecipe.requiredItem[0].stack = 8; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Copper Shortsword"); - newRecipe.requiredItem[0].SetDefaults(20); - newRecipe.requiredItem[0].stack = 7; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Copper Bow"); - newRecipe.requiredItem[0].SetDefaults(20); - newRecipe.requiredItem[0].stack = 7; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Copper Helmet"); - newRecipe.requiredItem[0].SetDefaults(20); - newRecipe.requiredItem[0].stack = 15; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Copper Chainmail"); - newRecipe.requiredItem[0].SetDefaults(20); - newRecipe.requiredItem[0].stack = 0x19; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Copper Greaves"); - newRecipe.requiredItem[0].SetDefaults(20); - newRecipe.requiredItem[0].stack = 20; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Copper Watch"); - newRecipe.requiredItem[0].SetDefaults(20); - newRecipe.requiredItem[0].stack = 10; - newRecipe.requiredItem[1].SetDefaults(0x55); - newRecipe.requiredTile[0] = 14; - newRecipe.requiredTile[1] = 15; - addRecipe(); - newRecipe.createItem.SetDefaults("Copper Chandelier"); - newRecipe.requiredItem[0].SetDefaults(20); - newRecipe.requiredItem[0].stack = 4; - newRecipe.requiredItem[1].SetDefaults(8); - newRecipe.requiredItem[1].stack = 4; - newRecipe.requiredItem[2].SetDefaults(0x55); - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(0x16); - newRecipe.requiredItem[0].SetDefaults(11); - newRecipe.requiredItem[0].stack = 3; - newRecipe.requiredTile[0] = 0x11; - addRecipe(); - newRecipe.createItem.SetDefaults(0x23); - newRecipe.requiredItem[0].SetDefaults(0x16); - newRecipe.requiredItem[0].stack = 5; - newRecipe.requiredTile[0] = 0x12; - addRecipe(); - newRecipe.createItem.SetDefaults(0xcd); - newRecipe.requiredItem[0].SetDefaults(0x16); - newRecipe.requiredItem[0].stack = 3; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(1); - newRecipe.requiredItem[0].SetDefaults(0x16); - newRecipe.requiredItem[0].stack = 12; - newRecipe.requiredItem[1].SetDefaults(9); - newRecipe.requiredItem[1].stack = 3; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(10); - newRecipe.requiredItem[0].SetDefaults(0x16); - newRecipe.requiredItem[0].stack = 9; - newRecipe.requiredItem[1].SetDefaults(9); - newRecipe.requiredItem[1].stack = 3; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(7); - newRecipe.requiredItem[0].SetDefaults(0x16); - newRecipe.requiredItem[0].stack = 10; - newRecipe.requiredItem[1].SetDefaults(9); - newRecipe.requiredItem[1].stack = 3; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(4); - newRecipe.requiredItem[0].SetDefaults(0x16); - newRecipe.requiredItem[0].stack = 8; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(6); - newRecipe.requiredItem[0].SetDefaults(0x16); - newRecipe.requiredItem[0].stack = 7; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Iron Bow"); - newRecipe.requiredItem[0].SetDefaults(0x16); - newRecipe.requiredItem[0].stack = 7; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Iron Helmet"); - newRecipe.requiredItem[0].SetDefaults(0x16); - newRecipe.requiredItem[0].stack = 20; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Iron Chainmail"); - newRecipe.requiredItem[0].SetDefaults(0x16); - newRecipe.requiredItem[0].stack = 30; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Iron Greaves"); - newRecipe.requiredItem[0].SetDefaults(0x16); - newRecipe.requiredItem[0].stack = 0x19; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Iron Chain"); - newRecipe.requiredItem[0].SetDefaults(0x16); - newRecipe.requiredItem[0].stack = 3; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(0x15); - newRecipe.requiredItem[0].SetDefaults(14); - newRecipe.requiredItem[0].stack = 4; - newRecipe.requiredTile[0] = 0x11; - addRecipe(); - newRecipe.createItem.SetDefaults("Silver Pickaxe"); - newRecipe.requiredItem[0].SetDefaults(0x15); - newRecipe.requiredItem[0].stack = 12; - newRecipe.requiredItem[1].SetDefaults(9); - newRecipe.requiredItem[1].stack = 4; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Silver Axe"); - newRecipe.requiredItem[0].SetDefaults(0x15); - newRecipe.requiredItem[0].stack = 9; - newRecipe.requiredItem[1].SetDefaults(9); - newRecipe.requiredItem[1].stack = 3; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Silver Hammer"); - newRecipe.requiredItem[0].SetDefaults(0x15); - newRecipe.requiredItem[0].stack = 10; - newRecipe.requiredItem[1].SetDefaults(9); - newRecipe.requiredItem[1].stack = 3; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Silver Broadsword"); - newRecipe.requiredItem[0].SetDefaults(0x15); - newRecipe.requiredItem[0].stack = 8; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Silver Bow"); - newRecipe.requiredItem[0].SetDefaults(0x15); - newRecipe.requiredItem[0].stack = 7; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Silver Helmet"); - newRecipe.requiredItem[0].SetDefaults(0x15); - newRecipe.requiredItem[0].stack = 20; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Silver Chainmail"); - newRecipe.requiredItem[0].SetDefaults(0x15); - newRecipe.requiredItem[0].stack = 30; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Silver Greaves"); - newRecipe.requiredItem[0].SetDefaults(0x15); - newRecipe.requiredItem[0].stack = 0x19; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Silver Watch"); - newRecipe.requiredItem[0].SetDefaults(0x15); - newRecipe.requiredItem[0].stack = 10; - newRecipe.requiredItem[1].SetDefaults(0x55); - newRecipe.requiredTile[0] = 14; - newRecipe.requiredTile[1] = 15; - addRecipe(); - newRecipe.createItem.SetDefaults("Silver Chandelier"); - newRecipe.requiredItem[0].SetDefaults(0x15); - newRecipe.requiredItem[0].stack = 4; - newRecipe.requiredItem[1].SetDefaults(8); - newRecipe.requiredItem[1].stack = 4; - newRecipe.requiredItem[2].SetDefaults(0x55); - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(0x13); - newRecipe.requiredItem[0].SetDefaults(13); - newRecipe.requiredItem[0].stack = 4; - newRecipe.requiredTile[0] = 0x11; - addRecipe(); - newRecipe.createItem.SetDefaults("Gold Pickaxe"); - newRecipe.requiredItem[0].SetDefaults(0x13); - newRecipe.requiredItem[0].stack = 12; - newRecipe.requiredItem[1].SetDefaults(9); - newRecipe.requiredItem[1].stack = 4; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Gold Axe"); - newRecipe.requiredItem[0].SetDefaults(0x13); - newRecipe.requiredItem[0].stack = 9; - newRecipe.requiredItem[1].SetDefaults(9); - newRecipe.requiredItem[1].stack = 3; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Gold Hammer"); - newRecipe.requiredItem[0].SetDefaults(0x13); - newRecipe.requiredItem[0].stack = 10; - newRecipe.requiredItem[1].SetDefaults(9); - newRecipe.requiredItem[1].stack = 3; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Gold Broadsword"); - newRecipe.requiredItem[0].SetDefaults(0x13); - newRecipe.requiredItem[0].stack = 8; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Gold Shortsword"); - newRecipe.requiredItem[0].SetDefaults(0x13); - newRecipe.requiredItem[0].stack = 7; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Gold Bow"); - newRecipe.requiredItem[0].SetDefaults(0x13); - newRecipe.requiredItem[0].stack = 7; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Gold Helmet"); - newRecipe.requiredItem[0].SetDefaults(0x13); - newRecipe.requiredItem[0].stack = 0x19; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Gold Chainmail"); - newRecipe.requiredItem[0].SetDefaults(0x13); - newRecipe.requiredItem[0].stack = 0x23; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Gold Greaves"); - newRecipe.requiredItem[0].SetDefaults(0x13); - newRecipe.requiredItem[0].stack = 30; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Gold Watch"); - newRecipe.requiredItem[0].SetDefaults(0x13); - newRecipe.requiredItem[0].stack = 10; - newRecipe.requiredItem[1].SetDefaults(0x55); - newRecipe.requiredTile[0] = 14; - newRecipe.requiredTile[1] = 15; - addRecipe(); - newRecipe.createItem.SetDefaults("Gold Chandelier"); - newRecipe.requiredItem[0].SetDefaults(0x13); - newRecipe.requiredItem[0].stack = 4; - newRecipe.requiredItem[1].SetDefaults(8); - newRecipe.requiredItem[1].stack = 4; - newRecipe.requiredItem[2].SetDefaults(0x55); - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Candle"); - newRecipe.requiredItem[0].SetDefaults(0x13); - newRecipe.requiredItem[1].SetDefaults(8); - newRecipe.requiredTile[0] = 0x12; - addRecipe(); - newRecipe.createItem.SetDefaults(0x39); - newRecipe.requiredItem[0].SetDefaults(0x38); - newRecipe.requiredItem[0].stack = 4; - newRecipe.requiredTile[0] = 0x11; - addRecipe(); - newRecipe.createItem.SetDefaults(0x2c); - newRecipe.requiredItem[0].SetDefaults(0x39); - newRecipe.requiredItem[0].stack = 8; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Unholy Arrow"); - newRecipe.createItem.stack = 2; - newRecipe.requiredItem[0].SetDefaults(40); - newRecipe.requiredItem[0].stack = 2; - newRecipe.requiredItem[1].SetDefaults(0x45); - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(0x2d); - newRecipe.requiredItem[0].SetDefaults(0x39); - newRecipe.requiredItem[0].stack = 10; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(0x2e); - newRecipe.requiredItem[0].SetDefaults(0x39); - newRecipe.requiredItem[0].stack = 10; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Shadow Helmet"); - newRecipe.requiredItem[0].SetDefaults(0x39); - newRecipe.requiredItem[0].stack = 15; - newRecipe.requiredItem[1].SetDefaults(0x56); - newRecipe.requiredItem[1].stack = 10; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Shadow Scalemail"); - newRecipe.requiredItem[0].SetDefaults(0x39); - newRecipe.requiredItem[0].stack = 0x19; - newRecipe.requiredItem[1].SetDefaults(0x56); - newRecipe.requiredItem[1].stack = 20; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Shadow Greaves"); - newRecipe.requiredItem[0].SetDefaults(0x39); - newRecipe.requiredItem[0].stack = 20; - newRecipe.requiredItem[1].SetDefaults(0x56); - newRecipe.requiredItem[1].stack = 15; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Nightmare Pickaxe"); - newRecipe.requiredItem[0].SetDefaults(0x39); - newRecipe.requiredItem[0].stack = 12; - newRecipe.requiredItem[1].SetDefaults(0x56); - newRecipe.requiredItem[1].stack = 6; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("The Breaker"); - newRecipe.requiredItem[0].SetDefaults(0x39); - newRecipe.requiredItem[0].stack = 10; - newRecipe.requiredItem[1].SetDefaults(0x56); - newRecipe.requiredItem[1].stack = 5; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Grappling Hook"); - newRecipe.requiredItem[0].SetDefaults(0x55); - newRecipe.requiredItem[0].stack = 3; - newRecipe.requiredItem[1].SetDefaults(0x76); - newRecipe.requiredItem[1].stack = 1; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(0x75); - newRecipe.requiredItem[0].SetDefaults(0x74); - newRecipe.requiredItem[0].stack = 6; - newRecipe.requiredTile[0] = 0x11; - addRecipe(); - newRecipe.createItem.SetDefaults(0xc6); - newRecipe.requiredItem[0].SetDefaults(0x75); - newRecipe.requiredItem[0].stack = 20; - newRecipe.requiredItem[1].SetDefaults(0xb1); - newRecipe.requiredItem[1].stack = 10; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(0xc7); - newRecipe.requiredItem[0].SetDefaults(0x75); - newRecipe.requiredItem[0].stack = 20; - newRecipe.requiredItem[1].SetDefaults(0xb2); - newRecipe.requiredItem[1].stack = 10; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(200); - newRecipe.requiredItem[0].SetDefaults(0x75); - newRecipe.requiredItem[0].stack = 20; - newRecipe.requiredItem[1].SetDefaults(0xb3); - newRecipe.requiredItem[1].stack = 10; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(0xc9); - newRecipe.requiredItem[0].SetDefaults(0x75); - newRecipe.requiredItem[0].stack = 20; - newRecipe.requiredItem[1].SetDefaults(0xb5); - newRecipe.requiredItem[1].stack = 10; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(0xca); - newRecipe.requiredItem[0].SetDefaults(0x75); - newRecipe.requiredItem[0].stack = 20; - newRecipe.requiredItem[1].SetDefaults(0xb6); - newRecipe.requiredItem[1].stack = 10; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(0xcb); - newRecipe.requiredItem[0].SetDefaults(0x75); - newRecipe.requiredItem[0].stack = 20; - newRecipe.requiredItem[1].SetDefaults(180); - newRecipe.requiredItem[1].stack = 10; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(0xcc); - newRecipe.requiredItem[0].SetDefaults(0x75); - newRecipe.requiredItem[0].stack = 0x23; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(0x7f); - newRecipe.requiredItem[0].SetDefaults(0x5f); - newRecipe.requiredItem[1].SetDefaults(0x75); - newRecipe.requiredItem[1].stack = 30; - newRecipe.requiredItem[2].SetDefaults(0x4b); - newRecipe.requiredItem[2].stack = 10; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(0xc5); - newRecipe.requiredItem[0].SetDefaults(0x62); - newRecipe.requiredItem[1].SetDefaults(0x75); - newRecipe.requiredItem[1].stack = 20; - newRecipe.requiredItem[2].SetDefaults(0x4b); - newRecipe.requiredItem[2].stack = 5; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Meteor Helmet"); - newRecipe.requiredItem[0].SetDefaults(0x75); - newRecipe.requiredItem[0].stack = 0x19; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Meteor Suit"); - newRecipe.requiredItem[0].SetDefaults(0x75); - newRecipe.requiredItem[0].stack = 0x23; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Meteor Leggings"); - newRecipe.requiredItem[0].SetDefaults(0x75); - newRecipe.requiredItem[0].stack = 30; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Meteor Shot"); - newRecipe.createItem.stack = 100; - newRecipe.requiredItem[0].SetDefaults(0x75); - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(0x97); - newRecipe.requiredItem[0].SetDefaults(0x9a); - newRecipe.requiredItem[0].stack = 0x19; - newRecipe.requiredItem[1].SetDefaults(150); - newRecipe.requiredItem[1].stack = 40; - newRecipe.requiredTile[0] = 0x12; - addRecipe(); - newRecipe.createItem.SetDefaults(0x98); - newRecipe.requiredItem[0].SetDefaults(0x9a); - newRecipe.requiredItem[0].stack = 0x23; - newRecipe.requiredItem[1].SetDefaults(150); - newRecipe.requiredItem[1].stack = 50; - newRecipe.requiredTile[0] = 0x12; - addRecipe(); - newRecipe.createItem.SetDefaults(0x99); - newRecipe.requiredItem[0].SetDefaults(0x9a); - newRecipe.requiredItem[0].stack = 30; - newRecipe.requiredItem[1].SetDefaults(150); - newRecipe.requiredItem[1].stack = 0x2d; - newRecipe.requiredTile[0] = 0x12; - addRecipe(); - newRecipe.createItem.SetDefaults(0xaf); - newRecipe.requiredItem[0].SetDefaults(0xae); - newRecipe.requiredItem[0].stack = 6; - newRecipe.requiredItem[1].SetDefaults(0xad); - newRecipe.requiredItem[1].stack = 2; - newRecipe.requiredTile[0] = 0x4d; - addRecipe(); - newRecipe.createItem.SetDefaults(0x77); - newRecipe.requiredItem[0].SetDefaults(0xaf); - newRecipe.requiredItem[0].stack = 15; - newRecipe.requiredItem[1].SetDefaults(0x37); - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(120); - newRecipe.requiredItem[0].SetDefaults(0xaf); - newRecipe.requiredItem[0].stack = 0x19; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(0x79); - newRecipe.requiredItem[0].SetDefaults(0xaf); - newRecipe.requiredItem[0].stack = 0x23; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(0x7a); - newRecipe.requiredItem[0].SetDefaults(0xaf); - newRecipe.requiredItem[0].stack = 0x23; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(0xd9); - newRecipe.requiredItem[0].SetDefaults(0xaf); - newRecipe.requiredItem[0].stack = 0x23; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(0xdb); - newRecipe.requiredItem[0].SetDefaults(0xaf); - newRecipe.requiredItem[0].stack = 20; - newRecipe.requiredItem[1].SetDefaults("Handgun"); - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(0xe7); - newRecipe.requiredItem[0].SetDefaults(0xaf); - newRecipe.requiredItem[0].stack = 30; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(0xe8); - newRecipe.requiredItem[0].SetDefaults(0xaf); - newRecipe.requiredItem[0].stack = 40; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(0xe9); - newRecipe.requiredItem[0].SetDefaults(0xaf); - newRecipe.requiredItem[0].stack = 0x23; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(190); - newRecipe.requiredItem[0].SetDefaults("Silver Broadsword"); - newRecipe.requiredItem[1].SetDefaults(0xd0); - newRecipe.requiredItem[1].stack = 40; - newRecipe.requiredItem[2].SetDefaults(0xd1); - newRecipe.requiredItem[2].stack = 20; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(0xbf); - newRecipe.requiredItem[0].SetDefaults(0xd0); - newRecipe.requiredItem[0].stack = 40; - newRecipe.requiredItem[1].SetDefaults(0xd1); - newRecipe.requiredItem[1].stack = 30; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults(0xb9); - newRecipe.requiredItem[0].SetDefaults(0x54); - newRecipe.requiredItem[1].SetDefaults(0xd0); - newRecipe.requiredItem[1].stack = 30; - newRecipe.requiredItem[2].SetDefaults(210); - newRecipe.requiredItem[2].stack = 3; - newRecipe.requiredTile[0] = 0x10; - addRecipe(); - newRecipe.createItem.SetDefaults("Depth Meter"); - newRecipe.requiredItem[0].SetDefaults(20); - newRecipe.requiredItem[0].stack = 10; - newRecipe.requiredItem[1].SetDefaults(0x15); - newRecipe.requiredItem[1].stack = 8; - newRecipe.requiredItem[2].SetDefaults(0x13); - newRecipe.requiredItem[2].stack = 6; - newRecipe.requiredTile[0] = 14; - newRecipe.requiredTile[1] = 15; - addRecipe(); - newRecipe.createItem.SetDefaults(0xc1); - newRecipe.requiredItem[0].SetDefaults(0xad); - newRecipe.requiredItem[0].stack = 20; - newRecipe.requiredTile[0] = 0x11; - addRecipe(); - newRecipe.createItem.SetDefaults("Goggles"); - newRecipe.requiredItem[0].SetDefaults(0x26); - newRecipe.requiredItem[0].stack = 2; - newRecipe.requiredTile[0] = 0x12; - newRecipe.requiredTile[1] = 15; - addRecipe(); - newRecipe.createItem.SetDefaults("Mana Crystal"); - newRecipe.requiredItem[0].SetDefaults(0x4b); - newRecipe.requiredItem[0].stack = 10; - addRecipe(); - newRecipe.createItem.SetDefaults(0x2b); - newRecipe.requiredItem[0].SetDefaults(0x26); - newRecipe.requiredItem[0].stack = 10; - newRecipe.requiredTile[0] = 0x1a; - addRecipe(); - newRecipe.createItem.SetDefaults(70); - newRecipe.requiredItem[0].SetDefaults(0x43); - newRecipe.requiredItem[0].stack = 30; - newRecipe.requiredItem[1].SetDefaults(0x44); - newRecipe.requiredItem[1].stack = 15; - newRecipe.requiredTile[0] = 0x1a; - addRecipe(); - newRecipe.createItem.SetDefaults(0x47); - newRecipe.createItem.stack = 100; - newRecipe.requiredItem[0].SetDefaults(0x48); - newRecipe.requiredItem[0].stack = 1; - addRecipe(); - newRecipe.createItem.SetDefaults(0x48); - newRecipe.createItem.stack = 1; - newRecipe.requiredItem[0].SetDefaults(0x47); - newRecipe.requiredItem[0].stack = 100; - addRecipe(); - newRecipe.createItem.SetDefaults(0x48); - newRecipe.createItem.stack = 100; - newRecipe.requiredItem[0].SetDefaults(0x49); - newRecipe.requiredItem[0].stack = 1; - addRecipe(); - newRecipe.createItem.SetDefaults(0x49); - newRecipe.createItem.stack = 1; - newRecipe.requiredItem[0].SetDefaults(0x48); - newRecipe.requiredItem[0].stack = 100; - addRecipe(); - newRecipe.createItem.SetDefaults(0x49); - newRecipe.createItem.stack = 100; - newRecipe.requiredItem[0].SetDefaults(0x4a); - newRecipe.requiredItem[0].stack = 1; - addRecipe(); - newRecipe.createItem.SetDefaults(0x4a); - newRecipe.createItem.stack = 1; - newRecipe.requiredItem[0].SetDefaults(0x49); - newRecipe.requiredItem[0].stack = 100; - addRecipe(); - } - } -} - diff --git a/Terraria/ServerSock.cs b/Terraria/ServerSock.cs deleted file mode 100644 index 638e2b06..00000000 --- a/Terraria/ServerSock.cs +++ /dev/null @@ -1,110 +0,0 @@ -namespace Terraria -{ - using System; - using System.Net.Sockets; - - public class ServerSock - { - public bool active; - public bool announced; - public Socket clientSocket; - public bool kill; - public bool locked; - public string name = "Anonymous"; - public NetworkStream networkStream; - public string oldName = ""; - public byte[] readBuffer; - public int state; - public int statusCount; - public int statusMax; - public string statusText = ""; - public string statusText2; - public TcpClient tcpClient = new TcpClient(); - public bool[,] tileSection = new bool[Main.maxTilesX / 200, Main.maxTilesY / 150]; - public int timeOut; - public int whoAmI; - public byte[] writeBuffer; - - public void Reset() - { - for (int i = 0; i < Main.maxSectionsX; i++) - { - for (int j = 0; j < Main.maxSectionsY; j++) - { - this.tileSection[i, j] = false; - } - } - if (this.whoAmI < 8) - { - Main.player[this.whoAmI] = new Player(); - } - this.timeOut = 0; - this.statusCount = 0; - this.statusMax = 0; - this.statusText2 = ""; - this.statusText = ""; - this.name = "Anonymous"; - this.state = 0; - this.locked = false; - this.kill = false; - this.active = false; - NetMessage.buffer[this.whoAmI].Reset(); - if (this.networkStream != null) - { - this.networkStream.Close(); - } - if (this.tcpClient != null) - { - this.tcpClient.Close(); - } - } - - public void ServerReadCallBack(IAsyncResult ar) - { - int streamLength = 0; - if (!Netplay.disconnect) - { - try - { - streamLength = this.networkStream.EndRead(ar); - } - catch - { - } - if (streamLength == 0) - { - this.kill = true; - } - else - { - if (Main.ignoreErrors) - { - try - { - NetMessage.RecieveBytes(this.readBuffer, streamLength, this.whoAmI); - goto Label_0057; - } - catch - { - goto Label_0057; - } - } - NetMessage.RecieveBytes(this.readBuffer, streamLength, this.whoAmI); - } - } - Label_0057: - this.locked = false; - } - - public void ServerWriteCallBack(IAsyncResult ar) - { - messageBuffer buffer1 = NetMessage.buffer[this.whoAmI]; - buffer1.spamCount--; - if (this.statusMax > 0) - { - this.statusCount++; - } - } - } -} - diff --git a/Terraria/ShankShock.cs b/Terraria/ShankShock.cs deleted file mode 100644 index a8d3395c..00000000 --- a/Terraria/ShankShock.cs +++ /dev/null @@ -1,488 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.IO; -using System.Net; - -namespace Terraria -{ - class ShankShock - { - private static double version = 4; - private static bool shownVersion = false; - - public static bool killGuide = true; - public static int invasionMultiplier = 1; - public static int defaultMaxSpawns = 4; - public static int defaultSpawnRate = 700; - public static bool kickCheater = true; - public static bool banCheater = true; - public static int serverPort = 7777; - public static bool enableWhitelist = false; - public static bool infinateInvasion = false; - public static bool permaPvp = false; - private static string saveDir = "./tshock/"; - public static int killCount = 0; - public static bool shownOneTimeInvasionMinder = false; - - public static string tileWhitelist = ""; - private static bool banTnt = false; - private static bool kickTnt = false; - - public enum NPCList : int - { - WORLD_EATER=0, - EYE=1, - SKELETRON=2 - } - - public static void ShowUpdateReminder(int ply) - { - if (!shownVersion) - { - if (IsAdmin(FindPlayer(ply))) - { - WebClient client = new WebClient(); - client.Headers.Add("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705;)"); - try - { - string updateVersion = client.DownloadString("http://shankshock.com/tshock.txt"); - string[] changes = updateVersion.Split(','); - float[] color = { 255, 255, 000 }; - if (Convert.ToDouble(changes[0]) > version) - { - SendMessage(ply, "This server is out of date. Version " + changes[0] + " is out.", color); - for (int i = 1; i <= changes.Length; i++) - { - SendMessage(ply, changes[i], color); - } - } - } - catch (Exception e) - { - _writeError(e.Message); - } - shownVersion = true; - } - } - } - - public static void IncrementKills() - { - killCount++; - Random r = new Random(); - int random = r.Next(5); - if (killCount % 100 == 0) - { - switch (random) - { - case 0: - ShankShock.Broadcast("You call that a lot? " + killCount + " goblins killed!"); - break; - case 1: - ShankShock.Broadcast("Fatality! " + killCount + " goblins killed!"); - break; - case 2: - ShankShock.Broadcast("Number of 'noobs' killed to date: " + killCount); - break; - case 3: - ShankShock.Broadcast("Duke Nukem would be proud. " + killCount + " goblins killed."); - break; - case 4: - ShankShock.Broadcast("You call that a lot? " + killCount + " goblins killed!"); - break; - case 5: - ShankShock.Broadcast(killCount + " copies of Call of Duty smashed."); - break; - } - - } - } - - public static bool OnWhitelist(string ip) - { - if (!enableWhitelist) { return true; } - if (!System.IO.File.Exists(saveDir +"whitelist.txt")) { CreateFile(saveDir + "whitelist.txt"); TextWriter tw = new StreamWriter(saveDir + "whitelist.txt"); tw.WriteLine("127.0.0.1"); tw.Close(); } - TextReader tr = new StreamReader(saveDir + "whitelist.txt"); - string whitelist = tr.ReadToEnd(); - ip = Tools.GetRealIP(ip); - if (whitelist.Contains(ip)) { return true; } else { return false; } - } - - public static void NewNPC(int type, int x, int y, int target) - { - - switch (type) - { - case 0: //World Eater - WorldGen.shadowOrbSmashed = true; - WorldGen.shadowOrbCount = 3; - int w = NPC.NewNPC(x, y, 13, 1); - Main.npc[w].target = target; - break; - case 1: //Eye - Main.time = 4861; - Main.dayTime = false; - WorldGen.spawnEye = true; - break; - case 2: //Skeletron - int enpeecee = NPC.NewNPC(x, y, 0x23, 0); - Main.npc[enpeecee].netUpdate = true; - break; - - } - - } - - private static string GetPlayers() - { - string str = ""; - for (int i = 0; i < 8; i++) - { - if (Main.player[i].active) - { - if (str == "") - { - str = str + Main.player[i].name; - } - else - { - str = str + ", " + Main.player[i].name; - } - } - } - return str; - } - - public static void ShowMOTD(int ply) - { - string foo = ""; - TextReader tr = new StreamReader(saveDir + "motd.txt"); - while ((foo = tr.ReadLine()) != null) - { - foo = foo.Replace("%map%", Main.worldName); - foo = foo.Replace("%players%", GetPlayers()); - if (foo.Substring(0, 1) == "%" && foo.Substring(12, 1) == "%") //Look for a beginning color code. - { - string possibleColor = foo.Substring(0, 13); - foo = foo.Remove(0, 13); - float[] pC = { 0, 0, 0 }; - possibleColor = possibleColor.Replace("%", ""); - string[] pCc = possibleColor.Split(','); - if (pCc.Length == 3) - { - try - { - pC[0] = Clamp(Convert.ToInt32(pCc[0]), 255, 0); - pC[1] = Clamp(Convert.ToInt32(pCc[1]), 255, 0); - pC[2] = Clamp(Convert.ToInt32(pCc[2]), 255, 0); - SendMessage(ply, foo, pC); - continue; - } - catch (Exception e) - { - _writeError(e.Message); - } - } - } - SendMessage(ply, foo); - } - tr.Close(); - } - - public static T Clamp(T value, T max, T min) - where T : System.IComparable - { - T result = value; - if (value.CompareTo(max) > 0) - result = max; - if (value.CompareTo(min) < 0) - result = min; - return result; - } - - private static void CreateFile(string file) - { - using (FileStream fs = File.Create(file)) { } - } - - private static void KeepTilesUpToDate() - { - TextReader tr = new StreamReader(saveDir + "tiles.txt"); - string file = tr.ReadToEnd(); - tr.Close(); - if (!file.Contains("0x3d")) - { - System.IO.File.Delete(saveDir + "tiles.txt"); - CreateFile(saveDir + "tiles.txt"); - TextWriter tw = new StreamWriter(saveDir + "tiles.txt"); - tw.Write("0x03, 0x05, 0x14, 0x25, 0x18, 0x18, 0x20, 0x1b, 0x34, 0x48, 0x33, 0x3d, 0x47, 0x49, 0x4a, 0x35, 0x3d, 0x3e, 0x45, 0x47, 0x49, 0x4a,"); - tw.Close(); - } - } - - public static void SetupConfig() - { - if (!System.IO.Directory.Exists(saveDir)) { System.IO.Directory.CreateDirectory(saveDir); } - if (!System.IO.File.Exists(saveDir + "tiles.txt")) - { - CreateFile(saveDir + "tiles.txt"); - TextWriter tw = new StreamWriter(saveDir + "tiles.txt"); - tw.Write("0x03, 0x05, 0x14, 0x25, 0x18, 0x18, 0x20, 0x1b, 0x34, 0x48, 0x33, 0x3d, 0x47, 0x49, 0x4a, 0x35, 0x3d, 0x3e, 0x45, 0x47, 0x49, 0x4a,"); - tw.Close(); - } - if (!System.IO.File.Exists(saveDir + "motd.txt")) { - CreateFile(saveDir + "motd.txt"); - TextWriter tw = new StreamWriter(saveDir + "motd.txt"); - tw.WriteLine("This server is running TShock. Type /help for a list of commands."); - tw.WriteLine("%255,000,000%Current map: %map%"); - tw.WriteLine("Current players: %players%"); - tw.Close(); } - if (!System.IO.File.Exists(saveDir +"bans.txt")) { CreateFile(saveDir + "bans.txt"); } - if (!System.IO.File.Exists(saveDir +"cheaters.txt")) { CreateFile(saveDir + "cheaters.txt"); } - if (!System.IO.File.Exists(saveDir +"admins.txt")) { CreateFile(saveDir + "admins.txt"); } - if (!System.IO.File.Exists(saveDir +"grief.txt")) { CreateFile(saveDir + "grief.txt"); } - if (!System.IO.File.Exists(saveDir +"config.txt")) - { - CreateFile(saveDir + "config.txt"); - TextWriter tw = new StreamWriter(saveDir + "config.txt"); - tw.WriteLine("true,50,4,700,true,true,7777,false,false,false,false,false"); - tw.Close(); - } - KeepTilesUpToDate(); - TextReader tr = new StreamReader(saveDir + "config.txt"); - string config = tr.ReadToEnd(); - config = config.Replace("\n", ""); - config = config.Replace("\r", ""); - config = config.Replace(" ", ""); - tr.Close(); - string[] configuration = config.Split(','); - try - { - killGuide = Convert.ToBoolean(configuration[0]); - invasionMultiplier = Convert.ToInt32(configuration[1]); - defaultMaxSpawns = Convert.ToInt32(configuration[2]); - defaultSpawnRate = Convert.ToInt32(configuration[3]); - kickCheater = Convert.ToBoolean(configuration[4]); - banCheater = Convert.ToBoolean(configuration[5]); - serverPort = Convert.ToInt32(configuration[6]); - enableWhitelist = Convert.ToBoolean(configuration[7]); - infinateInvasion = Convert.ToBoolean(configuration[8]); - permaPvp = Convert.ToBoolean(configuration[9]); - kickTnt = Convert.ToBoolean(configuration[10]); - banTnt = Convert.ToBoolean(configuration[11]); - if (infinateInvasion) - { - Main.startInv(); - } - } - catch (Exception e) - { - _writeError(e.Message); - } - - Netplay.serverPort = serverPort; - } - - public static bool TileOnWhitelist(byte tile) - { - int _tile = (int)tile; - TextReader tr2 = new StreamReader(saveDir + "tiles.txt"); - tileWhitelist = tr2.ReadToEnd(); tr2.Close(); - string hexValue = _tile.ToString("X"); - if (hexValue == "0") - { - return false; - } - Console.WriteLine(hexValue); - return tileWhitelist.Contains(hexValue); - } - - public static void SetupJsonConfig() - { - throw new NotImplementedException(); - } - - public static void HandleGrief(int ply) - { - - if (banTnt) { _writeGrief(ply); } - if (kickTnt) { ShankShock.Broadcast(FindPlayer(ply) + " was " + (banTnt ? "banned " : "kicked ") + "for kill tile abuse."); Kick(ply); } - } - - private static void _writeGrief(int ply) - { - TextWriter tw = new StreamWriter(saveDir + "grief.txt", true); - tw.WriteLine("[" + Main.player[ply].name + "] [" + Tools.GetRealIP(Netplay.serverSock[ply].tcpClient.Client.RemoteEndPoint.ToString()) + "]"); - tw.Close(); - } - - private static void _writeError(string err) - { - if (System.IO.File.Exists(saveDir +"errors.txt")) - { - TextWriter tw = new StreamWriter(saveDir + "errors.txt", true); - tw.WriteLine(err); - tw.Close(); - } - else - { - CreateFile(saveDir + "errors.txt"); - TextWriter tw = new StreamWriter(saveDir + "errors.txt", true); - tw.WriteLine(err); - tw.Close(); - } - } - - public static void _writeban(int ply) - { - string ip = Tools.GetRealIP(Convert.ToString(Netplay.serverSock[ply].tcpClient.Client.RemoteEndPoint)); - TextWriter tw = new StreamWriter(saveDir + "bans.txt", true); - tw.WriteLine("[" + Main.player[ply].name + "] " + "[" + ip + "]"); - tw.Close(); - } - - public static void _writecheater(int ply) - { - string ip = Tools.GetRealIP(Convert.ToString(Netplay.serverSock[ply].tcpClient.Client.RemoteEndPoint)); - string cheaters = ""; - TextReader tr = new StreamReader(saveDir + "cheaters.txt"); - cheaters = tr.ReadToEnd(); - tr.Close(); - if (cheaters.Contains(Main.player[ply].name) && cheaters.Contains(ip)) { return; } - TextWriter sw = new StreamWriter(saveDir + "cheaters.txt", true); - sw.WriteLine("[" + Main.player[ply].name + "] " + "[" + ip + "]"); - sw.Close(); - } - - public static void Kick(int ply) - { - Netplay.serverSock[ply].kill = true; - Netplay.serverSock[ply].Reset(); - NetMessage.syncPlayers(); - } - - public static void HandleCheater(int ply) - { - string cheater = ShankShock.FindPlayer(ply); - string ip = Tools.GetRealIP(Convert.ToString(Netplay.serverSock[ply].tcpClient.Client.RemoteEndPoint)); - - _writecheater(ply); - if (!kickCheater) { return; } - Netplay.serverSock[ply].kill = true; - Netplay.serverSock[ply].Reset(); - NetMessage.syncPlayers(); - ShankShock.Broadcast(cheater + " was " + (banCheater ? "banned " : "kicked ") + "for cheating."); - - } - - public static bool CheckGreif(String ip) - { - ip = Tools.GetRealIP(ip); - if (!banTnt) { return false; } - TextReader tr = new StreamReader(saveDir + "grief.txt"); - string list = tr.ReadToEnd(); - tr.Close(); - - return list.Contains(ip); - } - - public static bool CheckCheat(String ip) - { - ip = Tools.GetRealIP(ip); - if (!banCheater) { return false; } - TextReader tr = new StreamReader(saveDir + "cheaters.txt"); - string trr = tr.ReadToEnd(); - tr.Close(); - if (trr.Contains(ip)) { - return true; - } - return false; - } - - public static bool CheckBanned(String p) - { - String ip = p.Split(':')[0]; - TextReader tr = new StreamReader(saveDir + "bans.txt"); - string banlist = tr.ReadToEnd(); - tr.Close(); - banlist = banlist.Trim(); - if (banlist.Contains(ip)) - return true; - return false; - } - - public static void SendMessage(int ply, string msg, float[] color) - { - NetMessage.SendData(0x19, ply, -1, msg, 8, color[0], color[1], color[2]); - } - - public static void SendMessage(int ply, string message) - { - NetMessage.SendData(0x19, ply, -1, message, 8, 0f, 255f, 0f); - } - - public static int FindPlayer(string ply) - { - int pl = -1; - for (int i = 0; i < Main.player.Length; i++) - { - if ((ply.ToLower()) == Main.player[i].name.ToLower()) - { - pl = i; - break; - } - } - return pl; - } - - public static string FindPlayer(int ply) - { - for (int i = 0; i < Main.player.Length; i++) - { - if (i == ply) - { - return Main.player[i].name; - } - } - return "null"; - } - - public static void Broadcast(string msg) - { - for (int i = 0; i < Main.player.Length; i++) - { - SendMessage(i, msg); - } - } - - public static bool IsAdmin(string ply) - { - string remoteEndPoint = Convert.ToString((Netplay.serverSock[ShankShock.FindPlayer(ply)].tcpClient.Client.RemoteEndPoint)); - string[] remoteEndPointIP = remoteEndPoint.Split(':'); - TextReader tr = new StreamReader(saveDir + "admins.txt"); - string adminlist = tr.ReadToEnd(); - tr.Close(); - if (adminlist.Contains(remoteEndPointIP[0])) - { - return true; - } - return false; - } - - public static bool IsAdmin(int ply) - { - string remoteEndPoint = Convert.ToString((Netplay.serverSock[ply].tcpClient.Client.RemoteEndPoint)); - string[] remoteEndPointIP = remoteEndPoint.Split(':'); - TextReader tr = new StreamReader(saveDir + "admins.txt"); - string adminlist = tr.ReadToEnd(); - tr.Close(); - if (adminlist.Contains(remoteEndPointIP[0])) - { - return true; - } - return false; - } - } -} diff --git a/Terraria/ShankShockCommandProcessor.cs b/Terraria/ShankShockCommandProcessor.cs deleted file mode 100644 index b72a96b0..00000000 --- a/Terraria/ShankShockCommandProcessor.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -namespace Terraria -{ - class ShankShockCommandProcessor - { - private string[] commands = - { - "hardcore", - "break", - "skeletron", - "reload", - "bloodmoon", - "dropmeteor", - "eye", - "invade", - "help", - "spawn", - "kc", - "eater", - "testadmin", - "kick", - "ban", - }; - - - } -} diff --git a/Terraria/Sign.cs b/Terraria/Sign.cs deleted file mode 100644 index e02844dd..00000000 --- a/Terraria/Sign.cs +++ /dev/null @@ -1,78 +0,0 @@ -namespace Terraria -{ - using System; - - public class Sign - { - public const int maxSigns = 0x3e8; - public string text; - public int x; - public int y; - - public static void KillSign(int x, int y) - { - for (int i = 0; i < 0x3e8; i++) - { - if (((Main.sign[i] != null) && (Main.sign[i].x == x)) && (Main.sign[i].y == y)) - { - Main.sign[i] = null; - } - } - } - - public static int ReadSign(int i, int j) - { - int num = Main.tile[i, j].frameX / 0x12; - int num2 = Main.tile[i, j].frameY / 0x12; - while (num > 1) - { - num -= 2; - } - int x = i - num; - int y = j - num2; - if (Main.tile[x, y].type != 0x37) - { - KillSign(x, y); - return -1; - } - int num5 = -1; - for (int k = 0; k < 0x3e8; k++) - { - if (((Main.sign[k] != null) && (Main.sign[k].x == x)) && (Main.sign[k].y == y)) - { - num5 = k; - break; - } - } - if (num5 < 0) - { - for (int m = 0; m < 0x3e8; m++) - { - if (Main.sign[m] == null) - { - num5 = m; - Main.sign[m] = new Sign(); - Main.sign[m].x = x; - Main.sign[m].y = y; - Main.sign[m].text = ""; - return num5; - } - } - } - return num5; - } - - public static void TextSign(int i, string text) - { - if (((Main.tile[Main.sign[i].x, Main.sign[i].y] == null) || !Main.tile[Main.sign[i].x, Main.sign[i].y].active) || (Main.tile[Main.sign[i].x, Main.sign[i].y].type != 0x37)) - { - Main.sign[i] = null; - } - else - { - Main.sign[i].text = text; - } - } - } -} - diff --git a/Terraria/Star.cs b/Terraria/Star.cs deleted file mode 100644 index 359c1734..00000000 --- a/Terraria/Star.cs +++ /dev/null @@ -1,78 +0,0 @@ -namespace Terraria -{ - using Microsoft.Xna.Framework; - using System; - - public class Star - { - public Vector2 position; - public float rotation; - public float rotationSpeed; - public float scale; - public float twinkle; - public float twinkleSpeed; - public int type; - - public static void SpawnStars() - { - Main.numStars = Main.rand.Next(0x41, 130); - Main.numStars = 130; - for (int i = 0; i < Main.numStars; i++) - { - Main.star[i] = new Star(); - Main.star[i].position.X = Main.rand.Next(-12, Main.screenWidth + 1); - Main.star[i].position.Y = Main.rand.Next(-12, (int) (Main.screenHeight * 1.35)); - Main.star[i].rotation = Main.rand.Next(0x274) * 0.01f; - Main.star[i].scale = Main.rand.Next(50, 120) * 0.01f; - Main.star[i].type = Main.rand.Next(0, 5); - Main.star[i].twinkle = Main.rand.Next(0x65) * 0.01f; - Main.star[i].twinkleSpeed = Main.rand.Next(40, 100) * 0.0001f; - if (Main.rand.Next(2) == 0) - { - Star star1 = Main.star[i]; - star1.twinkleSpeed *= -1f; - } - Main.star[i].rotationSpeed = Main.rand.Next(10, 40) * 0.0001f; - if (Main.rand.Next(2) == 0) - { - Star star2 = Main.star[i]; - star2.rotationSpeed *= -1f; - } - } - } - - public static void UpdateStars() - { - for (int i = 0; i < Main.numStars; i++) - { - Star star1 = Main.star[i]; - star1.twinkle += Main.star[i].twinkleSpeed; - if (Main.star[i].twinkle > 1f) - { - Main.star[i].twinkle = 1f; - Star star2 = Main.star[i]; - star2.twinkleSpeed *= -1f; - } - else if (Main.star[i].twinkle < 0.5) - { - Main.star[i].twinkle = 0.5f; - Star star3 = Main.star[i]; - star3.twinkleSpeed *= -1f; - } - Star star4 = Main.star[i]; - star4.rotation += Main.star[i].rotationSpeed; - if (Main.star[i].rotation > 6.28) - { - Star star5 = Main.star[i]; - star5.rotation -= 6.28f; - } - if (Main.star[i].rotation < 0f) - { - Star star6 = Main.star[i]; - star6.rotation += 6.28f; - } - } - } - } -} - diff --git a/Terraria/Tile.cs b/Terraria/Tile.cs deleted file mode 100644 index a0f5bf49..00000000 --- a/Terraria/Tile.cs +++ /dev/null @@ -1,23 +0,0 @@ -namespace Terraria -{ - using System; - - public class Tile - { - public bool active; - public bool checkingLiquid; - public byte frameNumber; - public short frameX; - public short frameY; - public bool lava; - public bool lighted; - public byte liquid; - public bool skipLiquid; - public byte type; - public byte wall; - public byte wallFrameNumber; - public byte wallFrameX; - public byte wallFrameY; - } -} - diff --git a/Terraria/WorldGen.cs b/Terraria/WorldGen.cs deleted file mode 100644 index a0b843f3..00000000 --- a/Terraria/WorldGen.cs +++ /dev/null @@ -1,15666 +0,0 @@ -namespace Terraria -{ - using Microsoft.Xna.Framework; - using System; - using System.IO; - using System.Runtime.InteropServices; - using System.Threading; - - internal class WorldGen - { - public static int bestX = 0; - public static int bestY = 0; - public static bool canSpawn; - private static int[] DDoorPos = new int[300]; - private static int[] DDoorX = new int[300]; - private static int[] DDoorY = new int[300]; - public static int dEnteranceX = 0; - private static bool destroyObject = false; - private static int dMaxX; - private static int dMaxY; - private static int dMinX; - private static int dMinY; - private static int[] DPlatX = new int[300]; - private static int[] DPlatY = new int[300]; - - public static bool dSurface = false; - public static int dungeonX; - public static int dungeonY; - private static double dxStrength1; - private static double dxStrength2; - private static double dyStrength1; - private static double dyStrength2; - private static int[] fihX = new int[300]; - private static int[] fihY = new int[300]; - public static bool gen = false; - [ThreadStatic] - public static Random genRand = new Random(); - public static int hiScore = 0; - private static int houseCount = 0; - public static bool[] houseTile = new bool[80]; - private static int[] JChestX = new int[100]; - private static int[] JChestY = new int[100]; - public static Vector2 lastDungeonHall = new Vector2(); - private static int lastMaxTilesX = 0; - private static int lastMaxTilesY = 0; - public static int lavaLine; - public static bool loadFailed = false; - public static int maxDRooms = 100; - private static int[] dRoomB = new int[maxDRooms]; - private static int[] dRoomL = new int[maxDRooms]; - private static int[] dRoomR = new int[maxDRooms]; - public static int[] dRoomSize = new int[maxDRooms]; - private static int[] dRoomT = new int[maxDRooms]; - private static bool[] dRoomTreasure = new bool[maxDRooms]; - public static int[] dRoomX = new int[maxDRooms]; - public static int[] dRoomY = new int[maxDRooms]; - public static int maxRoomTiles = 0x76c; - private static int[] mCaveX = new int[300]; - private static int[] mCaveY = new int[300]; - private static bool mergeDown = false; - private static bool mergeLeft = false; - private static bool mergeRight = false; - private static bool mergeUp = false; - public static bool noLiquidCheck = false; - private static int numDDoors; - private static int numDPlats; - public static int numDRooms = 0; - private static int numIslandHouses = 0; - private static int numJChests = 0; - private static int numMCaves = 0; - public static int numRoomTiles; - public static int[] roomX = new int[maxRoomTiles]; - public static int roomX1; - public static int roomX2; - public static int[] roomY = new int[maxRoomTiles]; - public static int roomY1; - public static int roomY2; - public static bool saveLock = false; - public static int shadowOrbCount = 0; - public static bool shadowOrbSmashed = false; - public static int spawnDelay = 0; - public static bool spawnEye = false; - public static bool spawnMeteor = false; - public static int spawnNPC = 0; - public static string statusText = ""; - private static bool stopDrops = false; - private static bool tempBloodMoon = Main.bloodMoon; - private static bool tempDayTime = Main.dayTime; - private static int tempMoonPhase = Main.moonPhase; - private static double tempTime = Main.time; - public static int waterLine; - public static bool worldCleared = false; - - public static bool AddBuriedChest(int i, int j, int contain = 0) - { - if (genRand == null) - { - genRand = new Random((int) DateTime.Now.Ticks); - } - for (int k = j; k < Main.maxTilesY; k++) - { - if (Main.tile[i, k].active && Main.tileSolid[Main.tile[i, k].type]) - { - int num2 = i; - int num3 = k; - int index = PlaceChest(num2 - 1, num3 - 1, 0x15); - if (index < 0) - { - return false; - } - int num5 = 0; - while (num5 == 0) - { - if (contain > 0) - { - Main.chest[index].item[num5].SetDefaults(contain); - num5++; - } - else - { - switch (genRand.Next(7)) - { - case 0: - Main.chest[index].item[num5].SetDefaults(0x31); - break; - - case 1: - Main.chest[index].item[num5].SetDefaults(50); - break; - - case 2: - Main.chest[index].item[num5].SetDefaults(0x34); - break; - - case 3: - Main.chest[index].item[num5].SetDefaults(0x35); - break; - - case 4: - Main.chest[index].item[num5].SetDefaults(0x36); - break; - - case 5: - Main.chest[index].item[num5].SetDefaults(0x37); - break; - - case 6: - Main.chest[index].item[num5].SetDefaults(0x33); - Main.chest[index].item[num5].stack = genRand.Next(0x1a) + 0x19; - break; - } - num5++; - } - if (genRand.Next(3) == 0) - { - Main.chest[index].item[num5].SetDefaults(0xa7); - num5++; - } - if (genRand.Next(2) == 0) - { - int num7 = genRand.Next(4); - int num8 = genRand.Next(8) + 3; - switch (num7) - { - case 0: - Main.chest[index].item[num5].SetDefaults(0x13); - break; - - case 1: - Main.chest[index].item[num5].SetDefaults(20); - break; - - case 2: - Main.chest[index].item[num5].SetDefaults(0x15); - break; - - case 3: - Main.chest[index].item[num5].SetDefaults(0x16); - break; - } - Main.chest[index].item[num5].stack = num8; - num5++; - } - if (genRand.Next(2) == 0) - { - int num9 = genRand.Next(2); - int num10 = genRand.Next(0x1a) + 0x19; - switch (num9) - { - case 0: - Main.chest[index].item[num5].SetDefaults(40); - break; - - case 1: - Main.chest[index].item[num5].SetDefaults(0x2a); - break; - } - Main.chest[index].item[num5].stack = num10; - num5++; - } - if (genRand.Next(2) == 0) - { - int num11 = genRand.Next(1); - int num12 = genRand.Next(3) + 3; - if (num11 == 0) - { - Main.chest[index].item[num5].SetDefaults(0x1c); - } - Main.chest[index].item[num5].stack = num12; - num5++; - } - if (genRand.Next(2) == 0) - { - int num13 = genRand.Next(2); - int num14 = genRand.Next(11) + 10; - switch (num13) - { - case 0: - Main.chest[index].item[num5].SetDefaults(8); - break; - - case 1: - Main.chest[index].item[num5].SetDefaults(0x1f); - break; - } - Main.chest[index].item[num5].stack = num14; - num5++; - } - if (genRand.Next(2) == 0) - { - Main.chest[index].item[num5].SetDefaults(0x49); - Main.chest[index].item[num5].stack = genRand.Next(1, 3); - num5++; - } - } - return true; - } - } - return false; - } - - public static void AddHellHouses() - { - int num = (int) (Main.maxTilesX * 0.25); - for (int i = num; i < (Main.maxTilesX - num); i++) - { - int j = Main.maxTilesY - 40; - while (Main.tile[i, j].active || (Main.tile[i, j].liquid > 0)) - { - j--; - } - if (Main.tile[i, j + 1].active) - { - HellHouse(i, j); - i += genRand.Next(15, 80); - } - } - } - - public static bool AddLifeCrystal(int i, int j) - { - for (int k = j; k < Main.maxTilesY; k++) - { - if (Main.tile[i, k].active && Main.tileSolid[Main.tile[i, k].type]) - { - int endX = i; - int endY = k - 1; - if (Main.tile[endX, endY - 1].lava || Main.tile[endX - 1, endY - 1].lava) - { - return false; - } - if (!EmptyTileCheck(endX - 1, endX, endY - 1, endY, -1)) - { - return false; - } - Main.tile[endX - 1, endY - 1].active = true; - Main.tile[endX - 1, endY - 1].type = 12; - Main.tile[endX - 1, endY - 1].frameX = 0; - Main.tile[endX - 1, endY - 1].frameY = 0; - Main.tile[endX, endY - 1].active = true; - Main.tile[endX, endY - 1].type = 12; - Main.tile[endX, endY - 1].frameX = 0x12; - Main.tile[endX, endY - 1].frameY = 0; - Main.tile[endX - 1, endY].active = true; - Main.tile[endX - 1, endY].type = 12; - Main.tile[endX - 1, endY].frameX = 0; - Main.tile[endX - 1, endY].frameY = 0x12; - Main.tile[endX, endY].active = true; - Main.tile[endX, endY].type = 12; - Main.tile[endX, endY].frameX = 0x12; - Main.tile[endX, endY].frameY = 0x12; - return true; - } - } - return false; - } - - public static void AddPlants() - { - for (int i = 0; i < Main.maxTilesX; i++) - { - for (int j = 1; j < Main.maxTilesY; j++) - { - if ((Main.tile[i, j].type == 2) && Main.tile[i, j].active) - { - if (!Main.tile[i, j - 1].active) - { - PlaceTile(i, j - 1, 3, true, false, -1); - } - } - else if (((Main.tile[i, j].type == 0x17) && Main.tile[i, j].active) && !Main.tile[i, j - 1].active) - { - PlaceTile(i, j - 1, 0x18, true, false, -1); - } - } - } - } - - public static void AddShadowOrb(int x, int y) - { - if (((x >= 10) && (x <= (Main.maxTilesX - 10))) && ((y >= 10) && (y <= (Main.maxTilesY - 10)))) - { - Main.tile[x - 1, y - 1].active = true; - Main.tile[x - 1, y - 1].type = 0x1f; - Main.tile[x - 1, y - 1].frameX = 0; - Main.tile[x - 1, y - 1].frameY = 0; - Main.tile[x, y - 1].active = true; - Main.tile[x, y - 1].type = 0x1f; - Main.tile[x, y - 1].frameX = 0x12; - Main.tile[x, y - 1].frameY = 0; - Main.tile[x - 1, y].active = true; - Main.tile[x - 1, y].type = 0x1f; - Main.tile[x - 1, y].frameX = 0; - Main.tile[x - 1, y].frameY = 0x12; - Main.tile[x, y].active = true; - Main.tile[x, y].type = 0x1f; - Main.tile[x, y].frameX = 0x12; - Main.tile[x, y].frameY = 0x12; - } - } - - public static void AddTrees() - { - for (int i = 1; i < (Main.maxTilesX - 1); i++) - { - for (int j = 20; j < Main.worldSurface; j++) - { - GrowTree(i, j); - } - } - } - - public static void CaveOpenater(int i, int j) - { - Vector2 vector; - Vector2 vector2; - double num5 = genRand.Next(7, 12); - double num6 = num5; - int num7 = 1; - if (genRand.Next(2) == 0) - { - num7 = -1; - } - vector.X = i; - vector.Y = j; - int num8 = 100; - vector2.Y = 0f; - vector2.X = num7; - while (num8 > 0) - { - if (Main.tile[(int) vector.X, (int) vector.Y].wall == 0) - { - num8 = 0; - } - num8--; - int num = (int) (vector.X - (num5 * 0.5)); - int maxTilesX = (int) (vector.X + (num5 * 0.5)); - int num2 = (int) (vector.Y - (num5 * 0.5)); - int maxTilesY = (int) (vector.Y + (num5 * 0.5)); - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num2 < 0) - { - num2 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - num6 = (num5 * genRand.Next(80, 120)) * 0.01; - for (int k = num; k < maxTilesX; k++) - { - for (int m = num2; m < maxTilesY; m++) - { - float num11 = Math.Abs((float) (k - vector.X)); - float num12 = Math.Abs((float) (m - vector.Y)); - if (Math.Sqrt((double) ((num11 * num11) + (num12 * num12))) < (num6 * 0.4)) - { - Main.tile[k, m].active = false; - } - } - } - vector += vector2; - vector2.X += genRand.Next(-10, 11) * 0.05f; - vector2.Y += genRand.Next(-10, 11) * 0.05f; - if (vector2.X > (num7 + 0.5f)) - { - vector2.X = num7 + 0.5f; - } - if (vector2.X < (num7 - 0.5f)) - { - vector2.X = num7 - 0.5f; - } - if (vector2.Y > 0f) - { - vector2.Y = 0f; - } - if (vector2.Y < -0.5) - { - vector2.Y = -0.5f; - } - } - } - - public static void Cavinator(int i, int j, int steps) - { - Vector2 vector; - Vector2 vector2; - double num5 = genRand.Next(7, 15); - double num6 = num5; - int num7 = 1; - if (genRand.Next(2) == 0) - { - num7 = -1; - } - vector.X = i; - vector.Y = j; - int num8 = genRand.Next(20, 40); - vector2.Y = genRand.Next(10, 20) * 0.01f; - vector2.X = num7; - while (num8 > 0) - { - num8--; - int num = (int) (vector.X - (num5 * 0.5)); - int maxTilesX = (int) (vector.X + (num5 * 0.5)); - int num2 = (int) (vector.Y - (num5 * 0.5)); - int maxTilesY = (int) (vector.Y + (num5 * 0.5)); - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num2 < 0) - { - num2 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - num6 = (num5 * genRand.Next(80, 120)) * 0.01; - for (int k = num; k < maxTilesX; k++) - { - for (int m = num2; m < maxTilesY; m++) - { - float num11 = Math.Abs((float) (k - vector.X)); - float num12 = Math.Abs((float) (m - vector.Y)); - if (Math.Sqrt((double) ((num11 * num11) + (num12 * num12))) < (num6 * 0.4)) - { - Main.tile[k, m].active = false; - } - } - } - vector += vector2; - vector2.X += genRand.Next(-10, 11) * 0.05f; - vector2.Y += genRand.Next(-10, 11) * 0.05f; - if (vector2.X > (num7 + 0.5f)) - { - vector2.X = num7 + 0.5f; - } - if (vector2.X < (num7 - 0.5f)) - { - vector2.X = num7 - 0.5f; - } - if (vector2.Y > 2f) - { - vector2.Y = 2f; - } - if (vector2.Y < 0f) - { - vector2.Y = 0f; - } - } - if ((steps > 0) && (((int) vector.Y) < (Main.rockLayer + 50.0))) - { - Cavinator((int) vector.X, (int) vector.Y, steps - 1); - } - } - - public static void ChasmRunner(int i, int j, int steps, bool makeOrb = false) - { - Vector2 vector; - Vector2 vector2; - bool flag = false; - bool flag2 = false; - if (!makeOrb) - { - flag = true; - } - float num5 = steps; - vector.X = i; - vector.Y = j; - vector2.X = genRand.Next(-10, 11) * 0.1f; - vector2.Y = (genRand.Next(11) * 0.2f) + 0.5f; - int num6 = 5; - double num7 = genRand.Next(5) + 7; - while (num7 > 0.0) - { - int num; - int num2; - int num3; - int maxTilesY; - if (num5 > 0f) - { - num7 += genRand.Next(3); - num7 -= genRand.Next(3); - if (num7 < 7.0) - { - num7 = 7.0; - } - if (num7 > 20.0) - { - num7 = 20.0; - } - if ((num5 == 1f) && (num7 < 10.0)) - { - num7 = 10.0; - } - } - else - { - num7 -= genRand.Next(4); - } - if ((vector.Y > Main.rockLayer) && (num5 > 0f)) - { - num5 = 0f; - } - num5--; - if (num5 > num6) - { - num = (int) (vector.X - (num7 * 0.5)); - num3 = (int) (vector.X + (num7 * 0.5)); - num2 = (int) (vector.Y - (num7 * 0.5)); - maxTilesY = (int) (vector.Y + (num7 * 0.5)); - if (num < 0) - { - num = 0; - } - if (num3 > (Main.maxTilesX - 1)) - { - num3 = Main.maxTilesX - 1; - } - if (num2 < 0) - { - num2 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int n = num; n < num3; n++) - { - for (int num9 = num2; num9 < maxTilesY; num9++) - { - if ((Math.Abs((float) (n - vector.X)) + Math.Abs((float) (num9 - vector.Y))) < ((num7 * 0.5) * (1.0 + (genRand.Next(-10, 11) * 0.015)))) - { - Main.tile[n, num9].active = false; - } - } - } - } - if (num5 <= 0f) - { - if (!flag) - { - flag = true; - AddShadowOrb((int) vector.X, (int) vector.Y); - } - else if (!flag2) - { - flag2 = false; - bool flag3 = false; - int num10 = 0; - while (!flag3) - { - int x = genRand.Next(((int) vector.X) - 0x19, ((int) vector.X) + 0x19); - int y = genRand.Next(((int) vector.Y) - 50, (int) vector.Y); - if (x < 5) - { - x = 5; - } - if (x > (Main.maxTilesX - 5)) - { - x = Main.maxTilesX - 5; - } - if (y < 5) - { - y = 5; - } - if (y > (Main.maxTilesY - 5)) - { - y = Main.maxTilesY - 5; - } - if (y > Main.worldSurface) - { - Place3x2(x, y, 0x1a); - if (Main.tile[x, y].type == 0x1a) - { - flag3 = true; - } - else - { - num10++; - if (num10 >= 0x2710) - { - flag3 = true; - } - } - } - else - { - flag3 = true; - } - } - } - } - vector += vector2; - vector2.X += genRand.Next(-10, 11) * 0.01f; - if (vector2.X > 0.3) - { - vector2.X = 0.3f; - } - if (vector2.X < -0.3) - { - vector2.X = -0.3f; - } - num = (int) (vector.X - (num7 * 1.1)); - num3 = (int) (vector.X + (num7 * 1.1)); - num2 = (int) (vector.Y - (num7 * 1.1)); - maxTilesY = (int) (vector.Y + (num7 * 1.1)); - if (num < 1) - { - num = 1; - } - if (num3 > (Main.maxTilesX - 1)) - { - num3 = Main.maxTilesX - 1; - } - if (num2 < 0) - { - num2 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int k = num; k < num3; k++) - { - for (int num14 = num2; num14 < maxTilesY; num14++) - { - if ((Math.Abs((float) (k - vector.X)) + Math.Abs((float) (num14 - vector.Y))) < ((num7 * 1.1) * (1.0 + (genRand.Next(-10, 11) * 0.015)))) - { - if ((Main.tile[k, num14].type != 0x19) && (num14 > (j + genRand.Next(3, 20)))) - { - Main.tile[k, num14].active = true; - } - if (steps <= num6) - { - Main.tile[k, num14].active = true; - } - if (Main.tile[k, num14].type != 0x1f) - { - Main.tile[k, num14].type = 0x19; - } - if (Main.tile[k, num14].wall == 2) - { - Main.tile[k, num14].wall = 0; - } - } - } - } - for (int m = num; m < num3; m++) - { - for (int num16 = num2; num16 < maxTilesY; num16++) - { - if ((Math.Abs((float) (m - vector.X)) + Math.Abs((float) (num16 - vector.Y))) < ((num7 * 1.1) * (1.0 + (genRand.Next(-10, 11) * 0.015)))) - { - if (Main.tile[m, num16].type != 0x1f) - { - Main.tile[m, num16].type = 0x19; - } - if (steps <= num6) - { - Main.tile[m, num16].active = true; - } - if (num16 > (j + genRand.Next(3, 20))) - { - PlaceWall(m, num16, 3, true); - } - } - } - } - } - } - - public static void Check1x2(int x, int j, byte type) - { - if (!destroyObject) - { - int num = j; - bool flag = true; - if (Main.tile[x, num] == null) - { - Main.tile[x, num] = new Tile(); - } - if (Main.tile[x, num + 1] == null) - { - Main.tile[x, num + 1] = new Tile(); - } - if (Main.tile[x, num].frameY == 0x12) - { - num--; - } - if (Main.tile[x, num] == null) - { - Main.tile[x, num] = new Tile(); - } - if (((Main.tile[x, num].frameY == 0) && (Main.tile[x, num + 1].frameY == 0x12)) && ((Main.tile[x, num].type == type) && (Main.tile[x, num + 1].type == type))) - { - flag = false; - } - if (Main.tile[x, num + 2] == null) - { - Main.tile[x, num + 2] = new Tile(); - } - if (!Main.tile[x, num + 2].active || !Main.tileSolid[Main.tile[x, num + 2].type]) - { - flag = true; - } - if ((Main.tile[x, num + 2].type != 2) && (Main.tile[x, num].type == 20)) - { - flag = true; - } - if (flag) - { - destroyObject = true; - if (Main.tile[x, num].type == type) - { - KillTile(x, num, false, false, false); - } - if (Main.tile[x, num + 1].type == type) - { - KillTile(x, num + 1, false, false, false); - } - if (type == 15) - { - Item.NewItem(x * 0x10, num * 0x10, 0x20, 0x20, 0x22, 1, false); - } - destroyObject = false; - } - } - } - - public static void Check1x2Top(int x, int j, byte type) - { - if (!destroyObject) - { - int num = j; - bool flag = true; - if (Main.tile[x, num] == null) - { - Main.tile[x, num] = new Tile(); - } - if (Main.tile[x, num + 1] == null) - { - Main.tile[x, num + 1] = new Tile(); - } - if (Main.tile[x, num].frameY == 0x12) - { - num--; - } - if (Main.tile[x, num] == null) - { - Main.tile[x, num] = new Tile(); - } - if (((Main.tile[x, num].frameY == 0) && (Main.tile[x, num + 1].frameY == 0x12)) && ((Main.tile[x, num].type == type) && (Main.tile[x, num + 1].type == type))) - { - flag = false; - } - if (Main.tile[x, num - 1] == null) - { - Main.tile[x, num - 1] = new Tile(); - } - if ((!Main.tile[x, num - 1].active || !Main.tileSolid[Main.tile[x, num - 1].type]) || Main.tileSolidTop[Main.tile[x, num - 1].type]) - { - flag = true; - } - if (flag) - { - destroyObject = true; - if (Main.tile[x, num].type == type) - { - KillTile(x, num, false, false, false); - } - if (Main.tile[x, num + 1].type == type) - { - KillTile(x, num + 1, false, false, false); - } - if (type == 0x2a) - { - Item.NewItem(x * 0x10, num * 0x10, 0x20, 0x20, 0x88, 1, false); - } - destroyObject = false; - } - } - } - - public static void Check2x1(int i, int y, byte type) - { - if (!destroyObject) - { - int num = i; - bool flag = true; - if (Main.tile[num, y] == null) - { - Main.tile[num, y] = new Tile(); - } - if (Main.tile[num + 1, y] == null) - { - Main.tile[num + 1, y] = new Tile(); - } - if (Main.tile[num, y + 1] == null) - { - Main.tile[num, y + 1] = new Tile(); - } - if (Main.tile[num + 1, y + 1] == null) - { - Main.tile[num + 1, y + 1] = new Tile(); - } - if (Main.tile[num, y].frameX == 0x12) - { - num--; - } - if (Main.tile[num, y] == null) - { - Main.tile[num, y] = new Tile(); - } - if (((Main.tile[num, y].frameX == 0) && (Main.tile[num + 1, y].frameX == 0x12)) && ((Main.tile[num, y].type == type) && (Main.tile[num + 1, y].type == type))) - { - flag = false; - } - if (type == 0x1d) - { - if (!Main.tile[num, y + 1].active || !Main.tileTable[Main.tile[num, y + 1].type]) - { - flag = true; - } - if (!Main.tile[num + 1, y + 1].active || !Main.tileTable[Main.tile[num + 1, y + 1].type]) - { - flag = true; - } - } - else - { - if (!Main.tile[num, y + 1].active || !Main.tileSolid[Main.tile[num, y + 1].type]) - { - flag = true; - } - if (!Main.tile[num + 1, y + 1].active || !Main.tileSolid[Main.tile[num + 1, y + 1].type]) - { - flag = true; - } - } - if (flag) - { - destroyObject = true; - if (Main.tile[num, y].type == type) - { - KillTile(num, y, false, false, false); - } - if (Main.tile[num + 1, y].type == type) - { - KillTile(num + 1, y, false, false, false); - } - if (type == 0x10) - { - Item.NewItem(num * 0x10, y * 0x10, 0x20, 0x20, 0x23, 1, false); - } - if (type == 0x12) - { - Item.NewItem(num * 0x10, y * 0x10, 0x20, 0x20, 0x24, 1, false); - } - if (type == 0x1d) - { - Item.NewItem(num * 0x10, y * 0x10, 0x20, 0x20, 0x57, 1, false); - Main.PlaySound(13, i * 0x10, y * 0x10, 1); - } - destroyObject = false; - } - } - } - - public static void Check3x2(int i, int j, int type) - { - if (!destroyObject) - { - bool flag = false; - int num = i; - int num2 = j; - num += (Main.tile[i, j].frameX / 0x12) * -1; - num2 += (Main.tile[i, j].frameY / 0x12) * -1; - for (int k = num; k < (num + 3); k++) - { - for (int m = num2; m < (num2 + 2); m++) - { - if (Main.tile[k, m] == null) - { - Main.tile[k, m] = new Tile(); - } - if ((!Main.tile[k, m].active || (Main.tile[k, m].type != type)) || ((Main.tile[k, m].frameX != ((k - num) * 0x12)) || (Main.tile[k, m].frameY != ((m - num2) * 0x12)))) - { - flag = true; - } - } - if (Main.tile[k, num2 + 2] == null) - { - Main.tile[k, num2 + 2] = new Tile(); - } - if (!Main.tile[k, num2 + 2].active || !Main.tileSolid[Main.tile[k, num2 + 2].type]) - { - flag = true; - } - } - if (flag) - { - destroyObject = true; - for (int n = num; n < (num + 3); n++) - { - for (int num6 = num2; num6 < (num2 + 3); num6++) - { - if ((Main.tile[n, num6].type == type) && Main.tile[n, num6].active) - { - KillTile(n, num6, false, false, false); - } - } - } - if (type == 14) - { - Item.NewItem(i * 0x10, j * 0x10, 0x20, 0x20, 0x20, 1, false); - } - else if (type == 0x11) - { - Item.NewItem(i * 0x10, j * 0x10, 0x20, 0x20, 0x21, 1, false); - } - else if (type == 0x4d) - { - Item.NewItem(i * 0x10, j * 0x10, 0x20, 0x20, 0xdd, 1, false); - } - destroyObject = false; - for (int num7 = num - 1; num7 < (num + 4); num7++) - { - for (int num8 = num2 - 1; num8 < (num2 + 4); num8++) - { - TileFrame(num7, num8, false, false); - } - } - } - } - } - - public static void Check3x3(int i, int j, int type) - { - if (!destroyObject) - { - bool flag = false; - int num = i; - int num2 = j; - num += (Main.tile[i, j].frameX / 0x12) * -1; - num2 += (Main.tile[i, j].frameY / 0x12) * -1; - for (int k = num; k < (num + 3); k++) - { - for (int m = num2; m < (num2 + 3); m++) - { - if (Main.tile[k, m] == null) - { - Main.tile[k, m] = new Tile(); - } - if ((!Main.tile[k, m].active || (Main.tile[k, m].type != type)) || ((Main.tile[k, m].frameX != ((k - num) * 0x12)) || (Main.tile[k, m].frameY != ((m - num2) * 0x12)))) - { - flag = true; - } - } - } - if (Main.tile[num + 1, num2 - 1] == null) - { - Main.tile[num + 1, num2 - 1] = new Tile(); - } - if ((!Main.tile[num + 1, num2 - 1].active || !Main.tileSolid[Main.tile[num + 1, num2 - 1].type]) || Main.tileSolidTop[Main.tile[num + 1, num2 - 1].type]) - { - flag = true; - } - if (flag) - { - destroyObject = true; - for (int n = num; n < (num + 3); n++) - { - for (int num6 = num2; num6 < (num2 + 3); num6++) - { - if ((Main.tile[n, num6].type == type) && Main.tile[n, num6].active) - { - KillTile(n, num6, false, false, false); - } - } - } - if (type == 0x22) - { - Item.NewItem(i * 0x10, j * 0x10, 0x20, 0x20, 0x6a, 1, false); - } - else if (type == 0x23) - { - Item.NewItem(i * 0x10, j * 0x10, 0x20, 0x20, 0x6b, 1, false); - } - else if (type == 0x24) - { - Item.NewItem(i * 0x10, j * 0x10, 0x20, 0x20, 0x6c, 1, false); - } - destroyObject = false; - for (int num7 = num - 1; num7 < (num + 4); num7++) - { - for (int num8 = num2 - 1; num8 < (num2 + 4); num8++) - { - TileFrame(num7, num8, false, false); - } - } - } - } - } - - public static void Check4x2(int i, int j, int type) - { - if (!destroyObject) - { - bool flag = false; - int num = i; - int num2 = j; - num += (Main.tile[i, j].frameX / 0x12) * -1; - if ((type == 0x4f) && (Main.tile[i, j].frameX >= 0x48)) - { - num += 4; - } - num2 += (Main.tile[i, j].frameY / 0x12) * -1; - for (int k = num; k < (num + 4); k++) - { - for (int m = num2; m < (num2 + 2); m++) - { - int num5 = (k - num) * 0x12; - if ((type == 0x4f) && (Main.tile[i, j].frameX >= 0x48)) - { - num5 = ((k - num) + 4) * 0x12; - } - if (Main.tile[k, m] == null) - { - Main.tile[k, m] = new Tile(); - } - if ((!Main.tile[k, m].active || (Main.tile[k, m].type != type)) || ((Main.tile[k, m].frameX != num5) || (Main.tile[k, m].frameY != ((m - num2) * 0x12)))) - { - flag = true; - } - } - if (Main.tile[k, num2 + 2] == null) - { - Main.tile[k, num2 + 2] = new Tile(); - } - if (!Main.tile[k, num2 + 2].active || !Main.tileSolid[Main.tile[k, num2 + 2].type]) - { - flag = true; - } - } - if (flag) - { - destroyObject = true; - for (int n = num; n < (num + 4); n++) - { - for (int num7 = num2; num7 < (num2 + 3); num7++) - { - if ((Main.tile[n, num7].type == type) && Main.tile[n, num7].active) - { - KillTile(n, num7, false, false, false); - } - } - } - if (type == 0x4f) - { - Item.NewItem(i * 0x10, j * 0x10, 0x20, 0x20, 0xe0, 1, false); - } - destroyObject = false; - for (int num8 = num - 1; num8 < (num + 4); num8++) - { - for (int num9 = num2 - 1; num9 < (num2 + 4); num9++) - { - TileFrame(num8, num9, false, false); - } - } - } - } - } - - public static void CheckChest(int i, int j, int type) - { - if (!destroyObject) - { - bool flag = false; - int num = i; - int num2 = j; - num += (Main.tile[i, j].frameX / 0x12) * -1; - num2 += (Main.tile[i, j].frameY / 0x12) * -1; - for (int k = num; k < (num + 2); k++) - { - for (int m = num2; m < (num2 + 2); m++) - { - if (Main.tile[k, m] == null) - { - Main.tile[k, m] = new Tile(); - } - if ((!Main.tile[k, m].active || (Main.tile[k, m].type != type)) || ((Main.tile[k, m].frameX != ((k - num) * 0x12)) || (Main.tile[k, m].frameY != ((m - num2) * 0x12)))) - { - flag = true; - } - } - if (Main.tile[k, num2 + 2] == null) - { - Main.tile[k, num2 + 2] = new Tile(); - } - if (!Main.tile[k, num2 + 2].active || !Main.tileSolid[Main.tile[k, num2 + 2].type]) - { - flag = true; - } - } - if (flag) - { - destroyObject = true; - for (int n = num; n < (num + 2); n++) - { - for (int num6 = num2; num6 < (num2 + 3); num6++) - { - if ((Main.tile[n, num6].type == type) && Main.tile[n, num6].active) - { - KillTile(n, num6, false, false, false); - } - } - } - Item.NewItem(i * 0x10, j * 0x10, 0x20, 0x20, 0x30, 1, false); - destroyObject = false; - } - } - } - - public static void CheckOnTable1x1(int x, int y, int type) - { - if ((Main.tile[x, y + 1] != null) && (!Main.tile[x, y + 1].active || !Main.tileTable[Main.tile[x, y + 1].type])) - { - if (type == 0x4e) - { - if (!Main.tile[x, y + 1].active || !Main.tileSolid[Main.tile[x, y + 1].type]) - { - KillTile(x, y, false, false, false); - } - } - else - { - KillTile(x, y, false, false, false); - } - } - } - - public static void CheckPot(int i, int j, int type = 0x1c) - { - if (!destroyObject) - { - bool flag = false; - int num = 0; - int num2 = j; - num += Main.tile[i, j].frameX / 0x12; - num2 += (Main.tile[i, j].frameY / 0x12) * -1; - while (num > 1) - { - num -= 2; - } - num *= -1; - num += i; - for (int k = num; k < (num + 2); k++) - { - for (int m = num2; m < (num2 + 2); m++) - { - if (Main.tile[k, m] == null) - { - Main.tile[k, m] = new Tile(); - } - int num5 = Main.tile[k, m].frameX / 0x12; - while (num5 > 1) - { - num5 -= 2; - } - if ((!Main.tile[k, m].active || (Main.tile[k, m].type != type)) || ((num5 != (k - num)) || (Main.tile[k, m].frameY != ((m - num2) * 0x12)))) - { - flag = true; - } - } - if (Main.tile[k, num2 + 2] == null) - { - Main.tile[k, num2 + 2] = new Tile(); - } - if (!Main.tile[k, num2 + 2].active || !Main.tileSolid[Main.tile[k, num2 + 2].type]) - { - flag = true; - } - } - if (flag) - { - destroyObject = true; - Main.PlaySound(13, i * 0x10, j * 0x10, 1); - for (int n = num; n < (num + 2); n++) - { - for (int num7 = num2; num7 < (num2 + 2); num7++) - { - if ((Main.tile[n, num7].type == type) && Main.tile[n, num7].active) - { - KillTile(n, num7, false, false, false); - } - } - } - Gore.NewGore(new Vector2((float) (i * 0x10), (float) (j * 0x10)), new Vector2(), 0x33); - Gore.NewGore(new Vector2((float) (i * 0x10), (float) (j * 0x10)), new Vector2(), 0x34); - Gore.NewGore(new Vector2((float) (i * 0x10), (float) (j * 0x10)), new Vector2(), 0x35); - int num8 = Main.rand.Next(10); - if ((num8 == 0) && (Main.player[Player.FindClosest(new Vector2((float) (i * 0x10), (float) (j * 0x10)), 0x10, 0x10)].statLife < Main.player[Player.FindClosest(new Vector2((float) (i * 0x10), (float) (j * 0x10)), 0x10, 0x10)].statLifeMax)) - { - Item.NewItem(i * 0x10, j * 0x10, 0x10, 0x10, 0x3a, 1, false); - } - else if ((num8 == 1) && (Main.player[Player.FindClosest(new Vector2((float) (i * 0x10), (float) (j * 0x10)), 0x10, 0x10)].statMana < Main.player[Player.FindClosest(new Vector2((float) (i * 0x10), (float) (j * 0x10)), 0x10, 0x10)].statManaMax)) - { - Item.NewItem(i * 0x10, j * 0x10, 0x10, 0x10, 0xb8, 1, false); - } - else if (num8 == 2) - { - int stack = Main.rand.Next(3) + 1; - Item.NewItem(i * 0x10, j * 0x10, 0x10, 0x10, 8, stack, false); - } - else if (num8 == 3) - { - int num10 = Main.rand.Next(8) + 3; - Item.NewItem(i * 0x10, j * 0x10, 0x10, 0x10, 40, num10, false); - } - else if (num8 == 4) - { - Item.NewItem(i * 0x10, j * 0x10, 0x10, 0x10, 0x1c, 1, false); - } - else if (num8 == 5) - { - int num11 = Main.rand.Next(4) + 1; - Item.NewItem(i * 0x10, j * 0x10, 0x10, 0x10, 0xa6, num11, false); - } - else - { - float num12 = 200 + genRand.Next(-100, 0x65); - num12 *= 1f + (Main.rand.Next(-20, 0x15) * 0.01f); - if (Main.rand.Next(5) == 0) - { - num12 *= 1f + (Main.rand.Next(5, 11) * 0.01f); - } - if (Main.rand.Next(10) == 0) - { - num12 *= 1f + (Main.rand.Next(10, 0x15) * 0.01f); - } - if (Main.rand.Next(15) == 0) - { - num12 *= 1f + (Main.rand.Next(20, 0x29) * 0.01f); - } - if (Main.rand.Next(20) == 0) - { - num12 *= 1f + (Main.rand.Next(40, 0x51) * 0.01f); - } - if (Main.rand.Next(0x19) == 0) - { - num12 *= 1f + (Main.rand.Next(50, 0x65) * 0.01f); - } - while (((int) num12) > 0) - { - if (num12 > 1000000f) - { - int num13 = (int) (num12 / 1000000f); - if ((num13 > 50) && (Main.rand.Next(2) == 0)) - { - num13 /= Main.rand.Next(3) + 1; - } - if (Main.rand.Next(2) == 0) - { - num13 /= Main.rand.Next(3) + 1; - } - num12 -= 0xf4240 * num13; - Item.NewItem(i * 0x10, j * 0x10, 0x10, 0x10, 0x4a, num13, false); - } - else - { - if (num12 > 10000f) - { - int num14 = (int) (num12 / 10000f); - if ((num14 > 50) && (Main.rand.Next(2) == 0)) - { - num14 /= Main.rand.Next(3) + 1; - } - if (Main.rand.Next(2) == 0) - { - num14 /= Main.rand.Next(3) + 1; - } - num12 -= 0x2710 * num14; - Item.NewItem(i * 0x10, j * 0x10, 0x10, 0x10, 0x49, num14, false); - continue; - } - if (num12 > 100f) - { - int num15 = (int) (num12 / 100f); - if ((num15 > 50) && (Main.rand.Next(2) == 0)) - { - num15 /= Main.rand.Next(3) + 1; - } - if (Main.rand.Next(2) == 0) - { - num15 /= Main.rand.Next(3) + 1; - } - num12 -= 100 * num15; - Item.NewItem(i * 0x10, j * 0x10, 0x10, 0x10, 0x48, num15, false); - continue; - } - int num16 = (int) num12; - if ((num16 > 50) && (Main.rand.Next(2) == 0)) - { - num16 /= Main.rand.Next(3) + 1; - } - if (Main.rand.Next(2) == 0) - { - num16 /= Main.rand.Next(4) + 1; - } - if (num16 < 1) - { - num16 = 1; - } - num12 -= num16; - Item.NewItem(i * 0x10, j * 0x10, 0x10, 0x10, 0x47, num16, false); - } - } - } - destroyObject = false; - } - } - } - - public static void CheckRoom(int x, int y) - { - if (canSpawn) - { - if (((x < 10) || (y < 10)) || ((x >= (Main.maxTilesX - 10)) || (y >= (lastMaxTilesY - 10)))) - { - canSpawn = false; - } - else - { - for (int i = 0; i < numRoomTiles; i++) - { - if ((roomX[i] == x) && (roomY[i] == y)) - { - return; - } - } - roomX[numRoomTiles] = x; - roomY[numRoomTiles] = y; - numRoomTiles++; - if (numRoomTiles >= maxRoomTiles) - { - canSpawn = false; - } - else - { - if (Main.tile[x, y].active) - { - houseTile[Main.tile[x, y].type] = true; - if (Main.tileSolid[Main.tile[x, y].type] || (Main.tile[x, y].type == 11)) - { - return; - } - } - if (x < roomX1) - { - roomX1 = x; - } - if (x > roomX2) - { - roomX2 = x; - } - if (y < roomY1) - { - roomY1 = y; - } - if (y > roomY2) - { - roomY2 = y; - } - bool flag = false; - bool flag2 = false; - for (int j = -2; j < 3; j++) - { - if (Main.wallHouse[Main.tile[x + j, y].wall]) - { - flag = true; - } - if (Main.tile[x + j, y].active && (Main.tileSolid[Main.tile[x + j, y].type] || (Main.tile[x + j, y].type == 11))) - { - flag = true; - } - if (Main.wallHouse[Main.tile[x, y + j].wall]) - { - flag2 = true; - } - if (Main.tile[x, y + j].active && (Main.tileSolid[Main.tile[x, y + j].type] || (Main.tile[x, y + j].type == 11))) - { - flag2 = true; - } - } - if (!flag || !flag2) - { - canSpawn = false; - } - else - { - for (int k = x - 1; k < (x + 2); k++) - { - for (int m = y - 1; m < (y + 2); m++) - { - if (((k != x) || (m != y)) && canSpawn) - { - CheckRoom(k, m); - } - } - } - } - } - } - } - } - - public static void CheckSign(int x, int y, int type) - { - if (!destroyObject) - { - int num = x - 2; - int num2 = x + 3; - int num3 = y - 2; - int num4 = y + 3; - if ((((num >= 0) && (num2 <= Main.maxTilesX)) && (num3 >= 0)) && (num4 <= Main.maxTilesY)) - { - bool flag = false; - for (int i = num; i < num2; i++) - { - for (int k = num3; k < num4; k++) - { - if (Main.tile[i, k] == null) - { - Main.tile[i, k] = new Tile(); - } - } - } - int num7 = Main.tile[x, y].frameX / 0x12; - int num8 = Main.tile[x, y].frameY / 0x12; - while (num7 > 1) - { - num7 -= 2; - } - int num9 = x - num7; - int num10 = y - num8; - int num11 = (Main.tile[num9, num10].frameX / 0x12) / 2; - num = num9; - num2 = num9 + 2; - num3 = num10; - num4 = num10 + 2; - num7 = 0; - for (int j = num; j < num2; j++) - { - num8 = 0; - for (int m = num3; m < num4; m++) - { - if (!Main.tile[j, m].active || (Main.tile[j, m].type != type)) - { - flag = true; - goto Label_017B; - } - if (((Main.tile[j, m].frameX / 0x12) != (num7 + (num11 * 2))) || ((Main.tile[j, m].frameY / 0x12) != num8)) - { - flag = true; - goto Label_017B; - } - num8++; - } - Label_017B: - num7++; - } - if (!flag) - { - if ((Main.tile[num9, num10 + 2].active && Main.tileSolid[Main.tile[num9, num10 + 2].type]) && (Main.tile[num9 + 1, num10 + 2].active && Main.tileSolid[Main.tile[num9 + 1, num10 + 2].type])) - { - num11 = 0; - } - else if (((Main.tile[num9, num10 - 1].active && Main.tileSolid[Main.tile[num9, num10 - 1].type]) && (!Main.tileSolidTop[Main.tile[num9, num10 - 1].type] && Main.tile[num9 + 1, num10 - 1].active)) && (Main.tileSolid[Main.tile[num9 + 1, num10 - 1].type] && !Main.tileSolidTop[Main.tile[num9 + 1, num10 - 1].type])) - { - num11 = 1; - } - else if (((Main.tile[num9 - 1, num10].active && Main.tileSolid[Main.tile[num9 - 1, num10].type]) && (!Main.tileSolidTop[Main.tile[num9 - 1, num10].type] && Main.tile[num9 - 1, num10 + 1].active)) && (Main.tileSolid[Main.tile[num9 - 1, num10 + 1].type] && !Main.tileSolidTop[Main.tile[num9 - 1, num10 + 1].type])) - { - num11 = 2; - } - else if (((Main.tile[num9 + 2, num10].active && Main.tileSolid[Main.tile[num9 + 2, num10].type]) && (!Main.tileSolidTop[Main.tile[num9 + 2, num10].type] && Main.tile[num9 + 2, num10 + 1].active)) && (Main.tileSolid[Main.tile[num9 + 2, num10 + 1].type] && !Main.tileSolidTop[Main.tile[num9 + 2, num10 + 1].type])) - { - num11 = 3; - } - else - { - flag = true; - } - } - if (flag) - { - destroyObject = true; - for (int n = num; n < num2; n++) - { - for (int num15 = num3; num15 < num4; num15++) - { - if (Main.tile[n, num15].type == type) - { - KillTile(n, num15, false, false, false); - } - } - } - Sign.KillSign(num9, num10); - Item.NewItem(x * 0x10, y * 0x10, 0x20, 0x20, 0xab, 1, false); - destroyObject = false; - } - else - { - int num16 = 0x24 * num11; - for (int num17 = 0; num17 < 2; num17++) - { - for (int num18 = 0; num18 < 2; num18++) - { - Main.tile[num9 + num17, num10 + num18].active = true; - Main.tile[num9 + num17, num10 + num18].type = (byte) type; - Main.tile[num9 + num17, num10 + num18].frameX = (short) (num16 + (0x12 * num17)); - Main.tile[num9 + num17, num10 + num18].frameY = (short) (0x12 * num18); - } - } - } - } - } - } - - public static void CheckSunflower(int i, int j, int type = 0x1b) - { - if (!destroyObject) - { - bool flag = false; - int num = 0; - int num2 = j; - num += Main.tile[i, j].frameX / 0x12; - num2 += (Main.tile[i, j].frameY / 0x12) * -1; - while (num > 1) - { - num -= 2; - } - num *= -1; - num += i; - for (int k = num; k < (num + 2); k++) - { - for (int m = num2; m < (num2 + 4); m++) - { - if (Main.tile[k, m] == null) - { - Main.tile[k, m] = new Tile(); - } - int num5 = Main.tile[k, m].frameX / 0x12; - while (num5 > 1) - { - num5 -= 2; - } - if ((!Main.tile[k, m].active || (Main.tile[k, m].type != type)) || ((num5 != (k - num)) || (Main.tile[k, m].frameY != ((m - num2) * 0x12)))) - { - flag = true; - } - } - if (Main.tile[k, num2 + 4] == null) - { - Main.tile[k, num2 + 4] = new Tile(); - } - if (!Main.tile[k, num2 + 4].active || (Main.tile[k, num2 + 4].type != 2)) - { - flag = true; - } - } - if (flag) - { - destroyObject = true; - for (int n = num; n < (num + 2); n++) - { - for (int num7 = num2; num7 < (num2 + 4); num7++) - { - if ((Main.tile[n, num7].type == type) && Main.tile[n, num7].active) - { - KillTile(n, num7, false, false, false); - } - } - } - Item.NewItem(i * 0x10, j * 0x10, 0x20, 0x20, 0x3f, 1, false); - destroyObject = false; - } - } - } - - public static void clearWorld() - { - spawnEye = false; - spawnNPC = 0; - shadowOrbCount = 0; - Main.helpText = 0; - Main.dungeonX = 0; - Main.dungeonY = 0; - NPC.downedBoss1 = false; - NPC.downedBoss2 = false; - NPC.downedBoss3 = false; - shadowOrbSmashed = false; - spawnMeteor = false; - stopDrops = false; - Main.invasionDelay = 0; - Main.invasionType = 0; - Main.invasionSize = 0; - Main.invasionWarn = 0; - Main.invasionX = 0.0; - noLiquidCheck = false; - Liquid.numLiquid = 0; - LiquidBuffer.numLiquidBuffer = 0; - if (((Main.netMode == 1) || (lastMaxTilesX > Main.maxTilesX)) || (lastMaxTilesY > Main.maxTilesY)) - { - for (int num = 0; num < lastMaxTilesX; num++) - { - float num2 = ((float) num) / ((float) lastMaxTilesX); - Main.statusText = "Freeing unused resources: " + ((int) ((num2 * 100f) + 1f)) + "%"; - for (int num3 = 0; num3 < lastMaxTilesY; num3++) - { - Main.tile[num, num3] = null; - } - } - } - lastMaxTilesX = Main.maxTilesX; - lastMaxTilesY = Main.maxTilesY; - if (Main.netMode != 1) - { - for (int num4 = 0; num4 < Main.maxTilesX; num4++) - { - float num5 = ((float) num4) / ((float) Main.maxTilesX); - Main.statusText = "Resetting game objects: " + ((int) ((num5 * 100f) + 1f)) + "%"; - for (int num6 = 0; num6 < Main.maxTilesY; num6++) - { - Main.tile[num4, num6] = new Tile(); - } - } - } - for (int i = 0; i < 0x7d0; i++) - { - Main.dust[i] = new Dust(); - } - for (int j = 0; j < 200; j++) - { - Main.gore[j] = new Gore(); - } - for (int k = 0; k < 200; k++) - { - Main.item[k] = new Item(); - } - for (int m = 0; m < 0x3e8; m++) - { - Main.npc[m] = new NPC(); - } - for (int n = 0; n < 0x3e8; n++) - { - Main.projectile[n] = new Projectile(); - } - for (int num12 = 0; num12 < 0x3e8; num12++) - { - Main.chest[num12] = null; - } - for (int num13 = 0; num13 < 0x3e8; num13++) - { - Main.sign[num13] = null; - } - for (int num14 = 0; num14 < Liquid.resLiquid; num14++) - { - Main.liquid[num14] = new Liquid(); - } - for (int num15 = 0; num15 < 0x2710; num15++) - { - Main.liquidBuffer[num15] = new LiquidBuffer(); - } - setWorldSize(); - worldCleared = true; - } - - public static bool CloseDoor(int i, int j, bool forced = false) - { - int num = 0; - int num2 = i; - int num3 = j; - if (Main.tile[i, j] == null) - { - Main.tile[i, j] = new Tile(); - } - int frameX = Main.tile[i, j].frameX; - int frameY = Main.tile[i, j].frameY; - switch (frameX) - { - case 0: - num2 = i; - num = 1; - break; - - case 0x12: - num2 = i - 1; - num = 1; - break; - - case 0x24: - num2 = i + 1; - num = -1; - break; - - case 0x36: - num2 = i; - num = -1; - break; - } - switch (frameY) - { - case 0: - num3 = j; - break; - - case 0x12: - num3 = j - 1; - break; - - case 0x24: - num3 = j - 2; - break; - } - int num6 = num2; - if (num == -1) - { - num6 = num2 - 1; - } - if (!forced) - { - for (int n = num3; n < (num3 + 3); n++) - { - if (!Collision.EmptyTile(num2, n, true)) - { - return false; - } - } - } - for (int k = num6; k < (num6 + 2); k++) - { - for (int num9 = num3; num9 < (num3 + 3); num9++) - { - if (k == num2) - { - if (Main.tile[k, num9] == null) - { - Main.tile[k, num9] = new Tile(); - } - Main.tile[k, num9].type = 10; - Main.tile[k, num9].frameX = (short) (genRand.Next(3) * 0x12); - } - else - { - if (Main.tile[k, num9] == null) - { - Main.tile[k, num9] = new Tile(); - } - Main.tile[k, num9].active = false; - } - } - } - for (int m = num2 - 1; m <= (num2 + 1); m++) - { - for (int num11 = num3 - 1; num11 <= (num3 + 2); num11++) - { - TileFrame(m, num11, false, false); - } - } - Main.PlaySound(9, i * 0x10, j * 0x10, 1); - return true; - } - - public static void CreateNewWorld() - { - ThreadPool.QueueUserWorkItem(new WaitCallback(WorldGen.worldGenCallBack), 1); - } - - public static void dropMeteor() - { - bool flag = true; - int num = 0; - if (Main.netMode != 1) - { - for (int i = 0; i < 8; i++) - { - if (Main.player[i].active) - { - flag = false; - break; - } - } - int num3 = 0; - float num4 = Main.maxTilesX / 0x1068; - int num5 = (int) (400f * num4); - for (int j = 5; j < (Main.maxTilesX - 5); j++) - { - for (int k = 5; k < Main.worldSurface; k++) - { - if (Main.tile[j, k].active && (Main.tile[j, k].type == 0x25)) - { - num3++; - if (num3 > num5) - { - return; - } - } - } - } - while (!flag) - { - float num8 = Main.maxTilesX * 0.08f; - int num9 = Main.rand.Next(50, Main.maxTilesX - 50); - while ((num9 > (Main.spawnTileX - num8)) && (num9 < (Main.spawnTileX + num8))) - { - num9 = Main.rand.Next(50, Main.maxTilesX - 50); - } - for (int m = Main.rand.Next(100); m < Main.maxTilesY; m++) - { - if (Main.tile[num9, m].active && Main.tileSolid[Main.tile[num9, m].type]) - { - flag = meteor(num9, m); - break; - } - } - num++; - if (num >= 100) - { - return; - } - } - } - } - - public static void DungeonEnt(int i, int j, int tileType, int wallType) - { - Vector2 vector; - double num5 = dxStrength1; - double num6 = dyStrength1; - vector.X = i; - vector.Y = j - (((float) num6) / 2f); - dMinY = (int) vector.Y; - int num7 = 1; - if (i > (Main.maxTilesX / 2)) - { - num7 = -1; - } - int num = ((int) (vector.X - (num5 * 0.60000002384185791))) - genRand.Next(2, 5); - int maxTilesX = ((int) (vector.X + (num5 * 0.60000002384185791))) + genRand.Next(2, 5); - int num2 = ((int) (vector.Y - (num6 * 0.60000002384185791))) - genRand.Next(2, 5); - int maxTilesY = ((int) (vector.Y + (num6 * 0.60000002384185791))) + genRand.Next(8, 0x10); - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num2 < 0) - { - num2 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int k = num; k < maxTilesX; k++) - { - for (int num9 = num2; num9 < maxTilesY; num9++) - { - Main.tile[k, num9].liquid = 0; - if (Main.tile[k, num9].wall != wallType) - { - Main.tile[k, num9].wall = 0; - if (((k > (num + 1)) && (k < (maxTilesX - 2))) && ((num9 > (num2 + 1)) && (num9 < (maxTilesY - 2)))) - { - PlaceWall(k, num9, wallType, true); - } - Main.tile[k, num9].active = true; - Main.tile[k, num9].type = (byte) tileType; - } - } - } - int num10 = num; - int num11 = (num + 5) + genRand.Next(4); - int num12 = (num2 - 3) - genRand.Next(3); - int num13 = num2; - for (int m = num10; m < num11; m++) - { - for (int num15 = num12; num15 < num13; num15++) - { - if (Main.tile[m, num15].wall != wallType) - { - Main.tile[m, num15].active = true; - Main.tile[m, num15].type = (byte) tileType; - } - } - } - num10 = (maxTilesX - 5) - genRand.Next(4); - num11 = maxTilesX; - num12 = (num2 - 3) - genRand.Next(3); - num13 = num2; - for (int n = num10; n < num11; n++) - { - for (int num17 = num12; num17 < num13; num17++) - { - if (Main.tile[n, num17].wall != wallType) - { - Main.tile[n, num17].active = true; - Main.tile[n, num17].type = (byte) tileType; - } - } - } - int num18 = 1 + genRand.Next(2); - int num19 = 2 + genRand.Next(4); - int num20 = 0; - for (int num21 = num; num21 < maxTilesX; num21++) - { - for (int num22 = num2 - num18; num22 < num2; num22++) - { - if (Main.tile[num21, num22].wall != wallType) - { - Main.tile[num21, num22].active = true; - Main.tile[num21, num22].type = (byte) tileType; - } - } - num20++; - if (num20 >= num19) - { - num21 += num19; - num20 = 0; - } - } - for (int num23 = num; num23 < maxTilesX; num23++) - { - for (int num24 = maxTilesY; num24 < (maxTilesY + 100); num24++) - { - PlaceWall(num23, num24, 2, true); - } - } - num = (int) (vector.X - (num5 * 0.60000002384185791)); - maxTilesX = (int) (vector.X + (num5 * 0.60000002384185791)); - num2 = (int) (vector.Y - (num6 * 0.60000002384185791)); - maxTilesY = (int) (vector.Y + (num6 * 0.60000002384185791)); - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num2 < 0) - { - num2 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int num25 = num; num25 < maxTilesX; num25++) - { - for (int num26 = num2; num26 < maxTilesY; num26++) - { - PlaceWall(num25, num26, wallType, true); - } - } - num = (int) ((vector.X - (num5 * 0.6)) - 1.0); - maxTilesX = (int) ((vector.X + (num5 * 0.6)) + 1.0); - num2 = (int) ((vector.Y - (num6 * 0.6)) - 1.0); - maxTilesY = (int) ((vector.Y + (num6 * 0.6)) + 1.0); - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num2 < 0) - { - num2 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int num27 = num; num27 < maxTilesX; num27++) - { - for (int num28 = num2; num28 < maxTilesY; num28++) - { - Main.tile[num27, num28].wall = (byte) wallType; - } - } - num = (int) (vector.X - (num5 * 0.5)); - maxTilesX = (int) (vector.X + (num5 * 0.5)); - num2 = (int) (vector.Y - (num6 * 0.5)); - maxTilesY = (int) (vector.Y + (num6 * 0.5)); - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num2 < 0) - { - num2 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int num29 = num; num29 < maxTilesX; num29++) - { - for (int num30 = num2; num30 < maxTilesY; num30++) - { - Main.tile[num29, num30].active = false; - Main.tile[num29, num30].wall = (byte) wallType; - } - } - DPlatX[numDPlats] = (int) vector.X; - DPlatY[numDPlats] = maxTilesY; - numDPlats++; - vector.X += (((float) num5) * 0.6f) * num7; - vector.Y += ((float) num6) * 0.5f; - num5 = dxStrength2; - num6 = dyStrength2; - vector.X += (((float) num5) * 0.55f) * num7; - vector.Y -= ((float) num6) * 0.5f; - num = ((int) (vector.X - (num5 * 0.60000002384185791))) - genRand.Next(1, 3); - maxTilesX = ((int) (vector.X + (num5 * 0.60000002384185791))) + genRand.Next(1, 3); - num2 = ((int) (vector.Y - (num6 * 0.60000002384185791))) - genRand.Next(1, 3); - maxTilesY = ((int) (vector.Y + (num6 * 0.60000002384185791))) + genRand.Next(6, 0x10); - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num2 < 0) - { - num2 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int num31 = num; num31 < maxTilesX; num31++) - { - for (int num32 = num2; num32 < maxTilesY; num32++) - { - if (Main.tile[num31, num32].wall != wallType) - { - bool flag = true; - if (num7 < 0) - { - if (num31 < (vector.X - (num5 * 0.5))) - { - flag = false; - } - } - else if (num31 > ((vector.X + (num5 * 0.5)) - 1.0)) - { - flag = false; - } - if (flag) - { - Main.tile[num31, num32].wall = 0; - Main.tile[num31, num32].active = true; - Main.tile[num31, num32].type = (byte) tileType; - } - } - } - } - for (int num33 = num; num33 < maxTilesX; num33++) - { - for (int num34 = maxTilesY; num34 < (maxTilesY + 100); num34++) - { - PlaceWall(num33, num34, 2, true); - } - } - num = (int) (vector.X - (num5 * 0.5)); - maxTilesX = (int) (vector.X + (num5 * 0.5)); - num10 = num; - if (num7 < 0) - { - num10++; - } - num11 = (num10 + 5) + genRand.Next(4); - num12 = (num2 - 3) - genRand.Next(3); - num13 = num2; - for (int num35 = num10; num35 < num11; num35++) - { - for (int num36 = num12; num36 < num13; num36++) - { - if (Main.tile[num35, num36].wall != wallType) - { - Main.tile[num35, num36].active = true; - Main.tile[num35, num36].type = (byte) tileType; - } - } - } - num10 = (maxTilesX - 5) - genRand.Next(4); - num11 = maxTilesX; - num12 = (num2 - 3) - genRand.Next(3); - num13 = num2; - for (int num37 = num10; num37 < num11; num37++) - { - for (int num38 = num12; num38 < num13; num38++) - { - if (Main.tile[num37, num38].wall != wallType) - { - Main.tile[num37, num38].active = true; - Main.tile[num37, num38].type = (byte) tileType; - } - } - } - num18 = 1 + genRand.Next(2); - num19 = 2 + genRand.Next(4); - num20 = 0; - if (num7 < 0) - { - maxTilesX++; - } - for (int num39 = num + 1; num39 < (maxTilesX - 1); num39++) - { - for (int num40 = num2 - num18; num40 < num2; num40++) - { - if (Main.tile[num39, num40].wall != wallType) - { - Main.tile[num39, num40].active = true; - Main.tile[num39, num40].type = (byte) tileType; - } - } - num20++; - if (num20 >= num19) - { - num39 += num19; - num20 = 0; - } - } - num = (int) (vector.X - (num5 * 0.6)); - maxTilesX = (int) (vector.X + (num5 * 0.6)); - num2 = (int) (vector.Y - (num6 * 0.6)); - maxTilesY = (int) (vector.Y + (num6 * 0.6)); - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num2 < 0) - { - num2 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int num41 = num; num41 < maxTilesX; num41++) - { - for (int num42 = num2; num42 < maxTilesY; num42++) - { - Main.tile[num41, num42].wall = 0; - } - } - num = (int) (vector.X - (num5 * 0.5)); - maxTilesX = (int) (vector.X + (num5 * 0.5)); - num2 = (int) (vector.Y - (num6 * 0.5)); - maxTilesY = (int) (vector.Y + (num6 * 0.5)); - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num2 < 0) - { - num2 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int num43 = num; num43 < maxTilesX; num43++) - { - for (int num44 = num2; num44 < maxTilesY; num44++) - { - Main.tile[num43, num44].active = false; - Main.tile[num43, num44].wall = 0; - } - } - for (int num45 = num; num45 < maxTilesX; num45++) - { - if (!Main.tile[num45, maxTilesY].active) - { - Main.tile[num45, maxTilesY].active = true; - Main.tile[num45, maxTilesY].type = 0x13; - } - } - Main.dungeonX = (int) vector.X; - Main.dungeonY = maxTilesY; - int index = NPC.NewNPC((dungeonX * 0x10) + 8, dungeonY * 0x10, 0x25, 0); - Main.npc[index].homeless = false; - Main.npc[index].homeTileX = Main.dungeonX; - Main.npc[index].homeTileY = Main.dungeonY; - if (num7 == 1) - { - int num47 = 0; - for (int num48 = maxTilesX; num48 < (maxTilesX + 0x19); num48++) - { - num47++; - for (int num49 = maxTilesY + num47; num49 < (maxTilesY + 0x19); num49++) - { - Main.tile[num48, num49].active = true; - Main.tile[num48, num49].type = (byte) tileType; - } - } - } - else - { - int num50 = 0; - for (int num51 = num; num51 > (num - 0x19); num51--) - { - num50++; - for (int num52 = maxTilesY + num50; num52 < (maxTilesY + 0x19); num52++) - { - Main.tile[num51, num52].active = true; - Main.tile[num51, num52].type = (byte) tileType; - } - } - } - num18 = 1 + genRand.Next(2); - num19 = 2 + genRand.Next(4); - num20 = 0; - num = (int) (vector.X - (num5 * 0.5)); - maxTilesX = (int) (vector.X + (num5 * 0.5)); - num += 2; - maxTilesX -= 2; - for (int num53 = num; num53 < maxTilesX; num53++) - { - for (int num54 = num2; num54 < maxTilesY; num54++) - { - PlaceWall(num53, num54, wallType, true); - } - num20++; - if (num20 >= num19) - { - num53 += num19 * 2; - num20 = 0; - } - } - vector.X -= (((float) num5) * 0.6f) * num7; - vector.Y += ((float) num6) * 0.5f; - num5 = 15.0; - num6 = 3.0; - vector.Y -= ((float) num6) * 0.5f; - num = (int) (vector.X - (num5 * 0.5)); - maxTilesX = (int) (vector.X + (num5 * 0.5)); - num2 = (int) (vector.Y - (num6 * 0.5)); - maxTilesY = (int) (vector.Y + (num6 * 0.5)); - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num2 < 0) - { - num2 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int num55 = num; num55 < maxTilesX; num55++) - { - for (int num56 = num2; num56 < maxTilesY; num56++) - { - Main.tile[num55, num56].active = false; - } - } - if (num7 < 0) - { - vector.X--; - } - PlaceTile((int) vector.X, ((int) vector.Y) + 1, 10, false, false, -1); - } - - public static void DungeonHalls(int i, int j, int tileType, int wallType, bool forceX = false) - { - Vector2 vector; - Vector2 vector2 = new Vector2(); - double num5 = genRand.Next(4, 6); - Vector2 vector3 = new Vector2(); - Vector2 vector4 = new Vector2(); - int num6 = 1; - vector.X = i; - vector.Y = j; - int num7 = genRand.Next(0x23, 80); - if (forceX) - { - num7 += 20; - lastDungeonHall = new Vector2(); - } - else if (genRand.Next(5) == 0) - { - num5 *= 2.0; - num7 /= 2; - } - bool flag = false; - while (!flag) - { - if (genRand.Next(2) == 0) - { - num6 = -1; - } - else - { - num6 = 1; - } - bool flag2 = false; - if (genRand.Next(2) == 0) - { - flag2 = true; - } - if (forceX) - { - flag2 = true; - } - if (flag2) - { - vector3.Y = 0f; - vector3.X = num6; - vector4.Y = 0f; - vector4.X = -num6; - vector2.Y = 0f; - vector2.X = num6; - if (genRand.Next(3) == 0) - { - if (genRand.Next(2) == 0) - { - vector2.Y = -0.2f; - } - else - { - vector2.Y = 0.2f; - } - } - } - else - { - num5++; - vector2.Y = num6; - vector2.X = 0f; - vector3.X = 0f; - vector3.Y = num6; - vector4.X = 0f; - vector4.Y = -num6; - if (genRand.Next(2) == 0) - { - if (genRand.Next(2) == 0) - { - vector2.X = 0.3f; - } - else - { - vector2.X = -0.3f; - } - } - else - { - num7 /= 2; - } - } - if (lastDungeonHall != vector4) - { - flag = true; - } - } - if (!forceX) - { - if (vector.X > (lastMaxTilesX - 200)) - { - num6 = -1; - vector3.Y = 0f; - vector3.X = num6; - vector2.Y = 0f; - vector2.X = num6; - if (genRand.Next(3) == 0) - { - if (genRand.Next(2) == 0) - { - vector2.Y = -0.2f; - } - else - { - vector2.Y = 0.2f; - } - } - } - else if (vector.X < 200f) - { - num6 = 1; - vector3.Y = 0f; - vector3.X = num6; - vector2.Y = 0f; - vector2.X = num6; - if (genRand.Next(3) == 0) - { - if (genRand.Next(2) == 0) - { - vector2.Y = -0.2f; - } - else - { - vector2.Y = 0.2f; - } - } - } - else if (vector.Y > (lastMaxTilesY + 200)) - { - num6 = -1; - num5++; - vector2.Y = num6; - vector2.X = 0f; - vector3.X = 0f; - vector3.Y = num6; - if (genRand.Next(2) == 0) - { - if (genRand.Next(2) == 0) - { - vector2.X = 0.3f; - } - else - { - vector2.X = -0.3f; - } - } - } - else if (vector.Y < Main.rockLayer) - { - num6 = 1; - num5++; - vector2.Y = num6; - vector2.X = 0f; - vector3.X = 0f; - vector3.Y = num6; - if (genRand.Next(2) == 0) - { - if (genRand.Next(2) == 0) - { - vector2.X = 0.3f; - } - else - { - vector2.X = -0.3f; - } - } - } - else if ((vector.X < (Main.maxTilesX / 2)) && (vector.X > (Main.maxTilesX * 0.25))) - { - num6 = -1; - vector3.Y = 0f; - vector3.X = num6; - vector2.Y = 0f; - vector2.X = num6; - if (genRand.Next(3) == 0) - { - if (genRand.Next(2) == 0) - { - vector2.Y = -0.2f; - } - else - { - vector2.Y = 0.2f; - } - } - } - else if ((vector.X > (Main.maxTilesX / 2)) && (vector.X < (Main.maxTilesX * 0.75))) - { - num6 = 1; - vector3.Y = 0f; - vector3.X = num6; - vector2.Y = 0f; - vector2.X = num6; - if (genRand.Next(3) == 0) - { - if (genRand.Next(2) == 0) - { - vector2.Y = -0.2f; - } - else - { - vector2.Y = 0.2f; - } - } - } - } - if (vector3.Y == 0f) - { - DDoorX[numDDoors] = (int) vector.X; - DDoorY[numDDoors] = (int) vector.Y; - DDoorPos[numDDoors] = 0; - numDDoors++; - } - else - { - DPlatX[numDPlats] = (int) vector.X; - DPlatY[numDPlats] = (int) vector.Y; - numDPlats++; - } - lastDungeonHall = vector3; - while (num7 > 0) - { - if ((vector3.X > 0f) && (vector.X > (Main.maxTilesX - 100))) - { - num7 = 0; - } - else if ((vector3.X < 0f) && (vector.X < 100f)) - { - num7 = 0; - } - else if ((vector3.Y > 0f) && (vector.Y > (Main.maxTilesY - 100))) - { - num7 = 0; - } - else if ((vector3.Y < 0f) && (vector.Y < (Main.rockLayer + 50.0))) - { - num7 = 0; - } - num7--; - int num = ((int) ((vector.X - num5) - 4.0)) - genRand.Next(6); - int maxTilesX = ((int) ((vector.X + num5) + 4.0)) + genRand.Next(6); - int num2 = ((int) ((vector.Y - num5) - 4.0)) - genRand.Next(6); - int maxTilesY = ((int) ((vector.Y + num5) + 4.0)) + genRand.Next(6); - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num2 < 0) - { - num2 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int k = num; k < maxTilesX; k++) - { - for (int num9 = num2; num9 < maxTilesY; num9++) - { - Main.tile[k, num9].liquid = 0; - if (Main.tile[k, num9].wall == 0) - { - Main.tile[k, num9].active = true; - Main.tile[k, num9].type = (byte) tileType; - } - } - } - for (int m = num + 1; m < (maxTilesX - 1); m++) - { - for (int num11 = num2 + 1; num11 < (maxTilesY - 1); num11++) - { - PlaceWall(m, num11, wallType, true); - } - } - int num12 = 0; - if ((vector2.Y == 0f) && (genRand.Next(((int) num5) + 1) == 0)) - { - num12 = genRand.Next(1, 3); - } - else if ((vector2.X == 0f) && (genRand.Next(((int) num5) - 1) == 0)) - { - num12 = genRand.Next(1, 3); - } - else if (genRand.Next(((int) num5) * 3) == 0) - { - num12 = genRand.Next(1, 3); - } - num = ((int) (vector.X - (num5 * 0.5))) - num12; - maxTilesX = ((int) (vector.X + (num5 * 0.5))) + num12; - num2 = ((int) (vector.Y - (num5 * 0.5))) - num12; - maxTilesY = ((int) (vector.Y + (num5 * 0.5))) + num12; - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num2 < 0) - { - num2 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int n = num; n < maxTilesX; n++) - { - for (int num14 = num2; num14 < maxTilesY; num14++) - { - Main.tile[n, num14].active = false; - Main.tile[n, num14].wall = (byte) wallType; - } - } - vector += vector2; - } - dungeonX = (int) vector.X; - dungeonY = (int) vector.Y; - if (vector3.Y == 0f) - { - DDoorX[numDDoors] = (int) vector.X; - DDoorY[numDDoors] = (int) vector.Y; - DDoorPos[numDDoors] = 0; - numDDoors++; - } - else - { - DPlatX[numDPlats] = (int) vector.X; - DPlatY[numDPlats] = (int) vector.Y; - numDPlats++; - } - } - - public static void DungeonRoom(int i, int j, int tileType, int wallType) - { - Vector2 vector; - Vector2 vector2; - double num5 = genRand.Next(15, 30); - vector2.X = genRand.Next(-10, 11) * 0.1f; - vector2.Y = genRand.Next(-10, 11) * 0.1f; - vector.X = i; - vector.Y = j - (((float) num5) / 2f); - int num6 = genRand.Next(10, 20); - double x = vector.X; - double num8 = vector.X; - double y = vector.Y; - double num10 = vector.Y; - while (num6 > 0) - { - num6--; - int num = (int) ((vector.X - (num5 * 0.800000011920929)) - 5.0); - int maxTilesX = (int) ((vector.X + (num5 * 0.800000011920929)) + 5.0); - int num2 = (int) ((vector.Y - (num5 * 0.800000011920929)) - 5.0); - int maxTilesY = (int) ((vector.Y + (num5 * 0.800000011920929)) + 5.0); - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num2 < 0) - { - num2 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int k = num; k < maxTilesX; k++) - { - for (int num12 = num2; num12 < maxTilesY; num12++) - { - Main.tile[k, num12].liquid = 0; - if (Main.tile[k, num12].wall == 0) - { - Main.tile[k, num12].active = true; - Main.tile[k, num12].type = (byte) tileType; - } - } - } - for (int m = num + 1; m < (maxTilesX - 1); m++) - { - for (int num14 = num2 + 1; num14 < (maxTilesY - 1); num14++) - { - PlaceWall(m, num14, wallType, true); - } - } - num = (int) (vector.X - (num5 * 0.5)); - maxTilesX = (int) (vector.X + (num5 * 0.5)); - num2 = (int) (vector.Y - (num5 * 0.5)); - maxTilesY = (int) (vector.Y + (num5 * 0.5)); - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num2 < 0) - { - num2 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - if (num < x) - { - x = num; - } - if (maxTilesX > num8) - { - num8 = maxTilesX; - } - if (num2 < y) - { - y = num2; - } - if (maxTilesY > num10) - { - num10 = maxTilesY; - } - for (int n = num; n < maxTilesX; n++) - { - for (int num16 = num2; num16 < maxTilesY; num16++) - { - Main.tile[n, num16].active = false; - Main.tile[n, num16].wall = (byte) wallType; - } - } - vector += vector2; - vector2.X += genRand.Next(-10, 11) * 0.05f; - vector2.Y += genRand.Next(-10, 11) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if (vector2.Y > 1f) - { - vector2.Y = 1f; - } - if (vector2.Y < -1f) - { - vector2.Y = -1f; - } - } - dRoomX[numDRooms] = (int) vector.X; - dRoomY[numDRooms] = (int) vector.Y; - dRoomSize[numDRooms] = (int) num5; - dRoomL[numDRooms] = (int) x; - dRoomR[numDRooms] = (int) num8; - dRoomT[numDRooms] = (int) y; - dRoomB[numDRooms] = (int) num10; - dRoomTreasure[numDRooms] = false; - numDRooms++; - } - - public static void DungeonStairs(int i, int j, int tileType, int wallType) - { - Vector2 vector; - Vector2 vector2 = new Vector2(); - double num5 = genRand.Next(5, 9); - int num6 = 1; - vector.X = i; - vector.Y = j; - int num7 = genRand.Next(10, 30); - if (i > dEnteranceX) - { - num6 = -1; - } - else - { - num6 = 1; - } - vector2.Y = -1f; - vector2.X = num6; - if (genRand.Next(3) == 0) - { - vector2.X *= 0.5f; - } - else if (genRand.Next(3) == 0) - { - vector2.Y *= 2f; - } - while (num7 > 0) - { - num7--; - int num = ((int) ((vector.X - num5) - 4.0)) - genRand.Next(6); - int maxTilesX = ((int) ((vector.X + num5) + 4.0)) + genRand.Next(6); - int num2 = (int) ((vector.Y - num5) - 4.0); - int maxTilesY = ((int) ((vector.Y + num5) + 4.0)) + genRand.Next(6); - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num2 < 0) - { - num2 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - int num8 = 1; - if (vector.X > (Main.maxTilesX / 2)) - { - num8 = -1; - } - int num9 = (int) ((vector.X + ((((float) dxStrength1) * 0.6f) * num8)) + (((float) dxStrength2) * num8)); - int num10 = (int) (dyStrength2 * 0.5); - if (((vector.Y < (Main.worldSurface - 5.0)) && (Main.tile[num9, ((int) ((vector.Y - num5) - 6.0)) + num10].wall == 0)) && ((Main.tile[num9, ((int) ((vector.Y - num5) - 7.0)) + num10].wall == 0) && (Main.tile[num9, ((int) ((vector.Y - num5) - 8.0)) + num10].wall == 0))) - { - dSurface = true; - TileRunner(num9, ((int) ((vector.Y - num5) - 6.0)) + num10, (double) genRand.Next(0x19, 0x23), genRand.Next(10, 20), -1, false, 0f, -1f, false, true); - } - for (int k = num; k < maxTilesX; k++) - { - for (int num12 = num2; num12 < maxTilesY; num12++) - { - Main.tile[k, num12].liquid = 0; - if (Main.tile[k, num12].wall != wallType) - { - Main.tile[k, num12].wall = 0; - Main.tile[k, num12].active = true; - Main.tile[k, num12].type = (byte) tileType; - } - } - } - for (int m = num + 1; m < (maxTilesX - 1); m++) - { - for (int num14 = num2 + 1; num14 < (maxTilesY - 1); num14++) - { - PlaceWall(m, num14, wallType, true); - } - } - int num15 = 0; - if (genRand.Next((int) num5) == 0) - { - num15 = genRand.Next(1, 3); - } - num = ((int) (vector.X - (num5 * 0.5))) - num15; - maxTilesX = ((int) (vector.X + (num5 * 0.5))) + num15; - num2 = ((int) (vector.Y - (num5 * 0.5))) - num15; - maxTilesY = ((int) (vector.Y + (num5 * 0.5))) + num15; - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num2 < 0) - { - num2 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int n = num; n < maxTilesX; n++) - { - for (int num17 = num2; num17 < maxTilesY; num17++) - { - Main.tile[n, num17].active = false; - PlaceWall(n, num17, wallType, true); - } - } - if (dSurface) - { - num7 = 0; - } - vector += vector2; - } - dungeonX = (int) vector.X; - dungeonY = (int) vector.Y; - } - - public static bool EmptyTileCheck(int startX, int endX, int startY, int endY, int ignoreStyle = -1) - { - if (startX < 0) - { - return false; - } - if (endX >= Main.maxTilesX) - { - return false; - } - if (startY < 0) - { - return false; - } - if (endY >= Main.maxTilesY) - { - return false; - } - for (int i = startX; i < (endX + 1); i++) - { - for (int j = startY; j < (endY + 1); j++) - { - if (Main.tile[i, j].active) - { - if (ignoreStyle == -1) - { - return false; - } - if ((ignoreStyle == 11) && (Main.tile[i, j].type != 11)) - { - return false; - } - if (((ignoreStyle == 20) && (Main.tile[i, j].type != 20)) && (Main.tile[i, j].type != 3)) - { - return false; - } - if ((ignoreStyle == 0x47) && (Main.tile[i, j].type != 0x47)) - { - return false; - } - } - } - } - return true; - } - - public static void EveryTileFrame() - { - noLiquidCheck = true; - for (int i = 0; i < Main.maxTilesX; i++) - { - float num2 = ((float) i) / ((float) Main.maxTilesX); - Main.statusText = "Finding tile frames: " + ((int) ((num2 * 100f) + 1f)) + "%"; - for (int j = 0; j < Main.maxTilesY; j++) - { - TileFrame(i, j, true, false); - WallFrame(i, j, true); - } - } - noLiquidCheck = false; - } - - public static void FloatingIsland(int i, int j) - { - Vector2 vector; - Vector2 vector2; - double num5 = genRand.Next(80, 120); - double num6 = num5; - float num7 = genRand.Next(20, 0x19); - vector.X = i; - vector.Y = j; - vector2.X = genRand.Next(-20, 0x15) * 0.2f; - while ((vector2.X > -2f) && (vector2.X < 2f)) - { - vector2.X = genRand.Next(-20, 0x15) * 0.2f; - } - vector2.Y = genRand.Next(-20, -10) * 0.02f; - while ((num5 > 0.0) && (num7 > 0f)) - { - num5 -= genRand.Next(4); - num7--; - int num = (int) (vector.X - (num5 * 0.5)); - int maxTilesX = (int) (vector.X + (num5 * 0.5)); - int num2 = (int) (vector.Y - (num5 * 0.5)); - int maxTilesY = (int) (vector.Y + (num5 * 0.5)); - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num2 < 0) - { - num2 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - num6 = (num5 * genRand.Next(80, 120)) * 0.01; - float y = vector.Y + 1f; - for (int k = num; k < maxTilesX; k++) - { - if (genRand.Next(2) == 0) - { - y += genRand.Next(-1, 2); - } - if (y < vector.Y) - { - y = vector.Y; - } - if (y > (vector.Y + 2f)) - { - y = vector.Y + 2f; - } - for (int n = num2; n < maxTilesY; n++) - { - if (n > y) - { - float num11 = Math.Abs((float) (k - vector.X)); - float num12 = Math.Abs((float) (n - vector.Y)) * 2f; - if (Math.Sqrt((double) ((num11 * num11) + (num12 * num12))) < (num6 * 0.4)) - { - Main.tile[k, n].active = true; - } - } - } - } - TileRunner(genRand.Next(num + 10, maxTilesX - 10), (int) ((vector.Y + (num6 * 0.1)) + 5.0), (double) genRand.Next(5, 10), genRand.Next(10, 15), 0, true, 0f, 2f, true, true); - num = (int) (vector.X - (num5 * 0.4)); - maxTilesX = (int) (vector.X + (num5 * 0.4)); - num2 = (int) (vector.Y - (num5 * 0.4)); - maxTilesY = (int) (vector.Y + (num5 * 0.4)); - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num2 < 0) - { - num2 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - num6 = (num5 * genRand.Next(80, 120)) * 0.01; - for (int m = num; m < maxTilesX; m++) - { - for (int num15 = num2; num15 < maxTilesY; num15++) - { - if (num15 > (vector.Y + 2f)) - { - float num16 = Math.Abs((float) (m - vector.X)); - float num17 = Math.Abs((float) (num15 - vector.Y)) * 2f; - if (Math.Sqrt((double) ((num16 * num16) + (num17 * num17))) < (num6 * 0.4)) - { - Main.tile[m, num15].wall = 2; - } - } - } - } - vector += vector2; - vector2.Y += genRand.Next(-10, 11) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if (vector2.Y > 0.2) - { - vector2.Y = -0.2f; - } - if (vector2.Y < -0.2) - { - vector2.Y = -0.2f; - } - } - } - - public static void generateWorld(int seed = -1) - { - gen = true; - if (seed > 0) - { - genRand = new Random(seed); - } - else - { - genRand = new Random((int) DateTime.Now.Ticks); - } - Main.worldID = genRand.Next(0x7fffffff); - int num7 = 0; - int num8 = 0; - double num = Main.maxTilesY * 0.3; - num *= genRand.Next(90, 110) * 0.005; - double num4 = num + (Main.maxTilesY * 0.2); - num4 *= genRand.Next(90, 110) * 0.01; - double num2 = num; - double num3 = num; - double num5 = num4; - double num6 = num4; - int num9 = 0; - if (genRand.Next(2) == 0) - { - num9 = -1; - } - else - { - num9 = 1; - } - for (int i = 0; i < Main.maxTilesX; i++) - { - float num11 = ((float) i) / ((float) Main.maxTilesX); - Main.statusText = "Generating world terrain: " + ((int) ((num11 * 100f) + 1f)) + "%"; - if (num < num2) - { - num2 = num; - } - if (num > num3) - { - num3 = num; - } - if (num4 < num5) - { - num5 = num4; - } - if (num4 > num6) - { - num6 = num4; - } - if (num8 <= 0) - { - num7 = genRand.Next(0, 5); - num8 = genRand.Next(5, 40); - if (num7 == 0) - { - num8 *= (int) (genRand.Next(5, 30) * 0.2); - } - } - num8--; - switch (num7) - { - case 0: - while (genRand.Next(0, 7) == 0) - { - num += genRand.Next(-1, 2); - } - break; - - case 1: - while (genRand.Next(0, 4) == 0) - { - num--; - } - while (genRand.Next(0, 10) == 0) - { - num++; - } - break; - - case 2: - while (genRand.Next(0, 4) == 0) - { - num++; - } - while (genRand.Next(0, 10) == 0) - { - num--; - } - break; - - case 3: - while (genRand.Next(0, 2) == 0) - { - num--; - } - while (genRand.Next(0, 6) == 0) - { - num++; - } - break; - - case 4: - while (genRand.Next(0, 2) == 0) - { - num++; - } - while (genRand.Next(0, 5) == 0) - { - num--; - } - break; - } - if (num < (Main.maxTilesY * 0.15)) - { - num = Main.maxTilesY * 0.15; - num8 = 0; - } - else if (num > (Main.maxTilesY * 0.3)) - { - num = Main.maxTilesY * 0.3; - num8 = 0; - } - while (genRand.Next(0, 3) == 0) - { - num4 += genRand.Next(-2, 3); - } - if (num4 < (num + (Main.maxTilesY * 0.05))) - { - num4++; - } - if (num4 > (num + (Main.maxTilesY * 0.35))) - { - num4--; - } - for (int num12 = 0; num12 < num; num12++) - { - Main.tile[i, num12].active = false; - Main.tile[i, num12].lighted = true; - Main.tile[i, num12].frameX = -1; - Main.tile[i, num12].frameY = -1; - } - for (int num13 = (int) num; num13 < Main.maxTilesY; num13++) - { - if (num13 < num4) - { - Main.tile[i, num13].active = true; - Main.tile[i, num13].type = 0; - Main.tile[i, num13].frameX = -1; - Main.tile[i, num13].frameY = -1; - } - else - { - Main.tile[i, num13].active = true; - Main.tile[i, num13].type = 1; - Main.tile[i, num13].frameX = -1; - Main.tile[i, num13].frameY = -1; - } - } - } - Main.worldSurface = num3 + 5.0; - Main.rockLayer = num6; - double num14 = ((int) ((Main.rockLayer - Main.worldSurface) / 6.0)) * 6; - Main.rockLayer = Main.worldSurface + num14; - waterLine = (((int) Main.rockLayer) + Main.maxTilesY) / 2; - waterLine += genRand.Next(-100, 20); - lavaLine = waterLine + genRand.Next(50, 80); - int num15 = 0; - Main.statusText = "Adding sand..."; - int num16 = genRand.Next((int) (Main.maxTilesX * 0.0007), (int) (Main.maxTilesX * 0.002)) + 2; - for (int j = 0; j < num16; j++) - { - int num18 = genRand.Next(Main.maxTilesX); - while ((num18 > (Main.maxTilesX * 0.45f)) && (num18 < (Main.maxTilesX * 0.55f))) - { - num18 = genRand.Next(Main.maxTilesX); - } - int num19 = genRand.Next(15, 90); - if (genRand.Next(3) == 0) - { - num19 *= 2; - } - int num20 = num18 - num19; - num19 = genRand.Next(15, 90); - if (genRand.Next(3) == 0) - { - num19 *= 2; - } - int maxTilesX = num18 + num19; - if (num20 < 0) - { - num20 = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - switch (j) - { - case 0: - num20 = 0; - maxTilesX = genRand.Next(250, 300); - break; - - case 2: - num20 = Main.maxTilesX - genRand.Next(250, 300); - maxTilesX = Main.maxTilesX; - break; - } - int num22 = genRand.Next(50, 100); - for (int num23 = num20; num23 < maxTilesX; num23++) - { - if (genRand.Next(2) == 0) - { - num22 += genRand.Next(-1, 2); - if (num22 < 50) - { - num22 = 50; - } - if (num22 > 100) - { - num22 = 100; - } - } - for (int num24 = 0; num24 < Main.worldSurface; num24++) - { - if (Main.tile[num23, num24].active) - { - int num25 = num22; - if ((num23 - num20) < num25) - { - num25 = num23 - num20; - } - if ((maxTilesX - num23) < num25) - { - num25 = maxTilesX - num23; - } - num25 += genRand.Next(5); - for (int num26 = num24; num26 < (num24 + num25); num26++) - { - if ((num23 > (num20 + genRand.Next(5))) && (num23 < (maxTilesX - genRand.Next(5)))) - { - Main.tile[num23, num26].type = 0x35; - } - } - break; - } - } - } - } - for (int k = 0; k < ((int) ((Main.maxTilesX * Main.maxTilesY) * 8E-06)); k++) - { - TileRunner(genRand.Next(0, Main.maxTilesX), genRand.Next((int) Main.worldSurface, (int) Main.rockLayer), (double) genRand.Next(15, 70), genRand.Next(20, 130), 0x35, false, 0f, 0f, false, true); - } - numMCaves = 0; - Main.statusText = "Generating hills..."; - for (int m = 0; m < ((int) (Main.maxTilesX * 0.0008)); m++) - { - int num29 = 0; - bool flag = false; - bool flag2 = false; - int num30 = genRand.Next((int) (Main.maxTilesX * 0.25), (int) (Main.maxTilesX * 0.75)); - while (!flag2) - { - flag2 = true; - while ((num30 > ((Main.maxTilesX / 2) - 100)) && (num30 < ((Main.maxTilesX / 2) + 100))) - { - num30 = genRand.Next((int) (Main.maxTilesX * 0.25), (int) (Main.maxTilesX * 0.75)); - } - for (int num31 = 0; num31 < numMCaves; num31++) - { - if ((num30 > (mCaveX[num31] - 50)) && (num30 < (mCaveX[num31] + 50))) - { - num29++; - flag2 = false; - break; - } - } - if (num29 >= 200) - { - flag = true; - break; - } - } - if (!flag) - { - for (int num32 = 0; num32 < Main.worldSurface; num32++) - { - if (Main.tile[num30, num32].active) - { - Mountinater(num30, num32); - mCaveX[numMCaves] = num30; - mCaveY[numMCaves] = num32; - numMCaves++; - break; - } - } - } - } - for (int n = 1; n < (Main.maxTilesX - 1); n++) - { - float num34 = ((float) n) / ((float) Main.maxTilesX); - Main.statusText = "Puttin dirt behind dirt: " + ((int) ((num34 * 100f) + 1f)) + "%"; - bool flag3 = false; - num15 += genRand.Next(-1, 2); - if (num15 < 0) - { - num15 = 0; - } - if (num15 > 10) - { - num15 = 10; - } - for (int num35 = 0; num35 < (Main.worldSurface + 10.0); num35++) - { - if (num35 > (Main.worldSurface + num15)) - { - break; - } - if (flag3) - { - Main.tile[n, num35].wall = 2; - } - if (((Main.tile[n, num35].active && Main.tile[n - 1, num35].active) && (Main.tile[n + 1, num35].active && Main.tile[n, num35 + 1].active)) && (Main.tile[n - 1, num35 + 1].active && Main.tile[n + 1, num35 + 1].active)) - { - flag3 = true; - } - } - } - numIslandHouses = 0; - houseCount = 0; - Main.statusText = "Generating floating islands..."; - for (int num36 = 0; num36 < ((int) (Main.maxTilesX * 0.0008)); num36++) - { - int num37 = 0; - bool flag4 = false; - int num38 = genRand.Next((int) (Main.maxTilesX * 0.1), (int) (Main.maxTilesX * 0.9)); - bool flag5 = false; - while (!flag5) - { - flag5 = true; - while ((num38 > ((Main.maxTilesX / 2) - 80)) && (num38 < ((Main.maxTilesX / 2) + 80))) - { - num38 = genRand.Next((int) (Main.maxTilesX * 0.1), (int) (Main.maxTilesX * 0.9)); - } - for (int num39 = 0; num39 < numIslandHouses; num39++) - { - if ((num38 > (fihX[num39] - 80)) && (num38 < (fihX[num39] + 80))) - { - num37++; - flag5 = false; - break; - } - } - if (num37 >= 200) - { - flag4 = true; - break; - } - } - if (!flag4) - { - for (int num40 = 200; num40 < Main.worldSurface; num40++) - { - if (Main.tile[num38, num40].active) - { - int num41 = num38; - int num42 = genRand.Next(100, num40 - 100); - while (num42 > (num2 - 50.0)) - { - num42--; - } - FloatingIsland(num41, num42); - fihX[numIslandHouses] = num41; - fihY[numIslandHouses] = num42; - numIslandHouses++; - break; - } - } - } - } - Main.statusText = "Placing rocks in the dirt..."; - for (int num43 = 0; num43 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 0.0002)); num43++) - { - TileRunner(genRand.Next(0, Main.maxTilesX), genRand.Next(0, ((int) num2) + 1), (double) genRand.Next(4, 15), genRand.Next(5, 40), 1, false, 0f, 0f, false, true); - } - for (int num44 = 0; num44 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 0.0002)); num44++) - { - TileRunner(genRand.Next(0, Main.maxTilesX), genRand.Next((int) num2, ((int) num3) + 1), (double) genRand.Next(4, 10), genRand.Next(5, 30), 1, false, 0f, 0f, false, true); - } - for (int num45 = 0; num45 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 0.0045)); num45++) - { - TileRunner(genRand.Next(0, Main.maxTilesX), genRand.Next((int) num3, ((int) num6) + 1), (double) genRand.Next(2, 7), genRand.Next(2, 0x17), 1, false, 0f, 0f, false, true); - } - Main.statusText = "Placing dirt in the rocks..."; - for (int num46 = 0; num46 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 0.005)); num46++) - { - TileRunner(genRand.Next(0, Main.maxTilesX), genRand.Next((int) num5, Main.maxTilesY), (double) genRand.Next(2, 6), genRand.Next(2, 40), 0, false, 0f, 0f, false, true); - } - Main.statusText = "Adding clay..."; - for (int num47 = 0; num47 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 2E-05)); num47++) - { - TileRunner(genRand.Next(0, Main.maxTilesX), genRand.Next(0, (int) num2), (double) genRand.Next(4, 14), genRand.Next(10, 50), 40, false, 0f, 0f, false, true); - } - for (int num48 = 0; num48 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 5E-05)); num48++) - { - TileRunner(genRand.Next(0, Main.maxTilesX), genRand.Next((int) num2, ((int) num3) + 1), (double) genRand.Next(8, 14), genRand.Next(15, 0x2d), 40, false, 0f, 0f, false, true); - } - for (int num49 = 0; num49 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 2E-05)); num49++) - { - TileRunner(genRand.Next(0, Main.maxTilesX), genRand.Next((int) num3, ((int) num6) + 1), (double) genRand.Next(8, 15), genRand.Next(5, 50), 40, false, 0f, 0f, false, true); - } - for (int num50 = 5; num50 < (Main.maxTilesX - 5); num50++) - { - for (int num51 = 1; num51 < (Main.worldSurface - 1.0); num51++) - { - if (Main.tile[num50, num51].active) - { - for (int num52 = num51; num52 < (num51 + 5); num52++) - { - if (Main.tile[num50, num52].type == 40) - { - Main.tile[num50, num52].type = 0; - } - } - break; - } - } - } - for (int num53 = 0; num53 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 0.0015)); num53++) - { - float num54 = (float) (((double) num53) / ((Main.maxTilesX * Main.maxTilesY) * 0.0015)); - Main.statusText = "Making random holes: " + ((int) ((num54 * 100f) + 1f)) + "%"; - int type = -1; - if (genRand.Next(5) == 0) - { - type = -2; - } - TileRunner(genRand.Next(0, Main.maxTilesX), genRand.Next((int) num3, Main.maxTilesY), (double) genRand.Next(2, 5), genRand.Next(2, 20), type, false, 0f, 0f, false, true); - TileRunner(genRand.Next(0, Main.maxTilesX), genRand.Next((int) num3, Main.maxTilesY), (double) genRand.Next(8, 15), genRand.Next(7, 30), type, false, 0f, 0f, false, true); - } - for (int num56 = 0; num56 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 3E-05)); num56++) - { - float num57 = (float) (((double) num56) / ((Main.maxTilesX * Main.maxTilesY) * 3E-05)); - Main.statusText = "Generating small caves: " + ((int) ((num57 * 100f) + 1f)) + "%"; - if (num6 <= Main.maxTilesY) - { - int num58 = -1; - if (genRand.Next(6) == 0) - { - num58 = -2; - } - TileRunner(genRand.Next(0, Main.maxTilesX), genRand.Next((int) num2, ((int) num6) + 1), (double) genRand.Next(5, 15), genRand.Next(30, 200), num58, false, 0f, 0f, false, true); - } - } - for (int num59 = 0; num59 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 0.00015)); num59++) - { - float num60 = (float) (((double) num59) / ((Main.maxTilesX * Main.maxTilesY) * 0.00015)); - Main.statusText = "Generating large caves: " + ((int) ((num60 * 100f) + 1f)) + "%"; - if (num6 <= Main.maxTilesY) - { - int num61 = -1; - if (genRand.Next(10) == 0) - { - num61 = -2; - } - TileRunner(genRand.Next(0, Main.maxTilesX), genRand.Next((int) num6, Main.maxTilesY), (double) genRand.Next(6, 20), genRand.Next(50, 300), num61, false, 0f, 0f, false, true); - } - } - int num62 = 0; - Main.statusText = "Generating surface caves..."; - for (int num63 = 0; num63 < ((int) (Main.maxTilesX * 0.0025)); num63++) - { - num62 = genRand.Next(0, Main.maxTilesX); - for (int num64 = 0; num64 < num3; num64++) - { - if (Main.tile[num62, num64].active) - { - TileRunner(num62, num64, (double) genRand.Next(3, 6), genRand.Next(5, 50), -1, false, genRand.Next(-10, 11) * 0.1f, 1f, false, true); - break; - } - } - } - for (int num65 = 0; num65 < ((int) (Main.maxTilesX * 0.0007)); num65++) - { - num62 = genRand.Next(0, Main.maxTilesX); - for (int num66 = 0; num66 < num3; num66++) - { - if (Main.tile[num62, num66].active) - { - TileRunner(num62, num66, (double) genRand.Next(10, 15), genRand.Next(50, 130), -1, false, genRand.Next(-10, 11) * 0.1f, 2f, false, true); - break; - } - } - } - for (int num67 = 0; num67 < ((int) (Main.maxTilesX * 0.0003)); num67++) - { - num62 = genRand.Next(0, Main.maxTilesX); - for (int num68 = 0; num68 < num3; num68++) - { - if (Main.tile[num62, num68].active) - { - TileRunner(num62, num68, (double) genRand.Next(12, 0x19), genRand.Next(150, 500), -1, false, genRand.Next(-10, 11) * 0.1f, 4f, false, true); - TileRunner(num62, num68, (double) genRand.Next(8, 0x11), genRand.Next(60, 200), -1, false, genRand.Next(-10, 11) * 0.1f, 2f, false, true); - TileRunner(num62, num68, (double) genRand.Next(5, 13), genRand.Next(40, 170), -1, false, genRand.Next(-10, 11) * 0.1f, 2f, false, true); - break; - } - } - } - for (int num69 = 0; num69 < ((int) (Main.maxTilesX * 0.0004)); num69++) - { - num62 = genRand.Next(0, Main.maxTilesX); - for (int num70 = 0; num70 < num3; num70++) - { - if (Main.tile[num62, num70].active) - { - TileRunner(num62, num70, (double) genRand.Next(7, 12), genRand.Next(150, 250), -1, false, 0f, 1f, true, true); - break; - } - } - } - for (int num73 = 0; num73 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 0.002)); num73++) - { - int num71 = genRand.Next(1, Main.maxTilesX - 1); - int num72 = genRand.Next((int) num2, (int) num3); - if (num72 >= Main.maxTilesY) - { - num72 = Main.maxTilesY - 2; - } - if (((Main.tile[num71 - 1, num72].active && (Main.tile[num71 - 1, num72].type == 0)) && (Main.tile[num71 + 1, num72].active && (Main.tile[num71 + 1, num72].type == 0))) && ((Main.tile[num71, num72 - 1].active && (Main.tile[num71, num72 - 1].type == 0)) && (Main.tile[num71, num72 + 1].active && (Main.tile[num71, num72 + 1].type == 0)))) - { - Main.tile[num71, num72].active = true; - Main.tile[num71, num72].type = 2; - } - num71 = genRand.Next(1, Main.maxTilesX - 1); - num72 = genRand.Next(0, (int) num2); - if (num72 >= Main.maxTilesY) - { - num72 = Main.maxTilesY - 2; - } - if (((Main.tile[num71 - 1, num72].active && (Main.tile[num71 - 1, num72].type == 0)) && (Main.tile[num71 + 1, num72].active && (Main.tile[num71 + 1, num72].type == 0))) && ((Main.tile[num71, num72 - 1].active && (Main.tile[num71, num72 - 1].type == 0)) && (Main.tile[num71, num72 + 1].active && (Main.tile[num71, num72 + 1].type == 0)))) - { - Main.tile[num71, num72].active = true; - Main.tile[num71, num72].type = 2; - } - } - Main.statusText = "Generating underground jungle: 0%"; - float num74 = Main.maxTilesX / 0x1068; - num74 *= 1.5f; - int num75 = 0; - if (num9 == -1) - { - num75 = (int) (Main.maxTilesX * 0.8f); - } - else - { - num75 = (int) (Main.maxTilesX * 0.2f); - } - int num76 = (Main.maxTilesY + ((int) Main.rockLayer)) / 2; - num75 += genRand.Next((int) (-100f * num74), (int) (101f * num74)); - num76 += genRand.Next((int) (-100f * num74), (int) (101f * num74)); - TileRunner(num75, num76, (double) genRand.Next((int) (250f * num74), (int) (500f * num74)), genRand.Next(50, 150), 0x3b, false, (float) (num9 * 3), 0f, false, true); - Main.statusText = "Generating underground jungle: 20%"; - num75 += genRand.Next((int) (-250f * num74), (int) (251f * num74)); - num76 += genRand.Next((int) (-150f * num74), (int) (151f * num74)); - int num77 = num75; - int num78 = num76; - TileRunner(num75, num76, (double) genRand.Next((int) (250f * num74), (int) (500f * num74)), genRand.Next(50, 150), 0x3b, false, 0f, 0f, false, true); - Main.statusText = "Generating underground jungle: 40%"; - num75 += genRand.Next((int) (-400f * num74), (int) (401f * num74)); - num76 += genRand.Next((int) (-150f * num74), (int) (151f * num74)); - TileRunner(num75, num76, (double) genRand.Next((int) (250f * num74), (int) (500f * num74)), genRand.Next(50, 150), 0x3b, false, (float) (num9 * -3), 0f, false, true); - Main.statusText = "Generating underground jungle: 60%"; - num75 = num77; - num76 = num78; - for (int num79 = 0; num79 <= (20f * num74); num79++) - { - Main.statusText = "Generating underground jungle: " + ((int) (60f + (((float) num79) / num74))) + "%"; - num75 += genRand.Next((int) (-5f * num74), (int) (6f * num74)); - num76 += genRand.Next((int) (-5f * num74), (int) (6f * num74)); - TileRunner(num75, num76, (double) genRand.Next(40, 100), genRand.Next(300, 500), 0x3b, false, 0f, 0f, false, true); - } - for (int num80 = 0; num80 <= (10f * num74); num80++) - { - Main.statusText = "Generating underground jungle: " + ((int) (80f + ((((float) num80) / num74) * 2f))) + "%"; - num75 = num77 + genRand.Next((int) (-600f * num74), (int) (600f * num74)); - num76 = num78 + genRand.Next((int) (-200f * num74), (int) (200f * num74)); - while ((((num75 < 1) || (num75 >= (Main.maxTilesX - 1))) || ((num76 < 1) || (num76 >= (Main.maxTilesY - 1)))) || (Main.tile[num75, num76].type != 0x3b)) - { - num75 = num77 + genRand.Next((int) (-600f * num74), (int) (600f * num74)); - num76 = num78 + genRand.Next((int) (-200f * num74), (int) (200f * num74)); - } - for (int num81 = 0; num81 < (8f * num74); num81++) - { - num75 += genRand.Next(-30, 0x1f); - num76 += genRand.Next(-30, 0x1f); - int num82 = -1; - if (genRand.Next(7) == 0) - { - num82 = -2; - } - TileRunner(num75, num76, (double) genRand.Next(10, 20), genRand.Next(30, 70), num82, false, 0f, 0f, false, true); - } - } - for (int num83 = 0; num83 <= (300f * num74); num83++) - { - num75 = num77 + genRand.Next((int) (-600f * num74), (int) (600f * num74)); - num76 = num78 + genRand.Next((int) (-200f * num74), (int) (200f * num74)); - while ((((num75 < 1) || (num75 >= (Main.maxTilesX - 1))) || ((num76 < 1) || (num76 >= (Main.maxTilesY - 1)))) || (Main.tile[num75, num76].type != 0x3b)) - { - num75 = num77 + genRand.Next((int) (-600f * num74), (int) (600f * num74)); - num76 = num78 + genRand.Next((int) (-200f * num74), (int) (200f * num74)); - } - TileRunner(num75, num76, (double) genRand.Next(4, 10), genRand.Next(5, 30), 1, false, 0f, 0f, false, true); - if (genRand.Next(4) == 0) - { - int num84 = genRand.Next(0x3f, 0x45); - TileRunner(num75 + genRand.Next(-1, 2), num76 + genRand.Next(-1, 2), (double) genRand.Next(3, 7), genRand.Next(4, 8), num84, false, 0f, 0f, false, true); - } - } - num75 = num77; - num76 = num78; - float num85 = genRand.Next(6, 10); - float num86 = Main.maxTilesX / 0x1068; - num85 *= num86; - for (int num87 = 0; num87 < num85; num87++) - { - bool flag6 = true; - while (flag6) - { - num75 = genRand.Next(20, Main.maxTilesX - 20); - num76 = genRand.Next(20, Main.maxTilesY - 300); - if (Main.tile[num75, num76].type == 0x3b) - { - flag6 = false; - int num88 = genRand.Next(2, 4); - int num89 = genRand.Next(2, 4); - for (int num90 = (num75 - num88) - 1; num90 <= ((num75 + num88) + 1); num90++) - { - for (int num91 = (num76 - num89) - 1; num91 <= ((num76 + num89) + 1); num91++) - { - Main.tile[num90, num91].active = true; - Main.tile[num90, num91].type = 0x2d; - Main.tile[num90, num91].liquid = 0; - Main.tile[num90, num91].lava = false; - } - } - for (int num92 = num75 - num88; num92 <= (num75 + num88); num92++) - { - for (int num93 = num76 - num89; num93 <= (num76 + num89); num93++) - { - Main.tile[num92, num93].active = false; - Main.tile[num92, num93].wall = 10; - } - } - bool flag7 = false; - int num94 = 0; - while (!flag7 && (num94 < 100)) - { - num94++; - int num95 = genRand.Next(num75 - num88, (num75 + num88) + 1); - int num96 = genRand.Next(num76 - num89, (num76 + num89) - 2); - PlaceTile(num95, num96, 4, true, false, -1); - if (Main.tile[num95, num96].type == 4) - { - flag7 = true; - } - } - for (int num97 = (num75 - num88) - 1; num97 <= ((num75 + num88) + 1); num97++) - { - for (int num98 = (num76 + num89) - 2; num98 <= (num76 + num89); num98++) - { - Main.tile[num97, num98].active = false; - } - } - for (int num99 = (num75 - num88) - 1; num99 <= ((num75 + num88) + 1); num99++) - { - for (int num100 = (num76 + num89) - 2; num100 <= ((num76 + num89) - 1); num100++) - { - Main.tile[num99, num100].active = false; - } - } - for (int num101 = (num75 - num88) - 1; num101 <= ((num75 + num88) + 1); num101++) - { - int num102 = 4; - int num103 = (num76 + num89) + 2; - while ((!Main.tile[num101, num103].active && (num103 < Main.maxTilesY)) && (num102 > 0)) - { - Main.tile[num101, num103].active = true; - Main.tile[num101, num103].type = 0x3b; - num103++; - num102--; - } - } - num88 -= genRand.Next(1, 3); - for (int num104 = (num76 - num89) - 2; num88 > -1; num104--) - { - for (int num105 = (num75 - num88) - 1; num105 <= ((num75 + num88) + 1); num105++) - { - Main.tile[num105, num104].active = true; - Main.tile[num105, num104].type = 0x2d; - } - num88 -= genRand.Next(1, 3); - } - JChestX[numJChests] = num75; - JChestY[numJChests] = num76; - numJChests++; - } - } - } - for (int num106 = 0; num106 < Main.maxTilesX; num106++) - { - for (int num107 = (int) Main.worldSurface; num107 < Main.maxTilesY; num107++) - { - if (Main.tile[num106, num107].active) - { - SpreadGrass(num106, num107, 0x3b, 60, false); - } - } - } - Main.statusText = "Adding mushroom patches..."; - for (int num108 = 0; num108 < (Main.maxTilesX / 300); num108++) - { - int num109 = genRand.Next((int) (Main.maxTilesX * 0.3), (int) (Main.maxTilesX * 0.7)); - int num110 = genRand.Next((int) Main.rockLayer, Main.maxTilesY - 300); - ShroomPatch(num109, num110); - } - for (int num111 = 0; num111 < Main.maxTilesX; num111++) - { - for (int num112 = (int) Main.worldSurface; num112 < Main.maxTilesY; num112++) - { - if (Main.tile[num111, num112].active) - { - SpreadGrass(num111, num112, 0x3b, 70, false); - } - } - } - Main.statusText = "Placing mud in the dirt..."; - for (int num113 = 0; num113 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 0.001)); num113++) - { - TileRunner(genRand.Next(0, Main.maxTilesX), genRand.Next((int) num5, Main.maxTilesY), (double) genRand.Next(2, 6), genRand.Next(2, 40), 0x3b, false, 0f, 0f, false, true); - } - Main.statusText = "Adding shinies..."; - for (int num114 = 0; num114 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 6E-05)); num114++) - { - TileRunner(genRand.Next(0, Main.maxTilesX), genRand.Next((int) num2, (int) num3), (double) genRand.Next(3, 6), genRand.Next(2, 6), 7, false, 0f, 0f, false, true); - } - for (int num115 = 0; num115 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 8E-05)); num115++) - { - TileRunner(genRand.Next(0, Main.maxTilesX), genRand.Next((int) num3, (int) num6), (double) genRand.Next(3, 7), genRand.Next(3, 7), 7, false, 0f, 0f, false, true); - } - for (int num116 = 0; num116 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 0.0002)); num116++) - { - TileRunner(genRand.Next(0, Main.maxTilesX), genRand.Next((int) num5, Main.maxTilesY), (double) genRand.Next(4, 9), genRand.Next(4, 8), 7, false, 0f, 0f, false, true); - } - for (int num117 = 0; num117 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 3E-05)); num117++) - { - TileRunner(genRand.Next(0, Main.maxTilesX), genRand.Next((int) num2, (int) num3), (double) genRand.Next(3, 7), genRand.Next(2, 5), 6, false, 0f, 0f, false, true); - } - for (int num118 = 0; num118 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 8E-05)); num118++) - { - TileRunner(genRand.Next(0, Main.maxTilesX), genRand.Next((int) num3, (int) num6), (double) genRand.Next(3, 6), genRand.Next(3, 6), 6, false, 0f, 0f, false, true); - } - for (int num119 = 0; num119 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 0.0002)); num119++) - { - TileRunner(genRand.Next(0, Main.maxTilesX), genRand.Next((int) num5, Main.maxTilesY), (double) genRand.Next(4, 9), genRand.Next(4, 8), 6, false, 0f, 0f, false, true); - } - for (int num120 = 0; num120 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 3E-05)); num120++) - { - TileRunner(genRand.Next(0, Main.maxTilesX), genRand.Next((int) num3, (int) num6), (double) genRand.Next(3, 6), genRand.Next(3, 6), 9, false, 0f, 0f, false, true); - } - for (int num121 = 0; num121 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 0.00017)); num121++) - { - TileRunner(genRand.Next(0, Main.maxTilesX), genRand.Next((int) num5, Main.maxTilesY), (double) genRand.Next(4, 9), genRand.Next(4, 8), 9, false, 0f, 0f, false, true); - } - for (int num122 = 0; num122 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 0.00017)); num122++) - { - TileRunner(genRand.Next(0, Main.maxTilesX), genRand.Next(0, (int) num2), (double) genRand.Next(4, 9), genRand.Next(4, 8), 9, false, 0f, 0f, false, true); - } - for (int num123 = 0; num123 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 0.00012)); num123++) - { - TileRunner(genRand.Next(0, Main.maxTilesX), genRand.Next((int) num5, Main.maxTilesY), (double) genRand.Next(4, 8), genRand.Next(4, 8), 8, false, 0f, 0f, false, true); - } - for (int num124 = 0; num124 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 0.00012)); num124++) - { - TileRunner(genRand.Next(0, Main.maxTilesX), genRand.Next(0, ((int) num2) - 20), (double) genRand.Next(4, 8), genRand.Next(4, 8), 8, false, 0f, 0f, false, true); - } - Main.statusText = "Adding webs..."; - for (int num125 = 0; num125 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 0.001)); num125++) - { - int num126 = genRand.Next(20, Main.maxTilesX - 20); - int num127 = genRand.Next((int) num2, Main.maxTilesY - 20); - if (num125 < numMCaves) - { - num126 = mCaveX[num125]; - num127 = mCaveY[num125]; - } - if (!Main.tile[num126, num127].active && ((num127 > Main.worldSurface) || (Main.tile[num126, num127].wall > 0))) - { - while (!Main.tile[num126, num127].active && (num127 > ((int) num2))) - { - num127--; - } - num127++; - int num128 = 1; - if (genRand.Next(2) == 0) - { - num128 = -1; - } - while ((!Main.tile[num126, num127].active && (num126 > 10)) && (num126 < (Main.maxTilesX - 10))) - { - num126 += num128; - } - num126 -= num128; - if ((num127 > Main.worldSurface) || (Main.tile[num126, num127].wall > 0)) - { - TileRunner(num126, num127, (double) genRand.Next(4, 13), genRand.Next(2, 5), 0x33, true, (float) num128, -1f, false, false); - } - } - } - Main.statusText = "Creating underworld: 0%"; - int num129 = Main.maxTilesY - genRand.Next(150, 190); - for (int num130 = 0; num130 < Main.maxTilesX; num130++) - { - num129 += genRand.Next(-3, 4); - if (num129 < (Main.maxTilesY - 190)) - { - num129 = Main.maxTilesY - 190; - } - if (num129 > (Main.maxTilesY - 160)) - { - num129 = Main.maxTilesY - 160; - } - for (int num131 = (num129 - 20) - genRand.Next(3); num131 < Main.maxTilesY; num131++) - { - if (num131 >= num129) - { - Main.tile[num130, num131].active = false; - Main.tile[num130, num131].lava = false; - Main.tile[num130, num131].liquid = 0; - } - else - { - Main.tile[num130, num131].type = 0x39; - } - } - } - int num132 = Main.maxTilesY - genRand.Next(40, 70); - for (int num133 = 10; num133 < (Main.maxTilesX - 10); num133++) - { - num132 += genRand.Next(-10, 11); - if (num132 > (Main.maxTilesY - 60)) - { - num132 = Main.maxTilesY - 60; - } - if (num132 < (Main.maxTilesY - 100)) - { - num132 = Main.maxTilesY - 120; - } - for (int num134 = num132; num134 < (Main.maxTilesY - 10); num134++) - { - if (!Main.tile[num133, num134].active) - { - Main.tile[num133, num134].lava = true; - Main.tile[num133, num134].liquid = 0xff; - } - } - } - for (int num135 = 0; num135 < Main.maxTilesX; num135++) - { - if (genRand.Next(50) == 0) - { - int num136 = Main.maxTilesY - 0x41; - while (!Main.tile[num135, num136].active && (num136 > (Main.maxTilesY - 0x87))) - { - num136--; - } - TileRunner(genRand.Next(0, Main.maxTilesX), num136 + genRand.Next(20, 50), (double) genRand.Next(15, 20), 0x3e8, 0x39, true, 0f, (float) genRand.Next(1, 3), true, true); - } - } - Liquid.QuickWater(-2, -1, -1); - for (int num137 = 0; num137 < Main.maxTilesX; num137++) - { - float num138 = ((float) num137) / ((float) (Main.maxTilesX - 1)); - Main.statusText = "Creating underworld: " + ((int) (((num138 * 100f) / 2f) + 50f)) + "%"; - if (genRand.Next(13) == 0) - { - int num139 = Main.maxTilesY - 0x41; - while (((Main.tile[num137, num139].liquid > 0) || Main.tile[num137, num139].active) && (num139 > (Main.maxTilesY - 140))) - { - num139--; - } - TileRunner(num137, num139 - genRand.Next(2, 5), (double) genRand.Next(5, 30), 0x3e8, 0x39, true, 0f, (float) genRand.Next(1, 3), true, true); - float num140 = genRand.Next(1, 3); - if (genRand.Next(3) == 0) - { - num140 *= 0.5f; - } - if (genRand.Next(2) == 0) - { - TileRunner(num137, num139 - genRand.Next(2, 5), (double) ((int) (genRand.Next(5, 15) * num140)), (int) (genRand.Next(10, 15) * num140), 0x39, true, 1f, 0.3f, false, true); - } - if (genRand.Next(2) == 0) - { - num140 = genRand.Next(1, 3); - TileRunner(num137, num139 - genRand.Next(2, 5), (double) ((int) (genRand.Next(5, 15) * num140)), (int) (genRand.Next(10, 15) * num140), 0x39, true, -1f, 0.3f, false, true); - } - TileRunner(num137 + genRand.Next(-10, 10), num139 + genRand.Next(-10, 10), (double) genRand.Next(5, 15), genRand.Next(5, 10), -2, false, (float) genRand.Next(-1, 3), (float) genRand.Next(-1, 3), false, true); - if (genRand.Next(3) == 0) - { - TileRunner(num137 + genRand.Next(-10, 10), num139 + genRand.Next(-10, 10), (double) genRand.Next(10, 30), genRand.Next(10, 20), -2, false, (float) genRand.Next(-1, 3), (float) genRand.Next(-1, 3), false, true); - } - if (genRand.Next(5) == 0) - { - TileRunner(num137 + genRand.Next(-15, 15), num139 + genRand.Next(-15, 10), (double) genRand.Next(15, 30), genRand.Next(5, 20), -2, false, (float) genRand.Next(-1, 3), (float) genRand.Next(-1, 3), false, true); - } - } - } - for (int num141 = 0; num141 < Main.maxTilesX; num141++) - { - if (!Main.tile[num141, Main.maxTilesY - 0x91].active) - { - Main.tile[num141, Main.maxTilesY - 0x91].liquid = 0xff; - Main.tile[num141, Main.maxTilesY - 0x91].lava = true; - } - if (!Main.tile[num141, Main.maxTilesY - 0x90].active) - { - Main.tile[num141, Main.maxTilesY - 0x90].liquid = 0xff; - Main.tile[num141, Main.maxTilesY - 0x90].lava = true; - } - } - for (int num142 = 0; num142 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 0.002)); num142++) - { - TileRunner(genRand.Next(0, Main.maxTilesX), genRand.Next(Main.maxTilesY - 140, Main.maxTilesY), (double) genRand.Next(3, 8), genRand.Next(3, 8), 0x3a, false, 0f, 0f, false, true); - } - AddHellHouses(); - int num143 = genRand.Next(2, (int) (Main.maxTilesX * 0.005)); - for (int num144 = 0; num144 < num143; num144++) - { - float num145 = ((float) num144) / ((float) num143); - Main.statusText = "Adding water bodies: " + ((int) (num145 * 100f)) + "%"; - int num146 = genRand.Next(300, Main.maxTilesX - 300); - while ((num146 > ((Main.maxTilesX / 2) - 50)) && (num146 < ((Main.maxTilesX / 2) + 50))) - { - num146 = genRand.Next(300, Main.maxTilesX - 300); - } - int num147 = ((int) num2) - 20; - while (!Main.tile[num146, num147].active) - { - num147++; - } - Lakinater(num146, num147); - } - int x = 0; - if (num9 == -1) - { - x = genRand.Next((int) (Main.maxTilesX * 0.05), (int) (Main.maxTilesX * 0.2)); - num9 = -1; - } - else - { - x = genRand.Next((int) (Main.maxTilesX * 0.8), (int) (Main.maxTilesX * 0.95)); - num9 = 1; - } - int y = ((int) ((Main.rockLayer + Main.maxTilesY) / 2.0)) + genRand.Next(-200, 200); - MakeDungeon(x, y, 0x29, 7); - for (int num150 = 0; num150 < (Main.maxTilesX * 0.0004); num150++) - { - float num151 = (float) (((double) num150) / (Main.maxTilesX * 0.0004)); - Main.statusText = "Making the world evil: " + ((int) (num151 * 100f)) + "%"; - bool flag8 = false; - int num152 = 0; - int num153 = 0; - int num154 = 0; - while (!flag8) - { - flag8 = true; - int num155 = Main.maxTilesX / 2; - int num156 = 200; - num152 = genRand.Next(Main.maxTilesX); - num153 = (num152 - genRand.Next(150)) - 0xaf; - num154 = (num152 + genRand.Next(150)) + 0xaf; - if (num153 < 0) - { - num153 = 0; - } - if (num154 > Main.maxTilesX) - { - num154 = Main.maxTilesX; - } - if ((num152 > (num155 - num156)) && (num152 < (num155 + num156))) - { - flag8 = false; - } - if ((num153 > (num155 - num156)) && (num153 < (num155 + num156))) - { - flag8 = false; - } - if ((num154 > (num155 - num156)) && (num154 < (num155 + num156))) - { - flag8 = false; - } - for (int num157 = num153; num157 < num154; num157++) - { - for (int num158 = 0; num158 < ((int) Main.worldSurface); num158 += 5) - { - if (Main.tile[num157, num158].active && Main.tileDungeon[Main.tile[num157, num158].type]) - { - flag8 = false; - break; - } - if (!flag8) - { - break; - } - } - } - } - int num159 = 0; - for (int num160 = num153; num160 < num154; num160++) - { - if (num159 > 0) - { - num159--; - } - if ((num160 == num152) || (num159 == 0)) - { - for (int num161 = (int) num2; num161 < (Main.worldSurface - 1.0); num161++) - { - if (Main.tile[num160, num161].active || (Main.tile[num160, num161].wall > 0)) - { - if (num160 == num152) - { - num159 = 20; - ChasmRunner(num160, num161, genRand.Next(150) + 150, true); - } - else if ((genRand.Next(30) == 0) && (num159 == 0)) - { - num159 = 20; - bool makeOrb = false; - if (genRand.Next(2) == 0) - { - makeOrb = true; - } - ChasmRunner(num160, num161, genRand.Next(50) + 50, makeOrb); - } - break; - } - } - } - } - double num162 = Main.worldSurface + 40.0; - for (int num163 = num153; num163 < num154; num163++) - { - num162 += genRand.Next(-2, 3); - if (num162 < (Main.worldSurface + 30.0)) - { - num162 = Main.worldSurface + 30.0; - } - if (num162 > (Main.worldSurface + 50.0)) - { - num162 = Main.worldSurface + 50.0; - } - num62 = num163; - bool flag10 = false; - for (int num164 = (int) num2; num164 < num162; num164++) - { - if (Main.tile[num62, num164].active) - { - if (((Main.tile[num62, num164].type == 0) && (num164 < (Main.worldSurface - 1.0))) && !flag10) - { - SpreadGrass(num62, num164, 0, 0x17, true); - } - flag10 = true; - if (((Main.tile[num62, num164].type == 1) && (num62 >= (num153 + genRand.Next(5)))) && (num62 <= (num154 - genRand.Next(5)))) - { - Main.tile[num62, num164].type = 0x19; - } - if (Main.tile[num62, num164].type == 2) - { - Main.tile[num62, num164].type = 0x17; - } - } - } - } - for (int num165 = num153; num165 < num154; num165++) - { - for (int num166 = 0; num166 < (Main.maxTilesY - 50); num166++) - { - if (Main.tile[num165, num166].active && (Main.tile[num165, num166].type == 0x1f)) - { - int num167 = num165 - 13; - int num168 = num165 + 13; - int num169 = num166 - 13; - int num170 = num166 + 13; - for (int num171 = num167; num171 < num168; num171++) - { - if ((num171 > 10) && (num171 < (Main.maxTilesX - 10))) - { - for (int num172 = num169; num172 < num170; num172++) - { - if ((((Math.Abs((int) (num171 - num165)) + Math.Abs((int) (num172 - num166))) < (9 + genRand.Next(11))) && (genRand.Next(3) != 0)) && (Main.tile[num171, num172].type != 0x1f)) - { - Main.tile[num171, num172].active = true; - Main.tile[num171, num172].type = 0x19; - if ((Math.Abs((int) (num171 - num165)) <= 1) && (Math.Abs((int) (num172 - num166)) <= 1)) - { - Main.tile[num171, num172].active = false; - } - } - if (((Main.tile[num171, num172].type != 0x1f) && (Math.Abs((int) (num171 - num165)) <= (2 + genRand.Next(3)))) && (Math.Abs((int) (num172 - num166)) <= (2 + genRand.Next(3)))) - { - Main.tile[num171, num172].active = false; - } - } - } - } - } - } - } - } - Main.statusText = "Generating mountain caves..."; - for (int num173 = 0; num173 < numMCaves; num173++) - { - int num174 = mCaveX[num173]; - int num175 = mCaveY[num173]; - CaveOpenater(num174, num175); - Cavinator(num174, num175, genRand.Next(40, 50)); - } - Main.statusText = "Creating beaches..."; - for (int num176 = 0; num176 < 2; num176++) - { - int num177 = 0; - int num178 = 0; - if (num176 == 0) - { - num177 = 0; - num178 = genRand.Next(0x7d, 200); - float num179 = 1f; - int num180 = 0; - while (!Main.tile[num178 - 1, num180].active) - { - num180++; - } - for (int num181 = num178 - 1; num181 >= num177; num181--) - { - num179 += genRand.Next(10, 20) * 0.05f; - for (int num182 = 0; num182 < (num180 + num179); num182++) - { - if (num182 < ((num180 + (num179 * 0.75f)) - 3f)) - { - Main.tile[num181, num182].active = false; - if (num182 > num180) - { - Main.tile[num181, num182].liquid = 0xff; - } - else if (num182 == num180) - { - Main.tile[num181, num182].liquid = 0x7f; - } - } - else if (num182 > num180) - { - Main.tile[num181, num182].type = 0x35; - Main.tile[num181, num182].active = true; - } - Main.tile[num181, num182].wall = 0; - } - } - } - else - { - num177 = Main.maxTilesX - genRand.Next(0x7d, 200); - num178 = Main.maxTilesX; - float num183 = 1f; - int num184 = 0; - while (!Main.tile[num177, num184].active) - { - num184++; - } - for (int num185 = num177; num185 < num178; num185++) - { - num183 += genRand.Next(10, 20) * 0.05f; - for (int num186 = 0; num186 < (num184 + num183); num186++) - { - if (num186 < ((num184 + (num183 * 0.75f)) - 3f)) - { - Main.tile[num185, num186].active = false; - if (num186 > num184) - { - Main.tile[num185, num186].liquid = 0xff; - } - else if (num186 == num184) - { - Main.tile[num185, num186].liquid = 0x7f; - } - } - else if (num186 > num184) - { - Main.tile[num185, num186].type = 0x35; - Main.tile[num185, num186].active = true; - } - Main.tile[num185, num186].wall = 0; - } - } - } - } - Main.statusText = "Adding gems..."; - for (int num187 = 0x3f; num187 <= 0x44; num187++) - { - float num188 = 0f; - switch (num187) - { - case 0x43: - num188 = Main.maxTilesX * 0.5f; - break; - - case 0x42: - num188 = Main.maxTilesX * 0.45f; - break; - - case 0x3f: - num188 = Main.maxTilesX * 0.3f; - break; - - case 0x41: - num188 = Main.maxTilesX * 0.25f; - break; - - case 0x40: - num188 = Main.maxTilesX * 0.1f; - break; - - case 0x44: - num188 = Main.maxTilesX * 0.05f; - break; - } - num188 *= 0.2f; - for (int num189 = 0; num189 < num188; num189++) - { - int num190 = genRand.Next(0, Main.maxTilesX); - int num191 = genRand.Next((int) Main.worldSurface, Main.maxTilesY); - while (Main.tile[num190, num191].type != 1) - { - num190 = genRand.Next(0, Main.maxTilesX); - num191 = genRand.Next((int) Main.worldSurface, Main.maxTilesY); - } - TileRunner(num190, num191, (double) genRand.Next(2, 6), genRand.Next(3, 7), num187, false, 0f, 0f, false, true); - } - } - for (int num192 = 0; num192 < Main.maxTilesX; num192++) - { - float num193 = ((float) num192) / ((float) (Main.maxTilesX - 1)); - Main.statusText = "Gravitating sand: " + ((int) (num193 * 100f)) + "%"; - for (int num194 = Main.maxTilesY - 5; num194 > 0; num194--) - { - if (Main.tile[num192, num194].active && (Main.tile[num192, num194].type == 0x35)) - { - for (int num195 = num194; !Main.tile[num192, num195 + 1].active && (num195 < (Main.maxTilesY - 5)); num195++) - { - Main.tile[num192, num195 + 1].active = true; - Main.tile[num192, num195 + 1].type = 0x35; - } - } - } - } - for (int num196 = 3; num196 < (Main.maxTilesX - 3); num196++) - { - float num197 = ((float) num196) / ((float) Main.maxTilesX); - Main.statusText = "Cleaning up dirt backgrounds: " + ((int) ((num197 * 100f) + 1f)) + "%"; - for (int num198 = 0; num198 < Main.worldSurface; num198++) - { - if (Main.tile[num196, num198].wall == 2) - { - Main.tile[num196, num198].wall = 0; - } - if (Main.tile[num196, num198].type != 0x35) - { - if (Main.tile[num196 - 1, num198].wall == 2) - { - Main.tile[num196 - 1, num198].wall = 0; - } - if ((Main.tile[num196 - 2, num198].wall == 2) && (genRand.Next(2) == 0)) - { - Main.tile[num196 - 2, num198].wall = 0; - } - if ((Main.tile[num196 - 3, num198].wall == 2) && (genRand.Next(2) == 0)) - { - Main.tile[num196 - 3, num198].wall = 0; - } - if (Main.tile[num196 + 1, num198].wall == 2) - { - Main.tile[num196 + 1, num198].wall = 0; - } - if ((Main.tile[num196 + 2, num198].wall == 2) && (genRand.Next(2) == 0)) - { - Main.tile[num196 + 2, num198].wall = 0; - } - if ((Main.tile[num196 + 3, num198].wall == 2) && (genRand.Next(2) == 0)) - { - Main.tile[num196 + 3, num198].wall = 0; - } - if (Main.tile[num196, num198].active) - { - break; - } - } - } - } - for (int num199 = 0; num199 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 2E-05)); num199++) - { - float num200 = (float) (((double) num199) / ((Main.maxTilesX * Main.maxTilesY) * 2E-05)); - Main.statusText = "Placing alters: " + ((int) ((num200 * 100f) + 1f)) + "%"; - bool flag11 = false; - int num201 = 0; - while (!flag11) - { - int num202 = genRand.Next(1, Main.maxTilesX); - int num203 = (int) (num3 + 20.0); - Place3x2(num202, num203, 0x1a); - if (Main.tile[num202, num203].type == 0x1a) - { - flag11 = true; - } - else - { - num201++; - if (num201 >= 0x2710) - { - flag11 = true; - } - } - } - } - Liquid.QuickWater(3, -1, -1); - WaterCheck(); - int num204 = 0; - Liquid.quickSettle = true; - while (num204 < 10) - { - int num205 = Liquid.numLiquid + LiquidBuffer.numLiquidBuffer; - num204++; - float num206 = 0f; - while (Liquid.numLiquid > 0) - { - float num207 = ((float) (num205 - (Liquid.numLiquid + LiquidBuffer.numLiquidBuffer))) / ((float) num205); - if ((Liquid.numLiquid + LiquidBuffer.numLiquidBuffer) > num205) - { - num205 = Liquid.numLiquid + LiquidBuffer.numLiquidBuffer; - } - if (num207 > num206) - { - num206 = num207; - } - else - { - num207 = num206; - } - if (num204 == 1) - { - Main.statusText = "Settling liquids: " + ((int) (((num207 * 100f) / 3f) + 33f)) + "%"; - } - int num208 = 10; - if (num204 > num208) - { - num208 = num204; - } - Liquid.UpdateLiquid(); - } - WaterCheck(); - Main.statusText = "Settling liquids: " + ((int) (((num204 * 10f) / 3f) + 66f)) + "%"; - } - Liquid.quickSettle = false; - for (int num209 = 0; num209 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 2.5E-05)); num209++) - { - float num210 = (float) (((double) num209) / ((Main.maxTilesX * Main.maxTilesY) * 2.5E-05)); - Main.statusText = "Placing life crystals: " + ((int) ((num210 * 100f) + 1f)) + "%"; - bool flag12 = false; - int num211 = 0; - while (!flag12) - { - if (AddLifeCrystal(genRand.Next(1, Main.maxTilesX), genRand.Next((int) (num3 + 20.0), Main.maxTilesY))) - { - flag12 = true; - } - else - { - num211++; - if (num211 >= 0x2710) - { - flag12 = true; - } - } - } - } - for (int num212 = 0; num212 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 1.8E-05)); num212++) - { - float num213 = (float) (((double) num212) / ((Main.maxTilesX * Main.maxTilesY) * 1.8E-05)); - Main.statusText = "Hiding treasure: " + ((int) ((num213 * 100f) + 1f)) + "%"; - bool flag13 = false; - int num214 = 0; - while (!flag13) - { - if (AddBuriedChest(genRand.Next(1, Main.maxTilesX), genRand.Next((int) (num3 + 20.0), Main.maxTilesY), 0)) - { - flag13 = true; - } - else - { - num214++; - if (num214 >= 0x2710) - { - flag13 = true; - } - } - } - } - int num215 = 0; - for (int num216 = 0; num216 < numJChests; num216++) - { - num215++; - int contain = 0xd3; - switch (num215) - { - case 1: - contain = 0xd3; - break; - - case 2: - contain = 0xd4; - break; - - case 3: - contain = 0xd5; - break; - } - if (num215 > 3) - { - num215 = 0; - } - if (!AddBuriedChest(JChestX[num216] + genRand.Next(2), JChestY[num216], contain)) - { - for (int num218 = JChestX[num216]; num218 <= (JChestX[num216] + 1); num218++) - { - for (int num219 = JChestY[num216]; num219 <= (JChestY[num216] + 1); num219++) - { - KillTile(num218, num219, false, false, false); - } - } - AddBuriedChest(JChestX[num216], JChestY[num216], contain); - } - } - float num220 = Main.maxTilesX / 0x1068; - int num221 = 0; - for (int num222 = 0; num222 < (10f * num220); num222++) - { - int num224; - int num225; - int num223 = 0; - num221++; - if (num221 == 1) - { - num223 = 0xba; - } - else - { - num223 = 0xbb; - num221 = 0; - } - for (bool flag14 = false; !flag14; flag14 = AddBuriedChest(num224, num225, num223)) - { - num224 = genRand.Next(1, Main.maxTilesX); - for (num225 = genRand.Next(1, Main.maxTilesY - 200); (Main.tile[num224, num225].liquid < 200) || Main.tile[num224, num225].lava; num225 = genRand.Next(1, Main.maxTilesY - 200)) - { - num224 = genRand.Next(1, Main.maxTilesX); - } - } - } - for (int num226 = 0; num226 < numIslandHouses; num226++) - { - IslandHouse(fihX[num226], fihY[num226]); - } - for (int num227 = 0; num227 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 0.0008)); num227++) - { - float num228 = (float) (((double) num227) / ((Main.maxTilesX * Main.maxTilesY) * 0.0008)); - Main.statusText = "Placing breakables: " + ((int) ((num228 * 100f) + 1f)) + "%"; - bool flag15 = false; - int num229 = 0; - Label_46C1: - while (!flag15) - { - int num230 = genRand.Next((int) num3, Main.maxTilesY - 10); - if (num228 > 0.93) - { - num230 = Main.maxTilesY - 150; - } - else if (num228 > 0.75) - { - num230 = (int) num2; - } - int num231 = genRand.Next(1, Main.maxTilesX); - bool flag16 = false; - for (int num232 = num230; num232 < Main.maxTilesY; num232++) - { - if (!flag16) - { - if ((Main.tile[num231, num232].active && Main.tileSolid[Main.tile[num231, num232].type]) && !Main.tile[num231, num232 - 1].lava) - { - flag16 = true; - } - } - else - { - if (PlacePot(num231, num232, 0x1c)) - { - flag15 = true; - goto Label_46C1; - } - num229++; - if (num229 >= 0x2710) - { - flag15 = true; - goto Label_46C1; - } - } - } - } - } - for (int num233 = 0; num233 < ((int) ((Main.maxTilesX * Main.maxTilesY) * 1E-05)); num233++) - { - float num234 = (float) (((double) num233) / ((Main.maxTilesX * Main.maxTilesY) * 1E-05)); - Main.statusText = "Placing hellforges: " + ((int) ((num234 * 100f) + 1f)) + "%"; - bool flag17 = false; - int num235 = 0; - while (!flag17) - { - int num236 = genRand.Next(1, Main.maxTilesX); - int num237 = genRand.Next(Main.maxTilesY - 250, Main.maxTilesY - 5); - if (Main.tile[num236, num237].wall == 13) - { - while (!Main.tile[num236, num237].active) - { - num237++; - } - num237--; - PlaceTile(num236, num237, 0x4d, false, false, -1); - if (Main.tile[num236, num237].type == 0x4d) - { - flag17 = true; - } - else - { - num235++; - if (num235 >= 0x2710) - { - flag17 = true; - } - } - } - } - } - Main.statusText = "Spreading grass..."; - for (int num238 = 0; num238 < Main.maxTilesX; num238++) - { - num62 = num238; - bool flag18 = true; - for (int num239 = 0; num239 < (Main.worldSurface - 1.0); num239++) - { - if (Main.tile[num62, num239].active) - { - if (flag18 && (Main.tile[num62, num239].type == 0)) - { - SpreadGrass(num62, num239, 0, 2, true); - } - if (num239 > num3) - { - break; - } - flag18 = false; - } - else if (Main.tile[num62, num239].wall == 0) - { - flag18 = true; - } - } - } - int num240 = 5; - bool flag19 = true; - while (flag19) - { - int num241 = (Main.maxTilesX / 2) + genRand.Next(-num240, num240 + 1); - for (int num242 = 0; num242 < Main.maxTilesY; num242++) - { - if (Main.tile[num241, num242].active) - { - Main.spawnTileX = num241; - Main.spawnTileY = num242; - Main.tile[num241, num242 - 1].lighted = true; - break; - } - } - flag19 = false; - num240++; - if (Main.spawnTileY > Main.worldSurface) - { - flag19 = true; - } - if (Main.tile[Main.spawnTileX, Main.spawnTileY - 1].liquid > 0) - { - flag19 = true; - } - } - for (int num243 = 10; Main.spawnTileY > Main.worldSurface; num243++) - { - int num244 = genRand.Next((Main.maxTilesX / 2) - num243, (Main.maxTilesX / 2) + num243); - for (int num245 = 0; num245 < Main.maxTilesY; num245++) - { - if (Main.tile[num244, num245].active) - { - Main.spawnTileX = num244; - Main.spawnTileY = num245; - Main.tile[num244, num245 - 1].lighted = true; - break; - } - } - } - int index = NPC.NewNPC(Main.spawnTileX * 0x10, Main.spawnTileY * 0x10, 0x16, 0); - Main.npc[index].homeTileX = Main.spawnTileX; - Main.npc[index].homeTileY = Main.spawnTileY; - Main.npc[index].direction = 1; - Main.npc[index].homeless = true; - Main.statusText = "Planting sunflowers..."; - for (int num247 = 0; num247 < (Main.maxTilesX * 0.002); num247++) - { - int num248 = 0; - int num249 = 0; - int num250 = 0; - int num1 = Main.maxTilesX / 2; - num248 = genRand.Next(Main.maxTilesX); - num249 = (num248 - genRand.Next(10)) - 7; - num250 = (num248 + genRand.Next(10)) + 7; - if (num249 < 0) - { - num249 = 0; - } - if (num250 > (Main.maxTilesX - 1)) - { - num250 = Main.maxTilesX - 1; - } - for (int num251 = num249; num251 < num250; num251++) - { - for (int num252 = 1; num252 < (Main.worldSurface - 1.0); num252++) - { - if ((Main.tile[num251, num252].type == 1) && Main.tile[num251, num252].active) - { - Main.tile[num251, num252].type = 2; - } - if ((Main.tile[num251 + 1, num252].type == 1) && Main.tile[num251 + 1, num252].active) - { - Main.tile[num251 + 1, num252].type = 2; - } - if (((Main.tile[num251, num252].type == 2) && Main.tile[num251, num252].active) && !Main.tile[num251, num252 - 1].active) - { - PlaceTile(num251, num252 - 1, 0x1b, true, false, -1); - } - if (Main.tile[num251, num252].active) - { - break; - } - } - } - } - Main.statusText = "Planting trees..."; - for (int num253 = 0; num253 < (Main.maxTilesX * 0.003); num253++) - { - int num254 = genRand.Next(50, Main.maxTilesX - 50); - int num255 = genRand.Next(0x19, 50); - for (int num256 = num254 - num255; num256 < (num254 + num255); num256++) - { - for (int num257 = 20; num257 < Main.worldSurface; num257++) - { - if (Main.tile[num256, num257].active) - { - if (Main.tile[num256, num257].type == 1) - { - Main.tile[num256, num257].type = 2; - } - if (Main.tile[num256, num257 + 1].type == 1) - { - Main.tile[num256, num257 + 1].type = 2; - } - break; - } - } - } - for (int num258 = num254 - num255; num258 < (num254 + num255); num258++) - { - for (int num259 = 20; num259 < Main.worldSurface; num259++) - { - GrowEpicTree(num258, num259); - } - } - } - AddTrees(); - Main.statusText = "Planting weeds..."; - AddPlants(); - for (int num260 = 0; num260 < Main.maxTilesX; num260++) - { - for (int num261 = (int) Main.worldSurface; num261 < Main.maxTilesY; num261++) - { - if (Main.tile[num260, num261].active) - { - if ((Main.tile[num260, num261].type == 70) && !Main.tile[num260, num261 - 1].active) - { - GrowShroom(num260, num261); - if (!Main.tile[num260, num261 - 1].active) - { - PlaceTile(num260, num261 - 1, 0x47, true, false, -1); - } - } - if ((Main.tile[num260, num261].type == 60) && !Main.tile[num260, num261 - 1].active) - { - PlaceTile(num260, num261 - 1, 0x3d, true, false, -1); - } - } - } - } - Main.statusText = "Growing vines..."; - for (int num262 = 0; num262 < Main.maxTilesX; num262++) - { - int num263 = 0; - for (int num264 = 0; num264 < Main.worldSurface; num264++) - { - if ((num263 > 0) && !Main.tile[num262, num264].active) - { - Main.tile[num262, num264].active = true; - Main.tile[num262, num264].type = 0x34; - num263--; - } - else - { - num263 = 0; - } - if ((Main.tile[num262, num264].active && (Main.tile[num262, num264].type == 2)) && (genRand.Next(5) < 3)) - { - num263 = genRand.Next(1, 10); - } - } - num263 = 0; - for (int num265 = (int) Main.worldSurface; num265 < Main.maxTilesY; num265++) - { - if ((num263 > 0) && !Main.tile[num262, num265].active) - { - Main.tile[num262, num265].active = true; - Main.tile[num262, num265].type = 0x3e; - num263--; - } - else - { - num263 = 0; - } - if ((Main.tile[num262, num265].active && (Main.tile[num262, num265].type == 60)) && (genRand.Next(5) < 3)) - { - num263 = genRand.Next(1, 10); - } - } - } - Main.statusText = "Planting flowers..."; - for (int num266 = 0; num266 < (Main.maxTilesX * 0.005); num266++) - { - int num267 = genRand.Next(20, Main.maxTilesX - 20); - int num268 = genRand.Next(5, 15); - int num269 = genRand.Next(15, 30); - for (int num270 = 1; num270 < (Main.worldSurface - 1.0); num270++) - { - if (Main.tile[num267, num270].active) - { - for (int num271 = num267 - num268; num271 < (num267 + num268); num271++) - { - for (int num272 = num270 - num269; num272 < (num270 + num269); num272++) - { - if ((Main.tile[num271, num272].type == 3) || (Main.tile[num271, num272].type == 0x18)) - { - Main.tile[num271, num272].frameX = (short) (genRand.Next(6, 8) * 0x12); - } - } - } - break; - } - } - } - Main.statusText = "Planting mushrooms..."; - for (int num273 = 0; num273 < (Main.maxTilesX * 0.002); num273++) - { - int num274 = genRand.Next(20, Main.maxTilesX - 20); - int num275 = genRand.Next(4, 10); - int num276 = genRand.Next(15, 30); - for (int num277 = 1; num277 < (Main.worldSurface - 1.0); num277++) - { - if (Main.tile[num274, num277].active) - { - for (int num278 = num274 - num275; num278 < (num274 + num275); num278++) - { - for (int num279 = num277 - num276; num279 < (num277 + num276); num279++) - { - if ((Main.tile[num278, num279].type == 3) || (Main.tile[num278, num279].type == 0x18)) - { - Main.tile[num278, num279].frameX = 0x90; - } - } - } - break; - } - } - } - gen = false; - } - - public static void GrowEpicTree(int i, int y) - { - int num2; - int num = y; - while (Main.tile[i, num].type == 20) - { - num++; - } - if ((((!Main.tile[i, num].active || (Main.tile[i, num].type != 2)) || ((Main.tile[i, num - 1].wall != 0) || (Main.tile[i, num - 1].liquid != 0))) || ((!Main.tile[i - 1, num].active || (Main.tile[i - 1, num].type != 2)) || (!Main.tile[i + 1, num].active || (Main.tile[i + 1, num].type != 2)))) || !EmptyTileCheck(i - 2, i + 2, num - 0x37, num - 1, 20)) - { - return; - } - bool flag = false; - bool flag2 = false; - int num4 = genRand.Next(20, 30); - for (int j = num - num4; j < num; j++) - { - Main.tile[i, j].frameNumber = (byte) genRand.Next(3); - Main.tile[i, j].active = true; - Main.tile[i, j].type = 5; - num2 = genRand.Next(3); - int num3 = genRand.Next(10); - if ((j == (num - 1)) || (j == (num - num4))) - { - num3 = 0; - } - while ((((num3 == 5) || (num3 == 7)) && flag) || (((num3 == 6) || (num3 == 7)) && flag2)) - { - num3 = genRand.Next(10); - } - flag = false; - flag2 = false; - if ((num3 == 5) || (num3 == 7)) - { - flag = true; - } - if ((num3 == 6) || (num3 == 7)) - { - flag2 = true; - } - if (num3 == 1) - { - switch (num2) - { - case 0: - Main.tile[i, j].frameX = 0; - Main.tile[i, j].frameY = 0x42; - break; - - case 1: - Main.tile[i, j].frameX = 0; - Main.tile[i, j].frameY = 0x58; - break; - - case 2: - Main.tile[i, j].frameX = 0; - Main.tile[i, j].frameY = 110; - break; - } - } - else if (num3 == 2) - { - switch (num2) - { - case 0: - Main.tile[i, j].frameX = 0x16; - Main.tile[i, j].frameY = 0; - break; - - case 1: - Main.tile[i, j].frameX = 0x16; - Main.tile[i, j].frameY = 0x16; - break; - - case 2: - Main.tile[i, j].frameX = 0x16; - Main.tile[i, j].frameY = 0x2c; - break; - } - } - else if (num3 == 3) - { - switch (num2) - { - case 0: - Main.tile[i, j].frameX = 0x2c; - Main.tile[i, j].frameY = 0x42; - break; - - case 1: - Main.tile[i, j].frameX = 0x2c; - Main.tile[i, j].frameY = 0x58; - break; - - case 2: - Main.tile[i, j].frameX = 0x2c; - Main.tile[i, j].frameY = 110; - break; - } - } - else if (num3 == 4) - { - switch (num2) - { - case 0: - Main.tile[i, j].frameX = 0x16; - Main.tile[i, j].frameY = 0x42; - break; - - case 1: - Main.tile[i, j].frameX = 0x16; - Main.tile[i, j].frameY = 0x58; - break; - - case 2: - Main.tile[i, j].frameX = 0x16; - Main.tile[i, j].frameY = 110; - break; - } - } - else if (num3 == 5) - { - switch (num2) - { - case 0: - Main.tile[i, j].frameX = 0x58; - Main.tile[i, j].frameY = 0; - break; - - case 1: - Main.tile[i, j].frameX = 0x58; - Main.tile[i, j].frameY = 0x16; - break; - - case 2: - Main.tile[i, j].frameX = 0x58; - Main.tile[i, j].frameY = 0x2c; - break; - } - } - else if (num3 == 6) - { - switch (num2) - { - case 0: - Main.tile[i, j].frameX = 0x42; - Main.tile[i, j].frameY = 0x42; - break; - - case 1: - Main.tile[i, j].frameX = 0x42; - Main.tile[i, j].frameY = 0x58; - break; - - case 2: - Main.tile[i, j].frameX = 0x42; - Main.tile[i, j].frameY = 110; - break; - } - } - else if (num3 == 7) - { - switch (num2) - { - case 0: - Main.tile[i, j].frameX = 110; - Main.tile[i, j].frameY = 0x42; - break; - - case 1: - Main.tile[i, j].frameX = 110; - Main.tile[i, j].frameY = 0x58; - break; - - case 2: - Main.tile[i, j].frameX = 110; - Main.tile[i, j].frameY = 110; - break; - } - } - else - { - switch (num2) - { - case 0: - Main.tile[i, j].frameX = 0; - Main.tile[i, j].frameY = 0; - break; - - case 1: - Main.tile[i, j].frameX = 0; - Main.tile[i, j].frameY = 0x16; - break; - - case 2: - Main.tile[i, j].frameX = 0; - Main.tile[i, j].frameY = 0x2c; - break; - } - } - if ((num3 == 5) || (num3 == 7)) - { - Main.tile[i - 1, j].active = true; - Main.tile[i - 1, j].type = 5; - num2 = genRand.Next(3); - if (genRand.Next(3) < 2) - { - switch (num2) - { - case 0: - Main.tile[i - 1, j].frameX = 0x2c; - Main.tile[i - 1, j].frameY = 0xc6; - break; - - case 1: - Main.tile[i - 1, j].frameX = 0x2c; - Main.tile[i - 1, j].frameY = 220; - break; - - case 2: - Main.tile[i - 1, j].frameX = 0x2c; - Main.tile[i - 1, j].frameY = 0xf2; - break; - } - } - else - { - switch (num2) - { - case 0: - Main.tile[i - 1, j].frameX = 0x42; - Main.tile[i - 1, j].frameY = 0; - break; - - case 1: - Main.tile[i - 1, j].frameX = 0x42; - Main.tile[i - 1, j].frameY = 0x16; - break; - - case 2: - Main.tile[i - 1, j].frameX = 0x42; - Main.tile[i - 1, j].frameY = 0x2c; - break; - } - } - } - if ((num3 == 6) || (num3 == 7)) - { - Main.tile[i + 1, j].active = true; - Main.tile[i + 1, j].type = 5; - num2 = genRand.Next(3); - if (genRand.Next(3) < 2) - { - switch (num2) - { - case 0: - Main.tile[i + 1, j].frameX = 0x42; - Main.tile[i + 1, j].frameY = 0xc6; - break; - - case 1: - Main.tile[i + 1, j].frameX = 0x42; - Main.tile[i + 1, j].frameY = 220; - break; - - case 2: - Main.tile[i + 1, j].frameX = 0x42; - Main.tile[i + 1, j].frameY = 0xf2; - break; - } - } - else - { - switch (num2) - { - case 0: - Main.tile[i + 1, j].frameX = 0x58; - Main.tile[i + 1, j].frameY = 0x42; - break; - - case 1: - Main.tile[i + 1, j].frameX = 0x58; - Main.tile[i + 1, j].frameY = 0x58; - break; - - case 2: - Main.tile[i + 1, j].frameX = 0x58; - Main.tile[i + 1, j].frameY = 110; - break; - } - } - } - } - int num6 = genRand.Next(3); - if ((num6 == 0) || (num6 == 1)) - { - Main.tile[i + 1, num - 1].active = true; - Main.tile[i + 1, num - 1].type = 5; - switch (genRand.Next(3)) - { - case 0: - Main.tile[i + 1, num - 1].frameX = 0x16; - Main.tile[i + 1, num - 1].frameY = 0x84; - break; - - case 1: - Main.tile[i + 1, num - 1].frameX = 0x16; - Main.tile[i + 1, num - 1].frameY = 0x9a; - break; - - case 2: - Main.tile[i + 1, num - 1].frameX = 0x16; - Main.tile[i + 1, num - 1].frameY = 0xb0; - goto Label_0A36; - } - } - Label_0A36: - if ((num6 == 0) || (num6 == 2)) - { - Main.tile[i - 1, num - 1].active = true; - Main.tile[i - 1, num - 1].type = 5; - switch (genRand.Next(3)) - { - case 0: - Main.tile[i - 1, num - 1].frameX = 0x2c; - Main.tile[i - 1, num - 1].frameY = 0x84; - break; - - case 1: - Main.tile[i - 1, num - 1].frameX = 0x2c; - Main.tile[i - 1, num - 1].frameY = 0x9a; - break; - - case 2: - Main.tile[i - 1, num - 1].frameX = 0x2c; - Main.tile[i - 1, num - 1].frameY = 0xb0; - break; - } - } - num2 = genRand.Next(3); - if (num6 == 0) - { - switch (num2) - { - case 0: - Main.tile[i, num - 1].frameX = 0x58; - Main.tile[i, num - 1].frameY = 0x84; - break; - - case 1: - Main.tile[i, num - 1].frameX = 0x58; - Main.tile[i, num - 1].frameY = 0x9a; - break; - - case 2: - Main.tile[i, num - 1].frameX = 0x58; - Main.tile[i, num - 1].frameY = 0xb0; - break; - } - } - else if (num6 == 1) - { - switch (num2) - { - case 0: - Main.tile[i, num - 1].frameX = 0; - Main.tile[i, num - 1].frameY = 0x84; - break; - - case 1: - Main.tile[i, num - 1].frameX = 0; - Main.tile[i, num - 1].frameY = 0x9a; - break; - - case 2: - Main.tile[i, num - 1].frameX = 0; - Main.tile[i, num - 1].frameY = 0xb0; - break; - } - } - else if (num6 == 2) - { - switch (num2) - { - case 0: - Main.tile[i, num - 1].frameX = 0x42; - Main.tile[i, num - 1].frameY = 0x84; - break; - - case 1: - Main.tile[i, num - 1].frameX = 0x42; - Main.tile[i, num - 1].frameY = 0x9a; - break; - - case 2: - Main.tile[i, num - 1].frameX = 0x42; - Main.tile[i, num - 1].frameY = 0xb0; - break; - } - } - if (genRand.Next(3) < 2) - { - switch (genRand.Next(3)) - { - case 0: - Main.tile[i, num - num4].frameX = 0x16; - Main.tile[i, num - num4].frameY = 0xc6; - break; - - case 1: - Main.tile[i, num - num4].frameX = 0x16; - Main.tile[i, num - num4].frameY = 220; - break; - - case 2: - Main.tile[i, num - num4].frameX = 0x16; - Main.tile[i, num - num4].frameY = 0xf2; - break; - } - } - else - { - switch (genRand.Next(3)) - { - case 0: - Main.tile[i, num - num4].frameX = 0; - Main.tile[i, num - num4].frameY = 0xc6; - break; - - case 1: - Main.tile[i, num - num4].frameX = 0; - Main.tile[i, num - num4].frameY = 220; - break; - - case 2: - Main.tile[i, num - num4].frameX = 0; - Main.tile[i, num - num4].frameY = 0xf2; - break; - } - } - RangeFrame(i - 2, (num - num4) - 1, i + 2, num + 1); - if (Main.netMode == 2) - { - NetMessage.SendTileSquare(-1, i, num - ((int) (num4 * 0.5)), num4 + 1); - } - } - - public static void GrowShroom(int i, int y) - { - int num = y; - if (((!Main.tile[i - 1, num - 1].lava && !Main.tile[i - 1, num - 1].lava) && !Main.tile[i + 1, num - 1].lava) && (((Main.tile[i, num].active && (Main.tile[i, num].type == 70)) && ((Main.tile[i, num - 1].wall == 0) && Main.tile[i - 1, num].active)) && (((Main.tile[i - 1, num].type == 70) && Main.tile[i + 1, num].active) && ((Main.tile[i + 1, num].type == 70) && EmptyTileCheck(i - 2, i + 2, num - 13, num - 1, 0x47))))) - { - int num3 = genRand.Next(4, 11); - for (int j = num - num3; j < num; j++) - { - Main.tile[i, j].frameNumber = (byte) genRand.Next(3); - Main.tile[i, j].active = true; - Main.tile[i, j].type = 0x48; - switch (genRand.Next(3)) - { - case 0: - Main.tile[i, j].frameX = 0; - Main.tile[i, j].frameY = 0; - break; - - case 1: - Main.tile[i, j].frameX = 0; - Main.tile[i, j].frameY = 0x12; - break; - - case 2: - Main.tile[i, j].frameX = 0; - Main.tile[i, j].frameY = 0x24; - break; - } - } - switch (genRand.Next(3)) - { - case 0: - Main.tile[i, num - num3].frameX = 0x24; - Main.tile[i, num - num3].frameY = 0; - break; - - case 1: - Main.tile[i, num - num3].frameX = 0x24; - Main.tile[i, num - num3].frameY = 0x12; - break; - - case 2: - Main.tile[i, num - num3].frameX = 0x24; - Main.tile[i, num - num3].frameY = 0x24; - break; - } - RangeFrame(i - 2, (num - num3) - 1, i + 2, num + 1); - if (Main.netMode == 2) - { - NetMessage.SendTileSquare(-1, i, num - ((int) (num3 * 0.5)), num3 + 1); - } - } - } - - public static void GrowTree(int i, int y) - { - int num2; - int num = y; - while (Main.tile[i, num].type == 20) - { - num++; - } - if (((Main.tile[i - 1, num - 1].liquid != 0) || (Main.tile[i - 1, num - 1].liquid != 0)) || (Main.tile[i + 1, num - 1].liquid != 0)) - { - return; - } - if (((!Main.tile[i, num].active || (Main.tile[i, num].type != 2)) || ((Main.tile[i, num - 1].wall != 0) || !Main.tile[i - 1, num].active)) || (((Main.tile[i - 1, num].type != 2) || !Main.tile[i + 1, num].active) || ((Main.tile[i + 1, num].type != 2) || !EmptyTileCheck(i - 2, i + 2, num - 14, num - 1, 20)))) - { - return; - } - bool flag = false; - bool flag2 = false; - int num4 = genRand.Next(5, 15); - for (int j = num - num4; j < num; j++) - { - Main.tile[i, j].frameNumber = (byte) genRand.Next(3); - Main.tile[i, j].active = true; - Main.tile[i, j].type = 5; - num2 = genRand.Next(3); - int num3 = genRand.Next(10); - if ((j == (num - 1)) || (j == (num - num4))) - { - num3 = 0; - } - while ((((num3 == 5) || (num3 == 7)) && flag) || (((num3 == 6) || (num3 == 7)) && flag2)) - { - num3 = genRand.Next(10); - } - flag = false; - flag2 = false; - if ((num3 == 5) || (num3 == 7)) - { - flag = true; - } - if ((num3 == 6) || (num3 == 7)) - { - flag2 = true; - } - if (num3 == 1) - { - switch (num2) - { - case 0: - Main.tile[i, j].frameX = 0; - Main.tile[i, j].frameY = 0x42; - break; - - case 1: - Main.tile[i, j].frameX = 0; - Main.tile[i, j].frameY = 0x58; - break; - - case 2: - Main.tile[i, j].frameX = 0; - Main.tile[i, j].frameY = 110; - break; - } - } - else if (num3 == 2) - { - switch (num2) - { - case 0: - Main.tile[i, j].frameX = 0x16; - Main.tile[i, j].frameY = 0; - break; - - case 1: - Main.tile[i, j].frameX = 0x16; - Main.tile[i, j].frameY = 0x16; - break; - - case 2: - Main.tile[i, j].frameX = 0x16; - Main.tile[i, j].frameY = 0x2c; - break; - } - } - else if (num3 == 3) - { - switch (num2) - { - case 0: - Main.tile[i, j].frameX = 0x2c; - Main.tile[i, j].frameY = 0x42; - break; - - case 1: - Main.tile[i, j].frameX = 0x2c; - Main.tile[i, j].frameY = 0x58; - break; - - case 2: - Main.tile[i, j].frameX = 0x2c; - Main.tile[i, j].frameY = 110; - break; - } - } - else if (num3 == 4) - { - switch (num2) - { - case 0: - Main.tile[i, j].frameX = 0x16; - Main.tile[i, j].frameY = 0x42; - break; - - case 1: - Main.tile[i, j].frameX = 0x16; - Main.tile[i, j].frameY = 0x58; - break; - - case 2: - Main.tile[i, j].frameX = 0x16; - Main.tile[i, j].frameY = 110; - break; - } - } - else if (num3 == 5) - { - switch (num2) - { - case 0: - Main.tile[i, j].frameX = 0x58; - Main.tile[i, j].frameY = 0; - break; - - case 1: - Main.tile[i, j].frameX = 0x58; - Main.tile[i, j].frameY = 0x16; - break; - - case 2: - Main.tile[i, j].frameX = 0x58; - Main.tile[i, j].frameY = 0x2c; - break; - } - } - else if (num3 == 6) - { - switch (num2) - { - case 0: - Main.tile[i, j].frameX = 0x42; - Main.tile[i, j].frameY = 0x42; - break; - - case 1: - Main.tile[i, j].frameX = 0x42; - Main.tile[i, j].frameY = 0x58; - break; - - case 2: - Main.tile[i, j].frameX = 0x42; - Main.tile[i, j].frameY = 110; - break; - } - } - else if (num3 == 7) - { - switch (num2) - { - case 0: - Main.tile[i, j].frameX = 110; - Main.tile[i, j].frameY = 0x42; - break; - - case 1: - Main.tile[i, j].frameX = 110; - Main.tile[i, j].frameY = 0x58; - break; - - case 2: - Main.tile[i, j].frameX = 110; - Main.tile[i, j].frameY = 110; - break; - } - } - else - { - switch (num2) - { - case 0: - Main.tile[i, j].frameX = 0; - Main.tile[i, j].frameY = 0; - break; - - case 1: - Main.tile[i, j].frameX = 0; - Main.tile[i, j].frameY = 0x16; - break; - - case 2: - Main.tile[i, j].frameX = 0; - Main.tile[i, j].frameY = 0x2c; - break; - } - } - if ((num3 == 5) || (num3 == 7)) - { - Main.tile[i - 1, j].active = true; - Main.tile[i - 1, j].type = 5; - num2 = genRand.Next(3); - if (genRand.Next(3) < 2) - { - switch (num2) - { - case 0: - Main.tile[i - 1, j].frameX = 0x2c; - Main.tile[i - 1, j].frameY = 0xc6; - break; - - case 1: - Main.tile[i - 1, j].frameX = 0x2c; - Main.tile[i - 1, j].frameY = 220; - break; - - case 2: - Main.tile[i - 1, j].frameX = 0x2c; - Main.tile[i - 1, j].frameY = 0xf2; - break; - } - } - else - { - switch (num2) - { - case 0: - Main.tile[i - 1, j].frameX = 0x42; - Main.tile[i - 1, j].frameY = 0; - break; - - case 1: - Main.tile[i - 1, j].frameX = 0x42; - Main.tile[i - 1, j].frameY = 0x16; - break; - - case 2: - Main.tile[i - 1, j].frameX = 0x42; - Main.tile[i - 1, j].frameY = 0x2c; - break; - } - } - } - if ((num3 == 6) || (num3 == 7)) - { - Main.tile[i + 1, j].active = true; - Main.tile[i + 1, j].type = 5; - num2 = genRand.Next(3); - if (genRand.Next(3) < 2) - { - switch (num2) - { - case 0: - Main.tile[i + 1, j].frameX = 0x42; - Main.tile[i + 1, j].frameY = 0xc6; - break; - - case 1: - Main.tile[i + 1, j].frameX = 0x42; - Main.tile[i + 1, j].frameY = 220; - break; - - case 2: - Main.tile[i + 1, j].frameX = 0x42; - Main.tile[i + 1, j].frameY = 0xf2; - break; - } - } - else - { - switch (num2) - { - case 0: - Main.tile[i + 1, j].frameX = 0x58; - Main.tile[i + 1, j].frameY = 0x42; - break; - - case 1: - Main.tile[i + 1, j].frameX = 0x58; - Main.tile[i + 1, j].frameY = 0x58; - break; - - case 2: - Main.tile[i + 1, j].frameX = 0x58; - Main.tile[i + 1, j].frameY = 110; - break; - } - } - } - } - int num6 = genRand.Next(3); - if ((num6 == 0) || (num6 == 1)) - { - Main.tile[i + 1, num - 1].active = true; - Main.tile[i + 1, num - 1].type = 5; - switch (genRand.Next(3)) - { - case 0: - Main.tile[i + 1, num - 1].frameX = 0x16; - Main.tile[i + 1, num - 1].frameY = 0x84; - break; - - case 1: - Main.tile[i + 1, num - 1].frameX = 0x16; - Main.tile[i + 1, num - 1].frameY = 0x9a; - break; - - case 2: - Main.tile[i + 1, num - 1].frameX = 0x16; - Main.tile[i + 1, num - 1].frameY = 0xb0; - goto Label_0A63; - } - } - Label_0A63: - if ((num6 == 0) || (num6 == 2)) - { - Main.tile[i - 1, num - 1].active = true; - Main.tile[i - 1, num - 1].type = 5; - switch (genRand.Next(3)) - { - case 0: - Main.tile[i - 1, num - 1].frameX = 0x2c; - Main.tile[i - 1, num - 1].frameY = 0x84; - break; - - case 1: - Main.tile[i - 1, num - 1].frameX = 0x2c; - Main.tile[i - 1, num - 1].frameY = 0x9a; - break; - - case 2: - Main.tile[i - 1, num - 1].frameX = 0x2c; - Main.tile[i - 1, num - 1].frameY = 0xb0; - break; - } - } - num2 = genRand.Next(3); - if (num6 == 0) - { - switch (num2) - { - case 0: - Main.tile[i, num - 1].frameX = 0x58; - Main.tile[i, num - 1].frameY = 0x84; - break; - - case 1: - Main.tile[i, num - 1].frameX = 0x58; - Main.tile[i, num - 1].frameY = 0x9a; - break; - - case 2: - Main.tile[i, num - 1].frameX = 0x58; - Main.tile[i, num - 1].frameY = 0xb0; - break; - } - } - else if (num6 == 1) - { - switch (num2) - { - case 0: - Main.tile[i, num - 1].frameX = 0; - Main.tile[i, num - 1].frameY = 0x84; - break; - - case 1: - Main.tile[i, num - 1].frameX = 0; - Main.tile[i, num - 1].frameY = 0x9a; - break; - - case 2: - Main.tile[i, num - 1].frameX = 0; - Main.tile[i, num - 1].frameY = 0xb0; - break; - } - } - else if (num6 == 2) - { - switch (num2) - { - case 0: - Main.tile[i, num - 1].frameX = 0x42; - Main.tile[i, num - 1].frameY = 0x84; - break; - - case 1: - Main.tile[i, num - 1].frameX = 0x42; - Main.tile[i, num - 1].frameY = 0x9a; - break; - - case 2: - Main.tile[i, num - 1].frameX = 0x42; - Main.tile[i, num - 1].frameY = 0xb0; - break; - } - } - if (genRand.Next(3) < 2) - { - switch (genRand.Next(3)) - { - case 0: - Main.tile[i, num - num4].frameX = 0x16; - Main.tile[i, num - num4].frameY = 0xc6; - break; - - case 1: - Main.tile[i, num - num4].frameX = 0x16; - Main.tile[i, num - num4].frameY = 220; - break; - - case 2: - Main.tile[i, num - num4].frameX = 0x16; - Main.tile[i, num - num4].frameY = 0xf2; - break; - } - } - else - { - switch (genRand.Next(3)) - { - case 0: - Main.tile[i, num - num4].frameX = 0; - Main.tile[i, num - num4].frameY = 0xc6; - break; - - case 1: - Main.tile[i, num - num4].frameX = 0; - Main.tile[i, num - num4].frameY = 220; - break; - - case 2: - Main.tile[i, num - num4].frameX = 0; - Main.tile[i, num - num4].frameY = 0xf2; - break; - } - } - RangeFrame(i - 2, (num - num4) - 1, i + 2, num + 1); - if (Main.netMode == 2) - { - NetMessage.SendTileSquare(-1, i, num - ((int) (num4 * 0.5)), num4 + 1); - } - } - - public static void HellHouse(int i, int j) - { - int width = genRand.Next(8, 20); - int num2 = genRand.Next(3); - int num3 = genRand.Next(7); - int num4 = i; - int num5 = j; - for (int k = 0; k < num2; k++) - { - int height = genRand.Next(5, 9); - HellRoom(num4, num5, width, height); - num5 -= height; - } - num5 = j; - for (int m = 0; m < num3; m++) - { - int num9 = genRand.Next(5, 9); - num5 += num9; - HellRoom(num4, num5, width, num9); - } - for (int n = i - (width / 2); n <= (i + (width / 2)); n++) - { - num5 = j; - while ((num5 < Main.maxTilesY) && ((Main.tile[n, num5].active && (Main.tile[n, num5].type == 0x4c)) || (Main.tile[n, num5].wall == 13))) - { - num5++; - } - int num11 = 6 + genRand.Next(3); - while ((num5 < Main.maxTilesY) && !Main.tile[n, num5].active) - { - num11--; - Main.tile[n, num5].active = true; - Main.tile[n, num5].type = 0x39; - num5++; - if (num11 <= 0) - { - break; - } - } - } - int minValue = 0; - int maxValue = 0; - num5 = j; - while ((num5 < Main.maxTilesY) && ((Main.tile[i, num5].active && (Main.tile[i, num5].type == 0x4c)) || (Main.tile[i, num5].wall == 13))) - { - num5++; - } - num5--; - maxValue = num5; - while ((Main.tile[i, num5].active && (Main.tile[i, num5].type == 0x4c)) || (Main.tile[i, num5].wall == 13)) - { - num5--; - if (Main.tile[i, num5].active && (Main.tile[i, num5].type == 0x4c)) - { - int num14 = genRand.Next((i - (width / 2)) + 1, (i + (width / 2)) - 1); - int num15 = genRand.Next((i - (width / 2)) + 1, (i + (width / 2)) - 1); - if (num14 > num15) - { - int num16 = num14; - num14 = num15; - num15 = num16; - } - if (num14 == num15) - { - if (num14 < i) - { - num15++; - } - else - { - num14--; - } - } - for (int num17 = num14; num17 <= num15; num17++) - { - if (Main.tile[num17, num5 - 1].wall == 13) - { - Main.tile[num17, num5].wall = 13; - } - Main.tile[num17, num5].type = 0x13; - Main.tile[num17, num5].active = true; - } - num5--; - } - } - minValue = num5; - float num18 = (maxValue - minValue) * width; - float num19 = num18 * 0.02f; - for (int num20 = 0; num20 < num19; num20++) - { - int num21 = genRand.Next(i - (width / 2), (i + (width / 2)) + 1); - int num22 = genRand.Next(minValue, maxValue); - int num23 = genRand.Next(3, 8); - for (int num24 = num21 - num23; num24 <= (num21 + num23); num24++) - { - for (int num25 = num22 - num23; num25 <= (num22 + num23); num25++) - { - float num26 = Math.Abs((int) (num24 - num21)); - float num27 = Math.Abs((int) (num25 - num22)); - if (Math.Sqrt((double) ((num26 * num26) + (num27 * num27))) < (num23 * 0.4)) - { - if ((Main.tile[num24, num25].type == 0x4c) || (Main.tile[num24, num25].type == 0x13)) - { - Main.tile[num24, num25].active = false; - } - Main.tile[num24, num25].wall = 0; - } - } - } - } - } - - public static void HellRoom(int i, int j, int width, int height) - { - for (int k = i - (width / 2); k <= (i + (width / 2)); k++) - { - for (int n = j - height; n <= j; n++) - { - Main.tile[k, n].active = true; - Main.tile[k, n].type = 0x4c; - Main.tile[k, n].liquid = 0; - Main.tile[k, n].lava = false; - } - } - for (int m = (i - (width / 2)) + 1; m <= ((i + (width / 2)) - 1); m++) - { - for (int num4 = (j - height) + 1; num4 <= (j - 1); num4++) - { - Main.tile[m, num4].active = false; - Main.tile[m, num4].wall = 13; - Main.tile[m, num4].liquid = 0; - Main.tile[m, num4].lava = false; - } - } - } - - public static void IslandHouse(int i, int j) - { - byte num = (byte) genRand.Next(0x2d, 0x30); - byte num2 = (byte) genRand.Next(10, 13); - Vector2 vector = new Vector2((float) i, (float) j); - int num7 = 1; - if (genRand.Next(2) == 0) - { - num7 = -1; - } - int num8 = genRand.Next(7, 12); - int num9 = genRand.Next(5, 7); - vector.X = i + ((num8 + 2) * num7); - for (int k = j - 15; k < (j + 30); k++) - { - if (Main.tile[(int) vector.X, k].active) - { - vector.Y = k - 1; - break; - } - } - vector.X = i; - int num3 = (int) ((vector.X - num8) - 2f); - int maxTilesX = (int) ((vector.X + num8) + 2f); - int num4 = (int) ((vector.Y - num9) - 2f); - int maxTilesY = ((int) (vector.Y + 2f)) + genRand.Next(3, 5); - if (num3 < 0) - { - num3 = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num4 < 0) - { - num4 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int m = num3; m <= maxTilesX; m++) - { - for (int num12 = num4; num12 < maxTilesY; num12++) - { - Main.tile[m, num12].active = true; - Main.tile[m, num12].type = num; - Main.tile[m, num12].wall = 0; - } - } - num3 = ((int) vector.X) - num8; - maxTilesX = ((int) vector.X) + num8; - num4 = ((int) vector.Y) - num9; - maxTilesY = (int) (vector.Y + 1f); - if (num3 < 0) - { - num3 = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num4 < 0) - { - num4 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int n = num3; n <= maxTilesX; n++) - { - for (int num14 = num4; num14 < maxTilesY; num14++) - { - if (Main.tile[n, num14].wall == 0) - { - Main.tile[n, num14].active = false; - Main.tile[n, num14].wall = num2; - } - } - } - int num15 = i + ((num8 + 1) * num7); - int y = (int) vector.Y; - for (int num17 = num15 - 2; num17 <= (num15 + 2); num17++) - { - Main.tile[num17, y].active = false; - Main.tile[num17, y - 1].active = false; - Main.tile[num17, y - 2].active = false; - } - PlaceTile(num15, y, 10, true, false, -1); - int contain = 0; - int houseCount = WorldGen.houseCount; - if (houseCount > 2) - { - houseCount = genRand.Next(3); - } - switch (houseCount) - { - case 0: - contain = 0x9f; - break; - - case 1: - contain = 0x41; - break; - - case 2: - contain = 0x9e; - break; - } - AddBuriedChest(i, y - 3, contain); - WorldGen.houseCount++; - } - - public static void KillTile(int i, int j, bool fail = false, bool effectOnly = false, bool noItem = false) - { - if (((i >= 0) && (j >= 0)) && ((i < Main.maxTilesX) && (j < Main.maxTilesY))) - { - if (Main.tile[i, j] == null) - { - Main.tile[i, j] = new Tile(); - } - if (Main.tile[i, j].active) - { - if ((j >= 1) && (Main.tile[i, j - 1] == null)) - { - Main.tile[i, j - 1] = new Tile(); - } - if ((((j < 1) || !Main.tile[i, j - 1].active) || ((((Main.tile[i, j - 1].type != 5) || (Main.tile[i, j].type == 5)) && ((Main.tile[i, j - 1].type != 0x15) || (Main.tile[i, j].type == 0x15))) && ((((Main.tile[i, j - 1].type != 0x1a) || (Main.tile[i, j].type == 0x1a)) && ((Main.tile[i, j - 1].type != 0x48) || (Main.tile[i, j].type == 0x48))) && ((Main.tile[i, j - 1].type != 12) || (Main.tile[i, j].type == 12))))) || ((Main.tile[i, j - 1].type == 5) && (((((Main.tile[i, j - 1].frameX == 0x42) && (Main.tile[i, j - 1].frameY >= 0)) && (Main.tile[i, j - 1].frameY <= 0x2c)) || (((Main.tile[i, j - 1].frameX == 0x58) && (Main.tile[i, j - 1].frameY >= 0x42)) && (Main.tile[i, j - 1].frameY <= 110))) || (Main.tile[i, j - 1].frameY >= 0xc6)))) - { - if (!effectOnly && !stopDrops) - { - if (Main.tile[i, j].type == 3) - { - Main.PlaySound(6, i * 0x10, j * 0x10, 1); - if (Main.tile[i, j].frameX == 0x90) - { - Item.NewItem(i * 0x10, j * 0x10, 0x10, 0x10, 5, 1, false); - } - } - else if (Main.tile[i, j].type == 0x18) - { - Main.PlaySound(6, i * 0x10, j * 0x10, 1); - if (Main.tile[i, j].frameX == 0x90) - { - Item.NewItem(i * 0x10, j * 0x10, 0x10, 0x10, 60, 1, false); - } - } - else if ((((Main.tile[i, j].type == 0x20) || (Main.tile[i, j].type == 0x33)) || ((Main.tile[i, j].type == 0x34) || (Main.tile[i, j].type == 0x3d))) || (((Main.tile[i, j].type == 0x3e) || (Main.tile[i, j].type == 0x45)) || (((Main.tile[i, j].type == 0x47) || (Main.tile[i, j].type == 0x49)) || (Main.tile[i, j].type == 0x4a)))) - { - Main.PlaySound(6, i * 0x10, j * 0x10, 1); - } - else if ((((((Main.tile[i, j].type == 1) || (Main.tile[i, j].type == 6)) || ((Main.tile[i, j].type == 7) || (Main.tile[i, j].type == 8))) || (((Main.tile[i, j].type == 9) || (Main.tile[i, j].type == 0x16)) || ((Main.tile[i, j].type == 0x19) || (Main.tile[i, j].type == 0x25)))) || ((((Main.tile[i, j].type == 0x26) || (Main.tile[i, j].type == 0x27)) || ((Main.tile[i, j].type == 0x29) || (Main.tile[i, j].type == 0x2b))) || (((Main.tile[i, j].type == 0x2c) || (Main.tile[i, j].type == 0x2d)) || ((Main.tile[i, j].type == 0x2e) || (Main.tile[i, j].type == 0x2f))))) || ((((Main.tile[i, j].type == 0x30) || (Main.tile[i, j].type == 0x38)) || ((Main.tile[i, j].type == 0x3a) || (Main.tile[i, j].type == 0x3f))) || ((((Main.tile[i, j].type == 0x40) || (Main.tile[i, j].type == 0x41)) || ((Main.tile[i, j].type == 0x42) || (Main.tile[i, j].type == 0x43))) || (((Main.tile[i, j].type == 0x44) || (Main.tile[i, j].type == 0x4b)) || (Main.tile[i, j].type == 0x4c))))) - { - Main.PlaySound(0x15, i * 0x10, j * 0x10, 1); - } - else - { - Main.PlaySound(0, i * 0x10, j * 0x10, 1); - } - } - int num = 10; - if (fail) - { - num = 3; - } - for (int k = 0; k < num; k++) - { - int type = 0; - if (Main.tile[i, j].type == 0) - { - type = 0; - } - if ((((Main.tile[i, j].type == 1) || (Main.tile[i, j].type == 0x10)) || ((Main.tile[i, j].type == 0x11) || (Main.tile[i, j].type == 0x26))) || ((((Main.tile[i, j].type == 0x27) || (Main.tile[i, j].type == 0x29)) || ((Main.tile[i, j].type == 0x2b) || (Main.tile[i, j].type == 0x2c))) || ((Main.tile[i, j].type == 0x30) || Main.tileStone[Main.tile[i, j].type]))) - { - type = 1; - } - if ((Main.tile[i, j].type == 4) || (Main.tile[i, j].type == 0x21)) - { - type = 6; - } - if ((((Main.tile[i, j].type == 5) || (Main.tile[i, j].type == 10)) || ((Main.tile[i, j].type == 11) || (Main.tile[i, j].type == 14))) || (((Main.tile[i, j].type == 15) || (Main.tile[i, j].type == 0x13)) || ((Main.tile[i, j].type == 0x15) || (Main.tile[i, j].type == 30)))) - { - type = 7; - } - if (Main.tile[i, j].type == 2) - { - if (genRand.Next(2) == 0) - { - type = 0; - } - else - { - type = 2; - } - } - if ((Main.tile[i, j].type == 6) || (Main.tile[i, j].type == 0x1a)) - { - type = 8; - } - if (((Main.tile[i, j].type == 7) || (Main.tile[i, j].type == 0x22)) || (Main.tile[i, j].type == 0x2f)) - { - type = 9; - } - if (((Main.tile[i, j].type == 8) || (Main.tile[i, j].type == 0x24)) || (Main.tile[i, j].type == 0x2d)) - { - type = 10; - } - if (((Main.tile[i, j].type == 9) || (Main.tile[i, j].type == 0x23)) || ((Main.tile[i, j].type == 0x2a) || (Main.tile[i, j].type == 0x2e))) - { - type = 11; - } - if (Main.tile[i, j].type == 12) - { - type = 12; - } - if ((Main.tile[i, j].type == 3) || (Main.tile[i, j].type == 0x49)) - { - type = 3; - } - if ((Main.tile[i, j].type == 13) || (Main.tile[i, j].type == 0x36)) - { - type = 13; - } - if (Main.tile[i, j].type == 0x16) - { - type = 14; - } - if ((Main.tile[i, j].type == 0x1c) || (Main.tile[i, j].type == 0x4e)) - { - type = 0x16; - } - if (Main.tile[i, j].type == 0x1d) - { - type = 0x17; - } - if (Main.tile[i, j].type == 40) - { - type = 0x1c; - } - if (Main.tile[i, j].type == 0x31) - { - type = 0x1d; - } - if (Main.tile[i, j].type == 50) - { - type = 0x16; - } - if (Main.tile[i, j].type == 0x33) - { - type = 30; - } - if (Main.tile[i, j].type == 0x34) - { - type = 3; - } - if (Main.tile[i, j].type == 0x35) - { - type = 0x20; - } - if ((Main.tile[i, j].type == 0x38) || (Main.tile[i, j].type == 0x4b)) - { - type = 0x25; - } - if (Main.tile[i, j].type == 0x39) - { - type = 0x24; - } - if (Main.tile[i, j].type == 0x3b) - { - type = 0x26; - } - if (((Main.tile[i, j].type == 0x3d) || (Main.tile[i, j].type == 0x3e)) || (Main.tile[i, j].type == 0x4a)) - { - type = 40; - } - if (Main.tile[i, j].type == 0x45) - { - type = 7; - } - if ((Main.tile[i, j].type == 0x47) || (Main.tile[i, j].type == 0x48)) - { - type = 0x1a; - } - if (Main.tile[i, j].type == 70) - { - type = 0x11; - } - if (Main.tile[i, j].type == 2) - { - if (genRand.Next(2) == 0) - { - type = 0x26; - } - else - { - type = 0x27; - } - } - if (((Main.tile[i, j].type == 0x3a) || (Main.tile[i, j].type == 0x4c)) || (Main.tile[i, j].type == 0x4d)) - { - if (genRand.Next(2) == 0) - { - type = 6; - } - else - { - type = 0x19; - } - } - if (Main.tile[i, j].type == 0x25) - { - if (genRand.Next(2) == 0) - { - type = 6; - } - else - { - type = 0x17; - } - } - if (Main.tile[i, j].type == 0x20) - { - if (genRand.Next(2) == 0) - { - type = 14; - } - else - { - type = 0x18; - } - } - if ((Main.tile[i, j].type == 0x17) || (Main.tile[i, j].type == 0x18)) - { - if (genRand.Next(2) == 0) - { - type = 14; - } - else - { - type = 0x11; - } - } - if ((Main.tile[i, j].type == 0x19) || (Main.tile[i, j].type == 0x1f)) - { - if (genRand.Next(2) == 0) - { - type = 14; - } - else - { - type = 1; - } - } - if (Main.tile[i, j].type == 20) - { - if (genRand.Next(2) == 0) - { - type = 7; - } - else - { - type = 2; - } - } - if (Main.tile[i, j].type == 0x1b) - { - if (genRand.Next(2) == 0) - { - type = 3; - } - else - { - type = 0x13; - } - } - if ((((Main.tile[i, j].type == 0x22) || (Main.tile[i, j].type == 0x23)) || ((Main.tile[i, j].type == 0x24) || (Main.tile[i, j].type == 0x2a))) && (Main.rand.Next(2) == 0)) - { - type = 6; - } - if (type >= 0) - { - Color newColor = new Color(); - Dust.NewDust(new Vector2((float) (i * 0x10), (float) (j * 0x10)), 0x10, 0x10, type, 0f, 0f, 0, newColor, 1f); - } - } - if (!effectOnly) - { - if (fail) - { - if ((Main.tile[i, j].type == 2) || (Main.tile[i, j].type == 0x17)) - { - Main.tile[i, j].type = 0; - } - if (Main.tile[i, j].type == 60) - { - Main.tile[i, j].type = 0x3b; - } - SquareTileFrame(i, j, true); - } - else - { - if ((Main.tile[i, j].type == 0x15) && (Main.netMode != 1)) - { - int x = i - (Main.tile[i, j].frameX / 0x12); - int y = j - (Main.tile[i, j].frameY / 0x12); - if (!Chest.DestroyChest(x, y)) - { - return; - } - } - if (!noItem && !stopDrops) - { - int num6 = 0; - if ((Main.tile[i, j].type == 0) || (Main.tile[i, j].type == 2)) - { - num6 = 2; - } - else if (Main.tile[i, j].type == 1) - { - num6 = 3; - } - else if (Main.tile[i, j].type == 4) - { - num6 = 8; - } - else if (Main.tile[i, j].type == 5) - { - if ((Main.tile[i, j].frameX >= 0x16) && (Main.tile[i, j].frameY >= 0xc6)) - { - if (genRand.Next(2) == 0) - { - num6 = 0x1b; - } - else - { - num6 = 9; - } - } - else - { - num6 = 9; - } - } - else if (Main.tile[i, j].type == 6) - { - num6 = 11; - } - else if (Main.tile[i, j].type == 7) - { - num6 = 12; - } - else if (Main.tile[i, j].type == 8) - { - num6 = 13; - } - else if (Main.tile[i, j].type == 9) - { - num6 = 14; - } - else if (Main.tile[i, j].type == 13) - { - Main.PlaySound(13, i * 0x10, j * 0x10, 1); - if (Main.tile[i, j].frameX == 0x12) - { - num6 = 0x1c; - } - else if (Main.tile[i, j].frameX == 0x24) - { - num6 = 110; - } - else - { - num6 = 0x1f; - } - } - else if (Main.tile[i, j].type == 0x13) - { - num6 = 0x5e; - } - else if (Main.tile[i, j].type == 0x16) - { - num6 = 0x38; - } - else if (Main.tile[i, j].type == 0x17) - { - num6 = 2; - } - else if (Main.tile[i, j].type == 0x19) - { - num6 = 0x3d; - } - else if (Main.tile[i, j].type == 30) - { - num6 = 9; - } - else if (Main.tile[i, j].type == 0x21) - { - num6 = 0x69; - } - else if (Main.tile[i, j].type == 0x25) - { - num6 = 0x74; - } - else if (Main.tile[i, j].type == 0x26) - { - num6 = 0x81; - } - else if (Main.tile[i, j].type == 0x27) - { - num6 = 0x83; - } - else if (Main.tile[i, j].type == 40) - { - num6 = 0x85; - } - else if (Main.tile[i, j].type == 0x29) - { - num6 = 0x86; - } - else if (Main.tile[i, j].type == 0x2b) - { - num6 = 0x89; - } - else if (Main.tile[i, j].type == 0x2c) - { - num6 = 0x8b; - } - else if (Main.tile[i, j].type == 0x2d) - { - num6 = 0x8d; - } - else if (Main.tile[i, j].type == 0x2e) - { - num6 = 0x8f; - } - else if (Main.tile[i, j].type == 0x2f) - { - num6 = 0x91; - } - else if (Main.tile[i, j].type == 0x30) - { - num6 = 0x93; - } - else if (Main.tile[i, j].type == 0x31) - { - num6 = 0x94; - } - else if (Main.tile[i, j].type == 0x33) - { - num6 = 150; - } - else if (Main.tile[i, j].type == 0x35) - { - num6 = 0xa9; - } - else if (Main.tile[i, j].type == 0x36) - { - Main.PlaySound(13, i * 0x10, j * 0x10, 1); - } - else if (Main.tile[i, j].type == 0x38) - { - num6 = 0xad; - } - else if (Main.tile[i, j].type == 0x39) - { - num6 = 0xac; - } - else if (Main.tile[i, j].type == 0x3a) - { - num6 = 0xae; - } - else if (Main.tile[i, j].type == 60) - { - num6 = 0xb0; - } - else if (Main.tile[i, j].type == 70) - { - num6 = 0xb0; - } - else if (Main.tile[i, j].type == 0x4b) - { - num6 = 0xc0; - } - else if (Main.tile[i, j].type == 0x4c) - { - num6 = 0xd6; - } - else if (Main.tile[i, j].type == 0x4e) - { - num6 = 0xde; - } - else if ((Main.tile[i, j].type == 0x3d) || (Main.tile[i, j].type == 0x4a)) - { - if (Main.tile[i, j].frameX == 0xa2) - { - num6 = 0xdf; - } - else if (((Main.tile[i, j].frameX >= 0x6c) && (Main.tile[i, j].frameX <= 0x7e)) && (genRand.Next(2) == 0)) - { - num6 = 0xd0; - } - } - else if ((Main.tile[i, j].type == 0x3b) || (Main.tile[i, j].type == 60)) - { - num6 = 0xb0; - } - else if ((Main.tile[i, j].type == 0x47) || (Main.tile[i, j].type == 0x48)) - { - if (genRand.Next(50) == 0) - { - num6 = 0xc2; - } - else - { - num6 = 0xb7; - } - } - else if ((Main.tile[i, j].type == 0x4a) && (genRand.Next(100) == 0)) - { - num6 = 0xc3; - } - else if ((Main.tile[i, j].type >= 0x3f) && (Main.tile[i, j].type <= 0x44)) - { - num6 = (Main.tile[i, j].type - 0x3f) + 0xb1; - } - else if (Main.tile[i, j].type == 50) - { - if (Main.tile[i, j].frameX == 90) - { - num6 = 0xa5; - } - else - { - num6 = 0x95; - } - } - if (num6 > 0) - { - Item.NewItem(i * 0x10, j * 0x10, 0x10, 0x10, num6, 1, false); - } - } - Main.tile[i, j].active = false; - if (Main.tileSolid[Main.tile[i, j].type]) - { - Main.tile[i, j].lighted = false; - } - Main.tile[i, j].frameX = -1; - Main.tile[i, j].frameY = -1; - Main.tile[i, j].frameNumber = 0; - Main.tile[i, j].type = 0; - SquareTileFrame(i, j, true); - } - } - } - } - } - } - - public static void KillWall(int i, int j, bool fail = false) - { - if (((i >= 0) && (j >= 0)) && ((i < Main.maxTilesX) && (j < Main.maxTilesY))) - { - if (Main.tile[i, j] == null) - { - Main.tile[i, j] = new Tile(); - } - if (Main.tile[i, j].wall > 0) - { - genRand.Next(3); - Main.PlaySound(0, i * 0x10, j * 0x10, 1); - int num = 10; - if (fail) - { - num = 3; - } - for (int k = 0; k < num; k++) - { - int type = 0; - if ((((Main.tile[i, j].wall == 1) || (Main.tile[i, j].wall == 5)) || ((Main.tile[i, j].wall == 6) || (Main.tile[i, j].wall == 7))) || ((Main.tile[i, j].wall == 8) || (Main.tile[i, j].wall == 9))) - { - type = 1; - } - if (Main.tile[i, j].wall == 3) - { - if (genRand.Next(2) == 0) - { - type = 14; - } - else - { - type = 1; - } - } - if (Main.tile[i, j].wall == 4) - { - type = 7; - } - if (Main.tile[i, j].wall == 12) - { - type = 9; - } - if (Main.tile[i, j].wall == 10) - { - type = 10; - } - if (Main.tile[i, j].wall == 11) - { - type = 11; - } - Color newColor = new Color(); - Dust.NewDust(new Vector2((float) (i * 0x10), (float) (j * 0x10)), 0x10, 0x10, type, 0f, 0f, 0, newColor, 1f); - } - if (fail) - { - SquareWallFrame(i, j, true); - } - else - { - int num4 = 0; - if (Main.tile[i, j].wall == 1) - { - num4 = 0x1a; - } - if (Main.tile[i, j].wall == 4) - { - num4 = 0x5d; - } - if (Main.tile[i, j].wall == 5) - { - num4 = 130; - } - if (Main.tile[i, j].wall == 6) - { - num4 = 0x84; - } - if (Main.tile[i, j].wall == 7) - { - num4 = 0x87; - } - if (Main.tile[i, j].wall == 8) - { - num4 = 0x8a; - } - if (Main.tile[i, j].wall == 9) - { - num4 = 140; - } - if (Main.tile[i, j].wall == 10) - { - num4 = 0x8e; - } - if (Main.tile[i, j].wall == 11) - { - num4 = 0x90; - } - if (Main.tile[i, j].wall == 12) - { - num4 = 0x92; - } - if (num4 > 0) - { - Item.NewItem(i * 0x10, j * 0x10, 0x10, 0x10, num4, 1, false); - } - Main.tile[i, j].wall = 0; - SquareWallFrame(i, j, true); - } - } - } - } - - public static void Lakinater(int i, int j) - { - Vector2 vector; - Vector2 vector2; - double num5 = genRand.Next(0x19, 50); - double num6 = num5; - float num7 = genRand.Next(30, 80); - if (genRand.Next(5) == 0) - { - num5 *= 1.5; - num6 *= 1.5; - num7 *= 1.2f; - } - vector.X = i; - vector.Y = j - (num7 * 0.3f); - vector2.X = genRand.Next(-10, 11) * 0.1f; - vector2.Y = genRand.Next(-20, -10) * 0.1f; - while ((num5 > 0.0) && (num7 > 0f)) - { - if ((vector.Y + (num6 * 0.5)) > Main.worldSurface) - { - num7 = 0f; - } - num5 -= genRand.Next(3); - num7--; - int num = (int) (vector.X - (num5 * 0.5)); - int maxTilesX = (int) (vector.X + (num5 * 0.5)); - int num2 = (int) (vector.Y - (num5 * 0.5)); - int maxTilesY = (int) (vector.Y + (num5 * 0.5)); - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num2 < 0) - { - num2 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - num6 = (num5 * genRand.Next(80, 120)) * 0.01; - for (int k = num; k < maxTilesX; k++) - { - for (int m = num2; m < maxTilesY; m++) - { - float num10 = Math.Abs((float) (k - vector.X)); - float num11 = Math.Abs((float) (m - vector.Y)); - if (Math.Sqrt((double) ((num10 * num10) + (num11 * num11))) < (num6 * 0.4)) - { - if (Main.tile[k, m].active) - { - Main.tile[k, m].liquid = 0xff; - } - Main.tile[k, m].active = false; - } - } - } - vector += vector2; - vector2.X += genRand.Next(-10, 11) * 0.05f; - vector2.Y += genRand.Next(-10, 11) * 0.05f; - if (vector2.X > 0.5) - { - vector2.X = 0.5f; - } - if (vector2.X < -0.5) - { - vector2.X = -0.5f; - } - if (vector2.Y > 1.5) - { - vector2.Y = 1.5f; - } - if (vector2.Y < 0.5) - { - vector2.Y = 0.5f; - } - } - } - - public static void loadWorld() - { - if (genRand == null) - { - genRand = new Random((int) DateTime.Now.Ticks); - } - using (FileStream stream = new FileStream(Main.worldPathName, FileMode.Open)) - { - using (BinaryReader reader = new BinaryReader(stream)) - { - try - { - if (reader.ReadInt32() > Main.curRelease) - { - Main.menuMode = 15; - Main.statusText = "Incompatible world file!"; - loadFailed = true; - reader.Close(); - return; - } - Main.worldName = reader.ReadString(); - Main.worldID = reader.ReadInt32(); - Main.leftWorld = reader.ReadInt32(); - Main.rightWorld = reader.ReadInt32(); - Main.topWorld = reader.ReadInt32(); - Main.bottomWorld = reader.ReadInt32(); - Main.maxTilesY = reader.ReadInt32(); - Main.maxTilesX = reader.ReadInt32(); - clearWorld(); - Main.spawnTileX = reader.ReadInt32(); - Main.spawnTileY = reader.ReadInt32(); - Main.worldSurface = reader.ReadDouble(); - Main.rockLayer = reader.ReadDouble(); - tempTime = reader.ReadDouble(); - tempDayTime = reader.ReadBoolean(); - tempMoonPhase = reader.ReadInt32(); - tempBloodMoon = reader.ReadBoolean(); - Main.dungeonX = reader.ReadInt32(); - Main.dungeonY = reader.ReadInt32(); - NPC.downedBoss1 = reader.ReadBoolean(); - NPC.downedBoss2 = reader.ReadBoolean(); - NPC.downedBoss3 = reader.ReadBoolean(); - shadowOrbSmashed = reader.ReadBoolean(); - spawnMeteor = reader.ReadBoolean(); - shadowOrbCount = reader.ReadByte(); - Main.invasionDelay = reader.ReadInt32(); - Main.invasionSize = reader.ReadInt32(); - Main.invasionType = reader.ReadInt32(); - Main.invasionX = reader.ReadDouble(); - for (int i = 0; i < Main.maxTilesX; i++) - { - float num3 = ((float) i) / ((float) Main.maxTilesX); - Main.statusText = "Loading world data: " + ((int) ((num3 * 100f) + 1f)) + "%"; - for (int n = 0; n < Main.maxTilesY; n++) - { - Main.tile[i, n].active = reader.ReadBoolean(); - if (Main.tile[i, n].active) - { - Main.tile[i, n].type = reader.ReadByte(); - if (Main.tileFrameImportant[Main.tile[i, n].type]) - { - Main.tile[i, n].frameX = reader.ReadInt16(); - Main.tile[i, n].frameY = reader.ReadInt16(); - } - else - { - Main.tile[i, n].frameX = -1; - Main.tile[i, n].frameY = -1; - } - } - Main.tile[i, n].lighted = reader.ReadBoolean(); - if (reader.ReadBoolean()) - { - Main.tile[i, n].wall = reader.ReadByte(); - } - if (reader.ReadBoolean()) - { - Main.tile[i, n].liquid = reader.ReadByte(); - Main.tile[i, n].lava = reader.ReadBoolean(); - } - } - } - for (int j = 0; j < 0x3e8; j++) - { - if (reader.ReadBoolean()) - { - Main.chest[j] = new Chest(); - Main.chest[j].x = reader.ReadInt32(); - Main.chest[j].y = reader.ReadInt32(); - for (int num6 = 0; num6 < Chest.maxItems; num6++) - { - Main.chest[j].item[num6] = new Item(); - byte num7 = reader.ReadByte(); - if (num7 > 0) - { - string itemName = reader.ReadString(); - Main.chest[j].item[num6].SetDefaults(itemName); - Main.chest[j].item[num6].stack = num7; - } - } - } - } - for (int k = 0; k < 0x3e8; k++) - { - if (reader.ReadBoolean()) - { - string str2 = reader.ReadString(); - int num9 = reader.ReadInt32(); - int num10 = reader.ReadInt32(); - if (Main.tile[num9, num10].active && (Main.tile[num9, num10].type == 0x37)) - { - Main.sign[k] = new Sign(); - Main.sign[k].x = num9; - Main.sign[k].y = num10; - Main.sign[k].text = str2; - } - } - } - bool flag = reader.ReadBoolean(); - for (int m = 0; flag; m++) - { - Main.npc[m].SetDefaults(reader.ReadString()); - Main.npc[m].position.X = reader.ReadSingle(); - Main.npc[m].position.Y = reader.ReadSingle(); - Main.npc[m].homeless = reader.ReadBoolean(); - Main.npc[m].homeTileX = reader.ReadInt32(); - Main.npc[m].homeTileY = reader.ReadInt32(); - flag = reader.ReadBoolean(); - } - reader.Close(); - gen = true; - waterLine = Main.maxTilesY; - Liquid.QuickWater(2, -1, -1); - WaterCheck(); - int num12 = 0; - Liquid.quickSettle = true; - int num13 = Liquid.numLiquid + LiquidBuffer.numLiquidBuffer; - float num14 = 0f; - while ((Liquid.numLiquid > 0) && (num12 < 0x186a0)) - { - num12++; - float num15 = ((float) (num13 - (Liquid.numLiquid + LiquidBuffer.numLiquidBuffer))) / ((float) num13); - if ((Liquid.numLiquid + LiquidBuffer.numLiquidBuffer) > num13) - { - num13 = Liquid.numLiquid + LiquidBuffer.numLiquidBuffer; - } - if (num15 > num14) - { - num14 = num15; - } - else - { - num15 = num14; - } - Main.statusText = "Settling liquids: " + ((int) (((num15 * 100f) / 2f) + 50f)) + "%"; - Liquid.UpdateLiquid(); - } - Liquid.quickSettle = false; - WaterCheck(); - gen = false; - } - catch (Exception exception) - { - Main.menuMode = 15; - Main.statusText = exception.ToString(); - loadFailed = true; - try - { - reader.Close(); - } - catch - { - } - return; - } - loadFailed = false; - } - } - } - - public static void MakeDungeon(int x, int y, int tileType = 0x29, int wallType = 7) - { - int num = genRand.Next(3); - int num2 = genRand.Next(3); - switch (num) - { - case 1: - tileType = 0x2b; - break; - - case 2: - tileType = 0x2c; - break; - } - switch (num2) - { - case 1: - wallType = 8; - break; - - case 2: - wallType = 9; - break; - } - numDDoors = 0; - numDPlats = 0; - numDRooms = 0; - WorldGen.dungeonX = x; - WorldGen.dungeonY = y; - dMinX = x; - dMaxX = x; - dMinY = y; - dMaxY = y; - dxStrength1 = genRand.Next(0x19, 30); - dyStrength1 = genRand.Next(20, 0x19); - dxStrength2 = genRand.Next(0x23, 50); - dyStrength2 = genRand.Next(10, 15); - float num3 = Main.maxTilesX / 60; - num3 += genRand.Next(0, (int) (num3 / 3f)); - float num4 = num3; - int num5 = 5; - DungeonRoom(WorldGen.dungeonX, WorldGen.dungeonY, tileType, wallType); - while (num3 > 0f) - { - if (WorldGen.dungeonX < dMinX) - { - dMinX = WorldGen.dungeonX; - } - if (WorldGen.dungeonX > dMaxX) - { - dMaxX = WorldGen.dungeonX; - } - if (WorldGen.dungeonY > dMaxY) - { - dMaxY = WorldGen.dungeonY; - } - num3--; - Main.statusText = "Creating dungeon: " + ((int) (((num4 - num3) / num4) * 60f)) + "%"; - if (num5 > 0) - { - num5--; - } - if ((num5 == 0) & (genRand.Next(3) == 0)) - { - num5 = 5; - if (genRand.Next(2) == 0) - { - int dungeonX = WorldGen.dungeonX; - int dungeonY = WorldGen.dungeonY; - DungeonHalls(WorldGen.dungeonX, WorldGen.dungeonY, tileType, wallType, false); - if (genRand.Next(2) == 0) - { - DungeonHalls(WorldGen.dungeonX, WorldGen.dungeonY, tileType, wallType, false); - } - DungeonRoom(WorldGen.dungeonX, WorldGen.dungeonY, tileType, wallType); - WorldGen.dungeonX = dungeonX; - WorldGen.dungeonY = dungeonY; - } - else - { - DungeonRoom(WorldGen.dungeonX, WorldGen.dungeonY, tileType, wallType); - } - } - else - { - DungeonHalls(WorldGen.dungeonX, WorldGen.dungeonY, tileType, wallType, false); - } - } - DungeonRoom(WorldGen.dungeonX, WorldGen.dungeonY, tileType, wallType); - int num8 = dRoomX[0]; - int num9 = dRoomY[0]; - for (int i = 0; i < numDRooms; i++) - { - if (dRoomY[i] < num9) - { - num8 = dRoomX[i]; - num9 = dRoomY[i]; - } - } - WorldGen.dungeonX = num8; - WorldGen.dungeonY = num9; - dEnteranceX = num8; - dSurface = false; - num5 = 5; - while (!dSurface) - { - if (num5 > 0) - { - num5--; - } - if (((num5 == 0) & (genRand.Next(5) == 0)) && (WorldGen.dungeonY > (Main.worldSurface + 50.0))) - { - num5 = 10; - int num11 = WorldGen.dungeonX; - int num12 = WorldGen.dungeonY; - DungeonHalls(WorldGen.dungeonX, WorldGen.dungeonY, tileType, wallType, true); - DungeonRoom(WorldGen.dungeonX, WorldGen.dungeonY, tileType, wallType); - WorldGen.dungeonX = num11; - WorldGen.dungeonY = num12; - } - DungeonStairs(WorldGen.dungeonX, WorldGen.dungeonY, tileType, wallType); - } - DungeonEnt(WorldGen.dungeonX, WorldGen.dungeonY, tileType, wallType); - Main.statusText = "Creating dungeon: 65%"; - for (int j = 0; j < numDRooms; j++) - { - for (int num14 = dRoomL[j]; num14 <= dRoomR[j]; num14++) - { - if (!Main.tile[num14, dRoomT[j] - 1].active) - { - DPlatX[numDPlats] = num14; - DPlatY[numDPlats] = dRoomT[j] - 1; - numDPlats++; - break; - } - } - for (int num15 = dRoomL[j]; num15 <= dRoomR[j]; num15++) - { - if (!Main.tile[num15, dRoomB[j] + 1].active) - { - DPlatX[numDPlats] = num15; - DPlatY[numDPlats] = dRoomB[j] + 1; - numDPlats++; - break; - } - } - for (int num16 = dRoomT[j]; num16 <= dRoomB[j]; num16++) - { - if (!Main.tile[dRoomL[j] - 1, num16].active) - { - DDoorX[numDDoors] = dRoomL[j] - 1; - DDoorY[numDDoors] = num16; - DDoorPos[numDDoors] = -1; - numDDoors++; - break; - } - } - for (int num17 = dRoomT[j]; num17 <= dRoomB[j]; num17++) - { - if (!Main.tile[dRoomR[j] + 1, num17].active) - { - DDoorX[numDDoors] = dRoomR[j] + 1; - DDoorY[numDDoors] = num17; - DDoorPos[numDDoors] = 1; - numDDoors++; - break; - } - } - } - Main.statusText = "Creating dungeon: 70%"; - int num18 = 0; - int num19 = 0x3e8; - int num20 = 0; - while (num20 < (Main.maxTilesX / 0x7d)) - { - num18++; - int num21 = genRand.Next(dMinX, dMaxX); - int num22 = genRand.Next(((int) Main.worldSurface) + 0x19, dMaxY); - int num23 = num21; - if ((Main.tile[num21, num22].wall == wallType) && !Main.tile[num21, num22].active) - { - int num24 = 1; - if (genRand.Next(2) == 0) - { - num24 = -1; - } - while (!Main.tile[num21, num22].active) - { - num22 += num24; - } - if ((Main.tile[num21 - 1, num22].active && Main.tile[num21 + 1, num22].active) && (!Main.tile[num21 - 1, num22 - num24].active && !Main.tile[num21 + 1, num22 - num24].active)) - { - num20++; - int num25 = genRand.Next(5, 10); - while ((Main.tile[num21 - 1, num22].active && Main.tile[num21, num22 + num24].active) && ((Main.tile[num21, num22].active && !Main.tile[num21, num22 - num24].active) && (num25 > 0))) - { - Main.tile[num21, num22].type = 0x30; - if (!Main.tile[num21 - 1, num22 - num24].active && !Main.tile[num21 + 1, num22 - num24].active) - { - Main.tile[num21, num22 - num24].type = 0x30; - Main.tile[num21, num22 - num24].active = true; - } - num21--; - num25--; - } - num25 = genRand.Next(5, 10); - num21 = num23 + 1; - while ((Main.tile[num21 + 1, num22].active && Main.tile[num21, num22 + num24].active) && ((Main.tile[num21, num22].active && !Main.tile[num21, num22 - num24].active) && (num25 > 0))) - { - Main.tile[num21, num22].type = 0x30; - if (!Main.tile[num21 - 1, num22 - num24].active && !Main.tile[num21 + 1, num22 - num24].active) - { - Main.tile[num21, num22 - num24].type = 0x30; - Main.tile[num21, num22 - num24].active = true; - } - num21++; - num25--; - } - } - } - if (num18 > num19) - { - num18 = 0; - num20++; - } - } - num18 = 0; - num19 = 0x3e8; - num20 = 0; - Main.statusText = "Creating dungeon: 75%"; - while (num20 < (Main.maxTilesX / 0x7d)) - { - num18++; - int num26 = genRand.Next(dMinX, dMaxX); - int num27 = genRand.Next(((int) Main.worldSurface) + 0x19, dMaxY); - int num28 = num27; - if ((Main.tile[num26, num27].wall == wallType) && !Main.tile[num26, num27].active) - { - int num29 = 1; - if (genRand.Next(2) == 0) - { - num29 = -1; - } - while (((num26 > 5) && (num26 < (Main.maxTilesX - 5))) && !Main.tile[num26, num27].active) - { - num26 += num29; - } - if ((Main.tile[num26, num27 - 1].active && Main.tile[num26, num27 + 1].active) && (!Main.tile[num26 - num29, num27 - 1].active && !Main.tile[num26 - num29, num27 + 1].active)) - { - num20++; - int num30 = genRand.Next(5, 10); - while ((Main.tile[num26, num27 - 1].active && Main.tile[num26 + num29, num27].active) && ((Main.tile[num26, num27].active && !Main.tile[num26 - num29, num27].active) && (num30 > 0))) - { - Main.tile[num26, num27].type = 0x30; - if (!Main.tile[num26 - num29, num27 - 1].active && !Main.tile[num26 - num29, num27 + 1].active) - { - Main.tile[num26 - num29, num27].type = 0x30; - Main.tile[num26 - num29, num27].active = true; - } - num27--; - num30--; - } - num30 = genRand.Next(5, 10); - num27 = num28 + 1; - while ((Main.tile[num26, num27 + 1].active && Main.tile[num26 + num29, num27].active) && ((Main.tile[num26, num27].active && !Main.tile[num26 - num29, num27].active) && (num30 > 0))) - { - Main.tile[num26, num27].type = 0x30; - if (!Main.tile[num26 - num29, num27 - 1].active && !Main.tile[num26 - num29, num27 + 1].active) - { - Main.tile[num26 - num29, num27].type = 0x30; - Main.tile[num26 - num29, num27].active = true; - } - num27++; - num30--; - } - } - } - if (num18 > num19) - { - num18 = 0; - num20++; - } - } - Main.statusText = "Creating dungeon: 80%"; - for (int k = 0; k < numDDoors; k++) - { - int num32 = DDoorX[k] - 10; - int num33 = DDoorX[k] + 10; - int num34 = 100; - int num35 = 0; - int num36 = 0; - int num37 = 0; - for (int num38 = num32; num38 < num33; num38++) - { - bool flag = true; - int num39 = DDoorY[k]; - while (!Main.tile[num38, num39].active) - { - num39--; - } - if (!Main.tileDungeon[Main.tile[num38, num39].type]) - { - flag = false; - } - num36 = num39; - num39 = DDoorY[k]; - while (!Main.tile[num38, num39].active) - { - num39++; - } - if (!Main.tileDungeon[Main.tile[num38, num39].type]) - { - flag = false; - } - num37 = num39; - if ((num37 - num36) >= 3) - { - int num40 = num38 - 20; - int num41 = num38 + 20; - int num42 = num37 - 10; - int num43 = num37 + 10; - for (int num44 = num40; num44 < num41; num44++) - { - for (int num45 = num42; num45 < num43; num45++) - { - if (Main.tile[num44, num45].active && (Main.tile[num44, num45].type == 10)) - { - flag = false; - break; - } - } - } - if (flag) - { - for (int num46 = num37 - 3; num46 < num37; num46++) - { - for (int num47 = num38 - 3; num47 <= (num38 + 3); num47++) - { - if (Main.tile[num47, num46].active) - { - flag = false; - break; - } - } - } - } - if (flag && ((num37 - num36) < 20)) - { - bool flag2 = false; - if ((DDoorPos[k] == 0) && ((num37 - num36) < num34)) - { - flag2 = true; - } - if ((DDoorPos[k] == -1) && (num38 > num35)) - { - flag2 = true; - } - if ((DDoorPos[k] == 1) && ((num38 < num35) || (num35 == 0))) - { - flag2 = true; - } - if (flag2) - { - num35 = num38; - num34 = num37 - num36; - } - } - } - } - if (num34 < 20) - { - int num48 = num35; - int num49 = DDoorY[k]; - int num50 = num49; - while (!Main.tile[num48, num49].active) - { - Main.tile[num48, num49].active = false; - num49++; - } - while (!Main.tile[num48, num50].active) - { - num50--; - } - num49--; - num50++; - for (int num51 = num50; num51 < (num49 - 2); num51++) - { - Main.tile[num48, num51].active = true; - Main.tile[num48, num51].type = (byte) tileType; - } - PlaceTile(num48, num49, 10, true, false, -1); - num48--; - int num52 = num49 - 3; - while (!Main.tile[num48, num52].active) - { - num52--; - } - if (((num49 - num52) < ((num49 - num50) + 5)) && Main.tileDungeon[Main.tile[num48, num52].type]) - { - for (int num53 = (num49 - 4) - genRand.Next(3); num53 > num52; num53--) - { - Main.tile[num48, num53].active = true; - Main.tile[num48, num53].type = (byte) tileType; - } - } - num48 += 2; - num52 = num49 - 3; - while (!Main.tile[num48, num52].active) - { - num52--; - } - if (((num49 - num52) < ((num49 - num50) + 5)) && Main.tileDungeon[Main.tile[num48, num52].type]) - { - for (int num54 = (num49 - 4) - genRand.Next(3); num54 > num52; num54--) - { - Main.tile[num48, num54].active = true; - Main.tile[num48, num54].type = (byte) tileType; - } - } - num49++; - num48--; - Main.tile[num48 - 1, num49].active = true; - Main.tile[num48 - 1, num49].type = (byte) tileType; - Main.tile[num48 + 1, num49].active = true; - Main.tile[num48 + 1, num49].type = (byte) tileType; - } - } - Main.statusText = "Creating dungeon: 85%"; - for (int m = 0; m < numDPlats; m++) - { - int num56 = DPlatX[m]; - int num57 = DPlatY[m]; - int maxTilesX = Main.maxTilesX; - int num59 = 10; - for (int num60 = num57 - 5; num60 <= (num57 + 5); num60++) - { - int num61 = num56; - int num62 = num56; - bool flag3 = false; - if (!Main.tile[num61, num60].active) - { - goto Label_10D8; - } - flag3 = true; - goto Label_1128; - Label_10B4: - num61--; - if (!Main.tileDungeon[Main.tile[num61, num60].type]) - { - flag3 = true; - } - Label_10D8: - if (!Main.tile[num61, num60].active) - { - goto Label_10B4; - } - while (!Main.tile[num62, num60].active) - { - num62++; - if (!Main.tileDungeon[Main.tile[num62, num60].type]) - { - flag3 = true; - } - } - Label_1128: - if (!flag3 && ((num62 - num61) <= num59)) - { - bool flag4 = true; - int num63 = (num56 - (num59 / 2)) - 2; - int num64 = (num56 + (num59 / 2)) + 2; - int num65 = num60 - 5; - int num66 = num60 + 5; - for (int num67 = num63; num67 <= num64; num67++) - { - for (int num68 = num65; num68 <= num66; num68++) - { - if (Main.tile[num67, num68].active && (Main.tile[num67, num68].type == 0x13)) - { - flag4 = false; - break; - } - } - } - for (int num69 = num60 + 3; num69 >= (num60 - 5); num69--) - { - if (Main.tile[num56, num69].active) - { - flag4 = false; - break; - } - } - if (flag4) - { - maxTilesX = num60; - break; - } - } - } - if ((maxTilesX > (num57 - 10)) && (maxTilesX < (num57 + 10))) - { - int num70 = num56; - int num71 = maxTilesX; - int num72 = num56 + 1; - while (!Main.tile[num70, num71].active) - { - Main.tile[num70, num71].active = true; - Main.tile[num70, num71].type = 0x13; - num70--; - } - while (!Main.tile[num72, num71].active) - { - Main.tile[num72, num71].active = true; - Main.tile[num72, num71].type = 0x13; - num72++; - } - } - } - Main.statusText = "Creating dungeon: 90%"; - num18 = 0; - num19 = 0x3e8; - num20 = 0; - while (num20 < (Main.maxTilesX / 20)) - { - num18++; - int num73 = genRand.Next(dMinX, dMaxX); - int num74 = genRand.Next(dMinY, dMaxY); - bool flag5 = true; - if ((Main.tile[num73, num74].wall == wallType) && !Main.tile[num73, num74].active) - { - int num75 = 1; - if (genRand.Next(2) == 0) - { - num75 = -1; - } - while (flag5 && !Main.tile[num73, num74].active) - { - num73 -= num75; - if ((num73 < 5) || (num73 > (Main.maxTilesX - 5))) - { - flag5 = false; - } - else if (Main.tile[num73, num74].active && !Main.tileDungeon[Main.tile[num73, num74].type]) - { - flag5 = false; - } - } - if (((flag5 && Main.tile[num73, num74].active) && (Main.tileDungeon[Main.tile[num73, num74].type] && Main.tile[num73, num74 - 1].active)) && ((Main.tileDungeon[Main.tile[num73, num74 - 1].type] && Main.tile[num73, num74 + 1].active) && Main.tileDungeon[Main.tile[num73, num74 + 1].type])) - { - num73 += num75; - for (int num76 = num73 - 3; num76 <= (num73 + 3); num76++) - { - for (int num77 = num74 - 3; num77 <= (num74 + 3); num77++) - { - if (Main.tile[num76, num77].active && (Main.tile[num76, num77].type == 0x13)) - { - flag5 = false; - break; - } - } - } - if (flag5 && ((!Main.tile[num73, num74 - 1].active & !Main.tile[num73, num74 - 2].active) & !Main.tile[num73, num74 - 3].active)) - { - int num78 = num73; - int num79 = num73; - while (((num78 > dMinX) && (num78 < dMaxX)) && ((!Main.tile[num78, num74].active && !Main.tile[num78, num74 - 1].active) && !Main.tile[num78, num74 + 1].active)) - { - num78 += num75; - } - num78 = Math.Abs((int) (num73 - num78)); - bool flag6 = false; - if (genRand.Next(2) == 0) - { - flag6 = true; - } - if (num78 > 5) - { - for (int num80 = genRand.Next(1, 4); num80 > 0; num80--) - { - Main.tile[num73, num74].active = true; - Main.tile[num73, num74].type = 0x13; - if (flag6) - { - PlaceTile(num73, num74 - 1, 50, true, false, -1); - if ((genRand.Next(50) == 0) && (Main.tile[num73, num74 - 1].type == 50)) - { - Main.tile[num73, num74 - 1].frameX = 90; - } - } - num73 += num75; - } - num18 = 0; - num20++; - if (!flag6 && (genRand.Next(2) == 0)) - { - num73 = num79; - num74--; - int type = genRand.Next(2); - switch (type) - { - case 0: - type = 13; - break; - - case 1: - type = 0x31; - break; - } - PlaceTile(num73, num74, type, true, false, -1); - if (Main.tile[num73, num74].type == 13) - { - if (genRand.Next(2) == 0) - { - Main.tile[num73, num74].frameX = 0x12; - } - else - { - Main.tile[num73, num74].frameX = 0x24; - } - } - } - } - } - } - } - if (num18 > num19) - { - num18 = 0; - num20++; - } - } - Main.statusText = "Creating dungeon: 95%"; - for (int n = 0; n < numDRooms; n++) - { - int num83 = 0; - while (num83 < 0x3e8) - { - int num84 = (int) (dRoomSize[n] * 0.4); - int num85 = dRoomX[n] + genRand.Next(-num84, num84 + 1); - int num86 = dRoomY[n] + genRand.Next(-num84, num84 + 1); - int contain = 0; - switch (n) - { - case 0: - contain = 0x71; - break; - - case 1: - contain = 0x9b; - break; - - case 2: - contain = 0x9c; - break; - - case 3: - contain = 0x9d; - break; - - case 4: - contain = 0xa3; - break; - - case 5: - contain = 0xa4; - break; - } - if ((contain == 0) && (genRand.Next(2) == 0)) - { - num83 = 0x3e8; - } - else - { - if (AddBuriedChest(num85, num86, contain)) - { - num83 += 0x3e8; - } - num83++; - } - } - } - dMinX -= 0x19; - dMaxX += 0x19; - dMinY -= 0x19; - dMaxY += 0x19; - if (dMinX < 0) - { - dMinX = 0; - } - if (dMaxX > Main.maxTilesX) - { - dMaxX = Main.maxTilesX; - } - if (dMinY < 0) - { - dMinY = 0; - } - if (dMaxY > Main.maxTilesY) - { - dMaxY = Main.maxTilesY; - } - num18 = 0; - num19 = 0x3e8; - num20 = 0; - while (num20 < (Main.maxTilesX / 20)) - { - num18++; - int num89 = genRand.Next(dMinX, dMaxX); - int num90 = genRand.Next(dMinY, dMaxY); - if (Main.tile[num89, num90].wall == wallType) - { - for (int num91 = num90; num91 > dMinY; num91--) - { - if (Main.tile[num89, num91 - 1].active && (Main.tile[num89, num91 - 1].type == tileType)) - { - bool flag7 = false; - for (int num92 = num89 - 15; num92 < (num89 + 15); num92++) - { - for (int num93 = num91 - 15; num93 < (num91 + 15); num93++) - { - if ((((num92 > 0) && (num92 < Main.maxTilesX)) && ((num93 > 0) && (num93 < Main.maxTilesY))) && (Main.tile[num92, num93].type == 0x2a)) - { - flag7 = true; - break; - } - } - } - if ((Main.tile[num89 - 1, num91].active || Main.tile[num89 + 1, num91].active) || ((Main.tile[num89 - 1, num91 + 1].active || Main.tile[num89 + 1, num91 + 1].active) || Main.tile[num89, num91 + 2].active)) - { - flag7 = true; - } - if (!flag7) - { - Place1x2Top(num89, num91, 0x2a); - if (Main.tile[num89, num91].type == 0x2a) - { - num18 = 0; - num20++; - } - } - break; - } - } - } - if (num18 > num19) - { - num20++; - num18 = 0; - } - } - } - - public static bool meteor(int i, int j) - { - if ((i < 50) || (i > (Main.maxTilesX - 50))) - { - return false; - } - if ((j < 50) || (j > (Main.maxTilesY - 50))) - { - return false; - } - int num = 0x19; - Rectangle rectangle = new Rectangle((i - num) * 0x10, (j - num) * 0x10, (num * 2) * 0x10, (num * 2) * 0x10); - for (int k = 0; k < 8; k++) - { - if (Main.player[k].active) - { - Rectangle rectangle2 = new Rectangle(((((int) Main.player[k].position.X) + (Main.player[k].width / 2)) - (Main.screenWidth / 2)) - NPC.safeRangeX, ((((int) Main.player[k].position.Y) + (Main.player[k].height / 2)) - (Main.screenHeight / 2)) - NPC.safeRangeY, Main.screenWidth + (NPC.safeRangeX * 2), Main.screenHeight + (NPC.safeRangeY * 2)); - if (rectangle.Intersects(rectangle2)) - { - return false; - } - } - } - for (int m = 0; m < 0x3e8; m++) - { - if (Main.npc[m].active) - { - Rectangle rectangle3 = new Rectangle((int) Main.npc[m].position.X, (int) Main.npc[m].position.Y, Main.npc[m].width, Main.npc[m].height); - if (rectangle.Intersects(rectangle3)) - { - return false; - } - } - } - for (int n = i - num; n < (i + num); n++) - { - for (int num5 = j - num; num5 < (j + num); num5++) - { - if (Main.tile[n, num5].active && (Main.tile[n, num5].type == 0x15)) - { - return false; - } - } - } - stopDrops = true; - num = 15; - for (int num6 = i - num; num6 < (i + num); num6++) - { - for (int num7 = j - num; num7 < (j + num); num7++) - { - if ((num7 > ((j + Main.rand.Next(-2, 3)) - 5)) && ((Math.Abs((int) (i - num6)) + Math.Abs((int) (j - num7))) < ((num * 1.5) + Main.rand.Next(-5, 5)))) - { - if (!Main.tileSolid[Main.tile[num6, num7].type]) - { - Main.tile[num6, num7].active = false; - } - Main.tile[num6, num7].type = 0x25; - } - } - } - num = 10; - for (int num8 = i - num; num8 < (i + num); num8++) - { - for (int num9 = j - num; num9 < (j + num); num9++) - { - if ((num9 > ((j + Main.rand.Next(-2, 3)) - 5)) && ((Math.Abs((int) (i - num8)) + Math.Abs((int) (j - num9))) < (num + Main.rand.Next(-3, 4)))) - { - Main.tile[num8, num9].active = false; - } - } - } - num = 0x10; - for (int num10 = i - num; num10 < (i + num); num10++) - { - for (int num11 = j - num; num11 < (j + num); num11++) - { - if ((Main.tile[num10, num11].type == 5) || (Main.tile[num10, num11].type == 0x20)) - { - KillTile(num10, num11, false, false, false); - } - SquareTileFrame(num10, num11, true); - SquareWallFrame(num10, num11, true); - } - } - num = 0x17; - for (int num12 = i - num; num12 < (i + num); num12++) - { - for (int num13 = j - num; num13 < (j + num); num13++) - { - if ((Main.tile[num12, num13].active && (Main.rand.Next(10) == 0)) && ((Math.Abs((int) (i - num12)) + Math.Abs((int) (j - num13))) < (num * 1.3))) - { - if ((Main.tile[num12, num13].type == 5) || (Main.tile[num12, num13].type == 0x20)) - { - KillTile(num12, num13, false, false, false); - } - Main.tile[num12, num13].type = 0x25; - SquareTileFrame(num12, num13, true); - } - } - } - stopDrops = false; - if (Main.netMode == 0) - { - Main.NewText("A meteorite has landed!", 50, 0xff, 130); - } - else if (Main.netMode == 2) - { - NetMessage.SendData(0x19, -1, -1, "A meteorite has landed!", 8, 50f, 255f, 130f); - } - if (Main.netMode != 1) - { - NetMessage.SendTileSquare(-1, i, j, 30); - } - return true; - } - - public static void Mountinater(int i, int j) - { - Vector2 vector; - Vector2 vector2; - double num5 = genRand.Next(80, 120); - double num6 = num5; - float num7 = genRand.Next(40, 0x37); - vector.X = i; - vector.Y = j + (num7 / 2f); - vector2.X = genRand.Next(-10, 11) * 0.1f; - vector2.Y = genRand.Next(-20, -10) * 0.1f; - while ((num5 > 0.0) && (num7 > 0f)) - { - num5 -= genRand.Next(4); - num7--; - int num = (int) (vector.X - (num5 * 0.5)); - int maxTilesX = (int) (vector.X + (num5 * 0.5)); - int num2 = (int) (vector.Y - (num5 * 0.5)); - int maxTilesY = (int) (vector.Y + (num5 * 0.5)); - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num2 < 0) - { - num2 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - num6 = (num5 * genRand.Next(80, 120)) * 0.01; - for (int k = num; k < maxTilesX; k++) - { - for (int m = num2; m < maxTilesY; m++) - { - float num10 = Math.Abs((float) (k - vector.X)); - float num11 = Math.Abs((float) (m - vector.Y)); - if ((Math.Sqrt((double) ((num10 * num10) + (num11 * num11))) < (num6 * 0.4)) && !Main.tile[k, m].active) - { - Main.tile[k, m].active = true; - Main.tile[k, m].type = 0; - } - } - } - vector += vector2; - vector2.X += genRand.Next(-10, 11) * 0.05f; - vector2.Y += genRand.Next(-10, 11) * 0.05f; - if (vector2.X > 0.5) - { - vector2.X = 0.5f; - } - if (vector2.X < -0.5) - { - vector2.X = -0.5f; - } - if (vector2.Y > -0.5) - { - vector2.Y = -0.5f; - } - if (vector2.Y < -1.5) - { - vector2.Y = -1.5f; - } - } - } - - public static bool OpenDoor(int i, int j, int direction) - { - int num3; - int num = 0; - if (Main.tile[i, j - 1] == null) - { - Main.tile[i, j - 1] = new Tile(); - } - if (Main.tile[i, j - 2] == null) - { - Main.tile[i, j - 2] = new Tile(); - } - if (Main.tile[i, j + 1] == null) - { - Main.tile[i, j + 1] = new Tile(); - } - if (Main.tile[i, j] == null) - { - Main.tile[i, j] = new Tile(); - } - if ((Main.tile[i, j - 1].frameY == 0) && (Main.tile[i, j - 1].type == Main.tile[i, j].type)) - { - num = j - 1; - } - else if ((Main.tile[i, j - 2].frameY == 0) && (Main.tile[i, j - 2].type == Main.tile[i, j].type)) - { - num = j - 2; - } - else if ((Main.tile[i, j + 1].frameY == 0) && (Main.tile[i, j + 1].type == Main.tile[i, j].type)) - { - num = j + 1; - } - else - { - num = j; - } - int num2 = i; - short num4 = 0; - if (direction == -1) - { - num2 = i - 1; - num4 = 0x24; - num3 = i - 1; - } - else - { - num2 = i; - num3 = i + 1; - } - bool flag = true; - for (int k = num; k < (num + 3); k++) - { - if (Main.tile[num3, k] == null) - { - Main.tile[num3, k] = new Tile(); - } - if (Main.tile[num3, k].active) - { - if ((((Main.tile[num3, k].type == 3) || (Main.tile[num3, k].type == 0x18)) || ((Main.tile[num3, k].type == 0x34) || (Main.tile[num3, k].type == 0x3d))) || (((Main.tile[num3, k].type == 0x3e) || (Main.tile[num3, k].type == 0x45)) || (((Main.tile[num3, k].type == 0x47) || (Main.tile[num3, k].type == 0x49)) || (Main.tile[num3, k].type == 0x4a)))) - { - KillTile(num3, k, false, false, false); - } - else - { - flag = false; - break; - } - } - } - if (flag) - { - Main.PlaySound(8, i * 0x10, j * 0x10, 1); - Main.tile[num2, num].active = true; - Main.tile[num2, num].type = 11; - Main.tile[num2, num].frameY = 0; - Main.tile[num2, num].frameX = num4; - if (Main.tile[num2 + 1, num] == null) - { - Main.tile[num2 + 1, num] = new Tile(); - } - Main.tile[num2 + 1, num].active = true; - Main.tile[num2 + 1, num].type = 11; - Main.tile[num2 + 1, num].frameY = 0; - Main.tile[num2 + 1, num].frameX = (short) (num4 + 0x12); - if (Main.tile[num2, num + 1] == null) - { - Main.tile[num2, num + 1] = new Tile(); - } - Main.tile[num2, num + 1].active = true; - Main.tile[num2, num + 1].type = 11; - Main.tile[num2, num + 1].frameY = 0x12; - Main.tile[num2, num + 1].frameX = num4; - if (Main.tile[num2 + 1, num + 1] == null) - { - Main.tile[num2 + 1, num + 1] = new Tile(); - } - Main.tile[num2 + 1, num + 1].active = true; - Main.tile[num2 + 1, num + 1].type = 11; - Main.tile[num2 + 1, num + 1].frameY = 0x12; - Main.tile[num2 + 1, num + 1].frameX = (short) (num4 + 0x12); - if (Main.tile[num2, num + 2] == null) - { - Main.tile[num2, num + 2] = new Tile(); - } - Main.tile[num2, num + 2].active = true; - Main.tile[num2, num + 2].type = 11; - Main.tile[num2, num + 2].frameY = 0x24; - Main.tile[num2, num + 2].frameX = num4; - if (Main.tile[num2 + 1, num + 2] == null) - { - Main.tile[num2 + 1, num + 2] = new Tile(); - } - Main.tile[num2 + 1, num + 2].active = true; - Main.tile[num2 + 1, num + 2].type = 11; - Main.tile[num2 + 1, num + 2].frameY = 0x24; - Main.tile[num2 + 1, num + 2].frameX = (short) (num4 + 0x12); - for (int m = num2 - 1; m <= (num2 + 2); m++) - { - for (int n = num - 1; n <= (num + 2); n++) - { - TileFrame(m, n, false, false); - } - } - } - return flag; - } - - public static void Place1x2(int x, int y, int type) - { - short num = 0; - if (type == 20) - { - num = (short) (genRand.Next(3) * 0x12); - } - if (Main.tile[x, y - 1] == null) - { - Main.tile[x, y - 1] = new Tile(); - } - if (Main.tile[x, y + 1] == null) - { - Main.tile[x, y + 1] = new Tile(); - } - if ((Main.tile[x, y + 1].active && Main.tileSolid[Main.tile[x, y + 1].type]) && !Main.tile[x, y - 1].active) - { - Main.tile[x, y - 1].active = true; - Main.tile[x, y - 1].frameY = 0; - Main.tile[x, y - 1].frameX = num; - Main.tile[x, y - 1].type = (byte) type; - Main.tile[x, y].active = true; - Main.tile[x, y].frameY = 0x12; - Main.tile[x, y].frameX = num; - Main.tile[x, y].type = (byte) type; - } - } - - public static void Place1x2Top(int x, int y, int type) - { - short num = 0; - if (Main.tile[x, y - 1] == null) - { - Main.tile[x, y - 1] = new Tile(); - } - if (Main.tile[x, y + 1] == null) - { - Main.tile[x, y + 1] = new Tile(); - } - if ((Main.tile[x, y - 1].active && Main.tileSolid[Main.tile[x, y - 1].type]) && (!Main.tileSolidTop[Main.tile[x, y - 1].type] && !Main.tile[x, y + 1].active)) - { - Main.tile[x, y].active = true; - Main.tile[x, y].frameY = 0; - Main.tile[x, y].frameX = num; - Main.tile[x, y].type = (byte) type; - Main.tile[x, y + 1].active = true; - Main.tile[x, y + 1].frameY = 0x12; - Main.tile[x, y + 1].frameX = num; - Main.tile[x, y + 1].type = (byte) type; - } - } - - public static void Place2x1(int x, int y, int type) - { - if (Main.tile[x, y] == null) - { - Main.tile[x, y] = new Tile(); - } - if (Main.tile[x + 1, y] == null) - { - Main.tile[x + 1, y] = new Tile(); - } - if (Main.tile[x, y + 1] == null) - { - Main.tile[x, y + 1] = new Tile(); - } - if (Main.tile[x + 1, y + 1] == null) - { - Main.tile[x + 1, y + 1] = new Tile(); - } - bool flag = false; - if ((((type != 0x1d) && Main.tile[x, y + 1].active) && (Main.tile[x + 1, y + 1].active && Main.tileSolid[Main.tile[x, y + 1].type])) && ((Main.tileSolid[Main.tile[x + 1, y + 1].type] && !Main.tile[x, y].active) && !Main.tile[x + 1, y].active)) - { - flag = true; - } - else if ((((type == 0x1d) && Main.tile[x, y + 1].active) && (Main.tile[x + 1, y + 1].active && Main.tileTable[Main.tile[x, y + 1].type])) && ((Main.tileTable[Main.tile[x + 1, y + 1].type] && !Main.tile[x, y].active) && !Main.tile[x + 1, y].active)) - { - flag = true; - } - if (flag) - { - Main.tile[x, y].active = true; - Main.tile[x, y].frameY = 0; - Main.tile[x, y].frameX = 0; - Main.tile[x, y].type = (byte) type; - Main.tile[x + 1, y].active = true; - Main.tile[x + 1, y].frameY = 0; - Main.tile[x + 1, y].frameX = 0x12; - Main.tile[x + 1, y].type = (byte) type; - } - } - - public static void Place3x2(int x, int y, int type) - { - if (((x >= 5) && (x <= (Main.maxTilesX - 5))) && ((y >= 5) && (y <= (Main.maxTilesY - 5)))) - { - bool flag = true; - for (int i = x - 1; i < (x + 2); i++) - { - for (int j = y - 1; j < (y + 1); j++) - { - if (Main.tile[i, j] == null) - { - Main.tile[i, j] = new Tile(); - } - if (Main.tile[i, j].active) - { - flag = false; - } - } - if (Main.tile[i, y + 1] == null) - { - Main.tile[i, y + 1] = new Tile(); - } - if (!Main.tile[i, y + 1].active || !Main.tileSolid[Main.tile[i, y + 1].type]) - { - flag = false; - } - } - if (flag) - { - Main.tile[x - 1, y - 1].active = true; - Main.tile[x - 1, y - 1].frameY = 0; - Main.tile[x - 1, y - 1].frameX = 0; - Main.tile[x - 1, y - 1].type = (byte) type; - Main.tile[x, y - 1].active = true; - Main.tile[x, y - 1].frameY = 0; - Main.tile[x, y - 1].frameX = 0x12; - Main.tile[x, y - 1].type = (byte) type; - Main.tile[x + 1, y - 1].active = true; - Main.tile[x + 1, y - 1].frameY = 0; - Main.tile[x + 1, y - 1].frameX = 0x24; - Main.tile[x + 1, y - 1].type = (byte) type; - Main.tile[x - 1, y].active = true; - Main.tile[x - 1, y].frameY = 0x12; - Main.tile[x - 1, y].frameX = 0; - Main.tile[x - 1, y].type = (byte) type; - Main.tile[x, y].active = true; - Main.tile[x, y].frameY = 0x12; - Main.tile[x, y].frameX = 0x12; - Main.tile[x, y].type = (byte) type; - Main.tile[x + 1, y].active = true; - Main.tile[x + 1, y].frameY = 0x12; - Main.tile[x + 1, y].frameX = 0x24; - Main.tile[x + 1, y].type = (byte) type; - } - } - } - - public static void Place3x3(int x, int y, int type) - { - bool flag = true; - for (int i = x - 1; i < (x + 2); i++) - { - for (int j = y; j < (y + 3); j++) - { - if (Main.tile[i, j] == null) - { - Main.tile[i, j] = new Tile(); - } - if (Main.tile[i, j].active) - { - flag = false; - } - } - } - if (Main.tile[x, y - 1] == null) - { - Main.tile[x, y - 1] = new Tile(); - } - if ((!Main.tile[x, y - 1].active || !Main.tileSolid[Main.tile[x, y - 1].type]) || Main.tileSolidTop[Main.tile[x, y - 1].type]) - { - flag = false; - } - if (flag) - { - Main.tile[x - 1, y].active = true; - Main.tile[x - 1, y].frameY = 0; - Main.tile[x - 1, y].frameX = 0; - Main.tile[x - 1, y].type = (byte) type; - Main.tile[x, y].active = true; - Main.tile[x, y].frameY = 0; - Main.tile[x, y].frameX = 0x12; - Main.tile[x, y].type = (byte) type; - Main.tile[x + 1, y].active = true; - Main.tile[x + 1, y].frameY = 0; - Main.tile[x + 1, y].frameX = 0x24; - Main.tile[x + 1, y].type = (byte) type; - Main.tile[x - 1, y + 1].active = true; - Main.tile[x - 1, y + 1].frameY = 0x12; - Main.tile[x - 1, y + 1].frameX = 0; - Main.tile[x - 1, y + 1].type = (byte) type; - Main.tile[x, y + 1].active = true; - Main.tile[x, y + 1].frameY = 0x12; - Main.tile[x, y + 1].frameX = 0x12; - Main.tile[x, y + 1].type = (byte) type; - Main.tile[x + 1, y + 1].active = true; - Main.tile[x + 1, y + 1].frameY = 0x12; - Main.tile[x + 1, y + 1].frameX = 0x24; - Main.tile[x + 1, y + 1].type = (byte) type; - Main.tile[x - 1, y + 2].active = true; - Main.tile[x - 1, y + 2].frameY = 0x24; - Main.tile[x - 1, y + 2].frameX = 0; - Main.tile[x - 1, y + 2].type = (byte) type; - Main.tile[x, y + 2].active = true; - Main.tile[x, y + 2].frameY = 0x24; - Main.tile[x, y + 2].frameX = 0x12; - Main.tile[x, y + 2].type = (byte) type; - Main.tile[x + 1, y + 2].active = true; - Main.tile[x + 1, y + 2].frameY = 0x24; - Main.tile[x + 1, y + 2].frameX = 0x24; - Main.tile[x + 1, y + 2].type = (byte) type; - } - } - - public static void Place4x2(int x, int y, int type, int direction = -1) - { - if (((x >= 5) && (x <= (Main.maxTilesX - 5))) && ((y >= 5) && (y <= (Main.maxTilesY - 5)))) - { - bool flag = true; - for (int i = x - 1; i < (x + 3); i++) - { - for (int j = y - 1; j < (y + 1); j++) - { - if (Main.tile[i, j] == null) - { - Main.tile[i, j] = new Tile(); - } - if (Main.tile[i, j].active) - { - flag = false; - } - } - if (Main.tile[i, y + 1] == null) - { - Main.tile[i, y + 1] = new Tile(); - } - if (!Main.tile[i, y + 1].active || !Main.tileSolid[Main.tile[i, y + 1].type]) - { - flag = false; - } - } - short num3 = 0; - if (direction == 1) - { - num3 = 0x48; - } - if (flag) - { - Main.tile[x - 1, y - 1].active = true; - Main.tile[x - 1, y - 1].frameY = 0; - Main.tile[x - 1, y - 1].frameX = num3; - Main.tile[x - 1, y - 1].type = (byte) type; - Main.tile[x, y - 1].active = true; - Main.tile[x, y - 1].frameY = 0; - Main.tile[x, y - 1].frameX = (short) (0x12 + num3); - Main.tile[x, y - 1].type = (byte) type; - Main.tile[x + 1, y - 1].active = true; - Main.tile[x + 1, y - 1].frameY = 0; - Main.tile[x + 1, y - 1].frameX = (short) (0x24 + num3); - Main.tile[x + 1, y - 1].type = (byte) type; - Main.tile[x + 2, y - 1].active = true; - Main.tile[x + 2, y - 1].frameY = 0; - Main.tile[x + 2, y - 1].frameX = (short) (0x36 + num3); - Main.tile[x + 2, y - 1].type = (byte) type; - Main.tile[x - 1, y].active = true; - Main.tile[x - 1, y].frameY = 0x12; - Main.tile[x - 1, y].frameX = num3; - Main.tile[x - 1, y].type = (byte) type; - Main.tile[x, y].active = true; - Main.tile[x, y].frameY = 0x12; - Main.tile[x, y].frameX = (short) (0x12 + num3); - Main.tile[x, y].type = (byte) type; - Main.tile[x + 1, y].active = true; - Main.tile[x + 1, y].frameY = 0x12; - Main.tile[x + 1, y].frameX = (short) (0x24 + num3); - Main.tile[x + 1, y].type = (byte) type; - Main.tile[x + 2, y].active = true; - Main.tile[x + 2, y].frameY = 0x12; - Main.tile[x + 2, y].frameX = (short) (0x36 + num3); - Main.tile[x + 2, y].type = (byte) type; - } - } - } - - public static int PlaceChest(int x, int y, int type = 0x15) - { - bool flag = true; - int num = -1; - for (int i = x; i < (x + 2); i++) - { - for (int j = y - 1; j < (y + 1); j++) - { - if (Main.tile[i, j] == null) - { - Main.tile[i, j] = new Tile(); - } - if (Main.tile[i, j].active) - { - flag = false; - } - if (Main.tile[i, j].lava) - { - flag = false; - } - } - if (Main.tile[i, y + 1] == null) - { - Main.tile[i, y + 1] = new Tile(); - } - if (!Main.tile[i, y + 1].active || !Main.tileSolid[Main.tile[i, y + 1].type]) - { - flag = false; - } - } - if (flag) - { - num = Chest.CreateChest(x, y - 1); - if (num == -1) - { - flag = false; - } - } - if (flag) - { - Main.tile[x, y - 1].active = true; - Main.tile[x, y - 1].frameY = 0; - Main.tile[x, y - 1].frameX = 0; - Main.tile[x, y - 1].type = (byte) type; - Main.tile[x + 1, y - 1].active = true; - Main.tile[x + 1, y - 1].frameY = 0; - Main.tile[x + 1, y - 1].frameX = 0x12; - Main.tile[x + 1, y - 1].type = (byte) type; - Main.tile[x, y].active = true; - Main.tile[x, y].frameY = 0x12; - Main.tile[x, y].frameX = 0; - Main.tile[x, y].type = (byte) type; - Main.tile[x + 1, y].active = true; - Main.tile[x + 1, y].frameY = 0x12; - Main.tile[x + 1, y].frameX = 0x12; - Main.tile[x + 1, y].type = (byte) type; - } - return num; - } - - public static bool PlaceDoor(int i, int j, int type) - { - try - { - if ((Main.tile[i, j - 2].active && Main.tileSolid[Main.tile[i, j - 2].type]) && (Main.tile[i, j + 2].active && Main.tileSolid[Main.tile[i, j + 2].type])) - { - Main.tile[i, j - 1].active = true; - Main.tile[i, j - 1].type = 10; - Main.tile[i, j - 1].frameY = 0; - Main.tile[i, j - 1].frameX = (short) (genRand.Next(3) * 0x12); - Main.tile[i, j].active = true; - Main.tile[i, j].type = 10; - Main.tile[i, j].frameY = 0x12; - Main.tile[i, j].frameX = (short) (genRand.Next(3) * 0x12); - Main.tile[i, j + 1].active = true; - Main.tile[i, j + 1].type = 10; - Main.tile[i, j + 1].frameY = 0x24; - Main.tile[i, j + 1].frameX = (short) (genRand.Next(3) * 0x12); - return true; - } - return false; - } - catch - { - return false; - } - } - - public static void PlaceOnTable1x1(int x, int y, int type) - { - bool flag = false; - if (Main.tile[x, y] == null) - { - Main.tile[x, y] = new Tile(); - } - if (Main.tile[x, y + 1] == null) - { - Main.tile[x, y + 1] = new Tile(); - } - if ((!Main.tile[x, y].active && Main.tile[x, y + 1].active) && Main.tileTable[Main.tile[x, y + 1].type]) - { - flag = true; - } - if (((type == 0x4e) && !Main.tile[x, y].active) && (Main.tile[x, y + 1].active && Main.tileSolid[Main.tile[x, y + 1].type])) - { - flag = true; - } - if (flag) - { - Main.tile[x, y].active = true; - Main.tile[x, y].frameX = 0; - Main.tile[x, y].frameY = 0; - Main.tile[x, y].type = (byte) type; - if (type == 50) - { - Main.tile[x, y].frameX = (short) (0x12 * genRand.Next(5)); - } - } - } - - public static bool PlacePot(int x, int y, int type = 0x1c) - { - bool flag = true; - for (int i = x; i < (x + 2); i++) - { - for (int k = y - 1; k < (y + 1); k++) - { - if (Main.tile[i, k] == null) - { - Main.tile[i, k] = new Tile(); - } - if (Main.tile[i, k].active) - { - flag = false; - } - } - if (Main.tile[i, y + 1] == null) - { - Main.tile[i, y + 1] = new Tile(); - } - if (!Main.tile[i, y + 1].active || !Main.tileSolid[Main.tile[i, y + 1].type]) - { - flag = false; - } - } - if (!flag) - { - return false; - } - for (int j = 0; j < 2; j++) - { - for (int m = -1; m < 1; m++) - { - int num5 = (j * 0x12) + (genRand.Next(3) * 0x24); - int num6 = (m + 1) * 0x12; - Main.tile[x + j, y + m].active = true; - Main.tile[x + j, y + m].frameX = (short) num5; - Main.tile[x + j, y + m].frameY = (short) num6; - Main.tile[x + j, y + m].type = (byte) type; - } - } - return true; - } - - public static bool PlaceSign(int x, int y, int type) - { - int num7; - int num8; - int num9; - int num = x - 2; - int num2 = x + 3; - int num3 = y - 2; - int num4 = y + 3; - if (num >= 0) - { - if (num2 > Main.maxTilesX) - { - return false; - } - if (num3 < 0) - { - return false; - } - if (num4 > Main.maxTilesY) - { - return false; - } - for (int j = num; j < num2; j++) - { - for (int k = num3; k < num4; k++) - { - if (Main.tile[j, k] == null) - { - Main.tile[j, k] = new Tile(); - } - } - } - num7 = x; - num8 = y; - num9 = 0; - if ((Main.tile[x, y + 1].active && Main.tileSolid[Main.tile[x, y + 1].type]) && (Main.tile[x + 1, y + 1].active && Main.tileSolid[Main.tile[x + 1, y + 1].type])) - { - num8--; - num9 = 0; - goto Label_02E8; - } - if (((Main.tile[x, y - 1].active && Main.tileSolid[Main.tile[x, y - 1].type]) && (!Main.tileSolidTop[Main.tile[x, y - 1].type] && Main.tile[x + 1, y - 1].active)) && (Main.tileSolid[Main.tile[x + 1, y - 1].type] && !Main.tileSolidTop[Main.tile[x + 1, y - 1].type])) - { - num9 = 1; - goto Label_02E8; - } - if (((Main.tile[x - 1, y].active && Main.tileSolid[Main.tile[x - 1, y].type]) && (!Main.tileSolidTop[Main.tile[x - 1, y].type] && Main.tile[x - 1, y + 1].active)) && (Main.tileSolid[Main.tile[x - 1, y + 1].type] && !Main.tileSolidTop[Main.tile[x - 1, y + 1].type])) - { - num9 = 2; - goto Label_02E8; - } - if (((Main.tile[x + 1, y].active && Main.tileSolid[Main.tile[x + 1, y].type]) && (!Main.tileSolidTop[Main.tile[x + 1, y].type] && Main.tile[x + 1, y + 1].active)) && (Main.tileSolid[Main.tile[x + 1, y + 1].type] && !Main.tileSolidTop[Main.tile[x + 1, y + 1].type])) - { - num7--; - num9 = 3; - goto Label_02E8; - } - } - return false; - Label_02E8: - if ((Main.tile[num7, num8].active || Main.tile[num7 + 1, num8].active) || (Main.tile[num7, num8 + 1].active || Main.tile[num7 + 1, num8 + 1].active)) - { - return false; - } - int num10 = 0x24 * num9; - for (int i = 0; i < 2; i++) - { - for (int m = 0; m < 2; m++) - { - Main.tile[num7 + i, num8 + m].active = true; - Main.tile[num7 + i, num8 + m].type = (byte) type; - Main.tile[num7 + i, num8 + m].frameX = (short) (num10 + (0x12 * i)); - Main.tile[num7 + i, num8 + m].frameY = (short) (0x12 * m); - } - } - return true; - } - - public static void PlaceSunflower(int x, int y, int type = 0x1b) - { - if (y <= (Main.worldSurface - 1.0)) - { - bool flag = true; - for (int i = x; i < (x + 2); i++) - { - for (int j = y - 3; j < (y + 1); j++) - { - if (Main.tile[i, j] == null) - { - Main.tile[i, j] = new Tile(); - } - if (Main.tile[i, j].active || (Main.tile[i, j].wall > 0)) - { - flag = false; - } - } - if (Main.tile[i, y + 1] == null) - { - Main.tile[i, y + 1] = new Tile(); - } - if (!Main.tile[i, y + 1].active || (Main.tile[i, y + 1].type != 2)) - { - flag = false; - } - } - if (flag) - { - for (int k = 0; k < 2; k++) - { - for (int m = -3; m < 1; m++) - { - int num5 = (k * 0x12) + (genRand.Next(3) * 0x24); - int num6 = (m + 3) * 0x12; - Main.tile[x + k, y + m].active = true; - Main.tile[x + k, y + m].frameX = (short) num5; - Main.tile[x + k, y + m].frameY = (short) num6; - Main.tile[x + k, y + m].type = (byte) type; - } - } - } - } - } - - public static bool PlaceTile(int i, int j, int type, bool mute = false, bool forced = false, int plr = -1) - { - bool flag = false; - if (((i >= 0) && (j >= 0)) && ((i < Main.maxTilesX) && (j < Main.maxTilesY))) - { - if (Main.tile[i, j] == null) - { - Main.tile[i, j] = new Tile(); - } - if (((((!forced && !Collision.EmptyTile(i, j, false)) && Main.tileSolid[type]) && (((type != 0x17) || (Main.tile[i, j].type != 0)) || !Main.tile[i, j].active)) && (((type != 2) || (Main.tile[i, j].type != 0)) || !Main.tile[i, j].active)) && ((((type != 60) || (Main.tile[i, j].type != 0x3b)) || !Main.tile[i, j].active) && (((type != 70) || (Main.tile[i, j].type != 0x3b)) || !Main.tile[i, j].active))) - { - return flag; - } - if ((type == 0x17) && ((Main.tile[i, j].type != 0) || !Main.tile[i, j].active)) - { - return false; - } - if ((type == 2) && ((Main.tile[i, j].type != 0) || !Main.tile[i, j].active)) - { - return false; - } - if ((type == 60) && ((Main.tile[i, j].type != 0x3b) || !Main.tile[i, j].active)) - { - return false; - } - if ((Main.tile[i, j].liquid > 0) && ((((type == 3) || (type == 4)) || ((type == 20) || (type == 0x18))) || ((((type == 0x1b) || (type == 0x20)) || ((type == 0x33) || (type == 0x3d))) || (((type == 0x45) || (type == 0x48)) || (type == 0x49))))) - { - return false; - } - Main.tile[i, j].frameY = 0; - Main.tile[i, j].frameX = 0; - if ((type == 3) || (type == 0x18)) - { - if ((((j + 1) < Main.maxTilesY) && Main.tile[i, j + 1].active) && ((((Main.tile[i, j + 1].type == 2) && (type == 3)) || ((Main.tile[i, j + 1].type == 0x17) && (type == 0x18))) || ((Main.tile[i, j + 1].type == 0x4e) && (type == 3)))) - { - if ((type == 0x18) && (genRand.Next(13) == 0)) - { - Main.tile[i, j].active = true; - Main.tile[i, j].type = 0x20; - SquareTileFrame(i, j, true); - } - else if (Main.tile[i, j + 1].type == 0x4e) - { - Main.tile[i, j].active = true; - Main.tile[i, j].type = (byte) type; - Main.tile[i, j].frameX = (short) ((genRand.Next(2) * 0x12) + 0x6c); - } - else if ((Main.tile[i, j].wall == 0) && (Main.tile[i, j + 1].wall == 0)) - { - if (genRand.Next(50) == 0) - { - Main.tile[i, j].active = true; - Main.tile[i, j].type = (byte) type; - Main.tile[i, j].frameX = 0x90; - } - else if (genRand.Next(0x23) == 0) - { - Main.tile[i, j].active = true; - Main.tile[i, j].type = (byte) type; - Main.tile[i, j].frameX = (short) ((genRand.Next(2) * 0x12) + 0x6c); - } - else - { - Main.tile[i, j].active = true; - Main.tile[i, j].type = (byte) type; - Main.tile[i, j].frameX = (short) (genRand.Next(6) * 0x12); - } - } - } - } - else if (type == 0x3d) - { - if ((((j + 1) < Main.maxTilesY) && Main.tile[i, j + 1].active) && (Main.tile[i, j + 1].type == 60)) - { - if (genRand.Next(10) == 0) - { - Main.tile[i, j].active = true; - Main.tile[i, j].type = 0x45; - SquareTileFrame(i, j, true); - } - else if (genRand.Next(15) == 0) - { - Main.tile[i, j].active = true; - Main.tile[i, j].type = (byte) type; - Main.tile[i, j].frameX = 0x90; - } - else if (genRand.Next(0x3e8) == 0) - { - Main.tile[i, j].active = true; - Main.tile[i, j].type = (byte) type; - Main.tile[i, j].frameX = 0xa2; - } - else - { - Main.tile[i, j].active = true; - Main.tile[i, j].type = (byte) type; - Main.tile[i, j].frameX = (short) (genRand.Next(8) * 0x12); - } - } - } - else if (type == 0x47) - { - if ((((j + 1) < Main.maxTilesY) && Main.tile[i, j + 1].active) && (Main.tile[i, j + 1].type == 70)) - { - Main.tile[i, j].active = true; - Main.tile[i, j].type = (byte) type; - Main.tile[i, j].frameX = (short) (genRand.Next(5) * 0x12); - } - } - else if (type == 4) - { - if (Main.tile[i - 1, j] == null) - { - Main.tile[i - 1, j] = new Tile(); - } - if (Main.tile[i + 1, j] == null) - { - Main.tile[i + 1, j] = new Tile(); - } - if (Main.tile[i, j + 1] == null) - { - Main.tile[i, j + 1] = new Tile(); - } - if (((Main.tile[i - 1, j].active && (Main.tileSolid[Main.tile[i - 1, j].type] || (((Main.tile[i - 1, j].type == 5) && (Main.tile[i - 1, j - 1].type == 5)) && (Main.tile[i - 1, j + 1].type == 5)))) || (Main.tile[i + 1, j].active && (Main.tileSolid[Main.tile[i + 1, j].type] || (((Main.tile[i + 1, j].type == 5) && (Main.tile[i + 1, j - 1].type == 5)) && (Main.tile[i + 1, j + 1].type == 5))))) || (Main.tile[i, j + 1].active && Main.tileSolid[Main.tile[i, j + 1].type])) - { - Main.tile[i, j].active = true; - Main.tile[i, j].type = (byte) type; - SquareTileFrame(i, j, true); - } - } - else if (type == 10) - { - if (Main.tile[i, j - 1] == null) - { - Main.tile[i, j - 1] = new Tile(); - } - if (Main.tile[i, j - 2] == null) - { - Main.tile[i, j - 2] = new Tile(); - } - if (Main.tile[i, j - 3] == null) - { - Main.tile[i, j - 3] = new Tile(); - } - if (Main.tile[i, j + 1] == null) - { - Main.tile[i, j + 1] = new Tile(); - } - if (Main.tile[i, j + 2] == null) - { - Main.tile[i, j + 2] = new Tile(); - } - if (Main.tile[i, j + 3] == null) - { - Main.tile[i, j + 3] = new Tile(); - } - if ((Main.tile[i, j - 1].active || Main.tile[i, j - 2].active) || (!Main.tile[i, j - 3].active || !Main.tileSolid[Main.tile[i, j - 3].type])) - { - if ((Main.tile[i, j + 1].active || Main.tile[i, j + 2].active) || (!Main.tile[i, j + 3].active || !Main.tileSolid[Main.tile[i, j + 3].type])) - { - return false; - } - PlaceDoor(i, j + 1, type); - SquareTileFrame(i, j, true); - } - else - { - PlaceDoor(i, j - 1, type); - SquareTileFrame(i, j, true); - } - } - else if (((type == 0x22) || (type == 0x23)) || (type == 0x24)) - { - Place3x3(i, j, type); - SquareTileFrame(i, j, true); - } - else if (((type == 13) || (type == 0x21)) || (((type == 0x31) || (type == 50)) || (type == 0x4e))) - { - PlaceOnTable1x1(i, j, type); - SquareTileFrame(i, j, true); - } - else if ((type == 14) || (type == 0x1a)) - { - Place3x2(i, j, type); - SquareTileFrame(i, j, true); - } - else if (type == 20) - { - if (Main.tile[i, j + 1] == null) - { - Main.tile[i, j + 1] = new Tile(); - } - if (Main.tile[i, j + 1].active && (Main.tile[i, j + 1].type == 2)) - { - Place1x2(i, j, type); - SquareTileFrame(i, j, true); - } - } - else if (type == 15) - { - if (Main.tile[i, j - 1] == null) - { - Main.tile[i, j - 1] = new Tile(); - } - if (Main.tile[i, j] == null) - { - Main.tile[i, j] = new Tile(); - } - Place1x2(i, j, type); - SquareTileFrame(i, j, true); - } - else if (((type == 0x10) || (type == 0x12)) || (type == 0x1d)) - { - Place2x1(i, j, type); - SquareTileFrame(i, j, true); - } - else if ((type == 0x11) || (type == 0x4d)) - { - Place3x2(i, j, type); - SquareTileFrame(i, j, true); - } - else if (type == 0x15) - { - PlaceChest(i, j, type); - SquareTileFrame(i, j, true); - } - else if (type == 0x1b) - { - PlaceSunflower(i, j, 0x1b); - SquareTileFrame(i, j, true); - } - else if (type == 0x1c) - { - PlacePot(i, j, 0x1c); - SquareTileFrame(i, j, true); - } - else if (type == 0x2a) - { - Place1x2Top(i, j, type); - SquareTileFrame(i, j, true); - } - else if (type == 0x37) - { - PlaceSign(i, j, type); - } - else if (type == 0x4f) - { - int direction = 1; - if (plr > -1) - { - direction = Main.player[plr].direction; - } - Place4x2(i, j, type, direction); - } - else - { - Main.tile[i, j].active = true; - Main.tile[i, j].type = (byte) type; - } - if (Main.tile[i, j].active && !mute) - { - SquareTileFrame(i, j, true); - flag = true; - Main.PlaySound(0, i * 0x10, j * 0x10, 1); - if (type != 0x16) - { - return flag; - } - for (int k = 0; k < 3; k++) - { - Color newColor = new Color(); - Dust.NewDust(new Vector2((float) (i * 0x10), (float) (j * 0x10)), 0x10, 0x10, 14, 0f, 0f, 0, newColor, 1f); - } - } - } - return flag; - } - - public static void PlaceWall(int i, int j, int type, bool mute = false) - { - if (Main.tile[i, j] == null) - { - Main.tile[i, j] = new Tile(); - } - if (Main.tile[i, j].wall != type) - { - for (int k = i - 1; k < (i + 2); k++) - { - for (int m = j - 1; m < (j + 2); m++) - { - if (Main.tile[k, m] == null) - { - Main.tile[k, m] = new Tile(); - } - if ((Main.tile[k, m].wall > 0) && (Main.tile[k, m].wall != type)) - { - return; - } - } - } - Main.tile[i, j].wall = (byte) type; - SquareWallFrame(i, j, true); - if (!mute) - { - Main.PlaySound(0, i * 0x10, j * 0x10, 1); - } - } - } - - public static void PlantCheck(int i, int j) - { - int num = -1; - int type = Main.tile[i, j].type; - int num1 = i - 1; - int maxTilesX = Main.maxTilesX; - int num4 = i + 1; - int num5 = j - 1; - if ((j + 1) >= Main.maxTilesY) - { - num = type; - } - if ((((i - 1) >= 0) && (Main.tile[i - 1, j] != null)) && Main.tile[i - 1, j].active) - { - byte num6 = Main.tile[i - 1, j].type; - } - if ((((i + 1) < Main.maxTilesX) && (Main.tile[i + 1, j] != null)) && Main.tile[i + 1, j].active) - { - byte num7 = Main.tile[i + 1, j].type; - } - if ((((j - 1) >= 0) && (Main.tile[i, j - 1] != null)) && Main.tile[i, j - 1].active) - { - byte num8 = Main.tile[i, j - 1].type; - } - if ((((j + 1) < Main.maxTilesY) && (Main.tile[i, j + 1] != null)) && Main.tile[i, j + 1].active) - { - num = Main.tile[i, j + 1].type; - } - if ((((i - 1) >= 0) && ((j - 1) >= 0)) && ((Main.tile[i - 1, j - 1] != null) && Main.tile[i - 1, j - 1].active)) - { - byte num9 = Main.tile[i - 1, j - 1].type; - } - if ((((i + 1) < Main.maxTilesX) && ((j - 1) >= 0)) && ((Main.tile[i + 1, j - 1] != null) && Main.tile[i + 1, j - 1].active)) - { - byte num10 = Main.tile[i + 1, j - 1].type; - } - if ((((i - 1) >= 0) && ((j + 1) < Main.maxTilesY)) && ((Main.tile[i - 1, j + 1] != null) && Main.tile[i - 1, j + 1].active)) - { - byte num11 = Main.tile[i - 1, j + 1].type; - } - if ((((i + 1) < Main.maxTilesX) && ((j + 1) < Main.maxTilesY)) && ((Main.tile[i + 1, j + 1] != null) && Main.tile[i + 1, j + 1].active)) - { - byte num12 = Main.tile[i + 1, j + 1].type; - } - if ((((((type == 3) && (num != 2)) && (num != 0x4e)) || ((type == 0x18) && (num != 0x17))) || (((type == 0x3d) && (num != 60)) || ((type == 0x47) && (num != 70)))) || ((((type == 0x49) && (num != 2)) && (num != 0x4e)) || ((type == 0x4a) && (num != 60)))) - { - KillTile(i, j, false, false, false); - } - } - - public static bool PlayerLOS(int x, int y) - { - Rectangle rectangle = new Rectangle(x * 0x10, y * 0x10, 0x10, 0x10); - for (int i = 0; i < 8; i++) - { - if (Main.player[i].active) - { - Rectangle rectangle2 = new Rectangle((int) ((Main.player[i].position.X + (Main.player[i].width * 0.5)) - (Main.screenWidth * 0.6)), (int) ((Main.player[i].position.Y + (Main.player[i].height * 0.5)) - (Main.screenHeight * 0.6)), (int) (Main.screenWidth * 1.2), (int) (Main.screenHeight * 1.2)); - if (rectangle.Intersects(rectangle2)) - { - return true; - } - } - } - return false; - } - - public static void playWorld() - { - ThreadPool.QueueUserWorkItem(new WaitCallback(WorldGen.playWorldCallBack), 1); - } - - public static void playWorldCallBack(object threadContext) - { - if (Main.rand == null) - { - Main.rand = new Random((int) DateTime.Now.Ticks); - } - for (int i = 0; i < 8; i++) - { - if (i != Main.myPlayer) - { - Main.player[i].active = false; - } - } - loadWorld(); - if (!loadFailed) - { - EveryTileFrame(); - if (Main.gameMenu) - { - Main.gameMenu = false; - } - Main.player[Main.myPlayer].Spawn(); - Main.player[Main.myPlayer].UpdatePlayer(Main.myPlayer); - Main.dayTime = tempDayTime; - Main.time = tempTime; - Main.moonPhase = tempMoonPhase; - Main.bloodMoon = tempBloodMoon; - Main.PlaySound(11, -1, -1, 1); - Main.resetClouds = true; - } - } - - public static void QuickFindHome(int npc) - { - if (((Main.npc[npc].homeTileX > 10) && (Main.npc[npc].homeTileY > 10)) && ((Main.npc[npc].homeTileX < (Main.maxTilesX - 10)) && (Main.npc[npc].homeTileY < Main.maxTilesY))) - { - canSpawn = false; - StartRoomCheck(Main.npc[npc].homeTileX, Main.npc[npc].homeTileY - 1); - if (!canSpawn) - { - for (int i = Main.npc[npc].homeTileX - 1; i < (Main.npc[npc].homeTileX + 2); i++) - { - for (int j = Main.npc[npc].homeTileY - 1; j < (Main.npc[npc].homeTileY + 2); j++) - { - if (StartRoomCheck(i, j)) - { - break; - } - } - } - } - if (!canSpawn) - { - int num3 = 10; - for (int k = Main.npc[npc].homeTileX - num3; k <= (Main.npc[npc].homeTileX + num3); k += 2) - { - for (int m = Main.npc[npc].homeTileY - num3; m <= (Main.npc[npc].homeTileY + num3); m += 2) - { - if (StartRoomCheck(k, m)) - { - break; - } - } - } - } - if (canSpawn) - { - RoomNeeds(Main.npc[npc].type); - if (canSpawn) - { - ScoreRoom(npc); - } - if (canSpawn && (hiScore > 0)) - { - Main.npc[npc].homeTileX = bestX; - Main.npc[npc].homeTileY = bestY; - Main.npc[npc].homeless = false; - canSpawn = false; - } - else - { - Main.npc[npc].homeless = true; - } - } - else - { - Main.npc[npc].homeless = true; - } - } - } - - public static void RangeFrame(int startX, int startY, int endX, int endY) - { - int num = startX; - int num2 = endX + 1; - int num3 = startY; - int num4 = endY + 1; - for (int i = num - 1; i < (num2 + 1); i++) - { - for (int j = num3 - 1; j < (num4 + 1); j++) - { - TileFrame(i, j, false, false); - WallFrame(i, j, false); - } - } - } - - public static bool RoomNeeds(int npcType) - { - if (((houseTile[15] && (houseTile[14] || houseTile[0x12])) && (((houseTile[4] || houseTile[0x21]) || (houseTile[0x22] || houseTile[0x23])) || ((houseTile[0x24] || houseTile[0x2a]) || houseTile[0x31]))) && ((houseTile[10] || houseTile[11]) || houseTile[0x13])) - { - canSpawn = true; - } - else - { - canSpawn = false; - } - return canSpawn; - } - - public static void saveAndPlay() - { - ThreadPool.QueueUserWorkItem(new WaitCallback(WorldGen.saveAndPlayCallBack), 1); - } - - public static void saveAndPlayCallBack(object threadContext) - { - saveWorld(false); - } - - public static void SaveAndQuit() - { - Main.PlaySound(11, -1, -1, 1); - ThreadPool.QueueUserWorkItem(new WaitCallback(WorldGen.SaveAndQuitCallBack), 1); - } - - public static void SaveAndQuitCallBack(object threadContext) - { - Main.menuMode = 10; - Main.gameMenu = true; - Player.SavePlayer(Main.player[Main.myPlayer], Main.playerPathName); - if (Main.netMode == 0) - { - saveWorld(false); - Main.PlaySound(10, -1, -1, 1); - } - else - { - Netplay.disconnect = true; - Main.netMode = 0; - } - Main.menuMode = 0; - } - - public static void saveToonWhilePlaying() - { - ThreadPool.QueueUserWorkItem(new WaitCallback(WorldGen.saveToonWhilePlayingCallBack), 1); - } - - public static void saveToonWhilePlayingCallBack(object threadContext) - { - Player.SavePlayer(Main.player[Main.myPlayer], Main.playerPathName); - } - - public static void saveWorld(bool resetTime = false) - { - if (!saveLock) - { - saveLock = true; - if (!Main.skipMenu) - { - bool dayTime = Main.dayTime; - tempTime = Main.time; - tempMoonPhase = Main.moonPhase; - tempBloodMoon = Main.bloodMoon; - if (resetTime) - { - dayTime = true; - tempTime = 13500.0; - tempMoonPhase = 0; - tempBloodMoon = false; - } - if (Main.worldPathName != null) - { - string path = Main.worldPathName + ".sav"; - using (FileStream stream = new FileStream(path, FileMode.Create)) - { - using (BinaryWriter writer = new BinaryWriter(stream)) - { - writer.Write(Main.curRelease); - writer.Write(Main.worldName); - writer.Write(Main.worldID); - writer.Write((int) Main.leftWorld); - writer.Write((int) Main.rightWorld); - writer.Write((int) Main.topWorld); - writer.Write((int) Main.bottomWorld); - writer.Write(Main.maxTilesY); - writer.Write(Main.maxTilesX); - writer.Write(Main.spawnTileX); - writer.Write(Main.spawnTileY); - writer.Write(Main.worldSurface); - writer.Write(Main.rockLayer); - writer.Write(tempTime); - writer.Write(dayTime); - writer.Write(tempMoonPhase); - writer.Write(tempBloodMoon); - writer.Write(Main.dungeonX); - writer.Write(Main.dungeonY); - writer.Write(NPC.downedBoss1); - writer.Write(NPC.downedBoss2); - writer.Write(NPC.downedBoss3); - writer.Write(shadowOrbSmashed); - writer.Write(spawnMeteor); - writer.Write((byte) shadowOrbCount); - writer.Write(Main.invasionDelay); - writer.Write(Main.invasionSize); - writer.Write(Main.invasionType); - writer.Write(Main.invasionX); - for (int i = 0; i < Main.maxTilesX; i++) - { - float num2 = ((float) i) / ((float) Main.maxTilesX); - Main.statusText = "Saving world data: " + ((int) ((num2 * 100f) + 1f)) + "%"; - for (int n = 0; n < Main.maxTilesY; n++) - { - writer.Write(Main.tile[i, n].active); - if (Main.tile[i, n].active) - { - writer.Write(Main.tile[i, n].type); - if (Main.tileFrameImportant[Main.tile[i, n].type]) - { - writer.Write(Main.tile[i, n].frameX); - writer.Write(Main.tile[i, n].frameY); - } - } - writer.Write(Main.tile[i, n].lighted); - if (Main.tile[i, n].wall > 0) - { - writer.Write(true); - writer.Write(Main.tile[i, n].wall); - } - else - { - writer.Write(false); - } - if (Main.tile[i, n].liquid > 0) - { - writer.Write(true); - writer.Write(Main.tile[i, n].liquid); - writer.Write(Main.tile[i, n].lava); - } - else - { - writer.Write(false); - } - } - } - for (int j = 0; j < 0x3e8; j++) - { - if (Main.chest[j] == null) - { - writer.Write(false); - } - else - { - writer.Write(true); - writer.Write(Main.chest[j].x); - writer.Write(Main.chest[j].y); - for (int num5 = 0; num5 < Chest.maxItems; num5++) - { - writer.Write((byte) Main.chest[j].item[num5].stack); - if (Main.chest[j].item[num5].stack > 0) - { - writer.Write(Main.chest[j].item[num5].name != null ? Main.chest[j].item[num5].name : ""); - } - } - } - } - for (int k = 0; k < 0x3e8; k++) - { - if ((Main.sign[k] == null) || (Main.sign[k].text == null)) - { - writer.Write(false); - } - else - { - writer.Write(true); - writer.Write(Main.sign[k].text); - writer.Write(Main.sign[k].x); - writer.Write(Main.sign[k].y); - } - } - for (int m = 0; m < 0x3e8; m++) - { - lock (Main.npc[m]) - { - if (Main.npc[m].active && Main.npc[m].townNPC) - { - writer.Write(true); - writer.Write(Main.npc[m].name); - writer.Write(Main.npc[m].position.X); - writer.Write(Main.npc[m].position.Y); - writer.Write(Main.npc[m].homeless); - writer.Write(Main.npc[m].homeTileX); - writer.Write(Main.npc[m].homeTileY); - } - } - } - writer.Write(false); - writer.Close(); - Main.statusText = "Backing up world file..."; - string destFileName = Main.worldPathName + ".bak"; - if (File.Exists(Main.worldPathName)) - { - File.Copy(Main.worldPathName, destFileName, true); - } - File.Copy(path, Main.worldPathName, true); - File.Delete(path); - } - } - saveLock = false; - } - } - } - } - - public static void ScoreRoom(int ignoreNPC = -1) - { - for (int i = 0; i < 0x3e8; i++) - { - if ((Main.npc[i].active && Main.npc[i].townNPC) && ((ignoreNPC != i) && !Main.npc[i].homeless)) - { - for (int k = 0; k < numRoomTiles; k++) - { - if ((Main.npc[i].homeTileX == roomX[k]) && (Main.npc[i].homeTileY == roomY[k])) - { - bool flag = false; - for (int m = 0; m < numRoomTiles; m++) - { - if ((Main.npc[i].homeTileX == roomX[m]) && ((Main.npc[i].homeTileY - 1) == roomY[m])) - { - flag = true; - break; - } - } - if (flag) - { - hiScore = -1; - return; - } - } - } - } - } - hiScore = 0; - int num4 = 0; - int num5 = 0; - int num6 = 0; - int num7 = ((roomX1 - ((Main.screenWidth / 2) / 0x10)) - 1) - 0x15; - int num8 = ((roomX2 + ((Main.screenWidth / 2) / 0x10)) + 1) + 0x15; - int num9 = ((roomY1 - ((Main.screenHeight / 2) / 0x10)) - 1) - 0x15; - int maxTilesX = ((roomY2 + ((Main.screenHeight / 2) / 0x10)) + 1) + 0x15; - if (num7 < 0) - { - num7 = 0; - } - if (num8 >= Main.maxTilesX) - { - num8 = Main.maxTilesX - 1; - } - if (num9 < 0) - { - num9 = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - for (int j = num7 + 1; j < num8; j++) - { - for (int n = num9 + 2; n < (maxTilesX + 2); n++) - { - if (Main.tile[j, n].active) - { - if (((Main.tile[j, n].type == 0x17) || (Main.tile[j, n].type == 0x18)) || ((Main.tile[j, n].type == 0x19) || (Main.tile[j, n].type == 0x20))) - { - Main.evilTiles++; - } - else if (Main.tile[j, n].type == 0x1b) - { - Main.evilTiles -= 5; - } - } - } - } - if (num6 < 50) - { - num6 = 0; - } - num5 = -num6; - if (num5 <= -250) - { - hiScore = num5; - } - else - { - num7 = roomX1; - num8 = roomX2; - num9 = roomY1; - maxTilesX = roomY2; - for (int num13 = num7 + 1; num13 < num8; num13++) - { - for (int num14 = num9 + 2; num14 < (maxTilesX + 2); num14++) - { - if (!Main.tile[num13, num14].active) - { - continue; - } - num4 = num5; - if (((Main.tileSolid[Main.tile[num13, num14].type] && !Main.tileSolidTop[Main.tile[num13, num14].type]) && (!Collision.SolidTiles(num13 - 1, num13 + 1, num14 - 3, num14 - 1) && Main.tile[num13 - 1, num14].active)) && ((Main.tileSolid[Main.tile[num13 - 1, num14].type] && Main.tile[num13 + 1, num14].active) && Main.tileSolid[Main.tile[num13 + 1, num14].type])) - { - for (int num15 = num13 - 2; num15 < (num13 + 3); num15++) - { - for (int num16 = num14 - 4; num16 < num14; num16++) - { - if (Main.tile[num15, num16].active) - { - if (num15 == num13) - { - num4 -= 15; - } - else if ((Main.tile[num15, num16].type == 10) || (Main.tile[num15, num16].type == 11)) - { - num4 -= 20; - } - else if (Main.tileSolid[Main.tile[num15, num16].type]) - { - num4 -= 5; - } - else - { - num4 += 5; - } - } - } - } - if (num4 > hiScore) - { - bool flag2 = false; - for (int num17 = 0; num17 < numRoomTiles; num17++) - { - if ((roomX[num17] == num13) && (roomY[num17] == num14)) - { - flag2 = true; - break; - } - } - if (flag2) - { - hiScore = num4; - bestX = num13; - bestY = num14; - } - } - } - } - } - } - } - - public static void SectionTileFrame(int startX, int startY, int endX, int endY) - { - int num = startX * 200; - int num2 = (endX + 1) * 200; - int num3 = startY * 150; - int num4 = (endY + 1) * 150; - if (num < 1) - { - num = 1; - } - if (num3 < 1) - { - num3 = 1; - } - if (num > (Main.maxTilesX - 2)) - { - num = Main.maxTilesX - 2; - } - if (num3 > (Main.maxTilesY - 2)) - { - num3 = Main.maxTilesY - 2; - } - for (int i = num - 1; i < (num2 + 1); i++) - { - for (int j = num3 - 1; j < (num4 + 1); j++) - { - if (Main.tile[i, j] == null) - { - Main.tile[i, j] = new Tile(); - } - TileFrame(i, j, true, true); - WallFrame(i, j, true); - } - } - } - - public static void serverLoadWorld() - { - ThreadPool.QueueUserWorkItem(new WaitCallback(WorldGen.serverLoadWorldCallBack), 1); - if (ShankShock.infinateInvasion) { Main.startInv(); } - } - - public static void serverLoadWorldCallBack(object threadContext) - { - loadWorld(); - if (!loadFailed) - { - Main.PlaySound(10, -1, -1, 1); - Netplay.StartServer(); - Main.dayTime = tempDayTime; - Main.time = tempTime; - Main.moonPhase = tempMoonPhase; - Main.bloodMoon = tempBloodMoon; - } - } - - public static void setWorldSize() - { - Main.bottomWorld = Main.maxTilesY * 0x10; - Main.rightWorld = Main.maxTilesX * 0x10; - Main.maxSectionsX = Main.maxTilesX / 200; - Main.maxSectionsY = Main.maxTilesY / 150; - } - - public static void ShroomPatch(int i, int j) - { - Vector2 vector; - Vector2 vector2; - double num5 = genRand.Next(40, 70); - double num6 = num5; - float num7 = genRand.Next(10, 20); - if (genRand.Next(5) == 0) - { - num5 *= 1.5; - num6 *= 1.5; - num7 *= 1.2f; - } - vector.X = i; - vector.Y = j - (num7 * 0.3f); - vector2.X = genRand.Next(-10, 11) * 0.1f; - vector2.Y = genRand.Next(-20, -10) * 0.1f; - while ((num5 > 0.0) && (num7 > 0f)) - { - num5 -= genRand.Next(3); - num7--; - int num = (int) (vector.X - (num5 * 0.5)); - int maxTilesX = (int) (vector.X + (num5 * 0.5)); - int num2 = (int) (vector.Y - (num5 * 0.5)); - int maxTilesY = (int) (vector.Y + (num5 * 0.5)); - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num2 < 0) - { - num2 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - num6 = (num5 * genRand.Next(80, 120)) * 0.01; - for (int k = num; k < maxTilesX; k++) - { - for (int m = num2; m < maxTilesY; m++) - { - float num10 = Math.Abs((float) (k - vector.X)); - float num11 = Math.Abs((float) ((m - vector.Y) * 2.3f)); - if (Math.Sqrt((double) ((num10 * num10) + (num11 * num11))) < (num6 * 0.4)) - { - if (m < (vector.Y + (num6 * 0.05))) - { - if (Main.tile[k, m].type != 0x3b) - { - Main.tile[k, m].active = false; - } - } - else - { - Main.tile[k, m].type = 0x3b; - } - Main.tile[k, m].liquid = 0; - Main.tile[k, m].lava = false; - } - } - } - vector += vector2; - vector2.X += genRand.Next(-10, 11) * 0.05f; - vector2.Y += genRand.Next(-10, 11) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 0.1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if (vector2.Y > 1f) - { - vector2.Y = 1f; - } - if (vector2.Y < -1f) - { - vector2.Y = -1f; - } - } - } - - public static void SpawnNPC(int x, int y) - { - if (Main.wallHouse[Main.tile[x, y].wall]) - { - canSpawn = true; - } - if ((canSpawn && StartRoomCheck(x, y)) && RoomNeeds(spawnNPC)) - { - ScoreRoom(-1); - if (hiScore > 0) - { - int index = -1; - for (int i = 0; i < 0x3e8; i++) - { - if ((Main.npc[i].active && Main.npc[i].homeless) && (Main.npc[i].type == spawnNPC)) - { - index = i; - break; - } - } - if (index != -1) - { - spawnNPC = 0; - Main.npc[index].homeTileX = WorldGen.bestX; - Main.npc[index].homeTileY = WorldGen.bestY; - Main.npc[index].homeless = false; - } - else - { - int bestX = WorldGen.bestX; - int bestY = WorldGen.bestY; - bool flag = false; - if (!flag) - { - flag = true; - Rectangle rectangle = new Rectangle((((bestX * 0x10) + 8) - (Main.screenWidth / 2)) - NPC.safeRangeX, (((bestY * 0x10) + 8) - (Main.screenHeight / 2)) - NPC.safeRangeY, Main.screenWidth + (NPC.safeRangeX * 2), Main.screenHeight + (NPC.safeRangeY * 2)); - for (int j = 0; j < 8; j++) - { - if (Main.player[j].active) - { - Rectangle rectangle2 = new Rectangle((int) Main.player[j].position.X, (int) Main.player[j].position.Y, Main.player[j].width, Main.player[j].height); - if (rectangle2.Intersects(rectangle)) - { - flag = false; - break; - } - } - } - } - if (!flag) - { - for (int k = 1; k < 500; k++) - { - for (int m = 0; m < 2; m++) - { - if (m == 0) - { - bestX = WorldGen.bestX + k; - } - else - { - bestX = WorldGen.bestX - k; - } - if ((bestX > 10) && (bestX < (Main.maxTilesX - 10))) - { - int num8 = WorldGen.bestY - k; - double worldSurface = WorldGen.bestY + k; - if (num8 < 10) - { - num8 = 10; - } - if (worldSurface > Main.worldSurface) - { - worldSurface = Main.worldSurface; - } - for (int n = num8; n < worldSurface; n++) - { - bestY = n; - if (Main.tile[bestX, bestY].active && Main.tileSolid[Main.tile[bestX, bestY].type]) - { - if (!Collision.SolidTiles(bestX - 1, bestX + 1, bestY - 3, bestY - 1)) - { - flag = true; - Rectangle rectangle3 = new Rectangle((((bestX * 0x10) + 8) - (Main.screenWidth / 2)) - NPC.safeRangeX, (((bestY * 0x10) + 8) - (Main.screenHeight / 2)) - NPC.safeRangeY, Main.screenWidth + (NPC.safeRangeX * 2), Main.screenHeight + (NPC.safeRangeY * 2)); - for (int num11 = 0; num11 < 8; num11++) - { - if (Main.player[num11].active) - { - Rectangle rectangle4 = new Rectangle((int) Main.player[num11].position.X, (int) Main.player[num11].position.Y, Main.player[num11].width, Main.player[num11].height); - if (rectangle4.Intersects(rectangle3)) - { - flag = false; - break; - } - } - } - } - break; - } - } - } - if (flag) - { - break; - } - } - if (flag) - { - break; - } - } - } - int num12 = NPC.NewNPC(bestX * 0x10, bestY * 0x10, spawnNPC, 1); - Main.npc[num12].homeTileX = WorldGen.bestX; - Main.npc[num12].homeTileY = WorldGen.bestY; - if (bestX < WorldGen.bestX) - { - Main.npc[num12].direction = 1; - } - else if (bestX > WorldGen.bestX) - { - Main.npc[num12].direction = -1; - } - Main.npc[num12].netUpdate = true; - if (Main.netMode == 0) - { - Main.NewText(Main.npc[num12].name + " has arrived!", 50, 0x7d, 0xff); - } - else if (Main.netMode == 2) - { - if (Main.npc[num12].name == "") { return; } - NetMessage.SendData(0x19, -1, -1, Main.npc[num12].name + " has arrived!", 8, 50f, 125f, 255f); - } - } - spawnNPC = 0; - } - } - } - - public static void SpreadGrass(int i, int j, int dirt = 0, int grass = 2, bool repeat = true) - { - if (((Main.tile[i, j].type == dirt) && Main.tile[i, j].active) && ((j < Main.worldSurface) || (dirt == 0x3b))) - { - int num = i - 1; - int maxTilesX = i + 2; - int num3 = j - 1; - int maxTilesY = j + 2; - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num3 < 0) - { - num3 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - bool flag = true; - for (int k = num; k < maxTilesX; k++) - { - for (int m = num3; m < maxTilesY; m++) - { - if (!Main.tile[k, m].active || !Main.tileSolid[Main.tile[k, m].type]) - { - flag = false; - goto Label_00BB; - } - } - Label_00BB:; - } - if (!flag && ((grass != 0x17) || (Main.tile[i, j - 1].type != 0x1b))) - { - Main.tile[i, j].type = (byte) grass; - for (int n = num; n < maxTilesX; n++) - { - for (int num8 = num3; num8 < maxTilesY; num8++) - { - if ((Main.tile[n, num8].active && (Main.tile[n, num8].type == dirt)) && repeat) - { - SpreadGrass(n, num8, dirt, grass, true); - } - } - } - } - } - } - - public static void SquareTileFrame(int i, int j, bool resetFrame = true) - { - TileFrame(i - 1, j - 1, false, false); - TileFrame(i - 1, j, false, false); - TileFrame(i - 1, j + 1, false, false); - TileFrame(i, j - 1, false, false); - TileFrame(i, j, resetFrame, false); - TileFrame(i, j + 1, false, false); - TileFrame(i + 1, j - 1, false, false); - TileFrame(i + 1, j, false, false); - TileFrame(i + 1, j + 1, false, false); - } - - public static void SquareWallFrame(int i, int j, bool resetFrame = true) - { - WallFrame(i - 1, j - 1, false); - WallFrame(i - 1, j, false); - WallFrame(i - 1, j + 1, false); - WallFrame(i, j - 1, false); - WallFrame(i, j, resetFrame); - WallFrame(i, j + 1, false); - WallFrame(i + 1, j - 1, false); - WallFrame(i + 1, j, false); - WallFrame(i + 1, j + 1, false); - } - - public static bool StartRoomCheck(int x, int y) - { - roomX1 = x; - roomX2 = x; - roomY1 = y; - roomY2 = y; - numRoomTiles = 0; - for (int i = 0; i < 80; i++) - { - houseTile[i] = false; - } - canSpawn = true; - if (Main.tile[x, y].active && Main.tileSolid[Main.tile[x, y].type]) - { - canSpawn = false; - } - CheckRoom(x, y); - if (numRoomTiles < 60) - { - canSpawn = false; - } - return canSpawn; - } - - public static void TileFrame(int i, int j, bool resetFrame = false, bool noBreak = false) - { - if ((((i >= 0) && (j >= 0)) && ((i < Main.maxTilesX) && (j < Main.maxTilesY))) && (Main.tile[i, j] != null)) - { - if (((Main.tile[i, j].liquid > 0) && (Main.netMode != 1)) && !noLiquidCheck) - { - Liquid.AddWater(i, j); - } - if (Main.tile[i, j].active && (!noBreak || !Main.tileFrameImportant[Main.tile[i, j].type])) - { - Rectangle rectangle; - int index = -1; - int num2 = -1; - int num3 = -1; - int num4 = -1; - int num5 = -1; - int num6 = -1; - int num7 = -1; - int num8 = -1; - int type = Main.tile[i, j].type; - if (Main.tileStone[type]) - { - type = 1; - } - int frameX = Main.tile[i, j].frameX; - int frameY = Main.tile[i, j].frameY; - rectangle.X = -1; - rectangle.Y = -1; - if ((((type == 3) || (type == 0x18)) || ((type == 0x3d) || (type == 0x47))) || ((type == 0x49) || (type == 0x4a))) - { - PlantCheck(i, j); - } - else - { - WorldGen.mergeUp = false; - WorldGen.mergeDown = false; - WorldGen.mergeLeft = false; - WorldGen.mergeRight = false; - if ((i - 1) < 0) - { - index = type; - num4 = type; - num6 = type; - } - if ((i + 1) >= Main.maxTilesX) - { - num3 = type; - num5 = type; - num8 = type; - } - if ((j - 1) < 0) - { - index = type; - num2 = type; - num3 = type; - } - if ((j + 1) >= Main.maxTilesY) - { - num6 = type; - num7 = type; - num8 = type; - } - if ((((i - 1) >= 0) && (Main.tile[i - 1, j] != null)) && Main.tile[i - 1, j].active) - { - num4 = Main.tile[i - 1, j].type; - } - if ((((i + 1) < Main.maxTilesX) && (Main.tile[i + 1, j] != null)) && Main.tile[i + 1, j].active) - { - num5 = Main.tile[i + 1, j].type; - } - if ((((j - 1) >= 0) && (Main.tile[i, j - 1] != null)) && Main.tile[i, j - 1].active) - { - num2 = Main.tile[i, j - 1].type; - } - if ((((j + 1) < Main.maxTilesY) && (Main.tile[i, j + 1] != null)) && Main.tile[i, j + 1].active) - { - num7 = Main.tile[i, j + 1].type; - } - if ((((i - 1) >= 0) && ((j - 1) >= 0)) && ((Main.tile[i - 1, j - 1] != null) && Main.tile[i - 1, j - 1].active)) - { - index = Main.tile[i - 1, j - 1].type; - } - if ((((i + 1) < Main.maxTilesX) && ((j - 1) >= 0)) && ((Main.tile[i + 1, j - 1] != null) && Main.tile[i + 1, j - 1].active)) - { - num3 = Main.tile[i + 1, j - 1].type; - } - if ((((i - 1) >= 0) && ((j + 1) < Main.maxTilesY)) && ((Main.tile[i - 1, j + 1] != null) && Main.tile[i - 1, j + 1].active)) - { - num6 = Main.tile[i - 1, j + 1].type; - } - if ((((i + 1) < Main.maxTilesX) && ((j + 1) < Main.maxTilesY)) && ((Main.tile[i + 1, j + 1] != null) && Main.tile[i + 1, j + 1].active)) - { - num8 = Main.tile[i + 1, j + 1].type; - } - if ((num4 >= 0) && Main.tileStone[num4]) - { - num4 = 1; - } - if ((num5 >= 0) && Main.tileStone[num5]) - { - num5 = 1; - } - if ((num2 >= 0) && Main.tileStone[num2]) - { - num2 = 1; - } - if ((num7 >= 0) && Main.tileStone[num7]) - { - num7 = 1; - } - if ((index >= 0) && Main.tileStone[index]) - { - index = 1; - } - if ((num3 >= 0) && Main.tileStone[num3]) - { - num3 = 1; - } - if ((num6 >= 0) && Main.tileStone[num6]) - { - num6 = 1; - } - if ((num8 >= 0) && Main.tileStone[num8]) - { - num8 = 1; - } - if (type == 4) - { - if (((num7 >= 0) && Main.tileSolid[num7]) && !Main.tileNoAttach[num7]) - { - Main.tile[i, j].frameX = 0; - } - else if ((((num4 >= 0) && Main.tileSolid[num4]) && !Main.tileNoAttach[num4]) || (((num4 == 5) && (index == 5)) && (num6 == 5))) - { - Main.tile[i, j].frameX = 0x16; - } - else if ((((num5 >= 0) && Main.tileSolid[num5]) && !Main.tileNoAttach[num5]) || (((num5 == 5) && (num3 == 5)) && (num8 == 5))) - { - Main.tile[i, j].frameX = 0x2c; - } - else - { - KillTile(i, j, false, false, false); - } - } - else if ((type == 12) || (type == 0x1f)) - { - if (!destroyObject) - { - int num12 = i; - int num13 = j; - if (Main.tile[i, j].frameX == 0) - { - num12 = i; - } - else - { - num12 = i - 1; - } - if (Main.tile[i, j].frameY == 0) - { - num13 = j; - } - else - { - num13 = j - 1; - } - if ((((Main.tile[num12, num13] != null) && (Main.tile[num12 + 1, num13] != null)) && ((Main.tile[num12, num13 + 1] != null) && (Main.tile[num12 + 1, num13 + 1] != null))) && (((!Main.tile[num12, num13].active || (Main.tile[num12, num13].type != type)) || (!Main.tile[num12 + 1, num13].active || (Main.tile[num12 + 1, num13].type != type))) || ((!Main.tile[num12, num13 + 1].active || (Main.tile[num12, num13 + 1].type != type)) || (!Main.tile[num12 + 1, num13 + 1].active || (Main.tile[num12 + 1, num13 + 1].type != type))))) - { - destroyObject = true; - if (Main.tile[num12, num13].type == type) - { - KillTile(num12, num13, false, false, false); - } - if (Main.tile[num12 + 1, num13].type == type) - { - KillTile(num12 + 1, num13, false, false, false); - } - if (Main.tile[num12, num13 + 1].type == type) - { - KillTile(num12, num13 + 1, false, false, false); - } - if (Main.tile[num12 + 1, num13 + 1].type == type) - { - KillTile(num12 + 1, num13 + 1, false, false, false); - } - if (type == 12) - { - Item.NewItem(num12 * 0x10, num13 * 0x10, 0x20, 0x20, 0x1d, 1, false); - } - else if (type == 0x1f) - { - if (genRand.Next(2) == 0) - { - spawnMeteor = true; - } - int num14 = Main.rand.Next(5); - if (!shadowOrbSmashed) - { - num14 = 0; - } - if (num14 == 0) - { - Item.NewItem(num12 * 0x10, num13 * 0x10, 0x20, 0x20, 0x60, 1, false); - int stack = genRand.Next(0x19, 0x33); - Item.NewItem(num12 * 0x10, num13 * 0x10, 0x20, 0x20, 0x61, stack, false); - } - else if (num14 == 1) - { - Item.NewItem(num12 * 0x10, num13 * 0x10, 0x20, 0x20, 0x40, 1, false); - } - else if (num14 == 2) - { - Item.NewItem(num12 * 0x10, num13 * 0x10, 0x20, 0x20, 0xa2, 1, false); - } - else if (num14 == 3) - { - Item.NewItem(num12 * 0x10, num13 * 0x10, 0x20, 0x20, 0x73, 1, false); - } - else if (num14 == 4) - { - Item.NewItem(num12 * 0x10, num13 * 0x10, 0x20, 0x20, 0x6f, 1, false); - } - shadowOrbSmashed = true; - shadowOrbCount++; - if (shadowOrbCount >= 3) - { - shadowOrbCount = 0; - float num16 = num12 * 0x10; - float num17 = num13 * 0x10; - float num18 = -1f; - int plr = 0; - for (int k = 0; k < 8; k++) - { - float num21 = Math.Abs((float) (Main.player[k].position.X - num16)) + Math.Abs((float) (Main.player[k].position.Y - num17)); - if ((num21 < num18) || (num18 == -1f)) - { - plr = 0; - num18 = num21; - } - } - NPC.SpawnOnPlayer(plr, 13); - } - else - { - string newText = "A horrible chill goes down your spine..."; - if (shadowOrbCount == 2) - { - newText = "Screams echo around you..."; - } - if (Main.netMode == 0) - { - Main.NewText(newText, 50, 0xff, 130); - } - else if (Main.netMode == 2) - { - NetMessage.SendData(0x19, -1, -1, newText, 8, 50f, 255f, 130f); - } - } - } - Main.PlaySound(13, i * 0x10, j * 0x10, 1); - destroyObject = false; - } - } - } - else - { - if (type == 0x13) - { - if ((num4 == type) && (num5 == type)) - { - if (Main.tile[i, j].frameNumber == 0) - { - rectangle.X = 0; - rectangle.Y = 0; - } - if (Main.tile[i, j].frameNumber == 1) - { - rectangle.X = 0; - rectangle.Y = 0x12; - } - if (Main.tile[i, j].frameNumber == 2) - { - rectangle.X = 0; - rectangle.Y = 0x24; - } - } - else if ((num4 == type) && (num5 == -1)) - { - if (Main.tile[i, j].frameNumber == 0) - { - rectangle.X = 0x12; - rectangle.Y = 0; - } - if (Main.tile[i, j].frameNumber == 1) - { - rectangle.X = 0x12; - rectangle.Y = 0x12; - } - if (Main.tile[i, j].frameNumber == 2) - { - rectangle.X = 0x12; - rectangle.Y = 0x24; - } - } - else if ((num4 == -1) && (num5 == type)) - { - if (Main.tile[i, j].frameNumber == 0) - { - rectangle.X = 0x24; - rectangle.Y = 0; - } - if (Main.tile[i, j].frameNumber == 1) - { - rectangle.X = 0x24; - rectangle.Y = 0x12; - } - if (Main.tile[i, j].frameNumber == 2) - { - rectangle.X = 0x24; - rectangle.Y = 0x24; - } - } - else if ((num4 != type) && (num5 == type)) - { - if (Main.tile[i, j].frameNumber == 0) - { - rectangle.X = 0x36; - rectangle.Y = 0; - } - if (Main.tile[i, j].frameNumber == 1) - { - rectangle.X = 0x36; - rectangle.Y = 0x12; - } - if (Main.tile[i, j].frameNumber == 2) - { - rectangle.X = 0x36; - rectangle.Y = 0x24; - } - } - else if ((num4 == type) && (num5 != type)) - { - if (Main.tile[i, j].frameNumber == 0) - { - rectangle.X = 0x48; - rectangle.Y = 0; - } - if (Main.tile[i, j].frameNumber == 1) - { - rectangle.X = 0x48; - rectangle.Y = 0x12; - } - if (Main.tile[i, j].frameNumber == 2) - { - rectangle.X = 0x48; - rectangle.Y = 0x24; - } - } - else if (((num4 != type) && (num4 != -1)) && (num5 == -1)) - { - if (Main.tile[i, j].frameNumber == 0) - { - rectangle.X = 0x6c; - rectangle.Y = 0; - } - if (Main.tile[i, j].frameNumber == 1) - { - rectangle.X = 0x6c; - rectangle.Y = 0x12; - } - if (Main.tile[i, j].frameNumber == 2) - { - rectangle.X = 0x6c; - rectangle.Y = 0x24; - } - } - else if (((num4 == -1) && (num5 != type)) && (num5 != -1)) - { - if (Main.tile[i, j].frameNumber == 0) - { - rectangle.X = 0x7e; - rectangle.Y = 0; - } - if (Main.tile[i, j].frameNumber == 1) - { - rectangle.X = 0x7e; - rectangle.Y = 0x12; - } - if (Main.tile[i, j].frameNumber == 2) - { - rectangle.X = 0x7e; - rectangle.Y = 0x24; - } - } - else - { - if (Main.tile[i, j].frameNumber == 0) - { - rectangle.X = 90; - rectangle.Y = 0; - } - if (Main.tile[i, j].frameNumber == 1) - { - rectangle.X = 90; - rectangle.Y = 0x12; - } - if (Main.tile[i, j].frameNumber == 2) - { - rectangle.X = 90; - rectangle.Y = 0x24; - } - } - } - else - { - if (type == 10) - { - if (!destroyObject) - { - int num22 = Main.tile[i, j].frameY; - int num23 = j; - bool flag = false; - switch (num22) - { - case 0: - num23 = j; - break; - - case 0x12: - num23 = j - 1; - break; - - case 0x24: - num23 = j - 2; - break; - } - if (Main.tile[i, num23 - 1] == null) - { - Main.tile[i, num23 - 1] = new Tile(); - } - if (Main.tile[i, num23 + 3] == null) - { - Main.tile[i, num23 + 3] = new Tile(); - } - if (Main.tile[i, num23 + 2] == null) - { - Main.tile[i, num23 + 2] = new Tile(); - } - if (Main.tile[i, num23 + 1] == null) - { - Main.tile[i, num23 + 1] = new Tile(); - } - if (Main.tile[i, num23] == null) - { - Main.tile[i, num23] = new Tile(); - } - if (!Main.tile[i, num23 - 1].active || !Main.tileSolid[Main.tile[i, num23 - 1].type]) - { - flag = true; - } - if (!Main.tile[i, num23 + 3].active || !Main.tileSolid[Main.tile[i, num23 + 3].type]) - { - flag = true; - } - if (!Main.tile[i, num23].active || (Main.tile[i, num23].type != type)) - { - flag = true; - } - if (!Main.tile[i, num23 + 1].active || (Main.tile[i, num23 + 1].type != type)) - { - flag = true; - } - if (!Main.tile[i, num23 + 2].active || (Main.tile[i, num23 + 2].type != type)) - { - flag = true; - } - if (flag) - { - destroyObject = true; - KillTile(i, num23, false, false, false); - KillTile(i, num23 + 1, false, false, false); - KillTile(i, num23 + 2, false, false, false); - Item.NewItem(i * 0x10, j * 0x10, 0x10, 0x10, 0x19, 1, false); - } - destroyObject = false; - } - return; - } - if (type == 11) - { - if (!destroyObject) - { - int num24 = 0; - int num25 = i; - int num26 = j; - int num27 = Main.tile[i, j].frameX; - int num28 = Main.tile[i, j].frameY; - bool flag2 = false; - switch (num27) - { - case 0: - num25 = i; - num24 = 1; - break; - - case 0x12: - num25 = i - 1; - num24 = 1; - break; - - case 0x24: - num25 = i + 1; - num24 = -1; - break; - - case 0x36: - num25 = i; - num24 = -1; - break; - } - if (num28 == 0) - { - num26 = j; - } - else if (num28 == 0x12) - { - num26 = j - 1; - } - else if (num28 == 0x24) - { - num26 = j - 2; - } - if (Main.tile[num25, num26 + 3] == null) - { - Main.tile[num25, num26 + 3] = new Tile(); - } - if (Main.tile[num25, num26 - 1] == null) - { - Main.tile[num25, num26 - 1] = new Tile(); - } - if ((!Main.tile[num25, num26 - 1].active || !Main.tileSolid[Main.tile[num25, num26 - 1].type]) || (!Main.tile[num25, num26 + 3].active || !Main.tileSolid[Main.tile[num25, num26 + 3].type])) - { - flag2 = true; - destroyObject = true; - Item.NewItem(i * 0x10, j * 0x10, 0x10, 0x10, 0x19, 1, false); - } - int num29 = num25; - if (num24 == -1) - { - num29 = num25 - 1; - } - for (int m = num29; m < (num29 + 2); m++) - { - for (int n = num26; n < (num26 + 3); n++) - { - if (!flag2 && ((Main.tile[m, n].type != 11) || !Main.tile[m, n].active)) - { - destroyObject = true; - Item.NewItem(i * 0x10, j * 0x10, 0x10, 0x10, 0x19, 1, false); - flag2 = true; - m = num29; - n = num26; - } - if (flag2) - { - KillTile(m, n, false, false, false); - } - } - } - destroyObject = false; - } - return; - } - if (((type == 0x22) || (type == 0x23)) || (type == 0x24)) - { - Check3x3(i, j, (byte) type); - return; - } - if ((type == 15) || (type == 20)) - { - Check1x2(i, j, (byte) type); - return; - } - if (((type == 14) || (type == 0x11)) || ((type == 0x1a) || (type == 0x4d))) - { - Check3x2(i, j, (byte) type); - return; - } - if (((type == 0x10) || (type == 0x12)) || (type == 0x1d)) - { - Check2x1(i, j, (byte) type); - return; - } - if (((type == 13) || (type == 0x21)) || (((type == 0x31) || (type == 50)) || (type == 0x4e))) - { - CheckOnTable1x1(i, j, (byte) type); - return; - } - if (type == 0x15) - { - CheckChest(i, j, (byte) type); - return; - } - if (type == 0x1b) - { - CheckSunflower(i, j, 0x1b); - return; - } - if (type == 0x1c) - { - CheckPot(i, j, 0x1c); - return; - } - if (type == 0x2a) - { - Check1x2Top(i, j, (byte) type); - return; - } - if (type == 0x37) - { - CheckSign(i, j, type); - return; - } - if (type == 0x4f) - { - Check4x2(i, j, type); - return; - } - } - if (type == 0x48) - { - if ((num7 != type) && (num7 != 70)) - { - KillTile(i, j, false, false, false); - } - else if ((num2 != type) && (Main.tile[i, j].frameX == 0)) - { - Main.tile[i, j].frameNumber = (byte) genRand.Next(3); - if (Main.tile[i, j].frameNumber == 0) - { - Main.tile[i, j].frameX = 0x12; - Main.tile[i, j].frameY = 0; - } - if (Main.tile[i, j].frameNumber == 1) - { - Main.tile[i, j].frameX = 0x12; - Main.tile[i, j].frameY = 0x12; - } - if (Main.tile[i, j].frameNumber == 2) - { - Main.tile[i, j].frameX = 0x12; - Main.tile[i, j].frameY = 0x24; - } - } - } - if (type == 5) - { - if (((Main.tile[i, j].frameX >= 0x16) && (Main.tile[i, j].frameX <= 0x2c)) && ((Main.tile[i, j].frameY >= 0x84) && (Main.tile[i, j].frameY <= 0xb0))) - { - if (((num4 != type) && (num5 != type)) || (num7 != 2)) - { - KillTile(i, j, false, false, false); - } - } - else if (((((Main.tile[i, j].frameX == 0x58) && (Main.tile[i, j].frameY >= 0)) && (Main.tile[i, j].frameY <= 0x2c)) || (((Main.tile[i, j].frameX == 0x42) && (Main.tile[i, j].frameY >= 0x42)) && (Main.tile[i, j].frameY <= 130))) || ((((Main.tile[i, j].frameX == 110) && (Main.tile[i, j].frameY >= 0x42)) && (Main.tile[i, j].frameY <= 110)) || (((Main.tile[i, j].frameX == 0x84) && (Main.tile[i, j].frameY >= 0)) && (Main.tile[i, j].frameY <= 0xb0)))) - { - if ((num4 == type) && (num5 == type)) - { - if (Main.tile[i, j].frameNumber == 0) - { - Main.tile[i, j].frameX = 110; - Main.tile[i, j].frameY = 0x42; - } - if (Main.tile[i, j].frameNumber == 1) - { - Main.tile[i, j].frameX = 110; - Main.tile[i, j].frameY = 0x58; - } - if (Main.tile[i, j].frameNumber == 2) - { - Main.tile[i, j].frameX = 110; - Main.tile[i, j].frameY = 110; - } - } - else if (num4 == type) - { - if (Main.tile[i, j].frameNumber == 0) - { - Main.tile[i, j].frameX = 0x58; - Main.tile[i, j].frameY = 0; - } - if (Main.tile[i, j].frameNumber == 1) - { - Main.tile[i, j].frameX = 0x58; - Main.tile[i, j].frameY = 0x16; - } - if (Main.tile[i, j].frameNumber == 2) - { - Main.tile[i, j].frameX = 0x58; - Main.tile[i, j].frameY = 0x2c; - } - } - else if (num5 == type) - { - if (Main.tile[i, j].frameNumber == 0) - { - Main.tile[i, j].frameX = 0x42; - Main.tile[i, j].frameY = 0x42; - } - if (Main.tile[i, j].frameNumber == 1) - { - Main.tile[i, j].frameX = 0x42; - Main.tile[i, j].frameY = 0x58; - } - if (Main.tile[i, j].frameNumber == 2) - { - Main.tile[i, j].frameX = 0x42; - Main.tile[i, j].frameY = 110; - } - } - else - { - if (Main.tile[i, j].frameNumber == 0) - { - Main.tile[i, j].frameX = 0; - Main.tile[i, j].frameY = 0; - } - if (Main.tile[i, j].frameNumber == 1) - { - Main.tile[i, j].frameX = 0; - Main.tile[i, j].frameY = 0x16; - } - if (Main.tile[i, j].frameNumber == 2) - { - Main.tile[i, j].frameX = 0; - Main.tile[i, j].frameY = 0x2c; - } - } - } - if (((Main.tile[i, j].frameY >= 0x84) && (Main.tile[i, j].frameY <= 0xb0)) && (((Main.tile[i, j].frameX == 0) || (Main.tile[i, j].frameX == 0x42)) || (Main.tile[i, j].frameX == 0x58))) - { - if (num7 != 2) - { - KillTile(i, j, false, false, false); - } - if ((num4 != type) && (num5 != type)) - { - if (Main.tile[i, j].frameNumber == 0) - { - Main.tile[i, j].frameX = 0; - Main.tile[i, j].frameY = 0; - } - if (Main.tile[i, j].frameNumber == 1) - { - Main.tile[i, j].frameX = 0; - Main.tile[i, j].frameY = 0x16; - } - if (Main.tile[i, j].frameNumber == 2) - { - Main.tile[i, j].frameX = 0; - Main.tile[i, j].frameY = 0x2c; - } - } - else if (num4 != type) - { - if (Main.tile[i, j].frameNumber == 0) - { - Main.tile[i, j].frameX = 0; - Main.tile[i, j].frameY = 0x84; - } - if (Main.tile[i, j].frameNumber == 1) - { - Main.tile[i, j].frameX = 0; - Main.tile[i, j].frameY = 0x9a; - } - if (Main.tile[i, j].frameNumber == 2) - { - Main.tile[i, j].frameX = 0; - Main.tile[i, j].frameY = 0xb0; - } - } - else if (num5 != type) - { - if (Main.tile[i, j].frameNumber == 0) - { - Main.tile[i, j].frameX = 0x42; - Main.tile[i, j].frameY = 0x84; - } - if (Main.tile[i, j].frameNumber == 1) - { - Main.tile[i, j].frameX = 0x42; - Main.tile[i, j].frameY = 0x9a; - } - if (Main.tile[i, j].frameNumber == 2) - { - Main.tile[i, j].frameX = 0x42; - Main.tile[i, j].frameY = 0xb0; - } - } - else - { - if (Main.tile[i, j].frameNumber == 0) - { - Main.tile[i, j].frameX = 0x58; - Main.tile[i, j].frameY = 0x84; - } - if (Main.tile[i, j].frameNumber == 1) - { - Main.tile[i, j].frameX = 0x58; - Main.tile[i, j].frameY = 0x9a; - } - if (Main.tile[i, j].frameNumber == 2) - { - Main.tile[i, j].frameX = 0x58; - Main.tile[i, j].frameY = 0xb0; - } - } - } - if ((((Main.tile[i, j].frameX == 0x42) && (((Main.tile[i, j].frameY == 0) || (Main.tile[i, j].frameY == 0x16)) || (Main.tile[i, j].frameY == 0x2c))) || ((Main.tile[i, j].frameX == 0x58) && (((Main.tile[i, j].frameY == 0x42) || (Main.tile[i, j].frameY == 0x58)) || (Main.tile[i, j].frameY == 110)))) || (((Main.tile[i, j].frameX == 0x2c) && (((Main.tile[i, j].frameY == 0xc6) || (Main.tile[i, j].frameY == 220)) || (Main.tile[i, j].frameY == 0xf2))) || ((Main.tile[i, j].frameX == 0x42) && (((Main.tile[i, j].frameY == 0xc6) || (Main.tile[i, j].frameY == 220)) || (Main.tile[i, j].frameY == 0xf2))))) - { - if ((num4 != type) && (num5 != type)) - { - KillTile(i, j, false, false, false); - } - } - else if ((num7 == -1) || (num7 == 0x17)) - { - KillTile(i, j, false, false, false); - } - else if (((num2 != type) && (Main.tile[i, j].frameY < 0xc6)) && (((Main.tile[i, j].frameX != 0x16) && (Main.tile[i, j].frameX != 0x2c)) || (Main.tile[i, j].frameY < 0x84))) - { - if ((num4 == type) || (num5 == type)) - { - if (num7 == type) - { - if ((num4 == type) && (num5 == type)) - { - if (Main.tile[i, j].frameNumber == 0) - { - Main.tile[i, j].frameX = 0x84; - Main.tile[i, j].frameY = 0x84; - } - if (Main.tile[i, j].frameNumber == 1) - { - Main.tile[i, j].frameX = 0x84; - Main.tile[i, j].frameY = 0x9a; - } - if (Main.tile[i, j].frameNumber == 2) - { - Main.tile[i, j].frameX = 0x84; - Main.tile[i, j].frameY = 0xb0; - } - } - else if (num4 == type) - { - if (Main.tile[i, j].frameNumber == 0) - { - Main.tile[i, j].frameX = 0x84; - Main.tile[i, j].frameY = 0; - } - if (Main.tile[i, j].frameNumber == 1) - { - Main.tile[i, j].frameX = 0x84; - Main.tile[i, j].frameY = 0x16; - } - if (Main.tile[i, j].frameNumber == 2) - { - Main.tile[i, j].frameX = 0x84; - Main.tile[i, j].frameY = 0x2c; - } - } - else if (num5 == type) - { - if (Main.tile[i, j].frameNumber == 0) - { - Main.tile[i, j].frameX = 0x84; - Main.tile[i, j].frameY = 0x42; - } - if (Main.tile[i, j].frameNumber == 1) - { - Main.tile[i, j].frameX = 0x84; - Main.tile[i, j].frameY = 0x58; - } - if (Main.tile[i, j].frameNumber == 2) - { - Main.tile[i, j].frameX = 0x84; - Main.tile[i, j].frameY = 110; - } - } - } - else if ((num4 == type) && (num5 == type)) - { - if (Main.tile[i, j].frameNumber == 0) - { - Main.tile[i, j].frameX = 0x9a; - Main.tile[i, j].frameY = 0x84; - } - if (Main.tile[i, j].frameNumber == 1) - { - Main.tile[i, j].frameX = 0x9a; - Main.tile[i, j].frameY = 0x9a; - } - if (Main.tile[i, j].frameNumber == 2) - { - Main.tile[i, j].frameX = 0x9a; - Main.tile[i, j].frameY = 0xb0; - } - } - else if (num4 == type) - { - if (Main.tile[i, j].frameNumber == 0) - { - Main.tile[i, j].frameX = 0x9a; - Main.tile[i, j].frameY = 0; - } - if (Main.tile[i, j].frameNumber == 1) - { - Main.tile[i, j].frameX = 0x9a; - Main.tile[i, j].frameY = 0x16; - } - if (Main.tile[i, j].frameNumber == 2) - { - Main.tile[i, j].frameX = 0x9a; - Main.tile[i, j].frameY = 0x2c; - } - } - else if (num5 == type) - { - if (Main.tile[i, j].frameNumber == 0) - { - Main.tile[i, j].frameX = 0x9a; - Main.tile[i, j].frameY = 0x42; - } - if (Main.tile[i, j].frameNumber == 1) - { - Main.tile[i, j].frameX = 0x9a; - Main.tile[i, j].frameY = 0x58; - } - if (Main.tile[i, j].frameNumber == 2) - { - Main.tile[i, j].frameX = 0x9a; - Main.tile[i, j].frameY = 110; - } - } - } - else - { - if (Main.tile[i, j].frameNumber == 0) - { - Main.tile[i, j].frameX = 110; - Main.tile[i, j].frameY = 0; - } - if (Main.tile[i, j].frameNumber == 1) - { - Main.tile[i, j].frameX = 110; - Main.tile[i, j].frameY = 0x16; - } - if (Main.tile[i, j].frameNumber == 2) - { - Main.tile[i, j].frameX = 110; - Main.tile[i, j].frameY = 0x2c; - } - } - } - rectangle.X = Main.tile[i, j].frameX; - rectangle.Y = Main.tile[i, j].frameY; - } - if (!Main.tileFrameImportant[Main.tile[i, j].type]) - { - int frameNumber = 0; - if (resetFrame) - { - frameNumber = genRand.Next(0, 3); - Main.tile[i, j].frameNumber = (byte) frameNumber; - } - else - { - frameNumber = Main.tile[i, j].frameNumber; - } - if (type == 0) - { - for (int num33 = 0; num33 < 80; num33++) - { - switch (num33) - { - case 1: - case 6: - case 7: - case 8: - case 9: - case 0x16: - case 0x19: - case 0x25: - case 40: - case 0x35: - case 0x38: - if (num2 == num33) - { - TileFrame(i, j - 1, false, false); - if (WorldGen.mergeDown) - { - num2 = type; - } - } - if (num7 == num33) - { - TileFrame(i, j + 1, false, false); - if (WorldGen.mergeUp) - { - num7 = type; - } - } - if (num4 == num33) - { - TileFrame(i - 1, j, false, false); - if (WorldGen.mergeRight) - { - num4 = type; - } - } - if (num5 == num33) - { - TileFrame(i + 1, j, false, false); - if (WorldGen.mergeLeft) - { - num5 = type; - } - } - if (index == num33) - { - index = type; - } - if (num3 == num33) - { - num3 = type; - } - if (num6 == num33) - { - num6 = type; - } - if (num8 == num33) - { - num8 = type; - } - break; - } - } - if (num2 == 2) - { - num2 = type; - } - if (num7 == 2) - { - num7 = type; - } - if (num4 == 2) - { - num4 = type; - } - if (num5 == 2) - { - num5 = type; - } - if (index == 2) - { - index = type; - } - if (num3 == 2) - { - num3 = type; - } - if (num6 == 2) - { - num6 = type; - } - if (num8 == 2) - { - num8 = type; - } - if (num2 == 0x17) - { - num2 = type; - } - if (num7 == 0x17) - { - num7 = type; - } - if (num4 == 0x17) - { - num4 = type; - } - if (num5 == 0x17) - { - num5 = type; - } - if (index == 0x17) - { - index = type; - } - if (num3 == 0x17) - { - num3 = type; - } - if (num6 == 0x17) - { - num6 = type; - } - if (num8 == 0x17) - { - num8 = type; - } - } - else if (type == 0x39) - { - if (num2 == 0x3a) - { - TileFrame(i, j - 1, false, false); - if (WorldGen.mergeDown) - { - num2 = type; - } - } - if (num7 == 0x3a) - { - TileFrame(i, j + 1, false, false); - if (WorldGen.mergeUp) - { - num7 = type; - } - } - if (num4 == 0x3a) - { - TileFrame(i - 1, j, false, false); - if (WorldGen.mergeRight) - { - num4 = type; - } - } - if (num5 == 0x3a) - { - TileFrame(i + 1, j, false, false); - if (WorldGen.mergeLeft) - { - num5 = type; - } - } - if (index == 0x3a) - { - index = type; - } - if (num3 == 0x3a) - { - num3 = type; - } - if (num6 == 0x3a) - { - num6 = type; - } - if (num8 == 0x3a) - { - num8 = type; - } - } - else if (type == 0x3b) - { - if (num2 == 60) - { - num2 = type; - } - if (num7 == 60) - { - num7 = type; - } - if (num4 == 60) - { - num4 = type; - } - if (num5 == 60) - { - num5 = type; - } - if (index == 60) - { - index = type; - } - if (num3 == 60) - { - num3 = type; - } - if (num6 == 60) - { - num6 = type; - } - if (num8 == 60) - { - num8 = type; - } - if (num2 == 70) - { - num2 = type; - } - if (num7 == 70) - { - num7 = type; - } - if (num4 == 70) - { - num4 = type; - } - if (num5 == 70) - { - num5 = type; - } - if (index == 70) - { - index = type; - } - if (num3 == 70) - { - num3 = type; - } - if (num6 == 70) - { - num6 = type; - } - if (num8 == 70) - { - num8 = type; - } - } - else if (type == 1) - { - if (num2 == 0x3b) - { - TileFrame(i, j - 1, false, false); - if (WorldGen.mergeDown) - { - num2 = type; - } - } - if (num7 == 0x3b) - { - TileFrame(i, j + 1, false, false); - if (WorldGen.mergeUp) - { - num7 = type; - } - } - if (num4 == 0x3b) - { - TileFrame(i - 1, j, false, false); - if (WorldGen.mergeRight) - { - num4 = type; - } - } - if (num5 == 0x3b) - { - TileFrame(i + 1, j, false, false); - if (WorldGen.mergeLeft) - { - num5 = type; - } - } - if (index == 0x3b) - { - index = type; - } - if (num3 == 0x3b) - { - num3 = type; - } - if (num6 == 0x3b) - { - num6 = type; - } - if (num8 == 0x3b) - { - num8 = type; - } - } - if ((((type == 1) || (type == 6)) || ((type == 7) || (type == 8))) || ((((type == 9) || (type == 0x16)) || ((type == 0x19) || (type == 0x25))) || (((type == 40) || (type == 0x35)) || (type == 0x38)))) - { - for (int num34 = 0; num34 < 80; num34++) - { - switch (num34) - { - case 1: - case 6: - case 7: - case 8: - case 9: - case 0x16: - case 0x19: - case 0x25: - case 40: - case 0x35: - case 0x38: - if (num2 == 0) - { - num2 = -2; - } - if (num7 == 0) - { - num7 = -2; - } - if (num4 == 0) - { - num4 = -2; - } - if (num5 == 0) - { - num5 = -2; - } - if (index == 0) - { - index = -2; - } - if (num3 == 0) - { - num3 = -2; - } - if (num6 == 0) - { - num6 = -2; - } - if (num8 == 0) - { - num8 = -2; - } - break; - } - } - } - else if (type == 0x3a) - { - if (num2 == 0x39) - { - num2 = -2; - } - if (num7 == 0x39) - { - num7 = -2; - } - if (num4 == 0x39) - { - num4 = -2; - } - if (num5 == 0x39) - { - num5 = -2; - } - if (index == 0x39) - { - index = -2; - } - if (num3 == 0x39) - { - num3 = -2; - } - if (num6 == 0x39) - { - num6 = -2; - } - if (num8 == 0x39) - { - num8 = -2; - } - } - else if (type == 0x3b) - { - if (num2 == 1) - { - num2 = -2; - } - if (num7 == 1) - { - num7 = -2; - } - if (num4 == 1) - { - num4 = -2; - } - if (num5 == 1) - { - num5 = -2; - } - if (index == 1) - { - index = -2; - } - if (num3 == 1) - { - num3 = -2; - } - if (num6 == 1) - { - num6 = -2; - } - if (num8 == 1) - { - num8 = -2; - } - } - if ((type == 0x20) && (num7 == 0x17)) - { - num7 = type; - } - if ((type == 0x45) && (num7 == 60)) - { - num7 = type; - } - if (type == 0x33) - { - if ((num2 > -1) && !Main.tileNoAttach[num2]) - { - num2 = type; - } - if ((num7 > -1) && !Main.tileNoAttach[num7]) - { - num7 = type; - } - if ((num4 > -1) && !Main.tileNoAttach[num4]) - { - num4 = type; - } - if ((num5 > -1) && !Main.tileNoAttach[num5]) - { - num5 = type; - } - if ((index > -1) && !Main.tileNoAttach[index]) - { - index = type; - } - if ((num3 > -1) && !Main.tileNoAttach[num3]) - { - num3 = type; - } - if ((num6 > -1) && !Main.tileNoAttach[num6]) - { - num6 = type; - } - if ((num8 > -1) && !Main.tileNoAttach[num8]) - { - num8 = type; - } - } - if (((num2 > -1) && !Main.tileSolid[num2]) && (num2 != type)) - { - num2 = -1; - } - if (((num7 > -1) && !Main.tileSolid[num7]) && (num7 != type)) - { - num7 = -1; - } - if (((num4 > -1) && !Main.tileSolid[num4]) && (num4 != type)) - { - num4 = -1; - } - if (((num5 > -1) && !Main.tileSolid[num5]) && (num5 != type)) - { - num5 = -1; - } - if (((index > -1) && !Main.tileSolid[index]) && (index != type)) - { - index = -1; - } - if (((num3 > -1) && !Main.tileSolid[num3]) && (num3 != type)) - { - num3 = -1; - } - if (((num6 > -1) && !Main.tileSolid[num6]) && (num6 != type)) - { - num6 = -1; - } - if (((num8 > -1) && !Main.tileSolid[num8]) && (num8 != type)) - { - num8 = -1; - } - if (((type == 2) || (type == 0x17)) || ((type == 60) || (type == 70))) - { - int num35 = 0; - if ((type == 60) || (type == 70)) - { - num35 = 0x3b; - } - else if (type == 2) - { - if (num2 == 0x17) - { - num2 = num35; - } - if (num7 == 0x17) - { - num7 = num35; - } - if (num4 == 0x17) - { - num4 = num35; - } - if (num5 == 0x17) - { - num5 = num35; - } - if (index == 0x17) - { - index = num35; - } - if (num3 == 0x17) - { - num3 = num35; - } - if (num6 == 0x17) - { - num6 = num35; - } - if (num8 == 0x17) - { - num8 = num35; - } - } - else if (type == 0x17) - { - if (num2 == 2) - { - num2 = num35; - } - if (num7 == 2) - { - num7 = num35; - } - if (num4 == 2) - { - num4 = num35; - } - if (num5 == 2) - { - num5 = num35; - } - if (index == 2) - { - index = num35; - } - if (num3 == 2) - { - num3 = num35; - } - if (num6 == 2) - { - num6 = num35; - } - if (num8 == 2) - { - num8 = num35; - } - } - if (((num2 != type) && (num2 != num35)) && ((num7 == type) || (num7 == num35))) - { - if ((num4 == num35) && (num5 == type)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0; - rectangle.Y = 0xc6; - break; - - case 1: - rectangle.X = 0x12; - rectangle.Y = 0xc6; - break; - - case 2: - rectangle.X = 0x24; - rectangle.Y = 0xc6; - break; - } - } - else if ((num4 == type) && (num5 == num35)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x36; - rectangle.Y = 0xc6; - break; - - case 1: - rectangle.X = 0x48; - rectangle.Y = 0xc6; - break; - - case 2: - rectangle.X = 90; - rectangle.Y = 0xc6; - break; - } - } - } - else if (((num7 != type) && (num7 != num35)) && ((num2 == type) || (num2 == num35))) - { - if ((num4 == num35) && (num5 == type)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0; - rectangle.Y = 0xd8; - break; - - case 1: - rectangle.X = 0x12; - rectangle.Y = 0xd8; - break; - - case 2: - rectangle.X = 0x24; - rectangle.Y = 0xd8; - break; - } - } - else if ((num4 == type) && (num5 == num35)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x36; - rectangle.Y = 0xd8; - break; - - case 1: - rectangle.X = 0x48; - rectangle.Y = 0xd8; - break; - - case 2: - rectangle.X = 90; - rectangle.Y = 0xd8; - break; - } - } - } - else if (((num4 != type) && (num4 != num35)) && ((num5 == type) || (num5 == num35))) - { - if ((num2 == num35) && (num7 == type)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x48; - rectangle.Y = 0x90; - break; - - case 1: - rectangle.X = 0x48; - rectangle.Y = 0xa2; - break; - - case 2: - rectangle.X = 0x48; - rectangle.Y = 180; - break; - } - } - else if ((num7 == type) && (num5 == num2)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x48; - rectangle.Y = 90; - break; - - case 1: - rectangle.X = 0x48; - rectangle.Y = 0x6c; - break; - - case 2: - rectangle.X = 0x48; - rectangle.Y = 0x7e; - break; - } - } - } - else if (((num5 != type) && (num5 != num35)) && ((num4 == type) || (num4 == num35))) - { - if ((num2 == num35) && (num7 == type)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 90; - rectangle.Y = 0x90; - break; - - case 1: - rectangle.X = 90; - rectangle.Y = 0xa2; - break; - - case 2: - rectangle.X = 90; - rectangle.Y = 180; - break; - } - } - else if ((num7 == type) && (num5 == num2)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 90; - rectangle.Y = 90; - break; - - case 1: - rectangle.X = 90; - rectangle.Y = 0x6c; - break; - - case 2: - rectangle.X = 90; - rectangle.Y = 0x7e; - break; - } - } - } - else if (((num2 == type) && (num7 == type)) && ((num4 == type) && (num5 == type))) - { - if (((index != type) && (num3 != type)) && ((num6 != type) && (num8 != type))) - { - if (num8 == num35) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x6c; - rectangle.Y = 0x144; - break; - - case 1: - rectangle.X = 0x7e; - rectangle.Y = 0x144; - break; - - case 2: - rectangle.X = 0x90; - rectangle.Y = 0x144; - break; - } - } - else if (num3 == num35) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x6c; - rectangle.Y = 0x156; - break; - - case 1: - rectangle.X = 0x7e; - rectangle.Y = 0x156; - break; - - case 2: - rectangle.X = 0x90; - rectangle.Y = 0x156; - break; - } - } - else if (num6 == num35) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x6c; - rectangle.Y = 360; - break; - - case 1: - rectangle.X = 0x7e; - rectangle.Y = 360; - break; - - case 2: - rectangle.X = 0x90; - rectangle.Y = 360; - break; - } - } - else if (index == num35) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x6c; - rectangle.Y = 0x17a; - break; - - case 1: - rectangle.X = 0x7e; - rectangle.Y = 0x17a; - break; - - case 2: - rectangle.X = 0x90; - rectangle.Y = 0x17a; - break; - } - } - else - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x90; - rectangle.Y = 0xea; - break; - - case 1: - rectangle.X = 0xc6; - rectangle.Y = 0xea; - break; - - case 2: - rectangle.X = 0xfc; - rectangle.Y = 0xea; - break; - } - } - } - else if ((index != type) && (num8 != type)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x24; - rectangle.Y = 0x132; - break; - - case 1: - rectangle.X = 0x36; - rectangle.Y = 0x132; - break; - - case 2: - rectangle.X = 0x48; - rectangle.Y = 0x132; - break; - } - } - else if ((num3 != type) && (num6 != type)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 90; - rectangle.Y = 0x132; - break; - - case 1: - rectangle.X = 0x6c; - rectangle.Y = 0x132; - break; - - case 2: - rectangle.X = 0x7e; - rectangle.Y = 0x132; - break; - } - } - else if (((index != type) && (num3 == type)) && ((num6 == type) && (num8 == type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x36; - rectangle.Y = 0x6c; - break; - - case 1: - rectangle.X = 0x36; - rectangle.Y = 0x90; - break; - - case 2: - rectangle.X = 0x36; - rectangle.Y = 180; - break; - } - } - else if (((index == type) && (num3 != type)) && ((num6 == type) && (num8 == type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x24; - rectangle.Y = 0x6c; - break; - - case 1: - rectangle.X = 0x24; - rectangle.Y = 0x90; - break; - - case 2: - rectangle.X = 0x24; - rectangle.Y = 180; - break; - } - } - else if (((index == type) && (num3 == type)) && ((num6 != type) && (num8 == type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x36; - rectangle.Y = 90; - break; - - case 1: - rectangle.X = 0x36; - rectangle.Y = 0x7e; - break; - - case 2: - rectangle.X = 0x36; - rectangle.Y = 0xa2; - break; - } - } - else if (((index == type) && (num3 == type)) && ((num6 == type) && (num8 != type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x24; - rectangle.Y = 90; - break; - - case 1: - rectangle.X = 0x24; - rectangle.Y = 0x7e; - break; - - case 2: - rectangle.X = 0x24; - rectangle.Y = 0xa2; - break; - } - } - } - else if ((((num2 == type) && (num7 == num35)) && ((num4 == type) && (num5 == type))) && ((index == -1) && (num3 == -1))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x6c; - rectangle.Y = 0x12; - break; - - case 1: - rectangle.X = 0x7e; - rectangle.Y = 0x12; - break; - - case 2: - rectangle.X = 0x90; - rectangle.Y = 0x12; - break; - } - } - else if ((((num2 == num35) && (num7 == type)) && ((num4 == type) && (num5 == type))) && ((num6 == -1) && (num8 == -1))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x6c; - rectangle.Y = 0x24; - break; - - case 1: - rectangle.X = 0x7e; - rectangle.Y = 0x24; - break; - - case 2: - rectangle.X = 0x90; - rectangle.Y = 0x24; - break; - } - } - else if ((((num2 == type) && (num7 == type)) && ((num4 == num35) && (num5 == type))) && ((num3 == -1) && (num8 == -1))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0xc6; - rectangle.Y = 0; - break; - - case 1: - rectangle.X = 0xc6; - rectangle.Y = 0x12; - break; - - case 2: - rectangle.X = 0xc6; - rectangle.Y = 0x24; - break; - } - } - else if ((((num2 == type) && (num7 == type)) && ((num4 == type) && (num5 == num35))) && ((index == -1) && (num6 == -1))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 180; - rectangle.Y = 0; - break; - - case 1: - rectangle.X = 180; - rectangle.Y = 0x12; - break; - - case 2: - rectangle.X = 180; - rectangle.Y = 0x24; - break; - } - } - else if (((num2 == type) && (num7 == num35)) && ((num4 == type) && (num5 == type))) - { - if (num3 == -1) - { - if (index != -1) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x24; - rectangle.Y = 0x6c; - break; - - case 1: - rectangle.X = 0x24; - rectangle.Y = 0x90; - break; - - case 2: - rectangle.X = 0x24; - rectangle.Y = 180; - break; - } - } - } - else - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x36; - rectangle.Y = 0x6c; - break; - - case 1: - rectangle.X = 0x36; - rectangle.Y = 0x90; - break; - - case 2: - rectangle.X = 0x36; - rectangle.Y = 180; - break; - } - } - } - else if (((num2 == num35) && (num7 == type)) && ((num4 == type) && (num5 == type))) - { - if (num8 == -1) - { - if (num6 != -1) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x24; - rectangle.Y = 90; - break; - - case 1: - rectangle.X = 0x24; - rectangle.Y = 0x7e; - break; - - case 2: - rectangle.X = 0x24; - rectangle.Y = 0xa2; - break; - } - } - } - else - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x36; - rectangle.Y = 90; - break; - - case 1: - rectangle.X = 0x36; - rectangle.Y = 0x7e; - break; - - case 2: - rectangle.X = 0x36; - rectangle.Y = 0xa2; - break; - } - } - } - else if (((num2 == type) && (num7 == type)) && ((num4 == type) && (num5 == num35))) - { - if (index == -1) - { - if (num6 != -1) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x36; - rectangle.Y = 0x6c; - break; - - case 1: - rectangle.X = 0x36; - rectangle.Y = 0x90; - break; - - case 2: - rectangle.X = 0x36; - rectangle.Y = 180; - break; - } - } - } - else - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x36; - rectangle.Y = 90; - break; - - case 1: - rectangle.X = 0x36; - rectangle.Y = 0x7e; - break; - - case 2: - rectangle.X = 0x36; - rectangle.Y = 0xa2; - break; - } - } - } - else if (((num2 == type) && (num7 == type)) && ((num4 == num35) && (num5 == type))) - { - if (num3 == -1) - { - if (num8 != -1) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x24; - rectangle.Y = 0x6c; - break; - - case 1: - rectangle.X = 0x24; - rectangle.Y = 0x90; - break; - - case 2: - rectangle.X = 0x24; - rectangle.Y = 180; - break; - } - } - } - else - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x24; - rectangle.Y = 90; - break; - - case 1: - rectangle.X = 0x24; - rectangle.Y = 0x7e; - break; - - case 2: - rectangle.X = 0x24; - rectangle.Y = 0xa2; - break; - } - } - } - else if (((((num2 == num35) && (num7 == type)) && ((num4 == type) && (num5 == type))) || (((num2 == type) && (num7 == num35)) && ((num4 == type) && (num5 == type)))) || ((((num2 == type) && (num7 == type)) && ((num4 == num35) && (num5 == type))) || (((num2 == type) && (num7 == type)) && ((num4 == type) && (num5 == num35))))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x12; - rectangle.Y = 0x12; - break; - - case 1: - rectangle.X = 0x24; - rectangle.Y = 0x12; - break; - - case 2: - rectangle.X = 0x36; - rectangle.Y = 0x12; - break; - } - } - if ((((num2 == type) || (num2 == num35)) && ((num7 == type) || (num7 == num35))) && (((num4 == type) || (num4 == num35)) && ((num5 == type) || (num5 == num35)))) - { - if (((((index != type) && (index != num35)) && ((num3 == type) || (num3 == num35))) && ((num6 == type) || (num6 == num35))) && ((num8 == type) || (num8 == num35))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x36; - rectangle.Y = 0x6c; - break; - - case 1: - rectangle.X = 0x36; - rectangle.Y = 0x90; - break; - - case 2: - rectangle.X = 0x36; - rectangle.Y = 180; - break; - } - } - else if (((((num3 != type) && (num3 != num35)) && ((index == type) || (index == num35))) && ((num6 == type) || (num6 == num35))) && ((num8 == type) || (num8 == num35))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x24; - rectangle.Y = 0x6c; - break; - - case 1: - rectangle.X = 0x24; - rectangle.Y = 0x90; - break; - - case 2: - rectangle.X = 0x24; - rectangle.Y = 180; - break; - } - } - else if (((((num6 != type) && (num6 != num35)) && ((index == type) || (index == num35))) && ((num3 == type) || (num3 == num35))) && ((num8 == type) || (num8 == num35))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x36; - rectangle.Y = 90; - break; - - case 1: - rectangle.X = 0x36; - rectangle.Y = 0x7e; - break; - - case 2: - rectangle.X = 0x36; - rectangle.Y = 0xa2; - break; - } - } - else if (((((num8 != type) && (num8 != num35)) && ((index == type) || (index == num35))) && ((num6 == type) || (num6 == num35))) && ((num3 == type) || (num3 == num35))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x24; - rectangle.Y = 90; - break; - - case 1: - rectangle.X = 0x24; - rectangle.Y = 0x7e; - break; - - case 2: - rectangle.X = 0x24; - rectangle.Y = 0xa2; - break; - } - } - } - if ((((num2 != num35) && (num2 != type)) && ((num7 == type) && (num4 != num35))) && (((num4 != type) && (num5 == type)) && ((num8 != num35) && (num8 != type)))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 90; - rectangle.Y = 270; - break; - - case 1: - rectangle.X = 0x6c; - rectangle.Y = 270; - break; - - case 2: - rectangle.X = 0x7e; - rectangle.Y = 270; - break; - } - } - else if ((((num2 != num35) && (num2 != type)) && ((num7 == type) && (num4 == type))) && (((num5 != num35) && (num5 != type)) && ((num6 != num35) && (num6 != type)))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x90; - rectangle.Y = 270; - break; - - case 1: - rectangle.X = 0xa2; - rectangle.Y = 270; - break; - - case 2: - rectangle.X = 180; - rectangle.Y = 270; - break; - } - } - else if ((((num7 != num35) && (num7 != type)) && ((num2 == type) && (num4 != num35))) && (((num4 != type) && (num5 == type)) && ((num3 != num35) && (num3 != type)))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 90; - rectangle.Y = 0x120; - break; - - case 1: - rectangle.X = 0x6c; - rectangle.Y = 0x120; - break; - - case 2: - rectangle.X = 0x7e; - rectangle.Y = 0x120; - break; - } - } - else if ((((num7 != num35) && (num7 != type)) && ((num2 == type) && (num4 == type))) && (((num5 != num35) && (num5 != type)) && ((index != num35) && (index != type)))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x90; - rectangle.Y = 0x120; - break; - - case 1: - rectangle.X = 0xa2; - rectangle.Y = 0x120; - break; - - case 2: - rectangle.X = 180; - rectangle.Y = 0x120; - break; - } - } - else if (((((num2 != type) && (num2 != num35)) && ((num7 == type) && (num4 == type))) && (((num5 == type) && (num6 != type)) && ((num6 != num35) && (num8 != type)))) && (num8 != num35)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x90; - rectangle.Y = 0xd8; - break; - - case 1: - rectangle.X = 0xc6; - rectangle.Y = 0xd8; - break; - - case 2: - rectangle.X = 0xfc; - rectangle.Y = 0xd8; - break; - } - } - else if (((((num7 != type) && (num7 != num35)) && ((num2 == type) && (num4 == type))) && (((num5 == type) && (index != type)) && ((index != num35) && (num3 != type)))) && (num3 != num35)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x90; - rectangle.Y = 0xfc; - break; - - case 1: - rectangle.X = 0xc6; - rectangle.Y = 0xfc; - break; - - case 2: - rectangle.X = 0xfc; - rectangle.Y = 0xfc; - break; - } - } - else if (((((num4 != type) && (num4 != num35)) && ((num7 == type) && (num2 == type))) && (((num5 == type) && (num3 != type)) && ((num3 != num35) && (num8 != type)))) && (num8 != num35)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x7e; - rectangle.Y = 0xea; - break; - - case 1: - rectangle.X = 180; - rectangle.Y = 0xea; - break; - - case 2: - rectangle.X = 0xea; - rectangle.Y = 0xea; - break; - } - } - else if (((((num5 != type) && (num5 != num35)) && ((num7 == type) && (num2 == type))) && (((num4 == type) && (index != type)) && ((index != num35) && (num6 != type)))) && (num6 != num35)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0xa2; - rectangle.Y = 0xea; - break; - - case 1: - rectangle.X = 0xd8; - rectangle.Y = 0xea; - break; - - case 2: - rectangle.X = 270; - rectangle.Y = 0xea; - break; - } - } - else if ((((num2 != num35) && (num2 != type)) && ((num7 == num35) || (num7 == type))) && ((num4 == num35) && (num5 == num35))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x24; - rectangle.Y = 270; - break; - - case 1: - rectangle.X = 0x36; - rectangle.Y = 270; - break; - - case 2: - rectangle.X = 0x48; - rectangle.Y = 270; - break; - } - } - else if ((((num7 != num35) && (num7 != type)) && ((num2 == num35) || (num2 == type))) && ((num4 == num35) && (num5 == num35))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x24; - rectangle.Y = 0x120; - break; - - case 1: - rectangle.X = 0x36; - rectangle.Y = 0x120; - break; - - case 2: - rectangle.X = 0x48; - rectangle.Y = 0x120; - break; - } - } - else if ((((num4 != num35) && (num4 != type)) && ((num5 == num35) || (num5 == type))) && ((num2 == num35) && (num7 == num35))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0; - rectangle.Y = 270; - break; - - case 1: - rectangle.X = 0; - rectangle.Y = 0x120; - break; - - case 2: - rectangle.X = 0; - rectangle.Y = 0x132; - break; - } - } - else if ((((num5 != num35) && (num5 != type)) && ((num4 == num35) || (num4 == type))) && ((num2 == num35) && (num7 == num35))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x12; - rectangle.Y = 270; - break; - - case 1: - rectangle.X = 0x12; - rectangle.Y = 0x120; - break; - - case 2: - rectangle.X = 0x12; - rectangle.Y = 0x132; - break; - } - } - else if (((num2 == type) && (num7 == num35)) && ((num4 == num35) && (num5 == num35))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0xc6; - rectangle.Y = 0x120; - break; - - case 1: - rectangle.X = 0xd8; - rectangle.Y = 0x120; - break; - - case 2: - rectangle.X = 0xea; - rectangle.Y = 0x120; - break; - } - } - else if (((num2 == num35) && (num7 == type)) && ((num4 == num35) && (num5 == num35))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0xc6; - rectangle.Y = 270; - break; - - case 1: - rectangle.X = 0xd8; - rectangle.Y = 270; - break; - - case 2: - rectangle.X = 0xea; - rectangle.Y = 270; - break; - } - } - else if (((num2 == num35) && (num7 == num35)) && ((num4 == type) && (num5 == num35))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0xc6; - rectangle.Y = 0x132; - break; - - case 1: - rectangle.X = 0xd8; - rectangle.Y = 0x132; - break; - - case 2: - rectangle.X = 0xea; - rectangle.Y = 0x132; - break; - } - } - else if (((num2 == num35) && (num7 == num35)) && ((num4 == num35) && (num5 == type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x90; - rectangle.Y = 0x132; - break; - - case 1: - rectangle.X = 0xa2; - rectangle.Y = 0x132; - break; - - case 2: - rectangle.X = 180; - rectangle.Y = 0x132; - break; - } - } - if ((((num2 != type) && (num2 != num35)) && ((num7 == type) && (num4 == type))) && (num5 == type)) - { - if (((num6 == num35) || (num6 == type)) && ((num8 != num35) && (num8 != type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0; - rectangle.Y = 0x144; - break; - - case 1: - rectangle.X = 0x12; - rectangle.Y = 0x144; - break; - - case 2: - rectangle.X = 0x24; - rectangle.Y = 0x144; - break; - } - } - else if (((num8 == num35) || (num8 == type)) && ((num6 != num35) && (num6 != type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x36; - rectangle.Y = 0x144; - break; - - case 1: - rectangle.X = 0x48; - rectangle.Y = 0x144; - break; - - case 2: - rectangle.X = 90; - rectangle.Y = 0x144; - break; - } - } - } - else if ((((num7 != type) && (num7 != num35)) && ((num2 == type) && (num4 == type))) && (num5 == type)) - { - if (((index == num35) || (index == type)) && ((num3 != num35) && (num3 != type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0; - rectangle.Y = 0x156; - break; - - case 1: - rectangle.X = 0x12; - rectangle.Y = 0x156; - break; - - case 2: - rectangle.X = 0x24; - rectangle.Y = 0x156; - break; - } - } - else if (((num3 == num35) || (num3 == type)) && ((index != num35) && (index != type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x36; - rectangle.Y = 0x156; - break; - - case 1: - rectangle.X = 0x48; - rectangle.Y = 0x156; - break; - - case 2: - rectangle.X = 90; - rectangle.Y = 0x156; - break; - } - } - } - else if ((((num4 != type) && (num4 != num35)) && ((num2 == type) && (num7 == type))) && (num5 == type)) - { - if (((num3 == num35) || (num3 == type)) && ((num8 != num35) && (num8 != type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x36; - rectangle.Y = 360; - break; - - case 1: - rectangle.X = 0x48; - rectangle.Y = 360; - break; - - case 2: - rectangle.X = 90; - rectangle.Y = 360; - break; - } - } - else if (((num8 == num35) || (num8 == type)) && ((num3 != num35) && (num3 != type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0; - rectangle.Y = 360; - break; - - case 1: - rectangle.X = 0x12; - rectangle.Y = 360; - break; - - case 2: - rectangle.X = 0x24; - rectangle.Y = 360; - break; - } - } - } - else if ((((num5 != type) && (num5 != num35)) && ((num2 == type) && (num7 == type))) && (num4 == type)) - { - if (((index == num35) || (index == type)) && ((num6 != num35) && (num6 != type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0; - rectangle.Y = 0x17a; - break; - - case 1: - rectangle.X = 0x12; - rectangle.Y = 0x17a; - break; - - case 2: - rectangle.X = 0x24; - rectangle.Y = 0x17a; - break; - } - } - else if (((num6 == num35) || (num6 == type)) && ((index != num35) && (index != type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x36; - rectangle.Y = 0x17a; - break; - - case 1: - rectangle.X = 0x48; - rectangle.Y = 0x17a; - break; - - case 2: - rectangle.X = 90; - rectangle.Y = 0x17a; - break; - } - } - } - if (((((num2 == type) || (num2 == num35)) && ((num7 == type) || (num7 == num35))) && (((num4 == type) || (num4 == num35)) && ((num5 == type) || (num5 == num35)))) && (((index != -1) && (num3 != -1)) && ((num6 != -1) && (num8 != -1)))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x12; - rectangle.Y = 0x12; - break; - - case 1: - rectangle.X = 0x24; - rectangle.Y = 0x12; - break; - - case 2: - rectangle.X = 0x36; - rectangle.Y = 0x12; - break; - } - } - if (num2 == num35) - { - num2 = -2; - } - if (num7 == num35) - { - num7 = -2; - } - if (num4 == num35) - { - num4 = -2; - } - if (num5 == num35) - { - num5 = -2; - } - if (index == num35) - { - index = -2; - } - if (num3 == num35) - { - num3 = -2; - } - if (num6 == num35) - { - num6 = -2; - } - if (num8 == num35) - { - num8 = -2; - } - } - if ((((((type == 1) || (type == 2)) || ((type == 6) || (type == 7))) || (((type == 8) || (type == 9)) || ((type == 0x16) || (type == 0x17)))) || ((((type == 0x19) || (type == 0x25)) || ((type == 40) || (type == 0x35))) || (((type == 0x38) || (type == 0x3a)) || (((type == 0x3b) || (type == 60)) || (type == 70))))) && ((rectangle.X == -1) && (rectangle.Y == -1))) - { - if ((num2 >= 0) && (num2 != type)) - { - num2 = -1; - } - if ((num7 >= 0) && (num7 != type)) - { - num7 = -1; - } - if ((num4 >= 0) && (num4 != type)) - { - num4 = -1; - } - if ((num5 >= 0) && (num5 != type)) - { - num5 = -1; - } - if (((num2 != -1) && (num7 != -1)) && ((num4 != -1) && (num5 != -1))) - { - if (((num2 == -2) && (num7 == type)) && ((num4 == type) && (num5 == type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x90; - rectangle.Y = 0x6c; - break; - - case 1: - rectangle.X = 0xa2; - rectangle.Y = 0x6c; - break; - - case 2: - rectangle.X = 180; - rectangle.Y = 0x6c; - break; - } - WorldGen.mergeUp = true; - } - else if (((num2 == type) && (num7 == -2)) && ((num4 == type) && (num5 == type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x90; - rectangle.Y = 90; - break; - - case 1: - rectangle.X = 0xa2; - rectangle.Y = 90; - break; - - case 2: - rectangle.X = 180; - rectangle.Y = 90; - break; - } - WorldGen.mergeDown = true; - } - else if (((num2 == type) && (num7 == type)) && ((num4 == -2) && (num5 == type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0xa2; - rectangle.Y = 0x7e; - break; - - case 1: - rectangle.X = 0xa2; - rectangle.Y = 0x90; - break; - - case 2: - rectangle.X = 0xa2; - rectangle.Y = 0xa2; - break; - } - WorldGen.mergeLeft = true; - } - else if (((num2 == type) && (num7 == type)) && ((num4 == type) && (num5 == -2))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x90; - rectangle.Y = 0x7e; - break; - - case 1: - rectangle.X = 0x90; - rectangle.Y = 0x90; - break; - - case 2: - rectangle.X = 0x90; - rectangle.Y = 0xa2; - break; - } - WorldGen.mergeRight = true; - } - else if (((num2 == -2) && (num7 == type)) && ((num4 == -2) && (num5 == type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x24; - rectangle.Y = 90; - break; - - case 1: - rectangle.X = 0x24; - rectangle.Y = 0x7e; - break; - - case 2: - rectangle.X = 0x24; - rectangle.Y = 0xa2; - break; - } - WorldGen.mergeUp = true; - WorldGen.mergeLeft = true; - } - else if (((num2 == -2) && (num7 == type)) && ((num4 == type) && (num5 == -2))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x36; - rectangle.Y = 90; - break; - - case 1: - rectangle.X = 0x36; - rectangle.Y = 0x7e; - break; - - case 2: - rectangle.X = 0x36; - rectangle.Y = 0xa2; - break; - } - WorldGen.mergeUp = true; - WorldGen.mergeRight = true; - } - else if (((num2 == type) && (num7 == -2)) && ((num4 == -2) && (num5 == type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x24; - rectangle.Y = 0x6c; - break; - - case 1: - rectangle.X = 0x24; - rectangle.Y = 0x90; - break; - - case 2: - rectangle.X = 0x24; - rectangle.Y = 180; - break; - } - WorldGen.mergeDown = true; - WorldGen.mergeLeft = true; - } - else if (((num2 == type) && (num7 == -2)) && ((num4 == type) && (num5 == -2))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x36; - rectangle.Y = 0x6c; - break; - - case 1: - rectangle.X = 0x36; - rectangle.Y = 0x90; - break; - - case 2: - rectangle.X = 0x36; - rectangle.Y = 180; - break; - } - WorldGen.mergeDown = true; - WorldGen.mergeRight = true; - } - else if (((num2 == type) && (num7 == type)) && ((num4 == -2) && (num5 == -2))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 180; - rectangle.Y = 0x7e; - break; - - case 1: - rectangle.X = 180; - rectangle.Y = 0x90; - break; - - case 2: - rectangle.X = 180; - rectangle.Y = 0xa2; - break; - } - WorldGen.mergeLeft = true; - WorldGen.mergeRight = true; - } - else if (((num2 == -2) && (num7 == -2)) && ((num4 == type) && (num5 == type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x90; - rectangle.Y = 180; - break; - - case 1: - rectangle.X = 0xa2; - rectangle.Y = 180; - break; - - case 2: - rectangle.X = 180; - rectangle.Y = 180; - break; - } - WorldGen.mergeUp = true; - WorldGen.mergeDown = true; - } - else if (((num2 == -2) && (num7 == type)) && ((num4 == -2) && (num5 == -2))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0xc6; - rectangle.Y = 90; - break; - - case 1: - rectangle.X = 0xc6; - rectangle.Y = 0x6c; - break; - - case 2: - rectangle.X = 0xc6; - rectangle.Y = 0x7e; - break; - } - WorldGen.mergeUp = true; - WorldGen.mergeLeft = true; - WorldGen.mergeRight = true; - } - else if (((num2 == type) && (num7 == -2)) && ((num4 == -2) && (num5 == -2))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0xc6; - rectangle.Y = 0x90; - break; - - case 1: - rectangle.X = 0xc6; - rectangle.Y = 0xa2; - break; - - case 2: - rectangle.X = 0xc6; - rectangle.Y = 180; - break; - } - WorldGen.mergeDown = true; - WorldGen.mergeLeft = true; - WorldGen.mergeRight = true; - } - else if (((num2 == -2) && (num7 == -2)) && ((num4 == type) && (num5 == -2))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0xd8; - rectangle.Y = 0x90; - break; - - case 1: - rectangle.X = 0xd8; - rectangle.Y = 0xa2; - break; - - case 2: - rectangle.X = 0xd8; - rectangle.Y = 180; - break; - } - WorldGen.mergeUp = true; - WorldGen.mergeDown = true; - WorldGen.mergeRight = true; - } - else if (((num2 == -2) && (num7 == -2)) && ((num4 == -2) && (num5 == type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0xd8; - rectangle.Y = 90; - break; - - case 1: - rectangle.X = 0xd8; - rectangle.Y = 0x6c; - break; - - case 2: - rectangle.X = 0xd8; - rectangle.Y = 0x7e; - break; - } - WorldGen.mergeUp = true; - WorldGen.mergeDown = true; - WorldGen.mergeLeft = true; - } - else if (((num2 == -2) && (num7 == -2)) && ((num4 == -2) && (num5 == -2))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x6c; - rectangle.Y = 0xc6; - break; - - case 1: - rectangle.X = 0x7e; - rectangle.Y = 0xc6; - break; - - case 2: - rectangle.X = 0x90; - rectangle.Y = 0xc6; - break; - } - WorldGen.mergeUp = true; - WorldGen.mergeDown = true; - WorldGen.mergeLeft = true; - WorldGen.mergeRight = true; - } - else if (((num2 == type) && (num7 == type)) && ((num4 == type) && (num5 == type))) - { - if (index == -2) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x12; - rectangle.Y = 0x6c; - break; - - case 1: - rectangle.X = 0x12; - rectangle.Y = 0x90; - break; - - case 2: - rectangle.X = 0x12; - rectangle.Y = 180; - break; - } - } - if (num3 == -2) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0; - rectangle.Y = 0x6c; - break; - - case 1: - rectangle.X = 0; - rectangle.Y = 0x90; - break; - - case 2: - rectangle.X = 0; - rectangle.Y = 180; - break; - } - } - if (num6 == -2) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x12; - rectangle.Y = 90; - break; - - case 1: - rectangle.X = 0x12; - rectangle.Y = 0x7e; - break; - - case 2: - rectangle.X = 0x12; - rectangle.Y = 0xa2; - break; - } - } - if (num8 == -2) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0; - rectangle.Y = 90; - break; - - case 1: - rectangle.X = 0; - rectangle.Y = 0x7e; - break; - - case 2: - rectangle.X = 0; - rectangle.Y = 0xa2; - break; - } - } - } - } - else - { - if (((type != 2) && (type != 0x17)) && ((type != 60) && (type != 70))) - { - if (((num2 == -1) && (num7 == -2)) && ((num4 == type) && (num5 == type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0xea; - rectangle.Y = 0; - break; - - case 1: - rectangle.X = 0xfc; - rectangle.Y = 0; - break; - - case 2: - rectangle.X = 270; - rectangle.Y = 0; - break; - } - WorldGen.mergeDown = true; - } - else if (((num2 == -2) && (num7 == -1)) && ((num4 == type) && (num5 == type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0xea; - rectangle.Y = 0x12; - break; - - case 1: - rectangle.X = 0xfc; - rectangle.Y = 0x12; - break; - - case 2: - rectangle.X = 270; - rectangle.Y = 0x12; - break; - } - WorldGen.mergeUp = true; - } - else if (((num2 == type) && (num7 == type)) && ((num4 == -1) && (num5 == -2))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0xea; - rectangle.Y = 0x24; - break; - - case 1: - rectangle.X = 0xfc; - rectangle.Y = 0x24; - break; - - case 2: - rectangle.X = 270; - rectangle.Y = 0x24; - break; - } - WorldGen.mergeRight = true; - } - else if (((num2 == type) && (num7 == type)) && ((num4 == -2) && (num5 == -1))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0xea; - rectangle.Y = 0x36; - break; - - case 1: - rectangle.X = 0xfc; - rectangle.Y = 0x36; - break; - - case 2: - rectangle.X = 270; - rectangle.Y = 0x36; - break; - } - WorldGen.mergeLeft = true; - } - } - if (((num2 != -1) && (num7 != -1)) && ((num4 == -1) && (num5 == type))) - { - if ((num2 == -2) && (num7 == type)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x48; - rectangle.Y = 0x90; - break; - - case 1: - rectangle.X = 0x48; - rectangle.Y = 0xa2; - break; - - case 2: - rectangle.X = 0x48; - rectangle.Y = 180; - break; - } - WorldGen.mergeUp = true; - } - else if ((num7 == -2) && (num2 == type)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x48; - rectangle.Y = 90; - break; - - case 1: - rectangle.X = 0x48; - rectangle.Y = 0x6c; - break; - - case 2: - rectangle.X = 0x48; - rectangle.Y = 0x7e; - break; - } - WorldGen.mergeDown = true; - } - } - else if (((num2 != -1) && (num7 != -1)) && ((num4 == type) && (num5 == -1))) - { - if ((num2 == -2) && (num7 == type)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 90; - rectangle.Y = 0x90; - break; - - case 1: - rectangle.X = 90; - rectangle.Y = 0xa2; - break; - - case 2: - rectangle.X = 90; - rectangle.Y = 180; - break; - } - WorldGen.mergeUp = true; - } - else if ((num7 == -2) && (num2 == type)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 90; - rectangle.Y = 90; - break; - - case 1: - rectangle.X = 90; - rectangle.Y = 0x6c; - break; - - case 2: - rectangle.X = 90; - rectangle.Y = 0x7e; - break; - } - WorldGen.mergeDown = true; - } - } - else if (((num2 == -1) && (num7 == type)) && ((num4 != -1) && (num5 != -1))) - { - if ((num4 == -2) && (num5 == type)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0; - rectangle.Y = 0xc6; - break; - - case 1: - rectangle.X = 0x12; - rectangle.Y = 0xc6; - break; - - case 2: - rectangle.X = 0x24; - rectangle.Y = 0xc6; - break; - } - WorldGen.mergeLeft = true; - } - else if ((num5 == -2) && (num4 == type)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x36; - rectangle.Y = 0xc6; - break; - - case 1: - rectangle.X = 0x48; - rectangle.Y = 0xc6; - break; - - case 2: - rectangle.X = 90; - rectangle.Y = 0xc6; - break; - } - WorldGen.mergeRight = true; - } - } - else if (((num2 == type) && (num7 == -1)) && ((num4 != -1) && (num5 != -1))) - { - if ((num4 == -2) && (num5 == type)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0; - rectangle.Y = 0xd8; - break; - - case 1: - rectangle.X = 0x12; - rectangle.Y = 0xd8; - break; - - case 2: - rectangle.X = 0x24; - rectangle.Y = 0xd8; - break; - } - WorldGen.mergeLeft = true; - } - else if ((num5 == -2) && (num4 == type)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x36; - rectangle.Y = 0xd8; - break; - - case 1: - rectangle.X = 0x48; - rectangle.Y = 0xd8; - break; - - case 2: - rectangle.X = 90; - rectangle.Y = 0xd8; - break; - } - WorldGen.mergeRight = true; - } - } - else if (((num2 != -1) && (num7 != -1)) && ((num4 == -1) && (num5 == -1))) - { - if ((num2 == -2) && (num7 == -2)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x6c; - rectangle.Y = 0xd8; - break; - - case 1: - rectangle.X = 0x6c; - rectangle.Y = 0xea; - break; - - case 2: - rectangle.X = 0x6c; - rectangle.Y = 0xfc; - break; - } - WorldGen.mergeUp = true; - WorldGen.mergeDown = true; - } - else if (num2 == -2) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x7e; - rectangle.Y = 0x90; - break; - - case 1: - rectangle.X = 0x7e; - rectangle.Y = 0xa2; - break; - - case 2: - rectangle.X = 0x7e; - rectangle.Y = 180; - break; - } - WorldGen.mergeUp = true; - } - else if (num7 == -2) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x7e; - rectangle.Y = 90; - break; - - case 1: - rectangle.X = 0x7e; - rectangle.Y = 0x6c; - break; - - case 2: - rectangle.X = 0x7e; - rectangle.Y = 0x7e; - break; - } - WorldGen.mergeDown = true; - } - } - else if (((num2 == -1) && (num7 == -1)) && ((num4 != -1) && (num5 != -1))) - { - if ((num4 == -2) && (num5 == -2)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0xa2; - rectangle.Y = 0xc6; - break; - - case 1: - rectangle.X = 180; - rectangle.Y = 0xc6; - break; - - case 2: - rectangle.X = 0xc6; - rectangle.Y = 0xc6; - break; - } - WorldGen.mergeLeft = true; - WorldGen.mergeRight = true; - } - else if (num4 == -2) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0; - rectangle.Y = 0xfc; - break; - - case 1: - rectangle.X = 0x12; - rectangle.Y = 0xfc; - break; - - case 2: - rectangle.X = 0x24; - rectangle.Y = 0xfc; - break; - } - WorldGen.mergeLeft = true; - } - else if (num5 == -2) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x36; - rectangle.Y = 0xfc; - break; - - case 1: - rectangle.X = 0x48; - rectangle.Y = 0xfc; - break; - - case 2: - rectangle.X = 90; - rectangle.Y = 0xfc; - break; - } - WorldGen.mergeRight = true; - } - } - else if (((num2 == -2) && (num7 == -1)) && ((num4 == -1) && (num5 == -1))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x6c; - rectangle.Y = 0x90; - break; - - case 1: - rectangle.X = 0x6c; - rectangle.Y = 0xa2; - break; - - case 2: - rectangle.X = 0x6c; - rectangle.Y = 180; - break; - } - WorldGen.mergeUp = true; - } - else if (((num2 == -1) && (num7 == -2)) && ((num4 == -1) && (num5 == -1))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x6c; - rectangle.Y = 90; - break; - - case 1: - rectangle.X = 0x6c; - rectangle.Y = 0x6c; - break; - - case 2: - rectangle.X = 0x6c; - rectangle.Y = 0x7e; - break; - } - WorldGen.mergeDown = true; - } - else if (((num2 == -1) && (num7 == -1)) && ((num4 == -2) && (num5 == -1))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0; - rectangle.Y = 0xea; - break; - - case 1: - rectangle.X = 0x12; - rectangle.Y = 0xea; - break; - - case 2: - rectangle.X = 0x24; - rectangle.Y = 0xea; - break; - } - WorldGen.mergeLeft = true; - } - else if (((num2 == -1) && (num7 == -1)) && ((num4 == -1) && (num5 == -2))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x36; - rectangle.Y = 0xea; - break; - - case 1: - rectangle.X = 0x48; - rectangle.Y = 0xea; - break; - - case 2: - rectangle.X = 90; - rectangle.Y = 0xea; - break; - } - WorldGen.mergeRight = true; - } - } - } - if ((rectangle.X < 0) || (rectangle.Y < 0)) - { - if (((type == 2) || (type == 0x17)) || ((type == 60) || (type == 70))) - { - if (num2 == -2) - { - num2 = type; - } - if (num7 == -2) - { - num7 = type; - } - if (num4 == -2) - { - num4 = type; - } - if (num5 == -2) - { - num5 = type; - } - if (index == -2) - { - index = type; - } - if (num3 == -2) - { - num3 = type; - } - if (num6 == -2) - { - num6 = type; - } - if (num8 == -2) - { - num8 = type; - } - } - if (((num2 == type) && (num7 == type)) && ((num4 == type) & (num5 == type))) - { - if ((index != type) && (num3 != type)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x6c; - rectangle.Y = 0x12; - break; - - case 1: - rectangle.X = 0x7e; - rectangle.Y = 0x12; - break; - - case 2: - rectangle.X = 0x90; - rectangle.Y = 0x12; - break; - } - } - else if ((num6 != type) && (num8 != type)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x6c; - rectangle.Y = 0x24; - break; - - case 1: - rectangle.X = 0x7e; - rectangle.Y = 0x24; - break; - - case 2: - rectangle.X = 0x90; - rectangle.Y = 0x24; - break; - } - } - else if ((index != type) && (num6 != type)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 180; - rectangle.Y = 0; - break; - - case 1: - rectangle.X = 180; - rectangle.Y = 0x12; - break; - - case 2: - rectangle.X = 180; - rectangle.Y = 0x24; - break; - } - } - else if ((num3 != type) && (num8 != type)) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0xc6; - rectangle.Y = 0; - break; - - case 1: - rectangle.X = 0xc6; - rectangle.Y = 0x12; - break; - - case 2: - rectangle.X = 0xc6; - rectangle.Y = 0x24; - break; - } - } - else - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x12; - rectangle.Y = 0x12; - break; - - case 1: - rectangle.X = 0x24; - rectangle.Y = 0x12; - break; - - case 2: - rectangle.X = 0x36; - rectangle.Y = 0x12; - break; - } - } - } - else if (((num2 != type) && (num7 == type)) && ((num4 == type) & (num5 == type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x12; - rectangle.Y = 0; - break; - - case 1: - rectangle.X = 0x24; - rectangle.Y = 0; - break; - - case 2: - rectangle.X = 0x36; - rectangle.Y = 0; - break; - } - } - else if (((num2 == type) && (num7 != type)) && ((num4 == type) & (num5 == type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x12; - rectangle.Y = 0x24; - break; - - case 1: - rectangle.X = 0x24; - rectangle.Y = 0x24; - break; - - case 2: - rectangle.X = 0x36; - rectangle.Y = 0x24; - break; - } - } - else if (((num2 == type) && (num7 == type)) && ((num4 != type) & (num5 == type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0; - rectangle.Y = 0; - break; - - case 1: - rectangle.X = 0; - rectangle.Y = 0x12; - break; - - case 2: - rectangle.X = 0; - rectangle.Y = 0x24; - break; - } - } - else if (((num2 == type) && (num7 == type)) && ((num4 == type) & (num5 != type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x48; - rectangle.Y = 0; - break; - - case 1: - rectangle.X = 0x48; - rectangle.Y = 0x12; - break; - - case 2: - rectangle.X = 0x48; - rectangle.Y = 0x24; - break; - } - } - else if (((num2 != type) && (num7 == type)) && ((num4 != type) & (num5 == type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0; - rectangle.Y = 0x36; - break; - - case 1: - rectangle.X = 0x24; - rectangle.Y = 0x36; - break; - - case 2: - rectangle.X = 0x48; - rectangle.Y = 0x36; - break; - } - } - else if (((num2 != type) && (num7 == type)) && ((num4 == type) & (num5 != type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x12; - rectangle.Y = 0x36; - break; - - case 1: - rectangle.X = 0x36; - rectangle.Y = 0x36; - break; - - case 2: - rectangle.X = 90; - rectangle.Y = 0x36; - break; - } - } - else if (((num2 == type) && (num7 != type)) && ((num4 != type) & (num5 == type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0; - rectangle.Y = 0x48; - break; - - case 1: - rectangle.X = 0x24; - rectangle.Y = 0x48; - break; - - case 2: - rectangle.X = 0x48; - rectangle.Y = 0x48; - break; - } - } - else if (((num2 == type) && (num7 != type)) && ((num4 == type) & (num5 != type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x12; - rectangle.Y = 0x48; - break; - - case 1: - rectangle.X = 0x36; - rectangle.Y = 0x48; - break; - - case 2: - rectangle.X = 90; - rectangle.Y = 0x48; - break; - } - } - else if (((num2 == type) && (num7 == type)) && ((num4 != type) & (num5 != type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 90; - rectangle.Y = 0; - break; - - case 1: - rectangle.X = 90; - rectangle.Y = 0x12; - break; - - case 2: - rectangle.X = 90; - rectangle.Y = 0x24; - break; - } - } - else if (((num2 != type) && (num7 != type)) && ((num4 == type) & (num5 == type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x6c; - rectangle.Y = 0x48; - break; - - case 1: - rectangle.X = 0x7e; - rectangle.Y = 0x48; - break; - - case 2: - rectangle.X = 0x90; - rectangle.Y = 0x48; - break; - } - } - else if (((num2 != type) && (num7 == type)) && ((num4 != type) & (num5 != type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x6c; - rectangle.Y = 0; - break; - - case 1: - rectangle.X = 0x7e; - rectangle.Y = 0; - break; - - case 2: - rectangle.X = 0x90; - rectangle.Y = 0; - break; - } - } - else if (((num2 == type) && (num7 != type)) && ((num4 != type) & (num5 != type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0x6c; - rectangle.Y = 0x36; - break; - - case 1: - rectangle.X = 0x7e; - rectangle.Y = 0x36; - break; - - case 2: - rectangle.X = 0x90; - rectangle.Y = 0x36; - break; - } - } - else if (((num2 != type) && (num7 != type)) && ((num4 != type) & (num5 == type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0xa2; - rectangle.Y = 0; - break; - - case 1: - rectangle.X = 0xa2; - rectangle.Y = 0x12; - break; - - case 2: - rectangle.X = 0xa2; - rectangle.Y = 0x24; - break; - } - } - else if (((num2 != type) && (num7 != type)) && ((num4 == type) & (num5 != type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0xd8; - rectangle.Y = 0; - break; - - case 1: - rectangle.X = 0xd8; - rectangle.Y = 0x12; - break; - - case 2: - rectangle.X = 0xd8; - rectangle.Y = 0x24; - break; - } - } - else if (((num2 != type) && (num7 != type)) && ((num4 != type) & (num5 != type))) - { - switch (frameNumber) - { - case 0: - rectangle.X = 0xa2; - rectangle.Y = 0x36; - break; - - case 1: - rectangle.X = 180; - rectangle.Y = 0x36; - break; - - case 2: - rectangle.X = 0xc6; - rectangle.Y = 0x36; - break; - } - } - } - if ((rectangle.X <= -1) || (rectangle.Y <= -1)) - { - if (frameNumber <= 0) - { - rectangle.X = 0x12; - rectangle.Y = 0x12; - } - if (frameNumber == 1) - { - rectangle.X = 0x24; - rectangle.Y = 0x12; - } - if (frameNumber >= 2) - { - rectangle.X = 0x36; - rectangle.Y = 0x12; - } - } - Main.tile[i, j].frameX = (short) rectangle.X; - Main.tile[i, j].frameY = (short) rectangle.Y; - if ((type == 0x34) || (type == 0x3e)) - { - if (Main.tile[i, j - 1] != null) - { - if (!Main.tile[i, j - 1].active) - { - num2 = -1; - } - else - { - num2 = Main.tile[i, j - 1].type; - } - } - else - { - num2 = type; - } - if (((num2 != type) && (num2 != 2)) && (num2 != 60)) - { - KillTile(i, j, false, false, false); - } - } - if (type == 0x35) - { - if (Main.netMode == 0) - { - if ((Main.tile[i, j + 1] != null) && !Main.tile[i, j + 1].active) - { - bool flag3 = true; - if (Main.tile[i, j - 1].active && (Main.tile[i, j - 1].type == 0x15)) - { - flag3 = false; - } - if (flag3) - { - Main.tile[i, j].active = false; - Projectile.NewProjectile((float) ((i * 0x10) + 8), (float) ((j * 0x10) + 8), 0f, 0.41f, 0x1f, 10, 0f, Main.myPlayer); - SquareTileFrame(i, j, true); - } - } - } - else if (((Main.netMode == 2) && (Main.tile[i, j + 1] != null)) && !Main.tile[i, j + 1].active) - { - bool flag4 = true; - if (Main.tile[i, j - 1].active && (Main.tile[i, j - 1].type == 0x15)) - { - flag4 = false; - } - if (flag4) - { - Main.tile[i, j].active = false; - int num36 = Projectile.NewProjectile((float) ((i * 0x10) + 8), (float) ((j * 0x10) + 8), 0f, 0.41f, 0x1f, 10, 0f, Main.myPlayer); - Main.projectile[num36].velocity.Y = 0.5f; - Main.projectile[num36].position.Y += 2f; - NetMessage.SendTileSquare(-1, i, j, 1); - SquareTileFrame(i, j, true); - } - } - } - if (((rectangle.X != frameX) && (rectangle.Y != frameY)) && ((frameX >= 0) && (frameY >= 0))) - { - bool mergeUp = WorldGen.mergeUp; - bool mergeDown = WorldGen.mergeDown; - bool mergeLeft = WorldGen.mergeLeft; - bool mergeRight = WorldGen.mergeRight; - TileFrame(i - 1, j, false, false); - TileFrame(i + 1, j, false, false); - TileFrame(i, j - 1, false, false); - TileFrame(i, j + 1, false, false); - WorldGen.mergeUp = mergeUp; - WorldGen.mergeDown = mergeDown; - WorldGen.mergeLeft = mergeLeft; - WorldGen.mergeRight = mergeRight; - } - } - } - } - } - } - } - - public static void TileRunner(int i, int j, double strength, int steps, int type, bool addTile = false, float speedX = 0f, float speedY = 0f, bool noYChange = false, bool overRide = true) - { - Vector2 vector; - Vector2 vector2; - double num5 = strength; - float num6 = steps; - vector.X = i; - vector.Y = j; - vector2.X = genRand.Next(-10, 11) * 0.1f; - vector2.Y = genRand.Next(-10, 11) * 0.1f; - if ((speedX != 0f) || (speedY != 0f)) - { - vector2.X = speedX; - vector2.Y = speedY; - } - while ((num5 > 0.0) && (num6 > 0f)) - { - num5 = strength * (num6 / ((float) steps)); - num6--; - int num = (int) (vector.X - (num5 * 0.5)); - int maxTilesX = (int) (vector.X + (num5 * 0.5)); - int num2 = (int) (vector.Y - (num5 * 0.5)); - int maxTilesY = (int) (vector.Y + (num5 * 0.5)); - if (num < 0) - { - num = 0; - } - if (maxTilesX > Main.maxTilesX) - { - maxTilesX = Main.maxTilesX; - } - if (num2 < 0) - { - num2 = 0; - } - if (maxTilesY > Main.maxTilesY) - { - maxTilesY = Main.maxTilesY; - } - for (int k = num; k < maxTilesX; k++) - { - for (int m = num2; m < maxTilesY; m++) - { - if ((Math.Abs((float) (k - vector.X)) + Math.Abs((float) (m - vector.Y))) < ((strength * 0.5) * (1.0 + (genRand.Next(-10, 11) * 0.015)))) - { - if (type < 0) - { - if (((type == -2) && Main.tile[k, m].active) && ((m < waterLine) || (m > lavaLine))) - { - Main.tile[k, m].liquid = 0xff; - if (m > lavaLine) - { - Main.tile[k, m].lava = true; - } - } - Main.tile[k, m].active = false; - } - else - { - if (((overRide || !Main.tile[k, m].active) && ((type != 40) || (Main.tile[k, m].type != 0x35))) && ((!Main.tileStone[type] || (Main.tile[k, m].type == 1)) && (Main.tile[k, m].type != 0x2d))) - { - Main.tile[k, m].type = (byte) type; - } - if (addTile) - { - Main.tile[k, m].active = true; - Main.tile[k, m].liquid = 0; - Main.tile[k, m].lava = false; - } - if (noYChange && (m < Main.worldSurface)) - { - Main.tile[k, m].wall = 2; - } - if (((type == 0x3b) && (m > waterLine)) && (Main.tile[k, m].liquid > 0)) - { - Main.tile[k, m].lava = false; - Main.tile[k, m].liquid = 0; - } - } - } - } - } - vector += vector2; - if (num5 > 50.0) - { - vector += vector2; - num6--; - vector2.Y += genRand.Next(-10, 11) * 0.05f; - vector2.X += genRand.Next(-10, 11) * 0.05f; - if (num5 > 100.0) - { - vector += vector2; - num6--; - vector2.Y += genRand.Next(-10, 11) * 0.05f; - vector2.X += genRand.Next(-10, 11) * 0.05f; - if (num5 > 150.0) - { - vector += vector2; - num6--; - vector2.Y += genRand.Next(-10, 11) * 0.05f; - vector2.X += genRand.Next(-10, 11) * 0.05f; - if (num5 > 200.0) - { - vector += vector2; - num6--; - vector2.Y += genRand.Next(-10, 11) * 0.05f; - vector2.X += genRand.Next(-10, 11) * 0.05f; - if (num5 > 250.0) - { - vector += vector2; - num6--; - vector2.Y += genRand.Next(-10, 11) * 0.05f; - vector2.X += genRand.Next(-10, 11) * 0.05f; - if (num5 > 300.0) - { - vector += vector2; - num6--; - vector2.Y += genRand.Next(-10, 11) * 0.05f; - vector2.X += genRand.Next(-10, 11) * 0.05f; - if (num5 > 400.0) - { - vector += vector2; - num6--; - vector2.Y += genRand.Next(-10, 11) * 0.05f; - vector2.X += genRand.Next(-10, 11) * 0.05f; - if (num5 > 500.0) - { - vector += vector2; - num6--; - vector2.Y += genRand.Next(-10, 11) * 0.05f; - vector2.X += genRand.Next(-10, 11) * 0.05f; - if (num5 > 600.0) - { - vector += vector2; - num6--; - vector2.Y += genRand.Next(-10, 11) * 0.05f; - vector2.X += genRand.Next(-10, 11) * 0.05f; - if (num5 > 700.0) - { - vector += vector2; - num6--; - vector2.Y += genRand.Next(-10, 11) * 0.05f; - vector2.X += genRand.Next(-10, 11) * 0.05f; - if (num5 > 800.0) - { - vector += vector2; - num6--; - vector2.Y += genRand.Next(-10, 11) * 0.05f; - vector2.X += genRand.Next(-10, 11) * 0.05f; - if (num5 > 900.0) - { - vector += vector2; - num6--; - vector2.Y += genRand.Next(-10, 11) * 0.05f; - vector2.X += genRand.Next(-10, 11) * 0.05f; - } - } - } - } - } - } - } - } - } - } - } - } - vector2.X += genRand.Next(-10, 11) * 0.05f; - if (vector2.X > 1f) - { - vector2.X = 1f; - } - if (vector2.X < -1f) - { - vector2.X = -1f; - } - if (!noYChange) - { - vector2.Y += genRand.Next(-10, 11) * 0.05f; - if (vector2.Y > 1f) - { - vector2.Y = 1f; - } - if (vector2.Y < -1f) - { - vector2.Y = -1f; - } - } - else if (num5 < 3.0) - { - if (vector2.Y > 1f) - { - vector2.Y = 1f; - } - if (vector2.Y < -1f) - { - vector2.Y = -1f; - } - } - if (type == 0x3b) - { - if (vector2.Y > 0.5) - { - vector2.Y = 0.5f; - } - if (vector2.Y < -0.5) - { - vector2.Y = -0.5f; - } - if (vector.Y < (Main.rockLayer + 100.0)) - { - vector2.Y = 1f; - } - if (vector.Y > (Main.maxTilesY - 300)) - { - vector2.Y = -1f; - } - } - } - } - - public static void UpdateWorld() - { - Liquid.skipCount++; - if (Liquid.skipCount > 1) - { - Liquid.UpdateLiquid(); - Liquid.skipCount = 0; - } - float num = 4E-05f; - float num2 = 2E-05f; - bool flag = false; - spawnDelay++; - if (Main.invasionType > 0) - { - spawnDelay = 0; - } - if (spawnDelay >= 20) - { - flag = true; - spawnDelay = 0; - for (int k = 0; k < 0x3e8; k++) - { - if ((Main.npc[k].active && Main.npc[k].homeless) && Main.npc[k].townNPC) - { - spawnNPC = Main.npc[k].type; - break; - } - } - } - for (int i = 0; i < ((Main.maxTilesX * Main.maxTilesY) * num); i++) - { - int num5 = genRand.Next(10, Main.maxTilesX - 10); - int num6 = genRand.Next(10, ((int) Main.worldSurface) - 1); - int num7 = num5 - 1; - int num8 = num5 + 2; - int num9 = num6 - 1; - int num10 = num6 + 2; - if (num7 < 10) - { - num7 = 10; - } - if (num8 > (Main.maxTilesX - 10)) - { - num8 = Main.maxTilesX - 10; - } - if (num9 < 10) - { - num9 = 10; - } - if (num10 > (Main.maxTilesY - 10)) - { - num10 = Main.maxTilesY - 10; - } - if (Main.tile[num5, num6] != null) - { - if (Main.tile[num5, num6].liquid > 0x20) - { - if (Main.tile[num5, num6].active && (((Main.tile[num5, num6].type == 3) || (Main.tile[num5, num6].type == 20)) || (((Main.tile[num5, num6].type == 0x18) || (Main.tile[num5, num6].type == 0x1b)) || (Main.tile[num5, num6].type == 0x49)))) - { - KillTile(num5, num6, false, false, false); - if (Main.netMode == 2) - { - NetMessage.SendData(0x11, -1, -1, "", 0, (float) num5, (float) num6, 0f); - } - } - } - else if (Main.tile[num5, num6].active) - { - if (Main.tile[num5, num6].type == 0x4e) - { - if (!Main.tile[num5, num9].active) - { - PlaceTile(num5, num9, 3, true, false, -1); - if ((Main.netMode == 2) && Main.tile[num5, num9].active) - { - NetMessage.SendTileSquare(-1, num5, num9, 1); - } - } - } - else if (((Main.tile[num5, num6].type == 2) || (Main.tile[num5, num6].type == 0x17)) || (Main.tile[num5, num6].type == 0x20)) - { - int type = Main.tile[num5, num6].type; - if ((!Main.tile[num5, num9].active && (genRand.Next(10) == 0)) && (type == 2)) - { - PlaceTile(num5, num9, 3, true, false, -1); - if ((Main.netMode == 2) && Main.tile[num5, num9].active) - { - NetMessage.SendTileSquare(-1, num5, num9, 1); - } - } - if ((!Main.tile[num5, num9].active && (genRand.Next(10) == 0)) && (type == 0x17)) - { - PlaceTile(num5, num9, 0x18, true, false, -1); - if ((Main.netMode == 2) && Main.tile[num5, num9].active) - { - NetMessage.SendTileSquare(-1, num5, num9, 1); - } - } - bool flag2 = false; - for (int m = num7; m < num8; m++) - { - for (int n = num9; n < num10; n++) - { - if (((num5 != m) || (num6 != n)) && Main.tile[m, n].active) - { - if (type == 0x20) - { - type = 0x17; - } - if ((Main.tile[m, n].type == 0) || ((type == 0x17) && (Main.tile[m, n].type == 2))) - { - SpreadGrass(m, n, 0, type, false); - if (type == 0x17) - { - SpreadGrass(m, n, 2, type, false); - } - if (Main.tile[m, n].type == type) - { - SquareTileFrame(m, n, true); - flag2 = true; - } - } - } - } - } - if ((Main.netMode == 2) && flag2) - { - NetMessage.SendTileSquare(-1, num5, num6, 3); - } - } - else if (((Main.tile[num5, num6].type == 20) && !PlayerLOS(num5, num6)) && (genRand.Next(5) == 0)) - { - GrowTree(num5, num6); - } - if (((Main.tile[num5, num6].type == 3) && (genRand.Next(10) == 0)) && (Main.tile[num5, num6].frameX < 0x90)) - { - Main.tile[num5, num6].type = 0x49; - if (Main.netMode == 2) - { - NetMessage.SendTileSquare(-1, num5, num6, 3); - } - } - if ((Main.tile[num5, num6].type == 0x20) && (genRand.Next(3) == 0)) - { - int num14 = num5; - int num15 = num6; - int num16 = 0; - if (Main.tile[num14 + 1, num15].active && (Main.tile[num14 + 1, num15].type == 0x20)) - { - num16++; - } - if (Main.tile[num14 - 1, num15].active && (Main.tile[num14 - 1, num15].type == 0x20)) - { - num16++; - } - if (Main.tile[num14, num15 + 1].active && (Main.tile[num14, num15 + 1].type == 0x20)) - { - num16++; - } - if (Main.tile[num14, num15 - 1].active && (Main.tile[num14, num15 - 1].type == 0x20)) - { - num16++; - } - if ((num16 < 3) || (Main.tile[num5, num6].type == 0x17)) - { - switch (genRand.Next(4)) - { - case 0: - num15--; - break; - - case 1: - num15++; - break; - - case 2: - num14--; - break; - - case 3: - num14++; - break; - } - if (!Main.tile[num14, num15].active) - { - num16 = 0; - if (Main.tile[num14 + 1, num15].active && (Main.tile[num14 + 1, num15].type == 0x20)) - { - num16++; - } - if (Main.tile[num14 - 1, num15].active && (Main.tile[num14 - 1, num15].type == 0x20)) - { - num16++; - } - if (Main.tile[num14, num15 + 1].active && (Main.tile[num14, num15 + 1].type == 0x20)) - { - num16++; - } - if (Main.tile[num14, num15 - 1].active && (Main.tile[num14, num15 - 1].type == 0x20)) - { - num16++; - } - if (num16 < 2) - { - int num18 = 7; - int num19 = num14 - num18; - int num20 = num14 + num18; - int num21 = num15 - num18; - int num22 = num15 + num18; - bool flag3 = false; - for (int num23 = num19; num23 < num20; num23++) - { - for (int num24 = num21; num24 < num22; num24++) - { - if ((((((Math.Abs((int) (num23 - num14)) * 2) + Math.Abs((int) (num24 - num15))) < 9) && Main.tile[num23, num24].active) && ((Main.tile[num23, num24].type == 0x17) && Main.tile[num23, num24 - 1].active)) && ((Main.tile[num23, num24 - 1].type == 0x20) && (Main.tile[num23, num24 - 1].liquid == 0))) - { - flag3 = true; - break; - } - } - } - if (flag3) - { - Main.tile[num14, num15].type = 0x20; - Main.tile[num14, num15].active = true; - SquareTileFrame(num14, num15, true); - if (Main.netMode == 2) - { - NetMessage.SendTileSquare(-1, num14, num15, 3); - } - } - } - } - } - } - if (((Main.tile[num5, num6].type == 2) || (Main.tile[num5, num6].type == 0x34)) && (((genRand.Next(5) == 0) && !Main.tile[num5, num6 + 1].active) && !Main.tile[num5, num6 + 1].lava)) - { - bool flag4 = false; - for (int num25 = num6; num25 > (num6 - 10); num25--) - { - if (Main.tile[num5, num25].active && (Main.tile[num5, num25].type == 2)) - { - flag4 = true; - break; - } - } - if (flag4) - { - int num26 = num5; - int num27 = num6 + 1; - Main.tile[num26, num27].type = 0x34; - Main.tile[num26, num27].active = true; - SquareTileFrame(num26, num27, true); - if (Main.netMode == 2) - { - NetMessage.SendTileSquare(-1, num26, num27, 3); - } - } - } - } - else if (flag && (spawnNPC > 0)) - { - SpawnNPC(num5, num6); - } - } - } - for (int j = 0; j < ((Main.maxTilesX * Main.maxTilesY) * num2); j++) - { - int num29 = genRand.Next(10, Main.maxTilesX - 10); - int num30 = genRand.Next(((int) Main.worldSurface) + 2, Main.maxTilesY - 200); - int num31 = num29 - 1; - int num32 = num29 + 2; - int num33 = num30 - 1; - int num34 = num30 + 2; - if (num31 < 10) - { - num31 = 10; - } - if (num32 > (Main.maxTilesX - 10)) - { - num32 = Main.maxTilesX - 10; - } - if (num33 < 10) - { - num33 = 10; - } - if (num34 > (Main.maxTilesY - 10)) - { - num34 = Main.maxTilesY - 10; - } - if (Main.tile[num29, num30] != null) - { - if (Main.tile[num29, num30].liquid > 0x20) - { - if (Main.tile[num29, num30].active && ((Main.tile[num29, num30].type == 0x3d) || (Main.tile[num29, num30].type == 0x4a))) - { - KillTile(num29, num30, false, false, false); - if (Main.netMode == 2) - { - NetMessage.SendData(0x11, -1, -1, "", 0, (float) num29, (float) num30, 0f); - } - } - continue; - } - if (Main.tile[num29, num30].active) - { - if (Main.tile[num29, num30].type == 60) - { - int grass = Main.tile[num29, num30].type; - if (!Main.tile[num29, num33].active && (genRand.Next(10) == 0)) - { - PlaceTile(num29, num33, 0x3d, true, false, -1); - if ((Main.netMode == 2) && Main.tile[num29, num33].active) - { - NetMessage.SendTileSquare(-1, num29, num33, 1); - } - } - bool flag5 = false; - for (int num36 = num31; num36 < num32; num36++) - { - for (int num37 = num33; num37 < num34; num37++) - { - if (((num29 != num36) || (num30 != num37)) && (Main.tile[num36, num37].active && (Main.tile[num36, num37].type == 0x3b))) - { - SpreadGrass(num36, num37, 0x3b, grass, false); - if (Main.tile[num36, num37].type == grass) - { - SquareTileFrame(num36, num37, true); - flag5 = true; - } - } - } - } - if ((Main.netMode == 2) && flag5) - { - NetMessage.SendTileSquare(-1, num29, num30, 3); - } - } - if (((Main.tile[num29, num30].type == 0x3d) && (genRand.Next(3) == 0)) && (Main.tile[num29, num30].frameX < 0x90)) - { - Main.tile[num29, num30].type = 0x4a; - if (Main.netMode == 2) - { - NetMessage.SendTileSquare(-1, num29, num30, 3); - } - } - if (((Main.tile[num29, num30].type == 60) || (Main.tile[num29, num30].type == 0x3e)) && (((genRand.Next(5) == 0) && !Main.tile[num29, num30 + 1].active) && !Main.tile[num29, num30 + 1].lava)) - { - bool flag6 = false; - for (int num38 = num30; num38 > (num30 - 10); num38--) - { - if (Main.tile[num29, num38].active && (Main.tile[num29, num38].type == 60)) - { - flag6 = true; - break; - } - } - if (flag6) - { - int num39 = num29; - int num40 = num30 + 1; - Main.tile[num39, num40].type = 0x3e; - Main.tile[num39, num40].active = true; - SquareTileFrame(num39, num40, true); - if (Main.netMode == 2) - { - NetMessage.SendTileSquare(-1, num39, num40, 3); - } - } - } - if ((Main.tile[num29, num30].type == 0x45) && (genRand.Next(3) == 0)) - { - int num41 = num29; - int num42 = num30; - int num43 = 0; - if (Main.tile[num41 + 1, num42].active && (Main.tile[num41 + 1, num42].type == 0x45)) - { - num43++; - } - if (Main.tile[num41 - 1, num42].active && (Main.tile[num41 - 1, num42].type == 0x45)) - { - num43++; - } - if (Main.tile[num41, num42 + 1].active && (Main.tile[num41, num42 + 1].type == 0x45)) - { - num43++; - } - if (Main.tile[num41, num42 - 1].active && (Main.tile[num41, num42 - 1].type == 0x45)) - { - num43++; - } - if ((num43 < 3) || (Main.tile[num29, num30].type == 60)) - { - switch (genRand.Next(4)) - { - case 0: - num42--; - break; - - case 1: - num42++; - break; - - case 2: - num41--; - break; - - case 3: - num41++; - break; - } - if (!Main.tile[num41, num42].active) - { - num43 = 0; - if (Main.tile[num41 + 1, num42].active && (Main.tile[num41 + 1, num42].type == 0x45)) - { - num43++; - } - if (Main.tile[num41 - 1, num42].active && (Main.tile[num41 - 1, num42].type == 0x45)) - { - num43++; - } - if (Main.tile[num41, num42 + 1].active && (Main.tile[num41, num42 + 1].type == 0x45)) - { - num43++; - } - if (Main.tile[num41, num42 - 1].active && (Main.tile[num41, num42 - 1].type == 0x45)) - { - num43++; - } - if (num43 < 2) - { - int num45 = 7; - int num46 = num41 - num45; - int num47 = num41 + num45; - int num48 = num42 - num45; - int num49 = num42 + num45; - bool flag7 = false; - for (int num50 = num46; num50 < num47; num50++) - { - for (int num51 = num48; num51 < num49; num51++) - { - if ((((((Math.Abs((int) (num50 - num41)) * 2) + Math.Abs((int) (num51 - num42))) < 9) && Main.tile[num50, num51].active) && ((Main.tile[num50, num51].type == 60) && Main.tile[num50, num51 - 1].active)) && ((Main.tile[num50, num51 - 1].type == 0x45) && (Main.tile[num50, num51 - 1].liquid == 0))) - { - flag7 = true; - break; - } - } - } - if (flag7) - { - Main.tile[num41, num42].type = 0x45; - Main.tile[num41, num42].active = true; - SquareTileFrame(num41, num42, true); - if (Main.netMode == 2) - { - NetMessage.SendTileSquare(-1, num41, num42, 3); - } - } - } - } - } - } - if (Main.tile[num29, num30].type == 70) - { - int num52 = Main.tile[num29, num30].type; - if (!Main.tile[num29, num33].active && (genRand.Next(10) == 0)) - { - PlaceTile(num29, num33, 0x47, true, false, -1); - if ((Main.netMode == 2) && Main.tile[num29, num33].active) - { - NetMessage.SendTileSquare(-1, num29, num33, 1); - } - } - bool flag8 = false; - for (int num53 = num31; num53 < num32; num53++) - { - for (int num54 = num33; num54 < num34; num54++) - { - if (((num29 != num53) || (num30 != num54)) && (Main.tile[num53, num54].active && (Main.tile[num53, num54].type == 0x3b))) - { - SpreadGrass(num53, num54, 0x3b, num52, false); - if (Main.tile[num53, num54].type == num52) - { - SquareTileFrame(num53, num54, true); - flag8 = true; - } - } - } - } - if ((Main.netMode == 2) && flag8) - { - NetMessage.SendTileSquare(-1, num29, num30, 3); - } - } - continue; - } - if (flag && (spawnNPC > 0)) - { - SpawnNPC(num29, num30); - } - } - } - if (!Main.dayTime) - { - float num55 = Main.maxTilesX / 0x1068; - if (Main.rand.Next(0x1f40) < (10f * num55)) - { - int num56 = 12; - int num57 = Main.rand.Next(Main.maxTilesX - 50) + 100; - num57 *= 0x10; - int num58 = Main.rand.Next((int) (Main.maxTilesY * 0.05)) * 0x10; - Vector2 vector = new Vector2((float) num57, (float) num58); - float speedX = Main.rand.Next(-100, 0x65); - float speedY = Main.rand.Next(200) + 100; - float num61 = (float) Math.Sqrt((double) ((speedX * speedX) + (speedY * speedY))); - num61 = ((float) num56) / num61; - speedX *= num61; - speedY *= num61; - Projectile.NewProjectile(vector.X, vector.Y, speedX, speedY, 12, 0x3e8, 10f, Main.myPlayer); - } - } - } - - public static void WallFrame(int i, int j, bool resetFrame = false) - { - if ((((i >= 0) && (j >= 0)) && ((i < Main.maxTilesX) && (j < Main.maxTilesY))) && ((Main.tile[i, j] != null) && (Main.tile[i, j].wall > 0))) - { - int num = -1; - int num2 = -1; - int num3 = -1; - int num4 = -1; - int num5 = -1; - int num6 = -1; - int num7 = -1; - int num8 = -1; - int wall = Main.tile[i, j].wall; - if (wall != 0) - { - Rectangle rectangle; - byte wallFrameX = Main.tile[i, j].wallFrameX; - byte wallFrameY = Main.tile[i, j].wallFrameY; - rectangle.X = -1; - rectangle.Y = -1; - if ((i - 1) < 0) - { - num = wall; - num4 = wall; - num6 = wall; - } - if ((i + 1) >= Main.maxTilesX) - { - num3 = wall; - num5 = wall; - num8 = wall; - } - if ((j - 1) < 0) - { - num = wall; - num2 = wall; - num3 = wall; - } - if ((j + 1) >= Main.maxTilesY) - { - num6 = wall; - num7 = wall; - num8 = wall; - } - if (((i - 1) >= 0) && (Main.tile[i - 1, j] != null)) - { - num4 = Main.tile[i - 1, j].wall; - } - if (((i + 1) < Main.maxTilesX) && (Main.tile[i + 1, j] != null)) - { - num5 = Main.tile[i + 1, j].wall; - } - if (((j - 1) >= 0) && (Main.tile[i, j - 1] != null)) - { - num2 = Main.tile[i, j - 1].wall; - } - if (((j + 1) < Main.maxTilesY) && (Main.tile[i, j + 1] != null)) - { - num7 = Main.tile[i, j + 1].wall; - } - if ((((i - 1) >= 0) && ((j - 1) >= 0)) && (Main.tile[i - 1, j - 1] != null)) - { - num = Main.tile[i - 1, j - 1].wall; - } - if ((((i + 1) < Main.maxTilesX) && ((j - 1) >= 0)) && (Main.tile[i + 1, j - 1] != null)) - { - num3 = Main.tile[i + 1, j - 1].wall; - } - if ((((i - 1) >= 0) && ((j + 1) < Main.maxTilesY)) && (Main.tile[i - 1, j + 1] != null)) - { - num6 = Main.tile[i - 1, j + 1].wall; - } - if ((((i + 1) < Main.maxTilesX) && ((j + 1) < Main.maxTilesY)) && (Main.tile[i + 1, j + 1] != null)) - { - num8 = Main.tile[i + 1, j + 1].wall; - } - if (wall == 2) - { - if (j == ((int) Main.worldSurface)) - { - num7 = wall; - num6 = wall; - num8 = wall; - } - else if (j >= ((int) Main.worldSurface)) - { - num7 = wall; - num6 = wall; - num8 = wall; - num2 = wall; - num = wall; - num3 = wall; - num4 = wall; - num5 = wall; - } - } - int wallFrameNumber = 0; - if (resetFrame) - { - wallFrameNumber = genRand.Next(0, 3); - Main.tile[i, j].wallFrameNumber = (byte) wallFrameNumber; - } - else - { - wallFrameNumber = Main.tile[i, j].wallFrameNumber; - } - if ((rectangle.X < 0) || (rectangle.Y < 0)) - { - if (((num2 == wall) && (num7 == wall)) && ((num4 == wall) & (num5 == wall))) - { - if ((num != wall) && (num3 != wall)) - { - switch (wallFrameNumber) - { - case 0: - rectangle.X = 0x6c; - rectangle.Y = 0x12; - break; - - case 1: - rectangle.X = 0x7e; - rectangle.Y = 0x12; - break; - - case 2: - rectangle.X = 0x90; - rectangle.Y = 0x12; - break; - } - } - else if ((num6 != wall) && (num8 != wall)) - { - switch (wallFrameNumber) - { - case 0: - rectangle.X = 0x6c; - rectangle.Y = 0x24; - break; - - case 1: - rectangle.X = 0x7e; - rectangle.Y = 0x24; - break; - - case 2: - rectangle.X = 0x90; - rectangle.Y = 0x24; - break; - } - } - else if ((num != wall) && (num6 != wall)) - { - switch (wallFrameNumber) - { - case 0: - rectangle.X = 180; - rectangle.Y = 0; - break; - - case 1: - rectangle.X = 180; - rectangle.Y = 0x12; - break; - - case 2: - rectangle.X = 180; - rectangle.Y = 0x24; - break; - } - } - else if ((num3 != wall) && (num8 != wall)) - { - switch (wallFrameNumber) - { - case 0: - rectangle.X = 0xc6; - rectangle.Y = 0; - break; - - case 1: - rectangle.X = 0xc6; - rectangle.Y = 0x12; - break; - - case 2: - rectangle.X = 0xc6; - rectangle.Y = 0x24; - break; - } - } - else - { - switch (wallFrameNumber) - { - case 0: - rectangle.X = 0x12; - rectangle.Y = 0x12; - break; - - case 1: - rectangle.X = 0x24; - rectangle.Y = 0x12; - break; - - case 2: - rectangle.X = 0x36; - rectangle.Y = 0x12; - break; - } - } - } - else if (((num2 != wall) && (num7 == wall)) && ((num4 == wall) & (num5 == wall))) - { - switch (wallFrameNumber) - { - case 0: - rectangle.X = 0x12; - rectangle.Y = 0; - break; - - case 1: - rectangle.X = 0x24; - rectangle.Y = 0; - break; - - case 2: - rectangle.X = 0x36; - rectangle.Y = 0; - break; - } - } - else if (((num2 == wall) && (num7 != wall)) && ((num4 == wall) & (num5 == wall))) - { - switch (wallFrameNumber) - { - case 0: - rectangle.X = 0x12; - rectangle.Y = 0x24; - break; - - case 1: - rectangle.X = 0x24; - rectangle.Y = 0x24; - break; - - case 2: - rectangle.X = 0x36; - rectangle.Y = 0x24; - break; - } - } - else if (((num2 == wall) && (num7 == wall)) && ((num4 != wall) & (num5 == wall))) - { - switch (wallFrameNumber) - { - case 0: - rectangle.X = 0; - rectangle.Y = 0; - break; - - case 1: - rectangle.X = 0; - rectangle.Y = 0x12; - break; - - case 2: - rectangle.X = 0; - rectangle.Y = 0x24; - break; - } - } - else if (((num2 == wall) && (num7 == wall)) && ((num4 == wall) & (num5 != wall))) - { - switch (wallFrameNumber) - { - case 0: - rectangle.X = 0x48; - rectangle.Y = 0; - break; - - case 1: - rectangle.X = 0x48; - rectangle.Y = 0x12; - break; - - case 2: - rectangle.X = 0x48; - rectangle.Y = 0x24; - break; - } - } - else if (((num2 != wall) && (num7 == wall)) && ((num4 != wall) & (num5 == wall))) - { - switch (wallFrameNumber) - { - case 0: - rectangle.X = 0; - rectangle.Y = 0x36; - break; - - case 1: - rectangle.X = 0x24; - rectangle.Y = 0x36; - break; - - case 2: - rectangle.X = 0x48; - rectangle.Y = 0x36; - break; - } - } - else if (((num2 != wall) && (num7 == wall)) && ((num4 == wall) & (num5 != wall))) - { - switch (wallFrameNumber) - { - case 0: - rectangle.X = 0x12; - rectangle.Y = 0x36; - break; - - case 1: - rectangle.X = 0x36; - rectangle.Y = 0x36; - break; - - case 2: - rectangle.X = 90; - rectangle.Y = 0x36; - break; - } - } - else if (((num2 == wall) && (num7 != wall)) && ((num4 != wall) & (num5 == wall))) - { - switch (wallFrameNumber) - { - case 0: - rectangle.X = 0; - rectangle.Y = 0x48; - break; - - case 1: - rectangle.X = 0x24; - rectangle.Y = 0x48; - break; - - case 2: - rectangle.X = 0x48; - rectangle.Y = 0x48; - break; - } - } - else if (((num2 == wall) && (num7 != wall)) && ((num4 == wall) & (num5 != wall))) - { - switch (wallFrameNumber) - { - case 0: - rectangle.X = 0x12; - rectangle.Y = 0x48; - break; - - case 1: - rectangle.X = 0x36; - rectangle.Y = 0x48; - break; - - case 2: - rectangle.X = 90; - rectangle.Y = 0x48; - break; - } - } - else if (((num2 == wall) && (num7 == wall)) && ((num4 != wall) & (num5 != wall))) - { - switch (wallFrameNumber) - { - case 0: - rectangle.X = 90; - rectangle.Y = 0; - break; - - case 1: - rectangle.X = 90; - rectangle.Y = 0x12; - break; - - case 2: - rectangle.X = 90; - rectangle.Y = 0x24; - break; - } - } - else if (((num2 != wall) && (num7 != wall)) && ((num4 == wall) & (num5 == wall))) - { - switch (wallFrameNumber) - { - case 0: - rectangle.X = 0x6c; - rectangle.Y = 0x48; - break; - - case 1: - rectangle.X = 0x7e; - rectangle.Y = 0x48; - break; - - case 2: - rectangle.X = 0x90; - rectangle.Y = 0x48; - break; - } - } - else if (((num2 != wall) && (num7 == wall)) && ((num4 != wall) & (num5 != wall))) - { - switch (wallFrameNumber) - { - case 0: - rectangle.X = 0x6c; - rectangle.Y = 0; - break; - - case 1: - rectangle.X = 0x7e; - rectangle.Y = 0; - break; - - case 2: - rectangle.X = 0x90; - rectangle.Y = 0; - break; - } - } - else if (((num2 == wall) && (num7 != wall)) && ((num4 != wall) & (num5 != wall))) - { - switch (wallFrameNumber) - { - case 0: - rectangle.X = 0x6c; - rectangle.Y = 0x36; - break; - - case 1: - rectangle.X = 0x7e; - rectangle.Y = 0x36; - break; - - case 2: - rectangle.X = 0x90; - rectangle.Y = 0x36; - break; - } - } - else if (((num2 != wall) && (num7 != wall)) && ((num4 != wall) & (num5 == wall))) - { - switch (wallFrameNumber) - { - case 0: - rectangle.X = 0xa2; - rectangle.Y = 0; - break; - - case 1: - rectangle.X = 0xa2; - rectangle.Y = 0x12; - break; - - case 2: - rectangle.X = 0xa2; - rectangle.Y = 0x24; - break; - } - } - else if (((num2 != wall) && (num7 != wall)) && ((num4 == wall) & (num5 != wall))) - { - switch (wallFrameNumber) - { - case 0: - rectangle.X = 0xd8; - rectangle.Y = 0; - break; - - case 1: - rectangle.X = 0xd8; - rectangle.Y = 0x12; - break; - - case 2: - rectangle.X = 0xd8; - rectangle.Y = 0x24; - break; - } - } - else if (((num2 != wall) && (num7 != wall)) && ((num4 != wall) & (num5 != wall))) - { - switch (wallFrameNumber) - { - case 0: - rectangle.X = 0xa2; - rectangle.Y = 0x36; - break; - - case 1: - rectangle.X = 180; - rectangle.Y = 0x36; - break; - - case 2: - rectangle.X = 0xc6; - rectangle.Y = 0x36; - break; - } - } - } - if ((rectangle.X <= -1) || (rectangle.Y <= -1)) - { - if (wallFrameNumber <= 0) - { - rectangle.X = 0x12; - rectangle.Y = 0x12; - } - if (wallFrameNumber == 1) - { - rectangle.X = 0x24; - rectangle.Y = 0x12; - } - if (wallFrameNumber >= 2) - { - rectangle.X = 0x36; - rectangle.Y = 0x12; - } - } - Main.tile[i, j].wallFrameX = (byte) rectangle.X; - Main.tile[i, j].wallFrameY = (byte) rectangle.Y; - } - } - } - - public static void WaterCheck() - { - Liquid.numLiquid = 0; - LiquidBuffer.numLiquidBuffer = 0; - for (int i = 1; i < (Main.maxTilesX - 1); i++) - { - for (int j = Main.maxTilesY - 2; j > 0; j--) - { - Main.tile[i, j].checkingLiquid = false; - if (((Main.tile[i, j].liquid > 0) && Main.tile[i, j].active) && (Main.tileSolid[Main.tile[i, j].type] && !Main.tileSolidTop[Main.tile[i, j].type])) - { - Main.tile[i, j].liquid = 0; - } - else if (Main.tile[i, j].liquid > 0) - { - if (Main.tile[i, j].active) - { - if (Main.tileWaterDeath[Main.tile[i, j].type]) - { - KillTile(i, j, false, false, false); - } - if (Main.tile[i, j].lava && Main.tileLavaDeath[Main.tile[i, j].type]) - { - KillTile(i, j, false, false, false); - } - } - if (((!Main.tile[i, j + 1].active || !Main.tileSolid[Main.tile[i, j + 1].type]) || Main.tileSolidTop[Main.tile[i, j + 1].type]) && (Main.tile[i, j + 1].liquid < 0xff)) - { - if (Main.tile[i, j + 1].liquid > 250) - { - Main.tile[i, j + 1].liquid = 0xff; - } - else - { - Liquid.AddWater(i, j); - } - } - if (((!Main.tile[i - 1, j].active || !Main.tileSolid[Main.tile[i - 1, j].type]) || Main.tileSolidTop[Main.tile[i - 1, j].type]) && (Main.tile[i - 1, j].liquid != Main.tile[i, j].liquid)) - { - Liquid.AddWater(i, j); - } - else if (((!Main.tile[i + 1, j].active || !Main.tileSolid[Main.tile[i + 1, j].type]) || Main.tileSolidTop[Main.tile[i + 1, j].type]) && (Main.tile[i + 1, j].liquid != Main.tile[i, j].liquid)) - { - Liquid.AddWater(i, j); - } - if (Main.tile[i, j].lava) - { - if ((Main.tile[i - 1, j].liquid > 0) && !Main.tile[i - 1, j].lava) - { - Liquid.AddWater(i, j); - } - else if ((Main.tile[i + 1, j].liquid > 0) && !Main.tile[i + 1, j].lava) - { - Liquid.AddWater(i, j); - } - else if ((Main.tile[i, j - 1].liquid > 0) && !Main.tile[i, j - 1].lava) - { - Liquid.AddWater(i, j); - } - else if ((Main.tile[i, j + 1].liquid > 0) && !Main.tile[i, j + 1].lava) - { - Liquid.AddWater(i, j); - } - } - } - } - } - } - - public static void worldGenCallBack(object threadContext) - { - Main.PlaySound(10, -1, -1, 1); - clearWorld(); - generateWorld(-1); - saveWorld(true); - Main.LoadWorlds(); - if (Main.menuMode == 10) - { - Main.menuMode = 6; - } - Main.PlaySound(10, -1, -1, 1); - } - } -} - diff --git a/Terraria/lbolt.ico b/Terraria/lbolt.ico deleted file mode 100644 index a0f55f40456b391502b9fbbce6dee12e5a2275b5..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1150 zcmbtS-77<39DWvByHInZgqmC+$(155xR^q_Kq>zLmt1H!Ecv=vZrmt02uVy+SWNP< z7G(&vOrrTHwV7EiH0yZIa+cW{J9$sfdEfJUKHlGZ&H+@sv|4cJ(2)*gb5%@;B^{xP z-ho-H%s6z~0d=GYgbtP_M_n>pbcgGk`fFC)EsUb8-E& z5%XJYZ>&wHnn7I}^73ckI0;8H0v`gb8zI(5iKO3zoB`d&Kx|*J_wQKU4l;Lyx-7Y~ zuwIC%g~d3J==Z$~IK1#95I)4%#2R%CN&FdDwspeu7>vvCK1a~fwohM?obP*$nsV57 z>~Vgvhg)9|gJv^%+1{lL@@n+-_T%_6l#sFMxF+9D{Q6Ilug1ZdE5Yx12%~REJb#(A vpWIAdgQ}WI9J${UGVWhOm|Ys6=C5-!!R@_C@Qd%lXu6|cFYOJm_78jlTMv%0 diff --git a/Terraria/messageBuffer.cs b/Terraria/messageBuffer.cs deleted file mode 100644 index 222071fb..00000000 --- a/Terraria/messageBuffer.cs +++ /dev/null @@ -1,1879 +0,0 @@ -namespace Terraria -{ - using System; - using System.Text; - using System.IO; - - public class messageBuffer - { - public bool broadcast; - public bool checkBytes; - public int maxSpam; - public int messageLength; - public byte[] readBuffer = new byte[0xffff]; - public const int readBufferMax = 0xffff; - public int spamCount; - public int totalData; - public int whoAmI; - public byte[] writeBuffer = new byte[0xffff]; - public const int writeBufferMax = 0xffff; - public bool writeLocked; - - public void GetData(int start, int length) - { - byte num50; - int num51; - int num52; - byte num53; - byte num58; - int num59; - int num60; - int num61; - int num158; - int num159; - int team; - string str14; - int num161; - if (this.whoAmI < 9) - { - Netplay.serverSock[this.whoAmI].timeOut = 0; - } - else - { - Netplay.clientSock.timeOut = 0; - } - byte msgType = 0; - int index = 0; - index = start + 1; - msgType = this.readBuffer[start]; - if ((Main.netMode == 1) && (Netplay.clientSock.statusMax > 0)) - { - Netplay.clientSock.statusCount++; - } - if (Main.verboseNetplay) - { - for (int i = start; i < (start + length); i++) - { - } - for (int j = start; j < (start + length); j++) - { - byte num1 = this.readBuffer[j]; - } - } - if (((Main.netMode == 2) && (msgType != 0x26)) && (Netplay.serverSock[this.whoAmI].state == -1)) - { - NetMessage.SendData(2, this.whoAmI, -1, "Incorrect password.", 0, 0f, 0f, 0f); - return; - } - if ((msgType == 1) && (Main.netMode == 2)) - { - if (Netplay.serverSock[this.whoAmI].state == 0) - { - if (Encoding.ASCII.GetString(this.readBuffer, start + 1, length - 1) == ("Terraria" + Main.curRelease)) - { - if ((Netplay.password == null) || (Netplay.password == "")) - { - Netplay.serverSock[this.whoAmI].state = 1; - NetMessage.SendData(3, this.whoAmI, -1, "", 0, 0f, 0f, 0f); - return; - } - Netplay.serverSock[this.whoAmI].state = -1; - NetMessage.SendData(0x25, this.whoAmI, -1, "", 0, 0f, 0f, 0f); - return; - } - NetMessage.SendData(2, this.whoAmI, -1, "You are not using the same version as this server.", 0, 0f, 0f, 0f); - return; - } - return; - } - if ((msgType == 2) && (Main.netMode == 1)) - { - Netplay.disconnect = true; - Main.statusText = Encoding.ASCII.GetString(this.readBuffer, start + 1, length - 1); - return; - } - if ((msgType == 3) && (Main.netMode == 1)) - { - if (Netplay.clientSock.state == 1) - { - Netplay.clientSock.state = 2; - } - int num5 = this.readBuffer[start + 1]; - if (num5 != Main.myPlayer) - { - Main.player[num5] = (Player) Main.player[Main.myPlayer].Clone(); - Main.player[Main.myPlayer] = new Player(); - Main.player[num5].whoAmi = num5; - Main.myPlayer = num5; - } - NetMessage.SendData(4, -1, -1, Main.player[Main.myPlayer].name, Main.myPlayer, 0f, 0f, 0f); - NetMessage.SendData(0x10, -1, -1, "", Main.myPlayer, 0f, 0f, 0f); - NetMessage.SendData(0x2a, -1, -1, "", Main.myPlayer, 0f, 0f, 0f); - for (int k = 0; k < 0x2c; k++) - { - NetMessage.SendData(5, -1, -1, Main.player[Main.myPlayer].inventory[k].name, Main.myPlayer, (float) k, 0f, 0f); - } - NetMessage.SendData(5, -1, -1, Main.player[Main.myPlayer].armor[0].name, Main.myPlayer, 44f, 0f, 0f); - NetMessage.SendData(5, -1, -1, Main.player[Main.myPlayer].armor[1].name, Main.myPlayer, 45f, 0f, 0f); - NetMessage.SendData(5, -1, -1, Main.player[Main.myPlayer].armor[2].name, Main.myPlayer, 46f, 0f, 0f); - NetMessage.SendData(5, -1, -1, Main.player[Main.myPlayer].armor[3].name, Main.myPlayer, 47f, 0f, 0f); - NetMessage.SendData(5, -1, -1, Main.player[Main.myPlayer].armor[4].name, Main.myPlayer, 48f, 0f, 0f); - NetMessage.SendData(5, -1, -1, Main.player[Main.myPlayer].armor[5].name, Main.myPlayer, 49f, 0f, 0f); - NetMessage.SendData(5, -1, -1, Main.player[Main.myPlayer].armor[6].name, Main.myPlayer, 50f, 0f, 0f); - NetMessage.SendData(5, -1, -1, Main.player[Main.myPlayer].armor[7].name, Main.myPlayer, 51f, 0f, 0f); - NetMessage.SendData(6, -1, -1, "", 0, 0f, 0f, 0f); - if (Netplay.clientSock.state == 2) - { - Netplay.clientSock.state = 3; - return; - } - return; - } - switch (msgType) - { - case 9: - if (Main.netMode == 1) - { - int num25 = BitConverter.ToInt32(this.readBuffer, start + 1); - string str4 = Encoding.ASCII.GetString(this.readBuffer, start + 5, length - 5); - Netplay.clientSock.statusMax += num25; - Netplay.clientSock.statusText = str4; - return; - } - return; - - case 10: - { - short number = BitConverter.ToInt16(this.readBuffer, start + 1); - int num27 = BitConverter.ToInt32(this.readBuffer, start + 3); - int num28 = BitConverter.ToInt32(this.readBuffer, start + 7); - index = start + 11; - for (int m = num27; m < (num27 + number); m++) - { - if (Main.tile[m, num28] == null) - { - Main.tile[m, num28] = new Tile(); - } - byte num29 = this.readBuffer[index]; - index++; - bool active = Main.tile[m, num28].active; - if ((num29 & 1) == 1) - { - Main.tile[m, num28].active = true; - } - else - { - Main.tile[m, num28].active = false; - } - if ((num29 & 2) == 2) - { - Main.tile[m, num28].lighted = true; - } - if ((num29 & 4) == 4) - { - Main.tile[m, num28].wall = 1; - } - else - { - Main.tile[m, num28].wall = 0; - } - if ((num29 & 8) == 8) - { - Main.tile[m, num28].liquid = 1; - } - else - { - Main.tile[m, num28].liquid = 0; - } - if (Main.tile[m, num28].active) - { - int type = Main.tile[m, num28].type; - Main.tile[m, num28].type = this.readBuffer[index]; - index++; - if (Main.tileFrameImportant[Main.tile[m, num28].type]) - { - Main.tile[m, num28].frameX = BitConverter.ToInt16(this.readBuffer, index); - index += 2; - Main.tile[m, num28].frameY = BitConverter.ToInt16(this.readBuffer, index); - index += 2; - } - else if (!active || (Main.tile[m, num28].type != type)) - { - Main.tile[m, num28].frameX = -1; - Main.tile[m, num28].frameY = -1; - } - } - if (Main.tile[m, num28].wall > 0) - { - Main.tile[m, num28].wall = this.readBuffer[index]; - index++; - } - if (Main.tile[m, num28].liquid > 0) - { - Main.tile[m, num28].liquid = this.readBuffer[index]; - index++; - byte num32 = this.readBuffer[index]; - index++; - if (num32 == 1) - { - Main.tile[m, num28].lava = true; - } - else - { - Main.tile[m, num28].lava = false; - } - } - } - if (Main.netMode == 2) - { - NetMessage.SendData(msgType, -1, this.whoAmI, "", number, (float) num27, (float) num28, 0f); - return; - } - return; - } - case 8: - if (Main.netMode == 2) - { - int x = BitConverter.ToInt32(this.readBuffer, index); - index += 4; - int y = BitConverter.ToInt32(this.readBuffer, index); - index += 4; - bool flag2 = true; - if ((x == -1) || (y == -1)) - { - flag2 = false; - } - else if ((x < 10) || (x > (Main.maxTilesX - 10))) - { - flag2 = false; - } - else if ((y < 10) || (y > (Main.maxTilesY - 10))) - { - flag2 = false; - } - int num16 = 0x546; - if (flag2) - { - num16 *= 2; - } - if (Netplay.serverSock[this.whoAmI].state == 2) - { - Netplay.serverSock[this.whoAmI].state = 3; - } - NetMessage.SendData(9, this.whoAmI, -1, "Receiving tile data", num16, 0f, 0f, 0f); - Netplay.serverSock[this.whoAmI].statusText2 = "is receiving tile data"; - ServerSock sock1 = Netplay.serverSock[this.whoAmI]; - sock1.statusMax += num16; - int sectionX = Netplay.GetSectionX(Main.spawnTileX); - int sectionY = Netplay.GetSectionY(Main.spawnTileY); - for (int n = sectionX - 2; n < (sectionX + 3); n++) - { - for (int num20 = sectionY - 1; num20 < (sectionY + 2); num20++) - { - NetMessage.SendSection(this.whoAmI, n, num20); - } - } - if (flag2) - { - x = Netplay.GetSectionX(x); - y = Netplay.GetSectionY(y); - for (int num21 = x - 2; num21 < (x + 3); num21++) - { - for (int num22 = y - 1; num22 < (y + 2); num22++) - { - NetMessage.SendSection(this.whoAmI, num21, num22); - } - } - NetMessage.SendData(11, this.whoAmI, -1, "", x - 2, (float) (y - 1), (float) (x + 2), (float) (y + 1)); - } - NetMessage.SendData(11, this.whoAmI, -1, "", sectionX - 2, (float) (sectionY - 1), (float) (sectionX + 2), (float) (sectionY + 1)); - for (int num23 = 0; num23 < 200; num23++) - { - if (Main.item[num23].active) - { - NetMessage.SendData(0x15, this.whoAmI, -1, "", num23, 0f, 0f, 0f); - NetMessage.SendData(0x16, this.whoAmI, -1, "", num23, 0f, 0f, 0f); - } - } - for (int num24 = 0; num24 < 0x3e8; num24++) - { - if (Main.npc[num24].active) - { - NetMessage.SendData(0x17, this.whoAmI, -1, "", num24, 0f, 0f, 0f); - } - } - NetMessage.SendData(0x31, this.whoAmI, -1, "", 0, 0f, 0f, 0f); - return; - } - return; - - case 11: - if (Main.netMode == 1) - { - int startX = BitConverter.ToInt16(this.readBuffer, index); - index += 4; - int startY = BitConverter.ToInt16(this.readBuffer, index); - index += 4; - int endX = BitConverter.ToInt16(this.readBuffer, index); - index += 4; - int endY = BitConverter.ToInt16(this.readBuffer, index); - index += 4; - WorldGen.SectionTileFrame(startX, startY, endX, endY); - return; - } - return; - - case 12: - { - int num37 = this.readBuffer[index]; - index++; - Main.player[num37].SpawnX = BitConverter.ToInt32(this.readBuffer, index); - index += 4; - Main.player[num37].SpawnY = BitConverter.ToInt32(this.readBuffer, index); - index += 4; - Main.player[num37].Spawn(); - if ((Main.netMode == 2) && (Netplay.serverSock[this.whoAmI].state >= 3)) - { - NetMessage.buffer[this.whoAmI].broadcast = true; - NetMessage.SendData(12, -1, this.whoAmI, "", this.whoAmI, 0f, 0f, 0f); - if (Netplay.serverSock[this.whoAmI].state == 3) - { - - Netplay.serverSock[this.whoAmI].state = 10; - NetMessage.greetPlayer(this.whoAmI); - NetMessage.syncPlayers(); - return; - } - } - return; - } - case 13: - { - int num38 = this.readBuffer[index]; - if ((Main.netMode == 1) && !Main.player[num38].active) - { - NetMessage.SendData(15, -1, -1, "", 0, 0f, 0f, 0f); - } - index++; - int num39 = this.readBuffer[index]; - index++; - int num40 = this.readBuffer[index]; - index++; - float num41 = BitConverter.ToSingle(this.readBuffer, index); - index += 4; - float num42 = BitConverter.ToSingle(this.readBuffer, index); - index += 4; - float num43 = BitConverter.ToSingle(this.readBuffer, index); - index += 4; - float num44 = BitConverter.ToSingle(this.readBuffer, index); - index += 4; - Main.player[num38].selectedItem = num40; - Main.player[num38].position.X = num41; - Main.player[num38].position.Y = num42; - Main.player[num38].velocity.X = num43; - Main.player[num38].velocity.Y = num44; - Main.player[num38].oldVelocity = Main.player[num38].velocity; - Main.player[num38].fallStart = (int) (num42 / 16f); - Main.player[num38].controlUp = false; - Main.player[num38].controlDown = false; - Main.player[num38].controlLeft = false; - Main.player[num38].controlRight = false; - Main.player[num38].controlJump = false; - Main.player[num38].controlUseItem = false; - Main.player[num38].direction = -1; - if ((num39 & 1) == 1) - { - Main.player[num38].controlUp = true; - } - if ((num39 & 2) == 2) - { - Main.player[num38].controlDown = true; - } - if ((num39 & 4) == 4) - { - Main.player[num38].controlLeft = true; - } - if ((num39 & 8) == 8) - { - Main.player[num38].controlRight = true; - } - if ((num39 & 0x10) == 0x10) - { - Main.player[num38].controlJump = true; - } - if ((num39 & 0x20) == 0x20) - { - Main.player[num38].controlUseItem = true; - } - if ((num39 & 0x40) == 0x40) - { - Main.player[num38].direction = 1; - } - if ((Main.netMode == 2) && (Netplay.serverSock[this.whoAmI].state == 10)) - { - NetMessage.SendData(13, -1, this.whoAmI, "", num38, 0f, 0f, 0f); - return; - } - return; - } - case 14: - if (Main.netMode == 1) - { - int num45 = this.readBuffer[index]; - index++; - int num46 = this.readBuffer[index]; - if (num46 == 1) - { - if (Main.player[num45].active) - { - Main.player[num45] = new Player(); - } - Main.player[num45].active = true; - return; - } - Main.player[num45].active = false; - return; - } - return; - - case 15: - if (Main.netMode == 2) - { - NetMessage.syncPlayers(); - return; - } - return; - - case 0x10: - { - int whoAmI = this.readBuffer[index]; - index++; - int num48 = BitConverter.ToInt16(this.readBuffer, index); - index += 2; - int num49 = BitConverter.ToInt16(this.readBuffer, index); - if (Main.netMode == 2) - { - whoAmI = this.whoAmI; - } - Main.player[whoAmI].statLife = num48; - Main.player[whoAmI].statLifeMax = num49; - if (Main.player[whoAmI].statLife <= 0) - { - Main.player[whoAmI].dead = true; - } - if (Main.netMode == 2) - { - NetMessage.SendData(0x10, -1, this.whoAmI, "", whoAmI, 0f, 0f, 0f); - return; - } - return; - } - case 7: - if (Main.netMode == 1) - { - Main.time = BitConverter.ToInt32(this.readBuffer, index); - index += 4; - Main.dayTime = false; - if (this.readBuffer[index] == 1) - { - Main.dayTime = true; - } - index++; - Main.moonPhase = this.readBuffer[index]; - index++; - int num13 = this.readBuffer[index]; - index++; - if (num13 == 1) - { - Main.bloodMoon = true; - } - else - { - Main.bloodMoon = false; - } - Main.maxTilesX = BitConverter.ToInt32(this.readBuffer, index); - index += 4; - Main.maxTilesY = BitConverter.ToInt32(this.readBuffer, index); - index += 4; - Main.spawnTileX = BitConverter.ToInt32(this.readBuffer, index); - index += 4; - Main.spawnTileY = BitConverter.ToInt32(this.readBuffer, index); - index += 4; - Main.worldSurface = BitConverter.ToInt32(this.readBuffer, index); - index += 4; - Main.rockLayer = BitConverter.ToInt32(this.readBuffer, index); - index += 4; - Main.worldID = BitConverter.ToInt32(this.readBuffer, index); - index += 4; - Main.worldName = Encoding.ASCII.GetString(this.readBuffer, index, (length - index) + start); - if (Netplay.clientSock.state == 3) - { - Netplay.clientSock.state = 4; - return; - } - } - return; - - case 6: - if (Main.netMode == 2) - { - if (Netplay.serverSock[this.whoAmI].state == 1) - { - Netplay.serverSock[this.whoAmI].state = 2; - } - NetMessage.SendData(7, this.whoAmI, -1, "", 0, 0f, 0f, 0f); - return; - } - return; - - case 5: - { - int num10 = this.readBuffer[start + 1]; - if (Main.netMode == 2) - { - num10 = this.whoAmI; - } - int num11 = this.readBuffer[start + 2]; - int num12 = this.readBuffer[start + 3]; - string itemName = Encoding.ASCII.GetString(this.readBuffer, start + 4, length - 4); - if (num11 < 0x2c) - { - Main.player[num10].inventory[num11] = new Item(); - Main.player[num10].inventory[num11].SetDefaults(itemName); - Main.player[num10].inventory[num11].stack = num12; - } - else - { - Main.player[num10].armor[num11 - 0x2c] = new Item(); - Main.player[num10].armor[num11 - 0x2c].SetDefaults(itemName); - Main.player[num10].armor[num11 - 0x2c].stack = num12; - } - if ((Main.netMode == 2) && (num10 == this.whoAmI)) - { - NetMessage.SendData(5, -1, this.whoAmI, itemName, num10, (float) num11, 0f, 0f); - return; - } - return; - } - case 4: - { - bool flag = false; - int num7 = this.readBuffer[start + 1]; - int num8 = this.readBuffer[start + 2]; - if (Main.netMode == 2) - { - num7 = this.whoAmI; - } - Main.player[num7].hair = num8; - Main.player[num7].whoAmi = num7; - index += 2; - Main.player[num7].hairColor.R = this.readBuffer[index]; - index++; - Main.player[num7].hairColor.G = this.readBuffer[index]; - index++; - Main.player[num7].hairColor.B = this.readBuffer[index]; - index++; - Main.player[num7].skinColor.R = this.readBuffer[index]; - index++; - Main.player[num7].skinColor.G = this.readBuffer[index]; - index++; - Main.player[num7].skinColor.B = this.readBuffer[index]; - index++; - Main.player[num7].eyeColor.R = this.readBuffer[index]; - index++; - Main.player[num7].eyeColor.G = this.readBuffer[index]; - index++; - Main.player[num7].eyeColor.B = this.readBuffer[index]; - index++; - Main.player[num7].shirtColor.R = this.readBuffer[index]; - index++; - Main.player[num7].shirtColor.G = this.readBuffer[index]; - index++; - Main.player[num7].shirtColor.B = this.readBuffer[index]; - index++; - Main.player[num7].underShirtColor.R = this.readBuffer[index]; - index++; - Main.player[num7].underShirtColor.G = this.readBuffer[index]; - index++; - Main.player[num7].underShirtColor.B = this.readBuffer[index]; - index++; - Main.player[num7].pantsColor.R = this.readBuffer[index]; - index++; - Main.player[num7].pantsColor.G = this.readBuffer[index]; - index++; - Main.player[num7].pantsColor.B = this.readBuffer[index]; - index++; - Main.player[num7].shoeColor.R = this.readBuffer[index]; - index++; - Main.player[num7].shoeColor.G = this.readBuffer[index]; - index++; - Main.player[num7].shoeColor.B = this.readBuffer[index]; - index++; - string text = Encoding.ASCII.GetString(this.readBuffer, index, (length - index) + start); - text = text.Replace("\\", ""); - if (text == "" || text == " ") - { - text = "mingebag"; - } - Main.player[num7].name = text; - if (Main.netMode == 2) - { - if (Netplay.serverSock[this.whoAmI].state < 10) - { - for (int num9 = 0; num9 < 8; num9++) - { - if (((num9 != num7) && (text == Main.player[num9].name)) && Netplay.serverSock[num9].active) - { - flag = true; - } - } - } - if (flag) - { - NetMessage.SendData(2, this.whoAmI, -1, text + " is already on this server.", 0, 0f, 0f, 0f); - return; - } - Netplay.serverSock[this.whoAmI].oldName = text; - Netplay.serverSock[this.whoAmI].name = text; - NetMessage.SendData(4, -1, this.whoAmI, text, num7, 0f, 0f, 0f); - return; - } - return; - } - default: - { - if (msgType != 0x11) - { - if (msgType == 0x12) - { - if (Main.netMode == 1) - { - byte num54 = this.readBuffer[index]; - index++; - int num55 = BitConverter.ToInt32(this.readBuffer, index); - index += 4; - short num56 = BitConverter.ToInt16(this.readBuffer, index); - index += 2; - short num57 = BitConverter.ToInt16(this.readBuffer, index); - index += 2; - if (num54 == 1) - { - Main.dayTime = true; - } - else - { - Main.dayTime = false; - } - Main.time = num55; - Main.sunModY = num56; - Main.moonModY = num57; - if (Main.netMode == 2) - { - NetMessage.SendData(0x12, -1, this.whoAmI, "", 0, 0f, 0f, 0f); - return; - } - } - return; - } - if (msgType != 0x13) - { - switch (msgType) - { - case 20: - { - short num63 = BitConverter.ToInt16(this.readBuffer, start + 1); - int num64 = BitConverter.ToInt32(this.readBuffer, start + 3); - int num65 = BitConverter.ToInt32(this.readBuffer, start + 7); - index = start + 11; - for (int num67 = num64; num67 < (num64 + num63); num67++) - { - for (int num68 = num65; num68 < (num65 + num63); num68++) - { - if (Main.tile[num67, num68] == null) - { - Main.tile[num67, num68] = new Tile(); - } - byte num66 = this.readBuffer[index]; - index++; - bool flag5 = Main.tile[num67, num68].active; - if ((num66 & 1) == 1) - { - Main.tile[num67, num68].active = true; - } - else - { - Main.tile[num67, num68].active = false; - } - if ((num66 & 2) == 2) - { - Main.tile[num67, num68].lighted = true; - } - if ((num66 & 4) == 4) - { - Main.tile[num67, num68].wall = 1; - } - else - { - Main.tile[num67, num68].wall = 0; - } - if ((num66 & 8) == 8) - { - Main.tile[num67, num68].liquid = 1; - } - else - { - Main.tile[num67, num68].liquid = 0; - } - if (Main.tile[num67, num68].active) - { - int num69 = Main.tile[num67, num68].type; - Main.tile[num67, num68].type = this.readBuffer[index]; - index++; - if (Main.tileFrameImportant[Main.tile[num67, num68].type]) - { - Main.tile[num67, num68].frameX = BitConverter.ToInt16(this.readBuffer, index); - index += 2; - Main.tile[num67, num68].frameY = BitConverter.ToInt16(this.readBuffer, index); - index += 2; - } - else if (!flag5 || (Main.tile[num67, num68].type != num69)) - { - Main.tile[num67, num68].frameX = -1; - Main.tile[num67, num68].frameY = -1; - } - } - if (Main.tile[num67, num68].wall > 0) - { - Main.tile[num67, num68].wall = this.readBuffer[index]; - index++; - } - if (Main.tile[num67, num68].liquid > 0) - { - Main.tile[num67, num68].liquid = this.readBuffer[index]; - index++; - byte num70 = this.readBuffer[index]; - index++; - if (num70 == 1) - { - Main.tile[num67, num68].lava = true; - } - else - { - Main.tile[num67, num68].lava = false; - } - } - } - } - WorldGen.RangeFrame(num64, num65, num64 + num63, num65 + num63); - if (Main.netMode == 2) - { - NetMessage.SendData(msgType, -1, this.whoAmI, "", num63, (float) num64, (float) num65, 0f); - return; - } - return; - } - case 0x15: - { - short num71 = BitConverter.ToInt16(this.readBuffer, index); - index += 2; - float num72 = BitConverter.ToSingle(this.readBuffer, index); - index += 4; - float num73 = BitConverter.ToSingle(this.readBuffer, index); - index += 4; - float num74 = BitConverter.ToSingle(this.readBuffer, index); - index += 4; - float num75 = BitConverter.ToSingle(this.readBuffer, index); - index += 4; - byte stack = this.readBuffer[index]; - index++; - string str5 = Encoding.ASCII.GetString(this.readBuffer, index, (length - index) + start); - if (Main.netMode == 1) - { - if (str5 == "0") - { - Main.item[num71].active = false; - return; - } - Main.item[num71].SetDefaults(str5); - Main.item[num71].stack = stack; - Main.item[num71].position.X = num72; - Main.item[num71].position.Y = num73; - Main.item[num71].velocity.X = num74; - Main.item[num71].velocity.Y = num75; - Main.item[num71].active = true; - Main.item[num71].wet = Collision.WetCollision(Main.item[num71].position, Main.item[num71].width, Main.item[num71].height); - return; - } - if (str5 != "0") - { - bool flag6 = false; - if (num71 == 200) - { - flag6 = true; - } - if (flag6) - { - Item item = new Item(); - item.SetDefaults(str5); - num71 = (short) Item.NewItem((int) num72, (int) num73, item.width, item.height, item.type, stack, true); - } - Main.item[num71].SetDefaults(str5); - Main.item[num71].stack = stack; - Main.item[num71].position.X = num72; - Main.item[num71].position.Y = num73; - Main.item[num71].velocity.X = num74; - Main.item[num71].velocity.Y = num75; - Main.item[num71].active = true; - Main.item[num71].owner = Main.myPlayer; - if (flag6) - { - NetMessage.SendData(0x15, -1, -1, "", num71, 0f, 0f, 0f); - Main.item[num71].ownIgnore = this.whoAmI; - Main.item[num71].ownTime = 100; - Main.item[num71].FindOwner(num71); - return; - } - NetMessage.SendData(0x15, -1, this.whoAmI, "", num71, 0f, 0f, 0f); - return; - } - if (num71 < 200) - { - Main.item[num71].active = false; - NetMessage.SendData(0x15, -1, -1, "", num71, 0f, 0f, 0f); - return; - } - return; - } - case 0x16: - { - short num77 = BitConverter.ToInt16(this.readBuffer, index); - index += 2; - byte num78 = this.readBuffer[index]; - Main.item[num77].owner = num78; - if (num78 == Main.myPlayer) - { - Main.item[num77].keepTime = 15; - } - else - { - Main.item[num77].keepTime = 0; - } - if (Main.netMode == 2) - { - Main.item[num77].owner = 8; - Main.item[num77].keepTime = 15; - NetMessage.SendData(0x16, -1, -1, "", num77, 0f, 0f, 0f); - return; - } - return; - } - case 0x17: - { - short num79 = BitConverter.ToInt16(this.readBuffer, index); - index += 2; - float num80 = BitConverter.ToSingle(this.readBuffer, index); - index += 4; - float num81 = BitConverter.ToSingle(this.readBuffer, index); - index += 4; - float num82 = BitConverter.ToSingle(this.readBuffer, index); - index += 4; - float num83 = BitConverter.ToSingle(this.readBuffer, index); - index += 4; - int num84 = BitConverter.ToInt16(this.readBuffer, index); - index += 2; - int num85 = this.readBuffer[index] - 1; - index++; - byte num172 = this.readBuffer[index]; - index++; - int num86 = BitConverter.ToInt16(this.readBuffer, index); - index += 2; - float[] numArray = new float[NPC.maxAI]; - for (int num87 = 0; num87 < NPC.maxAI; num87++) - { - numArray[num87] = BitConverter.ToSingle(this.readBuffer, index); - index += 4; - } - string name = Encoding.ASCII.GetString(this.readBuffer, index, (length - index) + start); - if (!Main.npc[num79].active || (Main.npc[num79].name != name)) - { - Main.npc[num79].active = true; - Main.npc[num79].SetDefaults(name); - } - Main.npc[num79].position.X = num80; - Main.npc[num79].position.Y = num81; - Main.npc[num79].velocity.X = num82; - Main.npc[num79].velocity.Y = num83; - Main.npc[num79].target = num84; - Main.npc[num79].direction = num85; - Main.npc[num79].life = num86; - if (num86 <= 0) - { - Main.npc[num79].active = false; - } - for (int num88 = 0; num88 < NPC.maxAI; num88++) - { - Main.npc[num79].ai[num88] = numArray[num88]; - } - return; - } - case 0x18: - { - short num89 = BitConverter.ToInt16(this.readBuffer, index); - index += 2; - byte num90 = this.readBuffer[index]; - Main.npc[num89].StrikeNPC(Main.player[num90].inventory[Main.player[num90].selectedItem].damage, Main.player[num90].inventory[Main.player[num90].selectedItem].knockBack, Main.player[num90].direction); - if (Main.netMode == 2) - { - NetMessage.SendData(0x18, -1, this.whoAmI, "", num89, (float) num90, 0f, 0f); - NetMessage.SendData(0x17, -1, -1, "", num89, 0f, 0f, 0f); - return; - } - return; - } - case 0x19: - { - int num91 = this.readBuffer[start + 1]; - if (Main.netMode == 2) - { - num91 = this.whoAmI; - } - byte r = this.readBuffer[start + 2]; - byte g = this.readBuffer[start + 3]; - byte b = this.readBuffer[start + 4]; - string str7 = Encoding.ASCII.GetString(this.readBuffer, start + 5, length - 5); - if (Main.netMode == 1) - { - string newText = str7; - if (num91 < 8) - { - newText = "<" + Main.player[num91].name + "> " + str7; - Main.player[num91].chatText = str7; - Main.player[num91].chatShowTime = Main.chatLength / 2; - } - Main.NewText(newText, r, g, b); - return; - } - if (Main.netMode == 2) - { - string str9 = str7.ToLower(); - int x = (int)Main.player[this.whoAmI].position.X; - int y = (int)Main.player[this.whoAmI].position.Y; - //TODO: Clean this shit up - if (str9 == "/hardcore") - { - if (!ShankShock.IsAdmin(this.whoAmI)) - { - ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that."); - return; - } - - for (int i = 0; i <= 2; i++) - { - ShankShock.NewNPC(i, x, y, this.whoAmI); - } - Main.startInv(); - ShankShock.Broadcast(ShankShock.FindPlayer(this.whoAmI) + " has spawned all 3 bosses and started an invasion!!!"); - return; - } - if (str9 == "/off") - { - if (!ShankShock.IsAdmin(this.whoAmI)) - { - ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that."); - return; - } - Netplay.disconnect = true; - return; - } - if (str9 == "/skeletron") - { - if (!ShankShock.IsAdmin(this.whoAmI)) - { - ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that."); - return; - } - ShankShock.NewNPC((int)ShankShock.NPCList.SKELETRON, x, y, this.whoAmI); - ShankShock.Broadcast(ShankShock.FindPlayer(this.whoAmI) + " has spawned Skeletor!"); - return; - } - if (str9 == "/reload") - { - if (!ShankShock.IsAdmin(this.whoAmI)) - { - ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that."); - return; - } - - ShankShock.SendMessage(this.whoAmI, "Reloaded the server configuration files."); - return; - } - if (str9 == "/bloodmoon") - { - if (!ShankShock.IsAdmin(this.whoAmI)) - { - ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that."); - return; - } - ShankShock.Broadcast(ShankShock.FindPlayer(this.whoAmI) + " turned on blood moon."); - Main.bloodMoon = true; - Main.time = 0; - Main.dayTime = false; - Main.UpdateT(); - NetMessage.SendData(18, -1, -1, "", 0, 0, Main.sunModY, Main.moonModY); - NetMessage.syncPlayers(); - - return; - } - if (str9 == "/dropmeteor") - { - if (!ShankShock.IsAdmin(this.whoAmI)) - { - ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that."); - return; - } - WorldGen.spawnMeteor = false; - WorldGen.dropMeteor(); - return; - } - if (str9 == "/star") - { - if (!ShankShock.IsAdmin(this.whoAmI)) - { - ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that."); - return; - } - //TODO: clean up this copypasted code - - int penis56 = 12; - int penis57 = Main.rand.Next(Main.maxTilesX - 50) + 100; - penis57 *= 0x10; - int penis58 = Main.rand.Next((int)(Main.maxTilesY * 0.05)) * 0x10; - Microsoft.Xna.Framework.Vector2 vector = new Microsoft.Xna.Framework.Vector2((float)penis57, (float)penis58); - float speedX = Main.rand.Next(-100, 0x65); - float speedY = Main.rand.Next(200) + 100; - float penis61 = (float)Math.Sqrt((double)((speedX * speedX) + (speedY * speedY))); - penis61 = ((float)penis56) / penis61; - speedX *= penis61; - speedY *= penis61; - Projectile.NewProjectile(vector.X, vector.Y, speedX, speedY, 12, 0x3e8, 10f, Main.myPlayer); - return; - } - if (str9 == "/eye") - { - if (!ShankShock.IsAdmin(this.whoAmI)) - { - ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that."); - return; - } - ShankShock.NewNPC((int)ShankShock.NPCList.EYE, x, y, this.whoAmI); - ShankShock.Broadcast(ShankShock.FindPlayer(this.whoAmI) + " has spawned an eye!"); - return; - } - if (str9 == "/invade") - { - if (!ShankShock.IsAdmin(this.whoAmI)) - { - ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that."); - return; - } - Main.startInv(); - return; - } - if (str9 == ("/help")) - { - ShankShock.SendMessage(this.whoAmI, "TShock Commands:"); - ShankShock.SendMessage(this.whoAmI, "/who - Who's online?"); - ShankShock.SendMessage(this.whoAmI, "/me - Talk in 3rd person"); - ShankShock.SendMessage(this.whoAmI, "/p - Talk in party chat"); - if (ShankShock.IsAdmin(this.whoAmI)) - { - ShankShock.SendMessage(this.whoAmI, "/kick | /ban | /eater | /hardcore | /skeletron"); - ShankShock.SendMessage(this.whoAmI, "/invade | /dropmeteor | /bloodmoon | /eye"); - } - return; - - } - if (str9 == "/spawn") - { - Main.player[this.whoAmI].position.X = Main.player[this.whoAmI].SpawnX; - Main.player[this.whoAmI].position.Y = Main.player[this.whoAmI].SpawnY; - Main.player[this.whoAmI].Spawn(); - return; - } - if (str9 == "/kc") - { - if (!ShankShock.infinateInvasion) { return; } - ShankShock.SendMessage(this.whoAmI, "Goblin kill count to date: " + ShankShock.killCount, new float[] { 255, 0, 0 }); - return; - } - if (str9 == "/eater") - { - if (!ShankShock.IsAdmin(this.whoAmI)) - { - ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that."); - return; - } - ShankShock.NewNPC((int)ShankShock.NPCList.WORLD_EATER, x, y, this.whoAmI); - ShankShock.Broadcast(ShankShock.FindPlayer(this.whoAmI) + " has spawned an eater of worlds!"); - return; - } - if (str9.Length > 5 && str9.Substring(0, 5) == "/kick") - { - if (!ShankShock.IsAdmin(this.whoAmI)){ - ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that."); - return; - } - string plStr = str9.Remove(0, 5).Trim(); - if (!(ShankShock.FindPlayer(plStr) == -1 || plStr == "")) - { - ShankShock.Kick(ShankShock.FindPlayer(plStr)); - ShankShock.Broadcast(plStr + " has been kicked."); - return; - } - ShankShock.SendMessage(this.whoAmI, "Player doesn't exist."); - return; - } - if (str9.Length > 4 && str9.Substring(0, 4) == "/ban"){ - if (!ShankShock.IsAdmin(this.whoAmI)){ - ShankShock.SendMessage(this.whoAmI, "You aren't allowed to do that."); - return; - } - string plStr = str9.Remove(0, 4).Trim(); - if (!(ShankShock.FindPlayer(plStr) == -1 || plStr == "")) - { - ShankShock._writeban(ShankShock.FindPlayer(plStr)); - ShankShock.Kick(ShankShock.FindPlayer(plStr)); - ShankShock.Broadcast(plStr + " has been banned."); - return; - } - } - if (str9 == "/playing" || str9 == "/who") - { - string str10 = ""; - for (int num95 = 0; num95 < 8; num95++) - { - if (Main.player[num95].active) - { - if (str10 == "") - { - str10 = str10 + Main.player[num95].name; - } - else - { - str10 = str10 + ", " + Main.player[num95].name; - } - } - } - NetMessage.SendData(0x19, this.whoAmI, -1, "Current players: " + str10 + ".", 8, 255f, 240f, 20f); - return; - } - if ((str9.Length >= 4) && (str9.Substring(0, 4) == "/me ")) - { - NetMessage.SendData(0x19, -1, -1, "*" + Main.player[this.whoAmI].name + " " + str7.Substring(4), 8, 200f, 100f, 0f); - return; - } - if ((str9.Length >= 3) && (str9.Substring(0, 3) == "/p ")) - { - if (Main.player[this.whoAmI].team != 0) - { - for (int num96 = 0; num96 < 8; num96++) - { - if (Main.player[num96].team == Main.player[this.whoAmI].team) - { - NetMessage.SendData(0x19, num96, -1, str7.Substring(3), num91, (float) Main.teamColor[Main.player[this.whoAmI].team].R, (float) Main.teamColor[Main.player[this.whoAmI].team].G, (float) Main.teamColor[Main.player[this.whoAmI].team].B); - } - } - return; - } - NetMessage.SendData(0x19, this.whoAmI, -1, "You are not in a party!", 8, 255f, 240f, 20f); - return; - } - NetMessage.SendData(0x19, -1, -1, str7, num91, (float) r, (float) g, (float) b); - return; - } - return; - } - case 0x1a: - { - byte num97 = this.readBuffer[index]; - index++; - int hitDirection = this.readBuffer[index] - 1; - index++; - short damage = BitConverter.ToInt16(this.readBuffer, index); - index += 2; - byte num100 = this.readBuffer[index]; - bool pvp = false; - if (num100 != 0 || ShankShock.permaPvp) - { - pvp = true; - } - Main.player[num97].Hurt(damage, hitDirection, pvp, true); - if (Main.netMode == 2) - { - NetMessage.SendData(0x1a, -1, this.whoAmI, "", num97, (float) hitDirection, (float) damage, (float) num100); - return; - } - return; - } - case 0x1b: - { - short num101 = BitConverter.ToInt16(this.readBuffer, index); - index += 2; - float num102 = BitConverter.ToSingle(this.readBuffer, index); - index += 4; - float num103 = BitConverter.ToSingle(this.readBuffer, index); - index += 4; - float num104 = BitConverter.ToSingle(this.readBuffer, index); - index += 4; - float num105 = BitConverter.ToSingle(this.readBuffer, index); - index += 4; - float num106 = BitConverter.ToSingle(this.readBuffer, index); - index += 4; - short num107 = BitConverter.ToInt16(this.readBuffer, index); - index += 2; - byte num108 = this.readBuffer[index]; - index++; - byte num109 = this.readBuffer[index]; - index++; - float[] numArray2 = new float[Projectile.maxAI]; - for (int num110 = 0; num110 < Projectile.maxAI; num110++) - { - numArray2[num110] = BitConverter.ToSingle(this.readBuffer, index); - index += 4; - } - int num111 = 0x3e8; - for (int num112 = 0; num112 < 0x3e8; num112++) - { - if (((Main.projectile[num112].owner == num108) && (Main.projectile[num112].identity == num101)) && Main.projectile[num112].active) - { - num111 = num112; - break; - } - } - if (num111 == 0x3e8) - { - for (int num113 = 0; num113 < 0x3e8; num113++) - { - if (!Main.projectile[num113].active) - { - num111 = num113; - break; - } - } - } - if (!Main.projectile[num111].active || (Main.projectile[num111].type != num109)) - { - Main.projectile[num111].SetDefaults(num109); - } - Main.projectile[num111].identity = num101; - Main.projectile[num111].position.X = num102; - Main.projectile[num111].position.Y = num103; - Main.projectile[num111].velocity.X = num104; - Main.projectile[num111].velocity.Y = num105; - Main.projectile[num111].damage = num107; - Main.projectile[num111].type = num109; - Main.projectile[num111].owner = num108; - Main.projectile[num111].knockBack = num106; - for (int num114 = 0; num114 < Projectile.maxAI; num114++) - { - Main.projectile[num111].ai[num114] = numArray2[num114]; - } - if (Main.netMode == 2) - { - NetMessage.SendData(0x1b, -1, this.whoAmI, "", num111, 0f, 0f, 0f); - } - return; - } - case 0x1c: - { - short num115 = BitConverter.ToInt16(this.readBuffer, index); - index += 2; - short num116 = BitConverter.ToInt16(this.readBuffer, index); - index += 2; - float knockBack = BitConverter.ToSingle(this.readBuffer, index); - index += 4; - int num118 = this.readBuffer[index] - 1; - if (num116 >= 0) - { - Main.npc[num115].StrikeNPC(num116, knockBack, num118); - } - else - { - Main.npc[num115].life = 0; - Main.npc[num115].HitEffect(0, 10.0); - Main.npc[num115].active = false; - } - if (Main.netMode == 2) - { - NetMessage.SendData(0x1c, -1, this.whoAmI, "", num115, (float) num116, knockBack, (float) num118); - NetMessage.SendData(0x17, -1, -1, "", num115, 0f, 0f, 0f); - return; - } - return; - } - case 0x1f: - if (Main.netMode == 2) - { - int num124 = BitConverter.ToInt32(this.readBuffer, index); - index += 4; - int num125 = BitConverter.ToInt32(this.readBuffer, index); - index += 4; - int num126 = Chest.FindChest(num124, num125); - if ((num126 > -1) && (Chest.UsingChest(num126) == -1)) - { - for (int num127 = 0; num127 < Chest.maxItems; num127++) - { - NetMessage.SendData(0x20, this.whoAmI, -1, "", num126, (float) num127, 0f, 0f); - } - NetMessage.SendData(0x21, this.whoAmI, -1, "", num126, 0f, 0f, 0f); - Main.player[this.whoAmI].chest = num126; - return; - } - } - return; - - case 0x20: - { - int num128 = BitConverter.ToInt16(this.readBuffer, index); - index += 2; - int num129 = this.readBuffer[index]; - index++; - int num130 = this.readBuffer[index]; - index++; - string str12 = Encoding.ASCII.GetString(this.readBuffer, index, (length - index) + start); - if (Main.chest[num128] == null) - { - Main.chest[num128] = new Chest(); - } - if (Main.chest[num128].item[num129] == null) - { - Main.chest[num128].item[num129] = new Item(); - } - Main.chest[num128].item[num129].SetDefaults(str12); - Main.chest[num128].item[num129].stack = num130; - return; - } - case 30: - { - byte num122 = this.readBuffer[index]; - if (ShankShock.permaPvp) - { - Main.player[num122].hostile = true; - NetMessage.SendData(30, -1, -1, "", num122); - return; - } - index++; - byte num123 = this.readBuffer[index]; - if (num123 == 1) - { - Main.player[num122].hostile = true; - } - else - { - Main.player[num122].hostile = false; - } - if (Main.netMode == 2) - { - NetMessage.SendData(30, -1, this.whoAmI, "", num122, 0f, 0f, 0f); - string str11 = " has enabled PvP!"; - if (num123 == 0) - { - str11 = " has disabled PvP!"; - } - NetMessage.SendData(0x19, -1, -1, Main.player[num122].name + str11, 8, (float) Main.teamColor[Main.player[num122].team].R, (float) Main.teamColor[Main.player[num122].team].G, (float) Main.teamColor[Main.player[num122].team].B); - return; - } - return; - } - case 0x21: - { - int num131 = BitConverter.ToInt16(this.readBuffer, index); - index += 2; - int num132 = BitConverter.ToInt32(this.readBuffer, index); - index += 4; - int num133 = BitConverter.ToInt32(this.readBuffer, index); - if (Main.netMode == 1) - { - if (Main.player[Main.myPlayer].chest == -1) - { - Main.playerInventory = true; - Main.PlaySound(10, -1, -1, 1); - } - else if ((Main.player[Main.myPlayer].chest != num131) && (num131 != -1)) - { - Main.playerInventory = true; - Main.PlaySound(12, -1, -1, 1); - } - else if ((Main.player[Main.myPlayer].chest != -1) && (num131 == -1)) - { - Main.PlaySound(11, -1, -1, 1); - } - Main.player[Main.myPlayer].chest = num131; - Main.player[Main.myPlayer].chestX = num132; - Main.player[Main.myPlayer].chestY = num133; - return; - } - Main.player[this.whoAmI].chest = num131; - return; - } - case 0x22: - if (Main.netMode == 2) - { - int num134 = BitConverter.ToInt32(this.readBuffer, index); - index += 4; - int num135 = BitConverter.ToInt32(this.readBuffer, index); - WorldGen.KillTile(num134, num135, false, false, false); - if (!Main.tile[num134, num135].active) - { - NetMessage.SendData(0x11, -1, -1, "", 0, (float) num134, (float) num135, 0f); - return; - } - } - return; - - case 0x23: - { - int num136 = this.readBuffer[index]; - index++; - int healAmount = BitConverter.ToInt16(this.readBuffer, index); - index += 2; - if (num136 != Main.myPlayer) - { - Main.player[num136].HealEffect(healAmount); - } - if (Main.netMode == 2) - { - NetMessage.SendData(0x23, -1, this.whoAmI, "", num136, (float) healAmount, 0f, 0f); - return; - } - return; - } - case 0x24: - { - int num138 = this.readBuffer[index]; - index++; - int num139 = this.readBuffer[index]; - index++; - int num140 = this.readBuffer[index]; - index++; - int num141 = this.readBuffer[index]; - index++; - int num142 = this.readBuffer[index]; - index++; - if (num139 == 0) - { - Main.player[num138].zoneEvil = false; - } - else - { - Main.player[num138].zoneEvil = true; - } - if (num140 == 0) - { - Main.player[num138].zoneMeteor = false; - } - else - { - Main.player[num138].zoneMeteor = true; - } - if (num141 == 0) - { - Main.player[num138].zoneDungeon = false; - } - else - { - Main.player[num138].zoneDungeon = true; - } - if (num142 == 0) - { - Main.player[num138].zoneJungle = false; - return; - } - Main.player[num138].zoneJungle = true; - return; - } - case 0x25: - if (Main.netMode == 1) - { - Netplay.password = ""; - Main.menuMode = 0x1f; - return; - } - return; - - case 0x26: - if (Main.netMode == 2) - { - if (Encoding.ASCII.GetString(this.readBuffer, index, (length - index) + start) == Netplay.password) - { - Netplay.serverSock[this.whoAmI].state = 1; - NetMessage.SendData(3, this.whoAmI, -1, "", 0, 0f, 0f, 0f); - return; - } - NetMessage.SendData(2, this.whoAmI, -1, "Incorrect password.", 0, 0f, 0f, 0f); - return; - } - return; - - case 0x1d: - { - short num119 = BitConverter.ToInt16(this.readBuffer, index); - index += 2; - byte num120 = this.readBuffer[index]; - for (int num121 = 0; num121 < 0x3e8; num121++) - { - if (((Main.projectile[num121].owner == num120) && (Main.projectile[num121].identity == num119)) && Main.projectile[num121].active) - { - Main.projectile[num121].Kill(); - break; - } - } - if (Main.netMode == 2) - { - NetMessage.SendData(0x1d, -1, this.whoAmI, "", num119, (float) num120, 0f, 0f); - } - return; - } - } - if ((msgType == 0x27) && (Main.netMode == 1)) - { - short num143 = BitConverter.ToInt16(this.readBuffer, index); - Main.item[num143].owner = 8; - NetMessage.SendData(0x16, -1, -1, "", num143, 0f, 0f, 0f); - return; - } - switch (msgType) - { - case 40: - { - byte num144 = this.readBuffer[index]; - index++; - int num145 = BitConverter.ToInt16(this.readBuffer, index); - index += 2; - Main.player[num144].talkNPC = num145; - if (Main.netMode == 2) - { - NetMessage.SendData(40, -1, this.whoAmI, "", num144, 0f, 0f, 0f); - return; - } - return; - } - case 0x29: - { - byte num146 = this.readBuffer[index]; - index++; - float num147 = BitConverter.ToSingle(this.readBuffer, index); - index += 4; - int num148 = BitConverter.ToInt16(this.readBuffer, index); - Main.player[num146].itemRotation = num147; - Main.player[num146].itemAnimation = num148; - if (Main.netMode == 2) - { - NetMessage.SendData(0x29, -1, this.whoAmI, "", num146, 0f, 0f, 0f); - return; - } - return; - } - case 0x2a: - { - int num149 = this.readBuffer[index]; - index++; - int num150 = BitConverter.ToInt16(this.readBuffer, index); - index += 2; - int num151 = BitConverter.ToInt16(this.readBuffer, index); - if (Main.netMode == 2) - { - num149 = this.whoAmI; - } - Main.player[num149].statMana = num150; - Main.player[num149].statManaMax = num151; - if (Main.netMode == 2) - { - NetMessage.SendData(0x2a, -1, this.whoAmI, "", num149, 0f, 0f, 0f); - return; - } - return; - } - case 0x2b: - { - int num152 = this.readBuffer[index]; - index++; - int manaAmount = BitConverter.ToInt16(this.readBuffer, index); - index += 2; - if (num152 != Main.myPlayer) - { - Main.player[num152].ManaEffect(manaAmount); - } - if (Main.netMode == 2) - { - NetMessage.SendData(0x2b, -1, this.whoAmI, "", num152, (float) manaAmount, 0f, 0f); - return; - } - return; - } - case 0x2c: - { - byte num154 = this.readBuffer[index]; - index++; - int num155 = this.readBuffer[index] - 1; - index++; - short num156 = BitConverter.ToInt16(this.readBuffer, index); - index += 2; - byte num157 = this.readBuffer[index]; - bool flag8 = false; - if (num157 != 0) - { - flag8 = true; - } - Main.player[num154].KillMe((double) num156, num155, flag8); - if (Main.netMode == 2) - { - NetMessage.SendData(0x2c, -1, this.whoAmI, "", num154, (float) num155, (float) num156, (float) num157); - return; - } - return; - } - } - if (msgType != 0x2d) - { - switch (msgType) - { - case 0x2e: - if (Main.netMode == 2) - { - int num162 = BitConverter.ToInt32(this.readBuffer, index); - index += 4; - int num163 = BitConverter.ToInt32(this.readBuffer, index); - index += 4; - int num164 = Sign.ReadSign(num162, num163); - if (num164 >= 0) - { - NetMessage.SendData(0x2f, this.whoAmI, -1, "", num164, 0f, 0f, 0f); - return; - } - } - return; - - case 0x2f: - { - int num165 = BitConverter.ToInt16(this.readBuffer, index); - index += 2; - int num166 = BitConverter.ToInt32(this.readBuffer, index); - index += 4; - int num167 = BitConverter.ToInt32(this.readBuffer, index); - index += 4; - string str15 = Encoding.ASCII.GetString(this.readBuffer, index, (length - index) + start); - Main.sign[num165] = new Sign(); - Main.sign[num165].x = num166; - Main.sign[num165].y = num167; - Sign.TextSign(num165, str15); - if (((Main.netMode == 1) && (Main.sign[num165] != null)) && (num165 != Main.player[Main.myPlayer].sign)) - { - Main.playerInventory = false; - Main.player[Main.myPlayer].talkNPC = -1; - Main.editSign = false; - Main.PlaySound(10, -1, -1, 1); - Main.player[Main.myPlayer].sign = num165; - Main.npcChatText = Main.sign[num165].text; - return; - } - return; - } - } - if (msgType == 0x30) - { - int num168 = BitConverter.ToInt32(this.readBuffer, index); - index += 4; - int num169 = BitConverter.ToInt32(this.readBuffer, index); - index += 4; - byte num170 = this.readBuffer[index]; - index++; - byte num171 = this.readBuffer[index]; - index++; - if (Main.tile[num168, num169] == null) - { - Main.tile[num168, num169] = new Tile(); - } - lock (Main.tile[num168, num169]) - { - Main.tile[num168, num169].liquid = num170; - if (num171 == 1) - { - Main.tile[num168, num169].lava = true; - } - else - { - Main.tile[num168, num169].lava = false; - } - if (Main.netMode == 2) - { - WorldGen.SquareTileFrame(num168, num169, true); - } - return; - } - } - if ((msgType == 0x31) && (Netplay.clientSock.state == 6)) - { - Netplay.clientSock.state = 10; - Main.player[Main.myPlayer].Spawn(); - } - return; - } - num158 = this.readBuffer[index]; - index++; - num159 = this.readBuffer[index]; - index++; - team = Main.player[num158].team; - Main.player[num158].team = num159; - if (Main.netMode != 2) - { - return; - } - NetMessage.SendData(0x2d, -1, this.whoAmI, "", num158, 0f, 0f, 0f); - str14 = ""; - switch (num159) - { - case 0: - str14 = " is no longer on a party."; - goto Label_33CD; - - case 1: - str14 = " has joined the red party."; - goto Label_33CD; - - case 2: - str14 = " has joined the green party."; - goto Label_33CD; - - case 3: - str14 = " has joined the blue party."; - goto Label_33CD; - - case 4: - str14 = " has joined the yellow party."; - goto Label_33CD; - } - goto Label_33CD; - } - num58 = this.readBuffer[index]; - index++; - num59 = BitConverter.ToInt32(this.readBuffer, index); - index += 4; - num60 = BitConverter.ToInt32(this.readBuffer, index); - index += 4; - num61 = this.readBuffer[index]; - int direction = 0; - if (num61 == 0) - { - direction = -1; - } - switch (num58) - { - case 0: - WorldGen.OpenDoor(num59, num60, direction); - goto Label_1928; - - case 1: - WorldGen.CloseDoor(num59, num60, true); - goto Label_1928; - } - goto Label_1928; - } - num50 = this.readBuffer[index]; - index++; - num51 = BitConverter.ToInt32(this.readBuffer, index); - index += 4; - num52 = BitConverter.ToInt32(this.readBuffer, index); - index += 4; - num53 = this.readBuffer[index]; - bool fail = false; - if (num53 == 1) - { - fail = true; - } - if (Main.tile[num51, num52] == null) - { - Main.tile[num51, num52] = new Tile(); - } - if ((Main.netMode == 2) && !Netplay.serverSock[this.whoAmI].tileSection[Netplay.GetSectionX(num51), Netplay.GetSectionY(num52)]) - { - fail = true; - } - switch (num50) // - { - case 0: - if (!ShankShock.TileOnWhitelist(Main.tile[num51, num52].type)) - { - Main.player[this.whoAmI].breakTicks += 1; - } - WorldGen.KillTile(num51, num52, fail, false, false); - break; - - case 1: - WorldGen.PlaceTile(num51, num52, num53, false, true, -1); - break; - - case 2: - if (!ShankShock.TileOnWhitelist(Main.tile[num51, num52].type)) - { - Main.player[this.whoAmI].breakTicks += 1; - } - WorldGen.KillWall(num51, num52, fail); - break; - - case 3: - WorldGen.PlaceWall(num51, num52, num53, false); - break; - - case 4: - if (!ShankShock.TileOnWhitelist(Main.tile[num51, num52].type)) - { - Main.player[this.whoAmI].breakTicks += 1; - } - WorldGen.KillTile(num51, num52, fail, false, true); - break; - } - break; - } - } - if (Main.netMode == 2) - { - NetMessage.SendData(0x11, -1, this.whoAmI, "", num50, (float) num51, (float) num52, (float) num53); - if ((num50 != 1) || (num53 != 0x35)) - { - return; - } - NetMessage.SendTileSquare(-1, num51, num52, 1); - } - return; - Label_1928: - if (Main.netMode == 2) - { - NetMessage.SendData(0x13, -1, this.whoAmI, "", num58, (float) num59, (float) num60, (float) num61); - } - return; - Label_33CD: - num161 = 0; - while (num161 < 8) - { - if (((num161 == this.whoAmI) || ((team > 0) && (Main.player[num161].team == team))) || ((num159 > 0) && (Main.player[num161].team == num159))) - { - NetMessage.SendData(0x19, num161, -1, Main.player[num158].name + str14, 8, (float) Main.teamColor[num159].R, (float) Main.teamColor[num159].G, (float) Main.teamColor[num159].B); - } - num161++; - } - } - - public void Reset() - { - this.writeBuffer = new byte[0xffff]; - this.writeLocked = false; - this.messageLength = 0; - this.totalData = 0; - this.spamCount = 0; - this.broadcast = false; - this.checkBytes = false; - } - } -} -