[Items] Overhaul Item Hand-in System (#4593)

* [Items] Overhaul Item Hand-in System

* Edge case lua fix

* Merge fix

* I'm going to be amazed if this works first try

* Update linux-build.sh

* Update linux-build.sh

* Update linux-build.sh

* Update linux-build.sh

* Update linux-build.sh

* Update linux-build.sh

* Update linux-build.sh

* Update linux-build.sh

* Add protections against scripts that hand back items themselves

* Remove EVENT_ITEM_ScriptStopReturn

* test

* Update npc_handins.cpp

* Add Items:AlwaysReturnHandins

* Update spdat.cpp

* Bypass update prompt on CI
This commit is contained in:
Chris Miles
2025-02-03 16:51:09 -06:00
committed by GitHub
parent d1d6db3a09
commit 6fb919a16f
40 changed files with 2254 additions and 473 deletions
+30 -1
View File
@@ -5,6 +5,9 @@ set -ex
sudo chown eqemu:eqemu /drone/src/ * -R
sudo chown eqemu:eqemu /home/eqemu/.ccache/ * -R
chmod +x ./utils/scripts/build/source-db-build.sh
utils/scripts/build/source-db-build.sh &
git submodule init && git submodule update
perl utils/scripts/build/tag-version.pl
@@ -19,13 +22,39 @@ mkdir -p build && cd build && \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING="-O1 -g -Wno-everything" \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-G 'Unix Makefiles' \
.. && make -j$((`nproc`-4))
.. && make -j$((`nproc`-12))
curl https://raw.githubusercontent.com/Akkadius/eqemu-install-v2/master/eqemu_config.json --output eqemu_config.json
./bin/tests
ldd ./bin/zone
echo "Waiting for MariaDB to be ready..."
while ! mysqladmin ping -uroot -peqemu -hlocalhost --silent; do
sleep 1
done
echo "# Cloning quests repository"
git -C ./quests pull 2> /dev/null || git clone https://github.com/ProjectEQ/projecteqquests.git quests
# remove this eventually
cd ./quests && git checkout akkadius/item-handin-overhaul && cd ..
mkdir maps
mkdir logs
ln -s ./quests/lua_modules ./lua_modules
ln -s ./quests/plugins ./plugins
echo "# Running world database updates"
FORCE_INTERACTIVE=1 ./bin/world database:updates --skip-backup --force
echo "# Running shared_memory"
./bin/shared_memory
echo "# Running NPC hand-in tests"
./bin/zone tests:npc-handins
# shellcheck disable=SC2164
cd /drone/src/
+90
View File
@@ -0,0 +1,90 @@
# Variables
ROOT_PASSWORD="eqemu"
MARIADB_CONFIG="/etc/mysql/mariadb.conf.d/50-server.cnf"
# Update and install MariaDB
echo "Installing MariaDB..."
sudo apt update
sudo apt install -y mariadb-server mariadb-client
# Ensure MariaDB is stopped before configuration
echo "Stopping MariaDB service..."
sudo systemctl stop mariadb
# Initialize the data directory (in case it's not already initialized)
echo "Initializing MariaDB data directory..."
sudo mysqld --initialize --user=mysql --datadir=/var/lib/mysql
# Start MariaDB in safe mode
echo "Starting MariaDB in safe mode..."
sudo mysqld_safe --skip-grant-tables --skip-networking &
sleep 5
# Reset root password and configure authentication
echo "Resetting root password and configuring authentication..."
mariadb <<EOF
FLUSH PRIVILEGES;
ALTER USER 'root'@'localhost' IDENTIFIED VIA mysql_native_password USING PASSWORD('$ROOT_PASSWORD');
GRANT ALL PRIVILEGES ON *.* TO 'root'@'localhost' IDENTIFIED BY '$ROOT_PASSWORD' WITH GRANT OPTION;
FLUSH PRIVILEGES;
EOF
# Stop MariaDB safe mode
echo "Stopping MariaDB safe mode..."
sudo killall mysqld
# Configure MariaDB to allow remote connections (optional)
echo "Configuring MariaDB to allow remote connections..."
sudo sed -i "s/^bind-address.*/bind-address = 0.0.0.0/" $MARIADB_CONFIG
# Restart MariaDB service
echo "Restarting MariaDB service..."
sudo systemctl restart mariadb
# Test connection
echo "Testing MariaDB connection..."
mysql -u root -p"$ROOT_PASSWORD" -e "SELECT VERSION();"
# Display completion message
echo "MariaDB setup completed!"
echo "Root password: $ROOT_PASSWORD"
# Set Database Credentials
DB_USER="root"
DB_PASS="eqemu"
DB_HOST="localhost"
DB_NAME="peq"
SQL_DIR="/tmp/db/peq-dump"
# Download the latest database dump
echo "Downloading the latest PEQ database dump..."
curl -s http://db.projecteq.net/api/v1/dump/latest -o /tmp/db.zip
# Unzip the database dump
echo "Extracting the database dump..."
unzip -o /tmp/db.zip -d /tmp/db/
# Ensure MariaDB is running
echo "Ensuring MariaDB is running..."
sudo systemctl start mariadb
# Wait for MariaDB to be ready
echo "Waiting for MariaDB to be ready..."
while ! mysqladmin ping -u${DB_USER} -p${DB_PASS} -h${DB_HOST} --silent; do
sleep 1
done
# Create the peq database
echo "Creating the '${DB_NAME}' database..."
mysql -u${DB_USER} -p${DB_PASS} -h${DB_HOST} -e "DROP DATABASE IF EXISTS ${DB_NAME}; CREATE DATABASE ${DB_NAME};"
# Parallelize the import process
echo "Importing tables in parallel..."
ls /tmp/db/peq-dump/create_tables_*.sql | xargs -P 4 -I {} sh -c "mysql -u${DB_USER} -p${DB_PASS} -h${DB_HOST} ${DB_NAME} < {}"
# Clean up temporary files
echo "Cleaning up temporary files..."
rm -rf /tmp/db/
rm -rf ${COMBINED_DIR}
echo "Database import complete!"