update damit claude mir nicht immer meinen mod-namen ruiniert.

This commit is contained in:
2025-11-23 20:23:53 +01:00
parent 6e856a6216
commit aa713a093a
6 changed files with 71 additions and 43 deletions

View File

@@ -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
View 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;
}
}