mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-01 22:40:26 +00:00
Compare commits
421 Commits
v22.62.0
...
64bc4b2362
| Author | SHA1 | Date | |
|---|---|---|---|
| 64bc4b2362 | |||
| b261856917 | |||
| f64e29433e | |||
| 42a3780d80 | |||
| e544f72da0 | |||
| 587422bdc1 | |||
| f4717b8414 | |||
| 64329f3e59 | |||
| feaf907210 | |||
| 3f8746d33c | |||
| 1168d3bc37 | |||
| e81f36c0a6 | |||
| 9b3f9f356d | |||
| 47ff765ae1 | |||
| e42dc2e1d2 | |||
| 2239bba2c5 | |||
| 87076e8487 | |||
| 95b91431dd | |||
| 2d30df179c | |||
| 897512a43e | |||
| b9f8d7c3b1 | |||
| 625cfdb179 | |||
| f72474216f | |||
| af0fd14a38 | |||
| 2f78b6c2f3 | |||
| d61effbb8f | |||
| 0f7abb8c25 | |||
| 2faa3ec478 | |||
| 792bd3be96 | |||
| 97a34ded56 | |||
| 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 | |||
| d142e1ca81 | |||
| d9f4d49ef4 | |||
| 0a1df5bbb6 | |||
| 41f3d7ff31 | |||
| 0afef19d26 | |||
| e9be2d76c3 | |||
| ffa813b92c | |||
| 909de47acd | |||
| 73a5f11e17 | |||
| 9544e100c3 | |||
| f3232cdc3a | |||
| b8884d6572 | |||
| 323a0c0b27 | |||
| ab45d4358d | |||
| f7775c7a75 | |||
| 659a960401 | |||
| 07d484597d | |||
| fc470d5f83 | |||
| 585ed3bd25 | |||
| 2eb291a461 | |||
| a1421af214 | |||
| 13aad6229f | |||
| 76d46ceaf0 | |||
| 389047c4e2 | |||
| 2c6d405b2c | |||
| 50ae0f8351 | |||
| dc261bb203 | |||
| 643ee56433 | |||
| c0bb32ed12 | |||
| c99bda3f47 | |||
| 967a13e692 | |||
| f304f9cc61 | |||
| 004e2ca63f | |||
| 128732e05d | |||
| 1e6a4dac78 | |||
| 654764685a | |||
| c5ab35e4af | |||
| 947795f1d1 | |||
| 1153c9ab96 | |||
| 2128b45313 | |||
| 4f7ff2d6f2 | |||
| b5f1e99d3b | |||
| 83918ce020 | |||
| f3aaeff0a9 | |||
| 98eff43346 | |||
| 46b43a990f | |||
| ea96cbf885 | |||
| de07870c99 | |||
| b3b228c26c | |||
| 27b5c80c3c | |||
| fb4d003e19 | |||
| f025e5741b | |||
| c3f2708f1b | |||
| 2e760d6397 | |||
| bac892b582 | |||
| 4005b68383 | |||
| 5ac9dd04e4 | |||
| f0c041e8b3 | |||
| 2f4a5b56dd | |||
| 940f97c9ae | |||
| f8ee664b27 | |||
| df86ad371b | |||
| e846bb86b6 | |||
| 3e6a3e2168 | |||
| 2aebf1a78a | |||
| 1be7e56b86 | |||
| a0ff9d67a1 | |||
| befee1c729 | |||
| 3d70063a68 | |||
| 4e28bcf85e | |||
| 687d10960a | |||
| 567d46c3d6 | |||
| 53cc2de459 | |||
| cb866cba31 | |||
| e2162c08da | |||
| e657953b8f | |||
| eb366e67b7 | |||
| 5b728a42f7 | |||
| a1d414d64c | |||
| 907029ed76 | |||
| 894f22fba0 | |||
| 7ec09d7e0f | |||
| c82266790a | |||
| ec31fddbae | |||
| fb49ce2404 | |||
| 276b7e238a | |||
| c7a463420b | |||
| a56bb52808 | |||
| 0bbdb58679 | |||
| f29478c105 | |||
| 888a88f966 | |||
| 3b617a6652 | |||
| c36c336bc7 | |||
| 4a9779635d | |||
| 20da490bda | |||
| 1221e88d92 | |||
| a2b28b2e16 | |||
| 3d607d352c | |||
| 83cd8119c8 | |||
| 4de8fbbd56 | |||
| 780120036d | |||
| f3697e633c | |||
| 24f8d88333 | |||
| 21bd906a4d | |||
| 138612bc88 | |||
| 5919bb4dea | |||
| 99d249fefd | |||
| c08f286817 | |||
| cd003ff0b7 | |||
| 1a539f6656 | |||
| 7e7fb7b758 | |||
| 5ae87b40e2 | |||
| 0ec07daebb | |||
| 9869da2a0a | |||
| 617eb4432b | |||
| a2b2a6a5cf | |||
| 43a5bff84a | |||
| e983d07228 | |||
| 90db12483a | |||
| ff71cfbd5b | |||
| 08bb9de437 | |||
| 16e341906d | |||
| 216b3a039f | |||
| b813cf71bb | |||
| 48ecd1222f | |||
| e758b407e9 | |||
| 758dd1875e | |||
| 8e2961dda5 | |||
| 5522eda6e4 | |||
| ac1469bac2 | |||
| c2989e019a | |||
| e16b481ba2 | |||
| 4fc0ffd173 | |||
| b883888a19 | |||
| 50ad97aa0b | |||
| dca892e258 | |||
| f9fe4ea2ec | |||
| cc30c72538 | |||
| d1fd40cd85 | |||
| f3af458cb3 | |||
| a093d04594 | |||
| 115df81400 | |||
| 5babc864b9 | |||
| 60a2dd8616 | |||
| 9be2485330 | |||
| a2bf10624a | |||
| ed58d16f1f | |||
| e9b45fb360 | |||
| 803972873a | |||
| d9e57eca79 | |||
| 6429dc80d3 | |||
| c4262b3fa6 | |||
| 92128b98fd | |||
| b9cfdea76c | |||
| c8a7066d0e | |||
| 950cc4a325 | |||
| 82b48fe6e8 | |||
| ca9c1fdd24 | |||
| fe08961d25 | |||
| 5b9f7ff4c9 | |||
| 23743a4050 | |||
| 444d688ad2 | |||
| d554eb3423 | |||
| deb298dda7 | |||
| 19e785b842 | |||
| 7b9691d486 | |||
| 30fddcc5a0 | |||
| 235e59a2d8 | |||
| bc1ffe0716 | |||
| 44497414db | |||
| 96e34fe8f7 | |||
| ceca28d2a3 | |||
| b040571427 | |||
| 49664cc1a0 | |||
| 5e4fd43920 | |||
| 937b947597 | |||
| bb70850421 | |||
| 46511365a7 | |||
| 6d69ac7a98 | |||
| 938937c271 | |||
| cd808416c8 | |||
| a05d0752f6 | |||
| 799609fb21 | |||
| 213fe6a9e9 | |||
| be6a5d5f50 | |||
| 1af29bd7b1 | |||
| ef945e6e99 | |||
| 9528c1e7fc | |||
| fd6e5f465d | |||
| d00125abe1 | |||
| 5d69235a4c | |||
| e93785f885 | |||
| 3c2545cfaf | |||
| 8d1a9efac9 | |||
| f6b18fb003 | |||
| 00e77f190c | |||
| 9cb72a6ba7 | |||
| 8203c034bf | |||
| 33ae51f56f | |||
| 30c39194a3 | |||
| 051ce3736f | |||
| 84708edccf | |||
| da4e9ab95b | |||
| a8fea95eab | |||
| 53610c2f0f | |||
| 9f10c12874 | |||
| a0634adb3c | |||
| a2ed6be1f5 | |||
| c33ac40567 | |||
| 9ee095b354 | |||
| 7ab32af4dc | |||
| 0c301419c2 | |||
| d6a21be25e | |||
| 1d4ba082ad | |||
| 94553501ba | |||
| da824d5178 | |||
| 5a1df38900 | |||
| 8cd7148b29 | |||
| 09e079a45e | |||
| 4bc881da4b | |||
| 0615864d51 | |||
| 3638d157b2 | |||
| d41725e325 | |||
| 88580b69b6 | |||
| f7a6fe595a | |||
| 07d14c2681 | |||
| eac7a73fb6 | |||
| c5715f1f14 | |||
| 3902230fa1 | |||
| 212969f5cd | |||
| de4226fdc9 | |||
| 8b13434197 | |||
| 27274397ec | |||
| 2b79a36014 | |||
| 8cf52294e9 | |||
| 0ef79903f8 | |||
| ab14458f9e | |||
| 5b94e736b3 | |||
| c3b8cc9744 | |||
| 89e3b2c72e | |||
| 23c4aa241b | |||
| acb7584e26 | |||
| a885bd9322 | |||
| 20fe1926e0 | |||
| eb7118754b | |||
| 3611b49f68 | |||
| 511d8a8bb3 | |||
| 1598d2e17b | |||
| 805757ba87 | |||
| eb6ac25540 | |||
| cb634cf57d | |||
| 2f7ca2cdc8 | |||
| 425d24c1f4 | |||
| 875df8e64a | |||
| 7a2d2a0c51 | |||
| 5296202e56 | |||
| e2db8ffea8 | |||
| fa2ab11676 | |||
| 80e8634a48 | |||
| 98c2fa5127 | |||
| 8b8b41dab3 | |||
| 63b1e6b4b4 | |||
| 21b7b6e7ab | |||
| 878a5377ae | |||
| 486c7c44be | |||
| aa4869c6e9 | |||
| 94e1b4edfa | |||
| 4d73b7d641 | |||
| ed4f9b0d30 | |||
| f8837d0926 | |||
| 753d83c499 | |||
| f0108826d3 | |||
| 6ac846c003 | |||
| 44963f3f21 | |||
| 9fd935ef10 | |||
| 6f390c81f9 | |||
| 1bd281c8f2 | |||
| 49cf97ae9c | |||
| 8315240b17 | |||
| 55155ff800 | |||
| ab4e1191ef | |||
| c09fad5a75 | |||
| 8201175c2c | |||
| e88ea24966 | |||
| 02e2f6771c | |||
| 3b399dfac5 | |||
| 9aa0f7c695 | |||
| 3ba113a91d | |||
| b0c951bd6e | |||
| 8a5f885558 | |||
| fd3f5cfd29 | |||
| 74b8cf8bd3 | |||
| 18685748f6 | |||
| da24bf467a | |||
| e948a6815c | |||
| dfb089b0c1 | |||
| d9d2d5d47c | |||
| ac4ffefa09 | |||
| c228604255 | |||
| 59292b15f6 | |||
| 843f6531a7 | |||
| 432452c5c7 | |||
| f3a2f97155 | |||
| 9e07d90664 | |||
| 4fe229c475 | |||
| 4658e7f60d | |||
| 95559b2e17 | |||
| 7ad63575c7 | |||
| bc6b21f601 | |||
| 05c7e6409d | |||
| 60ba76b39c | |||
| 41009aa19b | |||
| ed7023f336 | |||
| e0d95b4302 | |||
| 537b585791 | |||
| 1a48add20e | |||
| 1650efa787 | |||
| 0dde51f518 | |||
| 5cebc42f89 | |||
| 7021602bf4 | |||
| 752ac78c56 | |||
| e9678da311 | |||
| 51f25ed779 | |||
| 8f4f8368df | |||
| 21d27a1122 | |||
| 6519fb40c7 | |||
| ff2763785c | |||
| f1852e16b7 | |||
| 49917bfb13 | |||
| ff86cc3b8a | |||
| 91a0e14509 | |||
| 6fb919a16f | |||
| d1d6db3a09 | |||
| e3ab90695f | |||
| aa423e398a | |||
| 1cf7709c9d | |||
| f466964db8 | |||
| 4fda3c045e | |||
| 0a20100d12 | |||
| 29701d0ea7 | |||
| 4a38fd8829 | |||
| 08c8e0d81f | |||
| c966f26ac1 | |||
| fe66c24352 | |||
| bdcded7d45 | |||
| f939f25aa1 | |||
| 401f1038f3 | |||
| 95c6560e7c | |||
| 59f645b5c3 | |||
| bbfed8300c | |||
| 07c762068f | |||
| 6525051d2d |
@@ -1,6 +1,5 @@
|
|||||||
!Makefile
|
base/
|
||||||
base/*.sql
|
!base/*.json
|
||||||
base/*.zip
|
override/
|
||||||
base/db/
|
repo/
|
||||||
base/maps/
|
cache/
|
||||||
!base/expansion/Makefile
|
|
||||||
|
|||||||
+133
-189
@@ -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
|
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
|
.PHONY: prep
|
||||||
prep:
|
prep: is-vscode
|
||||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
|
||||||
@make -C ../ -f .devcontainer/Makefile prep --no-print-directory
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
@echo "Preparing build/bin for usage..."
|
@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
|
@echo "Prepping folders..."
|
||||||
cp -R -u -p .devcontainer/base/login.json build/bin/login.json
|
@mkdir -p .devcontainer/override
|
||||||
cp -R -u -p loginserver/login_util/* build/bin/assets/patches/
|
@mkdir -p .devcontainer/repo
|
||||||
mkdir -p build/bin/assets
|
@mkdir -p .devcontainer/cache
|
||||||
cp -R -u -p utils/patches build/bin/assets/
|
@mkdir -p build/bin/logs
|
||||||
-unlink build/bin/lua_modules
|
@mkdir -p build/bin/shared
|
||||||
cd build/bin && ln -s quests/lua_modules lua_modules
|
@mkdir -p build/bin/assets
|
||||||
-unlink build/bin/mods
|
|
||||||
cd build/bin && ln -s quests/mods mods
|
@echo "Applying overrides..."
|
||||||
-unlink build/bin/maps
|
@if [ ! -f .devcontainer/override/eqemu_config.json ]; then cp .devcontainer/base/eqemu_config.json .devcontainer/override/eqemu_config.json; fi
|
||||||
cd build/bin && ln -s ../../base/maps maps
|
@if [ -f build/bin/eqemu_config.json ]; then unlink build/bin/eqemu_config.json; fi
|
||||||
mkdir -p build/bin/logs
|
cd build/bin && ln -s ../../.devcontainer/override/eqemu_config.json eqemu_config.json
|
||||||
mkdir -p build/bin/shared
|
@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."
|
@echo "Eqemu is prepared. Edit build/bin/eqemu_config.json to configure."
|
||||||
|
|
||||||
maps:
|
is-vscode:
|
||||||
@echo "Downloading maps..."
|
@if [ -z "$$REMOTE_CONTAINERS" ]; then \
|
||||||
@mkdir -p base/maps
|
echo "Not running in VS Code devcontainer"; \
|
||||||
@cd base/maps && wget -nc https://github.com/Akkadius/eqemu-maps/archive/refs/heads/master.zip
|
exit 1; \
|
||||||
@cd base/maps && unzip -o master.zip
|
fi
|
||||||
@cd base/maps && mv eqemu-maps-master/* .
|
|
||||||
@cd base/maps && rm -rf eqemu-maps-master
|
|
||||||
@echo "Maps downloaded."
|
|
||||||
|
|
||||||
quests:
|
clean: is-vscode
|
||||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
rm -rf build
|
||||||
@make -C ../ -f .devcontainer/Makefile quests --no-print-directory
|
|
||||||
exit
|
.PHONY: maps
|
||||||
endif
|
maps: is-vscode
|
||||||
@cd build/bin && git clone https://github.com/ProjectEQ/projecteqquests.git quests
|
@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
|
# Runs tests
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test:
|
test: is-vscode
|
||||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
|
||||||
@make -C ../ -f .devcontainer/Makefile test --no-print-directory
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
cd build/bin && ./tests
|
cd build/bin && ./tests
|
||||||
|
|
||||||
# Runs login binary
|
# Runs login binary
|
||||||
.PHONY: login
|
.PHONY: login
|
||||||
login:
|
login: is-vscode check-mariadb
|
||||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
|
||||||
@make -C ../ -f .devcontainer/Makefile login --no-print-directory
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
cd build/bin && ./loginserver
|
cd build/bin && ./loginserver
|
||||||
|
|
||||||
|
.PHONY: hotfix
|
||||||
|
hotfix: shared
|
||||||
|
|
||||||
# Runs shared_memory binary
|
# Runs shared_memory binary
|
||||||
.PHONY: shared
|
.PHONY: shared
|
||||||
shared:
|
shared: is-vscode check-mariadb
|
||||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
|
||||||
@make -C ../ -f .devcontainer/Makefile shared --no-print-directory
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
cd build/bin && ./shared_memory
|
cd build/bin && ./shared_memory
|
||||||
|
|
||||||
# Runs zone binary
|
# Runs zone binary
|
||||||
.PHONY: zone
|
.PHONY: zone
|
||||||
zone:
|
zone: is-vscode check-mariadb
|
||||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
@find build/bin/logs/zone/ -type f -name 'zone*.log' -exec rm -f {} +
|
||||||
@make -C ../ -f .devcontainer/Makefile zone --no-print-directory
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
@-rm build/bin/logs/zone/zone*.log
|
|
||||||
cd build/bin && ./zone
|
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
|
# Runs world binary
|
||||||
.PHONY: world
|
.PHONY: world
|
||||||
world:
|
world: is-vscode check-mariadb
|
||||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
@find build/bin/logs/ -type f -name 'world*.log' -exec rm -f {} +
|
||||||
@make -C ../ -f .devcontainer/Makefile world --no-print-directory
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
@-rm build/bin/logs/world*.log
|
|
||||||
cd build/bin && ./world
|
cd build/bin && ./world
|
||||||
|
|
||||||
# Runs ucs binary
|
# Runs ucs binary
|
||||||
.PHONY: ucs
|
.PHONY: ucs
|
||||||
ucs:
|
ucs: is-vscode check-mariadb
|
||||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
@find build/bin/logs/ -type f -name 'ucs*.log' -exec rm -f {} +
|
||||||
@make -C ../ -f .devcontainer/Makefile ucs --no-print-directory
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
@-rm build/bin/logs/ucs*.log
|
|
||||||
cd build/bin && ./ucs
|
cd build/bin && ./ucs
|
||||||
|
|
||||||
# Runs queryserv binary
|
# Runs queryserv binary
|
||||||
.PHONY: queryserv
|
.PHONY: queryserv
|
||||||
queryserv:
|
queryserv: is-vscode check-mariadb
|
||||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
@find build/bin/logs/ -type f -name 'query_server*.log' -exec rm -f {} +
|
||||||
@make -C ../ -f .devcontainer/Makefile queryserv --no-print-directory
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
@-rm build/bin/logs/query_server*.log
|
|
||||||
cd build/bin && ./queryserv
|
cd build/bin && ./queryserv
|
||||||
|
|
||||||
valgrind-%:
|
reset-content:
|
||||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
@echo "Resetting content tables in database peq..."
|
||||||
@make -C ../ -f .devcontainer/Makefile valgrind --no-print-directory
|
cd .devcontainer/cache/db/peq-dump && sudo mariadb --database peq -e "source create_tables_content.sql"
|
||||||
exit
|
|
||||||
endif
|
valgrind-%: is-vscode
|
||||||
cd build/bin && valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=logs/$*.valgrind.log ./$*
|
cd build/bin && valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=logs/$*.valgrind.log ./$*
|
||||||
|
|
||||||
# Start mariaDB standalone
|
# Start mariaDB standalone
|
||||||
@@ -201,30 +132,33 @@ mariadb:
|
|||||||
.PHONY: inject-mariadb
|
.PHONY: inject-mariadb
|
||||||
inject-mariadb:
|
inject-mariadb:
|
||||||
-sudo service mariadb start
|
-sudo service mariadb start
|
||||||
-mkdir -p base/db/
|
-mkdir -p .devcontainer/cache/db/
|
||||||
-sudo mariadb -e 'DROP DATABASE IF EXISTS peq;'
|
-sudo mariadb -e 'DROP DATABASE IF EXISTS peq;'
|
||||||
-sudo mariadb -e 'CREATE DATABASE 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';"
|
-sudo mariadb -e "GRANT ALL PRIVILEGES ON *.* TO 'peq'@'127.0.0.1';"
|
||||||
ifeq (,$(wildcard base/db/db.sql.zip))
|
ifeq (,$(wildcard .devcontainer/cache/db/db.sql.zip))
|
||||||
@echo "base/db.sql.zip not found. Downloading latest from https://db.projecteq.net/"
|
@echo ".devcontainer/cache/db.sql.zip not found. Downloading database from https://db.eqemu.dev/latest"
|
||||||
wget -nc https://db.projecteq.net/latest -O base/db/db.sql.zip
|
wget -nc https://db.eqemu.dev/latest -O .devcontainer/cache/db/db.sql.zip
|
||||||
-cd base/db && unzip db.sql.zip
|
-cd .devcontainer/cache/db && unzip db.sql.zip
|
||||||
endif
|
endif
|
||||||
@echo "Sourcing db may take a while, please wait..."
|
@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."
|
@echo "MariaDB is now injected."
|
||||||
|
|
||||||
.PHONY: gm-%
|
.PHONY: gm-%
|
||||||
gm-%:
|
gm-%: is-vscode
|
||||||
sudo mariadb --database peq -e "UPDATE account SET status=255 WHERE name = '$*';"
|
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."
|
@echo "Account $* is now a GM. /camp to have it go into effect."
|
||||||
|
|
||||||
depends:
|
depends: is-vscode
|
||||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
|
||||||
@make -C ../ -f .devcontainer/Makefile depends --no-print-directory
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
sudo apt install graphviz pip time
|
sudo apt install graphviz pip time
|
||||||
pip3 install graphviz
|
pip3 install graphviz
|
||||||
mkdir -p build/depends
|
mkdir -p build/depends
|
||||||
@@ -241,44 +175,54 @@ endif
|
|||||||
@echo "Common..."
|
@echo "Common..."
|
||||||
time python3 build/depends/dependency_graph.py -f png common build/depends/common.dot
|
time python3 build/depends/dependency_graph.py -f png common build/depends/common.dot
|
||||||
|
|
||||||
backup:
|
backup: is-vscode
|
||||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
|
||||||
@make -C ../ -f .devcontainer/Makefile backup --no-print-directory
|
|
||||||
exit
|
|
||||||
endif
|
|
||||||
@mkdir -p build/bin/backup
|
@mkdir -p build/bin/backup
|
||||||
cd build/bin && ./world database:dump --compress --player-tables --state-tables --system-tables --query-serv-tables
|
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)
|
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
|
exit
|
||||||
endif
|
endif
|
||||||
@cd build/bin && mkdir -p tmp
|
@cd build/bin && mkdir -p tmp
|
||||||
cd build/bin && CPUPROFILE=prof.out ./zone
|
cd build/bin && CPUPROFILE=prof.out ./zone
|
||||||
|
|
||||||
pprof-zone:
|
pprof-zone: is-vscode
|
||||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
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
|
exit
|
||||||
endif
|
endif
|
||||||
cd build/bin && google-pprof --pdf zone prof.out > prof.pdf
|
cd build/bin && google-pprof --pdf zone prof.out > prof.pdf
|
||||||
pprof-web-zone:
|
|
||||||
|
pprof-gv-zone: is-vscode
|
||||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
||||||
@make -C ../ -f .devcontainer/Makefile pprof-web-zone --no-print-directory
|
@echo "This makefile is not intended to be run from the .devcontainer 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
|
|
||||||
exit
|
exit
|
||||||
endif
|
endif
|
||||||
cd build/bin && google-pprof --gv zone prof.out > prof.gv
|
cd build/bin && google-pprof --gv zone prof.out > prof.gv
|
||||||
heap-zone:
|
|
||||||
|
heap-zone: is-vscode
|
||||||
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
|
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
|
exit
|
||||||
endif
|
endif
|
||||||
@cd build/bin && mkdir -p tmp
|
@cd build/bin && mkdir -p tmp
|
||||||
cd build/bin && HEAPPROFILE=prof.out ./zone
|
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",
|
"GitHub.copilot",
|
||||||
"xackery.make-magic",
|
"xackery.make-magic",
|
||||||
"Gruntfuggly.todo-tree",
|
"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",
|
"workspaceFolder": "/src",
|
||||||
"workspaceMount": "source=${localWorkspaceFolder},target=/src,type=bind,consistency=cached"
|
"workspaceMount": "source=${localWorkspaceFolder},target=/src,type=bind,consistency=cached"
|
||||||
}
|
}
|
||||||
-98
@@ -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
|
|
||||||
|
|
||||||
|
|
||||||
@@ -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 libmariadb-dev libmariadb-dev-compat libboost-all-dev libperl-dev liblua5.1-0-dev libluajit-5.1-dev zlib1g-dev uuid-dev libssl-dev libsodium-dev libmbedtls-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
|
||||||
+3
-15
@@ -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"]
|
[submodule "submodules/websocketpp"]
|
||||||
path = submodules/websocketpp
|
path = submodules/websocketpp
|
||||||
url = https://github.com/zaphoyd/websocketpp.git
|
url = https://github.com/zaphoyd/websocketpp.git
|
||||||
[submodule "submodules/recastnavigation"]
|
[submodule "submodules/vcpkg"]
|
||||||
path = submodules/recastnavigation
|
path = submodules/vcpkg
|
||||||
url = https://github.com/EQEmu/recastnavigation.git
|
url = https://github.com/microsoft/vcpkg.git
|
||||||
|
|||||||
Vendored
-25
@@ -21,14 +21,6 @@
|
|||||||
"${workspaceFolder}/dependencies/zlibng"
|
"${workspaceFolder}/dependencies/zlibng"
|
||||||
],
|
],
|
||||||
"telemetry.enableTelemetry": false,
|
"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.skipConfigureIfCachePresent": true,
|
||||||
"cmake.configureOnOpen": false,
|
"cmake.configureOnOpen": false,
|
||||||
"files.associations": {
|
"files.associations": {
|
||||||
@@ -115,22 +107,5 @@
|
|||||||
"format": "cpp",
|
"format": "cpp",
|
||||||
"ranges": "cpp",
|
"ranges": "cpp",
|
||||||
"span": "cpp"
|
"span": "cpp"
|
||||||
},
|
|
||||||
"cmake.statusbar.advanced": {
|
|
||||||
"kit": {
|
|
||||||
"visibility": "hidden",
|
|
||||||
},
|
|
||||||
"debug": {
|
|
||||||
"visibility": "hidden",
|
|
||||||
},
|
|
||||||
"buildTarget": {
|
|
||||||
"visibility": "hidden",
|
|
||||||
},
|
|
||||||
"launch": {
|
|
||||||
"visibility": "hidden",
|
|
||||||
},
|
|
||||||
"ctest": {
|
|
||||||
"visibility": "icon",
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+836
@@ -1,3 +1,839 @@
|
|||||||
|
## [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
|
||||||
|
|
||||||
|
* Fix Quest Ownership Edge Case ([#4977](https://github.com/EQEmu/Server/pull/4977)) @Kinglykrab 2025-08-02
|
||||||
|
|
||||||
|
## [23.9.0] 8/2/2025
|
||||||
|
|
||||||
|
### Bots
|
||||||
|
|
||||||
|
* Fix FinishBuffing rule ([#4961](https://github.com/EQEmu/Server/pull/4961)) @nytmyr 2025-07-01
|
||||||
|
* Fix ^cast resurrects ([#4958](https://github.com/EQEmu/Server/pull/4958)) @nytmyr 2025-06-29
|
||||||
|
|
||||||
|
### Build
|
||||||
|
|
||||||
|
* Fix Linking with GCC ([#4969](https://github.com/EQEmu/Server/pull/4969)) @solar984 2025-08-03
|
||||||
|
* More Build Speed Improvements ([#4959](https://github.com/EQEmu/Server/pull/4959)) @Akkadius 2025-06-30
|
||||||
|
|
||||||
|
### Commands
|
||||||
|
|
||||||
|
* Add #show keyring Subcommand ([#4973](https://github.com/EQEmu/Server/pull/4973)) @Kinglykrab 2025-08-03
|
||||||
|
|
||||||
|
### Database
|
||||||
|
|
||||||
|
* Add Indexes to NPC's Spawns Loot ([#4972](https://github.com/EQEmu/Server/pull/4972)) @Akkadius 2025-07-30
|
||||||
|
|
||||||
|
### Feature
|
||||||
|
|
||||||
|
* Zone Scripting ([#4908](https://github.com/EQEmu/Server/pull/4908)) @Kinglykrab 2025-07-10
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Add a missing Froglok starting area for Titanium Startzone. ([#4962](https://github.com/EQEmu/Server/pull/4962)) @regneq 2025-07-04
|
||||||
|
* Fix Hero's Forge Ingame and Character Select ([#4966](https://github.com/EQEmu/Server/pull/4966)) @Kinglykrab 2025-07-30
|
||||||
|
* Show player count on the server list status. ([#4971](https://github.com/EQEmu/Server/pull/4971)) @regneq 2025-07-30
|
||||||
|
|
||||||
|
### Loginserver
|
||||||
|
|
||||||
|
* Fix Legacy World When Using Local DB ([#4970](https://github.com/EQEmu/Server/pull/4970)) @solar984 2025-08-03
|
||||||
|
|
||||||
|
### Performance
|
||||||
|
|
||||||
|
* Clear Wearchange Deduplication Cache ([#4960](https://github.com/EQEmu/Server/pull/4960)) @Akkadius 2025-06-30
|
||||||
|
|
||||||
|
### Quest API
|
||||||
|
|
||||||
|
* Add GetMemberRole() to Perl/Lua ([#4963](https://github.com/EQEmu/Server/pull/4963)) @Barathos 2025-07-10
|
||||||
|
* Add GetTimers() and GetPausedTimers() to Perl/Lua ([#4965](https://github.com/EQEmu/Server/pull/4965)) @Kinglykrab 2025-08-03
|
||||||
|
|
||||||
|
## [23.8.1] 6/28/2025
|
||||||
|
|
||||||
|
### Crash Fix
|
||||||
|
|
||||||
|
* Fix Possible Crashes with Raid Methods ([#4955](https://github.com/EQEmu/Server/pull/4955)) @Kinglykrab 2025-06-26
|
||||||
|
|
||||||
|
### Databuckets
|
||||||
|
|
||||||
|
* Revert Caching Changes of #4917 ([#4957](https://github.com/EQEmu/Server/pull/4957)) @Akkadius 2025-06-28
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Fix FindCharacter Using content_db ([#4956](https://github.com/EQEmu/Server/pull/4956)) @Kinglykrab 2025-06-26
|
||||||
|
* Fix Hero Forge on Character Select ([#4954](https://github.com/EQEmu/Server/pull/4954)) @Kinglykrab 2025-06-26
|
||||||
|
|
||||||
|
## [23.8.0] 6/25/2025
|
||||||
|
|
||||||
|
### API
|
||||||
|
|
||||||
|
* Add wwmarquee <type> <message> ([#4919](https://github.com/EQEmu/Server/pull/4919)) @Akkadius 2025-06-23
|
||||||
|
|
||||||
|
### Build
|
||||||
|
|
||||||
|
* Significantly Improve Build Times Using Unity Builds ([#4948](https://github.com/EQEmu/Server/pull/4948)) @Akkadius 2025-06-22
|
||||||
|
|
||||||
|
### Code
|
||||||
|
|
||||||
|
* AdventureManager Global to Singleton Cleanup ([#4931](https://github.com/EQEmu/Server/pull/4931)) @Kinglykrab 2025-06-25
|
||||||
|
* Cleanup Strings Header ([#4950](https://github.com/EQEmu/Server/pull/4950)) @Akkadius 2025-06-22
|
||||||
|
* ClientList Global to Singleton Cleanup ([#4942](https://github.com/EQEmu/Server/pull/4942)) @Kinglykrab 2025-06-25
|
||||||
|
* DatabaseUpdate Global to Singleton Cleanup ([#4943](https://github.com/EQEmu/Server/pull/4943)) @Kinglykrab 2025-06-25
|
||||||
|
* DiscordManager Global to Singleton Cleanup ([#4926](https://github.com/EQEmu/Server/pull/4926)) @Kinglykrab 2025-06-25
|
||||||
|
* EQ::Random Global to Singleton Cleanup ([#4936](https://github.com/EQEmu/Server/pull/4936)) @Kinglykrab 2025-06-22
|
||||||
|
* EQEmuLogSys Global to Singleton Cleanup ([#4925](https://github.com/EQEmu/Server/pull/4925)) @Akkadius 2025-06-25
|
||||||
|
* EvolvingItemsManager Global to Singleton Cleanup ([#4929](https://github.com/EQEmu/Server/pull/4929)) @Kinglykrab 2025-06-25
|
||||||
|
* LFGuildManager Global to Singleton Cleanup ([#4927](https://github.com/EQEmu/Server/pull/4927)) @Kinglykrab 2025-06-25
|
||||||
|
* LoginServerList Global to Singleton Cleanup ([#4941](https://github.com/EQEmu/Server/pull/4941)) @Kinglykrab 2025-06-25
|
||||||
|
* Optimize PCH Config (Faster Builds) ([#4951](https://github.com/EQEmu/Server/pull/4951)) @Akkadius 2025-06-22
|
||||||
|
* PCH Cleanup ([#4952](https://github.com/EQEmu/Server/pull/4952)) @Akkadius 2025-06-25
|
||||||
|
* PathManager Global to Singleton Cleanup ([#4924](https://github.com/EQEmu/Server/pull/4924)) @Akkadius 2025-06-22
|
||||||
|
* PetitionList Global to Singleton Cleanup ([#4944](https://github.com/EQEmu/Server/pull/4944)) @Kinglykrab 2025-06-25
|
||||||
|
* PlayerEventLogs Global to Singleton Cleanup ([#4928](https://github.com/EQEmu/Server/pull/4928)) @Kinglykrab 2025-06-25
|
||||||
|
* QueryServConnection Global to Singleton Cleanup ([#4938](https://github.com/EQEmu/Server/pull/4938)) @Kinglykrab 2025-06-25
|
||||||
|
* Remove Lua Rule Constants ([#4949](https://github.com/EQEmu/Server/pull/4949)) @Akkadius 2025-06-22
|
||||||
|
* Remove Regex Compile Bloat ([#4947](https://github.com/EQEmu/Server/pull/4947)) @Akkadius 2025-06-22
|
||||||
|
* Remove Unused MZoneShutdown Mutex ([#4946](https://github.com/EQEmu/Server/pull/4946)) @Kinglykrab 2025-06-22
|
||||||
|
* SharedTaskManager Global to Singleton Cleanup ([#4930](https://github.com/EQEmu/Server/pull/4930)) @Kinglykrab 2025-06-25
|
||||||
|
* SkillCaps Global to Singleton Cleanup ([#4933](https://github.com/EQEmu/Server/pull/4933)) @Kinglykrab 2025-06-22
|
||||||
|
* TaskManager Global to Singleton Cleanup ([#4945](https://github.com/EQEmu/Server/pull/4945)) @Kinglykrab 2025-06-22
|
||||||
|
* UCSConnection Global to Singleton Cleanup ([#4937](https://github.com/EQEmu/Server/pull/4937)) @Kinglykrab 2025-06-25
|
||||||
|
* WebInterfaceList Global to Singleton Cleanup ([#4935](https://github.com/EQEmu/Server/pull/4935)) @Kinglykrab 2025-06-25
|
||||||
|
* WorldContentServer Global to Singleton Cleanup ([#4939](https://github.com/EQEmu/Server/pull/4939)) @Kinglykrab 2025-06-25
|
||||||
|
* WorldEventScheduler and ZoneEventScheduler Global to Singleton Cleanup ([#4932](https://github.com/EQEmu/Server/pull/4932)) @Kinglykrab 2025-06-25
|
||||||
|
* ZSList Global to Singleton Cleanup ([#4940](https://github.com/EQEmu/Server/pull/4940)) @Kinglykrab 2025-06-25
|
||||||
|
* ZoneStore Global to Singleton Cleanup ([#4934](https://github.com/EQEmu/Server/pull/4934)) @Kinglykrab 2025-06-23
|
||||||
|
|
||||||
|
### Corpses
|
||||||
|
|
||||||
|
* Add corpse entity variables to DB ([#4911](https://github.com/EQEmu/Server/pull/4911)) @fryguy503 2025-06-25
|
||||||
|
|
||||||
|
### Databuckets
|
||||||
|
|
||||||
|
* Move Databuckets to Common ([#4918](https://github.com/EQEmu/Server/pull/4918)) @Akkadius 2025-06-16
|
||||||
|
* Nested Caching ([#4917](https://github.com/EQEmu/Server/pull/4917)) @Akkadius 2025-06-25
|
||||||
|
|
||||||
|
### Doors
|
||||||
|
|
||||||
|
* Fix door saving for versions ([#4905](https://github.com/EQEmu/Server/pull/4905)) @nytmyr 2025-06-09
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Bulk Send Corpses after Idle State ([#4910](https://github.com/EQEmu/Server/pull/4910)) @Akkadius 2025-06-09
|
||||||
|
* Fix ClientList Singleton Shortcomings of #4942 @Akkadius 2025-06-25
|
||||||
|
* Fix breaking changes to Titanium, SoF, SoD patches causes by big bags update ([#4922](https://github.com/EQEmu/Server/pull/4922)) @regneq 2025-06-25
|
||||||
|
|
||||||
|
### Logs
|
||||||
|
|
||||||
|
* Fix output for tasks in logs ([#4907](https://github.com/EQEmu/Server/pull/4907)) @joligario 2025-06-09
|
||||||
|
|
||||||
|
### Performance
|
||||||
|
|
||||||
|
* Auto Idle / AFK ([#4903](https://github.com/EQEmu/Server/pull/4903)) @Akkadius 2025-05-22
|
||||||
|
* Wearchange Packet Send Deduplication ([#4916](https://github.com/EQEmu/Server/pull/4916)) @Akkadius 2025-06-25
|
||||||
|
|
||||||
|
### Player Event Logs
|
||||||
|
|
||||||
|
* Don't Clear Event Data on ETL Events ([#4913](https://github.com/EQEmu/Server/pull/4913)) @Akkadius 2025-06-25
|
||||||
|
|
||||||
|
### Player Events
|
||||||
|
|
||||||
|
* Don't Write Empty Data ([#4912](https://github.com/EQEmu/Server/pull/4912)) @Akkadius 2025-06-25
|
||||||
|
* Zone Fetch Settings from QS if Enabled ([#4915](https://github.com/EQEmu/Server/pull/4915)) @Akkadius 2025-06-25
|
||||||
|
|
||||||
|
### Quest API
|
||||||
|
|
||||||
|
* Add CompleteTask and UncompleteTask methods to Perl/Lua ([#4921](https://github.com/EQEmu/Server/pull/4921)) @Barathos 2025-06-25
|
||||||
|
* Lua Client Scoped EnableTitleSets ([#4914](https://github.com/EQEmu/Server/pull/4914)) @fryguy503 2025-06-25
|
||||||
|
|
||||||
|
### Quests
|
||||||
|
|
||||||
|
* Support Multiple Quest, Plugin, and Lua Module Paths ([#4906](https://github.com/EQEmu/Server/pull/4906)) @Akkadius 2025-06-09
|
||||||
|
|
||||||
|
### World API
|
||||||
|
|
||||||
|
* Input Validation ([#4904](https://github.com/EQEmu/Server/pull/4904)) @Akkadius 2025-05-22
|
||||||
|
|
||||||
|
## [23.7.0] 5/19/2025
|
||||||
|
|
||||||
|
### CLI
|
||||||
|
|
||||||
|
* Add custom database version output ([#4901](https://github.com/EQEmu/Server/pull/4901)) @joligario 2025-05-18
|
||||||
|
* Fix MySQL check in database dumper ([#4897](https://github.com/EQEmu/Server/pull/4897)) @joligario 2025-05-16
|
||||||
|
|
||||||
|
### Commands
|
||||||
|
|
||||||
|
* Add #zonevariable Command ([#4882](https://github.com/EQEmu/Server/pull/4882)) @Kinglykrab 2025-05-15
|
||||||
|
|
||||||
|
### Database
|
||||||
|
|
||||||
|
* Add Custom Database Migrations for Operators ([#4892](https://github.com/EQEmu/Server/pull/4892)) @Akkadius 2025-05-16
|
||||||
|
* Remove Transaction Wrapped Character Save ([#4894](https://github.com/EQEmu/Server/pull/4894)) @Akkadius 2025-05-16
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Deadlock on failed #copycharacter commands ([#4887](https://github.com/EQEmu/Server/pull/4887)) @Akkadius 2025-05-16
|
||||||
|
|
||||||
|
### Logging
|
||||||
|
|
||||||
|
* Auto Update Log Category Names ([#4890](https://github.com/EQEmu/Server/pull/4890)) @Akkadius 2025-05-16
|
||||||
|
|
||||||
|
### Netcode
|
||||||
|
|
||||||
|
* Resend Logic Adjustments ([#4900](https://github.com/EQEmu/Server/pull/4900)) @Akkadius 2025-05-18
|
||||||
|
|
||||||
|
### Player Events
|
||||||
|
|
||||||
|
* Add rule to ignore configured GM commands ([#4888](https://github.com/EQEmu/Server/pull/4888)) @Akkadius 2025-05-16
|
||||||
|
|
||||||
|
### Rules
|
||||||
|
|
||||||
|
* Auto Update Rule Notes from Source ([#4891](https://github.com/EQEmu/Server/pull/4891)) @Akkadius 2025-05-16
|
||||||
|
|
||||||
|
### World
|
||||||
|
|
||||||
|
* Fix Rarer Reload Deadlock ([#4893](https://github.com/EQEmu/Server/pull/4893)) @Akkadius 2025-05-16
|
||||||
|
|
||||||
|
### Zone State
|
||||||
|
|
||||||
|
* Load New Spawn2 Data When Present ([#4889](https://github.com/EQEmu/Server/pull/4889)) @Akkadius 2025-05-16
|
||||||
|
|
||||||
|
## [23.6.0] 5/14/2025
|
||||||
|
|
||||||
|
### Bots
|
||||||
|
|
||||||
|
* Correct ^pull logic and add checks for Enchanter pets ([#4827](https://github.com/EQEmu/Server/pull/4827)) @nytmyr 2025-05-15
|
||||||
|
* Fix creation limit, spawn limit, level requirement checks ([#4868](https://github.com/EQEmu/Server/pull/4868)) @nytmyr 2025-05-15
|
||||||
|
* Move all spell_id instances to uint16 ([#4876](https://github.com/EQEmu/Server/pull/4876)) @nytmyr 2025-05-15
|
||||||
|
* Prevent non-taunters from potentially fleeing mob on TargetReflection ([#4859](https://github.com/EQEmu/Server/pull/4859)) @nytmyr 2025-04-28
|
||||||
|
|
||||||
|
### CLI
|
||||||
|
|
||||||
|
* ETL Settings Output ([#4873](https://github.com/EQEmu/Server/pull/4873)) @joligario 2025-05-15
|
||||||
|
|
||||||
|
### Code
|
||||||
|
|
||||||
|
* Fix typo in QueryNameAvailablity ([#4869](https://github.com/EQEmu/Server/pull/4869)) @nytmyr 2025-04-28
|
||||||
|
|
||||||
|
### Crash
|
||||||
|
|
||||||
|
* Fix crash bug with pbae and quest scripts spawning mobs ([#4884](https://github.com/EQEmu/Server/pull/4884)) @carolus21rex 2025-05-15
|
||||||
|
|
||||||
|
### Feature
|
||||||
|
|
||||||
|
* Add Character:TradeskillUpMinChance rule ([#4867](https://github.com/EQEmu/Server/pull/4867)) @zrix-eq 2025-05-15
|
||||||
|
* Enable spawn attribute for NPCTintID ([#4871](https://github.com/EQEmu/Server/pull/4871)) @neckkola 2025-05-15
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Add trader/buyer cleanup actions ([#4843](https://github.com/EQEmu/Server/pull/4843)) @neckkola 2025-05-15
|
||||||
|
* Fix #copycharacter command ([#4860](https://github.com/EQEmu/Server/pull/4860)) @nytmyr 2025-04-28
|
||||||
|
* Fix Crash with #task ([#4874](https://github.com/EQEmu/Server/pull/4874)) @Kinglykrab 2025-04-30
|
||||||
|
* Fix Object Name Init, User Refs, and Client Sync on Close ([#4861](https://github.com/EQEmu/Server/pull/4861)) @zimp-wow 2025-05-15
|
||||||
|
* Fix breaking change to UF patches caused by Big Bags update ([#4883](https://github.com/EQEmu/Server/pull/4883)) @hbingram 2025-05-15
|
||||||
|
* Prevent Ranged Attack from being triggered at arbitrary rate ([#4879](https://github.com/EQEmu/Server/pull/4879)) @catapultam-habeo 2025-05-15
|
||||||
|
|
||||||
|
### Performance
|
||||||
|
|
||||||
|
* Store Player Title Sets in Client Memory ([#4836](https://github.com/EQEmu/Server/pull/4836)) @Kinglykrab 2025-05-15
|
||||||
|
|
||||||
|
### Quest API
|
||||||
|
|
||||||
|
* Add Last Login and First Login Flags to EVENT_CONNECT ([#4866](https://github.com/EQEmu/Server/pull/4866)) @Kinglykrab 2025-05-15
|
||||||
|
|
||||||
|
## [23.5.0] 4/10/2025
|
||||||
|
|
||||||
|
### API
|
||||||
|
|
||||||
|
* World API Optimizations ([#4850](https://github.com/EQEmu/Server/pull/4850)) @Akkadius 2025-04-10
|
||||||
|
|
||||||
|
### Bots
|
||||||
|
|
||||||
|
* Add valid state checks to ^clickitem ([#4830](https://github.com/EQEmu/Server/pull/4830)) @nytmyr 2025-04-10
|
||||||
|
* Flag all buffs with SE_DamageShield as Damage Shield ([#4833](https://github.com/EQEmu/Server/pull/4833)) @nytmyr 2025-04-10
|
||||||
|
* Positioning rewrite ([#4856](https://github.com/EQEmu/Server/pull/4856)) @nytmyr 2025-04-10
|
||||||
|
* Restore old buff overwrite blocking ([#4832](https://github.com/EQEmu/Server/pull/4832)) @nytmyr 2025-04-10
|
||||||
|
|
||||||
|
### Bugfix
|
||||||
|
|
||||||
|
* Load zone variables before encounter_load. ([#4846](https://github.com/EQEmu/Server/pull/4846)) @zimp-wow 2025-04-10
|
||||||
|
* Prevent depops from blocking new spawns. ([#4841](https://github.com/EQEmu/Server/pull/4841)) @zimp-wow 2025-04-10
|
||||||
|
* Prevent final shutdown from persisting incomplete state. ([#4849](https://github.com/EQEmu/Server/pull/4849)) @zimp-wow 2025-04-10
|
||||||
|
|
||||||
|
### Code
|
||||||
|
|
||||||
|
* Remove queryserv dump flag ([#4842](https://github.com/EQEmu/Server/pull/4842)) @joligario 2025-04-10
|
||||||
|
* Update link for legacy EQEmu loginserver account setup ([#4826](https://github.com/EQEmu/Server/pull/4826)) @joligario 2025-04-10
|
||||||
|
|
||||||
|
### Crash
|
||||||
|
|
||||||
|
* Fix rarer exception crash issue in PlayerEventLogs::ProcessBatchQueue ([#4835](https://github.com/EQEmu/Server/pull/4835)) @Akkadius 2025-04-03
|
||||||
|
|
||||||
|
### Database
|
||||||
|
|
||||||
|
* Fix manifest for `helmtexture` in `horses` table ([#4852](https://github.com/EQEmu/Server/pull/4852)) @joligario 2025-04-10
|
||||||
|
|
||||||
|
### Feature
|
||||||
|
|
||||||
|
* Add rule to consume command text from any channel ([#4839](https://github.com/EQEmu/Server/pull/4839)) @catapultam-habeo 2025-04-10
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Add the bazaar search limit to query ([#4829](https://github.com/EQEmu/Server/pull/4829)) @neckkola 2025-04-10
|
||||||
|
* Backfill expire_at (not sure why this didn't make it in there to begin with) @Akkadius 2025-03-31
|
||||||
|
* Bazaar Search window not working in a DZ ([#4828](https://github.com/EQEmu/Server/pull/4828)) @neckkola 2025-04-10
|
||||||
|
* Databuckets Account Cache Loading ([#4855](https://github.com/EQEmu/Server/pull/4855)) @Akkadius 2025-04-10
|
||||||
|
* Fix missing timer_name check on Mob::StopTimer ([#4840](https://github.com/EQEmu/Server/pull/4840)) @zimp-wow 2025-04-04
|
||||||
|
* FixHeading Infinite Loop Fix ([#4854](https://github.com/EQEmu/Server/pull/4854)) @KimLS 2025-04-10
|
||||||
|
* Make sure we don't expire default value instances @Akkadius 2025-03-31
|
||||||
|
* Regression in World SendEmoteMessageRaw ([#4837](https://github.com/EQEmu/Server/pull/4837)) @Akkadius 2025-04-03
|
||||||
|
* Remove QS Tables From Export @Akkadius 2025-04-10
|
||||||
|
* Zone State Spawn2 Location Restore ([#4844](https://github.com/EQEmu/Server/pull/4844)) @Akkadius 2025-04-10
|
||||||
|
|
||||||
|
### Netcode
|
||||||
|
|
||||||
|
* Fix Stale Client Edge Case ([#4853](https://github.com/EQEmu/Server/pull/4853)) @Akkadius 2025-04-10
|
||||||
|
|
||||||
|
### Performance
|
||||||
|
|
||||||
|
* Character Save Optimizations ([#4851](https://github.com/EQEmu/Server/pull/4851)) @Akkadius 2025-04-10
|
||||||
|
* Network Ring Buffers ([#4857](https://github.com/EQEmu/Server/pull/4857)) @Akkadius 2025-04-10
|
||||||
|
* Pre-Compute CLE Server Lists ([#4838](https://github.com/EQEmu/Server/pull/4838)) @Akkadius 2025-04-10
|
||||||
|
|
||||||
|
### Spells
|
||||||
|
|
||||||
|
* Fear resistance effects edge case fixes and support for SPA 102 as an AA ([#4848](https://github.com/EQEmu/Server/pull/4848)) @KayenEQ 2025-04-10
|
||||||
|
* Update to SPA 180 SE_ResistSpellChance to not block unresistable spells. ([#4847](https://github.com/EQEmu/Server/pull/4847)) @KayenEQ 2025-04-10
|
||||||
|
* Update to SPA 378 SE_SpellEffectResistChance ([#4845](https://github.com/EQEmu/Server/pull/4845)) @KayenEQ 2025-04-10
|
||||||
|
|
||||||
|
## [23.4.0] 3/30/2025
|
||||||
|
|
||||||
|
### API
|
||||||
|
|
||||||
|
* Expose Zoneserver Compile Metadata ([#4815](https://github.com/EQEmu/Server/pull/4815)) @Akkadius 2025-03-29
|
||||||
|
|
||||||
|
### Bots
|
||||||
|
|
||||||
|
* Charmed Pets were breaking Mob respawns ([#4780](https://github.com/EQEmu/Server/pull/4780)) @nytmyr 2025-03-16
|
||||||
|
* Enraged positioning ([#4789](https://github.com/EQEmu/Server/pull/4789)) @nytmyr 2025-03-29
|
||||||
|
* Fix IsValidSpellTypeBySpellID to account for all types ([#4764](https://github.com/EQEmu/Server/pull/4764)) @nytmyr 2025-03-19
|
||||||
|
* Fix Rule ZonesWithSpawnLimits/ZonesWithForcedSpawnLimits errors ([#4791](https://github.com/EQEmu/Server/pull/4791)) @nytmyr 2025-03-29
|
||||||
|
* Fix rule Bots:FinishBuffing ([#4788](https://github.com/EQEmu/Server/pull/4788)) @nytmyr 2025-03-29
|
||||||
|
* Line of Sight and Mez optimizations and cleanup ([#4746](https://github.com/EQEmu/Server/pull/4746)) @nytmyr 2025-03-29
|
||||||
|
* Prevent bot pets from despawning on #repop ([#4790](https://github.com/EQEmu/Server/pull/4790)) @nytmyr 2025-03-29
|
||||||
|
|
||||||
|
### Code
|
||||||
|
|
||||||
|
* Control flow defaults missed in recent bot updates ([#4817](https://github.com/EQEmu/Server/pull/4817)) @joligario 2025-03-30
|
||||||
|
* Remove Extraneous Time Type in ShowZoneData ([#4806](https://github.com/EQEmu/Server/pull/4806)) @Kinglykrab 2025-03-29
|
||||||
|
* Remove Unused Command Methods ([#4805](https://github.com/EQEmu/Server/pull/4805)) @Kinglykrab 2025-03-29
|
||||||
|
* UCS Member Count ([#4819](https://github.com/EQEmu/Server/pull/4819)) @joligario 2025-03-30
|
||||||
|
|
||||||
|
### Commands
|
||||||
|
|
||||||
|
* Add #show zone_variables ([#4812](https://github.com/EQEmu/Server/pull/4812)) @Akkadius 2025-03-29
|
||||||
|
* Add Instance Support to #zoneshutdown ([#4807](https://github.com/EQEmu/Server/pull/4807)) @Kinglykrab 2025-03-29
|
||||||
|
|
||||||
|
### Crash
|
||||||
|
|
||||||
|
* Fix Rarer World Crash with Player Event Thread Processor ([#4800](https://github.com/EQEmu/Server/pull/4800)) @Akkadius 2025-03-29
|
||||||
|
* Fix Repop Race Condition Crash ([#4814](https://github.com/EQEmu/Server/pull/4814)) @Akkadius 2025-03-29
|
||||||
|
|
||||||
|
### Database
|
||||||
|
|
||||||
|
* Fix Respawn Times Table ([#4802](https://github.com/EQEmu/Server/pull/4802)) @Akkadius 2025-03-29
|
||||||
|
* Wrap PurgeExpiredInstances in a Transaction ([#4824](https://github.com/EQEmu/Server/pull/4824)) @Akkadius 2025-03-30
|
||||||
|
|
||||||
|
### Feature
|
||||||
|
|
||||||
|
* Implement /changename & related script bindings. Clean up #set name ([#4770](https://github.com/EQEmu/Server/pull/4770)) @catapultam-habeo 2025-03-20
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* AllowFVNoDrop Flag trades ([#4809](https://github.com/EQEmu/Server/pull/4809)) @neckkola 2025-03-27
|
||||||
|
* Fix Instance Creation Race Condition ([#4803](https://github.com/EQEmu/Server/pull/4803)) @Akkadius 2025-03-29
|
||||||
|
* Fix zone crash when attempting to add a disappearing client to hate list. ([#4782](https://github.com/EQEmu/Server/pull/4782)) @zimp-wow 2025-03-19
|
||||||
|
* Globally Reloading Quests when not loaded ([#4813](https://github.com/EQEmu/Server/pull/4813)) @Akkadius 2025-03-29
|
||||||
|
* Instance DZ Creation ([#4823](https://github.com/EQEmu/Server/pull/4823)) @Akkadius 2025-03-30
|
||||||
|
* Zone State Entity Variable Load Pre-Spawn ([#4785](https://github.com/EQEmu/Server/pull/4785)) @Akkadius 2025-03-19
|
||||||
|
* Zone State Position Fix ([#4784](https://github.com/EQEmu/Server/pull/4784)) @Akkadius 2025-03-19
|
||||||
|
* Zone State Variables Load First ([#4798](https://github.com/EQEmu/Server/pull/4798)) @Akkadius 2025-03-29
|
||||||
|
* Zone state edge case with 0 hp ([#4787](https://github.com/EQEmu/Server/pull/4787)) @Akkadius 2025-03-29
|
||||||
|
|
||||||
|
### Instance
|
||||||
|
|
||||||
|
* Clear Respawn Timers on Creation ([#4801](https://github.com/EQEmu/Server/pull/4801)) @Akkadius 2025-03-29
|
||||||
|
|
||||||
|
### Instances
|
||||||
|
|
||||||
|
* Add `expire_at` Column ([#4820](https://github.com/EQEmu/Server/pull/4820)) @Akkadius 2025-03-30
|
||||||
|
|
||||||
|
### Performance
|
||||||
|
|
||||||
|
* Add several database indexes ([#4811](https://github.com/EQEmu/Server/pull/4811)) @Akkadius 2025-03-29
|
||||||
|
* Have World Send Smarter Guild Updates ([#4796](https://github.com/EQEmu/Server/pull/4796)) @Akkadius 2025-03-29
|
||||||
|
* Improve Character Select DB Performance ([#4799](https://github.com/EQEmu/Server/pull/4799)) @Akkadius 2025-03-29
|
||||||
|
* Reduce Adventure S2S chatter ([#4793](https://github.com/EQEmu/Server/pull/4793)) @Akkadius 2025-03-29
|
||||||
|
* Reduce CorpseOwnerOnline S2S Chatter to World ([#4795](https://github.com/EQEmu/Server/pull/4795)) @Akkadius 2025-03-29
|
||||||
|
* Reduce LFGuild Chatter ([#4794](https://github.com/EQEmu/Server/pull/4794)) @Akkadius 2025-03-29
|
||||||
|
* Reduce UpdateWho S2S Chatter to World ([#4792](https://github.com/EQEmu/Server/pull/4792)) @Akkadius 2025-03-29
|
||||||
|
* Send Smarter Emote Packets ([#4818](https://github.com/EQEmu/Server/pull/4818)) @Akkadius 2025-03-30
|
||||||
|
|
||||||
|
### Quest API
|
||||||
|
|
||||||
|
* Add Support for NPC ID and NPC Name Specificity ([#4781](https://github.com/EQEmu/Server/pull/4781)) @Kinglykrab 2025-03-19
|
||||||
|
|
||||||
|
### Reload
|
||||||
|
|
||||||
|
* Add Reload for Maps / Navs ([#4816](https://github.com/EQEmu/Server/pull/4816)) @Akkadius 2025-03-29
|
||||||
|
|
||||||
|
### Zone
|
||||||
|
|
||||||
|
* Zone State Automated Testing and Improvements ([#4808](https://github.com/EQEmu/Server/pull/4808)) @Akkadius 2025-03-30
|
||||||
|
* Zone State Improvements Part 3 ([#4773](https://github.com/EQEmu/Server/pull/4773)) @Akkadius 2025-03-13
|
||||||
|
|
||||||
|
## [23.3.4] 3/14/2025
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Add check for simultaneous direct vendor and parcel Trader/Buyer Purchase ([#4778](https://github.com/EQEmu/Server/pull/4778)) @neckkola 2025-03-14
|
||||||
|
* Fix for rare circumstance where NPC's would have 0 health on restore @Akkadius
|
||||||
|
|
||||||
|
## [23.3.3] 3/13/2025
|
||||||
|
|
||||||
|
### Database
|
||||||
|
|
||||||
|
* Add indexes for data_buckets and zone_state_spawns ([#4771](https://github.com/EQEmu/Server/pull/4771)) @Akkadius 2025-03-11
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Update GuildBank to correctly handle items with charges equal to zero ([#4774](https://github.com/EQEmu/Server/pull/4774)) @neckkola 2025-03-13
|
||||||
|
|
||||||
|
### Networking
|
||||||
|
|
||||||
|
* Fix "port in use" error ([#4772](https://github.com/EQEmu/Server/pull/4772)) @Akkadius 2025-03-12
|
||||||
|
|
||||||
|
### Zone
|
||||||
|
|
||||||
|
* Zone State Improvements Part 3 ([#4773](https://github.com/EQEmu/Server/pull/4773)) @Akkadius 2025-03-13
|
||||||
|
|
||||||
|
## [23.3.2] 3/11/2025
|
||||||
|
|
||||||
|
### DynamicZones
|
||||||
|
|
||||||
|
* Bulk request dz member statuses on zone boot ([#4769](https://github.com/EQEmu/Server/pull/4769)) @hgtw 2025-03-11
|
||||||
|
|
||||||
|
### Zone
|
||||||
|
|
||||||
|
* Zone State Improvements (Continued) ([#4768](https://github.com/EQEmu/Server/pull/4768)) @Akkadius 2025-03-11
|
||||||
|
|
||||||
|
## [23.3.0] 3/8/2025
|
||||||
|
|
||||||
|
### Bots
|
||||||
|
|
||||||
|
* Fix buffs not overwriting lesser buffs ([#4756](https://github.com/EQEmu/Server/pull/4756)) @nytmyr 2025-03-06
|
||||||
|
* Fix taunting bots positioning ([#4754](https://github.com/EQEmu/Server/pull/4754)) @nytmyr 2025-03-06
|
||||||
|
* Move commanded spell map to zone ([#4755](https://github.com/EQEmu/Server/pull/4755)) @nytmyr 2025-03-06
|
||||||
|
|
||||||
|
### Code
|
||||||
|
|
||||||
|
* Fix typo in GM tradeskill combine message ([#4762](https://github.com/EQEmu/Server/pull/4762)) @nytmyr 2025-03-08
|
||||||
|
|
||||||
|
### Crash
|
||||||
|
|
||||||
|
* Bot aura crash fix ([#4752](https://github.com/EQEmu/Server/pull/4752)) @nytmyr 2025-03-06
|
||||||
|
|
||||||
|
### Databuckets
|
||||||
|
|
||||||
|
* Nested Databuckets Protections and Improvements ([#4748](https://github.com/EQEmu/Server/pull/4748)) @Akkadius 2025-03-04
|
||||||
|
|
||||||
|
### Feature
|
||||||
|
|
||||||
|
* Add Rule for dealing with augments when an item evolves ([#4758](https://github.com/EQEmu/Server/pull/4758)) @neckkola 2025-03-08
|
||||||
|
* Allow assigning Helm Texture independently of Body Texture for Horses ([#4759](https://github.com/EQEmu/Server/pull/4759)) @catapultam-habeo 2025-03-08
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Add crash checks for certain PlayerEventLogs ([#4761](https://github.com/EQEmu/Server/pull/4761)) @neckkola 2025-03-07
|
||||||
|
* Correct incorrectly calculated stat caps with Heroic Stats ([#4760](https://github.com/EQEmu/Server/pull/4760)) @catapultam-habeo 2025-03-08
|
||||||
|
* Fix sigabort crash from invalid JSON @Akkadius 2025-03-03
|
||||||
|
* Forgot to push up some changes for test output @Akkadius 2025-03-04
|
||||||
|
* Parcel Delivery Updates for two edge cases ([#4753](https://github.com/EQEmu/Server/pull/4753)) @neckkola 2025-03-06
|
||||||
|
* Remove one port check in world @Akkadius 2025-03-03
|
||||||
|
* Zero out currentnpcid whenever spawn is reset. ([#4763](https://github.com/EQEmu/Server/pull/4763)) @zimp-wow 2025-03-08
|
||||||
|
|
||||||
|
### Logging
|
||||||
|
|
||||||
|
* Convert JSON Error to Data Buckets Logging Category ([#4747](https://github.com/EQEmu/Server/pull/4747)) @Kinglykrab 2025-03-04
|
||||||
|
|
||||||
|
### Pets
|
||||||
|
|
||||||
|
* Fix renamed pets loading as blank names ([#4751](https://github.com/EQEmu/Server/pull/4751)) @nytmyr 2025-03-05
|
||||||
|
|
||||||
|
### Rules
|
||||||
|
|
||||||
|
* Fix EvolvingItems:PercentOfRaidExperience Description ([#4757](https://github.com/EQEmu/Server/pull/4757)) @Kinglykrab 2025-03-07
|
||||||
|
|
||||||
|
### Tests
|
||||||
|
|
||||||
|
* Cleanup Hand-in Tests ([#4749](https://github.com/EQEmu/Server/pull/4749)) @Akkadius 2025-03-04
|
||||||
|
|
||||||
|
### Zone
|
||||||
|
|
||||||
|
* Make zone controller less likely to be visible, immune to all forms of combat ([#4750](https://github.com/EQEmu/Server/pull/4750)) @Akkadius 2025-03-06
|
||||||
|
* State Save Improvements ([#4765](https://github.com/EQEmu/Server/pull/4765)) @Akkadius 2025-03-08
|
||||||
|
|
||||||
|
## [23.2.0] 3/3/2025
|
||||||
|
|
||||||
|
### Crash
|
||||||
|
|
||||||
|
* Database SetMutex crash fix ([#4741](https://github.com/EQEmu/Server/pull/4741)) @Akkadius 2025-03-03
|
||||||
|
* Fix Aura process crash with bots ([#4743](https://github.com/EQEmu/Server/pull/4743)) @Akkadius 2025-03-03
|
||||||
|
* Fix crash in add loot code path ([#4745](https://github.com/EQEmu/Server/pull/4745)) @Akkadius 2025-03-03
|
||||||
|
* Fix world repop crash ([#4742](https://github.com/EQEmu/Server/pull/4742)) @Akkadius 2025-03-03
|
||||||
|
* Potential crash fix in scan close mobs ([#4744](https://github.com/EQEmu/Server/pull/4744)) @Akkadius 2025-03-03
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Cleanup zone buckets on instance purge. ([#4739](https://github.com/EQEmu/Server/pull/4739)) @zimp-wow 2025-03-02
|
||||||
|
* Fix an error causing Endurance Regen to not be applied by items. ([#4738](https://github.com/EQEmu/Server/pull/4738)) @catapultam-habeo 2025-03-02
|
||||||
|
|
||||||
|
### World
|
||||||
|
|
||||||
|
* Check if port in use to avoid double booting mistakes ([#4740](https://github.com/EQEmu/Server/pull/4740)) @Akkadius 2025-03-03
|
||||||
|
|
||||||
|
## [23.1.0] 3/1/2025
|
||||||
|
|
||||||
|
### Bots
|
||||||
|
|
||||||
|
* Fix unresponsive bots in groups upon group wipe ([#4712](https://github.com/EQEmu/Server/pull/4712)) @nytmyr 2025-02-28
|
||||||
|
|
||||||
|
### Code
|
||||||
|
|
||||||
|
* More login <-> world code cleanup ([#4724](https://github.com/EQEmu/Server/pull/4724)) @Akkadius 2025-02-28
|
||||||
|
|
||||||
|
### Crash
|
||||||
|
|
||||||
|
* Check for directory existence before traversing in CheckForCompatibleQuestPlugins ([#4730](https://github.com/EQEmu/Server/pull/4730)) @Akkadius 2025-03-02
|
||||||
|
* Fix filesystem crash / exception in DatabaseDumpService::RemoveCredentialsFile() ([#4731](https://github.com/EQEmu/Server/pull/4731)) @Akkadius 2025-03-01
|
||||||
|
* Fix large file size crash in File::GetContents for windows ([#4735](https://github.com/EQEmu/Server/pull/4735)) @Akkadius 2025-03-02
|
||||||
|
* Fix reload concurrency crash when ran from Spire ([#4733](https://github.com/EQEmu/Server/pull/4733)) @Akkadius 2025-03-02
|
||||||
|
* Validate item in SE_SummonItemIntoBag ([#4734](https://github.com/EQEmu/Server/pull/4734)) @Akkadius 2025-03-02
|
||||||
|
* World CLI validation ([#4728](https://github.com/EQEmu/Server/pull/4728)) @Akkadius 2025-03-01
|
||||||
|
|
||||||
|
### Database
|
||||||
|
|
||||||
|
* Remove force_interactive from big bag updates ([#4727](https://github.com/EQEmu/Server/pull/4727)) @Akkadius 2025-03-01
|
||||||
|
|
||||||
|
### Feature
|
||||||
|
|
||||||
|
* Add a rule for spells to bypass stacking rules ([#4716](https://github.com/EQEmu/Server/pull/4716)) @catapultam-habeo 2025-02-28
|
||||||
|
* Evolving items Additions ([#4725](https://github.com/EQEmu/Server/pull/4725)) @neckkola 2025-03-01
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Add character_pet_name to player tables schema @Akkadius 2025-03-02
|
||||||
|
* Add client packets to questmanager:setguild ([#4732](https://github.com/EQEmu/Server/pull/4732)) @neckkola 2025-03-01
|
||||||
|
* Clear m_completed_shared_tasks before reloading @Akkadius 2025-02-24
|
||||||
|
* Fix AA Reset Error Message ([#4720](https://github.com/EQEmu/Server/pull/4720)) @Kinglykrab 2025-02-28
|
||||||
|
* Fix Issue with Suffixes/Prefixes ([#4723](https://github.com/EQEmu/Server/pull/4723)) @Kinglykrab 2025-02-28
|
||||||
|
* Fix Trading Items to Bot Pets ([#4721](https://github.com/EQEmu/Server/pull/4721)) @MortimerGreenwald 2025-02-28
|
||||||
|
* Refactor ApplyItemBonuses to fix double-counting of ATK and recommended levels not correctly applying ([#4713](https://github.com/EQEmu/Server/pull/4713)) @catapultam-habeo 2025-03-01
|
||||||
|
|
||||||
|
### Loginserver
|
||||||
|
|
||||||
|
* Minor cleanup ([#4729](https://github.com/EQEmu/Server/pull/4729)) @Akkadius 2025-03-01
|
||||||
|
|
||||||
|
### Quest API
|
||||||
|
|
||||||
|
* Add Key Ring Methods to Perl and Lua ([#4719](https://github.com/EQEmu/Server/pull/4719)) @Kinglykrab 2025-02-28
|
||||||
|
* Implement eq.handin() and quest::handin() ([#4718](https://github.com/EQEmu/Server/pull/4718)) @Akkadius 2025-02-28
|
||||||
|
|
||||||
|
### Tasks
|
||||||
|
|
||||||
|
* Extend IsTaskCompleted to also be aware of shared task completion ([#4714](https://github.com/EQEmu/Server/pull/4714)) @Akkadius 2025-02-24
|
||||||
|
|
||||||
|
### Zone
|
||||||
|
|
||||||
|
* Implement Zone State Saving on Shutdown ([#4715](https://github.com/EQEmu/Server/pull/4715)) @Akkadius 2025-02-28
|
||||||
|
|
||||||
|
### Zone State
|
||||||
|
|
||||||
|
* Wrap all serialization/deserialization in try/catch ([#4726](https://github.com/EQEmu/Server/pull/4726)) @Akkadius 2025-03-01
|
||||||
|
|
||||||
|
## [23.0.2] 2/21/2025
|
||||||
|
|
||||||
|
### Bots
|
||||||
|
|
||||||
|
* Add checks to ensure bots and pets do not engage on ^pull ([#4708](https://github.com/EQEmu/Server/pull/4708)) @nytmyr 2025-02-22
|
||||||
|
* Improve positioning ([#4709](https://github.com/EQEmu/Server/pull/4709)) @nytmyr 2025-02-22
|
||||||
|
* Prevent medding in combat if any mob has bot targeted ([#4707](https://github.com/EQEmu/Server/pull/4707)) @nytmyr 2025-02-22
|
||||||
|
|
||||||
|
### Client Mod
|
||||||
|
|
||||||
|
* Adds a hacked fast camp rule for GMs ([#4697](https://github.com/EQEmu/Server/pull/4697)) @KimLS 2025-02-20
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Fix Lua Zone ID Exports ([#4700](https://github.com/EQEmu/Server/pull/4700)) @Kinglykrab 2025-02-22
|
||||||
|
* Fix bad Mob reference in QuestManager::resumetimer() ([#4710](https://github.com/EQEmu/Server/pull/4710)) @zimp-wow 2025-02-22
|
||||||
|
* Fix cursor load on zone ([#4704](https://github.com/EQEmu/Server/pull/4704)) @nytmyr 2025-02-22
|
||||||
|
* Fix infinite loop in QuestManager::stoptimer() ([#4703](https://github.com/EQEmu/Server/pull/4703)) @zimp-wow 2025-02-21
|
||||||
|
|
||||||
|
### Quest API
|
||||||
|
|
||||||
|
* Add GetSpawn() to Perl and Lua ([#4702](https://github.com/EQEmu/Server/pull/4702)) @Kinglykrab 2025-02-22
|
||||||
|
|
||||||
|
## [23.0.1] 2/20/2025
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Player event ordering merge fix ([#4699](https://github.com/EQEmu/Server/pull/4699)) @Akkadius 2025-02-20
|
||||||
|
|
||||||
|
### Quest API
|
||||||
|
|
||||||
|
* Add DisableRespawnTimers to Perl and Lua ([#4691](https://github.com/EQEmu/Server/pull/4691)) @Kinglykrab 2025-02-20
|
||||||
|
|
||||||
|
## [23.0.0] 2/19/2025
|
||||||
|
|
||||||
|
### Bots
|
||||||
|
|
||||||
|
* Add AEHateLine to HateLine ParentType ([#4678](https://github.com/EQEmu/Server/pull/4678)) @nytmyr 2025-02-15
|
||||||
|
* Add IsInRaidOrGroup checks to ^attack and ^pull ([#4654](https://github.com/EQEmu/Server/pull/4654)) @nytmyr 2025-02-07
|
||||||
|
* Add missing stance options ([#4681](https://github.com/EQEmu/Server/pull/4681)) @nytmyr 2025-02-15
|
||||||
|
* Bot Overhaul ([#4580](https://github.com/EQEmu/Server/pull/4580)) @nytmyr 2025-02-03
|
||||||
|
* Command Cleanup ([#4676](https://github.com/EQEmu/Server/pull/4676)) @nytmyr 2025-02-15
|
||||||
|
* Correct camp count on ^camp ([#4650](https://github.com/EQEmu/Server/pull/4650)) @nytmyr 2025-02-06
|
||||||
|
* Correct helper message for forced casts ([#4656](https://github.com/EQEmu/Server/pull/4656)) @nytmyr 2025-02-07
|
||||||
|
* Crash fixes related to GetNumberNeedingHealedInGroup ([#4684](https://github.com/EQEmu/Server/pull/4684)) @nytmyr 2025-02-15
|
||||||
|
* Fix AE range calculation ([#4683](https://github.com/EQEmu/Server/pull/4683)) @nytmyr 2025-02-15
|
||||||
|
* Fix Bards not casting ([#4638](https://github.com/EQEmu/Server/pull/4638)) @nytmyr 2025-02-03
|
||||||
|
* Fix a couple potential crashes with GetNumberNeedingHealedInGroup ([#4652](https://github.com/EQEmu/Server/pull/4652)) @nytmyr 2025-02-07
|
||||||
|
* Fix crash related to GetTempSpellType() ([#4649](https://github.com/EQEmu/Server/pull/4649)) @nytmyr 2025-02-06
|
||||||
|
* Fix pets causing aggro ([#4677](https://github.com/EQEmu/Server/pull/4677)) @nytmyr 2025-02-15
|
||||||
|
* Fix spell priority commands ([#4660](https://github.com/EQEmu/Server/pull/4660)) @nytmyr 2025-02-08
|
||||||
|
* Fix typo in positioning ([#4659](https://github.com/EQEmu/Server/pull/4659)) @nytmyr 2025-02-08
|
||||||
|
* Move BotGetSpellsByType to cache ([#4655](https://github.com/EQEmu/Server/pull/4655)) @nytmyr 2025-02-07
|
||||||
|
* Prevents casting on ineligible targets due to target type, stacking, etc. ([#4680](https://github.com/EQEmu/Server/pull/4680)) @nytmyr 2025-02-15
|
||||||
|
* Sanity checks for spell type updates ([#4641](https://github.com/EQEmu/Server/pull/4641)) @nytmyr 2025-02-05
|
||||||
|
|
||||||
|
### Bug
|
||||||
|
|
||||||
|
* Item Purchase Offset when multiple buyers are buying at the same time. ([#4628](https://github.com/EQEmu/Server/pull/4628)) @fryguy503 2025-02-06
|
||||||
|
|
||||||
|
### CI
|
||||||
|
|
||||||
|
* Fix database race condition ([#4646](https://github.com/EQEmu/Server/pull/4646)) @Akkadius 2025-02-06
|
||||||
|
|
||||||
|
### Client Mod
|
||||||
|
|
||||||
|
* Adds a hacked fast camp rule for GMs ([#4697](https://github.com/EQEmu/Server/pull/4697)) @KimLS 2025-02-20
|
||||||
|
|
||||||
|
### Code
|
||||||
|
|
||||||
|
* Bot RaidGroupSay ([#4653](https://github.com/EQEmu/Server/pull/4653)) @nytmyr 2025-02-07
|
||||||
|
* Cleanup logic in cursor bag check ([#4642](https://github.com/EQEmu/Server/pull/4642)) @nytmyr 2025-02-04
|
||||||
|
* Use Repositories for Titles ([#4608](https://github.com/EQEmu/Server/pull/4608)) @Kinglykrab 2025-02-07
|
||||||
|
|
||||||
|
### Commands
|
||||||
|
|
||||||
|
* Fix #goto not accepting proper heading ([#4685](https://github.com/EQEmu/Server/pull/4685)) @nytmyr 2025-02-15
|
||||||
|
* Fix Illusion Block ([#4666](https://github.com/EQEmu/Server/pull/4666)) @nytmyr 2025-02-12
|
||||||
|
|
||||||
|
### Crash
|
||||||
|
|
||||||
|
* Fix raid/group crash regression ([#4671](https://github.com/EQEmu/Server/pull/4671)) @Akkadius 2025-02-12
|
||||||
|
* Fix zone crash caused by NPC::MoveTo ([#4639](https://github.com/EQEmu/Server/pull/4639)) @catapultam-habeo 2025-02-03
|
||||||
|
|
||||||
|
### Databuckets
|
||||||
|
|
||||||
|
* Add Zone Scoped Databuckets ([#4690](https://github.com/EQEmu/Server/pull/4690)) @Akkadius 2025-02-18
|
||||||
|
|
||||||
|
### Expeditions
|
||||||
|
|
||||||
|
* Move expedition code into DynamicZone ([#4672](https://github.com/EQEmu/Server/pull/4672)) @hgtw 2025-02-16
|
||||||
|
|
||||||
|
### Feature
|
||||||
|
|
||||||
|
* Add Support for Tradeskill Recipe Inspect ([#4648](https://github.com/EQEmu/Server/pull/4648)) @Kinglykrab 2025-02-06
|
||||||
|
* Add rule to allow /changepetname to function without being enabled by scripts. @catapultam-habeo 2025-02-05
|
||||||
|
* GuildBank Updates ([#4674](https://github.com/EQEmu/Server/pull/4674)) @neckkola 2025-02-15
|
||||||
|
* Implement Big Bags ([#4606](https://github.com/EQEmu/Server/pull/4606)) @Kinglykrab 2025-02-03
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* #rq and #reload quest alias ([#4694](https://github.com/EQEmu/Server/pull/4694)) @Akkadius 2025-02-18
|
||||||
|
* Always spawn zone controller first ([#4669](https://github.com/EQEmu/Server/pull/4669)) @Akkadius 2025-02-12
|
||||||
|
* Big Bag Cleanup ([#4643](https://github.com/EQEmu/Server/pull/4643)) @fryguy503 2025-02-05
|
||||||
|
* Big Bag additional fixes ([#4644](https://github.com/EQEmu/Server/pull/4644)) @fryguy503 2025-02-05
|
||||||
|
* Change logging level for no items found in a bazaar search to reduce spam logs. ([#4675](https://github.com/EQEmu/Server/pull/4675)) @neckkola 2025-02-13
|
||||||
|
* Find Zone - Expansion Settings ([#4692](https://github.com/EQEmu/Server/pull/4692)) @MortimerGreenwald 2025-02-18
|
||||||
|
* Fix Beastlord Warder Size Modifier ([#4665](https://github.com/EQEmu/Server/pull/4665)) @Kinglykrab 2025-02-12
|
||||||
|
* Fix CI since hand-ins are merged @Akkadius 2025-02-03
|
||||||
|
* Fix Illusion Fade Texture Bug ([#4673](https://github.com/EQEmu/Server/pull/4673)) @Kinglykrab 2025-02-14
|
||||||
|
* Fix Item Discovery ([#4663](https://github.com/EQEmu/Server/pull/4663)) @Kinglykrab 2025-02-10
|
||||||
|
* Fix ST_GroupNoPets and ST_GroupClientAndPet ([#4667](https://github.com/EQEmu/Server/pull/4667)) @nytmyr 2025-02-10
|
||||||
|
* Fix SendStatsWindow Mod2 Value Display ([#4658](https://github.com/EQEmu/Server/pull/4658)) @Kinglykrab 2025-02-07
|
||||||
|
* Fix Tradeskill Queries ([#4661](https://github.com/EQEmu/Server/pull/4661)) @Kinglykrab 2025-02-09
|
||||||
|
* Fix error in update manifest ([#4637](https://github.com/EQEmu/Server/pull/4637)) @nytmyr 2025-02-03
|
||||||
|
* Fix issue with getting an unset nested databucket ([#4693](https://github.com/EQEmu/Server/pull/4693)) @Akkadius 2025-02-19
|
||||||
|
* Fix non-error in player_event_logs ([#4695](https://github.com/EQEmu/Server/pull/4695)) @Akkadius 2025-02-18
|
||||||
|
* GMMove Update Edge Case With Clients ([#4686](https://github.com/EQEmu/Server/pull/4686)) @Akkadius 2025-02-15
|
||||||
|
* Item Handins to Pets ([#4687](https://github.com/EQEmu/Server/pull/4687)) @Akkadius 2025-02-15
|
||||||
|
* Parcel Delivery Updates ([#4688](https://github.com/EQEmu/Server/pull/4688)) @neckkola 2025-02-16
|
||||||
|
* Prevent zone from loading ETL ID's on bootup ([#4696](https://github.com/EQEmu/Server/pull/4696)) @Akkadius 2025-02-18
|
||||||
|
* Update pre big bag corpse slot_id's to support big bags ([#4679](https://github.com/EQEmu/Server/pull/4679)) @nytmyr 2025-02-15
|
||||||
|
|
||||||
|
### Inventory
|
||||||
|
|
||||||
|
* Fix cursor bag saving to invalid slot_ids ([#4640](https://github.com/EQEmu/Server/pull/4640)) @nytmyr 2025-02-04
|
||||||
|
|
||||||
|
### Items
|
||||||
|
|
||||||
|
* Overhaul Item Hand-in System ([#4593](https://github.com/EQEmu/Server/pull/4593)) @Akkadius 2025-02-03
|
||||||
|
|
||||||
|
### Loginserver
|
||||||
|
|
||||||
|
* Fix iterator crash ([#4670](https://github.com/EQEmu/Server/pull/4670)) @Akkadius 2025-02-12
|
||||||
|
* Modernize codebase ([#4647](https://github.com/EQEmu/Server/pull/4647)) @Akkadius 2025-02-06
|
||||||
|
|
||||||
|
### NPC Handins
|
||||||
|
|
||||||
|
* Fix MultiQuest Handins ([#4651](https://github.com/EQEmu/Server/pull/4651)) @Akkadius 2025-02-07
|
||||||
|
|
||||||
|
### Performance
|
||||||
|
|
||||||
|
* Server Reload Overhaul ([#4689](https://github.com/EQEmu/Server/pull/4689)) @Akkadius 2025-02-18
|
||||||
|
|
||||||
|
### Player Event Logs
|
||||||
|
|
||||||
|
* Migrate and Deprecate QS Legacy Logging ([#4542](https://github.com/EQEmu/Server/pull/4542)) @neckkola 2025-02-05
|
||||||
|
|
||||||
|
### Quest API
|
||||||
|
|
||||||
|
* Add Bandolier Methods ([#4635](https://github.com/EQEmu/Server/pull/4635)) @Kinglykrab 2025-02-03
|
||||||
|
* Add Potion Belt Methods ([#4634](https://github.com/EQEmu/Server/pull/4634)) @Kinglykrab 2025-02-04
|
||||||
|
* Add Zone Support to Perl and Lua ([#4662](https://github.com/EQEmu/Server/pull/4662)) @Kinglykrab 2025-02-09
|
||||||
|
|
||||||
|
### Spells
|
||||||
|
|
||||||
|
* Add all types to checks for max_targets_allowed rule for AEs ([#4682](https://github.com/EQEmu/Server/pull/4682)) @nytmyr 2025-02-15
|
||||||
|
|
||||||
|
## [22.62.2] 2/1/2025
|
||||||
|
|
||||||
|
### Fixes
|
||||||
|
|
||||||
|
* Add price change check to the Bazaar Search Window purchase mechanics ([#4632](https://github.com/EQEmu/Server/pull/4632)) @neckkola 2025-02-01
|
||||||
|
* NewBazaar Search Consumables ([#4631](https://github.com/EQEmu/Server/pull/4631)) @neckkola 2025-02-01
|
||||||
|
* Update the shard bazaar search feature ([#4630](https://github.com/EQEmu/Server/pull/4630)) @neckkola 2025-02-01
|
||||||
|
|
||||||
|
### Memory Leak
|
||||||
|
|
||||||
|
* Revert " Change raw pointer to unique_ptr to avoid potential leak in dbg stream " ([#4616](https://github.com/EQEmu/Server/pull/4616)) @Akkadius 2025-01-27
|
||||||
|
|
||||||
|
### Performance
|
||||||
|
|
||||||
|
* Significantly Improve Client Network Resends ([#4629](https://github.com/EQEmu/Server/pull/4629)) @Akkadius 2025-02-01
|
||||||
|
|
||||||
|
## [22.62.1] 1/27/2025
|
||||||
|
|
||||||
|
### Memory Leak
|
||||||
|
|
||||||
|
* Revert "Change raw pointer to unique_ptr to avoid potential leak in dbg stream" ([#4616](https://github.com/EQEmu/Server/pull/4616)) @Akkadius 2025-01-27
|
||||||
|
|
||||||
|
### Performance
|
||||||
|
|
||||||
|
* Re-use ClientUpdate packet memory ([#4619](https://github.com/EQEmu/Server/pull/4619)) @Akkadius 2025-01-27
|
||||||
|
* Re-use OP_Animation packet ([#4621](https://github.com/EQEmu/Server/pull/4621)) @Akkadius 2025-01-27
|
||||||
|
* Re-use OP_Damage packet memory ([#4625](https://github.com/EQEmu/Server/pull/4625)) @Akkadius 2025-01-27
|
||||||
|
* Re-use OP_HPUpdate packet memory ([#4622](https://github.com/EQEmu/Server/pull/4622)) @Akkadius 2025-01-27
|
||||||
|
* Re-use OP_PlayerStateAdd packet memory ([#4626](https://github.com/EQEmu/Server/pull/4626)) @Akkadius 2025-01-27
|
||||||
|
* Re-use OP_SendFindableNPCs packet memory ([#4623](https://github.com/EQEmu/Server/pull/4623)) @Akkadius 2025-01-27
|
||||||
|
|
||||||
|
### Repop
|
||||||
|
|
||||||
|
* Make #repop instant ([#4620](https://github.com/EQEmu/Server/pull/4620)) @Akkadius 2025-01-27
|
||||||
|
|
||||||
## [22.62.0] 1/26/2025
|
## [22.62.0] 1/26/2025
|
||||||
|
|
||||||
### Bazaar
|
### Bazaar
|
||||||
|
|||||||
+223
-432
@@ -1,487 +1,278 @@
|
|||||||
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)
|
if(DEFINED ENV{VCPKG_ROOT} AND NOT DEFINED CMAKE_TOOLCHAIN_FILE)
|
||||||
CMAKE_POLICY(SET CMP0074 NEW)
|
message(STATUS "Using vcpkg env variable")
|
||||||
ENDIF()
|
set(CMAKE_TOOLCHAIN_FILE "$ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "")
|
||||||
|
elseif(NOT DEFINED CMAKE_TOOLCHAIN_FILE)
|
||||||
|
message(STATUS "Using vcpkg submodule")
|
||||||
|
set(CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_SOURCE_DIR}/submodules/vcpkg/scripts/buildsystems/vcpkg.cmake" CACHE STRING "")
|
||||||
|
endif()
|
||||||
|
|
||||||
PROJECT(EQEmu)
|
project(EQEmu)
|
||||||
|
|
||||||
IF(NOT CMAKE_BUILD_TYPE)
|
#explicitly set CMP0167 for Find Boost
|
||||||
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
|
if(POLICY CMP0167)
|
||||||
ENDIF(NOT CMAKE_BUILD_TYPE)
|
cmake_policy(SET CMP0167 NEW)
|
||||||
|
endif()
|
||||||
|
|
||||||
SET(CMAKE_CXX_STANDARD 20)
|
if(NOT CMAKE_BUILD_TYPE)
|
||||||
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
|
set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
|
||||||
SET(CMAKE_CXX_EXTENSIONS OFF)
|
endif()
|
||||||
|
|
||||||
OPTION(EQEMU_BUILD_STATIC "Build with static linking" OFF)
|
set(CMAKE_CXX_STANDARD 20)
|
||||||
OPTION(EQEMU_BUILD_PCH "Build with precompiled headers (Windows)" ON)
|
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)
|
# Requires libgoogle-perftools-dev google-perftools packages for linux (debian)
|
||||||
IF(EQEMU_ADD_PROFILER)
|
if(EQEMU_ADD_PROFILER)
|
||||||
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-as-needed,-lprofiler,--as-needed")
|
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-as-needed,-lprofiler,--as-needed")
|
||||||
ENDIF(EQEMU_ADD_PROFILER)
|
endif()
|
||||||
|
|
||||||
IF(USE_MAP_MMFS)
|
if(USE_MAP_MMFS)
|
||||||
ADD_DEFINITIONS(-DUSE_MAP_MMFS)
|
add_definitions(-DUSE_MAP_MMFS)
|
||||||
ENDIF (USE_MAP_MMFS)
|
endif()
|
||||||
|
|
||||||
IF(MSVC)
|
if(MSVC)
|
||||||
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
|
add_compile_options(/bigobj)
|
||||||
ADD_DEFINITIONS(-DNOMINMAX)
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||||
ADD_DEFINITIONS(-DCRASH_LOGGING)
|
add_definitions(-DNOMINMAX)
|
||||||
ADD_DEFINITIONS(-D_HAS_AUTO_PTR_ETC) # for Luabind on C++17
|
add_definitions(-DCRASH_LOGGING)
|
||||||
|
add_definitions(-D_HAS_AUTO_PTR_ETC) # for Luabind on C++17
|
||||||
|
|
||||||
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)
|
option(EQEMU_DISABLE_MSVC_WARNINGS "Disable MSVC compile warnings." ON)
|
||||||
IF(EQEMU_DISABLE_MSVC_WARNINGS)
|
if(EQEMU_DISABLE_MSVC_WARNINGS)
|
||||||
ADD_DEFINITIONS( "/W0 /D_CRT_SECURE_NO_WARNINGS /wd4005 /wd4996 /nologo /Os")
|
add_definitions( "/W0 /D_CRT_SECURE_NO_WARNINGS /wd4005 /wd4996 /nologo /Os")
|
||||||
ENDIF(EQEMU_DISABLE_MSVC_WARNINGS)
|
endif()
|
||||||
ELSE(MSVC)
|
else(MSVC)
|
||||||
ADD_DEFINITIONS(-DHAS_UNION_SEMUN)
|
add_definitions(-DHAS_UNION_SEMUN)
|
||||||
ENDIF(MSVC)
|
endif()
|
||||||
|
|
||||||
#FreeBSD support
|
#FreeBSD support
|
||||||
IF(UNIX)
|
if(UNIX)
|
||||||
IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
if(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
||||||
ADD_DEFINITIONS(-DFREEBSD)
|
add_definitions(-DFREEBSD)
|
||||||
ADD_DEFINITIONS(-D_GLIBCXX_USE_C99)
|
add_definitions(-D_GLIBCXX_USE_C99)
|
||||||
SET(FREEBSD TRUE)
|
set(FREEBSD TRUE)
|
||||||
ENDIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
|
endif()
|
||||||
IF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
if(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
||||||
ADD_DEFINITIONS(-DDARWIN)
|
add_definitions(-DDARWIN)
|
||||||
SET(DARWIN TRUE)
|
set(DARWIN TRUE)
|
||||||
ENDIF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
|
endif()
|
||||||
ENDIF(UNIX)
|
endif()
|
||||||
|
|
||||||
ADD_DEFINITIONS(-DGLM_FORCE_RADIANS)
|
add_definitions(-DGLM_FORCE_RADIANS)
|
||||||
ADD_DEFINITIONS(-DGLM_FORCE_CTOR_INIT)
|
add_definitions(-DGLM_FORCE_CTOR_INIT)
|
||||||
ADD_DEFINITIONS(-DGLM_ENABLE_EXPERIMENTAL)
|
add_definitions(-DGLM_ENABLE_EXPERIMENTAL)
|
||||||
|
|
||||||
#MSVC can fetch dependencies automatically.
|
find_package(Boost REQUIRED COMPONENTS dynamic_bitset foreach tuple)
|
||||||
IF(MSVC)
|
find_package(cereal CONFIG REQUIRED)
|
||||||
INCLUDE("${CMAKE_SOURCE_DIR}/cmake/DependencyHelperMSVC.cmake")
|
find_package(fmt CONFIG REQUIRED)
|
||||||
ENDIF()
|
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(PerlLibs)
|
||||||
|
|
||||||
#Find everything we need
|
message(STATUS "**************************************************")
|
||||||
FIND_PACKAGE(Boost REQUIRED)
|
message(STATUS "* Library Detection *")
|
||||||
FIND_PACKAGE(MySQL)
|
message(STATUS "**************************************************")
|
||||||
FIND_PACKAGE(MariaDB)
|
|
||||||
FIND_PACKAGE(ZLIB)
|
|
||||||
FIND_PACKAGE(OpenSSL)
|
|
||||||
FIND_PACKAGE(Lua51)
|
|
||||||
FIND_PACKAGE(LuaJit)
|
|
||||||
FIND_PACKAGE(PerlLibs)
|
|
||||||
FIND_PACKAGE(Sodium)
|
|
||||||
FIND_PACKAGE(mbedTLS)
|
|
||||||
|
|
||||||
MESSAGE(STATUS "**************************************************")
|
if(MARIADB_FOUND)
|
||||||
MESSAGE(STATUS "* Library Detection *")
|
message(STATUS "* MariaDB: FOUND *")
|
||||||
MESSAGE(STATUS "**************************************************")
|
else()
|
||||||
|
message(STATUS "* MariaDB: MISSING *")
|
||||||
|
endif()
|
||||||
|
|
||||||
IF(MYSQL_FOUND)
|
if(ZLIB_FOUND)
|
||||||
MESSAGE(STATUS "* MySQL: FOUND *")
|
message(STATUS "* ZLIB: FOUND *")
|
||||||
ELSE()
|
else()
|
||||||
MESSAGE(STATUS "* MySQL: MISSING *")
|
message(STATUS "* ZLIB: MISSING *")
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
IF(MARIADB_FOUND)
|
if(LuaJit_FOUND)
|
||||||
MESSAGE(STATUS "* MariaDB: FOUND *")
|
message(STATUS "* LuaJIT: FOUND *")
|
||||||
ELSE()
|
else()
|
||||||
MESSAGE(STATUS "* MariaDB: MISSING *")
|
message(STATUS "* LuaJIT: MISSING *")
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
IF(ZLIB_FOUND)
|
if(PerlLibs_FOUND)
|
||||||
MESSAGE(STATUS "* ZLIB: FOUND *")
|
message(STATUS "* Perl: FOUND *")
|
||||||
ELSE()
|
else()
|
||||||
MESSAGE(STATUS "* ZLIB: MISSING *")
|
message(STATUS "* Perl: MISSING *")
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
IF(Lua51_FOUND)
|
if(OpenSSL_FOUND)
|
||||||
MESSAGE(STATUS "* Lua: FOUND *")
|
message(STATUS "* OpenSSL: FOUND *")
|
||||||
ELSE()
|
else()
|
||||||
MESSAGE(STATUS "* Lua: MISSING *")
|
message(STATUS "* OpenSSL: MISSING *")
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
IF(LuaJit_FOUND)
|
message(STATUS "PERL_INCLUDE_PATH: ${PERL_INCLUDE_PATH}")
|
||||||
MESSAGE(STATUS "* LuaJIT: FOUND *")
|
message(STATUS "PERL_LIBRARY: ${PERL_LIBRARY}")
|
||||||
ELSE()
|
message(STATUS "PERL_INCLUDE_DIR: ${PERL_INCLUDE_DIR}")
|
||||||
MESSAGE(STATUS "* LuaJIT: MISSING *")
|
message(STATUS "PERL_INCLUDE_DIRS: ${PERL_INCLUDE_DIRS}")
|
||||||
ENDIF()
|
message(STATUS "PERL_LIBRARIES: ${PERL_LIBRARIES}")
|
||||||
|
message(STATUS "PERL_VERSION: ${PERL_VERSION}")
|
||||||
|
message(STATUS "**************************************************")
|
||||||
|
|
||||||
IF(PerlLibs_FOUND)
|
include_directories(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/websocketpp")
|
||||||
MESSAGE(STATUS "* Perl: FOUND *")
|
|
||||||
ELSE()
|
|
||||||
MESSAGE(STATUS "* Perl: MISSING *")
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF(SODIUM_FOUND)
|
add_definitions(-DBOOST_BIND_GLOBAL_PLACEHOLDERS)
|
||||||
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 "**************************************************")
|
|
||||||
|
|
||||||
#options
|
#options
|
||||||
OPTION(EQEMU_COMMANDS_LOGGING "Enable GM Command logs" ON)
|
option(EQEMU_COMMANDS_LOGGING "Enable GM Command logs" ON)
|
||||||
OPTION(EQEMU_BUILD_SERVER "Build the game server." ON)
|
option(EQEMU_BUILD_SERVER "Build the game server." ON)
|
||||||
OPTION(EQEMU_BUILD_LOGIN "Build the login 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_TESTS "Build utility tests." OFF)
|
option(EQEMU_BUILD_CLIENT_FILES "Build Client Import/Export Data Programs." ON)
|
||||||
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_PREFER_LUA "Build with normal Lua even if LuaJIT is found." OFF)
|
|
||||||
|
|
||||||
#PRNG options
|
#PRNG options
|
||||||
OPTION(EQEMU_ADDITIVE_LFIB_PRNG "Use Additive LFib for PRNG." OFF)
|
option(EQEMU_ADDITIVE_LFIB_PRNG "Use Additive LFib for PRNG." OFF)
|
||||||
MARK_AS_ADVANCED(EQEMU_ADDITIVE_LFIB_PRNG)
|
mark_as_advanced(EQEMU_ADDITIVE_LFIB_PRNG)
|
||||||
OPTION(EQEMU_BIASED_INT_DIST "Use biased int dist instead of uniform." OFF)
|
option(EQEMU_BIASED_INT_DIST "Use biased int dist instead of uniform." OFF)
|
||||||
MARK_AS_ADVANCED(EQEMU_BIASED_INT_DIST)
|
mark_as_advanced(EQEMU_BIASED_INT_DIST)
|
||||||
SET(EQEMU_CUSTOM_PRNG_ENGINE "" CACHE STRING "Custom random engine. (ex. std::default_random_engine)")
|
set(EQEMU_CUSTOM_PRNG_ENGINE "" CACHE STRING "Custom random engine. (ex. std::default_random_engine)")
|
||||||
MARK_AS_ADVANCED(EQEMU_CUSTOM_PRNG_ENGINE)
|
mark_as_advanced(EQEMU_CUSTOM_PRNG_ENGINE)
|
||||||
|
|
||||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
OPTION(EQEMU_SFMT19937 "Use GCC's extention for SIMD Fast MT19937." OFF)
|
option(EQEMU_SFMT19937 "Use GCC's extention for SIMD Fast MT19937." OFF)
|
||||||
MARK_AS_ADVANCED(EQEMU_SFMT19937)
|
mark_as_advanced(EQEMU_SFMT19937)
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
IF(EQEMU_ADDITIVE_LFIB_PRNG)
|
if(EQEMU_ADDITIVE_LFIB_PRNG)
|
||||||
ADD_DEFINITIONS(-DUSE_ADDITIVE_LFIB_PRNG)
|
add_definitions(-DUSE_ADDITIVE_LFIB_PRNG)
|
||||||
IF(EQEMU_SFMT19937)
|
if(EQEMU_SFMT19937)
|
||||||
MESSAGE(STATUS "SFMT19937 and ADDITITVE_LFIB_PRNG both set, SFMT19937 ignored.")
|
message(STATUS "SFMT19937 and ADDITITVE_LFIB_PRNG both set, SFMT19937 ignored.")
|
||||||
SET(EQEMU_SFMT19937 OFF)
|
set(EQEMU_SFMT19937 OFF)
|
||||||
ENDIF()
|
endif()
|
||||||
IF(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "")
|
if(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "")
|
||||||
MESSAGE(STATUS "CUSTOM_PRNG_ENGINE and ADDITITVE_LFIB_PRNG both set, CUSTOM_PRNG_ENGINE ignored.")
|
message(STATUS "CUSTOM_PRNG_ENGINE and ADDITITVE_LFIB_PRNG both set, CUSTOM_PRNG_ENGINE ignored.")
|
||||||
SET(EQEMU_CUSTOM_PRNG_ENGINE "")
|
set(EQEMU_CUSTOM_PRNG_ENGINE "")
|
||||||
ENDIF()
|
endif()
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
IF(EQEMU_SFMT19937)
|
if(EQEMU_SFMT19937)
|
||||||
ADD_DEFINITIONS(-DUSE_SFMT19937)
|
add_definitions(-DUSE_SFMT19937)
|
||||||
IF(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "")
|
if(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "")
|
||||||
MESSAGE(STATUS "CUSTOM_PRNG_ENGINE and SFMT19937 both set, CUSTOM_PRNG_ENGINE ignored.")
|
message(STATUS "CUSTOM_PRNG_ENGINE and SFMT19937 both set, CUSTOM_PRNG_ENGINE ignored.")
|
||||||
SET(EQEMU_CUSTOM_PRNG_ENGINE "")
|
set(EQEMU_CUSTOM_PRNG_ENGINE "")
|
||||||
ENDIF()
|
endif()
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
IF(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "")
|
if(NOT EQEMU_CUSTOM_PRNG_ENGINE STREQUAL "")
|
||||||
ADD_DEFINITIONS(-DUSE_CUSTOM_PRNG_ENGINE=${EQEMU_CUSTOM_PRNG_ENGINE})
|
add_definitions(-DUSE_CUSTOM_PRNG_ENGINE=${EQEMU_CUSTOM_PRNG_ENGINE})
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
IF(EQEMU_BIASED_INT_DIST)
|
if(EQEMU_BIASED_INT_DIST)
|
||||||
ADD_DEFINITIONS(-DBIASED_INT_DIST)
|
add_definitions(-DBIASED_INT_DIST)
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
IF(EQEMU_COMMANDS_LOGGING)
|
if(EQEMU_COMMANDS_LOGGING)
|
||||||
ADD_DEFINITIONS(-DCOMMANDS_LOGGING)
|
add_definitions(-DCOMMANDS_LOGGING)
|
||||||
ENDIF(EQEMU_COMMANDS_LOGGING)
|
endif()
|
||||||
|
|
||||||
#database
|
if(${OPENSSL_VERSION} VERSION_GREATER_EQUAL "1.1.1")
|
||||||
IF(MySQL_FOUND AND MariaDB_FOUND)
|
add_definitions(-DCPPHTTPLIB_OPENSSL_SUPPORT)
|
||||||
SET(DATABASE_LIBRARY_SELECTION MariaDB CACHE STRING "Database library to use:
|
endif()
|
||||||
MySQL
|
|
||||||
MariaDB"
|
|
||||||
)
|
|
||||||
|
|
||||||
IF(DATABASE_LIBRARY_SELECTION STREQUAL "MySQL")
|
if(PerlLibs_FOUND)
|
||||||
SET(DATABASE_LIBRARY_TYPE " MySQL")
|
set(PERL_LIBRARY_TYPE " Perl")
|
||||||
SET(DATABASE_LIBRARY_LIBS ${MySQL_LIBRARIES})
|
set(PERL_LIBRARY_ENABLED ON)
|
||||||
SET(DATABASE_LIBRARY_INCLUDE ${MySQL_INCLUDE_DIR})
|
set(PERL_LIBRARY_LIBS ${PERL_LIBRARY})
|
||||||
ELSEIF(DATABASE_LIBRARY_SELECTION STREQUAL "MariaDB")
|
set(PERL_LIBRARY_INCLUDE ${PERL_INCLUDE_PATH})
|
||||||
SET(DATABASE_LIBRARY_TYPE "MariaDB")
|
else()
|
||||||
SET(DATABASE_LIBRARY_LIBS ${MariaDB_LIBRARIES})
|
set(PERL_LIBRARY_TYPE "Disabled")
|
||||||
SET(DATABASE_LIBRARY_INCLUDE ${MariaDB_INCLUDE_DIR})
|
set(PERL_LIBRARY_ENABLED OFF)
|
||||||
ELSE()
|
endif()
|
||||||
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
|
message(STATUS "")
|
||||||
#prefer openssl to mbedtls (arbitrary)
|
message(STATUS "**************************************************")
|
||||||
IF(OpenSSL_FOUND AND MBEDTLS_FOUND)
|
message(STATUS "* Library Usage *")
|
||||||
SET(TLS_LIBRARY_SELECTION OpenSSL CACHE STRING "TLS library to use:
|
message(STATUS "**************************************************")
|
||||||
OpenSSL
|
message(STATUS "* Database: MariaDB *")
|
||||||
mbedTLS"
|
message(STATUS "* TLS: OpenSSL *")
|
||||||
)
|
message(STATUS "* Lua: LuaJIT *")
|
||||||
|
message(STATUS "* Perl: ${PERL_LIBRARY_TYPE} *")
|
||||||
|
message(STATUS "* zlib: ZLIB *")
|
||||||
|
message(STATUS "**************************************************")
|
||||||
|
|
||||||
IF(TLS_LIBRARY_SELECTION STREQUAL "OpenSSL")
|
option(EQEMU_BUILD_LUA "Build Lua parser." ON)
|
||||||
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)
|
if(EQEMU_BUILD_LUA)
|
||||||
SET(SODIUM_LIBRARY_TYPE "Libsodium")
|
add_definitions(-DLUA_EQEMU)
|
||||||
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))
|
include_directories(SYSTEM "${LUAJIT_INCLUDE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/libs/luabind")
|
||||||
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)
|
option(EQEMU_SANITIZE_LUA_LIBS "Sanitize Lua Libraries (Remove OS and IO standard libraries from being able to run)." ON)
|
||||||
SET(PERL_LIBRARY_TYPE " Perl")
|
if(EQEMU_SANITIZE_LUA_LIBS)
|
||||||
SET(PERL_LIBRARY_ENABLED ON)
|
add_definitions(-DSANITIZE_LUA_LIBS)
|
||||||
SET(PERL_LIBRARY_LIBS ${PERL_LIBRARY})
|
endif()
|
||||||
SET(PERL_LIBRARY_INCLUDE ${PERL_INCLUDE_PATH})
|
endif()
|
||||||
ELSE()
|
|
||||||
SET(PERL_LIBRARY_TYPE "Disabled")
|
|
||||||
SET(PERL_LIBRARY_ENABLED OFF)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
#use zlib if exists
|
if(PERL_LIBRARY_ENABLED)
|
||||||
IF(ZLIB_FOUND)
|
option(EQEMU_BUILD_PERL "Build Perl parser." ON)
|
||||||
OPTION(EQEMU_BUILD_ZLIB "Build internal version of zlib." ON)
|
if(EQEMU_BUILD_PERL)
|
||||||
IF(EQEMU_BUILD_ZLIB)
|
set(SERVER_LIBS ${SERVER_LIBS} ${PERL_LIBRARY_LIBS} perlbind)
|
||||||
SET(ZLIB_LIBRARY_TYPE "zlib-ng")
|
INCLUDE_DIRECTORIES(SYSTEM "${PERL_LIBRARY_INCLUDE}" "${CMAKE_CURRENT_SOURCE_DIR}/libs/perlbind/include")
|
||||||
SET(ZLIB_LIBRARY_LIBS "zlibstatic")
|
add_definitions(-DEMBPERL)
|
||||||
SET(ZLIB_LIBRARY_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/libs/zlibng")
|
add_definitions(-DEMBPERL_PLUGIN)
|
||||||
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_BINARY_DIR}/libs/zlibng")
|
add_definitions(-DPERLBIND_NO_STRICT_SCALAR_TYPES)
|
||||||
ELSE()
|
endif()
|
||||||
SET(ZLIB_LIBRARY_TYPE " zlib")
|
endif()
|
||||||
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)
|
|
||||||
|
|
||||||
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")
|
|
||||||
|
|
||||||
|
set(SERVER_LIBS common)
|
||||||
# silence obnoxious deprecation message
|
# silence obnoxious deprecation message
|
||||||
ADD_DEFINITIONS(-DBOOST_BIND_GLOBAL_PLACEHOLDERS)
|
add_definitions(-DBOOST_BIND_GLOBAL_PLACEHOLDERS)
|
||||||
|
|
||||||
IF(TLS_LIBRARY_ENABLED)
|
if(WIN32)
|
||||||
SET(SERVER_LIBS ${SERVER_LIBS} ${TLS_LIBRARY_LIBS})
|
set(SERVER_LIBS ${SERVER_LIBS} "ws2_32" "psapi" "iphlpapi" "userenv")
|
||||||
INCLUDE_DIRECTORIES(SYSTEM "${TLS_LIBRARY_INCLUDE}")
|
endif()
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF(SODIUM_LIBRARY_ENABLED)
|
if(UNIX)
|
||||||
SET(SERVER_LIBS ${SERVER_LIBS} ${SODIUM_LIBRARY_LIBS})
|
set(SERVER_LIBS ${SERVER_LIBS} ${CMAKE_DL_LIBS} "z" "m" "pthread")
|
||||||
INCLUDE_DIRECTORIES(SYSTEM "${SODIUM_LIBRARY_INCLUDE}")
|
if(NOT DARWIN)
|
||||||
ENDIF()
|
set(SERVER_LIBS ${SERVER_LIBS} "rt")
|
||||||
|
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
|
# Freebsd provides uuids in the C library
|
||||||
IF(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||||
SET(SERVER_LIBS ${SERVER_LIBS} "uuid")
|
set(SERVER_LIBS ${SERVER_LIBS} "uuid")
|
||||||
ENDIF()
|
endif()
|
||||||
ENDIF()
|
endif()
|
||||||
|
|
||||||
SET(ZONE_LIBS ${ZONE_LIBS} ${SERVER_LIBS})
|
set(ZONE_LIBS ${ZONE_LIBS} ${SERVER_LIBS})
|
||||||
|
|
||||||
IF(EQEMU_BUILD_LOGIN AND NOT TLS_LIBRARY_ENABLED)
|
if(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS)
|
||||||
MESSAGE(FATAL_ERROR "Login server requires a TLS Library to build.")
|
add_subdirectory(common)
|
||||||
ENDIF()
|
add_subdirectory(libs)
|
||||||
|
endif()
|
||||||
|
|
||||||
IF(EQEMU_BUILD_HC AND NOT TLS_LIBRARY_ENABLED)
|
if(EQEMU_BUILD_SERVER)
|
||||||
MESSAGE(FATAL_ERROR "Headless client requires a TLS Library to build.")
|
add_subdirectory(shared_memory)
|
||||||
ENDIF()
|
add_subdirectory(world)
|
||||||
|
add_subdirectory(zone)
|
||||||
|
add_subdirectory(ucs)
|
||||||
|
add_subdirectory(queryserv)
|
||||||
|
add_subdirectory(eqlaunch)
|
||||||
|
endif()
|
||||||
|
|
||||||
IF(EQEMU_BUILD_SERVER OR EQEMU_BUILD_LOGIN OR EQEMU_BUILD_TESTS OR EQEMU_BUILD_HC)
|
if(EQEMU_BUILD_LOGIN)
|
||||||
ADD_SUBDIRECTORY(common)
|
add_subdirectory(loginserver)
|
||||||
ADD_SUBDIRECTORY(libs)
|
endif()
|
||||||
ADD_SUBDIRECTORY(submodules/fmt)
|
|
||||||
ADD_SUBDIRECTORY(submodules/libuv)
|
|
||||||
|
|
||||||
IF(EQEMU_BUILD_ZLIB)
|
if(EQEMU_BUILD_TESTS)
|
||||||
SET(ZLIB_COMPAT ON CACHE BOOL "Compile with zlib compatible API")
|
add_subdirectory(tests)
|
||||||
SET(ZLIB_ENABLE_TESTS OFF CACHE BOOL "Build test binaries")
|
endif()
|
||||||
ADD_SUBDIRECTORY(libs/zlibng)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
SET(RECASTNAVIGATION_DEMO OFF CACHE BOOL "Build demo")
|
if(EQEMU_BUILD_CLIENT_FILES)
|
||||||
SET(RECASTNAVIGATION_TESTS OFF CACHE BOOL "Build tests")
|
add_subdirectory(client_files)
|
||||||
SET(RECASTNAVIGATION_EXAMPLES OFF CACHE BOOL "Build examples")
|
endif()
|
||||||
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)
|
|
||||||
|
|||||||
@@ -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,83 +1,150 @@
|
|||||||
# EQEmulator Core Server
|
<h1 align="center">EQEmulator Server Platform</h1>
|
||||||
| Drone (Linux x64) | Drone (Windows x64) |
|
|
||||||
|:---:|:---:|
|
<p align="center">
|
||||||
|[](http://drone.akkadius.com/EQEmu/Server) |[](http://drone.akkadius.com/EQEmu/Server) |
|
<img src="https://github.com/user-attachments/assets/11942e15-b512-402d-a619-0543c7f1151e" style="border-radius: 10px">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<b>EQEmulator - A Fan-Made Project Honoring a Legendary MMORPG</b>
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://github.com/eqemu/server/graphs/contributors"><img src="https://img.shields.io/github/contributors/eqemu/server" alt="Contributors"></a>
|
||||||
|
<a href="https://discord.gg/QHsm7CD"><img src="https://img.shields.io/discord/212663220849213441?label=Discord&logo=discord&color=7289DA" alt="Discord"></a>
|
||||||
|
<a href="https://docs.eqemu.io"><img src="https://img.shields.io/badge/docs-MkDocs%20Powered-blueviolet" alt="Docs"></a>
|
||||||
|
<a href="./LICENSE"><img src="https://img.shields.io/github/license/EQEmu/Server" alt="License"></a>
|
||||||
|
<a href="https://github.com/eqemu/server/releases"><img src="https://img.shields.io/github/v/release/eqemu/server" alt="Latest Release"></a>
|
||||||
|
<a href="https://github.com/EQEmu/Server/releases"><img src="https://img.shields.io/github/release-date/EQEmu/Server" alt="Release Date"></a>
|
||||||
|
<img src="https://img.shields.io/github/downloads/eqemu/server/total.svg" alt="Github All Releases"></a>
|
||||||
|
<a href="http://drone.akkadius.com/EQEmu/Server"><img src="http://drone.akkadius.com/api/badges/EQEmu/Server/status.svg" alt="Build Status"></a>
|
||||||
|
<img src="https://img.shields.io/github/issues-pr-closed/eqemu/server" alt="GitHub Issues or Pull Requests">
|
||||||
|
<img src="https://img.shields.io/docker/pulls/akkadius/eqemu-server" alt="Docker Pulls">
|
||||||
|
<a href="http://drone.akkadius.com/EQEmu/Server"><img src="http://drone.akkadius.com/api/badges/EQEmu/Server/status.svg" alt="Build Status"></a> <img src="https://jb.gg/badges/official-plastic.svg" alt="Official">
|
||||||
|
|
||||||
|
</p>
|
||||||
|
|
||||||
***
|
***
|
||||||
|
|
||||||
**EQEmulator is a custom completely from-scratch open source server implementation for EverQuest built mostly on C++**
|
<p align="center">
|
||||||
* MySQL/MariaDB is used as the database engine (over 200+ tables)
|
EQEmulator is a <b>passion-driven</b>, <b>open source server emulator</b> project dedicated to preserving and celebrating the legacy of a groundbreaking classic MMORPG.
|
||||||
* Perl and LUA are both supported scripting languages for NPC/Player/Quest oriented events
|
</p>
|
||||||
* Open source database (Project EQ) has content up to expansion OoW (included in server installs)
|
|
||||||
* Game server environments and databases can be heavily customized to create all new experiences
|
|
||||||
* Hundreds of Quests/events created and maintained by Project EQ
|
|
||||||
|
|
||||||
## Server Installs
|
<p align="center">
|
||||||
| |Windows|Linux|
|
For over two decades and continuing, EQEmulator has served as a <strong>fan tribute</strong>, providing tools and technology that allow players to explore, customize, and experience the legendary game's iconic gameplay in new ways. This project exists solely out of <strong>deep admiration</strong> for the original developers, artists, designers, and visionaries who created one of the most influential online worlds of all time.
|
||||||
|:---:|:---:|:---:|
|
</p>
|
||||||
|**Install Count**|||
|
|
||||||
### > Windows
|
|
||||||
|
|
||||||
* [Install Guide](https://docs.eqemu.io/server/installation/server-installation-windows/)
|
<p align="center">
|
||||||
|
We do not claim ownership of the original game or its assets. <strong>All credit and respect belong to the original creators and Daybreak Game Company</strong>, whose work continues to inspire generations of players and developers alike.
|
||||||
|
</p>
|
||||||
|
|
||||||
### > Debian/Ubuntu/CentOS/Fedora
|
<p align="center">
|
||||||
|
EQEmulator has for over 20 years and always will be a <strong>fan-based, non-commercial open-source effort</strong> made by players, for players—preserving the legacy of the game while empowering community-driven creativity, learning and joy that the game and its creators has so strongly inspired in us all.
|
||||||
|
</p>
|
||||||
|
|
||||||
* [Install Guide](https://docs.eqemu.io/server/installation/server-installation-linux/)
|
***
|
||||||
|
|
||||||
* You can use curl or wget to kick off the installer (whichever your OS has)
|
<h3 align="center">
|
||||||
> curl -O https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/linux_installer/install.sh install.sh && chmod 755 install.sh && ./install.sh
|
Technical Overview & Reverse Engineering Effort
|
||||||
|
</h1>
|
||||||
|
|
||||||
> wget --no-check-certificate https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/linux_installer/install.sh -O install.sh && chmod 755 install.sh && ./install.sh
|
<p align="center">EQEmulator represents <strong>over two decades of collaborative reverse engineering</strong>, building the server from the ground up without access to the original source code. This effort was achieved entirely through <strong>community-driven analysis, network protocol decoding, and in-game behavioral research</strong>.</p>
|
||||||
|
|
||||||
## Supported Clients
|
<h1 align="center">
|
||||||
|
💡 How We Did It
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img src="https://github.com/user-attachments/assets/b6b48cf7-f64a-4497-9750-71f442a3d132" height="300px">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<strong>Reverse Engineering</strong>
|
||||||
|
Every system, packet, opcode, and game mechanic has been reconstructed through countless hours of live packet sniffing, client disassembly, and in-game experimentation by dedicated contributors over the years.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
No proprietary code or server sources were ever used.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
All implementations are the result of clean-room engineering.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
|
||||||
|
<h1 align="center">
|
||||||
|
🛠️ Technology Stack
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<img src="https://github.com/user-attachments/assets/df5ea809-86c5-439d-a8fa-651fb04ba477" style="border-radius: 10px">
|
||||||
|
</p>
|
||||||
|
|
||||||
|
**C++ Core Engine**
|
||||||
|
|
||||||
|
* High-performance networking and gameplay logic built in C++
|
||||||
|
* Cross-platform support for Linux and Windows
|
||||||
|
|
||||||
|
**MySQL / MariaDB Backend**
|
||||||
|
|
||||||
|
* Fully structured schema with over 200+ tables
|
||||||
|
* Supports content customization, expansions, and custom worlds
|
||||||
|
|
||||||
|
**Scripting Engine**
|
||||||
|
|
||||||
|
* Native support for **Perl** and **Lua** scripting
|
||||||
|
* Powerfully extendable for quests, NPC behaviors, and custom events
|
||||||
|
|
||||||
|
**Open Source Content Database**
|
||||||
|
|
||||||
|
* Includes ProjectEQ’s world data up through *Dragons of Norrath*
|
||||||
|
* 100% customizable to create entirely new game worlds
|
||||||
|
|
||||||
|
<h1 align="center">
|
||||||
|
🚀 Why It Matters
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<p align="center">🧬 EQEmulator stands as a <strong>technical preservation project</strong>, ensuring that the magic of classic and custom servers lives on for future generations of players, tinkerers, and game designers.
|
||||||
|
</p>
|
||||||
|
|
||||||
|
> We humbly acknowledge and thank the original developers for creating one of the most influential online experiences in gaming history.
|
||||||
|
|
||||||
|
<h1 align="center">
|
||||||
|
🧑💻🖥️ Supported Clients
|
||||||
|
</h1>
|
||||||
|
|
||||||
|Titanium Edition|Secrets of Faydwer|Seeds of Destruction|Underfoot|Rain of Fear|
|
|Titanium Edition|Secrets of Faydwer|Seeds of Destruction|Underfoot|Rain of Fear|
|
||||||
|:---:|:---:|:---:|:---:|:---:|
|
|:---:|:---:|:---:|:---:|:---:|
|
||||||
|<img src="http://i.imgur.com/hrwDxoM.jpg" height="150">|<img src="http://i.imgur.com/cRDW5tn.png" height="150">|<img src="http://i.imgur.com/V48kuVn.jpg" height="150">|<img src="http://i.imgur.com/IJQ0XMa.jpg" height="150">|<img src="http://i.imgur.com/OMpHkKa.png" height="100">|
|
|<img src="http://i.imgur.com/hrwDxoM.jpg" height="150">|<img src="http://i.imgur.com/cRDW5tn.png" height="150">|<img src="http://i.imgur.com/V48kuVn.jpg" height="150">|<img src="http://i.imgur.com/IJQ0XMa.jpg" height="150">|<img src="http://i.imgur.com/OMpHkKa.png" height="100">|
|
||||||
|
|
||||||
## Bug Reports <img src="http://i.imgur.com/daf1Vjw.png" height="20">
|
## 📚 Resources
|
||||||
* Please use the [issue tracker](https://github.com/EQEmu/Server/issues) provided by GitHub to send us bug
|
|
||||||
reports or feature requests.
|
|
||||||
* The [EQEmu Forums](http://www.eqemulator.org/forums/) are also a place to submit and get help with bugs.
|
|
||||||
|
|
||||||
## Contributions <img src="http://image.flaticon.com/icons/png/512/25/25231.png" width="20">
|
| Resource | Badges | Link |
|
||||||
|
|---------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------|
|
||||||
|
| **EQEmulator Docs** | [](https://docs.eqemu.io) | [docs.eqemu.io](https://docs.eqemu.io/) |
|
||||||
|
| **Discord Community**| [](https://discord.gg/QHsm7CD) | [Join Discord](https://discord.gg/QHsm7CD) |
|
||||||
|
| **Latest Release** | [](https://github.com/eqemu/server/releases) <br> [](https://github.com/EQEmu/Server/releases) <br> [](https://github.com/eqemu/server/releases) | [View Releases](https://github.com/eqemu/server/releases) |
|
||||||
|
| **License** | [](./LICENSE) | [View License](./LICENSE) |
|
||||||
|
| **Build Status** | [](http://drone.akkadius.com/EQEmu/Server) | [View Build Status](http://drone.akkadius.com/EQEmu/Server) |
|
||||||
|
| **Docker Pulls** | [](https://hub.docker.com/r/akkadius/eqemu-server) | [Docker Hub](https://hub.docker.com/r/akkadius/eqemu-server) |
|
||||||
|
| **Contributions** | [](https://github.com/eqemu/server/pulls?q=is%3Apr+is%3Aclosed) | [Closed PRs & Issues](https://github.com/eqemu/server/pulls?q=is%3Apr+is%3Aclosed) |
|
||||||
|
|
||||||
* The preferred way to contribute is to fork the repo and submit a pull request on
|
## 🛠️ Getting Started
|
||||||
GitHub. If you need help with your changes, you can always post on the forums or
|
|
||||||
try Discord. You can also post unified diffs (`git diff` should do the trick) on the
|
|
||||||
[Server Code Submissions](http://www.eqemulator.org/forums/forumdisplay.php?f=669)
|
|
||||||
forum, although pull requests will be much quicker and easier on all parties.
|
|
||||||
|
|
||||||
## Contact <img src="http://gamerescape.com/wp-content/uploads/2015/06/discord.png" height="20">
|
If you want to set up your own EQEmulator server, please refer to the current [server installation guides](https://docs.eqemu.io/#server-installation). We've had 100,000s of players and developers use our guides to set up their own servers, and we hope you will too!
|
||||||
|
|
||||||
- Discord Channel: https://discord.gg/QHsm7CD
|
## 🗂️ Related Repositories
|
||||||
- **User Discord Channel**: `#general`
|
|
||||||
- **Developer Discord Channel**: `#eqemucoders`
|
|
||||||
|
|
||||||
## Resources
|
| Repository | Description |
|
||||||
- [EQEmulator Forums](http://www.eqemulator.org/forums)
|
|--------------------|----------------------------------------------------------------------------------|
|
||||||
- [EQEmulator Wiki](https://docs.eqemu.io/)
|
| [ProjectEQ Quests](https://github.com/ProjectEQ/projecteqquests) | Official quests and event scripts for ProjectEQ |
|
||||||
|
| [Maps](https://github.com/Akkadius/EQEmuMaps) | EQEmu-compatible zone maps |
|
||||||
|
| [Installer Resources](https://github.com/Akkadius/EQEmuInstall) | Scripts and assets for setting up EQEmu servers |
|
||||||
|
| [Zone Utilities](https://github.com/EQEmu/zone-utilities) | Utilities for parsing, rendering, and manipulating EQ zone files |
|
||||||
|
|
||||||
## Related Repositories
|
|
||||||
* [ProjectEQ Quests](https://github.com/ProjectEQ/projecteqquests)
|
|
||||||
* [Maps](https://github.com/Akkadius/EQEmuMaps)
|
|
||||||
* [Installer Resources](https://github.com/Akkadius/EQEmuInstall)
|
|
||||||
* [Zone Utilities](https://github.com/EQEmu/zone-utilities) - Various utilities and libraries for parsing, rendering and manipulating EQ Zone files.
|
|
||||||
|
|
||||||
## Other License Info
|
|
||||||
|
|
||||||
* The server code and utilities are released under **GPLv3**
|
|
||||||
* We also include some small libraries for convienence that may be under different licensing
|
|
||||||
* SocketLib - GPL LibXML
|
|
||||||
* zlib - zlib license
|
|
||||||
* MariaDB/MySQL - GPL
|
|
||||||
* GPL Perl - GPL / ActiveState (under the assumption that this is a free project)
|
|
||||||
* CPPUnit - GLP StringUtilities - Apache
|
|
||||||
* LUA - MIT
|
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
<a href="https://github.com/EQEmu/server/graphs/contributors">
|
<a href="https://github.com/EQEmu/server/graphs/contributors">
|
||||||
<img src="https://contributors-img.firebaseapp.com/image?repo=EQEmu/server" />
|
<img src="https://contributors-img.firebaseapp.com/image?repo=EQEmu/server" />
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.20)
|
||||||
|
|
||||||
add_subdirectory(import)
|
add_subdirectory(import)
|
||||||
add_subdirectory(export)
|
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
|
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 ${SERVER_LIBS})
|
||||||
|
|
||||||
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||||
|
|||||||
@@ -38,13 +38,6 @@
|
|||||||
#include "../../common/skill_caps.h"
|
#include "../../common/skill_caps.h"
|
||||||
#include "../../common/evolving_items.h"
|
#include "../../common/evolving_items.h"
|
||||||
|
|
||||||
EQEmuLogSys LogSys;
|
|
||||||
WorldContentService content_service;
|
|
||||||
ZoneStore zone_store;
|
|
||||||
PathManager path;
|
|
||||||
PlayerEventLogs player_event_logs;
|
|
||||||
EvolvingItemsManager evolving_items_manager;
|
|
||||||
|
|
||||||
void ExportSpells(SharedDatabase *db);
|
void ExportSpells(SharedDatabase *db);
|
||||||
void ExportSkillCaps(SharedDatabase *db);
|
void ExportSkillCaps(SharedDatabase *db);
|
||||||
void ExportBaseData(SharedDatabase *db);
|
void ExportBaseData(SharedDatabase *db);
|
||||||
@@ -53,10 +46,10 @@ void ExportDBStrings(SharedDatabase *db);
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
{
|
{
|
||||||
RegisterExecutablePlatform(ExePlatformClientExport);
|
RegisterExecutablePlatform(ExePlatformClientExport);
|
||||||
LogSys.LoadLogSettingsDefaults();
|
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
|
||||||
set_exception_handler();
|
set_exception_handler();
|
||||||
|
|
||||||
path.LoadPaths();
|
PathManager::Instance()->Init();
|
||||||
|
|
||||||
LogInfo("Client Files Export Utility");
|
LogInfo("Client Files Export Utility");
|
||||||
if (!EQEmuConfig::LoadConfig()) {
|
if (!EQEmuConfig::LoadConfig()) {
|
||||||
@@ -99,8 +92,8 @@ int main(int argc, char **argv)
|
|||||||
content_db.SetMySQL(database);
|
content_db.SetMySQL(database);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogSys.SetDatabase(&database)
|
EQEmuLogSys::Instance()->SetDatabase(&database)
|
||||||
->SetLogPath(path.GetLogPath())
|
->SetLogPath(PathManager::Instance()->GetLogPath())
|
||||||
->LoadLogDatabaseSettings()
|
->LoadLogDatabaseSettings()
|
||||||
->StartFileLogs();
|
->StartFileLogs();
|
||||||
|
|
||||||
@@ -129,14 +122,14 @@ int main(int argc, char **argv)
|
|||||||
ExportBaseData(&content_db);
|
ExportBaseData(&content_db);
|
||||||
ExportDBStrings(&database);
|
ExportDBStrings(&database);
|
||||||
|
|
||||||
LogSys.CloseFileLogs();
|
EQEmuLogSys::Instance()->CloseFileLogs();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ExportSpells(SharedDatabase* db)
|
void ExportSpells(SharedDatabase* db)
|
||||||
{
|
{
|
||||||
std::ofstream file(fmt::format("{}/export/spells_us.txt", path.GetServerPath()));
|
std::ofstream file(fmt::format("{}/export/spells_us.txt", PathManager::Instance()->GetServerPath()));
|
||||||
if (!file || !file.is_open()) {
|
if (!file || !file.is_open()) {
|
||||||
LogError("Unable to open export/spells_us.txt to write, skipping.");
|
LogError("Unable to open export/spells_us.txt to write, skipping.");
|
||||||
return;
|
return;
|
||||||
@@ -155,7 +148,7 @@ void ExportSpells(SharedDatabase* db)
|
|||||||
|
|
||||||
void ExportSkillCaps(SharedDatabase* db)
|
void ExportSkillCaps(SharedDatabase* db)
|
||||||
{
|
{
|
||||||
std::ofstream file(fmt::format("{}/export/SkillCaps.txt", path.GetServerPath()));
|
std::ofstream file(fmt::format("{}/export/SkillCaps.txt", PathManager::Instance()->GetServerPath()));
|
||||||
if (!file || !file.is_open()) {
|
if (!file || !file.is_open()) {
|
||||||
LogError("Unable to open export/SkillCaps.txt to write, skipping.");
|
LogError("Unable to open export/SkillCaps.txt to write, skipping.");
|
||||||
return;
|
return;
|
||||||
@@ -174,7 +167,7 @@ void ExportSkillCaps(SharedDatabase* db)
|
|||||||
|
|
||||||
void ExportBaseData(SharedDatabase *db)
|
void ExportBaseData(SharedDatabase *db)
|
||||||
{
|
{
|
||||||
std::ofstream file(fmt::format("{}/export/BaseData.txt", path.GetServerPath()));
|
std::ofstream file(fmt::format("{}/export/BaseData.txt", PathManager::Instance()->GetServerPath()));
|
||||||
if (!file || !file.is_open()) {
|
if (!file || !file.is_open()) {
|
||||||
LogError("Unable to open export/BaseData.txt to write, skipping.");
|
LogError("Unable to open export/BaseData.txt to write, skipping.");
|
||||||
return;
|
return;
|
||||||
@@ -193,7 +186,7 @@ void ExportBaseData(SharedDatabase *db)
|
|||||||
|
|
||||||
void ExportDBStrings(SharedDatabase *db)
|
void ExportDBStrings(SharedDatabase *db)
|
||||||
{
|
{
|
||||||
std::ofstream file(fmt::format("{}/export/dbstr_us.txt", path.GetServerPath()));
|
std::ofstream file(fmt::format("{}/export/dbstr_us.txt", PathManager::Instance()->GetServerPath()));
|
||||||
if (!file || !file.is_open()) {
|
if (!file || !file.is_open()) {
|
||||||
LogError("Unable to open export/dbstr_us.txt to write, skipping.");
|
LogError("Unable to open export/dbstr_us.txt to write, skipping.");
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -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
|
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 ${SERVER_LIBS})
|
||||||
|
|
||||||
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||||
|
|||||||
@@ -32,13 +32,6 @@
|
|||||||
#include "../../common/events/player_event_logs.h"
|
#include "../../common/events/player_event_logs.h"
|
||||||
#include "../../common/evolving_items.h"
|
#include "../../common/evolving_items.h"
|
||||||
|
|
||||||
EQEmuLogSys LogSys;
|
|
||||||
WorldContentService content_service;
|
|
||||||
ZoneStore zone_store;
|
|
||||||
PathManager path;
|
|
||||||
PlayerEventLogs player_event_logs;
|
|
||||||
EvolvingItemsManager evolving_items_manager;
|
|
||||||
|
|
||||||
void ImportSpells(SharedDatabase *db);
|
void ImportSpells(SharedDatabase *db);
|
||||||
void ImportSkillCaps(SharedDatabase *db);
|
void ImportSkillCaps(SharedDatabase *db);
|
||||||
void ImportBaseData(SharedDatabase *db);
|
void ImportBaseData(SharedDatabase *db);
|
||||||
@@ -46,10 +39,10 @@ void ImportDBStrings(SharedDatabase *db);
|
|||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
RegisterExecutablePlatform(ExePlatformClientImport);
|
RegisterExecutablePlatform(ExePlatformClientImport);
|
||||||
LogSys.LoadLogSettingsDefaults();
|
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
|
||||||
set_exception_handler();
|
set_exception_handler();
|
||||||
|
|
||||||
path.LoadPaths();
|
PathManager::Instance()->Init();
|
||||||
|
|
||||||
LogInfo("Client Files Import Utility");
|
LogInfo("Client Files Import Utility");
|
||||||
if(!EQEmuConfig::LoadConfig()) {
|
if(!EQEmuConfig::LoadConfig()) {
|
||||||
@@ -92,8 +85,8 @@ int main(int argc, char **argv) {
|
|||||||
content_db.SetMySQL(database);
|
content_db.SetMySQL(database);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogSys.SetDatabase(&database)
|
EQEmuLogSys::Instance()->SetDatabase(&database)
|
||||||
->SetLogPath(path.GetLogPath())
|
->SetLogPath(PathManager::Instance()->GetLogPath())
|
||||||
->LoadLogDatabaseSettings()
|
->LoadLogDatabaseSettings()
|
||||||
->StartFileLogs();
|
->StartFileLogs();
|
||||||
|
|
||||||
@@ -102,7 +95,7 @@ int main(int argc, char **argv) {
|
|||||||
ImportBaseData(&content_db);
|
ImportBaseData(&content_db);
|
||||||
ImportDBStrings(&database);
|
ImportDBStrings(&database);
|
||||||
|
|
||||||
LogSys.CloseFileLogs();
|
EQEmuLogSys::Instance()->CloseFileLogs();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@@ -138,7 +131,7 @@ bool IsStringField(int i) {
|
|||||||
|
|
||||||
void ImportSpells(SharedDatabase *db) {
|
void ImportSpells(SharedDatabase *db) {
|
||||||
LogInfo("Importing Spells");
|
LogInfo("Importing Spells");
|
||||||
std::string file = fmt::format("{}/import/spells_us.txt", path.GetServerPath());
|
std::string file = fmt::format("{}/import/spells_us.txt", PathManager::Instance()->GetServerPath());
|
||||||
FILE *f = fopen(file.c_str(), "r");
|
FILE *f = fopen(file.c_str(), "r");
|
||||||
if(!f) {
|
if(!f) {
|
||||||
LogError("Unable to open {} to read, skipping.", file);
|
LogError("Unable to open {} to read, skipping.", file);
|
||||||
@@ -228,7 +221,7 @@ void ImportSpells(SharedDatabase *db) {
|
|||||||
void ImportSkillCaps(SharedDatabase *db) {
|
void ImportSkillCaps(SharedDatabase *db) {
|
||||||
LogInfo("Importing Skill Caps");
|
LogInfo("Importing Skill Caps");
|
||||||
|
|
||||||
std::string file = fmt::format("{}/import/SkillCaps.txt", path.GetServerPath());
|
std::string file = fmt::format("{}/import/SkillCaps.txt", PathManager::Instance()->GetServerPath());
|
||||||
FILE *f = fopen(file.c_str(), "r");
|
FILE *f = fopen(file.c_str(), "r");
|
||||||
if(!f) {
|
if(!f) {
|
||||||
LogError("Unable to open {} to read, skipping.", file);
|
LogError("Unable to open {} to read, skipping.", file);
|
||||||
@@ -265,7 +258,7 @@ void ImportBaseData(SharedDatabase *db)
|
|||||||
{
|
{
|
||||||
LogInfo("Importing Base Data");
|
LogInfo("Importing Base Data");
|
||||||
|
|
||||||
const std::string& file_name = fmt::format("{}/import/BaseData.txt", path.GetServerPath());
|
const std::string& file_name = fmt::format("{}/import/BaseData.txt", PathManager::Instance()->GetServerPath());
|
||||||
|
|
||||||
const auto& file_contents = File::GetContents(file_name);
|
const auto& file_contents = File::GetContents(file_name);
|
||||||
if (!file_contents.error.empty()) {
|
if (!file_contents.error.empty()) {
|
||||||
@@ -305,7 +298,7 @@ void ImportBaseData(SharedDatabase *db)
|
|||||||
void ImportDBStrings(SharedDatabase *db) {
|
void ImportDBStrings(SharedDatabase *db) {
|
||||||
LogInfo("Importing DB Strings");
|
LogInfo("Importing DB Strings");
|
||||||
|
|
||||||
std::string file = fmt::format("{}/import/dbstr_us.txt", path.GetServerPath());
|
std::string file = fmt::format("{}/import/dbstr_us.txt", PathManager::Instance()->GetServerPath());
|
||||||
FILE *f = fopen(file.c_str(), "r");
|
FILE *f = fopen(file.c_str(), "r");
|
||||||
if(!f) {
|
if(!f) {
|
||||||
LogError("Unable to open {} to read, skipping.", file);
|
LogError("Unable to open {} to read, skipping.", file);
|
||||||
|
|||||||
@@ -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)
|
VERSION_VAR LUAJIT_VERSION_STRING)
|
||||||
|
|
||||||
mark_as_advanced(LUAJIT_INCLUDE_DIR LUAJIT_LIBRARIES LUAJIT_LIBRARY LUAJIT_MATH_LIBRARY)
|
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
|
|
||||||
)
|
|
||||||
+68
-34
@@ -1,6 +1,6 @@
|
|||||||
CMAKE_MINIMUM_REQUIRED(VERSION 3.12)
|
cmake_minimum_required(VERSION 3.20.0)
|
||||||
|
|
||||||
SET(common_sources
|
set(common_sources
|
||||||
base_packet.cpp
|
base_packet.cpp
|
||||||
bazaar.cpp
|
bazaar.cpp
|
||||||
bodytypes.cpp
|
bodytypes.cpp
|
||||||
@@ -17,11 +17,13 @@ SET(common_sources
|
|||||||
database.cpp
|
database.cpp
|
||||||
database_instances.cpp
|
database_instances.cpp
|
||||||
database/database_update_manifest.cpp
|
database/database_update_manifest.cpp
|
||||||
|
database/database_update_manifest_custom.cpp
|
||||||
database/database_update_manifest_bots.cpp
|
database/database_update_manifest_bots.cpp
|
||||||
database/database_update.cpp
|
database/database_update.cpp
|
||||||
dbcore.cpp
|
dbcore.cpp
|
||||||
deity.cpp
|
deity.cpp
|
||||||
dynamic_zone_base.cpp
|
dynamic_zone_base.cpp
|
||||||
|
dynamic_zone_lockout.cpp
|
||||||
emu_constants.cpp
|
emu_constants.cpp
|
||||||
emu_limits.cpp
|
emu_limits.cpp
|
||||||
emu_opcodes.cpp
|
emu_opcodes.cpp
|
||||||
@@ -40,7 +42,6 @@ SET(common_sources
|
|||||||
events/player_event_logs.cpp
|
events/player_event_logs.cpp
|
||||||
events/player_event_discord_formatter.cpp
|
events/player_event_discord_formatter.cpp
|
||||||
evolving_items.cpp
|
evolving_items.cpp
|
||||||
expedition_lockout_timer.cpp
|
|
||||||
extprofile.cpp
|
extprofile.cpp
|
||||||
discord/discord_manager.cpp
|
discord/discord_manager.cpp
|
||||||
faction.cpp
|
faction.cpp
|
||||||
@@ -89,6 +90,7 @@ SET(common_sources
|
|||||||
skills.cpp
|
skills.cpp
|
||||||
skill_caps.cpp
|
skill_caps.cpp
|
||||||
spdat.cpp
|
spdat.cpp
|
||||||
|
spdat_bot.cpp
|
||||||
strings.cpp
|
strings.cpp
|
||||||
struct_strategy.cpp
|
struct_strategy.cpp
|
||||||
textures.cpp
|
textures.cpp
|
||||||
@@ -102,9 +104,9 @@ SET(common_sources
|
|||||||
net/console_server.cpp
|
net/console_server.cpp
|
||||||
net/console_server_connection.cpp
|
net/console_server_connection.cpp
|
||||||
net/crc32.cpp
|
net/crc32.cpp
|
||||||
net/daybreak_connection.cpp
|
|
||||||
net/eqstream.cpp
|
net/eqstream.cpp
|
||||||
net/packet.cpp
|
net/packet.cpp
|
||||||
|
net/reliable_stream_connection.cpp
|
||||||
net/servertalk_client_connection.cpp
|
net/servertalk_client_connection.cpp
|
||||||
net/servertalk_legacy_client_connection.cpp
|
net/servertalk_legacy_client_connection.cpp
|
||||||
net/servertalk_server.cpp
|
net/servertalk_server.cpp
|
||||||
@@ -130,7 +132,7 @@ SET(common_sources
|
|||||||
util/directory.cpp
|
util/directory.cpp
|
||||||
util/uuid.cpp)
|
util/uuid.cpp)
|
||||||
|
|
||||||
SET(repositories
|
set(repositories
|
||||||
|
|
||||||
# Criteria
|
# Criteria
|
||||||
repositories/criteria/content_filter_criteria.h
|
repositories/criteria/content_filter_criteria.h
|
||||||
@@ -212,10 +214,9 @@ SET(repositories
|
|||||||
repositories/base/base_discovered_items_repository.h
|
repositories/base/base_discovered_items_repository.h
|
||||||
repositories/base/base_doors_repository.h
|
repositories/base/base_doors_repository.h
|
||||||
repositories/base/base_dynamic_zones_repository.h
|
repositories/base/base_dynamic_zones_repository.h
|
||||||
|
repositories/base/base_dynamic_zone_lockouts_repository.h
|
||||||
repositories/base/base_dynamic_zone_members_repository.h
|
repositories/base/base_dynamic_zone_members_repository.h
|
||||||
repositories/base/base_dynamic_zone_templates_repository.h
|
repositories/base/base_dynamic_zone_templates_repository.h
|
||||||
repositories/base/base_expeditions_repository.h
|
|
||||||
repositories/base/base_expedition_lockouts_repository.h
|
|
||||||
repositories/base/base_faction_association_repository.h
|
repositories/base/base_faction_association_repository.h
|
||||||
repositories/base/base_faction_base_data_repository.h
|
repositories/base/base_faction_base_data_repository.h
|
||||||
repositories/base/base_faction_list_repository.h
|
repositories/base/base_faction_list_repository.h
|
||||||
@@ -281,8 +282,20 @@ SET(repositories
|
|||||||
repositories/base/base_pets_equipmentset_repository.h
|
repositories/base/base_pets_equipmentset_repository.h
|
||||||
repositories/base/base_pets_equipmentset_entries_repository.h
|
repositories/base/base_pets_equipmentset_entries_repository.h
|
||||||
repositories/base/base_player_titlesets_repository.h
|
repositories/base/base_player_titlesets_repository.h
|
||||||
|
repositories/base/base_player_event_aa_purchase_repository.h
|
||||||
|
repositories/base/base_player_event_killed_npc_repository.h
|
||||||
|
repositories/base/base_player_event_killed_named_npc_repository.h
|
||||||
|
repositories/base/base_player_event_killed_raid_npc_repository.h
|
||||||
repositories/base/base_player_event_log_settings_repository.h
|
repositories/base/base_player_event_log_settings_repository.h
|
||||||
repositories/base/base_player_event_logs_repository.h
|
repositories/base/base_player_event_logs_repository.h
|
||||||
|
repositories/base/base_player_event_loot_items_repository.h
|
||||||
|
repositories/base/base_player_event_merchant_purchase_repository.h
|
||||||
|
repositories/base/base_player_event_merchant_sell_repository.h
|
||||||
|
repositories/base/base_player_event_npc_handin_repository.h
|
||||||
|
repositories/base/base_player_event_npc_handin_entries_repository.h
|
||||||
|
repositories/base/base_player_event_speech_repository.h
|
||||||
|
repositories/base/base_player_event_trade_repository.h
|
||||||
|
repositories/base/base_player_event_trade_entries_repository.h
|
||||||
repositories/base/base_quest_globals_repository.h
|
repositories/base/base_quest_globals_repository.h
|
||||||
repositories/base/base_raid_details_repository.h
|
repositories/base/base_raid_details_repository.h
|
||||||
repositories/base/base_raid_members_repository.h
|
repositories/base/base_raid_members_repository.h
|
||||||
@@ -397,10 +410,9 @@ SET(repositories
|
|||||||
repositories/discovered_items_repository.h
|
repositories/discovered_items_repository.h
|
||||||
repositories/doors_repository.h
|
repositories/doors_repository.h
|
||||||
repositories/dynamic_zones_repository.h
|
repositories/dynamic_zones_repository.h
|
||||||
|
repositories/dynamic_zone_lockouts_repository.h
|
||||||
repositories/dynamic_zone_members_repository.h
|
repositories/dynamic_zone_members_repository.h
|
||||||
repositories/dynamic_zone_templates_repository.h
|
repositories/dynamic_zone_templates_repository.h
|
||||||
repositories/expeditions_repository.h
|
|
||||||
repositories/expedition_lockouts_repository.h
|
|
||||||
repositories/faction_association_repository.h
|
repositories/faction_association_repository.h
|
||||||
repositories/faction_base_data_repository.h
|
repositories/faction_base_data_repository.h
|
||||||
repositories/faction_list_repository.h
|
repositories/faction_list_repository.h
|
||||||
@@ -466,8 +478,20 @@ SET(repositories
|
|||||||
repositories/pets_equipmentset_repository.h
|
repositories/pets_equipmentset_repository.h
|
||||||
repositories/pets_equipmentset_entries_repository.h
|
repositories/pets_equipmentset_entries_repository.h
|
||||||
repositories/player_titlesets_repository.h
|
repositories/player_titlesets_repository.h
|
||||||
|
repositories/player_event_aa_purchase_repository.h
|
||||||
|
repositories/player_event_killed_npc_repository.h
|
||||||
|
repositories/player_event_killed_named_npc_repository.h
|
||||||
|
repositories/player_event_killed_raid_npc_repository.h
|
||||||
repositories/player_event_log_settings_repository.h
|
repositories/player_event_log_settings_repository.h
|
||||||
repositories/player_event_logs_repository.h
|
repositories/player_event_logs_repository.h
|
||||||
|
repositories/player_event_loot_items_repository.h
|
||||||
|
repositories/player_event_merchant_purchase_repository.h
|
||||||
|
repositories/player_event_merchant_sell_repository.h
|
||||||
|
repositories/player_event_npc_handin_repository.h
|
||||||
|
repositories/player_event_npc_handin_entries_repository.h
|
||||||
|
repositories/player_event_speech_repository.h
|
||||||
|
repositories/player_event_trade_repository.h
|
||||||
|
repositories/player_event_trade_entries_repository.h
|
||||||
repositories/quest_globals_repository.h
|
repositories/quest_globals_repository.h
|
||||||
repositories/raid_details_repository.h
|
repositories/raid_details_repository.h
|
||||||
repositories/raid_members_repository.h
|
repositories/raid_members_repository.h
|
||||||
@@ -507,10 +531,9 @@ SET(repositories
|
|||||||
repositories/veteran_reward_templates_repository.h
|
repositories/veteran_reward_templates_repository.h
|
||||||
repositories/zone_repository.h
|
repositories/zone_repository.h
|
||||||
repositories/zone_points_repository.h
|
repositories/zone_points_repository.h
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
SET(common_headers
|
set(common_headers
|
||||||
additive_lagged_fibonacci_engine.h
|
additive_lagged_fibonacci_engine.h
|
||||||
bazaar.h
|
bazaar.h
|
||||||
base_packet.h
|
base_packet.h
|
||||||
@@ -536,6 +559,7 @@ SET(common_headers
|
|||||||
discord/discord.h
|
discord/discord.h
|
||||||
discord/discord_manager.h
|
discord/discord_manager.h
|
||||||
dynamic_zone_base.h
|
dynamic_zone_base.h
|
||||||
|
dynamic_zone_lockout.h
|
||||||
emu_constants.h
|
emu_constants.h
|
||||||
emu_limits.h
|
emu_limits.h
|
||||||
emu_opcodes.h
|
emu_opcodes.h
|
||||||
@@ -562,7 +586,6 @@ SET(common_headers
|
|||||||
events/player_events.h
|
events/player_events.h
|
||||||
event_sub.h
|
event_sub.h
|
||||||
evolving_items.h
|
evolving_items.h
|
||||||
expedition_lockout_timer.h
|
|
||||||
extprofile.h
|
extprofile.h
|
||||||
faction.h
|
faction.h
|
||||||
file.h
|
file.h
|
||||||
@@ -579,7 +602,6 @@ SET(common_headers
|
|||||||
ipc_mutex.h
|
ipc_mutex.h
|
||||||
ip_util.h
|
ip_util.h
|
||||||
item_data.h
|
item_data.h
|
||||||
item_fieldlist.h
|
|
||||||
item_instance.h
|
item_instance.h
|
||||||
json_config.h
|
json_config.h
|
||||||
light_source.h
|
light_source.h
|
||||||
@@ -622,6 +644,7 @@ SET(common_headers
|
|||||||
server_event_scheduler.h
|
server_event_scheduler.h
|
||||||
serverinfo.h
|
serverinfo.h
|
||||||
servertalk.h
|
servertalk.h
|
||||||
|
server_reload_types.h
|
||||||
shared_tasks.h
|
shared_tasks.h
|
||||||
shareddb.h
|
shareddb.h
|
||||||
skills.h
|
skills.h
|
||||||
@@ -646,18 +669,20 @@ SET(common_headers
|
|||||||
net/console_server.h
|
net/console_server.h
|
||||||
net/console_server_connection.h
|
net/console_server_connection.h
|
||||||
net/crc32.h
|
net/crc32.h
|
||||||
net/daybreak_connection.h
|
|
||||||
net/daybreak_structs.h
|
|
||||||
net/dns.h
|
net/dns.h
|
||||||
net/endian.h
|
net/endian.h
|
||||||
net/eqstream.h
|
net/eqstream.h
|
||||||
net/packet.h
|
net/packet.h
|
||||||
|
net/reliable_stream_connection.h
|
||||||
|
net/reliable_stream_pooling.h
|
||||||
|
net/reliable_stream_structs.h
|
||||||
net/servertalk_client_connection.h
|
net/servertalk_client_connection.h
|
||||||
net/servertalk_legacy_client_connection.h
|
net/servertalk_legacy_client_connection.h
|
||||||
net/servertalk_common.h
|
net/servertalk_common.h
|
||||||
net/servertalk_server.h
|
net/servertalk_server.h
|
||||||
net/servertalk_server_connection.h
|
net/servertalk_server_connection.h
|
||||||
net/tcp_connection.h
|
net/tcp_connection.h
|
||||||
|
net/tcp_connection_pooling.h
|
||||||
net/tcp_server.h
|
net/tcp_server.h
|
||||||
net/websocket_server.h
|
net/websocket_server.h
|
||||||
net/websocket_server_connection.h
|
net/websocket_server_connection.h
|
||||||
@@ -697,28 +722,25 @@ SET(common_headers
|
|||||||
util/uuid.h
|
util/uuid.h
|
||||||
)
|
)
|
||||||
|
|
||||||
SOURCE_GROUP(Event FILES
|
source_group(Event FILES
|
||||||
event/event_loop.h
|
event/event_loop.h
|
||||||
event/timer.h
|
event/timer.h
|
||||||
event/task.h
|
event/task.h
|
||||||
)
|
)
|
||||||
|
|
||||||
SOURCE_GROUP(Json FILES
|
source_group(Json FILES
|
||||||
json/json.h
|
json/json.h
|
||||||
json/jsoncpp.cpp
|
json/jsoncpp.cpp
|
||||||
json/json-forwards.h
|
json/json-forwards.h
|
||||||
)
|
)
|
||||||
|
|
||||||
SOURCE_GROUP(Net FILES
|
source_group(Net FILES
|
||||||
net/console_server.cpp
|
net/console_server.cpp
|
||||||
net/console_server.h
|
net/console_server.h
|
||||||
net/console_server_connection.cpp
|
net/console_server_connection.cpp
|
||||||
net/console_server_connection.h
|
net/console_server_connection.h
|
||||||
net/crc32.cpp
|
net/crc32.cpp
|
||||||
net/crc32.h
|
net/crc32.h
|
||||||
net/daybreak_connection.cpp
|
|
||||||
net/daybreak_connection.h
|
|
||||||
net/daybreak_structs.h
|
|
||||||
net/dns.h
|
net/dns.h
|
||||||
net/endian.h
|
net/endian.h
|
||||||
net/eqmq.cpp
|
net/eqmq.cpp
|
||||||
@@ -727,6 +749,10 @@ SOURCE_GROUP(Net FILES
|
|||||||
net/eqstream.h
|
net/eqstream.h
|
||||||
net/packet.cpp
|
net/packet.cpp
|
||||||
net/packet.h
|
net/packet.h
|
||||||
|
net/reliable_stream_connection.cpp
|
||||||
|
net/reliable_stream_connection.h
|
||||||
|
net/reliable_stream_pooling.h
|
||||||
|
net/reliable_stream_structs.h
|
||||||
net/servertalk_client_connection.cpp
|
net/servertalk_client_connection.cpp
|
||||||
net/servertalk_client_connection.h
|
net/servertalk_client_connection.h
|
||||||
net/servertalk_legacy_client_connection.cpp
|
net/servertalk_legacy_client_connection.cpp
|
||||||
@@ -738,6 +764,7 @@ SOURCE_GROUP(Net FILES
|
|||||||
net/servertalk_server_connection.h
|
net/servertalk_server_connection.h
|
||||||
net/tcp_connection.cpp
|
net/tcp_connection.cpp
|
||||||
net/tcp_connection.h
|
net/tcp_connection.h
|
||||||
|
net/tcp_connection_pooling.h
|
||||||
net/tcp_server.cpp
|
net/tcp_server.cpp
|
||||||
net/tcp_server.h
|
net/tcp_server.h
|
||||||
net/websocket_server.cpp
|
net/websocket_server.cpp
|
||||||
@@ -746,7 +773,7 @@ SOURCE_GROUP(Net FILES
|
|||||||
net/websocket_server_connection.h
|
net/websocket_server_connection.h
|
||||||
)
|
)
|
||||||
|
|
||||||
SOURCE_GROUP(Patches FILES
|
source_group(Patches FILES
|
||||||
patches/patches.h
|
patches/patches.h
|
||||||
patches/sod.h
|
patches/sod.h
|
||||||
patches/sod_limits.h
|
patches/sod_limits.h
|
||||||
@@ -790,12 +817,12 @@ SOURCE_GROUP(Patches FILES
|
|||||||
patches/uf_limits.cpp
|
patches/uf_limits.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
SOURCE_GROUP(StackWalker FILES
|
source_group(StackWalker FILES
|
||||||
StackWalker/StackWalker.h
|
StackWalker/StackWalker.h
|
||||||
StackWalker/StackWalker.cpp
|
StackWalker/StackWalker.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
SOURCE_GROUP(Util FILES
|
source_group(Util FILES
|
||||||
util/memory_stream.h
|
util/memory_stream.h
|
||||||
util/directory.cpp
|
util/directory.cpp
|
||||||
util/directory.h
|
util/directory.h
|
||||||
@@ -803,17 +830,24 @@ SOURCE_GROUP(Util FILES
|
|||||||
util/uuid.h
|
util/uuid.h
|
||||||
)
|
)
|
||||||
|
|
||||||
INCLUDE_DIRECTORIES(Patches SocketLib StackWalker)
|
include_directories(Patches SocketLib StackWalker)
|
||||||
|
|
||||||
ADD_LIBRARY(common ${common_sources} ${common_headers} ${repositories})
|
add_library(common ${common_sources} ${common_headers} ${repositories})
|
||||||
|
|
||||||
IF (UNIX)
|
target_link_libraries(common PUBLIC cereal::cereal fmt::fmt unofficial::libmariadb $<IF:$<TARGET_EXISTS:libuv::uv_a>,libuv::uv_a,libuv::uv> OpenSSL::SSL OpenSSL::Crypto ZLIB::ZLIB)
|
||||||
SET_SOURCE_FILES_PROPERTIES("SocketLib/Mime.cpp" PROPERTY COMPILE_FLAGS -Wno-unused-result)
|
|
||||||
SET_SOURCE_FILES_PROPERTIES("patches/sod.cpp" "patches/sof.cpp" "patches/rof.cpp" "patches/rof2.cpp" "patches/uf.cpp" PROPERTIES COMPILE_FLAGS -O0)
|
|
||||||
ENDIF (UNIX)
|
|
||||||
|
|
||||||
IF (WIN32 AND EQEMU_BUILD_PCH)
|
if(UNIX)
|
||||||
TARGET_PRECOMPILE_HEADERS(common PRIVATE pch/pch.h)
|
set_source_files_properties("SocketLib/Mime.cpp" PROPERTY COMPILE_FLAGS -Wno-unused-result)
|
||||||
ENDIF ()
|
set_source_files_properties("patches/sod.cpp" "patches/sof.cpp" "patches/rof.cpp" "patches/rof2.cpp" "patches/uf.cpp" PROPERTIES COMPILE_FLAGS -O0)
|
||||||
|
endif()
|
||||||
|
|
||||||
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
if(EQEMU_BUILD_PCH)
|
||||||
|
TARGET_PRECOMPILE_HEADERS(common PRIVATE pch/std-pch.h)
|
||||||
|
# Avoid PCH/__OPTIMIZE__ mismatch when compiling certain patch sources with -O0
|
||||||
|
# These files are compiled with -O0 on UNIX (see COMPILE_FLAGS above), which
|
||||||
|
# disables the __OPTIMIZE__ predefined macro. Disabling PCH for them prevents
|
||||||
|
# Clang from erroring due to macro state differences between the PCH and TU.
|
||||||
|
set_source_files_properties("patches/sod.cpp" "patches/sof.cpp" "patches/rof.cpp" "patches/rof2.cpp" "patches/uf.cpp" PROPERTIES SKIP_PRECOMPILE_HEADERS ON)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
|
||||||
|
|||||||
+8
-4
@@ -279,11 +279,12 @@ Bazaar::GetSearchResults(
|
|||||||
trader_items_ids,
|
trader_items_ids,
|
||||||
std::string(search.item_name),
|
std::string(search.item_name),
|
||||||
field_criteria_items,
|
field_criteria_items,
|
||||||
where_criteria_items
|
where_criteria_items,
|
||||||
|
search.max_results
|
||||||
);
|
);
|
||||||
|
|
||||||
if (item_results.empty()) {
|
if (item_results.empty()) {
|
||||||
LogError("Bazaar - No items found in bazaar search.");
|
LogTradingDetail("Bazaar - No items found in bazaar search.");
|
||||||
return all_entries;
|
return all_entries;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -300,7 +301,7 @@ Bazaar::GetSearchResults(
|
|||||||
r.serial_number = t.trader.item_sn;
|
r.serial_number = t.trader.item_sn;
|
||||||
r.cost = t.trader.item_cost;
|
r.cost = t.trader.item_cost;
|
||||||
r.slot_id = t.trader.slot_id;
|
r.slot_id = t.trader.slot_id;
|
||||||
r.sum_charges = t.trader.item_charges;
|
r.charges = t.trader.item_charges;
|
||||||
r.stackable = item_results.at(t.trader.item_id).stackable;
|
r.stackable = item_results.at(t.trader.item_id).stackable;
|
||||||
r.icon_id = item_results.at(t.trader.item_id).icon;
|
r.icon_id = item_results.at(t.trader.item_id).icon;
|
||||||
r.trader_zone_id = t.trader.char_zone_id;
|
r.trader_zone_id = t.trader.char_zone_id;
|
||||||
@@ -312,7 +313,10 @@ Bazaar::GetSearchResults(
|
|||||||
r.item_stat = item_results.at(t.trader.item_id).stats;
|
r.item_stat = item_results.at(t.trader.item_id).stats;
|
||||||
|
|
||||||
if (RuleB(Bazaar, UseAlternateBazaarSearch)) {
|
if (RuleB(Bazaar, UseAlternateBazaarSearch)) {
|
||||||
if (convert || (r.trader_zone_id == Zones::BAZAAR && r.trader_zone_instance_id != char_zone_instance_id)) {
|
if (convert ||
|
||||||
|
char_zone_id != Zones::BAZAAR ||
|
||||||
|
(char_zone_id == Zones::BAZAAR && r.trader_zone_instance_id != char_zone_instance_id)
|
||||||
|
) {
|
||||||
r.trader_id = TraderRepository::TRADER_CONVERT_ID + r.trader_zone_instance_id;
|
r.trader_id = TraderRepository::TRADER_CONVERT_ID + r.trader_zone_instance_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
#include <fmt/ranges.h>
|
||||||
#include "../common/global_define.h"
|
#include "../common/global_define.h"
|
||||||
#include "../common/classes.h"
|
#include "../common/classes.h"
|
||||||
#include "data_verification.h"
|
#include "data_verification.h"
|
||||||
|
|||||||
@@ -131,6 +131,8 @@ static std::map<uint8, std::string> class_names = {
|
|||||||
#define ARMOR_TYPE_LAST ARMOR_TYPE_PLATE
|
#define ARMOR_TYPE_LAST ARMOR_TYPE_PLATE
|
||||||
#define ARMOR_TYPE_COUNT 5
|
#define ARMOR_TYPE_COUNT 5
|
||||||
|
|
||||||
|
#define BOT_CLASS_BASE_ID_PREFIX 3000
|
||||||
|
|
||||||
|
|
||||||
const char* GetClassIDName(uint8 class_id, uint8 level = 0);
|
const char* GetClassIDName(uint8 class_id, uint8 level = 0);
|
||||||
|
|
||||||
|
|||||||
@@ -19,6 +19,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
#include <fmt/ranges.h>
|
||||||
#include "eqemu_command_handler.h"
|
#include "eqemu_command_handler.h"
|
||||||
#include "terminal_color.hpp"
|
#include "terminal_color.hpp"
|
||||||
#include "../platform.h"
|
#include "../platform.h"
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ WorldContentService *WorldContentService::SetExpansionContext()
|
|||||||
// pull expansion from rules
|
// pull expansion from rules
|
||||||
int expansion = RuleI(Expansion, CurrentExpansion);
|
int expansion = RuleI(Expansion, CurrentExpansion);
|
||||||
if (expansion >= Expansion::Classic && expansion <= Expansion::MaxId) {
|
if (expansion >= Expansion::Classic && expansion <= Expansion::MaxId) {
|
||||||
content_service.SetCurrentExpansion(expansion);
|
WorldContentService::Instance()->SetCurrentExpansion(expansion);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogInfo(
|
LogInfo(
|
||||||
@@ -41,12 +41,12 @@ WorldContentService *WorldContentService::SetExpansionContext()
|
|||||||
|
|
||||||
std::string WorldContentService::GetCurrentExpansionName()
|
std::string WorldContentService::GetCurrentExpansionName()
|
||||||
{
|
{
|
||||||
if (content_service.GetCurrentExpansion() == Expansion::EXPANSION_ALL) {
|
if (WorldContentService::Instance()->GetCurrentExpansion() == Expansion::EXPANSION_ALL) {
|
||||||
return "All Expansions";
|
return "All Expansions";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (current_expansion >= Expansion::Classic && current_expansion <= Expansion::MaxId) {
|
if (current_expansion >= Expansion::Classic && current_expansion <= Expansion::MaxId) {
|
||||||
return Expansion::ExpansionName[content_service.GetCurrentExpansion()];
|
return Expansion::ExpansionName[WorldContentService::Instance()->GetCurrentExpansion()];
|
||||||
}
|
}
|
||||||
|
|
||||||
return "Unknown Expansion";
|
return "Unknown Expansion";
|
||||||
@@ -185,7 +185,7 @@ void WorldContentService::ReloadContentFlags()
|
|||||||
|
|
||||||
SetContentFlags(set_content_flags);
|
SetContentFlags(set_content_flags);
|
||||||
LoadStaticGlobalZoneInstances();
|
LoadStaticGlobalZoneInstances();
|
||||||
zone_store.LoadZones(*m_content_database);
|
ZoneStore::Instance()->LoadZones(*m_content_database);
|
||||||
}
|
}
|
||||||
|
|
||||||
Database *WorldContentService::GetDatabase() const
|
Database *WorldContentService::GetDatabase() const
|
||||||
@@ -291,7 +291,7 @@ WorldContentService *WorldContentService::LoadStaticGlobalZoneInstances()
|
|||||||
// instance_list table entry for lavastorm has version = 1, is_global = 1, never_expires = 1
|
// instance_list table entry for lavastorm has version = 1, is_global = 1, never_expires = 1
|
||||||
WorldContentService::FindZoneResult WorldContentService::FindZone(uint32 zone_id, uint32 instance_id)
|
WorldContentService::FindZoneResult WorldContentService::FindZone(uint32 zone_id, uint32 instance_id)
|
||||||
{
|
{
|
||||||
for (const auto &z: zone_store.GetZones()) {
|
for (const auto &z: ZoneStore::Instance()->GetZones()) {
|
||||||
for (auto &i: m_zone_static_instances) {
|
for (auto &i: m_zone_static_instances) {
|
||||||
if (
|
if (
|
||||||
z.zoneidnumber == zone_id &&
|
z.zoneidnumber == zone_id &&
|
||||||
|
|||||||
@@ -181,6 +181,12 @@ public:
|
|||||||
FindZoneResult FindZone(uint32 zone_id, uint32 instance_id);
|
FindZoneResult FindZone(uint32 zone_id, uint32 instance_id);
|
||||||
bool IsInPublicStaticInstance(uint32 instance_id);
|
bool IsInPublicStaticInstance(uint32 instance_id);
|
||||||
|
|
||||||
|
static WorldContentService* Instance()
|
||||||
|
{
|
||||||
|
static WorldContentService instance;
|
||||||
|
return &instance;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int current_expansion{};
|
int current_expansion{};
|
||||||
std::vector<ContentFlagsRepository::ContentFlags> content_flags;
|
std::vector<ContentFlagsRepository::ContentFlags> content_flags;
|
||||||
@@ -194,6 +200,4 @@ private:
|
|||||||
std::vector<InstanceListRepository::InstanceList> m_zone_static_instances;
|
std::vector<InstanceListRepository::InstanceList> m_zone_static_instances;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern WorldContentService content_service;
|
|
||||||
|
|
||||||
#endif //EQEMU_WORLD_CONTENT_SERVICE_H
|
#endif //EQEMU_WORLD_CONTENT_SERVICE_H
|
||||||
|
|||||||
+8
-6
@@ -23,10 +23,12 @@ void SendCrashReport(const std::string &crash_report)
|
|||||||
{
|
{
|
||||||
// can configure multiple endpoints if need be
|
// can configure multiple endpoints if need be
|
||||||
std::vector<std::string> endpoints = {
|
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
|
// "http://localhost:3010/api/v1/analytics/server-crash-report", // development
|
||||||
};
|
};
|
||||||
|
|
||||||
|
EQEmuLogSys* log = EQEmuLogSys::Instance();
|
||||||
|
|
||||||
auto config = EQEmuConfig::get();
|
auto config = EQEmuConfig::get();
|
||||||
for (auto &e: endpoints) {
|
for (auto &e: endpoints) {
|
||||||
uri u(e);
|
uri u(e);
|
||||||
@@ -68,12 +70,12 @@ void SendCrashReport(const std::string &crash_report)
|
|||||||
p["cpus"] = cpus.size();
|
p["cpus"] = cpus.size();
|
||||||
p["origination_info"] = "";
|
p["origination_info"] = "";
|
||||||
|
|
||||||
if (!LogSys.origination_info.zone_short_name.empty()) {
|
if (!log->origination_info.zone_short_name.empty()) {
|
||||||
p["origination_info"] = fmt::format(
|
p["origination_info"] = fmt::format(
|
||||||
"{} ({}) instance_id [{}]",
|
"{} ({}) instance_id [{}]",
|
||||||
LogSys.origination_info.zone_short_name,
|
log->origination_info.zone_short_name,
|
||||||
LogSys.origination_info.zone_long_name,
|
log->origination_info.zone_long_name,
|
||||||
LogSys.origination_info.instance_id
|
log->origination_info.instance_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -294,7 +296,7 @@ void print_trace()
|
|||||||
SendCrashReport(crash_report);
|
SendCrashReport(crash_report);
|
||||||
}
|
}
|
||||||
|
|
||||||
LogSys.CloseFileLogs();
|
EQEmuLogSys::Instance()->CloseFileLogs();
|
||||||
|
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,28 +1,30 @@
|
|||||||
#include "data_bucket.h"
|
#include "../common/data_bucket.h"
|
||||||
#include "zonedb.h"
|
#include "database.h"
|
||||||
#include "mob.h"
|
|
||||||
#include "worldserver.h"
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include "../common/json/json.hpp"
|
#include "../common/json/json.hpp"
|
||||||
|
|
||||||
using json = nlohmann::json;
|
using json = nlohmann::json;
|
||||||
|
|
||||||
extern WorldServer worldserver;
|
|
||||||
const std::string NESTED_KEY_DELIMITER = ".";
|
const std::string NESTED_KEY_DELIMITER = ".";
|
||||||
|
|
||||||
std::vector<DataBucketsRepository::DataBuckets> g_data_bucket_cache = {};
|
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(const std::string &bucket_key, const std::string &bucket_value, std::string expires_time)
|
||||||
{
|
{
|
||||||
auto k = DataBucketKey{
|
auto k = DataBucketKey{
|
||||||
.key = bucket_key,
|
.key = bucket_key,
|
||||||
.value = bucket_value,
|
.value = bucket_value,
|
||||||
.expires = expires_time,
|
.expires = expires_time,
|
||||||
.account_id = 0,
|
|
||||||
.character_id = 0,
|
|
||||||
.npc_id = 0,
|
|
||||||
.bot_id = 0
|
|
||||||
};
|
};
|
||||||
|
|
||||||
DataBucket::SetData(k);
|
DataBucket::SetData(k);
|
||||||
@@ -31,7 +33,8 @@ void DataBucket::SetData(const std::string &bucket_key, const std::string &bucke
|
|||||||
void DataBucket::SetData(const DataBucketKey &k_)
|
void DataBucket::SetData(const DataBucketKey &k_)
|
||||||
{
|
{
|
||||||
DataBucketKey k = k_; // copy the key so we can modify it
|
DataBucketKey k = k_; // copy the key so we can modify it
|
||||||
if (k.key.find(NESTED_KEY_DELIMITER) != std::string::npos) {
|
bool is_nested = k.key.find(NESTED_KEY_DELIMITER) != std::string::npos;
|
||||||
|
if (is_nested) {
|
||||||
k.key = Strings::Split(k.key, NESTED_KEY_DELIMITER).front();
|
k.key = Strings::Split(k.key, NESTED_KEY_DELIMITER).front();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -54,6 +57,9 @@ void DataBucket::SetData(const DataBucketKey &k_)
|
|||||||
}
|
}
|
||||||
else if (k.bot_id > 0) {
|
else if (k.bot_id > 0) {
|
||||||
b.bot_id = k.bot_id;
|
b.bot_id = k.bot_id;
|
||||||
|
} else if (k.zone_id > 0) {
|
||||||
|
b.zone_id = k.zone_id;
|
||||||
|
b.instance_id = k.instance_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
const uint64 bucket_id = b.id;
|
const uint64 bucket_id = b.id;
|
||||||
@@ -64,6 +70,10 @@ void DataBucket::SetData(const DataBucketKey &k_)
|
|||||||
if (isalpha(k.expires[0]) || isalpha(k.expires[k.expires.length() - 1])) {
|
if (isalpha(k.expires[0]) || isalpha(k.expires[k.expires.length() - 1])) {
|
||||||
expires_time_unix = static_cast<int64>(std::time(nullptr)) + Strings::TimeToSeconds(k.expires);
|
expires_time_unix = static_cast<int64>(std::time(nullptr)) + Strings::TimeToSeconds(k.expires);
|
||||||
}
|
}
|
||||||
|
if (is_nested) {
|
||||||
|
LogDataBuckets("Nested keys can't expire; set expiration on the parent key");
|
||||||
|
expires_time_unix = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
b.expires = expires_time_unix;
|
b.expires = expires_time_unix;
|
||||||
@@ -76,26 +86,45 @@ void DataBucket::SetData(const DataBucketKey &k_)
|
|||||||
std::string existing_value = r.id > 0 ? r.value : "{}";
|
std::string existing_value = r.id > 0 ? r.value : "{}";
|
||||||
json json_value = json::object();
|
json json_value = json::object();
|
||||||
|
|
||||||
|
// Check if the JSON is valid
|
||||||
|
if (Strings::IsValidJson(existing_value)) {
|
||||||
try {
|
try {
|
||||||
json_value = json::parse(existing_value);
|
json_value = json::parse(existing_value);
|
||||||
} catch (json::parse_error &e) {
|
} catch (json::parse_error &e) {
|
||||||
LogError("Failed to parse JSON for key [{}]: {}", k_.key, e.what());
|
LogDataBuckets("Failed to parse JSON for key [{}] [{}]", k_.key, e.what());
|
||||||
json_value = json::object(); // Reset to an empty object on error
|
json_value = json::object(); // Reset to an empty object on error
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Recursively merge new key-value pair into the JSON object
|
// Recursively merge new key-value pair into the JSON object
|
||||||
auto nested_keys = Strings::Split(k_.key, NESTED_KEY_DELIMITER);
|
auto nested_keys = Strings::Split(k_.key, NESTED_KEY_DELIMITER);
|
||||||
|
auto top_key = nested_keys.front();
|
||||||
|
// remove the top-level key
|
||||||
|
nested_keys.erase(nested_keys.begin());
|
||||||
|
|
||||||
json *current = &json_value;
|
json *current = &json_value;
|
||||||
|
|
||||||
for (size_t i = 0; i < nested_keys.size(); ++i) {
|
for (size_t i = 0; i < nested_keys.size(); ++i) {
|
||||||
const std::string &key_part = nested_keys[i];
|
const std::string &key_part = nested_keys[i];
|
||||||
|
|
||||||
if (i == nested_keys.size() - 1) {
|
if (i == nested_keys.size() - 1) {
|
||||||
|
|
||||||
|
LogDataBucketsDetail("Setting key [{}] key_part [{}]", k.key, key_part);
|
||||||
|
|
||||||
|
// If the key already exists and is an object or array, prevent overwriting to avoid data loss
|
||||||
|
if (current->contains(key_part) &&
|
||||||
|
((*current)[key_part].is_object() || (*current)[key_part].is_array())) {
|
||||||
|
LogDataBuckets("Attempted to overwrite an existing object or array at key [{}] - skipping", k_.key);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Set the value at the final key
|
// Set the value at the final key
|
||||||
(*current)[key_part] = k_.value;
|
(*current)[key_part] = k_.value;
|
||||||
} else {
|
} else {
|
||||||
// Traverse or create nested objects
|
// Traverse or create nested objects
|
||||||
if (!current->contains(key_part)) {
|
if (!current->contains(key_part)) {
|
||||||
(*current)[key_part] = json::object();
|
(*current)[key_part] = json::object();
|
||||||
|
LogDataBucketsDetail("Creating nested root key [{}] key_part [{}]", k.key, key_part);
|
||||||
} else if (!(*current)[key_part].is_object()) {
|
} else if (!(*current)[key_part].is_object()) {
|
||||||
// If key exists but is not an object, reset to object to avoid conflicts
|
// If key exists but is not an object, reset to object to avoid conflicts
|
||||||
(*current)[key_part] = json::object();
|
(*current)[key_part] = json::object();
|
||||||
@@ -106,7 +135,7 @@ void DataBucket::SetData(const DataBucketKey &k_)
|
|||||||
|
|
||||||
// Serialize JSON back to string
|
// Serialize JSON back to string
|
||||||
b.value = json_value.dump();
|
b.value = json_value.dump();
|
||||||
b.key_ = nested_keys.front(); // Use the top-level key
|
b.key_ = top_key; // Use the top-level key
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bucket_id) {
|
if (bucket_id) {
|
||||||
@@ -143,12 +172,20 @@ DataBucketsRepository::DataBuckets DataBucket::ExtractNestedValue(
|
|||||||
const std::string &full_key)
|
const std::string &full_key)
|
||||||
{
|
{
|
||||||
auto nested_keys = Strings::Split(full_key, NESTED_KEY_DELIMITER);
|
auto nested_keys = Strings::Split(full_key, NESTED_KEY_DELIMITER);
|
||||||
|
auto top_key = nested_keys.front();
|
||||||
|
nested_keys.erase(nested_keys.begin());
|
||||||
json json_value;
|
json json_value;
|
||||||
|
|
||||||
|
// Check if the JSON is valid
|
||||||
|
if (!Strings::IsValidJson(bucket.value)) {
|
||||||
|
LogDataBuckets("Invalid JSON for key [{}]", bucket.key_);
|
||||||
|
return DataBucketsRepository::NewEntity();
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
json_value = json::parse(bucket.value); // Parse the JSON
|
json_value = json::parse(bucket.value); // Parse the JSON
|
||||||
} catch (json::parse_error &ex) {
|
} catch (json::parse_error &ex) {
|
||||||
LogError("Failed to parse JSON for key [{}]: {}", bucket.key_, ex.what());
|
LogDataBuckets("Failed to parse JSON for key [{}] [{}]", bucket.key_, ex.what());
|
||||||
return DataBucketsRepository::NewEntity(); // Return empty entity on parse error
|
return DataBucketsRepository::NewEntity(); // Return empty entity on parse error
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,12 +226,14 @@ DataBucketsRepository::DataBuckets DataBucket::GetData(const DataBucketKey &k_,
|
|||||||
}
|
}
|
||||||
|
|
||||||
LogDataBuckets(
|
LogDataBuckets(
|
||||||
"Getting bucket key [{}] bot_id [{}] account_id [{}] character_id [{}] npc_id [{}]",
|
"Getting bucket key [{}] bot_id [{}] account_id [{}] character_id [{}] npc_id [{}] zone_id [{}] instance_id [{}]",
|
||||||
k.key,
|
k.key,
|
||||||
k.bot_id,
|
k.bot_id,
|
||||||
k.account_id,
|
k.account_id,
|
||||||
k.character_id,
|
k.character_id,
|
||||||
k.npc_id
|
k.npc_id,
|
||||||
|
k.zone_id,
|
||||||
|
k.instance_id
|
||||||
);
|
);
|
||||||
|
|
||||||
bool can_cache = CanCache(k);
|
bool can_cache = CanCache(k);
|
||||||
@@ -211,7 +250,7 @@ DataBucketsRepository::DataBuckets DataBucket::GetData(const DataBucketKey &k_,
|
|||||||
|
|
||||||
LogDataBuckets("Returning key [{}] value [{}] from cache", e.key_, e.value);
|
LogDataBuckets("Returning key [{}] value [{}] from cache", e.key_, e.value);
|
||||||
|
|
||||||
if (is_nested_key) {
|
if (is_nested_key && !k_.key.empty()) {
|
||||||
return ExtractNestedValue(e, k_.key);
|
return ExtractNestedValue(e, k_.key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -244,17 +283,21 @@ DataBucketsRepository::DataBuckets DataBucket::GetData(const DataBucketKey &k_,
|
|||||||
.account_id = k.account_id,
|
.account_id = k.account_id,
|
||||||
.character_id = k.character_id,
|
.character_id = k.character_id,
|
||||||
.npc_id = k.npc_id,
|
.npc_id = k.npc_id,
|
||||||
.bot_id = k.bot_id
|
.bot_id = k.bot_id,
|
||||||
|
.zone_id = k.zone_id,
|
||||||
|
.instance_id = k.instance_id
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
LogDataBuckets(
|
LogDataBuckets(
|
||||||
"Key [{}] not found in database, adding to cache as a miss account_id [{}] character_id [{}] npc_id [{}] bot_id [{}] cache size before [{}] after [{}]",
|
"Key [{}] not found in database, adding to cache as a miss account_id [{}] character_id [{}] npc_id [{}] bot_id [{}] zone_id [{}] instance_id [{}] cache size before [{}] after [{}]",
|
||||||
k.key,
|
k.key,
|
||||||
k.account_id,
|
k.account_id,
|
||||||
k.character_id,
|
k.character_id,
|
||||||
k.npc_id,
|
k.npc_id,
|
||||||
k.bot_id,
|
k.bot_id,
|
||||||
|
k.zone_id,
|
||||||
|
k.instance_id,
|
||||||
size_before,
|
size_before,
|
||||||
g_data_bucket_cache.size()
|
g_data_bucket_cache.size()
|
||||||
);
|
);
|
||||||
@@ -287,7 +330,7 @@ DataBucketsRepository::DataBuckets DataBucket::GetData(const DataBucketKey &k_,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Handle nested key extraction
|
// Handle nested key extraction
|
||||||
if (is_nested_key) {
|
if (is_nested_key && !k_.key.empty()) {
|
||||||
return ExtractNestedValue(bucket, k_.key);
|
return ExtractNestedValue(bucket, k_.key);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -309,31 +352,13 @@ bool DataBucket::DeleteData(const std::string &bucket_key)
|
|||||||
return DeleteData(DataBucketKey{.key = bucket_key});
|
return DeleteData(DataBucketKey{.key = bucket_key});
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetDataBuckets bulk loads all data buckets for a mob
|
|
||||||
bool DataBucket::GetDataBuckets(Mob *mob)
|
|
||||||
{
|
|
||||||
const uint32 id = mob->GetMobTypeIdentifier();
|
|
||||||
|
|
||||||
if (!id) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mob->IsBot()) {
|
|
||||||
BulkLoadEntitiesToCache(DataBucketLoadType::Bot, {id});
|
|
||||||
}
|
|
||||||
else if (mob->IsClient()) {
|
|
||||||
BulkLoadEntitiesToCache(DataBucketLoadType::Account, {id});
|
|
||||||
BulkLoadEntitiesToCache(DataBucketLoadType::Client, {id});
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DataBucket::DeleteData(const DataBucketKey &k)
|
bool DataBucket::DeleteData(const DataBucketKey &k)
|
||||||
{
|
{
|
||||||
if (CanCache(k)) {
|
bool is_nested_key = k.key.find(NESTED_KEY_DELIMITER) != std::string::npos;
|
||||||
size_t size_before = g_data_bucket_cache.size();
|
|
||||||
|
|
||||||
|
if (!is_nested_key) {
|
||||||
|
// Update cache
|
||||||
|
if (CanCache(k)) {
|
||||||
// delete from cache where contents match
|
// delete from cache where contents match
|
||||||
g_data_bucket_cache.erase(
|
g_data_bucket_cache.erase(
|
||||||
std::remove_if(
|
std::remove_if(
|
||||||
@@ -345,29 +370,102 @@ bool DataBucket::DeleteData(const DataBucketKey &k)
|
|||||||
),
|
),
|
||||||
g_data_bucket_cache.end()
|
g_data_bucket_cache.end()
|
||||||
);
|
);
|
||||||
|
}
|
||||||
|
|
||||||
LogDataBuckets(
|
// Regular key deletion, no nesting involved
|
||||||
"Deleting bucket key [{}] bot_id [{}] account_id [{}] character_id [{}] npc_id [{}] cache size before [{}] after [{}]",
|
return DataBucketsRepository::DeleteWhere(
|
||||||
k.key,
|
database,
|
||||||
k.bot_id,
|
fmt::format("{} `key` = '{}'", DataBucket::GetScopedDbFilters(k), k.key)
|
||||||
k.account_id,
|
);
|
||||||
k.character_id,
|
}
|
||||||
k.npc_id,
|
|
||||||
size_before,
|
// If it's a nested key, retrieve the top-level JSON object
|
||||||
g_data_bucket_cache.size()
|
auto top_level_key = Strings::Split(k.key, NESTED_KEY_DELIMITER).front();
|
||||||
|
DataBucketKey top_level_k = k;
|
||||||
|
top_level_k.key = top_level_key;
|
||||||
|
|
||||||
|
auto r = GetData(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;
|
||||||
|
}
|
||||||
|
|
||||||
|
json json_value;
|
||||||
|
try {
|
||||||
|
json_value = json::parse(r.value);
|
||||||
|
} catch (json::parse_error &ex) {
|
||||||
|
LogDataBuckets("Failed to parse JSON for key [{}] [{}]", top_level_key, ex.what());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Recursively remove the nested key
|
||||||
|
auto nested_keys = Strings::Split(k.key, NESTED_KEY_DELIMITER);
|
||||||
|
auto top_key = nested_keys.front();
|
||||||
|
nested_keys.erase(nested_keys.begin());
|
||||||
|
json *current = &json_value;
|
||||||
|
|
||||||
|
for (size_t i = 0; i < nested_keys.size(); ++i) {
|
||||||
|
const std::string &key_part = nested_keys[i];
|
||||||
|
|
||||||
|
if (i == nested_keys.size() - 1) {
|
||||||
|
// Last key in the hierarchy - delete it
|
||||||
|
if (current->contains(key_part)) {
|
||||||
|
current->erase(key_part);
|
||||||
|
LogDataBuckets("Deleted nested key [{}] from [{}]", key_part, k.key);
|
||||||
|
} else {
|
||||||
|
LogDataBuckets("Key [{}] not found in JSON - nothing to delete", k.key);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (!current->contains(key_part) || !(*current)[key_part].is_object()) {
|
||||||
|
LogDataBuckets("Parent key [{}] does not exist or is not an object", key_part);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
current = &(*current)[key_part];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If the JSON object is now empty, delete the top-level key
|
||||||
|
if (json_value.empty()) {
|
||||||
|
LogDataBuckets("Top-level key [{}] is now empty, deleting entire entry", top_level_key);
|
||||||
|
|
||||||
|
// delete cache
|
||||||
|
if (CanCache(k)) {
|
||||||
|
g_data_bucket_cache.erase(
|
||||||
|
std::remove_if(
|
||||||
|
g_data_bucket_cache.begin(),
|
||||||
|
g_data_bucket_cache.end(),
|
||||||
|
[&](DataBucketsRepository::DataBuckets &e) {
|
||||||
|
return CheckBucketMatch(e, top_level_k);
|
||||||
|
}
|
||||||
|
),
|
||||||
|
g_data_bucket_cache.end()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return DataBucketsRepository::DeleteWhere(
|
return DataBucketsRepository::DeleteWhere(
|
||||||
database,
|
database,
|
||||||
fmt::format(
|
fmt::format("{} `key` = '{}'", DataBucket::GetScopedDbFilters(k), top_level_key)
|
||||||
"{} `key` = '{}'",
|
|
||||||
DataBucket::GetScopedDbFilters(k),
|
|
||||||
k.key
|
|
||||||
)
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Otherwise, update the existing JSON without the deleted key
|
||||||
|
r.value = json_value.dump();
|
||||||
|
DataBucketsRepository::UpdateOne(database, r);
|
||||||
|
|
||||||
|
// Update cache
|
||||||
|
if (CanCache(k)) {
|
||||||
|
for (auto &e : g_data_bucket_cache) {
|
||||||
|
if (CheckBucketMatch(e, top_level_k)) {
|
||||||
|
e.value = r.value;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
std::string DataBucket::GetDataExpires(const DataBucketKey &k)
|
std::string DataBucket::GetDataExpires(const DataBucketKey &k)
|
||||||
{
|
{
|
||||||
LogDataBuckets(
|
LogDataBuckets(
|
||||||
@@ -390,12 +488,15 @@ std::string DataBucket::GetDataExpires(const DataBucketKey &k)
|
|||||||
std::string DataBucket::GetDataRemaining(const DataBucketKey &k)
|
std::string DataBucket::GetDataRemaining(const DataBucketKey &k)
|
||||||
{
|
{
|
||||||
LogDataBuckets(
|
LogDataBuckets(
|
||||||
"Getting bucket remaining key [{}] bot_id [{}] account_id [{}] character_id [{}] npc_id [{}]",
|
"Getting bucket remaining key [{}] bot_id [{}] account_id [{}] character_id [{}] npc_id [{}] bot_id [{}] zone_id [{}] instance_id [{}]",
|
||||||
k.key,
|
k.key,
|
||||||
k.bot_id,
|
k.bot_id,
|
||||||
k.account_id,
|
k.account_id,
|
||||||
k.character_id,
|
k.character_id,
|
||||||
k.npc_id
|
k.npc_id,
|
||||||
|
k.bot_id,
|
||||||
|
k.zone_id,
|
||||||
|
k.instance_id
|
||||||
);
|
);
|
||||||
|
|
||||||
auto r = GetData(k);
|
auto r = GetData(k);
|
||||||
@@ -408,39 +509,46 @@ std::string DataBucket::GetDataRemaining(const DataBucketKey &k)
|
|||||||
|
|
||||||
std::string DataBucket::GetScopedDbFilters(const DataBucketKey &k)
|
std::string DataBucket::GetScopedDbFilters(const DataBucketKey &k)
|
||||||
{
|
{
|
||||||
std::vector<std::string> query = {};
|
std::vector<std::string> q = {};
|
||||||
if (k.character_id > 0) {
|
if (k.character_id > 0) {
|
||||||
query.emplace_back(fmt::format("character_id = {}", k.character_id));
|
q.emplace_back(fmt::format("character_id = {}", k.character_id));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
query.emplace_back("character_id = 0");
|
q.emplace_back("character_id = 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (k.account_id > 0) {
|
if (k.account_id > 0) {
|
||||||
query.emplace_back(fmt::format("account_id = {}", k.account_id));
|
q.emplace_back(fmt::format("account_id = {}", k.account_id));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
query.emplace_back("account_id = 0");
|
q.emplace_back("account_id = 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (k.npc_id > 0) {
|
if (k.npc_id > 0) {
|
||||||
query.emplace_back(fmt::format("npc_id = {}", k.npc_id));
|
q.emplace_back(fmt::format("npc_id = {}", k.npc_id));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
query.emplace_back("npc_id = 0");
|
q.emplace_back("npc_id = 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (k.bot_id > 0) {
|
if (k.bot_id > 0) {
|
||||||
query.emplace_back(fmt::format("bot_id = {}", k.bot_id));
|
q.emplace_back(fmt::format("bot_id = {}", k.bot_id));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
query.emplace_back("bot_id = 0");
|
q.emplace_back("bot_id = 0");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (k.zone_id > 0) {
|
||||||
|
q.emplace_back(fmt::format("zone_id = {} AND instance_id = {}", k.zone_id, k.instance_id));
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
q.emplace_back("zone_id = 0 AND instance_id = 0");
|
||||||
}
|
}
|
||||||
|
|
||||||
return fmt::format(
|
return fmt::format(
|
||||||
"{} {}",
|
"{} {}",
|
||||||
Strings::Join(query, " AND "),
|
Strings::Join(q, " AND "),
|
||||||
!query.empty() ? "AND" : ""
|
!q.empty() ? "AND" : ""
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -451,7 +559,52 @@ bool DataBucket::CheckBucketMatch(const DataBucketsRepository::DataBuckets &dbe,
|
|||||||
dbe.bot_id == k.bot_id &&
|
dbe.bot_id == k.bot_id &&
|
||||||
dbe.account_id == k.account_id &&
|
dbe.account_id == k.account_id &&
|
||||||
dbe.character_id == k.character_id &&
|
dbe.character_id == k.character_id &&
|
||||||
dbe.npc_id == k.npc_id
|
dbe.npc_id == k.npc_id &&
|
||||||
|
dbe.zone_id == k.zone_id &&
|
||||||
|
dbe.instance_id == k.instance_id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DataBucket::LoadZoneCache(uint16 zone_id, uint16 instance_id)
|
||||||
|
{
|
||||||
|
const auto &l = DataBucketsRepository::GetWhere(
|
||||||
|
database,
|
||||||
|
fmt::format(
|
||||||
|
"zone_id = {} AND instance_id = {} AND (`expires` > {} OR `expires` = 0)",
|
||||||
|
zone_id,
|
||||||
|
instance_id,
|
||||||
|
(long long) std::time(nullptr)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (l.empty()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
LogDataBucketsDetail("cache size before [{}] l size [{}]", g_data_bucket_cache.size(), l.size());
|
||||||
|
|
||||||
|
uint32 added_count = 0;
|
||||||
|
|
||||||
|
for (const auto &e: l) {
|
||||||
|
if (!ExistsInCache(e)) {
|
||||||
|
added_count++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto &e: l) {
|
||||||
|
if (!ExistsInCache(e)) {
|
||||||
|
LogDataBucketsDetail("bucket id [{}] bucket key [{}] bucket value [{}]", e.id, e.key_, e.value);
|
||||||
|
|
||||||
|
g_data_bucket_cache.emplace_back(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LogDataBucketsDetail("cache size after [{}]", g_data_bucket_cache.size());
|
||||||
|
|
||||||
|
LogDataBuckets(
|
||||||
|
"Loaded [{}] zone keys new cache size is [{}]",
|
||||||
|
l.size(),
|
||||||
|
g_data_bucket_cache.size()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -541,7 +694,7 @@ void DataBucket::BulkLoadEntitiesToCache(DataBucketLoadType::Type t, std::vector
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataBucket::DeleteCachedBuckets(DataBucketLoadType::Type type, uint32 id)
|
void DataBucket::DeleteCachedBuckets(DataBucketLoadType::Type type, uint32 id, uint32 secondary_id)
|
||||||
{
|
{
|
||||||
size_t size_before = g_data_bucket_cache.size();
|
size_t size_before = g_data_bucket_cache.size();
|
||||||
|
|
||||||
@@ -553,7 +706,8 @@ void DataBucket::DeleteCachedBuckets(DataBucketLoadType::Type type, uint32 id)
|
|||||||
return (
|
return (
|
||||||
(type == DataBucketLoadType::Bot && e.bot_id == id) ||
|
(type == DataBucketLoadType::Bot && e.bot_id == id) ||
|
||||||
(type == DataBucketLoadType::Account && e.account_id == id) ||
|
(type == DataBucketLoadType::Account && e.account_id == id) ||
|
||||||
(type == DataBucketLoadType::Client && e.character_id == id)
|
(type == DataBucketLoadType::Client && e.character_id == id) ||
|
||||||
|
(type == DataBucketLoadType::Zone && e.zone_id == id && e.instance_id == secondary_id)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
@@ -595,7 +749,9 @@ void DataBucket::DeleteFromMissesCache(DataBucketsRepository::DataBuckets e)
|
|||||||
ce.account_id == e.account_id &&
|
ce.account_id == e.account_id &&
|
||||||
ce.character_id == e.character_id &&
|
ce.character_id == e.character_id &&
|
||||||
ce.npc_id == e.npc_id &&
|
ce.npc_id == e.npc_id &&
|
||||||
ce.bot_id == e.bot_id;
|
ce.bot_id == e.bot_id &&
|
||||||
|
ce.zone_id == e.zone_id &&
|
||||||
|
ce.instance_id == e.instance_id;
|
||||||
}
|
}
|
||||||
),
|
),
|
||||||
g_data_bucket_cache.end()
|
g_data_bucket_cache.end()
|
||||||
@@ -647,13 +803,42 @@ void DataBucket::DeleteFromCache(uint64 id, DataBucketLoadType::Type type)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DataBucket::DeleteZoneFromCache(uint16 zone_id, uint16 instance_id, DataBucketLoadType::Type type)
|
||||||
|
{
|
||||||
|
size_t size_before = g_data_bucket_cache.size();
|
||||||
|
|
||||||
|
g_data_bucket_cache.erase(
|
||||||
|
std::remove_if(
|
||||||
|
g_data_bucket_cache.begin(),
|
||||||
|
g_data_bucket_cache.end(),
|
||||||
|
[&](DataBucketsRepository::DataBuckets &e) {
|
||||||
|
switch (type) {
|
||||||
|
case DataBucketLoadType::Zone:
|
||||||
|
return e.zone_id == zone_id && e.instance_id == instance_id;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
),
|
||||||
|
g_data_bucket_cache.end()
|
||||||
|
);
|
||||||
|
|
||||||
|
LogDataBuckets(
|
||||||
|
"Deleted zone [{}] instance [{}] from cache size before [{}] after [{}]",
|
||||||
|
zone_id,
|
||||||
|
instance_id,
|
||||||
|
size_before,
|
||||||
|
g_data_bucket_cache.size()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// CanCache returns whether a bucket can be cached or not
|
// CanCache returns whether a bucket can be cached or not
|
||||||
// characters are only in one zone at a time so we can cache locally to the zone
|
// characters are only in one zone at a time so we can cache locally to the zone
|
||||||
// bots (not implemented) are only in one zone at a time so we can cache locally to the zone
|
// bots (not implemented) are only in one zone at a time so we can cache locally to the zone
|
||||||
// npcs (ids) can be in multiple zones so we can't cache locally to the zone
|
// npcs (ids) can be in multiple zones so we can't cache locally to the zone
|
||||||
bool DataBucket::CanCache(const DataBucketKey &key)
|
bool DataBucket::CanCache(const DataBucketKey &key)
|
||||||
{
|
{
|
||||||
if (key.character_id > 0 || key.account_id > 0 || key.bot_id > 0) {
|
if (key.character_id > 0 || key.account_id > 0 || key.bot_id > 0 || key.zone_id > 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2,20 +2,20 @@
|
|||||||
#define EQEMU_DATABUCKET_H
|
#define EQEMU_DATABUCKET_H
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "../common/types.h"
|
#include "types.h"
|
||||||
#include "../common/repositories/data_buckets_repository.h"
|
#include "repositories/data_buckets_repository.h"
|
||||||
#include "mob.h"
|
#include "json/json_archive_single_line.h"
|
||||||
#include "../common/json/json_archive_single_line.h"
|
|
||||||
#include "../common/servertalk.h"
|
|
||||||
|
|
||||||
struct DataBucketKey {
|
struct DataBucketKey {
|
||||||
std::string key;
|
std::string key;
|
||||||
std::string value;
|
std::string value;
|
||||||
std::string expires;
|
std::string expires;
|
||||||
int64_t account_id = 0;
|
uint64_t account_id = 0;
|
||||||
int64_t character_id = 0;
|
uint64_t character_id = 0;
|
||||||
int64_t npc_id = 0;
|
uint32_t npc_id = 0;
|
||||||
int64_t bot_id = 0;
|
uint32_t bot_id = 0;
|
||||||
|
uint16_t zone_id = 0;
|
||||||
|
uint16_t instance_id = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
namespace DataBucketLoadType {
|
namespace DataBucketLoadType {
|
||||||
@@ -23,6 +23,7 @@ namespace DataBucketLoadType {
|
|||||||
Bot,
|
Bot,
|
||||||
Account,
|
Account,
|
||||||
Client,
|
Client,
|
||||||
|
Zone,
|
||||||
MaxType
|
MaxType
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -30,6 +31,7 @@ namespace DataBucketLoadType {
|
|||||||
"Bot",
|
"Bot",
|
||||||
"Account",
|
"Account",
|
||||||
"Client",
|
"Client",
|
||||||
|
"Zone"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,8 +44,6 @@ public:
|
|||||||
static std::string GetDataExpires(const std::string &bucket_key);
|
static std::string GetDataExpires(const std::string &bucket_key);
|
||||||
static std::string GetDataRemaining(const std::string &bucket_key);
|
static std::string GetDataRemaining(const std::string &bucket_key);
|
||||||
|
|
||||||
static bool GetDataBuckets(Mob *mob);
|
|
||||||
|
|
||||||
// scoped bucket methods
|
// scoped bucket methods
|
||||||
static void SetData(const DataBucketKey &k_);
|
static void SetData(const DataBucketKey &k_);
|
||||||
static bool DeleteData(const DataBucketKey &k);
|
static bool DeleteData(const DataBucketKey &k);
|
||||||
@@ -56,12 +56,14 @@ public:
|
|||||||
static bool CheckBucketMatch(const DataBucketsRepository::DataBuckets &dbe, const DataBucketKey &k);
|
static bool CheckBucketMatch(const DataBucketsRepository::DataBuckets &dbe, const DataBucketKey &k);
|
||||||
static bool ExistsInCache(const DataBucketsRepository::DataBuckets &entry);
|
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 BulkLoadEntitiesToCache(DataBucketLoadType::Type t, std::vector<uint32> ids);
|
||||||
static void DeleteCachedBuckets(DataBucketLoadType::Type type, uint32 id);
|
static void DeleteCachedBuckets(DataBucketLoadType::Type type, uint32 id, uint32 secondary_id = 0);
|
||||||
|
|
||||||
static void DeleteFromMissesCache(DataBucketsRepository::DataBuckets e);
|
static void DeleteFromMissesCache(DataBucketsRepository::DataBuckets e);
|
||||||
static void ClearCache();
|
static void ClearCache();
|
||||||
static void DeleteFromCache(uint64 id, DataBucketLoadType::Type type);
|
static void DeleteFromCache(uint64 id, DataBucketLoadType::Type type);
|
||||||
|
static void DeleteZoneFromCache(uint16 zone_id, uint16 instance_id, DataBucketLoadType::Type type);
|
||||||
static bool CanCache(const DataBucketKey &key);
|
static bool CanCache(const DataBucketKey &key);
|
||||||
static DataBucketsRepository::DataBuckets
|
static DataBucketsRepository::DataBuckets
|
||||||
ExtractNestedValue(const DataBucketsRepository::DataBuckets &bucket, const std::string &full_key);
|
ExtractNestedValue(const DataBucketsRepository::DataBuckets &bucket, const std::string &full_key);
|
||||||
+99
-13
@@ -245,7 +245,7 @@ uint32 Database::CreateAccount(
|
|||||||
e.password = password;
|
e.password = password;
|
||||||
}
|
}
|
||||||
|
|
||||||
LogInfo("Account Attempting to be created: [{}:{}] status: {}", loginserver, name, status);
|
LogInfo("Account attempting to be created loginserver [{}] name [{}] status [{}]", loginserver, name, status);
|
||||||
|
|
||||||
e = AccountRepository::InsertOne(*this, e);
|
e = AccountRepository::InsertOne(*this, e);
|
||||||
|
|
||||||
@@ -708,6 +708,20 @@ const std::string Database::GetNPCNameByID(uint32 npc_id)
|
|||||||
return e.id ? e.name : std::string();
|
return e.id ? e.name : std::string();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template<typename InputIterator, typename OutputIterator>
|
||||||
|
inline auto CleanMobName(InputIterator first, InputIterator last, OutputIterator result)
|
||||||
|
{
|
||||||
|
for (; first != last; ++first) {
|
||||||
|
if (*first == '_') {
|
||||||
|
*result = ' ';
|
||||||
|
}
|
||||||
|
else if (isalpha(*first) || *first == '`') {
|
||||||
|
*result = *first;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
const std::string Database::GetCleanNPCNameByID(uint32 npc_id)
|
const std::string Database::GetCleanNPCNameByID(uint32 npc_id)
|
||||||
{
|
{
|
||||||
const auto& e = NpcTypesRepository::FindOne(*this, npc_id);
|
const auto& e = NpcTypesRepository::FindOne(*this, npc_id);
|
||||||
@@ -955,6 +969,29 @@ bool Database::UpdateName(const std::string& old_name, const std::string& new_na
|
|||||||
return CharacterDataRepository::UpdateOne(*this, e);
|
return CharacterDataRepository::UpdateOne(*this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool Database::UpdateNameByID(const int character_id, const std::string& new_name)
|
||||||
|
{
|
||||||
|
LogInfo("Renaming [{}] to [{}]", character_id, new_name);
|
||||||
|
|
||||||
|
auto l = CharacterDataRepository::GetWhere(
|
||||||
|
*this,
|
||||||
|
fmt::format(
|
||||||
|
"`id` = {}",
|
||||||
|
character_id
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if (l.empty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto& e = l.front();
|
||||||
|
|
||||||
|
e.name = new_name;
|
||||||
|
|
||||||
|
return CharacterDataRepository::UpdateOne(*this, e);
|
||||||
|
}
|
||||||
|
|
||||||
bool Database::IsNameUsed(const std::string& name)
|
bool Database::IsNameUsed(const std::string& name)
|
||||||
{
|
{
|
||||||
if (RuleB(Bots, Enabled)) {
|
if (RuleB(Bots, Enabled)) {
|
||||||
@@ -982,6 +1019,20 @@ bool Database::IsNameUsed(const std::string& name)
|
|||||||
return !character_data.empty();
|
return !character_data.empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Players cannot have the same name as a pet vanity name, or memory corruption occurs.
|
||||||
|
bool Database::IsPetNameUsed(const std::string& name)
|
||||||
|
{
|
||||||
|
const auto& pet_name_data = CharacterPetNameRepository::GetWhere(
|
||||||
|
*this,
|
||||||
|
fmt::format(
|
||||||
|
"`name` = '{}'",
|
||||||
|
Strings::Escape(name)
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
return !pet_name_data.empty();
|
||||||
|
}
|
||||||
|
|
||||||
uint32 Database::GetServerType()
|
uint32 Database::GetServerType()
|
||||||
{
|
{
|
||||||
const auto& l = VariablesRepository::GetWhere(*this, "`varname` = 'ServerType' LIMIT 1");
|
const auto& l = VariablesRepository::GetWhere(*this, "`varname` = 'ServerType' LIMIT 1");
|
||||||
@@ -1058,11 +1109,11 @@ void Database::SetLFP(uint32 character_id, bool is_lfp)
|
|||||||
CharacterDataRepository::UpdateOne(*this, e);
|
CharacterDataRepository::UpdateOne(*this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::SetLoginFlags(uint32 character_id, bool is_lfp, bool is_lfg, uint8 first_logon)
|
void Database::SetLoginFlags(uint32 character_id, bool is_lfp, bool is_lfg, uint8 ingame)
|
||||||
{
|
{
|
||||||
auto e = CharacterDataRepository::FindOne(*this, character_id);
|
auto e = CharacterDataRepository::FindOne(*this, character_id);
|
||||||
|
|
||||||
e.firstlogon = first_logon;
|
e.ingame = ingame;
|
||||||
e.lfg = is_lfg ? 1 : 0;
|
e.lfg = is_lfg ? 1 : 0;
|
||||||
e.lfp = is_lfp ? 1 : 0;
|
e.lfp = is_lfp ? 1 : 0;
|
||||||
|
|
||||||
@@ -1078,11 +1129,11 @@ void Database::SetLFG(uint32 character_id, bool is_lfg)
|
|||||||
CharacterDataRepository::UpdateOne(*this, e);
|
CharacterDataRepository::UpdateOne(*this, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::SetFirstLogon(uint32 character_id, uint8 first_logon)
|
void Database::SetIngame(uint32 character_id, uint8 ingame)
|
||||||
{
|
{
|
||||||
auto e = CharacterDataRepository::FindOne(*this, character_id);
|
auto e = CharacterDataRepository::FindOne(*this, character_id);
|
||||||
|
|
||||||
e.firstlogon = first_logon;
|
e.ingame = ingame;
|
||||||
|
|
||||||
CharacterDataRepository::UpdateOne(*this, e);
|
CharacterDataRepository::UpdateOne(*this, e);
|
||||||
}
|
}
|
||||||
@@ -1883,6 +1934,7 @@ bool Database::CopyCharacter(
|
|||||||
std::vector<std::string> tables_to_zero_id = {
|
std::vector<std::string> tables_to_zero_id = {
|
||||||
"keyring",
|
"keyring",
|
||||||
"data_buckets",
|
"data_buckets",
|
||||||
|
"character_evolving_items",
|
||||||
"character_instance_safereturns",
|
"character_instance_safereturns",
|
||||||
"character_expedition_lockouts",
|
"character_expedition_lockouts",
|
||||||
"character_instance_lockouts",
|
"character_instance_lockouts",
|
||||||
@@ -1914,6 +1966,12 @@ bool Database::CopyCharacter(
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!results.Success()) {
|
||||||
|
LogError("Transaction failed [{}] rolling back", results.ErrorMessage());
|
||||||
|
TransactionRollback();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::string> columns = {};
|
std::vector<std::string> columns = {};
|
||||||
int column_count = 0;
|
int column_count = 0;
|
||||||
|
|
||||||
@@ -1932,6 +1990,12 @@ bool Database::CopyCharacter(
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!results.Success()) {
|
||||||
|
LogError("Transaction failed [{}] rolling back", results.ErrorMessage());
|
||||||
|
TransactionRollback();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
std::vector<std::vector<std::string>> new_rows;
|
std::vector<std::vector<std::string>> new_rows;
|
||||||
|
|
||||||
for (auto row : results) {
|
for (auto row : results) {
|
||||||
@@ -1999,13 +2063,18 @@ bool Database::CopyCharacter(
|
|||||||
LogInfo("Copying table [{}] rows [{}]", table_name, Strings::Commify(rows_copied));
|
LogInfo("Copying table [{}] rows [{}]", table_name, Strings::Commify(rows_copied));
|
||||||
|
|
||||||
if (!insert.ErrorMessage().empty()) {
|
if (!insert.ErrorMessage().empty()) {
|
||||||
|
LogError("Error copying table [{}] [{}]", table_name, insert.ErrorMessage());
|
||||||
TransactionRollback();
|
TransactionRollback();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
TransactionCommit();
|
auto r = TransactionCommit();
|
||||||
|
if (!r.Success()) {
|
||||||
|
LogError("Transaction failed [{}] rolling back", r.ErrorMessage());
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
LogInfo(
|
LogInfo(
|
||||||
"Character [{}] copied to [{}] total rows [{}]",
|
"Character [{}] copied to [{}] total rows [{}]",
|
||||||
@@ -2157,12 +2226,12 @@ void Database::PurgeCharacterParcels()
|
|||||||
for (auto const &r: results) {
|
for (auto const &r: results) {
|
||||||
pd.from_name = r.from_name;
|
pd.from_name = r.from_name;
|
||||||
pd.item_id = r.item_id;
|
pd.item_id = r.item_id;
|
||||||
pd.aug_slot_1 = r.aug_slot_1;
|
pd.augment_1_id = r.aug_slot_1;
|
||||||
pd.aug_slot_2 = r.aug_slot_2;
|
pd.augment_2_id = r.aug_slot_2;
|
||||||
pd.aug_slot_3 = r.aug_slot_3;
|
pd.augment_3_id = r.aug_slot_3;
|
||||||
pd.aug_slot_4 = r.aug_slot_4;
|
pd.augment_4_id = r.aug_slot_4;
|
||||||
pd.aug_slot_5 = r.aug_slot_5;
|
pd.augment_5_id = r.aug_slot_5;
|
||||||
pd.aug_slot_6 = r.aug_slot_6;
|
pd.augment_6_id = r.aug_slot_6;
|
||||||
pd.note = r.note;
|
pd.note = r.note;
|
||||||
pd.quantity = r.quantity;
|
pd.quantity = r.quantity;
|
||||||
pd.sent_date = r.sent_date;
|
pd.sent_date = r.sent_date;
|
||||||
@@ -2175,7 +2244,7 @@ void Database::PurgeCharacterParcels()
|
|||||||
pel.event_data = ss.str();
|
pel.event_data = ss.str();
|
||||||
pel.created_at = std::time(nullptr);
|
pel.created_at = std::time(nullptr);
|
||||||
|
|
||||||
player_event_logs.AddToQueue(pel);
|
PlayerEventLogs::Instance()->AddToQueue(pel);
|
||||||
|
|
||||||
ss.str("");
|
ss.str("");
|
||||||
ss.clear();
|
ss.clear();
|
||||||
@@ -2202,3 +2271,20 @@ void Database::ClearBuyerDetails()
|
|||||||
{
|
{
|
||||||
BuyerRepository::DeleteBuyer(*this, 0);
|
BuyerRepository::DeleteBuyer(*this, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint64_t Database::GetNextTableId(const std::string &table_name)
|
||||||
|
{
|
||||||
|
auto results = QueryDatabase(fmt::format("SHOW TABLE STATUS LIKE '{}'", table_name));
|
||||||
|
|
||||||
|
for (auto row: results) {
|
||||||
|
for (int row_index = 0; row_index < results.ColumnCount(); row_index++) {
|
||||||
|
std::string field_name = Strings::ToLower(results.FieldName(row_index));
|
||||||
|
if (field_name == "auto_increment") {
|
||||||
|
std::string value = row[row_index] ? row[row_index] : "null";
|
||||||
|
return Strings::ToUnsignedBigInt(value, 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|||||||
+6
-1
@@ -103,6 +103,7 @@ public:
|
|||||||
bool ReserveName(uint32 account_id, const std::string& name);
|
bool ReserveName(uint32 account_id, const std::string& name);
|
||||||
bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp);
|
bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp);
|
||||||
bool UpdateName(const std::string& old_name, const std::string& new_name);
|
bool UpdateName(const std::string& old_name, const std::string& new_name);
|
||||||
|
bool UpdateNameByID(const int character_id, const std::string& new_name);
|
||||||
bool CopyCharacter(
|
bool CopyCharacter(
|
||||||
const std::string& source_character_name,
|
const std::string& source_character_name,
|
||||||
const std::string& destination_character_name,
|
const std::string& destination_character_name,
|
||||||
@@ -116,6 +117,7 @@ public:
|
|||||||
bool CheckGMIPs(const std::string& login_ip, uint32 account_id);
|
bool CheckGMIPs(const std::string& login_ip, uint32 account_id);
|
||||||
bool CheckNameFilter(const std::string& name, bool surname = false);
|
bool CheckNameFilter(const std::string& name, bool surname = false);
|
||||||
bool IsNameUsed(const std::string& name);
|
bool IsNameUsed(const std::string& name);
|
||||||
|
bool IsPetNameUsed(const std::string& name);
|
||||||
|
|
||||||
uint32 GetAccountIDByChar(const std::string& name, uint32* character_id = 0);
|
uint32 GetAccountIDByChar(const std::string& name, uint32* character_id = 0);
|
||||||
uint32 GetAccountIDByChar(uint32 character_id);
|
uint32 GetAccountIDByChar(uint32 character_id);
|
||||||
@@ -139,6 +141,7 @@ public:
|
|||||||
bool CheckInstanceExpired(uint16 instance_id);
|
bool CheckInstanceExpired(uint16 instance_id);
|
||||||
bool CreateInstance(uint16 instance_id, uint32 zone_id, uint32 version, uint32 duration);
|
bool CreateInstance(uint16 instance_id, uint32 zone_id, uint32 version, uint32 duration);
|
||||||
bool GetUnusedInstanceID(uint16& instance_id);
|
bool GetUnusedInstanceID(uint16& instance_id);
|
||||||
|
bool TryGetUnusedInstanceID(uint16& instance_id);
|
||||||
bool IsGlobalInstance(uint16 instance_id);
|
bool IsGlobalInstance(uint16 instance_id);
|
||||||
bool RemoveClientFromInstance(uint16 instance_id, uint32 char_id);
|
bool RemoveClientFromInstance(uint16 instance_id, uint32 char_id);
|
||||||
bool RemoveClientsFromInstance(uint16 instance_id);
|
bool RemoveClientsFromInstance(uint16 instance_id);
|
||||||
@@ -260,7 +263,7 @@ public:
|
|||||||
bool SaveTime(int8 minute, int8 hour, int8 day, int8 month, int16 year);
|
bool SaveTime(int8 minute, int8 hour, int8 day, int8 month, int16 year);
|
||||||
void ClearMerchantTemp();
|
void ClearMerchantTemp();
|
||||||
void ClearPTimers(uint32 character_id);
|
void ClearPTimers(uint32 character_id);
|
||||||
void SetFirstLogon(uint32 character_id, uint8 first_logon);
|
void SetIngame(uint32 character_id, uint8 ingame);
|
||||||
void SetLFG(uint32 character_id, bool is_lfg);
|
void SetLFG(uint32 character_id, bool is_lfg);
|
||||||
void SetLFP(uint32 character_id, bool is_lfp);
|
void SetLFP(uint32 character_id, bool is_lfp);
|
||||||
void SetLoginFlags(uint32 character_id, bool is_lfp, bool is_lfg, uint8 first_logon);
|
void SetLoginFlags(uint32 character_id, bool is_lfp, bool is_lfg, uint8 first_logon);
|
||||||
@@ -274,6 +277,8 @@ public:
|
|||||||
void Encode(std::string &in);
|
void Encode(std::string &in);
|
||||||
void Decode(std::string &in);
|
void Decode(std::string &in);
|
||||||
|
|
||||||
|
uint64_t GetNextTableId(const std::string& table_name);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Mutex Mvarcache;
|
Mutex Mvarcache;
|
||||||
VarCache_Struct varcache;
|
VarCache_Struct varcache;
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ bool DatabaseDumpService::IsMySQLInstalled()
|
|||||||
{
|
{
|
||||||
std::string version_output = GetMySQLVersion();
|
std::string version_output = GetMySQLVersion();
|
||||||
|
|
||||||
return version_output.find("mysql") != std::string::npos && version_output.find("Ver") != std::string::npos;
|
return version_output.find("mysql") != std::string::npos && (version_output.find("Ver") != std::string::npos || version_output.find("from") != std::string::npos);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -136,11 +136,6 @@ std::string DatabaseDumpService::GetLoginTableList()
|
|||||||
return Strings::Join(DatabaseSchema::GetLoginTables(), " ");
|
return Strings::Join(DatabaseSchema::GetLoginTables(), " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string DatabaseDumpService::GetQueryServTables()
|
|
||||||
{
|
|
||||||
return Strings::Join(DatabaseSchema::GetQueryServerTables(), " ");
|
|
||||||
}
|
|
||||||
|
|
||||||
std::string DatabaseDumpService::GetSystemTablesList()
|
std::string DatabaseDumpService::GetSystemTablesList()
|
||||||
{
|
{
|
||||||
auto system_tables = DatabaseSchema::GetServerTables();
|
auto system_tables = DatabaseSchema::GetServerTables();
|
||||||
@@ -209,7 +204,7 @@ void DatabaseDumpService::DatabaseDump()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (IsDumpOutputToConsole()) {
|
if (IsDumpOutputToConsole()) {
|
||||||
LogSys.SilenceConsoleLogging();
|
EQEmuLogSys::Instance()->SilenceConsoleLogging();
|
||||||
}
|
}
|
||||||
|
|
||||||
LogInfo("MySQL installed [{}]", GetMySQLVersion());
|
LogInfo("MySQL installed [{}]", GetMySQLVersion());
|
||||||
@@ -272,11 +267,6 @@ void DatabaseDumpService::DatabaseDump()
|
|||||||
tables_to_dump += GetLoginTableList() + " ";
|
tables_to_dump += GetLoginTableList() + " ";
|
||||||
dump_descriptor += "-login";
|
dump_descriptor += "-login";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsDumpQueryServerTables()) {
|
|
||||||
tables_to_dump += GetQueryServTables();
|
|
||||||
dump_descriptor += "-queryserv";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsDumpStaticInstanceData()) {
|
if (IsDumpStaticInstanceData()) {
|
||||||
@@ -334,7 +324,7 @@ void DatabaseDumpService::DatabaseDump()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!IsDumpOutputToConsole()) {
|
if (!IsDumpOutputToConsole()) {
|
||||||
LogSys.LoadLogSettingsDefaults();
|
EQEmuLogSys::Instance()->LoadLogSettingsDefaults();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pipe_file.empty()) {
|
if (!pipe_file.empty()) {
|
||||||
@@ -401,7 +391,6 @@ void DatabaseDumpService::DatabaseDump()
|
|||||||
// LogDebug("[{}] dump-to-console", IsDumpOutputToConsole());
|
// LogDebug("[{}] dump-to-console", IsDumpOutputToConsole());
|
||||||
// LogDebug("[{}] dump-path", GetSetDumpPath());
|
// LogDebug("[{}] dump-path", GetSetDumpPath());
|
||||||
// LogDebug("[{}] compression", (IsDumpWithCompression() ? "true" : "false"));
|
// LogDebug("[{}] compression", (IsDumpWithCompression() ? "true" : "false"));
|
||||||
// LogDebug("[{}] query-serv", (IsDumpQueryServerTables() ? "true" : "false"));
|
|
||||||
// LogDebug("[{}] has-compression-binary", (HasCompressionBinary() ? "true" : "false"));
|
// LogDebug("[{}] has-compression-binary", (HasCompressionBinary() ? "true" : "false"));
|
||||||
// LogDebug("[{}] content", (IsDumpContentTables() ? "true" : "false"));
|
// LogDebug("[{}] content", (IsDumpContentTables() ? "true" : "false"));
|
||||||
// LogDebug("[{}] no-data", (IsDumpWithNoData() ? "true" : "false"));
|
// LogDebug("[{}] no-data", (IsDumpWithNoData() ? "true" : "false"));
|
||||||
@@ -511,16 +500,6 @@ const std::string &DatabaseDumpService::GetDumpFileName() const
|
|||||||
return dump_file_name;
|
return dump_file_name;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseDumpService::IsDumpQueryServerTables() const
|
|
||||||
{
|
|
||||||
return dump_query_server_tables;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DatabaseDumpService::SetDumpQueryServerTables(bool dump_query_server_tables)
|
|
||||||
{
|
|
||||||
DatabaseDumpService::dump_query_server_tables = dump_query_server_tables;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool DatabaseDumpService::IsDumpOutputToConsole() const
|
bool DatabaseDumpService::IsDumpOutputToConsole() const
|
||||||
{
|
{
|
||||||
return dump_output_to_console;
|
return dump_output_to_console;
|
||||||
@@ -617,8 +596,13 @@ void DatabaseDumpService::BuildCredentialsFile()
|
|||||||
void DatabaseDumpService::RemoveCredentialsFile()
|
void DatabaseDumpService::RemoveCredentialsFile()
|
||||||
{
|
{
|
||||||
if (File::Exists(CREDENTIALS_FILE)) {
|
if (File::Exists(CREDENTIALS_FILE)) {
|
||||||
|
try {
|
||||||
std::filesystem::remove(CREDENTIALS_FILE);
|
std::filesystem::remove(CREDENTIALS_FILE);
|
||||||
}
|
}
|
||||||
|
catch (std::exception &e) {
|
||||||
|
LogError("std::filesystem::remove err [{}]", e.what());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DatabaseDumpService::IsDumpStaticInstanceData()
|
bool DatabaseDumpService::IsDumpStaticInstanceData()
|
||||||
|
|||||||
@@ -45,8 +45,6 @@ public:
|
|||||||
void SetDumpPath(const std::string &dump_path);
|
void SetDumpPath(const std::string &dump_path);
|
||||||
const std::string &GetDumpFileName() const;
|
const std::string &GetDumpFileName() const;
|
||||||
void SetDumpFileName(const std::string &dump_file_name);
|
void SetDumpFileName(const std::string &dump_file_name);
|
||||||
bool IsDumpQueryServerTables() const;
|
|
||||||
void SetDumpQueryServerTables(bool dump_query_server_tables);
|
|
||||||
bool IsDumpOutputToConsole() const;
|
bool IsDumpOutputToConsole() const;
|
||||||
void SetDumpOutputToConsole(bool dump_output_to_console);
|
void SetDumpOutputToConsole(bool dump_output_to_console);
|
||||||
bool IsDumpDropTableSyntaxOnly() const;
|
bool IsDumpDropTableSyntaxOnly() const;
|
||||||
@@ -67,7 +65,6 @@ private:
|
|||||||
bool dump_system_tables = false;
|
bool dump_system_tables = false;
|
||||||
bool dump_content_tables = false;
|
bool dump_content_tables = false;
|
||||||
bool dump_player_tables = false;
|
bool dump_player_tables = false;
|
||||||
bool dump_query_server_tables = false;
|
|
||||||
bool dump_login_server_tables = false;
|
bool dump_login_server_tables = false;
|
||||||
bool dump_with_no_data = false;
|
bool dump_with_no_data = false;
|
||||||
bool dump_table_lock = false;
|
bool dump_table_lock = false;
|
||||||
@@ -96,7 +93,6 @@ private:
|
|||||||
bool HasCompressionBinary();
|
bool HasCompressionBinary();
|
||||||
std::string GetDumpFileNameWithPath();
|
std::string GetDumpFileNameWithPath();
|
||||||
std::string GetSetDumpPath();
|
std::string GetSetDumpPath();
|
||||||
std::string GetQueryServTables();
|
|
||||||
void RemoveSqlBackup();
|
void RemoveSqlBackup();
|
||||||
void BuildCredentialsFile();
|
void BuildCredentialsFile();
|
||||||
void RemoveCredentialsFile();
|
void RemoveCredentialsFile();
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
#include "../http/httplib.h"
|
#include "../http/httplib.h"
|
||||||
|
|
||||||
#include "database_update_manifest.cpp"
|
#include "database_update_manifest.cpp"
|
||||||
|
#include "database_update_manifest_custom.cpp"
|
||||||
#include "database_update_manifest_bots.cpp"
|
#include "database_update_manifest_bots.cpp"
|
||||||
#include "database_dump_service.h"
|
#include "database_dump_service.h"
|
||||||
|
|
||||||
@@ -14,7 +15,7 @@ constexpr int BREAK_LENGTH = 70;
|
|||||||
|
|
||||||
DatabaseVersion DatabaseUpdate::GetDatabaseVersions()
|
DatabaseVersion DatabaseUpdate::GetDatabaseVersions()
|
||||||
{
|
{
|
||||||
auto results = m_database->QueryDatabase("SELECT `version`, `bots_version` FROM `db_version` LIMIT 1");
|
auto results = m_database->QueryDatabase("SELECT `version`, `bots_version`, `custom_version` FROM `db_version` LIMIT 1");
|
||||||
if (!results.Success() || !results.RowCount()) {
|
if (!results.Success() || !results.RowCount()) {
|
||||||
LogError("Failed to read from [db_version] table!");
|
LogError("Failed to read from [db_version] table!");
|
||||||
return DatabaseVersion{};
|
return DatabaseVersion{};
|
||||||
@@ -25,6 +26,7 @@ DatabaseVersion DatabaseUpdate::GetDatabaseVersions()
|
|||||||
return DatabaseVersion{
|
return DatabaseVersion{
|
||||||
.server_database_version = Strings::ToInt(r[0]),
|
.server_database_version = Strings::ToInt(r[0]),
|
||||||
.bots_database_version = Strings::ToInt(r[1]),
|
.bots_database_version = Strings::ToInt(r[1]),
|
||||||
|
.custom_database_version = Strings::ToInt(r[2]),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,6 +35,7 @@ DatabaseVersion DatabaseUpdate::GetBinaryDatabaseVersions()
|
|||||||
return DatabaseVersion{
|
return DatabaseVersion{
|
||||||
.server_database_version = CURRENT_BINARY_DATABASE_VERSION,
|
.server_database_version = CURRENT_BINARY_DATABASE_VERSION,
|
||||||
.bots_database_version = (RuleB(Bots, Enabled) ? CURRENT_BINARY_BOTS_DATABASE_VERSION : 0),
|
.bots_database_version = (RuleB(Bots, Enabled) ? CURRENT_BINARY_BOTS_DATABASE_VERSION : 0),
|
||||||
|
.custom_database_version = CUSTOM_BINARY_DATABASE_VERSION,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -43,6 +46,7 @@ constexpr int LOOK_BACK_AMOUNT = 10;
|
|||||||
// this check will take action
|
// this check will take action
|
||||||
void DatabaseUpdate::CheckDbUpdates()
|
void DatabaseUpdate::CheckDbUpdates()
|
||||||
{
|
{
|
||||||
|
InjectCustomVersionColumn();
|
||||||
InjectBotsVersionColumn();
|
InjectBotsVersionColumn();
|
||||||
auto v = GetDatabaseVersions();
|
auto v = GetDatabaseVersions();
|
||||||
auto b = GetBinaryDatabaseVersions();
|
auto b = GetBinaryDatabaseVersions();
|
||||||
@@ -59,6 +63,15 @@ void DatabaseUpdate::CheckDbUpdates()
|
|||||||
m_database->QueryDatabase(fmt::format("UPDATE `db_version` SET `version` = {}", b.server_database_version));
|
m_database->QueryDatabase(fmt::format("UPDATE `db_version` SET `version` = {}", b.server_database_version));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (UpdateManifest(manifest_entries_custom, v.custom_database_version, b.custom_database_version)) {
|
||||||
|
LogInfo(
|
||||||
|
"Updates ran successfully, setting database version to [{}] from [{}]",
|
||||||
|
b.custom_database_version,
|
||||||
|
v.custom_database_version
|
||||||
|
);
|
||||||
|
m_database->QueryDatabase(fmt::format("UPDATE `db_version` SET `custom_version` = {}", b.custom_database_version));
|
||||||
|
}
|
||||||
|
|
||||||
if (b.bots_database_version > 0) {
|
if (b.bots_database_version > 0) {
|
||||||
if (UpdateManifest(bot_manifest_entries, v.bots_database_version, b.bots_database_version)) {
|
if (UpdateManifest(bot_manifest_entries, v.bots_database_version, b.bots_database_version)) {
|
||||||
LogInfo(
|
LogInfo(
|
||||||
@@ -141,7 +154,8 @@ bool DatabaseUpdate::UpdateManifest(
|
|||||||
std::vector<int> missing_migrations = {};
|
std::vector<int> missing_migrations = {};
|
||||||
if (version_low != version_high) {
|
if (version_low != version_high) {
|
||||||
|
|
||||||
LogSys.DisableMySQLErrorLogs();
|
EQEmuLogSys::Instance()->DisableMySQLErrorLogs();
|
||||||
|
bool force_interactive = false;
|
||||||
for (int version = version_low + 1; version <= version_high; ++version) {
|
for (int version = version_low + 1; version <= version_high; ++version) {
|
||||||
for (auto &e: entries) {
|
for (auto &e: entries) {
|
||||||
if (e.version == version) {
|
if (e.version == version) {
|
||||||
@@ -163,10 +177,14 @@ bool DatabaseUpdate::UpdateManifest(
|
|||||||
prefix,
|
prefix,
|
||||||
e.description
|
e.description
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (!has_migration && e.force_interactive) {
|
||||||
|
force_interactive = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
LogSys.EnableMySQLErrorLogs();
|
}
|
||||||
|
EQEmuLogSys::Instance()->EnableMySQLErrorLogs();
|
||||||
LogInfo("{}", Strings::Repeat("-", BREAK_LENGTH));
|
LogInfo("{}", Strings::Repeat("-", BREAK_LENGTH));
|
||||||
|
|
||||||
if (!missing_migrations.empty() && m_skip_backup) {
|
if (!missing_migrations.empty() && m_skip_backup) {
|
||||||
@@ -187,6 +205,42 @@ bool DatabaseUpdate::UpdateManifest(
|
|||||||
LogInfo("{}", Strings::Repeat("-", BREAK_LENGTH));
|
LogInfo("{}", Strings::Repeat("-", BREAK_LENGTH));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (force_interactive && !std::getenv("FORCE_INTERACTIVE")) {
|
||||||
|
LogInfo("{}", Strings::Repeat("-", BREAK_LENGTH));
|
||||||
|
LogInfo("Some migrations require user input. Running interactively");
|
||||||
|
LogInfo("This is usually due to a major change that could cause data loss");
|
||||||
|
LogInfo("Your server is automatically backed up before these updates are applied");
|
||||||
|
LogInfo("but you should also make sure you take a backup prior to running this update");
|
||||||
|
LogInfo("Would you like to run this update? [y/n] (Timeout 60s)");
|
||||||
|
LogInfo("{}", Strings::Repeat("-", BREAK_LENGTH));
|
||||||
|
|
||||||
|
// user input
|
||||||
|
std::string input;
|
||||||
|
bool gave_input = false;
|
||||||
|
time_t start_time = time(nullptr);
|
||||||
|
time_t wait_time_seconds = 60;
|
||||||
|
|
||||||
|
// spawn a concurrent thread that waits for input from std::cin
|
||||||
|
std::thread t1(
|
||||||
|
[&]() {
|
||||||
|
std::cin >> input;
|
||||||
|
gave_input = true;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
t1.detach();
|
||||||
|
|
||||||
|
// check the inputReceived flag once every 50ms for 10 seconds
|
||||||
|
while (time(nullptr) < start_time + wait_time_seconds && !gave_input) {
|
||||||
|
std::this_thread::sleep_for(std::chrono::milliseconds(50));
|
||||||
|
}
|
||||||
|
|
||||||
|
// prompt for user skip
|
||||||
|
if (Strings::Trim(input) != "y") {
|
||||||
|
LogInfo("Exiting due to user input");
|
||||||
|
std::exit(1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (auto &m: missing_migrations) {
|
for (auto &m: missing_migrations) {
|
||||||
for (auto &e: entries) {
|
for (auto &e: entries) {
|
||||||
if (e.version == m) {
|
if (e.version == m) {
|
||||||
@@ -303,6 +357,16 @@ bool DatabaseUpdate::CheckVersionsUpToDate(DatabaseVersion v, DatabaseVersion b)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (b.custom_database_version > 0) {
|
||||||
|
LogInfo(
|
||||||
|
"{:>8} | database [{}] binary [{}] {}",
|
||||||
|
"Custom",
|
||||||
|
v.custom_database_version,
|
||||||
|
b.custom_database_version,
|
||||||
|
(v.custom_database_version == b.custom_database_version) ? "up to date" : "checking updates"
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
LogInfo("{:>8} | [server.auto_database_updates] [<green>true]", "Config");
|
LogInfo("{:>8} | [server.auto_database_updates] [<green>true]", "Config");
|
||||||
|
|
||||||
LogInfo("{}", Strings::Repeat("-", BREAK_LENGTH));
|
LogInfo("{}", Strings::Repeat("-", BREAK_LENGTH));
|
||||||
@@ -312,7 +376,10 @@ bool DatabaseUpdate::CheckVersionsUpToDate(DatabaseVersion v, DatabaseVersion b)
|
|||||||
// bots database version is optional, if not enabled then it is always up-to-date
|
// bots database version is optional, if not enabled then it is always up-to-date
|
||||||
bool bots_up_to_date = RuleB(Bots, Enabled) ? v.bots_database_version >= b.bots_database_version : true;
|
bool bots_up_to_date = RuleB(Bots, Enabled) ? v.bots_database_version >= b.bots_database_version : true;
|
||||||
|
|
||||||
return server_up_to_date && bots_up_to_date;
|
// custom database version is optional, if not enabled then it is always up-to-date
|
||||||
|
bool custom_up_to_date = v.custom_database_version >= b.custom_database_version;
|
||||||
|
|
||||||
|
return server_up_to_date && bots_up_to_date && custom_up_to_date;
|
||||||
}
|
}
|
||||||
|
|
||||||
// checks to see if there are pending updates
|
// checks to see if there are pending updates
|
||||||
@@ -332,3 +399,12 @@ void DatabaseUpdate::InjectBotsVersionColumn()
|
|||||||
m_database->QueryDatabase("ALTER TABLE db_version ADD bots_version int(11) DEFAULT '0' AFTER version");
|
m_database->QueryDatabase("ALTER TABLE db_version ADD bots_version int(11) DEFAULT '0' AFTER version");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DatabaseUpdate::InjectCustomVersionColumn()
|
||||||
|
{
|
||||||
|
auto results = m_database->QueryDatabase("SHOW COLUMNS FROM `db_version` LIKE 'custom_version'");
|
||||||
|
if (!results.Success() || results.RowCount() == 0) {
|
||||||
|
LogInfo("Adding custom_version column to db_version table");
|
||||||
|
m_database->QueryDatabase("ALTER TABLE `db_version` ADD COLUMN `custom_version` INT(11) UNSIGNED NOT NULL DEFAULT 0");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
@@ -11,11 +11,13 @@ struct ManifestEntry {
|
|||||||
std::string match{}; // match field that is not always used, but works in conjunction with "condition" values [missing|match|contains]
|
std::string match{}; // match field that is not always used, but works in conjunction with "condition" values [missing|match|contains]
|
||||||
std::string sql{}; // the SQL DDL that gets ran when the condition is true
|
std::string sql{}; // the SQL DDL that gets ran when the condition is true
|
||||||
bool content_schema_update{}; // if true, this migration is a content schema update and should be ran against the content database
|
bool content_schema_update{}; // if true, this migration is a content schema update and should be ran against the content database
|
||||||
|
bool force_interactive; // if true, this migration will always be run interactively
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DatabaseVersion {
|
struct DatabaseVersion {
|
||||||
int server_database_version;
|
int server_database_version;
|
||||||
int bots_database_version;
|
int bots_database_version;
|
||||||
|
int custom_database_version;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DatabaseUpdate {
|
class DatabaseUpdate {
|
||||||
@@ -31,12 +33,20 @@ public:
|
|||||||
DatabaseUpdate *SetContentDatabase(Database *db);
|
DatabaseUpdate *SetContentDatabase(Database *db);
|
||||||
DatabaseUpdate *SetSkipBackup(bool skip);
|
DatabaseUpdate *SetSkipBackup(bool skip);
|
||||||
bool HasPendingUpdates();
|
bool HasPendingUpdates();
|
||||||
|
|
||||||
|
static DatabaseUpdate* Instance()
|
||||||
|
{
|
||||||
|
static DatabaseUpdate instance;
|
||||||
|
return &instance;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool m_skip_backup = false;
|
bool m_skip_backup = false;
|
||||||
Database *m_database;
|
Database *m_database;
|
||||||
Database *m_content_database;
|
Database *m_content_database;
|
||||||
static bool CheckVersionsUpToDate(DatabaseVersion v, DatabaseVersion b);
|
static bool CheckVersionsUpToDate(DatabaseVersion v, DatabaseVersion b);
|
||||||
void InjectBotsVersionColumn();
|
void InjectBotsVersionColumn();
|
||||||
|
void InjectCustomVersionColumn();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -6378,7 +6378,814 @@ CREATE INDEX idx_trader_active_transaction ON trader (active_transaction);
|
|||||||
)",
|
)",
|
||||||
.content_schema_update = false
|
.content_schema_update = false
|
||||||
},
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9296,
|
||||||
|
.description = "2025_02_01_trader_table_listing_date.sql",
|
||||||
|
.check = "SHOW CREATE TABLE `trader`",
|
||||||
|
.condition = "missing",
|
||||||
|
.match = "listing_date",
|
||||||
|
.sql = R"(
|
||||||
|
ALTER TABLE `trader`
|
||||||
|
ADD COLUMN `listing_date` DATETIME NULL DEFAULT NULL AFTER `active_transaction`,
|
||||||
|
ADD INDEX `idx_trader_listing_date` (`listing_date`);
|
||||||
|
)",
|
||||||
|
.content_schema_update = false
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9297,
|
||||||
|
.description = "2024_01_22_sharedbank_guid_primary_key.sql",
|
||||||
|
.check = "SHOW COLUMNS FROM `sharedbank` LIKE 'guid'",
|
||||||
|
.condition = "empty",
|
||||||
|
.match = "",
|
||||||
|
.sql = R"(
|
||||||
|
ALTER TABLE `sharedbank`
|
||||||
|
CHANGE COLUMN `acctid` `account_id` int(11) UNSIGNED NOT NULL DEFAULT 0 FIRST,
|
||||||
|
CHANGE COLUMN `slotid` `slot_id` mediumint(7) UNSIGNED NOT NULL DEFAULT 0 AFTER `account_id`,
|
||||||
|
CHANGE COLUMN `itemid` `item_id` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `slot_id`,
|
||||||
|
CHANGE COLUMN `augslot1` `augment_one` mediumint(7) UNSIGNED NOT NULL DEFAULT 0 AFTER `charges`,
|
||||||
|
CHANGE COLUMN `augslot2` `augment_two` mediumint(7) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_one`,
|
||||||
|
CHANGE COLUMN `augslot3` `augment_three` mediumint(7) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_two`,
|
||||||
|
CHANGE COLUMN `augslot4` `augment_four` mediumint(7) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_three`,
|
||||||
|
CHANGE COLUMN `augslot5` `augment_five` mediumint(7) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_four`,
|
||||||
|
CHANGE COLUMN `augslot6` `augment_six` mediumint(7) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_five`,
|
||||||
|
MODIFY COLUMN `charges` smallint(3) UNSIGNED NOT NULL DEFAULT 0 AFTER `item_id`,
|
||||||
|
ADD COLUMN `color` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `charges`,
|
||||||
|
ADD COLUMN `ornament_icon` int(11) UNSIGNED NOT NULL AFTER `custom_data`,
|
||||||
|
ADD COLUMN `ornament_idfile` int(11) UNSIGNED NOT NULL AFTER `ornament_icon`,
|
||||||
|
ADD COLUMN `ornament_hero_model` int(11) NOT NULL AFTER `ornament_idfile`,
|
||||||
|
ADD COLUMN `guid` bigint(20) UNSIGNED NOT NULL DEFAULT 0 AFTER `ornament_hero_model`,
|
||||||
|
ADD PRIMARY KEY (`account_id`, `slot_id`);
|
||||||
|
)",
|
||||||
|
.content_schema_update = false,
|
||||||
|
.force_interactive = false
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9298,
|
||||||
|
.description = "2024_10_24_inventory_changes.sql",
|
||||||
|
.check = "SHOW COLUMNS FROM `inventory` LIKE 'character_id'",
|
||||||
|
.condition = "empty",
|
||||||
|
.match = "",
|
||||||
|
.sql = R"(
|
||||||
|
ALTER TABLE `inventory`
|
||||||
|
CHANGE COLUMN `charid` `character_id` int(11) UNSIGNED NOT NULL DEFAULT 0 FIRST,
|
||||||
|
CHANGE COLUMN `slotid` `slot_id` mediumint(7) UNSIGNED NOT NULL DEFAULT 0 AFTER `character_id`,
|
||||||
|
CHANGE COLUMN `itemid` `item_id` int(11) UNSIGNED NULL DEFAULT 0 AFTER `slot_id`,
|
||||||
|
CHANGE COLUMN `augslot1` `augment_one` mediumint(7) UNSIGNED NOT NULL DEFAULT 0 AFTER `color`,
|
||||||
|
CHANGE COLUMN `augslot2` `augment_two` mediumint(7) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_one`,
|
||||||
|
CHANGE COLUMN `augslot3` `augment_three` mediumint(7) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_two`,
|
||||||
|
CHANGE COLUMN `augslot4` `augment_four` mediumint(7) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_three`,
|
||||||
|
CHANGE COLUMN `augslot5` `augment_five` mediumint(7) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_four`,
|
||||||
|
CHANGE COLUMN `augslot6` `augment_six` mediumint(7) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_five`,
|
||||||
|
CHANGE COLUMN `ornamenticon` `ornament_icon` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `custom_data`,
|
||||||
|
CHANGE COLUMN `ornamentidfile` `ornament_idfile` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `ornament_icon`,
|
||||||
|
DROP PRIMARY KEY,
|
||||||
|
ADD PRIMARY KEY (`character_id`, `slot_id`) USING BTREE;
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 251) + 4010) WHERE `slot_id` BETWEEN 251 AND 260; -- Bag 1
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 261) + 4210) WHERE `slot_id` BETWEEN 261 AND 270; -- Bag 2
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 271) + 4410) WHERE `slot_id` BETWEEN 271 AND 280; -- Bag 3
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 281) + 4610) WHERE `slot_id` BETWEEN 281 AND 290; -- Bag 4
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 291) + 4810) WHERE `slot_id` BETWEEN 291 AND 300; -- Bag 5
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 301) + 5010) WHERE `slot_id` BETWEEN 301 AND 310; -- Bag 6
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 311) + 5210) WHERE `slot_id` BETWEEN 311 AND 320; -- Bag 7
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 321) + 5410) WHERE `slot_id` BETWEEN 321 AND 330; -- Bag 8
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 331) + 5610) WHERE `slot_id` BETWEEN 331 AND 340; -- Bag 9
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 341) + 5810) WHERE `slot_id` BETWEEN 341 AND 350; -- Bag 10
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 8000) + 6010) WHERE `slot_id` BETWEEN 8000 AND 8199; -- Cursor Overflow
|
||||||
|
DELETE FROM `inventory` WHERE `slot_id` BETWEEN 8200 AND 8999; -- Extreme Cursor Overflow
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 351) + 6010) WHERE `slot_id` BETWEEN 351 AND 360; -- Cursor Bag
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 2031) + 6210) WHERE `slot_id` BETWEEN 2031 AND 2040; -- Bank Bag 1
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 2041) + 6410) WHERE `slot_id` BETWEEN 2041 AND 2050; -- Bank Bag 2
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 2051) + 6610) WHERE `slot_id` BETWEEN 2051 AND 2060; -- Bank Bag 3
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 2061) + 6810) WHERE `slot_id` BETWEEN 2061 AND 2070; -- Bank Bag 4
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 2071) + 7010) WHERE `slot_id` BETWEEN 2071 AND 2080; -- Bank Bag 5
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 2081) + 7210) WHERE `slot_id` BETWEEN 2081 AND 2090; -- Bank Bag 6
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 2091) + 7410) WHERE `slot_id` BETWEEN 2091 AND 2100; -- Bank Bag 7
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 2101) + 7610) WHERE `slot_id` BETWEEN 2101 AND 2110; -- Bank Bag 8
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 2111) + 7810) WHERE `slot_id` BETWEEN 2111 AND 2120; -- Bank Bag 9
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 2121) + 8010) WHERE `slot_id` BETWEEN 2121 AND 2130; -- Bank Bag 10
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 2131) + 8210) WHERE `slot_id` BETWEEN 2131 AND 2140; -- Bank Bag 11
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 2141) + 8410) WHERE `slot_id` BETWEEN 2141 AND 2150; -- Bank Bag 12
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 2151) + 8610) WHERE `slot_id` BETWEEN 2151 AND 2160; -- Bank Bag 13
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 2161) + 8810) WHERE `slot_id` BETWEEN 2161 AND 2170; -- Bank Bag 14
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 2171) + 9010) WHERE `slot_id` BETWEEN 2171 AND 2180; -- Bank Bag 15
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 2181) + 9210) WHERE `slot_id` BETWEEN 2181 AND 2190; -- Bank Bag 16
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 2191) + 9410) WHERE `slot_id` BETWEEN 2191 AND 2200; -- Bank Bag 17
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 2201) + 9610) WHERE `slot_id` BETWEEN 2201 AND 2210; -- Bank Bag 18
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 2211) + 9810) WHERE `slot_id` BETWEEN 2211 AND 2220; -- Bank Bag 19
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 2221) + 10010) WHERE `slot_id` BETWEEN 2221 AND 2230; -- Bank Bag 20
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 2231) + 10210) WHERE `slot_id` BETWEEN 2231 AND 2240; -- Bank Bag 21
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 2241) + 10410) WHERE `slot_id` BETWEEN 2241 AND 2250; -- Bank Bag 22
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 2251) + 10610) WHERE `slot_id` BETWEEN 2251 AND 2260; -- Bank Bag 23
|
||||||
|
UPDATE `inventory` SET `slot_id` = ((`slot_id` - 2261) + 10810) WHERE `slot_id` BETWEEN 2261 AND 2270; -- Bank Bag 24
|
||||||
|
UPDATE `sharedbank` SET `slot_id` = ((`slot_id` - 2531) + 11010) WHERE `slot_id` BETWEEN 2531 AND 2540; -- Shared Bank Bag 1
|
||||||
|
UPDATE `sharedbank` SET `slot_id` = ((`slot_id` - 2541) + 11210) WHERE `slot_id` BETWEEN 2541 AND 2550; -- Shared Bank Bag 2
|
||||||
|
)",
|
||||||
|
.content_schema_update = false,
|
||||||
|
.force_interactive = false
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9299,
|
||||||
|
.description = "2024_10_24_merchantlist_temp_uncap.sql",
|
||||||
|
.check = "SHOW CREATE TABLE `merchantlist_temp`",
|
||||||
|
.condition = "contains",
|
||||||
|
.match = "`slot` tinyint(3)",
|
||||||
|
.sql = R"(
|
||||||
|
ALTER TABLE `merchantlist_temp`
|
||||||
|
MODIFY COLUMN `slot` int UNSIGNED NOT NULL DEFAULT 0 AFTER `npcid`;
|
||||||
|
)",
|
||||||
|
.content_schema_update = false
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9300,
|
||||||
|
.description = "2024_10_15_npc_types_multiquest_enabled.sql",
|
||||||
|
.check = "SHOW COLUMNS FROM `npc_types` LIKE 'multiquest_enabled'",
|
||||||
|
.condition = "empty",
|
||||||
|
.match = "",
|
||||||
|
.sql = R"(
|
||||||
|
ALTER TABLE `npc_types`
|
||||||
|
ADD COLUMN `multiquest_enabled` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 AFTER `is_parcel_merchant`;
|
||||||
|
)",
|
||||||
|
.content_schema_update = true
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9301,
|
||||||
|
.description = "2024_10_08_add_detail_player_event_logging.sql",
|
||||||
|
.check = "SHOW COLUMNS FROM `player_event_log_settings` LIKE 'etl_enabled'",
|
||||||
|
.condition = "empty",
|
||||||
|
.match = "",
|
||||||
|
.sql = R"(
|
||||||
|
ALTER TABLE `player_event_log_settings`
|
||||||
|
ADD COLUMN `etl_enabled` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' AFTER `discord_webhook_id`;
|
||||||
|
ALTER TABLE `player_event_logs`
|
||||||
|
ADD COLUMN `etl_table_id` BIGINT(20) NOT NULL DEFAULT '0' AFTER `event_data`;
|
||||||
|
UPDATE `player_event_log_settings` SET `etl_enabled` = 1 WHERE `id` = 14;
|
||||||
|
CREATE TABLE `player_event_loot_items` (
|
||||||
|
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`item_id` INT(10) UNSIGNED NULL DEFAULT NULL,
|
||||||
|
`item_name` VARCHAR(64) NULL DEFAULT NULL COLLATE 'latin1_swedish_ci',
|
||||||
|
`charges` INT(11) NULL DEFAULT NULL,
|
||||||
|
`augment_1_id` INT UNSIGNED NULL DEFAULT '0',
|
||||||
|
`augment_2_id` INT UNSIGNED NULL DEFAULT '0',
|
||||||
|
`augment_3_id` INT UNSIGNED NULL DEFAULT '0',
|
||||||
|
`augment_4_id` INT UNSIGNED NULL DEFAULT '0',
|
||||||
|
`augment_5_id` INT UNSIGNED NULL DEFAULT '0',
|
||||||
|
`augment_6_id` INT UNSIGNED NULL DEFAULT '0',
|
||||||
|
`npc_id` INT(10) UNSIGNED NULL DEFAULT NULL,
|
||||||
|
`corpse_name` VARCHAR(64) NULL DEFAULT NULL COLLATE 'latin1_swedish_ci',
|
||||||
|
`created_at` DATETIME NULL DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
|
INDEX `item_id_npc_id` (`item_id`, `npc_id`) USING BTREE,
|
||||||
|
INDEX `created_at` (`created_at`) USING BTREE
|
||||||
|
)
|
||||||
|
COLLATE='latin1_swedish_ci'
|
||||||
|
ENGINE=InnoDB
|
||||||
|
AUTO_INCREMENT=1;
|
||||||
|
UPDATE `player_event_log_settings` SET `etl_enabled` = 1 WHERE `id` = 16;
|
||||||
|
CREATE TABLE `player_event_merchant_sell` (
|
||||||
|
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`npc_id` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`merchant_name` VARCHAR(64) NULL DEFAULT NULL COLLATE 'latin1_swedish_ci',
|
||||||
|
`merchant_type` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`item_id` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`item_name` VARCHAR(64) NULL DEFAULT NULL COLLATE 'latin1_swedish_ci',
|
||||||
|
`charges` INT(11) NULL DEFAULT '0',
|
||||||
|
`cost` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`alternate_currency_id` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`player_money_balance` BIGINT(20) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`player_currency_balance` BIGINT(20) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`created_at` DATETIME NULL DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
|
INDEX `item_id_npc_id` (`item_id`, `npc_id`) USING BTREE,
|
||||||
|
INDEX `created_at` (`created_at`) USING BTREE
|
||||||
|
)
|
||||||
|
COLLATE='latin1_swedish_ci'
|
||||||
|
ENGINE=InnoDB
|
||||||
|
AUTO_INCREMENT=1;
|
||||||
|
UPDATE `player_event_log_settings` SET `etl_enabled` = 1 WHERE `id` = 15;
|
||||||
|
CREATE TABLE `player_event_merchant_purchase` (
|
||||||
|
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`npc_id` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`merchant_name` VARCHAR(64) NULL DEFAULT NULL COLLATE 'latin1_swedish_ci',
|
||||||
|
`merchant_type` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`item_id` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`item_name` VARCHAR(64) NULL DEFAULT NULL COLLATE 'latin1_swedish_ci',
|
||||||
|
`charges` INT(11) NULL DEFAULT '0',
|
||||||
|
`cost` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`alternate_currency_id` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`player_money_balance` BIGINT(20) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`player_currency_balance` BIGINT(20) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`created_at` DATETIME NULL DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
|
INDEX `item_id_npc_id` (`item_id`, `npc_id`) USING BTREE,
|
||||||
|
INDEX `created_at` (`created_at`) USING BTREE
|
||||||
|
)
|
||||||
|
COLLATE='latin1_swedish_ci'
|
||||||
|
ENGINE=InnoDB
|
||||||
|
AUTO_INCREMENT=1;
|
||||||
|
UPDATE `player_event_log_settings` SET `etl_enabled` = 1 WHERE `id` = 22;
|
||||||
|
CREATE TABLE `player_event_npc_handin` (
|
||||||
|
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`npc_id` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`npc_name` VARCHAR(64) NULL DEFAULT NULL COLLATE 'latin1_swedish_ci',
|
||||||
|
`handin_copper` BIGINT(20) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`handin_silver` BIGINT(20) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`handin_gold` BIGINT(20) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`handin_platinum` BIGINT(20) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`return_copper` BIGINT(20) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`return_silver` BIGINT(20) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`return_gold` BIGINT(20) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`return_platinum` BIGINT(20) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`is_quest_handin` TINYINT(3) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`created_at` DATETIME NULL DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
|
INDEX `npc_id_is_quest_handin` (`npc_id`, `is_quest_handin`) USING BTREE,
|
||||||
|
INDEX `created_at` (`created_at`) USING BTREE
|
||||||
|
)
|
||||||
|
COLLATE='latin1_swedish_ci'
|
||||||
|
ENGINE=InnoDB
|
||||||
|
AUTO_INCREMENT=1;
|
||||||
|
CREATE TABLE `player_event_npc_handin_entries` (
|
||||||
|
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`player_event_npc_handin_id` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`type` INT(10) UNSIGNED NULL DEFAULT NULL,
|
||||||
|
`item_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`charges` INT(11) NOT NULL DEFAULT '0',
|
||||||
|
`evolve_level` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`evolve_amount` BIGINT(20) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`augment_1_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`augment_2_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`augment_3_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`augment_4_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`augment_5_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`augment_6_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
|
||||||
|
`created_at` DATETIME NULL DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
|
INDEX `type_item_id` (`type`, `item_id`) USING BTREE,
|
||||||
|
INDEX `player_event_npc_handin_id` (`player_event_npc_handin_id`) USING BTREE,
|
||||||
|
INDEX `created_at` (`created_at`) USING BTREE
|
||||||
|
)
|
||||||
|
COLLATE='latin1_swedish_ci'
|
||||||
|
ENGINE=InnoDB
|
||||||
|
AUTO_INCREMENT=1;
|
||||||
|
UPDATE `player_event_log_settings` SET `etl_enabled` = 1 WHERE `id` = 27;
|
||||||
|
CREATE TABLE `player_event_trade` (
|
||||||
|
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`char1_id` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`char2_id` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`char1_copper` BIGINT(20) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`char1_silver` BIGINT(20) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`char1_gold` BIGINT(20) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`char1_platinum` BIGINT(20) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`char2_copper` BIGINT(20) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`char2_silver` BIGINT(20) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`char2_gold` BIGINT(20) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`char2_platinum` BIGINT(20) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`created_at` DATETIME NULL DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
|
INDEX `char1_id_char2_id` (`char1_id`, `char2_id`) USING BTREE,
|
||||||
|
INDEX `created_at` (`created_at`) USING BTREE
|
||||||
|
)
|
||||||
|
COLLATE='latin1_swedish_ci'
|
||||||
|
ENGINE=InnoDB
|
||||||
|
AUTO_INCREMENT=1;
|
||||||
|
CREATE TABLE `player_event_trade_entries` (
|
||||||
|
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`player_event_trade_id` BIGINT(20) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`char_id` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`slot` SMALLINT(6) NULL DEFAULT '0',
|
||||||
|
`item_id` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`charges` SMALLINT(6) NULL DEFAULT '0',
|
||||||
|
`augment_1_id` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`augment_2_id` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`augment_3_id` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`augment_4_id` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`augment_5_id` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`augment_6_id` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`in_bag` TINYINT(4) NULL DEFAULT '0',
|
||||||
|
`created_at` DATETIME NULL DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
|
INDEX `player_event_trade_id` (`player_event_trade_id`) USING BTREE,
|
||||||
|
INDEX `created_at` (`created_at`) USING BTREE
|
||||||
|
)
|
||||||
|
COLLATE='latin1_swedish_ci'
|
||||||
|
ENGINE=InnoDB
|
||||||
|
AUTO_INCREMENT=1;
|
||||||
|
UPDATE `player_event_log_settings` SET `etl_enabled` = 0 WHERE `id` = 54;
|
||||||
|
CREATE TABLE `player_event_speech` (
|
||||||
|
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`to_char_id` VARCHAR(64) NULL DEFAULT NULL COLLATE 'latin1_swedish_ci',
|
||||||
|
`from_char_id` VARCHAR(64) NULL DEFAULT NULL COLLATE 'latin1_swedish_ci',
|
||||||
|
`guild_id` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`type` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`min_status` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`message` LONGTEXT NULL DEFAULT NULL COLLATE 'latin1_swedish_ci',
|
||||||
|
`created_at` DATETIME NULL DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
|
INDEX `to_char_id_from_char_id` (`to_char_id`, `from_char_id`) USING BTREE,
|
||||||
|
INDEX `created_at` (`created_at`) USING BTREE
|
||||||
|
)
|
||||||
|
COLLATE='latin1_swedish_ci'
|
||||||
|
ENGINE=InnoDB
|
||||||
|
AUTO_INCREMENT=1;
|
||||||
|
UPDATE `player_event_log_settings` SET `etl_enabled` = 1 WHERE `id` = 44;
|
||||||
|
CREATE TABLE `player_event_killed_npc` (
|
||||||
|
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`npc_id` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`npc_name` VARCHAR(64) NULL DEFAULT NULL COLLATE 'latin1_swedish_ci',
|
||||||
|
`combat_time_seconds` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`total_damage_per_second_taken` BIGINT(20) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`total_heal_per_second_taken` BIGINT(20) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`created_at` DATETIME NULL DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
|
INDEX `npc_id` (`npc_id`) USING BTREE,
|
||||||
|
INDEX `created_at` (`created_at`) USING BTREE
|
||||||
|
)
|
||||||
|
COLLATE='latin1_swedish_ci'
|
||||||
|
ENGINE=InnoDB;
|
||||||
|
UPDATE `player_event_log_settings` SET `etl_enabled` = 1 WHERE `id` = 45;
|
||||||
|
CREATE TABLE `player_event_killed_named_npc` (
|
||||||
|
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`npc_id` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`npc_name` VARCHAR(64) NULL DEFAULT NULL COLLATE 'latin1_swedish_ci',
|
||||||
|
`combat_time_seconds` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`total_damage_per_second_taken` BIGINT(20) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`total_heal_per_second_taken` BIGINT(20) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`created_at` DATETIME NULL DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
|
INDEX `npc_id` (`npc_id`) USING BTREE,
|
||||||
|
INDEX `created_at` (`created_at`) USING BTREE
|
||||||
|
)
|
||||||
|
COLLATE='latin1_swedish_ci'
|
||||||
|
ENGINE=InnoDB;
|
||||||
|
UPDATE `player_event_log_settings` SET `etl_enabled` = 1 WHERE `id` = 46;
|
||||||
|
CREATE TABLE `player_event_killed_raid_npc` (
|
||||||
|
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`npc_id` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`npc_name` VARCHAR(64) NULL DEFAULT NULL COLLATE 'latin1_swedish_ci',
|
||||||
|
`combat_time_seconds` INT(10) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`total_damage_per_second_taken` BIGINT(20) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`total_heal_per_second_taken` BIGINT(20) UNSIGNED NULL DEFAULT '0',
|
||||||
|
`created_at` DATETIME NULL DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
|
INDEX `npc_id` (`npc_id`) USING BTREE,
|
||||||
|
INDEX `created_at` (`created_at`) USING BTREE
|
||||||
|
)
|
||||||
|
COLLATE='latin1_swedish_ci'
|
||||||
|
ENGINE=InnoDB;
|
||||||
|
UPDATE `player_event_log_settings` SET `etl_enabled` = 1 WHERE `id` = 4;
|
||||||
|
CREATE TABLE `player_event_aa_purchase` (
|
||||||
|
`id` BIGINT(20) UNSIGNED NOT NULL AUTO_INCREMENT,
|
||||||
|
`aa_ability_id` INT(11) NULL DEFAULT '0',
|
||||||
|
`cost` INT(11) NULL DEFAULT '0',
|
||||||
|
`previous_id` INT(11) NULL DEFAULT '0',
|
||||||
|
`next_id` INT(11) NULL DEFAULT '0',
|
||||||
|
`created_at` DATETIME NULL DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`) USING BTREE,
|
||||||
|
INDEX `created_at` (`created_at`) USING BTREE
|
||||||
|
)
|
||||||
|
COLLATE='latin1_swedish_ci'
|
||||||
|
ENGINE=InnoDB
|
||||||
|
;
|
||||||
|
)"
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9302,
|
||||||
|
.description = "2025_02_09_illusion_block.sql",
|
||||||
|
.check = "SHOW COLUMNS FROM `character_data` LIKE 'illusion_block'",
|
||||||
|
.condition = "empty",
|
||||||
|
.match = "",
|
||||||
|
.sql = R"(
|
||||||
|
ALTER TABLE `character_data`
|
||||||
|
ADD COLUMN `illusion_block` TINYINT(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `deleted_at`;
|
||||||
|
|
||||||
|
UPDATE `command_settings`
|
||||||
|
SET `aliases` =
|
||||||
|
CASE
|
||||||
|
WHEN LENGTH(`aliases`) > 0 AND `aliases` NOT LIKE '%|ib%'
|
||||||
|
THEN CONCAT(`aliases`, '|ib')
|
||||||
|
WHEN LENGTH(`aliases`) = 0
|
||||||
|
THEN 'ib'
|
||||||
|
ELSE `aliases`
|
||||||
|
END
|
||||||
|
WHERE `command` = 'illusionblock'
|
||||||
|
AND `aliases` NOT LIKE '%ib%';
|
||||||
|
)",
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9303,
|
||||||
|
.description = "2025_02_13_corpse_slot_fix.sql",
|
||||||
|
.check = "SELECT * FROM `character_corpse_items` WHERE `equip_slot` BETWEEN 251 AND 350",
|
||||||
|
.condition = "not_empty",
|
||||||
|
.match = "",
|
||||||
|
.sql = R"(
|
||||||
|
UPDATE `character_corpse_items` SET `equip_slot` = ((`equip_slot` - 251) + 4010) WHERE `equip_slot` BETWEEN 251 AND 260; -- Bag 1
|
||||||
|
UPDATE `character_corpse_items` SET `equip_slot` = ((`equip_slot` - 261) + 4210) WHERE `equip_slot` BETWEEN 261 AND 270; -- Bag 2
|
||||||
|
UPDATE `character_corpse_items` SET `equip_slot` = ((`equip_slot` - 271) + 4410) WHERE `equip_slot` BETWEEN 271 AND 280; -- Bag 3
|
||||||
|
UPDATE `character_corpse_items` SET `equip_slot` = ((`equip_slot` - 281) + 4610) WHERE `equip_slot` BETWEEN 281 AND 290; -- Bag 4
|
||||||
|
UPDATE `character_corpse_items` SET `equip_slot` = ((`equip_slot` - 291) + 4810) WHERE `equip_slot` BETWEEN 291 AND 300; -- Bag 5
|
||||||
|
UPDATE `character_corpse_items` SET `equip_slot` = ((`equip_slot` - 301) + 5010) WHERE `equip_slot` BETWEEN 301 AND 310; -- Bag 6
|
||||||
|
UPDATE `character_corpse_items` SET `equip_slot` = ((`equip_slot` - 311) + 5210) WHERE `equip_slot` BETWEEN 311 AND 320; -- Bag 7
|
||||||
|
UPDATE `character_corpse_items` SET `equip_slot` = ((`equip_slot` - 321) + 5410) WHERE `equip_slot` BETWEEN 321 AND 330; -- Bag 8
|
||||||
|
UPDATE `character_corpse_items` SET `equip_slot` = ((`equip_slot` - 331) + 5610) WHERE `equip_slot` BETWEEN 331 AND 340; -- Bag 9
|
||||||
|
UPDATE `character_corpse_items` SET `equip_slot` = ((`equip_slot` - 341) + 5810) WHERE `equip_slot` BETWEEN 341 AND 350; -- Bag 10
|
||||||
|
)",
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9304,
|
||||||
|
.description = "2024_12_01_update_guild_bank",
|
||||||
|
.check = "SHOW COLUMNS FROM `guild_bank` LIKE 'augment_one_id'",
|
||||||
|
.condition = "empty",
|
||||||
|
.match = "",
|
||||||
|
.sql = R"(
|
||||||
|
ALTER TABLE `guild_bank`
|
||||||
|
DROP INDEX `guildid`,
|
||||||
|
CHANGE COLUMN `guildid` `guild_id` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `id`,
|
||||||
|
CHANGE COLUMN `itemid` `item_id` INT(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `slot`,
|
||||||
|
CHANGE COLUMN `whofor` `who_for` VARCHAR(64) NULL DEFAULT NULL COLLATE 'utf8_general_ci' AFTER `permissions`,
|
||||||
|
ADD COLUMN `augment_one_id` INT UNSIGNED NULL DEFAULT '0' AFTER `item_id`,
|
||||||
|
ADD COLUMN `augment_two_id` INT UNSIGNED NULL DEFAULT '0' AFTER `augment_one_id`,
|
||||||
|
ADD COLUMN `augment_three_id` INT UNSIGNED NULL DEFAULT '0' AFTER `augment_two_id`,
|
||||||
|
ADD COLUMN `augment_four_id` INT UNSIGNED NULL DEFAULT '0' AFTER `augment_three_id`,
|
||||||
|
ADD COLUMN `augment_five_id` INT UNSIGNED NULL DEFAULT '0' AFTER `augment_four_id`,
|
||||||
|
ADD COLUMN `augment_six_id` INT UNSIGNED NULL DEFAULT '0' AFTER `augment_five_id`,
|
||||||
|
CHANGE COLUMN `qty` `quantity` INT(10) NOT NULL DEFAULT '0' AFTER `augment_six_id`;
|
||||||
|
ALTER TABLE `guild_bank`
|
||||||
|
ADD INDEX `guild_id` (`guild_id`);
|
||||||
|
)"
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9305,
|
||||||
|
.description = "2024_12_01_expedition_dz_merge.sql",
|
||||||
|
.check = "SHOW COLUMNS FROM `dynamic_zones` LIKE 'is_locked'",
|
||||||
|
.condition = "empty",
|
||||||
|
.match = "",
|
||||||
|
.sql = R"(
|
||||||
|
ALTER TABLE `dynamic_zones`
|
||||||
|
ADD COLUMN `is_locked` TINYINT NOT NULL DEFAULT '0' AFTER `has_zone_in`,
|
||||||
|
ADD COLUMN `add_replay` TINYINT NOT NULL DEFAULT '1' AFTER `is_locked`;
|
||||||
|
|
||||||
|
ALTER TABLE `expedition_lockouts`
|
||||||
|
CHANGE COLUMN `expedition_id` `dynamic_zone_id` INT(10) UNSIGNED NOT NULL AFTER `id`,
|
||||||
|
DROP INDEX `expedition_id_event_name`,
|
||||||
|
ADD UNIQUE INDEX `dz_id_event_name` (`dynamic_zone_id`, `event_name`) USING BTREE;
|
||||||
|
|
||||||
|
UPDATE expedition_lockouts lockouts
|
||||||
|
INNER JOIN expeditions ON lockouts.dynamic_zone_id = expeditions.id
|
||||||
|
SET lockouts.dynamic_zone_id = expeditions.dynamic_zone_id;
|
||||||
|
|
||||||
|
DROP TABLE `expeditions`;
|
||||||
|
|
||||||
|
RENAME TABLE `expedition_lockouts` TO `dynamic_zone_lockouts`;
|
||||||
|
)"
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9306,
|
||||||
|
.description = "2025_02_16_data_buckets_zone_id_instance_id.sql",
|
||||||
|
.check = "SHOW COLUMNS FROM `data_buckets` LIKE 'zone_id'",
|
||||||
|
.condition = "empty",
|
||||||
|
.match = "",
|
||||||
|
.sql = R"(
|
||||||
|
-- Drop old indexes if exists
|
||||||
|
DROP INDEX IF EXISTS `keys` ON `data_buckets`;
|
||||||
|
DROP INDEX IF EXISTS `idx_npc_expires` ON `data_buckets`;
|
||||||
|
DROP INDEX IF EXISTS `idx_bot_expires` ON `data_buckets`;
|
||||||
|
|
||||||
|
-- Add zone_id, instance_id
|
||||||
|
ALTER TABLE `data_buckets`
|
||||||
|
MODIFY COLUMN `npc_id` int(11) NOT NULL DEFAULT 0 AFTER `character_id`,
|
||||||
|
MODIFY COLUMN `bot_id` int(11) NOT NULL DEFAULT 0 AFTER `npc_id`,
|
||||||
|
ADD COLUMN `zone_id` smallint(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `bot_id`,
|
||||||
|
ADD COLUMN `instance_id` smallint(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `zone_id`;
|
||||||
|
|
||||||
|
ALTER TABLE `data_buckets`
|
||||||
|
MODIFY COLUMN `account_id` bigint(11) UNSIGNED NULL DEFAULT 0 AFTER `expires`,
|
||||||
|
MODIFY COLUMN `character_id` bigint(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `account_id`,
|
||||||
|
MODIFY COLUMN `npc_id` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `character_id`,
|
||||||
|
MODIFY COLUMN `bot_id` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `npc_id`;
|
||||||
|
|
||||||
|
-- Create optimized unique index with `key` first
|
||||||
|
CREATE UNIQUE INDEX `keys` ON data_buckets (`key`, character_id, npc_id, bot_id, account_id, zone_id, instance_id);
|
||||||
|
|
||||||
|
-- Create indexes for just instance_id (instance deletion)
|
||||||
|
CREATE INDEX idx_instance_id ON data_buckets (instance_id);
|
||||||
|
)",
|
||||||
|
.content_schema_update = false
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9307,
|
||||||
|
.description = "2025_02_17_zone_state_spawns.sql",
|
||||||
|
.check = "SHOW TABLES LIKE 'zone_state_spawns'",
|
||||||
|
.condition = "empty",
|
||||||
|
.match = "",
|
||||||
|
.sql = R"(
|
||||||
|
CREATE TABLE `zone_state_spawns` (
|
||||||
|
`id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||||
|
`zone_id` int(11) unsigned DEFAULT NULL,
|
||||||
|
`instance_id` int(11) unsigned DEFAULT NULL,
|
||||||
|
`is_corpse` tinyint(11) DEFAULT 0,
|
||||||
|
`decay_in_seconds` int(11) DEFAULT 0,
|
||||||
|
`npc_id` int(10) unsigned DEFAULT NULL,
|
||||||
|
`spawn2_id` int(10) unsigned NOT NULL,
|
||||||
|
`spawngroup_id` int(10) unsigned NOT NULL,
|
||||||
|
`x` float NOT NULL,
|
||||||
|
`y` float NOT NULL,
|
||||||
|
`z` float NOT NULL,
|
||||||
|
`heading` float NOT NULL,
|
||||||
|
`respawn_time` int(10) unsigned NOT NULL,
|
||||||
|
`variance` int(10) unsigned NOT NULL,
|
||||||
|
`grid` int(10) unsigned DEFAULT 0,
|
||||||
|
`current_waypoint` int(11) DEFAULT 0,
|
||||||
|
`path_when_zone_idle` smallint(6) DEFAULT 0,
|
||||||
|
`condition_id` smallint(5) unsigned DEFAULT 0,
|
||||||
|
`condition_min_value` smallint(6) DEFAULT 0,
|
||||||
|
`enabled` smallint(6) DEFAULT 1,
|
||||||
|
`anim` smallint(5) unsigned DEFAULT 0,
|
||||||
|
`loot_data` text DEFAULT NULL,
|
||||||
|
`entity_variables` text DEFAULT NULL,
|
||||||
|
`buffs` text DEFAULT NULL,
|
||||||
|
`hp` bigint(20) DEFAULT 0,
|
||||||
|
`mana` bigint(20) DEFAULT 0,
|
||||||
|
`endurance` bigint(20) DEFAULT 0,
|
||||||
|
`created_at` datetime DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4
|
||||||
|
)",
|
||||||
|
.content_schema_update = false
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9308,
|
||||||
|
.description = "2025_03_29_add_multivalue_support_to_evolving_subtype.sql",
|
||||||
|
.check = "SHOW COLUMNS FROM `items_evolving_details` LIKE 'sub_type'",
|
||||||
|
.condition = "missing",
|
||||||
|
.match = "varchar(200)",
|
||||||
|
.sql = R"(
|
||||||
|
ALTER TABLE `items_evolving_details`
|
||||||
|
CHANGE COLUMN `sub_type` `sub_type` VARCHAR(200) NULL DEFAULT '0' AFTER `type`;
|
||||||
|
)",
|
||||||
|
.content_schema_update = true
|
||||||
|
},
|
||||||
|
// this one got missed being added to PEQ dumps so adding it again so it gets added when folks take a new release
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9309,
|
||||||
|
.description = "2025_03_1_create_pet_names_table_if_not_exist.sql",
|
||||||
|
.check = "SHOW TABLES LIKE 'character_pet_name'",
|
||||||
|
.condition = "empty",
|
||||||
|
.match = "",
|
||||||
|
.sql = R"(
|
||||||
|
CREATE TABLE `character_pet_name` (
|
||||||
|
`character_id` INT(11) NOT NULL PRIMARY KEY,
|
||||||
|
`name` VARCHAR(64) NOT NULL
|
||||||
|
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
|
||||||
|
)",
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9310,
|
||||||
|
.description = "2025_03_7_expand_horse_def.sql",
|
||||||
|
.check = "SHOW COLUMNS FROM `horses` LIKE 'helmtexture'",
|
||||||
|
.condition = "empty",
|
||||||
|
.match = "",
|
||||||
|
.sql = R"(
|
||||||
|
ALTER TABLE `horses`
|
||||||
|
ADD COLUMN `helmtexture` TINYINT(2) NOT NULL DEFAULT -1 AFTER `texture`;
|
||||||
|
)",
|
||||||
|
.content_schema_update = true
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9311,
|
||||||
|
.description = "2025_03_09_add_zone_state_is_zone_field.sql",
|
||||||
|
.check = "SHOW COLUMNS FROM `zone_state_spawns` LIKE 'is_zone'",
|
||||||
|
.condition = "empty",
|
||||||
|
.match = "",
|
||||||
|
.sql = R"(
|
||||||
|
ALTER TABLE `zone_state_spawns`
|
||||||
|
ADD COLUMN `is_zone` tinyint(11) NULL DEFAULT 0 AFTER `is_corpse`;
|
||||||
|
)",
|
||||||
|
.content_schema_update = false
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9312,
|
||||||
|
.description = "2025_03_11_data_bucket_indexes.sql",
|
||||||
|
.check = "SHOW INDEX FROM data_buckets",
|
||||||
|
.condition = "missing",
|
||||||
|
.match = "idx_zone_instance_expires",
|
||||||
|
.sql = R"(
|
||||||
|
DROP INDEX IF EXISTS `idx_zone_instance_expires` ON `data_buckets`;
|
||||||
|
DROP INDEX IF EXISTS `idx_character_expires` ON `data_buckets`;
|
||||||
|
DROP INDEX IF EXISTS `idx_bot_expires` ON `data_buckets`;
|
||||||
|
ALTER TABLE data_buckets ADD INDEX idx_zone_instance_expires (zone_id, instance_id, expires);
|
||||||
|
ALTER TABLE data_buckets ADD INDEX idx_character_expires (character_id, expires);
|
||||||
|
ALTER TABLE data_buckets ADD INDEX idx_bot_expires (bot_id, expires);
|
||||||
|
)",
|
||||||
|
.content_schema_update = false
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9313,
|
||||||
|
.description = "2025_03_11_zone_state_spawns.sql",
|
||||||
|
.check = "SHOW INDEX FROM zone_state_spawns",
|
||||||
|
.condition = "missing",
|
||||||
|
.match = "idx_zone_instance",
|
||||||
|
.sql = R"(
|
||||||
|
ALTER TABLE zone_state_spawns ADD INDEX idx_zone_instance (zone_id, instance_id);
|
||||||
|
)",
|
||||||
|
.content_schema_update = false
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9314,
|
||||||
|
.description = "2025_03_12_zone_state_spawns_one_time_truncate.sql",
|
||||||
|
.check = "SELECT * FROM db_version WHERE version >= 9314",
|
||||||
|
.condition = "empty",
|
||||||
|
.match = "",
|
||||||
|
.sql = R"(
|
||||||
|
TRUNCATE TABLE zone_state_spawns;
|
||||||
|
)",
|
||||||
|
.content_schema_update = false
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9315,
|
||||||
|
.description = "2025_03_29_character_tribute_index.sql",
|
||||||
|
.check = "SHOW INDEX FROM character_tribute",
|
||||||
|
.condition = "missing",
|
||||||
|
.match = "idx_character_id",
|
||||||
|
.sql = R"(
|
||||||
|
ALTER TABLE character_tribute ADD INDEX idx_character_id (character_id);
|
||||||
|
)",
|
||||||
|
.content_schema_update = false
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9316,
|
||||||
|
.description = "2025_03_29_player_titlesets_index.sql",
|
||||||
|
.check = "SHOW INDEX FROM player_titlesets",
|
||||||
|
.condition = "missing",
|
||||||
|
.match = "idx_char_id",
|
||||||
|
.sql = R"(
|
||||||
|
ALTER TABLE player_titlesets ADD INDEX idx_char_id (char_id);
|
||||||
|
)",
|
||||||
|
.content_schema_update = false
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9317,
|
||||||
|
.description = "2025_03_29_respawn_times_instance_index.sql",
|
||||||
|
.check = "SHOW INDEX FROM respawn_times",
|
||||||
|
.condition = "missing",
|
||||||
|
.match = "idx_instance_id",
|
||||||
|
.sql = R"(
|
||||||
|
ALTER TABLE respawn_times ADD INDEX idx_instance_id (instance_id);
|
||||||
|
)",
|
||||||
|
.content_schema_update = false
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9318,
|
||||||
|
.description = "2025_03_29_zone_state_spawns_instance_index.sql",
|
||||||
|
.check = "SHOW INDEX FROM zone_state_spawns",
|
||||||
|
.condition = "missing",
|
||||||
|
.match = "idx_instance_id",
|
||||||
|
.sql = R"(
|
||||||
|
ALTER TABLE zone_state_spawns ADD INDEX idx_instance_id (instance_id);
|
||||||
|
)",
|
||||||
|
.content_schema_update = false
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9319,
|
||||||
|
.description = "2025_03_29_data_buckets_expires_index.sql",
|
||||||
|
.check = "SHOW INDEX FROM data_buckets",
|
||||||
|
.condition = "missing",
|
||||||
|
.match = "idx_expires",
|
||||||
|
.sql = R"(
|
||||||
|
CREATE INDEX idx_expires ON data_buckets (expires);
|
||||||
|
)",
|
||||||
|
.content_schema_update = false
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9320,
|
||||||
|
.description = "2025_03_23_add_respawn_times_expire_at.sql",
|
||||||
|
.check = "SHOW COLUMNS FROM `respawn_times` LIKE 'expire_at'",
|
||||||
|
.condition = "empty",
|
||||||
|
.match = "",
|
||||||
|
.sql = R"(
|
||||||
|
ALTER TABLE `respawn_times`
|
||||||
|
ADD COLUMN `expire_at` int(11) UNSIGNED NULL DEFAULT 0 AFTER `duration`;
|
||||||
|
|
||||||
|
UPDATE respawn_times set expire_at = `start` + `duration`; -- backfill existing data
|
||||||
|
|
||||||
|
CREATE INDEX `idx_expire_at` ON `respawn_times` (`expire_at`);
|
||||||
|
)",
|
||||||
|
.content_schema_update = false
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9321,
|
||||||
|
.description = "2025_03_30_instance_list_add_expire_at.sql",
|
||||||
|
.check = "SHOW COLUMNS FROM `instance_list` LIKE 'expire_at'",
|
||||||
|
.condition = "empty",
|
||||||
|
.match = "",
|
||||||
|
.sql = R"(
|
||||||
|
ALTER TABLE `instance_list`
|
||||||
|
ADD COLUMN `expire_at` bigint(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `duration`;
|
||||||
|
|
||||||
|
UPDATE instance_list set expire_at = `start_time` + `duration`; -- backfill existing data
|
||||||
|
|
||||||
|
CREATE INDEX `idx_expire_at` ON `instance_list` (`expire_at`);
|
||||||
|
)",
|
||||||
|
.content_schema_update = false
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9322,
|
||||||
|
.description = "2025_04_24_add_npc_tint_id.sql",
|
||||||
|
.check = "SHOW COLUMNS FROM `npc_types` LIKE 'npc_tint_id'",
|
||||||
|
.condition = "empty",
|
||||||
|
.match = "",
|
||||||
|
.sql = R"(
|
||||||
|
ALTER TABLE `npc_types`
|
||||||
|
ADD COLUMN `npc_tint_id` SMALLINT UNSIGNED NULL DEFAULT '0' AFTER `multiquest_enabled`;
|
||||||
|
)",
|
||||||
|
.content_schema_update = true
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9323,
|
||||||
|
.description = "2025_04_16_character_data_first_login.sql",
|
||||||
|
.check = "SHOW COLUMNS FROM `character_data` LIKE 'first_login'",
|
||||||
|
.condition = "empty",
|
||||||
|
.match = "",
|
||||||
|
.sql = R"(
|
||||||
|
ALTER TABLE `character_data`
|
||||||
|
CHANGE COLUMN `firstlogon` `ingame` tinyint(1) UNSIGNED NOT NULL DEFAULT 0 AFTER `xtargets`,
|
||||||
|
ADD COLUMN `first_login` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `xtargets`;
|
||||||
|
)",
|
||||||
|
.content_schema_update = false
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9324,
|
||||||
|
.description = "2025_06_11_player_event_logs_table.sql",
|
||||||
|
.check = "SHOW CREATE TABLE `player_event_logs`",
|
||||||
|
.condition = "missing",
|
||||||
|
.match = "COMPRESS",
|
||||||
|
.sql = R"(
|
||||||
|
ALTER TABLE player_event_logs ROW_FORMAT=COMPRESSED;
|
||||||
|
CREATE INDEX idx_event_type_char_id ON player_event_logs (event_type_id, character_id);
|
||||||
|
)",
|
||||||
|
.content_schema_update = false
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9325,
|
||||||
|
.description = "2025_06_10_character_corpses_entity_variables.sql",
|
||||||
|
.check = "SHOW COLUMNS FROM `character_corpses` LIKE 'entity_variables'",
|
||||||
|
.condition = "empty",
|
||||||
|
.match = "",
|
||||||
|
.sql = R"(
|
||||||
|
ALTER TABLE `character_corpses`
|
||||||
|
ADD COLUMN `entity_variables` TEXT DEFAULT NULL AFTER `rezzable`;
|
||||||
|
)",
|
||||||
|
.content_schema_update = false
|
||||||
|
},
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 9326,
|
||||||
|
.description = "2025_07_27_add_indexes_npc_spawns_loot.sql",
|
||||||
|
.check = "SHOW INDEX FROM npc_types",
|
||||||
|
.condition = "missing",
|
||||||
|
.match = "idx_npc_types_loottable_id",
|
||||||
|
.sql = R"(
|
||||||
|
ALTER TABLE npc_types
|
||||||
|
ADD INDEX idx_npc_types_loottable_id (loottable_id);
|
||||||
|
|
||||||
|
ALTER TABLE spawnentry
|
||||||
|
ADD INDEX idx_spawnentry_spawngroup_id (spawngroupID),
|
||||||
|
ADD INDEX idx_spawnentry_npc_id (npcID);
|
||||||
|
|
||||||
|
ALTER TABLE lootdrop_entries
|
||||||
|
ADD INDEX idx_lootdrop_entries_lootdrop_id (lootdrop_id),
|
||||||
|
ADD INDEX idx_lootdrop_entries_item_id (item_id);
|
||||||
|
|
||||||
|
ALTER TABLE loottable_entries
|
||||||
|
ADD INDEX idx_loottable_entries_lootdrop_id (lootdrop_id),
|
||||||
|
ADD INDEX idx_loottable_entries_loottable_id (loottable_id);
|
||||||
|
)",
|
||||||
|
.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
|
// -- template; copy/paste this when you need to create a new entry
|
||||||
// ManifestEntry{
|
// ManifestEntry{
|
||||||
// .version = 9228,
|
// .version = 9228,
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,55 @@
|
|||||||
|
#include "database_update.h"
|
||||||
|
|
||||||
|
std::vector<ManifestEntry> manifest_entries_custom = {
|
||||||
|
ManifestEntry{
|
||||||
|
.version = 1,
|
||||||
|
.description = "2025_05_16_new_database_check_test",
|
||||||
|
.check = "SHOW TABLES LIKE 'new_table'",
|
||||||
|
.condition = "empty",
|
||||||
|
.match = "",
|
||||||
|
.sql = R"(
|
||||||
|
CREATE TABLE `new_table` (
|
||||||
|
`id` int NOT NULL AUTO_INCREMENT,
|
||||||
|
PRIMARY KEY (`id`)
|
||||||
|
);
|
||||||
|
)",
|
||||||
|
.content_schema_update = false,
|
||||||
|
},
|
||||||
|
// Used for testing
|
||||||
|
// ManifestEntry{
|
||||||
|
// .version = 9229,
|
||||||
|
// .description = "new_database_check_test",
|
||||||
|
// .check = "SHOW TABLES LIKE 'new_table'",
|
||||||
|
// .condition = "empty",
|
||||||
|
// .match = "",
|
||||||
|
// .sql = R"(
|
||||||
|
//CREATE TABLE `new_table` (
|
||||||
|
// `id` int NOT NULL AUTO_INCREMENT,
|
||||||
|
// PRIMARY KEY (`id`)
|
||||||
|
//);
|
||||||
|
//CREATE TABLE `new_table1` (
|
||||||
|
// `id` int NOT NULL AUTO_INCREMENT,
|
||||||
|
// PRIMARY KEY (`id`)
|
||||||
|
//);
|
||||||
|
//CREATE TABLE `new_table2` (
|
||||||
|
// `id` int NOT NULL AUTO_INCREMENT,
|
||||||
|
// PRIMARY KEY (`id`)
|
||||||
|
//);
|
||||||
|
//CREATE TABLE `new_table3` (
|
||||||
|
// `id` int NOT NULL AUTO_INCREMENT,
|
||||||
|
// PRIMARY KEY (`id`)
|
||||||
|
//);
|
||||||
|
//)",
|
||||||
|
// }
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// see struct definitions for what each field does
|
||||||
|
// struct ManifestEntry {
|
||||||
|
// int version{}; // database version of the migration
|
||||||
|
// std::string description{}; // description of the migration ex: "add_new_table" or "add_index_to_table"
|
||||||
|
// std::string check{}; // query that checks against the condition
|
||||||
|
// std::string condition{}; // condition or "match_type" - Possible values [contains|match|missing|empty|not_empty]
|
||||||
|
// std::string match{}; // match field that is not always used, but works in conjunction with "condition" values [missing|match|contains]
|
||||||
|
// std::string sql{}; // the SQL DDL that gets ran when the condition is true
|
||||||
|
// };
|
||||||
@@ -30,8 +30,8 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|||||||
#include "../common/repositories/respawn_times_repository.h"
|
#include "../common/repositories/respawn_times_repository.h"
|
||||||
#include "../common/repositories/spawn_condition_values_repository.h"
|
#include "../common/repositories/spawn_condition_values_repository.h"
|
||||||
#include "repositories/spawn2_disabled_repository.h"
|
#include "repositories/spawn2_disabled_repository.h"
|
||||||
|
#include "repositories/data_buckets_repository.h"
|
||||||
|
#include "repositories/zone_state_spawns_repository.h"
|
||||||
#include "database.h"
|
#include "database.h"
|
||||||
|
|
||||||
#include <iomanip>
|
#include <iomanip>
|
||||||
@@ -128,11 +128,35 @@ bool Database::CreateInstance(uint16 instance_id, uint32 zone_id, uint32 version
|
|||||||
e.version = version;
|
e.version = version;
|
||||||
e.start_time = std::time(nullptr);
|
e.start_time = std::time(nullptr);
|
||||||
e.duration = duration;
|
e.duration = duration;
|
||||||
|
e.expire_at = e.start_time + duration;
|
||||||
|
|
||||||
return InstanceListRepository::InsertOne(*this, e).id;
|
RespawnTimesRepository::ClearInstanceTimers(*this, e.id);
|
||||||
|
InstanceListRepository::ReplaceOne(*this, e);
|
||||||
|
return instance_id > 0 && e.id;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Database::GetUnusedInstanceID(uint16 &instance_id)
|
bool Database::GetUnusedInstanceID(uint16 &instance_id)
|
||||||
|
{
|
||||||
|
// attempt to get an unused instance id
|
||||||
|
for (int a = 0; a < 10; a++) {
|
||||||
|
uint16 attempted_id = 0;
|
||||||
|
if (TryGetUnusedInstanceID(attempted_id)) {
|
||||||
|
auto i = InstanceListRepository::NewEntity();
|
||||||
|
i.id = attempted_id;
|
||||||
|
i.notes = "Prefetching";
|
||||||
|
auto n = InstanceListRepository::InsertOne(*this, i);
|
||||||
|
if (n.id > 0) {
|
||||||
|
instance_id = n.id;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
instance_id = 0;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Database::TryGetUnusedInstanceID(uint16 &instance_id)
|
||||||
{
|
{
|
||||||
uint32 max_reserved_instance_id = RuleI(Instances, ReservedInstances);
|
uint32 max_reserved_instance_id = RuleI(Instances, ReservedInstances);
|
||||||
uint32 max_instance_id = 32000;
|
uint32 max_instance_id = 32000;
|
||||||
@@ -479,6 +503,10 @@ void Database::DeleteInstance(uint16 instance_id)
|
|||||||
DynamicZoneMembersRepository::DeleteByInstance(*this, instance_id);
|
DynamicZoneMembersRepository::DeleteByInstance(*this, instance_id);
|
||||||
DynamicZonesRepository::DeleteWhere(*this, fmt::format("instance_id = {}", instance_id));
|
DynamicZonesRepository::DeleteWhere(*this, fmt::format("instance_id = {}", instance_id));
|
||||||
CharacterCorpsesRepository::BuryInstance(*this, instance_id);
|
CharacterCorpsesRepository::BuryInstance(*this, instance_id);
|
||||||
|
DataBucketsRepository::DeleteWhere(*this, fmt::format("instance_id = {}", instance_id));
|
||||||
|
if (RuleB(Zone, StateSavingOnShutdown)) {
|
||||||
|
ZoneStateSpawnsRepository::DeleteWhere(*this, fmt::format("`instance_id` = {}", instance_id));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::FlagInstanceByGroupLeader(uint32 zone_id, int16 version, uint32 character_id, uint32 group_id)
|
void Database::FlagInstanceByGroupLeader(uint32 zone_id, int16 version, uint32 character_id, uint32 group_id)
|
||||||
@@ -533,14 +561,12 @@ void Database::GetCharactersInInstance(uint16 instance_id, std::list<uint32> &ch
|
|||||||
|
|
||||||
void Database::PurgeExpiredInstances()
|
void Database::PurgeExpiredInstances()
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Delay purging by a day so that we can continue using adjacent free instance id's
|
|
||||||
* from the table without risking the chance we immediately re-allocate a zone that freshly expired but
|
|
||||||
* has not been fully de-allocated
|
|
||||||
*/
|
|
||||||
auto l = InstanceListRepository::GetWhere(
|
auto l = InstanceListRepository::GetWhere(
|
||||||
*this,
|
*this,
|
||||||
"(start_time + duration) <= (UNIX_TIMESTAMP() - 86400) AND never_expires = 0"
|
fmt::format(
|
||||||
|
"expire_at <= (UNIX_TIMESTAMP() - {}) and expire_at != 0 AND never_expires = 0",
|
||||||
|
RuleI(Instances, ExpireOffsetTimeSeconds)
|
||||||
|
)
|
||||||
);
|
);
|
||||||
if (l.empty()) {
|
if (l.empty()) {
|
||||||
return;
|
return;
|
||||||
@@ -551,16 +577,24 @@ void Database::PurgeExpiredInstances()
|
|||||||
instance_ids.emplace_back(std::to_string(e.id));
|
instance_ids.emplace_back(std::to_string(e.id));
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto imploded_instance_ids = Strings::Implode(",", instance_ids);
|
const auto ids = Strings::Implode(",", instance_ids);
|
||||||
|
|
||||||
InstanceListRepository::DeleteWhere(*this, fmt::format("id IN ({})", imploded_instance_ids));
|
TransactionBegin();
|
||||||
InstanceListPlayerRepository::DeleteWhere(*this, fmt::format("id IN ({})", imploded_instance_ids));
|
InstanceListRepository::DeleteWhere(*this, fmt::format("id IN ({})", ids));
|
||||||
RespawnTimesRepository::DeleteWhere(*this, fmt::format("instance_id IN ({})", imploded_instance_ids));
|
InstanceListPlayerRepository::DeleteWhere(*this, fmt::format("id IN ({})", ids));
|
||||||
SpawnConditionValuesRepository::DeleteWhere(*this, fmt::format("instance_id IN ({})", imploded_instance_ids));
|
RespawnTimesRepository::DeleteWhere(*this, fmt::format("instance_id IN ({})", ids));
|
||||||
CharacterCorpsesRepository::BuryInstances(*this, imploded_instance_ids);
|
SpawnConditionValuesRepository::DeleteWhere(*this, fmt::format("instance_id IN ({})", ids));
|
||||||
DynamicZoneMembersRepository::DeleteByManyInstances(*this, imploded_instance_ids);
|
CharacterCorpsesRepository::BuryInstances(*this, ids);
|
||||||
DynamicZonesRepository::DeleteWhere(*this, fmt::format("instance_id IN ({})", imploded_instance_ids));
|
DynamicZoneMembersRepository::DeleteByManyInstances(*this, ids);
|
||||||
Spawn2DisabledRepository::DeleteWhere(*this, fmt::format("instance_id IN ({})", imploded_instance_ids));
|
DynamicZonesRepository::DeleteWhere(*this, fmt::format("instance_id IN ({})", ids));
|
||||||
|
Spawn2DisabledRepository::DeleteWhere(*this, fmt::format("instance_id IN ({})", ids));
|
||||||
|
DataBucketsRepository::DeleteWhere(*this, fmt::format("instance_id != 0 and instance_id IN ({})", ids));
|
||||||
|
if (RuleB(Zone, StateSavingOnShutdown)) {
|
||||||
|
ZoneStateSpawnsRepository::DeleteWhere(*this, fmt::format("`instance_id` IN ({})", ids));
|
||||||
|
}
|
||||||
|
TransactionCommit();
|
||||||
|
|
||||||
|
LogInfo("Purged [{}] expired instances", l.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Database::SetInstanceDuration(uint16 instance_id, uint32 new_duration)
|
void Database::SetInstanceDuration(uint16 instance_id, uint32 new_duration)
|
||||||
@@ -572,6 +606,7 @@ void Database::SetInstanceDuration(uint16 instance_id, uint32 new_duration)
|
|||||||
|
|
||||||
i.start_time = std::time(nullptr);
|
i.start_time = std::time(nullptr);
|
||||||
i.duration = new_duration;
|
i.duration = new_duration;
|
||||||
|
i.expire_at = i.start_time + i.duration;
|
||||||
|
|
||||||
InstanceListRepository::UpdateOne(*this, i);
|
InstanceListRepository::UpdateOne(*this, i);
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-29
@@ -80,7 +80,7 @@ namespace DatabaseSchema {
|
|||||||
{"guild_members", "char_id"},
|
{"guild_members", "char_id"},
|
||||||
{"guilds", "id"},
|
{"guilds", "id"},
|
||||||
{"instance_list_player", "id"},
|
{"instance_list_player", "id"},
|
||||||
{"inventory", "charid"},
|
{"inventory", "character_id"},
|
||||||
{"inventory_snapshots", "charid"},
|
{"inventory_snapshots", "charid"},
|
||||||
{"keyring", "char_id"},
|
{"keyring", "char_id"},
|
||||||
{"mail", "charid"},
|
{"mail", "charid"},
|
||||||
@@ -139,6 +139,7 @@ namespace DatabaseSchema {
|
|||||||
"character_pet_buffs",
|
"character_pet_buffs",
|
||||||
"character_pet_info",
|
"character_pet_info",
|
||||||
"character_pet_inventory",
|
"character_pet_inventory",
|
||||||
|
"character_pet_name",
|
||||||
"character_peqzone_flags",
|
"character_peqzone_flags",
|
||||||
"character_potionbelt",
|
"character_potionbelt",
|
||||||
"character_skills",
|
"character_skills",
|
||||||
@@ -291,32 +292,6 @@ namespace DatabaseSchema {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets QueryServer tables
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
static std::vector<std::string> GetQueryServerTables()
|
|
||||||
{
|
|
||||||
return {
|
|
||||||
"qs_merchant_transaction_record",
|
|
||||||
"qs_merchant_transaction_record_entries",
|
|
||||||
"qs_player_aa_rate_hourly",
|
|
||||||
"qs_player_delete_record",
|
|
||||||
"qs_player_delete_record_entries",
|
|
||||||
"qs_player_events",
|
|
||||||
"qs_player_handin_record",
|
|
||||||
"qs_player_handin_record_entries",
|
|
||||||
"qs_player_move_record",
|
|
||||||
"qs_player_move_record_entries",
|
|
||||||
"qs_player_npc_kill_record",
|
|
||||||
"qs_player_npc_kill_record_entries",
|
|
||||||
"qs_player_speech",
|
|
||||||
"qs_player_trade_record",
|
|
||||||
"qs_player_trade_record_entries",
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets state tables
|
* Gets state tables
|
||||||
* Tables that keep track of server state
|
* Tables that keep track of server state
|
||||||
@@ -337,10 +312,9 @@ namespace DatabaseSchema {
|
|||||||
"completed_shared_task_members",
|
"completed_shared_task_members",
|
||||||
"completed_shared_tasks",
|
"completed_shared_tasks",
|
||||||
"discord_webhooks",
|
"discord_webhooks",
|
||||||
|
"dynamic_zone_lockouts",
|
||||||
"dynamic_zone_members",
|
"dynamic_zone_members",
|
||||||
"dynamic_zones",
|
"dynamic_zones",
|
||||||
"expedition_lockouts",
|
|
||||||
"expeditions",
|
|
||||||
"gm_ips",
|
"gm_ips",
|
||||||
"group_id",
|
"group_id",
|
||||||
"group_leaders",
|
"group_leaders",
|
||||||
@@ -359,12 +333,25 @@ namespace DatabaseSchema {
|
|||||||
"saylink",
|
"saylink",
|
||||||
"server_scheduled_events",
|
"server_scheduled_events",
|
||||||
"spawn2_disabled",
|
"spawn2_disabled",
|
||||||
|
"player_event_aa_purchase",
|
||||||
|
"player_event_killed_npc",
|
||||||
|
"player_event_killed_named_npc",
|
||||||
|
"player_event_killed_raid_npc",
|
||||||
"player_event_log_settings",
|
"player_event_log_settings",
|
||||||
"player_event_logs",
|
"player_event_logs",
|
||||||
|
"player_event_loot_items",
|
||||||
|
"player_event_merchant_purchase",
|
||||||
|
"player_event_merchant_sell",
|
||||||
|
"player_event_npc_handin",
|
||||||
|
"player_event_npc_handin_entries",
|
||||||
|
"player_event_speech",
|
||||||
|
"player_event_trade",
|
||||||
|
"player_event_trade_entries",
|
||||||
"shared_task_activity_state",
|
"shared_task_activity_state",
|
||||||
"shared_task_dynamic_zones",
|
"shared_task_dynamic_zones",
|
||||||
"shared_task_members",
|
"shared_task_members",
|
||||||
"shared_tasks",
|
"shared_tasks",
|
||||||
|
"zone_state_spawns",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -406,6 +393,7 @@ namespace DatabaseSchema {
|
|||||||
static std::vector<std::string> GetBotTables()
|
static std::vector<std::string> GetBotTables()
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
|
"bot_blocked_buffs",
|
||||||
"bot_buffs",
|
"bot_buffs",
|
||||||
"bot_command_settings",
|
"bot_command_settings",
|
||||||
"bot_create_combinations",
|
"bot_create_combinations",
|
||||||
@@ -419,6 +407,7 @@ namespace DatabaseSchema {
|
|||||||
"bot_pet_buffs",
|
"bot_pet_buffs",
|
||||||
"bot_pet_inventories",
|
"bot_pet_inventories",
|
||||||
"bot_pets",
|
"bot_pets",
|
||||||
|
"bot_settings",
|
||||||
"bot_spell_casting_chances",
|
"bot_spell_casting_chances",
|
||||||
"bot_spell_settings",
|
"bot_spell_settings",
|
||||||
"bot_spells_entries",
|
"bot_spells_entries",
|
||||||
|
|||||||
+5
-3
@@ -160,7 +160,7 @@ MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, boo
|
|||||||
(uint32) mysql_insert_id(mysql)
|
(uint32) mysql_insert_id(mysql)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (LogSys.log_settings[Logs::MySQLQuery].is_category_enabled == 1) {
|
if (EQEmuLogSys::Instance()->log_settings[Logs::MySQLQuery].is_category_enabled == 1) {
|
||||||
if ((strncasecmp(query, "select", 6) == 0)) {
|
if ((strncasecmp(query, "select", 6) == 0)) {
|
||||||
LogMySQLQuery(
|
LogMySQLQuery(
|
||||||
"{0} -- ({1} row{2} returned) ({3}s)",
|
"{0} -- ({1} row{2} returned) ({3}s)",
|
||||||
@@ -189,9 +189,9 @@ void DBcore::TransactionBegin()
|
|||||||
QueryDatabase("START TRANSACTION");
|
QueryDatabase("START TRANSACTION");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DBcore::TransactionCommit()
|
MySQLRequestResult DBcore::TransactionCommit()
|
||||||
{
|
{
|
||||||
QueryDatabase("COMMIT");
|
return QueryDatabase("COMMIT");
|
||||||
}
|
}
|
||||||
|
|
||||||
void DBcore::TransactionRollback()
|
void DBcore::TransactionRollback()
|
||||||
@@ -302,7 +302,9 @@ std::string DBcore::Escape(const std::string& s)
|
|||||||
|
|
||||||
void DBcore::SetMutex(Mutex *mutex)
|
void DBcore::SetMutex(Mutex *mutex)
|
||||||
{
|
{
|
||||||
|
if (m_mutex && m_mutex != mutex) {
|
||||||
safe_delete(m_mutex);
|
safe_delete(m_mutex);
|
||||||
|
}
|
||||||
|
|
||||||
DBcore::m_mutex = mutex;
|
DBcore::m_mutex = mutex;
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -32,7 +32,7 @@ public:
|
|||||||
MySQLRequestResult QueryDatabase(const std::string& query, bool retryOnFailureOnce = true);
|
MySQLRequestResult QueryDatabase(const std::string& query, bool retryOnFailureOnce = true);
|
||||||
MySQLRequestResult QueryDatabaseMulti(const std::string &query);
|
MySQLRequestResult QueryDatabaseMulti(const std::string &query);
|
||||||
void TransactionBegin();
|
void TransactionBegin();
|
||||||
void TransactionCommit();
|
MySQLRequestResult TransactionCommit();
|
||||||
void TransactionRollback();
|
void TransactionRollback();
|
||||||
std::string Escape(const std::string& s);
|
std::string Escape(const std::string& s);
|
||||||
uint32 DoEscapeString(char *tobuf, const char *frombuf, uint32 fromlen);
|
uint32 DoEscapeString(char *tobuf, const char *frombuf, uint32 fromlen);
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include "../types.h"
|
#include "../types.h"
|
||||||
#include "../http/httplib.h"
|
|
||||||
#include "../repositories/player_event_logs_repository.h"
|
#include "../repositories/player_event_logs_repository.h"
|
||||||
#include "../events/player_events.h"
|
#include "../events/player_events.h"
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ void DiscordManager::ProcessMessageQueue()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto webhook = LogSys.GetDiscordWebhooks()[q.first];
|
auto webhook = EQEmuLogSys::Instance()->GetDiscordWebhooks()[q.first];
|
||||||
std::string message;
|
std::string message;
|
||||||
|
|
||||||
for (auto &m: q.second) {
|
for (auto &m: q.second) {
|
||||||
@@ -68,7 +68,7 @@ void DiscordManager::ProcessMessageQueue()
|
|||||||
|
|
||||||
void DiscordManager::QueuePlayerEventMessage(const PlayerEvent::PlayerEventContainer& e)
|
void DiscordManager::QueuePlayerEventMessage(const PlayerEvent::PlayerEventContainer& e)
|
||||||
{
|
{
|
||||||
auto w = player_event_logs.GetDiscordWebhookUrlFromEventType(e.player_event_log.event_type_id);
|
auto w = PlayerEventLogs::Instance()->GetDiscordWebhookUrlFromEventType(e.player_event_log.event_type_id);
|
||||||
if (!w.empty()) {
|
if (!w.empty()) {
|
||||||
Discord::SendPlayerEventMessage(e, w);
|
Discord::SendPlayerEventMessage(e, w);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ public:
|
|||||||
void QueueWebhookMessage(uint32 webhook_id, const std::string& message);
|
void QueueWebhookMessage(uint32 webhook_id, const std::string& message);
|
||||||
void ProcessMessageQueue();
|
void ProcessMessageQueue();
|
||||||
void QueuePlayerEventMessage(const PlayerEvent::PlayerEventContainer& e);
|
void QueuePlayerEventMessage(const PlayerEvent::PlayerEventContainer& e);
|
||||||
|
|
||||||
|
static DiscordManager* Instance()
|
||||||
|
{
|
||||||
|
static DiscordManager instance;
|
||||||
|
return &instance;
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
std::mutex webhook_queue_lock{};
|
std::mutex webhook_queue_lock{};
|
||||||
std::map<uint32, std::vector<std::string>> webhook_message_queue{};
|
std::map<uint32, std::vector<std::string>> webhook_message_queue{};
|
||||||
|
|||||||
+297
-67
@@ -1,11 +1,13 @@
|
|||||||
#include "dynamic_zone_base.h"
|
#include "dynamic_zone_base.h"
|
||||||
#include "database.h"
|
#include "database.h"
|
||||||
#include "eqemu_logsys.h"
|
#include "eqemu_logsys.h"
|
||||||
#include "repositories/instance_list_repository.h"
|
|
||||||
#include "repositories/instance_list_player_repository.h"
|
|
||||||
#include "rulesys.h"
|
#include "rulesys.h"
|
||||||
#include "servertalk.h"
|
#include "servertalk.h"
|
||||||
#include "util/uuid.h"
|
#include "util/uuid.h"
|
||||||
|
#include "repositories/character_expedition_lockouts_repository.h"
|
||||||
|
#include "repositories/dynamic_zone_lockouts_repository.h"
|
||||||
|
#include "repositories/instance_list_repository.h"
|
||||||
|
#include "repositories/instance_list_player_repository.h"
|
||||||
|
|
||||||
DynamicZoneBase::DynamicZoneBase(DynamicZonesRepository::DynamicZoneInstance&& entry)
|
DynamicZoneBase::DynamicZoneBase(DynamicZonesRepository::DynamicZoneInstance&& entry)
|
||||||
{
|
{
|
||||||
@@ -56,15 +58,16 @@ uint32_t DynamicZoneBase::CreateInstance()
|
|||||||
insert_instance.start_time = static_cast<int>(std::chrono::system_clock::to_time_t(m_start_time));
|
insert_instance.start_time = static_cast<int>(std::chrono::system_clock::to_time_t(m_start_time));
|
||||||
insert_instance.duration = static_cast<int>(m_duration.count());
|
insert_instance.duration = static_cast<int>(m_duration.count());
|
||||||
insert_instance.never_expires = m_never_expires;
|
insert_instance.never_expires = m_never_expires;
|
||||||
|
insert_instance.expire_at = insert_instance.start_time + insert_instance.duration;
|
||||||
|
|
||||||
auto instance = InstanceListRepository::InsertOne(GetDatabase(), insert_instance);
|
auto instance = InstanceListRepository::ReplaceOne(GetDatabase(), insert_instance);
|
||||||
if (instance.id == 0)
|
if (!instance)
|
||||||
{
|
{
|
||||||
LogDynamicZones("Failed to create instance [{}] for zone [{}]", unused_instance_id, m_zone_id);
|
LogDynamicZones("Failed to create instance [{}] for zone [{}]", unused_instance_id, m_zone_id);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_instance_id = instance.id;
|
m_instance_id = unused_instance_id;
|
||||||
|
|
||||||
return m_instance_id;
|
return m_instance_id;
|
||||||
}
|
}
|
||||||
@@ -93,13 +96,15 @@ void DynamicZoneBase::LoadRepositoryResult(DynamicZonesRepository::DynamicZoneIn
|
|||||||
m_zonein.y = dz_entry.zone_in_y;
|
m_zonein.y = dz_entry.zone_in_y;
|
||||||
m_zonein.z = dz_entry.zone_in_z;
|
m_zonein.z = dz_entry.zone_in_z;
|
||||||
m_zonein.heading = dz_entry.zone_in_heading;
|
m_zonein.heading = dz_entry.zone_in_heading;
|
||||||
m_has_zonein = (dz_entry.has_zone_in != 0);
|
m_has_zonein = dz_entry.has_zone_in != 0;
|
||||||
|
m_is_locked = dz_entry.is_locked;
|
||||||
|
m_add_replay = dz_entry.add_replay;
|
||||||
// instance_list portion
|
// instance_list portion
|
||||||
m_zone_id = dz_entry.zone;
|
m_zone_id = dz_entry.zone;
|
||||||
m_zone_version = dz_entry.version;
|
m_zone_version = dz_entry.version;
|
||||||
m_start_time = std::chrono::system_clock::from_time_t(dz_entry.start_time);
|
m_start_time = std::chrono::system_clock::from_time_t(dz_entry.start_time);
|
||||||
m_duration = std::chrono::seconds(dz_entry.duration);
|
m_duration = std::chrono::seconds(dz_entry.duration);
|
||||||
m_never_expires = (dz_entry.never_expires != 0);
|
m_never_expires = dz_entry.never_expires != 0;
|
||||||
m_expire_time = m_start_time + m_duration;
|
m_expire_time = m_start_time + m_duration;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,39 +124,42 @@ void DynamicZoneBase::AddMemberFromRepositoryResult(
|
|||||||
uint32_t DynamicZoneBase::SaveToDatabase()
|
uint32_t DynamicZoneBase::SaveToDatabase()
|
||||||
{
|
{
|
||||||
LogDynamicZonesDetail("Saving dz instance [{}] to database", m_instance_id);
|
LogDynamicZonesDetail("Saving dz instance [{}] to database", m_instance_id);
|
||||||
|
if (m_instance_id == 0)
|
||||||
if (m_instance_id != 0)
|
|
||||||
{
|
{
|
||||||
auto insert_dz = DynamicZonesRepository::NewEntity();
|
|
||||||
insert_dz.uuid = m_uuid;
|
|
||||||
insert_dz.name = m_name;
|
|
||||||
insert_dz.leader_id = m_leader.id;
|
|
||||||
insert_dz.min_players = m_min_players;
|
|
||||||
insert_dz.max_players = m_max_players;
|
|
||||||
insert_dz.instance_id = m_instance_id,
|
|
||||||
insert_dz.type = static_cast<int>(m_type);
|
|
||||||
insert_dz.dz_switch_id = m_dz_switch_id;
|
|
||||||
insert_dz.compass_zone_id = m_compass.zone_id;
|
|
||||||
insert_dz.compass_x = m_compass.x;
|
|
||||||
insert_dz.compass_y = m_compass.y;
|
|
||||||
insert_dz.compass_z = m_compass.z;
|
|
||||||
insert_dz.safe_return_zone_id = m_safereturn.zone_id;
|
|
||||||
insert_dz.safe_return_x = m_safereturn.x;
|
|
||||||
insert_dz.safe_return_y = m_safereturn.y;
|
|
||||||
insert_dz.safe_return_z = m_safereturn.z;
|
|
||||||
insert_dz.safe_return_heading = m_safereturn.heading;
|
|
||||||
insert_dz.zone_in_x = m_zonein.x;
|
|
||||||
insert_dz.zone_in_y = m_zonein.y;
|
|
||||||
insert_dz.zone_in_z = m_zonein.z;
|
|
||||||
insert_dz.zone_in_heading = m_zonein.heading;
|
|
||||||
insert_dz.has_zone_in = m_has_zonein;
|
|
||||||
|
|
||||||
auto inserted_dz = DynamicZonesRepository::InsertOne(GetDatabase(), insert_dz);
|
|
||||||
return inserted_dz.id;
|
|
||||||
}
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto dz = DynamicZonesRepository::NewEntity();
|
||||||
|
dz.uuid = m_uuid;
|
||||||
|
dz.name = m_name;
|
||||||
|
dz.leader_id = m_leader.id;
|
||||||
|
dz.min_players = m_min_players;
|
||||||
|
dz.max_players = m_max_players;
|
||||||
|
dz.instance_id = static_cast<int32_t>(m_instance_id),
|
||||||
|
dz.type = static_cast<uint8_t>(m_type);
|
||||||
|
dz.dz_switch_id = m_dz_switch_id;
|
||||||
|
dz.compass_zone_id = m_compass.zone_id;
|
||||||
|
dz.compass_x = m_compass.x;
|
||||||
|
dz.compass_y = m_compass.y;
|
||||||
|
dz.compass_z = m_compass.z;
|
||||||
|
dz.safe_return_zone_id = m_safereturn.zone_id;
|
||||||
|
dz.safe_return_x = m_safereturn.x;
|
||||||
|
dz.safe_return_y = m_safereturn.y;
|
||||||
|
dz.safe_return_z = m_safereturn.z;
|
||||||
|
dz.safe_return_heading = m_safereturn.heading;
|
||||||
|
dz.zone_in_x = m_zonein.x;
|
||||||
|
dz.zone_in_y = m_zonein.y;
|
||||||
|
dz.zone_in_z = m_zonein.z;
|
||||||
|
dz.zone_in_heading = m_zonein.heading;
|
||||||
|
dz.has_zone_in = static_cast<uint8_t>(m_has_zonein);
|
||||||
|
dz.is_locked = static_cast<int8_t>(m_is_locked);
|
||||||
|
dz.add_replay = static_cast<int8_t>(m_add_replay);
|
||||||
|
|
||||||
|
dz = DynamicZonesRepository::InsertOne(GetDatabase(), std::move(dz));
|
||||||
|
|
||||||
|
return dz.id;
|
||||||
|
}
|
||||||
|
|
||||||
bool DynamicZoneBase::AddMember(const DynamicZoneMember& add_member)
|
bool DynamicZoneBase::AddMember(const DynamicZoneMember& add_member)
|
||||||
{
|
{
|
||||||
if (HasMember(add_member.id))
|
if (HasMember(add_member.id))
|
||||||
@@ -196,10 +204,9 @@ bool DynamicZoneBase::RemoveMember(const DynamicZoneMember& remove_member)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DynamicZoneBase::SwapMember(
|
bool DynamicZoneBase::SwapMember(const DynamicZoneMember& add_member, const std::string& remove_name)
|
||||||
const DynamicZoneMember& add_member, const std::string& remove_char_name)
|
|
||||||
{
|
{
|
||||||
auto remove_member = GetMemberData(remove_char_name);
|
auto remove_member = GetMemberData(remove_name);
|
||||||
if (!add_member.IsValid() || !remove_member.IsValid())
|
if (!add_member.IsValid() || !remove_member.IsValid())
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
@@ -230,9 +237,18 @@ void DynamicZoneBase::RemoveAllMembers()
|
|||||||
|
|
||||||
void DynamicZoneBase::SaveMembers(const std::vector<DynamicZoneMember>& members)
|
void DynamicZoneBase::SaveMembers(const std::vector<DynamicZoneMember>& members)
|
||||||
{
|
{
|
||||||
|
if (members.empty())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
LogDynamicZonesDetail("Saving [{}] member(s) for dz [{}]", members.size(), m_id);
|
LogDynamicZonesDetail("Saving [{}] member(s) for dz [{}]", members.size(), m_id);
|
||||||
|
|
||||||
m_members = members;
|
m_members = members;
|
||||||
|
if (m_members.size() > m_max_players)
|
||||||
|
{
|
||||||
|
m_members.resize(m_max_players);
|
||||||
|
}
|
||||||
|
|
||||||
// the lower level instance_list_players needs to be kept updated as well
|
// the lower level instance_list_players needs to be kept updated as well
|
||||||
std::vector<DynamicZoneMembersRepository::DynamicZoneMembers> insert_members;
|
std::vector<DynamicZoneMembersRepository::DynamicZoneMembers> insert_members;
|
||||||
@@ -242,12 +258,12 @@ void DynamicZoneBase::SaveMembers(const std::vector<DynamicZoneMember>& members)
|
|||||||
DynamicZoneMembersRepository::DynamicZoneMembers member_entry{};
|
DynamicZoneMembersRepository::DynamicZoneMembers member_entry{};
|
||||||
member_entry.dynamic_zone_id = m_id;
|
member_entry.dynamic_zone_id = m_id;
|
||||||
member_entry.character_id = member.id;
|
member_entry.character_id = member.id;
|
||||||
insert_members.emplace_back(member_entry);
|
insert_members.push_back(member_entry);
|
||||||
|
|
||||||
InstanceListPlayerRepository::InstanceListPlayer player_entry;
|
InstanceListPlayerRepository::InstanceListPlayer player_entry{};
|
||||||
player_entry.id = static_cast<int>(m_instance_id);
|
player_entry.id = m_instance_id;
|
||||||
player_entry.charid = static_cast<int>(member.id);
|
player_entry.charid = member.id;
|
||||||
insert_players.emplace_back(player_entry);
|
insert_players.push_back(player_entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
DynamicZoneMembersRepository::InsertOrUpdateMany(GetDatabase(), insert_members);
|
DynamicZoneMembersRepository::InsertOrUpdateMany(GetDatabase(), insert_members);
|
||||||
@@ -339,6 +355,44 @@ void DynamicZoneBase::SetLeader(const DynamicZoneMember& new_leader, bool update
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DynamicZoneBase::SetLocked(bool lock, bool update_db, DzLockMsg lock_msg, uint32_t color)
|
||||||
|
{
|
||||||
|
m_is_locked = lock;
|
||||||
|
|
||||||
|
if (update_db)
|
||||||
|
{
|
||||||
|
DynamicZonesRepository::UpdateLocked(GetDatabase(), m_id, lock);
|
||||||
|
|
||||||
|
ServerPacket pack(ServerOP_DzLock, sizeof(ServerDzLock_Struct));
|
||||||
|
auto buf = reinterpret_cast<ServerDzLock_Struct*>(pack.pBuffer);
|
||||||
|
buf->dz_id = GetID();
|
||||||
|
buf->sender_zone_id = GetCurrentZoneID();
|
||||||
|
buf->sender_instance_id = GetCurrentInstanceID();
|
||||||
|
buf->lock = m_is_locked;
|
||||||
|
buf->lock_msg = static_cast<uint8_t>(lock_msg);
|
||||||
|
buf->color = color;
|
||||||
|
SendServerPacket(&pack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DynamicZoneBase::SetReplayOnJoin(bool enabled, bool update_db)
|
||||||
|
{
|
||||||
|
m_add_replay = enabled;
|
||||||
|
|
||||||
|
if (update_db)
|
||||||
|
{
|
||||||
|
DynamicZonesRepository::UpdateReplayOnJoin(GetDatabase(), m_id, enabled);
|
||||||
|
|
||||||
|
ServerPacket pack(ServerOP_DzReplayOnJoin, sizeof(ServerDzBool_Struct));
|
||||||
|
auto buf = reinterpret_cast<ServerDzBool_Struct*>(pack.pBuffer);
|
||||||
|
buf->dz_id = GetID();
|
||||||
|
buf->sender_zone_id = GetCurrentZoneID();
|
||||||
|
buf->sender_instance_id = GetCurrentInstanceID();
|
||||||
|
buf->enabled = enabled;
|
||||||
|
SendServerPacket(&pack);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t DynamicZoneBase::GetSecondsRemaining() const
|
uint32_t DynamicZoneBase::GetSecondsRemaining() const
|
||||||
{
|
{
|
||||||
auto remaining = std::chrono::duration_cast<std::chrono::seconds>(GetDurationRemaining()).count();
|
auto remaining = std::chrono::duration_cast<std::chrono::seconds>(GetDurationRemaining()).count();
|
||||||
@@ -478,13 +532,13 @@ void DynamicZoneBase::RemoveInternalMember(uint32_t character_id)
|
|||||||
), m_members.end());
|
), m_members.end());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DynamicZoneBase::HasMember(uint32_t character_id)
|
bool DynamicZoneBase::HasMember(uint32_t character_id) const
|
||||||
{
|
{
|
||||||
return std::any_of(m_members.begin(), m_members.end(),
|
return std::any_of(m_members.begin(), m_members.end(),
|
||||||
[&](const DynamicZoneMember& member) { return member.id == character_id; });
|
[&](const DynamicZoneMember& member) { return member.id == character_id; });
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DynamicZoneBase::HasMember(const std::string& character_name)
|
bool DynamicZoneBase::HasMember(const std::string& character_name) const
|
||||||
{
|
{
|
||||||
return std::any_of(m_members.begin(), m_members.end(),
|
return std::any_of(m_members.begin(), m_members.end(),
|
||||||
[&](const DynamicZoneMember& member) {
|
[&](const DynamicZoneMember& member) {
|
||||||
@@ -590,35 +644,34 @@ std::string DynamicZoneBase::GetDynamicZoneTypeName(DynamicZoneType dz_type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EQ::Net::DynamicPacket DynamicZoneBase::GetSerializedDzPacket()
|
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerPacket(uint16_t zone_id, uint16_t instance_id)
|
||||||
{
|
{
|
||||||
EQ::Net::DynamicPacket dyn_pack;
|
std::ostringstream ss = GetSerialized();
|
||||||
dyn_pack.PutSerialize(0, *this);
|
std::string_view sv = ss.view();
|
||||||
|
|
||||||
LogDynamicZonesDetail("Serialized server dz size [{}]", dyn_pack.Length());
|
auto pack_size = sizeof(ServerDzCreate_Struct) + sv.size();
|
||||||
return dyn_pack;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateServerDzCreatePacket(
|
|
||||||
uint16_t origin_zone_id, uint16_t origin_instance_id)
|
|
||||||
{
|
|
||||||
EQ::Net::DynamicPacket dyn_pack = GetSerializedDzPacket();
|
|
||||||
|
|
||||||
auto pack_size = sizeof(ServerDzCreateSerialized_Struct) + dyn_pack.Length();
|
|
||||||
auto pack = std::make_unique<ServerPacket>(ServerOP_DzCreated, static_cast<uint32_t>(pack_size));
|
auto pack = std::make_unique<ServerPacket>(ServerOP_DzCreated, static_cast<uint32_t>(pack_size));
|
||||||
auto buf = reinterpret_cast<ServerDzCreateSerialized_Struct*>(pack->pBuffer);
|
auto buf = reinterpret_cast<ServerDzCreate_Struct*>(pack->pBuffer);
|
||||||
buf->origin_zone_id = origin_zone_id;
|
buf->origin_zone_id = zone_id;
|
||||||
buf->origin_instance_id = origin_instance_id;
|
buf->origin_instance_id = instance_id;
|
||||||
buf->cereal_size = static_cast<uint32_t>(dyn_pack.Length());
|
buf->dz_id = GetID();
|
||||||
memcpy(buf->cereal_data, dyn_pack.Data(), dyn_pack.Length());
|
buf->cereal_size = static_cast<uint32_t>(sv.size());
|
||||||
|
memcpy(buf->cereal_data, sv.data(), sv.size());
|
||||||
|
|
||||||
return pack;
|
return pack;
|
||||||
}
|
}
|
||||||
|
|
||||||
void DynamicZoneBase::LoadSerializedDzPacket(char* cereal_data, uint32_t cereal_size)
|
std::ostringstream DynamicZoneBase::GetSerialized()
|
||||||
{
|
{
|
||||||
LogDynamicZonesDetail("Deserializing server dz size [{}]", cereal_size);
|
std::ostringstream ss;
|
||||||
EQ::Util::MemoryStreamReader ss(cereal_data, cereal_size);
|
cereal::BinaryOutputArchive archive(ss);
|
||||||
|
archive(*this);
|
||||||
|
return ss;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DynamicZoneBase::Unserialize(std::span<char> buf)
|
||||||
|
{
|
||||||
|
EQ::Util::MemoryStreamReader ss(buf.data(), buf.size());
|
||||||
cereal::BinaryInputArchive archive(ss);
|
cereal::BinaryInputArchive archive(ss);
|
||||||
archive(*this);
|
archive(*this);
|
||||||
}
|
}
|
||||||
@@ -647,3 +700,180 @@ void DynamicZoneBase::LoadTemplate(const DynamicZoneTemplatesRepository::Dynamic
|
|||||||
m_zonein.z = dz_template.zone_in_z;
|
m_zonein.z = dz_template.zone_in_z;
|
||||||
m_zonein.heading = dz_template.zone_in_h;
|
m_zonein.heading = dz_template.zone_in_h;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<uint32_t> DynamicZoneBase::GetMemberIds()
|
||||||
|
{
|
||||||
|
std::vector<uint32_t> ids;
|
||||||
|
ids.reserve(m_members.size());
|
||||||
|
for (const auto& member : m_members)
|
||||||
|
{
|
||||||
|
ids.push_back(member.id);
|
||||||
|
}
|
||||||
|
return ids;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DynamicZoneBase::HasLockout(const std::string& event)
|
||||||
|
{
|
||||||
|
return std::ranges::any_of(m_lockouts, [&](const auto& l) { return l.IsEvent(event); });
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DynamicZoneBase::HasReplayLockout()
|
||||||
|
{
|
||||||
|
return HasLockout(DzLockout::ReplayTimer);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DynamicZoneBase::AddLockout(const std::string& event, uint32_t seconds)
|
||||||
|
{
|
||||||
|
auto lockout = DzLockout::Create(m_name, event, seconds, m_uuid);
|
||||||
|
AddLockout(lockout);
|
||||||
|
}
|
||||||
|
|
||||||
|
void DynamicZoneBase::AddLockout(const DzLockout& lockout, bool members_only)
|
||||||
|
{
|
||||||
|
if (!members_only)
|
||||||
|
{
|
||||||
|
DynamicZoneLockoutsRepository::InsertLockouts(GetDatabase(), GetID(), { lockout });
|
||||||
|
}
|
||||||
|
|
||||||
|
CharacterExpeditionLockoutsRepository::InsertLockout(GetDatabase(), GetMemberIds(), lockout);
|
||||||
|
|
||||||
|
HandleLockoutUpdate(lockout, false, members_only);
|
||||||
|
SendServerPacket(CreateLockoutPacket(lockout, false, members_only).get());
|
||||||
|
}
|
||||||
|
|
||||||
|
void DynamicZoneBase::AddLockoutDuration(const std::string& event, int seconds, bool members_only)
|
||||||
|
{
|
||||||
|
auto lockout = DzLockout::Create(m_name, event, std::max(0, seconds), m_uuid);
|
||||||
|
|
||||||
|
// lockout has unsigned duration, pass original seconds to support reducing existing timers
|
||||||
|
int secs = static_cast<int>(seconds * RuleR(Expedition, LockoutDurationMultiplier));
|
||||||
|
CharacterExpeditionLockoutsRepository::AddLockoutDuration(GetDatabase(), GetMemberIds(), lockout, secs);
|
||||||
|
|
||||||
|
HandleLockoutDuration(lockout, seconds, members_only, true);
|
||||||
|
SendServerPacket(CreateLockoutDurationPacket(lockout, seconds, members_only).get());
|
||||||
|
}
|
||||||
|
|
||||||
|
void DynamicZoneBase::UpdateLockoutDuration(const std::string& event, uint32_t seconds, bool members_only)
|
||||||
|
{
|
||||||
|
// some live expeditions update existing lockout timers during progression
|
||||||
|
auto it = std::ranges::find_if(m_lockouts, [&](const auto& l) { return l.IsEvent(event); });
|
||||||
|
if (it != m_lockouts.end())
|
||||||
|
{
|
||||||
|
seconds = static_cast<uint32_t>(seconds * RuleR(Expedition, LockoutDurationMultiplier));
|
||||||
|
DzLockout lockout(m_uuid, m_name, event, it->GetStartTime() + seconds, seconds);
|
||||||
|
AddLockout(lockout, members_only);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DynamicZoneBase::RemoveLockout(const std::string& event)
|
||||||
|
{
|
||||||
|
DynamicZoneLockoutsRepository::DeleteWhere(GetDatabase(), fmt::format(
|
||||||
|
"dynamic_zone_id = {} AND event_name = '{}'", GetID(), Strings::Escape(event)));
|
||||||
|
|
||||||
|
CharacterExpeditionLockoutsRepository::DeleteWhere(GetDatabase(), fmt::format(
|
||||||
|
"character_id IN ({}) AND expedition_name = '{}' AND event_name = '{}'",
|
||||||
|
fmt::join(GetMemberIds(), ","), Strings::Escape(m_name), Strings::Escape(event)));
|
||||||
|
|
||||||
|
DzLockout lockout{m_uuid, m_name, event, 0, 0};
|
||||||
|
HandleLockoutUpdate(lockout, true, false);
|
||||||
|
SendServerPacket(CreateLockoutPacket(lockout, true).get());
|
||||||
|
}
|
||||||
|
|
||||||
|
void DynamicZoneBase::HandleLockoutUpdate(const DzLockout& lockout, bool remove, bool members_only)
|
||||||
|
{
|
||||||
|
if (!members_only)
|
||||||
|
{
|
||||||
|
std::erase_if(m_lockouts, [&](const auto& l) { return l.IsEvent(lockout.Event()); });
|
||||||
|
if (!remove)
|
||||||
|
{
|
||||||
|
m_lockouts.push_back(lockout);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DynamicZoneBase::HandleLockoutDuration(const DzLockout& lockout, int seconds, bool members_only, bool insert_db)
|
||||||
|
{
|
||||||
|
if (!members_only)
|
||||||
|
{
|
||||||
|
auto it = std::ranges::find_if(m_lockouts, [&](const auto& l) { return l.IsEvent(lockout.Event()); });
|
||||||
|
if (it != m_lockouts.end())
|
||||||
|
{
|
||||||
|
it->AddLockoutTime(seconds);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
it = m_lockouts.insert(m_lockouts.end(), lockout);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (insert_db)
|
||||||
|
{
|
||||||
|
DynamicZoneLockoutsRepository::InsertLockouts(GetDatabase(), GetID(), { *it });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateLockoutPacket(const DzLockout& lockout, bool remove, bool members_only) const
|
||||||
|
{
|
||||||
|
uint32_t pack_size = sizeof(ServerDzLockout_Struct);
|
||||||
|
auto pack = std::make_unique<ServerPacket>(ServerOP_DzLockout, pack_size);
|
||||||
|
auto buf = reinterpret_cast<ServerDzLockout_Struct*>(pack->pBuffer);
|
||||||
|
buf->dz_id = GetID();
|
||||||
|
buf->expire_time = lockout.GetExpireTime();
|
||||||
|
buf->duration = lockout.GetDuration();
|
||||||
|
buf->sender_zone_id = GetCurrentZoneID();
|
||||||
|
buf->sender_instance_id = GetCurrentInstanceID();
|
||||||
|
buf->remove = remove;
|
||||||
|
buf->members_only = members_only;
|
||||||
|
strn0cpy(buf->event_name, lockout.Event().c_str(), sizeof(buf->event_name));
|
||||||
|
return pack;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::unique_ptr<ServerPacket> DynamicZoneBase::CreateLockoutDurationPacket(const DzLockout& lockout, int seconds, bool members_only) const
|
||||||
|
{
|
||||||
|
uint32_t pack_size = sizeof(ServerDzLockout_Struct);
|
||||||
|
auto pack = std::make_unique<ServerPacket>(ServerOP_DzLockoutDuration, pack_size);
|
||||||
|
auto buf = reinterpret_cast<ServerDzLockout_Struct*>(pack->pBuffer);
|
||||||
|
buf->dz_id = GetID();
|
||||||
|
buf->expire_time = lockout.GetExpireTime();
|
||||||
|
buf->duration = lockout.GetDuration();
|
||||||
|
buf->sender_zone_id = GetCurrentZoneID();
|
||||||
|
buf->sender_instance_id = GetCurrentInstanceID();
|
||||||
|
buf->members_only = members_only;
|
||||||
|
buf->seconds = seconds;
|
||||||
|
strn0cpy(buf->event_name, lockout.Event().c_str(), sizeof(buf->event_name));
|
||||||
|
return pack;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DynamicZoneBase::SyncCharacterLockouts(uint32_t char_id, std::vector<DzLockout>& lockouts)
|
||||||
|
{
|
||||||
|
// adds missing event lockouts to client for this expedition and updates
|
||||||
|
// client timers that are both shorter and from another expedition
|
||||||
|
bool modified = false;
|
||||||
|
|
||||||
|
for (const auto& lockout : m_lockouts)
|
||||||
|
{
|
||||||
|
if (lockout.IsReplay() || lockout.IsExpired() || lockout.UUID() != m_uuid)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
auto it = std::find_if(lockouts.begin(), lockouts.end(), [&](const DzLockout& l) { return l.IsSame(lockout); });
|
||||||
|
if (it == lockouts.end())
|
||||||
|
{
|
||||||
|
modified = true;
|
||||||
|
lockouts.push_back(lockout); // insert missing
|
||||||
|
}
|
||||||
|
else if (it->GetSecondsRemaining() < lockout.GetSecondsRemaining() && it->UUID() != m_uuid)
|
||||||
|
{
|
||||||
|
// only update lockout timer not uuid so loot event apis still work
|
||||||
|
modified = true;
|
||||||
|
it->SetDuration(lockout.GetDuration());
|
||||||
|
it->SetExpireTime(lockout.GetExpireTime());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (modified)
|
||||||
|
{
|
||||||
|
CharacterExpeditionLockoutsRepository::InsertLockouts(GetDatabase(), char_id, lockouts);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
+68
-14
@@ -1,8 +1,8 @@
|
|||||||
#ifndef COMMON_DYNAMIC_ZONE_BASE_H
|
#ifndef COMMON_DYNAMIC_ZONE_BASE_H
|
||||||
#define COMMON_DYNAMIC_ZONE_BASE_H
|
#define COMMON_DYNAMIC_ZONE_BASE_H
|
||||||
|
|
||||||
|
#include "dynamic_zone_lockout.h"
|
||||||
#include "eq_constants.h"
|
#include "eq_constants.h"
|
||||||
#include "net/packet.h"
|
|
||||||
#include "repositories/dynamic_zones_repository.h"
|
#include "repositories/dynamic_zones_repository.h"
|
||||||
#include "repositories/dynamic_zone_members_repository.h"
|
#include "repositories/dynamic_zone_members_repository.h"
|
||||||
#include "repositories/dynamic_zone_templates_repository.h"
|
#include "repositories/dynamic_zone_templates_repository.h"
|
||||||
@@ -10,12 +10,40 @@
|
|||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <span>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
class Database;
|
class Database;
|
||||||
class ServerPacket;
|
class ServerPacket;
|
||||||
|
|
||||||
|
// message string 8312 added in September 08 2020 Test patch (used by both dz and shared tasks)
|
||||||
|
inline constexpr char DzNotAllAdded[] = "Not all players in your {0} were added to the {1}. The {1} can take a maximum of {2} players, and your {0} has {3}.";
|
||||||
|
|
||||||
|
enum class DzLockMsg : uint8_t
|
||||||
|
{
|
||||||
|
None = 0, Close, Begin
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class DynamicZoneType
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
Expedition,
|
||||||
|
Tutorial,
|
||||||
|
Task,
|
||||||
|
Mission, // Shared Task
|
||||||
|
Quest
|
||||||
|
};
|
||||||
|
|
||||||
|
enum class DynamicZoneMemberStatus
|
||||||
|
{
|
||||||
|
Unknown = 0,
|
||||||
|
Online,
|
||||||
|
Offline,
|
||||||
|
InDynamicZone,
|
||||||
|
LinkDead
|
||||||
|
};
|
||||||
|
|
||||||
struct DynamicZoneMember
|
struct DynamicZoneMember
|
||||||
{
|
{
|
||||||
uint32_t id = 0;
|
uint32_t id = 0;
|
||||||
@@ -93,6 +121,7 @@ public:
|
|||||||
const std::string& GetName() const { return m_name; }
|
const std::string& GetName() const { return m_name; }
|
||||||
const std::string& GetUUID() const { return m_uuid; }
|
const std::string& GetUUID() const { return m_uuid; }
|
||||||
const DynamicZoneMember& GetLeader() const { return m_leader; }
|
const DynamicZoneMember& GetLeader() const { return m_leader; }
|
||||||
|
const std::vector<DzLockout>& GetLockouts() const { return m_lockouts; }
|
||||||
const std::vector<DynamicZoneMember>& GetMembers() const { return m_members; }
|
const std::vector<DynamicZoneMember>& GetMembers() const { return m_members; }
|
||||||
const DynamicZoneLocation& GetCompassLocation() const { return m_compass; }
|
const DynamicZoneLocation& GetCompassLocation() const { return m_compass; }
|
||||||
const DynamicZoneLocation& GetSafeReturnLocation() const { return m_safereturn; }
|
const DynamicZoneLocation& GetSafeReturnLocation() const { return m_safereturn; }
|
||||||
@@ -104,31 +133,34 @@ public:
|
|||||||
uint32_t GetDatabaseMemberCount();
|
uint32_t GetDatabaseMemberCount();
|
||||||
DynamicZoneMember GetMemberData(uint32_t character_id);
|
DynamicZoneMember GetMemberData(uint32_t character_id);
|
||||||
DynamicZoneMember GetMemberData(const std::string& character_name);
|
DynamicZoneMember GetMemberData(const std::string& character_name);
|
||||||
EQ::Net::DynamicPacket GetSerializedDzPacket();
|
std::vector<uint32_t> GetMemberIds();
|
||||||
|
std::ostringstream GetSerialized();
|
||||||
bool HasDatabaseMember(uint32_t character_id);
|
bool HasDatabaseMember(uint32_t character_id);
|
||||||
bool HasMember(uint32_t character_id);
|
bool HasMember(uint32_t character_id) const;
|
||||||
bool HasMember(const std::string& character_name);
|
bool HasMember(const std::string& character_name) const;
|
||||||
bool HasMembers() const { return !m_members.empty(); }
|
bool HasMembers() const { return !m_members.empty(); }
|
||||||
bool HasZoneInLocation() const { return m_has_zonein; }
|
bool HasZoneInLocation() const { return m_has_zonein; }
|
||||||
|
bool IsExpedition() const { return m_type == DynamicZoneType::Expedition; }
|
||||||
bool IsExpired() const { return m_expire_time < std::chrono::system_clock::now(); }
|
bool IsExpired() const { return m_expire_time < std::chrono::system_clock::now(); }
|
||||||
bool IsInstanceID(uint32_t instance_id) const { return (m_instance_id != 0 && m_instance_id == instance_id); }
|
bool IsInstanceID(uint32_t instance_id) const { return (m_instance_id != 0 && m_instance_id == instance_id); }
|
||||||
|
bool IsLocked() const { return m_is_locked; }
|
||||||
bool IsValid() const { return m_instance_id != 0; }
|
bool IsValid() const { return m_instance_id != 0; }
|
||||||
bool IsSameDz(uint32_t zone_id, uint32_t instance_id) const { return zone_id == m_zone_id && instance_id == m_instance_id; }
|
bool IsSameDz(uint32_t zone_id, uint32_t instance_id) const { return zone_id == m_zone_id && instance_id == m_instance_id; }
|
||||||
void LoadSerializedDzPacket(char* cereal_data, uint32_t cereal_size);
|
|
||||||
void LoadTemplate(const DynamicZoneTemplatesRepository::DynamicZoneTemplates& dz_template);
|
void LoadTemplate(const DynamicZoneTemplatesRepository::DynamicZoneTemplates& dz_template);
|
||||||
void RemoveAllMembers();
|
void RemoveAllMembers();
|
||||||
bool RemoveMember(uint32_t character_id);
|
bool RemoveMember(uint32_t character_id);
|
||||||
bool RemoveMember(const std::string& character_name);
|
bool RemoveMember(const std::string& character_name);
|
||||||
bool RemoveMember(const DynamicZoneMember& remove_member);
|
bool RemoveMember(const DynamicZoneMember& remove_member);
|
||||||
void SaveMembers(const std::vector<DynamicZoneMember>& members);
|
|
||||||
void SetCompass(const DynamicZoneLocation& location, bool update_db = false);
|
void SetCompass(const DynamicZoneLocation& location, bool update_db = false);
|
||||||
void SetCompass(uint32_t zone_id, float x, float y, float z, bool update_db = false);
|
void SetCompass(uint32_t zone_id, float x, float y, float z, bool update_db = false);
|
||||||
void SetDuration(uint32_t seconds) { m_duration = std::chrono::seconds(seconds); }
|
void SetDuration(uint32_t seconds) { m_duration = std::chrono::seconds(seconds); }
|
||||||
void SetLeader(const DynamicZoneMember& leader, bool update_db = false);
|
void SetLeader(const DynamicZoneMember& leader, bool update_db = false);
|
||||||
|
void SetLocked(bool lock, bool update_db = false, DzLockMsg lock_msg = DzLockMsg::None, uint32_t color = Chat::Yellow);
|
||||||
void SetMaxPlayers(uint32_t max_players) { m_max_players = max_players; }
|
void SetMaxPlayers(uint32_t max_players) { m_max_players = max_players; }
|
||||||
void SetMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status);
|
void SetMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status);
|
||||||
void SetMinPlayers(uint32_t min_players) { m_min_players = min_players; }
|
void SetMinPlayers(uint32_t min_players) { m_min_players = min_players; }
|
||||||
void SetName(const std::string& name) { m_name = name; }
|
void SetName(const std::string& name) { m_name = name; }
|
||||||
|
void SetReplayOnJoin(bool enabled, bool update_db = false);
|
||||||
void SetSafeReturn(const DynamicZoneLocation& location, bool update_db = false);
|
void SetSafeReturn(const DynamicZoneLocation& location, bool update_db = false);
|
||||||
void SetSafeReturn(uint32_t zone_id, float x, float y, float z, float heading, bool update_db = false);
|
void SetSafeReturn(uint32_t zone_id, float x, float y, float z, float heading, bool update_db = false);
|
||||||
void SetSwitchID(int dz_switch_id, bool update_db = false);
|
void SetSwitchID(int dz_switch_id, bool update_db = false);
|
||||||
@@ -136,34 +168,48 @@ public:
|
|||||||
void SetUUID(std::string uuid) { m_uuid = std::move(uuid); }
|
void SetUUID(std::string uuid) { m_uuid = std::move(uuid); }
|
||||||
void SetZoneInLocation(const DynamicZoneLocation& location, bool update_db = false);
|
void SetZoneInLocation(const DynamicZoneLocation& location, bool update_db = false);
|
||||||
void SetZoneInLocation(float x, float y, float z, float heading, bool update_db = false);
|
void SetZoneInLocation(float x, float y, float z, float heading, bool update_db = false);
|
||||||
bool SwapMember(const DynamicZoneMember& add_member, const std::string& remove_char_name);
|
bool SwapMember(const DynamicZoneMember& add_member, const std::string& remove_name);
|
||||||
|
|
||||||
|
void AddLockout(const std::string& event, uint32_t seconds);
|
||||||
|
void AddLockoutDuration(const std::string& event, int seconds, bool members_only = true);
|
||||||
|
bool HasLockout(const std::string& event);
|
||||||
|
bool HasReplayLockout();
|
||||||
|
void RemoveLockout(const std::string& event);
|
||||||
|
void SyncCharacterLockouts(uint32_t char_id, std::vector<DzLockout>& lockouts);
|
||||||
|
void UpdateLockoutDuration(const std::string& event, uint32_t seconds, bool members_only = true);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual uint16_t GetCurrentInstanceID() { return 0; }
|
virtual uint16_t GetCurrentInstanceID() const { return 0; }
|
||||||
virtual uint16_t GetCurrentZoneID() { return 0; }
|
virtual uint16_t GetCurrentZoneID() const { return 0; }
|
||||||
virtual Database& GetDatabase() = 0;
|
virtual Database& GetDatabase() = 0;
|
||||||
|
virtual void HandleLockoutDuration(const DzLockout& lockout, int seconds, bool members_only, bool insert_db);
|
||||||
|
virtual void HandleLockoutUpdate(const DzLockout& lockout, bool remove, bool members_only);
|
||||||
virtual void ProcessCompassChange(const DynamicZoneLocation& location) { m_compass = location; }
|
virtual void ProcessCompassChange(const DynamicZoneLocation& location) { m_compass = location; }
|
||||||
virtual void ProcessMemberAddRemove(const DynamicZoneMember& member, bool removed);
|
virtual void ProcessMemberAddRemove(const DynamicZoneMember& member, bool removed);
|
||||||
virtual bool ProcessMemberStatusChange(uint32_t member_id, DynamicZoneMemberStatus status);
|
virtual bool ProcessMemberStatusChange(uint32_t character_id, DynamicZoneMemberStatus status);
|
||||||
virtual void ProcessRemoveAllMembers(bool silent = false) { m_members.clear(); }
|
virtual void ProcessRemoveAllMembers() { m_members.clear(); }
|
||||||
virtual void ProcessSetSwitchID(int dz_switch_id) { m_dz_switch_id = dz_switch_id; }
|
virtual void ProcessSetSwitchID(int dz_switch_id) { m_dz_switch_id = dz_switch_id; }
|
||||||
virtual bool SendServerPacket(ServerPacket* packet) = 0;
|
virtual bool SendServerPacket(ServerPacket* packet) = 0;
|
||||||
|
|
||||||
|
void AddLockout(const DzLockout& lockout, bool members_only = false);
|
||||||
void AddInternalMember(const DynamicZoneMember& member);
|
void AddInternalMember(const DynamicZoneMember& member);
|
||||||
uint32_t Create();
|
uint32_t Create();
|
||||||
uint32_t CreateInstance();
|
uint32_t CreateInstance();
|
||||||
void LoadRepositoryResult(DynamicZonesRepository::DynamicZoneInstance&& dz_entry);
|
void LoadRepositoryResult(DynamicZonesRepository::DynamicZoneInstance&& dz_entry);
|
||||||
void RemoveInternalMember(uint32_t character_id);
|
void RemoveInternalMember(uint32_t character_id);
|
||||||
|
void SaveMembers(const std::vector<DynamicZoneMember>& members);
|
||||||
uint32_t SaveToDatabase();
|
uint32_t SaveToDatabase();
|
||||||
bool SetInternalMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status);
|
bool SetInternalMemberStatus(uint32_t character_id, DynamicZoneMemberStatus status);
|
||||||
|
|
||||||
std::unique_ptr<ServerPacket> CreateServerDzCreatePacket(uint16_t origin_zone_id, uint16_t origin_instance_id);
|
std::unique_ptr<ServerPacket> CreateServerPacket(uint16_t zone_id, uint16_t instance_id);
|
||||||
std::unique_ptr<ServerPacket> CreateServerDzLocationPacket(uint16_t server_opcode, const DynamicZoneLocation& location);
|
std::unique_ptr<ServerPacket> CreateServerDzLocationPacket(uint16_t server_opcode, const DynamicZoneLocation& location);
|
||||||
std::unique_ptr<ServerPacket> CreateServerDzSwitchIDPacket();
|
std::unique_ptr<ServerPacket> CreateServerDzSwitchIDPacket();
|
||||||
std::unique_ptr<ServerPacket> CreateServerMemberAddRemovePacket(const DynamicZoneMember& member, bool removed);
|
std::unique_ptr<ServerPacket> CreateServerMemberAddRemovePacket(const DynamicZoneMember& member, bool removed);
|
||||||
std::unique_ptr<ServerPacket> CreateServerMemberStatusPacket(uint32_t character_id, DynamicZoneMemberStatus status);
|
std::unique_ptr<ServerPacket> CreateServerMemberStatusPacket(uint32_t character_id, DynamicZoneMemberStatus status);
|
||||||
std::unique_ptr<ServerPacket> CreateServerMemberSwapPacket(const DynamicZoneMember& remove_member, const DynamicZoneMember& add_member);
|
std::unique_ptr<ServerPacket> CreateServerMemberSwapPacket(const DynamicZoneMember& remove_member, const DynamicZoneMember& add_member);
|
||||||
std::unique_ptr<ServerPacket> CreateServerRemoveAllMembersPacket();
|
std::unique_ptr<ServerPacket> CreateServerRemoveAllMembersPacket();
|
||||||
|
std::unique_ptr<ServerPacket> CreateLockoutPacket(const DzLockout& lockout, bool remove, bool members_only = false) const;
|
||||||
|
std::unique_ptr<ServerPacket> CreateLockoutDurationPacket(const DzLockout& lockout, int seconds, bool members_only = false) const;
|
||||||
|
|
||||||
uint32_t m_id = 0;
|
uint32_t m_id = 0;
|
||||||
uint32_t m_zone_id = 0;
|
uint32_t m_zone_id = 0;
|
||||||
@@ -175,6 +221,8 @@ protected:
|
|||||||
bool m_never_expires = false;
|
bool m_never_expires = false;
|
||||||
bool m_has_zonein = false;
|
bool m_has_zonein = false;
|
||||||
bool m_has_member_statuses = false;
|
bool m_has_member_statuses = false;
|
||||||
|
bool m_is_locked = false;
|
||||||
|
bool m_add_replay = true;
|
||||||
std::string m_name;
|
std::string m_name;
|
||||||
std::string m_uuid;
|
std::string m_uuid;
|
||||||
DynamicZoneMember m_leader;
|
DynamicZoneMember m_leader;
|
||||||
@@ -182,12 +230,15 @@ protected:
|
|||||||
DynamicZoneLocation m_compass;
|
DynamicZoneLocation m_compass;
|
||||||
DynamicZoneLocation m_safereturn;
|
DynamicZoneLocation m_safereturn;
|
||||||
DynamicZoneLocation m_zonein;
|
DynamicZoneLocation m_zonein;
|
||||||
std::chrono::seconds m_duration;
|
std::chrono::seconds m_duration = {};
|
||||||
std::chrono::time_point<std::chrono::system_clock> m_start_time;
|
std::chrono::time_point<std::chrono::system_clock> m_start_time;
|
||||||
std::chrono::time_point<std::chrono::system_clock> m_expire_time;
|
std::chrono::time_point<std::chrono::system_clock> m_expire_time;
|
||||||
std::vector<DynamicZoneMember> m_members;
|
std::vector<DynamicZoneMember> m_members;
|
||||||
|
std::vector<DzLockout> m_lockouts;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
void Unserialize(std::span<char> buf);
|
||||||
|
|
||||||
template<class Archive>
|
template<class Archive>
|
||||||
void serialize(Archive& archive)
|
void serialize(Archive& archive)
|
||||||
{
|
{
|
||||||
@@ -202,6 +253,8 @@ public:
|
|||||||
m_never_expires,
|
m_never_expires,
|
||||||
m_has_zonein,
|
m_has_zonein,
|
||||||
m_has_member_statuses,
|
m_has_member_statuses,
|
||||||
|
m_is_locked,
|
||||||
|
m_add_replay,
|
||||||
m_name,
|
m_name,
|
||||||
m_uuid,
|
m_uuid,
|
||||||
m_leader,
|
m_leader,
|
||||||
@@ -212,7 +265,8 @@ public:
|
|||||||
m_duration,
|
m_duration,
|
||||||
m_start_time,
|
m_start_time,
|
||||||
m_expire_time,
|
m_expire_time,
|
||||||
m_members
|
m_members,
|
||||||
|
m_lockouts
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -0,0 +1,93 @@
|
|||||||
|
#include "dynamic_zone_lockout.h"
|
||||||
|
#include "strings.h"
|
||||||
|
#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)
|
||||||
|
: m_uuid(std::move(uuid))
|
||||||
|
, m_name(std::move(expedition))
|
||||||
|
, m_event(std::move(event))
|
||||||
|
, m_expire_time(std::chrono::system_clock::from_time_t(expire_time))
|
||||||
|
, m_duration(duration)
|
||||||
|
{
|
||||||
|
m_is_replay = m_event == ReplayTimer;
|
||||||
|
}
|
||||||
|
|
||||||
|
DzLockout::DzLockout(std::string_view name, BaseDynamicZoneLockoutsRepository::DynamicZoneLockouts&& lockout)
|
||||||
|
: m_uuid(std::move(lockout.from_expedition_uuid))
|
||||||
|
, m_name(name)
|
||||||
|
, m_event(std::move(lockout.event_name))
|
||||||
|
, m_expire_time(std::chrono::system_clock::from_time_t(lockout.expire_time))
|
||||||
|
, m_duration(lockout.duration)
|
||||||
|
{
|
||||||
|
m_is_replay = m_event == ReplayTimer;
|
||||||
|
}
|
||||||
|
|
||||||
|
DzLockout DzLockout::Create(const std::string& expedition, const std::string& event, uint32_t seconds, std::string uuid)
|
||||||
|
{
|
||||||
|
seconds = static_cast<uint32_t>(seconds * RuleR(Expedition, LockoutDurationMultiplier));
|
||||||
|
|
||||||
|
if (uuid.empty())
|
||||||
|
{
|
||||||
|
uuid = EQ::Util::UUID::Generate().ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
DzLockout lockout{uuid, expedition, event, 0, seconds};
|
||||||
|
lockout.Reset(); // sets expire time
|
||||||
|
return lockout;
|
||||||
|
}
|
||||||
|
|
||||||
|
uint32_t DzLockout::GetSecondsRemaining() const
|
||||||
|
{
|
||||||
|
auto now = std::chrono::system_clock::now();
|
||||||
|
if (m_expire_time > now)
|
||||||
|
{
|
||||||
|
auto remaining = m_expire_time - now;
|
||||||
|
return static_cast<uint32_t>(std::chrono::duration_cast<std::chrono::seconds>(remaining).count());
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
DzLockout::TimeStrings DzLockout::GetTimeRemainingStrs() const
|
||||||
|
{
|
||||||
|
auto seconds = GetSecondsRemaining();
|
||||||
|
return DzLockout::TimeStrings{
|
||||||
|
fmt::format_int(seconds / 86400).str(), // days
|
||||||
|
fmt::format_int(seconds / 3600 % 24).str(), // hours
|
||||||
|
fmt::format_int(seconds / 60 % 60).str(), // minutes
|
||||||
|
fmt::format_int(seconds % 60).str() // seconds
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DzLockout::IsSame(const DzLockout& other) const
|
||||||
|
{
|
||||||
|
return other.IsSame(m_name, m_event);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool DzLockout::IsSame(const std::string& expedition, const std::string& event) const
|
||||||
|
{
|
||||||
|
return m_name == expedition && m_event == event;
|
||||||
|
}
|
||||||
|
|
||||||
|
void DzLockout::AddLockoutTime(int seconds)
|
||||||
|
{
|
||||||
|
seconds = static_cast<int>(seconds * RuleR(Expedition, LockoutDurationMultiplier));
|
||||||
|
|
||||||
|
auto new_duration = std::max(0, static_cast<int>(m_duration.count()) + seconds);
|
||||||
|
|
||||||
|
auto start_time = m_expire_time - m_duration;
|
||||||
|
m_duration = std::chrono::seconds(new_duration);
|
||||||
|
m_expire_time = start_time + m_duration;
|
||||||
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void DzLockout::serialize(T& archive)
|
||||||
|
{
|
||||||
|
archive(m_is_replay, m_uuid, m_name, m_event, m_duration, m_expire_time);
|
||||||
|
}
|
||||||
|
|
||||||
|
template void DzLockout::serialize(cereal::BinaryOutputArchive&);
|
||||||
|
template void DzLockout::serialize(cereal::BinaryInputArchive&);
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <chrono>
|
||||||
|
#include <string>
|
||||||
|
#include "repositories/base/base_dynamic_zone_lockouts_repository.h"
|
||||||
|
|
||||||
|
class DzLockout
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DzLockout() = default;
|
||||||
|
DzLockout(std::string uuid, std::string expedition, std::string event, uint64_t expire_time, uint32_t duration);
|
||||||
|
DzLockout(std::string_view name, BaseDynamicZoneLockoutsRepository::DynamicZoneLockouts&& lockout);
|
||||||
|
|
||||||
|
static constexpr char ReplayTimer[] = "Replay Timer";
|
||||||
|
|
||||||
|
static DzLockout Create(const std::string& expedition, const std::string& event, uint32_t seconds, std::string uuid = {});
|
||||||
|
|
||||||
|
struct TimeStrings
|
||||||
|
{
|
||||||
|
std::string days;
|
||||||
|
std::string hours;
|
||||||
|
std::string mins;
|
||||||
|
std::string secs;
|
||||||
|
};
|
||||||
|
|
||||||
|
void AddLockoutTime(int seconds);
|
||||||
|
uint32_t GetDuration() const { return static_cast<uint32_t>(m_duration.count()); }
|
||||||
|
uint64_t GetExpireTime() const { return std::chrono::system_clock::to_time_t(m_expire_time); }
|
||||||
|
uint64_t GetStartTime() const { return std::chrono::system_clock::to_time_t(m_expire_time - m_duration); }
|
||||||
|
uint32_t GetSecondsRemaining() const;
|
||||||
|
TimeStrings GetTimeRemainingStrs() const;
|
||||||
|
const std::string& DzName() const { return m_name; }
|
||||||
|
const std::string& Event() const { return m_event; }
|
||||||
|
const std::string& UUID() const { return m_uuid; }
|
||||||
|
bool IsEvent(std::string_view event) const { return m_event == event; }
|
||||||
|
bool IsExpired() const { return GetSecondsRemaining() == 0; }
|
||||||
|
bool IsReplay() const { return m_is_replay; }
|
||||||
|
bool IsSame(const DzLockout& other) const;
|
||||||
|
bool IsSame(const std::string& expedition, const std::string& event) const;
|
||||||
|
bool IsUUID(const std::string& uuid) const { return uuid == m_uuid; }
|
||||||
|
void Reset() { m_expire_time = std::chrono::system_clock::now() + m_duration; }
|
||||||
|
void SetDuration(uint32_t seconds) { m_duration = std::chrono::seconds(seconds); }
|
||||||
|
void SetExpireTime(uint64_t expire_time) { m_expire_time = std::chrono::system_clock::from_time_t(expire_time); }
|
||||||
|
void SetUUID(const std::string& uuid) { m_uuid = uuid; }
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
void serialize(T& archive);
|
||||||
|
|
||||||
|
private:
|
||||||
|
bool m_is_replay = false;
|
||||||
|
std::string m_uuid; // dz received in
|
||||||
|
std::string m_name;
|
||||||
|
std::string m_event;
|
||||||
|
std::chrono::seconds m_duration = {};
|
||||||
|
std::chrono::time_point<std::chrono::system_clock> m_expire_time;
|
||||||
|
};
|
||||||
@@ -451,3 +451,23 @@ bool LDoNTheme::IsValid(uint32 theme_id)
|
|||||||
{
|
{
|
||||||
return ldon_theme_names.find(theme_id) != ldon_theme_names.end();
|
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();
|
||||||
|
}
|
||||||
|
|||||||
+156
-25
@@ -130,9 +130,11 @@ namespace EQ
|
|||||||
using RoF2::invtype::MAIL_SIZE;
|
using RoF2::invtype::MAIL_SIZE;
|
||||||
using RoF2::invtype::GUILD_TROPHY_TRIBUTE_SIZE;
|
using RoF2::invtype::GUILD_TROPHY_TRIBUTE_SIZE;
|
||||||
using RoF2::invtype::KRONO_SIZE;
|
using RoF2::invtype::KRONO_SIZE;
|
||||||
|
using RoF2::invtype::GUILD_BANK_MAIN_SIZE;
|
||||||
|
using RoF2::invtype::GUILD_BANK_DEPOSIT_SIZE;
|
||||||
using RoF2::invtype::OTHER_SIZE;
|
using RoF2::invtype::OTHER_SIZE;
|
||||||
|
|
||||||
using Titanium::invtype::TRADE_NPC_SIZE;
|
using RoF2::invtype::TRADE_NPC_SIZE;
|
||||||
|
|
||||||
using RoF2::invtype::TYPE_INVALID;
|
using RoF2::invtype::TYPE_INVALID;
|
||||||
using RoF2::invtype::TYPE_BEGIN;
|
using RoF2::invtype::TYPE_BEGIN;
|
||||||
@@ -159,7 +161,7 @@ namespace EQ
|
|||||||
using RoF2::invslot::SLOT_INVALID;
|
using RoF2::invslot::SLOT_INVALID;
|
||||||
using RoF2::invslot::SLOT_BEGIN;
|
using RoF2::invslot::SLOT_BEGIN;
|
||||||
|
|
||||||
using Titanium::invslot::SLOT_TRADESKILL_EXPERIMENT_COMBINE;
|
using RoF2::invslot::SLOT_TRADESKILL_EXPERIMENT_COMBINE;
|
||||||
|
|
||||||
const int16 SLOT_AUGMENT_GENERIC_RETURN = 1001; // clients don't appear to use this method... (internal inventory return value)
|
const int16 SLOT_AUGMENT_GENERIC_RETURN = 1001; // clients don't appear to use this method... (internal inventory return value)
|
||||||
|
|
||||||
@@ -179,25 +181,25 @@ namespace EQ
|
|||||||
using RoF2::invslot::BONUS_STAT_END;
|
using RoF2::invslot::BONUS_STAT_END;
|
||||||
using RoF2::invslot::BONUS_SKILL_END;
|
using RoF2::invslot::BONUS_SKILL_END;
|
||||||
|
|
||||||
using Titanium::invslot::BANK_BEGIN;
|
using RoF2::invslot::BANK_BEGIN;
|
||||||
using SoF::invslot::BANK_END;
|
using RoF2::invslot::BANK_END;
|
||||||
|
|
||||||
using Titanium::invslot::SHARED_BANK_BEGIN;
|
using RoF2::invslot::SHARED_BANK_BEGIN;
|
||||||
using Titanium::invslot::SHARED_BANK_END;
|
using RoF2::invslot::SHARED_BANK_END;
|
||||||
|
|
||||||
using Titanium::invslot::TRADE_BEGIN;
|
using RoF2::invslot::TRADE_BEGIN;
|
||||||
using Titanium::invslot::TRADE_END;
|
using RoF2::invslot::TRADE_END;
|
||||||
|
|
||||||
using Titanium::invslot::TRADE_NPC_END;
|
using RoF2::invslot::TRADE_NPC_END;
|
||||||
|
|
||||||
using Titanium::invslot::WORLD_BEGIN;
|
using RoF2::invslot::WORLD_BEGIN;
|
||||||
using Titanium::invslot::WORLD_END;
|
using RoF2::invslot::WORLD_END;
|
||||||
|
|
||||||
using Titanium::invslot::TRIBUTE_BEGIN;
|
using RoF2::invslot::TRIBUTE_BEGIN;
|
||||||
using Titanium::invslot::TRIBUTE_END;
|
using RoF2::invslot::TRIBUTE_END;
|
||||||
|
|
||||||
using Titanium::invslot::GUILD_TRIBUTE_BEGIN;
|
using RoF2::invslot::GUILD_TRIBUTE_BEGIN;
|
||||||
using Titanium::invslot::GUILD_TRIBUTE_END;
|
using RoF2::invslot::GUILD_TRIBUTE_END;
|
||||||
|
|
||||||
const int16 CORPSE_BEGIN = invslot::slotGeneral1;
|
const int16 CORPSE_BEGIN = invslot::slotGeneral1;
|
||||||
const int16 CORPSE_END = CORPSE_BEGIN + invslot::slotCursor;
|
const int16 CORPSE_END = CORPSE_BEGIN + invslot::slotCursor;
|
||||||
@@ -214,38 +216,40 @@ namespace EQ
|
|||||||
} // namespace invslot
|
} // namespace invslot
|
||||||
|
|
||||||
namespace invbag {
|
namespace invbag {
|
||||||
using Titanium::invbag::SLOT_INVALID;
|
using RoF2::invbag::SLOT_INVALID;
|
||||||
using Titanium::invbag::SLOT_BEGIN;
|
using RoF2::invbag::SLOT_BEGIN;
|
||||||
using Titanium::invbag::SLOT_END;
|
using RoF2::invbag::SLOT_END;
|
||||||
using Titanium::invbag::SLOT_COUNT;
|
using RoF2::invbag::SLOT_COUNT;
|
||||||
|
|
||||||
using Titanium::invbag::GENERAL_BAGS_BEGIN;
|
using RoF2::invslot::WORLD_END;
|
||||||
|
|
||||||
|
const int16 GENERAL_BAGS_BEGIN = WORLD_END + 1;
|
||||||
const int16 GENERAL_BAGS_COUNT = invslot::GENERAL_COUNT * SLOT_COUNT;
|
const int16 GENERAL_BAGS_COUNT = invslot::GENERAL_COUNT * SLOT_COUNT;
|
||||||
const int16 GENERAL_BAGS_END = (GENERAL_BAGS_BEGIN + GENERAL_BAGS_COUNT) - 1;
|
const int16 GENERAL_BAGS_END = (GENERAL_BAGS_BEGIN + GENERAL_BAGS_COUNT) - 1;
|
||||||
|
|
||||||
const int16 GENERAL_BAGS_8_COUNT = 8 * SLOT_COUNT;
|
const int16 GENERAL_BAGS_8_COUNT = 8 * SLOT_COUNT;
|
||||||
const int16 GENERAL_BAGS_8_END = (GENERAL_BAGS_BEGIN + GENERAL_BAGS_8_COUNT) - 1;
|
const int16 GENERAL_BAGS_8_END = (GENERAL_BAGS_BEGIN + GENERAL_BAGS_8_COUNT) - 1;
|
||||||
|
|
||||||
const int16 CURSOR_BAG_BEGIN = 351;
|
const int16 CURSOR_BAG_BEGIN = GENERAL_BAGS_END + 1;
|
||||||
const int16 CURSOR_BAG_COUNT = SLOT_COUNT;
|
const int16 CURSOR_BAG_COUNT = SLOT_COUNT;
|
||||||
const int16 CURSOR_BAG_END = (CURSOR_BAG_BEGIN + CURSOR_BAG_COUNT) - 1;
|
const int16 CURSOR_BAG_END = (CURSOR_BAG_BEGIN + CURSOR_BAG_COUNT) - 1;
|
||||||
|
|
||||||
using Titanium::invbag::BANK_BAGS_BEGIN;
|
const int16 BANK_BAGS_BEGIN = CURSOR_BAG_END + 1;
|
||||||
const int16 BANK_BAGS_COUNT = (invtype::BANK_SIZE * SLOT_COUNT);
|
const int16 BANK_BAGS_COUNT = (invtype::BANK_SIZE * SLOT_COUNT);
|
||||||
const int16 BANK_BAGS_END = (BANK_BAGS_BEGIN + BANK_BAGS_COUNT) - 1;
|
const int16 BANK_BAGS_END = (BANK_BAGS_BEGIN + BANK_BAGS_COUNT) - 1;
|
||||||
|
|
||||||
const int16 BANK_BAGS_16_COUNT = 16 * SLOT_COUNT;
|
const int16 BANK_BAGS_16_COUNT = 16 * SLOT_COUNT;
|
||||||
const int16 BANK_BAGS_16_END = (BANK_BAGS_BEGIN + BANK_BAGS_16_COUNT) - 1;
|
const int16 BANK_BAGS_16_END = (BANK_BAGS_BEGIN + BANK_BAGS_16_COUNT) - 1;
|
||||||
|
|
||||||
using Titanium::invbag::SHARED_BANK_BAGS_BEGIN;
|
const int16 SHARED_BANK_BAGS_BEGIN = BANK_BAGS_END + 1;
|
||||||
const int16 SHARED_BANK_BAGS_COUNT = invtype::SHARED_BANK_SIZE * SLOT_COUNT;
|
const int16 SHARED_BANK_BAGS_COUNT = invtype::SHARED_BANK_SIZE * SLOT_COUNT;
|
||||||
const int16 SHARED_BANK_BAGS_END = (SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_COUNT) - 1;
|
const int16 SHARED_BANK_BAGS_END = (SHARED_BANK_BAGS_BEGIN + SHARED_BANK_BAGS_COUNT) - 1;
|
||||||
|
|
||||||
using Titanium::invbag::TRADE_BAGS_BEGIN;
|
const int16 TRADE_BAGS_BEGIN = SHARED_BANK_BAGS_END + 1;
|
||||||
const int16 TRADE_BAGS_COUNT = invtype::TRADE_SIZE * SLOT_COUNT;
|
const int16 TRADE_BAGS_COUNT = invtype::TRADE_SIZE * SLOT_COUNT;
|
||||||
const int16 TRADE_BAGS_END = (TRADE_BAGS_BEGIN + TRADE_BAGS_COUNT) - 1;
|
const int16 TRADE_BAGS_END = (TRADE_BAGS_BEGIN + TRADE_BAGS_COUNT) - 1;
|
||||||
|
|
||||||
using Titanium::invbag::GetInvBagIndexName;
|
using RoF2::invbag::GetInvBagIndexName;
|
||||||
|
|
||||||
} // namespace invbag
|
} // namespace invbag
|
||||||
|
|
||||||
@@ -788,4 +792,131 @@ namespace BookType {
|
|||||||
constexpr uint8 ItemInfo = 2;
|
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*/
|
#endif /*COMMON_EMU_CONSTANTS_H*/
|
||||||
|
|||||||
@@ -287,6 +287,8 @@ N(OP_InstillDoubt),
|
|||||||
N(OP_InterruptCast),
|
N(OP_InterruptCast),
|
||||||
N(OP_InvokeChangePetName),
|
N(OP_InvokeChangePetName),
|
||||||
N(OP_InvokeChangePetNameImmediate),
|
N(OP_InvokeChangePetNameImmediate),
|
||||||
|
N(OP_InvokeNameChangeImmediate),
|
||||||
|
N(OP_InvokeNameChangeLazy),
|
||||||
N(OP_ItemLinkClick),
|
N(OP_ItemLinkClick),
|
||||||
N(OP_ItemLinkResponse),
|
N(OP_ItemLinkResponse),
|
||||||
N(OP_ItemLinkText),
|
N(OP_ItemLinkText),
|
||||||
@@ -574,6 +576,7 @@ N(OP_TradeRequestAck),
|
|||||||
N(OP_TraderItemUpdate),
|
N(OP_TraderItemUpdate),
|
||||||
N(OP_TraderShop),
|
N(OP_TraderShop),
|
||||||
N(OP_TradeSkillCombine),
|
N(OP_TradeSkillCombine),
|
||||||
|
N(OP_TradeSkillRecipeInspect),
|
||||||
N(OP_Translocate),
|
N(OP_Translocate),
|
||||||
N(OP_TributeInfo),
|
N(OP_TributeInfo),
|
||||||
N(OP_TributeItem),
|
N(OP_TributeItem),
|
||||||
|
|||||||
+2
-20
@@ -974,25 +974,6 @@ namespace ZoneBlockedSpellTypes {
|
|||||||
const uint8 Region = 2;
|
const uint8 Region = 2;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum class DynamicZoneType
|
|
||||||
{
|
|
||||||
None = 0,
|
|
||||||
Expedition,
|
|
||||||
Tutorial,
|
|
||||||
Task,
|
|
||||||
Mission, // Shared Task
|
|
||||||
Quest
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class DynamicZoneMemberStatus : uint8_t
|
|
||||||
{
|
|
||||||
Unknown = 0,
|
|
||||||
Online,
|
|
||||||
Offline,
|
|
||||||
InDynamicZone,
|
|
||||||
LinkDead
|
|
||||||
};
|
|
||||||
|
|
||||||
enum StartZoneIndex {
|
enum StartZoneIndex {
|
||||||
Odus = 0,
|
Odus = 0,
|
||||||
Qeynos,
|
Qeynos,
|
||||||
@@ -1007,7 +988,8 @@ enum StartZoneIndex {
|
|||||||
Felwithe,
|
Felwithe,
|
||||||
Akanon,
|
Akanon,
|
||||||
Cabilis,
|
Cabilis,
|
||||||
SharVahl
|
SharVahl,
|
||||||
|
RatheMtn
|
||||||
};
|
};
|
||||||
|
|
||||||
enum FVNoDropFlagRule
|
enum FVNoDropFlagRule
|
||||||
|
|||||||
+22
-22
@@ -173,7 +173,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL,
|
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL,
|
||||||
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL,
|
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL,
|
||||||
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL,
|
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL,
|
||||||
ClientUnknown::INULL
|
ClientUnknown::INULL, ClientUnknown::INULL, ClientUnknown::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
ClientUnknown::INULL,
|
ClientUnknown::INULL,
|
||||||
@@ -200,7 +200,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
Client62::INULL, Client62::INULL, Client62::INULL,
|
Client62::INULL, Client62::INULL, Client62::INULL,
|
||||||
Client62::INULL, Client62::INULL, Client62::INULL,
|
Client62::INULL, Client62::INULL, Client62::INULL,
|
||||||
Client62::INULL, Client62::INULL, Client62::INULL,
|
Client62::INULL, Client62::INULL, Client62::INULL,
|
||||||
Client62::INULL
|
Client62::INULL, Client62::INULL, Client62::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
Client62::INULL,
|
Client62::INULL,
|
||||||
@@ -227,7 +227,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
Titanium::invtype::VIEW_MOD_PC_SIZE, Titanium::invtype::VIEW_MOD_BANK_SIZE, Titanium::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
Titanium::invtype::VIEW_MOD_PC_SIZE, Titanium::invtype::VIEW_MOD_BANK_SIZE, Titanium::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
Titanium::invtype::VIEW_MOD_LIMBO_SIZE, Titanium::invtype::ALT_STORAGE_SIZE, Titanium::invtype::ARCHIVED_SIZE,
|
Titanium::invtype::VIEW_MOD_LIMBO_SIZE, Titanium::invtype::ALT_STORAGE_SIZE, Titanium::invtype::ARCHIVED_SIZE,
|
||||||
Titanium::INULL, Titanium::INULL, Titanium::INULL,
|
Titanium::INULL, Titanium::INULL, Titanium::INULL,
|
||||||
Titanium::invtype::OTHER_SIZE
|
Titanium::INULL, Titanium::INULL, Titanium::invtype::OTHER_SIZE
|
||||||
),
|
),
|
||||||
|
|
||||||
Titanium::invslot::EQUIPMENT_BITMASK,
|
Titanium::invslot::EQUIPMENT_BITMASK,
|
||||||
@@ -254,7 +254,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
SoF::invtype::VIEW_MOD_PC_SIZE, SoF::invtype::VIEW_MOD_BANK_SIZE, SoF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
SoF::invtype::VIEW_MOD_PC_SIZE, SoF::invtype::VIEW_MOD_BANK_SIZE, SoF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
SoF::invtype::VIEW_MOD_LIMBO_SIZE, SoF::invtype::ALT_STORAGE_SIZE, SoF::invtype::ARCHIVED_SIZE,
|
SoF::invtype::VIEW_MOD_LIMBO_SIZE, SoF::invtype::ALT_STORAGE_SIZE, SoF::invtype::ARCHIVED_SIZE,
|
||||||
SoF::INULL, SoF::INULL, SoF::INULL,
|
SoF::INULL, SoF::INULL, SoF::INULL,
|
||||||
SoF::invtype::OTHER_SIZE
|
SoF::INULL, SoF::INULL, SoF::invtype::OTHER_SIZE
|
||||||
),
|
),
|
||||||
|
|
||||||
SoF::invslot::EQUIPMENT_BITMASK,
|
SoF::invslot::EQUIPMENT_BITMASK,
|
||||||
@@ -281,7 +281,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
SoD::invtype::VIEW_MOD_PC_SIZE, SoD::invtype::VIEW_MOD_BANK_SIZE, SoD::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
SoD::invtype::VIEW_MOD_PC_SIZE, SoD::invtype::VIEW_MOD_BANK_SIZE, SoD::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
SoD::invtype::VIEW_MOD_LIMBO_SIZE, SoD::invtype::ALT_STORAGE_SIZE, SoD::invtype::ARCHIVED_SIZE,
|
SoD::invtype::VIEW_MOD_LIMBO_SIZE, SoD::invtype::ALT_STORAGE_SIZE, SoD::invtype::ARCHIVED_SIZE,
|
||||||
SoD::INULL, SoD::INULL, SoD::INULL,
|
SoD::INULL, SoD::INULL, SoD::INULL,
|
||||||
SoD::invtype::OTHER_SIZE
|
SoD::INULL, SoD::INULL, SoD::invtype::OTHER_SIZE
|
||||||
),
|
),
|
||||||
|
|
||||||
SoD::invslot::EQUIPMENT_BITMASK,
|
SoD::invslot::EQUIPMENT_BITMASK,
|
||||||
@@ -308,7 +308,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
UF::invtype::VIEW_MOD_PC_SIZE, UF::invtype::VIEW_MOD_BANK_SIZE, UF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
UF::invtype::VIEW_MOD_PC_SIZE, UF::invtype::VIEW_MOD_BANK_SIZE, UF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
UF::invtype::VIEW_MOD_LIMBO_SIZE, UF::invtype::ALT_STORAGE_SIZE, UF::invtype::ARCHIVED_SIZE,
|
UF::invtype::VIEW_MOD_LIMBO_SIZE, UF::invtype::ALT_STORAGE_SIZE, UF::invtype::ARCHIVED_SIZE,
|
||||||
UF::INULL, UF::INULL, UF::INULL,
|
UF::INULL, UF::INULL, UF::INULL,
|
||||||
UF::invtype::OTHER_SIZE
|
UF::INULL, UF::INULL, UF::invtype::OTHER_SIZE
|
||||||
),
|
),
|
||||||
|
|
||||||
UF::invslot::EQUIPMENT_BITMASK,
|
UF::invslot::EQUIPMENT_BITMASK,
|
||||||
@@ -335,7 +335,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
RoF::invtype::VIEW_MOD_PC_SIZE, RoF::invtype::VIEW_MOD_BANK_SIZE, RoF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
RoF::invtype::VIEW_MOD_PC_SIZE, RoF::invtype::VIEW_MOD_BANK_SIZE, RoF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
RoF::invtype::VIEW_MOD_LIMBO_SIZE, RoF::invtype::ALT_STORAGE_SIZE, RoF::invtype::ARCHIVED_SIZE,
|
RoF::invtype::VIEW_MOD_LIMBO_SIZE, RoF::invtype::ALT_STORAGE_SIZE, RoF::invtype::ARCHIVED_SIZE,
|
||||||
RoF::invtype::MAIL_SIZE, RoF::invtype::GUILD_TROPHY_TRIBUTE_SIZE, RoF::INULL,
|
RoF::invtype::MAIL_SIZE, RoF::invtype::GUILD_TROPHY_TRIBUTE_SIZE, RoF::INULL,
|
||||||
RoF::invtype::OTHER_SIZE
|
RoF::INULL,RoF::INULL,RoF::invtype::OTHER_SIZE
|
||||||
),
|
),
|
||||||
|
|
||||||
RoF::invslot::EQUIPMENT_BITMASK,
|
RoF::invslot::EQUIPMENT_BITMASK,
|
||||||
@@ -362,7 +362,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
RoF2::invtype::VIEW_MOD_PC_SIZE, RoF2::invtype::VIEW_MOD_BANK_SIZE, RoF2::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
RoF2::invtype::VIEW_MOD_PC_SIZE, RoF2::invtype::VIEW_MOD_BANK_SIZE, RoF2::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
RoF2::invtype::VIEW_MOD_LIMBO_SIZE, RoF2::invtype::ALT_STORAGE_SIZE, RoF2::invtype::ARCHIVED_SIZE,
|
RoF2::invtype::VIEW_MOD_LIMBO_SIZE, RoF2::invtype::ALT_STORAGE_SIZE, RoF2::invtype::ARCHIVED_SIZE,
|
||||||
RoF2::invtype::MAIL_SIZE, RoF2::invtype::GUILD_TROPHY_TRIBUTE_SIZE, RoF2::invtype::KRONO_SIZE,
|
RoF2::invtype::MAIL_SIZE, RoF2::invtype::GUILD_TROPHY_TRIBUTE_SIZE, RoF2::invtype::KRONO_SIZE,
|
||||||
RoF2::invtype::OTHER_SIZE
|
RoF2::invtype::GUILD_BANK_MAIN_SIZE,RoF2::invtype::GUILD_BANK_DEPOSIT_SIZE, RoF2::invtype::OTHER_SIZE
|
||||||
),
|
),
|
||||||
|
|
||||||
RoF2::invslot::EQUIPMENT_BITMASK,
|
RoF2::invslot::EQUIPMENT_BITMASK,
|
||||||
@@ -389,7 +389,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,
|
EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,
|
||||||
EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,
|
EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,
|
||||||
EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,
|
EntityLimits::NPC::INULL, EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,
|
||||||
EntityLimits::NPC::INULL
|
EntityLimits::NPC::INULL, EntityLimits::NPC::INULL,EntityLimits::NPC::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
EntityLimits::NPC::INULL,
|
EntityLimits::NPC::INULL,
|
||||||
@@ -416,7 +416,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL,
|
EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL,
|
||||||
EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL,
|
EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL,
|
||||||
EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL,
|
EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL,
|
||||||
EntityLimits::NPCMerchant::INULL
|
EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL, EntityLimits::NPCMerchant::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
EntityLimits::NPCMerchant::INULL,
|
EntityLimits::NPCMerchant::INULL,
|
||||||
@@ -443,7 +443,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL,
|
EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL,
|
||||||
EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL,
|
EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL,
|
||||||
EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL,
|
EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL,
|
||||||
EntityLimits::Merc::INULL
|
EntityLimits::Merc::INULL, EntityLimits::Merc::INULL, EntityLimits::Merc::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
EntityLimits::Merc::INULL,
|
EntityLimits::Merc::INULL,
|
||||||
@@ -470,7 +470,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL,
|
EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL,
|
||||||
EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL,
|
EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL,
|
||||||
EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL,
|
EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL,
|
||||||
EntityLimits::Bot::INULL
|
EntityLimits::Bot::INULL, EntityLimits::Bot::INULL, EntityLimits::Bot::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
EntityLimits::Bot::invslot::EQUIPMENT_BITMASK,
|
EntityLimits::Bot::invslot::EQUIPMENT_BITMASK,
|
||||||
@@ -497,7 +497,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL,
|
EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL,
|
||||||
EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL,
|
EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL,
|
||||||
EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL,
|
EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL,
|
||||||
EntityLimits::ClientPet::INULL
|
EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL, EntityLimits::ClientPet::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
EntityLimits::ClientPet::INULL,
|
EntityLimits::ClientPet::INULL,
|
||||||
@@ -524,7 +524,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL,
|
EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL,
|
||||||
EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL,
|
EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL,
|
||||||
EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL,
|
EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL,
|
||||||
EntityLimits::NPCPet::INULL
|
EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL, EntityLimits::NPCPet::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
EntityLimits::NPCPet::INULL,
|
EntityLimits::NPCPet::INULL,
|
||||||
@@ -551,7 +551,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL,
|
EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL,
|
||||||
EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL,
|
EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL,
|
||||||
EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL,
|
EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL,
|
||||||
EntityLimits::MercPet::INULL
|
EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL, EntityLimits::MercPet::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
EntityLimits::MercPet::INULL,
|
EntityLimits::MercPet::INULL,
|
||||||
@@ -578,7 +578,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL,
|
EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL,
|
||||||
EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL,
|
EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL,
|
||||||
EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL,
|
EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL,
|
||||||
EntityLimits::BotPet::INULL
|
EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL, EntityLimits::BotPet::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
EntityLimits::BotPet::INULL,
|
EntityLimits::BotPet::INULL,
|
||||||
@@ -605,7 +605,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
Titanium::invtype::VIEW_MOD_PC_SIZE, Titanium::invtype::VIEW_MOD_BANK_SIZE, Titanium::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
Titanium::invtype::VIEW_MOD_PC_SIZE, Titanium::invtype::VIEW_MOD_BANK_SIZE, Titanium::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
Titanium::invtype::VIEW_MOD_LIMBO_SIZE, Titanium::INULL, Titanium::INULL,
|
Titanium::invtype::VIEW_MOD_LIMBO_SIZE, Titanium::INULL, Titanium::INULL,
|
||||||
Titanium::INULL, Titanium::INULL, Titanium::INULL,
|
Titanium::INULL, Titanium::INULL, Titanium::INULL,
|
||||||
Titanium::INULL
|
Titanium::INULL, Titanium::INULL, Titanium::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
Titanium::INULL,
|
Titanium::INULL,
|
||||||
@@ -632,7 +632,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
SoF::invtype::VIEW_MOD_PC_SIZE, SoF::invtype::VIEW_MOD_BANK_SIZE, SoF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
SoF::invtype::VIEW_MOD_PC_SIZE, SoF::invtype::VIEW_MOD_BANK_SIZE, SoF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
SoF::invtype::VIEW_MOD_LIMBO_SIZE, SoF::INULL, SoF::INULL,
|
SoF::invtype::VIEW_MOD_LIMBO_SIZE, SoF::INULL, SoF::INULL,
|
||||||
SoF::INULL, SoF::INULL, SoF::INULL,
|
SoF::INULL, SoF::INULL, SoF::INULL,
|
||||||
SoF::INULL
|
SoF::INULL, SoF::INULL, SoF::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
SoF::INULL,
|
SoF::INULL,
|
||||||
@@ -659,7 +659,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
SoD::invtype::VIEW_MOD_PC_SIZE, SoD::invtype::VIEW_MOD_BANK_SIZE, SoD::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
SoD::invtype::VIEW_MOD_PC_SIZE, SoD::invtype::VIEW_MOD_BANK_SIZE, SoD::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
SoD::invtype::VIEW_MOD_LIMBO_SIZE, SoD::INULL, SoD::INULL,
|
SoD::invtype::VIEW_MOD_LIMBO_SIZE, SoD::INULL, SoD::INULL,
|
||||||
SoD::INULL, SoD::INULL, SoD::INULL,
|
SoD::INULL, SoD::INULL, SoD::INULL,
|
||||||
SoD::INULL
|
SoD::INULL, SoD::INULL, SoD::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
SoD::INULL,
|
SoD::INULL,
|
||||||
@@ -686,7 +686,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
UF::invtype::VIEW_MOD_PC_SIZE, UF::invtype::VIEW_MOD_BANK_SIZE, UF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
UF::invtype::VIEW_MOD_PC_SIZE, UF::invtype::VIEW_MOD_BANK_SIZE, UF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
UF::invtype::VIEW_MOD_LIMBO_SIZE, UF::INULL, UF::INULL,
|
UF::invtype::VIEW_MOD_LIMBO_SIZE, UF::INULL, UF::INULL,
|
||||||
UF::INULL, UF::INULL, UF::INULL,
|
UF::INULL, UF::INULL, UF::INULL,
|
||||||
UF::INULL
|
UF::INULL, UF::INULL, UF::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
UF::INULL,
|
UF::INULL,
|
||||||
@@ -713,7 +713,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
RoF::invtype::VIEW_MOD_PC_SIZE, RoF::invtype::VIEW_MOD_BANK_SIZE, RoF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
RoF::invtype::VIEW_MOD_PC_SIZE, RoF::invtype::VIEW_MOD_BANK_SIZE, RoF::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
RoF::invtype::VIEW_MOD_LIMBO_SIZE, RoF::INULL, RoF::INULL,
|
RoF::invtype::VIEW_MOD_LIMBO_SIZE, RoF::INULL, RoF::INULL,
|
||||||
RoF::INULL, RoF::INULL, RoF::INULL,
|
RoF::INULL, RoF::INULL, RoF::INULL,
|
||||||
RoF::INULL
|
RoF::INULL, RoF::INULL, RoF::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
RoF::INULL,
|
RoF::INULL,
|
||||||
@@ -740,7 +740,7 @@ static const EQ::inventory::LookupEntry inventory_static_lookup_entries[EQ::vers
|
|||||||
RoF2::invtype::VIEW_MOD_PC_SIZE, RoF2::invtype::VIEW_MOD_BANK_SIZE, RoF2::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
RoF2::invtype::VIEW_MOD_PC_SIZE, RoF2::invtype::VIEW_MOD_BANK_SIZE, RoF2::invtype::VIEW_MOD_SHARED_BANK_SIZE,
|
||||||
RoF2::invtype::VIEW_MOD_LIMBO_SIZE, RoF2::INULL, RoF2::INULL,
|
RoF2::invtype::VIEW_MOD_LIMBO_SIZE, RoF2::INULL, RoF2::INULL,
|
||||||
RoF2::INULL, RoF2::INULL, RoF2::INULL,
|
RoF2::INULL, RoF2::INULL, RoF2::INULL,
|
||||||
RoF2::INULL
|
RoF2::INULL, RoF2::INULL, RoF2::INULL
|
||||||
),
|
),
|
||||||
|
|
||||||
RoF2::INULL,
|
RoF2::INULL,
|
||||||
|
|||||||
+3
-3
@@ -87,7 +87,7 @@ namespace EQ
|
|||||||
int16 ViewMODPC, ViewMODBank, ViewMODSharedBank;
|
int16 ViewMODPC, ViewMODBank, ViewMODSharedBank;
|
||||||
int16 ViewMODLimbo, AltStorage, Archived;
|
int16 ViewMODLimbo, AltStorage, Archived;
|
||||||
int16 Mail, GuildTrophyTribute, Krono;
|
int16 Mail, GuildTrophyTribute, Krono;
|
||||||
int16 Other;
|
int16 GuildBankMain,GuildBankDeposit, Other;
|
||||||
|
|
||||||
InventoryTypeSize_Struct(
|
InventoryTypeSize_Struct(
|
||||||
int16 Possessions, int16 Bank, int16 SharedBank,
|
int16 Possessions, int16 Bank, int16 SharedBank,
|
||||||
@@ -98,7 +98,7 @@ namespace EQ
|
|||||||
int16 ViewMODPC, int16 ViewMODBank, int16 ViewMODSharedBank,
|
int16 ViewMODPC, int16 ViewMODBank, int16 ViewMODSharedBank,
|
||||||
int16 ViewMODLimbo, int16 AltStorage, int16 Archived,
|
int16 ViewMODLimbo, int16 AltStorage, int16 Archived,
|
||||||
int16 Mail, int16 GuildTrophyTribute, int16 Krono,
|
int16 Mail, int16 GuildTrophyTribute, int16 Krono,
|
||||||
int16 Other
|
int16 GuildBankMain,int16 GuildBankDeposit, int16 Other
|
||||||
) :
|
) :
|
||||||
Possessions(Possessions), Bank(Bank), SharedBank(SharedBank),
|
Possessions(Possessions), Bank(Bank), SharedBank(SharedBank),
|
||||||
Trade(Trade), World(World), Limbo(Limbo),
|
Trade(Trade), World(World), Limbo(Limbo),
|
||||||
@@ -108,7 +108,7 @@ namespace EQ
|
|||||||
ViewMODPC(ViewMODPC), ViewMODBank(ViewMODBank), ViewMODSharedBank(ViewMODSharedBank),
|
ViewMODPC(ViewMODPC), ViewMODBank(ViewMODBank), ViewMODSharedBank(ViewMODSharedBank),
|
||||||
ViewMODLimbo(ViewMODLimbo), AltStorage(AltStorage), Archived(Archived),
|
ViewMODLimbo(ViewMODLimbo), AltStorage(AltStorage), Archived(Archived),
|
||||||
Mail(Mail), GuildTrophyTribute(GuildTrophyTribute), Krono(Krono),
|
Mail(Mail), GuildTrophyTribute(GuildTrophyTribute), Krono(Krono),
|
||||||
Other(Other)
|
GuildBankMain(GuildBankMain), GuildBankDeposit(GuildBankDeposit), Other(Other)
|
||||||
{ }
|
{ }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
+70
-48
@@ -19,17 +19,17 @@
|
|||||||
#ifndef EQ_PACKET_STRUCTS_H
|
#ifndef EQ_PACKET_STRUCTS_H
|
||||||
#define EQ_PACKET_STRUCTS_H
|
#define EQ_PACKET_STRUCTS_H
|
||||||
|
|
||||||
#include "types.h"
|
#include <list>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <list>
|
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include "../common/version.h"
|
|
||||||
#include "emu_constants.h"
|
|
||||||
#include "textures.h"
|
|
||||||
#include "../cereal/include/cereal/archives/binary.hpp"
|
#include "../cereal/include/cereal/archives/binary.hpp"
|
||||||
#include "../cereal/include/cereal/types/string.hpp"
|
#include "../cereal/include/cereal/types/string.hpp"
|
||||||
#include "../cereal/include/cereal/types/vector.hpp"
|
#include "../cereal/include/cereal/types/vector.hpp"
|
||||||
|
#include "../common/version.h"
|
||||||
|
#include "emu_constants.h"
|
||||||
|
#include "textures.h"
|
||||||
|
#include "types.h"
|
||||||
|
|
||||||
static const uint32 BUFF_COUNT = 42;
|
static const uint32 BUFF_COUNT = 42;
|
||||||
static const uint32 PET_BUFF_COUNT = 30;
|
static const uint32 PET_BUFF_COUNT = 30;
|
||||||
@@ -47,7 +47,7 @@ static const uint32 ADVANCED_LORE_LENGTH = 8192;
|
|||||||
*/
|
*/
|
||||||
#pragma pack(1)
|
#pragma pack(1)
|
||||||
|
|
||||||
struct LoginInfo_Struct {
|
struct LoginInfo {
|
||||||
/*000*/ char login_info[64];
|
/*000*/ char login_info[64];
|
||||||
/*064*/ uint8 unknown064[124];
|
/*064*/ uint8 unknown064[124];
|
||||||
/*188*/ uint8 zoning; // 01 if zoning, 00 if not
|
/*188*/ uint8 zoning; // 01 if zoning, 00 if not
|
||||||
@@ -324,6 +324,8 @@ union
|
|||||||
bool guild_show;
|
bool guild_show;
|
||||||
bool trader;
|
bool trader;
|
||||||
bool buyer;
|
bool buyer;
|
||||||
|
bool untargetable;
|
||||||
|
uint32 npc_tint_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct PlayerState_Struct {
|
struct PlayerState_Struct {
|
||||||
@@ -4283,6 +4285,10 @@ struct NewCombine_Struct {
|
|||||||
/*04*/
|
/*04*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct TradeSkillRecipeInspect_Struct {
|
||||||
|
uint32 recipe_id;
|
||||||
|
uint32 padding[17]; // unknown
|
||||||
|
};
|
||||||
|
|
||||||
//client requesting favorite recipies
|
//client requesting favorite recipies
|
||||||
struct TradeskillFavorites_Struct {
|
struct TradeskillFavorites_Struct {
|
||||||
@@ -5525,46 +5531,55 @@ struct GuildBankWithdrawItem_Struct
|
|||||||
|
|
||||||
struct GuildBankItemUpdate_Struct
|
struct GuildBankItemUpdate_Struct
|
||||||
{
|
{
|
||||||
void Init(uint32 inAction, uint32 inUnknown004, uint16 inSlotID, uint16 inArea, uint16 inUnknown012, uint32 inItemID, uint32 inIcon, uint32 inQuantity,
|
void Init(
|
||||||
uint32 inPermissions, uint32 inAllowMerge, bool inUseable)
|
uint32 inAction,
|
||||||
|
uint32 inUnknown004,
|
||||||
|
uint16 inSlotID,
|
||||||
|
uint16 inArea,
|
||||||
|
uint16 inUnknown012,
|
||||||
|
uint32 inItemID,
|
||||||
|
uint32 inIcon,
|
||||||
|
uint32 inQuantity,
|
||||||
|
uint32 inPermissions,
|
||||||
|
uint32 inAllowMerge,
|
||||||
|
bool inUseable)
|
||||||
{
|
{
|
||||||
Action = inAction;
|
action = inAction;
|
||||||
Unknown004 = inUnknown004;
|
unknown004 = inUnknown004;
|
||||||
SlotID = inSlotID;
|
slot_id = inSlotID;
|
||||||
Area = inArea;
|
area = inArea;
|
||||||
Unknown012 = inUnknown012;
|
display = inUnknown012;
|
||||||
ItemID = inItemID;
|
item_id = inItemID;
|
||||||
Icon = inIcon;
|
icon_id = inIcon;
|
||||||
Quantity = inQuantity;
|
quantity = inQuantity;
|
||||||
Permissions = inPermissions;
|
permissions = inPermissions;
|
||||||
AllowMerge = inAllowMerge;
|
allow_merge = inAllowMerge;
|
||||||
Useable = inUseable;
|
is_useable = inUseable;
|
||||||
ItemName[0] = '\0';
|
item_name[0] = '\0';
|
||||||
Donator[0] = '\0';
|
donator[0] = '\0';
|
||||||
WhoFor[0] = '\0';
|
who_for[0] = '\0';
|
||||||
};
|
};
|
||||||
|
|
||||||
/*000*/ uint32 Action;
|
/*000*/ uint32 action;
|
||||||
/*004*/ uint32 Unknown004;
|
/*004*/ uint32 unknown004;
|
||||||
/*008*/ uint16 SlotID;
|
/*008*/ uint16 slot_id;
|
||||||
/*010*/ uint16 Area;
|
/*010*/ uint16 area;
|
||||||
/*012*/ uint32 Unknown012;
|
/*012*/ uint32 display;
|
||||||
/*016*/ uint32 ItemID;
|
/*016*/ uint32 item_id;
|
||||||
/*020*/ uint32 Icon;
|
/*020*/ uint32 icon_id;
|
||||||
/*024*/ uint32 Quantity;
|
/*024*/ uint32 quantity;
|
||||||
/*028*/ uint32 Permissions;
|
/*028*/ uint32 permissions;
|
||||||
/*032*/ uint8 AllowMerge;
|
/*032*/ uint8 allow_merge;
|
||||||
/*033*/ uint8 Useable; // Used in conjunction with the Public-if-useable permission.
|
/*033*/ uint8 is_useable; // Used in conjunction with the Public-if-useable permission.
|
||||||
/*034*/ char ItemName[64];
|
/*034*/ char item_name[64];
|
||||||
/*098*/ char Donator[64];
|
/*098*/ char donator[64];
|
||||||
/*162*/ char WhoFor[64];
|
/*162*/ char who_for[64];
|
||||||
/*226*/ uint16 Unknown226;
|
/*226*/ uint16 unknown226;
|
||||||
};
|
};
|
||||||
|
|
||||||
// newer clients (RoF+) send a list that contains 240 entries
|
// newer clients (RoF+) send a list that contains 240 entries
|
||||||
// The packets don't actually use all 64 chars in the strings, but we'll just overallocate for these
|
// The packets don't actually use all 64 chars in the strings, but we'll just overallocate for these
|
||||||
struct GuildBankItemListEntry_Struct
|
struct GuildBankItemListEntry_Struct {
|
||||||
{
|
|
||||||
uint8 vaild;
|
uint8 vaild;
|
||||||
uint32 permissions;
|
uint32 permissions;
|
||||||
char whofor[64];
|
char whofor[64];
|
||||||
@@ -5819,21 +5834,28 @@ struct ChangeSize_Struct
|
|||||||
/*16*/
|
/*16*/
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum ChangeNameResponse : int {
|
||||||
|
Denied = 0, // 5167: "You have requested an invalid name or a Customer Service Representative has denied your name request. Please try another name."
|
||||||
|
Accepted = 1, // 5976: "Your request for a name change was successful."
|
||||||
|
Timeout = -1, // 5977: "Your request for a name change has timed out. Please try again later."
|
||||||
|
ServerError = -2, // 5978: "The server had an error while processing your name request. Please try again later."
|
||||||
|
RateLimited = -3, // 5979: "You must wait longer before submitting another name request. Please try again in a few minutes."
|
||||||
|
Ineligible = -4, // 5980: "Your character is not eligible for a name change."
|
||||||
|
Pending = -5 // 5193: "You already have a name change pending. Please wait until it is fully processed before attempting another name change."
|
||||||
|
};
|
||||||
|
|
||||||
|
struct AltChangeName_Struct {
|
||||||
|
/*00*/ char new_name[64];
|
||||||
|
/*40*/ char old_name[64];
|
||||||
|
/*80*/ int response_code;
|
||||||
|
};
|
||||||
|
|
||||||
struct ChangePetName_Struct {
|
struct ChangePetName_Struct {
|
||||||
/*00*/ char new_pet_name[64];
|
/*00*/ char new_pet_name[64];
|
||||||
/*40*/ char pet_owner_name[64];
|
/*40*/ char pet_owner_name[64];
|
||||||
/*80*/ int response_code;
|
/*80*/ int response_code;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum ChangePetNameResponse : int {
|
|
||||||
Denied = 0, // 5167 You have requested an invalid name or a Customer Service Representative has denied your name request. Please try another name.
|
|
||||||
Accepted = 1, // 5976 Your request for a name change was successful.
|
|
||||||
Timeout = -3, // 5979 You must wait longer before submitting another name request. Please try again in a few minutes.
|
|
||||||
NotEligible = -4, // 5980 Your character is not eligible for a name change.
|
|
||||||
Pending = -5, // 5193 You already have a name change pending. Please wait until it is fully processed before attempting another name change.
|
|
||||||
Unhandled = -1
|
|
||||||
};
|
|
||||||
|
|
||||||
// New OpCode/Struct for SoD+
|
// New OpCode/Struct for SoD+
|
||||||
struct GroupMakeLeader_Struct
|
struct GroupMakeLeader_Struct
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -545,13 +545,13 @@ void EQStream::SendPacket(uint16 opcode, EQApplicationPacket *p)
|
|||||||
uint32 chunksize, used;
|
uint32 chunksize, used;
|
||||||
uint32 length;
|
uint32 length;
|
||||||
|
|
||||||
if (LogSys.log_settings[Logs::Server_Client_Packet].is_category_enabled == 1){
|
if (EQEmuLogSys::Instance()->log_settings[Logs::Server_Client_Packet].is_category_enabled == 1){
|
||||||
if (p->GetOpcode() != OP_SpecialMesg){
|
if (p->GetOpcode() != OP_SpecialMesg){
|
||||||
Log(Logs::General, Logs::Server_Client_Packet, "[%s - 0x%04x] [Size: %u]", OpcodeManager::EmuToName(p->GetOpcode()), p->GetOpcode(), p->Size());
|
Log(Logs::General, Logs::Server_Client_Packet, "[%s - 0x%04x] [Size: %u]", OpcodeManager::EmuToName(p->GetOpcode()), p->GetOpcode(), p->Size());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LogSys.log_settings[Logs::Server_Client_Packet_With_Dump].is_category_enabled == 1){
|
if (EQEmuLogSys::Instance()->log_settings[Logs::Server_Client_Packet_With_Dump].is_category_enabled == 1){
|
||||||
if (p->GetOpcode() != OP_SpecialMesg){
|
if (p->GetOpcode() != OP_SpecialMesg){
|
||||||
Log(Logs::General, Logs::Server_Client_Packet_With_Dump, "[%s - 0x%04x] [Size: %u] %s", OpcodeManager::EmuToName(p->GetOpcode()), p->GetOpcode(), p->Size(), DumpPacketToString(p).c_str());
|
Log(Logs::General, Logs::Server_Client_Packet_With_Dump, "[%s - 0x%04x] [Size: %u] %s", OpcodeManager::EmuToName(p->GetOpcode()), p->GetOpcode(), p->Size(), DumpPacketToString(p).c_str());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include "emu_versions.h"
|
#include "emu_versions.h"
|
||||||
#include "eq_packet.h"
|
#include "eq_packet.h"
|
||||||
#include "net/daybreak_connection.h"
|
#include "net/reliable_stream_connection.h"
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ESTABLISHED,
|
ESTABLISHED,
|
||||||
@@ -33,18 +33,18 @@ struct EQStreamManagerInterfaceOptions
|
|||||||
//Login I had trouble getting to recognize compression at all
|
//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.
|
//but that might be because it was still a bit buggy when i was testing that.
|
||||||
if (compressed) {
|
if (compressed) {
|
||||||
daybreak_options.encode_passes[0] = EQ::Net::EncodeCompression;
|
reliable_stream_options.encode_passes[0] = EQ::Net::EncodeCompression;
|
||||||
}
|
}
|
||||||
else if (encoded) {
|
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;
|
int opcode_size;
|
||||||
bool track_opcode_stats;
|
bool track_opcode_stats;
|
||||||
EQ::Net::DaybreakConnectionManagerOptions daybreak_options;
|
EQ::Net::ReliableStreamConnectionManagerOptions reliable_stream_options;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EQStreamManagerInterface
|
class EQStreamManagerInterface
|
||||||
@@ -80,7 +80,7 @@ public:
|
|||||||
|
|
||||||
struct Stats
|
struct Stats
|
||||||
{
|
{
|
||||||
EQ::Net::DaybreakConnectionStats DaybreakStats;
|
EQ::Net::ReliableStreamConnectionStats ReliableStreamStats;
|
||||||
int RecvCount[_maxEmuOpcode];
|
int RecvCount[_maxEmuOpcode];
|
||||||
int SentCount[_maxEmuOpcode];
|
int SentCount[_maxEmuOpcode];
|
||||||
};
|
};
|
||||||
|
|||||||
+19
-2
@@ -147,6 +147,8 @@ void EQEmuConfig::parse_config()
|
|||||||
QSDatabaseUsername = _root["server"]["qsdatabase"].get("username", "eq").asString();
|
QSDatabaseUsername = _root["server"]["qsdatabase"].get("username", "eq").asString();
|
||||||
QSDatabasePassword = _root["server"]["qsdatabase"].get("password", "eq").asString();
|
QSDatabasePassword = _root["server"]["qsdatabase"].get("password", "eq").asString();
|
||||||
QSDatabaseDB = _root["server"]["qsdatabase"].get("db", "eq").asString();
|
QSDatabaseDB = _root["server"]["qsdatabase"].get("db", "eq").asString();
|
||||||
|
QSHost = _root["server"]["queryserver"].get("host", "localhost").asString();
|
||||||
|
QSPort = Strings::ToUnsignedInt(_root["server"]["queryserver"].get("port", "9500").asString());
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Zones
|
* Zones
|
||||||
@@ -175,6 +177,21 @@ void EQEmuConfig::parse_config()
|
|||||||
SharedMemDir = _root["server"]["directories"].get("shared_memory", "shared/").asString();
|
SharedMemDir = _root["server"]["directories"].get("shared_memory", "shared/").asString();
|
||||||
LogDir = _root["server"]["directories"].get("logs", "logs/").asString();
|
LogDir = _root["server"]["directories"].get("logs", "logs/").asString();
|
||||||
|
|
||||||
|
auto load_paths = [&](const std::string& key, std::vector<std::string>& target) {
|
||||||
|
const auto& paths = _root["server"]["directories"][key];
|
||||||
|
if (paths.isArray()) {
|
||||||
|
for (const auto& dir : paths) {
|
||||||
|
if (dir.isString()) {
|
||||||
|
target.push_back(dir.asString());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
load_paths("quest_paths", m_quest_directories);
|
||||||
|
load_paths("plugin_paths", m_plugin_directories);
|
||||||
|
load_paths("lua_module_paths", m_lua_module_directories);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs
|
* Logs
|
||||||
*/
|
*/
|
||||||
@@ -419,11 +436,11 @@ void EQEmuConfig::CheckUcsConfigConversion()
|
|||||||
LogInfo("Migrating old [eqemu_config] UCS configuration to new configuration");
|
LogInfo("Migrating old [eqemu_config] UCS configuration to new configuration");
|
||||||
|
|
||||||
std::string config_file_path = std::filesystem::path{
|
std::string config_file_path = std::filesystem::path{
|
||||||
path.GetServerPath() + "/eqemu_config.json"
|
PathManager::Instance()->GetServerPath() + "/eqemu_config.json"
|
||||||
}.string();
|
}.string();
|
||||||
|
|
||||||
std::string config_file_bak_path = std::filesystem::path{
|
std::string config_file_bak_path = std::filesystem::path{
|
||||||
path.GetServerPath() + "/eqemu_config.ucs-migrate-json.bak"
|
PathManager::Instance()->GetServerPath() + "/eqemu_config.ucs-migrate-json.bak"
|
||||||
}.string();
|
}.string();
|
||||||
|
|
||||||
// copy eqemu_config.json to eqemu_config.json.bak
|
// copy eqemu_config.json to eqemu_config.json.bak
|
||||||
|
|||||||
+25
-1
@@ -23,6 +23,7 @@
|
|||||||
#include "path_manager.h"
|
#include "path_manager.h"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
#include <fmt/ranges.h>
|
||||||
|
|
||||||
struct LoginConfig {
|
struct LoginConfig {
|
||||||
std::string LoginHost;
|
std::string LoginHost;
|
||||||
@@ -82,6 +83,8 @@ class EQEmuConfig
|
|||||||
std::string QSDatabasePassword;
|
std::string QSDatabasePassword;
|
||||||
std::string QSDatabaseDB;
|
std::string QSDatabaseDB;
|
||||||
uint16 QSDatabasePort;
|
uint16 QSDatabasePort;
|
||||||
|
std::string QSHost;
|
||||||
|
int QSPort;
|
||||||
|
|
||||||
// From <files/>
|
// From <files/>
|
||||||
std::string SpellsFile;
|
std::string SpellsFile;
|
||||||
@@ -118,6 +121,22 @@ class EQEmuConfig
|
|||||||
const std::string &GetUCSHost() const;
|
const std::string &GetUCSHost() const;
|
||||||
uint16 GetUCSPort() const;
|
uint16 GetUCSPort() const;
|
||||||
|
|
||||||
|
std::vector<std::string> GetQuestDirectories() const
|
||||||
|
{
|
||||||
|
return m_quest_directories;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> GetPluginsDirectories() const
|
||||||
|
{
|
||||||
|
return m_plugin_directories;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> GetLuaModuleDirectories() const
|
||||||
|
{
|
||||||
|
return m_lua_module_directories;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// uint16 DynamicCount;
|
// uint16 DynamicCount;
|
||||||
|
|
||||||
// map<string,uint16> StaticZones;
|
// map<string,uint16> StaticZones;
|
||||||
@@ -131,6 +150,11 @@ class EQEmuConfig
|
|||||||
Json::Value _root;
|
Json::Value _root;
|
||||||
static std::string ConfigFile;
|
static std::string ConfigFile;
|
||||||
|
|
||||||
|
std::vector<std::string> m_quest_directories = {};
|
||||||
|
std::vector<std::string> m_plugin_directories = {};
|
||||||
|
std::vector<std::string> m_lua_module_directories = {};
|
||||||
|
|
||||||
|
protected:
|
||||||
void parse_config();
|
void parse_config();
|
||||||
|
|
||||||
EQEmuConfig()
|
EQEmuConfig()
|
||||||
@@ -168,7 +192,7 @@ class EQEmuConfig
|
|||||||
|
|
||||||
std::string file = fmt::format(
|
std::string file = fmt::format(
|
||||||
"{}/{}",
|
"{}/{}",
|
||||||
(file_path.empty() ? path.GetServerPath() : file_path),
|
(file_path.empty() ? PathManager::Instance()->GetServerPath() : file_path),
|
||||||
EQEmuConfig::ConfigFile
|
EQEmuConfig::ConfigFile
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
+44
-13
@@ -105,6 +105,8 @@ EQEmuLogSys *EQEmuLogSys::LoadLogSettingsDefaults()
|
|||||||
log_settings[Logs::QuestErrors].log_to_console = static_cast<uint8>(Logs::General);
|
log_settings[Logs::QuestErrors].log_to_console = static_cast<uint8>(Logs::General);
|
||||||
log_settings[Logs::EqTime].log_to_console = static_cast<uint8>(Logs::General);
|
log_settings[Logs::EqTime].log_to_console = static_cast<uint8>(Logs::General);
|
||||||
log_settings[Logs::EqTime].log_to_gmsay = static_cast<uint8>(Logs::General);
|
log_settings[Logs::EqTime].log_to_gmsay = static_cast<uint8>(Logs::General);
|
||||||
|
log_settings[Logs::NpcHandin].log_to_console = static_cast<uint8>(Logs::General);
|
||||||
|
log_settings[Logs::NpcHandin].log_to_gmsay = static_cast<uint8>(Logs::General);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RFC 5424
|
* RFC 5424
|
||||||
@@ -535,9 +537,9 @@ void EQEmuLogSys::StartFileLogs(const std::string &log_name)
|
|||||||
{
|
{
|
||||||
EQEmuLogSys::CloseFileLogs();
|
EQEmuLogSys::CloseFileLogs();
|
||||||
|
|
||||||
if (!File::Exists(path.GetLogPath())) {
|
if (!File::Exists(PathManager::Instance()->GetLogPath())) {
|
||||||
LogInfo("Logs directory not found, creating [{}]", path.GetLogPath());
|
LogInfo("Logs directory not found, creating [{}]", PathManager::Instance()->GetLogPath());
|
||||||
File::Makedir(path.GetLogPath());
|
File::Makedir(PathManager::Instance()->GetLogPath());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -599,6 +601,8 @@ void EQEmuLogSys::SilenceConsoleLogging()
|
|||||||
log_settings[log_index].is_category_enabled = 0;
|
log_settings[log_index].is_category_enabled = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log_settings[Logs::MySQLError].log_to_console = static_cast<uint8>(Logs::MySQLError);
|
||||||
|
log_settings[Logs::Error].log_to_console = static_cast<uint8>(Logs::Error);
|
||||||
log_settings[Logs::Crash].log_to_console = static_cast<uint8>(Logs::General);
|
log_settings[Logs::Crash].log_to_console = static_cast<uint8>(Logs::General);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -610,7 +614,7 @@ void EQEmuLogSys::EnableConsoleLogging()
|
|||||||
std::copy(std::begin(pre_silence_settings), std::end(pre_silence_settings), std::begin(log_settings));
|
std::copy(std::begin(pre_silence_settings), std::end(pre_silence_settings), std::begin(log_settings));
|
||||||
}
|
}
|
||||||
|
|
||||||
EQEmuLogSys *EQEmuLogSys::LoadLogDatabaseSettings()
|
EQEmuLogSys *EQEmuLogSys::LoadLogDatabaseSettings(bool silent_load)
|
||||||
{
|
{
|
||||||
InjectTablesIfNotExist();
|
InjectTablesIfNotExist();
|
||||||
|
|
||||||
@@ -652,7 +656,7 @@ EQEmuLogSys *EQEmuLogSys::LoadLogDatabaseSettings()
|
|||||||
// If we go through this whole loop and nothing is set to any debug level, there
|
// If we go through this whole loop and nothing is set to any debug level, there
|
||||||
// is no point to create a file or keep anything open
|
// is no point to create a file or keep anything open
|
||||||
if (log_settings[c.log_category_id].log_to_file > 0) {
|
if (log_settings[c.log_category_id].log_to_file > 0) {
|
||||||
LogSys.m_file_logs_enabled = true;
|
m_file_logs_enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
db_categories.emplace_back(c.log_category_id);
|
db_categories.emplace_back(c.log_category_id);
|
||||||
@@ -678,14 +682,33 @@ EQEmuLogSys *EQEmuLogSys::LoadLogDatabaseSettings()
|
|||||||
if (is_missing_in_database && !is_deprecated_category) {
|
if (is_missing_in_database && !is_deprecated_category) {
|
||||||
LogInfo("Automatically adding new log category [{}] ({})", Logs::LogCategoryName[i], i);
|
LogInfo("Automatically adding new log category [{}] ({})", Logs::LogCategoryName[i], i);
|
||||||
|
|
||||||
auto new_category = LogsysCategoriesRepository::NewEntity();
|
auto e = LogsysCategoriesRepository::NewEntity();
|
||||||
new_category.log_category_id = i;
|
e.log_category_id = i;
|
||||||
new_category.log_category_description = Strings::Escape(Logs::LogCategoryName[i]);
|
e.log_category_description = Strings::Escape(Logs::LogCategoryName[i]);
|
||||||
new_category.log_to_console = log_settings[i].log_to_console;
|
e.log_to_console = log_settings[i].log_to_console;
|
||||||
new_category.log_to_gmsay = log_settings[i].log_to_gmsay;
|
e.log_to_gmsay = log_settings[i].log_to_gmsay;
|
||||||
new_category.log_to_file = log_settings[i].log_to_file;
|
e.log_to_file = log_settings[i].log_to_file;
|
||||||
new_category.log_to_discord = log_settings[i].log_to_discord;
|
e.log_to_discord = log_settings[i].log_to_discord;
|
||||||
db_categories_to_add.emplace_back(new_category);
|
db_categories_to_add.emplace_back(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
// look to see if the category name is different in the database
|
||||||
|
auto it = std::find_if(
|
||||||
|
categories.begin(),
|
||||||
|
categories.end(),
|
||||||
|
[i](const auto &c) { return c.log_category_id == i; }
|
||||||
|
);
|
||||||
|
if (it != categories.end()) {
|
||||||
|
if (it->log_category_description != Logs::LogCategoryName[i]) {
|
||||||
|
LogInfo(
|
||||||
|
"Updating log category [{}] ({}) to new name [{}]",
|
||||||
|
it->log_category_description,
|
||||||
|
i,
|
||||||
|
Logs::LogCategoryName[i]
|
||||||
|
);
|
||||||
|
it->log_category_description = Logs::LogCategoryName[i];
|
||||||
|
LogsysCategoriesRepository::ReplaceOne(*m_database, *it);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -695,6 +718,10 @@ EQEmuLogSys *EQEmuLogSys::LoadLogDatabaseSettings()
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (silent_load) {
|
||||||
|
SilenceConsoleLogging();
|
||||||
|
}
|
||||||
|
|
||||||
LogInfo("Loaded [{}] log categories", categories.size());
|
LogInfo("Loaded [{}] log categories", categories.size());
|
||||||
|
|
||||||
auto webhooks = DiscordWebhooksRepository::GetWhere(*m_database, fmt::format("id < {}", MAX_DISCORD_WEBHOOK_ID));
|
auto webhooks = DiscordWebhooksRepository::GetWhere(*m_database, fmt::format("id < {}", MAX_DISCORD_WEBHOOK_ID));
|
||||||
@@ -712,6 +739,10 @@ EQEmuLogSys *EQEmuLogSys::LoadLogDatabaseSettings()
|
|||||||
log_settings[Logs::Info].log_to_file = static_cast<uint8>(Logs::General);
|
log_settings[Logs::Info].log_to_file = static_cast<uint8>(Logs::General);
|
||||||
log_settings[Logs::Info].log_to_console = static_cast<uint8>(Logs::General);
|
log_settings[Logs::Info].log_to_console = static_cast<uint8>(Logs::General);
|
||||||
|
|
||||||
|
if (silent_load) {
|
||||||
|
SilenceConsoleLogging();
|
||||||
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+33
-14
@@ -34,6 +34,7 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
#include <fmt/ranges.h>
|
||||||
#include "types.h"
|
#include "types.h"
|
||||||
|
|
||||||
namespace Logs {
|
namespace Logs {
|
||||||
@@ -74,7 +75,7 @@ namespace Logs {
|
|||||||
Spawns,
|
Spawns,
|
||||||
Spells,
|
Spells,
|
||||||
Status, // deprecated
|
Status, // deprecated
|
||||||
TCPConnection,
|
TCPConnection, // deprecated
|
||||||
Tasks,
|
Tasks,
|
||||||
Tradeskills,
|
Tradeskills,
|
||||||
Trading,
|
Trading,
|
||||||
@@ -145,6 +146,13 @@ namespace Logs {
|
|||||||
EvolveItem,
|
EvolveItem,
|
||||||
PositionUpdate,
|
PositionUpdate,
|
||||||
KSM,
|
KSM,
|
||||||
|
BotSettings,
|
||||||
|
BotSpellChecks,
|
||||||
|
BotSpellTypeChecks,
|
||||||
|
NpcHandin,
|
||||||
|
ZoneState,
|
||||||
|
NetClient,
|
||||||
|
NetTCP,
|
||||||
MaxCategoryID /* Don't Remove this */
|
MaxCategoryID /* Don't Remove this */
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -178,7 +186,7 @@ namespace Logs {
|
|||||||
"Spawns",
|
"Spawns",
|
||||||
"Spells",
|
"Spells",
|
||||||
"Status (Deprecated)",
|
"Status (Deprecated)",
|
||||||
"TCP Connection",
|
"TCP Connection (Deprecated)",
|
||||||
"Tasks",
|
"Tasks",
|
||||||
"Tradeskills",
|
"Tradeskills",
|
||||||
"Trading",
|
"Trading",
|
||||||
@@ -187,8 +195,8 @@ namespace Logs {
|
|||||||
"Web Interface (Deprecated)",
|
"Web Interface (Deprecated)",
|
||||||
"World Server (Deprecated)",
|
"World Server (Deprecated)",
|
||||||
"Zone Server (Deprecated)",
|
"Zone Server (Deprecated)",
|
||||||
"QueryErr",
|
"MySQL Error",
|
||||||
"Query",
|
"MySQL Query",
|
||||||
"Mercenaries",
|
"Mercenaries",
|
||||||
"Quest Debug",
|
"Quest Debug",
|
||||||
"Legacy Packet Logging (Deprecated)",
|
"Legacy Packet Logging (Deprecated)",
|
||||||
@@ -211,8 +219,8 @@ namespace Logs {
|
|||||||
"Emergency (Deprecated)",
|
"Emergency (Deprecated)",
|
||||||
"Alert (Deprecated)",
|
"Alert (Deprecated)",
|
||||||
"Notice (Deprecated)",
|
"Notice (Deprecated)",
|
||||||
"AI Scan",
|
"AI Scan Close",
|
||||||
"AI Yell",
|
"AI Yell For Help",
|
||||||
"AI CastBeneficial",
|
"AI CastBeneficial",
|
||||||
"AOE Cast",
|
"AOE Cast",
|
||||||
"Entity Management",
|
"Entity Management",
|
||||||
@@ -230,7 +238,7 @@ namespace Logs {
|
|||||||
"DialogueWindow",
|
"DialogueWindow",
|
||||||
"HTTP",
|
"HTTP",
|
||||||
"Saylink",
|
"Saylink",
|
||||||
"ChecksumVer",
|
"Checksum Verification",
|
||||||
"CombatRecord",
|
"CombatRecord",
|
||||||
"Hate",
|
"Hate",
|
||||||
"Discord",
|
"Discord",
|
||||||
@@ -248,12 +256,17 @@ namespace Logs {
|
|||||||
"XTargets",
|
"XTargets",
|
||||||
"EvolveItem",
|
"EvolveItem",
|
||||||
"PositionUpdate",
|
"PositionUpdate",
|
||||||
"KSM" // Kernel Samepage Merging
|
"KSM", // Kernel Samepage Merging
|
||||||
|
"Bot Settings",
|
||||||
|
"Bot Spell Checks",
|
||||||
|
"Bot Spell Type Checks",
|
||||||
|
"NpcHandin",
|
||||||
|
"ZoneState",
|
||||||
|
"Net Server <-> Client",
|
||||||
|
"Net TCP"
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "eqemu_logsys_log_aliases.h"
|
|
||||||
|
|
||||||
class Database;
|
class Database;
|
||||||
|
|
||||||
constexpr uint16 MAX_DISCORD_WEBHOOK_ID = 300;
|
constexpr uint16 MAX_DISCORD_WEBHOOK_ID = 300;
|
||||||
@@ -269,7 +282,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
void CloseFileLogs();
|
void CloseFileLogs();
|
||||||
EQEmuLogSys *LoadLogSettingsDefaults();
|
EQEmuLogSys *LoadLogSettingsDefaults();
|
||||||
EQEmuLogSys *LoadLogDatabaseSettings();
|
EQEmuLogSys *LoadLogDatabaseSettings(bool silent_load = false);
|
||||||
|
|
||||||
|
static EQEmuLogSys *Instance()
|
||||||
|
{
|
||||||
|
static EQEmuLogSys instance;
|
||||||
|
return &instance;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param directory_name
|
* @param directory_name
|
||||||
@@ -336,7 +355,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* Internally used memory reference for all log settings per category
|
* Internally used memory reference for all log settings per category
|
||||||
* These are loaded via DB and have defaults loaded in LoadLogSettingsDefaults
|
* These are loaded via DB and have defaults loaded in LoadLogSettingsDefaults
|
||||||
* Database loaded via LogSys.SetDatabase(&database)->LoadLogDatabaseSettings();
|
* Database loaded via EQEmuLogSys::Instance()->SetDatabase(&database)->LoadLogDatabaseSettings();
|
||||||
*/
|
*/
|
||||||
LogSettings log_settings[Logs::LogCategory::MaxCategoryID]{};
|
LogSettings log_settings[Logs::LogCategory::MaxCategoryID]{};
|
||||||
|
|
||||||
@@ -420,7 +439,7 @@ private:
|
|||||||
void InjectTablesIfNotExist();
|
void InjectTablesIfNotExist();
|
||||||
};
|
};
|
||||||
|
|
||||||
extern EQEmuLogSys LogSys;
|
#include "eqemu_logsys_log_aliases.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
template<typename... Args>
|
template<typename... Args>
|
||||||
@@ -442,7 +461,7 @@ void OutF(
|
|||||||
|
|
||||||
#define OutF(ls, debug_level, log_category, file, func, line, formatStr, ...) \
|
#define OutF(ls, debug_level, log_category, file, func, line, formatStr, ...) \
|
||||||
do { \
|
do { \
|
||||||
ls.Out(debug_level, log_category, file, func, line, fmt::format(formatStr, ##__VA_ARGS__).c_str()); \
|
ls->Out(debug_level, log_category, file, func, line, fmt::format(formatStr, ##__VA_ARGS__).c_str()); \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+408
-356
File diff suppressed because it is too large
Load Diff
@@ -3,6 +3,7 @@
|
|||||||
#include "../json/json_archive_single_line.h"
|
#include "../json/json_archive_single_line.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
#include <fmt/ranges.h>
|
||||||
#include <cereal/archives/json.hpp>
|
#include <cereal/archives/json.hpp>
|
||||||
#include <cereal/types/vector.hpp>
|
#include <cereal/types/vector.hpp>
|
||||||
|
|
||||||
@@ -714,6 +715,18 @@ std::string PlayerEventDiscordFormatter::FormatNPCHandinEvent(
|
|||||||
h.charges > 1 ? fmt::format(" Charges: {}", h.charges) : "",
|
h.charges > 1 ? fmt::format(" Charges: {}", h.charges) : "",
|
||||||
h.attuned ? " (Attuned)" : ""
|
h.attuned ? " (Attuned)" : ""
|
||||||
);
|
);
|
||||||
|
|
||||||
|
for (int i = 0; i < h.augment_ids.size(); i++) {
|
||||||
|
if (!h.augment_names[i].empty()) {
|
||||||
|
const uint8 slot_id = (i + 1);
|
||||||
|
handin_items_info += fmt::format(
|
||||||
|
"Augment {}: {} ({})\n",
|
||||||
|
slot_id,
|
||||||
|
h.augment_names[i],
|
||||||
|
h.augment_ids[i]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -727,6 +740,18 @@ std::string PlayerEventDiscordFormatter::FormatNPCHandinEvent(
|
|||||||
r.charges > 1 ? fmt::format(" Charges: {}", r.charges) : "",
|
r.charges > 1 ? fmt::format(" Charges: {}", r.charges) : "",
|
||||||
r.attuned ? " (Attuned)" : ""
|
r.attuned ? " (Attuned)" : ""
|
||||||
);
|
);
|
||||||
|
|
||||||
|
for (int i = 0; i < r.augment_ids.size(); i++) {
|
||||||
|
if (!r.augment_names[i].empty()) {
|
||||||
|
const uint8 slot_id = (i + 1);
|
||||||
|
return_items_info += fmt::format(
|
||||||
|
"Augment {}: {} ({})\n",
|
||||||
|
slot_id,
|
||||||
|
r.augment_names[i],
|
||||||
|
r.augment_ids[i]
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1057,51 +1082,51 @@ std::string PlayerEventDiscordFormatter::FormatTradeEvent(
|
|||||||
if (!e.character_1_give_items.empty()) {
|
if (!e.character_1_give_items.empty()) {
|
||||||
for (const auto &i: e.character_1_give_items) {
|
for (const auto &i: e.character_1_give_items) {
|
||||||
std::string augment_info;
|
std::string augment_info;
|
||||||
if (i.aug_1_item_id > 0) {
|
if (i.augment_1_id > 0) {
|
||||||
augment_info += fmt::format(
|
augment_info += fmt::format(
|
||||||
"Augment 1: {} ({})",
|
"Augment 1: {} ({})",
|
||||||
i.aug_1_item_name,
|
i.augment_1_name,
|
||||||
i.aug_1_item_id
|
i.augment_1_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i.aug_2_item_id > 0) {
|
if (i.augment_2_id > 0) {
|
||||||
augment_info += fmt::format(
|
augment_info += fmt::format(
|
||||||
"Augment 2: {} ({})",
|
"Augment 2: {} ({})",
|
||||||
i.aug_2_item_name,
|
i.augment_2_name,
|
||||||
i.aug_2_item_id
|
i.augment_2_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i.aug_3_item_id > 0) {
|
if (i.augment_3_id > 0) {
|
||||||
augment_info += fmt::format(
|
augment_info += fmt::format(
|
||||||
"Augment 3: {} ({})",
|
"Augment 3: {} ({})",
|
||||||
i.aug_3_item_name,
|
i.augment_3_name,
|
||||||
i.aug_3_item_id
|
i.augment_3_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i.aug_4_item_id > 0) {
|
if (i.augment_4_id > 0) {
|
||||||
augment_info += fmt::format(
|
augment_info += fmt::format(
|
||||||
"Augment 4: {} ({})\n",
|
"Augment 4: {} ({})\n",
|
||||||
i.aug_4_item_name,
|
i.augment_4_name,
|
||||||
i.aug_4_item_id
|
i.augment_4_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i.aug_5_item_id > 0) {
|
if (i.augment_5_id > 0) {
|
||||||
augment_info += fmt::format(
|
augment_info += fmt::format(
|
||||||
"Augment 5: {} ({})\n",
|
"Augment 5: {} ({})\n",
|
||||||
i.aug_5_item_name,
|
i.augment_5_name,
|
||||||
i.aug_5_item_id
|
i.augment_5_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i.aug_6_item_id > 0) {
|
if (i.augment_6_id > 0) {
|
||||||
augment_info += fmt::format(
|
augment_info += fmt::format(
|
||||||
"Augment 6: {} ({})",
|
"Augment 6: {} ({})",
|
||||||
i.aug_6_item_name,
|
i.augment_6_name,
|
||||||
i.aug_6_item_id
|
i.augment_6_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1122,51 +1147,51 @@ std::string PlayerEventDiscordFormatter::FormatTradeEvent(
|
|||||||
if (!e.character_2_give_items.empty()) {
|
if (!e.character_2_give_items.empty()) {
|
||||||
for (const auto &i: e.character_2_give_items) {
|
for (const auto &i: e.character_2_give_items) {
|
||||||
std::string augment_info;
|
std::string augment_info;
|
||||||
if (i.aug_1_item_id > 0) {
|
if (i.augment_1_id > 0) {
|
||||||
augment_info += fmt::format(
|
augment_info += fmt::format(
|
||||||
"Augment 1: {} ({})",
|
"Augment 1: {} ({})",
|
||||||
i.aug_1_item_name,
|
i.augment_1_name,
|
||||||
i.aug_1_item_id
|
i.augment_1_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i.aug_2_item_id > 0) {
|
if (i.augment_2_id > 0) {
|
||||||
augment_info += fmt::format(
|
augment_info += fmt::format(
|
||||||
"Augment 2: {} ({})",
|
"Augment 2: {} ({})",
|
||||||
i.aug_2_item_name,
|
i.augment_2_name,
|
||||||
i.aug_2_item_id
|
i.augment_2_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i.aug_3_item_id > 0) {
|
if (i.augment_3_id > 0) {
|
||||||
augment_info += fmt::format(
|
augment_info += fmt::format(
|
||||||
"Augment 3: {} ({})",
|
"Augment 3: {} ({})",
|
||||||
i.aug_3_item_name,
|
i.augment_3_name,
|
||||||
i.aug_3_item_id
|
i.augment_3_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i.aug_4_item_id > 0) {
|
if (i.augment_4_id > 0) {
|
||||||
augment_info += fmt::format(
|
augment_info += fmt::format(
|
||||||
"Augment 4: {} ({})\n",
|
"Augment 4: {} ({})\n",
|
||||||
i.aug_4_item_name,
|
i.augment_4_name,
|
||||||
i.aug_4_item_id
|
i.augment_4_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i.aug_5_item_id > 0) {
|
if (i.augment_5_id > 0) {
|
||||||
augment_info += fmt::format(
|
augment_info += fmt::format(
|
||||||
"Augment 5: {} ({})\n",
|
"Augment 5: {} ({})\n",
|
||||||
i.aug_5_item_name,
|
i.augment_5_name,
|
||||||
i.aug_5_item_id
|
i.augment_5_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (i.aug_6_item_id > 0) {
|
if (i.augment_6_id > 0) {
|
||||||
augment_info += fmt::format(
|
augment_info += fmt::format(
|
||||||
"Augment 6: {} ({})",
|
"Augment 6: {} ({})",
|
||||||
i.aug_6_item_name,
|
i.augment_6_name,
|
||||||
i.aug_6_item_id
|
i.augment_6_id
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,14 @@
|
|||||||
#include <cereal/archives/json.hpp>
|
|
||||||
#include "player_event_logs.h"
|
#include "player_event_logs.h"
|
||||||
#include "player_event_discord_formatter.h"
|
#include <cereal/archives/json.hpp>
|
||||||
|
|
||||||
#include "../platform.h"
|
#include "../platform.h"
|
||||||
#include "../rulesys.h"
|
#include "../rulesys.h"
|
||||||
|
#include "player_event_discord_formatter.h"
|
||||||
|
#include "../repositories/player_event_loot_items_repository.h"
|
||||||
|
#include "../repositories/player_event_merchant_sell_repository.h"
|
||||||
|
#include "../repositories/player_event_merchant_purchase_repository.h"
|
||||||
|
#include "../repositories/player_event_npc_handin_repository.h"
|
||||||
|
#include "../repositories/player_event_npc_handin_entries_repository.h"
|
||||||
|
|
||||||
const uint32 PROCESS_RETENTION_TRUNCATION_TIMER_INTERVAL = 60 * 60 * 1000; // 1 hour
|
const uint32 PROCESS_RETENTION_TRUNCATION_TIMER_INTERVAL = 60 * 60 * 1000; // 1 hour
|
||||||
|
|
||||||
@@ -11,6 +17,7 @@ void PlayerEventLogs::Init()
|
|||||||
{
|
{
|
||||||
m_process_batch_events_timer.SetTimer(RuleI(Logging, BatchPlayerEventProcessIntervalSeconds) * 1000);
|
m_process_batch_events_timer.SetTimer(RuleI(Logging, BatchPlayerEventProcessIntervalSeconds) * 1000);
|
||||||
m_process_retention_truncation_timer.SetTimer(PROCESS_RETENTION_TRUNCATION_TIMER_INTERVAL);
|
m_process_retention_truncation_timer.SetTimer(PROCESS_RETENTION_TRUNCATION_TIMER_INTERVAL);
|
||||||
|
m_database_ping_timer.SetTimer(10 * 1000); // 10 seconds
|
||||||
|
|
||||||
ValidateDatabaseConnection();
|
ValidateDatabaseConnection();
|
||||||
|
|
||||||
@@ -21,6 +28,7 @@ void PlayerEventLogs::Init()
|
|||||||
m_settings[i].event_enabled = 1;
|
m_settings[i].event_enabled = 1;
|
||||||
m_settings[i].retention_days = 0;
|
m_settings[i].retention_days = 0;
|
||||||
m_settings[i].discord_webhook_id = 0;
|
m_settings[i].discord_webhook_id = 0;
|
||||||
|
m_settings[i].etl_enabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetSettingsDefaults();
|
SetSettingsDefaults();
|
||||||
@@ -65,6 +73,7 @@ void PlayerEventLogs::Init()
|
|||||||
c.event_name = PlayerEvent::EventName[i];
|
c.event_name = PlayerEvent::EventName[i];
|
||||||
c.event_enabled = m_settings[i].event_enabled;
|
c.event_enabled = m_settings[i].event_enabled;
|
||||||
c.retention_days = m_settings[i].retention_days;
|
c.retention_days = m_settings[i].retention_days;
|
||||||
|
c.etl_enabled = false;
|
||||||
settings_to_insert.emplace_back(c);
|
settings_to_insert.emplace_back(c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -78,6 +87,7 @@ void PlayerEventLogs::Init()
|
|||||||
|
|
||||||
// on initial boot process truncation
|
// on initial boot process truncation
|
||||||
if (processing_in_world || processing_in_qs) {
|
if (processing_in_world || processing_in_qs) {
|
||||||
|
LoadEtlIds();
|
||||||
ProcessRetentionTruncation();
|
ProcessRetentionTruncation();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -121,23 +131,328 @@ void PlayerEventLogs::ProcessBatchQueue()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static std::map<uint32, uint32> counter{};
|
||||||
|
counter.clear();
|
||||||
|
for (auto const &e: m_record_batch_queue) {
|
||||||
|
counter[e.event_type_id]++;
|
||||||
|
}
|
||||||
|
|
||||||
BenchTimer benchmark;
|
BenchTimer benchmark;
|
||||||
|
|
||||||
|
EtlQueues etl_queues{};
|
||||||
|
for (const auto &[type, count]: counter) {
|
||||||
|
if (count > 0) {
|
||||||
|
switch (type) {
|
||||||
|
case PlayerEvent::TRADE:
|
||||||
|
etl_queues.trade.reserve(count);
|
||||||
|
break;
|
||||||
|
case PlayerEvent::SPEECH:
|
||||||
|
etl_queues.speech.reserve(count);
|
||||||
|
break;
|
||||||
|
case PlayerEvent::LOOT_ITEM:
|
||||||
|
etl_queues.loot_items.reserve(count);
|
||||||
|
break;
|
||||||
|
case PlayerEvent::KILLED_NPC:
|
||||||
|
etl_queues.killed_npc.reserve(count);
|
||||||
|
break;
|
||||||
|
case PlayerEvent::NPC_HANDIN:
|
||||||
|
etl_queues.npc_handin.reserve(count);
|
||||||
|
break;
|
||||||
|
case PlayerEvent::AA_PURCHASE:
|
||||||
|
etl_queues.aa_purchase.reserve(count);
|
||||||
|
break;
|
||||||
|
case PlayerEvent::MERCHANT_SELL:
|
||||||
|
etl_queues.merchant_sell.reserve(count);
|
||||||
|
break;
|
||||||
|
case PlayerEvent::KILLED_RAID_NPC:
|
||||||
|
etl_queues.killed_raid_npc.reserve(count);
|
||||||
|
break;
|
||||||
|
case PlayerEvent::KILLED_NAMED_NPC:
|
||||||
|
etl_queues.killed_named_npc.reserve(count);
|
||||||
|
break;
|
||||||
|
case PlayerEvent::MERCHANT_PURCHASE:
|
||||||
|
etl_queues.merchant_purchase.reserve(count);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helper to deserialize event data
|
||||||
|
auto Deserialize = [](const std::string &data, auto &out) {
|
||||||
|
if (!Strings::IsValidJson(data)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// cpp exceptions are terrible, don't ever use them
|
||||||
|
try {
|
||||||
|
std::stringstream ss(data);
|
||||||
|
cereal::JSONInputArchive ar(ss);
|
||||||
|
out.serialize(ar);
|
||||||
|
}
|
||||||
|
catch (const std::exception &e) {}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Helper to assign ETL table ID
|
||||||
|
|
||||||
|
auto AssignEtlId = [&](
|
||||||
|
PlayerEventLogsRepository::PlayerEventLogs& r,
|
||||||
|
PlayerEvent::EventType type
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (m_etl_settings.contains(type)) {
|
||||||
|
r.etl_table_id = m_etl_settings.at(type).next_id++;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Define event processors
|
||||||
|
std::unordered_map<PlayerEvent::EventType, std::function<void(PlayerEventLogsRepository::PlayerEventLogs &)>> event_processors = {
|
||||||
|
{
|
||||||
|
PlayerEvent::EventType::LOOT_ITEM, [&](PlayerEventLogsRepository::PlayerEventLogs &r) {
|
||||||
|
PlayerEvent::LootItemEvent in{};
|
||||||
|
PlayerEventLootItemsRepository::PlayerEventLootItems out{};
|
||||||
|
Deserialize(r.event_data, in);
|
||||||
|
|
||||||
|
out.charges = in.charges;
|
||||||
|
out.corpse_name = in.corpse_name;
|
||||||
|
out.item_id = in.item_id;
|
||||||
|
out.item_name = in.item_name;
|
||||||
|
out.augment_1_id = in.augment_1_id;
|
||||||
|
out.augment_2_id = in.augment_2_id;
|
||||||
|
out.augment_3_id = in.augment_3_id;
|
||||||
|
out.augment_4_id = in.augment_4_id;
|
||||||
|
out.augment_5_id = in.augment_5_id;
|
||||||
|
out.augment_6_id = in.augment_6_id;
|
||||||
|
out.npc_id = in.npc_id;
|
||||||
|
out.created_at = r.created_at;
|
||||||
|
|
||||||
|
AssignEtlId(r, PlayerEvent::EventType::LOOT_ITEM);
|
||||||
|
etl_queues.loot_items.push_back(out);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
PlayerEvent::EventType::MERCHANT_SELL, [&](PlayerEventLogsRepository::PlayerEventLogs &r) {
|
||||||
|
PlayerEvent::MerchantSellEvent in{};
|
||||||
|
PlayerEventMerchantSellRepository::PlayerEventMerchantSell out{};
|
||||||
|
Deserialize(r.event_data, in);
|
||||||
|
|
||||||
|
out.npc_id = in.npc_id;
|
||||||
|
out.merchant_name = in.merchant_name;
|
||||||
|
out.merchant_type = in.merchant_type;
|
||||||
|
out.item_id = in.item_id;
|
||||||
|
out.item_name = in.item_name;
|
||||||
|
out.charges = in.charges;
|
||||||
|
out.cost = in.cost;
|
||||||
|
out.alternate_currency_id = in.alternate_currency_id;
|
||||||
|
out.player_money_balance = in.player_money_balance;
|
||||||
|
out.player_currency_balance = in.player_currency_balance;
|
||||||
|
out.created_at = r.created_at;
|
||||||
|
|
||||||
|
AssignEtlId(r, PlayerEvent::EventType::MERCHANT_SELL);
|
||||||
|
etl_queues.merchant_sell.push_back(out);
|
||||||
|
}},
|
||||||
|
{
|
||||||
|
PlayerEvent::EventType::MERCHANT_PURCHASE, [&](PlayerEventLogsRepository::PlayerEventLogs &r) {
|
||||||
|
PlayerEvent::MerchantPurchaseEvent in{};
|
||||||
|
PlayerEventMerchantPurchaseRepository::PlayerEventMerchantPurchase out{};
|
||||||
|
Deserialize(r.event_data, in);
|
||||||
|
|
||||||
|
out.npc_id = in.npc_id;
|
||||||
|
out.merchant_name = in.merchant_name;
|
||||||
|
out.merchant_type = in.merchant_type;
|
||||||
|
out.item_id = in.item_id;
|
||||||
|
out.item_name = in.item_name;
|
||||||
|
out.charges = in.charges;
|
||||||
|
out.cost = in.cost;
|
||||||
|
out.alternate_currency_id = in.alternate_currency_id;
|
||||||
|
out.player_money_balance = in.player_money_balance;
|
||||||
|
out.player_currency_balance = in.player_currency_balance;
|
||||||
|
out.created_at = r.created_at;
|
||||||
|
|
||||||
|
AssignEtlId(r, PlayerEvent::EventType::MERCHANT_PURCHASE);
|
||||||
|
etl_queues.merchant_purchase.push_back(out);
|
||||||
|
}},
|
||||||
|
{
|
||||||
|
PlayerEvent::EventType::NPC_HANDIN, [&](PlayerEventLogsRepository::PlayerEventLogs &r) {
|
||||||
|
PlayerEvent::HandinEvent in{};
|
||||||
|
PlayerEventNpcHandinRepository::PlayerEventNpcHandin out{};
|
||||||
|
Deserialize(r.event_data, in);
|
||||||
|
|
||||||
|
out.npc_id = in.npc_id;
|
||||||
|
out.npc_name = in.npc_name;
|
||||||
|
out.handin_copper = in.handin_money.copper;
|
||||||
|
out.handin_silver = in.handin_money.silver;
|
||||||
|
out.handin_gold = in.handin_money.gold;
|
||||||
|
out.handin_platinum = in.handin_money.platinum;
|
||||||
|
out.return_copper = in.return_money.copper;
|
||||||
|
out.return_silver = in.return_money.silver;
|
||||||
|
out.return_gold = in.return_money.gold;
|
||||||
|
out.return_platinum = in.return_money.platinum;
|
||||||
|
out.is_quest_handin = in.is_quest_handin;
|
||||||
|
out.created_at = r.created_at;
|
||||||
|
|
||||||
|
AssignEtlId(r, PlayerEvent::EventType::NPC_HANDIN);
|
||||||
|
etl_queues.npc_handin.push_back(out);
|
||||||
|
|
||||||
|
for (const auto &i: in.handin_items) {
|
||||||
|
PlayerEventNpcHandinEntriesRepository::PlayerEventNpcHandinEntries entry{};
|
||||||
|
entry.player_event_npc_handin_id = r.etl_table_id;
|
||||||
|
entry.item_id = i.item_id;
|
||||||
|
entry.charges = i.charges;
|
||||||
|
entry.type = 1;
|
||||||
|
etl_queues.npc_handin_entries.push_back(entry);
|
||||||
|
}
|
||||||
|
for (const auto &i: in.return_items) {
|
||||||
|
PlayerEventNpcHandinEntriesRepository::PlayerEventNpcHandinEntries entry{};
|
||||||
|
entry.player_event_npc_handin_id = r.etl_table_id;
|
||||||
|
entry.item_id = i.item_id;
|
||||||
|
entry.charges = i.charges;
|
||||||
|
entry.type = 2;
|
||||||
|
etl_queues.npc_handin_entries.push_back(entry);
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
{
|
||||||
|
PlayerEvent::EventType::TRADE, [&](PlayerEventLogsRepository::PlayerEventLogs &r) {
|
||||||
|
PlayerEvent::TradeEvent in{};
|
||||||
|
PlayerEventTradeRepository::PlayerEventTrade out{};
|
||||||
|
Deserialize(r.event_data, in);
|
||||||
|
|
||||||
|
out.char1_id = in.character_1_id;
|
||||||
|
out.char2_id = in.character_2_id;
|
||||||
|
out.char1_copper = in.character_1_give_money.copper;
|
||||||
|
out.char1_silver = in.character_1_give_money.silver;
|
||||||
|
out.char1_gold = in.character_1_give_money.gold;
|
||||||
|
out.char1_platinum = in.character_1_give_money.platinum;
|
||||||
|
out.char2_copper = in.character_2_give_money.copper;
|
||||||
|
out.char2_silver = in.character_2_give_money.silver;
|
||||||
|
out.char2_gold = in.character_2_give_money.gold;
|
||||||
|
out.char2_platinum = in.character_2_give_money.platinum;
|
||||||
|
out.created_at = r.created_at;
|
||||||
|
|
||||||
|
AssignEtlId(r, PlayerEvent::EventType::TRADE);
|
||||||
|
etl_queues.trade.push_back(out);
|
||||||
|
|
||||||
|
for (const auto &i: in.character_1_give_items) {
|
||||||
|
PlayerEventTradeEntriesRepository::PlayerEventTradeEntries entry{};
|
||||||
|
entry.player_event_trade_id = r.etl_table_id;
|
||||||
|
entry.char_id = in.character_1_id;
|
||||||
|
entry.item_id = i.item_id;
|
||||||
|
entry.charges = i.charges;
|
||||||
|
entry.slot = i.slot;
|
||||||
|
etl_queues.trade_entries.push_back(entry);
|
||||||
|
}
|
||||||
|
for (const auto &i: in.character_2_give_items) {
|
||||||
|
PlayerEventTradeEntriesRepository::PlayerEventTradeEntries entry{};
|
||||||
|
entry.player_event_trade_id = r.etl_table_id;
|
||||||
|
entry.char_id = in.character_2_id;
|
||||||
|
entry.item_id = i.item_id;
|
||||||
|
entry.charges = i.charges;
|
||||||
|
entry.slot = i.slot;
|
||||||
|
etl_queues.trade_entries.push_back(entry);
|
||||||
|
}
|
||||||
|
}},
|
||||||
|
{
|
||||||
|
PlayerEvent::EventType::SPEECH, [&](PlayerEventLogsRepository::PlayerEventLogs &r) {
|
||||||
|
PlayerEvent::PlayerSpeech in{};
|
||||||
|
PlayerEventSpeechRepository::PlayerEventSpeech out{};
|
||||||
|
Deserialize(r.event_data, in);
|
||||||
|
|
||||||
|
out.from_char_id = in.from;
|
||||||
|
out.to_char_id = in.to;
|
||||||
|
out.type = in.type;
|
||||||
|
out.min_status = in.min_status;
|
||||||
|
out.message = in.message;
|
||||||
|
out.guild_id = in.guild_id;
|
||||||
|
out.created_at = r.created_at;
|
||||||
|
|
||||||
|
AssignEtlId(r, PlayerEvent::EventType::SPEECH);
|
||||||
|
etl_queues.speech.push_back(out);
|
||||||
|
}},
|
||||||
|
{
|
||||||
|
PlayerEvent::EventType::KILLED_NPC, [&](PlayerEventLogsRepository::PlayerEventLogs &r) {
|
||||||
|
PlayerEvent::KilledNPCEvent in{};
|
||||||
|
PlayerEventKilledNpcRepository::PlayerEventKilledNpc out{};
|
||||||
|
Deserialize(r.event_data, in);
|
||||||
|
|
||||||
|
out.npc_id = in.npc_id;
|
||||||
|
out.npc_name = in.npc_name;
|
||||||
|
out.combat_time_seconds = in.combat_time_seconds;
|
||||||
|
out.total_damage_per_second_taken = in.total_damage_per_second_taken;
|
||||||
|
out.total_heal_per_second_taken = in.total_heal_per_second_taken;
|
||||||
|
out.created_at = r.created_at;
|
||||||
|
|
||||||
|
AssignEtlId(r, PlayerEvent::EventType::KILLED_NPC);
|
||||||
|
etl_queues.killed_npc.push_back(out);
|
||||||
|
}},
|
||||||
|
{
|
||||||
|
PlayerEvent::EventType::AA_PURCHASE, [&](PlayerEventLogsRepository::PlayerEventLogs &r) {
|
||||||
|
PlayerEvent::AAPurchasedEvent in{};
|
||||||
|
PlayerEventAaPurchaseRepository::PlayerEventAaPurchase out{};
|
||||||
|
Deserialize(r.event_data, in);
|
||||||
|
|
||||||
|
out.aa_ability_id = in.aa_id;
|
||||||
|
out.cost = in.aa_cost;
|
||||||
|
out.previous_id = in.aa_previous_id;
|
||||||
|
out.next_id = in.aa_next_id;
|
||||||
|
out.created_at = r.created_at;
|
||||||
|
|
||||||
|
AssignEtlId(r, PlayerEvent::EventType::AA_PURCHASE);
|
||||||
|
etl_queues.aa_purchase.push_back(out);
|
||||||
|
}},
|
||||||
|
};
|
||||||
|
|
||||||
|
// Process the batch queue
|
||||||
|
for (auto &r: m_record_batch_queue) {
|
||||||
|
if (m_settings[r.event_type_id].etl_enabled) {
|
||||||
|
auto it = event_processors.find(static_cast<PlayerEvent::EventType>(r.event_type_id));
|
||||||
|
if (it != event_processors.end()) {
|
||||||
|
it->second(r); // Call the appropriate lambda
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LogPlayerEventsDetail("Non-Implemented ETL routing [{}]", r.event_type_id);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Helper to flush and clear queues
|
||||||
|
auto flush_queue = [&](auto insert_many, auto &queue) {
|
||||||
|
if (!queue.empty()) {
|
||||||
|
insert_many(*m_database, queue);
|
||||||
|
queue.clear();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
// flush many
|
// flush many
|
||||||
PlayerEventLogsRepository::InsertMany(*m_database, m_record_batch_queue);
|
PlayerEventLogsRepository::InsertMany(*m_database, m_record_batch_queue);
|
||||||
LogPlayerEventsDetail(
|
|
||||||
|
// flush etl queues
|
||||||
|
flush_queue(PlayerEventLootItemsRepository::InsertMany, etl_queues.loot_items);
|
||||||
|
flush_queue(PlayerEventMerchantSellRepository::InsertMany, etl_queues.merchant_sell);
|
||||||
|
flush_queue(PlayerEventMerchantPurchaseRepository::InsertMany, etl_queues.merchant_purchase);
|
||||||
|
flush_queue(PlayerEventNpcHandinRepository::InsertMany, etl_queues.npc_handin);
|
||||||
|
flush_queue(PlayerEventNpcHandinEntriesRepository::InsertMany, etl_queues.npc_handin_entries);
|
||||||
|
flush_queue(PlayerEventTradeRepository::InsertMany, etl_queues.trade);
|
||||||
|
flush_queue(PlayerEventTradeEntriesRepository::InsertMany, etl_queues.trade_entries);
|
||||||
|
flush_queue(PlayerEventSpeechRepository::InsertMany, etl_queues.speech);
|
||||||
|
flush_queue(PlayerEventKilledNpcRepository::InsertMany, etl_queues.killed_npc);
|
||||||
|
flush_queue(PlayerEventKilledNamedNpcRepository::InsertMany, etl_queues.killed_named_npc);
|
||||||
|
flush_queue(PlayerEventKilledRaidNpcRepository::InsertMany, etl_queues.killed_raid_npc);
|
||||||
|
flush_queue(PlayerEventAaPurchaseRepository::InsertMany, etl_queues.aa_purchase);
|
||||||
|
|
||||||
|
LogPlayerEvents(
|
||||||
"Processing batch player event log queue of [{}] took [{}]",
|
"Processing batch player event log queue of [{}] took [{}]",
|
||||||
m_record_batch_queue.size(),
|
m_record_batch_queue.size(),
|
||||||
benchmark.elapsed()
|
benchmark.elapsed()
|
||||||
);
|
);
|
||||||
|
|
||||||
// empty
|
// empty
|
||||||
m_record_batch_queue = {};
|
m_record_batch_queue.clear();
|
||||||
m_batch_queue_lock.unlock();
|
m_batch_queue_lock.unlock();
|
||||||
}
|
}
|
||||||
|
|
||||||
// adds a player event to the queue
|
// adds a player event to the queue
|
||||||
void PlayerEventLogs::AddToQueue(const PlayerEventLogsRepository::PlayerEventLogs &log)
|
void PlayerEventLogs::AddToQueue(PlayerEventLogsRepository::PlayerEventLogs &log)
|
||||||
{
|
{
|
||||||
m_batch_queue_lock.lock();
|
m_batch_queue_lock.lock();
|
||||||
m_record_batch_queue.emplace_back(log);
|
m_record_batch_queue.emplace_back(log);
|
||||||
@@ -194,7 +509,7 @@ bool PlayerEventLogs::IsEventDiscordEnabled(int32_t event_type_id)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ensure there is a matching webhook to begin with
|
// ensure there is a matching webhook to begin with
|
||||||
if (!LogSys.GetDiscordWebhooks()[m_settings[event_type_id].discord_webhook_id].webhook_url.empty()) {
|
if (!EQEmuLogSys::Instance()->GetDiscordWebhooks()[m_settings[event_type_id].discord_webhook_id].webhook_url.empty()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,13 +529,27 @@ std::string PlayerEventLogs::GetDiscordWebhookUrlFromEventType(int32_t event_typ
|
|||||||
}
|
}
|
||||||
|
|
||||||
// ensure there is a matching webhook to begin with
|
// ensure there is a matching webhook to begin with
|
||||||
if (!LogSys.GetDiscordWebhooks()[m_settings[event_type_id].discord_webhook_id].webhook_url.empty()) {
|
if (!EQEmuLogSys::Instance()->GetDiscordWebhooks()[m_settings[event_type_id].discord_webhook_id].webhook_url.empty()) {
|
||||||
return LogSys.GetDiscordWebhooks()[m_settings[event_type_id].discord_webhook_id].webhook_url;
|
return EQEmuLogSys::Instance()->GetDiscordWebhooks()[m_settings[event_type_id].discord_webhook_id].webhook_url;
|
||||||
}
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlayerEventLogs::LoadPlayerEventSettingsFromQS(
|
||||||
|
const std::vector<PlayerEventLogSettingsRepository::PlayerEventLogSettings> &settings
|
||||||
|
)
|
||||||
|
{
|
||||||
|
for (const auto &e : settings) {
|
||||||
|
if (e.id >= PlayerEvent::MAX || e.id < 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
m_settings[e.id] = e;
|
||||||
|
}
|
||||||
|
|
||||||
|
LogInfo("Applied [{}] player event log settings from QS", settings.size());
|
||||||
|
}
|
||||||
|
|
||||||
// GM_COMMAND | [x] Implemented Formatter
|
// GM_COMMAND | [x] Implemented Formatter
|
||||||
// ZONING | [x] Implemented Formatter
|
// ZONING | [x] Implemented Formatter
|
||||||
// AA_GAIN | [x] Implemented Formatter
|
// AA_GAIN | [x] Implemented Formatter
|
||||||
@@ -588,7 +917,7 @@ std::string PlayerEventLogs::GetDiscordPayloadFromEvent(const PlayerEvent::Playe
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
LogInfo(
|
LogPlayerEventsDetail(
|
||||||
"Player event [{}] ({}) Discord formatter not implemented",
|
"Player event [{}] ({}) Discord formatter not implemented",
|
||||||
e.player_event_log.event_type_name,
|
e.player_event_log.event_type_name,
|
||||||
e.player_event_log.event_type_id
|
e.player_event_log.event_type_id
|
||||||
@@ -602,7 +931,12 @@ std::string PlayerEventLogs::GetDiscordPayloadFromEvent(const PlayerEvent::Playe
|
|||||||
// general process function, used in world or QS depending on rule Logging:PlayerEventsQSProcess
|
// general process function, used in world or QS depending on rule Logging:PlayerEventsQSProcess
|
||||||
void PlayerEventLogs::Process()
|
void PlayerEventLogs::Process()
|
||||||
{
|
{
|
||||||
if (m_process_batch_events_timer.Check() || m_record_batch_queue.size() >= RuleI(Logging, BatchPlayerEventProcessChunkSize)) {
|
if (m_database_ping_timer.Check()) {
|
||||||
|
m_database->ping();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_process_batch_events_timer.Check() ||
|
||||||
|
m_record_batch_queue.size() >= RuleI(Logging, BatchPlayerEventProcessChunkSize)) {
|
||||||
ProcessBatchQueue();
|
ProcessBatchQueue();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -613,31 +947,117 @@ void PlayerEventLogs::Process()
|
|||||||
|
|
||||||
void PlayerEventLogs::ProcessRetentionTruncation()
|
void PlayerEventLogs::ProcessRetentionTruncation()
|
||||||
{
|
{
|
||||||
LogPlayerEvents("Running truncation");
|
LogPlayerEventsDetail("Running truncation");
|
||||||
|
|
||||||
|
// Map of repository-specific deletion functions
|
||||||
|
std::unordered_map<PlayerEvent::EventType, std::function<uint32(const std::string &)>> repository_deleters = {
|
||||||
|
{
|
||||||
|
PlayerEvent::LOOT_ITEM, [&](const std::string &condition) {
|
||||||
|
return PlayerEventLootItemsRepository::DeleteWhere(*m_database, condition);
|
||||||
|
}},
|
||||||
|
{
|
||||||
|
PlayerEvent::MERCHANT_SELL, [&](const std::string &condition) {
|
||||||
|
return PlayerEventMerchantSellRepository::DeleteWhere(*m_database, condition);
|
||||||
|
}},
|
||||||
|
{
|
||||||
|
PlayerEvent::MERCHANT_PURCHASE, [&](const std::string &condition) {
|
||||||
|
return PlayerEventMerchantPurchaseRepository::DeleteWhere(*m_database, condition);
|
||||||
|
}},
|
||||||
|
{
|
||||||
|
PlayerEvent::NPC_HANDIN, [&](const std::string &condition) {
|
||||||
|
uint32 deleted_count = PlayerEventNpcHandinRepository::DeleteWhere(*m_database, condition);
|
||||||
|
deleted_count += PlayerEventNpcHandinEntriesRepository::DeleteWhere(*m_database, condition);
|
||||||
|
return deleted_count;
|
||||||
|
}},
|
||||||
|
{
|
||||||
|
PlayerEvent::TRADE, [&](const std::string &condition) {
|
||||||
|
uint32 deleted_count = PlayerEventTradeRepository::DeleteWhere(*m_database, condition);
|
||||||
|
deleted_count += PlayerEventTradeEntriesRepository::DeleteWhere(*m_database, condition);
|
||||||
|
return deleted_count;
|
||||||
|
}},
|
||||||
|
{
|
||||||
|
PlayerEvent::SPEECH, [&](const std::string &condition) {
|
||||||
|
return PlayerEventSpeechRepository::DeleteWhere(*m_database, condition);
|
||||||
|
}},
|
||||||
|
{
|
||||||
|
PlayerEvent::KILLED_NPC, [&](const std::string &condition) {
|
||||||
|
return PlayerEventKilledNpcRepository::DeleteWhere(*m_database, condition);
|
||||||
|
}},
|
||||||
|
{
|
||||||
|
PlayerEvent::KILLED_NAMED_NPC, [&](const std::string &condition) {
|
||||||
|
return PlayerEventKilledNamedNpcRepository::DeleteWhere(*m_database, condition);
|
||||||
|
}},
|
||||||
|
{
|
||||||
|
PlayerEvent::KILLED_RAID_NPC, [&](const std::string &condition) {
|
||||||
|
return PlayerEventKilledRaidNpcRepository::DeleteWhere(*m_database, condition);
|
||||||
|
}},
|
||||||
|
{
|
||||||
|
PlayerEvent::AA_PURCHASE, [&](const std::string &condition) {
|
||||||
|
return PlayerEventAaPurchaseRepository::DeleteWhere(*m_database, condition);
|
||||||
|
}}
|
||||||
|
};
|
||||||
|
|
||||||
|
// Group event types by retention interval
|
||||||
|
std::unordered_map<int, std::vector<int>> retention_groups;
|
||||||
for (int i = PlayerEvent::GM_COMMAND; i != PlayerEvent::MAX; i++) {
|
for (int i = PlayerEvent::GM_COMMAND; i != PlayerEvent::MAX; i++) {
|
||||||
if (m_settings[i].retention_days > 0) {
|
if (m_settings[i].retention_days > 0) {
|
||||||
int deleted_count = PlayerEventLogsRepository::DeleteWhere(
|
retention_groups[m_settings[i].retention_days].push_back(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for (const auto &[retention_days, event_types]: retention_groups) {
|
||||||
|
std::string condition = fmt::format(
|
||||||
|
"created_at < (NOW() - INTERVAL {} DAY)",
|
||||||
|
retention_days
|
||||||
|
);
|
||||||
|
|
||||||
|
// Handle ETL deletions for each event type in the group
|
||||||
|
uint32 total_deleted_count = 0;
|
||||||
|
for (int event_type_id: event_types) {
|
||||||
|
if (m_settings[event_type_id].etl_enabled) {
|
||||||
|
auto it = repository_deleters.find(static_cast<PlayerEvent::EventType>(m_settings[event_type_id].id));
|
||||||
|
if (it != repository_deleters.end()) {
|
||||||
|
total_deleted_count += it->second(condition);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
LogError("Non-Implemented ETL Event Type [{}]", static_cast<uint32>(m_settings[event_type_id].id));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (total_deleted_count > 0) {
|
||||||
|
LogInfo(
|
||||||
|
"Truncated [{}] ETL events older than [{}] days",
|
||||||
|
total_deleted_count,
|
||||||
|
retention_days
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Batch deletion for player_event_logs
|
||||||
|
std::string event_type_ids = fmt::format(
|
||||||
|
"({})",
|
||||||
|
fmt::join(event_types, ", ")
|
||||||
|
);
|
||||||
|
|
||||||
|
uint32 deleted_count = PlayerEventLogsRepository::DeleteWhere(
|
||||||
*m_database,
|
*m_database,
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"event_type_id = {} AND created_at < (NOW() - INTERVAL {} DAY)",
|
"event_type_id IN {} AND {}",
|
||||||
i,
|
event_type_ids,
|
||||||
m_settings[i].retention_days
|
condition
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (deleted_count > 0) {
|
if (deleted_count > 0) {
|
||||||
LogInfo(
|
LogInfo(
|
||||||
"Truncated [{}] events of type [{}] ({}) older than [{}] days",
|
"Truncated [{}] events of types [{}] older than [{}] days",
|
||||||
deleted_count,
|
deleted_count,
|
||||||
PlayerEvent::EventName[i],
|
event_type_ids,
|
||||||
i,
|
retention_days
|
||||||
m_settings[i].retention_days
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
void PlayerEventLogs::ReloadSettings()
|
void PlayerEventLogs::ReloadSettings()
|
||||||
{
|
{
|
||||||
@@ -708,8 +1128,143 @@ void PlayerEventLogs::SetSettingsDefaults()
|
|||||||
m_settings[PlayerEvent::PARCEL_DELETE].event_enabled = 1;
|
m_settings[PlayerEvent::PARCEL_DELETE].event_enabled = 1;
|
||||||
m_settings[PlayerEvent::BARTER_TRANSACTION].event_enabled = 1;
|
m_settings[PlayerEvent::BARTER_TRANSACTION].event_enabled = 1;
|
||||||
m_settings[PlayerEvent::EVOLVE_ITEM].event_enabled = 1;
|
m_settings[PlayerEvent::EVOLVE_ITEM].event_enabled = 1;
|
||||||
|
m_settings[PlayerEvent::SPEECH].event_enabled = 0;
|
||||||
|
|
||||||
for (int i = PlayerEvent::GM_COMMAND; i != PlayerEvent::MAX; i++) {
|
for (int i = PlayerEvent::GM_COMMAND; i != PlayerEvent::MAX; i++) {
|
||||||
m_settings[i].retention_days = RETENTION_DAYS_DEFAULT;
|
m_settings[i].retention_days = RETENTION_DAYS_DEFAULT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PlayerEventLogs::LoadEtlIds()
|
||||||
|
{
|
||||||
|
auto e = [&](auto p) -> bool {
|
||||||
|
for (PlayerEventLogSettingsRepository::PlayerEventLogSettings const &c: m_settings) {
|
||||||
|
if (c.id == p) {
|
||||||
|
return c.etl_enabled ? true : false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
|
||||||
|
m_etl_settings.clear();
|
||||||
|
m_etl_settings = {
|
||||||
|
{
|
||||||
|
PlayerEvent::LOOT_ITEM,
|
||||||
|
{
|
||||||
|
.enabled = e(PlayerEvent::LOOT_ITEM),
|
||||||
|
.table_name = "player_event_loot_items",
|
||||||
|
.next_id = static_cast<int64>(m_database->GetNextTableId(PlayerEventLootItemsRepository::TableName()))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
PlayerEvent::MERCHANT_SELL,
|
||||||
|
{
|
||||||
|
.enabled = e(PlayerEvent::MERCHANT_SELL),
|
||||||
|
.table_name = "player_event_merchant_sell",
|
||||||
|
.next_id = static_cast<int64>(m_database->GetNextTableId(PlayerEventMerchantSellRepository::TableName()))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
PlayerEvent::MERCHANT_PURCHASE,
|
||||||
|
{
|
||||||
|
.enabled = e(PlayerEvent::MERCHANT_PURCHASE),
|
||||||
|
.table_name = "player_event_merchant_purchase",
|
||||||
|
.next_id = static_cast<int64>(m_database->GetNextTableId(PlayerEventMerchantPurchaseRepository::TableName()))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
PlayerEvent::NPC_HANDIN,
|
||||||
|
{
|
||||||
|
.enabled = e(PlayerEvent::NPC_HANDIN),
|
||||||
|
.table_name = "player_event_npc_handin",
|
||||||
|
.next_id = static_cast<int64>(m_database->GetNextTableId(PlayerEventNpcHandinRepository::TableName()))
|
||||||
|
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
PlayerEvent::TRADE,
|
||||||
|
{
|
||||||
|
.enabled = e(PlayerEvent::TRADE),
|
||||||
|
.table_name = "player_event_trade",
|
||||||
|
.next_id = static_cast<int64>(m_database->GetNextTableId(PlayerEventTradeRepository::TableName()))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
PlayerEvent::SPEECH,
|
||||||
|
{
|
||||||
|
.enabled = e(PlayerEvent::SPEECH),
|
||||||
|
.table_name = "player_event_speech",
|
||||||
|
.next_id = static_cast<int64>(m_database->GetNextTableId(PlayerEventSpeechRepository::TableName()))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
PlayerEvent::KILLED_NPC,
|
||||||
|
{
|
||||||
|
.enabled = e(PlayerEvent::KILLED_NPC),
|
||||||
|
.table_name = "player_event_killed_npc",
|
||||||
|
.next_id = static_cast<int64>(m_database->GetNextTableId(PlayerEventKilledNpcRepository::TableName()))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
PlayerEvent::KILLED_NAMED_NPC,
|
||||||
|
{
|
||||||
|
.enabled = e(PlayerEvent::KILLED_NAMED_NPC),
|
||||||
|
.table_name = "player_event_killed_named_npc",
|
||||||
|
.next_id = static_cast<int64>(m_database->GetNextTableId(PlayerEventKilledNamedNpcRepository::TableName()))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
PlayerEvent::KILLED_RAID_NPC,
|
||||||
|
{
|
||||||
|
.enabled = e(PlayerEvent::KILLED_RAID_NPC),
|
||||||
|
.table_name = "player_event_killed_raid_npc",
|
||||||
|
.next_id = static_cast<int64>(m_database->GetNextTableId(PlayerEventKilledRaidNpcRepository::TableName()))
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
PlayerEvent::AA_PURCHASE,
|
||||||
|
{
|
||||||
|
.enabled = e(PlayerEvent::AA_PURCHASE),
|
||||||
|
.table_name = "player_event_aa_purchase",
|
||||||
|
.next_id = static_cast<int64>(m_database->GetNextTableId(PlayerEventAaPurchaseRepository::TableName()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
for (auto &e: m_etl_settings) {
|
||||||
|
LogPlayerEventsDetail(
|
||||||
|
"ETL Settings [{}] Enabled [{}] Table [{}] NextId [{}]",
|
||||||
|
PlayerEvent::EventName[e.first],
|
||||||
|
e.second.enabled,
|
||||||
|
e.second.table_name,
|
||||||
|
e.second.next_id
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool PlayerEventLogs::LoadDatabaseConnection()
|
||||||
|
{
|
||||||
|
const auto c = EQEmuConfig::get();
|
||||||
|
|
||||||
|
LogInfo(
|
||||||
|
"Connecting to MySQL for PlayerEvents [{}]@[{}]:[{}]",
|
||||||
|
c->DatabaseUsername.c_str(),
|
||||||
|
c->DatabaseHost.c_str(),
|
||||||
|
c->DatabasePort
|
||||||
|
);
|
||||||
|
|
||||||
|
if (!player_event_database.Connect(
|
||||||
|
c->DatabaseHost.c_str(),
|
||||||
|
c->DatabaseUsername.c_str(),
|
||||||
|
c->DatabasePassword.c_str(),
|
||||||
|
c->DatabaseDB.c_str(),
|
||||||
|
c->DatabasePort
|
||||||
|
)) {
|
||||||
|
LogError("Cannot continue without a database connection for player events.");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetDatabase(&player_event_database);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,19 +1,38 @@
|
|||||||
#ifndef EQEMU_PLAYER_EVENT_LOGS_H
|
#ifndef EQEMU_PLAYER_EVENT_LOGS_H
|
||||||
#define EQEMU_PLAYER_EVENT_LOGS_H
|
#define EQEMU_PLAYER_EVENT_LOGS_H
|
||||||
|
|
||||||
#include "../repositories/player_event_log_settings_repository.h"
|
|
||||||
#include "player_events.h"
|
|
||||||
#include "../servertalk.h"
|
|
||||||
#include "../repositories/player_event_logs_repository.h"
|
|
||||||
#include "../timer.h"
|
|
||||||
#include "../json/json_archive_single_line.h"
|
|
||||||
#include <cereal/archives/json.hpp>
|
#include <cereal/archives/json.hpp>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
#include "../json/json_archive_single_line.h"
|
||||||
|
#include "../servertalk.h"
|
||||||
|
#include "../timer.h"
|
||||||
|
#include "../eqemu_config.h"
|
||||||
|
|
||||||
|
#include "../repositories/player_event_log_settings_repository.h"
|
||||||
|
#include "../repositories/player_event_logs_repository.h"
|
||||||
|
#include "../repositories/player_event_loot_items_repository.h"
|
||||||
|
#include "../repositories/player_event_merchant_purchase_repository.h"
|
||||||
|
#include "../repositories/player_event_merchant_sell_repository.h"
|
||||||
|
#include "../repositories/player_event_npc_handin_repository.h"
|
||||||
|
#include "../repositories/player_event_npc_handin_entries_repository.h"
|
||||||
|
#include "../repositories/player_event_trade_repository.h"
|
||||||
|
#include "../repositories/player_event_trade_entries_repository.h"
|
||||||
|
#include "../repositories/player_event_speech_repository.h"
|
||||||
|
#include "../repositories/player_event_killed_npc_repository.h"
|
||||||
|
#include "../repositories/player_event_killed_named_npc_repository.h"
|
||||||
|
#include "../repositories/player_event_killed_raid_npc_repository.h"
|
||||||
|
#include "../repositories/player_event_aa_purchase_repository.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class PlayerEventLogs {
|
class PlayerEventLogs {
|
||||||
public:
|
public:
|
||||||
|
Database player_event_database{};
|
||||||
|
|
||||||
void Init();
|
void Init();
|
||||||
|
bool LoadDatabaseConnection();
|
||||||
void ReloadSettings();
|
void ReloadSettings();
|
||||||
|
void LoadEtlIds();
|
||||||
PlayerEventLogs *SetDatabase(Database *db);
|
PlayerEventLogs *SetDatabase(Database *db);
|
||||||
bool ValidateDatabaseConnection();
|
bool ValidateDatabaseConnection();
|
||||||
bool IsEventEnabled(PlayerEvent::EventType event);
|
bool IsEventEnabled(PlayerEvent::EventType event);
|
||||||
@@ -21,7 +40,7 @@ public:
|
|||||||
void Process();
|
void Process();
|
||||||
|
|
||||||
// batch queue
|
// batch queue
|
||||||
void AddToQueue(const PlayerEventLogsRepository::PlayerEventLogs &logs);
|
void AddToQueue(PlayerEventLogsRepository::PlayerEventLogs &logs);
|
||||||
|
|
||||||
// main event record generic function
|
// main event record generic function
|
||||||
// can ingest any struct event types
|
// can ingest any struct event types
|
||||||
@@ -58,8 +77,38 @@ public:
|
|||||||
bool IsEventDiscordEnabled(int32_t event_type_id);
|
bool IsEventDiscordEnabled(int32_t event_type_id);
|
||||||
std::string GetDiscordWebhookUrlFromEventType(int32_t event_type_id);
|
std::string GetDiscordWebhookUrlFromEventType(int32_t event_type_id);
|
||||||
|
|
||||||
|
void LoadPlayerEventSettingsFromQS(const std::vector<PlayerEventLogSettingsRepository::PlayerEventLogSettings>& settings);
|
||||||
|
|
||||||
static std::string GetDiscordPayloadFromEvent(const PlayerEvent::PlayerEventContainer &e);
|
static std::string GetDiscordPayloadFromEvent(const PlayerEvent::PlayerEventContainer &e);
|
||||||
|
|
||||||
|
struct EtlQueues {
|
||||||
|
std::vector<PlayerEventLootItemsRepository::PlayerEventLootItems> loot_items;
|
||||||
|
std::vector<PlayerEventMerchantPurchaseRepository::PlayerEventMerchantPurchase> merchant_purchase;
|
||||||
|
std::vector<PlayerEventMerchantSellRepository::PlayerEventMerchantSell> merchant_sell;
|
||||||
|
std::vector<PlayerEventNpcHandinRepository::PlayerEventNpcHandin> npc_handin;
|
||||||
|
std::vector<PlayerEventNpcHandinEntriesRepository::PlayerEventNpcHandinEntries> npc_handin_entries;
|
||||||
|
std::vector<PlayerEventTradeRepository::PlayerEventTrade> trade;
|
||||||
|
std::vector<PlayerEventTradeEntriesRepository::PlayerEventTradeEntries> trade_entries;
|
||||||
|
std::vector<PlayerEventSpeechRepository::PlayerEventSpeech> speech;
|
||||||
|
std::vector<PlayerEventKilledNpcRepository::PlayerEventKilledNpc> killed_npc;
|
||||||
|
std::vector<PlayerEventKilledNamedNpcRepository::PlayerEventKilledNamedNpc> killed_named_npc;
|
||||||
|
std::vector<PlayerEventKilledRaidNpcRepository::PlayerEventKilledRaidNpc> killed_raid_npc;
|
||||||
|
std::vector<PlayerEventAaPurchaseRepository::PlayerEventAaPurchase> aa_purchase;
|
||||||
|
};
|
||||||
|
|
||||||
|
static PlayerEventLogs* Instance()
|
||||||
|
{
|
||||||
|
static PlayerEventLogs instance;
|
||||||
|
return &instance;
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
struct EtlSettings {
|
||||||
|
bool enabled;
|
||||||
|
std::string table_name;
|
||||||
|
int64 next_id;
|
||||||
|
};
|
||||||
|
|
||||||
Database *m_database; // reference to database
|
Database *m_database; // reference to database
|
||||||
PlayerEventLogSettingsRepository::PlayerEventLogSettings m_settings[PlayerEvent::EventType::MAX]{};
|
PlayerEventLogSettingsRepository::PlayerEventLogSettings m_settings[PlayerEvent::EventType::MAX]{};
|
||||||
|
|
||||||
@@ -69,7 +118,10 @@ private:
|
|||||||
static std::unique_ptr<ServerPacket>
|
static std::unique_ptr<ServerPacket>
|
||||||
BuildPlayerEventPacket(const PlayerEvent::PlayerEventContainer &e);
|
BuildPlayerEventPacket(const PlayerEvent::PlayerEventContainer &e);
|
||||||
|
|
||||||
|
std::map<PlayerEvent::EventType, EtlSettings> m_etl_settings{};
|
||||||
|
|
||||||
// timers
|
// timers
|
||||||
|
Timer m_database_ping_timer; // database ping timer
|
||||||
Timer m_process_batch_events_timer; // events processing timer
|
Timer m_process_batch_events_timer; // events processing timer
|
||||||
Timer m_process_retention_truncation_timer; // timer for truncating events based on retention settings
|
Timer m_process_retention_truncation_timer; // timer for truncating events based on retention settings
|
||||||
|
|
||||||
@@ -78,8 +130,9 @@ private:
|
|||||||
void ProcessBatchQueue();
|
void ProcessBatchQueue();
|
||||||
void ProcessRetentionTruncation();
|
void ProcessRetentionTruncation();
|
||||||
void SetSettingsDefaults();
|
void SetSettingsDefaults();
|
||||||
|
|
||||||
|
public:
|
||||||
|
std::map<PlayerEvent::EventType, EtlSettings> &GetEtlSettings() { return m_etl_settings;}
|
||||||
};
|
};
|
||||||
|
|
||||||
extern PlayerEventLogs player_event_logs;
|
|
||||||
|
|
||||||
#endif //EQEMU_PLAYER_EVENT_LOGS_H
|
#endif //EQEMU_PLAYER_EVENT_LOGS_H
|
||||||
|
|||||||
+749
-116
File diff suppressed because it is too large
Load Diff
+45
-18
@@ -21,8 +21,8 @@ void EvolvingItemsManager::LoadEvolvingItems() const
|
|||||||
results.begin(),
|
results.begin(),
|
||||||
results.end(),
|
results.end(),
|
||||||
std::inserter(
|
std::inserter(
|
||||||
evolving_items_manager.GetEvolvingItemsCache(),
|
EvolvingItemsManager::Instance()->GetEvolvingItemsCache(),
|
||||||
evolving_items_manager.GetEvolvingItemsCache().end()
|
EvolvingItemsManager::Instance()->GetEvolvingItemsCache().end()
|
||||||
),
|
),
|
||||||
[](const ItemsEvolvingDetailsRepository::ItemsEvolvingDetails &x) {
|
[](const ItemsEvolvingDetailsRepository::ItemsEvolvingDetails &x) {
|
||||||
return std::make_pair(x.item_id, x);
|
return std::make_pair(x.item_id, x);
|
||||||
@@ -42,18 +42,22 @@ void EvolvingItemsManager::SetContentDatabase(Database *db)
|
|||||||
|
|
||||||
double EvolvingItemsManager::CalculateProgression(const uint64 current_amount, const uint32 item_id)
|
double EvolvingItemsManager::CalculateProgression(const uint64 current_amount, const uint32 item_id)
|
||||||
{
|
{
|
||||||
if (!evolving_items_manager.GetEvolvingItemsCache().contains(item_id)) {
|
if (!EvolvingItemsManager::Instance()->GetEvolvingItemsCache().contains(item_id)) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
return evolving_items_manager.GetEvolvingItemsCache().at(item_id).required_amount > 0
|
return EvolvingItemsManager::Instance()->GetEvolvingItemsCache().at(item_id).required_amount > 0
|
||||||
? static_cast<double>(current_amount)
|
? static_cast<double>(current_amount)
|
||||||
/ static_cast<double>(evolving_items_manager.GetEvolvingItemsCache().at(item_id).required_amount) * 100
|
/ static_cast<double>(EvolvingItemsManager::Instance()->GetEvolvingItemsCache().at(item_id).required_amount) * 100
|
||||||
: 0;
|
: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EvolvingItemsManager::DoLootChecks(const uint32 char_id, const uint16 slot_id, const EQ::ItemInstance &inst) const
|
void EvolvingItemsManager::DoLootChecks(const uint32 char_id, const uint16 slot_id, const EQ::ItemInstance &inst) const
|
||||||
{
|
{
|
||||||
|
if (!inst) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
inst.SetEvolveEquipped(false);
|
inst.SetEvolveEquipped(false);
|
||||||
if (inst.IsEvolving() && slot_id <= EQ::invslot::EQUIPMENT_END && slot_id >= EQ::invslot::EQUIPMENT_BEGIN) {
|
if (inst.IsEvolving() && slot_id <= EQ::invslot::EQUIPMENT_END && slot_id >= EQ::invslot::EQUIPMENT_BEGIN) {
|
||||||
inst.SetEvolveEquipped(true);
|
inst.SetEvolveEquipped(true);
|
||||||
@@ -69,7 +73,11 @@ void EvolvingItemsManager::DoLootChecks(const uint32 char_id, const uint16 slot_
|
|||||||
e.character_id = char_id;
|
e.character_id = char_id;
|
||||||
e.item_id = inst.GetID();
|
e.item_id = inst.GetID();
|
||||||
e.equipped = inst.GetEvolveEquipped();
|
e.equipped = inst.GetEvolveEquipped();
|
||||||
e.final_item_id = evolving_items_manager.GetFinalItemID(inst);
|
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);
|
auto r = CharacterEvolvingItemsRepository::InsertOne(*m_db, e);
|
||||||
e.id = r.id;
|
e.id = r.id;
|
||||||
@@ -87,21 +95,25 @@ void EvolvingItemsManager::DoLootChecks(const uint32 char_id, const uint16 slot_
|
|||||||
|
|
||||||
uint32 EvolvingItemsManager::GetFinalItemID(const EQ::ItemInstance &inst) const
|
uint32 EvolvingItemsManager::GetFinalItemID(const EQ::ItemInstance &inst) const
|
||||||
{
|
{
|
||||||
|
if (!inst) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
const auto start_iterator = std::ranges::find_if(
|
const auto start_iterator = std::ranges::find_if(
|
||||||
evolving_items_manager.GetEvolvingItemsCache().cbegin(),
|
EvolvingItemsManager::Instance()->GetEvolvingItemsCache().cbegin(),
|
||||||
evolving_items_manager.GetEvolvingItemsCache().cend(),
|
EvolvingItemsManager::Instance()->GetEvolvingItemsCache().cend(),
|
||||||
[&](const std::pair<uint32, ItemsEvolvingDetailsRepository::ItemsEvolvingDetails> &a) {
|
[&](const std::pair<uint32, ItemsEvolvingDetailsRepository::ItemsEvolvingDetails> &a) {
|
||||||
return a.second.item_evo_id == inst.GetEvolveLoreID();
|
return a.second.item_evo_id == inst.GetEvolveLoreID();
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (start_iterator == std::end(evolving_items_manager.GetEvolvingItemsCache())) {
|
if (start_iterator == std::end(EvolvingItemsManager::Instance()->GetEvolvingItemsCache())) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const auto final_id = std::ranges::max_element(
|
const auto final_id = std::ranges::max_element(
|
||||||
start_iterator,
|
start_iterator,
|
||||||
evolving_items_manager.GetEvolvingItemsCache().cend(),
|
EvolvingItemsManager::Instance()->GetEvolvingItemsCache().cend(),
|
||||||
[&](
|
[&](
|
||||||
const std::pair<uint32, ItemsEvolvingDetailsRepository::ItemsEvolvingDetails> &a,
|
const std::pair<uint32, ItemsEvolvingDetailsRepository::ItemsEvolvingDetails> &a,
|
||||||
const std::pair<uint32, ItemsEvolvingDetailsRepository::ItemsEvolvingDetails> &b
|
const std::pair<uint32, ItemsEvolvingDetailsRepository::ItemsEvolvingDetails> &b
|
||||||
@@ -116,18 +128,22 @@ uint32 EvolvingItemsManager::GetFinalItemID(const EQ::ItemInstance &inst) const
|
|||||||
|
|
||||||
uint32 EvolvingItemsManager::GetNextEvolveItemID(const EQ::ItemInstance &inst) const
|
uint32 EvolvingItemsManager::GetNextEvolveItemID(const EQ::ItemInstance &inst) const
|
||||||
{
|
{
|
||||||
|
if (!inst) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
int8 const current_level = inst.GetEvolveLvl();
|
int8 const current_level = inst.GetEvolveLvl();
|
||||||
|
|
||||||
const auto iterator = std::ranges::find_if(
|
const auto iterator = std::ranges::find_if(
|
||||||
evolving_items_manager.GetEvolvingItemsCache().cbegin(),
|
EvolvingItemsManager::Instance()->GetEvolvingItemsCache().cbegin(),
|
||||||
evolving_items_manager.GetEvolvingItemsCache().cend(),
|
EvolvingItemsManager::Instance()->GetEvolvingItemsCache().cend(),
|
||||||
[&](const std::pair<uint32, ItemsEvolvingDetailsRepository::ItemsEvolvingDetails> &a) {
|
[&](const std::pair<uint32, ItemsEvolvingDetailsRepository::ItemsEvolvingDetails> &a) {
|
||||||
return a.second.item_evo_id == inst.GetEvolveLoreID() &&
|
return a.second.item_evo_id == inst.GetEvolveLoreID() &&
|
||||||
a.second.item_evolve_level == current_level + 1;
|
a.second.item_evolve_level == current_level + 1;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
if (iterator == std::end(evolving_items_manager.GetEvolvingItemsCache())) {
|
if (iterator == std::end(EvolvingItemsManager::Instance()->GetEvolvingItemsCache())) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -191,6 +207,10 @@ uint64 EvolvingItemsManager::GetTotalEarnedXP(const EQ::ItemInstance &inst)
|
|||||||
EvolveGetNextItem EvolvingItemsManager::GetNextItemByXP(const EQ::ItemInstance &inst_in, const int64 in_xp)
|
EvolveGetNextItem EvolvingItemsManager::GetNextItemByXP(const EQ::ItemInstance &inst_in, const int64 in_xp)
|
||||||
{
|
{
|
||||||
EvolveGetNextItem ets{};
|
EvolveGetNextItem ets{};
|
||||||
|
if (!inst_in) {
|
||||||
|
return ets;
|
||||||
|
}
|
||||||
|
|
||||||
const auto evolve_items = GetEvolveIDItems(inst_in.GetEvolveLoreID());
|
const auto evolve_items = GetEvolveIDItems(inst_in.GetEvolveLoreID());
|
||||||
uint32 max_transfer_level = 0;
|
uint32 max_transfer_level = 0;
|
||||||
int64 xp = in_xp;
|
int64 xp = in_xp;
|
||||||
@@ -235,9 +255,12 @@ EvolveTransfer EvolvingItemsManager::DetermineTransferResults(
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
EvolveTransfer ets{};
|
EvolveTransfer ets{};
|
||||||
|
if (!inst_from || !inst_to) {
|
||||||
|
return ets;
|
||||||
|
}
|
||||||
|
|
||||||
auto evolving_details_inst_from = evolving_items_manager.GetEvolveItemDetails(inst_from.GetID());
|
auto evolving_details_inst_from = EvolvingItemsManager::Instance()->GetEvolveItemDetails(inst_from.GetID());
|
||||||
auto evolving_details_inst_to = evolving_items_manager.GetEvolveItemDetails(inst_to.GetID());
|
auto evolving_details_inst_to = EvolvingItemsManager::Instance()->GetEvolveItemDetails(inst_to.GetID());
|
||||||
|
|
||||||
if (!evolving_details_inst_from.id || !evolving_details_inst_to.id) {
|
if (!evolving_details_inst_from.id || !evolving_details_inst_to.id) {
|
||||||
return ets;
|
return ets;
|
||||||
@@ -253,10 +276,10 @@ EvolveTransfer EvolvingItemsManager::DetermineTransferResults(
|
|||||||
compatibility = 30;
|
compatibility = 30;
|
||||||
}
|
}
|
||||||
|
|
||||||
xp = evolving_items_manager.GetTotalEarnedXP(inst_from) * compatibility / 100;
|
xp = EvolvingItemsManager::Instance()->GetTotalEarnedXP(inst_from) * compatibility / 100;
|
||||||
auto results = evolving_items_manager.GetNextItemByXP(inst_to, xp);
|
auto results = EvolvingItemsManager::Instance()->GetNextItemByXP(inst_to, xp);
|
||||||
|
|
||||||
ets.item_from_id = evolving_items_manager.GetFirstItemInLoreGroup(inst_from.GetEvolveLoreID());
|
ets.item_from_id = EvolvingItemsManager::Instance()->GetFirstItemInLoreGroup(inst_from.GetEvolveLoreID());
|
||||||
ets.item_from_current_amount = results.from_current_amount;
|
ets.item_from_current_amount = results.from_current_amount;
|
||||||
ets.item_to_id = results.new_item_id;
|
ets.item_to_id = results.new_item_id;
|
||||||
ets.item_to_current_amount = results.new_current_amount;
|
ets.item_to_current_amount = results.new_current_amount;
|
||||||
@@ -295,6 +318,10 @@ uint32 EvolvingItemsManager::GetFirstItemInLoreGroupByItemID(const uint32 item_i
|
|||||||
|
|
||||||
void EvolvingItemsManager::LoadPlayerEvent(const EQ::ItemInstance &inst, PlayerEvent::EvolveItem &e)
|
void EvolvingItemsManager::LoadPlayerEvent(const EQ::ItemInstance &inst, PlayerEvent::EvolveItem &e)
|
||||||
{
|
{
|
||||||
|
if (!inst) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
e.item_id = inst.GetID();
|
e.item_id = inst.GetID();
|
||||||
e.item_name = inst.GetItem() ? inst.GetItem()->Name : std::string();
|
e.item_name = inst.GetItem() ? inst.GetItem()->Name : std::string();
|
||||||
e.level = inst.GetEvolveLvl();
|
e.level = inst.GetEvolveLvl();
|
||||||
|
|||||||
@@ -53,15 +53,18 @@ public:
|
|||||||
ItemsEvolvingDetailsRepository::ItemsEvolvingDetails GetEvolveItemDetails(uint64 id);
|
ItemsEvolvingDetailsRepository::ItemsEvolvingDetails GetEvolveItemDetails(uint64 id);
|
||||||
EvolveTransfer DetermineTransferResults(const EQ::ItemInstance& inst_from, const EQ::ItemInstance& inst_to);
|
EvolveTransfer DetermineTransferResults(const EQ::ItemInstance& inst_from, const EQ::ItemInstance& inst_to);
|
||||||
EvolveGetNextItem GetNextItemByXP(const EQ::ItemInstance &inst_in, int64 in_xp);
|
EvolveGetNextItem GetNextItemByXP(const EQ::ItemInstance &inst_in, int64 in_xp);
|
||||||
std::map<uint32, ItemsEvolvingDetailsRepository::ItemsEvolvingDetails>& GetEvolvingItemsCache() { return evolving_items_cache; }
|
std::map<uint32, ItemsEvolvingDetailsRepository::ItemsEvolvingDetails>& GetEvolvingItemsCache() { return m_evolving_items_cache; }
|
||||||
std::vector<ItemsEvolvingDetailsRepository::ItemsEvolvingDetails> GetEvolveIDItems(uint32 evolve_id);
|
std::vector<ItemsEvolvingDetailsRepository::ItemsEvolvingDetails> GetEvolveIDItems(uint32 evolve_id);
|
||||||
|
|
||||||
|
static EvolvingItemsManager* Instance()
|
||||||
|
{
|
||||||
|
static EvolvingItemsManager instance;
|
||||||
|
return &instance;
|
||||||
|
}
|
||||||
private:
|
private:
|
||||||
std::map<uint32, ItemsEvolvingDetailsRepository::ItemsEvolvingDetails> evolving_items_cache;
|
std::map<uint32, ItemsEvolvingDetailsRepository::ItemsEvolvingDetails> m_evolving_items_cache;
|
||||||
Database * m_db;
|
Database * m_db;
|
||||||
Database * m_content_db;
|
Database * m_content_db;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern EvolvingItemsManager evolving_items_manager;
|
|
||||||
|
|
||||||
#endif //EVOLVING_H
|
#endif //EVOLVING_H
|
||||||
|
|||||||
@@ -1,101 +0,0 @@
|
|||||||
/**
|
|
||||||
* EQEmulator: Everquest Server Emulator
|
|
||||||
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; version 2 of the License.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
|
||||||
* are required to give you total support for your newly bought product;
|
|
||||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "expedition_lockout_timer.h"
|
|
||||||
#include "../common/strings.h"
|
|
||||||
#include "../common/rulesys.h"
|
|
||||||
#include "../common/util/uuid.h"
|
|
||||||
#include <fmt/format.h>
|
|
||||||
|
|
||||||
const char* const DZ_REPLAY_TIMER_NAME = "Replay Timer"; // see December 14, 2016 patch notes
|
|
||||||
|
|
||||||
ExpeditionLockoutTimer::ExpeditionLockoutTimer(
|
|
||||||
std::string expedition_uuid, std::string expedition_name,
|
|
||||||
std::string event_name, uint64_t expire_time, uint32_t duration
|
|
||||||
) :
|
|
||||||
m_expedition_uuid{std::move(expedition_uuid)},
|
|
||||||
m_expedition_name{std::move(expedition_name)},
|
|
||||||
m_event_name{std::move(event_name)},
|
|
||||||
m_expire_time(std::chrono::system_clock::from_time_t(expire_time)),
|
|
||||||
m_duration(duration)
|
|
||||||
{
|
|
||||||
if (m_event_name == DZ_REPLAY_TIMER_NAME)
|
|
||||||
{
|
|
||||||
m_is_replay_timer = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ExpeditionLockoutTimer ExpeditionLockoutTimer::CreateLockout(
|
|
||||||
const std::string& expedition_name, const std::string& event_name, uint32_t seconds, std::string uuid)
|
|
||||||
{
|
|
||||||
seconds = static_cast<uint32_t>(seconds * RuleR(Expedition, LockoutDurationMultiplier));
|
|
||||||
|
|
||||||
if (uuid.empty())
|
|
||||||
{
|
|
||||||
uuid = EQ::Util::UUID::Generate().ToString();
|
|
||||||
}
|
|
||||||
|
|
||||||
ExpeditionLockoutTimer lockout{uuid, expedition_name, event_name, 0, seconds};
|
|
||||||
lockout.Reset(); // sets expire time
|
|
||||||
return lockout;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint32_t ExpeditionLockoutTimer::GetSecondsRemaining() const
|
|
||||||
{
|
|
||||||
auto now = std::chrono::system_clock::now();
|
|
||||||
if (m_expire_time > now)
|
|
||||||
{
|
|
||||||
auto remaining = m_expire_time - now;
|
|
||||||
return static_cast<uint32_t>(std::chrono::duration_cast<std::chrono::seconds>(remaining).count());
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
ExpeditionLockoutTimer::DaysHoursMinutes ExpeditionLockoutTimer::GetDaysHoursMinutesRemaining() const
|
|
||||||
{
|
|
||||||
auto seconds = GetSecondsRemaining();
|
|
||||||
return ExpeditionLockoutTimer::DaysHoursMinutes{
|
|
||||||
fmt::format_int(seconds / 86400).str(), // days
|
|
||||||
fmt::format_int((seconds / 3600) % 24).str(), // hours
|
|
||||||
fmt::format_int((seconds / 60) % 60).str() // minutes
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ExpeditionLockoutTimer::IsSameLockout(const ExpeditionLockoutTimer& compare_lockout) const
|
|
||||||
{
|
|
||||||
return compare_lockout.IsSameLockout(GetExpeditionName(), GetEventName());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ExpeditionLockoutTimer::IsSameLockout(
|
|
||||||
const std::string& expedition_name, const std::string& event_name) const
|
|
||||||
{
|
|
||||||
return GetExpeditionName() == expedition_name && GetEventName() == event_name;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ExpeditionLockoutTimer::AddLockoutTime(int seconds)
|
|
||||||
{
|
|
||||||
seconds = static_cast<uint32_t>(seconds * RuleR(Expedition, LockoutDurationMultiplier));
|
|
||||||
|
|
||||||
auto new_duration = std::max(0, static_cast<int>(m_duration.count()) + seconds);
|
|
||||||
|
|
||||||
auto start_time = m_expire_time - m_duration;
|
|
||||||
m_duration = std::chrono::seconds(new_duration);
|
|
||||||
m_expire_time = start_time + m_duration;
|
|
||||||
}
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
/**
|
|
||||||
* EQEmulator: Everquest Server Emulator
|
|
||||||
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation; version 2 of the License.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY except by those people which sell it, which
|
|
||||||
* are required to give you total support for your newly bought product;
|
|
||||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
|
|
||||||
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef EXPEDITION_LOCKOUT_TIMER_H
|
|
||||||
#define EXPEDITION_LOCKOUT_TIMER_H
|
|
||||||
|
|
||||||
#include <chrono>
|
|
||||||
#include <string>
|
|
||||||
|
|
||||||
extern const char* const DZ_REPLAY_TIMER_NAME;
|
|
||||||
|
|
||||||
class ExpeditionLockoutTimer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ExpeditionLockoutTimer() = default;
|
|
||||||
ExpeditionLockoutTimer(
|
|
||||||
std::string expedition_uuid, std::string expedition_name,
|
|
||||||
std::string event_name, uint64_t expire_time, uint32_t duration);
|
|
||||||
|
|
||||||
static ExpeditionLockoutTimer CreateLockout(
|
|
||||||
const std::string& expedition_name, const std::string& event_name,
|
|
||||||
uint32_t seconds, std::string uuid = {});
|
|
||||||
|
|
||||||
struct DaysHoursMinutes
|
|
||||||
{
|
|
||||||
std::string days;
|
|
||||||
std::string hours;
|
|
||||||
std::string mins;
|
|
||||||
};
|
|
||||||
|
|
||||||
void AddLockoutTime(int seconds);
|
|
||||||
uint32_t GetDuration() const { return static_cast<uint32_t>(m_duration.count()); }
|
|
||||||
uint64_t GetExpireTime() const { return std::chrono::system_clock::to_time_t(m_expire_time); }
|
|
||||||
uint64_t GetStartTime() const { return std::chrono::system_clock::to_time_t(m_expire_time - m_duration); }
|
|
||||||
uint32_t GetSecondsRemaining() const;
|
|
||||||
DaysHoursMinutes GetDaysHoursMinutesRemaining() const;
|
|
||||||
const std::string& GetExpeditionName() const { return m_expedition_name; }
|
|
||||||
const std::string& GetExpeditionUUID() const { return m_expedition_uuid; }
|
|
||||||
const std::string& GetEventName() const { return m_event_name; }
|
|
||||||
bool IsExpired() const { return GetSecondsRemaining() == 0; }
|
|
||||||
bool IsFromExpedition(const std::string& uuid) const { return uuid == m_expedition_uuid; }
|
|
||||||
bool IsReplayTimer() const { return m_is_replay_timer; }
|
|
||||||
bool IsSameLockout(const ExpeditionLockoutTimer& compare_lockout) const;
|
|
||||||
bool IsSameLockout(const std::string& expedition_name, const std::string& event_name) const;
|
|
||||||
void Reset() { m_expire_time = std::chrono::system_clock::now() + m_duration; }
|
|
||||||
void SetDuration(uint32_t seconds) { m_duration = std::chrono::seconds(seconds); }
|
|
||||||
void SetExpireTime(uint64_t expire_time) { m_expire_time = std::chrono::system_clock::from_time_t(expire_time); }
|
|
||||||
void SetUUID(const std::string& uuid) { m_expedition_uuid = uuid; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool m_is_replay_timer = false;
|
|
||||||
std::string m_expedition_uuid; // expedition received in
|
|
||||||
std::string m_expedition_name;
|
|
||||||
std::string m_event_name;
|
|
||||||
std::chrono::seconds m_duration;
|
|
||||||
std::chrono::time_point<std::chrono::system_clock> m_expire_time;
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
+29
-29
@@ -95,12 +95,12 @@ bool IsOfEqualRace(int r1, int r2)
|
|||||||
}
|
}
|
||||||
// TODO: add more values
|
// TODO: add more values
|
||||||
switch (r1) {
|
switch (r1) {
|
||||||
case DARK_ELF:
|
case Race::DarkElf:
|
||||||
if (r2 == Race::NeriakCitizen) {
|
if (r2 == Race::NeriakCitizen) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case BARBARIAN:
|
case Race::Barbarian:
|
||||||
if (r2 == Race::HalasCitizen) {
|
if (r2 == Race::HalasCitizen) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -116,49 +116,49 @@ bool IsOfIndiffRace(int r1, int r2)
|
|||||||
}
|
}
|
||||||
// TODO: add more values
|
// TODO: add more values
|
||||||
switch (r1) {
|
switch (r1) {
|
||||||
case DARK_ELF:
|
case Race::DarkElf:
|
||||||
case OGRE:
|
case Race::Ogre:
|
||||||
case TROLL:
|
case Race::Troll:
|
||||||
if (r2 == OGRE || r2 == TROLL || r2 == DARK_ELF) {
|
if (r2 == Race::Ogre || r2 == Race::Troll || r2 == Race::DarkElf) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case HUMAN:
|
case Race::Human:
|
||||||
case BARBARIAN:
|
case Race::Barbarian:
|
||||||
case HALF_ELF:
|
case Race::HalfElf:
|
||||||
case GNOME:
|
case Race::Gnome:
|
||||||
case HALFLING:
|
case Race::Halfling:
|
||||||
case WOOD_ELF:
|
case Race::WoodElf:
|
||||||
if (r2 == HUMAN ||
|
if (r2 == Race::Human ||
|
||||||
r2 == BARBARIAN ||
|
r2 == Race::Barbarian ||
|
||||||
r2 == ERUDITE ||
|
r2 == Race::Erudite ||
|
||||||
r2 == HALF_ELF ||
|
r2 == Race::HalfElf ||
|
||||||
r2 == GNOME ||
|
r2 == Race::Gnome ||
|
||||||
r2 == HALFLING ||
|
r2 == Race::Halfling ||
|
||||||
r2 == DWARF ||
|
r2 == Race::Dwarf ||
|
||||||
r2 == HIGH_ELF ||
|
r2 == Race::HighElf ||
|
||||||
r2 == WOOD_ELF) {
|
r2 == Race::WoodElf) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case ERUDITE:
|
case Race::Erudite:
|
||||||
if (r2 == HUMAN || r2 == HALF_ELF) {
|
if (r2 == Race::Human || r2 == Race::HalfElf) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case DWARF:
|
case Race::Dwarf:
|
||||||
if (r2 == HALFLING || r2 == GNOME) {
|
if (r2 == Race::Halfling || r2 == Race::Gnome) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case HIGH_ELF:
|
case Race::HighElf:
|
||||||
if (r2 == WOOD_ELF) {
|
if (r2 == Race::WoodElf) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VAHSHIR:
|
case Race::VahShir:
|
||||||
return true;
|
return true;
|
||||||
case IKSAR:
|
case Race::Iksar:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
+13
-13
@@ -36,9 +36,11 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
#include <fmt/ranges.h>
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
namespace fs = std::filesystem;
|
namespace fs = std::filesystem;
|
||||||
|
|
||||||
@@ -90,23 +92,21 @@ std::string File::GetCwd()
|
|||||||
|
|
||||||
FileContentsResult File::GetContents(const std::string &file_name)
|
FileContentsResult File::GetContents(const std::string &file_name)
|
||||||
{
|
{
|
||||||
std::string error;
|
std::ifstream f(file_name, std::ios::in | std::ios::binary);
|
||||||
std::ifstream f;
|
if (!f) {
|
||||||
f.open(file_name);
|
return { .error = fmt::format("Couldn't open file [{}]", file_name) };
|
||||||
std::string line;
|
}
|
||||||
|
|
||||||
|
constexpr size_t CHUNK_SIZE = 4096; // Read 4KB chunks
|
||||||
std::string lines;
|
std::string lines;
|
||||||
if (f.is_open()) {
|
std::vector<char> buffer(CHUNK_SIZE);
|
||||||
while (f) {
|
|
||||||
std::getline(f, line);
|
while (f.read(buffer.data(), CHUNK_SIZE) || f.gcount() > 0) {
|
||||||
lines += line + "\n";
|
lines.append(buffer.data(), f.gcount());
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
error = fmt::format("Couldn't open file [{}]", file_name);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FileContentsResult{
|
return FileContentsResult{
|
||||||
.contents = lines,
|
.contents = lines,
|
||||||
.error = error,
|
.error = {}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
+18
-16
@@ -547,52 +547,54 @@ uint32 BaseGuildManager::UpdateDbCreateGuild(std::string name, uint32 leader)
|
|||||||
|
|
||||||
bool BaseGuildManager::UpdateDbDeleteGuild(uint32 guild_id, bool local_delete, bool db_delete)
|
bool BaseGuildManager::UpdateDbDeleteGuild(uint32 guild_id, bool local_delete, bool db_delete)
|
||||||
{
|
{
|
||||||
|
auto const where_filter = fmt::format("guild_id = {}", guild_id);
|
||||||
|
auto const bank_items = GuildBankRepository::GetWhere(*m_db, where_filter);
|
||||||
|
|
||||||
if (local_delete) {
|
if (local_delete) {
|
||||||
auto where_filter = fmt::format("guildid = {}", guild_id);
|
|
||||||
auto bank_items = GuildBankRepository::GetWhere(*m_db, where_filter);
|
|
||||||
if (!bank_items.empty()) {
|
if (!bank_items.empty()) {
|
||||||
LogError(
|
LogError(
|
||||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try again.",
|
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try "
|
||||||
|
"again.",
|
||||||
guild_id,
|
guild_id,
|
||||||
bank_items.size()
|
bank_items.size()
|
||||||
);
|
);
|
||||||
LogGuilds(
|
LogGuilds(
|
||||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try again.",
|
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try "
|
||||||
|
"again.",
|
||||||
guild_id,
|
guild_id,
|
||||||
bank_items.size()
|
bank_items.size()
|
||||||
);
|
);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
std::map<uint32, GuildInfo *>::iterator res;
|
auto res = m_guilds.find(guild_id);
|
||||||
res = m_guilds.find(guild_id);
|
|
||||||
if (res != m_guilds.end()) {
|
if (res != m_guilds.end()) {
|
||||||
delete res->second;
|
safe_delete(res->second);
|
||||||
m_guilds.erase(res);
|
m_guilds.erase(res);
|
||||||
LogGuilds("Deleted guild [{}] from memory", guild_id);
|
LogGuilds("Deleted guild [{}] from memory", guild_id);
|
||||||
// Does this need to be sent to world?
|
// Does this need to be sent to world?
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (db_delete) {
|
if (db_delete) {
|
||||||
auto where_filter = fmt::format("guildid = {}", guild_id);
|
|
||||||
auto bank_items = GuildBankRepository::GetWhere(*m_db, where_filter);
|
|
||||||
if (!bank_items.empty()) {
|
if (!bank_items.empty()) {
|
||||||
LogError(
|
LogError(
|
||||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try again.",
|
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try "
|
||||||
|
"again.",
|
||||||
guild_id,
|
guild_id,
|
||||||
bank_items.size()
|
bank_items.size()
|
||||||
);
|
);
|
||||||
LogGuilds(
|
LogGuilds(
|
||||||
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try again.",
|
"Attempt to delete guild id [{}] that still has [{}] items in the bank. Please remove them and try "
|
||||||
|
"again.",
|
||||||
guild_id,
|
guild_id,
|
||||||
bank_items.size()
|
bank_items.size()
|
||||||
);
|
);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
auto where_filter = fmt::format("guild_id = {}", guild_id);
|
|
||||||
GuildTributesRepository::DeleteOne(*m_db, guild_id);
|
GuildTributesRepository::DeleteOne(*m_db, guild_id);
|
||||||
GuildsRepository::DeleteOne(*m_db, guild_id);
|
GuildsRepository::DeleteOne(*m_db, guild_id);
|
||||||
GuildRanksRepository::DeleteWhere(*m_db, where_filter);
|
GuildRanksRepository::DeleteWhere(*m_db, where_filter);
|
||||||
@@ -600,7 +602,7 @@ bool BaseGuildManager::UpdateDbDeleteGuild(uint32 guild_id, bool local_delete, b
|
|||||||
GuildMembersRepository::DeleteWhere(*m_db, where_filter);
|
GuildMembersRepository::DeleteWhere(*m_db, where_filter);
|
||||||
LogGuilds("Deleted guild [{}] from the database", guild_id);
|
LogGuilds("Deleted guild [{}] from the database", guild_id);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+548
-468
File diff suppressed because it is too large
Load Diff
@@ -178,8 +178,8 @@ namespace EQ
|
|||||||
// Locate an available inventory slot
|
// Locate an available inventory slot
|
||||||
int16 FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size = 0, bool is_arrow = false);
|
int16 FindFreeSlot(bool for_bag, bool try_cursor, uint8 min_size = 0, bool is_arrow = false);
|
||||||
int16 FindFreeSlotForTradeItem(const ItemInstance* inst, int16 general_start = invslot::GENERAL_BEGIN, uint8 bag_start = invbag::SLOT_BEGIN);
|
int16 FindFreeSlotForTradeItem(const ItemInstance* inst, int16 general_start = invslot::GENERAL_BEGIN, uint8 bag_start = invbag::SLOT_BEGIN);
|
||||||
std::vector<int16> FindAllFreeSlotsThatFitItem(const EQ::ItemData *inst);
|
|
||||||
int16 FindFirstFreeSlotThatFitsItem(const EQ::ItemData *inst);
|
int16 FindFirstFreeSlotThatFitsItem(const EQ::ItemData *inst);
|
||||||
|
int16 FindFirstFreeSlotThatFitsItemWithStacking(ItemInstance *inst) const;
|
||||||
|
|
||||||
// Calculate slot_id for an item within a bag
|
// Calculate slot_id for an item within a bag
|
||||||
static int16 CalcSlotId(int16 slot_id); // Calc parent bag's slot_id
|
static int16 CalcSlotId(int16 slot_id); // Calc parent bag's slot_id
|
||||||
@@ -201,12 +201,6 @@ namespace EQ
|
|||||||
|
|
||||||
uint8 FindBrightestLightType();
|
uint8 FindBrightestLightType();
|
||||||
|
|
||||||
void dumpEntireInventory();
|
|
||||||
void dumpWornItems();
|
|
||||||
void dumpInventory();
|
|
||||||
void dumpBankItems();
|
|
||||||
void dumpSharedBankItems();
|
|
||||||
|
|
||||||
void SetCustomItemData(uint32 character_id, int16 slot_id, const std::string &identifier, const std::string& value);
|
void SetCustomItemData(uint32 character_id, int16 slot_id, const std::string &identifier, const std::string& value);
|
||||||
void SetCustomItemData(uint32 character_id, int16 slot_id, const std::string &identifier, int value);
|
void SetCustomItemData(uint32 character_id, int16 slot_id, const std::string &identifier, int value);
|
||||||
void SetCustomItemData(uint32 character_id, int16 slot_id, const std::string &identifier, float value);
|
void SetCustomItemData(uint32 character_id, int16 slot_id, const std::string &identifier, float value);
|
||||||
@@ -226,8 +220,6 @@ namespace EQ
|
|||||||
///////////////////////////////
|
///////////////////////////////
|
||||||
|
|
||||||
int GetSlotByItemInstCollection(const std::map<int16, ItemInstance*> &collection, ItemInstance *inst);
|
int GetSlotByItemInstCollection(const std::map<int16, ItemInstance*> &collection, ItemInstance *inst);
|
||||||
void dumpItemCollection(const std::map<int16, ItemInstance*> &collection);
|
|
||||||
void dumpBagContents(ItemInstance *inst, std::map<int16, ItemInstance*>::const_iterator *it);
|
|
||||||
|
|
||||||
// Retrieves item within an inventory bucket
|
// Retrieves item within an inventory bucket
|
||||||
ItemInstance* _GetItem(const std::map<int16, ItemInstance*>& bucket, int16 slot_id) const;
|
ItemInstance* _GetItem(const std::map<int16, ItemInstance*>& bucket, int16 slot_id) const;
|
||||||
|
|||||||
@@ -20,6 +20,7 @@
|
|||||||
|
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
#include <fmt/ranges.h>
|
||||||
#include <csignal>
|
#include <csignal>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "ip_util.h"
|
#include "ip_util.h"
|
||||||
@@ -259,3 +260,84 @@ bool IpUtil::IsIPAddress(const std::string &ip_address)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <winsock2.h>
|
||||||
|
#pragma comment(lib, "ws2_32.lib") // Link against Winsock library
|
||||||
|
#else
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
#include <string>
|
||||||
|
#ifdef _WIN32
|
||||||
|
#include <winsock2.h>
|
||||||
|
#include <ws2tcpip.h> // For inet_pton
|
||||||
|
#pragma comment(lib, "ws2_32.lib") // Link against Winsock library
|
||||||
|
#else
|
||||||
|
#include <sys/types.h>
|
||||||
|
#include <sys/socket.h>
|
||||||
|
#include <netinet/in.h>
|
||||||
|
#include <arpa/inet.h> // For inet_pton
|
||||||
|
#include <unistd.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
bool IpUtil::IsPortInUse(const std::string& ip, int port) {
|
||||||
|
bool in_use = false;
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
WSADATA wsaData;
|
||||||
|
if (WSAStartup(MAKEWORD(2, 2), &wsaData) != 0) {
|
||||||
|
std::cerr << "WSAStartup failed\n";
|
||||||
|
return true; // Assume in use on failure
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int sock = socket(AF_INET, SOCK_STREAM, 0);
|
||||||
|
if (sock < 0) {
|
||||||
|
#ifdef _WIN32
|
||||||
|
WSACleanup();
|
||||||
|
#endif
|
||||||
|
return true; // Assume in use on failure
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
int opt = 1;
|
||||||
|
setsockopt(sock, SOL_SOCKET, SO_EXCLUSIVEADDRUSE, (char*)&opt, sizeof(opt)); // Windows-specific
|
||||||
|
#else
|
||||||
|
int opt = 1;
|
||||||
|
setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)); // Linux/macOS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
sockaddr_in addr{};
|
||||||
|
addr.sin_family = AF_INET;
|
||||||
|
addr.sin_port = htons(port);
|
||||||
|
|
||||||
|
// Convert IP address from string to binary format
|
||||||
|
if (inet_pton(AF_INET, ip.c_str(), &addr.sin_addr) <= 0) {
|
||||||
|
std::cerr << "Invalid IP address format: " << ip << std::endl;
|
||||||
|
#ifdef _WIN32
|
||||||
|
closesocket(sock);
|
||||||
|
WSACleanup();
|
||||||
|
#else
|
||||||
|
close(sock);
|
||||||
|
#endif
|
||||||
|
return true; // Assume in use on failure
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bind(sock, (struct sockaddr*)&addr, sizeof(addr)) < 0) {
|
||||||
|
in_use = true; // Bind failed, port is in use
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
closesocket(sock);
|
||||||
|
WSACleanup();
|
||||||
|
#else
|
||||||
|
close(sock);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return in_use;
|
||||||
|
}
|
||||||
|
|||||||
@@ -37,6 +37,7 @@ public:
|
|||||||
int port
|
int port
|
||||||
);
|
);
|
||||||
static bool IsIPAddress(const std::string &ip_address);
|
static bool IsIPAddress(const std::string &ip_address);
|
||||||
|
static bool IsPortInUse(const std::string& ip, int port);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ namespace EQ {
|
|||||||
EQ_EXCEPT("IPC Mutex", "Could not create mutex.");
|
EQ_EXCEPT("IPC Mutex", "Could not create mutex.");
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
std::string final_name = fmt::format("{}/{}.lock", path.GetSharedMemoryPath(), name);
|
std::string final_name = fmt::format("{}/{}.lock", PathManager::Instance()->GetSharedMemoryPath(), name);
|
||||||
|
|
||||||
#ifdef __DARWIN
|
#ifdef __DARWIN
|
||||||
#if __DARWIN_C_LEVEL < 200809L
|
#if __DARWIN_C_LEVEL < 200809L
|
||||||
|
|||||||
@@ -220,6 +220,34 @@ bool EQ::ItemData::IsType1HWeapon() const
|
|||||||
return ((ItemType == item::ItemType1HBlunt) || (ItemType == item::ItemType1HSlash) || (ItemType == item::ItemType1HPiercing) || (ItemType == item::ItemTypeMartial));
|
return ((ItemType == item::ItemType1HBlunt) || (ItemType == item::ItemType1HSlash) || (ItemType == item::ItemType1HPiercing) || (ItemType == item::ItemTypeMartial));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool EQ::ItemData::IsPetUsable() const
|
||||||
|
{
|
||||||
|
if (ItemClass == item::ItemClassBag) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if it's a misc item and has slots, it's wearable
|
||||||
|
// this item type is conflated with many other item types
|
||||||
|
if (ItemClass == item::ItemTypeMisc && Slots != 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
switch (ItemType) {
|
||||||
|
case item::ItemType1HBlunt:
|
||||||
|
case item::ItemType1HSlash:
|
||||||
|
case item::ItemType1HPiercing:
|
||||||
|
case item::ItemType2HBlunt:
|
||||||
|
case item::ItemType2HSlash:
|
||||||
|
case item::ItemTypeMartial:
|
||||||
|
case item::ItemTypeShield:
|
||||||
|
case item::ItemTypeArmor:
|
||||||
|
case item::ItemTypeJewelry:
|
||||||
|
return true;
|
||||||
|
default:
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
bool EQ::ItemData::IsType2HWeapon() const
|
bool EQ::ItemData::IsType2HWeapon() const
|
||||||
{
|
{
|
||||||
return ((ItemType == item::ItemType2HBlunt) || (ItemType == item::ItemType2HSlash) || (ItemType == item::ItemType2HPiercing));
|
return ((ItemType == item::ItemType2HBlunt) || (ItemType == item::ItemType2HSlash) || (ItemType == item::ItemType2HPiercing));
|
||||||
|
|||||||
+2
-1
@@ -438,7 +438,7 @@ namespace EQ
|
|||||||
//uint32 Unk054 {};
|
//uint32 Unk054 {};
|
||||||
int16 MaxCharges {}; // Maximum charges items can hold: -1 if not a chargeable item
|
int16 MaxCharges {}; // Maximum charges items can hold: -1 if not a chargeable item
|
||||||
uint8 ItemType {}; // Item Type/Skill (itemClass* from above)
|
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
|
uint8 Material {}; // Item material type
|
||||||
uint32 HerosForgeModel {};// Hero's Forge Armor Model Type (2-13?)
|
uint32 HerosForgeModel {};// Hero's Forge Armor Model Type (2-13?)
|
||||||
float SellRate {}; // Sell rate
|
float SellRate {}; // Sell rate
|
||||||
@@ -550,6 +550,7 @@ namespace EQ
|
|||||||
bool IsType1HWeapon() const;
|
bool IsType1HWeapon() const;
|
||||||
bool IsType2HWeapon() const;
|
bool IsType2HWeapon() const;
|
||||||
bool IsTypeShield() const;
|
bool IsTypeShield() const;
|
||||||
|
bool IsPetUsable() const;
|
||||||
bool IsQuestItem() const;
|
bool IsQuestItem() const;
|
||||||
|
|
||||||
static bool CheckLoreConflict(const ItemData* l_item, const ItemData* r_item);
|
static bool CheckLoreConflict(const ItemData* l_item, const ItemData* r_item);
|
||||||
|
|||||||
@@ -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)
|
|
||||||
@@ -574,7 +574,7 @@ EQ::ItemInstance* EQ::ItemInstance::GetOrnamentationAugment() const
|
|||||||
uint32 EQ::ItemInstance::GetOrnamentHeroModel(int32 material_slot) const
|
uint32 EQ::ItemInstance::GetOrnamentHeroModel(int32 material_slot) const
|
||||||
{
|
{
|
||||||
// Not a Hero Forge item.
|
// Not a Hero Forge item.
|
||||||
if (m_ornament_hero_model == 0 || material_slot < 0) {
|
if (m_ornament_hero_model == 0) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -906,26 +906,34 @@ bool EQ::ItemInstance::IsSlotAllowed(int16 slot_id) const {
|
|||||||
|
|
||||||
bool EQ::ItemInstance::IsDroppable(bool recurse) const
|
bool EQ::ItemInstance::IsDroppable(bool recurse) const
|
||||||
{
|
{
|
||||||
if (!m_item)
|
if (!m_item) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
/*if (m_ornamentidfile) // not implemented
|
/*if (m_ornamentidfile) // not implemented
|
||||||
return false;*/
|
return false;*/
|
||||||
if (m_attuned)
|
if (m_attuned) {
|
||||||
return false;
|
return false;
|
||||||
/*if (m_item->FVNoDrop != 0) // not implemented
|
}
|
||||||
return false;*/
|
|
||||||
if (m_item->NoDrop == 0)
|
if (RuleI(World, FVNoDropFlag) == FVNoDropFlagRule::Enabled && m_item->FVNoDrop == 0) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (m_item->NoDrop == 0) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
if (recurse) {
|
if (recurse) {
|
||||||
for (auto iter: m_contents) {
|
for (auto iter: m_contents) {
|
||||||
if (!iter.second)
|
if (!iter.second) {
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (!iter.second->IsDroppable(recurse))
|
if (!iter.second->IsDroppable(recurse)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -1785,6 +1793,18 @@ std::vector<uint32> EQ::ItemInstance::GetAugmentIDs() const
|
|||||||
return augments;
|
return augments;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::vector<std::string> EQ::ItemInstance::GetAugmentNames() const
|
||||||
|
{
|
||||||
|
std::vector<std::string> augment_names;
|
||||||
|
|
||||||
|
for (uint8 slot_id = invaug::SOCKET_BEGIN; slot_id <= invaug::SOCKET_END; slot_id++) {
|
||||||
|
const auto augment = GetAugment(slot_id);
|
||||||
|
augment_names.push_back(augment ? augment->GetItem()->Name : "");
|
||||||
|
}
|
||||||
|
|
||||||
|
return augment_names;
|
||||||
|
}
|
||||||
|
|
||||||
int EQ::ItemInstance::GetItemRegen(bool augments) const
|
int EQ::ItemInstance::GetItemRegen(bool augments) const
|
||||||
{
|
{
|
||||||
int stat = 0;
|
int stat = 0;
|
||||||
|
|||||||
@@ -305,6 +305,7 @@ namespace EQ
|
|||||||
int GetItemSkillsStat(EQ::skills::SkillType skill, bool augments = false) const;
|
int GetItemSkillsStat(EQ::skills::SkillType skill, bool augments = false) const;
|
||||||
uint32 GetItemGuildFavor() const;
|
uint32 GetItemGuildFavor() const;
|
||||||
std::vector<uint32> GetAugmentIDs() const;
|
std::vector<uint32> GetAugmentIDs() const;
|
||||||
|
std::vector<std::string> GetAugmentNames() const;
|
||||||
static void AddGUIDToMap(uint64 existing_serial_number);
|
static void AddGUIDToMap(uint64 existing_serial_number);
|
||||||
static void ClearGUIDMap();
|
static void ClearGUIDMap();
|
||||||
|
|
||||||
@@ -334,7 +335,7 @@ namespace EQ
|
|||||||
void SetEvolveAddToCurrentAmount(const uint64 in) const { m_evolving_details.current_amount += in; }
|
void SetEvolveAddToCurrentAmount(const uint64 in) const { m_evolving_details.current_amount += in; }
|
||||||
void SetEvolveFinalItemID(const uint32 in) const { m_evolving_details.final_item_id = in; }
|
void SetEvolveFinalItemID(const uint32 in) const { m_evolving_details.final_item_id = in; }
|
||||||
bool TransferOwnership(Database& db, const uint32 to_char_id) const;
|
bool TransferOwnership(Database& db, const uint32 to_char_id) const;
|
||||||
void CalculateEvolveProgression() const { m_evolving_details.progression = evolving_items_manager.CalculateProgression(GetEvolveCurrentAmount(), GetID()); }
|
void CalculateEvolveProgression() const { m_evolving_details.progression = EvolvingItemsManager::Instance()->CalculateProgression(GetEvolveCurrentAmount(), GetID()); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
//////////////////////////
|
//////////////////////////
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ struct LootItem {
|
|||||||
uint16 trivial_max_level;
|
uint16 trivial_max_level;
|
||||||
uint16 npc_min_level;
|
uint16 npc_min_level;
|
||||||
uint16 npc_max_level;
|
uint16 npc_max_level;
|
||||||
|
uint32 lootdrop_id; // required for zone state referencing
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef std::list<LootItem*> LootItems;
|
typedef std::list<LootItem*> LootItems;
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
#include "console_server.h"
|
#include "console_server.h"
|
||||||
#include "../strings.h"
|
#include "../strings.h"
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
#include <fmt/ranges.h>
|
||||||
|
|
||||||
EQ::Net::ConsoleServer::ConsoleServer(const std::string &addr, int port)
|
EQ::Net::ConsoleServer::ConsoleServer(const std::string &addr, int port)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
#include "../servertalk.h"
|
#include "../servertalk.h"
|
||||||
#include "../rulesys.h"
|
#include "../rulesys.h"
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
#include <fmt/ranges.h>
|
||||||
|
|
||||||
EQ::Net::ConsoleServerConnection::ConsoleServerConnection(ConsoleServer *parent, std::shared_ptr<TCPConnection> connection)
|
EQ::Net::ConsoleServerConnection::ConsoleServerConnection(ConsoleServer *parent, std::shared_ptr<TCPConnection> connection)
|
||||||
{
|
{
|
||||||
|
|||||||
+12
-12
@@ -1,11 +1,11 @@
|
|||||||
#include "eqstream.h"
|
#include "eqstream.h"
|
||||||
#include "../eqemu_logsys.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_reliable_stream.OnNewConnection(std::bind(&EQStreamManager::ReliableStreamNewConnection, this, std::placeholders::_1));
|
||||||
m_daybreak.OnConnectionStateChange(std::bind(&EQStreamManager::DaybreakConnectionStateChange, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
m_reliable_stream.OnConnectionStateChange(std::bind(&EQStreamManager::ReliableStreamConnectionStateChange, 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.OnPacketRecv(std::bind(&EQStreamManager::ReliableStreamPacketRecv, this, std::placeholders::_1, std::placeholders::_2));
|
||||||
}
|
}
|
||||||
|
|
||||||
EQ::Net::EQStreamManager::~EQStreamManager()
|
EQ::Net::EQStreamManager::~EQStreamManager()
|
||||||
@@ -15,11 +15,11 @@ EQ::Net::EQStreamManager::~EQStreamManager()
|
|||||||
void EQ::Net::EQStreamManager::SetOptions(const EQStreamManagerInterfaceOptions &options)
|
void EQ::Net::EQStreamManager::SetOptions(const EQStreamManagerInterfaceOptions &options)
|
||||||
{
|
{
|
||||||
m_options = options;
|
m_options = options;
|
||||||
auto &opts = m_daybreak.GetOptions();
|
auto &opts = m_reliable_stream.GetOptions();
|
||||||
opts = options.daybreak_options;
|
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));
|
std::shared_ptr<EQStream> stream(new EQStream(this, connection));
|
||||||
m_streams.emplace(std::make_pair(connection, stream));
|
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);
|
auto iter = m_streams.find(connection);
|
||||||
if (iter != m_streams.end()) {
|
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);
|
auto iter = m_streams.find(connection);
|
||||||
if (iter != m_streams.end()) {
|
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_owner = owner;
|
||||||
m_connection = connection;
|
m_connection = connection;
|
||||||
@@ -71,7 +71,7 @@ void EQ::Net::EQStream::QueuePacket(const EQApplicationPacket *p, bool ack_req)
|
|||||||
OpcodeManager::EmuToName(p->GetOpcode()),
|
OpcodeManager::EmuToName(p->GetOpcode()),
|
||||||
(*m_opcode_manager)->EmuToEQ(p->GetOpcode()),
|
(*m_opcode_manager)->EmuToEQ(p->GetOpcode()),
|
||||||
p->Size(),
|
p->Size(),
|
||||||
(LogSys.IsLogEnabled(Logs::Detail, Logs::PacketServerClient) ? DumpPacketToString(p) : "")
|
(EQEmuLogSys::Instance()->IsLogEnabled(Logs::Detail, Logs::PacketServerClient) ? DumpPacketToString(p) : "")
|
||||||
);
|
);
|
||||||
|
|
||||||
if (m_opcode_manager && *m_opcode_manager) {
|
if (m_opcode_manager && *m_opcode_manager) {
|
||||||
@@ -235,7 +235,7 @@ EQStreamState EQ::Net::EQStream::GetState() {
|
|||||||
EQ::Net::EQStream::Stats EQ::Net::EQStream::GetStats() const
|
EQ::Net::EQStream::Stats EQ::Net::EQStream::GetStats() const
|
||||||
{
|
{
|
||||||
Stats ret;
|
Stats ret;
|
||||||
ret.DaybreakStats = m_connection->GetStats();
|
ret.ReliableStreamStats = m_connection->GetStats();
|
||||||
|
|
||||||
for (int i = 0; i < _maxEmuOpcode; ++i) {
|
for (int i = 0; i < _maxEmuOpcode; ++i) {
|
||||||
ret.RecvCount[i] = 0;
|
ret.RecvCount[i] = 0;
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
#include "../eq_packet.h"
|
#include "../eq_packet.h"
|
||||||
#include "../eq_stream_intf.h"
|
#include "../eq_stream_intf.h"
|
||||||
#include "../opcodemgr.h"
|
#include "../opcodemgr.h"
|
||||||
#include "daybreak_connection.h"
|
#include "reliable_stream_connection.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <unordered_map>
|
#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 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; }
|
void OnConnectionStateChange(std::function<void(std::shared_ptr<EQStream>, DbProtocolStatus, DbProtocolStatus)> func) { m_on_connection_state_change = func; }
|
||||||
private:
|
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>)> m_on_new_connection;
|
||||||
std::function<void(std::shared_ptr<EQStream>, DbProtocolStatus, DbProtocolStatus)> m_on_connection_state_change;
|
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 ReliableStreamNewConnection(std::shared_ptr<ReliableStreamConnection> connection);
|
||||||
void DaybreakConnectionStateChange(std::shared_ptr<DaybreakConnection> connection, DbProtocolStatus from, DbProtocolStatus to);
|
void ReliableStreamConnectionStateChange(std::shared_ptr<ReliableStreamConnection> connection, DbProtocolStatus from, DbProtocolStatus to);
|
||||||
void DaybreakPacketRecv(std::shared_ptr<DaybreakConnection> connection, const Packet &p);
|
void ReliableStreamPacketRecv(std::shared_ptr<ReliableStreamConnection> connection, const Packet &p);
|
||||||
friend class EQStream;
|
friend class EQStream;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EQStream : public EQStreamInterface
|
class EQStream : public EQStreamInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EQStream(EQStreamManagerInterface *parent, std::shared_ptr<DaybreakConnection> connection);
|
EQStream(EQStreamManagerInterface *parent, std::shared_ptr<ReliableStreamConnection> connection);
|
||||||
~EQStream();
|
~EQStream();
|
||||||
|
|
||||||
virtual void QueuePacket(const EQApplicationPacket *p, bool ack_req = true);
|
virtual void QueuePacket(const EQApplicationPacket *p, bool ack_req = true);
|
||||||
@@ -67,7 +67,7 @@ namespace EQ
|
|||||||
virtual EQStreamManagerInterface* GetManager() const;
|
virtual EQStreamManagerInterface* GetManager() const;
|
||||||
private:
|
private:
|
||||||
EQStreamManagerInterface *m_owner;
|
EQStreamManagerInterface *m_owner;
|
||||||
std::shared_ptr<DaybreakConnection> m_connection;
|
std::shared_ptr<ReliableStreamConnection> m_connection;
|
||||||
OpcodeManager **m_opcode_manager;
|
OpcodeManager **m_opcode_manager;
|
||||||
std::deque<std::unique_ptr<EQ::Net::Packet>> m_packet_queue;
|
std::deque<std::unique_ptr<EQ::Net::Packet>> m_packet_queue;
|
||||||
std::unordered_map<int, int> m_packet_recv_count;
|
std::unordered_map<int, int> m_packet_recv_count;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
#include "endian.h"
|
#include "endian.h"
|
||||||
#include <cctype>
|
#include <cctype>
|
||||||
#include <fmt/format.h>
|
#include <fmt/format.h>
|
||||||
|
#include <fmt/ranges.h>
|
||||||
|
|
||||||
void EQ::Net::Packet::PutInt8(size_t offset, int8_t value)
|
void EQ::Net::Packet::PutInt8(size_t offset, int8_t value)
|
||||||
{
|
{
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -2,7 +2,8 @@
|
|||||||
|
|
||||||
#include "../random.h"
|
#include "../random.h"
|
||||||
#include "packet.h"
|
#include "packet.h"
|
||||||
#include "daybreak_structs.h"
|
#include "reliable_stream_structs.h"
|
||||||
|
#include "reliable_stream_pooling.h"
|
||||||
#include <uv.h>
|
#include <uv.h>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
@@ -15,7 +16,7 @@ namespace EQ
|
|||||||
{
|
{
|
||||||
namespace Net
|
namespace Net
|
||||||
{
|
{
|
||||||
enum DaybreakProtocolOpcode
|
enum ReliableStreamProtocolOpcode
|
||||||
{
|
{
|
||||||
OP_Padding = 0x00,
|
OP_Padding = 0x00,
|
||||||
OP_SessionRequest = 0x01,
|
OP_SessionRequest = 0x01,
|
||||||
@@ -54,7 +55,7 @@ namespace EQ
|
|||||||
StatusDisconnected
|
StatusDisconnected
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DaybreakEncodeType
|
enum ReliableStreamEncodeType
|
||||||
{
|
{
|
||||||
EncodeNone = 0,
|
EncodeNone = 0,
|
||||||
EncodeCompression = 1,
|
EncodeCompression = 1,
|
||||||
@@ -71,9 +72,9 @@ namespace EQ
|
|||||||
typedef std::chrono::steady_clock::time_point Timestamp;
|
typedef std::chrono::steady_clock::time_point Timestamp;
|
||||||
typedef std::chrono::steady_clock Clock;
|
typedef std::chrono::steady_clock Clock;
|
||||||
|
|
||||||
struct DaybreakConnectionStats
|
struct ReliableStreamConnectionStats
|
||||||
{
|
{
|
||||||
DaybreakConnectionStats() {
|
ReliableStreamConnectionStats() {
|
||||||
recv_bytes = 0;
|
recv_bytes = 0;
|
||||||
sent_bytes = 0;
|
sent_bytes = 0;
|
||||||
recv_packets = 0;
|
recv_packets = 0;
|
||||||
@@ -133,14 +134,14 @@ namespace EQ
|
|||||||
uint64_t bytes_before_encode;
|
uint64_t bytes_before_encode;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DaybreakConnectionManager;
|
class ReliableStreamConnectionManager;
|
||||||
class DaybreakConnection;
|
class ReliableStreamConnection;
|
||||||
class DaybreakConnection
|
class ReliableStreamConnection
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DaybreakConnection(DaybreakConnectionManager *owner, const DaybreakConnect &connect, const std::string &endpoint, int port);
|
ReliableStreamConnection(ReliableStreamConnectionManager *owner, const ReliableStreamConnect &connect, const std::string &endpoint, int port);
|
||||||
DaybreakConnection(DaybreakConnectionManager *owner, const std::string &endpoint, int port);
|
ReliableStreamConnection(ReliableStreamConnectionManager *owner, const std::string &endpoint, int port);
|
||||||
~DaybreakConnection();
|
~ReliableStreamConnection();
|
||||||
|
|
||||||
const std::string& RemoteEndpoint() const { return m_endpoint; }
|
const std::string& RemoteEndpoint() const { return m_endpoint; }
|
||||||
int RemotePort() const { return m_port; }
|
int RemotePort() const { return m_port; }
|
||||||
@@ -150,23 +151,23 @@ namespace EQ
|
|||||||
void QueuePacket(Packet &p, int stream);
|
void QueuePacket(Packet &p, int stream);
|
||||||
void QueuePacket(Packet &p, int stream, bool reliable);
|
void QueuePacket(Packet &p, int stream, bool reliable);
|
||||||
|
|
||||||
DaybreakConnectionStats GetStats();
|
ReliableStreamConnectionStats GetStats();
|
||||||
void ResetStats();
|
void ResetStats();
|
||||||
size_t GetRollingPing() const { return m_rolling_ping; }
|
size_t GetRollingPing() const { return m_rolling_ping; }
|
||||||
DbProtocolStatus GetStatus() const { return m_status; }
|
DbProtocolStatus GetStatus() const { return m_status; }
|
||||||
|
|
||||||
const DaybreakEncodeType* GetEncodePasses() const { return m_encode_passes; }
|
const ReliableStreamEncodeType* GetEncodePasses() const { return m_encode_passes; }
|
||||||
const DaybreakConnectionManager* GetManager() const { return m_owner; }
|
const ReliableStreamConnectionManager* GetManager() const { return m_owner; }
|
||||||
DaybreakConnectionManager* GetManager() { return m_owner; }
|
ReliableStreamConnectionManager* GetManager() { return m_owner; }
|
||||||
private:
|
private:
|
||||||
DaybreakConnectionManager *m_owner;
|
ReliableStreamConnectionManager *m_owner;
|
||||||
std::string m_endpoint;
|
std::string m_endpoint;
|
||||||
int m_port;
|
int m_port;
|
||||||
uint32_t m_connect_code;
|
uint32_t m_connect_code;
|
||||||
uint32_t m_encode_key;
|
uint32_t m_encode_key;
|
||||||
uint32_t m_max_packet_size;
|
uint32_t m_max_packet_size;
|
||||||
uint32_t m_crc_bytes;
|
uint32_t m_crc_bytes;
|
||||||
DaybreakEncodeType m_encode_passes[2];
|
ReliableStreamEncodeType m_encode_passes[2];
|
||||||
|
|
||||||
Timestamp m_last_send;
|
Timestamp m_last_send;
|
||||||
Timestamp m_last_recv;
|
Timestamp m_last_recv;
|
||||||
@@ -175,13 +176,19 @@ namespace EQ
|
|||||||
std::list<DynamicPacket> m_buffered_packets;
|
std::list<DynamicPacket> m_buffered_packets;
|
||||||
size_t m_buffered_packets_length;
|
size_t m_buffered_packets_length;
|
||||||
std::unique_ptr<char[]> m_combined;
|
std::unique_ptr<char[]> m_combined;
|
||||||
DaybreakConnectionStats m_stats;
|
ReliableStreamConnectionStats m_stats;
|
||||||
Timestamp m_last_session_stats;
|
Timestamp m_last_session_stats;
|
||||||
size_t m_rolling_ping;
|
size_t m_rolling_ping;
|
||||||
Timestamp m_close_time;
|
Timestamp m_close_time;
|
||||||
double m_outgoing_budget;
|
double m_outgoing_budget;
|
||||||
|
|
||||||
struct DaybreakSentPacket
|
// resend tracking
|
||||||
|
size_t m_resend_packets_sent = 0;
|
||||||
|
size_t m_resend_bytes_sent = 0;
|
||||||
|
bool m_acked_since_last_resend = false;
|
||||||
|
Timestamp m_last_ack;
|
||||||
|
|
||||||
|
struct ReliableStreamSentPacket
|
||||||
{
|
{
|
||||||
DynamicPacket packet;
|
DynamicPacket packet;
|
||||||
Timestamp last_sent;
|
Timestamp last_sent;
|
||||||
@@ -190,9 +197,9 @@ namespace EQ
|
|||||||
size_t resend_delay;
|
size_t resend_delay;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DaybreakStream
|
struct ReliableStream
|
||||||
{
|
{
|
||||||
DaybreakStream() {
|
ReliableStream() {
|
||||||
sequence_in = 0;
|
sequence_in = 0;
|
||||||
sequence_out = 0;
|
sequence_out = 0;
|
||||||
fragment_current_bytes = 0;
|
fragment_current_bytes = 0;
|
||||||
@@ -201,17 +208,17 @@ namespace EQ
|
|||||||
|
|
||||||
uint16_t sequence_in;
|
uint16_t sequence_in;
|
||||||
uint16_t sequence_out;
|
uint16_t sequence_out;
|
||||||
std::map<uint16_t, std::unique_ptr<Packet>> packet_queue;
|
std::map<uint16_t, Packet*> packet_queue;
|
||||||
|
|
||||||
DynamicPacket fragment_packet;
|
DynamicPacket fragment_packet;
|
||||||
uint32_t fragment_current_bytes;
|
uint32_t fragment_current_bytes;
|
||||||
uint32_t fragment_total_bytes;
|
uint32_t fragment_total_bytes;
|
||||||
|
|
||||||
std::map<uint16_t, DaybreakSentPacket> sent_packets;
|
std::map<uint16_t, ReliableStreamSentPacket> sent_packets;
|
||||||
};
|
};
|
||||||
|
|
||||||
DaybreakStream m_streams[4];
|
ReliableStream m_streams[4];
|
||||||
std::weak_ptr<DaybreakConnection> m_self;
|
std::weak_ptr<ReliableStreamConnection> m_self;
|
||||||
|
|
||||||
void Process();
|
void Process();
|
||||||
void ProcessPacket(Packet &p);
|
void ProcessPacket(Packet &p);
|
||||||
@@ -244,12 +251,12 @@ namespace EQ
|
|||||||
void FlushBuffer();
|
void FlushBuffer();
|
||||||
SequenceOrder CompareSequence(uint16_t expected, uint16_t actual) const;
|
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;
|
max_connection_count = 0;
|
||||||
keepalive_delay_ms = 9000;
|
keepalive_delay_ms = 9000;
|
||||||
resend_delay_ms = 30;
|
resend_delay_ms = 30;
|
||||||
@@ -261,8 +268,8 @@ namespace EQ
|
|||||||
connect_stale_ms = 5000;
|
connect_stale_ms = 5000;
|
||||||
crc_length = 2;
|
crc_length = 2;
|
||||||
max_packet_size = 512;
|
max_packet_size = 512;
|
||||||
encode_passes[0] = DaybreakEncodeType::EncodeNone;
|
encode_passes[0] = ReliableStreamEncodeType::EncodeNone;
|
||||||
encode_passes[1] = DaybreakEncodeType::EncodeNone;
|
encode_passes[1] = ReliableStreamEncodeType::EncodeNone;
|
||||||
port = 0;
|
port = 0;
|
||||||
hold_size = 512;
|
hold_size = 512;
|
||||||
hold_length_ms = 50;
|
hold_length_ms = 50;
|
||||||
@@ -292,28 +299,28 @@ namespace EQ
|
|||||||
double tic_rate_hertz;
|
double tic_rate_hertz;
|
||||||
size_t resend_timeout;
|
size_t resend_timeout;
|
||||||
size_t connection_close_time;
|
size_t connection_close_time;
|
||||||
DaybreakEncodeType encode_passes[2];
|
ReliableStreamEncodeType encode_passes[2];
|
||||||
int port;
|
int port;
|
||||||
double outgoing_data_rate;
|
double outgoing_data_rate;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DaybreakConnectionManager
|
class ReliableStreamConnectionManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DaybreakConnectionManager();
|
ReliableStreamConnectionManager();
|
||||||
DaybreakConnectionManager(const DaybreakConnectionManagerOptions &opts);
|
ReliableStreamConnectionManager(const ReliableStreamConnectionManagerOptions &opts);
|
||||||
~DaybreakConnectionManager();
|
~ReliableStreamConnectionManager();
|
||||||
|
|
||||||
void Connect(const std::string &addr, int port);
|
void Connect(const std::string &addr, int port);
|
||||||
void Process();
|
void Process();
|
||||||
void UpdateDataBudget();
|
void UpdateDataBudget();
|
||||||
void ProcessResend();
|
void ProcessResend();
|
||||||
void OnNewConnection(std::function<void(std::shared_ptr<DaybreakConnection>)> func) { m_on_new_connection = func; }
|
void OnNewConnection(std::function<void(std::shared_ptr<ReliableStreamConnection>)> 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 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<DaybreakConnection>, const Packet &)> func) { m_on_packet_recv = 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; }
|
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:
|
private:
|
||||||
void Attach(uv_loop_t *loop);
|
void Attach(uv_loop_t *loop);
|
||||||
void Detach();
|
void Detach();
|
||||||
@@ -322,18 +329,18 @@ namespace EQ
|
|||||||
uv_timer_t m_timer;
|
uv_timer_t m_timer;
|
||||||
uv_udp_t m_socket;
|
uv_udp_t m_socket;
|
||||||
uv_loop_t *m_attached;
|
uv_loop_t *m_attached;
|
||||||
DaybreakConnectionManagerOptions m_options;
|
ReliableStreamConnectionManagerOptions m_options;
|
||||||
std::function<void(std::shared_ptr<DaybreakConnection>)> m_on_new_connection;
|
std::function<void(std::shared_ptr<ReliableStreamConnection>)> m_on_new_connection;
|
||||||
std::function<void(std::shared_ptr<DaybreakConnection>, DbProtocolStatus, DbProtocolStatus)> m_on_connection_state_change;
|
std::function<void(std::shared_ptr<ReliableStreamConnection>, DbProtocolStatus, DbProtocolStatus)> m_on_connection_state_change;
|
||||||
std::function<void(std::shared_ptr<DaybreakConnection>, const Packet&)> m_on_packet_recv;
|
std::function<void(std::shared_ptr<ReliableStreamConnection>, const Packet&)> m_on_packet_recv;
|
||||||
std::function<void(const std::string&)> m_on_error_message;
|
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);
|
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);
|
void SendDisconnect(const std::string &addr, int port);
|
||||||
|
|
||||||
friend class DaybreakConnection;
|
friend class ReliableStreamConnection;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <optional>
|
||||||
|
#include <atomic>
|
||||||
|
#include <memory>
|
||||||
|
#include <array>
|
||||||
|
#include <vector>
|
||||||
|
#include <mutex>
|
||||||
|
#include <iostream>
|
||||||
|
#include "../eqemu_logsys.h"
|
||||||
|
#include <uv.h>
|
||||||
|
|
||||||
|
constexpr size_t UDP_BUFFER_SIZE = 512;
|
||||||
|
|
||||||
|
struct EmbeddedContext {
|
||||||
|
size_t pool_index;
|
||||||
|
class SendBufferPool* pool;
|
||||||
|
};
|
||||||
|
|
||||||
|
class SendBufferPool {
|
||||||
|
public:
|
||||||
|
explicit SendBufferPool(size_t initial_capacity = 64)
|
||||||
|
: m_capacity(initial_capacity), m_head(0)
|
||||||
|
{
|
||||||
|
LogNetClient("[SendBufferPool] Initializing with capacity [{}]", (int)m_capacity);
|
||||||
|
|
||||||
|
m_pool.reserve(m_capacity);
|
||||||
|
m_locks = std::make_unique<std::atomic_bool[]>(m_capacity);
|
||||||
|
|
||||||
|
for (size_t i = 0; i < m_capacity; ++i) {
|
||||||
|
auto* req = new PooledUdpSend();
|
||||||
|
req->context.pool_index = i;
|
||||||
|
req->context.pool = this;
|
||||||
|
req->uv_req.data = &req->context;
|
||||||
|
|
||||||
|
m_pool.emplace_back(std::unique_ptr<PooledUdpSend>(req));
|
||||||
|
m_locks[i].store(false, std::memory_order_relaxed);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<std::tuple<uv_udp_send_t*, char*, EmbeddedContext*>> acquire() {
|
||||||
|
size_t cap = m_capacity.load(std::memory_order_acquire);
|
||||||
|
for (size_t i = 0; i < cap; ++i) {
|
||||||
|
size_t index = m_head.fetch_add(1, std::memory_order_relaxed) % cap;
|
||||||
|
bool expected = false;
|
||||||
|
if (m_locks[index].compare_exchange_strong(expected, true)) {
|
||||||
|
auto* req = m_pool[index].get();
|
||||||
|
LogNetClientDetail("[SendBufferPool] Acquired [{}]", index);
|
||||||
|
return std::make_tuple(&req->uv_req, req->buffer.data(), &req->context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LogNetClient("[SendBufferPool] Growing from [{}] to [{}]", cap, cap * 2);
|
||||||
|
grow();
|
||||||
|
return acquireAfterGrowth();
|
||||||
|
}
|
||||||
|
|
||||||
|
void release(EmbeddedContext* ctx) {
|
||||||
|
if (!ctx || ctx->pool != this || ctx->pool_index >= m_capacity.load(std::memory_order_acquire)) {
|
||||||
|
LogNetClient("[SendBufferPool] Invalid context release [{}]", ctx ? ctx->pool_index : -1);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
m_locks[ctx->pool_index].store(false, std::memory_order_release);
|
||||||
|
LogNetClientDetail("[SendBufferPool] Released [{}]", ctx->pool_index);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
struct PooledUdpSend {
|
||||||
|
uv_udp_send_t uv_req;
|
||||||
|
std::array<char, UDP_BUFFER_SIZE> buffer;
|
||||||
|
EmbeddedContext context;
|
||||||
|
};
|
||||||
|
|
||||||
|
std::vector<std::unique_ptr<PooledUdpSend>> m_pool;
|
||||||
|
std::unique_ptr<std::atomic_bool[]> m_locks;
|
||||||
|
std::atomic<size_t> m_capacity;
|
||||||
|
std::atomic<size_t> m_head;
|
||||||
|
std::mutex m_grow_mutex;
|
||||||
|
|
||||||
|
void grow() {
|
||||||
|
std::lock_guard<std::mutex> lock(m_grow_mutex);
|
||||||
|
|
||||||
|
size_t old_cap = m_capacity.load(std::memory_order_acquire);
|
||||||
|
size_t new_cap = old_cap * 2;
|
||||||
|
|
||||||
|
m_pool.reserve(new_cap);
|
||||||
|
for (size_t i = old_cap; i < new_cap; ++i) {
|
||||||
|
auto* req = new PooledUdpSend();
|
||||||
|
req->context.pool_index = i;
|
||||||
|
req->context.pool = this;
|
||||||
|
req->uv_req.data = &req->context;
|
||||||
|
|
||||||
|
m_pool.emplace_back(std::unique_ptr<PooledUdpSend>(req));
|
||||||
|
}
|
||||||
|
|
||||||
|
auto new_locks = std::make_unique<std::atomic_bool[]>(new_cap);
|
||||||
|
for (size_t i = 0; i < old_cap; ++i) {
|
||||||
|
new_locks[i].store(m_locks[i].load(std::memory_order_acquire));
|
||||||
|
}
|
||||||
|
for (size_t i = old_cap; i < new_cap; ++i) {
|
||||||
|
new_locks[i].store(false, std::memory_order_relaxed);
|
||||||
|
}
|
||||||
|
|
||||||
|
m_locks = std::move(new_locks);
|
||||||
|
m_capacity.store(new_cap, std::memory_order_release);
|
||||||
|
|
||||||
|
LogNetClient("[SendBufferPool] Grew to [{}] from [{}]", new_cap, old_cap);
|
||||||
|
}
|
||||||
|
|
||||||
|
std::optional<std::tuple<uv_udp_send_t*, char*, EmbeddedContext*>> acquireAfterGrowth() {
|
||||||
|
size_t cap = m_capacity.load(std::memory_order_acquire);
|
||||||
|
for (size_t i = 0; i < cap; ++i) {
|
||||||
|
size_t index = m_head.fetch_add(1, std::memory_order_relaxed) % cap;
|
||||||
|
bool expected = false;
|
||||||
|
if (m_locks[index].compare_exchange_strong(expected, true)) {
|
||||||
|
auto* req = m_pool[index].get();
|
||||||
|
LogNetClient("[SendBufferPool] Acquired after grow [{}]", index);
|
||||||
|
return std::make_tuple(&req->uv_req, req->buffer.data(), &req->context);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return std::nullopt;
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -8,7 +8,7 @@ namespace EQ
|
|||||||
{
|
{
|
||||||
namespace Net
|
namespace Net
|
||||||
{
|
{
|
||||||
struct DaybreakHeader
|
struct ReliableStreamHeader
|
||||||
{
|
{
|
||||||
static size_t size() { return 2; }
|
static size_t size() { return 2; }
|
||||||
uint8_t zero;
|
uint8_t zero;
|
||||||
@@ -22,7 +22,7 @@ namespace EQ
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DaybreakConnect
|
struct ReliableStreamConnect
|
||||||
{
|
{
|
||||||
static size_t size() { return 14; }
|
static size_t size() { return 14; }
|
||||||
uint8_t zero;
|
uint8_t zero;
|
||||||
@@ -42,7 +42,7 @@ namespace EQ
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DaybreakConnectReply
|
struct ReliableStreamConnectReply
|
||||||
{
|
{
|
||||||
static size_t size() { return 17; }
|
static size_t size() { return 17; }
|
||||||
uint8_t zero;
|
uint8_t zero;
|
||||||
@@ -68,7 +68,7 @@ namespace EQ
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DaybreakDisconnect
|
struct ReliableStreamDisconnect
|
||||||
{
|
{
|
||||||
static size_t size() { return 8; }
|
static size_t size() { return 8; }
|
||||||
uint8_t zero;
|
uint8_t zero;
|
||||||
@@ -84,7 +84,7 @@ namespace EQ
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DaybreakReliableHeader
|
struct ReliableStreamReliableHeader
|
||||||
{
|
{
|
||||||
static size_t size() { return 4; }
|
static size_t size() { return 4; }
|
||||||
uint8_t zero;
|
uint8_t zero;
|
||||||
@@ -100,10 +100,10 @@ namespace EQ
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DaybreakReliableFragmentHeader
|
struct ReliableStreamReliableFragmentHeader
|
||||||
{
|
{
|
||||||
static size_t size() { return 4 + DaybreakReliableHeader::size(); }
|
static size_t size() { return 4 + ReliableStreamReliableHeader::size(); }
|
||||||
DaybreakReliableHeader reliable;
|
ReliableStreamReliableHeader reliable;
|
||||||
uint32_t total_size;
|
uint32_t total_size;
|
||||||
|
|
||||||
template <class Archive>
|
template <class Archive>
|
||||||
@@ -114,7 +114,7 @@ namespace EQ
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DaybreakSessionStatRequest
|
struct ReliableStreamSessionStatRequest
|
||||||
{
|
{
|
||||||
static size_t size() { return 40; }
|
static size_t size() { return 40; }
|
||||||
uint8_t zero;
|
uint8_t zero;
|
||||||
@@ -144,7 +144,7 @@ namespace EQ
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DaybreakSessionStatResponse
|
struct ReliableStreamSessionStatResponse
|
||||||
{
|
{
|
||||||
static size_t size() { return 40; }
|
static size_t size() { return 40; }
|
||||||
uint8_t zero;
|
uint8_t zero;
|
||||||
@@ -171,3 +171,4 @@ namespace EQ
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -62,15 +62,15 @@ void EQ::Net::ServertalkClient::Connect()
|
|||||||
m_connecting = true;
|
m_connecting = true;
|
||||||
EQ::Net::TCPConnection::Connect(m_addr, m_port, false, [this](std::shared_ptr<EQ::Net::TCPConnection> connection) {
|
EQ::Net::TCPConnection::Connect(m_addr, m_port, false, [this](std::shared_ptr<EQ::Net::TCPConnection> connection) {
|
||||||
if (connection == nullptr) {
|
if (connection == nullptr) {
|
||||||
LogF(Logs::General, Logs::TCPConnection, "Error connecting to {0}:{1}, attempting to reconnect...", m_addr, m_port);
|
LogNetTCP("Error connecting to {0}:{1}, attempting to reconnect...", m_addr, m_port);
|
||||||
m_connecting = false;
|
m_connecting = false;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
LogF(Logs::General, Logs::TCPConnection, "Connected to {0}:{1}", m_addr, m_port);
|
LogNetTCP("Connected to {0}:{1}", m_addr, m_port);
|
||||||
m_connection = connection;
|
m_connection = connection;
|
||||||
m_connection->OnDisconnect([this](EQ::Net::TCPConnection *c) {
|
m_connection->OnDisconnect([this](EQ::Net::TCPConnection *c) {
|
||||||
LogF(Logs::General, Logs::TCPConnection, "Connection lost to {0}:{1}, attempting to reconnect...", m_addr, m_port);
|
LogNetTCP("Connection lost to {0}:{1}, attempting to reconnect...", m_addr, m_port);
|
||||||
m_connection.reset();
|
m_connection.reset();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -23,6 +23,9 @@ namespace EQ
|
|||||||
bool Connected() const { return m_connecting != true; }
|
bool Connected() const { return m_connecting != true; }
|
||||||
|
|
||||||
std::shared_ptr<EQ::Net::TCPConnection> Handle() { return m_connection; }
|
std::shared_ptr<EQ::Net::TCPConnection> Handle() { return m_connection; }
|
||||||
|
|
||||||
|
const std::unique_ptr<EQ::Timer> &GetTimer() const { return m_timer; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void Connect();
|
void Connect();
|
||||||
void ProcessData(EQ::Net::TCPConnection *c, const unsigned char *data, size_t length);
|
void ProcessData(EQ::Net::TCPConnection *c, const unsigned char *data, size_t length);
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user