update damit claude mir nicht immer meinen mod-namen ruiniert.
This commit is contained in:
30
.gitignore
vendored
Normal file
30
.gitignore
vendored
Normal file
@@ -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
|
||||||
BIN
CHRANIBotTNG.dll
Normal file
BIN
CHRANIBotTNG.dll
Normal file
Binary file not shown.
@@ -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<int> _recipientEntityIds)
|
|
||||||
{
|
|
||||||
if (_msg != null && _msg.StartsWith("/bot "))
|
|
||||||
{
|
|
||||||
string playerName = _cInfo != null ? _cInfo.playerName : "Server";
|
|
||||||
Console.WriteLine($"[Bot] {playerName}: {_msg}");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
29
Harmony/CHRANIBotTNG.cs
Normal file
29
Harmony/CHRANIBotTNG.cs
Normal file
@@ -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;
|
||||||
|
}
|
||||||
|
}
|
||||||
14
ModInfo.xml
14
ModInfo.xml
@@ -1,9 +1,9 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8" ?>
|
||||||
<xml>
|
<xml>
|
||||||
<ModInfo>
|
<Name value="CHRANIBotTNG" />
|
||||||
<Name value="BotCommandMod"/>
|
<DisplayName value="CHRANI-Bot-TNG" />
|
||||||
<Description value="Intercepts chat messages starting with /bot and logs them to telnet only"/>
|
<Description value="Companion Mod for the CHRANI-Bot-TNG" />
|
||||||
<Author value="Claude"/>
|
<Author value="wwevo" />
|
||||||
<Version value="1.0.0"/>
|
<Version value="2.0.0.0" />
|
||||||
</ModInfo>
|
<Website value="https://code.notjustfor.me/wwevo/chrani-bot-tng-mod" />
|
||||||
</xml>
|
</xml>
|
||||||
8
build.sh
8
build.sh
@@ -1,11 +1,11 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
# Set your 7DTD installation path
|
# 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
|
# Use csc (Roslyn compiler) instead of mcs
|
||||||
csc -target:library \
|
csc -target:library \
|
||||||
-out:BotCommandMod.dll \
|
-out:CHRANIBotTNG.dll \
|
||||||
-nostdlib \
|
-nostdlib \
|
||||||
-r:"$GAME_DIR/7DaysToDie_Data/Managed/mscorlib.dll" \
|
-r:"$GAME_DIR/7DaysToDie_Data/Managed/mscorlib.dll" \
|
||||||
-r:"$GAME_DIR/7DaysToDie_Data/Managed/netstandard.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/System.Core.dll" \
|
||||||
-r:"$GAME_DIR/7DaysToDie_Data/Managed/Assembly-CSharp.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/UnityEngine.CoreModule.dll" \
|
||||||
-r:"$GAME_DIR/7DaysToDie_Data/Managed/0Harmony.dll" \
|
-r:"/home/ecv/Software/SteamLibrary/steamapps/common/7 Days To Die/Mods/0_TFP_Harmony/0Harmony.dll" \
|
||||||
Harmony/BotCommandPatch.cs
|
Harmony/CHRANIBotTNG.cs
|
||||||
|
|||||||
Reference in New Issue
Block a user