playerbots fixes

This commit is contained in:
Deckard
2025-10-15 02:06:37 -04:00
parent 209c84f3b6
commit c4815cf17f
28 changed files with 370 additions and 45 deletions

0
scripts/auto-post-install.sh Executable file → Normal file
View File

0
scripts/backup-daily.sh Executable file → Normal file
View File

0
scripts/backup-hourly.sh Executable file → Normal file
View File

0
scripts/backup.sh Executable file → Normal file
View File

0
scripts/cleanup.sh Executable file → Normal file
View File

0
scripts/configure-modules.sh Executable file → Normal file
View File

28
scripts/db-import-conditional.sh Executable file → Normal file
View File

@@ -153,6 +153,34 @@ if [ -z "$backup_path" ] && [ -d "$BACKUP_DIRS" ]; then
fi
else
echo "📅 No daily backup directory found"
# Check for timestamped backup directories (legacy format: YYYYMMDD_HHMMSS)
echo "🔍 Checking for timestamped backup directories..."
timestamped_backups=$(ls -1t $BACKUP_DIRS 2>/dev/null | grep -E '^[0-9]{8}_[0-9]{6}$' | head -n 1)
if [ -n "$timestamped_backups" ]; then
latest_timestamped="$timestamped_backups"
echo "📦 Found timestamped backup: $latest_timestamped"
if [ -d "$BACKUP_DIRS/$latest_timestamped" ]; then
# Check if directory has .sql.gz files
if ls "$BACKUP_DIRS/$latest_timestamped"/*.sql.gz >/dev/null 2>&1; then
# Validate at least one backup file has content
echo "🔍 Validating timestamped backup content..."
for backup_file in "$BACKUP_DIRS/$latest_timestamped"/*.sql.gz; do
if [ -f "$backup_file" ] && [ -s "$backup_file" ]; then
# Use timeout to prevent hanging on zcat
if timeout 10 zcat "$backup_file" 2>/dev/null | head -20 | grep -q "CREATE DATABASE\|INSERT INTO\|CREATE TABLE"; then
echo "✅ Valid timestamped backup found: $(basename $backup_file)"
backup_path="$BACKUP_DIRS/$latest_timestamped"
break
fi
fi
done
else
echo "⚠️ No .sql.gz files found in timestamped backup directory"
fi
fi
else
echo "📅 No timestamped backup directories found"
fi
fi
else
echo "📁 Backup directory is empty"

0
scripts/db-init-enhanced.sh Executable file → Normal file
View File

0
scripts/deploy-and-check-distrobox.sh Executable file → Normal file
View File

0
scripts/deploy-and-check.sh Executable file → Normal file
View File

0
scripts/post-install-setup.sh Executable file → Normal file
View File

0
scripts/rebuild-with-modules.sh Executable file → Normal file
View File

0
scripts/restore.sh Executable file → Normal file
View File

0
scripts/setup-eluna.sh Executable file → Normal file
View File

0
scripts/setup-server.sh Executable file → Normal file
View File

0
scripts/status.sh Executable file → Normal file
View File

0
scripts/test-backup-detection-enhanced.sh Executable file → Normal file
View File

0
scripts/test-backup-detection.sh Executable file → Normal file
View File

0
scripts/test-local-worldserver.sh Executable file → Normal file
View File

View File

@@ -0,0 +1,96 @@
#!/bin/bash
# ==============================================
# Playerbots Toggle Script
# ==============================================
# Simple script to enable/disable playerbots without rebuilding
set -e
# Colors for output
RED='\033[0;31m'
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
BLUE='\033[0;34m'
NC='\033[0m' # No Color
# Function to print colored output
print_status() {
local status=$1
local message=$2
case $status in
"INFO")
echo -e "${BLUE} ${message}${NC}"
;;
"SUCCESS")
echo -e "${GREEN}${message}${NC}"
;;
"WARNING")
echo -e "${YELLOW}⚠️ ${message}${NC}"
;;
"ERROR")
echo -e "${RED}${message}${NC}"
;;
esac
}
# Change to project root
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
cd "$PROJECT_ROOT"
ENV_FILE="docker-compose-azerothcore-services.env"
if [ ! -f "$ENV_FILE" ]; then
print_status "ERROR" "Environment file not found: $ENV_FILE"
exit 1
fi
# Check current state
current_state=$(grep "^MODULE_PLAYERBOTS=" "$ENV_FILE" | cut -d'=' -f2)
current_authserver=$(grep "^AC_AUTHSERVER_IMAGE=" "$ENV_FILE" | cut -d'=' -f2)
if [[ "$current_authserver" == *"playerbots"* ]]; then
is_playerbots_active=true
else
is_playerbots_active=false
fi
print_status "INFO" "CURRENT PLAYERBOTS STATUS"
echo "Module Setting: MODULE_PLAYERBOTS=$current_state"
echo "Active Images: $(if $is_playerbots_active; then echo "Playerbots"; else echo "Standard AzerothCore"; fi)"
echo ""
if [ "$1" = "status" ]; then
exit 0
fi
# Toggle logic
if $is_playerbots_active; then
print_status "WARNING" "Disabling playerbots (switching to standard AzerothCore images)"
# Switch to standard images
sed -i.bak \
-e 's/^AC_AUTHSERVER_IMAGE=uprightbass360.*/AC_AUTHSERVER_IMAGE=acore\/ac-wotlk-authserver:14.0.0-dev/' \
-e 's/^AC_WORLDSERVER_IMAGE=uprightbass360.*/AC_WORLDSERVER_IMAGE=acore\/ac-wotlk-worldserver:14.0.0-dev/' \
-e 's/^MODULE_PLAYERBOTS=1/MODULE_PLAYERBOTS=0/' \
"$ENV_FILE"
print_status "SUCCESS" "Playerbots disabled"
else
print_status "INFO" "Enabling playerbots (switching to pre-built playerbots images)"
# Switch to playerbots images
sed -i.bak \
-e 's/^AC_AUTHSERVER_IMAGE=acore.*/AC_AUTHSERVER_IMAGE=uprightbass360\/azerothcore-wotlk-playerbots:authserver-Playerbot/' \
-e 's/^AC_WORLDSERVER_IMAGE=acore.*/AC_WORLDSERVER_IMAGE=uprightbass360\/azerothcore-wotlk-playerbots:worldserver-Playerbot/' \
-e 's/^MODULE_PLAYERBOTS=0/MODULE_PLAYERBOTS=1/' \
"$ENV_FILE"
print_status "SUCCESS" "Playerbots enabled"
fi
print_status "INFO" "To apply changes, redeploy the services:"
echo " docker compose --env-file $ENV_FILE -f docker-compose-azerothcore-services.yml up -d"
echo ""
print_status "INFO" "No rebuild required - using pre-built images!"

0
scripts/update-config.sh Executable file → Normal file
View File

0
scripts/update-realmlist.sh Executable file → Normal file
View File

0
scripts/wait-and-start-worldserver.sh Executable file → Normal file
View File