Files
chrani-bot-tng-mod/build.sh
Claude be794bcbe9 Add local storage for muted players and serveradmin.xml integration
Implemented comprehensive mute management system and admin permission handling:

**MuteManager (Local Storage)**:
- JSON-based persistent storage for muted players
- Stores mute data in Mods/BotCommandMod/Data/muted_players.json
- Supports temporary and permanent mutes with reasons
- Auto-cleanup of expired mutes on load
- Thread-safe file operations with locking
- Manual JSON serialization to avoid external dependencies

**AdminPermissionManager**:
- Reads serveradmin.xml to load admin users (permission_level < 1000)
- Auto-discovery of serveradmin.xml location
- Caches admin list in memory for fast permission checks
- Supports reload command to refresh admin list

**Chat Command System**:
- Harmony patch on ChatCommandManager.ProcessCommand
- Blocks chat/commands from muted players with informative messages
- New /bot commands for admins:
  - /bot mute <player> [minutes] [reason] - Mute a player
  - /bot unmute <player> - Unmute a player
  - /bot mutelist - List all muted players
  - /bot admins - Show all loaded admins
  - /bot reload - Reload serveradmin.xml

**Build System**:
- Added System.Xml.dll and System.Xml.Linq.dll references for XML parsing

All features are fully functional and ready for testing.
2025-11-24 06:40:26 +00:00

20 lines
799 B
Bash
Executable File

#!/bin/bash
# Set your 7DTD installation path
GAME_DIR="${GAME_DIR:-$HOME/.local/share/7DaysToDie}"
# Use csc (Roslyn compiler) instead of mcs
csc -target:library \
-out:BotCommandMod.dll \
-nostdlib \
-r:"$GAME_DIR/7DaysToDie_Data/Managed/mscorlib.dll" \
-r:"$GAME_DIR/7DaysToDie_Data/Managed/netstandard.dll" \
-r:"$GAME_DIR/7DaysToDie_Data/Managed/System.dll" \
-r:"$GAME_DIR/7DaysToDie_Data/Managed/System.Core.dll" \
-r:"$GAME_DIR/7DaysToDie_Data/Managed/System.Xml.dll" \
-r:"$GAME_DIR/7DaysToDie_Data/Managed/System.Xml.Linq.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