From e125aa619776979e38a330b1f820d65af733f29c Mon Sep 17 00:00:00 2001 From: Maverick Motherfucker Date: Mon, 30 May 2011 01:16:41 -0700 Subject: [PATCH 1/2] Got debug and compile working in this motherfucker --- .gitignore | 6 ++++-- TShockAPI/TShockAPI.csproj | 2 +- ...gnTimeResolveAssemblyReferencesInput.cache | Bin 6155 -> 6012 bytes Terraria.csproj | 3 ++- 4 files changed, 7 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index e110c69f..e8a43a80 100644 --- a/.gitignore +++ b/.gitignore @@ -6,8 +6,10 @@ *.exe *.o *.so -/bin/* -/obj/* +*/bin/* +*/obj/* +bin/* +obj/* # Packages # ############ diff --git a/TShockAPI/TShockAPI.csproj b/TShockAPI/TShockAPI.csproj index 5482ca86..d6b31217 100644 --- a/TShockAPI/TShockAPI.csproj +++ b/TShockAPI/TShockAPI.csproj @@ -17,7 +17,7 @@ true full false - bin\Debug\ + ..\..\Program Files %28x86%29\Steam\steamapps\common\terraria\plugins\ DEBUG;TRACE prompt 4 diff --git a/TShockAPI/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache b/TShockAPI/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache index 303b254c1e9d2b9739a4b79cf23c65fa3ffd984b..8ace54954534e859ba54f28c327a5dc300f320a7 100644 GIT binary patch delta 313 zcmeA+_@lRBKL?k)vsFw;a7KP|_U3;amW&D2Kz?{;UP^v>ag1+fa#4P9ep-p1UusEA zVsUY5Zct?&mbl!H7&I$H7_}}I3_$ZFD1XcIHtnFZ1P$zNzRm<95zV?28Ke4 z&63^B#{G`TK9n+_P5#F#V;@188Jku3^4WreDKjJ{Bse2KIomP7GbSlB4;V2?rRke5 IiL7D*08Ch4 - lbolt.ico + + From 314613ef234698348ffda2c217fe0293a83a7083 Mon Sep 17 00:00:00 2001 From: Maverick Motherfucker Date: Mon, 30 May 2011 01:47:14 -0700 Subject: [PATCH 2/2] Got anti tile greif semi working --- TShockAPI/TShock.cs | 36 +++++++++++++++++++++++++++++++++++- 1 file changed, 35 insertions(+), 1 deletion(-) diff --git a/TShockAPI/TShock.cs b/TShockAPI/TShock.cs index e92b8120..fc755e77 100644 --- a/TShockAPI/TShock.cs +++ b/TShockAPI/TShock.cs @@ -12,6 +12,8 @@ namespace TShockAPI { public class TShock : TerrariaPlugin { + private uint[] tileThreshold = new uint[Main.maxPlayers]; + public static string saveDir = "./tshock/"; public override Version Version @@ -41,12 +43,29 @@ namespace TShockAPI GameHooks.OnUpdate += new Action(OnUpdate); GameHooks.OnLoadContent += new Action(OnLoadContent); ServerHooks.OnChat += new Action(OnChat); + NetHooks.OnPreGetData += GetData; } /* * Hooks: * */ + void GetData(byte id, messageBuffer msg, int idx, int length, HandledEventArgs e) + { + int n = 5; + byte[] buf = msg.readBuffer; + if (id == 17) + { + byte type = buf[n]; + n++; + if (type == 0) + { + tileThreshold[msg.whoAmI]++; + } + } + return; + } + void OnChat(int ply, string msg, HandledEventArgs handler) { if (IsAdmin(ply)) @@ -92,7 +111,22 @@ namespace TShockAPI void OnUpdate(GameTime time) { - + for (uint i = 0; i < Main.maxPlayers; i++) + { + if (tileThreshold[i] >= 5) + { + if (Main.player[i] != null) + { + WriteGrief((int)i); + Kick((int)i, "Fuck you bomb spam or some other fucking shit"); + } + tileThreshold[i] = 0; + } + else if (tileThreshold[i] > 0) + { + tileThreshold[i]--; + } + } } /*