модуль npc дипломатов

This commit is contained in:
2026-03-14 17:50:08 +04:00
parent feceaab626
commit c53d6b30d4
7 changed files with 960 additions and 0 deletions
+59
View File
@@ -76,6 +76,9 @@ FORCE_PLAYERBOTS="${FORCE_PLAYERBOTS:-${ACORE_PLAYERBOTS_FORCE:-0}}"
: "${ACORE_ELUNA_PLAYER_ANNOUNCE_RELOAD:=false}"
: "${ACORE_ELUNA_REQUIRE_PATHS:=}"
: "${ACORE_ELUNA_REQUIRE_CPATHS:=}"
#
# Local Lua module SQL bootstrap.
: "${ACORE_IMPORT_START_ZONE_RACE_TELEPORTERS_SQL:=1}"
: "${ACORE_LEARNSPELLS_GAMEMASTERS:=0}"
: "${ACORE_LEARNSPELLS_CLASS_SPELLS:=1}"
@@ -122,6 +125,7 @@ usage() {
Usage: $(basename "$0") [--dry-run] [--force-playerbots]
Configures AzerothCore module configs for this repository layout.
If ac-database is already running, it also imports local Lua-module bootstrap SQL.
Options:
--dry-run Show actions without changing files
@@ -181,6 +185,16 @@ sync_file() {
log "synced ${target#$ROOT_DIR/}"
}
require_integer_flag() {
local name="$1"
local value="$2"
if ! [[ "$value" =~ ^[01]$ ]]; then
printf '%s must be 0 or 1, got: %s\n' "$name" "$value" >&2
exit 1
fi
}
escape_regex() {
printf '%s' "$1" | sed 's/[][(){}.^$*+?|\\/]/\\&/g'
}
@@ -232,6 +246,48 @@ set_config_value() {
log "appended ${key} to ${file#$ROOT_DIR/}"
}
database_service_running() {
if ! command -v docker >/dev/null 2>&1; then
return 1
fi
docker compose ps --status running --services 2>/dev/null | grep -qx 'ac-database'
}
import_world_sql_file() {
local file_path="$1"
if [[ ! -f "$file_path" ]]; then
log "skip missing ${file_path#$ROOT_DIR/}"
return
fi
if (( DRY_RUN )); then
log "would import ${file_path#$ROOT_DIR/} into acore_world"
return
fi
docker compose exec -T ac-database bash -lc \
"mysql --default-character-set=utf8mb4 -uroot -p\"\$MYSQL_ROOT_PASSWORD\" acore_world" < "$file_path"
log "imported ${file_path#$ROOT_DIR/} into acore_world"
}
import_local_lua_module_sql() {
local start_zone_race_teleporters_sql="$ROOT_DIR/lua_scripts/StartZoneRaceTeleporters/sql/world/start_zone_race_teleporters.sql"
if [[ "$ACORE_IMPORT_START_ZONE_RACE_TELEPORTERS_SQL" == "0" ]]; then
log "StartZoneRaceTeleporters SQL import disabled, skipped"
return
fi
if ! database_service_running; then
log "skip StartZoneRaceTeleporters SQL: ac-database is not running"
return
fi
import_world_sql_file "$start_zone_race_teleporters_sql"
}
ensure_world_conf() {
if [[ -f "$WORLD_CONF" ]]; then
return
@@ -515,6 +571,8 @@ main() {
log "root: $ROOT_DIR"
log "etc: $ETC_DIR"
require_integer_flag "ACORE_IMPORT_START_ZONE_RACE_TELEPORTERS_SQL" "$ACORE_IMPORT_START_ZONE_RACE_TELEPORTERS_SQL"
ensure_runtime_dirs
sync_module_dists
cleanup_legacy_module_overrides
@@ -525,6 +583,7 @@ main() {
write_eluna_conf
write_learnspells_conf
write_playerbots_conf
import_local_lua_module_sql
log "module bootstrap completed"
}