From 9281d0ea6a4088ffa14d307eb4d9c15d8c769170 Mon Sep 17 00:00:00 2001 From: Deathmax Date: Mon, 27 Jun 2011 22:38:58 +0800 Subject: [PATCH 1/4] /auth output is now saved into auth.lck --- TShockAPI/TShock.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index c666df6d..b26967ee 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -184,7 +184,8 @@ namespace TShockAPI Console.WriteLine("TShock Notice: To become SuperAdmin, join the game and type /auth " + ConfigurationManager.AuthToken); Console.WriteLine("This token will only display ONCE. This only works ONCE. If you don't use it and the server goes down, delete auth.lck."); - FileTools.CreateFile(Path.Combine(SavePath, "auth.lck")); + //FileTools.CreateFile(Path.Combine(SavePath, "auth.lck")); + File.WriteAllText(Path.Combine(SavePath, "auth.lck"), ConfigurationManager.AuthToken.ToString()); } } From a8da178987e5a35f4622310c7c6d641c13fd099f Mon Sep 17 00:00:00 2001 From: Deathmax Date: Tue, 28 Jun 2011 18:28:29 +0800 Subject: [PATCH 2/4] Removed unnecessary checks --- TShockAPI/GetDataHandlers.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs index 48f70535..1b141ecb 100755 --- a/TShockAPI/GetDataHandlers.cs +++ b/TShockAPI/GetDataHandlers.cs @@ -360,10 +360,10 @@ namespace TShockAPI private static bool HandlePlayerDamage(GetDataHandlerArgs args) { byte playerid = args.Data.ReadInt8(); - if (playerid >= 0 && playerid <= Main.maxPlayers && TShock.Players[playerid] != null) + if (playerid >= 0 && playerid <= Main.maxPlayers) return !TShock.Players[playerid].TPlayer.hostile; - - return ConfigurationManager.PermaPvp; + else + return true; } private static bool HandleLiquidSet(GetDataHandlerArgs args) From 61c999181021ea7f384dc556f704e3d978affc43 Mon Sep 17 00:00:00 2001 From: Deathmax Date: Tue, 28 Jun 2011 22:17:25 +0800 Subject: [PATCH 3/4] Added -configpath command line parameter to set config path. --- TShockAPI/TShock.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 0c8cbf17..5644d042 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -37,7 +37,7 @@ namespace TShockAPI public static readonly Version VersionNum = Assembly.GetExecutingAssembly().GetName().Version; public static readonly string VersionCodename = "Lol, packet changes."; - public static readonly string SavePath = "tshock"; + public static string SavePath = "tshock"; public static TSPlayer[] Players = new TSPlayer[Main.maxPlayers]; public static BanManager Bans = new BanManager(Path.Combine(SavePath, "bans.txt")); @@ -167,6 +167,15 @@ namespace TShockAPI Console.WriteLine("Bad IP: {0}", parms[i]); } } + if (parms[i].ToLower() == "-configpath") + { + var path = parms[++i]; + if (path.IndexOfAny(Path.GetInvalidPathChars()) == -1) + { + SavePath = path; + Log.ConsoleInfo("Config path has been set to " + path); + } + } } } @@ -184,8 +193,7 @@ namespace TShockAPI Console.WriteLine("TShock Notice: To become SuperAdmin, join the game and type /auth " + ConfigurationManager.AuthToken); Console.WriteLine("This token will only display ONCE. This only works ONCE. If you don't use it and the server goes down, delete auth.lck."); - //FileTools.CreateFile(Path.Combine(SavePath, "auth.lck")); - File.WriteAllText(Path.Combine(SavePath, "auth.lck"), ConfigurationManager.AuthToken.ToString()); + FileTools.CreateFile(Path.Combine(SavePath, "auth.lck")); } } From 75e062fb617b8c7c44d47fb41a6f4180605de87d Mon Sep 17 00:00:00 2001 From: Deathmax Date: Tue, 28 Jun 2011 22:19:56 +0800 Subject: [PATCH 4/4] Changed banned item check to use TSPlayer's TPlayer --- TShockAPI/TShock.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index 5644d042..99d0f6f7 100755 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -232,7 +232,7 @@ namespace TShockAPI if (!player.Group.HasPermission("usebanneditem")) { - var inv = Main.player[player.Index].inventory; + var inv = player.TPlayer.inventory; for (int i = 0; i < inv.Length; i++) { if (inv[i] != null && ItemManager.ItemIsBanned(inv[i].name))