Compare commits

..

68 Commits

Author SHA1 Message Date
Alex 74dad42b59 Merge 42a3780d80 into 9b3f9f356d 2025-11-24 07:57:16 +00:00
KimLS 42a3780d80 PERL_SET_INTERP causes an issue on newer versions of perl on windows because a symbol is not properly exported in their API, change the lines so it's basically what it used to be 2025-11-23 23:57:06 -08:00
KimLS e544f72da0 Perl link got lost 2025-11-23 21:37:37 -08:00
KimLS 587422bdc1 Set perlbind include dir 2025-11-23 13:54:01 -08:00
KimLS f4717b8414 Actually add file 2025-11-22 23:41:58 -08:00
KimLS 64329f3e59 Remove pkg-config, it's the suggested way to use luajit with vcpkg but it causes issues with CI and might be a pain point for windows users 2025-11-22 23:24:45 -08:00
KimLS feaf907210 vcpkg baseline set for CI 2025-11-22 22:51:10 -08:00
KimLS 3f8746d33c More cleanup 2025-11-22 22:34:32 -08:00
KimLS 1168d3bc37 remove old zlibng, remove perlwrap, remove hc 2025-11-22 17:41:19 -08:00
KimLS e81f36c0a6 Cleanup main file 2025-11-20 22:41:35 -08:00
dependabot[bot] 9b3f9f356d Bump golang.org/x/crypto in /utils/scripts/build/should-release (#5032)
Build / Linux (push) Has been cancelled
Build / Windows (push) Has been cancelled
Bumps [golang.org/x/crypto](https://github.com/golang/crypto) from 0.36.0 to 0.45.0.
- [Commits](https://github.com/golang/crypto/compare/v0.36.0...v0.45.0)

---
updated-dependencies:
- dependency-name: golang.org/x/crypto
  dependency-version: 0.45.0
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-11-20 19:44:17 +01:00
KimLS 47ff765ae1 Merge fix 2025-11-18 20:41:26 -08:00
brainiac e42dc2e1d2 Add Github Actions support (#5031)
Build / Linux (push) Has been cancelled
Build / Windows (push) Has been cancelled
Basic support for building linux and windows in pull requests and also
the master branch.

Removes search for local perl on windows. Just always use the packaged
perl until we can switch to a package manager.

Removes drone config file, since that isn't doing anything useful anymore.
2025-11-17 10:21:05 -08:00
KimLS 2239bba2c5 Zone works but is messy, tomorrow futher cleanup! 2025-11-16 23:20:03 -08:00
KimLS 87076e8487 loginserver works 2025-11-16 22:52:45 -08:00
KimLS 95b91431dd queryserv and eqlaunch 2025-11-16 22:48:55 -08:00
KimLS 2d30df179c UCS compiles now too! 2025-11-16 22:47:54 -08:00
KimLS 897512a43e World, had to swap out zlib-ng for now because it wasn't playing nicely along side the zlib install. May revisit. 2025-11-16 22:43:58 -08:00
KimLS b9f8d7c3b1 Tests and more cmake version updates 2025-11-16 22:26:34 -08:00
KimLS 625cfdb179 client files compile 2025-11-16 22:22:00 -08:00
KimLS f72474216f shared_memory compiles 2025-11-16 22:21:10 -08:00
KimLS af0fd14a38 Fix common build. 2025-11-16 16:53:20 -08:00
KimLS 2f78b6c2f3 WIP, luabind and perlbind build. Common only partially builds. 2025-11-15 22:30:54 -08:00
KimLS d61effbb8f Add finds to the toplevel cmakelists 2025-11-13 21:34:14 -08:00
KimLS 0f7abb8c25 Update vcpkg to no longer be from 2022, update cmake lists (wip) 2025-11-13 21:11:03 -08:00
KimLS 2faa3ec478 Remove cmake ext we wont be using anymore 2025-11-12 23:32:03 -08:00
KimLS 792bd3be96 Simple vcpkg manifest, will almost certainly need tweaking 2025-11-12 23:26:57 -08:00
KimLS 97a34ded56 Start rewrite, add vcpkg 2025-11-12 23:12:33 -08:00
m0th c611a25385 Dev Container Overhaul (#5023)
* Cleanup & Reorganize Makefile for Dev Containers

* Fix Makefile & misc fixes

---------

Co-authored-by: m0th <43860202+m0th@users.noreply.github.com>
2025-10-29 22:22:23 -07:00
Vayle f74efcaa5f [Bug Fix] Enhance SummonItemIntoInventory() to support stacking of items (#5022)
* Initial plan

* Initial plan

* Enhance SummonItemIntoInventory to support stacking

Co-authored-by: Valorith <76063792+Valorith@users.noreply.github.com>

* Update .gitignore

* Revert "Update .gitignore"

This reverts commit 16159398d8.

* Disable PCH for patch sources compiled with -O0

Disables precompiled headers for specific patch source files that are compiled with -O0 on UNIX. This avoids Clang errors caused by __OPTIMIZE__ macro state mismatches between the PCH and translation units.

---------

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
2025-10-22 22:50:00 -07:00
Jordan Conner eb4e7d694c Update client.cpp HandleEnterWorldPacket for UCS Local Address (#5020)
world/client.cpp's EnterWorld will correctly serve a LAN client the eqemu_config.json.world.localaddress based off IsLocalClient. It will then serve a non-LAN client the world.address value. This concept needs to be applied to UCS as that system also receives direct client connections. Inside world/client.cpp HandleEnterWorldPacket is where world sends the client info about UCS connection. This fix specifically handles the issue when you have a server on LAN and want to connect to it via another LAN computer + you have external clients.
2025-10-22 22:37:37 -07:00
Exonintrendo ecc0d4b5c0 updated crash report url to new hosted spire location (#5024) 2025-10-16 10:22:49 -07:00
Chris Miles 8175ae6187 [Release] 23.10.3 2025-09-17 01:31:48 -05:00
Chris Miles e8f4ffd628 [Release] 23.10.2 2025-09-17 00:52:31 -05:00
Chris Miles 0447618f7e hotfix: merge fix 2025-09-17 00:50:03 -05:00
Chris Miles e71ce001ff Hotfix: revert #4996 2025-09-17 00:47:42 -05:00
Alex King 1575a2af40 [Hotfix] Fixed Mail Key Bug (#5015)
* [Hotfix] Fixed Mail Key Bug

* Release
2025-09-16 22:52:57 -04:00
JJ 4b69df646c [Release] 23.10.0 (#5014)
* Update CHANGELOG.md

* Update version.h

* Update package.json
2025-09-16 11:35:03 -04:00
Alex King 044b9c1420 [Repositories] Convert Mail Key to Repositories (#5007)
* [Repositories] Convert Mail Key to Repositories

* Update shareddb.cpp

---------

Co-authored-by: JJ <3617814+joligario@users.noreply.github.com>
2025-09-15 14:23:48 -04:00
Alex King 0bbb5b90e7 [Repositories] Convert Total Time Played to Repositories (#5008) 2025-09-15 09:14:59 -04:00
Alex King 6506ad5b51 [Quest API] Add EVENT_CHARM_START and EVENT_CHARM_END (#5013) 2025-09-15 09:14:46 -04:00
Alex King dcaa0ecdaa [Quest API] Add Identifiers to Get/Modify NPC Stat Methods (#5012) 2025-09-15 09:14:29 -04:00
Mitch Freeman 9b143132be [Bug Fix] Fix Several Evolving Item Bugs (#4992)
* Add sending evolving items via parcels
Send, retrieve and inspect tested ok

* Sell evolving items to a merchant and purchase tested ok.

* Fix a problem with potions and quantity
2025-09-07 22:51:39 -04:00
Mitch Freeman 231bf8b4ec Update database_update_manifest.cpp (#5011) 2025-09-07 19:13:00 -04:00
Alex King dee58f9a91 [Repositories] Convert Shared Bank Platinum to Repositories (#5006) 2025-09-01 21:39:24 -04:00
Alex King 1eb89edbbd [Repositories] Convert Item Loading to Repositories (#4998) 2025-08-30 16:39:23 -04:00
Alex King e015d0d67e [Repositories] Convert Damage Shield Types to Repositories (#4995)
* [Repositories] Convert Damage Shield Types to Repositories

* Remove max spell ID
2025-08-30 16:23:33 -04:00
Alex King ba78394ce9 [Repositories] Convert Spell Loading to Repositories (#4996) 2025-08-30 15:42:04 -04:00
Alex King 060f6e377d [Constants] Convert SE Defines to SpellEffect Namespace (#4999) 2025-08-30 15:33:19 -04:00
Alex King 92c8b0e585 [Constants] Change Race Changes to Race Namespace (#5000) 2025-08-30 15:33:11 -04:00
Alex King 33df8ea665 [Repositories] Convert Character Inspect Messages to Repositories (#4997) 2025-08-30 14:42:40 -04:00
Alex King 9668074d94 [Bug Fix] Fix Recipe Inspect Bug (#4994) 2025-08-30 13:56:14 -04:00
Alex King 822a5dcac4 [Cleanup] Cleanup #show ip_lookup Message (#5005)
* [Cleanup] Cleanup #show ip_lookup Message

* Test

* Update clientlist.cpp
2025-08-30 13:05:18 -04:00
Alex King 0c65a4febe [Cleanup] Fix #set race 0 Message (#5004) 2025-08-29 20:08:03 -04:00
Alex King 02f66de679 [Cleanup] Remove Unused errorname Variable (#5001) 2025-08-29 12:02:11 -04:00
Alex King 145111f11e [Bug Fix] Fix Task Reloading (#5002) 2025-08-29 06:52:51 -04:00
Alex King a4e47d9180 [Pets] Add Pet Constants and Methods (#4987)
* [Pets] Add Pet Constants and Methods

* Remove GetID

* GetPetTypeName()

* Cleanup
2025-08-17 01:00:31 -04:00
Alex King 207ee2daa0 [Database] Add heal_amount to character_stats_record (#4986)
* [Database] Add heal_amount to character_stats_record

* Update version.h
2025-08-16 21:35:55 -04:00
Alex King 1fe5d9fa4f [Commands] Add #task complete Saylink to #task show (#4985) 2025-08-16 21:35:38 -04:00
Alex King ed3f6c2a40 [Cleanup] Fix Issues with Strings::Commify and Mob::SendStatsWindow (#4984) 2025-08-16 21:35:13 -04:00
Alex King adb3196ca5 [Cleanup] Add #npcedit npc_tint_id Help Message (#4982)
* [Cleanup] Add #npcedit npc_tint_id Help Message

* Update npcedit.cpp

* Update npcedit.cpp
2025-08-16 21:34:55 -04:00
Alex King e13b133ac8 [Quest API] Add GetNPCTintIndex() to Perl/Lua (#4983) 2025-08-16 21:34:39 -04:00
Alex King d475428157 [Quest API] Add GetKeyRing() to Perl/Lua (#4980) 2025-08-16 21:34:28 -04:00
Alex King 00b66ce432 [Commands] Add #find account Subcommand (#4981)
Credit goes to https://github.com/The-Heroes-Journey-EQEMU/Server/pull/281
2025-08-16 21:34:16 -04:00
Alex 4d12dd5c43 [Code] Remove Attributions (#4988) 2025-08-15 23:36:35 -05:00
regneq c4f408bffc [Bug Fix] Fix Race 474 for Titanium (#4979) 2025-08-11 16:49:59 -04:00
Alex King d876c6df2a [Bug Fix] Fix #show recipe uint16 Cap (#4978) 2025-08-11 14:06:13 -04:00
Alex King d142e1ca81 [Hotfix] Fix Quest Ownership Edge Case (#4977)
* [Hotfix] Fix Quest Ownership Edge Case

* Push
2025-08-02 22:09:30 -05:00
358 changed files with 7597 additions and 53312 deletions
+5 -6
View File
@@ -1,6 +1,5 @@
!Makefile base/
base/*.sql !base/*.json
base/*.zip override/
base/db/ repo/
base/maps/ cache/
!base/expansion/Makefile
+133 -189
View File
@@ -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
+33 -2
View File
@@ -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
View File
@@ -1,98 +0,0 @@
---
kind: pipeline
type: docker
name: Build Linux
# Limits how many of these builds can run on the drone runner at a time, this isn't about cores
concurrency:
limit: 1
volumes:
- name: cache
host:
path: /var/lib/cache-release
steps:
- name: Build Linux X64
image: akkadius/eqemu-server:v14
environment:
GITHUB_TOKEN:
from_secret: GH_RELEASE_GITHUB_API_TOKEN
RCLONE_CONFIG_REMOTE_TYPE: ftp
RCLONE_FTP_HOST: drone.akkadius.com
RCLONE_FTP_USER: artifacts
RCLONE_FTP_PASS:
from_secret: RCLONE_FTP_PASS
commands:
- ./utils/scripts/build/linux-build.sh
volumes:
- name: cache
path: /home/eqemu/.ccache/
---
kind: pipeline
type: exec
name: Build Windows
# Limits how many of these builds can run on the drone runner at a time, this isn't about cores
concurrency:
limit: 1
platform:
os: windows
arch: amd64
steps:
- name: Build Windows X64
environment:
RCLONE_CONFIG_REMOTE_TYPE: ftp
RCLONE_FTP_HOST: drone.akkadius.com
RCLONE_FTP_USER: artifacts
RCLONE_FTP_PASS:
from_secret: RCLONE_FTP_PASS
GITHUB_TOKEN:
from_secret: GH_RELEASE_GITHUB_API_TOKEN
commands:
- .\utils\scripts\build\windows-build.ps1
---
kind: pipeline
type: docker
name: Publish Artifacts to Github
steps:
- name: Upload Artifacts
image: akkadius/eqemu-build-releaser:v3
environment:
RCLONE_CONFIG_REMOTE_TYPE: ftp
RCLONE_FTP_HOST: drone.akkadius.com
RCLONE_FTP_USER: artifacts
RCLONE_FTP_PASS:
from_secret: RCLONE_FTP_PASS
GH_RELEASE_GITHUB_API_TOKEN:
from_secret: GH_RELEASE_GITHUB_API_TOKEN
GITHUB_TOKEN:
from_secret: GH_RELEASE_GITHUB_API_TOKEN
commands:
- ./utils/scripts/build/should-release/should-release
- rclone config create remote ftp env_auth true > /dev/null
- |
rclone copy remote: --include "eqemu-server*.zip" .
- gh-release --assets=eqemu-server-linux-x64.zip,eqemu-server-windows-x64.zip -y
- |
rclone delete remote: --include "eqemu-server*.zip"
trigger:
branch:
- master
event:
- push
depends_on:
- Build Windows
- Build Linux
+81
View File
@@ -0,0 +1,81 @@
name: Build
on:
push:
branches:
- master
pull_request:
jobs:
linux:
name: Linux
runs-on: ubuntu-latest
steps:
- name: Checkout source
uses: actions/checkout@v5
with:
submodules: recursive
- name: Setup ccache
uses: hendrikmuhs/ccache-action@v1.2
with:
key: ${{ runner.os }}-ccache
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential ninja-build ccache 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
View File
@@ -16,3 +16,6 @@
[submodule "submodules/recastnavigation"] [submodule "submodules/recastnavigation"]
path = submodules/recastnavigation path = submodules/recastnavigation
url = https://github.com/EQEmu/recastnavigation.git url = https://github.com/EQEmu/recastnavigation.git
[submodule "submodules/vcpkg"]
path = submodules/vcpkg
url = https://github.com/microsoft/vcpkg.git
-25
View File
@@ -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",
}
} }
} }
+87
View File
@@ -1,3 +1,90 @@
## [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 ## [23.9.0] 8/2/2025
### Bots ### Bots
+233 -433
View File
@@ -1,490 +1,290 @@
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) if(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE) endif()
SET(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD 20)
SET(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
OPTION(EQEMU_BUILD_STATIC "Build with static linking" OFF) option(EQEMU_BUILD_STATIC "Build with static linking" OFF)
OPTION(EQEMU_BUILD_PCH "Build with precompiled headers (Windows)" ON) option(EQEMU_BUILD_PCH "Build with precompiled headers (Windows)" ON)
IF (EQEMU_BUILD_STATIC) if(EQEMU_BUILD_STATIC)
SET(BUILD_SHARED_LIBS OFF) set(BUILD_SHARED_LIBS OFF)
SET(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".a") set(CMAKE_FIND_LIBRARY_SUFFIXES ".lib" ".a")
MESSAGE(STATUS "Building with static linking") message(STATUS "Building with static linking")
SET(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++") set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
IF (UNIX) if(UNIX)
SET(PERL_LIBRARY "/opt/eqemu-perl/lib/5.32.1/x86_64-linux-thread-multi/CORE/libperl.so") 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_INCLUDE_PATH "/opt/eqemu-perl/lib/5.32.1/x86_64-linux-thread-multi/CORE/")
SET(PERL_EXECUTABLE "/opt/eqemu-perl/bin/perl") set(PERL_EXECUTABLE "/opt/eqemu-perl/bin/perl")
ENDIF () endif()
ENDIF (EQEMU_BUILD_STATIC) endif()
# 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_compile_options(/bigobj) add_compile_options(/bigobj)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) add_definitions(-D_CRT_SECURE_NO_WARNINGS)
ADD_DEFINITIONS(-DNOMINMAX) add_definitions(-DNOMINMAX)
ADD_DEFINITIONS(-DCRASH_LOGGING) add_definitions(-DCRASH_LOGGING)
ADD_DEFINITIONS(-D_HAS_AUTO_PTR_ETC) # for Luabind on C++17 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() if(UNIX AND EQEMU_BUILD_STATIC)
SET(ZLIB_LIBRARY_TYPE " zlib") set(SERVER_LIBS ${SERVER_LIBS} libcrypt.a)
SET(ZLIB_LIBRARY_LIBS ${ZLIB_LIBRARY}) endif()
SET(ZLIB_LIBRARY_INCLUDE ${ZLIB_INCLUDE_DIRS}) endif()
ENDIF() endif()
ELSE()
SET(ZLIB_LIBRARY_TYPE "zlib-ng")
SET(ZLIB_LIBRARY_LIBS "zlibstatic")
SET(ZLIB_LIBRARY_INCLUDE "${CMAKE_CURRENT_SOURCE_DIR}/libs/zlibng")
ENDIF()
IF (EQEMU_BUILD_STATIC)
SET(ZLIB_LIBRARY_LIBS libz.a)
ENDIF(EQEMU_BUILD_STATIC)
MESSAGE(STATUS "")
MESSAGE(STATUS "**************************************************")
MESSAGE(STATUS "* Library Usage *")
MESSAGE(STATUS "**************************************************")
MESSAGE(STATUS "* Database: ${DATABASE_LIBRARY_TYPE} *")
MESSAGE(STATUS "* TLS: ${TLS_LIBRARY_TYPE} *")
MESSAGE(STATUS "* Sodium: ${SODIUM_LIBRARY_TYPE} *")
MESSAGE(STATUS "* Lua: ${LUA_LIBRARY_TYPE} *")
MESSAGE(STATUS "* Perl: ${PERL_LIBRARY_TYPE} *")
MESSAGE(STATUS "* zlib: ${ZLIB_LIBRARY_TYPE} *")
MESSAGE(STATUS "**************************************************")
#setup server libs and headers
SET(SERVER_LIBS common ${DATABASE_LIBRARY_LIBS} ${ZLIB_LIBRARY_LIBS} ${Boost_LIBRARIES} uv_a fmt RecastNavigation::Detour)
set(FMT_HEADER_ONLY OFF)
INCLUDE_DIRECTORIES(SYSTEM "${DATABASE_LIBRARY_INCLUDE}")
INCLUDE_DIRECTORIES(SYSTEM "${ZLIB_LIBRARY_INCLUDE}")
INCLUDE_DIRECTORIES(SYSTEM "${Boost_INCLUDE_DIRS}")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/glm")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/cereal/include")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/fmt/include")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/libuv/include" )
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigation/DebugUtils/Include")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigation/Detour/Include")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigation/DetourCrowd/Include")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigation/DetourTileCache/Include")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/recastnavigation/Recast/Include")
INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/websocketpp")
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)
+49
View File
@@ -0,0 +1,49 @@
{
"version": 3,
"cmakeMinimumRequired": {
"major": 3,
"minor": 19,
"patch": 0
},
"configurePresets": [
{
"name": "linux-debug",
"displayName": "Linux Debug",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug",
"CMAKE_EXPORT_COMPILE_COMMANDS": "ON",
"CMAKE_C_COMPILER_LAUNCHER": "ccache",
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache",
"EQEMU_BUILD_LOGIN": "ON",
"EQEMU_BUILD_TESTS": "ON",
"EQEMU_ADD_PROFILER": "ON"
}
},
{
"name": "linux-release",
"displayName": "Linux Release",
"generator": "Ninja",
"binaryDir": "${sourceDir}/build/release",
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Release",
"CMAKE_C_COMPILER_LAUNCHER": "ccache",
"CMAKE_CXX_COMPILER_LAUNCHER": "ccache",
"EQEMU_BUILD_LOGIN": "ON"
}
},
{
"name": "win-msvc",
"displayName": "Windows MSVC (VS 2022)",
"generator": "Visual Studio 17 2022",
"binaryDir": "${sourceDir}/build/{presetName}",
"architecture": { "value": "x64" },
"cacheVariables": {
"CMAKE_CONFIGURATION_TYPES": "Debug;Release",
"EQEMU_BUILD_LOGIN": "ON",
"EQEMU_BUILD_TESTS": "ON"
}
}
]
}
+1 -1
View File
@@ -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)
+7 -7
View File
@@ -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)
+7 -7
View File
@@ -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)
-94
View 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()
-91
View File
@@ -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)
-1
View File
@@ -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)
-87
View File
@@ -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
)
-87
View File
@@ -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
)
-30
View File
@@ -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)
-93
View File
@@ -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
)
+34 -29
View File
@@ -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
@@ -104,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
@@ -132,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
@@ -531,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
@@ -603,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
@@ -671,13 +669,13 @@ 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_pooling.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
@@ -724,29 +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_pooling.h
net/daybreak_structs.h
net/dns.h net/dns.h
net/endian.h net/endian.h
net/eqmq.cpp net/eqmq.cpp
@@ -755,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
@@ -775,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
@@ -819,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
@@ -832,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 (EQEMU_BUILD_PCH) if(UNIX)
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()
if(EQEMU_BUILD_PCH)
TARGET_PRECOMPILE_HEADERS(common PRIVATE pch/std-pch.h) TARGET_PRECOMPILE_HEADERS(common PRIVATE pch/std-pch.h)
ENDIF () # 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) set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
+1
View File
@@ -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"
+1
View File
@@ -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"
+1 -1
View File
@@ -23,7 +23,7 @@ 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
}; };
@@ -7160,7 +7160,32 @@ ALTER TABLE loottable_entries
)", )",
.content_schema_update = true .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,
+1
View File
@@ -3,6 +3,7 @@
#include "rulesys.h" #include "rulesys.h"
#include "util/uuid.h" #include "util/uuid.h"
#include <fmt/format.h> #include <fmt/format.h>
#include <fmt/ranges.h>
#include <cereal/types/chrono.hpp> #include <cereal/types/chrono.hpp>
DzLockout::DzLockout(std::string uuid, std::string expedition, std::string event, uint64_t expire_time, uint32_t duration) DzLockout::DzLockout(std::string uuid, std::string expedition, std::string event, uint64_t expire_time, uint32_t duration)
+20
View File
@@ -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();
}
+127
View File
@@ -792,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*/
+6 -6
View File
@@ -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];
}; };
+1
View File
@@ -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;
+1
View File
@@ -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 {
@@ -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>
+4
View File
@@ -74,6 +74,10 @@ void EvolvingItemsManager::DoLootChecks(const uint32 char_id, const uint16 slot_
e.item_id = inst.GetID(); e.item_id = inst.GetID();
e.equipped = inst.GetEvolveEquipped(); e.equipped = inst.GetEvolveEquipped();
e.final_item_id = EvolvingItemsManager::Instance()->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;
+29 -29
View File
@@ -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;
+1
View File
@@ -36,6 +36,7 @@
#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>
+1
View File
@@ -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"
+1 -1
View File
@@ -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
-206
View File
@@ -1,206 +0,0 @@
/*
These fields must be in the order of how they are serialized!
*/
F(itemclass)
F(name)
F(lore)
F(idfile)
F(id)
F(weight)
F(norent)
F(nodrop)
F(size)
F(slots)
F(price)
F(icon)
F(UNK012)
F(UNK013)
F(benefitflag)
F(tradeskills)
F(cr)
F(dr)
F(pr)
F(mr)
F(fr)
F(astr)
F(asta)
F(aagi)
F(adex)
F(acha)
F(aint)
F(awis)
F(hp)
F(mana)
F(ac)
F(deity)
F(skillmodvalue)
F(UNK033)
F(skillmodmax)
F(skillmodtype)
F(banedmgrace)
F(banedmgamt)
F(banedmgbody)
F(magic)
F(casttime_)
F(reqlevel)
F(bardtype)
F(bardvalue)
F(light)
F(delay)
F(reclevel)
F(recskill)
F(elemdmgtype)
F(elemdmgamt)
F(range)
F(damage)
F(color)
F(classes)
F(races)
F(UNK054)
F(maxcharges)
F(itemtype)
F(material)
F(herosforgemodel)
F(sellrate)
F(UNK059)
F(casttime)
F(elitematerial)
F(procrate)
F(combateffects)
F(shielding)
F(stunresist)
F(strikethrough)
F(extradmgskill)
F(extradmgamt)
F(spellshield)
F(avoidance)
F(accuracy)
F(charmfileid)
F(factionmod1)
F(factionmod2)
F(factionmod3)
F(factionmod4)
F(factionamt1)
F(factionamt2)
F(factionamt3)
F(factionamt4)
F(charmfile)
F(augtype)
F(augslot1type)
F(augslot1visible)
F(augslot2type)
F(augslot2visible)
F(augslot3type)
F(augslot3visible)
F(augslot4type)
F(augslot4visible)
F(augslot5type)
F(augslot5visible)
F(augslot6type)
F(augslot6visible)
F(ldontheme)
F(ldonprice)
F(ldonsold)
F(bagtype)
F(bagslots)
F(bagsize)
F(bagwr)
F(book)
F(booktype)
F(filename)
F(banedmgraceamt)
F(augrestrict)
F(loregroup)
F(pendingloreflag)
F(artifactflag)
F(summonedflag)
F(favor)
F(fvnodrop)
F(endur)
F(dotshielding)
F(attack)
F(regen)
F(manaregen)
F(enduranceregen)
F(haste)
F(damageshield)
F(recastdelay)
F(recasttype)
F(guildfavor)
F(augdistiller)
F(UNK123)
F(UNK124)
F(attuneable)
F(nopet)
F(UNK127)
F(pointtype)
F(potionbelt)
F(potionbeltslots)
F(stacksize)
F(notransfer)
F(stackable)
F(UNK134)
F(clickeffect)
F(clicktype)
F(clicklevel)
F(clicklevel2)
F(proceffect)
F(proctype)
F(proclevel)
F(proclevel2)
F(worneffect)
F(worntype)
F(wornlevel)
F(wornlevel2)
F(focuseffect)
F(focustype)
F(focuslevel)
F(focuslevel2)
F(scrolleffect)
F(scrolltype)
F(scrolllevel)
F(scrolllevel2)
F(bardeffect)
F(bardeffecttype)
F(bardlevel2)
F(bardlevel)
F(questitemflag)
F(svcorruption)
F(purity)
F(evoitem)
F(evoid)
F(evolvinglevel)
F(evomax)
F(backstabdmg)
F(dsmitigation)
F(heroic_str)
F(heroic_int)
F(heroic_wis)
F(heroic_agi)
F(heroic_dex)
F(heroic_sta)
F(heroic_cha)
F(heroic_mr)
F(heroic_fr)
F(heroic_cr)
F(heroic_dr)
F(heroic_pr)
F(heroic_svcorrup)
F(healamt)
F(spelldmg)
F(ldonsellbackrate)
F(scriptfileid)
F(expendablearrow)
F(clairvoyance)
F(clickname)
F(procname)
F(wornname)
F(focusname)
F(scrollname)
F(subtype)
+1
View File
@@ -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)
{ {
+1
View File
@@ -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)
{ {
+11 -11
View File
@@ -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;
@@ -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;
+8 -8
View File
@@ -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;
+1
View File
@@ -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)
{ {
@@ -1,9 +1,10 @@
#include "daybreak_connection.h" #include "reliable_stream_connection.h"
#include "../event/event_loop.h" #include "../event/event_loop.h"
#include "../data_verification.h" #include "../data_verification.h"
#include "crc32.h" #include "crc32.h"
#include <zlib.h> #include <zlib.h>
#include <fmt/format.h> #include <fmt/format.h>
#include <fmt/ranges.h>
// observed client receive window is 300 packets, 140KB // observed client receive window is 300 packets, 140KB
constexpr size_t MAX_CLIENT_RECV_PACKETS_PER_WINDOW = 300; constexpr size_t MAX_CLIENT_RECV_PACKETS_PER_WINDOW = 300;
@@ -12,7 +13,7 @@ constexpr size_t MAX_CLIENT_RECV_BYTES_PER_WINDOW = 140 * 1024;
// buffer pools // buffer pools
SendBufferPool send_buffer_pool; SendBufferPool send_buffer_pool;
EQ::Net::DaybreakConnectionManager::DaybreakConnectionManager() EQ::Net::ReliableStreamConnectionManager::ReliableStreamConnectionManager()
{ {
m_attached = nullptr; m_attached = nullptr;
memset(&m_timer, 0, sizeof(uv_timer_t)); memset(&m_timer, 0, sizeof(uv_timer_t));
@@ -21,7 +22,7 @@ EQ::Net::DaybreakConnectionManager::DaybreakConnectionManager()
Attach(EQ::EventLoop::Get().Handle()); Attach(EQ::EventLoop::Get().Handle());
} }
EQ::Net::DaybreakConnectionManager::DaybreakConnectionManager(const DaybreakConnectionManagerOptions &opts) EQ::Net::ReliableStreamConnectionManager::ReliableStreamConnectionManager(const ReliableStreamConnectionManagerOptions &opts)
{ {
m_attached = nullptr; m_attached = nullptr;
m_options = opts; m_options = opts;
@@ -31,12 +32,12 @@ EQ::Net::DaybreakConnectionManager::DaybreakConnectionManager(const DaybreakConn
Attach(EQ::EventLoop::Get().Handle()); Attach(EQ::EventLoop::Get().Handle());
} }
EQ::Net::DaybreakConnectionManager::~DaybreakConnectionManager() EQ::Net::ReliableStreamConnectionManager::~ReliableStreamConnectionManager()
{ {
Detach(); Detach();
} }
void EQ::Net::DaybreakConnectionManager::Attach(uv_loop_t *loop) void EQ::Net::ReliableStreamConnectionManager::Attach(uv_loop_t *loop)
{ {
if (!m_attached) { if (!m_attached) {
uv_timer_init(loop, &m_timer); uv_timer_init(loop, &m_timer);
@@ -45,7 +46,7 @@ void EQ::Net::DaybreakConnectionManager::Attach(uv_loop_t *loop)
auto update_rate = (uint64_t)(1000.0 / m_options.tic_rate_hertz); auto update_rate = (uint64_t)(1000.0 / m_options.tic_rate_hertz);
uv_timer_start(&m_timer, [](uv_timer_t *handle) { uv_timer_start(&m_timer, [](uv_timer_t *handle) {
DaybreakConnectionManager *c = (DaybreakConnectionManager*)handle->data; ReliableStreamConnectionManager *c = (ReliableStreamConnectionManager*)handle->data;
c->UpdateDataBudget(); c->UpdateDataBudget();
c->Process(); c->Process();
c->ProcessResend(); c->ProcessResend();
@@ -71,7 +72,7 @@ void EQ::Net::DaybreakConnectionManager::Attach(uv_loop_t *loop)
buf->len = 65536; buf->len = 65536;
}, },
[](uv_udp_t* handle, ssize_t nread, const uv_buf_t* buf, const struct sockaddr* addr, unsigned flags) { [](uv_udp_t* handle, ssize_t nread, const uv_buf_t* buf, const struct sockaddr* addr, unsigned flags) {
DaybreakConnectionManager *c = (DaybreakConnectionManager*)handle->data; ReliableStreamConnectionManager *c = (ReliableStreamConnectionManager*)handle->data;
if (nread < 0 || addr == nullptr) { if (nread < 0 || addr == nullptr) {
return; return;
} }
@@ -90,7 +91,7 @@ void EQ::Net::DaybreakConnectionManager::Attach(uv_loop_t *loop)
} }
} }
void EQ::Net::DaybreakConnectionManager::Detach() void EQ::Net::ReliableStreamConnectionManager::Detach()
{ {
if (m_attached) { if (m_attached) {
uv_udp_recv_stop(&m_socket); uv_udp_recv_stop(&m_socket);
@@ -99,11 +100,11 @@ void EQ::Net::DaybreakConnectionManager::Detach()
} }
} }
void EQ::Net::DaybreakConnectionManager::Connect(const std::string &addr, int port) void EQ::Net::ReliableStreamConnectionManager::Connect(const std::string &addr, int port)
{ {
//todo dns resolution //todo dns resolution
auto connection = std::shared_ptr<DaybreakConnection>(new DaybreakConnection(this, addr, port)); auto connection = std::shared_ptr<ReliableStreamConnection>(new ReliableStreamConnection(this, addr, port));
connection->m_self = connection; connection->m_self = connection;
if (m_on_new_connection) { if (m_on_new_connection) {
@@ -113,7 +114,7 @@ void EQ::Net::DaybreakConnectionManager::Connect(const std::string &addr, int po
m_connections.emplace(std::make_pair(std::make_pair(addr, port), connection)); m_connections.emplace(std::make_pair(std::make_pair(addr, port), connection));
} }
void EQ::Net::DaybreakConnectionManager::Process() void EQ::Net::ReliableStreamConnectionManager::Process()
{ {
auto now = Clock::now(); auto now = Clock::now();
auto iter = m_connections.begin(); auto iter = m_connections.begin();
@@ -177,7 +178,7 @@ void EQ::Net::DaybreakConnectionManager::Process()
} }
} }
void EQ::Net::DaybreakConnectionManager::UpdateDataBudget() void EQ::Net::ReliableStreamConnectionManager::UpdateDataBudget()
{ {
auto outgoing_data_rate = m_options.outgoing_data_rate; auto outgoing_data_rate = m_options.outgoing_data_rate;
if (outgoing_data_rate <= 0.0) { if (outgoing_data_rate <= 0.0) {
@@ -196,7 +197,7 @@ void EQ::Net::DaybreakConnectionManager::UpdateDataBudget()
} }
} }
void EQ::Net::DaybreakConnectionManager::ProcessResend() void EQ::Net::ReliableStreamConnectionManager::ProcessResend()
{ {
auto iter = m_connections.begin(); auto iter = m_connections.begin();
while (iter != m_connections.end()) { while (iter != m_connections.end()) {
@@ -217,15 +218,15 @@ void EQ::Net::DaybreakConnectionManager::ProcessResend()
} }
} }
void EQ::Net::DaybreakConnectionManager::ProcessPacket(const std::string &endpoint, int port, const char *data, size_t size) void EQ::Net::ReliableStreamConnectionManager::ProcessPacket(const std::string &endpoint, int port, const char *data, size_t size)
{ {
if (m_options.simulated_in_packet_loss && m_options.simulated_in_packet_loss >= m_rand.Int(0, 100)) { if (m_options.simulated_in_packet_loss && m_options.simulated_in_packet_loss >= m_rand.Int(0, 100)) {
return; return;
} }
if (size < DaybreakHeader::size()) { if (size < ReliableStreamHeader::size()) {
if (m_on_error_message) { if (m_on_error_message) {
m_on_error_message(fmt::format("Packet of size {0} which is less than {1}", size, DaybreakHeader::size())); m_on_error_message(fmt::format("Packet of size {0} which is less than {1}", size, ReliableStreamHeader::size()));
} }
return; return;
} }
@@ -239,9 +240,9 @@ void EQ::Net::DaybreakConnectionManager::ProcessPacket(const std::string &endpoi
else { else {
if (data[0] == 0 && data[1] == OP_SessionRequest) { if (data[0] == 0 && data[1] == OP_SessionRequest) {
StaticPacket p((void*)data, size); StaticPacket p((void*)data, size);
auto request = p.GetSerialize<DaybreakConnect>(0); auto request = p.GetSerialize<ReliableStreamConnect>(0);
connection = std::shared_ptr<DaybreakConnection>(new DaybreakConnection(this, request, endpoint, port)); connection = std::shared_ptr<ReliableStreamConnection>(new ReliableStreamConnection(this, request, endpoint, port));
connection->m_self = connection; connection->m_self = connection;
if (m_on_new_connection) { if (m_on_new_connection) {
@@ -262,7 +263,7 @@ void EQ::Net::DaybreakConnectionManager::ProcessPacket(const std::string &endpoi
} }
} }
std::shared_ptr<EQ::Net::DaybreakConnection> EQ::Net::DaybreakConnectionManager::FindConnectionByEndpoint(std::string addr, int port) std::shared_ptr<EQ::Net::ReliableStreamConnection> EQ::Net::ReliableStreamConnectionManager::FindConnectionByEndpoint(std::string addr, int port)
{ {
auto p = std::make_pair(addr, port); auto p = std::make_pair(addr, port);
auto iter = m_connections.find(p); auto iter = m_connections.find(p);
@@ -273,9 +274,9 @@ std::shared_ptr<EQ::Net::DaybreakConnection> EQ::Net::DaybreakConnectionManager:
return nullptr; return nullptr;
} }
void EQ::Net::DaybreakConnectionManager::SendDisconnect(const std::string &addr, int port) void EQ::Net::ReliableStreamConnectionManager::SendDisconnect(const std::string &addr, int port)
{ {
DaybreakDisconnect header; ReliableStreamDisconnect header;
header.zero = 0; header.zero = 0;
header.opcode = OP_OutOfSession; header.opcode = OP_OutOfSession;
header.connect_code = 0; header.connect_code = 0;
@@ -300,7 +301,7 @@ void EQ::Net::DaybreakConnectionManager::SendDisconnect(const std::string &addr,
} }
//new connection made as server //new connection made as server
EQ::Net::DaybreakConnection::DaybreakConnection(DaybreakConnectionManager *owner, const DaybreakConnect &connect, const std::string &endpoint, int port) EQ::Net::ReliableStreamConnection::ReliableStreamConnection(ReliableStreamConnectionManager *owner, const ReliableStreamConnect &connect, const std::string &endpoint, int port)
{ {
m_owner = owner; m_owner = owner;
m_last_send = Clock::now(); m_last_send = Clock::now();
@@ -327,7 +328,7 @@ EQ::Net::DaybreakConnection::DaybreakConnection(DaybreakConnectionManager *owner
} }
//new connection made as client //new connection made as client
EQ::Net::DaybreakConnection::DaybreakConnection(DaybreakConnectionManager *owner, const std::string &endpoint, int port) EQ::Net::ReliableStreamConnection::ReliableStreamConnection(ReliableStreamConnectionManager *owner, const std::string &endpoint, int port)
{ {
m_owner = owner; m_owner = owner;
m_last_send = Clock::now(); m_last_send = Clock::now();
@@ -349,11 +350,11 @@ EQ::Net::DaybreakConnection::DaybreakConnection(DaybreakConnectionManager *owner
m_outgoing_budget = owner->m_options.outgoing_data_rate; m_outgoing_budget = owner->m_options.outgoing_data_rate;
} }
EQ::Net::DaybreakConnection::~DaybreakConnection() EQ::Net::ReliableStreamConnection::~ReliableStreamConnection()
{ {
} }
void EQ::Net::DaybreakConnection::Close() void EQ::Net::ReliableStreamConnection::Close()
{ {
if (m_status != StatusDisconnected && m_status != StatusDisconnecting) { if (m_status != StatusDisconnected && m_status != StatusDisconnecting) {
FlushBuffer(); FlushBuffer();
@@ -367,17 +368,17 @@ void EQ::Net::DaybreakConnection::Close()
ChangeStatus(StatusDisconnecting); ChangeStatus(StatusDisconnecting);
} }
void EQ::Net::DaybreakConnection::QueuePacket(Packet &p) void EQ::Net::ReliableStreamConnection::QueuePacket(Packet &p)
{ {
QueuePacket(p, 0, true); QueuePacket(p, 0, true);
} }
void EQ::Net::DaybreakConnection::QueuePacket(Packet &p, int stream) void EQ::Net::ReliableStreamConnection::QueuePacket(Packet &p, int stream)
{ {
QueuePacket(p, stream, true); QueuePacket(p, stream, true);
} }
void EQ::Net::DaybreakConnection::QueuePacket(Packet &p, int stream, bool reliable) void EQ::Net::ReliableStreamConnection::QueuePacket(Packet &p, int stream, bool reliable)
{ {
if (*(char*)p.Data() == 0) { if (*(char*)p.Data() == 0) {
DynamicPacket packet; DynamicPacket packet;
@@ -390,21 +391,21 @@ void EQ::Net::DaybreakConnection::QueuePacket(Packet &p, int stream, bool reliab
InternalQueuePacket(p, stream, reliable); InternalQueuePacket(p, stream, reliable);
} }
EQ::Net::DaybreakConnectionStats EQ::Net::DaybreakConnection::GetStats() EQ::Net::ReliableStreamConnectionStats EQ::Net::ReliableStreamConnection::GetStats()
{ {
EQ::Net::DaybreakConnectionStats ret = m_stats; EQ::Net::ReliableStreamConnectionStats ret = m_stats;
ret.datarate_remaining = m_outgoing_budget; ret.datarate_remaining = m_outgoing_budget;
ret.avg_ping = m_rolling_ping; ret.avg_ping = m_rolling_ping;
return ret; return ret;
} }
void EQ::Net::DaybreakConnection::ResetStats() void EQ::Net::ReliableStreamConnection::ResetStats()
{ {
m_stats.Reset(); m_stats.Reset();
} }
void EQ::Net::DaybreakConnection::Process() void EQ::Net::ReliableStreamConnection::Process()
{ {
try { try {
auto now = Clock::now(); auto now = Clock::now();
@@ -422,7 +423,7 @@ void EQ::Net::DaybreakConnection::Process()
} }
} }
void EQ::Net::DaybreakConnection::ProcessPacket(Packet &p) void EQ::Net::ReliableStreamConnection::ProcessPacket(Packet &p)
{ {
m_last_recv = Clock::now(); m_last_recv = Clock::now();
m_stats.recv_packets++; m_stats.recv_packets++;
@@ -458,13 +459,13 @@ void EQ::Net::DaybreakConnection::ProcessPacket(Packet &p)
switch (m_encode_passes[i]) { switch (m_encode_passes[i]) {
case EncodeCompression: case EncodeCompression:
if(temp.GetInt8(0) == 0) if(temp.GetInt8(0) == 0)
Decompress(temp, DaybreakHeader::size(), temp.Length() - DaybreakHeader::size()); Decompress(temp, ReliableStreamHeader::size(), temp.Length() - ReliableStreamHeader::size());
else else
Decompress(temp, 1, temp.Length() - 1); Decompress(temp, 1, temp.Length() - 1);
break; break;
case EncodeXOR: case EncodeXOR:
if (temp.GetInt8(0) == 0) if (temp.GetInt8(0) == 0)
Decode(temp, DaybreakHeader::size(), temp.Length() - DaybreakHeader::size()); Decode(temp, ReliableStreamHeader::size(), temp.Length() - ReliableStreamHeader::size());
else else
Decode(temp, 1, temp.Length() - 1); Decode(temp, 1, temp.Length() - 1);
break; break;
@@ -483,7 +484,7 @@ void EQ::Net::DaybreakConnection::ProcessPacket(Packet &p)
switch (m_encode_passes[i]) { switch (m_encode_passes[i]) {
case EncodeXOR: case EncodeXOR:
if (temp.GetInt8(0) == 0) if (temp.GetInt8(0) == 0)
Decode(temp, DaybreakHeader::size(), temp.Length() - DaybreakHeader::size()); Decode(temp, ReliableStreamHeader::size(), temp.Length() - ReliableStreamHeader::size());
else else
Decode(temp, 1, temp.Length() - 1); Decode(temp, 1, temp.Length() - 1);
break; break;
@@ -502,7 +503,7 @@ void EQ::Net::DaybreakConnection::ProcessPacket(Packet &p)
} }
} }
void EQ::Net::DaybreakConnection::ProcessQueue() void EQ::Net::ReliableStreamConnection::ProcessQueue()
{ {
for (int i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {
auto stream = &m_streams[i]; auto stream = &m_streams[i];
@@ -521,7 +522,7 @@ void EQ::Net::DaybreakConnection::ProcessQueue()
} }
} }
void EQ::Net::DaybreakConnection::RemoveFromQueue(int stream, uint16_t seq) void EQ::Net::ReliableStreamConnection::RemoveFromQueue(int stream, uint16_t seq)
{ {
auto s = &m_streams[stream]; auto s = &m_streams[stream];
auto iter = s->packet_queue.find(seq); auto iter = s->packet_queue.find(seq);
@@ -532,7 +533,7 @@ void EQ::Net::DaybreakConnection::RemoveFromQueue(int stream, uint16_t seq)
} }
} }
void EQ::Net::DaybreakConnection::AddToQueue(int stream, uint16_t seq, const Packet &p) void EQ::Net::ReliableStreamConnection::AddToQueue(int stream, uint16_t seq, const Packet &p)
{ {
auto s = &m_streams[stream]; auto s = &m_streams[stream];
auto iter = s->packet_queue.find(seq); auto iter = s->packet_queue.find(seq);
@@ -544,7 +545,7 @@ void EQ::Net::DaybreakConnection::AddToQueue(int stream, uint16_t seq, const Pac
} }
} }
void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p) void EQ::Net::ReliableStreamConnection::ProcessDecodedPacket(const Packet &p)
{ {
if (p.GetInt8(0) == 0) { if (p.GetInt8(0) == 0) {
if (p.Length() < 2) { if (p.Length() < 2) {
@@ -628,13 +629,13 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
case OP_SessionRequest: case OP_SessionRequest:
{ {
if (m_status == StatusConnected) { if (m_status == StatusConnected) {
auto request = p.GetSerialize<DaybreakConnect>(0); auto request = p.GetSerialize<ReliableStreamConnect>(0);
if (NetworkToHost(request.connect_code) != m_connect_code) { if (NetworkToHost(request.connect_code) != m_connect_code) {
return; return;
} }
DaybreakConnectReply reply; ReliableStreamConnectReply reply;
reply.zero = 0; reply.zero = 0;
reply.opcode = OP_SessionResponse; reply.opcode = OP_SessionResponse;
reply.connect_code = HostToNetwork(m_connect_code); reply.connect_code = HostToNetwork(m_connect_code);
@@ -656,13 +657,13 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
case OP_SessionResponse: case OP_SessionResponse:
{ {
if (m_status == StatusConnecting) { if (m_status == StatusConnecting) {
auto reply = p.GetSerialize<DaybreakConnectReply>(0); auto reply = p.GetSerialize<ReliableStreamConnectReply>(0);
if (m_connect_code == reply.connect_code) { if (m_connect_code == reply.connect_code) {
m_encode_key = reply.encode_key; m_encode_key = reply.encode_key;
m_crc_bytes = reply.crc_bytes; m_crc_bytes = reply.crc_bytes;
m_encode_passes[0] = (DaybreakEncodeType)reply.encode_pass1; m_encode_passes[0] = (ReliableStreamEncodeType)reply.encode_pass1;
m_encode_passes[1] = (DaybreakEncodeType)reply.encode_pass2; m_encode_passes[1] = (ReliableStreamEncodeType)reply.encode_pass2;
m_max_packet_size = reply.max_packet_size; m_max_packet_size = reply.max_packet_size;
ChangeStatus(StatusConnected); ChangeStatus(StatusConnected);
@@ -686,7 +687,7 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
return; return;
} }
auto header = p.GetSerialize<DaybreakReliableHeader>(0); auto header = p.GetSerialize<ReliableStreamReliableHeader>(0);
auto sequence = NetworkToHost(header.sequence); auto sequence = NetworkToHost(header.sequence);
auto stream_id = header.opcode - OP_Packet; auto stream_id = header.opcode - OP_Packet;
auto stream = &m_streams[stream_id]; auto stream = &m_streams[stream_id];
@@ -703,7 +704,7 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
RemoveFromQueue(stream_id, sequence); RemoveFromQueue(stream_id, sequence);
SendAck(stream_id, stream->sequence_in); SendAck(stream_id, stream->sequence_in);
stream->sequence_in++; stream->sequence_in++;
StaticPacket next((char*)p.Data() + DaybreakReliableHeader::size(), p.Length() - DaybreakReliableHeader::size()); StaticPacket next((char*)p.Data() + ReliableStreamReliableHeader::size(), p.Length() - ReliableStreamReliableHeader::size());
ProcessDecodedPacket(next); ProcessDecodedPacket(next);
} }
@@ -715,7 +716,7 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
case OP_Fragment3: case OP_Fragment3:
case OP_Fragment4: case OP_Fragment4:
{ {
auto header = p.GetSerialize<DaybreakReliableHeader>(0); auto header = p.GetSerialize<ReliableStreamReliableHeader>(0);
auto sequence = NetworkToHost(header.sequence); auto sequence = NetworkToHost(header.sequence);
auto stream_id = header.opcode - OP_Fragment; auto stream_id = header.opcode - OP_Fragment;
auto stream = &m_streams[stream_id]; auto stream = &m_streams[stream_id];
@@ -735,22 +736,22 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
stream->sequence_in++; stream->sequence_in++;
if (stream->fragment_total_bytes == 0) { if (stream->fragment_total_bytes == 0) {
auto fragheader = p.GetSerialize<DaybreakReliableFragmentHeader>(0); auto fragheader = p.GetSerialize<ReliableStreamReliableFragmentHeader>(0);
stream->fragment_total_bytes = NetworkToHost(fragheader.total_size); stream->fragment_total_bytes = NetworkToHost(fragheader.total_size);
stream->fragment_current_bytes = 0; stream->fragment_current_bytes = 0;
stream->fragment_packet.Reserve(stream->fragment_total_bytes); stream->fragment_packet.Reserve(stream->fragment_total_bytes);
stream->fragment_packet.PutData( stream->fragment_packet.PutData(
stream->fragment_current_bytes, stream->fragment_current_bytes,
(char*)p.Data() + DaybreakReliableFragmentHeader::size(), p.Length() - DaybreakReliableFragmentHeader::size()); (char*)p.Data() + ReliableStreamReliableFragmentHeader::size(), p.Length() - ReliableStreamReliableFragmentHeader::size());
stream->fragment_current_bytes += (uint32_t)(p.Length() - DaybreakReliableFragmentHeader::size()); stream->fragment_current_bytes += (uint32_t)(p.Length() - ReliableStreamReliableFragmentHeader::size());
} }
else { else {
stream->fragment_packet.PutData( stream->fragment_packet.PutData(
stream->fragment_current_bytes, stream->fragment_current_bytes,
(char*)p.Data() + DaybreakReliableHeader::size(), p.Length() - DaybreakReliableHeader::size()); (char*)p.Data() + ReliableStreamReliableHeader::size(), p.Length() - ReliableStreamReliableHeader::size());
stream->fragment_current_bytes += (uint32_t)(p.Length() - DaybreakReliableHeader::size()); stream->fragment_current_bytes += (uint32_t)(p.Length() - ReliableStreamReliableHeader::size());
if (stream->fragment_current_bytes >= stream->fragment_total_bytes) { if (stream->fragment_current_bytes >= stream->fragment_total_bytes) {
ProcessDecodedPacket(stream->fragment_packet); ProcessDecodedPacket(stream->fragment_packet);
@@ -769,7 +770,7 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
case OP_Ack3: case OP_Ack3:
case OP_Ack4: case OP_Ack4:
{ {
auto header = p.GetSerialize<DaybreakReliableHeader>(0); auto header = p.GetSerialize<ReliableStreamReliableHeader>(0);
auto sequence = NetworkToHost(header.sequence); auto sequence = NetworkToHost(header.sequence);
auto stream_id = header.opcode - OP_Ack; auto stream_id = header.opcode - OP_Ack;
Ack(stream_id, sequence); Ack(stream_id, sequence);
@@ -781,7 +782,7 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
case OP_OutOfOrderAck3: case OP_OutOfOrderAck3:
case OP_OutOfOrderAck4: case OP_OutOfOrderAck4:
{ {
auto header = p.GetSerialize<DaybreakReliableHeader>(0); auto header = p.GetSerialize<ReliableStreamReliableHeader>(0);
auto sequence = NetworkToHost(header.sequence); auto sequence = NetworkToHost(header.sequence);
auto stream_id = header.opcode - OP_OutOfOrderAck; auto stream_id = header.opcode - OP_OutOfOrderAck;
OutOfOrderAck(stream_id, sequence); OutOfOrderAck(stream_id, sequence);
@@ -815,13 +816,13 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
} }
case OP_SessionStatRequest: case OP_SessionStatRequest:
{ {
auto request = p.GetSerialize<DaybreakSessionStatRequest>(0); auto request = p.GetSerialize<ReliableStreamSessionStatRequest>(0);
m_stats.sync_remote_sent_packets = EQ::Net::NetworkToHost(request.packets_sent); m_stats.sync_remote_sent_packets = EQ::Net::NetworkToHost(request.packets_sent);
m_stats.sync_remote_recv_packets = EQ::Net::NetworkToHost(request.packets_recv); m_stats.sync_remote_recv_packets = EQ::Net::NetworkToHost(request.packets_recv);
m_stats.sync_sent_packets = m_stats.sent_packets; m_stats.sync_sent_packets = m_stats.sent_packets;
m_stats.sync_recv_packets = m_stats.recv_packets; m_stats.sync_recv_packets = m_stats.recv_packets;
DaybreakSessionStatResponse response; ReliableStreamSessionStatResponse response;
response.zero = 0; response.zero = 0;
response.opcode = OP_SessionStatResponse; response.opcode = OP_SessionStatResponse;
response.timestamp = request.timestamp; response.timestamp = request.timestamp;
@@ -836,7 +837,7 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
break; break;
} }
case OP_SessionStatResponse: { case OP_SessionStatResponse: {
auto response = p.GetSerialize<DaybreakSessionStatResponse>(0); auto response = p.GetSerialize<ReliableStreamSessionStatResponse>(0);
m_stats.sync_remote_sent_packets = EQ::Net::NetworkToHost(response.server_sent); m_stats.sync_remote_sent_packets = EQ::Net::NetworkToHost(response.server_sent);
m_stats.sync_remote_recv_packets = EQ::Net::NetworkToHost(response.server_recv); m_stats.sync_remote_recv_packets = EQ::Net::NetworkToHost(response.server_recv);
m_stats.sync_sent_packets = m_stats.sent_packets; m_stats.sync_sent_packets = m_stats.sent_packets;
@@ -858,7 +859,7 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
} }
} }
bool EQ::Net::DaybreakConnection::ValidateCRC(Packet &p) bool EQ::Net::ReliableStreamConnection::ValidateCRC(Packet &p)
{ {
if (m_crc_bytes == 0U) { if (m_crc_bytes == 0U) {
return true; return true;
@@ -892,7 +893,7 @@ bool EQ::Net::DaybreakConnection::ValidateCRC(Packet &p)
return false; return false;
} }
void EQ::Net::DaybreakConnection::AppendCRC(Packet &p) void EQ::Net::ReliableStreamConnection::AppendCRC(Packet &p)
{ {
if (m_crc_bytes == 0U) { if (m_crc_bytes == 0U) {
return; return;
@@ -911,7 +912,7 @@ void EQ::Net::DaybreakConnection::AppendCRC(Packet &p)
} }
} }
void EQ::Net::DaybreakConnection::ChangeStatus(DbProtocolStatus new_status) void EQ::Net::ReliableStreamConnection::ChangeStatus(DbProtocolStatus new_status)
{ {
if (m_owner->m_on_connection_state_change) { if (m_owner->m_on_connection_state_change) {
if (auto self = m_self.lock()) { if (auto self = m_self.lock()) {
@@ -922,7 +923,7 @@ void EQ::Net::DaybreakConnection::ChangeStatus(DbProtocolStatus new_status)
m_status = new_status; m_status = new_status;
} }
bool EQ::Net::DaybreakConnection::PacketCanBeEncoded(Packet &p) const bool EQ::Net::ReliableStreamConnection::PacketCanBeEncoded(Packet &p) const
{ {
if (p.Length() < 2) { if (p.Length() < 2) {
return false; return false;
@@ -941,7 +942,7 @@ bool EQ::Net::DaybreakConnection::PacketCanBeEncoded(Packet &p) const
return true; return true;
} }
void EQ::Net::DaybreakConnection::Decode(Packet &p, size_t offset, size_t length) void EQ::Net::ReliableStreamConnection::Decode(Packet &p, size_t offset, size_t length)
{ {
int key = m_encode_key; int key = m_encode_key;
char *buffer = (char*)p.Data() + offset; char *buffer = (char*)p.Data() + offset;
@@ -961,7 +962,7 @@ void EQ::Net::DaybreakConnection::Decode(Packet &p, size_t offset, size_t length
} }
} }
void EQ::Net::DaybreakConnection::Encode(Packet &p, size_t offset, size_t length) void EQ::Net::ReliableStreamConnection::Encode(Packet &p, size_t offset, size_t length)
{ {
int key = m_encode_key; int key = m_encode_key;
char *buffer = (char*)p.Data() + offset; char *buffer = (char*)p.Data() + offset;
@@ -1050,7 +1051,7 @@ uint32_t Deflate(const uint8_t* in, uint32_t in_len, uint8_t* out, uint32_t out_
} }
} }
void EQ::Net::DaybreakConnection::Decompress(Packet &p, size_t offset, size_t length) void EQ::Net::ReliableStreamConnection::Decompress(Packet &p, size_t offset, size_t length)
{ {
if (length < 2) { if (length < 2) {
return; return;
@@ -1075,7 +1076,7 @@ void EQ::Net::DaybreakConnection::Decompress(Packet &p, size_t offset, size_t le
p.PutData(offset, new_buffer, new_length); p.PutData(offset, new_buffer, new_length);
} }
void EQ::Net::DaybreakConnection::Compress(Packet &p, size_t offset, size_t length) void EQ::Net::ReliableStreamConnection::Compress(Packet &p, size_t offset, size_t length)
{ {
static thread_local uint8_t new_buffer[2048] = { 0 }; static thread_local uint8_t new_buffer[2048] = { 0 };
uint8_t *buffer = (uint8_t*)p.Data() + offset; uint8_t *buffer = (uint8_t*)p.Data() + offset;
@@ -1097,14 +1098,14 @@ void EQ::Net::DaybreakConnection::Compress(Packet &p, size_t offset, size_t leng
p.PutData(offset, new_buffer, new_length); p.PutData(offset, new_buffer, new_length);
} }
void EQ::Net::DaybreakConnection::ProcessResend() void EQ::Net::ReliableStreamConnection::ProcessResend()
{ {
for (int i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {
ProcessResend(i); ProcessResend(i);
} }
} }
void EQ::Net::DaybreakConnection::ProcessResend(int stream) void EQ::Net::ReliableStreamConnection::ProcessResend(int stream)
{ {
if (m_status == DbProtocolStatus::StatusDisconnected) { if (m_status == DbProtocolStatus::StatusDisconnected) {
return; return;
@@ -1201,7 +1202,7 @@ void EQ::Net::DaybreakConnection::ProcessResend(int stream)
auto &sp = e.second; auto &sp = e.second;
auto &p = sp.packet; auto &p = sp.packet;
if (p.Length() >= DaybreakHeader::size()) { if (p.Length() >= ReliableStreamHeader::size()) {
if (p.GetInt8(0) == 0 && p.GetInt8(1) >= OP_Fragment && p.GetInt8(1) <= OP_Fragment4) { if (p.GetInt8(0) == 0 && p.GetInt8(1) >= OP_Fragment && p.GetInt8(1) <= OP_Fragment4) {
m_stats.resent_fragments++; m_stats.resent_fragments++;
} }
@@ -1232,7 +1233,7 @@ void EQ::Net::DaybreakConnection::ProcessResend(int stream)
m_last_ack = now; m_last_ack = now;
} }
void EQ::Net::DaybreakConnection::Ack(int stream, uint16_t seq) void EQ::Net::ReliableStreamConnection::Ack(int stream, uint16_t seq)
{ {
auto now = Clock::now(); auto now = Clock::now();
auto s = &m_streams[stream]; auto s = &m_streams[stream];
@@ -1259,7 +1260,7 @@ void EQ::Net::DaybreakConnection::Ack(int stream, uint16_t seq)
m_last_ack = now; m_last_ack = now;
} }
void EQ::Net::DaybreakConnection::OutOfOrderAck(int stream, uint16_t seq) void EQ::Net::ReliableStreamConnection::OutOfOrderAck(int stream, uint16_t seq)
{ {
auto now = Clock::now(); auto now = Clock::now();
auto s = &m_streams[stream]; auto s = &m_streams[stream];
@@ -1279,15 +1280,15 @@ void EQ::Net::DaybreakConnection::OutOfOrderAck(int stream, uint16_t seq)
m_last_ack = now; m_last_ack = now;
} }
void EQ::Net::DaybreakConnection::UpdateDataBudget(double budget_add) void EQ::Net::ReliableStreamConnection::UpdateDataBudget(double budget_add)
{ {
auto outgoing_data_rate = m_owner->m_options.outgoing_data_rate; auto outgoing_data_rate = m_owner->m_options.outgoing_data_rate;
m_outgoing_budget = EQ::ClampUpper(m_outgoing_budget + budget_add, outgoing_data_rate); m_outgoing_budget = EQ::ClampUpper(m_outgoing_budget + budget_add, outgoing_data_rate);
} }
void EQ::Net::DaybreakConnection::SendAck(int stream_id, uint16_t seq) void EQ::Net::ReliableStreamConnection::SendAck(int stream_id, uint16_t seq)
{ {
DaybreakReliableHeader ack; ReliableStreamReliableHeader ack;
ack.zero = 0; ack.zero = 0;
ack.opcode = OP_Ack + stream_id; ack.opcode = OP_Ack + stream_id;
ack.sequence = HostToNetwork(seq); ack.sequence = HostToNetwork(seq);
@@ -1298,9 +1299,9 @@ void EQ::Net::DaybreakConnection::SendAck(int stream_id, uint16_t seq)
InternalBufferedSend(p); InternalBufferedSend(p);
} }
void EQ::Net::DaybreakConnection::SendOutOfOrderAck(int stream_id, uint16_t seq) void EQ::Net::ReliableStreamConnection::SendOutOfOrderAck(int stream_id, uint16_t seq)
{ {
DaybreakReliableHeader ack; ReliableStreamReliableHeader ack;
ack.zero = 0; ack.zero = 0;
ack.opcode = OP_OutOfOrderAck + stream_id; ack.opcode = OP_OutOfOrderAck + stream_id;
ack.sequence = HostToNetwork(seq); ack.sequence = HostToNetwork(seq);
@@ -1311,9 +1312,9 @@ void EQ::Net::DaybreakConnection::SendOutOfOrderAck(int stream_id, uint16_t seq)
InternalBufferedSend(p); InternalBufferedSend(p);
} }
void EQ::Net::DaybreakConnection::SendDisconnect() void EQ::Net::ReliableStreamConnection::SendDisconnect()
{ {
DaybreakDisconnect disconnect; ReliableStreamDisconnect disconnect;
disconnect.zero = 0; disconnect.zero = 0;
disconnect.opcode = OP_SessionDisconnect; disconnect.opcode = OP_SessionDisconnect;
disconnect.connect_code = HostToNetwork(m_connect_code); disconnect.connect_code = HostToNetwork(m_connect_code);
@@ -1322,7 +1323,7 @@ void EQ::Net::DaybreakConnection::SendDisconnect()
InternalSend(out); InternalSend(out);
} }
void EQ::Net::DaybreakConnection::InternalBufferedSend(Packet &p) void EQ::Net::ReliableStreamConnection::InternalBufferedSend(Packet &p)
{ {
if (p.Length() > 0xFFU) { if (p.Length() > 0xFFU) {
FlushBuffer(); FlushBuffer();
@@ -1331,7 +1332,7 @@ void EQ::Net::DaybreakConnection::InternalBufferedSend(Packet &p)
} }
//we could add this packet to a combined //we could add this packet to a combined
size_t raw_size = DaybreakHeader::size() + (size_t)m_crc_bytes + m_buffered_packets_length + m_buffered_packets.size() + 1 + p.Length(); size_t raw_size = ReliableStreamHeader::size() + (size_t)m_crc_bytes + m_buffered_packets_length + m_buffered_packets.size() + 1 + p.Length();
if (raw_size > m_max_packet_size) { if (raw_size > m_max_packet_size) {
FlushBuffer(); FlushBuffer();
} }
@@ -1346,9 +1347,9 @@ void EQ::Net::DaybreakConnection::InternalBufferedSend(Packet &p)
} }
} }
void EQ::Net::DaybreakConnection::SendConnect() void EQ::Net::ReliableStreamConnection::SendConnect()
{ {
DaybreakConnect connect; ReliableStreamConnect connect;
connect.zero = 0; connect.zero = 0;
connect.opcode = OP_SessionRequest; connect.opcode = OP_SessionRequest;
connect.protocol_version = HostToNetwork(3U); connect.protocol_version = HostToNetwork(3U);
@@ -1361,9 +1362,9 @@ void EQ::Net::DaybreakConnection::SendConnect()
InternalSend(p); InternalSend(p);
} }
void EQ::Net::DaybreakConnection::SendKeepAlive() void EQ::Net::ReliableStreamConnection::SendKeepAlive()
{ {
DaybreakHeader keep_alive; ReliableStreamHeader keep_alive;
keep_alive.zero = 0; keep_alive.zero = 0;
keep_alive.opcode = OP_KeepAlive; keep_alive.opcode = OP_KeepAlive;
@@ -1373,7 +1374,7 @@ void EQ::Net::DaybreakConnection::SendKeepAlive()
InternalSend(p); InternalSend(p);
} }
void EQ::Net::DaybreakConnection::InternalSend(Packet &p) { void EQ::Net::ReliableStreamConnection::InternalSend(Packet &p) {
if (m_owner->m_options.outgoing_data_rate > 0.0) { if (m_owner->m_options.outgoing_data_rate > 0.0) {
auto new_budget = m_outgoing_budget - (p.Length() / 1024.0); auto new_budget = m_outgoing_budget - (p.Length() / 1024.0);
if (new_budget <= 0.0) { if (new_budget <= 0.0) {
@@ -1409,14 +1410,14 @@ void EQ::Net::DaybreakConnection::InternalSend(Packet &p) {
switch (m_encode_passe) { switch (m_encode_passe) {
case EncodeCompression: case EncodeCompression:
if (out.GetInt8(0) == 0) { if (out.GetInt8(0) == 0) {
Compress(out, DaybreakHeader::size(), out.Length() - DaybreakHeader::size()); Compress(out, ReliableStreamHeader::size(), out.Length() - ReliableStreamHeader::size());
} else { } else {
Compress(out, 1, out.Length() - 1); Compress(out, 1, out.Length() - 1);
} }
break; break;
case EncodeXOR: case EncodeXOR:
if (out.GetInt8(0) == 0) { if (out.GetInt8(0) == 0) {
Encode(out, DaybreakHeader::size(), out.Length() - DaybreakHeader::size()); Encode(out, ReliableStreamHeader::size(), out.Length() - ReliableStreamHeader::size());
} else { } else {
Encode(out, 1, out.Length() - 1); Encode(out, 1, out.Length() - 1);
} }
@@ -1466,7 +1467,7 @@ void EQ::Net::DaybreakConnection::InternalSend(Packet &p) {
} }
} }
void EQ::Net::DaybreakConnection::InternalQueuePacket(Packet &p, int stream_id, bool reliable) void EQ::Net::ReliableStreamConnection::InternalQueuePacket(Packet &p, int stream_id, bool reliable)
{ {
if (!reliable) { if (!reliable) {
auto max_raw_size = 0xFFU - m_crc_bytes; auto max_raw_size = 0xFFU - m_crc_bytes;
@@ -1480,23 +1481,23 @@ void EQ::Net::DaybreakConnection::InternalQueuePacket(Packet &p, int stream_id,
} }
auto stream = &m_streams[stream_id]; auto stream = &m_streams[stream_id];
auto max_raw_size = m_max_packet_size - m_crc_bytes - DaybreakReliableHeader::size() - 1; // -1 for compress flag auto max_raw_size = m_max_packet_size - m_crc_bytes - ReliableStreamReliableHeader::size() - 1; // -1 for compress flag
size_t length = p.Length(); size_t length = p.Length();
if (length > max_raw_size) { if (length > max_raw_size) {
DaybreakReliableFragmentHeader first_header; ReliableStreamReliableFragmentHeader first_header;
first_header.reliable.zero = 0; first_header.reliable.zero = 0;
first_header.reliable.opcode = OP_Fragment + stream_id; first_header.reliable.opcode = OP_Fragment + stream_id;
first_header.reliable.sequence = HostToNetwork(stream->sequence_out); first_header.reliable.sequence = HostToNetwork(stream->sequence_out);
first_header.total_size = (uint32_t)HostToNetwork((uint32_t)length); first_header.total_size = (uint32_t)HostToNetwork((uint32_t)length);
size_t used = 0; size_t used = 0;
size_t sublen = m_max_packet_size - m_crc_bytes - DaybreakReliableFragmentHeader::size() - 1; // -1 for compress flag size_t sublen = m_max_packet_size - m_crc_bytes - ReliableStreamReliableFragmentHeader::size() - 1; // -1 for compress flag
DynamicPacket first_packet; DynamicPacket first_packet;
first_packet.PutSerialize(0, first_header); first_packet.PutSerialize(0, first_header);
first_packet.PutData(DaybreakReliableFragmentHeader::size(), (char*)p.Data() + used, sublen); first_packet.PutData(ReliableStreamReliableFragmentHeader::size(), (char*)p.Data() + used, sublen);
used += sublen; used += sublen;
DaybreakSentPacket sent; ReliableStreamSentPacket sent;
sent.packet.PutPacket(0, first_packet); sent.packet.PutPacket(0, first_packet);
sent.last_sent = Clock::now(); sent.last_sent = Clock::now();
sent.first_sent = Clock::now(); sent.first_sent = Clock::now();
@@ -1513,22 +1514,22 @@ void EQ::Net::DaybreakConnection::InternalQueuePacket(Packet &p, int stream_id,
while (used < length) { while (used < length) {
auto left = length - used; auto left = length - used;
DynamicPacket packet; DynamicPacket packet;
DaybreakReliableHeader header; ReliableStreamReliableHeader header;
header.zero = 0; header.zero = 0;
header.opcode = OP_Fragment + stream_id; header.opcode = OP_Fragment + stream_id;
header.sequence = HostToNetwork(stream->sequence_out); header.sequence = HostToNetwork(stream->sequence_out);
packet.PutSerialize(0, header); packet.PutSerialize(0, header);
if (left > max_raw_size) { if (left > max_raw_size) {
packet.PutData(DaybreakReliableHeader::size(), (char*)p.Data() + used, max_raw_size); packet.PutData(ReliableStreamReliableHeader::size(), (char*)p.Data() + used, max_raw_size);
used += max_raw_size; used += max_raw_size;
} }
else { else {
packet.PutData(DaybreakReliableHeader::size(), (char*)p.Data() + used, left); packet.PutData(ReliableStreamReliableHeader::size(), (char*)p.Data() + used, left);
used += left; used += left;
} }
DaybreakSentPacket sent; ReliableStreamSentPacket sent;
sent.packet.PutPacket(0, packet); sent.packet.PutPacket(0, packet);
sent.last_sent = Clock::now(); sent.last_sent = Clock::now();
sent.first_sent = Clock::now(); sent.first_sent = Clock::now();
@@ -1545,14 +1546,14 @@ void EQ::Net::DaybreakConnection::InternalQueuePacket(Packet &p, int stream_id,
} }
else { else {
DynamicPacket packet; DynamicPacket packet;
DaybreakReliableHeader header; ReliableStreamReliableHeader header;
header.zero = 0; header.zero = 0;
header.opcode = OP_Packet + stream_id; header.opcode = OP_Packet + stream_id;
header.sequence = HostToNetwork(stream->sequence_out); header.sequence = HostToNetwork(stream->sequence_out);
packet.PutSerialize(0, header); packet.PutSerialize(0, header);
packet.PutPacket(DaybreakReliableHeader::size(), p); packet.PutPacket(ReliableStreamReliableHeader::size(), p);
DaybreakSentPacket sent; ReliableStreamSentPacket sent;
sent.packet.PutPacket(0, packet); sent.packet.PutPacket(0, packet);
sent.last_sent = Clock::now(); sent.last_sent = Clock::now();
sent.first_sent = Clock::now(); sent.first_sent = Clock::now();
@@ -1568,7 +1569,7 @@ void EQ::Net::DaybreakConnection::InternalQueuePacket(Packet &p, int stream_id,
} }
} }
void EQ::Net::DaybreakConnection::FlushBuffer() void EQ::Net::ReliableStreamConnection::FlushBuffer()
{ {
if (m_buffered_packets.empty()) { if (m_buffered_packets.empty()) {
return; return;
@@ -1595,7 +1596,7 @@ void EQ::Net::DaybreakConnection::FlushBuffer()
m_buffered_packets_length = 0; m_buffered_packets_length = 0;
} }
EQ::Net::SequenceOrder EQ::Net::DaybreakConnection::CompareSequence(uint16_t expected, uint16_t actual) const EQ::Net::SequenceOrder EQ::Net::ReliableStreamConnection::CompareSequence(uint16_t expected, uint16_t actual) const
{ {
int diff = (int)actual - (int)expected; int diff = (int)actual - (int)expected;
@@ -2,8 +2,8 @@
#include "../random.h" #include "../random.h"
#include "packet.h" #include "packet.h"
#include "daybreak_structs.h" #include "reliable_stream_structs.h"
#include "daybreak_pooling.h" #include "reliable_stream_pooling.h"
#include <uv.h> #include <uv.h>
#include <chrono> #include <chrono>
#include <functional> #include <functional>
@@ -16,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,
@@ -55,7 +55,7 @@ namespace EQ
StatusDisconnected StatusDisconnected
}; };
enum DaybreakEncodeType enum ReliableStreamEncodeType
{ {
EncodeNone = 0, EncodeNone = 0,
EncodeCompression = 1, EncodeCompression = 1,
@@ -72,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;
@@ -134,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; }
@@ -151,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;
@@ -176,7 +176,7 @@ 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;
@@ -188,7 +188,7 @@ namespace EQ
bool m_acked_since_last_resend = false; bool m_acked_since_last_resend = false;
Timestamp m_last_ack; Timestamp m_last_ack;
struct DaybreakSentPacket struct ReliableStreamSentPacket
{ {
DynamicPacket packet; DynamicPacket packet;
Timestamp last_sent; Timestamp last_sent;
@@ -197,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;
@@ -214,11 +214,11 @@ namespace EQ
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);
@@ -251,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;
@@ -268,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;
@@ -299,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();
@@ -329,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;
}; };
} }
} }
@@ -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;
+1
View File
@@ -2,6 +2,7 @@
#include "../event/event_loop.h" #include "../event/event_loop.h"
#include "../event/timer.h" #include "../event/timer.h"
#include <fmt/format.h> #include <fmt/format.h>
#include <fmt/ranges.h>
#include <map> #include <map>
#include <unordered_set> #include <unordered_set>
#include <array> #include <array>
@@ -4,6 +4,7 @@
#include "../util/uuid.h" #include "../util/uuid.h"
#include <sstream> #include <sstream>
#include <fmt/format.h> #include <fmt/format.h>
#include <fmt/ranges.h>
struct EQ::Net::WebsocketServerConnection::Impl { struct EQ::Net::WebsocketServerConnection::Impl {
WebsocketServer *parent; WebsocketServer *parent;
+2 -1
View File
@@ -6481,7 +6481,7 @@ namespace RoF2
hdr.scaled_value = (inst->IsScaling() ? (inst->GetExp() / 100) : 0); hdr.scaled_value = (inst->IsScaling() ? (inst->GetExp() / 100) : 0);
hdr.instance_id = (inst->GetMerchantSlot() ? inst->GetMerchantSlot() : inst->GetSerialNumber()); hdr.instance_id = (inst->GetMerchantSlot() ? inst->GetMerchantSlot() : inst->GetSerialNumber());
hdr.parcel_item_id = packet_type == ItemPacketParcel ? inst->GetID() : 0; hdr.parcel_item_id = packet_type == ItemPacketParcel ? inst->GetID() : 0;
if (item->EvolvingItem) { if (item->EvolvingItem && packet_type != ItemPacketParcel && packet_type != ItemPacketMerchant) {
hdr.instance_id = inst->GetEvolveUniqueID() & 0xFFFFFFFF; //lower dword hdr.instance_id = inst->GetEvolveUniqueID() & 0xFFFFFFFF; //lower dword
hdr.parcel_item_id = inst->GetEvolveUniqueID() >> 32; //upper dword hdr.parcel_item_id = inst->GetEvolveUniqueID() >> 32; //upper dword
} }
@@ -6500,6 +6500,7 @@ namespace RoF2
if (item->EvolvingItem > 0) { if (item->EvolvingItem > 0) {
RoF2::structs::EvolvingItem_Struct evotop; RoF2::structs::EvolvingItem_Struct evotop;
inst->CalculateEvolveProgression();
evotop.final_item_id = inst->GetEvolveFinalItemID(); evotop.final_item_id = inst->GetEvolveFinalItemID();
evotop.evolve_level = item->EvolvingLevel; evotop.evolve_level = item->EvolvingLevel;
+3 -3
View File
@@ -1059,7 +1059,7 @@ namespace Titanium
OUT(spawnid); OUT(spawnid);
OUT_str(charname); OUT_str(charname);
if (emu->race > 473) if (emu->race > 474)
eq->race = 1; eq->race = 1;
else else
OUT(race); OUT(race);
@@ -1840,7 +1840,7 @@ namespace Titanium
emu_cse = (CharacterSelectEntry_Struct *)emu_ptr; emu_cse = (CharacterSelectEntry_Struct *)emu_ptr;
eq->Race[char_index] = emu_cse->Race; eq->Race[char_index] = emu_cse->Race;
if (eq->Race[char_index] > 473) if (eq->Race[char_index] > 474)
eq->Race[char_index] = 1; eq->Race[char_index] = 1;
for (int index = 0; index < EQ::textures::materialCount; ++index) { for (int index = 0; index < EQ::textures::materialCount; ++index) {
@@ -2421,7 +2421,7 @@ namespace Titanium
strcpy(eq->title, emu->title); strcpy(eq->title, emu->title);
// eq->unknown0274 = emu->unknown0274; // eq->unknown0274 = emu->unknown0274;
eq->helm = emu->helm; eq->helm = emu->helm;
if (emu->race > 473) if (emu->race > 474)
eq->race = 1; eq->race = 1;
else else
eq->race = emu->race; eq->race = emu->race;
+1
View File
@@ -2,6 +2,7 @@
#include <memory> #include <memory>
#include "process.h" #include "process.h"
#include <fmt/format.h> #include <fmt/format.h>
#include <fmt/ranges.h>
std::string Process::execute(const std::string &cmd) std::string Process::execute(const std::string &cmd)
{ {
+1 -1
View File
@@ -23,7 +23,7 @@
#include <string> #include <string>
#include <list> #include <list>
#include <fmt/format.h> #include <fmt/format.h>
#include <fmt/ranges.h>
class DBcore; class DBcore;
+413 -658
View File
File diff suppressed because it is too large Load Diff
+89 -113
View File
@@ -21,103 +21,7 @@
#include "../common/types.h" #include "../common/types.h"
#include <string> #include <string>
namespace Gender {
constexpr uint8 Male = 0;
constexpr uint8 Female = 1;
constexpr uint8 Neuter = 2;
}
//theres a big list straight from the client below.
#define HUMAN 1
#define BARBARIAN 2
#define ERUDITE 3
#define WOOD_ELF 4
#define HIGH_ELF 5
#define DARK_ELF 6
#define HALF_ELF 7
#define DWARF 8
#define TROLL 9
#define OGRE 10
#define HALFLING 11
#define GNOME 12
#define WEREWOLF 14
#define WOLF 42
#define BEAR 43
#define SKELETON 60
#define TIGER 63
#define ELEMENTAL 75
#define ALLIGATOR 91
#define OGGOK_CITIZEN 93
#define EYE_OF_ZOMM 108
#define WOLF_ELEMENTAL 120
#define INVISIBLE_MAN 127
#define IKSAR 128
#define VAHSHIR 130
#define CONTROLLED_BOAT 141
#define MINOR_ILL_OBJ 142
#define TREE 143
#define IKSAR_SKELETON 161
#define FROGLOK 330
// TODO: check all clients for (BYTE) usage of '/who all' class and remove FROGLOK2, if possible (330 - 74 = 256 .. WORD->BYTE conversion loss...)
#define FROGLOK2 74 // Not sure why /who all reports race as 74 for frogloks
#define FAIRY 473
#define DRAKKIN 522 // 32768
#define EMU_RACE_NPC 131069 // was 65533
#define EMU_RACE_PET 131070 // was 65534
#define EMU_RACE_UNKNOWN 131071 // was 65535
// player race values
#define PLAYER_RACE_UNKNOWN 0
#define PLAYER_RACE_HUMAN 1
#define PLAYER_RACE_BARBARIAN 2
#define PLAYER_RACE_ERUDITE 3
#define PLAYER_RACE_WOOD_ELF 4
#define PLAYER_RACE_HIGH_ELF 5
#define PLAYER_RACE_DARK_ELF 6
#define PLAYER_RACE_HALF_ELF 7
#define PLAYER_RACE_DWARF 8
#define PLAYER_RACE_TROLL 9
#define PLAYER_RACE_OGRE 10
#define PLAYER_RACE_HALFLING 11
#define PLAYER_RACE_GNOME 12
#define PLAYER_RACE_IKSAR 13
#define PLAYER_RACE_VAHSHIR 14
#define PLAYER_RACE_FROGLOK 15
#define PLAYER_RACE_DRAKKIN 16
#define PLAYER_RACE_COUNT 16
#define PLAYER_RACE_EMU_NPC 17
#define PLAYER_RACE_EMU_PET 18
#define PLAYER_RACE_EMU_COUNT 19
// player race bits
#define PLAYER_RACE_UNKNOWN_BIT 0
#define PLAYER_RACE_HUMAN_BIT 1
#define PLAYER_RACE_BARBARIAN_BIT 2
#define PLAYER_RACE_ERUDITE_BIT 4
#define PLAYER_RACE_WOOD_ELF_BIT 8
#define PLAYER_RACE_HIGH_ELF_BIT 16
#define PLAYER_RACE_DARK_ELF_BIT 32
#define PLAYER_RACE_HALF_ELF_BIT 64
#define PLAYER_RACE_DWARF_BIT 128
#define PLAYER_RACE_TROLL_BIT 256
#define PLAYER_RACE_OGRE_BIT 512
#define PLAYER_RACE_HALFLING_BIT 1024
#define PLAYER_RACE_GNOME_BIT 2048
#define PLAYER_RACE_IKSAR_BIT 4096
#define PLAYER_RACE_VAHSHIR_BIT 8192
#define PLAYER_RACE_FROGLOK_BIT 16384
#define PLAYER_RACE_DRAKKIN_BIT 32768
#define PLAYER_RACE_ALL_MASK 65535
const char* GetRaceIDName(uint16 race_id); const char* GetRaceIDName(uint16 race_id);
const char* GetPlayerRaceName(uint32 player_race_value);
const char* GetGenderName(uint32 gender_id); const char* GetGenderName(uint32 gender_id);
bool IsPlayerRace(uint16 race_id); bool IsPlayerRace(uint16 race_id);
@@ -127,25 +31,13 @@ uint32 GetPlayerRaceValue(uint16 race_id);
uint16 GetPlayerRaceBit(uint16 race_id); uint16 GetPlayerRaceBit(uint16 race_id);
uint16 GetRaceIDFromPlayerRaceValue(uint32 player_race_value); uint16 GetRaceIDFromPlayerRaceValue(uint32 player_race_value);
uint16 GetRaceIDFromPlayerRaceBit(uint32 player_race_bit);
float GetRaceGenderDefaultHeight(int race, int gender); float GetRaceGenderDefaultHeight(int race, int gender);
// player race-/gender-based model feature validators namespace Gender {
namespace PlayerAppearance constexpr uint8 Male = 0;
{ constexpr uint8 Female = 1;
bool IsValidBeard(uint16 race_id, uint8 gender_id, uint8 beard_value, bool use_luclin = true); constexpr uint8 Neuter = 2;
bool IsValidBeardColor(uint16 race_id, uint8 gender_id, uint8 beard_color_value, bool use_luclin = true);
bool IsValidDetail(uint16 race_id, uint8 gender_id, uint32 detail_value, bool use_luclin = true);
bool IsValidEyeColor(uint16 race_id, uint8 gender_id, uint8 eye_color_value, bool use_luclin = true);
bool IsValidFace(uint16 race_id, uint8 gender_id, uint8 face_value, bool use_luclin = true);
bool IsValidHair(uint16 race_id, uint8 gender_id, uint8 hair_value, bool use_luclin = true);
bool IsValidHairColor(uint16 race_id, uint8 gender_id, uint8 hair_color_value, bool use_luclin = true);
bool IsValidHead(uint16 race_id, uint8 gender_id, uint8 head_value, bool use_luclin = true);
bool IsValidHeritage(uint16 race_id, uint8 gender_id, uint32 heritage_value, bool use_luclin = true);
bool IsValidTattoo(uint16 race_id, uint8 gender_id, uint32 tattoo_value, bool use_luclin = true);
bool IsValidTexture(uint16 race_id, uint8 gender_id, uint8 texture_value, bool use_luclin = true);
bool IsValidWoad(uint16 race_id, uint8 gender_id, uint8 woad_value, bool use_luclin = true);
} }
namespace Race { namespace Race {
@@ -884,8 +776,92 @@ namespace Race {
constexpr uint16 Pegasus3 = 732; constexpr uint16 Pegasus3 = 732;
constexpr uint16 InteractiveObject = 2250; constexpr uint16 InteractiveObject = 2250;
constexpr uint16 Node = 2254; constexpr uint16 Node = 2254;
}
constexpr uint16 ALL_RACES_BITMASK = 65535; namespace RaceBitmask {
constexpr uint16 Unknown = 0;
constexpr uint16 Human = 1;
constexpr uint16 Barbarian = 2;
constexpr uint16 Erudite = 4;
constexpr uint16 WoodElf = 8;
constexpr uint16 HighElf = 16;
constexpr uint16 DarkElf = 32;
constexpr uint16 HalfElf = 64;
constexpr uint16 Dwarf = 128;
constexpr uint16 Troll = 256;
constexpr uint16 Ogre = 512;
constexpr uint16 Halfling = 1024;
constexpr uint16 Gnome = 2048;
constexpr uint16 Iksar = 4096;
constexpr uint16 VahShir = 8192;
constexpr uint16 Froglok = 16384;
constexpr uint16 Drakkin = 32768;
constexpr uint16 All = 65535;
}
namespace RaceIndex {
constexpr uint16 Human = 1;
constexpr uint16 Barbarian = 2;
constexpr uint16 Erudite = 3;
constexpr uint16 WoodElf = 4;
constexpr uint16 HighElf = 5;
constexpr uint16 DarkElf = 6;
constexpr uint16 HalfElf = 7;
constexpr uint16 Dwarf = 8;
constexpr uint16 Troll = 9;
constexpr uint16 Ogre = 10;
constexpr uint16 Halfling = 11;
constexpr uint16 Gnome = 12;
constexpr uint16 Iksar = 13;
constexpr uint16 VahShir = 14;
constexpr uint16 Froglok = 15;
constexpr uint16 Drakkin = 16;
}
namespace RaceAppearance {
bool IsValidBeard(uint16 race_id, uint8 gender_id, uint8 beard_value, bool use_luclin = true);
bool IsValidBeardColor(uint16 race_id, uint8 gender_id, uint8 beard_color_value, bool use_luclin = true);
bool IsValidDetail(uint16 race_id, uint8 gender_id, uint32 detail_value, bool use_luclin = true);
bool IsValidEyeColor(uint16 race_id, uint8 gender_id, uint8 eye_color_value, bool use_luclin = true);
bool IsValidFace(uint16 race_id, uint8 gender_id, uint8 face_value, bool use_luclin = true);
bool IsValidHair(uint16 race_id, uint8 gender_id, uint8 hair_value, bool use_luclin = true);
bool IsValidHairColor(uint16 race_id, uint8 gender_id, uint8 hair_color_value, bool use_luclin = true);
bool IsValidHeritage(uint16 race_id, uint8 gender_id, uint32 heritage_value, bool use_luclin = true);
bool IsValidTattoo(uint16 race_id, uint8 gender_id, uint32 tattoo_value, bool use_luclin = true);
bool IsValidWoad(uint16 race_id, uint8 gender_id, uint8 woad_value, bool use_luclin = true);
constexpr int HumanMale = (Race::Human << 8) | Gender::Male;
constexpr int HumanFemale = (Race::Human << 8) | Gender::Female;
constexpr int BarbarianMale = (Race::Barbarian << 8) | Gender::Male;
constexpr int BarbarianFemale = (Race::Barbarian << 8) | Gender::Female;
constexpr int EruditeMale = (Race::Erudite << 8) | Gender::Male;
constexpr int EruditeFemale = (Race::Erudite << 8) | Gender::Female;
constexpr int WoodElfMale = (Race::WoodElf << 8) | Gender::Male;
constexpr int WoodElfFemale = (Race::WoodElf << 8) | Gender::Female;
constexpr int HighElfMale = (Race::HighElf << 8) | Gender::Male;
constexpr int HighElfFemale = (Race::HighElf << 8) | Gender::Female;
constexpr int DarkElfMale = (Race::DarkElf << 8) | Gender::Male;
constexpr int DarkElfFemale = (Race::DarkElf << 8) | Gender::Female;
constexpr int HalfElfMale = (Race::HalfElf << 8) | Gender::Male;
constexpr int HalfElfFemale = (Race::HalfElf << 8) | Gender::Female;
constexpr int DwarfMale = (Race::Dwarf << 8) | Gender::Male;
constexpr int DwarfFemale = (Race::Dwarf << 8) | Gender::Female;
constexpr int TrollMale = (Race::Troll << 8) | Gender::Male;
constexpr int TrollFemale = (Race::Troll << 8) | Gender::Female;
constexpr int OgreMale = (Race::Ogre << 8) | Gender::Male;
constexpr int OgreFemale = (Race::Ogre << 8) | Gender::Female;
constexpr int HalflingMale = (Race::Halfling << 8) | Gender::Male;
constexpr int HalflingFemale = (Race::Halfling << 8) | Gender::Female;
constexpr int GnomeMale = (Race::Gnome << 8) | Gender::Male;
constexpr int GnomeFemale = (Race::Gnome << 8) | Gender::Female;
constexpr int IksarMale = (Race::Iksar << 8) | Gender::Male;
constexpr int IksarFemale = (Race::Iksar << 8) | Gender::Female;
constexpr int VahShirMale = (Race::VahShir << 8) | Gender::Male;
constexpr int VahShirFemale = (Race::VahShir << 8) | Gender::Female;
constexpr int FroglokMale = (Race::Froglok2 << 8) | Gender::Male;
constexpr int FroglokFemale = (Race::Froglok2 << 8) | Gender::Female;
constexpr int DrakkinMale = (Race::Drakkin << 8) | Gender::Male;
constexpr int DrakkinFemale = (Race::Drakkin << 8) | Gender::Female;
} }
#endif #endif
@@ -30,6 +30,7 @@ public:
uint32_t aug_slot_5; uint32_t aug_slot_5;
uint32_t aug_slot_6; uint32_t aug_slot_6;
uint32_t quantity; uint32_t quantity;
uint32_t evolve_amount;
}; };
static std::string PrimaryKey() static std::string PrimaryKey()
@@ -51,6 +52,7 @@ public:
"aug_slot_5", "aug_slot_5",
"aug_slot_6", "aug_slot_6",
"quantity", "quantity",
"evolve_amount",
}; };
} }
@@ -68,6 +70,7 @@ public:
"aug_slot_5", "aug_slot_5",
"aug_slot_6", "aug_slot_6",
"quantity", "quantity",
"evolve_amount",
}; };
} }
@@ -119,6 +122,7 @@ public:
e.aug_slot_5 = 0; e.aug_slot_5 = 0;
e.aug_slot_6 = 0; e.aug_slot_6 = 0;
e.quantity = 0; e.quantity = 0;
e.evolve_amount = 0;
return e; return e;
} }
@@ -166,6 +170,7 @@ public:
e.aug_slot_5 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0; e.aug_slot_5 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
e.aug_slot_6 = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0; e.aug_slot_6 = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0; e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
e.evolve_amount = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
return e; return e;
} }
@@ -209,6 +214,7 @@ public:
v.push_back(columns[8] + " = " + std::to_string(e.aug_slot_5)); v.push_back(columns[8] + " = " + std::to_string(e.aug_slot_5));
v.push_back(columns[9] + " = " + std::to_string(e.aug_slot_6)); v.push_back(columns[9] + " = " + std::to_string(e.aug_slot_6));
v.push_back(columns[10] + " = " + std::to_string(e.quantity)); v.push_back(columns[10] + " = " + std::to_string(e.quantity));
v.push_back(columns[11] + " = " + std::to_string(e.evolve_amount));
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@@ -241,6 +247,7 @@ public:
v.push_back(std::to_string(e.aug_slot_5)); v.push_back(std::to_string(e.aug_slot_5));
v.push_back(std::to_string(e.aug_slot_6)); v.push_back(std::to_string(e.aug_slot_6));
v.push_back(std::to_string(e.quantity)); v.push_back(std::to_string(e.quantity));
v.push_back(std::to_string(e.evolve_amount));
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@@ -281,6 +288,7 @@ public:
v.push_back(std::to_string(e.aug_slot_5)); v.push_back(std::to_string(e.aug_slot_5));
v.push_back(std::to_string(e.aug_slot_6)); v.push_back(std::to_string(e.aug_slot_6));
v.push_back(std::to_string(e.quantity)); v.push_back(std::to_string(e.quantity));
v.push_back(std::to_string(e.evolve_amount));
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
} }
@@ -325,6 +333,7 @@ public:
e.aug_slot_5 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0; e.aug_slot_5 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
e.aug_slot_6 = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0; e.aug_slot_6 = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0; e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
e.evolve_amount = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
all_entries.push_back(e); all_entries.push_back(e);
} }
@@ -360,6 +369,7 @@ public:
e.aug_slot_5 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0; e.aug_slot_5 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
e.aug_slot_6 = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0; e.aug_slot_6 = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0; e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
e.evolve_amount = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
all_entries.push_back(e); all_entries.push_back(e);
} }
@@ -445,6 +455,7 @@ public:
v.push_back(std::to_string(e.aug_slot_5)); v.push_back(std::to_string(e.aug_slot_5));
v.push_back(std::to_string(e.aug_slot_6)); v.push_back(std::to_string(e.aug_slot_6));
v.push_back(std::to_string(e.quantity)); v.push_back(std::to_string(e.quantity));
v.push_back(std::to_string(e.evolve_amount));
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@@ -478,6 +489,7 @@ public:
v.push_back(std::to_string(e.aug_slot_5)); v.push_back(std::to_string(e.aug_slot_5));
v.push_back(std::to_string(e.aug_slot_6)); v.push_back(std::to_string(e.aug_slot_6));
v.push_back(std::to_string(e.quantity)); v.push_back(std::to_string(e.quantity));
v.push_back(std::to_string(e.evolve_amount));
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
} }
@@ -30,6 +30,7 @@ public:
uint32_t aug_slot_6; uint32_t aug_slot_6;
uint32_t slot_id; uint32_t slot_id;
uint32_t quantity; uint32_t quantity;
uint32_t evolve_amount;
std::string from_name; std::string from_name;
std::string note; std::string note;
time_t sent_date; time_t sent_date;
@@ -54,6 +55,7 @@ public:
"aug_slot_6", "aug_slot_6",
"slot_id", "slot_id",
"quantity", "quantity",
"evolve_amount",
"from_name", "from_name",
"note", "note",
"sent_date", "sent_date",
@@ -74,6 +76,7 @@ public:
"aug_slot_6", "aug_slot_6",
"slot_id", "slot_id",
"quantity", "quantity",
"evolve_amount",
"from_name", "from_name",
"note", "note",
"UNIX_TIMESTAMP(sent_date)", "UNIX_TIMESTAMP(sent_date)",
@@ -128,6 +131,7 @@ public:
e.aug_slot_6 = 0; e.aug_slot_6 = 0;
e.slot_id = 0; e.slot_id = 0;
e.quantity = 0; e.quantity = 0;
e.evolve_amount = 0;
e.from_name = ""; e.from_name = "";
e.note = ""; e.note = "";
e.sent_date = 0; e.sent_date = 0;
@@ -178,9 +182,10 @@ public:
e.aug_slot_6 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0; e.aug_slot_6 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
e.slot_id = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0; e.slot_id = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0; e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
e.from_name = row[11] ? row[11] : ""; e.evolve_amount = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
e.note = row[12] ? row[12] : ""; e.from_name = row[12] ? row[12] : "";
e.sent_date = strtoll(row[13] ? row[13] : "-1", nullptr, 10); e.note = row[13] ? row[13] : "";
e.sent_date = strtoll(row[14] ? row[14] : "-1", nullptr, 10);
return e; return e;
} }
@@ -224,9 +229,10 @@ public:
v.push_back(columns[8] + " = " + std::to_string(e.aug_slot_6)); v.push_back(columns[8] + " = " + std::to_string(e.aug_slot_6));
v.push_back(columns[9] + " = " + std::to_string(e.slot_id)); v.push_back(columns[9] + " = " + std::to_string(e.slot_id));
v.push_back(columns[10] + " = " + std::to_string(e.quantity)); v.push_back(columns[10] + " = " + std::to_string(e.quantity));
v.push_back(columns[11] + " = '" + Strings::Escape(e.from_name) + "'"); v.push_back(columns[11] + " = " + std::to_string(e.evolve_amount));
v.push_back(columns[12] + " = '" + Strings::Escape(e.note) + "'"); v.push_back(columns[12] + " = '" + Strings::Escape(e.from_name) + "'");
v.push_back(columns[13] + " = FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")"); v.push_back(columns[13] + " = '" + Strings::Escape(e.note) + "'");
v.push_back(columns[14] + " = FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")");
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@@ -259,6 +265,7 @@ public:
v.push_back(std::to_string(e.aug_slot_6)); v.push_back(std::to_string(e.aug_slot_6));
v.push_back(std::to_string(e.slot_id)); v.push_back(std::to_string(e.slot_id));
v.push_back(std::to_string(e.quantity)); v.push_back(std::to_string(e.quantity));
v.push_back(std::to_string(e.evolve_amount));
v.push_back("'" + Strings::Escape(e.from_name) + "'"); v.push_back("'" + Strings::Escape(e.from_name) + "'");
v.push_back("'" + Strings::Escape(e.note) + "'"); v.push_back("'" + Strings::Escape(e.note) + "'");
v.push_back("FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")"); v.push_back("FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")");
@@ -302,6 +309,7 @@ public:
v.push_back(std::to_string(e.aug_slot_6)); v.push_back(std::to_string(e.aug_slot_6));
v.push_back(std::to_string(e.slot_id)); v.push_back(std::to_string(e.slot_id));
v.push_back(std::to_string(e.quantity)); v.push_back(std::to_string(e.quantity));
v.push_back(std::to_string(e.evolve_amount));
v.push_back("'" + Strings::Escape(e.from_name) + "'"); v.push_back("'" + Strings::Escape(e.from_name) + "'");
v.push_back("'" + Strings::Escape(e.note) + "'"); v.push_back("'" + Strings::Escape(e.note) + "'");
v.push_back("FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")"); v.push_back("FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")");
@@ -349,9 +357,10 @@ public:
e.aug_slot_6 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0; e.aug_slot_6 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
e.slot_id = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0; e.slot_id = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0; e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
e.from_name = row[11] ? row[11] : ""; e.evolve_amount = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
e.note = row[12] ? row[12] : ""; e.from_name = row[12] ? row[12] : "";
e.sent_date = strtoll(row[13] ? row[13] : "-1", nullptr, 10); e.note = row[13] ? row[13] : "";
e.sent_date = strtoll(row[14] ? row[14] : "-1", nullptr, 10);
all_entries.push_back(e); all_entries.push_back(e);
} }
@@ -387,9 +396,10 @@ public:
e.aug_slot_6 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0; e.aug_slot_6 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
e.slot_id = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0; e.slot_id = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0; e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
e.from_name = row[11] ? row[11] : ""; e.evolve_amount = row[11] ? static_cast<uint32_t>(strtoul(row[11], nullptr, 10)) : 0;
e.note = row[12] ? row[12] : ""; e.from_name = row[12] ? row[12] : "";
e.sent_date = strtoll(row[13] ? row[13] : "-1", nullptr, 10); e.note = row[13] ? row[13] : "";
e.sent_date = strtoll(row[14] ? row[14] : "-1", nullptr, 10);
all_entries.push_back(e); all_entries.push_back(e);
} }
@@ -475,6 +485,7 @@ public:
v.push_back(std::to_string(e.aug_slot_6)); v.push_back(std::to_string(e.aug_slot_6));
v.push_back(std::to_string(e.slot_id)); v.push_back(std::to_string(e.slot_id));
v.push_back(std::to_string(e.quantity)); v.push_back(std::to_string(e.quantity));
v.push_back(std::to_string(e.evolve_amount));
v.push_back("'" + Strings::Escape(e.from_name) + "'"); v.push_back("'" + Strings::Escape(e.from_name) + "'");
v.push_back("'" + Strings::Escape(e.note) + "'"); v.push_back("'" + Strings::Escape(e.note) + "'");
v.push_back("FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")"); v.push_back("FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")");
@@ -511,6 +522,7 @@ public:
v.push_back(std::to_string(e.aug_slot_6)); v.push_back(std::to_string(e.aug_slot_6));
v.push_back(std::to_string(e.slot_id)); v.push_back(std::to_string(e.slot_id));
v.push_back(std::to_string(e.quantity)); v.push_back(std::to_string(e.quantity));
v.push_back(std::to_string(e.evolve_amount));
v.push_back("'" + Strings::Escape(e.from_name) + "'"); v.push_back("'" + Strings::Escape(e.from_name) + "'");
v.push_back("'" + Strings::Escape(e.note) + "'"); v.push_back("'" + Strings::Escape(e.note) + "'");
v.push_back("FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")"); v.push_back("FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")");
@@ -70,6 +70,7 @@ public:
int32_t endurance_regen; int32_t endurance_regen;
int32_t shielding; int32_t shielding;
int32_t spell_damage; int32_t spell_damage;
int32_t heal_amount;
int32_t spell_shielding; int32_t spell_shielding;
int32_t strikethrough; int32_t strikethrough;
int32_t stun_resist; int32_t stun_resist;
@@ -154,6 +155,7 @@ public:
"endurance_regen", "endurance_regen",
"shielding", "shielding",
"spell_damage", "spell_damage",
"heal_amount",
"spell_shielding", "spell_shielding",
"strikethrough", "strikethrough",
"stun_resist", "stun_resist",
@@ -234,6 +236,7 @@ public:
"endurance_regen", "endurance_regen",
"shielding", "shielding",
"spell_damage", "spell_damage",
"heal_amount",
"spell_shielding", "spell_shielding",
"strikethrough", "strikethrough",
"stun_resist", "stun_resist",
@@ -348,6 +351,7 @@ public:
e.endurance_regen = 0; e.endurance_regen = 0;
e.shielding = 0; e.shielding = 0;
e.spell_damage = 0; e.spell_damage = 0;
e.heal_amount = 0;
e.spell_shielding = 0; e.spell_shielding = 0;
e.strikethrough = 0; e.strikethrough = 0;
e.stun_resist = 0; e.stun_resist = 0;
@@ -458,29 +462,30 @@ public:
e.endurance_regen = row[48] ? static_cast<int32_t>(atoi(row[48])) : 0; e.endurance_regen = row[48] ? static_cast<int32_t>(atoi(row[48])) : 0;
e.shielding = row[49] ? static_cast<int32_t>(atoi(row[49])) : 0; e.shielding = row[49] ? static_cast<int32_t>(atoi(row[49])) : 0;
e.spell_damage = row[50] ? static_cast<int32_t>(atoi(row[50])) : 0; e.spell_damage = row[50] ? static_cast<int32_t>(atoi(row[50])) : 0;
e.spell_shielding = row[51] ? static_cast<int32_t>(atoi(row[51])) : 0; e.heal_amount = row[51] ? static_cast<int32_t>(atoi(row[51])) : 0;
e.strikethrough = row[52] ? static_cast<int32_t>(atoi(row[52])) : 0; e.spell_shielding = row[52] ? static_cast<int32_t>(atoi(row[52])) : 0;
e.stun_resist = row[53] ? static_cast<int32_t>(atoi(row[53])) : 0; e.strikethrough = row[53] ? static_cast<int32_t>(atoi(row[53])) : 0;
e.backstab = row[54] ? static_cast<int32_t>(atoi(row[54])) : 0; e.stun_resist = row[54] ? static_cast<int32_t>(atoi(row[54])) : 0;
e.wind = row[55] ? static_cast<int32_t>(atoi(row[55])) : 0; e.backstab = row[55] ? static_cast<int32_t>(atoi(row[55])) : 0;
e.brass = row[56] ? static_cast<int32_t>(atoi(row[56])) : 0; e.wind = row[56] ? static_cast<int32_t>(atoi(row[56])) : 0;
e.string = row[57] ? static_cast<int32_t>(atoi(row[57])) : 0; e.brass = row[57] ? static_cast<int32_t>(atoi(row[57])) : 0;
e.percussion = row[58] ? static_cast<int32_t>(atoi(row[58])) : 0; e.string = row[58] ? static_cast<int32_t>(atoi(row[58])) : 0;
e.singing = row[59] ? static_cast<int32_t>(atoi(row[59])) : 0; e.percussion = row[59] ? static_cast<int32_t>(atoi(row[59])) : 0;
e.baking = row[60] ? static_cast<int32_t>(atoi(row[60])) : 0; e.singing = row[60] ? static_cast<int32_t>(atoi(row[60])) : 0;
e.alchemy = row[61] ? static_cast<int32_t>(atoi(row[61])) : 0; e.baking = row[61] ? static_cast<int32_t>(atoi(row[61])) : 0;
e.tailoring = row[62] ? static_cast<int32_t>(atoi(row[62])) : 0; e.alchemy = row[62] ? static_cast<int32_t>(atoi(row[62])) : 0;
e.blacksmithing = row[63] ? static_cast<int32_t>(atoi(row[63])) : 0; e.tailoring = row[63] ? static_cast<int32_t>(atoi(row[63])) : 0;
e.fletching = row[64] ? static_cast<int32_t>(atoi(row[64])) : 0; e.blacksmithing = row[64] ? static_cast<int32_t>(atoi(row[64])) : 0;
e.brewing = row[65] ? static_cast<int32_t>(atoi(row[65])) : 0; e.fletching = row[65] ? static_cast<int32_t>(atoi(row[65])) : 0;
e.jewelry = row[66] ? static_cast<int32_t>(atoi(row[66])) : 0; e.brewing = row[66] ? static_cast<int32_t>(atoi(row[66])) : 0;
e.pottery = row[67] ? static_cast<int32_t>(atoi(row[67])) : 0; e.jewelry = row[67] ? static_cast<int32_t>(atoi(row[67])) : 0;
e.research = row[68] ? static_cast<int32_t>(atoi(row[68])) : 0; e.pottery = row[68] ? static_cast<int32_t>(atoi(row[68])) : 0;
e.alcohol = row[69] ? static_cast<int32_t>(atoi(row[69])) : 0; e.research = row[69] ? static_cast<int32_t>(atoi(row[69])) : 0;
e.fishing = row[70] ? static_cast<int32_t>(atoi(row[70])) : 0; e.alcohol = row[70] ? static_cast<int32_t>(atoi(row[70])) : 0;
e.tinkering = row[71] ? static_cast<int32_t>(atoi(row[71])) : 0; e.fishing = row[71] ? static_cast<int32_t>(atoi(row[71])) : 0;
e.created_at = strtoll(row[72] ? row[72] : "-1", nullptr, 10); e.tinkering = row[72] ? static_cast<int32_t>(atoi(row[72])) : 0;
e.updated_at = strtoll(row[73] ? row[73] : "-1", nullptr, 10); e.created_at = strtoll(row[73] ? row[73] : "-1", nullptr, 10);
e.updated_at = strtoll(row[74] ? row[74] : "-1", nullptr, 10);
return e; return e;
} }
@@ -565,29 +570,30 @@ public:
v.push_back(columns[48] + " = " + std::to_string(e.endurance_regen)); v.push_back(columns[48] + " = " + std::to_string(e.endurance_regen));
v.push_back(columns[49] + " = " + std::to_string(e.shielding)); v.push_back(columns[49] + " = " + std::to_string(e.shielding));
v.push_back(columns[50] + " = " + std::to_string(e.spell_damage)); v.push_back(columns[50] + " = " + std::to_string(e.spell_damage));
v.push_back(columns[51] + " = " + std::to_string(e.spell_shielding)); v.push_back(columns[51] + " = " + std::to_string(e.heal_amount));
v.push_back(columns[52] + " = " + std::to_string(e.strikethrough)); v.push_back(columns[52] + " = " + std::to_string(e.spell_shielding));
v.push_back(columns[53] + " = " + std::to_string(e.stun_resist)); v.push_back(columns[53] + " = " + std::to_string(e.strikethrough));
v.push_back(columns[54] + " = " + std::to_string(e.backstab)); v.push_back(columns[54] + " = " + std::to_string(e.stun_resist));
v.push_back(columns[55] + " = " + std::to_string(e.wind)); v.push_back(columns[55] + " = " + std::to_string(e.backstab));
v.push_back(columns[56] + " = " + std::to_string(e.brass)); v.push_back(columns[56] + " = " + std::to_string(e.wind));
v.push_back(columns[57] + " = " + std::to_string(e.string)); v.push_back(columns[57] + " = " + std::to_string(e.brass));
v.push_back(columns[58] + " = " + std::to_string(e.percussion)); v.push_back(columns[58] + " = " + std::to_string(e.string));
v.push_back(columns[59] + " = " + std::to_string(e.singing)); v.push_back(columns[59] + " = " + std::to_string(e.percussion));
v.push_back(columns[60] + " = " + std::to_string(e.baking)); v.push_back(columns[60] + " = " + std::to_string(e.singing));
v.push_back(columns[61] + " = " + std::to_string(e.alchemy)); v.push_back(columns[61] + " = " + std::to_string(e.baking));
v.push_back(columns[62] + " = " + std::to_string(e.tailoring)); v.push_back(columns[62] + " = " + std::to_string(e.alchemy));
v.push_back(columns[63] + " = " + std::to_string(e.blacksmithing)); v.push_back(columns[63] + " = " + std::to_string(e.tailoring));
v.push_back(columns[64] + " = " + std::to_string(e.fletching)); v.push_back(columns[64] + " = " + std::to_string(e.blacksmithing));
v.push_back(columns[65] + " = " + std::to_string(e.brewing)); v.push_back(columns[65] + " = " + std::to_string(e.fletching));
v.push_back(columns[66] + " = " + std::to_string(e.jewelry)); v.push_back(columns[66] + " = " + std::to_string(e.brewing));
v.push_back(columns[67] + " = " + std::to_string(e.pottery)); v.push_back(columns[67] + " = " + std::to_string(e.jewelry));
v.push_back(columns[68] + " = " + std::to_string(e.research)); v.push_back(columns[68] + " = " + std::to_string(e.pottery));
v.push_back(columns[69] + " = " + std::to_string(e.alcohol)); v.push_back(columns[69] + " = " + std::to_string(e.research));
v.push_back(columns[70] + " = " + std::to_string(e.fishing)); v.push_back(columns[70] + " = " + std::to_string(e.alcohol));
v.push_back(columns[71] + " = " + std::to_string(e.tinkering)); v.push_back(columns[71] + " = " + std::to_string(e.fishing));
v.push_back(columns[72] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")"); v.push_back(columns[72] + " = " + std::to_string(e.tinkering));
v.push_back(columns[73] + " = FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")"); v.push_back(columns[73] + " = FROM_UNIXTIME(" + (e.created_at > 0 ? std::to_string(e.created_at) : "null") + ")");
v.push_back(columns[74] + " = FROM_UNIXTIME(" + (e.updated_at > 0 ? std::to_string(e.updated_at) : "null") + ")");
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@@ -660,6 +666,7 @@ public:
v.push_back(std::to_string(e.endurance_regen)); v.push_back(std::to_string(e.endurance_regen));
v.push_back(std::to_string(e.shielding)); v.push_back(std::to_string(e.shielding));
v.push_back(std::to_string(e.spell_damage)); v.push_back(std::to_string(e.spell_damage));
v.push_back(std::to_string(e.heal_amount));
v.push_back(std::to_string(e.spell_shielding)); v.push_back(std::to_string(e.spell_shielding));
v.push_back(std::to_string(e.strikethrough)); v.push_back(std::to_string(e.strikethrough));
v.push_back(std::to_string(e.stun_resist)); v.push_back(std::to_string(e.stun_resist));
@@ -763,6 +770,7 @@ public:
v.push_back(std::to_string(e.endurance_regen)); v.push_back(std::to_string(e.endurance_regen));
v.push_back(std::to_string(e.shielding)); v.push_back(std::to_string(e.shielding));
v.push_back(std::to_string(e.spell_damage)); v.push_back(std::to_string(e.spell_damage));
v.push_back(std::to_string(e.heal_amount));
v.push_back(std::to_string(e.spell_shielding)); v.push_back(std::to_string(e.spell_shielding));
v.push_back(std::to_string(e.strikethrough)); v.push_back(std::to_string(e.strikethrough));
v.push_back(std::to_string(e.stun_resist)); v.push_back(std::to_string(e.stun_resist));
@@ -870,29 +878,30 @@ public:
e.endurance_regen = row[48] ? static_cast<int32_t>(atoi(row[48])) : 0; e.endurance_regen = row[48] ? static_cast<int32_t>(atoi(row[48])) : 0;
e.shielding = row[49] ? static_cast<int32_t>(atoi(row[49])) : 0; e.shielding = row[49] ? static_cast<int32_t>(atoi(row[49])) : 0;
e.spell_damage = row[50] ? static_cast<int32_t>(atoi(row[50])) : 0; e.spell_damage = row[50] ? static_cast<int32_t>(atoi(row[50])) : 0;
e.spell_shielding = row[51] ? static_cast<int32_t>(atoi(row[51])) : 0; e.heal_amount = row[51] ? static_cast<int32_t>(atoi(row[51])) : 0;
e.strikethrough = row[52] ? static_cast<int32_t>(atoi(row[52])) : 0; e.spell_shielding = row[52] ? static_cast<int32_t>(atoi(row[52])) : 0;
e.stun_resist = row[53] ? static_cast<int32_t>(atoi(row[53])) : 0; e.strikethrough = row[53] ? static_cast<int32_t>(atoi(row[53])) : 0;
e.backstab = row[54] ? static_cast<int32_t>(atoi(row[54])) : 0; e.stun_resist = row[54] ? static_cast<int32_t>(atoi(row[54])) : 0;
e.wind = row[55] ? static_cast<int32_t>(atoi(row[55])) : 0; e.backstab = row[55] ? static_cast<int32_t>(atoi(row[55])) : 0;
e.brass = row[56] ? static_cast<int32_t>(atoi(row[56])) : 0; e.wind = row[56] ? static_cast<int32_t>(atoi(row[56])) : 0;
e.string = row[57] ? static_cast<int32_t>(atoi(row[57])) : 0; e.brass = row[57] ? static_cast<int32_t>(atoi(row[57])) : 0;
e.percussion = row[58] ? static_cast<int32_t>(atoi(row[58])) : 0; e.string = row[58] ? static_cast<int32_t>(atoi(row[58])) : 0;
e.singing = row[59] ? static_cast<int32_t>(atoi(row[59])) : 0; e.percussion = row[59] ? static_cast<int32_t>(atoi(row[59])) : 0;
e.baking = row[60] ? static_cast<int32_t>(atoi(row[60])) : 0; e.singing = row[60] ? static_cast<int32_t>(atoi(row[60])) : 0;
e.alchemy = row[61] ? static_cast<int32_t>(atoi(row[61])) : 0; e.baking = row[61] ? static_cast<int32_t>(atoi(row[61])) : 0;
e.tailoring = row[62] ? static_cast<int32_t>(atoi(row[62])) : 0; e.alchemy = row[62] ? static_cast<int32_t>(atoi(row[62])) : 0;
e.blacksmithing = row[63] ? static_cast<int32_t>(atoi(row[63])) : 0; e.tailoring = row[63] ? static_cast<int32_t>(atoi(row[63])) : 0;
e.fletching = row[64] ? static_cast<int32_t>(atoi(row[64])) : 0; e.blacksmithing = row[64] ? static_cast<int32_t>(atoi(row[64])) : 0;
e.brewing = row[65] ? static_cast<int32_t>(atoi(row[65])) : 0; e.fletching = row[65] ? static_cast<int32_t>(atoi(row[65])) : 0;
e.jewelry = row[66] ? static_cast<int32_t>(atoi(row[66])) : 0; e.brewing = row[66] ? static_cast<int32_t>(atoi(row[66])) : 0;
e.pottery = row[67] ? static_cast<int32_t>(atoi(row[67])) : 0; e.jewelry = row[67] ? static_cast<int32_t>(atoi(row[67])) : 0;
e.research = row[68] ? static_cast<int32_t>(atoi(row[68])) : 0; e.pottery = row[68] ? static_cast<int32_t>(atoi(row[68])) : 0;
e.alcohol = row[69] ? static_cast<int32_t>(atoi(row[69])) : 0; e.research = row[69] ? static_cast<int32_t>(atoi(row[69])) : 0;
e.fishing = row[70] ? static_cast<int32_t>(atoi(row[70])) : 0; e.alcohol = row[70] ? static_cast<int32_t>(atoi(row[70])) : 0;
e.tinkering = row[71] ? static_cast<int32_t>(atoi(row[71])) : 0; e.fishing = row[71] ? static_cast<int32_t>(atoi(row[71])) : 0;
e.created_at = strtoll(row[72] ? row[72] : "-1", nullptr, 10); e.tinkering = row[72] ? static_cast<int32_t>(atoi(row[72])) : 0;
e.updated_at = strtoll(row[73] ? row[73] : "-1", nullptr, 10); e.created_at = strtoll(row[73] ? row[73] : "-1", nullptr, 10);
e.updated_at = strtoll(row[74] ? row[74] : "-1", nullptr, 10);
all_entries.push_back(e); all_entries.push_back(e);
} }
@@ -968,29 +977,30 @@ public:
e.endurance_regen = row[48] ? static_cast<int32_t>(atoi(row[48])) : 0; e.endurance_regen = row[48] ? static_cast<int32_t>(atoi(row[48])) : 0;
e.shielding = row[49] ? static_cast<int32_t>(atoi(row[49])) : 0; e.shielding = row[49] ? static_cast<int32_t>(atoi(row[49])) : 0;
e.spell_damage = row[50] ? static_cast<int32_t>(atoi(row[50])) : 0; e.spell_damage = row[50] ? static_cast<int32_t>(atoi(row[50])) : 0;
e.spell_shielding = row[51] ? static_cast<int32_t>(atoi(row[51])) : 0; e.heal_amount = row[51] ? static_cast<int32_t>(atoi(row[51])) : 0;
e.strikethrough = row[52] ? static_cast<int32_t>(atoi(row[52])) : 0; e.spell_shielding = row[52] ? static_cast<int32_t>(atoi(row[52])) : 0;
e.stun_resist = row[53] ? static_cast<int32_t>(atoi(row[53])) : 0; e.strikethrough = row[53] ? static_cast<int32_t>(atoi(row[53])) : 0;
e.backstab = row[54] ? static_cast<int32_t>(atoi(row[54])) : 0; e.stun_resist = row[54] ? static_cast<int32_t>(atoi(row[54])) : 0;
e.wind = row[55] ? static_cast<int32_t>(atoi(row[55])) : 0; e.backstab = row[55] ? static_cast<int32_t>(atoi(row[55])) : 0;
e.brass = row[56] ? static_cast<int32_t>(atoi(row[56])) : 0; e.wind = row[56] ? static_cast<int32_t>(atoi(row[56])) : 0;
e.string = row[57] ? static_cast<int32_t>(atoi(row[57])) : 0; e.brass = row[57] ? static_cast<int32_t>(atoi(row[57])) : 0;
e.percussion = row[58] ? static_cast<int32_t>(atoi(row[58])) : 0; e.string = row[58] ? static_cast<int32_t>(atoi(row[58])) : 0;
e.singing = row[59] ? static_cast<int32_t>(atoi(row[59])) : 0; e.percussion = row[59] ? static_cast<int32_t>(atoi(row[59])) : 0;
e.baking = row[60] ? static_cast<int32_t>(atoi(row[60])) : 0; e.singing = row[60] ? static_cast<int32_t>(atoi(row[60])) : 0;
e.alchemy = row[61] ? static_cast<int32_t>(atoi(row[61])) : 0; e.baking = row[61] ? static_cast<int32_t>(atoi(row[61])) : 0;
e.tailoring = row[62] ? static_cast<int32_t>(atoi(row[62])) : 0; e.alchemy = row[62] ? static_cast<int32_t>(atoi(row[62])) : 0;
e.blacksmithing = row[63] ? static_cast<int32_t>(atoi(row[63])) : 0; e.tailoring = row[63] ? static_cast<int32_t>(atoi(row[63])) : 0;
e.fletching = row[64] ? static_cast<int32_t>(atoi(row[64])) : 0; e.blacksmithing = row[64] ? static_cast<int32_t>(atoi(row[64])) : 0;
e.brewing = row[65] ? static_cast<int32_t>(atoi(row[65])) : 0; e.fletching = row[65] ? static_cast<int32_t>(atoi(row[65])) : 0;
e.jewelry = row[66] ? static_cast<int32_t>(atoi(row[66])) : 0; e.brewing = row[66] ? static_cast<int32_t>(atoi(row[66])) : 0;
e.pottery = row[67] ? static_cast<int32_t>(atoi(row[67])) : 0; e.jewelry = row[67] ? static_cast<int32_t>(atoi(row[67])) : 0;
e.research = row[68] ? static_cast<int32_t>(atoi(row[68])) : 0; e.pottery = row[68] ? static_cast<int32_t>(atoi(row[68])) : 0;
e.alcohol = row[69] ? static_cast<int32_t>(atoi(row[69])) : 0; e.research = row[69] ? static_cast<int32_t>(atoi(row[69])) : 0;
e.fishing = row[70] ? static_cast<int32_t>(atoi(row[70])) : 0; e.alcohol = row[70] ? static_cast<int32_t>(atoi(row[70])) : 0;
e.tinkering = row[71] ? static_cast<int32_t>(atoi(row[71])) : 0; e.fishing = row[71] ? static_cast<int32_t>(atoi(row[71])) : 0;
e.created_at = strtoll(row[72] ? row[72] : "-1", nullptr, 10); e.tinkering = row[72] ? static_cast<int32_t>(atoi(row[72])) : 0;
e.updated_at = strtoll(row[73] ? row[73] : "-1", nullptr, 10); e.created_at = strtoll(row[73] ? row[73] : "-1", nullptr, 10);
e.updated_at = strtoll(row[74] ? row[74] : "-1", nullptr, 10);
all_entries.push_back(e); all_entries.push_back(e);
} }
@@ -1116,6 +1126,7 @@ public:
v.push_back(std::to_string(e.endurance_regen)); v.push_back(std::to_string(e.endurance_regen));
v.push_back(std::to_string(e.shielding)); v.push_back(std::to_string(e.shielding));
v.push_back(std::to_string(e.spell_damage)); v.push_back(std::to_string(e.spell_damage));
v.push_back(std::to_string(e.heal_amount));
v.push_back(std::to_string(e.spell_shielding)); v.push_back(std::to_string(e.spell_shielding));
v.push_back(std::to_string(e.strikethrough)); v.push_back(std::to_string(e.strikethrough));
v.push_back(std::to_string(e.stun_resist)); v.push_back(std::to_string(e.stun_resist));
@@ -1212,6 +1223,7 @@ public:
v.push_back(std::to_string(e.endurance_regen)); v.push_back(std::to_string(e.endurance_regen));
v.push_back(std::to_string(e.shielding)); v.push_back(std::to_string(e.shielding));
v.push_back(std::to_string(e.spell_damage)); v.push_back(std::to_string(e.spell_damage));
v.push_back(std::to_string(e.heal_amount));
v.push_back(std::to_string(e.spell_shielding)); v.push_back(std::to_string(e.spell_shielding));
v.push_back(std::to_string(e.strikethrough)); v.push_back(std::to_string(e.strikethrough));
v.push_back(std::to_string(e.stun_resist)); v.push_back(std::to_string(e.stun_resist));
@@ -191,6 +191,22 @@ public:
return character_ids; return character_ids;
} }
static uint32_t GetTotalTimePlayed(Database& db, uint32_t account_id)
{
auto query = fmt::format(
"SELECT SUM(time_played) FROM `character_data` WHERE `account_id` = {}",
account_id
);
auto results = db.QueryDatabase(query);
if (!results.Success()) {
return 0;
}
auto row = results.begin();
return Strings::ToUnsignedInt(row[0]);
}
}; };
#endif //EQEMU_CHARACTER_DATA_REPOSITORY_H #endif //EQEMU_CHARACTER_DATA_REPOSITORY_H
@@ -49,6 +49,7 @@ public:
// these are the base definitions for command_subsettings and can be over-ridden by the database // these are the base definitions for command_subsettings and can be over-ridden by the database
std::vector<CommandSubsettingsRepository::CommandSubsettings> static_records = { std::vector<CommandSubsettingsRepository::CommandSubsettings> static_records = {
{.parent_command = "find", .sub_command = "aa", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "findaa"}, {.parent_command = "find", .sub_command = "aa", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "findaa"},
{.parent_command = "find", .sub_command = "account", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "findaccount"},
{.parent_command = "find", .sub_command = "body_type", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "findbodytype"}, {.parent_command = "find", .sub_command = "body_type", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "findbodytype"},
{.parent_command = "find", .sub_command = "bug_category", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "findbugcategory"}, {.parent_command = "find", .sub_command = "bug_category", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "findbugcategory"},
{.parent_command = "find", .sub_command = "character", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "findcharacter"}, {.parent_command = "find", .sub_command = "character", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "findcharacter"},
+1
View File
@@ -23,6 +23,7 @@
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <fmt/format.h> #include <fmt/format.h>
#include <fmt/ranges.h>
#include "../common/repositories/rule_sets_repository.h" #include "../common/repositories/rule_sets_repository.h"
#include "../common/repositories/rule_values_repository.h" #include "../common/repositories/rule_values_repository.h"
+1 -1
View File
@@ -619,7 +619,7 @@ RULE_INT(Combat, SneakPullAssistRange, 400, "Modified range of assist for sneak
RULE_BOOL(Combat, Classic2HBAnimation, false, "2HB will use the 2 hand piercing animation instead of the overhead slashing animation") RULE_BOOL(Combat, Classic2HBAnimation, false, "2HB will use the 2 hand piercing animation instead of the overhead slashing animation")
RULE_BOOL(Combat, ArcheryConsumesAmmo, true, "Set to false to disable Archery Ammo Consumption") RULE_BOOL(Combat, ArcheryConsumesAmmo, true, "Set to false to disable Archery Ammo Consumption")
RULE_BOOL(Combat, ThrowingConsumesAmmo, true, "Set to false to disable Throwing Ammo Consumption") RULE_BOOL(Combat, ThrowingConsumesAmmo, true, "Set to false to disable Throwing Ammo Consumption")
RULE_BOOL(Combat, UseLiveRiposteMechanics, false, "Set to true to disable SPA 173 SE_RiposteChance from making those with the effect on them immune to enrage, can longer riposte from a riposte.") RULE_BOOL(Combat, UseLiveRiposteMechanics, false, "Set to true to disable SPA 173 SpellEffect::RiposteChance from making those with the effect on them immune to enrage, can longer riposte from a riposte.")
RULE_INT(Combat, FrontalStunImmunityClasses, 0, "Bitmask for Classes than have frontal stun immunity, No Races (0) by default.") RULE_INT(Combat, FrontalStunImmunityClasses, 0, "Bitmask for Classes than have frontal stun immunity, No Races (0) by default.")
RULE_BOOL(Combat, NPCsUseFrontalStunImmunityClasses, false, "Enable or disable NPCs using frontal stun immunity Classes from Combat:FrontalStunImmunityClasses, false by default.") RULE_BOOL(Combat, NPCsUseFrontalStunImmunityClasses, false, "Enable or disable NPCs using frontal stun immunity Classes from Combat:FrontalStunImmunityClasses, false by default.")
RULE_INT(Combat, FrontalStunImmunityRaces, 512, "Bitmask for Races than have frontal stun immunity, Ogre (512) only by default.") RULE_INT(Combat, FrontalStunImmunityRaces, 512, "Bitmask for Races than have frontal stun immunity, Ogre (512) only by default.")
+263 -325
View File
@@ -19,6 +19,7 @@
#include <iostream> #include <iostream>
#include <cstring> #include <cstring>
#include <fmt/format.h> #include <fmt/format.h>
#include <fmt/ranges.h>
#if defined(_MSC_VER) && _MSC_VER >= 1800 #if defined(_MSC_VER) && _MSC_VER >= 1800
#include <algorithm> #include <algorithm>
@@ -51,19 +52,10 @@
#include "repositories/inventory_repository.h" #include "repositories/inventory_repository.h"
#include "repositories/books_repository.h" #include "repositories/books_repository.h"
#include "repositories/sharedbank_repository.h" #include "repositories/sharedbank_repository.h"
#include "repositories/character_inspect_messages_repository.h"
namespace ItemField #include "repositories/spells_new_repository.h"
{ #include "repositories/damageshieldtypes_repository.h"
enum { #include "repositories/items_repository.h"
source = 0,
#define F(x) x,
#include "item_fieldlist.h"
#undef F
updated,
minstatus,
comment,
};
}
SharedDatabase::SharedDatabase() SharedDatabase::SharedDatabase()
: Database() : Database()
@@ -131,68 +123,43 @@ bool SharedDatabase::SetGMFlymode(uint32 account_id, uint8 flymode)
return a.id > 0; return a.id > 0;
} }
uint32 SharedDatabase::GetTotalTimeEntitledOnAccount(uint32 AccountID) { void SharedDatabase::SetMailKey(uint32 character_id, uint32 ip_address, uint32 mail_key)
uint32 EntitledTime = 0;
const std::string query = StringFormat("SELECT `time_played` FROM `character_data` WHERE `account_id` = %u", AccountID);
auto results = QueryDatabase(query);
for (auto& row = results.begin(); row != results.end(); ++row) {
EntitledTime += Strings::ToUnsignedInt(row[0]);
}
return EntitledTime;
}
void SharedDatabase::SetMailKey(int CharID, int IPAddress, int MailKey)
{ {
char mail_key[17]; std::string full_mail_key;
if (RuleB(Chat, EnableMailKeyIPVerification) == true) { if (RuleB(Chat, EnableMailKeyIPVerification)) {
sprintf(mail_key, "%08X%08X", IPAddress, MailKey); full_mail_key = fmt::format("{:08X}{:08X}", ip_address, mail_key);
} } else {
else { full_mail_key = fmt::format("{:08X}", mail_key);
sprintf(mail_key, "%08X", MailKey);
} }
const std::string query = StringFormat( auto e = CharacterDataRepository::FindOne(*this, character_id);
"UPDATE character_data SET mailkey = '%s' WHERE id = '%i'", if (!e.id) {
mail_key, CharID LogError("Failed to find character_id [{}] when setting mailkey", character_id);
); return;
}
const auto results = QueryDatabase(query); e.mailkey = full_mail_key;
if (!results.Success()) {
LogError("SharedDatabase::SetMailKey({}, {}) : {}", CharID, mail_key, results.ErrorMessage().c_str()); if (!CharacterDataRepository::UpdateOne(*this, e)) {
LogError("Failed to set mailkey to [{}] for character_id [{}]", full_mail_key, character_id);
} }
} }
SharedDatabase::MailKeys SharedDatabase::GetMailKey(int character_id) SharedDatabase::MailKeys SharedDatabase::GetMailKey(uint32 character_id)
{ {
const std::string query = StringFormat("SELECT `mailkey` FROM `character_data` WHERE `id`='%i' LIMIT 1", character_id); auto e = CharacterDataRepository::FindOne(*this, character_id);
auto results = QueryDatabase(query);
if (!results.Success()) { if (!e.id) {
return MailKeys{ }; return MailKeys{ };
} }
if (!results.RowCount()) {
Log(Logs::General,
Logs::ClientLogin,
"Error: Mailkey for character id [%i] does not exist or could not be found",
character_id
);
return MailKeys{};
}
auto &row = results.begin();
if (row != results.end()) {
std::string mail_key = row[0];
return MailKeys{ return MailKeys{
.mail_key = mail_key.substr(8), .mail_key = e.mailkey.substr(8),
.mail_key_full = mail_key .mail_key_full = e.mailkey
}; };
} }
return MailKeys{};
}
bool SharedDatabase::SaveCursor( bool SharedDatabase::SaveCursor(
uint32 char_id, uint32 char_id,
std::list<EQ::ItemInstance*>::const_iterator& start, std::list<EQ::ItemInstance*>::const_iterator& start,
@@ -457,27 +424,20 @@ bool SharedDatabase::DeleteSharedBankSlot(uint32 char_id, int16 slot_id)
); );
} }
int32 SharedDatabase::GetSharedPlatinum(uint32 account_id) int32 SharedDatabase::GetSharedPlatinum(uint32 account_id)
{ {
const auto query = fmt::format("SELECT sharedplat FROM account WHERE id = {}", account_id); const auto& e = AccountRepository::FindOne(*this, account_id);
auto results = QueryDatabase(query);
if (!results.Success() || !results.RowCount()) { return e.sharedplat;
return 0;
} }
auto row = results.begin(); bool SharedDatabase::AddSharedPlatinum(uint32 account_id, int amount)
return Strings::ToInt(row[0]); {
} auto e = AccountRepository::FindOne(*this, account_id);
bool SharedDatabase::SetSharedPlatinum(uint32 account_id, int32 amount_to_add) { e.sharedplat += amount;
const std::string query = StringFormat("UPDATE account SET sharedplat = sharedplat + %i WHERE id = %i", amount_to_add, account_id);
const auto results = QueryDatabase(query);
if (!results.Success()) {
return false;
}
return true; return AccountRepository::UpdateOne(*this, e);
} }
bool SharedDatabase::SetStartingItems( bool SharedDatabase::SetStartingItems(
@@ -946,25 +906,8 @@ void SharedDatabase::ClearOldRecastTimestamps(uint32 char_id)
void SharedDatabase::GetItemsCount(int32& item_count, uint32& max_id) void SharedDatabase::GetItemsCount(int32& item_count, uint32& max_id)
{ {
item_count = -1; max_id = ItemsRepository::GetMaxId(*this);
max_id = 0; item_count = ItemsRepository::Count(*this);
const std::string query = "SELECT MAX(id), count(*) FROM items";
auto results = QueryDatabase(query);
if (!results.Success()) {
return;
}
if (results.RowCount() == 0)
return;
auto& row = results.begin();
if (row[0])
max_id = Strings::ToUnsignedInt(row[0]);
if (row[1])
item_count = Strings::ToUnsignedInt(row[1]);
} }
bool SharedDatabase::LoadItems(const std::string &prefix) { bool SharedDatabase::LoadItems(const std::string &prefix) {
@@ -1032,206 +975,204 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_
EQ::ItemData item; EQ::ItemData item;
const std::string query = "SELECT source," const auto& l = ItemsRepository::All(*this);
#define F(x) "`"#x"`,"
#include "item_fieldlist.h" if (l.empty()) {
#undef F
"updated, minstatus, comment FROM items ORDER BY id";
auto results = QueryDatabase(query);
if (!results.Success()) {
return; return;
} }
for (auto& row = results.begin(); row != results.end(); ++row) { for (const auto& e : l) {
memset(&item, 0, sizeof(EQ::ItemData)); memset(&item, 0, sizeof(EQ::ItemData));
// Unique Identifier // Unique Identifier
item.ID = Strings::ToUnsignedInt(row[ItemField::id]); item.ID = e.id;
// Minimum Status // Minimum Status
item.MinStatus = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::minstatus])); item.MinStatus = static_cast<uint8>(e.minstatus);
// Name, Lore, and Comment // Name, Lore, and Comment
strn0cpy(item.Name, row[ItemField::name], sizeof(item.Name)); strn0cpy(item.Name, e.Name.c_str(), sizeof(item.Name));
strn0cpy(item.Lore, row[ItemField::lore], sizeof(item.Lore)); strn0cpy(item.Lore, e.lore.c_str(), sizeof(item.Lore));
strn0cpy(item.Comment, row[ItemField::comment], sizeof(item.Comment)); strn0cpy(item.Comment, e.comment.c_str(), sizeof(item.Comment));
// Flags // Flags
item.ArtifactFlag = Strings::ToBool(row[ItemField::artifactflag]); item.ArtifactFlag = e.artifactflag;
item.Attuneable = !disable_attuneable && Strings::ToBool(row[ItemField::attuneable]); item.Attuneable = !disable_attuneable && e.attuneable;
item.BenefitFlag = Strings::ToBool(row[ItemField::benefitflag]); item.BenefitFlag = e.benefitflag;
item.FVNoDrop = Strings::ToBool(row[ItemField::fvnodrop]); item.FVNoDrop = e.fvnodrop;
item.Magic = Strings::ToBool(row[ItemField::magic]); item.Magic = e.magic;
item.NoDrop = disable_no_drop ? static_cast<uint8>(255) : static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::nodrop])); item.NoDrop = disable_no_drop ? std::numeric_limits<uint8>::max() : e.nodrop;
item.NoPet = !disable_no_pet && Strings::ToBool(row[ItemField::nopet]); item.NoPet = !disable_no_pet && e.nopet;
item.NoRent = disable_no_rent ? static_cast<uint8>(255) : static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::norent])); item.NoRent = disable_no_rent ? std::numeric_limits<uint8>::max() : e.norent;
item.NoTransfer = !disable_no_transfer && Strings::ToBool(row[ItemField::notransfer]); item.NoTransfer = !disable_no_transfer && e.notransfer;
item.PendingLoreFlag = Strings::ToBool(row[ItemField::pendingloreflag]); item.PendingLoreFlag = e.pendingloreflag;
item.QuestItemFlag = Strings::ToBool(row[ItemField::questitemflag]); item.QuestItemFlag = e.questitemflag;
item.Stackable = Strings::ToBool(row[ItemField::stackable]); item.Stackable = e.stackable;
item.Tradeskills = Strings::ToBool(row[ItemField::tradeskills]); item.Tradeskills = e.tradeskills;
item.SummonedFlag = Strings::ToBool(row[ItemField::summonedflag]); item.SummonedFlag = e.summonedflag;
// Lore // Lore
item.LoreGroup = disable_lore ? 0 : Strings::ToInt(row[ItemField::loregroup]); item.LoreGroup = disable_lore ? 0 : e.loregroup;
item.LoreFlag = !disable_lore && item.LoreGroup != 0; item.LoreFlag = !disable_lore && item.LoreGroup != 0;
// Type // Type
item.AugType = Strings::ToUnsignedInt(row[ItemField::augtype]); item.AugType = e.augtype;
item.ItemType = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::itemtype])); item.ItemType = static_cast<uint8>(e.itemtype);
item.SubType = Strings::ToInt(row[ItemField::subtype]); item.SubType = e.subtype;
// Miscellaneous // Miscellaneous
item.ExpendableArrow = static_cast<uint16>(Strings::ToUnsignedInt(row[ItemField::expendablearrow])); item.ExpendableArrow = e.expendablearrow;
item.Light = static_cast<int8>(Strings::ToInt(row[ItemField::light])); item.Light = EQ::Clamp(e.light, -128, 127);
item.MaxCharges = static_cast<int16>(Strings::ToInt(row[ItemField::maxcharges])); item.MaxCharges = e.maxcharges;
item.Size = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::size])); item.Size = static_cast<uint8>(e.size);
item.StackSize = static_cast<int16>(Strings::ToInt(row[ItemField::stacksize])); item.StackSize = e.stacksize;
item.Weight = Strings::ToInt(row[ItemField::weight]); item.Weight = e.weight;
// Potion Belt // Potion Belt
item.PotionBelt = !disable_potion_belt && Strings::ToBool(row[ItemField::potionbelt]); item.PotionBelt = !disable_potion_belt && e.potionbelt;
item.PotionBeltSlots = disable_potion_belt ? 0 : static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::potionbeltslots])); item.PotionBeltSlots = disable_potion_belt ? 0 : static_cast<uint8>(e.potionbeltslots);
// Merchant // Merchant
item.Favor = Strings::ToUnsignedInt(row[ItemField::favor]); item.Favor = e.favor;
item.GuildFavor = Strings::ToUnsignedInt(row[ItemField::guildfavor]); item.GuildFavor = e.guildfavor;
item.Price = Strings::ToUnsignedInt(row[ItemField::price]); item.Price = e.price;
item.SellRate = Strings::ToFloat(row[ItemField::sellrate]); item.SellRate = e.sellrate;
// Display // Display
item.Color = Strings::ToUnsignedInt(row[ItemField::color]); item.Color = e.color;
item.EliteMaterial = Strings::ToUnsignedInt(row[ItemField::elitematerial]); item.EliteMaterial = e.elitematerial;
item.HerosForgeModel = Strings::ToUnsignedInt(row[ItemField::herosforgemodel]); item.HerosForgeModel = e.herosforgemodel;
item.Icon = Strings::ToUnsignedInt(row[ItemField::icon]); item.Icon = e.icon;
strn0cpy(item.IDFile, row[ItemField::idfile], sizeof(item.IDFile)); strn0cpy(item.IDFile, e.idfile.c_str(), sizeof(item.IDFile));
item.Material = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::material])); item.Material = e.material;
// Resists // Resists
item.CR = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::cr]), -128, 127)); item.CR = EQ::Clamp(e.cr, -128, 127);
item.DR = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::dr]), -128, 127)); item.DR = EQ::Clamp(e.dr, -128, 127);
item.FR = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::fr]), -128, 127)); item.FR = EQ::Clamp(e.fr, -128, 127);
item.MR = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::mr]), -128, 127)); item.MR = EQ::Clamp(e.mr, -128, 127);
item.PR = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::pr]), -128, 127)); item.PR = EQ::Clamp(e.pr, -128, 127);
item.SVCorruption = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::svcorruption]), -128, 127)); item.SVCorruption = EQ::Clamp(e.svcorruption, -128, 127);
// Heroic Resists // Heroic Resists
item.HeroicCR = Strings::ToInt(row[ItemField::heroic_cr]); item.HeroicCR = e.heroic_cr;
item.HeroicDR = Strings::ToInt(row[ItemField::heroic_dr]); item.HeroicDR = e.heroic_dr;
item.HeroicFR = Strings::ToInt(row[ItemField::heroic_fr]); item.HeroicFR = e.heroic_fr;
item.HeroicMR = Strings::ToInt(row[ItemField::heroic_mr]); item.HeroicMR = e.heroic_mr;
item.HeroicPR = Strings::ToInt(row[ItemField::heroic_pr]); item.HeroicPR = e.heroic_pr;
item.HeroicSVCorrup = Strings::ToInt(row[ItemField::heroic_svcorrup]); item.HeroicSVCorrup = e.heroic_svcorrup;
// Stats // Stats
item.AAgi = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::aagi]), -128, 127)); item.AAgi = EQ::Clamp(e.aagi, -128, 127);
item.ACha = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::acha]), -128, 127)); item.ACha = EQ::Clamp(e.acha, -128, 127);
item.ADex = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::adex]), -128, 127)); item.ADex = EQ::Clamp(e.adex, -128, 127);
item.AInt = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::aint]), -128, 127)); item.AInt = EQ::Clamp(e.aint, -128, 127);
item.ASta = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::asta]), -128, 127)); item.ASta = EQ::Clamp(e.asta, -128, 127);
item.AStr = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::astr]), -128, 127)); item.AStr = EQ::Clamp(e.astr, -128, 127);
item.AWis = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::awis]), -128, 127)); item.AWis = EQ::Clamp(e.awis, -128, 127);
// Heroic Stats // Heroic Stats
item.HeroicAgi = Strings::ToInt(row[ItemField::heroic_agi]); item.HeroicAgi = e.heroic_agi;
item.HeroicCha = Strings::ToInt(row[ItemField::heroic_cha]); item.HeroicCha = e.heroic_cha;
item.HeroicDex = Strings::ToInt(row[ItemField::heroic_dex]); item.HeroicDex = e.heroic_dex;
item.HeroicInt = Strings::ToInt(row[ItemField::heroic_int]); item.HeroicInt = e.heroic_int;
item.HeroicSta = Strings::ToInt(row[ItemField::heroic_sta]); item.HeroicSta = e.heroic_sta;
item.HeroicStr = Strings::ToInt(row[ItemField::heroic_str]); item.HeroicStr = e.heroic_str;
item.HeroicWis = Strings::ToInt(row[ItemField::heroic_wis]); item.HeroicWis = e.heroic_wis;
// Health, Mana, and Endurance // Health, Mana, and Endurance
item.HP = Strings::ToInt(row[ItemField::hp]); item.HP = e.hp;
item.Regen = Strings::ToInt(row[ItemField::regen]); item.Regen = e.regen;
item.Mana = Strings::ToInt(row[ItemField::mana]); item.Mana = e.mana;
item.ManaRegen = Strings::ToInt(row[ItemField::manaregen]); item.ManaRegen = e.manaregen;
item.Endur = Strings::ToInt(row[ItemField::endur]); item.Endur = e.endur;
item.EnduranceRegen = Strings::ToInt(row[ItemField::enduranceregen]); item.EnduranceRegen = e.enduranceregen;
// Bane Damage // Bane Damage
item.BaneDmgAmt = Strings::ToInt(row[ItemField::banedmgamt]); item.BaneDmgAmt = e.banedmgamt;
item.BaneDmgBody = Strings::ToUnsignedInt(row[ItemField::banedmgbody]); item.BaneDmgBody = e.banedmgbody;
item.BaneDmgRace = Strings::ToUnsignedInt(row[ItemField::banedmgrace]); item.BaneDmgRace = e.banedmgrace;
item.BaneDmgRaceAmt = Strings::ToUnsignedInt(row[ItemField::banedmgraceamt]); item.BaneDmgRaceAmt = e.banedmgraceamt;
// Elemental Damage // Elemental Damage
item.ElemDmgType = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::elemdmgtype])); item.ElemDmgType = static_cast<uint8>(e.elemdmgtype);
item.ElemDmgAmt = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::elemdmgamt])); item.ElemDmgAmt = static_cast<uint8>(e.elemdmgamt);
// Combat // Combat
item.BackstabDmg = Strings::ToUnsignedInt(row[ItemField::backstabdmg]); item.BackstabDmg = e.backstabdmg;
item.Damage = Strings::ToUnsignedInt(row[ItemField::damage]); item.Damage = e.damage;
item.Delay = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::delay])); item.Delay = static_cast<uint8>(e.delay);
item.Range = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::range])); item.Range = static_cast<uint8>(e.range_);
// Combat Stats // Combat Stats
item.AC = Strings::ToInt(row[ItemField::ac]); item.AC = e.ac;
item.Accuracy = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::accuracy]), -128, 127)); item.Accuracy = EQ::Clamp(e.accuracy, -128, 127);
item.Attack = Strings::ToInt(row[ItemField::attack]); item.Attack = e.attack;
item.Avoidance = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::avoidance]), -128, 127)); item.Avoidance = EQ::Clamp(e.avoidance, -128, 127);
item.Clairvoyance = Strings::ToUnsignedInt(row[ItemField::clairvoyance]); item.Clairvoyance = e.clairvoyance;
item.CombatEffects = Strings::IsNumber(row[ItemField::combateffects]) ? static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::combateffects]), -128, 127)) : 0; item.CombatEffects = Strings::IsNumber(e.combateffects) ? static_cast<int8>(EQ::Clamp(Strings::ToInt(e.combateffects), -128, 127)) : 0;
item.DamageShield = Strings::ToInt(row[ItemField::damageshield]); item.DamageShield = e.damageshield;
item.DotShielding = Strings::ToInt(row[ItemField::dotshielding]); item.DotShielding = e.dotshielding;
item.DSMitigation = Strings::ToUnsignedInt(row[ItemField::dsmitigation]); item.DSMitigation = e.dsmitigation;
item.Haste = Strings::ToInt(row[ItemField::haste]); item.Haste = e.haste;
item.HealAmt = Strings::ToInt(row[ItemField::healamt]); item.HealAmt = e.healamt;
item.Purity = Strings::ToUnsignedInt(row[ItemField::purity]); item.Purity = e.purity;
item.Shielding = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::shielding]), -128, 127)); item.Shielding = EQ::Clamp(e.shielding, -128, 127);
item.SpellDmg = Strings::ToInt(row[ItemField::spelldmg]); item.SpellDmg = e.spelldmg;
item.SpellShield = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::spellshield]), -128, 127)); item.SpellShield = EQ::Clamp(e.spellshield, -128, 127);
item.StrikeThrough = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::strikethrough]), -128, 127)); item.StrikeThrough = EQ::Clamp(e.strikethrough, -128, 127);
item.StunResist = static_cast<int8>(EQ::Clamp(Strings::ToInt(row[ItemField::stunresist]), -128, 127)); item.StunResist = EQ::Clamp(e.stunresist, -128, 127);
// Restrictions // Restrictions
item.AugRestrict = Strings::ToUnsignedInt(row[ItemField::augrestrict]); item.AugRestrict = e.augrestrict;
item.Classes = Strings::ToUnsignedInt(row[ItemField::classes]); item.Classes = e.classes;
item.Deity = Strings::ToUnsignedInt(row[ItemField::deity]); item.Deity = e.deity;
item.ItemClass = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::itemclass])); item.ItemClass = static_cast<uint8>(e.itemclass);
item.Races = Strings::ToUnsignedInt(row[ItemField::races]); item.Races = e.races;
item.RecLevel = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::reclevel])); item.RecLevel = static_cast<uint8>(e.reclevel);
item.RecSkill = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::recskill])); item.RecSkill = static_cast<uint8>(e.recskill);
item.ReqLevel = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::reqlevel])); item.ReqLevel = static_cast<uint8>(e.reqlevel);
item.Slots = Strings::ToUnsignedInt(row[ItemField::slots]); item.Slots = e.slots;
// Skill Modifier // Skill Modifier
item.SkillModValue = Strings::ToInt(row[ItemField::skillmodvalue]); item.SkillModValue = e.skillmodvalue;
item.SkillModMax = Strings::ToInt(row[ItemField::skillmodmax]); item.SkillModMax = e.skillmodmax;
item.SkillModType = Strings::ToUnsignedInt(row[ItemField::skillmodtype]); item.SkillModType = e.skillmodtype;
// Extra Damage Skill // Extra Damage Skill
item.ExtraDmgSkill = Strings::ToInt(row[ItemField::extradmgskill]); item.ExtraDmgSkill = e.extradmgskill;
item.ExtraDmgAmt = Strings::ToInt(row[ItemField::extradmgamt]); item.ExtraDmgAmt = e.extradmgamt;
// Bard // Bard
item.BardType = Strings::ToUnsignedInt(row[ItemField::bardtype]); item.BardType = e.bardtype;
item.BardValue = Strings::ToInt(row[ItemField::bardvalue]); item.BardValue = e.bardvalue;
// Faction // Faction
item.FactionAmt1 = Strings::ToInt(row[ItemField::factionamt1]); item.FactionAmt1 = e.factionamt1;
item.FactionMod1 = Strings::ToInt(row[ItemField::factionmod1]); item.FactionMod1 = e.factionmod1;
item.FactionAmt2 = Strings::ToInt(row[ItemField::factionamt2]); item.FactionAmt2 = e.factionamt2;
item.FactionMod2 = Strings::ToInt(row[ItemField::factionmod2]); item.FactionMod2 = e.factionmod2;
item.FactionAmt3 = Strings::ToInt(row[ItemField::factionamt3]); item.FactionAmt3 = e.factionamt3;
item.FactionMod3 = Strings::ToInt(row[ItemField::factionmod3]); item.FactionMod3 = e.factionmod3;
item.FactionAmt4 = Strings::ToInt(row[ItemField::factionamt4]); item.FactionAmt4 = e.factionamt4;
item.FactionMod4 = Strings::ToInt(row[ItemField::factionmod4]); item.FactionMod4 = e.factionmod4;
// Augment // Augment Distiller
item.AugDistiller = Strings::ToUnsignedInt(row[ItemField::augdistiller]); item.AugDistiller = e.augdistiller;
item.AugSlotType[0] = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::augslot1type]));
item.AugSlotVisible[0] = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::augslot1visible])); // Augment Slots
item.AugSlotType[1] = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::augslot2type])); item.AugSlotType[0] = static_cast<uint8>(e.augslot1type);
item.AugSlotVisible[1] = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::augslot2visible])); item.AugSlotVisible[0] = static_cast<uint8>(e.augslot1visible);
item.AugSlotType[2] = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::augslot3type])); item.AugSlotType[1] = static_cast<uint8>(e.augslot2type);
item.AugSlotVisible[2] = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::augslot3visible])); item.AugSlotVisible[1] = static_cast<uint8>(e.augslot2visible);
item.AugSlotType[3] = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::augslot4type])); item.AugSlotType[2] = static_cast<uint8>(e.augslot3type);
item.AugSlotVisible[3] = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::augslot4visible])); item.AugSlotVisible[2] = static_cast<uint8>(e.augslot3visible);
item.AugSlotType[4] = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::augslot5type])); item.AugSlotType[3] = static_cast<uint8>(e.augslot4type);
item.AugSlotVisible[4] = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::augslot5visible])); item.AugSlotVisible[3] = static_cast<uint8>(e.augslot4visible);
item.AugSlotType[5] = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::augslot6type])); item.AugSlotType[4] = static_cast<uint8>(e.augslot5type);
item.AugSlotVisible[5] = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::augslot6visible])); item.AugSlotVisible[4] = static_cast<uint8>(e.augslot5visible);
item.AugSlotType[5] = static_cast<uint8>(e.augslot6type);
item.AugSlotVisible[5] = static_cast<uint8>(e.augslot6visible);
// Augment Unknowns // Augment Unknowns
for (uint8 i = EQ::invaug::SOCKET_BEGIN; i <= EQ::invaug::SOCKET_END; i++) { for (uint8 i = EQ::invaug::SOCKET_BEGIN; i <= EQ::invaug::SOCKET_END; i++) {
@@ -1239,79 +1180,79 @@ void SharedDatabase::LoadItems(void *data, uint32 size, int32 items, uint32 max_
} }
// LDoN // LDoN
item.LDoNTheme = Strings::ToUnsignedInt(row[ItemField::ldontheme]); item.LDoNTheme = e.ldontheme;
item.LDoNPrice = Strings::ToUnsignedInt(row[ItemField::ldonprice]); item.LDoNPrice = e.ldonprice;
item.LDoNSellBackRate = Strings::ToUnsignedInt(row[ItemField::ldonsellbackrate]); item.LDoNSellBackRate = e.ldonsellbackrate;
item.LDoNSold = Strings::ToUnsignedInt(row[ItemField::ldonsold]); item.LDoNSold = e.ldonsold;
item.PointType = Strings::ToUnsignedInt(row[ItemField::pointtype]); item.PointType = e.pointtype;
// Bag // Bag
item.BagSize = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::bagsize])); item.BagSize = static_cast<uint8>(e.bagsize);
item.BagSlots = static_cast<uint8>(EQ::Clamp(Strings::ToInt(row[ItemField::bagslots]), 0, static_cast<int>(EQ::invbag::SLOT_COUNT))); item.BagSlots = EQ::Clamp(e.bagslots, 0, static_cast<int>(EQ::invbag::SLOT_COUNT));
item.BagType = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::bagtype])); item.BagType = static_cast<uint8>(e.bagtype);
item.BagWR = static_cast<uint8>(EQ::Clamp(Strings::ToInt(row[ItemField::bagwr]), 0, 100)); item.BagWR = EQ::Clamp(e.bagwr, 0, 100);
// Bard Effect // Bard Effect
item.Bard.Effect = disable_bard_focus_effects ? 0 : Strings::ToInt(row[ItemField::bardeffect]); item.Bard.Effect = disable_bard_focus_effects ? 0 : e.bardeffect;
item.Bard.Type = disable_bard_focus_effects ? 0 : static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::bardtype])); item.Bard.Type = disable_bard_focus_effects ? 0 : static_cast<uint8>(e.bardtype);
item.Bard.Level = disable_bard_focus_effects ? 0 : static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::bardlevel])); item.Bard.Level = disable_bard_focus_effects ? 0 : static_cast<uint8>(e.bardlevel);
item.Bard.Level2 = disable_bard_focus_effects ? 0 : static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::bardlevel2])); item.Bard.Level2 = disable_bard_focus_effects ? 0 : static_cast<uint8>(e.bardlevel2);
// Book // Book
item.Book = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::book])); item.Book = static_cast<uint8>(e.book);
item.BookType = Strings::ToUnsignedInt(row[ItemField::booktype]); item.BookType = e.booktype;
// Click Effect // Click Effect
item.CastTime = Strings::ToUnsignedInt(row[ItemField::casttime]); item.CastTime = e.casttime;
item.CastTime_ = Strings::ToInt(row[ItemField::casttime_]); item.CastTime_ = e.casttime_;
item.Click.Effect = Strings::ToInt(row[ItemField::clickeffect]); item.Click.Effect = e.clickeffect;
item.Click.Type = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::clicktype])); item.Click.Type = static_cast<uint8>(e.clicktype);
item.Click.Level = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::clicklevel])); item.Click.Level = static_cast<uint8>(e.clicklevel);
item.Click.Level2 = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::clicklevel2])); item.Click.Level2 = static_cast<uint8>(e.clicklevel2);
strn0cpy(item.ClickName, row[ItemField::clickname], sizeof(item.ClickName)); strn0cpy(item.ClickName, e.clickname.c_str(), sizeof(item.ClickName));
item.RecastDelay = Strings::ToUnsignedInt(row[ItemField::recastdelay]); item.RecastDelay = e.recastdelay;
item.RecastType = Strings::ToInt(row[ItemField::recasttype]); item.RecastType = e.recasttype;
// Focus Effect // Focus Effect
item.Focus.Effect = disable_spell_focus_effects ? 0 : Strings::ToInt(row[ItemField::focuseffect]); item.Focus.Effect = disable_spell_focus_effects ? 0 : e.focuseffect;
item.Focus.Type = disable_spell_focus_effects ? 0 : static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::focustype])); item.Focus.Type = disable_spell_focus_effects ? 0 : static_cast<uint8>(e.focustype);
item.Focus.Level = disable_spell_focus_effects ? 0 : static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::focuslevel])); item.Focus.Level = disable_spell_focus_effects ? 0 : static_cast<uint8>(e.focuslevel);
item.Focus.Level2 = disable_spell_focus_effects ? 0 : static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::focuslevel2])); item.Focus.Level2 = disable_spell_focus_effects ? 0 : static_cast<uint8>(e.focuslevel2);
strn0cpy(item.FocusName, disable_spell_focus_effects ? "" : row[ItemField::focusname], sizeof(item.FocusName)); strn0cpy(item.FocusName, disable_spell_focus_effects ? "" : e.focusname.c_str(), sizeof(item.FocusName));
// Proc Effect // Proc Effect
item.Proc.Effect = Strings::ToInt(row[ItemField::proceffect]); item.Proc.Effect = e.proceffect;
item.Proc.Type = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::proctype])); item.Proc.Type = static_cast<uint8>(e.proctype);
item.Proc.Level = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::proclevel])); item.Proc.Level = static_cast<uint8>(e.proclevel);
item.Proc.Level2 = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::proclevel2])); item.Proc.Level2 = static_cast<uint8>(e.proclevel2);
strn0cpy(item.ProcName, row[ItemField::procname], sizeof(item.ProcName)); strn0cpy(item.ProcName, e.procname.c_str(), sizeof(item.ProcName));
item.ProcRate = Strings::ToInt(row[ItemField::procrate]); item.ProcRate = e.procrate;
// Scroll Effect // Scroll Effect
item.Scroll.Effect = Strings::ToInt(row[ItemField::scrolleffect]); item.Scroll.Effect = e.scrolleffect;
item.Scroll.Type = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::scrolltype])); item.Scroll.Type = static_cast<uint8>(e.scrolltype);
item.Scroll.Level = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::scrolllevel])); item.Scroll.Level = static_cast<uint8>(e.scrolllevel);
item.Scroll.Level2 = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::scrolllevel2])); item.Scroll.Level2 = static_cast<uint8>(e.scrolllevel2);
strn0cpy(item.ScrollName, row[ItemField::scrollname], sizeof(item.ScrollName)); strn0cpy(item.ScrollName, e.scrollname.c_str(), sizeof(item.ScrollName));
// Worn Effect // Worn Effect
item.Worn.Effect = Strings::ToInt(row[ItemField::worneffect]); item.Worn.Effect = e.worneffect;
item.Worn.Type = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::worntype])); item.Worn.Type = static_cast<uint8>(e.worntype);
item.Worn.Level = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::wornlevel])); item.Worn.Level = static_cast<uint8>(e.wornlevel);
item.Worn.Level2 = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::wornlevel2])); item.Worn.Level2 = static_cast<uint8>(e.wornlevel2);
strn0cpy(item.WornName, row[ItemField::wornname], sizeof(item.WornName)); strn0cpy(item.WornName, e.wornname.c_str(), sizeof(item.WornName));
// Evolving Item // Evolving Item
item.EvolvingID = Strings::ToUnsignedInt(row[ItemField::evoid]); item.EvolvingID = e.evoid;
item.EvolvingItem = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::evoitem])); item.EvolvingItem = static_cast<uint8>(e.evoitem);
item.EvolvingLevel = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::evolvinglevel])); item.EvolvingLevel = static_cast<uint8>(e.evolvinglevel);
item.EvolvingMax = static_cast<uint8>(Strings::ToUnsignedInt(row[ItemField::evomax])); item.EvolvingMax = static_cast<uint8>(e.evomax);
// Scripting // Scripting
item.CharmFileID = Strings::IsNumber(row[ItemField::charmfileid]) ? Strings::ToUnsignedInt(row[ItemField::charmfileid]) : 0; item.CharmFileID = Strings::IsNumber(e.charmfileid) ? Strings::ToUnsignedInt(e.charmfileid) : 0;
strn0cpy(item.CharmFile, row[ItemField::charmfile], sizeof(item.CharmFile)); strn0cpy(item.CharmFile, e.charmfile.c_str(), sizeof(item.CharmFile));
strn0cpy(item.Filename, row[ItemField::filename], sizeof(item.Filename)); strn0cpy(item.Filename, e.filename.c_str(), sizeof(item.Filename));
item.ScriptFileID = Strings::ToUnsignedInt(row[ItemField::scriptfileid]); item.ScriptFileID = e.scriptfileid;
try { try {
hash.insert(item.ID, item); hash.insert(item.ID, item);
@@ -1673,20 +1614,17 @@ bool SharedDatabase::GetCommandSubSettings(std::vector<CommandSubsettingsReposit
return true; return true;
} }
void SharedDatabase::LoadDamageShieldTypes(SPDat_Spell_Struct* sp, int32 iMaxSpellID) { void SharedDatabase::LoadDamageShieldTypes(SPDat_Spell_Struct* s)
const std::string query = StringFormat("SELECT `spellid`, `type` FROM `damageshieldtypes` WHERE `spellid` > 0 " {
"AND `spellid` <= %i", iMaxSpellID); const auto& l = DamageshieldtypesRepository::All(*this);
auto results = QueryDatabase(query);
if (!results.Success()) { if (l.empty()) {
return; return;
} }
for(auto& row = results.begin(); row != results.end(); ++row) { for (const auto& e : l) {
const int spellID = Strings::ToInt(row[0]); s[e.spellid].damage_shield_type = e.type;
if((spellID > 0) && (spellID <= iMaxSpellID))
sp[spellID].damage_shield_type = Strings::ToUnsignedInt(row[1]);
} }
} }
const EvolveInfo* SharedDatabase::GetEvolveInfo(uint32 loregroup) { const EvolveInfo* SharedDatabase::GetEvolveInfo(uint32 loregroup) {
@@ -1903,21 +1841,32 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) {
sp[tempid].damage_shield_type = 0; sp[tempid].damage_shield_type = 0;
} }
LoadDamageShieldTypes(sp, max_spells); LoadDamageShieldTypes(sp);
} }
void SharedDatabase::LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* message) { void SharedDatabase::LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* s)
const std::string query = StringFormat("SELECT `inspect_message` FROM `character_inspect_messages` WHERE `id` = %u LIMIT 1", character_id); {
auto results = QueryDatabase(query); const auto& e = CharacterInspectMessagesRepository::FindOne(*this, character_id);
memset(message, '\0', sizeof(InspectMessage_Struct));
for (auto& row = results.begin(); row != results.end(); ++row) { memset(s, '\0', sizeof(InspectMessage_Struct));
memcpy(message, row[0], sizeof(InspectMessage_Struct));
} if (!e.id) {
return;
} }
void SharedDatabase::SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct* message) { memcpy(s, e.inspect_message.c_str(), sizeof(InspectMessage_Struct));
const std::string query = StringFormat("REPLACE INTO `character_inspect_messages` (id, inspect_message) VALUES (%u, '%s')", character_id, Strings::Escape(message->text).c_str()); }
auto results = QueryDatabase(query);
void SharedDatabase::SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct* s)
{
auto e = CharacterInspectMessagesRepository::NewEntity();
e.id = character_id;
e.inspect_message = s->text;
if (!CharacterInspectMessagesRepository::ReplaceOne(*this, e)) {
LogError("Failed to save character inspect message of [{}] for character_id [{}]", s->text, character_id);
}
} }
uint32 SharedDatabase::GetSpellsCount() uint32 SharedDatabase::GetSpellsCount()
@@ -1938,18 +1887,7 @@ uint32 SharedDatabase::GetSpellsCount()
uint32 SharedDatabase::GetItemsCount() uint32 SharedDatabase::GetItemsCount()
{ {
auto results = QueryDatabase("SELECT count(*) FROM items"); return ItemsRepository::Count(*this);
if (!results.Success() || !results.RowCount()) {
return 0;
}
auto& row = results.begin();
if (row[0]) {
return Strings::ToUnsignedInt(row[0]);
}
return 0;
} }
void SharedDatabase::SetSharedItemsCount(uint32 shared_items_count) void SharedDatabase::SetSharedItemsCount(uint32 shared_items_count)
+6 -7
View File
@@ -76,21 +76,20 @@ public:
uint8 GetGMSpeed(uint32 account_id); uint8 GetGMSpeed(uint32 account_id);
bool SetHideMe(uint32 account_id, uint8 hideme); bool SetHideMe(uint32 account_id, uint8 hideme);
int DeleteStalePlayerCorpses(); int DeleteStalePlayerCorpses();
void LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct *message); void LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* s);
void SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct *message); void SaveCharacterInspectMessage(uint32 character_id, const InspectMessage_Struct* s);
bool GetCommandSettings(std::map<std::string, std::pair<uint8, std::vector<std::string>>> &command_settings); bool GetCommandSettings(std::map<std::string, std::pair<uint8, std::vector<std::string>>> &command_settings);
bool UpdateInjectedCommandSettings(const std::vector<std::pair<std::string, uint8>> &injected); bool UpdateInjectedCommandSettings(const std::vector<std::pair<std::string, uint8>> &injected);
bool UpdateOrphanedCommandSettings(const std::vector<std::string> &orphaned); bool UpdateOrphanedCommandSettings(const std::vector<std::string> &orphaned);
bool GetCommandSubSettings(std::vector<CommandSubsettingsRepository::CommandSubsettings> &command_subsettings); bool GetCommandSubSettings(std::vector<CommandSubsettingsRepository::CommandSubsettings> &command_subsettings);
uint32 GetTotalTimeEntitledOnAccount(uint32 AccountID);
bool SetGMInvul(uint32 account_id, bool gminvul); bool SetGMInvul(uint32 account_id, bool gminvul);
bool SetGMFlymode(uint32 account_id, uint8 flymode); bool SetGMFlymode(uint32 account_id, uint8 flymode);
void SetMailKey(int CharID, int IPAddress, int MailKey); void SetMailKey(uint32 character_id, uint32 ip_address, uint32 mail_key);
struct MailKeys { struct MailKeys {
std::string mail_key; std::string mail_key;
std::string mail_key_full; std::string mail_key_full;
}; };
MailKeys GetMailKey(int character_id); MailKeys GetMailKey(uint32 character_id);
bool SaveCursor( bool SaveCursor(
uint32 char_id, uint32 char_id,
std::list<EQ::ItemInstance *>::const_iterator &start, std::list<EQ::ItemInstance *>::const_iterator &start,
@@ -104,7 +103,7 @@ public:
bool VerifyInventory(uint32 account_id, int16 slot_id, const EQ::ItemInstance *inst); bool VerifyInventory(uint32 account_id, int16 slot_id, const EQ::ItemInstance *inst);
bool GetSharedBank(uint32 id, EQ::InventoryProfile *inv, bool is_charid); bool GetSharedBank(uint32 id, EQ::InventoryProfile *inv, bool is_charid);
int32 GetSharedPlatinum(uint32 account_id); int32 GetSharedPlatinum(uint32 account_id);
bool SetSharedPlatinum(uint32 account_id, int32 amount_to_add); bool AddSharedPlatinum(uint32 account_id, int amount);
bool GetInventory(Client* c); bool GetInventory(Client* c);
bool GetInventory(uint32 account_id, char *name, EQ::InventoryProfile *inv); // deprecated bool GetInventory(uint32 account_id, char *name, EQ::InventoryProfile *inv); // deprecated
std::map<uint32, uint32> GetItemRecastTimestamps(uint32 char_id); std::map<uint32, uint32> GetItemRecastTimestamps(uint32 char_id);
@@ -173,7 +172,7 @@ public:
int GetMaxSpellID(); int GetMaxSpellID();
bool LoadSpells(const std::string &prefix, int32 *records, const SPDat_Spell_Struct **sp); bool LoadSpells(const std::string &prefix, int32 *records, const SPDat_Spell_Struct **sp);
void LoadSpells(void *data, int max_spells); void LoadSpells(void *data, int max_spells);
void LoadDamageShieldTypes(SPDat_Spell_Struct *sp, int32 iMaxSpellID); void LoadDamageShieldTypes(SPDat_Spell_Struct* s);
uint32 GetSharedSpellsCount() { return m_shared_spells_count; } uint32 GetSharedSpellsCount() { return m_shared_spells_count; }
uint32 GetSpellsCount(); uint32 GetSpellsCount();
+415 -415
View File
File diff suppressed because it is too large Load Diff
+531 -532
View File
File diff suppressed because it is too large Load Diff
+7
View File
@@ -36,6 +36,7 @@
#include "strings.h" #include "strings.h"
#include <cereal/external/rapidjson/document.h> #include <cereal/external/rapidjson/document.h>
#include <fmt/format.h> #include <fmt/format.h>
#include <fmt/ranges.h>
#include <algorithm> #include <algorithm>
#include <cctype> #include <cctype>
@@ -313,6 +314,12 @@ std::string Strings::Commify(const std::string &number)
auto string_length = static_cast<int>(number.length()); auto string_length = static_cast<int>(number.length());
if (string_length == 3) {
return number;
} else if (string_length == 4 && number.starts_with("-")) {
return number;
}
int i = 0; int i = 0;
for (i = string_length - 3; i >= 0; i -= 3) { for (i = string_length - 3; i >= 0; i -= 3) {
if (i > 0) { if (i > 0) {
+1
View File
@@ -2,6 +2,7 @@
#include <ios> #include <ios>
#include <fmt/format.h> #include <fmt/format.h>
#include <fmt/ranges.h>
#ifdef _WIN32 #ifdef _WIN32
#include <objbase.h> #include <objbase.h>
+2 -2
View File
@@ -25,7 +25,7 @@
// Build variables // Build variables
// these get injected during the build pipeline // these get injected during the build pipeline
#define CURRENT_VERSION "23.9.0-dev" // always append -dev to the current version for custom-builds #define CURRENT_VERSION "23.10.3-dev" // always append -dev to the current version for custom-builds
#define LOGIN_VERSION "0.8.0" #define LOGIN_VERSION "0.8.0"
#define COMPILE_DATE __DATE__ #define COMPILE_DATE __DATE__
#define COMPILE_TIME __TIME__ #define COMPILE_TIME __TIME__
@@ -42,7 +42,7 @@
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt * Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
*/ */
#define CURRENT_BINARY_DATABASE_VERSION 9326 #define CURRENT_BINARY_DATABASE_VERSION 9328
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9054 #define CURRENT_BINARY_BOTS_DATABASE_VERSION 9054
#define CUSTOM_BINARY_DATABASE_VERSION 0 #define CUSTOM_BINARY_DATABASE_VERSION 0
+7 -7
View File
@@ -1,20 +1,20 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.12) cmake_minimum_required(VERSION 3.20)
SET(eqlaunch_sources set(eqlaunch_sources
eqlaunch.cpp eqlaunch.cpp
worldserver.cpp worldserver.cpp
zone_launch.cpp zone_launch.cpp
) )
SET(eqlaunch_headers set(eqlaunch_headers
worldserver.h worldserver.h
zone_launch.h zone_launch.h
) )
ADD_EXECUTABLE(eqlaunch ${eqlaunch_sources} ${eqlaunch_headers}) add_executable(eqlaunch ${eqlaunch_sources} ${eqlaunch_headers})
INSTALL(TARGETS eqlaunch RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin) install(TARGETS eqlaunch RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
TARGET_LINK_LIBRARIES(eqlaunch ${SERVER_LIBS}) target_link_libraries(eqlaunch ${SERVER_LIBS})
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
-22
View File
@@ -1,22 +0,0 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
SET(hc_sources
eq.cpp
main.cpp
login.cpp
world.cpp
)
SET(hc_headers
eq.h
login.h
world.h
)
ADD_EXECUTABLE(hc ${hc_sources} ${hc_headers})
INSTALL(TARGETS hc RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/bin)
TARGET_LINK_LIBRARIES(hc ${SERVER_LIBS})
SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
-350
View File
@@ -1,350 +0,0 @@
#include "eq.h"
#include "../common/net/dns.h"
const char* eqcrypt_block(const char *buffer_in, size_t buffer_in_sz, char* buffer_out, bool enc) {
DES_key_schedule k;
DES_cblock v;
memset(&k, 0, sizeof(DES_key_schedule));
memset(&v, 0, sizeof(DES_cblock));
if (!enc && buffer_in_sz && buffer_in_sz % 8 != 0) {
return nullptr;
}
DES_ncbc_encrypt((const unsigned char*)buffer_in, (unsigned char*)buffer_out, (long)buffer_in_sz, &k, &v, enc);
return buffer_out;
}
EverQuest::EverQuest(const std::string &host, int port, const std::string &user, const std::string &pass, const std::string &server, const std::string &character)
{
m_host = host;
m_port = port;
m_user = user;
m_pass = pass;
m_server = server;
m_character = character;
m_dbid = 0;
EQ::Net::DNSLookup(m_host, port, false, [&](const std::string &addr) {
if (addr.empty()) {
Log.OutF(Logs::General, Logs::Headless_Client, "Could not resolve address: {0}", m_host);
return;
}
else {
m_host = addr;
m_login_connection_manager.reset(new EQ::Net::DaybreakConnectionManager());
m_login_connection_manager->OnNewConnection(std::bind(&EverQuest::LoginOnNewConnection, this, std::placeholders::_1));
m_login_connection_manager->OnConnectionStateChange(std::bind(&EverQuest::LoginOnStatusChangeReconnectEnabled, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
m_login_connection_manager->OnPacketRecv(std::bind(&EverQuest::LoginOnPacketRecv, this, std::placeholders::_1, std::placeholders::_2));
m_login_connection_manager->Connect(m_host, m_port);
}
});
}
EverQuest::~EverQuest()
{
}
void EverQuest::LoginOnNewConnection(std::shared_ptr<EQ::Net::DaybreakConnection> connection)
{
m_login_connection = connection;
Log.OutF(Logs::General, Logs::Headless_Client, "Connecting...");
}
void EverQuest::LoginOnStatusChangeReconnectEnabled(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
{
if (to == EQ::Net::StatusConnected) {
Log.OutF(Logs::General, Logs::Headless_Client, "Login connected.");
LoginSendSessionReady();
}
if (to == EQ::Net::StatusDisconnected) {
Log.OutF(Logs::General, Logs::Headless_Client, "Login connection lost before we got to world, reconnecting.");
m_key.clear();
m_dbid = 0;
m_login_connection.reset();
m_login_connection_manager->Connect(m_host, m_port);
}
}
void EverQuest::LoginOnStatusChangeReconnectDisabled(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
{
if (to == EQ::Net::StatusDisconnected) {
m_login_connection.reset();
}
}
void EverQuest::LoginOnPacketRecv(std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet & p)
{
auto opcode = p.GetUInt16(0);
switch (opcode) {
case 0x0017: //OP_ChatMessage
LoginSendLogin();
break;
case 0x0018:
LoginProcessLoginResponse(p);
break;
case 0x0019:
LoginProcessServerPacketList(p);
break;
case 0x0022:
LoginProcessServerPlayResponse(p);
break;
}
}
void EverQuest::LoginSendSessionReady()
{
EQ::Net::DynamicPacket p;
p.PutUInt16(0, 1); //OP_SessionReady
p.PutUInt32(2, 2);
m_login_connection->QueuePacket(p);
}
void EverQuest::LoginSendLogin()
{
size_t buffer_len = m_user.length() + m_pass.length() + 2;
std::unique_ptr<char[]> buffer(new char[buffer_len]);
strcpy(&buffer[0], m_user.c_str());
strcpy(&buffer[m_user.length() + 1], m_pass.c_str());
size_t encrypted_len = buffer_len;
if (encrypted_len % 8 > 0) {
encrypted_len = ((encrypted_len / 8) + 1) * 8;
}
EQ::Net::DynamicPacket p;
p.Resize(12 + encrypted_len);
p.PutUInt16(0, 2); //OP_Login
p.PutUInt32(2, 3);
eqcrypt_block(&buffer[0], buffer_len, (char*)p.Data() + 12, true);
m_login_connection->QueuePacket(p);
}
void EverQuest::LoginSendServerRequest()
{
EQ::Net::DynamicPacket p;
p.PutUInt16(0, 4); //OP_ServerListRequest
p.PutUInt32(2, 4);
m_login_connection->QueuePacket(p);
}
void EverQuest::LoginSendPlayRequest(uint32_t id)
{
EQ::Net::DynamicPacket p;
p.PutUInt16(0, 0x000d);
p.PutUInt16(2, 5);
p.PutUInt32(4, 0);
p.PutUInt32(8, 0);
p.PutUInt32(12, id);
m_login_connection->QueuePacket(p);
}
void EverQuest::LoginProcessLoginResponse(const EQ::Net::Packet & p)
{
auto encrypt_size = p.Length() - 12;
if (encrypt_size % 8 > 0) {
encrypt_size = (encrypt_size / 8) * 8;
}
std::unique_ptr<char[]> decrypted(new char[encrypt_size]);
eqcrypt_block((char*)p.Data() + 12, encrypt_size, &decrypted[0], false);
EQ::Net::StaticPacket sp(&decrypted[0], encrypt_size);
auto response_error = sp.GetUInt16(1);
if (response_error > 101) {
Log.OutF(Logs::General, Logs::Headless_Client, "Error logging in response code: {0}", response_error);
LoginDisableReconnect();
}
else {
m_key = sp.GetCString(12);
m_dbid = sp.GetUInt32(8);
Log.OutF(Logs::General, Logs::Headless_Client, "Logged in successfully with dbid {0} and key {1}", m_dbid, m_key);
LoginSendServerRequest();
}
}
void EverQuest::LoginProcessServerPacketList(const EQ::Net::Packet & p)
{
m_world_servers.clear();
auto number_of_servers = p.GetUInt32(18);
size_t idx = 22;
for (auto i = 0U; i < number_of_servers; ++i) {
WorldServer ws;
ws.address = p.GetCString(idx);
idx += (ws.address.length() + 1);
ws.type = p.GetInt32(idx);
idx += 4;
auto id = p.GetUInt32(idx);
idx += 4;
ws.long_name = p.GetCString(idx);
idx += (ws.long_name.length() + 1);
ws.lang = p.GetCString(idx);
idx += (ws.lang.length() + 1);
ws.region = p.GetCString(idx);
idx += (ws.region.length() + 1);
ws.status = p.GetInt32(idx);
idx += 4;
ws.players = p.GetInt32(idx);
idx += 4;
m_world_servers[id] = ws;
}
for (auto server : m_world_servers) {
if (server.second.long_name.compare(m_server) == 0) {
Log.OutF(Logs::General, Logs::Headless_Client, "Found world server {0}, attempting to login.", m_server);
LoginSendPlayRequest(server.first);
return;
}
}
Log.OutF(Logs::General, Logs::Headless_Client, "Got response from login server but could not find world server {0} disconnecting.", m_server);
LoginDisableReconnect();
}
void EverQuest::LoginProcessServerPlayResponse(const EQ::Net::Packet &p)
{
auto allowed = p.GetUInt8(12);
if (allowed) {
auto server = p.GetUInt32(18);
auto ws = m_world_servers.find(server);
if (ws != m_world_servers.end()) {
ConnectToWorld();
LoginDisableReconnect();
}
}
else {
auto message = p.GetUInt16(13);
Log.OutF(Logs::General, Logs::Headless_Client, "Failed to login to server with message {0}");
LoginDisableReconnect();
}
}
void EverQuest::LoginDisableReconnect()
{
m_login_connection_manager->OnConnectionStateChange(std::bind(&EverQuest::LoginOnStatusChangeReconnectDisabled, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
m_login_connection->Close();
}
void EverQuest::ConnectToWorld()
{
m_world_connection_manager.reset(new EQ::Net::DaybreakConnectionManager());
m_world_connection_manager->OnNewConnection(std::bind(&EverQuest::WorldOnNewConnection, this, std::placeholders::_1));
m_world_connection_manager->OnConnectionStateChange(std::bind(&EverQuest::WorldOnStatusChangeReconnectEnabled, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
m_world_connection_manager->OnPacketRecv(std::bind(&EverQuest::WorldOnPacketRecv, this, std::placeholders::_1, std::placeholders::_2));
m_world_connection_manager->Connect(m_host, 9000);
}
void EverQuest::WorldOnNewConnection(std::shared_ptr<EQ::Net::DaybreakConnection> connection)
{
m_world_connection = connection;
Log.OutF(Logs::General, Logs::Headless_Client, "Connecting to world...");
}
void EverQuest::WorldOnStatusChangeReconnectEnabled(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
{
if (to == EQ::Net::StatusConnected) {
Log.OutF(Logs::General, Logs::Headless_Client, "World connected.");
WorldSendClientAuth();
}
if (to == EQ::Net::StatusDisconnected) {
Log.OutF(Logs::General, Logs::Headless_Client, "World connection lost, reconnecting.");
m_world_connection.reset();
m_world_connection_manager->Connect(m_host, 9000);
}
}
void EverQuest::WorldOnStatusChangeReconnectDisabled(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
{
if (to == EQ::Net::StatusDisconnected) {
m_world_connection.reset();
}
}
void EverQuest::WorldOnPacketRecv(std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet & p)
{
auto opcode = p.GetUInt16(0);
switch (opcode) {
case 0x00d2:
WorldProcessCharacterSelect(p);
break;
default:
Log.OutF(Logs::General, Logs::Headless_Client, "Unhandled opcode: {0:#x}", opcode);
break;
}
}
void EverQuest::WorldSendClientAuth()
{
EQ::Net::DynamicPacket p;
p.Resize(2 + 464);
p.PutUInt16(0, 0x7a09U);
std::string dbid_str = std::to_string(m_dbid);
p.PutCString(2, dbid_str.c_str());
p.PutCString(2 + dbid_str.length() + 1, m_key.c_str());
m_world_connection->QueuePacket(p);
}
void EverQuest::WorldSendEnterWorld(const std::string &character)
{
EQ::Net::DynamicPacket p;
p.PutUInt16(0, 0x578f);
p.PutString(2, character);
p.PutUInt32(66, 0);
p.PutUInt32(70, 0);
m_world_connection->QueuePacket(p);
}
void EverQuest::WorldProcessCharacterSelect(const EQ::Net::Packet &p)
{
auto char_count = p.GetUInt32(2);
size_t idx = 6;
//Log.OutF(Logs::General, Logs::Headless_Client, "{0} characters", char_count);
for (uint32_t i = 0; i < char_count; ++i) {
auto name = p.GetCString(idx);
idx += name.length() + 1;
auto pclass = p.GetUInt8(idx);
auto prace = p.GetUInt32(idx + 1);
auto plevel = p.GetUInt8(idx + 5);
idx += 274;
if (m_character.compare(name) == 0) {
Log.OutF(Logs::General, Logs::Headless_Client, "Found {0}, would attempt to login here.", m_character);
WorldSendEnterWorld(m_character);
return;
}
}
Log.OutF(Logs::General, Logs::Headless_Client, "Could not find {0}, cannot continue to login.", m_character);
}
-74
View File
@@ -1,74 +0,0 @@
#pragma once
#include "../common/eqemu_logsys.h"
#include "../common/net/daybreak_connection.h"
#include "../common/event/timer.h"
#include <openssl/des.h>
#include <string>
#include <map>
struct WorldServer
{
std::string long_name;
std::string address;
int type;
std::string lang;
std::string region;
int status;
int players;
};
class EverQuest
{
public:
EverQuest(const std::string &host, int port, const std::string &user, const std::string &pass, const std::string &server, const std::string &character);
~EverQuest();
private:
//Login
void LoginOnNewConnection(std::shared_ptr<EQ::Net::DaybreakConnection> connection);
void LoginOnStatusChangeReconnectEnabled(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
void LoginOnStatusChangeReconnectDisabled(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
void LoginOnPacketRecv(std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet &p);
void LoginSendSessionReady();
void LoginSendLogin();
void LoginSendServerRequest();
void LoginSendPlayRequest(uint32_t id);
void LoginProcessLoginResponse(const EQ::Net::Packet &p);
void LoginProcessServerPacketList(const EQ::Net::Packet &p);
void LoginProcessServerPlayResponse(const EQ::Net::Packet &p);
void LoginDisableReconnect();
std::unique_ptr<EQ::Net::DaybreakConnectionManager> m_login_connection_manager;
std::shared_ptr<EQ::Net::DaybreakConnection> m_login_connection;
std::map<uint32_t, WorldServer> m_world_servers;
//World
void ConnectToWorld();
void WorldOnNewConnection(std::shared_ptr<EQ::Net::DaybreakConnection> connection);
void WorldOnStatusChangeReconnectEnabled(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
void WorldOnStatusChangeReconnectDisabled(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
void WorldOnPacketRecv(std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet &p);
void WorldSendClientAuth();
void WorldSendEnterWorld(const std::string &character);
void WorldProcessCharacterSelect(const EQ::Net::Packet &p);
std::unique_ptr<EQ::Net::DaybreakConnectionManager> m_world_connection_manager;
std::shared_ptr<EQ::Net::DaybreakConnection> m_world_connection;
//Variables
std::string m_host;
int m_port;
std::string m_user;
std::string m_pass;
std::string m_server;
std::string m_character;
std::string m_key;
uint32_t m_dbid;
};
-255
View File
@@ -1,255 +0,0 @@
/*#include "login.h"
#include "../common/eqemu_logsys.h"
#include <openssl/des.h>
const char* eqcrypt_block(const char *buffer_in, size_t buffer_in_sz, char* buffer_out, bool enc) {
DES_key_schedule k;
DES_cblock v;
memset(&k, 0, sizeof(DES_key_schedule));
memset(&v, 0, sizeof(DES_cblock));
if (!enc && buffer_in_sz && buffer_in_sz % 8 != 0) {
return nullptr;
}
DES_ncbc_encrypt((const unsigned char*)buffer_in, (unsigned char*)buffer_out, (long)buffer_in_sz, &k, &v, enc);
return buffer_out;
}
LoginConnection::LoginConnection(const std::string &username, const std::string &password, const std::string &host, int host_port, const std::string &server)
{
m_connecting = false;
m_username = username;
m_password = password;
m_host = host;
m_host_port = host_port;
m_server = server;
m_connection_manager.reset(new EQ::Net::DaybreakConnectionManager());
m_connection_manager->OnNewConnection(std::bind(&LoginConnection::OnNewConnection, this, std::placeholders::_1));
m_connection_manager->OnConnectionStateChange(std::bind(&LoginConnection::OnStatusChangeActive, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
m_connection_manager->OnPacketRecv(std::bind(&LoginConnection::OnPacketRecv, this, std::placeholders::_1, std::placeholders::_2));
m_connection_manager->Connect(host, host_port);
}
LoginConnection::~LoginConnection()
{
}
void LoginConnection::OnNewConnection(std::shared_ptr<EQ::Net::DaybreakConnection> connection)
{
m_connection = connection;
Log.OutF(Logs::General, Logs::Headless_Client, "Connecting...");
}
void LoginConnection::OnStatusChangeActive(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
{
if (to == EQ::Net::StatusConnected) {
Log.OutF(Logs::General, Logs::Headless_Client, "Login connected.");
SendSessionReady();
}
if (to == EQ::Net::StatusDisconnected) {
Log.OutF(Logs::General, Logs::Headless_Client, "Login connection lost, reconnecting.");
m_key.clear();
m_dbid = 0;
m_connection.reset();
m_connection_manager->Connect(m_host, m_host_port);
}
}
void LoginConnection::OnStatusChangeInactive(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
{
if (to == EQ::Net::StatusDisconnected) {
m_key.clear();
m_dbid = 0;
m_connection.reset();
}
}
void LoginConnection::OnPacketRecv(std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet &p)
{
auto opcode = p.GetUInt16(0);
switch (opcode) {
case 0x0017: //OP_ChatMessage
SendLogin();
break;
case 0x0018:
ProcessLoginResponse(p);
break;
case 0x0019:
ProcessServerPacketList(p);
break;
case 0x0022:
ProcessServerPlayResponse(p);
break;
}
}
void LoginConnection::Kill()
{
m_connection_manager->OnConnectionStateChange(std::bind(&LoginConnection::OnStatusChangeInactive, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
m_key.clear();
m_dbid = 0;
m_connection->Close();
}
void LoginConnection::Start()
{
m_connection_manager->OnConnectionStateChange(std::bind(&LoginConnection::OnStatusChangeActive, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
m_connection_manager->Connect(m_host, m_host_port);
}
void LoginConnection::SendSessionReady()
{
EQ::Net::DynamicPacket p;
p.PutUInt16(0, 1); //OP_SessionReady
p.PutUInt32(2, 2);
m_connection->QueuePacket(p);
}
void LoginConnection::SendLogin()
{
size_t buffer_len = m_username.length() + m_password.length() + 2;
std::unique_ptr<char[]> buffer(new char[buffer_len]);
strcpy(&buffer[0], m_username.c_str());
strcpy(&buffer[m_username.length() + 1], m_password.c_str());
size_t encrypted_len = buffer_len;
if (encrypted_len % 8 > 0) {
encrypted_len = ((encrypted_len / 8) + 1) * 8;
}
EQ::Net::DynamicPacket p;
p.Resize(12 + encrypted_len);
p.PutUInt16(0, 2); //OP_Login
p.PutUInt32(2, 3);
eqcrypt_block(&buffer[0], buffer_len, (char*)p.Data() + 12, true);
m_connection->QueuePacket(p);
}
void LoginConnection::SendServerRequest()
{
EQ::Net::DynamicPacket p;
p.PutUInt16(0, 4); //OP_ServerListRequest
p.PutUInt32(2, 4);
m_connection->QueuePacket(p);
}
void LoginConnection::SendPlayRequest(uint32_t id)
{
EQ::Net::DynamicPacket p;
p.PutUInt16(0, 0x000d);
p.PutUInt16(2, 5);
p.PutUInt32(4, 0);
p.PutUInt32(8, 0);
p.PutUInt32(12, id);
m_connection->QueuePacket(p);
}
void LoginConnection::ProcessLoginResponse(const EQ::Net::Packet &p)
{
auto encrypt_size = p.Length() - 12;
if (encrypt_size % 8 > 0) {
encrypt_size = (encrypt_size / 8) * 8;
}
std::unique_ptr<char[]> decrypted(new char[encrypt_size]);
eqcrypt_block((char*)p.Data() + 12, encrypt_size, &decrypted[0], false);
EQ::Net::StaticPacket sp(&decrypted[0], encrypt_size);
auto response_error = sp.GetUInt16(1);
if (response_error > 101) {
Log.OutF(Logs::General, Logs::Headless_Client, "Error logging in response code: {0}", response_error);
Kill();
}
else {
m_key = sp.GetCString(12);
m_dbid = sp.GetUInt32(8);
Log.OutF(Logs::General, Logs::Headless_Client, "Logged in successfully with dbid {0} and key {1}", m_dbid, m_key);
SendServerRequest();
}
}
void LoginConnection::ProcessServerPacketList(const EQ::Net::Packet &p)
{
m_world_servers.clear();
auto number_of_servers = p.GetUInt32(18);
size_t idx = 22;
for (auto i = 0U; i < number_of_servers; ++i) {
WorldServer ws;
ws.address = p.GetCString(idx);
idx += (ws.address.length() + 1);
ws.type = p.GetInt32(idx);
idx += 4;
auto id = p.GetUInt32(idx);
idx += 4;
ws.long_name = p.GetCString(idx);
idx += (ws.long_name.length() + 1);
ws.lang = p.GetCString(idx);
idx += (ws.lang.length() + 1);
ws.region = p.GetCString(idx);
idx += (ws.region.length() + 1);
ws.status = p.GetInt32(idx);
idx += 4;
ws.players = p.GetInt32(idx);
idx += 4;
m_world_servers[id] = ws;
}
for (auto server : m_world_servers) {
if (server.second.long_name.compare(m_server) == 0) {
Log.OutF(Logs::General, Logs::Headless_Client, "Found world server {0}, attempting to login.", m_server);
SendPlayRequest(server.first);
return;
}
}
Log.OutF(Logs::General, Logs::Headless_Client, "Got response from login server but could not find world server {0} disconnecting.", m_server);
Kill();
}
void LoginConnection::ProcessServerPlayResponse(const EQ::Net::Packet &p)
{
auto allowed = p.GetUInt8(12);
if (allowed) {
auto server = p.GetUInt32(18);
auto ws = m_world_servers.find(server);
if (ws != m_world_servers.end()) {
if (m_on_can_login_world) {
m_on_can_login_world(ws->second, m_key, m_dbid);
}
Kill();
}
}
else {
auto message = p.GetUInt16(13);
Log.OutF(Logs::General, Logs::Headless_Client, "Failed to login to server with message {0}");
Kill();
}
}
*/
-56
View File
@@ -1,56 +0,0 @@
#pragma once
#include "../common/net/daybreak_connection.h"
#include "../common/event/timer.h"
#include <map>
struct WorldServer
{
std::string long_name;
std::string address;
int type;
std::string lang;
std::string region;
int status;
int players;
};
class LoginConnection
{
public:
LoginConnection(const std::string &username, const std::string &password, const std::string &host, int host_port, const std::string &server);
void OnCanLoginToWorld(std::function<void(const WorldServer&, const std::string&, uint32_t)> cb) { m_on_can_login_world = cb; }
~LoginConnection();
private:
void OnNewConnection(std::shared_ptr<EQ::Net::DaybreakConnection> connection);
void OnStatusChangeActive(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
void OnStatusChangeInactive(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
void OnPacketRecv(std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet &p);
void Kill();
void Start();
void SendSessionReady();
void SendLogin();
void SendServerRequest();
void SendPlayRequest(uint32_t id);
void ProcessLoginResponse(const EQ::Net::Packet &p);
void ProcessServerPacketList(const EQ::Net::Packet &p);
void ProcessServerPlayResponse(const EQ::Net::Packet &p);
std::unique_ptr<EQ::Net::DaybreakConnectionManager> m_connection_manager;
std::shared_ptr<EQ::Net::DaybreakConnection> m_connection;
bool m_connecting;
std::unique_ptr<EQ::Timer> m_connect_timer;
std::string m_username;
std::string m_password;
std::string m_host;
int m_host_port;
std::string m_server;
std::string m_key;
uint32_t m_dbid;
std::map<uint32_t, WorldServer> m_world_servers;
std::function<void(const WorldServer&, const std::string&, uint32_t)> m_on_can_login_world;
};
-51
View File
@@ -1,51 +0,0 @@
#include "../common/event/event_loop.h"
#include "../common/eqemu_logsys.h"
#include "../common/crash.h"
#include "../common/platform.h"
#include "../common/json_config.h"
#include <thread>
#include "eq.h"
EQEmuLogSys Log;
int main() {
RegisterExecutablePlatform(ExePlatformHC);
Log.LoadLogSettingsDefaults();
set_exception_handler();
Log.OutF(Logs::General, Logs::Headless_Client, "Starting EQEmu Headless Client.");
auto config = EQ::JsonConfigFile::Load("hc.json");
auto config_handle = config.RawHandle();
std::vector<std::unique_ptr<EverQuest>> eq_list;
try {
for (int i = 0; i < config_handle.size(); ++i) {
auto c = config_handle[i];
auto host = c["host"].asString();
auto port = c["port"].asInt();
auto user = c["user"].asString();
auto pass = c["pass"].asString();
auto server = c["server"].asString();
auto character = c["character"].asString();
Log.OutF(Logs::General, Logs::Headless_Client, "Connecting to {0}:{1} as Account '{2}' to Server '{3}' under Character '{4}'", host, port, user, server, character);
eq_list.push_back(std::unique_ptr<EverQuest>(new EverQuest(host, port, user, pass, server, character)));
}
}
catch (std::exception &ex) {
Log.OutF(Logs::General, Logs::Headless_Client, "Error parsing config file: {0}", ex.what());
return 0;
}
for (;;) {
EQ::EventLoop::Get().Process();
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
return 0;
}
-78
View File
@@ -1,78 +0,0 @@
#include "world.h"
#include "../common/eqemu_logsys.h"
WorldConnection::WorldConnection(const std::string &key, uint32_t dbid, const std::string &host)
{
m_connecting = false;
m_host = host;
m_key = key;
m_dbid = dbid;
m_connection_manager.reset(new EQ::Net::DaybreakConnectionManager());
m_connection_manager->OnNewConnection(std::bind(&WorldConnection::OnNewConnection, this, std::placeholders::_1));
m_connection_manager->OnConnectionStateChange(std::bind(&WorldConnection::OnStatusChangeActive, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
m_connection_manager->OnPacketRecv(std::bind(&WorldConnection::OnPacketRecv, this, std::placeholders::_1, std::placeholders::_2));
m_connection_manager->Connect(host, 9000);
}
WorldConnection::~WorldConnection() {
}
void WorldConnection::OnNewConnection(std::shared_ptr<EQ::Net::DaybreakConnection> connection)
{
m_connection = connection;
Log.OutF(Logs::General, Logs::Headless_Client, "Connecting to world...");
}
void WorldConnection::OnStatusChangeActive(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
{
if (to == EQ::Net::StatusConnected) {
Log.OutF(Logs::General, Logs::Headless_Client, "World connected.");
SendClientAuth();
}
if (to == EQ::Net::StatusDisconnected) {
Log.OutF(Logs::General, Logs::Headless_Client, "World connection lost, reconnecting.");
m_connection.reset();
m_connection_manager->Connect(m_host, 9000);
}
}
void WorldConnection::OnStatusChangeInactive(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
{
if (to == EQ::Net::StatusDisconnected) {
m_connection.reset();
}
}
void WorldConnection::OnPacketRecv(std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet &p)
{
auto opcode = p.GetUInt16(0);
Log.OutF(Logs::General, Logs::Headless_Client, "Packet in:\n{0}", p.ToString());
}
void WorldConnection::Kill()
{
m_connection_manager->OnConnectionStateChange(std::bind(&WorldConnection::OnStatusChangeInactive, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
m_connection->Close();
}
void WorldConnection::Start()
{
m_connection_manager->OnConnectionStateChange(std::bind(&WorldConnection::OnStatusChangeActive, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
m_connection_manager->Connect(m_host, 9000);
}
void WorldConnection::SendClientAuth()
{
EQ::Net::DynamicPacket p;
p.Resize(2 + 464);
p.PutUInt16(0, 0x7a09U);
std::string dbid_str = std::to_string(m_dbid);
p.PutCString(2, dbid_str.c_str());
p.PutCString(2 + dbid_str.length() + 1, m_key.c_str());
m_connection->QueuePacket(p);
}
-31
View File
@@ -1,31 +0,0 @@
#pragma once
#include "../common/net/daybreak_connection.h"
#include "../common/event/timer.h"
#include <map>
class WorldConnection
{
public:
WorldConnection(const std::string &key, uint32_t dbid, const std::string &host);
~WorldConnection();
private:
void OnNewConnection(std::shared_ptr<EQ::Net::DaybreakConnection> connection);
void OnStatusChangeActive(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
void OnStatusChangeInactive(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
void OnPacketRecv(std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet &p);
void Kill();
void Start();
void SendClientAuth();
std::unique_ptr<EQ::Net::DaybreakConnectionManager> m_connection_manager;
std::shared_ptr<EQ::Net::DaybreakConnection> m_connection;
bool m_connecting;
std::unique_ptr<EQ::Timer> m_connect_timer;
std::string m_host;
std::string m_key;
uint32_t m_dbid;
};
View File
View File
+6 -6
View File
@@ -1,7 +1,7 @@
IF(EQEMU_BUILD_LUA) if(EQEMU_BUILD_LUA)
ADD_SUBDIRECTORY(luabind) add_subdirectory(luabind)
ENDIF(EQEMU_BUILD_LUA) endif()
IF(EQEMU_BUILD_PERL) if(EQEMU_BUILD_PERL)
ADD_SUBDIRECTORY(perlbind) add_subdirectory(perlbind)
ENDIF(EQEMU_BUILD_PERL) endif()
+10 -10
View File
@@ -1,6 +1,6 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.12) cmake_minimum_required(VERSION 3.20.0)
SET(lb_sources set(lb_sources
src/class.cpp src/class.cpp
src/class_info.cpp src/class_info.cpp
src/class_registry.cpp src/class_registry.cpp
@@ -20,19 +20,19 @@ SET(lb_sources
src/wrapper_base.cpp src/wrapper_base.cpp
) )
SET(lb_headers set(lb_headers
) )
ADD_LIBRARY(luabind ${lb_sources} ${lb_headers}) add_library(luabind ${lb_sources} ${lb_headers})
target_link_libraries(luabind PRIVATE Boost::dynamic_bitset Boost::tuple Boost::foreach ${LUAJIT_LIBRARY})
if(UNIX)
IF(UNIX)
set_source_files_properties(${lb_sources} PROPERTY COMPILE_FLAGS -Wno-deprecated-declarations) set_source_files_properties(${lb_sources} PROPERTY COMPILE_FLAGS -Wno-deprecated-declarations)
ENDIF(UNIX) endif()
IF(MSVC) if(MSVC)
set_source_files_properties(${lb_sources} PROPERTY COMPILE_FLAGS " /W0 " ) set_source_files_properties(${lb_sources} PROPERTY COMPILE_FLAGS " /W0 " )
ENDIF(MSVC) endif()
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
+1 -1
View File
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.7) cmake_minimum_required(VERSION 3.20.0)
project(perlbind LANGUAGES CXX) project(perlbind LANGUAGES CXX)
-4
View File
@@ -1,4 +0,0 @@
* text=auto
*.c text
*.h text
Makefile text
-39
View File
@@ -1,39 +0,0 @@
name: CI Static Analysis
on: [push, pull_request]
jobs:
GCC-10:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install packages (Ubuntu)
run: |
sudo add-apt-repository ppa:ubuntu-toolchain-r/test -y
sudo apt-get update
sudo apt-get install -y gcc-10
- name: Generate project files
run: |
cmake . -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DWITH_FUZZERS=OFF -DWITH_CODE_COVERAGE=OFF -DWITH_MAINTAINER_WARNINGS=OFF
env:
CC: gcc-10
CFLAGS: "-fanalyzer -Werror -Wanalyzer-double-fclose -Wanalyzer-double-free -Wanalyzer-exposure-through-output-file -Wanalyzer-file-leak -Wanalyzer-free-of-non-heap -Wanalyzer-malloc-leak -Wanalyzer-null-argument -Wanalyzer-null-dereference -Wanalyzer-possible-null-argument -Wanalyzer-possible-null-dereference -Wanalyzer-stale-setjmp-buffer -Wanalyzer-tainted-array-index -Wanalyzer-unsafe-call-within-signal-handler -Wanalyzer-use-after-free -Wanalyzer-use-of-pointer-in-stale-stack-frame"
CI: true
- name: Compile source code
run: |
cmake --build . --config Release > /dev/null
Clang-12:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- name: Install packages (Ubuntu)
run: |
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key|sudo apt-key add -
sudo apt-add-repository "deb http://apt.llvm.org/bionic/ llvm-toolchain-bionic main" -y
sudo apt install clang-tools-12 -y
- name: Generate project files
run: |
scan-build-12 --status-bugs cmake . -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DWITH_FUZZERS=OFF -DWITH_CODE_COVERAGE=OFF -DWITH_MAINTAINER_WARNINGS=OFF
env:
CI: true
- name: Compile source code
run: |
scan-build-12 --status-bugs cmake --build . --config Release > /dev/null
-381
View File
@@ -1,381 +0,0 @@
name: CI CMake
on: [push, pull_request]
jobs:
ci-cmake:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: Ubuntu GCC
os: ubuntu-latest
compiler: gcc
cmake-args: -DWITH_SANITIZER=Address
codecov: ubuntu_gcc
- name: Ubuntu GCC OSB -O1 No Unaligned64
os: ubuntu-latest
compiler: gcc
cmake-args: -DWITH_UNALIGNED=ON -DUNALIGNED64_OK=OFF -DWITH_SANITIZER=Undefined
build-dir: ../build
build-src-dir: ../zlib-ng
codecov: ubuntu_gcc_osb
cflags: -O1 -g3
- name: Ubuntu GCC -O3 No Unaligned
os: ubuntu-latest
compiler: gcc
cmake-args: -DWITH_UNALIGNED=OFF
codecov: ubuntu_gcc_o3
cflags: -O3
- name: Ubuntu GCC Link Zlib
os: ubuntu-latest
compiler: gcc
cmake-args: -DZLIB_DUAL_LINK=ON
- name: Ubuntu GCC No AVX2
os: ubuntu-latest
compiler: gcc
cmake-args: -DWITH_AVX2=OFF -DWITH_SANITIZER=Undefined
codecov: ubuntu_gcc_no_avx2
- name: Ubuntu GCC No SSE2
os: ubuntu-latest
compiler: gcc
cmake-args: -DWITH_SSE2=OFF -DWITH_SANITIZER=Undefined
codecov: ubuntu_gcc_no_sse2
- name: Ubuntu GCC No SSE4
os: ubuntu-latest
compiler: gcc
cmake-args: -DWITH_SSE4=OFF -DWITH_SANITIZER=Undefined
codecov: ubuntu_gcc_no_sse4
- name: Ubuntu GCC No PCLMULQDQ
os: ubuntu-latest
compiler: gcc
cmake-args: -DWITH_PCLMULQDQ=OFF -DWITH_SANITIZER=Undefined
codecov: ubuntu_gcc_no_pclmulqdq
- name: Ubuntu GCC Compat No Opt
os: ubuntu-latest
compiler: gcc
cmake-args: -DZLIB_COMPAT=ON -DWITH_NEW_STRATEGIES=OFF -DWITH_OPTIM=OFF -DWITH_SANITIZER=Address
codecov: ubuntu_gcc_compat_no_opt
cflags: -DNOT_TWEAK_COMPILER
- name: Ubuntu GCC ARM SF
os: ubuntu-latest
compiler: arm-linux-gnueabi-gcc
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabi -DWITH_SANITIZER=Address
packages: qemu gcc-arm-linux-gnueabi libc-dev-armel-cross
codecov: ubuntu_gcc_armsf
- name: Ubuntu GCC ARM SF Compat No Opt
os: ubuntu-latest
compiler: arm-linux-gnueabi-gcc
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabi -DZLIB_COMPAT=ON -DWITH_NEW_STRATEGIES=OFF -DWITH_OPTIM=OFF -DWITH_SANITIZER=Undefined
packages: qemu gcc-arm-linux-gnueabi libc-dev-armel-cross
codecov: ubuntu_gcc_armsf_compat_no_opt
- name: Ubuntu GCC ARM HF
os: ubuntu-latest
compiler: arm-linux-gnueabihf-gcc
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabihf -DWITH_SANITIZER=Address
packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross
codecov: ubuntu_gcc_armhf
- name: Ubuntu GCC ARM HF No ACLE
os: ubuntu-latest
compiler: arm-linux-gnueabihf-gcc
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabihf -DWITH_ACLE=OFF -DWITH_SANITIZER=Address
packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross
codecov: ubuntu_gcc_armhf_no_acle
- name: Ubuntu GCC ARM HF No NEON
os: ubuntu-latest
compiler: arm-linux-gnueabihf-gcc
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabihf -DWITH_NEON=OFF -DWITH_SANITIZER=Address
packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross
codecov: ubuntu_gcc_armhf_no_neon
- name: Ubuntu GCC ARM HF Compat No Opt
os: ubuntu-latest
compiler: arm-linux-gnueabihf-gcc
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabihf -DZLIB_COMPAT=ON -DWITH_NEW_STRATEGIES=OFF -DWITH_OPTIM=OFF -DWITH_SANITIZER=Undefined
packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross
codecov: ubuntu_gcc_armhf_compat_no_opt
- name: Ubuntu GCC AARCH64
os: ubuntu-latest
compiler: aarch64-linux-gnu-gcc
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-aarch64.cmake -DWITH_SANITIZER=Address
asan-options: detect_leaks=0
packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross
codecov: ubuntu_gcc_aarch64
- name: Ubuntu GCC AARCH64 No ACLE
os: ubuntu-latest
compiler: aarch64-linux-gnu-gcc
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-aarch64.cmake -DWITH_ACLE=OFF -DWITH_SANITIZER=Undefined
asan-options: detect_leaks=0
packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross
codecov: ubuntu_gcc_aarch64_no_acle
- name: Ubuntu GCC AARCH64 No NEON
os: ubuntu-latest
compiler: aarch64-linux-gnu-gcc
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-aarch64.cmake -DWITH_NEON=OFF -DWITH_SANITIZER=Undefined
asan-options: detect_leaks=0
packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross
codecov: ubuntu_gcc_aarch64_no_neon
- name: Ubuntu GCC AARCH64 Compat No Opt
os: ubuntu-latest
compiler: aarch64-linux-gnu-gcc
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-aarch64.cmake -DZLIB_COMPAT=ON -DWITH_NEW_STRATEGIES=OFF -DWITH_OPTIM=OFF -DWITH_SANITIZER=Undefined
asan-options: detect_leaks=0
packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross
codecov: ubuntu_gcc_aarch64_compat_no_opt
- name: Ubuntu GCC PPC
os: ubuntu-latest
compiler: powerpc-linux-gnu-gcc
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-powerpc.cmake
packages: qemu gcc-powerpc-linux-gnu libc-dev-powerpc-cross
ldflags: -static
codecov: ubuntu_gcc_ppc
- name: Ubuntu GCC PPC64
os: ubuntu-latest
compiler: powerpc64-linux-gnu-gcc
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-powerpc64.cmake
packages: qemu gcc-powerpc64-linux-gnu libc-dev-ppc64-cross
ldflags: -static
codecov: ubuntu_gcc_ppc64
- name: Ubuntu GCC PPC64LE
os: ubuntu-latest
compiler: powerpc64le-linux-gnu-gcc
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-powerpc64le.cmake
packages: qemu gcc-powerpc64le-linux-gnu libc-dev-ppc64el-cross
codecov: ubuntu_gcc_ppc64le
- name: Ubuntu GCC SPARC64
os: ubuntu-latest
compiler: sparc64-linux-gnu-gcc
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-sparc64.cmake
packages: qemu gcc-sparc64-linux-gnu libc-dev-sparc64-cross
ldflags: -static
codecov: ubuntu_gcc_sparc64
- name: Ubuntu GCC S390X
os: ubuntu-latest
compiler: s390x-linux-gnu-gcc
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-s390x.cmake -DWITH_SANITIZER=Address
packages: qemu gcc-s390x-linux-gnu libc-dev-s390x-cross
ldflags: -static
codecov: ubuntu_gcc_s390x
- name: Ubuntu GCC S390X DFLTCC
os: ubuntu-latest
compiler: s390x-linux-gnu-gcc
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-s390x.cmake -DWITH_DFLTCC_DEFLATE=ON -DWITH_DFLTCC_INFLATE=ON -DWITH_SANITIZER=Address
packages: qemu gcc-s390x-linux-gnu libc-dev-s390x-cross
ldflags: -static
codecov: ubuntu_gcc_s390x
- name: Ubuntu GCC S390X DFLTCC Compat
os: ubuntu-latest
compiler: s390x-linux-gnu-gcc
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-s390x.cmake -DZLIB_COMPAT=ON -DWITH_DFLTCC_DEFLATE=ON -DWITH_DFLTCC_INFLATE=ON -DWITH_SANITIZER=Undefined
packages: qemu gcc-s390x-linux-gnu libc-dev-s390x-cross
ldflags: -static
codecov: ubuntu_gcc_s390x
- name: Ubuntu MinGW i686
os: ubuntu-latest
compiler: i686-w64-mingw32-gcc
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-mingw-i686.cmake
packages: wine32 gcc-mingw-w64
# Codecov disabled due to gcov locking issue error
- name: Ubuntu MinGW x86_64
os: ubuntu-latest
compiler: x86_64-w64-mingw32-gcc
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-mingw-x86_64.cmake
packages: wine-stable gcc-mingw-w64
codecov: ubuntu_gcc_mingw_x86_64
- name: Ubuntu Clang
os: ubuntu-latest
compiler: clang
packages: llvm-6.0
gcov-exec: llvm-cov-6.0 gcov
codecov: ubuntu_clang
- name: Ubuntu Clang Inflate Strict
os: ubuntu-latest
compiler: clang
cmake-args: -DWITH_INFLATE_STRICT=ON
packages: llvm-6.0
gcov-exec: llvm-cov-6.0 gcov
codecov: ubuntu_clang_inflate_strict
- name: Ubuntu Clang Inflate Allow Invalid Dist
os: ubuntu-latest
compiler: clang
cmake-args: -DWITH_INFLATE_ALLOW_INVALID_DIST=ON
packages: llvm-6.0
gcov-exec: llvm-cov-6.0 gcov
codecov: ubuntu_clang_inflate_allow_invalid_dist
- name: Ubuntu Clang Memory Map
os: ubuntu-latest
compiler: clang
cflags: -DUSE_MMAP
packages: llvm-6.0
gcov-exec: llvm-cov-6.0 gcov
codecov: ubuntu_clang_mmap
- name: Ubuntu Clang Debug
os: ubuntu-latest
compiler: clang
packages: llvm-6.0
gcov-exec: llvm-cov-6.0 gcov
codecov: ubuntu_clang_debug
build-config: Debug
- name: Ubuntu Clang MSAN
os: ubuntu-latest
compiler: clang
cmake-args: -GNinja -DWITH_SANITIZER=Memory
packages: ninja-build llvm-6.0
gcov-exec: llvm-cov-6.0 gcov
cflags: -g3 -fno-omit-frame-pointer -fno-optimize-sibling-calls -fsanitize-memory-track-origins
codecov: ubuntu_clang_msan
- name: Windows MSVC Win32
os: windows-latest
compiler: cl
cmake-args: -A Win32
- name: Windows MSVC Win64
os: windows-latest
compiler: cl
cmake-args: -A x64
- name: Windows MSVC ARM No Test
os: windows-latest
compiler: cl
cmake-args: -A ARM
- name: Windows MSVC ARM64 No Test
os: windows-latest
compiler: cl
cmake-args: -A ARM64
- name: Windows GCC
os: windows-latest
compiler: gcc
cmake-args: -G Ninja
codecov: win64_gcc
- name: Windows GCC Compat No Opt
os: windows-latest
compiler: gcc
cmake-args: -G Ninja -DZLIB_COMPAT=ON -DWITH_NEW_STRATEGIES=OFF -DWITH_OPTIM=OFF
codecov: win64_gcc_compat_no_opt
- name: macOS Clang
os: macos-latest
compiler: clang
cmake-args: -DWITH_SANITIZER=Address
codecov: macos_clang
- name: macOS GCC
os: macos-latest
compiler: gcc-10
cmake-args: -DWITH_SANITIZER=Undefined
packages: gcc@10
gcov-exec: gcov-10
codecov: macos_gcc
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout test corpora
uses: actions/checkout@v2
with:
repository: nmoinvaz/corpora
path: test/data/corpora
- name: Install packages (Ubuntu)
if: runner.os == 'Linux' && matrix.packages
run: |
sudo dpkg --add-architecture i386 # Required for wine32
sudo apt-get update
sudo apt-get install -y ${{ matrix.packages }}
- name: Install packages (Windows)
if: runner.os == 'Windows'
run: |
choco install ninja ${{ matrix.packages }} --no-progress
- name: Install packages (macOS)
if: runner.os == 'macOS'
run: |
brew install ninja ${{ matrix.packages }}
env:
HOMEBREW_NO_INSTALL_CLEANUP: 1
- name: Install codecov.io tools
if: matrix.codecov
run: |
python -u -m pip install codecov
- name: Generate project files
# Shared libaries turned off for qemu ppc* and sparc & reduce code coverage sources
run: |
mkdir ${{ matrix.build-dir || '.not-used' }}
cd ${{ matrix.build-dir || '.' }}
cmake ${{ matrix.build-src-dir || '.' }} ${{ matrix.cmake-args }} -DCMAKE_BUILD_TYPE=${{ matrix.build-config || 'Release' }} -DBUILD_SHARED_LIBS=OFF -DWITH_FUZZERS=ON -DWITH_CODE_COVERAGE=ON -DWITH_MAINTAINER_WARNINGS=ON
env:
CC: ${{ matrix.compiler }}
CFLAGS: ${{ matrix.cflags }}
LDFLAGS: ${{ matrix.ldflags }}
CI: true
- name: Compile source code
run: |
cd ${{ matrix.build-dir || '.' }}
cmake --build . --config ${{ matrix.build-config || 'Release' }}
- name: Run test cases
# Don't run tests on Windows ARM
if: runner.os != 'Windows' || contains(matrix.name, 'ARM') == false
run: |
cd ${{ matrix.build-dir || '.' }}
ctest --verbose -C Release --output-on-failure --max-width 120 -j 6
env:
ASAN_OPTIONS: ${{ matrix.asan-options || 'verbosity=0' }}:abort_on_error=1
MSAN_OPTIONS: ${{ matrix.msan-options || 'verbosity=0' }}:abort_on_error=1
TSAN_OPTIONS: ${{ matrix.tsan-options || 'verbosity=0' }}:abort_on_error=1
LSAN_OPTIONS: ${{ matrix.lsan-options || 'verbosity=0' }}:abort_on_error=1
- name: Upload coverage report
if: matrix.codecov && ( env.CODECOV_TOKEN_SECRET != '' || github.repository == 'zlib-ng/zlib-ng' )
shell: bash
run: |
bash tools/codecov-upload.sh
env:
# Codecov does not yet support GitHub Actions
CODECOV_TOKEN_SECRET: "${{secrets.CODECOV_TOKEN}}"
CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN || 'e4fdf847-f541-4ab1-9d50-3d27e5913906' }}"
CODECOV_FLAGS: "${{ matrix.codecov }}"
CODECOV_NAME: "${{ matrix.name }}"
CODECOV_EXEC: "${{ matrix.gcov-exec || 'gcov' }}"
CODECOV_DIR: "${{ matrix.build-dir || '.' }}"
-185
View File
@@ -1,185 +0,0 @@
name: CI Configure
on: [push, pull_request]
jobs:
ci-configure:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: Ubuntu GCC
os: ubuntu-latest
compiler: gcc
configure-args: --warn
- name: Ubuntu GCC OSB
os: ubuntu-latest
compiler: gcc
configure-args: --warn
build-dir: ../build
build-src-dir: ../zlib-ng
- name: Ubuntu GCC Compat No Opt
os: ubuntu-latest
compiler: gcc
configure-args: --warn --zlib-compat --without-optimizations --without-new-strategies
- name: Ubuntu GCC ARM SF
os: ubuntu-latest
compiler: arm-linux-gnueabi-gcc
configure-args: --warn
chost: arm-linux-gnueabi
packages: qemu gcc-arm-linux-gnueabi libc-dev-armel-cross
- name: Ubuntu GCC ARM SF Compat No Opt
os: ubuntu-latest
compiler: arm-linux-gnueabi-gcc
configure-args: --warn --zlib-compat --without-optimizations --without-new-strategies
chost: arm-linux-gnueabi
packages: qemu gcc-arm-linux-gnueabi libc-dev-armel-cross
- name: Ubuntu GCC ARM HF
os: ubuntu-latest
compiler: arm-linux-gnueabihf-gcc
configure-args: --warn
chost: arm-linux-gnueabihf
packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross
- name: Ubuntu GCC ARM HF No ACLE
os: ubuntu-latest
compiler: arm-linux-gnueabihf-gcc
configure-args: --warn --without-acle
chost: arm-linux-gnueabihf
packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross
- name: Ubuntu GCC ARM HF No NEON
os: ubuntu-latest
compiler: arm-linux-gnueabihf-gcc
configure-args: --warn --without-neon
chost: arm-linux-gnueabihf
packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross
- name: Ubuntu GCC ARM HF Compat No Opt
os: ubuntu-latest
compiler: arm-linux-gnueabihf-gcc
configure-args: --warn --zlib-compat --without-optimizations --without-new-strategies
chost: arm-linux-gnueabihf
packages: qemu gcc-arm-linux-gnueabihf libc-dev-armel-cross
- name: Ubuntu GCC AARCH64
os: ubuntu-latest
compiler: aarch64-linux-gnu-gcc
configure-args: --warn
chost: aarch64-linux-gnu
packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross
- name: Ubuntu GCC AARCH64 No ACLE
os: ubuntu-latest
compiler: aarch64-linux-gnu-gcc
configure-args: --warn --without-acle
chost: aarch64-linux-gnu
packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross
- name: Ubuntu GCC AARCH64 No NEON
os: ubuntu-latest
compiler: aarch64-linux-gnu-gcc
configure-args: --warn --without-neon
chost: aarch64-linux-gnu
packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross
- name: Ubuntu GCC AARCH64 Compat No Opt
os: ubuntu-latest
compiler: aarch64-linux-gnu-gcc
configure-args: --warn --zlib-compat --without-optimizations --without-new-strategies
chost: aarch64-linux-gnu
packages: qemu gcc-aarch64-linux-gnu libc-dev-arm64-cross
- name: Ubuntu GCC PPC
os: ubuntu-latest
compiler: powerpc-linux-gnu-gcc
configure-args: --warn --static
chost: powerpc-linux-gnu
packages: qemu gcc-powerpc-linux-gnu libc-dev-powerpc-cross
cflags: -static
ldflags: -static
- name: Ubuntu GCC PPC64
os: ubuntu-latest
compiler: powerpc64-linux-gnu-gcc
configure-args: --warn --static
chost: powerpc-linux-gnu
packages: qemu gcc-powerpc64-linux-gnu libc-dev-ppc64-cross
cflags: -static
ldflags: -static
- name: Ubuntu GCC PPC64LE
os: ubuntu-latest
compiler: powerpc64le-linux-gnu-gcc
configure-args: --warn
chost: powerpc64le-linux-gnu
packages: qemu gcc-powerpc64le-linux-gnu libc-dev-ppc64el-cross
- name: Ubuntu GCC S390X
os: ubuntu-latest
compiler: s390x-linux-gnu-gcc
configure-args: --warn --static
chost: s390x-linux-gnu
packages: qemu gcc-s390x-linux-gnu libc-dev-s390x-cross
cflags: -static
ldflags: -static
- name: Ubuntu GCC S390X DFLTCC
os: ubuntu-latest
compiler: s390x-linux-gnu-gcc
configure-args: --warn --static --with-dfltcc-deflate --with-dfltcc-inflate
chost: s390x-linux-gnu
packages: qemu gcc-s390x-linux-gnu libc-dev-s390x-cross
cflags: -static
ldflags: -static
- name: Ubuntu GCC S390X DFLTCC Compat
os: ubuntu-latest
compiler: s390x-linux-gnu-gcc
configure-args: --warn --zlib-compat --static --with-dfltcc-deflate --with-dfltcc-inflate
chost: s390x-linux-gnu
packages: qemu gcc-s390x-linux-gnu libc-dev-s390x-cross
cflags: -static
ldflags: -static
- name: macOS GCC
os: macOS-latest
compiler: gcc
configure-args: --warn
steps:
- name: Checkout repository
uses: actions/checkout@v1
- name: Install packages (Ubuntu)
if: runner.os == 'Linux' && matrix.packages
run: |
sudo apt-get update
sudo apt-get install -y ${{ matrix.packages }}
- name: Generate project files
run: |
mkdir ${{ matrix.build-dir || '.not-used' }}
cd ${{ matrix.build-dir || '.' }}
${{ matrix.build-src-dir || '.' }}/configure ${{ matrix.configure-args }}
env:
CC: ${{ matrix.compiler }}
CFLAGS: ${{ matrix.cflags }}
LDFLAGS: ${{ matrix.ldflags }}
CHOST: ${{ matrix.chost }}
CI: true
- name: Compile source code
run: |
cd ${{ matrix.build-dir || '.' }}
make -j2
- name: Run test cases
run: |
cd ${{ matrix.build-dir || '.' }}
make test
-23
View File
@@ -1,23 +0,0 @@
name: CI Fuzz
on: [pull_request]
jobs:
Fuzzing:
runs-on: ubuntu-latest
steps:
- name: Build Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/build_fuzzers@master
with:
oss-fuzz-project-name: 'zlib-ng'
dry-run: false
- name: Run Fuzzers
uses: google/oss-fuzz/infra/cifuzz/actions/run_fuzzers@master
with:
oss-fuzz-project-name: 'zlib-ng'
fuzz-seconds: 600
dry-run: false
- name: Upload Crash
uses: actions/upload-artifact@v1
if: failure()
with:
name: artifacts
path: ./out/artifacts
-46
View File
@@ -1,46 +0,0 @@
name: CI Libpng
on: [pull_request]
jobs:
pngtest:
name: Ubuntu Clang
runs-on: ubuntu-latest
steps:
- name: Checkout repository (zlib-ng)
uses: actions/checkout@v1
- name: Generate project files (zlib-ng)
run: |
cmake . -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=OFF -DZLIB_COMPAT=ON -DZLIB_ENABLE_TESTS=OFF
env:
CC: clang
CFLAGS: -fPIC
CI: true
- name: Compile source code (zlib-ng)
run: |
cmake --build . --config Release
- name: Checkout repository (libpng)
uses: actions/checkout@v2
with:
repository: glennrp/libpng
path: libpng
- name: Generate project files (libpng)
run: |
cd libpng
cmake . -DCMAKE_BUILD_TYPE=Release -DPNG_TESTS=ON -DPNG_STATIC=OFF -DZLIB_INCLUDE_DIR=.. -DZLIB_LIBRARY=$PWD/../libz.a
env:
CC: clang
CI: true
- name: Compile source code (libpng)
run: |
cd libpng
cmake --build . --config Release
- name: Run test cases (libpng)
run: |
cd libpng
ctest -C Release --output-on-failure --max-width 120
-48
View File
@@ -1,48 +0,0 @@
name: CI NMake
on: [push, pull_request]
jobs:
ci-cmake:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: Windows NMake x86
os: windows-latest
makefile: win32/Makefile.msc
vc-vars: x86
- name: Windows NMake x64
os: windows-latest
makefile: win32/Makefile.msc
vc-vars: x86_amd64
- name: Windows NMake ARM No Test
os: windows-latest
makefile: win32/Makefile.arm
vc-vars: x86_arm
- name: Windows NMake ARM64 No Test
os: windows-latest
makefile: win32/Makefile.a64
vc-vars: x86_arm64
steps:
- name: Checkout repository
uses: actions/checkout@v1
- name: Compile source code
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.vc-vars }}
nmake -f ${{ matrix.makefile }}
- name: Run test cases
shell: cmd
# Don't run tests on Windows ARM
if: contains(matrix.vc-vars, 'arm') == false
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" ${{ matrix.vc-vars }}
nmake -f ${{ matrix.makefile }} test
nmake -f ${{ matrix.makefile }} testdll
-121
View File
@@ -1,121 +0,0 @@
name: CI Pkgcheck
on: [push, pull_request]
jobs:
ci-pkgcheck:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: Ubuntu GCC
os: ubuntu-latest
compiler: gcc
- name: Ubuntu GCC -m32
os: ubuntu-latest
compiler: gcc
packages: gcc-multilib
cmake-args: -DCMAKE_C_FLAGS=-m32
cflags: -m32
ldflags: -m32
- name: Ubuntu GCC ARM HF
os: ubuntu-latest
chost: arm-linux-gnueabihf
compiler: arm-linux-gnueabihf-gcc
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-arm.cmake -DCMAKE_C_COMPILER_TARGET=arm-linux-gnueabihf
packages: qemu gcc-arm-linux-gnueabihf libc6-dev-armhf-cross
- name: Ubuntu GCC AARCH64
os: ubuntu-latest
chost: aarch64-linux-gnu
compiler: aarch64-linux-gnu-gcc
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-aarch64.cmake
packages: qemu gcc-aarch64-linux-gnu libc6-dev-arm64-cross
- name: Ubuntu GCC PPC
os: ubuntu-latest
chost: powerpc-linux-gnu
compiler: powerpc-linux-gnu-gcc
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-powerpc.cmake
packages: qemu gcc-powerpc-linux-gnu libc6-dev-powerpc-cross
- name: Ubuntu GCC PPC64LE
os: ubuntu-latest
chost: powerpc64le-linux-gnu
compiler: powerpc64le-linux-gnu-gcc
cmake-args: -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-powerpc64le.cmake
packages: qemu gcc-powerpc64le-linux-gnu libc6-dev-ppc64el-cross
- name: macOS Clang
os: macOS-latest
compiler: clang
steps:
- name: Checkout repository
uses: actions/checkout@v1
- name: Install packages (Ubuntu)
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends abigail-tools ninja-build diffoscope ${{ matrix.packages }}
- name: Install packages (macOS)
if: runner.os == 'macOS'
run: |
brew install ninja diffoscope ${{ matrix.packages }}
env:
HOMEBREW_NO_INSTALL_CLEANUP: 1
- name: Select Xcode version (macOS)
# Use a version of Xcode that supports ZERO_AR_DATE until CMake supports
# AppleClang linking with libtool using -D argument
# https://gitlab.kitware.com/cmake/cmake/-/issues/19852
if: runner.os == 'macOS'
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: '12.1.1'
- name: Compare builds
run: |
sh test/pkgcheck.sh
env:
CC: ${{ matrix.compiler }}
CFLAGS: ${{ matrix.cflags }}
CHOST: ${{ matrix.chost }}
CMAKE_ARGS: ${{ matrix.cmake-args }}
LDFLAGS: ${{ matrix.ldflags }}
- name: Compare builds (compat)
run: |
sh test/pkgcheck.sh --zlib-compat
env:
CC: ${{ matrix.compiler }}
CFLAGS: ${{ matrix.cflags }}
CHOST: ${{ matrix.chost }}
CMAKE_ARGS: ${{ matrix.cmake-args }}
LDFLAGS: ${{ matrix.ldflags }}
- name: Check ABI
# macOS runner does not contain abigail
if: runner.os != 'macOS'
run: |
sh test/abicheck.sh --refresh_if
env:
CC: ${{ matrix.compiler }}
CFLAGS: ${{ matrix.cflags }}
CHOST: ${{ matrix.chost }}
LDFLAGS: ${{ matrix.ldflags }}
- name: Check ABI (compat)
# macOS runner does not contain abigail
if: runner.os != 'macOS'
run: |
sh test/abicheck.sh --zlib-compat --refresh_if
env:
CC: ${{ matrix.compiler }}
CFLAGS: ${{ matrix.cflags }}
CHOST: ${{ matrix.chost }}
LDFLAGS: ${{ matrix.ldflags }}
-73
View File
@@ -1,73 +0,0 @@
name: CI Release
on:
push:
tags:
- '*'
jobs:
ci-cmake:
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: Windows MSVC Win32
os: windows-latest
compiler: cl
cmake-args: -A Win32
deploy-name: win32
- name: Windows MSVC Win32 Compat
os: windows-latest
compiler: cl
cmake-args: -A Win32 -DZLIB_COMPAT=ON
deploy-name: win32-compat
- name: Windows MSVC Win64
os: windows-latest
compiler: cl
cmake-args: -A x64
deploy-name: win64
- name: Windows MSVC Win64 Compat
os: windows-latest
compiler: cl
cmake-args: -A x64 -DZLIB_COMPAT=ON
deploy-name: win64-compat
steps:
- name: Checkout repository
uses: actions/checkout@v1
- name: Set environment variables
shell: bash
run: echo "tag=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_ENV
- name: Generate project files
run: |
cmake . ${{ matrix.cmake-args }} -DCMAKE_BUILD_TYPE=Release -DZLIB_ENABLE_TESTS=ON -DCMAKE_INSTALL_PREFIX=out -DINSTALL_UTILS=ON
env:
CC: ${{ matrix.compiler }}
CI: true
- name: Compile source code
run: |
cmake --build . --config Release --target install
- name: Package release (Windows)
if: runner.os == 'Windows'
run: |
cd out
7z a -tzip ../zlib-ng-${{ matrix.deploy-name }}.zip bin include lib ../LICENSE.md ../README.md
- name: Upload release (Windows)
uses: svenstaro/upload-release-action@v1-release
if: runner.os == 'Windows'
with:
asset_name: zlib-ng-${{ matrix.deploy-name }}.zip
file: zlib-ng-${{ matrix.deploy-name }}.zip
tag: ${{env.tag}}
repo_token: ${{ secrets.GITHUB_TOKEN }}
overwrite: true
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
-86
View File
@@ -1,86 +0,0 @@
*.diff
*.patch
*.orig
*.rej
*~
*.a
*.lo
*.o
*.dylib
*.gcda
*.gcno
*.gcov
/adler32_test
/adler32_testsh
/example
/example64
/examplesh
/libz.so*
/libz-ng.so*
/makefixed
/minigzip
/minigzip64
/minigzipsh
/switchlevels
/zlib.pc
/zlib-ng.pc
/CVE-2003-0107
.DS_Store
*_fuzzer
*.obj
*.exe
*.pdb
*.exp
*.lib
*.dll
*.res
foo.gz
*.manifest
*.opensdf
*.sln
*.sdf
*.vcxproj
*.vcxproj.filters
.vs
CMakeCache.txt
CMakeFiles
Testing
/*.cmake
*.stackdump
*._h
zconf.h
zconf.h.cmakein
zconf.h.included
zconf-ng.h
zconf-ng.h.cmakein
ztest*
configure.log
a.out
/Makefile
/arch/arm/Makefile
/arch/generic/Makefile
/arch/power/Makefile
/arch/x86/Makefile
.kdev4
*.kdev4
/Debug
/example.dir
/minigzip.dir
/zlib.dir
/zlibstatic.dir
/win32/Debug
/build/
/build[.-]*/
/btmp[12]/
/pkgtmp[12]/
/.idea
/cmake-build-debug
-1
View File
@@ -1 +0,0 @@
disable=SC2140,SC2086,SC2046,SC2015,SC1097,SC1035,SC1036,SC1007,SC2154,SC2155,SC2000,SC2034,SC2016,SC1091,SC1090,SC2212,SC2143,SC2129,SC2102,SC2069,SC1041,SC1042,SC1044,SC1046,SC1119,SC1110,SC1111,SC1112,SC1102,SC1105,SC1101,SC1004,SC1003,SC1012,SC2068,SC2065,SC2064,SC2063,SC2059,SC2053,SC2048,SC2044,SC2032,SC2031,SC2030,SC2029,SC2025,SC2024,SC2022,SC2018,SC2019,SC2017,SC2014,SC2013,SC2012,SC2009,SC2001,SC2098,SC2096,SC2094,SC2091,SC2092,SC2088,SC2087,SC2076,SC2072,SC2071,SC2223,SC2221,SC2222,SC2217,SC2207,SC2206,SC2205,SC2190,SC2188,SC2187,SC2185,SC2179,SC2178,SC2174,SC2168,SC2167,SC2163,SC2161,SC2160,SC2153,SC2150,SC2148,SC2147,SC2146,SC2142,SC2139,SC2126,SC2123,SC2120,SC2119,SC2117,SC2114,SC1117,SC2164,SC1083,SC2004,SC2125,SC2128,SC2011,SC1008,SC1019,SC2093,SC1132,SC1129,SC2236,SC2237,SC2231,SC2230,SC2229,SC2106,SC2102,SC2243,SC2244,SC2245,SC2247,SC2248,SC2249,SC2250,SC2251,SC2252,SC2181
File diff suppressed because it is too large Load Diff
-374
View File
@@ -1,374 +0,0 @@
##
# THIS IS AN UNMAINTAINED COPY OF THE ORIGINAL FILE DISTRIBUTED WITH ZLIB 1.2.11
##
Frequently Asked Questions about zlib
If your question is not there, please check the zlib home page
http://zlib.net/ which may have more recent information.
The lastest zlib FAQ is at http://zlib.net/zlib_faq.html
1. Is zlib Y2K-compliant?
Yes. zlib doesn't handle dates.
2. Where can I get a Windows DLL version?
The zlib sources can be compiled without change to produce a DLL. See the
file win32/DLL_FAQ.txt in the zlib distribution. Pointers to the
precompiled DLL are found in the zlib web site at http://zlib.net/ .
3. Where can I get a Visual Basic interface to zlib?
See
* http://marknelson.us/1997/01/01/zlib-engine/
* win32/DLL_FAQ.txt in the zlib distribution
4. compress() returns Z_BUF_ERROR.
Make sure that before the call of compress(), the length of the compressed
buffer is equal to the available size of the compressed buffer and not
zero. For Visual Basic, check that this parameter is passed by reference
("as any"), not by value ("as long").
5. deflate() or inflate() returns Z_BUF_ERROR.
Before making the call, make sure that avail_in and avail_out are not zero.
When setting the parameter flush equal to Z_FINISH, also make sure that
avail_out is big enough to allow processing all pending input. Note that a
Z_BUF_ERROR is not fatal--another call to deflate() or inflate() can be
made with more input or output space. A Z_BUF_ERROR may in fact be
unavoidable depending on how the functions are used, since it is not
possible to tell whether or not there is more output pending when
strm.avail_out returns with zero. See http://zlib.net/zlib_how.html for a
heavily annotated example.
6. Where's the zlib documentation (man pages, etc.)?
It's in zlib.h . Examples of zlib usage are in the files test/example.c
and test/minigzip.c, with more in examples/ .
7. Why don't you use GNU autoconf or libtool or ...?
Because we would like to keep zlib as a very small and simple package.
zlib is rather portable and doesn't need much configuration.
8. I found a bug in zlib.
Most of the time, such problems are due to an incorrect usage of zlib.
Please try to reproduce the problem with a small program and send the
corresponding source to us at zlib@gzip.org . Do not send multi-megabyte
data files without prior agreement.
9. Why do I get "undefined reference to gzputc"?
If "make test" produces something like
example.o(.text+0x154): undefined reference to `gzputc'
check that you don't have old files libz.* in /usr/lib, /usr/local/lib or
/usr/X11R6/lib. Remove any old versions, then do "make install".
10. I need a Delphi interface to zlib.
See the contrib/delphi directory in the zlib distribution.
11. Can zlib handle .zip archives?
Not by itself, no. See the directory contrib/minizip in the zlib
distribution.
12. Can zlib handle .Z files?
No, sorry. You have to spawn an uncompress or gunzip subprocess, or adapt
the code of uncompress on your own.
13. How can I make a Unix shared library?
By default a shared (and a static) library is built for Unix. So:
make distclean
./configure
make
14. How do I install a shared zlib library on Unix?
After the above, then:
make install
However, many flavors of Unix come with a shared zlib already installed.
Before going to the trouble of compiling a shared version of zlib and
trying to install it, you may want to check if it's already there! If you
can #include <zlib.h>, it's there. The -lz option will probably link to
it. You can check the version at the top of zlib.h or with the
ZLIB_VERSION symbol defined in zlib.h .
15. I have a question about OttoPDF.
We are not the authors of OttoPDF. The real author is on the OttoPDF web
site: Joel Hainley, jhainley@myndkryme.com.
16. Can zlib decode Flate data in an Adobe PDF file?
Yes. See http://www.pdflib.com/ . To modify PDF forms, see
http://sourceforge.net/projects/acroformtool/ .
17. Why am I getting this "register_frame_info not found" error on Solaris?
After installing zlib 1.1.4 on Solaris 2.6, running applications using zlib
generates an error such as:
ld.so.1: rpm: fatal: relocation error: file /usr/local/lib/libz.so:
symbol __register_frame_info: referenced symbol not found
The symbol __register_frame_info is not part of zlib, it is generated by
the C compiler (cc or gcc). You must recompile applications using zlib
which have this problem. This problem is specific to Solaris. See
http://www.sunfreeware.com for Solaris versions of zlib and applications
using zlib.
18. Why does gzip give an error on a file I make with compress/deflate?
The compress and deflate functions produce data in the zlib format, which
is different and incompatible with the gzip format. The gz* functions in
zlib on the other hand use the gzip format. Both the zlib and gzip formats
use the same compressed data format internally, but have different headers
and trailers around the compressed data.
19. Ok, so why are there two different formats?
The gzip format was designed to retain the directory information about a
single file, such as the name and last modification date. The zlib format
on the other hand was designed for in-memory and communication channel
applications, and has a much more compact header and trailer and uses a
faster integrity check than gzip.
20. Well that's nice, but how do I make a gzip file in memory?
You can request that deflate write the gzip format instead of the zlib
format using deflateInit2(). You can also request that inflate decode the
gzip format using inflateInit2(). Read zlib.h for more details.
21. Is zlib thread-safe?
Yes. However any library routines that zlib uses and any application-
provided memory allocation routines must also be thread-safe. zlib's gz*
functions use stdio library routines, and most of zlib's functions use the
library memory allocation routines by default. zlib's *Init* functions
allow for the application to provide custom memory allocation routines.
Of course, you should only operate on any given zlib or gzip stream from a
single thread at a time.
22. Can I use zlib in my commercial application?
Yes. Please read the license in zlib.h.
23. Is zlib under the GNU license?
No. Please read the license in zlib.h.
24. The license says that altered source versions must be "plainly marked". So
what exactly do I need to do to meet that requirement?
You need to change the ZLIB_VERSION and ZLIB_VERNUM #defines in zlib.h. In
particular, the final version number needs to be changed to "f", and an
identification string should be appended to ZLIB_VERSION. Version numbers
x.x.x.f are reserved for modifications to zlib by others than the zlib
maintainers. For example, if the version of the base zlib you are altering
is "1.2.3.4", then in zlib.h you should change ZLIB_VERNUM to 0x123f, and
ZLIB_VERSION to something like "1.2.3.f-zachary-mods-v3". You can also
update the version strings in deflate.c and inftrees.c.
For altered source distributions, you should also note the origin and
nature of the changes in zlib.h, as well as in ChangeLog and README, along
with the dates of the alterations. The origin should include at least your
name (or your company's name), and an email address to contact for help or
issues with the library.
Note that distributing a compiled zlib library along with zlib.h and
zconf.h is also a source distribution, and so you should change
ZLIB_VERSION and ZLIB_VERNUM and note the origin and nature of the changes
in zlib.h as you would for a full source distribution.
25. Will zlib work on a big-endian or little-endian architecture, and can I
exchange compressed data between them?
Yes and yes.
26. Will zlib work on a 64-bit machine?
Yes. It has been tested on 64-bit machines, and has no dependence on any
data types being limited to 32-bits in length. If you have any
difficulties, please provide a complete problem report to zlib@gzip.org
27. Will zlib decompress data from the PKWare Data Compression Library?
No. The PKWare DCL uses a completely different compressed data format than
does PKZIP and zlib. However, you can look in zlib's contrib/blast
directory for a possible solution to your problem.
28. Can I access data randomly in a compressed stream?
No, not without some preparation. If when compressing you periodically use
Z_FULL_FLUSH, carefully write all the pending data at those points, and
keep an index of those locations, then you can start decompression at those
points. You have to be careful to not use Z_FULL_FLUSH too often, since it
can significantly degrade compression. Alternatively, you can scan a
deflate stream once to generate an index, and then use that index for
random access. See examples/zran.c .
29. Does zlib work on MVS, OS/390, CICS, etc.?
It has in the past, but we have not heard of any recent evidence. There
were working ports of zlib 1.1.4 to MVS, but those links no longer work.
If you know of recent, successful applications of zlib on these operating
systems, please let us know. Thanks.
30. Is there some simpler, easier to read version of inflate I can look at to
understand the deflate format?
First off, you should read RFC 1951. Second, yes. Look in zlib's
contrib/puff directory.
31. Does zlib infringe on any patents?
As far as we know, no. In fact, that was originally the whole point behind
zlib. Look here for some more information:
http://www.gzip.org/#faq11
32. Can zlib work with greater than 4 GB of data?
Yes. inflate() and deflate() will process any amount of data correctly.
Each call of inflate() or deflate() is limited to input and output chunks
of the maximum value that can be stored in the compiler's "unsigned int"
type, but there is no limit to the number of chunks. Note however that the
strm.total_in and strm_total_out counters may be limited to 4 GB. These
counters are provided as a convenience and are not used internally by
inflate() or deflate(). The application can easily set up its own counters
updated after each call of inflate() or deflate() to count beyond 4 GB.
compress() and uncompress() may be limited to 4 GB, since they operate in a
single call. gzseek() and gztell() may be limited to 4 GB depending on how
zlib is compiled. See the zlibCompileFlags() function in zlib.h.
The word "may" appears several times above since there is a 4 GB limit only
if the compiler's "long" type is 32 bits. If the compiler's "long" type is
64 bits, then the limit is 16 exabytes.
33. Does zlib have any security vulnerabilities?
The only one that we are aware of is potentially in gzprintf(). If zlib is
compiled to use sprintf() or vsprintf(), then there is no protection
against a buffer overflow of an 8K string space (or other value as set by
gzbuffer()), other than the caller of gzprintf() assuring that the output
will not exceed 8K. On the other hand, if zlib is compiled to use
snprintf() or vsnprintf(), which should normally be the case, then there is
no vulnerability. The ./configure script will display warnings if an
insecure variation of sprintf() will be used by gzprintf(). Also the
zlibCompileFlags() function will return information on what variant of
sprintf() is used by gzprintf().
If you don't have snprintf() or vsnprintf() and would like one, you can
find a portable implementation here:
http://www.ijs.si/software/snprintf/
Note that you should be using the most recent version of zlib. Versions
1.1.3 and before were subject to a double-free vulnerability, and versions
1.2.1 and 1.2.2 were subject to an access exception when decompressing
invalid compressed data.
34. Is there a Java version of zlib?
Probably what you want is to use zlib in Java. zlib is already included
as part of the Java SDK in the java.util.zip package. If you really want
a version of zlib written in the Java language, look on the zlib home
page for links: http://zlib.net/ .
35. I get this or that compiler or source-code scanner warning when I crank it
up to maximally-pedantic. Can't you guys write proper code?
Many years ago, we gave up attempting to avoid warnings on every compiler
in the universe. It just got to be a waste of time, and some compilers
were downright silly as well as contradicted each other. So now, we simply
make sure that the code always works.
36. Valgrind (or some similar memory access checker) says that deflate is
performing a conditional jump that depends on an uninitialized value.
Isn't that a bug?
No. That is intentional for performance reasons, and the output of deflate
is not affected. This only started showing up recently since zlib 1.2.x
uses malloc() by default for allocations, whereas earlier versions used
calloc(), which zeros out the allocated memory. Even though the code was
correct, versions 1.2.4 and later was changed to not stimulate these
checkers.
37. Will zlib read the (insert any ancient or arcane format here) compressed
data format?
Probably not. Look in the comp.compression FAQ for pointers to various
formats and associated software.
38. How can I encrypt/decrypt zip files with zlib?
zlib doesn't support encryption. The original PKZIP encryption is very
weak and can be broken with freely available programs. To get strong
encryption, use GnuPG, http://www.gnupg.org/ , which already includes zlib
compression. For PKZIP compatible "encryption", look at
http://www.info-zip.org/
39. What's the difference between the "gzip" and "deflate" HTTP 1.1 encodings?
"gzip" is the gzip format, and "deflate" is the zlib format. They should
probably have called the second one "zlib" instead to avoid confusion with
the raw deflate compressed data format. While the HTTP 1.1 RFC 2616
correctly points to the zlib specification in RFC 1950 for the "deflate"
transfer encoding, there have been reports of servers and browsers that
incorrectly produce or expect raw deflate data per the deflate
specification in RFC 1951, most notably Microsoft. So even though the
"deflate" transfer encoding using the zlib format would be the more
efficient approach (and in fact exactly what the zlib format was designed
for), using the "gzip" transfer encoding is probably more reliable due to
an unfortunate choice of name on the part of the HTTP 1.1 authors.
Bottom line: use the gzip format for HTTP 1.1 encoding.
40. Does zlib support the new "Deflate64" format introduced by PKWare?
No. PKWare has apparently decided to keep that format proprietary, since
they have not documented it as they have previous compression formats. In
any case, the compression improvements are so modest compared to other more
modern approaches, that it's not worth the effort to implement.
41. I'm having a problem with the zip functions in zlib, can you help?
There are no zip functions in zlib. You are probably using minizip by
Giles Vollant, which is found in the contrib directory of zlib. It is not
part of zlib. In fact none of the stuff in contrib is part of zlib. The
files in there are not supported by the zlib authors. You need to contact
the authors of the respective contribution for help.
42. The match.asm code in contrib is under the GNU General Public License.
Since it's part of zlib, doesn't that mean that all of zlib falls under the
GNU GPL?
No. The files in contrib are not part of zlib. They were contributed by
other authors and are provided as a convenience to the user within the zlib
distribution. Each item in contrib has its own license.
43. Is zlib subject to export controls? What is its ECCN?
zlib is not subject to export controls, and so is classified as EAR99.
44. Can you please sign these lengthy legal documents and fax them back to us
so that we can use your software in our product?
No. Go away. Shoo.
-37
View File
@@ -1,37 +0,0 @@
Contents
--------
| Name | Description |
|:-----------------|:---------------------------------------------------------------|
| arch/ | Architecture-specific code |
| doc/ | Documentation for formats and algorithms |
| test/example.c | Zlib usages examples for build testing |
| test/minigzip.c | Minimal gzip-like functionality for build testing |
| test/infcover.c | Inflate code coverage for build testing |
| win32/ | Shared library version resources for Windows |
| CMakeLists.txt | Cmake build script |
| configure | Bash configure/build script |
| adler32.c | Compute the Adler-32 checksum of a data stream |
| chunkset.* | Inline functions to copy small data chunks |
| compress.c | Compress a memory buffer |
| deflate.* | Compress data using the deflate algorithm |
| deflate_fast.c | Compress data using the deflate algorithm with fast strategy |
| deflate_medium.c | Compress data using the deflate algorithm with medium strategy |
| deflate_slow.c | Compress data using the deflate algorithm with slow strategy |
| functable.* | Struct containing function pointers to optimized functions |
| gzguts.h | Internal definitions for gzip operations |
| gzlib.c | Functions common to reading and writing gzip files |
| gzread.c | Read gzip files |
| gzwrite.c | Write gzip files |
| infback.* | Inflate using a callback interface |
| inflate.* | Decompress data |
| inffast.* | Decompress data with speed optimizations |
| inffixed_tbl.h | Table for decoding fixed codes |
| inftrees.h | Generate Huffman trees for efficient decoding |
| trees.* | Output deflated data using Huffman coding |
| uncompr.c | Decompress a memory buffer |
| zconf.h.cmakein | zconf.h template for cmake |
| zendian.h | BYTE_ORDER for endian tests |
| zlib.3 | Man page for zlib |
| zlib.map | Linux symbol information |
| zlib.pc.in | Pkg-config template |
-19
View File
@@ -1,19 +0,0 @@
(C) 1995-2013 Jean-loup Gailly and Mark Adler
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
arising from the use of this software.
Permission is granted to anyone to use this software for any purpose,
including commercial applications, and to alter it and redistribute it
freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not
claim that you wrote the original software. If you use this software
in a product, an acknowledgment in the product documentation would be
appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be
misrepresented as being the original software.
3. This notice may not be removed or altered from any source distribution.
-441
View File
@@ -1,441 +0,0 @@
# Makefile for zlib
# Copyright (C) 1995-2016 Jean-loup Gailly, Mark Adler
# For conditions of distribution and use, see copyright notice in zlib.h
# To compile and test, type:
# ./configure; make test
# Normally configure builds both a static and a shared library.
# If you want to build just a static library, use: ./configure --static
# To install /usr/local/lib/libz.* and /usr/local/include/zlib.h, type:
# make install
# To install in $HOME instead of /usr/local, use:
# make install prefix=$HOME
CC=cc
CFLAGS=-O
#CFLAGS=-O -DMAX_WBITS=14 -DMAX_MEM_LEVEL=7
#CFLAGS=-g -DZLIB_DEBUG
#CFLAGS=-O3 -Wall -Wwrite-strings -Wpointer-arith -Wconversion \
# -Wstrict-prototypes -Wmissing-prototypes
SFLAGS=-O
LDFLAGS=-L.
LIBNAME1=libz-ng
LIBNAME2=zlib-ng
SUFFIX=-ng
TEST_LIBS=$(LIBNAME1).a
LDSHARED=$(CC)
LDSHAREDFLAGS=-shared
VER=2.0.0-RC2
VER1=2
STATICLIB=$(LIBNAME1).a
SHAREDLIB=$(LIBNAME1).so
SHAREDLIBV=$(LIBNAME1).so.$(VER)
SHAREDLIBM=$(LIBNAME1).so.$(VER1)
IMPORTLIB=
SHAREDTARGET=$(LIBNAME1).so.$(VER)
PKGFILE=$(LIBNAME2).pc
LIBS=$(STATICLIB) $(SHAREDTARGET)
AR=ar
ARFLAGS=rc
DEFFILE=
RC=
RCFLAGS=
RCOBJS=
STRIP=
RANLIB=ranlib
LDCONFIG=ldconfig
LDSHAREDLIBC=
EXE=
SRCDIR=.
INCLUDES=-I$(SRCDIR)
ARCHDIR=arch/generic
ARCH_STATIC_OBJS=
ARCH_SHARED_OBJS=
prefix = /usr/local
exec_prefix = ${prefix}
bindir = ${exec_prefix}/bin
libdir = ${exec_prefix}/lib
sharedlibdir = ${libdir}
includedir = ${prefix}/include
mandir = ${prefix}/share/man
man3dir = ${mandir}/man3
pkgconfigdir = ${libdir}/pkgconfig
OBJZ = \
adler32.o \
chunkset.o \
compare258.o \
compress.o \
crc32.o \
crc32_comb.o \
deflate.o \
deflate_fast.o \
deflate_medium.o \
deflate_quick.o \
deflate_slow.o \
functable.o \
infback.o \
inffast.o \
inflate.o \
inftrees.o \
insert_string.o \
trees.o \
uncompr.o \
zutil.o \
$(ARCH_STATIC_OBJS)
OBJG = \
gzlib.o \
gzread.o \
gzwrite.o
OBJC = $(OBJZ) $(OBJG)
PIC_OBJZ = \
adler32.lo \
chunkset.lo \
compare258.lo \
compress.lo \
crc32.lo \
crc32_comb.lo \
deflate.lo \
deflate_fast.lo \
deflate_medium.lo \
deflate_quick.lo \
deflate_slow.lo \
functable.lo \
infback.lo \
inffast.lo \
inflate.lo \
inftrees.lo \
insert_string.lo \
trees.lo \
uncompr.lo \
zutil.lo \
$(ARCH_SHARED_OBJS)
PIC_OBJG = \
gzlib.lo \
gzread.lo \
gzwrite.lo
PIC_OBJC = $(PIC_OBJZ) $(PIC_OBJG)
OBJS = $(OBJC)
PIC_OBJS = $(PIC_OBJC)
all: static shared
static: adler32_test$(EXE) example$(EXE) minigzip$(EXE) fuzzers makefixed$(EXE) maketrees$(EXE) makecrct$(EXE)
shared: adler32_testsh$(EXE) examplesh$(EXE) minigzipsh$(EXE)
check: test
.SECONDARY:
$(ARCHDIR)/%.o: $(SRCDIR)/$(ARCHDIR)/%.c
$(MAKE) -C $(ARCHDIR) $(notdir $@)
$(ARCHDIR)/%.lo: $(SRCDIR)/$(ARCHDIR)/%.c
$(MAKE) -C $(ARCHDIR) $(notdir $@)
%.o: $(ARCHDIR)/%.o
-cp $< $@
%.lo: $(ARCHDIR)/%.lo
-cp $< $@
test: all
$(MAKE) -C test
# This variable is set by configure.
WITH_FUZZERS=
# By default, use our own standalone_fuzz_target_runner.
# This runner does no fuzzing, but simply executes the inputs
# provided via parameters.
# Run e.g. "make all LIB_FUZZING_ENGINE=/path/to/libFuzzer.a"
# to link the fuzzer(s) against a real fuzzing engine.
ifeq (,$(LIB_FUZZING_ENGINE))
LIB_FUZZING_ENGINE = standalone_fuzz_target_runner.o
else
# OSS-Fuzz will define its own value for LIB_FUZZING_ENGINE.
WITH_FUZZERS=1
endif
ifeq (1,$(WITH_FUZZERS))
fuzzers: checksum_fuzzer$(EXE) compress_fuzzer$(EXE) example_small_fuzzer$(EXE) example_large_fuzzer$(EXE) example_flush_fuzzer$(EXE) example_dict_fuzzer$(EXE) minigzip_fuzzer$(EXE)
else
fuzzers:
endif
# The standalone fuzz target runner.
standalone_fuzz_target_runner.o:
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
checksum_fuzzer.o:
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
compress_fuzzer.o:
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
example_small_fuzzer.o:
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
example_large_fuzzer.o:
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
example_flush_fuzzer.o:
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
example_dict_fuzzer.o:
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
minigzip_fuzzer.o:
$(CC) $(CFLAGS) -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $<
checksum_fuzzer$(EXE): checksum_fuzzer.o standalone_fuzz_target_runner.o $(STATICLIB)
$(CC) $(LDFLAGS) -o $@ $(LIB_FUZZING_ENGINE) checksum_fuzzer.o $(STATICLIB) -lpthread
compress_fuzzer$(EXE): compress_fuzzer.o standalone_fuzz_target_runner.o $(STATICLIB)
$(CC) $(LDFLAGS) -o $@ $(LIB_FUZZING_ENGINE) compress_fuzzer.o $(STATICLIB) -lpthread
example_small_fuzzer$(EXE): example_small_fuzzer.o standalone_fuzz_target_runner.o $(STATICLIB)
$(CC) $(LDFLAGS) -o $@ $(LIB_FUZZING_ENGINE) example_small_fuzzer.o $(STATICLIB) -lpthread
example_large_fuzzer$(EXE): example_large_fuzzer.o standalone_fuzz_target_runner.o $(STATICLIB)
$(CC) $(LDFLAGS) -o $@ $(LIB_FUZZING_ENGINE) example_large_fuzzer.o $(STATICLIB) -lpthread
example_flush_fuzzer$(EXE): example_flush_fuzzer.o standalone_fuzz_target_runner.o $(STATICLIB)
$(CC) $(LDFLAGS) -o $@ $(LIB_FUZZING_ENGINE) example_flush_fuzzer.o $(STATICLIB) -lpthread
example_dict_fuzzer$(EXE): example_dict_fuzzer.o standalone_fuzz_target_runner.o $(STATICLIB)
$(CC) $(LDFLAGS) -o $@ $(LIB_FUZZING_ENGINE) example_dict_fuzzer.o $(STATICLIB) -lpthread
minigzip_fuzzer$(EXE): minigzip_fuzzer.o standalone_fuzz_target_runner.o $(OBJG) $(STATICLIB)
$(CC) $(LDFLAGS) -o $@ $(LIB_FUZZING_ENGINE) minigzip_fuzzer.o $(OBJG) $(STATICLIB) -lpthread
infcover.o: $(SRCDIR)/test/infcover.c $(SRCDIR)/zlib$(SUFFIX).h zconf$(SUFFIX).h
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/test/infcover.c
infcover$(EXE): infcover.o $(STATICLIB)
$(CC) $(LDFLAGS) -o $@ infcover.o $(STATICLIB)
ifneq ($(STRIP),)
$(STRIP) $@
endif
cover: infcover$(EXE)
rm -f *.gcda
./infcover
gcov inf*.c
$(STATICLIB): $(OBJS)
$(AR) $(ARFLAGS) $@ $(OBJS)
-@ ($(RANLIB) $@ || true) >/dev/null 2>&1
adler32_test.o:
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/test/adler32_test.c
example.o:
$(CC) $(CFLAGS) -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $(SRCDIR)/test/example.c
minigzip.o:
$(CC) $(CFLAGS) -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $(SRCDIR)/test/minigzip.c
makefixed.o:
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/tools/makefixed.c
maketrees.o:
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/tools/maketrees.c
makecrct.o:
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $(SRCDIR)/tools/makecrct.c
zlibrc.o: win32/zlib$(SUFFIX)1.rc
$(RC) $(RCFLAGS) -o $@ win32/zlib$(SUFFIX)1.rc
.SUFFIXES: .lo
%.o: $(SRCDIR)/%.c
$(CC) $(CFLAGS) $(INCLUDES) -c -o $@ $<
%.lo: $(SRCDIR)/%.c
$(CC) $(SFLAGS) -DPIC $(INCLUDES) -c -o $@ $<
$(OBJG): %.o: $(SRCDIR)/%.c
$(CC) $(CFLAGS) -DWITH_GZFILEOP $(INCLUDES) -c -o $@ $<
$(SHAREDTARGET): $(PIC_OBJS) $(DEFFILE) $(RCOBJS)
ifneq ($(SHAREDTARGET),)
$(LDSHARED) $(CFLAGS) $(LDSHAREDFLAGS) $(LDFLAGS) -o $@ $(DEFFILE) $(PIC_OBJS) $(RCOBJS) $(LDSHAREDLIBC)
ifneq ($(STRIP),)
$(STRIP) $@
endif
ifneq ($(SHAREDLIB),$(SHAREDTARGET))
rm -f $(SHAREDLIB) $(SHAREDLIBM)
ln -s $@ $(SHAREDLIB)
ln -s $@ $(SHAREDLIBM)
endif
endif
adler32_test$(EXE): adler32_test.o $(OBJG) $(STATICLIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ adler32_test.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC)
ifneq ($(STRIP),)
$(STRIP) $@
endif
example$(EXE): example.o $(OBJG) $(STATICLIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ example.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC)
ifneq ($(STRIP),)
$(STRIP) $@
endif
minigzip$(EXE): minigzip.o $(OBJG) $(STATICLIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC)
ifneq ($(STRIP),)
$(STRIP) $@
endif
adler32_testsh$(EXE): adler32_test.o $(OBJG) $(SHAREDTARGET)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ adler32_test.o $(OBJG) $(SHAREDTARGET) $(LDSHAREDLIBC)
ifneq ($(STRIP),)
$(STRIP) $@
endif
examplesh$(EXE): example.o $(OBJG) $(SHAREDTARGET)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ example.o $(OBJG) $(SHAREDTARGET) $(LDSHAREDLIBC)
ifneq ($(STRIP),)
$(STRIP) $@
endif
minigzipsh$(EXE): minigzip.o $(OBJG) $(SHAREDTARGET)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ minigzip.o $(OBJG) $(SHAREDTARGET) $(LDSHAREDLIBC)
ifneq ($(STRIP),)
$(STRIP) $@
endif
makefixed$(EXE): makefixed.o $(OBJG) $(STATICLIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ makefixed.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC)
ifneq ($(STRIP),)
$(STRIP) $@
endif
maketrees$(EXE): maketrees.o $(OBJG) $(STATICLIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ maketrees.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC)
ifneq ($(STRIP),)
$(STRIP) $@
endif
makecrct$(EXE): makecrct.o $(OBJG) $(STATICLIB)
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ makecrct.o $(OBJG) $(TEST_LIBS) $(LDSHAREDLIBC)
ifneq ($(STRIP),)
$(STRIP) $@
endif
install-shared: $(SHAREDTARGET)
ifneq ($(SHAREDTARGET),)
-@if [ ! -d $(DESTDIR)$(sharedlibdir) ]; then mkdir -p $(DESTDIR)$(sharedlibdir); fi
rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDTARGET)
cp $(SHAREDTARGET) $(DESTDIR)$(sharedlibdir)
chmod 755 $(DESTDIR)$(sharedlibdir)/$(SHAREDTARGET)
ifneq ($(SHAREDLIB),$(SHAREDTARGET))
rm -f $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM)
ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIB)
ln -s $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)/$(SHAREDLIBM)
($(LDCONFIG) || true) >/dev/null 2>&1
# ldconfig is for Linux
endif
ifneq ($(IMPORTLIB),)
cp $(IMPORTLIB) $(DESTDIR)$(sharedlibdir)
chmod 644 $(DESTDIR)$(sharedlibdir)/$(IMPORTLIB)
endif
endif
install-static: $(STATICLIB)
-@if [ ! -d $(DESTDIR)$(libdir) ]; then mkdir -p $(DESTDIR)$(libdir); fi
rm -f $(DESTDIR)$(libdir)/$(STATICLIB)
cp $(STATICLIB) $(DESTDIR)$(libdir)
chmod 644 $(DESTDIR)$(libdir)/$(STATICLIB)
-@($(RANLIB) $(DESTDIR)$(libdir)/$(STATICLIB) || true) >/dev/null 2>&1
# The ranlib in install-static is needed on NeXTSTEP which checks file times
install-libs: install-shared install-static
-@if [ ! -d $(DESTDIR)$(man3dir) ]; then mkdir -p $(DESTDIR)$(man3dir); fi
-@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
rm -f $(DESTDIR)$(man3dir)/zlib$(SUFFIX).3
cp $(SRCDIR)/zlib.3 $(DESTDIR)$(man3dir)/zlib$(SUFFIX).3
chmod 644 $(DESTDIR)$(man3dir)/zlib$(SUFFIX).3
rm -f $(DESTDIR)$(pkgconfigdir)/$(PKGFILE)
cp $(PKGFILE) $(DESTDIR)$(pkgconfigdir)
chmod 644 $(DESTDIR)$(pkgconfigdir)/$(PKGFILE)
install: install-libs
-@if [ ! -d $(DESTDIR)$(includedir) ]; then mkdir -p $(DESTDIR)$(includedir); fi
rm -f $(DESTDIR)$(includedir)/zlib$(SUFFIX).h $(DESTDIR)$(includedir)/zconf$(SUFFIX).h
cp $(SRCDIR)/zlib$(SUFFIX).h $(DESTDIR)$(includedir)/zlib$(SUFFIX).h
cp zconf$(SUFFIX).h $(DESTDIR)$(includedir)/zconf$(SUFFIX).h
chmod 644 $(DESTDIR)$(includedir)/zlib$(SUFFIX).h $(DESTDIR)$(includedir)/zconf$(SUFFIX).h
uninstall-static:
cd $(DESTDIR)$(libdir) && rm -f $(STATICLIB)
uninstall-shared:
ifneq ($(SHAREDLIB),)
cd $(DESTDIR)$(sharedlibdir) && rm -f $(SHAREDLIBV) $(SHAREDLIB) $(SHAREDLIBM)
endif
ifneq ($(IMPORTLIB),)
cd $(DESTDIR)$(sharedlibdir) && rm -f $(IMPORTLIB)
endif
uninstall: uninstall-static uninstall-shared
cd $(DESTDIR)$(includedir) && rm -f zlib$(SUFFIX).h zconf$(SUFFIX).h
cd $(DESTDIR)$(man3dir) && rm -f zlib$(SUFFIX).3
cd $(DESTDIR)$(pkgconfigdir) && rm -f $(PKGFILE)
docs: zlib.3.pdf
zlib.3.pdf: $(SRCDIR)/zlib.3
groff -mandoc -f H -T ps $(SRCDIR)/zlib.3 | ps2pdf - zlib.3.pdf
mostlyclean: clean
clean:
@if [ -f $(ARCHDIR)/Makefile ]; then $(MAKE) -C $(ARCHDIR) clean; fi
@if [ -f test/Makefile ]; then $(MAKE) -C test clean; fi
rm -f *.o *.lo *~ \
adler32_test$(EXE) example$(EXE) minigzip$(EXE) \
adler32_testsh$(EXE) examplesh$(EXE) minigzipsh$(EXE) \
checksum_fuzzer$(EXE) compress_fuzzer$(EXE) example_small_fuzzer$(EXE) example_large_fuzzer$(EXE) \
example_flush_fuzzer$(EXE) example_dict_fuzzer$(EXE) minigzip_fuzzer$(EXE) \
infcover makefixed$(EXE) maketrees$(EXE) makecrct$(EXE) \
$(STATICLIB) $(IMPORTLIB) $(SHAREDLIB) $(SHAREDLIBV) $(SHAREDLIBM) \
foo.gz so_locations \
_match.s maketree
rm -rf objs
rm -f *.gcda *.gcno *.gcov
rm -f a.out a.exe
rm -f *.pc
rm -f *._h
rm -rf btmp1 btmp2 pkgtmp1 pkgtmp2
maintainer-clean: distclean
distclean: clean
@if [ -f $(ARCHDIR)/Makefile ]; then $(MAKE) -C $(ARCHDIR) distclean; fi
@if [ -f test/Makefile ]; then $(MAKE) -C test distclean; fi
rm -f $(PKGFILE) configure.log zconf.h zconf.h.cmakein
-@rm -f .DS_Store
# Reset Makefile if building inside source tree
@if [ -f Makefile.in ]; then \
printf 'all:\n\t-@echo "Please use ./configure first. Thank you."\n' > Makefile ; \
printf '\ndistclean:\n\t$(MAKE) -f Makefile.in distclean\n' >> Makefile ; \
touch -r $(SRCDIR)/Makefile.in Makefile ; fi
# Reset zconf.h and zconf.h.cmakein if building inside source tree
@if [ -f zconf.h.in ]; then \
cp -p $(SRCDIR)/zconf.h.in zconf.h ; \
grep -v '^#cmakedefine' $(SRCDIR)/zconf.h.in > zconf.h.cmakein &&\
touch -r $(SRCDIR)/zconf.h.in zconf.h.cmakein ; fi
# Cleanup these files if building outside source tree
@if [ ! -f zlib.3 ]; then rm -f zlib.3.pdf Makefile; fi
# Remove arch and test directory if building outside source tree
@if [ ! -f $(ARCHDIR)/Makefile.in ]; then rm -rf arch; fi
@if [ ! -f test/Makefile.in ]; then rm -rf test; fi
tags:
etags $(SRCDIR)/*.[ch]
-206
View File
@@ -1,206 +0,0 @@
## zlib-ng
*zlib data compression library for the next generation systems*
Maintained by Hans Kristian Rosbach
aka Dead2 (zlib-ng àt circlestorm dót org)
|CI|Status|
|:-|-|
|GitHub Actions|[![Master Branch Status](https://github.com/zlib-ng/zlib-ng/workflows/CI%20CMake/badge.svg)](https://github.com/zlib-ng/zlib-ng/actions) [![Master Branch Status](https://github.com/zlib-ng/zlib-ng/workflows/CI%20Configure/badge.svg)](https://github.com/zlib-ng/zlib-ng/actions) [![Master Branch Status](https://github.com/zlib-ng/zlib-ng/workflows/CI%20NMake/badge.svg)](https://github.com/zlib-ng/zlib-ng/actions)|
|Buildkite|[![Build status](https://badge.buildkite.com/7bb1ef84356d3baee26202706cc053ee1de871c0c712b65d26.svg?branch=develop)](https://buildkite.com/circlestorm-productions/zlib-ng)|
|CodeFactor|[![CodeFactor](https://www.codefactor.io/repository/github/zlib-ng/zlib-ng/badge)](https://www.codefactor.io/repository/github/zlib-ng/zlib-ng)|
|OSS-Fuzz|[![Fuzzing Status](https://oss-fuzz-build-logs.storage.googleapis.com/badges/zlib-ng.svg)](https://bugs.chromium.org/p/oss-fuzz/issues/list?sort=-opened&can=1&q=proj:zlib-ng)
|Codecov|[![codecov.io](https://codecov.io/github/zlib-ng/zlib-ng/coverage.svg?branch=develop)](https://codecov.io/github/zlib-ng/zlib-ng/)|
Features
--------
* Zlib compatible API with support for dual-linking
* Modernized native API based on zlib API for ease of porting
* Modern C99 syntax and a clean code layout
* Deflate medium and quick algorithms based on Intels zlib fork
* Support for CPU intrinsics when available
* Adler32 implementation using SSSE3, AVX2, Neon & VSX
* CRC32-B implementation using PCLMULQDQ & ACLE
* Hash table implementation using CRC32-C intrinsics on x86 and ARM
* Slide hash implementations using SSE2, AVX2, Neon & VSX
* Compare256/258 implementations using SSE4.2 & AVX2
* Inflate chunk copying using SSE2, AVX2 & Neon
* Support for hardware-accelerated deflate using IBM Z DFLTCC
* Unaligned memory read/writes and large bit buffer improvements
* Includes improvements from Cloudflare and Intel forks
* Configure, CMake, and NMake build system support
* Comprehensive set of CMake unit tests
* Code sanitizers, fuzzing, and coverage
* GitHub Actions continuous integration on Windows, macOS, and Linux
* Emulated CI for ARM, AARCH64, PPC, PPC64, SPARC64, S390x using qemu
Fork Motivation
---------------------------
The motivation for this fork was due to seeing several 3rd party
contributions containing new optimizations not getting implemented
into the official zlib repository.
Mark Adler has been maintaining zlib for a very long time, and he has
done a great job and hopefully he will continue for a long time yet.
The idea of zlib-ng is not to replace zlib, but to co-exist as a
drop-in replacement with a lower threshold for code change.
zlib has a long history and is incredibly portable, even supporting
lots of systems that predate the Internet. This is great, but it does
complicate further development and maintainability.
The zlib code has numerous workarounds for old compilers that do not
understand ANSI-C or to accommodate systems with limitations such as
operating in a 16-bit environment.
Many of these workarounds are only maintenance burdens, some of them
are pretty huge code-wise. For example, the [v]s[n]printf workaround
code has a whopping 8 different implementations just to cater to
various old compilers. With this many workarounds cluttered throughout
the code, new programmers with an idea/interest for zlib will need
to take some time to figure out why all of these seemingly strange
things are used, and how to work within those confines.
So I decided to make a fork, merge all the Intel optimizations, merge
the Cloudflare optimizations that did not conflict, plus a couple
of other smaller patches. Then I started cleaning out workarounds,
various dead code, all contrib and example code as there is little
point in having those in this fork for various reasons.
A lot of improvements have gone into zlib-ng since its start, and
numerous people and companies have contributed both small and big
improvements, or valuable testing.
Please read LICENSE.md, it is very simple and very liberal.
Build
-----
There are two ways to build zlib-ng:
### Cmake
To build zlib-ng using the cross-platform makefile generator cmake.
```
cmake .
cmake --build . --config Release
ctest --verbose -C Release
```
Alternatively, you can use the cmake configuration GUI tool ccmake:
```
ccmake .
```
### Configure
To build zlib-ng using the bash configure script:
```
./configure
make
make test
```
Build Options
-------------
| CMake | configure | Description | Default |
|:-------------------------|:-------------------------|:--------------------------------------------------------------------------------------|---------|
| ZLIB_COMPAT | --zlib-compat | Compile with zlib compatible API | OFF |
| ZLIB_ENABLE_TESTS | | Build test binaries | ON |
| WITH_GZFILEOP | --without-gzfileops | Compile with support for gzFile related functions | ON |
| WITH_OPTIM | --without-optimizations | Build with optimisations | ON |
| WITH_NEW_STRATEGIES | --without-new-strategies | Use new strategies | ON |
| WITH_NATIVE_INSTRUCTIONS | --native | Compiles with full instruction set supported on this host (gcc/clang -march=native) | OFF |
| WITH_SANITIZER | --with-sanitizer | Build with sanitizer (memory, address, undefined) | OFF |
| WITH_FUZZERS | --with-fuzzers | Build test/fuzz | OFF |
| WITH_MAINTAINER_WARNINGS | | Build with project maintainer warnings | OFF |
| WITH_CODE_COVERAGE | | Enable code coverage reporting | OFF |
Install
-------
WARNING: We do not recommend manually installing unless you really
know what you are doing, because this can potentially override the system
default zlib library, and any incompatibility or wrong configuration of
zlib-ng can make the whole system unusable, requiring recovery or reinstall.
If you still want a manual install, we recommend using the /opt/ path prefix.
For Linux distros, an alternative way to use zlib-ng (if compiled in
zlib-compat mode) instead of zlib, is through the use of the
_LD_PRELOAD_ environment variable. If the program is dynamically linked
with zlib, then zlib-ng will temporarily be used instead by the program,
without risking system-wide instability.
```
LD_PRELOAD=/opt/zlib-ng/libz.so.1.2.11.zlib-ng /usr/bin/program
```
### Cmake
To install zlib-ng system-wide using cmake:
```
cmake --build . --target install
```
### Configure
To install zlib-ng system-wide using the configure script:
```
make install
```
Contributing
------------
Zlib-ng is a aiming to be open to contributions, and we would be
delighted to receive pull requests on github.
Just remember that any code you submit must be your own and it must
be zlib licensed.
Help with testing and reviewing of pull requests etc is also very
much appreciated.
If you are interested in contributing, please consider joining our
IRC channel #zlib-ng on the Freenode IRC network.
Acknowledgments
----------------
Thanks to Servebolt.com for sponsoring my maintainership of zlib-ng.
Thanks go out to all the people and companies who have taken the time
to contribute code reviews, testing and/or patches. Zlib-ng would not
have been nearly as good without you.
The deflate format used by zlib was defined by Phil Katz.
The deflate and zlib specifications were written by L. Peter Deutsch.
zlib was originally created by Jean-loup Gailly (compression)
and Mark Adler (decompression).
Advanced Build Options
----------------------
| CMake | configure | Description | Default |
|:--------------------------------|:----------------------|:--------------------------------------------------------------------|------------------------|
| ZLIB_DUAL_LINK | | Dual link tests with system zlib | OFF |
| | --force-sse2 | Assume SSE2 instructions are always available | ON (x86), OFF (x86_64) |
| WITH_AVX2 | | Build with AVX2 intrinsics | ON |
| WITH_SSE2 | | Build with SSE2 intrinsics | ON |
| WITH_SSE4 | | Build with SSE4 intrinsics | ON |
| WITH_PCLMULQDQ | | Build with PCLMULQDQ intrinsics | ON |
| WITH_ACLE | --without-acle | Build with ACLE intrinsics | ON |
| WITH_NEON | --without-neon | Build with NEON intrinsics | ON |
| WITH_POWER8 | | Build with POWER8 optimisations | ON |
| WITH_DFLTCC_DEFLATE | --with-dfltcc-deflate | Use DEFLATE COMPRESSION CALL instruction for compression on IBM Z | OFF |
| WITH_DFLTCC_INFLATE | --with-dfltcc-inflate | Use DEFLATE COMPRESSION CALL instruction for decompression on IBM Z | OFF |
| WITH_UNALIGNED | | Allow optimizations that use unaligned reads if safe on current arch| ON |
| WITH_INFLATE_STRICT | | Build with strict inflate distance checking | OFF |
| WITH_INFLATE_ALLOW_INVALID_DIST | | Build with zero fill for inflate invalid distances | OFF |
| INSTALL_UTILS | | Copy minigzip and minideflate during install | OFF |

Some files were not shown because too many files have changed in this diff Show More