diff --git a/DBEditor/CommandList.cs b/DBEditor/CommandList.cs
index e1c24f64..50fd8003 100644
--- a/DBEditor/CommandList.cs
+++ b/DBEditor/CommandList.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
diff --git a/DBEditor/DbExt.cs b/DBEditor/DbExt.cs
index 1fcf2f36..112d5161 100644
--- a/DBEditor/DbExt.cs
+++ b/DBEditor/DbExt.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
diff --git a/DBEditor/Group.cs b/DBEditor/Group.cs
index acedf451..8dd3f44e 100644
--- a/DBEditor/Group.cs
+++ b/DBEditor/Group.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System;
using System.Collections.Generic;
namespace TShockDBEditor
diff --git a/DBEditor/Itemlist.cs b/DBEditor/Itemlist.cs
index e4462e33..f73a51f8 100644
--- a/DBEditor/Itemlist.cs
+++ b/DBEditor/Itemlist.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
diff --git a/DBEditor/Main.Designer.cs b/DBEditor/Main.Designer.cs
index 565b5cfb..38128155 100644
--- a/DBEditor/Main.Designer.cs
+++ b/DBEditor/Main.Designer.cs
@@ -1,4 +1,21 @@
-namespace TShockDBEditor
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+namespace TShockDBEditor
{
partial class TShockDBEditor
{
diff --git a/DBEditor/Main.cs b/DBEditor/Main.cs
index 180d779b..b0afd2ed 100644
--- a/DBEditor/Main.cs
+++ b/DBEditor/Main.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
diff --git a/DBEditor/Program.cs b/DBEditor/Program.cs
index b2ca7986..87c58708 100644
--- a/DBEditor/Program.cs
+++ b/DBEditor/Program.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
diff --git a/DBEditor/Properties/AssemblyInfo.cs b/DBEditor/Properties/AssemblyInfo.cs
index 441f6b69..c8be0e19 100644
--- a/DBEditor/Properties/AssemblyInfo.cs
+++ b/DBEditor/Properties/AssemblyInfo.cs
@@ -1,4 +1,21 @@
-using System.Reflection;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
diff --git a/DBEditor/Properties/Resources.Designer.cs b/DBEditor/Properties/Resources.Designer.cs
index aa2d1063..2ec43f10 100644
--- a/DBEditor/Properties/Resources.Designer.cs
+++ b/DBEditor/Properties/Resources.Designer.cs
@@ -1,4 +1,22 @@
-//------------------------------------------------------------------------------
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+
+//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version:4.0.30319.1
diff --git a/DBEditor/Properties/Settings.Designer.cs b/DBEditor/Properties/Settings.Designer.cs
index f7730805..d6ca6768 100644
--- a/DBEditor/Properties/Settings.Designer.cs
+++ b/DBEditor/Properties/Settings.Designer.cs
@@ -1,4 +1,22 @@
-//------------------------------------------------------------------------------
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+
+//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version:4.0.30319.1
diff --git a/DBEditor/TShockDBEditor.csproj b/DBEditor/TShockDBEditor.csproj
index ac8260c1..25b8d7d8 100644
--- a/DBEditor/TShockDBEditor.csproj
+++ b/DBEditor/TShockDBEditor.csproj
@@ -14,6 +14,7 @@
512
+ false
publish\
true
Disk
@@ -26,7 +27,6 @@
true
0
1.0.0.%2a
- false
false
true
@@ -110,6 +110,7 @@
Settings.settings
True
+
diff --git a/DBEditor/TShockDBEditor.licenseheader b/DBEditor/TShockDBEditor.licenseheader
new file mode 100644
index 00000000..32579142
--- /dev/null
+++ b/DBEditor/TShockDBEditor.licenseheader
@@ -0,0 +1,18 @@
+extensions: .cs
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
\ No newline at end of file
diff --git a/TShockAPI/BackupManager.cs b/TShockAPI/BackupManager.cs
index 4cf79cff..8aa8c2f5 100644
--- a/TShockAPI/BackupManager.cs
+++ b/TShockAPI/BackupManager.cs
@@ -1,4 +1,4 @@
-/*
+/*
TShock, a server mod for Terraria
Copyright (C) 2011 The TShock Team
@@ -15,8 +15,6 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-
-
using System;
using System.IO;
using System.Threading;
diff --git a/TShockAPI/Commands.cs b/TShockAPI/Commands.cs
index 14ce98c5..de663943 100644
--- a/TShockAPI/Commands.cs
+++ b/TShockAPI/Commands.cs
@@ -15,7 +15,6 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-
using System;
using System.Collections.Generic;
using System.Diagnostics;
@@ -191,16 +190,15 @@ namespace TShockAPI
add(Permissions.rootonly, GrabUserUserInfo, "userinfo", "ui");
add(Permissions.rootonly, AuthVerify, "auth-verify");
ChatCommands.Add(new Command(Permissions.canlogin, AttemptLogin, "login") {DoLog = false});
- add(Permissions.cfg, Broadcast, "broadcast", "bc", "say", "yell", "scream", "yellinanguish", "speak");
+ add(Permissions.cfg, Broadcast, "broadcast", "bc", "say");
add(Permissions.whisper, Whisper, "whisper", "w", "tell");
add(Permissions.whisper, Reply, "reply", "r");
add(Permissions.annoy, Annoy, "annoy");
- add(Permissions.cfg, ConvertWaR, "convert");
add(Permissions.kill, Kill, "kill");
add(Permissions.butcher, Butcher, "butcher");
add(Permissions.item, Item, "item", "i");
- add(Permissions.item, Give, "give");
- add(Permissions.clearitems, ClearItems, "clearitems");
+ add(Permissions.item, Give, "give", "g");
+ add(Permissions.clearitems, ClearItems, "clear", "clearitems");
add(Permissions.heal, Heal, "heal");
add(Permissions.buff, Buff, "buff");
add(Permissions.buffplayer, GBuff, "gbuff", "buffplayer");
@@ -924,23 +922,6 @@ namespace TShockAPI
#region Server Maintenence Commands
- public static void ConvertWaR(CommandArgs args)
- {
- if (args.Parameters.Count < 1)
- {
- args.Player.SendMessage("This command will dump all users from both Regions and Warps.");
- args.Player.SendMessage("This command will also change all Worlds to reference this WorldID.");
- args.Player.SendMessage("You must manually fix multi-world configurations.");
- args.Player.SendMessage("To confirm this: /convert yes");
- }
- else if (args.Parameters[0] == "yes")
- {
- TShock.Warps.ConvertDB();
- TShock.Regions.ConvertDB();
- args.Player.SendMessage("Convert complete. You need to re-allow users after they register.");
- }
- }
-
private static void Broadcast(CommandArgs args)
{
string message = "";
@@ -1057,6 +1038,7 @@ namespace TShockAPI
}
}
+ [Obsolete("This specific command for spawning mobs will replaced soon.")]
private static void Eater(CommandArgs args)
{
if (args.Parameters.Count > 1)
@@ -1076,6 +1058,7 @@ namespace TShockAPI
TShock.Utils.Broadcast(string.Format("{0} has spawned eater of worlds {1} times!", args.Player.Name, amount));
}
+ [Obsolete("This specific command for spawning mobs will replaced soon.")]
private static void Eye(CommandArgs args)
{
if (args.Parameters.Count > 1)
@@ -1096,6 +1079,7 @@ namespace TShockAPI
TShock.Utils.Broadcast(string.Format("{0} has spawned eye {1} times!", args.Player.Name, amount));
}
+ [Obsolete("This specific command for spawning mobs will replaced soon.")]
private static void King(CommandArgs args)
{
if (args.Parameters.Count > 1)
@@ -1115,6 +1099,7 @@ namespace TShockAPI
TShock.Utils.Broadcast(string.Format("{0} has spawned king slime {1} times!", args.Player.Name, amount));
}
+ [Obsolete("This specific command for spawning mobs will replaced soon.")]
private static void Skeletron(CommandArgs args)
{
if (args.Parameters.Count > 1)
@@ -1135,6 +1120,7 @@ namespace TShockAPI
TShock.Utils.Broadcast(string.Format("{0} has spawned skeletron {1} times!", args.Player.Name, amount));
}
+ [Obsolete("This specific command for spawning mobs will replaced soon.")]
private static void WoF(CommandArgs args)
{
if (Main.wof >= 0 || (args.Player.Y/16f < (Main.maxTilesY - 205)))
@@ -1146,6 +1132,7 @@ namespace TShockAPI
TShock.Utils.Broadcast(string.Format("{0} has spawned Wall of Flesh!", args.Player.Name));
}
+ [Obsolete("This specific command for spawning mobs will replaced soon.")]
private static void Twins(CommandArgs args)
{
if (args.Parameters.Count > 1)
@@ -1168,6 +1155,7 @@ namespace TShockAPI
TShock.Utils.Broadcast(string.Format("{0} has spawned the twins {1} times!", args.Player.Name, amount));
}
+ [Obsolete("This specific command for spawning mobs will replaced soon.")]
private static void Destroyer(CommandArgs args)
{
if (args.Parameters.Count > 1)
@@ -1188,6 +1176,7 @@ namespace TShockAPI
TShock.Utils.Broadcast(string.Format("{0} has spawned the destroyer {1} times!", args.Player.Name, amount));
}
+ [Obsolete("This specific command for spawning mobs will replaced soon.")]
private static void SkeletronPrime(CommandArgs args)
{
if (args.Parameters.Count > 1)
@@ -1208,6 +1197,7 @@ namespace TShockAPI
TShock.Utils.Broadcast(string.Format("{0} has spawned skeletron prime {1} times!", args.Player.Name, amount));
}
+ [Obsolete("This specific command for spawning mobs will replaced soon.")]
private static void Hardcore(CommandArgs args) // TODO: Add all 8 bosses
{
if (args.Parameters.Count > 1)
diff --git a/TShockAPI/ConfigFile.cs b/TShockAPI/ConfigFile.cs
index 2d364217..67af949a 100644
--- a/TShockAPI/ConfigFile.cs
+++ b/TShockAPI/ConfigFile.cs
@@ -1,4 +1,4 @@
-/*
+/*
TShock, a server mod for Terraria
Copyright (C) 2011 The TShock Team
diff --git a/TShockAPI/DB/BanManager.cs b/TShockAPI/DB/BanManager.cs
index 3630287e..46d4489c 100644
--- a/TShockAPI/DB/BanManager.cs
+++ b/TShockAPI/DB/BanManager.cs
@@ -1,4 +1,4 @@
-/*
+/*
TShock, a server mod for Terraria
Copyright (C) 2011 The TShock Team
@@ -15,7 +15,6 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-
using System;
using System.Data;
using System.IO;
@@ -41,32 +40,6 @@ namespace TShockAPI.DB
? (IQueryBuilder) new SqliteQueryCreator()
: new MysqlQueryCreator());
creator.EnsureExists(table);
-
- String file = Path.Combine(TShock.SavePath, "bans.txt");
- if (File.Exists(file))
- {
- using (StreamReader sr = new StreamReader(file))
- {
- String line;
- while ((line = sr.ReadLine()) != null)
- {
- String[] info = line.Split('|');
- string query;
- if (TShock.Config.StorageType.ToLower() == "sqlite")
- query = "INSERT OR IGNORE INTO Bans (IP, Name, Reason) VALUES (@0, @1, @2);";
- else
- query = "INSERT IGNORE INTO Bans SET IP=@0, Name=@1, Reason=@2;";
- db.Query(query, info[0].Trim(), info[1].Trim(), info[2].Trim());
- }
- }
- String path = Path.Combine(TShock.SavePath, "old_configs");
- String file2 = Path.Combine(path, "bans.txt");
- if (!Directory.Exists(path))
- Directory.CreateDirectory(path);
- if (File.Exists(file2))
- File.Delete(file2);
- File.Move(file, file2);
- }
}
public Ban GetBanByIp(string ip)
diff --git a/TShockAPI/DB/GroupManager.cs b/TShockAPI/DB/GroupManager.cs
index 763d4e29..da3ce79f 100644
--- a/TShockAPI/DB/GroupManager.cs
+++ b/TShockAPI/DB/GroupManager.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
@@ -39,45 +56,6 @@ namespace TShockAPI.DB
"ban,unban,whitelist,causeevents,spawnboss,spawnmob,managewarp,time,tp,pvpfun,kill,logs,immunetokick,tphere");
AddGroup("trustedadmin", "admin", "maintenance,cfg,butcher,item,heal,immunetoban,usebanneditem,manageusers");
AddGroup("vip", "default", "reservedslot");
-
- String file = Path.Combine(TShock.SavePath, "groups.txt");
- if (File.Exists(file))
- {
- using (StreamReader sr = new StreamReader(file))
- {
- String line;
- while ((line = sr.ReadLine()) != null)
- {
- if (!line.Equals("") && !line.Substring(0, 1).Equals("#"))
- {
- String[] info = line.Split(' ');
- String comms = "";
- int size = info.Length;
- for (int i = 1; i < size; i++)
- {
- if (!comms.Equals(""))
- comms = comms + ",";
- comms = comms + info[i].Trim();
- }
-
- string query = "";
- if (TShock.Config.StorageType.ToLower() == "sqlite")
- query = "INSERT OR IGNORE INTO GroupList (GroupName, Commands) VALUES (@0, @1);";
- else if (TShock.Config.StorageType.ToLower() == "mysql")
- query = "INSERT IGNORE INTO GroupList SET GroupName=@0, Commands=@1;";
-
- db.Query(query, info[0].Trim(), comms);
- }
- }
- }
- String path = Path.Combine(TShock.SavePath, "old_configs");
- String file2 = Path.Combine(path, "groups.txt");
- if (!Directory.Exists(path))
- Directory.CreateDirectory(path);
- if (File.Exists(file2))
- File.Delete(file2);
- File.Move(file, file2);
- }
}
diff --git a/TShockAPI/DB/IQueryBuilder.cs b/TShockAPI/DB/IQueryBuilder.cs
index f63c0790..107375da 100644
--- a/TShockAPI/DB/IQueryBuilder.cs
+++ b/TShockAPI/DB/IQueryBuilder.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
diff --git a/TShockAPI/DB/InventoryManager.cs b/TShockAPI/DB/InventoryManager.cs
index 623e9834..65b192bc 100644
--- a/TShockAPI/DB/InventoryManager.cs
+++ b/TShockAPI/DB/InventoryManager.cs
@@ -1,4 +1,4 @@
-/*
+/*
TShock, a server mod for Terraria
Copyright (C) 2011 The TShock Team
@@ -15,7 +15,6 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-
using System;
using System.Data;
using MySql.Data.MySqlClient;
diff --git a/TShockAPI/DB/ItemManager.cs b/TShockAPI/DB/ItemManager.cs
index f1ef8d67..1b84e1b7 100644
--- a/TShockAPI/DB/ItemManager.cs
+++ b/TShockAPI/DB/ItemManager.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
@@ -25,38 +42,6 @@ namespace TShockAPI.DB
? (IQueryBuilder) new SqliteQueryCreator()
: new MysqlQueryCreator());
creator.EnsureExists(table);
-
- String file = Path.Combine(TShock.SavePath, "itembans.txt");
- if (File.Exists(file))
- {
- using (StreamReader sr = new StreamReader(file))
- {
- String line;
- while ((line = sr.ReadLine()) != null)
- {
- if (!line.Equals("") && !line.Substring(0, 1).Equals("#"))
- {
- string query = (TShock.Config.StorageType.ToLower() == "sqlite")
- ? "INSERT OR IGNORE INTO 'ItemBans' (ItemName, AllowedGroups) VALUES (@0, @1);"
- : "INSERT IGNORE INTO ItemBans SET ItemName=@0,AllowedGroups=@1 ;";
-
- int id = 0;
- int.TryParse(line, out id);
-
- database.Query(query, TShock.Utils.GetItemById(id).name, "");
- }
- }
- }
-
- String path = Path.Combine(TShock.SavePath, "old_configs");
- String file2 = Path.Combine(path, "itembans.txt");
- if (!Directory.Exists(path))
- Directory.CreateDirectory(path);
- if (File.Exists(file2))
- File.Delete(file2);
- File.Move(file, file2);
- }
-
UpdateItemBans();
}
diff --git a/TShockAPI/DB/RegionManager.cs b/TShockAPI/DB/RegionManager.cs
index 63befa4a..53c99a10 100644
--- a/TShockAPI/DB/RegionManager.cs
+++ b/TShockAPI/DB/RegionManager.cs
@@ -1,4 +1,4 @@
-/*
+/*
TShock, a server mod for Terraria
Copyright (C) 2011 The TShock Team
@@ -15,7 +15,6 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-
using System;
using System.Collections.Generic;
using System.Data;
@@ -55,117 +54,9 @@ namespace TShockAPI.DB
: new MysqlQueryCreator());
creator.EnsureExists(table);
- ImportOld();
ReloadAllRegions();
}
- [SuppressMessage("Microsoft.Reliability", "CA2000:Dispose objects before losing scope")]
- public void ImportOld()
- {
- String file = Path.Combine(TShock.SavePath, "regions.xml");
- if (!File.Exists(file))
- return;
-
- Region region;
- Rectangle rect;
-
- using (var reader = XmlReader.Create(new StreamReader(file), new XmlReaderSettings {CloseInput = true}))
- {
- // Parse the file and display each of the nodes.
- while (reader.Read())
- {
- if (reader.NodeType != XmlNodeType.Element || reader.Name != "ProtectedRegion")
- continue;
-
- region = new Region();
- rect = new Rectangle();
-
- bool endregion = false;
- while (reader.Read() && !endregion)
- {
- if (reader.NodeType != XmlNodeType.Element)
- continue;
-
- string name = reader.Name;
-
- while (reader.Read() && reader.NodeType != XmlNodeType.Text) ;
-
- int t = 0;
-
- switch (name)
- {
- case "RegionName":
- region.Name = reader.Value;
- break;
- case "Point1X":
- int.TryParse(reader.Value, out t);
- rect.X = t;
- break;
- case "Point1Y":
- int.TryParse(reader.Value, out t);
- rect.Y = t;
- break;
- case "Point2X":
- int.TryParse(reader.Value, out t);
- rect.Width = t;
- break;
- case "Point2Y":
- int.TryParse(reader.Value, out t);
- rect.Height = t;
- break;
- case "Protected":
- region.DisableBuild = reader.Value.ToLower().Equals("true");
- break;
- case "WorldName":
- region.WorldID = reader.Value;
- break;
- case "AllowedUserCount":
- break;
- case "IP":
- region.AllowedIDs.Add(int.Parse(reader.Value));
- break;
- default:
- endregion = true;
- break;
- }
- }
-
- region.Area = rect;
- string query = (TShock.Config.StorageType.ToLower() == "sqlite")
- ? "INSERT OR IGNORE INTO Regions VALUES (@0, @1, @2, @3, @4, @5, @6, @7);"
- : "INSERT IGNORE INTO Regions SET X1=@0, Y1=@1, height=@2, width=@3, RegionName=@4, WorldID=@5, UserIds=@6, Protected=@7;";
- database.Query(query, region.Area.X, region.Area.Y, region.Area.Width, region.Area.Height, region.Name,
- region.WorldID, "", region.DisableBuild);
-
- //Todo: What should this be? We don't really have a way to go from ips to userids
- /*string.Join(",", region.AllowedIDs)*/
- }
- }
-
- String path = Path.Combine(TShock.SavePath, "old_configs");
- String file2 = Path.Combine(path, "regions.xml");
- if (!Directory.Exists(path))
- Directory.CreateDirectory(path);
- if (File.Exists(file2))
- File.Delete(file2);
- File.Move(file, file2);
-
- ReloadAllRegions();
- }
-
- public void ConvertDB()
- {
- try
- {
- database.Query("UPDATE Regions SET WorldID=@0, UserIds=''", Main.worldID.ToString());
- ReloadAllRegions();
- }
- catch (Exception ex)
- {
- Log.Error(ex.ToString());
- }
- }
-
public void ReloadAllRegions()
{
try
diff --git a/TShockAPI/DB/RememberPosManager.cs b/TShockAPI/DB/RememberPosManager.cs
index 4958eadf..4cc4d441 100644
--- a/TShockAPI/DB/RememberPosManager.cs
+++ b/TShockAPI/DB/RememberPosManager.cs
@@ -1,4 +1,4 @@
-/*
+/*
TShock, a server mod for Terraria
Copyright (C) 2011 The TShock Team
@@ -15,7 +15,6 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-
using System;
using System.Data;
using MySql.Data.MySqlClient;
diff --git a/TShockAPI/DB/SqlColumn.cs b/TShockAPI/DB/SqlColumn.cs
index dce163b4..75860f79 100644
--- a/TShockAPI/DB/SqlColumn.cs
+++ b/TShockAPI/DB/SqlColumn.cs
@@ -1,4 +1,21 @@
-using MySql.Data.MySqlClient;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using MySql.Data.MySqlClient;
namespace TShockAPI.DB
{
diff --git a/TShockAPI/DB/SqlTable.cs b/TShockAPI/DB/SqlTable.cs
index 8f98ef4d..ce3b527a 100644
--- a/TShockAPI/DB/SqlTable.cs
+++ b/TShockAPI/DB/SqlTable.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
diff --git a/TShockAPI/DB/SqlValue.cs b/TShockAPI/DB/SqlValue.cs
index fedb818b..35f998b6 100644
--- a/TShockAPI/DB/SqlValue.cs
+++ b/TShockAPI/DB/SqlValue.cs
@@ -1,4 +1,21 @@
-using System.Collections.Generic;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System.Collections.Generic;
using System.Data;
namespace TShockAPI.DB
diff --git a/TShockAPI/DB/UserManager.cs b/TShockAPI/DB/UserManager.cs
index bb086174..70423dfb 100644
--- a/TShockAPI/DB/UserManager.cs
+++ b/TShockAPI/DB/UserManager.cs
@@ -1,4 +1,4 @@
-/*
+/*
TShock, a server mod for Terraria
Copyright (C) 2011 The TShock Team
@@ -15,7 +15,6 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-
using System;
using System.Data;
using System.IO;
@@ -43,53 +42,6 @@ namespace TShockAPI.DB
? (IQueryBuilder) new SqliteQueryCreator()
: new MysqlQueryCreator());
creator.EnsureExists(table);
-
- String file = Path.Combine(TShock.SavePath, "users.txt");
- if (File.Exists(file))
- {
- using (StreamReader sr = new StreamReader(file))
- {
- String line;
- while ((line = sr.ReadLine()) != null)
- {
- if (line.Equals("") || line.Substring(0, 1).Equals("#"))
- continue;
- String[] info = line.Split(' ');
- String username = "";
- String sha = "";
- String group = "";
- String ip = "";
-
- String[] nameSha = info[0].Split(':');
-
- if (nameSha.Length < 2)
- {
- username = nameSha[0];
- ip = nameSha[0];
- group = info[1];
- }
- else
- {
- username = nameSha[0];
- sha = nameSha[1];
- group = info[1];
- }
-
- string query = (TShock.Config.StorageType.ToLower() == "sqlite")
- ? "INSERT OR IGNORE INTO Users (Username, Password, Usergroup, IP) VALUES (@0, @1, @2, @3)"
- : "INSERT IGNORE INTO Users SET Username=@0, Password=@1, Usergroup=@2, IP=@3";
-
- database.Query(query, username.Trim(), sha.Trim(), group.Trim(), ip.Trim());
- }
- }
- String path = Path.Combine(TShock.SavePath, "old_configs");
- String file2 = Path.Combine(path, "users.txt");
- if (!Directory.Exists(path))
- Directory.CreateDirectory(path);
- if (File.Exists(file2))
- File.Delete(file2);
- File.Move(file, file2);
- }
}
///
diff --git a/TShockAPI/DB/WarpsManager.cs b/TShockAPI/DB/WarpsManager.cs
index 174ec3f3..1627a15c 100644
--- a/TShockAPI/DB/WarpsManager.cs
+++ b/TShockAPI/DB/WarpsManager.cs
@@ -1,4 +1,4 @@
-/*
+/*
TShock, a server mod for Terraria
Copyright (C) 2011 The TShock Team
@@ -15,13 +15,10 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-
using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics.CodeAnalysis;
-using System.IO;
-using System.Xml;
using MySql.Data.MySqlClient;
using Terraria;
@@ -48,93 +45,6 @@ namespace TShockAPI.DB
? (IQueryBuilder) new SqliteQueryCreator()
: new MysqlQueryCreator());
creator.EnsureExists(table);
-
- String file = Path.Combine(TShock.SavePath, "warps.xml");
- String name = "";
- String world = "";
- int x1 = 0;
- int y1 = 0;
- if (!File.Exists(file))
- return;
-
- using (var reader = XmlReader.Create(new StreamReader(file), new XmlReaderSettings {CloseInput = true}))
- {
- // Parse the file and display each of the nodes.
- while (reader.Read())
- {
- switch (reader.NodeType)
- {
- case XmlNodeType.Element:
- switch (reader.Name)
- {
- case "Warp":
- name = "";
- world = "";
- x1 = 0;
- y1 = 0;
- break;
- case "WarpName":
- while (reader.NodeType != XmlNodeType.Text)
- reader.Read();
- name = reader.Value;
- break;
- case "X":
- while (reader.NodeType != XmlNodeType.Text)
- reader.Read();
- int.TryParse(reader.Value, out x1);
- break;
- case "Y":
- while (reader.NodeType != XmlNodeType.Text)
- reader.Read();
- int.TryParse(reader.Value, out y1);
- break;
- case "WorldName":
- while (reader.NodeType != XmlNodeType.Text)
- reader.Read();
- world = reader.Value;
- break;
- }
- break;
- case XmlNodeType.Text:
-
- break;
- case XmlNodeType.XmlDeclaration:
- case XmlNodeType.ProcessingInstruction:
- break;
- case XmlNodeType.Comment:
- break;
- case XmlNodeType.EndElement:
- if (reader.Name.Equals("Warp"))
- {
- string query = (TShock.Config.StorageType.ToLower() == "sqlite")
- ? "INSERT OR IGNORE INTO Warps VALUES (@0, @1,@2, @3);"
- : "INSERT IGNORE INTO Warps SET X=@0, Y=@1, WarpName=@2, WorldID=@3;";
- database.Query(query, x1, y1, name, world);
- }
- break;
- }
- }
- }
-
- String path = Path.Combine(TShock.SavePath, "old_configs");
- String file2 = Path.Combine(path, "warps.xml");
- if (!Directory.Exists(path))
- Directory.CreateDirectory(path);
- if (File.Exists(file2))
- File.Delete(file2);
- File.Move(file, file2);
- }
-
- public void ConvertDB()
- {
- try
- {
- database.Query("UPDATE Warps SET WorldID=@0", Main.worldID.ToString());
- }
- catch (Exception ex)
- {
- Log.Error(ex.ToString());
- }
}
public bool AddWarp(int x, int y, string name, string worldid)
diff --git a/TShockAPI/Extensions/DbExt.cs b/TShockAPI/Extensions/DbExt.cs
index e98bfd83..4cc774d0 100644
--- a/TShockAPI/Extensions/DbExt.cs
+++ b/TShockAPI/Extensions/DbExt.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System;
using System.Collections.Generic;
using System.Data;
using System.Diagnostics.CodeAnalysis;
diff --git a/TShockAPI/Extensions/LinqExt.cs b/TShockAPI/Extensions/LinqExt.cs
index 965af17e..15b26fbf 100644
--- a/TShockAPI/Extensions/LinqExt.cs
+++ b/TShockAPI/Extensions/LinqExt.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System;
using System.Collections.Generic;
namespace TShockAPI
diff --git a/TShockAPI/Extensions/RandomExt.cs b/TShockAPI/Extensions/RandomExt.cs
index b65050ee..1c702af2 100644
--- a/TShockAPI/Extensions/RandomExt.cs
+++ b/TShockAPI/Extensions/RandomExt.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System;
using System.Text;
namespace TShockAPI.Extensions
diff --git a/TShockAPI/Extensions/StringExt.cs b/TShockAPI/Extensions/StringExt.cs
index edbf05fe..95f3f20c 100644
--- a/TShockAPI/Extensions/StringExt.cs
+++ b/TShockAPI/Extensions/StringExt.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System;
namespace TShockAPI
{
diff --git a/TShockAPI/FileTools.cs b/TShockAPI/FileTools.cs
index ee05a301..3d6673ed 100644
--- a/TShockAPI/FileTools.cs
+++ b/TShockAPI/FileTools.cs
@@ -1,4 +1,4 @@
-/*
+/*
TShock, a server mod for Terraria
Copyright (C) 2011 The TShock Team
diff --git a/TShockAPI/GeoIPCountry.cs b/TShockAPI/GeoIPCountry.cs
index 0301bb00..445b348a 100644
--- a/TShockAPI/GeoIPCountry.cs
+++ b/TShockAPI/GeoIPCountry.cs
@@ -17,6 +17,23 @@
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
using System;
using System.IO;
using System.Net;
diff --git a/TShockAPI/GetDataHandlers.cs b/TShockAPI/GetDataHandlers.cs
index 279a88fa..558604ca 100644
--- a/TShockAPI/GetDataHandlers.cs
+++ b/TShockAPI/GetDataHandlers.cs
@@ -1,4 +1,4 @@
-/*
+/*
TShock, a server mod for Terraria
Copyright (C) 2011 The TShock Team
@@ -15,7 +15,6 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -401,6 +400,263 @@ namespace TShockAPI
return args.Handled;
}
+ public class ChestOpenEventArgs : HandledEventArgs
+ {
+ public int X { get; set; }
+ public int Y { get; set; }
+ }
+ public static HandlerList ChestOpen;
+
+ private static bool OnChestOpen(int x, int y)
+ {
+ if (ChestOpen == null)
+ return false;
+
+ var args = new ChestOpenEventArgs
+ {
+ X = x,
+ Y = y,
+ };
+ ChestOpen.Invoke(null, args);
+ return args.Handled;
+ }
+
+ public class ChestItemEventArgs : HandledEventArgs
+ {
+ public short ID { get; set; }
+ public byte Slot { get; set; }
+ public byte Stacks { get; set; }
+ public byte Prefix { get; set; }
+ public short Type { get; set; }
+ }
+ public static HandlerList ChestItemChange;
+
+ private static bool OnChestItemChange(short id, byte slot, byte stacks, byte prefix, short type)
+ {
+ if (PlayerSpawn == null)
+ return false;
+
+ var args = new ChestItemEventArgs
+ {
+ ID = id,
+ Slot = slot,
+ Stacks = stacks,
+ Prefix = prefix,
+ Type = type,
+ };
+ ChestItemChange.Invoke(null, args);
+ return args.Handled;
+ }
+
+ public class SignEventArgs : HandledEventArgs
+ {
+ public short ID { get; set; }
+ public int X { get; set; }
+ public int Y { get; set; }
+ }
+ public static HandlerList Sign;
+
+ private static bool OnSignEvent(short id, int x, int y)
+ {
+ if (Sign == null)
+ return false;
+
+ var args = new SignEventArgs
+ {
+ ID = id,
+ X = x,
+ Y = y,
+ };
+ Sign.Invoke(null, args);
+ return args.Handled;
+ }
+
+ public class NPCHomeChangeEventArgs : HandledEventArgs
+ {
+ public short ID { get; set; }
+ public short X { get; set; }
+ public short Y { get; set; }
+ public byte Homeless { get; set; }
+ }
+ public static HandlerList NPCHome;
+
+ private static bool OnUpdateNPCHome(short id, short x, short y, byte homeless)
+ {
+ if (NPCHome == null)
+ return false;
+
+ var args = new NPCHomeChangeEventArgs
+ {
+ ID = id,
+ X = x,
+ Y = y,
+ Homeless = homeless,
+ };
+ NPCHome.Invoke(null, args);
+ return args.Handled;
+ }
+
+ public class PlayerBuffEventArgs : HandledEventArgs
+ {
+ public byte ID { get; set; }
+ public byte Type { get; set; }
+ public short Time { get; set; }
+ }
+ public static HandlerList PlayerBuff;
+
+ private static bool OnPlayerBuff(byte id, byte type, short time)
+ {
+ if (PlayerBuff == null)
+ return false;
+
+ var args = new PlayerBuffEventArgs
+ {
+ ID = id,
+ Type = type,
+ Time = time,
+ };
+ PlayerBuff.Invoke(null, args);
+ return args.Handled;
+ }
+
+ public class ItemDropEventArgs : HandledEventArgs
+ {
+ public short ID { get; set; }
+ public Vector2 Position { get; set; }
+ public Vector2 Velocity { get; set; }
+ public byte Stacks { get; set; }
+ public byte Prefix { get; set; }
+ public short Type { get; set; }
+ }
+ public static HandlerList ItemDrop;
+
+ private static bool OnItemDrop(short id, Vector2 pos, Vector2 vel, byte stacks, byte prefix, short type)
+ {
+ if (ItemDrop == null)
+ return false;
+
+ var args = new ItemDropEventArgs
+ {
+ ID = id,
+ Position = pos,
+ Velocity = vel,
+ Stacks = stacks,
+ Prefix = prefix,
+ Type = type,
+ };
+ ItemDrop.Invoke(null, args);
+ return args.Handled;
+ }
+
+ public class PlayerDamageEventArgs : HandledEventArgs
+ {
+ public byte ID { get; set; }
+ public byte Direction { get; set; }
+ public short Damage { get; set; }
+ public byte PVP { get; set; }
+ public byte Critical { get; set; }
+ }
+ public static HandlerList PlayerDamage;
+
+ private static bool OnPlayerDamage(byte id, byte dir, short dmg, byte pvp, byte crit)
+ {
+ if (PlayerDamage == null)
+ return false;
+
+ var args = new PlayerDamageEventArgs
+ {
+ ID = id,
+ Direction = dir,
+ Damage = dmg,
+ PVP = pvp,
+ Critical = crit,
+ };
+ PlayerDamage.Invoke(null, args);
+ return args.Handled;
+ }
+
+ public class NPCStrikeEventArgs : HandledEventArgs
+ {
+ public byte ID { get; set; }
+ public byte Direction { get; set; }
+ public short Damage { get; set; }
+ public byte PVP { get; set; }
+ public byte Critical { get; set; }
+ }
+ public static HandlerList NPCStrike;
+
+ private static bool OnNPCStrike(byte id, byte dir, short dmg, byte pvp, byte crit)
+ {
+ if (NPCStrike == null)
+ return false;
+
+ var args = new NPCStrikeEventArgs
+ {
+ ID = id,
+ Direction = dir,
+ Damage = dmg,
+ PVP = pvp,
+ Critical = crit,
+ };
+ NPCStrike.Invoke(null, args);
+ return args.Handled;
+ }
+
+ public class NPCSpecialEventArgs : HandledEventArgs
+ {
+ public byte ID { get; set; }
+ public byte Type { get; set; }
+ }
+ public static HandlerList NPCSpecial;
+
+ private static bool OnNPCSpecial(byte id, byte type)
+ {
+ if (NPCSpecial == null)
+ return false;
+
+ var args = new NPCSpecialEventArgs
+ {
+ ID = id,
+ Type = type,
+ };
+ NPCSpecial.Invoke(null, args);
+ return args.Handled;
+ }
+
+ public class PlayerAnimationEventArgs : HandledEventArgs
+ {
+ }
+ public static HandlerList PlayerAnimation;
+
+ private static bool OnPlayerAnimation()
+ {
+ if (PlayerAnimation == null)
+ return false;
+
+ var args = new PlayerAnimationEventArgs {};
+ PlayerAnimation.Invoke(null, args);
+ return args.Handled;
+ }
+
+ public class PlayerBuffUpdateEventArgs : HandledEventArgs
+ {
+ public byte ID { get; set; }
+ }
+ public static HandlerList PlayerBuffUpdate;
+
+ private static bool OnPlayerBuffUpdate(byte id)
+ {
+ if (PlayerBuffUpdate == null)
+ return false;
+
+ var args = new PlayerBuffUpdateEventArgs
+ {
+ ID = id,
+ };
+ PlayerBuffUpdate.Invoke(null, args);
+ return args.Handled;
+ }
+
#endregion
public static void InitGetDataHandler()
{
@@ -1547,6 +1803,9 @@ namespace TShockAPI
var x = args.Data.ReadInt32();
var y = args.Data.ReadInt32();
+ if (OnChestOpen(x, y))
+ return true;
+
if (TShock.CheckIgnores(args.Player))
{
return true;
@@ -1573,6 +1832,9 @@ namespace TShockAPI
var prefix = args.Data.ReadInt8();
var type = args.Data.ReadInt16();
+ if (OnChestItemChange(id, slot, stacks, prefix, type))
+ return true;
+
if (args.TPlayer.chest != id)
{
return false;
@@ -1610,6 +1872,9 @@ namespace TShockAPI
var x = args.Data.ReadInt32();
var y = args.Data.ReadInt32();
+ if (OnSignEvent(id, x, y))
+ return true;
+
if (TShock.CheckTilePermission(args.Player, x, y))
{
args.Player.SendData(PacketTypes.SignNew, "", id);
@@ -1631,6 +1896,9 @@ namespace TShockAPI
var y = args.Data.ReadInt16();
var homeless = args.Data.ReadInt8();
+ if (OnUpdateNPCHome(id, x, y, homeless))
+ return true;
+
if (!args.Player.Group.HasPermission(Permissions.movenpc))
{
args.Player.SendMessage("You do not have permission to relocate NPCs.", Color.Red);
@@ -1661,6 +1929,9 @@ namespace TShockAPI
var type = args.Data.ReadInt8();
var time = args.Data.ReadInt16();
+ if (OnPlayerBuff(id, type, time))
+ return true;
+
if (TShock.CheckIgnores(args.Player))
{
args.Player.SendData(PacketTypes.PlayerBuff, "", id);
@@ -1700,6 +1971,9 @@ namespace TShockAPI
var prefix = args.Data.ReadInt8();
var type = args.Data.ReadInt16();
+ if (OnItemDrop(id, pos, vel, stacks, prefix, type))
+ return true;
+
if (type == 0) //Item removed, let client do this to prevent item duplication client side
{
return false;
@@ -1736,6 +2010,9 @@ namespace TShockAPI
var pvp = args.Data.ReadInt8();
var crit = args.Data.ReadInt8();
+ if (OnPlayerDamage(id, direction, dmg, pvp, crit))
+ return true;
+
int textlength = (int) (args.Data.Length - args.Data.Position - 1);
string deathtext = "";
if (textlength > 0)
@@ -1797,6 +2074,9 @@ namespace TShockAPI
var pvp = args.Data.ReadInt8();
var crit = args.Data.ReadInt8();
+ if (OnNPCStrike(id, direction, dmg, pvp, crit))
+ return true;
+
if (Main.npc[id] == null)
return true;
@@ -1841,6 +2121,9 @@ namespace TShockAPI
var id = args.Data.ReadInt8();
var type = args.Data.ReadInt8();
+ if (OnNPCSpecial(id, type))
+ return true;
+
if (type == 1 && TShock.Config.DisableDungeonGuardian)
{
args.Player.SendMessage("The Dungeon Guardian returned you to your spawn point", Color.Purple);
@@ -1853,6 +2136,10 @@ namespace TShockAPI
private static bool HandlePlayerAnimation(GetDataHandlerArgs args)
{
+
+ if (OnPlayerAnimation())
+ return true;
+
if (TShock.CheckIgnores(args.Player))
{
args.Player.SendData(PacketTypes.PlayerAnimation, "", args.Player.Index);
@@ -1871,6 +2158,10 @@ namespace TShockAPI
private static bool HandlePlayerBuffUpdate(GetDataHandlerArgs args)
{
var id = args.Data.ReadInt8();
+
+ if (OnPlayerBuffUpdate(id))
+ return true;
+
for (int i = 0; i < 10; i++)
{
var buff = args.Data.ReadInt8();
diff --git a/TShockAPI/Group.cs b/TShockAPI/Group.cs
index 18a84a5d..01131a5e 100644
--- a/TShockAPI/Group.cs
+++ b/TShockAPI/Group.cs
@@ -1,4 +1,4 @@
-/*
+/*
TShock, a server mod for Terraria
Copyright (C) 2011 The TShock Team
diff --git a/TShockAPI/HandlerList.cs b/TShockAPI/HandlerList.cs
index 7104b2ac..32ae94e6 100644
--- a/TShockAPI/HandlerList.cs
+++ b/TShockAPI/HandlerList.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
diff --git a/TShockAPI/IPackable.cs b/TShockAPI/IPackable.cs
index d117794d..40480fae 100644
--- a/TShockAPI/IPackable.cs
+++ b/TShockAPI/IPackable.cs
@@ -1,4 +1,4 @@
-/*
+/*
TShock, a server mod for Terraria
Copyright (C) 2011 The TShock Team
@@ -15,7 +15,6 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-
using System.IO;
namespace TShockAPI
diff --git a/TShockAPI/Log.cs b/TShockAPI/Log.cs
index bdc17c0e..4f743334 100644
--- a/TShockAPI/Log.cs
+++ b/TShockAPI/Log.cs
@@ -1,4 +1,4 @@
-/*
+/*
TShock, a server mod for Terraria
Copyright (C) 2011 The TShock Team
diff --git a/TShockAPI/Net/BaseMsg.cs b/TShockAPI/Net/BaseMsg.cs
index 1e71a6f1..8362f9c5 100644
--- a/TShockAPI/Net/BaseMsg.cs
+++ b/TShockAPI/Net/BaseMsg.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System;
using System.IO;
using System.IO.Streams;
diff --git a/TShockAPI/Net/DisconnectMsg.cs b/TShockAPI/Net/DisconnectMsg.cs
index 879d6bff..41877cf1 100644
--- a/TShockAPI/Net/DisconnectMsg.cs
+++ b/TShockAPI/Net/DisconnectMsg.cs
@@ -1,4 +1,21 @@
-using System.IO;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System.IO;
using System.IO.Streams;
using System.Text;
diff --git a/TShockAPI/Net/NetTile.cs b/TShockAPI/Net/NetTile.cs
index b1ab9c31..54a4b6eb 100644
--- a/TShockAPI/Net/NetTile.cs
+++ b/TShockAPI/Net/NetTile.cs
@@ -1,4 +1,4 @@
-/*
+/*
TShock, a server mod for Terraria
Copyright (C) 2011 The TShock Team
@@ -15,7 +15,6 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-
using System;
using System.IO;
using System.IO.Streams;
diff --git a/TShockAPI/Net/ProjectileRemoveMsg.cs b/TShockAPI/Net/ProjectileRemoveMsg.cs
index beec584c..66723f93 100644
--- a/TShockAPI/Net/ProjectileRemoveMsg.cs
+++ b/TShockAPI/Net/ProjectileRemoveMsg.cs
@@ -1,4 +1,21 @@
-using System.IO;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System.IO;
using System.IO.Streams;
namespace TShockAPI.Net
diff --git a/TShockAPI/Net/SpawnMsg.cs b/TShockAPI/Net/SpawnMsg.cs
index d49d0b5c..3a503a5a 100644
--- a/TShockAPI/Net/SpawnMsg.cs
+++ b/TShockAPI/Net/SpawnMsg.cs
@@ -1,4 +1,21 @@
-using System.IO;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System.IO;
using System.IO.Streams;
namespace TShockAPI.Net
diff --git a/TShockAPI/Net/WorldInfoMsg.cs b/TShockAPI/Net/WorldInfoMsg.cs
index 0fe02b2e..fcfc9675 100644
--- a/TShockAPI/Net/WorldInfoMsg.cs
+++ b/TShockAPI/Net/WorldInfoMsg.cs
@@ -1,4 +1,4 @@
-/*
+/*
TShock, a server mod for Terraria
Copyright (C) 2011 The TShock Team
@@ -15,7 +15,6 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-
using System;
using System.IO;
using System.IO.Streams;
diff --git a/TShockAPI/PacketBufferer.cs b/TShockAPI/PacketBufferer.cs
index 60b6e506..4bf7c7eb 100644
--- a/TShockAPI/PacketBufferer.cs
+++ b/TShockAPI/PacketBufferer.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
diff --git a/TShockAPI/Permissions.cs b/TShockAPI/Permissions.cs
index 87caffb7..85c5bce4 100644
--- a/TShockAPI/Permissions.cs
+++ b/TShockAPI/Permissions.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
diff --git a/TShockAPI/Properties/AssemblyInfo.cs b/TShockAPI/Properties/AssemblyInfo.cs
index f794aefa..76cbefd2 100644
--- a/TShockAPI/Properties/AssemblyInfo.cs
+++ b/TShockAPI/Properties/AssemblyInfo.cs
@@ -1,4 +1,21 @@
-using System.Reflection;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System.Reflection;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
@@ -31,5 +48,5 @@ using System.Runtime.InteropServices;
// Build Number
// MMdd of the build
-[assembly: AssemblyVersion("3.4.2.1231")]
-[assembly: AssemblyFileVersion("3.4.2.1231")]
\ No newline at end of file
+[assembly: AssemblyVersion("3.4.2.0101")]
+[assembly: AssemblyFileVersion("3.4.2.0101")]
\ No newline at end of file
diff --git a/TShockAPI/RconHandler.cs b/TShockAPI/RconHandler.cs
index ceaa27b0..9da51328 100644
--- a/TShockAPI/RconHandler.cs
+++ b/TShockAPI/RconHandler.cs
@@ -1,4 +1,4 @@
-/*
+/*
TShock, a server mod for Terraria
Copyright (C) 2011 The TShock Team
@@ -15,7 +15,6 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-
using System;
using System.Collections.Generic;
using System.IO;
diff --git a/TShockAPI/Resources.Designer.cs b/TShockAPI/Resources.Designer.cs
index 34060646..2d3489cd 100644
--- a/TShockAPI/Resources.Designer.cs
+++ b/TShockAPI/Resources.Designer.cs
@@ -1,4 +1,22 @@
-//------------------------------------------------------------------------------
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+
+//------------------------------------------------------------------------------
//
// This code was generated by a tool.
// Runtime Version:4.0.30319.235
diff --git a/TShockAPI/Rest/Rest.cs b/TShockAPI/Rest/Rest.cs
index 31043f8e..c8229644 100644
--- a/TShockAPI/Rest/Rest.cs
+++ b/TShockAPI/Rest/Rest.cs
@@ -1,11 +1,30 @@
-using System;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System;
using System.Collections.Generic;
+using System.ComponentModel;
using System.Net;
using System.Text;
using System.Text.RegularExpressions;
using HttpServer;
using HttpServer.Headers;
using Newtonsoft.Json;
+using TShockAPI;
using HttpListener = HttpServer.HttpListener;
namespace Rests
@@ -68,12 +87,38 @@ namespace Rests
commands.Add(com);
}
+ #region Event
+ public class RestRequestEventArgs : HandledEventArgs
+ {
+ public RequestEventArgs Request { get; set; }
+ }
+
+ public static HandlerList RestRequestEvent;
+
+ private static bool OnRestRequestCall(RequestEventArgs request)
+ {
+ if (RestRequestEvent == null)
+ return false;
+
+ var args = new RestRequestEventArgs
+ {
+ Request = request,
+ };
+ RestRequestEvent.Invoke(null, args);
+ return args.Handled;
+ }
+ #endregion
+
+
protected virtual void OnRequest(object sender, RequestEventArgs e)
{
var obj = ProcessRequest(sender, e);
if (obj == null)
throw new NullReferenceException("obj");
+ //if (OnRestRequestCall(e))
+ // return;
+
var str = JsonConvert.SerializeObject(obj, Formatting.Indented);
e.Response.Connection.Type = ConnectionType.Close;
e.Response.Body.Write(Encoding.ASCII.GetBytes(str), 0, str.Length);
diff --git a/TShockAPI/Rest/RestCommand.cs b/TShockAPI/Rest/RestCommand.cs
index f720c50d..13c6b129 100644
--- a/TShockAPI/Rest/RestCommand.cs
+++ b/TShockAPI/Rest/RestCommand.cs
@@ -1,3 +1,20 @@
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
using System.Linq;
using System.Text.RegularExpressions;
diff --git a/TShockAPI/Rest/RestManager.cs b/TShockAPI/Rest/RestManager.cs
index cbe6035b..0e30d4bc 100644
--- a/TShockAPI/Rest/RestManager.cs
+++ b/TShockAPI/Rest/RestManager.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System;
using System.Collections.Generic;
using System.Linq;
using HttpServer;
diff --git a/TShockAPI/Rest/RestObject.cs b/TShockAPI/Rest/RestObject.cs
index 610749cd..6b99d1cc 100644
--- a/TShockAPI/Rest/RestObject.cs
+++ b/TShockAPI/Rest/RestObject.cs
@@ -1,3 +1,20 @@
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
using System;
using System.Collections.Generic;
diff --git a/TShockAPI/Rest/RestVerbs.cs b/TShockAPI/Rest/RestVerbs.cs
index cda3fe21..8dd84f50 100644
--- a/TShockAPI/Rest/RestVerbs.cs
+++ b/TShockAPI/Rest/RestVerbs.cs
@@ -1,3 +1,20 @@
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
using System;
using System.Collections.Generic;
diff --git a/TShockAPI/Rest/SecureRest.cs b/TShockAPI/Rest/SecureRest.cs
index 913532cf..6af31523 100644
--- a/TShockAPI/Rest/SecureRest.cs
+++ b/TShockAPI/Rest/SecureRest.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
diff --git a/TShockAPI/StatTracker.cs b/TShockAPI/StatTracker.cs
index 9c8c9923..27ede224 100644
--- a/TShockAPI/StatTracker.cs
+++ b/TShockAPI/StatTracker.cs
@@ -1,4 +1,21 @@
-using System;
+/*
+TShock, a server mod for Terraria
+Copyright (C) 2011 The TShock Team
+
+This program is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program. If not, see .
+*/
+using System;
using System.IO;
using System.Net;
using System.Threading;
@@ -12,16 +29,16 @@ namespace TShockAPI
public DateTime lastcheck = DateTime.MinValue;
private readonly int checkinFrequency = 5;
- public void checkin()
+ public void CheckIn()
{
if ((DateTime.Now - lastcheck).TotalMinutes >= checkinFrequency)
{
- ThreadPool.QueueUserWorkItem(callHome);
+ ThreadPool.QueueUserWorkItem(CallHome);
lastcheck = DateTime.Now;
}
}
- private void callHome(object state)
+ private void CallHome(object state)
{
string fp;
string lolpath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) + "/.tshock/";
diff --git a/TShockAPI/TSPlayer.cs b/TShockAPI/TSPlayer.cs
index 044cd40d..7752778f 100644
--- a/TShockAPI/TSPlayer.cs
+++ b/TShockAPI/TSPlayer.cs
@@ -1,4 +1,4 @@
-/*
+/*
TShock, a server mod for Terraria
Copyright (C) 2011 The TShock Team
@@ -15,7 +15,6 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-
using System;
using System.Collections.Generic;
using System.IO;
diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs
index 70d1dc71..c9d1497e 100644
--- a/TShockAPI/TShock.cs
+++ b/TShockAPI/TShock.cs
@@ -1,4 +1,4 @@
-/*
+/*
TShock, a server mod for Terraria
Copyright (C) 2011 The TShock Team
@@ -15,14 +15,6 @@ GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see .
*/
-/* TShock wouldn't be possible without:
- * Github
- * Microsoft Visual Studio 2011
- * And you, for your continued support and devotion to the evolution of TShock
- * Kerplunc Gaming
- * TerrariaGSP
- * XNS Technology Group (Xenon Servers)
- */
using System;
using System.Collections.Generic;
using System.ComponentModel;
@@ -115,7 +107,7 @@ namespace TShockAPI
Directory.CreateDirectory(SavePath);
#if DEBUG
- Log.Initialize(Path.Combine(SavePath, "log.txt"), LogLevel.All, false);
+ Log.Initialize(Path.Combine(SavePath, "log.txt"), LogLevel.All, false);
#else
Log.Initialize(Path.Combine(SavePath, "log.txt"), LogLevel.All & ~LogLevel.Debug, false);
#endif
@@ -149,11 +141,11 @@ namespace TShockAPI
DB = new MySqlConnection();
DB.ConnectionString =
String.Format("Server={0}; Port={1}; Database={2}; Uid={3}; Pwd={4};",
- hostport[0],
- hostport.Length > 1 ? hostport[1] : "3306",
- Config.MySqlDbName,
- Config.MySqlUsername,
- Config.MySqlPassword
+ hostport[0],
+ hostport.Length > 1 ? hostport[1] : "3306",
+ Config.MySqlDbName,
+ Config.MySqlUsername,
+ Config.MySqlPassword
);
}
catch (MySqlException ex)
@@ -234,22 +226,22 @@ namespace TShockAPI
if (userAccount == null)
{
return new RestObject("401")
- {Error = "Invalid username/password combination provided. Please re-submit your query with a correct pair."};
+ {Error = "Invalid username/password combination provided. Please re-submit your query with a correct pair."};
}
if (Utils.HashPassword(password).ToUpper() != userAccount.Password.ToUpper())
{
return new RestObject("401")
- {Error = "Invalid username/password combination provided. Please re-submit your query with a correct pair."};
+ {Error = "Invalid username/password combination provided. Please re-submit your query with a correct pair."};
}
if (!Utils.GetGroup(userAccount.Group).HasPermission("api") && userAccount.Group != "superadmin")
{
return new RestObject("403")
- {
- Error =
- "Although your account was successfully found and identified, your account lacks the permission required to use the API. (api)"
- };
+ {
+ Error =
+ "Although your account was successfully found and identified, your account lacks the permission required to use the API. (api)"
+ };
}
return new RestObject("200") {Response = "Successful login"}; //Maybe return some user info too?
@@ -295,7 +287,7 @@ namespace TShockAPI
Log.Error(e.ExceptionObject.ToString());
if (e.ExceptionObject.ToString().Contains("Terraria.Netplay.ListenForClients") ||
- e.ExceptionObject.ToString().Contains("Terraria.Netplay.ServerLoop"))
+ e.ExceptionObject.ToString().Contains("Terraria.Netplay.ServerLoop"))
{
var sb = new List();
for (int i = 0; i < Netplay.serverSock.Length; i++)
@@ -381,9 +373,9 @@ namespace TShockAPI
}
/*
- * Hooks:
- *
- */
+ * Hooks:
+ *
+ */
public static int AuthToken = -1;
@@ -424,7 +416,7 @@ namespace TShockAPI
if (Config.RestApiEnabled)
RestApi.Start();
- StatTracker.checkin();
+ StatTracker.CheckIn();
FixChestStacks();
}
@@ -450,7 +442,7 @@ namespace TShockAPI
private void OnUpdate()
{
UpdateManager.UpdateProcedureCheck();
- StatTracker.checkin();
+ StatTracker.CheckIn();
if (Backups.IsBackupTime)
Backups.Backup();
@@ -545,7 +537,7 @@ namespace TShockAPI
foreach (Item item in player.TPlayer.inventory)
{
if (!player.Group.HasPermission(Permissions.ignorestackhackdetection) && item.stack > item.maxStack &&
- item.type != 0)
+ item.type != 0)
{
check = "Remove Item " + item.name + " (" + item.stack + ") exceeds max stack of " + item.maxStack;
}
@@ -569,14 +561,14 @@ namespace TShockAPI
player.SetBuff(23, 120); //Cursed
}
else if (!player.Group.HasPermission(Permissions.usebanneditem) &&
- Itembans.ItemIsBanned(player.TPlayer.inventory[player.TPlayer.selectedItem].name, player))
+ Itembans.ItemIsBanned(player.TPlayer.inventory[player.TPlayer.selectedItem].name, player))
{
player.SetBuff(23, 120); //Cursed
}
}
}
Console.Title = string.Format("TerrariaShock Version {0} ({1}) ({2}/{3})", Version, VersionCodename, count,
- Config.MaxSlots);
+ Config.MaxSlots);
}
private void OnConnect(int ply, HandledEventArgs handler)
@@ -752,7 +744,7 @@ namespace TShockAPI
{
count++;
TSPlayer.Server.SendMessage(string.Format("{0} ({1}) [{2}] <{3}>", player.Name, player.IP,
- player.Group.Name, player.UserAccountName));
+ player.Group.Name, player.UserAccountName));
}
}
TSPlayer.Server.SendMessage(string.Format("{0} players connected.", count));
@@ -802,7 +794,7 @@ namespace TShockAPI
}
if ((player.State < 10 || player.Dead) && (int) type > 12 && (int) type != 16 && (int) type != 42 && (int) type != 50 &&
- (int) type != 38)
+ (int) type != 38)
{
e.Handled = true;
return;
@@ -946,16 +938,16 @@ namespace TShockAPI
if (e.MsgID == PacketTypes.Disconnect)
{
Action senddisconnect = (sock, str) =>
- {
- if (sock == null || !sock.active)
- return;
- sock.kill = true;
- using (var ms = new MemoryStream())
- {
- new DisconnectMsg {Reason = str}.PackFull(ms);
- SendBytesBufferless(sock, ms.ToArray());
- }
- };
+ {
+ if (sock == null || !sock.active)
+ return;
+ sock.kill = true;
+ using (var ms = new MemoryStream())
+ {
+ new DisconnectMsg {Reason = str}.PackFull(ms);
+ SendBytesBufferless(sock, ms.ToArray());
+ }
+ };
if (e.remoteClient != -1)
{
@@ -990,8 +982,8 @@ namespace TShockAPI
}
/*
- * Useful stuff:
- * */
+ * Useful stuff:
+ * */
public static void StartInvasion()
{
@@ -1063,7 +1055,7 @@ namespace TShockAPI
}
if ((type == 42 || type == 65 || type == 68) && !player.Group.HasPermission(Permissions.usebanneditem) &&
- Itembans.ItemIsBanned("Sandgun", player)) //Sandgun Projectiles
+ Itembans.ItemIsBanned("Sandgun", player)) //Sandgun Projectiles
{
return true;
}
@@ -1101,7 +1093,7 @@ namespace TShockAPI
return true;
}
if (!player.Group.HasPermission(Permissions.editspawn) && !Regions.CanBuild(tileX, tileY, player) &&
- Regions.InArea(tileX, tileY))
+ Regions.InArea(tileX, tileY))
{
player.SendMessage("Region protected from changes.", Color.Red);
return true;
@@ -1147,9 +1139,9 @@ namespace TShockAPI
public static bool HackedHealth(TSPlayer player)
{
return (player.TPlayer.statManaMax > 400) ||
- (player.TPlayer.statMana > 400) ||
- (player.TPlayer.statLifeMax > 400) ||
- (player.TPlayer.statLife > 400);
+ (player.TPlayer.statMana > 400) ||
+ (player.TPlayer.statLifeMax > 400) ||
+ (player.TPlayer.statLife > 400);
}
public static bool HackedInventory(TSPlayer player)
@@ -1207,7 +1199,7 @@ namespace TShockAPI
if (player.TPlayer.statLifeMax > playerData.maxHealth)
{
player.SendMessage("Error: Your max health exceeded (" + playerData.maxHealth + ") which is stored on server",
- Color.Cyan);
+ Color.Cyan);
check = false;
}
@@ -1227,7 +1219,7 @@ namespace TShockAPI
item.Prefix(inventory[i].prefix);
item.AffixName();
player.SendMessage(player.IgnoreActionsForInventory = "Your item (" + item.name + ") needs to be deleted.",
- Color.Cyan);
+ Color.Cyan);
check = false;
}
else if (playerData.inventory[i].prefix != inventory[i].prefix)
@@ -1236,7 +1228,7 @@ namespace TShockAPI
item.Prefix(inventory[i].prefix);
item.AffixName();
player.SendMessage(player.IgnoreActionsForInventory = "Your item (" + item.name + ") needs to be deleted.",
- Color.Cyan);
+ Color.Cyan);
check = false;
}
else if (inventory[i].stack > playerData.inventory[i].stack)
@@ -1264,7 +1256,7 @@ namespace TShockAPI
item.Prefix(armor[i - 48].prefix);
item.AffixName();
player.SendMessage(player.IgnoreActionsForInventory = "Your armor (" + item.name + ") needs to be deleted.",
- Color.Cyan);
+ Color.Cyan);
check = false;
}
else if (playerData.inventory[i].prefix != armor[i - 48].prefix)
@@ -1273,7 +1265,7 @@ namespace TShockAPI
item.Prefix(armor[i - 48].prefix);
item.AffixName();
player.SendMessage(player.IgnoreActionsForInventory = "Your armor (" + item.name + ") needs to be deleted.",
- Color.Cyan);
+ Color.Cyan);
check = false;
}
else if (armor[i - 48].stack > playerData.inventory[i].stack)
diff --git a/TShockAPI/TShockAPI.csproj b/TShockAPI/TShockAPI.csproj
index 666b9e98..461cff5e 100644
--- a/TShockAPI/TShockAPI.csproj
+++ b/TShockAPI/TShockAPI.csproj
@@ -139,6 +139,7 @@
+
@@ -186,7 +187,7 @@
-
+