Chest + boulder exploit

This commit is contained in:
MarioE 2012-08-15 20:17:34 -04:00
parent 2da302a0e1
commit 76c7b3fe8e
2 changed files with 28 additions and 8 deletions

View file

@ -1653,7 +1653,7 @@ namespace TShockAPI
var fail = args.Data.ReadBoolean();
if (OnTileEdit(args.Player, tileX, tileY, tiletype, type, fail))
return true;
if (tileX < 0 || tileX >= Main.maxTilesX || tileY < 0 || tileY >= Main.maxTilesY)
if (!TShock.Utils.TileInRange(tileX, tileY))
return false;
if (args.Player.Dead && TShock.Config.PreventDeadModification)
@ -1675,7 +1675,7 @@ namespace TShockAPI
{
return true;
}
if ((tiletype == 29 || tiletype == 97) && TShock.Config.ServerSideInventory && TShock.Config.DisablePiggybanksOnSSI)
if (type == 1 && (tiletype == 29 || tiletype == 97) && TShock.Config.ServerSideInventory && TShock.Config.DisablePiggybanksOnSSI)
{
args.Player.SendMessage("You cannot place this tile, server side inventory is enabled.", Color.Red);
args.Player.SendTileSquare(tileX, tileY);
@ -1688,12 +1688,15 @@ namespace TShockAPI
args.Player.SendTileSquare(tileX, tileY);
return true;
}
if (type == 1 && tiletype == 21 && TShock.Utils.MaxChests())
{
args.Player.SendMessage("Reached the world's max chest limit, unable to place more.", Color.Red);
args.Player.SendTileSquare(tileX, tileY);
return true;
}
if (type == 1 && tiletype == 21)
{
if (TShock.Utils.MaxChests())
{
args.Player.SendMessage("Reached the world's max chest limit, unable to place more.", Color.Red);
args.Player.SendTileSquare(tileX, tileY);
return true;
}
}
if (tiletype == 141 && !args.Player.Group.HasPermission(Permissions.usebanneditem) &&
TShock.Itembans.ItemIsBanned("Explosives", args.Player))
{
@ -1701,6 +1704,12 @@ namespace TShockAPI
args.Player.SendTileSquare(tileX, tileY);
return true;
}
if ((TShock.Utils.TileInRange(tileX, tileY + 1) && Main.tile[tileX, tileY + 1].type == 138) ||
(TShock.Utils.TileInRange(tileX + 1, tileY + 1) && Main.tile[tileX + 1, tileY + 1].type == 138))
{
args.Player.SendTileSquare(tileX, tileY);
return true;
}
}
if (TShock.CheckIgnores(args.Player))

View file

@ -821,6 +821,17 @@ namespace TShockAPI
return HashPassword(Encoding.UTF8.GetBytes(password));
}
/// <summary>
/// Checks if the given X and Y are in range for the world's tile array
/// </summary>
/// <param name="X">X</param>
/// <param name="Y">Y</param>
/// <returns>True if the X and Y are in range</returns>
public bool TileInRange(int X, int Y)
{
return X >= 0 && Y >= 0 && X < Main.maxTilesX - 1 && Y < Main.maxTilesY - 1;
}
/// <summary>
/// Checks if the string contains any unprintable characters
/// </summary>