From aa713a093a768a1e13aab840341371976d4ebb61 Mon Sep 17 00:00:00 2001 From: ecv Date: Sun, 23 Nov 2025 20:23:53 +0100 Subject: [PATCH] update damit claude mir nicht immer meinen mod-namen ruiniert. --- .gitignore | 30 ++++++++++++++++++++++++++++++ CHRANIBotTNG.dll | Bin 0 -> 4096 bytes Harmony/BotCommandPatch.cs | 31 ------------------------------- Harmony/CHRANIBotTNG.cs | 29 +++++++++++++++++++++++++++++ ModInfo.xml | 16 ++++++++-------- build.sh | 8 ++++---- 6 files changed, 71 insertions(+), 43 deletions(-) create mode 100644 .gitignore create mode 100644 CHRANIBotTNG.dll delete mode 100644 Harmony/BotCommandPatch.cs create mode 100644 Harmony/CHRANIBotTNG.cs diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a731290 --- /dev/null +++ b/.gitignore @@ -0,0 +1,30 @@ +.idea/**/workspace.xml +.idea/**/tasks.xml +.idea/**/usage.statistics.xml +.idea/**/dictionaries +.idea/**/shelf +.idea/**/aws.xml +.idea/**/contentModel.xml +.idea/**/dataSources/ +.idea/**/dataSources.ids +.idea/**/dataSources.local.xml +.idea/**/sqlDataSources.xml +.idea/**/dynamic.xml +.idea/**/uiDesigner.xml +.idea/**/dbnavigator.xml +.idea/**/gradle.xml +.idea/**/libraries +cmake-build-*/ +.idea/**/mongoSettings.xml +*.iws +out/ +.idea_modules/ +atlassian-ide-plugin.xml +.idea/replstate.xml +.idea/sonarlint/ +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties +.idea/httpRequests +.idea/caches/build_file_checksums.ser diff --git a/CHRANIBotTNG.dll b/CHRANIBotTNG.dll new file mode 100644 index 0000000000000000000000000000000000000000..204a18722eae303fcda6079a5e08751b47a7dd06 GIT binary patch literal 4096 zcmeHKO>7)h68^e989U>6h!brL0zxO|$HdMsk&Oa~z>LSnG5Aj&)6;$#H}rH5 z-95nu2?Zqn#Dz#J?cUIG;0D@5Rv>;PZd^cudysNktq>AikPs4tuikXqM_xr2fDE6@mw|UU3Y0Yd@8}%W`5WHNMFrg-Kw>=)yNA2itq zkBBoodnT@7l}<6+e&Q^-Q;hy$;@x-xOSleY(g(1C_l%oKe~)3@sx68b$RgQT!Ypqy3G@7nw$8O*+ zD$icmRJ5gEZ27UUsK@_`Al!}tv3hf%Gu&TnduA`!)P;6dCN|sf2>=^U4 z#~20{LUqPn$CQdE*Ok+XX_f|oVzP63vkyOt3Qy=FPu(0(**F5kJdtyl!XIH_hP;hc zo;4qJ;8urxgXhlS2@k39sj2BXv9>5s8_*uZKhLic+uqv}9~RJ8g`(%P8l&&gBqE6g zJMI#U7nk39>F@oc<=50-@9G=uE+bg4h@W0zjmM%V8|#@utH|8^=2{q_R(%iXbL?mH3M z&AGszTz6Dcc6@0q44#Y(+I8!uSv64Y*y0f@Eq${8Bi6DCBThV4ACW~CB@6P`C~ zyMDWGmD0yqw3lz95B)W9rI+7=L~efIYT(@VY}#+l;=hrLoqRhyR02-&g_pufbByFN zs#qbOWdBszJ@f3F6^?Vbul?194>Di>{*vuU+aOtW!~pO)OnUc9Pk+%iMWnwmb|Gtk5k_Qe zt~|ljBlf%aX>MD`qHU3_v1PlgyEf{GrO3Nt>yZz%e%ebmv9|RYyT^Ljyf+m6{inOA zz _recipientEntityIds) - { - if (_msg != null && _msg.StartsWith("/bot ")) - { - string playerName = _cInfo != null ? _cInfo.playerName : "Server"; - Console.WriteLine($"[Bot] {playerName}: {_msg}"); - return false; - } - return true; - } -} diff --git a/Harmony/CHRANIBotTNG.cs b/Harmony/CHRANIBotTNG.cs new file mode 100644 index 0000000..76b71cb --- /dev/null +++ b/Harmony/CHRANIBotTNG.cs @@ -0,0 +1,29 @@ +using HarmonyLib; +using System.Reflection; +using System; + +public class CHRANIBotTNG : IModApi +{ + public void InitMod(Mod _modInstance) + { + Console.WriteLine("[CHRANIBotTNG] Loading"); + var harmony = new Harmony("com.chranibottng.mod"); + harmony.PatchAll(Assembly.GetExecutingAssembly()); + Console.WriteLine("[CHRANIBotTNG] Loaded"); + } +} + +[HarmonyPatch(typeof(ChatCommandManager), "ProcessCommand")] +public class ChatCommandPatch +{ + static bool Prefix(ChatCommandManager __instance, string _chatText, ClientInfo _cInfo) + { + if (_chatText != null && _chatText.StartsWith("/bot ")) + { + string playerName = _cInfo != null ? _cInfo.playerName : "Server"; + Console.WriteLine($"[Bot] {playerName}: {_chatText}"); + return false; + } + return true; + } +} \ No newline at end of file diff --git a/ModInfo.xml b/ModInfo.xml index c070ccf..68b39b7 100644 --- a/ModInfo.xml +++ b/ModInfo.xml @@ -1,9 +1,9 @@ - + - - - - - - - + + + + + + + \ No newline at end of file diff --git a/build.sh b/build.sh index 9cf126c..88cd9be 100755 --- a/build.sh +++ b/build.sh @@ -1,11 +1,11 @@ #!/bin/bash # Set your 7DTD installation path -GAME_DIR="${GAME_DIR:-$HOME/.local/share/7DaysToDie}" +GAME_DIR="${GAME_DIR:-$HOME/Software/SteamLibrary/steamapps/common/7 Days To Die}" # Use csc (Roslyn compiler) instead of mcs csc -target:library \ - -out:BotCommandMod.dll \ + -out:CHRANIBotTNG.dll \ -nostdlib \ -r:"$GAME_DIR/7DaysToDie_Data/Managed/mscorlib.dll" \ -r:"$GAME_DIR/7DaysToDie_Data/Managed/netstandard.dll" \ @@ -13,5 +13,5 @@ csc -target:library \ -r:"$GAME_DIR/7DaysToDie_Data/Managed/System.Core.dll" \ -r:"$GAME_DIR/7DaysToDie_Data/Managed/Assembly-CSharp.dll" \ -r:"$GAME_DIR/7DaysToDie_Data/Managed/UnityEngine.CoreModule.dll" \ - -r:"$GAME_DIR/7DaysToDie_Data/Managed/0Harmony.dll" \ - Harmony/BotCommandPatch.cs + -r:"/home/ecv/Software/SteamLibrary/steamapps/common/7 Days To Die/Mods/0_TFP_Harmony/0Harmony.dll" \ + Harmony/CHRANIBotTNG.cs