mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-15 16:41:29 +00:00
Compare commits
44 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6c057308da | ||
|
|
0bc0ee609a | ||
|
|
c84df0d5ba | ||
|
|
9b3f9f356d | ||
|
|
e42dc2e1d2 | ||
|
|
c611a25385 | ||
|
|
f74efcaa5f | ||
|
|
eb4e7d694c | ||
|
|
ecc0d4b5c0 | ||
|
|
8175ae6187 | ||
|
|
e8f4ffd628 | ||
|
|
0447618f7e | ||
|
|
e71ce001ff | ||
|
|
1575a2af40 | ||
|
|
4b69df646c | ||
|
|
044b9c1420 | ||
|
|
0bbb5b90e7 | ||
|
|
6506ad5b51 | ||
|
|
dcaa0ecdaa | ||
|
|
9b143132be | ||
|
|
231bf8b4ec | ||
|
|
dee58f9a91 | ||
|
|
1eb89edbbd | ||
|
|
e015d0d67e | ||
|
|
ba78394ce9 | ||
|
|
060f6e377d | ||
|
|
92c8b0e585 | ||
|
|
33df8ea665 | ||
|
|
9668074d94 | ||
|
|
822a5dcac4 | ||
|
|
0c65a4febe | ||
|
|
02f66de679 | ||
|
|
145111f11e | ||
|
|
a4e47d9180 | ||
|
|
207ee2daa0 | ||
|
|
1fe5d9fa4f | ||
|
|
ed3f6c2a40 | ||
|
|
adb3196ca5 | ||
|
|
e13b133ac8 | ||
|
|
d475428157 | ||
|
|
00b66ce432 | ||
|
|
4d12dd5c43 | ||
|
|
c4f408bffc | ||
|
|
d876c6df2a |
11
.devcontainer/.gitignore
vendored
11
.devcontainer/.gitignore
vendored
@ -1,6 +1,5 @@
|
||||
!Makefile
|
||||
base/*.sql
|
||||
base/*.zip
|
||||
base/db/
|
||||
base/maps/
|
||||
!base/expansion/Makefile
|
||||
base/
|
||||
!base/*.json
|
||||
override/
|
||||
repo/
|
||||
cache/
|
||||
|
||||
@ -1,196 +1,127 @@
|
||||
# Build binaries: make cmake, make build
|
||||
# One time initial setup (or to reset db): make prep, make inject-mariadb, make maps
|
||||
# Update custom db edits: make inject-custom
|
||||
# Start up server: make shared, make login, make world, make zone
|
||||
# in game, stop combat spam #logs set gmsay 79 0
|
||||
# in game, stop loot spam #logs set gmsay 69 0
|
||||
NAME := eqemu-server
|
||||
.ONESHELL:
|
||||
|
||||
DOCKER_ARGS := --rm --name ${NAME} -v $$PWD:/src -w /src ${NAME}
|
||||
DOCKER_ARM64_ARGS := --rm --platform linux/arm64 --name ${NAME}-arm64 -v $$PWD:/src -w /src ${NAME}-arm64
|
||||
|
||||
.PHONY: build
|
||||
build:
|
||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
||||
@make -C ../ -f .devcontainer/Makefile build --no-print-directory
|
||||
exit
|
||||
endif
|
||||
cd build$$BUILD_SUFFIX && cmake --build . --config Release --target all --
|
||||
|
||||
.PHONY: cmake
|
||||
cmake:
|
||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
||||
@make -C ../ -f .devcontainer/Makefile cmake --no-print-directory
|
||||
exit
|
||||
endif
|
||||
@echo "working directory: $$PWD"
|
||||
mkdir -p build$$BUILD_SUFFIX
|
||||
@cd build$$BUILD_SUFFIX && cmake -DEQEMU_BUILD_LOGIN=ON \
|
||||
-DEQEMU_BUILD_TESTS=ON \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -G Ninja ..
|
||||
|
||||
clean:
|
||||
ifneq (,$(findstring .devcontainer,$$PWD))
|
||||
@make -C ../ -f .devcontainer/Makefile clean --no-print-directory
|
||||
endif
|
||||
rm -rf build
|
||||
|
||||
docker-cmake:
|
||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
||||
@make -C ../ -f .devcontainer/Makefile docker-cmake --no-print-directory
|
||||
exit
|
||||
endif
|
||||
@echo "working directory: $$PWD"
|
||||
git submodule update --init --recursive
|
||||
docker run ${DOCKER_ARGS} make cmake
|
||||
|
||||
docker-build:
|
||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
||||
@make -C ../ -f .devcontainer/Makefile docker-build --no-print-directory
|
||||
exit
|
||||
endif
|
||||
docker run ${DOCKER_ARGS} make build
|
||||
|
||||
# Build image if it doesn't exist
|
||||
docker-image-build:
|
||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
||||
@make -C ../ -f .devcontainer/Makefile docker-image-build --no-print-directory
|
||||
exit
|
||||
endif
|
||||
ifeq ($(shell docker images -q ${NAME} 2> /dev/null),)
|
||||
@echo "Docker image not found. Building..."
|
||||
docker build -f Dockerfile.debian.dev -t ${NAME} .
|
||||
endif
|
||||
|
||||
docker-arm-cmake: docker-arm-image-build
|
||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
||||
@make -C ../ -f .devcontainer/Makefile docker-arm-cmake --no-print-directory
|
||||
exit
|
||||
endif
|
||||
git submodule update --init --recursive
|
||||
docker run ${DOCKER_ARM64_ARGS} make cmake BUILD_SUFFIX=arm64
|
||||
|
||||
docker-arm-build: docker-arm-image-build
|
||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
||||
@make -C ../ -f .devcontainer/Makefile docker-arm-build --no-print-directory
|
||||
exit
|
||||
endif
|
||||
docker run ${DOCKER_ARM64_ARGS} make build BUILD_SUFFIX=arm64
|
||||
|
||||
docker-arm-image-build:
|
||||
ifeq ($(shell docker images -q ${NAME}-arm64 2> /dev/null),)
|
||||
@echo "Docker image not found. Building..."
|
||||
docker build -f Dockerfile.debian.arm.dev -t ${NAME}-arm64 .
|
||||
endif
|
||||
|
||||
docker-clean: clean
|
||||
|
||||
.PHONY: prep
|
||||
prep:
|
||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
||||
@make -C ../ -f .devcontainer/Makefile prep --no-print-directory
|
||||
exit
|
||||
endif
|
||||
prep: is-vscode
|
||||
@echo "Preparing build/bin for usage..."
|
||||
mkdir -p build/bin/assets/patches
|
||||
cp -R -u -p .devcontainer/base/eqemu_config.json build/bin/eqemu_config.json
|
||||
cp -R -u -p .devcontainer/base/login.json build/bin/login.json
|
||||
cp -R -u -p loginserver/login_util/* build/bin/assets/patches/
|
||||
mkdir -p build/bin/assets
|
||||
cp -R -u -p utils/patches build/bin/assets/
|
||||
-unlink build/bin/lua_modules
|
||||
cd build/bin && ln -s quests/lua_modules lua_modules
|
||||
-unlink build/bin/mods
|
||||
cd build/bin && ln -s quests/mods mods
|
||||
-unlink build/bin/maps
|
||||
cd build/bin && ln -s ../../base/maps maps
|
||||
mkdir -p build/bin/logs
|
||||
mkdir -p build/bin/shared
|
||||
|
||||
@echo "Prepping folders..."
|
||||
@mkdir -p .devcontainer/override
|
||||
@mkdir -p .devcontainer/repo
|
||||
@mkdir -p .devcontainer/cache
|
||||
@mkdir -p build/bin/logs
|
||||
@mkdir -p build/bin/shared
|
||||
@mkdir -p build/bin/assets
|
||||
|
||||
@echo "Applying overrides..."
|
||||
@if [ ! -f .devcontainer/override/eqemu_config.json ]; then cp .devcontainer/base/eqemu_config.json .devcontainer/override/eqemu_config.json; fi
|
||||
@if [ -f build/bin/eqemu_config.json ]; then unlink build/bin/eqemu_config.json; fi
|
||||
cd build/bin && ln -s ../../.devcontainer/override/eqemu_config.json eqemu_config.json
|
||||
@if [ ! -f .devcontainer/override/login.json ]; then cp .devcontainer/base/login.json .devcontainer/override/login.json; fi
|
||||
@if [ -f build/bin/login.json ]; then unlink build/bin/login.json; fi
|
||||
cd build/bin && ln -s ../../.devcontainer/override/login.json login.json
|
||||
|
||||
@echo "Cloning repositories..."
|
||||
cd .devcontainer/repo && if [ ! -d "quests" ]; then cd ../../.devcontainer/repo/ && git clone https://github.com/ProjectEQ/projecteqquests.git quests; fi
|
||||
cd .devcontainer/repo && if [ ! -d "eqemu-definitions" ]; then cd ../../.devcontainer/repo/ && git clone https://github.com/xackery/eqemu-definitions.git eqemu-definitions; fi
|
||||
cd .devcontainer/repo && if [ ! -d "maps" ]; then cd ../../ && make maps; fi
|
||||
@if [ -d build/bin/quests ]; then unlink build/bin/quests; fi
|
||||
cd build/bin && ln -s ../../.devcontainer/repo/quests quests
|
||||
@if [ -d build/bin/maps ]; then unlink build/bin/maps; fi
|
||||
cd build/bin && ln -s ../../.devcontainer/repo/maps maps
|
||||
@if [ -d build/bin/eqemu-definitions ]; then unlink build/bin/eqemu-definitions; fi
|
||||
cd build/bin && ln -s ../../.devcontainer/repo/eqemu-definitions eqemu-definitions
|
||||
@mkdir -p build/bin/quests/mods
|
||||
|
||||
@echo "Applying base links..."
|
||||
cp -R -u -p utils/patches .devcontainer/base/
|
||||
@if [ -d build/bin/assets/patches ]; then unlink build/bin/assets/patches; fi
|
||||
cd build/bin/assets && ln -s ../../../.devcontainer/base/patches patches
|
||||
@if [ -d build/bin/lua_modules ]; then unlink build/bin/lua_modules; fi
|
||||
cd build/bin && ln -s ../../.devcontainer/repo/quests/lua_modules lua_modules
|
||||
@if [ -d build/bin/mods ]; then unlink build/bin/mods; fi
|
||||
cd build/bin && ln -s ../../.devcontainer/repo/quests/mods mods
|
||||
@if [ -d build/bin/plugins ]; then unlink build/bin/plugins; fi
|
||||
cd build/bin && ln -s ../../.devcontainer/repo/quests/plugins plugins
|
||||
|
||||
@echo "Eqemu is prepared. Edit build/bin/eqemu_config.json to configure."
|
||||
|
||||
maps:
|
||||
@echo "Downloading maps..."
|
||||
@mkdir -p base/maps
|
||||
@cd base/maps && wget -nc https://github.com/Akkadius/eqemu-maps/archive/refs/heads/master.zip
|
||||
@cd base/maps && unzip -o master.zip
|
||||
@cd base/maps && mv eqemu-maps-master/* .
|
||||
@cd base/maps && rm -rf eqemu-maps-master
|
||||
@echo "Maps downloaded."
|
||||
is-vscode:
|
||||
@if [ -z "$$REMOTE_CONTAINERS" ]; then \
|
||||
echo "Not running in VS Code devcontainer"; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
quests:
|
||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
||||
@make -C ../ -f .devcontainer/Makefile quests --no-print-directory
|
||||
exit
|
||||
endif
|
||||
@cd build/bin && git clone https://github.com/ProjectEQ/projecteqquests.git quests
|
||||
clean: is-vscode
|
||||
rm -rf build
|
||||
|
||||
.PHONY: maps
|
||||
maps: is-vscode
|
||||
@echo "Downloading maps..."
|
||||
@mkdir -p .devcontainer/repo/maps
|
||||
@cd .devcontainer/repo/maps && wget -nc https://github.com/EQEmu/maps/archive/refs/heads/master.zip
|
||||
@cd .devcontainer/repo/maps && unzip -o master.zip
|
||||
@cd .devcontainer/repo/maps && mv maps-master/* .
|
||||
@cd .devcontainer/repo/maps && rm -rf maps-master
|
||||
@echo "Maps downloaded."
|
||||
|
||||
# Runs tests
|
||||
.PHONY: test
|
||||
test:
|
||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
||||
@make -C ../ -f .devcontainer/Makefile test --no-print-directory
|
||||
exit
|
||||
endif
|
||||
test: is-vscode
|
||||
cd build/bin && ./tests
|
||||
|
||||
# Runs login binary
|
||||
.PHONY: login
|
||||
login:
|
||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
||||
@make -C ../ -f .devcontainer/Makefile login --no-print-directory
|
||||
exit
|
||||
endif
|
||||
login: is-vscode check-mariadb
|
||||
cd build/bin && ./loginserver
|
||||
|
||||
.PHONY: hotfix
|
||||
hotfix: shared
|
||||
|
||||
# Runs shared_memory binary
|
||||
.PHONY: shared
|
||||
shared:
|
||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
||||
@make -C ../ -f .devcontainer/Makefile shared --no-print-directory
|
||||
exit
|
||||
endif
|
||||
shared: is-vscode check-mariadb
|
||||
cd build/bin && ./shared_memory
|
||||
|
||||
# Runs zone binary
|
||||
.PHONY: zone
|
||||
zone:
|
||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
||||
@make -C ../ -f .devcontainer/Makefile zone --no-print-directory
|
||||
exit
|
||||
endif
|
||||
@-rm build/bin/logs/zone/zone*.log
|
||||
zone: is-vscode check-mariadb
|
||||
@find build/bin/logs/zone/ -type f -name 'zone*.log' -exec rm -f {} +
|
||||
cd build/bin && ./zone
|
||||
|
||||
check-mariadb: is-vscode
|
||||
@if ! sudo service mariadb status | grep -q 'active (running)'; then \
|
||||
sudo service mariadb start; \
|
||||
fi
|
||||
|
||||
# Runs world binary
|
||||
.PHONY: world
|
||||
world:
|
||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
||||
@make -C ../ -f .devcontainer/Makefile world --no-print-directory
|
||||
exit
|
||||
endif
|
||||
@-rm build/bin/logs/world*.log
|
||||
world: is-vscode check-mariadb
|
||||
@find build/bin/logs/ -type f -name 'world*.log' -exec rm -f {} +
|
||||
cd build/bin && ./world
|
||||
|
||||
# Runs ucs binary
|
||||
.PHONY: ucs
|
||||
ucs:
|
||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
||||
@make -C ../ -f .devcontainer/Makefile ucs --no-print-directory
|
||||
exit
|
||||
endif
|
||||
@-rm build/bin/logs/ucs*.log
|
||||
ucs: is-vscode check-mariadb
|
||||
@find build/bin/logs/ -type f -name 'ucs*.log' -exec rm -f {} +
|
||||
cd build/bin && ./ucs
|
||||
|
||||
# Runs queryserv binary
|
||||
.PHONY: queryserv
|
||||
queryserv:
|
||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
||||
@make -C ../ -f .devcontainer/Makefile queryserv --no-print-directory
|
||||
exit
|
||||
endif
|
||||
@-rm build/bin/logs/query_server*.log
|
||||
queryserv: is-vscode check-mariadb
|
||||
@find build/bin/logs/ -type f -name 'query_server*.log' -exec rm -f {} +
|
||||
cd build/bin && ./queryserv
|
||||
|
||||
valgrind-%:
|
||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
||||
@make -C ../ -f .devcontainer/Makefile valgrind --no-print-directory
|
||||
exit
|
||||
endif
|
||||
reset-content:
|
||||
@echo "Resetting content tables in database peq..."
|
||||
cd .devcontainer/cache/db/peq-dump && sudo mariadb --database peq -e "source create_tables_content.sql"
|
||||
|
||||
valgrind-%: is-vscode
|
||||
cd build/bin && valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=logs/$*.valgrind.log ./$*
|
||||
|
||||
# Start mariaDB standalone
|
||||
@ -201,30 +132,33 @@ mariadb:
|
||||
.PHONY: inject-mariadb
|
||||
inject-mariadb:
|
||||
-sudo service mariadb start
|
||||
-mkdir -p base/db/
|
||||
-mkdir -p .devcontainer/cache/db/
|
||||
-sudo mariadb -e 'DROP DATABASE IF EXISTS peq;'
|
||||
-sudo mariadb -e 'CREATE DATABASE peq;'
|
||||
-sudo mariadb -e "CREATE USER 'peq'@'127.0.0.1' IDENTIFIED BY 'peqpass';"
|
||||
-sudo mariadb -e "CREATE USER IF NOT EXISTS 'peq'@'127.0.0.1' IDENTIFIED BY 'peqpass';"
|
||||
-sudo mariadb -e "GRANT ALL PRIVILEGES ON *.* TO 'peq'@'127.0.0.1';"
|
||||
ifeq (,$(wildcard base/db/db.sql.zip))
|
||||
@echo "base/db.sql.zip not found. Downloading latest from https://db.projecteq.net/"
|
||||
wget -nc https://db.projecteq.net/latest -O base/db/db.sql.zip
|
||||
-cd base/db && unzip db.sql.zip
|
||||
ifeq (,$(wildcard .devcontainer/cache/db/db.sql.zip))
|
||||
@echo ".devcontainer/cache/db.sql.zip not found. Downloading database from https://db.eqemu.dev/latest"
|
||||
wget -nc https://db.eqemu.dev/latest -O .devcontainer/cache/db/db.sql.zip
|
||||
-cd .devcontainer/cache/db && unzip db.sql.zip
|
||||
endif
|
||||
@echo "Sourcing db may take a while, please wait..."
|
||||
@cd base/db/peq-dump && sudo mariadb --database peq -e "source create_all_tables.sql"
|
||||
|
||||
@cd .devcontainer/cache/db/peq-dump && sudo mariadb --database peq -e "source create_tables_content.sql"
|
||||
@cd .devcontainer/cache/db/peq-dump && sudo mariadb --database peq -e "source create_tables_login.sql"
|
||||
@cd .devcontainer/cache/db/peq-dump && sudo mariadb --database peq -e "source create_tables_player.sql"
|
||||
@# deprecated cd .devcontainer/cache/db/peq-dump && sudo mariadb --database peq -e "source create_tables_queryserv.sql"
|
||||
@cd .devcontainer/cache/db/peq-dump && sudo mariadb --database peq -e "source create_tables_state.sql"
|
||||
@cd .devcontainer/cache/db/peq-dump && sudo mariadb --database peq -e "source create_tables_system.sql"
|
||||
|
||||
@echo "MariaDB is now injected."
|
||||
|
||||
.PHONY: gm-%
|
||||
gm-%:
|
||||
gm-%: is-vscode
|
||||
sudo mariadb --database peq -e "UPDATE account SET status=255 WHERE name = '$*';"
|
||||
@echo "Account $* is now a GM. /camp to have it go into effect."
|
||||
|
||||
depends:
|
||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
||||
@make -C ../ -f .devcontainer/Makefile depends --no-print-directory
|
||||
exit
|
||||
endif
|
||||
depends: is-vscode
|
||||
sudo apt install graphviz pip time
|
||||
pip3 install graphviz
|
||||
mkdir -p build/depends
|
||||
@ -241,44 +175,54 @@ endif
|
||||
@echo "Common..."
|
||||
time python3 build/depends/dependency_graph.py -f png common build/depends/common.dot
|
||||
|
||||
backup:
|
||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
||||
@make -C ../ -f .devcontainer/Makefile backup --no-print-directory
|
||||
exit
|
||||
endif
|
||||
backup: is-vscode
|
||||
@mkdir -p build/bin/backup
|
||||
cd build/bin && ./world database:dump --compress --player-tables --state-tables --system-tables --query-serv-tables
|
||||
|
||||
cpu-zone:
|
||||
restore-%: is-vscode
|
||||
@if [ -z "$*" ]; then \
|
||||
echo "Please provide a backup file to restore from. Example: make restore-backup.sql"; \
|
||||
exit 1; \
|
||||
fi
|
||||
@echo "Restoring from backup $*"
|
||||
@sudo mariadb --database peq -e "$*"
|
||||
|
||||
|
||||
cpu-zone: is-vscode
|
||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
||||
@make -C ../ -f .devcontainer/Makefile cpu-zone --no-print-directory
|
||||
@echo "This makefile is not intended to be run from the .devcontainer directory."
|
||||
exit
|
||||
endif
|
||||
@cd build/bin && mkdir -p tmp
|
||||
cd build/bin && CPUPROFILE=prof.out ./zone
|
||||
|
||||
pprof-zone:
|
||||
pprof-zone: is-vscode
|
||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
||||
@make -C ../ -f .devcontainer/Makefile pprof-zone --no-print-directory
|
||||
@echo "This makefile is not intended to be run from the .devcontainer directory."
|
||||
exit
|
||||
endif
|
||||
cd build/bin && google-pprof --pdf zone prof.out > prof.pdf
|
||||
pprof-web-zone:
|
||||
|
||||
pprof-gv-zone: is-vscode
|
||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
||||
@make -C ../ -f .devcontainer/Makefile pprof-web-zone --no-print-directory
|
||||
exit
|
||||
endif
|
||||
cd build/bin && google-pprof --web zone prof.out
|
||||
pprof-gv-zone:
|
||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
||||
@make -C ../ -f .devcontainer/Makefile pprof-gv-zone --no-print-directory
|
||||
@echo "This makefile is not intended to be run from the .devcontainer directory."
|
||||
exit
|
||||
endif
|
||||
cd build/bin && google-pprof --gv zone prof.out > prof.gv
|
||||
heap-zone:
|
||||
|
||||
heap-zone: is-vscode
|
||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
||||
@make -C ../ -f .devcontainer/Makefile heap-zone --no-print-directory
|
||||
@echo "This makefile is not intended to be run from the .devcontainer directory."
|
||||
exit
|
||||
endif
|
||||
@cd build/bin && mkdir -p tmp
|
||||
cd build/bin && HEAPPROFILE=prof.out ./zone
|
||||
|
||||
|
||||
.PHONY: pull
|
||||
pull:
|
||||
git pull
|
||||
@if [ ! -d "quests" ]; then git clone https://github.com/rebuildeq/quests.git quests; fi
|
||||
cd quests && git pull
|
||||
@if [ ! -d "eqemu-definitions" ]; then git clone https://github.com/xackery/eqemu-definitions.git eqemu-definitions; fi
|
||||
cd eqemu-definitions && git pull
|
||||
@ -40,10 +40,41 @@
|
||||
"GitHub.copilot",
|
||||
"xackery.make-magic",
|
||||
"Gruntfuggly.todo-tree",
|
||||
"ms-vscode.cmake-tools"
|
||||
]
|
||||
"ms-vscode.cmake-tools",
|
||||
"sumneko.lua"
|
||||
],
|
||||
"settings": {
|
||||
"Lua.runtime.version": "Lua 5.1",
|
||||
"Lua.workspace.library": [
|
||||
"/src/repo/eqemu-definitions"
|
||||
],
|
||||
"Lua.diagnostics.disable": [
|
||||
"lowercase-global"
|
||||
],
|
||||
"cmake.statusbar.advanced": {
|
||||
"kit": {
|
||||
"visibility": "hidden"
|
||||
},
|
||||
"debug": {
|
||||
"visibility": "hidden"
|
||||
},
|
||||
"buildTarget": {
|
||||
"visibility": "compact"
|
||||
},
|
||||
"launch": {
|
||||
"visibility": "hidden"
|
||||
},
|
||||
"ctest": {
|
||||
"visibility": "icon"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
"mounts": [
|
||||
"source=${localWorkspaceFolder}/.devcontainer/Makefile,target=/src/Makefile,type=bind,consistency=cached"
|
||||
],
|
||||
|
||||
"workspaceFolder": "/src",
|
||||
"workspaceMount": "source=${localWorkspaceFolder},target=/src,type=bind,consistency=cached"
|
||||
}
|
||||
98
.drone.yml
98
.drone.yml
@ -1,98 +0,0 @@
|
||||
---
|
||||
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: Build Linux
|
||||
|
||||
# Limits how many of these builds can run on the drone runner at a time, this isn't about cores
|
||||
concurrency:
|
||||
limit: 1
|
||||
|
||||
volumes:
|
||||
- name: cache
|
||||
host:
|
||||
path: /var/lib/cache-release
|
||||
|
||||
steps:
|
||||
- name: Build Linux X64
|
||||
image: akkadius/eqemu-server:v14
|
||||
environment:
|
||||
GITHUB_TOKEN:
|
||||
from_secret: GH_RELEASE_GITHUB_API_TOKEN
|
||||
RCLONE_CONFIG_REMOTE_TYPE: ftp
|
||||
RCLONE_FTP_HOST: drone.akkadius.com
|
||||
RCLONE_FTP_USER: artifacts
|
||||
RCLONE_FTP_PASS:
|
||||
from_secret: RCLONE_FTP_PASS
|
||||
commands:
|
||||
- ./utils/scripts/build/linux-build.sh
|
||||
volumes:
|
||||
- name: cache
|
||||
path: /home/eqemu/.ccache/
|
||||
|
||||
---
|
||||
|
||||
kind: pipeline
|
||||
type: exec
|
||||
name: Build Windows
|
||||
|
||||
# Limits how many of these builds can run on the drone runner at a time, this isn't about cores
|
||||
concurrency:
|
||||
limit: 1
|
||||
|
||||
platform:
|
||||
os: windows
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: Build Windows X64
|
||||
environment:
|
||||
RCLONE_CONFIG_REMOTE_TYPE: ftp
|
||||
RCLONE_FTP_HOST: drone.akkadius.com
|
||||
RCLONE_FTP_USER: artifacts
|
||||
RCLONE_FTP_PASS:
|
||||
from_secret: RCLONE_FTP_PASS
|
||||
GITHUB_TOKEN:
|
||||
from_secret: GH_RELEASE_GITHUB_API_TOKEN
|
||||
commands:
|
||||
- .\utils\scripts\build\windows-build.ps1
|
||||
|
||||
---
|
||||
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: Publish Artifacts to Github
|
||||
|
||||
steps:
|
||||
- name: Upload Artifacts
|
||||
image: akkadius/eqemu-build-releaser:v3
|
||||
environment:
|
||||
RCLONE_CONFIG_REMOTE_TYPE: ftp
|
||||
RCLONE_FTP_HOST: drone.akkadius.com
|
||||
RCLONE_FTP_USER: artifacts
|
||||
RCLONE_FTP_PASS:
|
||||
from_secret: RCLONE_FTP_PASS
|
||||
GH_RELEASE_GITHUB_API_TOKEN:
|
||||
from_secret: GH_RELEASE_GITHUB_API_TOKEN
|
||||
GITHUB_TOKEN:
|
||||
from_secret: GH_RELEASE_GITHUB_API_TOKEN
|
||||
commands:
|
||||
- ./utils/scripts/build/should-release/should-release
|
||||
- rclone config create remote ftp env_auth true > /dev/null
|
||||
- |
|
||||
rclone copy remote: --include "eqemu-server*.zip" .
|
||||
- gh-release --assets=eqemu-server-linux-x64.zip,eqemu-server-windows-x64.zip -y
|
||||
- |
|
||||
rclone delete remote: --include "eqemu-server*.zip"
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
- master
|
||||
event:
|
||||
- push
|
||||
|
||||
depends_on:
|
||||
- Build Windows
|
||||
- Build Linux
|
||||
|
||||
|
||||
81
.github/workflows/build.yaml
vendored
Normal file
81
.github/workflows/build.yaml
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
name: Build
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
linux:
|
||||
name: Linux
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout source
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Setup ccache
|
||||
uses: hendrikmuhs/ccache-action@v1.2
|
||||
with:
|
||||
key: ${{ runner.os }}-ccache
|
||||
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y build-essential ninja-build ccache uuid-dev
|
||||
|
||||
- name: Configure
|
||||
run: |
|
||||
cmake -S . -B build -G Ninja \
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=ccache \
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
|
||||
-DEQEMU_BUILD_TESTS=ON \
|
||||
-DEQEMU_BUILD_LOGIN=ON \
|
||||
-DEQEMU_BUILD_LUA=ON \
|
||||
-DEQEMU_BUILD_PERL=ON \
|
||||
-DEQEMU_BUILD_CLIENT_FILES=ON
|
||||
|
||||
- name: Build
|
||||
run: cmake --build build --parallel
|
||||
|
||||
- name: Test
|
||||
working-directory: build
|
||||
run: ./bin/tests
|
||||
|
||||
windows:
|
||||
name: Windows
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- name: Checkout source
|
||||
uses: actions/checkout@v5
|
||||
with:
|
||||
submodules: recursive
|
||||
|
||||
- name: Enable long paths
|
||||
run: git config --global core.longpaths true
|
||||
|
||||
- name: Setup MSVC environment
|
||||
uses: ilammy/msvc-dev-cmd@v1
|
||||
with:
|
||||
arch: x64
|
||||
|
||||
- name: Configure
|
||||
shell: pwsh
|
||||
run: |
|
||||
cmake -S . -B build -G "Visual Studio 17 2022" -A x64 `
|
||||
-DCMAKE_BUILD_TYPE=RelWithDebInfo `
|
||||
-DEQEMU_BUILD_TESTS=ON `
|
||||
-DEQEMU_BUILD_LOGIN=ON `
|
||||
-DEQEMU_BUILD_LUA=ON `
|
||||
-DEQEMU_BUILD_ZLIB=ON `
|
||||
-DEQEMU_BUILD_CLIENT_FILES=ON
|
||||
|
||||
- name: Build
|
||||
shell: pwsh
|
||||
run: cmake --build build --config RelWithDebInfo --target ALL_BUILD -- /m
|
||||
|
||||
- name: Test
|
||||
working-directory: build
|
||||
run: ./bin/RelWithDebInfo/tests.exe
|
||||
18
.gitmodules
vendored
18
.gitmodules
vendored
@ -1,18 +1,6 @@
|
||||
[submodule "submodules/glm"]
|
||||
path = submodules/glm
|
||||
url = https://github.com/g-truc/glm.git
|
||||
[submodule "submodules/fmt"]
|
||||
path = submodules/fmt
|
||||
url = https://github.com/fmtlib/fmt.git
|
||||
[submodule "submodules/libuv"]
|
||||
path = submodules/libuv
|
||||
url = https://github.com/libuv/libuv.git
|
||||
[submodule "submodules/cereal"]
|
||||
path = submodules/cereal
|
||||
url = https://github.com/USCiLab/cereal.git
|
||||
[submodule "submodules/websocketpp"]
|
||||
path = submodules/websocketpp
|
||||
url = https://github.com/zaphoyd/websocketpp.git
|
||||
[submodule "submodules/recastnavigation"]
|
||||
path = submodules/recastnavigation
|
||||
url = https://github.com/EQEmu/recastnavigation.git
|
||||
[submodule "submodules/vcpkg"]
|
||||
path = submodules/vcpkg
|
||||
url = https://github.com/microsoft/vcpkg.git
|
||||
|
||||
25
.vscode/settings.json
vendored
25
.vscode/settings.json
vendored
@ -21,14 +21,6 @@
|
||||
"${workspaceFolder}/dependencies/zlibng"
|
||||
],
|
||||
"telemetry.enableTelemetry": false,
|
||||
"cmake.buildDirectory": "${workspaceFolder}/build",
|
||||
"cmake.configureArgs": [
|
||||
"-DEQEMU_BUILD_LOGIN=ON",
|
||||
"-DEQEMU_BUILD_TESTS=ON",
|
||||
"-DCMAKE_CXX_COMPILER_LAUNCHER=ccache",
|
||||
"-DEQEMU_ADD_PROFILER=ON",
|
||||
"Ninja"
|
||||
],
|
||||
"cmake.skipConfigureIfCachePresent": true,
|
||||
"cmake.configureOnOpen": false,
|
||||
"files.associations": {
|
||||
@ -115,22 +107,5 @@
|
||||
"format": "cpp",
|
||||
"ranges": "cpp",
|
||||
"span": "cpp"
|
||||
},
|
||||
"cmake.statusbar.advanced": {
|
||||
"kit": {
|
||||
"visibility": "hidden",
|
||||
},
|
||||
"debug": {
|
||||
"visibility": "hidden",
|
||||
},
|
||||
"buildTarget": {
|
||||
"visibility": "hidden",
|
||||
},
|
||||
"launch": {
|
||||
"visibility": "hidden",
|
||||
},
|
||||
"ctest": {
|
||||
"visibility": "icon",
|
||||
}
|
||||
}
|
||||
}
|
||||
21
BUILD.md
21
BUILD.md
@ -4,46 +4,35 @@ This guide is far from exhaustive, you should expect to have some experience wit
|
||||
|
||||
### CMake
|
||||
|
||||
EQEmu uses CMake as the build system on all platforms. You will need CMake 3.2 or higher to build from source.
|
||||
EQEmu uses CMake as the build system on all platforms. You will need CMake 3.20 or higher to build from source.
|
||||
|
||||
### Dependencies
|
||||
|
||||
The following libraries are required to build from source:
|
||||
- [boost](https://www.boost.org/ "boost")
|
||||
- [zlib](https://www.zlib.net/ "zlib") (If not included the source will build [zlib-ng](https://github.com/zlib-ng/zlib-ng "zlib-ng") instead)
|
||||
- [libmysql](https://dev.mysql.com/downloads/connector/c/ "libmysql") or [libmariadb](https://github.com/MariaDB/mariadb-connector-c "libmariadb")
|
||||
- uuid (unix)
|
||||
|
||||
The following libraries are not strictly required but in many cased recommended.
|
||||
- [OpenSSL](https://www.openssl.org/ "OpenSSL") or [mbedTLS](https://tls.mbed.org/ "mbedTLS") (Required for the loginserver and headless client)
|
||||
- [libsodium](https://github.com/jedisct1/libsodium "libsodium") (Required for strong password hashing on the loginserver)
|
||||
- [Lua 5.1](https://www.lua.org/ "Lua 5.1") or [LuaJit](http://luajit.org/ "LuaJit") (Required for Lua Quest Scripting)
|
||||
- [Perl](https://www.perl.org/ "Perl") (Required for Perl Quest Scripting)
|
||||
|
||||
##### Windows
|
||||
For windows it is suggested you make use of [vcpkg](https://github.com/microsoft/vcpkg "vcpkg") if you wish to build your own dependencies.
|
||||
|
||||
If you wish to use Perl then you should use whichever version of Perl you have installed on the target system.
|
||||
|
||||
You can also download a vcpkg export from our releases section for Visual Studio [x86](https://github.com/EQEmu/Server/releases/download/v1.2/vcpkg-export-x86.zip "x86") or [x64](https://github.com/EQEmu/Server/releases/download/v1.2/vcpkg-export-x64.zip "x64") that includes a toolchain file you can pass to CMake.
|
||||
|
||||
##### Linux
|
||||
For Linux you simply can install the dependencies from your package manager, below is an example of doing it on Ubuntu using apt-get.
|
||||
|
||||
sudo apt-get install libmysqlclient-dev libperl-dev libboost-dev liblua5.1-0-dev zlib1g-dev uuid-dev libssl-dev
|
||||
sudo apt-get install libperl-dev uuid-dev
|
||||
|
||||
### Running CMake
|
||||
|
||||
##### Windows
|
||||
The following is a modified command our automated build server uses to run CMake via the release vcpkg export and its toolchain file.
|
||||
|
||||
Assuming it is starting in c:/projects/eqemu and the x64 dependencies were extracted to c:/projects/eqemu/vcpkg.
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -G "Visual Studio 15 2017 Win64" -DEQEMU_BUILD_TESTS=ON -DEQEMU_BUILD_LOGIN=ON -DEQEMU_BUILD_ZLIB=ON -DCMAKE_TOOLCHAIN_FILE="c:/projects/eqemu/vcpkg/vcpkg-export-20180828-145455/scripts/buildsystems/vcpkg.cmake" ..
|
||||
cmake -G "Visual Studio 15 2022 Win64" -DEQEMU_BUILD_TESTS=ON -DEQEMU_BUILD_LOGIN=ON ..
|
||||
|
||||
##### Linux
|
||||
Similarly to Windows running CMake on Linux is simple it just omits the toolchain file and uses a different generator.
|
||||
Similarly to Windows running CMake on Linux is simple it just uses a different generator.
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
|
||||
81
CHANGELOG.md
81
CHANGELOG.md
@ -1,3 +1,84 @@
|
||||
## [23.10.3] 9/16/2025
|
||||
|
||||
### Hotfix
|
||||
|
||||
* Hotfix crashes occurring in #4987. @Akkadius 2025-09-17
|
||||
|
||||
## [23.10.2] 9/16/2025
|
||||
|
||||
### Hotfix
|
||||
|
||||
* Revert #4996 as it was causing critical issues with spells that needs to be further investigated. @Akkadius 2025-09-17
|
||||
|
||||
## [23.10.1] 9/16/2025
|
||||
|
||||
### Hotfix
|
||||
* Fixed Mail Key Bug ([#5015](https://github.com/EQEmu/Server/pull/5015)) @Kinglykrab 2025-09-16
|
||||
|
||||
## [23.10.0] 9/15/2025
|
||||
|
||||
### Build
|
||||
|
||||
* Fix Linking with GCC ([#4969](https://github.com/EQEmu/Server/pull/4969)) @solar984 2025-08-03
|
||||
|
||||
### Code
|
||||
|
||||
* Add #npcedit npc_tint_id Help Message ([#4982](https://github.com/EQEmu/Server/pull/4982)) @Kinglykrab 2025-08-17
|
||||
* Cleanup #show ip_lookup Message ([#5005](https://github.com/EQEmu/Server/pull/5005)) @Kinglykrab 2025-08-30
|
||||
* Fix #set race 0 Message ([#5004](https://github.com/EQEmu/Server/pull/5004)) @Kinglykrab 2025-08-30
|
||||
* Fix Issues with Strings::Commify and Mob::SendStatsWindow ([#4984](https://github.com/EQEmu/Server/pull/4984)) @Kinglykrab 2025-08-17
|
||||
* Remove Attributions ([#4988](https://github.com/EQEmu/Server/pull/4988)) @KimLS 2025-08-16
|
||||
* Remove Unused errorname Variable ([#5001](https://github.com/EQEmu/Server/pull/5001)) @Kinglykrab 2025-08-29
|
||||
|
||||
### Commands
|
||||
|
||||
* Add #find account Subcommand ([#4981](https://github.com/EQEmu/Server/pull/4981)) @Kinglykrab 2025-08-17
|
||||
* Add #show keyring Subcommand ([#4973](https://github.com/EQEmu/Server/pull/4973)) @Kinglykrab 2025-08-03
|
||||
* Add #task complete Saylink to #task show ([#4985](https://github.com/EQEmu/Server/pull/4985)) @Kinglykrab 2025-08-17
|
||||
|
||||
### Constants
|
||||
|
||||
* Change Race Changes to Race Namespace ([#5000](https://github.com/EQEmu/Server/pull/5000)) @Kinglykrab 2025-08-30
|
||||
* Convert SE Defines to SpellEffect Namespace ([#4999](https://github.com/EQEmu/Server/pull/4999)) @Kinglykrab 2025-08-30
|
||||
|
||||
### Database
|
||||
|
||||
* Add `heal_amount` to `character_stats_record` ([#4986](https://github.com/EQEmu/Server/pull/4986)) @Kinglykrab 2025-08-17
|
||||
|
||||
### Fixes
|
||||
|
||||
* Fix #show recipe uint16 Cap ([#4978](https://github.com/EQEmu/Server/pull/4978)) @Kinglykrab 2025-08-11
|
||||
* Fix Race 474 for Titanium ([#4979](https://github.com/EQEmu/Server/pull/4979)) @regneq 2025-08-11
|
||||
* Fix Recipe Inspect Bug ([#4994](https://github.com/EQEmu/Server/pull/4994)) @Kinglykrab 2025-08-30
|
||||
* Fix Several Evolving Item Bugs ([#4992](https://github.com/EQEmu/Server/pull/4992)) @neckkola 2025-09-08
|
||||
* Fix Task Reloading ([#5002](https://github.com/EQEmu/Server/pull/5002)) @Kinglykrab 2025-08-29
|
||||
|
||||
### Loginserver
|
||||
|
||||
* Fix Legacy World When Using Local DB ([#4970](https://github.com/EQEmu/Server/pull/4970)) @solar984 2025-08-03
|
||||
|
||||
### Pets
|
||||
|
||||
* Add Pet Constants and Methods ([#4987](https://github.com/EQEmu/Server/pull/4987)) @Kinglykrab 2025-08-17
|
||||
|
||||
### Quest API
|
||||
|
||||
* Add EVENT_CHARM_START and EVENT_CHARM_END ([#5013](https://github.com/EQEmu/Server/pull/5013)) @Kinglykrab 2025-09-15
|
||||
* Add GetKeyRing() to Perl/Lua ([#4980](https://github.com/EQEmu/Server/pull/4980)) @Kinglykrab 2025-08-17
|
||||
* Add GetNPCTintIndex() to Perl/Lua ([#4983](https://github.com/EQEmu/Server/pull/4983)) @Kinglykrab 2025-08-17
|
||||
* Add GetTimers() and GetPausedTimers() to Perl/Lua ([#4965](https://github.com/EQEmu/Server/pull/4965)) @Kinglykrab 2025-08-03
|
||||
* Add Identifiers to Get/Modify NPC Stat Methods ([#5012](https://github.com/EQEmu/Server/pull/5012)) @Kinglykrab 2025-09-15
|
||||
|
||||
### Repositories
|
||||
|
||||
* Convert Character Inspect Messages to Repositories ([#4997](https://github.com/EQEmu/Server/pull/4997)) @Kinglykrab 2025-08-30
|
||||
* Convert Damage Shield Types to Repositories ([#4995](https://github.com/EQEmu/Server/pull/4995)) @Kinglykrab 2025-08-30
|
||||
* Convert Item Loading to Repositories ([#4998](https://github.com/EQEmu/Server/pull/4998)) @Kinglykrab 2025-08-30
|
||||
* Convert Mail Key to Repositories ([#5007](https://github.com/EQEmu/Server/pull/5007)) @Kinglykrab 2025-09-15
|
||||
* Convert Shared Bank Platinum to Repositories ([#5006](https://github.com/EQEmu/Server/pull/5006)) @Kinglykrab 2025-09-02
|
||||
* Convert Spell Loading to Repositories ([#4996](https://github.com/EQEmu/Server/pull/4996)) @Kinglykrab 2025-08-30
|
||||
* Convert Total Time Played to Repositories ([#5008](https://github.com/EQEmu/Server/pull/5008)) @Kinglykrab 2025-09-15
|
||||
|
||||
## [23.9.1] 8/2/2025
|
||||
|
||||
### Hotfix
|
||||
|
||||
608
CMakeLists.txt
608
CMakeLists.txt
@ -1,490 +1,180 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.12)
|
||||
cmake_minimum_required(VERSION 3.20.0)
|
||||
|
||||
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH})
|
||||
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH})
|
||||
|
||||
IF(POLICY CMP0074)
|
||||
CMAKE_POLICY(SET CMP0074 NEW)
|
||||
ENDIF()
|
||||
if(NOT CMAKE_TOOLCHAIN_FILE)
|
||||
if(DEFINED ENV{VCPKG_ROOT})
|
||||
message(STATUS "Using vcpkg from VCPKG_ROOT")
|
||||
set(CMAKE_TOOLCHAIN_FILE
|
||||
"$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake"
|
||||
CACHE FILEPATH "Vcpkg toolchain file"
|
||||
)
|
||||
else()
|
||||
message(STATUS "Using vcpkg submodule")
|
||||
set(CMAKE_TOOLCHAIN_FILE
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/submodules/vcpkg/scripts/buildsystems/vcpkg.cmake"
|
||||
CACHE FILEPATH "Vcpkg toolchain file"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
PROJECT(EQEmu)
|
||||
project(EQEmu
|
||||
VERSION 24.10.3
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
IF(NOT CMAKE_BUILD_TYPE)
|
||||
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
|
||||
ENDIF(NOT CMAKE_BUILD_TYPE)
|
||||
#explicitly set CMP0167 for Find Boost
|
||||
if(POLICY CMP0167)
|
||||
cmake_policy(SET CMP0167 NEW)
|
||||
endif()
|
||||
|
||||
SET(CMAKE_CXX_STANDARD 20)
|
||||
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
SET(CMAKE_CXX_EXTENSIONS OFF)
|
||||
if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
|
||||
set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE STRING "Build type")
|
||||
endif()
|
||||
|
||||
OPTION(EQEMU_BUILD_STATIC "Build with static linking" OFF)
|
||||
OPTION(EQEMU_BUILD_PCH "Build with precompiled headers (Windows)" ON)
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
set(CMAKE_CXX_EXTENSIONS OFF)
|
||||
|
||||
IF (EQEMU_BUILD_STATIC)
|
||||
SET(BUILD_SHARED_LIBS OFF)
|
||||
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".a")
|
||||
MESSAGE(STATUS "Building with static linking")
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
|
||||
IF (UNIX)
|
||||
SET(PERL_LIBRARY "/opt/eqemu-perl/lib/5.32.1/x86_64-linux-thread-multi/CORE/libperl.so")
|
||||
SET(PERL_INCLUDE_PATH "/opt/eqemu-perl/lib/5.32.1/x86_64-linux-thread-multi/CORE/")
|
||||
SET(PERL_EXECUTABLE "/opt/eqemu-perl/bin/perl")
|
||||
ENDIF ()
|
||||
ENDIF (EQEMU_BUILD_STATIC)
|
||||
option(EQEMU_BUILD_PCH "Build with precompiled headers (Windows)" ON)
|
||||
|
||||
|
||||
# Requires libgoogle-perftools-dev google-perftools packages for linux (debian)
|
||||
IF(EQEMU_ADD_PROFILER)
|
||||
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-as-needed,-lprofiler,--as-needed")
|
||||
ENDIF(EQEMU_ADD_PROFILER)
|
||||
|
||||
IF(USE_MAP_MMFS)
|
||||
ADD_DEFINITIONS(-DUSE_MAP_MMFS)
|
||||
ENDIF (USE_MAP_MMFS)
|
||||
|
||||
IF(MSVC)
|
||||
if(MSVC)
|
||||
add_compile_options(/bigobj)
|
||||
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
|
||||
ADD_DEFINITIONS(-DNOMINMAX)
|
||||
ADD_DEFINITIONS(-DCRASH_LOGGING)
|
||||
ADD_DEFINITIONS(-D_HAS_AUTO_PTR_ETC) # for Luabind on C++17
|
||||
add_compile_definitions(_CRT_SECURE_NO_WARNINGS NOMINMAX CRASH_LOGGING _HAS_AUTO_PTR_ETC)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||
|
||||
OPTION(EQEMU_DISABLE_MSVC_WARNINGS "Disable MSVC compile warnings." ON)
|
||||
IF(EQEMU_DISABLE_MSVC_WARNINGS)
|
||||
ADD_DEFINITIONS( "/W0 /D_CRT_SECURE_NO_WARNINGS /wd4005 /wd4996 /nologo /Os")
|
||||
ENDIF(EQEMU_DISABLE_MSVC_WARNINGS)
|
||||
ELSE(MSVC)
|
||||
ADD_DEFINITIONS(-DHAS_UNION_SEMUN)
|
||||
ENDIF(MSVC)
|
||||
option(EQEMU_DISABLE_MSVC_WARNINGS "Disable MSVC compile warnings." ON)
|
||||
if(EQEMU_DISABLE_MSVC_WARNINGS)
|
||||
add_compile_options(/W0 /wd4005 /wd4996 /nologo /Os)
|
||||
endif()
|
||||
else()
|
||||
add_compile_definitions(HAS_UNION_SEMUN)
|
||||
endif()
|
||||
|
||||
#FreeBSD support
|
||||
IF(UNIX)
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
ADD_DEFINITIONS(-DFREEBSD)
|
||||
ADD_DEFINITIONS(-D_GLIBCXX_USE_C99)
|
||||
SET(FREEBSD TRUE)
|
||||
ENDIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
IF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
ADD_DEFINITIONS(-DDARWIN)
|
||||
SET(DARWIN TRUE)
|
||||
ENDIF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
ENDIF(UNIX)
|
||||
if(UNIX)
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||
add_compile_definitions(FREEBSD)
|
||||
add_compile_definitions(_GLIBCXX_USE_C99)
|
||||
set(FREEBSD TRUE)
|
||||
endif()
|
||||
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||
add_compile_definitions(DARWIN)
|
||||
set(DARWIN TRUE)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
ADD_DEFINITIONS(-DGLM_FORCE_RADIANS)
|
||||
ADD_DEFINITIONS(-DGLM_FORCE_CTOR_INIT)
|
||||
ADD_DEFINITIONS(-DGLM_ENABLE_EXPERIMENTAL)
|
||||
find_package(Boost REQUIRED COMPONENTS dynamic_bitset foreach tuple)
|
||||
find_package(cereal CONFIG REQUIRED)
|
||||
find_package(fmt CONFIG REQUIRED)
|
||||
find_package(glm CONFIG REQUIRED)
|
||||
find_package(unofficial-libmariadb CONFIG REQUIRED)
|
||||
find_package(libuv CONFIG REQUIRED)
|
||||
find_package(OpenSSL REQUIRED)
|
||||
find_package(recastnavigation CONFIG REQUIRED)
|
||||
find_package(ZLIB REQUIRED)
|
||||
find_package(LuaJit REQUIRED)
|
||||
find_package(unofficial-sodium CONFIG REQUIRED)
|
||||
find_package(PerlLibs)
|
||||
|
||||
#MSVC can fetch dependencies automatically.
|
||||
IF(MSVC)
|
||||
INCLUDE("${CMAKE_SOURCE_DIR}/cmake/DependencyHelperMSVC.cmake")
|
||||
ENDIF()
|
||||
message(STATUS "**************************************************")
|
||||
message(STATUS "* Library Detection *")
|
||||
message(STATUS "**************************************************")
|
||||
|
||||
#Find everything we need
|
||||
FIND_PACKAGE(Boost REQUIRED)
|
||||
FIND_PACKAGE(MySQL)
|
||||
FIND_PACKAGE(MariaDB)
|
||||
FIND_PACKAGE(ZLIB)
|
||||
FIND_PACKAGE(OpenSSL)
|
||||
FIND_PACKAGE(Lua51)
|
||||
FIND_PACKAGE(LuaJit)
|
||||
FIND_PACKAGE(PerlLibs)
|
||||
FIND_PACKAGE(Sodium)
|
||||
FIND_PACKAGE(mbedTLS)
|
||||
if(MARIADB_FOUND)
|
||||
message(STATUS "* MariaDB: FOUND *")
|
||||
else()
|
||||
message(STATUS "* MariaDB: MISSING *")
|
||||
endif()
|
||||
|
||||
MESSAGE(STATUS "**************************************************")
|
||||
MESSAGE(STATUS "* Library Detection *")
|
||||
MESSAGE(STATUS "**************************************************")
|
||||
if(ZLIB_FOUND)
|
||||
message(STATUS "* ZLIB: FOUND *")
|
||||
else()
|
||||
message(STATUS "* ZLIB: MISSING *")
|
||||
endif()
|
||||
|
||||
IF(MYSQL_FOUND)
|
||||
MESSAGE(STATUS "* MySQL: FOUND *")
|
||||
ELSE()
|
||||
MESSAGE(STATUS "* MySQL: MISSING *")
|
||||
ENDIF()
|
||||
if(LuaJit_FOUND)
|
||||
message(STATUS "* LuaJIT: FOUND *")
|
||||
else()
|
||||
message(STATUS "* LuaJIT: MISSING *")
|
||||
endif()
|
||||
|
||||
IF(MARIADB_FOUND)
|
||||
MESSAGE(STATUS "* MariaDB: FOUND *")
|
||||
ELSE()
|
||||
MESSAGE(STATUS "* MariaDB: MISSING *")
|
||||
ENDIF()
|
||||
if(PerlLibs_FOUND)
|
||||
message(STATUS "* Perl: FOUND *")
|
||||
else()
|
||||
message(STATUS "* Perl: MISSING *")
|
||||
endif()
|
||||
|
||||
IF(ZLIB_FOUND)
|
||||
MESSAGE(STATUS "* ZLIB: FOUND *")
|
||||
ELSE()
|
||||
MESSAGE(STATUS "* ZLIB: MISSING *")
|
||||
ENDIF()
|
||||
if(OpenSSL_FOUND)
|
||||
message(STATUS "* OpenSSL: FOUND *")
|
||||
else()
|
||||
message(STATUS "* OpenSSL: MISSING *")
|
||||
endif()
|
||||
|
||||
IF(Lua51_FOUND)
|
||||
MESSAGE(STATUS "* Lua: FOUND *")
|
||||
ELSE()
|
||||
MESSAGE(STATUS "* Lua: MISSING *")
|
||||
ENDIF()
|
||||
|
||||
IF(LuaJit_FOUND)
|
||||
MESSAGE(STATUS "* LuaJIT: FOUND *")
|
||||
ELSE()
|
||||
MESSAGE(STATUS "* LuaJIT: MISSING *")
|
||||
ENDIF()
|
||||
|
||||
IF(PerlLibs_FOUND)
|
||||
MESSAGE(STATUS "* Perl: FOUND *")
|
||||
ELSE()
|
||||
MESSAGE(STATUS "* Perl: MISSING *")
|
||||
ENDIF()
|
||||
|
||||
IF(SODIUM_FOUND)
|
||||
MESSAGE(STATUS "* libsodium: FOUND *")
|
||||
ELSE()
|
||||
MESSAGE(STATUS "* libsodium: MISSING *")
|
||||
ENDIF()
|
||||
|
||||
IF(OpenSSL_FOUND)
|
||||
MESSAGE(STATUS "* OpenSSL: FOUND *")
|
||||
ELSE()
|
||||
MESSAGE(STATUS "* OpenSSL: MISSING *")
|
||||
ENDIF()
|
||||
|
||||
IF(MBEDTLS_FOUND)
|
||||
MESSAGE(STATUS "* mbedTLS: FOUND *")
|
||||
ELSE()
|
||||
MESSAGE(STATUS "* mbedTLS: MISSING *")
|
||||
ENDIF()
|
||||
|
||||
MESSAGE(STATUS "PERL_INCLUDE_PATH: ${PERL_INCLUDE_PATH}")
|
||||
MESSAGE(STATUS "PERL_LIBRARY: ${PERL_LIBRARY}")
|
||||
MESSAGE(STATUS "PERL_INCLUDE_DIR: ${PERL_INCLUDE_DIR}")
|
||||
MESSAGE(STATUS "PERL_INCLUDE_DIRS: ${PERL_INCLUDE_DIRS}")
|
||||
MESSAGE(STATUS "PERL_LIBRARIES: ${PERL_LIBRARIES}")
|
||||
MESSAGE(STATUS "PERL_VERSION: ${PERL_VERSION}")
|
||||
|
||||
MESSAGE(STATUS "**************************************************")
|
||||
message(STATUS "PERL_INCLUDE_PATH: ${PERL_INCLUDE_PATH}")
|
||||
message(STATUS "PERL_LIBRARY: ${PERL_LIBRARY}")
|
||||
message(STATUS "PERL_INCLUDE_DIR: ${PERL_INCLUDE_DIR}")
|
||||
message(STATUS "PERL_INCLUDE_DIRS: ${PERL_INCLUDE_DIRS}")
|
||||
message(STATUS "PERL_LIBRARIES: ${PERL_LIBRARIES}")
|
||||
message(STATUS "PERL_VERSION: ${PERL_VERSION}")
|
||||
message(STATUS "**************************************************")
|
||||
|
||||
#options
|
||||
OPTION(EQEMU_COMMANDS_LOGGING "Enable GM Command logs" ON)
|
||||
OPTION(EQEMU_BUILD_SERVER "Build the game server." ON)
|
||||
OPTION(EQEMU_BUILD_LOGIN "Build the login server." ON)
|
||||
OPTION(EQEMU_BUILD_HC "Build the headless client." OFF)
|
||||
OPTION(EQEMU_BUILD_TESTS "Build utility tests." OFF)
|
||||
OPTION(EQEMU_BUILD_CLIENT_FILES "Build Client Import/Export Data Programs." ON)
|
||||
OPTION(EQEMU_PREFER_LUA "Build with normal Lua even if LuaJIT is found." OFF)
|
||||
option(EQEMU_BUILD_SERVER "Build the game server." ON)
|
||||
option(EQEMU_BUILD_LOGIN "Build the login server." ON)
|
||||
option(EQEMU_BUILD_TESTS "Build utility tests." OFF)
|
||||
option(EQEMU_BUILD_CLIENT_FILES "Build Client Import/Export Data Programs." ON)
|
||||
|
||||
#PRNG options
|
||||
OPTION(EQEMU_ADDITIVE_LFIB_PRNG "Use Additive LFib for PRNG." OFF)
|
||||
MARK_AS_ADVANCED(EQEMU_ADDITIVE_LFIB_PRNG)
|
||||
OPTION(EQEMU_BIASED_INT_DIST "Use biased int dist instead of uniform." OFF)
|
||||
MARK_AS_ADVANCED(EQEMU_BIASED_INT_DIST)
|
||||
SET(EQEMU_CUSTOM_PRNG_ENGINE "" CACHE STRING "Custom random engine. (ex. std::default_random_engine)")
|
||||
MARK_AS_ADVANCED(EQEMU_CUSTOM_PRNG_ENGINE)
|
||||
if(PerlLibs_FOUND)
|
||||
option(EQEMU_BUILD_PERL "Build Perl parser." ON)
|
||||
|
||||
if(EQEMU_BUILD_PERL)
|
||||
set(PERL_LIBRARY_TYPE " Perl")
|
||||
else()
|
||||
set(PERL_LIBRARY_TYPE " Missing")
|
||||
endif()
|
||||
else()
|
||||
set(PERL_LIBRARY_TYPE "Disabled")
|
||||
endif()
|
||||
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
OPTION(EQEMU_SFMT19937 "Use GCC's extention for SIMD Fast MT19937." OFF)
|
||||
MARK_AS_ADVANCED(EQEMU_SFMT19937)
|
||||
ENDIF()
|
||||
message(STATUS "")
|
||||
message(STATUS "**************************************************")
|
||||
message(STATUS "* Library Usage *")
|
||||
message(STATUS "**************************************************")
|
||||
message(STATUS "* Database: MariaDB *")
|
||||
message(STATUS "* TLS: OpenSSL *")
|
||||
message(STATUS "* Lua: LuaJIT *")
|
||||
message(STATUS "* Perl: ${PERL_LIBRARY_TYPE} *")
|
||||
message(STATUS "* zlib: ZLIB *")
|
||||
message(STATUS "**************************************************")
|
||||
|
||||
IF(EQEMU_ADDITIVE_LFIB_PRNG)
|
||||
ADD_DEFINITIONS(-DUSE_ADDITIVE_LFIB_PRNG)
|
||||
IF(EQEMU_SFMT19937)
|
||||
MESSAGE(STATUS "SFMT19937 and ADDITITVE_LFIB_PRNG both set, SFMT19937 ignored.")
|
||||
SET(EQEMU_SFMT19937 OFF)
|
||||
ENDIF()
|
||||
IF(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "")
|
||||
MESSAGE(STATUS "CUSTOM_PRNG_ENGINE and ADDITITVE_LFIB_PRNG both set, CUSTOM_PRNG_ENGINE ignored.")
|
||||
SET(EQEMU_CUSTOM_PRNG_ENGINE "")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(EQEMU_SFMT19937)
|
||||
ADD_DEFINITIONS(-DUSE_SFMT19937)
|
||||
IF(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "")
|
||||
MESSAGE(STATUS "CUSTOM_PRNG_ENGINE and SFMT19937 both set, CUSTOM_PRNG_ENGINE ignored.")
|
||||
SET(EQEMU_CUSTOM_PRNG_ENGINE "")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
option(EQEMU_BUILD_LUA "Build Lua parser." ON)
|
||||
|
||||
IF(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "")
|
||||
ADD_DEFINITIONS(-DUSE_CUSTOM_PRNG_ENGINE=${EQEMU_CUSTOM_PRNG_ENGINE})
|
||||
ENDIF()
|
||||
if(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_CLIENT_FILES)
|
||||
add_subdirectory(common)
|
||||
add_subdirectory(libs)
|
||||
else()
|
||||
message(FATAL_ERROR "No targets were selected to build, we must build at least one target.")
|
||||
endif()
|
||||
|
||||
IF(EQEMU_BIASED_INT_DIST)
|
||||
ADD_DEFINITIONS(-DBIASED_INT_DIST)
|
||||
ENDIF()
|
||||
if(EQEMU_BUILD_SERVER)
|
||||
add_subdirectory(shared_memory)
|
||||
add_subdirectory(world)
|
||||
add_subdirectory(zone)
|
||||
add_subdirectory(ucs)
|
||||
add_subdirectory(queryserv)
|
||||
add_subdirectory(eqlaunch)
|
||||
endif()
|
||||
|
||||
IF(EQEMU_COMMANDS_LOGGING)
|
||||
ADD_DEFINITIONS(-DCOMMANDS_LOGGING)
|
||||
ENDIF(EQEMU_COMMANDS_LOGGING)
|
||||
if(EQEMU_BUILD_LOGIN)
|
||||
add_subdirectory(loginserver)
|
||||
endif()
|
||||
|
||||
#database
|
||||
IF(MySQL_FOUND AND MariaDB_FOUND)
|
||||
SET(DATABASE_LIBRARY_SELECTION MariaDB CACHE STRING "Database library to use:
|
||||
MySQL
|
||||
MariaDB"
|
||||
)
|
||||
if(EQEMU_BUILD_TESTS)
|
||||
add_subdirectory(tests)
|
||||
endif()
|
||||
|
||||
IF(DATABASE_LIBRARY_SELECTION STREQUAL "MySQL")
|
||||
SET(DATABASE_LIBRARY_TYPE " MySQL")
|
||||
SET(DATABASE_LIBRARY_LIBS ${MySQL_LIBRARIES})
|
||||
SET(DATABASE_LIBRARY_INCLUDE ${MySQL_INCLUDE_DIR})
|
||||
ELSEIF(DATABASE_LIBRARY_SELECTION STREQUAL "MariaDB")
|
||||
SET(DATABASE_LIBRARY_TYPE "MariaDB")
|
||||
SET(DATABASE_LIBRARY_LIBS ${MariaDB_LIBRARIES})
|
||||
SET(DATABASE_LIBRARY_INCLUDE ${MariaDB_INCLUDE_DIR})
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Unknown database library set, should be one of: MySQL, MariaDB")
|
||||
ENDIF()
|
||||
ELSEIF(MariaDB_FOUND)
|
||||
SET(DATABASE_LIBRARY_TYPE "MariaDB")
|
||||
SET(DATABASE_LIBRARY_LIBS ${MariaDB_LIBRARIES})
|
||||
SET(DATABASE_LIBRARY_INCLUDE ${MariaDB_INCLUDE_DIR})
|
||||
ELSEIF(MySQL_FOUND)
|
||||
SET(DATABASE_LIBRARY_TYPE " MySQL")
|
||||
SET(DATABASE_LIBRARY_LIBS ${MySQL_LIBRARIES})
|
||||
SET(DATABASE_LIBRARY_INCLUDE ${MySQL_INCLUDE_DIR})
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "One of MySQL or MariaDB is a required dependency.")
|
||||
ENDIF()
|
||||
|
||||
#security
|
||||
#prefer openssl to mbedtls (arbitrary)
|
||||
IF(OpenSSL_FOUND AND MBEDTLS_FOUND)
|
||||
SET(TLS_LIBRARY_SELECTION OpenSSL CACHE STRING "TLS library to use:
|
||||
OpenSSL
|
||||
mbedTLS"
|
||||
)
|
||||
|
||||
IF(TLS_LIBRARY_SELECTION STREQUAL "OpenSSL")
|
||||
SET(TLS_LIBRARY_TYPE " OpenSSL")
|
||||
SET(TLS_LIBRARY_ENABLED ON)
|
||||
SET(TLS_LIBRARY_LIBS ${OPENSSL_LIBRARIES})
|
||||
SET(TLS_LIBRARY_INCLUDE ${OPENSSL_INCLUDE_DIR})
|
||||
ADD_DEFINITIONS(-DEQEMU_USE_OPENSSL)
|
||||
IF(${OPENSSL_VERSION} VERSION_GREATER_EQUAL "1.1.1")
|
||||
ADD_DEFINITIONS(-DCPPHTTPLIB_OPENSSL_SUPPORT)
|
||||
ENDIF()
|
||||
ELSEIF(TLS_LIBRARY_SELECTION STREQUAL "mbedTLS")
|
||||
SET(TLS_LIBRARY_TYPE " mbedTLS")
|
||||
SET(TLS_LIBRARY_ENABLED ON)
|
||||
SET(TLS_LIBRARY_LIBS ${MBEDTLS_LIBRARY} ${MBEDX509_LIBRARY} ${MBEDCRYPTO_LIBRARY})
|
||||
SET(TLS_LIBRARY_INCLUDE ${MBEDTLS_INCLUDE_DIR})
|
||||
ADD_DEFINITIONS(-DEQEMU_USE_MBEDTLS)
|
||||
ELSE()
|
||||
MESSAGE(FATAL_ERROR "Unknown TLS library set, should be one of: OpenSSL, mbedTLS")
|
||||
ENDIF()
|
||||
ELSEIF(OpenSSL_FOUND)
|
||||
SET(TLS_LIBRARY_TYPE " OpenSSL")
|
||||
SET(TLS_LIBRARY_ENABLED ON)
|
||||
SET(TLS_LIBRARY_LIBS ${OPENSSL_LIBRARIES})
|
||||
SET(TLS_LIBRARY_INCLUDE ${OPENSSL_INCLUDE_DIR})
|
||||
ADD_DEFINITIONS(-DEQEMU_USE_OPENSSL)
|
||||
IF(${OPENSSL_VERSION} VERSION_GREATER_EQUAL "1.1.1")
|
||||
ADD_DEFINITIONS(-DCPPHTTPLIB_OPENSSL_SUPPORT)
|
||||
ENDIF()
|
||||
ELSEIF(MBEDTLS_FOUND)
|
||||
SET(TLS_LIBRARY_TYPE " mbedTLS")
|
||||
SET(TLS_LIBRARY_ENABLED ON)
|
||||
SET(TLS_LIBRARY_LIBS ${MBEDTLS_LIBRARY} ${MBEDX509_LIBRARY} ${MBEDCRYPTO_LIBRARY})
|
||||
SET(TLS_LIBRARY_INCLUDE ${MBEDTLS_INCLUDE_DIR})
|
||||
ADD_DEFINITIONS(-DEQEMU_USE_MBEDTLS)
|
||||
ELSE()
|
||||
SET(TLS_LIBRARY_TYPE "Disabled")
|
||||
SET(TLS_LIBRARY_ENABLED OFF)
|
||||
ENDIF()
|
||||
|
||||
IF(SODIUM_FOUND)
|
||||
SET(SODIUM_LIBRARY_TYPE "Libsodium")
|
||||
SET(SODIUM_LIBRARY_ENABLED ON)
|
||||
SET(SODIUM_LIBRARY_LIBS ${SODIUM_LIBRARIES})
|
||||
SET(SODIUM_LIBRARY_INCLUDE ${SODIUM_INCLUDE_DIRS})
|
||||
ADD_DEFINITIONS(-DENABLE_SECURITY)
|
||||
ELSE()
|
||||
SET(SODIUM_LIBRARY_TYPE " Disabled")
|
||||
SET(SODIUM_LIBRARY_ENABLED OFF)
|
||||
ENDIF()
|
||||
|
||||
IF(LUAJIT_FOUND AND NOT (EQEMU_PREFER_LUA AND Lua51_FOUND))
|
||||
SET(LUA_LIBRARY_TYPE " LuaJIT")
|
||||
SET(LUA_LIBRARY_ENABLED ON)
|
||||
SET(LUA_LIBRARY_LIBS ${LUAJIT_LIBRARY} luabind)
|
||||
SET(LUA_LIBRARY_INCLUDE ${LUAJIT_INCLUDE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/libs/luabind")
|
||||
ELSEIF(Lua51_FOUND )
|
||||
SET(LUA_LIBRARY_TYPE " Lua 5.1")
|
||||
SET(LUA_LIBRARY_ENABLED ON)
|
||||
SET(LUA_LIBRARY_LIBS ${LUA_LIBRARY} luabind)
|
||||
SET(LUA_LIBRARY_INCLUDE ${LUA_INCLUDE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/libs/luabind")
|
||||
ELSE()
|
||||
SET(LUA_LIBRARY_TYPE "Disabled")
|
||||
SET(LUA_LIBRARY_ENABLED OFF)
|
||||
ENDIF()
|
||||
|
||||
IF(PerlLibs_FOUND)
|
||||
SET(PERL_LIBRARY_TYPE " Perl")
|
||||
SET(PERL_LIBRARY_ENABLED ON)
|
||||
SET(PERL_LIBRARY_LIBS ${PERL_LIBRARY})
|
||||
SET(PERL_LIBRARY_INCLUDE ${PERL_INCLUDE_PATH})
|
||||
ELSE()
|
||||
SET(PERL_LIBRARY_TYPE "Disabled")
|
||||
SET(PERL_LIBRARY_ENABLED OFF)
|
||||
ENDIF()
|
||||
|
||||
#use zlib if exists
|
||||
IF(ZLIB_FOUND)
|
||||
OPTION(EQEMU_BUILD_ZLIB "Build internal version of zlib." ON)
|
||||
IF(EQEMU_BUILD_ZLIB)
|
||||
SET(ZLIB_LIBRARY_TYPE "zlib-ng")
|
||||
SET(ZLIB_LIBRARY_LIBS "zlibstatic")
|
||||
SET(ZLIB_LIBRARY_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/libs/zlibng")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_BINARY_DIR}/libs/zlibng")
|
||||
ELSE()
|
||||
SET(ZLIB_LIBRARY_TYPE " zlib")
|
||||
SET(ZLIB_LIBRARY_LIBS ${ZLIB_LIBRARY})
|
||||
SET(ZLIB_LIBRARY_INCLUDE ${ZLIB_INCLUDE_DIRS})
|
||||
ENDIF()
|
||||
ELSE()
|
||||
SET(ZLIB_LIBRARY_TYPE "zlib-ng")
|
||||
SET(ZLIB_LIBRARY_LIBS "zlibstatic")
|
||||
SET(ZLIB_LIBRARY_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/libs/zlibng")
|
||||
ENDIF()
|
||||
|
||||
IF (EQEMU_BUILD_STATIC)
|
||||
SET(ZLIB_LIBRARY_LIBS libz.a)
|
||||
ENDIF(EQEMU_BUILD_STATIC)
|
||||
|
||||
MESSAGE(STATUS "")
|
||||
MESSAGE(STATUS "**************************************************")
|
||||
MESSAGE(STATUS "* Library Usage *")
|
||||
MESSAGE(STATUS "**************************************************")
|
||||
MESSAGE(STATUS "* Database: ${DATABASE_LIBRARY_TYPE} *")
|
||||
MESSAGE(STATUS "* TLS: ${TLS_LIBRARY_TYPE} *")
|
||||
MESSAGE(STATUS "* Sodium: ${SODIUM_LIBRARY_TYPE} *")
|
||||
MESSAGE(STATUS "* Lua: ${LUA_LIBRARY_TYPE} *")
|
||||
MESSAGE(STATUS "* Perl: ${PERL_LIBRARY_TYPE} *")
|
||||
MESSAGE(STATUS "* zlib: ${ZLIB_LIBRARY_TYPE} *")
|
||||
MESSAGE(STATUS "**************************************************")
|
||||
|
||||
#setup server libs and headers
|
||||
SET(SERVER_LIBS common ${DATABASE_LIBRARY_LIBS} ${ZLIB_LIBRARY_LIBS} ${Boost_LIBRARIES} uv_a fmt RecastNavigation::Detour)
|
||||
|
||||
set(FMT_HEADER_ONLY OFF)
|
||||
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${DATABASE_LIBRARY_INCLUDE}")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${ZLIB_LIBRARY_INCLUDE}")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${Boost_INCLUDE_DIRS}")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/glm")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/cereal/include")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/fmt/include")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/libuv/include" )
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigation/DebugUtils/Include")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigation/Detour/Include")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigation/DetourCrowd/Include")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigation/DetourTileCache/Include")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigation/Recast/Include")
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/websocketpp")
|
||||
|
||||
# silence obnoxious deprecation message
|
||||
ADD_DEFINITIONS(-DBOOST_BIND_GLOBAL_PLACEHOLDERS)
|
||||
|
||||
IF(TLS_LIBRARY_ENABLED)
|
||||
SET(SERVER_LIBS ${SERVER_LIBS} ${TLS_LIBRARY_LIBS})
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${TLS_LIBRARY_INCLUDE}")
|
||||
ENDIF()
|
||||
|
||||
IF(SODIUM_LIBRARY_ENABLED)
|
||||
SET(SERVER_LIBS ${SERVER_LIBS} ${SODIUM_LIBRARY_LIBS})
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${SODIUM_LIBRARY_INCLUDE}")
|
||||
ENDIF()
|
||||
|
||||
IF(LUA_LIBRARY_ENABLED)
|
||||
OPTION(EQEMU_BUILD_LUA "Build Lua parser." ON)
|
||||
|
||||
IF(EQEMU_BUILD_LUA)
|
||||
ADD_DEFINITIONS(-DLUA_EQEMU)
|
||||
SET(ZONE_LIBS ${LUA_LIBRARY_LIBS})
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${LUA_LIBRARY_INCLUDE}")
|
||||
|
||||
OPTION(EQEMU_SANITIZE_LUA_LIBS "Sanitize Lua Libraries (Remove OS and IO standard libraries from being able to run)." ON)
|
||||
IF(EQEMU_SANITIZE_LUA_LIBS)
|
||||
ADD_DEFINITIONS(-DSANITIZE_LUA_LIBS)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(PERL_LIBRARY_ENABLED)
|
||||
OPTION(EQEMU_BUILD_PERL "Build Perl parser." ON)
|
||||
IF(EQEMU_BUILD_PERL)
|
||||
SET(SERVER_LIBS ${SERVER_LIBS} ${PERL_LIBRARY_LIBS} perlbind)
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${PERL_LIBRARY_INCLUDE}")
|
||||
ADD_DEFINITIONS(-DEMBPERL)
|
||||
ADD_DEFINITIONS(-DEMBPERL_PLUGIN)
|
||||
ADD_DEFINITIONS(-DPERLBIND_NO_STRICT_SCALAR_TYPES)
|
||||
IF (UNIX AND EQEMU_BUILD_STATIC)
|
||||
SET(SERVER_LIBS ${SERVER_LIBS} libcrypt.a)
|
||||
ENDIF ()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
IF(WIN32)
|
||||
SET(SERVER_LIBS ${SERVER_LIBS} "ws2_32" "psapi" "iphlpapi" "userenv")
|
||||
ENDIF()
|
||||
|
||||
IF(UNIX)
|
||||
SET(SERVER_LIBS ${SERVER_LIBS} ${CMAKE_DL_LIBS} "z" "m" "pthread")
|
||||
IF(NOT DARWIN)
|
||||
SET(SERVER_LIBS ${SERVER_LIBS} "rt")
|
||||
ENDIF()
|
||||
# Freebsd provides uuids in the C library
|
||||
IF(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||
SET(SERVER_LIBS ${SERVER_LIBS} "uuid")
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
SET(ZONE_LIBS ${ZONE_LIBS} ${SERVER_LIBS})
|
||||
|
||||
IF(EQEMU_BUILD_LOGIN AND NOT TLS_LIBRARY_ENABLED)
|
||||
MESSAGE(FATAL_ERROR "Login server requires a TLS Library to build.")
|
||||
ENDIF()
|
||||
|
||||
IF(EQEMU_BUILD_HC AND NOT TLS_LIBRARY_ENABLED)
|
||||
MESSAGE(FATAL_ERROR "Headless client requires a TLS Library to build.")
|
||||
ENDIF()
|
||||
|
||||
IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC)
|
||||
ADD_SUBDIRECTORY(common)
|
||||
ADD_SUBDIRECTORY(libs)
|
||||
ADD_SUBDIRECTORY(submodules/fmt)
|
||||
ADD_SUBDIRECTORY(submodules/libuv)
|
||||
|
||||
IF(EQEMU_BUILD_ZLIB)
|
||||
SET(ZLIB_COMPAT ON CACHE BOOL "Compile with zlib compatible API")
|
||||
SET(ZLIB_ENABLE_TESTS OFF CACHE BOOL "Build test binaries")
|
||||
ADD_SUBDIRECTORY(libs/zlibng)
|
||||
ENDIF()
|
||||
|
||||
SET(RECASTNAVIGATION_DEMO OFF CACHE BOOL "Build demo")
|
||||
SET(RECASTNAVIGATION_TESTS OFF CACHE BOOL "Build tests")
|
||||
SET(RECASTNAVIGATION_EXAMPLES OFF CACHE BOOL "Build examples")
|
||||
ADD_SUBDIRECTORY(submodules/recastnavigation)
|
||||
ENDIF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC)
|
||||
|
||||
IF(EQEMU_BUILD_SERVER)
|
||||
ADD_SUBDIRECTORY(shared_memory)
|
||||
ADD_SUBDIRECTORY(world)
|
||||
ADD_SUBDIRECTORY(zone)
|
||||
ADD_SUBDIRECTORY(ucs)
|
||||
ADD_SUBDIRECTORY(queryserv)
|
||||
ADD_SUBDIRECTORY(eqlaunch)
|
||||
ENDIF(EQEMU_BUILD_SERVER)
|
||||
|
||||
IF(EQEMU_BUILD_LOGIN)
|
||||
ADD_SUBDIRECTORY(loginserver)
|
||||
ENDIF(EQEMU_BUILD_LOGIN)
|
||||
|
||||
IF(EQEMU_BUILD_HC)
|
||||
ADD_SUBDIRECTORY(hc)
|
||||
ENDIF(EQEMU_BUILD_HC)
|
||||
|
||||
IF(EQEMU_BUILD_TESTS)
|
||||
ADD_SUBDIRECTORY(tests)
|
||||
ENDIF(EQEMU_BUILD_TESTS)
|
||||
|
||||
IF(EQEMU_BUILD_CLIENT_FILES)
|
||||
ADD_SUBDIRECTORY(client_files)
|
||||
ENDIF(EQEMU_BUILD_CLIENT_FILES)
|
||||
if(EQEMU_BUILD_CLIENT_FILES)
|
||||
add_subdirectory(client_files)
|
||||
endif()
|
||||
|
||||
49
CMakePresets.json
Normal file
49
CMakePresets.json
Normal file
@ -0,0 +1,49 @@
|
||||
{
|
||||
"version": 3,
|
||||
"cmakeMinimumRequired": {
|
||||
"major": 3,
|
||||
"minor": 19,
|
||||
"patch": 0
|
||||
},
|
||||
"configurePresets": [
|
||||
{
|
||||
"name": "linux-debug",
|
||||
"displayName": "Linux Debug",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Debug",
|
||||
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
|
||||
"CMAKE_C_COMPILER_LAUNCHER": "ccache",
|
||||
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache",
|
||||
"EQEMU_BUILD_LOGIN": "ON",
|
||||
"EQEMU_BUILD_TESTS": "ON",
|
||||
"EQEMU_ADD_PROFILER": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "linux-release",
|
||||
"displayName": "Linux Release",
|
||||
"generator": "Ninja",
|
||||
"binaryDir": "${sourceDir}/build/release",
|
||||
"cacheVariables": {
|
||||
"CMAKE_BUILD_TYPE": "Release",
|
||||
"CMAKE_C_COMPILER_LAUNCHER": "ccache",
|
||||
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache",
|
||||
"EQEMU_BUILD_LOGIN": "ON"
|
||||
}
|
||||
},
|
||||
{
|
||||
"name": "win-msvc",
|
||||
"displayName": "Windows MSVC (VS 2022)",
|
||||
"generator": "Visual Studio 17 2022",
|
||||
"binaryDir": "${sourceDir}/build/{presetName}",
|
||||
"architecture": { "value": "x64" },
|
||||
"cacheVariables": {
|
||||
"CMAKE_CONFIGURATION_TYPES": "Debug;Release",
|
||||
"EQEMU_BUILD_LOGIN": "ON",
|
||||
"EQEMU_BUILD_TESTS": "ON"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -1,4 +1,4 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
add_subdirectory(import)
|
||||
add_subdirectory(export)
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.12)
|
||||
cmake_minimum_required(VERSION 3.20.0)
|
||||
|
||||
SET(export_sources
|
||||
set(export_sources
|
||||
main.cpp
|
||||
)
|
||||
|
||||
SET(export_headers
|
||||
set(export_headers
|
||||
)
|
||||
|
||||
ADD_EXECUTABLE(export_client_files ${export_sources} ${export_headers})
|
||||
add_executable(export_client_files ${export_sources} ${export_headers})
|
||||
|
||||
INSTALL(TARGETS export_client_files RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
install(TARGETS export_client_files RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
|
||||
TARGET_LINK_LIBRARIES(export_client_files ${SERVER_LIBS})
|
||||
target_link_libraries(export_client_files common)
|
||||
|
||||
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||
|
||||
@ -1,16 +1,16 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.12)
|
||||
cmake_minimum_required(VERSION 3.20.0)
|
||||
|
||||
SET(import_sources
|
||||
set(import_sources
|
||||
main.cpp
|
||||
)
|
||||
|
||||
SET(import_headers
|
||||
set(import_headers
|
||||
)
|
||||
|
||||
ADD_EXECUTABLE(import_client_files ${import_sources} ${import_headers})
|
||||
add_executable(import_client_files ${import_sources} ${import_headers})
|
||||
|
||||
INSTALL(TARGETS import_client_files RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
install(TARGETS import_client_files RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
|
||||
TARGET_LINK_LIBRARIES(import_client_files ${SERVER_LIBS})
|
||||
target_link_libraries(import_client_files common)
|
||||
|
||||
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||
|
||||
@ -1,94 +0,0 @@
|
||||
OPTION(EQEMU_FETCH_MSVC_DEPENDENCIES_VCPKG "Automatically fetch vcpkg dependencies for MSCV" ON)
|
||||
OPTION(EQEMU_FETCH_MSVC_DEPENDENCIES_PERL "Automatically fetch perl dependencies for MSCV" ON)
|
||||
|
||||
MARK_AS_ADVANCED(EQEMU_FETCH_MSVC_DEPENDENCIES_VCPKG)
|
||||
MARK_AS_ADVANCED(EQEMU_FETCH_MSVC_DEPENDENCIES_PERL)
|
||||
|
||||
SET(EQEMU_MSVC_DEPENDENCIES_VCPKG_X86 "https://github.com/EQEmu/Server/releases/download/v1.2/vcpkg-export-x86.zip")
|
||||
SET(EQEMU_MSVC_DEPENDENCIES_VCPKG_X64 "https://github.com/EQEmu/Server/releases/download/v1.2/vcpkg-export-x64.zip")
|
||||
SET(EQEMU_MSVC_DEPENDENCIES_PERL_X86 "http://strawberryperl.com/download/5.24.4.1/strawberry-perl-5.24.4.1-32bit-portable.zip")
|
||||
SET(EQEMU_MSVC_DEPENDENCIES_PERL_X64 "http://strawberryperl.com/download/5.24.4.1/strawberry-perl-5.24.4.1-64bit-portable.zip")
|
||||
SET(EQEMU_MSVC_DEPENDENCIES_VCPKG_X86_ZIP "vcpkg-export-x86.zip")
|
||||
SET(EQEMU_MSVC_DEPENDENCIES_VCPKG_X64_ZIP "vcpkg-export-x64.zip")
|
||||
SET(EQEMU_MSVC_DEPENDENCIES_VCPKG_X86_DIR "vcpkg-export-x86")
|
||||
SET(EQEMU_MSVC_DEPENDENCIES_VCPKG_X64_DIR "vcpkg-export-x64")
|
||||
SET(EQEMU_MSVC_DEPENDENCIES_PERL_X86_ZIP "strawberry-perl-5.24.4.1-32bit-portable.zip")
|
||||
SET(EQEMU_MSVC_DEPENDENCIES_PERL_X64_ZIP "strawberry-perl-5.24.4.1-64bit-portable.zip")
|
||||
SET(EQEMU_MSVC_DEPENDENCIES_PERL_X86_DIR "x86")
|
||||
SET(EQEMU_MSVC_DEPENDENCIES_PERL_X64_DIR "x64")
|
||||
|
||||
IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
||||
SET(EQEMU_VCPKG_URL ${EQEMU_MSVC_DEPENDENCIES_VCPKG_X64})
|
||||
SET(EQEMU_PERL_URL ${EQEMU_MSVC_DEPENDENCIES_PERL_X64})
|
||||
SET(EQEMU_VCPKG_ZIP ${EQEMU_MSVC_DEPENDENCIES_VCPKG_X64_ZIP})
|
||||
SET(EQEMU_VCPKG_DIR ${EQEMU_MSVC_DEPENDENCIES_VCPKG_X64_DIR})
|
||||
SET(EQEMU_PERL_ZIP ${EQEMU_MSVC_DEPENDENCIES_PERL_X64_ZIP})
|
||||
SET(EQEMU_PERL_DIR ${EQEMU_MSVC_DEPENDENCIES_PERL_X64_DIR})
|
||||
ELSE()
|
||||
SET(EQEMU_VCPKG_URL ${EQEMU_MSVC_DEPENDENCIES_VCPKG_X86})
|
||||
SET(EQEMU_PERL_URL ${EQEMU_MSVC_DEPENDENCIES_PERL_X86})
|
||||
SET(EQEMU_VCPKG_ZIP ${EQEMU_MSVC_DEPENDENCIES_VCPKG_X86_ZIP})
|
||||
SET(EQEMU_VCPKG_DIR ${EQEMU_MSVC_DEPENDENCIES_VCPKG_X86_DIR})
|
||||
SET(EQEMU_PERL_ZIP ${EQEMU_MSVC_DEPENDENCIES_PERL_X86_ZIP})
|
||||
SET(EQEMU_PERL_DIR ${EQEMU_MSVC_DEPENDENCIES_PERL_X86_DIR})
|
||||
ENDIF()
|
||||
|
||||
IF(EQEMU_FETCH_MSVC_DEPENDENCIES_VCPKG)
|
||||
MESSAGE(STATUS "Resolving vcpkg dependencies...")
|
||||
|
||||
IF(NOT EXISTS ${PROJECT_SOURCE_DIR}/vcpkg/${EQEMU_VCPKG_ZIP})
|
||||
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_SOURCE_DIR}/vcpkg)
|
||||
|
||||
MESSAGE(STATUS "Downloading existing vcpkg dependencies from releases...")
|
||||
FILE(DOWNLOAD ${EQEMU_VCPKG_URL} ${PROJECT_SOURCE_DIR}/vcpkg/${EQEMU_VCPKG_ZIP}
|
||||
SHOW_PROGRESS
|
||||
STATUS DOWNLOAD_STATUS)
|
||||
|
||||
LIST(GET DOWNLOAD_STATUS 0 STATUS_CODE)
|
||||
IF(NOT STATUS_CODE EQUAL 0)
|
||||
MESSAGE(FATAL_ERROR "Was unable to download dependencies from ${EQEMU_VCPKG_URL}")
|
||||
ENDIF()
|
||||
|
||||
MESSAGE(STATUS "Extracting files...")
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_COMMAND} -E tar xzf ${PROJECT_SOURCE_DIR}/vcpkg/${EQEMU_VCPKG_ZIP}
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/vcpkg
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
INCLUDE(${PROJECT_SOURCE_DIR}/vcpkg/${EQEMU_VCPKG_DIR}/scripts/buildsystems/vcpkg.cmake)
|
||||
ENDIF()
|
||||
|
||||
IF(EQEMU_FETCH_MSVC_DEPENDENCIES_PERL)
|
||||
#Try to find perl first, (so you can use your active install first)
|
||||
FIND_PACKAGE(PerlLibs)
|
||||
|
||||
IF(NOT PerlLibs_FOUND)
|
||||
MESSAGE(STATUS "Resolving perl dependencies...")
|
||||
|
||||
IF(NOT EXISTS ${PROJECT_SOURCE_DIR}/perl/${EQEMU_PERL_ZIP})
|
||||
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_SOURCE_DIR}/perl)
|
||||
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_SOURCE_DIR}/perl/${EQEMU_PERL_DIR})
|
||||
|
||||
MESSAGE(STATUS "Downloading portable perl...")
|
||||
FILE(DOWNLOAD ${EQEMU_PERL_URL} ${PROJECT_SOURCE_DIR}/perl/${EQEMU_PERL_ZIP}
|
||||
SHOW_PROGRESS
|
||||
STATUS DOWNLOAD_STATUS)
|
||||
|
||||
LIST(GET DOWNLOAD_STATUS 0 STATUS_CODE)
|
||||
IF(NOT STATUS_CODE EQUAL 0)
|
||||
MESSAGE(FATAL_ERROR "Was unable to download dependencies from ${EQEMU_PERL_URL}")
|
||||
ENDIF()
|
||||
|
||||
MESSAGE(STATUS "Extracting files...")
|
||||
EXECUTE_PROCESS(
|
||||
COMMAND ${CMAKE_COMMAND} -E tar xzf ${PROJECT_SOURCE_DIR}/perl/${EQEMU_PERL_ZIP}
|
||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/perl/${EQEMU_PERL_DIR}
|
||||
)
|
||||
ENDIF()
|
||||
|
||||
SET(PERL_EXECUTABLE ${PROJECT_SOURCE_DIR}/perl/${EQEMU_PERL_DIR}/perl/bin/perl.exe CACHE FILEPATH "Path to perl program" FORCE)
|
||||
SET(PERL_INCLUDE_PATH ${PROJECT_SOURCE_DIR}/perl/${EQEMU_PERL_DIR}/perl/lib/CORE CACHE PATH "Path to perl include files" FORCE)
|
||||
SET(PERL_LIBRARY ${PROJECT_SOURCE_DIR}/perl/${EQEMU_PERL_DIR}/perl/lib/CORE/libperl524.a CACHE FILEPATH "Path to perl library" FORCE)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
@ -1,91 +0,0 @@
|
||||
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
|
||||
# file Copyright.txt or https://cmake.org/licensing for details.
|
||||
# Modified from the FindLua51 that comes with CMake
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
FindLua51
|
||||
---------
|
||||
|
||||
|
||||
|
||||
Locate Lua51 library This module defines
|
||||
|
||||
::
|
||||
|
||||
LUA51_FOUND, if false, do not try to link to Lua
|
||||
LUA_LIBRARIES
|
||||
LUA_INCLUDE_DIR, where to find lua.h
|
||||
LUA_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
|
||||
|
||||
|
||||
|
||||
Note that the expected include convention is
|
||||
|
||||
::
|
||||
|
||||
#include "lua.h"
|
||||
|
||||
and not
|
||||
|
||||
::
|
||||
|
||||
#include <lua/lua.h>
|
||||
|
||||
This is because, the lua location is not standardized and may exist in
|
||||
locations other than lua/
|
||||
#]=======================================================================]
|
||||
|
||||
find_path(LUA_INCLUDE_DIR lua.h
|
||||
HINTS
|
||||
ENV LUA_DIR
|
||||
PATH_SUFFIXES include/lua51 include/lua5.1 include/lua-5.1 include/lua include
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/sw # Fink
|
||||
/opt/local # DarwinPorts
|
||||
/opt/csw # Blastwave
|
||||
/opt
|
||||
)
|
||||
|
||||
find_library(LUA_LIBRARY
|
||||
NAMES lua51 lua5.1 lua-5.1 lua
|
||||
HINTS
|
||||
ENV LUA_DIR
|
||||
PATH_SUFFIXES lib
|
||||
PATHS
|
||||
~/Library/Frameworks
|
||||
/Library/Frameworks
|
||||
/sw
|
||||
/opt/local
|
||||
/opt/csw
|
||||
/opt
|
||||
)
|
||||
|
||||
if(LUA_LIBRARY)
|
||||
# include the math library for Unix
|
||||
if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU)
|
||||
find_library(LUA_MATH_LIBRARY m)
|
||||
set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
|
||||
# For Windows and Mac, don't need to explicitly include the math library
|
||||
else()
|
||||
set( LUA_LIBRARIES "${LUA_LIBRARY}" CACHE STRING "Lua Libraries")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h")
|
||||
file(STRINGS "${LUA_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"")
|
||||
|
||||
string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUA_VERSION_STRING "${lua_version_str}")
|
||||
unset(lua_version_str)
|
||||
endif()
|
||||
|
||||
include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
|
||||
# handle the QUIETLY and REQUIRED arguments and set LUA51_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua51
|
||||
REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR
|
||||
VERSION_VAR LUA_VERSION_STRING)
|
||||
|
||||
mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARIES LUA_LIBRARY LUA_MATH_LIBRARY)
|
||||
|
||||
@ -88,4 +88,3 @@ FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaJit
|
||||
VERSION_VAR LUAJIT_VERSION_STRING)
|
||||
|
||||
mark_as_advanced(LUAJIT_INCLUDE_DIR LUAJIT_LIBRARIES LUAJIT_LIBRARY LUAJIT_MATH_LIBRARY)
|
||||
|
||||
|
||||
@ -1,87 +0,0 @@
|
||||
# - Find mariadbclient
|
||||
#
|
||||
# -*- cmake -*-
|
||||
#
|
||||
# Find the native MariaDB includes and library
|
||||
#
|
||||
# MariaDB_INCLUDE_DIR - where to find mysql.h, etc.
|
||||
# MariaDB_LIBRARIES - List of libraries when using MariaDB.
|
||||
# MariaDB_FOUND - True if MariaDB found.
|
||||
# The following can be used as a hint as to where to search:
|
||||
# MARIADB_ROOT
|
||||
|
||||
IF (MariaDB_INCLUDE_DIR AND MariaDB_LIBRARIES)
|
||||
# Already in cache, be silent
|
||||
SET(MariaDB_FIND_QUIETLY TRUE)
|
||||
ENDIF (MariaDB_INCLUDE_DIR AND MariaDB_LIBRARIES)
|
||||
|
||||
# Include dir
|
||||
IF(MARIADB_ROOT)
|
||||
FIND_PATH(MariaDB_INCLUDE_DIR
|
||||
NAMES mariadb_version.h
|
||||
PATHS ${MARIADB_ROOT}/include
|
||||
PATH_SUFFIXES mysql mariadb
|
||||
NO_DEFAULT_PATH
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
)
|
||||
FIND_PATH(MariaDB_INCLUDE_DIR
|
||||
NAMES mariadb_version.h
|
||||
PATH_SUFFIXES mysql mariadb
|
||||
)
|
||||
ELSE(MARIADB_ROOT)
|
||||
FIND_PATH(MariaDB_INCLUDE_DIR
|
||||
NAMES mariadb_version.h
|
||||
PATH_SUFFIXES mysql mariadb
|
||||
)
|
||||
ENDIF(MARIADB_ROOT)
|
||||
|
||||
# Library
|
||||
SET(MariaDB_NAMES libmariadb)
|
||||
IF(MARIADB_ROOT)
|
||||
FIND_LIBRARY(MariaDB_LIBRARY
|
||||
NAMES ${MariaDB_NAMES}
|
||||
PATHS ${MARIADB_ROOT}/lib
|
||||
PATH_SUFFIXES mysql mariadb
|
||||
NO_DEFAULT_PATH
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
)
|
||||
|
||||
FIND_LIBRARY(MariaDB_LIBRARY
|
||||
NAMES ${MariaDB_NAMES}
|
||||
PATH_SUFFIXES mysql mariadb
|
||||
)
|
||||
ELSE(MARIADB_ROOT)
|
||||
FIND_LIBRARY(MariaDB_LIBRARY
|
||||
NAMES ${MariaDB_NAMES} mariadbclient_r mariadbclient
|
||||
PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64
|
||||
PATH_SUFFIXES mysql mariadb
|
||||
)
|
||||
ENDIF(MARIADB_ROOT)
|
||||
|
||||
IF (MariaDB_INCLUDE_DIR AND MariaDB_LIBRARY)
|
||||
SET(MariaDB_FOUND TRUE)
|
||||
SET(MariaDB_LIBRARIES ${MariaDB_LIBRARY})
|
||||
ELSE (MariaDB_INCLUDE_DIR AND MariaDB_LIBRARY)
|
||||
SET(MariaDB_FOUND FALSE)
|
||||
SET(MariaDB_LIBRARIES)
|
||||
ENDIF (MariaDB_INCLUDE_DIR AND MariaDB_LIBRARY)
|
||||
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set MariaDB_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MariaDB DEFAULT_MSG MariaDB_LIBRARY MariaDB_INCLUDE_DIR)
|
||||
|
||||
IF(MariaDB_FOUND)
|
||||
SET( MariaDB_LIBRARY_RELEASE ${MariaDB_LIBRARY} )
|
||||
SET( MariaDB_LIBRARY_DEBUG ${MariaDB_LIBRARY} )
|
||||
SET( MariaDB_LIBRARIES ${MariaDB_LIBRARY_RELEASE} ${MariaDB_LIBRARY_DEBUG} )
|
||||
ELSE(MariaDB_FOUND)
|
||||
SET( MariaDB_LIBRARIES )
|
||||
ENDIF(MariaDB_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
MariaDB_LIBRARY_DEBUG
|
||||
MariaDB_LIBRARY_RELEASE
|
||||
MariaDB_INCLUDE_DIR
|
||||
)
|
||||
@ -1,87 +0,0 @@
|
||||
# - Find mysqlclient
|
||||
#
|
||||
# -*- cmake -*-
|
||||
#
|
||||
# Find the native MySQL includes and library
|
||||
#
|
||||
# MySQL_INCLUDE_DIR - where to find mysql.h, etc.
|
||||
# MySQL_LIBRARIES - List of libraries when using MySQL.
|
||||
# MySQL_FOUND - True if MySQL found.
|
||||
# The following can be used as a hint as to where to search:
|
||||
# MYSQL_ROOT
|
||||
|
||||
IF (MySQL_INCLUDE_DIR AND MySQL_LIBRARIES)
|
||||
# Already in cache, be silent
|
||||
SET(MySQL_FIND_QUIETLY TRUE)
|
||||
ENDIF (MySQL_INCLUDE_DIR AND MySQL_LIBRARIES)
|
||||
|
||||
# Include dir
|
||||
IF(MYSQL_ROOT)
|
||||
FIND_PATH(MySQL_INCLUDE_DIR
|
||||
NAMES mysql.h
|
||||
PATHS ${MYSQL_ROOT}/include
|
||||
PATH_SUFFIXES mysql
|
||||
NO_DEFAULT_PATH
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
)
|
||||
FIND_PATH(MySQL_INCLUDE_DIR
|
||||
NAMES mysql.h
|
||||
PATH_SUFFIXES mysql
|
||||
)
|
||||
ELSE(MYSQL_ROOT)
|
||||
FIND_PATH(MySQL_INCLUDE_DIR
|
||||
NAMES mysql.h
|
||||
PATH_SUFFIXES mysql
|
||||
)
|
||||
ENDIF(MYSQL_ROOT)
|
||||
|
||||
# Library
|
||||
SET(MySQL_NAMES libmysql)
|
||||
IF(MYSQL_ROOT)
|
||||
FIND_LIBRARY(MySQL_LIBRARY
|
||||
NAMES ${MySQL_NAMES}
|
||||
PATHS ${MYSQL_ROOT}/lib
|
||||
PATH_SUFFIXES mysql
|
||||
NO_DEFAULT_PATH
|
||||
NO_SYSTEM_ENVIRONMENT_PATH
|
||||
)
|
||||
|
||||
FIND_LIBRARY(MySQL_LIBRARY
|
||||
NAMES ${MySQL_NAMES}
|
||||
PATH_SUFFIXES mysql
|
||||
)
|
||||
ELSE(MYSQL_ROOT)
|
||||
FIND_LIBRARY(MySQL_LIBRARY
|
||||
NAMES ${MySQL_NAMES} mysqlclient_r mysqlclient
|
||||
PATHS /usr/lib /usr/local/lib /usr/lib64 /usr/local/lib64
|
||||
PATH_SUFFIXES mysql
|
||||
)
|
||||
ENDIF(MYSQL_ROOT)
|
||||
|
||||
IF (MySQL_INCLUDE_DIR AND MySQL_LIBRARY)
|
||||
SET(MySQL_FOUND TRUE)
|
||||
SET( MySQL_LIBRARIES ${MySQL_LIBRARY} )
|
||||
ELSE (MySQL_INCLUDE_DIR AND MySQL_LIBRARY)
|
||||
SET(MySQL_FOUND FALSE)
|
||||
SET( MySQL_LIBRARIES )
|
||||
ENDIF (MySQL_INCLUDE_DIR AND MySQL_LIBRARY)
|
||||
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set MySQL_FOUND to TRUE if
|
||||
# all listed variables are TRUE
|
||||
INCLUDE(FindPackageHandleStandardArgs)
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(MySQL DEFAULT_MSG MySQL_LIBRARY MySQL_INCLUDE_DIR)
|
||||
|
||||
IF(MySQL_FOUND)
|
||||
SET( MySQL_LIBRARY_RELEASE ${MySQL_LIBRARY} )
|
||||
SET( MySQL_LIBRARY_DEBUG ${MySQL_LIBRARY} )
|
||||
SET( MySQL_LIBRARIES ${MySQL_LIBRARY_RELEASE} ${MySQL_LIBRARY_DEBUG} )
|
||||
ELSE(MySQL_FOUND)
|
||||
SET( MySQL_LIBRARIES )
|
||||
ENDIF(MySQL_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
MySQL_LIBRARY_DEBUG
|
||||
MySQL_LIBRARY_RELEASE
|
||||
MySQL_INCLUDE_DIR
|
||||
)
|
||||
@ -1,30 +0,0 @@
|
||||
if (NOT MSVC)
|
||||
include(FindPkgConfig)
|
||||
pkg_check_modules(PC_SODIUM "libsodium")
|
||||
if (NOT PC_SODIUM_FOUND)
|
||||
pkg_check_modules(PC_SODIUM "sodium")
|
||||
endif (NOT PC_SODIUM_FOUND)
|
||||
if (PC_SODIUM_FOUND)
|
||||
set(SODIUM_INCLUDE_HINTS ${PC_SODIUM_INCLUDE_DIRS} ${PC_SODIUM_INCLUDE_DIRS}/*)
|
||||
set(SODIUM_LIBRARY_HINTS ${PC_SODIUM_LIBRARY_DIRS} ${PC_SODIUM_LIBRARY_DIRS}/*)
|
||||
endif()
|
||||
endif (NOT MSVC)
|
||||
|
||||
# some libraries install the headers is a subdirectory of the include dir
|
||||
# returned by pkg-config, so use a wildcard match to improve chances of finding
|
||||
# headers and libraries.
|
||||
find_path(
|
||||
SODIUM_INCLUDE_DIRS
|
||||
NAMES sodium.h
|
||||
HINTS ${SODIUM_INCLUDE_HINTS}
|
||||
)
|
||||
|
||||
find_library(
|
||||
SODIUM_LIBRARIES
|
||||
NAMES libsodium sodium
|
||||
HINTS ${SODIUM_LIBRARY_HINTS}
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
find_package_handle_standard_args(SODIUM DEFAULT_MSG SODIUM_LIBRARIES SODIUM_INCLUDE_DIRS)
|
||||
mark_as_advanced(SODIUM_FOUND SODIUM_LIBRARIES SODIUM_INCLUDE_DIRS)
|
||||
@ -1,93 +0,0 @@
|
||||
# - Try to find mbedTLS
|
||||
# Once done this will define
|
||||
#
|
||||
# Read-Only variables
|
||||
# MBEDTLS_FOUND - system has mbedTLS
|
||||
# MBEDTLS_INCLUDE_DIR - the mbedTLS include directory
|
||||
# MBEDTLS_LIBRARY_DIR - the mbedTLS library directory
|
||||
# MBEDTLS_LIBRARIES - Link these to use mbedTLS
|
||||
# MBEDTLS_LIBRARY - path to mbedTLS library
|
||||
# MBEDX509_LIBRARY - path to mbedTLS X.509 library
|
||||
# MBEDCRYPTO_LIBRARY - path to mbedTLS Crypto library
|
||||
#
|
||||
# Hint
|
||||
# MBEDTLS_ROOT_DIR can be pointed to a local mbedTLS installation.
|
||||
|
||||
SET(_MBEDTLS_ROOT_HINTS
|
||||
${MBEDTLS_ROOT_DIR}
|
||||
ENV MBEDTLS_ROOT_DIR
|
||||
)
|
||||
|
||||
SET(_MBEDTLS_ROOT_HINTS_AND_PATHS
|
||||
HINTS ${_MBEDTLS_ROOT_HINTS}
|
||||
PATHS ${_MBEDTLS_ROOT_PATHS}
|
||||
)
|
||||
|
||||
FIND_PATH(MBEDTLS_INCLUDE_DIR
|
||||
NAMES mbedtls/version.h
|
||||
${_MBEDTLS_ROOT_HINTS_AND_PATHS}
|
||||
PATH_SUFFIXES include
|
||||
)
|
||||
|
||||
IF(MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARIES)
|
||||
# Already in cache, be silent
|
||||
SET(MBEDTLS_FIND_QUIETLY TRUE)
|
||||
ENDIF()
|
||||
|
||||
FIND_LIBRARY(MBEDTLS_LIBRARY
|
||||
NAMES mbedtls libmbedtls
|
||||
${_MBEDTLS_ROOT_HINTS_AND_PATHS}
|
||||
PATH_SUFFIXES library
|
||||
)
|
||||
FIND_LIBRARY(MBEDX509_LIBRARY
|
||||
NAMES mbedx509 libmbedx509
|
||||
${_MBEDTLS_ROOT_HINTS_AND_PATHS}
|
||||
PATH_SUFFIXES library
|
||||
)
|
||||
FIND_LIBRARY(MBEDCRYPTO_LIBRARY
|
||||
NAMES mbedcrypto libmbedcrypto
|
||||
${_MBEDTLS_ROOT_HINTS_AND_PATHS}
|
||||
PATH_SUFFIXES library
|
||||
)
|
||||
|
||||
IF(MBEDTLS_INCLUDE_DIR AND MBEDTLS_LIBRARY AND MBEDX509_LIBRARY AND MBEDCRYPTO_LIBRARY)
|
||||
SET(MBEDTLS_FOUND TRUE)
|
||||
ENDIF()
|
||||
|
||||
IF(MBEDTLS_FOUND)
|
||||
# split mbedTLS into -L and -l linker options, so we can set them for pkg-config
|
||||
GET_FILENAME_COMPONENT(MBEDTLS_LIBRARY_DIR ${MBEDTLS_LIBRARY} PATH)
|
||||
GET_FILENAME_COMPONENT(MBEDTLS_LIBRARY_FILE ${MBEDTLS_LIBRARY} NAME_WE)
|
||||
GET_FILENAME_COMPONENT(MBEDX509_LIBRARY_FILE ${MBEDX509_LIBRARY} NAME_WE)
|
||||
GET_FILENAME_COMPONENT(MBEDCRYPTO_LIBRARY_FILE ${MBEDCRYPTO_LIBRARY} NAME_WE)
|
||||
STRING(REGEX REPLACE "^lib" "" MBEDTLS_LIBRARY_FILE ${MBEDTLS_LIBRARY_FILE})
|
||||
STRING(REGEX REPLACE "^lib" "" MBEDX509_LIBRARY_FILE ${MBEDX509_LIBRARY_FILE})
|
||||
STRING(REGEX REPLACE "^lib" "" MBEDCRYPTO_LIBRARY_FILE ${MBEDCRYPTO_LIBRARY_FILE})
|
||||
SET(MBEDTLS_LIBRARIES "-L${MBEDTLS_LIBRARY_DIR} -l${MBEDTLS_LIBRARY_FILE} -l${MBEDX509_LIBRARY_FILE} -l${MBEDCRYPTO_LIBRARY_FILE}")
|
||||
|
||||
IF(NOT MBEDTLS_FIND_QUIETLY)
|
||||
MESSAGE(STATUS "Found mbedTLS:")
|
||||
FILE(READ ${MBEDTLS_INCLUDE_DIR}/mbedtls/version.h MBEDTLSCONTENT)
|
||||
STRING(REGEX MATCH "MBEDTLS_VERSION_STRING +\"[0-9|.]+\"" MBEDTLSMATCH ${MBEDTLSCONTENT})
|
||||
IF (MBEDTLSMATCH)
|
||||
STRING(REGEX REPLACE "MBEDTLS_VERSION_STRING +\"([0-9|.]+)\"" "\\1" MBEDTLS_VERSION ${MBEDTLSMATCH})
|
||||
MESSAGE(STATUS " version ${MBEDTLS_VERSION}")
|
||||
ENDIF(MBEDTLSMATCH)
|
||||
MESSAGE(STATUS " TLS: ${MBEDTLS_LIBRARY}")
|
||||
MESSAGE(STATUS " X509: ${MBEDX509_LIBRARY}")
|
||||
MESSAGE(STATUS " Crypto: ${MBEDCRYPTO_LIBRARY}")
|
||||
ENDIF(NOT MBEDTLS_FIND_QUIETLY)
|
||||
ELSE(MBEDTLS_FOUND)
|
||||
IF(MBEDTLS_FIND_REQUIRED)
|
||||
MESSAGE(FATAL_ERROR "Could not find mbedTLS")
|
||||
ENDIF(MBEDTLS_FIND_REQUIRED)
|
||||
ENDIF(MBEDTLS_FOUND)
|
||||
|
||||
MARK_AS_ADVANCED(
|
||||
MBEDTLS_INCLUDE_DIR
|
||||
MBEDTLS_LIBRARY_DIR
|
||||
MBEDTLS_LIBRARIES
|
||||
MBEDTLS_LIBRARY
|
||||
MBEDX509_LIBRARY
|
||||
MBEDCRYPTO_LIBRARY
|
||||
)
|
||||
File diff suppressed because it is too large
Load Diff
@ -16,6 +16,7 @@
|
||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/ranges.h>
|
||||
#include "../common/global_define.h"
|
||||
#include "../common/classes.h"
|
||||
#include "data_verification.h"
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
*/
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/ranges.h>
|
||||
#include "eqemu_command_handler.h"
|
||||
#include "terminal_color.hpp"
|
||||
#include "../platform.h"
|
||||
|
||||
@ -23,7 +23,7 @@ void SendCrashReport(const std::string &crash_report)
|
||||
{
|
||||
// can configure multiple endpoints if need be
|
||||
std::vector<std::string> endpoints = {
|
||||
"https://spire.akkadius.com/api/v1/analytics/server-crash-report",
|
||||
"https://spire.eqemu.dev/api/v1/analytics/server-crash-report",
|
||||
// "http://localhost:3010/api/v1/analytics/server-crash-report", // development
|
||||
};
|
||||
|
||||
|
||||
@ -9,17 +9,7 @@ using json = nlohmann::json;
|
||||
const std::string NESTED_KEY_DELIMITER = ".";
|
||||
std::vector<DataBucketsRepository::DataBuckets> g_data_bucket_cache = {};
|
||||
|
||||
#if defined(ZONE)
|
||||
#include "../zone/zonedb.h"
|
||||
extern ZoneDatabase database;
|
||||
#elif defined(WORLD)
|
||||
#include "../world/worlddb.h"
|
||||
extern WorldDatabase database;
|
||||
#else
|
||||
#error "You must define either ZONE or WORLD"
|
||||
#endif
|
||||
|
||||
void DataBucket::SetData(const std::string &bucket_key, const std::string &bucket_value, std::string expires_time)
|
||||
void DataBucket::SetData(SharedDatabase* database, const std::string &bucket_key, const std::string &bucket_value, std::string expires_time)
|
||||
{
|
||||
auto k = DataBucketKey{
|
||||
.key = bucket_key,
|
||||
@ -27,10 +17,10 @@ void DataBucket::SetData(const std::string &bucket_key, const std::string &bucke
|
||||
.expires = expires_time,
|
||||
};
|
||||
|
||||
DataBucket::SetData(k);
|
||||
DataBucket::SetData(database, k);
|
||||
}
|
||||
|
||||
void DataBucket::SetData(const DataBucketKey &k_)
|
||||
void DataBucket::SetData(SharedDatabase *database, const DataBucketKey &k_)
|
||||
{
|
||||
DataBucketKey k = k_; // copy the key so we can modify it
|
||||
bool is_nested = k.key.find(NESTED_KEY_DELIMITER) != std::string::npos;
|
||||
@ -39,7 +29,7 @@ void DataBucket::SetData(const DataBucketKey &k_)
|
||||
}
|
||||
|
||||
auto b = DataBucketsRepository::NewEntity();
|
||||
auto r = GetData(k, true);
|
||||
auto r = GetData(database, k, true);
|
||||
// if we have an entry, use it
|
||||
if (r.id > 0) {
|
||||
b = r;
|
||||
@ -149,10 +139,10 @@ void DataBucket::SetData(const DataBucketKey &k_)
|
||||
}
|
||||
}
|
||||
|
||||
DataBucketsRepository::UpdateOne(database, b);
|
||||
DataBucketsRepository::UpdateOne(*database, b);
|
||||
}
|
||||
else {
|
||||
b = DataBucketsRepository::InsertOne(database, b);
|
||||
b = DataBucketsRepository::InsertOne(*database, b);
|
||||
|
||||
// add to cache if it doesn't exist
|
||||
if (CanCache(k) && !ExistsInCache(b)) {
|
||||
@ -162,9 +152,9 @@ void DataBucket::SetData(const DataBucketKey &k_)
|
||||
}
|
||||
}
|
||||
|
||||
std::string DataBucket::GetData(const std::string &bucket_key)
|
||||
std::string DataBucket::GetData(SharedDatabase* database, const std::string &bucket_key)
|
||||
{
|
||||
return GetData(DataBucketKey{.key = bucket_key}).value;
|
||||
return GetData(database, DataBucketKey{.key = bucket_key}).value;
|
||||
}
|
||||
|
||||
DataBucketsRepository::DataBuckets DataBucket::ExtractNestedValue(
|
||||
@ -214,7 +204,7 @@ DataBucketsRepository::DataBuckets DataBucket::ExtractNestedValue(
|
||||
// if the bucket doesn't exist, it will be added to the cache as a miss
|
||||
// if ignore_misses_cache is true, the bucket will not be added to the cache as a miss
|
||||
// the only place we should be ignoring the misses cache is on the initial read during SetData
|
||||
DataBucketsRepository::DataBuckets DataBucket::GetData(const DataBucketKey &k_, bool ignore_misses_cache)
|
||||
DataBucketsRepository::DataBuckets DataBucket::GetData(SharedDatabase* database, const DataBucketKey &k_, bool ignore_misses_cache)
|
||||
{
|
||||
DataBucketKey k = k_; // Copy the key so we can modify it
|
||||
|
||||
@ -244,7 +234,7 @@ DataBucketsRepository::DataBuckets DataBucket::GetData(const DataBucketKey &k_,
|
||||
if (CheckBucketMatch(e, k)) {
|
||||
if (e.expires > 0 && e.expires < std::time(nullptr)) {
|
||||
LogDataBuckets("Attempted to read expired key [{}] removing from cache", e.key_);
|
||||
DeleteData(k);
|
||||
DeleteData(database, k);
|
||||
return DataBucketsRepository::NewEntity();
|
||||
}
|
||||
|
||||
@ -261,7 +251,7 @@ DataBucketsRepository::DataBuckets DataBucket::GetData(const DataBucketKey &k_,
|
||||
|
||||
// Fetch the value from the database
|
||||
auto r = DataBucketsRepository::GetWhere(
|
||||
database,
|
||||
*database,
|
||||
fmt::format(
|
||||
" {} `key` = '{}' LIMIT 1",
|
||||
DataBucket::GetScopedDbFilters(k),
|
||||
@ -310,7 +300,7 @@ DataBucketsRepository::DataBuckets DataBucket::GetData(const DataBucketKey &k_,
|
||||
|
||||
// If the entry has expired, delete it
|
||||
if (bucket.expires > 0 && bucket.expires < static_cast<long long>(std::time(nullptr))) {
|
||||
DeleteData(k);
|
||||
DeleteData(database, k);
|
||||
return DataBucketsRepository::NewEntity();
|
||||
}
|
||||
|
||||
@ -337,22 +327,22 @@ DataBucketsRepository::DataBuckets DataBucket::GetData(const DataBucketKey &k_,
|
||||
return bucket;
|
||||
}
|
||||
|
||||
std::string DataBucket::GetDataExpires(const std::string &bucket_key)
|
||||
std::string DataBucket::GetDataExpires(SharedDatabase* database, const std::string &bucket_key)
|
||||
{
|
||||
return GetDataExpires(DataBucketKey{.key = bucket_key});
|
||||
return GetDataExpires(database, DataBucketKey{.key = bucket_key});
|
||||
}
|
||||
|
||||
std::string DataBucket::GetDataRemaining(const std::string &bucket_key)
|
||||
std::string DataBucket::GetDataRemaining(SharedDatabase* database, const std::string &bucket_key)
|
||||
{
|
||||
return GetDataRemaining(DataBucketKey{.key = bucket_key});
|
||||
return GetDataRemaining(database, DataBucketKey{.key = bucket_key});
|
||||
}
|
||||
|
||||
bool DataBucket::DeleteData(const std::string &bucket_key)
|
||||
bool DataBucket::DeleteData(SharedDatabase* database, const std::string &bucket_key)
|
||||
{
|
||||
return DeleteData(DataBucketKey{.key = bucket_key});
|
||||
return DeleteData(database, DataBucketKey{.key = bucket_key});
|
||||
}
|
||||
|
||||
bool DataBucket::DeleteData(const DataBucketKey &k)
|
||||
bool DataBucket::DeleteData(SharedDatabase* database, const DataBucketKey &k)
|
||||
{
|
||||
bool is_nested_key = k.key.find(NESTED_KEY_DELIMITER) != std::string::npos;
|
||||
|
||||
@ -374,7 +364,7 @@ bool DataBucket::DeleteData(const DataBucketKey &k)
|
||||
|
||||
// Regular key deletion, no nesting involved
|
||||
return DataBucketsRepository::DeleteWhere(
|
||||
database,
|
||||
*database,
|
||||
fmt::format("{} `key` = '{}'", DataBucket::GetScopedDbFilters(k), k.key)
|
||||
);
|
||||
}
|
||||
@ -384,7 +374,7 @@ bool DataBucket::DeleteData(const DataBucketKey &k)
|
||||
DataBucketKey top_level_k = k;
|
||||
top_level_k.key = top_level_key;
|
||||
|
||||
auto r = GetData(top_level_k);
|
||||
auto r = GetData(database, top_level_k);
|
||||
if (r.id == 0 || r.value.empty() || !Strings::IsValidJson(r.value)) {
|
||||
LogDataBuckets("Attempted to delete nested key [{}] but parent key [{}] does not exist or is invalid JSON", k.key, top_level_key);
|
||||
return false;
|
||||
@ -444,14 +434,14 @@ bool DataBucket::DeleteData(const DataBucketKey &k)
|
||||
}
|
||||
|
||||
return DataBucketsRepository::DeleteWhere(
|
||||
database,
|
||||
*database,
|
||||
fmt::format("{} `key` = '{}'", DataBucket::GetScopedDbFilters(k), top_level_key)
|
||||
);
|
||||
}
|
||||
|
||||
// Otherwise, update the existing JSON without the deleted key
|
||||
r.value = json_value.dump();
|
||||
DataBucketsRepository::UpdateOne(database, r);
|
||||
DataBucketsRepository::UpdateOne(*database, r);
|
||||
|
||||
// Update cache
|
||||
if (CanCache(k)) {
|
||||
@ -466,7 +456,7 @@ bool DataBucket::DeleteData(const DataBucketKey &k)
|
||||
return true;
|
||||
}
|
||||
|
||||
std::string DataBucket::GetDataExpires(const DataBucketKey &k)
|
||||
std::string DataBucket::GetDataExpires(SharedDatabase* database, const DataBucketKey &k)
|
||||
{
|
||||
LogDataBuckets(
|
||||
"Getting bucket expiration key [{}] bot_id [{}] account_id [{}] character_id [{}] npc_id [{}]",
|
||||
@ -477,7 +467,7 @@ std::string DataBucket::GetDataExpires(const DataBucketKey &k)
|
||||
k.npc_id
|
||||
);
|
||||
|
||||
auto r = GetData(k);
|
||||
auto r = GetData(database, k);
|
||||
if (r.id == 0) {
|
||||
return {};
|
||||
}
|
||||
@ -485,7 +475,7 @@ std::string DataBucket::GetDataExpires(const DataBucketKey &k)
|
||||
return std::to_string(r.expires);
|
||||
}
|
||||
|
||||
std::string DataBucket::GetDataRemaining(const DataBucketKey &k)
|
||||
std::string DataBucket::GetDataRemaining(SharedDatabase* database, const DataBucketKey &k)
|
||||
{
|
||||
LogDataBuckets(
|
||||
"Getting bucket remaining key [{}] bot_id [{}] account_id [{}] character_id [{}] npc_id [{}] bot_id [{}] zone_id [{}] instance_id [{}]",
|
||||
@ -499,7 +489,7 @@ std::string DataBucket::GetDataRemaining(const DataBucketKey &k)
|
||||
k.instance_id
|
||||
);
|
||||
|
||||
auto r = GetData(k);
|
||||
auto r = GetData(database, k);
|
||||
if (r.id == 0) {
|
||||
return "0";
|
||||
}
|
||||
@ -565,10 +555,10 @@ bool DataBucket::CheckBucketMatch(const DataBucketsRepository::DataBuckets &dbe,
|
||||
);
|
||||
}
|
||||
|
||||
void DataBucket::LoadZoneCache(uint16 zone_id, uint16 instance_id)
|
||||
void DataBucket::LoadZoneCache(SharedDatabase* database, uint16 zone_id, uint16 instance_id)
|
||||
{
|
||||
const auto &l = DataBucketsRepository::GetWhere(
|
||||
database,
|
||||
*database,
|
||||
fmt::format(
|
||||
"zone_id = {} AND instance_id = {} AND (`expires` > {} OR `expires` = 0)",
|
||||
zone_id,
|
||||
@ -608,7 +598,7 @@ void DataBucket::LoadZoneCache(uint16 zone_id, uint16 instance_id)
|
||||
);
|
||||
}
|
||||
|
||||
void DataBucket::BulkLoadEntitiesToCache(DataBucketLoadType::Type t, std::vector<uint32> ids)
|
||||
void DataBucket::BulkLoadEntitiesToCache(SharedDatabase* database, DataBucketLoadType::Type t, std::vector<uint32> ids)
|
||||
{
|
||||
if (ids.empty()) {
|
||||
return;
|
||||
@ -653,7 +643,7 @@ void DataBucket::BulkLoadEntitiesToCache(DataBucketLoadType::Type t, std::vector
|
||||
}
|
||||
|
||||
const auto &l = DataBucketsRepository::GetWhere(
|
||||
database,
|
||||
*database,
|
||||
fmt::format(
|
||||
"{} IN ({}) AND (`expires` > {} OR `expires` = 0)",
|
||||
column,
|
||||
@ -843,4 +833,4 @@ bool DataBucket::CanCache(const DataBucketKey &key)
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
#include "types.h"
|
||||
#include "repositories/data_buckets_repository.h"
|
||||
#include "json/json_archive_single_line.h"
|
||||
#include "shareddb.h"
|
||||
|
||||
struct DataBucketKey {
|
||||
std::string key;
|
||||
@ -38,26 +39,26 @@ namespace DataBucketLoadType {
|
||||
class DataBucket {
|
||||
public:
|
||||
// non-scoped bucket methods (for global buckets)
|
||||
static void SetData(const std::string &bucket_key, const std::string &bucket_value, std::string expires_time = "");
|
||||
static bool DeleteData(const std::string &bucket_key);
|
||||
static std::string GetData(const std::string &bucket_key);
|
||||
static std::string GetDataExpires(const std::string &bucket_key);
|
||||
static std::string GetDataRemaining(const std::string &bucket_key);
|
||||
static void SetData(SharedDatabase *database, const std::string &bucket_key, const std::string &bucket_value, std::string expires_time = "");
|
||||
static bool DeleteData(SharedDatabase *database, const std::string &bucket_key);
|
||||
static std::string GetData(SharedDatabase *database, const std::string &bucket_key);
|
||||
static std::string GetDataExpires(SharedDatabase *database, const std::string &bucket_key);
|
||||
static std::string GetDataRemaining(SharedDatabase *database, const std::string &bucket_key);
|
||||
|
||||
// scoped bucket methods
|
||||
static void SetData(const DataBucketKey &k_);
|
||||
static bool DeleteData(const DataBucketKey &k);
|
||||
static DataBucketsRepository::DataBuckets GetData(const DataBucketKey &k_, bool ignore_misses_cache = false);
|
||||
static std::string GetDataExpires(const DataBucketKey &k);
|
||||
static std::string GetDataRemaining(const DataBucketKey &k);
|
||||
static void SetData(SharedDatabase *database, const DataBucketKey &k_);
|
||||
static bool DeleteData(SharedDatabase *database, const DataBucketKey &k);
|
||||
static DataBucketsRepository::DataBuckets GetData(SharedDatabase *database, const DataBucketKey &k_, bool ignore_misses_cache = false);
|
||||
static std::string GetDataExpires(SharedDatabase *database, const DataBucketKey &k);
|
||||
static std::string GetDataRemaining(SharedDatabase *database, const DataBucketKey &k);
|
||||
static std::string GetScopedDbFilters(const DataBucketKey &k);
|
||||
|
||||
// bucket repository versus key matching
|
||||
static bool CheckBucketMatch(const DataBucketsRepository::DataBuckets &dbe, const DataBucketKey &k);
|
||||
static bool ExistsInCache(const DataBucketsRepository::DataBuckets &entry);
|
||||
|
||||
static void LoadZoneCache(uint16 zone_id, uint16 instance_id);
|
||||
static void BulkLoadEntitiesToCache(DataBucketLoadType::Type t, std::vector<uint32> ids);
|
||||
static void LoadZoneCache(SharedDatabase* database, uint16 zone_id, uint16 instance_id);
|
||||
static void BulkLoadEntitiesToCache(SharedDatabase* database, DataBucketLoadType::Type t, std::vector<uint32> ids);
|
||||
static void DeleteCachedBuckets(DataBucketLoadType::Type type, uint32 id, uint32 secondary_id = 0);
|
||||
|
||||
static void DeleteFromMissesCache(DataBucketsRepository::DataBuckets e);
|
||||
|
||||
@ -5,11 +5,10 @@
|
||||
#include "../strings.h"
|
||||
#include "../rulesys.h"
|
||||
#include "../http/httplib.h"
|
||||
|
||||
#include "database_update_manifest.cpp"
|
||||
#include "database_update_manifest_custom.cpp"
|
||||
#include "database_update_manifest_bots.cpp"
|
||||
#include "database_dump_service.h"
|
||||
#include "database_update_manifest.h"
|
||||
#include "database_update_manifest_custom.h"
|
||||
#include "database_update_manifest_bots.h"
|
||||
|
||||
constexpr int BREAK_LENGTH = 70;
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#include "database_update.h"
|
||||
#pragma once
|
||||
|
||||
std::vector<ManifestEntry> manifest_entries = {
|
||||
ManifestEntry{
|
||||
@ -7160,7 +7160,32 @@ ALTER TABLE loottable_entries
|
||||
)",
|
||||
.content_schema_update = true
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9327,
|
||||
.description = "2025_08_13_character_stats_record_heal_amount.sql",
|
||||
.check = "SHOW COLUMNS FROM `character_stats_record` LIKE 'heal_amount'",
|
||||
.condition = "empty",
|
||||
.match = "",
|
||||
.sql = R"(
|
||||
ALTER TABLE `character_stats_record`
|
||||
ADD COLUMN `heal_amount` int(11) NULL DEFAULT 0 AFTER `spell_damage`;
|
||||
)"
|
||||
},
|
||||
ManifestEntry{
|
||||
.version = 9328,
|
||||
.description = "2025_08_22_character_parcel_updates.sql",
|
||||
.check = "SHOW COLUMNS FROM `character_parcels` LIKE 'evolve_amount'",
|
||||
.condition = "empty",
|
||||
.match = "",
|
||||
.sql = R"(
|
||||
ALTER TABLE `character_parcels`
|
||||
ADD COLUMN `evolve_amount` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `quantity`;
|
||||
|
||||
ALTER TABLE `character_parcels_containers`
|
||||
ADD COLUMN `evolve_amount` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `quantity`;
|
||||
)",
|
||||
.content_schema_update = false
|
||||
},
|
||||
// -- template; copy/paste this when you need to create a new entry
|
||||
// ManifestEntry{
|
||||
// .version = 9228,
|
||||
@ -1,4 +1,4 @@
|
||||
#include "database_update.h"
|
||||
#pragma once
|
||||
|
||||
std::vector<ManifestEntry> bot_manifest_entries = {
|
||||
ManifestEntry{
|
||||
@ -1,4 +1,4 @@
|
||||
#include "database_update.h"
|
||||
#pragma once
|
||||
|
||||
std::vector<ManifestEntry> manifest_entries_custom = {
|
||||
ManifestEntry{
|
||||
@ -258,9 +258,17 @@ bool DBcore::Open(uint32 *errnum, char *errbuf)
|
||||
if (pCompress) {
|
||||
flags |= CLIENT_COMPRESS;
|
||||
}
|
||||
|
||||
//todo: we need to revisit this ssl handling later
|
||||
//the whole connect code is ancient and tls is starting to come as a default requirement for many db setups
|
||||
if (pSSL) {
|
||||
flags |= CLIENT_SSL;
|
||||
}
|
||||
else {
|
||||
int off = 0;
|
||||
mysql_options(mysql, MYSQL_OPT_SSL_ENFORCE, &off);
|
||||
mysql_options(mysql, MYSQL_OPT_SSL_VERIFY_SERVER_CERT, &off);
|
||||
}
|
||||
if (mysql_real_connect(mysql, pHost, pUser, pPassword, pDatabase, pPort, 0, flags)) {
|
||||
pStatus = Connected;
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
#include "rulesys.h"
|
||||
#include "util/uuid.h"
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/ranges.h>
|
||||
#include <cereal/types/chrono.hpp>
|
||||
|
||||
DzLockout::DzLockout(std::string uuid, std::string expedition, std::string event, uint64_t expire_time, uint32_t duration)
|
||||
|
||||
@ -451,3 +451,23 @@ bool LDoNTheme::IsValid(uint32 theme_id)
|
||||
{
|
||||
return ldon_theme_names.find(theme_id) != ldon_theme_names.end();
|
||||
}
|
||||
|
||||
std::string PetCommand::GetName(uint8 pet_command)
|
||||
{
|
||||
return IsValid(pet_command) ? pet_commands[pet_command] : "UNKNOWN PET COMMAND";
|
||||
}
|
||||
|
||||
bool PetCommand::IsValid(uint8 pet_command)
|
||||
{
|
||||
return pet_commands.find(pet_command) != pet_commands.end();
|
||||
}
|
||||
|
||||
std::string PetType::GetName(uint8 pet_type)
|
||||
{
|
||||
return IsValid(pet_type) ? pet_types[pet_type] : "UNKNOWN PET TYPE";
|
||||
}
|
||||
|
||||
bool PetType::IsValid(uint8 pet_type)
|
||||
{
|
||||
return pet_types.find(pet_type) != pet_types.end();
|
||||
}
|
||||
|
||||
@ -792,4 +792,131 @@ namespace BookType {
|
||||
constexpr uint8 ItemInfo = 2;
|
||||
}
|
||||
|
||||
namespace PetButton {
|
||||
constexpr uint8 Sit = 0;
|
||||
constexpr uint8 Stop = 1;
|
||||
constexpr uint8 Regroup = 2;
|
||||
constexpr uint8 Follow = 3;
|
||||
constexpr uint8 Guard = 4;
|
||||
constexpr uint8 Taunt = 5;
|
||||
constexpr uint8 Hold = 6;
|
||||
constexpr uint8 GreaterHold = 7;
|
||||
constexpr uint8 Focus = 8;
|
||||
constexpr uint8 SpellHold = 9;
|
||||
}
|
||||
|
||||
namespace PetButtonState {
|
||||
constexpr uint8 Off = 0;
|
||||
constexpr uint8 On = 1;
|
||||
}
|
||||
|
||||
namespace PetCommand {
|
||||
constexpr uint8 HealthReport = 0; // /pet health or Pet Window
|
||||
constexpr uint8 Leader = 1; // /pet leader or Pet Window
|
||||
constexpr uint8 Attack = 2; // /pet attack or Pet Window
|
||||
constexpr uint8 QAttack = 3; // /pet qattack or Pet Window
|
||||
constexpr uint8 FollowMe = 4; // /pet follow or Pet Window
|
||||
constexpr uint8 GuardHere = 5; // /pet guard or Pet Window
|
||||
constexpr uint8 Sit = 6; // /pet sit or Pet Window
|
||||
constexpr uint8 SitDown = 7; // /pet sit on
|
||||
constexpr uint8 StandUp = 8; // /pet sit off
|
||||
constexpr uint8 Stop = 9; // /pet stop or Pet Window - Not implemented
|
||||
constexpr uint8 StopOn = 10; // /pet stop on - Not implemented
|
||||
constexpr uint8 StopOff = 11; // /pet stop off - Not implemented
|
||||
constexpr uint8 Taunt = 12; // /pet taunt or Pet Window
|
||||
constexpr uint8 TauntOn = 13; // /pet taunt on
|
||||
constexpr uint8 TauntOff = 14; // /pet taunt off
|
||||
constexpr uint8 Hold = 15; // /pet hold or Pet Window, won't add to hate list unless attacking
|
||||
constexpr uint8 HoldOn = 16; // /pet hold on
|
||||
constexpr uint8 HoldOff = 17; // /pet hold off
|
||||
constexpr uint8 GreaterHold = 18; // /pet ghold, will never add to hate list unless told to
|
||||
constexpr uint8 GreaterHoldOn = 19; // /pet ghold on
|
||||
constexpr uint8 GreaterHoldOff = 20; // /pet ghold off
|
||||
constexpr uint8 SpellHold = 21; // /pet no cast or /pet spellhold or Pet Window
|
||||
constexpr uint8 SpellHoldOn = 22; // /pet spellhold on
|
||||
constexpr uint8 SpellHoldOff = 23; // /pet spellhold off
|
||||
constexpr uint8 Focus = 24; // /pet focus or Pet Window
|
||||
constexpr uint8 FocusOn = 25; // /pet focus on
|
||||
constexpr uint8 FocusOff = 26; // /pet focus off
|
||||
constexpr uint8 Feign = 27; // /pet feign
|
||||
constexpr uint8 BackOff = 28; // /pet back off
|
||||
constexpr uint8 GetLost = 29; // /pet get lost
|
||||
constexpr uint8 GuardMe = 30; // Same as /pet follow, but different message in older clients
|
||||
constexpr uint8 Regroup = 31; // /pet regroup, acts like classic hold
|
||||
constexpr uint8 RegroupOn = 32; // /pet regroup on
|
||||
constexpr uint8 RegroupOff = 33; // /pet regroup off
|
||||
constexpr uint8 Max = 34;
|
||||
|
||||
static std::map<uint8, std::string> pet_commands = {
|
||||
{ PetCommand::HealthReport, "Health Report" },
|
||||
{ PetCommand::Leader, "Leader" },
|
||||
{ PetCommand::Attack, "Attack" },
|
||||
{ PetCommand::QAttack, "QAttack" },
|
||||
{ PetCommand::FollowMe, "Follow Me" },
|
||||
{ PetCommand::GuardHere, "Guard Here" },
|
||||
{ PetCommand::Sit, "Sit" },
|
||||
{ PetCommand::SitDown, "Sit Down" },
|
||||
{ PetCommand::StandUp, "Stand Up" },
|
||||
{ PetCommand::Stop, "Stop" },
|
||||
{ PetCommand::StopOn, "Stop On" },
|
||||
{ PetCommand::StopOff, "Stop Off" },
|
||||
{ PetCommand::Taunt, "Taunt" },
|
||||
{ PetCommand::TauntOn, "Taunt On" },
|
||||
{ PetCommand::TauntOff, "Taunt Off" },
|
||||
{ PetCommand::Hold, "Hold" },
|
||||
{ PetCommand::HoldOn, "Hold On" },
|
||||
{ PetCommand::HoldOff, "Hold Off" },
|
||||
{ PetCommand::GreaterHold, "Greater Hold" },
|
||||
{ PetCommand::GreaterHoldOn, "Greater Hold On" },
|
||||
{ PetCommand::GreaterHoldOff, "Greater Hold Off" },
|
||||
{ PetCommand::SpellHold, "Spell Hold" },
|
||||
{ PetCommand::SpellHoldOn, "Spell Hold On" },
|
||||
{ PetCommand::SpellHoldOff, "Spell Hold Off" },
|
||||
{ PetCommand::Focus, "Focus" },
|
||||
{ PetCommand::FocusOn, "Focus On" },
|
||||
{ PetCommand::FocusOff, "Focus Off" },
|
||||
{ PetCommand::Feign, "Feign" },
|
||||
{ PetCommand::BackOff, "Back Off" },
|
||||
{ PetCommand::GetLost, "Get Lost" },
|
||||
{ PetCommand::GuardMe, "Guard Me" },
|
||||
{ PetCommand::Regroup, "Regroup" },
|
||||
{ PetCommand::RegroupOn, "Regroup On" },
|
||||
{ PetCommand::RegroupOff, "Regroup Off" },
|
||||
{ PetCommand::Max, "Max" }
|
||||
};
|
||||
|
||||
std::string GetName(uint8 pet_command);
|
||||
bool IsValid(uint8 pet_command);
|
||||
}
|
||||
|
||||
namespace PetOrder {
|
||||
constexpr uint8 Follow = 0;
|
||||
constexpr uint8 Sit = 1;
|
||||
constexpr uint8 Guard = 2;
|
||||
constexpr uint8 Feign = 3;
|
||||
}
|
||||
|
||||
namespace PetType {
|
||||
constexpr uint8 Familiar = 0;
|
||||
constexpr uint8 Animation = 1;
|
||||
constexpr uint8 Normal = 2;
|
||||
constexpr uint8 Charmed = 3;
|
||||
constexpr uint8 Follow = 4;
|
||||
constexpr uint8 TargetLock = 5;
|
||||
constexpr uint8 None = 255;
|
||||
|
||||
static std::map<uint8, std::string> pet_types = {
|
||||
{ PetType::Familiar, "Familiar" },
|
||||
{ PetType::Animation, "Animation" },
|
||||
{ PetType::Normal, "Normal" },
|
||||
{ PetType::Charmed, "Charmed" },
|
||||
{ PetType::Follow, "Follow" },
|
||||
{ PetType::TargetLock, "Target Lock" },
|
||||
{ PetType::None, "None" }
|
||||
};
|
||||
|
||||
std::string GetName(uint8 pet_type);
|
||||
bool IsValid(uint8 pet_type);
|
||||
}
|
||||
|
||||
#endif /*COMMON_EMU_CONSTANTS_H*/
|
||||
|
||||
@ -23,9 +23,9 @@
|
||||
#include <string.h>
|
||||
#include <string>
|
||||
#include <time.h>
|
||||
#include "../cereal/include/cereal/archives/binary.hpp"
|
||||
#include "../cereal/include/cereal/types/string.hpp"
|
||||
#include "../cereal/include/cereal/types/vector.hpp"
|
||||
#include <cereal/archives/binary.hpp>
|
||||
#include <cereal/types/string.hpp>
|
||||
#include <cereal/types/vector.hpp>
|
||||
#include "../common/version.h"
|
||||
#include "emu_constants.h"
|
||||
#include "textures.h"
|
||||
|
||||
@ -6,7 +6,7 @@
|
||||
#include <string>
|
||||
#include "emu_versions.h"
|
||||
#include "eq_packet.h"
|
||||
#include "net/daybreak_connection.h"
|
||||
#include "net/reliable_stream_connection.h"
|
||||
|
||||
typedef enum {
|
||||
ESTABLISHED,
|
||||
@ -33,18 +33,18 @@ struct EQStreamManagerInterfaceOptions
|
||||
//Login I had trouble getting to recognize compression at all
|
||||
//but that might be because it was still a bit buggy when i was testing that.
|
||||
if (compressed) {
|
||||
daybreak_options.encode_passes[0] = EQ::Net::EncodeCompression;
|
||||
reliable_stream_options.encode_passes[0] = EQ::Net::EncodeCompression;
|
||||
}
|
||||
else if (encoded) {
|
||||
daybreak_options.encode_passes[0] = EQ::Net::EncodeXOR;
|
||||
reliable_stream_options.encode_passes[0] = EQ::Net::EncodeXOR;
|
||||
}
|
||||
|
||||
daybreak_options.port = port;
|
||||
reliable_stream_options.port = port;
|
||||
}
|
||||
|
||||
int opcode_size;
|
||||
bool track_opcode_stats;
|
||||
EQ::Net::DaybreakConnectionManagerOptions daybreak_options;
|
||||
EQ::Net::ReliableStreamConnectionManagerOptions reliable_stream_options;
|
||||
};
|
||||
|
||||
class EQStreamManagerInterface
|
||||
@ -80,7 +80,7 @@ public:
|
||||
|
||||
struct Stats
|
||||
{
|
||||
EQ::Net::DaybreakConnectionStats DaybreakStats;
|
||||
EQ::Net::ReliableStreamConnectionStats ReliableStreamStats;
|
||||
int RecvCount[_maxEmuOpcode];
|
||||
int SentCount[_maxEmuOpcode];
|
||||
};
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
#include "path_manager.h"
|
||||
#include <fstream>
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
struct LoginConfig {
|
||||
std::string LoginHost;
|
||||
|
||||
@ -34,6 +34,7 @@
|
||||
#endif
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/ranges.h>
|
||||
#include "types.h"
|
||||
|
||||
namespace Logs {
|
||||
|
||||
@ -3,6 +3,7 @@
|
||||
#include "../json/json_archive_single_line.h"
|
||||
#include <vector>
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/ranges.h>
|
||||
#include <cereal/archives/json.hpp>
|
||||
#include <cereal/types/vector.hpp>
|
||||
|
||||
|
||||
@ -74,6 +74,10 @@ void EvolvingItemsManager::DoLootChecks(const uint32 char_id, const uint16 slot_
|
||||
e.item_id = inst.GetID();
|
||||
e.equipped = inst.GetEvolveEquipped();
|
||||
e.final_item_id = EvolvingItemsManager::Instance()->GetFinalItemID(inst);
|
||||
if (inst.GetEvolveCurrentAmount() > 0) {
|
||||
e.current_amount = inst.GetEvolveCurrentAmount();
|
||||
inst.CalculateEvolveProgression();
|
||||
}
|
||||
|
||||
auto r = CharacterEvolvingItemsRepository::InsertOne(*m_db, e);
|
||||
e.id = r.id;
|
||||
|
||||
@ -95,12 +95,12 @@ bool IsOfEqualRace(int r1, int r2)
|
||||
}
|
||||
// TODO: add more values
|
||||
switch (r1) {
|
||||
case DARK_ELF:
|
||||
case Race::DarkElf:
|
||||
if (r2 == Race::NeriakCitizen) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case BARBARIAN:
|
||||
case Race::Barbarian:
|
||||
if (r2 == Race::HalasCitizen) {
|
||||
return true;
|
||||
}
|
||||
@ -116,49 +116,49 @@ bool IsOfIndiffRace(int r1, int r2)
|
||||
}
|
||||
// TODO: add more values
|
||||
switch (r1) {
|
||||
case DARK_ELF:
|
||||
case OGRE:
|
||||
case TROLL:
|
||||
if (r2 == OGRE || r2 == TROLL || r2 == DARK_ELF) {
|
||||
case Race::DarkElf:
|
||||
case Race::Ogre:
|
||||
case Race::Troll:
|
||||
if (r2 == Race::Ogre || r2 == Race::Troll || r2 == Race::DarkElf) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case HUMAN:
|
||||
case BARBARIAN:
|
||||
case HALF_ELF:
|
||||
case GNOME:
|
||||
case HALFLING:
|
||||
case WOOD_ELF:
|
||||
if (r2 == HUMAN ||
|
||||
r2 == BARBARIAN ||
|
||||
r2 == ERUDITE ||
|
||||
r2 == HALF_ELF ||
|
||||
r2 == GNOME ||
|
||||
r2 == HALFLING ||
|
||||
r2 == DWARF ||
|
||||
r2 == HIGH_ELF ||
|
||||
r2 == WOOD_ELF) {
|
||||
case Race::Human:
|
||||
case Race::Barbarian:
|
||||
case Race::HalfElf:
|
||||
case Race::Gnome:
|
||||
case Race::Halfling:
|
||||
case Race::WoodElf:
|
||||
if (r2 == Race::Human ||
|
||||
r2 == Race::Barbarian ||
|
||||
r2 == Race::Erudite ||
|
||||
r2 == Race::HalfElf ||
|
||||
r2 == Race::Gnome ||
|
||||
r2 == Race::Halfling ||
|
||||
r2 == Race::Dwarf ||
|
||||
r2 == Race::HighElf ||
|
||||
r2 == Race::WoodElf) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case ERUDITE:
|
||||
if (r2 == HUMAN || r2 == HALF_ELF) {
|
||||
case Race::Erudite:
|
||||
if (r2 == Race::Human || r2 == Race::HalfElf) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case DWARF:
|
||||
if (r2 == HALFLING || r2 == GNOME) {
|
||||
case Race::Dwarf:
|
||||
if (r2 == Race::Halfling || r2 == Race::Gnome) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case HIGH_ELF:
|
||||
if (r2 == WOOD_ELF) {
|
||||
case Race::HighElf:
|
||||
if (r2 == Race::WoodElf) {
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
case VAHSHIR:
|
||||
case Race::VahShir:
|
||||
return true;
|
||||
case IKSAR:
|
||||
case Race::Iksar:
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
|
||||
@ -36,6 +36,7 @@
|
||||
#endif
|
||||
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/ranges.h>
|
||||
#include <filesystem>
|
||||
#include <iostream>
|
||||
#include <sys/stat.h>
|
||||
|
||||
@ -20,6 +20,7 @@
|
||||
|
||||
#include <cstring>
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/ranges.h>
|
||||
#include <csignal>
|
||||
#include <vector>
|
||||
#include "ip_util.h"
|
||||
|
||||
@ -438,7 +438,7 @@ namespace EQ
|
||||
//uint32 Unk054 {};
|
||||
int16 MaxCharges {}; // Maximum charges items can hold: -1 if not a chargeable item
|
||||
uint8 ItemType {}; // Item Type/Skill (itemClass* from above)
|
||||
int32 SubType {}; // Some items have sub types that can be used for other things (unbreakable fishing poles, SE_FFItemClass)
|
||||
int32 SubType {}; // Some items have sub types that can be used for other things (unbreakable fishing poles, SpellEffect::FFItemClass)
|
||||
uint8 Material {}; // Item material type
|
||||
uint32 HerosForgeModel {};// Hero's Forge Armor Model Type (2-13?)
|
||||
float SellRate {}; // Sell rate
|
||||
|
||||
@ -1,206 +0,0 @@
|
||||
/*
|
||||
|
||||
|
||||
These fields must be in the order of how they are serialized!
|
||||
|
||||
|
||||
|
||||
*/
|
||||
|
||||
F(itemclass)
|
||||
F(name)
|
||||
F(lore)
|
||||
F(idfile)
|
||||
F(id)
|
||||
F(weight)
|
||||
F(norent)
|
||||
F(nodrop)
|
||||
F(size)
|
||||
F(slots)
|
||||
F(price)
|
||||
F(icon)
|
||||
F(UNK012)
|
||||
F(UNK013)
|
||||
F(benefitflag)
|
||||
F(tradeskills)
|
||||
F(cr)
|
||||
F(dr)
|
||||
F(pr)
|
||||
F(mr)
|
||||
F(fr)
|
||||
F(astr)
|
||||
F(asta)
|
||||
F(aagi)
|
||||
F(adex)
|
||||
F(acha)
|
||||
F(aint)
|
||||
F(awis)
|
||||
F(hp)
|
||||
F(mana)
|
||||
F(ac)
|
||||
F(deity)
|
||||
F(skillmodvalue)
|
||||
F(UNK033)
|
||||
F(skillmodmax)
|
||||
F(skillmodtype)
|
||||
F(banedmgrace)
|
||||
F(banedmgamt)
|
||||
F(banedmgbody)
|
||||
F(magic)
|
||||
F(casttime_)
|
||||
F(reqlevel)
|
||||
F(bardtype)
|
||||
F(bardvalue)
|
||||
F(light)
|
||||
F(delay)
|
||||
F(reclevel)
|
||||
F(recskill)
|
||||
F(elemdmgtype)
|
||||
F(elemdmgamt)
|
||||
F(range)
|
||||
F(damage)
|
||||
F(color)
|
||||
F(classes)
|
||||
F(races)
|
||||
F(UNK054)
|
||||
F(maxcharges)
|
||||
F(itemtype)
|
||||
F(material)
|
||||
F(herosforgemodel)
|
||||
F(sellrate)
|
||||
F(UNK059)
|
||||
F(casttime)
|
||||
F(elitematerial)
|
||||
F(procrate)
|
||||
F(combateffects)
|
||||
F(shielding)
|
||||
F(stunresist)
|
||||
F(strikethrough)
|
||||
F(extradmgskill)
|
||||
F(extradmgamt)
|
||||
F(spellshield)
|
||||
F(avoidance)
|
||||
F(accuracy)
|
||||
F(charmfileid)
|
||||
F(factionmod1)
|
||||
F(factionmod2)
|
||||
F(factionmod3)
|
||||
F(factionmod4)
|
||||
F(factionamt1)
|
||||
F(factionamt2)
|
||||
F(factionamt3)
|
||||
F(factionamt4)
|
||||
F(charmfile)
|
||||
F(augtype)
|
||||
F(augslot1type)
|
||||
F(augslot1visible)
|
||||
F(augslot2type)
|
||||
F(augslot2visible)
|
||||
F(augslot3type)
|
||||
F(augslot3visible)
|
||||
F(augslot4type)
|
||||
F(augslot4visible)
|
||||
F(augslot5type)
|
||||
F(augslot5visible)
|
||||
F(augslot6type)
|
||||
F(augslot6visible)
|
||||
F(ldontheme)
|
||||
F(ldonprice)
|
||||
F(ldonsold)
|
||||
F(bagtype)
|
||||
F(bagslots)
|
||||
F(bagsize)
|
||||
F(bagwr)
|
||||
F(book)
|
||||
F(booktype)
|
||||
F(filename)
|
||||
F(banedmgraceamt)
|
||||
F(augrestrict)
|
||||
F(loregroup)
|
||||
F(pendingloreflag)
|
||||
F(artifactflag)
|
||||
F(summonedflag)
|
||||
F(favor)
|
||||
F(fvnodrop)
|
||||
F(endur)
|
||||
F(dotshielding)
|
||||
F(attack)
|
||||
F(regen)
|
||||
F(manaregen)
|
||||
F(enduranceregen)
|
||||
F(haste)
|
||||
F(damageshield)
|
||||
F(recastdelay)
|
||||
F(recasttype)
|
||||
F(guildfavor)
|
||||
F(augdistiller)
|
||||
F(UNK123)
|
||||
F(UNK124)
|
||||
F(attuneable)
|
||||
F(nopet)
|
||||
F(UNK127)
|
||||
F(pointtype)
|
||||
F(potionbelt)
|
||||
F(potionbeltslots)
|
||||
F(stacksize)
|
||||
F(notransfer)
|
||||
F(stackable)
|
||||
F(UNK134)
|
||||
F(clickeffect)
|
||||
F(clicktype)
|
||||
F(clicklevel)
|
||||
F(clicklevel2)
|
||||
F(proceffect)
|
||||
F(proctype)
|
||||
F(proclevel)
|
||||
F(proclevel2)
|
||||
F(worneffect)
|
||||
F(worntype)
|
||||
F(wornlevel)
|
||||
F(wornlevel2)
|
||||
F(focuseffect)
|
||||
F(focustype)
|
||||
F(focuslevel)
|
||||
F(focuslevel2)
|
||||
F(scrolleffect)
|
||||
F(scrolltype)
|
||||
F(scrolllevel)
|
||||
F(scrolllevel2)
|
||||
F(bardeffect)
|
||||
F(bardeffecttype)
|
||||
F(bardlevel2)
|
||||
F(bardlevel)
|
||||
F(questitemflag)
|
||||
F(svcorruption)
|
||||
F(purity)
|
||||
F(evoitem)
|
||||
F(evoid)
|
||||
F(evolvinglevel)
|
||||
F(evomax)
|
||||
F(backstabdmg)
|
||||
F(dsmitigation)
|
||||
F(heroic_str)
|
||||
F(heroic_int)
|
||||
F(heroic_wis)
|
||||
F(heroic_agi)
|
||||
F(heroic_dex)
|
||||
F(heroic_sta)
|
||||
F(heroic_cha)
|
||||
F(heroic_mr)
|
||||
F(heroic_fr)
|
||||
F(heroic_cr)
|
||||
F(heroic_dr)
|
||||
F(heroic_pr)
|
||||
F(heroic_svcorrup)
|
||||
F(healamt)
|
||||
F(spelldmg)
|
||||
F(ldonsellbackrate)
|
||||
F(scriptfileid)
|
||||
F(expendablearrow)
|
||||
F(clairvoyance)
|
||||
F(clickname)
|
||||
F(procname)
|
||||
F(wornname)
|
||||
F(focusname)
|
||||
F(scrollname)
|
||||
F(subtype)
|
||||
@ -1,6 +1,7 @@
|
||||
#include "console_server.h"
|
||||
#include "../strings.h"
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
EQ::Net::ConsoleServer::ConsoleServer(const std::string &addr, int port)
|
||||
{
|
||||
|
||||
@ -5,6 +5,7 @@
|
||||
#include "../servertalk.h"
|
||||
#include "../rulesys.h"
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
EQ::Net::ConsoleServerConnection::ConsoleServerConnection(ConsoleServer *parent, std::shared_ptr<TCPConnection> connection)
|
||||
{
|
||||
|
||||
@ -1,11 +1,11 @@
|
||||
#include "eqstream.h"
|
||||
#include "../eqemu_logsys.h"
|
||||
|
||||
EQ::Net::EQStreamManager::EQStreamManager(const EQStreamManagerInterfaceOptions &options) : EQStreamManagerInterface(options), m_daybreak(options.daybreak_options)
|
||||
EQ::Net::EQStreamManager::EQStreamManager(const EQStreamManagerInterfaceOptions &options) : EQStreamManagerInterface(options), m_reliable_stream(options.reliable_stream_options)
|
||||
{
|
||||
m_daybreak.OnNewConnection(std::bind(&EQStreamManager::DaybreakNewConnection, this, std::placeholders::_1));
|
||||
m_daybreak.OnConnectionStateChange(std::bind(&EQStreamManager::DaybreakConnectionStateChange, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||
m_daybreak.OnPacketRecv(std::bind(&EQStreamManager::DaybreakPacketRecv, this, std::placeholders::_1, std::placeholders::_2));
|
||||
m_reliable_stream.OnNewConnection(std::bind(&EQStreamManager::ReliableStreamNewConnection, this, std::placeholders::_1));
|
||||
m_reliable_stream.OnConnectionStateChange(std::bind(&EQStreamManager::ReliableStreamConnectionStateChange, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||
m_reliable_stream.OnPacketRecv(std::bind(&EQStreamManager::ReliableStreamPacketRecv, this, std::placeholders::_1, std::placeholders::_2));
|
||||
}
|
||||
|
||||
EQ::Net::EQStreamManager::~EQStreamManager()
|
||||
@ -15,11 +15,11 @@ EQ::Net::EQStreamManager::~EQStreamManager()
|
||||
void EQ::Net::EQStreamManager::SetOptions(const EQStreamManagerInterfaceOptions &options)
|
||||
{
|
||||
m_options = options;
|
||||
auto &opts = m_daybreak.GetOptions();
|
||||
opts = options.daybreak_options;
|
||||
auto &opts = m_reliable_stream.GetOptions();
|
||||
opts = options.reliable_stream_options;
|
||||
}
|
||||
|
||||
void EQ::Net::EQStreamManager::DaybreakNewConnection(std::shared_ptr<DaybreakConnection> connection)
|
||||
void EQ::Net::EQStreamManager::ReliableStreamNewConnection(std::shared_ptr<ReliableStreamConnection> connection)
|
||||
{
|
||||
std::shared_ptr<EQStream> stream(new EQStream(this, connection));
|
||||
m_streams.emplace(std::make_pair(connection, stream));
|
||||
@ -28,7 +28,7 @@ void EQ::Net::EQStreamManager::DaybreakNewConnection(std::shared_ptr<DaybreakCon
|
||||
}
|
||||
}
|
||||
|
||||
void EQ::Net::EQStreamManager::DaybreakConnectionStateChange(std::shared_ptr<DaybreakConnection> connection, DbProtocolStatus from, DbProtocolStatus to)
|
||||
void EQ::Net::EQStreamManager::ReliableStreamConnectionStateChange(std::shared_ptr<ReliableStreamConnection> connection, DbProtocolStatus from, DbProtocolStatus to)
|
||||
{
|
||||
auto iter = m_streams.find(connection);
|
||||
if (iter != m_streams.end()) {
|
||||
@ -42,7 +42,7 @@ void EQ::Net::EQStreamManager::DaybreakConnectionStateChange(std::shared_ptr<Day
|
||||
}
|
||||
}
|
||||
|
||||
void EQ::Net::EQStreamManager::DaybreakPacketRecv(std::shared_ptr<DaybreakConnection> connection, const Packet &p)
|
||||
void EQ::Net::EQStreamManager::ReliableStreamPacketRecv(std::shared_ptr<ReliableStreamConnection> connection, const Packet &p)
|
||||
{
|
||||
auto iter = m_streams.find(connection);
|
||||
if (iter != m_streams.end()) {
|
||||
@ -53,7 +53,7 @@ void EQ::Net::EQStreamManager::DaybreakPacketRecv(std::shared_ptr<DaybreakConnec
|
||||
}
|
||||
}
|
||||
|
||||
EQ::Net::EQStream::EQStream(EQStreamManagerInterface *owner, std::shared_ptr<DaybreakConnection> connection)
|
||||
EQ::Net::EQStream::EQStream(EQStreamManagerInterface *owner, std::shared_ptr<ReliableStreamConnection> connection)
|
||||
{
|
||||
m_owner = owner;
|
||||
m_connection = connection;
|
||||
@ -235,7 +235,7 @@ EQStreamState EQ::Net::EQStream::GetState() {
|
||||
EQ::Net::EQStream::Stats EQ::Net::EQStream::GetStats() const
|
||||
{
|
||||
Stats ret;
|
||||
ret.DaybreakStats = m_connection->GetStats();
|
||||
ret.ReliableStreamStats = m_connection->GetStats();
|
||||
|
||||
for (int i = 0; i < _maxEmuOpcode; ++i) {
|
||||
ret.RecvCount[i] = 0;
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
#include "../eq_packet.h"
|
||||
#include "../eq_stream_intf.h"
|
||||
#include "../opcodemgr.h"
|
||||
#include "daybreak_connection.h"
|
||||
#include "reliable_stream_connection.h"
|
||||
#include <vector>
|
||||
#include <deque>
|
||||
#include <unordered_map>
|
||||
@ -23,21 +23,21 @@ namespace EQ
|
||||
void OnNewConnection(std::function<void(std::shared_ptr<EQStream>)> func) { m_on_new_connection = func; }
|
||||
void OnConnectionStateChange(std::function<void(std::shared_ptr<EQStream>, DbProtocolStatus, DbProtocolStatus)> func) { m_on_connection_state_change = func; }
|
||||
private:
|
||||
DaybreakConnectionManager m_daybreak;
|
||||
ReliableStreamConnectionManager m_reliable_stream;
|
||||
std::function<void(std::shared_ptr<EQStream>)> m_on_new_connection;
|
||||
std::function<void(std::shared_ptr<EQStream>, DbProtocolStatus, DbProtocolStatus)> m_on_connection_state_change;
|
||||
std::map<std::shared_ptr<DaybreakConnection>, std::shared_ptr<EQStream>> m_streams;
|
||||
std::map<std::shared_ptr<ReliableStreamConnection>, std::shared_ptr<EQStream>> m_streams;
|
||||
|
||||
void DaybreakNewConnection(std::shared_ptr<DaybreakConnection> connection);
|
||||
void DaybreakConnectionStateChange(std::shared_ptr<DaybreakConnection> connection, DbProtocolStatus from, DbProtocolStatus to);
|
||||
void DaybreakPacketRecv(std::shared_ptr<DaybreakConnection> connection, const Packet &p);
|
||||
void ReliableStreamNewConnection(std::shared_ptr<ReliableStreamConnection> connection);
|
||||
void ReliableStreamConnectionStateChange(std::shared_ptr<ReliableStreamConnection> connection, DbProtocolStatus from, DbProtocolStatus to);
|
||||
void ReliableStreamPacketRecv(std::shared_ptr<ReliableStreamConnection> connection, const Packet &p);
|
||||
friend class EQStream;
|
||||
};
|
||||
|
||||
class EQStream : public EQStreamInterface
|
||||
{
|
||||
public:
|
||||
EQStream(EQStreamManagerInterface *parent, std::shared_ptr<DaybreakConnection> connection);
|
||||
EQStream(EQStreamManagerInterface *parent, std::shared_ptr<ReliableStreamConnection> connection);
|
||||
~EQStream();
|
||||
|
||||
virtual void QueuePacket(const EQApplicationPacket *p, bool ack_req = true);
|
||||
@ -67,7 +67,7 @@ namespace EQ
|
||||
virtual EQStreamManagerInterface* GetManager() const;
|
||||
private:
|
||||
EQStreamManagerInterface *m_owner;
|
||||
std::shared_ptr<DaybreakConnection> m_connection;
|
||||
std::shared_ptr<ReliableStreamConnection> m_connection;
|
||||
OpcodeManager **m_opcode_manager;
|
||||
std::deque<std::unique_ptr<EQ::Net::Packet>> m_packet_queue;
|
||||
std::unordered_map<int, int> m_packet_recv_count;
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
#include "endian.h"
|
||||
#include <cctype>
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
void EQ::Net::Packet::PutInt8(size_t offset, int8_t value)
|
||||
{
|
||||
|
||||
@ -1,9 +1,10 @@
|
||||
#include "daybreak_connection.h"
|
||||
#include "reliable_stream_connection.h"
|
||||
#include "../event/event_loop.h"
|
||||
#include "../data_verification.h"
|
||||
#include "crc32.h"
|
||||
#include <zlib.h>
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
// observed client receive window is 300 packets, 140KB
|
||||
constexpr size_t MAX_CLIENT_RECV_PACKETS_PER_WINDOW = 300;
|
||||
@ -12,7 +13,7 @@ constexpr size_t MAX_CLIENT_RECV_BYTES_PER_WINDOW = 140 * 1024;
|
||||
// buffer pools
|
||||
SendBufferPool send_buffer_pool;
|
||||
|
||||
EQ::Net::DaybreakConnectionManager::DaybreakConnectionManager()
|
||||
EQ::Net::ReliableStreamConnectionManager::ReliableStreamConnectionManager()
|
||||
{
|
||||
m_attached = nullptr;
|
||||
memset(&m_timer, 0, sizeof(uv_timer_t));
|
||||
@ -21,7 +22,7 @@ EQ::Net::DaybreakConnectionManager::DaybreakConnectionManager()
|
||||
Attach(EQ::EventLoop::Get().Handle());
|
||||
}
|
||||
|
||||
EQ::Net::DaybreakConnectionManager::DaybreakConnectionManager(const DaybreakConnectionManagerOptions &opts)
|
||||
EQ::Net::ReliableStreamConnectionManager::ReliableStreamConnectionManager(const ReliableStreamConnectionManagerOptions &opts)
|
||||
{
|
||||
m_attached = nullptr;
|
||||
m_options = opts;
|
||||
@ -31,12 +32,12 @@ EQ::Net::DaybreakConnectionManager::DaybreakConnectionManager(const DaybreakConn
|
||||
Attach(EQ::EventLoop::Get().Handle());
|
||||
}
|
||||
|
||||
EQ::Net::DaybreakConnectionManager::~DaybreakConnectionManager()
|
||||
EQ::Net::ReliableStreamConnectionManager::~ReliableStreamConnectionManager()
|
||||
{
|
||||
Detach();
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnectionManager::Attach(uv_loop_t *loop)
|
||||
void EQ::Net::ReliableStreamConnectionManager::Attach(uv_loop_t *loop)
|
||||
{
|
||||
if (!m_attached) {
|
||||
uv_timer_init(loop, &m_timer);
|
||||
@ -45,7 +46,7 @@ void EQ::Net::DaybreakConnectionManager::Attach(uv_loop_t *loop)
|
||||
auto update_rate = (uint64_t)(1000.0 / m_options.tic_rate_hertz);
|
||||
|
||||
uv_timer_start(&m_timer, [](uv_timer_t *handle) {
|
||||
DaybreakConnectionManager *c = (DaybreakConnectionManager*)handle->data;
|
||||
ReliableStreamConnectionManager *c = (ReliableStreamConnectionManager*)handle->data;
|
||||
c->UpdateDataBudget();
|
||||
c->Process();
|
||||
c->ProcessResend();
|
||||
@ -71,7 +72,7 @@ void EQ::Net::DaybreakConnectionManager::Attach(uv_loop_t *loop)
|
||||
buf->len = 65536;
|
||||
},
|
||||
[](uv_udp_t* handle, ssize_t nread, const uv_buf_t* buf, const struct sockaddr* addr, unsigned flags) {
|
||||
DaybreakConnectionManager *c = (DaybreakConnectionManager*)handle->data;
|
||||
ReliableStreamConnectionManager *c = (ReliableStreamConnectionManager*)handle->data;
|
||||
if (nread < 0 || addr == nullptr) {
|
||||
return;
|
||||
}
|
||||
@ -90,7 +91,7 @@ void EQ::Net::DaybreakConnectionManager::Attach(uv_loop_t *loop)
|
||||
}
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnectionManager::Detach()
|
||||
void EQ::Net::ReliableStreamConnectionManager::Detach()
|
||||
{
|
||||
if (m_attached) {
|
||||
uv_udp_recv_stop(&m_socket);
|
||||
@ -99,11 +100,11 @@ void EQ::Net::DaybreakConnectionManager::Detach()
|
||||
}
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnectionManager::Connect(const std::string &addr, int port)
|
||||
void EQ::Net::ReliableStreamConnectionManager::Connect(const std::string &addr, int port)
|
||||
{
|
||||
//todo dns resolution
|
||||
|
||||
auto connection = std::shared_ptr<DaybreakConnection>(new DaybreakConnection(this, addr, port));
|
||||
auto connection = std::shared_ptr<ReliableStreamConnection>(new ReliableStreamConnection(this, addr, port));
|
||||
connection->m_self = connection;
|
||||
|
||||
if (m_on_new_connection) {
|
||||
@ -113,7 +114,7 @@ void EQ::Net::DaybreakConnectionManager::Connect(const std::string &addr, int po
|
||||
m_connections.emplace(std::make_pair(std::make_pair(addr, port), connection));
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnectionManager::Process()
|
||||
void EQ::Net::ReliableStreamConnectionManager::Process()
|
||||
{
|
||||
auto now = Clock::now();
|
||||
auto iter = m_connections.begin();
|
||||
@ -177,7 +178,7 @@ void EQ::Net::DaybreakConnectionManager::Process()
|
||||
}
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnectionManager::UpdateDataBudget()
|
||||
void EQ::Net::ReliableStreamConnectionManager::UpdateDataBudget()
|
||||
{
|
||||
auto outgoing_data_rate = m_options.outgoing_data_rate;
|
||||
if (outgoing_data_rate <= 0.0) {
|
||||
@ -196,7 +197,7 @@ void EQ::Net::DaybreakConnectionManager::UpdateDataBudget()
|
||||
}
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnectionManager::ProcessResend()
|
||||
void EQ::Net::ReliableStreamConnectionManager::ProcessResend()
|
||||
{
|
||||
auto iter = m_connections.begin();
|
||||
while (iter != m_connections.end()) {
|
||||
@ -217,15 +218,15 @@ void EQ::Net::DaybreakConnectionManager::ProcessResend()
|
||||
}
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnectionManager::ProcessPacket(const std::string &endpoint, int port, const char *data, size_t size)
|
||||
void EQ::Net::ReliableStreamConnectionManager::ProcessPacket(const std::string &endpoint, int port, const char *data, size_t size)
|
||||
{
|
||||
if (m_options.simulated_in_packet_loss && m_options.simulated_in_packet_loss >= m_rand.Int(0, 100)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (size < DaybreakHeader::size()) {
|
||||
if (size < ReliableStreamHeader::size()) {
|
||||
if (m_on_error_message) {
|
||||
m_on_error_message(fmt::format("Packet of size {0} which is less than {1}", size, DaybreakHeader::size()));
|
||||
m_on_error_message(fmt::format("Packet of size {0} which is less than {1}", size, ReliableStreamHeader::size()));
|
||||
}
|
||||
return;
|
||||
}
|
||||
@ -239,9 +240,9 @@ void EQ::Net::DaybreakConnectionManager::ProcessPacket(const std::string &endpoi
|
||||
else {
|
||||
if (data[0] == 0 && data[1] == OP_SessionRequest) {
|
||||
StaticPacket p((void*)data, size);
|
||||
auto request = p.GetSerialize<DaybreakConnect>(0);
|
||||
auto request = p.GetSerialize<ReliableStreamConnect>(0);
|
||||
|
||||
connection = std::shared_ptr<DaybreakConnection>(new DaybreakConnection(this, request, endpoint, port));
|
||||
connection = std::shared_ptr<ReliableStreamConnection>(new ReliableStreamConnection(this, request, endpoint, port));
|
||||
connection->m_self = connection;
|
||||
|
||||
if (m_on_new_connection) {
|
||||
@ -262,7 +263,7 @@ void EQ::Net::DaybreakConnectionManager::ProcessPacket(const std::string &endpoi
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<EQ::Net::DaybreakConnection> EQ::Net::DaybreakConnectionManager::FindConnectionByEndpoint(std::string addr, int port)
|
||||
std::shared_ptr<EQ::Net::ReliableStreamConnection> EQ::Net::ReliableStreamConnectionManager::FindConnectionByEndpoint(std::string addr, int port)
|
||||
{
|
||||
auto p = std::make_pair(addr, port);
|
||||
auto iter = m_connections.find(p);
|
||||
@ -273,9 +274,9 @@ std::shared_ptr<EQ::Net::DaybreakConnection> EQ::Net::DaybreakConnectionManager:
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnectionManager::SendDisconnect(const std::string &addr, int port)
|
||||
void EQ::Net::ReliableStreamConnectionManager::SendDisconnect(const std::string &addr, int port)
|
||||
{
|
||||
DaybreakDisconnect header;
|
||||
ReliableStreamDisconnect header;
|
||||
header.zero = 0;
|
||||
header.opcode = OP_OutOfSession;
|
||||
header.connect_code = 0;
|
||||
@ -300,7 +301,7 @@ void EQ::Net::DaybreakConnectionManager::SendDisconnect(const std::string &addr,
|
||||
}
|
||||
|
||||
//new connection made as server
|
||||
EQ::Net::DaybreakConnection::DaybreakConnection(DaybreakConnectionManager *owner, const DaybreakConnect &connect, const std::string &endpoint, int port)
|
||||
EQ::Net::ReliableStreamConnection::ReliableStreamConnection(ReliableStreamConnectionManager *owner, const ReliableStreamConnect &connect, const std::string &endpoint, int port)
|
||||
{
|
||||
m_owner = owner;
|
||||
m_last_send = Clock::now();
|
||||
@ -327,7 +328,7 @@ EQ::Net::DaybreakConnection::DaybreakConnection(DaybreakConnectionManager *owner
|
||||
}
|
||||
|
||||
//new connection made as client
|
||||
EQ::Net::DaybreakConnection::DaybreakConnection(DaybreakConnectionManager *owner, const std::string &endpoint, int port)
|
||||
EQ::Net::ReliableStreamConnection::ReliableStreamConnection(ReliableStreamConnectionManager *owner, const std::string &endpoint, int port)
|
||||
{
|
||||
m_owner = owner;
|
||||
m_last_send = Clock::now();
|
||||
@ -349,11 +350,11 @@ EQ::Net::DaybreakConnection::DaybreakConnection(DaybreakConnectionManager *owner
|
||||
m_outgoing_budget = owner->m_options.outgoing_data_rate;
|
||||
}
|
||||
|
||||
EQ::Net::DaybreakConnection::~DaybreakConnection()
|
||||
EQ::Net::ReliableStreamConnection::~ReliableStreamConnection()
|
||||
{
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::Close()
|
||||
void EQ::Net::ReliableStreamConnection::Close()
|
||||
{
|
||||
if (m_status != StatusDisconnected && m_status != StatusDisconnecting) {
|
||||
FlushBuffer();
|
||||
@ -367,17 +368,17 @@ void EQ::Net::DaybreakConnection::Close()
|
||||
ChangeStatus(StatusDisconnecting);
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::QueuePacket(Packet &p)
|
||||
void EQ::Net::ReliableStreamConnection::QueuePacket(Packet &p)
|
||||
{
|
||||
QueuePacket(p, 0, true);
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::QueuePacket(Packet &p, int stream)
|
||||
void EQ::Net::ReliableStreamConnection::QueuePacket(Packet &p, int stream)
|
||||
{
|
||||
QueuePacket(p, stream, true);
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::QueuePacket(Packet &p, int stream, bool reliable)
|
||||
void EQ::Net::ReliableStreamConnection::QueuePacket(Packet &p, int stream, bool reliable)
|
||||
{
|
||||
if (*(char*)p.Data() == 0) {
|
||||
DynamicPacket packet;
|
||||
@ -390,21 +391,21 @@ void EQ::Net::DaybreakConnection::QueuePacket(Packet &p, int stream, bool reliab
|
||||
InternalQueuePacket(p, stream, reliable);
|
||||
}
|
||||
|
||||
EQ::Net::DaybreakConnectionStats EQ::Net::DaybreakConnection::GetStats()
|
||||
EQ::Net::ReliableStreamConnectionStats EQ::Net::ReliableStreamConnection::GetStats()
|
||||
{
|
||||
EQ::Net::DaybreakConnectionStats ret = m_stats;
|
||||
EQ::Net::ReliableStreamConnectionStats ret = m_stats;
|
||||
ret.datarate_remaining = m_outgoing_budget;
|
||||
ret.avg_ping = m_rolling_ping;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::ResetStats()
|
||||
void EQ::Net::ReliableStreamConnection::ResetStats()
|
||||
{
|
||||
m_stats.Reset();
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::Process()
|
||||
void EQ::Net::ReliableStreamConnection::Process()
|
||||
{
|
||||
try {
|
||||
auto now = Clock::now();
|
||||
@ -422,7 +423,7 @@ void EQ::Net::DaybreakConnection::Process()
|
||||
}
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::ProcessPacket(Packet &p)
|
||||
void EQ::Net::ReliableStreamConnection::ProcessPacket(Packet &p)
|
||||
{
|
||||
m_last_recv = Clock::now();
|
||||
m_stats.recv_packets++;
|
||||
@ -458,13 +459,13 @@ void EQ::Net::DaybreakConnection::ProcessPacket(Packet &p)
|
||||
switch (m_encode_passes[i]) {
|
||||
case EncodeCompression:
|
||||
if(temp.GetInt8(0) == 0)
|
||||
Decompress(temp, DaybreakHeader::size(), temp.Length() - DaybreakHeader::size());
|
||||
Decompress(temp, ReliableStreamHeader::size(), temp.Length() - ReliableStreamHeader::size());
|
||||
else
|
||||
Decompress(temp, 1, temp.Length() - 1);
|
||||
break;
|
||||
case EncodeXOR:
|
||||
if (temp.GetInt8(0) == 0)
|
||||
Decode(temp, DaybreakHeader::size(), temp.Length() - DaybreakHeader::size());
|
||||
Decode(temp, ReliableStreamHeader::size(), temp.Length() - ReliableStreamHeader::size());
|
||||
else
|
||||
Decode(temp, 1, temp.Length() - 1);
|
||||
break;
|
||||
@ -483,7 +484,7 @@ void EQ::Net::DaybreakConnection::ProcessPacket(Packet &p)
|
||||
switch (m_encode_passes[i]) {
|
||||
case EncodeXOR:
|
||||
if (temp.GetInt8(0) == 0)
|
||||
Decode(temp, DaybreakHeader::size(), temp.Length() - DaybreakHeader::size());
|
||||
Decode(temp, ReliableStreamHeader::size(), temp.Length() - ReliableStreamHeader::size());
|
||||
else
|
||||
Decode(temp, 1, temp.Length() - 1);
|
||||
break;
|
||||
@ -502,7 +503,7 @@ void EQ::Net::DaybreakConnection::ProcessPacket(Packet &p)
|
||||
}
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::ProcessQueue()
|
||||
void EQ::Net::ReliableStreamConnection::ProcessQueue()
|
||||
{
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
auto stream = &m_streams[i];
|
||||
@ -521,7 +522,7 @@ void EQ::Net::DaybreakConnection::ProcessQueue()
|
||||
}
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::RemoveFromQueue(int stream, uint16_t seq)
|
||||
void EQ::Net::ReliableStreamConnection::RemoveFromQueue(int stream, uint16_t seq)
|
||||
{
|
||||
auto s = &m_streams[stream];
|
||||
auto iter = s->packet_queue.find(seq);
|
||||
@ -532,7 +533,7 @@ void EQ::Net::DaybreakConnection::RemoveFromQueue(int stream, uint16_t seq)
|
||||
}
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::AddToQueue(int stream, uint16_t seq, const Packet &p)
|
||||
void EQ::Net::ReliableStreamConnection::AddToQueue(int stream, uint16_t seq, const Packet &p)
|
||||
{
|
||||
auto s = &m_streams[stream];
|
||||
auto iter = s->packet_queue.find(seq);
|
||||
@ -544,7 +545,7 @@ void EQ::Net::DaybreakConnection::AddToQueue(int stream, uint16_t seq, const Pac
|
||||
}
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
||||
void EQ::Net::ReliableStreamConnection::ProcessDecodedPacket(const Packet &p)
|
||||
{
|
||||
if (p.GetInt8(0) == 0) {
|
||||
if (p.Length() < 2) {
|
||||
@ -628,13 +629,13 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
||||
case OP_SessionRequest:
|
||||
{
|
||||
if (m_status == StatusConnected) {
|
||||
auto request = p.GetSerialize<DaybreakConnect>(0);
|
||||
auto request = p.GetSerialize<ReliableStreamConnect>(0);
|
||||
|
||||
if (NetworkToHost(request.connect_code) != m_connect_code) {
|
||||
return;
|
||||
}
|
||||
|
||||
DaybreakConnectReply reply;
|
||||
ReliableStreamConnectReply reply;
|
||||
reply.zero = 0;
|
||||
reply.opcode = OP_SessionResponse;
|
||||
reply.connect_code = HostToNetwork(m_connect_code);
|
||||
@ -656,13 +657,13 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
||||
case OP_SessionResponse:
|
||||
{
|
||||
if (m_status == StatusConnecting) {
|
||||
auto reply = p.GetSerialize<DaybreakConnectReply>(0);
|
||||
auto reply = p.GetSerialize<ReliableStreamConnectReply>(0);
|
||||
|
||||
if (m_connect_code == reply.connect_code) {
|
||||
m_encode_key = reply.encode_key;
|
||||
m_crc_bytes = reply.crc_bytes;
|
||||
m_encode_passes[0] = (DaybreakEncodeType)reply.encode_pass1;
|
||||
m_encode_passes[1] = (DaybreakEncodeType)reply.encode_pass2;
|
||||
m_encode_passes[0] = (ReliableStreamEncodeType)reply.encode_pass1;
|
||||
m_encode_passes[1] = (ReliableStreamEncodeType)reply.encode_pass2;
|
||||
m_max_packet_size = reply.max_packet_size;
|
||||
ChangeStatus(StatusConnected);
|
||||
|
||||
@ -686,7 +687,7 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
||||
return;
|
||||
}
|
||||
|
||||
auto header = p.GetSerialize<DaybreakReliableHeader>(0);
|
||||
auto header = p.GetSerialize<ReliableStreamReliableHeader>(0);
|
||||
auto sequence = NetworkToHost(header.sequence);
|
||||
auto stream_id = header.opcode - OP_Packet;
|
||||
auto stream = &m_streams[stream_id];
|
||||
@ -703,7 +704,7 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
||||
RemoveFromQueue(stream_id, sequence);
|
||||
SendAck(stream_id, stream->sequence_in);
|
||||
stream->sequence_in++;
|
||||
StaticPacket next((char*)p.Data() + DaybreakReliableHeader::size(), p.Length() - DaybreakReliableHeader::size());
|
||||
StaticPacket next((char*)p.Data() + ReliableStreamReliableHeader::size(), p.Length() - ReliableStreamReliableHeader::size());
|
||||
ProcessDecodedPacket(next);
|
||||
}
|
||||
|
||||
@ -715,7 +716,7 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
||||
case OP_Fragment3:
|
||||
case OP_Fragment4:
|
||||
{
|
||||
auto header = p.GetSerialize<DaybreakReliableHeader>(0);
|
||||
auto header = p.GetSerialize<ReliableStreamReliableHeader>(0);
|
||||
auto sequence = NetworkToHost(header.sequence);
|
||||
auto stream_id = header.opcode - OP_Fragment;
|
||||
auto stream = &m_streams[stream_id];
|
||||
@ -735,22 +736,22 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
||||
stream->sequence_in++;
|
||||
|
||||
if (stream->fragment_total_bytes == 0) {
|
||||
auto fragheader = p.GetSerialize<DaybreakReliableFragmentHeader>(0);
|
||||
auto fragheader = p.GetSerialize<ReliableStreamReliableFragmentHeader>(0);
|
||||
stream->fragment_total_bytes = NetworkToHost(fragheader.total_size);
|
||||
stream->fragment_current_bytes = 0;
|
||||
stream->fragment_packet.Reserve(stream->fragment_total_bytes);
|
||||
stream->fragment_packet.PutData(
|
||||
stream->fragment_current_bytes,
|
||||
(char*)p.Data() + DaybreakReliableFragmentHeader::size(), p.Length() - DaybreakReliableFragmentHeader::size());
|
||||
(char*)p.Data() + ReliableStreamReliableFragmentHeader::size(), p.Length() - ReliableStreamReliableFragmentHeader::size());
|
||||
|
||||
stream->fragment_current_bytes += (uint32_t)(p.Length() - DaybreakReliableFragmentHeader::size());
|
||||
stream->fragment_current_bytes += (uint32_t)(p.Length() - ReliableStreamReliableFragmentHeader::size());
|
||||
}
|
||||
else {
|
||||
stream->fragment_packet.PutData(
|
||||
stream->fragment_current_bytes,
|
||||
(char*)p.Data() + DaybreakReliableHeader::size(), p.Length() - DaybreakReliableHeader::size());
|
||||
(char*)p.Data() + ReliableStreamReliableHeader::size(), p.Length() - ReliableStreamReliableHeader::size());
|
||||
|
||||
stream->fragment_current_bytes += (uint32_t)(p.Length() - DaybreakReliableHeader::size());
|
||||
stream->fragment_current_bytes += (uint32_t)(p.Length() - ReliableStreamReliableHeader::size());
|
||||
|
||||
if (stream->fragment_current_bytes >= stream->fragment_total_bytes) {
|
||||
ProcessDecodedPacket(stream->fragment_packet);
|
||||
@ -769,7 +770,7 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
||||
case OP_Ack3:
|
||||
case OP_Ack4:
|
||||
{
|
||||
auto header = p.GetSerialize<DaybreakReliableHeader>(0);
|
||||
auto header = p.GetSerialize<ReliableStreamReliableHeader>(0);
|
||||
auto sequence = NetworkToHost(header.sequence);
|
||||
auto stream_id = header.opcode - OP_Ack;
|
||||
Ack(stream_id, sequence);
|
||||
@ -781,7 +782,7 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
||||
case OP_OutOfOrderAck3:
|
||||
case OP_OutOfOrderAck4:
|
||||
{
|
||||
auto header = p.GetSerialize<DaybreakReliableHeader>(0);
|
||||
auto header = p.GetSerialize<ReliableStreamReliableHeader>(0);
|
||||
auto sequence = NetworkToHost(header.sequence);
|
||||
auto stream_id = header.opcode - OP_OutOfOrderAck;
|
||||
OutOfOrderAck(stream_id, sequence);
|
||||
@ -815,13 +816,13 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
||||
}
|
||||
case OP_SessionStatRequest:
|
||||
{
|
||||
auto request = p.GetSerialize<DaybreakSessionStatRequest>(0);
|
||||
auto request = p.GetSerialize<ReliableStreamSessionStatRequest>(0);
|
||||
m_stats.sync_remote_sent_packets = EQ::Net::NetworkToHost(request.packets_sent);
|
||||
m_stats.sync_remote_recv_packets = EQ::Net::NetworkToHost(request.packets_recv);
|
||||
m_stats.sync_sent_packets = m_stats.sent_packets;
|
||||
m_stats.sync_recv_packets = m_stats.recv_packets;
|
||||
|
||||
DaybreakSessionStatResponse response;
|
||||
ReliableStreamSessionStatResponse response;
|
||||
response.zero = 0;
|
||||
response.opcode = OP_SessionStatResponse;
|
||||
response.timestamp = request.timestamp;
|
||||
@ -836,7 +837,7 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
||||
break;
|
||||
}
|
||||
case OP_SessionStatResponse: {
|
||||
auto response = p.GetSerialize<DaybreakSessionStatResponse>(0);
|
||||
auto response = p.GetSerialize<ReliableStreamSessionStatResponse>(0);
|
||||
m_stats.sync_remote_sent_packets = EQ::Net::NetworkToHost(response.server_sent);
|
||||
m_stats.sync_remote_recv_packets = EQ::Net::NetworkToHost(response.server_recv);
|
||||
m_stats.sync_sent_packets = m_stats.sent_packets;
|
||||
@ -858,7 +859,7 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
||||
}
|
||||
}
|
||||
|
||||
bool EQ::Net::DaybreakConnection::ValidateCRC(Packet &p)
|
||||
bool EQ::Net::ReliableStreamConnection::ValidateCRC(Packet &p)
|
||||
{
|
||||
if (m_crc_bytes == 0U) {
|
||||
return true;
|
||||
@ -892,7 +893,7 @@ bool EQ::Net::DaybreakConnection::ValidateCRC(Packet &p)
|
||||
return false;
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::AppendCRC(Packet &p)
|
||||
void EQ::Net::ReliableStreamConnection::AppendCRC(Packet &p)
|
||||
{
|
||||
if (m_crc_bytes == 0U) {
|
||||
return;
|
||||
@ -911,7 +912,7 @@ void EQ::Net::DaybreakConnection::AppendCRC(Packet &p)
|
||||
}
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::ChangeStatus(DbProtocolStatus new_status)
|
||||
void EQ::Net::ReliableStreamConnection::ChangeStatus(DbProtocolStatus new_status)
|
||||
{
|
||||
if (m_owner->m_on_connection_state_change) {
|
||||
if (auto self = m_self.lock()) {
|
||||
@ -922,7 +923,7 @@ void EQ::Net::DaybreakConnection::ChangeStatus(DbProtocolStatus new_status)
|
||||
m_status = new_status;
|
||||
}
|
||||
|
||||
bool EQ::Net::DaybreakConnection::PacketCanBeEncoded(Packet &p) const
|
||||
bool EQ::Net::ReliableStreamConnection::PacketCanBeEncoded(Packet &p) const
|
||||
{
|
||||
if (p.Length() < 2) {
|
||||
return false;
|
||||
@ -941,7 +942,7 @@ bool EQ::Net::DaybreakConnection::PacketCanBeEncoded(Packet &p) const
|
||||
return true;
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::Decode(Packet &p, size_t offset, size_t length)
|
||||
void EQ::Net::ReliableStreamConnection::Decode(Packet &p, size_t offset, size_t length)
|
||||
{
|
||||
int key = m_encode_key;
|
||||
char *buffer = (char*)p.Data() + offset;
|
||||
@ -961,7 +962,7 @@ void EQ::Net::DaybreakConnection::Decode(Packet &p, size_t offset, size_t length
|
||||
}
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::Encode(Packet &p, size_t offset, size_t length)
|
||||
void EQ::Net::ReliableStreamConnection::Encode(Packet &p, size_t offset, size_t length)
|
||||
{
|
||||
int key = m_encode_key;
|
||||
char *buffer = (char*)p.Data() + offset;
|
||||
@ -1050,7 +1051,7 @@ uint32_t Deflate(const uint8_t* in, uint32_t in_len, uint8_t* out, uint32_t out_
|
||||
}
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::Decompress(Packet &p, size_t offset, size_t length)
|
||||
void EQ::Net::ReliableStreamConnection::Decompress(Packet &p, size_t offset, size_t length)
|
||||
{
|
||||
if (length < 2) {
|
||||
return;
|
||||
@ -1075,7 +1076,7 @@ void EQ::Net::DaybreakConnection::Decompress(Packet &p, size_t offset, size_t le
|
||||
p.PutData(offset, new_buffer, new_length);
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::Compress(Packet &p, size_t offset, size_t length)
|
||||
void EQ::Net::ReliableStreamConnection::Compress(Packet &p, size_t offset, size_t length)
|
||||
{
|
||||
static thread_local uint8_t new_buffer[2048] = { 0 };
|
||||
uint8_t *buffer = (uint8_t*)p.Data() + offset;
|
||||
@ -1097,14 +1098,14 @@ void EQ::Net::DaybreakConnection::Compress(Packet &p, size_t offset, size_t leng
|
||||
p.PutData(offset, new_buffer, new_length);
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::ProcessResend()
|
||||
void EQ::Net::ReliableStreamConnection::ProcessResend()
|
||||
{
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
ProcessResend(i);
|
||||
}
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::ProcessResend(int stream)
|
||||
void EQ::Net::ReliableStreamConnection::ProcessResend(int stream)
|
||||
{
|
||||
if (m_status == DbProtocolStatus::StatusDisconnected) {
|
||||
return;
|
||||
@ -1201,7 +1202,7 @@ void EQ::Net::DaybreakConnection::ProcessResend(int stream)
|
||||
|
||||
auto &sp = e.second;
|
||||
auto &p = sp.packet;
|
||||
if (p.Length() >= DaybreakHeader::size()) {
|
||||
if (p.Length() >= ReliableStreamHeader::size()) {
|
||||
if (p.GetInt8(0) == 0 && p.GetInt8(1) >= OP_Fragment && p.GetInt8(1) <= OP_Fragment4) {
|
||||
m_stats.resent_fragments++;
|
||||
}
|
||||
@ -1232,7 +1233,7 @@ void EQ::Net::DaybreakConnection::ProcessResend(int stream)
|
||||
m_last_ack = now;
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::Ack(int stream, uint16_t seq)
|
||||
void EQ::Net::ReliableStreamConnection::Ack(int stream, uint16_t seq)
|
||||
{
|
||||
auto now = Clock::now();
|
||||
auto s = &m_streams[stream];
|
||||
@ -1259,7 +1260,7 @@ void EQ::Net::DaybreakConnection::Ack(int stream, uint16_t seq)
|
||||
m_last_ack = now;
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::OutOfOrderAck(int stream, uint16_t seq)
|
||||
void EQ::Net::ReliableStreamConnection::OutOfOrderAck(int stream, uint16_t seq)
|
||||
{
|
||||
auto now = Clock::now();
|
||||
auto s = &m_streams[stream];
|
||||
@ -1279,15 +1280,15 @@ void EQ::Net::DaybreakConnection::OutOfOrderAck(int stream, uint16_t seq)
|
||||
m_last_ack = now;
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::UpdateDataBudget(double budget_add)
|
||||
void EQ::Net::ReliableStreamConnection::UpdateDataBudget(double budget_add)
|
||||
{
|
||||
auto outgoing_data_rate = m_owner->m_options.outgoing_data_rate;
|
||||
m_outgoing_budget = EQ::ClampUpper(m_outgoing_budget + budget_add, outgoing_data_rate);
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::SendAck(int stream_id, uint16_t seq)
|
||||
void EQ::Net::ReliableStreamConnection::SendAck(int stream_id, uint16_t seq)
|
||||
{
|
||||
DaybreakReliableHeader ack;
|
||||
ReliableStreamReliableHeader ack;
|
||||
ack.zero = 0;
|
||||
ack.opcode = OP_Ack + stream_id;
|
||||
ack.sequence = HostToNetwork(seq);
|
||||
@ -1298,9 +1299,9 @@ void EQ::Net::DaybreakConnection::SendAck(int stream_id, uint16_t seq)
|
||||
InternalBufferedSend(p);
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::SendOutOfOrderAck(int stream_id, uint16_t seq)
|
||||
void EQ::Net::ReliableStreamConnection::SendOutOfOrderAck(int stream_id, uint16_t seq)
|
||||
{
|
||||
DaybreakReliableHeader ack;
|
||||
ReliableStreamReliableHeader ack;
|
||||
ack.zero = 0;
|
||||
ack.opcode = OP_OutOfOrderAck + stream_id;
|
||||
ack.sequence = HostToNetwork(seq);
|
||||
@ -1311,9 +1312,9 @@ void EQ::Net::DaybreakConnection::SendOutOfOrderAck(int stream_id, uint16_t seq)
|
||||
InternalBufferedSend(p);
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::SendDisconnect()
|
||||
void EQ::Net::ReliableStreamConnection::SendDisconnect()
|
||||
{
|
||||
DaybreakDisconnect disconnect;
|
||||
ReliableStreamDisconnect disconnect;
|
||||
disconnect.zero = 0;
|
||||
disconnect.opcode = OP_SessionDisconnect;
|
||||
disconnect.connect_code = HostToNetwork(m_connect_code);
|
||||
@ -1322,7 +1323,7 @@ void EQ::Net::DaybreakConnection::SendDisconnect()
|
||||
InternalSend(out);
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::InternalBufferedSend(Packet &p)
|
||||
void EQ::Net::ReliableStreamConnection::InternalBufferedSend(Packet &p)
|
||||
{
|
||||
if (p.Length() > 0xFFU) {
|
||||
FlushBuffer();
|
||||
@ -1331,7 +1332,7 @@ void EQ::Net::DaybreakConnection::InternalBufferedSend(Packet &p)
|
||||
}
|
||||
|
||||
//we could add this packet to a combined
|
||||
size_t raw_size = DaybreakHeader::size() + (size_t)m_crc_bytes + m_buffered_packets_length + m_buffered_packets.size() + 1 + p.Length();
|
||||
size_t raw_size = ReliableStreamHeader::size() + (size_t)m_crc_bytes + m_buffered_packets_length + m_buffered_packets.size() + 1 + p.Length();
|
||||
if (raw_size > m_max_packet_size) {
|
||||
FlushBuffer();
|
||||
}
|
||||
@ -1346,9 +1347,9 @@ void EQ::Net::DaybreakConnection::InternalBufferedSend(Packet &p)
|
||||
}
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::SendConnect()
|
||||
void EQ::Net::ReliableStreamConnection::SendConnect()
|
||||
{
|
||||
DaybreakConnect connect;
|
||||
ReliableStreamConnect connect;
|
||||
connect.zero = 0;
|
||||
connect.opcode = OP_SessionRequest;
|
||||
connect.protocol_version = HostToNetwork(3U);
|
||||
@ -1361,9 +1362,9 @@ void EQ::Net::DaybreakConnection::SendConnect()
|
||||
InternalSend(p);
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::SendKeepAlive()
|
||||
void EQ::Net::ReliableStreamConnection::SendKeepAlive()
|
||||
{
|
||||
DaybreakHeader keep_alive;
|
||||
ReliableStreamHeader keep_alive;
|
||||
keep_alive.zero = 0;
|
||||
keep_alive.opcode = OP_KeepAlive;
|
||||
|
||||
@ -1373,7 +1374,7 @@ void EQ::Net::DaybreakConnection::SendKeepAlive()
|
||||
InternalSend(p);
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::InternalSend(Packet &p) {
|
||||
void EQ::Net::ReliableStreamConnection::InternalSend(Packet &p) {
|
||||
if (m_owner->m_options.outgoing_data_rate > 0.0) {
|
||||
auto new_budget = m_outgoing_budget - (p.Length() / 1024.0);
|
||||
if (new_budget <= 0.0) {
|
||||
@ -1409,14 +1410,14 @@ void EQ::Net::DaybreakConnection::InternalSend(Packet &p) {
|
||||
switch (m_encode_passe) {
|
||||
case EncodeCompression:
|
||||
if (out.GetInt8(0) == 0) {
|
||||
Compress(out, DaybreakHeader::size(), out.Length() - DaybreakHeader::size());
|
||||
Compress(out, ReliableStreamHeader::size(), out.Length() - ReliableStreamHeader::size());
|
||||
} else {
|
||||
Compress(out, 1, out.Length() - 1);
|
||||
}
|
||||
break;
|
||||
case EncodeXOR:
|
||||
if (out.GetInt8(0) == 0) {
|
||||
Encode(out, DaybreakHeader::size(), out.Length() - DaybreakHeader::size());
|
||||
Encode(out, ReliableStreamHeader::size(), out.Length() - ReliableStreamHeader::size());
|
||||
} else {
|
||||
Encode(out, 1, out.Length() - 1);
|
||||
}
|
||||
@ -1466,7 +1467,7 @@ void EQ::Net::DaybreakConnection::InternalSend(Packet &p) {
|
||||
}
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::InternalQueuePacket(Packet &p, int stream_id, bool reliable)
|
||||
void EQ::Net::ReliableStreamConnection::InternalQueuePacket(Packet &p, int stream_id, bool reliable)
|
||||
{
|
||||
if (!reliable) {
|
||||
auto max_raw_size = 0xFFU - m_crc_bytes;
|
||||
@ -1480,23 +1481,23 @@ void EQ::Net::DaybreakConnection::InternalQueuePacket(Packet &p, int stream_id,
|
||||
}
|
||||
|
||||
auto stream = &m_streams[stream_id];
|
||||
auto max_raw_size = m_max_packet_size - m_crc_bytes - DaybreakReliableHeader::size() - 1; // -1 for compress flag
|
||||
auto max_raw_size = m_max_packet_size - m_crc_bytes - ReliableStreamReliableHeader::size() - 1; // -1 for compress flag
|
||||
size_t length = p.Length();
|
||||
if (length > max_raw_size) {
|
||||
DaybreakReliableFragmentHeader first_header;
|
||||
ReliableStreamReliableFragmentHeader first_header;
|
||||
first_header.reliable.zero = 0;
|
||||
first_header.reliable.opcode = OP_Fragment + stream_id;
|
||||
first_header.reliable.sequence = HostToNetwork(stream->sequence_out);
|
||||
first_header.total_size = (uint32_t)HostToNetwork((uint32_t)length);
|
||||
|
||||
size_t used = 0;
|
||||
size_t sublen = m_max_packet_size - m_crc_bytes - DaybreakReliableFragmentHeader::size() - 1; // -1 for compress flag
|
||||
size_t sublen = m_max_packet_size - m_crc_bytes - ReliableStreamReliableFragmentHeader::size() - 1; // -1 for compress flag
|
||||
DynamicPacket first_packet;
|
||||
first_packet.PutSerialize(0, first_header);
|
||||
first_packet.PutData(DaybreakReliableFragmentHeader::size(), (char*)p.Data() + used, sublen);
|
||||
first_packet.PutData(ReliableStreamReliableFragmentHeader::size(), (char*)p.Data() + used, sublen);
|
||||
used += sublen;
|
||||
|
||||
DaybreakSentPacket sent;
|
||||
ReliableStreamSentPacket sent;
|
||||
sent.packet.PutPacket(0, first_packet);
|
||||
sent.last_sent = Clock::now();
|
||||
sent.first_sent = Clock::now();
|
||||
@ -1513,22 +1514,22 @@ void EQ::Net::DaybreakConnection::InternalQueuePacket(Packet &p, int stream_id,
|
||||
while (used < length) {
|
||||
auto left = length - used;
|
||||
DynamicPacket packet;
|
||||
DaybreakReliableHeader header;
|
||||
ReliableStreamReliableHeader header;
|
||||
header.zero = 0;
|
||||
header.opcode = OP_Fragment + stream_id;
|
||||
header.sequence = HostToNetwork(stream->sequence_out);
|
||||
packet.PutSerialize(0, header);
|
||||
|
||||
if (left > max_raw_size) {
|
||||
packet.PutData(DaybreakReliableHeader::size(), (char*)p.Data() + used, max_raw_size);
|
||||
packet.PutData(ReliableStreamReliableHeader::size(), (char*)p.Data() + used, max_raw_size);
|
||||
used += max_raw_size;
|
||||
}
|
||||
else {
|
||||
packet.PutData(DaybreakReliableHeader::size(), (char*)p.Data() + used, left);
|
||||
packet.PutData(ReliableStreamReliableHeader::size(), (char*)p.Data() + used, left);
|
||||
used += left;
|
||||
}
|
||||
|
||||
DaybreakSentPacket sent;
|
||||
ReliableStreamSentPacket sent;
|
||||
sent.packet.PutPacket(0, packet);
|
||||
sent.last_sent = Clock::now();
|
||||
sent.first_sent = Clock::now();
|
||||
@ -1545,14 +1546,14 @@ void EQ::Net::DaybreakConnection::InternalQueuePacket(Packet &p, int stream_id,
|
||||
}
|
||||
else {
|
||||
DynamicPacket packet;
|
||||
DaybreakReliableHeader header;
|
||||
ReliableStreamReliableHeader header;
|
||||
header.zero = 0;
|
||||
header.opcode = OP_Packet + stream_id;
|
||||
header.sequence = HostToNetwork(stream->sequence_out);
|
||||
packet.PutSerialize(0, header);
|
||||
packet.PutPacket(DaybreakReliableHeader::size(), p);
|
||||
packet.PutPacket(ReliableStreamReliableHeader::size(), p);
|
||||
|
||||
DaybreakSentPacket sent;
|
||||
ReliableStreamSentPacket sent;
|
||||
sent.packet.PutPacket(0, packet);
|
||||
sent.last_sent = Clock::now();
|
||||
sent.first_sent = Clock::now();
|
||||
@ -1568,7 +1569,7 @@ void EQ::Net::DaybreakConnection::InternalQueuePacket(Packet &p, int stream_id,
|
||||
}
|
||||
}
|
||||
|
||||
void EQ::Net::DaybreakConnection::FlushBuffer()
|
||||
void EQ::Net::ReliableStreamConnection::FlushBuffer()
|
||||
{
|
||||
if (m_buffered_packets.empty()) {
|
||||
return;
|
||||
@ -1595,7 +1596,7 @@ void EQ::Net::DaybreakConnection::FlushBuffer()
|
||||
m_buffered_packets_length = 0;
|
||||
}
|
||||
|
||||
EQ::Net::SequenceOrder EQ::Net::DaybreakConnection::CompareSequence(uint16_t expected, uint16_t actual) const
|
||||
EQ::Net::SequenceOrder EQ::Net::ReliableStreamConnection::CompareSequence(uint16_t expected, uint16_t actual) const
|
||||
{
|
||||
int diff = (int)actual - (int)expected;
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
|
||||
#include "../random.h"
|
||||
#include "packet.h"
|
||||
#include "daybreak_structs.h"
|
||||
#include "daybreak_pooling.h"
|
||||
#include "reliable_stream_structs.h"
|
||||
#include "reliable_stream_pooling.h"
|
||||
#include <uv.h>
|
||||
#include <chrono>
|
||||
#include <functional>
|
||||
@ -16,7 +16,7 @@ namespace EQ
|
||||
{
|
||||
namespace Net
|
||||
{
|
||||
enum DaybreakProtocolOpcode
|
||||
enum ReliableStreamProtocolOpcode
|
||||
{
|
||||
OP_Padding = 0x00,
|
||||
OP_SessionRequest = 0x01,
|
||||
@ -55,7 +55,7 @@ namespace EQ
|
||||
StatusDisconnected
|
||||
};
|
||||
|
||||
enum DaybreakEncodeType
|
||||
enum ReliableStreamEncodeType
|
||||
{
|
||||
EncodeNone = 0,
|
||||
EncodeCompression = 1,
|
||||
@ -72,9 +72,9 @@ namespace EQ
|
||||
typedef std::chrono::steady_clock::time_point Timestamp;
|
||||
typedef std::chrono::steady_clock Clock;
|
||||
|
||||
struct DaybreakConnectionStats
|
||||
struct ReliableStreamConnectionStats
|
||||
{
|
||||
DaybreakConnectionStats() {
|
||||
ReliableStreamConnectionStats() {
|
||||
recv_bytes = 0;
|
||||
sent_bytes = 0;
|
||||
recv_packets = 0;
|
||||
@ -134,14 +134,14 @@ namespace EQ
|
||||
uint64_t bytes_before_encode;
|
||||
};
|
||||
|
||||
class DaybreakConnectionManager;
|
||||
class DaybreakConnection;
|
||||
class DaybreakConnection
|
||||
class ReliableStreamConnectionManager;
|
||||
class ReliableStreamConnection;
|
||||
class ReliableStreamConnection
|
||||
{
|
||||
public:
|
||||
DaybreakConnection(DaybreakConnectionManager *owner, const DaybreakConnect &connect, const std::string &endpoint, int port);
|
||||
DaybreakConnection(DaybreakConnectionManager *owner, const std::string &endpoint, int port);
|
||||
~DaybreakConnection();
|
||||
ReliableStreamConnection(ReliableStreamConnectionManager *owner, const ReliableStreamConnect &connect, const std::string &endpoint, int port);
|
||||
ReliableStreamConnection(ReliableStreamConnectionManager *owner, const std::string &endpoint, int port);
|
||||
~ReliableStreamConnection();
|
||||
|
||||
const std::string& RemoteEndpoint() const { return m_endpoint; }
|
||||
int RemotePort() const { return m_port; }
|
||||
@ -151,23 +151,23 @@ namespace EQ
|
||||
void QueuePacket(Packet &p, int stream);
|
||||
void QueuePacket(Packet &p, int stream, bool reliable);
|
||||
|
||||
DaybreakConnectionStats GetStats();
|
||||
ReliableStreamConnectionStats GetStats();
|
||||
void ResetStats();
|
||||
size_t GetRollingPing() const { return m_rolling_ping; }
|
||||
DbProtocolStatus GetStatus() const { return m_status; }
|
||||
|
||||
const DaybreakEncodeType* GetEncodePasses() const { return m_encode_passes; }
|
||||
const DaybreakConnectionManager* GetManager() const { return m_owner; }
|
||||
DaybreakConnectionManager* GetManager() { return m_owner; }
|
||||
const ReliableStreamEncodeType* GetEncodePasses() const { return m_encode_passes; }
|
||||
const ReliableStreamConnectionManager* GetManager() const { return m_owner; }
|
||||
ReliableStreamConnectionManager* GetManager() { return m_owner; }
|
||||
private:
|
||||
DaybreakConnectionManager *m_owner;
|
||||
ReliableStreamConnectionManager *m_owner;
|
||||
std::string m_endpoint;
|
||||
int m_port;
|
||||
uint32_t m_connect_code;
|
||||
uint32_t m_encode_key;
|
||||
uint32_t m_max_packet_size;
|
||||
uint32_t m_crc_bytes;
|
||||
DaybreakEncodeType m_encode_passes[2];
|
||||
ReliableStreamEncodeType m_encode_passes[2];
|
||||
|
||||
Timestamp m_last_send;
|
||||
Timestamp m_last_recv;
|
||||
@ -176,7 +176,7 @@ namespace EQ
|
||||
std::list<DynamicPacket> m_buffered_packets;
|
||||
size_t m_buffered_packets_length;
|
||||
std::unique_ptr<char[]> m_combined;
|
||||
DaybreakConnectionStats m_stats;
|
||||
ReliableStreamConnectionStats m_stats;
|
||||
Timestamp m_last_session_stats;
|
||||
size_t m_rolling_ping;
|
||||
Timestamp m_close_time;
|
||||
@ -188,7 +188,7 @@ namespace EQ
|
||||
bool m_acked_since_last_resend = false;
|
||||
Timestamp m_last_ack;
|
||||
|
||||
struct DaybreakSentPacket
|
||||
struct ReliableStreamSentPacket
|
||||
{
|
||||
DynamicPacket packet;
|
||||
Timestamp last_sent;
|
||||
@ -197,9 +197,9 @@ namespace EQ
|
||||
size_t resend_delay;
|
||||
};
|
||||
|
||||
struct DaybreakStream
|
||||
struct ReliableStream
|
||||
{
|
||||
DaybreakStream() {
|
||||
ReliableStream() {
|
||||
sequence_in = 0;
|
||||
sequence_out = 0;
|
||||
fragment_current_bytes = 0;
|
||||
@ -214,11 +214,11 @@ namespace EQ
|
||||
uint32_t fragment_current_bytes;
|
||||
uint32_t fragment_total_bytes;
|
||||
|
||||
std::map<uint16_t, DaybreakSentPacket> sent_packets;
|
||||
std::map<uint16_t, ReliableStreamSentPacket> sent_packets;
|
||||
};
|
||||
|
||||
DaybreakStream m_streams[4];
|
||||
std::weak_ptr<DaybreakConnection> m_self;
|
||||
ReliableStream m_streams[4];
|
||||
std::weak_ptr<ReliableStreamConnection> m_self;
|
||||
|
||||
void Process();
|
||||
void ProcessPacket(Packet &p);
|
||||
@ -251,12 +251,12 @@ namespace EQ
|
||||
void FlushBuffer();
|
||||
SequenceOrder CompareSequence(uint16_t expected, uint16_t actual) const;
|
||||
|
||||
friend class DaybreakConnectionManager;
|
||||
friend class ReliableStreamConnectionManager;
|
||||
};
|
||||
|
||||
struct DaybreakConnectionManagerOptions
|
||||
struct ReliableStreamConnectionManagerOptions
|
||||
{
|
||||
DaybreakConnectionManagerOptions() {
|
||||
ReliableStreamConnectionManagerOptions() {
|
||||
max_connection_count = 0;
|
||||
keepalive_delay_ms = 9000;
|
||||
resend_delay_ms = 30;
|
||||
@ -268,8 +268,8 @@ namespace EQ
|
||||
connect_stale_ms = 5000;
|
||||
crc_length = 2;
|
||||
max_packet_size = 512;
|
||||
encode_passes[0] = DaybreakEncodeType::EncodeNone;
|
||||
encode_passes[1] = DaybreakEncodeType::EncodeNone;
|
||||
encode_passes[0] = ReliableStreamEncodeType::EncodeNone;
|
||||
encode_passes[1] = ReliableStreamEncodeType::EncodeNone;
|
||||
port = 0;
|
||||
hold_size = 512;
|
||||
hold_length_ms = 50;
|
||||
@ -299,28 +299,28 @@ namespace EQ
|
||||
double tic_rate_hertz;
|
||||
size_t resend_timeout;
|
||||
size_t connection_close_time;
|
||||
DaybreakEncodeType encode_passes[2];
|
||||
ReliableStreamEncodeType encode_passes[2];
|
||||
int port;
|
||||
double outgoing_data_rate;
|
||||
};
|
||||
|
||||
class DaybreakConnectionManager
|
||||
class ReliableStreamConnectionManager
|
||||
{
|
||||
public:
|
||||
DaybreakConnectionManager();
|
||||
DaybreakConnectionManager(const DaybreakConnectionManagerOptions &opts);
|
||||
~DaybreakConnectionManager();
|
||||
ReliableStreamConnectionManager();
|
||||
ReliableStreamConnectionManager(const ReliableStreamConnectionManagerOptions &opts);
|
||||
~ReliableStreamConnectionManager();
|
||||
|
||||
void Connect(const std::string &addr, int port);
|
||||
void Process();
|
||||
void UpdateDataBudget();
|
||||
void ProcessResend();
|
||||
void OnNewConnection(std::function<void(std::shared_ptr<DaybreakConnection>)> func) { m_on_new_connection = func; }
|
||||
void OnConnectionStateChange(std::function<void(std::shared_ptr<DaybreakConnection>, DbProtocolStatus, DbProtocolStatus)> func) { m_on_connection_state_change = func; }
|
||||
void OnPacketRecv(std::function<void(std::shared_ptr<DaybreakConnection>, const Packet &)> func) { m_on_packet_recv = func; }
|
||||
void OnNewConnection(std::function<void(std::shared_ptr<ReliableStreamConnection>)> func) { m_on_new_connection = func; }
|
||||
void OnConnectionStateChange(std::function<void(std::shared_ptr<ReliableStreamConnection>, DbProtocolStatus, DbProtocolStatus)> func) { m_on_connection_state_change = func; }
|
||||
void OnPacketRecv(std::function<void(std::shared_ptr<ReliableStreamConnection>, const Packet &)> func) { m_on_packet_recv = func; }
|
||||
void OnErrorMessage(std::function<void(const std::string&)> func) { m_on_error_message = func; }
|
||||
|
||||
DaybreakConnectionManagerOptions& GetOptions() { return m_options; }
|
||||
ReliableStreamConnectionManagerOptions& GetOptions() { return m_options; }
|
||||
private:
|
||||
void Attach(uv_loop_t *loop);
|
||||
void Detach();
|
||||
@ -329,18 +329,18 @@ namespace EQ
|
||||
uv_timer_t m_timer;
|
||||
uv_udp_t m_socket;
|
||||
uv_loop_t *m_attached;
|
||||
DaybreakConnectionManagerOptions m_options;
|
||||
std::function<void(std::shared_ptr<DaybreakConnection>)> m_on_new_connection;
|
||||
std::function<void(std::shared_ptr<DaybreakConnection>, DbProtocolStatus, DbProtocolStatus)> m_on_connection_state_change;
|
||||
std::function<void(std::shared_ptr<DaybreakConnection>, const Packet&)> m_on_packet_recv;
|
||||
ReliableStreamConnectionManagerOptions m_options;
|
||||
std::function<void(std::shared_ptr<ReliableStreamConnection>)> m_on_new_connection;
|
||||
std::function<void(std::shared_ptr<ReliableStreamConnection>, DbProtocolStatus, DbProtocolStatus)> m_on_connection_state_change;
|
||||
std::function<void(std::shared_ptr<ReliableStreamConnection>, const Packet&)> m_on_packet_recv;
|
||||
std::function<void(const std::string&)> m_on_error_message;
|
||||
std::map<std::pair<std::string, int>, std::shared_ptr<DaybreakConnection>> m_connections;
|
||||
std::map<std::pair<std::string, int>, std::shared_ptr<ReliableStreamConnection>> m_connections;
|
||||
|
||||
void ProcessPacket(const std::string &endpoint, int port, const char *data, size_t size);
|
||||
std::shared_ptr<DaybreakConnection> FindConnectionByEndpoint(std::string addr, int port);
|
||||
std::shared_ptr<ReliableStreamConnection> FindConnectionByEndpoint(std::string addr, int port);
|
||||
void SendDisconnect(const std::string &addr, int port);
|
||||
|
||||
friend class DaybreakConnection;
|
||||
friend class ReliableStreamConnection;
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -8,7 +8,7 @@ namespace EQ
|
||||
{
|
||||
namespace Net
|
||||
{
|
||||
struct DaybreakHeader
|
||||
struct ReliableStreamHeader
|
||||
{
|
||||
static size_t size() { return 2; }
|
||||
uint8_t zero;
|
||||
@ -22,7 +22,7 @@ namespace EQ
|
||||
}
|
||||
};
|
||||
|
||||
struct DaybreakConnect
|
||||
struct ReliableStreamConnect
|
||||
{
|
||||
static size_t size() { return 14; }
|
||||
uint8_t zero;
|
||||
@ -42,7 +42,7 @@ namespace EQ
|
||||
}
|
||||
};
|
||||
|
||||
struct DaybreakConnectReply
|
||||
struct ReliableStreamConnectReply
|
||||
{
|
||||
static size_t size() { return 17; }
|
||||
uint8_t zero;
|
||||
@ -68,7 +68,7 @@ namespace EQ
|
||||
}
|
||||
};
|
||||
|
||||
struct DaybreakDisconnect
|
||||
struct ReliableStreamDisconnect
|
||||
{
|
||||
static size_t size() { return 8; }
|
||||
uint8_t zero;
|
||||
@ -84,7 +84,7 @@ namespace EQ
|
||||
}
|
||||
};
|
||||
|
||||
struct DaybreakReliableHeader
|
||||
struct ReliableStreamReliableHeader
|
||||
{
|
||||
static size_t size() { return 4; }
|
||||
uint8_t zero;
|
||||
@ -100,10 +100,10 @@ namespace EQ
|
||||
}
|
||||
};
|
||||
|
||||
struct DaybreakReliableFragmentHeader
|
||||
struct ReliableStreamReliableFragmentHeader
|
||||
{
|
||||
static size_t size() { return 4 + DaybreakReliableHeader::size(); }
|
||||
DaybreakReliableHeader reliable;
|
||||
static size_t size() { return 4 + ReliableStreamReliableHeader::size(); }
|
||||
ReliableStreamReliableHeader reliable;
|
||||
uint32_t total_size;
|
||||
|
||||
template <class Archive>
|
||||
@ -114,7 +114,7 @@ namespace EQ
|
||||
}
|
||||
};
|
||||
|
||||
struct DaybreakSessionStatRequest
|
||||
struct ReliableStreamSessionStatRequest
|
||||
{
|
||||
static size_t size() { return 40; }
|
||||
uint8_t zero;
|
||||
@ -144,7 +144,7 @@ namespace EQ
|
||||
}
|
||||
};
|
||||
|
||||
struct DaybreakSessionStatResponse
|
||||
struct ReliableStreamSessionStatResponse
|
||||
{
|
||||
static size_t size() { return 40; }
|
||||
uint8_t zero;
|
||||
@ -2,6 +2,7 @@
|
||||
#include "../event/event_loop.h"
|
||||
#include "../event/timer.h"
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/ranges.h>
|
||||
#include <map>
|
||||
#include <unordered_set>
|
||||
#include <array>
|
||||
|
||||
@ -4,6 +4,7 @@
|
||||
#include "../util/uuid.h"
|
||||
#include <sstream>
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
struct EQ::Net::WebsocketServerConnection::Impl {
|
||||
WebsocketServer *parent;
|
||||
|
||||
@ -6481,7 +6481,7 @@ namespace RoF2
|
||||
hdr.scaled_value = (inst->IsScaling() ? (inst->GetExp() / 100) : 0);
|
||||
hdr.instance_id = (inst->GetMerchantSlot() ? inst->GetMerchantSlot() : inst->GetSerialNumber());
|
||||
hdr.parcel_item_id = packet_type == ItemPacketParcel ? inst->GetID() : 0;
|
||||
if (item->EvolvingItem) {
|
||||
if (item->EvolvingItem && packet_type != ItemPacketParcel && packet_type != ItemPacketMerchant) {
|
||||
hdr.instance_id = inst->GetEvolveUniqueID() & 0xFFFFFFFF; //lower dword
|
||||
hdr.parcel_item_id = inst->GetEvolveUniqueID() >> 32; //upper dword
|
||||
}
|
||||
@ -6500,6 +6500,7 @@ namespace RoF2
|
||||
|
||||
if (item->EvolvingItem > 0) {
|
||||
RoF2::structs::EvolvingItem_Struct evotop;
|
||||
inst->CalculateEvolveProgression();
|
||||
|
||||
evotop.final_item_id = inst->GetEvolveFinalItemID();
|
||||
evotop.evolve_level = item->EvolvingLevel;
|
||||
|
||||
@ -1059,7 +1059,7 @@ namespace Titanium
|
||||
OUT(spawnid);
|
||||
OUT_str(charname);
|
||||
|
||||
if (emu->race > 473)
|
||||
if (emu->race > 474)
|
||||
eq->race = 1;
|
||||
else
|
||||
OUT(race);
|
||||
@ -1840,7 +1840,7 @@ namespace Titanium
|
||||
emu_cse = (CharacterSelectEntry_Struct *)emu_ptr;
|
||||
|
||||
eq->Race[char_index] = emu_cse->Race;
|
||||
if (eq->Race[char_index] > 473)
|
||||
if (eq->Race[char_index] > 474)
|
||||
eq->Race[char_index] = 1;
|
||||
|
||||
for (int index = 0; index < EQ::textures::materialCount; ++index) {
|
||||
@ -2421,7 +2421,7 @@ namespace Titanium
|
||||
strcpy(eq->title, emu->title);
|
||||
// eq->unknown0274 = emu->unknown0274;
|
||||
eq->helm = emu->helm;
|
||||
if (emu->race > 473)
|
||||
if (emu->race > 474)
|
||||
eq->race = 1;
|
||||
else
|
||||
eq->race = emu->race;
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
#include "../raid.h"
|
||||
#include "../guilds.h"
|
||||
//#include "../repositories/trader_repository.h"
|
||||
#include "../cereal/include/cereal/types/vector.hpp"
|
||||
#include <cereal/types/vector.hpp>
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
#include <memory>
|
||||
#include "process.h"
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
std::string Process::execute(const std::string &cmd)
|
||||
{
|
||||
|
||||
@ -23,7 +23,7 @@
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <fmt/format.h>
|
||||
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
class DBcore;
|
||||
|
||||
|
||||
3779
common/races.cpp
3779
common/races.cpp
File diff suppressed because it is too large
Load Diff
202
common/races.h
202
common/races.h
@ -21,103 +21,7 @@
|
||||
#include "../common/types.h"
|
||||
#include <string>
|
||||
|
||||
namespace Gender {
|
||||
constexpr uint8 Male = 0;
|
||||
constexpr uint8 Female = 1;
|
||||
constexpr uint8 Neuter = 2;
|
||||
}
|
||||
|
||||
//theres a big list straight from the client below.
|
||||
|
||||
#define HUMAN 1
|
||||
#define BARBARIAN 2
|
||||
#define ERUDITE 3
|
||||
#define WOOD_ELF 4
|
||||
#define HIGH_ELF 5
|
||||
#define DARK_ELF 6
|
||||
#define HALF_ELF 7
|
||||
#define DWARF 8
|
||||
#define TROLL 9
|
||||
#define OGRE 10
|
||||
#define HALFLING 11
|
||||
#define GNOME 12
|
||||
#define WEREWOLF 14
|
||||
#define WOLF 42
|
||||
#define BEAR 43
|
||||
#define SKELETON 60
|
||||
#define TIGER 63
|
||||
#define ELEMENTAL 75
|
||||
#define ALLIGATOR 91
|
||||
#define OGGOK_CITIZEN 93
|
||||
#define EYE_OF_ZOMM 108
|
||||
#define WOLF_ELEMENTAL 120
|
||||
#define INVISIBLE_MAN 127
|
||||
#define IKSAR 128
|
||||
#define VAHSHIR 130
|
||||
#define CONTROLLED_BOAT 141
|
||||
#define MINOR_ILL_OBJ 142
|
||||
#define TREE 143
|
||||
#define IKSAR_SKELETON 161
|
||||
#define FROGLOK 330
|
||||
// TODO: check all clients for (BYTE) usage of '/who all' class and remove FROGLOK2, if possible (330 - 74 = 256 .. WORD->BYTE conversion loss...)
|
||||
#define FROGLOK2 74 // Not sure why /who all reports race as 74 for frogloks
|
||||
#define FAIRY 473
|
||||
#define DRAKKIN 522 // 32768
|
||||
#define EMU_RACE_NPC 131069 // was 65533
|
||||
#define EMU_RACE_PET 131070 // was 65534
|
||||
#define EMU_RACE_UNKNOWN 131071 // was 65535
|
||||
|
||||
|
||||
// player race values
|
||||
#define PLAYER_RACE_UNKNOWN 0
|
||||
#define PLAYER_RACE_HUMAN 1
|
||||
#define PLAYER_RACE_BARBARIAN 2
|
||||
#define PLAYER_RACE_ERUDITE 3
|
||||
#define PLAYER_RACE_WOOD_ELF 4
|
||||
#define PLAYER_RACE_HIGH_ELF 5
|
||||
#define PLAYER_RACE_DARK_ELF 6
|
||||
#define PLAYER_RACE_HALF_ELF 7
|
||||
#define PLAYER_RACE_DWARF 8
|
||||
#define PLAYER_RACE_TROLL 9
|
||||
#define PLAYER_RACE_OGRE 10
|
||||
#define PLAYER_RACE_HALFLING 11
|
||||
#define PLAYER_RACE_GNOME 12
|
||||
#define PLAYER_RACE_IKSAR 13
|
||||
#define PLAYER_RACE_VAHSHIR 14
|
||||
#define PLAYER_RACE_FROGLOK 15
|
||||
#define PLAYER_RACE_DRAKKIN 16
|
||||
|
||||
#define PLAYER_RACE_COUNT 16
|
||||
|
||||
|
||||
#define PLAYER_RACE_EMU_NPC 17
|
||||
#define PLAYER_RACE_EMU_PET 18
|
||||
#define PLAYER_RACE_EMU_COUNT 19
|
||||
|
||||
|
||||
// player race bits
|
||||
#define PLAYER_RACE_UNKNOWN_BIT 0
|
||||
#define PLAYER_RACE_HUMAN_BIT 1
|
||||
#define PLAYER_RACE_BARBARIAN_BIT 2
|
||||
#define PLAYER_RACE_ERUDITE_BIT 4
|
||||
#define PLAYER_RACE_WOOD_ELF_BIT 8
|
||||
#define PLAYER_RACE_HIGH_ELF_BIT 16
|
||||
#define PLAYER_RACE_DARK_ELF_BIT 32
|
||||
#define PLAYER_RACE_HALF_ELF_BIT 64
|
||||
#define PLAYER_RACE_DWARF_BIT 128
|
||||
#define PLAYER_RACE_TROLL_BIT 256
|
||||
#define PLAYER_RACE_OGRE_BIT 512
|
||||
#define PLAYER_RACE_HALFLING_BIT 1024
|
||||
#define PLAYER_RACE_GNOME_BIT 2048
|
||||
#define PLAYER_RACE_IKSAR_BIT 4096
|
||||
#define PLAYER_RACE_VAHSHIR_BIT 8192
|
||||
#define PLAYER_RACE_FROGLOK_BIT 16384
|
||||
#define PLAYER_RACE_DRAKKIN_BIT 32768
|
||||
|
||||
#define PLAYER_RACE_ALL_MASK 65535
|
||||
|
||||
const char* GetRaceIDName(uint16 race_id);
|
||||
const char* GetPlayerRaceName(uint32 player_race_value);
|
||||
const char* GetGenderName(uint32 gender_id);
|
||||
|
||||
bool IsPlayerRace(uint16 race_id);
|
||||
@ -127,25 +31,13 @@ uint32 GetPlayerRaceValue(uint16 race_id);
|
||||
uint16 GetPlayerRaceBit(uint16 race_id);
|
||||
|
||||
uint16 GetRaceIDFromPlayerRaceValue(uint32 player_race_value);
|
||||
uint16 GetRaceIDFromPlayerRaceBit(uint32 player_race_bit);
|
||||
|
||||
float GetRaceGenderDefaultHeight(int race, int gender);
|
||||
|
||||
// player race-/gender-based model feature validators
|
||||
namespace PlayerAppearance
|
||||
{
|
||||
bool IsValidBeard(uint16 race_id, uint8 gender_id, uint8 beard_value, bool use_luclin = true);
|
||||
bool IsValidBeardColor(uint16 race_id, uint8 gender_id, uint8 beard_color_value, bool use_luclin = true);
|
||||
bool IsValidDetail(uint16 race_id, uint8 gender_id, uint32 detail_value, bool use_luclin = true);
|
||||
bool IsValidEyeColor(uint16 race_id, uint8 gender_id, uint8 eye_color_value, bool use_luclin = true);
|
||||
bool IsValidFace(uint16 race_id, uint8 gender_id, uint8 face_value, bool use_luclin = true);
|
||||
bool IsValidHair(uint16 race_id, uint8 gender_id, uint8 hair_value, bool use_luclin = true);
|
||||
bool IsValidHairColor(uint16 race_id, uint8 gender_id, uint8 hair_color_value, bool use_luclin = true);
|
||||
bool IsValidHead(uint16 race_id, uint8 gender_id, uint8 head_value, bool use_luclin = true);
|
||||
bool IsValidHeritage(uint16 race_id, uint8 gender_id, uint32 heritage_value, bool use_luclin = true);
|
||||
bool IsValidTattoo(uint16 race_id, uint8 gender_id, uint32 tattoo_value, bool use_luclin = true);
|
||||
bool IsValidTexture(uint16 race_id, uint8 gender_id, uint8 texture_value, bool use_luclin = true);
|
||||
bool IsValidWoad(uint16 race_id, uint8 gender_id, uint8 woad_value, bool use_luclin = true);
|
||||
namespace Gender {
|
||||
constexpr uint8 Male = 0;
|
||||
constexpr uint8 Female = 1;
|
||||
constexpr uint8 Neuter = 2;
|
||||
}
|
||||
|
||||
namespace Race {
|
||||
@ -884,8 +776,92 @@ namespace Race {
|
||||
constexpr uint16 Pegasus3 = 732;
|
||||
constexpr uint16 InteractiveObject = 2250;
|
||||
constexpr uint16 Node = 2254;
|
||||
}
|
||||
|
||||
constexpr uint16 ALL_RACES_BITMASK = 65535;
|
||||
namespace RaceBitmask {
|
||||
constexpr uint16 Unknown = 0;
|
||||
constexpr uint16 Human = 1;
|
||||
constexpr uint16 Barbarian = 2;
|
||||
constexpr uint16 Erudite = 4;
|
||||
constexpr uint16 WoodElf = 8;
|
||||
constexpr uint16 HighElf = 16;
|
||||
constexpr uint16 DarkElf = 32;
|
||||
constexpr uint16 HalfElf = 64;
|
||||
constexpr uint16 Dwarf = 128;
|
||||
constexpr uint16 Troll = 256;
|
||||
constexpr uint16 Ogre = 512;
|
||||
constexpr uint16 Halfling = 1024;
|
||||
constexpr uint16 Gnome = 2048;
|
||||
constexpr uint16 Iksar = 4096;
|
||||
constexpr uint16 VahShir = 8192;
|
||||
constexpr uint16 Froglok = 16384;
|
||||
constexpr uint16 Drakkin = 32768;
|
||||
constexpr uint16 All = 65535;
|
||||
}
|
||||
|
||||
namespace RaceIndex {
|
||||
constexpr uint16 Human = 1;
|
||||
constexpr uint16 Barbarian = 2;
|
||||
constexpr uint16 Erudite = 3;
|
||||
constexpr uint16 WoodElf = 4;
|
||||
constexpr uint16 HighElf = 5;
|
||||
constexpr uint16 DarkElf = 6;
|
||||
constexpr uint16 HalfElf = 7;
|
||||
constexpr uint16 Dwarf = 8;
|
||||
constexpr uint16 Troll = 9;
|
||||
constexpr uint16 Ogre = 10;
|
||||
constexpr uint16 Halfling = 11;
|
||||
constexpr uint16 Gnome = 12;
|
||||
constexpr uint16 Iksar = 13;
|
||||
constexpr uint16 VahShir = 14;
|
||||
constexpr uint16 Froglok = 15;
|
||||
constexpr uint16 Drakkin = 16;
|
||||
}
|
||||
|
||||
namespace RaceAppearance {
|
||||
bool IsValidBeard(uint16 race_id, uint8 gender_id, uint8 beard_value, bool use_luclin = true);
|
||||
bool IsValidBeardColor(uint16 race_id, uint8 gender_id, uint8 beard_color_value, bool use_luclin = true);
|
||||
bool IsValidDetail(uint16 race_id, uint8 gender_id, uint32 detail_value, bool use_luclin = true);
|
||||
bool IsValidEyeColor(uint16 race_id, uint8 gender_id, uint8 eye_color_value, bool use_luclin = true);
|
||||
bool IsValidFace(uint16 race_id, uint8 gender_id, uint8 face_value, bool use_luclin = true);
|
||||
bool IsValidHair(uint16 race_id, uint8 gender_id, uint8 hair_value, bool use_luclin = true);
|
||||
bool IsValidHairColor(uint16 race_id, uint8 gender_id, uint8 hair_color_value, bool use_luclin = true);
|
||||
bool IsValidHeritage(uint16 race_id, uint8 gender_id, uint32 heritage_value, bool use_luclin = true);
|
||||
bool IsValidTattoo(uint16 race_id, uint8 gender_id, uint32 tattoo_value, bool use_luclin = true);
|
||||
bool IsValidWoad(uint16 race_id, uint8 gender_id, uint8 woad_value, bool use_luclin = true);
|
||||
|
||||
constexpr int HumanMale = (Race::Human << 8) | Gender::Male;
|
||||
constexpr int HumanFemale = (Race::Human << 8) | Gender::Female;
|
||||
constexpr int BarbarianMale = (Race::Barbarian << 8) | Gender::Male;
|
||||
constexpr int BarbarianFemale = (Race::Barbarian << 8) | Gender::Female;
|
||||
constexpr int EruditeMale = (Race::Erudite << 8) | Gender::Male;
|
||||
constexpr int EruditeFemale = (Race::Erudite << 8) | Gender::Female;
|
||||
constexpr int WoodElfMale = (Race::WoodElf << 8) | Gender::Male;
|
||||
constexpr int WoodElfFemale = (Race::WoodElf << 8) | Gender::Female;
|
||||
constexpr int HighElfMale = (Race::HighElf << 8) | Gender::Male;
|
||||
constexpr int HighElfFemale = (Race::HighElf << 8) | Gender::Female;
|
||||
constexpr int DarkElfMale = (Race::DarkElf << 8) | Gender::Male;
|
||||
constexpr int DarkElfFemale = (Race::DarkElf << 8) | Gender::Female;
|
||||
constexpr int HalfElfMale = (Race::HalfElf << 8) | Gender::Male;
|
||||
constexpr int HalfElfFemale = (Race::HalfElf << 8) | Gender::Female;
|
||||
constexpr int DwarfMale = (Race::Dwarf << 8) | Gender::Male;
|
||||
constexpr int DwarfFemale = (Race::Dwarf << 8) | Gender::Female;
|
||||
constexpr int TrollMale = (Race::Troll << 8) | Gender::Male;
|
||||
constexpr int TrollFemale = (Race::Troll << 8) | Gender::Female;
|
||||
constexpr int OgreMale = (Race::Ogre << 8) | Gender::Male;
|
||||
constexpr int OgreFemale = (Race::Ogre << 8) | Gender::Female;
|
||||
constexpr int HalflingMale = (Race::Halfling << 8) | Gender::Male;
|
||||
constexpr int HalflingFemale = (Race::Halfling << 8) | Gender::Female;
|
||||
constexpr int GnomeMale = (Race::Gnome << 8) | Gender::Male;
|
||||
constexpr int GnomeFemale = (Race::Gnome << 8) | Gender::Female;
|
||||
constexpr int IksarMale = (Race::Iksar << 8) | Gender::Male;
|
||||
constexpr int IksarFemale = (Race::Iksar << 8) | Gender::Female;
|
||||
constexpr int VahShirMale = (Race::VahShir << 8) | Gender::Male;
|
||||
constexpr int VahShirFemale = (Race::VahShir << 8) | Gender::Female;
|
||||
constexpr int FroglokMale = (Race::Froglok2 << 8) | Gender::Male;
|
||||
constexpr int FroglokFemale = (Race::Froglok2 << 8) | Gender::Female;
|
||||
constexpr int DrakkinMale = (Race::Drakkin << 8) | Gender::Male;
|
||||
constexpr int DrakkinFemale = (Race::Drakkin << 8) | Gender::Female;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -30,6 +30,7 @@ public:
|
||||
uint32_t aug_slot_5;
|
||||
uint32_t aug_slot_6;
|
||||
uint32_t quantity;
|
||||
uint32_t evolve_amount;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
@ -51,6 +52,7 @@ public:
|
||||
"aug_slot_5",
|
||||
"aug_slot_6",
|
||||
"quantity",
|
||||
"evolve_amount",
|
||||
};
|
||||
}
|
||||
|
||||
@ -68,6 +70,7 @@ public:
|
||||
"aug_slot_5",
|
||||
"aug_slot_6",
|
||||
"quantity",
|
||||
"evolve_amount",
|
||||
};
|
||||
}
|
||||
|
||||
@ -108,17 +111,18 @@ public:
|
||||
{
|
||||
CharacterParcelsContainers e{};
|
||||
|
||||
e.id = 0;
|
||||
e.parcels_id = 0;
|
||||
e.slot_id = 0;
|
||||
e.item_id = 0;
|
||||
e.aug_slot_1 = 0;
|
||||
e.aug_slot_2 = 0;
|
||||
e.aug_slot_3 = 0;
|
||||
e.aug_slot_4 = 0;
|
||||
e.aug_slot_5 = 0;
|
||||
e.aug_slot_6 = 0;
|
||||
e.quantity = 0;
|
||||
e.id = 0;
|
||||
e.parcels_id = 0;
|
||||
e.slot_id = 0;
|
||||
e.item_id = 0;
|
||||
e.aug_slot_1 = 0;
|
||||
e.aug_slot_2 = 0;
|
||||
e.aug_slot_3 = 0;
|
||||
e.aug_slot_4 = 0;
|
||||
e.aug_slot_5 = 0;
|
||||
e.aug_slot_6 = 0;
|
||||
e.quantity = 0;
|
||||
e.evolve_amount = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@ -155,17 +159,18 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterParcelsContainers e{};
|
||||
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.parcels_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.slot_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.item_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.aug_slot_1 = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.aug_slot_2 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.aug_slot_3 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.aug_slot_4 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.aug_slot_5 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.aug_slot_6 = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.parcels_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.slot_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.item_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.aug_slot_1 = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.aug_slot_2 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.aug_slot_3 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.aug_slot_4 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.aug_slot_5 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.aug_slot_6 = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.evolve_amount = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@ -209,6 +214,7 @@ public:
|
||||
v.push_back(columns[8] + " = " + std::to_string(e.aug_slot_5));
|
||||
v.push_back(columns[9] + " = " + std::to_string(e.aug_slot_6));
|
||||
v.push_back(columns[10] + " = " + std::to_string(e.quantity));
|
||||
v.push_back(columns[11] + " = " + std::to_string(e.evolve_amount));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@ -241,6 +247,7 @@ public:
|
||||
v.push_back(std::to_string(e.aug_slot_5));
|
||||
v.push_back(std::to_string(e.aug_slot_6));
|
||||
v.push_back(std::to_string(e.quantity));
|
||||
v.push_back(std::to_string(e.evolve_amount));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@ -281,6 +288,7 @@ public:
|
||||
v.push_back(std::to_string(e.aug_slot_5));
|
||||
v.push_back(std::to_string(e.aug_slot_6));
|
||||
v.push_back(std::to_string(e.quantity));
|
||||
v.push_back(std::to_string(e.evolve_amount));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
@ -314,17 +322,18 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterParcelsContainers e{};
|
||||
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.parcels_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.slot_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.item_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.aug_slot_1 = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.aug_slot_2 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.aug_slot_3 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.aug_slot_4 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.aug_slot_5 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.aug_slot_6 = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.parcels_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.slot_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.item_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.aug_slot_1 = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.aug_slot_2 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.aug_slot_3 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.aug_slot_4 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.aug_slot_5 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.aug_slot_6 = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.evolve_amount = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@ -349,17 +358,18 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterParcelsContainers e{};
|
||||
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.parcels_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.slot_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.item_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.aug_slot_1 = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.aug_slot_2 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.aug_slot_3 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.aug_slot_4 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.aug_slot_5 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.aug_slot_6 = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.parcels_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.slot_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.item_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.aug_slot_1 = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.aug_slot_2 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.aug_slot_3 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.aug_slot_4 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.aug_slot_5 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.aug_slot_6 = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.evolve_amount = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@ -445,6 +455,7 @@ public:
|
||||
v.push_back(std::to_string(e.aug_slot_5));
|
||||
v.push_back(std::to_string(e.aug_slot_6));
|
||||
v.push_back(std::to_string(e.quantity));
|
||||
v.push_back(std::to_string(e.evolve_amount));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@ -478,6 +489,7 @@ public:
|
||||
v.push_back(std::to_string(e.aug_slot_5));
|
||||
v.push_back(std::to_string(e.aug_slot_6));
|
||||
v.push_back(std::to_string(e.quantity));
|
||||
v.push_back(std::to_string(e.evolve_amount));
|
||||
|
||||
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
|
||||
}
|
||||
|
||||
@ -30,6 +30,7 @@ public:
|
||||
uint32_t aug_slot_6;
|
||||
uint32_t slot_id;
|
||||
uint32_t quantity;
|
||||
uint32_t evolve_amount;
|
||||
std::string from_name;
|
||||
std::string note;
|
||||
time_t sent_date;
|
||||
@ -54,6 +55,7 @@ public:
|
||||
"aug_slot_6",
|
||||
"slot_id",
|
||||
"quantity",
|
||||
"evolve_amount",
|
||||
"from_name",
|
||||
"note",
|
||||
"sent_date",
|
||||
@ -74,6 +76,7 @@ public:
|
||||
"aug_slot_6",
|
||||
"slot_id",
|
||||
"quantity",
|
||||
"evolve_amount",
|
||||
"from_name",
|
||||
"note",
|
||||
"UNIX_TIMESTAMP(sent_date)",
|
||||
@ -117,20 +120,21 @@ public:
|
||||
{
|
||||
CharacterParcels e{};
|
||||
|
||||
e.id = 0;
|
||||
e.char_id = 0;
|
||||
e.item_id = 0;
|
||||
e.aug_slot_1 = 0;
|
||||
e.aug_slot_2 = 0;
|
||||
e.aug_slot_3 = 0;
|
||||
e.aug_slot_4 = 0;
|
||||
e.aug_slot_5 = 0;
|
||||
e.aug_slot_6 = 0;
|
||||
e.slot_id = 0;
|
||||
e.quantity = 0;
|
||||
e.from_name = "";
|
||||
e.note = "";
|
||||
e.sent_date = 0;
|
||||
e.id = 0;
|
||||
e.char_id = 0;
|
||||
e.item_id = 0;
|
||||
e.aug_slot_1 = 0;
|
||||
e.aug_slot_2 = 0;
|
||||
e.aug_slot_3 = 0;
|
||||
e.aug_slot_4 = 0;
|
||||
e.aug_slot_5 = 0;
|
||||
e.aug_slot_6 = 0;
|
||||
e.slot_id = 0;
|
||||
e.quantity = 0;
|
||||
e.evolve_amount = 0;
|
||||
e.from_name = "";
|
||||
e.note = "";
|
||||
e.sent_date = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
@ -167,20 +171,21 @@ public:
|
||||
if (results.RowCount() == 1) {
|
||||
CharacterParcels e{};
|
||||
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.char_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.item_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.aug_slot_1 = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.aug_slot_2 = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.aug_slot_3 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.aug_slot_4 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.aug_slot_5 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.aug_slot_6 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.slot_id = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.from_name = row[11] ? row[11] : "";
|
||||
e.note = row[12] ? row[12] : "";
|
||||
e.sent_date = strtoll(row[13] ? row[13] : "-1", nullptr, 10);
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.char_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.item_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.aug_slot_1 = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.aug_slot_2 = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.aug_slot_3 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.aug_slot_4 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.aug_slot_5 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.aug_slot_6 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.slot_id = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.evolve_amount = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.from_name = row[12] ? row[12] : "";
|
||||
e.note = row[13] ? row[13] : "";
|
||||
e.sent_date = strtoll(row[14] ? row[14] : "-1", nullptr, 10);
|
||||
|
||||
return e;
|
||||
}
|
||||
@ -224,9 +229,10 @@ public:
|
||||
v.push_back(columns[8] + " = " + std::to_string(e.aug_slot_6));
|
||||
v.push_back(columns[9] + " = " + std::to_string(e.slot_id));
|
||||
v.push_back(columns[10] + " = " + std::to_string(e.quantity));
|
||||
v.push_back(columns[11] + " = '" + Strings::Escape(e.from_name) + "'");
|
||||
v.push_back(columns[12] + " = '" + Strings::Escape(e.note) + "'");
|
||||
v.push_back(columns[13] + " = FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")");
|
||||
v.push_back(columns[11] + " = " + std::to_string(e.evolve_amount));
|
||||
v.push_back(columns[12] + " = '" + Strings::Escape(e.from_name) + "'");
|
||||
v.push_back(columns[13] + " = '" + Strings::Escape(e.note) + "'");
|
||||
v.push_back(columns[14] + " = FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@ -259,6 +265,7 @@ public:
|
||||
v.push_back(std::to_string(e.aug_slot_6));
|
||||
v.push_back(std::to_string(e.slot_id));
|
||||
v.push_back(std::to_string(e.quantity));
|
||||
v.push_back(std::to_string(e.evolve_amount));
|
||||
v.push_back("'" + Strings::Escape(e.from_name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.note) + "'");
|
||||
v.push_back("FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")");
|
||||
@ -302,6 +309,7 @@ public:
|
||||
v.push_back(std::to_string(e.aug_slot_6));
|
||||
v.push_back(std::to_string(e.slot_id));
|
||||
v.push_back(std::to_string(e.quantity));
|
||||
v.push_back(std::to_string(e.evolve_amount));
|
||||
v.push_back("'" + Strings::Escape(e.from_name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.note) + "'");
|
||||
v.push_back("FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")");
|
||||
@ -338,20 +346,21 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterParcels e{};
|
||||
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.char_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.item_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.aug_slot_1 = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.aug_slot_2 = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.aug_slot_3 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.aug_slot_4 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.aug_slot_5 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.aug_slot_6 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.slot_id = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.from_name = row[11] ? row[11] : "";
|
||||
e.note = row[12] ? row[12] : "";
|
||||
e.sent_date = strtoll(row[13] ? row[13] : "-1", nullptr, 10);
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.char_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.item_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.aug_slot_1 = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.aug_slot_2 = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.aug_slot_3 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.aug_slot_4 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.aug_slot_5 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.aug_slot_6 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.slot_id = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.evolve_amount = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.from_name = row[12] ? row[12] : "";
|
||||
e.note = row[13] ? row[13] : "";
|
||||
e.sent_date = strtoll(row[14] ? row[14] : "-1", nullptr, 10);
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@ -376,20 +385,21 @@ public:
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
CharacterParcels e{};
|
||||
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.char_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.item_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.aug_slot_1 = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.aug_slot_2 = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.aug_slot_3 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.aug_slot_4 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.aug_slot_5 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.aug_slot_6 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.slot_id = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.from_name = row[11] ? row[11] : "";
|
||||
e.note = row[12] ? row[12] : "";
|
||||
e.sent_date = strtoll(row[13] ? row[13] : "-1", nullptr, 10);
|
||||
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
|
||||
e.char_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
|
||||
e.item_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
|
||||
e.aug_slot_1 = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
|
||||
e.aug_slot_2 = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
|
||||
e.aug_slot_3 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
|
||||
e.aug_slot_4 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
|
||||
e.aug_slot_5 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
|
||||
e.aug_slot_6 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
|
||||
e.slot_id = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
|
||||
e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
|
||||
e.evolve_amount = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
|
||||
e.from_name = row[12] ? row[12] : "";
|
||||
e.note = row[13] ? row[13] : "";
|
||||
e.sent_date = strtoll(row[14] ? row[14] : "-1", nullptr, 10);
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@ -475,6 +485,7 @@ public:
|
||||
v.push_back(std::to_string(e.aug_slot_6));
|
||||
v.push_back(std::to_string(e.slot_id));
|
||||
v.push_back(std::to_string(e.quantity));
|
||||
v.push_back(std::to_string(e.evolve_amount));
|
||||
v.push_back("'" + Strings::Escape(e.from_name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.note) + "'");
|
||||
v.push_back("FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")");
|
||||
@ -511,6 +522,7 @@ public:
|
||||
v.push_back(std::to_string(e.aug_slot_6));
|
||||
v.push_back(std::to_string(e.slot_id));
|
||||
v.push_back(std::to_string(e.quantity));
|
||||
v.push_back(std::to_string(e.evolve_amount));
|
||||
v.push_back("'" + Strings::Escape(e.from_name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.note) + "'");
|
||||
v.push_back("FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")");
|
||||
|
||||
@ -70,6 +70,7 @@ public:
|
||||
int32_t endurance_regen;
|
||||
int32_t shielding;
|
||||
int32_t spell_damage;
|
||||
int32_t heal_amount;
|
||||
int32_t spell_shielding;
|
||||
int32_t strikethrough;
|
||||
int32_t stun_resist;
|
||||
@ -154,6 +155,7 @@ public:
|
||||
"endurance_regen",
|
||||
"shielding",
|
||||
"spell_damage",
|
||||
"heal_amount",
|
||||
"spell_shielding",
|
||||
"strikethrough",
|
||||
"stun_resist",
|
||||
@ -234,6 +236,7 @@ public:
|
||||
"endurance_regen",
|
||||
"shielding",
|
||||
"spell_damage",
|
||||
"heal_amount",
|
||||
"spell_shielding",
|
||||
"strikethrough",
|
||||
"stun_resist",
|
||||
@ -348,6 +351,7 @@ public:
|
||||
e.endurance_regen = 0;
|
||||
e.shielding = 0;
|
||||
e.spell_damage = 0;
|
||||
e.heal_amount = 0;
|
||||
e.spell_shielding = 0;
|
||||
e.strikethrough = 0;
|
||||
e.stun_resist = 0;
|
||||
@ -458,29 +462,30 @@ public:
|
||||
e.endurance_regen = row[48] ? static_cast<int32_t>(atoi(row[48])) : 0;
|
||||
e.shielding = row[49] ? static_cast<int32_t>(atoi(row[49])) : 0;
|
||||
e.spell_damage = row[50] ? static_cast<int32_t>(atoi(row[50])) : 0;
|
||||
e.spell_shielding = row[51] ? static_cast<int32_t>(atoi(row[51])) : 0;
|
||||
e.strikethrough = row[52] ? static_cast<int32_t>(atoi(row[52])) : 0;
|
||||
e.stun_resist = row[53] ? static_cast<int32_t>(atoi(row[53])) : 0;
|
||||
e.backstab = row[54] ? static_cast<int32_t>(atoi(row[54])) : 0;
|
||||
e.wind = row[55] ? static_cast<int32_t>(atoi(row[55])) : 0;
|
||||
e.brass = row[56] ? static_cast<int32_t>(atoi(row[56])) : 0;
|
||||
e.string = row[57] ? static_cast<int32_t>(atoi(row[57])) : 0;
|
||||
e.percussion = row[58] ? static_cast<int32_t>(atoi(row[58])) : 0;
|
||||
e.singing = row[59] ? static_cast<int32_t>(atoi(row[59])) : 0;
|
||||
e.baking = row[60] ? static_cast<int32_t>(atoi(row[60])) : 0;
|
||||
e.alchemy = row[61] ? static_cast<int32_t>(atoi(row[61])) : 0;
|
||||
e.tailoring = row[62] ? static_cast<int32_t>(atoi(row[62])) : 0;
|
||||
e.blacksmithing = row[63] ? static_cast<int32_t>(atoi(row[63])) : 0;
|
||||
e.fletching = row[64] ? static_cast<int32_t>(atoi(row[64])) : 0;
|
||||
e.brewing = row[65] ? static_cast<int32_t>(atoi(row[65])) : 0;
|
||||
e.jewelry = row[66] ? static_cast<int32_t>(atoi(row[66])) : 0;
|
||||
e.pottery = row[67] ? static_cast<int32_t>(atoi(row[67])) : 0;
|
||||
e.research = row[68] ? static_cast<int32_t>(atoi(row[68])) : 0;
|
||||
e.alcohol = row[69] ? static_cast<int32_t>(atoi(row[69])) : 0;
|
||||
e.fishing = row[70] ? static_cast<int32_t>(atoi(row[70])) : 0;
|
||||
e.tinkering = row[71] ? static_cast<int32_t>(atoi(row[71])) : 0;
|
||||
e.created_at = strtoll(row[72] ? row[72] : "-1", nullptr, 10);
|
||||
e.updated_at = strtoll(row[73] ? row[73] : "-1", nullptr, 10);
|
||||
e.heal_amount = row[51] ? static_cast<int32_t>(atoi(row[51])) : 0;
|
||||
e.spell_shielding = row[52] ? static_cast<int32_t>(atoi(row[52])) : 0;
|
||||
e.strikethrough = row[53] ? static_cast<int32_t>(atoi(row[53])) : 0;
|
||||
e.stun_resist = row[54] ? static_cast<int32_t>(atoi(row[54])) : 0;
|
||||
e.backstab = row[55] ? static_cast<int32_t>(atoi(row[55])) : 0;
|
||||
e.wind = row[56] ? static_cast<int32_t>(atoi(row[56])) : 0;
|
||||
e.brass = row[57] ? static_cast<int32_t>(atoi(row[57])) : 0;
|
||||
e.string = row[58] ? static_cast<int32_t>(atoi(row[58])) : 0;
|
||||
e.percussion = row[59] ? static_cast<int32_t>(atoi(row[59])) : 0;
|
||||
e.singing = row[60] ? static_cast<int32_t>(atoi(row[60])) : 0;
|
||||
e.baking = row[61] ? static_cast<int32_t>(atoi(row[61])) : 0;
|
||||
e.alchemy = row[62] ? static_cast<int32_t>(atoi(row[62])) : 0;
|
||||
e.tailoring = row[63] ? static_cast<int32_t>(atoi(row[63])) : 0;
|
||||
e.blacksmithing = row[64] ? static_cast<int32_t>(atoi(row[64])) : 0;
|
||||
e.fletching = row[65] ? static_cast<int32_t>(atoi(row[65])) : 0;
|
||||
e.brewing = row[66] ? static_cast<int32_t>(atoi(row[66])) : 0;
|
||||
e.jewelry = row[67] ? static_cast<int32_t>(atoi(row[67])) : 0;
|
||||
e.pottery = row[68] ? static_cast<int32_t>(atoi(row[68])) : 0;
|
||||
e.research = row[69] ? static_cast<int32_t>(atoi(row[69])) : 0;
|
||||
e.alcohol = row[70] ? static_cast<int32_t>(atoi(row[70])) : 0;
|
||||
e.fishing = row[71] ? static_cast<int32_t>(atoi(row[71])) : 0;
|
||||
e.tinkering = row[72] ? static_cast<int32_t>(atoi(row[72])) : 0;
|
||||
e.created_at = strtoll(row[73] ? row[73] : "-1", nullptr, 10);
|
||||
e.updated_at = strtoll(row[74] ? row[74] : "-1", nullptr, 10);
|
||||
|
||||
return e;
|
||||
}
|
||||
@ -565,29 +570,30 @@ public:
|
||||
v.push_back(columns[48] + " = " + std::to_string(e.endurance_regen));
|
||||
v.push_back(columns[49] + " = " + std::to_string(e.shielding));
|
||||
v.push_back(columns[50] + " = " + std::to_string(e.spell_damage));
|
||||
v.push_back(columns[51] + " = " + std::to_string(e.spell_shielding));
|
||||
v.push_back(columns[52] + " = " + std::to_string(e.strikethrough));
|
||||
v.push_back(columns[53] + " = " + std::to_string(e.stun_resist));
|
||||
v.push_back(columns[54] + " = " + std::to_string(e.backstab));
|
||||
v.push_back(columns[55] + " = " + std::to_string(e.wind));
|
||||
v.push_back(columns[56] + " = " + std::to_string(e.brass));
|
||||
v.push_back(columns[57] + " = " + std::to_string(e.string));
|
||||
v.push_back(columns[58] + " = " + std::to_string(e.percussion));
|
||||
v.push_back(columns[59] + " = " + std::to_string(e.singing));
|
||||
v.push_back(columns[60] + " = " + std::to_string(e.baking));
|
||||
v.push_back(columns[61] + " = " + std::to_string(e.alchemy));
|
||||
v.push_back(columns[62] + " = " + std::to_string(e.tailoring));
|
||||
v.push_back(columns[63] + " = " + std::to_string(e.blacksmithing));
|
||||
v.push_back(columns[64] + " = " + std::to_string(e.fletching));
|
||||
v.push_back(columns[65] + " = " + std::to_string(e.brewing));
|
||||
v.push_back(columns[66] + " = " + std::to_string(e.jewelry));
|
||||
v.push_back(columns[67] + " = " + std::to_string(e.pottery));
|
||||
v.push_back(columns[68] + " = " + std::to_string(e.research));
|
||||
v.push_back(columns[69] + " = " + std::to_string(e.alcohol));
|
||||
v.push_back(columns[70] + " = " + std::to_string(e.fishing));
|
||||
v.push_back(columns[71] + " = " + std::to_string(e.tinkering));
|
||||
v.push_back(columns[72] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")");
|
||||
v.push_back(columns[73] + " = FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")");
|
||||
v.push_back(columns[51] + " = " + std::to_string(e.heal_amount));
|
||||
v.push_back(columns[52] + " = " + std::to_string(e.spell_shielding));
|
||||
v.push_back(columns[53] + " = " + std::to_string(e.strikethrough));
|
||||
v.push_back(columns[54] + " = " + std::to_string(e.stun_resist));
|
||||
v.push_back(columns[55] + " = " + std::to_string(e.backstab));
|
||||
v.push_back(columns[56] + " = " + std::to_string(e.wind));
|
||||
v.push_back(columns[57] + " = " + std::to_string(e.brass));
|
||||
v.push_back(columns[58] + " = " + std::to_string(e.string));
|
||||
v.push_back(columns[59] + " = " + std::to_string(e.percussion));
|
||||
v.push_back(columns[60] + " = " + std::to_string(e.singing));
|
||||
v.push_back(columns[61] + " = " + std::to_string(e.baking));
|
||||
v.push_back(columns[62] + " = " + std::to_string(e.alchemy));
|
||||
v.push_back(columns[63] + " = " + std::to_string(e.tailoring));
|
||||
v.push_back(columns[64] + " = " + std::to_string(e.blacksmithing));
|
||||
v.push_back(columns[65] + " = " + std::to_string(e.fletching));
|
||||
v.push_back(columns[66] + " = " + std::to_string(e.brewing));
|
||||
v.push_back(columns[67] + " = " + std::to_string(e.jewelry));
|
||||
v.push_back(columns[68] + " = " + std::to_string(e.pottery));
|
||||
v.push_back(columns[69] + " = " + std::to_string(e.research));
|
||||
v.push_back(columns[70] + " = " + std::to_string(e.alcohol));
|
||||
v.push_back(columns[71] + " = " + std::to_string(e.fishing));
|
||||
v.push_back(columns[72] + " = " + std::to_string(e.tinkering));
|
||||
v.push_back(columns[73] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")");
|
||||
v.push_back(columns[74] + " = FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
@ -660,6 +666,7 @@ public:
|
||||
v.push_back(std::to_string(e.endurance_regen));
|
||||
v.push_back(std::to_string(e.shielding));
|
||||
v.push_back(std::to_string(e.spell_damage));
|
||||
v.push_back(std::to_string(e.heal_amount));
|
||||
v.push_back(std::to_string(e.spell_shielding));
|
||||
v.push_back(std::to_string(e.strikethrough));
|
||||
v.push_back(std::to_string(e.stun_resist));
|
||||
@ -763,6 +770,7 @@ public:
|
||||
v.push_back(std::to_string(e.endurance_regen));
|
||||
v.push_back(std::to_string(e.shielding));
|
||||
v.push_back(std::to_string(e.spell_damage));
|
||||
v.push_back(std::to_string(e.heal_amount));
|
||||
v.push_back(std::to_string(e.spell_shielding));
|
||||
v.push_back(std::to_string(e.strikethrough));
|
||||
v.push_back(std::to_string(e.stun_resist));
|
||||
@ -870,29 +878,30 @@ public:
|
||||
e.endurance_regen = row[48] ? static_cast<int32_t>(atoi(row[48])) : 0;
|
||||
e.shielding = row[49] ? static_cast<int32_t>(atoi(row[49])) : 0;
|
||||
e.spell_damage = row[50] ? static_cast<int32_t>(atoi(row[50])) : 0;
|
||||
e.spell_shielding = row[51] ? static_cast<int32_t>(atoi(row[51])) : 0;
|
||||
e.strikethrough = row[52] ? static_cast<int32_t>(atoi(row[52])) : 0;
|
||||
e.stun_resist = row[53] ? static_cast<int32_t>(atoi(row[53])) : 0;
|
||||
e.backstab = row[54] ? static_cast<int32_t>(atoi(row[54])) : 0;
|
||||
e.wind = row[55] ? static_cast<int32_t>(atoi(row[55])) : 0;
|
||||
e.brass = row[56] ? static_cast<int32_t>(atoi(row[56])) : 0;
|
||||
e.string = row[57] ? static_cast<int32_t>(atoi(row[57])) : 0;
|
||||
e.percussion = row[58] ? static_cast<int32_t>(atoi(row[58])) : 0;
|
||||
e.singing = row[59] ? static_cast<int32_t>(atoi(row[59])) : 0;
|
||||
e.baking = row[60] ? static_cast<int32_t>(atoi(row[60])) : 0;
|
||||
e.alchemy = row[61] ? static_cast<int32_t>(atoi(row[61])) : 0;
|
||||
e.tailoring = row[62] ? static_cast<int32_t>(atoi(row[62])) : 0;
|
||||
e.blacksmithing = row[63] ? static_cast<int32_t>(atoi(row[63])) : 0;
|
||||
e.fletching = row[64] ? static_cast<int32_t>(atoi(row[64])) : 0;
|
||||
e.brewing = row[65] ? static_cast<int32_t>(atoi(row[65])) : 0;
|
||||
e.jewelry = row[66] ? static_cast<int32_t>(atoi(row[66])) : 0;
|
||||
e.pottery = row[67] ? static_cast<int32_t>(atoi(row[67])) : 0;
|
||||
e.research = row[68] ? static_cast<int32_t>(atoi(row[68])) : 0;
|
||||
e.alcohol = row[69] ? static_cast<int32_t>(atoi(row[69])) : 0;
|
||||
e.fishing = row[70] ? static_cast<int32_t>(atoi(row[70])) : 0;
|
||||
e.tinkering = row[71] ? static_cast<int32_t>(atoi(row[71])) : 0;
|
||||
e.created_at = strtoll(row[72] ? row[72] : "-1", nullptr, 10);
|
||||
e.updated_at = strtoll(row[73] ? row[73] : "-1", nullptr, 10);
|
||||
e.heal_amount = row[51] ? static_cast<int32_t>(atoi(row[51])) : 0;
|
||||
e.spell_shielding = row[52] ? static_cast<int32_t>(atoi(row[52])) : 0;
|
||||
e.strikethrough = row[53] ? static_cast<int32_t>(atoi(row[53])) : 0;
|
||||
e.stun_resist = row[54] ? static_cast<int32_t>(atoi(row[54])) : 0;
|
||||
e.backstab = row[55] ? static_cast<int32_t>(atoi(row[55])) : 0;
|
||||
e.wind = row[56] ? static_cast<int32_t>(atoi(row[56])) : 0;
|
||||
e.brass = row[57] ? static_cast<int32_t>(atoi(row[57])) : 0;
|
||||
e.string = row[58] ? static_cast<int32_t>(atoi(row[58])) : 0;
|
||||
e.percussion = row[59] ? static_cast<int32_t>(atoi(row[59])) : 0;
|
||||
e.singing = row[60] ? static_cast<int32_t>(atoi(row[60])) : 0;
|
||||
e.baking = row[61] ? static_cast<int32_t>(atoi(row[61])) : 0;
|
||||
e.alchemy = row[62] ? static_cast<int32_t>(atoi(row[62])) : 0;
|
||||
e.tailoring = row[63] ? static_cast<int32_t>(atoi(row[63])) : 0;
|
||||
e.blacksmithing = row[64] ? static_cast<int32_t>(atoi(row[64])) : 0;
|
||||
e.fletching = row[65] ? static_cast<int32_t>(atoi(row[65])) : 0;
|
||||
e.brewing = row[66] ? static_cast<int32_t>(atoi(row[66])) : 0;
|
||||
e.jewelry = row[67] ? static_cast<int32_t>(atoi(row[67])) : 0;
|
||||
e.pottery = row[68] ? static_cast<int32_t>(atoi(row[68])) : 0;
|
||||
e.research = row[69] ? static_cast<int32_t>(atoi(row[69])) : 0;
|
||||
e.alcohol = row[70] ? static_cast<int32_t>(atoi(row[70])) : 0;
|
||||
e.fishing = row[71] ? static_cast<int32_t>(atoi(row[71])) : 0;
|
||||
e.tinkering = row[72] ? static_cast<int32_t>(atoi(row[72])) : 0;
|
||||
e.created_at = strtoll(row[73] ? row[73] : "-1", nullptr, 10);
|
||||
e.updated_at = strtoll(row[74] ? row[74] : "-1", nullptr, 10);
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@ -968,29 +977,30 @@ public:
|
||||
e.endurance_regen = row[48] ? static_cast<int32_t>(atoi(row[48])) : 0;
|
||||
e.shielding = row[49] ? static_cast<int32_t>(atoi(row[49])) : 0;
|
||||
e.spell_damage = row[50] ? static_cast<int32_t>(atoi(row[50])) : 0;
|
||||
e.spell_shielding = row[51] ? static_cast<int32_t>(atoi(row[51])) : 0;
|
||||
e.strikethrough = row[52] ? static_cast<int32_t>(atoi(row[52])) : 0;
|
||||
e.stun_resist = row[53] ? static_cast<int32_t>(atoi(row[53])) : 0;
|
||||
e.backstab = row[54] ? static_cast<int32_t>(atoi(row[54])) : 0;
|
||||
e.wind = row[55] ? static_cast<int32_t>(atoi(row[55])) : 0;
|
||||
e.brass = row[56] ? static_cast<int32_t>(atoi(row[56])) : 0;
|
||||
e.string = row[57] ? static_cast<int32_t>(atoi(row[57])) : 0;
|
||||
e.percussion = row[58] ? static_cast<int32_t>(atoi(row[58])) : 0;
|
||||
e.singing = row[59] ? static_cast<int32_t>(atoi(row[59])) : 0;
|
||||
e.baking = row[60] ? static_cast<int32_t>(atoi(row[60])) : 0;
|
||||
e.alchemy = row[61] ? static_cast<int32_t>(atoi(row[61])) : 0;
|
||||
e.tailoring = row[62] ? static_cast<int32_t>(atoi(row[62])) : 0;
|
||||
e.blacksmithing = row[63] ? static_cast<int32_t>(atoi(row[63])) : 0;
|
||||
e.fletching = row[64] ? static_cast<int32_t>(atoi(row[64])) : 0;
|
||||
e.brewing = row[65] ? static_cast<int32_t>(atoi(row[65])) : 0;
|
||||
e.jewelry = row[66] ? static_cast<int32_t>(atoi(row[66])) : 0;
|
||||
e.pottery = row[67] ? static_cast<int32_t>(atoi(row[67])) : 0;
|
||||
e.research = row[68] ? static_cast<int32_t>(atoi(row[68])) : 0;
|
||||
e.alcohol = row[69] ? static_cast<int32_t>(atoi(row[69])) : 0;
|
||||
e.fishing = row[70] ? static_cast<int32_t>(atoi(row[70])) : 0;
|
||||
e.tinkering = row[71] ? static_cast<int32_t>(atoi(row[71])) : 0;
|
||||
e.created_at = strtoll(row[72] ? row[72] : "-1", nullptr, 10);
|
||||
e.updated_at = strtoll(row[73] ? row[73] : "-1", nullptr, 10);
|
||||
e.heal_amount = row[51] ? static_cast<int32_t>(atoi(row[51])) : 0;
|
||||
e.spell_shielding = row[52] ? static_cast<int32_t>(atoi(row[52])) : 0;
|
||||
e.strikethrough = row[53] ? static_cast<int32_t>(atoi(row[53])) : 0;
|
||||
e.stun_resist = row[54] ? static_cast<int32_t>(atoi(row[54])) : 0;
|
||||
e.backstab = row[55] ? static_cast<int32_t>(atoi(row[55])) : 0;
|
||||
e.wind = row[56] ? static_cast<int32_t>(atoi(row[56])) : 0;
|
||||
e.brass = row[57] ? static_cast<int32_t>(atoi(row[57])) : 0;
|
||||
e.string = row[58] ? static_cast<int32_t>(atoi(row[58])) : 0;
|
||||
e.percussion = row[59] ? static_cast<int32_t>(atoi(row[59])) : 0;
|
||||
e.singing = row[60] ? static_cast<int32_t>(atoi(row[60])) : 0;
|
||||
e.baking = row[61] ? static_cast<int32_t>(atoi(row[61])) : 0;
|
||||
e.alchemy = row[62] ? static_cast<int32_t>(atoi(row[62])) : 0;
|
||||
e.tailoring = row[63] ? static_cast<int32_t>(atoi(row[63])) : 0;
|
||||
e.blacksmithing = row[64] ? static_cast<int32_t>(atoi(row[64])) : 0;
|
||||
e.fletching = row[65] ? static_cast<int32_t>(atoi(row[65])) : 0;
|
||||
e.brewing = row[66] ? static_cast<int32_t>(atoi(row[66])) : 0;
|
||||
e.jewelry = row[67] ? static_cast<int32_t>(atoi(row[67])) : 0;
|
||||
e.pottery = row[68] ? static_cast<int32_t>(atoi(row[68])) : 0;
|
||||
e.research = row[69] ? static_cast<int32_t>(atoi(row[69])) : 0;
|
||||
e.alcohol = row[70] ? static_cast<int32_t>(atoi(row[70])) : 0;
|
||||
e.fishing = row[71] ? static_cast<int32_t>(atoi(row[71])) : 0;
|
||||
e.tinkering = row[72] ? static_cast<int32_t>(atoi(row[72])) : 0;
|
||||
e.created_at = strtoll(row[73] ? row[73] : "-1", nullptr, 10);
|
||||
e.updated_at = strtoll(row[74] ? row[74] : "-1", nullptr, 10);
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
@ -1116,6 +1126,7 @@ public:
|
||||
v.push_back(std::to_string(e.endurance_regen));
|
||||
v.push_back(std::to_string(e.shielding));
|
||||
v.push_back(std::to_string(e.spell_damage));
|
||||
v.push_back(std::to_string(e.heal_amount));
|
||||
v.push_back(std::to_string(e.spell_shielding));
|
||||
v.push_back(std::to_string(e.strikethrough));
|
||||
v.push_back(std::to_string(e.stun_resist));
|
||||
@ -1212,6 +1223,7 @@ public:
|
||||
v.push_back(std::to_string(e.endurance_regen));
|
||||
v.push_back(std::to_string(e.shielding));
|
||||
v.push_back(std::to_string(e.spell_damage));
|
||||
v.push_back(std::to_string(e.heal_amount));
|
||||
v.push_back(std::to_string(e.spell_shielding));
|
||||
v.push_back(std::to_string(e.strikethrough));
|
||||
v.push_back(std::to_string(e.stun_resist));
|
||||
|
||||
@ -191,6 +191,22 @@ public:
|
||||
|
||||
return character_ids;
|
||||
}
|
||||
|
||||
static uint32_t GetTotalTimePlayed(Database& db, uint32_t account_id)
|
||||
{
|
||||
auto query = fmt::format(
|
||||
"SELECT SUM(time_played) FROM `character_data` WHERE `account_id` = {}",
|
||||
account_id
|
||||
);
|
||||
|
||||
auto results = db.QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto row = results.begin();
|
||||
return Strings::ToUnsignedInt(row[0]);
|
||||
}
|
||||
};
|
||||
|
||||
#endif //EQEMU_CHARACTER_DATA_REPOSITORY_H
|
||||
|
||||
@ -49,6 +49,7 @@ public:
|
||||
// these are the base definitions for command_subsettings and can be over-ridden by the database
|
||||
std::vector<CommandSubsettingsRepository::CommandSubsettings> static_records = {
|
||||
{.parent_command = "find", .sub_command = "aa", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "findaa"},
|
||||
{.parent_command = "find", .sub_command = "account", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "findaccount"},
|
||||
{.parent_command = "find", .sub_command = "body_type", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "findbodytype"},
|
||||
{.parent_command = "find", .sub_command = "bug_category", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "findbugcategory"},
|
||||
{.parent_command = "find", .sub_command = "character", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "findcharacter"},
|
||||
|
||||
@ -7,8 +7,8 @@
|
||||
#include "items_repository.h"
|
||||
#include "../../common/item_data.h"
|
||||
#include "../../common/races.h"
|
||||
#include "../cereal/include/cereal/archives/binary.hpp"
|
||||
#include "../cereal/include/cereal/types/string.hpp"
|
||||
#include <cereal/archives/binary.hpp>
|
||||
#include <cereal/types/string.hpp>
|
||||
|
||||
class TraderRepository : public BaseTraderRepository {
|
||||
public:
|
||||
|
||||
@ -23,6 +23,7 @@
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
#include "../common/repositories/rule_sets_repository.h"
|
||||
#include "../common/repositories/rule_values_repository.h"
|
||||
|
||||
@ -619,7 +619,7 @@ RULE_INT(Combat, SneakPullAssistRange, 400, "Modified range of assist for sneak
|
||||
RULE_BOOL(Combat, Classic2HBAnimation, false, "2HB will use the 2 hand piercing animation instead of the overhead slashing animation")
|
||||
RULE_BOOL(Combat, ArcheryConsumesAmmo, true, "Set to false to disable Archery Ammo Consumption")
|
||||
RULE_BOOL(Combat, ThrowingConsumesAmmo, true, "Set to false to disable Throwing Ammo Consumption")
|
||||
RULE_BOOL(Combat, UseLiveRiposteMechanics, false, "Set to true to disable SPA 173 SE_RiposteChance from making those with the effect on them immune to enrage, can longer riposte from a riposte.")
|
||||
RULE_BOOL(Combat, UseLiveRiposteMechanics, false, "Set to true to disable SPA 173 SpellEffect::RiposteChance from making those with the effect on them immune to enrage, can longer riposte from a riposte.")
|
||||
RULE_INT(Combat, FrontalStunImmunityClasses, 0, "Bitmask for Classes than have frontal stun immunity, No Races (0) by default.")
|
||||
RULE_BOOL(Combat, NPCsUseFrontalStunImmunityClasses, false, "Enable or disable NPCs using frontal stun immunity Classes from Combat:FrontalStunImmunityClasses, false by default.")
|
||||
RULE_INT(Combat, FrontalStunImmunityRaces, 512, "Bitmask for Races than have frontal stun immunity, Ogre (512) only by default.")
|
||||
|
||||
@ -19,6 +19,7 @@
|
||||
#include <iostream>
|
||||
#include <cstring>
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1800
|
||||
#include <algorithm>
|
||||
@ -51,19 +52,10 @@
|
||||
#include "repositories/inventory_repository.h"
|
||||
#include "repositories/books_repository.h"
|
||||
#include "repositories/sharedbank_repository.h"
|
||||
|
||||
namespace ItemField
|
||||
{
|
||||
enum {
|
||||
source = 0,
|
||||
#define F(x) x,
|
||||
#include "item_fieldlist.h"
|
||||
#undef F
|
||||
updated,
|
||||
minstatus,
|
||||
comment,
|
||||
};
|
||||
}
|
||||
#include "repositories/character_inspect_messages_repository.h"
|
||||
#include "repositories/spells_new_repository.h"
|
||||
#include "repositories/damageshieldtypes_repository.h"
|
||||
#include "repositories/items_repository.h"
|
||||
|
||||
SharedDatabase::SharedDatabase()
|
||||
: Database()
|
||||
@ -131,66 +123,41 @@ bool SharedDatabase::SetGMFlymode(uint32 account_id, uint8 flymode)
|
||||
return a.id > 0;
|
||||
}
|
||||
|
||||
uint32 SharedDatabase::GetTotalTimeEntitledOnAccount(uint32 AccountID) {
|
||||
uint32 EntitledTime = 0;
|
||||
const std::string query = StringFormat("SELECT `time_played` FROM `character_data` WHERE `account_id` = %u", AccountID);
|
||||
auto results = QueryDatabase(query);
|
||||
for (auto& row = results.begin(); row != results.end(); ++row) {
|
||||
EntitledTime += Strings::ToUnsignedInt(row[0]);
|
||||
}
|
||||
return EntitledTime;
|
||||
}
|
||||
|
||||
void SharedDatabase::SetMailKey(int CharID, int IPAddress, int MailKey)
|
||||
void SharedDatabase::SetMailKey(uint32 character_id, uint32 ip_address, uint32 mail_key)
|
||||
{
|
||||
char mail_key[17];
|
||||
std::string full_mail_key;
|
||||
|
||||
if (RuleB(Chat, EnableMailKeyIPVerification) == true) {
|
||||
sprintf(mail_key, "%08X%08X", IPAddress, MailKey);
|
||||
}
|
||||
else {
|
||||
sprintf(mail_key, "%08X", MailKey);
|
||||
if (RuleB(Chat, EnableMailKeyIPVerification)) {
|
||||
full_mail_key = fmt::format("{:08X}{:08X}", ip_address, mail_key);
|
||||
} else {
|
||||
full_mail_key = fmt::format("{:08X}", mail_key);
|
||||
}
|
||||
|
||||
const std::string query = StringFormat(
|
||||
"UPDATE character_data SET mailkey = '%s' WHERE id = '%i'",
|
||||
mail_key, CharID
|
||||
);
|
||||
auto e = CharacterDataRepository::FindOne(*this, character_id);
|
||||
if (!e.id) {
|
||||
LogError("Failed to find character_id [{}] when setting mailkey", character_id);
|
||||
return;
|
||||
}
|
||||
|
||||
const auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
LogError("SharedDatabase::SetMailKey({}, {}) : {}", CharID, mail_key, results.ErrorMessage().c_str());
|
||||
e.mailkey = full_mail_key;
|
||||
|
||||
if (!CharacterDataRepository::UpdateOne(*this, e)) {
|
||||
LogError("Failed to set mailkey to [{}] for character_id [{}]", full_mail_key, character_id);
|
||||
}
|
||||
}
|
||||
|
||||
SharedDatabase::MailKeys SharedDatabase::GetMailKey(int character_id)
|
||||
SharedDatabase::MailKeys SharedDatabase::GetMailKey(uint32 character_id)
|
||||
{
|
||||
const std::string query = StringFormat("SELECT `mailkey` FROM `character_data` WHERE `id`='%i' LIMIT 1", character_id);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return MailKeys{};
|
||||
auto e = CharacterDataRepository::FindOne(*this, character_id);
|
||||
|
||||
if (!e.id) {
|
||||
return MailKeys{ };
|
||||
}
|
||||
|
||||
if (!results.RowCount()) {
|
||||
Log(Logs::General,
|
||||
Logs::ClientLogin,
|
||||
"Error: Mailkey for character id [%i] does not exist or could not be found",
|
||||
character_id
|
||||
);
|
||||
return MailKeys{};
|
||||
}
|
||||
|
||||
auto &row = results.begin();
|
||||
if (row != results.end()) {
|
||||
std::string mail_key = row[0];
|
||||
|
||||
return MailKeys{
|
||||
.mail_key = mail_key.substr(8),
|
||||
.mail_key_full = mail_key
|
||||
};
|
||||
}
|
||||
|
||||
return MailKeys{};
|
||||
return MailKeys{
|
||||
.mail_key = e.mailkey.substr(8),
|
||||
.mail_key_full = e.mailkey
|
||||
};
|
||||
}
|
||||
|
||||
bool SharedDatabase::SaveCursor(
|
||||
@ -457,27 +424,20 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
int32 SharedDatabase::GetSharedPlatinum(uint32 account_id)
|
||||
{
|
||||
const auto query = fmt::format("SELECT sharedplat FROM account WHERE id = {}", account_id);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success() || !results.RowCount()) {
|
||||
return 0;
|
||||
}
|
||||
const auto& e = AccountRepository::FindOne(*this, account_id);
|
||||
|
||||
auto row = results.begin();
|
||||
return Strings::ToInt(row[0]);
|
||||
return e.sharedplat;
|
||||
}
|
||||
|
||||
bool SharedDatabase::SetSharedPlatinum(uint32 account_id, int32 amount_to_add) {
|
||||
const std::string query = StringFormat("UPDATE account SET sharedplat = sharedplat + %i WHERE id = %i", amount_to_add, account_id);
|
||||
const auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return false;
|
||||
}
|
||||
bool SharedDatabase::AddSharedPlatinum(uint32 account_id, int amount)
|
||||
{
|
||||
auto e = AccountRepository::FindOne(*this, account_id);
|
||||
|
||||
return true;
|
||||
e.sharedplat += amount;
|
||||
|
||||
return AccountRepository::UpdateOne(*this, e);
|
||||
}
|
||||
|
||||
bool SharedDatabase::SetStartingItems(
|
||||
@ -944,27 +904,10 @@ void SharedDatabase::ClearOldRecastTimestamps(uint32 char_id)
|
||||
);
|
||||
}
|
||||
|
||||
void SharedDatabase::GetItemsCount(int32 &item_count, uint32 &max_id)
|
||||
void SharedDatabase::GetItemsCount(int32& item_count, uint32& max_id)
|
||||
{
|
||||
item_count = -1;
|
||||
max_id = 0;
|
||||
|
||||
const std::string query = "SELECT MAX(id), count(*) FROM items";
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (results.RowCount() == 0)
|
||||
return;
|
||||
|
||||
auto& row = results.begin();
|
||||
|
||||
if (row[0])
|
||||
max_id = Strings::ToUnsignedInt(row[0]);
|
||||
|
||||
if (row[1])
|
||||
item_count = Strings::ToUnsignedInt(row[1]);
|
||||
max_id = ItemsRepository::GetMaxId(*this);
|
||||
item_count = ItemsRepository::Count(*this);
|
||||
}
|
||||
|
||||
bool SharedDatabase::LoadItems(const std::string &prefix) {
|
||||
@ -994,14 +937,14 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_
|
||||
|
||||
std::string variable_buffer;
|
||||
|
||||
bool disable_attuneable = RuleB(Items, DisableAttuneable);
|
||||
bool disable_bard_focus_effects = RuleB(Items, DisableBardFocusEffects);
|
||||
bool disable_lore = RuleB(Items, DisableLore);
|
||||
bool disable_no_drop = RuleB(Items, DisableNoDrop);
|
||||
bool disable_no_pet = RuleB(Items, DisableNoPet);
|
||||
bool disable_no_rent = RuleB(Items, DisableNoRent);
|
||||
bool disable_no_transfer = RuleB(Items, DisableNoTransfer);
|
||||
bool disable_potion_belt = RuleB(Items, DisablePotionBelt);
|
||||
bool disable_attuneable = RuleB(Items, DisableAttuneable);
|
||||
bool disable_bard_focus_effects = RuleB(Items, DisableBardFocusEffects);
|
||||
bool disable_lore = RuleB(Items, DisableLore);
|
||||
bool disable_no_drop = RuleB(Items, DisableNoDrop);
|
||||
bool disable_no_pet = RuleB(Items, DisableNoPet);
|
||||
bool disable_no_rent = RuleB(Items, DisableNoRent);
|
||||
bool disable_no_transfer = RuleB(Items, DisableNoTransfer);
|
||||
bool disable_potion_belt = RuleB(Items, DisablePotionBelt);
|
||||
bool disable_spell_focus_effects = RuleB(Items, DisableSpellFocusEffects);
|
||||
|
||||
// Old Variable Code
|
||||
@ -1032,206 +975,204 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_
|
||||
|
||||
EQ::ItemData item;
|
||||
|
||||
const std::string query = "SELECT source,"
|
||||
#define F(x) "`"#x"`,"
|
||||
#include "item_fieldlist.h"
|
||||
#undef F
|
||||
"updated, minstatus, comment FROM items ORDER BY id";
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
const auto& l = ItemsRepository::All(*this);
|
||||
|
||||
if (l.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (auto& row = results.begin(); row != results.end(); ++row) {
|
||||
for (const auto& e : l) {
|
||||
memset(&item, 0, sizeof(EQ::ItemData));
|
||||
|
||||
// Unique Identifier
|
||||
item.ID = Strings::ToUnsignedInt(row[ItemField::id]);
|
||||
item.ID = e.id;
|
||||
|
||||
// Minimum Status
|
||||
item.MinStatus = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::minstatus]));
|
||||
item.MinStatus = static_cast<uint8>(e.minstatus);
|
||||
|
||||
// Name, Lore, and Comment
|
||||
strn0cpy(item.Name, row[ItemField::name], sizeof(item.Name));
|
||||
strn0cpy(item.Lore, row[ItemField::lore], sizeof(item.Lore));
|
||||
strn0cpy(item.Comment, row[ItemField::comment], sizeof(item.Comment));
|
||||
strn0cpy(item.Name, e.Name.c_str(), sizeof(item.Name));
|
||||
strn0cpy(item.Lore, e.lore.c_str(), sizeof(item.Lore));
|
||||
strn0cpy(item.Comment, e.comment.c_str(), sizeof(item.Comment));
|
||||
|
||||
// Flags
|
||||
item.ArtifactFlag = Strings::ToBool(row[ItemField::artifactflag]);
|
||||
item.Attuneable = !disable_attuneable && Strings::ToBool(row[ItemField::attuneable]);
|
||||
item.BenefitFlag = Strings::ToBool(row[ItemField::benefitflag]);
|
||||
item.FVNoDrop = Strings::ToBool(row[ItemField::fvnodrop]);
|
||||
item.Magic = Strings::ToBool(row[ItemField::magic]);
|
||||
item.NoDrop = disable_no_drop ? static_cast<uint8>(255) : static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::nodrop]));
|
||||
item.NoPet = !disable_no_pet && Strings::ToBool(row[ItemField::nopet]);
|
||||
item.NoRent = disable_no_rent ? static_cast<uint8>(255) : static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::norent]));
|
||||
item.NoTransfer = !disable_no_transfer && Strings::ToBool(row[ItemField::notransfer]);
|
||||
item.PendingLoreFlag = Strings::ToBool(row[ItemField::pendingloreflag]);
|
||||
item.QuestItemFlag = Strings::ToBool(row[ItemField::questitemflag]);
|
||||
item.Stackable = Strings::ToBool(row[ItemField::stackable]);
|
||||
item.Tradeskills = Strings::ToBool(row[ItemField::tradeskills]);
|
||||
item.SummonedFlag = Strings::ToBool(row[ItemField::summonedflag]);
|
||||
item.ArtifactFlag = e.artifactflag;
|
||||
item.Attuneable = !disable_attuneable && e.attuneable;
|
||||
item.BenefitFlag = e.benefitflag;
|
||||
item.FVNoDrop = e.fvnodrop;
|
||||
item.Magic = e.magic;
|
||||
item.NoDrop = disable_no_drop ? std::numeric_limits<uint8>::max() : e.nodrop;
|
||||
item.NoPet = !disable_no_pet && e.nopet;
|
||||
item.NoRent = disable_no_rent ? std::numeric_limits<uint8>::max() : e.norent;
|
||||
item.NoTransfer = !disable_no_transfer && e.notransfer;
|
||||
item.PendingLoreFlag = e.pendingloreflag;
|
||||
item.QuestItemFlag = e.questitemflag;
|
||||
item.Stackable = e.stackable;
|
||||
item.Tradeskills = e.tradeskills;
|
||||
item.SummonedFlag = e.summonedflag;
|
||||
|
||||
// Lore
|
||||
item.LoreGroup = disable_lore ? 0 : Strings::ToInt(row[ItemField::loregroup]);
|
||||
item.LoreFlag = !disable_lore && item.LoreGroup != 0;
|
||||
item.LoreGroup = disable_lore ? 0 : e.loregroup;
|
||||
item.LoreFlag = !disable_lore && item.LoreGroup != 0;
|
||||
|
||||
// Type
|
||||
item.AugType = Strings::ToUnsignedInt(row[ItemField::augtype]);
|
||||
item.ItemType = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::itemtype]));
|
||||
item.SubType = Strings::ToInt(row[ItemField::subtype]);
|
||||
item.AugType = e.augtype;
|
||||
item.ItemType = static_cast<uint8>(e.itemtype);
|
||||
item.SubType = e.subtype;
|
||||
|
||||
// Miscellaneous
|
||||
item.ExpendableArrow = static_cast<uint16>(Strings::ToUnsignedInt(row[ItemField::expendablearrow]));
|
||||
item.Light = static_cast<int8>(Strings::ToInt(row[ItemField::light]));
|
||||
item.MaxCharges = static_cast<int16>(Strings::ToInt(row[ItemField::maxcharges]));
|
||||
item.Size = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::size]));
|
||||
item.StackSize = static_cast<int16>(Strings::ToInt(row[ItemField::stacksize]));
|
||||
item.Weight = Strings::ToInt(row[ItemField::weight]);
|
||||
item.ExpendableArrow = e.expendablearrow;
|
||||
item.Light = EQ::Clamp(e.light, -128, 127);
|
||||
item.MaxCharges = e.maxcharges;
|
||||
item.Size = static_cast<uint8>(e.size);
|
||||
item.StackSize = e.stacksize;
|
||||
item.Weight = e.weight;
|
||||
|
||||
// Potion Belt
|
||||
item.PotionBelt = !disable_potion_belt && Strings::ToBool(row[ItemField::potionbelt]);
|
||||
item.PotionBeltSlots = disable_potion_belt ? 0 : static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::potionbeltslots]));
|
||||
item.PotionBelt = !disable_potion_belt && e.potionbelt;
|
||||
item.PotionBeltSlots = disable_potion_belt ? 0 : static_cast<uint8>(e.potionbeltslots);
|
||||
|
||||
// Merchant
|
||||
item.Favor = Strings::ToUnsignedInt(row[ItemField::favor]);
|
||||
item.GuildFavor = Strings::ToUnsignedInt(row[ItemField::guildfavor]);
|
||||
item.Price = Strings::ToUnsignedInt(row[ItemField::price]);
|
||||
item.SellRate = Strings::ToFloat(row[ItemField::sellrate]);
|
||||
item.Favor = e.favor;
|
||||
item.GuildFavor = e.guildfavor;
|
||||
item.Price = e.price;
|
||||
item.SellRate = e.sellrate;
|
||||
|
||||
// Display
|
||||
item.Color = Strings::ToUnsignedInt(row[ItemField::color]);
|
||||
item.EliteMaterial = Strings::ToUnsignedInt(row[ItemField::elitematerial]);
|
||||
item.HerosForgeModel = Strings::ToUnsignedInt(row[ItemField::herosforgemodel]);
|
||||
item.Icon = Strings::ToUnsignedInt(row[ItemField::icon]);
|
||||
strn0cpy(item.IDFile, row[ItemField::idfile], sizeof(item.IDFile));
|
||||
item.Material = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::material]));
|
||||
item.Color = e.color;
|
||||
item.EliteMaterial = e.elitematerial;
|
||||
item.HerosForgeModel = e.herosforgemodel;
|
||||
item.Icon = e.icon;
|
||||
strn0cpy(item.IDFile, e.idfile.c_str(), sizeof(item.IDFile));
|
||||
item.Material = e.material;
|
||||
|
||||
// Resists
|
||||
item.CR = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::cr]), -128, 127));
|
||||
item.DR = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::dr]), -128, 127));
|
||||
item.FR = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::fr]), -128, 127));
|
||||
item.MR = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::mr]), -128, 127));
|
||||
item.PR = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::pr]), -128, 127));
|
||||
item.SVCorruption = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::svcorruption]), -128, 127));
|
||||
item.CR = EQ::Clamp(e.cr, -128, 127);
|
||||
item.DR = EQ::Clamp(e.dr, -128, 127);
|
||||
item.FR = EQ::Clamp(e.fr, -128, 127);
|
||||
item.MR = EQ::Clamp(e.mr, -128, 127);
|
||||
item.PR = EQ::Clamp(e.pr, -128, 127);
|
||||
item.SVCorruption = EQ::Clamp(e.svcorruption, -128, 127);
|
||||
|
||||
// Heroic Resists
|
||||
item.HeroicCR = Strings::ToInt(row[ItemField::heroic_cr]);
|
||||
item.HeroicDR = Strings::ToInt(row[ItemField::heroic_dr]);
|
||||
item.HeroicFR = Strings::ToInt(row[ItemField::heroic_fr]);
|
||||
item.HeroicMR = Strings::ToInt(row[ItemField::heroic_mr]);
|
||||
item.HeroicPR = Strings::ToInt(row[ItemField::heroic_pr]);
|
||||
item.HeroicSVCorrup = Strings::ToInt(row[ItemField::heroic_svcorrup]);
|
||||
item.HeroicCR = e.heroic_cr;
|
||||
item.HeroicDR = e.heroic_dr;
|
||||
item.HeroicFR = e.heroic_fr;
|
||||
item.HeroicMR = e.heroic_mr;
|
||||
item.HeroicPR = e.heroic_pr;
|
||||
item.HeroicSVCorrup = e.heroic_svcorrup;
|
||||
|
||||
// Stats
|
||||
item.AAgi = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::aagi]), -128, 127));
|
||||
item.ACha = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::acha]), -128, 127));
|
||||
item.ADex = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::adex]), -128, 127));
|
||||
item.AInt = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::aint]), -128, 127));
|
||||
item.ASta = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::asta]), -128, 127));
|
||||
item.AStr = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::astr]), -128, 127));
|
||||
item.AWis = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::awis]), -128, 127));
|
||||
item.AAgi = EQ::Clamp(e.aagi, -128, 127);
|
||||
item.ACha = EQ::Clamp(e.acha, -128, 127);
|
||||
item.ADex = EQ::Clamp(e.adex, -128, 127);
|
||||
item.AInt = EQ::Clamp(e.aint, -128, 127);
|
||||
item.ASta = EQ::Clamp(e.asta, -128, 127);
|
||||
item.AStr = EQ::Clamp(e.astr, -128, 127);
|
||||
item.AWis = EQ::Clamp(e.awis, -128, 127);
|
||||
|
||||
// Heroic Stats
|
||||
item.HeroicAgi = Strings::ToInt(row[ItemField::heroic_agi]);
|
||||
item.HeroicCha = Strings::ToInt(row[ItemField::heroic_cha]);
|
||||
item.HeroicDex = Strings::ToInt(row[ItemField::heroic_dex]);
|
||||
item.HeroicInt = Strings::ToInt(row[ItemField::heroic_int]);
|
||||
item.HeroicSta = Strings::ToInt(row[ItemField::heroic_sta]);
|
||||
item.HeroicStr = Strings::ToInt(row[ItemField::heroic_str]);
|
||||
item.HeroicWis = Strings::ToInt(row[ItemField::heroic_wis]);
|
||||
item.HeroicAgi = e.heroic_agi;
|
||||
item.HeroicCha = e.heroic_cha;
|
||||
item.HeroicDex = e.heroic_dex;
|
||||
item.HeroicInt = e.heroic_int;
|
||||
item.HeroicSta = e.heroic_sta;
|
||||
item.HeroicStr = e.heroic_str;
|
||||
item.HeroicWis = e.heroic_wis;
|
||||
|
||||
// Health, Mana, and Endurance
|
||||
item.HP = Strings::ToInt(row[ItemField::hp]);
|
||||
item.Regen = Strings::ToInt(row[ItemField::regen]);
|
||||
item.Mana = Strings::ToInt(row[ItemField::mana]);
|
||||
item.ManaRegen = Strings::ToInt(row[ItemField::manaregen]);
|
||||
item.Endur = Strings::ToInt(row[ItemField::endur]);
|
||||
item.EnduranceRegen = Strings::ToInt(row[ItemField::enduranceregen]);
|
||||
item.HP = e.hp;
|
||||
item.Regen = e.regen;
|
||||
item.Mana = e.mana;
|
||||
item.ManaRegen = e.manaregen;
|
||||
item.Endur = e.endur;
|
||||
item.EnduranceRegen = e.enduranceregen;
|
||||
|
||||
// Bane Damage
|
||||
item.BaneDmgAmt = Strings::ToInt(row[ItemField::banedmgamt]);
|
||||
item.BaneDmgBody = Strings::ToUnsignedInt(row[ItemField::banedmgbody]);
|
||||
item.BaneDmgRace = Strings::ToUnsignedInt(row[ItemField::banedmgrace]);
|
||||
item.BaneDmgRaceAmt = Strings::ToUnsignedInt(row[ItemField::banedmgraceamt]);
|
||||
item.BaneDmgAmt = e.banedmgamt;
|
||||
item.BaneDmgBody = e.banedmgbody;
|
||||
item.BaneDmgRace = e.banedmgrace;
|
||||
item.BaneDmgRaceAmt = e.banedmgraceamt;
|
||||
|
||||
// Elemental Damage
|
||||
item.ElemDmgType = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::elemdmgtype]));
|
||||
item.ElemDmgAmt = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::elemdmgamt]));
|
||||
item.ElemDmgType = static_cast<uint8>(e.elemdmgtype);
|
||||
item.ElemDmgAmt = static_cast<uint8>(e.elemdmgamt);
|
||||
|
||||
// Combat
|
||||
item.BackstabDmg = Strings::ToUnsignedInt(row[ItemField::backstabdmg]);
|
||||
item.Damage = Strings::ToUnsignedInt(row[ItemField::damage]);
|
||||
item.Delay = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::delay]));
|
||||
item.Range = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::range]));
|
||||
item.BackstabDmg = e.backstabdmg;
|
||||
item.Damage = e.damage;
|
||||
item.Delay = static_cast<uint8>(e.delay);
|
||||
item.Range = static_cast<uint8>(e.range_);
|
||||
|
||||
// Combat Stats
|
||||
item.AC = Strings::ToInt(row[ItemField::ac]);
|
||||
item.Accuracy = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::accuracy]), -128, 127));
|
||||
item.Attack = Strings::ToInt(row[ItemField::attack]);
|
||||
item.Avoidance = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::avoidance]), -128, 127));
|
||||
item.Clairvoyance = Strings::ToUnsignedInt(row[ItemField::clairvoyance]);
|
||||
item.CombatEffects = Strings::IsNumber(row[ItemField::combateffects]) ? static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::combateffects]), -128, 127)) : 0;
|
||||
item.DamageShield = Strings::ToInt(row[ItemField::damageshield]);
|
||||
item.DotShielding = Strings::ToInt(row[ItemField::dotshielding]);
|
||||
item.DSMitigation = Strings::ToUnsignedInt(row[ItemField::dsmitigation]);
|
||||
item.Haste = Strings::ToInt(row[ItemField::haste]);
|
||||
item.HealAmt = Strings::ToInt(row[ItemField::healamt]);
|
||||
item.Purity = Strings::ToUnsignedInt(row[ItemField::purity]);
|
||||
item.Shielding = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::shielding]), -128, 127));
|
||||
item.SpellDmg = Strings::ToInt(row[ItemField::spelldmg]);
|
||||
item.SpellShield = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::spellshield]), -128, 127));
|
||||
item.StrikeThrough = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::strikethrough]), -128, 127));
|
||||
item.StunResist = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::stunresist]), -128, 127));
|
||||
item.AC = e.ac;
|
||||
item.Accuracy = EQ::Clamp(e.accuracy, -128, 127);
|
||||
item.Attack = e.attack;
|
||||
item.Avoidance = EQ::Clamp(e.avoidance, -128, 127);
|
||||
item.Clairvoyance = e.clairvoyance;
|
||||
item.CombatEffects = Strings::IsNumber(e.combateffects) ? static_cast<int8>(EQ::Clamp(Strings::ToInt(e.combateffects), -128, 127)) : 0;
|
||||
item.DamageShield = e.damageshield;
|
||||
item.DotShielding = e.dotshielding;
|
||||
item.DSMitigation = e.dsmitigation;
|
||||
item.Haste = e.haste;
|
||||
item.HealAmt = e.healamt;
|
||||
item.Purity = e.purity;
|
||||
item.Shielding = EQ::Clamp(e.shielding, -128, 127);
|
||||
item.SpellDmg = e.spelldmg;
|
||||
item.SpellShield = EQ::Clamp(e.spellshield, -128, 127);
|
||||
item.StrikeThrough = EQ::Clamp(e.strikethrough, -128, 127);
|
||||
item.StunResist = EQ::Clamp(e.stunresist, -128, 127);
|
||||
|
||||
// Restrictions
|
||||
item.AugRestrict = Strings::ToUnsignedInt(row[ItemField::augrestrict]);
|
||||
item.Classes = Strings::ToUnsignedInt(row[ItemField::classes]);
|
||||
item.Deity = Strings::ToUnsignedInt(row[ItemField::deity]);
|
||||
item.ItemClass = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::itemclass]));
|
||||
item.Races = Strings::ToUnsignedInt(row[ItemField::races]);
|
||||
item.RecLevel = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::reclevel]));
|
||||
item.RecSkill = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::recskill]));
|
||||
item.ReqLevel = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::reqlevel]));
|
||||
item.Slots = Strings::ToUnsignedInt(row[ItemField::slots]);
|
||||
item.AugRestrict = e.augrestrict;
|
||||
item.Classes = e.classes;
|
||||
item.Deity = e.deity;
|
||||
item.ItemClass = static_cast<uint8>(e.itemclass);
|
||||
item.Races = e.races;
|
||||
item.RecLevel = static_cast<uint8>(e.reclevel);
|
||||
item.RecSkill = static_cast<uint8>(e.recskill);
|
||||
item.ReqLevel = static_cast<uint8>(e.reqlevel);
|
||||
item.Slots = e.slots;
|
||||
|
||||
// Skill Modifier
|
||||
item.SkillModValue = Strings::ToInt(row[ItemField::skillmodvalue]);
|
||||
item.SkillModMax = Strings::ToInt(row[ItemField::skillmodmax]);
|
||||
item.SkillModType = Strings::ToUnsignedInt(row[ItemField::skillmodtype]);
|
||||
item.SkillModValue = e.skillmodvalue;
|
||||
item.SkillModMax = e.skillmodmax;
|
||||
item.SkillModType = e.skillmodtype;
|
||||
|
||||
// Extra Damage Skill
|
||||
item.ExtraDmgSkill = Strings::ToInt(row[ItemField::extradmgskill]);
|
||||
item.ExtraDmgAmt = Strings::ToInt(row[ItemField::extradmgamt]);
|
||||
item.ExtraDmgSkill = e.extradmgskill;
|
||||
item.ExtraDmgAmt = e.extradmgamt;
|
||||
|
||||
// Bard
|
||||
item.BardType = Strings::ToUnsignedInt(row[ItemField::bardtype]);
|
||||
item.BardValue = Strings::ToInt(row[ItemField::bardvalue]);
|
||||
item.BardType = e.bardtype;
|
||||
item.BardValue = e.bardvalue;
|
||||
|
||||
// Faction
|
||||
item.FactionAmt1 = Strings::ToInt(row[ItemField::factionamt1]);
|
||||
item.FactionMod1 = Strings::ToInt(row[ItemField::factionmod1]);
|
||||
item.FactionAmt2 = Strings::ToInt(row[ItemField::factionamt2]);
|
||||
item.FactionMod2 = Strings::ToInt(row[ItemField::factionmod2]);
|
||||
item.FactionAmt3 = Strings::ToInt(row[ItemField::factionamt3]);
|
||||
item.FactionMod3 = Strings::ToInt(row[ItemField::factionmod3]);
|
||||
item.FactionAmt4 = Strings::ToInt(row[ItemField::factionamt4]);
|
||||
item.FactionMod4 = Strings::ToInt(row[ItemField::factionmod4]);
|
||||
item.FactionAmt1 = e.factionamt1;
|
||||
item.FactionMod1 = e.factionmod1;
|
||||
item.FactionAmt2 = e.factionamt2;
|
||||
item.FactionMod2 = e.factionmod2;
|
||||
item.FactionAmt3 = e.factionamt3;
|
||||
item.FactionMod3 = e.factionmod3;
|
||||
item.FactionAmt4 = e.factionamt4;
|
||||
item.FactionMod4 = e.factionmod4;
|
||||
|
||||
// Augment
|
||||
item.AugDistiller = Strings::ToUnsignedInt(row[ItemField::augdistiller]);
|
||||
item.AugSlotType[0] = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::augslot1type]));
|
||||
item.AugSlotVisible[0] = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::augslot1visible]));
|
||||
item.AugSlotType[1] = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::augslot2type]));
|
||||
item.AugSlotVisible[1] = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::augslot2visible]));
|
||||
item.AugSlotType[2] = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::augslot3type]));
|
||||
item.AugSlotVisible[2] = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::augslot3visible]));
|
||||
item.AugSlotType[3] = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::augslot4type]));
|
||||
item.AugSlotVisible[3] = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::augslot4visible]));
|
||||
item.AugSlotType[4] = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::augslot5type]));
|
||||
item.AugSlotVisible[4] = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::augslot5visible]));
|
||||
item.AugSlotType[5] = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::augslot6type]));
|
||||
item.AugSlotVisible[5] = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::augslot6visible]));
|
||||
// Augment Distiller
|
||||
item.AugDistiller = e.augdistiller;
|
||||
|
||||
// Augment Slots
|
||||
item.AugSlotType[0] = static_cast<uint8>(e.augslot1type);
|
||||
item.AugSlotVisible[0] = static_cast<uint8>(e.augslot1visible);
|
||||
item.AugSlotType[1] = static_cast<uint8>(e.augslot2type);
|
||||
item.AugSlotVisible[1] = static_cast<uint8>(e.augslot2visible);
|
||||
item.AugSlotType[2] = static_cast<uint8>(e.augslot3type);
|
||||
item.AugSlotVisible[2] = static_cast<uint8>(e.augslot3visible);
|
||||
item.AugSlotType[3] = static_cast<uint8>(e.augslot4type);
|
||||
item.AugSlotVisible[3] = static_cast<uint8>(e.augslot4visible);
|
||||
item.AugSlotType[4] = static_cast<uint8>(e.augslot5type);
|
||||
item.AugSlotVisible[4] = static_cast<uint8>(e.augslot5visible);
|
||||
item.AugSlotType[5] = static_cast<uint8>(e.augslot6type);
|
||||
item.AugSlotVisible[5] = static_cast<uint8>(e.augslot6visible);
|
||||
|
||||
// Augment Unknowns
|
||||
for (uint8 i = EQ::invaug::SOCKET_BEGIN; i <= EQ::invaug::SOCKET_END; i++) {
|
||||
@ -1239,79 +1180,79 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_
|
||||
}
|
||||
|
||||
// LDoN
|
||||
item.LDoNTheme = Strings::ToUnsignedInt(row[ItemField::ldontheme]);
|
||||
item.LDoNPrice = Strings::ToUnsignedInt(row[ItemField::ldonprice]);
|
||||
item.LDoNSellBackRate = Strings::ToUnsignedInt(row[ItemField::ldonsellbackrate]);
|
||||
item.LDoNSold = Strings::ToUnsignedInt(row[ItemField::ldonsold]);
|
||||
item.PointType = Strings::ToUnsignedInt(row[ItemField::pointtype]);
|
||||
item.LDoNTheme = e.ldontheme;
|
||||
item.LDoNPrice = e.ldonprice;
|
||||
item.LDoNSellBackRate = e.ldonsellbackrate;
|
||||
item.LDoNSold = e.ldonsold;
|
||||
item.PointType = e.pointtype;
|
||||
|
||||
// Bag
|
||||
item.BagSize = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::bagsize]));
|
||||
item.BagSlots = static_cast<uint8>(EQ::Clamp(Strings::ToInt(row[ItemField::bagslots]), 0, static_cast<int>(EQ::invbag::SLOT_COUNT)));
|
||||
item.BagType = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::bagtype]));
|
||||
item.BagWR = static_cast<uint8>(EQ::Clamp(Strings::ToInt(row[ItemField::bagwr]), 0, 100));
|
||||
item.BagSize = static_cast<uint8>(e.bagsize);
|
||||
item.BagSlots = EQ::Clamp(e.bagslots, 0, static_cast<int>(EQ::invbag::SLOT_COUNT));
|
||||
item.BagType = static_cast<uint8>(e.bagtype);
|
||||
item.BagWR = EQ::Clamp(e.bagwr, 0, 100);
|
||||
|
||||
// Bard Effect
|
||||
item.Bard.Effect = disable_bard_focus_effects ? 0 : Strings::ToInt(row[ItemField::bardeffect]);
|
||||
item.Bard.Type = disable_bard_focus_effects ? 0 : static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::bardtype]));
|
||||
item.Bard.Level = disable_bard_focus_effects ? 0 : static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::bardlevel]));
|
||||
item.Bard.Level2 = disable_bard_focus_effects ? 0 : static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::bardlevel2]));
|
||||
item.Bard.Effect = disable_bard_focus_effects ? 0 : e.bardeffect;
|
||||
item.Bard.Type = disable_bard_focus_effects ? 0 : static_cast<uint8>(e.bardtype);
|
||||
item.Bard.Level = disable_bard_focus_effects ? 0 : static_cast<uint8>(e.bardlevel);
|
||||
item.Bard.Level2 = disable_bard_focus_effects ? 0 : static_cast<uint8>(e.bardlevel2);
|
||||
|
||||
// Book
|
||||
item.Book = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::book]));
|
||||
item.BookType = Strings::ToUnsignedInt(row[ItemField::booktype]);
|
||||
item.Book = static_cast<uint8>(e.book);
|
||||
item.BookType = e.booktype;
|
||||
|
||||
// Click Effect
|
||||
item.CastTime = Strings::ToUnsignedInt(row[ItemField::casttime]);
|
||||
item.CastTime_ = Strings::ToInt(row[ItemField::casttime_]);
|
||||
item.Click.Effect = Strings::ToInt(row[ItemField::clickeffect]);
|
||||
item.Click.Type = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::clicktype]));
|
||||
item.Click.Level = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::clicklevel]));
|
||||
item.Click.Level2 = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::clicklevel2]));
|
||||
strn0cpy(item.ClickName, row[ItemField::clickname], sizeof(item.ClickName));
|
||||
item.RecastDelay = Strings::ToUnsignedInt(row[ItemField::recastdelay]);
|
||||
item.RecastType = Strings::ToInt(row[ItemField::recasttype]);
|
||||
item.CastTime = e.casttime;
|
||||
item.CastTime_ = e.casttime_;
|
||||
item.Click.Effect = e.clickeffect;
|
||||
item.Click.Type = static_cast<uint8>(e.clicktype);
|
||||
item.Click.Level = static_cast<uint8>(e.clicklevel);
|
||||
item.Click.Level2 = static_cast<uint8>(e.clicklevel2);
|
||||
strn0cpy(item.ClickName, e.clickname.c_str(), sizeof(item.ClickName));
|
||||
item.RecastDelay = e.recastdelay;
|
||||
item.RecastType = e.recasttype;
|
||||
|
||||
// Focus Effect
|
||||
item.Focus.Effect = disable_spell_focus_effects ? 0 : Strings::ToInt(row[ItemField::focuseffect]);
|
||||
item.Focus.Type = disable_spell_focus_effects ? 0 : static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::focustype]));
|
||||
item.Focus.Level = disable_spell_focus_effects ? 0 : static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::focuslevel]));
|
||||
item.Focus.Level2 = disable_spell_focus_effects ? 0 : static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::focuslevel2]));
|
||||
strn0cpy(item.FocusName, disable_spell_focus_effects ? "" : row[ItemField::focusname], sizeof(item.FocusName));
|
||||
item.Focus.Effect = disable_spell_focus_effects ? 0 : e.focuseffect;
|
||||
item.Focus.Type = disable_spell_focus_effects ? 0 : static_cast<uint8>(e.focustype);
|
||||
item.Focus.Level = disable_spell_focus_effects ? 0 : static_cast<uint8>(e.focuslevel);
|
||||
item.Focus.Level2 = disable_spell_focus_effects ? 0 : static_cast<uint8>(e.focuslevel2);
|
||||
strn0cpy(item.FocusName, disable_spell_focus_effects ? "" : e.focusname.c_str(), sizeof(item.FocusName));
|
||||
|
||||
// Proc Effect
|
||||
item.Proc.Effect = Strings::ToInt(row[ItemField::proceffect]);
|
||||
item.Proc.Type = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::proctype]));
|
||||
item.Proc.Level = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::proclevel]));
|
||||
item.Proc.Level2 = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::proclevel2]));
|
||||
strn0cpy(item.ProcName, row[ItemField::procname], sizeof(item.ProcName));
|
||||
item.ProcRate = Strings::ToInt(row[ItemField::procrate]);
|
||||
item.Proc.Effect = e.proceffect;
|
||||
item.Proc.Type = static_cast<uint8>(e.proctype);
|
||||
item.Proc.Level = static_cast<uint8>(e.proclevel);
|
||||
item.Proc.Level2 = static_cast<uint8>(e.proclevel2);
|
||||
strn0cpy(item.ProcName, e.procname.c_str(), sizeof(item.ProcName));
|
||||
item.ProcRate = e.procrate;
|
||||
|
||||
// Scroll Effect
|
||||
item.Scroll.Effect = Strings::ToInt(row[ItemField::scrolleffect]);
|
||||
item.Scroll.Type = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::scrolltype]));
|
||||
item.Scroll.Level = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::scrolllevel]));
|
||||
item.Scroll.Level2 = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::scrolllevel2]));
|
||||
strn0cpy(item.ScrollName, row[ItemField::scrollname], sizeof(item.ScrollName));
|
||||
item.Scroll.Effect = e.scrolleffect;
|
||||
item.Scroll.Type = static_cast<uint8>(e.scrolltype);
|
||||
item.Scroll.Level = static_cast<uint8>(e.scrolllevel);
|
||||
item.Scroll.Level2 = static_cast<uint8>(e.scrolllevel2);
|
||||
strn0cpy(item.ScrollName, e.scrollname.c_str(), sizeof(item.ScrollName));
|
||||
|
||||
// Worn Effect
|
||||
item.Worn.Effect = Strings::ToInt(row[ItemField::worneffect]);
|
||||
item.Worn.Type = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::worntype]));
|
||||
item.Worn.Level = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::wornlevel]));
|
||||
item.Worn.Level2 = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::wornlevel2]));
|
||||
strn0cpy(item.WornName, row[ItemField::wornname], sizeof(item.WornName));
|
||||
item.Worn.Effect = e.worneffect;
|
||||
item.Worn.Type = static_cast<uint8>(e.worntype);
|
||||
item.Worn.Level = static_cast<uint8>(e.wornlevel);
|
||||
item.Worn.Level2 = static_cast<uint8>(e.wornlevel2);
|
||||
strn0cpy(item.WornName, e.wornname.c_str(), sizeof(item.WornName));
|
||||
|
||||
// Evolving Item
|
||||
item.EvolvingID = Strings::ToUnsignedInt(row[ItemField::evoid]);
|
||||
item.EvolvingItem = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::evoitem]));
|
||||
item.EvolvingLevel = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::evolvinglevel]));
|
||||
item.EvolvingMax = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::evomax]));
|
||||
item.EvolvingID = e.evoid;
|
||||
item.EvolvingItem = static_cast<uint8>(e.evoitem);
|
||||
item.EvolvingLevel = static_cast<uint8>(e.evolvinglevel);
|
||||
item.EvolvingMax = static_cast<uint8>(e.evomax);
|
||||
|
||||
// Scripting
|
||||
item.CharmFileID = Strings::IsNumber(row[ItemField::charmfileid]) ? Strings::ToUnsignedInt(row[ItemField::charmfileid]) : 0;
|
||||
strn0cpy(item.CharmFile, row[ItemField::charmfile], sizeof(item.CharmFile));
|
||||
strn0cpy(item.Filename, row[ItemField::filename], sizeof(item.Filename));
|
||||
item.ScriptFileID = Strings::ToUnsignedInt(row[ItemField::scriptfileid]);
|
||||
item.CharmFileID = Strings::IsNumber(e.charmfileid) ? Strings::ToUnsignedInt(e.charmfileid) : 0;
|
||||
strn0cpy(item.CharmFile, e.charmfile.c_str(), sizeof(item.CharmFile));
|
||||
strn0cpy(item.Filename, e.filename.c_str(), sizeof(item.Filename));
|
||||
item.ScriptFileID = e.scriptfileid;
|
||||
|
||||
try {
|
||||
hash.insert(item.ID, item);
|
||||
@ -1673,20 +1614,17 @@ bool SharedDatabase::GetCommandSubSettings(std::vector<CommandSubsettingsReposit
|
||||
return true;
|
||||
}
|
||||
|
||||
void SharedDatabase::LoadDamageShieldTypes(SPDat_Spell_Struct* sp, int32 iMaxSpellID) {
|
||||
const std::string query = StringFormat("SELECT `spellid`, `type` FROM `damageshieldtypes` WHERE `spellid` > 0 "
|
||||
"AND `spellid` <= %i", iMaxSpellID);
|
||||
auto results = QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return;
|
||||
}
|
||||
void SharedDatabase::LoadDamageShieldTypes(SPDat_Spell_Struct* s)
|
||||
{
|
||||
const auto& l = DamageshieldtypesRepository::All(*this);
|
||||
|
||||
for(auto& row = results.begin(); row != results.end(); ++row) {
|
||||
const int spellID = Strings::ToInt(row[0]);
|
||||
if((spellID > 0) && (spellID <= iMaxSpellID))
|
||||
sp[spellID].damage_shield_type = Strings::ToUnsignedInt(row[1]);
|
||||
}
|
||||
if (l.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
for (const auto& e : l) {
|
||||
s[e.spellid].damage_shield_type = e.type;
|
||||
}
|
||||
}
|
||||
|
||||
const EvolveInfo* SharedDatabase::GetEvolveInfo(uint32 loregroup) {
|
||||
@ -1903,21 +1841,32 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) {
|
||||
sp[tempid].damage_shield_type = 0;
|
||||
}
|
||||
|
||||
LoadDamageShieldTypes(sp, max_spells);
|
||||
LoadDamageShieldTypes(sp);
|
||||
}
|
||||
|
||||
void SharedDatabase::LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* message) {
|
||||
const std::string query = StringFormat("SELECT `inspect_message` FROM `character_inspect_messages` WHERE `id` = %u LIMIT 1", character_id);
|
||||
auto results = QueryDatabase(query);
|
||||
memset(message, '\0', sizeof(InspectMessage_Struct));
|
||||
for (auto& row = results.begin(); row != results.end(); ++row) {
|
||||
memcpy(message, row[0], sizeof(InspectMessage_Struct));
|
||||
void SharedDatabase::LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* s)
|
||||
{
|
||||
const auto& e = CharacterInspectMessagesRepository::FindOne(*this, character_id);
|
||||
|
||||
memset(s, '\0', sizeof(InspectMessage_Struct));
|
||||
|
||||
if (!e.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
memcpy(s, e.inspect_message.c_str(), sizeof(InspectMessage_Struct));
|
||||
}
|
||||
|
||||
void SharedDatabase::SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct* message) {
|
||||
const std::string query = StringFormat("REPLACE INTO `character_inspect_messages` (id, inspect_message) VALUES (%u, '%s')", character_id, Strings::Escape(message->text).c_str());
|
||||
auto results = QueryDatabase(query);
|
||||
void SharedDatabase::SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct* s)
|
||||
{
|
||||
auto e = CharacterInspectMessagesRepository::NewEntity();
|
||||
|
||||
e.id = character_id;
|
||||
e.inspect_message = s->text;
|
||||
|
||||
if (!CharacterInspectMessagesRepository::ReplaceOne(*this, e)) {
|
||||
LogError("Failed to save character inspect message of [{}] for character_id [{}]", s->text, character_id);
|
||||
}
|
||||
}
|
||||
|
||||
uint32 SharedDatabase::GetSpellsCount()
|
||||
@ -1938,18 +1887,7 @@ uint32 SharedDatabase::GetSpellsCount()
|
||||
|
||||
uint32 SharedDatabase::GetItemsCount()
|
||||
{
|
||||
auto results = QueryDatabase("SELECT count(*) FROM items");
|
||||
if (!results.Success() || !results.RowCount()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
auto& row = results.begin();
|
||||
|
||||
if (row[0]) {
|
||||
return Strings::ToUnsignedInt(row[0]);
|
||||
}
|
||||
|
||||
return 0;
|
||||
return ItemsRepository::Count(*this);
|
||||
}
|
||||
|
||||
void SharedDatabase::SetSharedItemsCount(uint32 shared_items_count)
|
||||
|
||||
@ -76,21 +76,20 @@ public:
|
||||
uint8 GetGMSpeed(uint32 account_id);
|
||||
bool SetHideMe(uint32 account_id, uint8 hideme);
|
||||
int DeleteStalePlayerCorpses();
|
||||
void LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct *message);
|
||||
void SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct *message);
|
||||
void LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* s);
|
||||
void SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct* s);
|
||||
bool GetCommandSettings(std::map<std::string, std::pair<uint8, std::vector<std::string>>> &command_settings);
|
||||
bool UpdateInjectedCommandSettings(const std::vector<std::pair<std::string, uint8>> &injected);
|
||||
bool UpdateOrphanedCommandSettings(const std::vector<std::string> &orphaned);
|
||||
bool GetCommandSubSettings(std::vector<CommandSubsettingsRepository::CommandSubsettings> &command_subsettings);
|
||||
uint32 GetTotalTimeEntitledOnAccount(uint32 AccountID);
|
||||
bool SetGMInvul(uint32 account_id, bool gminvul);
|
||||
bool SetGMFlymode(uint32 account_id, uint8 flymode);
|
||||
void SetMailKey(int CharID, int IPAddress, int MailKey);
|
||||
void SetMailKey(uint32 character_id, uint32 ip_address, uint32 mail_key);
|
||||
struct MailKeys {
|
||||
std::string mail_key;
|
||||
std::string mail_key_full;
|
||||
};
|
||||
MailKeys GetMailKey(int character_id);
|
||||
MailKeys GetMailKey(uint32 character_id);
|
||||
bool SaveCursor(
|
||||
uint32 char_id,
|
||||
std::list<EQ::ItemInstance *>::const_iterator &start,
|
||||
@ -104,7 +103,7 @@ public:
|
||||
bool VerifyInventory(uint32 account_id, int16 slot_id, const EQ::ItemInstance *inst);
|
||||
bool GetSharedBank(uint32 id, EQ::InventoryProfile *inv, bool is_charid);
|
||||
int32 GetSharedPlatinum(uint32 account_id);
|
||||
bool SetSharedPlatinum(uint32 account_id, int32 amount_to_add);
|
||||
bool AddSharedPlatinum(uint32 account_id, int amount);
|
||||
bool GetInventory(Client* c);
|
||||
bool GetInventory(uint32 account_id, char *name, EQ::InventoryProfile *inv); // deprecated
|
||||
std::map<uint32, uint32> GetItemRecastTimestamps(uint32 char_id);
|
||||
@ -158,7 +157,7 @@ public:
|
||||
);
|
||||
EQ::ItemInstance *CreateBaseItem(const EQ::ItemData *item, int16 charges = 0);
|
||||
|
||||
void GetItemsCount(int32 &item_count, uint32 &max_id);
|
||||
void GetItemsCount(int32& item_count, uint32& max_id);
|
||||
void LoadItems(void *data, uint32 size, int32 items, uint32 max_item_id);
|
||||
bool LoadItems(const std::string &prefix);
|
||||
const EQ::ItemData *IterateItems(uint32 *id) const;
|
||||
@ -173,7 +172,7 @@ public:
|
||||
int GetMaxSpellID();
|
||||
bool LoadSpells(const std::string &prefix, int32 *records, const SPDat_Spell_Struct **sp);
|
||||
void LoadSpells(void *data, int max_spells);
|
||||
void LoadDamageShieldTypes(SPDat_Spell_Struct *sp, int32 iMaxSpellID);
|
||||
void LoadDamageShieldTypes(SPDat_Spell_Struct* s);
|
||||
uint32 GetSharedSpellsCount() { return m_shared_spells_count; }
|
||||
uint32 GetSpellsCount();
|
||||
|
||||
|
||||
830
common/spdat.cpp
830
common/spdat.cpp
File diff suppressed because it is too large
Load Diff
1063
common/spdat.h
1063
common/spdat.h
File diff suppressed because it is too large
Load Diff
@ -36,6 +36,7 @@
|
||||
#include "strings.h"
|
||||
#include <cereal/external/rapidjson/document.h>
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/ranges.h>
|
||||
#include <algorithm>
|
||||
#include <cctype>
|
||||
|
||||
@ -47,14 +48,9 @@
|
||||
#include <random>
|
||||
#include <string>
|
||||
|
||||
//Const char based
|
||||
#include "strings_legacy.cpp" // legacy c functions
|
||||
#include "strings_misc.cpp" // anything non "Strings" scoped
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <ctype.h>
|
||||
#include <functional>
|
||||
#include <algorithm>
|
||||
#endif
|
||||
|
||||
std::string Strings::Random(size_t length)
|
||||
@ -313,6 +309,12 @@ std::string Strings::Commify(const std::string &number)
|
||||
|
||||
auto string_length = static_cast<int>(number.length());
|
||||
|
||||
if (string_length == 3) {
|
||||
return number;
|
||||
} else if (string_length == 4 && number.starts_with("-")) {
|
||||
return number;
|
||||
}
|
||||
|
||||
int i = 0;
|
||||
for (i = string_length - 3; i >= 0; i -= 3) {
|
||||
if (i > 0) {
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
|
||||
#include <ios>
|
||||
#include <fmt/format.h>
|
||||
#include <fmt/ranges.h>
|
||||
|
||||
#ifdef _WIN32
|
||||
#include <objbase.h>
|
||||
|
||||
@ -25,7 +25,7 @@
|
||||
|
||||
// Build variables
|
||||
// these get injected during the build pipeline
|
||||
#define CURRENT_VERSION "23.9.1-dev" // always append -dev to the current version for custom-builds
|
||||
#define CURRENT_VERSION "23.10.3-dev" // always append -dev to the current version for custom-builds
|
||||
#define LOGIN_VERSION "0.8.0"
|
||||
#define COMPILE_DATE __DATE__
|
||||
#define COMPILE_TIME __TIME__
|
||||
@ -42,7 +42,7 @@
|
||||
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
|
||||
*/
|
||||
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9326
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9328
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9054
|
||||
#define CUSTOM_BINARY_DATABASE_VERSION 0
|
||||
|
||||
|
||||
@ -1,20 +1,20 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.12)
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
SET(eqlaunch_sources
|
||||
set(eqlaunch_sources
|
||||
eqlaunch.cpp
|
||||
worldserver.cpp
|
||||
zone_launch.cpp
|
||||
)
|
||||
|
||||
SET(eqlaunch_headers
|
||||
set(eqlaunch_headers
|
||||
worldserver.h
|
||||
zone_launch.h
|
||||
)
|
||||
|
||||
ADD_EXECUTABLE(eqlaunch ${eqlaunch_sources} ${eqlaunch_headers})
|
||||
add_executable(eqlaunch ${eqlaunch_sources} ${eqlaunch_headers})
|
||||
|
||||
INSTALL(TARGETS eqlaunch RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
install(TARGETS eqlaunch RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
|
||||
TARGET_LINK_LIBRARIES(eqlaunch ${SERVER_LIBS})
|
||||
target_link_libraries(eqlaunch common)
|
||||
|
||||
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||
|
||||
@ -1,22 +0,0 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
|
||||
|
||||
SET(hc_sources
|
||||
eq.cpp
|
||||
main.cpp
|
||||
login.cpp
|
||||
world.cpp
|
||||
)
|
||||
|
||||
SET(hc_headers
|
||||
eq.h
|
||||
login.h
|
||||
world.h
|
||||
)
|
||||
|
||||
ADD_EXECUTABLE(hc ${hc_sources} ${hc_headers})
|
||||
|
||||
INSTALL(TARGETS hc RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
|
||||
|
||||
TARGET_LINK_LIBRARIES(hc ${SERVER_LIBS})
|
||||
|
||||
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||
350
hc/eq.cpp
350
hc/eq.cpp
@ -1,350 +0,0 @@
|
||||
#include "eq.h"
|
||||
#include "../common/net/dns.h"
|
||||
|
||||
const char* eqcrypt_block(const char *buffer_in, size_t buffer_in_sz, char* buffer_out, bool enc) {
|
||||
DES_key_schedule k;
|
||||
DES_cblock v;
|
||||
|
||||
memset(&k, 0, sizeof(DES_key_schedule));
|
||||
memset(&v, 0, sizeof(DES_cblock));
|
||||
|
||||
if (!enc && buffer_in_sz && buffer_in_sz % 8 != 0) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DES_ncbc_encrypt((const unsigned char*)buffer_in, (unsigned char*)buffer_out, (long)buffer_in_sz, &k, &v, enc);
|
||||
return buffer_out;
|
||||
}
|
||||
|
||||
EverQuest::EverQuest(const std::string &host, int port, const std::string &user, const std::string &pass, const std::string &server, const std::string &character)
|
||||
{
|
||||
m_host = host;
|
||||
m_port = port;
|
||||
m_user = user;
|
||||
m_pass = pass;
|
||||
m_server = server;
|
||||
m_character = character;
|
||||
m_dbid = 0;
|
||||
|
||||
EQ::Net::DNSLookup(m_host, port, false, [&](const std::string &addr) {
|
||||
if (addr.empty()) {
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "Could not resolve address: {0}", m_host);
|
||||
return;
|
||||
}
|
||||
else {
|
||||
m_host = addr;
|
||||
m_login_connection_manager.reset(new EQ::Net::DaybreakConnectionManager());
|
||||
|
||||
m_login_connection_manager->OnNewConnection(std::bind(&EverQuest::LoginOnNewConnection, this, std::placeholders::_1));
|
||||
m_login_connection_manager->OnConnectionStateChange(std::bind(&EverQuest::LoginOnStatusChangeReconnectEnabled, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||
m_login_connection_manager->OnPacketRecv(std::bind(&EverQuest::LoginOnPacketRecv, this, std::placeholders::_1, std::placeholders::_2));
|
||||
|
||||
m_login_connection_manager->Connect(m_host, m_port);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
EverQuest::~EverQuest()
|
||||
{
|
||||
}
|
||||
|
||||
void EverQuest::LoginOnNewConnection(std::shared_ptr<EQ::Net::DaybreakConnection> connection)
|
||||
{
|
||||
m_login_connection = connection;
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "Connecting...");
|
||||
}
|
||||
|
||||
void EverQuest::LoginOnStatusChangeReconnectEnabled(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
|
||||
{
|
||||
if (to == EQ::Net::StatusConnected) {
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "Login connected.");
|
||||
LoginSendSessionReady();
|
||||
}
|
||||
|
||||
if (to == EQ::Net::StatusDisconnected) {
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "Login connection lost before we got to world, reconnecting.");
|
||||
m_key.clear();
|
||||
m_dbid = 0;
|
||||
m_login_connection.reset();
|
||||
m_login_connection_manager->Connect(m_host, m_port);
|
||||
}
|
||||
}
|
||||
|
||||
void EverQuest::LoginOnStatusChangeReconnectDisabled(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
|
||||
{
|
||||
if (to == EQ::Net::StatusDisconnected) {
|
||||
m_login_connection.reset();
|
||||
}
|
||||
}
|
||||
|
||||
void EverQuest::LoginOnPacketRecv(std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet & p)
|
||||
{
|
||||
auto opcode = p.GetUInt16(0);
|
||||
switch (opcode) {
|
||||
case 0x0017: //OP_ChatMessage
|
||||
LoginSendLogin();
|
||||
break;
|
||||
case 0x0018:
|
||||
LoginProcessLoginResponse(p);
|
||||
break;
|
||||
case 0x0019:
|
||||
LoginProcessServerPacketList(p);
|
||||
break;
|
||||
case 0x0022:
|
||||
LoginProcessServerPlayResponse(p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void EverQuest::LoginSendSessionReady()
|
||||
{
|
||||
EQ::Net::DynamicPacket p;
|
||||
p.PutUInt16(0, 1); //OP_SessionReady
|
||||
p.PutUInt32(2, 2);
|
||||
|
||||
m_login_connection->QueuePacket(p);
|
||||
}
|
||||
|
||||
void EverQuest::LoginSendLogin()
|
||||
{
|
||||
size_t buffer_len = m_user.length() + m_pass.length() + 2;
|
||||
std::unique_ptr<char[]> buffer(new char[buffer_len]);
|
||||
|
||||
strcpy(&buffer[0], m_user.c_str());
|
||||
strcpy(&buffer[m_user.length() + 1], m_pass.c_str());
|
||||
|
||||
size_t encrypted_len = buffer_len;
|
||||
|
||||
if (encrypted_len % 8 > 0) {
|
||||
encrypted_len = ((encrypted_len / 8) + 1) * 8;
|
||||
}
|
||||
|
||||
EQ::Net::DynamicPacket p;
|
||||
p.Resize(12 + encrypted_len);
|
||||
p.PutUInt16(0, 2); //OP_Login
|
||||
p.PutUInt32(2, 3);
|
||||
|
||||
eqcrypt_block(&buffer[0], buffer_len, (char*)p.Data() + 12, true);
|
||||
|
||||
m_login_connection->QueuePacket(p);
|
||||
}
|
||||
|
||||
void EverQuest::LoginSendServerRequest()
|
||||
{
|
||||
EQ::Net::DynamicPacket p;
|
||||
p.PutUInt16(0, 4); //OP_ServerListRequest
|
||||
p.PutUInt32(2, 4);
|
||||
|
||||
m_login_connection->QueuePacket(p);
|
||||
}
|
||||
|
||||
void EverQuest::LoginSendPlayRequest(uint32_t id)
|
||||
{
|
||||
EQ::Net::DynamicPacket p;
|
||||
p.PutUInt16(0, 0x000d);
|
||||
p.PutUInt16(2, 5);
|
||||
p.PutUInt32(4, 0);
|
||||
p.PutUInt32(8, 0);
|
||||
p.PutUInt32(12, id);
|
||||
|
||||
m_login_connection->QueuePacket(p);
|
||||
}
|
||||
|
||||
void EverQuest::LoginProcessLoginResponse(const EQ::Net::Packet & p)
|
||||
{
|
||||
auto encrypt_size = p.Length() - 12;
|
||||
if (encrypt_size % 8 > 0) {
|
||||
encrypt_size = (encrypt_size / 8) * 8;
|
||||
}
|
||||
|
||||
std::unique_ptr<char[]> decrypted(new char[encrypt_size]);
|
||||
|
||||
eqcrypt_block((char*)p.Data() + 12, encrypt_size, &decrypted[0], false);
|
||||
|
||||
EQ::Net::StaticPacket sp(&decrypted[0], encrypt_size);
|
||||
auto response_error = sp.GetUInt16(1);
|
||||
|
||||
if (response_error > 101) {
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "Error logging in response code: {0}", response_error);
|
||||
LoginDisableReconnect();
|
||||
}
|
||||
else {
|
||||
m_key = sp.GetCString(12);
|
||||
m_dbid = sp.GetUInt32(8);
|
||||
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "Logged in successfully with dbid {0} and key {1}", m_dbid, m_key);
|
||||
LoginSendServerRequest();
|
||||
}
|
||||
}
|
||||
|
||||
void EverQuest::LoginProcessServerPacketList(const EQ::Net::Packet & p)
|
||||
{
|
||||
m_world_servers.clear();
|
||||
auto number_of_servers = p.GetUInt32(18);
|
||||
size_t idx = 22;
|
||||
|
||||
for (auto i = 0U; i < number_of_servers; ++i) {
|
||||
WorldServer ws;
|
||||
ws.address = p.GetCString(idx);
|
||||
idx += (ws.address.length() + 1);
|
||||
|
||||
ws.type = p.GetInt32(idx);
|
||||
idx += 4;
|
||||
|
||||
auto id = p.GetUInt32(idx);
|
||||
idx += 4;
|
||||
|
||||
ws.long_name = p.GetCString(idx);
|
||||
idx += (ws.long_name.length() + 1);
|
||||
|
||||
ws.lang = p.GetCString(idx);
|
||||
idx += (ws.lang.length() + 1);
|
||||
|
||||
ws.region = p.GetCString(idx);
|
||||
idx += (ws.region.length() + 1);
|
||||
|
||||
ws.status = p.GetInt32(idx);
|
||||
idx += 4;
|
||||
|
||||
ws.players = p.GetInt32(idx);
|
||||
idx += 4;
|
||||
|
||||
m_world_servers[id] = ws;
|
||||
}
|
||||
|
||||
for (auto server : m_world_servers) {
|
||||
if (server.second.long_name.compare(m_server) == 0) {
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "Found world server {0}, attempting to login.", m_server);
|
||||
LoginSendPlayRequest(server.first);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "Got response from login server but could not find world server {0} disconnecting.", m_server);
|
||||
LoginDisableReconnect();
|
||||
}
|
||||
|
||||
void EverQuest::LoginProcessServerPlayResponse(const EQ::Net::Packet &p)
|
||||
{
|
||||
auto allowed = p.GetUInt8(12);
|
||||
|
||||
if (allowed) {
|
||||
auto server = p.GetUInt32(18);
|
||||
auto ws = m_world_servers.find(server);
|
||||
if (ws != m_world_servers.end()) {
|
||||
ConnectToWorld();
|
||||
LoginDisableReconnect();
|
||||
}
|
||||
}
|
||||
else {
|
||||
auto message = p.GetUInt16(13);
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "Failed to login to server with message {0}");
|
||||
LoginDisableReconnect();
|
||||
}
|
||||
}
|
||||
|
||||
void EverQuest::LoginDisableReconnect()
|
||||
{
|
||||
m_login_connection_manager->OnConnectionStateChange(std::bind(&EverQuest::LoginOnStatusChangeReconnectDisabled, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||
m_login_connection->Close();
|
||||
}
|
||||
|
||||
void EverQuest::ConnectToWorld()
|
||||
{
|
||||
m_world_connection_manager.reset(new EQ::Net::DaybreakConnectionManager());
|
||||
m_world_connection_manager->OnNewConnection(std::bind(&EverQuest::WorldOnNewConnection, this, std::placeholders::_1));
|
||||
m_world_connection_manager->OnConnectionStateChange(std::bind(&EverQuest::WorldOnStatusChangeReconnectEnabled, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||
m_world_connection_manager->OnPacketRecv(std::bind(&EverQuest::WorldOnPacketRecv, this, std::placeholders::_1, std::placeholders::_2));
|
||||
m_world_connection_manager->Connect(m_host, 9000);
|
||||
}
|
||||
|
||||
void EverQuest::WorldOnNewConnection(std::shared_ptr<EQ::Net::DaybreakConnection> connection)
|
||||
{
|
||||
m_world_connection = connection;
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "Connecting to world...");
|
||||
}
|
||||
|
||||
void EverQuest::WorldOnStatusChangeReconnectEnabled(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
|
||||
{
|
||||
if (to == EQ::Net::StatusConnected) {
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "World connected.");
|
||||
WorldSendClientAuth();
|
||||
}
|
||||
|
||||
if (to == EQ::Net::StatusDisconnected) {
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "World connection lost, reconnecting.");
|
||||
m_world_connection.reset();
|
||||
m_world_connection_manager->Connect(m_host, 9000);
|
||||
}
|
||||
}
|
||||
|
||||
void EverQuest::WorldOnStatusChangeReconnectDisabled(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
|
||||
{
|
||||
if (to == EQ::Net::StatusDisconnected) {
|
||||
m_world_connection.reset();
|
||||
}
|
||||
}
|
||||
|
||||
void EverQuest::WorldOnPacketRecv(std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet & p)
|
||||
{
|
||||
auto opcode = p.GetUInt16(0);
|
||||
switch (opcode) {
|
||||
case 0x00d2:
|
||||
WorldProcessCharacterSelect(p);
|
||||
break;
|
||||
default:
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "Unhandled opcode: {0:#x}", opcode);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void EverQuest::WorldSendClientAuth()
|
||||
{
|
||||
EQ::Net::DynamicPacket p;
|
||||
p.Resize(2 + 464);
|
||||
|
||||
p.PutUInt16(0, 0x7a09U);
|
||||
std::string dbid_str = std::to_string(m_dbid);
|
||||
|
||||
p.PutCString(2, dbid_str.c_str());
|
||||
p.PutCString(2 + dbid_str.length() + 1, m_key.c_str());
|
||||
|
||||
m_world_connection->QueuePacket(p);
|
||||
}
|
||||
|
||||
void EverQuest::WorldSendEnterWorld(const std::string &character)
|
||||
{
|
||||
EQ::Net::DynamicPacket p;
|
||||
p.PutUInt16(0, 0x578f);
|
||||
p.PutString(2, character);
|
||||
p.PutUInt32(66, 0);
|
||||
p.PutUInt32(70, 0);
|
||||
|
||||
m_world_connection->QueuePacket(p);
|
||||
}
|
||||
|
||||
void EverQuest::WorldProcessCharacterSelect(const EQ::Net::Packet &p)
|
||||
{
|
||||
auto char_count = p.GetUInt32(2);
|
||||
size_t idx = 6;
|
||||
|
||||
//Log.OutF(Logs::General, Logs::Headless_Client, "{0} characters", char_count);
|
||||
for (uint32_t i = 0; i < char_count; ++i) {
|
||||
auto name = p.GetCString(idx);
|
||||
idx += name.length() + 1;
|
||||
|
||||
auto pclass = p.GetUInt8(idx);
|
||||
auto prace = p.GetUInt32(idx + 1);
|
||||
auto plevel = p.GetUInt8(idx + 5);
|
||||
|
||||
idx += 274;
|
||||
if (m_character.compare(name) == 0) {
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "Found {0}, would attempt to login here.", m_character);
|
||||
WorldSendEnterWorld(m_character);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "Could not find {0}, cannot continue to login.", m_character);
|
||||
}
|
||||
|
||||
74
hc/eq.h
74
hc/eq.h
@ -1,74 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "../common/eqemu_logsys.h"
|
||||
#include "../common/net/daybreak_connection.h"
|
||||
#include "../common/event/timer.h"
|
||||
#include <openssl/des.h>
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
struct WorldServer
|
||||
{
|
||||
std::string long_name;
|
||||
std::string address;
|
||||
int type;
|
||||
std::string lang;
|
||||
std::string region;
|
||||
int status;
|
||||
int players;
|
||||
};
|
||||
|
||||
class EverQuest
|
||||
{
|
||||
public:
|
||||
EverQuest(const std::string &host, int port, const std::string &user, const std::string &pass, const std::string &server, const std::string &character);
|
||||
~EverQuest();
|
||||
|
||||
private:
|
||||
//Login
|
||||
void LoginOnNewConnection(std::shared_ptr<EQ::Net::DaybreakConnection> connection);
|
||||
void LoginOnStatusChangeReconnectEnabled(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
|
||||
void LoginOnStatusChangeReconnectDisabled(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
|
||||
void LoginOnPacketRecv(std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet &p);
|
||||
|
||||
void LoginSendSessionReady();
|
||||
void LoginSendLogin();
|
||||
void LoginSendServerRequest();
|
||||
void LoginSendPlayRequest(uint32_t id);
|
||||
void LoginProcessLoginResponse(const EQ::Net::Packet &p);
|
||||
void LoginProcessServerPacketList(const EQ::Net::Packet &p);
|
||||
void LoginProcessServerPlayResponse(const EQ::Net::Packet &p);
|
||||
|
||||
void LoginDisableReconnect();
|
||||
|
||||
std::unique_ptr<EQ::Net::DaybreakConnectionManager> m_login_connection_manager;
|
||||
std::shared_ptr<EQ::Net::DaybreakConnection> m_login_connection;
|
||||
std::map<uint32_t, WorldServer> m_world_servers;
|
||||
|
||||
//World
|
||||
void ConnectToWorld();
|
||||
|
||||
void WorldOnNewConnection(std::shared_ptr<EQ::Net::DaybreakConnection> connection);
|
||||
void WorldOnStatusChangeReconnectEnabled(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
|
||||
void WorldOnStatusChangeReconnectDisabled(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
|
||||
void WorldOnPacketRecv(std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet &p);
|
||||
|
||||
void WorldSendClientAuth();
|
||||
void WorldSendEnterWorld(const std::string &character);
|
||||
|
||||
void WorldProcessCharacterSelect(const EQ::Net::Packet &p);
|
||||
|
||||
std::unique_ptr<EQ::Net::DaybreakConnectionManager> m_world_connection_manager;
|
||||
std::shared_ptr<EQ::Net::DaybreakConnection> m_world_connection;
|
||||
|
||||
//Variables
|
||||
std::string m_host;
|
||||
int m_port;
|
||||
std::string m_user;
|
||||
std::string m_pass;
|
||||
std::string m_server;
|
||||
std::string m_character;
|
||||
|
||||
std::string m_key;
|
||||
uint32_t m_dbid;
|
||||
};
|
||||
255
hc/login.cpp
255
hc/login.cpp
@ -1,255 +0,0 @@
|
||||
/*#include "login.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
#include <openssl/des.h>
|
||||
|
||||
const char* eqcrypt_block(const char *buffer_in, size_t buffer_in_sz, char* buffer_out, bool enc) {
|
||||
DES_key_schedule k;
|
||||
DES_cblock v;
|
||||
|
||||
memset(&k, 0, sizeof(DES_key_schedule));
|
||||
memset(&v, 0, sizeof(DES_cblock));
|
||||
|
||||
if (!enc && buffer_in_sz && buffer_in_sz % 8 != 0) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
DES_ncbc_encrypt((const unsigned char*)buffer_in, (unsigned char*)buffer_out, (long)buffer_in_sz, &k, &v, enc);
|
||||
return buffer_out;
|
||||
}
|
||||
|
||||
LoginConnection::LoginConnection(const std::string &username, const std::string &password, const std::string &host, int host_port, const std::string &server)
|
||||
{
|
||||
m_connecting = false;
|
||||
m_username = username;
|
||||
m_password = password;
|
||||
m_host = host;
|
||||
m_host_port = host_port;
|
||||
m_server = server;
|
||||
|
||||
m_connection_manager.reset(new EQ::Net::DaybreakConnectionManager());
|
||||
|
||||
m_connection_manager->OnNewConnection(std::bind(&LoginConnection::OnNewConnection, this, std::placeholders::_1));
|
||||
m_connection_manager->OnConnectionStateChange(std::bind(&LoginConnection::OnStatusChangeActive, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||
m_connection_manager->OnPacketRecv(std::bind(&LoginConnection::OnPacketRecv, this, std::placeholders::_1, std::placeholders::_2));
|
||||
|
||||
m_connection_manager->Connect(host, host_port);
|
||||
}
|
||||
|
||||
LoginConnection::~LoginConnection()
|
||||
{
|
||||
}
|
||||
|
||||
void LoginConnection::OnNewConnection(std::shared_ptr<EQ::Net::DaybreakConnection> connection)
|
||||
{
|
||||
m_connection = connection;
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "Connecting...");
|
||||
}
|
||||
|
||||
void LoginConnection::OnStatusChangeActive(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
|
||||
{
|
||||
if (to == EQ::Net::StatusConnected) {
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "Login connected.");
|
||||
SendSessionReady();
|
||||
}
|
||||
|
||||
if (to == EQ::Net::StatusDisconnected) {
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "Login connection lost, reconnecting.");
|
||||
m_key.clear();
|
||||
m_dbid = 0;
|
||||
m_connection.reset();
|
||||
m_connection_manager->Connect(m_host, m_host_port);
|
||||
}
|
||||
}
|
||||
|
||||
void LoginConnection::OnStatusChangeInactive(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
|
||||
{
|
||||
if (to == EQ::Net::StatusDisconnected) {
|
||||
m_key.clear();
|
||||
m_dbid = 0;
|
||||
m_connection.reset();
|
||||
}
|
||||
}
|
||||
|
||||
void LoginConnection::OnPacketRecv(std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet &p)
|
||||
{
|
||||
auto opcode = p.GetUInt16(0);
|
||||
switch (opcode) {
|
||||
case 0x0017: //OP_ChatMessage
|
||||
SendLogin();
|
||||
break;
|
||||
case 0x0018:
|
||||
ProcessLoginResponse(p);
|
||||
break;
|
||||
case 0x0019:
|
||||
ProcessServerPacketList(p);
|
||||
break;
|
||||
case 0x0022:
|
||||
ProcessServerPlayResponse(p);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void LoginConnection::Kill()
|
||||
{
|
||||
m_connection_manager->OnConnectionStateChange(std::bind(&LoginConnection::OnStatusChangeInactive, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||
m_key.clear();
|
||||
m_dbid = 0;
|
||||
m_connection->Close();
|
||||
}
|
||||
|
||||
void LoginConnection::Start()
|
||||
{
|
||||
m_connection_manager->OnConnectionStateChange(std::bind(&LoginConnection::OnStatusChangeActive, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||
m_connection_manager->Connect(m_host, m_host_port);
|
||||
}
|
||||
|
||||
void LoginConnection::SendSessionReady()
|
||||
{
|
||||
EQ::Net::DynamicPacket p;
|
||||
p.PutUInt16(0, 1); //OP_SessionReady
|
||||
p.PutUInt32(2, 2);
|
||||
|
||||
m_connection->QueuePacket(p);
|
||||
}
|
||||
|
||||
void LoginConnection::SendLogin()
|
||||
{
|
||||
size_t buffer_len = m_username.length() + m_password.length() + 2;
|
||||
std::unique_ptr<char[]> buffer(new char[buffer_len]);
|
||||
|
||||
strcpy(&buffer[0], m_username.c_str());
|
||||
strcpy(&buffer[m_username.length() + 1], m_password.c_str());
|
||||
|
||||
size_t encrypted_len = buffer_len;
|
||||
|
||||
if (encrypted_len % 8 > 0) {
|
||||
encrypted_len = ((encrypted_len / 8) + 1) * 8;
|
||||
}
|
||||
|
||||
EQ::Net::DynamicPacket p;
|
||||
p.Resize(12 + encrypted_len);
|
||||
p.PutUInt16(0, 2); //OP_Login
|
||||
p.PutUInt32(2, 3);
|
||||
|
||||
eqcrypt_block(&buffer[0], buffer_len, (char*)p.Data() + 12, true);
|
||||
|
||||
m_connection->QueuePacket(p);
|
||||
}
|
||||
|
||||
void LoginConnection::SendServerRequest()
|
||||
{
|
||||
EQ::Net::DynamicPacket p;
|
||||
p.PutUInt16(0, 4); //OP_ServerListRequest
|
||||
p.PutUInt32(2, 4);
|
||||
|
||||
m_connection->QueuePacket(p);
|
||||
}
|
||||
|
||||
void LoginConnection::SendPlayRequest(uint32_t id)
|
||||
{
|
||||
EQ::Net::DynamicPacket p;
|
||||
p.PutUInt16(0, 0x000d);
|
||||
p.PutUInt16(2, 5);
|
||||
p.PutUInt32(4, 0);
|
||||
p.PutUInt32(8, 0);
|
||||
p.PutUInt32(12, id);
|
||||
|
||||
m_connection->QueuePacket(p);
|
||||
}
|
||||
|
||||
void LoginConnection::ProcessLoginResponse(const EQ::Net::Packet &p)
|
||||
{
|
||||
auto encrypt_size = p.Length() - 12;
|
||||
if (encrypt_size % 8 > 0) {
|
||||
encrypt_size = (encrypt_size / 8) * 8;
|
||||
}
|
||||
|
||||
std::unique_ptr<char[]> decrypted(new char[encrypt_size]);
|
||||
|
||||
eqcrypt_block((char*)p.Data() + 12, encrypt_size, &decrypted[0], false);
|
||||
|
||||
EQ::Net::StaticPacket sp(&decrypted[0], encrypt_size);
|
||||
auto response_error = sp.GetUInt16(1);
|
||||
|
||||
if (response_error > 101) {
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "Error logging in response code: {0}", response_error);
|
||||
Kill();
|
||||
}
|
||||
else {
|
||||
m_key = sp.GetCString(12);
|
||||
m_dbid = sp.GetUInt32(8);
|
||||
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "Logged in successfully with dbid {0} and key {1}", m_dbid, m_key);
|
||||
SendServerRequest();
|
||||
}
|
||||
}
|
||||
|
||||
void LoginConnection::ProcessServerPacketList(const EQ::Net::Packet &p)
|
||||
{
|
||||
m_world_servers.clear();
|
||||
auto number_of_servers = p.GetUInt32(18);
|
||||
size_t idx = 22;
|
||||
|
||||
for (auto i = 0U; i < number_of_servers; ++i) {
|
||||
WorldServer ws;
|
||||
ws.address = p.GetCString(idx);
|
||||
idx += (ws.address.length() + 1);
|
||||
|
||||
ws.type = p.GetInt32(idx);
|
||||
idx += 4;
|
||||
|
||||
auto id = p.GetUInt32(idx);
|
||||
idx += 4;
|
||||
|
||||
ws.long_name = p.GetCString(idx);
|
||||
idx += (ws.long_name.length() + 1);
|
||||
|
||||
ws.lang = p.GetCString(idx);
|
||||
idx += (ws.lang.length() + 1);
|
||||
|
||||
ws.region = p.GetCString(idx);
|
||||
idx += (ws.region.length() + 1);
|
||||
|
||||
ws.status = p.GetInt32(idx);
|
||||
idx += 4;
|
||||
|
||||
ws.players = p.GetInt32(idx);
|
||||
idx += 4;
|
||||
|
||||
m_world_servers[id] = ws;
|
||||
}
|
||||
|
||||
for (auto server : m_world_servers) {
|
||||
if (server.second.long_name.compare(m_server) == 0) {
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "Found world server {0}, attempting to login.", m_server);
|
||||
SendPlayRequest(server.first);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "Got response from login server but could not find world server {0} disconnecting.", m_server);
|
||||
Kill();
|
||||
}
|
||||
|
||||
void LoginConnection::ProcessServerPlayResponse(const EQ::Net::Packet &p)
|
||||
{
|
||||
auto allowed = p.GetUInt8(12);
|
||||
|
||||
if (allowed) {
|
||||
auto server = p.GetUInt32(18);
|
||||
auto ws = m_world_servers.find(server);
|
||||
if (ws != m_world_servers.end()) {
|
||||
if (m_on_can_login_world) {
|
||||
m_on_can_login_world(ws->second, m_key, m_dbid);
|
||||
}
|
||||
|
||||
Kill();
|
||||
}
|
||||
}
|
||||
else {
|
||||
auto message = p.GetUInt16(13);
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "Failed to login to server with message {0}");
|
||||
Kill();
|
||||
}
|
||||
}
|
||||
*/
|
||||
56
hc/login.h
56
hc/login.h
@ -1,56 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "../common/net/daybreak_connection.h"
|
||||
#include "../common/event/timer.h"
|
||||
#include <map>
|
||||
|
||||
struct WorldServer
|
||||
{
|
||||
std::string long_name;
|
||||
std::string address;
|
||||
int type;
|
||||
std::string lang;
|
||||
std::string region;
|
||||
int status;
|
||||
int players;
|
||||
};
|
||||
|
||||
class LoginConnection
|
||||
{
|
||||
public:
|
||||
LoginConnection(const std::string &username, const std::string &password, const std::string &host, int host_port, const std::string &server);
|
||||
void OnCanLoginToWorld(std::function<void(const WorldServer&, const std::string&, uint32_t)> cb) { m_on_can_login_world = cb; }
|
||||
|
||||
~LoginConnection();
|
||||
private:
|
||||
void OnNewConnection(std::shared_ptr<EQ::Net::DaybreakConnection> connection);
|
||||
void OnStatusChangeActive(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
|
||||
void OnStatusChangeInactive(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
|
||||
void OnPacketRecv(std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet &p);
|
||||
void Kill();
|
||||
void Start();
|
||||
|
||||
void SendSessionReady();
|
||||
void SendLogin();
|
||||
void SendServerRequest();
|
||||
void SendPlayRequest(uint32_t id);
|
||||
void ProcessLoginResponse(const EQ::Net::Packet &p);
|
||||
void ProcessServerPacketList(const EQ::Net::Packet &p);
|
||||
void ProcessServerPlayResponse(const EQ::Net::Packet &p);
|
||||
|
||||
std::unique_ptr<EQ::Net::DaybreakConnectionManager> m_connection_manager;
|
||||
std::shared_ptr<EQ::Net::DaybreakConnection> m_connection;
|
||||
bool m_connecting;
|
||||
std::unique_ptr<EQ::Timer> m_connect_timer;
|
||||
|
||||
std::string m_username;
|
||||
std::string m_password;
|
||||
std::string m_host;
|
||||
int m_host_port;
|
||||
std::string m_server;
|
||||
|
||||
std::string m_key;
|
||||
uint32_t m_dbid;
|
||||
std::map<uint32_t, WorldServer> m_world_servers;
|
||||
std::function<void(const WorldServer&, const std::string&, uint32_t)> m_on_can_login_world;
|
||||
};
|
||||
51
hc/main.cpp
51
hc/main.cpp
@ -1,51 +0,0 @@
|
||||
#include "../common/event/event_loop.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
#include "../common/crash.h"
|
||||
#include "../common/platform.h"
|
||||
#include "../common/json_config.h"
|
||||
#include <thread>
|
||||
|
||||
#include "eq.h"
|
||||
|
||||
EQEmuLogSys Log;
|
||||
|
||||
int main() {
|
||||
RegisterExecutablePlatform(ExePlatformHC);
|
||||
Log.LoadLogSettingsDefaults();
|
||||
set_exception_handler();
|
||||
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "Starting EQEmu Headless Client.");
|
||||
|
||||
auto config = EQ::JsonConfigFile::Load("hc.json");
|
||||
auto config_handle = config.RawHandle();
|
||||
|
||||
std::vector<std::unique_ptr<EverQuest>> eq_list;
|
||||
|
||||
try {
|
||||
for (int i = 0; i < config_handle.size(); ++i) {
|
||||
auto c = config_handle[i];
|
||||
|
||||
auto host = c["host"].asString();
|
||||
auto port = c["port"].asInt();
|
||||
auto user = c["user"].asString();
|
||||
auto pass = c["pass"].asString();
|
||||
auto server = c["server"].asString();
|
||||
auto character = c["character"].asString();
|
||||
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "Connecting to {0}:{1} as Account '{2}' to Server '{3}' under Character '{4}'", host, port, user, server, character);
|
||||
|
||||
eq_list.push_back(std::unique_ptr<EverQuest>(new EverQuest(host, port, user, pass, server, character)));
|
||||
}
|
||||
}
|
||||
catch (std::exception &ex) {
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "Error parsing config file: {0}", ex.what());
|
||||
return 0;
|
||||
}
|
||||
|
||||
for (;;) {
|
||||
EQ::EventLoop::Get().Process();
|
||||
std::this_thread::sleep_for(std::chrono::milliseconds(1));
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
78
hc/world.cpp
78
hc/world.cpp
@ -1,78 +0,0 @@
|
||||
#include "world.h"
|
||||
#include "../common/eqemu_logsys.h"
|
||||
|
||||
WorldConnection::WorldConnection(const std::string &key, uint32_t dbid, const std::string &host)
|
||||
{
|
||||
m_connecting = false;
|
||||
m_host = host;
|
||||
m_key = key;
|
||||
m_dbid = dbid;
|
||||
|
||||
m_connection_manager.reset(new EQ::Net::DaybreakConnectionManager());
|
||||
m_connection_manager->OnNewConnection(std::bind(&WorldConnection::OnNewConnection, this, std::placeholders::_1));
|
||||
m_connection_manager->OnConnectionStateChange(std::bind(&WorldConnection::OnStatusChangeActive, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||
m_connection_manager->OnPacketRecv(std::bind(&WorldConnection::OnPacketRecv, this, std::placeholders::_1, std::placeholders::_2));
|
||||
m_connection_manager->Connect(host, 9000);
|
||||
}
|
||||
|
||||
WorldConnection::~WorldConnection() {
|
||||
}
|
||||
|
||||
void WorldConnection::OnNewConnection(std::shared_ptr<EQ::Net::DaybreakConnection> connection)
|
||||
{
|
||||
m_connection = connection;
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "Connecting to world...");
|
||||
}
|
||||
|
||||
void WorldConnection::OnStatusChangeActive(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
|
||||
{
|
||||
if (to == EQ::Net::StatusConnected) {
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "World connected.");
|
||||
SendClientAuth();
|
||||
}
|
||||
|
||||
if (to == EQ::Net::StatusDisconnected) {
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "World connection lost, reconnecting.");
|
||||
m_connection.reset();
|
||||
m_connection_manager->Connect(m_host, 9000);
|
||||
}
|
||||
}
|
||||
|
||||
void WorldConnection::OnStatusChangeInactive(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
|
||||
{
|
||||
if (to == EQ::Net::StatusDisconnected) {
|
||||
m_connection.reset();
|
||||
}
|
||||
}
|
||||
|
||||
void WorldConnection::OnPacketRecv(std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet &p)
|
||||
{
|
||||
auto opcode = p.GetUInt16(0);
|
||||
Log.OutF(Logs::General, Logs::Headless_Client, "Packet in:\n{0}", p.ToString());
|
||||
}
|
||||
|
||||
void WorldConnection::Kill()
|
||||
{
|
||||
m_connection_manager->OnConnectionStateChange(std::bind(&WorldConnection::OnStatusChangeInactive, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||
m_connection->Close();
|
||||
}
|
||||
|
||||
void WorldConnection::Start()
|
||||
{
|
||||
m_connection_manager->OnConnectionStateChange(std::bind(&WorldConnection::OnStatusChangeActive, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||
m_connection_manager->Connect(m_host, 9000);
|
||||
}
|
||||
|
||||
void WorldConnection::SendClientAuth()
|
||||
{
|
||||
EQ::Net::DynamicPacket p;
|
||||
p.Resize(2 + 464);
|
||||
|
||||
p.PutUInt16(0, 0x7a09U);
|
||||
std::string dbid_str = std::to_string(m_dbid);
|
||||
|
||||
p.PutCString(2, dbid_str.c_str());
|
||||
p.PutCString(2 + dbid_str.length() + 1, m_key.c_str());
|
||||
|
||||
m_connection->QueuePacket(p);
|
||||
}
|
||||
31
hc/world.h
31
hc/world.h
@ -1,31 +0,0 @@
|
||||
#pragma once
|
||||
|
||||
#include "../common/net/daybreak_connection.h"
|
||||
#include "../common/event/timer.h"
|
||||
#include <map>
|
||||
|
||||
class WorldConnection
|
||||
{
|
||||
public:
|
||||
WorldConnection(const std::string &key, uint32_t dbid, const std::string &host);
|
||||
~WorldConnection();
|
||||
private:
|
||||
void OnNewConnection(std::shared_ptr<EQ::Net::DaybreakConnection> connection);
|
||||
void OnStatusChangeActive(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
|
||||
void OnStatusChangeInactive(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
|
||||
void OnPacketRecv(std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet &p);
|
||||
void Kill();
|
||||
void Start();
|
||||
|
||||
void SendClientAuth();
|
||||
|
||||
std::unique_ptr<EQ::Net::DaybreakConnectionManager> m_connection_manager;
|
||||
std::shared_ptr<EQ::Net::DaybreakConnection> m_connection;
|
||||
bool m_connecting;
|
||||
std::unique_ptr<EQ::Timer> m_connect_timer;
|
||||
|
||||
std::string m_host;
|
||||
|
||||
std::string m_key;
|
||||
uint32_t m_dbid;
|
||||
};
|
||||
@ -1,7 +1,7 @@
|
||||
IF(EQEMU_BUILD_LUA)
|
||||
ADD_SUBDIRECTORY(luabind)
|
||||
ENDIF(EQEMU_BUILD_LUA)
|
||||
if(EQEMU_BUILD_LUA)
|
||||
add_subdirectory(luabind)
|
||||
endif()
|
||||
|
||||
IF(EQEMU_BUILD_PERL)
|
||||
ADD_SUBDIRECTORY(perlbind)
|
||||
ENDIF(EQEMU_BUILD_PERL)
|
||||
if(EQEMU_BUILD_PERL)
|
||||
add_subdirectory(perlbind)
|
||||
endif()
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.12)
|
||||
cmake_minimum_required(VERSION 3.20.0)
|
||||
|
||||
SET(lb_sources
|
||||
set(lb_sources
|
||||
src/class.cpp
|
||||
src/class_info.cpp
|
||||
src/class_registry.cpp
|
||||
@ -20,19 +20,16 @@ SET(lb_sources
|
||||
src/wrapper_base.cpp
|
||||
)
|
||||
|
||||
SET(lb_headers
|
||||
add_library(luabind ${lb_sources})
|
||||
target_include_directories(luabind PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${LUAJIT_INCLUDE_DIR})
|
||||
target_link_libraries(luabind PUBLIC Boost::dynamic_bitset Boost::tuple Boost::foreach ${LUAJIT_LIBRARY})
|
||||
|
||||
)
|
||||
|
||||
ADD_LIBRARY(luabind ${lb_sources} ${lb_headers})
|
||||
|
||||
|
||||
IF(UNIX)
|
||||
if(UNIX)
|
||||
set_source_files_properties(${lb_sources} PROPERTY COMPILE_FLAGS -Wno-deprecated-declarations)
|
||||
ENDIF(UNIX)
|
||||
endif()
|
||||
|
||||
IF(MSVC)
|
||||
if(MSVC)
|
||||
set_source_files_properties(${lb_sources} PROPERTY COMPILE_FLAGS " /W0 " )
|
||||
ENDIF(MSVC)
|
||||
endif()
|
||||
|
||||
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||
|
||||
@ -1,11 +1,7 @@
|
||||
cmake_minimum_required(VERSION 3.7)
|
||||
cmake_minimum_required(VERSION 3.20.0)
|
||||
|
||||
project(perlbind LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".so" ".a")
|
||||
|
||||
find_package(PerlLibs)
|
||||
|
||||
set(PERLBIND_HEADERS
|
||||
include/perlbind/array.h
|
||||
include/perlbind/forward.h
|
||||
|
||||
4
libs/zlibng/.gitattributes
vendored
4
libs/zlibng/.gitattributes
vendored
@ -1,4 +0,0 @@
|
||||
* text=auto
|
||||
*.c text
|
||||
*.h text
|
||||
Makefile text
|
||||
39
libs/zlibng/.github/workflows/analyze.yml
vendored
39
libs/zlibng/.github/workflows/analyze.yml
vendored
@ -1,39 +0,0 @@
|
||||
name: CI Static Analysis
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
GCC-10:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Install packages (Ubuntu)
|
||||
run: |
|
||||
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y gcc-10
|
||||
- name: Generate project files
|
||||
run: |
|
||||
cmake . -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DWITH_FUZZERS=OFF -DWITH_CODE_COVERAGE=OFF -DWITH_MAINTAINER_WARNINGS=OFF
|
||||
env:
|
||||
CC: gcc-10
|
||||
CFLAGS: "-fanalyzer -Werror -Wanalyzer-double-fclose -Wanalyzer-double-free -Wanalyzer-exposure-through-output-file -Wanalyzer-file-leak -Wanalyzer-free-of-non-heap -Wanalyzer-malloc-leak -Wanalyzer-null-argument -Wanalyzer-null-dereference -Wanalyzer-possible-null-argument -Wanalyzer-possible-null-dereference -Wanalyzer-stale-setjmp-buffer -Wanalyzer-tainted-array-index -Wanalyzer-unsafe-call-within-signal-handler -Wanalyzer-use-after-free -Wanalyzer-use-of-pointer-in-stale-stack-frame"
|
||||
CI: true
|
||||
- name: Compile source code
|
||||
run: |
|
||||
cmake --build . --config Release > /dev/null
|
||||
Clang-12:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Install packages (Ubuntu)
|
||||
run: |
|
||||
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
|
||||
sudo apt-add-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main" -y
|
||||
sudo apt install clang-tools-12 -y
|
||||
- name: Generate project files
|
||||
run: |
|
||||
scan-build-12 --status-bugs cmake . -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DWITH_FUZZERS=OFF -DWITH_CODE_COVERAGE=OFF -DWITH_MAINTAINER_WARNINGS=OFF
|
||||
env:
|
||||
CI: true
|
||||
- name: Compile source code
|
||||
run: |
|
||||
scan-build-12 --status-bugs cmake --build . --config Release > /dev/null
|
||||
381
libs/zlibng/.github/workflows/cmake.yml
vendored
381
libs/zlibng/.github/workflows/cmake.yml
vendored
@ -1,381 +0,0 @@
|
||||
name: CI CMake
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
ci-cmake:
|
||||
name: ${{ matrix.name }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: Ubuntu GCC
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
cmake-args: -DWITH_SANITIZER=Address
|
||||
codecov: ubuntu_gcc
|
||||
|
||||
- name: Ubuntu GCC OSB -O1 No Unaligned64
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
cmake-args: -DWITH_UNALIGNED=ON -DUNALIGNED64_OK=OFF -DWITH_SANITIZER=Undefined
|
||||
build-dir: ../build
|
||||
build-src-dir: ../zlib-ng
|
||||
codecov: ubuntu_gcc_osb
|
||||
cflags: -O1 -g3
|
||||
|
||||
- name: Ubuntu GCC -O3 No Unaligned
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
cmake-args: -DWITH_UNALIGNED=OFF
|
||||
codecov: ubuntu_gcc_o3
|
||||
cflags: -O3
|
||||
|
||||
- name: Ubuntu GCC Link Zlib
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
cmake-args: -DZLIB_DUAL_LINK=ON
|
||||
|
||||
- name: Ubuntu GCC No AVX2
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
cmake-args: -DWITH_AVX2=OFF -DWITH_SANITIZER=Undefined
|
||||
codecov: ubuntu_gcc_no_avx2
|
||||
|
||||
- name: Ubuntu GCC No SSE2
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
cmake-args: -DWITH_SSE2=OFF -DWITH_SANITIZER=Undefined
|
||||
codecov: ubuntu_gcc_no_sse2
|
||||
|
||||
- name: Ubuntu GCC No SSE4
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
cmake-args: -DWITH_SSE4=OFF -DWITH_SANITIZER=Undefined
|
||||
codecov: ubuntu_gcc_no_sse4
|
||||
|
||||
- name: Ubuntu GCC No PCLMULQDQ
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
cmake-args: -DWITH_PCLMULQDQ=OFF -DWITH_SANITIZER=Undefined
|
||||
codecov: ubuntu_gcc_no_pclmulqdq
|
||||
|
||||
- name: Ubuntu GCC Compat No Opt
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
cmake-args: -DZLIB_COMPAT=ON -DWITH_NEW_STRATEGIES=OFF -DWITH_OPTIM=OFF -DWITH_SANITIZER=Address
|
||||
codecov: ubuntu_gcc_compat_no_opt
|
||||
cflags: -DNOT_TWEAK_COMPILER
|
||||
|
||||
- name: Ubuntu GCC ARM SF
|
||||
os: ubuntu-latest
|
||||
compiler: arm-linux-gnueabi-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabi -DWITH_SANITIZER=Address
|
||||
packages: qemu gcc-arm-linux-gnueabi libc-dev-armel-cross
|
||||
codecov: ubuntu_gcc_armsf
|
||||
|
||||
- name: Ubuntu GCC ARM SF Compat No Opt
|
||||
os: ubuntu-latest
|
||||
compiler: arm-linux-gnueabi-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabi -DZLIB_COMPAT=ON -DWITH_NEW_STRATEGIES=OFF -DWITH_OPTIM=OFF -DWITH_SANITIZER=Undefined
|
||||
packages: qemu gcc-arm-linux-gnueabi libc-dev-armel-cross
|
||||
codecov: ubuntu_gcc_armsf_compat_no_opt
|
||||
|
||||
- name: Ubuntu GCC ARM HF
|
||||
os: ubuntu-latest
|
||||
compiler: arm-linux-gnueabihf-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabihf -DWITH_SANITIZER=Address
|
||||
packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross
|
||||
codecov: ubuntu_gcc_armhf
|
||||
|
||||
- name: Ubuntu GCC ARM HF No ACLE
|
||||
os: ubuntu-latest
|
||||
compiler: arm-linux-gnueabihf-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabihf -DWITH_ACLE=OFF -DWITH_SANITIZER=Address
|
||||
packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross
|
||||
codecov: ubuntu_gcc_armhf_no_acle
|
||||
|
||||
- name: Ubuntu GCC ARM HF No NEON
|
||||
os: ubuntu-latest
|
||||
compiler: arm-linux-gnueabihf-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabihf -DWITH_NEON=OFF -DWITH_SANITIZER=Address
|
||||
packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross
|
||||
codecov: ubuntu_gcc_armhf_no_neon
|
||||
|
||||
- name: Ubuntu GCC ARM HF Compat No Opt
|
||||
os: ubuntu-latest
|
||||
compiler: arm-linux-gnueabihf-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabihf -DZLIB_COMPAT=ON -DWITH_NEW_STRATEGIES=OFF -DWITH_OPTIM=OFF -DWITH_SANITIZER=Undefined
|
||||
packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross
|
||||
codecov: ubuntu_gcc_armhf_compat_no_opt
|
||||
|
||||
- name: Ubuntu GCC AARCH64
|
||||
os: ubuntu-latest
|
||||
compiler: aarch64-linux-gnu-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-aarch64.cmake -DWITH_SANITIZER=Address
|
||||
asan-options: detect_leaks=0
|
||||
packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross
|
||||
codecov: ubuntu_gcc_aarch64
|
||||
|
||||
- name: Ubuntu GCC AARCH64 No ACLE
|
||||
os: ubuntu-latest
|
||||
compiler: aarch64-linux-gnu-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-aarch64.cmake -DWITH_ACLE=OFF -DWITH_SANITIZER=Undefined
|
||||
asan-options: detect_leaks=0
|
||||
packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross
|
||||
codecov: ubuntu_gcc_aarch64_no_acle
|
||||
|
||||
- name: Ubuntu GCC AARCH64 No NEON
|
||||
os: ubuntu-latest
|
||||
compiler: aarch64-linux-gnu-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-aarch64.cmake -DWITH_NEON=OFF -DWITH_SANITIZER=Undefined
|
||||
asan-options: detect_leaks=0
|
||||
packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross
|
||||
codecov: ubuntu_gcc_aarch64_no_neon
|
||||
|
||||
- name: Ubuntu GCC AARCH64 Compat No Opt
|
||||
os: ubuntu-latest
|
||||
compiler: aarch64-linux-gnu-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-aarch64.cmake -DZLIB_COMPAT=ON -DWITH_NEW_STRATEGIES=OFF -DWITH_OPTIM=OFF -DWITH_SANITIZER=Undefined
|
||||
asan-options: detect_leaks=0
|
||||
packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross
|
||||
codecov: ubuntu_gcc_aarch64_compat_no_opt
|
||||
|
||||
- name: Ubuntu GCC PPC
|
||||
os: ubuntu-latest
|
||||
compiler: powerpc-linux-gnu-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-powerpc.cmake
|
||||
packages: qemu gcc-powerpc-linux-gnu libc-dev-powerpc-cross
|
||||
ldflags: -static
|
||||
codecov: ubuntu_gcc_ppc
|
||||
|
||||
- name: Ubuntu GCC PPC64
|
||||
os: ubuntu-latest
|
||||
compiler: powerpc64-linux-gnu-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-powerpc64.cmake
|
||||
packages: qemu gcc-powerpc64-linux-gnu libc-dev-ppc64-cross
|
||||
ldflags: -static
|
||||
codecov: ubuntu_gcc_ppc64
|
||||
|
||||
- name: Ubuntu GCC PPC64LE
|
||||
os: ubuntu-latest
|
||||
compiler: powerpc64le-linux-gnu-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-powerpc64le.cmake
|
||||
packages: qemu gcc-powerpc64le-linux-gnu libc-dev-ppc64el-cross
|
||||
codecov: ubuntu_gcc_ppc64le
|
||||
|
||||
- name: Ubuntu GCC SPARC64
|
||||
os: ubuntu-latest
|
||||
compiler: sparc64-linux-gnu-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-sparc64.cmake
|
||||
packages: qemu gcc-sparc64-linux-gnu libc-dev-sparc64-cross
|
||||
ldflags: -static
|
||||
codecov: ubuntu_gcc_sparc64
|
||||
|
||||
- name: Ubuntu GCC S390X
|
||||
os: ubuntu-latest
|
||||
compiler: s390x-linux-gnu-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-s390x.cmake -DWITH_SANITIZER=Address
|
||||
packages: qemu gcc-s390x-linux-gnu libc-dev-s390x-cross
|
||||
ldflags: -static
|
||||
codecov: ubuntu_gcc_s390x
|
||||
|
||||
- name: Ubuntu GCC S390X DFLTCC
|
||||
os: ubuntu-latest
|
||||
compiler: s390x-linux-gnu-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-s390x.cmake -DWITH_DFLTCC_DEFLATE=ON -DWITH_DFLTCC_INFLATE=ON -DWITH_SANITIZER=Address
|
||||
packages: qemu gcc-s390x-linux-gnu libc-dev-s390x-cross
|
||||
ldflags: -static
|
||||
codecov: ubuntu_gcc_s390x
|
||||
|
||||
- name: Ubuntu GCC S390X DFLTCC Compat
|
||||
os: ubuntu-latest
|
||||
compiler: s390x-linux-gnu-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-s390x.cmake -DZLIB_COMPAT=ON -DWITH_DFLTCC_DEFLATE=ON -DWITH_DFLTCC_INFLATE=ON -DWITH_SANITIZER=Undefined
|
||||
packages: qemu gcc-s390x-linux-gnu libc-dev-s390x-cross
|
||||
ldflags: -static
|
||||
codecov: ubuntu_gcc_s390x
|
||||
|
||||
- name: Ubuntu MinGW i686
|
||||
os: ubuntu-latest
|
||||
compiler: i686-w64-mingw32-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-mingw-i686.cmake
|
||||
packages: wine32 gcc-mingw-w64
|
||||
# Codecov disabled due to gcov locking issue error
|
||||
|
||||
- name: Ubuntu MinGW x86_64
|
||||
os: ubuntu-latest
|
||||
compiler: x86_64-w64-mingw32-gcc
|
||||
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-mingw-x86_64.cmake
|
||||
packages: wine-stable gcc-mingw-w64
|
||||
codecov: ubuntu_gcc_mingw_x86_64
|
||||
|
||||
- name: Ubuntu Clang
|
||||
os: ubuntu-latest
|
||||
compiler: clang
|
||||
packages: llvm-6.0
|
||||
gcov-exec: llvm-cov-6.0 gcov
|
||||
codecov: ubuntu_clang
|
||||
|
||||
- name: Ubuntu Clang Inflate Strict
|
||||
os: ubuntu-latest
|
||||
compiler: clang
|
||||
cmake-args: -DWITH_INFLATE_STRICT=ON
|
||||
packages: llvm-6.0
|
||||
gcov-exec: llvm-cov-6.0 gcov
|
||||
codecov: ubuntu_clang_inflate_strict
|
||||
|
||||
- name: Ubuntu Clang Inflate Allow Invalid Dist
|
||||
os: ubuntu-latest
|
||||
compiler: clang
|
||||
cmake-args: -DWITH_INFLATE_ALLOW_INVALID_DIST=ON
|
||||
packages: llvm-6.0
|
||||
gcov-exec: llvm-cov-6.0 gcov
|
||||
codecov: ubuntu_clang_inflate_allow_invalid_dist
|
||||
|
||||
- name: Ubuntu Clang Memory Map
|
||||
os: ubuntu-latest
|
||||
compiler: clang
|
||||
cflags: -DUSE_MMAP
|
||||
packages: llvm-6.0
|
||||
gcov-exec: llvm-cov-6.0 gcov
|
||||
codecov: ubuntu_clang_mmap
|
||||
|
||||
- name: Ubuntu Clang Debug
|
||||
os: ubuntu-latest
|
||||
compiler: clang
|
||||
packages: llvm-6.0
|
||||
gcov-exec: llvm-cov-6.0 gcov
|
||||
codecov: ubuntu_clang_debug
|
||||
build-config: Debug
|
||||
|
||||
- name: Ubuntu Clang MSAN
|
||||
os: ubuntu-latest
|
||||
compiler: clang
|
||||
cmake-args: -GNinja -DWITH_SANITIZER=Memory
|
||||
packages: ninja-build llvm-6.0
|
||||
gcov-exec: llvm-cov-6.0 gcov
|
||||
cflags: -g3 -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize-memory-track-origins
|
||||
codecov: ubuntu_clang_msan
|
||||
|
||||
- name: Windows MSVC Win32
|
||||
os: windows-latest
|
||||
compiler: cl
|
||||
cmake-args: -A Win32
|
||||
|
||||
- name: Windows MSVC Win64
|
||||
os: windows-latest
|
||||
compiler: cl
|
||||
cmake-args: -A x64
|
||||
|
||||
- name: Windows MSVC ARM No Test
|
||||
os: windows-latest
|
||||
compiler: cl
|
||||
cmake-args: -A ARM
|
||||
|
||||
- name: Windows MSVC ARM64 No Test
|
||||
os: windows-latest
|
||||
compiler: cl
|
||||
cmake-args: -A ARM64
|
||||
|
||||
- name: Windows GCC
|
||||
os: windows-latest
|
||||
compiler: gcc
|
||||
cmake-args: -G Ninja
|
||||
codecov: win64_gcc
|
||||
|
||||
- name: Windows GCC Compat No Opt
|
||||
os: windows-latest
|
||||
compiler: gcc
|
||||
cmake-args: -G Ninja -DZLIB_COMPAT=ON -DWITH_NEW_STRATEGIES=OFF -DWITH_OPTIM=OFF
|
||||
codecov: win64_gcc_compat_no_opt
|
||||
|
||||
- name: macOS Clang
|
||||
os: macos-latest
|
||||
compiler: clang
|
||||
cmake-args: -DWITH_SANITIZER=Address
|
||||
codecov: macos_clang
|
||||
|
||||
- name: macOS GCC
|
||||
os: macos-latest
|
||||
compiler: gcc-10
|
||||
cmake-args: -DWITH_SANITIZER=Undefined
|
||||
packages: gcc@10
|
||||
gcov-exec: gcov-10
|
||||
codecov: macos_gcc
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v2
|
||||
|
||||
- name: Checkout test corpora
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: nmoinvaz/corpora
|
||||
path: test/data/corpora
|
||||
|
||||
- name: Install packages (Ubuntu)
|
||||
if: runner.os == 'Linux' && matrix.packages
|
||||
run: |
|
||||
sudo dpkg --add-architecture i386 # Required for wine32
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ${{ matrix.packages }}
|
||||
|
||||
- name: Install packages (Windows)
|
||||
if: runner.os == 'Windows'
|
||||
run: |
|
||||
choco install ninja ${{ matrix.packages }} --no-progress
|
||||
|
||||
- name: Install packages (macOS)
|
||||
if: runner.os == 'macOS'
|
||||
run: |
|
||||
brew install ninja ${{ matrix.packages }}
|
||||
env:
|
||||
HOMEBREW_NO_INSTALL_CLEANUP: 1
|
||||
|
||||
- name: Install codecov.io tools
|
||||
if: matrix.codecov
|
||||
run: |
|
||||
python -u -m pip install codecov
|
||||
|
||||
- name: Generate project files
|
||||
# Shared libaries turned off for qemu ppc* and sparc & reduce code coverage sources
|
||||
run: |
|
||||
mkdir ${{ matrix.build-dir || '.not-used' }}
|
||||
cd ${{ matrix.build-dir || '.' }}
|
||||
cmake ${{ matrix.build-src-dir || '.' }} ${{ matrix.cmake-args }} -DCMAKE_BUILD_TYPE=${{ matrix.build-config || 'Release' }} -DBUILD_SHARED_LIBS=OFF -DWITH_FUZZERS=ON -DWITH_CODE_COVERAGE=ON -DWITH_MAINTAINER_WARNINGS=ON
|
||||
env:
|
||||
CC: ${{ matrix.compiler }}
|
||||
CFLAGS: ${{ matrix.cflags }}
|
||||
LDFLAGS: ${{ matrix.ldflags }}
|
||||
CI: true
|
||||
|
||||
- name: Compile source code
|
||||
run: |
|
||||
cd ${{ matrix.build-dir || '.' }}
|
||||
cmake --build . --config ${{ matrix.build-config || 'Release' }}
|
||||
|
||||
- name: Run test cases
|
||||
# Don't run tests on Windows ARM
|
||||
if: runner.os != 'Windows' || contains(matrix.name, 'ARM') == false
|
||||
run: |
|
||||
cd ${{ matrix.build-dir || '.' }}
|
||||
ctest --verbose -C Release --output-on-failure --max-width 120 -j 6
|
||||
env:
|
||||
ASAN_OPTIONS: ${{ matrix.asan-options || 'verbosity=0' }}:abort_on_error=1
|
||||
MSAN_OPTIONS: ${{ matrix.msan-options || 'verbosity=0' }}:abort_on_error=1
|
||||
TSAN_OPTIONS: ${{ matrix.tsan-options || 'verbosity=0' }}:abort_on_error=1
|
||||
LSAN_OPTIONS: ${{ matrix.lsan-options || 'verbosity=0' }}:abort_on_error=1
|
||||
|
||||
- name: Upload coverage report
|
||||
if: matrix.codecov && ( env.CODECOV_TOKEN_SECRET != '' || github.repository == 'zlib-ng/zlib-ng' )
|
||||
shell: bash
|
||||
run: |
|
||||
bash tools/codecov-upload.sh
|
||||
env:
|
||||
# Codecov does not yet support GitHub Actions
|
||||
CODECOV_TOKEN_SECRET: "${{secrets.CODECOV_TOKEN}}"
|
||||
CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN || 'e4fdf847-f541-4ab1-9d50-3d27e5913906' }}"
|
||||
CODECOV_FLAGS: "${{ matrix.codecov }}"
|
||||
CODECOV_NAME: "${{ matrix.name }}"
|
||||
CODECOV_EXEC: "${{ matrix.gcov-exec || 'gcov' }}"
|
||||
CODECOV_DIR: "${{ matrix.build-dir || '.' }}"
|
||||
185
libs/zlibng/.github/workflows/configure.yml
vendored
185
libs/zlibng/.github/workflows/configure.yml
vendored
@ -1,185 +0,0 @@
|
||||
name: CI Configure
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
ci-configure:
|
||||
name: ${{ matrix.name }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: Ubuntu GCC
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
configure-args: --warn
|
||||
|
||||
- name: Ubuntu GCC OSB
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
configure-args: --warn
|
||||
build-dir: ../build
|
||||
build-src-dir: ../zlib-ng
|
||||
|
||||
- name: Ubuntu GCC Compat No Opt
|
||||
os: ubuntu-latest
|
||||
compiler: gcc
|
||||
configure-args: --warn --zlib-compat --without-optimizations --without-new-strategies
|
||||
|
||||
- name: Ubuntu GCC ARM SF
|
||||
os: ubuntu-latest
|
||||
compiler: arm-linux-gnueabi-gcc
|
||||
configure-args: --warn
|
||||
chost: arm-linux-gnueabi
|
||||
packages: qemu gcc-arm-linux-gnueabi libc-dev-armel-cross
|
||||
|
||||
- name: Ubuntu GCC ARM SF Compat No Opt
|
||||
os: ubuntu-latest
|
||||
compiler: arm-linux-gnueabi-gcc
|
||||
configure-args: --warn --zlib-compat --without-optimizations --without-new-strategies
|
||||
chost: arm-linux-gnueabi
|
||||
packages: qemu gcc-arm-linux-gnueabi libc-dev-armel-cross
|
||||
|
||||
- name: Ubuntu GCC ARM HF
|
||||
os: ubuntu-latest
|
||||
compiler: arm-linux-gnueabihf-gcc
|
||||
configure-args: --warn
|
||||
chost: arm-linux-gnueabihf
|
||||
packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross
|
||||
|
||||
- name: Ubuntu GCC ARM HF No ACLE
|
||||
os: ubuntu-latest
|
||||
compiler: arm-linux-gnueabihf-gcc
|
||||
configure-args: --warn --without-acle
|
||||
chost: arm-linux-gnueabihf
|
||||
packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross
|
||||
|
||||
- name: Ubuntu GCC ARM HF No NEON
|
||||
os: ubuntu-latest
|
||||
compiler: arm-linux-gnueabihf-gcc
|
||||
configure-args: --warn --without-neon
|
||||
chost: arm-linux-gnueabihf
|
||||
packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross
|
||||
|
||||
- name: Ubuntu GCC ARM HF Compat No Opt
|
||||
os: ubuntu-latest
|
||||
compiler: arm-linux-gnueabihf-gcc
|
||||
configure-args: --warn --zlib-compat --without-optimizations --without-new-strategies
|
||||
chost: arm-linux-gnueabihf
|
||||
packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross
|
||||
|
||||
- name: Ubuntu GCC AARCH64
|
||||
os: ubuntu-latest
|
||||
compiler: aarch64-linux-gnu-gcc
|
||||
configure-args: --warn
|
||||
chost: aarch64-linux-gnu
|
||||
packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross
|
||||
|
||||
- name: Ubuntu GCC AARCH64 No ACLE
|
||||
os: ubuntu-latest
|
||||
compiler: aarch64-linux-gnu-gcc
|
||||
configure-args: --warn --without-acle
|
||||
chost: aarch64-linux-gnu
|
||||
packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross
|
||||
|
||||
- name: Ubuntu GCC AARCH64 No NEON
|
||||
os: ubuntu-latest
|
||||
compiler: aarch64-linux-gnu-gcc
|
||||
configure-args: --warn --without-neon
|
||||
chost: aarch64-linux-gnu
|
||||
packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross
|
||||
|
||||
- name: Ubuntu GCC AARCH64 Compat No Opt
|
||||
os: ubuntu-latest
|
||||
compiler: aarch64-linux-gnu-gcc
|
||||
configure-args: --warn --zlib-compat --without-optimizations --without-new-strategies
|
||||
chost: aarch64-linux-gnu
|
||||
packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross
|
||||
|
||||
- name: Ubuntu GCC PPC
|
||||
os: ubuntu-latest
|
||||
compiler: powerpc-linux-gnu-gcc
|
||||
configure-args: --warn --static
|
||||
chost: powerpc-linux-gnu
|
||||
packages: qemu gcc-powerpc-linux-gnu libc-dev-powerpc-cross
|
||||
cflags: -static
|
||||
ldflags: -static
|
||||
|
||||
- name: Ubuntu GCC PPC64
|
||||
os: ubuntu-latest
|
||||
compiler: powerpc64-linux-gnu-gcc
|
||||
configure-args: --warn --static
|
||||
chost: powerpc-linux-gnu
|
||||
packages: qemu gcc-powerpc64-linux-gnu libc-dev-ppc64-cross
|
||||
cflags: -static
|
||||
ldflags: -static
|
||||
|
||||
- name: Ubuntu GCC PPC64LE
|
||||
os: ubuntu-latest
|
||||
compiler: powerpc64le-linux-gnu-gcc
|
||||
configure-args: --warn
|
||||
chost: powerpc64le-linux-gnu
|
||||
packages: qemu gcc-powerpc64le-linux-gnu libc-dev-ppc64el-cross
|
||||
|
||||
- name: Ubuntu GCC S390X
|
||||
os: ubuntu-latest
|
||||
compiler: s390x-linux-gnu-gcc
|
||||
configure-args: --warn --static
|
||||
chost: s390x-linux-gnu
|
||||
packages: qemu gcc-s390x-linux-gnu libc-dev-s390x-cross
|
||||
cflags: -static
|
||||
ldflags: -static
|
||||
|
||||
- name: Ubuntu GCC S390X DFLTCC
|
||||
os: ubuntu-latest
|
||||
compiler: s390x-linux-gnu-gcc
|
||||
configure-args: --warn --static --with-dfltcc-deflate --with-dfltcc-inflate
|
||||
chost: s390x-linux-gnu
|
||||
packages: qemu gcc-s390x-linux-gnu libc-dev-s390x-cross
|
||||
cflags: -static
|
||||
ldflags: -static
|
||||
|
||||
- name: Ubuntu GCC S390X DFLTCC Compat
|
||||
os: ubuntu-latest
|
||||
compiler: s390x-linux-gnu-gcc
|
||||
configure-args: --warn --zlib-compat --static --with-dfltcc-deflate --with-dfltcc-inflate
|
||||
chost: s390x-linux-gnu
|
||||
packages: qemu gcc-s390x-linux-gnu libc-dev-s390x-cross
|
||||
cflags: -static
|
||||
ldflags: -static
|
||||
|
||||
- name: macOS GCC
|
||||
os: macOS-latest
|
||||
compiler: gcc
|
||||
configure-args: --warn
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- name: Install packages (Ubuntu)
|
||||
if: runner.os == 'Linux' && matrix.packages
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y ${{ matrix.packages }}
|
||||
|
||||
- name: Generate project files
|
||||
run: |
|
||||
mkdir ${{ matrix.build-dir || '.not-used' }}
|
||||
cd ${{ matrix.build-dir || '.' }}
|
||||
${{ matrix.build-src-dir || '.' }}/configure ${{ matrix.configure-args }}
|
||||
env:
|
||||
CC: ${{ matrix.compiler }}
|
||||
CFLAGS: ${{ matrix.cflags }}
|
||||
LDFLAGS: ${{ matrix.ldflags }}
|
||||
CHOST: ${{ matrix.chost }}
|
||||
CI: true
|
||||
|
||||
- name: Compile source code
|
||||
run: |
|
||||
cd ${{ matrix.build-dir || '.' }}
|
||||
make -j2
|
||||
|
||||
- name: Run test cases
|
||||
run: |
|
||||
cd ${{ matrix.build-dir || '.' }}
|
||||
make test
|
||||
23
libs/zlibng/.github/workflows/fuzz.yml
vendored
23
libs/zlibng/.github/workflows/fuzz.yml
vendored
@ -1,23 +0,0 @@
|
||||
name: CI Fuzz
|
||||
on: [pull_request]
|
||||
jobs:
|
||||
Fuzzing:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Build Fuzzers
|
||||
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
|
||||
with:
|
||||
oss-fuzz-project-name: 'zlib-ng'
|
||||
dry-run: false
|
||||
- name: Run Fuzzers
|
||||
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
|
||||
with:
|
||||
oss-fuzz-project-name: 'zlib-ng'
|
||||
fuzz-seconds: 600
|
||||
dry-run: false
|
||||
- name: Upload Crash
|
||||
uses: actions/upload-artifact@v1
|
||||
if: failure()
|
||||
with:
|
||||
name: artifacts
|
||||
path: ./out/artifacts
|
||||
46
libs/zlibng/.github/workflows/libpng.yml
vendored
46
libs/zlibng/.github/workflows/libpng.yml
vendored
@ -1,46 +0,0 @@
|
||||
name: CI Libpng
|
||||
on: [pull_request]
|
||||
jobs:
|
||||
pngtest:
|
||||
name: Ubuntu Clang
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout repository (zlib-ng)
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- name: Generate project files (zlib-ng)
|
||||
run: |
|
||||
cmake . -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DZLIB_COMPAT=ON -DZLIB_ENABLE_TESTS=OFF
|
||||
env:
|
||||
CC: clang
|
||||
CFLAGS: -fPIC
|
||||
CI: true
|
||||
|
||||
- name: Compile source code (zlib-ng)
|
||||
run: |
|
||||
cmake --build . --config Release
|
||||
|
||||
- name: Checkout repository (libpng)
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
repository: glennrp/libpng
|
||||
path: libpng
|
||||
|
||||
- name: Generate project files (libpng)
|
||||
run: |
|
||||
cd libpng
|
||||
cmake . -DCMAKE_BUILD_TYPE=Release -DPNG_TESTS=ON -DPNG_STATIC=OFF -DZLIB_INCLUDE_DIR=.. -DZLIB_LIBRARY=$PWD/../libz.a
|
||||
env:
|
||||
CC: clang
|
||||
CI: true
|
||||
|
||||
- name: Compile source code (libpng)
|
||||
run: |
|
||||
cd libpng
|
||||
cmake --build . --config Release
|
||||
|
||||
- name: Run test cases (libpng)
|
||||
run: |
|
||||
cd libpng
|
||||
ctest -C Release --output-on-failure --max-width 120
|
||||
48
libs/zlibng/.github/workflows/nmake.yml
vendored
48
libs/zlibng/.github/workflows/nmake.yml
vendored
@ -1,48 +0,0 @@
|
||||
name: CI NMake
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
ci-cmake:
|
||||
name: ${{ matrix.name }}
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
include:
|
||||
- name: Windows NMake x86
|
||||
os: windows-latest
|
||||
makefile: win32/Makefile.msc
|
||||
vc-vars: x86
|
||||
|
||||
- name: Windows NMake x64
|
||||
os: windows-latest
|
||||
makefile: win32/Makefile.msc
|
||||
vc-vars: x86_amd64
|
||||
|
||||
- name: Windows NMake ARM No Test
|
||||
os: windows-latest
|
||||
makefile: win32/Makefile.arm
|
||||
vc-vars: x86_arm
|
||||
|
||||
- name: Windows NMake ARM64 No Test
|
||||
os: windows-latest
|
||||
makefile: win32/Makefile.a64
|
||||
vc-vars: x86_arm64
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v1
|
||||
|
||||
- name: Compile source code
|
||||
shell: cmd
|
||||
run: |
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.vc-vars }}
|
||||
nmake -f ${{ matrix.makefile }}
|
||||
|
||||
- name: Run test cases
|
||||
shell: cmd
|
||||
# Don't run tests on Windows ARM
|
||||
if: contains(matrix.vc-vars, 'arm') == false
|
||||
run: |
|
||||
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.vc-vars }}
|
||||
nmake -f ${{ matrix.makefile }} test
|
||||
nmake -f ${{ matrix.makefile }} testdll
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user