Re-do warps

This commit is contained in:
MarioE 2013-11-01 23:55:31 -04:00
parent 416ce98518
commit 41121b8412
5 changed files with 125 additions and 135 deletions

View file

@ -432,6 +432,9 @@ namespace TShockAPI.DB
{
try
{
Region region = Regions.First(r => String.Equals(regionName, r.Name, StringComparison.OrdinalIgnoreCase));
region.Area = new Rectangle(x, y, width, height);
if (database.Query("UPDATE Regions SET X1 = @0, Y1 = @1, width = @2, height = @3 WHERE RegionName = @4 AND WorldID = @5",
x, y, width, height, regionName, Main.worldID.ToString()) > 0)
return true;
@ -442,27 +445,6 @@ namespace TShockAPI.DB
}
return false;
}
/// <summary>
/// Offsets a region.
/// </summary>
/// <param name="regionName">The region name.</param>
/// <param name="x">The X offset.</param>
/// <param name="y">The Y offset.</param>
/// <returns>Whether the operation succeeded.</returns>
public bool OffsetRegion(string regionName, int x, int y)
{
try
{
if (database.Query("UPDATE Regions SET X1 = X1 + @0, Y1 = Y1 + @1 WHERE RegionName = @2 AND WorldID = @3",
x, y, regionName, Main.worldID.ToString()) > 0)
return true;
}
catch (Exception ex)
{
Log.Error(ex.ToString());
}
return false;
}
/// <summary>
/// Gets all the regions names from world