From fb60f15cad85cf7cca85d17ea933141c852bf566 Mon Sep 17 00:00:00 2001 From: Jon <> Date: Fri, 9 Aug 2024 20:03:56 +0100 Subject: [PATCH] Added bash scripts to be run inside the docker container --- GuildWarsPartySearch.Bot/build.sh | 1 + .../check_and_update_gw_keys.sh | 10 +++++++ GuildWarsPartySearch.Bot/run.sh | 29 +++++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 GuildWarsPartySearch.Bot/build.sh create mode 100644 GuildWarsPartySearch.Bot/check_and_update_gw_keys.sh create mode 100644 GuildWarsPartySearch.Bot/run.sh diff --git a/GuildWarsPartySearch.Bot/build.sh b/GuildWarsPartySearch.Bot/build.sh new file mode 100644 index 0000000..cddada0 --- /dev/null +++ b/GuildWarsPartySearch.Bot/build.sh @@ -0,0 +1 @@ +cmake -B linuxbuild -G "Ninja" && ninja -C linuxbuild \ No newline at end of file diff --git a/GuildWarsPartySearch.Bot/check_and_update_gw_keys.sh b/GuildWarsPartySearch.Bot/check_and_update_gw_keys.sh new file mode 100644 index 0000000..3e2d794 --- /dev/null +++ b/GuildWarsPartySearch.Bot/check_and_update_gw_keys.sh @@ -0,0 +1,10 @@ +#!/bin/bash +dpkg -s python3 > /dev/null 2>&1 || ( + apt install python3 pip -y; + pip install tqdm; + pip install pefile; +); +python3 ./Dependencies/Headquarter/tools/update_binary.py; +mkdir -p ./data; +cp -ura ./Dependencies/Headquarter/data/* ./data; +cp -ura ./Dependencies/Headquarter/Gw.build Gw.build; \ No newline at end of file diff --git a/GuildWarsPartySearch.Bot/run.sh b/GuildWarsPartySearch.Bot/run.sh new file mode 100644 index 0000000..38ff3c0 --- /dev/null +++ b/GuildWarsPartySearch.Bot/run.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +NOW=$(date '+%Y-%m-%d_%H-%M-%S') + +BIN_DIR=$PWD/linuxbuild/bin; + +# Absolute path to client executable +CLIENT_EXE=$BIN_DIR/client; +# Absolute path to log file +LOG_FILE=$PWD/logs/$NOW.txt; +# Contains the build version number of guild wars +BUILD_VERSION_FILE=$PWD/Gw.build; +# Absolute location of plugin on disk +PLUGIN_EXE=$BIN_DIR/libGuildWarsPartySearch.Bot.so; + +# TODO: ENV vars +RUN_EMAIL="${EMAIL:-null@arenanet.com}"; +RUN_PASSWORD="${PASSWORD:-nopassword}"; +RUN_CHARACTER="${CHARACTER:-No Character}"; +RUN_MAP_ID="${MAP_ID:-0}"; +RUN_DISTRICT="${DISTRICT:-0}"; + +# Absolute log +LOG_DIR=$(dirname "$LOG_FILE") +rm -R $LOG_DIR; +mkdir -p $LOG_DIR; +touch $LOG_FILE; + +"$CLIENT_EXE" -email "$RUN_EMAIL" -character "$RUN_CHARACTER" -district "$RUN_DISTRICT" -mapid "$RUN_MAP_ID" -password "$RUN_PASSWORD" -l "$LOG_FILE" -file-game-version "$BUILD_VERSION_FILE" "$PLUGIN_EXE" \ No newline at end of file