diff --git a/README.md b/README.md
new file mode 100644
index 00000000..fe077c21
--- /dev/null
+++ b/README.md
@@ -0,0 +1,2 @@
+TShock is a server modification based upon High6's mod API that allows for basic server administration commands.
+Constant builds: http://ci.shankshock.com/
\ No newline at end of file
diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs
index b005d54a..f9829ee1 100644
--- a/TShockAPI/Commands.cs
+++ b/TShockAPI/Commands.cs
@@ -54,6 +54,7 @@ namespace TShockAPI
TShock.admincommandList.Add("kill", new CommandDelegate(Kill));
TShock.admincommandList.Add("help", new CommandDelegate(Help));
TShock.admincommandList.Add("slap", new CommandDelegate(Slap));
+ TShock.admincommandList.Add("off-nosave", new CommandDelegate(OffNoSave));
TShock.commandList.Add("help", new CommandDelegate(Help));
TShock.commandList.Add("kill", new CommandDelegate(Kill));
}
@@ -63,7 +64,7 @@ namespace TShockAPI
{
string plStr = args.Message.Remove(0, 5).Trim();
int ply = args.PlayerID;
- if (!(Tools.FindPlayer(plStr) == -1 || plStr == ""))
+ if (!(Tools.FindPlayer(plStr) == -1 || Tools.FindPlayer(plStr) == -2 || plStr == ""))
{
if (!TShock.players[Tools.FindPlayer(plStr)].IsAdmin())
{
@@ -73,6 +74,8 @@ namespace TShockAPI
else
Tools.SendMessage(ply, "You can't kick another admin!", new float[] { 255f, 0f, 0f });
}
+ else if (Tools.FindPlayer(plStr) == -2)
+ Tools.SendMessage(ply, "More than one player matched!", new float[] { 255f, 0f, 0f });
else
Tools.SendMessage(ply, "Invalid player!", new float[] { 255f, 0f, 0f });
}
@@ -81,7 +84,7 @@ namespace TShockAPI
{
string plStr = args.Message.Remove(0, 4).Trim();
int ply = args.PlayerID;
- if (!(Tools.FindPlayer(plStr) == -1 || plStr == ""))
+ if (!(Tools.FindPlayer(plStr) == -1 || Tools.FindPlayer(plStr) == -2 || plStr == ""))
{
if (!TShock.players[Tools.FindPlayer(plStr)].IsAdmin())
{
@@ -91,11 +94,19 @@ namespace TShockAPI
else
Tools.SendMessage(ply, "You can't ban another admin!", new float[] { 255f, 0f, 0f });
}
+ else if (Tools.FindPlayer(plStr) == -2)
+ Tools.SendMessage(ply, "More than one player matched!", new float[] { 255f, 0f, 0f });
else
Tools.SendMessage(ply, "Invalid player!", new float[] { 255f, 0f, 0f });
}
public static void Off(CommandArgs args)
+ {
+ WorldGen.saveWorld();
+ Netplay.disconnect = true;
+ }
+
+ public static void OffNoSave(CommandArgs args)
{
Netplay.disconnect = true;
}
@@ -437,9 +448,9 @@ namespace TShockAPI
int page = 1;
if (args.Message.Split(' ').Length == 2)
int.TryParse(args.Message.Split(' ')[1], out page);
- if (commands.Count > (20 * (page - 1)))
+ if (commands.Count > (15 * (page - 1)))
{
- for (int j = (20 * (page - 1)); j < commands.Count; j++)
+ for (int j = (15 * (page - 1)); j < commands.Count; j++)
{
if (i == 3) break;
if (j == commands.Count - 1)
@@ -450,7 +461,7 @@ namespace TShockAPI
if ((h - 1) % 5 == 0 && (h - 1) != 0)
{
Tools.SendMessage(ply, tempstring.TrimEnd(new char[] { ' ', ',' }), new float[] { 255f, 255f, 0f });
- tempstring = "";
+ tempstring = "/" + commands.Keys.ElementAt(j) + ", ";
i++;
h++;
}
@@ -461,7 +472,7 @@ namespace TShockAPI
}
}
}
- if (commands.Count > (20 * page))
+ if (commands.Count > (15 * page))
{ Tools.SendMessage(ply, "Type /help " + (page + 1).ToString() + " for more commands.", new float[] { 255f, 0f, 255f }); }
Tools.SendMessage(ply, "Terraria commands:");
Tools.SendMessage(ply, "/playing, /p, /me", new float[] { 255f, 255f, 0f });
diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs
index 0990f5bd..1ce76424 100644
--- a/TShockAPI/ConfigFile.cs
+++ b/TShockAPI/ConfigFile.cs
@@ -21,5 +21,7 @@ namespace TShockAPI
public bool BanGriefers = true;
public bool BanKillTileAbusers = false;
public bool KickKillTileAbusers = false;
+ public bool BanExplosives = true;
+ public bool KickExplosives = true;
}
}
diff --git a/TShockAPI/ConfigurationManager.cs b/TShockAPI/ConfigurationManager.cs
index 1a447e87..aacce18c 100644
--- a/TShockAPI/ConfigurationManager.cs
+++ b/TShockAPI/ConfigurationManager.cs
@@ -27,6 +27,9 @@ namespace TShockAPI
public static bool banGriefer = true;
public static bool banTnt = false;
public static bool kickTnt = false;
+ public static bool banBoom = true;
+ public static bool kickBoom = true;
+
public enum NPCList : int
{
WORLD_EATER = 0,
@@ -53,6 +56,8 @@ namespace TShockAPI
banGriefer = cfg.BanGriefers;
banTnt = cfg.BanKillTileAbusers;
kickTnt = cfg.KickKillTileAbusers;
+ banBoom = cfg.BanExplosives;
+ kickBoom = cfg.KickExplosives;
}
public static void WriteJsonConfiguration()
@@ -80,6 +85,8 @@ namespace TShockAPI
cfg.BanGriefers = banGriefer;
cfg.BanKillTileAbusers = true;
cfg.KickKillTileAbusers = true;
+ cfg.BanExplosives = true;
+ cfg.KickExplosives = true;
string json = JsonConvert.SerializeObject(cfg, Formatting.Indented);
TextWriter tr = new StreamWriter(FileTools.SaveDir + "config.json");
diff --git a/TShockAPI/FileTools.cs b/TShockAPI/FileTools.cs
index b95c1505..91d7637e 100644
--- a/TShockAPI/FileTools.cs
+++ b/TShockAPI/FileTools.cs
@@ -128,7 +128,7 @@ namespace TShockAPI
///
///
///
- public static bool CheckGreif(String ip)
+ public static bool Checkgrief(String ip)
{
ip = Tools.GetRealIP(ip);
if (!ConfigurationManager.banTnt) { return false; }
diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs
index 2196813d..60103e5b 100644
--- a/TShockAPI/TSPlayer.cs
+++ b/TShockAPI/TSPlayer.cs
@@ -8,8 +8,8 @@ namespace TShockAPI
public class TSPlayer
{
public uint tileThreshold;
- public bool firstTimeHealth;
- public bool firstTimeMana;
+ public bool syncHP = false;
+ public bool syncMP = false;
private int player;
private bool admin;
diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs
index 30b5af07..911ed00a 100644
--- a/TShockAPI/TShock.cs
+++ b/TShockAPI/TShock.cs
@@ -15,7 +15,7 @@ namespace TShockAPI
public static string saveDir = "./tshock/";
- public static Version VersionNum = new Version(1, 5, 0, 0);
+ public static Version VersionNum = new Version(1, 5, 0, 1);
public static bool shownVersion = false;
@@ -199,14 +199,14 @@ namespace TShockAPI
life = br.ReadInt16();
maxLife = br.ReadInt16();
}
- if (!players[ply].firstTimeHealth)
- {
- players[ply].firstTimeHealth = true;
- }
if (maxLife > Main.player[ply].statLifeMax + 20 || life > maxLife)
- {
- Tools.HandleCheater(ply);
- }
+ if (players[ply].syncHP)
+ {
+ if (maxLife > Main.player[ply].statLifeMax + 20 || life > maxLife)
+ Tools.HandleCheater(ply);
+ }
+ else
+ players[ply].syncHP = true;
}
else if (e.MsgID == 0x2a)
{
@@ -218,14 +218,14 @@ namespace TShockAPI
mana = br.ReadInt16();
maxmana = br.ReadInt16();
}
- if (!players[ply].firstTimeMana)
- {
- players[ply].firstTimeMana = true;
- }
- else if (maxmana > Main.player[ply].statManaMax + 20 || mana > maxmana)
- {
- Tools.HandleCheater(ply);
- }
+ if (maxmana > Main.player[ply].statManaMax + 20 || mana > maxmana)
+ if (players[ply].syncMP)
+ {
+ if (maxmana > Main.player[ply].statManaMax + 20 || mana > maxmana)
+ Tools.HandleCheater(ply);
+ }
+ else
+ players[ply].syncMP = true;
}
else if (e.MsgID == 0x19)
{
@@ -240,6 +240,45 @@ namespace TShockAPI
Tools.HandleCheater(ply);
}
}
+ else if (e.MsgID == 0x1B)
+ {
+ Int16 ident;
+ float posx;
+ float posy;
+ float velx;
+ float vely;
+ float knockback;
+ Int16 dmg;
+ byte owner;
+ byte type;
+ using (var br = new BinaryReader(new MemoryStream(e.Msg.readBuffer, e.Index, e.Length)))
+ {
+ ident = br.ReadInt16();
+ posx = br.ReadSingle();
+ posy = br.ReadSingle();
+ velx = br.ReadSingle();
+ vely = br.ReadSingle();
+ knockback = br.ReadSingle();
+ dmg = br.ReadInt16();
+ owner = br.ReadByte();
+ type = br.ReadByte();
+ }
+ if (type == 29 || type == 28)
+ {
+ if (!players[e.Msg.whoAmI].IsAdmin())
+ {
+ if (ConfigurationManager.kickBoom || ConfigurationManager.banBoom)
+ {
+ int i = e.Msg.whoAmI;
+ if (ConfigurationManager.banBoom)
+ FileTools.WriteGrief((int)i);
+ Tools.Kick((int)i, "Explosives was thrown.");
+ Tools.Broadcast(Main.player[i].name + " was " + (ConfigurationManager.banBoom ? "banned" : "kicked") + " for throwing an explosive device.");
+ e.Handled = true;
+ }
+ }
+ }
+ }
}
void OnGreetPlayer(int who, HandledEventArgs e)
@@ -290,9 +329,16 @@ namespace TShockAPI
{
if (Main.netMode != 2) { return; }
string ip = Tools.GetRealIP((Convert.ToString(Netplay.serverSock[ply].tcpClient.Client.RemoteEndPoint)));
- if (FileTools.CheckBanned(ip) || FileTools.CheckCheat(ip) || FileTools.CheckGreif(ip))
+ if (FileTools.CheckBanned(ip))
{
Tools.Kick(ply, "You are banned.");
+ } else if (FileTools.CheckCheat(ip))
+ {
+ Tools.Kick(ply, "You were flagged for cheating.");
+ }
+ else if (FileTools.Checkgrief(ip))
+ {
+ Tools.Kick(ply, "You were flagged for griefing.");
}
if (!FileTools.OnWhitelist(ip))
{
@@ -320,13 +366,17 @@ namespace TShockAPI
for (uint i = 0; i < Main.maxPlayers; i++)
{
if (Main.player[i].active == false) { continue; }
- if (players[i].tileThreshold >= 5)
+ if (players[i].tileThreshold >= 20)
{
if (Main.player[i] != null)
{
- FileTools.WriteGrief((int)i);
- Tools.Kick((int)i, "Kill tile abuse detected.");
- Tools.Broadcast(Main.player[i].name + " was " + (ConfigurationManager.banTnt ? "banned" : "kicked") + " for kill tile abuse.");
+ if (ConfigurationManager.kickTnt || ConfigurationManager.banTnt)
+ {
+ if (ConfigurationManager.banTnt)
+ FileTools.WriteGrief((int)i);
+ Tools.Kick((int)i, "Kill tile abuse detected.");
+ Tools.Broadcast(Main.player[i].name + " was " + (ConfigurationManager.banTnt ? "banned" : "kicked") + " for kill tile abuse.");
+ }
}
players[i].tileThreshold = 0;
}
diff --git a/TShockAPI/TShockAPI.csproj b/TShockAPI/TShockAPI.csproj
index d9987db5..11aebcc5 100644
--- a/TShockAPI/TShockAPI.csproj
+++ b/TShockAPI/TShockAPI.csproj
@@ -69,7 +69,8 @@
- $(SolutionDir)\myass.bat
+
+