This is C#, not javascript!
This commit is contained in:
parent
966735ec2e
commit
43beb99cb7
5 changed files with 127 additions and 127 deletions
|
|
@ -225,7 +225,7 @@ namespace TShockAPI
|
||||||
commands.Add(new Command("p", "", PartyChat));
|
commands.Add(new Command("p", "", PartyChat));
|
||||||
commands.Add(new Command("rules", "", Rules));
|
commands.Add(new Command("rules", "", Rules));
|
||||||
commands.Add(new Command("antibuild", "editspawn", ToggleAntiBuild));
|
commands.Add(new Command("antibuild", "editspawn", ToggleAntiBuild));
|
||||||
if (ConfigurationManager.distributationAgent != "terraria-online")
|
if (ConfigurationManager.DistributationAgent != "terraria-online")
|
||||||
{
|
{
|
||||||
commands.Add(new Command("kill", "kill", Kill));
|
commands.Add(new Command("kill", "kill", Kill));
|
||||||
commands.Add(new Command("butcher", "cheat", Butcher));
|
commands.Add(new Command("butcher", "cheat", Butcher));
|
||||||
|
|
@ -246,12 +246,12 @@ namespace TShockAPI
|
||||||
public static void ToggleAntiBuild(CommandArgs args)
|
public static void ToggleAntiBuild(CommandArgs args)
|
||||||
{
|
{
|
||||||
Tools.SendMessage(args.PlayerID, "Toggled world anti-build.");
|
Tools.SendMessage(args.PlayerID, "Toggled world anti-build.");
|
||||||
if (ConfigurationManager.disableBuild)
|
if (ConfigurationManager.DisableBuild)
|
||||||
{
|
{
|
||||||
ConfigurationManager.disableBuild = false;
|
ConfigurationManager.DisableBuild = false;
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
ConfigurationManager.disableBuild = true;
|
ConfigurationManager.DisableBuild = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -296,21 +296,21 @@ namespace TShockAPI
|
||||||
int ply = args.PlayerID;
|
int ply = args.PlayerID;
|
||||||
Tools.SendMessage(ply, "TShock Config:");
|
Tools.SendMessage(ply, "TShock Config:");
|
||||||
string lineOne = string.Format("BanCheater : {0}, KickCheater : {1}, BanGriefer : {2}, KickGriefer : {3}",
|
string lineOne = string.Format("BanCheater : {0}, KickCheater : {1}, BanGriefer : {2}, KickGriefer : {3}",
|
||||||
ConfigurationManager.banCheater, ConfigurationManager.kickCheater,
|
ConfigurationManager.BanCheater, ConfigurationManager.KickCheater,
|
||||||
ConfigurationManager.banGriefer, ConfigurationManager.kickGriefer);
|
ConfigurationManager.BanGriefer, ConfigurationManager.KickGriefer);
|
||||||
Tools.SendMessage(ply, lineOne, Color.Yellow);
|
Tools.SendMessage(ply, lineOne, Color.Yellow);
|
||||||
string lineTwo = string.Format("BanTnt : {0}, KickTnt : {1}, BanBoom : {2}, KickBoom : {3}",
|
string lineTwo = string.Format("BanTnt : {0}, KickTnt : {1}, BanBoom : {2}, KickBoom : {3}",
|
||||||
ConfigurationManager.banTnt, ConfigurationManager.kickTnt,
|
ConfigurationManager.BanTnt, ConfigurationManager.KickTnt,
|
||||||
ConfigurationManager.banBoom, ConfigurationManager.kickBoom);
|
ConfigurationManager.BanBoom, ConfigurationManager.KickBoom);
|
||||||
Tools.SendMessage(ply, lineTwo, Color.Yellow);
|
Tools.SendMessage(ply, lineTwo, Color.Yellow);
|
||||||
string lineThree = string.Format("RangeChecks : {0}, DisableBuild : {1}, ProtectSpawn : {2}, ProtectRadius : {3}",
|
string lineThree = string.Format("RangeChecks : {0}, DisableBuild : {1}, ProtectSpawn : {2}, ProtectRadius : {3}",
|
||||||
ConfigurationManager.rangeChecks, ConfigurationManager.disableBuild,
|
ConfigurationManager.RangeChecks, ConfigurationManager.DisableBuild,
|
||||||
ConfigurationManager.spawnProtect, ConfigurationManager.spawnProtectRadius);
|
ConfigurationManager.SpawnProtect, ConfigurationManager.SpawnProtectRadius);
|
||||||
Tools.SendMessage(ply, lineThree, Color.Yellow);
|
Tools.SendMessage(ply, lineThree, Color.Yellow);
|
||||||
string lineFour = string.Format("MaxSlots : {0}, SpamChecks : {1}, InvMultiplier : {2}, DMS : {3}, SpawnRate {4}",
|
string lineFour = string.Format("MaxSlots : {0}, SpamChecks : {1}, InvMultiplier : {2}, DMS : {3}, SpawnRate {4}",
|
||||||
ConfigurationManager.maxSlots, ConfigurationManager.spamChecks,
|
ConfigurationManager.MaxSlots, ConfigurationManager.SpamChecks,
|
||||||
ConfigurationManager.invasionMultiplier, ConfigurationManager.defaultMaxSpawns,
|
ConfigurationManager.InvasionMultiplier, ConfigurationManager.DefaultMaxSpawns,
|
||||||
ConfigurationManager.defaultSpawnRate);
|
ConfigurationManager.DefaultSpawnRate);
|
||||||
Tools.SendMessage(ply, lineFour, Color.Yellow);
|
Tools.SendMessage(ply, lineFour, Color.Yellow);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -596,12 +596,12 @@ namespace TShockAPI
|
||||||
|
|
||||||
public static void AuthToken(CommandArgs args)
|
public static void AuthToken(CommandArgs args)
|
||||||
{
|
{
|
||||||
if (ConfigurationManager.authToken == 0)
|
if (ConfigurationManager.AuthToken == 0)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int givenCode = Convert.ToInt32(args.Parameters[0]);
|
int givenCode = Convert.ToInt32(args.Parameters[0]);
|
||||||
if (givenCode == ConfigurationManager.authToken)
|
if (givenCode == ConfigurationManager.AuthToken)
|
||||||
{
|
{
|
||||||
TextWriter tw = new StreamWriter(FileTools.UsersPath, true);
|
TextWriter tw = new StreamWriter(FileTools.UsersPath, true);
|
||||||
tw.Write("\n" +
|
tw.Write("\n" +
|
||||||
|
|
@ -609,7 +609,7 @@ namespace TShockAPI
|
||||||
Convert.ToString(Netplay.serverSock[args.PlayerID].tcpClient.Client.RemoteEndPoint)) +
|
Convert.ToString(Netplay.serverSock[args.PlayerID].tcpClient.Client.RemoteEndPoint)) +
|
||||||
" superadmin");
|
" superadmin");
|
||||||
Tools.SendMessage(args.PlayerID, "SuperAdmin authenticated. Please re-connect using the same IP.");
|
Tools.SendMessage(args.PlayerID, "SuperAdmin authenticated. Please re-connect using the same IP.");
|
||||||
ConfigurationManager.authToken = 0;
|
ConfigurationManager.AuthToken = 0;
|
||||||
tw.Close();
|
tw.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -881,7 +881,7 @@ namespace TShockAPI
|
||||||
int amount = Convert.ToInt32(args.Parameters[0]);
|
int amount = Convert.ToInt32(args.Parameters[0]);
|
||||||
int.TryParse(args.Parameters[0], out amount);
|
int.TryParse(args.Parameters[0], out amount);
|
||||||
NPC.defaultMaxSpawns = amount;
|
NPC.defaultMaxSpawns = amount;
|
||||||
ConfigurationManager.defaultMaxSpawns = amount;
|
ConfigurationManager.DefaultMaxSpawns = amount;
|
||||||
Tools.Broadcast(string.Format("{0} changed the maximum spawns to: {1}", Tools.FindPlayer(adminplr), amount));
|
Tools.Broadcast(string.Format("{0} changed the maximum spawns to: {1}", Tools.FindPlayer(adminplr), amount));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -898,7 +898,7 @@ namespace TShockAPI
|
||||||
int amount = Convert.ToInt32(args.Parameters[0]);
|
int amount = Convert.ToInt32(args.Parameters[0]);
|
||||||
int.TryParse(args.Parameters[0], out amount);
|
int.TryParse(args.Parameters[0], out amount);
|
||||||
NPC.defaultSpawnRate = amount;
|
NPC.defaultSpawnRate = amount;
|
||||||
ConfigurationManager.defaultSpawnRate = amount;
|
ConfigurationManager.DefaultSpawnRate = amount;
|
||||||
Tools.Broadcast(string.Format("{0} changed the spawn rate to: {1}", Tools.FindPlayer(adminplr), amount));
|
Tools.Broadcast(string.Format("{0} changed the spawn rate to: {1}", Tools.FindPlayer(adminplr), amount));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1056,9 +1056,9 @@ namespace TShockAPI
|
||||||
|
|
||||||
public static void ProtectSpawn(CommandArgs args)
|
public static void ProtectSpawn(CommandArgs args)
|
||||||
{
|
{
|
||||||
ConfigurationManager.spawnProtect = (ConfigurationManager.spawnProtect == false);
|
ConfigurationManager.SpawnProtect = (ConfigurationManager.SpawnProtect == false);
|
||||||
Tools.SendMessage(args.PlayerID,
|
Tools.SendMessage(args.PlayerID,
|
||||||
string.Format("Spawn is now {0}.", (ConfigurationManager.spawnProtect ? "protected" : "open")));
|
string.Format("Spawn is now {0}.", (ConfigurationManager.SpawnProtect ? "protected" : "open")));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void UpdateNow(CommandArgs args)
|
public static void UpdateNow(CommandArgs args)
|
||||||
|
|
|
||||||
|
|
@ -28,32 +28,32 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
//Add default values here and in ConfigFile.cs
|
//Add default values here and in ConfigFile.cs
|
||||||
//Values written here will automatically be pulled into a config file on save.
|
//Values written here will automatically be pulled into a config file on save.
|
||||||
public static int invasionMultiplier = 1;
|
public static int InvasionMultiplier = 1;
|
||||||
public static int defaultMaxSpawns = 4;
|
public static int DefaultMaxSpawns = 4;
|
||||||
public static int defaultSpawnRate = 700;
|
public static int DefaultSpawnRate = 700;
|
||||||
public static int serverPort = 7777;
|
public static int ServerPort = 7777;
|
||||||
public static bool enableWhitelist = false;
|
public static bool EnableWhitelist = false;
|
||||||
public static bool infiniteInvasion = false;
|
public static bool InfiniteInvasion = false;
|
||||||
public static bool permaPvp = false;
|
public static bool PermaPvp = false;
|
||||||
public static int killCount;
|
public static int KillCount;
|
||||||
public static bool kickCheater = true;
|
public static bool KickCheater = true;
|
||||||
public static bool banCheater = true;
|
public static bool BanCheater = true;
|
||||||
public static bool kickGriefer = true;
|
public static bool KickGriefer = true;
|
||||||
public static bool banGriefer = true;
|
public static bool BanGriefer = true;
|
||||||
public static bool banTnt = true;
|
public static bool BanTnt = true;
|
||||||
public static bool kickTnt = true;
|
public static bool KickTnt = true;
|
||||||
public static bool banBoom = true;
|
public static bool BanBoom = true;
|
||||||
public static bool kickBoom = true;
|
public static bool KickBoom = true;
|
||||||
public static bool spawnProtect = true;
|
public static bool SpawnProtect = true;
|
||||||
public static bool rangeChecks = true;
|
public static bool RangeChecks = true;
|
||||||
public static int spawnProtectRadius = 5;
|
public static int SpawnProtectRadius = 5;
|
||||||
public static string distributationAgent = "facepunch";
|
public static string DistributationAgent = "facepunch";
|
||||||
public static int authToken;
|
public static int AuthToken;
|
||||||
public static int maxSlots = 8;
|
public static int MaxSlots = 8;
|
||||||
public static bool spamChecks = false;
|
public static bool SpamChecks = false;
|
||||||
public static bool disableBuild = false;
|
public static bool DisableBuild = false;
|
||||||
public static float[] adminChatRGB = {255, 0, 0};
|
public static float[] AdminChatRGB = {255, 0, 0};
|
||||||
public static string adminChatPrefix = "(Admin) ";
|
public static string AdminChatPrefix = "(Admin) ";
|
||||||
|
|
||||||
public enum NPCList
|
public enum NPCList
|
||||||
{
|
{
|
||||||
|
|
@ -68,60 +68,60 @@ namespace TShockAPI
|
||||||
ConfigFile cfg = JsonConvert.DeserializeObject<ConfigFile>(tr.ReadToEnd());
|
ConfigFile cfg = JsonConvert.DeserializeObject<ConfigFile>(tr.ReadToEnd());
|
||||||
tr.Close();
|
tr.Close();
|
||||||
|
|
||||||
invasionMultiplier = cfg.InvasionMultiplier;
|
InvasionMultiplier = cfg.InvasionMultiplier;
|
||||||
defaultMaxSpawns = cfg.DefaultMaximumSpawns;
|
DefaultMaxSpawns = cfg.DefaultMaximumSpawns;
|
||||||
defaultSpawnRate = cfg.DefaultSpawnRate;
|
DefaultSpawnRate = cfg.DefaultSpawnRate;
|
||||||
serverPort = cfg.ServerPort;
|
ServerPort = cfg.ServerPort;
|
||||||
enableWhitelist = cfg.EnableWhitelist;
|
EnableWhitelist = cfg.EnableWhitelist;
|
||||||
infiniteInvasion = cfg.InfiniteInvasion;
|
InfiniteInvasion = cfg.InfiniteInvasion;
|
||||||
permaPvp = cfg.AlwaysPvP;
|
PermaPvp = cfg.AlwaysPvP;
|
||||||
kickCheater = cfg.KickCheaters;
|
KickCheater = cfg.KickCheaters;
|
||||||
banCheater = cfg.BanCheaters;
|
BanCheater = cfg.BanCheaters;
|
||||||
kickGriefer = cfg.KickGriefers;
|
KickGriefer = cfg.KickGriefers;
|
||||||
banGriefer = cfg.BanGriefers;
|
BanGriefer = cfg.BanGriefers;
|
||||||
banTnt = cfg.BanKillTileAbusers;
|
BanTnt = cfg.BanKillTileAbusers;
|
||||||
kickTnt = cfg.KickKillTileAbusers;
|
KickTnt = cfg.KickKillTileAbusers;
|
||||||
banBoom = cfg.BanExplosives;
|
BanBoom = cfg.BanExplosives;
|
||||||
kickBoom = cfg.KickExplosives;
|
KickBoom = cfg.KickExplosives;
|
||||||
spawnProtect = cfg.SpawnProtection;
|
SpawnProtect = cfg.SpawnProtection;
|
||||||
spawnProtectRadius = cfg.SpawnProtectionRadius;
|
SpawnProtectRadius = cfg.SpawnProtectionRadius;
|
||||||
distributationAgent = cfg.DistributationAgent;
|
DistributationAgent = cfg.DistributationAgent;
|
||||||
maxSlots = cfg.MaxSlots;
|
MaxSlots = cfg.MaxSlots;
|
||||||
rangeChecks = cfg.RangeChecks;
|
RangeChecks = cfg.RangeChecks;
|
||||||
spamChecks = cfg.SpamChecks;
|
SpamChecks = cfg.SpamChecks;
|
||||||
disableBuild = cfg.DisableBuild;
|
DisableBuild = cfg.DisableBuild;
|
||||||
NPC.maxSpawns = defaultMaxSpawns;
|
NPC.maxSpawns = DefaultMaxSpawns;
|
||||||
NPC.defaultSpawnRate = defaultSpawnRate;
|
NPC.defaultSpawnRate = DefaultSpawnRate;
|
||||||
adminChatRGB = cfg.AdminChatRGB;
|
AdminChatRGB = cfg.AdminChatRGB;
|
||||||
adminChatPrefix = cfg.AdminChatPrefix;
|
AdminChatPrefix = cfg.AdminChatPrefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void WriteJsonConfiguration()
|
public static void WriteJsonConfiguration()
|
||||||
{
|
{
|
||||||
ConfigFile cfg = new ConfigFile();
|
ConfigFile cfg = new ConfigFile();
|
||||||
cfg.InvasionMultiplier = invasionMultiplier;
|
cfg.InvasionMultiplier = InvasionMultiplier;
|
||||||
cfg.DefaultMaximumSpawns = defaultMaxSpawns;
|
cfg.DefaultMaximumSpawns = DefaultMaxSpawns;
|
||||||
cfg.DefaultSpawnRate = defaultSpawnRate;
|
cfg.DefaultSpawnRate = DefaultSpawnRate;
|
||||||
cfg.ServerPort = serverPort;
|
cfg.ServerPort = ServerPort;
|
||||||
cfg.EnableWhitelist = enableWhitelist;
|
cfg.EnableWhitelist = EnableWhitelist;
|
||||||
cfg.InfiniteInvasion = infiniteInvasion;
|
cfg.InfiniteInvasion = InfiniteInvasion;
|
||||||
cfg.AlwaysPvP = permaPvp;
|
cfg.AlwaysPvP = PermaPvp;
|
||||||
cfg.KickCheaters = kickCheater;
|
cfg.KickCheaters = KickCheater;
|
||||||
cfg.BanCheaters = banCheater;
|
cfg.BanCheaters = BanCheater;
|
||||||
cfg.KickGriefers = kickGriefer;
|
cfg.KickGriefers = KickGriefer;
|
||||||
cfg.BanGriefers = banGriefer;
|
cfg.BanGriefers = BanGriefer;
|
||||||
cfg.BanKillTileAbusers = banGriefer;
|
cfg.BanKillTileAbusers = BanGriefer;
|
||||||
cfg.KickKillTileAbusers = kickGriefer;
|
cfg.KickKillTileAbusers = KickGriefer;
|
||||||
cfg.BanExplosives = banBoom;
|
cfg.BanExplosives = BanBoom;
|
||||||
cfg.KickExplosives = kickBoom;
|
cfg.KickExplosives = KickBoom;
|
||||||
cfg.SpawnProtection = spawnProtect;
|
cfg.SpawnProtection = SpawnProtect;
|
||||||
cfg.SpawnProtectionRadius = spawnProtectRadius;
|
cfg.SpawnProtectionRadius = SpawnProtectRadius;
|
||||||
cfg.MaxSlots = maxSlots;
|
cfg.MaxSlots = MaxSlots;
|
||||||
cfg.RangeChecks = rangeChecks;
|
cfg.RangeChecks = RangeChecks;
|
||||||
cfg.SpamChecks = spamChecks;
|
cfg.SpamChecks = SpamChecks;
|
||||||
cfg.DisableBuild = disableBuild;
|
cfg.DisableBuild = DisableBuild;
|
||||||
cfg.AdminChatRGB = adminChatRGB;
|
cfg.AdminChatRGB = AdminChatRGB;
|
||||||
cfg.AdminChatPrefix = adminChatPrefix;
|
cfg.AdminChatPrefix = AdminChatPrefix;
|
||||||
string json = JsonConvert.SerializeObject(cfg, Formatting.Indented);
|
string json = JsonConvert.SerializeObject(cfg, Formatting.Indented);
|
||||||
TextWriter tr = new StreamWriter(FileTools.ConfigPath);
|
TextWriter tr = new StreamWriter(FileTools.ConfigPath);
|
||||||
tr.Write(json);
|
tr.Write(json);
|
||||||
|
|
|
||||||
|
|
@ -81,7 +81,7 @@ namespace TShockAPI
|
||||||
ConfigurationManager.ReadJsonConfiguration();
|
ConfigurationManager.ReadJsonConfiguration();
|
||||||
}
|
}
|
||||||
|
|
||||||
Netplay.serverPort = ConfigurationManager.serverPort;
|
Netplay.serverPort = ConfigurationManager.ServerPort;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -91,7 +91,7 @@ namespace TShockAPI
|
||||||
/// <returns>true/false</returns>
|
/// <returns>true/false</returns>
|
||||||
public static bool OnWhitelist(string ip)
|
public static bool OnWhitelist(string ip)
|
||||||
{
|
{
|
||||||
if (!ConfigurationManager.enableWhitelist)
|
if (!ConfigurationManager.EnableWhitelist)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -221,7 +221,7 @@ namespace TShockAPI
|
||||||
|
|
||||||
private void NpcHooks_OnStrikeNpc(NpcStrikeEventArgs e)
|
private void NpcHooks_OnStrikeNpc(NpcStrikeEventArgs e)
|
||||||
{
|
{
|
||||||
if (ConfigurationManager.infiniteInvasion)
|
if (ConfigurationManager.InfiniteInvasion)
|
||||||
{
|
{
|
||||||
IncrementKills();
|
IncrementKills();
|
||||||
if (Main.invasionSize < 10)
|
if (Main.invasionSize < 10)
|
||||||
|
|
@ -298,7 +298,7 @@ namespace TShockAPI
|
||||||
int plyY = Math.Abs((int)Main.player[e.Msg.whoAmI].position.Y / 16);
|
int plyY = Math.Abs((int)Main.player[e.Msg.whoAmI].position.Y / 16);
|
||||||
int tileX = Math.Abs(x);
|
int tileX = Math.Abs(x);
|
||||||
int tileY = Math.Abs(y);
|
int tileY = Math.Abs(y);
|
||||||
if (size > 5 || (ConfigurationManager.rangeChecks && (Math.Abs(plyX - tileX) > 32 || Math.Abs(plyY - tileY) > 32)))
|
if (size > 5 || (ConfigurationManager.RangeChecks && (Math.Abs(plyX - tileX) > 32 || Math.Abs(plyY - tileY) > 32)))
|
||||||
{
|
{
|
||||||
Log.Debug(string.Format("SendTileSquare(PlyXY:{0}_{1}, TileXY:{2}_{3}, Result:{4}_{5}, Size:{6})",
|
Log.Debug(string.Format("SendTileSquare(PlyXY:{0}_{1}, TileXY:{2}_{3}, Result:{4}_{5}, Size:{6})",
|
||||||
plyX, plyY,
|
plyX, plyY,
|
||||||
|
|
@ -328,7 +328,7 @@ namespace TShockAPI
|
||||||
return Tools.Kick(e.Msg.whoAmI, "Using dirt rod");
|
return Tools.Kick(e.Msg.whoAmI, "Using dirt rod");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ConfigurationManager.rangeChecks && ((Math.Abs(plyX - tileX) > 32) || (Math.Abs(plyY - tileY) > 32)))
|
if (ConfigurationManager.RangeChecks && ((Math.Abs(plyX - tileX) > 32) || (Math.Abs(plyY - tileY) > 32)))
|
||||||
{
|
{
|
||||||
Log.Debug(string.Format("TilePlaced(PlyXY:{0}_{1}, TileXY:{2}_{3}, Result:{4}_{5}, Type:{6})",
|
Log.Debug(string.Format("TilePlaced(PlyXY:{0}_{1}, TileXY:{2}_{3}, Result:{4}_{5}, Type:{6})",
|
||||||
plyX, plyY,
|
plyX, plyY,
|
||||||
|
|
@ -339,7 +339,7 @@ namespace TShockAPI
|
||||||
return Tools.HandleGriefer(e.Msg.whoAmI, "Placing impossible to place blocks.");
|
return Tools.HandleGriefer(e.Msg.whoAmI, "Placing impossible to place blocks.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ConfigurationManager.disableBuild)
|
if (ConfigurationManager.DisableBuild)
|
||||||
{
|
{
|
||||||
if (!Players[e.Msg.whoAmI].Group.HasPermission("editspawn"))
|
if (!Players[e.Msg.whoAmI].Group.HasPermission("editspawn"))
|
||||||
{
|
{
|
||||||
|
|
@ -348,7 +348,7 @@ namespace TShockAPI
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (ConfigurationManager.spawnProtect)
|
if (ConfigurationManager.SpawnProtect)
|
||||||
{
|
{
|
||||||
if (!Players[e.Msg.whoAmI].Group.HasPermission("editspawn"))
|
if (!Players[e.Msg.whoAmI].Group.HasPermission("editspawn"))
|
||||||
{
|
{
|
||||||
|
|
@ -384,7 +384,7 @@ namespace TShockAPI
|
||||||
Main.player[e.Msg.whoAmI].hostile = pvp;
|
Main.player[e.Msg.whoAmI].hostile = pvp;
|
||||||
if (id != e.Msg.whoAmI)
|
if (id != e.Msg.whoAmI)
|
||||||
Main.player[e.Msg.whoAmI].hostile = true;
|
Main.player[e.Msg.whoAmI].hostile = true;
|
||||||
if (ConfigurationManager.permaPvp)
|
if (ConfigurationManager.PermaPvp)
|
||||||
Main.player[e.Msg.whoAmI].hostile = true;
|
Main.player[e.Msg.whoAmI].hostile = true;
|
||||||
NetMessage.SendData(30, -1, -1, "", e.Msg.whoAmI);
|
NetMessage.SendData(30, -1, -1, "", e.Msg.whoAmI);
|
||||||
return true;
|
return true;
|
||||||
|
|
@ -520,7 +520,7 @@ namespace TShockAPI
|
||||||
));
|
));
|
||||||
return Tools.HandleGriefer(e.Msg.whoAmI, "Manipulating liquid without bucket."); ;
|
return Tools.HandleGriefer(e.Msg.whoAmI, "Manipulating liquid without bucket."); ;
|
||||||
}
|
}
|
||||||
if (ConfigurationManager.rangeChecks && ((Math.Abs(plyX - tileX) > 32) || (Math.Abs(plyY - tileY) > 32)))
|
if (ConfigurationManager.RangeChecks && ((Math.Abs(plyX - tileX) > 32) || (Math.Abs(plyY - tileY) > 32)))
|
||||||
{
|
{
|
||||||
Log.Debug(string.Format("Liquid(PlyXY:{0}_{1}, TileXY:{2}_{3}, Result:{4}_{5}, Amount:{6})",
|
Log.Debug(string.Format("Liquid(PlyXY:{0}_{1}, TileXY:{2}_{3}, Result:{4}_{5}, Amount:{6})",
|
||||||
plyX, plyY,
|
plyX, plyY,
|
||||||
|
|
@ -531,7 +531,7 @@ namespace TShockAPI
|
||||||
return Tools.HandleGriefer(e.Msg.whoAmI, "Placing impossible to place liquid."); ;
|
return Tools.HandleGriefer(e.Msg.whoAmI, "Placing impossible to place liquid."); ;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ConfigurationManager.spawnProtect)
|
if (ConfigurationManager.SpawnProtect)
|
||||||
{
|
{
|
||||||
if (!Players[e.Msg.whoAmI].Group.HasPermission("editspawn"))
|
if (!Players[e.Msg.whoAmI].Group.HasPermission("editspawn"))
|
||||||
{
|
{
|
||||||
|
|
@ -577,12 +577,12 @@ namespace TShockAPI
|
||||||
{
|
{
|
||||||
Tools.HandleCheater(who, "Hacked health.");
|
Tools.HandleCheater(who, "Hacked health.");
|
||||||
}
|
}
|
||||||
if (ConfigurationManager.permaPvp)
|
if (ConfigurationManager.PermaPvp)
|
||||||
{
|
{
|
||||||
Main.player[who].hostile = true;
|
Main.player[who].hostile = true;
|
||||||
NetMessage.SendData(30, -1, -1, "", who);
|
NetMessage.SendData(30, -1, -1, "", who);
|
||||||
}
|
}
|
||||||
if (Players[who].Group.HasPermission("causeevents") && ConfigurationManager.infiniteInvasion)
|
if (Players[who].Group.HasPermission("causeevents") && ConfigurationManager.InfiniteInvasion)
|
||||||
{
|
{
|
||||||
StartInvasion();
|
StartInvasion();
|
||||||
}
|
}
|
||||||
|
|
@ -602,7 +602,7 @@ namespace TShockAPI
|
||||||
|
|
||||||
if (Players[ply].Group.HasPermission("adminchat") && !text.StartsWith("/"))
|
if (Players[ply].Group.HasPermission("adminchat") && !text.StartsWith("/"))
|
||||||
{
|
{
|
||||||
Tools.Broadcast(ConfigurationManager.adminChatPrefix + "<" + Main.player[ply].name + "> " + text, (byte)ConfigurationManager.adminChatRGB[0], (byte)ConfigurationManager.adminChatRGB[1], (byte)ConfigurationManager.adminChatRGB[2]);
|
Tools.Broadcast(ConfigurationManager.AdminChatPrefix + "<" + Main.player[ply].name + "> " + text, (byte)ConfigurationManager.AdminChatRGB[0], (byte)ConfigurationManager.AdminChatRGB[1], (byte)ConfigurationManager.AdminChatRGB[2]);
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -662,7 +662,7 @@ namespace TShockAPI
|
||||||
Players[ply] = new TSPlayer(ply);
|
Players[ply] = new TSPlayer(ply);
|
||||||
Players[ply].Group = Tools.GetGroupForIP(ip);
|
Players[ply].Group = Tools.GetGroupForIP(ip);
|
||||||
|
|
||||||
if (Tools.ActivePlayers() + 1 > ConfigurationManager.maxSlots &&
|
if (Tools.ActivePlayers() + 1 > ConfigurationManager.MaxSlots &&
|
||||||
!Players[ply].Group.HasPermission("reservedslot"))
|
!Players[ply].Group.HasPermission("reservedslot"))
|
||||||
{
|
{
|
||||||
Tools.ForceKick(ply, "Server is full");
|
Tools.ForceKick(ply, "Server is full");
|
||||||
|
|
@ -683,7 +683,7 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Netplay.serverSock[ply].spamCheck = ConfigurationManager.spamChecks;
|
Netplay.serverSock[ply].spamCheck = ConfigurationManager.SpamChecks;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnPostInit()
|
private void OnPostInit()
|
||||||
|
|
@ -691,9 +691,9 @@ namespace TShockAPI
|
||||||
if (!File.Exists(Path.Combine(SavePath, "auth.lck")))
|
if (!File.Exists(Path.Combine(SavePath, "auth.lck")))
|
||||||
{
|
{
|
||||||
var r = new Random((int)DateTime.Now.ToBinary());
|
var r = new Random((int)DateTime.Now.ToBinary());
|
||||||
ConfigurationManager.authToken = r.Next(100000, 10000000);
|
ConfigurationManager.AuthToken = r.Next(100000, 10000000);
|
||||||
Console.WriteLine("TShock Notice: To become SuperAdmin, join the game and type /auth " +
|
Console.WriteLine("TShock Notice: To become SuperAdmin, join the game and type /auth " +
|
||||||
ConfigurationManager.authToken);
|
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.");
|
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"));
|
||||||
}
|
}
|
||||||
|
|
@ -773,13 +773,13 @@ namespace TShockAPI
|
||||||
public static void StartInvasion()
|
public static void StartInvasion()
|
||||||
{
|
{
|
||||||
Main.invasionType = 1;
|
Main.invasionType = 1;
|
||||||
if (ConfigurationManager.infiniteInvasion)
|
if (ConfigurationManager.InfiniteInvasion)
|
||||||
{
|
{
|
||||||
Main.invasionSize = 20000000;
|
Main.invasionSize = 20000000;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Main.invasionSize = 100 + (ConfigurationManager.invasionMultiplier * Tools.ActivePlayers());
|
Main.invasionSize = 100 + (ConfigurationManager.InvasionMultiplier * Tools.ActivePlayers());
|
||||||
}
|
}
|
||||||
|
|
||||||
Main.invasionWarn = 0;
|
Main.invasionWarn = 0;
|
||||||
|
|
@ -795,30 +795,30 @@ namespace TShockAPI
|
||||||
|
|
||||||
public static void IncrementKills()
|
public static void IncrementKills()
|
||||||
{
|
{
|
||||||
ConfigurationManager.killCount++;
|
ConfigurationManager.KillCount++;
|
||||||
Random r = new Random();
|
Random r = new Random();
|
||||||
int random = r.Next(5);
|
int random = r.Next(5);
|
||||||
if (ConfigurationManager.killCount % 100 == 0)
|
if (ConfigurationManager.KillCount % 100 == 0)
|
||||||
{
|
{
|
||||||
switch (random)
|
switch (random)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
Tools.Broadcast(string.Format("You call that a lot? {0} goblins killed!", ConfigurationManager.killCount));
|
Tools.Broadcast(string.Format("You call that a lot? {0} goblins killed!", ConfigurationManager.KillCount));
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
Tools.Broadcast(string.Format("Fatality! {0} goblins killed!", ConfigurationManager.killCount));
|
Tools.Broadcast(string.Format("Fatality! {0} goblins killed!", ConfigurationManager.KillCount));
|
||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
Tools.Broadcast(string.Format("Number of 'noobs' killed to date: {0}", ConfigurationManager.killCount));
|
Tools.Broadcast(string.Format("Number of 'noobs' killed to date: {0}", ConfigurationManager.KillCount));
|
||||||
break;
|
break;
|
||||||
case 3:
|
case 3:
|
||||||
Tools.Broadcast(string.Format("Duke Nukem would be proud. {0} goblins killed.", ConfigurationManager.killCount));
|
Tools.Broadcast(string.Format("Duke Nukem would be proud. {0} goblins killed.", ConfigurationManager.KillCount));
|
||||||
break;
|
break;
|
||||||
case 4:
|
case 4:
|
||||||
Tools.Broadcast(string.Format("You call that a lot? {0} goblins killed!", ConfigurationManager.killCount));
|
Tools.Broadcast(string.Format("You call that a lot? {0} goblins killed!", ConfigurationManager.KillCount));
|
||||||
break;
|
break;
|
||||||
case 5:
|
case 5:
|
||||||
Tools.Broadcast(string.Format("{0} copies of Call of Duty smashed.", ConfigurationManager.killCount));
|
Tools.Broadcast(string.Format("{0} copies of Call of Duty smashed.", ConfigurationManager.KillCount));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -893,7 +893,7 @@ namespace TShockAPI
|
||||||
Vector2 tile = new Vector2(x, y);
|
Vector2 tile = new Vector2(x, y);
|
||||||
Vector2 spawn = new Vector2(Main.spawnTileX, Main.spawnTileY);
|
Vector2 spawn = new Vector2(Main.spawnTileX, Main.spawnTileY);
|
||||||
var distance = Vector2.Distance(spawn, tile);
|
var distance = Vector2.Distance(spawn, tile);
|
||||||
if (distance > ConfigurationManager.spawnProtectRadius)
|
if (distance > ConfigurationManager.SpawnProtectRadius)
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -306,22 +306,22 @@ namespace TShockAPI
|
||||||
|
|
||||||
public static bool HandleCheater(int ply, string reason)
|
public static bool HandleCheater(int ply, string reason)
|
||||||
{
|
{
|
||||||
return HandleBadPlayer(ply, "ignorecheatdetection", ConfigurationManager.banCheater, ConfigurationManager.kickCheater, reason);
|
return HandleBadPlayer(ply, "ignorecheatdetection", ConfigurationManager.BanCheater, ConfigurationManager.KickCheater, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool HandleGriefer(int ply, string reason)
|
public static bool HandleGriefer(int ply, string reason)
|
||||||
{
|
{
|
||||||
return HandleBadPlayer(ply, "ignoregriefdetection", ConfigurationManager.banGriefer, ConfigurationManager.kickGriefer, reason);
|
return HandleBadPlayer(ply, "ignoregriefdetection", ConfigurationManager.BanGriefer, ConfigurationManager.KickGriefer, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool HandleTntUser(int ply, string reason)
|
public static bool HandleTntUser(int ply, string reason)
|
||||||
{
|
{
|
||||||
return HandleBadPlayer(ply, "ignoregriefdetection", ConfigurationManager.banTnt, ConfigurationManager.kickTnt, reason);
|
return HandleBadPlayer(ply, "ignoregriefdetection", ConfigurationManager.BanTnt, ConfigurationManager.KickTnt, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool HandleExplosivesUser(int ply, string reason)
|
public static bool HandleExplosivesUser(int ply, string reason)
|
||||||
{
|
{
|
||||||
return HandleBadPlayer(ply, "ignoregriefdetection", ConfigurationManager.banBoom, ConfigurationManager.kickBoom, reason);
|
return HandleBadPlayer(ply, "ignoregriefdetection", ConfigurationManager.BanBoom, ConfigurationManager.KickBoom, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static bool HandleBadPlayer(int ply, string overridePermission, bool ban, bool kick, string reason)
|
private static bool HandleBadPlayer(int ply, string overridePermission, bool ban, bool kick, string reason)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue