mirror of
https://github.com/EQEmu/Server.git
synced 2026-05-29 14:55:44 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| f9b45fc023 |
@@ -0,0 +1,21 @@
|
||||
// For format details, see https://aka.ms/vscode-remote/devcontainer.json or this file's README at:
|
||||
// https://github.com/microsoft/vscode-dev-containers/tree/v0.101.1/containers/ubuntu-18.04-git
|
||||
{
|
||||
"name": "Ubuntu 18.04 EQEMU",
|
||||
// Moved from dockerfile to image so it builds faster
|
||||
"image": "eqemu/devcontainer:0.0.2",
|
||||
|
||||
// Set *default* container specific settings.json values on container create.
|
||||
"settings": {
|
||||
"terminal.integrated.shell.linux": "/bin/bash"
|
||||
},
|
||||
|
||||
"runArgs": [ "--cap-add=SYS_PTRACE", "--security-opt", "seccomp=unconfined" ],
|
||||
|
||||
// Add the IDs of extensions you want installed when the container is created.
|
||||
"extensions": ["ms-vscode.cpptools", "ms-azuretools.vscode-docker"],
|
||||
"mounts": ["source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind"],
|
||||
"remoteEnv": {
|
||||
"HOST_PROJECT_PATH": "${localWorkspaceFolder}"
|
||||
}
|
||||
}
|
||||
+9
-74
@@ -1,11 +1,7 @@
|
||||
---
|
||||
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: Build Linux
|
||||
|
||||
clone:
|
||||
depth: 1
|
||||
name: EQEmulator Server Linux CI
|
||||
|
||||
# Limits how many of these builds can run on the drone runner at a time, this isn't about cores
|
||||
concurrency:
|
||||
@@ -14,79 +10,18 @@ concurrency:
|
||||
volumes:
|
||||
- name: cache
|
||||
host:
|
||||
path: /var/lib/cache-release
|
||||
path: /var/lib/cache
|
||||
|
||||
steps:
|
||||
- name: Build Linux X64
|
||||
- name: server-build
|
||||
# Source build script https://github.com/Akkadius/akk-stack/blob/master/containers/eqemu-server/Dockerfile#L20
|
||||
image: akkadius/eqemu-server:v11
|
||||
environment:
|
||||
GITHUB_TOKEN:
|
||||
from_secret: GH_RELEASE_GITHUB_API_TOKEN
|
||||
RCLONE_CONFIG_REMOTE_TYPE: ftp
|
||||
RCLONE_FTP_HOST: drone.akkadius.com
|
||||
RCLONE_FTP_USER: artifacts
|
||||
RCLONE_FTP_PASS:
|
||||
from_secret: RCLONE_FTP_PASS
|
||||
commands:
|
||||
- ./utils/scripts/build/linux-build.sh
|
||||
- sudo chown eqemu:eqemu /drone/src/ * -R
|
||||
- sudo chown eqemu:eqemu /home/eqemu/.ccache/ * -R
|
||||
- git submodule init && git submodule update && mkdir -p build && cd build && cmake -DEQEMU_BUILD_TESTS=ON -DEQEMU_BUILD_LOGIN=ON -DEQEMU_ENABLE_BOTS=ON -DEQEMU_BUILD_LUA=ON -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_FLAGS_RELWITHDEBINFO:STRING="-O0 -g -DNDEBUG" -G 'Unix Makefiles' .. && make -j$((`nproc`-4))
|
||||
- curl https://raw.githubusercontent.com/Akkadius/eqemu-install-v2/master/eqemu_config.json --output eqemu_config.json
|
||||
- ./bin/tests
|
||||
volumes:
|
||||
- name: cache
|
||||
path: /home/eqemu/.ccache/
|
||||
|
||||
---
|
||||
|
||||
kind: pipeline
|
||||
type: exec
|
||||
name: Build Windows
|
||||
|
||||
clone:
|
||||
depth: 1
|
||||
|
||||
platform:
|
||||
os: windows
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: Build Windows X64
|
||||
environment:
|
||||
RCLONE_CONFIG_REMOTE_TYPE: ftp
|
||||
RCLONE_FTP_HOST: drone.akkadius.com
|
||||
RCLONE_FTP_USER: artifacts
|
||||
RCLONE_FTP_PASS:
|
||||
from_secret: RCLONE_FTP_PASS
|
||||
GITHUB_TOKEN:
|
||||
from_secret: GH_RELEASE_GITHUB_API_TOKEN
|
||||
commands:
|
||||
- .\utils\scripts\build\windows-build.ps1
|
||||
|
||||
---
|
||||
|
||||
kind: pipeline
|
||||
type: docker
|
||||
name: Publish Artifacts to Github
|
||||
|
||||
steps:
|
||||
- name: Upload Artifacts
|
||||
image: akkadius/eqemu-build-releaser:v3
|
||||
environment:
|
||||
RCLONE_CONFIG_REMOTE_TYPE: ftp
|
||||
RCLONE_FTP_HOST: drone.akkadius.com
|
||||
RCLONE_FTP_USER: artifacts
|
||||
RCLONE_FTP_PASS:
|
||||
from_secret: RCLONE_FTP_PASS
|
||||
GH_RELEASE_GITHUB_API_TOKEN:
|
||||
from_secret: GH_RELEASE_GITHUB_API_TOKEN
|
||||
GITHUB_TOKEN:
|
||||
from_secret: GH_RELEASE_GITHUB_API_TOKEN
|
||||
commands:
|
||||
- ./utils/scripts/build/should-release/should-release
|
||||
- rclone config create remote ftp env_auth true > /dev/null
|
||||
- |
|
||||
rclone copy remote: --include "eqemu-server*.zip" .
|
||||
- gh-release --assets=eqemu-server-linux-x64.zip,eqemu-server-windows-x64.zip -y
|
||||
- |
|
||||
rclone delete remote: --include "eqemu-server*.zip"
|
||||
|
||||
depends_on:
|
||||
- Build Windows
|
||||
- Build Linux
|
||||
|
||||
+1
-9
@@ -59,12 +59,4 @@ bin/
|
||||
|
||||
# Clangd Generated Files.
|
||||
compile_flags.txt
|
||||
.cache/
|
||||
|
||||
# vscode generated settings
|
||||
.vscode/
|
||||
|
||||
# Build pipeline
|
||||
!utils/scripts/build/
|
||||
!utils/scripts/build/should-release/should-release
|
||||
!utils/scripts/build/should-release/should-release.exe
|
||||
.cache/
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Linux",
|
||||
"includePath": [
|
||||
"${workspaceFolder}/**",
|
||||
"/usr/include/mysql"
|
||||
],
|
||||
"defines": [],
|
||||
"compilerPath": "/usr/bin/gcc",
|
||||
"cStandard": "c11",
|
||||
"cppStandard": "c++17"
|
||||
}
|
||||
],
|
||||
"version": 4
|
||||
}
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"*.ipp": "cpp"
|
||||
}
|
||||
}
|
||||
Vendored
+164
@@ -0,0 +1,164 @@
|
||||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "2.0.0",
|
||||
"tasks": [
|
||||
{
|
||||
"label": "make",
|
||||
"type": "shell",
|
||||
"command": "cd bin && make",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "make clean",
|
||||
"type": "shell",
|
||||
"command": "cd bin && make clean",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "cmake",
|
||||
"type": "shell",
|
||||
"command": "mkdir -p bin && cd bin && rm CMakeCache.txt && cmake -DEQEMU_BUILD_LOGIN=ON -DEQEMU_BUILD_LUA=ON -G 'Unix Makefiles' ..",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"problemMatcher":{
|
||||
"owner": "cpp",
|
||||
"fileLocation": "relative",
|
||||
"pattern":[
|
||||
{
|
||||
"regexp": "([\\w+|\\\\]*\\.\\w+)\\((\\d+)\\)\\: (warning|error) (.*)$",
|
||||
"file": 1,
|
||||
"location": 2,
|
||||
"severity": 3,
|
||||
"message": 4
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "download maps",
|
||||
"type": "shell",
|
||||
"command": "mkdir -p bin && cd bin && wget https://codeload.github.com/Akkadius/EQEmuMaps/zip/master -O maps.zip && unzip -o maps.zip && rm ./maps -rf && mv EQEmuMaps-master maps && rm maps.zip",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "download quests",
|
||||
"type": "shell",
|
||||
"command": "mkdir -p bin && cd bin && cd server && git -C ./quests pull 2> /dev/null || git clone https://github.com/ProjectEQ/projecteqquests.git quests",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "download eqemu_config",
|
||||
"type": "shell",
|
||||
"command": "mkdir -p bin && cd bin && wget --no-check-certificate https://raw.githubusercontent.com/Akkadius/EQEmuInstall/master/eqemu_config_docker.json -O eqemu_config.json",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "rebuild database (mariadb must be started)",
|
||||
"type": "shell",
|
||||
"command": "mkdir -p bin && cd bin && docker run -i --rm --privileged -v ${HOST_PROJECT_PATH}/bin:/src --network=eqemu -it eqemu/server:0.0.3 bash -c './eqemu_server.pl source_peq_db && ./eqemu_server.pl check_db_updates && ./eqemu_server.pl linux_login_server_setup'",
|
||||
"group": {
|
||||
"kind": "build",
|
||||
"isDefault": true
|
||||
},
|
||||
"problemMatcher": [
|
||||
"$gcc"
|
||||
]
|
||||
},
|
||||
{
|
||||
"label": "zone 7000",
|
||||
"type": "shell",
|
||||
"command": "docker stop zone7000 | true && docker network create eqemu | true && docker run -i --rm --name zone7000 --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 --network=eqemu -p 7000:7000/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./zone dynamic_zone7000:7000",
|
||||
"group": {
|
||||
"kind": "test",
|
||||
"isDefault": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "zone 7001",
|
||||
"type": "shell",
|
||||
"command": "docker stop zone7001 | true && docker network create eqemu | true && docker run -i --rm --name zone7001 --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 --network=eqemu -p 7001:7001/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./zone dynamic_zone7001:7001",
|
||||
"group": {
|
||||
"kind": "test",
|
||||
"isDefault": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "loginserver",
|
||||
"type": "shell",
|
||||
"command": "docker stop loginserver | true && docker network create eqemu | true && docker run -i --rm --cap-add=SYS_PTRACE --security-opt seccomp=unconfined --privileged -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 --network=eqemu --name loginserver -p 5999:5999/udp -p 5998:5998/udp -e LD_LIBRARY_PATH=/src/ eqemu/server:0.0.3 gdb -ex run --args ./loginserver",
|
||||
"group": {
|
||||
"kind": "test",
|
||||
"isDefault": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "shared_memory, world",
|
||||
"type": "shell",
|
||||
"command": "docker stop sharedmemory | true && docker stop world | true && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/bin:/src --network=eqemu --name sharedmemory eqemu/server:0.0.3 ./shared_memory && docker run --rm -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 -e LD_LIBRARY_PATH=/src/ --network=eqemu --name world -p 9000:9000 -p 9000:9000/udp -p 9001:9001 -p 9080:9080 eqemu/server:0.0.3 gdb -ex run ./world",
|
||||
"group": {
|
||||
"kind": "test",
|
||||
"isDefault": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "queryserv",
|
||||
"type": "shell",
|
||||
"command": "docker stop queryserv | true && docker run --rm -v ${HOST_PROJECT_PATH}/bin:/src --ulimit core=10000000 -e LD_LIBRARY_PATH=/src/ --network=eqemu --name queryserv eqemu/server:0.0.3 gdb -ex run ./queryserv",
|
||||
"group": {
|
||||
"kind": "test",
|
||||
"isDefault": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "mariadb",
|
||||
"type": "shell",
|
||||
"command": "docker stop mariadb | true && cd bin && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/bin/db:/bitnami/mariadb -p 3306:3306 -e MARIADB_DATABASE=peq -e MARIADB_USER=eqemu -e MARIADB_PASSWORD=eqemupass -e ALLOW_EMPTY_PASSWORD=yes --name mariadb --network=eqemu bitnami/mariadb:latest",
|
||||
"group": {
|
||||
"kind": "test",
|
||||
"isDefault": true
|
||||
}
|
||||
},
|
||||
{
|
||||
"label": "ucs",
|
||||
"type": "shell",
|
||||
"command": "docker stop ucs | true && cd bin && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/bin:/src -p 7778:7778 --name ucs --network=eqemu eqemu/server:0.0.3 gdb -ex run ./ucs",
|
||||
"group": {
|
||||
"kind": "test",
|
||||
"isDefault": true
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -40,14 +40,14 @@ Assuming it is starting in c:/projects/eqemu and the x64 dependencies were extra
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -G "Visual Studio 15 2017 Win64" -DEQEMU_BUILD_TESTS=ON -DEQEMU_BUILD_LOGIN=ON -DEQEMU_BUILD_ZLIB=ON -DCMAKE_TOOLCHAIN_FILE="c:/projects/eqemu/vcpkg/vcpkg-export-20180828-145455/scripts/buildsystems/vcpkg.cmake" ..
|
||||
cmake -G "Visual Studio 15 2017 Win64" -DEQEMU_BUILD_TESTS=ON -DEQEMU_BUILD_LOGIN=ON -DEQEMU_BUILD_ZLIB=ON -DEQEMU_ENABLE_BOTS=ON -DCMAKE_TOOLCHAIN_FILE="c:/projects/eqemu/vcpkg/vcpkg-export-20180828-145455/scripts/buildsystems/vcpkg.cmake" ..
|
||||
|
||||
##### Linux
|
||||
Similarly to Windows running CMake on Linux is simple it just omits the toolchain file and uses a different generator.
|
||||
|
||||
mkdir build
|
||||
cd build
|
||||
cmake -G "Unix Makefiles" -DEQEMU_BUILD_TESTS=ON -DEQEMU_BUILD_LOGIN=ON ..
|
||||
cmake -G "Unix Makefiles" -DEQEMU_BUILD_TESTS=ON -DEQEMU_ENABLE_BOTS=ON -DEQEMU_BUILD_LOGIN=ON ..
|
||||
|
||||
### Building
|
||||
|
||||
|
||||
-692
@@ -1,692 +0,0 @@
|
||||
## [22.1.0] - 01/22/2022
|
||||
|
||||
This is a first release using the new build system. Changelog entry representative of last year. Subsequent releases will consist of incremental changes since the last release.
|
||||
|
||||
### AA
|
||||
|
||||
* Fix AA tables dump ([#2769](https://github.com/EQEmu/Server/pull/2769)) ([Akkadius](https://github.com/Akkadius)) 2023-01-22
|
||||
|
||||
### AI
|
||||
|
||||
* Add Support to Heals to allow Trigger based spells ([#2709](https://github.com/EQEmu/Server/pull/2709)) ([Aeadoin](https://github.com/Aeadoin)) 2023-01-08
|
||||
* Spell Type (1024) InCombatBuff were spam casting ([#2030](https://github.com/EQEmu/Server/pull/2030)) ([noudess](https://github.com/noudess)) 2022-03-07
|
||||
|
||||
### API
|
||||
|
||||
* Apply spells with custom buff durations and adjust existing spell buff durations. ([#1997](https://github.com/EQEmu/Server/pull/1997)) ([KayenEQ](https://github.com/KayenEQ)) 2022-02-15
|
||||
* Fix for SetBuffDuration function to check bard slots. ([#2009](https://github.com/EQEmu/Server/pull/2009)) ([KayenEQ](https://github.com/KayenEQ)) 2022-02-17
|
||||
* GetNPCStat can now return default stat values. ([#2048](https://github.com/EQEmu/Server/pull/2048)) ([KayenEQ](https://github.com/KayenEQ)) 2022-03-11
|
||||
* GetNPCStat default better naming ([#2053](https://github.com/EQEmu/Server/pull/2053)) ([KayenEQ](https://github.com/KayenEQ)) 2022-03-13
|
||||
* Methods for getting more information on quest timers. ([#2060](https://github.com/EQEmu/Server/pull/2060)) ([KayenEQ](https://github.com/KayenEQ)) 2022-04-13
|
||||
* Perl functions added to apply spell effects directly to NPCs without requiring buffs. ([#1975](https://github.com/EQEmu/Server/pull/1975)) ([KayenEQ](https://github.com/KayenEQ)) 2022-02-08
|
||||
* Perl functions to set invulnerable to and modify environmental damage. ([#2044](https://github.com/EQEmu/Server/pull/2044)) ([KayenEQ](https://github.com/KayenEQ)) 2022-03-09
|
||||
* Reload API ([#2716](https://github.com/EQEmu/Server/pull/2716)) ([Akkadius](https://github.com/Akkadius)) 2023-01-11
|
||||
* perl added GetNPCStat(identifier) ([#2012](https://github.com/EQEmu/Server/pull/2012)) ([KayenEQ](https://github.com/KayenEQ)) 2022-02-20
|
||||
|
||||
### Aggro
|
||||
|
||||
* Cleanup Mob::CombatRange ([#2652](https://github.com/EQEmu/Server/pull/2652)) ([Aeadoin](https://github.com/Aeadoin)) 2022-12-20
|
||||
* Rooted mobs will add other hated targets to Hate list ([#2180](https://github.com/EQEmu/Server/pull/2180)) ([noudess](https://github.com/noudess)) 2022-05-27
|
||||
|
||||
### Appveyor
|
||||
|
||||
* Remove bots preprocessor ([Akkadius](https://github.com/Akkadius)) 2023-01-20
|
||||
|
||||
### Backups
|
||||
|
||||
* Use World CLI for Database Backups ([#2286](https://github.com/EQEmu/Server/pull/2286)) ([Akkadius](https://github.com/Akkadius)) 2022-07-07
|
||||
|
||||
### Bot/Merc
|
||||
|
||||
* Cleanup methods, and virtual overrides. ([#2734](https://github.com/EQEmu/Server/pull/2734)) ([Aeadoin](https://github.com/Aeadoin)) 2023-01-15
|
||||
|
||||
### Bots
|
||||
|
||||
* Add Bot Command Reloading ([#2773](https://github.com/EQEmu/Server/pull/2773)) ([Kinglykrab](https://github.com/Kinglykrab)) 2023-01-22
|
||||
* Add Bot-specific Spell Settings. ([#2553](https://github.com/EQEmu/Server/pull/2553)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-27
|
||||
* Add Buff support for Bards under AI_IdleCastChecks ([#2590](https://github.com/EQEmu/Server/pull/2590)) ([Aeadoin](https://github.com/Aeadoin)) 2022-11-28
|
||||
* Add Data Bucket support to Bot Spell Entries. ([#2505](https://github.com/EQEmu/Server/pull/2505)) ([Aeadoin](https://github.com/Aeadoin)) 2022-11-06
|
||||
* Add EVENT_TRADE Support to Bots. ([#2560](https://github.com/EQEmu/Server/pull/2560)) ([Aeadoin](https://github.com/Aeadoin)) 2022-11-25
|
||||
* Add Event_Trade Support for ^inventorygive Command ([#2628](https://github.com/EQEmu/Server/pull/2628)) ([Aeadoin](https://github.com/Aeadoin)) 2022-12-11
|
||||
* Add Expansion Bitmask Quest APIs. ([#2523](https://github.com/EQEmu/Server/pull/2523)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-16
|
||||
* Add GetBotOwnerByBotID Method ([#2715](https://github.com/EQEmu/Server/pull/2715)) ([Aeadoin](https://github.com/Aeadoin)) 2023-01-11
|
||||
* Add Melee Support for Casting, Cleanup Bot Casting Logic ([#2571](https://github.com/EQEmu/Server/pull/2571)) ([Aeadoin](https://github.com/Aeadoin)) 2022-11-25
|
||||
* Add Quest API Methods ([#2631](https://github.com/EQEmu/Server/pull/2631)) ([Aeadoin](https://github.com/Aeadoin)) 2022-12-12
|
||||
* Add Quest API Support for Limits. ([#2522](https://github.com/EQEmu/Server/pull/2522)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-17
|
||||
* Add Rule Allowing Bots to Equip Any Race Items ([#2578](https://github.com/EQEmu/Server/pull/2578)) ([Aeadoin](https://github.com/Aeadoin)) 2022-11-26
|
||||
* Add Support for AA bonuses that were missing. ([#2764](https://github.com/EQEmu/Server/pull/2764)) ([Aeadoin](https://github.com/Aeadoin)) 2023-01-20
|
||||
* Add Support for Bots to receive Auras, and other AoE Buffs. ([#2586](https://github.com/EQEmu/Server/pull/2586)) ([Aeadoin](https://github.com/Aeadoin)) 2022-11-27
|
||||
* Add Virtual Override for Bot::Attack ([#2771](https://github.com/EQEmu/Server/pull/2771)) ([Aeadoin](https://github.com/Aeadoin)) 2023-01-20
|
||||
* Add give/remove saylinks to ^itemuse. ([#2503](https://github.com/EQEmu/Server/pull/2503)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-10-30
|
||||
* Add support for Bot scripting. ([#2515](https://github.com/EQEmu/Server/pull/2515)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-17
|
||||
* Apply Spells:IgnoreSpellDmgLvlRestriction to bots ([#2024](https://github.com/EQEmu/Server/pull/2024)) ([catapultam-habeo](https://github.com/catapultam-habeo)) 2022-03-07
|
||||
* Bot::PerformTradeWithClient Cleanup. ([#2084](https://github.com/EQEmu/Server/pull/2084)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-01
|
||||
* Cleanup Bot Spell Functions, reduce reliance on NPC Functions/Attributes ([#2495](https://github.com/EQEmu/Server/pull/2495)) ([Aeadoin](https://github.com/Aeadoin)) 2022-10-29
|
||||
* Cleanup Fast Rest Regen ([#2626](https://github.com/EQEmu/Server/pull/2626)) ([Aeadoin](https://github.com/Aeadoin)) 2022-12-07
|
||||
* Cleanup Say Event Parse. ([#2557](https://github.com/EQEmu/Server/pull/2557)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-20
|
||||
* Cleanup Spell Settings Commands ([#2607](https://github.com/EQEmu/Server/pull/2607)) ([Aeadoin](https://github.com/Aeadoin)) 2022-12-04
|
||||
* Cleanup ^inventoryremove, ^inventorylist, and ^list Commands and bot groups. ([#2273](https://github.com/EQEmu/Server/pull/2273)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-07-03
|
||||
* Cleanup and remove preprocessors. ([#2757](https://github.com/EQEmu/Server/pull/2757)) ([Kinglykrab](https://github.com/Kinglykrab)) 2023-01-20
|
||||
* Cleanup various Bot Spell Focus methods ([#2649](https://github.com/EQEmu/Server/pull/2649)) ([Aeadoin](https://github.com/Aeadoin)) 2022-12-16
|
||||
* Convert Load, Save, SaveNew, and Delete to Repositories. ([#2614](https://github.com/EQEmu/Server/pull/2614)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-12-04
|
||||
* Expanded Bot Spell Settings List. ([#2606](https://github.com/EQEmu/Server/pull/2606)) ([Aeadoin](https://github.com/Aeadoin)) 2022-12-03
|
||||
* Fix Bot Spell Type "In Combat Buffs" ([#2711](https://github.com/EQEmu/Server/pull/2711)) ([Aeadoin](https://github.com/Aeadoin)) 2023-01-08
|
||||
* Fix Gender not saving as GetBaseGender on BotSave ([#2639](https://github.com/EQEmu/Server/pull/2639)) ([nytmyr](https://github.com/nytmyr)) 2022-12-13
|
||||
* Fix Slow Query in QueryNameAvailablity ([#2781](https://github.com/EQEmu/Server/pull/2781)) ([Aeadoin](https://github.com/Aeadoin)) 2023-01-22
|
||||
* Fix ^dyearmor command math. ([#2081](https://github.com/EQEmu/Server/pull/2081)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-04-30
|
||||
* Fix bot spawn when bot id = char_id ([#1984](https://github.com/EQEmu/Server/pull/1984)) ([neckkola](https://github.com/neckkola)) 2022-03-07
|
||||
* Hotfix for possible crash. ([#2539](https://github.com/EQEmu/Server/pull/2539)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-14
|
||||
* Melee Bot Support for Spell Settings Commands ([#2599](https://github.com/EQEmu/Server/pull/2599)) ([Aeadoin](https://github.com/Aeadoin)) 2022-12-01
|
||||
* Move Bot Spell Loading process to constructor from calcbotstats() ([#2583](https://github.com/EQEmu/Server/pull/2583)) ([Aeadoin](https://github.com/Aeadoin)) 2022-11-27
|
||||
* Optimize inventory loading. ([#2588](https://github.com/EQEmu/Server/pull/2588)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-28
|
||||
* Post pre-processor fixes ([#2770](https://github.com/EQEmu/Server/pull/2770)) ([Akkadius](https://github.com/Akkadius)) 2023-01-20
|
||||
* Resolve incorrect values on Bot Creation ([#2644](https://github.com/EQEmu/Server/pull/2644)) ([Aeadoin](https://github.com/Aeadoin)) 2022-12-14
|
||||
* Restrict Bot Groups from spawning while Feigned. ([#2761](https://github.com/EQEmu/Server/pull/2761)) ([Aeadoin](https://github.com/Aeadoin)) 2023-01-19
|
||||
* Save Bot Toggle Archer Setting between Loads. ([#2612](https://github.com/EQEmu/Server/pull/2612)) ([Aeadoin](https://github.com/Aeadoin)) 2022-12-04
|
||||
* Update Bot Heal & Damage methods to more closely match Clients + Bugfixes ([#2045](https://github.com/EQEmu/Server/pull/2045)) ([catapultam-habeo](https://github.com/catapultam-habeo)) 2022-03-11
|
||||
* Update Bot Logic to ignore ST_TargetsTarget when buffing ([#2584](https://github.com/EQEmu/Server/pull/2584)) ([Aeadoin](https://github.com/Aeadoin)) 2022-11-27
|
||||
|
||||
### Bug
|
||||
|
||||
* Fixed trade items record log ([#2003](https://github.com/EQEmu/Server/pull/2003)) ([cybernine186](https://github.com/cybernine186)) 2022-02-17
|
||||
* Loot Drop Randomization adjustment ([#2368](https://github.com/EQEmu/Server/pull/2368)) ([fryguy503](https://github.com/fryguy503)) 2022-08-31
|
||||
* UINT32 EmoteID ([#2369](https://github.com/EQEmu/Server/pull/2369)) ([fryguy503](https://github.com/fryguy503)) 2022-08-13
|
||||
|
||||
### Bug Fix
|
||||
|
||||
* Boats should never get FixZ'd ([#2246](https://github.com/EQEmu/Server/pull/2246)) ([noudess](https://github.com/noudess)) 2022-07-02
|
||||
* Clamp Item Ldon Sell Back Rates. ([#2592](https://github.com/EQEmu/Server/pull/2592)) ([Aeadoin](https://github.com/Aeadoin)) 2022-11-30
|
||||
* Zone Flags Regression ([#2760](https://github.com/EQEmu/Server/pull/2760)) ([Akkadius](https://github.com/Akkadius)) 2023-01-19
|
||||
|
||||
### C++20
|
||||
|
||||
* Arithmetic on different enums is deprecated ([#2752](https://github.com/EQEmu/Server/pull/2752)) ([mackal](https://github.com/mackal)) 2023-01-17
|
||||
* Enable C++20 + Fixes + FMT 9.1 ([#2664](https://github.com/EQEmu/Server/pull/2664)) ([Akkadius](https://github.com/Akkadius)) 2022-12-21
|
||||
|
||||
### CI
|
||||
|
||||
* Hook tests back up ([#2316](https://github.com/EQEmu/Server/pull/2316)) ([Akkadius](https://github.com/Akkadius)) 2022-07-27
|
||||
|
||||
### CPP
|
||||
|
||||
* Update C++ standard to C++17 ([#2308](https://github.com/EQEmu/Server/pull/2308)) ([mackal](https://github.com/mackal)) 2022-07-27
|
||||
|
||||
### Cereal
|
||||
|
||||
* Bump to v1.3.2 from v1.2.2 ([#2654](https://github.com/EQEmu/Server/pull/2654)) ([Akkadius](https://github.com/Akkadius)) 2022-12-20
|
||||
|
||||
### Client
|
||||
|
||||
* Fix IsMoving for Client ([#2318](https://github.com/EQEmu/Server/pull/2318)) ([Akkadius](https://github.com/Akkadius)) 2022-07-27
|
||||
* Remove unimplemented Client Insight Method. ([#2663](https://github.com/EQEmu/Server/pull/2663)) ([Aeadoin](https://github.com/Aeadoin)) 2022-12-21
|
||||
|
||||
### Code
|
||||
|
||||
* Removed vscode setting ([#2753](https://github.com/EQEmu/Server/pull/2753)) ([xackery](https://github.com/xackery)) 2023-01-17
|
||||
|
||||
### Code Cleanup
|
||||
|
||||
* Add Validation to varchar number item fields. ([#2241](https://github.com/EQEmu/Server/pull/2241)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-06-04
|
||||
* Cleanup #kick message. ([#2164](https://github.com/EQEmu/Server/pull/2164)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-10
|
||||
* Cleanup Haste references and Lua API calls for unsigned to signed. ([#2240](https://github.com/EQEmu/Server/pull/2240)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-06-04
|
||||
* Cleanup code smells and compiler warnings in common/shareddb ([#2270](https://github.com/EQEmu/Server/pull/2270)) ([Quintinon](https://github.com/Quintinon)) 2022-07-03
|
||||
* Cleanup magic numbers ([#2662](https://github.com/EQEmu/Server/pull/2662)) ([Aeadoin](https://github.com/Aeadoin)) 2022-12-20
|
||||
* Cleanup spell and max level bucket logic. ([#2181](https://github.com/EQEmu/Server/pull/2181)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-28
|
||||
* Extra Space in NPC::AISpellsList(). ([#2555](https://github.com/EQEmu/Server/pull/2555)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-20
|
||||
* Fix unintended copies in zone/zonedb.cpp by changing auto to auto& ([#2271](https://github.com/EQEmu/Server/pull/2271)) ([Quintinon](https://github.com/Quintinon)) 2022-07-03
|
||||
* Make use of std::abs where possible. ([#2739](https://github.com/EQEmu/Server/pull/2739)) ([Kinglykrab](https://github.com/Kinglykrab)) 2023-01-15
|
||||
* Merge Client::Attack and Bot::Attack into Mob::Attack ([#2756](https://github.com/EQEmu/Server/pull/2756)) ([Aeadoin](https://github.com/Aeadoin)) 2023-01-20
|
||||
* Move Client::Undye() to client.cpp from #path Command. ([#2188](https://github.com/EQEmu/Server/pull/2188)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-21
|
||||
* Possible issues with variable/parameter name equality. ([#2161](https://github.com/EQEmu/Server/pull/2161)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-10
|
||||
* Quest API push methods using invalid types. ([#2172](https://github.com/EQEmu/Server/pull/2172)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-16
|
||||
* Remove unused basic_functions.h ([#2729](https://github.com/EQEmu/Server/pull/2729)) ([Kinglykrab](https://github.com/Kinglykrab)) 2023-01-13
|
||||
* Remove unused maxskill.h. ([#2728](https://github.com/EQEmu/Server/pull/2728)) ([Kinglykrab](https://github.com/Kinglykrab)) 2023-01-13
|
||||
* Remove unused methods. ([#2171](https://github.com/EQEmu/Server/pull/2171)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-15
|
||||
* Remove unusued Max Item ID Constant ([#2528](https://github.com/EQEmu/Server/pull/2528)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-08
|
||||
* Rework Lua QuestReward to not use try/catch blocks ([#2417](https://github.com/EQEmu/Server/pull/2417)) ([mackal](https://github.com/mackal)) 2022-09-03
|
||||
* Send eqstr message in AddAAPoints ([#2507](https://github.com/EQEmu/Server/pull/2507)) ([hgtw](https://github.com/hgtw)) 2022-10-29
|
||||
* Update to EQEmu #2253 to clean up message strings ([#2279](https://github.com/EQEmu/Server/pull/2279)) ([fryguy503](https://github.com/fryguy503)) 2022-07-03
|
||||
|
||||
### Combat
|
||||
|
||||
* /shield command "too far away message" ([#1999](https://github.com/EQEmu/Server/pull/1999)) ([KayenEQ](https://github.com/KayenEQ)) 2022-02-14
|
||||
* Basic Combat Recording ([#2090](https://github.com/EQEmu/Server/pull/2090)) ([Akkadius](https://github.com/Akkadius)) 2022-05-01
|
||||
* Fix Frenzy vs opponents immune to non-magic ([#2095](https://github.com/EQEmu/Server/pull/2095)) ([noudess](https://github.com/noudess)) 2022-05-03
|
||||
* Fix shield calculation ([#2234](https://github.com/EQEmu/Server/pull/2234)) ([Quintinon](https://github.com/Quintinon)) 2022-06-01
|
||||
* Legacy Combat Middleware Affected by PR #1858 ([#1939](https://github.com/EQEmu/Server/pull/1939)) ([Akkadius](https://github.com/Akkadius)) 2022-01-30
|
||||
|
||||
### Commands
|
||||
|
||||
* #bind Typo. ([#2196](https://github.com/EQEmu/Server/pull/2196)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-23
|
||||
* #ginfo Cleanup. ([#1955](https://github.com/EQEmu/Server/pull/1955)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-02-03
|
||||
* #reload Command Overhaul. ([#2162](https://github.com/EQEmu/Server/pull/2162)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-10
|
||||
* #reload level_mods could cause Non-Booted zones to crash. ([#2670](https://github.com/EQEmu/Server/pull/2670)) ([Aeadoin](https://github.com/Aeadoin)) 2022-12-24
|
||||
* Add #bugs Command. ([#2559](https://github.com/EQEmu/Server/pull/2559)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-22
|
||||
* Add #feature Command. ([#2142](https://github.com/EQEmu/Server/pull/2142)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-06
|
||||
* Add #findcharacter Command. ([#2692](https://github.com/EQEmu/Server/pull/2692)) ([Kinglykrab](https://github.com/Kinglykrab)) 2023-01-03
|
||||
* Add #findrecipe and #viewrecipe Commands. ([#2401](https://github.com/EQEmu/Server/pull/2401)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-08-31
|
||||
* Add #setanon Command ([#2690](https://github.com/EQEmu/Server/pull/2690)) ([Kinglykrab](https://github.com/Kinglykrab)) 2023-01-03
|
||||
* Add #suspendmulti Command. ([#2619](https://github.com/EQEmu/Server/pull/2619)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-12-11
|
||||
* Add BestZ and Region Data to #loc ([#2245](https://github.com/EQEmu/Server/pull/2245)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-06-05
|
||||
* Add additional #peqzone functionality. ([#2085](https://github.com/EQEmu/Server/pull/2085)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-01
|
||||
* Add max_hp back to #modifynpcstat command. ([#2638](https://github.com/EQEmu/Server/pull/2638)) ([nytmyr](https://github.com/nytmyr)) 2022-12-13
|
||||
* Adding movespeed to #showstats output ([#2596](https://github.com/EQEmu/Server/pull/2596)) ([fryguy503](https://github.com/fryguy503)) 2022-11-30
|
||||
* Bug fix for #logs command. ([#2008](https://github.com/EQEmu/Server/pull/2008)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-02-17
|
||||
* Cleanup #ai Command. ([#1980](https://github.com/EQEmu/Server/pull/1980)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-02-11
|
||||
* Cleanup #appearanceeffects Command. ([#2777](https://github.com/EQEmu/Server/pull/2777)) ([Kinglykrab](https://github.com/Kinglykrab)) 2023-01-22
|
||||
* Cleanup #attack Command. ([#2103](https://github.com/EQEmu/Server/pull/2103)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-04
|
||||
* Cleanup #ban, #ipban, #flag, #kick, #setlsinfo, and #setpass Commands. ([#2104](https://github.com/EQEmu/Server/pull/2104)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-08
|
||||
* Cleanup #chat Command. ([#2581](https://github.com/EQEmu/Server/pull/2581)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-27
|
||||
* Cleanup #corpsefix Command. ([#2197](https://github.com/EQEmu/Server/pull/2197)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-27
|
||||
* Cleanup #cvs Command. ([#2153](https://github.com/EQEmu/Server/pull/2153)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-08
|
||||
* Cleanup #date Command. ([#2228](https://github.com/EQEmu/Server/pull/2228)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-06-01
|
||||
* Cleanup #dbspawn2 Command. ([#2493](https://github.com/EQEmu/Server/pull/2493)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-10-30
|
||||
* Cleanup #delacct Command. ([#2567](https://github.com/EQEmu/Server/pull/2567)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-22
|
||||
* Cleanup #depop Command. ([#2536](https://github.com/EQEmu/Server/pull/2536)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-14
|
||||
* Cleanup #depopzone Command. ([#2537](https://github.com/EQEmu/Server/pull/2537)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-14
|
||||
* Cleanup #devtools Command. ([#2538](https://github.com/EQEmu/Server/pull/2538)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-14
|
||||
* Cleanup #doanim Command. ([#2540](https://github.com/EQEmu/Server/pull/2540)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-14
|
||||
* Cleanup #emote Command. ([#2535](https://github.com/EQEmu/Server/pull/2535)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-14
|
||||
* Cleanup #emotesearch and #emoteview Command. ([#2494](https://github.com/EQEmu/Server/pull/2494)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-10-30
|
||||
* Cleanup #emptyinventory Command. ([#2219](https://github.com/EQEmu/Server/pull/2219)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-29
|
||||
* Cleanup #findaliases and #help Commands. ([#2204](https://github.com/EQEmu/Server/pull/2204)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-27
|
||||
* Cleanup #findclass and #findrace Commands. ([#2211](https://github.com/EQEmu/Server/pull/2211)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-27
|
||||
* Cleanup #flagedit Command. ([#1968](https://github.com/EQEmu/Server/pull/1968)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-02-10
|
||||
* Cleanup #freeze and #unfreeze Commands. ([#2102](https://github.com/EQEmu/Server/pull/2102)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-04
|
||||
* Cleanup #gassign Command. ([#2101](https://github.com/EQEmu/Server/pull/2101)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-06
|
||||
* Cleanup #gearup Command. ([#2589](https://github.com/EQEmu/Server/pull/2589)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-27
|
||||
* Cleanup #getvariable Command. ([#2100](https://github.com/EQEmu/Server/pull/2100)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-04
|
||||
* Cleanup #guild Command ([#2693](https://github.com/EQEmu/Server/pull/2693)) ([Kinglykrab](https://github.com/Kinglykrab)) 2023-01-04
|
||||
* Cleanup #hatelist Command. ([#1976](https://github.com/EQEmu/Server/pull/1976)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-02-10
|
||||
* Cleanup #heromodel Command. ([#2566](https://github.com/EQEmu/Server/pull/2566)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-22
|
||||
* Cleanup #kill Command. ([#2195](https://github.com/EQEmu/Server/pull/2195)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-23
|
||||
* Cleanup #level Command. ([#2203](https://github.com/EQEmu/Server/pull/2203)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-27
|
||||
* Cleanup #logs Command. ([#1969](https://github.com/EQEmu/Server/pull/1969)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-02-10
|
||||
* Cleanup #makepet Command. ([#2105](https://github.com/EQEmu/Server/pull/2105)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #modifynpcstat Command. ([#2499](https://github.com/EQEmu/Server/pull/2499)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-10-30
|
||||
* Cleanup #motd Command. ([#2190](https://github.com/EQEmu/Server/pull/2190)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-23
|
||||
* Cleanup #name Command. ([#1977](https://github.com/EQEmu/Server/pull/1977)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-02-10
|
||||
* Cleanup #netstats Command. ([#1970](https://github.com/EQEmu/Server/pull/1970)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-02-10
|
||||
* Cleanup #npcedit Command. ([#2582](https://github.com/EQEmu/Server/pull/2582)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-27
|
||||
* Cleanup #npcedit, #lastname, #title, and #titlesuffix Commands. ([#2215](https://github.com/EQEmu/Server/pull/2215)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-28
|
||||
* Cleanup #npceditmass command. ([#1957](https://github.com/EQEmu/Server/pull/1957)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-02-03
|
||||
* Cleanup #npcemote Command. ([#2106](https://github.com/EQEmu/Server/pull/2106)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #npcloot Command. ([#1974](https://github.com/EQEmu/Server/pull/1974)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-02-11
|
||||
* Cleanup #npcsay and #npcshout Commands. ([#2107](https://github.com/EQEmu/Server/pull/2107)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #npcspecialattk Command. ([#2108](https://github.com/EQEmu/Server/pull/2108)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #npctype_cache Command. ([#2109](https://github.com/EQEmu/Server/pull/2109)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #npctypespawn Command. ([#2110](https://github.com/EQEmu/Server/pull/2110)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #nudge Command. ([#2220](https://github.com/EQEmu/Server/pull/2220)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-29
|
||||
* Cleanup #oocmute Command. ([#2191](https://github.com/EQEmu/Server/pull/2191)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-27
|
||||
* Cleanup #opcode Command. ([#2547](https://github.com/EQEmu/Server/pull/2547)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-16
|
||||
* Cleanup #profanity Command. ([#2113](https://github.com/EQEmu/Server/pull/2113)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #push Command. ([#2114](https://github.com/EQEmu/Server/pull/2114)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #qglobal Command. ([#2115](https://github.com/EQEmu/Server/pull/2115)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #randomizefeatures Command. ([#2118](https://github.com/EQEmu/Server/pull/2118)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #refreshgroup Command. ([#2119](https://github.com/EQEmu/Server/pull/2119)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #reloadaa Command. ([#2120](https://github.com/EQEmu/Server/pull/2120)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #reloadallrules Command. ([#2121](https://github.com/EQEmu/Server/pull/2121)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #reloadlevelmods Command. ([#2122](https://github.com/EQEmu/Server/pull/2122)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #reloadmerchants Command. ([#2123](https://github.com/EQEmu/Server/pull/2123)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #reloadperlexportsettings Command. ([#2124](https://github.com/EQEmu/Server/pull/2124)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #reloadrulesworld Command. ([#2128](https://github.com/EQEmu/Server/pull/2128)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #reloadstatic Command. ([#2130](https://github.com/EQEmu/Server/pull/2130)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #reloadtitles Command. ([#2125](https://github.com/EQEmu/Server/pull/2125)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #reloadtraps Command. ([#2126](https://github.com/EQEmu/Server/pull/2126)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #reloadworld and #repop Command. ([#2127](https://github.com/EQEmu/Server/pull/2127)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #reloadzps Command. ([#2129](https://github.com/EQEmu/Server/pull/2129)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #resetaa Command. ([#2132](https://github.com/EQEmu/Server/pull/2132)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #resetaa_timer Command. ([#2131](https://github.com/EQEmu/Server/pull/2131)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #resetdisc_timer Command. ([#2133](https://github.com/EQEmu/Server/pull/2133)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-06
|
||||
* Cleanup #revoke Command. ([#2134](https://github.com/EQEmu/Server/pull/2134)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #roambox Command. ([#2135](https://github.com/EQEmu/Server/pull/2135)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-06
|
||||
* Cleanup #rules Command. ([#2593](https://github.com/EQEmu/Server/pull/2593)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-12-10
|
||||
* Cleanup #save Command. ([#2136](https://github.com/EQEmu/Server/pull/2136)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-06
|
||||
* Cleanup #scale Command. ([#2591](https://github.com/EQEmu/Server/pull/2591)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-12-05
|
||||
* Cleanup #scribespell and #scribespells Commands. ([#2534](https://github.com/EQEmu/Server/pull/2534)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-14
|
||||
* Cleanup #sensetrap Command. ([#2137](https://github.com/EQEmu/Server/pull/2137)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #serverinfo Command. ([#2568](https://github.com/EQEmu/Server/pull/2568)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-22
|
||||
* Cleanup #serverrules Command. ([#2139](https://github.com/EQEmu/Server/pull/2139)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-06
|
||||
* Cleanup #setlanguage Command. ([#2464](https://github.com/EQEmu/Server/pull/2464)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-10-13
|
||||
* Cleanup #setskillall Command. ([#1992](https://github.com/EQEmu/Server/pull/1992)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-02-15
|
||||
* Cleanup #shownpcgloballoot and #showzonegloballoot Command. ([#2141](https://github.com/EQEmu/Server/pull/2141)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-06
|
||||
* Cleanup #showskills Command. ([#1994](https://github.com/EQEmu/Server/pull/1994)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-02-15
|
||||
* Cleanup #spawneditmass Command. ([#2229](https://github.com/EQEmu/Server/pull/2229)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-06-04
|
||||
* Cleanup #spawnfix Command. ([#2143](https://github.com/EQEmu/Server/pull/2143)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-06
|
||||
* Cleanup #spawnstatus Command. ([#2144](https://github.com/EQEmu/Server/pull/2144)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-06
|
||||
* Cleanup #summon Command. ([#2145](https://github.com/EQEmu/Server/pull/2145)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-06
|
||||
* Cleanup #summonburiedplayercorpse Command. ([#2146](https://github.com/EQEmu/Server/pull/2146)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #suspend Command. ([#2564](https://github.com/EQEmu/Server/pull/2564)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-22
|
||||
* Cleanup #task Command. ([#2071](https://github.com/EQEmu/Server/pull/2071)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-04-14
|
||||
* Cleanup #time and #timezone Command. ([#2147](https://github.com/EQEmu/Server/pull/2147)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #timers Command. ([#2562](https://github.com/EQEmu/Server/pull/2562)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-22
|
||||
* Cleanup #trapinfo Command. ([#2148](https://github.com/EQEmu/Server/pull/2148)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #ucs Command. ([#2149](https://github.com/EQEmu/Server/pull/2149)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Cleanup #undye and #undyeme Commands. ([#1966](https://github.com/EQEmu/Server/pull/1966)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-02-10
|
||||
* Cleanup #unscribespell Command. ([#1998](https://github.com/EQEmu/Server/pull/1998)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-02-16
|
||||
* Cleanup #untraindisc Command. ([#1996](https://github.com/EQEmu/Server/pull/1996)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-02-16
|
||||
* Cleanup #version Command. ([#1967](https://github.com/EQEmu/Server/pull/1967)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-02-10
|
||||
* Cleanup #worldwide command. ([#2021](https://github.com/EQEmu/Server/pull/2021)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-03-01
|
||||
* Cleanup #xtargets Command. ([#2545](https://github.com/EQEmu/Server/pull/2545)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-17
|
||||
* Cleanup #zone and #zoneinstance Commands. ([#2202](https://github.com/EQEmu/Server/pull/2202)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-27
|
||||
* Command Status Reload and Helper Method ([#2377](https://github.com/EQEmu/Server/pull/2377)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-08-20
|
||||
* Consolidate #lock and #unlock Commands into #serverlock. ([#2193](https://github.com/EQEmu/Server/pull/2193)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-23
|
||||
* Fix #copycharacter command crash ([#2446](https://github.com/EQEmu/Server/pull/2446)) ([Akkadius](https://github.com/Akkadius)) 2022-09-25
|
||||
* Fix #killallnpcs from crashing ([#2037](https://github.com/EQEmu/Server/pull/2037)) ([Akkadius](https://github.com/Akkadius)) 2022-03-07
|
||||
* Fix Flymode Command Help Prompt ([#2669](https://github.com/EQEmu/Server/pull/2669)) ([Aeadoin](https://github.com/Aeadoin)) 2022-12-23
|
||||
* Fix typos in #ban and #ipban Commands. ([#2209](https://github.com/EQEmu/Server/pull/2209)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-26
|
||||
* Make #damage require a target ([#2426](https://github.com/EQEmu/Server/pull/2426)) ([hgtw](https://github.com/hgtw)) 2022-09-05
|
||||
* Nested Command Aliases ([#2636](https://github.com/EQEmu/Server/pull/2636)) ([Akkadius](https://github.com/Akkadius)) 2022-12-15
|
||||
* Remove #guildapprove, #guildcreate, and #guildlist Commands ([#2775](https://github.com/EQEmu/Server/pull/2775)) ([Kinglykrab](https://github.com/Kinglykrab)) 2023-01-22
|
||||
* Remove #iteminfo Command. ([#2565](https://github.com/EQEmu/Server/pull/2565)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-22
|
||||
* Remove #profiledump and #profilereset Commands. ([#2546](https://github.com/EQEmu/Server/pull/2546)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-16
|
||||
* Remove #undyeme Command. ([#2776](https://github.com/EQEmu/Server/pull/2776)) ([Kinglykrab](https://github.com/Kinglykrab)) 2023-01-22
|
||||
* Remove unused #bestz and #pf Commands. ([#2112](https://github.com/EQEmu/Server/pull/2112)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Remove unused/broken #deletegraveyard and #setgraveyard Commands. ([#2198](https://github.com/EQEmu/Server/pull/2198)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-23
|
||||
|
||||
### Compile
|
||||
|
||||
* Decrease build times using unity build strategy ([#2089](https://github.com/EQEmu/Server/pull/2089)) ([Akkadius](https://github.com/Akkadius)) 2022-05-01
|
||||
|
||||
### Crash
|
||||
|
||||
* Fix reload crashes ([#2462](https://github.com/EQEmu/Server/pull/2462)) ([Akkadius](https://github.com/Akkadius)) 2022-09-30
|
||||
* Fix spawn race condition shown by #repop ([#2455](https://github.com/EQEmu/Server/pull/2455)) ([Akkadius](https://github.com/Akkadius)) 2022-09-29
|
||||
* Linux Crash Dump Improvements ([#2296](https://github.com/EQEmu/Server/pull/2296)) ([Akkadius](https://github.com/Akkadius)) 2022-07-14
|
||||
* Pointer validation in mob iteration loops ([#2490](https://github.com/EQEmu/Server/pull/2490)) ([Akkadius](https://github.com/Akkadius)) 2022-10-15
|
||||
* Stability Fixes ([#2489](https://github.com/EQEmu/Server/pull/2489)) ([Akkadius](https://github.com/Akkadius)) 2022-10-15
|
||||
* Websocket Crash fix race when fetching log categories ([#2456](https://github.com/EQEmu/Server/pull/2456)) ([Akkadius](https://github.com/Akkadius)) 2022-09-29
|
||||
|
||||
### Database
|
||||
|
||||
* Add Primary ID Keys to Tables ([#2036](https://github.com/EQEmu/Server/pull/2036)) ([Akkadius](https://github.com/Akkadius)) 2022-03-07
|
||||
* Add fallback migration for logsys columns ([#2457](https://github.com/EQEmu/Server/pull/2457)) ([Akkadius](https://github.com/Akkadius)) 2022-09-29
|
||||
* Update 2022_01_10_checksum_verification.sql ([#2041](https://github.com/EQEmu/Server/pull/2041)) ([joligario](https://github.com/joligario)) 2022-03-07
|
||||
|
||||
### Diawind
|
||||
|
||||
* Plus sign markdown fix ([#2727](https://github.com/EQEmu/Server/pull/2727)) ([Akkadius](https://github.com/Akkadius)) 2023-01-12
|
||||
|
||||
### Doors
|
||||
|
||||
* Fix Misty PoK Stone ([#2482](https://github.com/EQEmu/Server/pull/2482)) ([Akkadius](https://github.com/Akkadius)) 2022-10-14
|
||||
* Fix Neriak PoK Stone ([#2486](https://github.com/EQEmu/Server/pull/2486)) ([Coreidan](https://github.com/Coreidan)) 2022-10-15
|
||||
* Fix door target zone heading data ([#2414](https://github.com/EQEmu/Server/pull/2414)) ([Akkadius](https://github.com/Akkadius)) 2022-09-05
|
||||
* Improvements to door manipulation ([#2370](https://github.com/EQEmu/Server/pull/2370)) ([Akkadius](https://github.com/Akkadius)) 2022-08-13
|
||||
|
||||
### Drone
|
||||
|
||||
* Speed up drone builds ([#2092](https://github.com/EQEmu/Server/pull/2092)) ([Akkadius](https://github.com/Akkadius)) 2022-05-02
|
||||
|
||||
### Expansions
|
||||
|
||||
* Expansion Deprecation Revert ([#2312](https://github.com/EQEmu/Server/pull/2312)) ([Akkadius](https://github.com/Akkadius)) 2022-07-15
|
||||
* Zone expansion consistency changes ([#2380](https://github.com/EQEmu/Server/pull/2380)) ([Akkadius](https://github.com/Akkadius)) 2022-08-22
|
||||
|
||||
### Experience
|
||||
|
||||
* Change Exp Calculations to be 64 bit where needed. ([#2677](https://github.com/EQEmu/Server/pull/2677)) ([Aeadoin](https://github.com/Aeadoin)) 2022-12-31
|
||||
|
||||
### Feature
|
||||
|
||||
* AA Cap Limit ([#2423](https://github.com/EQEmu/Server/pull/2423)) ([fryguy503](https://github.com/fryguy503)) 2022-10-13
|
||||
* Add "Keeps Sold Items" Flag to NPCs ([#2671](https://github.com/EQEmu/Server/pull/2671)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-12-25
|
||||
* Add Experience Gain Toggle. ([#2676](https://github.com/EQEmu/Server/pull/2676)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-12-30
|
||||
* Add Guild Chat to Console. ([#2387](https://github.com/EQEmu/Server/pull/2387)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-08-22
|
||||
* Add Hate Override for Heals ([#2485](https://github.com/EQEmu/Server/pull/2485)) ([Aeadoin](https://github.com/Aeadoin)) 2022-10-14
|
||||
* Add Rule to Disable Group EXP Modifier. ([#2741](https://github.com/EQEmu/Server/pull/2741)) ([Kinglykrab](https://github.com/Kinglykrab)) 2023-01-15
|
||||
* Add Support for "Show Mine Only" Filters ([#2484](https://github.com/EQEmu/Server/pull/2484)) ([Aeadoin](https://github.com/Aeadoin)) 2022-10-13
|
||||
* Add Type 49545 to Spell Resistrictions ([#2436](https://github.com/EQEmu/Server/pull/2436)) ([Aeadoin](https://github.com/Aeadoin)) 2022-09-20
|
||||
* Add humanoid and non-wielded restrictions to pick pocket ([#2276](https://github.com/EQEmu/Server/pull/2276)) ([noudess](https://github.com/noudess)) 2022-07-03
|
||||
* Add player /inspect quest event ([#2508](https://github.com/EQEmu/Server/pull/2508)) ([hgtw](https://github.com/hgtw)) 2022-10-29
|
||||
* Add special ability to block /open ([#2506](https://github.com/EQEmu/Server/pull/2506)) ([hgtw](https://github.com/hgtw)) 2022-10-29
|
||||
* Allow Focus Effects to be Filtered out. ([#2447](https://github.com/EQEmu/Server/pull/2447)) ([Aeadoin](https://github.com/Aeadoin)) 2022-09-25
|
||||
* Allow pets to zone with permanent (buffdurationformula 50) buffs to maintain them through zone transitions ([#2035](https://github.com/EQEmu/Server/pull/2035)) ([catapultam-habeo](https://github.com/catapultam-habeo)) 2022-03-07
|
||||
* Bind Wound and Forage while mounted. ([#2257](https://github.com/EQEmu/Server/pull/2257)) ([fryguy503](https://github.com/fryguy503)) 2022-07-03
|
||||
* Change #scribespells to be aware of spellgroups & ranks ([#2501](https://github.com/EQEmu/Server/pull/2501)) ([Aeadoin](https://github.com/Aeadoin)) 2022-11-06
|
||||
* Change GetSkillDmgAmt to int32 ([#2364](https://github.com/EQEmu/Server/pull/2364)) ([Aeadoin](https://github.com/Aeadoin)) 2022-08-10
|
||||
* Change Lifetap Emotes to be filterable. ([#2454](https://github.com/EQEmu/Server/pull/2454)) ([Aeadoin](https://github.com/Aeadoin)) 2022-09-29
|
||||
* Change Mana Costs to use Signed Int ([#2384](https://github.com/EQEmu/Server/pull/2384)) ([Aeadoin](https://github.com/Aeadoin)) 2022-08-21
|
||||
* Change mana_used to int32 ([#2321](https://github.com/EQEmu/Server/pull/2321)) ([Aeadoin](https://github.com/Aeadoin)) 2022-07-30
|
||||
* Client Checksum Verification (Resubmit old 1678) ([#1922](https://github.com/EQEmu/Server/pull/1922)) ([noudess](https://github.com/noudess)) 2022-03-07
|
||||
* EQ2-style implied targeting for spells. ([#2032](https://github.com/EQEmu/Server/pull/2032)) ([catapultam-habeo](https://github.com/catapultam-habeo)) 2022-03-07
|
||||
* Faction Association ([#2408](https://github.com/EQEmu/Server/pull/2408)) ([mackal](https://github.com/mackal)) 2022-09-03
|
||||
* GM State Change Persistance ([#2328](https://github.com/EQEmu/Server/pull/2328)) ([fryguy503](https://github.com/fryguy503)) 2022-07-31
|
||||
* Implement Heroic Strikethrough to NPCs ([#2395](https://github.com/EQEmu/Server/pull/2395)) ([Aeadoin](https://github.com/Aeadoin)) 2022-08-31
|
||||
* Implement OP_CashReward ([#2307](https://github.com/EQEmu/Server/pull/2307)) ([mackal](https://github.com/mackal)) 2022-07-15
|
||||
* Instance Version Specific Experience Modifiers ([#2376](https://github.com/EQEmu/Server/pull/2376)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-08-20
|
||||
* NPCs with bows and arrows do ranged attacks ([#2322](https://github.com/EQEmu/Server/pull/2322)) ([mackal](https://github.com/mackal)) 2022-07-30
|
||||
* Soft Delete Bots on Character Soft Delete ([#2467](https://github.com/EQEmu/Server/pull/2467)) ([Aeadoin](https://github.com/Aeadoin)) 2022-10-13
|
||||
* Spell Ranks will now work with AllowSpellMemorizeFromItem Rule ([#2475](https://github.com/EQEmu/Server/pull/2475)) ([Aeadoin](https://github.com/Aeadoin)) 2022-10-13
|
||||
* Update HateMod used by SPA 114 to Int32. ([#2428](https://github.com/EQEmu/Server/pull/2428)) ([Aeadoin](https://github.com/Aeadoin)) 2022-09-08
|
||||
|
||||
### Git
|
||||
|
||||
* Add Clangd Generated Files to .gitignore ([#2684](https://github.com/EQEmu/Server/pull/2684)) ([Aeadoin](https://github.com/Aeadoin)) 2022-12-31
|
||||
|
||||
### Hotfix
|
||||
|
||||
* Add Bazaar portal discs to SQL ([Akkadius](https://github.com/Akkadius)) 2022-09-05
|
||||
* Add discord_webhooks to server tables ([Akkadius](https://github.com/Akkadius)) 2022-07-03
|
||||
* Blocks are nested too deeply. ([#2689](https://github.com/EQEmu/Server/pull/2689)) ([Kinglykrab](https://github.com/Kinglykrab)) 2023-01-01
|
||||
* Cleanup #questerrors Command. ([#2116](https://github.com/EQEmu/Server/pull/2116)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-07
|
||||
* Compiling fails on FMT 9.1 with Bots ([#2665](https://github.com/EQEmu/Server/pull/2665)) ([Aeadoin](https://github.com/Aeadoin)) 2022-12-21
|
||||
* Correct database call to point to the content_db connection ([Akkadius](https://github.com/Akkadius)) 2022-06-12
|
||||
* Corrected misnamed Database Query file for Experience Toggle ([#2683](https://github.com/EQEmu/Server/pull/2683)) ([Aeadoin](https://github.com/Aeadoin)) 2022-12-31
|
||||
* Faction associations file naming / lock consistency ([Akkadius](https://github.com/Akkadius)) 2022-09-05
|
||||
* Fix DB version merge ([Akkadius](https://github.com/Akkadius)) 2022-05-08
|
||||
* Fix door click crash issue if destination zone doesn't exist ([Akkadius](https://github.com/Akkadius)) 2023-01-20
|
||||
* Fix issue with Bot Loading with 0 Health causing buffs to be lost. ([#2552](https://github.com/EQEmu/Server/pull/2552)) ([Aeadoin](https://github.com/Aeadoin)) 2022-11-18
|
||||
* Fix lua mod load path ([Akkadius](https://github.com/Akkadius)) 2022-09-29
|
||||
* Fix merge issue ([Akkadius](https://github.com/Akkadius)) 2022-07-14
|
||||
* Fix path load ordering for CLI commands ([Akkadius](https://github.com/Akkadius)) 2022-10-16
|
||||
* Fix potential race for crash dumps (Linux) ([Akkadius](https://github.com/Akkadius)) 2022-07-31
|
||||
* Fix regression caused by #2129 ([Akkadius](https://github.com/Akkadius)) 2022-05-09
|
||||
* Flipped positive / negative values for legacy_combat.lua ([Akkadius](https://github.com/Akkadius)) 2022-06-09
|
||||
* Force collation on conversion script ([Akkadius](https://github.com/Akkadius)) 2022-09-28
|
||||
* Instances Repository Fix ([#2576](https://github.com/EQEmu/Server/pull/2576)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-26
|
||||
* Login Server failing to compile on Windows. ([#2758](https://github.com/EQEmu/Server/pull/2758)) ([Aeadoin](https://github.com/Aeadoin)) 2023-01-19
|
||||
* Lua Parser Needs Lua_ItemInst ([#2696](https://github.com/EQEmu/Server/pull/2696)) ([Kinglykrab](https://github.com/Kinglykrab)) 2023-01-01
|
||||
* Make sure we have a proper split size before assuming we can split it ([Akkadius](https://github.com/Akkadius)) 2023-01-20
|
||||
* Move discord_webhooks to state tables because we don't want webhooks being exported ([Akkadius](https://github.com/Akkadius)) 2022-07-03
|
||||
* Possible windows compile fix ([Akkadius](https://github.com/Akkadius)) 2022-07-07
|
||||
* Possible windows compile fix take 2 ([Akkadius](https://github.com/Akkadius)) 2022-07-07
|
||||
* Remove appveyor fetch bots ([Akkadius](https://github.com/Akkadius)) 2023-01-21
|
||||
* Remove expansion field from account for those who have it ([#2357](https://github.com/EQEmu/Server/pull/2357)) ([Akkadius](https://github.com/Akkadius)) 2022-08-01
|
||||
* Resolve Zone Crashing when grouped with Bots. ([#2747](https://github.com/EQEmu/Server/pull/2747)) ([Aeadoin](https://github.com/Aeadoin)) 2023-01-16
|
||||
* Resolve issue with Bot Casting after zoning. ([#2617](https://github.com/EQEmu/Server/pull/2617)) ([Aeadoin](https://github.com/Aeadoin)) 2022-12-04
|
||||
* Return weather_type_map ([Akkadius](https://github.com/Akkadius)) 2022-10-14
|
||||
* SQL Update ([Akkadius](https://github.com/Akkadius)) 2022-07-31
|
||||
* Shared Memory Protection Fixes ([Akkadius](https://github.com/Akkadius)) 2022-07-27
|
||||
* Windows compile fix take 3 (final) ([Akkadius](https://github.com/Akkadius)) 2022-07-07
|
||||
* fix manifest ([Akkadius](https://github.com/Akkadius)) 2022-07-16
|
||||
|
||||
### Library
|
||||
|
||||
* Bump httplib to 0.11.2 ([#2442](https://github.com/EQEmu/Server/pull/2442)) ([Akkadius](https://github.com/Akkadius)) 2022-09-28
|
||||
|
||||
### Loading
|
||||
|
||||
* Zone Version Loading Fixes ([#2233](https://github.com/EQEmu/Server/pull/2233)) ([Akkadius](https://github.com/Akkadius)) 2022-06-01
|
||||
|
||||
### Logging
|
||||
|
||||
* Add stack trace in code paths that shouldn't occur ([#2453](https://github.com/EQEmu/Server/pull/2453)) ([Akkadius](https://github.com/Akkadius)) 2022-09-28
|
||||
* Cleanup AI Logging Events ([#2615](https://github.com/EQEmu/Server/pull/2615)) ([Aeadoin](https://github.com/Aeadoin)) 2022-12-04
|
||||
* Fix log messages to final damage values ([#2056](https://github.com/EQEmu/Server/pull/2056)) ([noudess](https://github.com/noudess)) 2022-03-14
|
||||
* Fix zoning log typo ([#2478](https://github.com/EQEmu/Server/pull/2478)) ([Akkadius](https://github.com/Akkadius)) 2022-10-11
|
||||
* Force crash logs to always be on regardless of setting ([#2762](https://github.com/EQEmu/Server/pull/2762)) ([Akkadius](https://github.com/Akkadius)) 2023-01-20
|
||||
* Improvements to GM Say Logging ([#2765](https://github.com/EQEmu/Server/pull/2765)) ([Akkadius](https://github.com/Akkadius)) 2023-01-20
|
||||
* Logging Improvements ([#2755](https://github.com/EQEmu/Server/pull/2755)) ([Akkadius](https://github.com/Akkadius)) 2023-01-18
|
||||
* More AI Logging Cleanup ([#2616](https://github.com/EQEmu/Server/pull/2616)) ([Aeadoin](https://github.com/Aeadoin)) 2022-12-10
|
||||
* Netcode Logging Unify ([#2443](https://github.com/EQEmu/Server/pull/2443)) ([Akkadius](https://github.com/Akkadius)) 2022-09-28
|
||||
* Remove function prefixes ([#2766](https://github.com/EQEmu/Server/pull/2766)) ([Akkadius](https://github.com/Akkadius)) 2023-01-20
|
||||
* Remove loginserver unhandled error ([#2458](https://github.com/EQEmu/Server/pull/2458)) ([Akkadius](https://github.com/Akkadius)) 2022-09-29
|
||||
* Reset stream so we don't bold the whole line ([Akkadius](https://github.com/Akkadius)) 2023-01-18
|
||||
* Table Injection - Member Variable Cleanup ([#2281](https://github.com/EQEmu/Server/pull/2281)) ([Akkadius](https://github.com/Akkadius)) 2022-07-07
|
||||
* Update BUILD_LOGGING=false Blank Aliases ([#2083](https://github.com/EQEmu/Server/pull/2083)) ([Akkadius](https://github.com/Akkadius)) 2022-05-01
|
||||
|
||||
### Login
|
||||
|
||||
* Added OP_ExpansionPacketData for RoF2 and update payload for Titanium ([#2186](https://github.com/EQEmu/Server/pull/2186)) ([neckkola](https://github.com/neckkola)) 2022-07-14
|
||||
|
||||
### Logs
|
||||
|
||||
* #logs list Improvements ([#2302](https://github.com/EQEmu/Server/pull/2302)) ([Akkadius](https://github.com/Akkadius)) 2022-07-14
|
||||
* Fix GMSay Log Regression ([#2298](https://github.com/EQEmu/Server/pull/2298)) ([Akkadius](https://github.com/Akkadius)) 2022-07-14
|
||||
* Have #reload logs also reload UCS logging ([#2491](https://github.com/EQEmu/Server/pull/2491)) ([Akkadius](https://github.com/Akkadius)) 2022-10-15
|
||||
|
||||
### Loot
|
||||
|
||||
* Add #lootsim (Loot Simulator) command ([#2375](https://github.com/EQEmu/Server/pull/2375)) ([Akkadius](https://github.com/Akkadius)) 2022-08-20
|
||||
* Remove unnecessary loot error messages. ([#2261](https://github.com/EQEmu/Server/pull/2261)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-06-12
|
||||
|
||||
### Luabind
|
||||
|
||||
* Silence deprecation warning ([#2657](https://github.com/EQEmu/Server/pull/2657)) ([Akkadius](https://github.com/Akkadius)) 2022-12-20
|
||||
|
||||
### Luamod
|
||||
|
||||
* Add CalcSpellEffectValue_formula to luamods ([#2721](https://github.com/EQEmu/Server/pull/2721)) ([Natedog2012](https://github.com/Natedog2012)) 2023-01-11
|
||||
|
||||
### Manifest
|
||||
|
||||
* Its not_empty not notempty ([#2394](https://github.com/EQEmu/Server/pull/2394)) ([mackal](https://github.com/mackal)) 2022-08-23
|
||||
|
||||
### Merchant
|
||||
|
||||
* LDoNSellBackRate support for Rule Merchant:EnableAltCurrencySell ([#2570](https://github.com/EQEmu/Server/pull/2570)) ([Aeadoin](https://github.com/Aeadoin)) 2022-11-25
|
||||
|
||||
### Mercs
|
||||
|
||||
* Add Mercenary Support ([#2745](https://github.com/EQEmu/Server/pull/2745)) ([Kinglykrab](https://github.com/Kinglykrab)) 2023-01-17
|
||||
|
||||
### Messages
|
||||
|
||||
* Convert messages from Spells to FocusEffect where necessary. ([#2243](https://github.com/EQEmu/Server/pull/2243)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-06-08
|
||||
|
||||
### Netcode
|
||||
|
||||
* Adjust first packet for compress flag ([#2326](https://github.com/EQEmu/Server/pull/2326)) ([hgtw](https://github.com/hgtw)) 2022-07-27
|
||||
|
||||
### Opcode
|
||||
|
||||
* Implement SetFace opcode ([#2167](https://github.com/EQEmu/Server/pull/2167)) ([hgtw](https://github.com/hgtw)) 2022-05-11
|
||||
|
||||
### Optimization
|
||||
|
||||
* Handle channel name filter checks in memory ([#2767](https://github.com/EQEmu/Server/pull/2767)) ([Valorith](https://github.com/Valorith)) 2023-01-20
|
||||
|
||||
### Pathing
|
||||
|
||||
* Fix pathing z-correctness for certain models ([#2430](https://github.com/EQEmu/Server/pull/2430)) ([Akkadius](https://github.com/Akkadius)) 2022-09-11
|
||||
|
||||
### Process
|
||||
|
||||
* Process Execution Refactor ([#2632](https://github.com/EQEmu/Server/pull/2632)) ([Akkadius](https://github.com/Akkadius)) 2022-12-11
|
||||
|
||||
### QS
|
||||
|
||||
* Database class name change ([#2743](https://github.com/EQEmu/Server/pull/2743)) ([Akkadius](https://github.com/Akkadius)) 2023-01-15
|
||||
|
||||
### Quests
|
||||
|
||||
* Improve Quest Error Handling ([#2635](https://github.com/EQEmu/Server/pull/2635)) ([Akkadius](https://github.com/Akkadius)) 2022-12-13
|
||||
* Improve Quest Error Handling - Add back in process based syntax validation ([#2646](https://github.com/EQEmu/Server/pull/2646)) ([Akkadius](https://github.com/Akkadius)) 2022-12-15
|
||||
|
||||
### Refactor
|
||||
|
||||
* Simplify NPC Loading ([#2087](https://github.com/EQEmu/Server/pull/2087)) ([Akkadius](https://github.com/Akkadius)) 2022-05-01
|
||||
|
||||
### Regen
|
||||
|
||||
* Fix possible overflow in CalcHPRegenCap(). ([#2185](https://github.com/EQEmu/Server/pull/2185)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-27
|
||||
* Implement Per Second HP Regen for NPCs ([#2086](https://github.com/EQEmu/Server/pull/2086)) ([Akkadius](https://github.com/Akkadius)) 2022-05-01
|
||||
|
||||
### Repositories
|
||||
|
||||
* Add Bot Repositories. ([#2529](https://github.com/EQEmu/Server/pull/2529)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-16
|
||||
* Add Cereal support to repository generator ([#2660](https://github.com/EQEmu/Server/pull/2660)) ([Akkadius](https://github.com/Akkadius)) 2022-12-20
|
||||
* Add GetMaxId, Count ([#2371](https://github.com/EQEmu/Server/pull/2371)) ([Akkadius](https://github.com/Akkadius)) 2022-08-13
|
||||
* Add more precise types to repository generator ([#2391](https://github.com/EQEmu/Server/pull/2391)) ([mackal](https://github.com/mackal)) 2022-08-31
|
||||
* Cast floats to avoid grid repository warnings ([#2094](https://github.com/EQEmu/Server/pull/2094)) ([hgtw](https://github.com/hgtw)) 2022-05-02
|
||||
* Migrate LoadPerlEventExportSettings to use repositories ([#2637](https://github.com/EQEmu/Server/pull/2637)) ([Akkadius](https://github.com/Akkadius)) 2022-12-15
|
||||
* Modernize character recipe list ([#2385](https://github.com/EQEmu/Server/pull/2385)) ([Akkadius](https://github.com/Akkadius)) 2022-08-22
|
||||
* Update Character EXP Modifiers Repository ([#2530](https://github.com/EQEmu/Server/pull/2530)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-11-14
|
||||
* Update repositories ([#2040](https://github.com/EQEmu/Server/pull/2040)) ([Akkadius](https://github.com/Akkadius)) 2022-03-11
|
||||
|
||||
### Roambox
|
||||
|
||||
* Improve Path Finding ([#2324](https://github.com/EQEmu/Server/pull/2324)) ([noudess](https://github.com/noudess)) 2022-07-30
|
||||
|
||||
### Rules
|
||||
|
||||
* Add Backstab Rules ([#2666](https://github.com/EQEmu/Server/pull/2666)) ([Valorith](https://github.com/Valorith)) 2022-12-21
|
||||
* Add Frontal Stun Immunity Rules. ([#2217](https://github.com/EQEmu/Server/pull/2217)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-06-07
|
||||
* Add Keep Level on Death ([#2319](https://github.com/EQEmu/Server/pull/2319)) ([trentdm](https://github.com/trentdm)) 2022-07-30
|
||||
* Add LDoN Loot Count Modifier Rule ([#2694](https://github.com/EQEmu/Server/pull/2694)) ([Kinglykrab](https://github.com/Kinglykrab)) 2023-01-03
|
||||
* Add ManaOnDeath and EndurOnDeath ([#2661](https://github.com/EQEmu/Server/pull/2661)) ([fryguy503](https://github.com/fryguy503)) 2022-12-20
|
||||
* Add Rule to Disable NPC Last Names. ([#2227](https://github.com/EQEmu/Server/pull/2227)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-06-04
|
||||
* Add Rule to Enable Tells with #hideme ([#2358](https://github.com/EQEmu/Server/pull/2358)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-08-04
|
||||
* Add Rule to allow Assassinate on non-Humanoid body types. ([#2331](https://github.com/EQEmu/Server/pull/2331)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-07-29
|
||||
* Add Rule to allow Headshots on non-Humanoid body types. ([#2329](https://github.com/EQEmu/Server/pull/2329)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-07-29
|
||||
* Add Rules to disable various item functionalities and cleanup data types. ([#2225](https://github.com/EQEmu/Server/pull/2225)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-06-01
|
||||
* Add Spells:BuffsFadeOnDeath. ([#2200](https://github.com/EQEmu/Server/pull/2200)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-27
|
||||
* Add Spells:IllusionsAlwaysPersist. ([#2199](https://github.com/EQEmu/Server/pull/2199)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-27
|
||||
* Add Toggle for Warrior Shielding ([#2496](https://github.com/EQEmu/Server/pull/2496)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-10-22
|
||||
* Add adjustment for zone forage. ([#2330](https://github.com/EQEmu/Server/pull/2330)) ([fryguy503](https://github.com/fryguy503)) 2022-07-30
|
||||
* Add rule for NPC Level Based Buff Restrictions. ([#2708](https://github.com/EQEmu/Server/pull/2708)) ([noudess](https://github.com/noudess)) 2023-01-15
|
||||
* Add rule to allow players to permanently save chat channels to database, up to a limit. ([#2706](https://github.com/EQEmu/Server/pull/2706)) ([Valorith](https://github.com/Valorith)) 2023-01-19
|
||||
* Change TradeskillUp Rules to be Floats ([#2674](https://github.com/EQEmu/Server/pull/2674)) ([Aeadoin](https://github.com/Aeadoin)) 2022-12-25
|
||||
* Cleanup all unused rules. ([#2184](https://github.com/EQEmu/Server/pull/2184)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-23
|
||||
* Rule Gate Pet Zoning ([#2625](https://github.com/EQEmu/Server/pull/2625)) ([fryguy503](https://github.com/fryguy503)) 2022-12-07
|
||||
* Rule to allow cap on % XP gain per kill ([#2667](https://github.com/EQEmu/Server/pull/2667)) ([Valorith](https://github.com/Valorith)) 2022-12-25
|
||||
* Update logic checks everywhere for FVNoDropFlag. ([#2179](https://github.com/EQEmu/Server/pull/2179)) ([Quintinon](https://github.com/Quintinon)) 2022-07-30
|
||||
|
||||
### SQL
|
||||
|
||||
* Bugs Table Migration (#2602) ([#2559](https://github.com/EQEmu/Server/pull/2559)) ([joligario](https://github.com/joligario)) 2022-12-01
|
||||
* Update 2023_01_15_merc_data.sql ([#2763](https://github.com/EQEmu/Server/pull/2763)) ([joligario](https://github.com/joligario)) 2023-01-20
|
||||
|
||||
### Saylinks
|
||||
|
||||
* Add Silent helper ([#2372](https://github.com/EQEmu/Server/pull/2372)) ([Akkadius](https://github.com/Akkadius)) 2022-08-13
|
||||
* Convert all GM Command Saylinks to Silent Saylinks. ([#2373](https://github.com/EQEmu/Server/pull/2373)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-08-14
|
||||
* Inject Saylinks in MessageClose API ([#2335](https://github.com/EQEmu/Server/pull/2335)) ([hgtw](https://github.com/hgtw)) 2022-07-31
|
||||
* Refactor saylink injection ([#2315](https://github.com/EQEmu/Server/pull/2315)) ([hgtw](https://github.com/hgtw)) 2022-07-27
|
||||
|
||||
### Server
|
||||
|
||||
* Configuration Issues Checker (LAN Detection) ([#2283](https://github.com/EQEmu/Server/pull/2283)) ([Akkadius](https://github.com/Akkadius)) 2022-07-07
|
||||
|
||||
### Skills
|
||||
|
||||
* Configurable Exponential Decay Formula for Skill Up ([#1887](https://github.com/EQEmu/Server/pull/1887)) ([mmcgarvey](https://github.com/mmcgarvey)) 2022-01-30
|
||||
|
||||
### Spells
|
||||
|
||||
* AE Duration effect (Rains) will now work with Target Ring and PBAE spells. ([#2000](https://github.com/EQEmu/Server/pull/2000)) ([KayenEQ](https://github.com/KayenEQ)) 2022-02-16
|
||||
* Allow damage spells to heal if quest based spell mitigation is over 100 pct. ([#1978](https://github.com/EQEmu/Server/pull/1978)) ([KayenEQ](https://github.com/KayenEQ)) 2022-02-08
|
||||
* Bard songs from item clickies should not require components ([#2011](https://github.com/EQEmu/Server/pull/2011)) ([KayenEQ](https://github.com/KayenEQ)) 2022-02-18
|
||||
* Fix for AA and Discipline recast timers being set on spell casting failure. ([#1971](https://github.com/EQEmu/Server/pull/1971)) ([KayenEQ](https://github.com/KayenEQ)) 2022-02-08
|
||||
* Fix for AA recast timers not resetting properly ([#1989](https://github.com/EQEmu/Server/pull/1989)) ([KayenEQ](https://github.com/KayenEQ)) 2022-02-11
|
||||
* Fixes for numhits type 7 counter incrementing incorrectly. ([#2022](https://github.com/EQEmu/Server/pull/2022)) ([KayenEQ](https://github.com/KayenEQ)) 2022-03-02
|
||||
* Illusions will now persist onto the corpse when mob is killed. ([#1960](https://github.com/EQEmu/Server/pull/1960)) ([KayenEQ](https://github.com/KayenEQ)) 2022-02-05
|
||||
* Invisibility updates and rework ([#1991](https://github.com/EQEmu/Server/pull/1991)) ([KayenEQ](https://github.com/KayenEQ)) 2022-02-15
|
||||
* Major update to Bard song pulsing, Bard item clicks while singing, and spell casting restriction logic. ([#1954](https://github.com/EQEmu/Server/pull/1954)) ([KayenEQ](https://github.com/KayenEQ)) 2022-02-07
|
||||
* SPA 311 SE_LimitCombatSkills should prevent focusing of procs even if proc is a 'casted' spell. ([#1961](https://github.com/EQEmu/Server/pull/1961)) ([KayenEQ](https://github.com/KayenEQ)) 2022-02-05
|
||||
* SPA 79 SE_CurrentHPOnce now will check for focus, critical and partial resist checks, except for buffs. ([#2018](https://github.com/EQEmu/Server/pull/2018)) ([KayenEQ](https://github.com/KayenEQ)) 2022-02-24
|
||||
* Support for 'HateAdded' spell field to apply negative values to reduce hate. ([#1953](https://github.com/EQEmu/Server/pull/1953)) ([KayenEQ](https://github.com/KayenEQ)) 2022-02-03
|
||||
* Support for SPA 194 SE_FadingMemories to use max level checks on aggroed mobs ([#1979](https://github.com/EQEmu/Server/pull/1979)) ([KayenEQ](https://github.com/KayenEQ)) 2022-02-09
|
||||
* Swarm pet aggro logic fix ([#1956](https://github.com/EQEmu/Server/pull/1956)) ([KayenEQ](https://github.com/KayenEQ)) 2022-02-04
|
||||
* Target's Target Combat Range Rule ([#2274](https://github.com/EQEmu/Server/pull/2274)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-06-24
|
||||
* Update to target types Beam and Cone to ignore invalid targets. ([#2080](https://github.com/EQEmu/Server/pull/2080)) ([KayenEQ](https://github.com/KayenEQ)) 2022-05-01
|
||||
* Updates to spell field 'cast not stands' to ignore casting restrictions ([#1938](https://github.com/EQEmu/Server/pull/1938)) ([KayenEQ](https://github.com/KayenEQ)) 2022-01-29
|
||||
|
||||
### Strings
|
||||
|
||||
* Refactor Strings Usage ([#2305](https://github.com/EQEmu/Server/pull/2305)) ([Akkadius](https://github.com/Akkadius)) 2022-07-14
|
||||
|
||||
### Tasks
|
||||
|
||||
* Add Task Reward Points Field ([#2317](https://github.com/EQEmu/Server/pull/2317)) ([hgtw](https://github.com/hgtw)) 2022-07-30
|
||||
* Add method to filter shared task offers ([#2497](https://github.com/EQEmu/Server/pull/2497)) ([hgtw](https://github.com/hgtw)) 2022-10-29
|
||||
* Add pre-task update event ([#2512](https://github.com/EQEmu/Server/pull/2512)) ([hgtw](https://github.com/hgtw)) 2022-10-30
|
||||
* Add rule to update multiple task elements ([#2427](https://github.com/EQEmu/Server/pull/2427)) ([hgtw](https://github.com/hgtw)) 2022-09-06
|
||||
* Add task accept packet validation ([#2354](https://github.com/EQEmu/Server/pull/2354)) ([hgtw](https://github.com/hgtw)) 2022-07-31
|
||||
* Apply full duration mission replay timers ([#2299](https://github.com/EQEmu/Server/pull/2299)) ([hgtw](https://github.com/hgtw)) 2022-07-14
|
||||
* Change zone task data container ([#2410](https://github.com/EQEmu/Server/pull/2410)) ([hgtw](https://github.com/hgtw)) 2022-09-03
|
||||
* Crash fix with data input sanitization ([#2629](https://github.com/EQEmu/Server/pull/2629)) ([Akkadius](https://github.com/Akkadius)) 2022-12-10
|
||||
* Data validation for zone_version ([#2381](https://github.com/EQEmu/Server/pull/2381)) ([Akkadius](https://github.com/Akkadius)) 2022-08-21
|
||||
* Fix #task command crash on bad input ([#2301](https://github.com/EQEmu/Server/pull/2301)) ([hgtw](https://github.com/hgtw)) 2022-07-14
|
||||
* Fix validation loading ([#2230](https://github.com/EQEmu/Server/pull/2230)) ([Akkadius](https://github.com/Akkadius)) 2022-06-01
|
||||
* Implement Task Goal Match List ([#2097](https://github.com/EQEmu/Server/pull/2097)) ([Akkadius](https://github.com/Akkadius)) 2022-05-07
|
||||
* Implement task activity prerequisites ([#2374](https://github.com/EQEmu/Server/pull/2374)) ([hgtw](https://github.com/hgtw)) 2022-08-22
|
||||
* Let task completion event block task rewards ([#2511](https://github.com/EQEmu/Server/pull/2511)) ([hgtw](https://github.com/hgtw)) 2022-10-30
|
||||
* Let task reward find free bag slots ([#2431](https://github.com/EQEmu/Server/pull/2431)) ([hgtw](https://github.com/hgtw)) 2022-09-18
|
||||
* Make #task reloadall not quit shared tasks ([#2351](https://github.com/EQEmu/Server/pull/2351)) ([hgtw](https://github.com/hgtw)) 2022-07-31
|
||||
* Make Task Selector Cooldown Optional ([#2420](https://github.com/EQEmu/Server/pull/2420)) ([hgtw](https://github.com/hgtw)) 2022-09-03
|
||||
* Only allow shared task completion once ([#2422](https://github.com/EQEmu/Server/pull/2422)) ([hgtw](https://github.com/hgtw)) 2022-09-03
|
||||
* Only update loot tasks for NPC corpses ([#2513](https://github.com/EQEmu/Server/pull/2513)) ([hgtw](https://github.com/hgtw)) 2022-11-05
|
||||
* Place task item rewards in free slots ([#2300](https://github.com/EQEmu/Server/pull/2300)) ([hgtw](https://github.com/hgtw)) 2022-07-14
|
||||
* Remove delivered task items from trades ([#2405](https://github.com/EQEmu/Server/pull/2405)) ([hgtw](https://github.com/hgtw)) 2022-09-02
|
||||
* Replace task goals with explicit fields ([#2402](https://github.com/EQEmu/Server/pull/2402)) ([hgtw](https://github.com/hgtw)) 2022-09-02
|
||||
* Reward clients on shared task completion sync ([#2306](https://github.com/EQEmu/Server/pull/2306)) ([hgtw](https://github.com/hgtw)) 2022-07-16
|
||||
* Schema simplification ([#2449](https://github.com/EQEmu/Server/pull/2449)) ([hgtw](https://github.com/hgtw)) 2022-09-28
|
||||
* Send Client Message for All Solo Task Updates ([#2336](https://github.com/EQEmu/Server/pull/2336)) ([hgtw](https://github.com/hgtw)) 2022-07-31
|
||||
* Support Raw NPC Names in Task Goal List ([#2333](https://github.com/EQEmu/Server/pull/2333)) ([hgtw](https://github.com/hgtw)) 2022-07-30
|
||||
* Tweak task update messages ([#2406](https://github.com/EQEmu/Server/pull/2406)) ([hgtw](https://github.com/hgtw)) 2022-09-02
|
||||
* Use CashReward for Tasks ([#2332](https://github.com/EQEmu/Server/pull/2332)) ([hgtw](https://github.com/hgtw)) 2022-07-30
|
||||
* Use dz switch id for task touch events ([#2344](https://github.com/EQEmu/Server/pull/2344)) ([hgtw](https://github.com/hgtw)) 2022-07-31
|
||||
* Use zone currencies instead of hard-coded enum. ([#2459](https://github.com/EQEmu/Server/pull/2459)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-09-29
|
||||
* Zone Version Matching ([#2303](https://github.com/EQEmu/Server/pull/2303)) ([Akkadius](https://github.com/Akkadius)) 2022-07-14
|
||||
|
||||
### Telnet
|
||||
|
||||
* Add guildsay to console commands and Guild Channel to QueueMessage. ([#2263](https://github.com/EQEmu/Server/pull/2263)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-07-03
|
||||
|
||||
### Titles
|
||||
|
||||
* Cleanup titles, title suffix, and last name methods. ([#2174](https://github.com/EQEmu/Server/pull/2174)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-20
|
||||
|
||||
### Typo
|
||||
|
||||
* Remove CanTradeFVNoDropItem() Duplicate ([#2352](https://github.com/EQEmu/Server/pull/2352)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-07-31
|
||||
|
||||
### UCS
|
||||
|
||||
* Auto Client Reconnection ([#2154](https://github.com/EQEmu/Server/pull/2154)) ([Akkadius](https://github.com/Akkadius)) 2022-05-08
|
||||
|
||||
### Utility
|
||||
|
||||
* Add std::string_view overloads for std::from_chars ([#2392](https://github.com/EQEmu/Server/pull/2392)) ([mackal](https://github.com/mackal)) 2022-08-31
|
||||
|
||||
### Validation
|
||||
|
||||
* Add Size Validation to #hotfix. ([#2304](https://github.com/EQEmu/Server/pull/2304)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-07-14
|
||||
|
||||
### Websocket
|
||||
|
||||
* Fix cpp20/gcc11 compile failure ([#2737](https://github.com/EQEmu/Server/pull/2737)) ([Akkadius](https://github.com/Akkadius)) 2023-01-15
|
||||
|
||||
### World
|
||||
|
||||
* Add more descriptive LS auth erroring ([#2293](https://github.com/EQEmu/Server/pull/2293)) ([Akkadius](https://github.com/Akkadius)) 2022-07-14
|
||||
* World Bootup Consolidation ([#2294](https://github.com/EQEmu/Server/pull/2294)) ([Akkadius](https://github.com/Akkadius)) 2022-07-14
|
||||
|
||||
### XTarget
|
||||
|
||||
* Revert All XTarget Corpse Changes ([#1944](https://github.com/EQEmu/Server/pull/1944)) ([mmcgarvey](https://github.com/mmcgarvey)) 2022-01-24
|
||||
|
||||
### Zone
|
||||
|
||||
* Add missing safe_heading assignment ([#2407](https://github.com/EQEmu/Server/pull/2407)) ([hgtw](https://github.com/hgtw)) 2022-09-02
|
||||
* Deprecate Zone `expansion` Field ([#2297](https://github.com/EQEmu/Server/pull/2297)) ([Akkadius](https://github.com/Akkadius)) 2022-07-14
|
||||
* Fix and simplify zone shutdown logic ([#2390](https://github.com/EQEmu/Server/pull/2390)) ([Akkadius](https://github.com/Akkadius)) 2022-08-31
|
||||
|
||||
### Zones
|
||||
|
||||
* Add Max Level Check to Zones. ([#2714](https://github.com/EQEmu/Server/pull/2714)) ([Kinglykrab](https://github.com/Kinglykrab)) 2023-01-11
|
||||
|
||||
### Zoning
|
||||
|
||||
* Fix zone race condition ([#2479](https://github.com/EQEmu/Server/pull/2479)) ([Akkadius](https://github.com/Akkadius)) 2022-10-12
|
||||
* Fix zoning logic issues ([#2412](https://github.com/EQEmu/Server/pull/2412)) ([Akkadius](https://github.com/Akkadius)) 2022-09-03
|
||||
* Possible zoning under world fix ([#2424](https://github.com/EQEmu/Server/pull/2424)) ([Akkadius](https://github.com/Akkadius)) 2022-10-11
|
||||
* Revert #2424 ([#2492](https://github.com/EQEmu/Server/pull/2492)) ([Akkadius](https://github.com/Akkadius)) 2022-10-16
|
||||
|
||||
### eqemu_server.pl
|
||||
|
||||
* Remove non-working fetch_latest_windows_binaries() ([#2445](https://github.com/EQEmu/Server/pull/2445)) ([Akkadius](https://github.com/Akkadius)) 2022-09-25
|
||||
|
||||
### int64
|
||||
|
||||
* Fix int64 for OOC Regen and GetHP(), GetMaxHP(), GetItemHPBonuses() in Perl/Lua. ([#2218](https://github.com/EQEmu/Server/pull/2218)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-29
|
||||
* Further int64 cleanup in Perl SetHP() and GetSpellHPBonuses() in Perl/Lua. ([#2222](https://github.com/EQEmu/Server/pull/2222)) ([Kinglykrab](https://github.com/Kinglykrab)) 2022-05-29
|
||||
* Hate Fixes ([#2163](https://github.com/EQEmu/Server/pull/2163)) ([Akkadius](https://github.com/Akkadius)) 2022-05-10
|
||||
* Support for HP / Mana / End / Damage / Hate ([#2091](https://github.com/EQEmu/Server/pull/2091)) ([Akkadius](https://github.com/Akkadius)) 2022-05-08
|
||||
* Windows Compile Fixes ([#2155](https://github.com/EQEmu/Server/pull/2155)) ([Akkadius](https://github.com/Akkadius)) 2022-05-08
|
||||
|
||||
### libuv
|
||||
|
||||
* Bump to v1.44.2 from v1.26.0 ([#2658](https://github.com/EQEmu/Server/pull/2658)) ([Akkadius](https://github.com/Akkadius)) 2022-12-20
|
||||
+10
-1
@@ -23,7 +23,6 @@ IF(MSVC)
|
||||
ADD_DEFINITIONS(-D_HAS_AUTO_PTR_ETC) # for Luabind on C++17
|
||||
|
||||
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
|
||||
ADD_DEFINITIONS( "/W0 /D_CRT_SECURE_NO_WARNINGS /wd4005 /wd4996 /nologo /Os")
|
||||
ELSE(MSVC)
|
||||
ADD_DEFINITIONS(-DHAS_UNION_SEMUN)
|
||||
ENDIF(MSVC)
|
||||
@@ -123,6 +122,7 @@ ENDIF()
|
||||
MESSAGE(STATUS "**************************************************")
|
||||
|
||||
#options
|
||||
OPTION(EQEMU_ENABLE_BOTS "Enable Bots" OFF)
|
||||
OPTION(EQEMU_COMMANDS_LOGGING "Enable GM Command logs" ON)
|
||||
OPTION(EQEMU_BUILD_SERVER "Build the game server." ON)
|
||||
OPTION(EQEMU_BUILD_LOGIN "Build the login server." ON)
|
||||
@@ -176,6 +176,10 @@ IF(EQEMU_COMMANDS_LOGGING)
|
||||
ADD_DEFINITIONS(-DCOMMANDS_LOGGING)
|
||||
ENDIF(EQEMU_COMMANDS_LOGGING)
|
||||
|
||||
IF(EQEMU_ENABLE_BOTS)
|
||||
ADD_DEFINITIONS(-DBOTS)
|
||||
ENDIF(EQEMU_ENABLE_BOTS)
|
||||
|
||||
#database
|
||||
IF(MySQL_FOUND AND MariaDB_FOUND)
|
||||
SET(DATABASE_LIBRARY_SELECTION MariaDB CACHE STRING "Database library to use:
|
||||
@@ -339,6 +343,11 @@ INCLUDE_DIRECTORIES(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/submodules/websocketpp")
|
||||
# silence obnoxious deprecation message
|
||||
ADD_DEFINITIONS(-DBOOST_BIND_GLOBAL_PLACEHOLDERS)
|
||||
|
||||
OPTION(EQEMU_BUILD_LOGGING "Build Logging (To speed up compilation)" ON)
|
||||
IF(EQEMU_BUILD_LOGGING)
|
||||
ADD_DEFINITIONS(-DBUILD_LOGGING)
|
||||
ENDIF()
|
||||
|
||||
IF(TLS_LIBRARY_ENABLED)
|
||||
SET(SERVER_LIBS ${SERVER_LIBS} ${TLS_LIBRARY_LIBS})
|
||||
INCLUDE_DIRECTORIES(SYSTEM "${TLS_LIBRARY_INCLUDE}")
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
version: 1.0.{build}
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
image: Visual Studio 2017
|
||||
configuration: RelWithDebInfo
|
||||
clone_folder: c:\projects\eqemu
|
||||
init:
|
||||
- ps: git config --global core.autocrlf input
|
||||
cache: c:\tools\vcpkg\installed\
|
||||
before_build:
|
||||
- ps: "$wc = New-Object System.Net.WebClient\n$wc.DownloadFile(\"http://strawberryperl.com/download/5.26.2.1/strawberry-perl-5.26.2.1-64bit-portable.zip\", \"c:\\projects\\eqemu\\strawberry-perl-5.26.2.1-64bit-portable.zip\")\ncd c:\\projects\\eqemu\n7z x c:/projects/eqemu/strawberry-perl-5.26.2.1-64bit-portable.zip -oc:/projects/eqemu/strawberry-perl-portable -y\n(Get-Content C:/projects/eqemu/strawberry-perl-portable/perl/lib/CORE/config.h).replace('#define PERL_STATIC_INLINE static __inline__', '#define PERL_STATIC_INLINE static __inline') | Set-Content C:/projects/eqemu/strawberry-perl-portable/perl/lib/CORE/config.h\nvcpkg install boost-geometry:x64-windows boost-dynamic-bitset:x64-windows luajit:x64-windows libsodium:x64-windows libmysql:x64-windows openssl:x64-windows zlib:x64-windows \nmkdir build\ncd build\ncmake -G \"Visual Studio 15 2017 Win64\" -DEQEMU_BUILD_TESTS=ON -DEQEMU_BUILD_LOGIN=ON -EQEMU_ENABLE_BOTS=ON -DPERL_EXECUTABLE=\"C:/projects/eqemu/strawberry-perl-portable/perl/bin/perl.exe\" -DPERL_INCLUDE_PATH=\"C:/projects/eqemu/strawberry-perl-portable/perl/lib/CORE\" -DPERL_LIBRARY=\"C:/projects/eqemu/strawberry-perl-portable/perl/lib/CORE/libperl526.a\" -DCMAKE_TOOLCHAIN_FILE=\"c:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake\" .."
|
||||
build:
|
||||
project: C:\projects\eqemu\build\EQEmu.sln
|
||||
parallel: true
|
||||
verbosity: minimal
|
||||
after_build:
|
||||
- cmd: >-
|
||||
7z a build_x64-bots.zip C:\projects\eqemu\build\bin\RelWithDebInfo\*.exe C:\projects\eqemu\build\bin\RelWithDebInfo\*.dll C:\projects\eqemu\build\bin\RelWithDebInfo\*.pdb C:\projects\eqemu\build\libs\zlibng\RelWithDebInfo\*.dll
|
||||
|
||||
appveyor PushArtifact build_x64-bots.zip
|
||||
@@ -0,0 +1,21 @@
|
||||
version: 1.0.{build}
|
||||
branches:
|
||||
only:
|
||||
- master
|
||||
image: Visual Studio 2017
|
||||
configuration: RelWithDebInfo
|
||||
clone_folder: c:\projects\eqemu
|
||||
init:
|
||||
- ps: git config --global core.autocrlf input
|
||||
cache: c:\tools\vcpkg\installed\
|
||||
before_build:
|
||||
- ps: "$wc = New-Object System.Net.WebClient\n$wc.DownloadFile(\"http://strawberryperl.com/download/5.26.2.1/strawberry-perl-5.26.2.1-64bit-portable.zip\", \"c:\\projects\\eqemu\\strawberry-perl-5.26.2.1-64bit-portable.zip\")\ncd c:\\projects\\eqemu\n7z x c:/projects/eqemu/strawberry-perl-5.26.2.1-64bit-portable.zip -oc:/projects/eqemu/strawberry-perl-portable -y\n(Get-Content C:/projects/eqemu/strawberry-perl-portable/perl/lib/CORE/config.h).replace('#define PERL_STATIC_INLINE static __inline__', '#define PERL_STATIC_INLINE static __inline') | Set-Content C:/projects/eqemu/strawberry-perl-portable/perl/lib/CORE/config.h\nvcpkg install boost-geometry:x64-windows boost-dynamic-bitset:x64-windows luajit:x64-windows libsodium:x64-windows libmysql:x64-windows openssl:x64-windows zlib:x64-windows \nmkdir build\ncd build\ncmake -G \"Visual Studio 15 2017 Win64\" -DEQEMU_BUILD_TESTS=ON -DEQEMU_BUILD_LOGIN=ON -EQEMU_ENABLE_BOTS=OFF -DPERL_EXECUTABLE=\"C:/projects/eqemu/strawberry-perl-portable/perl/bin/perl.exe\" -DPERL_INCLUDE_PATH=\"C:/projects/eqemu/strawberry-perl-portable/perl/lib/CORE\" -DPERL_LIBRARY=\"C:/projects/eqemu/strawberry-perl-portable/perl/lib/CORE/libperl526.a\" -DCMAKE_TOOLCHAIN_FILE=\"c:/tools/vcpkg/scripts/buildsystems/vcpkg.cmake\" .."
|
||||
build:
|
||||
project: C:\projects\eqemu\build\EQEmu.sln
|
||||
parallel: true
|
||||
verbosity: minimal
|
||||
after_build:
|
||||
- cmd: >-
|
||||
7z a build_x64-no-bots.zip C:\projects\eqemu\build\bin\RelWithDebInfo\*.exe C:\projects\eqemu\build\bin\RelWithDebInfo\*.dll C:\projects\eqemu\build\bin\RelWithDebInfo\*.pdb C:\projects\eqemu\build\libs\zlibng\RelWithDebInfo\*.dll
|
||||
|
||||
appveyor PushArtifact build_x64-no-bots.zip
|
||||
@@ -182,8 +182,6 @@ SET(repositories
|
||||
repositories/base/base_char_create_combinations_repository.h
|
||||
repositories/base/base_char_create_point_allocations_repository.h
|
||||
repositories/base/base_char_recipe_list_repository.h
|
||||
repositories/base/base_chatchannels_repository.h
|
||||
repositories/base/base_chatchannel_reserved_names_repository.h
|
||||
repositories/base/base_completed_shared_tasks_repository.h
|
||||
repositories/base/base_completed_shared_task_activity_state_repository.h
|
||||
repositories/base/base_completed_shared_task_members_repository.h
|
||||
@@ -360,8 +358,6 @@ SET(repositories
|
||||
repositories/char_create_combinations_repository.h
|
||||
repositories/char_create_point_allocations_repository.h
|
||||
repositories/char_recipe_list_repository.h
|
||||
repositories/chatchannels_repository.h
|
||||
repositories/chatchannel_reserved_names_repository.h
|
||||
repositories/completed_shared_tasks_repository.h
|
||||
repositories/completed_shared_task_activity_state_repository.h
|
||||
repositories/completed_shared_task_members_repository.h
|
||||
@@ -656,7 +652,6 @@ SET(common_headers
|
||||
patches/uf_limits.h
|
||||
patches/uf_ops.h
|
||||
patches/uf_structs.h
|
||||
termcolor/rang.hpp
|
||||
stacktrace/backward.hpp
|
||||
StackWalker/StackWalker.h
|
||||
util/memory_stream.h
|
||||
|
||||
@@ -20,7 +20,6 @@
|
||||
|
||||
#include "../common/types.h"
|
||||
|
||||
#define NO_CLASS 0
|
||||
#define WARRIOR 1
|
||||
#define CLERIC 2
|
||||
#define PALADIN 3
|
||||
|
||||
@@ -3,14 +3,6 @@
|
||||
#include "crash.h"
|
||||
#include "strings.h"
|
||||
#include "process/process.h"
|
||||
#include "http/httplib.h"
|
||||
#include "http/uri.h"
|
||||
#include "json/json.h"
|
||||
#include "version.h"
|
||||
#include "eqemu_config.h"
|
||||
#include "serverinfo.h"
|
||||
#include "rulesys.h"
|
||||
#include "platform.h"
|
||||
|
||||
#include <cstdio>
|
||||
|
||||
@@ -18,80 +10,6 @@
|
||||
#define popen _popen
|
||||
#endif
|
||||
|
||||
void SendCrashReport(const std::string &crash_report)
|
||||
{
|
||||
// can configure multiple endpoints if need be
|
||||
std::vector<std::string> endpoints = {
|
||||
"http://spire.akkadius.com/api/v1/server-crash-report",
|
||||
// "http://localhost:3010/api/v1/server-crash-report", // development
|
||||
};
|
||||
|
||||
auto config = EQEmuConfig::get();
|
||||
for (auto &e: endpoints) {
|
||||
uri u(e);
|
||||
|
||||
std::string base_url = fmt::format("{}://{}", u.get_scheme(), u.get_host());
|
||||
if (u.get_port()) {
|
||||
base_url += fmt::format(":{}", u.get_port());
|
||||
}
|
||||
|
||||
// client
|
||||
httplib::Client r(base_url);
|
||||
r.set_connection_timeout(1, 0);
|
||||
r.set_read_timeout(1, 0);
|
||||
r.set_write_timeout(1, 0);
|
||||
httplib::Headers headers = {
|
||||
{"Content-Type", "application/json"}
|
||||
};
|
||||
|
||||
// os info
|
||||
auto os = EQ::GetOS();
|
||||
auto cpus = EQ::GetCPUs();
|
||||
auto process_id = EQ::GetPID();
|
||||
auto rss = EQ::GetRSS() / 1048576.0;
|
||||
auto uptime = static_cast<uint32>(EQ::GetUptime());
|
||||
|
||||
// payload
|
||||
Json::Value p;
|
||||
p["platform_name"] = GetPlatformName();
|
||||
p["crash_report"] = crash_report;
|
||||
p["server_version"] = CURRENT_VERSION;
|
||||
p["compile_date"] = COMPILE_DATE;
|
||||
p["compile_time"] = COMPILE_TIME;
|
||||
p["server_name"] = config->LongName;
|
||||
p["server_short_name"] = config->ShortName;
|
||||
p["uptime"] = uptime;
|
||||
p["os_machine"] = os.machine;
|
||||
p["os_release"] = os.release;
|
||||
p["os_version"] = os.version;
|
||||
p["os_sysname"] = os.sysname;
|
||||
p["process_id"] = process_id;
|
||||
p["rss_memory"] = rss;
|
||||
p["cpus"] = cpus.size();
|
||||
p["origination_info"] = "";
|
||||
|
||||
if (!LogSys.origination_info.zone_short_name.empty()) {
|
||||
p["origination_info"] = fmt::format(
|
||||
"{} ({}) instance_id [{}]",
|
||||
LogSys.origination_info.zone_short_name,
|
||||
LogSys.origination_info.zone_long_name,
|
||||
LogSys.origination_info.instance_id
|
||||
);
|
||||
}
|
||||
|
||||
std::stringstream payload;
|
||||
payload << p;
|
||||
|
||||
if (auto res = r.Post(e, payload.str(), "application/json")) {
|
||||
if (res->status == 200) {
|
||||
LogInfo("Sent crash report");
|
||||
}
|
||||
else {
|
||||
LogError("Failed to send crash report to [{}]", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if defined(_WINDOWS) && defined(CRASH_LOGGING)
|
||||
#include "StackWalker.h"
|
||||
@@ -116,11 +34,6 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
if (RuleB(Analytics, CrashReporting)) {
|
||||
std::string crash_report = buffer;
|
||||
SendCrashReport(crash_report);
|
||||
}
|
||||
|
||||
Log(Logs::General, Logs::Crash, buffer);
|
||||
StackWalker::OnOutput(szText);
|
||||
}
|
||||
@@ -268,18 +181,12 @@ void print_trace()
|
||||
}
|
||||
|
||||
std::ifstream input(temp_output_file);
|
||||
std::string crash_report;
|
||||
for (std::string line; getline(input, line);) {
|
||||
LogCrash("{}", line);
|
||||
crash_report += fmt::format("{}\n", line);
|
||||
}
|
||||
|
||||
std::remove(temp_output_file.c_str());
|
||||
|
||||
if (RuleB(Analytics, CrashReporting)) {
|
||||
SendCrashReport(crash_report);
|
||||
}
|
||||
|
||||
exit(1);
|
||||
}
|
||||
|
||||
|
||||
+26
-28
@@ -71,11 +71,11 @@ bool Database::Connect(const char* host, const char* user, const char* passwd, c
|
||||
uint32 errnum= 0;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
if (!Open(host, user, passwd, database, port, &errnum, errbuf)) {
|
||||
LogError("Connection [{}] Failed to connect to database Error [{}]", connection_label, errbuf);
|
||||
LogError("[MySQL] Connection [{}] Failed to connect to database: Error [{}]", connection_label, errbuf);
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
LogInfo("Connected to database [{}] [{}] @ [{}:{}]", connection_label, database, host,port);
|
||||
LogInfo("[MySQL] Connection [{}] database [{}] at [{}]:[{}]", connection_label, database, host,port);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -391,10 +391,15 @@ bool Database::DeleteCharacter(char *character_name)
|
||||
}
|
||||
|
||||
if (character_id <= 0) {
|
||||
LogError("Invalid Character ID [{}]", character_name);
|
||||
LogError("[DeleteCharacter] Invalid Character ID [{}]", character_name);
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef BOTS
|
||||
query = StringFormat("DELETE FROM `guild_members` WHERE `char_id` = '%d' AND GetMobTypeById(%i) = 'C'", character_id); // note: only use of GetMobTypeById()
|
||||
QueryDatabase(query);
|
||||
#endif
|
||||
|
||||
std::string delete_type = "hard-deleted";
|
||||
if (RuleB(Character, SoftDeletes)) {
|
||||
delete_type = "soft-deleted";
|
||||
@@ -413,26 +418,21 @@ bool Database::DeleteCharacter(char *character_name)
|
||||
|
||||
QueryDatabase(query);
|
||||
|
||||
if (RuleB(Bots, Enabled)) {
|
||||
query = fmt::format(
|
||||
SQL(
|
||||
UPDATE
|
||||
bot_data
|
||||
SET
|
||||
name = SUBSTRING(CONCAT(name, '-deleted-', UNIX_TIMESTAMP()), 1, 64)
|
||||
WHERE
|
||||
owner_id = '{}'
|
||||
),
|
||||
character_id
|
||||
);
|
||||
QueryDatabase(query);
|
||||
LogInfo(
|
||||
"[DeleteCharacter] character_name [{}] ({}) bots are being [{}]",
|
||||
character_name,
|
||||
character_id,
|
||||
delete_type
|
||||
);
|
||||
}
|
||||
#ifdef BOTS
|
||||
query = fmt::format(
|
||||
SQL(
|
||||
UPDATE
|
||||
bot_data
|
||||
SET
|
||||
name = SUBSTRING(CONCAT(name, '-deleted-', UNIX_TIMESTAMP()), 1, 64)
|
||||
WHERE
|
||||
owner_id = '{}'
|
||||
),
|
||||
character_id
|
||||
);
|
||||
QueryDatabase(query);
|
||||
LogInfo("[DeleteCharacter] character_name [{}] ({}) bots are being [{}]", character_name, character_id, delete_type);
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -444,7 +444,7 @@ bool Database::DeleteCharacter(char *character_name)
|
||||
QueryDatabase(fmt::format("DELETE FROM {} WHERE {} = {}", table_name, character_id_column_name, character_id));
|
||||
}
|
||||
|
||||
LogInfo("character_name [{}] ({}) is being [{}]", character_name, character_id, delete_type);
|
||||
LogInfo("[DeleteCharacter] character_name [{}] ({}) is being [{}]", character_name, character_id, delete_type);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -975,8 +975,6 @@ bool Database::LoadVariables() {
|
||||
varcache.Add(key, value);
|
||||
}
|
||||
|
||||
LogInfo("Loaded [{}] variable(s)", Strings::Commify(std::to_string(results.RowCount())));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2356,7 +2354,7 @@ void Database::SourceDatabaseTableFromUrl(std::string table_name, std::string ur
|
||||
uri request_uri(url);
|
||||
|
||||
LogHTTP(
|
||||
"parsing url [{}] path [{}] host [{}] query_string [{}] protocol [{}] port [{}]",
|
||||
"[SourceDatabaseTableFromUrl] parsing url [{}] path [{}] host [{}] query_string [{}] protocol [{}] port [{}]",
|
||||
url,
|
||||
request_uri.get_path(),
|
||||
request_uri.get_host(),
|
||||
@@ -2410,7 +2408,7 @@ void Database::SourceDatabaseTableFromUrl(std::string table_name, std::string ur
|
||||
|
||||
}
|
||||
catch (std::invalid_argument iae) {
|
||||
LogError("URI parser error [{}]", iae.what());
|
||||
LogError("[SourceDatabaseTableFromUrl] URI parser error [{}]", iae.what());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -118,53 +118,109 @@ std::string DatabaseDumpService::GetBaseMySQLDumpCommand()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
std::string DatabaseDumpService::GetPlayerTablesList()
|
||||
{
|
||||
return Strings::Join(DatabaseSchema::GetPlayerTables(), " ");
|
||||
std::string tables_list;
|
||||
std::vector<std::string> tables = DatabaseSchema::GetPlayerTables();
|
||||
for (const auto &table : tables) {
|
||||
tables_list += table + " ";
|
||||
}
|
||||
|
||||
return Strings::Trim(tables_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
std::string DatabaseDumpService::GetBotTablesList()
|
||||
{
|
||||
return Strings::Join(DatabaseSchema::GetBotTables(), " ");
|
||||
}
|
||||
|
||||
std::string DatabaseDumpService::GetMercTablesList()
|
||||
{
|
||||
return Strings::Join(DatabaseSchema::GetMercTables(), " ");
|
||||
std::string tables_list;
|
||||
std::vector<std::string> tables = DatabaseSchema::GetBotTables();
|
||||
for (const auto &table : tables) {
|
||||
tables_list += table + " ";
|
||||
}
|
||||
|
||||
return Strings::Trim(tables_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
std::string DatabaseDumpService::GetLoginTableList()
|
||||
{
|
||||
return Strings::Join(DatabaseSchema::GetLoginTables(), " ");
|
||||
std::string tables_list;
|
||||
std::vector<std::string> tables = DatabaseSchema::GetLoginTables();
|
||||
for (const auto &table : tables) {
|
||||
tables_list += table + " ";
|
||||
}
|
||||
|
||||
return Strings::Trim(tables_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
std::string DatabaseDumpService::GetQueryServTables()
|
||||
{
|
||||
return Strings::Join(DatabaseSchema::GetQueryServerTables(), " ");
|
||||
std::string tables_list;
|
||||
std::vector<std::string> tables = DatabaseSchema::GetQueryServerTables();
|
||||
for (const auto &table : tables) {
|
||||
tables_list += table + " ";
|
||||
}
|
||||
|
||||
return Strings::Trim(tables_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
std::string DatabaseDumpService::GetSystemTablesList()
|
||||
{
|
||||
auto system_tables = DatabaseSchema::GetServerTables();
|
||||
auto version_tables = DatabaseSchema::GetVersionTables();
|
||||
std::string tables_list;
|
||||
|
||||
system_tables.insert(
|
||||
std::end(system_tables),
|
||||
std::begin(version_tables),
|
||||
std::end(version_tables)
|
||||
);
|
||||
std::vector<std::string> tables = DatabaseSchema::GetServerTables();
|
||||
for (const auto &table : tables) {
|
||||
tables_list += table + " ";
|
||||
}
|
||||
|
||||
return Strings::Join(system_tables, " ");
|
||||
tables = DatabaseSchema::GetVersionTables();
|
||||
for (const auto &table : tables) {
|
||||
tables_list += table + " ";
|
||||
}
|
||||
|
||||
return Strings::Trim(tables_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
std::string DatabaseDumpService::GetStateTablesList()
|
||||
{
|
||||
return Strings::Join(DatabaseSchema::GetStateTables(), " ");
|
||||
std::string tables_list;
|
||||
|
||||
std::vector<std::string> tables = DatabaseSchema::GetStateTables();
|
||||
for (const auto &table : tables) {
|
||||
tables_list += table + " ";
|
||||
}
|
||||
|
||||
return Strings::Trim(tables_list);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return
|
||||
*/
|
||||
std::string DatabaseDumpService::GetContentTablesList()
|
||||
{
|
||||
return Strings::Join(DatabaseSchema::GetContentTables(), " ");
|
||||
std::string tables_list;
|
||||
|
||||
std::vector<std::string> tables = DatabaseSchema::GetContentTables();
|
||||
for (const auto &table : tables) {
|
||||
tables_list += table + " ";
|
||||
}
|
||||
|
||||
return Strings::Trim(tables_list);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -250,11 +306,6 @@ void DatabaseDumpService::Dump()
|
||||
dump_descriptor += "-bots";
|
||||
}
|
||||
|
||||
if (IsDumpMercTables()) {
|
||||
tables_to_dump += GetMercTablesList() + " ";
|
||||
dump_descriptor += "-mercs";
|
||||
}
|
||||
|
||||
if (IsDumpSystemTables()) {
|
||||
tables_to_dump += GetSystemTablesList() + " ";
|
||||
dump_descriptor += "-system";
|
||||
@@ -324,7 +375,7 @@ void DatabaseDumpService::Dump()
|
||||
}
|
||||
|
||||
if (!tables_to_dump.empty()) {
|
||||
LogInfo("Dumping Tables [{}]", Strings::Trim(tables_to_dump));
|
||||
LogInfo("Dumping Tables [{}]", tables_to_dump);
|
||||
}
|
||||
|
||||
LogInfo("Database dump created at [{}.sql]", GetDumpFileNameWithPath());
|
||||
@@ -525,13 +576,3 @@ void DatabaseDumpService::SetDumpBotTables(bool dump_bot_tables)
|
||||
{
|
||||
DatabaseDumpService::dump_bot_tables = dump_bot_tables;
|
||||
}
|
||||
|
||||
bool DatabaseDumpService::IsDumpMercTables() const
|
||||
{
|
||||
return dump_merc_tables;
|
||||
}
|
||||
|
||||
void DatabaseDumpService::SetDumpMercTables(bool dump_merc_tables)
|
||||
{
|
||||
DatabaseDumpService::dump_merc_tables = dump_merc_tables;
|
||||
}
|
||||
|
||||
@@ -55,8 +55,6 @@ public:
|
||||
void SetDumpStateTables(bool dump_state_tables);
|
||||
bool IsDumpBotTables() const;
|
||||
void SetDumpBotTables(bool dump_bot_tables);
|
||||
bool IsDumpMercTables() const;
|
||||
void SetDumpMercTables(bool dump_bot_tables);
|
||||
|
||||
private:
|
||||
bool dump_all_tables = false;
|
||||
@@ -72,7 +70,6 @@ private:
|
||||
bool dump_output_to_console = false;
|
||||
bool dump_drop_table_syntax_only = false;
|
||||
bool dump_bot_tables = false;
|
||||
bool dump_merc_tables = false;
|
||||
std::string dump_path;
|
||||
std::string dump_file_name;
|
||||
|
||||
@@ -81,7 +78,6 @@ private:
|
||||
std::string GetBaseMySQLDumpCommand();
|
||||
std::string GetPlayerTablesList();
|
||||
std::string GetBotTablesList();
|
||||
std::string GetMercTablesList();
|
||||
std::string GetSystemTablesList();
|
||||
std::string GetStateTablesList();
|
||||
std::string GetContentTablesList();
|
||||
|
||||
@@ -476,12 +476,6 @@ bool Database::CheckDatabaseConversions() {
|
||||
CheckDatabaseConvertPPDeblob();
|
||||
CheckDatabaseConvertCorpseDeblob();
|
||||
|
||||
RuleManager::Instance()->LoadRules(this, "default", false);
|
||||
if (!RuleB(Bots, Enabled) && DoesTableExist("bot_data")) {
|
||||
LogInfo("Bot tables found but rule not enabled, enabling");
|
||||
RuleManager::Instance()->SetRule("Bots:Enabled", "true", this, true, true);
|
||||
}
|
||||
|
||||
/* Run EQEmu Server script (Checks for database updates) */
|
||||
|
||||
const std::string file = fmt::format("{}/eqemu_server.pl", path.GetServerPath());
|
||||
|
||||
@@ -332,9 +332,7 @@ namespace DatabaseSchema {
|
||||
"ip_exemptions",
|
||||
"item_tick",
|
||||
"lfguild",
|
||||
"merc_buffs",
|
||||
"merchantlist_temp",
|
||||
"mercs",
|
||||
"object_contents",
|
||||
"raid_details",
|
||||
"raid_leaders",
|
||||
@@ -408,28 +406,9 @@ namespace DatabaseSchema {
|
||||
"bot_spell_settings",
|
||||
"bot_spells_entries",
|
||||
"bot_stances",
|
||||
"bot_timers"
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> GetMercTables()
|
||||
{
|
||||
return {
|
||||
"merc_armorinfo",
|
||||
"merc_inventory",
|
||||
"merc_merchant_entries",
|
||||
"merc_merchant_template_entries",
|
||||
"merc_merchant_templates",
|
||||
"merc_name_types",
|
||||
"merc_npc_types",
|
||||
"merc_spell_list_entries",
|
||||
"merc_spell_lists",
|
||||
"merc_stance_entries",
|
||||
"merc_stats",
|
||||
"merc_subtypes",
|
||||
"merc_templates",
|
||||
"merc_types",
|
||||
"merc_weaponinfo"
|
||||
"bot_timers",
|
||||
"vw_bot_character_mobs",
|
||||
"vw_bot_groups"
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -167,7 +167,7 @@ MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, boo
|
||||
if (LogSys.log_settings[Logs::MySQLQuery].is_category_enabled == 1) {
|
||||
if ((strncasecmp(query, "select", 6) == 0)) {
|
||||
LogMySQLQuery(
|
||||
"{0} -- ({1} row{2} returned) ({3}s)",
|
||||
"{0}; -- ({1} row{2} returned) ({3}s)",
|
||||
query,
|
||||
requestResult.RowCount(),
|
||||
requestResult.RowCount() == 1 ? "" : "s",
|
||||
@@ -176,7 +176,7 @@ MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, boo
|
||||
}
|
||||
else {
|
||||
LogMySQLQuery(
|
||||
"{0} -- ({1} row{2} affected) ({3}s)",
|
||||
"{0}; -- ({1} row{2} affected) ({3}s)",
|
||||
query,
|
||||
requestResult.RowsAffected(),
|
||||
requestResult.RowsAffected() == 1 ? "" : "s",
|
||||
|
||||
@@ -48,7 +48,7 @@ void Discord::SendWebhookMessage(const std::string &message, const std::string &
|
||||
while (retry) {
|
||||
if (auto res = cli.Post(endpoint.c_str(), payload.str(), "application/json")) {
|
||||
if (res->status != 200 && res->status != 204) {
|
||||
LogError("Code [{}] Error [{}]", res->status, res->body);
|
||||
LogError("[Discord Client] Code [{}] Error [{}]", res->status, res->body);
|
||||
}
|
||||
if (res->status == 429) {
|
||||
if (!res->body.empty()) {
|
||||
|
||||
+177
-149
@@ -22,19 +22,21 @@
|
||||
#include "rulesys.h"
|
||||
#include "platform.h"
|
||||
#include "strings.h"
|
||||
#include "misc.h"
|
||||
#include "discord/discord.h"
|
||||
#include "repositories/discord_webhooks_repository.h"
|
||||
#include "repositories/logsys_categories_repository.h"
|
||||
#include "termcolor/rang.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <iomanip>
|
||||
#include <time.h>
|
||||
#include <sys/stat.h>
|
||||
#include <algorithm>
|
||||
|
||||
std::ofstream process_log;
|
||||
|
||||
#include <filesystem>
|
||||
|
||||
#ifdef _WINDOWS
|
||||
#include <direct.h>
|
||||
#include <conio.h>
|
||||
@@ -50,12 +52,46 @@ std::ofstream process_log;
|
||||
|
||||
#endif
|
||||
|
||||
/**
|
||||
* Linux ANSI console color defines
|
||||
*/
|
||||
#define LC_RESET "\033[0m"
|
||||
#define LC_BLACK "\033[30m" /* Black */
|
||||
#define LC_RED "\033[31m" /* Red */
|
||||
#define LC_GREEN "\033[32m" /* Green */
|
||||
#define LC_YELLOW "\033[33m" /* Yellow */
|
||||
#define LC_BLUE "\033[34m" /* Blue */
|
||||
#define LC_MAGENTA "\033[35m" /* Magenta */
|
||||
#define LC_CYAN "\033[36m" /* Cyan */
|
||||
#define LC_WHITE "\033[37m" /* White */
|
||||
|
||||
namespace Console {
|
||||
enum Color {
|
||||
Black = 0,
|
||||
Blue = 1,
|
||||
Green = 2,
|
||||
Cyan = 3,
|
||||
Red = 4,
|
||||
Magenta = 5,
|
||||
Brown = 6,
|
||||
LightGray = 7,
|
||||
DarkGray = 8,
|
||||
LightBlue = 9,
|
||||
LightGreen = 10,
|
||||
LightCyan = 11,
|
||||
LightRed = 12,
|
||||
LightMagenta = 13,
|
||||
Yellow = 14,
|
||||
White = 15
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* EQEmuLogSys Constructor
|
||||
*/
|
||||
EQEmuLogSys::EQEmuLogSys()
|
||||
{
|
||||
m_on_log_gmsay_hook = [](uint16 log_type, const char *func, const std::string &) {};
|
||||
m_on_log_gmsay_hook = [](uint16 log_type, const std::string &) {};
|
||||
m_on_log_console_hook = [](uint16 log_type, const std::string &) {};
|
||||
}
|
||||
|
||||
@@ -84,8 +120,14 @@ EQEmuLogSys *EQEmuLogSys::LoadLogSettingsDefaults()
|
||||
/**
|
||||
* Set Defaults
|
||||
*/
|
||||
log_settings[Logs::WorldServer].log_to_console = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::ZoneServer].log_to_console = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::QSServer].log_to_console = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::UCSServer].log_to_console = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::Crash].log_to_console = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::MySQLError].log_to_console = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::Loginserver].log_to_console = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::HeadlessClient].log_to_console = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::NPCScaling].log_to_gmsay = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::HotReload].log_to_gmsay = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::HotReload].log_to_console = static_cast<uint8>(Logs::General);
|
||||
@@ -104,8 +146,12 @@ EQEmuLogSys *EQEmuLogSys::LoadLogSettingsDefaults()
|
||||
/**
|
||||
* RFC 5424
|
||||
*/
|
||||
log_settings[Logs::Emergency].log_to_console = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::Alert].log_to_console = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::Critical].log_to_console = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::Error].log_to_console = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::Warning].log_to_console = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::Notice].log_to_console = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::Info].log_to_console = static_cast<uint8>(Logs::General);
|
||||
|
||||
/**
|
||||
@@ -150,6 +196,24 @@ EQEmuLogSys *EQEmuLogSys::LoadLogSettingsDefaults()
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param log_category
|
||||
* @return
|
||||
*/
|
||||
bool EQEmuLogSys::IsRfc5424LogCategory(uint16 log_category)
|
||||
{
|
||||
return (
|
||||
log_category == Logs::Emergency ||
|
||||
log_category == Logs::Alert ||
|
||||
log_category == Logs::Critical ||
|
||||
log_category == Logs::Error ||
|
||||
log_category == Logs::Warning ||
|
||||
log_category == Logs::Notice ||
|
||||
log_category == Logs::Info ||
|
||||
log_category == Logs::Debug
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param debug_level
|
||||
* @param log_category
|
||||
@@ -180,6 +244,66 @@ void EQEmuLogSys::ProcessLogWrite(
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param log_category
|
||||
* @return
|
||||
*/
|
||||
uint16 EQEmuLogSys::GetWindowsConsoleColorFromCategory(uint16 log_category)
|
||||
{
|
||||
switch (log_category) {
|
||||
case Logs::Status:
|
||||
case Logs::Normal:
|
||||
return Console::Color::Yellow;
|
||||
case Logs::MySQLError:
|
||||
case Logs::Error:
|
||||
case Logs::QuestErrors:
|
||||
return Console::Color::LightRed;
|
||||
case Logs::MySQLQuery:
|
||||
case Logs::Debug:
|
||||
return Console::Color::LightGreen;
|
||||
case Logs::Quests:
|
||||
return Console::Color::LightCyan;
|
||||
case Logs::Commands:
|
||||
case Logs::Mercenaries:
|
||||
return Console::Color::LightMagenta;
|
||||
case Logs::Crash:
|
||||
return Console::Color::LightRed;
|
||||
default:
|
||||
return Console::Color::Yellow;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param log_category
|
||||
* @return
|
||||
*/
|
||||
std::string EQEmuLogSys::GetLinuxConsoleColorFromCategory(uint16 log_category)
|
||||
{
|
||||
switch (log_category) {
|
||||
case Logs::Status:
|
||||
case Logs::Normal:
|
||||
return LC_YELLOW;
|
||||
case Logs::MySQLError:
|
||||
case Logs::QuestErrors:
|
||||
case Logs::Warning:
|
||||
case Logs::Critical:
|
||||
case Logs::Error:
|
||||
return LC_RED;
|
||||
case Logs::MySQLQuery:
|
||||
case Logs::Debug:
|
||||
return LC_GREEN;
|
||||
case Logs::Quests:
|
||||
return LC_CYAN;
|
||||
case Logs::Commands:
|
||||
case Logs::Mercenaries:
|
||||
return LC_MAGENTA;
|
||||
case Logs::Crash:
|
||||
return LC_RED;
|
||||
default:
|
||||
return LC_YELLOW;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param log_category
|
||||
* @return
|
||||
@@ -187,6 +311,9 @@ void EQEmuLogSys::ProcessLogWrite(
|
||||
uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category)
|
||||
{
|
||||
switch (log_category) {
|
||||
case Logs::Status:
|
||||
case Logs::Normal:
|
||||
return Chat::Yellow;
|
||||
case Logs::MySQLError:
|
||||
case Logs::QuestErrors:
|
||||
case Logs::Error:
|
||||
@@ -206,144 +333,28 @@ uint16 EQEmuLogSys::GetGMSayColorFromCategory(uint16 log_category)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param debug_level
|
||||
* @param log_category
|
||||
* @param message
|
||||
*/
|
||||
void EQEmuLogSys::ProcessConsoleMessage(
|
||||
uint16 log_category,
|
||||
const std::string &message,
|
||||
const char *file,
|
||||
const char *func,
|
||||
int line
|
||||
)
|
||||
void EQEmuLogSys::ProcessConsoleMessage(uint16 log_category, const std::string &message)
|
||||
{
|
||||
bool is_error = (
|
||||
log_category == Logs::LogCategory::Error ||
|
||||
log_category == Logs::LogCategory::MySQLError ||
|
||||
log_category == Logs::LogCategory::Crash ||
|
||||
log_category == Logs::LogCategory::QuestErrors
|
||||
);
|
||||
bool is_warning = (
|
||||
log_category == Logs::LogCategory::Warning
|
||||
);
|
||||
|
||||
(!is_error ? std::cout : std::cerr)
|
||||
<< ""
|
||||
<< rang::fgB::black
|
||||
<< rang::style::bold
|
||||
<< fmt::format("{:>6}", GetPlatformName().substr(0, 6))
|
||||
<< rang::style::reset
|
||||
<< rang::fgB::gray
|
||||
<< " | "
|
||||
<< ((is_error || is_warning) ? rang::fgB::red : rang::fgB::gray)
|
||||
<< rang::style::bold
|
||||
<< fmt::format("{:^10}", fmt::format("{}", Logs::LogCategoryName[log_category]).substr(0, 10))
|
||||
<< rang::style::reset
|
||||
<< rang::fgB::gray
|
||||
<< " | "
|
||||
<< rang::fgB::gray
|
||||
<< rang::style::bold
|
||||
<< fmt::format("{}", func)
|
||||
<< rang::style::reset
|
||||
<< rang::fgB::gray
|
||||
<< " ";
|
||||
|
||||
if (RuleB(Logging, PrintFileFunctionAndLine)) {
|
||||
(!is_error ? std::cout : std::cerr)
|
||||
<< ""
|
||||
<< rang::fgB::green
|
||||
<< rang::style::bold
|
||||
<< fmt::format("{:}", fmt::format("{}:{}:{}", std::filesystem::path(file).filename().string(), func, line))
|
||||
<< rang::style::reset
|
||||
<< " | ";
|
||||
}
|
||||
|
||||
if (log_category == Logs::LogCategory::MySQLQuery) {
|
||||
auto s = Strings::Split(message, "--");
|
||||
if (s.size() > 1) {
|
||||
std::string query = Strings::Trim(s[0]);
|
||||
std::string meta = Strings::Trim(s[1]);
|
||||
|
||||
std::cout <<
|
||||
rang::fgB::green
|
||||
<<
|
||||
query
|
||||
<<
|
||||
rang::style::reset;
|
||||
|
||||
std::cout <<
|
||||
rang::fgB::black
|
||||
<<
|
||||
" -- "
|
||||
<<
|
||||
meta
|
||||
<<
|
||||
rang::style::reset;
|
||||
}
|
||||
}
|
||||
else if (Strings::Contains(message, "[")) {
|
||||
for (auto &e: Strings::Split(message, " ")) {
|
||||
if (Strings::Contains(e, "[") && Strings::Contains(e, "]")) {
|
||||
e = Strings::Replace(e, "[", "");
|
||||
e = Strings::Replace(e, "]", "");
|
||||
|
||||
bool is_upper = false;
|
||||
|
||||
for (int i = 0; i < strlen(e.c_str()); i++) {
|
||||
if (isupper(e[i])) {
|
||||
is_upper = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (!is_upper) {
|
||||
(!is_error ? std::cout : std::cerr)
|
||||
<< rang::fgB::gray
|
||||
<< "["
|
||||
<< rang::style::bold
|
||||
<< rang::fgB::yellow
|
||||
<< e
|
||||
<< rang::fgB::gray
|
||||
<< "] "
|
||||
;
|
||||
}
|
||||
else {
|
||||
(!is_error ? std::cout : std::cerr) << rang::fgB::gray << "[" << e << "] ";
|
||||
}
|
||||
}
|
||||
else {
|
||||
(!is_error ? std::cout : std::cerr)
|
||||
<< (is_error ? rang::fgB::red : rang::fgB::gray)
|
||||
<< e
|
||||
<< " ";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
(!is_error ? std::cout : std::cerr)
|
||||
<< (is_error ? rang::fgB::red : rang::fgB::gray)
|
||||
<< message
|
||||
<< " ";
|
||||
}
|
||||
|
||||
if (!origination_info.zone_short_name.empty()) {
|
||||
(!is_error ? std::cout : std::cerr)
|
||||
<<
|
||||
rang::fgB::black
|
||||
<<
|
||||
"-- "
|
||||
<<
|
||||
fmt::format(
|
||||
"[{}] ({}) inst_id [{}]",
|
||||
origination_info.zone_short_name,
|
||||
origination_info.zone_long_name,
|
||||
origination_info.instance_id
|
||||
);
|
||||
}
|
||||
|
||||
(!is_error ? std::cout : std::cerr) << rang::style::reset << std::endl;
|
||||
#ifdef _WINDOWS
|
||||
HANDLE console_handle;
|
||||
console_handle = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
CONSOLE_FONT_INFOEX info = { 0 };
|
||||
info.cbSize = sizeof(info);
|
||||
info.dwFontSize.Y = 12; // leave X as zero
|
||||
info.FontWeight = FW_NORMAL;
|
||||
wcscpy(info.FaceName, L"Lucida Console");
|
||||
SetCurrentConsoleFontEx(console_handle, NULL, &info);
|
||||
SetConsoleTextAttribute(console_handle, EQEmuLogSys::GetWindowsConsoleColorFromCategory(log_category));
|
||||
std::cout << message << "\n";
|
||||
SetConsoleTextAttribute(console_handle, Console::Color::White);
|
||||
#else
|
||||
std::cout << EQEmuLogSys::GetLinuxConsoleColorFromCategory(log_category) << message << LC_RESET << std::endl;
|
||||
#endif
|
||||
|
||||
m_on_log_console_hook(log_category, message);
|
||||
}
|
||||
@@ -357,6 +368,33 @@ constexpr const char *str_end(const char *str)
|
||||
return *str ? str_end(str + 1) : str;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
constexpr bool str_slant(const char *str)
|
||||
{
|
||||
return *str == '/' ? true : (*str ? str_slant(str + 1) : false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
constexpr const char *r_slant(const char *str)
|
||||
{
|
||||
return *str == '/' ? (str + 1) : r_slant(str - 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
constexpr const char *base_file_name(const char *str)
|
||||
{
|
||||
return str_slant(str) ? r_slant(str_end(str)) : str;
|
||||
}
|
||||
|
||||
/**
|
||||
* Core logging function
|
||||
*
|
||||
@@ -384,7 +422,7 @@ void EQEmuLogSys::Out(
|
||||
|
||||
std::string prefix;
|
||||
if (RuleB(Logging, PrintFileFunctionAndLine)) {
|
||||
prefix = fmt::format("[{0}::{1}:{2}] ", std::filesystem::path(file).filename().string(), func, line);
|
||||
prefix = fmt::format("[{0}::{1}:{2}] ", base_file_name(file), func, line);
|
||||
}
|
||||
|
||||
// remove this when we remove all legacy logs
|
||||
@@ -407,14 +445,11 @@ void EQEmuLogSys::Out(
|
||||
if (l.log_to_console_enabled) {
|
||||
EQEmuLogSys::ProcessConsoleMessage(
|
||||
log_category,
|
||||
output_message,
|
||||
file,
|
||||
func,
|
||||
line
|
||||
fmt::format("[{}] [{}] {}", GetPlatformName(), Logs::LogCategoryName[log_category], prefix + output_message)
|
||||
);
|
||||
}
|
||||
if (l.log_to_gmsay_enabled) {
|
||||
m_on_log_gmsay_hook(log_category, func, output_message);
|
||||
m_on_log_gmsay_hook(log_category, output_message);
|
||||
}
|
||||
if (l.log_to_file_enabled) {
|
||||
EQEmuLogSys::ProcessLogWrite(
|
||||
@@ -528,8 +563,6 @@ void EQEmuLogSys::SilenceConsoleLogging()
|
||||
log_settings[log_index].log_to_console = 0;
|
||||
log_settings[log_index].is_category_enabled = 0;
|
||||
}
|
||||
|
||||
log_settings[Logs::Crash].log_to_console = static_cast<uint8>(Logs::General);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -634,11 +667,6 @@ EQEmuLogSys *EQEmuLogSys::LoadLogDatabaseSettings()
|
||||
LogInfo("Loaded [{}] Discord webhooks", webhooks.size());
|
||||
}
|
||||
|
||||
// force override this setting
|
||||
log_settings[Logs::Crash].log_to_console = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::Crash].log_to_gmsay = static_cast<uint8>(Logs::General);
|
||||
log_settings[Logs::Crash].log_to_file = static_cast<uint8>(Logs::General);
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
+62
-63
@@ -39,7 +39,8 @@
|
||||
namespace Logs {
|
||||
enum DebugLevel {
|
||||
General = 1, // 1 - Low-Level general debugging, useful info on single line
|
||||
Detail // 2 - Use this for very chatty logging you want to leave in but don't want on by default
|
||||
Moderate, // 2 - Informational based, used in functions, when particular things load
|
||||
Detail // 3 - Use this for extreme detail in logging, usually in extreme debugging in the stack or interprocess communication
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -53,7 +54,7 @@ namespace Logs {
|
||||
AI,
|
||||
Aggro,
|
||||
Attack,
|
||||
DeprecatedCS, // deprecated
|
||||
DeprecatedCS,
|
||||
Combat,
|
||||
Commands,
|
||||
Crash,
|
||||
@@ -64,36 +65,36 @@ namespace Logs {
|
||||
Inventory,
|
||||
Launcher,
|
||||
Netcode,
|
||||
Normal, // deprecated
|
||||
Normal,
|
||||
Object,
|
||||
Pathing,
|
||||
QSServer, // deprecated
|
||||
QSServer,
|
||||
Quests,
|
||||
Rules,
|
||||
Skills,
|
||||
Spawns,
|
||||
Spells,
|
||||
Status, // deprecated
|
||||
Status,
|
||||
TCPConnection,
|
||||
Tasks,
|
||||
Tradeskills,
|
||||
Trading,
|
||||
Tribute,
|
||||
UCSServer, // deprecated
|
||||
WebInterfaceServer, // deprecated
|
||||
WorldServer, // deprecated
|
||||
ZoneServer, // deprecated
|
||||
UCSServer,
|
||||
WebInterfaceServer,
|
||||
WorldServer,
|
||||
ZoneServer,
|
||||
MySQLError,
|
||||
MySQLQuery,
|
||||
Mercenaries,
|
||||
QuestDebug,
|
||||
DeprecatedSC, // deprecated
|
||||
DeprecatedCSU, // deprecated
|
||||
DeprecatedSCD, // deprecated
|
||||
DeprecatedCSD, // deprecated
|
||||
Loginserver, // deprecated
|
||||
DeprecatedSC,
|
||||
DeprecatedCSU,
|
||||
DeprecatedSCD,
|
||||
DeprecatedCSD,
|
||||
Loginserver,
|
||||
ClientLogin,
|
||||
HeadlessClient, // deprecated
|
||||
HeadlessClient,
|
||||
HPUpdate,
|
||||
FixZ,
|
||||
Food,
|
||||
@@ -103,10 +104,10 @@ namespace Logs {
|
||||
MobAppearance,
|
||||
Info,
|
||||
Warning,
|
||||
Critical, // deprecated
|
||||
Emergency, // deprecated
|
||||
Alert, // deprecated
|
||||
Notice, // deprecated
|
||||
Critical,
|
||||
Emergency,
|
||||
Alert,
|
||||
Notice,
|
||||
AIScanClose,
|
||||
AIYellForHelp,
|
||||
AICastBeneficialClose,
|
||||
@@ -159,52 +160,52 @@ namespace Logs {
|
||||
"Inventory",
|
||||
"Launcher",
|
||||
"Netcode",
|
||||
"Normal (Deprecated)",
|
||||
"Normal",
|
||||
"Object",
|
||||
"Pathing",
|
||||
"QS Server (Deprecated)",
|
||||
"QS Server",
|
||||
"Quests",
|
||||
"Rules",
|
||||
"Skills",
|
||||
"Spawns",
|
||||
"Spells",
|
||||
"Status (Deprecated)",
|
||||
"Status",
|
||||
"TCP Connection",
|
||||
"Tasks",
|
||||
"Tradeskills",
|
||||
"Trading",
|
||||
"Tribute",
|
||||
"UCS Server (Deprecated)",
|
||||
"Web Interface (Deprecated)",
|
||||
"World Server (Deprecated)",
|
||||
"Zone Server (Deprecated)",
|
||||
"QueryErr",
|
||||
"Query",
|
||||
"UCS Server",
|
||||
"WebInterface Server",
|
||||
"World Server",
|
||||
"Zone Server",
|
||||
"MySQL Error",
|
||||
"MySQL Query",
|
||||
"Mercenaries",
|
||||
"Quest Debug",
|
||||
"Legacy Packet Logging (Deprecated)",
|
||||
"Legacy Packet Logging (Deprecated)",
|
||||
"Legacy Packet Logging (Deprecated)",
|
||||
"Legacy Packet Logging (Deprecated)",
|
||||
"Login Server (Deprecated)",
|
||||
"Deprecated",
|
||||
"Deprecated",
|
||||
"Deprecated",
|
||||
"Deprecated",
|
||||
"Login Server",
|
||||
"Client Login",
|
||||
"Headless Client (Deprecated)",
|
||||
"Headless Client",
|
||||
"HP Update",
|
||||
"FixZ",
|
||||
"Food",
|
||||
"Traps",
|
||||
"NPC Roam Box",
|
||||
"NPC Scaling",
|
||||
"MobAppearance",
|
||||
"Mob Appearance",
|
||||
"Info",
|
||||
"Warning",
|
||||
"Critical (Deprecated)",
|
||||
"Emergency (Deprecated)",
|
||||
"Alert (Deprecated)",
|
||||
"Notice (Deprecated)",
|
||||
"AI Scan",
|
||||
"AI Yell",
|
||||
"AI CastBeneficial",
|
||||
"Critical",
|
||||
"Emergency",
|
||||
"Alert",
|
||||
"Notice",
|
||||
"AI Scan Close",
|
||||
"AI Yell For Help",
|
||||
"AI Cast Beneficial Close",
|
||||
"AOE Cast",
|
||||
"Entity Management",
|
||||
"Flee",
|
||||
@@ -221,14 +222,14 @@ namespace Logs {
|
||||
"DialogueWindow",
|
||||
"HTTP",
|
||||
"Saylink",
|
||||
"ChecksumVer",
|
||||
"ChecksumVerification",
|
||||
"CombatRecord",
|
||||
"Hate",
|
||||
"Discord",
|
||||
"Faction",
|
||||
"Packet S->C",
|
||||
"Packet C->S",
|
||||
"Packet S->S",
|
||||
"Packet-S->C",
|
||||
"Packet-C->S",
|
||||
"Packet-S->S",
|
||||
"Bugs",
|
||||
"QuestErrors"
|
||||
};
|
||||
@@ -344,7 +345,7 @@ public:
|
||||
// gmsay
|
||||
uint16 GetGMSayColorFromCategory(uint16 log_category);
|
||||
|
||||
EQEmuLogSys *SetGMSayHandler(const std::function<void(uint16 log_type, const char *func, const std::string &)>& f)
|
||||
EQEmuLogSys *SetGMSayHandler(std::function<void(uint16 log_type, const std::string &)> f)
|
||||
{
|
||||
m_on_log_gmsay_hook = f;
|
||||
return this;
|
||||
@@ -375,24 +376,22 @@ public:
|
||||
private:
|
||||
|
||||
// reference to database
|
||||
Database *m_database;
|
||||
std::function<void(uint16 log_category, const char *func, const std::string &)> m_on_log_gmsay_hook;
|
||||
std::function<void(uint16 log_category, int webhook_id, const std::string &)> m_on_log_discord_hook;
|
||||
std::function<void(uint16 log_category, const std::string &)> m_on_log_console_hook;
|
||||
DiscordWebhooks m_discord_webhooks[MAX_DISCORD_WEBHOOK_ID]{};
|
||||
bool m_file_logs_enabled = false;
|
||||
int m_log_platform = 0;
|
||||
std::string m_platform_file_name;
|
||||
std::string m_log_path;
|
||||
Database *m_database;
|
||||
std::function<void(uint16 log_category, const std::string &)> m_on_log_gmsay_hook;
|
||||
std::function<void(uint16 log_category, int webhook_id, const std::string &)> m_on_log_discord_hook;
|
||||
std::function<void(uint16 log_category, const std::string &)> m_on_log_console_hook;
|
||||
DiscordWebhooks m_discord_webhooks[MAX_DISCORD_WEBHOOK_ID]{};
|
||||
bool m_file_logs_enabled = false;
|
||||
int m_log_platform = 0;
|
||||
std::string m_platform_file_name;
|
||||
std::string m_log_path;
|
||||
|
||||
void ProcessConsoleMessage(
|
||||
uint16 log_category,
|
||||
const std::string &message,
|
||||
const char *file,
|
||||
const char *func,
|
||||
int line
|
||||
);
|
||||
std::string GetLinuxConsoleColorFromCategory(uint16 log_category);
|
||||
uint16 GetWindowsConsoleColorFromCategory(uint16 log_category);
|
||||
|
||||
void ProcessConsoleMessage(uint16 log_category, const std::string &message);
|
||||
void ProcessLogWrite(uint16 log_category, const std::string &message);
|
||||
bool IsRfc5424LogCategory(uint16 log_category);
|
||||
void InjectTablesIfNotExist();
|
||||
};
|
||||
|
||||
|
||||
@@ -21,6 +21,8 @@
|
||||
#ifndef EQEMU_EQEMU_LOGSYS_LOG_ALIASES_H
|
||||
#define EQEMU_EQEMU_LOGSYS_LOG_ALIASES_H
|
||||
|
||||
#ifdef BUILD_LOGGING
|
||||
|
||||
#define LogAA(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::General, Logs::AA))\
|
||||
OutF(LogSys, Logs::General, Logs::AA, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
@@ -36,6 +38,11 @@
|
||||
OutF(LogSys, Logs::General, Logs::AI, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogAIModerate(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::Moderate, Logs::AI))\
|
||||
OutF(LogSys, Logs::Moderate, Logs::AI, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogAIDetail(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::Detail, Logs::AI))\
|
||||
OutF(LogSys, Logs::Detail, Logs::AI, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
@@ -76,6 +83,11 @@
|
||||
OutF(LogSys, Logs::General, Logs::Combat, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogCombatModerate(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::Moderate, Logs::Combat))\
|
||||
OutF(LogSys, Logs::Moderate, Logs::Combat, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogCombatDetail(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::Detail, Logs::Combat))\
|
||||
OutF(LogSys, Logs::Detail, Logs::Combat, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
@@ -201,6 +213,16 @@
|
||||
OutF(LogSys, Logs::Detail, Logs::Pathing, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogQSServer(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::General, Logs::QSServer))\
|
||||
OutF(LogSys, Logs::General, Logs::QSServer, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogQSServerDetail(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::Detail, Logs::QSServer))\
|
||||
OutF(LogSys, Logs::Detail, Logs::QSServer, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogQuests(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::General, Logs::Quests))\
|
||||
OutF(LogSys, Logs::General, Logs::Quests, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
@@ -246,6 +268,11 @@
|
||||
OutF(LogSys, Logs::General, Logs::Spells, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogSpellsModerate(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::Moderate, Logs::Spells))\
|
||||
OutF(LogSys, Logs::Moderate, Logs::Spells, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogSpellsDetail(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::Detail, Logs::Spells))\
|
||||
OutF(LogSys, Logs::Detail, Logs::Spells, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
@@ -311,6 +338,46 @@
|
||||
OutF(LogSys, Logs::Detail, Logs::Tribute, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogUCSServer(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::General, Logs::UCSServer))\
|
||||
OutF(LogSys, Logs::General, Logs::UCSServer, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogUCSServerDetail(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::Detail, Logs::UCSServer))\
|
||||
OutF(LogSys, Logs::Detail, Logs::UCSServer, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogWebInterfaceServer(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::General, Logs::WebInterfaceServer))\
|
||||
OutF(LogSys, Logs::General, Logs::WebInterfaceServer, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogWebInterfaceServerDetail(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::Detail, Logs::WebInterfaceServer))\
|
||||
OutF(LogSys, Logs::Detail, Logs::WebInterfaceServer, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogWorldServer(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::General, Logs::WorldServer))\
|
||||
OutF(LogSys, Logs::General, Logs::WorldServer, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogWorldServerDetail(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::Detail, Logs::WorldServer))\
|
||||
OutF(LogSys, Logs::Detail, Logs::WorldServer, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogZoneServer(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::General, Logs::ZoneServer))\
|
||||
OutF(LogSys, Logs::General, Logs::ZoneServer, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogZoneServerDetail(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::Detail, Logs::ZoneServer))\
|
||||
OutF(LogSys, Logs::Detail, Logs::ZoneServer, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogMySQLError(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::General, Logs::MySQLError))\
|
||||
OutF(LogSys, Logs::General, Logs::MySQLError, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
@@ -382,6 +449,16 @@
|
||||
OutF(LogSys, Logs::Detail, Logs::ClientLogin, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogHeadlessClient(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::General, Logs::HeadlessClient))\
|
||||
OutF(LogSys, Logs::General, Logs::HeadlessClient, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogHeadlessClientDetail(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::Detail, Logs::HeadlessClient))\
|
||||
OutF(LogSys, Logs::Detail, Logs::HeadlessClient, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogHPUpdate(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::General, Logs::HPUpdate))\
|
||||
OutF(LogSys, Logs::General, Logs::HPUpdate, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
@@ -517,6 +594,11 @@
|
||||
OutF(LogSys, Logs::General, Logs::AIScanClose, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogAIScanCloseModerate(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::Moderate, Logs::AIScanClose))\
|
||||
OutF(LogSys, Logs::Moderate, Logs::AIScanClose, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogAIScanCloseDetail(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::Detail, Logs::AIScanClose))\
|
||||
OutF(LogSys, Logs::Detail, Logs::AIScanClose, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
@@ -764,6 +846,11 @@
|
||||
|
||||
// manually created
|
||||
|
||||
#define LogExpeditionsModerate(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::Moderate, Logs::Expeditions))\
|
||||
OutF(LogSys, Logs::Moderate, Logs::Expeditions, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#define LogBugs(message, ...) do {\
|
||||
if (LogSys.IsLogEnabled(Logs::General, Logs::Bugs))\
|
||||
OutF(LogSys, Logs::General, Logs::Bugs, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
@@ -794,5 +881,469 @@
|
||||
OutF(LogSys, debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
|
||||
} while (0)
|
||||
|
||||
#else
|
||||
#define LogEmergency(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogAlert(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogCritical(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogError(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogWarning(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogNotice(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogInfo(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogDebug(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
/**
|
||||
* Category
|
||||
*/
|
||||
|
||||
#define LogAA(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogAADetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogAI(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogAIModerate(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogAIDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogAggro(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogAggroDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogAttack(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogAttackDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogPacketClientServer(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogPacketClientServerDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogCombat(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogCombatModerate(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogCombatDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogCommands(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogCommandsDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogCrash(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogCrashDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogDoors(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogDoorsDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogGroup(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogGroupDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogGuilds(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogGuildsDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogInventory(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogInventoryDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogLauncher(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogLauncherDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogNetcode(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogNetcodeDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogNormal(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogNormalDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogObject(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogObjectDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogPathing(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogPathingDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogQSServer(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogQSServerDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogQuests(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogQuestsDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogRules(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogRulesDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogSkills(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogSkillsDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogSpawns(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogSpawnsDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogSpells(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogSpellsModerate(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogSpellsDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogTCPConnection(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogTCPConnectionDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogTasks(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogTasksDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogTradeskills(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogTradeskillsDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogTrading(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogTradingDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogTribute(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogTributeDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogMySQLError(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogMySQLErrorDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogMySQLQuery(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogMySQLQueryDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogMercenaries(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogMercenariesDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogQuestDebug(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogQuestDebugDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogLoginserver(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogLoginserverDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogClientLogin(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogClientLoginDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogHeadlessClient(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogHeadlessClientDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogHPUpdate(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogHPUpdateDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogFixZ(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogFixZDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogFood(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogFoodDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogTraps(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogTrapsDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogNPCRoamBox(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogNPCRoamBoxDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogNPCScaling(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogNPCScalingDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogMobAppearance(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogMobAppearanceDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogStatus(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogStatusDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogAIScanClose(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogAIScanCloseModerate(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogAIScanCloseDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogAIYellForHelp(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogAIYellForHelpDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogAICastBeneficialClose(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogAICastBeneficialCloseDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogAoeCast(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogAoeCastDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogEntityManagement(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogEntityManagementDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogFlee(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogFleeDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogAura(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogAuraDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogHotReload(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogHotReloadDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogMerchants(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogMerchantsDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogZonePoints(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogZonePointsDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogExpeditions(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogExpeditionsModerate(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogExpeditionsDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogDynamicZones(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogDynamicZonesDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogCheatList(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogCheatDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogClientList(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogClientListDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogDiaWind(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogDiaWindDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogHTTP(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogHTTPDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogSaylink(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogSaylinkDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogScheduler(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogSchedulerDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogCheat(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogCheatDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogLoot(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogLootDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogFood(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogFoodDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogChecksumVerification(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogChecksumVerificationDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogCombatRecord(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogCombatRecordDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogHate(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogHateDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogFaction(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogFactionDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogBugs(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogBugsDetail(message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define Log(debug_level, log_category, message, ...) do {\
|
||||
} while (0)
|
||||
|
||||
#define LogF(debug_level, log_category, message, ...) do {\
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#endif //EQEMU_EQEMU_LOGSYS_LOG_ALIASES_H
|
||||
|
||||
+17
-5
@@ -63,9 +63,7 @@ bool BaseGuildManager::LoadGuilds() {
|
||||
for (auto row=results.begin();row!=results.end();++row)
|
||||
_CreateGuild(atoi(row[0]), row[1], atoi(row[2]), atoi(row[3]), row[4], row[5], row[6], row[7]);
|
||||
|
||||
LogInfo("Loaded [{}] Guilds", Strings::Commify(std::to_string(results.RowCount())));
|
||||
|
||||
query = "SELECT guild_id,`rank`,title,can_hear,can_speak,can_invite,can_remove,can_promote,can_demote,can_motd,can_warpeace FROM guild_ranks";
|
||||
query = "SELECT guild_id,`rank`,title,can_hear,can_speak,can_invite,can_remove,can_promote,can_demote,can_motd,can_warpeace FROM guild_ranks";
|
||||
results = m_db->QueryDatabase(query);
|
||||
|
||||
if (!results.Success())
|
||||
@@ -866,11 +864,20 @@ bool BaseGuildManager::QueryWithLogging(std::string query, const char *errmsg) {
|
||||
return(true);
|
||||
}
|
||||
|
||||
//factored out so I dont have to copy this crap.
|
||||
#ifdef BOTS
|
||||
#define GuildMemberBaseQuery \
|
||||
"SELECT c.`id`, c.`name`, c.`class`, c.`level`, c.`last_login`, c.`zone_id`," \
|
||||
" g.`guild_id`, g.`rank`, g.`tribute_enable`, g.`total_tribute`, g.`last_tribute`," \
|
||||
" g.`banker`, g.`public_note`, g.`alt`" \
|
||||
" FROM `vw_bot_character_mobs` AS c LEFT JOIN `vw_guild_members` AS g ON c.`id` = g.`char_id` AND c.`mob_type` = g.`mob_type` "
|
||||
#else
|
||||
#define GuildMemberBaseQuery \
|
||||
"SELECT c.`id`, c.`name`, c.`class`, c.`level`, c.`last_login`, c.`zone_id`," \
|
||||
" g.`guild_id`, g.`rank`, g.`tribute_enable`, g.`total_tribute`, g.`last_tribute`," \
|
||||
" g.`banker`, g.`public_note`, g.`alt` " \
|
||||
" FROM `character_data` AS c LEFT JOIN `guild_members` AS g ON c.`id` = g.`char_id` "
|
||||
#endif
|
||||
static void ProcessGuildMember(MySQLRequestRow row, CharGuildInfo &into) {
|
||||
//fields from `characer_`
|
||||
into.char_id = atoi(row[0]);
|
||||
@@ -960,8 +967,13 @@ bool BaseGuildManager::GetCharInfo(uint32 char_id, CharGuildInfo &into) {
|
||||
}
|
||||
|
||||
//load up the rank info for each guild.
|
||||
std::string query = StringFormat(GuildMemberBaseQuery " WHERE c.id=%d AND c.deleted_at IS NULL", char_id);
|
||||
auto results = m_db->QueryDatabase(query);
|
||||
std::string query;
|
||||
#ifdef BOTS
|
||||
query = StringFormat(GuildMemberBaseQuery " WHERE c.id=%d AND c.mob_type = 'C' AND c.deleted_at IS NULL", char_id);
|
||||
#else
|
||||
query = StringFormat(GuildMemberBaseQuery " WHERE c.id=%d AND c.deleted_at IS NULL", char_id);
|
||||
#endif
|
||||
auto results = m_db->QueryDatabase(query);
|
||||
if (!results.Success()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
|
||||
|
||||
#include "item_instance.h"
|
||||
#include "classes.h"
|
||||
#include "races.h"
|
||||
|
||||
#include <list>
|
||||
#include <vector>
|
||||
@@ -132,7 +130,7 @@ namespace EQ
|
||||
|
||||
// Swap items in inventory
|
||||
enum SwapItemFailState : int8 { swapInvalid = -1, swapPass = 0, swapNotAllowed, swapNullData, swapRaceClass, swapDeity, swapLevel };
|
||||
bool SwapItem(int16 source_slot, int16 destination_slot, SwapItemFailState& fail_state, uint16 race_id = RACE_DOUG_0, uint8 class_id = NO_CLASS, uint16 deity_id = deity::DeityType::DeityUnknown, uint8 level = 0);
|
||||
bool SwapItem(int16 source_slot, int16 destination_slot, SwapItemFailState& fail_state, uint16 race_id = 0, uint8 class_id = 0, uint16 deity_id = 0, uint8 level = 0);
|
||||
|
||||
// Remove item from inventory
|
||||
bool DeleteItem(int16 slot_id, int16 quantity = 0);
|
||||
|
||||
+1
-1
@@ -198,7 +198,7 @@ std::string IpUtil::DNSLookupSync(const std::string &addr, int port)
|
||||
std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
|
||||
if (std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count() > 1500) {
|
||||
LogInfo(
|
||||
"Deadline exceeded [{}]",
|
||||
"[DNSLookupSync] Deadline exceeded [{}]",
|
||||
1500
|
||||
);
|
||||
running = false;
|
||||
|
||||
@@ -534,11 +534,10 @@ bool EQ::ItemInstance::IsNoneEmptyContainer()
|
||||
}
|
||||
|
||||
// Retrieve augment inside item
|
||||
EQ::ItemInstance* EQ::ItemInstance::GetAugment(uint8 augment_index) const
|
||||
EQ::ItemInstance* EQ::ItemInstance::GetAugment(uint8 slot) const
|
||||
{
|
||||
if (m_item && m_item->IsClassCommon()) {
|
||||
return GetItem(augment_index);
|
||||
}
|
||||
if (m_item && m_item->IsClassCommon())
|
||||
return GetItem(slot);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
@@ -664,13 +663,12 @@ bool EQ::ItemInstance::CanTransform(const ItemData *ItemToTry, const ItemData *C
|
||||
return false;
|
||||
}
|
||||
|
||||
uint32 EQ::ItemInstance::GetAugmentItemID(uint8 augment_index) const
|
||||
uint32 EQ::ItemInstance::GetAugmentItemID(uint8 slot) const
|
||||
{
|
||||
if (!m_item || !m_item->IsClassCommon()) {
|
||||
if (!m_item || !m_item->IsClassCommon())
|
||||
return 0;
|
||||
}
|
||||
|
||||
return GetItemID(augment_index);
|
||||
return GetItemID(slot);
|
||||
}
|
||||
|
||||
// Add an augment to the item
|
||||
@@ -1251,7 +1249,7 @@ int EQ::ItemInstance::GetItemBaneDamageBody(bool augments) const
|
||||
|
||||
int EQ::ItemInstance::GetItemBaneDamageRace(bool augments) const
|
||||
{
|
||||
int race = RACE_DOUG_0;
|
||||
int race = 0;
|
||||
const auto item = GetItem();
|
||||
if (item) {
|
||||
race = item->BaneDmgRace;
|
||||
|
||||
@@ -127,8 +127,8 @@ namespace EQ
|
||||
//
|
||||
// Augments
|
||||
//
|
||||
ItemInstance* GetAugment(uint8 augment_index) const;
|
||||
uint32 GetAugmentItemID(uint8 augment_index) const;
|
||||
ItemInstance* GetAugment(uint8 slot) const;
|
||||
uint32 GetAugmentItemID(uint8 slot) const;
|
||||
void PutAugment(uint8 slot, const ItemInstance& inst);
|
||||
void PutAugment(SharedDatabase *db, uint8 slot, uint32 item_id);
|
||||
void DeleteAugment(uint8 slot);
|
||||
|
||||
@@ -665,7 +665,7 @@ namespace RoF
|
||||
|
||||
ENCODE(OP_DeleteCharge)
|
||||
{
|
||||
Log(Logs::Detail, Logs::Netcode, "RoF::ENCODE(OP_DeleteCharge)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "RoF::ENCODE(OP_DeleteCharge)");
|
||||
|
||||
ENCODE_FORWARD(OP_MoveItem);
|
||||
}
|
||||
@@ -1593,7 +1593,7 @@ namespace RoF
|
||||
ENCODE_LENGTH_EXACT(LootingItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "RoF::ENCODE(OP_LootItem)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "RoF::ENCODE(OP_LootItem)");
|
||||
|
||||
OUT(lootee);
|
||||
OUT(looter);
|
||||
@@ -1751,7 +1751,7 @@ namespace RoF
|
||||
ENCODE_LENGTH_EXACT(MoveItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "RoF::ENCODE(OP_MoveItem)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "RoF::ENCODE(OP_MoveItem)");
|
||||
|
||||
eq->from_slot = ServerToRoFSlot(emu->from_slot);
|
||||
eq->to_slot = ServerToRoFSlot(emu->to_slot);
|
||||
@@ -3831,7 +3831,7 @@ namespace RoF
|
||||
}
|
||||
|
||||
float SpawnSize = emu->size;
|
||||
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522))
|
||||
)
|
||||
{
|
||||
@@ -3965,7 +3965,7 @@ namespace RoF
|
||||
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // unknown18
|
||||
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // unknown19
|
||||
|
||||
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)
|
||||
)
|
||||
{
|
||||
@@ -4822,7 +4822,7 @@ namespace RoF
|
||||
DECODE_LENGTH_EXACT(structs::LootingItem_Struct);
|
||||
SETUP_DIRECT_DECODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "RoF::DECODE(OP_LootItem)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "RoF::DECODE(OP_LootItem)");
|
||||
|
||||
IN(lootee);
|
||||
IN(looter);
|
||||
@@ -4837,7 +4837,7 @@ namespace RoF
|
||||
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
|
||||
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "RoF::DECODE(OP_MoveItem)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "RoF::DECODE(OP_MoveItem)");
|
||||
|
||||
emu->from_slot = RoFToServerSlot(eq->from_slot);
|
||||
emu->to_slot = RoFToServerSlot(eq->to_slot);
|
||||
|
||||
@@ -716,7 +716,7 @@ namespace RoF2
|
||||
|
||||
ENCODE(OP_DeleteCharge)
|
||||
{
|
||||
Log(Logs::Detail, Logs::Netcode, "RoF2::ENCODE(OP_DeleteCharge)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "RoF2::ENCODE(OP_DeleteCharge)");
|
||||
|
||||
ENCODE_FORWARD(OP_MoveItem);
|
||||
}
|
||||
@@ -1644,7 +1644,7 @@ namespace RoF2
|
||||
ENCODE_LENGTH_EXACT(LootingItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "RoF2::ENCODE(OP_LootItem)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "RoF2::ENCODE(OP_LootItem)");
|
||||
|
||||
OUT(lootee);
|
||||
OUT(looter);
|
||||
@@ -1802,7 +1802,7 @@ namespace RoF2
|
||||
ENCODE_LENGTH_EXACT(MoveItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "RoF2::ENCODE(OP_MoveItem)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "RoF2::ENCODE(OP_MoveItem)");
|
||||
|
||||
eq->from_slot = ServerToRoF2Slot(emu->from_slot);
|
||||
eq->to_slot = ServerToRoF2Slot(emu->to_slot);
|
||||
@@ -3967,7 +3967,7 @@ namespace RoF2
|
||||
}
|
||||
|
||||
float SpawnSize = emu->size;
|
||||
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522))
|
||||
)
|
||||
{
|
||||
@@ -4172,7 +4172,7 @@ namespace RoF2
|
||||
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // These do something with OP_WeaponEquip1
|
||||
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0xffffffff); // ^
|
||||
|
||||
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)
|
||||
)
|
||||
{
|
||||
@@ -5023,7 +5023,7 @@ namespace RoF2
|
||||
DECODE_LENGTH_EXACT(structs::LootingItem_Struct);
|
||||
SETUP_DIRECT_DECODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "RoF2::DECODE(OP_LootItem)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "RoF2::DECODE(OP_LootItem)");
|
||||
|
||||
IN(lootee);
|
||||
IN(looter);
|
||||
@@ -5038,7 +5038,7 @@ namespace RoF2
|
||||
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
|
||||
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "RoF2::DECODE(OP_MoveItem)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "RoF2::DECODE(OP_MoveItem)");
|
||||
|
||||
emu->from_slot = RoF2ToServerSlot(eq->from_slot);
|
||||
emu->to_slot = RoF2ToServerSlot(eq->to_slot);
|
||||
|
||||
@@ -458,7 +458,7 @@ namespace SoD
|
||||
|
||||
ENCODE(OP_DeleteCharge)
|
||||
{
|
||||
Log(Logs::Detail, Logs::Netcode, "SoD::ENCODE(OP_DeleteCharge)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoD::ENCODE(OP_DeleteCharge)");
|
||||
|
||||
ENCODE_FORWARD(OP_MoveItem);
|
||||
}
|
||||
@@ -1128,7 +1128,7 @@ namespace SoD
|
||||
ENCODE_LENGTH_EXACT(LootingItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "SoD::ENCODE(OP_LootItem)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoD::ENCODE(OP_LootItem)");
|
||||
|
||||
OUT(lootee);
|
||||
OUT(looter);
|
||||
@@ -1277,7 +1277,7 @@ namespace SoD
|
||||
ENCODE_LENGTH_EXACT(MoveItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "SoD::ENCODE(OP_MoveItem)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoD::ENCODE(OP_MoveItem)");
|
||||
|
||||
eq->from_slot = ServerToSoDSlot(emu->from_slot);
|
||||
eq->to_slot = ServerToSoDSlot(emu->to_slot);
|
||||
@@ -2467,7 +2467,7 @@ namespace SoD
|
||||
}
|
||||
|
||||
float SpawnSize = emu->size;
|
||||
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522))
|
||||
)
|
||||
{
|
||||
@@ -2666,7 +2666,7 @@ namespace SoD
|
||||
|
||||
Buffer += sizeof(structs::Spawn_Struct_Position);
|
||||
|
||||
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)
|
||||
)
|
||||
{
|
||||
@@ -2693,7 +2693,7 @@ namespace SoD
|
||||
}
|
||||
|
||||
|
||||
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)
|
||||
)
|
||||
{
|
||||
@@ -3226,7 +3226,7 @@ namespace SoD
|
||||
DECODE_LENGTH_EXACT(structs::LootingItem_Struct);
|
||||
SETUP_DIRECT_DECODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "SoD::DECODE(OP_LootItem)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoD::DECODE(OP_LootItem)");
|
||||
|
||||
IN(lootee);
|
||||
IN(looter);
|
||||
@@ -3241,7 +3241,7 @@ namespace SoD
|
||||
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
|
||||
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "SoD::DECODE(OP_MoveItem)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoD::DECODE(OP_MoveItem)");
|
||||
|
||||
emu->from_slot = SoDToServerSlot(eq->from_slot);
|
||||
emu->to_slot = SoDToServerSlot(eq->to_slot);
|
||||
|
||||
@@ -436,7 +436,7 @@ namespace SoF
|
||||
|
||||
ENCODE(OP_DeleteCharge)
|
||||
{
|
||||
Log(Logs::Detail, Logs::Netcode, "SoF::ENCODE(OP_DeleteCharge)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoF::ENCODE(OP_DeleteCharge)");
|
||||
|
||||
ENCODE_FORWARD(OP_MoveItem);
|
||||
}
|
||||
@@ -923,7 +923,7 @@ namespace SoF
|
||||
ENCODE_LENGTH_EXACT(LootingItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "SoF::ENCODE(OP_LootItem)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoF::ENCODE(OP_LootItem)");
|
||||
|
||||
OUT(lootee);
|
||||
OUT(looter);
|
||||
@@ -954,7 +954,7 @@ namespace SoF
|
||||
ENCODE_LENGTH_EXACT(MoveItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "SoF::ENCODE(OP_MoveItem)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoF::ENCODE(OP_MoveItem)");
|
||||
|
||||
eq->from_slot = ServerToSoFSlot(emu->from_slot);
|
||||
eq->to_slot = ServerToSoFSlot(emu->to_slot);
|
||||
@@ -2631,7 +2631,7 @@ namespace SoF
|
||||
DECODE_LENGTH_EXACT(structs::LootingItem_Struct);
|
||||
SETUP_DIRECT_DECODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "SoF::DECODE(OP_LootItem)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoF::DECODE(OP_LootItem)");
|
||||
|
||||
IN(lootee);
|
||||
IN(looter);
|
||||
@@ -2646,7 +2646,7 @@ namespace SoF
|
||||
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
|
||||
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "SoF::DECODE(OP_MoveItem)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "SoF::DECODE(OP_MoveItem)");
|
||||
|
||||
emu->from_slot = SoFToServerSlot(eq->from_slot);
|
||||
emu->to_slot = SoFToServerSlot(eq->to_slot);
|
||||
|
||||
@@ -380,7 +380,7 @@ namespace Titanium
|
||||
|
||||
ENCODE(OP_DeleteCharge)
|
||||
{
|
||||
Log(Logs::Detail, Logs::Netcode, "Titanium::ENCODE(OP_DeleteCharge)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "Titanium::ENCODE(OP_DeleteCharge)");
|
||||
|
||||
ENCODE_FORWARD(OP_MoveItem);
|
||||
}
|
||||
@@ -890,7 +890,7 @@ namespace Titanium
|
||||
ENCODE_LENGTH_EXACT(LootingItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Titanium::ENCODE(OP_LootItem)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "Titanium::ENCODE(OP_LootItem)");
|
||||
|
||||
OUT(lootee);
|
||||
OUT(looter);
|
||||
@@ -934,7 +934,7 @@ namespace Titanium
|
||||
ENCODE_LENGTH_EXACT(MoveItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Titanium::ENCODE(OP_MoveItem)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "Titanium::ENCODE(OP_MoveItem)");
|
||||
|
||||
eq->from_slot = ServerToTitaniumSlot(emu->from_slot);
|
||||
eq->to_slot = ServerToTitaniumSlot(emu->to_slot);
|
||||
@@ -2178,7 +2178,7 @@ namespace Titanium
|
||||
DECODE_LENGTH_EXACT(structs::LootingItem_Struct);
|
||||
SETUP_DIRECT_DECODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Titanium::DECODE(OP_LootItem)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "Titanium::DECODE(OP_LootItem)");
|
||||
|
||||
IN(lootee);
|
||||
IN(looter);
|
||||
@@ -2193,7 +2193,7 @@ namespace Titanium
|
||||
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
|
||||
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "Titanium::DECODE(OP_MoveItem)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "Titanium::DECODE(OP_MoveItem)");
|
||||
|
||||
emu->from_slot = TitaniumToServerSlot(eq->from_slot);
|
||||
emu->to_slot = TitaniumToServerSlot(eq->to_slot);
|
||||
|
||||
@@ -579,7 +579,7 @@ namespace UF
|
||||
|
||||
ENCODE(OP_DeleteCharge)
|
||||
{
|
||||
Log(Logs::Detail, Logs::Netcode, "UF::ENCODE(OP_DeleteCharge)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "UF::ENCODE(OP_DeleteCharge)");
|
||||
|
||||
ENCODE_FORWARD(OP_MoveItem);
|
||||
}
|
||||
@@ -1349,7 +1349,7 @@ namespace UF
|
||||
ENCODE_LENGTH_EXACT(LootingItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "UF::ENCODE(OP_LootItem)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "UF::ENCODE(OP_LootItem)");
|
||||
|
||||
OUT(lootee);
|
||||
OUT(looter);
|
||||
@@ -1502,7 +1502,7 @@ namespace UF
|
||||
ENCODE_LENGTH_EXACT(MoveItem_Struct);
|
||||
SETUP_DIRECT_ENCODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "UF::ENCODE(OP_MoveItem)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "UF::ENCODE(OP_MoveItem)");
|
||||
|
||||
eq->from_slot = ServerToUFSlot(emu->from_slot);
|
||||
eq->to_slot = ServerToUFSlot(emu->to_slot);
|
||||
@@ -2739,7 +2739,7 @@ namespace UF
|
||||
}
|
||||
|
||||
float SpawnSize = emu->size;
|
||||
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
if (!((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522))
|
||||
)
|
||||
{
|
||||
@@ -2942,7 +2942,7 @@ namespace UF
|
||||
|
||||
Buffer += sizeof(structs::Spawn_Struct_Position);
|
||||
|
||||
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)
|
||||
)
|
||||
{
|
||||
@@ -2978,7 +2978,7 @@ namespace UF
|
||||
VARSTRUCT_ENCODE_TYPE(uint32, Buffer, 0);
|
||||
}
|
||||
|
||||
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
if ((emu->NPC == 0) || (emu->race <= RACE_GNOME_12) || (emu->race == RACE_IKSAR_128) ||
|
||||
(emu->race == RACE_VAH_SHIR_130) || (emu->race == RACE_FROGLOK_330) || (emu->race == RACE_DRAKKIN_522)
|
||||
)
|
||||
{
|
||||
@@ -3584,7 +3584,7 @@ namespace UF
|
||||
DECODE_LENGTH_EXACT(structs::LootingItem_Struct);
|
||||
SETUP_DIRECT_DECODE(LootingItem_Struct, structs::LootingItem_Struct);
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "UF::DECODE(OP_LootItem)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "UF::DECODE(OP_LootItem)");
|
||||
|
||||
IN(lootee);
|
||||
IN(looter);
|
||||
@@ -3599,7 +3599,7 @@ namespace UF
|
||||
DECODE_LENGTH_EXACT(structs::MoveItem_Struct);
|
||||
SETUP_DIRECT_DECODE(MoveItem_Struct, structs::MoveItem_Struct);
|
||||
|
||||
Log(Logs::Detail, Logs::Netcode, "UF::DECODE(OP_MoveItem)");
|
||||
Log(Logs::Moderate, Logs::Netcode, "UF::DECODE(OP_MoveItem)");
|
||||
|
||||
emu->from_slot = UFToServerSlot(eq->from_slot);
|
||||
emu->to_slot = UFToServerSlot(eq->to_slot);
|
||||
|
||||
+11
-18
@@ -20,19 +20,12 @@ void PathManager::LoadPaths()
|
||||
{
|
||||
m_server_path = File::FindEqemuConfigPath();
|
||||
|
||||
if (!m_server_path.empty()) {
|
||||
std::filesystem::current_path(m_server_path);
|
||||
}
|
||||
std::filesystem::current_path(m_server_path);
|
||||
|
||||
if (m_server_path.empty()) {
|
||||
LogInfo("Failed to load server path");
|
||||
return;
|
||||
}
|
||||
|
||||
LogInfo("server [{}]", m_server_path);
|
||||
LogInfo("[PathManager] server [{}]", m_server_path);
|
||||
|
||||
if (!EQEmuConfig::LoadConfig()) {
|
||||
LogError("Failed to load eqemu config");
|
||||
LogError("[PathManager] Failed to load eqemu config");
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -84,14 +77,14 @@ void PathManager::LoadPaths()
|
||||
m_log_path = fs::relative(fs::path{m_server_path + "/" + c->LogDir}).string();
|
||||
}
|
||||
|
||||
LogInfo("logs path [{}]", m_log_path);
|
||||
LogInfo("lua mods path [{}]", m_lua_mods_path);
|
||||
LogInfo("lua_modules path [{}]", m_lua_modules_path);
|
||||
LogInfo("maps path [{}]", m_maps_path);
|
||||
LogInfo("patches path [{}]", m_patch_path);
|
||||
LogInfo("plugins path [{}]", m_plugins_path);
|
||||
LogInfo("quests path [{}]", m_quests_path);
|
||||
LogInfo("shared_memory path [{}]", m_shared_memory_path);
|
||||
LogInfo("[PathManager] logs [{}]", m_log_path);
|
||||
LogInfo("[PathManager] lua mods [{}]", m_lua_mods_path);
|
||||
LogInfo("[PathManager] lua_modules [{}]", m_lua_modules_path);
|
||||
LogInfo("[PathManager] maps [{}]", m_maps_path);
|
||||
LogInfo("[PathManager] patches [{}]", m_patch_path);
|
||||
LogInfo("[PathManager] plugins [{}]", m_plugins_path);
|
||||
LogInfo("[PathManager] quests [{}]", m_quests_path);
|
||||
LogInfo("[PathManager] shared_memory [{}]", m_shared_memory_path);
|
||||
}
|
||||
|
||||
const std::string &PathManager::GetServerPath() const
|
||||
|
||||
+5
-3
@@ -55,12 +55,14 @@ std::string GetPlatformName()
|
||||
return "UCS";
|
||||
case EQEmuExePlatform::ExePlatformLogin:
|
||||
return "Login";
|
||||
case EQEmuExePlatform::ExePlatformSocket_Server:
|
||||
return "SocketServer";
|
||||
case EQEmuExePlatform::ExePlatformSharedMemory:
|
||||
return "SharedMem";
|
||||
return "SharedMemory";
|
||||
case EQEmuExePlatform::ExePlatformClientImport:
|
||||
return "Import";
|
||||
return "ClientImport";
|
||||
case EQEmuExePlatform::ExePlatformClientExport:
|
||||
return "Export";
|
||||
return "ClientExport";
|
||||
case EQEmuExePlatform::ExePlatformLaunch:
|
||||
return "Launch";
|
||||
case EQEmuExePlatform::ExePlatformHC:
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
*/
|
||||
|
||||
#include "profanity_manager.h"
|
||||
#include "eqemu_logsys.h"
|
||||
#include "dbcore.h"
|
||||
#include "strings.h"
|
||||
|
||||
@@ -236,8 +235,6 @@ bool EQ::ProfanityManager::load_database_entries(DBcore *db) {
|
||||
}
|
||||
}
|
||||
|
||||
LogInfo("Loaded [{}] profanity entries", Strings::Commify(profanity_list.size()));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,334 +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://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHATCHANNEL_RESERVED_NAMES_REPOSITORY_H
|
||||
#define EQEMU_BASE_CHATCHANNEL_RESERVED_NAMES_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
|
||||
class BaseChatchannelReservedNamesRepository {
|
||||
public:
|
||||
struct ChatchannelReservedNames {
|
||||
int32_t id;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"name",
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"name",
|
||||
};
|
||||
}
|
||||
|
||||
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("chatchannel_reserved_names");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
SelectColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static ChatchannelReservedNames NewEntity()
|
||||
{
|
||||
ChatchannelReservedNames e{};
|
||||
|
||||
e.id = 0;
|
||||
e.name = "";
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static ChatchannelReservedNames GetChatchannelReservedNames(
|
||||
const std::vector<ChatchannelReservedNames> &chatchannel_reserved_namess,
|
||||
int chatchannel_reserved_names_id
|
||||
)
|
||||
{
|
||||
for (auto &chatchannel_reserved_names : chatchannel_reserved_namess) {
|
||||
if (chatchannel_reserved_names.id == chatchannel_reserved_names_id) {
|
||||
return chatchannel_reserved_names;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static ChatchannelReservedNames FindOne(
|
||||
Database& db,
|
||||
int chatchannel_reserved_names_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
chatchannel_reserved_names_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
ChatchannelReservedNames e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.name = row[1] ? row[1] : "";
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int chatchannel_reserved_names_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
chatchannel_reserved_names_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
const ChatchannelReservedNames &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[1] + " = '" + Strings::Escape(e.name) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
Strings::Implode(", ", v),
|
||||
PrimaryKey(),
|
||||
e.id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static ChatchannelReservedNames InsertOne(
|
||||
Database& db,
|
||||
ChatchannelReservedNames e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
|
||||
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<ChatchannelReservedNames> &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("'" + Strings::Escape(e.name) + "'");
|
||||
|
||||
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<ChatchannelReservedNames> All(Database& db)
|
||||
{
|
||||
std::vector<ChatchannelReservedNames> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
ChatchannelReservedNames e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.name = row[1] ? row[1] : "";
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<ChatchannelReservedNames> GetWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
std::vector<ChatchannelReservedNames> 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) {
|
||||
ChatchannelReservedNames e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.name = row[1] ? row[1] : "";
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHATCHANNEL_RESERVED_NAMES_REPOSITORY_H
|
||||
@@ -1,364 +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://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_CHATCHANNELS_REPOSITORY_H
|
||||
#define EQEMU_BASE_CHATCHANNELS_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
|
||||
class BaseChatchannelsRepository {
|
||||
public:
|
||||
struct Chatchannels {
|
||||
int32_t id;
|
||||
std::string name;
|
||||
std::string owner;
|
||||
std::string password;
|
||||
int32_t minstatus;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"name",
|
||||
"owner",
|
||||
"password",
|
||||
"minstatus",
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"name",
|
||||
"owner",
|
||||
"password",
|
||||
"minstatus",
|
||||
};
|
||||
}
|
||||
|
||||
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("chatchannels");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
SelectColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static Chatchannels NewEntity()
|
||||
{
|
||||
Chatchannels e{};
|
||||
|
||||
e.id = 0;
|
||||
e.name = "";
|
||||
e.owner = "";
|
||||
e.password = "";
|
||||
e.minstatus = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static Chatchannels GetChatchannels(
|
||||
const std::vector<Chatchannels> &chatchannelss,
|
||||
int chatchannels_id
|
||||
)
|
||||
{
|
||||
for (auto &chatchannels : chatchannelss) {
|
||||
if (chatchannels.id == chatchannels_id) {
|
||||
return chatchannels;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static Chatchannels FindOne(
|
||||
Database& db,
|
||||
int chatchannels_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
chatchannels_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
Chatchannels e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.name = row[1] ? row[1] : "";
|
||||
e.owner = row[2] ? row[2] : "";
|
||||
e.password = row[3] ? row[3] : "";
|
||||
e.minstatus = static_cast<int32_t>(atoi(row[4]));
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int chatchannels_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
chatchannels_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
const Chatchannels &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[1] + " = '" + Strings::Escape(e.name) + "'");
|
||||
v.push_back(columns[2] + " = '" + Strings::Escape(e.owner) + "'");
|
||||
v.push_back(columns[3] + " = '" + Strings::Escape(e.password) + "'");
|
||||
v.push_back(columns[4] + " = " + std::to_string(e.minstatus));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
Strings::Implode(", ", v),
|
||||
PrimaryKey(),
|
||||
e.id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static Chatchannels InsertOne(
|
||||
Database& db,
|
||||
Chatchannels e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.owner) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.password) + "'");
|
||||
v.push_back(std::to_string(e.minstatus));
|
||||
|
||||
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<Chatchannels> &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("'" + Strings::Escape(e.name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.owner) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.password) + "'");
|
||||
v.push_back(std::to_string(e.minstatus));
|
||||
|
||||
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<Chatchannels> All(Database& db)
|
||||
{
|
||||
std::vector<Chatchannels> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
Chatchannels e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.name = row[1] ? row[1] : "";
|
||||
e.owner = row[2] ? row[2] : "";
|
||||
e.password = row[3] ? row[3] : "";
|
||||
e.minstatus = static_cast<int32_t>(atoi(row[4]));
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<Chatchannels> GetWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
std::vector<Chatchannels> 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) {
|
||||
Chatchannels e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.name = row[1] ? row[1] : "";
|
||||
e.owner = row[2] ? row[2] : "";
|
||||
e.password = row[3] ? row[3] : "";
|
||||
e.minstatus = static_cast<int32_t>(atoi(row[4]));
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_CHATCHANNELS_REPOSITORY_H
|
||||
@@ -1,414 +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://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_MERC_ARMORINFO_REPOSITORY_H
|
||||
#define EQEMU_BASE_MERC_ARMORINFO_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
|
||||
class BaseMercArmorinfoRepository {
|
||||
public:
|
||||
struct MercArmorinfo {
|
||||
int32_t id;
|
||||
uint32_t merc_npc_type_id;
|
||||
uint8_t minlevel;
|
||||
uint8_t maxlevel;
|
||||
uint8_t texture;
|
||||
uint8_t helmtexture;
|
||||
uint32_t armortint_id;
|
||||
uint8_t armortint_red;
|
||||
uint8_t armortint_green;
|
||||
uint8_t armortint_blue;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"merc_npc_type_id",
|
||||
"minlevel",
|
||||
"maxlevel",
|
||||
"texture",
|
||||
"helmtexture",
|
||||
"armortint_id",
|
||||
"armortint_red",
|
||||
"armortint_green",
|
||||
"armortint_blue",
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"merc_npc_type_id",
|
||||
"minlevel",
|
||||
"maxlevel",
|
||||
"texture",
|
||||
"helmtexture",
|
||||
"armortint_id",
|
||||
"armortint_red",
|
||||
"armortint_green",
|
||||
"armortint_blue",
|
||||
};
|
||||
}
|
||||
|
||||
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("merc_armorinfo");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
SelectColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static MercArmorinfo NewEntity()
|
||||
{
|
||||
MercArmorinfo e{};
|
||||
|
||||
e.id = 0;
|
||||
e.merc_npc_type_id = 0;
|
||||
e.minlevel = 1;
|
||||
e.maxlevel = 255;
|
||||
e.texture = 0;
|
||||
e.helmtexture = 0;
|
||||
e.armortint_id = 0;
|
||||
e.armortint_red = 0;
|
||||
e.armortint_green = 0;
|
||||
e.armortint_blue = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static MercArmorinfo GetMercArmorinfo(
|
||||
const std::vector<MercArmorinfo> &merc_armorinfos,
|
||||
int merc_armorinfo_id
|
||||
)
|
||||
{
|
||||
for (auto &merc_armorinfo : merc_armorinfos) {
|
||||
if (merc_armorinfo.id == merc_armorinfo_id) {
|
||||
return merc_armorinfo;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static MercArmorinfo FindOne(
|
||||
Database& db,
|
||||
int merc_armorinfo_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
merc_armorinfo_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
MercArmorinfo e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.merc_npc_type_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.minlevel = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.maxlevel = static_cast<uint8_t>(strtoul(row[3], nullptr, 10));
|
||||
e.texture = static_cast<uint8_t>(strtoul(row[4], nullptr, 10));
|
||||
e.helmtexture = static_cast<uint8_t>(strtoul(row[5], nullptr, 10));
|
||||
e.armortint_id = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.armortint_red = static_cast<uint8_t>(strtoul(row[7], nullptr, 10));
|
||||
e.armortint_green = static_cast<uint8_t>(strtoul(row[8], nullptr, 10));
|
||||
e.armortint_blue = static_cast<uint8_t>(strtoul(row[9], nullptr, 10));
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int merc_armorinfo_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
merc_armorinfo_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
const MercArmorinfo &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.merc_npc_type_id));
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.minlevel));
|
||||
v.push_back(columns[3] + " = " + std::to_string(e.maxlevel));
|
||||
v.push_back(columns[4] + " = " + std::to_string(e.texture));
|
||||
v.push_back(columns[5] + " = " + std::to_string(e.helmtexture));
|
||||
v.push_back(columns[6] + " = " + std::to_string(e.armortint_id));
|
||||
v.push_back(columns[7] + " = " + std::to_string(e.armortint_red));
|
||||
v.push_back(columns[8] + " = " + std::to_string(e.armortint_green));
|
||||
v.push_back(columns[9] + " = " + std::to_string(e.armortint_blue));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
Strings::Implode(", ", v),
|
||||
PrimaryKey(),
|
||||
e.id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static MercArmorinfo InsertOne(
|
||||
Database& db,
|
||||
MercArmorinfo e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.merc_npc_type_id));
|
||||
v.push_back(std::to_string(e.minlevel));
|
||||
v.push_back(std::to_string(e.maxlevel));
|
||||
v.push_back(std::to_string(e.texture));
|
||||
v.push_back(std::to_string(e.helmtexture));
|
||||
v.push_back(std::to_string(e.armortint_id));
|
||||
v.push_back(std::to_string(e.armortint_red));
|
||||
v.push_back(std::to_string(e.armortint_green));
|
||||
v.push_back(std::to_string(e.armortint_blue));
|
||||
|
||||
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<MercArmorinfo> &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.merc_npc_type_id));
|
||||
v.push_back(std::to_string(e.minlevel));
|
||||
v.push_back(std::to_string(e.maxlevel));
|
||||
v.push_back(std::to_string(e.texture));
|
||||
v.push_back(std::to_string(e.helmtexture));
|
||||
v.push_back(std::to_string(e.armortint_id));
|
||||
v.push_back(std::to_string(e.armortint_red));
|
||||
v.push_back(std::to_string(e.armortint_green));
|
||||
v.push_back(std::to_string(e.armortint_blue));
|
||||
|
||||
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<MercArmorinfo> All(Database& db)
|
||||
{
|
||||
std::vector<MercArmorinfo> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
MercArmorinfo e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.merc_npc_type_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.minlevel = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.maxlevel = static_cast<uint8_t>(strtoul(row[3], nullptr, 10));
|
||||
e.texture = static_cast<uint8_t>(strtoul(row[4], nullptr, 10));
|
||||
e.helmtexture = static_cast<uint8_t>(strtoul(row[5], nullptr, 10));
|
||||
e.armortint_id = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.armortint_red = static_cast<uint8_t>(strtoul(row[7], nullptr, 10));
|
||||
e.armortint_green = static_cast<uint8_t>(strtoul(row[8], nullptr, 10));
|
||||
e.armortint_blue = static_cast<uint8_t>(strtoul(row[9], nullptr, 10));
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<MercArmorinfo> GetWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
std::vector<MercArmorinfo> 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) {
|
||||
MercArmorinfo e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.merc_npc_type_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.minlevel = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.maxlevel = static_cast<uint8_t>(strtoul(row[3], nullptr, 10));
|
||||
e.texture = static_cast<uint8_t>(strtoul(row[4], nullptr, 10));
|
||||
e.helmtexture = static_cast<uint8_t>(strtoul(row[5], nullptr, 10));
|
||||
e.armortint_id = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.armortint_red = static_cast<uint8_t>(strtoul(row[7], nullptr, 10));
|
||||
e.armortint_green = static_cast<uint8_t>(strtoul(row[8], nullptr, 10));
|
||||
e.armortint_blue = static_cast<uint8_t>(strtoul(row[9], 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);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_MERC_ARMORINFO_REPOSITORY_H
|
||||
@@ -1,504 +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://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_MERC_BUFFS_REPOSITORY_H
|
||||
#define EQEMU_BASE_MERC_BUFFS_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
|
||||
class BaseMercBuffsRepository {
|
||||
public:
|
||||
struct MercBuffs {
|
||||
uint32_t MercBuffId;
|
||||
uint32_t MercId;
|
||||
uint32_t SpellId;
|
||||
uint32_t CasterLevel;
|
||||
uint32_t DurationFormula;
|
||||
int32_t TicsRemaining;
|
||||
uint32_t PoisonCounters;
|
||||
uint32_t DiseaseCounters;
|
||||
uint32_t CurseCounters;
|
||||
uint32_t CorruptionCounters;
|
||||
uint32_t HitCount;
|
||||
uint32_t MeleeRune;
|
||||
uint32_t MagicRune;
|
||||
int32_t dot_rune;
|
||||
int32_t caston_x;
|
||||
int8_t Persistent;
|
||||
int32_t caston_y;
|
||||
int32_t caston_z;
|
||||
int32_t ExtraDIChance;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("MercBuffId");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"MercBuffId",
|
||||
"MercId",
|
||||
"SpellId",
|
||||
"CasterLevel",
|
||||
"DurationFormula",
|
||||
"TicsRemaining",
|
||||
"PoisonCounters",
|
||||
"DiseaseCounters",
|
||||
"CurseCounters",
|
||||
"CorruptionCounters",
|
||||
"HitCount",
|
||||
"MeleeRune",
|
||||
"MagicRune",
|
||||
"dot_rune",
|
||||
"caston_x",
|
||||
"Persistent",
|
||||
"caston_y",
|
||||
"caston_z",
|
||||
"ExtraDIChance",
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"MercBuffId",
|
||||
"MercId",
|
||||
"SpellId",
|
||||
"CasterLevel",
|
||||
"DurationFormula",
|
||||
"TicsRemaining",
|
||||
"PoisonCounters",
|
||||
"DiseaseCounters",
|
||||
"CurseCounters",
|
||||
"CorruptionCounters",
|
||||
"HitCount",
|
||||
"MeleeRune",
|
||||
"MagicRune",
|
||||
"dot_rune",
|
||||
"caston_x",
|
||||
"Persistent",
|
||||
"caston_y",
|
||||
"caston_z",
|
||||
"ExtraDIChance",
|
||||
};
|
||||
}
|
||||
|
||||
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("merc_buffs");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
SelectColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static MercBuffs NewEntity()
|
||||
{
|
||||
MercBuffs e{};
|
||||
|
||||
e.MercBuffId = 0;
|
||||
e.MercId = 0;
|
||||
e.SpellId = 0;
|
||||
e.CasterLevel = 0;
|
||||
e.DurationFormula = 0;
|
||||
e.TicsRemaining = 0;
|
||||
e.PoisonCounters = 0;
|
||||
e.DiseaseCounters = 0;
|
||||
e.CurseCounters = 0;
|
||||
e.CorruptionCounters = 0;
|
||||
e.HitCount = 0;
|
||||
e.MeleeRune = 0;
|
||||
e.MagicRune = 0;
|
||||
e.dot_rune = 0;
|
||||
e.caston_x = 0;
|
||||
e.Persistent = 0;
|
||||
e.caston_y = 0;
|
||||
e.caston_z = 0;
|
||||
e.ExtraDIChance = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static MercBuffs GetMercBuffs(
|
||||
const std::vector<MercBuffs> &merc_buffss,
|
||||
int merc_buffs_id
|
||||
)
|
||||
{
|
||||
for (auto &merc_buffs : merc_buffss) {
|
||||
if (merc_buffs.MercBuffId == merc_buffs_id) {
|
||||
return merc_buffs;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static MercBuffs FindOne(
|
||||
Database& db,
|
||||
int merc_buffs_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
merc_buffs_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
MercBuffs e{};
|
||||
|
||||
e.MercBuffId = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.MercId = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.SpellId = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.CasterLevel = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.DurationFormula = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.TicsRemaining = static_cast<int32_t>(atoi(row[5]));
|
||||
e.PoisonCounters = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.DiseaseCounters = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.CurseCounters = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.CorruptionCounters = static_cast<uint32_t>(strtoul(row[9], nullptr, 10));
|
||||
e.HitCount = static_cast<uint32_t>(strtoul(row[10], nullptr, 10));
|
||||
e.MeleeRune = static_cast<uint32_t>(strtoul(row[11], nullptr, 10));
|
||||
e.MagicRune = static_cast<uint32_t>(strtoul(row[12], nullptr, 10));
|
||||
e.dot_rune = static_cast<int32_t>(atoi(row[13]));
|
||||
e.caston_x = static_cast<int32_t>(atoi(row[14]));
|
||||
e.Persistent = static_cast<int8_t>(atoi(row[15]));
|
||||
e.caston_y = static_cast<int32_t>(atoi(row[16]));
|
||||
e.caston_z = static_cast<int32_t>(atoi(row[17]));
|
||||
e.ExtraDIChance = static_cast<int32_t>(atoi(row[18]));
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int merc_buffs_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
merc_buffs_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
const MercBuffs &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.MercId));
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.SpellId));
|
||||
v.push_back(columns[3] + " = " + std::to_string(e.CasterLevel));
|
||||
v.push_back(columns[4] + " = " + std::to_string(e.DurationFormula));
|
||||
v.push_back(columns[5] + " = " + std::to_string(e.TicsRemaining));
|
||||
v.push_back(columns[6] + " = " + std::to_string(e.PoisonCounters));
|
||||
v.push_back(columns[7] + " = " + std::to_string(e.DiseaseCounters));
|
||||
v.push_back(columns[8] + " = " + std::to_string(e.CurseCounters));
|
||||
v.push_back(columns[9] + " = " + std::to_string(e.CorruptionCounters));
|
||||
v.push_back(columns[10] + " = " + std::to_string(e.HitCount));
|
||||
v.push_back(columns[11] + " = " + std::to_string(e.MeleeRune));
|
||||
v.push_back(columns[12] + " = " + std::to_string(e.MagicRune));
|
||||
v.push_back(columns[13] + " = " + std::to_string(e.dot_rune));
|
||||
v.push_back(columns[14] + " = " + std::to_string(e.caston_x));
|
||||
v.push_back(columns[15] + " = " + std::to_string(e.Persistent));
|
||||
v.push_back(columns[16] + " = " + std::to_string(e.caston_y));
|
||||
v.push_back(columns[17] + " = " + std::to_string(e.caston_z));
|
||||
v.push_back(columns[18] + " = " + std::to_string(e.ExtraDIChance));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
Strings::Implode(", ", v),
|
||||
PrimaryKey(),
|
||||
e.MercBuffId
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static MercBuffs InsertOne(
|
||||
Database& db,
|
||||
MercBuffs e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.MercBuffId));
|
||||
v.push_back(std::to_string(e.MercId));
|
||||
v.push_back(std::to_string(e.SpellId));
|
||||
v.push_back(std::to_string(e.CasterLevel));
|
||||
v.push_back(std::to_string(e.DurationFormula));
|
||||
v.push_back(std::to_string(e.TicsRemaining));
|
||||
v.push_back(std::to_string(e.PoisonCounters));
|
||||
v.push_back(std::to_string(e.DiseaseCounters));
|
||||
v.push_back(std::to_string(e.CurseCounters));
|
||||
v.push_back(std::to_string(e.CorruptionCounters));
|
||||
v.push_back(std::to_string(e.HitCount));
|
||||
v.push_back(std::to_string(e.MeleeRune));
|
||||
v.push_back(std::to_string(e.MagicRune));
|
||||
v.push_back(std::to_string(e.dot_rune));
|
||||
v.push_back(std::to_string(e.caston_x));
|
||||
v.push_back(std::to_string(e.Persistent));
|
||||
v.push_back(std::to_string(e.caston_y));
|
||||
v.push_back(std::to_string(e.caston_z));
|
||||
v.push_back(std::to_string(e.ExtraDIChance));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
e.MercBuffId = results.LastInsertedID();
|
||||
return e;
|
||||
}
|
||||
|
||||
e = NewEntity();
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
const std::vector<MercBuffs> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.MercBuffId));
|
||||
v.push_back(std::to_string(e.MercId));
|
||||
v.push_back(std::to_string(e.SpellId));
|
||||
v.push_back(std::to_string(e.CasterLevel));
|
||||
v.push_back(std::to_string(e.DurationFormula));
|
||||
v.push_back(std::to_string(e.TicsRemaining));
|
||||
v.push_back(std::to_string(e.PoisonCounters));
|
||||
v.push_back(std::to_string(e.DiseaseCounters));
|
||||
v.push_back(std::to_string(e.CurseCounters));
|
||||
v.push_back(std::to_string(e.CorruptionCounters));
|
||||
v.push_back(std::to_string(e.HitCount));
|
||||
v.push_back(std::to_string(e.MeleeRune));
|
||||
v.push_back(std::to_string(e.MagicRune));
|
||||
v.push_back(std::to_string(e.dot_rune));
|
||||
v.push_back(std::to_string(e.caston_x));
|
||||
v.push_back(std::to_string(e.Persistent));
|
||||
v.push_back(std::to_string(e.caston_y));
|
||||
v.push_back(std::to_string(e.caston_z));
|
||||
v.push_back(std::to_string(e.ExtraDIChance));
|
||||
|
||||
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<MercBuffs> All(Database& db)
|
||||
{
|
||||
std::vector<MercBuffs> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
MercBuffs e{};
|
||||
|
||||
e.MercBuffId = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.MercId = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.SpellId = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.CasterLevel = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.DurationFormula = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.TicsRemaining = static_cast<int32_t>(atoi(row[5]));
|
||||
e.PoisonCounters = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.DiseaseCounters = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.CurseCounters = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.CorruptionCounters = static_cast<uint32_t>(strtoul(row[9], nullptr, 10));
|
||||
e.HitCount = static_cast<uint32_t>(strtoul(row[10], nullptr, 10));
|
||||
e.MeleeRune = static_cast<uint32_t>(strtoul(row[11], nullptr, 10));
|
||||
e.MagicRune = static_cast<uint32_t>(strtoul(row[12], nullptr, 10));
|
||||
e.dot_rune = static_cast<int32_t>(atoi(row[13]));
|
||||
e.caston_x = static_cast<int32_t>(atoi(row[14]));
|
||||
e.Persistent = static_cast<int8_t>(atoi(row[15]));
|
||||
e.caston_y = static_cast<int32_t>(atoi(row[16]));
|
||||
e.caston_z = static_cast<int32_t>(atoi(row[17]));
|
||||
e.ExtraDIChance = static_cast<int32_t>(atoi(row[18]));
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<MercBuffs> GetWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
std::vector<MercBuffs> 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) {
|
||||
MercBuffs e{};
|
||||
|
||||
e.MercBuffId = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.MercId = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.SpellId = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.CasterLevel = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.DurationFormula = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.TicsRemaining = static_cast<int32_t>(atoi(row[5]));
|
||||
e.PoisonCounters = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
e.DiseaseCounters = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.CurseCounters = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.CorruptionCounters = static_cast<uint32_t>(strtoul(row[9], nullptr, 10));
|
||||
e.HitCount = static_cast<uint32_t>(strtoul(row[10], nullptr, 10));
|
||||
e.MeleeRune = static_cast<uint32_t>(strtoul(row[11], nullptr, 10));
|
||||
e.MagicRune = static_cast<uint32_t>(strtoul(row[12], nullptr, 10));
|
||||
e.dot_rune = static_cast<int32_t>(atoi(row[13]));
|
||||
e.caston_x = static_cast<int32_t>(atoi(row[14]));
|
||||
e.Persistent = static_cast<int8_t>(atoi(row[15]));
|
||||
e.caston_y = static_cast<int32_t>(atoi(row[16]));
|
||||
e.caston_z = static_cast<int32_t>(atoi(row[17]));
|
||||
e.ExtraDIChance = static_cast<int32_t>(atoi(row[18]));
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_MERC_BUFFS_REPOSITORY_H
|
||||
@@ -1,364 +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://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_MERC_INVENTORY_REPOSITORY_H
|
||||
#define EQEMU_BASE_MERC_INVENTORY_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
|
||||
class BaseMercInventoryRepository {
|
||||
public:
|
||||
struct MercInventory {
|
||||
uint32_t merc_inventory_id;
|
||||
uint32_t merc_subtype_id;
|
||||
uint32_t item_id;
|
||||
uint32_t min_level;
|
||||
uint32_t max_level;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("merc_inventory_id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"merc_inventory_id",
|
||||
"merc_subtype_id",
|
||||
"item_id",
|
||||
"min_level",
|
||||
"max_level",
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"merc_inventory_id",
|
||||
"merc_subtype_id",
|
||||
"item_id",
|
||||
"min_level",
|
||||
"max_level",
|
||||
};
|
||||
}
|
||||
|
||||
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("merc_inventory");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
SelectColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static MercInventory NewEntity()
|
||||
{
|
||||
MercInventory e{};
|
||||
|
||||
e.merc_inventory_id = 0;
|
||||
e.merc_subtype_id = 0;
|
||||
e.item_id = 0;
|
||||
e.min_level = 0;
|
||||
e.max_level = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static MercInventory GetMercInventory(
|
||||
const std::vector<MercInventory> &merc_inventorys,
|
||||
int merc_inventory_id
|
||||
)
|
||||
{
|
||||
for (auto &merc_inventory : merc_inventorys) {
|
||||
if (merc_inventory.merc_inventory_id == merc_inventory_id) {
|
||||
return merc_inventory;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static MercInventory FindOne(
|
||||
Database& db,
|
||||
int merc_inventory_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
merc_inventory_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
MercInventory e{};
|
||||
|
||||
e.merc_inventory_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.merc_subtype_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.item_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.min_level = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.max_level = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int merc_inventory_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
merc_inventory_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
const MercInventory &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.merc_subtype_id));
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.item_id));
|
||||
v.push_back(columns[3] + " = " + std::to_string(e.min_level));
|
||||
v.push_back(columns[4] + " = " + std::to_string(e.max_level));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
Strings::Implode(", ", v),
|
||||
PrimaryKey(),
|
||||
e.merc_inventory_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static MercInventory InsertOne(
|
||||
Database& db,
|
||||
MercInventory e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.merc_inventory_id));
|
||||
v.push_back(std::to_string(e.merc_subtype_id));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back(std::to_string(e.min_level));
|
||||
v.push_back(std::to_string(e.max_level));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
e.merc_inventory_id = results.LastInsertedID();
|
||||
return e;
|
||||
}
|
||||
|
||||
e = NewEntity();
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
const std::vector<MercInventory> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.merc_inventory_id));
|
||||
v.push_back(std::to_string(e.merc_subtype_id));
|
||||
v.push_back(std::to_string(e.item_id));
|
||||
v.push_back(std::to_string(e.min_level));
|
||||
v.push_back(std::to_string(e.max_level));
|
||||
|
||||
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<MercInventory> All(Database& db)
|
||||
{
|
||||
std::vector<MercInventory> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
MercInventory e{};
|
||||
|
||||
e.merc_inventory_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.merc_subtype_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.item_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.min_level = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.max_level = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<MercInventory> GetWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
std::vector<MercInventory> 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) {
|
||||
MercInventory e{};
|
||||
|
||||
e.merc_inventory_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.merc_subtype_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.item_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.min_level = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.max_level = static_cast<uint32_t>(strtoul(row[4], 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);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_MERC_INVENTORY_REPOSITORY_H
|
||||
@@ -1,344 +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://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_MERC_MERCHANT_ENTRIES_REPOSITORY_H
|
||||
#define EQEMU_BASE_MERC_MERCHANT_ENTRIES_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
|
||||
class BaseMercMerchantEntriesRepository {
|
||||
public:
|
||||
struct MercMerchantEntries {
|
||||
uint32_t merc_merchant_entry_id;
|
||||
uint32_t merc_merchant_template_id;
|
||||
uint32_t merchant_id;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("merc_merchant_entry_id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"merc_merchant_entry_id",
|
||||
"merc_merchant_template_id",
|
||||
"merchant_id",
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"merc_merchant_entry_id",
|
||||
"merc_merchant_template_id",
|
||||
"merchant_id",
|
||||
};
|
||||
}
|
||||
|
||||
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("merc_merchant_entries");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
SelectColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static MercMerchantEntries NewEntity()
|
||||
{
|
||||
MercMerchantEntries e{};
|
||||
|
||||
e.merc_merchant_entry_id = 0;
|
||||
e.merc_merchant_template_id = 0;
|
||||
e.merchant_id = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static MercMerchantEntries GetMercMerchantEntries(
|
||||
const std::vector<MercMerchantEntries> &merc_merchant_entriess,
|
||||
int merc_merchant_entries_id
|
||||
)
|
||||
{
|
||||
for (auto &merc_merchant_entries : merc_merchant_entriess) {
|
||||
if (merc_merchant_entries.merc_merchant_entry_id == merc_merchant_entries_id) {
|
||||
return merc_merchant_entries;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static MercMerchantEntries FindOne(
|
||||
Database& db,
|
||||
int merc_merchant_entries_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
merc_merchant_entries_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
MercMerchantEntries e{};
|
||||
|
||||
e.merc_merchant_entry_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.merc_merchant_template_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.merchant_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int merc_merchant_entries_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
merc_merchant_entries_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
const MercMerchantEntries &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.merc_merchant_template_id));
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.merchant_id));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
Strings::Implode(", ", v),
|
||||
PrimaryKey(),
|
||||
e.merc_merchant_entry_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static MercMerchantEntries InsertOne(
|
||||
Database& db,
|
||||
MercMerchantEntries e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.merc_merchant_entry_id));
|
||||
v.push_back(std::to_string(e.merc_merchant_template_id));
|
||||
v.push_back(std::to_string(e.merchant_id));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
e.merc_merchant_entry_id = results.LastInsertedID();
|
||||
return e;
|
||||
}
|
||||
|
||||
e = NewEntity();
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
const std::vector<MercMerchantEntries> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.merc_merchant_entry_id));
|
||||
v.push_back(std::to_string(e.merc_merchant_template_id));
|
||||
v.push_back(std::to_string(e.merchant_id));
|
||||
|
||||
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<MercMerchantEntries> All(Database& db)
|
||||
{
|
||||
std::vector<MercMerchantEntries> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
MercMerchantEntries e{};
|
||||
|
||||
e.merc_merchant_entry_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.merc_merchant_template_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.merchant_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<MercMerchantEntries> GetWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
std::vector<MercMerchantEntries> 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) {
|
||||
MercMerchantEntries e{};
|
||||
|
||||
e.merc_merchant_entry_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.merc_merchant_template_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.merchant_id = static_cast<uint32_t>(strtoul(row[2], 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);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_MERC_MERCHANT_ENTRIES_REPOSITORY_H
|
||||
@@ -1,344 +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://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_MERC_MERCHANT_TEMPLATE_ENTRIES_REPOSITORY_H
|
||||
#define EQEMU_BASE_MERC_MERCHANT_TEMPLATE_ENTRIES_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
|
||||
class BaseMercMerchantTemplateEntriesRepository {
|
||||
public:
|
||||
struct MercMerchantTemplateEntries {
|
||||
uint32_t merc_merchant_template_entry_id;
|
||||
uint32_t merc_merchant_template_id;
|
||||
uint32_t merc_template_id;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("merc_merchant_template_entry_id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"merc_merchant_template_entry_id",
|
||||
"merc_merchant_template_id",
|
||||
"merc_template_id",
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"merc_merchant_template_entry_id",
|
||||
"merc_merchant_template_id",
|
||||
"merc_template_id",
|
||||
};
|
||||
}
|
||||
|
||||
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("merc_merchant_template_entries");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
SelectColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static MercMerchantTemplateEntries NewEntity()
|
||||
{
|
||||
MercMerchantTemplateEntries e{};
|
||||
|
||||
e.merc_merchant_template_entry_id = 0;
|
||||
e.merc_merchant_template_id = 0;
|
||||
e.merc_template_id = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static MercMerchantTemplateEntries GetMercMerchantTemplateEntries(
|
||||
const std::vector<MercMerchantTemplateEntries> &merc_merchant_template_entriess,
|
||||
int merc_merchant_template_entries_id
|
||||
)
|
||||
{
|
||||
for (auto &merc_merchant_template_entries : merc_merchant_template_entriess) {
|
||||
if (merc_merchant_template_entries.merc_merchant_template_entry_id == merc_merchant_template_entries_id) {
|
||||
return merc_merchant_template_entries;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static MercMerchantTemplateEntries FindOne(
|
||||
Database& db,
|
||||
int merc_merchant_template_entries_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
merc_merchant_template_entries_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
MercMerchantTemplateEntries e{};
|
||||
|
||||
e.merc_merchant_template_entry_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.merc_merchant_template_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.merc_template_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int merc_merchant_template_entries_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
merc_merchant_template_entries_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
const MercMerchantTemplateEntries &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.merc_merchant_template_id));
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.merc_template_id));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
Strings::Implode(", ", v),
|
||||
PrimaryKey(),
|
||||
e.merc_merchant_template_entry_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static MercMerchantTemplateEntries InsertOne(
|
||||
Database& db,
|
||||
MercMerchantTemplateEntries e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.merc_merchant_template_entry_id));
|
||||
v.push_back(std::to_string(e.merc_merchant_template_id));
|
||||
v.push_back(std::to_string(e.merc_template_id));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
e.merc_merchant_template_entry_id = results.LastInsertedID();
|
||||
return e;
|
||||
}
|
||||
|
||||
e = NewEntity();
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
const std::vector<MercMerchantTemplateEntries> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.merc_merchant_template_entry_id));
|
||||
v.push_back(std::to_string(e.merc_merchant_template_id));
|
||||
v.push_back(std::to_string(e.merc_template_id));
|
||||
|
||||
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<MercMerchantTemplateEntries> All(Database& db)
|
||||
{
|
||||
std::vector<MercMerchantTemplateEntries> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
MercMerchantTemplateEntries e{};
|
||||
|
||||
e.merc_merchant_template_entry_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.merc_merchant_template_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.merc_template_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<MercMerchantTemplateEntries> GetWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
std::vector<MercMerchantTemplateEntries> 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) {
|
||||
MercMerchantTemplateEntries e{};
|
||||
|
||||
e.merc_merchant_template_entry_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.merc_merchant_template_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.merc_template_id = static_cast<uint32_t>(strtoul(row[2], 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);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_MERC_MERCHANT_TEMPLATE_ENTRIES_REPOSITORY_H
|
||||
@@ -1,344 +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://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_MERC_MERCHANT_TEMPLATES_REPOSITORY_H
|
||||
#define EQEMU_BASE_MERC_MERCHANT_TEMPLATES_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
|
||||
class BaseMercMerchantTemplatesRepository {
|
||||
public:
|
||||
struct MercMerchantTemplates {
|
||||
uint32_t merc_merchant_template_id;
|
||||
std::string name;
|
||||
std::string qglobal;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("merc_merchant_template_id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"merc_merchant_template_id",
|
||||
"name",
|
||||
"qglobal",
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"merc_merchant_template_id",
|
||||
"name",
|
||||
"qglobal",
|
||||
};
|
||||
}
|
||||
|
||||
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("merc_merchant_templates");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
SelectColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static MercMerchantTemplates NewEntity()
|
||||
{
|
||||
MercMerchantTemplates e{};
|
||||
|
||||
e.merc_merchant_template_id = 0;
|
||||
e.name = "";
|
||||
e.qglobal = "";
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static MercMerchantTemplates GetMercMerchantTemplates(
|
||||
const std::vector<MercMerchantTemplates> &merc_merchant_templatess,
|
||||
int merc_merchant_templates_id
|
||||
)
|
||||
{
|
||||
for (auto &merc_merchant_templates : merc_merchant_templatess) {
|
||||
if (merc_merchant_templates.merc_merchant_template_id == merc_merchant_templates_id) {
|
||||
return merc_merchant_templates;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static MercMerchantTemplates FindOne(
|
||||
Database& db,
|
||||
int merc_merchant_templates_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
merc_merchant_templates_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
MercMerchantTemplates e{};
|
||||
|
||||
e.merc_merchant_template_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.name = row[1] ? row[1] : "";
|
||||
e.qglobal = row[2] ? row[2] : "";
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int merc_merchant_templates_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
merc_merchant_templates_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
const MercMerchantTemplates &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[1] + " = '" + Strings::Escape(e.name) + "'");
|
||||
v.push_back(columns[2] + " = '" + Strings::Escape(e.qglobal) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
Strings::Implode(", ", v),
|
||||
PrimaryKey(),
|
||||
e.merc_merchant_template_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static MercMerchantTemplates InsertOne(
|
||||
Database& db,
|
||||
MercMerchantTemplates e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.merc_merchant_template_id));
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.qglobal) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
e.merc_merchant_template_id = results.LastInsertedID();
|
||||
return e;
|
||||
}
|
||||
|
||||
e = NewEntity();
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
const std::vector<MercMerchantTemplates> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.merc_merchant_template_id));
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.qglobal) + "'");
|
||||
|
||||
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<MercMerchantTemplates> All(Database& db)
|
||||
{
|
||||
std::vector<MercMerchantTemplates> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
MercMerchantTemplates e{};
|
||||
|
||||
e.merc_merchant_template_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.name = row[1] ? row[1] : "";
|
||||
e.qglobal = row[2] ? row[2] : "";
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<MercMerchantTemplates> GetWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
std::vector<MercMerchantTemplates> 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) {
|
||||
MercMerchantTemplates e{};
|
||||
|
||||
e.merc_merchant_template_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.name = row[1] ? row[1] : "";
|
||||
e.qglobal = row[2] ? row[2] : "";
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_MERC_MERCHANT_TEMPLATES_REPOSITORY_H
|
||||
@@ -1,355 +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://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_MERC_NAME_TYPES_REPOSITORY_H
|
||||
#define EQEMU_BASE_MERC_NAME_TYPES_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
|
||||
class BaseMercNameTypesRepository {
|
||||
public:
|
||||
struct MercNameTypes {
|
||||
uint32_t name_type_id;
|
||||
uint32_t class_id;
|
||||
std::string prefix;
|
||||
std::string suffix;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("name_type_id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"name_type_id",
|
||||
"class_id",
|
||||
"prefix",
|
||||
"suffix",
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"name_type_id",
|
||||
"class_id",
|
||||
"prefix",
|
||||
"suffix",
|
||||
};
|
||||
}
|
||||
|
||||
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("merc_name_types");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
SelectColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static MercNameTypes NewEntity()
|
||||
{
|
||||
MercNameTypes e{};
|
||||
|
||||
e.name_type_id = 0;
|
||||
e.class_id = 0;
|
||||
e.prefix = "";
|
||||
e.suffix = "";
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static MercNameTypes GetMercNameTypes(
|
||||
const std::vector<MercNameTypes> &merc_name_typess,
|
||||
int merc_name_types_id
|
||||
)
|
||||
{
|
||||
for (auto &merc_name_types : merc_name_typess) {
|
||||
if (merc_name_types.name_type_id == merc_name_types_id) {
|
||||
return merc_name_types;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static MercNameTypes FindOne(
|
||||
Database& db,
|
||||
int merc_name_types_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
merc_name_types_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
MercNameTypes e{};
|
||||
|
||||
e.name_type_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.class_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.prefix = row[2] ? row[2] : "";
|
||||
e.suffix = row[3] ? row[3] : "";
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int merc_name_types_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
merc_name_types_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
const MercNameTypes &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[0] + " = " + std::to_string(e.name_type_id));
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.class_id));
|
||||
v.push_back(columns[2] + " = '" + Strings::Escape(e.prefix) + "'");
|
||||
v.push_back(columns[3] + " = '" + Strings::Escape(e.suffix) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
Strings::Implode(", ", v),
|
||||
PrimaryKey(),
|
||||
e.name_type_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static MercNameTypes InsertOne(
|
||||
Database& db,
|
||||
MercNameTypes e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.name_type_id));
|
||||
v.push_back(std::to_string(e.class_id));
|
||||
v.push_back("'" + Strings::Escape(e.prefix) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.suffix) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
e.name_type_id = results.LastInsertedID();
|
||||
return e;
|
||||
}
|
||||
|
||||
e = NewEntity();
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
const std::vector<MercNameTypes> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.name_type_id));
|
||||
v.push_back(std::to_string(e.class_id));
|
||||
v.push_back("'" + Strings::Escape(e.prefix) + "'");
|
||||
v.push_back("'" + Strings::Escape(e.suffix) + "'");
|
||||
|
||||
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<MercNameTypes> All(Database& db)
|
||||
{
|
||||
std::vector<MercNameTypes> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
MercNameTypes e{};
|
||||
|
||||
e.name_type_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.class_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.prefix = row[2] ? row[2] : "";
|
||||
e.suffix = row[3] ? row[3] : "";
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<MercNameTypes> GetWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
std::vector<MercNameTypes> 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) {
|
||||
MercNameTypes e{};
|
||||
|
||||
e.name_type_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.class_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.prefix = row[2] ? row[2] : "";
|
||||
e.suffix = row[3] ? row[3] : "";
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_MERC_NAME_TYPES_REPOSITORY_H
|
||||
@@ -1,364 +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://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_MERC_NPC_TYPES_REPOSITORY_H
|
||||
#define EQEMU_BASE_MERC_NPC_TYPES_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
|
||||
class BaseMercNpcTypesRepository {
|
||||
public:
|
||||
struct MercNpcTypes {
|
||||
uint32_t merc_npc_type_id;
|
||||
uint8_t proficiency_id;
|
||||
uint8_t tier_id;
|
||||
uint32_t class_id;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("merc_npc_type_id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"merc_npc_type_id",
|
||||
"proficiency_id",
|
||||
"tier_id",
|
||||
"class_id",
|
||||
"name",
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"merc_npc_type_id",
|
||||
"proficiency_id",
|
||||
"tier_id",
|
||||
"class_id",
|
||||
"name",
|
||||
};
|
||||
}
|
||||
|
||||
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("merc_npc_types");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
SelectColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static MercNpcTypes NewEntity()
|
||||
{
|
||||
MercNpcTypes e{};
|
||||
|
||||
e.merc_npc_type_id = 0;
|
||||
e.proficiency_id = 0;
|
||||
e.tier_id = 0;
|
||||
e.class_id = 0;
|
||||
e.name = "";
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static MercNpcTypes GetMercNpcTypes(
|
||||
const std::vector<MercNpcTypes> &merc_npc_typess,
|
||||
int merc_npc_types_id
|
||||
)
|
||||
{
|
||||
for (auto &merc_npc_types : merc_npc_typess) {
|
||||
if (merc_npc_types.merc_npc_type_id == merc_npc_types_id) {
|
||||
return merc_npc_types;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static MercNpcTypes FindOne(
|
||||
Database& db,
|
||||
int merc_npc_types_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
merc_npc_types_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
MercNpcTypes e{};
|
||||
|
||||
e.merc_npc_type_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.proficiency_id = static_cast<uint8_t>(strtoul(row[1], nullptr, 10));
|
||||
e.tier_id = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.class_id = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.name = row[4] ? row[4] : "";
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int merc_npc_types_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
merc_npc_types_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
const MercNpcTypes &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.proficiency_id));
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.tier_id));
|
||||
v.push_back(columns[3] + " = " + std::to_string(e.class_id));
|
||||
v.push_back(columns[4] + " = '" + Strings::Escape(e.name) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
Strings::Implode(", ", v),
|
||||
PrimaryKey(),
|
||||
e.merc_npc_type_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static MercNpcTypes InsertOne(
|
||||
Database& db,
|
||||
MercNpcTypes e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.merc_npc_type_id));
|
||||
v.push_back(std::to_string(e.proficiency_id));
|
||||
v.push_back(std::to_string(e.tier_id));
|
||||
v.push_back(std::to_string(e.class_id));
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
e.merc_npc_type_id = results.LastInsertedID();
|
||||
return e;
|
||||
}
|
||||
|
||||
e = NewEntity();
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
const std::vector<MercNpcTypes> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.merc_npc_type_id));
|
||||
v.push_back(std::to_string(e.proficiency_id));
|
||||
v.push_back(std::to_string(e.tier_id));
|
||||
v.push_back(std::to_string(e.class_id));
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
|
||||
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<MercNpcTypes> All(Database& db)
|
||||
{
|
||||
std::vector<MercNpcTypes> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
MercNpcTypes e{};
|
||||
|
||||
e.merc_npc_type_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.proficiency_id = static_cast<uint8_t>(strtoul(row[1], nullptr, 10));
|
||||
e.tier_id = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.class_id = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.name = row[4] ? row[4] : "";
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<MercNpcTypes> GetWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
std::vector<MercNpcTypes> 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) {
|
||||
MercNpcTypes e{};
|
||||
|
||||
e.merc_npc_type_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.proficiency_id = static_cast<uint8_t>(strtoul(row[1], nullptr, 10));
|
||||
e.tier_id = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.class_id = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.name = row[4] ? row[4] : "";
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_MERC_NPC_TYPES_REPOSITORY_H
|
||||
@@ -1,404 +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://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_MERC_SPELL_LIST_ENTRIES_REPOSITORY_H
|
||||
#define EQEMU_BASE_MERC_SPELL_LIST_ENTRIES_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
|
||||
class BaseMercSpellListEntriesRepository {
|
||||
public:
|
||||
struct MercSpellListEntries {
|
||||
uint32_t merc_spell_list_entry_id;
|
||||
uint32_t merc_spell_list_id;
|
||||
uint32_t spell_id;
|
||||
uint32_t spell_type;
|
||||
uint8_t stance_id;
|
||||
uint8_t minlevel;
|
||||
uint8_t maxlevel;
|
||||
int8_t slot;
|
||||
uint8_t procChance;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("merc_spell_list_entry_id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"merc_spell_list_entry_id",
|
||||
"merc_spell_list_id",
|
||||
"spell_id",
|
||||
"spell_type",
|
||||
"stance_id",
|
||||
"minlevel",
|
||||
"maxlevel",
|
||||
"slot",
|
||||
"procChance",
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"merc_spell_list_entry_id",
|
||||
"merc_spell_list_id",
|
||||
"spell_id",
|
||||
"spell_type",
|
||||
"stance_id",
|
||||
"minlevel",
|
||||
"maxlevel",
|
||||
"slot",
|
||||
"procChance",
|
||||
};
|
||||
}
|
||||
|
||||
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("merc_spell_list_entries");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
SelectColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static MercSpellListEntries NewEntity()
|
||||
{
|
||||
MercSpellListEntries e{};
|
||||
|
||||
e.merc_spell_list_entry_id = 0;
|
||||
e.merc_spell_list_id = 0;
|
||||
e.spell_id = 0;
|
||||
e.spell_type = 0;
|
||||
e.stance_id = 0;
|
||||
e.minlevel = 1;
|
||||
e.maxlevel = 255;
|
||||
e.slot = -1;
|
||||
e.procChance = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static MercSpellListEntries GetMercSpellListEntries(
|
||||
const std::vector<MercSpellListEntries> &merc_spell_list_entriess,
|
||||
int merc_spell_list_entries_id
|
||||
)
|
||||
{
|
||||
for (auto &merc_spell_list_entries : merc_spell_list_entriess) {
|
||||
if (merc_spell_list_entries.merc_spell_list_entry_id == merc_spell_list_entries_id) {
|
||||
return merc_spell_list_entries;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static MercSpellListEntries FindOne(
|
||||
Database& db,
|
||||
int merc_spell_list_entries_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
merc_spell_list_entries_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
MercSpellListEntries e{};
|
||||
|
||||
e.merc_spell_list_entry_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.merc_spell_list_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.spell_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.spell_type = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.stance_id = static_cast<uint8_t>(strtoul(row[4], nullptr, 10));
|
||||
e.minlevel = static_cast<uint8_t>(strtoul(row[5], nullptr, 10));
|
||||
e.maxlevel = static_cast<uint8_t>(strtoul(row[6], nullptr, 10));
|
||||
e.slot = static_cast<int8_t>(atoi(row[7]));
|
||||
e.procChance = static_cast<uint8_t>(strtoul(row[8], nullptr, 10));
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int merc_spell_list_entries_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
merc_spell_list_entries_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
const MercSpellListEntries &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.merc_spell_list_id));
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.spell_id));
|
||||
v.push_back(columns[3] + " = " + std::to_string(e.spell_type));
|
||||
v.push_back(columns[4] + " = " + std::to_string(e.stance_id));
|
||||
v.push_back(columns[5] + " = " + std::to_string(e.minlevel));
|
||||
v.push_back(columns[6] + " = " + std::to_string(e.maxlevel));
|
||||
v.push_back(columns[7] + " = " + std::to_string(e.slot));
|
||||
v.push_back(columns[8] + " = " + std::to_string(e.procChance));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
Strings::Implode(", ", v),
|
||||
PrimaryKey(),
|
||||
e.merc_spell_list_entry_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static MercSpellListEntries InsertOne(
|
||||
Database& db,
|
||||
MercSpellListEntries e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.merc_spell_list_entry_id));
|
||||
v.push_back(std::to_string(e.merc_spell_list_id));
|
||||
v.push_back(std::to_string(e.spell_id));
|
||||
v.push_back(std::to_string(e.spell_type));
|
||||
v.push_back(std::to_string(e.stance_id));
|
||||
v.push_back(std::to_string(e.minlevel));
|
||||
v.push_back(std::to_string(e.maxlevel));
|
||||
v.push_back(std::to_string(e.slot));
|
||||
v.push_back(std::to_string(e.procChance));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
e.merc_spell_list_entry_id = results.LastInsertedID();
|
||||
return e;
|
||||
}
|
||||
|
||||
e = NewEntity();
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
const std::vector<MercSpellListEntries> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.merc_spell_list_entry_id));
|
||||
v.push_back(std::to_string(e.merc_spell_list_id));
|
||||
v.push_back(std::to_string(e.spell_id));
|
||||
v.push_back(std::to_string(e.spell_type));
|
||||
v.push_back(std::to_string(e.stance_id));
|
||||
v.push_back(std::to_string(e.minlevel));
|
||||
v.push_back(std::to_string(e.maxlevel));
|
||||
v.push_back(std::to_string(e.slot));
|
||||
v.push_back(std::to_string(e.procChance));
|
||||
|
||||
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<MercSpellListEntries> All(Database& db)
|
||||
{
|
||||
std::vector<MercSpellListEntries> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
MercSpellListEntries e{};
|
||||
|
||||
e.merc_spell_list_entry_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.merc_spell_list_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.spell_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.spell_type = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.stance_id = static_cast<uint8_t>(strtoul(row[4], nullptr, 10));
|
||||
e.minlevel = static_cast<uint8_t>(strtoul(row[5], nullptr, 10));
|
||||
e.maxlevel = static_cast<uint8_t>(strtoul(row[6], nullptr, 10));
|
||||
e.slot = static_cast<int8_t>(atoi(row[7]));
|
||||
e.procChance = static_cast<uint8_t>(strtoul(row[8], nullptr, 10));
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<MercSpellListEntries> GetWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
std::vector<MercSpellListEntries> 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) {
|
||||
MercSpellListEntries e{};
|
||||
|
||||
e.merc_spell_list_entry_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.merc_spell_list_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.spell_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.spell_type = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.stance_id = static_cast<uint8_t>(strtoul(row[4], nullptr, 10));
|
||||
e.minlevel = static_cast<uint8_t>(strtoul(row[5], nullptr, 10));
|
||||
e.maxlevel = static_cast<uint8_t>(strtoul(row[6], nullptr, 10));
|
||||
e.slot = static_cast<int8_t>(atoi(row[7]));
|
||||
e.procChance = static_cast<uint8_t>(strtoul(row[8], 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);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_MERC_SPELL_LIST_ENTRIES_REPOSITORY_H
|
||||
@@ -1,354 +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://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_MERC_SPELL_LISTS_REPOSITORY_H
|
||||
#define EQEMU_BASE_MERC_SPELL_LISTS_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
|
||||
class BaseMercSpellListsRepository {
|
||||
public:
|
||||
struct MercSpellLists {
|
||||
uint32_t merc_spell_list_id;
|
||||
uint32_t class_id;
|
||||
uint8_t proficiency_id;
|
||||
std::string name;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("merc_spell_list_id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"merc_spell_list_id",
|
||||
"class_id",
|
||||
"proficiency_id",
|
||||
"name",
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"merc_spell_list_id",
|
||||
"class_id",
|
||||
"proficiency_id",
|
||||
"name",
|
||||
};
|
||||
}
|
||||
|
||||
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("merc_spell_lists");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
SelectColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static MercSpellLists NewEntity()
|
||||
{
|
||||
MercSpellLists e{};
|
||||
|
||||
e.merc_spell_list_id = 0;
|
||||
e.class_id = 0;
|
||||
e.proficiency_id = 0;
|
||||
e.name = "";
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static MercSpellLists GetMercSpellLists(
|
||||
const std::vector<MercSpellLists> &merc_spell_listss,
|
||||
int merc_spell_lists_id
|
||||
)
|
||||
{
|
||||
for (auto &merc_spell_lists : merc_spell_listss) {
|
||||
if (merc_spell_lists.merc_spell_list_id == merc_spell_lists_id) {
|
||||
return merc_spell_lists;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static MercSpellLists FindOne(
|
||||
Database& db,
|
||||
int merc_spell_lists_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
merc_spell_lists_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
MercSpellLists e{};
|
||||
|
||||
e.merc_spell_list_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.class_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.proficiency_id = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.name = row[3] ? row[3] : "";
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int merc_spell_lists_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
merc_spell_lists_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
const MercSpellLists &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.class_id));
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.proficiency_id));
|
||||
v.push_back(columns[3] + " = '" + Strings::Escape(e.name) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
Strings::Implode(", ", v),
|
||||
PrimaryKey(),
|
||||
e.merc_spell_list_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static MercSpellLists InsertOne(
|
||||
Database& db,
|
||||
MercSpellLists e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.merc_spell_list_id));
|
||||
v.push_back(std::to_string(e.class_id));
|
||||
v.push_back(std::to_string(e.proficiency_id));
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
e.merc_spell_list_id = results.LastInsertedID();
|
||||
return e;
|
||||
}
|
||||
|
||||
e = NewEntity();
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
const std::vector<MercSpellLists> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.merc_spell_list_id));
|
||||
v.push_back(std::to_string(e.class_id));
|
||||
v.push_back(std::to_string(e.proficiency_id));
|
||||
v.push_back("'" + Strings::Escape(e.name) + "'");
|
||||
|
||||
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<MercSpellLists> All(Database& db)
|
||||
{
|
||||
std::vector<MercSpellLists> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
MercSpellLists e{};
|
||||
|
||||
e.merc_spell_list_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.class_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.proficiency_id = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.name = row[3] ? row[3] : "";
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<MercSpellLists> GetWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
std::vector<MercSpellLists> 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) {
|
||||
MercSpellLists e{};
|
||||
|
||||
e.merc_spell_list_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.class_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.proficiency_id = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.name = row[3] ? row[3] : "";
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_MERC_SPELL_LISTS_REPOSITORY_H
|
||||
@@ -1,364 +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://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_MERC_STANCE_ENTRIES_REPOSITORY_H
|
||||
#define EQEMU_BASE_MERC_STANCE_ENTRIES_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
|
||||
class BaseMercStanceEntriesRepository {
|
||||
public:
|
||||
struct MercStanceEntries {
|
||||
uint32_t merc_stance_entry_id;
|
||||
uint32_t class_id;
|
||||
uint8_t proficiency_id;
|
||||
uint8_t stance_id;
|
||||
int8_t isdefault;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("merc_stance_entry_id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"merc_stance_entry_id",
|
||||
"class_id",
|
||||
"proficiency_id",
|
||||
"stance_id",
|
||||
"isdefault",
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"merc_stance_entry_id",
|
||||
"class_id",
|
||||
"proficiency_id",
|
||||
"stance_id",
|
||||
"isdefault",
|
||||
};
|
||||
}
|
||||
|
||||
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("merc_stance_entries");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
SelectColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static MercStanceEntries NewEntity()
|
||||
{
|
||||
MercStanceEntries e{};
|
||||
|
||||
e.merc_stance_entry_id = 0;
|
||||
e.class_id = 0;
|
||||
e.proficiency_id = 0;
|
||||
e.stance_id = 0;
|
||||
e.isdefault = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static MercStanceEntries GetMercStanceEntries(
|
||||
const std::vector<MercStanceEntries> &merc_stance_entriess,
|
||||
int merc_stance_entries_id
|
||||
)
|
||||
{
|
||||
for (auto &merc_stance_entries : merc_stance_entriess) {
|
||||
if (merc_stance_entries.merc_stance_entry_id == merc_stance_entries_id) {
|
||||
return merc_stance_entries;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static MercStanceEntries FindOne(
|
||||
Database& db,
|
||||
int merc_stance_entries_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
merc_stance_entries_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
MercStanceEntries e{};
|
||||
|
||||
e.merc_stance_entry_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.class_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.proficiency_id = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.stance_id = static_cast<uint8_t>(strtoul(row[3], nullptr, 10));
|
||||
e.isdefault = static_cast<int8_t>(atoi(row[4]));
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int merc_stance_entries_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
merc_stance_entries_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
const MercStanceEntries &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.class_id));
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.proficiency_id));
|
||||
v.push_back(columns[3] + " = " + std::to_string(e.stance_id));
|
||||
v.push_back(columns[4] + " = " + std::to_string(e.isdefault));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
Strings::Implode(", ", v),
|
||||
PrimaryKey(),
|
||||
e.merc_stance_entry_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static MercStanceEntries InsertOne(
|
||||
Database& db,
|
||||
MercStanceEntries e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.merc_stance_entry_id));
|
||||
v.push_back(std::to_string(e.class_id));
|
||||
v.push_back(std::to_string(e.proficiency_id));
|
||||
v.push_back(std::to_string(e.stance_id));
|
||||
v.push_back(std::to_string(e.isdefault));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
e.merc_stance_entry_id = results.LastInsertedID();
|
||||
return e;
|
||||
}
|
||||
|
||||
e = NewEntity();
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
const std::vector<MercStanceEntries> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.merc_stance_entry_id));
|
||||
v.push_back(std::to_string(e.class_id));
|
||||
v.push_back(std::to_string(e.proficiency_id));
|
||||
v.push_back(std::to_string(e.stance_id));
|
||||
v.push_back(std::to_string(e.isdefault));
|
||||
|
||||
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<MercStanceEntries> All(Database& db)
|
||||
{
|
||||
std::vector<MercStanceEntries> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
MercStanceEntries e{};
|
||||
|
||||
e.merc_stance_entry_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.class_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.proficiency_id = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.stance_id = static_cast<uint8_t>(strtoul(row[3], nullptr, 10));
|
||||
e.isdefault = static_cast<int8_t>(atoi(row[4]));
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<MercStanceEntries> GetWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
std::vector<MercStanceEntries> 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) {
|
||||
MercStanceEntries e{};
|
||||
|
||||
e.merc_stance_entry_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.class_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.proficiency_id = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.stance_id = static_cast<uint8_t>(strtoul(row[3], nullptr, 10));
|
||||
e.isdefault = static_cast<int8_t>(atoi(row[4]));
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_MERC_STANCE_ENTRIES_REPOSITORY_H
|
||||
@@ -1,645 +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://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_MERC_STATS_REPOSITORY_H
|
||||
#define EQEMU_BASE_MERC_STATS_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
|
||||
class BaseMercStatsRepository {
|
||||
public:
|
||||
struct MercStats {
|
||||
uint32_t merc_npc_type_id;
|
||||
uint8_t clientlevel;
|
||||
uint8_t level;
|
||||
int32_t hp;
|
||||
int32_t mana;
|
||||
int16_t AC;
|
||||
int32_t ATK;
|
||||
uint32_t STR;
|
||||
uint32_t STA;
|
||||
uint32_t DEX;
|
||||
uint32_t AGI;
|
||||
uint32_t _INT;
|
||||
uint32_t WIS;
|
||||
uint32_t CHA;
|
||||
int16_t MR;
|
||||
int16_t CR;
|
||||
int16_t DR;
|
||||
int16_t FR;
|
||||
int16_t PR;
|
||||
int16_t Corrup;
|
||||
uint32_t mindmg;
|
||||
uint32_t maxdmg;
|
||||
int16_t attack_count;
|
||||
int8_t attack_speed;
|
||||
uint8_t attack_delay;
|
||||
std::string special_abilities;
|
||||
int32_t Accuracy;
|
||||
uint32_t hp_regen_rate;
|
||||
uint32_t mana_regen_rate;
|
||||
float runspeed;
|
||||
int32_t statscale;
|
||||
float spellscale;
|
||||
float healscale;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("merc_npc_type_id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"merc_npc_type_id",
|
||||
"clientlevel",
|
||||
"level",
|
||||
"hp",
|
||||
"mana",
|
||||
"AC",
|
||||
"ATK",
|
||||
"STR",
|
||||
"STA",
|
||||
"DEX",
|
||||
"AGI",
|
||||
"_INT",
|
||||
"WIS",
|
||||
"CHA",
|
||||
"MR",
|
||||
"CR",
|
||||
"DR",
|
||||
"FR",
|
||||
"PR",
|
||||
"Corrup",
|
||||
"mindmg",
|
||||
"maxdmg",
|
||||
"attack_count",
|
||||
"attack_speed",
|
||||
"attack_delay",
|
||||
"special_abilities",
|
||||
"Accuracy",
|
||||
"hp_regen_rate",
|
||||
"mana_regen_rate",
|
||||
"runspeed",
|
||||
"statscale",
|
||||
"spellscale",
|
||||
"healscale",
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"merc_npc_type_id",
|
||||
"clientlevel",
|
||||
"level",
|
||||
"hp",
|
||||
"mana",
|
||||
"AC",
|
||||
"ATK",
|
||||
"STR",
|
||||
"STA",
|
||||
"DEX",
|
||||
"AGI",
|
||||
"_INT",
|
||||
"WIS",
|
||||
"CHA",
|
||||
"MR",
|
||||
"CR",
|
||||
"DR",
|
||||
"FR",
|
||||
"PR",
|
||||
"Corrup",
|
||||
"mindmg",
|
||||
"maxdmg",
|
||||
"attack_count",
|
||||
"attack_speed",
|
||||
"attack_delay",
|
||||
"special_abilities",
|
||||
"Accuracy",
|
||||
"hp_regen_rate",
|
||||
"mana_regen_rate",
|
||||
"runspeed",
|
||||
"statscale",
|
||||
"spellscale",
|
||||
"healscale",
|
||||
};
|
||||
}
|
||||
|
||||
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("merc_stats");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
SelectColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static MercStats NewEntity()
|
||||
{
|
||||
MercStats e{};
|
||||
|
||||
e.merc_npc_type_id = 0;
|
||||
e.clientlevel = 1;
|
||||
e.level = 1;
|
||||
e.hp = 1;
|
||||
e.mana = 0;
|
||||
e.AC = 1;
|
||||
e.ATK = 1;
|
||||
e.STR = 75;
|
||||
e.STA = 75;
|
||||
e.DEX = 75;
|
||||
e.AGI = 75;
|
||||
e._INT = 80;
|
||||
e.WIS = 80;
|
||||
e.CHA = 75;
|
||||
e.MR = 15;
|
||||
e.CR = 15;
|
||||
e.DR = 15;
|
||||
e.FR = 15;
|
||||
e.PR = 15;
|
||||
e.Corrup = 15;
|
||||
e.mindmg = 1;
|
||||
e.maxdmg = 1;
|
||||
e.attack_count = 0;
|
||||
e.attack_speed = 0;
|
||||
e.attack_delay = 30;
|
||||
e.special_abilities = "";
|
||||
e.Accuracy = 0;
|
||||
e.hp_regen_rate = 1;
|
||||
e.mana_regen_rate = 1;
|
||||
e.runspeed = 0;
|
||||
e.statscale = 100;
|
||||
e.spellscale = 100;
|
||||
e.healscale = 100;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static MercStats GetMercStats(
|
||||
const std::vector<MercStats> &merc_statss,
|
||||
int merc_stats_id
|
||||
)
|
||||
{
|
||||
for (auto &merc_stats : merc_statss) {
|
||||
if (merc_stats.merc_npc_type_id == merc_stats_id) {
|
||||
return merc_stats;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static MercStats FindOne(
|
||||
Database& db,
|
||||
int merc_stats_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
merc_stats_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
MercStats e{};
|
||||
|
||||
e.merc_npc_type_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.clientlevel = static_cast<uint8_t>(strtoul(row[1], nullptr, 10));
|
||||
e.level = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.hp = static_cast<int32_t>(atoi(row[3]));
|
||||
e.mana = static_cast<int32_t>(atoi(row[4]));
|
||||
e.AC = static_cast<int16_t>(atoi(row[5]));
|
||||
e.ATK = static_cast<int32_t>(atoi(row[6]));
|
||||
e.STR = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.STA = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.DEX = static_cast<uint32_t>(strtoul(row[9], nullptr, 10));
|
||||
e.AGI = static_cast<uint32_t>(strtoul(row[10], nullptr, 10));
|
||||
e._INT = static_cast<uint32_t>(strtoul(row[11], nullptr, 10));
|
||||
e.WIS = static_cast<uint32_t>(strtoul(row[12], nullptr, 10));
|
||||
e.CHA = static_cast<uint32_t>(strtoul(row[13], nullptr, 10));
|
||||
e.MR = static_cast<int16_t>(atoi(row[14]));
|
||||
e.CR = static_cast<int16_t>(atoi(row[15]));
|
||||
e.DR = static_cast<int16_t>(atoi(row[16]));
|
||||
e.FR = static_cast<int16_t>(atoi(row[17]));
|
||||
e.PR = static_cast<int16_t>(atoi(row[18]));
|
||||
e.Corrup = static_cast<int16_t>(atoi(row[19]));
|
||||
e.mindmg = static_cast<uint32_t>(strtoul(row[20], nullptr, 10));
|
||||
e.maxdmg = static_cast<uint32_t>(strtoul(row[21], nullptr, 10));
|
||||
e.attack_count = static_cast<int16_t>(atoi(row[22]));
|
||||
e.attack_speed = static_cast<int8_t>(atoi(row[23]));
|
||||
e.attack_delay = static_cast<uint8_t>(strtoul(row[24], nullptr, 10));
|
||||
e.special_abilities = row[25] ? row[25] : "";
|
||||
e.Accuracy = static_cast<int32_t>(atoi(row[26]));
|
||||
e.hp_regen_rate = static_cast<uint32_t>(strtoul(row[27], nullptr, 10));
|
||||
e.mana_regen_rate = static_cast<uint32_t>(strtoul(row[28], nullptr, 10));
|
||||
e.runspeed = strtof(row[29], nullptr);
|
||||
e.statscale = static_cast<int32_t>(atoi(row[30]));
|
||||
e.spellscale = strtof(row[31], nullptr);
|
||||
e.healscale = strtof(row[32], nullptr);
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int merc_stats_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
merc_stats_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
const MercStats &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[0] + " = " + std::to_string(e.merc_npc_type_id));
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.clientlevel));
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.level));
|
||||
v.push_back(columns[3] + " = " + std::to_string(e.hp));
|
||||
v.push_back(columns[4] + " = " + std::to_string(e.mana));
|
||||
v.push_back(columns[5] + " = " + std::to_string(e.AC));
|
||||
v.push_back(columns[6] + " = " + std::to_string(e.ATK));
|
||||
v.push_back(columns[7] + " = " + std::to_string(e.STR));
|
||||
v.push_back(columns[8] + " = " + std::to_string(e.STA));
|
||||
v.push_back(columns[9] + " = " + std::to_string(e.DEX));
|
||||
v.push_back(columns[10] + " = " + std::to_string(e.AGI));
|
||||
v.push_back(columns[11] + " = " + std::to_string(e._INT));
|
||||
v.push_back(columns[12] + " = " + std::to_string(e.WIS));
|
||||
v.push_back(columns[13] + " = " + std::to_string(e.CHA));
|
||||
v.push_back(columns[14] + " = " + std::to_string(e.MR));
|
||||
v.push_back(columns[15] + " = " + std::to_string(e.CR));
|
||||
v.push_back(columns[16] + " = " + std::to_string(e.DR));
|
||||
v.push_back(columns[17] + " = " + std::to_string(e.FR));
|
||||
v.push_back(columns[18] + " = " + std::to_string(e.PR));
|
||||
v.push_back(columns[19] + " = " + std::to_string(e.Corrup));
|
||||
v.push_back(columns[20] + " = " + std::to_string(e.mindmg));
|
||||
v.push_back(columns[21] + " = " + std::to_string(e.maxdmg));
|
||||
v.push_back(columns[22] + " = " + std::to_string(e.attack_count));
|
||||
v.push_back(columns[23] + " = " + std::to_string(e.attack_speed));
|
||||
v.push_back(columns[24] + " = " + std::to_string(e.attack_delay));
|
||||
v.push_back(columns[25] + " = '" + Strings::Escape(e.special_abilities) + "'");
|
||||
v.push_back(columns[26] + " = " + std::to_string(e.Accuracy));
|
||||
v.push_back(columns[27] + " = " + std::to_string(e.hp_regen_rate));
|
||||
v.push_back(columns[28] + " = " + std::to_string(e.mana_regen_rate));
|
||||
v.push_back(columns[29] + " = " + std::to_string(e.runspeed));
|
||||
v.push_back(columns[30] + " = " + std::to_string(e.statscale));
|
||||
v.push_back(columns[31] + " = " + std::to_string(e.spellscale));
|
||||
v.push_back(columns[32] + " = " + std::to_string(e.healscale));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
Strings::Implode(", ", v),
|
||||
PrimaryKey(),
|
||||
e.merc_npc_type_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static MercStats InsertOne(
|
||||
Database& db,
|
||||
MercStats e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.merc_npc_type_id));
|
||||
v.push_back(std::to_string(e.clientlevel));
|
||||
v.push_back(std::to_string(e.level));
|
||||
v.push_back(std::to_string(e.hp));
|
||||
v.push_back(std::to_string(e.mana));
|
||||
v.push_back(std::to_string(e.AC));
|
||||
v.push_back(std::to_string(e.ATK));
|
||||
v.push_back(std::to_string(e.STR));
|
||||
v.push_back(std::to_string(e.STA));
|
||||
v.push_back(std::to_string(e.DEX));
|
||||
v.push_back(std::to_string(e.AGI));
|
||||
v.push_back(std::to_string(e._INT));
|
||||
v.push_back(std::to_string(e.WIS));
|
||||
v.push_back(std::to_string(e.CHA));
|
||||
v.push_back(std::to_string(e.MR));
|
||||
v.push_back(std::to_string(e.CR));
|
||||
v.push_back(std::to_string(e.DR));
|
||||
v.push_back(std::to_string(e.FR));
|
||||
v.push_back(std::to_string(e.PR));
|
||||
v.push_back(std::to_string(e.Corrup));
|
||||
v.push_back(std::to_string(e.mindmg));
|
||||
v.push_back(std::to_string(e.maxdmg));
|
||||
v.push_back(std::to_string(e.attack_count));
|
||||
v.push_back(std::to_string(e.attack_speed));
|
||||
v.push_back(std::to_string(e.attack_delay));
|
||||
v.push_back("'" + Strings::Escape(e.special_abilities) + "'");
|
||||
v.push_back(std::to_string(e.Accuracy));
|
||||
v.push_back(std::to_string(e.hp_regen_rate));
|
||||
v.push_back(std::to_string(e.mana_regen_rate));
|
||||
v.push_back(std::to_string(e.runspeed));
|
||||
v.push_back(std::to_string(e.statscale));
|
||||
v.push_back(std::to_string(e.spellscale));
|
||||
v.push_back(std::to_string(e.healscale));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
e.merc_npc_type_id = results.LastInsertedID();
|
||||
return e;
|
||||
}
|
||||
|
||||
e = NewEntity();
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
const std::vector<MercStats> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.merc_npc_type_id));
|
||||
v.push_back(std::to_string(e.clientlevel));
|
||||
v.push_back(std::to_string(e.level));
|
||||
v.push_back(std::to_string(e.hp));
|
||||
v.push_back(std::to_string(e.mana));
|
||||
v.push_back(std::to_string(e.AC));
|
||||
v.push_back(std::to_string(e.ATK));
|
||||
v.push_back(std::to_string(e.STR));
|
||||
v.push_back(std::to_string(e.STA));
|
||||
v.push_back(std::to_string(e.DEX));
|
||||
v.push_back(std::to_string(e.AGI));
|
||||
v.push_back(std::to_string(e._INT));
|
||||
v.push_back(std::to_string(e.WIS));
|
||||
v.push_back(std::to_string(e.CHA));
|
||||
v.push_back(std::to_string(e.MR));
|
||||
v.push_back(std::to_string(e.CR));
|
||||
v.push_back(std::to_string(e.DR));
|
||||
v.push_back(std::to_string(e.FR));
|
||||
v.push_back(std::to_string(e.PR));
|
||||
v.push_back(std::to_string(e.Corrup));
|
||||
v.push_back(std::to_string(e.mindmg));
|
||||
v.push_back(std::to_string(e.maxdmg));
|
||||
v.push_back(std::to_string(e.attack_count));
|
||||
v.push_back(std::to_string(e.attack_speed));
|
||||
v.push_back(std::to_string(e.attack_delay));
|
||||
v.push_back("'" + Strings::Escape(e.special_abilities) + "'");
|
||||
v.push_back(std::to_string(e.Accuracy));
|
||||
v.push_back(std::to_string(e.hp_regen_rate));
|
||||
v.push_back(std::to_string(e.mana_regen_rate));
|
||||
v.push_back(std::to_string(e.runspeed));
|
||||
v.push_back(std::to_string(e.statscale));
|
||||
v.push_back(std::to_string(e.spellscale));
|
||||
v.push_back(std::to_string(e.healscale));
|
||||
|
||||
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<MercStats> All(Database& db)
|
||||
{
|
||||
std::vector<MercStats> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
MercStats e{};
|
||||
|
||||
e.merc_npc_type_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.clientlevel = static_cast<uint8_t>(strtoul(row[1], nullptr, 10));
|
||||
e.level = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.hp = static_cast<int32_t>(atoi(row[3]));
|
||||
e.mana = static_cast<int32_t>(atoi(row[4]));
|
||||
e.AC = static_cast<int16_t>(atoi(row[5]));
|
||||
e.ATK = static_cast<int32_t>(atoi(row[6]));
|
||||
e.STR = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.STA = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.DEX = static_cast<uint32_t>(strtoul(row[9], nullptr, 10));
|
||||
e.AGI = static_cast<uint32_t>(strtoul(row[10], nullptr, 10));
|
||||
e._INT = static_cast<uint32_t>(strtoul(row[11], nullptr, 10));
|
||||
e.WIS = static_cast<uint32_t>(strtoul(row[12], nullptr, 10));
|
||||
e.CHA = static_cast<uint32_t>(strtoul(row[13], nullptr, 10));
|
||||
e.MR = static_cast<int16_t>(atoi(row[14]));
|
||||
e.CR = static_cast<int16_t>(atoi(row[15]));
|
||||
e.DR = static_cast<int16_t>(atoi(row[16]));
|
||||
e.FR = static_cast<int16_t>(atoi(row[17]));
|
||||
e.PR = static_cast<int16_t>(atoi(row[18]));
|
||||
e.Corrup = static_cast<int16_t>(atoi(row[19]));
|
||||
e.mindmg = static_cast<uint32_t>(strtoul(row[20], nullptr, 10));
|
||||
e.maxdmg = static_cast<uint32_t>(strtoul(row[21], nullptr, 10));
|
||||
e.attack_count = static_cast<int16_t>(atoi(row[22]));
|
||||
e.attack_speed = static_cast<int8_t>(atoi(row[23]));
|
||||
e.attack_delay = static_cast<uint8_t>(strtoul(row[24], nullptr, 10));
|
||||
e.special_abilities = row[25] ? row[25] : "";
|
||||
e.Accuracy = static_cast<int32_t>(atoi(row[26]));
|
||||
e.hp_regen_rate = static_cast<uint32_t>(strtoul(row[27], nullptr, 10));
|
||||
e.mana_regen_rate = static_cast<uint32_t>(strtoul(row[28], nullptr, 10));
|
||||
e.runspeed = strtof(row[29], nullptr);
|
||||
e.statscale = static_cast<int32_t>(atoi(row[30]));
|
||||
e.spellscale = strtof(row[31], nullptr);
|
||||
e.healscale = strtof(row[32], nullptr);
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<MercStats> GetWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
std::vector<MercStats> 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) {
|
||||
MercStats e{};
|
||||
|
||||
e.merc_npc_type_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.clientlevel = static_cast<uint8_t>(strtoul(row[1], nullptr, 10));
|
||||
e.level = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.hp = static_cast<int32_t>(atoi(row[3]));
|
||||
e.mana = static_cast<int32_t>(atoi(row[4]));
|
||||
e.AC = static_cast<int16_t>(atoi(row[5]));
|
||||
e.ATK = static_cast<int32_t>(atoi(row[6]));
|
||||
e.STR = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.STA = static_cast<uint32_t>(strtoul(row[8], nullptr, 10));
|
||||
e.DEX = static_cast<uint32_t>(strtoul(row[9], nullptr, 10));
|
||||
e.AGI = static_cast<uint32_t>(strtoul(row[10], nullptr, 10));
|
||||
e._INT = static_cast<uint32_t>(strtoul(row[11], nullptr, 10));
|
||||
e.WIS = static_cast<uint32_t>(strtoul(row[12], nullptr, 10));
|
||||
e.CHA = static_cast<uint32_t>(strtoul(row[13], nullptr, 10));
|
||||
e.MR = static_cast<int16_t>(atoi(row[14]));
|
||||
e.CR = static_cast<int16_t>(atoi(row[15]));
|
||||
e.DR = static_cast<int16_t>(atoi(row[16]));
|
||||
e.FR = static_cast<int16_t>(atoi(row[17]));
|
||||
e.PR = static_cast<int16_t>(atoi(row[18]));
|
||||
e.Corrup = static_cast<int16_t>(atoi(row[19]));
|
||||
e.mindmg = static_cast<uint32_t>(strtoul(row[20], nullptr, 10));
|
||||
e.maxdmg = static_cast<uint32_t>(strtoul(row[21], nullptr, 10));
|
||||
e.attack_count = static_cast<int16_t>(atoi(row[22]));
|
||||
e.attack_speed = static_cast<int8_t>(atoi(row[23]));
|
||||
e.attack_delay = static_cast<uint8_t>(strtoul(row[24], nullptr, 10));
|
||||
e.special_abilities = row[25] ? row[25] : "";
|
||||
e.Accuracy = static_cast<int32_t>(atoi(row[26]));
|
||||
e.hp_regen_rate = static_cast<uint32_t>(strtoul(row[27], nullptr, 10));
|
||||
e.mana_regen_rate = static_cast<uint32_t>(strtoul(row[28], nullptr, 10));
|
||||
e.runspeed = strtof(row[29], nullptr);
|
||||
e.statscale = static_cast<int32_t>(atoi(row[30]));
|
||||
e.spellscale = strtof(row[31], nullptr);
|
||||
e.healscale = strtof(row[32], nullptr);
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_MERC_STATS_REPOSITORY_H
|
||||
@@ -1,354 +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://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_MERC_SUBTYPES_REPOSITORY_H
|
||||
#define EQEMU_BASE_MERC_SUBTYPES_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
|
||||
class BaseMercSubtypesRepository {
|
||||
public:
|
||||
struct MercSubtypes {
|
||||
uint32_t merc_subtype_id;
|
||||
uint32_t class_id;
|
||||
uint8_t tier_id;
|
||||
uint8_t confidence_id;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("merc_subtype_id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"merc_subtype_id",
|
||||
"class_id",
|
||||
"tier_id",
|
||||
"confidence_id",
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"merc_subtype_id",
|
||||
"class_id",
|
||||
"tier_id",
|
||||
"confidence_id",
|
||||
};
|
||||
}
|
||||
|
||||
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("merc_subtypes");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
SelectColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static MercSubtypes NewEntity()
|
||||
{
|
||||
MercSubtypes e{};
|
||||
|
||||
e.merc_subtype_id = 0;
|
||||
e.class_id = 0;
|
||||
e.tier_id = 0;
|
||||
e.confidence_id = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static MercSubtypes GetMercSubtypes(
|
||||
const std::vector<MercSubtypes> &merc_subtypess,
|
||||
int merc_subtypes_id
|
||||
)
|
||||
{
|
||||
for (auto &merc_subtypes : merc_subtypess) {
|
||||
if (merc_subtypes.merc_subtype_id == merc_subtypes_id) {
|
||||
return merc_subtypes;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static MercSubtypes FindOne(
|
||||
Database& db,
|
||||
int merc_subtypes_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
merc_subtypes_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
MercSubtypes e{};
|
||||
|
||||
e.merc_subtype_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.class_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.tier_id = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.confidence_id = static_cast<uint8_t>(strtoul(row[3], nullptr, 10));
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int merc_subtypes_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
merc_subtypes_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
const MercSubtypes &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.class_id));
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.tier_id));
|
||||
v.push_back(columns[3] + " = " + std::to_string(e.confidence_id));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
Strings::Implode(", ", v),
|
||||
PrimaryKey(),
|
||||
e.merc_subtype_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static MercSubtypes InsertOne(
|
||||
Database& db,
|
||||
MercSubtypes e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.merc_subtype_id));
|
||||
v.push_back(std::to_string(e.class_id));
|
||||
v.push_back(std::to_string(e.tier_id));
|
||||
v.push_back(std::to_string(e.confidence_id));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
e.merc_subtype_id = results.LastInsertedID();
|
||||
return e;
|
||||
}
|
||||
|
||||
e = NewEntity();
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
const std::vector<MercSubtypes> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.merc_subtype_id));
|
||||
v.push_back(std::to_string(e.class_id));
|
||||
v.push_back(std::to_string(e.tier_id));
|
||||
v.push_back(std::to_string(e.confidence_id));
|
||||
|
||||
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<MercSubtypes> All(Database& db)
|
||||
{
|
||||
std::vector<MercSubtypes> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
MercSubtypes e{};
|
||||
|
||||
e.merc_subtype_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.class_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.tier_id = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.confidence_id = static_cast<uint8_t>(strtoul(row[3], nullptr, 10));
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<MercSubtypes> GetWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
std::vector<MercSubtypes> 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) {
|
||||
MercSubtypes e{};
|
||||
|
||||
e.merc_subtype_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.class_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.tier_id = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.confidence_id = static_cast<uint8_t>(strtoul(row[3], 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);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_MERC_SUBTYPES_REPOSITORY_H
|
||||
@@ -1,384 +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://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_MERC_TEMPLATES_REPOSITORY_H
|
||||
#define EQEMU_BASE_MERC_TEMPLATES_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
|
||||
class BaseMercTemplatesRepository {
|
||||
public:
|
||||
struct MercTemplates {
|
||||
uint32_t merc_template_id;
|
||||
uint32_t merc_type_id;
|
||||
uint32_t merc_subtype_id;
|
||||
uint32_t merc_npc_type_id;
|
||||
std::string dbstring;
|
||||
int8_t name_type_id;
|
||||
uint32_t clientversion;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("merc_template_id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"merc_template_id",
|
||||
"merc_type_id",
|
||||
"merc_subtype_id",
|
||||
"merc_npc_type_id",
|
||||
"dbstring",
|
||||
"name_type_id",
|
||||
"clientversion",
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"merc_template_id",
|
||||
"merc_type_id",
|
||||
"merc_subtype_id",
|
||||
"merc_npc_type_id",
|
||||
"dbstring",
|
||||
"name_type_id",
|
||||
"clientversion",
|
||||
};
|
||||
}
|
||||
|
||||
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("merc_templates");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
SelectColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static MercTemplates NewEntity()
|
||||
{
|
||||
MercTemplates e{};
|
||||
|
||||
e.merc_template_id = 0;
|
||||
e.merc_type_id = 0;
|
||||
e.merc_subtype_id = 0;
|
||||
e.merc_npc_type_id = 0;
|
||||
e.dbstring = "";
|
||||
e.name_type_id = 0;
|
||||
e.clientversion = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static MercTemplates GetMercTemplates(
|
||||
const std::vector<MercTemplates> &merc_templatess,
|
||||
int merc_templates_id
|
||||
)
|
||||
{
|
||||
for (auto &merc_templates : merc_templatess) {
|
||||
if (merc_templates.merc_template_id == merc_templates_id) {
|
||||
return merc_templates;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static MercTemplates FindOne(
|
||||
Database& db,
|
||||
int merc_templates_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
merc_templates_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
MercTemplates e{};
|
||||
|
||||
e.merc_template_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.merc_type_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.merc_subtype_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.merc_npc_type_id = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.dbstring = row[4] ? row[4] : "";
|
||||
e.name_type_id = static_cast<int8_t>(atoi(row[5]));
|
||||
e.clientversion = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int merc_templates_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
merc_templates_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
const MercTemplates &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.merc_type_id));
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.merc_subtype_id));
|
||||
v.push_back(columns[3] + " = " + std::to_string(e.merc_npc_type_id));
|
||||
v.push_back(columns[4] + " = '" + Strings::Escape(e.dbstring) + "'");
|
||||
v.push_back(columns[5] + " = " + std::to_string(e.name_type_id));
|
||||
v.push_back(columns[6] + " = " + std::to_string(e.clientversion));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
Strings::Implode(", ", v),
|
||||
PrimaryKey(),
|
||||
e.merc_template_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static MercTemplates InsertOne(
|
||||
Database& db,
|
||||
MercTemplates e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.merc_template_id));
|
||||
v.push_back(std::to_string(e.merc_type_id));
|
||||
v.push_back(std::to_string(e.merc_subtype_id));
|
||||
v.push_back(std::to_string(e.merc_npc_type_id));
|
||||
v.push_back("'" + Strings::Escape(e.dbstring) + "'");
|
||||
v.push_back(std::to_string(e.name_type_id));
|
||||
v.push_back(std::to_string(e.clientversion));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
e.merc_template_id = results.LastInsertedID();
|
||||
return e;
|
||||
}
|
||||
|
||||
e = NewEntity();
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
const std::vector<MercTemplates> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.merc_template_id));
|
||||
v.push_back(std::to_string(e.merc_type_id));
|
||||
v.push_back(std::to_string(e.merc_subtype_id));
|
||||
v.push_back(std::to_string(e.merc_npc_type_id));
|
||||
v.push_back("'" + Strings::Escape(e.dbstring) + "'");
|
||||
v.push_back(std::to_string(e.name_type_id));
|
||||
v.push_back(std::to_string(e.clientversion));
|
||||
|
||||
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<MercTemplates> All(Database& db)
|
||||
{
|
||||
std::vector<MercTemplates> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
MercTemplates e{};
|
||||
|
||||
e.merc_template_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.merc_type_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.merc_subtype_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.merc_npc_type_id = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.dbstring = row[4] ? row[4] : "";
|
||||
e.name_type_id = static_cast<int8_t>(atoi(row[5]));
|
||||
e.clientversion = static_cast<uint32_t>(strtoul(row[6], nullptr, 10));
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<MercTemplates> GetWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
std::vector<MercTemplates> 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) {
|
||||
MercTemplates e{};
|
||||
|
||||
e.merc_template_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.merc_type_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.merc_subtype_id = static_cast<uint32_t>(strtoul(row[2], nullptr, 10));
|
||||
e.merc_npc_type_id = static_cast<uint32_t>(strtoul(row[3], nullptr, 10));
|
||||
e.dbstring = row[4] ? row[4] : "";
|
||||
e.name_type_id = static_cast<int8_t>(atoi(row[5]));
|
||||
e.clientversion = static_cast<uint32_t>(strtoul(row[6], 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);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_MERC_TEMPLATES_REPOSITORY_H
|
||||
@@ -1,364 +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://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_MERC_TYPES_REPOSITORY_H
|
||||
#define EQEMU_BASE_MERC_TYPES_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
|
||||
class BaseMercTypesRepository {
|
||||
public:
|
||||
struct MercTypes {
|
||||
uint32_t merc_type_id;
|
||||
uint32_t race_id;
|
||||
uint8_t proficiency_id;
|
||||
std::string dbstring;
|
||||
uint32_t clientversion;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("merc_type_id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"merc_type_id",
|
||||
"race_id",
|
||||
"proficiency_id",
|
||||
"dbstring",
|
||||
"clientversion",
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"merc_type_id",
|
||||
"race_id",
|
||||
"proficiency_id",
|
||||
"dbstring",
|
||||
"clientversion",
|
||||
};
|
||||
}
|
||||
|
||||
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("merc_types");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
SelectColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static MercTypes NewEntity()
|
||||
{
|
||||
MercTypes e{};
|
||||
|
||||
e.merc_type_id = 0;
|
||||
e.race_id = 0;
|
||||
e.proficiency_id = 0;
|
||||
e.dbstring = "";
|
||||
e.clientversion = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static MercTypes GetMercTypes(
|
||||
const std::vector<MercTypes> &merc_typess,
|
||||
int merc_types_id
|
||||
)
|
||||
{
|
||||
for (auto &merc_types : merc_typess) {
|
||||
if (merc_types.merc_type_id == merc_types_id) {
|
||||
return merc_types;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static MercTypes FindOne(
|
||||
Database& db,
|
||||
int merc_types_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
merc_types_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
MercTypes e{};
|
||||
|
||||
e.merc_type_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.race_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.proficiency_id = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.dbstring = row[3] ? row[3] : "";
|
||||
e.clientversion = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int merc_types_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
merc_types_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
const MercTypes &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.race_id));
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.proficiency_id));
|
||||
v.push_back(columns[3] + " = '" + Strings::Escape(e.dbstring) + "'");
|
||||
v.push_back(columns[4] + " = " + std::to_string(e.clientversion));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
Strings::Implode(", ", v),
|
||||
PrimaryKey(),
|
||||
e.merc_type_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static MercTypes InsertOne(
|
||||
Database& db,
|
||||
MercTypes e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.merc_type_id));
|
||||
v.push_back(std::to_string(e.race_id));
|
||||
v.push_back(std::to_string(e.proficiency_id));
|
||||
v.push_back("'" + Strings::Escape(e.dbstring) + "'");
|
||||
v.push_back(std::to_string(e.clientversion));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
e.merc_type_id = results.LastInsertedID();
|
||||
return e;
|
||||
}
|
||||
|
||||
e = NewEntity();
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
const std::vector<MercTypes> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.merc_type_id));
|
||||
v.push_back(std::to_string(e.race_id));
|
||||
v.push_back(std::to_string(e.proficiency_id));
|
||||
v.push_back("'" + Strings::Escape(e.dbstring) + "'");
|
||||
v.push_back(std::to_string(e.clientversion));
|
||||
|
||||
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<MercTypes> All(Database& db)
|
||||
{
|
||||
std::vector<MercTypes> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
MercTypes e{};
|
||||
|
||||
e.merc_type_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.race_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.proficiency_id = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.dbstring = row[3] ? row[3] : "";
|
||||
e.clientversion = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<MercTypes> GetWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
std::vector<MercTypes> 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) {
|
||||
MercTypes e{};
|
||||
|
||||
e.merc_type_id = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.race_id = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.proficiency_id = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.dbstring = row[3] ? row[3] : "";
|
||||
e.clientversion = static_cast<uint32_t>(strtoul(row[4], 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);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_MERC_TYPES_REPOSITORY_H
|
||||
@@ -1,394 +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://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_MERC_WEAPONINFO_REPOSITORY_H
|
||||
#define EQEMU_BASE_MERC_WEAPONINFO_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
|
||||
class BaseMercWeaponinfoRepository {
|
||||
public:
|
||||
struct MercWeaponinfo {
|
||||
int32_t id;
|
||||
int32_t merc_npc_type_id;
|
||||
uint8_t minlevel;
|
||||
uint8_t maxlevel;
|
||||
int32_t d_melee_texture1;
|
||||
int32_t d_melee_texture2;
|
||||
uint8_t prim_melee_type;
|
||||
uint8_t sec_melee_type;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("id");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"merc_npc_type_id",
|
||||
"minlevel",
|
||||
"maxlevel",
|
||||
"d_melee_texture1",
|
||||
"d_melee_texture2",
|
||||
"prim_melee_type",
|
||||
"sec_melee_type",
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"id",
|
||||
"merc_npc_type_id",
|
||||
"minlevel",
|
||||
"maxlevel",
|
||||
"d_melee_texture1",
|
||||
"d_melee_texture2",
|
||||
"prim_melee_type",
|
||||
"sec_melee_type",
|
||||
};
|
||||
}
|
||||
|
||||
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("merc_weaponinfo");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
SelectColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static MercWeaponinfo NewEntity()
|
||||
{
|
||||
MercWeaponinfo e{};
|
||||
|
||||
e.id = 0;
|
||||
e.merc_npc_type_id = 0;
|
||||
e.minlevel = 0;
|
||||
e.maxlevel = 0;
|
||||
e.d_melee_texture1 = 0;
|
||||
e.d_melee_texture2 = 0;
|
||||
e.prim_melee_type = 28;
|
||||
e.sec_melee_type = 28;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static MercWeaponinfo GetMercWeaponinfo(
|
||||
const std::vector<MercWeaponinfo> &merc_weaponinfos,
|
||||
int merc_weaponinfo_id
|
||||
)
|
||||
{
|
||||
for (auto &merc_weaponinfo : merc_weaponinfos) {
|
||||
if (merc_weaponinfo.id == merc_weaponinfo_id) {
|
||||
return merc_weaponinfo;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static MercWeaponinfo FindOne(
|
||||
Database& db,
|
||||
int merc_weaponinfo_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
merc_weaponinfo_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
MercWeaponinfo e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.merc_npc_type_id = static_cast<int32_t>(atoi(row[1]));
|
||||
e.minlevel = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.maxlevel = static_cast<uint8_t>(strtoul(row[3], nullptr, 10));
|
||||
e.d_melee_texture1 = static_cast<int32_t>(atoi(row[4]));
|
||||
e.d_melee_texture2 = static_cast<int32_t>(atoi(row[5]));
|
||||
e.prim_melee_type = static_cast<uint8_t>(strtoul(row[6], nullptr, 10));
|
||||
e.sec_melee_type = static_cast<uint8_t>(strtoul(row[7], nullptr, 10));
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int merc_weaponinfo_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
merc_weaponinfo_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
const MercWeaponinfo &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.merc_npc_type_id));
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.minlevel));
|
||||
v.push_back(columns[3] + " = " + std::to_string(e.maxlevel));
|
||||
v.push_back(columns[4] + " = " + std::to_string(e.d_melee_texture1));
|
||||
v.push_back(columns[5] + " = " + std::to_string(e.d_melee_texture2));
|
||||
v.push_back(columns[6] + " = " + std::to_string(e.prim_melee_type));
|
||||
v.push_back(columns[7] + " = " + std::to_string(e.sec_melee_type));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
Strings::Implode(", ", v),
|
||||
PrimaryKey(),
|
||||
e.id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static MercWeaponinfo InsertOne(
|
||||
Database& db,
|
||||
MercWeaponinfo e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.id));
|
||||
v.push_back(std::to_string(e.merc_npc_type_id));
|
||||
v.push_back(std::to_string(e.minlevel));
|
||||
v.push_back(std::to_string(e.maxlevel));
|
||||
v.push_back(std::to_string(e.d_melee_texture1));
|
||||
v.push_back(std::to_string(e.d_melee_texture2));
|
||||
v.push_back(std::to_string(e.prim_melee_type));
|
||||
v.push_back(std::to_string(e.sec_melee_type));
|
||||
|
||||
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<MercWeaponinfo> &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.merc_npc_type_id));
|
||||
v.push_back(std::to_string(e.minlevel));
|
||||
v.push_back(std::to_string(e.maxlevel));
|
||||
v.push_back(std::to_string(e.d_melee_texture1));
|
||||
v.push_back(std::to_string(e.d_melee_texture2));
|
||||
v.push_back(std::to_string(e.prim_melee_type));
|
||||
v.push_back(std::to_string(e.sec_melee_type));
|
||||
|
||||
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<MercWeaponinfo> All(Database& db)
|
||||
{
|
||||
std::vector<MercWeaponinfo> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
MercWeaponinfo e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.merc_npc_type_id = static_cast<int32_t>(atoi(row[1]));
|
||||
e.minlevel = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.maxlevel = static_cast<uint8_t>(strtoul(row[3], nullptr, 10));
|
||||
e.d_melee_texture1 = static_cast<int32_t>(atoi(row[4]));
|
||||
e.d_melee_texture2 = static_cast<int32_t>(atoi(row[5]));
|
||||
e.prim_melee_type = static_cast<uint8_t>(strtoul(row[6], nullptr, 10));
|
||||
e.sec_melee_type = static_cast<uint8_t>(strtoul(row[7], nullptr, 10));
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<MercWeaponinfo> GetWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
std::vector<MercWeaponinfo> 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) {
|
||||
MercWeaponinfo e{};
|
||||
|
||||
e.id = static_cast<int32_t>(atoi(row[0]));
|
||||
e.merc_npc_type_id = static_cast<int32_t>(atoi(row[1]));
|
||||
e.minlevel = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.maxlevel = static_cast<uint8_t>(strtoul(row[3], nullptr, 10));
|
||||
e.d_melee_texture1 = static_cast<int32_t>(atoi(row[4]));
|
||||
e.d_melee_texture2 = static_cast<int32_t>(atoi(row[5]));
|
||||
e.prim_melee_type = static_cast<uint8_t>(strtoul(row[6], nullptr, 10));
|
||||
e.sec_melee_type = static_cast<uint8_t>(strtoul(row[7], 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);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_MERC_WEAPONINFO_REPOSITORY_H
|
||||
@@ -1,554 +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://eqemu.gitbook.io/server/in-development/developer-area/repositories
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_BASE_MERCS_REPOSITORY_H
|
||||
#define EQEMU_BASE_MERCS_REPOSITORY_H
|
||||
|
||||
#include "../../database.h"
|
||||
#include "../../strings.h"
|
||||
#include <ctime>
|
||||
|
||||
|
||||
class BaseMercsRepository {
|
||||
public:
|
||||
struct Mercs {
|
||||
uint32_t MercID;
|
||||
uint32_t OwnerCharacterID;
|
||||
uint8_t Slot;
|
||||
std::string Name;
|
||||
uint32_t TemplateID;
|
||||
uint32_t SuspendedTime;
|
||||
uint8_t IsSuspended;
|
||||
uint32_t TimerRemaining;
|
||||
uint8_t Gender;
|
||||
float MercSize;
|
||||
uint8_t StanceID;
|
||||
uint32_t HP;
|
||||
uint32_t Mana;
|
||||
uint32_t Endurance;
|
||||
uint32_t Face;
|
||||
uint32_t LuclinHairStyle;
|
||||
uint32_t LuclinHairColor;
|
||||
uint32_t LuclinEyeColor;
|
||||
uint32_t LuclinEyeColor2;
|
||||
uint32_t LuclinBeardColor;
|
||||
uint32_t LuclinBeard;
|
||||
uint32_t DrakkinHeritage;
|
||||
uint32_t DrakkinTattoo;
|
||||
uint32_t DrakkinDetails;
|
||||
};
|
||||
|
||||
static std::string PrimaryKey()
|
||||
{
|
||||
return std::string("MercID");
|
||||
}
|
||||
|
||||
static std::vector<std::string> Columns()
|
||||
{
|
||||
return {
|
||||
"MercID",
|
||||
"OwnerCharacterID",
|
||||
"Slot",
|
||||
"Name",
|
||||
"TemplateID",
|
||||
"SuspendedTime",
|
||||
"IsSuspended",
|
||||
"TimerRemaining",
|
||||
"Gender",
|
||||
"MercSize",
|
||||
"StanceID",
|
||||
"HP",
|
||||
"Mana",
|
||||
"Endurance",
|
||||
"Face",
|
||||
"LuclinHairStyle",
|
||||
"LuclinHairColor",
|
||||
"LuclinEyeColor",
|
||||
"LuclinEyeColor2",
|
||||
"LuclinBeardColor",
|
||||
"LuclinBeard",
|
||||
"DrakkinHeritage",
|
||||
"DrakkinTattoo",
|
||||
"DrakkinDetails",
|
||||
};
|
||||
}
|
||||
|
||||
static std::vector<std::string> SelectColumns()
|
||||
{
|
||||
return {
|
||||
"MercID",
|
||||
"OwnerCharacterID",
|
||||
"Slot",
|
||||
"Name",
|
||||
"TemplateID",
|
||||
"SuspendedTime",
|
||||
"IsSuspended",
|
||||
"TimerRemaining",
|
||||
"Gender",
|
||||
"MercSize",
|
||||
"StanceID",
|
||||
"HP",
|
||||
"Mana",
|
||||
"Endurance",
|
||||
"Face",
|
||||
"LuclinHairStyle",
|
||||
"LuclinHairColor",
|
||||
"LuclinEyeColor",
|
||||
"LuclinEyeColor2",
|
||||
"LuclinBeardColor",
|
||||
"LuclinBeard",
|
||||
"DrakkinHeritage",
|
||||
"DrakkinTattoo",
|
||||
"DrakkinDetails",
|
||||
};
|
||||
}
|
||||
|
||||
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("mercs");
|
||||
}
|
||||
|
||||
static std::string BaseSelect()
|
||||
{
|
||||
return fmt::format(
|
||||
"SELECT {} FROM {}",
|
||||
SelectColumnsRaw(),
|
||||
TableName()
|
||||
);
|
||||
}
|
||||
|
||||
static std::string BaseInsert()
|
||||
{
|
||||
return fmt::format(
|
||||
"INSERT INTO {} ({}) ",
|
||||
TableName(),
|
||||
ColumnsRaw()
|
||||
);
|
||||
}
|
||||
|
||||
static Mercs NewEntity()
|
||||
{
|
||||
Mercs e{};
|
||||
|
||||
e.MercID = 0;
|
||||
e.OwnerCharacterID = 0;
|
||||
e.Slot = 0;
|
||||
e.Name = "";
|
||||
e.TemplateID = 0;
|
||||
e.SuspendedTime = 0;
|
||||
e.IsSuspended = 0;
|
||||
e.TimerRemaining = 0;
|
||||
e.Gender = 0;
|
||||
e.MercSize = 5;
|
||||
e.StanceID = 0;
|
||||
e.HP = 0;
|
||||
e.Mana = 0;
|
||||
e.Endurance = 0;
|
||||
e.Face = 1;
|
||||
e.LuclinHairStyle = 1;
|
||||
e.LuclinHairColor = 1;
|
||||
e.LuclinEyeColor = 1;
|
||||
e.LuclinEyeColor2 = 1;
|
||||
e.LuclinBeardColor = 1;
|
||||
e.LuclinBeard = 0;
|
||||
e.DrakkinHeritage = 0;
|
||||
e.DrakkinTattoo = 0;
|
||||
e.DrakkinDetails = 0;
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static Mercs GetMercs(
|
||||
const std::vector<Mercs> &mercss,
|
||||
int mercs_id
|
||||
)
|
||||
{
|
||||
for (auto &mercs : mercss) {
|
||||
if (mercs.MercID == mercs_id) {
|
||||
return mercs;
|
||||
}
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static Mercs FindOne(
|
||||
Database& db,
|
||||
int mercs_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} WHERE {} = {} LIMIT 1",
|
||||
BaseSelect(),
|
||||
PrimaryKey(),
|
||||
mercs_id
|
||||
)
|
||||
);
|
||||
|
||||
auto row = results.begin();
|
||||
if (results.RowCount() == 1) {
|
||||
Mercs e{};
|
||||
|
||||
e.MercID = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.OwnerCharacterID = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.Slot = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.Name = row[3] ? row[3] : "";
|
||||
e.TemplateID = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.SuspendedTime = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.IsSuspended = static_cast<uint8_t>(strtoul(row[6], nullptr, 10));
|
||||
e.TimerRemaining = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.Gender = static_cast<uint8_t>(strtoul(row[8], nullptr, 10));
|
||||
e.MercSize = strtof(row[9], nullptr);
|
||||
e.StanceID = static_cast<uint8_t>(strtoul(row[10], nullptr, 10));
|
||||
e.HP = static_cast<uint32_t>(strtoul(row[11], nullptr, 10));
|
||||
e.Mana = static_cast<uint32_t>(strtoul(row[12], nullptr, 10));
|
||||
e.Endurance = static_cast<uint32_t>(strtoul(row[13], nullptr, 10));
|
||||
e.Face = static_cast<uint32_t>(strtoul(row[14], nullptr, 10));
|
||||
e.LuclinHairStyle = static_cast<uint32_t>(strtoul(row[15], nullptr, 10));
|
||||
e.LuclinHairColor = static_cast<uint32_t>(strtoul(row[16], nullptr, 10));
|
||||
e.LuclinEyeColor = static_cast<uint32_t>(strtoul(row[17], nullptr, 10));
|
||||
e.LuclinEyeColor2 = static_cast<uint32_t>(strtoul(row[18], nullptr, 10));
|
||||
e.LuclinBeardColor = static_cast<uint32_t>(strtoul(row[19], nullptr, 10));
|
||||
e.LuclinBeard = static_cast<uint32_t>(strtoul(row[20], nullptr, 10));
|
||||
e.DrakkinHeritage = static_cast<uint32_t>(strtoul(row[21], nullptr, 10));
|
||||
e.DrakkinTattoo = static_cast<uint32_t>(strtoul(row[22], nullptr, 10));
|
||||
e.DrakkinDetails = static_cast<uint32_t>(strtoul(row[23], nullptr, 10));
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
return NewEntity();
|
||||
}
|
||||
|
||||
static int DeleteOne(
|
||||
Database& db,
|
||||
int mercs_id
|
||||
)
|
||||
{
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"DELETE FROM {} WHERE {} = {}",
|
||||
TableName(),
|
||||
PrimaryKey(),
|
||||
mercs_id
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static int UpdateOne(
|
||||
Database& db,
|
||||
const Mercs &e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
auto columns = Columns();
|
||||
|
||||
v.push_back(columns[1] + " = " + std::to_string(e.OwnerCharacterID));
|
||||
v.push_back(columns[2] + " = " + std::to_string(e.Slot));
|
||||
v.push_back(columns[3] + " = '" + Strings::Escape(e.Name) + "'");
|
||||
v.push_back(columns[4] + " = " + std::to_string(e.TemplateID));
|
||||
v.push_back(columns[5] + " = " + std::to_string(e.SuspendedTime));
|
||||
v.push_back(columns[6] + " = " + std::to_string(e.IsSuspended));
|
||||
v.push_back(columns[7] + " = " + std::to_string(e.TimerRemaining));
|
||||
v.push_back(columns[8] + " = " + std::to_string(e.Gender));
|
||||
v.push_back(columns[9] + " = " + std::to_string(e.MercSize));
|
||||
v.push_back(columns[10] + " = " + std::to_string(e.StanceID));
|
||||
v.push_back(columns[11] + " = " + std::to_string(e.HP));
|
||||
v.push_back(columns[12] + " = " + std::to_string(e.Mana));
|
||||
v.push_back(columns[13] + " = " + std::to_string(e.Endurance));
|
||||
v.push_back(columns[14] + " = " + std::to_string(e.Face));
|
||||
v.push_back(columns[15] + " = " + std::to_string(e.LuclinHairStyle));
|
||||
v.push_back(columns[16] + " = " + std::to_string(e.LuclinHairColor));
|
||||
v.push_back(columns[17] + " = " + std::to_string(e.LuclinEyeColor));
|
||||
v.push_back(columns[18] + " = " + std::to_string(e.LuclinEyeColor2));
|
||||
v.push_back(columns[19] + " = " + std::to_string(e.LuclinBeardColor));
|
||||
v.push_back(columns[20] + " = " + std::to_string(e.LuclinBeard));
|
||||
v.push_back(columns[21] + " = " + std::to_string(e.DrakkinHeritage));
|
||||
v.push_back(columns[22] + " = " + std::to_string(e.DrakkinTattoo));
|
||||
v.push_back(columns[23] + " = " + std::to_string(e.DrakkinDetails));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"UPDATE {} SET {} WHERE {} = {}",
|
||||
TableName(),
|
||||
Strings::Implode(", ", v),
|
||||
PrimaryKey(),
|
||||
e.MercID
|
||||
)
|
||||
);
|
||||
|
||||
return (results.Success() ? results.RowsAffected() : 0);
|
||||
}
|
||||
|
||||
static Mercs InsertOne(
|
||||
Database& db,
|
||||
Mercs e
|
||||
)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.MercID));
|
||||
v.push_back(std::to_string(e.OwnerCharacterID));
|
||||
v.push_back(std::to_string(e.Slot));
|
||||
v.push_back("'" + Strings::Escape(e.Name) + "'");
|
||||
v.push_back(std::to_string(e.TemplateID));
|
||||
v.push_back(std::to_string(e.SuspendedTime));
|
||||
v.push_back(std::to_string(e.IsSuspended));
|
||||
v.push_back(std::to_string(e.TimerRemaining));
|
||||
v.push_back(std::to_string(e.Gender));
|
||||
v.push_back(std::to_string(e.MercSize));
|
||||
v.push_back(std::to_string(e.StanceID));
|
||||
v.push_back(std::to_string(e.HP));
|
||||
v.push_back(std::to_string(e.Mana));
|
||||
v.push_back(std::to_string(e.Endurance));
|
||||
v.push_back(std::to_string(e.Face));
|
||||
v.push_back(std::to_string(e.LuclinHairStyle));
|
||||
v.push_back(std::to_string(e.LuclinHairColor));
|
||||
v.push_back(std::to_string(e.LuclinEyeColor));
|
||||
v.push_back(std::to_string(e.LuclinEyeColor2));
|
||||
v.push_back(std::to_string(e.LuclinBeardColor));
|
||||
v.push_back(std::to_string(e.LuclinBeard));
|
||||
v.push_back(std::to_string(e.DrakkinHeritage));
|
||||
v.push_back(std::to_string(e.DrakkinTattoo));
|
||||
v.push_back(std::to_string(e.DrakkinDetails));
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{} VALUES ({})",
|
||||
BaseInsert(),
|
||||
Strings::Implode(",", v)
|
||||
)
|
||||
);
|
||||
|
||||
if (results.Success()) {
|
||||
e.MercID = results.LastInsertedID();
|
||||
return e;
|
||||
}
|
||||
|
||||
e = NewEntity();
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
static int InsertMany(
|
||||
Database& db,
|
||||
const std::vector<Mercs> &entries
|
||||
)
|
||||
{
|
||||
std::vector<std::string> insert_chunks;
|
||||
|
||||
for (auto &e: entries) {
|
||||
std::vector<std::string> v;
|
||||
|
||||
v.push_back(std::to_string(e.MercID));
|
||||
v.push_back(std::to_string(e.OwnerCharacterID));
|
||||
v.push_back(std::to_string(e.Slot));
|
||||
v.push_back("'" + Strings::Escape(e.Name) + "'");
|
||||
v.push_back(std::to_string(e.TemplateID));
|
||||
v.push_back(std::to_string(e.SuspendedTime));
|
||||
v.push_back(std::to_string(e.IsSuspended));
|
||||
v.push_back(std::to_string(e.TimerRemaining));
|
||||
v.push_back(std::to_string(e.Gender));
|
||||
v.push_back(std::to_string(e.MercSize));
|
||||
v.push_back(std::to_string(e.StanceID));
|
||||
v.push_back(std::to_string(e.HP));
|
||||
v.push_back(std::to_string(e.Mana));
|
||||
v.push_back(std::to_string(e.Endurance));
|
||||
v.push_back(std::to_string(e.Face));
|
||||
v.push_back(std::to_string(e.LuclinHairStyle));
|
||||
v.push_back(std::to_string(e.LuclinHairColor));
|
||||
v.push_back(std::to_string(e.LuclinEyeColor));
|
||||
v.push_back(std::to_string(e.LuclinEyeColor2));
|
||||
v.push_back(std::to_string(e.LuclinBeardColor));
|
||||
v.push_back(std::to_string(e.LuclinBeard));
|
||||
v.push_back(std::to_string(e.DrakkinHeritage));
|
||||
v.push_back(std::to_string(e.DrakkinTattoo));
|
||||
v.push_back(std::to_string(e.DrakkinDetails));
|
||||
|
||||
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<Mercs> All(Database& db)
|
||||
{
|
||||
std::vector<Mercs> all_entries;
|
||||
|
||||
auto results = db.QueryDatabase(
|
||||
fmt::format(
|
||||
"{}",
|
||||
BaseSelect()
|
||||
)
|
||||
);
|
||||
|
||||
all_entries.reserve(results.RowCount());
|
||||
|
||||
for (auto row = results.begin(); row != results.end(); ++row) {
|
||||
Mercs e{};
|
||||
|
||||
e.MercID = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.OwnerCharacterID = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.Slot = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.Name = row[3] ? row[3] : "";
|
||||
e.TemplateID = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.SuspendedTime = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.IsSuspended = static_cast<uint8_t>(strtoul(row[6], nullptr, 10));
|
||||
e.TimerRemaining = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.Gender = static_cast<uint8_t>(strtoul(row[8], nullptr, 10));
|
||||
e.MercSize = strtof(row[9], nullptr);
|
||||
e.StanceID = static_cast<uint8_t>(strtoul(row[10], nullptr, 10));
|
||||
e.HP = static_cast<uint32_t>(strtoul(row[11], nullptr, 10));
|
||||
e.Mana = static_cast<uint32_t>(strtoul(row[12], nullptr, 10));
|
||||
e.Endurance = static_cast<uint32_t>(strtoul(row[13], nullptr, 10));
|
||||
e.Face = static_cast<uint32_t>(strtoul(row[14], nullptr, 10));
|
||||
e.LuclinHairStyle = static_cast<uint32_t>(strtoul(row[15], nullptr, 10));
|
||||
e.LuclinHairColor = static_cast<uint32_t>(strtoul(row[16], nullptr, 10));
|
||||
e.LuclinEyeColor = static_cast<uint32_t>(strtoul(row[17], nullptr, 10));
|
||||
e.LuclinEyeColor2 = static_cast<uint32_t>(strtoul(row[18], nullptr, 10));
|
||||
e.LuclinBeardColor = static_cast<uint32_t>(strtoul(row[19], nullptr, 10));
|
||||
e.LuclinBeard = static_cast<uint32_t>(strtoul(row[20], nullptr, 10));
|
||||
e.DrakkinHeritage = static_cast<uint32_t>(strtoul(row[21], nullptr, 10));
|
||||
e.DrakkinTattoo = static_cast<uint32_t>(strtoul(row[22], nullptr, 10));
|
||||
e.DrakkinDetails = static_cast<uint32_t>(strtoul(row[23], nullptr, 10));
|
||||
|
||||
all_entries.push_back(e);
|
||||
}
|
||||
|
||||
return all_entries;
|
||||
}
|
||||
|
||||
static std::vector<Mercs> GetWhere(Database& db, const std::string &where_filter)
|
||||
{
|
||||
std::vector<Mercs> 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) {
|
||||
Mercs e{};
|
||||
|
||||
e.MercID = static_cast<uint32_t>(strtoul(row[0], nullptr, 10));
|
||||
e.OwnerCharacterID = static_cast<uint32_t>(strtoul(row[1], nullptr, 10));
|
||||
e.Slot = static_cast<uint8_t>(strtoul(row[2], nullptr, 10));
|
||||
e.Name = row[3] ? row[3] : "";
|
||||
e.TemplateID = static_cast<uint32_t>(strtoul(row[4], nullptr, 10));
|
||||
e.SuspendedTime = static_cast<uint32_t>(strtoul(row[5], nullptr, 10));
|
||||
e.IsSuspended = static_cast<uint8_t>(strtoul(row[6], nullptr, 10));
|
||||
e.TimerRemaining = static_cast<uint32_t>(strtoul(row[7], nullptr, 10));
|
||||
e.Gender = static_cast<uint8_t>(strtoul(row[8], nullptr, 10));
|
||||
e.MercSize = strtof(row[9], nullptr);
|
||||
e.StanceID = static_cast<uint8_t>(strtoul(row[10], nullptr, 10));
|
||||
e.HP = static_cast<uint32_t>(strtoul(row[11], nullptr, 10));
|
||||
e.Mana = static_cast<uint32_t>(strtoul(row[12], nullptr, 10));
|
||||
e.Endurance = static_cast<uint32_t>(strtoul(row[13], nullptr, 10));
|
||||
e.Face = static_cast<uint32_t>(strtoul(row[14], nullptr, 10));
|
||||
e.LuclinHairStyle = static_cast<uint32_t>(strtoul(row[15], nullptr, 10));
|
||||
e.LuclinHairColor = static_cast<uint32_t>(strtoul(row[16], nullptr, 10));
|
||||
e.LuclinEyeColor = static_cast<uint32_t>(strtoul(row[17], nullptr, 10));
|
||||
e.LuclinEyeColor2 = static_cast<uint32_t>(strtoul(row[18], nullptr, 10));
|
||||
e.LuclinBeardColor = static_cast<uint32_t>(strtoul(row[19], nullptr, 10));
|
||||
e.LuclinBeard = static_cast<uint32_t>(strtoul(row[20], nullptr, 10));
|
||||
e.DrakkinHeritage = static_cast<uint32_t>(strtoul(row[21], nullptr, 10));
|
||||
e.DrakkinTattoo = static_cast<uint32_t>(strtoul(row[22], nullptr, 10));
|
||||
e.DrakkinDetails = static_cast<uint32_t>(strtoul(row[23], 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);
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_BASE_MERCS_REPOSITORY_H
|
||||
@@ -1,50 +0,0 @@
|
||||
#ifndef EQEMU_CHATCHANNEL_RESERVED_NAMES_REPOSITORY_H
|
||||
#define EQEMU_CHATCHANNEL_RESERVED_NAMES_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
#include "base/base_chatchannel_reserved_names_repository.h"
|
||||
|
||||
class ChatchannelReservedNamesRepository: public BaseChatchannelReservedNamesRepository {
|
||||
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
|
||||
*
|
||||
* ChatchannelReservedNamesRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* ChatchannelReservedNamesRepository::GetWhereNeverExpires()
|
||||
* ChatchannelReservedNamesRepository::GetWhereXAndY()
|
||||
* ChatchannelReservedNamesRepository::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
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_CHATCHANNEL_RESERVED_NAMES_REPOSITORY_H
|
||||
@@ -1,50 +0,0 @@
|
||||
#ifndef EQEMU_CHATCHANNELS_REPOSITORY_H
|
||||
#define EQEMU_CHATCHANNELS_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
#include "base/base_chatchannels_repository.h"
|
||||
|
||||
class ChatchannelsRepository: public BaseChatchannelsRepository {
|
||||
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
|
||||
*
|
||||
* ChatchannelsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* ChatchannelsRepository::GetWhereNeverExpires()
|
||||
* ChatchannelsRepository::GetWhereXAndY()
|
||||
* ChatchannelsRepository::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
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_CHATCHANNELS_REPOSITORY_H
|
||||
@@ -1,50 +0,0 @@
|
||||
#ifndef EQEMU_MERC_ARMORINFO_REPOSITORY_H
|
||||
#define EQEMU_MERC_ARMORINFO_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
#include "base/base_merc_armorinfo_repository.h"
|
||||
|
||||
class MercArmorinfoRepository: public BaseMercArmorinfoRepository {
|
||||
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
|
||||
*
|
||||
* MercArmorinfoRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* MercArmorinfoRepository::GetWhereNeverExpires()
|
||||
* MercArmorinfoRepository::GetWhereXAndY()
|
||||
* MercArmorinfoRepository::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
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_MERC_ARMORINFO_REPOSITORY_H
|
||||
@@ -1,50 +0,0 @@
|
||||
#ifndef EQEMU_MERC_BUFFS_REPOSITORY_H
|
||||
#define EQEMU_MERC_BUFFS_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
#include "base/base_merc_buffs_repository.h"
|
||||
|
||||
class MercBuffsRepository: public BaseMercBuffsRepository {
|
||||
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
|
||||
*
|
||||
* MercBuffsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* MercBuffsRepository::GetWhereNeverExpires()
|
||||
* MercBuffsRepository::GetWhereXAndY()
|
||||
* MercBuffsRepository::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
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_MERC_BUFFS_REPOSITORY_H
|
||||
@@ -1,50 +0,0 @@
|
||||
#ifndef EQEMU_MERC_INVENTORY_REPOSITORY_H
|
||||
#define EQEMU_MERC_INVENTORY_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
#include "base/base_merc_inventory_repository.h"
|
||||
|
||||
class MercInventoryRepository: public BaseMercInventoryRepository {
|
||||
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
|
||||
*
|
||||
* MercInventoryRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* MercInventoryRepository::GetWhereNeverExpires()
|
||||
* MercInventoryRepository::GetWhereXAndY()
|
||||
* MercInventoryRepository::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
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_MERC_INVENTORY_REPOSITORY_H
|
||||
@@ -1,50 +0,0 @@
|
||||
#ifndef EQEMU_MERC_MERCHANT_ENTRIES_REPOSITORY_H
|
||||
#define EQEMU_MERC_MERCHANT_ENTRIES_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
#include "base/base_merc_merchant_entries_repository.h"
|
||||
|
||||
class MercMerchantEntriesRepository: public BaseMercMerchantEntriesRepository {
|
||||
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
|
||||
*
|
||||
* MercMerchantEntriesRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* MercMerchantEntriesRepository::GetWhereNeverExpires()
|
||||
* MercMerchantEntriesRepository::GetWhereXAndY()
|
||||
* MercMerchantEntriesRepository::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
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_MERC_MERCHANT_ENTRIES_REPOSITORY_H
|
||||
@@ -1,50 +0,0 @@
|
||||
#ifndef EQEMU_MERC_MERCHANT_TEMPLATE_ENTRIES_REPOSITORY_H
|
||||
#define EQEMU_MERC_MERCHANT_TEMPLATE_ENTRIES_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
#include "base/base_merc_merchant_template_entries_repository.h"
|
||||
|
||||
class MercMerchantTemplateEntriesRepository: public BaseMercMerchantTemplateEntriesRepository {
|
||||
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
|
||||
*
|
||||
* MercMerchantTemplateEntriesRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* MercMerchantTemplateEntriesRepository::GetWhereNeverExpires()
|
||||
* MercMerchantTemplateEntriesRepository::GetWhereXAndY()
|
||||
* MercMerchantTemplateEntriesRepository::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
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_MERC_MERCHANT_TEMPLATE_ENTRIES_REPOSITORY_H
|
||||
@@ -1,50 +0,0 @@
|
||||
#ifndef EQEMU_MERC_MERCHANT_TEMPLATES_REPOSITORY_H
|
||||
#define EQEMU_MERC_MERCHANT_TEMPLATES_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
#include "base/base_merc_merchant_templates_repository.h"
|
||||
|
||||
class MercMerchantTemplatesRepository: public BaseMercMerchantTemplatesRepository {
|
||||
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
|
||||
*
|
||||
* MercMerchantTemplatesRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* MercMerchantTemplatesRepository::GetWhereNeverExpires()
|
||||
* MercMerchantTemplatesRepository::GetWhereXAndY()
|
||||
* MercMerchantTemplatesRepository::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
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_MERC_MERCHANT_TEMPLATES_REPOSITORY_H
|
||||
@@ -1,50 +0,0 @@
|
||||
#ifndef EQEMU_MERC_NAME_TYPES_REPOSITORY_H
|
||||
#define EQEMU_MERC_NAME_TYPES_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
#include "base/base_merc_name_types_repository.h"
|
||||
|
||||
class MercNameTypesRepository: public BaseMercNameTypesRepository {
|
||||
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
|
||||
*
|
||||
* MercNameTypesRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* MercNameTypesRepository::GetWhereNeverExpires()
|
||||
* MercNameTypesRepository::GetWhereXAndY()
|
||||
* MercNameTypesRepository::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
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_MERC_NAME_TYPES_REPOSITORY_H
|
||||
@@ -1,50 +0,0 @@
|
||||
#ifndef EQEMU_MERC_NPC_TYPES_REPOSITORY_H
|
||||
#define EQEMU_MERC_NPC_TYPES_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
#include "base/base_merc_npc_types_repository.h"
|
||||
|
||||
class MercNpcTypesRepository: public BaseMercNpcTypesRepository {
|
||||
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
|
||||
*
|
||||
* MercNpcTypesRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* MercNpcTypesRepository::GetWhereNeverExpires()
|
||||
* MercNpcTypesRepository::GetWhereXAndY()
|
||||
* MercNpcTypesRepository::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
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_MERC_NPC_TYPES_REPOSITORY_H
|
||||
@@ -1,50 +0,0 @@
|
||||
#ifndef EQEMU_MERC_SPELL_LIST_ENTRIES_REPOSITORY_H
|
||||
#define EQEMU_MERC_SPELL_LIST_ENTRIES_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
#include "base/base_merc_spell_list_entries_repository.h"
|
||||
|
||||
class MercSpellListEntriesRepository: public BaseMercSpellListEntriesRepository {
|
||||
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
|
||||
*
|
||||
* MercSpellListEntriesRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* MercSpellListEntriesRepository::GetWhereNeverExpires()
|
||||
* MercSpellListEntriesRepository::GetWhereXAndY()
|
||||
* MercSpellListEntriesRepository::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
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_MERC_SPELL_LIST_ENTRIES_REPOSITORY_H
|
||||
@@ -1,50 +0,0 @@
|
||||
#ifndef EQEMU_MERC_SPELL_LISTS_REPOSITORY_H
|
||||
#define EQEMU_MERC_SPELL_LISTS_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
#include "base/base_merc_spell_lists_repository.h"
|
||||
|
||||
class MercSpellListsRepository: public BaseMercSpellListsRepository {
|
||||
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
|
||||
*
|
||||
* MercSpellListsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* MercSpellListsRepository::GetWhereNeverExpires()
|
||||
* MercSpellListsRepository::GetWhereXAndY()
|
||||
* MercSpellListsRepository::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
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_MERC_SPELL_LISTS_REPOSITORY_H
|
||||
@@ -1,50 +0,0 @@
|
||||
#ifndef EQEMU_MERC_STANCE_ENTRIES_REPOSITORY_H
|
||||
#define EQEMU_MERC_STANCE_ENTRIES_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
#include "base/base_merc_stance_entries_repository.h"
|
||||
|
||||
class MercStanceEntriesRepository: public BaseMercStanceEntriesRepository {
|
||||
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
|
||||
*
|
||||
* MercStanceEntriesRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* MercStanceEntriesRepository::GetWhereNeverExpires()
|
||||
* MercStanceEntriesRepository::GetWhereXAndY()
|
||||
* MercStanceEntriesRepository::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
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_MERC_STANCE_ENTRIES_REPOSITORY_H
|
||||
@@ -1,50 +0,0 @@
|
||||
#ifndef EQEMU_MERC_STATS_REPOSITORY_H
|
||||
#define EQEMU_MERC_STATS_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
#include "base/base_merc_stats_repository.h"
|
||||
|
||||
class MercStatsRepository: public BaseMercStatsRepository {
|
||||
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
|
||||
*
|
||||
* MercStatsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* MercStatsRepository::GetWhereNeverExpires()
|
||||
* MercStatsRepository::GetWhereXAndY()
|
||||
* MercStatsRepository::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
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_MERC_STATS_REPOSITORY_H
|
||||
@@ -1,50 +0,0 @@
|
||||
#ifndef EQEMU_MERC_SUBTYPES_REPOSITORY_H
|
||||
#define EQEMU_MERC_SUBTYPES_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
#include "base/base_merc_subtypes_repository.h"
|
||||
|
||||
class MercSubtypesRepository: public BaseMercSubtypesRepository {
|
||||
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
|
||||
*
|
||||
* MercSubtypesRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* MercSubtypesRepository::GetWhereNeverExpires()
|
||||
* MercSubtypesRepository::GetWhereXAndY()
|
||||
* MercSubtypesRepository::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
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_MERC_SUBTYPES_REPOSITORY_H
|
||||
@@ -1,50 +0,0 @@
|
||||
#ifndef EQEMU_MERC_TEMPLATES_REPOSITORY_H
|
||||
#define EQEMU_MERC_TEMPLATES_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
#include "base/base_merc_templates_repository.h"
|
||||
|
||||
class MercTemplatesRepository: public BaseMercTemplatesRepository {
|
||||
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
|
||||
*
|
||||
* MercTemplatesRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* MercTemplatesRepository::GetWhereNeverExpires()
|
||||
* MercTemplatesRepository::GetWhereXAndY()
|
||||
* MercTemplatesRepository::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
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_MERC_TEMPLATES_REPOSITORY_H
|
||||
@@ -1,50 +0,0 @@
|
||||
#ifndef EQEMU_MERC_TYPES_REPOSITORY_H
|
||||
#define EQEMU_MERC_TYPES_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
#include "base/base_merc_types_repository.h"
|
||||
|
||||
class MercTypesRepository: public BaseMercTypesRepository {
|
||||
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
|
||||
*
|
||||
* MercTypesRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* MercTypesRepository::GetWhereNeverExpires()
|
||||
* MercTypesRepository::GetWhereXAndY()
|
||||
* MercTypesRepository::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
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_MERC_TYPES_REPOSITORY_H
|
||||
@@ -1,50 +0,0 @@
|
||||
#ifndef EQEMU_MERC_WEAPONINFO_REPOSITORY_H
|
||||
#define EQEMU_MERC_WEAPONINFO_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
#include "base/base_merc_weaponinfo_repository.h"
|
||||
|
||||
class MercWeaponinfoRepository: public BaseMercWeaponinfoRepository {
|
||||
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
|
||||
*
|
||||
* MercWeaponinfoRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* MercWeaponinfoRepository::GetWhereNeverExpires()
|
||||
* MercWeaponinfoRepository::GetWhereXAndY()
|
||||
* MercWeaponinfoRepository::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
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_MERC_WEAPONINFO_REPOSITORY_H
|
||||
@@ -1,50 +0,0 @@
|
||||
#ifndef EQEMU_MERCS_REPOSITORY_H
|
||||
#define EQEMU_MERCS_REPOSITORY_H
|
||||
|
||||
#include "../database.h"
|
||||
#include "../strings.h"
|
||||
#include "base/base_mercs_repository.h"
|
||||
|
||||
class MercsRepository: public BaseMercsRepository {
|
||||
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
|
||||
*
|
||||
* MercsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
|
||||
* MercsRepository::GetWhereNeverExpires()
|
||||
* MercsRepository::GetWhereXAndY()
|
||||
* MercsRepository::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
|
||||
|
||||
};
|
||||
|
||||
#endif //EQEMU_MERCS_REPOSITORY_H
|
||||
+11
-18
@@ -34,7 +34,7 @@ const char *RuleManager::s_categoryNames[_CatCount + 1] = {
|
||||
"InvalidCategory"
|
||||
};
|
||||
|
||||
const RuleManager::RuleInfo RuleManager::s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount + 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*/
|
||||
#define RULE_INT(category_name, rule_name, default_value, notes) \
|
||||
{ #category_name ":" #rule_name, Category__##category_name, IntRule, Int__##rule_name, notes },
|
||||
@@ -212,14 +212,14 @@ std::string RuleManager::_GetRuleName(RuleType type, uint16 index) {
|
||||
case IntRule:
|
||||
return s_RuleInfo[index].name;
|
||||
case RealRule:
|
||||
return s_RuleInfo[index + IntRuleCount].name;
|
||||
return s_RuleInfo[index + _IntRuleCount].name;
|
||||
case BoolRule:
|
||||
return s_RuleInfo[index + IntRuleCount + RealRuleCount].name;
|
||||
return s_RuleInfo[index + _IntRuleCount + _RealRuleCount].name;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount].name;
|
||||
return s_RuleInfo[_IntRuleCount + _RealRuleCount + _BoolRuleCount].name;
|
||||
}
|
||||
|
||||
//assumes index is valid!
|
||||
@@ -228,14 +228,14 @@ const std::string &RuleManager::_GetRuleNotes(RuleType type, uint16 index) {
|
||||
case IntRule:
|
||||
return s_RuleInfo[index].notes;
|
||||
case RealRule:
|
||||
return s_RuleInfo[index + IntRuleCount].notes;
|
||||
return s_RuleInfo[index + _IntRuleCount].notes;
|
||||
case BoolRule:
|
||||
return s_RuleInfo[index + IntRuleCount + RealRuleCount].notes;
|
||||
return s_RuleInfo[index + _IntRuleCount + _RealRuleCount].notes;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
return s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount].notes;
|
||||
return s_RuleInfo[_IntRuleCount + _RealRuleCount + _BoolRuleCount].notes;
|
||||
}
|
||||
|
||||
bool RuleManager::LoadRules(Database *db, const std::string &rule_set_name, bool reload) {
|
||||
@@ -304,13 +304,6 @@ bool RuleManager::LoadRules(Database *db, const std::string &rule_set_name, bool
|
||||
}
|
||||
}
|
||||
|
||||
LogInfo(
|
||||
"Loaded [{}] rules(s) in rule_set [{}] id [{}]",
|
||||
Strings::Commify(std::to_string(l.size())),
|
||||
rule_set_name,
|
||||
rule_set_id
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -332,15 +325,15 @@ void RuleManager::SaveRules(Database *db, const std::string &rule_set_name) {
|
||||
}
|
||||
|
||||
int i;
|
||||
for (i = 0; i < IntRuleCount; i++) {
|
||||
for (i = 0; i < _IntRuleCount; i++) {
|
||||
_SaveRule(db, IntRule, i);
|
||||
}
|
||||
|
||||
for (i = 0; i < RealRuleCount; i++) {
|
||||
for (i = 0; i < _RealRuleCount; i++) {
|
||||
_SaveRule(db, RealRule, i);
|
||||
}
|
||||
|
||||
for (i = 0; i < BoolRuleCount; i++) {
|
||||
for (i = 0; i < _BoolRuleCount; i++) {
|
||||
_SaveRule(db, BoolRule, i);
|
||||
}
|
||||
}
|
||||
@@ -543,7 +536,7 @@ bool RuleManager::RestoreRuleNotes(Database *db)
|
||||
}
|
||||
}
|
||||
|
||||
return s_RuleInfo[IntRuleCount + RealRuleCount + BoolRuleCount];
|
||||
return s_RuleInfo[_IntRuleCount + _RealRuleCount + _BoolRuleCount];
|
||||
}(e.rule_name);
|
||||
|
||||
if (Strings::Contains(rule.name, e.rule_name)) {
|
||||
|
||||
+11
-17
@@ -57,8 +57,6 @@ public:
|
||||
_IntRuleCount
|
||||
} IntType;
|
||||
|
||||
static const int IntRuleCount = static_cast<int>(_IntRuleCount);
|
||||
|
||||
typedef enum {
|
||||
#define RULE_REAL(category_name, rule_name, default_value, notes) \
|
||||
Real__##rule_name,
|
||||
@@ -68,8 +66,6 @@ public:
|
||||
_RealRuleCount
|
||||
} RealType;
|
||||
|
||||
static const int RealRuleCount = static_cast<int>(_RealRuleCount);
|
||||
|
||||
typedef enum {
|
||||
#define RULE_BOOL(category_name, rule_name, default_value, notes) \
|
||||
Bool__##rule_name,
|
||||
@@ -79,8 +75,6 @@ public:
|
||||
_BoolRuleCount
|
||||
} BoolType;
|
||||
|
||||
static const int BoolRuleCount = static_cast<int>(_BoolRuleCount);
|
||||
|
||||
typedef enum {
|
||||
#define RULE_CATEGORY(category_name) \
|
||||
Category__##category_name,
|
||||
@@ -101,7 +95,7 @@ public:
|
||||
static const BoolType InvalidBool = _BoolRuleCount;
|
||||
static const CategoryType InvalidCategory = _CatCount;
|
||||
|
||||
static const uint32 RulesCount = IntRuleCount + RealRuleCount + BoolRuleCount;
|
||||
static const uint32 _RulesCount = _IntRuleCount + _RealRuleCount + _BoolRuleCount;
|
||||
|
||||
//fetch routines, you should generally use the Rule* macros instead of this
|
||||
int GetIntRule(IntType t) const;
|
||||
@@ -109,13 +103,13 @@ public:
|
||||
bool GetBoolRule(BoolType t) const;
|
||||
|
||||
//management routines
|
||||
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(BoolType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount + RealRuleCount].name; }
|
||||
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(BoolType t) { return s_RuleInfo[static_cast<int>(t) + IntRuleCount + RealRuleCount].notes; }
|
||||
static uint32 CountRules() { return RulesCount; }
|
||||
static std::string GetRuleName(IntType t) { return s_RuleInfo[t].name; }
|
||||
static std::string GetRuleName(RealType t) { return s_RuleInfo[t + _IntRuleCount].name; }
|
||||
static std::string GetRuleName(BoolType t) { return s_RuleInfo[t + _IntRuleCount + _RealRuleCount].name; }
|
||||
static const std::string &GetRuleNotes(IntType t) { return s_RuleInfo[t].notes; }
|
||||
static const std::string &GetRuleNotes(RealType t) { return s_RuleInfo[t + _IntRuleCount].notes; }
|
||||
static const std::string &GetRuleNotes(BoolType t) { return s_RuleInfo[t + _IntRuleCount + _RealRuleCount].notes; }
|
||||
static uint32 CountRules() { return _RulesCount; }
|
||||
static CategoryType FindCategory(const std::string &category_name);
|
||||
bool ListRules(const std::string &category_name, std::vector <std::string> &l);
|
||||
bool ListCategories(std::vector <std::string> &l);
|
||||
@@ -147,9 +141,9 @@ private:
|
||||
int m_activeRuleset;
|
||||
std::string m_activeName;
|
||||
|
||||
int m_RuleIntValues[IntRuleCount];
|
||||
float m_RuleRealValues[RealRuleCount];
|
||||
uint32 m_RuleBoolValues[BoolRuleCount];
|
||||
int m_RuleIntValues[_IntRuleCount];
|
||||
float m_RuleRealValues[_RealRuleCount];
|
||||
uint32 m_RuleBoolValues[_BoolRuleCount];
|
||||
|
||||
typedef enum {
|
||||
IntRule,
|
||||
|
||||
+3
-10
@@ -197,9 +197,6 @@ RULE_BOOL(Character, PetZoneWithOwner, true, "Should Pets Zone with Owner")
|
||||
RULE_BOOL(Character, FullManaOnDeath, true, "On death set mana to full")
|
||||
RULE_BOOL(Character, FullEndurOnDeath, true, "On death set endurance to full")
|
||||
RULE_INT(Character, ExperiencePercentCapPerKill, -1, "Caps the percentage of experience that can be gained per kill. -1 disables the cap; 0 blocks all (non-aa) xp.")
|
||||
RULE_BOOL(Character, EnableGroupEXPModifier, true, "Enable or disable the group experience modifier based on number of players in group, default is true")
|
||||
RULE_REAL(Character, GroupMemberEXPModifier, 0.2, "Sets the group experience modifier per members between 2 and 5, default is 0.2")
|
||||
RULE_REAL(Character, FullGroupEXPModifier, 2.16, "Sets the group experience modifier for a full group, default is 2.16")
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Mercs)
|
||||
@@ -429,7 +426,6 @@ RULE_BOOL(Spells, BuffsFadeOnDeath, true, "Disable to keep buffs from fading on
|
||||
RULE_BOOL(Spells, IllusionsAlwaysPersist, false, "Allows Illusions to persist beyond death and zoning always.")
|
||||
RULE_BOOL(Spells, UseItemCastMessage, false, "Enable to use the \"item begins to glow\" messages when casting from an item.")
|
||||
RULE_BOOL(Spells, TargetsTargetRequiresCombatRange, true, "Disable to remove combat range requirement from Target's Target Spell Target Type")
|
||||
RULE_BOOL(Spells, NPCBuffLevelRestrictions, false, "Impose BuffLevelRestrictions on NPCs if true")
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Combat)
|
||||
@@ -585,8 +581,9 @@ RULE_INT(Range, CriticalDamage, 80, "The packet range in which critical hit mess
|
||||
RULE_INT(Range, MobCloseScanDistance, 600, "Close scan distance")
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
|
||||
#ifdef BOTS
|
||||
RULE_CATEGORY(Bots)
|
||||
RULE_BOOL(Bots, Enabled, false, "Enable of disable bot functionality, default is false")
|
||||
RULE_INT(Bots, BotExpansionSettings, 16383, "Sets the expansion settings for bot use. Defaults to all expansions enabled up to TSS")
|
||||
RULE_BOOL(Bots, AllowCamelCaseNames, false, "Allows the use of 'MyBot' type names")
|
||||
RULE_BOOL(Bots, AllowBotEquipAnyRaceGear, false, "Allows Bots to wear Equipment even if their race is not valid")
|
||||
@@ -615,6 +612,7 @@ RULE_BOOL(Bots, ResurrectionSickness, true, "Use Resurrection Sickness based on
|
||||
RULE_INT(Bots, OldResurrectionSicknessSpell, 757, "757 is Default Old Resurrection Sickness Spell")
|
||||
RULE_INT(Bots, ResurrectionSicknessSpell, 756, "756 is Default Resurrection Sickness Spell")
|
||||
RULE_CATEGORY_END()
|
||||
#endif
|
||||
|
||||
RULE_CATEGORY(Chat)
|
||||
RULE_BOOL(Chat, ServerWideOOC, true, "Enable server wide ooc-chat")
|
||||
@@ -623,7 +621,6 @@ RULE_BOOL(Chat, EnableVoiceMacros, true, "Enable voice macros")
|
||||
RULE_BOOL(Chat, EnableMailKeyIPVerification, true, "Setting whether the authenticity of the client should be verified via its IP address when accessing the InGame mailbox")
|
||||
RULE_BOOL(Chat, EnableAntiSpam, true, "Enable anti-spam system for chat")
|
||||
RULE_BOOL(Chat, SuppressCommandErrors, false, "Do not suppress command errors by default")
|
||||
RULE_INT(Chat, MaxPermanentPlayerChannels, 0, "Maximum number of permanent chat channels a player can make. Default 0.")
|
||||
RULE_INT(Chat, MinStatusToBypassAntiSpam, 100, "Minimum status to bypass the anti-spam system")
|
||||
RULE_INT(Chat, MinimumMessagesPerInterval, 4, "Minimum number of chat messages allowed per interval. The karma value is added to this value")
|
||||
RULE_INT(Chat, MaximumMessagesPerInterval, 12, "Maximum value of chat messages allowed per interval")
|
||||
@@ -766,10 +763,6 @@ RULE_INT(Faction, DubiouslyFactionMinimum, -500, "Minimum faction for dubiously"
|
||||
RULE_INT(Faction, ThreateninglyFactionMinimum, -750, "Minimum faction for threateningly")
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Analytics)
|
||||
RULE_BOOL(Analytics, CrashReporting, true, "Automatic crash reporting analytics for EQEmu Server developers")
|
||||
RULE_CATEGORY_END()
|
||||
|
||||
RULE_CATEGORY(Logging)
|
||||
RULE_BOOL(Logging, PrintFileFunctionAndLine, false, "Ex: [World Server] [net.cpp::main:309] Loading variables...")
|
||||
RULE_BOOL(Logging, WorldGMSayLogging, true, "Relay worldserver logging to zone processes via GM say output")
|
||||
|
||||
@@ -109,7 +109,7 @@ bool ServerEventScheduler::ValidateEventReadyToActivate(
|
||||
|
||||
if (now_time_unix >= start_time_unix && (doesnt_end || now_time_unix < end_time_unix)) {
|
||||
LogSchedulerDetail(
|
||||
"now_time [{}] start_time [{}] doesnt_end [{}] end_time [{}]",
|
||||
"[ValidateEventReadyToActivate] now_time [{}] start_time [{}] doesnt_end [{}] end_time [{}]",
|
||||
now_time_unix,
|
||||
start_time_unix,
|
||||
doesnt_end ? "true" : "false",
|
||||
@@ -131,7 +131,7 @@ ServerEventScheduler *ServerEventScheduler::SetDatabase(Database *db)
|
||||
bool ServerEventScheduler::ValidateDatabaseConnection()
|
||||
{
|
||||
if (!m_database) {
|
||||
LogError("No database connection");
|
||||
LogError("[ServerEventScheduler::LoadScheduledEvents] No database connection");
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -174,7 +174,7 @@ bool ServerEventScheduler::CheckIfEventsChanged()
|
||||
dbe.created_at != e.created_at ||
|
||||
dbe.deleted_at != e.deleted_at
|
||||
) {
|
||||
LogSchedulerDetail("Field change detected");
|
||||
LogSchedulerDetail("[CheckIfEventsChanged] Field change detected");
|
||||
m_events = events;
|
||||
return true;
|
||||
}
|
||||
|
||||
+8
-24
@@ -42,7 +42,6 @@
|
||||
#include "repositories/account_repository.h"
|
||||
#include "repositories/faction_association_repository.h"
|
||||
#include "path_manager.h"
|
||||
#include "repositories/loottable_repository.h"
|
||||
|
||||
namespace ItemField
|
||||
{
|
||||
@@ -943,11 +942,10 @@ bool SharedDatabase::LoadItems(const std::string &prefix) {
|
||||
EQ::IPCMutex mutex("items");
|
||||
mutex.Lock();
|
||||
std::string file_name = fmt::format("{}/{}{}", path.GetSharedMemoryPath(), prefix, std::string("items"));
|
||||
LogInfo("[Shared Memory] Attempting to load file [{}]", file_name);
|
||||
items_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
|
||||
items_hash = std::make_unique<EQ::FixedMemoryHashSet<EQ::ItemData>>(static_cast<uint8*>(items_mmf->Get()), items_mmf->Size());
|
||||
mutex.Unlock();
|
||||
|
||||
LogInfo("Loaded [{}] items via shared memory", Strings::Commify(m_shared_items_count));
|
||||
} catch(std::exception& ex) {
|
||||
LogError("Error Loading Items: {}", ex.what());
|
||||
return false;
|
||||
@@ -1440,12 +1438,10 @@ bool SharedDatabase::LoadNPCFactionLists(const std::string &prefix) {
|
||||
EQ::IPCMutex mutex("faction");
|
||||
mutex.Lock();
|
||||
std::string file_name = fmt::format("{}/{}{}", path.GetSharedMemoryPath(), prefix, std::string("faction"));
|
||||
LogInfo("Loading [{}]", file_name);
|
||||
LogInfo("[Shared Memory] Attempting to load file [{}]", file_name);
|
||||
faction_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
|
||||
faction_hash = std::make_unique<EQ::FixedMemoryHashSet<NPCFactionList>>(static_cast<uint8*>(faction_mmf->Get()), faction_mmf->Size());
|
||||
mutex.Unlock();
|
||||
|
||||
LogInfo("Loaded faction lists via shared memory");
|
||||
} catch(std::exception& ex) {
|
||||
LogError("Error Loading npc factions: {}", ex.what());
|
||||
return false;
|
||||
@@ -1520,8 +1516,6 @@ bool SharedDatabase::LoadFactionAssociation(const std::string &prefix)
|
||||
new EQ::FixedMemoryHashSet<FactionAssociations>(reinterpret_cast<uint8 *>(faction_associations_mmf->Get()),
|
||||
faction_associations_mmf->Size()));
|
||||
mutex.Unlock();
|
||||
|
||||
LogInfo("Loaded faction associations via shared memory");
|
||||
} catch (std::exception &ex) {
|
||||
LogError("Error Loading faction associations: {}", ex.what());
|
||||
return false;
|
||||
@@ -1730,11 +1724,8 @@ bool SharedDatabase::LoadSkillCaps(const std::string &prefix) {
|
||||
EQ::IPCMutex mutex("skill_caps");
|
||||
mutex.Lock();
|
||||
std::string file_name = fmt::format("{}/{}{}", path.GetSharedMemoryPath(), prefix, std::string("skill_caps"));
|
||||
LogInfo("Loading [{}]", file_name);
|
||||
LogInfo("[Shared Memory] Attempting to load file [{}]", 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());
|
||||
@@ -1893,12 +1884,10 @@ bool SharedDatabase::LoadSpells(const std::string &prefix, int32 *records, const
|
||||
|
||||
std::string file_name = fmt::format("{}/{}{}", path.GetSharedMemoryPath(), prefix, std::string("spells"));
|
||||
spells_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
|
||||
LogInfo("Loading [{}]", file_name);
|
||||
LogInfo("[Shared Memory] Attempting to load file [{}]", file_name);
|
||||
*records = *static_cast<uint32*>(spells_mmf->Get());
|
||||
*sp = reinterpret_cast<const SPDat_Spell_Struct*>(static_cast<char*>(spells_mmf->Get()) + 4);
|
||||
mutex.Unlock();
|
||||
|
||||
LogInfo("Loaded [{}] spells via shared memory", Strings::Commify(m_shared_spells_count));
|
||||
}
|
||||
catch(std::exception& ex) {
|
||||
LogError("Error Loading Spells: {}", ex.what());
|
||||
@@ -1919,7 +1908,7 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) {
|
||||
}
|
||||
|
||||
if(results.ColumnCount() <= SPELL_LOAD_FIELD_COUNT) {
|
||||
LogSpells("Fatal error loading spells: Spell field count < SPELL_LOAD_FIELD_COUNT([{}])", SPELL_LOAD_FIELD_COUNT);
|
||||
LogSpells("[SharedDatabase::LoadSpells] Fatal error loading spells: Spell field count < SPELL_LOAD_FIELD_COUNT([{}])", SPELL_LOAD_FIELD_COUNT);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1928,9 +1917,9 @@ void SharedDatabase::LoadSpells(void *data, int max_spells) {
|
||||
for (auto& row = results.begin(); row != results.end(); ++row) {
|
||||
const int tempid = atoi(row[0]);
|
||||
if(tempid >= max_spells) {
|
||||
LogSpells("Non fatal error: spell.id >= max_spells, ignoring");
|
||||
continue;
|
||||
}
|
||||
LogSpells("[SharedDatabase::LoadSpells] Non fatal error: spell.id >= max_spells, ignoring");
|
||||
continue;
|
||||
}
|
||||
|
||||
++counter;
|
||||
sp[tempid].id = tempid;
|
||||
@@ -2110,8 +2099,6 @@ bool SharedDatabase::LoadBaseData(const std::string &prefix) {
|
||||
std::string file_name = fmt::format("{}/{}{}", path.GetSharedMemoryPath(), prefix, std::string("base_data"));
|
||||
base_data_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name);
|
||||
mutex.Unlock();
|
||||
|
||||
LogInfo("Loaded base data via shared memory");
|
||||
} catch(std::exception& ex) {
|
||||
LogError("Error Loading Base Data: {}", ex.what());
|
||||
return false;
|
||||
@@ -2436,9 +2423,6 @@ bool SharedDatabase::LoadLoot(const std::string &prefix) {
|
||||
loot_table_hash = std::make_unique<EQ::FixedMemoryVariableHashSet<LootTable_Struct>>(
|
||||
static_cast<uint8*>(loot_table_mmf->Get()),
|
||||
loot_table_mmf->Size());
|
||||
|
||||
LogInfo("Loaded loot tables via shared memory");
|
||||
|
||||
std::string file_name_ld = fmt::format("{}/{}{}", path.GetSharedMemoryPath(), prefix, std::string("loot_drop"));
|
||||
loot_drop_mmf = std::make_unique<EQ::MemoryMappedFile>(file_name_ld);
|
||||
loot_drop_hash = std::make_unique<EQ::FixedMemoryVariableHashSet<LootDrop_Struct>>(
|
||||
|
||||
@@ -95,12 +95,6 @@ public:
|
||||
static std::string &RTrim(std::string &str, const std::string &chars = "\t\n\v\f\r ");
|
||||
static std::string &Trim(std::string &str, const std::string &chars = "\t\n\v\f\r ");
|
||||
static std::string Commify(const std::string &number);
|
||||
static std::string Commify(uint16 number) { return Strings::Commify(std::to_string(number)); };
|
||||
static std::string Commify(uint32 number) { return Strings::Commify(std::to_string(number)); };
|
||||
static std::string Commify(uint64 number) { return Strings::Commify(std::to_string(number)); };
|
||||
static std::string Commify(int16 number) { return Strings::Commify(std::to_string(number)); };
|
||||
static std::string Commify(int32 number) { return Strings::Commify(std::to_string(number)); };
|
||||
static std::string Commify(int64 number) { return Strings::Commify(std::to_string(number)); };
|
||||
static std::string ConvertToDigit(int n, std::string suffix);
|
||||
static std::string Escape(const std::string &s);
|
||||
static std::string GetBetween(const std::string &s, std::string start_delim, std::string stop_delim);
|
||||
|
||||
@@ -1,502 +0,0 @@
|
||||
#ifndef RANG_DOT_HPP
|
||||
#define RANG_DOT_HPP
|
||||
|
||||
#if defined(__unix__) || defined(__unix) || defined(__linux__)
|
||||
#define OS_LINUX
|
||||
#elif defined(WIN32) || defined(_WIN32) || defined(_WIN64)
|
||||
#define OS_WIN
|
||||
#elif defined(__APPLE__) || defined(__MACH__)
|
||||
#define OS_MAC
|
||||
#else
|
||||
#error Unknown Platform
|
||||
#endif
|
||||
|
||||
#if defined(OS_LINUX) || defined(OS_MAC)
|
||||
#include <unistd.h>
|
||||
|
||||
#elif defined(OS_WIN)
|
||||
|
||||
#if defined(_WIN32_WINNT) && (_WIN32_WINNT < 0x0600)
|
||||
#error \
|
||||
"Please include rang.hpp before any windows system headers or set _WIN32_WINNT at least to _WIN32_WINNT_VISTA"
|
||||
#elif !defined(_WIN32_WINNT)
|
||||
#define _WIN32_WINNT _WIN32_WINNT_VISTA
|
||||
#endif
|
||||
|
||||
#include <windows.h>
|
||||
#include <io.h>
|
||||
#include <memory>
|
||||
|
||||
// Only defined in windows 10 onwards, redefining in lower windows since it
|
||||
// doesn't gets used in lower versions
|
||||
// https://docs.microsoft.com/en-us/windows/console/getconsolemode
|
||||
#ifndef ENABLE_VIRTUAL_TERMINAL_PROCESSING
|
||||
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#include <algorithm>
|
||||
#include <atomic>
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
#include <iostream>
|
||||
|
||||
namespace rang {
|
||||
|
||||
/* For better compability with most of terminals do not use any style settings
|
||||
* except of reset, bold and reversed.
|
||||
* Note that on Windows terminals bold style is same as fgB color.
|
||||
*/
|
||||
enum class style {
|
||||
reset = 0,
|
||||
bold = 1,
|
||||
dim = 2,
|
||||
italic = 3,
|
||||
underline = 4,
|
||||
blink = 5,
|
||||
rblink = 6,
|
||||
reversed = 7,
|
||||
conceal = 8,
|
||||
crossed = 9
|
||||
};
|
||||
|
||||
enum class fg {
|
||||
black = 30,
|
||||
red = 31,
|
||||
green = 32,
|
||||
yellow = 33,
|
||||
blue = 34,
|
||||
magenta = 35,
|
||||
cyan = 36,
|
||||
gray = 37,
|
||||
reset = 39
|
||||
};
|
||||
|
||||
enum class bg {
|
||||
black = 40,
|
||||
red = 41,
|
||||
green = 42,
|
||||
yellow = 43,
|
||||
blue = 44,
|
||||
magenta = 45,
|
||||
cyan = 46,
|
||||
gray = 47,
|
||||
reset = 49
|
||||
};
|
||||
|
||||
enum class fgB {
|
||||
black = 90,
|
||||
red = 91,
|
||||
green = 92,
|
||||
yellow = 93,
|
||||
blue = 94,
|
||||
magenta = 95,
|
||||
cyan = 96,
|
||||
gray = 97
|
||||
};
|
||||
|
||||
enum class bgB {
|
||||
black = 100,
|
||||
red = 101,
|
||||
green = 102,
|
||||
yellow = 103,
|
||||
blue = 104,
|
||||
magenta = 105,
|
||||
cyan = 106,
|
||||
gray = 107
|
||||
};
|
||||
|
||||
enum class control { // Behaviour of rang function calls
|
||||
Off = 0, // toggle off rang style/color calls
|
||||
Auto = 1, // (Default) autodect terminal and colorize if needed
|
||||
Force = 2 // force ansi color output to non terminal streams
|
||||
};
|
||||
// Use rang::setControlMode to set rang control mode
|
||||
|
||||
enum class winTerm { // Windows Terminal Mode
|
||||
Auto = 0, // (Default) automatically detects wheter Ansi or Native API
|
||||
Ansi = 1, // Force use Ansi API
|
||||
Native = 2 // Force use Native API
|
||||
};
|
||||
// Use rang::setWinTermMode to explicitly set terminal API for Windows
|
||||
// Calling rang::setWinTermMode have no effect on other OS
|
||||
|
||||
namespace rang_implementation {
|
||||
|
||||
inline std::atomic<control> &controlMode() noexcept
|
||||
{
|
||||
static std::atomic<control> value(control::Auto);
|
||||
return value;
|
||||
}
|
||||
|
||||
inline std::atomic<winTerm> &winTermMode() noexcept
|
||||
{
|
||||
static std::atomic<winTerm> termMode(winTerm::Auto);
|
||||
return termMode;
|
||||
}
|
||||
|
||||
inline bool supportsColor() noexcept
|
||||
{
|
||||
#if defined(OS_LINUX) || defined(OS_MAC)
|
||||
|
||||
static const bool result = [] {
|
||||
const char *Terms[]
|
||||
= { "ansi", "color", "console", "cygwin", "gnome",
|
||||
"konsole", "kterm", "linux", "msys", "putty",
|
||||
"rxvt", "screen", "vt100", "xterm" };
|
||||
|
||||
const char *env_p = std::getenv("TERM");
|
||||
if (env_p == nullptr) {
|
||||
return false;
|
||||
}
|
||||
return std::any_of(std::begin(Terms), std::end(Terms),
|
||||
[&](const char *term) {
|
||||
return std::strstr(env_p, term) != nullptr;
|
||||
});
|
||||
}();
|
||||
|
||||
#elif defined(OS_WIN)
|
||||
// All windows versions support colors through native console methods
|
||||
static constexpr bool result = true;
|
||||
#endif
|
||||
return result;
|
||||
}
|
||||
|
||||
#ifdef OS_WIN
|
||||
|
||||
|
||||
inline bool isMsysPty(int fd) noexcept
|
||||
{
|
||||
// Dynamic load for binary compability with old Windows
|
||||
const auto ptrGetFileInformationByHandleEx
|
||||
= reinterpret_cast<decltype(&GetFileInformationByHandleEx)>(
|
||||
GetProcAddress(GetModuleHandle(TEXT("kernel32.dll")),
|
||||
"GetFileInformationByHandleEx"));
|
||||
if (!ptrGetFileInformationByHandleEx) {
|
||||
return false;
|
||||
}
|
||||
|
||||
HANDLE h = reinterpret_cast<HANDLE>(_get_osfhandle(fd));
|
||||
if (h == INVALID_HANDLE_VALUE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check that it's a pipe:
|
||||
if (GetFileType(h) != FILE_TYPE_PIPE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// POD type is binary compatible with FILE_NAME_INFO from WinBase.h
|
||||
// It have the same alignment and used to avoid UB in caller code
|
||||
struct MY_FILE_NAME_INFO {
|
||||
DWORD FileNameLength;
|
||||
WCHAR FileName[MAX_PATH];
|
||||
};
|
||||
|
||||
auto pNameInfo = std::unique_ptr<MY_FILE_NAME_INFO>(
|
||||
new (std::nothrow) MY_FILE_NAME_INFO());
|
||||
if (!pNameInfo) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check pipe name is template of
|
||||
// {"cygwin-","msys-"}XXXXXXXXXXXXXXX-ptyX-XX
|
||||
if (!ptrGetFileInformationByHandleEx(h, FileNameInfo, pNameInfo.get(),
|
||||
sizeof(MY_FILE_NAME_INFO))) {
|
||||
return false;
|
||||
}
|
||||
std::wstring name(pNameInfo->FileName, pNameInfo->FileNameLength / sizeof(WCHAR));
|
||||
if ((name.find(L"msys-") == std::wstring::npos
|
||||
&& name.find(L"cygwin-") == std::wstring::npos)
|
||||
|| name.find(L"-pty") == std::wstring::npos) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
inline bool isTerminal(const std::streambuf *osbuf) noexcept
|
||||
{
|
||||
using std::cerr;
|
||||
using std::clog;
|
||||
using std::cout;
|
||||
#if defined(OS_LINUX) || defined(OS_MAC)
|
||||
if (osbuf == cout.rdbuf()) {
|
||||
static const bool cout_term = isatty(fileno(stdout)) != 0;
|
||||
return cout_term;
|
||||
} else if (osbuf == cerr.rdbuf() || osbuf == clog.rdbuf()) {
|
||||
static const bool cerr_term = isatty(fileno(stderr)) != 0;
|
||||
return cerr_term;
|
||||
}
|
||||
#elif defined(OS_WIN)
|
||||
if (osbuf == cout.rdbuf()) {
|
||||
static const bool cout_term
|
||||
= (_isatty(_fileno(stdout)) || isMsysPty(_fileno(stdout)));
|
||||
return cout_term;
|
||||
} else if (osbuf == cerr.rdbuf() || osbuf == clog.rdbuf()) {
|
||||
static const bool cerr_term
|
||||
= (_isatty(_fileno(stderr)) || isMsysPty(_fileno(stderr)));
|
||||
return cerr_term;
|
||||
}
|
||||
#endif
|
||||
return false;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
using enableStd = typename std::enable_if<
|
||||
std::is_same<T, rang::style>::value || std::is_same<T, rang::fg>::value
|
||||
|| std::is_same<T, rang::bg>::value || std::is_same<T, rang::fgB>::value
|
||||
|| std::is_same<T, rang::bgB>::value,
|
||||
std::ostream &>::type;
|
||||
|
||||
|
||||
#ifdef OS_WIN
|
||||
|
||||
struct SGR { // Select Graphic Rendition parameters for Windows console
|
||||
BYTE fgColor; // foreground color (0-15) lower 3 rgb bits + intense bit
|
||||
BYTE bgColor; // background color (0-15) lower 3 rgb bits + intense bit
|
||||
BYTE bold; // emulated as FOREGROUND_INTENSITY bit
|
||||
BYTE underline; // emulated as BACKGROUND_INTENSITY bit
|
||||
BOOLEAN inverse; // swap foreground/bold & background/underline
|
||||
BOOLEAN conceal; // set foreground/bold to background/underline
|
||||
};
|
||||
|
||||
enum class AttrColor : BYTE { // Color attributes for console screen buffer
|
||||
black = 0,
|
||||
red = 4,
|
||||
green = 2,
|
||||
yellow = 6,
|
||||
blue = 1,
|
||||
magenta = 5,
|
||||
cyan = 3,
|
||||
gray = 7
|
||||
};
|
||||
|
||||
inline HANDLE getConsoleHandle(const std::streambuf *osbuf) noexcept
|
||||
{
|
||||
if (osbuf == std::cout.rdbuf()) {
|
||||
static const HANDLE hStdout = GetStdHandle(STD_OUTPUT_HANDLE);
|
||||
return hStdout;
|
||||
} else if (osbuf == std::cerr.rdbuf() || osbuf == std::clog.rdbuf()) {
|
||||
static const HANDLE hStderr = GetStdHandle(STD_ERROR_HANDLE);
|
||||
return hStderr;
|
||||
}
|
||||
return INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
inline bool setWinTermAnsiColors(const std::streambuf *osbuf) noexcept
|
||||
{
|
||||
HANDLE h = getConsoleHandle(osbuf);
|
||||
if (h == INVALID_HANDLE_VALUE) {
|
||||
return false;
|
||||
}
|
||||
DWORD dwMode = 0;
|
||||
if (!GetConsoleMode(h, &dwMode)) {
|
||||
return false;
|
||||
}
|
||||
dwMode |= ENABLE_VIRTUAL_TERMINAL_PROCESSING;
|
||||
if (!SetConsoleMode(h, dwMode)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool supportsAnsi(const std::streambuf *osbuf) noexcept
|
||||
{
|
||||
using std::cerr;
|
||||
using std::clog;
|
||||
using std::cout;
|
||||
if (osbuf == cout.rdbuf()) {
|
||||
static const bool cout_ansi
|
||||
= (isMsysPty(_fileno(stdout)) || setWinTermAnsiColors(osbuf));
|
||||
return cout_ansi;
|
||||
} else if (osbuf == cerr.rdbuf() || osbuf == clog.rdbuf()) {
|
||||
static const bool cerr_ansi
|
||||
= (isMsysPty(_fileno(stderr)) || setWinTermAnsiColors(osbuf));
|
||||
return cerr_ansi;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
inline const SGR &defaultState() noexcept
|
||||
{
|
||||
static const SGR defaultSgr = []() -> SGR {
|
||||
CONSOLE_SCREEN_BUFFER_INFO info;
|
||||
WORD attrib = FOREGROUND_RED | FOREGROUND_GREEN | FOREGROUND_BLUE;
|
||||
if (GetConsoleScreenBufferInfo(GetStdHandle(STD_OUTPUT_HANDLE),
|
||||
&info)
|
||||
|| GetConsoleScreenBufferInfo(GetStdHandle(STD_ERROR_HANDLE),
|
||||
&info)) {
|
||||
attrib = info.wAttributes;
|
||||
}
|
||||
SGR sgr = { 0, 0, 0, 0, FALSE, FALSE };
|
||||
sgr.fgColor = attrib & 0x0F;
|
||||
sgr.bgColor = (attrib & 0xF0) >> 4;
|
||||
return sgr;
|
||||
}();
|
||||
return defaultSgr;
|
||||
}
|
||||
|
||||
inline BYTE ansi2attr(BYTE rgb) noexcept
|
||||
{
|
||||
static const AttrColor rev[8]
|
||||
= { AttrColor::black, AttrColor::red, AttrColor::green,
|
||||
AttrColor::yellow, AttrColor::blue, AttrColor::magenta,
|
||||
AttrColor::cyan, AttrColor::gray };
|
||||
return static_cast<BYTE>(rev[rgb]);
|
||||
}
|
||||
|
||||
inline void setWinSGR(rang::bg col, SGR &state) noexcept
|
||||
{
|
||||
if (col != rang::bg::reset) {
|
||||
state.bgColor = ansi2attr(static_cast<BYTE>(col) - 40);
|
||||
} else {
|
||||
state.bgColor = defaultState().bgColor;
|
||||
}
|
||||
}
|
||||
|
||||
inline void setWinSGR(rang::fg col, SGR &state) noexcept
|
||||
{
|
||||
if (col != rang::fg::reset) {
|
||||
state.fgColor = ansi2attr(static_cast<BYTE>(col) - 30);
|
||||
} else {
|
||||
state.fgColor = defaultState().fgColor;
|
||||
}
|
||||
}
|
||||
|
||||
inline void setWinSGR(rang::bgB col, SGR &state) noexcept
|
||||
{
|
||||
state.bgColor = (BACKGROUND_INTENSITY >> 4)
|
||||
| ansi2attr(static_cast<BYTE>(col) - 100);
|
||||
}
|
||||
|
||||
inline void setWinSGR(rang::fgB col, SGR &state) noexcept
|
||||
{
|
||||
state.fgColor
|
||||
= FOREGROUND_INTENSITY | ansi2attr(static_cast<BYTE>(col) - 90);
|
||||
}
|
||||
|
||||
inline void setWinSGR(rang::style style, SGR &state) noexcept
|
||||
{
|
||||
switch (style) {
|
||||
case rang::style::reset: state = defaultState(); break;
|
||||
case rang::style::bold: state.bold = FOREGROUND_INTENSITY; break;
|
||||
case rang::style::underline:
|
||||
case rang::style::blink:
|
||||
state.underline = BACKGROUND_INTENSITY;
|
||||
break;
|
||||
case rang::style::reversed: state.inverse = TRUE; break;
|
||||
case rang::style::conceal: state.conceal = TRUE; break;
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
inline SGR ¤t_state() noexcept
|
||||
{
|
||||
static SGR state = defaultState();
|
||||
return state;
|
||||
}
|
||||
|
||||
inline WORD SGR2Attr(const SGR &state) noexcept
|
||||
{
|
||||
WORD attrib = 0;
|
||||
if (state.conceal) {
|
||||
if (state.inverse) {
|
||||
attrib = (state.fgColor << 4) | state.fgColor;
|
||||
if (state.bold)
|
||||
attrib |= FOREGROUND_INTENSITY | BACKGROUND_INTENSITY;
|
||||
} else {
|
||||
attrib = (state.bgColor << 4) | state.bgColor;
|
||||
if (state.underline)
|
||||
attrib |= FOREGROUND_INTENSITY | BACKGROUND_INTENSITY;
|
||||
}
|
||||
} else if (state.inverse) {
|
||||
attrib = (state.fgColor << 4) | state.bgColor;
|
||||
if (state.bold) attrib |= BACKGROUND_INTENSITY;
|
||||
if (state.underline) attrib |= FOREGROUND_INTENSITY;
|
||||
} else {
|
||||
attrib = state.fgColor | (state.bgColor << 4) | state.bold
|
||||
| state.underline;
|
||||
}
|
||||
return attrib;
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline void setWinColorAnsi(std::ostream &os, T const value)
|
||||
{
|
||||
os << "\033[" << static_cast<int>(value) << "m";
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline void setWinColorNative(std::ostream &os, T const value)
|
||||
{
|
||||
const HANDLE h = getConsoleHandle(os.rdbuf());
|
||||
if (h != INVALID_HANDLE_VALUE) {
|
||||
setWinSGR(value, current_state());
|
||||
// Out all buffered text to console with previous settings:
|
||||
os.flush();
|
||||
SetConsoleTextAttribute(h, SGR2Attr(current_state()));
|
||||
}
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
inline enableStd<T> setColor(std::ostream &os, T const value)
|
||||
{
|
||||
if (winTermMode() == winTerm::Auto) {
|
||||
if (supportsAnsi(os.rdbuf())) {
|
||||
setWinColorAnsi(os, value);
|
||||
} else {
|
||||
setWinColorNative(os, value);
|
||||
}
|
||||
} else if (winTermMode() == winTerm::Ansi) {
|
||||
setWinColorAnsi(os, value);
|
||||
} else {
|
||||
setWinColorNative(os, value);
|
||||
}
|
||||
return os;
|
||||
}
|
||||
#else
|
||||
template <typename T>
|
||||
inline enableStd<T> setColor(std::ostream &os, T const value)
|
||||
{
|
||||
return os << "\033[" << static_cast<int>(value) << "m";
|
||||
}
|
||||
#endif
|
||||
} // namespace rang_implementation
|
||||
|
||||
template <typename T>
|
||||
inline rang_implementation::enableStd<T> operator<<(std::ostream &os,
|
||||
const T value)
|
||||
{
|
||||
const control option = rang_implementation::controlMode();
|
||||
switch (option) {
|
||||
case control::Auto:
|
||||
return rang_implementation::supportsColor()
|
||||
&& rang_implementation::isTerminal(os.rdbuf())
|
||||
? rang_implementation::setColor(os, value)
|
||||
: os;
|
||||
case control::Force: return rang_implementation::setColor(os, value);
|
||||
default: return os;
|
||||
}
|
||||
}
|
||||
|
||||
inline void setWinTermMode(const rang::winTerm value) noexcept
|
||||
{
|
||||
rang_implementation::winTermMode() = value;
|
||||
}
|
||||
|
||||
inline void setControlMode(const control value) noexcept
|
||||
{
|
||||
rang_implementation::controlMode() = value;
|
||||
}
|
||||
|
||||
} // namespace rang
|
||||
|
||||
#undef OS_LINUX
|
||||
#undef OS_WIN
|
||||
#undef OS_MAC
|
||||
|
||||
#endif /* ifndef RANG_DOT_HPP */
|
||||
+20
-15
@@ -18,22 +18,14 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef EQEMU_VERSION_H
|
||||
#define EQEMU_VERSION_H
|
||||
#ifndef _EQEMU_VERSION_H
|
||||
#define _EQEMU_VERSION_H
|
||||
|
||||
#define LOGIN_VERSION "0.8.0"
|
||||
#define EQEMU_PROTOCOL_VERSION "0.3.10"
|
||||
|
||||
// Build variables
|
||||
// these get injected during the build pipeline
|
||||
#define CURRENT_VERSION "22.1.0-dev" // always append -dev to the current version for custom-builds
|
||||
#define LOGIN_VERSION "0.8.0"
|
||||
#define COMPILE_DATE __DATE__
|
||||
#define COMPILE_TIME __TIME__
|
||||
#ifndef WIN32
|
||||
#define LAST_MODIFIED __TIME__
|
||||
#else
|
||||
#define LAST_MODIFIED __TIMESTAMP__
|
||||
#endif
|
||||
#define CURRENT_VERSION "2.0"
|
||||
|
||||
|
||||
/**
|
||||
* Every time a Database SQL is added to Github increment CURRENT_BINARY_DATABASE_VERSION
|
||||
@@ -42,8 +34,21 @@
|
||||
* Manifest: https://github.com/EQEmu/Server/blob/master/utils/sql/db_update_manifest.txt
|
||||
*/
|
||||
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9217
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9037
|
||||
#define CURRENT_BINARY_DATABASE_VERSION 9215
|
||||
|
||||
#ifdef BOTS
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 9035
|
||||
#else
|
||||
#define CURRENT_BINARY_BOTS_DATABASE_VERSION 0 // must be 0
|
||||
#endif
|
||||
|
||||
#define COMPILE_DATE __DATE__
|
||||
#define COMPILE_TIME __TIME__
|
||||
#ifndef WIN32
|
||||
#define LAST_MODIFIED __TIME__
|
||||
#else
|
||||
#define LAST_MODIFIED __TIMESTAMP__
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ void ZoneStore::LoadZones(Database &db)
|
||||
{
|
||||
m_zones = ZoneRepository::All(db);
|
||||
|
||||
LogInfo("Loaded [{}] zones", m_zones.size());
|
||||
LogInfo("[ZoneStore] Loaded [{}] zones", m_zones.size());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -60,7 +60,7 @@ uint32 ZoneStore::GetZoneID(std::string zone_name)
|
||||
}
|
||||
}
|
||||
|
||||
LogInfo("Failed to get zone_name [{}]", zone_name);
|
||||
LogInfo("[GetZoneID] Failed to get zone_name [{}]", zone_name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -117,7 +117,7 @@ std::string ZoneStore::GetZoneName(uint32 zone_id)
|
||||
}
|
||||
}
|
||||
|
||||
LogInfo("Failed to get zone long name by zone_id [{}]", zone_id);
|
||||
LogInfo("[GetZoneName] Failed to get zone long name by zone_id [{}]", zone_id);
|
||||
|
||||
return {};
|
||||
}
|
||||
@@ -134,7 +134,7 @@ std::string ZoneStore::GetZoneLongName(uint32 zone_id)
|
||||
}
|
||||
}
|
||||
|
||||
LogInfo("Failed to get zone long name by zone_id [{}]", zone_id);
|
||||
LogInfo("[GetZoneLongName] Failed to get zone long name by zone_id [{}]", zone_id);
|
||||
|
||||
return {};
|
||||
}
|
||||
@@ -152,7 +152,7 @@ ZoneRepository::Zone *ZoneStore::GetZone(uint32 zone_id, int version)
|
||||
}
|
||||
}
|
||||
|
||||
LogInfo("Failed to get zone by zone_id [{}] version [{}]", zone_id, version);
|
||||
LogInfo("[GetZone] Failed to get zone by zone_id [{}] version [{}]", zone_id, version);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
@@ -169,7 +169,7 @@ ZoneRepository::Zone *ZoneStore::GetZone(const char *in_zone_name)
|
||||
}
|
||||
}
|
||||
|
||||
LogInfo("Failed to get zone by zone_name [{}]", in_zone_name);
|
||||
LogInfo("[GetZone] Failed to get zone by zone_name [{}]", in_zone_name);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
@@ -206,7 +206,7 @@ ZoneRepository::Zone *ZoneStore::GetZoneWithFallback(uint32 zone_id, int version
|
||||
}
|
||||
}
|
||||
|
||||
LogInfo("Failed to get zone by zone_id [{}] version [{}]", zone_id, version);
|
||||
LogInfo("[GetZoneWithFallback] Failed to get zone by zone_id [{}] version [{}]", zone_id, version);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ uint32 AccountManagement::CheckLoginserverUserCredentials(
|
||||
|
||||
if (!login_server_admin.loaded) {
|
||||
LogError(
|
||||
"account [{0}] source_loginserver [{1}] not found!",
|
||||
"CheckLoginUserCredentials account [{0}] source_loginserver [{1}] not found!",
|
||||
in_account_username,
|
||||
source_loginserver
|
||||
);
|
||||
@@ -167,7 +167,7 @@ uint32 AccountManagement::CheckLoginserverUserCredentials(
|
||||
|
||||
if (!validated_credentials) {
|
||||
LogError(
|
||||
"account [{0}] source_loginserver [{1}] invalid credentials!",
|
||||
"CheckLoginUserCredentials account [{0}] source_loginserver [{1}] invalid credentials!",
|
||||
in_account_username,
|
||||
source_loginserver
|
||||
);
|
||||
@@ -176,7 +176,7 @@ uint32 AccountManagement::CheckLoginserverUserCredentials(
|
||||
}
|
||||
|
||||
LogInfo(
|
||||
"account [{0}] source_loginserver [{1}] credentials validated success!",
|
||||
"CheckLoginUserCredentials account [{0}] source_loginserver [{1}] credentials validated success!",
|
||||
in_account_username,
|
||||
source_loginserver
|
||||
);
|
||||
@@ -206,7 +206,7 @@ bool AccountManagement::UpdateLoginserverUserCredentials(
|
||||
|
||||
if (!login_server_account.loaded) {
|
||||
LogError(
|
||||
"account [{0}] source_loginserver [{1}] not found!",
|
||||
"ChangeLoginserverUserCredentials account [{0}] source_loginserver [{1}] not found!",
|
||||
in_account_username,
|
||||
source_loginserver
|
||||
);
|
||||
@@ -225,7 +225,7 @@ bool AccountManagement::UpdateLoginserverUserCredentials(
|
||||
);
|
||||
|
||||
LogInfo(
|
||||
"account [{0}] source_loginserver [{1}] credentials updated!",
|
||||
"ChangeLoginserverUserCredentials account [{0}] source_loginserver [{1}] credentials updated!",
|
||||
in_account_username,
|
||||
source_loginserver
|
||||
);
|
||||
@@ -401,7 +401,7 @@ uint32 AccountManagement::CheckExternalLoginserverUserCredentials(
|
||||
while (running) {
|
||||
std::chrono::steady_clock::time_point end = std::chrono::steady_clock::now();
|
||||
if (std::chrono::duration_cast<std::chrono::milliseconds>(end - begin).count() > REQUEST_TIMEOUT_MS) {
|
||||
LogInfo("Deadline exceeded [{}]", REQUEST_TIMEOUT_MS);
|
||||
LogInfo("[CheckExternalLoginserverUserCredentials] Deadline exceeded [{}]", REQUEST_TIMEOUT_MS);
|
||||
running = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -223,7 +223,7 @@ void Client::Handle_Login(const char *data, unsigned int size)
|
||||
if (server.db->GetLoginDataFromAccountInfo(user, db_loginserver, db_account_password_hash, db_account_id)) {
|
||||
result = VerifyLoginHash(user, db_loginserver, cred, db_account_password_hash);
|
||||
|
||||
LogDebug("Success [{0}]", (result ? "true" : "false"));
|
||||
LogDebug("[VerifyLoginHash] Success [{0}]", (result ? "true" : "false"));
|
||||
}
|
||||
else {
|
||||
m_client_status = cs_creating_account;
|
||||
@@ -332,7 +332,7 @@ void Client::AttemptLoginAccountCreation(
|
||||
const std::string &loginserver
|
||||
)
|
||||
{
|
||||
LogInfo("user [{}] loginserver [{}]", user, loginserver);
|
||||
LogInfo("[AttemptLoginAccountCreation] user [{}] loginserver [{}]", user, loginserver);
|
||||
|
||||
#ifdef LSPX
|
||||
if (loginserver == "eqemu") {
|
||||
@@ -351,7 +351,7 @@ void Client::AttemptLoginAccountCreation(
|
||||
);
|
||||
|
||||
if (account_id > 0) {
|
||||
LogInfo("Found and creating eqemu account [{}]", account_id);
|
||||
LogInfo("[AttemptLoginAccountCreation] Found and creating eqemu account [{}]", account_id);
|
||||
CreateEQEmuAccount(user, pass, account_id);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -41,7 +41,7 @@ Database::Database(
|
||||
exit(1);
|
||||
}
|
||||
else {
|
||||
LogInfo("Using database [{0}] at [{1}:{2}]", name, host, port);
|
||||
LogStatus("Using database [{0}] at [{1}:{2}]", name, host, port);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -148,8 +148,6 @@ void LoadServerConfig()
|
||||
|
||||
void start_web_server()
|
||||
{
|
||||
Sleep(1);
|
||||
|
||||
int web_api_port = server.config.GetVariableInt("web_api", "port", 6000);
|
||||
LogInfo("Webserver API now listening on port [{0}]", web_api_port);
|
||||
|
||||
@@ -255,6 +253,9 @@ int main(int argc, char **argv)
|
||||
#endif
|
||||
|
||||
LogInfo("Server Started");
|
||||
if (LogSys.log_settings[Logs::Loginserver].log_to_console == 1) {
|
||||
LogInfo("Loginserver logging set to level [1] for more debugging, enable detail [3]");
|
||||
}
|
||||
|
||||
/**
|
||||
* Web API
|
||||
@@ -266,8 +267,8 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
LogInfo("[Config] [Account] CanAutoCreateAccounts [{0}]", server.options.CanAutoCreateAccounts());
|
||||
LogInfo("[Config] [ClientConfiguration] DisplayExpansions [{0}]", server.options.IsDisplayExpansions());
|
||||
LogInfo("[Config] [ClientConfiguration] MaxExpansions [{0}]", server.options.GetMaxExpansions());
|
||||
LogInfo("[Config] [Client_Configuration] DisplayExpansions [{0}]", server.options.IsDisplayExpansions());
|
||||
LogInfo("[Config] [Client_Configuration] MaxExpansions [{0}]", server.options.GetMaxExpansions());
|
||||
|
||||
#ifdef LSPX
|
||||
LogInfo("[Config] [Account] CanAutoLinkAccounts [{0}]", server.options.CanAutoLinkAccounts());
|
||||
|
||||
@@ -80,7 +80,7 @@ void WorldServer::Reset()
|
||||
void WorldServer::ProcessNewLSInfo(uint16_t opcode, const EQ::Net::Packet &packet)
|
||||
{
|
||||
LogNetcode(
|
||||
"Application packet received from server [{:#04x}] [Size: {}]\n{}",
|
||||
"[ProcessNewLSInfo] Application packet received from server [{:#04x}] [Size: {}]\n{}",
|
||||
opcode,
|
||||
packet.Length(),
|
||||
packet.ToString()
|
||||
@@ -125,7 +125,7 @@ void WorldServer::ProcessNewLSInfo(uint16_t opcode, const EQ::Net::Packet &packe
|
||||
void WorldServer::ProcessLSStatus(uint16_t opcode, const EQ::Net::Packet &packet)
|
||||
{
|
||||
LogNetcode(
|
||||
"Application packet received from server [{:#04x}] [Size: {}]\n{}",
|
||||
"[ProcessLSStatus] Application packet received from server [{:#04x}] [Size: {}]\n{}",
|
||||
opcode,
|
||||
packet.Length(),
|
||||
packet.ToString()
|
||||
@@ -159,7 +159,7 @@ void WorldServer::ProcessLSStatus(uint16_t opcode, const EQ::Net::Packet &packet
|
||||
void WorldServer::ProcessUserToWorldResponseLegacy(uint16_t opcode, const EQ::Net::Packet &packet)
|
||||
{
|
||||
LogNetcode(
|
||||
"Application packet received from server [{:#04x}] [Size: {}]\n{}",
|
||||
"[ProcessUserToWorldResponseLegacy] Application packet received from server [{:#04x}] [Size: {}]\n{}",
|
||||
opcode,
|
||||
packet.Length(),
|
||||
packet.ToString()
|
||||
@@ -255,7 +255,7 @@ void WorldServer::ProcessUserToWorldResponseLegacy(uint16_t opcode, const EQ::Ne
|
||||
void WorldServer::ProcessUserToWorldResponse(uint16_t opcode, const EQ::Net::Packet &packet)
|
||||
{
|
||||
LogNetcode(
|
||||
"Application packet received from server [{:#04x}] [Size: {}]\n{}",
|
||||
"[ProcessUserToWorldResponse] Application packet received from server [{:#04x}] [Size: {}]\n{}",
|
||||
opcode,
|
||||
packet.Length(),
|
||||
packet.ToString()
|
||||
@@ -362,7 +362,7 @@ void WorldServer::ProcessUserToWorldResponse(uint16_t opcode, const EQ::Net::Pac
|
||||
void WorldServer::ProcessLSAccountUpdate(uint16_t opcode, const EQ::Net::Packet &packet)
|
||||
{
|
||||
LogNetcode(
|
||||
"Application packet received from server [{:#04x}] [Size: {}]\n{}",
|
||||
"[ProcessLSAccountUpdate] Application packet received from server [{:#04x}] [Size: {}]\n{}",
|
||||
opcode,
|
||||
packet.Length(),
|
||||
packet.ToString()
|
||||
@@ -458,7 +458,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct *new_world_server_info
|
||||
|
||||
if (login_server_admin.loaded) {
|
||||
LogDebug(
|
||||
"Attempting to authenticate world admin... [{0}] ({1}) against worldserver [{2}]",
|
||||
"WorldServer::Handle_NewLSInfo | Attempting to authenticate world admin... [{0}] ({1}) against worldserver [{2}]",
|
||||
GetAccountName(),
|
||||
login_server_admin.id,
|
||||
GetServerShortName()
|
||||
@@ -471,7 +471,7 @@ void WorldServer::Handle_NewLSInfo(ServerNewLSInfo_Struct *new_world_server_info
|
||||
login_server_admin.account_password
|
||||
)) {
|
||||
LogDebug(
|
||||
"Authenticating world admin... [{0}] ({1}) success! World ({2})",
|
||||
"WorldServer::Handle_NewLSInfo | Authenticating world admin... [{0}] ({1}) success! World ({2})",
|
||||
GetAccountName(),
|
||||
login_server_admin.id,
|
||||
GetServerShortName()
|
||||
@@ -600,7 +600,7 @@ void WorldServer::SendClientAuth(
|
||||
m_connection->Send(ServerOP_LSClientAuth, outapp);
|
||||
|
||||
LogNetcode(
|
||||
"Sending [{:#04x}] [Size: {}]\n{}",
|
||||
"[ServerOP_LSClientAuth] Sending [{:#04x}] [Size: {}]\n{}",
|
||||
ServerOP_LSClientAuth,
|
||||
outapp.Length(),
|
||||
outapp.ToString()
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"name": "eqemu-server",
|
||||
"version": "22.1.0",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/EQEmu/Server.git"
|
||||
}
|
||||
}
|
||||
+57
-9
@@ -50,8 +50,56 @@
|
||||
#include "../common/strings.h"
|
||||
#include "../common/servertalk.h"
|
||||
|
||||
Database::Database()
|
||||
{
|
||||
DBInitVars();
|
||||
}
|
||||
|
||||
void QSDatabase::AddSpeech(
|
||||
/*
|
||||
Establish a connection to a mysql database with the supplied parameters
|
||||
*/
|
||||
|
||||
Database::Database(const char *host, const char *user, const char *passwd, const char *database, uint32 port)
|
||||
{
|
||||
DBInitVars();
|
||||
Connect(host, user, passwd, database, port);
|
||||
}
|
||||
|
||||
bool Database::Connect(const char *host, const char *user, const char *passwd, const char *database, uint32 port)
|
||||
{
|
||||
uint32 errnum = 0;
|
||||
char errbuf[MYSQL_ERRMSG_SIZE];
|
||||
if (!Open(host, user, passwd, database, port, &errnum, errbuf)) {
|
||||
LogError("Failed to connect to database: Error: {}", errbuf);
|
||||
HandleMysqlError(errnum);
|
||||
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
LogInfo("Using database [{}] at [{}]:[{}]", database, host, port);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
void Database::DBInitVars()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
void Database::HandleMysqlError(uint32 errnum)
|
||||
{
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Close the connection to the database
|
||||
*/
|
||||
Database::~Database()
|
||||
{
|
||||
}
|
||||
|
||||
void Database::AddSpeech(
|
||||
const char *from,
|
||||
const char *to,
|
||||
const char *message,
|
||||
@@ -86,7 +134,7 @@ void QSDatabase::AddSpeech(
|
||||
|
||||
}
|
||||
|
||||
void QSDatabase::LogPlayerDropItem(QSPlayerDropItem_Struct *QS)
|
||||
void Database::LogPlayerDropItem(QSPlayerDropItem_Struct *QS)
|
||||
{
|
||||
|
||||
std::string query = StringFormat(
|
||||
@@ -125,7 +173,7 @@ void QSDatabase::LogPlayerDropItem(QSPlayerDropItem_Struct *QS)
|
||||
}
|
||||
}
|
||||
|
||||
void QSDatabase::LogPlayerTrade(QSPlayerLogTrade_Struct *QS, uint32 detailCount)
|
||||
void Database::LogPlayerTrade(QSPlayerLogTrade_Struct *QS, uint32 detailCount)
|
||||
{
|
||||
|
||||
std::string query = StringFormat(
|
||||
@@ -172,7 +220,7 @@ void QSDatabase::LogPlayerTrade(QSPlayerLogTrade_Struct *QS, uint32 detailCount)
|
||||
|
||||
}
|
||||
|
||||
void QSDatabase::LogPlayerHandin(QSPlayerLogHandin_Struct *QS, uint32 detailCount)
|
||||
void Database::LogPlayerHandin(QSPlayerLogHandin_Struct *QS, uint32 detailCount)
|
||||
{
|
||||
|
||||
std::string query = StringFormat(
|
||||
@@ -221,7 +269,7 @@ void QSDatabase::LogPlayerHandin(QSPlayerLogHandin_Struct *QS, uint32 detailCoun
|
||||
|
||||
}
|
||||
|
||||
void QSDatabase::LogPlayerNPCKill(QSPlayerLogNPCKill_Struct *QS, uint32 members)
|
||||
void Database::LogPlayerNPCKill(QSPlayerLogNPCKill_Struct *QS, uint32 members)
|
||||
{
|
||||
|
||||
std::string query = StringFormat(
|
||||
@@ -258,7 +306,7 @@ void QSDatabase::LogPlayerNPCKill(QSPlayerLogNPCKill_Struct *QS, uint32 members)
|
||||
|
||||
}
|
||||
|
||||
void QSDatabase::LogPlayerDelete(QSPlayerLogDelete_Struct *QS, uint32 items)
|
||||
void Database::LogPlayerDelete(QSPlayerLogDelete_Struct *QS, uint32 items)
|
||||
{
|
||||
|
||||
std::string query = StringFormat(
|
||||
@@ -297,7 +345,7 @@ void QSDatabase::LogPlayerDelete(QSPlayerLogDelete_Struct *QS, uint32 items)
|
||||
|
||||
}
|
||||
|
||||
void QSDatabase::LogPlayerMove(QSPlayerLogMove_Struct *QS, uint32 items)
|
||||
void Database::LogPlayerMove(QSPlayerLogMove_Struct *QS, uint32 items)
|
||||
{
|
||||
/* These are item moves */
|
||||
|
||||
@@ -337,7 +385,7 @@ void QSDatabase::LogPlayerMove(QSPlayerLogMove_Struct *QS, uint32 items)
|
||||
}
|
||||
}
|
||||
|
||||
void QSDatabase::LogMerchantTransaction(QSMerchantLogTransaction_Struct *QS, uint32 items)
|
||||
void Database::LogMerchantTransaction(QSMerchantLogTransaction_Struct *QS, uint32 items)
|
||||
{
|
||||
/* Merchant transactions are from the perspective of the merchant, not the player */
|
||||
std::string query = StringFormat(
|
||||
@@ -385,7 +433,7 @@ void QSDatabase::LogMerchantTransaction(QSMerchantLogTransaction_Struct *QS, uin
|
||||
}
|
||||
|
||||
// this function does not delete the ServerPacket, so it must be handled at call site
|
||||
void QSDatabase::GeneralQueryReceive(ServerPacket *pack)
|
||||
void Database::GeneralQueryReceive(ServerPacket *pack)
|
||||
{
|
||||
/*
|
||||
These are general queries passed from anywhere in zone instead of packing structures and breaking them down again and again
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
#include "../common/eqemu_logsys.h"
|
||||
#include "../common/global_define.h"
|
||||
#include "../common/types.h"
|
||||
#include "../common/database.h"
|
||||
#include "../common/dbcore.h"
|
||||
#include "../common/linked_list.h"
|
||||
#include "../common/servertalk.h"
|
||||
#include <string>
|
||||
@@ -36,8 +36,13 @@
|
||||
//atoi is not uint32 or uint32 safe!!!!
|
||||
#define atoul(str) strtoul(str, nullptr, 10)
|
||||
|
||||
class QSDatabase : public Database {
|
||||
class Database : public DBcore {
|
||||
public:
|
||||
Database();
|
||||
Database(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
|
||||
bool Connect(const char* host, const char* user, const char* passwd, const char* database,uint32 port);
|
||||
~Database();
|
||||
|
||||
void AddSpeech(const char* from, const char* to, const char* message, uint16 minstatus, uint32 guilddbid, uint8 type);
|
||||
void LogPlayerTrade(QSPlayerLogTrade_Struct* QS, uint32 DetailCount);
|
||||
void LogPlayerDropItem(QSPlayerDropItem_Struct* QS);
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
#include "../common/rulesys.h"
|
||||
|
||||
extern WorldServer *worldserver;
|
||||
extern QSDatabase database;
|
||||
extern Database database;
|
||||
|
||||
PlayerLookingForGuild::PlayerLookingForGuild(char *Name, char *Comments, uint32 Level, uint32 Class, uint32 AACount, uint32 Timezone, uint32 TimePosted)
|
||||
{
|
||||
|
||||
@@ -32,21 +32,19 @@
|
||||
#include "lfguild.h"
|
||||
#include "worldserver.h"
|
||||
#include "../common/path_manager.h"
|
||||
#include "../common/zone_store.h"
|
||||
#include <list>
|
||||
#include <signal.h>
|
||||
#include <thread>
|
||||
|
||||
volatile bool RunLoops = true;
|
||||
|
||||
QSDatabase database;
|
||||
Database database;
|
||||
LFGuildManager lfguildmanager;
|
||||
std::string WorldShortName;
|
||||
const queryservconfig *Config;
|
||||
WorldServer *worldserver = 0;
|
||||
EQEmuLogSys LogSys;
|
||||
PathManager path;
|
||||
ZoneStore zone_store;
|
||||
|
||||
void CatchSignal(int sig_num)
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
extern WorldServer worldserver;
|
||||
extern const queryservconfig *Config;
|
||||
extern QSDatabase database;
|
||||
extern Database database;
|
||||
extern LFGuildManager lfguildmanager;
|
||||
|
||||
WorldServer::WorldServer()
|
||||
|
||||
@@ -164,9 +164,13 @@ int main(int argc, char **argv)
|
||||
if (!RuleManager::Instance()->LoadRules(&database, "default", false)) {
|
||||
LogInfo("No rule set configured, using default rules");
|
||||
}
|
||||
else {
|
||||
LogInfo("Loaded default rule set 'default'");
|
||||
}
|
||||
}
|
||||
|
||||
EQ::InitializeDynamicLookups();
|
||||
LogInfo("Initialized dynamic dictionary entries");
|
||||
}
|
||||
|
||||
|
||||
@@ -268,6 +272,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
|
||||
if (load_all || load_factions) {
|
||||
LogInfo("Loading factions");
|
||||
try {
|
||||
LoadFactions(&content_db, hotfix_name);
|
||||
} catch (std::exception &ex) {
|
||||
|
||||
+1
-1
Submodule submodules/websocketpp updated: b9aeec6eaf...c6d7e295bf
+125
-283
@@ -25,7 +25,7 @@
|
||||
#include <cstdlib>
|
||||
#include <algorithm>
|
||||
|
||||
extern UCSDatabase database;
|
||||
extern Database database;
|
||||
extern uint32 ChatMessagesSent;
|
||||
|
||||
void ServerToClient45SayLink(std::string& clientSayLink, const std::string& serverSayLink);
|
||||
@@ -33,33 +33,33 @@ void ServerToClient50SayLink(std::string& clientSayLink, const std::string& serv
|
||||
void ServerToClient55SayLink(std::string& clientSayLink, const std::string& serverSayLink);
|
||||
|
||||
ChatChannel::ChatChannel(std::string inName, std::string inOwner, std::string inPassword, bool inPermanent, int inMinimumStatus) :
|
||||
m_delete_timer(0) {
|
||||
DeleteTimer(0) {
|
||||
|
||||
m_name = inName;
|
||||
Name = inName;
|
||||
|
||||
m_owner = inOwner;
|
||||
Owner = inOwner;
|
||||
|
||||
m_password = inPassword;
|
||||
Password = inPassword;
|
||||
|
||||
m_permanent = inPermanent;
|
||||
Permanent = inPermanent;
|
||||
|
||||
m_minimum_status = inMinimumStatus;
|
||||
MinimumStatus = inMinimumStatus;
|
||||
|
||||
m_moderated = false;
|
||||
Moderated = false;
|
||||
|
||||
LogDebug(
|
||||
"New ChatChannel created: Name: [{}], Owner: [{}], Password: [{}], MinStatus: [{}]",
|
||||
m_name.c_str(),
|
||||
m_owner.c_str(),
|
||||
m_password.c_str(),
|
||||
m_minimum_status
|
||||
"New ChatChannel created: Name: [[{}]], Owner: [[{}]], Password: [[{}]], MinStatus: [{}]",
|
||||
Name.c_str(),
|
||||
Owner.c_str(),
|
||||
Password.c_str(),
|
||||
MinimumStatus
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
ChatChannel::~ChatChannel() {
|
||||
|
||||
LinkedListIterator<Client*> iterator(m_clients_in_channel);
|
||||
LinkedListIterator<Client*> iterator(ClientsInChannel);
|
||||
|
||||
iterator.Reset();
|
||||
|
||||
@@ -67,79 +67,18 @@ ChatChannel::~ChatChannel() {
|
||||
iterator.RemoveCurrent(false);
|
||||
}
|
||||
|
||||
ChatChannel *ChatChannelList::CreateChannel(
|
||||
const std::string& name,
|
||||
const std::string& owner,
|
||||
const std::string& password,
|
||||
bool permanent,
|
||||
int minimum_status,
|
||||
bool save_to_db
|
||||
)
|
||||
{
|
||||
uint8 max_perm_player_channels = RuleI(Chat, MaxPermanentPlayerChannels);
|
||||
ChatChannel* ChatChannelList::CreateChannel(std::string Name, std::string Owner, std::string Password, bool Permanent, int MinimumStatus) {
|
||||
|
||||
if (!database.CheckChannelNameFilter(name)) {
|
||||
if (!(owner == SYSTEM_OWNER)) {
|
||||
return nullptr;
|
||||
}
|
||||
else {
|
||||
LogDebug("Ignoring Name Filter as channel is owned by System...");
|
||||
}
|
||||
}
|
||||
ChatChannel *NewChannel = new ChatChannel(CapitaliseName(Name), Owner, Password, Permanent, MinimumStatus);
|
||||
|
||||
if (IsOnChannelBlockList(name)) {
|
||||
if (!(owner == SYSTEM_OWNER)) {
|
||||
LogInfo("Channel name [{}] is a reserved/blocked channel name. Channel creation canceled.", name);
|
||||
return nullptr;
|
||||
}
|
||||
else {
|
||||
LogInfo("Ignoring reserved/blocked channel name [{}] as channel is owned by System...", name);
|
||||
}
|
||||
}
|
||||
else {
|
||||
LogDebug("Channel name [{}] passed the reserved/blocked channel name check...", name);
|
||||
}
|
||||
ChatChannels.Insert(NewChannel);
|
||||
|
||||
|
||||
auto *new_channel = new ChatChannel(CapitaliseName(name), owner, password, permanent, minimum_status);
|
||||
|
||||
ChatChannels.Insert(new_channel);
|
||||
|
||||
if (owner == SYSTEM_OWNER) {
|
||||
save_to_db = false;
|
||||
}
|
||||
|
||||
// If permanent player channels are enabled (and not a system channel)
|
||||
// save channel to database if not exceeding limit.
|
||||
bool can_save_channel = (max_perm_player_channels > 0) && !(owner == SYSTEM_OWNER) && save_to_db;
|
||||
if (can_save_channel) {
|
||||
|
||||
// Ensure there is room to save another chat channel to the database.
|
||||
bool player_under_channel_limit = database.CurrentPlayerChannelCount(owner) + 1 <= max_perm_player_channels;
|
||||
if (player_under_channel_limit) {
|
||||
database.SaveChatChannel(
|
||||
CapitaliseName(name),
|
||||
owner,
|
||||
password,
|
||||
minimum_status
|
||||
);
|
||||
}
|
||||
else {
|
||||
LogDebug(
|
||||
"Maximum number of channels [{}] reached for player [{}], channel [{}] save to database aborted.",
|
||||
max_perm_player_channels,
|
||||
owner,
|
||||
CapitaliseName(name)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
return new_channel;
|
||||
return NewChannel;
|
||||
}
|
||||
|
||||
ChatChannel* ChatChannelList::FindChannel(std::string Name) {
|
||||
|
||||
std::string normalized_name = CapitaliseName(Name);
|
||||
std::string NormalisedName = CapitaliseName(Name);
|
||||
|
||||
LinkedListIterator<ChatChannel*> iterator(ChatChannels);
|
||||
|
||||
@@ -147,9 +86,9 @@ ChatChannel* ChatChannelList::FindChannel(std::string Name) {
|
||||
|
||||
while(iterator.MoreElements()) {
|
||||
|
||||
auto *current_channel = iterator.GetData();
|
||||
ChatChannel *CurrentChannel = iterator.GetData();
|
||||
|
||||
if(current_channel && (current_channel->m_name == normalized_name))
|
||||
if(CurrentChannel && (CurrentChannel->Name == NormalisedName))
|
||||
return iterator.GetData();
|
||||
|
||||
iterator.Advance();
|
||||
@@ -220,7 +159,7 @@ void ChatChannelList::SendAllChannels(Client *c) {
|
||||
|
||||
void ChatChannelList::RemoveChannel(ChatChannel *Channel) {
|
||||
|
||||
LogDebug("Remove channel [{}]", Channel->GetName().c_str());
|
||||
LogDebug("RemoveChannel ([{}])", Channel->GetName().c_str());
|
||||
|
||||
LinkedListIterator<ChatChannel*> iterator(ChatChannels);
|
||||
|
||||
@@ -255,7 +194,7 @@ int ChatChannel::MemberCount(int Status) {
|
||||
|
||||
int Count = 0;
|
||||
|
||||
LinkedListIterator<Client*> iterator(m_clients_in_channel);
|
||||
LinkedListIterator<Client*> iterator(ClientsInChannel);
|
||||
|
||||
iterator.Reset();
|
||||
|
||||
@@ -272,43 +211,30 @@ int ChatChannel::MemberCount(int Status) {
|
||||
return Count;
|
||||
}
|
||||
|
||||
void ChatChannel::SetPassword(const std::string& in_password) {
|
||||
void ChatChannel::SetPassword(std::string inPassword) {
|
||||
|
||||
m_password = in_password;
|
||||
Password = inPassword;
|
||||
|
||||
if(m_permanent)
|
||||
if(Permanent)
|
||||
{
|
||||
RemoveApostrophes(m_password);
|
||||
database.SetChannelPassword(m_name, m_password);
|
||||
RemoveApostrophes(Password);
|
||||
database.SetChannelPassword(Name, Password);
|
||||
}
|
||||
}
|
||||
|
||||
void ChatChannel::SetOwner(std::string& in_owner) {
|
||||
void ChatChannel::SetOwner(std::string inOwner) {
|
||||
|
||||
m_owner = in_owner;
|
||||
Owner = inOwner;
|
||||
|
||||
if(m_permanent)
|
||||
database.SetChannelOwner(m_name, m_owner);
|
||||
}
|
||||
|
||||
// Returns the owner's name in type std::string()
|
||||
std::string& ChatChannel::GetOwnerName() {
|
||||
return m_owner;
|
||||
}
|
||||
|
||||
void ChatChannel::SetTemporary() {
|
||||
m_permanent = false;
|
||||
}
|
||||
|
||||
void ChatChannel::SetPermanent() {
|
||||
m_permanent = true;
|
||||
if(Permanent)
|
||||
database.SetChannelOwner(Name, Owner);
|
||||
}
|
||||
|
||||
void ChatChannel::AddClient(Client *c) {
|
||||
|
||||
if(!c) return;
|
||||
|
||||
m_delete_timer.Disable();
|
||||
DeleteTimer.Disable();
|
||||
|
||||
if(IsClientInChannel(c)) {
|
||||
|
||||
@@ -321,9 +247,9 @@ void ChatChannel::AddClient(Client *c) {
|
||||
|
||||
int AccountStatus = c->GetAccountStatus();
|
||||
|
||||
LogDebug("Adding [{}] to channel [{}]", c->GetName().c_str(), m_name.c_str());
|
||||
LogDebug("Adding [{}] to channel [{}]", c->GetName().c_str(), Name.c_str());
|
||||
|
||||
LinkedListIterator<Client*> iterator(m_clients_in_channel);
|
||||
LinkedListIterator<Client*> iterator(ClientsInChannel);
|
||||
|
||||
iterator.Reset();
|
||||
|
||||
@@ -338,7 +264,7 @@ void ChatChannel::AddClient(Client *c) {
|
||||
iterator.Advance();
|
||||
}
|
||||
|
||||
m_clients_in_channel.Insert(c);
|
||||
ClientsInChannel.Insert(c);
|
||||
|
||||
}
|
||||
|
||||
@@ -346,46 +272,46 @@ bool ChatChannel::RemoveClient(Client *c) {
|
||||
|
||||
if(!c) return false;
|
||||
|
||||
LogDebug("Remove client [{}] from channel [{}]", c->GetName().c_str(), GetName().c_str());
|
||||
LogDebug("RemoveClient [{}] from channel [{}]", c->GetName().c_str(), GetName().c_str());
|
||||
|
||||
bool hide_me = c->GetHideMe();
|
||||
bool HideMe = c->GetHideMe();
|
||||
|
||||
int account_status = c->GetAccountStatus();
|
||||
int AccountStatus = c->GetAccountStatus();
|
||||
|
||||
int players_in_channel = 0;
|
||||
int PlayersInChannel = 0;
|
||||
|
||||
LinkedListIterator<Client*> iterator(m_clients_in_channel);
|
||||
LinkedListIterator<Client*> iterator(ClientsInChannel);
|
||||
|
||||
iterator.Reset();
|
||||
|
||||
while(iterator.MoreElements()) {
|
||||
|
||||
auto *current_client = iterator.GetData();
|
||||
Client *CurrentClient = iterator.GetData();
|
||||
|
||||
if(current_client == c) {
|
||||
if(CurrentClient == c) {
|
||||
iterator.RemoveCurrent(false);
|
||||
}
|
||||
else if(current_client) {
|
||||
else if(CurrentClient) {
|
||||
|
||||
players_in_channel++;
|
||||
PlayersInChannel++;
|
||||
|
||||
if(current_client->IsAnnounceOn())
|
||||
if(!hide_me || (current_client->GetAccountStatus() > account_status))
|
||||
current_client->AnnounceLeave(this, c);
|
||||
if(CurrentClient->IsAnnounceOn())
|
||||
if(!HideMe || (CurrentClient->GetAccountStatus() > AccountStatus))
|
||||
CurrentClient->AnnounceLeave(this, c);
|
||||
|
||||
iterator.Advance();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if((players_in_channel == 0) && !m_permanent) {
|
||||
if((PlayersInChannel == 0) && !Permanent) {
|
||||
|
||||
if((m_password.length() == 0) || (RuleI(Channels, DeleteTimer) == 0))
|
||||
if((Password.length() == 0) || (RuleI(Channels, DeleteTimer) == 0))
|
||||
return false;
|
||||
|
||||
LogDebug("Starting delete timer for empty password protected channel [{}]", m_name.c_str());
|
||||
LogDebug("Starting delete timer for empty password protected channel [{}]", Name.c_str());
|
||||
|
||||
m_delete_timer.Start(RuleI(Channels, DeleteTimer) * 60000);
|
||||
DeleteTimer.Start(RuleI(Channels, DeleteTimer) * 60000);
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -396,9 +322,9 @@ void ChatChannel::SendOPList(Client *c)
|
||||
if (!c)
|
||||
return;
|
||||
|
||||
c->GeneralChannelMessage("Channel " + m_name + " op-list: (Owner=" + m_owner + ")");
|
||||
c->GeneralChannelMessage("Channel " + Name + " op-list: (Owner=" + Owner + ")");
|
||||
|
||||
for (auto &&m : m_moderators)
|
||||
for (auto &&m : Moderators)
|
||||
c->GeneralChannelMessage(m);
|
||||
}
|
||||
|
||||
@@ -424,7 +350,7 @@ void ChatChannel::SendChannelMembers(Client *c) {
|
||||
|
||||
int MembersInLine = 0;
|
||||
|
||||
LinkedListIterator<Client*> iterator(m_clients_in_channel);
|
||||
LinkedListIterator<Client*> iterator(ClientsInChannel);
|
||||
|
||||
iterator.Reset();
|
||||
|
||||
@@ -463,7 +389,7 @@ void ChatChannel::SendChannelMembers(Client *c) {
|
||||
|
||||
}
|
||||
|
||||
void ChatChannel::SendMessageToChannel(const std::string& Message, Client* Sender) {
|
||||
void ChatChannel::SendMessageToChannel(std::string Message, Client* Sender) {
|
||||
|
||||
if(!Sender) return;
|
||||
|
||||
@@ -471,40 +397,40 @@ void ChatChannel::SendMessageToChannel(const std::string& Message, Client* Sende
|
||||
|
||||
ChatMessagesSent++;
|
||||
|
||||
LinkedListIterator<Client*> iterator(m_clients_in_channel);
|
||||
LinkedListIterator<Client*> iterator(ClientsInChannel);
|
||||
|
||||
iterator.Reset();
|
||||
|
||||
while(iterator.MoreElements()) {
|
||||
|
||||
auto *channel_client = iterator.GetData();
|
||||
Client *ChannelClient = iterator.GetData();
|
||||
|
||||
if(channel_client)
|
||||
if(ChannelClient)
|
||||
{
|
||||
LogDebug("Sending message to [{}] from [{}]",
|
||||
channel_client->GetName().c_str(), Sender->GetName().c_str());
|
||||
ChannelClient->GetName().c_str(), Sender->GetName().c_str());
|
||||
|
||||
if (cv_messages[static_cast<uint32>(channel_client->GetClientVersion())].length() == 0) {
|
||||
switch (channel_client->GetClientVersion()) {
|
||||
if (cv_messages[static_cast<uint32>(ChannelClient->GetClientVersion())].length() == 0) {
|
||||
switch (ChannelClient->GetClientVersion()) {
|
||||
case EQ::versions::ClientVersion::Titanium:
|
||||
ServerToClient45SayLink(cv_messages[static_cast<uint32>(channel_client->GetClientVersion())], Message);
|
||||
ServerToClient45SayLink(cv_messages[static_cast<uint32>(ChannelClient->GetClientVersion())], Message);
|
||||
break;
|
||||
case EQ::versions::ClientVersion::SoF:
|
||||
case EQ::versions::ClientVersion::SoD:
|
||||
case EQ::versions::ClientVersion::UF:
|
||||
ServerToClient50SayLink(cv_messages[static_cast<uint32>(channel_client->GetClientVersion())], Message);
|
||||
ServerToClient50SayLink(cv_messages[static_cast<uint32>(ChannelClient->GetClientVersion())], Message);
|
||||
break;
|
||||
case EQ::versions::ClientVersion::RoF:
|
||||
ServerToClient55SayLink(cv_messages[static_cast<uint32>(channel_client->GetClientVersion())], Message);
|
||||
ServerToClient55SayLink(cv_messages[static_cast<uint32>(ChannelClient->GetClientVersion())], Message);
|
||||
break;
|
||||
case EQ::versions::ClientVersion::RoF2:
|
||||
default:
|
||||
cv_messages[static_cast<uint32>(channel_client->GetClientVersion())] = Message;
|
||||
cv_messages[static_cast<uint32>(ChannelClient->GetClientVersion())] = Message;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
channel_client->SendChannelMessage(m_name, cv_messages[static_cast<uint32>(channel_client->GetClientVersion())], Sender);
|
||||
ChannelClient->SendChannelMessage(Name, cv_messages[static_cast<uint32>(ChannelClient->GetClientVersion())], Sender);
|
||||
}
|
||||
|
||||
iterator.Advance();
|
||||
@@ -513,9 +439,9 @@ void ChatChannel::SendMessageToChannel(const std::string& Message, Client* Sende
|
||||
|
||||
void ChatChannel::SetModerated(bool inModerated) {
|
||||
|
||||
m_moderated = inModerated;
|
||||
Moderated = inModerated;
|
||||
|
||||
LinkedListIterator<Client*> iterator(m_clients_in_channel);
|
||||
LinkedListIterator<Client*> iterator(ClientsInChannel);
|
||||
|
||||
iterator.Reset();
|
||||
|
||||
@@ -525,10 +451,10 @@ void ChatChannel::SetModerated(bool inModerated) {
|
||||
|
||||
if(ChannelClient) {
|
||||
|
||||
if(m_moderated)
|
||||
ChannelClient->GeneralChannelMessage("Channel " + m_name + " is now moderated.");
|
||||
if(Moderated)
|
||||
ChannelClient->GeneralChannelMessage("Channel " + Name + " is now moderated.");
|
||||
else
|
||||
ChannelClient->GeneralChannelMessage("Channel " + m_name + " is no longer moderated.");
|
||||
ChannelClient->GeneralChannelMessage("Channel " + Name + " is no longer moderated.");
|
||||
}
|
||||
|
||||
iterator.Advance();
|
||||
@@ -539,7 +465,7 @@ bool ChatChannel::IsClientInChannel(Client *c) {
|
||||
|
||||
if(!c) return false;
|
||||
|
||||
LinkedListIterator<Client*> iterator(m_clients_in_channel);
|
||||
LinkedListIterator<Client*> iterator(ClientsInChannel);
|
||||
|
||||
iterator.Reset();
|
||||
|
||||
@@ -554,80 +480,54 @@ bool ChatChannel::IsClientInChannel(Client *c) {
|
||||
return false;
|
||||
}
|
||||
|
||||
ChatChannel *ChatChannelList::AddClientToChannel(std::string channel_name, Client *c, bool command_directed) {
|
||||
ChatChannel *ChatChannelList::AddClientToChannel(std::string ChannelName, Client *c) {
|
||||
|
||||
if(!c) return nullptr;
|
||||
|
||||
if ((channel_name.length() > 0) && (isdigit(channel_name[0]))) { // Ensure channel name does not start with a number
|
||||
if((ChannelName.length() > 0) && (isdigit(ChannelName[0]))) {
|
||||
|
||||
c->GeneralChannelMessage("The channel name can not begin with a number.");
|
||||
return nullptr;
|
||||
}
|
||||
else if (channel_name.empty()) { // Ensure channel name is not empty
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
std::string normalized_name, password;
|
||||
std::string NormalisedName, Password;
|
||||
|
||||
std::string::size_type Colon = channel_name.find_first_of(":");
|
||||
std::string::size_type Colon = ChannelName.find_first_of(":");
|
||||
|
||||
if(Colon == std::string::npos)
|
||||
normalized_name = CapitaliseName(channel_name);
|
||||
NormalisedName = CapitaliseName(ChannelName);
|
||||
else {
|
||||
normalized_name = CapitaliseName(channel_name.substr(0, Colon));
|
||||
NormalisedName = CapitaliseName(ChannelName.substr(0, Colon));
|
||||
|
||||
password = channel_name.substr(Colon + 1);
|
||||
Password = ChannelName.substr(Colon + 1);
|
||||
}
|
||||
|
||||
if((normalized_name.length() > 64) || (password.length() > 64)) {
|
||||
if((NormalisedName.length() > 64) || (Password.length() > 64)) {
|
||||
|
||||
c->GeneralChannelMessage("The channel name or password cannot exceed 64 characters.");
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ChatChannel *RequiredChannel = FindChannel(normalized_name);
|
||||
LogDebug("AddClient to channel [[{}]] with password [[{}]]", NormalisedName.c_str(), Password.c_str());
|
||||
|
||||
if (RequiredChannel) {
|
||||
if (IsOnChannelBlockList(channel_name)) { // Ensure channel name is not blocked
|
||||
if (!(RequiredChannel->GetOwnerName() == SYSTEM_OWNER)) {
|
||||
c->GeneralChannelMessage("That channel name is blocked by the server operator.");
|
||||
return nullptr;
|
||||
}
|
||||
else {
|
||||
LogDebug("Reserved/blocked channel name check for [{}] ignored due to channel being owned by System...", normalized_name);
|
||||
}
|
||||
}
|
||||
}
|
||||
ChatChannel *RequiredChannel = FindChannel(NormalisedName);
|
||||
|
||||
const std::string& channel_owner = c->GetName();
|
||||
if(!RequiredChannel)
|
||||
RequiredChannel = CreateChannel(NormalisedName, c->GetName(), Password, false, 0);
|
||||
|
||||
bool permanent = false;
|
||||
if (command_directed && RuleI(Chat, MaxPermanentPlayerChannels) > 0) {
|
||||
permanent = true;
|
||||
}
|
||||
if(RequiredChannel->GetMinStatus() > c->GetAccountStatus()) {
|
||||
|
||||
if (!RequiredChannel) {
|
||||
RequiredChannel = CreateChannel(normalized_name, channel_owner, password, permanent, 0, command_directed);
|
||||
if (RequiredChannel == nullptr) {
|
||||
LogDebug("Failed to create new channel with name: {}. Possible blocked or reserved channel name.", normalized_name);
|
||||
c->GeneralChannelMessage("Failed to create new channel with provided name. Possible blocked or reserved channel name.");
|
||||
return nullptr;
|
||||
}
|
||||
LogDebug("Created and added Client to channel [{}] with password [{}]. Owner: {}. Command Directed: {}", normalized_name.c_str(), password.c_str(), channel_owner, command_directed);
|
||||
}
|
||||
|
||||
LogDebug("Checking status requirement of channel: {}. Channel status required: {}, player status: {}.", normalized_name, std::to_string(RequiredChannel->GetMinStatus()), std::to_string(c->GetAccountStatus()));
|
||||
if (RequiredChannel->GetMinStatus() > c->GetAccountStatus()) {
|
||||
std::string Message = "You do not have the required account status to join channel " + normalized_name;
|
||||
std::string Message = "You do not have the required account status to join channel " + NormalisedName;
|
||||
|
||||
c->GeneralChannelMessage(Message);
|
||||
LogInfo("Client [{}] connection to channel [{}] refused due to insufficient status.", c->GetName(), normalized_name);
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (RequiredChannel->IsClientInChannel(c)) {
|
||||
if(RequiredChannel->IsClientInChannel(c))
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if(RequiredChannel->IsInvitee(c->GetName())) {
|
||||
|
||||
@@ -638,7 +538,7 @@ ChatChannel *ChatChannelList::AddClientToChannel(std::string channel_name, Clien
|
||||
return RequiredChannel;
|
||||
}
|
||||
|
||||
if(RequiredChannel->CheckPassword(password) || RequiredChannel->IsOwner(c->GetName()) || RequiredChannel->IsModerator(c->GetName()) ||
|
||||
if(RequiredChannel->CheckPassword(Password) || RequiredChannel->IsOwner(c->GetName()) || RequiredChannel->IsModerator(c->GetName()) ||
|
||||
c->IsChannelAdmin()) {
|
||||
|
||||
RequiredChannel->AddClient(c);
|
||||
@@ -646,42 +546,32 @@ ChatChannel *ChatChannelList::AddClientToChannel(std::string channel_name, Clien
|
||||
return RequiredChannel;
|
||||
}
|
||||
|
||||
c->GeneralChannelMessage("Incorrect password for channel " + (normalized_name));
|
||||
c->GeneralChannelMessage("Incorrect password for channel " + (NormalisedName));
|
||||
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ChatChannel *ChatChannelList::RemoveClientFromChannel(const std::string& in_channel_name, Client *c, bool command_directed) {
|
||||
ChatChannel *ChatChannelList::RemoveClientFromChannel(std::string inChannelName, Client *c) {
|
||||
|
||||
if(!c) return nullptr;
|
||||
|
||||
std::string channel_name = in_channel_name;
|
||||
std::string ChannelName = inChannelName;
|
||||
|
||||
if (in_channel_name.length() > 0 && isdigit(channel_name[0])) {
|
||||
channel_name = c->ChannelSlotName(atoi(in_channel_name.c_str()));
|
||||
}
|
||||
if((inChannelName.length() > 0) && isdigit(ChannelName[0]))
|
||||
ChannelName = c->ChannelSlotName(atoi(inChannelName.c_str()));
|
||||
|
||||
auto *required_channel = FindChannel(channel_name);
|
||||
ChatChannel *RequiredChannel = FindChannel(ChannelName);
|
||||
|
||||
if (!required_channel) {
|
||||
if(!RequiredChannel)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
LogDebug("Client [{}] removed from channel [{}]. Channel is owned by {}. Command directed: {}", c->GetName(), channel_name, required_channel->GetOwnerName(), command_directed);
|
||||
if (c->GetName() == required_channel->GetOwnerName() && command_directed) { // Check if the client that is leaving is the the channel owner
|
||||
LogDebug("Owner left the channel [{}], removing channel from database...", channel_name);
|
||||
database.DeleteChatChannel(channel_name); // Remove the channel from the database.
|
||||
LogDebug("Flagging [{}] channel as temporary...", channel_name);
|
||||
required_channel->SetTemporary();
|
||||
}
|
||||
|
||||
// RemoveClient will return false if there is no-one left in the channel, and the channel is not permanent and has
|
||||
// no password.
|
||||
if (!required_channel->RemoveClient(c)) {
|
||||
LogDebug("Noone left in the temporary channel [{}] and no password is set; removing temporary channel.", channel_name);
|
||||
RemoveChannel(required_channel);
|
||||
}
|
||||
//
|
||||
if(!RequiredChannel->RemoveClient(c))
|
||||
RemoveChannel(RequiredChannel);
|
||||
|
||||
return required_channel;
|
||||
return RequiredChannel;
|
||||
}
|
||||
|
||||
void ChatChannelList::Process() {
|
||||
@@ -710,76 +600,76 @@ void ChatChannelList::Process() {
|
||||
void ChatChannel::AddInvitee(const std::string &Invitee)
|
||||
{
|
||||
if (!IsInvitee(Invitee)) {
|
||||
m_invitees.push_back(Invitee);
|
||||
Invitees.push_back(Invitee);
|
||||
|
||||
LogDebug("Added [{}] as invitee to channel [{}]", Invitee.c_str(), m_name.c_str());
|
||||
LogDebug("Added [{}] as invitee to channel [{}]", Invitee.c_str(), Name.c_str());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ChatChannel::RemoveInvitee(std::string Invitee)
|
||||
{
|
||||
auto it = std::find(std::begin(m_invitees), std::end(m_invitees), Invitee);
|
||||
auto it = std::find(std::begin(Invitees), std::end(Invitees), Invitee);
|
||||
|
||||
if(it != std::end(m_invitees)) {
|
||||
m_invitees.erase(it);
|
||||
LogDebug("Removed [{}] as invitee to channel [{}]", Invitee.c_str(), m_name.c_str());
|
||||
if(it != std::end(Invitees)) {
|
||||
Invitees.erase(it);
|
||||
LogDebug("Removed [{}] as invitee to channel [{}]", Invitee.c_str(), Name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
bool ChatChannel::IsInvitee(std::string Invitee)
|
||||
{
|
||||
return std::find(std::begin(m_invitees), std::end(m_invitees), Invitee) != std::end(m_invitees);
|
||||
return std::find(std::begin(Invitees), std::end(Invitees), Invitee) != std::end(Invitees);
|
||||
}
|
||||
|
||||
void ChatChannel::AddModerator(const std::string &Moderator)
|
||||
{
|
||||
if (!IsModerator(Moderator)) {
|
||||
m_moderators.push_back(Moderator);
|
||||
Moderators.push_back(Moderator);
|
||||
|
||||
LogInfo("Added [{}] as moderator to channel [{}]", Moderator.c_str(), m_name.c_str());
|
||||
LogInfo("Added [{}] as moderator to channel [{}]", Moderator.c_str(), Name.c_str());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ChatChannel::RemoveModerator(const std::string &Moderator)
|
||||
{
|
||||
auto it = std::find(std::begin(m_moderators), std::end(m_moderators), Moderator);
|
||||
auto it = std::find(std::begin(Moderators), std::end(Moderators), Moderator);
|
||||
|
||||
if (it != std::end(m_moderators)) {
|
||||
m_moderators.erase(it);
|
||||
LogInfo("Removed [{}] as moderator to channel [{}]", Moderator.c_str(), m_name.c_str());
|
||||
if (it != std::end(Moderators)) {
|
||||
Moderators.erase(it);
|
||||
LogInfo("Removed [{}] as moderator to channel [{}]", Moderator.c_str(), Name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
bool ChatChannel::IsModerator(std::string Moderator)
|
||||
{
|
||||
return std::find(std::begin(m_moderators), std::end(m_moderators), Moderator) != std::end(m_moderators);
|
||||
return std::find(std::begin(Moderators), std::end(Moderators), Moderator) != std::end(Moderators);
|
||||
}
|
||||
|
||||
void ChatChannel::AddVoice(const std::string &inVoiced)
|
||||
{
|
||||
if (!HasVoice(inVoiced)) {
|
||||
m_voiced.push_back(inVoiced);
|
||||
Voiced.push_back(inVoiced);
|
||||
|
||||
LogInfo("Added [{}] as voiced to channel [{}]", inVoiced.c_str(), m_name.c_str());
|
||||
LogInfo("Added [{}] as voiced to channel [{}]", inVoiced.c_str(), Name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
void ChatChannel::RemoveVoice(const std::string &inVoiced)
|
||||
{
|
||||
auto it = std::find(std::begin(m_voiced), std::end(m_voiced), inVoiced);
|
||||
auto it = std::find(std::begin(Voiced), std::end(Voiced), inVoiced);
|
||||
|
||||
if (it != std::end(m_voiced)) {
|
||||
m_voiced.erase(it);
|
||||
if (it != std::end(Voiced)) {
|
||||
Voiced.erase(it);
|
||||
|
||||
LogInfo("Removed [{}] as voiced to channel [{}]", inVoiced.c_str(), m_name.c_str());
|
||||
LogInfo("Removed [{}] as voiced to channel [{}]", inVoiced.c_str(), Name.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
bool ChatChannel::HasVoice(std::string inVoiced)
|
||||
{
|
||||
return std::find(std::begin(m_voiced), std::end(m_voiced), inVoiced) != std::end(m_voiced);
|
||||
return std::find(std::begin(Voiced), std::end(Voiced), inVoiced) != std::end(Voiced);
|
||||
}
|
||||
|
||||
std::string CapitaliseName(std::string inString) {
|
||||
@@ -797,54 +687,6 @@ std::string CapitaliseName(std::string inString) {
|
||||
return NormalisedName;
|
||||
}
|
||||
|
||||
bool ChatChannelList::IsOnChannelBlockList(const std::string& channel_name) {
|
||||
if (channel_name.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if channel_name is already in the BlockedChannelNames vector
|
||||
return Strings::Contains(GetBlockedChannelNames(), channel_name);
|
||||
}
|
||||
|
||||
bool ChatChannelList::IsOnFilteredNameList(const std::string& name) {
|
||||
if (name.empty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Check if name is already in the filtered name vector
|
||||
return Strings::Contains(GetFilteredNames(), name);
|
||||
}
|
||||
|
||||
|
||||
void ChatChannelList::AddToChannelBlockList(const std::string& channel_name) {
|
||||
if (channel_name.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Check if channelName is already in the BlockedChannelNames vector
|
||||
bool is_found = Strings::Contains(ChatChannelList::GetBlockedChannelNames(), channel_name);
|
||||
|
||||
// Add channelName to the BlockedChannelNames vector if it is not already present
|
||||
if (!is_found) {
|
||||
auto blocked_channel_names = GetBlockedChannelNames(); // Get current blocked list
|
||||
blocked_channel_names.push_back(channel_name); // Add new name to local blocked list
|
||||
SetChannelBlockList(blocked_channel_names); // Set blocked list to match local blocked list
|
||||
}
|
||||
}
|
||||
|
||||
void ChatChannelList::AddToFilteredNames(const std::string& name) {
|
||||
if (name.empty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Add name to the filtered names vector if it is not already present
|
||||
if (!Strings::Contains(ChatChannelList::GetFilteredNames(), name)) {
|
||||
auto filtered_names = GetFilteredNames(); // Get current filter name list
|
||||
filtered_names.push_back(name); // Add new name to local filtered names list
|
||||
SetFilteredNameList(filtered_names); // Set filtered names list to match local filtered names list
|
||||
}
|
||||
}
|
||||
|
||||
void ServerToClient45SayLink(std::string& clientSayLink, const std::string& serverSayLink) {
|
||||
if (serverSayLink.find('\x12') == std::string::npos) {
|
||||
clientSayLink = serverSayLink;
|
||||
|
||||
+26
-42
@@ -9,8 +9,6 @@
|
||||
|
||||
class Client;
|
||||
|
||||
#define SYSTEM_OWNER std::string("*System*")
|
||||
|
||||
class ChatChannel {
|
||||
|
||||
public:
|
||||
@@ -23,19 +21,15 @@ public:
|
||||
bool IsClientInChannel(Client *c);
|
||||
|
||||
int MemberCount(int Status);
|
||||
const std::string &GetName() { return m_name; }
|
||||
void SendMessageToChannel(const std::string& Message, Client* Sender);
|
||||
bool CheckPassword(const std::string& in_password) { return m_password.empty() || m_password == in_password; }
|
||||
void SetPassword(const std::string& in_password);
|
||||
bool IsOwner(const std::string& name) { return (m_owner == name); }
|
||||
const std::string& GetPassword() { return m_password; }
|
||||
void SetOwner(std::string& inOwner);
|
||||
std::string& GetOwnerName();
|
||||
void SetTemporary();
|
||||
void SetPermanent();
|
||||
const std::string &GetName() { return Name; }
|
||||
void SendMessageToChannel(std::string Message, Client* Sender);
|
||||
bool CheckPassword(std::string inPassword) { return Password.empty() || Password == inPassword; }
|
||||
void SetPassword(std::string inPassword);
|
||||
bool IsOwner(std::string Name) { return (Owner == Name); }
|
||||
void SetOwner(std::string inOwner);
|
||||
void SendChannelMembers(Client *c);
|
||||
int GetMinStatus() { return m_minimum_status; }
|
||||
bool ReadyToDelete() { return m_delete_timer.Check(); }
|
||||
int GetMinStatus() { return MinimumStatus; }
|
||||
bool ReadyToDelete() { return DeleteTimer.Check(); }
|
||||
void SendOPList(Client *c);
|
||||
void AddInvitee(const std::string &Invitee);
|
||||
void RemoveInvitee(std::string Invitee);
|
||||
@@ -46,58 +40,48 @@ public:
|
||||
void AddVoice(const std::string &Voiced);
|
||||
void RemoveVoice(const std::string &Voiced);
|
||||
bool HasVoice(std::string Voiced);
|
||||
inline bool IsModerated() { return m_moderated; }
|
||||
inline bool IsModerated() { return Moderated; }
|
||||
void SetModerated(bool inModerated);
|
||||
|
||||
friend class ChatChannelList;
|
||||
|
||||
private:
|
||||
|
||||
std::string m_name;
|
||||
std::string m_owner;
|
||||
std::string m_password;
|
||||
std::string Name;
|
||||
std::string Owner;
|
||||
std::string Password;
|
||||
|
||||
bool m_permanent;
|
||||
bool m_moderated;
|
||||
bool Permanent;
|
||||
bool Moderated;
|
||||
|
||||
int m_minimum_status;
|
||||
int MinimumStatus;
|
||||
|
||||
Timer m_delete_timer;
|
||||
Timer DeleteTimer;
|
||||
|
||||
LinkedList<Client*> m_clients_in_channel;
|
||||
LinkedList<Client*> ClientsInChannel;
|
||||
|
||||
std::vector<std::string> m_moderators;
|
||||
std::vector<std::string> m_invitees;
|
||||
std::vector<std::string> m_voiced;
|
||||
std::vector<std::string> Moderators;
|
||||
std::vector<std::string> Invitees;
|
||||
std::vector<std::string> Voiced;
|
||||
|
||||
};
|
||||
|
||||
class ChatChannelList {
|
||||
|
||||
public:
|
||||
ChatChannel* CreateChannel(const std::string& name, const std::string& owner, const std::string& password, bool permanent, int minimum_status, bool save_to_database = false);
|
||||
ChatChannel* FindChannel(std::string name);
|
||||
ChatChannel* AddClientToChannel(std::string channel_name, Client* c, bool command_directed = false);
|
||||
ChatChannel* RemoveClientFromChannel(const std::string& in_channel_name, Client* c, bool command_directed = false);
|
||||
ChatChannel* CreateChannel(std::string Name, std::string Owner, std::string Passwordi, bool Permanent, int MinimumStatus = 0);
|
||||
ChatChannel* FindChannel(std::string Name);
|
||||
ChatChannel* AddClientToChannel(std::string Channel, Client *c);
|
||||
ChatChannel* RemoveClientFromChannel(std::string Channel, Client *c);
|
||||
void RemoveClientFromAllChannels(Client *c);
|
||||
void RemoveChannel(ChatChannel *Channel);
|
||||
void RemoveAllChannels();
|
||||
void SendAllChannels(Client *c);
|
||||
void Process();
|
||||
static inline std::vector<std::string> GetBlockedChannelNames() { return m_blocked_channel_names; }
|
||||
static inline std::vector<std::string> GetFilteredNames() { return m_filtered_names; }
|
||||
static inline void ClearChannelBlockList() { m_blocked_channel_names.clear(); };
|
||||
static inline void ClearFilteredNameList() { m_filtered_names.clear(); };
|
||||
static void AddToChannelBlockList(const std::string& channel_name);
|
||||
static void AddToFilteredNames(const std::string& name);
|
||||
static bool IsOnChannelBlockList(const std::string& channel_name);
|
||||
static bool IsOnFilteredNameList(const std::string& channel_name);
|
||||
static inline void SetChannelBlockList(std::vector<std::string> new_list) { m_blocked_channel_names = new_list; }
|
||||
static inline void SetFilteredNameList(std::vector<std::string> new_list) { m_filtered_names = new_list; }
|
||||
|
||||
private:
|
||||
|
||||
LinkedList<ChatChannel*> ChatChannels;
|
||||
static inline std::vector<std::string> m_blocked_channel_names;
|
||||
static inline std::vector<std::string> m_filtered_names;
|
||||
|
||||
};
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user