From 13fc1b7e665f31f621f3794e64944ffe2f223ac6 Mon Sep 17 00:00:00 2001 From: Deckard Date: Sat, 4 Oct 2025 22:35:48 -0400 Subject: [PATCH] eluna fixes --- docker-compose-azerothcore-services.env | 4 +- docker-compose-azerothcore-services.yml | 59 ++++++++----- scripts/setup-eluna.sh | 106 ++++++++++++++++++++++++ 3 files changed, 148 insertions(+), 21 deletions(-) diff --git a/docker-compose-azerothcore-services.env b/docker-compose-azerothcore-services.env index 3ad813a..f6a3912 100644 --- a/docker-compose-azerothcore-services.env +++ b/docker-compose-azerothcore-services.env @@ -20,7 +20,9 @@ WORLD_EXTERNAL_PORT=8215 SOAP_EXTERNAL_PORT=7778 # Server address for client connections (production) -SERVER_ADDRESS=192.168.0.188 +# SERVER_ADDRESS=192.168.0.188 +# Server address for client connections (local) +SERVER_ADDRESS=127.0.0.1 # Use WORLD_EXTERNAL_PORT for realmlist (client connection port) REALM_PORT=8215 diff --git a/docker-compose-azerothcore-services.yml b/docker-compose-azerothcore-services.yml index 8b54da1..c5ffcfb 100644 --- a/docker-compose-azerothcore-services.yml +++ b/docker-compose-azerothcore-services.yml @@ -274,7 +274,14 @@ services: image: ${AC_ELUNA_IMAGE} pull_policy: ${IMAGE_PULL_POLICY} container_name: ${CONTAINER_ELUNA} - user: "0:0" # Run as root to handle NFS permissions + command: npm run dev + volumes: + # TypeScript source files (input) + - ${STORAGE_PATH}/typescript:/eluna-ts/src + # Compiled Lua scripts (output) + - ${STORAGE_PATH}/lua_scripts:/eluna-ts/dist + environment: + - ELUNATS_BUILD_FILE=${ELUNATS_BUILD_FILE:-index.ts} restart: unless-stopped networks: - azerothcore @@ -721,27 +728,39 @@ services: fi if [ "$MODULE_ASSISTANT" = "1" ] && [ ! -d "mod-assistant" ]; then echo '๐Ÿค– Installing mod-assistant...' - echo ' ๐Ÿ“– Project: https://github.com/azerothcore/mod-assistant' - echo ' โ„น๏ธ Provides AI-powered assistance and automation features' + echo ' ๐Ÿ“– Project: https://github.com/noisiver/mod-assistant' + echo ' โ„น๏ธ NPC (ID: 9000000) providing heirlooms, glyphs, gems, profession services' echo ' ๐Ÿ”ง REBUILD REQUIRED: Container must be rebuilt with source-based compilation' echo ' ๐Ÿ”ฌ STATUS: IN TESTING - Currently under verification' - git clone https://github.com/azerothcore/mod-assistant.git mod-assistant + git clone https://github.com/noisiver/mod-assistant.git mod-assistant fi if [ "$MODULE_REAGENT_BANK" = "1" ] && [ ! -d "mod-reagent-bank" ]; then echo '๐Ÿฆ Installing mod-reagent-bank...' - echo ' ๐Ÿ“– Project: https://github.com/azerothcore/mod-reagent-bank' - echo ' โ„น๏ธ Adds reagent bank functionality similar to retail WoW' + echo ' ๐Ÿ“– Project: https://github.com/ZhengPeiRu21/mod-reagent-bank' + echo ' โ„น๏ธ Reagent banker NPC for storing crafting materials, frees bag space' echo ' ๐Ÿ”ง REBUILD REQUIRED: Container must be rebuilt with source-based compilation' echo ' ๐Ÿ”ฌ STATUS: IN TESTING - Currently under verification' - git clone https://github.com/azerothcore/mod-reagent-bank.git mod-reagent-bank + git clone https://github.com/ZhengPeiRu21/mod-reagent-bank.git mod-reagent-bank fi if [ "$MODULE_BLACK_MARKET_AUCTION_HOUSE" = "1" ] && [ ! -d "mod-black-market" ]; then echo '๐Ÿดโ€โ˜ ๏ธ Installing mod-black-market...' - echo ' ๐Ÿ“– Project: https://github.com/azerothcore/mod-black-market' - echo ' โ„น๏ธ Black Market Auction House for rare and unique items' - echo ' ๐Ÿ”ง REBUILD REQUIRED: Container must be rebuilt with source-based compilation' + echo ' ๐Ÿ“– Project: https://github.com/Youpeoples/Black-Market-Auction-House' + echo ' โ„น๏ธ MoP Black Market Auction House backported using Eluna Lua engine' + echo ' โš ๏ธ SPECIAL MODULE: Uses Lua scripts, not C++ compilation' + echo ' ๐Ÿ”ง REQUIRES: mod-eluna must be enabled and functional' echo ' ๐Ÿ”ฌ STATUS: IN TESTING - Currently under verification' - git clone https://github.com/azerothcore/mod-black-market.git mod-black-market + git clone https://github.com/Youpeoples/Black-Market-Auction-House.git mod-black-market + + # Special handling: Copy Lua scripts to lua_scripts directory + if [ "$MODULE_ELUNA" = "1" ] && [ -d "mod-black-market/Server Files/lua_scripts" ]; then + echo ' ๐Ÿ”ง Integrating Black Market Lua scripts with mod-eluna...' + mkdir -p /azerothcore/lua_scripts + cp -r mod-black-market/Server\ Files/lua_scripts/* /azerothcore/lua_scripts/ 2>/dev/null || true + echo ' โœ… Black Market Lua scripts copied to /azerothcore/lua_scripts directory' + ls -la /azerothcore/lua_scripts/ | grep -E "\\.lua$" || echo " โ„น๏ธ No .lua files found after copy" + else + echo ' โš ๏ธ WARNING: mod-eluna not enabled - Black Market will not function' + fi fi echo 'Managing configuration files...' @@ -820,7 +839,7 @@ services: fi if [ "$MODULE_ELUNA" != "1" ]; then - rm -f /azerothcore/env/dist/etc/mod_LuaEngine.conf* + rm -f /azerothcore/env/dist/etc/mod_eluna.conf* fi if [ "$MODULE_ARAC" != "1" ]; then rm -f /azerothcore/env/dist/etc/arac.conf* @@ -899,7 +918,7 @@ services: if [ -d "$$module_dir/data/sql/world" ]; then find "$$module_dir/data/sql/world" -name "*.sql" -type f | while read sql_file; do echo " Executing world SQL: $$(basename "$$sql_file")" - if mysql --skip-ssl-verify -h "${CONTAINER_MYSQL}" -P 3306 -u root -p"${MYSQL_ROOT_PASSWORD}" "${DB_WORLD_NAME}" < "$$sql_file" >/dev/null 2>&1; then + if mariadb --ssl=false -h "${CONTAINER_MYSQL}" -P 3306 -u root -p"${MYSQL_ROOT_PASSWORD}" "${DB_WORLD_NAME}" < "$$sql_file" >/dev/null 2>&1; then echo " โœ… Successfully executed $$(basename "$$sql_file")" else echo " โŒ Failed to execute $$sql_file" @@ -911,7 +930,7 @@ services: if [ -d "$$module_dir/data/sql/auth" ]; then find "$$module_dir/data/sql/auth" -name "*.sql" -type f | while read sql_file; do echo " Executing auth SQL: $$(basename "$$sql_file")" - if mysql --skip-ssl-verify -h "${CONTAINER_MYSQL}" -P 3306 -u root -p"${MYSQL_ROOT_PASSWORD}" "${DB_AUTH_NAME}" < "$$sql_file" >/dev/null 2>&1; then + if mariadb --ssl=false -h "${CONTAINER_MYSQL}" -P 3306 -u root -p"${MYSQL_ROOT_PASSWORD}" "${DB_AUTH_NAME}" < "$$sql_file" >/dev/null 2>&1; then echo " โœ… Successfully executed $$(basename "$$sql_file")" else echo " โŒ Failed to execute $$sql_file" @@ -923,7 +942,7 @@ services: if [ -d "$$module_dir/data/sql/characters" ]; then find "$$module_dir/data/sql/characters" -name "*.sql" -type f | while read sql_file; do echo " Executing characters SQL: $$(basename "$$sql_file")" - if mysql --skip-ssl-verify -h "${CONTAINER_MYSQL}" -P 3306 -u root -p"${MYSQL_ROOT_PASSWORD}" "${DB_CHARACTERS_NAME}" < "$$sql_file" >/dev/null 2>&1; then + if mariadb --ssl=false -h "${CONTAINER_MYSQL}" -P 3306 -u root -p"${MYSQL_ROOT_PASSWORD}" "${DB_CHARACTERS_NAME}" < "$$sql_file" >/dev/null 2>&1; then echo " โœ… Successfully executed $$(basename "$$sql_file")" else echo " โŒ Failed to execute $$sql_file" @@ -947,10 +966,10 @@ services: fi } - # Install MySQL client if not available - which mysql >/dev/null 2>&1 || { - echo "Installing MySQL client..." - apk add --no-cache mysql-client >/dev/null 2>&1 || echo "Warning: Could not install MySQL client" + # Install MariaDB client if not available + which mariadb >/dev/null 2>&1 || { + echo "Installing MariaDB client..." + apk add --no-cache mariadb-client >/dev/null 2>&1 || echo "Warning: Could not install MariaDB client" } # Execute SQL for enabled modules only @@ -1143,7 +1162,7 @@ services: [ "$MODULE_LEVEL_GRANT" = "1" ] && ENABLED_MODULES="$ENABLED_MODULES mod-quest-count-level" [ "$MODULE_ASSISTANT" = "1" ] && ENABLED_MODULES="$ENABLED_MODULES mod-assistant" [ "$MODULE_REAGENT_BANK" = "1" ] && ENABLED_MODULES="$ENABLED_MODULES mod-reagent-bank" - [ "$MODULE_BLACK_MARKET_AUCTION_HOUSE" = "1" ] && ENABLED_MODULES="$ENABLED_MODULES mod-black-market" + # Note: mod-black-market is Lua-based, doesn't need C++ compilation if [ -n "$ENABLED_MODULES" ]; then ENABLED_COUNT=$(echo $ENABLED_MODULES | wc -w) diff --git a/scripts/setup-eluna.sh b/scripts/setup-eluna.sh index 1015181..1abd26d 100755 --- a/scripts/setup-eluna.sh +++ b/scripts/setup-eluna.sh @@ -67,6 +67,17 @@ else print_status "INFO" "lua_scripts directory already exists" fi +# Create typescript directory for ac-eluna container +TYPESCRIPT_DIR="${STORAGE_PATH}/typescript" +print_status "INFO" "Creating TypeScript scripts directory: $TYPESCRIPT_DIR" + +if [ ! -d "$TYPESCRIPT_DIR" ]; then + mkdir -p "$TYPESCRIPT_DIR" + print_status "SUCCESS" "Created typescript directory" +else + print_status "INFO" "typescript directory already exists" +fi + # Create example scripts print_status "HEADER" "CREATING EXAMPLE LUA SCRIPTS" @@ -218,6 +229,85 @@ EOF print_status "SUCCESS" "Created init.lua loader script" +# Create TypeScript example +print_status "HEADER" "CREATING TYPESCRIPT EXAMPLE" + +cat > "$TYPESCRIPT_DIR/index.ts" << 'EOF' +// ============================================== +// TypeScript Example for AzerothCore Eluna-TS +// ============================================== +// This TypeScript file will be compiled to Lua by ac-eluna container + +// Event constants +const PLAYER_EVENT_ON_LOGIN = 3; +const PLAYER_EVENT_ON_LEVEL_CHANGE = 13; + +// Welcome message for players +function OnPlayerLogin(event: number, player: Player): void { + const playerName = player.GetName(); + const playerLevel = player.GetLevel(); + + player.SendBroadcastMessage( + `|cff00ff00Welcome ${playerName}! You are level ${playerLevel}.|r` + ); + player.SendBroadcastMessage( + "|cffyellow๐Ÿš€ This server supports TypeScript scripting via Eluna-TS!|r" + ); + + print(`TypeScript: Player ${playerName} logged in at level ${playerLevel}`); +} + +// Level up rewards +function OnPlayerLevelUp(event: number, player: Player, oldLevel: number): void { + const newLevel = player.GetLevel(); + const playerName = player.GetName(); + + if (newLevel <= oldLevel) { + return; + } + + player.SendBroadcastMessage( + `|cffff6600Congratulations on reaching level ${newLevel}!|r` + ); + + // Milestone rewards + const rewards: { [key: number]: { gold?: number; message: string } } = { + 10: { gold: 100, message: "1 gold for reaching level 10!" }, + 20: { gold: 500, message: "5 gold for reaching level 20!" }, + 30: { gold: 1000, message: "10 gold for reaching level 30!" }, + 40: { gold: 2000, message: "20 gold for reaching level 40!" }, + 50: { gold: 5000, message: "50 gold for reaching level 50!" }, + 60: { gold: 10000, message: "100 gold for reaching the original cap!" }, + 70: { gold: 20000, message: "200 gold for reaching TBC cap!" }, + 80: { gold: 50000, message: "500 gold for reaching max level!" } + }; + + const reward = rewards[newLevel]; + if (reward) { + if (reward.gold) { + player.ModifyMoney(reward.gold * 10000); // Convert to copper + } + player.SendBroadcastMessage(`|cffff0000${reward.message}|r`); + + if (newLevel >= 60) { + SendWorldMessage( + `|cffff6600${playerName} has reached level ${newLevel}! Congratulations!|r` + ); + } + } + + print(`TypeScript: Player ${playerName} leveled from ${oldLevel} to ${newLevel}`); +} + +// Register events +RegisterPlayerEvent(PLAYER_EVENT_ON_LOGIN, OnPlayerLogin); +RegisterPlayerEvent(PLAYER_EVENT_ON_LEVEL_CHANGE, OnPlayerLevelUp); + +print("โœ… TypeScript scripts loaded and will be compiled to Lua by ac-eluna"); +EOF + +print_status "SUCCESS" "Created TypeScript example: index.ts" + # Create Eluna configuration documentation cat > "$LUA_SCRIPTS_DIR/README.md" << 'EOF' # AzerothCore Eluna Lua Scripts @@ -322,17 +412,33 @@ else print_status "INFO" "No separate Eluna container found (using embedded mod-eluna)" fi +# Check for Black Market integration +if [ "$MODULE_BLACK_MARKET_AUCTION_HOUSE" = "1" ]; then + print_status "INFO" "Black Market Auction House module enabled - requires Eluna integration" + if [ -f "$LUA_SCRIPTS_DIR/bmah_server.lua" ]; then + print_status "SUCCESS" "Black Market Lua script found in lua_scripts directory" + else + print_status "WARNING" "Black Market Lua script not found - will be copied during module installation" + fi +fi + # Summary print_status "HEADER" "SETUP COMPLETE" echo "๐Ÿ“ Lua Scripts Directory: $LUA_SCRIPTS_DIR" +echo "๐Ÿ“ TypeScript Directory: $TYPESCRIPT_DIR" +echo "" echo "๐Ÿ“œ Example Scripts Created:" +echo " Lua Scripts:" echo " โ€ข welcome.lua - Player login messages" echo " โ€ข server_info.lua - Custom info commands" echo " โ€ข level_rewards.lua - Milestone rewards" echo " โ€ข init.lua - Script loader documentation" echo " โ€ข README.md - Complete documentation" echo "" +echo " TypeScript Scripts:" +echo " โ€ข index.ts - TypeScript example with type safety" +echo "" print_status "INFO" "Next Steps:" echo "1. Start/restart your worldserver container"