From b786c80bb044a1952e77bd3d5395b6f1494af6cd Mon Sep 17 00:00:00 2001 From: Shank Date: Sat, 4 Jun 2011 21:56:24 -0600 Subject: [PATCH] Added /debug-config Added Version codename Added version tick early Closes #15 --- TShockAPI/Commands.cs | 30 ++++++++++++++++++++++++++++++ TShockAPI/ConfigurationManager.cs | 3 +++ TShockAPI/TShock.cs | 11 +++++++---- 3 files changed, 40 insertions(+), 4 deletions(-) diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs index ee5addd5..443c99d6 100644 --- a/TShockAPI/Commands.cs +++ b/TShockAPI/Commands.cs @@ -56,11 +56,41 @@ namespace TShockAPI TShock.admincommandList.Add("slap", new CommandDelegate(Slap)); TShock.admincommandList.Add("off-nosave", new CommandDelegate(OffNoSave)); TShock.admincommandList.Add("protectspawn", new CommandDelegate(ProtectSpawn)); + TShock.admincommandList.Add("debug-config", new CommandDelegate(DebugConfiguration)); TShock.commandList.Add("help", new CommandDelegate(Help)); TShock.commandList.Add("kill", new CommandDelegate(Kill)); } #region Command Methods + + public static void DebugConfiguration(CommandArgs args) + { + int ply = args.PlayerID; + var commands = TShock.commandList; + if (TShock.players[ply].IsAdmin()) + commands = TShock.admincommandList; + Tools.SendMessage(ply, "TShock Config:"); + string lineOne = ""; + lineOne += "KickCheater : " + ConfigurationManager.kickCheater + ", "; + lineOne += "BanCheater : " + ConfigurationManager.banCheater + ", "; + lineOne += "KickGriefer : " + ConfigurationManager.kickGriefer + ", "; + lineOne += "BanGriefer : " + ConfigurationManager.banGriefer; + Tools.SendMessage(ply, lineOne, new float[] { 255f, 255f, 0f }); + string lineTwo = ""; + lineTwo += "BanTnt : " + ConfigurationManager.banTnt + ", "; + lineTwo += "KickTnt : " + ConfigurationManager.kickTnt + ", "; + lineTwo += "BanBoom : " + ConfigurationManager.banBoom + ", "; + lineTwo += "KickBoom : " + ConfigurationManager.kickBoom; + Tools.SendMessage(ply, lineTwo, new float[] { 255f, 255f, 0f }); + string lineThree = ""; + lineThree += "InvMultiplier : " + ConfigurationManager.invasionMultiplier + ", "; + lineThree += "SpawnProtect : " + ConfigurationManager.spawnProtect + ", "; + lineThree += "SpawnProtectR : " + ConfigurationManager.spawnProtectRadius + ", "; + lineThree += "DefaultMaxSpawns : " + ConfigurationManager.defaultMaxSpawns + ", "; + lineThree += "SpawnRate: " + ConfigurationManager.defaultSpawnRate + ", "; + Tools.SendMessage(ply, lineThree, new float[] { 255f, 255f, 0f}); + } + public static void Kick(CommandArgs args) { string plStr = args.Message.Remove(0, 5).Trim(); diff --git a/TShockAPI/ConfigurationManager.cs b/TShockAPI/ConfigurationManager.cs index 0edfdaa2..dc792931 100644 --- a/TShockAPI/ConfigurationManager.cs +++ b/TShockAPI/ConfigurationManager.cs @@ -31,6 +31,7 @@ namespace TShockAPI public static bool kickBoom = true; public static bool spawnProtect = true; public static int spawnProtectRadius = 5; + public static ConfigFile config = null; public enum NPCList : int { @@ -44,6 +45,8 @@ namespace TShockAPI TextReader tr = new StreamReader(FileTools.SaveDir + "config.json"); ConfigFile cfg = JsonConvert.DeserializeObject(tr.ReadToEnd()); tr.Close(); + + config = cfg; invasionMultiplier = cfg.InvasionMultiplier; defaultMaxSpawns = cfg.DefaultMaximumSpawns; diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index d68dabdc..4ccf714f 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -15,7 +15,9 @@ namespace TShockAPI public static string saveDir = "./tshock/"; - public static Version VersionNum = new Version(1, 6, 0, 0); + public static Version VersionNum = new Version(1, 7, 0, 0); + + public static string VersionCodename = "Bugless Beast"; public static bool shownVersion = false; @@ -111,6 +113,7 @@ namespace TShockAPI { Console.WriteLine(ex.ToString()); } + Console.WriteLine("TShock Version " + Version.Major + "." + Version.Minor + "." + Version.Build + "." + Version.Revision + " (" + VersionCodename + ") now running."); Log.Initialize(FileTools.SaveDir + "log.txt", LogLevel.All, true); Log.Info("Starting..."); GameHooks.OnPreInitialize += OnPreInit; @@ -372,11 +375,11 @@ namespace TShockAPI } } } -<<<<<<< HEAD +<<<<<<< HEAD else if (e.MsgID == 0x22) // Client only KillTile e.Handled = true; // Client only uses it for chests, but sends regular 17 as well. -======= ->>>>>>> master +======= +>>>>>>> master } catch (Exception ex) {