Merge pull request #814 from NyxStudios/commands
Another command overhaul
This commit is contained in:
commit
0701f5cf37
5 changed files with 549 additions and 431 deletions
|
|
@ -367,13 +367,13 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
HelpText = "Sets the spawn rate of NPCs."
|
HelpText = "Sets the spawn rate of NPCs."
|
||||||
});
|
});
|
||||||
add(new Command(Permissions.invade, PumpkinInvasion, "pumpkin")
|
add(new Command(Permissions.invade, PumpkinMoon, "pumpkinmoon", "pmoon")
|
||||||
{
|
{
|
||||||
HelpText = "Starts a Pumpkin Moon invasion at the specified wave."
|
HelpText = "Starts a Pumpkin Moon at the specified wave."
|
||||||
});
|
});
|
||||||
add(new Command(Permissions.invade, SnowInvasion, "snowinvasion")
|
add(new Command(Permissions.invade, FrostMoon, "frostmoon", "fmoon")
|
||||||
{
|
{
|
||||||
HelpText = "Starts a Snow Moon invasion at the specified wave."
|
HelpText = "Starts a Frost Moon at the specified wave."
|
||||||
});
|
});
|
||||||
#endregion
|
#endregion
|
||||||
#region TP Commands
|
#region TP Commands
|
||||||
|
|
@ -390,17 +390,17 @@ namespace TShockAPI
|
||||||
add(new Command(Permissions.tp, TP, "tp")
|
add(new Command(Permissions.tp, TP, "tp")
|
||||||
{
|
{
|
||||||
AllowServer = false,
|
AllowServer = false,
|
||||||
HelpText = "Teleports you to another player or a coordinate."
|
HelpText = "Teleports a player to another player."
|
||||||
|
});
|
||||||
|
add(new Command(Permissions.tppos, TPPos, "tppos")
|
||||||
|
{
|
||||||
|
AllowServer = false,
|
||||||
|
HelpText = "Teleports you to tile coordinates."
|
||||||
});
|
});
|
||||||
add(new Command(Permissions.tpallow, TPAllow, "tpallow")
|
add(new Command(Permissions.tpallow, TPAllow, "tpallow")
|
||||||
{
|
{
|
||||||
AllowServer = false,
|
AllowServer = false,
|
||||||
HelpText = "Toggles whether other people can teleport to you."
|
HelpText = "Toggles whether other people can teleport you."
|
||||||
});
|
|
||||||
add(new Command(Permissions.tphere, TPHere, "tphere")
|
|
||||||
{
|
|
||||||
AllowServer = false,
|
|
||||||
HelpText = "Teleports another player to you."
|
|
||||||
});
|
});
|
||||||
#endregion
|
#endregion
|
||||||
#region World Commands
|
#region World Commands
|
||||||
|
|
@ -412,14 +412,6 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
HelpText = "Sets a blood moon."
|
HelpText = "Sets a blood moon."
|
||||||
});
|
});
|
||||||
add(new Command(Permissions.snowmoon, SnowMoon, "snowmoon")
|
|
||||||
{
|
|
||||||
HelpText = "Sets a snow moon."
|
|
||||||
});
|
|
||||||
add(new Command(Permissions.pumpkinmoon, PumpkinMoon, "pumpkinmoon")
|
|
||||||
{
|
|
||||||
HelpText = "Sets a pumpkin moon."
|
|
||||||
});
|
|
||||||
add(new Command(Permissions.grow, Grow, "grow")
|
add(new Command(Permissions.grow, Grow, "grow")
|
||||||
{
|
{
|
||||||
AllowServer = false,
|
AllowServer = false,
|
||||||
|
|
@ -433,6 +425,10 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
HelpText = "Sets an eclipse."
|
HelpText = "Sets an eclipse."
|
||||||
});
|
});
|
||||||
|
add(new Command(Permissions.halloween, ForceHalloween, "forcehalloween")
|
||||||
|
{
|
||||||
|
HelpText = "Toggles halloween mode (goodie bags, pumpkins, etc)."
|
||||||
|
});
|
||||||
add(new Command(Permissions.xmas, ForceXmas, "forcexmas")
|
add(new Command(Permissions.xmas, ForceXmas, "forcexmas")
|
||||||
{
|
{
|
||||||
HelpText = "Toggles christmas mode (present spawning, santa, etc)."
|
HelpText = "Toggles christmas mode (present spawning, santa, etc)."
|
||||||
|
|
@ -1387,37 +1383,19 @@ namespace TShockAPI
|
||||||
args.Player.SendSuccessMessage("SSC of player \"{0}\" has been overriden.", matchedPlayer.Name);
|
args.Player.SendSuccessMessage("SSC of player \"{0}\" has been overriden.", matchedPlayer.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void ForceXmas(CommandArgs args)
|
private static void ForceHalloween(CommandArgs args)
|
||||||
{
|
{
|
||||||
if(args.Parameters.Count == 0)
|
TShock.Config.ForceHalloween = !TShock.Config.ForceHalloween;
|
||||||
{
|
Main.checkHalloween();
|
||||||
args.Player.SendErrorMessage("Usage: /forcexmas [true/false]");
|
TSPlayer.All.SendInfoMessage("{0} {1}abled halloween mode!", args.Player.Name, (TShock.Config.ForceHalloween ? "en" : "dis"));
|
||||||
args.Player.SendInfoMessage(
|
}
|
||||||
String.Format("The server is currently {0} force Christmas mode.",
|
|
||||||
(TShock.Config.ForceXmas ? "in" : "not in")));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if(args.Parameters[0].ToLower() == "true")
|
private static void ForceXmas(CommandArgs args)
|
||||||
{
|
{
|
||||||
TShock.Config.ForceXmas = true;
|
TShock.Config.ForceHalloween = !TShock.Config.ForceHalloween;
|
||||||
Main.checkXMas();
|
Main.checkXMas();
|
||||||
}
|
TSPlayer.All.SendInfoMessage("{0} {1}abled Christmas mode!", args.Player.Name, (TShock.Config.ForceHalloween ? "en" : "dis"));
|
||||||
else if(args.Parameters[0].ToLower() == "false")
|
}
|
||||||
{
|
|
||||||
TShock.Config.ForceXmas = false;
|
|
||||||
Main.checkXMas();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
args.Player.SendErrorMessage("Usage: /forcexmas [true/false]");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
args.Player.SendInfoMessage(
|
|
||||||
String.Format("The server is currently {0} force Christmas mode.",
|
|
||||||
(TShock.Config.ForceXmas ? "in" : "not in")));
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void TempGroup(CommandArgs args)
|
private static void TempGroup(CommandArgs args)
|
||||||
{
|
{
|
||||||
|
|
@ -1582,32 +1560,20 @@ namespace TShockAPI
|
||||||
|
|
||||||
private static void Fullmoon(CommandArgs args)
|
private static void Fullmoon(CommandArgs args)
|
||||||
{
|
{
|
||||||
TSPlayer.Server.SetFullMoon(true);
|
TSPlayer.Server.SetFullMoon();
|
||||||
TShock.Utils.Broadcast(string.Format("{0} turned on the full moon.", args.Player.Name), Color.Green);
|
TSPlayer.All.SendInfoMessage("{0} started a full moon.", args.Player.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Bloodmoon(CommandArgs args)
|
private static void Bloodmoon(CommandArgs args)
|
||||||
{
|
{
|
||||||
TSPlayer.Server.SetBloodMoon(true);
|
TSPlayer.Server.SetBloodMoon(!Main.bloodMoon);
|
||||||
TShock.Utils.Broadcast(string.Format("{0} turned on the blood moon.", args.Player.Name), Color.Green);
|
TSPlayer.All.SendInfoMessage("{0} {1}ed a blood moon.", args.Player.Name, Main.bloodMoon ? "start" : "stopp");
|
||||||
}
|
|
||||||
|
|
||||||
private static void SnowMoon(CommandArgs args)
|
|
||||||
{
|
|
||||||
TSPlayer.Server.SetSnowMoon(true);
|
|
||||||
TShock.Utils.Broadcast(string.Format("{0} turned on the snow moon.", args.Player.Name), Color.Green);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void PumpkinMoon(CommandArgs args)
|
|
||||||
{
|
|
||||||
TSPlayer.Server.SetPumpkinMoon(true);
|
|
||||||
TShock.Utils.Broadcast(string.Format("{0} turned on the pumpkin moon.", args.Player.Name), Color.Green);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Eclipse(CommandArgs args)
|
private static void Eclipse(CommandArgs args)
|
||||||
{
|
{
|
||||||
TSPlayer.Server.SetEclipse(true);
|
TSPlayer.Server.SetEclipse(!Main.eclipse);
|
||||||
TShock.Utils.Broadcast(string.Format("{0} has forced an Eclipse!", args.Player.Name), Color.Green);
|
TSPlayer.All.SendInfoMessage("{0} {1}ed an eclipse.", args.Player.Name, Main.eclipse ? "start" : "stopp");
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Invade(CommandArgs args)
|
private static void Invade(CommandArgs args)
|
||||||
|
|
@ -1648,78 +1614,62 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void PumpkinInvasion(CommandArgs args)
|
private static void PumpkinMoon(CommandArgs args)
|
||||||
{
|
{
|
||||||
TSPlayer.Server.SetTime(false, 0.0);
|
|
||||||
|
|
||||||
int wave = 1;
|
int wave = 1;
|
||||||
if (args.Parameters.Count != 0)
|
if (args.Parameters.Count != 0)
|
||||||
int.TryParse(args.Parameters[0], out wave);
|
{
|
||||||
|
if (!int.TryParse(args.Parameters[0], out wave) || wave <= 0)
|
||||||
|
{
|
||||||
|
args.Player.SendErrorMessage("Invalid wave!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Main.pumpkinMoon = true;
|
TSPlayer.Server.SetPumpkinMoon(true);
|
||||||
Main.bloodMoon = false;
|
Main.bloodMoon = false;
|
||||||
NPC.waveKills = 0f;
|
NPC.waveKills = 0f;
|
||||||
NPC.waveCount = wave;
|
NPC.waveCount = wave;
|
||||||
string text = "Pumpkin Invasion started at wave: " + wave;
|
TSPlayer.All.SendInfoMessage("{0} started the pumpkin moon at wave {1}!", args.Player.Name, wave);
|
||||||
if (Main.netMode == 0)
|
|
||||||
{
|
|
||||||
Main.NewText(text, 175, 75, 255, false);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (Main.netMode == 2)
|
|
||||||
{
|
|
||||||
NetMessage.SendData(25, -1, -1, text, 255, 175f, 75f, 255f, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SnowInvasion(CommandArgs args)
|
private static void FrostMoon(CommandArgs args)
|
||||||
{
|
{
|
||||||
TSPlayer.Server.SetTime(false, 0.0);
|
|
||||||
|
|
||||||
int wave = 1;
|
int wave = 1;
|
||||||
if (args.Parameters.Count != 0)
|
if (args.Parameters.Count != 0)
|
||||||
int.TryParse(args.Parameters[0], out wave);
|
|
||||||
|
|
||||||
Main.snowMoon = true;
|
|
||||||
Main.pumpkinMoon = false;
|
|
||||||
Main.bloodMoon = false;
|
|
||||||
if (Main.netMode != 1)
|
|
||||||
{
|
{
|
||||||
NPC.waveKills = 0f;
|
if (!int.TryParse(args.Parameters[0], out wave) || wave <= 0)
|
||||||
NPC.waveCount = wave;
|
|
||||||
string text = "Snow Invasion started at wave: " + wave;
|
|
||||||
if (Main.netMode == 0)
|
|
||||||
{
|
{
|
||||||
Main.NewText(text, 175, 75, 255, false);
|
args.Player.SendErrorMessage("Invalid wave!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Main.netMode == 2)
|
|
||||||
{
|
|
||||||
NetMessage.SendData(25, -1, -1, text, 255, 175f, 75f, 255f, 0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TSPlayer.Server.SetFrostMoon(true);
|
||||||
|
Main.bloodMoon = false;
|
||||||
|
NPC.waveKills = 0f;
|
||||||
|
NPC.waveCount = wave;
|
||||||
|
TSPlayer.All.SendInfoMessage("{0} started the frost moon at wave {1}!", args.Player.Name, wave);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Hardmode(CommandArgs args)
|
private static void Hardmode(CommandArgs args)
|
||||||
{
|
{
|
||||||
if (Main.hardMode)
|
if (Main.hardMode)
|
||||||
{
|
{
|
||||||
Main.hardMode = false;
|
Main.hardMode = false;
|
||||||
|
TSPlayer.All.SendData(PacketTypes.WorldInfo);
|
||||||
args.Player.SendSuccessMessage("Hardmode is now off.");
|
args.Player.SendSuccessMessage("Hardmode is now off.");
|
||||||
}
|
}
|
||||||
|
else if (!TShock.Config.DisableHardmode)
|
||||||
|
{
|
||||||
|
WorldGen.StartHardmode();
|
||||||
|
args.Player.SendSuccessMessage("Hardmode is now on.");
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (!TShock.Config.DisableHardmode)
|
args.Player.SendErrorMessage("Hardmode is disabled via config.");
|
||||||
{
|
|
||||||
WorldGen.StartHardmode();
|
|
||||||
args.Player.SendSuccessMessage("Hardmode is now on.");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
args.Player.SendErrorMessage("Hardmode is disabled via config.");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SpawnBoss(CommandArgs args)
|
private static void SpawnBoss(CommandArgs args)
|
||||||
{
|
{
|
||||||
|
|
@ -1922,104 +1872,150 @@ namespace TShockAPI
|
||||||
|
|
||||||
private static void TP(CommandArgs args)
|
private static void TP(CommandArgs args)
|
||||||
{
|
{
|
||||||
if (args.Parameters.Count < 1)
|
if (args.Parameters.Count != 1 && args.Parameters.Count != 2)
|
||||||
{
|
{
|
||||||
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /tp <player>");
|
if (args.Player.Group.HasPermission(Permissions.tpothers))
|
||||||
args.Player.SendErrorMessage(" /tp <x> <y>");
|
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /tp <player> [player 2]");
|
||||||
|
else
|
||||||
|
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /tp <player>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(args.Parameters.Count == 2)
|
if (args.Parameters.Count == 1)
|
||||||
{
|
{
|
||||||
float x, y;
|
var players = TShock.Utils.FindPlayer(args.Parameters[0]);
|
||||||
if (float.TryParse(args.Parameters[0], out x) && float.TryParse(args.Parameters[1], out y))
|
if (players.Count == 0)
|
||||||
|
args.Player.SendErrorMessage("Invalid player!");
|
||||||
|
else if (players.Count > 1)
|
||||||
|
TShock.Utils.SendMultipleMatchError(args.Player, players.Select(p => p.Name));
|
||||||
|
else
|
||||||
{
|
{
|
||||||
args.Player.Teleport(x, y);
|
var target = players[0];
|
||||||
args.Player.SendSuccessMessage("Teleported!");
|
if (!target.TPAllow && !args.Player.Group.HasPermission(Permissions.tpoverride))
|
||||||
|
{
|
||||||
|
args.Player.SendErrorMessage("{0} has disabled players from teleporting.", target.Name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (args.Player.Teleport(target.TPlayer.position.X, target.TPlayer.position.Y))
|
||||||
|
{
|
||||||
|
args.Player.SendSuccessMessage("Teleported to {0}.", target.Name);
|
||||||
|
if (!args.Player.Group.HasPermission(Permissions.tpsilent))
|
||||||
|
target.SendInfoMessage("{0} teleported to you.", args.Player.Name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
string plStr = String.Join(" ", args.Parameters);
|
if (!args.Player.Group.HasPermission(Permissions.tpothers))
|
||||||
var players = TShock.Utils.FindPlayer(plStr);
|
|
||||||
if (players.Count == 0)
|
|
||||||
{
|
{
|
||||||
args.Player.SendErrorMessage("Invalid user name.");
|
args.Player.SendErrorMessage("You do not have access to this command.");
|
||||||
args.Player.SendErrorMessage("Proper syntax: /tp <player>");
|
return;
|
||||||
args.Player.SendErrorMessage(" /tp <x> <y>");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (players.Count > 1)
|
var players1 = TShock.Utils.FindPlayer(args.Parameters[0]);
|
||||||
TShock.Utils.SendMultipleMatchError(args.Player, players.Select(p => p.Name));
|
var players2 = TShock.Utils.FindPlayer(args.Parameters[1]);
|
||||||
else if (!players[0].TPAllow && !args.Player.Group.HasPermission(Permissions.tpall))
|
|
||||||
|
if (players2.Count == 0)
|
||||||
|
args.Player.SendErrorMessage("Invalid player!");
|
||||||
|
else if (players2.Count > 1)
|
||||||
|
TShock.Utils.SendMultipleMatchError(args.Player, players2.Select(p => p.Name));
|
||||||
|
else if (players1.Count == 0)
|
||||||
{
|
{
|
||||||
var plr = players[0];
|
if (args.Parameters[0] == "*")
|
||||||
args.Player.SendErrorMessage(plr.Name + " has prevented users from teleporting to them.");
|
|
||||||
plr.SendInfoMessage(args.Player.Name + " attempted to teleport to you.");
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
var plr = players[0];
|
|
||||||
if (args.Player.Teleport(plr.TPlayer.position.X, plr.TPlayer.position.Y))
|
|
||||||
{
|
{
|
||||||
args.Player.SendSuccessMessage(string.Format("Teleported to {0}.", plr.Name));
|
if (!args.Player.Group.HasPermission(Permissions.tpallothers))
|
||||||
if (!args.Player.Group.HasPermission(Permissions.tphide))
|
{
|
||||||
plr.SendInfoMessage(args.Player.Name + " teleported to you.");
|
args.Player.SendErrorMessage("You do not have access to this command.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var target = players2[0];
|
||||||
|
foreach (var source in TShock.Players.Where(p => p != null && p != args.Player))
|
||||||
|
{
|
||||||
|
if (!target.TPAllow && !args.Player.Group.HasPermission(Permissions.tpoverride))
|
||||||
|
continue;
|
||||||
|
if (source.Teleport(target.TPlayer.position.X, target.TPlayer.position.Y))
|
||||||
|
{
|
||||||
|
if (args.Player != source)
|
||||||
|
{
|
||||||
|
if (args.Player.Group.HasPermission(Permissions.tpsilent))
|
||||||
|
source.SendSuccessMessage("You were teleported to {0}.", target.Name);
|
||||||
|
else
|
||||||
|
source.SendSuccessMessage("{0} teleported you to {1}.", args.Player.Name, target.Name);
|
||||||
|
}
|
||||||
|
if (args.Player != target)
|
||||||
|
{
|
||||||
|
if (args.Player.Group.HasPermission(Permissions.tpsilent))
|
||||||
|
target.SendInfoMessage("{0} was teleported to you.", source.Name);
|
||||||
|
if (!args.Player.Group.HasPermission(Permissions.tpsilent))
|
||||||
|
target.SendInfoMessage("{0} teleported {1} to you.", args.Player.Name, source.Name);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
args.Player.SendSuccessMessage("Teleported everyone to {0}.", target.Name);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
args.Player.SendErrorMessage("Invalid player!");
|
||||||
}
|
}
|
||||||
}
|
else if (players1.Count > 1)
|
||||||
|
TShock.Utils.SendMultipleMatchError(args.Player, players1.Select(p => p.Name));
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void TPHere(CommandArgs args)
|
|
||||||
{
|
|
||||||
if (args.Parameters.Count < 1)
|
|
||||||
{
|
|
||||||
if (args.Player.Group.HasPermission(Permissions.tpallothers))
|
|
||||||
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /tphere <player|*>");
|
|
||||||
else
|
else
|
||||||
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /tphere <player>");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
string playerName = String.Join(" ", args.Parameters);
|
|
||||||
var players = TShock.Utils.FindPlayer(playerName);
|
|
||||||
if (players.Count == 0)
|
|
||||||
{
|
|
||||||
if (playerName == "*")
|
|
||||||
{
|
{
|
||||||
if (!args.Player.Group.HasPermission(Permissions.tpallothers))
|
var source = players1[0];
|
||||||
|
if (!source.TPAllow && !args.Player.Group.HasPermission(Permissions.tpoverride))
|
||||||
{
|
{
|
||||||
args.Player.SendErrorMessage("You do not have permission to use this command.");
|
args.Player.SendErrorMessage("{0} has disabled players from teleporting.", source.Name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
args.Player.SendInfoMessage(string.Format("You teleported everyone here."));
|
var target = players2[0];
|
||||||
for (int i = 0; i < Main.maxPlayers; i++)
|
if (!target.TPAllow && !args.Player.Group.HasPermission(Permissions.tpoverride))
|
||||||
{
|
{
|
||||||
if (Main.player[i].active && (Main.player[i] != args.TPlayer))
|
args.Player.SendErrorMessage("{0} has disabled players from teleporting.", target.Name);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
args.Player.SendSuccessMessage("Teleported {0} to {1}.", source.Name, target.Name);
|
||||||
|
if (source.Teleport(target.TPlayer.position.X, target.TPlayer.position.Y))
|
||||||
|
{
|
||||||
|
if (args.Player != source)
|
||||||
{
|
{
|
||||||
if (TShock.Players[i].Teleport(args.TPlayer.position.X, args.TPlayer.position.Y))
|
if (args.Player.Group.HasPermission(Permissions.tpsilent))
|
||||||
TShock.Players[i].SendSuccessMessage(String.Format("You were teleported to {0}.", args.Player.Name));
|
source.SendSuccessMessage("You were teleported to {0}.", target.Name);
|
||||||
|
else
|
||||||
|
source.SendSuccessMessage("{0} teleported you to {1}.", args.Player.Name, target.Name);
|
||||||
|
}
|
||||||
|
if (args.Player != target)
|
||||||
|
{
|
||||||
|
if (args.Player.Group.HasPermission(Permissions.tpsilent))
|
||||||
|
target.SendInfoMessage("{0} was teleported to you.", source.Name);
|
||||||
|
if (!args.Player.Group.HasPermission(Permissions.tpsilent))
|
||||||
|
target.SendInfoMessage("{0} teleported {1} to you.", args.Player.Name, source.Name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
args.Player.SendErrorMessage("Invalid player!");
|
|
||||||
}
|
}
|
||||||
else if (players.Count > 1)
|
}
|
||||||
|
|
||||||
|
private static void TPPos(CommandArgs args)
|
||||||
|
{
|
||||||
|
if (args.Parameters.Count != 2)
|
||||||
{
|
{
|
||||||
TShock.Utils.SendMultipleMatchError(args.Player, players.Select(p => p.Name));
|
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /tppos <tile x> <tile y>");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
|
int x, y;
|
||||||
|
if (!int.TryParse(args.Parameters[0], out x) || !int.TryParse(args.Parameters[1], out y))
|
||||||
{
|
{
|
||||||
var plr = players[0];
|
args.Player.SendErrorMessage("Invalid tile positions!");
|
||||||
if (plr.Teleport(args.TPlayer.position.X, args.TPlayer.position.Y))
|
return;
|
||||||
{
|
|
||||||
plr.SendInfoMessage("You were teleported to {0}.", args.Player.Name);
|
|
||||||
args.Player.SendSuccessMessage("You teleported {0} here.", plr.Name);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
x = Math.Max(0, x);
|
||||||
|
y = Math.Max(0, y);
|
||||||
|
x = Math.Min(x, Main.maxTilesX - 1);
|
||||||
|
y = Math.Min(y, Main.maxTilesY - 1);
|
||||||
|
|
||||||
|
args.Player.Teleport(16 * x, 16 * y);
|
||||||
|
args.Player.SendSuccessMessage("Teleported to {0}, {1}!", x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void TPAllow(CommandArgs args)
|
private static void TPAllow(CommandArgs args)
|
||||||
|
|
@ -2136,7 +2132,7 @@ namespace TShockAPI
|
||||||
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /warp hide [name] <true/false>");
|
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /warp hide [name] <true/false>");
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
else if (args.Parameters[0].ToLower() == "send" && args.Player.Group.HasPermission(Permissions.tphere))
|
else if (args.Parameters[0].ToLower() == "send" && args.Player.Group.HasPermission(Permissions.tpothers))
|
||||||
{
|
{
|
||||||
#region Warp send
|
#region Warp send
|
||||||
if (args.Parameters.Count < 3)
|
if (args.Parameters.Count < 3)
|
||||||
|
|
@ -3033,74 +3029,54 @@ namespace TShockAPI
|
||||||
|
|
||||||
private static void MaxSpawns(CommandArgs args)
|
private static void MaxSpawns(CommandArgs args)
|
||||||
{
|
{
|
||||||
if (args.Parameters.Count != 1)
|
if (args.Parameters.Count == 0)
|
||||||
{
|
{
|
||||||
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /maxspawns <maxspawns>");
|
args.Player.SendInfoMessage("Current maximum spawns: {0}", TShock.Config.DefaultMaximumSpawns);
|
||||||
args.Player.SendErrorMessage("Proper syntax: /maxspawns show");
|
|
||||||
args.Player.SendErrorMessage("Proper syntax: /maxspawns default");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.Parameters[0] == "show")
|
if (String.Equals(args.Parameters[0], "default", StringComparison.CurrentCultureIgnoreCase))
|
||||||
{
|
{
|
||||||
args.Player.SendInfoMessage("Current maximum spawns is " + TShock.Config.DefaultMaximumSpawns + ".");
|
TShock.Config.DefaultMaximumSpawns = NPC.defaultMaxSpawns = 600;
|
||||||
return;
|
TSPlayer.All.SendInfoMessage("{0} changed the maximum spawns to 600.", args.Player.Name);
|
||||||
}
|
|
||||||
|
|
||||||
if(args.Parameters[0]=="default"){
|
|
||||||
TShock.Config.DefaultMaximumSpawns = 5;
|
|
||||||
NPC.defaultMaxSpawns = 5;
|
|
||||||
TSPlayer.All.SendInfoMessage(string.Format("{0} changed the maximum spawns to 5.", args.Player.Name));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int amount = Convert.ToInt32(args.Parameters[0]);
|
int maxSpawns = -1;
|
||||||
int.TryParse(args.Parameters[0], out amount);
|
if (!int.TryParse(args.Parameters[0], out maxSpawns) || maxSpawns < 0 || maxSpawns > Main.maxNPCs)
|
||||||
NPC.defaultMaxSpawns = amount;
|
{
|
||||||
TShock.Config.DefaultMaximumSpawns = amount;
|
args.Player.SendWarningMessage("Invalid maximum spawns!");
|
||||||
TSPlayer.All.SendInfoMessage(string.Format("{0} changed the maximum spawns to {1}.", args.Player.Name, amount));
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
TShock.Config.DefaultMaximumSpawns = NPC.defaultMaxSpawns = maxSpawns;
|
||||||
|
TSPlayer.All.SendInfoMessage("{0} changed the maximum spawns to {1}.", args.Player.Name, maxSpawns);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void SpawnRate(CommandArgs args)
|
private static void SpawnRate(CommandArgs args)
|
||||||
{
|
{
|
||||||
if (args.Parameters.Count != 1)
|
if (args.Parameters.Count == 0)
|
||||||
{
|
{
|
||||||
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /spawnrate <spawnrate>");
|
args.Player.SendInfoMessage("Current spawn rate: {0}", TShock.Config.DefaultSpawnRate);
|
||||||
args.Player.SendErrorMessage("/spawnrate show");
|
|
||||||
args.Player.SendErrorMessage("/spawnrate default");
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.Parameters[0] == "show")
|
if (String.Equals(args.Parameters[0], "default", StringComparison.CurrentCultureIgnoreCase))
|
||||||
{
|
{
|
||||||
args.Player.SendInfoMessage("Current spawn rate is " + TShock.Config.DefaultSpawnRate + ".");
|
TShock.Config.DefaultSpawnRate = NPC.defaultSpawnRate = 600;
|
||||||
|
TSPlayer.All.SendInfoMessage("{0} changed the spawn rate to 600.", args.Player.Name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (args.Parameters[0] == "default")
|
int spawnRate = -1;
|
||||||
|
if (!int.TryParse(args.Parameters[0], out spawnRate) || spawnRate < 0)
|
||||||
{
|
{
|
||||||
TShock.Config.DefaultSpawnRate = 600;
|
args.Player.SendWarningMessage("Invalid spawn rate!");
|
||||||
NPC.defaultSpawnRate = 600;
|
|
||||||
TSPlayer.All.SendInfoMessage(string.Format("{0} changed the spawn rate to 600.", args.Player.Name));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int amount = -1;
|
TShock.Config.DefaultSpawnRate = NPC.defaultSpawnRate = spawnRate;
|
||||||
if (!int.TryParse(args.Parameters[0], out amount))
|
TSPlayer.All.SendInfoMessage("{0} changed the spawn rate to {1}.", args.Player.Name, spawnRate);
|
||||||
{
|
|
||||||
args.Player.SendWarningMessage(string.Format("Invalid spawnrate ({0})", args.Parameters[0]));
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (amount < 0)
|
|
||||||
{
|
|
||||||
args.Player.SendWarningMessage("Spawnrate cannot be negative!");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
NPC.defaultSpawnRate = amount;
|
|
||||||
TShock.Config.DefaultSpawnRate = amount;
|
|
||||||
TSPlayer.All.SendInfoMessage(string.Format("{0} changed the spawn rate to {1}.", args.Player.Name, amount));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion Server Config Commands
|
#endregion Server Config Commands
|
||||||
|
|
@ -3109,36 +3085,60 @@ namespace TShockAPI
|
||||||
|
|
||||||
private static void Time(CommandArgs args)
|
private static void Time(CommandArgs args)
|
||||||
{
|
{
|
||||||
if (args.Parameters.Count != 1)
|
if (args.Parameters.Count == 0)
|
||||||
{
|
{
|
||||||
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /time <day/night/dusk/noon/midnight>");
|
double time = Main.time / 3600.0;
|
||||||
|
time += 4.5;
|
||||||
|
if (!Main.dayTime)
|
||||||
|
time += 15.0;
|
||||||
|
args.Player.SendInfoMessage("The current time is {0}:{1:D2}.", (int)Math.Floor(time), (int)Math.Round((time % 1.0) * 30.0));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (args.Parameters[0].ToLower())
|
switch (args.Parameters[0].ToLower())
|
||||||
{
|
{
|
||||||
case "day":
|
case "day":
|
||||||
TSPlayer.Server.SetTime(true, 150.0);
|
TSPlayer.Server.SetTime(true, 0.0);
|
||||||
TSPlayer.All.SendInfoMessage("{0} set the time to day.", args.Player.Name);
|
TSPlayer.All.SendInfoMessage("{0} set the time to 4:30.", args.Player.Name);
|
||||||
break;
|
break;
|
||||||
case "night":
|
case "night":
|
||||||
TSPlayer.Server.SetTime(false, 0.0);
|
TSPlayer.Server.SetTime(false, 0.0);
|
||||||
TSPlayer.All.SendInfoMessage("{0} set the time to night.", args.Player.Name);
|
TSPlayer.All.SendInfoMessage("{0} set the time to 19:30.", args.Player.Name);
|
||||||
break;
|
|
||||||
case "dusk":
|
|
||||||
TSPlayer.Server.SetTime(false, 0.0);
|
|
||||||
TSPlayer.All.SendInfoMessage("{0} set the time to dusk.", args.Player.Name);
|
|
||||||
break;
|
break;
|
||||||
case "noon":
|
case "noon":
|
||||||
TSPlayer.Server.SetTime(true, 27000.0);
|
TSPlayer.Server.SetTime(true, 27000.0);
|
||||||
TSPlayer.All.SendInfoMessage("{0} set the time to noon.", args.Player.Name);
|
TSPlayer.All.SendInfoMessage("{0} set the time to 12:00.", args.Player.Name);
|
||||||
break;
|
break;
|
||||||
case "midnight":
|
case "midnight":
|
||||||
TSPlayer.Server.SetTime(false, 16200.0);
|
TSPlayer.Server.SetTime(false, 16200.0);
|
||||||
TSPlayer.All.SendInfoMessage("{0} set the time to midnight.", args.Player.Name);
|
TSPlayer.All.SendInfoMessage("{0} set the time to 0:00.", args.Player.Name);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
args.Player.SendErrorMessage("Invalid syntax! Proper syntax: /time <day/night/dusk/noon/midnight>");
|
string[] array = args.Parameters[0].Split(':');
|
||||||
|
if (array.Length != 2)
|
||||||
|
{
|
||||||
|
args.Player.SendErrorMessage("Invalid time string! Proper format: hh:mm, in 24-hour time.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int hours;
|
||||||
|
int minutes;
|
||||||
|
if (!int.TryParse(array[0], out hours) || hours < 0 || hours > 23
|
||||||
|
|| !int.TryParse(array[1], out minutes) || minutes < 0 || minutes > 59)
|
||||||
|
{
|
||||||
|
args.Player.SendErrorMessage("Invalid time string! Proper format: hh:mm, in 24-hour time.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
decimal time = hours + minutes / 60.0m;
|
||||||
|
time -= 4.50m;
|
||||||
|
if (time < 0.00m)
|
||||||
|
time += 24.00m;
|
||||||
|
if (time >= 15.00m)
|
||||||
|
TSPlayer.Server.SetTime(false, (double)((time - 15.00m) * 3600.0m));
|
||||||
|
else
|
||||||
|
TSPlayer.Server.SetTime(true, (double)(time * 3600.0m));
|
||||||
|
TSPlayer.All.SendInfoMessage("{0} set the time to {1}:{2:D2}.", args.Player.Name, hours, minutes);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -4353,7 +4353,7 @@ namespace TShockAPI
|
||||||
|
|
||||||
if (args.Parameters.Count == 1)
|
if (args.Parameters.Count == 1)
|
||||||
{
|
{
|
||||||
List<NPC> npcs = TShock.Utils.GetNPCByIdOrName(args.Parameters[0]);
|
var npcs = TShock.Utils.GetNPCByIdOrName(args.Parameters[0]);
|
||||||
if (npcs.Count == 0)
|
if (npcs.Count == 0)
|
||||||
{
|
{
|
||||||
args.Player.SendErrorMessage("Invalid mob type!");
|
args.Player.SendErrorMessage("Invalid mob type!");
|
||||||
|
|
|
||||||
|
|
@ -31,264 +31,354 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
[Description(
|
[Description(
|
||||||
"The equation for calculating invasion size is 100 + (multiplier * (number of active players with greater than 200 health))."
|
"The equation for calculating invasion size is 100 + (multiplier * (number of active players with greater than 200 health))."
|
||||||
)] public int InvasionMultiplier = 1;
|
)]
|
||||||
|
public int InvasionMultiplier = 1;
|
||||||
|
|
||||||
[Description("The default maximum mobs that will spawn per wave. Higher means more mobs in that wave.")] public int
|
[Description("The default maximum mobs that will spawn per wave. Higher means more mobs in that wave.")]
|
||||||
DefaultMaximumSpawns = 5;
|
public int DefaultMaximumSpawns = 5;
|
||||||
|
|
||||||
[Description("The delay between waves. Lower values lead to more mobs.")] public int DefaultSpawnRate = 600;
|
[Description("The delay between waves. Lower values lead to more mobs.")]
|
||||||
[Description("The port the server runs on.")] public int ServerPort = 7777;
|
public int DefaultSpawnRate = 600;
|
||||||
[Description("Enable or disable the whitelist based on IP addresses in whitelist.txt")] public bool EnableWhitelist;
|
[Description("The port the server runs on.")]
|
||||||
|
public int ServerPort = 7777;
|
||||||
|
[Description("Enable or disable the whitelist based on IP addresses in whitelist.txt")]
|
||||||
|
public bool EnableWhitelist;
|
||||||
|
|
||||||
[Description(
|
[Description(
|
||||||
"Enable the ability for invasion size to never decrease. Make sure to run /invade, and note that this adds 2 million+ goblins to the spawn queue for the map."
|
"Enable the ability for invasion size to never decrease. Make sure to run /invade, and note that this adds 2 million+ goblins to the spawn queue for the map."
|
||||||
)] public bool InfiniteInvasion;
|
)]
|
||||||
|
public bool InfiniteInvasion;
|
||||||
|
|
||||||
[Description("Set the server pvp mode. Valid types are, \"normal\", \"always\", and \"disabled.\"")] public string PvPMode
|
[Description("Set the server pvp mode. Valid types are, \"normal\", \"always\", and \"disabled.\"")]
|
||||||
|
public string PvPMode
|
||||||
= "normal";
|
= "normal";
|
||||||
|
|
||||||
[Description("Prevents tiles from being placed within SpawnProtectionRadius of the default spawn.")] public bool
|
[Description("Prevents tiles from being placed within SpawnProtectionRadius of the default spawn.")]
|
||||||
SpawnProtection = true;
|
public bool SpawnProtection = true;
|
||||||
|
|
||||||
[Description("Radius from spawn tile for SpawnProtection.")] public int SpawnProtectionRadius = 10;
|
[Description("Radius from spawn tile for SpawnProtection.")]
|
||||||
|
public int SpawnProtectionRadius = 10;
|
||||||
|
|
||||||
[Description(
|
[Description(
|
||||||
"Max slots for the server. If you want people to be kicked with \"Server is full\" set this to how many players you want max and then set Terraria max players to 2 higher."
|
"Max slots for the server. If you want people to be kicked with \"Server is full\" set this to how many players you want max and then set Terraria max players to 2 higher."
|
||||||
)] public int MaxSlots = 8;
|
)]
|
||||||
|
public int MaxSlots = 8;
|
||||||
|
|
||||||
[Description("Global protection agent for any block distance based anti-grief check.")] public bool RangeChecks = true;
|
[Description("Global protection agent for any block distance based anti-grief check.")]
|
||||||
[Description("Disables any building; placing of blocks")] public bool DisableBuild;
|
public bool RangeChecks = true;
|
||||||
|
[Description("Disables any building; placing of blocks")]
|
||||||
|
public bool DisableBuild;
|
||||||
|
|
||||||
[Description("#.#.#. = Red/Blue/Green - RGB Colors for the Admin Chat Color. Max value: 255")] public float[]
|
[Description("#.#.#. = Red/Blue/Green - RGB Colors for the Admin Chat Color. Max value: 255")]
|
||||||
SuperAdminChatRGB = {255, 0, 0};
|
public float[] SuperAdminChatRGB = { 255, 0, 0 };
|
||||||
|
|
||||||
[Description("Super admin group chat prefix")] public string SuperAdminChatPrefix = "(Admin) ";
|
[Description("Super admin group chat prefix")]
|
||||||
[Description("Super admin group chat suffix")] public string SuperAdminChatSuffix = "";
|
public string SuperAdminChatPrefix = "(Admin) ";
|
||||||
|
[Description("Super admin group chat suffix")]
|
||||||
|
public string SuperAdminChatSuffix = "";
|
||||||
|
|
||||||
[Description(
|
[Description(
|
||||||
"Backup frequency in minutes. So, a value of 60 = 60 minutes. Backups are stored in the \\tshock\\backups folder.")] public int BackupInterval;
|
"Backup frequency in minutes. So, a value of 60 = 60 minutes. Backups are stored in the \\tshock\\backups folder.")]
|
||||||
|
public int BackupInterval;
|
||||||
|
|
||||||
[Description("How long backups are kept in minutes. 2880 = 2 days.")] public int BackupKeepFor = 60;
|
[Description("How long backups are kept in minutes. 2880 = 2 days.")]
|
||||||
|
public int BackupKeepFor = 60;
|
||||||
|
|
||||||
[Description(
|
[Description(
|
||||||
"Remembers where a player left off. It works by remembering the IP, NOT the character. \neg. When you try to disconnect, and reconnect to be automatically placed at spawn, you'll be at your last location. Note: Won't save after server restarts."
|
"Remembers where a player left off. It works by remembering the IP, NOT the character. \neg. When you try to disconnect, and reconnect to be automatically placed at spawn, you'll be at your last location. Note: Won't save after server restarts."
|
||||||
)] public bool RememberLeavePos;
|
)]
|
||||||
|
public bool RememberLeavePos;
|
||||||
|
|
||||||
[Description("Hardcore players ONLY. This means softcore players cannot join.")] public bool HardcoreOnly;
|
[Description("Hardcore players ONLY. This means softcore players cannot join.")]
|
||||||
[Description("Mediumcore players ONLY. This means softcore players cannot join.")] public bool MediumcoreOnly;
|
public bool HardcoreOnly;
|
||||||
[Description("Kicks a hardcore player on death.")] public bool KickOnMediumcoreDeath;
|
[Description("Mediumcore players ONLY. This means softcore players cannot join.")]
|
||||||
[Description("Bans a hardcore player on death.")] public bool BanOnMediumcoreDeath;
|
public bool MediumcoreOnly;
|
||||||
|
[Description("Kicks a hardcore player on death.")]
|
||||||
|
public bool KickOnMediumcoreDeath;
|
||||||
|
[Description("Bans a hardcore player on death.")]
|
||||||
|
public bool BanOnMediumcoreDeath;
|
||||||
|
|
||||||
[Description("Enable/disable Terraria's built in auto save.")] public bool AutoSave = true;
|
[Description("Enable/disable Terraria's built in auto save.")]
|
||||||
[Description("Enable/disable save announcements.")] public bool AnnounceSave = true;
|
public bool AutoSave = true;
|
||||||
|
[Description("Enable/disable save announcements.")]
|
||||||
|
public bool AnnounceSave = true;
|
||||||
|
|
||||||
[Description("Number of failed login attempts before kicking the player.")] public int MaximumLoginAttempts = 3;
|
[Description("Number of failed login attempts before kicking the player.")]
|
||||||
|
public int MaximumLoginAttempts = 3;
|
||||||
|
|
||||||
[Description("Not implemented.")] public string RconPassword = "";
|
[Description("Not implemented.")]
|
||||||
[Description("Not implemented.")] public int RconPort = 7777;
|
public string RconPassword = "";
|
||||||
|
[Description("Not implemented.")]
|
||||||
|
public int RconPort = 7777;
|
||||||
|
|
||||||
[Description("Used when replying to a rest /status request or sent to the client when UseServerName is true.")] public string ServerName = "";
|
[Description("Used when replying to a rest /status request or sent to the client when UseServerName is true.")]
|
||||||
[Description("Sends ServerName in place of the world name to clients.")] public bool UseServerName = false;
|
public string ServerName = "";
|
||||||
[Description("Not implemented.")] public string MasterServer = "127.0.0.1";
|
[Description("Sends ServerName in place of the world name to clients.")]
|
||||||
|
public bool UseServerName = false;
|
||||||
|
[Description("Not implemented.")]
|
||||||
|
public string MasterServer = "127.0.0.1";
|
||||||
|
|
||||||
[Description("Valid types are \"sqlite\" and \"mysql\"")] public string StorageType = "sqlite";
|
[Description("Valid types are \"sqlite\" and \"mysql\"")]
|
||||||
|
public string StorageType = "sqlite";
|
||||||
|
|
||||||
[Description("The MySQL hostname and port to direct connections to")] public string MySqlHost = "localhost:3306";
|
[Description("The MySQL hostname and port to direct connections to")]
|
||||||
[Description("Database name to connect to")] public string MySqlDbName = "";
|
public string MySqlHost = "localhost:3306";
|
||||||
[Description("Database username to connect with")] public string MySqlUsername = "";
|
[Description("Database name to connect to")]
|
||||||
[Description("Database password to connect with")] public string MySqlPassword = "";
|
public string MySqlDbName = "";
|
||||||
|
[Description("Database username to connect with")]
|
||||||
|
public string MySqlUsername = "";
|
||||||
|
[Description("Database password to connect with")]
|
||||||
|
public string MySqlPassword = "";
|
||||||
|
|
||||||
[Description("Bans a mediumcore player on death.")] public string MediumcoreBanReason = "Death results in a ban";
|
[Description("Bans a mediumcore player on death.")]
|
||||||
[Description("Kicks a mediumcore player on death.")] public string MediumcoreKickReason = "Death results in a kick";
|
public string MediumcoreBanReason = "Death results in a ban";
|
||||||
|
[Description("Kicks a mediumcore player on death.")]
|
||||||
|
public string MediumcoreKickReason = "Death results in a kick";
|
||||||
|
|
||||||
[Description("Enables DNS resolution of incoming connections with GetGroupForIPExpensive.")] public bool
|
[Description("Enables DNS resolution of incoming connections with GetGroupForIPExpensive.")]
|
||||||
EnableDNSHostResolution;
|
public bool EnableDNSHostResolution;
|
||||||
|
|
||||||
[Description("Enables kicking of banned users by matching their IP Address.")] public bool EnableIPBans = true;
|
[Description("Enables kicking of banned users by matching their IP Address.")]
|
||||||
|
public bool EnableIPBans = true;
|
||||||
|
|
||||||
[Description("Enables kicking of banned users by matching their client UUID.")] public bool EnableUUIDBans = true;
|
[Description("Enables kicking of banned users by matching their client UUID.")]
|
||||||
|
public bool EnableUUIDBans = true;
|
||||||
|
|
||||||
[Description("Enables kicking of banned users by matching their Character Name.")] public bool EnableBanOnUsernames;
|
[Description("Enables kicking of banned users by matching their Character Name.")]
|
||||||
|
public bool EnableBanOnUsernames;
|
||||||
|
|
||||||
[Description("Selects the default group name to place new registrants under.")] public string
|
[Description("Selects the default group name to place new registrants under.")]
|
||||||
DefaultRegistrationGroupName = "default";
|
public string DefaultRegistrationGroupName = "default";
|
||||||
|
|
||||||
[Description("Selects the default group name to place non registered users under")] public string
|
[Description("Selects the default group name to place non registered users under")]
|
||||||
DefaultGuestGroupName = "guest";
|
public string DefaultGuestGroupName = "guest";
|
||||||
|
|
||||||
[Description("Force-disable printing logs to players with the log permission.")] public bool DisableSpewLogs = true;
|
[Description("Force-disable printing logs to players with the log permission.")]
|
||||||
|
public bool DisableSpewLogs = true;
|
||||||
|
|
||||||
[Description("Valid types are \"sha512\", \"sha256\", \"md5\", append with \"-xp\" for the xp supported algorithms.")] public string HashAlgorithm = "sha512";
|
[Description("Valid types are \"sha512\", \"sha256\", \"md5\", append with \"-xp\" for the xp supported algorithms.")]
|
||||||
|
public string HashAlgorithm = "sha512";
|
||||||
|
|
||||||
[Description("Buffers up the packets and sends them out at the end of each frame.")] public bool BufferPackets = true;
|
[Description("Buffers up the packets and sends them out at the end of each frame.")]
|
||||||
|
public bool BufferPackets = true;
|
||||||
|
|
||||||
[Description("String that is used when kicking people when the server is full.")] public string ServerFullReason =
|
[Description("String that is used when kicking people when the server is full.")]
|
||||||
"Server is full";
|
public string ServerFullReason = "Server is full";
|
||||||
|
|
||||||
[Description("String that is used when a user is kicked due to not being on the whitelist.")] public string WhitelistKickReason = "You are not on the whitelist.";
|
[Description("String that is used when a user is kicked due to not being on the whitelist.")]
|
||||||
|
public string WhitelistKickReason = "You are not on the whitelist.";
|
||||||
|
|
||||||
[Description("String that is used when kicking people when the server is full with no reserved slots.")] public string
|
[Description("String that is used when kicking people when the server is full with no reserved slots.")]
|
||||||
ServerFullNoReservedReason = "Server is full. No reserved slots open.";
|
public string ServerFullNoReservedReason = "Server is full. No reserved slots open.";
|
||||||
|
|
||||||
[Description("This will save the world if Terraria crashes from an unhandled exception.")] public bool
|
[Description("This will save the world if Terraria crashes from an unhandled exception.")]
|
||||||
SaveWorldOnCrash = true;
|
public bool SaveWorldOnCrash = true;
|
||||||
|
|
||||||
[Description("This will announce a player's location on join")] public bool EnableGeoIP;
|
[Description("This will announce a player's location on join")]
|
||||||
|
public bool EnableGeoIP;
|
||||||
|
|
||||||
[Description("This will turn on token requirement for the public REST API endpoints.")] public bool
|
[Description("This will turn on token requirement for the public REST API endpoints.")]
|
||||||
EnableTokenEndpointAuthentication;
|
public bool EnableTokenEndpointAuthentication;
|
||||||
|
|
||||||
[Description("Enable/disable the rest api.")] public bool RestApiEnabled;
|
[Description("Enable/disable the rest api.")]
|
||||||
|
public bool RestApiEnabled;
|
||||||
|
|
||||||
[Description("This is the port which the rest api will listen on.")] public int RestApiPort = 7878;
|
[Description("This is the port which the rest api will listen on.")]
|
||||||
|
public int RestApiPort = 7878;
|
||||||
|
|
||||||
[Description("Disable tombstones for all players.")] public bool DisableTombstones = true;
|
[Description("Disable tombstones for all players.")]
|
||||||
|
public bool DisableTombstones = true;
|
||||||
|
|
||||||
[Description("Displays a player's IP on join to everyone who has the log permission.")] public bool DisplayIPToAdmins;
|
[Description("Displays a player's IP on join to everyone who has the log permission.")]
|
||||||
|
public bool DisplayIPToAdmins;
|
||||||
|
|
||||||
[Description("Kicks users using a proxy as identified with the GeoIP database.")] public bool KickProxyUsers = true;
|
[Description("Kicks users using a proxy as identified with the GeoIP database.")]
|
||||||
|
public bool KickProxyUsers = true;
|
||||||
|
|
||||||
[Description("Disables hardmode, can't never be activated. Overrides /starthardmode.")] public bool DisableHardmode;
|
[Description("Disables hardmode, can't never be activated. Overrides /starthardmode.")]
|
||||||
|
public bool DisableHardmode;
|
||||||
|
|
||||||
[Description("Disables the dungeon guardian from being spawned by player packets, this will instead force a respawn.")] public bool DisableDungeonGuardian;
|
[Description("Disables the dungeon guardian from being spawned by player packets, this will instead force a respawn.")]
|
||||||
|
public bool DisableDungeonGuardian;
|
||||||
|
|
||||||
[Description("Enable server side characters, This stops the client from saving character data! EXPERIMENTAL!!!!!")] public bool ServerSideCharacter;
|
[Description("Enable server side characters, This stops the client from saving character data! EXPERIMENTAL!!!!!")]
|
||||||
|
public bool ServerSideCharacter;
|
||||||
|
|
||||||
[Description("How often SSC should save, in minutes.")] public int ServerSideCharacterSave = 5;
|
[Description("How often SSC should save, in minutes.")]
|
||||||
|
public int ServerSideCharacterSave = 5;
|
||||||
|
|
||||||
[Description("Time, in milliseconds, to disallow discarding items after logging in when ServerSideInventory is ON.")] public int LogonDiscardThreshold=250;
|
[Description("Time, in milliseconds, to disallow discarding items after logging in when ServerSideInventory is ON.")]
|
||||||
|
public int LogonDiscardThreshold = 250;
|
||||||
[Description("Disables clown bomb projectiles from spawning.")] public bool DisableClownBombs;
|
|
||||||
|
|
||||||
[Description("Disables snow ball projectiles from spawning.")] public bool DisableSnowBalls;
|
[Description("Disables clown bomb projectiles from spawning.")]
|
||||||
|
public bool DisableClownBombs;
|
||||||
|
|
||||||
|
[Description("Disables snow ball projectiles from spawning.")]
|
||||||
|
public bool DisableSnowBalls;
|
||||||
|
|
||||||
[Description(
|
[Description(
|
||||||
"Changes ingame chat format: {0} = Group Name, {1} = Group Prefix, {2} = Player Name, {3} = Group Suffix, {4} = Chat Message"
|
"Changes ingame chat format: {0} = Group Name, {1} = Group Prefix, {2} = Player Name, {3} = Group Suffix, {4} = Chat Message"
|
||||||
)] public string ChatFormat = "{1}{2}{3}: {4}";
|
)]
|
||||||
|
public string ChatFormat = "{1}{2}{3}: {4}";
|
||||||
|
|
||||||
[Description("Change the player name when using chat above heads. This begins with a player name wrapped in brackets, as per Terraria's formatting. Same formatting as ChatFormat(minus the text aka {4}).")] public string ChatAboveHeadsFormat = "{2}";
|
[Description("Change the player name when using chat above heads. This begins with a player name wrapped in brackets, as per Terraria's formatting. Same formatting as ChatFormat(minus the text aka {4}).")]
|
||||||
|
public string ChatAboveHeadsFormat = "{2}";
|
||||||
|
|
||||||
[Description("Force the world time to be normal, day, or night.")] public string ForceTime = "normal";
|
[Description("Force the world time to be normal, day, or night.")]
|
||||||
|
public string ForceTime = "normal";
|
||||||
|
|
||||||
[Description("Disables/reverts a player if this number of tile kills is exceeded within 1 second.")] public int
|
[Description("Disables/reverts a player if this number of tile kills is exceeded within 1 second.")]
|
||||||
TileKillThreshold = 60;
|
public int TileKillThreshold = 60;
|
||||||
|
|
||||||
[Description("Disables/reverts a player if this number of tile places is exceeded within 1 second.")]
|
[Description("Disables/reverts a player if this number of tile places is exceeded within 1 second.")]
|
||||||
public int
|
public int TilePlaceThreshold = 20;
|
||||||
TilePlaceThreshold = 20;
|
|
||||||
|
|
||||||
[Description("Disables a player if this number of liquid sets is exceeded within 1 second.")] public int
|
[Description("Disables a player if this number of liquid sets is exceeded within 1 second.")]
|
||||||
TileLiquidThreshold = 15;
|
public int TileLiquidThreshold = 15;
|
||||||
|
|
||||||
[Description("Disable a player if this number of projectiles is created within 1 second.")]
|
[Description("Disable a player if this number of projectiles is created within 1 second.")]
|
||||||
public int
|
public int ProjectileThreshold = 50;
|
||||||
ProjectileThreshold = 50;
|
|
||||||
|
|
||||||
[Description("Ignore shrapnel from crystal bullets for projectile threshold.")] public bool
|
[Description("Ignore shrapnel from crystal bullets for projectile threshold.")]
|
||||||
ProjIgnoreShrapnel = true;
|
public bool ProjIgnoreShrapnel = true;
|
||||||
|
|
||||||
[Description("Requires all players to register or login before being allowed to play.")] public bool RequireLogin;
|
[Description("Requires all players to register or login before being allowed to play.")]
|
||||||
|
public bool RequireLogin;
|
||||||
|
|
||||||
[Description(
|
[Description(
|
||||||
"Disables invisibility potions from being used in PvP (Note, can be used in the client, but the effect isn't sent to the rest of the server)."
|
"Disables invisibility potions from being used in PvP (Note, can be used in the client, but the effect isn't sent to the rest of the server)."
|
||||||
)] public bool DisableInvisPvP;
|
)]
|
||||||
|
public bool DisableInvisPvP;
|
||||||
|
|
||||||
[Description("The maximum distance players disabled for various reasons can move from.")] public int
|
[Description("The maximum distance players disabled for various reasons can move from.")]
|
||||||
MaxRangeForDisabled = 10;
|
public int MaxRangeForDisabled = 10;
|
||||||
|
|
||||||
[Description("Server password required to join the server.")] public string ServerPassword = "";
|
[Description("Server password required to join the server.")]
|
||||||
|
public string ServerPassword = "";
|
||||||
|
|
||||||
[Description("Protect chests with region and build permissions.")] public bool RegionProtectChests;
|
[Description("Protect chests with region and build permissions.")]
|
||||||
|
public bool RegionProtectChests;
|
||||||
|
|
||||||
[Description("Disable users from being able to login with account password when joining.")] public bool
|
[Description("Disable users from being able to login with account password when joining.")]
|
||||||
DisableLoginBeforeJoin;
|
public bool DisableLoginBeforeJoin;
|
||||||
|
|
||||||
[Description("Disable users from being able to login with their client UUID.")] public bool DisableUUIDLogin;
|
[Description("Disable users from being able to login with their client UUID.")]
|
||||||
|
public bool DisableUUIDLogin;
|
||||||
|
|
||||||
[Description("Kick clients that don't send a UUID to the server.")] public bool KickEmptyUUID;
|
[Description("Kick clients that don't send a UUID to the server.")]
|
||||||
|
public bool KickEmptyUUID;
|
||||||
[Description("Allows users to register any username with /register.")] public bool AllowRegisterAnyUsername;
|
|
||||||
|
|
||||||
[Description("Allows users to login with any username with /login.")] public bool AllowLoginAnyUsername = true;
|
[Description("Allows users to register any username with /register.")]
|
||||||
|
public bool AllowRegisterAnyUsername;
|
||||||
|
|
||||||
[Description("The maximum damage a player/npc can inflict.")] public int MaxDamage = 175;
|
[Description("Allows users to login with any username with /login.")]
|
||||||
|
public bool AllowLoginAnyUsername = true;
|
||||||
[Description("The maximum damage a projectile can inflict.")] public int MaxProjDamage = 175;
|
|
||||||
|
|
||||||
[Description("Ignores checking to see if player 'can' update a projectile.")] public bool IgnoreProjUpdate = false;
|
[Description("The maximum damage a player/npc can inflict.")]
|
||||||
|
public int MaxDamage = 175;
|
||||||
[Description("Ignores checking to see if player 'can' kill a projectile.")] public bool IgnoreProjKill = false;
|
|
||||||
|
|
||||||
[Description("Ignores all no clip checks for players.")] public bool IgnoreNoClip = false;
|
[Description("The maximum damage a projectile can inflict.")]
|
||||||
|
public int MaxProjDamage = 175;
|
||||||
|
|
||||||
[Description("Allow ice placement even when user does not have canbuild.")] public bool AllowIce = false;
|
[Description("Ignores checking to see if player 'can' update a projectile.")]
|
||||||
|
public bool IgnoreProjUpdate = false;
|
||||||
|
|
||||||
|
[Description("Ignores checking to see if player 'can' kill a projectile.")]
|
||||||
|
public bool IgnoreProjKill = false;
|
||||||
|
|
||||||
|
[Description("Ignores all no clip checks for players.")]
|
||||||
|
public bool IgnoreNoClip = false;
|
||||||
|
|
||||||
|
[Description("Allow ice placement even when user does not have canbuild.")]
|
||||||
|
public bool AllowIce = false;
|
||||||
|
|
||||||
[Description("Allows crimson to spread when a world is hardmode.")]
|
[Description("Allows crimson to spread when a world is hardmode.")]
|
||||||
public bool AllowCrimsonCreep = true;
|
public bool AllowCrimsonCreep = true;
|
||||||
|
|
||||||
[Description("Allows corruption to spread when a world is hardmode.")] public bool AllowCorruptionCreep = true;
|
[Description("Allows corruption to spread when a world is hardmode.")]
|
||||||
|
public bool AllowCorruptionCreep = true;
|
||||||
|
|
||||||
[Description("Allows hallow to spread when a world is hardmode.")] public bool AllowHallowCreep = true;
|
[Description("Allows hallow to spread when a world is hardmode.")]
|
||||||
|
public bool AllowHallowCreep = true;
|
||||||
|
|
||||||
[Description("How many things a statue can spawn within 200 pixels(?) before it stops spawning. Default = 3")] public int StatueSpawn200 = 3;
|
[Description("How many things a statue can spawn within 200 pixels(?) before it stops spawning. Default = 3")]
|
||||||
|
public int StatueSpawn200 = 3;
|
||||||
|
|
||||||
[Description("How many things a statue can spawn within 600 pixels(?) before it stops spawning. Default = 6")] public int StatueSpawn600 = 6;
|
[Description("How many things a statue can spawn within 600 pixels(?) before it stops spawning. Default = 6")]
|
||||||
|
public int StatueSpawn600 = 6;
|
||||||
|
|
||||||
[Description("How many things a statue spawns can exist in the world before it stops spawning. Default = 10")] public int StatueSpawnWorld = 10;
|
[Description("How many things a statue spawns can exist in the world before it stops spawning. Default = 10")]
|
||||||
|
public int StatueSpawnWorld = 10;
|
||||||
|
|
||||||
[Description("Prevent banned items from being /i or /give.")] public bool PreventBannedItemSpawn = false;
|
[Description("Prevent banned items from being /i or /give.")]
|
||||||
|
public bool PreventBannedItemSpawn = false;
|
||||||
|
|
||||||
[Description("Prevent players from interacting with the world if dead.")] public bool PreventDeadModification =
|
[Description("Prevent players from interacting with the world if dead.")]
|
||||||
true;
|
public bool PreventDeadModification = true;
|
||||||
|
|
||||||
[Description("Displays chat messages above players' heads, but will disable chat prefixes to compensate.")] public
|
[Description("Displays chat messages above players' heads, but will disable chat prefixes to compensate.")]
|
||||||
bool EnableChatAboveHeads = false;
|
public bool EnableChatAboveHeads = false;
|
||||||
|
|
||||||
[Description("Force Christmas only events to occur all year.")] public bool ForceXmas = false;
|
[Description("Force Christmas-only events to occur all year.")]
|
||||||
|
public bool ForceXmas = false;
|
||||||
|
|
||||||
[Description("Allows groups on the banned item allowed list to spawn banned items.")] public bool AllowAllowedGroupsToSpawnBannedItems = false;
|
[Description("Allows groups on the banned item allowed list to spawn banned items.")]
|
||||||
|
public bool AllowAllowedGroupsToSpawnBannedItems = false;
|
||||||
|
|
||||||
[Description("Allows stacks in chests to be beyond the stack limit")] public bool IgnoreChestStacksOnLoad = false;
|
[Description("Allows stacks in chests to be beyond the stack limit")]
|
||||||
|
public bool IgnoreChestStacksOnLoad = false;
|
||||||
|
|
||||||
[Description("The path of the directory where logs should be written into.")] public string LogPath = "tshock";
|
[Description("The path of the directory where logs should be written into.")]
|
||||||
|
public string LogPath = "tshock";
|
||||||
|
|
||||||
[Description("Prevents players from placing tiles with an invalid style.")] public bool PreventInvalidPlaceStyle = true;
|
[Description("Prevents players from placing tiles with an invalid style.")]
|
||||||
|
public bool PreventInvalidPlaceStyle = true;
|
||||||
|
|
||||||
[Description("#.#.#. = Red/Blue/Green - RGB Colors for broadcasts. Max value: 255.")] public float[] BroadcastRGB =
|
[Description("#.#.#. = Red/Blue/Green - RGB Colors for broadcasts. Max value: 255.")]
|
||||||
{127,255,212};
|
public float[] BroadcastRGB = { 127, 255, 212 };
|
||||||
|
|
||||||
// TODO: Get rid of this when the old REST permission model is removed.
|
// TODO: Get rid of this when the old REST permission model is removed.
|
||||||
[Description(
|
[Description(
|
||||||
"Whether the REST API should use the new permission model. Note: The old permission model will become depracted in the future."
|
"Whether the REST API should use the new permission model. Note: The old permission model will become depracted in the future."
|
||||||
)] public bool RestUseNewPermissionModel = true;
|
)]
|
||||||
|
public bool RestUseNewPermissionModel = true;
|
||||||
|
|
||||||
[Description("A dictionary of REST tokens that external applications may use to make queries to your server.")]
|
[Description("A dictionary of REST tokens that external applications may use to make queries to your server.")]
|
||||||
public Dictionary<string, SecureRest.TokenData> ApplicationRestTokens = new Dictionary<string, SecureRest.TokenData>();
|
public Dictionary<string, SecureRest.TokenData> ApplicationRestTokens = new Dictionary<string, SecureRest.TokenData>();
|
||||||
|
|
||||||
[Description("The number of reserved slots past your max server slot that can be joined by reserved players")] public int ReservedSlots = 20;
|
[Description("The number of reserved slots past your max server slot that can be joined by reserved players")]
|
||||||
|
public int ReservedSlots = 20;
|
||||||
[Description("The number of reserved slots past your max server slot that can be joined by reserved players")] public bool LogRest = false;
|
|
||||||
|
|
||||||
[Description("The number of seconds a player must wait before being respawned.")] public int RespawnSeconds = 3;
|
[Description("The number of reserved slots past your max server slot that can be joined by reserved players")]
|
||||||
|
public bool LogRest = false;
|
||||||
|
|
||||||
[Description("Disables a player if this number of tiles is painted within 1 second.")] public int TilePaintThreshold = 15;
|
[Description("The number of seconds a player must wait before being respawned.")]
|
||||||
|
public int RespawnSeconds = 3;
|
||||||
|
|
||||||
[Description("Enables max packet bufferer size.")] public bool EnableMaxBytesInBuffer = false;
|
[Description("Disables a player if this number of tiles is painted within 1 second.")]
|
||||||
|
public int TilePaintThreshold = 15;
|
||||||
|
|
||||||
[Description("Number of bytes in the packet buffer before we disconnect the player.")] public int MaxBytesInBuffer = 5242880;
|
[Description("Enables max packet bufferer size.")]
|
||||||
|
public bool EnableMaxBytesInBuffer = false;
|
||||||
|
|
||||||
[Description("Forces your world to be in Halloween mode regardless of the data.")] public bool ForceHalloween = false;
|
[Description("Number of bytes in the packet buffer before we disconnect the player.")]
|
||||||
|
public int MaxBytesInBuffer = 5242880;
|
||||||
|
|
||||||
[Description("Allows anyone to break grass, pots, etc.")] public bool AllowCutTilesAndBreakables = false;
|
[Description("Forces your world to be in Halloween mode regardless of the data.")]
|
||||||
|
public bool ForceHalloween = false;
|
||||||
|
|
||||||
[Description("Specifies which string starts a command")] public string CommandSpecifier = "/";
|
[Description("Allows anyone to break grass, pots, etc.")]
|
||||||
|
public bool AllowCutTilesAndBreakables = false;
|
||||||
|
|
||||||
|
[Description("Specifies which string starts a command")]
|
||||||
|
public string CommandSpecifier = "/";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reads a configuration file from a given path
|
/// Reads a configuration file from a given path
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">string path</param>
|
/// <param name="path">string path</param>
|
||||||
/// <returns>ConfigFile object</returns>
|
/// <returns>ConfigFile object</returns>
|
||||||
public static ConfigFile Read(string path)
|
public static ConfigFile Read(string path)
|
||||||
{
|
{
|
||||||
if (!File.Exists(path))
|
if (!File.Exists(path))
|
||||||
return new ConfigFile();
|
return new ConfigFile();
|
||||||
|
|
@ -298,11 +388,11 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reads the configuration file from a stream
|
/// Reads the configuration file from a stream
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="stream">stream</param>
|
/// <param name="stream">stream</param>
|
||||||
/// <returns>ConfigFile object</returns>
|
/// <returns>ConfigFile object</returns>
|
||||||
public static ConfigFile Read(Stream stream)
|
public static ConfigFile Read(Stream stream)
|
||||||
{
|
{
|
||||||
using (var sr = new StreamReader(stream))
|
using (var sr = new StreamReader(stream))
|
||||||
|
|
@ -314,10 +404,10 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes the configuration to a given path
|
/// Writes the configuration to a given path
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">string path - Location to put the config file</param>
|
/// <param name="path">string path - Location to put the config file</param>
|
||||||
public void Write(string path)
|
public void Write(string path)
|
||||||
{
|
{
|
||||||
using (var fs = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Write))
|
using (var fs = new FileStream(path, FileMode.Create, FileAccess.Write, FileShare.Write))
|
||||||
|
|
@ -326,10 +416,10 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Writes the configuration to a stream
|
/// Writes the configuration to a stream
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="stream">stream</param>
|
/// <param name="stream">stream</param>
|
||||||
public void Write(Stream stream)
|
public void Write(Stream stream)
|
||||||
{
|
{
|
||||||
var str = JsonConvert.SerializeObject(this, Formatting.Indented);
|
var str = JsonConvert.SerializeObject(this, Formatting.Indented);
|
||||||
|
|
@ -339,14 +429,14 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// On config read hook
|
/// On config read hook
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static Action<ConfigFile> ConfigRead;
|
public static Action<ConfigFile> ConfigRead;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Dumps all configuration options to a text file in Markdown format
|
/// Dumps all configuration options to a text file in Markdown format
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static void DumpDescriptions()
|
public static void DumpDescriptions()
|
||||||
{
|
{
|
||||||
var sb = new StringBuilder();
|
var sb = new StringBuilder();
|
||||||
|
|
|
||||||
|
|
@ -67,7 +67,7 @@ namespace TShockAPI.DB
|
||||||
string.Join(",", Permissions.ban, Permissions.whitelist, "tshock.world.time.*", Permissions.spawnboss,
|
string.Join(",", Permissions.ban, Permissions.whitelist, "tshock.world.time.*", Permissions.spawnboss,
|
||||||
Permissions.spawnmob, Permissions.managewarp, Permissions.time, Permissions.tp, Permissions.slap,
|
Permissions.spawnmob, Permissions.managewarp, Permissions.time, Permissions.tp, Permissions.slap,
|
||||||
Permissions.kill, Permissions.logs,
|
Permissions.kill, Permissions.logs,
|
||||||
Permissions.immunetokick, Permissions.tphere));
|
Permissions.immunetokick, Permissions.tpothers));
|
||||||
|
|
||||||
AddDefaultGroup("trustedadmin", "admin",
|
AddDefaultGroup("trustedadmin", "admin",
|
||||||
string.Join(",", Permissions.maintenance, "tshock.cfg.*", "tshock.world.*", Permissions.butcher, Permissions.item,
|
string.Join(",", Permissions.maintenance, "tshock.cfg.*", "tshock.world.*", Permissions.butcher, Permissions.item,
|
||||||
|
|
|
||||||
|
|
@ -207,17 +207,20 @@ namespace TShockAPI
|
||||||
[Description("User can teleport to others.")]
|
[Description("User can teleport to others.")]
|
||||||
public static readonly string tp = "tshock.tp.self";
|
public static readonly string tp = "tshock.tp.self";
|
||||||
|
|
||||||
[Description("User can teleport people to them.")]
|
[Description("User can teleport other people.")]
|
||||||
public static readonly string tphere = "tshock.tp.others";
|
public static readonly string tpothers = "tshock.tp.others";
|
||||||
|
|
||||||
[Description("Users can stop people from teleporting to them")]
|
[Description("User can teleport to tile positions.")]
|
||||||
|
public static readonly string tppos = "tshock.tp.pos";
|
||||||
|
|
||||||
|
[Description("Users can stop people from teleporting.")]
|
||||||
public static readonly string tpallow = "tshock.tp.block";
|
public static readonly string tpallow = "tshock.tp.block";
|
||||||
|
|
||||||
[Description("Users can tp to anyone")]
|
[Description("Users can override teleport blocks.")]
|
||||||
public static readonly string tpall = "tshock.tp.toall";
|
public static readonly string tpoverride = "tshock.tp.override";
|
||||||
|
|
||||||
[Description("Users can tp to people without showing a notice")]
|
[Description("Users can teleport to people without showing a notice")]
|
||||||
public static readonly string tphide = "tshock.tp.silent";
|
public static readonly string tpsilent = "tshock.tp.silent";
|
||||||
|
|
||||||
[Description("User can use /home.")]
|
[Description("User can use /home.")]
|
||||||
public static readonly string home = "tshock.tp.home";
|
public static readonly string home = "tshock.tp.home";
|
||||||
|
|
@ -239,12 +242,6 @@ namespace TShockAPI
|
||||||
[Description("User can force a blood moon.")]
|
[Description("User can force a blood moon.")]
|
||||||
public static readonly string bloodmoon = "tshock.world.time.bloodmoon";
|
public static readonly string bloodmoon = "tshock.world.time.bloodmoon";
|
||||||
|
|
||||||
[Description("User can force a pumpkin moon.")]
|
|
||||||
public static readonly string pumpkinmoon = "tshock.world.time.pumpkinmoon";
|
|
||||||
|
|
||||||
[Description("User can force a snow moon.")]
|
|
||||||
public static readonly string snowmoon = "tshock.world.time.snowmoon";
|
|
||||||
|
|
||||||
[Description("User can set the time.")]
|
[Description("User can set the time.")]
|
||||||
public static readonly string time = "tshock.world.time.set";
|
public static readonly string time = "tshock.world.time.set";
|
||||||
|
|
||||||
|
|
@ -260,6 +257,9 @@ namespace TShockAPI
|
||||||
[Description("User can convert hallow into corruption and vice-versa")]
|
[Description("User can convert hallow into corruption and vice-versa")]
|
||||||
public static readonly string converthardmode = "tshock.world.converthardmode";
|
public static readonly string converthardmode = "tshock.world.converthardmode";
|
||||||
|
|
||||||
|
[Description("User can force the server to Halloween mode.")]
|
||||||
|
public static readonly string halloween = "tshock.world.sethalloween";
|
||||||
|
|
||||||
[Description("User can force the server to Christmas mode.")]
|
[Description("User can force the server to Christmas mode.")]
|
||||||
public static readonly string xmas = "tshock.world.setxmas";
|
public static readonly string xmas = "tshock.world.setxmas";
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1020,42 +1020,70 @@ namespace TShockAPI
|
||||||
//RconHandler.Response += msg + "\n";
|
//RconHandler.Response += msg + "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetFullMoon(bool fullmoon)
|
public void SetFullMoon()
|
||||||
{
|
{
|
||||||
|
Main.dayTime = false;
|
||||||
Main.moonPhase = 0;
|
Main.moonPhase = 0;
|
||||||
SetTime(false, 0);
|
Main.time = 0.0;
|
||||||
|
TSPlayer.All.SendData(PacketTypes.WorldInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetBloodMoon(bool bloodMoon)
|
public void SetBloodMoon(bool bloodMoon)
|
||||||
{
|
{
|
||||||
Main.bloodMoon = bloodMoon;
|
if (bloodMoon)
|
||||||
SetTime(false, 0);
|
{
|
||||||
|
Main.dayTime = false;
|
||||||
|
Main.bloodMoon = true;
|
||||||
|
Main.time = 0.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Main.bloodMoon = false;
|
||||||
|
TSPlayer.All.SendData(PacketTypes.WorldInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetSnowMoon(bool snowMoon)
|
public void SetFrostMoon(bool snowMoon)
|
||||||
{
|
{
|
||||||
Main.snowMoon = snowMoon;
|
if (snowMoon)
|
||||||
SetTime(false, 0);
|
{
|
||||||
|
Main.dayTime = false;
|
||||||
|
Main.snowMoon = true;
|
||||||
|
Main.time = 0.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Main.snowMoon = false;
|
||||||
|
TSPlayer.All.SendData(PacketTypes.WorldInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetPumpkinMoon(bool pumpkinMoon)
|
public void SetPumpkinMoon(bool pumpkinMoon)
|
||||||
{
|
{
|
||||||
Main.pumpkinMoon = pumpkinMoon;
|
if (pumpkinMoon)
|
||||||
SetTime(false, 0);
|
{
|
||||||
|
Main.dayTime = false;
|
||||||
|
Main.pumpkinMoon = true;
|
||||||
|
Main.time = 0.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Main.pumpkinMoon = false;
|
||||||
|
TSPlayer.All.SendData(PacketTypes.WorldInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetEclipse(bool Eclipse)
|
public void SetEclipse(bool eclipse)
|
||||||
{
|
{
|
||||||
Main.eclipse = Eclipse;
|
if (eclipse)
|
||||||
SetTime(true, 150);
|
{
|
||||||
|
Main.dayTime = Main.eclipse = true;
|
||||||
|
Main.time = 0.0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Main.eclipse = false;
|
||||||
|
TSPlayer.All.SendData(PacketTypes.WorldInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetTime(bool dayTime, double time)
|
public void SetTime(bool dayTime, double time)
|
||||||
{
|
{
|
||||||
Main.dayTime = dayTime;
|
Main.dayTime = dayTime;
|
||||||
Main.time = time;
|
Main.time = time;
|
||||||
NetMessage.SendData((int) PacketTypes.TimeSet, -1, -1, "", 0, 0, Main.sunModY, Main.moonModY);
|
TSPlayer.All.SendData(PacketTypes.TimeSet, "", 0, 0, Main.sunModY, Main.moonModY);
|
||||||
// NetMessage.syncPlayers(); Is not in any way resposnsible for time...
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SpawnNPC(int type, string name, int amount, int startTileX, int startTileY, int tileXRange = 100,
|
public void SpawnNPC(int type, string name, int amount, int startTileX, int startTileY, int tileXRange = 100,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue