Removing old crap
This commit is contained in:
parent
e15f28fbde
commit
f3ff33db62
31 changed files with 0 additions and 51042 deletions
|
|
@ -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 = "";
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
415
Terraria/Dust.cs
415
Terraria/Dust.cs
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 97 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 5.6 KiB |
173
Terraria/Gore.cs
173
Terraria/Gore.cs
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
3880
Terraria/Item.cs
3880
Terraria/Item.cs
File diff suppressed because it is too large
Load diff
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
9490
Terraria/Main.cs
9490
Terraria/Main.cs
File diff suppressed because it is too large
Load diff
6233
Terraria/NPC.cs
6233
Terraria/NPC.cs
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
4565
Terraria/Player.cs
4565
Terraria/Player.cs
File diff suppressed because it is too large
Load diff
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load diff
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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>(T value, T max, T min)
|
||||
where T : System.IComparable<T>
|
||||
{
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -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",
|
||||
};
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
15666
Terraria/WorldGen.cs
15666
Terraria/WorldGen.cs
File diff suppressed because it is too large
Load diff
Binary file not shown.
|
Before Width: | Height: | Size: 1.1 KiB |
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue