From 902cad907d70ee82cc80323b9c05e01bf175f926 Mon Sep 17 00:00:00 2001 From: b5635 Date: Fri, 24 May 2024 00:13:52 -0700 Subject: [PATCH 1/3] Update for Windows, need to update for Linux --- .gitignore | 76 ++---------------------------------- install/.keep | 0 nasher.cfg | 4 +- win_nasher_install.bat | 28 +++++++++++-- win_nasher_install_clean.bat | 28 +++++++++++-- win_nasher_unpack_folder.bat | 2 +- win_run_server.bat | 21 ++++++---- win_run_server_dev.bat | 35 +++++++++++------ win_run_server_dev_seed.bat | 48 ++++++++++++++--------- win_toolset.bat | 3 ++ 10 files changed, 123 insertions(+), 122 deletions(-) delete mode 100644 install/.keep diff --git a/.gitignore b/.gitignore index 0f525e706..d588a41fb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,89 +1,19 @@ -# Ignore everything -* +# Ignore build folder +.build/ +.build/* -!.gitignore -!.gitattributes -!database/.keep - -# Whitelist devserver files -!docker-compose-dev.yml -!docker-compose-dev-seed.yml -!config/common.env -!config/nwserver_dev.env -!config/nwserver_dev_seed.env -!settings.tml -!tools/ -!tools/** -!templates/ -!templates/** -!grafana-provisioning/ -!grafana-provisioning/** -!config/common-dev.env # Don't add real passwords to git config/influxdb.env config/grafana.env grafana-provisioning/datasources/nwn.yml -# Only the file templates -!config/influxdb-template.env -!config/grafana-template.env -!grafana-provisioning/datasources/nwn.yml.template - -!mod_desc.txt - -# Whitelist github and spec folder -!.github -!.github/** -!spec -!spec/** -!spec_output/src/nss/.keep - -# Gemfiles -!Gemfile -!Gemfile.lock - -# Whitelist dummy movie file -!movies/prelude.wbm # This file should be ignored always settings.tml server/settings.tml -# Whitelist the override folder but make sure these 2das never get committed -!override/ -!override/** -override/env.2da -override/env_dm.2da - -# Whitelist nwn base scripts folder -!nwn-base-scripts/ -!nwn-base-scripts/** - -# Keep this folder so install doesn't break -!install/.keep - -# Whitelist sources and nasher files -!nasher.cfg -!src/ -!src/** -!presets/ -!presets/** - -# Only keep server template file -!server/docker-compose-template.yml -!server/docker-compose-with-analytics-template.yml - -# Whitelist batch and readme files -!*.bat -!*.sh -!*.md - # Never commit these file types *.mod *.ncs *.csv -# Whitelist database files -!seeded_database -!seeded_database/** - diff --git a/install/.keep b/install/.keep deleted file mode 100644 index e69de29bb..000000000 diff --git a/nasher.cfg b/nasher.cfg index a86448892..601d1ace1 100644 --- a/nasher.cfg +++ b/nasher.cfg @@ -6,10 +6,10 @@ url = "" author = "" [Sources] -include = "src/**/*.{nss,json}" +include = "../src/**/*.{nss,json}" [Rules] -"*" = "src/$ext" +"*" = "../src/$ext" [Target] name = "mod" diff --git a/win_nasher_install.bat b/win_nasher_install.bat index ba10ed35a..e0a770721 100644 --- a/win_nasher_install.bat +++ b/win_nasher_install.bat @@ -7,13 +7,33 @@ echo. echo WARNING: Continuing will rebuild the module from source, deleting all unsaved changes! Commit or stash your changes, or exit out. @echo on -del modules /S -rd modules\TFN -rd modules +del .build\modules /S +rd .build\modules\TFN +rd .build\modules + +md .build + +rmdir /s /q .build\override +robocopy override .build\override + +md .build\database +md .build\movies +md .build\modules + +copy seeded_database\tmapsolutions.sqlite3 .build\database\tmapsolutions.sqlite3 +copy seeded_database\areadistances.sqlite3 .build\database\areadistances.sqlite3 +copy seeded_database\spawns.sqlite3 .build\database\spawns.sqlite3 +copy seeded_database\treasures.sqlite3 .build\database\treasures.sqlite3 +copy seeded_database\randspellbooks.sqlite3 .build\database\randspellbooks.sqlite3 +copy seeded_database\prettify.sqlite3 .build\database\prettify.sqlite3 +copy movies\prelude.wbm .build\movies\prelude.wbm +copy nasher.cfg .build\nasher.cfg del /f TFN.mod -"%CD%/tools/win/nasher/nasher.exe" install --verbose --erfUtil:"%CD%/tools/win/neverwinter64/nwn_erf.exe" --gffUtil:"%CD%/tools/win/neverwinter64/nwn_gff.exe" --tlkUtil:"%CD%/tools/win/neverwinter64/nwn_tlk.exe" --nssCompiler:"%CD%/tools/win/nwnsc/nwnsc.exe" --installDir:"%CD%" --nssFlags:"-oe -i ""%CD%/nwn-base-scripts""" --no +cd .build + +"%CD%/../tools/win/nasher/nasher.exe" install --verbose --erfUtil:"%CD%/../tools/win/neverwinter64/nwn_erf.exe" --gffUtil:"%CD%/../tools/win/neverwinter64/nwn_gff.exe" --tlkUtil:"%CD%/../tools/win/neverwinter64/nwn_tlk.exe" --nssCompiler:"%CD%/../tools/win/nwnsc/nwnsc.exe" --installDir:"%CD%" --nssFlags:"-oe -i ""%CD%/../nwn-base-scripts""" --no del /f TFN.mod pause diff --git a/win_nasher_install_clean.bat b/win_nasher_install_clean.bat index a56f02204..322f7dc8f 100644 --- a/win_nasher_install_clean.bat +++ b/win_nasher_install_clean.bat @@ -7,13 +7,33 @@ echo. echo WARNING: Continuing will rebuild the module from source, deleting all unsaved changes! Commit or stash your changes, or exit out. @echo on -del modules /S -rd modules\TFN -rd modules +del .build\modules /S +rd .build\modules\TFN +rd .build\modules + +md .build + +rmdir /s /q .build\override +robocopy override .build\override + +md .build\database +md .build\movies +md .build\modules + +copy seeded_database\tmapsolutions.sqlite3 .build\database\tmapsolutions.sqlite3 +copy seeded_database\areadistances.sqlite3 .build\database\areadistances.sqlite3 +copy seeded_database\spawns.sqlite3 .build\database\spawns.sqlite3 +copy seeded_database\treasures.sqlite3 .build\database\treasures.sqlite3 +copy seeded_database\randspellbooks.sqlite3 .build\database\randspellbooks.sqlite3 +copy seeded_database\prettify.sqlite3 .build\database\prettify.sqlite3 +copy movies\prelude.wbm .build\movies\prelude.wbm +copy nasher.cfg .build\nasher.cfg del /f TFN.mod -"%CD%/tools/win/nasher/nasher.exe" install --verbose --erfUtil:"%CD%/tools/win/neverwinter64/nwn_erf.exe" --gffUtil:"%CD%/tools/win/neverwinter64/nwn_gff.exe" --tlkUtil:"%CD%/tools/win/neverwinter64/nwn_tlk.exe" --nssCompiler:"%CD%/tools/win/nwnsc/nwnsc.exe" --installDir:"%CD%" --nssFlags:"-oe -i ""%CD%/nwn-base-scripts""" --no --clean +cd .build + +"%CD%/../tools/win/nasher/nasher.exe" install --verbose --erfUtil:"%CD%/../tools/win/neverwinter64/nwn_erf.exe" --gffUtil:"%CD%/../tools/win/neverwinter64/nwn_gff.exe" --tlkUtil:"%CD%/../tools/win/neverwinter64/nwn_tlk.exe" --nssCompiler:"%CD%/../tools/win/nwnsc/nwnsc.exe" --installDir:"%CD%" --nssFlags:"-oe -i ""%CD%/../nwn-base-scripts""" --no --clean del /f TFN.mod pause diff --git a/win_nasher_unpack_folder.bat b/win_nasher_unpack_folder.bat index 29e06430e..f9dd560ec 100644 --- a/win_nasher_unpack_folder.bat +++ b/win_nasher_unpack_folder.bat @@ -1,3 +1,3 @@ -"%CD%/tools/win/nasher/nasher.exe" unpack --file:modules/TFN --removeDeleted --erfUtil:"%CD%/tools/win/neverwinter64/nwn_erf.exe" --gffUtil:"%CD%/tools/win/neverwinter64/nwn_gff.exe" --tlkUtil:"%CD%/tools/win/neverwinter64/nwn_tlk.exe" --nssFlags:"-l" +"%CD%/tools/win/nasher/nasher.exe" unpack --file:.build/modules/TFN --removeDeleted --erfUtil:"%CD%/tools/win/neverwinter64/nwn_erf.exe" --gffUtil:"%CD%/tools/win/neverwinter64/nwn_gff.exe" --tlkUtil:"%CD%/tools/win/neverwinter64/nwn_tlk.exe" --nssFlags:"-l" git rm --cached src -r git add . \ No newline at end of file diff --git a/win_run_server.bat b/win_run_server.bat index 127e3b5e4..72f869cf0 100644 --- a/win_run_server.bat +++ b/win_run_server.bat @@ -9,11 +9,14 @@ echo. echo WARNING: Continuing will rebuild the module from source, deleting all unsaved changes! Commit or stash your changes, or exit out. @echo on -del modules /S -rd modules\TFN -rd modules +del .build\modules /S +rd .build\modules\TFN +rd .build\modules -del /f TFN.mod +md .build + +rmdir /s /q .build\override +robocopy override .build\override rem Fetch a timestamp and commit hash from git, and append it to mod_desc.txt rem This is more painful than it probably needed to be @@ -32,10 +35,14 @@ set content= for /f "delims=" %%x in ('type mod_desc.txt') do set "content=!content!%%x!LF!" set "content=!content!Last Updated: %timestamp% (%hash%)" -"%CD%/tools/win/nasher/nasher.exe" install --clean --verbose --erfUtil:"%CD%/tools/win/neverwinter64/nwn_erf.exe" --gffUtil:"%CD%/tools/win/neverwinter64/nwn_gff.exe" --tlkUtil:"%CD%/tools/win/neverwinter64/nwn_tlk.exe" --nssCompiler:"%CD%/tools/win/nwnsc/nwnsc.exe" --installDir:"%CD%" --nssFlags:"-oe -i %CD%/nwn-base-scripts" --no --modDescription "!content!" +cd .build + +"%CD%/../tools/win/nasher/nasher.exe" install --verbose --erfUtil:"%CD%/../tools/win/neverwinter64/nwn_erf.exe" --gffUtil:"%CD%/../tools/win/neverwinter64/nwn_gff.exe" --tlkUtil:"%CD%/../tools/win/neverwinter64/nwn_tlk.exe" --nssCompiler:"%CD%/../tools/win/nwnsc/nwnsc.exe" --installDir:"%CD%" --nssFlags:"-oe -i ""%CD%/../nwn-base-scripts""" --no --modDescription "!content!" endlocal +cd .. + del /f server\config\common.env del /f server\modules\TFN.mod del /f server\database\spawns.sqlite3 @@ -49,7 +56,7 @@ rmdir /s /q server\override md server\modules md server\database md server\config -copy modules\TFN.mod server\modules\TFN.mod +copy .build\modules\TFN.mod server\modules\TFN.mod copy config\common.env server\config\common.env copy settings.tml server\settings.tml copy seeded_database\tmapsolutions.sqlite3 server\database\tmapsolutions.sqlite3 @@ -63,7 +70,7 @@ robocopy override server\override copy server\env\env.2da server\override\env.2da copy server\env\env_dm.2da server\override\env_dm.2da -del /f TFN.mod +del /f .build\TFN.mod cd server docker-compose -f docker-compose.yml down diff --git a/win_run_server_dev.bat b/win_run_server_dev.bat index aff4ef1cc..d0442fa3c 100644 --- a/win_run_server_dev.bat +++ b/win_run_server_dev.bat @@ -1,16 +1,27 @@ -del /f database\spawns.sqlite3 -del /f database\treasures.sqlite3 -del /f database\randspellbooks.sqlite3 -del /f database\prettify.sqlite3 -del /f database\tmapsolutions.sqlite3 -del /f database\areadistances.sqlite3 +del /f .build\database\spawns.sqlite3 +del /f .build\database\treasures.sqlite3 +del /f .build\database\randspellbooks.sqlite3 +del /f .build\database\prettify.sqlite3 +del /f .build\database\tmapsolutions.sqlite3 +del /f .build\database\areadistances.sqlite3 -copy seeded_database\tmapsolutions.sqlite3 database\tmapsolutions.sqlite3 -copy seeded_database\areadistances.sqlite3 database\areadistances.sqlite3 -copy seeded_database\spawns.sqlite3 database\spawns.sqlite3 -copy seeded_database\treasures.sqlite3 database\treasures.sqlite3 -copy seeded_database\randspellbooks.sqlite3 database\randspellbooks.sqlite3 -copy seeded_database\prettify.sqlite3 database\prettify.sqlite3 +md .build\database +md .build\config + +copy seeded_database\tmapsolutions.sqlite3 .build\database\tmapsolutions.sqlite3 +copy seeded_database\areadistances.sqlite3 .build\database\areadistances.sqlite3 +copy seeded_database\spawns.sqlite3 .build\database\spawns.sqlite3 +copy seeded_database\treasures.sqlite3 .build\database\treasures.sqlite3 +copy seeded_database\randspellbooks.sqlite3 .build\database\randspellbooks.sqlite3 +copy seeded_database\prettify.sqlite3 .build\database\prettify.sqlite3 + +del /f .build\docker-compose-dev.yml +copy docker-compose-dev.yml .build\docker-compose-dev.yml + +del /f .build\config\common.env +copy config\common.env .build\config\common.env + +cd .build docker-compose -f docker-compose-dev.yml down docker-compose -f docker-compose-dev.yml up --no-recreate -d \ No newline at end of file diff --git a/win_run_server_dev_seed.bat b/win_run_server_dev_seed.bat index 957f0c9ad..ba566bbde 100644 --- a/win_run_server_dev_seed.bat +++ b/win_run_server_dev_seed.bat @@ -1,25 +1,35 @@ -del /f database\prettify.sqlite3 -del /f database\tmapsolutions.sqlite3 -del /f database\areadistances.sqlite3 +del /f .build\database\prettify.sqlite3 +del /f .build\database\tmapsolutions.sqlite3 +del /f .build\database\areadistances.sqlite3 -copy seeded_database\randspellbooks.sqlite3 database\randspellbooks.sqlite3 -copy seeded_database\prettify.sqlite3 database\prettify.sqlite3 -copy seeded_database\areadistances.sqlite3 database\areadistances.sqlite3 +md .build\database +md .build\config +copy seeded_database\randspellbooks.sqlite3 .build\database\randspellbooks.sqlite3 +copy seeded_database\prettify.sqlite3 .build\database\prettify.sqlite3 +copy seeded_database\areadistances.sqlite3 .build\database\areadistances.sqlite3 + +del /f .build\docker-compose-dev-seed.yml +copy docker-compose-dev-seed.yml .build\docker-compose-dev-seed.yml + +del /f .build\config\common.env +copy config\common.env .build\config\common.env + +cd .build docker-compose -f docker-compose-dev-seed.yml down docker-compose -f docker-compose-dev-seed.yml up --no-recreate -del /f seeded_database\spawns.sqlite3 -del /f seeded_database\treasures.sqlite3 -del /f seeded_database\randspellbooks.sqlite3 -del /f seeded_database\prettify.sqlite3 -del /f seeded_database\tmapsolutions.sqlite3 -del /f seeded_database\areadistances.sqlite3 - -copy database\tmapsolutions.sqlite3 seeded_database\tmapsolutions.sqlite3 -copy database\spawns.sqlite3 seeded_database\spawns.sqlite3 -copy database\treasures.sqlite3 seeded_database\treasures.sqlite3 -copy database\randspellbooks.sqlite3 seeded_database\randspellbooks.sqlite3 -copy database\prettify.sqlite3 seeded_database\prettify.sqlite3 -copy database\areadistances.sqlite3 seeded_database\areadistances.sqlite3 \ No newline at end of file +del /f ..\seeded_database\spawns.sqlite3 +del /f ..\seeded_database\treasures.sqlite3 +del /f ..\seeded_database\randspellbooks.sqlite3 +del /f ..\seeded_database\prettify.sqlite3 +del /f ..\seeded_database\tmapsolutions.sqlite3 +del /f ..\seeded_database\areadistances.sqlite3 + +copy database\tmapsolutions.sqlite3 ..\seeded_database\tmapsolutions.sqlite3 +copy database\spawns.sqlite3 ..\seeded_database\spawns.sqlite3 +copy database\treasures.sqlite3 ..\seeded_database\treasures.sqlite3 +copy database\randspellbooks.sqlite3 ..\seeded_database\randspellbooks.sqlite3 +copy database\prettify.sqlite3 ..\seeded_database\prettify.sqlite3 +copy database\areadistances.sqlite3 ..\seeded_database\areadistances.sqlite3 \ No newline at end of file diff --git a/win_toolset.bat b/win_toolset.bat index d8c5c4461..be62db09a 100644 --- a/win_toolset.bat +++ b/win_toolset.bat @@ -1,5 +1,8 @@ @echo off +md .build +cd .build + set DefaultSteamPath=C:\Program Files (x86)\Steam\steamapps\common\Neverwinter Nights\bin\win32\nwtoolset.exe if exist "%DefaultSteamPath%" ( echo DefaultSteamPath found: "%DefaultSteamPath%" From 08efa9d9e7b739c942e37129119248ab3cd66913 Mon Sep 17 00:00:00 2001 From: b5635 Date: Fri, 1 Nov 2024 23:07:46 -0700 Subject: [PATCH 2/3] Updated gitignore to ignore nasher folder --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index d588a41fb..d749569be 100644 --- a/.gitignore +++ b/.gitignore @@ -2,6 +2,9 @@ .build/ .build/* +.nasher/ +.nasher/* + # Don't add real passwords to git config/influxdb.env config/grafana.env From b945efdd586186397c5d895c3fcf9b14f327ca62 Mon Sep 17 00:00:00 2001 From: b5635 Date: Sat, 2 Nov 2024 00:41:36 -0700 Subject: [PATCH 3/3] Fixed windows server script --- .gitignore | 6 +++++- win_run_server.bat | 6 ++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index d749569be..472b7edef 100644 --- a/.gitignore +++ b/.gitignore @@ -12,7 +12,11 @@ grafana-provisioning/datasources/nwn.yml # This file should be ignored always settings.tml -server/settings.tml + +# Whitelist only server template files +server/* +!docker-compose-template.yml +!docker-compose-with-analytics-template.yml # Never commit these file types *.mod diff --git a/win_run_server.bat b/win_run_server.bat index 72f869cf0..e3e153d1b 100644 --- a/win_run_server.bat +++ b/win_run_server.bat @@ -35,12 +35,12 @@ set content= for /f "delims=" %%x in ('type mod_desc.txt') do set "content=!content!%%x!LF!" set "content=!content!Last Updated: %timestamp% (%hash%)" +endlocal + cd .build "%CD%/../tools/win/nasher/nasher.exe" install --verbose --erfUtil:"%CD%/../tools/win/neverwinter64/nwn_erf.exe" --gffUtil:"%CD%/../tools/win/neverwinter64/nwn_gff.exe" --tlkUtil:"%CD%/../tools/win/neverwinter64/nwn_tlk.exe" --nssCompiler:"%CD%/../tools/win/nwnsc/nwnsc.exe" --installDir:"%CD%" --nssFlags:"-oe -i ""%CD%/../nwn-base-scripts""" --no --modDescription "!content!" -endlocal - cd .. del /f server\config\common.env @@ -75,3 +75,5 @@ del /f .build\TFN.mod cd server docker-compose -f docker-compose.yml down docker-compose -f docker-compose.yml up --no-recreate -d + +PAUSE