Compare commits

..

2 Commits

Author SHA1 Message Date
Trust 2434bab697 Updated for bypass all rule 2024-02-25 16:00:44 -05:00
Trust 7a5a755033 [Bug Fix] Cleanup NPC Mana Tap Logic
Mana Tap rule logic was invalid - Cleaned up and simplified, either we care about npc mana or we dont.
2024-02-25 15:20:58 -05:00
258 changed files with 5742 additions and 12800 deletions
-6
View File
@@ -1,6 +0,0 @@
!Makefile
base/*.sql
base/*.zip
base/db/
base/maps/
!base/expansion/Makefile
@@ -1,9 +0,0 @@
# This is a "dev" image for running eqemu in development, also for dev containers
ARG USERNAME=user-name-goes-here
ARG USER_UID=1000
ARG USER_GID=$USER_UID
FROM --platform=linux/arm64 mcr.microsoft.com/devcontainers/base:debian
RUN sudo apt update && sudo apt install -y --no-install-recommends build-essential libtool cmake curl debconf-utils git libluabind-dev libsodium-dev liblua5.2-0 liblua5.2-dev libmariadb-dev libssl-dev minizip make mariadb-client locales nano open-vm-tools unzip uuid-dev iputils-ping wget libcurl4-openssl-dev gdb libyaml-cpp-dev ccache ninja-build pv mariadb-server libperl-dev libjson-perl libio-stringy-perl liblua5.1-dev libluabind-dev libboost-dev mariadb-server valgrind telnet libgoogle-perftools-dev google-perftools
USER $USERNAME
-9
View File
@@ -1,9 +0,0 @@
# This is a "dev" image for running eqemu in development, also for dev containers
ARG USERNAME=user-name-goes-here
ARG USER_UID=1000
ARG USER_GID=$USER_UID
FROM mcr.microsoft.com/devcontainers/base:debian
RUN sudo apt update && sudo apt install -y --no-install-recommends build-essential libtool cmake curl debconf-utils git libluabind-dev libsodium-dev liblua5.2-0 liblua5.2-dev libmariadb-dev libssl-dev minizip make mariadb-client locales nano open-vm-tools unzip uuid-dev iputils-ping wget libcurl4-openssl-dev gdb libyaml-cpp-dev ccache ninja-build pv mariadb-server libperl-dev libjson-perl libio-stringy-perl liblua5.1-dev libluabind-dev libboost-dev mariadb-server valgrind telnet libgoogle-perftools-dev google-perftools
USER $USERNAME
-284
View File
@@ -1,284 +0,0 @@
NAME := eqemu-server
.ONESHELL:
DOCKER_ARGS := --rm --name ${NAME} -v $$PWD:/src -w /src ${NAME}
DOCKER_ARM64_ARGS := --rm --platform linux/arm64 --name ${NAME}-arm64 -v $$PWD:/src -w /src ${NAME}-arm64
.PHONY: build
build:
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
@make -C ../ -f .devcontainer/Makefile build --no-print-directory
exit
endif
cd build$$BUILD_SUFFIX && cmake --build . --config Release --target all --
.PHONY: cmake
cmake:
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
@make -C ../ -f .devcontainer/Makefile cmake --no-print-directory
exit
endif
@echo "working directory: $$PWD"
mkdir -p build$$BUILD_SUFFIX
@cd build$$BUILD_SUFFIX && cmake -DEQEMU_BUILD_LOGIN=ON \
-DEQEMU_BUILD_TESTS=ON \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache -G Ninja ..
clean:
ifneq (,$(findstring .devcontainer,$$PWD))
@make -C ../ -f .devcontainer/Makefile clean --no-print-directory
endif
rm -rf build
docker-cmake:
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
@make -C ../ -f .devcontainer/Makefile docker-cmake --no-print-directory
exit
endif
@echo "working directory: $$PWD"
git submodule update --init --recursive
docker run ${DOCKER_ARGS} make cmake
docker-build:
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
@make -C ../ -f .devcontainer/Makefile docker-build --no-print-directory
exit
endif
docker run ${DOCKER_ARGS} make build
# Build image if it doesn't exist
docker-image-build:
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
@make -C ../ -f .devcontainer/Makefile docker-image-build --no-print-directory
exit
endif
ifeq ($(shell docker images -q ${NAME} 2> /dev/null),)
@echo "Docker image not found. Building..."
docker build -f Dockerfile.debian.dev -t ${NAME} .
endif
docker-arm-cmake: docker-arm-image-build
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
@make -C ../ -f .devcontainer/Makefile docker-arm-cmake --no-print-directory
exit
endif
git submodule update --init --recursive
docker run ${DOCKER_ARM64_ARGS} make cmake BUILD_SUFFIX=arm64
docker-arm-build: docker-arm-image-build
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
@make -C ../ -f .devcontainer/Makefile docker-arm-build --no-print-directory
exit
endif
docker run ${DOCKER_ARM64_ARGS} make build BUILD_SUFFIX=arm64
docker-arm-image-build:
ifeq ($(shell docker images -q ${NAME}-arm64 2> /dev/null),)
@echo "Docker image not found. Building..."
docker build -f Dockerfile.debian.arm.dev -t ${NAME}-arm64 .
endif
docker-clean: clean
.PHONY: prep
prep:
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
@make -C ../ -f .devcontainer/Makefile prep --no-print-directory
exit
endif
@echo "Preparing build/bin for usage..."
mkdir -p build/bin/assets/patches
cp -R -u -p .devcontainer/base/eqemu_config.json build/bin/eqemu_config.json
cp -R -u -p .devcontainer/base/login.json build/bin/login.json
cp -R -u -p loginserver/login_util/* build/bin/assets/patches/
mkdir -p build/bin/assets
cp -R -u -p utils/patches build/bin/assets/
-unlink build/bin/lua_modules
cd build/bin && ln -s quests/lua_modules lua_modules
-unlink build/bin/mods
cd build/bin && ln -s quests/mods mods
-unlink build/bin/maps
cd build/bin && ln -s ../../base/maps maps
mkdir -p build/bin/logs
mkdir -p build/bin/shared
@echo "Eqemu is prepared. Edit build/bin/eqemu_config.json to configure."
maps:
@echo "Downloading maps..."
@mkdir -p base/maps
@cd base/maps && wget -nc https://github.com/Akkadius/eqemu-maps/archive/refs/heads/master.zip
@cd base/maps && unzip -o master.zip
@cd base/maps && mv eqemu-maps-master/* .
@cd base/maps && rm -rf eqemu-maps-master
@echo "Maps downloaded."
quests:
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
@make -C ../ -f .devcontainer/Makefile quests --no-print-directory
exit
endif
@cd build/bin && git clone https://github.com/ProjectEQ/projecteqquests.git quests
# Runs tests
.PHONY: test
test:
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
@make -C ../ -f .devcontainer/Makefile test --no-print-directory
exit
endif
cd build/bin && ./tests
# Runs login binary
.PHONY: login
login:
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
@make -C ../ -f .devcontainer/Makefile login --no-print-directory
exit
endif
cd build/bin && ./loginserver
# Runs shared_memory binary
.PHONY: shared
shared:
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
@make -C ../ -f .devcontainer/Makefile shared --no-print-directory
exit
endif
cd build/bin && ./shared_memory
# Runs zone binary
.PHONY: zone
zone:
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
@make -C ../ -f .devcontainer/Makefile zone --no-print-directory
exit
endif
@-rm build/bin/logs/zone/zone*.log
cd build/bin && ./zone
# Runs world binary
.PHONY: world
world:
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
@make -C ../ -f .devcontainer/Makefile world --no-print-directory
exit
endif
@-rm build/bin/logs/world*.log
cd build/bin && ./world
# Runs ucs binary
.PHONY: ucs
ucs:
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
@make -C ../ -f .devcontainer/Makefile ucs --no-print-directory
exit
endif
@-rm build/bin/logs/ucs*.log
cd build/bin && ./ucs
# Runs queryserv binary
.PHONY: queryserv
queryserv:
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
@make -C ../ -f .devcontainer/Makefile queryserv --no-print-directory
exit
endif
@-rm build/bin/logs/query_server*.log
cd build/bin && ./queryserv
valgrind-%:
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
@make -C ../ -f .devcontainer/Makefile valgrind --no-print-directory
exit
endif
cd build/bin && valgrind --leak-check=full --show-leak-kinds=all --track-origins=yes --verbose --log-file=logs/$*.valgrind.log ./$*
# Start mariaDB standalone
.PHONY: mariadb
mariadb:
@sudo service mariadb start
.PHONY: inject-mariadb
inject-mariadb:
-sudo service mariadb start
-mkdir -p base/db/
-sudo mariadb -e 'DROP DATABASE IF EXISTS peq;'
-sudo mariadb -e 'CREATE DATABASE peq;'
-sudo mariadb -e "CREATE USER 'peq'@'127.0.0.1' IDENTIFIED BY 'peqpass';"
-sudo mariadb -e "GRANT ALL PRIVILEGES ON *.* TO 'peq'@'127.0.0.1';"
ifeq (,$(wildcard base/db/db.sql.zip))
@echo "base/db.sql.zip not found. Downloading latest from https://db.projecteq.net/"
wget -nc https://db.projecteq.net/latest -O base/db/db.sql.zip
-cd base/db && unzip db.sql.zip
endif
@echo "Sourcing db may take a while, please wait..."
@cd base/db/peq-dump && sudo mariadb --database peq -e "source create_all_tables.sql"
@echo "MariaDB is now injected."
.PHONY: gm-%
gm-%:
sudo mariadb --database peq -e "UPDATE account SET status=255 WHERE name = '$*';"
@echo "Account $* is now a GM. /camp to have it go into effect."
depends:
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
@make -C ../ -f .devcontainer/Makefile depends --no-print-directory
exit
endif
sudo apt install graphviz pip time
pip3 install graphviz
mkdir -p build/depends
@if [ ! -f "build/depends/dependency_graph.py" ]; then \
wget https://raw.githubusercontent.com/pvigier/dependency-graph/master/dependency_graph.py -O build/depends/dependency_graph.py; \
fi
@echo "Generating dependency graphs (This may take a while)..."
@echo "Login..."
time python3 build/depends/dependency_graph.py -f png login build/depends/login.dot
@echo "World..."
time python3 build/depends/dependency_graph.py -f png world build/depends/world.dot
@echo "Zone..."
time python3 build/depends/dependency_graph.py -f png zone build/depends/zone.dot
@echo "Common..."
time python3 build/depends/dependency_graph.py -f png common build/depends/common.dot
backup:
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
@make -C ../ -f .devcontainer/Makefile backup --no-print-directory
exit
endif
@mkdir -p build/bin/backup
cd build/bin && ./world database:dump --compress --player-tables --state-tables --system-tables --query-serv-tables
cpu-zone:
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
@make -C ../ -f .devcontainer/Makefile cpu-zone --no-print-directory
exit
endif
@cd build/bin && mkdir -p tmp
cd build/bin && CPUPROFILE=prof.out ./zone
pprof-zone:
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
@make -C ../ -f .devcontainer/Makefile pprof-zone --no-print-directory
exit
endif
cd build/bin && google-pprof --pdf zone prof.out > prof.pdf
pprof-web-zone:
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
@make -C ../ -f .devcontainer/Makefile pprof-web-zone --no-print-directory
exit
endif
cd build/bin && google-pprof --web zone prof.out
pprof-gv-zone:
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
@make -C ../ -f .devcontainer/Makefile pprof-gv-zone --no-print-directory
exit
endif
cd build/bin && google-pprof --gv zone prof.out > prof.gv
heap-zone:
ifeq ($(findstring .devcontainer,$(CURDIR)),.devcontainer)
@make -C ../ -f .devcontainer/Makefile heap-zone --no-print-directory
exit
endif
@cd build/bin && mkdir -p tmp
cd build/bin && HEAPPROFILE=prof.out ./zone
-73
View File
@@ -1,73 +0,0 @@
{
"server": {
"zones": {
"defaultstatus": "0",
"ports": {
"low": "7000",
"high": "7400"
}
},
"qsdatabase": {
"host": "127.0.0.1",
"port": "3306",
"username": "peq",
"password": "peqpass",
"db": "peq"
},
"chatserver": {
"port": "7778",
"host": ""
},
"mailserver": {
"host": "",
"port": "7778"
},
"webinterface": {
"port": "9081"
},
"world": {
"longname": "New Devbox",
"address": "192.168.1.100",
"localaddress": "192.168.1.100",
"loginserver1": {
"account": "",
"password": "",
"legacy": 0,
"host": "login.projecteq.net",
"port": "5998"
},
"tcp": {
"ip": "127.0.0.1",
"port": "9001"
},
"telnet": {
"ip": "0.0.0.0",
"port": "9000",
"enabled": "true"
},
"key": "random-generate-here",
"http": {
"port": "9080",
"enabled": "true",
"mimefile": "mime.types"
},
"shortname": "dev"
},
"database": {
"db": "peq",
"host": "127.0.0.1",
"port": "3306",
"username": "peq",
"password": "peqpass"
},
"files": {
"opcodes": "assets/patches/opcodes.conf",
"mail_opcodes": "assets/patches/mail_opcodes.conf"
},
"directories": {
"patches": "assets/patches/",
"opcodes": "assets/patches/",
"plugins": "quests/plugins/"
}
}
}
-37
View File
@@ -1,37 +0,0 @@
{
"database": {
"host": "127.0.0.1",
"port": "3306",
"db": "peq",
"user": "peq",
"password": "peqpass"
},
"account": {
"auto_create_accounts": true
},
"worldservers": {
"unregistered_allowed": true,
"reject_duplicate_servers": false
},
"web_api": {
"enabled": true,
"port": 6000
},
"security": {
"mode": 14,
"allow_password_login": true,
"allow_token_login": true
},
"logging": {
"trace": false,
"world_trace": false,
"dump_packets_in": false,
"dump_packets_out": false
},
"client_configuration": {
"titanium_port": 5998,
"titanium_opcodes": "assets/patches/login_opcodes.conf",
"sod_port": 5999,
"sod_opcodes": "assets/patches/login_opcodes_sod.conf"
}
}
-49
View File
@@ -1,49 +0,0 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/ubuntu
{
"name": "eqemu",
"build": {
"dockerfile": "Dockerfile.debian.dev"
},
"appPort": [
"5998:5998/udp",
"7000:7000/udp",
"7001:7001/udp",
"7002:7002/udp",
"7003:7003/udp",
"7004:7004/udp",
"7005:7005/udp",
"9000:9000/udp",
"9001:9001/udp"
],
"forwardPorts": [
3306
],
"remoteEnv": {
"LOCALWSF": "${localWorkspaceFolder}",
"CONTAINERWSF": "${containerWorkspaceFolder}"
},
"containerUser": "vscode",
// add ptrace
"runArgs": [
"--cap-add=SYS_PTRACE",
"--security-opt",
"seccomp=unconfined"
],
"customizations": {
"vscode": {
"extensions": [
"ms-vscode.cpptools-extension-pack",
"vilicvane.sensitive-replace",
"maattdd.gitless",
"bibhasdn.unique-lines",
"GitHub.copilot",
"xackery.make-magic",
"Gruntfuggly.todo-tree",
"ms-vscode.cmake-tools"
]
}
},
"workspaceFolder": "/src",
"workspaceMount": "source=${localWorkspaceFolder},target=/src,type=bind,consistency=cached"
}
+3
View File
@@ -61,6 +61,9 @@ bin/
compile_flags.txt compile_flags.txt
.cache/ .cache/
# vscode generated settings
.vscode/
# Build pipeline # Build pipeline
!utils/scripts/build/ !utils/scripts/build/
!utils/scripts/build/should-release/should-release !utils/scripts/build/should-release/should-release
-23
View File
@@ -1,23 +0,0 @@
{
"configurations": [
{
"name": "Linux",
"includePath": [
"${default}",
"${workspaceFolder}/submodules/fmt/include",
"${workspaceFolder}/submodules/cereal/include",
"${workspaceFolder}/submodules/glm",
"${workspaceFolder}/submodules/libuv/include"
],
"defines": [
"LUA_EQEMU=1"
],
"compilerPath": "/usr/bin/gcc",
"cStandard": "c17",
"cppStandard": "gnu++17",
"intelliSenseMode": "linux-gcc-x64",
"configurationProvider": "ms-vscode.cmake-tools"
}
],
"version": 4
}
-173
View File
@@ -1,173 +0,0 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(gdb) attach",
"type": "cppdbg",
"request": "attach",
"program": "${workspaceFolder}/build/bin/world",
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
},
{
"name": "(gdb) shared_memory",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/bin/shared_memory",
"cwd": "${workspaceFolder}/build/bin",
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
},
{
"name": "(gdb) world",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/bin/world",
"cwd": "${workspaceFolder}/build/bin",
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
},
{
"name": "(gdb) zone",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/bin/zone",
"cwd": "${workspaceFolder}/build/bin",
"args": [
"",
],
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
},
{
"name": "(gdb) zone neriakb",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/bin/zone",
"cwd": "${workspaceFolder}/build/bin",
"args": [
"neriakb",
],
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
},
{
"name": "(gdb) login",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/bin/loginserver",
"cwd": "${workspaceFolder}/build/bin",
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
},
{
"name": "(gdb) ucs",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/bin/ucs",
"cwd": "${workspaceFolder}/build/bin",
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
},
{
"name": "(gdb) queryserv",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/bin/queryserv",
"cwd": "${workspaceFolder}/build/bin",
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
]
}
-136
View File
@@ -1,136 +0,0 @@
{
"editor.detectIndentation": false,
"editor.insertSpaces": false,
"editor.tabSize": 4,
"editor.autoIndent": "full",
"editor.trimAutoWhitespace": true,
"files.trimTrailingWhitespace": true,
//"editor.formatOnSave": true,
"search.exclude": {
"dependencies": false,
},
"C_Cpp.default.includePath": [
"/usr/include/x86_64-linux-gnu",
"/usr/include/lua5.2",
"/usr/include/mariadb",
"${workspaceFolder}/dependencies/curl_x64/include",
"${workspaceFolder}/dependencies/fmt/include",
"${workspaceFolder}/dependencies/glm",
"${workspaceFolder}/dependencies/libuv/include",
"${workspaceFolder}/dependencies/sol2",
"${workspaceFolder}/dependencies/zlibng"
],
"telemetry.enableTelemetry": false,
"cmake.buildDirectory": "${workspaceFolder}/build",
"cmake.configureArgs": [
"-DEQEMU_BUILD_LOGIN=ON",
"-DEQEMU_BUILD_TESTS=ON",
"-DCMAKE_CXX_COMPILER_LAUNCHER=ccache",
"-DEQEMU_ADD_PROFILER=ON",
"Ninja"
],
"cmake.skipConfigureIfCachePresent": true,
"cmake.configureOnOpen": false,
"files.associations": {
"*.ipp": "cpp",
"functional": "cpp",
"string": "cpp",
"iostream": "cpp",
"map": "cpp",
"fstream": "cpp",
"type_traits": "cpp",
"utility": "cpp",
"cstring": "cpp",
"*.tcc": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"csignal": "cpp",
"cstdarg": "cpp",
"cstddef": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"cwctype": "cpp",
"any": "cpp",
"array": "cpp",
"atomic": "cpp",
"strstream": "cpp",
"bit": "cpp",
"bitset": "cpp",
"chrono": "cpp",
"codecvt": "cpp",
"compare": "cpp",
"complex": "cpp",
"concepts": "cpp",
"condition_variable": "cpp",
"coroutine": "cpp",
"cstdint": "cpp",
"deque": "cpp",
"forward_list": "cpp",
"list": "cpp",
"set": "cpp",
"unordered_map": "cpp",
"unordered_set": "cpp",
"vector": "cpp",
"exception": "cpp",
"algorithm": "cpp",
"iterator": "cpp",
"memory": "cpp",
"memory_resource": "cpp",
"numeric": "cpp",
"optional": "cpp",
"random": "cpp",
"ratio": "cpp",
"regex": "cpp",
"source_location": "cpp",
"string_view": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"future": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"iosfwd": "cpp",
"istream": "cpp",
"limits": "cpp",
"mutex": "cpp",
"new": "cpp",
"numbers": "cpp",
"ostream": "cpp",
"semaphore": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"stop_token": "cpp",
"streambuf": "cpp",
"thread": "cpp",
"cfenv": "cpp",
"cinttypes": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"valarray": "cpp",
"variant": "cpp",
"csetjmp": "cpp",
"charconv": "cpp",
"format": "cpp",
"ranges": "cpp",
"span": "cpp"
},
"cmake.statusbar.advanced": {
"kit": {
"visibility": "hidden",
},
"debug": {
"visibility": "hidden",
},
"buildTarget": {
"visibility": "hidden",
},
"launch": {
"visibility": "hidden",
},
"ctest": {
"visibility": "icon",
}
}
}
-380
View File
@@ -1,383 +1,3 @@
## [22.50.0] 5/9/2024
### Code
* Fix Message in #find task ([#4270](https://github.com/EQEmu/Server/pull/4270)) @Kinglykrab 2024-04-19
### Combat
* Add rule to set stun duration. Add rule to add stun messages. ([#4284](https://github.com/EQEmu/Server/pull/4284)) @noudess 2024-04-25
### Commands
* Adjust #kill and #list Commands ([#4271](https://github.com/EQEmu/Server/pull/4271)) @Kinglykrab 2024-05-04
### Compiling
* Add profiler flag ([#4293](https://github.com/EQEmu/Server/pull/4293)) @xackery 2024-05-04
### Corpses
* Corpse searches for items did not search augs ([#4289](https://github.com/EQEmu/Server/pull/4289)) @noudess 2024-04-27
### Database
* Add Extra Haste to Bots/Character Tables ([#4286](https://github.com/EQEmu/Server/pull/4286)) @Kinglykrab 2024-05-04
* Break out changes to `npc_types` from parcels ([#4295](https://github.com/EQEmu/Server/pull/4295)) @joligario 2024-05-03
* Move pets query to content database ([#4296](https://github.com/EQEmu/Server/pull/4296)) @joligario 2024-05-04
### Doors
* Replace magic # in code with a field in doors table for when door closes. ([#4288](https://github.com/EQEmu/Server/pull/4288)) @noudess 2024-04-25
### Experience
* Add SetExp/SetAAExp lua mods ([#4292](https://github.com/EQEmu/Server/pull/4292)) @xackery 2024-05-04
### Feature
* Add Augmentation Support for Parcels ([#4285](https://github.com/EQEmu/Server/pull/4285)) @neckkola 2024-04-24
* Add Character Auto Login ([#4216](https://github.com/EQEmu/Server/pull/4216)) @Kinglykrab 2024-04-15
* Add Parcel Feature for RoF2 Clients ([#4198](https://github.com/EQEmu/Server/pull/4198)) @neckkola 2024-04-21
* Add `is_parcel_merchant` to #npcedit ([#4290](https://github.com/EQEmu/Server/pull/4290)) @Kinglykrab 2024-05-04
* Add devcontainer support ([#4294](https://github.com/EQEmu/Server/pull/4294)) @xackery 2024-05-09
* Fix ignore_default on lua mod damage ([#4228](https://github.com/EQEmu/Server/pull/4228)) @xackery 2024-04-15
### Fixes
* "GM flag" vs "GM Flag" @Akkadius 2024-05-04
* All NPC classes could stun with kick/only warriors could be stunned ([#4273](https://github.com/EQEmu/Server/pull/4273)) @noudess 2024-04-24
* Fix Account Flags Loading ([#4243](https://github.com/EQEmu/Server/pull/4243)) @Kinglykrab 2024-04-15
* Fix Corpses "Disappearing" ([#4275](https://github.com/EQEmu/Server/pull/4275)) @joligario 2024-04-21
* Fix Issue With Auto Login ([#4267](https://github.com/EQEmu/Server/pull/4267)) @Kinglykrab 2024-04-21
* Fix crash from #4266 @Akkadius 2024-05-05
* Fixes Issue 4257 - Double Taunt Message ([#4258](https://github.com/EQEmu/Server/pull/4258)) @fryguy503 2024-04-18
* GLAA fix after database.cpp updates ([#4277](https://github.com/EQEmu/Server/pull/4277)) @neckkola 2024-04-21
* GetSkill default return 0 @Akkadius 2024-05-05
* Hero forge armor bug on login and show helm toggle. ([#4246](https://github.com/EQEmu/Server/pull/4246)) @noudess 2024-04-15
* Perl__send_parcel GCC compile error @Akkadius 2024-05-05
* Remove food or water GM message @Akkadius 2024-05-05
* Revert GetSkill from #4234 @Akkadius 2024-05-05
* Fix for world crash with over 1500 guilds ([#4299](https://github.com/EQEmu/Server/pull/4299)) @neckkola 2024-05-09
### Hot Fix
* Update database_update_manifest.cpp ([#4291](https://github.com/EQEmu/Server/pull/4291)) @noudess 2024-04-29
### Loot
* Add content filtering to lootdrop_entries ([#4229](https://github.com/EQEmu/Server/pull/4229)) @Akkadius 2024-04-15
* Consolidate filtering logic ([#4280](https://github.com/EQEmu/Server/pull/4280)) @Akkadius 2024-04-21
### Lua
* Add IsImmuneToSpell Lua Mod ([#4278](https://github.com/EQEmu/Server/pull/4278)) @xackery 2024-04-28
* Add UpdatePersonalFaction Lua Mod ([#4279](https://github.com/EQEmu/Server/pull/4279)) @xackery 2024-05-04
### Messages
* Add GM Status and Invulnerability Messages ([#4266](https://github.com/EQEmu/Server/pull/4266)) @Kinglykrab 2024-05-04
* Fix bug where DoT messages stop coming out when mob dies. ([#4249](https://github.com/EQEmu/Server/pull/4249)) @noudess 2024-04-15
* Fix multiple errors in spell damage at death. ([#4264](https://github.com/EQEmu/Server/pull/4264)) @noudess 2024-04-28
### Performance
* Change skill_cap from vector to map ([#4252](https://github.com/EQEmu/Server/pull/4252)) @xackery 2024-04-15
### Pets
* Fix errors in sync with client of sit/stand ([#4245](https://github.com/EQEmu/Server/pull/4245)) @noudess 2024-04-15
### Quest API
* Add DescribeSpecialAbilities() to Perl/Lua ([#4269](https://github.com/EQEmu/Server/pull/4269)) @Kinglykrab 2024-04-21
* Add GetConsiderColor() to Perl/Lua ([#4253](https://github.com/EQEmu/Server/pull/4253)) @Kinglykrab 2024-04-15
* Add Parcel Sending to Perl/Lua ([#4287](https://github.com/EQEmu/Server/pull/4287)) @Kinglykrab 2024-05-04
* Add Zone Methods to Perl/Lua ([#4268](https://github.com/EQEmu/Server/pull/4268)) @Kinglykrab 2024-04-21
### Quests
* Hot Reload Changes ([#4302](https://github.com/EQEmu/Server/pull/4302)) @Akkadius 2024-05-09
* Reload Quests on Bootup, Init earlier ([#4298](https://github.com/EQEmu/Server/pull/4298)) @Akkadius 2024-05-05
### Spells
* Implemented SPA 122 SE_ReduceSkill ([#4234](https://github.com/EQEmu/Server/pull/4234)) @KayenEQ 2024-05-04
* Normal Group Spells (non-raid) landed twice on caster ([#4240](https://github.com/EQEmu/Server/pull/4240)) @noudess 2024-04-15
* SPA69 TotalHP can be used in Worn Slot, Fixes/Updates to Max HP related variables. ([#4244](https://github.com/EQEmu/Server/pull/4244)) @KayenEQ 2024-04-15
### Zone Instances
* Handle routing to instances when using evac/succor ([#4297](https://github.com/EQEmu/Server/pull/4297)) @joligario 2024-05-04
## [22.49.1] 4/15/2024
### Zoning
* Fix zone routing edge case ([#4255](https://github.com/EQEmu/Server/pull/4255)) @Akkadius 2024-04-15
## [22.49.0] 4/15/2024
### Code
* Avoid unnecessary copies in database functions ([#4220](https://github.com/EQEmu/Server/pull/4220)) @joligario 2024-03-29
* Reference type in `GetRaidLeaderName` ([#4218](https://github.com/EQEmu/Server/pull/4218)) @joligario 2024-03-28
* Remove unnecessary reference types ([#4212](https://github.com/EQEmu/Server/pull/4212)) @joligario 2024-03-28
### Crash
* Check mob pointer before trying to remove it ([#4230](https://github.com/EQEmu/Server/pull/4230)) @Akkadius 2024-04-01
### Feature
* Add Character Auto Login ([#4216](https://github.com/EQEmu/Server/pull/4216)) @Kinglykrab 2024-04-15
* Add LuaMod functions for CommonDamage and HealDamage ([#4227](https://github.com/EQEmu/Server/pull/4227)) @xackery 2024-03-31
* Add RegisterBug LuaMod ([#4209](https://github.com/EQEmu/Server/pull/4209)) @xackery 2024-03-30
* Additive Spell Focus from Worn slot with Limit Checks ([#4208](https://github.com/EQEmu/Server/pull/4208)) @KayenEQ 2024-03-30
* Fix ignore_default on lua mod damage ([#4228](https://github.com/EQEmu/Server/pull/4228)) @xackery 2024-04-15
### Fixes
* Client not updating HP bar when an HP Buff with a Heal is applied. ([#4237](https://github.com/EQEmu/Server/pull/4237)) @KayenEQ 2024-04-02
* Fix Account Flags Loading ([#4243](https://github.com/EQEmu/Server/pull/4243)) @Kinglykrab 2024-04-15
* Fix Auto Login Issue ([#4213](https://github.com/EQEmu/Server/pull/4213)) @Kinglykrab 2024-03-28
* Fix Bot Creation Issue ([#4235](https://github.com/EQEmu/Server/pull/4235)) @Kinglykrab 2024-04-02
* Fix Bot/Character ID Overlap in Groups ([#4093](https://github.com/EQEmu/Server/pull/4093)) @Kinglykrab 2024-03-23
* Fix Group Leadership ([#4214](https://github.com/EQEmu/Server/pull/4214)) @Kinglykrab 2024-03-28
* Fix Issue With Bot Raid Aggro ([#4222](https://github.com/EQEmu/Server/pull/4222)) @Kinglykrab 2024-03-31
* Fix Lua Crash with Spell Blocked Event ([#4236](https://github.com/EQEmu/Server/pull/4236)) @Kinglykrab 2024-04-01
* Fix Luabind Double Class Register ([#4219](https://github.com/EQEmu/Server/pull/4219)) @Kinglykrab 2024-03-29
* Fix crash in SendEnterWorld ([#4204](https://github.com/EQEmu/Server/pull/4204)) @Akkadius 2024-03-24
* Fix event_consider any_cast error ([#4210](https://github.com/EQEmu/Server/pull/4210)) @xackery 2024-03-27
* Fix fishing chances ([#4203](https://github.com/EQEmu/Server/pull/4203)) @joligario 2024-03-24
* Fix manifest for skill caps schema type ([#4231](https://github.com/EQEmu/Server/pull/4231)) @Akkadius 2024-04-02
* Hero forge armor bug on login and show helm toggle. ([#4246](https://github.com/EQEmu/Server/pull/4246)) @noudess 2024-04-15
* Radiant/Ebon Crystals should only extract to 1000 ([#4195](https://github.com/EQEmu/Server/pull/4195)) @fryguy503 2024-03-23
* SPA214 SE_MaxHPChange calculation errors corrected. ([#4238](https://github.com/EQEmu/Server/pull/4238)) @KayenEQ 2024-04-02
* Shared Tasks - charid is now character_id ([#4233](https://github.com/EQEmu/Server/pull/4233)) @fryguy503 2024-04-01
* Using %T in channel messages on fresh corpse yields mob, not corpse name. ([#4168](https://github.com/EQEmu/Server/pull/4168)) @noudess 2024-04-05
### Hot Fix
* Fix Group::AddToGroup ([#4201](https://github.com/EQEmu/Server/pull/4201)) @Kinglykrab 2024-03-23
* Hot Fix for Group::AddToGroup Hot Fix ([#4202](https://github.com/EQEmu/Server/pull/4202)) @Kinglykrab 2024-03-23
### Loot
* Add content filtering to lootdrop_entries ([#4229](https://github.com/EQEmu/Server/pull/4229)) @Akkadius 2024-04-15
### Lua
* Add Zone and Language Constants ([#4211](https://github.com/EQEmu/Server/pull/4211)) @fryguy503 2024-03-28
### Messages
* Fix bug where DoT messages stop coming out when mob dies. ([#4249](https://github.com/EQEmu/Server/pull/4249)) @noudess 2024-04-15
### Performance
* Change skill_cap from vector to map ([#4252](https://github.com/EQEmu/Server/pull/4252)) @xackery 2024-04-15
### Pets
* Fix errors in sync with client of sit/stand ([#4245](https://github.com/EQEmu/Server/pull/4245)) @noudess 2024-04-15
### Quest API
* Add Archetype Methods to Perl/Lua ([#4181](https://github.com/EQEmu/Server/pull/4181)) @Kinglykrab 2024-03-23
* Add Class/Deity/Race Methods to Perl/Lua ([#4215](https://github.com/EQEmu/Server/pull/4215)) @Kinglykrab 2024-03-28
* Add GetConsiderColor() to Perl/Lua ([#4253](https://github.com/EQEmu/Server/pull/4253)) @Kinglykrab 2024-04-15
* Add Spell Blocked Event to Perl/Lua ([#4217](https://github.com/EQEmu/Server/pull/4217)) @Kinglykrab 2024-04-01
### Quests
* Avoid Player and Bot quests in unloaded zone ([#4232](https://github.com/EQEmu/Server/pull/4232)) @hgtw 2024-04-01
### Repositories
* Convert database.cpp to Repositories ([#4054](https://github.com/EQEmu/Server/pull/4054)) @Kinglykrab 2024-03-24
### Skill Caps
* Further improvements ([#4205](https://github.com/EQEmu/Server/pull/4205)) @Akkadius 2024-03-24
* Remove from shared memory and simplify ([#4069](https://github.com/EQEmu/Server/pull/4069)) @Kinglykrab 2024-03-23
### Spells
* Implemented SPA 463 SE_SHIELD_TARGET ([#4224](https://github.com/EQEmu/Server/pull/4224)) @KayenEQ 2024-03-30
* Normal Group Spells (non-raid) landed twice on caster ([#4240](https://github.com/EQEmu/Server/pull/4240)) @noudess 2024-04-15
* SPA148 Stacking Fix ([#4206](https://github.com/EQEmu/Server/pull/4206)) @KayenEQ 2024-03-27
* SPA69 TotalHP can be used in Worn Slot, Fixes/Updates to Max HP related variables. ([#4244](https://github.com/EQEmu/Server/pull/4244)) @KayenEQ 2024-04-15
## [22.48.0] 3/23/2024
### Bots
* IsValidTarget Crash Fix ([#4187](https://github.com/EQEmu/Server/pull/4187)) @nytmyr 2024-03-12
* Move BotGroupSay to Pet Response ([#4171](https://github.com/EQEmu/Server/pull/4171)) @nytmyr 2024-03-08
### Code
* Cleanup Zone Get Methods ([#4169](https://github.com/EQEmu/Server/pull/4169)) @Kinglykrab 2024-03-09
### Fixes
* An Update to Xtarget to exclude Bot owned Temp/Swarm Pets ([#4172](https://github.com/EQEmu/Server/pull/4172)) @MortimerGreenwald 2024-03-08
* Fix #serverrules Command ([#4193](https://github.com/EQEmu/Server/pull/4193)) @Kinglykrab 2024-03-20
* Fix Bot Cloning ([#4186](https://github.com/EQEmu/Server/pull/4186)) @Kinglykrab 2024-03-17
* Fix Crash in ClientList::GetCLEIP ([#4173](https://github.com/EQEmu/Server/pull/4173)) @Kinglykrab 2024-03-10
* Fix Default Value in `rule_values` table ([#4166](https://github.com/EQEmu/Server/pull/4166)) @Kinglykrab 2024-03-07
* Fix EVENT_KILLED_MERIT firing before NPC removal ([#4185](https://github.com/EQEmu/Server/pull/4185)) @Kinglykrab 2024-03-17
* Fix Empty Groups When Removing Bots ([#4178](https://github.com/EQEmu/Server/pull/4178)) @Kinglykrab 2024-03-14
* Fix GetLeaderName() for Groups ([#4184](https://github.com/EQEmu/Server/pull/4184)) @Kinglykrab 2024-03-14
* Fix Mob::CalculateDistance(mob) Typo ([#4183](https://github.com/EQEmu/Server/pull/4183)) @Kinglykrab 2024-03-10
* Fix Proximity Say ([#4189](https://github.com/EQEmu/Server/pull/4189)) @Kinglykrab 2024-03-15
* Fix ScaleNPC() in Perl ([#4196](https://github.com/EQEmu/Server/pull/4196)) @Kinglykrab 2024-03-23
* Fix range_percent ([#4197](https://github.com/EQEmu/Server/pull/4197)) @Kinglykrab 2024-03-22
* Fix reusing timers ([#4199](https://github.com/EQEmu/Server/pull/4199)) @joligario 2024-03-23
### Hot Fix
* Add bool return to fix Client::RemoveAAPoints ([#4176](https://github.com/EQEmu/Server/pull/4176)) @Kinglykrab 2024-03-09
### Loot
* Fix issue with nested data being loaded multiple times ([#4192](https://github.com/EQEmu/Server/pull/4192)) @Akkadius 2024-03-23
### Misc
* Windows preprocessor define in crash.cpp ([#4191](https://github.com/EQEmu/Server/pull/4191)) @joligario 2024-03-23
### Quest API
* Add Buff Support to Perl/Lua ([#4182](https://github.com/EQEmu/Server/pull/4182)) @Kinglykrab 2024-03-14
* Add DeleteBot() to Perl/Lua ([#4167](https://github.com/EQEmu/Server/pull/4167)) @nytmyr 2024-03-07
* Add GetDeityName() to Perl/Lua ([#4180](https://github.com/EQEmu/Server/pull/4180)) @Kinglykrab 2024-03-14
* Add RemoveAAPoints() and AA Loss Event to Perl/Lua ([#4174](https://github.com/EQEmu/Server/pull/4174)) @Kinglykrab 2024-03-09
* Add RemoveAlternateCurrencyValue() to Perl/Lua ([#4190](https://github.com/EQEmu/Server/pull/4190)) @Kinglykrab 2024-03-17
* Add Restore Methods for Health, Mana, and Endurance to Perl/Lua ([#4179](https://github.com/EQEmu/Server/pull/4179)) @Kinglykrab 2024-03-23
* Add Silent Saylink Methods to Perl/Lua ([#4177](https://github.com/EQEmu/Server/pull/4177)) @Kinglykrab 2024-03-14
### Rules
* Add World:Rules Rule ([#4194](https://github.com/EQEmu/Server/pull/4194)) @Kinglykrab 2024-03-23
### Tradeskills
* Implement learning recipes from books ([#4170](https://github.com/EQEmu/Server/pull/4170)) @hgtw 2024-03-23
## [22.47.0] 3/5/2024
### Crash Fix
* Added a guild_mgr check ([#4163](https://github.com/EQEmu/Server/pull/4163)) @neckkola 2024-03-06
* Goto Command could crash using Developer Tools ([#4158](https://github.com/EQEmu/Server/pull/4158)) @neckkola 2024-03-04
* Groundspawn Memory Corruption ([#4157](https://github.com/EQEmu/Server/pull/4157)) @neckkola 2024-03-04
* Update to location of qGlobals initialization ([#4144](https://github.com/EQEmu/Server/pull/4144)) @neckkola 2024-03-02
### Feature
* Adds rules to control level requirements for Double Backstab, Assassinate, and Double Bowshot (#4159) ([#29](https://github.com/EQEmu/Server/pull/29)) @catapultam-habeo 2024-03-04
* Adjust String-based Rules Length ([#4138](https://github.com/EQEmu/Server/pull/4138)) @Kinglykrab 2024-03-06
* Exempt a zone from IP-limit checks. ([#4137](https://github.com/EQEmu/Server/pull/4137)) @catapultam-habeo 2024-03-02
### Fixes
* Add id to the guild_bank table ([#4155](https://github.com/EQEmu/Server/pull/4155)) @neckkola 2024-03-05
* Fix Bots/Bot Pets ending up on XTargets ([#4132](https://github.com/EQEmu/Server/pull/4132)) @Kinglykrab 2024-03-02
* Fix Character EXP Modifiers default ([#4161](https://github.com/EQEmu/Server/pull/4161)) @Kinglykrab 2024-03-06
* Fix Spawns Not Parsing Quest on Zone Bootup ([#4149](https://github.com/EQEmu/Server/pull/4149)) @Kinglykrab 2024-03-05
* Fix typo when updating spawn events in spawn condition manager ([#4160](https://github.com/EQEmu/Server/pull/4160)) @joligario 2024-03-05
* GetBotNameByID Temporary Reference Warning ([#4145](https://github.com/EQEmu/Server/pull/4145)) @Kinglykrab 2024-03-02
* Prevent NPE when creating DZ using ad-hoc version IDs ([#4141](https://github.com/EQEmu/Server/pull/4141)) @catapultam-habeo 2024-03-05
* Update FreeGuildID Routine ([#4143](https://github.com/EQEmu/Server/pull/4143)) @neckkola 2024-03-02
### Quest API
* Add Bot Special Attacks for Immune Aggro/Damage ([#4108](https://github.com/EQEmu/Server/pull/4108)) @Kinglykrab 2024-03-02
* Add GetHeroicStrikethrough() to Perl/Lua ([#4150](https://github.com/EQEmu/Server/pull/4150)) @Kinglykrab 2024-03-03
* Add IsAlwaysAggro() to Perl/Lua ([#4152](https://github.com/EQEmu/Server/pull/4152)) @Kinglykrab 2024-03-04
* Add IsBoat()/IsControllableBoat() to Perl/Lua ([#4151](https://github.com/EQEmu/Server/pull/4151)) @Kinglykrab 2024-03-03
* Add IsDestructibleObject() to Perl/Lua ([#4153](https://github.com/EQEmu/Server/pull/4153)) @Kinglykrab 2024-03-03
### Zone
* Zone Routing Improvements ([#4142](https://github.com/EQEmu/Server/pull/4142)) @Akkadius 2024-03-02
### Zoning
* Zone routing adjustment ([#4162](https://github.com/EQEmu/Server/pull/4162)) @Akkadius 2024-03-06
## [22.46.1] 3/2/2024
### Fixes
* Change `UnburyCorpse` to use repository methods ([#4147](https://github.com/EQEmu/Server/pull/4147)) @joligario 2024-03-03
## [22.46.0] 3/2/2024
### Commands
* Add #fish Command ([#4136](https://github.com/EQEmu/Server/pull/4136)) @Kinglykrab 2024-03-01
### Crash Fix
* Raid::UpdateGroupAAs ([#4139](https://github.com/EQEmu/Server/pull/4139)) @neckkola 2024-03-02
* Update to location of qGlobals initialization ([#4144](https://github.com/EQEmu/Server/pull/4144)) @neckkola 2024-03-02
### Feature
* Exempt a zone from IP-limit checks. ([#4137](https://github.com/EQEmu/Server/pull/4137)) @catapultam-habeo 2024-03-02
### Fixes
* Cleanup NPC Mana Tap Logic ([#4134](https://github.com/EQEmu/Server/pull/4134)) @noudess 2024-03-02
* Fix Bots/Bot Pets ending up on XTargets ([#4132](https://github.com/EQEmu/Server/pull/4132)) @Kinglykrab 2024-03-02
* Fix issue with NPC Secondary Textures ([#4129](https://github.com/EQEmu/Server/pull/4129)) @Kinglykrab 2024-03-01
* GetBotNameByID Temporary Reference Warning ([#4145](https://github.com/EQEmu/Server/pull/4145)) @Kinglykrab 2024-03-02
* Update FreeGuildID Routine ([#4143](https://github.com/EQEmu/Server/pull/4143)) @neckkola 2024-03-02
* Use std::clamp for Mob::ChangeSize ([#4140](https://github.com/EQEmu/Server/pull/4140)) @joligario 2024-03-02
### Quest API
* Add Bot Special Attacks for Immune Aggro/Damage ([#4108](https://github.com/EQEmu/Server/pull/4108)) @Kinglykrab 2024-03-02
### Zone
* Zone Routing Improvements ([#4142](https://github.com/EQEmu/Server/pull/4142)) @Akkadius 2024-03-02
## [22.45.1] 2/29/2024
### Character Creation
* Improved Random Name Generator ([#4081](https://github.com/EQEmu/Server/pull/4081)) @catapultam-habeo 2024-02-27
### Code
* Fix Server Rules Documentation Generation ([#4125](https://github.com/EQEmu/Server/pull/4125)) @Kinglykrab 2024-02-26
* Remove unnecessary stoptimer logs ([#4128](https://github.com/EQEmu/Server/pull/4128)) @Kinglykrab 2024-02-28
### Commands
* Add `#forage` command ([#4133](https://github.com/EQEmu/Server/pull/4133)) @joligario 2024-02-29
### Crash
* Fix crash issue during database dump ([#4127](https://github.com/EQEmu/Server/pull/4127)) @Akkadius 2024-02-29
### Crash Fix
* D20 crash if mitigation average resulted in 0 ([#4131](https://github.com/EQEmu/Server/pull/4131)) @nytmyr 2024-02-29
### Fixes
* Fix forage returning first result from table ([#4130](https://github.com/EQEmu/Server/pull/4130)) @nytmyr 2024-02-29
* Who /all displays incorrect guild name ([#4123](https://github.com/EQEmu/Server/pull/4123)) @neckkola 2024-02-25
### Quest API
* Add Pet Owner Methods to Perl/Lua ([#4115](https://github.com/EQEmu/Server/pull/4115)) @Kinglykrab 2024-02-25
## [22.45.0] 2/24/2024 ## [22.45.0] 2/24/2024
### Beacon ### Beacon
-7
View File
@@ -31,13 +31,6 @@ IF (EQEMU_BUILD_STATIC)
ENDIF () ENDIF ()
ENDIF (EQEMU_BUILD_STATIC) ENDIF (EQEMU_BUILD_STATIC)
# Requires libgoogle-perftools-dev google-perftools packages for linux (debian)
IF(EQEMU_ADD_PROFILER)
SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--no-as-needed,-lprofiler,--as-needed")
ENDIF(EQEMU_ADD_PROFILER)
IF(MSVC) IF(MSVC)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS) ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS)
ADD_DEFINITIONS(-DNOMINMAX) ADD_DEFINITIONS(-DNOMINMAX)
+49 -48
View File
@@ -29,15 +29,11 @@
#include "../../common/content/world_content_service.h" #include "../../common/content/world_content_service.h"
#include "../../common/zone_store.h" #include "../../common/zone_store.h"
#include "../../common/path_manager.h" #include "../../common/path_manager.h"
#include "../../common/repositories/skill_caps_repository.h"
#include "../../common/file.h"
#include "../../common/events/player_event_logs.h"
EQEmuLogSys LogSys; EQEmuLogSys LogSys;
WorldContentService content_service; WorldContentService content_service;
ZoneStore zone_store; ZoneStore zone_store;
PathManager path; PathManager path;
PlayerEventLogs player_event_logs;
void ExportSpells(SharedDatabase *db); void ExportSpells(SharedDatabase *db);
void ExportSkillCaps(SharedDatabase *db); void ExportSkillCaps(SharedDatabase *db);
@@ -168,76 +164,81 @@ void ExportSpells(SharedDatabase *db)
fclose(f); fclose(f);
} }
bool SkillUsable(SharedDatabase* db, int skill_id, int class_id) bool SkillUsable(SharedDatabase *db, int skill_id, int class_id)
{ {
const auto& l = SkillCapsRepository::GetWhere(
*db,
fmt::format(
"`class_id` = {} AND `skill_id` = {} ORDER BY `cap` DESC LIMIT 1",
class_id,
skill_id
)
);
return !l.empty(); bool res = false;
std::string query = StringFormat(
"SELECT max(cap) FROM skill_caps WHERE class=%d AND skillID=%d",
class_id, skill_id
);
auto results = db->QueryDatabase(query);
if (!results.Success()) {
return false;
}
if (results.RowCount() == 0) {
return false;
}
auto row = results.begin();
if (row[0] && Strings::ToInt(row[0]) > 0) {
return true;
}
return false;
} }
uint32 GetSkill(SharedDatabase* db, int skill_id, int class_id, int level) int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level)
{ {
const auto& l = SkillCapsRepository::GetWhere(
*db,
fmt::format(
"`class_id` = {} AND `skill_id` = {} AND `level` = {}",
class_id,
skill_id,
level
)
);
if (l.empty()) { std::string query = StringFormat(
"SELECT cap FROM skill_caps WHERE class=%d AND skillID=%d AND level=%d",
class_id, skill_id, level
);
auto results = db->QueryDatabase(query);
if (!results.Success()) {
return 0; return 0;
} }
auto e = l.front(); if (results.RowCount() == 0) {
return 0;
}
return e.cap; auto row = results.begin();
return Strings::ToInt(row[0]);
} }
void ExportSkillCaps(SharedDatabase* db) void ExportSkillCaps(SharedDatabase *db)
{ {
LogInfo("Exporting Skill Caps"); LogInfo("Exporting Skill Caps");
std::ofstream file(fmt::format("{}/export/SkillCaps.txt", path.GetServerPath())); std::string file = fmt::format("{}/export/SkillCaps.txt", path.GetServerPath());
if (!file || !file.is_open()) { FILE *f = fopen(file.c_str(), "w");
if (!f) {
LogError("Unable to open export/SkillCaps.txt to write, skipping."); LogError("Unable to open export/SkillCaps.txt to write, skipping.");
return; return;
} }
const uint8 skill_cap_max_level = ( for (int cl = 1; cl <= 16; ++cl) {
RuleI(Character, SkillCapMaxLevel) > 0 ? for (int skill = 0; skill <= 77; ++skill) {
RuleI(Character, SkillCapMaxLevel) : if (SkillUsable(db, skill, cl)) {
RuleI(Character, MaxLevel) int previous_cap = 0;
); for (int level = 1; level <= 100; ++level) {
int cap = GetSkill(db, skill, cl, level);
for (uint8 class_id = Class::Warrior; class_id <= Class::Berserker; class_id++) {
for (uint8 skill_id = EQ::skills::Skill1HBlunt; skill_id <= EQ::skills::Skill2HPiercing; skill_id++) {
if (SkillUsable(db, skill_id, class_id)) {
uint32 previous_cap = 0;
for (uint8 level = 1; level <= skill_cap_max_level; level++) {
uint32 cap = GetSkill(db, skill_id, class_id, level);
if (cap < previous_cap) { if (cap < previous_cap) {
cap = previous_cap; cap = previous_cap;
} }
file << fmt::format("{}^{}^{}^{}^0", class_id, skill_id, level, cap) << std::endl; fprintf(f, "%d^%d^%d^%d^0\n", cl, skill, level, cap);
previous_cap = cap; previous_cap = cap;
} }
} }
} }
} }
file.close(); fclose(f);
} }
void ExportBaseData(SharedDatabase *db) void ExportBaseData(SharedDatabase *db)
+3 -5
View File
@@ -29,13 +29,11 @@
#include "../../common/path_manager.h" #include "../../common/path_manager.h"
#include "../../common/repositories/base_data_repository.h" #include "../../common/repositories/base_data_repository.h"
#include "../../common/file.h" #include "../../common/file.h"
#include "../../common/events/player_event_logs.h"
EQEmuLogSys LogSys; EQEmuLogSys LogSys;
WorldContentService content_service; WorldContentService content_service;
ZoneStore zone_store; ZoneStore zone_store;
PathManager path; PathManager path;
PlayerEventLogs player_event_logs;
void ImportSpells(SharedDatabase *db); void ImportSpells(SharedDatabase *db);
void ImportSkillCaps(SharedDatabase *db); void ImportSkillCaps(SharedDatabase *db);
+9 -13
View File
@@ -83,7 +83,6 @@ SET(common_sources
shared_tasks.cpp shared_tasks.cpp
shareddb.cpp shareddb.cpp
skills.cpp skills.cpp
skill_caps.cpp
spdat.cpp spdat.cpp
strings.cpp strings.cpp
struct_strategy.cpp struct_strategy.cpp
@@ -177,7 +176,6 @@ SET(repositories
repositories/base/base_character_leadership_abilities_repository.h repositories/base/base_character_leadership_abilities_repository.h
repositories/base/base_character_material_repository.h repositories/base/base_character_material_repository.h
repositories/base/base_character_memmed_spells_repository.h repositories/base/base_character_memmed_spells_repository.h
repositories/base/base_character_parcels_repository.h
repositories/base/base_character_peqzone_flags_repository.h repositories/base/base_character_peqzone_flags_repository.h
repositories/base/base_character_pet_buffs_repository.h repositories/base/base_character_pet_buffs_repository.h
repositories/base/base_character_pet_info_repository.h repositories/base/base_character_pet_info_repository.h
@@ -358,7 +356,6 @@ SET(repositories
repositories/character_leadership_abilities_repository.h repositories/character_leadership_abilities_repository.h
repositories/character_material_repository.h repositories/character_material_repository.h
repositories/character_memmed_spells_repository.h repositories/character_memmed_spells_repository.h
repositories/character_parcels_repository.h
repositories/character_peqzone_flags_repository.h repositories/character_peqzone_flags_repository.h
repositories/character_pet_buffs_repository.h repositories/character_pet_buffs_repository.h
repositories/character_pet_info_repository.h repositories/character_pet_info_repository.h
@@ -495,7 +492,7 @@ SET(repositories
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
@@ -595,7 +592,7 @@ SET(common_headers
ptimer.h ptimer.h
queue.h queue.h
races.h races.h
raid.h raid.h
random.h random.h
rdtsc.h rdtsc.h
rulesys.h rulesys.h
@@ -609,7 +606,6 @@ SET(common_headers
shared_tasks.h shared_tasks.h
shareddb.h shareddb.h
skills.h skills.h
skill_caps.h
spdat.h spdat.h
strings.h strings.h
struct_strategy.h struct_strategy.h
@@ -685,13 +681,13 @@ 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
@@ -728,7 +724,7 @@ SOURCE_GROUP(Net FILES
net/websocket_server.h net/websocket_server.h
net/websocket_server_connection.cpp net/websocket_server_connection.cpp
net/websocket_server_connection.h net/websocket_server_connection.h
) )
SOURCE_GROUP(Patches FILES SOURCE_GROUP(Patches FILES
patches/patches.h patches/patches.h
@@ -772,12 +768,12 @@ SOURCE_GROUP(Patches FILES
patches/titanium_limits.cpp patches/titanium_limits.cpp
patches/uf.cpp patches/uf.cpp
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
@@ -785,7 +781,7 @@ SOURCE_GROUP(Util FILES
util/directory.h util/directory.h
util/uuid.cpp util/uuid.cpp
util/uuid.h util/uuid.h
) )
INCLUDE_DIRECTORIES(Patches SocketLib StackWalker) INCLUDE_DIRECTORIES(Patches SocketLib StackWalker)
@@ -798,6 +794,6 @@ ENDIF (UNIX)
IF (WIN32 AND EQEMU_BUILD_PCH) IF (WIN32 AND EQEMU_BUILD_PCH)
TARGET_PRECOMPILE_HEADERS(common PRIVATE pch/pch.h) TARGET_PRECOMPILE_HEADERS(common PRIVATE pch/pch.h)
ENDIF () ENDIF()
SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
+42 -93
View File
@@ -178,13 +178,12 @@ void WorldContentService::ReloadContentFlags()
LogInfo( LogInfo(
"Loaded content flag [{}] [{}]", "Loaded content flag [{}] [{}]",
f.flag_name, f.flag_name,
(f.enabled ? "enabled" : "disabled") (f.enabled ? "Enabled" : "Disabled")
); );
} }
SetContentFlags(set_content_flags); SetContentFlags(set_content_flags);
LoadZones(); SetContentZones(ZoneRepository::All(*m_content_database));
LoadStaticGlobalZoneInstances();
} }
Database *WorldContentService::GetDatabase() const Database *WorldContentService::GetDatabase() const
@@ -236,6 +235,19 @@ void WorldContentService::SetContentFlag(const std::string &content_flag_name, b
ReloadContentFlags(); ReloadContentFlags();
} }
// SetZones sets the zones for the world content service
// this is used for zone routing middleware
// we pull the zone list from the zone repository and feed from the zone store for now
// we're holding a copy in the content service - but we're talking 250kb of data in memory to handle routing of zoning
WorldContentService *WorldContentService::SetContentZones(const std::vector<BaseZoneRepository::Zone>& zones)
{
m_zones = zones;
LogInfo("Loaded [{}] zones", m_zones.size());
return this;
}
// HandleZoneRoutingMiddleware is meant to handle content and context aware zone routing // HandleZoneRoutingMiddleware is meant to handle content and context aware zone routing
// //
// example # 1 // example # 1
@@ -248,57 +260,16 @@ void WorldContentService::SetContentFlag(const std::string &content_flag_name, b
// scripts handle all the same way, you don't have to think about instances, the middleware will handle the magic // scripts handle all the same way, you don't have to think about instances, the middleware will handle the magic
// the versions of zones are represented by two zone entries that have potentially different min/max expansion and/or different content flags // the versions of zones are represented by two zone entries that have potentially different min/max expansion and/or different content flags
// we decide to route the client to the correct version of the zone based on the current server side expansion // we decide to route the client to the correct version of the zone based on the current server side expansion
// example # 2
void WorldContentService::HandleZoneRoutingMiddleware(ZoneChange_Struct *zc) void WorldContentService::HandleZoneRoutingMiddleware(ZoneChange_Struct *zc)
{ {
auto r = FindZone(zc->zoneID, zc->instanceID); // if we're already in an instance, we don't want to route the player to another instance
if (r.zone_id == 0) { if (zc->instanceID > 0) {
return; return;
} }
zc->instanceID = r.instance.id;
}
// LoadStaticGlobalZoneInstances loads all static global zone instances
// these are zones that are never set to expire and are global
// these are used commonly in v1/v2/v3 versions of the same zone for expansion routing
WorldContentService * WorldContentService::LoadStaticGlobalZoneInstances()
{
m_zone_instances = InstanceListRepository::GetWhere(*GetDatabase(), fmt::format("never_expires = 1 AND is_global = 1"));
LogInfo("Loaded [{}] zone_instances", m_zone_instances.size());
return this;
}
// LoadZones sets the zones for the world content service
// this is used for zone routing middleware
// we pull the zone list from the zone repository and feed from the zone store for now
// we're holding a copy in the content service - but we're talking 250kb of data in memory to handle routing of zoning
WorldContentService * WorldContentService::LoadZones()
{
m_zones = ZoneRepository::All(*GetContentDatabase());
LogInfo("Loaded [{}] zones", m_zones.size());
return this;
}
// FindZone is critical to the zone routing middleware and any logic that needs to route players to the correct zone
// era contextual routing, multiple version of zones, etc
WorldContentService::FindZoneResult WorldContentService::FindZone(uint32 zone_id, uint32 instance_id)
{
// if there's an active dynamic instance, we don't need to route
if (instance_id > 0) {
auto inst = InstanceListRepository::FindOne(*GetDatabase(), instance_id);
if (inst.id != 0 && !inst.is_global && !inst.never_expires) {
return WorldContentService::FindZoneResult{
.zone_id = 0,
};
}
}
for (auto &z: m_zones) { for (auto &z: m_zones) {
if (z.zoneidnumber == zone_id) { if (z.zoneidnumber == zc->zoneID) {
auto f = ContentFlags{ auto f = ContentFlags{
.min_expansion = z.min_expansion, .min_expansion = z.min_expansion,
.max_expansion = z.max_expansion, .max_expansion = z.max_expansion,
@@ -315,55 +286,33 @@ WorldContentService::FindZoneResult WorldContentService::FindZone(uint32 zone_id
z.long_name z.long_name
); );
// first pass, explicit match on public static global zone instances auto instances = InstanceListRepository::GetWhere(
for (auto &i: m_zone_instances) { *GetDatabase(),
if (i.zone == zone_id && i.version == z.version) { fmt::format(
LogInfo( "zone = {} AND version = {} AND never_expires = 1 AND is_global = 1",
"Routed player to instance [{}] of zone [{}] ({}) version [{}] long_name [{}] notes [{}]", z.zoneidnumber,
i.id, z.version
z.short_name, )
z.zoneidnumber,
z.version,
z.long_name,
i.notes
);
return WorldContentService::FindZoneResult{
.zone_id = static_cast<uint32>(z.zoneidnumber),
.instance = i,
.zone = z
};
}
}
LogInfo(
"Routed player to non-instance zone [{}] ({}) version [{}] long_name [{}] notes [{}]",
z.short_name,
z.zoneidnumber,
z.version,
z.long_name,
z.note
); );
return WorldContentService::FindZoneResult{ if (!instances.empty()) {
.zone_id = static_cast<uint32>(z.zoneidnumber), auto instance = instances.front();
.instance = InstanceListRepository::NewEntity(), zc->instanceID = instance.id;
.zone = z
}; LogInfo(
"Routed player to instance [{}] of zone [{}] ({}) version [{}] long_name [{}] notes [{}]",
instance.id,
z.short_name,
z.zoneidnumber,
z.version,
z.long_name,
instance.notes
);
break;
}
} }
} }
} }
return WorldContentService::FindZoneResult{.zone_id = 0};
} }
bool WorldContentService::IsInPublicStaticInstance(uint32 instance_id)
{
for (auto &i: m_zone_instances) {
if (i.id == instance_id) {
return true;
}
}
return false;
}
+1 -14
View File
@@ -5,7 +5,6 @@
#include <vector> #include <vector>
#include "../repositories/content_flags_repository.h" #include "../repositories/content_flags_repository.h"
#include "../repositories/zone_repository.h" #include "../repositories/zone_repository.h"
#include "../repositories/instance_list_repository.h"
class Database; class Database;
@@ -170,16 +169,7 @@ public:
void SetContentFlag(const std::string &content_flag_name, bool enabled); void SetContentFlag(const std::string &content_flag_name, bool enabled);
void HandleZoneRoutingMiddleware(ZoneChange_Struct *zc); void HandleZoneRoutingMiddleware(ZoneChange_Struct *zc);
WorldContentService * SetContentZones(const std::vector<ZoneRepository::Zone>& zones);
struct FindZoneResult {
uint32 zone_id = 0;
InstanceListRepository::InstanceList instance;
ZoneRepository::Zone zone;
};
FindZoneResult FindZone(uint32 zone_id, uint32 instance_id);
bool IsInPublicStaticInstance(uint32 instance_id);
private: private:
int current_expansion{}; int current_expansion{};
std::vector<ContentFlagsRepository::ContentFlags> content_flags; std::vector<ContentFlagsRepository::ContentFlags> content_flags;
@@ -190,9 +180,6 @@ private:
// holds a record of the zone table from the database // holds a record of the zone table from the database
std::vector<ZoneRepository::Zone> m_zones = {}; std::vector<ZoneRepository::Zone> m_zones = {};
WorldContentService *LoadStaticGlobalZoneInstances();
std::vector<InstanceListRepository::InstanceList> m_zone_instances;
WorldContentService * LoadZones();
}; };
extern WorldContentService content_service; extern WorldContentService content_service;
+1 -1
View File
@@ -15,7 +15,7 @@
#include <cstdio> #include <cstdio>
#include <vector> #include <vector>
#ifdef _WINDOWS #if WINDOWS
#define popen _popen #define popen _popen
#endif #endif
+1286 -1073
View File
File diff suppressed because it is too large Load Diff
+139 -148
View File
@@ -18,8 +18,8 @@
#ifndef EQEMU_DATABASE_H #ifndef EQEMU_DATABASE_H
#define EQEMU_DATABASE_H #define EQEMU_DATABASE_H
#define AUTHENTICATION_TIMEOUT 60 #define AUTHENTICATION_TIMEOUT 60
#define INVALID_ID 0xFFFFFFFF #define INVALID_ID 0xFFFFFFFF
#include "global_define.h" #include "global_define.h"
#include "eqemu_logsys.h" #include "eqemu_logsys.h"
@@ -38,7 +38,8 @@
class MySQLRequestResult; class MySQLRequestResult;
class Client; class Client;
namespace EQ { namespace EQ
{
class InventoryProfile; class InventoryProfile;
} }
@@ -51,11 +52,10 @@ struct npcDecayTimes_Struct {
struct VarCache_Struct { struct VarCache_Struct {
std::map<std::string, std::string> m_cache; std::map<std::string, std::string> m_cache;
uint32 last_update; uint32 last_update;
VarCache_Struct() : last_update(0) { } VarCache_Struct() : last_update(0) { }
void Add(const std::string& key, const std::string& value) { m_cache[key] = value; } void Add(const std::string &key, const std::string &value) { m_cache[key] = value; }
const std::string* Get(const std::string& key) const std::string *Get(const std::string &key) {
{
auto it = m_cache.find(key); auto it = m_cache.find(key);
return (it != m_cache.end() ? &it->second : nullptr); return (it != m_cache.end() ? &it->second : nullptr);
} }
@@ -76,33 +76,37 @@ class PTimerList;
#define SQL(...) #__VA_ARGS__ #define SQL(...) #__VA_ARGS__
class LogSettings;
class Database : public DBcore { class Database : public DBcore {
public: public:
Database(); Database();
Database( Database(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
const std::string& host, bool Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port, std::string connection_label = "default");
const std::string& user,
const std::string& password,
const std::string& database,
uint32 port
);
bool Connect(
const std::string& host,
const std::string& user,
const std::string& password,
const std::string& database,
uint32 port,
std::string connection_label = "default"
);
~Database(); ~Database();
/* Character Creation */ /* Character Creation */
bool DeleteCharacter(const std::string& name);
bool MoveCharacterToZone(const std::string& name, uint32 zone_id); bool CreateCharacter(
uint32 account_id,
char *name,
uint16 gender,
uint16 race,
uint16 class_,
uint8 str,
uint8 sta,
uint8 cha,
uint8 dex,
uint8 int_,
uint8 agi,
uint8 wis,
uint8 face
);
bool DeleteCharacter(char *character_name);
bool MoveCharacterToZone(const char *charname, uint32 zone_id);
bool MoveCharacterToZone(uint32 character_id, uint32 zone_id); bool MoveCharacterToZone(uint32 character_id, uint32 zone_id);
bool ReserveName(uint32 account_id, const std::string& name); bool ReserveName(uint32 account_id, char *name);
bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp); bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct *pp);
bool UpdateName(const std::string& old_name, const std::string& new_name); bool UpdateName(const char *oldname, const char *newname);
bool CopyCharacter( bool CopyCharacter(
const std::string& source_character_name, const std::string& source_character_name,
const std::string& destination_character_name, const std::string& destination_character_name,
@@ -110,174 +114,161 @@ public:
); );
/* General Information Queries */ /* General Information Queries */
bool AddBannedIP(const std::string& banned_ip, const std::string& notes); //Add IP address to the banned_ips table.
bool AddToNameFilter(const std::string& name);
bool CheckBannedIPs(const std::string& login_ip); //Check incoming connection against banned IP table.
bool CheckGMIPs(const std::string& login_ip, uint32 account_id);
bool CheckNameFilter(const std::string& name, bool surname = false);
bool IsNameUsed(const std::string& name);
uint32 GetAccountIDByChar(const std::string& name, uint32* character_id = 0); bool AddBannedIP(std::string banned_ip, std::string notes); //Add IP address to the banned_ips table.
uint32 GetAccountIDByChar(uint32 character_id); bool AddToNameFilter(std::string name);
uint32 GetAccountIDByName(const std::string& account_name, const std::string& loginserver, int16* status = 0, uint32* lsid = 0); bool CheckBannedIPs(std::string login_ip); //Check incoming connection against banned IP table.
uint32 GetCharacterID(const std::string& name); bool CheckGMIPs(std::string login_ip, uint32 account_id);
uint32 GetGuildIDByCharID(uint32 character_id); bool CheckNameFilter(std::string name, bool surname = false);
uint32 GetGroupIDByCharID(uint32 character_id); bool CheckUsedName(std::string name);
uint32 GetRaidIDByCharID(uint32 character_id);
const std::string GetAccountName(uint32 account_id, uint32* lsaccount_id = 0); uint32 GetAccountIDByChar(const char* charname, uint32* oCharID = 0);
const std::string GetCharName(uint32 character_id); uint32 GetAccountIDByChar(uint32 char_id);
const std::string GetCharNameByID(uint32 character_id); uint32 GetAccountIDByName(std::string account_name, std::string loginserver, int16* status = 0, uint32* lsid = 0);
const std::string GetNPCNameByID(uint32 npc_id); uint32 GetCharacterID(const std::string& name);
const std::string GetCleanNPCNameByID(uint32 npc_id); uint32 GetCharacterInfo(std::string character_name, uint32 *account_id, uint32 *zone_id, uint32 *instance_id);
void LoginIP(uint32 account_id, const std::string& login_ip); uint32 GetGuildIDByCharID(uint32 char_id);
uint32 GetGroupIDByCharID(uint32 char_id);
uint32 GetRaidIDByCharID(uint32 char_id);
void GetAccountName(uint32 accountid, char* name, uint32* oLSAccountID = 0);
void GetCharName(uint32 char_id, char* name);
std::string GetCharNameByID(uint32 char_id);
std::string GetNPCNameByID(uint32 npc_id);
std::string GetCleanNPCNameByID(uint32 npc_id);
void LoginIP(uint32 account_id, std::string login_ip);
/* Instancing */ /* Instancing */
bool AddClientToInstance(uint16 instance_id, uint32 character_id); bool AddClientToInstance(uint16 instance_id, uint32 character_id);
bool CheckInstanceByCharID(uint16 instance_id, uint32 character_id); bool CheckInstanceByCharID(uint16 instance_id, uint32 character_id);
bool CheckInstanceExists(uint16 instance_id); bool CheckInstanceExists(uint16 instance_id);
bool CheckInstanceExpired(uint16 instance_id); bool CheckInstanceExpired(uint16 instance_id);
bool CreateInstance(uint16 instance_id, uint32 zone_id, uint32 version, uint32 duration); bool CreateInstance(uint16 instance_id, uint32 zone_id, uint32 version, uint32 duration);
bool GetUnusedInstanceID(uint16& instance_id); bool GetUnusedInstanceID(uint16 &instance_id);
bool IsGlobalInstance(uint16 instance_id); bool IsGlobalInstance(uint16 instance_id);
bool RemoveClientFromInstance(uint16 instance_id, uint32 char_id); bool RemoveClientFromInstance(uint16 instance_id, uint32 char_id);
bool RemoveClientsFromInstance(uint16 instance_id); bool RemoveClientsFromInstance(uint16 instance_id);
bool VerifyInstanceAlive(uint16 instance_id, uint32 character_id); bool VerifyInstanceAlive(uint16 instance_id, uint32 character_id);
bool VerifyZoneInstance(uint32 zone_id, uint16 instance_id); bool VerifyZoneInstance(uint32 zone_id, uint16 instance_id);
uint16 GetInstanceID(uint32 zone, uint32 character_id, int16 version); uint16 GetInstanceID(uint32 zone, uint32 charid, int16 version);
std::vector<uint16> GetInstanceIDs(uint32 zone_id, uint32 character_id); std::vector<uint16> GetInstanceIDs(uint32 zone_id, uint32 character_id);
uint8_t GetInstanceVersion(uint16 instance_id); uint8_t GetInstanceVersion(uint16 instance_id);
uint32 GetTimeRemainingInstance(uint16 instance_id, bool& is_perma); uint32 GetTimeRemainingInstance(uint16 instance_id, bool &is_perma);
uint32 GetInstanceZoneID(uint16 instance_id); uint32 GetInstanceZoneID(uint16 instance_id);
void AssignGroupToInstance(uint32 group_id, uint32 instance_id); void AssignGroupToInstance(uint32 gid, uint32 instance_id);
void AssignRaidToInstance(uint32 raid_id, uint32 instance_id); void AssignRaidToInstance(uint32 rid, uint32 instance_id);
void DeleteInstance(uint16 instance_id); void DeleteInstance(uint16 instance_id);
void FlagInstanceByGroupLeader(uint32 zone_id, int16 version, uint32 character_id, uint32 group_id); void FlagInstanceByGroupLeader(uint32 zone_id, int16 version, uint32 charid, uint32 group_id);
void FlagInstanceByRaidLeader(uint32 zone_id, int16 version, uint32 character_id, uint32 raid_id); void FlagInstanceByRaidLeader(uint32 zone_id, int16 version, uint32 charid, uint32 raid_id);
void GetCharactersInInstance(uint16 instance_id, std::list<uint32>& character_ids); void GetCharactersInInstance(uint16 instance_id, std::list<uint32> &character_ids);
void PurgeExpiredInstances(); void PurgeExpiredInstances();
void SetInstanceDuration(uint16 instance_id, uint32 new_duration); void SetInstanceDuration(uint16 instance_id, uint32 new_duration);
void CleanupInstanceCorpses(); void CleanupInstanceCorpses();
/* Adventure related. */ /* Adventure related. */
void UpdateAdventureStatsEntry(uint32 character_id, uint8 theme_id, bool is_win = false, bool is_remove = false);
bool GetAdventureStats(uint32 character_id, AdventureStats_Struct* as); void UpdateAdventureStatsEntry(uint32 char_id, uint8 theme, bool win = false, bool remove = false);
bool GetAdventureStats(uint32 char_id, AdventureStats_Struct *as);
/* Account Related */ /* Account Related */
const std::string GetLiveChar(uint32 account_id);
bool SetAccountStatus(const std::string& account_name, int16 status);
bool SetLocalPassword(uint32 account_id, const std::string& password);
bool UpdateLiveChar(const std::string& name, uint32 account_id);
int16 CheckStatus(uint32 account_id);
void SetAccountCRCField(uint32 account_id, const std::string& field_name, uint64 checksum);
uint32 CheckLogin(const std::string& name, const std::string& password, const std::string& loginserver, int16* status = 0);
uint32 CreateAccount(
const std::string& name,
const std::string& password,
int16 status,
const std::string& loginserver,
uint32 lsaccount_id
);
uint32 GetAccountIDFromLSID(
const std::string& in_loginserver_id,
uint32 in_loginserver_account_id,
char* in_account_name = 0,
int16* in_status = 0
);
uint8 GetAgreementFlag(uint32 account_id); bool DeleteAccount(const char *name, const char* loginserver);
void SetAgreementFlag(uint32 account_id); bool GetLiveChar(uint32 account_id, char* cname);
bool SetAccountStatus(const char* name, int16 status);
bool SetAccountStatus(const std::string& account_name, int16 status);
bool SetLocalPassword(uint32 accid, const char* password);
bool UpdateLiveChar(char* charname, uint32 account_id);
int GetIPExemption(const std::string& account_ip); int16 CheckStatus(uint32 account_id);
void SetIPExemption(const std::string& account_ip, int exemption_amount);
int GetInstanceID(uint32 character_id, uint32 zone_id); void SetAccountCRCField(uint32 account_id, std::string field_name, uint64 checksum);
uint32 CheckLogin(const char* name, const char* password, const char *loginserver, int16* oStatus = 0);
uint32 CreateAccount(const char* name, const char* password, int16 status, const char* loginserver, uint32 lsaccount_id);
uint32 GetAccountIDFromLSID(const std::string& in_loginserver_id, uint32 in_loginserver_account_id, char* in_account_name = 0, int16* in_status = 0);
uint8 GetAgreementFlag(uint32 account_id);
void GetAccountFromID(uint32 id, char* oAccountName, int16* oStatus);
void SetAgreementFlag(uint32 account_id);
int GetIPExemption(std::string account_ip);
void SetIPExemption(std::string account_ip, int exemption_amount);
int GetInstanceID(uint32 char_id, uint32 zone_id);
/* Groups */ /* Groups */
std::string GetGroupLeaderForLogin(const std::string& character_name);
char* GetGroupLeadershipInfo( std::string GetGroupLeaderForLogin(std::string character_name);
uint32 group_id, char* GetGroupLeadershipInfo(uint32 gid, char* leaderbuf, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr, char *mentoree = nullptr, int *mentor_percent = nullptr, GroupLeadershipAA_Struct* GLAA = nullptr);
char* leaderbuf,
char* maintank = nullptr, uint32 GetGroupID(const char* name);
char* assist = nullptr,
char* puller = nullptr, void ClearGroup(uint32 gid = 0);
char* marknpc = nullptr, void ClearGroupLeader(uint32 gid = 0);
char* mentoree = nullptr, void SetGroupID(const char* name, uint32 id, uint32 charid, uint32 ismerc = false);
int* mentor_percent = nullptr, void SetGroupLeaderName(uint32 gid, const char* name);
GroupLeadershipAA_Struct* GLAA = nullptr
);
std::string GetGroupLeaderName(uint32 group_id);
uint32 GetGroupID(const std::string& name);
void ClearGroup(uint32 group_id = 0);
void ClearGroupLeader(uint32 group_id = 0);
void SetGroupLeaderName(uint32 group_id, const std::string& name);
/* Raids */ /* Raids */
const std::string GetRaidLeaderName(uint32 raid_id);
uint32 GetRaidID(const std::string& name);
void ClearRaid(uint32 raid_id = 0);
void ClearRaidDetails(uint32 raid_id = 0);
void ClearRaidLeader(uint32 group_id = std::numeric_limits<uint32>::max(), uint32 raid_id = 0);
void GetGroupLeadershipInfo(
uint32 group_id,
uint32 raid_id,
char* maintank = nullptr,
char* assist = nullptr,
char* puller = nullptr,
char* marknpc = nullptr,
char* mentoree = nullptr,
int* mentor_percent = nullptr,
GroupLeadershipAA_Struct* GLAA = nullptr
);
void GetRaidLeadershipInfo(
uint32 raid_id,
char* maintank = nullptr,
char* assist = nullptr,
char* puller = nullptr,
char* marknpc = nullptr,
RaidLeadershipAA_Struct* RLAA = nullptr
);
void SetRaidGroupLeaderInfo(uint32 group_id, uint32 raid_id);
void PurgeAllDeletedDataBuckets(); const char *GetRaidLeaderName(uint32 rid);
uint32 GetRaidID(const char* name);
void ClearRaid(uint32 rid = 0);
void ClearRaidDetails(uint32 rid = 0);
void ClearRaidLeader(uint32 gid = 0xFFFFFFFF, uint32 rid = 0);
void GetGroupLeadershipInfo(uint32 gid, uint32 rid, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr, char *mentoree = nullptr, int *mentor_percent = nullptr, GroupLeadershipAA_Struct* GLAA = nullptr);
void GetRaidLeadershipInfo(uint32 rid, char* maintank = nullptr, char* assist = nullptr, char* puller = nullptr, char *marknpc = nullptr, RaidLeadershipAA_Struct* RLAA = nullptr);
void SetRaidGroupLeaderInfo(uint32 gid, uint32 rid);
void PurgeAllDeletedDataBuckets();
/* Database Variables */ /* Database Variables */
bool GetVariable(const std::string& name, std::string& value);
bool SetVariable(const std::string& name, const std::string& value);
bool LoadVariables();
uint8 GetPEQZone(uint32 zone_id, uint32 version); bool GetVariable(std::string varname, std::string &varvalue);
uint32 GetServerType(); bool SetVariable(const std::string& varname, const std::string &varvalue);
void AddReport(const std::string& who, const std::string& against, const std::string& lines); bool LoadVariables();
struct TimeOfDay_Struct LoadTime(time_t& realtime);
bool SaveTime(int8 minute, int8 hour, int8 day, int8 month, int16 year);
void ClearMerchantTemp();
void ClearPTimers(uint32 character_id);
void SetFirstLogon(uint32 character_id, uint8 first_logon);
void SetLFG(uint32 character_id, bool is_lfg);
void SetLFP(uint32 character_id, bool is_lfp);
void SetLoginFlags(uint32 character_id, bool is_lfp, bool is_lfg, uint8 first_logon);
int64 CountInvSnapshots(); /* General Queries */
void ClearInvSnapshots(bool from_now = false);
void SourceDatabaseTableFromUrl(const std::string& table_name, const std::string& url); bool GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zoneid = 0, float* graveyard_x = 0, float* graveyard_y = 0, float* graveyard_z = 0, float* graveyard_heading = 0);
void SourceSqlFromUrl(const std::string& url); bool LoadPTimers(uint32 charid, PTimerList &into);
void PurgeCharacterParcels();
void Encode(std::string &in); uint8 GetPEQZone(uint32 zone_id, uint32 version);
void Decode(std::string &in); uint8 GetMinStatus(uint32 zone_id, uint32 instance_version);
uint8 GetRaceSkill(uint8 skillid, uint8 in_race);
uint8 GetServerType();
uint8 GetSkillCap(uint8 skillid, uint8 in_race, uint8 in_class, uint16 in_level);
void AddReport(std::string who, std::string against, std::string lines);
struct TimeOfDay_Struct LoadTime(time_t &realtime);
bool SaveTime(int8 minute, int8 hour, int8 day, int8 month, int16 year);
void ClearMerchantTemp();
void ClearPTimers(uint32 charid);
void SetFirstLogon(uint32 CharID, uint8 firstlogon);
void SetLFG(uint32 CharID, bool LFG);
void SetLFP(uint32 CharID, bool LFP);
void SetLoginFlags(uint32 CharID, bool LFP, bool LFG, uint8 firstlogon);
int CountInvSnapshots();
void ClearInvSnapshots(bool from_now = false);
void SourceDatabaseTableFromUrl(std::string table_name, std::string url);
void SourceSqlFromUrl(std::string url);
private: private:
Mutex Mvarcache;
Mutex Mvarcache;
VarCache_Struct varcache; VarCache_Struct varcache;
/* Groups, utility methods. */ /* Groups, utility methods. */
void ClearAllGroupLeaders(); void ClearAllGroupLeaders();
void ClearAllGroups(); void ClearAllGroups();
/* Raid, utility methods. */ /* Raid, utility methods. */
void ClearAllRaids(); void ClearAllRaids();
+1 -6
View File
@@ -575,12 +575,7 @@ void DatabaseDumpService::RemoveSqlBackup()
{ {
std::string file = fmt::format("{}.sql", GetDumpFileNameWithPath()); std::string file = fmt::format("{}.sql", GetDumpFileNameWithPath());
if (File::Exists(file)) { if (File::Exists(file)) {
try { std::filesystem::remove(file);
std::filesystem::remove(file);
}
catch (std::exception &e) {
LogError("std::filesystem::remove err [{}]", e.what());
}
} }
RemoveCredentialsFile(); RemoveCredentialsFile();
@@ -5410,164 +5410,6 @@ ADD COLUMN `augment_five` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_fou
ADD COLUMN `augment_six` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_five`; ADD COLUMN `augment_six` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_five`;
)", )",
.content_schema_update = true .content_schema_update = true
},
ManifestEntry{
.version = 9265,
.description = "2024_03_03_add_id_to_guild_bank.sql",
.check = "SHOW COLUMNS FROM `guild_bank` LIKE 'id'",
.condition = "empty",
.match = "",
.sql = R"(
ALTER TABLE `guild_bank`
ADD COLUMN `id` INT UNSIGNED NOT NULL AUTO_INCREMENT FIRST,
ADD PRIMARY KEY (`id`);
)",
},
ManifestEntry{
.version = 9266,
.description = "2024_03_02_rule_values_rule_value_length.sql",
.check = "SHOW COLUMNS FROM `rule_values` LIKE 'rule_value'",
.condition = "contains",
.match = "varchar(30)",
.sql = R"(
ALTER TABLE `rule_values`
MODIFY COLUMN `rule_value` text CHARACTER SET latin1 COLLATE latin1_swedish_ci NULL DEFAULT NULL AFTER `rule_name`;
)"
},
ManifestEntry{
.version = 9267,
.description = "2024_02_18_group_id_bot_id.sql",
.check = "SHOW COLUMNS FROM `group_id` LIKE 'bot_id'",
.condition = "empty",
.match = "",
.sql = R"(
ALTER TABLE `group_id`
CHANGE COLUMN `groupid` `group_id` int(11) UNSIGNED NOT NULL DEFAULT 0 FIRST,
CHANGE COLUMN `charid` `character_id` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `group_id`,
CHANGE COLUMN `ismerc` `merc_id` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `name`,
ADD COLUMN `bot_id` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `character_id`,
MODIFY COLUMN `name` varchar(64) NOT NULL DEFAULT '' AFTER `character_id`,
DROP PRIMARY KEY,
ADD PRIMARY KEY (`group_id`, `character_id`, `bot_id`, `merc_id`) USING BTREE;
ALTER TABLE `group_id`
MODIFY COLUMN `character_id` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `name`;
)"
},
ManifestEntry{
.version = 9268,
.description = "2024_03_23_skill_caps.sql",
.check = "SHOW COLUMNS FROM `skill_caps` LIKE 'skill_id'",
.condition = "empty",
.match = "",
.sql = R"(
ALTER TABLE `skill_caps`
CHANGE COLUMN `skillID` `skill_id` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 FIRST,
CHANGE COLUMN `class` `class_id` tinyint(3) UNSIGNED NOT NULL DEFAULT 0 AFTER `skill_id`,
ADD COLUMN `id` int(3) UNSIGNED NOT NULL AUTO_INCREMENT FIRST,
DROP PRIMARY KEY,
ADD PRIMARY KEY (`id`) USING BTREE,
ADD INDEX `level_skill_cap`(`skill_id`, `class_id`, `level`, `cap`);
)",
.content_schema_update = true,
},
ManifestEntry{
.version = 9269,
.description = "2024_03_27_account_auto_login_charname.sql",
.check = "SHOW COLUMNS FROM `account` LIKE 'auto_login_charname'",
.condition = "empty",
.match = "",
.sql = R"(
ALTER TABLE `account`
ADD COLUMN `auto_login_charname` varchar(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL DEFAULT '' AFTER `charname`;
)"
},
ManifestEntry{
.version = 9270,
.description = "2024_04_31_content_flagging_lootdrop_entries.sql",
.check = "SHOW COLUMNS FROM `lootdrop_entries` LIKE 'content_flags'",
.condition = "empty",
.match = "",
.sql = R"(
ALTER TABLE `lootdrop_entries` ADD `min_expansion` tinyint(4) NOT NULL DEFAULT -1;
ALTER TABLE `lootdrop_entries` ADD `max_expansion` tinyint(4) NOT NULL DEFAULT -1;
ALTER TABLE `lootdrop_entries` ADD `content_flags` varchar(100) NULL;
ALTER TABLE `lootdrop_entries` ADD `content_flags_disabled` varchar(100) NULL;
)",
.content_schema_update = true
},
ManifestEntry{
.version = 9271,
.description = "2024_03_10_parcel_implementation.sql",
.check = "SHOW TABLES LIKE 'character_parcels'",
.condition = "empty",
.match = "",
.sql = R"(CREATE TABLE `character_parcels` (
`id` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
`char_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`item_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`slot_id` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`quantity` INT(10) UNSIGNED NOT NULL DEFAULT '0',
`from_name` VARCHAR(64) NULL DEFAULT NULL COLLATE 'latin1_swedish_ci',
`note` VARCHAR(1024) NULL DEFAULT NULL COLLATE 'latin1_swedish_ci',
`sent_date` DATETIME NULL DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE,
UNIQUE INDEX `data_constraint` (`slot_id`, `char_id`) USING BTREE
)
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB
AUTO_INCREMENT=1;
)"
},
ManifestEntry{
.version = 9272,
.description = "2024_04_23_add_parcel_support_for_augmented_items.sql",
.check = "SHOW COLUMNS FROM `character_parcels` LIKE 'aug_slot_1'",
.condition = "empty",
.match = "",
.sql = R"(
ALTER TABLE `character_parcels`
ADD COLUMN `aug_slot_1` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `item_id`,
ADD COLUMN `aug_slot_2` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `aug_slot_1`,
ADD COLUMN `aug_slot_3` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `aug_slot_2`,
ADD COLUMN `aug_slot_4` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `aug_slot_3`,
ADD COLUMN `aug_slot_5` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `aug_slot_4`,
ADD COLUMN `aug_slot_6` INT UNSIGNED NOT NULL DEFAULT '0' AFTER `aug_slot_5`;
)"
},
ManifestEntry{
.version = 9273,
.description = "2024_04_24_door_close_timer.sql",
.check = "SHOW COLUMNS FROM `doors` LIKE 'close_timer_ms'",
.condition = "empty",
.match = "",
.sql = R"(
ALTER TABLE `doors`
ADD COLUMN `close_timer_ms` smallint(8) UNSIGNED NOT NULL DEFAULT 5000 AFTER `is_ldon_door`;
)",
.content_schema_update = true
},
ManifestEntry{
.version = 9274,
.description = "2024_05_02_parcel_npc_content.sql",
.check = "SHOW COLUMNS FROM `npc_types` LIKE 'is_parcel_merchant'",
.condition = "empty",
.match = "",
.sql = R"(
ALTER TABLE `npc_types`
ADD COLUMN `is_parcel_merchant` TINYINT(1) UNSIGNED NOT NULL DEFAULT '0' AFTER `keeps_sold_items`;
)",
.content_schema_update = true
},
ManifestEntry{
.version = 9275,
.description = "2024_04_28_character_extra_haste.sql",
.check = "SHOW COLUMNS FROM `character_data` LIKE 'extra_haste'",
.condition = "empty",
.match = "",
.sql = R"(
ALTER TABLE `character_data`
ADD COLUMN `extra_haste` int(11) NOT NULL DEFAULT 0 AFTER `wis`;
)"
} }
// -- 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{
@@ -139,17 +139,6 @@ ADD COLUMN `augment_three` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_tw
ADD COLUMN `augment_four` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_three`, ADD COLUMN `augment_four` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_three`,
ADD COLUMN `augment_five` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_four`, ADD COLUMN `augment_five` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_four`,
ADD COLUMN `augment_six` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_five`; ADD COLUMN `augment_six` int(11) UNSIGNED NOT NULL DEFAULT 0 AFTER `augment_five`;
)"
},
ManifestEntry{
.version = 9044,
.description = "2024_04_23_bot_extra_haste.sql",
.check = "SHOW COLUMNS FROM `bot_data` LIKE 'extra_haste'",
.condition = "empty",
.match = "",
.sql = R"(
ALTER TABLE `bot_data`
ADD COLUMN `extra_haste` mediumint(8) NOT NULL DEFAULT 0 AFTER `wis`;
)" )"
} }
// -- template; copy/paste this when you need to create a new entry // -- template; copy/paste this when you need to create a new entry
+5 -10
View File
@@ -421,25 +421,20 @@ void Database::AssignGroupToInstance(uint32 group_id, uint32 instance_id)
auto zone_id = GetInstanceZoneID(instance_id); auto zone_id = GetInstanceZoneID(instance_id);
auto version = GetInstanceVersion(instance_id); auto version = GetInstanceVersion(instance_id);
const auto& l = GroupIdRepository::GetWhere( auto l = GroupIdRepository::GetWhere(
*this, *this,
fmt::format( fmt::format(
"`group_id` = {}", "groupid = {}",
group_id group_id
) )
); );
if (l.empty()) { if (l.empty()) {
return; return;
} }
for (const auto& e : l) { for (const auto& e : l) {
if (!e.character_id) { if (!GetInstanceID(zone_id, e.charid, version)) {
continue; AddClientToInstance(instance_id, e.charid);
}
if (!GetInstanceID(zone_id, e.character_id, version)) {
AddClientToInstance(instance_id, e.character_id);
} }
} }
} }
@@ -509,7 +504,7 @@ void Database::FlagInstanceByRaidLeader(uint32 zone_id, int16 version, uint32 ch
return; return;
} }
auto raid_leader_id = GetCharacterID(GetRaidLeaderName(raid_id).c_str()); auto raid_leader_id = GetCharacterID(GetRaidLeaderName(raid_id));
auto raid_leader_instance_id = GetInstanceID(zone_id, raid_leader_id, version); auto raid_leader_instance_id = GetInstanceID(zone_id, raid_leader_id, version);
if (!raid_leader_instance_id) { if (!raid_leader_instance_id) {
-2
View File
@@ -59,7 +59,6 @@ namespace DatabaseSchema {
{"character_leadership_abilities", "id"}, {"character_leadership_abilities", "id"},
{"character_material", "id"}, {"character_material", "id"},
{"character_memmed_spells", "id"}, {"character_memmed_spells", "id"},
{"character_parcels", "char_id"},
{"character_pet_buffs", "char_id"}, {"character_pet_buffs", "char_id"},
{"character_pet_info", "char_id"}, {"character_pet_info", "char_id"},
{"character_pet_inventory", "char_id"}, {"character_pet_inventory", "char_id"},
@@ -129,7 +128,6 @@ namespace DatabaseSchema {
"character_leadership_abilities", "character_leadership_abilities",
"character_material", "character_material",
"character_memmed_spells", "character_memmed_spells",
"character_parcels",
"character_pet_buffs", "character_pet_buffs",
"character_pet_info", "character_pet_info",
"character_pet_inventory", "character_pet_inventory",
-24
View File
@@ -698,8 +698,6 @@ const std::map<uint32, std::string>& EQ::constants::GetSpecialAbilityMap()
{ IMMUNE_OPEN, "Immune to Open" }, { IMMUNE_OPEN, "Immune to Open" },
{ IMMUNE_ASSASSINATE, "Immune to Assassinate" }, { IMMUNE_ASSASSINATE, "Immune to Assassinate" },
{ IMMUNE_HEADSHOT, "Immune to Headshot" }, { IMMUNE_HEADSHOT, "Immune to Headshot" },
{ IMMUNE_AGGRO_BOT, "Immune to Bot Aggro" },
{ IMMUNE_DAMAGE_BOT, "Immune to Bot Damage" },
}; };
return special_ability_map; return special_ability_map;
@@ -714,25 +712,3 @@ std::string EQ::constants::GetSpecialAbilityName(uint32 ability_id)
return std::string(); return std::string();
} }
const std::map<uint32, std::string>& EQ::constants::GetConsiderColorMap()
{
static const std::map<uint32, std::string> consider_color_map = {
{ ConsiderColor::Green, "Green" },
{ ConsiderColor::DarkBlue, "Dark Blue" },
{ ConsiderColor::Gray, "Gray" },
{ ConsiderColor::White, "White" },
{ ConsiderColor::Red, "Red" },
{ ConsiderColor::Yellow, "Yellow" },
{ ConsiderColor::LightBlue, "Light Blue" },
{ ConsiderColor::WhiteTitanium, "White" },
};
return consider_color_map;
}
std::string EQ::constants::GetConsiderColorName(uint32 consider_color)
{
const auto& c = EQ::constants::GetConsiderColorMap().find(consider_color);
return c != EQ::constants::GetConsiderColorMap().end() ? c->second : std::string();
}
+1 -17
View File
@@ -404,9 +404,6 @@ namespace EQ
extern const std::map<uint32, std::string>& GetSpecialAbilityMap(); extern const std::map<uint32, std::string>& GetSpecialAbilityMap();
std::string GetSpecialAbilityName(uint32 ability_id); std::string GetSpecialAbilityName(uint32 ability_id);
extern const std::map<uint32, std::string>& GetConsiderColorMap();
std::string GetConsiderColorName(uint32 consider_color);
const int STANCE_TYPE_FIRST = stancePassive; const int STANCE_TYPE_FIRST = stancePassive;
const int STANCE_TYPE_LAST = stanceBurnAE; const int STANCE_TYPE_LAST = stanceBurnAE;
const int STANCE_TYPE_COUNT = stanceBurnAE; const int STANCE_TYPE_COUNT = stanceBurnAE;
@@ -562,17 +559,6 @@ enum ConsiderLevel : uint8 {
Scowls Scowls
}; };
namespace ConsiderColor {
constexpr uint32 Green = 2;
constexpr uint32 DarkBlue = 4;
constexpr uint32 Gray = 6;
constexpr uint32 White = 10;
constexpr uint32 Red = 13;
constexpr uint32 Yellow = 15;
constexpr uint32 LightBlue = 18;
constexpr uint32 WhiteTitanium = 20;
};
enum TargetDescriptionType : uint8 { enum TargetDescriptionType : uint8 {
LCSelf, LCSelf,
UCSelf, UCSelf,
@@ -670,9 +656,7 @@ enum {
IMMUNE_OPEN = 53, IMMUNE_OPEN = 53,
IMMUNE_ASSASSINATE = 54, IMMUNE_ASSASSINATE = 54,
IMMUNE_HEADSHOT = 55, IMMUNE_HEADSHOT = 55,
IMMUNE_AGGRO_BOT = 56, MAX_SPECIAL_ATTACK = 56
IMMUNE_DAMAGE_BOT = 57,
MAX_SPECIAL_ATTACK = 58
}; };
-5
View File
@@ -510,11 +510,6 @@ N(OP_ShopEndConfirm),
N(OP_ShopItem), N(OP_ShopItem),
N(OP_ShopPlayerBuy), N(OP_ShopPlayerBuy),
N(OP_ShopPlayerSell), N(OP_ShopPlayerSell),
N(OP_ShopSendParcel),
N(OP_ShopDeleteParcel),
N(OP_ShopRespondParcel),
N(OP_ShopRetrieveParcel),
N(OP_ShopParcelIcon),
N(OP_ShopRequest), N(OP_ShopRequest),
N(OP_SimpleMessage), N(OP_SimpleMessage),
N(OP_SkillUpdate), N(OP_SkillUpdate),
-18
View File
@@ -1131,22 +1131,4 @@ namespace LeadershipAbilitySlot {
constexpr uint16 HealthOfTargetsTarget = 14; constexpr uint16 HealthOfTargetsTarget = 14;
} }
enum ExpSource
{
Quest,
GM,
Kill,
Death,
Resurrection,
LDoNChest,
Task,
Sacrifice
};
#define PARCEL_SEND_ITEMS 0
#define PARCEL_SEND_MONEY 1
#define PARCEL_MONEY_ITEM_ID 99990 // item id of money
#define PARCEL_LIMIT 5
#define PARCEL_BEGIN_SLOT 1
#endif /*COMMON_EQ_CONSTANTS_H*/ #endif /*COMMON_EQ_CONSTANTS_H*/
+19 -134
View File
@@ -27,9 +27,6 @@
#include "../common/version.h" #include "../common/version.h"
#include "emu_constants.h" #include "emu_constants.h"
#include "textures.h" #include "textures.h"
#include "../cereal/include/cereal/archives/binary.hpp"
#include "../cereal/include/cereal/types/string.hpp"
#include "../cereal/include/cereal/types/vector.hpp"
static const uint32 BUFF_COUNT = 42; static const uint32 BUFF_COUNT = 42;
@@ -133,11 +130,6 @@ enum CrystalReclaimTypes
Radiant = 4, Radiant = 4,
}; };
namespace ItemStackSizeConstraint {
constexpr int16 Minimum = 1;
constexpr int16 Maximum = 1000;
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
@@ -1536,32 +1528,20 @@ struct ExpUpdate_Struct
** Packet Types: See ItemPacketType enum ** Packet Types: See ItemPacketType enum
** **
*/ */
enum ItemPacketType { enum ItemPacketType
ItemPacketViewLink = 0x00, {
ItemPacketMerchant = 0x64, ItemPacketViewLink = 0x00,
ItemPacketTradeView = 0x65, ItemPacketMerchant = 0x64,
ItemPacketLoot = 0x66, ItemPacketTradeView = 0x65,
ItemPacketTrade = 0x67, ItemPacketLoot = 0x66,
ItemPacketCharInventory = 0x69, ItemPacketTrade = 0x67,
ItemPacketLimbo = 0x6A, ItemPacketCharInventory = 0x69,
ItemPacketWorldContainer = 0x6B, ItemPacketLimbo = 0x6A,
ItemPacketTributeItem = 0x6C, ItemPacketWorldContainer = 0x6B,
ItemPacketGuildTribute = 0x6D, ItemPacketTributeItem = 0x6C,
ItemPacketCharmUpdate = 0x6E, // noted as incorrect ItemPacketGuildTribute = 0x6D,
ItemPacketRecovery = 0x71, ItemPacketCharmUpdate = 0x6E, // noted as incorrect
ItemPacketParcel = 0x73, ItemPacketInvalid = 0xFF
ItemPacketInvalid = 0xFF
};
enum MerchantWindowTabDisplay {
None = 0x00,
SellBuy = 0x01,
Recover = 0x02,
SellBuyRecover = 0x03,
Parcel = 0x04,
SellBuyParcel = 0x05,
RecoverParcel = 0x06,
SellBuyRecoverParcel = 0x07
}; };
//enum ItemPacketType //enum ItemPacketType
@@ -1693,38 +1673,6 @@ struct GuildsList_Struct {
GuildsListEntry_Struct Guilds[MAX_NUMBER_GUILDS]; GuildsListEntry_Struct Guilds[MAX_NUMBER_GUILDS];
}; };
struct GuildsListMessagingEntry_Struct {
/*000*/ uint32 guild_id;
/*004*/ std::string guild_name;
template<class Archive>
void serialize(Archive& archive)
{
archive(
CEREAL_NVP(guild_id),
CEREAL_NVP(guild_name)
);
}
};
struct GuildsListMessaging_Struct {
/*000*/ char header[64];
/*064*/ uint32 no_of_guilds;
/*068*/ uint32 string_length;
/*072*/ std::vector<GuildsListMessagingEntry_Struct> guild_detail;
template<class Archive>
void serialize(Archive& archive)
{
archive(
CEREAL_NVP(header),
CEREAL_NVP(no_of_guilds),
CEREAL_NVP(string_length),
CEREAL_NVP(guild_detail)
);
}
};
struct GuildUpdate_Struct { struct GuildUpdate_Struct {
uint32 guildID; uint32 guildID;
GuildsListEntry_Struct entry; GuildsListEntry_Struct entry;
@@ -2104,75 +2052,12 @@ struct TimeOfDay_Struct {
}; };
// Darvik: shopkeeper structs // Darvik: shopkeeper structs
struct MerchantClick_Struct struct Merchant_Click_Struct {
{ /*000*/ uint32 npcid; // Merchant NPC's entity id
/*000*/ uint32 npc_id; // Merchant NPC's entity id /*004*/ uint32 playerid;
/*004*/ uint32 player_id; /*008*/ uint32 command; //1=open, 0=cancel/close
/*008*/ uint32 command; // 1=open, 0=cancel/close /*012*/ float rate; //cost multiplier, dosent work anymore
/*012*/ float rate; // cost multiplier, dosent work anymore
/*016*/ int32 tab_display; // bitmask b000 none, b001 Purchase/Sell, b010 Recover, b100 Parcels
/*020*/ int32 unknown020; // Seen 2592000 from Server or -1 from Client
/*024*/
}; };
enum MerchantActions {
Close = 0,
Open = 1
};
struct Parcel_Struct
{
/*000*/ uint32 npc_id;
/*004*/ uint32 item_slot;
/*008*/ uint32 quantity;
/*012*/ uint32 money_flag;
/*016*/ char send_to[64];
/*080*/ char note[128];
/*208*/ uint32 unknown_208;
/*212*/ uint32 unknown_212;
/*216*/ uint32 unknown_216;
};
struct ParcelRetrieve_Struct
{
uint32 merchant_entity_id;
uint32 player_entity_id;
uint32 parcel_slot_id;
uint32 parcel_item_id;
};
struct ParcelMessaging_Struct {
ItemPacketType packet_type;
std::string serialized_item;
uint32 sent_time;
std::string player_name;
std::string note;
uint32 slot_id;
template<class Archive>
void serialize(Archive &archive)
{
archive(
CEREAL_NVP(packet_type),
CEREAL_NVP(serialized_item),
CEREAL_NVP(sent_time),
CEREAL_NVP(player_name),
CEREAL_NVP(note),
CEREAL_NVP(slot_id)
);
}
};
struct ParcelIcon_Struct {
uint32 status; //0 off 1 on 2 overlimit
};
enum ParcelIconActions {
IconOff = 0,
IconOn = 1,
Overlimit = 2
};
/* /*
Unknowns: Unknowns:
0 is e7 from 01 to // MAYBE SLOT IN PURCHASE 0 is e7 from 01 to // MAYBE SLOT IN PURCHASE
-2
View File
@@ -141,7 +141,6 @@ namespace Logs {
Zoning, Zoning,
EqTime, EqTime,
Corpses, Corpses,
XTargets,
MaxCategoryID /* Don't Remove this */ MaxCategoryID /* Don't Remove this */
}; };
@@ -242,7 +241,6 @@ namespace Logs {
"Zoning", "Zoning",
"EqTime", "EqTime",
"Corpses", "Corpses",
"XTargets"
}; };
} }
-10
View File
@@ -834,16 +834,6 @@
OutF(LogSys, Logs::Detail, Logs::Corpses, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\ OutF(LogSys, Logs::Detail, Logs::Corpses, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0) } while (0)
#define LogXTargets(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::General, Logs::XTargets))\
OutF(LogSys, Logs::General, Logs::XTargets, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogXTargetsDetail(message, ...) do {\
if (LogSys.IsLogEnabled(Logs::Detail, Logs::XTargets))\
OutF(LogSys, Logs::Detail, Logs::XTargets, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define Log(debug_level, log_category, message, ...) do {\ #define Log(debug_level, log_category, message, ...) do {\
if (LogSys.IsLogEnabled(debug_level, log_category))\ if (LogSys.IsLogEnabled(debug_level, log_category))\
LogSys.Out(debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\ LogSys.Out(debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
+2 -5
View File
@@ -697,11 +697,8 @@ void PlayerEventLogs::SetSettingsDefaults()
m_settings[PlayerEvent::KILLED_NAMED_NPC].event_enabled = 1; m_settings[PlayerEvent::KILLED_NAMED_NPC].event_enabled = 1;
m_settings[PlayerEvent::KILLED_RAID_NPC].event_enabled = 1; m_settings[PlayerEvent::KILLED_RAID_NPC].event_enabled = 1;
m_settings[PlayerEvent::ITEM_CREATION].event_enabled = 1; m_settings[PlayerEvent::ITEM_CREATION].event_enabled = 1;
m_settings[PlayerEvent::GUILD_TRIBUTE_DONATE_ITEM].event_enabled = 1; m_settings[PlayerEvent::GUILD_TRIBUTE_DONATE_ITEM].event_enabled = 1;
m_settings[PlayerEvent::GUILD_TRIBUTE_DONATE_PLAT].event_enabled = 1; m_settings[PlayerEvent::GUILD_TRIBUTE_DONATE_PLAT].event_enabled = 1;
m_settings[PlayerEvent::PARCEL_SEND].event_enabled = 1;
m_settings[PlayerEvent::PARCEL_RETRIEVE].event_enabled = 1;
m_settings[PlayerEvent::PARCEL_DELETE].event_enabled = 1;
for (int i = PlayerEvent::GM_COMMAND; i != PlayerEvent::MAX; i++) { for (int i = PlayerEvent::GM_COMMAND; i != PlayerEvent::MAX; i++) {
m_settings[i].retention_days = RETENTION_DAYS_DEFAULT; m_settings[i].retention_days = RETENTION_DAYS_DEFAULT;
+2 -107
View File
@@ -58,9 +58,6 @@ namespace PlayerEvent {
ITEM_CREATION, ITEM_CREATION,
GUILD_TRIBUTE_DONATE_ITEM, GUILD_TRIBUTE_DONATE_ITEM,
GUILD_TRIBUTE_DONATE_PLAT, GUILD_TRIBUTE_DONATE_PLAT,
PARCEL_SEND,
PARCEL_RETRIEVE,
PARCEL_DELETE,
MAX // dont remove MAX // dont remove
}; };
@@ -69,7 +66,7 @@ namespace PlayerEvent {
// If event is unimplemented just tag (Unimplemented) in the name // If event is unimplemented just tag (Unimplemented) in the name
// Events don't get saved to the database if unimplemented or deprecated // Events don't get saved to the database if unimplemented or deprecated
// Events tagged as deprecated will get automatically removed // Events tagged as deprecated will get automatically removed
static const char *EventName[EventType::MAX] = { static const char *EventName[PlayerEvent::MAX] = {
"None", "None",
"GM Command", "GM Command",
"Zoning", "Zoning",
@@ -119,10 +116,7 @@ namespace PlayerEvent {
"Killed Raid NPC", "Killed Raid NPC",
"Item Creation", "Item Creation",
"Guild Tribute Donate Item", "Guild Tribute Donate Item",
"Guild Tribute Donate Platinum", "Guild Tribute Donate Platinum"
"Parcel Item Sent",
"Parcel Item Retrieved",
"Parcel Prune Routine"
}; };
// Generic struct used by all events // Generic struct used by all events
@@ -982,105 +976,6 @@ namespace PlayerEvent {
); );
} }
}; };
struct ParcelRetrieve {
uint32 item_id;
uint32 quantity;
std::string from_player_name;
uint32 sent_date;
uint32 aug_slot_1;
uint32 aug_slot_2;
uint32 aug_slot_3;
uint32 aug_slot_4;
uint32 aug_slot_5;
uint32 aug_slot_6;
// cereal
template<class Archive>
void serialize(Archive &ar)
{
ar(
CEREAL_NVP(item_id),
CEREAL_NVP(quantity),
CEREAL_NVP(from_player_name),
CEREAL_NVP(sent_date),
CEREAL_NVP(aug_slot_1),
CEREAL_NVP(aug_slot_2),
CEREAL_NVP(aug_slot_3),
CEREAL_NVP(aug_slot_4),
CEREAL_NVP(aug_slot_5),
CEREAL_NVP(aug_slot_6)
);
}
};
struct ParcelSend {
uint32 item_id;
uint32 quantity;
std::string from_player_name;
std::string to_player_name;
uint32 sent_date;
uint32 aug_slot_1;
uint32 aug_slot_2;
uint32 aug_slot_3;
uint32 aug_slot_4;
uint32 aug_slot_5;
uint32 aug_slot_6;
// cereal
template<class Archive>
void serialize(Archive &ar)
{
ar(
CEREAL_NVP(item_id),
CEREAL_NVP(quantity),
CEREAL_NVP(from_player_name),
CEREAL_NVP(to_player_name),
CEREAL_NVP(sent_date),
CEREAL_NVP(aug_slot_1),
CEREAL_NVP(aug_slot_2),
CEREAL_NVP(aug_slot_3),
CEREAL_NVP(aug_slot_4),
CEREAL_NVP(aug_slot_5),
CEREAL_NVP(aug_slot_6)
);
}
};
struct ParcelDelete {
uint32 item_id;
uint32 quantity;
uint32 char_id;
std::string from_name;
std::string note;
uint32 sent_date;
uint32 aug_slot_1;
uint32 aug_slot_2;
uint32 aug_slot_3;
uint32 aug_slot_4;
uint32 aug_slot_5;
uint32 aug_slot_6;
// cereal
template<class Archive>
void serialize(Archive &ar)
{
ar(
CEREAL_NVP(item_id),
CEREAL_NVP(quantity),
CEREAL_NVP(char_id),
CEREAL_NVP(from_name),
CEREAL_NVP(note),
CEREAL_NVP(sent_date),
CEREAL_NVP(aug_slot_1),
CEREAL_NVP(aug_slot_2),
CEREAL_NVP(aug_slot_3),
CEREAL_NVP(aug_slot_4),
CEREAL_NVP(aug_slot_5),
CEREAL_NVP(aug_slot_6)
);
}
};
} }
#endif //EQEMU_PLAYER_EVENTS_H #endif //EQEMU_PLAYER_EVENTS_H
+65 -44
View File
@@ -92,20 +92,10 @@ BaseGuildManager::~BaseGuildManager()
bool BaseGuildManager::LoadGuilds() bool BaseGuildManager::LoadGuilds()
{ {
ClearGuilds(); ClearGuilds();
auto guilds = GuildsRepository::GetWhere( auto guilds = GuildsRepository::All(*m_db);
*m_db, auto guilds_ranks = GuildRanksRepository::All(*m_db);
fmt::format("`id` < '{}'", RoF2::constants::MAX_GUILD_ID) auto guilds_permissions = GuildPermissionsRepository::All(*m_db);
); auto guilds_tributes = GuildTributesRepository::All(*m_db);
auto guilds_ranks = GuildRanksRepository::LoadAll(*m_db);
auto guilds_permissions = GuildPermissionsRepository::LoadAll(*m_db);
auto guilds_tributes = GuildTributesRepository::GetWhere(
*m_db,
fmt::format(
"`guild_id` < '{}'",
RoF2::constants::MAX_GUILD_ID
)
);
if (guilds.empty()) { if (guilds.empty()) {
LogGuilds("No Guilds found in database."); LogGuilds("No Guilds found in database.");
@@ -118,27 +108,22 @@ bool BaseGuildManager::LoadGuilds()
_CreateGuild(g.id, g.name, g.leader, g.minstatus, g.motd, g.motd_setter, g.channel, g.url, g.favor); _CreateGuild(g.id, g.name, g.leader, g.minstatus, g.motd, g.motd_setter, g.channel, g.url, g.favor);
for (int i = 1; i <= GUILD_MAX_RANK; i++) { for (auto const &r: guilds_ranks) {
auto key = fmt::format("{}-{}", g.id, i); if (r.guild_id == g.id) {
m_guilds[g.id]->rank_names[r.rank_] = r.title;
if (guilds_ranks.contains(key)) {
m_guilds[g.id]->rank_names[i] = guilds_ranks.find(key)->second;
} }
} }
auto count = 0; auto count = 0;
for (int i = 1; i <= GUILD_MAX_FUNCTIONS; i++) { for (auto const &p: guilds_permissions) {
auto key = fmt::format("{}-{}", g.id, i); if (p.guild_id == g.id) {
if (guilds_permissions.contains(key)) {
auto p = guilds_permissions.find(key)->second;
m_guilds[g.id]->functions[p.perm_id].id = p.id; m_guilds[g.id]->functions[p.perm_id].id = p.id;
m_guilds[g.id]->functions[p.perm_id].guild_id = p.guild_id; m_guilds[g.id]->functions[p.perm_id].guild_id = p.guild_id;
m_guilds[g.id]->functions[p.perm_id].perm_id = p.perm_id; m_guilds[g.id]->functions[p.perm_id].perm_id = p.perm_id;
m_guilds[g.id]->functions[p.perm_id].perm_value = p.permission; m_guilds[g.id]->functions[p.perm_id].perm_value = p.permission;
count++;
} }
count++;
} }
if (count < GUILD_MAX_FUNCTIONS) { if (count < GUILD_MAX_FUNCTIONS) {
@@ -357,14 +342,41 @@ bool BaseGuildManager::_StoreGuildDB(uint32 guild_id)
return true; return true;
} }
uint32 BaseGuildManager::_GetFreeGuildID()
{
GuildsRepository::DeleteWhere(*m_db, "`name` = ''");
GuildsRepository::Guilds out;
out.id = 0;
out.leader = 0;
out.minstatus = 0;
out.tribute = 0;
out.name = "";
out.motd = "";
out.motd_setter = "";
out.url = "";
out.channel = "";
auto last_insert_id = GuildsRepository::InsertOne(*m_db, out);
if (last_insert_id.id > 0) {
LogGuilds("Located a free guild ID [{}] in the database", last_insert_id.id);
return last_insert_id.id;
}
LogGuilds("Unable to find a free guild ID in the database");
return GUILD_NONE;
}
uint32 BaseGuildManager::CreateGuild(std::string name, uint32 leader_char_id) uint32 BaseGuildManager::CreateGuild(std::string name, uint32 leader_char_id)
{ {
uint32 guild_id = UpdateDbCreateGuild(name, leader_char_id); uint32 guild_id = UpdateDbCreateGuild(name, leader_char_id);
if (guild_id == GUILD_NONE) { if (guild_id == GUILD_NONE) {
return (GUILD_NONE); return (GUILD_NONE);
} }
//RefreshGuild(guild_id);
//SendGuildRefresh(guild_id, true, false, false, false);
//SendCharRefresh(GUILD_NONE, guild_id, leader_char_id);
return guild_id; return guild_id;
} }
bool BaseGuildManager::DeleteGuild(uint32 guild_id) bool BaseGuildManager::DeleteGuild(uint32 guild_id)
@@ -527,8 +539,8 @@ bool BaseGuildManager::SetPublicNote(uint32 charid, std::string public_note)
uint32 BaseGuildManager::UpdateDbCreateGuild(std::string name, uint32 leader) uint32 BaseGuildManager::UpdateDbCreateGuild(std::string name, uint32 leader)
{ {
auto new_id = GuildsRepository::GetMaxId(*m_db) + 1; auto new_id = _GetFreeGuildID();
if (!new_id) { if (new_id == GUILD_NONE) {
return GUILD_NONE; return GUILD_NONE;
} }
@@ -944,24 +956,33 @@ bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into)
} }
GuildsListMessaging_Struct BaseGuildManager::MakeGuildList() //returns ownership of the buffer.
uint8 *BaseGuildManager::MakeGuildList(const char *head_name, uint32 &length) const
{ {
GuildsListMessaging_Struct guild_list_messaging{}; //dynamic structs will make this a lot less painful.
uint32 string_length = 0;
for (auto const &g: m_guilds) { length = sizeof(GuildsList_Struct);
GuildsListMessagingEntry_Struct guild_entry{}; auto buffer = new uint8[length];
guild_entry.guild_id = g.first; //a bit little better than memsetting the whole thing...
guild_entry.guild_name = g.second->name; uint32 r, pos;
string_length += g.second->name.length() + 1; for (r = 0, pos = 0; r <= MAX_NUMBER_GUILDS; r++, pos += 64) {
guild_list_messaging.guild_detail.push_back(guild_entry); //strcpy((char *) buffer+pos, "BAD GUILD");
// These 'BAD GUILD' entries were showing in the drop-downs for selecting guilds in the LFP window,
// so just fill unused entries with an empty string instead.
buffer[pos] = '\0';
} }
guild_list_messaging.no_of_guilds = m_guilds.size(); strn0cpy((char *) buffer, head_name, 64);
guild_list_messaging.string_length = string_length;
return guild_list_messaging; std::map<uint32, GuildInfo *>::const_iterator cur, end;
cur = m_guilds.begin();
end = m_guilds.end();
for (; cur != end; ++cur) {
pos = 64 + (64 * cur->first);
strn0cpy((char *) buffer + pos, cur->second->name.c_str(), 64);
}
return (buffer);
} }
const char *BaseGuildManager::GetRankName(uint32 guild_id, uint8 rank) const const char *BaseGuildManager::GetRankName(uint32 guild_id, uint8 rank) const
+2 -1
View File
@@ -134,7 +134,7 @@ class BaseGuildManager
bool CheckGMStatus(uint32 guild_id, uint8 status) const; bool CheckGMStatus(uint32 guild_id, uint8 status) const;
bool CheckPermission(uint32 guild_id, uint8 rank, GuildAction act) const; bool CheckPermission(uint32 guild_id, uint8 rank, GuildAction act) const;
bool UpdateDbBankerFlag(uint32 charid, bool is_banker); bool UpdateDbBankerFlag(uint32 charid, bool is_banker);
GuildsListMessaging_Struct MakeGuildList(); uint8* MakeGuildList(const char* head_name, uint32& length) const; //make a guild list packet, returns ownership of the buffer.
uint8 GetDisplayedRank(uint32 guild_id, uint8 rank, uint32 char_id) const; uint8 GetDisplayedRank(uint32 guild_id, uint8 rank, uint32 char_id) const;
uint32 GetGuildIDByName(const char *GuildName); uint32 GetGuildIDByName(const char *GuildName);
uint32 GetGuildIDByCharacterID(uint32 character_id); uint32 GetGuildIDByCharacterID(uint32 character_id);
@@ -208,6 +208,7 @@ class BaseGuildManager
bool _StoreGuildDB(uint32 guild_id); bool _StoreGuildDB(uint32 guild_id);
GuildInfo* _CreateGuild(uint32 guild_id, std::string guild_name, uint32 leader_char_id, uint8 minstatus, std::string guild_motd, std::string motd_setter, std::string Channel, std::string URL, uint32 favour); GuildInfo* _CreateGuild(uint32 guild_id, std::string guild_name, uint32 leader_char_id, uint8 minstatus, std::string guild_motd, std::string motd_setter, std::string Channel, std::string URL, uint32 favour);
uint32 _GetFreeGuildID();
GuildsRepository::Guilds CreateGuildRepoFromGuildInfo(uint32 guild_id, BaseGuildManager::GuildInfo& in); GuildsRepository::Guilds CreateGuildRepoFromGuildInfo(uint32 guild_id, BaseGuildManager::GuildInfo& in);
}; };
#endif /*GUILD_BASE_H_*/ #endif /*GUILD_BASE_H_*/
+28
View File
@@ -3089,6 +3089,21 @@ namespace RoF
FINISH_ENCODE(); FINISH_ENCODE();
} }
ENCODE(OP_ShopRequest)
{
ENCODE_LENGTH_EXACT(Merchant_Click_Struct);
SETUP_DIRECT_ENCODE(Merchant_Click_Struct, structs::Merchant_Click_Struct);
OUT(npcid);
OUT(playerid);
OUT(command);
OUT(rate);
eq->unknown01 = 3; // Not sure what these values do yet, but list won't display without them
eq->unknown02 = 2592000;
FINISH_ENCODE();
}
ENCODE(OP_SkillUpdate) ENCODE(OP_SkillUpdate)
{ {
ENCODE_LENGTH_EXACT(SkillUpdate_Struct); ENCODE_LENGTH_EXACT(SkillUpdate_Struct);
@@ -5032,6 +5047,19 @@ namespace RoF
FINISH_DIRECT_DECODE(); FINISH_DIRECT_DECODE();
} }
DECODE(OP_ShopRequest)
{
DECODE_LENGTH_EXACT(structs::Merchant_Click_Struct);
SETUP_DIRECT_DECODE(Merchant_Click_Struct, structs::Merchant_Click_Struct);
IN(npcid);
IN(playerid);
IN(command);
IN(rate);
FINISH_DIRECT_DECODE();
}
DECODE(OP_Trader) DECODE(OP_Trader)
{ {
uint32 psize = __packet->size; uint32 psize = __packet->size;
+105 -131
View File
@@ -1401,35 +1401,58 @@ namespace RoF2
ENCODE(OP_GuildsList) ENCODE(OP_GuildsList)
{ {
EQApplicationPacket *in = *p; EQApplicationPacket *in = *p;
*p = nullptr; *p = nullptr;
GuildsListMessaging_Struct glms{}; uint32 NumberOfGuilds = in->size / 64;
EQ::Util::MemoryStreamReader ss(reinterpret_cast<char *>(in->pBuffer), in->size); uint32 PacketSize = 68; // 64 x 0x00 + a uint32 that I am guessing is the highest guild ID in use.
cereal::BinaryInputArchive ar(ss);
ar(glms);
auto packet_size = 64 + 4 + glms.guild_detail.size() * 4 + glms.string_length; unsigned char *__emu_buffer = in->pBuffer;
auto buffer = new uchar[packet_size];
auto buf_pos = buffer;
memset(buf_pos, 0, 64); char *InBuffer = (char *)__emu_buffer;
buf_pos += 64;
VARSTRUCT_ENCODE_TYPE(uint32, buf_pos, glms.no_of_guilds); uint32 HighestGuildID = 0;
for (auto const &g: glms.guild_detail) { for (unsigned int i = 0; i < NumberOfGuilds; ++i)
if (g.guild_id < RoF2::constants::MAX_GUILD_ID) { {
VARSTRUCT_ENCODE_TYPE(uint32, buf_pos, g.guild_id); if (InBuffer[0])
strn0cpy((char *) buf_pos, g.guild_name.c_str(), g.guild_name.length() + 1); {
buf_pos += g.guild_name.length() + 1; PacketSize += (5 + strlen(InBuffer));
HighestGuildID += 1;
} }
InBuffer += 64;
} }
auto outapp = new EQApplicationPacket(OP_GuildsList); PacketSize++; // Appears to be an extra 0x00 at the very end.
outapp->size = packet_size;
outapp->pBuffer = buffer;
dest->FastQueuePacket(&outapp); in->size = PacketSize;
in->pBuffer = new unsigned char[in->size];
InBuffer = (char *)__emu_buffer;
char *OutBuffer = (char *)in->pBuffer;
// Init the first 64 bytes to zero, as per live.
//
memset(OutBuffer, 0, 64);
OutBuffer += 64;
VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, HighestGuildID);
for (unsigned int i = 0; i < NumberOfGuilds; ++i)
{
if (InBuffer[0])
{
VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, i - 1);
VARSTRUCT_ENCODE_STRING(OutBuffer, InBuffer);
}
InBuffer += 64;
}
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0x00);
delete[] __emu_buffer;
dest->FastQueuePacket(&in, ack_req);
} }
ENCODE(OP_GuildTributeDonateItem) ENCODE(OP_GuildTributeDonateItem)
@@ -1556,75 +1579,30 @@ namespace RoF2
*p = nullptr; *p = nullptr;
//store away the emu struct //store away the emu struct
uchar *__emu_buffer = in->pBuffer; uchar* __emu_buffer = in->pBuffer;
ItemPacket_Struct *old_item_pkt = (ItemPacket_Struct *) __emu_buffer;
switch(old_item_pkt->PacketType) ItemPacket_Struct* old_item_pkt = (ItemPacket_Struct*)__emu_buffer;
{ EQ::InternalSerializedItem_Struct* int_struct = (EQ::InternalSerializedItem_Struct*)(&__emu_buffer[4]);
case ItemPacketParcel: {
ParcelMessaging_Struct pms{};
EQ::Util::MemoryStreamReader ss(reinterpret_cast<char *>(in->pBuffer), in->size);
cereal::BinaryInputArchive ar(ss);
ar(pms);
uint32 player_name_length = pms.player_name.length(); EQ::OutBuffer ob;
uint32 note_length = pms.note.length(); EQ::OutBuffer::pos_type last_pos = ob.tellp();
auto *int_struct = (EQ::InternalSerializedItem_Struct *) pms.serialized_item.data(); ob.write((const char*)__emu_buffer, 4);
EQ::OutBuffer ob; SerializeItem(ob, (const EQ::ItemInstance*)int_struct->inst, int_struct->slot_id, 0, old_item_pkt->PacketType);
EQ::OutBuffer::pos_type last_pos = ob.tellp(); if (ob.tellp() == last_pos) {
ob.write(reinterpret_cast<const char *>(&pms.packet_type), 4); LogNetcode("RoF2::ENCODE(OP_ItemPacket) Serialization failed on item slot [{}]", int_struct->slot_id);
delete in;
return;
}
SerializeItem(ob, (const EQ::ItemInstance *) int_struct->inst, pms.slot_id, 0, ItemPacketParcel); in->size = ob.size();
in->pBuffer = ob.detach();
if (ob.tellp() == last_pos) { delete[] __emu_buffer;
LogNetcode("RoF2::ENCODE(OP_ItemPacket) Serialization failed on item slot [{}]", pms.slot_id);
safe_delete_array(__emu_buffer);
safe_delete(in);
return;
}
ob.write((const char *) &pms.sent_time, 4); dest->FastQueuePacket(&in, ack_req);
ob.write((const char *) &player_name_length, 4); }
ob.write(pms.player_name.c_str(), pms.player_name.length());
ob.write((const char *) &note_length, 4);
ob.write(pms.note.c_str(), pms.note.length());
in->size = ob.size();
in->pBuffer = ob.detach();
safe_delete_array(__emu_buffer);
dest->FastQueuePacket(&in, ack_req);
break;
}
default: {
EQ::InternalSerializedItem_Struct *int_struct = (EQ::InternalSerializedItem_Struct *)(&__emu_buffer[4]);
EQ::OutBuffer ob;
EQ::OutBuffer::pos_type last_pos = ob.tellp();
ob.write((const char *)__emu_buffer, 4);
SerializeItem(ob, (const EQ::ItemInstance *)int_struct->inst, int_struct->slot_id, 0,
old_item_pkt->PacketType);
if (ob.tellp() == last_pos) {
LogNetcode("RoF2::ENCODE(OP_ItemPacket) Serialization failed on item slot [{}]",
int_struct->slot_id);
safe_delete_array(__emu_buffer);
safe_delete(in);
return;
}
in->size = ob.size();
in->pBuffer = ob.detach();
safe_delete_array(__emu_buffer);
dest->FastQueuePacket(&in, ack_req);
}
}
}
ENCODE(OP_ItemVerifyReply) ENCODE(OP_ItemVerifyReply)
{ {
@@ -3185,6 +3163,21 @@ namespace RoF2
FINISH_ENCODE(); FINISH_ENCODE();
} }
ENCODE(OP_ShopRequest)
{
ENCODE_LENGTH_EXACT(Merchant_Click_Struct);
SETUP_DIRECT_ENCODE(Merchant_Click_Struct, structs::Merchant_Click_Struct);
OUT(npcid);
OUT(playerid);
OUT(command);
OUT(rate);
eq->unknown01 = 3; // Not sure what these values do yet, but list won't display without them
eq->unknown02 = 2592000;
FINISH_ENCODE();
}
ENCODE(OP_SkillUpdate) ENCODE(OP_SkillUpdate)
{ {
ENCODE_LENGTH_EXACT(SkillUpdate_Struct); ENCODE_LENGTH_EXACT(SkillUpdate_Struct);
@@ -5314,17 +5307,15 @@ namespace RoF2
FINISH_DIRECT_DECODE(); FINISH_DIRECT_DECODE();
} }
DECODE(OP_ShopSendParcel) DECODE(OP_ShopRequest)
{ {
DECODE_LENGTH_EXACT(structs::Parcel_Struct); DECODE_LENGTH_EXACT(structs::Merchant_Click_Struct);
SETUP_DIRECT_DECODE(Parcel_Struct, structs::Parcel_Struct); SETUP_DIRECT_DECODE(Merchant_Click_Struct, structs::Merchant_Click_Struct);
IN(npc_id); IN(npcid);
IN(quantity); IN(playerid);
IN(money_flag); IN(command);
emu->item_slot = RoF2ToServerTypelessSlot(eq->inventory_slot, invtype::typePossessions); IN(rate);
strn0cpy(emu->send_to, eq->send_to, sizeof(emu->send_to));
strn0cpy(emu->note, eq->note, sizeof(emu->note));
FINISH_DIRECT_DECODE(); FINISH_DIRECT_DECODE();
} }
@@ -5543,24 +5534,11 @@ namespace RoF2
//sprintf(hdr.unknown000, "06e0002Y1W00"); //sprintf(hdr.unknown000, "06e0002Y1W00");
snprintf(hdr.unknown000, sizeof(hdr.unknown000), "%016d", item->ID); snprintf(hdr.unknown000, sizeof(hdr.unknown000), "%016d", item->ID);
if (packet_type == ItemPacketParcel) {
strn0cpy(
hdr.unknown000,
fmt::format(
"{:03}PAR{:010}\0",
inst->GetMerchantSlot(),
item->ID
).c_str(),
sizeof(hdr.unknown000)
);
}
hdr.stacksize = hdr.stacksize = (inst->IsStackable() ? ((inst->GetCharges() > 1000) ? 0xFFFFFFFF : inst->GetCharges()) : 1);
item->ID == PARCEL_MONEY_ITEM_ID ? inst->GetPrice() : (inst->IsStackable() ? ((inst->GetCharges() > 1000)
? 0xFFFFFFFF : inst->GetCharges()) : 1);
hdr.unknown004 = 0; hdr.unknown004 = 0;
structs::InventorySlot_Struct slot_id{}; structs::InventorySlot_Struct slot_id;
switch (packet_type) { switch (packet_type) {
case ItemPacketLoot: case ItemPacketLoot:
slot_id = ServerToRoF2CorpseSlot(slot_id_in); slot_id = ServerToRoF2CorpseSlot(slot_id_in);
@@ -5570,24 +5548,22 @@ namespace RoF2
break; break;
} }
hdr.slot_type = (inst->GetMerchantSlot() ? invtype::typeMerchant : slot_id.Type); hdr.slot_type = (inst->GetMerchantSlot() ? invtype::typeMerchant : slot_id.Type);
hdr.main_slot = (inst->GetMerchantSlot() ? inst->GetMerchantSlot() : slot_id.Slot); hdr.main_slot = (inst->GetMerchantSlot() ? inst->GetMerchantSlot() : slot_id.Slot);
hdr.sub_slot = (inst->GetMerchantSlot() ? 0xffff : slot_id.SubIndex); hdr.sub_slot = (inst->GetMerchantSlot() ? 0xffff : slot_id.SubIndex);
hdr.aug_slot = (inst->GetMerchantSlot() ? 0xffff : slot_id.AugIndex); hdr.aug_slot = (inst->GetMerchantSlot() ? 0xffff : slot_id.AugIndex);
hdr.price = inst->GetPrice(); hdr.price = inst->GetPrice();
hdr.merchant_slot = ((inst->GetMerchantSlot() ? inst->GetMerchantCount() : 1)); hdr.merchant_slot = (inst->GetMerchantSlot() ? inst->GetMerchantCount() : 1);
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.unknown028 = 0;
hdr.last_cast_time = inst->GetRecastTimestamp(); hdr.last_cast_time = inst->GetRecastTimestamp();
hdr.charges = (inst->IsStackable() ? (item->MaxCharges ? 1 : 0) : ((inst->GetCharges() > 254) hdr.charges = (inst->IsStackable() ? (item->MaxCharges ? 1 : 0) : ((inst->GetCharges() > 254) ? 0xFFFFFFFF : inst->GetCharges()));
? 0xFFFFFFFF hdr.inst_nodrop = (inst->IsAttuned() ? 1 : 0);
: inst->GetCharges())); hdr.unknown044 = 0;
hdr.inst_nodrop = (inst->IsAttuned() ? 1 : 0); hdr.unknown048 = 0;
hdr.unknown044 = 0; hdr.unknown052 = 0;
hdr.unknown048 = 0; hdr.isEvolving = item->EvolvingItem;
hdr.unknown052 = 0;
hdr.isEvolving = item->EvolvingItem;
ob.write((const char*)&hdr, sizeof(RoF2::structs::ItemSerializationHeader)); ob.write((const char*)&hdr, sizeof(RoF2::structs::ItemSerializationHeader));
@@ -5645,10 +5621,9 @@ namespace RoF2
ob.write((const char*)&hdrf, sizeof(RoF2::structs::ItemSerializationHeaderFinish)); ob.write((const char*)&hdrf, sizeof(RoF2::structs::ItemSerializationHeaderFinish));
if (strlen(item->Name) > 0) { if (strlen(item->Name) > 0)
ob.write(item->Name, strlen(item->Name)); ob.write(item->Name, strlen(item->Name));
ob.write("\0", 1); ob.write("\0", 1);
}
if (strlen(item->Lore) > 0) if (strlen(item->Lore) > 0)
ob.write(item->Lore, strlen(item->Lore)); ob.write(item->Lore, strlen(item->Lore));
@@ -5809,11 +5784,10 @@ namespace RoF2
itbs.unknown5 = 0; itbs.unknown5 = 0;
itbs.potion_belt_enabled = item->PotionBelt; itbs.potion_belt_enabled = item->PotionBelt;
itbs.potion_belt_slots = item->PotionBeltSlots; itbs.potion_belt_slots = item->PotionBeltSlots;
itbs.stacksize = itbs.stacksize = (inst->IsStackable() ? item->StackSize : 0);
item->ID == PARCEL_MONEY_ITEM_ID ? 0x7FFFFFFF : ((inst->IsStackable() ? item->StackSize : 0)); itbs.no_transfer = item->NoTransfer;
itbs.no_transfer = item->NoTransfer; itbs.expendablearrow = item->ExpendableArrow;
itbs.expendablearrow = item->ExpendableArrow;
// Done to hack older clients to label expendable fishing poles as such // Done to hack older clients to label expendable fishing poles as such
// July 28th, 2018 patch // July 28th, 2018 patch
-1
View File
@@ -271,7 +271,6 @@ namespace RoF2
const size_t CHARACTER_CREATION_LIMIT = 12; const size_t CHARACTER_CREATION_LIMIT = 12;
const size_t SAY_LINK_BODY_SIZE = 56; const size_t SAY_LINK_BODY_SIZE = 56;
const uint32 MAX_GUILD_ID = 50000;
} /*constants*/ } /*constants*/
+2 -1
View File
@@ -116,6 +116,7 @@ E(OP_SendZonepoints)
E(OP_SetGuildRank) E(OP_SetGuildRank)
E(OP_ShopPlayerBuy) E(OP_ShopPlayerBuy)
E(OP_ShopPlayerSell) E(OP_ShopPlayerSell)
E(OP_ShopRequest)
E(OP_SkillUpdate) E(OP_SkillUpdate)
E(OP_SomeItemPacketMaybe) E(OP_SomeItemPacketMaybe)
E(OP_SpawnAppearance) E(OP_SpawnAppearance)
@@ -199,7 +200,7 @@ D(OP_Save)
D(OP_SetServerFilter) D(OP_SetServerFilter)
D(OP_ShopPlayerBuy) D(OP_ShopPlayerBuy)
D(OP_ShopPlayerSell) D(OP_ShopPlayerSell)
D(OP_ShopSendParcel) D(OP_ShopRequest)
D(OP_Trader) D(OP_Trader)
D(OP_TraderBuy) D(OP_TraderBuy)
D(OP_TradeSkillCombine) D(OP_TradeSkillCombine)
+27 -41
View File
@@ -2247,17 +2247,15 @@ struct TimeOfDay_Struct {
}; };
// Darvik: shopkeeper structs // Darvik: shopkeeper structs
struct MerchantClick_Struct struct Merchant_Click_Struct {
{ /*000*/ uint32 npcid; // Merchant NPC's entity id
/*000*/ uint32 npc_id; // Merchant NPC's entity id /*004*/ uint32 playerid;
/*004*/ uint32 player_id; /*008*/ uint32 command; // 1=open, 0=cancel/close
/*008*/ uint32 command; // 1=open, 0=cancel/close /*012*/ float rate; // cost multiplier, dosent work anymore
/*012*/ float rate; // cost multiplier, dosent work anymore /*016*/ int32 unknown01; // Seen 3 from Server or -1 from Client
/*016*/ int32 tab_display; // bitmask b000 none, b001 Purchase/Sell, b010 Recover, b100 Parcels /*020*/ int32 unknown02; // Seen 2592000 from Server or -1 from Client
/*020*/ int32 unknown02; // Seen 2592000 from Server or -1 from Client /*024*/
/*024*/
}; };
/* /*
Unknowns: Unknowns:
0 is e7 from 01 to // MAYBE SLOT IN PURCHASE 0 is e7 from 01 to // MAYBE SLOT IN PURCHASE
@@ -4574,25 +4572,25 @@ struct RoF2SlotStruct
struct ItemSerializationHeader struct ItemSerializationHeader
{ {
/*000*/ char unknown000[17]; // New for HoT. Looks like a string. /*000*/ char unknown000[17]; // New for HoT. Looks like a string.
/*017*/ uint32 stacksize; /*017*/ uint32 stacksize;
/*021*/ uint32 unknown004; /*021*/ uint32 unknown004;
/*025*/ uint8 slot_type; // 0 = normal, 1 = bank, 2 = shared bank, 9 = merchant, 20 = ? /*025*/ uint8 slot_type; // 0 = normal, 1 = bank, 2 = shared bank, 9 = merchant, 20 = ?
/*026*/ uint16 main_slot; /*026*/ uint16 main_slot;
/*028*/ uint16 sub_slot; /*028*/ uint16 sub_slot;
/*030*/ uint16 aug_slot; // 0xffff /*030*/ uint16 aug_slot; // 0xffff
/*032*/ uint32 price; /*032*/ uint32 price;
/*036*/ uint32 merchant_slot; // 1 if not a merchant item /*036*/ uint32 merchant_slot; //1 if not a merchant item
/*040*/ uint32 scaled_value; // 0 /*040*/ uint32 scaled_value; //0
/*044*/ uint32 instance_id; // unique instance id if not merchant item, else is merchant slot /*044*/ uint32 instance_id; //unique instance id if not merchant item, else is merchant slot
/*048*/ uint32 parcel_item_id; /*048*/ uint32 unknown028; //0
/*052*/ uint32 last_cast_time; // Unix Time from PP of last cast for this recast type if recast delay > 0 /*052*/ uint32 last_cast_time; // Unix Time from PP of last cast for this recast type if recast delay > 0
/*056*/ uint32 charges; // Total Charges an item has (-1 for unlimited) /*056*/ uint32 charges; //Total Charges an item has (-1 for unlimited)
/*060*/ uint32 inst_nodrop; // 1 if the item is no drop (attuned items) /*060*/ uint32 inst_nodrop; // 1 if the item is no drop (attuned items)
/*064*/ uint32 unknown044; // 0 /*064*/ uint32 unknown044; // 0
/*068*/ uint32 unknown048; // 0 /*068*/ uint32 unknown048; // 0
/*072*/ uint32 unknown052; // 0 /*072*/ uint32 unknown052; // 0
uint8 isEvolving; uint8 isEvolving;
}; };
struct EvolvingItem { struct EvolvingItem {
@@ -5263,18 +5261,6 @@ struct Checksum_Struct {
uint8_t data[2048]; uint8_t data[2048];
}; };
struct Parcel_Struct
{
/*000*/ uint32 npc_id;
/*004*/ TypelessInventorySlot_Struct inventory_slot;
/*012*/ uint32 quantity;
/*016*/ uint32 money_flag;
/*020*/ char send_to[64];
/*084*/ char note[128];
/*212*/ uint32 unknown_212;
/*216*/ uint32 unknown_216;
/*220*/ uint32 unknown_220;
};
}; /*structs*/ }; /*structs*/
}; /*RoF2*/ }; /*RoF2*/
+2
View File
@@ -101,6 +101,7 @@ E(OP_SendZonepoints)
E(OP_SetGuildRank) E(OP_SetGuildRank)
E(OP_ShopPlayerBuy) E(OP_ShopPlayerBuy)
E(OP_ShopPlayerSell) E(OP_ShopPlayerSell)
E(OP_ShopRequest)
E(OP_SkillUpdate) E(OP_SkillUpdate)
E(OP_SomeItemPacketMaybe) E(OP_SomeItemPacketMaybe)
E(OP_SpawnAppearance) E(OP_SpawnAppearance)
@@ -182,6 +183,7 @@ D(OP_Save)
D(OP_SetServerFilter) D(OP_SetServerFilter)
D(OP_ShopPlayerBuy) D(OP_ShopPlayerBuy)
D(OP_ShopPlayerSell) D(OP_ShopPlayerSell)
D(OP_ShopRequest)
D(OP_Trader) D(OP_Trader)
D(OP_TraderBuy) D(OP_TraderBuy)
D(OP_TradeSkillCombine) D(OP_TradeSkillCombine)
+8 -10
View File
@@ -2200,17 +2200,15 @@ struct TimeOfDay_Struct {
}; };
// Darvik: shopkeeper structs // Darvik: shopkeeper structs
struct MerchantClick_Struct struct Merchant_Click_Struct {
{ /*000*/ uint32 npcid; // Merchant NPC's entity id
/*000*/ uint32 npc_id; // Merchant NPC's entity id /*004*/ uint32 playerid;
/*004*/ uint32 player_id; /*008*/ uint32 command; // 1=open, 0=cancel/close
/*008*/ uint32 command; // 1=open, 0=cancel/close /*012*/ float rate; // cost multiplier, dosent work anymore
/*012*/ float rate; // cost multiplier, dosent work anymore /*016*/ int32 unknown01; // Seen 3 from Server or -1 from Client
/*016*/ int32 tab_display; // bitmask b000 none, b001 Purchase/Sell, b010 Recover, b100 Parcels /*020*/ int32 unknown02; // Seen 2592000 from Server or -1 from Client
/*020*/ int32 unknown020; // Seen 2592000 from Server or -1 from Client /*024*/
/*024*/
}; };
/* /*
Unknowns: Unknowns:
0 is e7 from 01 to // MAYBE SLOT IN PURCHASE 0 is e7 from 01 to // MAYBE SLOT IN PURCHASE
-28
View File
@@ -2026,19 +2026,6 @@ namespace SoD
FINISH_ENCODE(); FINISH_ENCODE();
} }
ENCODE(OP_ShopRequest)
{
ENCODE_LENGTH_EXACT(MerchantClick_Struct);
SETUP_DIRECT_ENCODE(MerchantClick_Struct, structs::MerchantClick_Struct);
OUT(npc_id);
OUT(player_id);
OUT(command);
OUT(rate);
FINISH_ENCODE();
}
ENCODE(OP_SomeItemPacketMaybe) ENCODE(OP_SomeItemPacketMaybe)
{ {
// This Opcode is not named very well. It is used for the animation of arrows leaving the player's bow // This Opcode is not named very well. It is used for the animation of arrows leaving the player's bow
@@ -3496,21 +3483,6 @@ namespace SoD
FINISH_DIRECT_DECODE(); FINISH_DIRECT_DECODE();
} }
DECODE(OP_ShopRequest)
{
DECODE_LENGTH_EXACT(structs::MerchantClick_Struct);
SETUP_DIRECT_DECODE(MerchantClick_Struct, structs::MerchantClick_Struct);
IN(npc_id);
IN(player_id);
IN(command);
IN(rate);
emu->tab_display = 0;
emu->unknown020 = 0;
FINISH_DIRECT_DECODE();
}
DECODE(OP_TraderBuy) DECODE(OP_TraderBuy)
{ {
DECODE_LENGTH_EXACT(structs::TraderBuy_Struct); DECODE_LENGTH_EXACT(structs::TraderBuy_Struct);
-2
View File
@@ -78,7 +78,6 @@ E(OP_SendCharInfo)
E(OP_SendZonepoints) E(OP_SendZonepoints)
E(OP_ShopPlayerBuy) E(OP_ShopPlayerBuy)
E(OP_ShopPlayerSell) E(OP_ShopPlayerSell)
E(OP_ShopRequest)
E(OP_SomeItemPacketMaybe) E(OP_SomeItemPacketMaybe)
E(OP_SpawnDoor) E(OP_SpawnDoor)
E(OP_SpecialMesg) E(OP_SpecialMesg)
@@ -142,7 +141,6 @@ D(OP_Save)
D(OP_SetServerFilter) D(OP_SetServerFilter)
D(OP_ShopPlayerBuy) D(OP_ShopPlayerBuy)
D(OP_ShopPlayerSell) D(OP_ShopPlayerSell)
D(OP_ShopRequest)
D(OP_TraderBuy) D(OP_TraderBuy)
D(OP_TradeSkillCombine) D(OP_TradeSkillCombine)
D(OP_TributeItem) D(OP_TributeItem)
+5 -9
View File
@@ -1845,16 +1845,12 @@ struct TimeOfDay_Struct {
}; };
// Darvik: shopkeeper structs // Darvik: shopkeeper structs
struct MerchantClick_Struct struct Merchant_Click_Struct {
{ /*000*/ uint32 npcid; // Merchant NPC's entity id
/*000*/ uint32 npc_id; // Merchant NPC's entity id /*004*/ uint32 playerid;
/*004*/ uint32 player_id; /*008*/ uint32 command; //1=open, 0=cancel/close
/*008*/ uint32 command; // 1=open, 0=cancel/close /*012*/ float rate; //cost multiplier, dosent work anymore
/*012*/ float rate; // cost multiplier, dosent work anymore
/*016*/ int32 tab_display; // bitmask b000 none, b001 Purchase/Sell, b010 Recover, b100 Parcels
/*020*/ int32 unknown020; // Seen 2592000 from Server or -1 from Client
}; };
/* /*
Unknowns: Unknowns:
0 is e7 from 01 to // MAYBE SLOT IN PURCHASE 0 is e7 from 01 to // MAYBE SLOT IN PURCHASE
-28
View File
@@ -1683,19 +1683,6 @@ namespace SoF
FINISH_ENCODE(); FINISH_ENCODE();
} }
ENCODE(OP_ShopRequest)
{
ENCODE_LENGTH_EXACT(MerchantClick_Struct);
SETUP_DIRECT_ENCODE(MerchantClick_Struct, structs::MerchantClick_Struct);
OUT(npc_id);
OUT(player_id);
OUT(command);
OUT(rate);
FINISH_ENCODE();
}
ENCODE(OP_SomeItemPacketMaybe) ENCODE(OP_SomeItemPacketMaybe)
{ {
// This Opcode is not named very well. It is used for the animation of arrows leaving the player's bow // This Opcode is not named very well. It is used for the animation of arrows leaving the player's bow
@@ -2887,21 +2874,6 @@ namespace SoF
FINISH_DIRECT_DECODE(); FINISH_DIRECT_DECODE();
} }
DECODE(OP_ShopRequest)
{
DECODE_LENGTH_EXACT(structs::MerchantClick_Struct);
SETUP_DIRECT_DECODE(MerchantClick_Struct, structs::MerchantClick_Struct);
IN(npc_id);
IN(player_id);
IN(command);
IN(rate);
emu->tab_display = 0;
emu->unknown020 = 0;
FINISH_DIRECT_DECODE();
}
DECODE(OP_TraderBuy) DECODE(OP_TraderBuy)
{ {
DECODE_LENGTH_EXACT(structs::TraderBuy_Struct); DECODE_LENGTH_EXACT(structs::TraderBuy_Struct);
-2
View File
@@ -72,7 +72,6 @@ E(OP_SendAATable)
E(OP_SendCharInfo) E(OP_SendCharInfo)
E(OP_SendZonepoints) E(OP_SendZonepoints)
E(OP_ShopPlayerSell) E(OP_ShopPlayerSell)
E(OP_ShopRequest)
E(OP_SomeItemPacketMaybe) E(OP_SomeItemPacketMaybe)
E(OP_SpawnDoor) E(OP_SpawnDoor)
E(OP_SpecialMesg) E(OP_SpecialMesg)
@@ -129,7 +128,6 @@ D(OP_ReadBook)
D(OP_Save) D(OP_Save)
D(OP_SetServerFilter) D(OP_SetServerFilter)
D(OP_ShopPlayerSell) D(OP_ShopPlayerSell)
D(OP_ShopRequest)
D(OP_TraderBuy) D(OP_TraderBuy)
D(OP_TradeSkillCombine) D(OP_TradeSkillCombine)
D(OP_TributeItem) D(OP_TributeItem)
+5 -9
View File
@@ -1859,16 +1859,12 @@ struct TimeOfDay_Struct {
}; };
// Darvik: shopkeeper structs // Darvik: shopkeeper structs
struct MerchantClick_Struct struct Merchant_Click_Struct {
{ /*000*/ uint32 npcid; // Merchant NPC's entity id
/*000*/ uint32 npc_id; // Merchant NPC's entity id /*004*/ uint32 playerid;
/*004*/ uint32 player_id; /*008*/ uint32 command; //1=open, 0=cancel/close
/*008*/ uint32 command; // 1=open, 0=cancel/close /*012*/ float rate; //cost multiplier, dosent work anymore
/*012*/ float rate; // cost multiplier, dosent work anymore
/*016*/ int32 tab_display; // bitmask b000 none, b001 Purchase/Sell, b010 Recover, b100 Parcels
/*020*/ int32 unknown020; // Seen 2592000 from Server or -1 from Client
}; };
/* /*
Unknowns: Unknowns:
0 is e7 from 01 to // MAYBE SLOT IN PURCHASE 0 is e7 from 01 to // MAYBE SLOT IN PURCHASE
-50
View File
@@ -748,28 +748,6 @@ namespace Titanium
FINISH_ENCODE(); FINISH_ENCODE();
} }
ENCODE(OP_GuildsList)
{
EQApplicationPacket* in = *p;
*p = nullptr;
GuildsListMessaging_Struct glms{};
EQ::Util::MemoryStreamReader ss(reinterpret_cast<char *>(in->pBuffer), in->size);
cereal::BinaryInputArchive ar(ss);
ar(glms);
auto outapp = new EQApplicationPacket(OP_GuildsList, sizeof(structs::GuildsList_Struct));
auto out = (structs::GuildsList_Struct *) outapp->pBuffer;
for (auto const& g : glms.guild_detail) {
if (g.guild_id < Titanium::constants::MAX_GUILD_ID) {
strn0cpy(out->Guilds[g.guild_id].name, g.guild_name.c_str(), sizeof(out->Guilds[g.guild_id].name));
}
}
dest->FastQueuePacket(&outapp);
}
ENCODE(OP_GuildMemberAdd) ENCODE(OP_GuildMemberAdd)
{ {
ENCODE_LENGTH_EXACT(GuildMemberAdd_Struct) ENCODE_LENGTH_EXACT(GuildMemberAdd_Struct)
@@ -1880,19 +1858,6 @@ namespace Titanium
FINISH_ENCODE(); FINISH_ENCODE();
} }
ENCODE(OP_ShopRequest)
{
ENCODE_LENGTH_EXACT(MerchantClick_Struct);
SETUP_DIRECT_ENCODE(MerchantClick_Struct, structs::MerchantClick_Struct);
OUT(npc_id);
OUT(player_id);
OUT(command);
OUT(rate);
FINISH_ENCODE();
}
ENCODE(OP_SpecialMesg) ENCODE(OP_SpecialMesg)
{ {
EQApplicationPacket *in = *p; EQApplicationPacket *in = *p;
@@ -2910,21 +2875,6 @@ namespace Titanium
FINISH_DIRECT_DECODE(); FINISH_DIRECT_DECODE();
} }
DECODE(OP_ShopRequest)
{
DECODE_LENGTH_EXACT(structs::MerchantClick_Struct);
SETUP_DIRECT_DECODE(MerchantClick_Struct, structs::MerchantClick_Struct);
IN(npc_id);
IN(player_id);
IN(command);
IN(rate);
emu->tab_display = 0;
emu->unknown020 = 0;
FINISH_DIRECT_DECODE();
}
DECODE(OP_TraderBuy) DECODE(OP_TraderBuy)
{ {
DECODE_LENGTH_EXACT(structs::TraderBuy_Struct); DECODE_LENGTH_EXACT(structs::TraderBuy_Struct);
-1
View File
@@ -287,7 +287,6 @@ namespace Titanium
const size_t CHARACTER_CREATION_LIMIT = 8; // Hard-coded in client - DO NOT ALTER const size_t CHARACTER_CREATION_LIMIT = 8; // Hard-coded in client - DO NOT ALTER
const size_t SAY_LINK_BODY_SIZE = 45; const size_t SAY_LINK_BODY_SIZE = 45;
const uint32 MAX_GUILD_ID = 1500;
} /*constants*/ } /*constants*/
-3
View File
@@ -45,7 +45,6 @@ E(OP_Emote)
E(OP_FormattedMessage) E(OP_FormattedMessage)
E(OP_GroundSpawn) E(OP_GroundSpawn)
E(OP_SetGuildRank) E(OP_SetGuildRank)
E(OP_GuildsList)
E(OP_GuildMemberLevelUpdate) E(OP_GuildMemberLevelUpdate)
E(OP_GuildMemberList) E(OP_GuildMemberList)
E(OP_GuildMemberAdd) E(OP_GuildMemberAdd)
@@ -75,7 +74,6 @@ E(OP_SendCharInfo)
E(OP_SendAATable) E(OP_SendAATable)
E(OP_SetFace) E(OP_SetFace)
E(OP_ShopPlayerSell) E(OP_ShopPlayerSell)
E(OP_ShopRequest)
E(OP_SpawnAppearance) E(OP_SpawnAppearance)
E(OP_SpecialMesg) E(OP_SpecialMesg)
E(OP_TaskDescription) E(OP_TaskDescription)
@@ -122,7 +120,6 @@ D(OP_RaidInvite)
D(OP_ReadBook) D(OP_ReadBook)
D(OP_SetServerFilter) D(OP_SetServerFilter)
D(OP_ShopPlayerSell) D(OP_ShopPlayerSell)
D(OP_ShopRequest)
D(OP_TraderBuy) D(OP_TraderBuy)
D(OP_TradeSkillCombine) D(OP_TradeSkillCombine)
D(OP_TributeItem) D(OP_TributeItem)
+3 -3
View File
@@ -1669,9 +1669,9 @@ struct TimeOfDay_Struct {
}; };
// Darvik: shopkeeper structs // Darvik: shopkeeper structs
struct MerchantClick_Struct { struct Merchant_Click_Struct {
/*000*/ uint32 npc_id; // Merchant NPC's entity id /*000*/ uint32 npcid; // Merchant NPC's entity id
/*004*/ uint32 player_id; /*004*/ uint32 playerid;
/*008*/ uint32 command; //1=open, 0=cancel/close /*008*/ uint32 command; //1=open, 0=cancel/close
/*012*/ float rate; //cost multiplier, dosent work anymore /*012*/ float rate; //cost multiplier, dosent work anymore
}; };
+38 -50
View File
@@ -1182,37 +1182,53 @@ namespace UF
ENCODE(OP_GuildsList) ENCODE(OP_GuildsList)
{ {
EQApplicationPacket* in = *p; EQApplicationPacket *in = *p;
*p = nullptr; *p = nullptr;
GuildsListMessaging_Struct glms{}; uint32 NumberOfGuilds = in->size / 64;
EQ::Util::MemoryStreamReader ss(reinterpret_cast<char *>(in->pBuffer), in->size); uint32 PacketSize = 68; // 64 x 0x00 + a uint32 that I am guessing is the highest guild ID in use.
cereal::BinaryInputArchive ar(ss);
ar(glms);
auto packet_size = 64 + 4 + glms.guild_detail.size() * 4 + glms.string_length; unsigned char *__emu_buffer = in->pBuffer;
auto buffer = new uchar[packet_size]; char *InBuffer = (char *)__emu_buffer;
auto buf_pos = buffer; uint32 actual_no_guilds = 0;
memset(buf_pos, 0, 64); for (unsigned int i = 0; i < NumberOfGuilds; ++i)
buf_pos += 64; {
if (InBuffer[0])
VARSTRUCT_ENCODE_TYPE(uint32, buf_pos, glms.no_of_guilds); {
PacketSize += (5 + strlen(InBuffer));
for (auto const& g : glms.guild_detail) { actual_no_guilds++;
if (g.guild_id < UF::constants::MAX_GUILD_ID) {
VARSTRUCT_ENCODE_TYPE(uint32, buf_pos, g.guild_id);
strn0cpy((char *) buf_pos, g.guild_name.c_str(), g.guild_name.length() + 1);
buf_pos += g.guild_name.length() + 1;
} }
InBuffer += 64;
} }
auto outapp = new EQApplicationPacket(OP_GuildsList); PacketSize++; // Appears to be an extra 0x00 at the very end.
in->size = PacketSize;
in->pBuffer = new unsigned char[in->size];
InBuffer = (char *)__emu_buffer;
char *OutBuffer = (char *)in->pBuffer;
outapp->size = packet_size; // Init the first 64 bytes to zero, as per live.
outapp->pBuffer = buffer; //
memset(OutBuffer, 0, 64);
OutBuffer += 64;
dest->FastQueuePacket(&outapp); VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, actual_no_guilds);
for (unsigned int i = 0; i < NumberOfGuilds; ++i)
{
if (InBuffer[0])
{
VARSTRUCT_ENCODE_TYPE(uint32, OutBuffer, i - 1);
VARSTRUCT_ENCODE_STRING(OutBuffer, InBuffer);
}
InBuffer += 64;
}
VARSTRUCT_ENCODE_TYPE(uint8, OutBuffer, 0x00);
delete[] __emu_buffer;
dest->FastQueuePacket(&in, ack_req);
} }
ENCODE(OP_GuildMemberAdd) ENCODE(OP_GuildMemberAdd)
@@ -2438,19 +2454,6 @@ namespace UF
FINISH_ENCODE(); FINISH_ENCODE();
} }
ENCODE(OP_ShopRequest)
{
ENCODE_LENGTH_EXACT(MerchantClick_Struct);
SETUP_DIRECT_ENCODE(MerchantClick_Struct, structs::MerchantClick_Struct);
OUT(npc_id);
OUT(player_id);
OUT(command);
OUT(rate);
FINISH_ENCODE();
}
ENCODE(OP_SomeItemPacketMaybe) ENCODE(OP_SomeItemPacketMaybe)
{ {
// This Opcode is not named very well. It is used for the animation of arrows leaving the player's bow // This Opcode is not named very well. It is used for the animation of arrows leaving the player's bow
@@ -4044,21 +4047,6 @@ namespace UF
FINISH_DIRECT_DECODE(); FINISH_DIRECT_DECODE();
} }
DECODE(OP_ShopRequest)
{
DECODE_LENGTH_EXACT(structs::MerchantClick_Struct);
SETUP_DIRECT_DECODE(MerchantClick_Struct, structs::MerchantClick_Struct);
IN(npc_id);
IN(player_id);
IN(command);
IN(rate);
emu->tab_display = 0;
emu->unknown020 = 0;
FINISH_DIRECT_DECODE();
}
DECODE(OP_TraderBuy) DECODE(OP_TraderBuy)
{ {
DECODE_LENGTH_EXACT(structs::TraderBuy_Struct); DECODE_LENGTH_EXACT(structs::TraderBuy_Struct);
-1
View File
@@ -289,7 +289,6 @@ namespace UF
const size_t CHARACTER_CREATION_LIMIT = 12; const size_t CHARACTER_CREATION_LIMIT = 12;
const size_t SAY_LINK_BODY_SIZE = 50; const size_t SAY_LINK_BODY_SIZE = 50;
const uint32 MAX_GUILD_ID = 50000;
} /*constants*/ } /*constants*/
-2
View File
@@ -89,7 +89,6 @@ E(OP_SendZonepoints)
E(OP_SetGuildRank) E(OP_SetGuildRank)
E(OP_ShopPlayerBuy) E(OP_ShopPlayerBuy)
E(OP_ShopPlayerSell) E(OP_ShopPlayerSell)
E(OP_ShopRequest)
E(OP_SomeItemPacketMaybe) E(OP_SomeItemPacketMaybe)
E(OP_SpawnAppearance) E(OP_SpawnAppearance)
E(OP_SpawnDoor) E(OP_SpawnDoor)
@@ -159,7 +158,6 @@ D(OP_Save)
D(OP_SetServerFilter) D(OP_SetServerFilter)
D(OP_ShopPlayerBuy) D(OP_ShopPlayerBuy)
D(OP_ShopPlayerSell) D(OP_ShopPlayerSell)
D(OP_ShopRequest)
D(OP_TraderBuy) D(OP_TraderBuy)
D(OP_TradeSkillCombine) D(OP_TradeSkillCombine)
D(OP_TributeItem) D(OP_TributeItem)
+3 -3
View File
@@ -1916,9 +1916,9 @@ struct TimeOfDay_Struct {
}; };
// Darvik: shopkeeper structs // Darvik: shopkeeper structs
struct MerchantClick_Struct { struct Merchant_Click_Struct {
/*000*/ uint32 npc_id; // Merchant NPC's entity id /*000*/ uint32 npcid; // Merchant NPC's entity id
/*004*/ uint32 player_id; /*004*/ uint32 playerid;
/*008*/ uint32 command; //1=open, 0=cancel/close /*008*/ uint32 command; //1=open, 0=cancel/close
/*012*/ float rate; //cost multiplier, dosent work anymore /*012*/ float rate; //cost multiplier, dosent work anymore
}; };
+1 -1
View File
@@ -1379,7 +1379,7 @@ uint32 GetPlayerRaceValue(uint16 race_id) {
} }
} }
uint16 GetPlayerRaceBit(uint16 race_id) { uint32 GetPlayerRaceBit(uint16 race_id) {
switch (race_id) { switch (race_id) {
case HUMAN: case HUMAN:
return PLAYER_RACE_HUMAN_BIT; return PLAYER_RACE_HUMAN_BIT;
+1 -1
View File
@@ -124,7 +124,7 @@ bool IsPlayerRace(uint16 race_id);
const std::string GetPlayerRaceAbbreviation(uint16 race_id); const std::string GetPlayerRaceAbbreviation(uint16 race_id);
uint32 GetPlayerRaceValue(uint16 race_id); uint32 GetPlayerRaceValue(uint16 race_id);
uint16 GetPlayerRaceBit(uint16 race_id); uint32 GetPlayerRaceBit(uint16 race_id);
uint16 GetRaceIDFromPlayerRaceValue(uint32 player_race_value); uint16 GetRaceIDFromPlayerRaceValue(uint32 player_race_value);
uint16 GetRaceIDFromPlayerRaceBit(uint32 player_race_bit); uint16 GetRaceIDFromPlayerRaceBit(uint32 player_race_bit);
-62
View File
@@ -44,69 +44,7 @@ public:
*/ */
// Custom extended repository methods here // Custom extended repository methods here
static int16 GetAccountStatus(Database& db, const uint32 account_id)
{
auto results = db.QueryDatabase(
fmt::format(
"SELECT `status`, TIMESTAMPDIFF(SECOND, NOW(), `suspendeduntil`) FROM `{}` WHERE `{}` = {}",
TableName(),
PrimaryKey(),
account_id
)
);
if (!results.Success() || !results.RowCount()) {
return 0;
}
auto row = results.begin();
int16 status = static_cast<int16>(Strings::ToInt(row[0]));
int date_diff = 0;
if (row[1]) {
date_diff = Strings::ToInt(row[1]);
}
if (date_diff > 0) {
status = -1;
}
return status;
}
static bool UpdatePassword(Database& db, const uint32 account_id, const std::string& password)
{
auto results = db.QueryDatabase(
fmt::format(
"UPDATE `{}` SET `password` = MD5('{}') WHERE `{}` = {}",
TableName(),
password,
PrimaryKey(),
account_id
)
);
return results.Success();
}
static std::string GetAutoLoginCharacterNameByAccountID(Database& db, const uint32 account_id)
{
return AccountRepository::FindOne(db, account_id).auto_login_charname;
}
static bool SetAutoLoginCharacterNameByAccountID(Database& db, const uint32 account_id, const std::string& character_name)
{
auto e = AccountRepository::FindOne(db, account_id);
if (!e.id) {
return false;
}
e.auto_login_charname = character_name;
return AccountRepository::UpdateOne(db, e);
}
}; };
#endif //EQEMU_ACCOUNT_REPOSITORY_H #endif //EQEMU_ACCOUNT_REPOSITORY_H
@@ -44,65 +44,7 @@ public:
*/ */
// Custom extended repository methods here // Custom extended repository methods here
static void UpdateAdventureStatsEntry(Database& db, uint32 character_id, uint8 theme_id, bool is_win, bool is_remove)
{
std::string field;
switch (theme_id) {
case LDoNThemes::GUK: {
field = "guk_";
break;
}
case LDoNThemes::MIR: {
field = "mir_";
break;
}
case LDoNThemes::MMC: {
field = "mmc_";
break;
}
case LDoNThemes::RUJ: {
field = "ruj_";
break;
}
case LDoNThemes::TAK: {
field = "tak_";
break;
}
}
field += is_win ? "wins" : "losses";
auto e = FindOne(db, character_id);
if (!e.player_id && !is_remove) {
const std::string& query = fmt::format(
"INSERT INTO `{}` SET `{}` = 1, `{}` = {}",
TableName(),
field,
PrimaryKey(),
character_id
);
db.QueryDatabase(query);
return;
}
const std::string& field_operation = is_remove ? "-" : "+";
const std::string& query = fmt::format(
"UPDATE `{}` SET `{}` = {} {} 1 WHERE `{}` = {}",
TableName(),
field,
field,
field_operation,
PrimaryKey(),
character_id
);
db.QueryDatabase(query);
}
}; };
#endif //EQEMU_ADVENTURE_STATS_REPOSITORY_H #endif //EQEMU_ADVENTURE_STATS_REPOSITORY_H
@@ -22,7 +22,7 @@ public:
int32_t accid; int32_t accid;
std::string ip; std::string ip;
int32_t count; int32_t count;
time_t lastused; std::string lastused;
}; };
static std::string PrimaryKey() static std::string PrimaryKey()
@@ -46,7 +46,7 @@ public:
"accid", "accid",
"ip", "ip",
"count", "count",
"UNIX_TIMESTAMP(lastused)", "lastused",
}; };
} }
@@ -130,7 +130,7 @@ public:
e.accid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0; e.accid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
e.ip = row[1] ? row[1] : ""; e.ip = row[1] ? row[1] : "";
e.count = row[2] ? static_cast<int32_t>(atoi(row[2])) : 1; e.count = row[2] ? static_cast<int32_t>(atoi(row[2])) : 1;
e.lastused = strtoll(row[3] ? row[3] : "-1", nullptr, 10); e.lastused = row[3] ? row[3] : std::time(nullptr);
return e; return e;
} }
@@ -167,7 +167,7 @@ public:
v.push_back(columns[0] + " = " + std::to_string(e.accid)); v.push_back(columns[0] + " = " + std::to_string(e.accid));
v.push_back(columns[1] + " = '" + Strings::Escape(e.ip) + "'"); v.push_back(columns[1] + " = '" + Strings::Escape(e.ip) + "'");
v.push_back(columns[2] + " = " + std::to_string(e.count)); v.push_back(columns[2] + " = " + std::to_string(e.count));
v.push_back(columns[3] + " = FROM_UNIXTIME(" + (e.lastused > 0 ? std::to_string(e.lastused) : "null") + ")"); v.push_back(columns[3] + " = '" + Strings::Escape(e.lastused) + "'");
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@@ -192,7 +192,7 @@ public:
v.push_back(std::to_string(e.accid)); v.push_back(std::to_string(e.accid));
v.push_back("'" + Strings::Escape(e.ip) + "'"); v.push_back("'" + Strings::Escape(e.ip) + "'");
v.push_back(std::to_string(e.count)); v.push_back(std::to_string(e.count));
v.push_back("FROM_UNIXTIME(" + (e.lastused > 0 ? std::to_string(e.lastused) : "null") + ")"); v.push_back("'" + Strings::Escape(e.lastused) + "'");
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@@ -225,7 +225,7 @@ public:
v.push_back(std::to_string(e.accid)); v.push_back(std::to_string(e.accid));
v.push_back("'" + Strings::Escape(e.ip) + "'"); v.push_back("'" + Strings::Escape(e.ip) + "'");
v.push_back(std::to_string(e.count)); v.push_back(std::to_string(e.count));
v.push_back("FROM_UNIXTIME(" + (e.lastused > 0 ? std::to_string(e.lastused) : "null") + ")"); v.push_back("'" + Strings::Escape(e.lastused) + "'");
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
} }
@@ -262,7 +262,7 @@ public:
e.accid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0; e.accid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
e.ip = row[1] ? row[1] : ""; e.ip = row[1] ? row[1] : "";
e.count = row[2] ? static_cast<int32_t>(atoi(row[2])) : 1; e.count = row[2] ? static_cast<int32_t>(atoi(row[2])) : 1;
e.lastused = strtoll(row[3] ? row[3] : "-1", nullptr, 10); e.lastused = row[3] ? row[3] : std::time(nullptr);
all_entries.push_back(e); all_entries.push_back(e);
} }
@@ -290,7 +290,7 @@ public:
e.accid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0; e.accid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
e.ip = row[1] ? row[1] : ""; e.ip = row[1] ? row[1] : "";
e.count = row[2] ? static_cast<int32_t>(atoi(row[2])) : 1; e.count = row[2] ? static_cast<int32_t>(atoi(row[2])) : 1;
e.lastused = strtoll(row[3] ? row[3] : "-1", nullptr, 10); e.lastused = row[3] ? row[3] : std::time(nullptr);
all_entries.push_back(e); all_entries.push_back(e);
} }
@@ -368,7 +368,7 @@ public:
v.push_back(std::to_string(e.accid)); v.push_back(std::to_string(e.accid));
v.push_back("'" + Strings::Escape(e.ip) + "'"); v.push_back("'" + Strings::Escape(e.ip) + "'");
v.push_back(std::to_string(e.count)); v.push_back(std::to_string(e.count));
v.push_back("FROM_UNIXTIME(" + (e.lastused > 0 ? std::to_string(e.lastused) : "null") + ")"); v.push_back("'" + Strings::Escape(e.lastused) + "'");
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@@ -394,7 +394,7 @@ public:
v.push_back(std::to_string(e.accid)); v.push_back(std::to_string(e.accid));
v.push_back("'" + Strings::Escape(e.ip) + "'"); v.push_back("'" + Strings::Escape(e.ip) + "'");
v.push_back(std::to_string(e.count)); v.push_back(std::to_string(e.count));
v.push_back("FROM_UNIXTIME(" + (e.lastused > 0 ? std::to_string(e.lastused) : "null") + ")"); v.push_back("'" + Strings::Escape(e.lastused) + "'");
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
} }
+117 -129
View File
@@ -22,7 +22,6 @@ public:
int32_t id; int32_t id;
std::string name; std::string name;
std::string charname; std::string charname;
std::string auto_login_charname;
uint32_t sharedplat; uint32_t sharedplat;
std::string password; std::string password;
int32_t status; int32_t status;
@@ -57,7 +56,6 @@ public:
"id", "id",
"name", "name",
"charname", "charname",
"auto_login_charname",
"sharedplat", "sharedplat",
"password", "password",
"status", "status",
@@ -88,7 +86,6 @@ public:
"id", "id",
"name", "name",
"charname", "charname",
"auto_login_charname",
"sharedplat", "sharedplat",
"password", "password",
"status", "status",
@@ -150,31 +147,30 @@ public:
{ {
Account e{}; Account e{};
e.id = 0; e.id = 0;
e.name = ""; e.name = "";
e.charname = ""; e.charname = "";
e.auto_login_charname = ""; e.sharedplat = 0;
e.sharedplat = 0; e.password = "";
e.password = ""; e.status = 0;
e.status = 0; e.ls_id = "eqemu";
e.ls_id = "eqemu"; e.lsaccount_id = 0;
e.lsaccount_id = 0; e.gmspeed = 0;
e.gmspeed = 0; e.invulnerable = 0;
e.invulnerable = 0; e.flymode = 0;
e.flymode = 0; e.ignore_tells = 0;
e.ignore_tells = 0; e.revoked = 0;
e.revoked = 0; e.karma = 0;
e.karma = 0; e.minilogin_ip = "";
e.minilogin_ip = ""; e.hideme = 0;
e.hideme = 0; e.rulesflag = 0;
e.rulesflag = 0; e.suspendeduntil = 0;
e.suspendeduntil = 0; e.time_creation = 0;
e.time_creation = 0; e.ban_reason = "";
e.ban_reason = ""; e.suspend_reason = "";
e.suspend_reason = ""; e.crc_eqgame = "";
e.crc_eqgame = ""; e.crc_skillcaps = "";
e.crc_skillcaps = ""; e.crc_basedata = "";
e.crc_basedata = "";
return e; return e;
} }
@@ -211,31 +207,30 @@ public:
if (results.RowCount() == 1) { if (results.RowCount() == 1) {
Account e{}; Account e{};
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0; e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
e.name = row[1] ? row[1] : ""; e.name = row[1] ? row[1] : "";
e.charname = row[2] ? row[2] : ""; e.charname = row[2] ? row[2] : "";
e.auto_login_charname = row[3] ? row[3] : ""; e.sharedplat = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
e.sharedplat = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0; e.password = row[4] ? row[4] : "";
e.password = row[5] ? row[5] : ""; e.status = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
e.status = row[6] ? static_cast<int32_t>(atoi(row[6])) : 0; e.ls_id = row[6] ? row[6] : "eqemu";
e.ls_id = row[7] ? row[7] : "eqemu"; e.lsaccount_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
e.lsaccount_id = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0; e.gmspeed = row[8] ? static_cast<uint8_t>(strtoul(row[8], nullptr, 10)) : 0;
e.gmspeed = row[9] ? static_cast<uint8_t>(strtoul(row[9], nullptr, 10)) : 0; e.invulnerable = row[9] ? static_cast<int8_t>(atoi(row[9])) : 0;
e.invulnerable = row[10] ? static_cast<int8_t>(atoi(row[10])) : 0; e.flymode = row[10] ? static_cast<int8_t>(atoi(row[10])) : 0;
e.flymode = row[11] ? static_cast<int8_t>(atoi(row[11])) : 0; e.ignore_tells = row[11] ? static_cast<int8_t>(atoi(row[11])) : 0;
e.ignore_tells = row[12] ? static_cast<int8_t>(atoi(row[12])) : 0; e.revoked = row[12] ? static_cast<uint8_t>(strtoul(row[12], nullptr, 10)) : 0;
e.revoked = row[13] ? static_cast<uint8_t>(strtoul(row[13], nullptr, 10)) : 0; e.karma = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
e.karma = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0; e.minilogin_ip = row[14] ? row[14] : "";
e.minilogin_ip = row[15] ? row[15] : ""; e.hideme = row[15] ? static_cast<int8_t>(atoi(row[15])) : 0;
e.hideme = row[16] ? static_cast<int8_t>(atoi(row[16])) : 0; e.rulesflag = row[16] ? static_cast<uint8_t>(strtoul(row[16], nullptr, 10)) : 0;
e.rulesflag = row[17] ? static_cast<uint8_t>(strtoul(row[17], nullptr, 10)) : 0; e.suspendeduntil = strtoll(row[17] ? row[17] : "-1", nullptr, 10);
e.suspendeduntil = strtoll(row[18] ? row[18] : "-1", nullptr, 10); e.time_creation = row[18] ? static_cast<uint32_t>(strtoul(row[18], nullptr, 10)) : 0;
e.time_creation = row[19] ? static_cast<uint32_t>(strtoul(row[19], nullptr, 10)) : 0; e.ban_reason = row[19] ? row[19] : "";
e.ban_reason = row[20] ? row[20] : ""; e.suspend_reason = row[20] ? row[20] : "";
e.suspend_reason = row[21] ? row[21] : ""; e.crc_eqgame = row[21] ? row[21] : "";
e.crc_eqgame = row[22] ? row[22] : ""; e.crc_skillcaps = row[22] ? row[22] : "";
e.crc_skillcaps = row[23] ? row[23] : ""; e.crc_basedata = row[23] ? row[23] : "";
e.crc_basedata = row[24] ? row[24] : "";
return e; return e;
} }
@@ -271,28 +266,27 @@ public:
v.push_back(columns[1] + " = '" + Strings::Escape(e.name) + "'"); v.push_back(columns[1] + " = '" + Strings::Escape(e.name) + "'");
v.push_back(columns[2] + " = '" + Strings::Escape(e.charname) + "'"); v.push_back(columns[2] + " = '" + Strings::Escape(e.charname) + "'");
v.push_back(columns[3] + " = '" + Strings::Escape(e.auto_login_charname) + "'"); v.push_back(columns[3] + " = " + std::to_string(e.sharedplat));
v.push_back(columns[4] + " = " + std::to_string(e.sharedplat)); v.push_back(columns[4] + " = '" + Strings::Escape(e.password) + "'");
v.push_back(columns[5] + " = '" + Strings::Escape(e.password) + "'"); v.push_back(columns[5] + " = " + std::to_string(e.status));
v.push_back(columns[6] + " = " + std::to_string(e.status)); v.push_back(columns[6] + " = '" + Strings::Escape(e.ls_id) + "'");
v.push_back(columns[7] + " = '" + Strings::Escape(e.ls_id) + "'"); v.push_back(columns[7] + " = " + std::to_string(e.lsaccount_id));
v.push_back(columns[8] + " = " + std::to_string(e.lsaccount_id)); v.push_back(columns[8] + " = " + std::to_string(e.gmspeed));
v.push_back(columns[9] + " = " + std::to_string(e.gmspeed)); v.push_back(columns[9] + " = " + std::to_string(e.invulnerable));
v.push_back(columns[10] + " = " + std::to_string(e.invulnerable)); v.push_back(columns[10] + " = " + std::to_string(e.flymode));
v.push_back(columns[11] + " = " + std::to_string(e.flymode)); v.push_back(columns[11] + " = " + std::to_string(e.ignore_tells));
v.push_back(columns[12] + " = " + std::to_string(e.ignore_tells)); v.push_back(columns[12] + " = " + std::to_string(e.revoked));
v.push_back(columns[13] + " = " + std::to_string(e.revoked)); v.push_back(columns[13] + " = " + std::to_string(e.karma));
v.push_back(columns[14] + " = " + std::to_string(e.karma)); v.push_back(columns[14] + " = '" + Strings::Escape(e.minilogin_ip) + "'");
v.push_back(columns[15] + " = '" + Strings::Escape(e.minilogin_ip) + "'"); v.push_back(columns[15] + " = " + std::to_string(e.hideme));
v.push_back(columns[16] + " = " + std::to_string(e.hideme)); v.push_back(columns[16] + " = " + std::to_string(e.rulesflag));
v.push_back(columns[17] + " = " + std::to_string(e.rulesflag)); v.push_back(columns[17] + " = FROM_UNIXTIME(" + (e.suspendeduntil > 0 ? std::to_string(e.suspendeduntil) : "null") + ")");
v.push_back(columns[18] + " = FROM_UNIXTIME(" + (e.suspendeduntil > 0 ? std::to_string(e.suspendeduntil) : "null") + ")"); v.push_back(columns[18] + " = " + std::to_string(e.time_creation));
v.push_back(columns[19] + " = " + std::to_string(e.time_creation)); v.push_back(columns[19] + " = '" + Strings::Escape(e.ban_reason) + "'");
v.push_back(columns[20] + " = '" + Strings::Escape(e.ban_reason) + "'"); v.push_back(columns[20] + " = '" + Strings::Escape(e.suspend_reason) + "'");
v.push_back(columns[21] + " = '" + Strings::Escape(e.suspend_reason) + "'"); v.push_back(columns[21] + " = '" + Strings::Escape(e.crc_eqgame) + "'");
v.push_back(columns[22] + " = '" + Strings::Escape(e.crc_eqgame) + "'"); v.push_back(columns[22] + " = '" + Strings::Escape(e.crc_skillcaps) + "'");
v.push_back(columns[23] + " = '" + Strings::Escape(e.crc_skillcaps) + "'"); v.push_back(columns[23] + " = '" + Strings::Escape(e.crc_basedata) + "'");
v.push_back(columns[24] + " = '" + Strings::Escape(e.crc_basedata) + "'");
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@@ -317,7 +311,6 @@ public:
v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.id));
v.push_back("'" + Strings::Escape(e.name) + "'"); v.push_back("'" + Strings::Escape(e.name) + "'");
v.push_back("'" + Strings::Escape(e.charname) + "'"); v.push_back("'" + Strings::Escape(e.charname) + "'");
v.push_back("'" + Strings::Escape(e.auto_login_charname) + "'");
v.push_back(std::to_string(e.sharedplat)); v.push_back(std::to_string(e.sharedplat));
v.push_back("'" + Strings::Escape(e.password) + "'"); v.push_back("'" + Strings::Escape(e.password) + "'");
v.push_back(std::to_string(e.status)); v.push_back(std::to_string(e.status));
@@ -371,7 +364,6 @@ public:
v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.id));
v.push_back("'" + Strings::Escape(e.name) + "'"); v.push_back("'" + Strings::Escape(e.name) + "'");
v.push_back("'" + Strings::Escape(e.charname) + "'"); v.push_back("'" + Strings::Escape(e.charname) + "'");
v.push_back("'" + Strings::Escape(e.auto_login_charname) + "'");
v.push_back(std::to_string(e.sharedplat)); v.push_back(std::to_string(e.sharedplat));
v.push_back("'" + Strings::Escape(e.password) + "'"); v.push_back("'" + Strings::Escape(e.password) + "'");
v.push_back(std::to_string(e.status)); v.push_back(std::to_string(e.status));
@@ -426,31 +418,30 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) { for (auto row = results.begin(); row != results.end(); ++row) {
Account e{}; Account e{};
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0; e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
e.name = row[1] ? row[1] : ""; e.name = row[1] ? row[1] : "";
e.charname = row[2] ? row[2] : ""; e.charname = row[2] ? row[2] : "";
e.auto_login_charname = row[3] ? row[3] : ""; e.sharedplat = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
e.sharedplat = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0; e.password = row[4] ? row[4] : "";
e.password = row[5] ? row[5] : ""; e.status = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
e.status = row[6] ? static_cast<int32_t>(atoi(row[6])) : 0; e.ls_id = row[6] ? row[6] : "eqemu";
e.ls_id = row[7] ? row[7] : "eqemu"; e.lsaccount_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
e.lsaccount_id = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0; e.gmspeed = row[8] ? static_cast<uint8_t>(strtoul(row[8], nullptr, 10)) : 0;
e.gmspeed = row[9] ? static_cast<uint8_t>(strtoul(row[9], nullptr, 10)) : 0; e.invulnerable = row[9] ? static_cast<int8_t>(atoi(row[9])) : 0;
e.invulnerable = row[10] ? static_cast<int8_t>(atoi(row[10])) : 0; e.flymode = row[10] ? static_cast<int8_t>(atoi(row[10])) : 0;
e.flymode = row[11] ? static_cast<int8_t>(atoi(row[11])) : 0; e.ignore_tells = row[11] ? static_cast<int8_t>(atoi(row[11])) : 0;
e.ignore_tells = row[12] ? static_cast<int8_t>(atoi(row[12])) : 0; e.revoked = row[12] ? static_cast<uint8_t>(strtoul(row[12], nullptr, 10)) : 0;
e.revoked = row[13] ? static_cast<uint8_t>(strtoul(row[13], nullptr, 10)) : 0; e.karma = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
e.karma = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0; e.minilogin_ip = row[14] ? row[14] : "";
e.minilogin_ip = row[15] ? row[15] : ""; e.hideme = row[15] ? static_cast<int8_t>(atoi(row[15])) : 0;
e.hideme = row[16] ? static_cast<int8_t>(atoi(row[16])) : 0; e.rulesflag = row[16] ? static_cast<uint8_t>(strtoul(row[16], nullptr, 10)) : 0;
e.rulesflag = row[17] ? static_cast<uint8_t>(strtoul(row[17], nullptr, 10)) : 0; e.suspendeduntil = strtoll(row[17] ? row[17] : "-1", nullptr, 10);
e.suspendeduntil = strtoll(row[18] ? row[18] : "-1", nullptr, 10); e.time_creation = row[18] ? static_cast<uint32_t>(strtoul(row[18], nullptr, 10)) : 0;
e.time_creation = row[19] ? static_cast<uint32_t>(strtoul(row[19], nullptr, 10)) : 0; e.ban_reason = row[19] ? row[19] : "";
e.ban_reason = row[20] ? row[20] : ""; e.suspend_reason = row[20] ? row[20] : "";
e.suspend_reason = row[21] ? row[21] : ""; e.crc_eqgame = row[21] ? row[21] : "";
e.crc_eqgame = row[22] ? row[22] : ""; e.crc_skillcaps = row[22] ? row[22] : "";
e.crc_skillcaps = row[23] ? row[23] : ""; e.crc_basedata = row[23] ? row[23] : "";
e.crc_basedata = row[24] ? row[24] : "";
all_entries.push_back(e); all_entries.push_back(e);
} }
@@ -475,31 +466,30 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) { for (auto row = results.begin(); row != results.end(); ++row) {
Account e{}; Account e{};
e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0; e.id = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
e.name = row[1] ? row[1] : ""; e.name = row[1] ? row[1] : "";
e.charname = row[2] ? row[2] : ""; e.charname = row[2] ? row[2] : "";
e.auto_login_charname = row[3] ? row[3] : ""; e.sharedplat = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
e.sharedplat = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0; e.password = row[4] ? row[4] : "";
e.password = row[5] ? row[5] : ""; e.status = row[5] ? static_cast<int32_t>(atoi(row[5])) : 0;
e.status = row[6] ? static_cast<int32_t>(atoi(row[6])) : 0; e.ls_id = row[6] ? row[6] : "eqemu";
e.ls_id = row[7] ? row[7] : "eqemu"; e.lsaccount_id = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
e.lsaccount_id = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0; e.gmspeed = row[8] ? static_cast<uint8_t>(strtoul(row[8], nullptr, 10)) : 0;
e.gmspeed = row[9] ? static_cast<uint8_t>(strtoul(row[9], nullptr, 10)) : 0; e.invulnerable = row[9] ? static_cast<int8_t>(atoi(row[9])) : 0;
e.invulnerable = row[10] ? static_cast<int8_t>(atoi(row[10])) : 0; e.flymode = row[10] ? static_cast<int8_t>(atoi(row[10])) : 0;
e.flymode = row[11] ? static_cast<int8_t>(atoi(row[11])) : 0; e.ignore_tells = row[11] ? static_cast<int8_t>(atoi(row[11])) : 0;
e.ignore_tells = row[12] ? static_cast<int8_t>(atoi(row[12])) : 0; e.revoked = row[12] ? static_cast<uint8_t>(strtoul(row[12], nullptr, 10)) : 0;
e.revoked = row[13] ? static_cast<uint8_t>(strtoul(row[13], nullptr, 10)) : 0; e.karma = row[13] ? static_cast<uint32_t>(strtoul(row[13], nullptr, 10)) : 0;
e.karma = row[14] ? static_cast<uint32_t>(strtoul(row[14], nullptr, 10)) : 0; e.minilogin_ip = row[14] ? row[14] : "";
e.minilogin_ip = row[15] ? row[15] : ""; e.hideme = row[15] ? static_cast<int8_t>(atoi(row[15])) : 0;
e.hideme = row[16] ? static_cast<int8_t>(atoi(row[16])) : 0; e.rulesflag = row[16] ? static_cast<uint8_t>(strtoul(row[16], nullptr, 10)) : 0;
e.rulesflag = row[17] ? static_cast<uint8_t>(strtoul(row[17], nullptr, 10)) : 0; e.suspendeduntil = strtoll(row[17] ? row[17] : "-1", nullptr, 10);
e.suspendeduntil = strtoll(row[18] ? row[18] : "-1", nullptr, 10); e.time_creation = row[18] ? static_cast<uint32_t>(strtoul(row[18], nullptr, 10)) : 0;
e.time_creation = row[19] ? static_cast<uint32_t>(strtoul(row[19], nullptr, 10)) : 0; e.ban_reason = row[19] ? row[19] : "";
e.ban_reason = row[20] ? row[20] : ""; e.suspend_reason = row[20] ? row[20] : "";
e.suspend_reason = row[21] ? row[21] : ""; e.crc_eqgame = row[21] ? row[21] : "";
e.crc_eqgame = row[22] ? row[22] : ""; e.crc_skillcaps = row[22] ? row[22] : "";
e.crc_skillcaps = row[23] ? row[23] : ""; e.crc_basedata = row[23] ? row[23] : "";
e.crc_basedata = row[24] ? row[24] : "";
all_entries.push_back(e); all_entries.push_back(e);
} }
@@ -577,7 +567,6 @@ public:
v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.id));
v.push_back("'" + Strings::Escape(e.name) + "'"); v.push_back("'" + Strings::Escape(e.name) + "'");
v.push_back("'" + Strings::Escape(e.charname) + "'"); v.push_back("'" + Strings::Escape(e.charname) + "'");
v.push_back("'" + Strings::Escape(e.auto_login_charname) + "'");
v.push_back(std::to_string(e.sharedplat)); v.push_back(std::to_string(e.sharedplat));
v.push_back("'" + Strings::Escape(e.password) + "'"); v.push_back("'" + Strings::Escape(e.password) + "'");
v.push_back(std::to_string(e.status)); v.push_back(std::to_string(e.status));
@@ -624,7 +613,6 @@ public:
v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.id));
v.push_back("'" + Strings::Escape(e.name) + "'"); v.push_back("'" + Strings::Escape(e.name) + "'");
v.push_back("'" + Strings::Escape(e.charname) + "'"); v.push_back("'" + Strings::Escape(e.charname) + "'");
v.push_back("'" + Strings::Escape(e.auto_login_charname) + "'");
v.push_back(std::to_string(e.sharedplat)); v.push_back(std::to_string(e.sharedplat));
v.push_back("'" + Strings::Escape(e.password) + "'"); v.push_back("'" + Strings::Escape(e.password) + "'");
v.push_back(std::to_string(e.status)); v.push_back(std::to_string(e.status));
@@ -57,7 +57,6 @@ public:
int32_t int_; int32_t int_;
int32_t agi; int32_t agi;
int32_t wis; int32_t wis;
int32_t extra_haste;
int16_t fire; int16_t fire;
int16_t cold; int16_t cold;
int16_t magic; int16_t magic;
@@ -119,7 +118,6 @@ public:
"`int`", "`int`",
"agi", "agi",
"wis", "wis",
"extra_haste",
"fire", "fire",
"cold", "cold",
"magic", "magic",
@@ -177,7 +175,6 @@ public:
"`int`", "`int`",
"agi", "agi",
"wis", "wis",
"extra_haste",
"fire", "fire",
"cold", "cold",
"magic", "magic",
@@ -269,7 +266,6 @@ public:
e.int_ = 75; e.int_ = 75;
e.agi = 75; e.agi = 75;
e.wis = 75; e.wis = 75;
e.extra_haste = 0;
e.fire = 0; e.fire = 0;
e.cold = 0; e.cold = 0;
e.magic = 0; e.magic = 0;
@@ -357,20 +353,19 @@ public:
e.int_ = row[35] ? static_cast<int32_t>(atoi(row[35])) : 75; e.int_ = row[35] ? static_cast<int32_t>(atoi(row[35])) : 75;
e.agi = row[36] ? static_cast<int32_t>(atoi(row[36])) : 75; e.agi = row[36] ? static_cast<int32_t>(atoi(row[36])) : 75;
e.wis = row[37] ? static_cast<int32_t>(atoi(row[37])) : 75; e.wis = row[37] ? static_cast<int32_t>(atoi(row[37])) : 75;
e.extra_haste = row[38] ? static_cast<int32_t>(atoi(row[38])) : 0; e.fire = row[38] ? static_cast<int16_t>(atoi(row[38])) : 0;
e.fire = row[39] ? static_cast<int16_t>(atoi(row[39])) : 0; e.cold = row[39] ? static_cast<int16_t>(atoi(row[39])) : 0;
e.cold = row[40] ? static_cast<int16_t>(atoi(row[40])) : 0; e.magic = row[40] ? static_cast<int16_t>(atoi(row[40])) : 0;
e.magic = row[41] ? static_cast<int16_t>(atoi(row[41])) : 0; e.poison = row[41] ? static_cast<int16_t>(atoi(row[41])) : 0;
e.poison = row[42] ? static_cast<int16_t>(atoi(row[42])) : 0; e.disease = row[42] ? static_cast<int16_t>(atoi(row[42])) : 0;
e.disease = row[43] ? static_cast<int16_t>(atoi(row[43])) : 0; e.corruption = row[43] ? static_cast<int16_t>(atoi(row[43])) : 0;
e.corruption = row[44] ? static_cast<int16_t>(atoi(row[44])) : 0; e.show_helm = row[44] ? static_cast<uint32_t>(strtoul(row[44], nullptr, 10)) : 0;
e.show_helm = row[45] ? static_cast<uint32_t>(strtoul(row[45], nullptr, 10)) : 0; e.follow_distance = row[45] ? static_cast<uint32_t>(strtoul(row[45], nullptr, 10)) : 200;
e.follow_distance = row[46] ? static_cast<uint32_t>(strtoul(row[46], nullptr, 10)) : 200; e.stop_melee_level = row[46] ? static_cast<uint8_t>(strtoul(row[46], nullptr, 10)) : 255;
e.stop_melee_level = row[47] ? static_cast<uint8_t>(strtoul(row[47], nullptr, 10)) : 255; e.expansion_bitmask = row[47] ? static_cast<int32_t>(atoi(row[47])) : -1;
e.expansion_bitmask = row[48] ? static_cast<int32_t>(atoi(row[48])) : -1; e.enforce_spell_settings = row[48] ? static_cast<uint8_t>(strtoul(row[48], nullptr, 10)) : 0;
e.enforce_spell_settings = row[49] ? static_cast<uint8_t>(strtoul(row[49], nullptr, 10)) : 0; e.archery_setting = row[49] ? static_cast<uint8_t>(strtoul(row[49], nullptr, 10)) : 0;
e.archery_setting = row[50] ? static_cast<uint8_t>(strtoul(row[50], nullptr, 10)) : 0; e.caster_range = row[50] ? static_cast<uint32_t>(strtoul(row[50], nullptr, 10)) : 300;
e.caster_range = row[51] ? static_cast<uint32_t>(strtoul(row[51], nullptr, 10)) : 300;
return e; return e;
} }
@@ -441,20 +436,19 @@ public:
v.push_back(columns[35] + " = " + std::to_string(e.int_)); v.push_back(columns[35] + " = " + std::to_string(e.int_));
v.push_back(columns[36] + " = " + std::to_string(e.agi)); v.push_back(columns[36] + " = " + std::to_string(e.agi));
v.push_back(columns[37] + " = " + std::to_string(e.wis)); v.push_back(columns[37] + " = " + std::to_string(e.wis));
v.push_back(columns[38] + " = " + std::to_string(e.extra_haste)); v.push_back(columns[38] + " = " + std::to_string(e.fire));
v.push_back(columns[39] + " = " + std::to_string(e.fire)); v.push_back(columns[39] + " = " + std::to_string(e.cold));
v.push_back(columns[40] + " = " + std::to_string(e.cold)); v.push_back(columns[40] + " = " + std::to_string(e.magic));
v.push_back(columns[41] + " = " + std::to_string(e.magic)); v.push_back(columns[41] + " = " + std::to_string(e.poison));
v.push_back(columns[42] + " = " + std::to_string(e.poison)); v.push_back(columns[42] + " = " + std::to_string(e.disease));
v.push_back(columns[43] + " = " + std::to_string(e.disease)); v.push_back(columns[43] + " = " + std::to_string(e.corruption));
v.push_back(columns[44] + " = " + std::to_string(e.corruption)); v.push_back(columns[44] + " = " + std::to_string(e.show_helm));
v.push_back(columns[45] + " = " + std::to_string(e.show_helm)); v.push_back(columns[45] + " = " + std::to_string(e.follow_distance));
v.push_back(columns[46] + " = " + std::to_string(e.follow_distance)); v.push_back(columns[46] + " = " + std::to_string(e.stop_melee_level));
v.push_back(columns[47] + " = " + std::to_string(e.stop_melee_level)); v.push_back(columns[47] + " = " + std::to_string(e.expansion_bitmask));
v.push_back(columns[48] + " = " + std::to_string(e.expansion_bitmask)); v.push_back(columns[48] + " = " + std::to_string(e.enforce_spell_settings));
v.push_back(columns[49] + " = " + std::to_string(e.enforce_spell_settings)); v.push_back(columns[49] + " = " + std::to_string(e.archery_setting));
v.push_back(columns[50] + " = " + std::to_string(e.archery_setting)); v.push_back(columns[50] + " = " + std::to_string(e.caster_range));
v.push_back(columns[51] + " = " + std::to_string(e.caster_range));
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@@ -514,7 +508,6 @@ public:
v.push_back(std::to_string(e.int_)); v.push_back(std::to_string(e.int_));
v.push_back(std::to_string(e.agi)); v.push_back(std::to_string(e.agi));
v.push_back(std::to_string(e.wis)); v.push_back(std::to_string(e.wis));
v.push_back(std::to_string(e.extra_haste));
v.push_back(std::to_string(e.fire)); v.push_back(std::to_string(e.fire));
v.push_back(std::to_string(e.cold)); v.push_back(std::to_string(e.cold));
v.push_back(std::to_string(e.magic)); v.push_back(std::to_string(e.magic));
@@ -595,7 +588,6 @@ public:
v.push_back(std::to_string(e.int_)); v.push_back(std::to_string(e.int_));
v.push_back(std::to_string(e.agi)); v.push_back(std::to_string(e.agi));
v.push_back(std::to_string(e.wis)); v.push_back(std::to_string(e.wis));
v.push_back(std::to_string(e.extra_haste));
v.push_back(std::to_string(e.fire)); v.push_back(std::to_string(e.fire));
v.push_back(std::to_string(e.cold)); v.push_back(std::to_string(e.cold));
v.push_back(std::to_string(e.magic)); v.push_back(std::to_string(e.magic));
@@ -680,20 +672,19 @@ public:
e.int_ = row[35] ? static_cast<int32_t>(atoi(row[35])) : 75; e.int_ = row[35] ? static_cast<int32_t>(atoi(row[35])) : 75;
e.agi = row[36] ? static_cast<int32_t>(atoi(row[36])) : 75; e.agi = row[36] ? static_cast<int32_t>(atoi(row[36])) : 75;
e.wis = row[37] ? static_cast<int32_t>(atoi(row[37])) : 75; e.wis = row[37] ? static_cast<int32_t>(atoi(row[37])) : 75;
e.extra_haste = row[38] ? static_cast<int32_t>(atoi(row[38])) : 0; e.fire = row[38] ? static_cast<int16_t>(atoi(row[38])) : 0;
e.fire = row[39] ? static_cast<int16_t>(atoi(row[39])) : 0; e.cold = row[39] ? static_cast<int16_t>(atoi(row[39])) : 0;
e.cold = row[40] ? static_cast<int16_t>(atoi(row[40])) : 0; e.magic = row[40] ? static_cast<int16_t>(atoi(row[40])) : 0;
e.magic = row[41] ? static_cast<int16_t>(atoi(row[41])) : 0; e.poison = row[41] ? static_cast<int16_t>(atoi(row[41])) : 0;
e.poison = row[42] ? static_cast<int16_t>(atoi(row[42])) : 0; e.disease = row[42] ? static_cast<int16_t>(atoi(row[42])) : 0;
e.disease = row[43] ? static_cast<int16_t>(atoi(row[43])) : 0; e.corruption = row[43] ? static_cast<int16_t>(atoi(row[43])) : 0;
e.corruption = row[44] ? static_cast<int16_t>(atoi(row[44])) : 0; e.show_helm = row[44] ? static_cast<uint32_t>(strtoul(row[44], nullptr, 10)) : 0;
e.show_helm = row[45] ? static_cast<uint32_t>(strtoul(row[45], nullptr, 10)) : 0; e.follow_distance = row[45] ? static_cast<uint32_t>(strtoul(row[45], nullptr, 10)) : 200;
e.follow_distance = row[46] ? static_cast<uint32_t>(strtoul(row[46], nullptr, 10)) : 200; e.stop_melee_level = row[46] ? static_cast<uint8_t>(strtoul(row[46], nullptr, 10)) : 255;
e.stop_melee_level = row[47] ? static_cast<uint8_t>(strtoul(row[47], nullptr, 10)) : 255; e.expansion_bitmask = row[47] ? static_cast<int32_t>(atoi(row[47])) : -1;
e.expansion_bitmask = row[48] ? static_cast<int32_t>(atoi(row[48])) : -1; e.enforce_spell_settings = row[48] ? static_cast<uint8_t>(strtoul(row[48], nullptr, 10)) : 0;
e.enforce_spell_settings = row[49] ? static_cast<uint8_t>(strtoul(row[49], nullptr, 10)) : 0; e.archery_setting = row[49] ? static_cast<uint8_t>(strtoul(row[49], nullptr, 10)) : 0;
e.archery_setting = row[50] ? static_cast<uint8_t>(strtoul(row[50], nullptr, 10)) : 0; e.caster_range = row[50] ? static_cast<uint32_t>(strtoul(row[50], nullptr, 10)) : 300;
e.caster_range = row[51] ? static_cast<uint32_t>(strtoul(row[51], nullptr, 10)) : 300;
all_entries.push_back(e); all_entries.push_back(e);
} }
@@ -756,20 +747,19 @@ public:
e.int_ = row[35] ? static_cast<int32_t>(atoi(row[35])) : 75; e.int_ = row[35] ? static_cast<int32_t>(atoi(row[35])) : 75;
e.agi = row[36] ? static_cast<int32_t>(atoi(row[36])) : 75; e.agi = row[36] ? static_cast<int32_t>(atoi(row[36])) : 75;
e.wis = row[37] ? static_cast<int32_t>(atoi(row[37])) : 75; e.wis = row[37] ? static_cast<int32_t>(atoi(row[37])) : 75;
e.extra_haste = row[38] ? static_cast<int32_t>(atoi(row[38])) : 0; e.fire = row[38] ? static_cast<int16_t>(atoi(row[38])) : 0;
e.fire = row[39] ? static_cast<int16_t>(atoi(row[39])) : 0; e.cold = row[39] ? static_cast<int16_t>(atoi(row[39])) : 0;
e.cold = row[40] ? static_cast<int16_t>(atoi(row[40])) : 0; e.magic = row[40] ? static_cast<int16_t>(atoi(row[40])) : 0;
e.magic = row[41] ? static_cast<int16_t>(atoi(row[41])) : 0; e.poison = row[41] ? static_cast<int16_t>(atoi(row[41])) : 0;
e.poison = row[42] ? static_cast<int16_t>(atoi(row[42])) : 0; e.disease = row[42] ? static_cast<int16_t>(atoi(row[42])) : 0;
e.disease = row[43] ? static_cast<int16_t>(atoi(row[43])) : 0; e.corruption = row[43] ? static_cast<int16_t>(atoi(row[43])) : 0;
e.corruption = row[44] ? static_cast<int16_t>(atoi(row[44])) : 0; e.show_helm = row[44] ? static_cast<uint32_t>(strtoul(row[44], nullptr, 10)) : 0;
e.show_helm = row[45] ? static_cast<uint32_t>(strtoul(row[45], nullptr, 10)) : 0; e.follow_distance = row[45] ? static_cast<uint32_t>(strtoul(row[45], nullptr, 10)) : 200;
e.follow_distance = row[46] ? static_cast<uint32_t>(strtoul(row[46], nullptr, 10)) : 200; e.stop_melee_level = row[46] ? static_cast<uint8_t>(strtoul(row[46], nullptr, 10)) : 255;
e.stop_melee_level = row[47] ? static_cast<uint8_t>(strtoul(row[47], nullptr, 10)) : 255; e.expansion_bitmask = row[47] ? static_cast<int32_t>(atoi(row[47])) : -1;
e.expansion_bitmask = row[48] ? static_cast<int32_t>(atoi(row[48])) : -1; e.enforce_spell_settings = row[48] ? static_cast<uint8_t>(strtoul(row[48], nullptr, 10)) : 0;
e.enforce_spell_settings = row[49] ? static_cast<uint8_t>(strtoul(row[49], nullptr, 10)) : 0; e.archery_setting = row[49] ? static_cast<uint8_t>(strtoul(row[49], nullptr, 10)) : 0;
e.archery_setting = row[50] ? static_cast<uint8_t>(strtoul(row[50], nullptr, 10)) : 0; e.caster_range = row[50] ? static_cast<uint32_t>(strtoul(row[50], nullptr, 10)) : 300;
e.caster_range = row[51] ? static_cast<uint32_t>(strtoul(row[51], nullptr, 10)) : 300;
all_entries.push_back(e); all_entries.push_back(e);
} }
@@ -882,7 +872,6 @@ public:
v.push_back(std::to_string(e.int_)); v.push_back(std::to_string(e.int_));
v.push_back(std::to_string(e.agi)); v.push_back(std::to_string(e.agi));
v.push_back(std::to_string(e.wis)); v.push_back(std::to_string(e.wis));
v.push_back(std::to_string(e.extra_haste));
v.push_back(std::to_string(e.fire)); v.push_back(std::to_string(e.fire));
v.push_back(std::to_string(e.cold)); v.push_back(std::to_string(e.cold));
v.push_back(std::to_string(e.magic)); v.push_back(std::to_string(e.magic));
@@ -956,7 +945,6 @@ public:
v.push_back(std::to_string(e.int_)); v.push_back(std::to_string(e.int_));
v.push_back(std::to_string(e.agi)); v.push_back(std::to_string(e.agi));
v.push_back(std::to_string(e.wis)); v.push_back(std::to_string(e.wis));
v.push_back(std::to_string(e.extra_haste));
v.push_back(std::to_string(e.fire)); v.push_back(std::to_string(e.fire));
v.push_back(std::to_string(e.cold)); v.push_back(std::to_string(e.cold));
v.push_back(std::to_string(e.magic)); v.push_back(std::to_string(e.magic));
@@ -77,7 +77,6 @@ public:
uint32_t int_; uint32_t int_;
uint32_t agi; uint32_t agi;
uint32_t wis; uint32_t wis;
int32_t extra_haste;
uint32_t zone_change_count; uint32_t zone_change_count;
uint32_t toxicity; uint32_t toxicity;
uint32_t hunger_level; uint32_t hunger_level;
@@ -191,7 +190,6 @@ public:
"`int`", "`int`",
"agi", "agi",
"wis", "wis",
"extra_haste",
"zone_change_count", "zone_change_count",
"toxicity", "toxicity",
"hunger_level", "hunger_level",
@@ -301,7 +299,6 @@ public:
"`int`", "`int`",
"agi", "agi",
"wis", "wis",
"extra_haste",
"zone_change_count", "zone_change_count",
"toxicity", "toxicity",
"hunger_level", "hunger_level",
@@ -445,7 +442,6 @@ public:
e.int_ = 0; e.int_ = 0;
e.agi = 0; e.agi = 0;
e.wis = 0; e.wis = 0;
e.extra_haste = 0;
e.zone_change_count = 0; e.zone_change_count = 0;
e.toxicity = 0; e.toxicity = 0;
e.hunger_level = 0; e.hunger_level = 0;
@@ -585,52 +581,51 @@ public:
e.int_ = row[55] ? static_cast<uint32_t>(strtoul(row[55], nullptr, 10)) : 0; e.int_ = row[55] ? static_cast<uint32_t>(strtoul(row[55], nullptr, 10)) : 0;
e.agi = row[56] ? static_cast<uint32_t>(strtoul(row[56], nullptr, 10)) : 0; e.agi = row[56] ? static_cast<uint32_t>(strtoul(row[56], nullptr, 10)) : 0;
e.wis = row[57] ? static_cast<uint32_t>(strtoul(row[57], nullptr, 10)) : 0; e.wis = row[57] ? static_cast<uint32_t>(strtoul(row[57], nullptr, 10)) : 0;
e.extra_haste = row[58] ? static_cast<int32_t>(atoi(row[58])) : 0; e.zone_change_count = row[58] ? static_cast<uint32_t>(strtoul(row[58], nullptr, 10)) : 0;
e.zone_change_count = row[59] ? static_cast<uint32_t>(strtoul(row[59], nullptr, 10)) : 0; e.toxicity = row[59] ? static_cast<uint32_t>(strtoul(row[59], nullptr, 10)) : 0;
e.toxicity = row[60] ? static_cast<uint32_t>(strtoul(row[60], nullptr, 10)) : 0; e.hunger_level = row[60] ? static_cast<uint32_t>(strtoul(row[60], nullptr, 10)) : 0;
e.hunger_level = row[61] ? static_cast<uint32_t>(strtoul(row[61], nullptr, 10)) : 0; e.thirst_level = row[61] ? static_cast<uint32_t>(strtoul(row[61], nullptr, 10)) : 0;
e.thirst_level = row[62] ? static_cast<uint32_t>(strtoul(row[62], nullptr, 10)) : 0; e.ability_up = row[62] ? static_cast<uint32_t>(strtoul(row[62], nullptr, 10)) : 0;
e.ability_up = row[63] ? static_cast<uint32_t>(strtoul(row[63], nullptr, 10)) : 0; e.ldon_points_guk = row[63] ? static_cast<uint32_t>(strtoul(row[63], nullptr, 10)) : 0;
e.ldon_points_guk = row[64] ? static_cast<uint32_t>(strtoul(row[64], nullptr, 10)) : 0; e.ldon_points_mir = row[64] ? static_cast<uint32_t>(strtoul(row[64], nullptr, 10)) : 0;
e.ldon_points_mir = row[65] ? static_cast<uint32_t>(strtoul(row[65], nullptr, 10)) : 0; e.ldon_points_mmc = row[65] ? static_cast<uint32_t>(strtoul(row[65], nullptr, 10)) : 0;
e.ldon_points_mmc = row[66] ? static_cast<uint32_t>(strtoul(row[66], nullptr, 10)) : 0; e.ldon_points_ruj = row[66] ? static_cast<uint32_t>(strtoul(row[66], nullptr, 10)) : 0;
e.ldon_points_ruj = row[67] ? static_cast<uint32_t>(strtoul(row[67], nullptr, 10)) : 0; e.ldon_points_tak = row[67] ? static_cast<uint32_t>(strtoul(row[67], nullptr, 10)) : 0;
e.ldon_points_tak = row[68] ? static_cast<uint32_t>(strtoul(row[68], nullptr, 10)) : 0; e.ldon_points_available = row[68] ? static_cast<uint32_t>(strtoul(row[68], nullptr, 10)) : 0;
e.ldon_points_available = row[69] ? static_cast<uint32_t>(strtoul(row[69], nullptr, 10)) : 0; e.tribute_time_remaining = row[69] ? static_cast<uint32_t>(strtoul(row[69], nullptr, 10)) : 0;
e.tribute_time_remaining = row[70] ? static_cast<uint32_t>(strtoul(row[70], nullptr, 10)) : 0; e.career_tribute_points = row[70] ? static_cast<uint32_t>(strtoul(row[70], nullptr, 10)) : 0;
e.career_tribute_points = row[71] ? static_cast<uint32_t>(strtoul(row[71], nullptr, 10)) : 0; e.tribute_points = row[71] ? static_cast<uint32_t>(strtoul(row[71], nullptr, 10)) : 0;
e.tribute_points = row[72] ? static_cast<uint32_t>(strtoul(row[72], nullptr, 10)) : 0; e.tribute_active = row[72] ? static_cast<uint32_t>(strtoul(row[72], nullptr, 10)) : 0;
e.tribute_active = row[73] ? static_cast<uint32_t>(strtoul(row[73], nullptr, 10)) : 0; e.pvp_status = row[73] ? static_cast<uint8_t>(strtoul(row[73], nullptr, 10)) : 0;
e.pvp_status = row[74] ? static_cast<uint8_t>(strtoul(row[74], nullptr, 10)) : 0; e.pvp_kills = row[74] ? static_cast<uint32_t>(strtoul(row[74], nullptr, 10)) : 0;
e.pvp_kills = row[75] ? static_cast<uint32_t>(strtoul(row[75], nullptr, 10)) : 0; e.pvp_deaths = row[75] ? static_cast<uint32_t>(strtoul(row[75], nullptr, 10)) : 0;
e.pvp_deaths = row[76] ? static_cast<uint32_t>(strtoul(row[76], nullptr, 10)) : 0; e.pvp_current_points = row[76] ? static_cast<uint32_t>(strtoul(row[76], nullptr, 10)) : 0;
e.pvp_current_points = row[77] ? static_cast<uint32_t>(strtoul(row[77], nullptr, 10)) : 0; e.pvp_career_points = row[77] ? static_cast<uint32_t>(strtoul(row[77], nullptr, 10)) : 0;
e.pvp_career_points = row[78] ? static_cast<uint32_t>(strtoul(row[78], nullptr, 10)) : 0; e.pvp_best_kill_streak = row[78] ? static_cast<uint32_t>(strtoul(row[78], nullptr, 10)) : 0;
e.pvp_best_kill_streak = row[79] ? static_cast<uint32_t>(strtoul(row[79], nullptr, 10)) : 0; e.pvp_worst_death_streak = row[79] ? static_cast<uint32_t>(strtoul(row[79], nullptr, 10)) : 0;
e.pvp_worst_death_streak = row[80] ? static_cast<uint32_t>(strtoul(row[80], nullptr, 10)) : 0; e.pvp_current_kill_streak = row[80] ? static_cast<uint32_t>(strtoul(row[80], nullptr, 10)) : 0;
e.pvp_current_kill_streak = row[81] ? static_cast<uint32_t>(strtoul(row[81], nullptr, 10)) : 0; e.pvp2 = row[81] ? static_cast<uint32_t>(strtoul(row[81], nullptr, 10)) : 0;
e.pvp2 = row[82] ? static_cast<uint32_t>(strtoul(row[82], nullptr, 10)) : 0; e.pvp_type = row[82] ? static_cast<uint32_t>(strtoul(row[82], nullptr, 10)) : 0;
e.pvp_type = row[83] ? static_cast<uint32_t>(strtoul(row[83], nullptr, 10)) : 0; e.show_helm = row[83] ? static_cast<uint32_t>(strtoul(row[83], nullptr, 10)) : 0;
e.show_helm = row[84] ? static_cast<uint32_t>(strtoul(row[84], nullptr, 10)) : 0; e.group_auto_consent = row[84] ? static_cast<uint8_t>(strtoul(row[84], nullptr, 10)) : 0;
e.group_auto_consent = row[85] ? static_cast<uint8_t>(strtoul(row[85], nullptr, 10)) : 0; e.raid_auto_consent = row[85] ? static_cast<uint8_t>(strtoul(row[85], nullptr, 10)) : 0;
e.raid_auto_consent = row[86] ? static_cast<uint8_t>(strtoul(row[86], nullptr, 10)) : 0; e.guild_auto_consent = row[86] ? static_cast<uint8_t>(strtoul(row[86], nullptr, 10)) : 0;
e.guild_auto_consent = row[87] ? static_cast<uint8_t>(strtoul(row[87], nullptr, 10)) : 0; e.leadership_exp_on = row[87] ? static_cast<uint8_t>(strtoul(row[87], nullptr, 10)) : 0;
e.leadership_exp_on = row[88] ? static_cast<uint8_t>(strtoul(row[88], nullptr, 10)) : 0; e.RestTimer = row[88] ? static_cast<uint32_t>(strtoul(row[88], nullptr, 10)) : 0;
e.RestTimer = row[89] ? static_cast<uint32_t>(strtoul(row[89], nullptr, 10)) : 0; e.air_remaining = row[89] ? static_cast<uint32_t>(strtoul(row[89], nullptr, 10)) : 0;
e.air_remaining = row[90] ? static_cast<uint32_t>(strtoul(row[90], nullptr, 10)) : 0; e.autosplit_enabled = row[90] ? static_cast<uint32_t>(strtoul(row[90], nullptr, 10)) : 0;
e.autosplit_enabled = row[91] ? static_cast<uint32_t>(strtoul(row[91], nullptr, 10)) : 0; e.lfp = row[91] ? static_cast<uint8_t>(strtoul(row[91], nullptr, 10)) : 0;
e.lfp = row[92] ? static_cast<uint8_t>(strtoul(row[92], nullptr, 10)) : 0; e.lfg = row[92] ? static_cast<uint8_t>(strtoul(row[92], nullptr, 10)) : 0;
e.lfg = row[93] ? static_cast<uint8_t>(strtoul(row[93], nullptr, 10)) : 0; e.mailkey = row[93] ? row[93] : "";
e.mailkey = row[94] ? row[94] : ""; e.xtargets = row[94] ? static_cast<uint8_t>(strtoul(row[94], nullptr, 10)) : 5;
e.xtargets = row[95] ? static_cast<uint8_t>(strtoul(row[95], nullptr, 10)) : 5; e.firstlogon = row[95] ? static_cast<int8_t>(atoi(row[95])) : 0;
e.firstlogon = row[96] ? static_cast<int8_t>(atoi(row[96])) : 0; e.e_aa_effects = row[96] ? static_cast<uint32_t>(strtoul(row[96], nullptr, 10)) : 0;
e.e_aa_effects = row[97] ? static_cast<uint32_t>(strtoul(row[97], nullptr, 10)) : 0; e.e_percent_to_aa = row[97] ? static_cast<uint32_t>(strtoul(row[97], nullptr, 10)) : 0;
e.e_percent_to_aa = row[98] ? static_cast<uint32_t>(strtoul(row[98], nullptr, 10)) : 0; e.e_expended_aa_spent = row[98] ? static_cast<uint32_t>(strtoul(row[98], nullptr, 10)) : 0;
e.e_expended_aa_spent = row[99] ? static_cast<uint32_t>(strtoul(row[99], nullptr, 10)) : 0; e.aa_points_spent_old = row[99] ? static_cast<uint32_t>(strtoul(row[99], nullptr, 10)) : 0;
e.aa_points_spent_old = row[100] ? static_cast<uint32_t>(strtoul(row[100], nullptr, 10)) : 0; e.aa_points_old = row[100] ? static_cast<uint32_t>(strtoul(row[100], nullptr, 10)) : 0;
e.aa_points_old = row[101] ? static_cast<uint32_t>(strtoul(row[101], nullptr, 10)) : 0; e.e_last_invsnapshot = row[101] ? static_cast<uint32_t>(strtoul(row[101], nullptr, 10)) : 0;
e.e_last_invsnapshot = row[102] ? static_cast<uint32_t>(strtoul(row[102], nullptr, 10)) : 0; e.deleted_at = strtoll(row[102] ? row[102] : "-1", nullptr, 10);
e.deleted_at = strtoll(row[103] ? row[103] : "-1", nullptr, 10);
return e; return e;
} }
@@ -721,52 +716,51 @@ public:
v.push_back(columns[55] + " = " + std::to_string(e.int_)); v.push_back(columns[55] + " = " + std::to_string(e.int_));
v.push_back(columns[56] + " = " + std::to_string(e.agi)); v.push_back(columns[56] + " = " + std::to_string(e.agi));
v.push_back(columns[57] + " = " + std::to_string(e.wis)); v.push_back(columns[57] + " = " + std::to_string(e.wis));
v.push_back(columns[58] + " = " + std::to_string(e.extra_haste)); v.push_back(columns[58] + " = " + std::to_string(e.zone_change_count));
v.push_back(columns[59] + " = " + std::to_string(e.zone_change_count)); v.push_back(columns[59] + " = " + std::to_string(e.toxicity));
v.push_back(columns[60] + " = " + std::to_string(e.toxicity)); v.push_back(columns[60] + " = " + std::to_string(e.hunger_level));
v.push_back(columns[61] + " = " + std::to_string(e.hunger_level)); v.push_back(columns[61] + " = " + std::to_string(e.thirst_level));
v.push_back(columns[62] + " = " + std::to_string(e.thirst_level)); v.push_back(columns[62] + " = " + std::to_string(e.ability_up));
v.push_back(columns[63] + " = " + std::to_string(e.ability_up)); v.push_back(columns[63] + " = " + std::to_string(e.ldon_points_guk));
v.push_back(columns[64] + " = " + std::to_string(e.ldon_points_guk)); v.push_back(columns[64] + " = " + std::to_string(e.ldon_points_mir));
v.push_back(columns[65] + " = " + std::to_string(e.ldon_points_mir)); v.push_back(columns[65] + " = " + std::to_string(e.ldon_points_mmc));
v.push_back(columns[66] + " = " + std::to_string(e.ldon_points_mmc)); v.push_back(columns[66] + " = " + std::to_string(e.ldon_points_ruj));
v.push_back(columns[67] + " = " + std::to_string(e.ldon_points_ruj)); v.push_back(columns[67] + " = " + std::to_string(e.ldon_points_tak));
v.push_back(columns[68] + " = " + std::to_string(e.ldon_points_tak)); v.push_back(columns[68] + " = " + std::to_string(e.ldon_points_available));
v.push_back(columns[69] + " = " + std::to_string(e.ldon_points_available)); v.push_back(columns[69] + " = " + std::to_string(e.tribute_time_remaining));
v.push_back(columns[70] + " = " + std::to_string(e.tribute_time_remaining)); v.push_back(columns[70] + " = " + std::to_string(e.career_tribute_points));
v.push_back(columns[71] + " = " + std::to_string(e.career_tribute_points)); v.push_back(columns[71] + " = " + std::to_string(e.tribute_points));
v.push_back(columns[72] + " = " + std::to_string(e.tribute_points)); v.push_back(columns[72] + " = " + std::to_string(e.tribute_active));
v.push_back(columns[73] + " = " + std::to_string(e.tribute_active)); v.push_back(columns[73] + " = " + std::to_string(e.pvp_status));
v.push_back(columns[74] + " = " + std::to_string(e.pvp_status)); v.push_back(columns[74] + " = " + std::to_string(e.pvp_kills));
v.push_back(columns[75] + " = " + std::to_string(e.pvp_kills)); v.push_back(columns[75] + " = " + std::to_string(e.pvp_deaths));
v.push_back(columns[76] + " = " + std::to_string(e.pvp_deaths)); v.push_back(columns[76] + " = " + std::to_string(e.pvp_current_points));
v.push_back(columns[77] + " = " + std::to_string(e.pvp_current_points)); v.push_back(columns[77] + " = " + std::to_string(e.pvp_career_points));
v.push_back(columns[78] + " = " + std::to_string(e.pvp_career_points)); v.push_back(columns[78] + " = " + std::to_string(e.pvp_best_kill_streak));
v.push_back(columns[79] + " = " + std::to_string(e.pvp_best_kill_streak)); v.push_back(columns[79] + " = " + std::to_string(e.pvp_worst_death_streak));
v.push_back(columns[80] + " = " + std::to_string(e.pvp_worst_death_streak)); v.push_back(columns[80] + " = " + std::to_string(e.pvp_current_kill_streak));
v.push_back(columns[81] + " = " + std::to_string(e.pvp_current_kill_streak)); v.push_back(columns[81] + " = " + std::to_string(e.pvp2));
v.push_back(columns[82] + " = " + std::to_string(e.pvp2)); v.push_back(columns[82] + " = " + std::to_string(e.pvp_type));
v.push_back(columns[83] + " = " + std::to_string(e.pvp_type)); v.push_back(columns[83] + " = " + std::to_string(e.show_helm));
v.push_back(columns[84] + " = " + std::to_string(e.show_helm)); v.push_back(columns[84] + " = " + std::to_string(e.group_auto_consent));
v.push_back(columns[85] + " = " + std::to_string(e.group_auto_consent)); v.push_back(columns[85] + " = " + std::to_string(e.raid_auto_consent));
v.push_back(columns[86] + " = " + std::to_string(e.raid_auto_consent)); v.push_back(columns[86] + " = " + std::to_string(e.guild_auto_consent));
v.push_back(columns[87] + " = " + std::to_string(e.guild_auto_consent)); v.push_back(columns[87] + " = " + std::to_string(e.leadership_exp_on));
v.push_back(columns[88] + " = " + std::to_string(e.leadership_exp_on)); v.push_back(columns[88] + " = " + std::to_string(e.RestTimer));
v.push_back(columns[89] + " = " + std::to_string(e.RestTimer)); v.push_back(columns[89] + " = " + std::to_string(e.air_remaining));
v.push_back(columns[90] + " = " + std::to_string(e.air_remaining)); v.push_back(columns[90] + " = " + std::to_string(e.autosplit_enabled));
v.push_back(columns[91] + " = " + std::to_string(e.autosplit_enabled)); v.push_back(columns[91] + " = " + std::to_string(e.lfp));
v.push_back(columns[92] + " = " + std::to_string(e.lfp)); v.push_back(columns[92] + " = " + std::to_string(e.lfg));
v.push_back(columns[93] + " = " + std::to_string(e.lfg)); v.push_back(columns[93] + " = '" + Strings::Escape(e.mailkey) + "'");
v.push_back(columns[94] + " = '" + Strings::Escape(e.mailkey) + "'"); v.push_back(columns[94] + " = " + std::to_string(e.xtargets));
v.push_back(columns[95] + " = " + std::to_string(e.xtargets)); v.push_back(columns[95] + " = " + std::to_string(e.firstlogon));
v.push_back(columns[96] + " = " + std::to_string(e.firstlogon)); v.push_back(columns[96] + " = " + std::to_string(e.e_aa_effects));
v.push_back(columns[97] + " = " + std::to_string(e.e_aa_effects)); v.push_back(columns[97] + " = " + std::to_string(e.e_percent_to_aa));
v.push_back(columns[98] + " = " + std::to_string(e.e_percent_to_aa)); v.push_back(columns[98] + " = " + std::to_string(e.e_expended_aa_spent));
v.push_back(columns[99] + " = " + std::to_string(e.e_expended_aa_spent)); v.push_back(columns[99] + " = " + std::to_string(e.aa_points_spent_old));
v.push_back(columns[100] + " = " + std::to_string(e.aa_points_spent_old)); v.push_back(columns[100] + " = " + std::to_string(e.aa_points_old));
v.push_back(columns[101] + " = " + std::to_string(e.aa_points_old)); v.push_back(columns[101] + " = " + std::to_string(e.e_last_invsnapshot));
v.push_back(columns[102] + " = " + std::to_string(e.e_last_invsnapshot)); v.push_back(columns[102] + " = FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")");
v.push_back(columns[103] + " = FROM_UNIXTIME(" + (e.deleted_at > 0 ? std::to_string(e.deleted_at) : "null") + ")");
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@@ -846,7 +840,6 @@ public:
v.push_back(std::to_string(e.int_)); v.push_back(std::to_string(e.int_));
v.push_back(std::to_string(e.agi)); v.push_back(std::to_string(e.agi));
v.push_back(std::to_string(e.wis)); v.push_back(std::to_string(e.wis));
v.push_back(std::to_string(e.extra_haste));
v.push_back(std::to_string(e.zone_change_count)); v.push_back(std::to_string(e.zone_change_count));
v.push_back(std::to_string(e.toxicity)); v.push_back(std::to_string(e.toxicity));
v.push_back(std::to_string(e.hunger_level)); v.push_back(std::to_string(e.hunger_level));
@@ -979,7 +972,6 @@ public:
v.push_back(std::to_string(e.int_)); v.push_back(std::to_string(e.int_));
v.push_back(std::to_string(e.agi)); v.push_back(std::to_string(e.agi));
v.push_back(std::to_string(e.wis)); v.push_back(std::to_string(e.wis));
v.push_back(std::to_string(e.extra_haste));
v.push_back(std::to_string(e.zone_change_count)); v.push_back(std::to_string(e.zone_change_count));
v.push_back(std::to_string(e.toxicity)); v.push_back(std::to_string(e.toxicity));
v.push_back(std::to_string(e.hunger_level)); v.push_back(std::to_string(e.hunger_level));
@@ -1116,52 +1108,51 @@ public:
e.int_ = row[55] ? static_cast<uint32_t>(strtoul(row[55], nullptr, 10)) : 0; e.int_ = row[55] ? static_cast<uint32_t>(strtoul(row[55], nullptr, 10)) : 0;
e.agi = row[56] ? static_cast<uint32_t>(strtoul(row[56], nullptr, 10)) : 0; e.agi = row[56] ? static_cast<uint32_t>(strtoul(row[56], nullptr, 10)) : 0;
e.wis = row[57] ? static_cast<uint32_t>(strtoul(row[57], nullptr, 10)) : 0; e.wis = row[57] ? static_cast<uint32_t>(strtoul(row[57], nullptr, 10)) : 0;
e.extra_haste = row[58] ? static_cast<int32_t>(atoi(row[58])) : 0; e.zone_change_count = row[58] ? static_cast<uint32_t>(strtoul(row[58], nullptr, 10)) : 0;
e.zone_change_count = row[59] ? static_cast<uint32_t>(strtoul(row[59], nullptr, 10)) : 0; e.toxicity = row[59] ? static_cast<uint32_t>(strtoul(row[59], nullptr, 10)) : 0;
e.toxicity = row[60] ? static_cast<uint32_t>(strtoul(row[60], nullptr, 10)) : 0; e.hunger_level = row[60] ? static_cast<uint32_t>(strtoul(row[60], nullptr, 10)) : 0;
e.hunger_level = row[61] ? static_cast<uint32_t>(strtoul(row[61], nullptr, 10)) : 0; e.thirst_level = row[61] ? static_cast<uint32_t>(strtoul(row[61], nullptr, 10)) : 0;
e.thirst_level = row[62] ? static_cast<uint32_t>(strtoul(row[62], nullptr, 10)) : 0; e.ability_up = row[62] ? static_cast<uint32_t>(strtoul(row[62], nullptr, 10)) : 0;
e.ability_up = row[63] ? static_cast<uint32_t>(strtoul(row[63], nullptr, 10)) : 0; e.ldon_points_guk = row[63] ? static_cast<uint32_t>(strtoul(row[63], nullptr, 10)) : 0;
e.ldon_points_guk = row[64] ? static_cast<uint32_t>(strtoul(row[64], nullptr, 10)) : 0; e.ldon_points_mir = row[64] ? static_cast<uint32_t>(strtoul(row[64], nullptr, 10)) : 0;
e.ldon_points_mir = row[65] ? static_cast<uint32_t>(strtoul(row[65], nullptr, 10)) : 0; e.ldon_points_mmc = row[65] ? static_cast<uint32_t>(strtoul(row[65], nullptr, 10)) : 0;
e.ldon_points_mmc = row[66] ? static_cast<uint32_t>(strtoul(row[66], nullptr, 10)) : 0; e.ldon_points_ruj = row[66] ? static_cast<uint32_t>(strtoul(row[66], nullptr, 10)) : 0;
e.ldon_points_ruj = row[67] ? static_cast<uint32_t>(strtoul(row[67], nullptr, 10)) : 0; e.ldon_points_tak = row[67] ? static_cast<uint32_t>(strtoul(row[67], nullptr, 10)) : 0;
e.ldon_points_tak = row[68] ? static_cast<uint32_t>(strtoul(row[68], nullptr, 10)) : 0; e.ldon_points_available = row[68] ? static_cast<uint32_t>(strtoul(row[68], nullptr, 10)) : 0;
e.ldon_points_available = row[69] ? static_cast<uint32_t>(strtoul(row[69], nullptr, 10)) : 0; e.tribute_time_remaining = row[69] ? static_cast<uint32_t>(strtoul(row[69], nullptr, 10)) : 0;
e.tribute_time_remaining = row[70] ? static_cast<uint32_t>(strtoul(row[70], nullptr, 10)) : 0; e.career_tribute_points = row[70] ? static_cast<uint32_t>(strtoul(row[70], nullptr, 10)) : 0;
e.career_tribute_points = row[71] ? static_cast<uint32_t>(strtoul(row[71], nullptr, 10)) : 0; e.tribute_points = row[71] ? static_cast<uint32_t>(strtoul(row[71], nullptr, 10)) : 0;
e.tribute_points = row[72] ? static_cast<uint32_t>(strtoul(row[72], nullptr, 10)) : 0; e.tribute_active = row[72] ? static_cast<uint32_t>(strtoul(row[72], nullptr, 10)) : 0;
e.tribute_active = row[73] ? static_cast<uint32_t>(strtoul(row[73], nullptr, 10)) : 0; e.pvp_status = row[73] ? static_cast<uint8_t>(strtoul(row[73], nullptr, 10)) : 0;
e.pvp_status = row[74] ? static_cast<uint8_t>(strtoul(row[74], nullptr, 10)) : 0; e.pvp_kills = row[74] ? static_cast<uint32_t>(strtoul(row[74], nullptr, 10)) : 0;
e.pvp_kills = row[75] ? static_cast<uint32_t>(strtoul(row[75], nullptr, 10)) : 0; e.pvp_deaths = row[75] ? static_cast<uint32_t>(strtoul(row[75], nullptr, 10)) : 0;
e.pvp_deaths = row[76] ? static_cast<uint32_t>(strtoul(row[76], nullptr, 10)) : 0; e.pvp_current_points = row[76] ? static_cast<uint32_t>(strtoul(row[76], nullptr, 10)) : 0;
e.pvp_current_points = row[77] ? static_cast<uint32_t>(strtoul(row[77], nullptr, 10)) : 0; e.pvp_career_points = row[77] ? static_cast<uint32_t>(strtoul(row[77], nullptr, 10)) : 0;
e.pvp_career_points = row[78] ? static_cast<uint32_t>(strtoul(row[78], nullptr, 10)) : 0; e.pvp_best_kill_streak = row[78] ? static_cast<uint32_t>(strtoul(row[78], nullptr, 10)) : 0;
e.pvp_best_kill_streak = row[79] ? static_cast<uint32_t>(strtoul(row[79], nullptr, 10)) : 0; e.pvp_worst_death_streak = row[79] ? static_cast<uint32_t>(strtoul(row[79], nullptr, 10)) : 0;
e.pvp_worst_death_streak = row[80] ? static_cast<uint32_t>(strtoul(row[80], nullptr, 10)) : 0; e.pvp_current_kill_streak = row[80] ? static_cast<uint32_t>(strtoul(row[80], nullptr, 10)) : 0;
e.pvp_current_kill_streak = row[81] ? static_cast<uint32_t>(strtoul(row[81], nullptr, 10)) : 0; e.pvp2 = row[81] ? static_cast<uint32_t>(strtoul(row[81], nullptr, 10)) : 0;
e.pvp2 = row[82] ? static_cast<uint32_t>(strtoul(row[82], nullptr, 10)) : 0; e.pvp_type = row[82] ? static_cast<uint32_t>(strtoul(row[82], nullptr, 10)) : 0;
e.pvp_type = row[83] ? static_cast<uint32_t>(strtoul(row[83], nullptr, 10)) : 0; e.show_helm = row[83] ? static_cast<uint32_t>(strtoul(row[83], nullptr, 10)) : 0;
e.show_helm = row[84] ? static_cast<uint32_t>(strtoul(row[84], nullptr, 10)) : 0; e.group_auto_consent = row[84] ? static_cast<uint8_t>(strtoul(row[84], nullptr, 10)) : 0;
e.group_auto_consent = row[85] ? static_cast<uint8_t>(strtoul(row[85], nullptr, 10)) : 0; e.raid_auto_consent = row[85] ? static_cast<uint8_t>(strtoul(row[85], nullptr, 10)) : 0;
e.raid_auto_consent = row[86] ? static_cast<uint8_t>(strtoul(row[86], nullptr, 10)) : 0; e.guild_auto_consent = row[86] ? static_cast<uint8_t>(strtoul(row[86], nullptr, 10)) : 0;
e.guild_auto_consent = row[87] ? static_cast<uint8_t>(strtoul(row[87], nullptr, 10)) : 0; e.leadership_exp_on = row[87] ? static_cast<uint8_t>(strtoul(row[87], nullptr, 10)) : 0;
e.leadership_exp_on = row[88] ? static_cast<uint8_t>(strtoul(row[88], nullptr, 10)) : 0; e.RestTimer = row[88] ? static_cast<uint32_t>(strtoul(row[88], nullptr, 10)) : 0;
e.RestTimer = row[89] ? static_cast<uint32_t>(strtoul(row[89], nullptr, 10)) : 0; e.air_remaining = row[89] ? static_cast<uint32_t>(strtoul(row[89], nullptr, 10)) : 0;
e.air_remaining = row[90] ? static_cast<uint32_t>(strtoul(row[90], nullptr, 10)) : 0; e.autosplit_enabled = row[90] ? static_cast<uint32_t>(strtoul(row[90], nullptr, 10)) : 0;
e.autosplit_enabled = row[91] ? static_cast<uint32_t>(strtoul(row[91], nullptr, 10)) : 0; e.lfp = row[91] ? static_cast<uint8_t>(strtoul(row[91], nullptr, 10)) : 0;
e.lfp = row[92] ? static_cast<uint8_t>(strtoul(row[92], nullptr, 10)) : 0; e.lfg = row[92] ? static_cast<uint8_t>(strtoul(row[92], nullptr, 10)) : 0;
e.lfg = row[93] ? static_cast<uint8_t>(strtoul(row[93], nullptr, 10)) : 0; e.mailkey = row[93] ? row[93] : "";
e.mailkey = row[94] ? row[94] : ""; e.xtargets = row[94] ? static_cast<uint8_t>(strtoul(row[94], nullptr, 10)) : 5;
e.xtargets = row[95] ? static_cast<uint8_t>(strtoul(row[95], nullptr, 10)) : 5; e.firstlogon = row[95] ? static_cast<int8_t>(atoi(row[95])) : 0;
e.firstlogon = row[96] ? static_cast<int8_t>(atoi(row[96])) : 0; e.e_aa_effects = row[96] ? static_cast<uint32_t>(strtoul(row[96], nullptr, 10)) : 0;
e.e_aa_effects = row[97] ? static_cast<uint32_t>(strtoul(row[97], nullptr, 10)) : 0; e.e_percent_to_aa = row[97] ? static_cast<uint32_t>(strtoul(row[97], nullptr, 10)) : 0;
e.e_percent_to_aa = row[98] ? static_cast<uint32_t>(strtoul(row[98], nullptr, 10)) : 0; e.e_expended_aa_spent = row[98] ? static_cast<uint32_t>(strtoul(row[98], nullptr, 10)) : 0;
e.e_expended_aa_spent = row[99] ? static_cast<uint32_t>(strtoul(row[99], nullptr, 10)) : 0; e.aa_points_spent_old = row[99] ? static_cast<uint32_t>(strtoul(row[99], nullptr, 10)) : 0;
e.aa_points_spent_old = row[100] ? static_cast<uint32_t>(strtoul(row[100], nullptr, 10)) : 0; e.aa_points_old = row[100] ? static_cast<uint32_t>(strtoul(row[100], nullptr, 10)) : 0;
e.aa_points_old = row[101] ? static_cast<uint32_t>(strtoul(row[101], nullptr, 10)) : 0; e.e_last_invsnapshot = row[101] ? static_cast<uint32_t>(strtoul(row[101], nullptr, 10)) : 0;
e.e_last_invsnapshot = row[102] ? static_cast<uint32_t>(strtoul(row[102], nullptr, 10)) : 0; e.deleted_at = strtoll(row[102] ? row[102] : "-1", nullptr, 10);
e.deleted_at = strtoll(row[103] ? row[103] : "-1", nullptr, 10);
all_entries.push_back(e); all_entries.push_back(e);
} }
@@ -1244,52 +1235,51 @@ public:
e.int_ = row[55] ? static_cast<uint32_t>(strtoul(row[55], nullptr, 10)) : 0; e.int_ = row[55] ? static_cast<uint32_t>(strtoul(row[55], nullptr, 10)) : 0;
e.agi = row[56] ? static_cast<uint32_t>(strtoul(row[56], nullptr, 10)) : 0; e.agi = row[56] ? static_cast<uint32_t>(strtoul(row[56], nullptr, 10)) : 0;
e.wis = row[57] ? static_cast<uint32_t>(strtoul(row[57], nullptr, 10)) : 0; e.wis = row[57] ? static_cast<uint32_t>(strtoul(row[57], nullptr, 10)) : 0;
e.extra_haste = row[58] ? static_cast<int32_t>(atoi(row[58])) : 0; e.zone_change_count = row[58] ? static_cast<uint32_t>(strtoul(row[58], nullptr, 10)) : 0;
e.zone_change_count = row[59] ? static_cast<uint32_t>(strtoul(row[59], nullptr, 10)) : 0; e.toxicity = row[59] ? static_cast<uint32_t>(strtoul(row[59], nullptr, 10)) : 0;
e.toxicity = row[60] ? static_cast<uint32_t>(strtoul(row[60], nullptr, 10)) : 0; e.hunger_level = row[60] ? static_cast<uint32_t>(strtoul(row[60], nullptr, 10)) : 0;
e.hunger_level = row[61] ? static_cast<uint32_t>(strtoul(row[61], nullptr, 10)) : 0; e.thirst_level = row[61] ? static_cast<uint32_t>(strtoul(row[61], nullptr, 10)) : 0;
e.thirst_level = row[62] ? static_cast<uint32_t>(strtoul(row[62], nullptr, 10)) : 0; e.ability_up = row[62] ? static_cast<uint32_t>(strtoul(row[62], nullptr, 10)) : 0;
e.ability_up = row[63] ? static_cast<uint32_t>(strtoul(row[63], nullptr, 10)) : 0; e.ldon_points_guk = row[63] ? static_cast<uint32_t>(strtoul(row[63], nullptr, 10)) : 0;
e.ldon_points_guk = row[64] ? static_cast<uint32_t>(strtoul(row[64], nullptr, 10)) : 0; e.ldon_points_mir = row[64] ? static_cast<uint32_t>(strtoul(row[64], nullptr, 10)) : 0;
e.ldon_points_mir = row[65] ? static_cast<uint32_t>(strtoul(row[65], nullptr, 10)) : 0; e.ldon_points_mmc = row[65] ? static_cast<uint32_t>(strtoul(row[65], nullptr, 10)) : 0;
e.ldon_points_mmc = row[66] ? static_cast<uint32_t>(strtoul(row[66], nullptr, 10)) : 0; e.ldon_points_ruj = row[66] ? static_cast<uint32_t>(strtoul(row[66], nullptr, 10)) : 0;
e.ldon_points_ruj = row[67] ? static_cast<uint32_t>(strtoul(row[67], nullptr, 10)) : 0; e.ldon_points_tak = row[67] ? static_cast<uint32_t>(strtoul(row[67], nullptr, 10)) : 0;
e.ldon_points_tak = row[68] ? static_cast<uint32_t>(strtoul(row[68], nullptr, 10)) : 0; e.ldon_points_available = row[68] ? static_cast<uint32_t>(strtoul(row[68], nullptr, 10)) : 0;
e.ldon_points_available = row[69] ? static_cast<uint32_t>(strtoul(row[69], nullptr, 10)) : 0; e.tribute_time_remaining = row[69] ? static_cast<uint32_t>(strtoul(row[69], nullptr, 10)) : 0;
e.tribute_time_remaining = row[70] ? static_cast<uint32_t>(strtoul(row[70], nullptr, 10)) : 0; e.career_tribute_points = row[70] ? static_cast<uint32_t>(strtoul(row[70], nullptr, 10)) : 0;
e.career_tribute_points = row[71] ? static_cast<uint32_t>(strtoul(row[71], nullptr, 10)) : 0; e.tribute_points = row[71] ? static_cast<uint32_t>(strtoul(row[71], nullptr, 10)) : 0;
e.tribute_points = row[72] ? static_cast<uint32_t>(strtoul(row[72], nullptr, 10)) : 0; e.tribute_active = row[72] ? static_cast<uint32_t>(strtoul(row[72], nullptr, 10)) : 0;
e.tribute_active = row[73] ? static_cast<uint32_t>(strtoul(row[73], nullptr, 10)) : 0; e.pvp_status = row[73] ? static_cast<uint8_t>(strtoul(row[73], nullptr, 10)) : 0;
e.pvp_status = row[74] ? static_cast<uint8_t>(strtoul(row[74], nullptr, 10)) : 0; e.pvp_kills = row[74] ? static_cast<uint32_t>(strtoul(row[74], nullptr, 10)) : 0;
e.pvp_kills = row[75] ? static_cast<uint32_t>(strtoul(row[75], nullptr, 10)) : 0; e.pvp_deaths = row[75] ? static_cast<uint32_t>(strtoul(row[75], nullptr, 10)) : 0;
e.pvp_deaths = row[76] ? static_cast<uint32_t>(strtoul(row[76], nullptr, 10)) : 0; e.pvp_current_points = row[76] ? static_cast<uint32_t>(strtoul(row[76], nullptr, 10)) : 0;
e.pvp_current_points = row[77] ? static_cast<uint32_t>(strtoul(row[77], nullptr, 10)) : 0; e.pvp_career_points = row[77] ? static_cast<uint32_t>(strtoul(row[77], nullptr, 10)) : 0;
e.pvp_career_points = row[78] ? static_cast<uint32_t>(strtoul(row[78], nullptr, 10)) : 0; e.pvp_best_kill_streak = row[78] ? static_cast<uint32_t>(strtoul(row[78], nullptr, 10)) : 0;
e.pvp_best_kill_streak = row[79] ? static_cast<uint32_t>(strtoul(row[79], nullptr, 10)) : 0; e.pvp_worst_death_streak = row[79] ? static_cast<uint32_t>(strtoul(row[79], nullptr, 10)) : 0;
e.pvp_worst_death_streak = row[80] ? static_cast<uint32_t>(strtoul(row[80], nullptr, 10)) : 0; e.pvp_current_kill_streak = row[80] ? static_cast<uint32_t>(strtoul(row[80], nullptr, 10)) : 0;
e.pvp_current_kill_streak = row[81] ? static_cast<uint32_t>(strtoul(row[81], nullptr, 10)) : 0; e.pvp2 = row[81] ? static_cast<uint32_t>(strtoul(row[81], nullptr, 10)) : 0;
e.pvp2 = row[82] ? static_cast<uint32_t>(strtoul(row[82], nullptr, 10)) : 0; e.pvp_type = row[82] ? static_cast<uint32_t>(strtoul(row[82], nullptr, 10)) : 0;
e.pvp_type = row[83] ? static_cast<uint32_t>(strtoul(row[83], nullptr, 10)) : 0; e.show_helm = row[83] ? static_cast<uint32_t>(strtoul(row[83], nullptr, 10)) : 0;
e.show_helm = row[84] ? static_cast<uint32_t>(strtoul(row[84], nullptr, 10)) : 0; e.group_auto_consent = row[84] ? static_cast<uint8_t>(strtoul(row[84], nullptr, 10)) : 0;
e.group_auto_consent = row[85] ? static_cast<uint8_t>(strtoul(row[85], nullptr, 10)) : 0; e.raid_auto_consent = row[85] ? static_cast<uint8_t>(strtoul(row[85], nullptr, 10)) : 0;
e.raid_auto_consent = row[86] ? static_cast<uint8_t>(strtoul(row[86], nullptr, 10)) : 0; e.guild_auto_consent = row[86] ? static_cast<uint8_t>(strtoul(row[86], nullptr, 10)) : 0;
e.guild_auto_consent = row[87] ? static_cast<uint8_t>(strtoul(row[87], nullptr, 10)) : 0; e.leadership_exp_on = row[87] ? static_cast<uint8_t>(strtoul(row[87], nullptr, 10)) : 0;
e.leadership_exp_on = row[88] ? static_cast<uint8_t>(strtoul(row[88], nullptr, 10)) : 0; e.RestTimer = row[88] ? static_cast<uint32_t>(strtoul(row[88], nullptr, 10)) : 0;
e.RestTimer = row[89] ? static_cast<uint32_t>(strtoul(row[89], nullptr, 10)) : 0; e.air_remaining = row[89] ? static_cast<uint32_t>(strtoul(row[89], nullptr, 10)) : 0;
e.air_remaining = row[90] ? static_cast<uint32_t>(strtoul(row[90], nullptr, 10)) : 0; e.autosplit_enabled = row[90] ? static_cast<uint32_t>(strtoul(row[90], nullptr, 10)) : 0;
e.autosplit_enabled = row[91] ? static_cast<uint32_t>(strtoul(row[91], nullptr, 10)) : 0; e.lfp = row[91] ? static_cast<uint8_t>(strtoul(row[91], nullptr, 10)) : 0;
e.lfp = row[92] ? static_cast<uint8_t>(strtoul(row[92], nullptr, 10)) : 0; e.lfg = row[92] ? static_cast<uint8_t>(strtoul(row[92], nullptr, 10)) : 0;
e.lfg = row[93] ? static_cast<uint8_t>(strtoul(row[93], nullptr, 10)) : 0; e.mailkey = row[93] ? row[93] : "";
e.mailkey = row[94] ? row[94] : ""; e.xtargets = row[94] ? static_cast<uint8_t>(strtoul(row[94], nullptr, 10)) : 5;
e.xtargets = row[95] ? static_cast<uint8_t>(strtoul(row[95], nullptr, 10)) : 5; e.firstlogon = row[95] ? static_cast<int8_t>(atoi(row[95])) : 0;
e.firstlogon = row[96] ? static_cast<int8_t>(atoi(row[96])) : 0; e.e_aa_effects = row[96] ? static_cast<uint32_t>(strtoul(row[96], nullptr, 10)) : 0;
e.e_aa_effects = row[97] ? static_cast<uint32_t>(strtoul(row[97], nullptr, 10)) : 0; e.e_percent_to_aa = row[97] ? static_cast<uint32_t>(strtoul(row[97], nullptr, 10)) : 0;
e.e_percent_to_aa = row[98] ? static_cast<uint32_t>(strtoul(row[98], nullptr, 10)) : 0; e.e_expended_aa_spent = row[98] ? static_cast<uint32_t>(strtoul(row[98], nullptr, 10)) : 0;
e.e_expended_aa_spent = row[99] ? static_cast<uint32_t>(strtoul(row[99], nullptr, 10)) : 0; e.aa_points_spent_old = row[99] ? static_cast<uint32_t>(strtoul(row[99], nullptr, 10)) : 0;
e.aa_points_spent_old = row[100] ? static_cast<uint32_t>(strtoul(row[100], nullptr, 10)) : 0; e.aa_points_old = row[100] ? static_cast<uint32_t>(strtoul(row[100], nullptr, 10)) : 0;
e.aa_points_old = row[101] ? static_cast<uint32_t>(strtoul(row[101], nullptr, 10)) : 0; e.e_last_invsnapshot = row[101] ? static_cast<uint32_t>(strtoul(row[101], nullptr, 10)) : 0;
e.e_last_invsnapshot = row[102] ? static_cast<uint32_t>(strtoul(row[102], nullptr, 10)) : 0; e.deleted_at = strtoll(row[102] ? row[102] : "-1", nullptr, 10);
e.deleted_at = strtoll(row[103] ? row[103] : "-1", nullptr, 10);
all_entries.push_back(e); all_entries.push_back(e);
} }
@@ -1422,7 +1412,6 @@ public:
v.push_back(std::to_string(e.int_)); v.push_back(std::to_string(e.int_));
v.push_back(std::to_string(e.agi)); v.push_back(std::to_string(e.agi));
v.push_back(std::to_string(e.wis)); v.push_back(std::to_string(e.wis));
v.push_back(std::to_string(e.extra_haste));
v.push_back(std::to_string(e.zone_change_count)); v.push_back(std::to_string(e.zone_change_count));
v.push_back(std::to_string(e.toxicity)); v.push_back(std::to_string(e.toxicity));
v.push_back(std::to_string(e.hunger_level)); v.push_back(std::to_string(e.hunger_level));
@@ -1548,7 +1537,6 @@ public:
v.push_back(std::to_string(e.int_)); v.push_back(std::to_string(e.int_));
v.push_back(std::to_string(e.agi)); v.push_back(std::to_string(e.agi));
v.push_back(std::to_string(e.wis)); v.push_back(std::to_string(e.wis));
v.push_back(std::to_string(e.extra_haste));
v.push_back(std::to_string(e.zone_change_count)); v.push_back(std::to_string(e.zone_change_count));
v.push_back(std::to_string(e.toxicity)); v.push_back(std::to_string(e.toxicity));
v.push_back(std::to_string(e.hunger_level)); v.push_back(std::to_string(e.hunger_level));
@@ -1,535 +0,0 @@
/**
* DO NOT MODIFY THIS FILE
*
* This repository was automatically generated and is NOT to be modified directly.
* Any repository modifications are meant to be made to the repository extending the base.
* Any modifications to base repositories are to be made by the generator only
*
* @generator ./utils/scripts/generators/repository-generator.pl
* @docs https://docs.eqemu.io/developer/repositories
*/
#ifndef EQEMU_BASE_CHARACTER_PARCELS_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_PARCELS_REPOSITORY_H
#include "../../database.h"
#include "../../strings.h"
#include <ctime>
class BaseCharacterParcelsRepository {
public:
struct CharacterParcels {
uint32_t id;
uint32_t char_id;
uint32_t item_id;
uint32_t aug_slot_1;
uint32_t aug_slot_2;
uint32_t aug_slot_3;
uint32_t aug_slot_4;
uint32_t aug_slot_5;
uint32_t aug_slot_6;
uint32_t slot_id;
uint32_t quantity;
std::string from_name;
std::string note;
time_t sent_date;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"char_id",
"item_id",
"aug_slot_1",
"aug_slot_2",
"aug_slot_3",
"aug_slot_4",
"aug_slot_5",
"aug_slot_6",
"slot_id",
"quantity",
"from_name",
"note",
"sent_date",
};
}
static std::vector<std::string> SelectColumns()
{
return {
"id",
"char_id",
"item_id",
"aug_slot_1",
"aug_slot_2",
"aug_slot_3",
"aug_slot_4",
"aug_slot_5",
"aug_slot_6",
"slot_id",
"quantity",
"from_name",
"note",
"UNIX_TIMESTAMP(sent_date)",
};
}
static std::string ColumnsRaw()
{
return std::string(Strings::Implode(", ", Columns()));
}
static std::string SelectColumnsRaw()
{
return std::string(Strings::Implode(", ", SelectColumns()));
}
static std::string TableName()
{
return std::string("character_parcels");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
SelectColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static CharacterParcels NewEntity()
{
CharacterParcels e{};
e.id = 0;
e.char_id = 0;
e.item_id = 0;
e.aug_slot_1 = 0;
e.aug_slot_2 = 0;
e.aug_slot_3 = 0;
e.aug_slot_4 = 0;
e.aug_slot_5 = 0;
e.aug_slot_6 = 0;
e.slot_id = 0;
e.quantity = 0;
e.from_name = "";
e.note = "";
e.sent_date = 0;
return e;
}
static CharacterParcels GetCharacterParcels(
const std::vector<CharacterParcels> &character_parcelss,
int character_parcels_id
)
{
for (auto &character_parcels : character_parcelss) {
if (character_parcels.id == character_parcels_id) {
return character_parcels;
}
}
return NewEntity();
}
static CharacterParcels FindOne(
Database& db,
int character_parcels_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {} = {} LIMIT 1",
BaseSelect(),
PrimaryKey(),
character_parcels_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterParcels e{};
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
e.char_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
e.item_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
e.aug_slot_1 = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
e.aug_slot_2 = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
e.aug_slot_3 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
e.aug_slot_4 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
e.aug_slot_5 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
e.aug_slot_6 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
e.slot_id = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
e.from_name = row[11] ? row[11] : "";
e.note = row[12] ? row[12] : "";
e.sent_date = strtoll(row[13] ? row[13] : "-1", nullptr, 10);
return e;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int character_parcels_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_parcels_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
const CharacterParcels &e
)
{
std::vector<std::string> v;
auto columns = Columns();
v.push_back(columns[1] + " = " + std::to_string(e.char_id));
v.push_back(columns[2] + " = " + std::to_string(e.item_id));
v.push_back(columns[3] + " = " + std::to_string(e.aug_slot_1));
v.push_back(columns[4] + " = " + std::to_string(e.aug_slot_2));
v.push_back(columns[5] + " = " + std::to_string(e.aug_slot_3));
v.push_back(columns[6] + " = " + std::to_string(e.aug_slot_4));
v.push_back(columns[7] + " = " + std::to_string(e.aug_slot_5));
v.push_back(columns[8] + " = " + std::to_string(e.aug_slot_6));
v.push_back(columns[9] + " = " + std::to_string(e.slot_id));
v.push_back(columns[10] + " = " + std::to_string(e.quantity));
v.push_back(columns[11] + " = '" + Strings::Escape(e.from_name) + "'");
v.push_back(columns[12] + " = '" + Strings::Escape(e.note) + "'");
v.push_back(columns[13] + " = FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")");
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
Strings::Implode(", ", v),
PrimaryKey(),
e.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterParcels InsertOne(
Database& db,
CharacterParcels e
)
{
std::vector<std::string> v;
v.push_back(std::to_string(e.id));
v.push_back(std::to_string(e.char_id));
v.push_back(std::to_string(e.item_id));
v.push_back(std::to_string(e.aug_slot_1));
v.push_back(std::to_string(e.aug_slot_2));
v.push_back(std::to_string(e.aug_slot_3));
v.push_back(std::to_string(e.aug_slot_4));
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.slot_id));
v.push_back(std::to_string(e.quantity));
v.push_back("'" + Strings::Escape(e.from_name) + "'");
v.push_back("'" + Strings::Escape(e.note) + "'");
v.push_back("FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")");
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
Strings::Implode(",", v)
)
);
if (results.Success()) {
e.id = results.LastInsertedID();
return e;
}
e = NewEntity();
return e;
}
static int InsertMany(
Database& db,
const std::vector<CharacterParcels> &entries
)
{
std::vector<std::string> insert_chunks;
for (auto &e: entries) {
std::vector<std::string> v;
v.push_back(std::to_string(e.id));
v.push_back(std::to_string(e.char_id));
v.push_back(std::to_string(e.item_id));
v.push_back(std::to_string(e.aug_slot_1));
v.push_back(std::to_string(e.aug_slot_2));
v.push_back(std::to_string(e.aug_slot_3));
v.push_back(std::to_string(e.aug_slot_4));
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.slot_id));
v.push_back(std::to_string(e.quantity));
v.push_back("'" + Strings::Escape(e.from_name) + "'");
v.push_back("'" + Strings::Escape(e.note) + "'");
v.push_back("FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")");
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
}
std::vector<std::string> v;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
Strings::Implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterParcels> All(Database& db)
{
std::vector<CharacterParcels> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterParcels e{};
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
e.char_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
e.item_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
e.aug_slot_1 = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
e.aug_slot_2 = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
e.aug_slot_3 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
e.aug_slot_4 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
e.aug_slot_5 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
e.aug_slot_6 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
e.slot_id = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
e.from_name = row[11] ? row[11] : "";
e.note = row[12] ? row[12] : "";
e.sent_date = strtoll(row[13] ? row[13] : "-1", nullptr, 10);
all_entries.push_back(e);
}
return all_entries;
}
static std::vector<CharacterParcels> GetWhere(Database& db, const std::string &where_filter)
{
std::vector<CharacterParcels> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE {}",
BaseSelect(),
where_filter
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterParcels e{};
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
e.char_id = row[1] ? static_cast<uint32_t>(strtoul(row[1], nullptr, 10)) : 0;
e.item_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0;
e.aug_slot_1 = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
e.aug_slot_2 = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
e.aug_slot_3 = row[5] ? static_cast<uint32_t>(strtoul(row[5], nullptr, 10)) : 0;
e.aug_slot_4 = row[6] ? static_cast<uint32_t>(strtoul(row[6], nullptr, 10)) : 0;
e.aug_slot_5 = row[7] ? static_cast<uint32_t>(strtoul(row[7], nullptr, 10)) : 0;
e.aug_slot_6 = row[8] ? static_cast<uint32_t>(strtoul(row[8], nullptr, 10)) : 0;
e.slot_id = row[9] ? static_cast<uint32_t>(strtoul(row[9], nullptr, 10)) : 0;
e.quantity = row[10] ? static_cast<uint32_t>(strtoul(row[10], nullptr, 10)) : 0;
e.from_name = row[11] ? row[11] : "";
e.note = row[12] ? row[12] : "";
e.sent_date = strtoll(row[13] ? row[13] : "-1", nullptr, 10);
all_entries.push_back(e);
}
return all_entries;
}
static int DeleteWhere(Database& db, const std::string &where_filter)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {}",
TableName(),
where_filter
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int Truncate(Database& db)
{
auto results = db.QueryDatabase(
fmt::format(
"TRUNCATE TABLE {}",
TableName()
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int64 GetMaxId(Database& db)
{
auto results = db.QueryDatabase(
fmt::format(
"SELECT COALESCE(MAX({}), 0) FROM {}",
PrimaryKey(),
TableName()
)
);
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
}
static int64 Count(Database& db, const std::string &where_filter = "")
{
auto results = db.QueryDatabase(
fmt::format(
"SELECT COUNT(*) FROM {} {}",
TableName(),
(where_filter.empty() ? "" : "WHERE " + where_filter)
)
);
return (results.Success() && results.begin()[0] ? strtoll(results.begin()[0], nullptr, 10) : 0);
}
static std::string BaseReplace()
{
return fmt::format(
"REPLACE INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static int ReplaceOne(
Database& db,
const CharacterParcels &e
)
{
std::vector<std::string> v;
v.push_back(std::to_string(e.id));
v.push_back(std::to_string(e.char_id));
v.push_back(std::to_string(e.item_id));
v.push_back(std::to_string(e.aug_slot_1));
v.push_back(std::to_string(e.aug_slot_2));
v.push_back(std::to_string(e.aug_slot_3));
v.push_back(std::to_string(e.aug_slot_4));
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.slot_id));
v.push_back(std::to_string(e.quantity));
v.push_back("'" + Strings::Escape(e.from_name) + "'");
v.push_back("'" + Strings::Escape(e.note) + "'");
v.push_back("FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")");
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseReplace(),
Strings::Implode(",", v)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int ReplaceMany(
Database& db,
const std::vector<CharacterParcels> &entries
)
{
std::vector<std::string> insert_chunks;
for (auto &e: entries) {
std::vector<std::string> v;
v.push_back(std::to_string(e.id));
v.push_back(std::to_string(e.char_id));
v.push_back(std::to_string(e.item_id));
v.push_back(std::to_string(e.aug_slot_1));
v.push_back(std::to_string(e.aug_slot_2));
v.push_back(std::to_string(e.aug_slot_3));
v.push_back(std::to_string(e.aug_slot_4));
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.slot_id));
v.push_back(std::to_string(e.quantity));
v.push_back("'" + Strings::Escape(e.from_name) + "'");
v.push_back("'" + Strings::Escape(e.note) + "'");
v.push_back("FROM_UNIXTIME(" + (e.sent_date > 0 ? std::to_string(e.sent_date) : "null") + ")");
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
}
std::vector<std::string> v;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseReplace(),
Strings::Implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
};
#endif //EQEMU_BASE_CHARACTER_PARCELS_REPOSITORY_H
@@ -50,7 +50,6 @@ public:
float buffer; float buffer;
uint32_t client_version_mask; uint32_t client_version_mask;
int16_t is_ldon_door; int16_t is_ldon_door;
int16_t close_timer_ms;
int32_t dz_switch_id; int32_t dz_switch_id;
int8_t min_expansion; int8_t min_expansion;
int8_t max_expansion; int8_t max_expansion;
@@ -97,7 +96,6 @@ public:
"buffer", "buffer",
"client_version_mask", "client_version_mask",
"is_ldon_door", "is_ldon_door",
"close_timer_ms",
"dz_switch_id", "dz_switch_id",
"min_expansion", "min_expansion",
"max_expansion", "max_expansion",
@@ -140,7 +138,6 @@ public:
"buffer", "buffer",
"client_version_mask", "client_version_mask",
"is_ldon_door", "is_ldon_door",
"close_timer_ms",
"dz_switch_id", "dz_switch_id",
"min_expansion", "min_expansion",
"max_expansion", "max_expansion",
@@ -217,7 +214,6 @@ public:
e.buffer = 0; e.buffer = 0;
e.client_version_mask = 4294967295; e.client_version_mask = 4294967295;
e.is_ldon_door = 0; e.is_ldon_door = 0;
e.close_timer_ms = 5000;
e.dz_switch_id = 0; e.dz_switch_id = 0;
e.min_expansion = -1; e.min_expansion = -1;
e.max_expansion = -1; e.max_expansion = -1;
@@ -290,12 +286,11 @@ public:
e.buffer = row[28] ? strtof(row[28], nullptr) : 0; e.buffer = row[28] ? strtof(row[28], nullptr) : 0;
e.client_version_mask = row[29] ? static_cast<uint32_t>(strtoul(row[29], nullptr, 10)) : 4294967295; e.client_version_mask = row[29] ? static_cast<uint32_t>(strtoul(row[29], nullptr, 10)) : 4294967295;
e.is_ldon_door = row[30] ? static_cast<int16_t>(atoi(row[30])) : 0; e.is_ldon_door = row[30] ? static_cast<int16_t>(atoi(row[30])) : 0;
e.close_timer_ms = row[31] ? static_cast<int16_t>(atoi(row[31])) : 5000; e.dz_switch_id = row[31] ? static_cast<int32_t>(atoi(row[31])) : 0;
e.dz_switch_id = row[32] ? static_cast<int32_t>(atoi(row[32])) : 0; e.min_expansion = row[32] ? static_cast<int8_t>(atoi(row[32])) : -1;
e.min_expansion = row[33] ? static_cast<int8_t>(atoi(row[33])) : -1; e.max_expansion = row[33] ? static_cast<int8_t>(atoi(row[33])) : -1;
e.max_expansion = row[34] ? static_cast<int8_t>(atoi(row[34])) : -1; e.content_flags = row[34] ? row[34] : "";
e.content_flags = row[35] ? row[35] : ""; e.content_flags_disabled = row[35] ? row[35] : "";
e.content_flags_disabled = row[36] ? row[36] : "";
return e; return e;
} }
@@ -359,12 +354,11 @@ public:
v.push_back(columns[28] + " = " + std::to_string(e.buffer)); v.push_back(columns[28] + " = " + std::to_string(e.buffer));
v.push_back(columns[29] + " = " + std::to_string(e.client_version_mask)); v.push_back(columns[29] + " = " + std::to_string(e.client_version_mask));
v.push_back(columns[30] + " = " + std::to_string(e.is_ldon_door)); v.push_back(columns[30] + " = " + std::to_string(e.is_ldon_door));
v.push_back(columns[31] + " = " + std::to_string(e.close_timer_ms)); v.push_back(columns[31] + " = " + std::to_string(e.dz_switch_id));
v.push_back(columns[32] + " = " + std::to_string(e.dz_switch_id)); v.push_back(columns[32] + " = " + std::to_string(e.min_expansion));
v.push_back(columns[33] + " = " + std::to_string(e.min_expansion)); v.push_back(columns[33] + " = " + std::to_string(e.max_expansion));
v.push_back(columns[34] + " = " + std::to_string(e.max_expansion)); v.push_back(columns[34] + " = '" + Strings::Escape(e.content_flags) + "'");
v.push_back(columns[35] + " = '" + Strings::Escape(e.content_flags) + "'"); v.push_back(columns[35] + " = '" + Strings::Escape(e.content_flags_disabled) + "'");
v.push_back(columns[36] + " = '" + Strings::Escape(e.content_flags_disabled) + "'");
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@@ -417,7 +411,6 @@ public:
v.push_back(std::to_string(e.buffer)); v.push_back(std::to_string(e.buffer));
v.push_back(std::to_string(e.client_version_mask)); v.push_back(std::to_string(e.client_version_mask));
v.push_back(std::to_string(e.is_ldon_door)); v.push_back(std::to_string(e.is_ldon_door));
v.push_back(std::to_string(e.close_timer_ms));
v.push_back(std::to_string(e.dz_switch_id)); v.push_back(std::to_string(e.dz_switch_id));
v.push_back(std::to_string(e.min_expansion)); v.push_back(std::to_string(e.min_expansion));
v.push_back(std::to_string(e.max_expansion)); v.push_back(std::to_string(e.max_expansion));
@@ -483,7 +476,6 @@ public:
v.push_back(std::to_string(e.buffer)); v.push_back(std::to_string(e.buffer));
v.push_back(std::to_string(e.client_version_mask)); v.push_back(std::to_string(e.client_version_mask));
v.push_back(std::to_string(e.is_ldon_door)); v.push_back(std::to_string(e.is_ldon_door));
v.push_back(std::to_string(e.close_timer_ms));
v.push_back(std::to_string(e.dz_switch_id)); v.push_back(std::to_string(e.dz_switch_id));
v.push_back(std::to_string(e.min_expansion)); v.push_back(std::to_string(e.min_expansion));
v.push_back(std::to_string(e.max_expansion)); v.push_back(std::to_string(e.max_expansion));
@@ -553,12 +545,11 @@ public:
e.buffer = row[28] ? strtof(row[28], nullptr) : 0; e.buffer = row[28] ? strtof(row[28], nullptr) : 0;
e.client_version_mask = row[29] ? static_cast<uint32_t>(strtoul(row[29], nullptr, 10)) : 4294967295; e.client_version_mask = row[29] ? static_cast<uint32_t>(strtoul(row[29], nullptr, 10)) : 4294967295;
e.is_ldon_door = row[30] ? static_cast<int16_t>(atoi(row[30])) : 0; e.is_ldon_door = row[30] ? static_cast<int16_t>(atoi(row[30])) : 0;
e.close_timer_ms = row[31] ? static_cast<int16_t>(atoi(row[31])) : 5000; e.dz_switch_id = row[31] ? static_cast<int32_t>(atoi(row[31])) : 0;
e.dz_switch_id = row[32] ? static_cast<int32_t>(atoi(row[32])) : 0; e.min_expansion = row[32] ? static_cast<int8_t>(atoi(row[32])) : -1;
e.min_expansion = row[33] ? static_cast<int8_t>(atoi(row[33])) : -1; e.max_expansion = row[33] ? static_cast<int8_t>(atoi(row[33])) : -1;
e.max_expansion = row[34] ? static_cast<int8_t>(atoi(row[34])) : -1; e.content_flags = row[34] ? row[34] : "";
e.content_flags = row[35] ? row[35] : ""; e.content_flags_disabled = row[35] ? row[35] : "";
e.content_flags_disabled = row[36] ? row[36] : "";
all_entries.push_back(e); all_entries.push_back(e);
} }
@@ -614,12 +605,11 @@ public:
e.buffer = row[28] ? strtof(row[28], nullptr) : 0; e.buffer = row[28] ? strtof(row[28], nullptr) : 0;
e.client_version_mask = row[29] ? static_cast<uint32_t>(strtoul(row[29], nullptr, 10)) : 4294967295; e.client_version_mask = row[29] ? static_cast<uint32_t>(strtoul(row[29], nullptr, 10)) : 4294967295;
e.is_ldon_door = row[30] ? static_cast<int16_t>(atoi(row[30])) : 0; e.is_ldon_door = row[30] ? static_cast<int16_t>(atoi(row[30])) : 0;
e.close_timer_ms = row[31] ? static_cast<int16_t>(atoi(row[31])) : 5000; e.dz_switch_id = row[31] ? static_cast<int32_t>(atoi(row[31])) : 0;
e.dz_switch_id = row[32] ? static_cast<int32_t>(atoi(row[32])) : 0; e.min_expansion = row[32] ? static_cast<int8_t>(atoi(row[32])) : -1;
e.min_expansion = row[33] ? static_cast<int8_t>(atoi(row[33])) : -1; e.max_expansion = row[33] ? static_cast<int8_t>(atoi(row[33])) : -1;
e.max_expansion = row[34] ? static_cast<int8_t>(atoi(row[34])) : -1; e.content_flags = row[34] ? row[34] : "";
e.content_flags = row[35] ? row[35] : ""; e.content_flags_disabled = row[35] ? row[35] : "";
e.content_flags_disabled = row[36] ? row[36] : "";
all_entries.push_back(e); all_entries.push_back(e);
} }
@@ -725,7 +715,6 @@ public:
v.push_back(std::to_string(e.buffer)); v.push_back(std::to_string(e.buffer));
v.push_back(std::to_string(e.client_version_mask)); v.push_back(std::to_string(e.client_version_mask));
v.push_back(std::to_string(e.is_ldon_door)); v.push_back(std::to_string(e.is_ldon_door));
v.push_back(std::to_string(e.close_timer_ms));
v.push_back(std::to_string(e.dz_switch_id)); v.push_back(std::to_string(e.dz_switch_id));
v.push_back(std::to_string(e.min_expansion)); v.push_back(std::to_string(e.min_expansion));
v.push_back(std::to_string(e.max_expansion)); v.push_back(std::to_string(e.max_expansion));
@@ -784,7 +773,6 @@ public:
v.push_back(std::to_string(e.buffer)); v.push_back(std::to_string(e.buffer));
v.push_back(std::to_string(e.client_version_mask)); v.push_back(std::to_string(e.client_version_mask));
v.push_back(std::to_string(e.is_ldon_door)); v.push_back(std::to_string(e.is_ldon_door));
v.push_back(std::to_string(e.close_timer_ms));
v.push_back(std::to_string(e.dz_switch_id)); v.push_back(std::to_string(e.dz_switch_id));
v.push_back(std::to_string(e.min_expansion)); v.push_back(std::to_string(e.min_expansion));
v.push_back(std::to_string(e.max_expansion)); v.push_back(std::to_string(e.max_expansion));
@@ -19,37 +19,34 @@
class BaseGroupIdRepository { class BaseGroupIdRepository {
public: public:
struct GroupId { struct GroupId {
uint32_t group_id; int32_t groupid;
int32_t charid;
std::string name; std::string name;
uint32_t character_id; int8_t ismerc;
uint32_t bot_id;
uint32_t merc_id;
}; };
static std::string PrimaryKey() static std::string PrimaryKey()
{ {
return std::string("group_id"); return std::string("groupid");
} }
static std::vector<std::string> Columns() static std::vector<std::string> Columns()
{ {
return { return {
"group_id", "groupid",
"charid",
"name", "name",
"character_id", "ismerc",
"bot_id",
"merc_id",
}; };
} }
static std::vector<std::string> SelectColumns() static std::vector<std::string> SelectColumns()
{ {
return { return {
"group_id", "groupid",
"charid",
"name", "name",
"character_id", "ismerc",
"bot_id",
"merc_id",
}; };
} }
@@ -90,11 +87,10 @@ public:
{ {
GroupId e{}; GroupId e{};
e.group_id = 0; e.groupid = 0;
e.name = ""; e.charid = 0;
e.character_id = 0; e.name = "";
e.bot_id = 0; e.ismerc = 0;
e.merc_id = 0;
return e; return e;
} }
@@ -105,7 +101,7 @@ public:
) )
{ {
for (auto &group_id : group_ids) { for (auto &group_id : group_ids) {
if (group_id.group_id == group_id_id) { if (group_id.groupid == group_id_id) {
return group_id; return group_id;
} }
} }
@@ -131,11 +127,10 @@ public:
if (results.RowCount() == 1) { if (results.RowCount() == 1) {
GroupId e{}; GroupId e{};
e.group_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0; e.groupid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
e.name = row[1] ? row[1] : ""; e.charid = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
e.character_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0; e.name = row[2] ? row[2] : "";
e.bot_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0; e.ismerc = row[3] ? static_cast<int8_t>(atoi(row[3])) : 0;
e.merc_id = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
return e; return e;
} }
@@ -169,11 +164,10 @@ public:
auto columns = Columns(); auto columns = Columns();
v.push_back(columns[0] + " = " + std::to_string(e.group_id)); v.push_back(columns[0] + " = " + std::to_string(e.groupid));
v.push_back(columns[1] + " = '" + Strings::Escape(e.name) + "'"); v.push_back(columns[1] + " = " + std::to_string(e.charid));
v.push_back(columns[2] + " = " + std::to_string(e.character_id)); v.push_back(columns[2] + " = '" + Strings::Escape(e.name) + "'");
v.push_back(columns[3] + " = " + std::to_string(e.bot_id)); v.push_back(columns[3] + " = " + std::to_string(e.ismerc));
v.push_back(columns[4] + " = " + std::to_string(e.merc_id));
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@@ -181,7 +175,7 @@ public:
TableName(), TableName(),
Strings::Implode(", ", v), Strings::Implode(", ", v),
PrimaryKey(), PrimaryKey(),
e.group_id e.groupid
) )
); );
@@ -195,11 +189,10 @@ public:
{ {
std::vector<std::string> v; std::vector<std::string> v;
v.push_back(std::to_string(e.group_id)); v.push_back(std::to_string(e.groupid));
v.push_back(std::to_string(e.charid));
v.push_back("'" + Strings::Escape(e.name) + "'"); v.push_back("'" + Strings::Escape(e.name) + "'");
v.push_back(std::to_string(e.character_id)); v.push_back(std::to_string(e.ismerc));
v.push_back(std::to_string(e.bot_id));
v.push_back(std::to_string(e.merc_id));
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@@ -210,7 +203,7 @@ public:
); );
if (results.Success()) { if (results.Success()) {
e.group_id = results.LastInsertedID(); e.groupid = results.LastInsertedID();
return e; return e;
} }
@@ -229,11 +222,10 @@ public:
for (auto &e: entries) { for (auto &e: entries) {
std::vector<std::string> v; std::vector<std::string> v;
v.push_back(std::to_string(e.group_id)); v.push_back(std::to_string(e.groupid));
v.push_back(std::to_string(e.charid));
v.push_back("'" + Strings::Escape(e.name) + "'"); v.push_back("'" + Strings::Escape(e.name) + "'");
v.push_back(std::to_string(e.character_id)); v.push_back(std::to_string(e.ismerc));
v.push_back(std::to_string(e.bot_id));
v.push_back(std::to_string(e.merc_id));
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
} }
@@ -267,11 +259,10 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) { for (auto row = results.begin(); row != results.end(); ++row) {
GroupId e{}; GroupId e{};
e.group_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0; e.groupid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
e.name = row[1] ? row[1] : ""; e.charid = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
e.character_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0; e.name = row[2] ? row[2] : "";
e.bot_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0; e.ismerc = row[3] ? static_cast<int8_t>(atoi(row[3])) : 0;
e.merc_id = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
all_entries.push_back(e); all_entries.push_back(e);
} }
@@ -296,11 +287,10 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) { for (auto row = results.begin(); row != results.end(); ++row) {
GroupId e{}; GroupId e{};
e.group_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0; e.groupid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
e.name = row[1] ? row[1] : ""; e.charid = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
e.character_id = row[2] ? static_cast<uint32_t>(strtoul(row[2], nullptr, 10)) : 0; e.name = row[2] ? row[2] : "";
e.bot_id = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0; e.ismerc = row[3] ? static_cast<int8_t>(atoi(row[3])) : 0;
e.merc_id = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0;
all_entries.push_back(e); all_entries.push_back(e);
} }
@@ -375,11 +365,10 @@ public:
{ {
std::vector<std::string> v; std::vector<std::string> v;
v.push_back(std::to_string(e.group_id)); v.push_back(std::to_string(e.groupid));
v.push_back(std::to_string(e.charid));
v.push_back("'" + Strings::Escape(e.name) + "'"); v.push_back("'" + Strings::Escape(e.name) + "'");
v.push_back(std::to_string(e.character_id)); v.push_back(std::to_string(e.ismerc));
v.push_back(std::to_string(e.bot_id));
v.push_back(std::to_string(e.merc_id));
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@@ -402,11 +391,10 @@ public:
for (auto &e: entries) { for (auto &e: entries) {
std::vector<std::string> v; std::vector<std::string> v;
v.push_back(std::to_string(e.group_id)); v.push_back(std::to_string(e.groupid));
v.push_back(std::to_string(e.charid));
v.push_back("'" + Strings::Escape(e.name) + "'"); v.push_back("'" + Strings::Escape(e.name) + "'");
v.push_back(std::to_string(e.character_id)); v.push_back(std::to_string(e.ismerc));
v.push_back(std::to_string(e.bot_id));
v.push_back(std::to_string(e.merc_id));
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
} }
@@ -105,7 +105,7 @@ public:
e.gid = 0; e.gid = 0;
e.leadername = ""; e.leadername = "";
e.marknpc = ""; e.marknpc = "";
e.leadershipaa = ""; e.leadershipaa = 0;
e.maintank = ""; e.maintank = "";
e.assist = ""; e.assist = "";
e.puller = ""; e.puller = "";
@@ -150,7 +150,7 @@ public:
e.gid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0; e.gid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
e.leadername = row[1] ? row[1] : ""; e.leadername = row[1] ? row[1] : "";
e.marknpc = row[2] ? row[2] : ""; e.marknpc = row[2] ? row[2] : "";
e.leadershipaa = row[3] ? row[3] : ""; e.leadershipaa = row[3] ? row[3] : 0;
e.maintank = row[4] ? row[4] : ""; e.maintank = row[4] ? row[4] : "";
e.assist = row[5] ? row[5] : ""; e.assist = row[5] ? row[5] : "";
e.puller = row[6] ? row[6] : ""; e.puller = row[6] ? row[6] : "";
@@ -192,7 +192,7 @@ public:
v.push_back(columns[0] + " = " + std::to_string(e.gid)); v.push_back(columns[0] + " = " + std::to_string(e.gid));
v.push_back(columns[1] + " = '" + Strings::Escape(e.leadername) + "'"); v.push_back(columns[1] + " = '" + Strings::Escape(e.leadername) + "'");
v.push_back(columns[2] + " = '" + Strings::Escape(e.marknpc) + "'"); v.push_back(columns[2] + " = '" + Strings::Escape(e.marknpc) + "'");
v.push_back(columns[3] + " = '" + e.leadershipaa + "'"); v.push_back(columns[3] + " = '" + Strings::Escape(e.leadershipaa) + "'");
v.push_back(columns[4] + " = '" + Strings::Escape(e.maintank) + "'"); v.push_back(columns[4] + " = '" + Strings::Escape(e.maintank) + "'");
v.push_back(columns[5] + " = '" + Strings::Escape(e.assist) + "'"); v.push_back(columns[5] + " = '" + Strings::Escape(e.assist) + "'");
v.push_back(columns[6] + " = '" + Strings::Escape(e.puller) + "'"); v.push_back(columns[6] + " = '" + Strings::Escape(e.puller) + "'");
@@ -222,7 +222,7 @@ public:
v.push_back(std::to_string(e.gid)); v.push_back(std::to_string(e.gid));
v.push_back("'" + Strings::Escape(e.leadername) + "'"); v.push_back("'" + Strings::Escape(e.leadername) + "'");
v.push_back("'" + Strings::Escape(e.marknpc) + "'"); v.push_back("'" + Strings::Escape(e.marknpc) + "'");
v.push_back("'" + e.leadershipaa + "'"); v.push_back("'" + Strings::Escape(e.leadershipaa) + "'");
v.push_back("'" + Strings::Escape(e.maintank) + "'"); v.push_back("'" + Strings::Escape(e.maintank) + "'");
v.push_back("'" + Strings::Escape(e.assist) + "'"); v.push_back("'" + Strings::Escape(e.assist) + "'");
v.push_back("'" + Strings::Escape(e.puller) + "'"); v.push_back("'" + Strings::Escape(e.puller) + "'");
@@ -260,7 +260,7 @@ public:
v.push_back(std::to_string(e.gid)); v.push_back(std::to_string(e.gid));
v.push_back("'" + Strings::Escape(e.leadername) + "'"); v.push_back("'" + Strings::Escape(e.leadername) + "'");
v.push_back("'" + Strings::Escape(e.marknpc) + "'"); v.push_back("'" + Strings::Escape(e.marknpc) + "'");
v.push_back("'" + e.leadershipaa + "'"); v.push_back("'" + Strings::Escape(e.leadershipaa) + "'");
v.push_back("'" + Strings::Escape(e.maintank) + "'"); v.push_back("'" + Strings::Escape(e.maintank) + "'");
v.push_back("'" + Strings::Escape(e.assist) + "'"); v.push_back("'" + Strings::Escape(e.assist) + "'");
v.push_back("'" + Strings::Escape(e.puller) + "'"); v.push_back("'" + Strings::Escape(e.puller) + "'");
@@ -302,7 +302,7 @@ public:
e.gid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0; e.gid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
e.leadername = row[1] ? row[1] : ""; e.leadername = row[1] ? row[1] : "";
e.marknpc = row[2] ? row[2] : ""; e.marknpc = row[2] ? row[2] : "";
e.leadershipaa = row[3] ? row[3] : ""; e.leadershipaa = row[3] ? row[3] : 0;
e.maintank = row[4] ? row[4] : ""; e.maintank = row[4] ? row[4] : "";
e.assist = row[5] ? row[5] : ""; e.assist = row[5] ? row[5] : "";
e.puller = row[6] ? row[6] : ""; e.puller = row[6] ? row[6] : "";
@@ -335,7 +335,7 @@ public:
e.gid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0; e.gid = row[0] ? static_cast<int32_t>(atoi(row[0])) : 0;
e.leadername = row[1] ? row[1] : ""; e.leadername = row[1] ? row[1] : "";
e.marknpc = row[2] ? row[2] : ""; e.marknpc = row[2] ? row[2] : "";
e.leadershipaa = row[3] ? row[3] : ""; e.leadershipaa = row[3] ? row[3] : 0;
e.maintank = row[4] ? row[4] : ""; e.maintank = row[4] ? row[4] : "";
e.assist = row[5] ? row[5] : ""; e.assist = row[5] ? row[5] : "";
e.puller = row[6] ? row[6] : ""; e.puller = row[6] ? row[6] : "";
@@ -418,7 +418,7 @@ public:
v.push_back(std::to_string(e.gid)); v.push_back(std::to_string(e.gid));
v.push_back("'" + Strings::Escape(e.leadername) + "'"); v.push_back("'" + Strings::Escape(e.leadername) + "'");
v.push_back("'" + Strings::Escape(e.marknpc) + "'"); v.push_back("'" + Strings::Escape(e.marknpc) + "'");
v.push_back("'" + e.leadershipaa + "'"); v.push_back("'" + Strings::Escape(e.leadershipaa) + "'");
v.push_back("'" + Strings::Escape(e.maintank) + "'"); v.push_back("'" + Strings::Escape(e.maintank) + "'");
v.push_back("'" + Strings::Escape(e.assist) + "'"); v.push_back("'" + Strings::Escape(e.assist) + "'");
v.push_back("'" + Strings::Escape(e.puller) + "'"); v.push_back("'" + Strings::Escape(e.puller) + "'");
@@ -449,7 +449,7 @@ public:
v.push_back(std::to_string(e.gid)); v.push_back(std::to_string(e.gid));
v.push_back("'" + Strings::Escape(e.leadername) + "'"); v.push_back("'" + Strings::Escape(e.leadername) + "'");
v.push_back("'" + Strings::Escape(e.marknpc) + "'"); v.push_back("'" + Strings::Escape(e.marknpc) + "'");
v.push_back("'" + e.leadershipaa + "'"); v.push_back("'" + Strings::Escape(e.leadershipaa) + "'");
v.push_back("'" + Strings::Escape(e.maintank) + "'"); v.push_back("'" + Strings::Escape(e.maintank) + "'");
v.push_back("'" + Strings::Escape(e.assist) + "'"); v.push_back("'" + Strings::Escape(e.assist) + "'");
v.push_back("'" + Strings::Escape(e.puller) + "'"); v.push_back("'" + Strings::Escape(e.puller) + "'");
@@ -19,21 +19,17 @@
class BaseLootdropEntriesRepository { class BaseLootdropEntriesRepository {
public: public:
struct LootdropEntries { struct LootdropEntries {
uint32_t lootdrop_id; uint32_t lootdrop_id;
int32_t item_id; int32_t item_id;
uint16_t item_charges; uint16_t item_charges;
uint8_t equip_item; uint8_t equip_item;
float chance; float chance;
float disabled_chance; float disabled_chance;
uint16_t trivial_min_level; uint16_t trivial_min_level;
uint16_t trivial_max_level; uint16_t trivial_max_level;
uint8_t multiplier; uint8_t multiplier;
uint16_t npc_min_level; uint16_t npc_min_level;
uint16_t npc_max_level; uint16_t npc_max_level;
int8_t min_expansion;
int8_t max_expansion;
std::string content_flags;
std::string content_flags_disabled;
}; };
static std::string PrimaryKey() static std::string PrimaryKey()
@@ -55,10 +51,6 @@ public:
"multiplier", "multiplier",
"npc_min_level", "npc_min_level",
"npc_max_level", "npc_max_level",
"min_expansion",
"max_expansion",
"content_flags",
"content_flags_disabled",
}; };
} }
@@ -76,10 +68,6 @@ public:
"multiplier", "multiplier",
"npc_min_level", "npc_min_level",
"npc_max_level", "npc_max_level",
"min_expansion",
"max_expansion",
"content_flags",
"content_flags_disabled",
}; };
} }
@@ -120,21 +108,17 @@ public:
{ {
LootdropEntries e{}; LootdropEntries e{};
e.lootdrop_id = 0; e.lootdrop_id = 0;
e.item_id = 0; e.item_id = 0;
e.item_charges = 1; e.item_charges = 1;
e.equip_item = 0; e.equip_item = 0;
e.chance = 1; e.chance = 1;
e.disabled_chance = 0; e.disabled_chance = 0;
e.trivial_min_level = 0; e.trivial_min_level = 0;
e.trivial_max_level = 0; e.trivial_max_level = 0;
e.multiplier = 1; e.multiplier = 1;
e.npc_min_level = 0; e.npc_min_level = 0;
e.npc_max_level = 0; e.npc_max_level = 0;
e.min_expansion = -1;
e.max_expansion = -1;
e.content_flags = "";
e.content_flags_disabled = "";
return e; return e;
} }
@@ -171,21 +155,17 @@ public:
if (results.RowCount() == 1) { if (results.RowCount() == 1) {
LootdropEntries e{}; LootdropEntries e{};
e.lootdrop_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0; e.lootdrop_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
e.item_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0; e.item_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
e.item_charges = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 1; e.item_charges = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 1;
e.equip_item = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0; e.equip_item = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
e.chance = row[4] ? strtof(row[4], nullptr) : 1; e.chance = row[4] ? strtof(row[4], nullptr) : 1;
e.disabled_chance = row[5] ? strtof(row[5], nullptr) : 0; e.disabled_chance = row[5] ? strtof(row[5], nullptr) : 0;
e.trivial_min_level = row[6] ? static_cast<uint16_t>(strtoul(row[6], nullptr, 10)) : 0; e.trivial_min_level = row[6] ? static_cast<uint16_t>(strtoul(row[6], nullptr, 10)) : 0;
e.trivial_max_level = row[7] ? static_cast<uint16_t>(strtoul(row[7], nullptr, 10)) : 0; e.trivial_max_level = row[7] ? static_cast<uint16_t>(strtoul(row[7], nullptr, 10)) : 0;
e.multiplier = row[8] ? static_cast<uint8_t>(strtoul(row[8], nullptr, 10)) : 1; e.multiplier = row[8] ? static_cast<uint8_t>(strtoul(row[8], nullptr, 10)) : 1;
e.npc_min_level = row[9] ? static_cast<uint16_t>(strtoul(row[9], nullptr, 10)) : 0; e.npc_min_level = row[9] ? static_cast<uint16_t>(strtoul(row[9], nullptr, 10)) : 0;
e.npc_max_level = row[10] ? static_cast<uint16_t>(strtoul(row[10], nullptr, 10)) : 0; e.npc_max_level = row[10] ? static_cast<uint16_t>(strtoul(row[10], nullptr, 10)) : 0;
e.min_expansion = row[11] ? static_cast<int8_t>(atoi(row[11])) : -1;
e.max_expansion = row[12] ? static_cast<int8_t>(atoi(row[12])) : -1;
e.content_flags = row[13] ? row[13] : "";
e.content_flags_disabled = row[14] ? row[14] : "";
return e; return e;
} }
@@ -230,10 +210,6 @@ public:
v.push_back(columns[8] + " = " + std::to_string(e.multiplier)); v.push_back(columns[8] + " = " + std::to_string(e.multiplier));
v.push_back(columns[9] + " = " + std::to_string(e.npc_min_level)); v.push_back(columns[9] + " = " + std::to_string(e.npc_min_level));
v.push_back(columns[10] + " = " + std::to_string(e.npc_max_level)); v.push_back(columns[10] + " = " + std::to_string(e.npc_max_level));
v.push_back(columns[11] + " = " + std::to_string(e.min_expansion));
v.push_back(columns[12] + " = " + std::to_string(e.max_expansion));
v.push_back(columns[13] + " = '" + Strings::Escape(e.content_flags) + "'");
v.push_back(columns[14] + " = '" + Strings::Escape(e.content_flags_disabled) + "'");
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@@ -266,10 +242,6 @@ public:
v.push_back(std::to_string(e.multiplier)); v.push_back(std::to_string(e.multiplier));
v.push_back(std::to_string(e.npc_min_level)); v.push_back(std::to_string(e.npc_min_level));
v.push_back(std::to_string(e.npc_max_level)); v.push_back(std::to_string(e.npc_max_level));
v.push_back(std::to_string(e.min_expansion));
v.push_back(std::to_string(e.max_expansion));
v.push_back("'" + Strings::Escape(e.content_flags) + "'");
v.push_back("'" + Strings::Escape(e.content_flags_disabled) + "'");
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@@ -310,10 +282,6 @@ public:
v.push_back(std::to_string(e.multiplier)); v.push_back(std::to_string(e.multiplier));
v.push_back(std::to_string(e.npc_min_level)); v.push_back(std::to_string(e.npc_min_level));
v.push_back(std::to_string(e.npc_max_level)); v.push_back(std::to_string(e.npc_max_level));
v.push_back(std::to_string(e.min_expansion));
v.push_back(std::to_string(e.max_expansion));
v.push_back("'" + Strings::Escape(e.content_flags) + "'");
v.push_back("'" + Strings::Escape(e.content_flags_disabled) + "'");
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
} }
@@ -347,21 +315,17 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) { for (auto row = results.begin(); row != results.end(); ++row) {
LootdropEntries e{}; LootdropEntries e{};
e.lootdrop_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0; e.lootdrop_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
e.item_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0; e.item_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
e.item_charges = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 1; e.item_charges = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 1;
e.equip_item = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0; e.equip_item = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
e.chance = row[4] ? strtof(row[4], nullptr) : 1; e.chance = row[4] ? strtof(row[4], nullptr) : 1;
e.disabled_chance = row[5] ? strtof(row[5], nullptr) : 0; e.disabled_chance = row[5] ? strtof(row[5], nullptr) : 0;
e.trivial_min_level = row[6] ? static_cast<uint16_t>(strtoul(row[6], nullptr, 10)) : 0; e.trivial_min_level = row[6] ? static_cast<uint16_t>(strtoul(row[6], nullptr, 10)) : 0;
e.trivial_max_level = row[7] ? static_cast<uint16_t>(strtoul(row[7], nullptr, 10)) : 0; e.trivial_max_level = row[7] ? static_cast<uint16_t>(strtoul(row[7], nullptr, 10)) : 0;
e.multiplier = row[8] ? static_cast<uint8_t>(strtoul(row[8], nullptr, 10)) : 1; e.multiplier = row[8] ? static_cast<uint8_t>(strtoul(row[8], nullptr, 10)) : 1;
e.npc_min_level = row[9] ? static_cast<uint16_t>(strtoul(row[9], nullptr, 10)) : 0; e.npc_min_level = row[9] ? static_cast<uint16_t>(strtoul(row[9], nullptr, 10)) : 0;
e.npc_max_level = row[10] ? static_cast<uint16_t>(strtoul(row[10], nullptr, 10)) : 0; e.npc_max_level = row[10] ? static_cast<uint16_t>(strtoul(row[10], nullptr, 10)) : 0;
e.min_expansion = row[11] ? static_cast<int8_t>(atoi(row[11])) : -1;
e.max_expansion = row[12] ? static_cast<int8_t>(atoi(row[12])) : -1;
e.content_flags = row[13] ? row[13] : "";
e.content_flags_disabled = row[14] ? row[14] : "";
all_entries.push_back(e); all_entries.push_back(e);
} }
@@ -386,21 +350,17 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) { for (auto row = results.begin(); row != results.end(); ++row) {
LootdropEntries e{}; LootdropEntries e{};
e.lootdrop_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0; e.lootdrop_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
e.item_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0; e.item_id = row[1] ? static_cast<int32_t>(atoi(row[1])) : 0;
e.item_charges = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 1; e.item_charges = row[2] ? static_cast<uint16_t>(strtoul(row[2], nullptr, 10)) : 1;
e.equip_item = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0; e.equip_item = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0;
e.chance = row[4] ? strtof(row[4], nullptr) : 1; e.chance = row[4] ? strtof(row[4], nullptr) : 1;
e.disabled_chance = row[5] ? strtof(row[5], nullptr) : 0; e.disabled_chance = row[5] ? strtof(row[5], nullptr) : 0;
e.trivial_min_level = row[6] ? static_cast<uint16_t>(strtoul(row[6], nullptr, 10)) : 0; e.trivial_min_level = row[6] ? static_cast<uint16_t>(strtoul(row[6], nullptr, 10)) : 0;
e.trivial_max_level = row[7] ? static_cast<uint16_t>(strtoul(row[7], nullptr, 10)) : 0; e.trivial_max_level = row[7] ? static_cast<uint16_t>(strtoul(row[7], nullptr, 10)) : 0;
e.multiplier = row[8] ? static_cast<uint8_t>(strtoul(row[8], nullptr, 10)) : 1; e.multiplier = row[8] ? static_cast<uint8_t>(strtoul(row[8], nullptr, 10)) : 1;
e.npc_min_level = row[9] ? static_cast<uint16_t>(strtoul(row[9], nullptr, 10)) : 0; e.npc_min_level = row[9] ? static_cast<uint16_t>(strtoul(row[9], nullptr, 10)) : 0;
e.npc_max_level = row[10] ? static_cast<uint16_t>(strtoul(row[10], nullptr, 10)) : 0; e.npc_max_level = row[10] ? static_cast<uint16_t>(strtoul(row[10], nullptr, 10)) : 0;
e.min_expansion = row[11] ? static_cast<int8_t>(atoi(row[11])) : -1;
e.max_expansion = row[12] ? static_cast<int8_t>(atoi(row[12])) : -1;
e.content_flags = row[13] ? row[13] : "";
e.content_flags_disabled = row[14] ? row[14] : "";
all_entries.push_back(e); all_entries.push_back(e);
} }
@@ -486,10 +446,6 @@ public:
v.push_back(std::to_string(e.multiplier)); v.push_back(std::to_string(e.multiplier));
v.push_back(std::to_string(e.npc_min_level)); v.push_back(std::to_string(e.npc_min_level));
v.push_back(std::to_string(e.npc_max_level)); v.push_back(std::to_string(e.npc_max_level));
v.push_back(std::to_string(e.min_expansion));
v.push_back(std::to_string(e.max_expansion));
v.push_back("'" + Strings::Escape(e.content_flags) + "'");
v.push_back("'" + Strings::Escape(e.content_flags_disabled) + "'");
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@@ -523,10 +479,6 @@ public:
v.push_back(std::to_string(e.multiplier)); v.push_back(std::to_string(e.multiplier));
v.push_back(std::to_string(e.npc_min_level)); v.push_back(std::to_string(e.npc_min_level));
v.push_back(std::to_string(e.npc_max_level)); v.push_back(std::to_string(e.npc_max_level));
v.push_back(std::to_string(e.min_expansion));
v.push_back(std::to_string(e.max_expansion));
v.push_back("'" + Strings::Escape(e.content_flags) + "'");
v.push_back("'" + Strings::Escape(e.content_flags_disabled) + "'");
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
} }
@@ -146,7 +146,6 @@ public:
int32_t heroic_strikethrough; int32_t heroic_strikethrough;
int32_t faction_amount; int32_t faction_amount;
uint8_t keeps_sold_items; uint8_t keeps_sold_items;
uint8_t is_parcel_merchant;
}; };
static std::string PrimaryKey() static std::string PrimaryKey()
@@ -284,7 +283,6 @@ public:
"heroic_strikethrough", "heroic_strikethrough",
"faction_amount", "faction_amount",
"keeps_sold_items", "keeps_sold_items",
"is_parcel_merchant",
}; };
} }
@@ -418,7 +416,6 @@ public:
"heroic_strikethrough", "heroic_strikethrough",
"faction_amount", "faction_amount",
"keeps_sold_items", "keeps_sold_items",
"is_parcel_merchant",
}; };
} }
@@ -586,7 +583,6 @@ public:
e.heroic_strikethrough = 0; e.heroic_strikethrough = 0;
e.faction_amount = 0; e.faction_amount = 0;
e.keeps_sold_items = 1; e.keeps_sold_items = 1;
e.is_parcel_merchant = 0;
return e; return e;
} }
@@ -750,7 +746,6 @@ public:
e.heroic_strikethrough = row[124] ? static_cast<int32_t>(atoi(row[124])) : 0; e.heroic_strikethrough = row[124] ? static_cast<int32_t>(atoi(row[124])) : 0;
e.faction_amount = row[125] ? static_cast<int32_t>(atoi(row[125])) : 0; e.faction_amount = row[125] ? static_cast<int32_t>(atoi(row[125])) : 0;
e.keeps_sold_items = row[126] ? static_cast<uint8_t>(strtoul(row[126], nullptr, 10)) : 1; e.keeps_sold_items = row[126] ? static_cast<uint8_t>(strtoul(row[126], nullptr, 10)) : 1;
e.is_parcel_merchant = row[127] ? static_cast<uint8_t>(strtoul(row[127], nullptr, 10)) : 0;
return e; return e;
} }
@@ -910,7 +905,6 @@ public:
v.push_back(columns[124] + " = " + std::to_string(e.heroic_strikethrough)); v.push_back(columns[124] + " = " + std::to_string(e.heroic_strikethrough));
v.push_back(columns[125] + " = " + std::to_string(e.faction_amount)); v.push_back(columns[125] + " = " + std::to_string(e.faction_amount));
v.push_back(columns[126] + " = " + std::to_string(e.keeps_sold_items)); v.push_back(columns[126] + " = " + std::to_string(e.keeps_sold_items));
v.push_back(columns[127] + " = " + std::to_string(e.is_parcel_merchant));
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@@ -1059,7 +1053,6 @@ public:
v.push_back(std::to_string(e.heroic_strikethrough)); v.push_back(std::to_string(e.heroic_strikethrough));
v.push_back(std::to_string(e.faction_amount)); v.push_back(std::to_string(e.faction_amount));
v.push_back(std::to_string(e.keeps_sold_items)); v.push_back(std::to_string(e.keeps_sold_items));
v.push_back(std::to_string(e.is_parcel_merchant));
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@@ -1216,7 +1209,6 @@ public:
v.push_back(std::to_string(e.heroic_strikethrough)); v.push_back(std::to_string(e.heroic_strikethrough));
v.push_back(std::to_string(e.faction_amount)); v.push_back(std::to_string(e.faction_amount));
v.push_back(std::to_string(e.keeps_sold_items)); v.push_back(std::to_string(e.keeps_sold_items));
v.push_back(std::to_string(e.is_parcel_merchant));
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
} }
@@ -1377,7 +1369,6 @@ public:
e.heroic_strikethrough = row[124] ? static_cast<int32_t>(atoi(row[124])) : 0; e.heroic_strikethrough = row[124] ? static_cast<int32_t>(atoi(row[124])) : 0;
e.faction_amount = row[125] ? static_cast<int32_t>(atoi(row[125])) : 0; e.faction_amount = row[125] ? static_cast<int32_t>(atoi(row[125])) : 0;
e.keeps_sold_items = row[126] ? static_cast<uint8_t>(strtoul(row[126], nullptr, 10)) : 1; e.keeps_sold_items = row[126] ? static_cast<uint8_t>(strtoul(row[126], nullptr, 10)) : 1;
e.is_parcel_merchant = row[127] ? static_cast<uint8_t>(strtoul(row[127], nullptr, 10)) : 0;
all_entries.push_back(e); all_entries.push_back(e);
} }
@@ -1529,7 +1520,6 @@ public:
e.heroic_strikethrough = row[124] ? static_cast<int32_t>(atoi(row[124])) : 0; e.heroic_strikethrough = row[124] ? static_cast<int32_t>(atoi(row[124])) : 0;
e.faction_amount = row[125] ? static_cast<int32_t>(atoi(row[125])) : 0; e.faction_amount = row[125] ? static_cast<int32_t>(atoi(row[125])) : 0;
e.keeps_sold_items = row[126] ? static_cast<uint8_t>(strtoul(row[126], nullptr, 10)) : 1; e.keeps_sold_items = row[126] ? static_cast<uint8_t>(strtoul(row[126], nullptr, 10)) : 1;
e.is_parcel_merchant = row[127] ? static_cast<uint8_t>(strtoul(row[127], nullptr, 10)) : 0;
all_entries.push_back(e); all_entries.push_back(e);
} }
@@ -1731,7 +1721,6 @@ public:
v.push_back(std::to_string(e.heroic_strikethrough)); v.push_back(std::to_string(e.heroic_strikethrough));
v.push_back(std::to_string(e.faction_amount)); v.push_back(std::to_string(e.faction_amount));
v.push_back(std::to_string(e.keeps_sold_items)); v.push_back(std::to_string(e.keeps_sold_items));
v.push_back(std::to_string(e.is_parcel_merchant));
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@@ -1881,7 +1870,6 @@ public:
v.push_back(std::to_string(e.heroic_strikethrough)); v.push_back(std::to_string(e.heroic_strikethrough));
v.push_back(std::to_string(e.faction_amount)); v.push_back(std::to_string(e.faction_amount));
v.push_back(std::to_string(e.keeps_sold_items)); v.push_back(std::to_string(e.keeps_sold_items));
v.push_back(std::to_string(e.is_parcel_merchant));
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
} }
@@ -19,9 +19,8 @@
class BaseSkillCapsRepository { class BaseSkillCapsRepository {
public: public:
struct SkillCaps { struct SkillCaps {
uint32_t id; uint8_t skillID;
uint8_t skill_id; uint8_t class_;
uint8_t class_id;
uint8_t level; uint8_t level;
uint32_t cap; uint32_t cap;
uint8_t class_; uint8_t class_;
@@ -29,15 +28,14 @@ public:
static std::string PrimaryKey() static std::string PrimaryKey()
{ {
return std::string("id"); return std::string("skillID");
} }
static std::vector<std::string> Columns() static std::vector<std::string> Columns()
{ {
return { return {
"id", "skillID",
"skill_id", "`class`",
"class_id",
"level", "level",
"cap", "cap",
"class_", "class_",
@@ -47,9 +45,8 @@ public:
static std::vector<std::string> SelectColumns() static std::vector<std::string> SelectColumns()
{ {
return { return {
"id", "skillID",
"skill_id", "`class`",
"class_id",
"level", "level",
"cap", "cap",
"class_", "class_",
@@ -93,12 +90,11 @@ public:
{ {
SkillCaps e{}; SkillCaps e{};
e.id = 0; e.skillID = 0;
e.skill_id = 0; e.class_ = 0;
e.class_id = 0; e.level = 0;
e.level = 0; e.cap = 0;
e.cap = 0; e.class_ = 0;
e.class_ = 0;
return e; return e;
} }
@@ -109,7 +105,7 @@ public:
) )
{ {
for (auto &skill_caps : skill_capss) { for (auto &skill_caps : skill_capss) {
if (skill_caps.id == skill_caps_id) { if (skill_caps.skillID == skill_caps_id) {
return skill_caps; return skill_caps;
} }
} }
@@ -135,12 +131,11 @@ public:
if (results.RowCount() == 1) { if (results.RowCount() == 1) {
SkillCaps e{}; SkillCaps e{};
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0; e.skillID = row[0] ? static_cast<uint8_t>(strtoul(row[0], nullptr, 10)) : 0;
e.skill_id = row[1] ? static_cast<uint8_t>(strtoul(row[1], nullptr, 10)) : 0; e.class_ = row[1] ? static_cast<uint8_t>(strtoul(row[1], nullptr, 10)) : 0;
e.class_id = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0; e.level = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
e.level = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0; e.cap = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
e.cap = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0; e.class_ = row[4] ? static_cast<uint8_t>(strtoul(row[4], nullptr, 10)) : 0;
e.class_ = row[5] ? static_cast<uint8_t>(strtoul(row[5], nullptr, 10)) : 0;
return e; return e;
} }
@@ -174,11 +169,11 @@ public:
auto columns = Columns(); auto columns = Columns();
v.push_back(columns[1] + " = " + std::to_string(e.skill_id)); v.push_back(columns[0] + " = " + std::to_string(e.skillID));
v.push_back(columns[2] + " = " + std::to_string(e.class_id)); v.push_back(columns[1] + " = " + std::to_string(e.class_));
v.push_back(columns[3] + " = " + std::to_string(e.level)); v.push_back(columns[2] + " = " + std::to_string(e.level));
v.push_back(columns[4] + " = " + std::to_string(e.cap)); v.push_back(columns[3] + " = " + std::to_string(e.cap));
v.push_back(columns[5] + " = " + std::to_string(e.class_)); v.push_back(columns[4] + " = " + std::to_string(e.class_));
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@@ -186,7 +181,7 @@ public:
TableName(), TableName(),
Strings::Implode(", ", v), Strings::Implode(", ", v),
PrimaryKey(), PrimaryKey(),
e.id e.skillID
) )
); );
@@ -200,9 +195,8 @@ public:
{ {
std::vector<std::string> v; std::vector<std::string> v;
v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.skillID));
v.push_back(std::to_string(e.skill_id)); v.push_back(std::to_string(e.class_));
v.push_back(std::to_string(e.class_id));
v.push_back(std::to_string(e.level)); v.push_back(std::to_string(e.level));
v.push_back(std::to_string(e.cap)); v.push_back(std::to_string(e.cap));
v.push_back(std::to_string(e.class_)); v.push_back(std::to_string(e.class_));
@@ -216,7 +210,7 @@ public:
); );
if (results.Success()) { if (results.Success()) {
e.id = results.LastInsertedID(); e.skillID = results.LastInsertedID();
return e; return e;
} }
@@ -235,9 +229,8 @@ public:
for (auto &e: entries) { for (auto &e: entries) {
std::vector<std::string> v; std::vector<std::string> v;
v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.skillID));
v.push_back(std::to_string(e.skill_id)); v.push_back(std::to_string(e.class_));
v.push_back(std::to_string(e.class_id));
v.push_back(std::to_string(e.level)); v.push_back(std::to_string(e.level));
v.push_back(std::to_string(e.cap)); v.push_back(std::to_string(e.cap));
v.push_back(std::to_string(e.class_)); v.push_back(std::to_string(e.class_));
@@ -274,12 +267,11 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) { for (auto row = results.begin(); row != results.end(); ++row) {
SkillCaps e{}; SkillCaps e{};
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0; e.skillID = row[0] ? static_cast<uint8_t>(strtoul(row[0], nullptr, 10)) : 0;
e.skill_id = row[1] ? static_cast<uint8_t>(strtoul(row[1], nullptr, 10)) : 0; e.class_ = row[1] ? static_cast<uint8_t>(strtoul(row[1], nullptr, 10)) : 0;
e.class_id = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0; e.level = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
e.level = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0; e.cap = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
e.cap = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0; e.class_ = row[4] ? static_cast<uint8_t>(strtoul(row[4], nullptr, 10)) : 0;
e.class_ = row[5] ? static_cast<uint8_t>(strtoul(row[5], nullptr, 10)) : 0;
all_entries.push_back(e); all_entries.push_back(e);
} }
@@ -304,12 +296,11 @@ public:
for (auto row = results.begin(); row != results.end(); ++row) { for (auto row = results.begin(); row != results.end(); ++row) {
SkillCaps e{}; SkillCaps e{};
e.id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0; e.skillID = row[0] ? static_cast<uint8_t>(strtoul(row[0], nullptr, 10)) : 0;
e.skill_id = row[1] ? static_cast<uint8_t>(strtoul(row[1], nullptr, 10)) : 0; e.class_ = row[1] ? static_cast<uint8_t>(strtoul(row[1], nullptr, 10)) : 0;
e.class_id = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0; e.level = row[2] ? static_cast<uint8_t>(strtoul(row[2], nullptr, 10)) : 0;
e.level = row[3] ? static_cast<uint8_t>(strtoul(row[3], nullptr, 10)) : 0; e.cap = row[3] ? static_cast<uint32_t>(strtoul(row[3], nullptr, 10)) : 0;
e.cap = row[4] ? static_cast<uint32_t>(strtoul(row[4], nullptr, 10)) : 0; e.class_ = row[4] ? static_cast<uint8_t>(strtoul(row[4], nullptr, 10)) : 0;
e.class_ = row[5] ? static_cast<uint8_t>(strtoul(row[5], nullptr, 10)) : 0;
all_entries.push_back(e); all_entries.push_back(e);
} }
@@ -384,9 +375,8 @@ public:
{ {
std::vector<std::string> v; std::vector<std::string> v;
v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.skillID));
v.push_back(std::to_string(e.skill_id)); v.push_back(std::to_string(e.class_));
v.push_back(std::to_string(e.class_id));
v.push_back(std::to_string(e.level)); v.push_back(std::to_string(e.level));
v.push_back(std::to_string(e.cap)); v.push_back(std::to_string(e.cap));
v.push_back(std::to_string(e.class_)); v.push_back(std::to_string(e.class_));
@@ -412,9 +402,8 @@ public:
for (auto &e: entries) { for (auto &e: entries) {
std::vector<std::string> v; std::vector<std::string> v;
v.push_back(std::to_string(e.id)); v.push_back(std::to_string(e.skillID));
v.push_back(std::to_string(e.skill_id)); v.push_back(std::to_string(e.class_));
v.push_back(std::to_string(e.class_id));
v.push_back(std::to_string(e.level)); v.push_back(std::to_string(e.level));
v.push_back(std::to_string(e.cap)); v.push_back(std::to_string(e.cap));
v.push_back(std::to_string(e.class_)); v.push_back(std::to_string(e.class_));
@@ -23,7 +23,7 @@ public:
std::string varname; std::string varname;
std::string value; std::string value;
std::string information; std::string information;
time_t ts; std::string ts;
}; };
static std::string PrimaryKey() static std::string PrimaryKey()
@@ -49,7 +49,7 @@ public:
"varname", "varname",
"value", "value",
"information", "information",
"UNIX_TIMESTAMP(ts)", "ts",
}; };
} }
@@ -135,7 +135,7 @@ public:
e.varname = row[1] ? row[1] : ""; e.varname = row[1] ? row[1] : "";
e.value = row[2] ? row[2] : ""; e.value = row[2] ? row[2] : "";
e.information = row[3] ? row[3] : ""; e.information = row[3] ? row[3] : "";
e.ts = strtoll(row[4] ? row[4] : "-1", nullptr, 10); e.ts = row[4] ? row[4] : std::time(nullptr);
return e; return e;
} }
@@ -172,7 +172,7 @@ public:
v.push_back(columns[1] + " = '" + Strings::Escape(e.varname) + "'"); v.push_back(columns[1] + " = '" + Strings::Escape(e.varname) + "'");
v.push_back(columns[2] + " = '" + Strings::Escape(e.value) + "'"); v.push_back(columns[2] + " = '" + Strings::Escape(e.value) + "'");
v.push_back(columns[3] + " = '" + Strings::Escape(e.information) + "'"); v.push_back(columns[3] + " = '" + Strings::Escape(e.information) + "'");
v.push_back(columns[4] + " = FROM_UNIXTIME(" + (e.ts > 0 ? std::to_string(e.ts) : "null") + ")"); v.push_back(columns[4] + " = '" + Strings::Escape(e.ts) + "'");
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@@ -198,7 +198,7 @@ public:
v.push_back("'" + Strings::Escape(e.varname) + "'"); v.push_back("'" + Strings::Escape(e.varname) + "'");
v.push_back("'" + Strings::Escape(e.value) + "'"); v.push_back("'" + Strings::Escape(e.value) + "'");
v.push_back("'" + Strings::Escape(e.information) + "'"); v.push_back("'" + Strings::Escape(e.information) + "'");
v.push_back("FROM_UNIXTIME(" + (e.ts > 0 ? std::to_string(e.ts) : "null") + ")"); v.push_back("'" + Strings::Escape(e.ts) + "'");
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@@ -232,7 +232,7 @@ public:
v.push_back("'" + Strings::Escape(e.varname) + "'"); v.push_back("'" + Strings::Escape(e.varname) + "'");
v.push_back("'" + Strings::Escape(e.value) + "'"); v.push_back("'" + Strings::Escape(e.value) + "'");
v.push_back("'" + Strings::Escape(e.information) + "'"); v.push_back("'" + Strings::Escape(e.information) + "'");
v.push_back("FROM_UNIXTIME(" + (e.ts > 0 ? std::to_string(e.ts) : "null") + ")"); v.push_back("'" + Strings::Escape(e.ts) + "'");
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
} }
@@ -270,7 +270,7 @@ public:
e.varname = row[1] ? row[1] : ""; e.varname = row[1] ? row[1] : "";
e.value = row[2] ? row[2] : ""; e.value = row[2] ? row[2] : "";
e.information = row[3] ? row[3] : ""; e.information = row[3] ? row[3] : "";
e.ts = strtoll(row[4] ? row[4] : "-1", nullptr, 10); e.ts = row[4] ? row[4] : std::time(nullptr);
all_entries.push_back(e); all_entries.push_back(e);
} }
@@ -299,7 +299,7 @@ public:
e.varname = row[1] ? row[1] : ""; e.varname = row[1] ? row[1] : "";
e.value = row[2] ? row[2] : ""; e.value = row[2] ? row[2] : "";
e.information = row[3] ? row[3] : ""; e.information = row[3] ? row[3] : "";
e.ts = strtoll(row[4] ? row[4] : "-1", nullptr, 10); e.ts = row[4] ? row[4] : std::time(nullptr);
all_entries.push_back(e); all_entries.push_back(e);
} }
@@ -378,7 +378,7 @@ public:
v.push_back("'" + Strings::Escape(e.varname) + "'"); v.push_back("'" + Strings::Escape(e.varname) + "'");
v.push_back("'" + Strings::Escape(e.value) + "'"); v.push_back("'" + Strings::Escape(e.value) + "'");
v.push_back("'" + Strings::Escape(e.information) + "'"); v.push_back("'" + Strings::Escape(e.information) + "'");
v.push_back("FROM_UNIXTIME(" + (e.ts > 0 ? std::to_string(e.ts) : "null") + ")"); v.push_back("'" + Strings::Escape(e.ts) + "'");
auto results = db.QueryDatabase( auto results = db.QueryDatabase(
fmt::format( fmt::format(
@@ -405,7 +405,7 @@ public:
v.push_back("'" + Strings::Escape(e.varname) + "'"); v.push_back("'" + Strings::Escape(e.varname) + "'");
v.push_back("'" + Strings::Escape(e.value) + "'"); v.push_back("'" + Strings::Escape(e.value) + "'");
v.push_back("'" + Strings::Escape(e.information) + "'"); v.push_back("'" + Strings::Escape(e.information) + "'");
v.push_back("FROM_UNIXTIME(" + (e.ts > 0 ? std::to_string(e.ts) : "null") + ")"); v.push_back("'" + Strings::Escape(e.ts) + "'");
insert_chunks.push_back("(" + Strings::Implode(",", v) + ")"); insert_chunks.push_back("(" + Strings::Implode(",", v) + ")");
} }
@@ -59,24 +59,6 @@ public:
return NewEntity(); return NewEntity();
} }
// insert with ON DUPLICATE KEY UPDATE to leave rows that exist unchanged
static int InsertUpdateMany(Database& db, const std::vector<CharRecipeList>& entries)
{
std::vector<std::string> values;
values.reserve(entries.size());
for (const auto& e: entries)
{
values.emplace_back(fmt::format("({},{},{})", e.char_id, e.recipe_id, e.madecount));
}
auto results = db.QueryDatabase(fmt::format(
"INSERT INTO {0} (char_id, recipe_id, madecount) VALUES {1} ON DUPLICATE KEY UPDATE {2}={2}",
TableName(), fmt::join(values, ","), PrimaryKey()));
return results.Success() ? results.RowsAffected() : 0;
}
}; };
#endif //EQEMU_CHAR_RECIPE_LIST_REPOSITORY_H #endif //EQEMU_CHAR_RECIPE_LIST_REPOSITORY_H
@@ -213,23 +213,23 @@ public:
const glm::vec4& position const glm::vec4& position
) )
{ {
auto corpse = FindOne(db, corpse_id); auto results = db.QueryDatabase(
fmt::format(
"UPDATE `{}` SET `is_buried` = 0, `zone_id` = {}, `instance_id` = {}, `x` = {:.2f}, `y` = {:.2f}, `z` = {:.2f}, `heading` = {:.2f}, `time_of_death` = {}, `was_at_graveyard` = 0 WHERE `{}` = {}",
TableName(),
zone_id,
instance_id,
position.x,
position.y,
position.z,
position.w,
std::time(nullptr),
PrimaryKey(),
corpse_id
)
);
if (corpse.id == 0) { return results.Success() ? results.RowsAffected() : 0;
return 0;
}
corpse.is_buried = 0;
corpse.zone_id = zone_id;
corpse.instance_id = instance_id;
corpse.x = position.x;
corpse.y = position.y;
corpse.z = position.z;
corpse.heading = position.w;
corpse.time_of_death = time(nullptr);
corpse.was_at_graveyard = 0;
return UpdateOne(db, corpse);
} }
}; };
@@ -74,11 +74,9 @@ public:
}; };
} }
const auto& m = l.front();
return EXPModifier{ return EXPModifier{
.aa_modifier = m.aa_modifier, .aa_modifier = l[0].aa_modifier,
.exp_modifier = m.exp_modifier .exp_modifier = l[0].exp_modifier
}; };
} }
@@ -1,114 +0,0 @@
#ifndef EQEMU_CHARACTER_PARCELS_REPOSITORY_H
#define EQEMU_CHARACTER_PARCELS_REPOSITORY_H
#include "../database.h"
#include "../strings.h"
#include "base/base_character_parcels_repository.h"
class CharacterParcelsRepository: public BaseCharacterParcelsRepository {
public:
/**
* This file was auto generated and can be modified and extended upon
*
* Base repository methods are automatically
* generated in the "base" version of this repository. The base repository
* is immutable and to be left untouched, while methods in this class
* are used as extension methods for more specific persistence-layer
* accessors or mutators.
*
* Base Methods (Subject to be expanded upon in time)
*
* Note: Not all tables are designed appropriately to fit functionality with all base methods
*
* InsertOne
* UpdateOne
* DeleteOne
* FindOne
* GetWhere(std::string where_filter)
* DeleteWhere(std::string where_filter)
* InsertMany
* All
*
* Example custom methods in a repository
*
* ParcelsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* ParcelsRepository::GetWhereNeverExpires()
* ParcelsRepository::GetWhereXAndY()
* ParcelsRepository::DeleteWhereXAndY()
*
* Most of the above could be covered by base methods, but if you as a developer
* find yourself re-using logic for other parts of the code, its best to just make a
* method that can be re-used easily elsewhere especially if it can use a base repository
* method and encapsulate filters there
*/
// Custom extended repository methods here
struct ParcelCountAndCharacterName
{
std::string character_name;
uint32 char_id;
uint32 parcel_count;
};
static std::vector<ParcelCountAndCharacterName> GetParcelCountAndCharacterName(Database &db, const std::string &character_name)
{
std::vector<ParcelCountAndCharacterName> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"SELECT c.name, COUNT(p.id), c.id FROM character_data c "
"LEFT JOIN character_parcels p ON p.char_id = c.id "
"WHERE c.name = '{}' "
"LIMIT 1",
character_name)
);
all_entries.reserve(results.RowCount());
for(auto row = results.begin(); row != results.end(); ++row) {
ParcelCountAndCharacterName e {};
e.character_name = row[0] ? row[0] : "";
e.parcel_count = row[1] ? Strings::ToUnsignedInt(row[1]) : 0;
e.char_id = row[2] ? Strings::ToUnsignedInt(row[2]) : 0;
all_entries.push_back(e);
}
return all_entries;
}
static int GetNextFreeParcelSlot(Database& db, const uint32 character_id, const uint32 max_slots)
{
const auto& l = CharacterParcelsRepository::GetWhere(
db,
fmt::format(
"char_id = '{}' ORDER BY slot_id ASC",
character_id
)
);
if (l.empty()) {
return PARCEL_BEGIN_SLOT;
}
for (uint32 i = PARCEL_BEGIN_SLOT; i <= max_slots; i++) {
auto it = std::find_if(
l.cbegin(),
l.cend(),
[&](const auto &x) {
return x.slot_id == i;
}
);
if (it == l.end()) {
return i;
}
}
return INVALID_INDEX;
}
};
#endif //EQEMU_CHARACTER_PARCELS_REPOSITORY_H
@@ -70,7 +70,6 @@ public:
{.parent_command = "set", .sub_command = "alternate_currency", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "setaltcurrency"}, {.parent_command = "set", .sub_command = "alternate_currency", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "setaltcurrency"},
{.parent_command = "set", .sub_command = "animation", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "setanim"}, {.parent_command = "set", .sub_command = "animation", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "setanim"},
{.parent_command = "set", .sub_command = "anon", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "setanon"}, {.parent_command = "set", .sub_command = "anon", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "setanon"},
{.parent_command = "set", .sub_command = "auto_login", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "setautologin"},
{.parent_command = "set", .sub_command = "bind", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "bind"}, {.parent_command = "set", .sub_command = "bind", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "bind"},
{.parent_command = "set", .sub_command = "checksum", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "updatechecksum"}, {.parent_command = "set", .sub_command = "checksum", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "updatechecksum"},
{.parent_command = "set", .sub_command = "class_permanent", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "permaclass"}, {.parent_command = "set", .sub_command = "class_permanent", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "permaclass"},
@@ -123,7 +122,6 @@ public:
{.parent_command = "set", .sub_command = "zone", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "zclip|zcolor|zheader|zonelock|zsafecoords|zsky|zunderworld"}, {.parent_command = "set", .sub_command = "zone", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "zclip|zcolor|zheader|zonelock|zsafecoords|zsky|zunderworld"},
{.parent_command = "show", .sub_command = "aas", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "showaas"}, {.parent_command = "show", .sub_command = "aas", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "showaas"},
{.parent_command = "show", .sub_command = "aa_points", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "showaapoints|showaapts"}, {.parent_command = "show", .sub_command = "aa_points", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "showaapoints|showaapts"},
{.parent_command = "show", .sub_command = "auto_login", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "showautologin"},
{.parent_command = "show", .sub_command = "aggro", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "aggro"}, {.parent_command = "show", .sub_command = "aggro", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "aggro"},
{.parent_command = "show", .sub_command = "buffs", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "showbuffs"}, {.parent_command = "show", .sub_command = "buffs", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "showbuffs"},
{.parent_command = "show", .sub_command = "buried_corpse_count", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "getplayerburiedcorpsecount"}, {.parent_command = "show", .sub_command = "buried_corpse_count", .access_level = AccountStatus::QuestTroupe, .top_level_aliases = "getplayerburiedcorpsecount"},
+1 -9
View File
@@ -44,15 +44,7 @@ public:
*/ */
// Custom extended repository methods here // Custom extended repository methods here
static void ClearAllGroups(Database& db)
{
db.QueryDatabase(
fmt::format(
"DELETE FROM `{}`",
TableName()
)
);
}
}; };
#endif //EQEMU_GROUP_ID_REPOSITORY_H #endif //EQEMU_GROUP_ID_REPOSITORY_H
+1 -22
View File
@@ -7,6 +7,7 @@
class GroupLeadersRepository: public BaseGroupLeadersRepository { class GroupLeadersRepository: public BaseGroupLeadersRepository {
public: public:
/** /**
* This file was auto generated and can be modified and extended upon * This file was auto generated and can be modified and extended upon
* *
@@ -43,29 +44,7 @@ public:
*/ */
// Custom extended repository methods here // Custom extended repository methods here
static void ClearAllGroupLeaders(Database& db)
{
db.QueryDatabase(
fmt::format(
"DELETE FROM `{}`",
TableName()
)
);
}
static int UpdateLeadershipAA(Database &db, std::string &aa, uint32 group_id)
{
const auto group_leader = GetWhere(db, fmt::format("gid = '{}' LIMIT 1", group_id));
if(group_leader.empty()) {
return 0;
}
db.Encode(aa);
auto m = group_leader[0];
m.leadershipaa = aa;
return UpdateOne(db, m);
}
}; };
#endif //EQEMU_GROUP_LEADERS_REPOSITORY_H #endif //EQEMU_GROUP_LEADERS_REPOSITORY_H
@@ -191,5 +191,4 @@ public:
return UpdateOne(db, m); return UpdateOne(db, m);
} }
}; };
#endif //EQEMU_GUILD_MEMBERS_REPOSITORY_H #endif //EQEMU_GUILD_MEMBERS_REPOSITORY_H
@@ -45,31 +45,6 @@ public:
// Custom extended repository methods here // Custom extended repository methods here
static std::map<std::string, GuildPermissions> LoadAll(Database &db)
{
std::map<std::string, GuildPermissions> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE `guild_id` < {}",
BaseSelect(),
RoF2::constants::MAX_GUILD_ID
));
for (auto row = results.begin(); row != results.end(); ++row) {
GuildPermissions e{};
e.id = static_cast<int32_t>(atoi(row[0]));
e.perm_id = static_cast<int32_t>(atoi(row[1]));
e.guild_id = static_cast<int32_t>(atoi(row[2]));
e.permission = static_cast<int32_t>(atoi(row[3]));
auto key = fmt::format("{}-{}", e.guild_id, e.perm_id);
all_entries.emplace(key, e);
}
return all_entries;
}
}; };
#endif //EQEMU_GUILD_PERMISSIONS_REPOSITORY_H #endif //EQEMU_GUILD_PERMISSIONS_REPOSITORY_H
@@ -60,30 +60,6 @@ public:
return 1; return 1;
} }
static std::map<std::string, std::string> LoadAll(Database &db)
{
std::map<std::string, std::string> all_entries;
auto results = db.QueryDatabase(fmt::format(
"{} WHERE `guild_id` < {}",
BaseSelect(),
RoF2::constants::MAX_GUILD_ID)
);
for (auto row = results.begin(); row != results.end(); ++row) {
GuildRanks e{};
e.guild_id = row[0] ? static_cast<uint32_t>(strtoul(row[0], nullptr, 10)) : 0;
e.rank_ = row[1] ? static_cast<uint8_t>(strtoul(row[1], nullptr, 10)) : 0;
e.title = row[2] ? row[2] : "";
auto key = fmt::format("{}-{}", e.guild_id, e.rank_);
all_entries.emplace(key, e.title);
}
return all_entries;
}
}; };
#endif //EQEMU_GUILD_RANKS_REPOSITORY_H #endif //EQEMU_GUILD_RANKS_REPOSITORY_H
@@ -44,30 +44,7 @@ public:
*/ */
// Custom extended repository methods here // Custom extended repository methods here
static int64 CountInventorySnapshots(Database& db)
{
const std::string& query = "SELECT COUNT(*) FROM (SELECT * FROM `inventory_snapshots` a GROUP BY `charid`, `time_index`) b";
auto results = db.QueryDatabase(query);
if (!results.Success() || !results.RowCount()) {
return -1;
}
auto row = results.begin();
const int64 count = Strings::ToBigInt(row[0]);
if (count > std::numeric_limits<int>::max()) {
return -2;
}
if (count < 0) {
return -3;
}
return count;
}
}; };
#endif //EQEMU_INVENTORY_SNAPSHOTS_REPOSITORY_H #endif //EQEMU_INVENTORY_SNAPSHOTS_REPOSITORY_H
@@ -66,16 +66,6 @@ public:
return results.Success() ? results.RowsAffected() : 0; return results.Success() ? results.RowsAffected() : 0;
} }
static void ClearAllRaidDetails(Database& db)
{
db.QueryDatabase(
fmt::format(
"DELETE FROM `{}`",
TableName()
)
);
}
}; };
#endif //EQEMU_RAID_DETAILS_REPOSITORY_H #endif //EQEMU_RAID_DETAILS_REPOSITORY_H
@@ -0,0 +1,297 @@
#ifndef EQEMU_RAID_LEADERS_REPOSITORY_H
#define EQEMU_RAID_LEADERS_REPOSITORY_H
#include "../database.h"
#include "../strings.h"
class RaidLeadersRepository {
public:
struct RaidLeaders {
int gid;
int rid;
std::string marknpc;
std::string maintank;
std::string assist;
std::string puller;
std::string leadershipaa;
std::string mentoree;
int mentor_percent;
};
static std::string PrimaryKey()
{
return std::string("");
}
static std::vector<std::string> Columns()
{
return {
"gid",
"rid",
"marknpc",
"maintank",
"assist",
"puller",
"leadershipaa",
"mentoree",
"mentor_percent",
};
}
static std::string ColumnsRaw()
{
return std::string(Strings::Implode(", ", Columns()));
}
static std::string InsertColumnsRaw()
{
std::vector<std::string> insert_columns;
for (auto &column : Columns()) {
if (column == PrimaryKey()) {
continue;
}
insert_columns.push_back(column);
}
return std::string(Strings::Implode(", ", insert_columns));
}
static std::string TableName()
{
return std::string("raid_leaders");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
InsertColumnsRaw()
);
}
static RaidLeaders NewEntity()
{
RaidLeaders entry{};
entry.gid = 0;
entry.rid = 0;
entry.marknpc = "";
entry.maintank = "";
entry.assist = "";
entry.puller = "";
entry.leadershipaa = 0;
entry.mentoree = "";
entry.mentor_percent = 0;
return entry;
}
static RaidLeaders GetRaidLeadersEntry(
const std::vector<RaidLeaders> &raid_leaderss,
int raid_leaders_id
)
{
for (auto &raid_leaders : raid_leaderss) {
if (raid_leaders. == raid_leaders_id) {
return raid_leaders;
}
}
return NewEntity();
}
static RaidLeaders FindOne(
int raid_leaders_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
raid_leaders_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
RaidLeaders entry{};
entry.gid = atoi(row[0]);
entry.rid = atoi(row[1]);
entry.marknpc = row[2];
entry.maintank = row[3];
entry.assist = row[4];
entry.puller = row[5];
entry.leadershipaa = row[6];
entry.mentoree = row[7];
entry.mentor_percent = atoi(row[8]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
int raid_leaders_id
)
{
auto results = database.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
raid_leaders_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
RaidLeaders raid_leaders_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(raid_leaders_entry.gid));
update_values.push_back(columns[1] + " = " + std::to_string(raid_leaders_entry.rid));
update_values.push_back(columns[2] + " = '" + Strings::Escape(raid_leaders_entry.marknpc) + "'");
update_values.push_back(columns[3] + " = '" + Strings::Escape(raid_leaders_entry.maintank) + "'");
update_values.push_back(columns[4] + " = '" + Strings::Escape(raid_leaders_entry.assist) + "'");
update_values.push_back(columns[5] + " = '" + Strings::Escape(raid_leaders_entry.puller) + "'");
update_values.push_back(columns[6] + " = '" + Strings::Escape(raid_leaders_entry.leadershipaa) + "'");
update_values.push_back(columns[7] + " = '" + Strings::Escape(raid_leaders_entry.mentoree) + "'");
update_values.push_back(columns[8] + " = " + std::to_string(raid_leaders_entry.mentor_percent));
auto results = database.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
Strings::Implode(", ", update_values),
PrimaryKey(),
raid_leaders_entry.
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static RaidLeaders InsertOne(
RaidLeaders raid_leaders_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(raid_leaders_entry.gid));
insert_values.push_back(std::to_string(raid_leaders_entry.rid));
insert_values.push_back("'" + Strings::Escape(raid_leaders_entry.marknpc) + "'");
insert_values.push_back("'" + Strings::Escape(raid_leaders_entry.maintank) + "'");
insert_values.push_back("'" + Strings::Escape(raid_leaders_entry.assist) + "'");
insert_values.push_back("'" + Strings::Escape(raid_leaders_entry.puller) + "'");
insert_values.push_back("'" + Strings::Escape(raid_leaders_entry.leadershipaa) + "'");
insert_values.push_back("'" + Strings::Escape(raid_leaders_entry.mentoree) + "'");
insert_values.push_back(std::to_string(raid_leaders_entry.mentor_percent));
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
Strings::Implode(",", insert_values)
)
);
if (results.Success()) {
raid_leaders_entry.id = results.LastInsertedID();
return raid_leaders_entry;
}
raid_leaders_entry = InstanceListRepository::NewEntity();
return raid_leaders_entry;
}
static int InsertMany(
std::vector<RaidLeaders> raid_leaders_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &raid_leaders_entry: raid_leaders_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(raid_leaders_entry.gid));
insert_values.push_back(std::to_string(raid_leaders_entry.rid));
insert_values.push_back("'" + Strings::Escape(raid_leaders_entry.marknpc) + "'");
insert_values.push_back("'" + Strings::Escape(raid_leaders_entry.maintank) + "'");
insert_values.push_back("'" + Strings::Escape(raid_leaders_entry.assist) + "'");
insert_values.push_back("'" + Strings::Escape(raid_leaders_entry.puller) + "'");
insert_values.push_back("'" + Strings::Escape(raid_leaders_entry.leadershipaa) + "'");
insert_values.push_back("'" + Strings::Escape(raid_leaders_entry.mentoree) + "'");
insert_values.push_back(std::to_string(raid_leaders_entry.mentor_percent));
insert_chunks.push_back("(" + Strings::Implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = database.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
Strings::Implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<RaidLeaders> All()
{
std::vector<RaidLeaders> all_entries;
auto results = database.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
RaidLeaders entry{};
entry.gid = atoi(row[0]);
entry.rid = atoi(row[1]);
entry.marknpc = row[2];
entry.maintank = row[3];
entry.assist = row[4];
entry.puller = row[5];
entry.leadershipaa = row[6];
entry.mentoree = row[7];
entry.mentor_percent = atoi(row[8]);
all_entries.push_back(entry);
}
return all_entries;
}
};
#endif //EQEMU_RAID_LEADERS_REPOSITORY_H
@@ -98,15 +98,5 @@ public:
return results.Success() ? results.RowsAffected() : 0; return results.Success() ? results.RowsAffected() : 0;
} }
static void ClearAllRaids(Database& db)
{
db.QueryDatabase(
fmt::format(
"DELETE FROM `{}`",
TableName()
)
);
}
}; };
#endif //EQEMU_RAID_MEMBERS_REPOSITORY_H #endif //EQEMU_RAID_MEMBERS_REPOSITORY_H
+5 -35
View File
@@ -34,8 +34,8 @@ const char *RuleManager::s_categoryNames[_CatCount + 1] = {
"InvalidCategory" "InvalidCategory"
}; };
const RuleManager::RuleInfo RuleManager::s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount + StringRuleCount + 1] = { const RuleManager::RuleInfo RuleManager::s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount + 1] = {
/* this is done in three steps, so we can reliably get to them by index*/ /* this is done in three steps so we can reliably get to them by index*/
#define RULE_INT(category_name, rule_name, default_value, notes) \ #define RULE_INT(category_name, rule_name, default_value, notes) \
{ #category_name ":" #rule_name, Category__##category_name, IntRule, Int__##rule_name, notes }, { #category_name ":" #rule_name, Category__##category_name, IntRule, Int__##rule_name, notes },
#include "ruletypes.h" #include "ruletypes.h"
@@ -45,9 +45,6 @@ const RuleManager::RuleInfo RuleManager::s_RuleInfo[IntRuleCount + RealRuleCount
#define RULE_BOOL(category_name, rule_name, default_value, notes) \ #define RULE_BOOL(category_name, rule_name, default_value, notes) \
{ #category_name ":" #rule_name, Category__##category_name, BoolRule, Bool__##rule_name, notes }, { #category_name ":" #rule_name, Category__##category_name, BoolRule, Bool__##rule_name, notes },
#include "ruletypes.h" #include "ruletypes.h"
#define RULE_STRING(category_name, rule_name, default_value, notes) \
{ #category_name ":" #rule_name, Category__##category_name, StringRule, String__##rule_name, notes },
#include "ruletypes.h"
{ "Invalid Rule", _CatCount, IntRule } { "Invalid Rule", _CatCount, IntRule }
}; };
@@ -117,9 +114,6 @@ bool RuleManager::GetRule(const std::string &rule_name, std::string &rule_value)
case BoolRule: case BoolRule:
rule_value = m_RuleBoolValues[index] ? "true" : "false"; rule_value = m_RuleBoolValues[index] ? "true" : "false";
break; break;
case StringRule:
rule_value = m_RuleStringValues[index];
break;
} }
return true; return true;
@@ -158,10 +152,6 @@ bool RuleManager::SetRule(const std::string &rule_name, const std::string &rule_
m_RuleBoolValues[index] = static_cast<uint32>(Strings::ToBool(rule_value)); m_RuleBoolValues[index] = static_cast<uint32>(Strings::ToBool(rule_value));
LogRules("Set rule [{}] to value [{}]", rule_name, m_RuleBoolValues[index] == 1 ? "true" : "false"); LogRules("Set rule [{}] to value [{}]", rule_name, m_RuleBoolValues[index] == 1 ? "true" : "false");
break; break;
case StringRule:
m_RuleStringValues[index] = rule_value;
LogRules("Set rule [{}] to value [{}]", rule_name, rule_value);
break;
} }
if (db_save) { if (db_save) {
@@ -225,13 +215,11 @@ std::string RuleManager::_GetRuleName(RuleType type, uint16 index) {
return s_RuleInfo[index + IntRuleCount].name; return s_RuleInfo[index + IntRuleCount].name;
case BoolRule: case BoolRule:
return s_RuleInfo[index + IntRuleCount + RealRuleCount].name; return s_RuleInfo[index + IntRuleCount + RealRuleCount].name;
case StringRule:
return s_RuleInfo[index + IntRuleCount + RealRuleCount + StringRuleCount].name;
default: default:
break; break;
} }
return s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount + StringRuleCount].name; return s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount].name;
} }
//assumes index is valid! //assumes index is valid!
@@ -243,13 +231,11 @@ const std::string &RuleManager::_GetRuleNotes(RuleType type, uint16 index) {
return s_RuleInfo[index + IntRuleCount].notes; return s_RuleInfo[index + IntRuleCount].notes;
case BoolRule: case BoolRule:
return s_RuleInfo[index + IntRuleCount + RealRuleCount].notes; return s_RuleInfo[index + IntRuleCount + RealRuleCount].notes;
case StringRule:
return s_RuleInfo[index + IntRuleCount + RealRuleCount + StringRuleCount].notes;
default: default:
break; break;
} }
return s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount + StringRuleCount].notes; return s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount].notes;
} }
bool RuleManager::LoadRules(Database *db, const std::string &rule_set_name, bool reload) { bool RuleManager::LoadRules(Database *db, const std::string &rule_set_name, bool reload) {
@@ -357,10 +343,6 @@ void RuleManager::SaveRules(Database *db, const std::string &rule_set_name) {
for (i = 0; i < BoolRuleCount; i++) { for (i = 0; i < BoolRuleCount; i++) {
_SaveRule(db, BoolRule, i); _SaveRule(db, BoolRule, i);
} }
for (i = 0; i < StringRuleCount; i++) {
_SaveRule(db, StringRule, i);
}
} }
void RuleManager::_SaveRule(Database *db, RuleType type, uint16 index) { void RuleManager::_SaveRule(Database *db, RuleType type, uint16 index) {
@@ -385,9 +367,6 @@ void RuleManager::_SaveRule(Database *db, RuleType type, uint16 index) {
case BoolRule: case BoolRule:
rule_value = m_RuleBoolValues[index] ? "true" : "false"; rule_value = m_RuleBoolValues[index] ? "true" : "false";
break; break;
case StringRule:
rule_value = m_RuleStringValues[index];
break;
} }
const auto& rule_notes = _GetRuleNotes(type, index); const auto& rule_notes = _GetRuleNotes(type, index);
@@ -467,10 +446,6 @@ bool RuleManager::UpdateInjectedRules(Database *db, const std::string &rule_set_
rule_data[r.name].first = fmt::format("{}", m_RuleBoolValues[r.rule_index] ? "true" : "false"); rule_data[r.name].first = fmt::format("{}", m_RuleBoolValues[r.rule_index] ? "true" : "false");
rule_data[r.name].second = &r.notes; rule_data[r.name].second = &r.notes;
break; break;
case StringRule:
rule_data[r.name].first = m_RuleStringValues[r.rule_index];
rule_data[r.name].second = &r.notes;
break;
default: default:
break; break;
} }
@@ -577,7 +552,7 @@ bool RuleManager::RestoreRuleNotes(Database *db)
} }
} }
return s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount + StringRuleCount]; return s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount];
}(e.rule_name); }(e.rule_name);
if (Strings::Contains(rule.name, e.rule_name)) { if (Strings::Contains(rule.name, e.rule_name)) {
@@ -642,8 +617,3 @@ bool RuleManager::GetBoolRule(RuleManager::BoolType t) const
{ {
return m_RuleBoolValues[t] == 1; return m_RuleBoolValues[t] == 1;
} }
std::string RuleManager::GetStringRule(RuleManager::StringType t) const
{
return m_RuleStringValues[t];
}
+25 -45
View File
@@ -23,7 +23,6 @@
* - RuleI(category, rule) -> fetch an integer rule's value * - RuleI(category, rule) -> fetch an integer rule's value
* - RuleR(category, rule) -> fetch a real (float) rule's value * - RuleR(category, rule) -> fetch a real (float) rule's value
* - RuleB(category, rule) -> fetch a boolean/flag rule's value * - RuleB(category, rule) -> fetch a boolean/flag rule's value
* - RuleS(category, rule) -> fetch a string rule's value
* *
*/ */
@@ -36,8 +35,6 @@
RuleManager::Instance()->GetRealRule( RuleManager::Real__##rule_name ) RuleManager::Instance()->GetRealRule( RuleManager::Real__##rule_name )
#define RuleB(category_name, rule_name) \ #define RuleB(category_name, rule_name) \
RuleManager::Instance()->GetBoolRule( RuleManager::Bool__##rule_name ) RuleManager::Instance()->GetBoolRule( RuleManager::Bool__##rule_name )
#define RuleS(category_name, rule_name) \
RuleManager::Instance()->GetStringRule( RuleManager::String__##rule_name )
#include <vector> #include <vector>
@@ -84,17 +81,6 @@ public:
static const int BoolRuleCount = static_cast<int>(_BoolRuleCount); static const int BoolRuleCount = static_cast<int>(_BoolRuleCount);
typedef enum {
#define RULE_STRING(category_name, rule_name, default_value, notes) \
String__##rule_name,
#include "ruletypes.h"
_StringRuleCount
} StringType;
static const int StringRuleCount = static_cast<int>(_StringRuleCount);
typedef enum { typedef enum {
#define RULE_CATEGORY(category_name) \ #define RULE_CATEGORY(category_name) \
Category__##category_name, Category__##category_name,
@@ -113,49 +99,45 @@ public:
static const IntType InvalidInt = _IntRuleCount; static const IntType InvalidInt = _IntRuleCount;
static const RealType InvalidReal = _RealRuleCount; static const RealType InvalidReal = _RealRuleCount;
static const BoolType InvalidBool = _BoolRuleCount; static const BoolType InvalidBool = _BoolRuleCount;
static const StringType InvalidString = _StringRuleCount;
static const CategoryType InvalidCategory = _CatCount; static const CategoryType InvalidCategory = _CatCount;
static const uint32 RulesCount = IntRuleCount + RealRuleCount + BoolRuleCount + StringRuleCount; static const uint32 RulesCount = IntRuleCount + RealRuleCount + BoolRuleCount;
//fetch routines, you should generally use the Rule* macros instead of this //fetch routines, you should generally use the Rule* macros instead of this
int GetIntRule(IntType t) const; int GetIntRule(IntType t) const;
float GetRealRule(RealType t) const; float GetRealRule(RealType t) const;
bool GetBoolRule(BoolType t) const; bool GetBoolRule(BoolType t) const;
std::string GetStringRule(StringType t) const;
//management routines //management routines
static std::string GetRuleName(IntType t) { return s_RuleInfo[static_cast<int>(t)].name; } static std::string GetRuleName(IntType t) { return s_RuleInfo[static_cast<int>(t)].name; }
static std::string GetRuleName(RealType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount].name; } static std::string GetRuleName(RealType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount].name; }
static std::string GetRuleName(BoolType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount + RealRuleCount].name; } static std::string GetRuleName(BoolType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount + RealRuleCount].name; }
static std::string GetRuleName(StringType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount + RealRuleCount + StringRuleCount].name; } static const std::string &GetRuleNotes(IntType t) { return s_RuleInfo[static_cast<int>(t)].notes; }
static const std::string& GetRuleNotes(IntType t) { return s_RuleInfo[static_cast<int>(t)].notes; } static const std::string &GetRuleNotes(RealType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount].notes; }
static const std::string& GetRuleNotes(RealType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount].notes; } static const std::string &GetRuleNotes(BoolType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount + RealRuleCount].notes; }
static const std::string& GetRuleNotes(BoolType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount + RealRuleCount].notes; }
static const std::string& GetRuleNotes(StringType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount + RealRuleCount + StringRuleCount].notes; }
static uint32 CountRules() { return RulesCount; } static uint32 CountRules() { return RulesCount; }
static CategoryType FindCategory(const std::string& category_name); static CategoryType FindCategory(const std::string &category_name);
bool ListRules(const std::string& category_name, std::vector<std::string>& l); bool ListRules(const std::string &category_name, std::vector <std::string> &l);
bool ListCategories(std::vector<std::string>& l); bool ListCategories(std::vector <std::string> &l);
bool GetRule(const std::string& rule_name, std::string& rule_value); bool GetRule(const std::string &rule_name, std::string &rule_value);
bool SetRule( bool SetRule(
const std::string& rule_name, const std::string &rule_name,
const std::string& rule_value, const std::string &rule_value,
Database* db = nullptr, Database *db = nullptr,
bool db_save = false, bool db_save = false,
bool reload = false bool reload = false
); );
int GetActiveRulesetID() const { return m_activeRuleset; } int GetActiveRulesetID() const { return m_activeRuleset; }
std::string GetActiveRuleset() const { return m_activeName; } std::string GetActiveRuleset() const { return m_activeName; }
static bool ListRulesets(Database* db, std::map<int, std::string>& l); static bool ListRulesets(Database *db, std::map<int, std::string> &l);
void ResetRules(bool reload = false); void ResetRules(bool reload = false);
bool LoadRules(Database* db, const std::string& rule_set_name, bool reload = false); bool LoadRules(Database *db, const std::string &rule_set_name, bool reload = false);
void SaveRules(Database* db, const std::string& rule_set_name); void SaveRules(Database *db, const std::string &rule_set_name);
bool UpdateInjectedRules(Database* db, const std::string& rule_set_name, bool quiet_update = false); bool UpdateInjectedRules(Database *db, const std::string &rule_set_name, bool quiet_update = false);
bool UpdateOrphanedRules(Database* db, bool quiet_update = false); bool UpdateOrphanedRules(Database *db, bool quiet_update = false);
bool RestoreRuleNotes(Database* db); bool RestoreRuleNotes(Database *db);
private: private:
RuleManager(); RuleManager();
@@ -165,23 +147,21 @@ private:
int m_activeRuleset; int m_activeRuleset;
std::string m_activeName; std::string m_activeName;
int m_RuleIntValues[IntRuleCount]; int m_RuleIntValues[IntRuleCount];
float m_RuleRealValues[RealRuleCount]; float m_RuleRealValues[RealRuleCount];
uint32 m_RuleBoolValues[BoolRuleCount]; uint32 m_RuleBoolValues[BoolRuleCount];
std::string m_RuleStringValues[StringRuleCount];
typedef enum { typedef enum {
IntRule, IntRule,
RealRule, RealRule,
BoolRule, BoolRule
StringRule
} RuleType; } RuleType;
static bool _FindRule(const std::string& rule_name, RuleType& type_into, uint16& index_into); static bool _FindRule(const std::string &rule_name, RuleType &type_into, uint16 &index_into);
static std::string _GetRuleName(RuleType type, uint16 index); static std::string _GetRuleName(RuleType type, uint16 index);
static const std::string& _GetRuleNotes(RuleType type, uint16 index); static const std::string &_GetRuleNotes(RuleType type, uint16 index);
static int _FindOrCreateRuleset(Database* db, const std::string& rule_set_name); static int _FindOrCreateRuleset(Database *db, const std::string &rule_set_name);
void _SaveRule(Database* db, RuleType type, uint16 index); void _SaveRule(Database *db, RuleType type, uint16 index);
static const char* s_categoryNames[]; static const char* s_categoryNames[];
typedef struct { typedef struct {
+4 -31
View File
@@ -28,9 +28,6 @@
#ifndef RULE_BOOL #ifndef RULE_BOOL
#define RULE_BOOL(cat, rule, default_value, notes) #define RULE_BOOL(cat, rule, default_value, notes)
#endif #endif
#ifndef RULE_STRING
#define RULE_STRING(cat, rule, default_value, notes)
#endif
#ifndef RULE_CATEGORY_END #ifndef RULE_CATEGORY_END
#define RULE_CATEGORY_END() #define RULE_CATEGORY_END()
#endif #endif
@@ -51,10 +48,10 @@ RULE_BOOL(Character, DeathKeepLevel, false, "Players can not drop below 0% exper
RULE_BOOL(Character, UseDeathExpLossMult, false, "Setting to control whether DeathExpLossMultiplier or the code default is used: (Level x Level / 18.0) x 12000") RULE_BOOL(Character, UseDeathExpLossMult, false, "Setting to control whether DeathExpLossMultiplier or the code default is used: (Level x Level / 18.0) x 12000")
RULE_BOOL(Character, UseOldRaceRezEffects, false, "Older clients had ID 757 for races with high starting STR, but it doesn't seem used anymore") RULE_BOOL(Character, UseOldRaceRezEffects, false, "Older clients had ID 757 for races with high starting STR, but it doesn't seem used anymore")
RULE_INT(Character, CorpseDecayTime, 604800000, "Time after which the corpse decays (milliseconds) DEFAULT: 604800000 (7 Days)") RULE_INT(Character, CorpseDecayTime, 604800000, "Time after which the corpse decays (milliseconds) DEFAULT: 604800000 (7 Days)")
RULE_INT(Character, EmptyCorpseDecayTime, 10800000, "Time after which an empty corpse decays (milliseconds) DEFAULT: 10800000 (3 Hours)") RULE_INT( Character, EmptyCorpseDecayTime, 10800000, "Time after which an empty corpse decays (milliseconds) DEFAULT: 10800000 (3 Hours)")
RULE_INT(Character, CorpseResTime, 10800000, "Time after which the corpse can no longer be resurrected (milliseconds) DEFAULT: 10800000 (3 Hours)") RULE_INT(Character, CorpseResTime, 10800000, "Time after which the corpse can no longer be resurrected (milliseconds) DEFAULT: 10800000 (3 Hours)")
RULE_INT(Character, DuelCorpseResTime, 600000, "Time before cant res corpse after a duel (milliseconds) DEFAULT: 600000 (10 Minutes)") RULE_INT( Character, DuelCorpseResTime, 600000, "Time before cant res corpse after a duel (milliseconds) DEFAULT: 600000 (10 Minutes)")
RULE_INT(Character, CorpseOwnerOnlineTime, 30000, "How often corpse will check if its owner is online DEFAULT: 30000 (30 Seconds)") RULE_INT( Character, CorpseOwnerOnlineTime, 30000, "How often corpse will check if its owner is online DEFAULT: 30000 (30 Seconds)")
RULE_BOOL(Character, LeaveCorpses, true, "Setting whether you leave a corpse behind") RULE_BOOL(Character, LeaveCorpses, true, "Setting whether you leave a corpse behind")
RULE_BOOL(Character, LeaveNakedCorpses, false, "Setting whether you leave a corpse without items") RULE_BOOL(Character, LeaveNakedCorpses, false, "Setting whether you leave a corpse without items")
RULE_INT(Character, MaxDraggedCorpses, 2, "Maximum number of corpses you can drag at once") RULE_INT(Character, MaxDraggedCorpses, 2, "Maximum number of corpses you can drag at once")
@@ -327,10 +324,6 @@ RULE_INT(World, MaximumQuestErrors, 30, "Changes the maximum number of quest err
RULE_INT(World, BootHour, 0, "Sets the in-game hour world will set when it first boots. 0-24 are valid options, where 0 disables this rule") RULE_INT(World, BootHour, 0, "Sets the in-game hour world will set when it first boots. 0-24 are valid options, where 0 disables this rule")
RULE_BOOL(World, UseItemLinksForKeyRing, false, "Uses item links for Key Ring Listing instead of item name") RULE_BOOL(World, UseItemLinksForKeyRing, false, "Uses item links for Key Ring Listing instead of item name")
RULE_BOOL(World, UseOldShadowKnightClassExport, true, "Disable to have Shadowknight show as Shadow Knight (live-like)") RULE_BOOL(World, UseOldShadowKnightClassExport, true, "Disable to have Shadowknight show as Shadow Knight (live-like)")
RULE_STRING(World, IPExemptionZones, "", "Comma-delimited list of zones to exclude from IP-limit checks. Empty string to disable.")
RULE_STRING(World, MOTD, "", "Server MOTD sent on login, change from empty to have this be used instead of variables table 'motd' value")
RULE_STRING(World, Rules, "", "Server Rules, change from empty to have this be used instead of variables table 'rules' value, lines are pipe (|) separated, example: A|B|C")
RULE_BOOL(World, EnableAutoLogin, false, "Enables or disables auto login of characters, allowing people to log characters in directly from loginserver to ingame")
RULE_CATEGORY_END() RULE_CATEGORY_END()
RULE_CATEGORY(Zone) RULE_CATEGORY(Zone)
@@ -356,7 +349,6 @@ RULE_INT(Zone, GlobalLootMultiplier, 1, "Sets Global Loot drop multiplier for da
RULE_BOOL(Zone, KillProcessOnDynamicShutdown, true, "When process has booted a zone and has hit its zone shut down timer, it will hard kill the process to free memory back to the OS") RULE_BOOL(Zone, KillProcessOnDynamicShutdown, true, "When process has booted a zone and has hit its zone shut down timer, it will hard kill the process to free memory back to the OS")
RULE_INT(Zone, SpawnEventMin, 3, "When strict is set in spawn_events, specifies the max EQ minutes into the trigger hour a spawn_event will fire. Going below 3 may cause the spawn_event to not fire.") RULE_INT(Zone, SpawnEventMin, 3, "When strict is set in spawn_events, specifies the max EQ minutes into the trigger hour a spawn_event will fire. Going below 3 may cause the spawn_event to not fire.")
RULE_INT(Zone, ForageChance, 25, "Chance of foraging from zone table vs global table") RULE_INT(Zone, ForageChance, 25, "Chance of foraging from zone table vs global table")
RULE_INT(Zone, FishingChance, 399, "Chance of fishing from zone table vs global table")
RULE_BOOL(Zone, AllowCrossZoneSpellsOnBots, false, "Set to true to allow cross zone spells (cast/remove) to affect bots") RULE_BOOL(Zone, AllowCrossZoneSpellsOnBots, false, "Set to true to allow cross zone spells (cast/remove) to affect bots")
RULE_BOOL(Zone, AllowCrossZoneSpellsOnMercs, false, "Set to true to allow cross zone spells (cast/remove) to affect mercenaries") RULE_BOOL(Zone, AllowCrossZoneSpellsOnMercs, false, "Set to true to allow cross zone spells (cast/remove) to affect mercenaries")
RULE_BOOL(Zone, AllowCrossZoneSpellsOnPets, false, "Set to true to allow cross zone spells (cast/remove) to affect pets") RULE_BOOL(Zone, AllowCrossZoneSpellsOnPets, false, "Set to true to allow cross zone spells (cast/remove) to affect pets")
@@ -452,8 +444,7 @@ RULE_BOOL(Spells, Jun182014HundredHandsRevamp, false, "This should be true for i
RULE_BOOL(Spells, SwarmPetTargetLock, false, "Use old method of swarm pets target locking till target dies then despawning") RULE_BOOL(Spells, SwarmPetTargetLock, false, "Use old method of swarm pets target locking till target dies then despawning")
RULE_BOOL(Spells, NPC_UseFocusFromSpells, true, "Allow NPC to use most spell derived focus effects") RULE_BOOL(Spells, NPC_UseFocusFromSpells, true, "Allow NPC to use most spell derived focus effects")
RULE_BOOL(Spells, NPC_UseFocusFromItems, false, "Allow NPC to use most item derived focus effects") RULE_BOOL(Spells, NPC_UseFocusFromItems, false, "Allow NPC to use most item derived focus effects")
RULE_BOOL(Spells, UseAdditiveFocusFromWornSlot, false, "Allows an additive focus effect to be calculated from worn slot. Does not apply limits checks. Can only have one additive focus rule be true.") RULE_BOOL(Spells, UseAdditiveFocusFromWornSlot, false, "Allows an additive focus effect to be calculated from worn slot")
RULE_BOOL(Spells, UseAdditiveFocusFromWornSlotWithLimits, false, "Allows an additive focus effect to be calculated from worn slot. Applies normal limit checks. Can only have one additive focus rule be true.")
RULE_BOOL(Spells, AlwaysSendTargetsBuffs, false, "Ignore Leadership Alternate Abilities level if true") RULE_BOOL(Spells, AlwaysSendTargetsBuffs, false, "Ignore Leadership Alternate Abilities level if true")
RULE_BOOL(Spells, FlatItemExtraSpellAmt, false, "Allow SpellDmg stat to affect all spells, regardless of cast time/cooldown/etc") RULE_BOOL(Spells, FlatItemExtraSpellAmt, false, "Allow SpellDmg stat to affect all spells, regardless of cast time/cooldown/etc")
RULE_BOOL(Spells, IgnoreSpellDmgLvlRestriction, false, "Ignore the 5 level spread on applying SpellDmg") RULE_BOOL(Spells, IgnoreSpellDmgLvlRestriction, false, "Ignore the 5 level spread on applying SpellDmg")
@@ -511,8 +502,6 @@ RULE_CATEGORY(Combat)
RULE_REAL(Combat, AERampageMaxDistance, 70, "Max AERampage range (% of max combat distance)") RULE_REAL(Combat, AERampageMaxDistance, 70, "Max AERampage range (% of max combat distance)")
RULE_INT(Combat, PetBaseCritChance, 0, "Pet base crit chance") RULE_INT(Combat, PetBaseCritChance, 0, "Pet base crit chance")
RULE_INT(Combat, NPCBashKickLevel, 6, "The level that NPCcan KICK/BASH") RULE_INT(Combat, NPCBashKickLevel, 6, "The level that NPCcan KICK/BASH")
RULE_INT(Combat, NPCKickStunLevel, 1, "The level that NPC has a chance to stun with kick.")
RULE_INT(Combat, PCKickStunLevel, 56, "The level that PC has a chance to stun with kick.")
RULE_INT(Combat, MeleeCritDifficulty, 8900, "Value against which is rolled to check if a melee crit is triggered. Lower is easier") RULE_INT(Combat, MeleeCritDifficulty, 8900, "Value against which is rolled to check if a melee crit is triggered. Lower is easier")
RULE_INT(Combat, ArcheryCritDifficulty, 3400, "Value against which is rolled to check if an archery crit is triggered. Lower is easier") RULE_INT(Combat, ArcheryCritDifficulty, 3400, "Value against which is rolled to check if an archery crit is triggered. Lower is easier")
RULE_INT(Combat, ThrowingCritDifficulty, 1100, "Value against which is rolled to check if a throwing crit is triggered. Lower is easier") RULE_INT(Combat, ThrowingCritDifficulty, 1100, "Value against which is rolled to check if a throwing crit is triggered. Lower is easier")
@@ -533,7 +522,6 @@ RULE_REAL(Combat, BaseProcChance, 0.035, "Base chance for procs")
RULE_REAL(Combat, ProcDexDivideBy, 11000, "Divisor for the probability of a proc increased by dexterity") RULE_REAL(Combat, ProcDexDivideBy, 11000, "Divisor for the probability of a proc increased by dexterity")
RULE_INT(Combat, MinRangedAttackDist, 25, "Minimum Distance to use Ranged Attacks") RULE_INT(Combat, MinRangedAttackDist, 25, "Minimum Distance to use Ranged Attacks")
RULE_BOOL(Combat, ArcheryBonusRequiresStationary, true, "does the 2x archery bonus chance require a stationary npc") RULE_BOOL(Combat, ArcheryBonusRequiresStationary, true, "does the 2x archery bonus chance require a stationary npc")
RULE_INT(Combat, ArcheryBonusLevelRequirement, 51, "Level requirement when the 2x archery bonus will be enabled. The default is 51.")
RULE_REAL(Combat, ArcheryNPCMultiplier, 1.0, "Value is multiplied by the regular dmg to get the archery dmg") RULE_REAL(Combat, ArcheryNPCMultiplier, 1.0, "Value is multiplied by the regular dmg to get the archery dmg")
RULE_BOOL(Combat, AssistNoTargetSelf, true, "When assisting a target that does not have a target: true = target self, false = leave target as was before assist (false = live like)") RULE_BOOL(Combat, AssistNoTargetSelf, true, "When assisting a target that does not have a target: true = target self, false = leave target as was before assist (false = live like)")
RULE_INT(Combat, MaxRampageTargets, 3, "Maximum number of people hit with rampage") RULE_INT(Combat, MaxRampageTargets, 3, "Maximum number of people hit with rampage")
@@ -582,12 +570,10 @@ RULE_BOOL(Combat, NPCsUseFrontalStunImmunityClasses, false, "Enable or disable N
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.")
RULE_BOOL(Combat, NPCsUseFrontalStunImmunityRaces, true, "Enable or disable NPCs using frontal stun immunity Races from Combat:FrontalStunImmunityRaces, true by default.") RULE_BOOL(Combat, NPCsUseFrontalStunImmunityRaces, true, "Enable or disable NPCs using frontal stun immunity Races from Combat:FrontalStunImmunityRaces, true by default.")
RULE_BOOL(Combat, AssassinateOnlyHumanoids, true, "Enable or disable Assassinate only being allowed on Humanoids, true by default.") RULE_BOOL(Combat, AssassinateOnlyHumanoids, true, "Enable or disable Assassinate only being allowed on Humanoids, true by default.")
RULE_INT(Combat, AssassinateLevelRequirement, 60, "Level requirement to enable assassinate attempts on backstabs. The default is 60.")
RULE_BOOL(Combat, HeadshotOnlyHumanoids, true, "Enable or disable Headshot only being allowed on Humanoids, true by default.") RULE_BOOL(Combat, HeadshotOnlyHumanoids, true, "Enable or disable Headshot only being allowed on Humanoids, true by default.")
RULE_BOOL(Combat, EnableWarriorShielding, true, "Enable or disable Warrior Shielding Ability (/shield), true by default.") RULE_BOOL(Combat, EnableWarriorShielding, true, "Enable or disable Warrior Shielding Ability (/shield), true by default.")
RULE_BOOL(Combat, BackstabIgnoresElemental, false, "Enable or disable Elemental weapon damage affecting backstab damage, false by default.") RULE_BOOL(Combat, BackstabIgnoresElemental, false, "Enable or disable Elemental weapon damage affecting backstab damage, false by default.")
RULE_BOOL(Combat, BackstabIgnoresBane, false, "Enable or disable Bane weapon damage affecting backstab damage, false by default.") RULE_BOOL(Combat, BackstabIgnoresBane, false, "Enable or disable Bane weapon damage affecting backstab damage, false by default.")
RULE_INT(Combat, DoubleBackstabLevelRequirement, 55, "Level requirement to enable double backstab attempts. The default is 55.")
RULE_BOOL(Combat, SummonMeleeRange, true, "Enable or disable summoning of a player when already in melee range of the summoner.") RULE_BOOL(Combat, SummonMeleeRange, true, "Enable or disable summoning of a player when already in melee range of the summoner.")
RULE_BOOL(Combat, WaterMatchRequiredForAutoFireLoS, true, "Enable/Disable the requirement of both the attacker/victim being both in or out of water for AutoFire LoS to pass.") RULE_BOOL(Combat, WaterMatchRequiredForAutoFireLoS, true, "Enable/Disable the requirement of both the attacker/victim being both in or out of water for AutoFire LoS to pass.")
RULE_INT(Combat, ExtraAllowedKickClassesBitmask, 0, "Bitmask for allowing extra classes beyond Warrior, Ranger, Beastlord, and Berserker to kick, No Extra Classes (0) by default") RULE_INT(Combat, ExtraAllowedKickClassesBitmask, 0, "Bitmask for allowing extra classes beyond Warrior, Ranger, Beastlord, and Berserker to kick, No Extra Classes (0) by default")
@@ -599,8 +585,6 @@ RULE_INT(Combat, ClassicTripleAttackChanceMonk, 100, "Innate Chance for Monk to
RULE_INT(Combat, ClassicTripleAttackChanceBerserker, 100, "Innate Chance for Berserker to Triple Attack after a Double Attack (200 = 20%). DEFAULT: 100") RULE_INT(Combat, ClassicTripleAttackChanceBerserker, 100, "Innate Chance for Berserker to Triple Attack after a Double Attack (200 = 20%). DEFAULT: 100")
RULE_INT(Combat, ClassicTripleAttackChanceRanger, 100, "Innate Chance for Ranger to Triple Attack after a Double Attack (200 = 20%). DEFAULT: 100") RULE_INT(Combat, ClassicTripleAttackChanceRanger, 100, "Innate Chance for Ranger to Triple Attack after a Double Attack (200 = 20%). DEFAULT: 100")
RULE_INT(Combat, StunChance, 12, "Percent chance that client will be stunned when mob is behind player. DEFAULT: 12") RULE_INT(Combat, StunChance, 12, "Percent chance that client will be stunned when mob is behind player. DEFAULT: 12")
RULE_INT(Combat, StunDuration, 2000, "Duration of stuns in ms. DEFAULT: 2000")
RULE_BOOL(Combat, ClientStunMessage, false, "Client stunning NPC produces message. DEFAULT false")
RULE_BOOL(Combat, BashTwoHanderUseShoulderAC, false, "Enable to use shoulder AC for bash calculations when two hander is equipped. Unproven if accurate DEFAULT: false") RULE_BOOL(Combat, BashTwoHanderUseShoulderAC, false, "Enable to use shoulder AC for bash calculations when two hander is equipped. Unproven if accurate DEFAULT: false")
RULE_REAL(Combat, BashACBonusDivisor, 25.0, "this divides the AC value contribution to bash damage, lower to increase damage") RULE_REAL(Combat, BashACBonusDivisor, 25.0, "this divides the AC value contribution to bash damage, lower to increase damage")
RULE_CATEGORY_END() RULE_CATEGORY_END()
@@ -963,19 +947,8 @@ RULE_BOOL(Items, DisablePotionBelt, false, "Enable this to disable Potion Belt I
RULE_BOOL(Items, DisableSpellFocusEffects, false, "Enable this to disable Spell Focus Effects on Items") RULE_BOOL(Items, DisableSpellFocusEffects, false, "Enable this to disable Spell Focus Effects on Items")
RULE_CATEGORY_END() RULE_CATEGORY_END()
RULE_CATEGORY(Parcel)
RULE_BOOL(Parcel, EnableParcelMerchants, true, "Enable or Disable Parcel Merchants. Requires RoF+ Clients.")
RULE_BOOL(Parcel, EnableDirectToInventoryDelivery, false, "Enable or Disable RoF2 bazaar purchases to be delivered directly to the buyer's inventory.")
RULE_BOOL(Parcel, DeleteOnDuplicate, false, "Delete retrieved item if it creates a lore conflict.")
RULE_BOOL(Parcel, EnablePruning, false, "Enable the automatic pruning of sent parcels. Uses rule ParcelPruneDelay for prune delay.")
RULE_INT(Parcel, ParcelDeliveryDelay, 30000, "Sets the time that a player must wait between sending parcels.")
RULE_INT(Parcel, ParcelMaxItems, 50, "The maximum number of parcels a player is allowed to have in their mailbox.")
RULE_INT(Parcel, ParcelPruneDelay, 30, "The number of days after which a parcel is deleted. Items are lost!")
RULE_CATEGORY_END()
#undef RULE_CATEGORY #undef RULE_CATEGORY
#undef RULE_INT #undef RULE_INT
#undef RULE_REAL #undef RULE_REAL
#undef RULE_BOOL #undef RULE_BOOL
#undef RULE_STRING
#undef RULE_CATEGORY_END #undef RULE_CATEGORY_END
+3 -4
View File
@@ -348,7 +348,7 @@ std::string EQ::SayLinkEngine::InjectSaylinksIfNotExist(const char *message)
if (ch != startpos) if (ch != startpos)
{ {
std::string str(startpos, ch - startpos); std::string str(startpos, ch - startpos);
new_message += Saylink::Create(str); new_message += EQ::SayLinkEngine::GenerateQuestSaylink(str, false, str);
} }
in_bracket_state = false; in_bracket_state = false;
} }
@@ -417,12 +417,11 @@ SaylinkRepository::Saylink EQ::SayLinkEngine::GetOrSaveSaylink(std::string sayli
return {}; return {};
} }
std::string Saylink::Create(const std::string& saylink_text, bool silent, const std::string& link_name) std::string Saylink::Create(const std::string &saylink_text, bool silent, const std::string &link_name)
{ {
return EQ::SayLinkEngine::GenerateQuestSaylink(saylink_text, silent, (link_name.empty() ? saylink_text : link_name)); return EQ::SayLinkEngine::GenerateQuestSaylink(saylink_text, silent, (link_name.empty() ? saylink_text : link_name));
} }
std::string Saylink::Silent(const std::string& saylink_text, const std::string& link_name) std::string Saylink::Silent(const std::string &saylink_text, const std::string &link_name) {
{
return EQ::SayLinkEngine::GenerateQuestSaylink(saylink_text, true, (link_name.empty() ? saylink_text : link_name)); return EQ::SayLinkEngine::GenerateQuestSaylink(saylink_text, true, (link_name.empty() ? saylink_text : link_name));
} }
+1 -1
View File
@@ -130,7 +130,7 @@ namespace EQ
class Saylink { class Saylink {
public: public:
static std::string Create(const std::string &saylink_text, bool silent = false, const std::string &link_name = ""); static std::string Create(const std::string &saylink_text, bool silent, const std::string &link_name = "");
static std::string Silent(const std::string &saylink_text, const std::string &link_name = ""); static std::string Silent(const std::string &saylink_text, const std::string &link_name = "");
}; };
+1 -1
View File
@@ -11,7 +11,7 @@ namespace ServerEvents {
static const std::string EVENT_TYPE_RELOAD_WORLD = "reload_world"; static const std::string EVENT_TYPE_RELOAD_WORLD = "reload_world";
static const std::string EVENT_TYPE_RULE_CHANGE = "rule_change"; static const std::string EVENT_TYPE_RULE_CHANGE = "rule_change";
static const std::string EVENT_TYPE_CONTENT_FLAG_CHANGE = "content_flag_change"; static const std::string EVENT_TYPE_CONTENT_FLAG_CHANGE = "content_flag_change";
} // namespace ServerEvents }
class ServerEventScheduler { class ServerEventScheduler {
public: public:
+1 -5
View File
@@ -43,7 +43,7 @@
#define ServerOP_OnlineGuildMembersResponse 0x0016 #define ServerOP_OnlineGuildMembersResponse 0x0016
#define ServerOP_LFGuildUpdate 0x0017 #define ServerOP_LFGuildUpdate 0x0017
#define ServerOP_FlagUpdate 0x0018 // GM flag updated for character, refresh the memory cache #define ServerOP_FlagUpdate 0x0018 // GM Flag updated for character, refresh the memory cache
#define ServerOP_GMGoto 0x0019 #define ServerOP_GMGoto 0x0019
#define ServerOP_MultiLineMsg 0x001A #define ServerOP_MultiLineMsg 0x001A
#define ServerOP_Lock 0x001B // For #lock/#unlock inside server #define ServerOP_Lock 0x001B // For #lock/#unlock inside server
@@ -113,9 +113,6 @@
#define ServerOP_GuildSendGuildList 0x007E #define ServerOP_GuildSendGuildList 0x007E
#define ServerOP_GuildMembersList 0x007F #define ServerOP_GuildMembersList 0x007F
#define ServerOP_ParcelDelivery 0x0090
#define ServerOP_ParcelPrune 0x0091
#define ServerOP_RaidAdd 0x0100 //in use #define ServerOP_RaidAdd 0x0100 //in use
#define ServerOP_RaidRemove 0x0101 //in use #define ServerOP_RaidRemove 0x0101 //in use
#define ServerOP_RaidDisband 0x0102 //in use #define ServerOP_RaidDisband 0x0102 //in use
@@ -276,7 +273,6 @@
#define ServerOP_ReloadFactions 0x4126 #define ServerOP_ReloadFactions 0x4126
#define ServerOP_ReloadLoot 0x4127 #define ServerOP_ReloadLoot 0x4127
#define ServerOP_ReloadBaseData 0x4128 #define ServerOP_ReloadBaseData 0x4128
#define ServerOP_ReloadSkillCaps 0x4129
#define ServerOP_CZDialogueWindow 0x4500 #define ServerOP_CZDialogueWindow 0x4500
#define ServerOP_CZLDoNUpdate 0x4501 #define ServerOP_CZLDoNUpdate 0x4501
+1 -1
View File
@@ -60,7 +60,7 @@ SharedTaskRequest SharedTask::GetRequestCharacters(Database &db, uint32_t reques
request.group_type = SharedTaskRequestGroupType::Group; request.group_type = SharedTaskRequestGroupType::Group;
auto characters = CharacterDataRepository::GetWhere( auto characters = CharacterDataRepository::GetWhere(
db, fmt::format( db, fmt::format(
"id IN (select character_id from group_id where group_id = (select group_id from group_id where character_id = {}))", "id IN (select charid from group_id where groupid = (select groupid from group_id where charid = {}))",
requested_character_id requested_character_id
) )
); );
+134 -4
View File
@@ -45,7 +45,6 @@
#include "repositories/loottable_repository.h" #include "repositories/loottable_repository.h"
#include "repositories/character_item_recast_repository.h" #include "repositories/character_item_recast_repository.h"
#include "repositories/character_corpses_repository.h" #include "repositories/character_corpses_repository.h"
#include "repositories/skill_caps_repository.h"
namespace ItemField namespace ItemField
{ {
@@ -794,7 +793,8 @@ bool SharedDatabase::GetInventory(uint32 char_id, EQ::InventoryProfile *inv)
} }
if (cv_conflict) { if (cv_conflict) {
const std::string& char_name = GetCharName(char_id); char char_name[64] = "";
GetCharName(char_id, char_name);
LogError("ClientVersion/Expansion conflict during inventory load at zone entry for [{}] (charid: [{}], inver: [{}], gmi: [{}])", LogError("ClientVersion/Expansion conflict during inventory load at zone entry for [{}] (charid: [{}], inver: [{}], gmi: [{}])",
char_name, char_name,
char_id, char_id,
@@ -1626,6 +1626,136 @@ bool SharedDatabase::GetCommandSubSettings(std::vector<CommandSubsettingsReposit
return true; return true;
} }
bool SharedDatabase::LoadSkillCaps(const std::string &prefix) {
skill_caps_mmf.reset(nullptr);
try {
const auto Config = EQEmuConfig::get();
EQ::IPCMutex mutex("skill_caps");
mutex.Lock();
std::string file_name = fmt::format("{}/{}{}", path.GetSharedMemoryPath(), prefix, std::string("skill_caps"));
LogInfo("Loading [{}]", file_name);
skill_caps_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
LogInfo("Loaded skill caps via shared memory");
mutex.Unlock();
} catch(std::exception &ex) {
LogError("Error loading skill caps: {}", ex.what());
return false;
}
return true;
}
void SharedDatabase::LoadSkillCaps(void *data) {
const uint32 class_count = Class::PLAYER_CLASS_COUNT;
const uint32 skill_count = EQ::skills::HIGHEST_SKILL + 1;
const uint32 level_count = HARD_LEVEL_CAP + 1;
uint16 *skill_caps_table = static_cast<uint16*>(data);
const std::string query = "SELECT skillID, class, level, cap FROM skill_caps ORDER BY skillID, class, level";
auto results = QueryDatabase(query);
if (!results.Success()) {
LogError("Error loading skill caps from database: {}", results.ErrorMessage().c_str());
return;
}
for(auto& row = results.begin(); row != results.end(); ++row) {
const uint8 skillID = Strings::ToUnsignedInt(row[0]);
const uint8 class_ = Strings::ToUnsignedInt(row[1]) - 1;
const uint8 level = Strings::ToUnsignedInt(row[2]);
const uint16 cap = Strings::ToUnsignedInt(row[3]);
if(skillID >= skill_count || class_ >= class_count || level >= level_count)
continue;
const uint32 index = (((class_ * skill_count) + skillID) * level_count) + level;
skill_caps_table[index] = cap;
}
}
uint16 SharedDatabase::GetSkillCap(uint8 Class_, EQ::skills::SkillType Skill, uint8 Level) const
{
if(!skill_caps_mmf) {
return 0;
}
if(Class_ == 0)
return 0;
int SkillMaxLevel = RuleI(Character, SkillCapMaxLevel);
if(SkillMaxLevel < 1) {
SkillMaxLevel = RuleI(Character, MaxLevel);
}
const uint32 class_count = Class::PLAYER_CLASS_COUNT;
const uint32 skill_count = EQ::skills::HIGHEST_SKILL + 1;
const uint32 level_count = HARD_LEVEL_CAP + 1;
if(Class_ > class_count || static_cast<uint32>(Skill) > skill_count || Level > level_count) {
return 0;
}
if(Level > static_cast<uint8>(SkillMaxLevel)){
Level = static_cast<uint8>(SkillMaxLevel);
}
const uint32 index = ((((Class_ - 1) * skill_count) + Skill) * level_count) + Level;
const uint16 *skill_caps_table = static_cast<uint16*>(skill_caps_mmf->Get());
return skill_caps_table[index];
}
uint8 SharedDatabase::GetTrainLevel(uint8 Class_, EQ::skills::SkillType Skill, uint8 Level) const
{
if(!skill_caps_mmf) {
return 0;
}
if(Class_ == 0)
return 0;
int SkillMaxLevel = RuleI(Character, SkillCapMaxLevel);
if (SkillMaxLevel < 1) {
SkillMaxLevel = RuleI(Character, MaxLevel);
}
const uint32 class_count = Class::PLAYER_CLASS_COUNT;
const uint32 skill_count = EQ::skills::HIGHEST_SKILL + 1;
const uint32 level_count = HARD_LEVEL_CAP + 1;
if(Class_ > class_count || static_cast<uint32>(Skill) > skill_count || Level > level_count) {
return 0;
}
uint8 ret = 0;
if(Level > static_cast<uint8>(SkillMaxLevel)) {
const uint32 index = ((((Class_ - 1) * skill_count) + Skill) * level_count);
const uint16 *skill_caps_table = static_cast<uint16*>(skill_caps_mmf->Get());
for(uint8 x = 0; x < Level; x++){
if(skill_caps_table[index + x]){
ret = x;
break;
}
}
}
else
{
const uint32 index = ((((Class_ - 1) * skill_count) + Skill) * level_count);
const uint16 *skill_caps_table = static_cast<uint16*>(skill_caps_mmf->Get());
for(int x = 0; x < SkillMaxLevel; x++){
if(skill_caps_table[index + x]){
ret = x;
break;
}
}
}
if(ret > GetSkillCap(Class_, Skill, Level))
ret = static_cast<uint8>(GetSkillCap(Class_, Skill, Level));
return ret;
}
void SharedDatabase::LoadDamageShieldTypes(SPDat_Spell_Struct* sp, int32 iMaxSpellID) { void SharedDatabase::LoadDamageShieldTypes(SPDat_Spell_Struct* sp, int32 iMaxSpellID) {
const std::string query = StringFormat("SELECT `spellid`, `type` FROM `damageshieldtypes` WHERE `spellid` > 0 " const std::string query = StringFormat("SELECT `spellid`, `type` FROM `damageshieldtypes` WHERE `spellid` > 0 "
"AND `spellid` <= %i", iMaxSpellID); "AND `spellid` <= %i", iMaxSpellID);
@@ -1854,9 +1984,9 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) {
sp[tempid].min_range = Strings::ToFloat(row[231]); sp[tempid].min_range = Strings::ToFloat(row[231]);
sp[tempid].no_remove = Strings::ToBool(row[232]); sp[tempid].no_remove = Strings::ToBool(row[232]);
sp[tempid].damage_shield_type = 0; sp[tempid].damage_shield_type = 0;
} }
LoadDamageShieldTypes(sp, max_spells); LoadDamageShieldTypes(sp, max_spells);
} }
void SharedDatabase::LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* message) { void SharedDatabase::LoadCharacterInspectMessage(uint32 character_id, InspectMessage_Struct* message) {
+8
View File
@@ -160,6 +160,14 @@ public:
uint32 GetSharedItemsCount() { return m_shared_items_count; } uint32 GetSharedItemsCount() { return m_shared_items_count; }
uint32 GetItemsCount(); uint32 GetItemsCount();
/**
* skills
*/
void LoadSkillCaps(void *data);
bool LoadSkillCaps(const std::string &prefix);
uint16 GetSkillCap(uint8 Class_, EQ::skills::SkillType Skill, uint8 Level) const;
uint8 GetTrainLevel(uint8 Class_, EQ::skills::SkillType Skill, uint8 Level) const;
/** /**
* spells * spells
*/ */
-85
View File
@@ -1,85 +0,0 @@
#include "skill_caps.h"
SkillCaps *SkillCaps::SetContentDatabase(Database *db)
{
m_content_database = db;
return this;
}
SkillCapsRepository::SkillCaps SkillCaps::GetSkillCap(uint8 class_id, EQ::skills::SkillType skill_id, uint8 level)
{
if (!IsPlayerClass(class_id)) {
return SkillCapsRepository::NewEntity();
}
uint64_t key = (class_id * 1000000) + (level * 1000) + static_cast<uint32>(skill_id);
auto pos = m_skill_caps.find(key);
if (pos != m_skill_caps.end()) {
return pos->second;
}
return SkillCapsRepository::NewEntity();
}
uint8 SkillCaps::GetTrainLevel(uint8 class_id, EQ::skills::SkillType skill_id, uint8 level)
{
if (
!IsPlayerClass(class_id) ||
class_id > Class::PLAYER_CLASS_COUNT ||
static_cast<uint32>(skill_id) > (EQ::skills::HIGHEST_SKILL + 1)
) {
return 0;
}
const uint8 skill_cap_max_level = (
RuleI(Character, SkillCapMaxLevel) > 0 ?
RuleI(Character, SkillCapMaxLevel) :
RuleI(Character, MaxLevel)
);
const uint8 max_level = level > skill_cap_max_level ? level : skill_cap_max_level;
for (const auto &e: m_skill_caps) {
for (uint8 current_level = 1; current_level <= max_level; current_level++) {
uint64_t key = (class_id * 1000000) + (level * 1000) + static_cast<uint32>(skill_id);
auto pos = m_skill_caps.find(key);
if (pos != m_skill_caps.end()) {
return current_level;
}
}
}
return 0;
}
void SkillCaps::LoadSkillCaps()
{
const auto &l = SkillCapsRepository::All(*m_content_database);
m_skill_caps.clear();
for (const auto &e: l) {
if (
e.level < 1 ||
!IsPlayerClass(e.class_id) ||
static_cast<EQ::skills::SkillType>(e.skill_id) >= EQ::skills::SkillCount
) {
continue;
}
uint64_t key = (e.class_id * 1000000) + (e.level * 1000) + e.skill_id;
m_skill_caps[key] = e;
}
LogInfo(
"Loaded [{}] Skill Cap Entr{}",
l.size(),
l.size() != 1 ? "ies" : "y"
);
}
void SkillCaps::ReloadSkillCaps()
{
ClearSkillCaps();
LoadSkillCaps();
}
-26
View File
@@ -1,26 +0,0 @@
#ifndef CODE_SKILL_CAPS_H
#define CODE_SKILL_CAPS_H
#include "repositories/skill_caps_repository.h"
#include "types.h"
#include "classes.h"
#include "skills.h"
class SkillCaps {
public:
inline void ClearSkillCaps() { m_skill_caps.clear(); }
SkillCapsRepository::SkillCaps GetSkillCap(uint8 class_id, EQ::skills::SkillType skill_id, uint8 level);
uint8 GetTrainLevel(uint8 class_id, EQ::skills::SkillType skill_id, uint8 level);
void LoadSkillCaps();
void ReloadSkillCaps();
SkillCaps *SetContentDatabase(Database *db);
private:
Database *m_content_database{};
std::map<uint64, SkillCapsRepository::SkillCaps> m_skill_caps = {};
};
extern SkillCaps skill_caps;
#endif //CODE_SKILL_CAPS_H

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