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 0000000..204a187 Binary files /dev/null and b/CHRANIBotTNG.dll differ diff --git a/Harmony/BotCommandPatch.cs b/Harmony/BotCommandPatch.cs deleted file mode 100644 index 2637e1c..0000000 --- a/Harmony/BotCommandPatch.cs +++ /dev/null @@ -1,31 +0,0 @@ -using HarmonyLib; -using System.Reflection; -using System.Collections.Generic; -using System; - -public class BotCommandMod : IModApi -{ - public void InitMod(Mod _modInstance) - { - Console.WriteLine("[BotCommandMod] Loading"); - var harmony = new Harmony("com.botcommand.mod"); - harmony.PatchAll(Assembly.GetExecutingAssembly()); - Console.WriteLine("[BotCommandMod] Loaded"); - } -} - -[HarmonyPatch(typeof(GameManager))] -[HarmonyPatch("ChatMessageServer")] -public class ChatMessagePatch -{ - static bool Prefix(ClientInfo _cInfo, EChatType _type, int _senderId, string _msg, string _mainName, bool _localizeMain, List _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