merged master into us
This commit is contained in:
commit
4907407337
8 changed files with 157 additions and 7 deletions
|
|
@ -101,6 +101,7 @@ namespace TShockAPI
|
||||||
commands.Add(new Command("help", "", new CommandDelegate(Help)));
|
commands.Add(new Command("help", "", new CommandDelegate(Help)));
|
||||||
commands.Add(new Command("slap", "pvpfun", new CommandDelegate(Slap)));
|
commands.Add(new Command("slap", "pvpfun", new CommandDelegate(Slap)));
|
||||||
commands.Add(new Command("off-nosave", "maintenance", new CommandDelegate(OffNoSave)));
|
commands.Add(new Command("off-nosave", "maintenance", new CommandDelegate(OffNoSave)));
|
||||||
|
commands.Add(new Command("protectspawn", "cfg", new CommandDelegate(ProtectSpawn)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Command Methods
|
#region Command Methods
|
||||||
|
|
@ -602,6 +603,12 @@ namespace TShockAPI
|
||||||
else
|
else
|
||||||
Tools.SendMessage(args.PlayerID, "Invalid syntax! Proper syntax: /slap <player> [dmg]", new float[] { 255f, 0f, 0f });
|
Tools.SendMessage(args.PlayerID, "Invalid syntax! Proper syntax: /slap <player> [dmg]", new float[] { 255f, 0f, 0f });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void ProtectSpawn(CommandArgs args)
|
||||||
|
{
|
||||||
|
ConfigurationManager.spawnProtect = (ConfigurationManager.spawnProtect == false);
|
||||||
|
Tools.SendMessage(args.PlayerID, "Spawn is now " + (ConfigurationManager.spawnProtect ? "protected" : "open") + ".");
|
||||||
|
}
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -23,5 +23,7 @@ namespace TShockAPI
|
||||||
public bool KickKillTileAbusers = false;
|
public bool KickKillTileAbusers = false;
|
||||||
public bool BanExplosives = true;
|
public bool BanExplosives = true;
|
||||||
public bool KickExplosives = true;
|
public bool KickExplosives = true;
|
||||||
|
public bool SpawnProtection = true;
|
||||||
|
public int SpawnProtectionRadius = 5;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,6 +29,8 @@ namespace TShockAPI
|
||||||
public static bool kickTnt = false;
|
public static bool kickTnt = false;
|
||||||
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 int spawnProtectRadius = 5;
|
||||||
|
|
||||||
public enum NPCList : int
|
public enum NPCList : int
|
||||||
{
|
{
|
||||||
|
|
@ -58,10 +60,16 @@ namespace TShockAPI
|
||||||
kickTnt = cfg.KickKillTileAbusers;
|
kickTnt = cfg.KickKillTileAbusers;
|
||||||
banBoom = cfg.BanExplosives;
|
banBoom = cfg.BanExplosives;
|
||||||
kickBoom = cfg.KickExplosives;
|
kickBoom = cfg.KickExplosives;
|
||||||
|
spawnProtect = cfg.SpawnProtection;
|
||||||
|
spawnProtectRadius = cfg.SpawnProtectionRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void WriteJsonConfiguration()
|
public static void WriteJsonConfiguration()
|
||||||
{
|
{
|
||||||
|
if (!System.IO.Directory.Exists(FileTools.SaveDir))
|
||||||
|
{
|
||||||
|
System.IO.Directory.CreateDirectory(FileTools.SaveDir);
|
||||||
|
}
|
||||||
if (System.IO.File.Exists(FileTools.SaveDir + "config.json"))
|
if (System.IO.File.Exists(FileTools.SaveDir + "config.json"))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
|
@ -87,6 +95,8 @@ namespace TShockAPI
|
||||||
cfg.KickKillTileAbusers = true;
|
cfg.KickKillTileAbusers = true;
|
||||||
cfg.BanExplosives = true;
|
cfg.BanExplosives = true;
|
||||||
cfg.KickExplosives = true;
|
cfg.KickExplosives = true;
|
||||||
|
cfg.SpawnProtection = true;
|
||||||
|
cfg.SpawnProtectionRadius = 5;
|
||||||
|
|
||||||
string json = JsonConvert.SerializeObject(cfg, Formatting.Indented);
|
string json = JsonConvert.SerializeObject(cfg, Formatting.Indented);
|
||||||
TextWriter tr = new StreamWriter(FileTools.SaveDir + "config.json");
|
TextWriter tr = new StreamWriter(FileTools.SaveDir + "config.json");
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ namespace TShockAPI
|
||||||
|
|
||||||
public static string saveDir = "./tshock/";
|
public static string saveDir = "./tshock/";
|
||||||
|
|
||||||
public static Version VersionNum = new Version(1, 5, 0, 1);
|
public static Version VersionNum = new Version(1, 6, 0, 0);
|
||||||
|
|
||||||
public static bool shownVersion = false;
|
public static bool shownVersion = false;
|
||||||
|
|
||||||
|
|
@ -104,6 +104,14 @@ namespace TShockAPI
|
||||||
|
|
||||||
public override void Initialize()
|
public override void Initialize()
|
||||||
{
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
FileTools.SetupConfig();
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Console.WriteLine(ex.ToString());
|
||||||
|
}
|
||||||
Log.Initialize(FileTools.SaveDir + "log.txt", LogLevel.All, true);
|
Log.Initialize(FileTools.SaveDir + "log.txt", LogLevel.All, true);
|
||||||
Log.Info("Starting...");
|
Log.Info("Starting...");
|
||||||
GameHooks.OnPreInitialize += OnPreInit;
|
GameHooks.OnPreInitialize += OnPreInit;
|
||||||
|
|
@ -138,8 +146,6 @@ namespace TShockAPI
|
||||||
NetHooks.OnPreGetData -= GetData;
|
NetHooks.OnPreGetData -= GetData;
|
||||||
NetHooks.OnGreetPlayer -= new NetHooks.GreetPlayerD(OnGreetPlayer);
|
NetHooks.OnGreetPlayer -= new NetHooks.GreetPlayerD(OnGreetPlayer);
|
||||||
NpcHooks.OnStrikeNpc -= new NpcHooks.StrikeNpcD(NpcHooks_OnStrikeNpc);
|
NpcHooks.OnStrikeNpc -= new NpcHooks.StrikeNpcD(NpcHooks_OnStrikeNpc);
|
||||||
ConfigurationManager.WriteJsonConfiguration();
|
|
||||||
Log.Info("Shutting down...");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -168,6 +174,18 @@ namespace TShockAPI
|
||||||
byte type = br.ReadByte();
|
byte type = br.ReadByte();
|
||||||
int x = br.ReadInt32();
|
int x = br.ReadInt32();
|
||||||
int y = br.ReadInt32();
|
int y = br.ReadInt32();
|
||||||
|
byte typetile = br.ReadByte();
|
||||||
|
if (type == 0 || type == 1)
|
||||||
|
if (ConfigurationManager.spawnProtect)
|
||||||
|
if (!players[e.Msg.whoAmI].group.HasPermission("editspawn"))
|
||||||
|
{
|
||||||
|
var flag = CheckSpawn(x, y);
|
||||||
|
if (flag)
|
||||||
|
{
|
||||||
|
Tools.SendMessage(e.Msg.whoAmI, "The spawn is protected!", new float[] { 255f, 0f, 0f });
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (type == 0 && BlacklistTiles[Main.tile[x, y].type] && Main.player[e.Msg.whoAmI].active)
|
if (type == 0 && BlacklistTiles[Main.tile[x, y].type] && Main.player[e.Msg.whoAmI].active)
|
||||||
{
|
{
|
||||||
|
|
@ -192,6 +210,7 @@ namespace TShockAPI
|
||||||
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);
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (e.MsgID == 0x0A) //SendSection
|
else if (e.MsgID == 0x0A) //SendSection
|
||||||
{
|
{
|
||||||
|
|
@ -304,6 +323,30 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (e.MsgID == 0x30)
|
||||||
|
{
|
||||||
|
int x;
|
||||||
|
int y;
|
||||||
|
byte liquid;
|
||||||
|
bool lava;
|
||||||
|
using (var br = new BinaryReader(new MemoryStream(e.Msg.readBuffer, e.Index, e.Length)))
|
||||||
|
{
|
||||||
|
x = br.ReadInt32();
|
||||||
|
y = br.ReadInt32();
|
||||||
|
liquid = br.ReadByte();
|
||||||
|
lava = br.ReadBoolean();
|
||||||
|
}
|
||||||
|
if (ConfigurationManager.spawnProtect)
|
||||||
|
if (!players[e.Msg.whoAmI].group.HasPermission("editspawn"))
|
||||||
|
{
|
||||||
|
var flag = CheckSpawn(x, y);
|
||||||
|
if (flag)
|
||||||
|
{
|
||||||
|
Tools.SendMessage(e.Msg.whoAmI, "The spawn is protected!", new float[] { 255f, 0f, 0f });
|
||||||
|
e.Handled = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else if (e.MsgID == 0x2C) // KillMe
|
else if (e.MsgID == 0x2C) // KillMe
|
||||||
{
|
{
|
||||||
byte id;
|
byte id;
|
||||||
|
|
@ -640,5 +683,16 @@ namespace TShockAPI
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool CheckSpawn(int x, int y)
|
||||||
|
{
|
||||||
|
Vector2 tile = new Vector2((float)x, (float)y);
|
||||||
|
Vector2 spawn = new Vector2((float)Main.spawnTileX, (float)Main.spawnTileY);
|
||||||
|
var distance = Vector2.Distance(spawn, tile);
|
||||||
|
if (distance > (float)ConfigurationManager.spawnProtectRadius)
|
||||||
|
return false;
|
||||||
|
else
|
||||||
|
return true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -8,11 +8,12 @@
|
||||||
#ALWAYS DECLARE A GROUP'S PARENT BEFORE YOU DECLARE THE GROUP
|
#ALWAYS DECLARE A GROUP'S PARENT BEFORE YOU DECLARE THE GROUP
|
||||||
|
|
||||||
#currently avaliable permissions: kick ban ignorecheatdetection
|
#currently avaliable permissions: kick ban ignorecheatdetection
|
||||||
#power cfg causeevents spawnboss tp
|
#maintenance cfg causeevents spawnboss tp
|
||||||
#spawnmob cheat kill pvpfun
|
#spawnmob cheat kill pvpfun
|
||||||
#immunetoban immunetokick
|
#immunetoban immunetokick editspawn
|
||||||
|
#ignoregriefdetection
|
||||||
|
|
||||||
default null
|
default null
|
||||||
newadmin default kick
|
newadmin default kick editspawn
|
||||||
admin newadmin ban causeevents spawnboss spawnmob tp immunetokick kill
|
admin newadmin ban causeevents spawnboss spawnmob tp immunetokick kill
|
||||||
trustedadmin admin ignorecheatdetection power cfg cheat pvpfun ignorecheatdetection immunetoban
|
trustedadmin admin ignorecheatdetection maintenance cfg cheat pvpfun ignorecheatdetection immunetoban ignoregriefdetection
|
||||||
70
release-docs/changes.txt
Normal file
70
release-docs/changes.txt
Normal file
|
|
@ -0,0 +1,70 @@
|
||||||
|
For the full list of changes, please take a look at GitHub:
|
||||||
|
https://github.com/TShock/TShock/commits/master
|
||||||
|
|
||||||
|
Changes in API release 1.6.0.0:
|
||||||
|
- Added spawn protection
|
||||||
|
- Fixed numerous bugs
|
||||||
|
- Added a few commands
|
||||||
|
|
||||||
|
Changes in API release 1.5.0.1:
|
||||||
|
- Fixed cheat detection
|
||||||
|
|
||||||
|
Changes in API release 1.5.0.0:
|
||||||
|
- Added /time
|
||||||
|
- Added /kill <player>
|
||||||
|
- Fixed /item
|
||||||
|
- Added /slap <player> [dmg]
|
||||||
|
- Added broadcast event for kill tile abuse
|
||||||
|
- Fixed teleport somewhat
|
||||||
|
- More cheat detection
|
||||||
|
- Extended new cheat protection to mana
|
||||||
|
- Update player exploit patched
|
||||||
|
- Fixed /spawn
|
||||||
|
- Made /invasion a toggle
|
||||||
|
|
||||||
|
Changes in API release 1.4.0.0:
|
||||||
|
- The configuration file is now located at config.json
|
||||||
|
- Something else.
|
||||||
|
|
||||||
|
Changes in API release 1.3.0.1:
|
||||||
|
- Re-coded the entire command system
|
||||||
|
- Re-coded the help command
|
||||||
|
- Implemented what seems to be the most recurring blacklist ever
|
||||||
|
|
||||||
|
Changes in API release 1.3.0.0:
|
||||||
|
- Added /maxspawns
|
||||||
|
- Added /spawnrate
|
||||||
|
- Resetup the configuration file to read spawn rate information.
|
||||||
|
- Patched the ability for clients to spawn NPCs
|
||||||
|
- Patched the ability for clients to rewrite the server through SendSection
|
||||||
|
- Make sure to use this Terraria.exe for the server: (http://dl.dropbox.com/u/29760911/Terraria.exe)
|
||||||
|
-- Allows spawn rates to be changed
|
||||||
|
|
||||||
|
Changes in API release 1.2.0.1:
|
||||||
|
- New update system
|
||||||
|
|
||||||
|
Changes in API release 1.2:
|
||||||
|
- Added /butcher
|
||||||
|
- Added /heal
|
||||||
|
- /spawnmob now takes another argument for the amount
|
||||||
|
- /item now adds items to the inventory directly
|
||||||
|
- This update credit to Deathmax
|
||||||
|
|
||||||
|
Changes in API release 1.1:
|
||||||
|
- Added /tp
|
||||||
|
- Added /tphere
|
||||||
|
- Added /spawnmob
|
||||||
|
- Added /item
|
||||||
|
- Fixed /spawn
|
||||||
|
- Updated /help
|
||||||
|
- Everything in this update credit to Deathmax, High, and Shank
|
||||||
|
|
||||||
|
Changes in API release 0.1:
|
||||||
|
- Added /save to save the world
|
||||||
|
- Added /spawn to teleport to spawn
|
||||||
|
- Added broken teleport stuff
|
||||||
|
- Major re-write of the anti-tnt code (now uses a blacklist instead of a whitelist)
|
||||||
|
- Fixed server crashing bug of the anti-tnt code
|
||||||
|
- Made the anti-tnt code decrease the threshold instantaniously
|
||||||
|
|
||||||
|
Re added the update checker.
|
||||||
3
release-docs/documentation.txt
Normal file
3
release-docs/documentation.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
Documentation, NPC lists, Spawn lists, and more can be found on GitHub at:
|
||||||
|
|
||||||
|
https://github.com/TShock/TShock/wiki
|
||||||
3
release-docs/installation.txt
Normal file
3
release-docs/installation.txt
Normal file
|
|
@ -0,0 +1,3 @@
|
||||||
|
For installation instructions, please refer to:
|
||||||
|
|
||||||
|
https://github.com/TShock/TShock/wiki/Installation-instructions
|
||||||
Loading…
Add table
Add a link
Reference in a new issue