Changed a lot of RegionManager, fixed the file moving.
RegionManager is broken right now. Before it was adding ips to the userids table. Right now it doesn't import anything for userids. Also the function that uses AllowedIDs is expecting usernames instead of userids.
This commit is contained in:
parent
cfd2fdcb67
commit
903a862d62
3 changed files with 146 additions and 209 deletions
|
|
@ -1285,10 +1285,10 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
foreach (Region r in TShock.Regions.Regions)
|
foreach (Region r in TShock.Regions.Regions)
|
||||||
{
|
{
|
||||||
args.Player.SendMessage(r.RegionName + ": P: " + r.DisableBuild + " X: " + r.RegionArea.X + " Y: " + r.RegionArea.Y + " W: " + r.RegionArea.Width + " H: " + r.RegionArea.Height );
|
args.Player.SendMessage(r.Name + ": P: " + r.Protected + " X: " + r.Area.X + " Y: " + r.Area.Y + " W: " + r.Area.Width + " H: " + r.Area.Height );
|
||||||
foreach (string s in r.RegionAllowedIDs)
|
foreach (string s in r.AllowedIDs)
|
||||||
{
|
{
|
||||||
args.Player.SendMessage(r.RegionName + ": " + s);
|
args.Player.SendMessage(r.Name + ": " + s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1463,11 +1463,11 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
for (int j = (15 * (page - 1)); j < (15 * page); j++)
|
for (int j = (15 * (page - 1)); j < (15 * page); j++)
|
||||||
{
|
{
|
||||||
if (Regions[j].RegionWorldID == Main.worldID.ToString())
|
if (Regions[j].WorldID == Main.worldID.ToString())
|
||||||
{
|
{
|
||||||
if (sb.Length != 0)
|
if (sb.Length != 0)
|
||||||
sb.Append(", ");
|
sb.Append(", ");
|
||||||
sb.Append(Regions[j].RegionName);
|
sb.Append(Regions[j].Name);
|
||||||
if (j == Regions.Count - 1)
|
if (j == Regions.Count - 1)
|
||||||
{
|
{
|
||||||
args.Player.SendMessage(sb.ToString(), Color.Yellow);
|
args.Player.SendMessage(sb.ToString(), Color.Yellow);
|
||||||
|
|
|
||||||
|
|
@ -52,151 +52,108 @@ namespace TShockAPI.DB
|
||||||
|
|
||||||
com.ExecuteNonQuery();
|
com.ExecuteNonQuery();
|
||||||
|
|
||||||
String file = Path.Combine(TShock.SavePath, "regions.xml");
|
ImportOld();
|
||||||
String name = "";
|
}
|
||||||
String world = "";
|
}
|
||||||
int x1 = 0;
|
|
||||||
int x2 = 0;
|
public void ImportOld()
|
||||||
int y1 = 0;
|
{
|
||||||
int y2 = 0;
|
String file = Path.Combine(TShock.SavePath, "regions.xml");
|
||||||
int prot = 0;
|
if (!File.Exists(file))
|
||||||
int users = 0;
|
return;
|
||||||
String[] ips;
|
|
||||||
String ipstr = "";
|
Region region;
|
||||||
int updates = 0;
|
Rectangle rect;
|
||||||
if (File.Exists(file))
|
using (var sr = new StreamReader(file))
|
||||||
|
{
|
||||||
|
using (var reader = XmlReader.Create(sr))
|
||||||
{
|
{
|
||||||
XmlReader reader;
|
|
||||||
reader = XmlReader.Create(new StreamReader(file));
|
|
||||||
// Parse the file and display each of the nodes.
|
// Parse the file and display each of the nodes.
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
{
|
{
|
||||||
switch (reader.NodeType)
|
if (reader.NodeType != XmlNodeType.Element || reader.Name != "ProtectedRegion")
|
||||||
|
continue;
|
||||||
|
|
||||||
|
region = new Region();
|
||||||
|
rect = new Rectangle();
|
||||||
|
|
||||||
|
bool endregion = false;
|
||||||
|
while (reader.Read() && !endregion)
|
||||||
{
|
{
|
||||||
case XmlNodeType.Element:
|
if (reader.NodeType != XmlNodeType.Element)
|
||||||
switch( reader.Name )
|
continue;
|
||||||
|
|
||||||
|
string name = reader.Name;
|
||||||
|
|
||||||
|
while (reader.Read() && reader.NodeType != XmlNodeType.Text) ;
|
||||||
|
|
||||||
|
switch (name)
|
||||||
{
|
{
|
||||||
case "ProtectedRegion":
|
|
||||||
name = "";
|
|
||||||
world = "";
|
|
||||||
x1 = 0;
|
|
||||||
x2 = 0;
|
|
||||||
y1 = 0;
|
|
||||||
y2 = 0;
|
|
||||||
prot = 0;
|
|
||||||
users = 0;
|
|
||||||
ips = null;
|
|
||||||
ipstr = "";
|
|
||||||
break;
|
|
||||||
case "RegionName":
|
case "RegionName":
|
||||||
while (reader.NodeType != XmlNodeType.Text)
|
region.Name = reader.Value;
|
||||||
reader.Read();
|
|
||||||
name = reader.Value;
|
|
||||||
break;
|
break;
|
||||||
case "Point1X":
|
case "Point1X":
|
||||||
while (reader.NodeType != XmlNodeType.Text)
|
int.TryParse(reader.Value, out rect.X);
|
||||||
reader.Read();
|
|
||||||
int.TryParse( reader.Value, out x1 );
|
|
||||||
break;
|
break;
|
||||||
case "Point1Y":
|
case "Point1Y":
|
||||||
while (reader.NodeType != XmlNodeType.Text)
|
int.TryParse(reader.Value, out rect.Y);
|
||||||
reader.Read();
|
|
||||||
int.TryParse(reader.Value, out y1);
|
|
||||||
break;
|
break;
|
||||||
case "Point2X":
|
case "Point2X":
|
||||||
while (reader.NodeType != XmlNodeType.Text)
|
int.TryParse(reader.Value, out rect.Width);
|
||||||
reader.Read();
|
|
||||||
int.TryParse(reader.Value, out x2);
|
|
||||||
break;
|
break;
|
||||||
case "Point2Y":
|
case "Point2Y":
|
||||||
while (reader.NodeType != XmlNodeType.Text)
|
int.TryParse(reader.Value, out rect.Height);
|
||||||
reader.Read();
|
|
||||||
int.TryParse(reader.Value, out y2);
|
|
||||||
break;
|
break;
|
||||||
case "Protected":
|
case "Protected":
|
||||||
while (reader.NodeType != XmlNodeType.Text)
|
region.Protected = reader.Value.ToLower().Equals("true");
|
||||||
reader.Read();
|
|
||||||
if (reader.Value.Equals("True"))
|
|
||||||
{
|
|
||||||
prot = 0;
|
|
||||||
}
|
|
||||||
else{
|
|
||||||
prot = 1;
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
case "WorldName":
|
case "WorldName":
|
||||||
while (reader.NodeType != XmlNodeType.Text)
|
region.WorldID = reader.Value;
|
||||||
reader.Read();
|
|
||||||
world = reader.Value;
|
|
||||||
break;
|
break;
|
||||||
case "AllowedUserCount":
|
case "AllowedUserCount":
|
||||||
while (reader.NodeType != XmlNodeType.Text)
|
break;
|
||||||
reader.Read();
|
case "IP":
|
||||||
int.TryParse(reader.Value, out users);
|
region.AllowedIDs.Add(reader.Value);
|
||||||
if (users > 0)
|
break;
|
||||||
{
|
default:
|
||||||
ips = new String[users];
|
endregion = true;
|
||||||
for (int i = 0; i < users; i++)
|
break;
|
||||||
{
|
|
||||||
do
|
|
||||||
reader.Read();
|
|
||||||
while (reader.NodeType != XmlNodeType.Text);
|
|
||||||
ips[i] = reader.Value;
|
|
||||||
}
|
}
|
||||||
ipstr = "";
|
|
||||||
for( int i = 0; i < ips.Length; i++ )
|
|
||||||
{
|
|
||||||
if (ipstr != "")
|
|
||||||
ipstr += ",";
|
|
||||||
ipstr += ips[i];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
region.Area = rect;
|
||||||
|
using (var com = database.CreateCommand())
|
||||||
|
{
|
||||||
if (TShock.Config.StorageType.ToLower() == "sqlite")
|
if (TShock.Config.StorageType.ToLower() == "sqlite")
|
||||||
com.CommandText = "INSERT OR IGNORE INTO Regions VALUES (@tx, @ty, @height, @width, @name, @worldid, @userids, @protected);";
|
com.CommandText =
|
||||||
|
"INSERT OR IGNORE INTO Regions VALUES (@tx, @ty, @height, @width, @name, @worldid, @userids, @protected);";
|
||||||
else if (TShock.Config.StorageType.ToLower() == "mysql")
|
else if (TShock.Config.StorageType.ToLower() == "mysql")
|
||||||
com.CommandText = "INSERT IGNORE INTO Regions SET X1=@tx, Y1=@ty, height=@height, width=@width, RegionName=@name, WorldID=@world, UserIds=@userids, Protected=@protected;";
|
com.CommandText =
|
||||||
com.AddParameter("@tx", x1);
|
"INSERT IGNORE INTO Regions SET X1=@tx, Y1=@ty, height=@height, width=@width, RegionName=@name, WorldID=@world, UserIds=@userids, Protected=@protected;";
|
||||||
com.AddParameter("@ty", y1);
|
com.AddParameter("@tx", region.Area.X);
|
||||||
com.AddParameter("@width", x2);
|
com.AddParameter("@ty", region.Area.Y);
|
||||||
com.AddParameter("@height",y2);
|
com.AddParameter("@width", region.Area.Width);
|
||||||
com.AddParameter("@name", name);
|
com.AddParameter("@height", region.Area.Height);
|
||||||
com.AddParameter("@worldid", world);
|
com.AddParameter("@name", region.Name);
|
||||||
com.AddParameter("@userids", ipstr);
|
com.AddParameter("@worldid", region.WorldID);
|
||||||
com.AddParameter("@protected", prot);
|
//Todo: What should this be? We don't really have a way to go from ips to userids
|
||||||
updates += com.ExecuteNonQuery();
|
com.AddParameter("@userids", ""/*string.Join(",", region.AllowedIDs)*/);
|
||||||
com.Parameters.Clear();
|
com.AddParameter("@protected", region.Protected);
|
||||||
break;
|
int num = com.ExecuteNonQuery();
|
||||||
}
|
}
|
||||||
break;
|
}
|
||||||
case XmlNodeType.Text:
|
|
||||||
|
|
||||||
break;
|
|
||||||
case XmlNodeType.XmlDeclaration:
|
|
||||||
case XmlNodeType.ProcessingInstruction:
|
|
||||||
break;
|
|
||||||
case XmlNodeType.Comment:
|
|
||||||
break;
|
|
||||||
case XmlNodeType.EndElement:
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
reader.Close();
|
|
||||||
reader = null;
|
|
||||||
String path = Path.Combine(TShock.SavePath, "old_configs");
|
String path = Path.Combine(TShock.SavePath, "old_configs");
|
||||||
String file2 = Path.Combine(path, "regions.xml");
|
String file2 = Path.Combine(path, "regions.xml");
|
||||||
if (!Directory.Exists(path))
|
if (!Directory.Exists(path))
|
||||||
System.IO.Directory.CreateDirectory(path);
|
Directory.CreateDirectory(path);
|
||||||
if (File.Exists(file2))
|
if (File.Exists(file2))
|
||||||
File.Delete(file2);
|
File.Delete(file2);
|
||||||
//File.Move(file, file2);
|
File.Move(file, file2);
|
||||||
}
|
|
||||||
|
|
||||||
if( updates > 0 )
|
|
||||||
ReloadAllRegions();
|
ReloadAllRegions();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
public void ReloadAllRegions()
|
public void ReloadAllRegions()
|
||||||
{
|
{
|
||||||
|
|
@ -219,10 +176,8 @@ namespace TShockAPI.DB
|
||||||
string MergedIDs = DbExt.Get<string>(reader, "UserIds");
|
string MergedIDs = DbExt.Get<string>(reader, "UserIds");
|
||||||
string name = DbExt.Get<string>(reader, "RegionName");
|
string name = DbExt.Get<string>(reader, "RegionName");
|
||||||
|
|
||||||
string[] SplitIDs = MergedIDs.Split(',');
|
Region r = new Region(new Rectangle(X1, Y1, width, height), name, Protected != 0, Main.worldID.ToString());
|
||||||
|
r.AllowedIDs = MergedIDs.Split(',').ToList();
|
||||||
Region r = new Region(new Rectangle(X1, Y1, width, height), name, Protected, Main.worldID.ToString());
|
|
||||||
r.RegionAllowedIDs = SplitIDs;
|
|
||||||
Regions.Add(r);
|
Regions.Add(r);
|
||||||
}
|
}
|
||||||
reader.Close();
|
reader.Close();
|
||||||
|
|
@ -235,7 +190,7 @@ namespace TShockAPI.DB
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool AddRegion(int tx, int ty, int width, int height, string regionname, string worldid)
|
public bool AddRegion(Region region)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
@ -243,14 +198,14 @@ namespace TShockAPI.DB
|
||||||
{
|
{
|
||||||
com.CommandText =
|
com.CommandText =
|
||||||
"INSERT INTO Regions VALUES (@tx, @ty, @height, @width, @name, @worldid, @userids, @protected);";
|
"INSERT INTO Regions VALUES (@tx, @ty, @height, @width, @name, @worldid, @userids, @protected);";
|
||||||
com.AddParameter("@tx", tx);
|
com.AddParameter("@tx", region.Area.X);
|
||||||
com.AddParameter("@ty", ty);
|
com.AddParameter("@ty", region.Area.Y);
|
||||||
com.AddParameter("@width", width + tx);
|
com.AddParameter("@width", region.Area.Right);
|
||||||
com.AddParameter("@height", height + ty);
|
com.AddParameter("@height", region.Area.Bottom);
|
||||||
com.AddParameter("@name", regionname.ToLower());
|
com.AddParameter("@name", region.Name);
|
||||||
com.AddParameter("@worldid", worldid);
|
com.AddParameter("@worldid", region.WorldID);
|
||||||
com.AddParameter("@userids", "");
|
com.AddParameter("@userids", string.Join(",", region.AllowedIDs));
|
||||||
com.AddParameter("@protected", 1);
|
com.AddParameter("@protected", region.Protected);
|
||||||
if (com.ExecuteNonQuery() > 0)
|
if (com.ExecuteNonQuery() > 0)
|
||||||
{
|
{
|
||||||
ReloadAllRegions();
|
ReloadAllRegions();
|
||||||
|
|
@ -266,6 +221,11 @@ namespace TShockAPI.DB
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool AddRegion(int tx, int ty, int width, int height, string regionname, string worldid)
|
||||||
|
{
|
||||||
|
return AddRegion(new Region { Area = new Rectangle(tx, ty, width, height), Name = regionname, WorldID = worldid });
|
||||||
|
}
|
||||||
|
|
||||||
public bool DeleteRegion(string name)
|
public bool DeleteRegion(string name)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -330,9 +290,9 @@ namespace TShockAPI.DB
|
||||||
{
|
{
|
||||||
foreach (Region region in Regions)
|
foreach (Region region in Regions)
|
||||||
{
|
{
|
||||||
if (x >= region.RegionArea.Left && x <= region.RegionArea.Right &&
|
if (x >= region.Area.Left && x <= region.Area.Right &&
|
||||||
y >= region.RegionArea.Top && y <= region.RegionArea.Bottom &&
|
y >= region.Area.Top && y <= region.Area.Bottom &&
|
||||||
region.DisableBuild == 1)
|
region.Protected)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -392,7 +352,8 @@ namespace TShockAPI.DB
|
||||||
{
|
{
|
||||||
ReloadAllRegions();
|
ReloadAllRegions();
|
||||||
return true;
|
return true;
|
||||||
} else
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
@ -416,7 +377,7 @@ namespace TShockAPI.DB
|
||||||
using (var reader = com.ExecuteReader())
|
using (var reader = com.ExecuteReader())
|
||||||
{
|
{
|
||||||
while (reader.Read())
|
while (reader.Read())
|
||||||
Regions.Add(new Region(new Rectangle(reader.Get<int>("X1"), reader.Get<int>("Y1"), reader.Get<int>("height"), reader.Get<int>("width")), reader.Get<string>("RegionName"), reader.Get<int>("Protected"), reader.Get<string>("WorldID")));
|
Regions.Add(new Region(new Rectangle(reader.Get<int>("X1"), reader.Get<int>("Y1"), reader.Get<int>("height"), reader.Get<int>("width")), reader.Get<string>("RegionName"), reader.Get<int>("Protected") != 0, reader.Get<string>("WorldID")));
|
||||||
reader.Close();
|
reader.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -431,35 +392,33 @@ namespace TShockAPI.DB
|
||||||
|
|
||||||
public class Region
|
public class Region
|
||||||
{
|
{
|
||||||
public Rectangle RegionArea { get; set; }
|
public Rectangle Area { get; set; }
|
||||||
public string RegionName { get; set; }
|
public string Name { get; set; }
|
||||||
public int DisableBuild { get; set; }
|
public bool Protected { get; set; }
|
||||||
public string RegionWorldID { get; set; }
|
public string WorldID { get; set; }
|
||||||
public string[] RegionAllowedIDs { get; set; }
|
public List<string> AllowedIDs { get; set; }
|
||||||
|
|
||||||
public Region(Rectangle region, string name, int disablebuild, string RegionWorldIDz)
|
public Region(Rectangle region, string name, bool disablebuild, string worldid)
|
||||||
|
: this()
|
||||||
{
|
{
|
||||||
RegionArea = region;
|
Area = region;
|
||||||
RegionName = name;
|
Name = name;
|
||||||
DisableBuild = disablebuild;
|
Protected = disablebuild;
|
||||||
RegionWorldID = RegionWorldIDz;
|
WorldID = worldid;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Region()
|
public Region()
|
||||||
{
|
{
|
||||||
RegionArea = Rectangle.Empty;
|
Area = Rectangle.Empty;
|
||||||
RegionName = string.Empty;
|
Name = string.Empty;
|
||||||
DisableBuild = 1;
|
Protected = true;
|
||||||
RegionWorldID = string.Empty;
|
WorldID = string.Empty;
|
||||||
|
AllowedIDs = new List<string>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool InArea(Rectangle point)
|
public bool InArea(Rectangle point)
|
||||||
{
|
{
|
||||||
if (RegionArea.Contains(point.X, point.Y))
|
return Area.Contains(point.X, point.Y);
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasPermissionToBuildInRegion(TSPlayer ply)
|
public bool HasPermissionToBuildInRegion(TSPlayer ply)
|
||||||
|
|
@ -469,14 +428,12 @@ namespace TShockAPI.DB
|
||||||
ply.SendMessage("You must be logged in to take advantage of protected regions.", Color.Red);
|
ply.SendMessage("You must be logged in to take advantage of protected regions.", Color.Red);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (DisableBuild == 0)
|
if (!Protected)
|
||||||
{
|
|
||||||
return true;
|
return true;
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = 0; i < RegionAllowedIDs.Length; i++)
|
for (int i = 0; i < AllowedIDs.Count; i++)
|
||||||
{
|
{
|
||||||
if (RegionAllowedIDs[i] == ply.UserAccountName)
|
if (AllowedIDs[i] == ply.UserAccountName)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -156,15 +156,7 @@ namespace TShockAPI
|
||||||
/// <returns>int playerCount</returns>
|
/// <returns>int playerCount</returns>
|
||||||
public static int ActivePlayers()
|
public static int ActivePlayers()
|
||||||
{
|
{
|
||||||
int num = 0;
|
return TShock.Players.Count(player => player != null && player.Active);
|
||||||
foreach (TSPlayer player in TShock.Players)
|
|
||||||
{
|
|
||||||
if (player != null && player.Active)
|
|
||||||
{
|
|
||||||
num++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return num;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -464,11 +456,11 @@ namespace TShockAPI
|
||||||
public static Group GetGroup(string groupName)
|
public static Group GetGroup(string groupName)
|
||||||
{
|
{
|
||||||
//first attempt on cached groups
|
//first attempt on cached groups
|
||||||
for (int i = 0; i < TShock.Groups.groups.Count; i++)
|
foreach (Group t in TShock.Groups.groups)
|
||||||
{
|
{
|
||||||
if (TShock.Groups.groups[i].Name.Equals(groupName))
|
if (t.Name.Equals(groupName))
|
||||||
{
|
{
|
||||||
return TShock.Groups.groups[i];
|
return t;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return new Group("default");
|
return new Group("default");
|
||||||
|
|
@ -493,12 +485,10 @@ namespace TShockAPI
|
||||||
/// <returns>string sha256</returns>
|
/// <returns>string sha256</returns>
|
||||||
public static string HashPassword(string password)
|
public static string HashPassword(string password)
|
||||||
{
|
{
|
||||||
|
if (string.IsNullOrEmpty(password))
|
||||||
|
throw new NullReferenceException("Password can not be empty or null!");
|
||||||
using (var sha = new SHA512CryptoServiceProvider())
|
using (var sha = new SHA512CryptoServiceProvider())
|
||||||
{
|
{
|
||||||
if (password == "")
|
|
||||||
{
|
|
||||||
return "nonexistent-password";
|
|
||||||
}
|
|
||||||
var bytes = sha.ComputeHash(Encoding.ASCII.GetBytes(password));
|
var bytes = sha.ComputeHash(Encoding.ASCII.GetBytes(password));
|
||||||
return bytes.Aggregate("", (s, b) => s + b.ToString("X2"));
|
return bytes.Aggregate("", (s, b) => s + b.ToString("X2"));
|
||||||
}
|
}
|
||||||
|
|
@ -511,12 +501,7 @@ namespace TShockAPI
|
||||||
/// <returns>True if the string only contains printable characters</returns>
|
/// <returns>True if the string only contains printable characters</returns>
|
||||||
public static bool ValidString(string str)
|
public static bool ValidString(string str)
|
||||||
{
|
{
|
||||||
foreach (var c in str)
|
return str.All(c => c >= 0x20 && c <= 0xA9);
|
||||||
{
|
|
||||||
if (c < 0x20 || c > 0xA9)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -525,12 +510,7 @@ namespace TShockAPI
|
||||||
/// <returns>True if the entire chest array is used</returns>
|
/// <returns>True if the entire chest array is used</returns>
|
||||||
public static bool MaxChests()
|
public static bool MaxChests()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < Main.chest.Length; i++)
|
return Main.chest.All(t => t != null);
|
||||||
{
|
|
||||||
if (Main.chest[i] == null)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue