This commit is contained in:
White 2016-06-15 00:19:10 +09:30
parent 72ccd34ae6
commit aa337437a6

View file

@ -495,9 +495,9 @@ namespace TShockAPI
}
for (int c = num; c < num2; c++)
{
for (int d = num3; d< num4; d++)
for (int d = num3; d < num4; d++)
{
if (Main.tile[c,d].liquid != 0)
if (Main.tile[c, d].liquid != 0)
return false;
}
}
@ -509,15 +509,15 @@ namespace TShockAPI
|| !TShock.Utils.TileSolid(i, j) || !TShock.Utils.TileSolid(i + 1, j) || !TShock.Utils.TileSolid(i - 1, j)
|| !TShock.Utils.TileSolid(i, j + 1) || !TShock.Utils.TileSolid(i + 1, j + 1) || !TShock.Utils.TileSolid(i - 1, j + 1)
|| !TShock.Utils.TileSolid(i, j - 1) || !TShock.Utils.TileSolid(i + 1, j - 1) || !TShock.Utils.TileSolid(i - 1, j - 1)
|| Main.tileSolidTop[(int) Main.tile[i, j].type])
|| Main.tileSolidTop[(int)Main.tile[i, j].type])
{
continue;
}
Vector2 vector;
vector.X = (float) (i*16);
vector.Y = (float) (j*16);
if (Position.X + (float) Width > vector.X && Position.X < vector.X + 16f && Position.Y + (float) Height > vector.Y && Position.Y < vector.Y + 16f)
vector.X = (float)(i * 16);
vector.Y = (float)(j * 16);
if (Position.X + (float)Width > vector.X && Position.X < vector.X + 16f && Position.Y + (float)Height > vector.Y && Position.Y < vector.Y + 16f)
{
return true;
}
@ -642,7 +642,7 @@ namespace TShockAPI
/// <summary>
/// Amount of liquid
/// </summary>
public byte Amount { get; set;}
public byte Amount { get; set; }
/// <summary>
/// Type of Liquid: 0=water, 1=lave, 2=honey
/// </summary>
@ -1115,7 +1115,7 @@ namespace TShockAPI
if (PlayerAnimation == null)
return false;
var args = new PlayerAnimationEventArgs {};
var args = new PlayerAnimationEventArgs { };
PlayerAnimation.Invoke(null, args);
return args.Handled;
}
@ -1510,19 +1510,19 @@ namespace TShockAPI
else if (user != null && !TShock.Config.DisableLoginBeforeJoin)
{
args.Player.RequiresPassword = true;
NetMessage.SendData((int) PacketTypes.PasswordRequired, args.Player.Index);
NetMessage.SendData((int)PacketTypes.PasswordRequired, args.Player.Index);
return true;
}
else if (!string.IsNullOrEmpty(TShock.Config.ServerPassword))
{
args.Player.RequiresPassword = true;
NetMessage.SendData((int) PacketTypes.PasswordRequired, args.Player.Index);
NetMessage.SendData((int)PacketTypes.PasswordRequired, args.Player.Index);
return true;
}
if (args.Player.State == 1)
args.Player.State = 2;
NetMessage.SendData((int) PacketTypes.WorldInfo, args.Player.Index);
NetMessage.SendData((int)PacketTypes.WorldInfo, args.Player.Index);
return true;
}
@ -1546,7 +1546,7 @@ namespace TShockAPI
if (args.Player.State == 1)
args.Player.State = 2;
NetMessage.SendData((int) PacketTypes.WorldInfo, args.Player.Index);
NetMessage.SendData((int)PacketTypes.WorldInfo, args.Player.Index);
var group = TShock.Utils.GetGroup(user.Group);
@ -1592,7 +1592,7 @@ namespace TShockAPI
args.Player.RequiresPassword = false;
if (args.Player.State == 1)
args.Player.State = 2;
NetMessage.SendData((int) PacketTypes.WorldInfo, args.Player.Index);
NetMessage.SendData((int)PacketTypes.WorldInfo, args.Player.Index);
return true;
}
TShock.Utils.ForceKick(args.Player, "Incorrect server password", true);
@ -1607,7 +1607,7 @@ namespace TShockAPI
{
if (args.Player.RequestedSection)
return true;
args.Player.RequestedSection = true;
args.Player.RequestedSection = true;
if (String.IsNullOrEmpty(args.Player.Name))
{
TShock.Utils.ForceKick(args.Player, "Blank name.", true);
@ -1626,7 +1626,7 @@ namespace TShockAPI
return true;
}
NetMessage.SendData((int) PacketTypes.TimeSet, -1, -1, "", Main.dayTime ? 1 : 0, (int)Main.time, Main.sunModY, Main.moonModY);
NetMessage.SendData((int)PacketTypes.TimeSet, -1, -1, "", Main.dayTime ? 1 : 0, (int)Main.time, Main.sunModY, Main.moonModY);
return false;
}
@ -2059,8 +2059,8 @@ namespace TShockAPI
args.Player.SendTileSquare(tileX, tileY, 3);
return true;
}
if ((TShock.Utils.TilePlacementValid(tileX, tileY + 1) && Main.tile[tileX, tileY + 1].type == 138) ||
(TShock.Utils.TilePlacementValid(tileX + 1, tileY + 1) && Main.tile[tileX + 1, tileY + 1].type == 138))
if ((TShock.Utils.TilePlacementValid(tileX, tileY + 1) && Main.tile[tileX, tileY + 1].type == TileID.Boulder) ||
(TShock.Utils.TilePlacementValid(tileX + 1, tileY + 1) && Main.tile[tileX + 1, tileY + 1].type == TileID.Boulder))
{
args.Player.SendTileSquare(tileX, tileY, 3);
return true;
@ -2429,8 +2429,8 @@ namespace TShockAPI
if (!pos.Equals(args.Player.LastNetPosition))
{
float distance = Vector2.Distance(new Vector2(pos.X/16f, pos.Y/16f),
new Vector2(args.Player.LastNetPosition.X/16f, args.Player.LastNetPosition.Y/16f));
float distance = Vector2.Distance(new Vector2(pos.X / 16f, pos.Y / 16f),
new Vector2(args.Player.LastNetPosition.X / 16f, args.Player.LastNetPosition.Y / 16f));
if (TShock.CheckIgnores(args.Player))
{
if (distance > TShock.Config.MaxRangeForDisabled)
@ -2477,7 +2477,7 @@ namespace TShockAPI
{
var lastTileX = args.Player.LastNetPosition.X;
var lastTileY = args.Player.LastNetPosition.Y;
if (!args.Player.Teleport(lastTileX, lastTileY ))
if (!args.Player.Teleport(lastTileX, lastTileY))
{
args.Player.SendErrorMessage("You got stuck in a solid object, Sent to spawn point.");
args.Player.Spawn();
@ -2521,7 +2521,7 @@ namespace TShockAPI
args.TPlayer.position = pos;
args.TPlayer.oldVelocity = args.TPlayer.velocity;
args.TPlayer.velocity = vel;
args.TPlayer.fallStart = (int) (pos.Y/16f);
args.TPlayer.fallStart = (int)(pos.Y / 16f);
args.TPlayer.controlUp = false;
args.TPlayer.controlDown = false;
args.TPlayer.controlLeft = false;
@ -2720,7 +2720,7 @@ namespace TShockAPI
|| type == ProjectileID.StickyBomb
|| type == ProjectileID.StickyDynamite))
{
// Denotes that the player has recently set a fuse - used for cheat detection.
// Denotes that the player has recently set a fuse - used for cheat detection.
args.Player.RecentFuse = 10;
//return true;
}
@ -2732,7 +2732,7 @@ namespace TShockAPI
{
var ident = args.Data.ReadInt16();
var owner = args.Data.ReadInt8();
owner = (byte)args.Player.Index;
owner = (byte)args.Player.Index;
var index = TShock.Utils.SearchProjectile(ident, owner);
if (index > Main.maxProjectiles || index < 0)
@ -2982,12 +2982,26 @@ namespace TShockAPI
return true;
}
if (flag != 0 && Main.tile[tileX, tileY].type != 21 && Main.tile[tileX, tileY].type != 88 && (!TShock.Utils.MaxChests() && Main.tile[tileX, tileY].type != 0)) //Chest
if (flag != 0
&& Main.tile[tileX, tileY].type != TileID.Containers
&& Main.tile[tileX, tileY].type != TileID.Dressers
&& (!TShock.Utils.MaxChests() && Main.tile[tileX, tileY].type != TileID.Dirt)) //Chest
{
args.Player.SendTileSquare(tileX, tileY, 3);
return true;
}
if (flag == 2) //place dresser
{
if ((TShock.Utils.TilePlacementValid(tileX, tileY + 1) && Main.tile[tileX, tileY + 1].type == TileID.Teleporter) ||
(TShock.Utils.TilePlacementValid(tileX + 1, tileY + 1) && Main.tile[tileX + 1, tileY + 1].type == TileID.Teleporter))
{
//Prevent a dresser from being placed on a teleporter, as this can cause client and server crashes.
args.Player.SendTileSquare(tileX, tileY, 3);
return true;
}
}
if (TShock.CheckTilePermission(args.Player, tileX, tileY))
{
args.Player.SendTileSquare(tileX, tileY, 3);
@ -3547,7 +3561,7 @@ namespace TShockAPI
}
NetMessage.SendData((int) PacketTypes.PlayerBuff, -1, args.Player.Index, "", args.Player.Index);
NetMessage.SendData((int)PacketTypes.PlayerBuff, -1, args.Player.Index, "", args.Player.Index);
return true;
}
@ -3574,14 +3588,14 @@ namespace TShockAPI
case -3:
case -4:
case -5:
case -6:
case -7:
case -8:
case -6:
case -7:
case -8:
invasion = true;
break;
case 4:
case 13:
case 50:
case 4:
case 13:
case 50:
case 75:
case 125:
case 126:
@ -3591,16 +3605,16 @@ namespace TShockAPI
case 130:
case 131:
case 134:
case 222:
case 245:
case 266:
case 370:
case 222:
case 245:
case 266:
case 370:
case 398:
case 422:
case 439:
case 493:
case 507:
case 517:
case 493:
case 507:
case 517:
spawnboss = true;
break;
}