Change the way we ignore packets from clients while swapping with SSC inv.
Add dump for SSC, and terminate the application (maybe).
This commit is contained in:
parent
7fe761bacb
commit
b031f45cb0
3 changed files with 44 additions and 2 deletions
|
|
@ -1284,8 +1284,14 @@ namespace TShockAPI
|
||||||
bypassTrashCanCheck = true;
|
bypassTrashCanCheck = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (OnPlayerSlot(plr, slot, stack, prefix, type) || plr != args.Player.Index || slot < 0 || slot > NetItem.maxNetInventory || args.Player.IgnoreSSCPackets)
|
if (OnPlayerSlot(plr, slot, stack, prefix, type) || plr != args.Player.Index || slot < 0 ||
|
||||||
|
slot > NetItem.maxNetInventory)
|
||||||
return true;
|
return true;
|
||||||
|
if (args.Player.IgnoreSSCPackets)
|
||||||
|
{
|
||||||
|
args.Player.SendData(PacketTypes.PlayerSlot, "", args.Player.Index, slot);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
// Garabage? Or will it cause some internal initialization or whatever?
|
// Garabage? Or will it cause some internal initialization or whatever?
|
||||||
var item = new Item();
|
var item = new Item();
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
namespace TShockAPI.ServerSideCharacters
|
namespace TShockAPI.ServerSideCharacters
|
||||||
|
|
@ -61,5 +63,37 @@ namespace TShockAPI.ServerSideCharacters
|
||||||
writer.Write(JsonConvert.SerializeObject(this, Formatting.Indented));
|
writer.Write(JsonConvert.SerializeObject(this, Formatting.Indented));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Dumps all configuration options to a text file in Markdown format
|
||||||
|
/// </summary>
|
||||||
|
public static void DumpDescriptions()
|
||||||
|
{
|
||||||
|
var sb = new StringBuilder();
|
||||||
|
var defaults = new ServerSideConfig();
|
||||||
|
|
||||||
|
foreach (var field in defaults.GetType().GetFields().OrderBy(f => f.Name))
|
||||||
|
{
|
||||||
|
if (field.IsStatic)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
var name = field.Name;
|
||||||
|
var type = field.FieldType.Name;
|
||||||
|
|
||||||
|
var descattr =
|
||||||
|
field.GetCustomAttributes(false).FirstOrDefault(o => o is DescriptionAttribute) as DescriptionAttribute;
|
||||||
|
var desc = descattr != null && !string.IsNullOrWhiteSpace(descattr.Description) ? descattr.Description : "None";
|
||||||
|
|
||||||
|
var def = field.GetValue(defaults);
|
||||||
|
|
||||||
|
sb.AppendLine("{0} ".SFormat(name));
|
||||||
|
sb.AppendLine("Type: {0} ".SFormat(type));
|
||||||
|
sb.AppendLine("Description: {0} ".SFormat(desc));
|
||||||
|
sb.AppendLine("Default: \"{0}\" ".SFormat(def));
|
||||||
|
sb.AppendLine();
|
||||||
|
}
|
||||||
|
|
||||||
|
File.WriteAllText("ServerSideConfigDescriptions.txt", sb.ToString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -518,6 +518,8 @@ namespace TShockAPI
|
||||||
case "-dump":
|
case "-dump":
|
||||||
ConfigFile.DumpDescriptions();
|
ConfigFile.DumpDescriptions();
|
||||||
Permissions.DumpDescriptions();
|
Permissions.DumpDescriptions();
|
||||||
|
ServerSideConfig.DumpDescriptions();
|
||||||
|
Environment.Exit(1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue