Merge remote-tracking branch 'origin/general-devel' into fragments

This commit is contained in:
Lucas Nicodemus 2017-12-09 21:06:47 -07:00
commit 3e5c1bf0c5
6 changed files with 31 additions and 7 deletions

View file

@ -21,8 +21,11 @@ This is the rolling changelog for TShock for Terraria. Use past tense when addin
* Fixed /savessc not bothering to save ssc data for people who bypass ssc. (@hakusaro) * Fixed /savessc not bothering to save ssc data for people who bypass ssc. (@hakusaro)
* Default permission sets for new databases are more modern. (@hakusaro) * Default permission sets for new databases are more modern. (@hakusaro)
* Added the ability to ban by account name instead of just banning a character name assuming its an account name. (@hakusaro) * Added the ability to ban by account name instead of just banning a character name assuming its an account name. (@hakusaro)
* Fixed a bug in the CommandLineParser which caused some command lines to fail (@QuicM)
* Renamed TShock.DB.User to TShock.DB.UserAccount, including all the related methods, classes and events. (@Ryozuki) * Renamed TShock.DB.User to TShock.DB.UserAccount, including all the related methods, classes and events. (@Ryozuki)
* Update OTAPI to 2.0.0.31, which also updates Newtonsoft.Json to 10.0.3 (@Ryozuki) * Update OTAPI to 2.0.0.31, which also updates Newtonsoft.Json to 10.0.3 (@Ryozuki)
* Fixed DumpItems() from trying to dump older versions of certain items (negative item IDs). (@Zaicon)
* Added the `/dump-reference-data` command, which when run, runs Utils.Dump() and outputs Terraria reference data to the server folder. (@hakusaro)
* `GetDataHandlers.SendTileSquare` hook now sends a `TSPlayer` and a `MemoryStream` of raw data. (@hakusaro) * `GetDataHandlers.SendTileSquare` hook now sends a `TSPlayer` and a `MemoryStream` of raw data. (@hakusaro)
* Added `GetDataHandlers.HealOtherPlayer` hook. (@hakusaro) * Added `GetDataHandlers.HealOtherPlayer` hook. (@hakusaro)
* Added `GetDataHandlers.PlaceObject` hook. (@hakusaro) * Added `GetDataHandlers.PlaceObject` hook. (@hakusaro)

View file

@ -165,10 +165,16 @@ namespace TShockAPI.CLI
{ {
_source = source; _source = source;
for (int i = 0; i < (source.Length - 1 == 0 ? 1 : source.Length - 1); i++) for (int i = 0; i < (source.Length - 1 == 0 ? 1 : source.Length); i++)
{ {
string flag = source[i].ToLowerInvariant(); string flag = source[i].ToLowerInvariant();
string argument = null; string argument = null;
if (string.IsNullOrWhiteSpace(flag))
{
continue;
}
if (i + 1 < source.Length) if (i + 1 < source.Length)
{ {
argument = source[i + 1]; argument = source[i + 1];

View file

@ -616,6 +616,10 @@ namespace TShockAPI
{ {
HelpText = "Sends a PM to a player." HelpText = "Sends a PM to a player."
}); });
add(new Command(Permissions.createdumps, CreateDumps, "dump-reference-data")
{
HelpText = "Creates a reference tables for Terraria data types and the TShock permission system in the server folder."
});
#endregion #endregion
add(new Command(Aliases, "aliases") add(new Command(Aliases, "aliases")
@ -5178,6 +5182,14 @@ namespace TShockAPI
args.Player.SendErrorMessage("No command or command alias matching \"{0}\" found.", givenCommandName); args.Player.SendErrorMessage("No command or command alias matching \"{0}\" found.", givenCommandName);
} }
private static void CreateDumps(CommandArgs args)
{
TShock.Utils.DumpPermissionMatrix("PermissionMatrix.txt");
TShock.Utils.Dump(false);
args.Player.SendSuccessMessage("Your reference dumps have been created in the server folder.");
return;
}
#endregion General Commands #endregion General Commands
#region Cheat Commands #region Cheat Commands

View file

@ -172,7 +172,8 @@ namespace TShockAPI.DB
Permissions.serverinfo, Permissions.serverinfo,
Permissions.settempgroup, Permissions.settempgroup,
Permissions.spawnrate, Permissions.spawnrate,
Permissions.tpoverride)); Permissions.tpoverride,
Permissions.createdumps));
} }
// Load Permissions from the DB // Load Permissions from the DB

View file

@ -128,6 +128,9 @@ namespace TShockAPI
[Description("User can download updates to plugins that are currently running.")] [Description("User can download updates to plugins that are currently running.")]
public static readonly string updateplugins = "tshock.cfg.updateplugins"; public static readonly string updateplugins = "tshock.cfg.updateplugins";
[Description("User can create reference files of Terraria IDs and the permission matrix in the server folder.")]
public static readonly string createdumps = "tshock.cfg.createdumps";
// tshock.ignore nodes // tshock.ignore nodes
[Description("Prevents you from being reverted by kill tile abuse detection.")] [Description("Prevents you from being reverted by kill tile abuse detection.")]

View file

@ -1204,9 +1204,8 @@ namespace TShockAPI
Permissions.DumpDescriptions(); Permissions.DumpDescriptions();
ServerSideCharacters.ServerSideConfig.DumpDescriptions(); ServerSideCharacters.ServerSideConfig.DumpDescriptions();
RestManager.DumpDescriptions(); RestManager.DumpDescriptions();
DumpPermissionMatrix("PermissionMatrix.txt");
DumpBuffs("BuffList.txt"); DumpBuffs("BuffList.txt");
DumpItems("Items-1_0.txt", -48, 235); DumpItems("Items-1_0.txt", 1, 235);
DumpItems("Items-1_1.txt", 235, 604); DumpItems("Items-1_1.txt", 235, 604);
DumpItems("Items-1_2.txt", 604, 2749); DumpItems("Items-1_2.txt", 604, 2749);
DumpItems("Items-1_3.txt", 2749, Main.maxItemTypes); DumpItems("Items-1_3.txt", 2749, Main.maxItemTypes);
@ -1226,9 +1225,9 @@ namespace TShockAPI
Main.recipe[i] = new Recipe(); Main.recipe[i] = new Recipe();
} }
// Dumps a matrix of all permissions and all groups in markdown format /// <summary>Dumps a matrix of all permissions & all groups in Markdown table format.</summary>
// Hard coded to default groups because apparently we have poor querying tools /// <param name="path">The save destination.</param>
public void DumpPermissionMatrix(string path) internal void DumpPermissionMatrix(string path)
{ {
StringBuilder output = new StringBuilder(); StringBuilder output = new StringBuilder();
output.Append("|Permission|"); output.Append("|Permission|");