This commit is contained in:
2026-04-02 21:51:05 +04:00
parent b0d62064ba
commit 6516b32fc6
21 changed files with 636 additions and 19 deletions
+40 -4
View File
@@ -82,6 +82,9 @@ FORCE_PLAYERBOTS="${FORCE_PLAYERBOTS:-${ACORE_PLAYERBOTS_FORCE:-0}}"
: "${ACORE_QUEST_PARTY_ENABLE:=1}"
: "${ACORE_QUEST_PARTY_MESSAGE:=0}"
: "${ACORE_GAMEMODES_ENABLE:=1}"
: "${ACORE_GAMEMODES_TRAITOR_ENABLE:=1}"
: "${ACORE_ELUNA_ENABLED:=true}"
: "${ACORE_ELUNA_TRACEBACK:=false}"
: "${ACORE_ELUNA_SCRIPT_PATH:=lua_scripts}"
@@ -266,8 +269,9 @@ database_service_running() {
docker compose ps --status running --services 2>/dev/null | grep -qx 'ac-database'
}
import_world_sql_file() {
import_sql_file() {
local file_path="$1"
local database="$2"
if [[ ! -f "$file_path" ]]; then
log "skip missing ${file_path#$ROOT_DIR/}"
@@ -275,13 +279,21 @@ import_world_sql_file() {
fi
if (( DRY_RUN )); then
log "would import ${file_path#$ROOT_DIR/} into acore_world"
log "would import ${file_path#$ROOT_DIR/} into ${database}"
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"
"mysql --default-character-set=utf8mb4 -uroot -p\"\$MYSQL_ROOT_PASSWORD\" ${database}" < "$file_path"
log "imported ${file_path#$ROOT_DIR/} into ${database}"
}
import_world_sql_file() {
import_sql_file "$1" "acore_world"
}
import_characters_sql_file() {
import_sql_file "$1" "acore_characters"
}
import_local_lua_module_sql() {
@@ -300,6 +312,15 @@ import_local_lua_module_sql() {
import_world_sql_file "$start_zone_race_teleporters_sql"
}
import_gamemodes_sql() {
if ! database_service_running; then
log "skip gamemodes SQL: ac-database is not running"
return
fi
import_characters_sql_file "$ROOT_DIR/modules/mod-gamemodes/data/sql/db-characters/base/mod_gamemodes_characters.sql"
}
ensure_world_conf() {
if [[ -f "$WORLD_CONF" ]]; then
return
@@ -339,6 +360,8 @@ sync_module_dists() {
"$MODULES_ETC_DIR/mod_learnspells.conf.dist"
sync_file "$ROOT_DIR/modules/mod-playerbots/conf/playerbots.conf.dist" \
"$MODULES_ETC_DIR/playerbots.conf.dist"
sync_file "$ROOT_DIR/modules/mod-gamemodes/conf/mod_gamemodes.conf.dist" \
"$MODULES_ETC_DIR/mod_gamemodes.conf.dist"
sync_file "$ROOT_DIR/modules/mod-quest-loot-party/conf/mod-quest-loot-party.conf.dist" \
"$MODULES_ETC_DIR/mod-quest-loot-party.conf.dist"
}
@@ -482,6 +505,16 @@ playerbots_supported() {
return 0
}
write_gamemodes_conf() {
write_file "$MODULES_ETC_DIR/mod_gamemodes.conf.dist" <<EOF
[worldserver]
# Managed by ./setup-modules.sh
GameModes.Enable = ${ACORE_GAMEMODES_ENABLE}
GameModes.Traitor.Enable = ${ACORE_GAMEMODES_TRAITOR_ENABLE}
EOF
}
write_playerbots_conf() {
if ! [[ -f "$ROOT_DIR/modules/mod-playerbots/conf/playerbots.conf.dist" ]]; then
log "skip playerbots: module config source not found"
@@ -570,6 +603,7 @@ cleanup_legacy_module_overrides() {
"$MODULES_ETC_DIR/mod_eluna.conf"
"$MODULES_ETC_DIR/mod_learnspells.conf"
"$MODULES_ETC_DIR/mod-quest-loot-party.conf"
"$MODULES_ETC_DIR/mod_gamemodes.conf"
"$MODULES_ETC_DIR/playerbots.conf"
)
@@ -626,8 +660,10 @@ main() {
write_quest_loot_party_conf
write_eluna_conf
write_learnspells_conf
write_gamemodes_conf
write_playerbots_conf
import_local_lua_module_sql
import_gamemodes_sql
log "module bootstrap completed"
}