Compare commits

..

1 Commits

Author SHA1 Message Date
KimLS 0b24d4ff84 C++17 support, vs builds for now 2020-05-19 20:22:54 -07:00
587 changed files with 17812 additions and 262683 deletions
-16
View File
@@ -1,16 +0,0 @@
---
kind: pipeline
type: docker
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:
limit: 1
steps:
- name: server-build
# Source build script https://github.com/Akkadius/akk-stack/blob/master/containers/eqemu-server/Dockerfile#L20
image: akkadius/eqemu-server:latest
commands:
- sudo chown eqemu:eqemu /drone/src/ * -R
- git submodule init && git submodule update && mkdir -p build && cd build && cmake -DEQEMU_BUILD_LOGIN=ON -DEQEMU_BUILD_BOTS=ON -DEQEMU_BUILD_LUA=ON -G 'Unix Makefiles' .. && make -j$((`nproc`-4))
+13 -22
View File
@@ -6,7 +6,7 @@
{
"label": "make",
"type": "shell",
"command": "cd bin && make",
"command": "cd build && make",
"group": {
"kind": "build",
"isDefault": true
@@ -18,7 +18,7 @@
{
"label": "make clean",
"type": "shell",
"command": "cd bin && make clean",
"command": "cd build && make clean",
"group": {
"kind": "build",
"isDefault": true
@@ -30,7 +30,7 @@
{
"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' ..",
"command": "mkdir -p build && cd build && rm CMakeCache.txt && cmake -DEQEMU_BUILD_LOGIN=ON -DEQEMU_BUILD_LUA=ON -G 'Unix Makefiles' ..",
"group": {
"kind": "build",
"isDefault": true
@@ -52,7 +52,7 @@
{
"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",
"command": "mkdir -p build/bin && cd build/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
@@ -64,7 +64,7 @@
{
"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",
"command": "mkdir -p build/bin && cd build/bin && cd server && git -C ./quests pull 2> /dev/null || git clone https://github.com/ProjectEQ/projecteqquests.git quests",
"group": {
"kind": "build",
"isDefault": true
@@ -76,7 +76,7 @@
{
"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",
"command": "mkdir -p build/bin && cd build/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
@@ -88,7 +88,7 @@
{
"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'",
"command": "mkdir -p build/bin && cd build/bin && docker run -i --rm --privileged -v ${HOST_PROJECT_PATH}/build/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
@@ -100,7 +100,7 @@
{
"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",
"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}/build/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
@@ -109,7 +109,7 @@
{
"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",
"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}/build/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
@@ -118,7 +118,7 @@
{
"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",
"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}/build/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
@@ -127,7 +127,7 @@
{
"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",
"command": "docker stop sharedmemory | true && docker stop world | true && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/build/bin:/src --network=eqemu --name sharedmemory eqemu/server:0.0.3 ./shared_memory && docker run --rm -v ${HOST_PROJECT_PATH}/build/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
@@ -136,7 +136,7 @@
{
"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",
"command": "docker stop queryserv | true && docker run --rm -v ${HOST_PROJECT_PATH}/build/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
@@ -145,16 +145,7 @@
{
"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",
"command": "docker stop mariadb | true && cd build/bin && docker network create eqemu | true && docker run --rm -v ${HOST_PROJECT_PATH}/build/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
+4 -17
View File
@@ -1,4 +1,4 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.2)
CMAKE_MINIMUM_REQUIRED(VERSION 3.8)
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH})
@@ -12,7 +12,7 @@ IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_CXX_STANDARD 14)
SET(CMAKE_CXX_STANDARD 17)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
SET(CMAKE_CXX_EXTENSIONS OFF)
@@ -55,7 +55,6 @@ FIND_PACKAGE(MariaDB)
FIND_PACKAGE(ZLIB)
FIND_PACKAGE(OpenSSL)
FIND_PACKAGE(Lua51)
FIND_PACKAGE(LuaJit)
FIND_PACKAGE(PerlLibs)
FIND_PACKAGE(Sodium)
FIND_PACKAGE(mbedTLS)
@@ -88,12 +87,6 @@ ELSE()
MESSAGE(STATUS "* Lua: MISSING *")
ENDIF()
IF(LuaJit_FOUND)
MESSAGE(STATUS "* LuaJIT: FOUND *")
ELSE()
MESSAGE(STATUS "* LuaJIT: MISSING *")
ENDIF()
IF(PerlLibs_FOUND)
MESSAGE(STATUS "* Perl: FOUND *")
ELSE()
@@ -129,7 +122,6 @@ OPTION(EQEMU_BUILD_LOGIN "Build the login server." ON)
OPTION(EQEMU_BUILD_HC "Build the headless client." OFF)
OPTION(EQEMU_BUILD_TESTS "Build utility tests." OFF)
OPTION(EQEMU_BUILD_CLIENT_FILES "Build Client Import/Export Data Programs." ON)
OPTION(EQEMU_PREFER_LUA "Build with normal Lua even if LuaJIT is found." OFF)
IF(EQEMU_COMMANDS_LOGGING)
ADD_DEFINITIONS(-DCOMMANDS_LOGGING)
@@ -141,7 +133,7 @@ ENDIF(EQEMU_ENABLE_BOTS)
#database
IF(MySQL_FOUND AND MariaDB_FOUND)
SET(DATABASE_LIBRARY_SELECTION MariaDB CACHE STRING "Database library to use:
SET(DATABASE_LIBRARY_SELECTION MySQL CACHE STRING "Database library to use:
MySQL
MariaDB"
)
@@ -220,12 +212,7 @@ ELSE()
SET(SODIUM_LIBRARY_ENABLED OFF)
ENDIF()
IF(LUAJIT_FOUND AND NOT (EQEMU_PREFER_LUA AND Lua51_FOUND))
SET(LUA_LIBRARY_TYPE " LuaJIT")
SET(LUA_LIBRARY_ENABLED ON)
SET(LUA_LIBRARY_LIBS ${LUAJIT_LIBRARY} luabind)
SET(LUA_LIBRARY_INCLUDE ${LUAJIT_INCLUDE_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/libs/luabind")
ELSEIF(Lua51_FOUND )
IF(Lua51_FOUND)
SET(LUA_LIBRARY_TYPE " Lua 5.1")
SET(LUA_LIBRARY_ENABLED ON)
SET(LUA_LIBRARY_LIBS ${LUA_LIBRARY} luabind)
+1 -6
View File
@@ -17,13 +17,9 @@
|:---:|:---:|:---:|
|**Install Count**|![Windows Install Count](http://analytics.akkadius.com/?install_count&windows_count)|![Linux Install Count](http://analytics.akkadius.com/?install_count&linux_count)|
### > Windows
* [Install Guide](https://eqemu.gitbook.io/server/categories/installation/server-installation-windows)
* [Install](https://eqemu.gitbook.io/server/categories/how-to-guides/installation/server-installation-windows)
### > Debian/Ubuntu/CentOS/Fedora
* [Install Guide](https://eqemu.gitbook.io/server/categories/installation/server-installation-linux)
* You can use curl or wget to kick off the installer (whichever your OS has)
> curl -O https://raw.githubusercontent.com/EQEmu/Server/master/utils/scripts/linux_installer/install.sh install.sh && chmod 755 install.sh && ./install.sh
@@ -80,4 +76,3 @@ forum, although pull requests will be much quicker and easier on all parties.
<a href="https://github.com/EQEmu/server/graphs/contributors">
<img src="https://contributors-img.firebaseapp.com/image?repo=EQEmu/server" />
</a>
+76 -119
View File
@@ -26,24 +26,21 @@
#include "../../common/crash.h"
#include "../../common/rulesys.h"
#include "../../common/string_util.h"
#include "../../common/content/world_content_service.h"
EQEmuLogSys LogSys;
WorldContentService content_service;
void ExportSpells(SharedDatabase *db);
void ExportSkillCaps(SharedDatabase *db);
void ExportBaseData(SharedDatabase *db);
void ExportDBStrings(SharedDatabase *db);
int main(int argc, char **argv)
{
int main(int argc, char **argv) {
RegisterExecutablePlatform(ExePlatformClientExport);
LogSys.LoadLogSettingsDefaults();
set_exception_handler();
LogInfo("Client Files Export Utility");
if (!EQEmuConfig::LoadConfig()) {
if(!EQEmuConfig::LoadConfig()) {
LogError("Unable to load configuration file");
return 1;
}
@@ -51,38 +48,14 @@ int main(int argc, char **argv)
auto Config = EQEmuConfig::get();
SharedDatabase database;
SharedDatabase content_db;
LogInfo("Connecting to database");
if (!database.Connect(
Config->DatabaseHost.c_str(),
Config->DatabaseUsername.c_str(),
Config->DatabasePassword.c_str(),
Config->DatabaseDB.c_str(),
Config->DatabasePort
)) {
if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) {
LogError("Unable to connect to the database, cannot continue without a database connection");
return 1;
}
/**
* Multi-tenancy: Content database
*/
if (!Config->ContentDbHost.empty()) {
if (!content_db.Connect(
Config->ContentDbHost.c_str() ,
Config->ContentDbUsername.c_str(),
Config->ContentDbPassword.c_str(),
Config->ContentDbName.c_str(),
Config->ContentDbPort
)) {
LogError("Cannot continue without a content database connection");
return 1;
}
} else {
content_db.SetMysql(database.getMySQL());
}
/* Register Log System and Settings */
database.LoadLogSettings(LogSys.log_settings);
LogSys.StartFileLogs();
@@ -93,15 +66,15 @@ int main(int argc, char **argv)
}
if (arg_1 == "spells") {
ExportSpells(&content_db);
ExportSpells(&database);
return 0;
}
if (arg_1 == "skills") {
ExportSkillCaps(&content_db);
ExportSkillCaps(&database);
return 0;
}
if (arg_1 == "basedata") {
ExportBaseData(&content_db);
ExportBaseData(&database);
return 0;
}
if (arg_1 == "dbstring") {
@@ -109,9 +82,9 @@ int main(int argc, char **argv)
return 0;
}
ExportSpells(&content_db);
ExportSkillCaps(&content_db);
ExportBaseData(&content_db);
ExportSpells(&database);
ExportSkillCaps(&database);
ExportBaseData(&database);
ExportDBStrings(&database);
LogSys.CloseFileLogs();
@@ -119,105 +92,93 @@ int main(int argc, char **argv)
return 0;
}
void ExportSpells(SharedDatabase *db)
{
void ExportSpells(SharedDatabase *db) {
LogInfo("Exporting Spells");
FILE *f = fopen("export/spells_us.txt", "w");
if (!f) {
if(!f) {
LogError("Unable to open export/spells_us.txt to write, skipping.");
return;
}
const std::string query = "SELECT * FROM spells_new ORDER BY id";
auto results = db->QueryDatabase(query);
const std::string query = "SELECT * FROM spells_new ORDER BY id";
auto results = db->QueryDatabase(query);
if (results.Success()) {
for (auto row = results.begin(); row != results.end(); ++row) {
std::string line;
unsigned int fields = results.ColumnCount();
for (unsigned int i = 0; i < fields; ++i) {
if (i != 0) {
if(results.Success()) {
for (auto row = results.begin(); row != results.end(); ++row) {
std::string line;
unsigned int fields = results.ColumnCount();
for(unsigned int i = 0; i < fields; ++i) {
if(i != 0) {
line.push_back('^');
}
if (row[i] != nullptr) {
if(row[i] != nullptr) {
line += row[i];
}
}
fprintf(f, "%s\n", line.c_str());
}
}
else {
} else {
}
fclose(f);
}
bool SkillUsable(SharedDatabase *db, int skill_id, int class_id)
{
bool SkillUsable(SharedDatabase *db, int skill_id, int class_id) {
bool res = false;
std::string query = StringFormat(
"SELECT max(cap) FROM skill_caps WHERE class=%d AND skillID=%d",
class_id, skill_id
);
auto results = db->QueryDatabase(query);
if (!results.Success()) {
return false;
}
std::string query = StringFormat("SELECT max(cap) FROM skill_caps WHERE class=%d AND skillID=%d",
class_id, skill_id);
auto results = db->QueryDatabase(query);
if(!results.Success()) {
return false;
}
if (results.RowCount() == 0) {
return false;
}
if (results.RowCount() == 0)
return false;
auto row = results.begin();
if (row[0] && atoi(row[0]) > 0) {
return true;
}
auto row = results.begin();
if(row[0] && atoi(row[0]) > 0)
return true;
return false;
return false;
}
int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level)
{
int GetSkill(SharedDatabase *db, int skill_id, int class_id, int level) {
std::string query = StringFormat(
"SELECT cap FROM skill_caps WHERE class=%d AND skillID=%d AND level=%d",
class_id, skill_id, level
);
auto results = db->QueryDatabase(query);
if (!results.Success()) {
return 0;
}
std::string query = StringFormat("SELECT cap FROM skill_caps WHERE class=%d AND skillID=%d AND level=%d",
class_id, skill_id, level);
auto results = db->QueryDatabase(query);
if (!results.Success()) {
return 0;
}
if (results.RowCount() == 0) {
return 0;
}
if (results.RowCount() == 0)
return 0;
auto row = results.begin();
auto row = results.begin();
return atoi(row[0]);
}
void ExportSkillCaps(SharedDatabase *db)
{
void ExportSkillCaps(SharedDatabase *db) {
LogInfo("Exporting Skill Caps");
FILE *f = fopen("export/SkillCaps.txt", "w");
if (!f) {
if(!f) {
LogError("Unable to open export/SkillCaps.txt to write, skipping.");
return;
}
for (int cl = 1; cl <= 16; ++cl) {
for (int skill = 0; skill <= 77; ++skill) {
if (SkillUsable(db, skill, cl)) {
int previous_cap = 0;
for (int level = 1; level <= 100; ++level) {
for(int cl = 1; cl <= 16; ++cl) {
for(int skill = 0; skill <= 77; ++skill) {
if(SkillUsable(db, skill, cl)) {
int previous_cap = 0;
for(int level = 1; level <= 100; ++level) {
int cap = GetSkill(db, skill, cl, level);
if (cap < previous_cap) {
if(cap < previous_cap) {
cap = previous_cap;
}
@@ -231,28 +192,26 @@ void ExportSkillCaps(SharedDatabase *db)
fclose(f);
}
void ExportBaseData(SharedDatabase *db)
{
void ExportBaseData(SharedDatabase *db) {
LogInfo("Exporting Base Data");
FILE *f = fopen("export/BaseData.txt", "w");
if (!f) {
if(!f) {
LogError("Unable to open export/BaseData.txt to write, skipping.");
return;
}
const std::string query = "SELECT * FROM base_data ORDER BY level, class";
auto results = db->QueryDatabase(query);
if (results.Success()) {
for (auto row = results.begin(); row != results.end(); ++row) {
std::string line;
unsigned int fields = results.ColumnCount();
for (unsigned int rowIndex = 0; rowIndex < fields; ++rowIndex) {
if (rowIndex != 0) {
const std::string query = "SELECT * FROM base_data ORDER BY level, class";
auto results = db->QueryDatabase(query);
if(results.Success()) {
for (auto row = results.begin();row != results.end();++row) {
std::string line;
unsigned int fields = results.ColumnCount();
for(unsigned int rowIndex = 0; rowIndex < fields; ++rowIndex) {
if(rowIndex != 0)
line.push_back('^');
}
if (row[rowIndex] != nullptr) {
if(row[rowIndex] != nullptr) {
line += row[rowIndex];
}
}
@@ -264,29 +223,27 @@ void ExportBaseData(SharedDatabase *db)
fclose(f);
}
void ExportDBStrings(SharedDatabase *db)
{
void ExportDBStrings(SharedDatabase *db) {
LogInfo("Exporting DB Strings");
FILE *f = fopen("export/dbstr_us.txt", "w");
if (!f) {
if(!f) {
LogError("Unable to open export/dbstr_us.txt to write, skipping.");
return;
}
fprintf(f, "Major^Minor^String(New)\n");
const std::string query = "SELECT * FROM db_str ORDER BY id, type";
auto results = db->QueryDatabase(query);
if (results.Success()) {
for (auto row = results.begin(); row != results.end(); ++row) {
std::string line;
unsigned int fields = results.ColumnCount();
for (unsigned int rowIndex = 0; rowIndex < fields; ++rowIndex) {
if (rowIndex != 0) {
const std::string query = "SELECT * FROM db_str ORDER BY id, type";
auto results = db->QueryDatabase(query);
if(results.Success()) {
for(auto row = results.begin(); row != results.end(); ++row) {
std::string line;
unsigned int fields = results.ColumnCount();
for(unsigned int rowIndex = 0; rowIndex < fields; ++rowIndex) {
if(rowIndex != 0)
line.push_back('^');
}
if (row[rowIndex] != nullptr) {
if(row[rowIndex] != nullptr) {
line += row[rowIndex];
}
}
+10 -36
View File
@@ -24,10 +24,8 @@
#include "../../common/crash.h"
#include "../../common/rulesys.h"
#include "../../common/string_util.h"
#include "../../common/content/world_content_service.h"
EQEmuLogSys LogSys;
WorldContentService content_service;
void ImportSpells(SharedDatabase *db);
void ImportSkillCaps(SharedDatabase *db);
@@ -48,48 +46,24 @@ int main(int argc, char **argv) {
auto Config = EQEmuConfig::get();
SharedDatabase database;
SharedDatabase content_db;
LogInfo("Connecting to database");
if (!database.Connect(
Config->DatabaseHost.c_str(),
Config->DatabaseUsername.c_str(),
Config->DatabasePassword.c_str(),
Config->DatabaseDB.c_str(),
Config->DatabasePort
)) {
LogError("Unable to connect to the database, cannot continue without a database connection");
if(!database.Connect(Config->DatabaseHost.c_str(), Config->DatabaseUsername.c_str(),
Config->DatabasePassword.c_str(), Config->DatabaseDB.c_str(), Config->DatabasePort)) {
LogError("Unable to connect to the database, cannot continue without a "
"database connection");
return 1;
}
/**
* Multi-tenancy: Content database
*/
if (!Config->ContentDbHost.empty()) {
if (!content_db.Connect(
Config->ContentDbHost.c_str() ,
Config->ContentDbUsername.c_str(),
Config->ContentDbPassword.c_str(),
Config->ContentDbName.c_str(),
Config->ContentDbPort
)) {
LogError("Cannot continue without a content database connection");
return 1;
}
} else {
content_db.SetMysql(database.getMySQL());
}
database.LoadLogSettings(LogSys.log_settings);
LogSys.StartFileLogs();
ImportSpells(&content_db);
ImportSkillCaps(&content_db);
ImportBaseData(&content_db);
ImportSpells(&database);
ImportSkillCaps(&database);
ImportBaseData(&database);
ImportDBStrings(&database);
LogSys.CloseFileLogs();
return 0;
}
@@ -326,10 +300,10 @@ void ImportDBStrings(SharedDatabase *db) {
std::string sql;
int id, type;
std::string value;
id = atoi(split[0].c_str());
type = atoi(split[1].c_str());
if(split.size() >= 3) {
value = ::EscapeString(split[2]);
}
+2 -2
View File
@@ -38,7 +38,7 @@ locations other than lua/
find_path(LUA_INCLUDE_DIR lua.h
HINTS
ENV LUA_DIR
PATH_SUFFIXES include/lua51 include/lua5.1 include/lua-5.1 include/lua include
PATH_SUFFIXES include/lua51 include/lua5.1 include/lua-5.1 include/lua include/luajit include
PATHS
~/Library/Frameworks
/Library/Frameworks
@@ -49,7 +49,7 @@ find_path(LUA_INCLUDE_DIR lua.h
)
find_library(LUA_LIBRARY
NAMES lua51 lua5.1 lua-5.1 lua
NAMES lua51 lua5.1 lua-5.1 lua luajit
HINTS
ENV LUA_DIR
PATH_SUFFIXES lib
-91
View File
@@ -1,91 +0,0 @@
# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
# Modified from the FindLua51 that comes with CMake
#[=======================================================================[.rst:
FindLuaJit
---------
Locate LuaJit library This module defines
::
LUAJIT_FOUND, if false, do not try to link to Lua
LUAJIT_LIBRARIES
LUAJIT_INCLUDE_DIR, where to find lua.h
LUAJIT_VERSION_STRING, the version of Lua found (since CMake 2.8.8)
Note that the expected include convention is
::
#include "lua.h"
and not
::
#include <lua/lua.h>
This is because, the lua location is not standardized and may exist in
locations other than lua/
#]=======================================================================]
find_path(LUAJIT_INCLUDE_DIR lua.h
HINTS
ENV LUA_DIR
PATH_SUFFIXES include/luajit include/luajit-2.0 include/luajit-2.1
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw # Fink
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
)
find_library(LUAJIT_LIBRARY
NAMES luajit51 luajit5.1 luajit-5.1 luajit
HINTS
ENV LUA_DIR
PATH_SUFFIXES lib
PATHS
~/Library/Frameworks
/Library/Frameworks
/sw
/opt/local
/opt/csw
/opt
)
if(LUAJIT_LIBRARY)
# include the math library for Unix
if(UNIX AND NOT APPLE AND NOT BEOS AND NOT HAIKU)
find_library(LUAJIT_MATH_LIBRARY m)
set( LUAJIT_LIBRARIES "${LUAJIT_LIBRARY};${LUAJIT_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
# For Windows and Mac, don't need to explicitly include the math library
else()
set( LUAJIT_LIBRARIES "${LUAJIT_LIBRARY}" CACHE STRING "Lua Libraries")
endif()
endif()
if(LUAJIT_INCLUDE_DIR AND EXISTS "${LUAJIT_INCLUDE_DIR}/lua.h")
file(STRINGS "${LUAJIT_INCLUDE_DIR}/lua.h" lua_version_str REGEX "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua .+\"")
string(REGEX REPLACE "^#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([^\"]+)\".*" "\\1" LUAJIT_VERSION_STRING "${lua_version_str}")
unset(lua_version_str)
endif()
include(${CMAKE_ROOT}/Modules/FindPackageHandleStandardArgs.cmake)
# handle the QUIETLY and REQUIRED arguments and set LUAJIT_FOUND to TRUE if
# all listed variables are TRUE
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LuaJit
REQUIRED_VARS LUAJIT_LIBRARIES LUAJIT_INCLUDE_DIR
VERSION_VAR LUAJIT_VERSION_STRING)
mark_as_advanced(LUAJIT_INCLUDE_DIR LUAJIT_LIBRARIES LUAJIT_LIBRARY LUAJIT_MATH_LIBRARY)
+1 -338
View File
@@ -6,7 +6,6 @@ SET(common_sources
cli/eqemu_command_handler.cpp
compression.cpp
condition.cpp
content/world_content_service.cpp
crash.cpp
crc16.cpp
crc32.cpp
@@ -109,341 +108,6 @@ SET(common_sources
util/directory.cpp
util/uuid.cpp)
SET(repositories
# Criteria
repositories/criteria/content_filter_criteria.h
# Base Repositories
repositories/base/base_aa_ability_repository.h
repositories/base/base_aa_ranks_repository.h
repositories/base/base_aa_rank_effects_repository.h
repositories/base/base_aa_rank_prereqs_repository.h
repositories/base/base_account_repository.h
repositories/base/base_account_flags_repository.h
repositories/base/base_account_ip_repository.h
repositories/base/base_account_rewards_repository.h
repositories/base/base_adventure_details_repository.h
repositories/base/base_adventure_members_repository.h
repositories/base/base_adventure_stats_repository.h
repositories/base/base_adventure_template_repository.h
repositories/base/base_adventure_template_entry_repository.h
repositories/base/base_adventure_template_entry_flavor_repository.h
repositories/base/base_alternate_currency_repository.h
repositories/base/base_auras_repository.h
repositories/base/base_base_data_repository.h
repositories/base/base_blocked_spells_repository.h
repositories/base/base_bugs_repository.h
repositories/base/base_bug_reports_repository.h
repositories/base/base_buyer_repository.h
repositories/base/base_character_activities_repository.h
repositories/base/base_character_alternate_abilities_repository.h
repositories/base/base_character_alt_currency_repository.h
repositories/base/base_character_auras_repository.h
repositories/base/base_character_bandolier_repository.h
repositories/base/base_character_bind_repository.h
repositories/base/base_character_buffs_repository.h
repositories/base/base_character_corpses_repository.h
repositories/base/base_character_corpse_items_repository.h
repositories/base/base_character_currency_repository.h
repositories/base/base_character_data_repository.h
repositories/base/base_character_disciplines_repository.h
repositories/base/base_character_expedition_lockouts_repository.h
repositories/base/base_character_inspect_messages_repository.h
repositories/base/base_character_item_recast_repository.h
repositories/base/base_character_languages_repository.h
repositories/base/base_character_leadership_abilities_repository.h
repositories/base/base_character_material_repository.h
repositories/base/base_character_memmed_spells_repository.h
repositories/base/base_character_pet_buffs_repository.h
repositories/base/base_character_pet_info_repository.h
repositories/base/base_character_pet_inventory_repository.h
repositories/base/base_character_potionbelt_repository.h
repositories/base/base_character_skills_repository.h
repositories/base/base_character_spells_repository.h
repositories/base/base_character_tasks_repository.h
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_completed_tasks_repository.h
repositories/base/base_content_flags_repository.h
repositories/base/base_damageshieldtypes_repository.h
repositories/base/base_data_buckets_repository.h
repositories/base/base_db_str_repository.h
repositories/base/base_discovered_items_repository.h
repositories/base/base_doors_repository.h
repositories/base/base_dynamic_zones_repository.h
repositories/base/base_eventlog_repository.h
repositories/base/base_expeditions_repository.h
repositories/base/base_expedition_lockouts_repository.h
repositories/base/base_expedition_members_repository.h
repositories/base/base_faction_base_data_repository.h
repositories/base/base_faction_list_repository.h
repositories/base/base_faction_list_mod_repository.h
repositories/base/base_faction_values_repository.h
repositories/base/base_fishing_repository.h
repositories/base/base_forage_repository.h
repositories/base/base_friends_repository.h
repositories/base/base_global_loot_repository.h
repositories/base/base_gm_ips_repository.h
repositories/base/base_goallists_repository.h
repositories/base/base_graveyard_repository.h
repositories/base/base_grid_repository.h
repositories/base/base_grid_entries_repository.h
repositories/base/base_ground_spawns_repository.h
repositories/base/base_group_id_repository.h
repositories/base/base_group_leaders_repository.h
repositories/base/base_guilds_repository.h
repositories/base/base_guild_members_repository.h
repositories/base/base_guild_ranks_repository.h
repositories/base/base_guild_relations_repository.h
repositories/base/base_hackers_repository.h
repositories/base/base_instance_list_repository.h
repositories/base/base_instance_list_player_repository.h
repositories/base/base_inventory_repository.h
repositories/base/base_inventory_snapshots_repository.h
repositories/base/base_ip_exemptions_repository.h
repositories/base/base_items_repository.h
repositories/base/base_item_tick_repository.h
repositories/base/base_ldon_trap_entries_repository.h
repositories/base/base_ldon_trap_templates_repository.h
repositories/base/base_level_exp_mods_repository.h
repositories/base/base_lfguild_repository.h
repositories/base/base_login_accounts_repository.h
repositories/base/base_login_api_tokens_repository.h
repositories/base/base_login_server_admins_repository.h
repositories/base/base_login_server_list_types_repository.h
repositories/base/base_login_world_servers_repository.h
repositories/base/base_logsys_categories_repository.h
repositories/base/base_lootdrop_repository.h
repositories/base/base_lootdrop_entries_repository.h
repositories/base/base_loottable_repository.h
repositories/base/base_loottable_entries_repository.h
repositories/base/base_mail_repository.h
repositories/base/base_merchantlist_repository.h
repositories/base/base_merchantlist_temp_repository.h
repositories/base/base_name_filter_repository.h
repositories/base/base_npc_emotes_repository.h
repositories/base/base_npc_faction_repository.h
repositories/base/base_npc_faction_entries_repository.h
repositories/base/base_npc_scale_global_base_repository.h
repositories/base/base_npc_spells_repository.h
repositories/base/base_npc_spells_effects_repository.h
repositories/base/base_npc_spells_effects_entries_repository.h
repositories/base/base_npc_spells_entries_repository.h
repositories/base/base_npc_types_repository.h
repositories/base/base_npc_types_tint_repository.h
repositories/base/base_object_repository.h
repositories/base/base_object_contents_repository.h
repositories/base/base_perl_event_export_settings_repository.h
repositories/base/base_petitions_repository.h
repositories/base/base_pets_repository.h
repositories/base/base_pets_equipmentset_repository.h
repositories/base/base_pets_equipmentset_entries_repository.h
repositories/base/base_player_titlesets_repository.h
repositories/base/base_proximities_repository.h
repositories/base/base_quest_globals_repository.h
repositories/base/base_raid_details_repository.h
repositories/base/base_raid_members_repository.h
repositories/base/base_reports_repository.h
repositories/base/base_respawn_times_repository.h
repositories/base/base_rule_sets_repository.h
repositories/base/base_rule_values_repository.h
repositories/base/base_saylink_repository.h
repositories/base/base_skill_caps_repository.h
repositories/base/base_spawn2_repository.h
repositories/base/base_spawnentry_repository.h
repositories/base/base_spawngroup_repository.h
repositories/base/base_spawn_conditions_repository.h
repositories/base/base_spawn_condition_values_repository.h
repositories/base/base_spawn_events_repository.h
repositories/base/base_spells_new_repository.h
repositories/base/base_spell_buckets_repository.h
repositories/base/base_spell_globals_repository.h
repositories/base/base_starting_items_repository.h
repositories/base/base_start_zones_repository.h
repositories/base/base_tasks_repository.h
repositories/base/base_tasksets_repository.h
repositories/base/base_task_activities_repository.h
repositories/base/base_timers_repository.h
repositories/base/base_titles_repository.h
repositories/base/base_trader_repository.h
repositories/base/base_tradeskill_recipe_repository.h
repositories/base/base_tradeskill_recipe_entries_repository.h
repositories/base/base_traps_repository.h
repositories/base/base_tributes_repository.h
repositories/base/base_tribute_levels_repository.h
repositories/base/base_veteran_reward_templates_repository.h
repositories/base/base_zone_repository.h
repositories/base/base_zone_points_repository.h
# Extended Repositories
repositories/aa_ability_repository.h
repositories/aa_ranks_repository.h
repositories/aa_rank_effects_repository.h
repositories/aa_rank_prereqs_repository.h
repositories/account_repository.h
repositories/account_flags_repository.h
repositories/account_ip_repository.h
repositories/account_rewards_repository.h
repositories/adventure_details_repository.h
repositories/adventure_members_repository.h
repositories/adventure_stats_repository.h
repositories/adventure_template_repository.h
repositories/adventure_template_entry_repository.h
repositories/adventure_template_entry_flavor_repository.h
repositories/alternate_currency_repository.h
repositories/auras_repository.h
repositories/base_data_repository.h
repositories/blocked_spells_repository.h
repositories/bugs_repository.h
repositories/bug_reports_repository.h
repositories/buyer_repository.h
repositories/character_activities_repository.h
repositories/character_alternate_abilities_repository.h
repositories/character_alt_currency_repository.h
repositories/character_auras_repository.h
repositories/character_bandolier_repository.h
repositories/character_bind_repository.h
repositories/character_buffs_repository.h
repositories/character_corpses_repository.h
repositories/character_corpse_items_repository.h
repositories/character_currency_repository.h
repositories/character_data_repository.h
repositories/character_disciplines_repository.h
repositories/character_expedition_lockouts_repository.h
repositories/character_inspect_messages_repository.h
repositories/character_item_recast_repository.h
repositories/character_languages_repository.h
repositories/character_leadership_abilities_repository.h
repositories/character_material_repository.h
repositories/character_memmed_spells_repository.h
repositories/character_pet_buffs_repository.h
repositories/character_pet_info_repository.h
repositories/character_pet_inventory_repository.h
repositories/character_potionbelt_repository.h
repositories/character_skills_repository.h
repositories/character_spells_repository.h
repositories/character_tasks_repository.h
repositories/char_create_combinations_repository.h
repositories/char_create_point_allocations_repository.h
repositories/char_recipe_list_repository.h
repositories/completed_tasks_repository.h
repositories/content_flags_repository.h
repositories/damageshieldtypes_repository.h
repositories/data_buckets_repository.h
repositories/db_str_repository.h
repositories/discovered_items_repository.h
repositories/doors_repository.h
repositories/dynamic_zones_repository.h
repositories/eventlog_repository.h
repositories/expeditions_repository.h
repositories/expedition_lockouts_repository.h
repositories/expedition_members_repository.h
repositories/faction_base_data_repository.h
repositories/faction_list_repository.h
repositories/faction_list_mod_repository.h
repositories/faction_values_repository.h
repositories/fishing_repository.h
repositories/forage_repository.h
repositories/friends_repository.h
repositories/global_loot_repository.h
repositories/gm_ips_repository.h
repositories/goallists_repository.h
repositories/graveyard_repository.h
repositories/grid_repository.h
repositories/grid_entries_repository.h
repositories/ground_spawns_repository.h
repositories/group_id_repository.h
repositories/group_leaders_repository.h
repositories/guilds_repository.h
repositories/guild_members_repository.h
repositories/guild_ranks_repository.h
repositories/guild_relations_repository.h
repositories/hackers_repository.h
repositories/instance_list_repository.h
repositories/instance_list_player_repository.h
repositories/inventory_repository.h
repositories/inventory_snapshots_repository.h
repositories/ip_exemptions_repository.h
repositories/items_repository.h
repositories/item_tick_repository.h
repositories/ldon_trap_entries_repository.h
repositories/ldon_trap_templates_repository.h
repositories/level_exp_mods_repository.h
repositories/lfguild_repository.h
repositories/login_accounts_repository.h
repositories/login_api_tokens_repository.h
repositories/login_server_admins_repository.h
repositories/login_server_list_types_repository.h
repositories/login_world_servers_repository.h
repositories/logsys_categories_repository.h
repositories/lootdrop_repository.h
repositories/lootdrop_entries_repository.h
repositories/loottable_repository.h
repositories/loottable_entries_repository.h
repositories/mail_repository.h
repositories/merchantlist_repository.h
repositories/merchantlist_temp_repository.h
repositories/name_filter_repository.h
repositories/npc_emotes_repository.h
repositories/npc_faction_repository.h
repositories/npc_faction_entries_repository.h
repositories/npc_scale_global_base_repository.h
repositories/npc_spells_repository.h
repositories/npc_spells_effects_repository.h
repositories/npc_spells_effects_entries_repository.h
repositories/npc_spells_entries_repository.h
repositories/npc_types_repository.h
repositories/npc_types_tint_repository.h
repositories/object_repository.h
repositories/object_contents_repository.h
repositories/perl_event_export_settings_repository.h
repositories/petitions_repository.h
repositories/pets_repository.h
repositories/pets_equipmentset_repository.h
repositories/pets_equipmentset_entries_repository.h
repositories/player_titlesets_repository.h
repositories/proximities_repository.h
repositories/quest_globals_repository.h
repositories/raid_details_repository.h
repositories/raid_members_repository.h
repositories/reports_repository.h
repositories/respawn_times_repository.h
repositories/rule_sets_repository.h
repositories/rule_values_repository.h
repositories/saylink_repository.h
repositories/skill_caps_repository.h
repositories/spawn2_repository.h
repositories/spawnentry_repository.h
repositories/spawngroup_repository.h
repositories/spawn_conditions_repository.h
repositories/spawn_condition_values_repository.h
repositories/spawn_events_repository.h
repositories/spells_new_repository.h
repositories/spell_buckets_repository.h
repositories/spell_globals_repository.h
repositories/starting_items_repository.h
repositories/start_zones_repository.h
repositories/tasks_repository.h
repositories/tasksets_repository.h
repositories/task_activities_repository.h
repositories/timers_repository.h
repositories/titles_repository.h
repositories/trader_repository.h
repositories/tradeskill_recipe_repository.h
repositories/tradeskill_recipe_entries_repository.h
repositories/traps_repository.h
repositories/tributes_repository.h
repositories/tribute_levels_repository.h
repositories/veteran_reward_templates_repository.h
repositories/zone_repository.h
repositories/zone_points_repository.h
# Non-Comformative
repositories/character_recipe_list_repository.h
)
SET(common_headers
any.h
base_packet.h
@@ -452,7 +116,6 @@ SET(common_headers
classes.h
compression.h
condition.h
content/world_content_service.h
crash.h
crc16.h
crc32.h
@@ -717,7 +380,7 @@ SOURCE_GROUP(Util FILES
INCLUDE_DIRECTORIES(Patches SocketLib StackWalker)
ADD_LIBRARY(common ${common_sources} ${common_headers} ${repositories})
ADD_LIBRARY(common ${common_sources} ${common_headers})
IF(UNIX)
SET_SOURCE_FILES_PROPERTIES("SocketLib/Mime.cpp" PROPERTY COMPILE_FLAGS -Wno-unused-result)
-14
View File
@@ -378,8 +378,6 @@ const char *GetClassIDName(uint8 class_id, uint8 level)
return "Berserker Guildmaster";
case MERCHANT:
return "Merchant";
case DISCORD_MERCHANT:
return "Discord Merchant";
case ADVENTURERECRUITER:
return "Adventure Recruiter";
case ADVENTUREMERCHANT:
@@ -390,18 +388,6 @@ const char *GetClassIDName(uint8 class_id, uint8 level)
return "Tribute Master";
case GUILD_TRIBUTE_MASTER:
return "Guild Tribute Master";
case GUILD_BANKER:
return "Guild Banker";
case NORRATHS_KEEPERS_MERCHANT:
return "Radiant Crystal Merchant";
case DARK_REIGN_MERCHANT:
return "Ebon Crystal Merchant";
case FELLOWSHIP_MASTER:
return "Fellowship Master";
case ALT_CURRENCY_MERCHANT:
return "Alternate Currency Merchant";
case MERCERNARY_MASTER:
return "Mercenary Liaison";
default:
return "Unknown";
}
-1
View File
@@ -61,7 +61,6 @@
#define CORPSE_CLASS 62 // only seen on Danvi's Corpse in Akheva so far..
#define TRIBUTE_MASTER 63
#define GUILD_TRIBUTE_MASTER 64 // not sure
#define GUILD_BANKER 66
#define NORRATHS_KEEPERS_MERCHANT 67
#define DARK_REIGN_MERCHANT 68
#define FELLOWSHIP_MASTER 69
+4 -9
View File
@@ -77,7 +77,7 @@ namespace EQEmuCommand {
index++;
}
if (!arguments_filled || argc == 2 || cmd[{"-h", "--help"}]) {
if (!arguments_filled || argc == 2) {
std::string arguments_string;
for (auto &arg : arguments) {
arguments_string += " " + arg;
@@ -101,7 +101,7 @@ namespace EQEmuCommand {
std::cout << command_string.str() << std::endl;
exit(0);
exit(1);
}
}
@@ -168,11 +168,6 @@ namespace EQEmuCommand {
* Print section header
*/
std::string command_prefix = it.first.substr(0, it.first.find(":"));
if (command_prefix.find("test") != std::string::npos) {
continue;
}
if (command_section != command_prefix) {
command_section = command_prefix;
std::cout << termcolor::reset << command_prefix << std::endl;
@@ -188,11 +183,11 @@ namespace EQEmuCommand {
std::cout << std::endl;
std::exit(0);
std::exit(1);
}
if (ran_command) {
std::exit(0);
std::exit(1);
}
}
-101
View File
@@ -1,101 +0,0 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2019 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#include "world_content_service.h"
#include "../database.h"
#include "../rulesys.h"
#include "../eqemu_logsys.h"
WorldContentService::WorldContentService()
{
SetCurrentExpansion(Expansion::EXPANSION_ALL);
}
int WorldContentService::GetCurrentExpansion() const
{
return current_expansion;
}
void WorldContentService::SetExpansionContext()
{
int expansion = RuleI(Expansion, CurrentExpansion);
if (expansion >= Expansion::Classic && expansion <= Expansion::MaxId) {
content_service.SetCurrentExpansion(expansion);
}
LogInfo(
"Current expansion is [{}] ({})",
GetCurrentExpansion(),
GetCurrentExpansionName()
);
}
std::string WorldContentService::GetCurrentExpansionName()
{
if (content_service.GetCurrentExpansion() == Expansion::EXPANSION_ALL) {
return "All Expansions";
}
if (current_expansion >= Expansion::Classic && current_expansion <= Expansion::MaxId) {
return Expansion::ExpansionName[content_service.GetCurrentExpansion()];
}
return "Unknown Expansion";
}
/**
* @param current_expansion
*/
void WorldContentService::SetCurrentExpansion(int current_expansion)
{
WorldContentService::current_expansion = current_expansion;
}
/**
* @return
*/
const std::vector<std::string> &WorldContentService::GetContentFlags() const
{
return content_flags;
}
/**
* @param content_flags
*/
void WorldContentService::SetContentFlags(std::vector<std::string> content_flags)
{
WorldContentService::content_flags = content_flags;
}
/**
* @param content_flag
* @return
*/
bool WorldContentService::IsContentFlagEnabled(const std::string& content_flag)
{
for (auto &flag : GetContentFlags()) {
if (flag == content_flag) {
return true;
}
}
return false;
}
-173
View File
@@ -1,173 +0,0 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2019 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_WORLD_CONTENT_SERVICE_H
#define EQEMU_WORLD_CONTENT_SERVICE_H
#include <string>
#include <vector>
namespace Expansion {
static const int EXPANSION_ALL = -1;
static const int EXPANSION_FILTER_MAX = 99;
enum ExpansionNumber {
Classic = 0,
TheRuinsOfKunark,
TheScarsOfVelious,
TheShadowsOfLuclin,
ThePlanesOfPower,
TheLegacyOfYkesha,
LostDungeonsOfNorrath,
GatesOfDiscord,
OmensOfWar,
DragonsOfNorrath,
DepthsOfDarkhollow,
ProphecyOfRo,
TheSerpentsSpine,
TheBuriedSea,
SecretsOfFaydwer,
SeedsOfDestruction,
Underfoot,
HouseOfThule,
VeilOfAlaris,
RainOfFear,
CallOfTheForsaken,
TheDarkendSea,
TheBrokenMirror,
EmpiresOfKunark,
RingOfScale,
TheBurningLands,
TormentOfVelious,
MaxId
};
/**
* If you add to this, make sure you update LogCategory
*/
static const char *ExpansionName[ExpansionNumber::MaxId] = {
"Classic",
"The Ruins of Kunark",
"The Scars of Velious",
"The Shadows of Luclin",
"The Planes of Power",
"The Legacy of Ykesha",
"Lost Dungeons of Norrath",
"Gates of Discord",
"Omens of War",
"Dragons of Norrath",
"Depths of Darkhollow",
"Prophecy of Ro",
"The Serpent's Spine",
"The Buried Sea",
"Secrets of Faydwer",
"Seeds of Destruction",
"Underfoot",
"House of Thule",
"Veil of Alaris",
"Rain of Fear",
"Call of the Forsaken",
"The Darkened Sea",
"The Broken Mirror",
"Empires of Kunark",
"Ring of Scale",
"The Burning Lands",
"Torment of Velious",
};
}
class WorldContentService {
public:
WorldContentService();
std::string GetCurrentExpansionName();
int GetCurrentExpansion() const;
void SetCurrentExpansion(int current_expansion);
bool IsClassicEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::Classic || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTheRuinsOfKunarkEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheRuinsOfKunark || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTheScarsOfVeliousEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheScarsOfVelious || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTheShadowsOfLuclinEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheShadowsOfLuclin || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsThePlanesOfPowerEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::ThePlanesOfPower || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTheLegacyOfYkeshaEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheLegacyOfYkesha || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsLostDungeonsOfNorrathEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::LostDungeonsOfNorrath || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsGatesOfDiscordEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::GatesOfDiscord || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsOmensOfWarEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::OmensOfWar || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsDragonsOfNorrathEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::DragonsOfNorrath || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsDepthsOfDarkhollowEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::DepthsOfDarkhollow || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsProphecyOfRoEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::ProphecyOfRo || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTheSerpentsSpineEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheSerpentsSpine || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTheBuriedSeaEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheBuriedSea || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsSecretsOfFaydwerEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::SecretsOfFaydwer || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsSeedsOfDestructionEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::SeedsOfDestruction || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsUnderfootEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::Underfoot || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsHouseOfThuleEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::HouseOfThule || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsVeilOfAlarisEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::VeilOfAlaris || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsRainOfFearEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::RainOfFear || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsCallOfTheForsakenEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::CallOfTheForsaken || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTheDarkendSeaEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheDarkendSea || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTheBrokenMirrorEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheBrokenMirror || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsEmpiresOfKunarkEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::EmpiresOfKunark || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsRingOfScaleEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::RingOfScale || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTheBurningLandsEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TheBurningLands || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsTormentOfVeliousEnabled() { return GetCurrentExpansion() >= Expansion::ExpansionNumber::TormentOfVelious || GetCurrentExpansion() == Expansion::EXPANSION_ALL; }
bool IsCurrentExpansionClassic() { return current_expansion == Expansion::ExpansionNumber::Classic; }
bool IsCurrentExpansionTheRuinsOfKunark() { return current_expansion == Expansion::ExpansionNumber::TheRuinsOfKunark; }
bool IsCurrentExpansionTheScarsOfVelious() { return current_expansion == Expansion::ExpansionNumber::TheScarsOfVelious; }
bool IsCurrentExpansionTheShadowsOfLuclin() { return current_expansion == Expansion::ExpansionNumber::TheShadowsOfLuclin; }
bool IsCurrentExpansionThePlanesOfPower() { return current_expansion == Expansion::ExpansionNumber::ThePlanesOfPower; }
bool IsCurrentExpansionTheLegacyOfYkesha() { return current_expansion == Expansion::ExpansionNumber::TheLegacyOfYkesha; }
bool IsCurrentExpansionLostDungeonsOfNorrath() { return current_expansion == Expansion::ExpansionNumber::LostDungeonsOfNorrath; }
bool IsCurrentExpansionGatesOfDiscord() { return current_expansion == Expansion::ExpansionNumber::GatesOfDiscord; }
bool IsCurrentExpansionOmensOfWar() { return current_expansion == Expansion::ExpansionNumber::OmensOfWar; }
bool IsCurrentExpansionDragonsOfNorrath() { return current_expansion == Expansion::ExpansionNumber::DragonsOfNorrath; }
bool IsCurrentExpansionDepthsOfDarkhollow() { return current_expansion == Expansion::ExpansionNumber::DepthsOfDarkhollow; }
bool IsCurrentExpansionProphecyOfRo() { return current_expansion == Expansion::ExpansionNumber::ProphecyOfRo; }
bool IsCurrentExpansionTheSerpentsSpine() { return current_expansion == Expansion::ExpansionNumber::TheSerpentsSpine; }
bool IsCurrentExpansionTheBuriedSea() { return current_expansion == Expansion::ExpansionNumber::TheBuriedSea; }
bool IsCurrentExpansionSecretsOfFaydwer() { return current_expansion == Expansion::ExpansionNumber::SecretsOfFaydwer; }
bool IsCurrentExpansionSeedsOfDestruction() { return current_expansion == Expansion::ExpansionNumber::SeedsOfDestruction; }
bool IsCurrentExpansionUnderfoot() { return current_expansion == Expansion::ExpansionNumber::Underfoot; }
bool IsCurrentExpansionHouseOfThule() { return current_expansion == Expansion::ExpansionNumber::HouseOfThule; }
bool IsCurrentExpansionVeilOfAlaris() { return current_expansion == Expansion::ExpansionNumber::VeilOfAlaris; }
bool IsCurrentExpansionRainOfFear() { return current_expansion == Expansion::ExpansionNumber::RainOfFear; }
bool IsCurrentExpansionCallOfTheForsaken() { return current_expansion == Expansion::ExpansionNumber::CallOfTheForsaken; }
bool IsCurrentExpansionTheDarkendSea() { return current_expansion == Expansion::ExpansionNumber::TheDarkendSea; }
bool IsCurrentExpansionTheBrokenMirror() { return current_expansion == Expansion::ExpansionNumber::TheBrokenMirror; }
bool IsCurrentExpansionEmpiresOfKunark() { return current_expansion == Expansion::ExpansionNumber::EmpiresOfKunark; }
bool IsCurrentExpansionRingOfScale() { return current_expansion == Expansion::ExpansionNumber::RingOfScale; }
bool IsCurrentExpansionTheBurningLands() { return current_expansion == Expansion::ExpansionNumber::TheBurningLands; }
bool IsCurrentExpansionTormentOfVelious() { return current_expansion == Expansion::ExpansionNumber::TormentOfVelious; }
private:
int current_expansion{};
std::vector<std::string> content_flags;
public:
const std::vector<std::string> &GetContentFlags() const;
bool IsContentFlagEnabled(const std::string& content_flag);
void SetContentFlags(std::vector<std::string> content_flags);
void SetExpansionContext();
};
extern WorldContentService content_service;
#endif //EQEMU_WORLD_CONTENT_SERVICE_H
+202 -243
View File
@@ -61,15 +61,15 @@ Database::Database(const char* host, const char* user, const char* passwd, const
Connect(host, user, passwd, database, port);
}
bool Database::Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port, std::string connection_label) {
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("[MySQL] Connection [{}] Failed to connect to database: Error [{}]", connection_label, errbuf);
LogError("Failed to connect to database: Error: {}", errbuf);
return false;
}
else {
LogInfo("[MySQL] Connection [{}] database [{}] at [{}]:[{}]", connection_label, database, host,port);
LogInfo("Using database [{}] at [{}]:[{}]", database, host,port);
return true;
}
}
@@ -339,7 +339,7 @@ bool Database::ReserveName(uint32 account_id, char* name) {
query = StringFormat("INSERT INTO `character_data` SET `account_id` = %i, `name` = '%s'", account_id, name);
results = QueryDatabase(query);
if (!results.Success() || results.ErrorMessage() != ""){ return false; }
// Put character into the default guild if rule is being used.
int guild_id = RuleI(Character, DefaultGuild);
@@ -353,7 +353,7 @@ bool Database::ReserveName(uint32 account_id, char* name) {
}
}
}
return true;
}
@@ -512,96 +512,96 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
"guild_auto_consent,"
"RestTimer) "
"VALUES ("
"%u," // id
"%u," // account_id
"'%s'," // `name`
"'%s'," // last_name
"%u," // gender
"%u," // race
"%u," // class
"%u," // `level`
"%u," // deity
"%u," // birthday
"%u," // last_login
"%u," // time_played
"%u," // pvp_status
"%u," // level2
"%u," // anon
"%u," // gm
"%u," // intoxication
"%u," // hair_color
"%u," // beard_color
"%u," // eye_color_1
"%u," // eye_color_2
"%u," // hair_style
"%u," // beard
"%u," // ability_time_seconds
"%u," // ability_number
"%u," // ability_time_minutes
"%u," // ability_time_hours
"'%s'," // title
"'%s'," // suffix
"%u," // exp
"%u," // points
"%u," // mana
"%u," // cur_hp
"%u," // str
"%u," // sta
"%u," // cha
"%u," // dex
"%u," // `int`
"%u," // agi
"%u," // wis
"%u," // face
"%f," // y
"%f," // x
"%f," // z
"%f," // heading
"%u," // pvp2
"%u," // pvp_type
"%u," // autosplit_enabled
"%u," // zone_change_count
"%u," // drakkin_heritage
"%u," // drakkin_tattoo
"%u," // drakkin_details
"%i," // toxicity
"%i," // hunger_level
"%i," // thirst_level
"%u," // ability_up
"%u," // zone_id
"%u," // zone_instance
"%u," // leadership_exp_on
"%u," // ldon_points_guk
"%u," // ldon_points_mir
"%u," // ldon_points_mmc
"%u," // ldon_points_ruj
"%u," // ldon_points_tak
"%u," // ldon_points_available
"%u," // id
"%u," // account_id
"'%s'," // `name`
"'%s'," // last_name
"%u," // gender
"%u," // race
"%u," // class
"%u," // `level`
"%u," // deity
"%u," // birthday
"%u," // last_login
"%u," // time_played
"%u," // pvp_status
"%u," // level2
"%u," // anon
"%u," // gm
"%u," // intoxication
"%u," // hair_color
"%u," // beard_color
"%u," // eye_color_1
"%u," // eye_color_2
"%u," // hair_style
"%u," // beard
"%u," // ability_time_seconds
"%u," // ability_number
"%u," // ability_time_minutes
"%u," // ability_time_hours
"'%s'," // title
"'%s'," // suffix
"%u," // exp
"%u," // points
"%u," // mana
"%u," // cur_hp
"%u," // str
"%u," // sta
"%u," // cha
"%u," // dex
"%u," // `int`
"%u," // agi
"%u," // wis
"%u," // face
"%f," // y
"%f," // x
"%f," // z
"%f," // heading
"%u," // pvp2
"%u," // pvp_type
"%u," // autosplit_enabled
"%u," // zone_change_count
"%u," // drakkin_heritage
"%u," // drakkin_tattoo
"%u," // drakkin_details
"%i," // toxicity
"%i," // hunger_level
"%i," // thirst_level
"%u," // ability_up
"%u," // zone_id
"%u," // zone_instance
"%u," // leadership_exp_on
"%u," // ldon_points_guk
"%u," // ldon_points_mir
"%u," // ldon_points_mmc
"%u," // ldon_points_ruj
"%u," // ldon_points_tak
"%u," // ldon_points_available
"%u," // tribute_time_remaining
"%u," // show_helm
"%u," // career_tribute_points
"%u," // tribute_points
"%u," // tribute_active
"%u," // endurance
"%u," // group_leadership_exp
"%u," // raid_leadership_exp
"%u," // show_helm
"%u," // career_tribute_points
"%u," // tribute_points
"%u," // tribute_active
"%u," // endurance
"%u," // group_leadership_exp
"%u," // raid_leadership_exp
"%u," // group_leadership_point
"%u," // raid_leadership_points
"%u," // air_remaining
"%u," // pvp_kills
"%u," // pvp_deaths
"%u," // pvp_current_points
"%u," // pvp_career_points
"%u," // pvp_best_kill_streak
"%u," // air_remaining
"%u," // pvp_kills
"%u," // pvp_deaths
"%u," // pvp_current_points
"%u," // pvp_career_points
"%u," // pvp_best_kill_streak
"%u," // pvp_worst_death_streak
"%u," // pvp_current_kill_strea
"%u," // aa_points_spent
"%u," // aa_exp
"%u," // aa_points
"%u," // group_auto_consent
"%u," // raid_auto_consent
"%u," // guild_auto_consent
"%u" // RestTimer
"%u," // aa_points_spent
"%u," // aa_exp
"%u," // aa_points
"%u," // group_auto_consent
"%u," // raid_auto_consent
"%u," // guild_auto_consent
"%u" // RestTimer
")",
character_id, // " id, "
account_id, // " account_id, "
@@ -750,6 +750,61 @@ bool Database::SaveCharacterCreate(uint32 character_id, uint32 account_id, Playe
return true;
}
/* This only for new Character creation storing */
bool Database::StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, EQ::InventoryProfile* inv) {
uint32 charid = 0;
char zone[50];
float x, y, z;
charid = GetCharacterID(pp->name);
if(!charid) {
LogError("StoreCharacter: no character id");
return false;
}
const char *zname = GetZoneName(pp->zone_id);
if(zname == nullptr) {
/* Zone not in the DB, something to prevent crash... */
strn0cpy(zone, "qeynos", 49);
pp->zone_id = 1;
}
else{ strn0cpy(zone, zname, 49); }
x = pp->x;
y = pp->y;
z = pp->z;
/* Saves Player Profile Data */
SaveCharacterCreate(charid, account_id, pp);
/* Insert starting inventory... */
std::string invquery;
for (int16 i = EQ::invslot::EQUIPMENT_BEGIN; i <= EQ::invbag::BANK_BAGS_END;) {
const EQ::ItemInstance* newinv = inv->GetItem(i);
if (newinv) {
invquery = StringFormat("INSERT INTO `inventory` (charid, slotid, itemid, charges, color) VALUES (%u, %i, %u, %i, %u)",
charid, i, newinv->GetItem()->ID, newinv->GetCharges(), newinv->GetColor());
auto results = QueryDatabase(invquery);
}
if (i == EQ::invslot::slotCursor) {
i = EQ::invbag::GENERAL_BAGS_BEGIN;
continue;
}
else if (i == EQ::invbag::CURSOR_BAG_END) {
i = EQ::invslot::BANK_BEGIN;
continue;
}
else if (i == EQ::invslot::BANK_END) {
i = EQ::invbag::BANK_BAGS_BEGIN;
continue;
}
i++;
}
return true;
}
uint32 Database::GetCharacterID(const char *name) {
std::string query = StringFormat("SELECT `id` FROM `character_data` WHERE `name` = '%s'", name);
auto results = QueryDatabase(query);
@@ -1082,6 +1137,50 @@ bool Database::GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zon
return true;
}
bool Database::LoadZoneNames() {
std::string query("SELECT zoneidnumber, short_name FROM zone");
auto results = QueryDatabase(query);
if (!results.Success())
{
return false;
}
for (auto row= results.begin();row != results.end();++row)
{
uint32 zoneid = atoi(row[0]);
std::string zonename = row[1];
zonename_array.insert(std::pair<uint32,std::string>(zoneid,zonename));
}
return true;
}
uint32 Database::GetZoneID(const char* zonename) {
if (zonename == nullptr)
return 0;
for (auto iter = zonename_array.begin(); iter != zonename_array.end(); ++iter)
if (strcasecmp(iter->second.c_str(), zonename) == 0)
return iter->first;
return 0;
}
const char* Database::GetZoneName(uint32 zoneID, bool ErrorUnknown) {
auto iter = zonename_array.find(zoneID);
if (iter != zonename_array.end())
return iter->second.c_str();
if (ErrorUnknown)
return "UNKNOWN";
return 0;
}
uint8 Database::GetPEQZone(uint32 zoneID, uint32 version){
std::string query = StringFormat("SELECT peqzone from zone where zoneidnumber='%i' AND (version=%i OR version=0) ORDER BY version DESC", zoneID, version);
@@ -1298,31 +1397,29 @@ uint8 Database::GetServerType() {
return atoi(row[0]);
}
bool Database::MoveCharacterToZone(uint32 character_id, uint32 zone_id)
{
std::string query = StringFormat(
"UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `id` = %i",
zone_id,
character_id
);
bool Database::MoveCharacterToZone(const char* charname, const char* zonename, uint32 zoneid) {
if(zonename == nullptr || strlen(zonename) == 0)
return false;
std::string query = StringFormat("UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `name` = '%s'", zoneid, charname);
auto results = QueryDatabase(query);
if (!results.Success()) {
return false;
}
return results.RowsAffected() != 0;
if (results.RowsAffected() == 0)
return false;
return true;
}
bool Database::MoveCharacterToZone(const char *charname, uint32 zone_id)
{
std::string query = StringFormat(
"UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `name` = '%s'",
zone_id,
charname
);
bool Database::MoveCharacterToZone(const char* charname, const char* zonename) {
return MoveCharacterToZone(charname, zonename, GetZoneID(zonename));
}
bool Database::MoveCharacterToZone(uint32 iCharID, const char* iZonename) {
std::string query = StringFormat("UPDATE `character_data` SET `zone_id` = %i, `x` = -1, `y` = -1, `z` = -1 WHERE `id` = %i", GetZoneID(iZonename), iCharID);
auto results = QueryDatabase(query);
if (!results.Success()) {
@@ -2309,141 +2406,3 @@ int Database::GetInstanceID(uint32 char_id, uint32 zone_id) {
return 0;
}
/**
* @param source_character_name
* @param destination_character_name
* @param destination_account_name
* @return
*/
bool Database::CopyCharacter(
std::string source_character_name,
std::string destination_character_name,
std::string destination_account_name
)
{
auto results = QueryDatabase(
fmt::format(
"SELECT id FROM character_data WHERE name = '{}' and deleted_at is NULL LIMIT 1",
source_character_name
)
);
if (results.RowCount() == 0) {
LogError("No character found with name [{}]", source_character_name);
}
auto row = results.begin();
std::string source_character_id = row[0];
results = QueryDatabase(
fmt::format(
"SELECT id FROM account WHERE name = '{}' LIMIT 1",
destination_account_name
)
);
if (results.RowCount() == 0) {
LogError("No account found with name [{}]", destination_account_name);
}
row = results.begin();
std::string source_account_id = row[0];
/**
* Fresh ID
*/
results = QueryDatabase("SELECT (MAX(id) + 1) as new_id from character_data");
row = results.begin();
std::string new_character_id = row[0];
TransactionBegin();
for (const auto &iter : DatabaseSchema::GetCharacterTables()) {
std::string table_name = iter.first;
std::string character_id_column_name = iter.second;
/**
* Columns
*/
results = QueryDatabase(fmt::format("SHOW COLUMNS FROM {}", table_name));
std::vector<std::string> columns = {};
int column_count = 0;
for (row = results.begin(); row != results.end(); ++row) {
columns.emplace_back(row[0]);
column_count++;
}
results = QueryDatabase(
fmt::format(
"SELECT {} FROM {} WHERE {} = {}",
implode(",", wrap(columns, "`")),
table_name,
character_id_column_name,
source_character_id
)
);
std::vector<std::vector<std::string>> new_rows;
for (row = results.begin(); row != results.end(); ++row) {
std::vector<std::string> new_values = {};
for (int column_index = 0; column_index < column_count; column_index++) {
std::string column = columns[column_index];
std::string value = row[column_index] ? row[column_index] : "null";
if (column == character_id_column_name) {
value = new_character_id;
}
if (column == "name" && table_name == "character_data") {
value = destination_character_name;
}
if (column == "account_id" && table_name == "character_data") {
value = source_account_id;
}
new_values.emplace_back(value);
}
new_rows.emplace_back(new_values);
}
std::string insert_values;
std::vector<std::string> insert_rows;
for (auto &r: new_rows) {
std::string insert_row = "(" + implode(",", wrap(r, "'")) + ")";
insert_rows.emplace_back(insert_row);
}
if (!insert_rows.empty()) {
QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
table_name,
character_id_column_name,
new_character_id
)
);
auto insert = QueryDatabase(
fmt::format(
"INSERT INTO {} ({}) VALUES {}",
table_name,
implode(",", wrap(columns, "`")),
implode(",", insert_rows)
)
);
if (!insert.ErrorMessage().empty()) {
TransactionRollback();
return false;
break;
}
}
}
TransactionCommit();
return true;
}
+20 -30
View File
@@ -100,40 +100,23 @@ 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, std::string connection_label = "default");
bool Connect(const char* host, const char* user, const char* passwd, const char* database, uint32 port);
~Database();
/* Character Creation */
bool AddToNameFilter(const char *name);
bool CreateCharacter(
uint32 account_id,
char *name,
uint16 gender,
uint16 race,
uint16 class_,
uint8 str,
uint8 sta,
uint8 cha,
uint8 dex,
uint8 int_,
uint8 agi,
uint8 wis,
uint8 face
);
bool DeleteCharacter(char *character_name);
bool MoveCharacterToZone(const char *charname, uint32 zone_id);
bool MoveCharacterToZone(uint32 character_id, uint32 zone_id);
bool ReserveName(uint32 account_id, char *name);
bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct *pp);
bool SetHackerFlag(const char *accountname, const char *charactername, const char *hacked);
bool SetMQDetectionFlag(const char *accountname, const char *charactername, const char *hacked, const char *zone);
bool UpdateName(const char *oldname, const char *newname);
bool CopyCharacter(
std::string source_character_name,
std::string destination_character_name,
std::string destination_account_name
);
bool AddToNameFilter(const char* name);
bool CreateCharacter(uint32 account_id, char* name, uint16 gender, uint16 race, uint16 class_, uint8 str, uint8 sta, uint8 cha, uint8 dex, uint8 int_, uint8 agi, uint8 wis, uint8 face);
bool DeleteCharacter(char* character_name);
bool MoveCharacterToZone(const char* charname, const char* zonename);
bool MoveCharacterToZone(const char* charname, const char* zonename,uint32 zoneid);
bool MoveCharacterToZone(uint32 iCharID, const char* iZonename);
bool ReserveName(uint32 account_id, char* name);
bool SaveCharacterCreate(uint32 character_id, uint32 account_id, PlayerProfile_Struct* pp);
bool SetHackerFlag(const char* accountname, const char* charactername, const char* hacked);
bool SetMQDetectionFlag(const char* accountname, const char* charactername, const char* hacked, const char* zone);
bool StoreCharacter(uint32 account_id, PlayerProfile_Struct* pp, EQ::InventoryProfile* inv);
bool UpdateName(const char* oldname, const char* newname);
/* General Information Queries */
@@ -173,6 +156,7 @@ public:
bool VerifyInstanceAlive(uint16 instance_id, uint32 char_id);
bool VerifyZoneInstance(uint32 zone_id, uint16 instance_id);
uint16 GetInstanceID(const char* zone, uint32 charid, int16 version);
uint16 GetInstanceID(uint32 zone, uint32 charid, int16 version);
uint16 GetInstanceVersion(uint16 instance_id);
uint32 GetTimeRemainingInstance(uint16 instance_id, bool &is_perma);
@@ -260,11 +244,16 @@ public:
/* General Queries */
bool GetSafePoints(const char* short_name, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr);
bool GetSafePoints(uint32 zoneID, uint32 version, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, int16* minstatus = 0, uint8* minlevel = 0, char *flag_needed = nullptr) { return GetSafePoints(GetZoneName(zoneID), version, safe_x, safe_y, safe_z, minstatus, minlevel, flag_needed); }
bool GetZoneGraveyard(const uint32 graveyard_id, uint32* graveyard_zoneid = 0, float* graveyard_x = 0, float* graveyard_y = 0, float* graveyard_z = 0, float* graveyard_heading = 0);
bool GetZoneLongName(const char* short_name, char** long_name, char* file_name = 0, float* safe_x = 0, float* safe_y = 0, float* safe_z = 0, uint32* graveyard_id = 0, uint32* maxclients = 0);
bool LoadPTimers(uint32 charid, PTimerList &into);
bool LoadZoneNames();
const char* GetZoneName(uint32 zoneID, bool ErrorUnknown = false);
uint32 GetZoneGraveyardID(uint32 zone_id, uint32 version);
uint32 GetZoneID(const char* zonename);
uint8 GetPEQZone(uint32 zoneID, uint32 version);
uint8 GetRaceSkill(uint8 skillid, uint8 in_race);
@@ -288,6 +277,7 @@ public:
void LoadLogSettings(EQEmuLogSys::LogSettings* log_settings);
private:
std::map<uint32,std::string> zonename_array;
Mutex Mvarcache;
VarCache_Struct varcache;
+3 -13
View File
@@ -128,23 +128,12 @@ std::string DatabaseDumpService::GetMySQLVersion()
std::string DatabaseDumpService::GetBaseMySQLDumpCommand()
{
auto config = EQEmuConfig::get();
if (IsDumpContentTables() && !config->ContentDbHost.empty()) {
return fmt::format(
"mysqldump -u {} -p{} -h {} --port={} {}",
config->ContentDbUsername,
config->ContentDbPassword,
config->ContentDbHost,
config->ContentDbPort,
config->ContentDbName
);
};
return fmt::format(
"mysqldump -u {} -p{} -h {} --port={} {}",
"mysqldump -u {} -p{} -h {} {}",
config->DatabaseUsername,
config->DatabasePassword,
config->DatabaseHost,
config->DatabasePort,
config->DatabaseDB
);
}
@@ -300,7 +289,8 @@ void DatabaseDumpService::Dump()
config->DatabaseUsername
);
std::string options = "--allow-keywords --extended-insert --max-allowed-packet=1G --net-buffer-length=32704";
std::string options = "--allow-keywords --extended-insert";
if (IsDumpWithNoData()) {
options += " --no-data";
}
+42 -22
View File
@@ -34,7 +34,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#define strcasecmp _stricmp
#else
#include "unix.h"
#include "../zone/zonedb.h"
#include <netinet/in.h>
#include <sys/time.h>
#endif
@@ -306,6 +305,36 @@ bool Database::VerifyZoneInstance(uint32 zone_id, uint16 instance_id)
return true;
}
uint16 Database::GetInstanceID(const char* zone, uint32 character_id, int16 version) {
std::string query = StringFormat(
"SELECT "
"instance_list.id "
"FROM "
"instance_list, "
"instance_list_player "
"WHERE "
"instance_list.zone = %u "
"AND instance_list.version = %u "
"AND instance_list.id = instance_list_player.id "
"AND instance_list_player.charid = %u "
"LIMIT 1 ",
GetZoneID(zone),
version,
character_id
);
auto results = QueryDatabase(query);
if (!results.Success())
return 0;
if (results.RowCount() == 0)
return 0;
auto row = results.begin();
return atoi(row[0]);
}
uint16 Database::GetInstanceID(uint32 zone, uint32 character_id, int16 version)
{
if (!zone)
@@ -472,18 +501,22 @@ void Database::AssignRaidToInstance(uint32 raid_id, uint32 instance_id)
}
void Database::BuryCorpsesInInstance(uint16 instance_id) {
QueryDatabase(
fmt::format(
"UPDATE character_corpses SET is_buried = 1, instance_id = 0 WHERE instance_id = {}",
instance_id
)
);
std::string query = StringFormat(
"UPDATE `character_corpses` "
"SET `is_buried` = 1, "
"`instance_id` = 0 "
"WHERE "
"`instance_id` = %u ",
instance_id
);
auto results = QueryDatabase(query);
}
void Database::DeleteInstance(uint16 instance_id)
{
std::string query;
query = StringFormat("DELETE FROM instance_list_player WHERE id=%u", instance_id);
QueryDatabase(query);
@@ -493,9 +526,6 @@ void Database::DeleteInstance(uint16 instance_id)
query = StringFormat("DELETE FROM spawn_condition_values WHERE instance_id=%u", instance_id);
QueryDatabase(query);
query = fmt::format("DELETE FROM dynamic_zones WHERE instance_id={}", instance_id);
QueryDatabase(query);
BuryCorpsesInInstance(instance_id);
}
@@ -573,19 +603,9 @@ void Database::PurgeExpiredInstances()
return;
}
std::vector<std::string> instance_ids;
for (auto row = results.begin(); row != results.end(); ++row) {
instance_ids.emplace_back(row[0]);
DeleteInstance(atoi(row[0]));
}
std::string imploded_instance_ids = implode(",", instance_ids);
QueryDatabase(fmt::format("DELETE FROM instance_list WHERE id IN ({})", imploded_instance_ids));
QueryDatabase(fmt::format("DELETE FROM instance_list_player WHERE id IN ({})", imploded_instance_ids));
QueryDatabase(fmt::format("DELETE FROM respawn_times WHERE instance_id IN ({})", imploded_instance_ids));
QueryDatabase(fmt::format("DELETE FROM spawn_condition_values WHERE instance_id IN ({})", imploded_instance_ids));
QueryDatabase(fmt::format("UPDATE character_corpses SET is_buried = 1, instance_id = 0 WHERE instance_id IN ({})", imploded_instance_ids));
QueryDatabase(fmt::format("DELETE FROM dynamic_zones WHERE instance_id IN ({})", imploded_instance_ids));
}
void Database::SetInstanceDuration(uint16 instance_id, uint32 new_duration)
+13 -10
View File
@@ -50,7 +50,6 @@ namespace DatabaseSchema {
{"character_data", "id"},
{"character_disciplines", "id"},
{"character_enabledtasks", "charid"},
{"character_expedition_lockouts", "character_id"},
{"character_inspect_messages", "id"},
{"character_item_recast", "id"},
{"character_languages", "id"},
@@ -115,7 +114,6 @@ namespace DatabaseSchema {
"character_data",
"character_disciplines",
"character_enabledtasks",
"character_expedition_lockouts",
"character_inspect_messages",
"character_item_recast",
"character_languages",
@@ -168,12 +166,16 @@ namespace DatabaseSchema {
{
return {
"aa_ability",
"aa_actions",
"aa_effects",
"aa_rank_effects",
"aa_rank_prereqs",
"aa_ranks",
"aa_required_level_cost",
"adventure_template",
"adventure_template_entry",
"adventure_template_entry_flavor",
"altadv_vars",
"alternate_currency",
"auras",
"base_data",
@@ -181,11 +183,13 @@ namespace DatabaseSchema {
"books",
"char_create_combinations",
"char_create_point_allocations",
"class_skill",
"damageshieldtypes",
"doors",
"faction_base_data",
"faction_list",
"faction_list_mod",
"fear_hints",
"fishing",
"forage",
"global_loot",
@@ -195,6 +199,7 @@ namespace DatabaseSchema {
"grid_entries",
"ground_spawns",
"horses",
"instance_list",
"items",
"ldon_trap_entries",
"ldon_trap_templates",
@@ -212,15 +217,19 @@ namespace DatabaseSchema {
"npc_spells_effects_entries",
"npc_spells_entries",
"npc_types",
"npc_types_metadata",
"npc_types_tint",
"object",
"pets",
"pets_equipmentset",
"pets_equipmentset_entries",
"proximities",
"races",
"skill_caps",
"spawn2",
"spawn_condition_values",
"spawn_conditions",
"spawn_events",
"spawnentry",
"spawngroup",
"spells_new",
@@ -237,6 +246,8 @@ namespace DatabaseSchema {
"veteran_reward_templates",
"zone",
"zone_points",
"zone_server",
"zoneserver_auth",
};
}
@@ -250,13 +261,10 @@ namespace DatabaseSchema {
return {
"chatchannels",
"command_settings",
"content_flags",
"db_str",
"eqtime",
"launcher",
"launcher_zones",
"spawn_condition_values",
"spawn_events",
"level_exp_mods",
"logsys_categories",
"name_filter",
@@ -307,17 +315,12 @@ namespace DatabaseSchema {
"banned_ips",
"bug_reports",
"bugs",
"dynamic_zones",
"eventlog",
"expedition_lockouts",
"expedition_members",
"expeditions",
"gm_ips",
"group_id",
"group_leaders",
"hackers",
"ip_exemptions",
"instance_list",
"item_tick",
"lfguild",
"merchantlist_temp",
+10 -46
View File
@@ -35,31 +35,17 @@
DBcore::DBcore()
{
mysql_init(&mysql);
pHost = nullptr;
pUser = nullptr;
pPassword = nullptr;
pDatabase = nullptr;
pCompress = false;
pSSL = false;
pStatus = Closed;
pHost = 0;
pUser = 0;
pPassword = 0;
pDatabase = 0;
pCompress = false;
pSSL = false;
pStatus = Closed;
}
DBcore::~DBcore()
{
/**
* This prevents us from doing a double free in multi-tenancy setups where we
* are re-using the default database connection pointer when we dont have an
* external configuration setup ex: (content_database)
*/
std::string mysql_connection_host;
if (mysql.host) {
mysql_connection_host = mysql.host;
}
if (GetOriginHost() != mysql_connection_host) {
return;
}
mysql_close(&mysql);
safe_delete_array(pHost);
safe_delete_array(pUser);
@@ -83,13 +69,6 @@ MySQLRequestResult DBcore::QueryDatabase(std::string query, bool retryOnFailureO
return QueryDatabase(query.c_str(), query.length(), retryOnFailureOnce);
}
bool DBcore::DoesTableExist(std::string table_name)
{
auto results = QueryDatabase(fmt::format("SHOW TABLES LIKE '{}'", table_name));
return results.RowCount() > 0;
}
MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, bool retryOnFailureOnce)
{
BenchTimer timer;
@@ -102,8 +81,6 @@ MySQLRequestResult DBcore::QueryDatabase(const char *query, uint32 querylen, boo
Open();
}
// request query. != 0 indicates some kind of error.
if (mysql_real_query(&mysql, query, querylen) != 0) {
unsigned int errorNumber = mysql_errno(&mysql);
@@ -267,10 +244,6 @@ bool DBcore::Open(uint32 *errnum, char *errbuf)
}
if (mysql_real_connect(&mysql, pHost, pUser, pPassword, pDatabase, pPort, 0, flags)) {
pStatus = Connected;
std::string connected_origin_host = pHost;
SetOriginHost(connected_origin_host);
return true;
}
else {
@@ -285,17 +258,8 @@ bool DBcore::Open(uint32 *errnum, char *errbuf)
}
}
void DBcore::SetMysql(MYSQL *mysql)
{
DBcore::mysql = *mysql;
}
const std::string &DBcore::GetOriginHost() const
{
return origin_host;
}
void DBcore::SetOriginHost(const std::string &origin_host)
{
DBcore::origin_host = origin_host;
}
+20 -41
View File
@@ -2,8 +2,8 @@
#define DBCORE_H
#ifdef _WINDOWS
#include <winsock2.h>
#include <windows.h>
#include <winsock2.h>
#include <windows.h>
#endif
#include "../common/mutex.h"
@@ -15,57 +15,36 @@
class DBcore {
public:
enum eStatus {
Closed, Connected, Error
};
enum eStatus { Closed, Connected, Error };
DBcore();
~DBcore();
eStatus GetStatus() { return pStatus; }
MySQLRequestResult QueryDatabase(const char *query, uint32 querylen, bool retryOnFailureOnce = true);
MySQLRequestResult QueryDatabase(std::string query, bool retryOnFailureOnce = true);
eStatus GetStatus() { return pStatus; }
MySQLRequestResult QueryDatabase(const char* query, uint32 querylen, bool retryOnFailureOnce = true);
MySQLRequestResult QueryDatabase(std::string query, bool retryOnFailureOnce = true);
void TransactionBegin();
void TransactionCommit();
void TransactionRollback();
uint32 DoEscapeString(char *tobuf, const char *frombuf, uint32 fromlen);
void ping();
MYSQL *getMySQL() { return &mysql; }
void SetMysql(MYSQL *mysql);
const std::string &GetOriginHost() const;
void SetOriginHost(const std::string &origin_host);
bool DoesTableExist(std::string table_name);
uint32 DoEscapeString(char* tobuf, const char* frombuf, uint32 fromlen);
void ping();
MYSQL* getMySQL(){ return &mysql; }
protected:
bool Open(
const char *iHost,
const char *iUser,
const char *iPassword,
const char *iDatabase,
uint32 iPort,
uint32 *errnum = 0,
char *errbuf = 0,
bool iCompress = false,
bool iSSL = false
);
bool Open(const char* iHost, const char* iUser, const char* iPassword, const char* iDatabase, uint32 iPort, uint32* errnum = 0, char* errbuf = 0, bool iCompress = false, bool iSSL = false);
private:
bool Open(uint32 *errnum = nullptr, char *errbuf = nullptr);
bool Open(uint32* errnum = 0, char* errbuf = 0);
MYSQL mysql;
Mutex MDatabase;
MYSQL mysql;
Mutex MDatabase;
eStatus pStatus;
std::string origin_host;
char *pHost;
char *pUser;
char *pPassword;
char *pDatabase;
bool pCompress;
uint32 pPort;
bool pSSL;
char* pHost;
char* pUser;
char* pPassword;
char* pDatabase;
bool pCompress;
uint32 pPort;
bool pSSL;
};
+5 -8
View File
@@ -136,22 +136,20 @@ N(OP_Dye),
N(OP_DynamicWall),
N(OP_DzAddPlayer),
N(OP_DzChooseZone),
N(OP_DzChooseZoneReply),
N(OP_DzCompass),
N(OP_DzExpeditionEndsWarning),
N(OP_DzExpeditionInfo),
N(OP_DzExpeditionInvite),
N(OP_DzExpeditionInviteResponse),
N(OP_DzExpeditionLockoutTimers),
N(OP_DzExpeditionList),
N(OP_DzJoinExpeditionConfirm),
N(OP_DzJoinExpeditionReply),
N(OP_DzLeaderStatus),
N(OP_DzListTimers),
N(OP_DzMakeLeader),
N(OP_DzMemberList),
N(OP_DzMemberListName),
N(OP_DzMemberListStatus),
N(OP_DzMemberStatus),
N(OP_DzPlayerList),
N(OP_DzQuit),
N(OP_DzRemovePlayer),
N(OP_DzSetLeaderName),
N(OP_DzSwapPlayer),
N(OP_Emote),
N(OP_EndLootRequest),
@@ -273,7 +271,6 @@ N(OP_ItemVerifyRequest),
N(OP_ItemViewUnknown),
N(OP_Jump),
N(OP_KeyRing),
N(OP_KickPlayers),
N(OP_KnowledgeBase),
N(OP_LDoNButton),
N(OP_LDoNDisarmTraps),
+44 -149
View File
@@ -375,16 +375,13 @@ struct NewZone_Struct {
/*0686*/ uint16 zone_instance;
/*0688*/ uint32 unknown688;
/*0692*/ uint8 unknown692[8];
// Titanium doesn't have a translator, but we can still safely add stuff under here without issues since client memcpy's only what it knows
// Just wastes some bandwidth sending to tit clients /shrug
/*0700*/ float fog_density;
/*0704*/ uint32 SuspendBuffs;
/*0708*/ uint32 FastRegenHP;
/*0712*/ uint32 FastRegenMana;
/*0716*/ uint32 FastRegenEndurance;
/*0720*/ uint32 NPCAggroMaxDist;
/*0724*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, if this value is 0, it prevents you from running off edges that would end up underworld
/*0728*/
/*0724*/
};
/*
@@ -4835,98 +4832,17 @@ struct BuffIcon_Struct
BuffIconEntry_Struct entries[0];
};
struct ExpeditionInvite_Struct
{
/*000*/ uint32 client_id; // unique character id
/*004*/ uint32 unknown004; // added after titanium
/*008*/ char inviter_name[64];
/*072*/ char expedition_name[128];
/*200*/ uint8 swapping; // 0: adding 1: swapping
/*201*/ char swap_name[64]; // if swapping, swap name being removed
/*265*/ uint8 padding[3];
/*268*/ uint16 dz_zone_id; // dz_id zone/instance pair, sent back in reply
/*270*/ uint16 dz_instance_id;
};
struct ExpeditionInviteResponse_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004; // added after titanium
/*008*/ uint16 dz_zone_id; // dz_id pair sent in invite
/*010*/ uint16 dz_instance_id;
/*012*/ uint8 accepted; // 0: declined 1: accepted
/*013*/ uint8 swapping; // 0: adding 1: swapping (sent in invite)
/*014*/ char swap_name[64]; // swap name sent in invite
/*078*/ uint8 unknown078; // padding garbage?
/*079*/ uint8 unknown079; // padding garbage?
};
struct ExpeditionInfo_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004; // added after titanium
/*008*/ uint32 assigned; // padded bool, 0: not in expedition (clear data), 1: in expedition
/*012*/ uint32 max_players;
/*016*/ char expedition_name[128];
/*144*/ char leader_name[64];
/*000*/ uint32 max_players;
/*004*/ char expedition_name[128];
/*132*/ char leader_name[64];
};
struct ExpeditionMemberEntry_Struct
struct ExpeditionJoinPrompt_Struct
{
/*000*/ char name[64]; // variable length, null terminated, max 0x40 (64)
/*064*/ uint8 expedition_status; // 0: unknown, 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
};
struct ExpeditionMemberList_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 member_count;
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
};
struct ExpeditionMemberListName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ uint32 add_name; // padded bool, 0: remove name, 1: add name with unknown status
/*012*/ char name[64];
};
struct ExpeditionLockoutTimerEntry_Struct
{
/*000*/ char expedition_name[128]; // variable length, null terminated, max 0x80 (128)
/*000*/ uint32 seconds_remaining;
/*000*/ int32 event_type; // seen -1 (0xffffffff) for replay timers and 1 for event timers
/*000*/ char event_name[256]; // variable length, null terminated, max 0x100 (256)
};
struct ExpeditionLockoutTimers_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
};
struct ExpeditionSetLeaderName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ char leader_name[64];
};
struct ExpeditionCommand_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004;
/*008*/ char name[64];
};
struct ExpeditionCommandSwap_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004;
/*008*/ char add_player_name[64]; // swap to (player must confirm)
/*072*/ char rem_player_name[64]; // swap from
/*000*/ char player_name[64];
/*064*/ char expedition_name[64];
};
struct ExpeditionExpireWarning
@@ -4934,67 +4850,48 @@ struct ExpeditionExpireWarning
/*008*/ uint32 minutes_remaining;
};
struct DynamicZoneCompassEntry_Struct
struct ExpeditionCompassEntry_Struct
{
/*000*/ uint16 dz_zone_id; // target dz id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
/*008*/ uint32 unknown008;
/*012*/ float y;
/*016*/ float x;
/*020*/ float z;
/*000*/ uint32 enabled; //guess
/*004*/ float y;
/*008*/ float x;
/*012*/ float z;
};
struct DynamicZoneCompass_Struct
struct ExpeditionCompass_Struct
{
/*000*/ uint32 client_id;
/*000*/ uint32 count;
/*004*/ DynamicZoneCompassEntry_Struct entries[0];
/*004*/ ExpeditionCompassEntry_Struct entries[0];
};
struct DynamicZoneChooseZoneEntry_Struct
struct ExpeditionMemberEntry_Struct
{
/*000*/ uint16 dz_zone_id; // dz_id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 unknown_id1; // seen 28 00 00 00 (40), sent back in reply
/*008*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest -- sent back in reply
/*012*/ uint32 unknown_id2; // possibly an id based on dz type, for expeditions this was same as dz_id (zone|instance) but task dz was different
/*016*/ char description[128]; // variable length, null terminated
/*144*/ char leader_name[64]; // variable length, null terminated
char name[64];
char status;
};
struct DynamicZoneChooseZone_Struct
struct ExpeditionMemberList_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ DynamicZoneChooseZoneEntry_Struct choices[0];
/*000*/ uint32 count;
/*004*/ ExpeditionMemberEntry_Struct entries[0];
};
struct DynamicZoneChooseZoneReply_Struct
struct ExpeditionLockoutEntry_Struct
{
/*000*/ uint32 unknown000; // ff ff ff ff
/*004*/ uint32 unknown004; // seen 69 00 00 00
/*008*/ uint32 unknown008; // ff ff ff ff
/*012*/ uint32 unknown_id1; // from choose zone entry message
/*016*/ uint16 dz_zone_id; // dz_id pair
/*018*/ uint16 dz_instance_id;
/*020*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest
/*024*/ uint32 unknown_id2; // from choose zone entry message
/*028*/ uint32 unknown028; // 00 00 00 00
/*032*/ uint32 unknown032; // always same as unknown044
/*036*/ uint32 unknown036;
/*040*/ uint32 unknown040;
/*044*/ uint32 unknown044; // always same as unknown032
/*048*/ uint32 unknown048; // seen 01 00 00 00 and 02 00 00 00
/*000*/ uint32 time_left;
/*004*/ char expedition[128];
/*132*/ char expedition_event[128];
};
struct KickPlayers_Struct
struct ExpeditionLockoutList_Struct
{
/*000*/ char char_name[64];
/*064*/ uint32 unknown064; // always 0
/*068*/ uint8 kick_expedition; // true if /kickplayers exp
/*069*/ uint8 kick_task; // true if /kickplayers task
/*070*/ uint8 padding[2];
/*000*/ uint32 count;
/*004*/ ExpeditionLockoutEntry_Struct entries[0];
};
struct ExpeditionLeaderSet_Struct
{
/*000*/ char leader_name[64];
};
struct CorpseDrag_Struct
@@ -5444,20 +5341,18 @@ struct MercenaryMerchantResponse_Struct {
struct ServerLootItem_Struct {
uint32 item_id; // uint32 item_id;
int16 equip_slot; // int16 equip_slot;
uint16 charges; // uint8 charges;
uint16 lootslot; // uint16 lootslot;
uint32 aug_1; // uint32 aug_1;
uint32 aug_2; // uint32 aug_2;
uint32 aug_3; // uint32 aug_3;
uint32 aug_4; // uint32 aug_4;
uint32 aug_5; // uint32 aug_5;
uint32 aug_6; // uint32 aug_5;
uint8 attuned;
uint16 trivial_min_level;
uint16 trivial_max_level;
uint16 npc_min_level;
uint16 npc_max_level;
int16 equip_slot; // int16 equip_slot;
uint16 charges; // uint8 charges;
uint16 lootslot; // uint16 lootslot;
uint32 aug_1; // uint32 aug_1;
uint32 aug_2; // uint32 aug_2;
uint32 aug_3; // uint32 aug_3;
uint32 aug_4; // uint32 aug_4;
uint32 aug_5; // uint32 aug_5;
uint32 aug_6; // uint32 aug_5;
uint8 attuned;
uint8 min_level;
uint8 max_level;
};
//Found in client near a ref to the string:
-9
View File
@@ -104,15 +104,6 @@ void EQEmuConfig::parse_config()
DatabasePort = atoi(_root["server"]["database"].get("port", "3306").asString().c_str());
DatabaseDB = _root["server"]["database"].get("db", "eq").asString();
/**
* Content Database
*/
ContentDbUsername = _root["server"]["content_database"].get("username", "").asString();
ContentDbPassword = _root["server"]["content_database"].get("password", "").asString();
ContentDbHost = _root["server"]["content_database"].get("host", "").asString();
ContentDbPort = atoi(_root["server"]["content_database"].get("port", 0).asString().c_str());
ContentDbName = _root["server"]["content_database"].get("db", "").asString();
/**
* QS
*/
-7
View File
@@ -74,13 +74,6 @@ class EQEmuConfig
std::string DatabaseDB;
uint16 DatabasePort;
// From <content_database/>
std::string ContentDbHost;
std::string ContentDbUsername;
std::string ContentDbPassword;
std::string ContentDbName;
uint16 ContentDbPort;
// From <qsdatabase> // QueryServ
std::string QSDatabaseHost;
std::string QSDatabaseUsername;
-1
View File
@@ -126,7 +126,6 @@ void EQEmuLogSys::LoadLogSettingsDefaults()
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);
log_settings[Logs::Loot].log_to_gmsay = static_cast<uint8>(Logs::General);
/**
* RFC 5424
-14
View File
@@ -115,13 +115,6 @@ namespace Logs {
Flee,
Aura,
HotReload,
Merchants,
ZonePoints,
Loot,
Expeditions,
DynamicZones,
Group,
Adventure,
MaxCategoryID /* Don't Remove this */
};
@@ -196,13 +189,6 @@ namespace Logs {
"Flee",
"Aura",
"HotReload",
"Merchants",
"ZonePoints",
"Loot",
"Expeditions",
"DynamicZones",
"Group",
"Adventure",
};
}
+1 -109
View File
@@ -161,16 +161,6 @@
OutF(LogSys, Logs::Detail, Logs::Doors, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogGroup(message, ...) do {\
if (LogSys.log_settings[Logs::Group].is_category_enabled == 1)\
OutF(LogSys, Logs::General, Logs::Group, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogGroupDetail(message, ...) do {\
if (LogSys.log_settings[Logs::Group].is_category_enabled == 1)\
OutF(LogSys, Logs::Detail, Logs::Group, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogGuilds(message, ...) do {\
if (LogSys.log_settings[Logs::Guilds].is_category_enabled == 1)\
OutF(LogSys, Logs::General, Logs::Guilds, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
@@ -581,71 +571,6 @@
OutF(LogSys, Logs::Detail, Logs::HotReload, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogMerchants(message, ...) do {\
if (LogSys.log_settings[Logs::Merchants].is_category_enabled == 1)\
OutF(LogSys, Logs::General, Logs::Merchants, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogMerchantsDetail(message, ...) do {\
if (LogSys.log_settings[Logs::Merchants].is_category_enabled == 1)\
OutF(LogSys, Logs::Detail, Logs::Merchants, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogZonePoints(message, ...) do {\
if (LogSys.log_settings[Logs::ZonePoints].is_category_enabled == 1)\
OutF(LogSys, Logs::General, Logs::ZonePoints, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogZonePointsDetail(message, ...) do {\
if (LogSys.log_settings[Logs::ZonePoints].is_category_enabled == 1)\
OutF(LogSys, Logs::Detail, Logs::ZonePoints, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogLoot(message, ...) do {\
if (LogSys.log_settings[Logs::Loot].is_category_enabled == 1)\
OutF(LogSys, Logs::General, Logs::Loot, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogLootDetail(message, ...) do {\
if (LogSys.log_settings[Logs::Loot].is_category_enabled == 1)\
OutF(LogSys, Logs::Detail, Logs::Loot, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogExpeditions(message, ...) do {\
if (LogSys.log_settings[Logs::Expeditions].is_category_enabled == 1)\
OutF(LogSys, Logs::General, Logs::Expeditions, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogExpeditionsModerate(message, ...) do {\
if (LogSys.log_settings[Logs::Expeditions].is_category_enabled == 1)\
OutF(LogSys, Logs::Moderate, Logs::Expeditions, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogExpeditionsDetail(message, ...) do {\
if (LogSys.log_settings[Logs::Expeditions].is_category_enabled == 1)\
OutF(LogSys, Logs::Detail, Logs::Expeditions, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogDynamicZones(message, ...) do {\
if (LogSys.log_settings[Logs::DynamicZones].is_category_enabled == 1)\
OutF(LogSys, Logs::General, Logs::DynamicZones, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogDynamicZonesDetail(message, ...) do {\
if (LogSys.log_settings[Logs::DynamicZones].is_category_enabled == 1)\
OutF(LogSys, Logs::Detail, Logs::DynamicZones, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogAdventure(message, ...) do {\
if (LogSys.log_settings[Logs::Adventure].is_category_enabled == 1)\
OutF(LogSys, Logs::General, Logs::Adventure, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogAdventureDetail(message, ...) do {\
if (LogSys.log_settings[Logs::Adventure].is_category_enabled == 1)\
OutF(LogSys, Logs::Detail, Logs::Adventure, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define Log(debug_level, log_category, message, ...) do {\
if (LogSys.log_settings[log_category].is_category_enabled == 1)\
LogSys.Out(debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
@@ -739,12 +664,6 @@
#define LogDoorsDetail(message, ...) do {\
} while (0)
#define LogGroup(message, ...) do {\
} while (0)
#define LogGroupDetail(message, ...) do {\
} while (0)
#define LogGuilds(message, ...) do {\
} while (0)
@@ -991,33 +910,6 @@
#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 Log(debug_level, log_category, message, ...) do {\
} while (0)
@@ -1025,4 +917,4 @@
} while (0)
#endif
#endif //EQEMU_EQEMU_LOGSYS_LOG_ALIASES_H
#endif //EQEMU_EQEMU_LOGSYS_LOG_ALIASES_H
+1 -1
View File
@@ -61,7 +61,7 @@ class SharedDatabase;
namespace EQ
{
class InventoryProfile;
class ItemInstance {
public:
/////////////////////////
+7 -9
View File
@@ -39,15 +39,13 @@ struct LootTable_Struct {
};
struct LootDropEntries_Struct {
uint32 item_id;
int8 item_charges;
uint8 equip_item;
float chance;
uint16 trivial_min_level;
uint16 trivial_max_level;
uint16 npc_min_level;
uint16 npc_max_level;
uint8 multiplier;
uint32 item_id;
int8 item_charges;
uint8 equip_item;
float chance;
uint8 minlevel;
uint8 maxlevel;
uint8 multiplier;
};
struct LootDrop_Struct {
+71 -179
View File
@@ -710,48 +710,15 @@ namespace RoF
FINISH_ENCODE();
}
ENCODE(OP_DzChooseZone)
{
SETUP_VAR_ENCODE(DynamicZoneChooseZone_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->count);
for (uint32 i = 0; i < emu->count; ++i)
{
buf.WriteUInt16(emu->choices[i].dz_zone_id);
buf.WriteUInt16(emu->choices[i].dz_instance_id);
buf.WriteUInt32(emu->choices[i].unknown_id1);
buf.WriteUInt32(emu->choices[i].dz_type);
buf.WriteUInt32(emu->choices[i].unknown_id2);
buf.WriteString(emu->choices[i].description);
buf.WriteString(emu->choices[i].leader_name);
}
__packet->size = buf.size();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzCompass)
{
SETUP_VAR_ENCODE(DynamicZoneCompass_Struct);
ALLOC_VAR_ENCODE(structs::DynamicZoneCompass_Struct,
sizeof(structs::DynamicZoneCompass_Struct) +
sizeof(structs::DynamicZoneCompassEntry_Struct) * emu->count
);
SETUP_VAR_ENCODE(ExpeditionCompass_Struct);
ALLOC_VAR_ENCODE(structs::ExpeditionCompass_Struct, sizeof(structs::ExpeditionInfo_Struct) + sizeof(structs::ExpeditionCompassEntry_Struct) * emu->count);
OUT(client_id);
OUT(count);
for (uint32 i = 0; i < emu->count; ++i)
{
OUT(entries[i].dz_zone_id);
OUT(entries[i].dz_instance_id);
OUT(entries[i].dz_type);
OUT(entries[i].x);
OUT(entries[i].y);
OUT(entries[i].z);
@@ -775,60 +742,81 @@ namespace RoF
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
OUT(client_id);
OUT(assigned);
OUT(max_players);
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
eq->unknown004 = 785316192;
eq->unknown008 = 435601;
strncpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
strncpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionInvite)
ENCODE(OP_DzExpeditionList)
{
ENCODE_LENGTH_EXACT(ExpeditionInvite_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInvite_Struct, structs::ExpeditionInvite_Struct);
SETUP_VAR_ENCODE(ExpeditionLockoutList_Struct);
OUT(client_id);
strn0cpy(eq->inviter_name, emu->inviter_name, sizeof(eq->inviter_name));
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
OUT(swapping);
strn0cpy(eq->swap_name, emu->swap_name, sizeof(eq->swap_name));
OUT(dz_zone_id);
OUT(dz_instance_id);
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionLockoutTimers)
{
SETUP_VAR_ENCODE(ExpeditionLockoutTimers_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->count);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&emu->count, sizeof(uint32));
for (uint32 i = 0; i < emu->count; ++i)
{
buf.WriteString(emu->timers[i].expedition_name);
buf.WriteUInt32(emu->timers[i].seconds_remaining);
buf.WriteInt32(emu->timers[i].event_type);
buf.WriteString(emu->timers[i].event_name);
ss.write(emu->entries[i].expedition, strlen(emu->entries[i].expedition));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&emu->entries[i].time_left, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write(emu->entries[i].expedition_event, strlen(emu->entries[i].expedition_event));
ss.write((const char*)&null_term, sizeof(char));
}
__packet->size = buf.size();
__packet->size = ss.str().length();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzSetLeaderName)
ENCODE(OP_DzJoinExpeditionConfirm)
{
ENCODE_LENGTH_EXACT(ExpeditionSetLeaderName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionSetLeaderName_Struct, structs::ExpeditionSetLeaderName_Struct);
ENCODE_LENGTH_EXACT(ExpeditionJoinPrompt_Struct);
SETUP_DIRECT_ENCODE(ExpeditionJoinPrompt_Struct, structs::ExpeditionJoinPrompt_Struct);
OUT(client_id);
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
strncpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
strncpy(eq->player_name, emu->player_name, sizeof(eq->player_name));
FINISH_ENCODE();
}
ENCODE(OP_DzLeaderStatus)
{
SETUP_VAR_ENCODE(ExpeditionLeaderSet_Struct);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write(emu->leader_name, strlen(emu->leader_name));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));//0xffffffff
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));//1
ss.write((const char*)&client_id, sizeof(uint32));
__packet->size = ss.str().length();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
FINISH_ENCODE();
}
@@ -837,43 +825,26 @@ namespace RoF
{
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->member_count);
for (uint32 i = 0; i < emu->member_count; ++i)
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&emu->count, sizeof(uint32));
for (uint32 i = 0; i < emu->count; ++i)
{
buf.WriteString(emu->members[i].name);
buf.WriteUInt8(emu->members[i].expedition_status);
ss.write(emu->entries[i].name, strlen(emu->entries[i].name));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&emu->entries[i].status, sizeof(char));
}
__packet->size = buf.size();
__packet->size = ss.str().length();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzMemberListName)
{
ENCODE_LENGTH_EXACT(ExpeditionMemberListName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionMemberListName_Struct, structs::ExpeditionMemberListName_Struct);
OUT(client_id);
OUT(add_name);
strn0cpy(eq->name, emu->name, sizeof(eq->name));
FINISH_ENCODE();
}
ENCODE(OP_DzMemberListStatus)
{
auto emu = reinterpret_cast<ExpeditionMemberList_Struct*>((*p)->pBuffer);
if (emu->member_count == 1)
{
ENCODE_FORWARD(OP_DzMemberList);
}
}
ENCODE(OP_Emote)
{
EQApplicationPacket *in = *p;
@@ -1856,7 +1827,6 @@ namespace RoF
OUT(FastRegenHP);
OUT(FastRegenMana);
OUT(FastRegenEndurance);
OUT(underworld_teleport_index);
eq->FogDensity = emu->fog_density;
@@ -4417,84 +4387,6 @@ namespace RoF
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzAddPlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzChooseZoneReply)
{
DECODE_LENGTH_EXACT(structs::DynamicZoneChooseZoneReply_Struct);
SETUP_DIRECT_DECODE(DynamicZoneChooseZoneReply_Struct, structs::DynamicZoneChooseZoneReply_Struct);
IN(unknown000);
IN(unknown004);
IN(unknown008);
IN(unknown_id1);
IN(dz_zone_id);
IN(dz_instance_id);
IN(dz_type);
IN(unknown_id2);
IN(unknown028);
IN(unknown032);
IN(unknown036);
IN(unknown040);
IN(unknown044);
IN(unknown048);
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzExpeditionInviteResponse)
{
DECODE_LENGTH_EXACT(structs::ExpeditionInviteResponse_Struct);
SETUP_DIRECT_DECODE(ExpeditionInviteResponse_Struct, structs::ExpeditionInviteResponse_Struct);
IN(dz_zone_id);
IN(dz_instance_id);
IN(accepted);
IN(swapping);
strn0cpy(emu->swap_name, eq->swap_name, sizeof(emu->swap_name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzMakeLeader)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzRemovePlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzSwapPlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommandSwap_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommandSwap_Struct, structs::ExpeditionCommandSwap_Struct);
strn0cpy(emu->add_player_name, eq->add_player_name, sizeof(emu->add_player_name));
strn0cpy(emu->rem_player_name, eq->rem_player_name, sizeof(emu->rem_player_name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_Emote)
{
unsigned char *__eq_buffer = __packet->pBuffer;
+71 -179
View File
@@ -759,48 +759,15 @@ namespace RoF2
FINISH_ENCODE();
}
ENCODE(OP_DzChooseZone)
{
SETUP_VAR_ENCODE(DynamicZoneChooseZone_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->count);
for (uint32 i = 0; i < emu->count; ++i)
{
buf.WriteUInt16(emu->choices[i].dz_zone_id);
buf.WriteUInt16(emu->choices[i].dz_instance_id);
buf.WriteUInt32(emu->choices[i].unknown_id1);
buf.WriteUInt32(emu->choices[i].dz_type);
buf.WriteUInt32(emu->choices[i].unknown_id2);
buf.WriteString(emu->choices[i].description);
buf.WriteString(emu->choices[i].leader_name);
}
__packet->size = buf.size();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzCompass)
{
SETUP_VAR_ENCODE(DynamicZoneCompass_Struct);
ALLOC_VAR_ENCODE(structs::DynamicZoneCompass_Struct,
sizeof(structs::DynamicZoneCompass_Struct) +
sizeof(structs::DynamicZoneCompassEntry_Struct) * emu->count
);
SETUP_VAR_ENCODE(ExpeditionCompass_Struct);
ALLOC_VAR_ENCODE(structs::ExpeditionCompass_Struct, sizeof(structs::ExpeditionInfo_Struct) + sizeof(structs::ExpeditionCompassEntry_Struct) * emu->count);
OUT(client_id);
OUT(count);
for (uint32 i = 0; i < emu->count; ++i)
{
OUT(entries[i].dz_zone_id);
OUT(entries[i].dz_instance_id);
OUT(entries[i].dz_type);
OUT(entries[i].x);
OUT(entries[i].y);
OUT(entries[i].z);
@@ -824,60 +791,81 @@ namespace RoF2
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
OUT(client_id);
OUT(assigned);
OUT(max_players);
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
eq->unknown004 = 785316192;
eq->unknown008 = 435601;
strncpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
strncpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionInvite)
ENCODE(OP_DzExpeditionList)
{
ENCODE_LENGTH_EXACT(ExpeditionInvite_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInvite_Struct, structs::ExpeditionInvite_Struct);
SETUP_VAR_ENCODE(ExpeditionLockoutList_Struct);
OUT(client_id);
strn0cpy(eq->inviter_name, emu->inviter_name, sizeof(eq->inviter_name));
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
OUT(swapping);
strn0cpy(eq->swap_name, emu->swap_name, sizeof(eq->swap_name));
OUT(dz_zone_id);
OUT(dz_instance_id);
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionLockoutTimers)
{
SETUP_VAR_ENCODE(ExpeditionLockoutTimers_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->count);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&emu->count, sizeof(uint32));
for (uint32 i = 0; i < emu->count; ++i)
{
buf.WriteString(emu->timers[i].expedition_name);
buf.WriteUInt32(emu->timers[i].seconds_remaining);
buf.WriteInt32(emu->timers[i].event_type);
buf.WriteString(emu->timers[i].event_name);
ss.write(emu->entries[i].expedition, strlen(emu->entries[i].expedition));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&emu->entries[i].time_left, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write(emu->entries[i].expedition_event, strlen(emu->entries[i].expedition_event));
ss.write((const char*)&null_term, sizeof(char));
}
__packet->size = buf.size();
__packet->size = ss.str().length();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzSetLeaderName)
ENCODE(OP_DzJoinExpeditionConfirm)
{
ENCODE_LENGTH_EXACT(ExpeditionSetLeaderName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionSetLeaderName_Struct, structs::ExpeditionSetLeaderName_Struct);
ENCODE_LENGTH_EXACT(ExpeditionJoinPrompt_Struct);
SETUP_DIRECT_ENCODE(ExpeditionJoinPrompt_Struct, structs::ExpeditionJoinPrompt_Struct);
OUT(client_id);
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
strncpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
strncpy(eq->player_name, emu->player_name, sizeof(eq->player_name));
FINISH_ENCODE();
}
ENCODE(OP_DzLeaderStatus)
{
SETUP_VAR_ENCODE(ExpeditionLeaderSet_Struct);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write(emu->leader_name, strlen(emu->leader_name));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));//0xffffffff
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));//1
ss.write((const char*)&client_id, sizeof(uint32));
__packet->size = ss.str().length();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
FINISH_ENCODE();
}
@@ -886,43 +874,26 @@ namespace RoF2
{
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->member_count);
for (uint32 i = 0; i < emu->member_count; ++i)
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&emu->count, sizeof(uint32));
for (uint32 i = 0; i < emu->count; ++i)
{
buf.WriteString(emu->members[i].name);
buf.WriteUInt8(emu->members[i].expedition_status);
ss.write(emu->entries[i].name, strlen(emu->entries[i].name));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&emu->entries[i].status, sizeof(char));
}
__packet->size = buf.size();
__packet->size = ss.str().length();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzMemberListName)
{
ENCODE_LENGTH_EXACT(ExpeditionMemberListName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionMemberListName_Struct, structs::ExpeditionMemberListName_Struct);
OUT(client_id);
OUT(add_name);
strn0cpy(eq->name, emu->name, sizeof(eq->name));
FINISH_ENCODE();
}
ENCODE(OP_DzMemberListStatus)
{
auto emu = reinterpret_cast<ExpeditionMemberList_Struct*>((*p)->pBuffer);
if (emu->member_count == 1)
{
ENCODE_FORWARD(OP_DzMemberList);
}
}
ENCODE(OP_Emote)
{
EQApplicationPacket *in = *p;
@@ -1905,7 +1876,6 @@ namespace RoF2
OUT(FastRegenHP);
OUT(FastRegenMana);
OUT(FastRegenEndurance);
OUT(underworld_teleport_index);
eq->FogDensity = emu->fog_density;
@@ -4614,84 +4584,6 @@ namespace RoF2
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzAddPlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzChooseZoneReply)
{
DECODE_LENGTH_EXACT(structs::DynamicZoneChooseZoneReply_Struct);
SETUP_DIRECT_DECODE(DynamicZoneChooseZoneReply_Struct, structs::DynamicZoneChooseZoneReply_Struct);
IN(unknown000);
IN(unknown004);
IN(unknown008);
IN(unknown_id1);
IN(dz_zone_id);
IN(dz_instance_id);
IN(dz_type);
IN(unknown_id2);
IN(unknown028);
IN(unknown032);
IN(unknown036);
IN(unknown040);
IN(unknown044);
IN(unknown048);
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzExpeditionInviteResponse)
{
DECODE_LENGTH_EXACT(structs::ExpeditionInviteResponse_Struct);
SETUP_DIRECT_DECODE(ExpeditionInviteResponse_Struct, structs::ExpeditionInviteResponse_Struct);
IN(dz_zone_id);
IN(dz_instance_id);
IN(accepted);
IN(swapping);
strn0cpy(emu->swap_name, eq->swap_name, sizeof(emu->swap_name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzMakeLeader)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzRemovePlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzSwapPlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommandSwap_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommandSwap_Struct, structs::ExpeditionCommandSwap_Struct);
strn0cpy(emu->add_player_name, eq->add_player_name, sizeof(emu->add_player_name));
strn0cpy(emu->rem_player_name, eq->rem_player_name, sizeof(emu->rem_player_name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_Emote)
{
unsigned char *__eq_buffer = __packet->pBuffer;
+3 -12
View File
@@ -58,16 +58,13 @@ E(OP_DeleteCharge)
E(OP_DeleteItem)
E(OP_DeleteSpawn)
E(OP_DisciplineUpdate)
E(OP_DzChooseZone)
E(OP_DzCompass)
E(OP_DzExpeditionEndsWarning)
E(OP_DzExpeditionInfo)
E(OP_DzExpeditionInvite)
E(OP_DzExpeditionLockoutTimers)
E(OP_DzExpeditionList)
E(OP_DzJoinExpeditionConfirm)
E(OP_DzLeaderStatus)
E(OP_DzMemberList)
E(OP_DzMemberListName)
E(OP_DzMemberListStatus)
E(OP_DzSetLeaderName)
E(OP_Emote)
E(OP_ExpansionInfo)
E(OP_FormattedMessage)
@@ -162,12 +159,6 @@ D(OP_ConsiderCorpse)
D(OP_Consume)
D(OP_Damage)
D(OP_DeleteItem)
D(OP_DzAddPlayer)
D(OP_DzChooseZoneReply)
D(OP_DzExpeditionInviteResponse)
D(OP_DzMakeLeader)
D(OP_DzRemovePlayer)
D(OP_DzSwapPlayer)
D(OP_Emote)
D(OP_EnvDamage)
D(OP_FaceChange)
+27 -144
View File
@@ -628,7 +628,7 @@ struct NewZone_Struct {
/*0856*/ uint32 scriptNPCReceivedanItem;
/*0860*/ uint32 bCheck; // padded bool
/*0864*/ uint32 scriptIDSomething;
/*0868*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
/*0868*/ uint32 scriptIDSomething2;
/*0872*/ uint32 scriptIDSomething3;
/*0876*/ uint32 SuspendBuffs; // padded bool
/*0880*/ uint32 LavaDamage; // LavaDamage value
@@ -4882,169 +4882,52 @@ struct VeteranClaim
/*076*/ uint32 action;
};
struct ExpeditionInvite_Struct
{
/*000*/ uint32 client_id; // unique character id
/*004*/ uint32 unknown004;
/*008*/ char inviter_name[64];
/*072*/ char expedition_name[128];
/*200*/ uint8 swapping; // 0: adding 1: swapping
/*201*/ char swap_name[64]; // if swapping, swap name being removed
/*265*/ uint8 padding[3];
/*268*/ uint16 dz_zone_id; // dz_id zone/instance pair, sent back in reply
/*270*/ uint16 dz_instance_id;
};
struct ExpeditionInviteResponse_Struct
struct ExpeditionEntryHeader_Struct
{
/*000*/ uint32 unknown000;
/*000*/ uint32 number_of_entries;
};
struct ExpeditionJoinPrompt_Struct
{
/*000*/ uint32 clientid;
/*004*/ uint32 unknown004;
/*008*/ uint16 dz_zone_id; // dz_id pair sent in invite
/*010*/ uint16 dz_instance_id;
/*012*/ uint8 accepted; // 0: declined 1: accepted
/*013*/ uint8 swapping; // 0: adding 1: swapping (sent in invite)
/*014*/ char swap_name[64]; // swap name sent in invite
/*078*/ uint8 unknown078; // padding garbage?
/*079*/ uint8 unknown079; // padding garbage?
};
struct ExpeditionInfo_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ uint32 assigned; // padded bool, 0: not in expedition (clear data), 1: in expedition
/*012*/ uint32 max_players;
/*016*/ char expedition_name[128];
/*144*/ char leader_name[64];
//*208*/ uint32 unknown208; // live sends 01 00 00 00 here but client doesn't read it
};
struct ExpeditionMemberEntry_Struct
{
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
/*000*/ uint8 expedition_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
};
struct ExpeditionMemberList_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 member_count; // number of players in window
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
};
struct ExpeditionMemberListName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ uint32 add_name; // padded bool, 0: remove name, 1: add name with unknown status
/*012*/ char name[64];
};
struct ExpeditionLockoutTimerEntry_Struct
{
/*000*/ char expedition_name[1]; // variable length, null terminated, max 0x80 (128)
/*000*/ uint32 seconds_remaining;
/*000*/ int32 event_type; // seen -1 (0xffffffff) for replay timers and 1 for event timers
/*000*/ char event_name[1]; // variable length, null terminated, max 0x100 (256)
};
struct ExpeditionLockoutTimers_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
};
struct ExpeditionSetLeaderName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ char leader_name[64];
};
struct ExpeditionCommand_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004;
/*008*/ char name[64];
};
struct ExpeditionCommandSwap_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004;
/*008*/ char add_player_name[64]; // swap to (player must confirm)
/*072*/ char rem_player_name[64]; // swap from
/*008*/ char player_name[64];
/*072*/ char expedition_name[64];
};
struct ExpeditionExpireWarning
{
/*000*/ uint32 client_id;
/*000*/ uint32 clientid;
/*004*/ uint32 unknown004;
/*008*/ uint32 minutes_remaining;
};
struct DynamicZoneCompassEntry_Struct
struct ExpeditionInfo_Struct
{
/*000*/ uint16 dz_zone_id; // target dz id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
/*000*/ uint32 clientid;
/*004*/ uint32 unknown004;
/*008*/ uint32 unknown008;
/*012*/ uint32 max_players;
/*016*/ char expedition_name[128];
/*142*/ char leader_name[64];
};
struct ExpeditionCompassEntry_Struct
{
/*000*/ float unknown000; //seen *((uint32*)) = 1584791871
/*004*/ uint32 enabled; //guess
/*008*/ uint32 unknown008; //seen 1019
/*012*/ float y;
/*016*/ float x;
/*020*/ float z;
};
struct DynamicZoneCompass_Struct
struct ExpeditionCompass_Struct
{
/*000*/ uint32 client_id;
/*000*/ uint32 clientid;
/*004*/ uint32 count;
/*008*/ DynamicZoneCompassEntry_Struct entries[0];
};
struct DynamicZoneChooseZoneEntry_Struct
{
/*000*/ uint16 dz_zone_id; // dz_id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 unknown_id1; // seen 28 00 00 00 (40), sent back in reply
/*008*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest -- sent back in reply
/*012*/ uint32 unknown_id2; // possibly an id based on dz type, for expeditions this was same as dz_id (zone|instance) but task dz was different
/*016*/ char description[1]; // variable length, null terminated, max 0x80 (128)
/*000*/ char leader_name[1]; // variable length, null terminated, max 0x40 (64)
};
struct DynamicZoneChooseZone_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ DynamicZoneChooseZoneEntry_Struct choices[0];
};
struct DynamicZoneChooseZoneReply_Struct
{
/*000*/ uint32 unknown000; // ff ff ff ff
/*004*/ uint32 unknown004; // seen 69 00 00 00
/*008*/ uint32 unknown008; // ff ff ff ff
/*012*/ uint32 unknown_id1; // from choose zone entry message
/*016*/ uint16 dz_zone_id; // dz_id pair
/*018*/ uint16 dz_instance_id;
/*020*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest
/*024*/ uint32 unknown_id2; // from choose zone entry message
/*028*/ uint32 unknown028; // 00 00 00 00
/*032*/ uint32 unknown032; // always same as unknown044
/*036*/ uint32 unknown036;
/*040*/ uint32 unknown040;
/*044*/ uint32 unknown044; // always same as unknown032
/*048*/ uint32 unknown048; // seen 01 00 00 00 and 02 00 00 00
};
struct KickPlayers_Struct
{
/*000*/ char char_name[64];
/*064*/ uint32 unknown064; // always 0
/*068*/ uint8 kick_expedition; // true if /kickplayers exp
/*069*/ uint8 kick_task; // true if /kickplayers task
/*070*/ uint8 padding[2];
/*008*/ ExpeditionCompassEntry_Struct entries[0];
};
struct MaxCharacters_Struct
+3 -12
View File
@@ -44,16 +44,13 @@ E(OP_DeleteCharge)
E(OP_DeleteItem)
E(OP_DeleteSpawn)
E(OP_DisciplineUpdate)
E(OP_DzChooseZone)
E(OP_DzCompass)
E(OP_DzExpeditionEndsWarning)
E(OP_DzExpeditionInfo)
E(OP_DzExpeditionInvite)
E(OP_DzExpeditionLockoutTimers)
E(OP_DzExpeditionList)
E(OP_DzJoinExpeditionConfirm)
E(OP_DzLeaderStatus)
E(OP_DzMemberList)
E(OP_DzMemberListName)
E(OP_DzMemberListStatus)
E(OP_DzSetLeaderName)
E(OP_Emote)
E(OP_ExpansionInfo)
E(OP_FormattedMessage)
@@ -148,12 +145,6 @@ D(OP_ConsiderCorpse)
D(OP_Consume)
D(OP_Damage)
D(OP_DeleteItem)
D(OP_DzAddPlayer)
D(OP_DzChooseZoneReply)
D(OP_DzExpeditionInviteResponse)
D(OP_DzMakeLeader)
D(OP_DzRemovePlayer)
D(OP_DzSwapPlayer)
D(OP_Emote)
D(OP_EnvDamage)
D(OP_FaceChange)
+27 -138
View File
@@ -575,11 +575,7 @@ struct NewZone_Struct {
/*0848*/ int32 unknown848;
/*0852*/ uint16 zone_id;
/*0854*/ uint16 zone_instance;
/*0856*/ uint32 scriptNPCReceivedanItem;
/*0860*/ uint32 bCheck; // padded bool
/*0864*/ uint32 scriptIDSomething;
/*0868*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
/*0872*/ uint32 scriptIDSomething3;
/*0856*/ char unknown856[20];
/*0876*/ uint32 SuspendBuffs;
/*0880*/ uint32 unknown880; // Seen 50
/*0884*/ uint32 unknown884; // Seen 10
@@ -4815,159 +4811,52 @@ struct VeteranClaim
/*076*/ uint32 action;
};
struct ExpeditionInvite_Struct
{
/*000*/ uint32 client_id; // unique character id
/*004*/ uint32 unknown004;
/*008*/ char inviter_name[64];
/*072*/ char expedition_name[128];
/*200*/ uint8 swapping; // 0: adding 1: swapping
/*201*/ char swap_name[64]; // if swapping, swap name being removed
/*265*/ uint8 padding[3];
/*268*/ uint16 dz_zone_id; // dz_id zone/instance pair, sent back in reply
/*270*/ uint16 dz_instance_id;
};
struct ExpeditionInviteResponse_Struct
struct ExpeditionEntryHeader_Struct
{
/*000*/ uint32 unknown000;
/*000*/ uint32 number_of_entries;
};
struct ExpeditionJoinPrompt_Struct
{
/*000*/ uint32 clientid;
/*004*/ uint32 unknown004;
/*008*/ uint16 dz_zone_id; // dz_id pair sent in invite
/*010*/ uint16 dz_instance_id;
/*012*/ uint8 accepted; // 0: declined 1: accepted
/*013*/ uint8 swapping; // 0: adding 1: swapping (sent in invite)
/*014*/ char swap_name[64]; // swap name sent in invite
/*078*/ uint8 unknown078; // padding garbage?
/*079*/ uint8 unknown079; // padding garbage?
};
struct ExpeditionInfo_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ uint32 assigned; // padded bool
/*012*/ uint32 max_players;
/*016*/ char expedition_name[128];
/*144*/ char leader_name[64];
};
struct ExpeditionMemberEntry_Struct
{
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
/*000*/ uint8 expedition_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
};
struct ExpeditionMemberList_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 member_count; // number of players in window
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
};
struct ExpeditionMemberListName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ uint32 add_name; // padded bool, 0: remove name, 1: add name with unknown status
/*012*/ char name[64];
};
struct ExpeditionLockoutTimerEntry_Struct
{
/*000*/ char expedition_name[1]; // variable length, null terminated, max 0x80 (128)
/*000*/ uint32 seconds_remaining;
/*000*/ int32 event_type; // seen -1 (0xffffffff) for replay timers and 1 for event timers
/*000*/ char event_name[1]; // variable length, null terminated, max 0x100 (256)
};
struct ExpeditionLockoutTimers_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
};
struct ExpeditionSetLeaderName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ char leader_name[64];
};
struct ExpeditionCommand_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004;
/*008*/ char name[64];
};
struct ExpeditionCommandSwap_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004;
/*008*/ char add_player_name[64]; // swap to (player must confirm)
/*072*/ char rem_player_name[64]; // swap from
/*008*/ char player_name[64];
/*072*/ char expedition_name[64];
};
struct ExpeditionExpireWarning
{
/*000*/ uint32 client_id;
/*000*/ uint32 clientid;
/*004*/ uint32 unknown004;
/*008*/ uint32 minutes_remaining;
};
struct DynamicZoneCompassEntry_Struct
struct ExpeditionInfo_Struct
{
/*000*/ uint16 dz_zone_id; // target dz id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
/*000*/ uint32 clientid;
/*004*/ uint32 unknown004;
/*008*/ uint32 unknown008;
/*012*/ uint32 max_players;
/*016*/ char expedition_name[128];
/*142*/ char leader_name[64];
};
struct ExpeditionCompassEntry_Struct
{
/*000*/ float unknown000; //seen *((uint32*)) = 1584791871
/*004*/ uint32 enabled; //guess
/*008*/ uint32 unknown008; //seen 1019
/*012*/ float y;
/*016*/ float x;
/*020*/ float z;
};
struct DynamicZoneCompass_Struct
struct ExpeditionCompass_Struct
{
/*000*/ uint32 client_id;
/*000*/ uint32 clientid;
/*004*/ uint32 count;
/*008*/ DynamicZoneCompassEntry_Struct entries[0];
};
struct DynamicZoneChooseZoneEntry_Struct
{
/*000*/ uint16 dz_zone_id; // dz_id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 unknown_id1; // sent back in reply
/*008*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest -- sent back in reply
/*012*/ uint32 unknown_id2; // possibly an id based on dz type, for expeditions this was same as dz_id (zone|instance) but task dz was different
/*016*/ char description[1]; // variable length, null terminated, max 0x80 (128)
/*000*/ char leader_name[1]; // variable length, null terminated, max 0x40 (64)
};
struct DynamicZoneChooseZone_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ DynamicZoneChooseZoneEntry_Struct choices[0];
};
struct DynamicZoneChooseZoneReply_Struct
{
/*000*/ uint32 unknown000; // ff ff ff ff
/*004*/ uint32 unknown004; // seen 69 00 00 00
/*008*/ uint32 unknown008; // ff ff ff ff
/*012*/ uint32 unknown_id1; // from choose zone entry message
/*016*/ uint16 dz_zone_id; // dz_id pair
/*018*/ uint16 dz_instance_id;
/*020*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest
/*024*/ uint32 unknown_id2; // from choose zone entry message
/*028*/ uint32 unknown028; // 00 00 00 00
/*032*/ uint32 unknown032; // always same as unknown044
/*036*/ uint32 unknown036;
/*040*/ uint32 unknown040;
/*044*/ uint32 unknown044; // always same as unknown032
/*048*/ uint32 unknown048; // seen 01 00 00 00 and 02 00 00 00
/*008*/ ExpeditionCompassEntry_Struct entries[0];
};
struct MaxCharacters_Struct
+71 -180
View File
@@ -483,48 +483,15 @@ namespace SoD
FINISH_ENCODE();
}
ENCODE(OP_DzChooseZone)
{
SETUP_VAR_ENCODE(DynamicZoneChooseZone_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->count);
for (uint32 i = 0; i < emu->count; ++i)
{
buf.WriteUInt16(emu->choices[i].dz_zone_id);
buf.WriteUInt16(emu->choices[i].dz_instance_id);
buf.WriteUInt32(emu->choices[i].unknown_id1);
buf.WriteUInt32(emu->choices[i].dz_type);
buf.WriteUInt32(emu->choices[i].unknown_id2);
buf.WriteString(emu->choices[i].description);
buf.WriteString(emu->choices[i].leader_name);
}
__packet->size = buf.size();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzCompass)
{
SETUP_VAR_ENCODE(DynamicZoneCompass_Struct);
ALLOC_VAR_ENCODE(structs::DynamicZoneCompass_Struct,
sizeof(structs::DynamicZoneCompass_Struct) +
sizeof(structs::DynamicZoneCompassEntry_Struct) * emu->count
);
SETUP_VAR_ENCODE(ExpeditionCompass_Struct);
ALLOC_VAR_ENCODE(structs::ExpeditionCompass_Struct, sizeof(structs::ExpeditionInfo_Struct) + sizeof(structs::ExpeditionCompassEntry_Struct) * emu->count);
OUT(client_id);
OUT(count);
for (uint32 i = 0; i < emu->count; ++i)
{
OUT(entries[i].dz_zone_id);
OUT(entries[i].dz_instance_id);
OUT(entries[i].dz_type);
OUT(entries[i].x);
OUT(entries[i].y);
OUT(entries[i].z);
@@ -548,60 +515,81 @@ namespace SoD
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
OUT(client_id);
OUT(assigned);
OUT(max_players);
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
eq->unknown004 = 785316192;
eq->unknown008 = 435601;
strcpy(eq->expedition_name, emu->expedition_name);
strcpy(eq->leader_name, emu->leader_name);
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionInvite)
ENCODE(OP_DzExpeditionList)
{
ENCODE_LENGTH_EXACT(ExpeditionInvite_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInvite_Struct, structs::ExpeditionInvite_Struct);
SETUP_VAR_ENCODE(ExpeditionLockoutList_Struct);
OUT(client_id);
strn0cpy(eq->inviter_name, emu->inviter_name, sizeof(eq->inviter_name));
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
OUT(swapping);
strn0cpy(eq->swap_name, emu->swap_name, sizeof(eq->swap_name));
OUT(dz_zone_id);
OUT(dz_instance_id);
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionLockoutTimers)
{
SETUP_VAR_ENCODE(ExpeditionLockoutTimers_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->count);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&emu->count, sizeof(uint32));
for (uint32 i = 0; i < emu->count; ++i)
{
buf.WriteString(emu->timers[i].expedition_name);
buf.WriteUInt32(emu->timers[i].seconds_remaining);
buf.WriteInt32(emu->timers[i].event_type);
buf.WriteString(emu->timers[i].event_name);
ss.write(emu->entries[i].expedition, strlen(emu->entries[i].expedition));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&emu->entries[i].time_left, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write(emu->entries[i].expedition_event, strlen(emu->entries[i].expedition_event));
ss.write((const char*)&null_term, sizeof(char));
}
__packet->size = buf.size();
__packet->size = ss.str().length();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzSetLeaderName)
ENCODE(OP_DzJoinExpeditionConfirm)
{
ENCODE_LENGTH_EXACT(ExpeditionSetLeaderName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionSetLeaderName_Struct, structs::ExpeditionSetLeaderName_Struct);
ENCODE_LENGTH_EXACT(ExpeditionJoinPrompt_Struct);
SETUP_DIRECT_ENCODE(ExpeditionJoinPrompt_Struct, structs::ExpeditionJoinPrompt_Struct);
OUT(client_id);
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
strcpy(eq->expedition_name, emu->expedition_name);
strcpy(eq->player_name, emu->player_name);
FINISH_ENCODE();
}
ENCODE(OP_DzLeaderStatus)
{
SETUP_VAR_ENCODE(ExpeditionLeaderSet_Struct);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write(emu->leader_name, strlen(emu->leader_name));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));//0xffffffff
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));//1
ss.write((const char*)&client_id, sizeof(uint32));
__packet->size = ss.str().length();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
FINISH_ENCODE();
}
@@ -610,44 +598,26 @@ namespace SoD
{
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->member_count);
for (uint32 i = 0; i < emu->member_count; ++i)
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&emu->count, sizeof(uint32));
for (uint32 i = 0; i < emu->count; ++i)
{
buf.WriteString(emu->members[i].name);
buf.WriteUInt8(emu->members[i].expedition_status);
ss.write(emu->entries[i].name, strlen(emu->entries[i].name));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&emu->entries[i].status, sizeof(char));
}
__packet->size = buf.size();
__packet->size = ss.str().length();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzMemberListName)
{
ENCODE_LENGTH_EXACT(ExpeditionMemberListName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionMemberListName_Struct, structs::ExpeditionMemberListName_Struct);
OUT(client_id);
OUT(add_name);
strn0cpy(eq->name, emu->name, sizeof(eq->name));
FINISH_ENCODE();
}
ENCODE(OP_DzMemberListStatus)
{
auto emu = reinterpret_cast<ExpeditionMemberList_Struct*>((*p)->pBuffer);
if (emu->member_count == 1)
{
ENCODE_FORWARD(OP_DzMemberList);
}
}
ENCODE(OP_Emote)
{
EQApplicationPacket *in = *p;
@@ -1383,7 +1353,6 @@ namespace SoD
OUT(FastRegenHP);
OUT(FastRegenMana);
OUT(FastRegenEndurance);
OUT(underworld_teleport_index);
/*fill in some unknowns with observed values, hopefully it will help */
eq->unknown800 = -1;
@@ -3004,84 +2973,6 @@ namespace SoD
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzAddPlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzChooseZoneReply)
{
DECODE_LENGTH_EXACT(structs::DynamicZoneChooseZoneReply_Struct);
SETUP_DIRECT_DECODE(DynamicZoneChooseZoneReply_Struct, structs::DynamicZoneChooseZoneReply_Struct);
IN(unknown000);
IN(unknown004);
IN(unknown008);
IN(unknown_id1);
IN(dz_zone_id);
IN(dz_instance_id);
IN(dz_type);
IN(unknown_id2);
IN(unknown028);
IN(unknown032);
IN(unknown036);
IN(unknown040);
IN(unknown044);
IN(unknown048);
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzExpeditionInviteResponse)
{
DECODE_LENGTH_EXACT(structs::ExpeditionInviteResponse_Struct);
SETUP_DIRECT_DECODE(ExpeditionInviteResponse_Struct, structs::ExpeditionInviteResponse_Struct);
IN(dz_zone_id);
IN(dz_instance_id);
IN(accepted);
IN(swapping);
strn0cpy(emu->swap_name, eq->swap_name, sizeof(emu->swap_name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzMakeLeader)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzRemovePlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzSwapPlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommandSwap_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommandSwap_Struct, structs::ExpeditionCommandSwap_Struct);
strn0cpy(emu->add_player_name, eq->add_player_name, sizeof(emu->add_player_name));
strn0cpy(emu->rem_player_name, eq->rem_player_name, sizeof(emu->rem_player_name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_Emote)
{
unsigned char *__eq_buffer = __packet->pBuffer;
+3 -12
View File
@@ -35,16 +35,13 @@ E(OP_Consider)
E(OP_Damage)
E(OP_DeleteCharge)
E(OP_DeleteItem)
E(OP_DzChooseZone)
E(OP_DzCompass)
E(OP_DzExpeditionEndsWarning)
E(OP_DzExpeditionInfo)
E(OP_DzExpeditionInvite)
E(OP_DzExpeditionLockoutTimers)
E(OP_DzExpeditionList)
E(OP_DzJoinExpeditionConfirm)
E(OP_DzLeaderStatus)
E(OP_DzMemberList)
E(OP_DzMemberListName)
E(OP_DzMemberListStatus)
E(OP_DzSetLeaderName)
E(OP_Emote)
E(OP_ExpansionInfo)
E(OP_FormattedMessage)
@@ -114,12 +111,6 @@ D(OP_Consider)
D(OP_ConsiderCorpse)
D(OP_Consume)
D(OP_DeleteItem)
D(OP_DzAddPlayer)
D(OP_DzChooseZoneReply)
D(OP_DzExpeditionInviteResponse)
D(OP_DzMakeLeader)
D(OP_DzRemovePlayer)
D(OP_DzSwapPlayer)
D(OP_Emote)
D(OP_FaceChange)
D(OP_FindPersonRequest)
+27 -139
View File
@@ -444,11 +444,7 @@ struct NewZone_Struct {
/*0848*/ int32 unknown848;
/*0852*/ uint16 zone_id;
/*0854*/ uint16 zone_instance;
/*0856*/ uint32 scriptNPCReceivedanItem;
/*0860*/ uint32 bCheck; // padded bool
/*0864*/ uint32 scriptIDSomething;
/*0868*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
/*0872*/ uint32 scriptIDSomething3;
/*0856*/ char unknown856[20];
/*0876*/ uint32 SuspendBuffs;
/*0880*/ uint32 unknown880; //seen 50
/*0884*/ uint32 unknown884; //seen 10
@@ -4169,160 +4165,52 @@ struct VeteranReward
/*012*/ VeteranRewardItem items[8];
};
struct ExpeditionInvite_Struct
{
/*000*/ uint32 client_id; // unique character id
/*004*/ uint32 unknown004;
/*008*/ char inviter_name[64];
/*072*/ char expedition_name[128];
/*200*/ uint8 swapping; // 0: adding 1: swapping
/*201*/ char swap_name[64]; // if swapping, swap name being removed
/*265*/ uint8 padding[3];
/*268*/ uint16 dz_zone_id; // dz_id zone/instance pair, sent back in reply
/*270*/ uint16 dz_instance_id;
};
struct ExpeditionInviteResponse_Struct
struct ExpeditionEntryHeader_Struct
{
/*000*/ uint32 unknown000;
/*000*/ uint32 number_of_entries;
};
struct ExpeditionJoinPrompt_Struct
{
/*000*/ uint32 clientid;
/*004*/ uint32 unknown004;
/*008*/ uint16 dz_zone_id; // dz_id pair sent in invite
/*010*/ uint16 dz_instance_id;
/*012*/ uint8 accepted; // 0: declined 1: accepted
/*013*/ uint8 swapping; // 0: adding 1: swapping (sent in invite)
/*014*/ char swap_name[64]; // swap name sent in invite
/*078*/ uint8 unknown078; // padding garbage?
/*079*/ uint8 unknown079; // padding garbage?
};
struct ExpeditionInfo_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ uint32 assigned; // padded bool
/*012*/ uint32 max_players;
/*016*/ char expedition_name[128];
/*144*/ char leader_name[64];
};
struct ExpeditionMemberEntry_Struct
{
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
/*000*/ uint8 expedition_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
};
struct ExpeditionMemberList_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 member_count; // number of players in window
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
};
struct ExpeditionMemberListName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ uint32 add_name; // padded bool, 0: remove name, 1: add name with unknown status
/*012*/ char name[64];
};
struct ExpeditionLockoutTimerEntry_Struct
{
/*000*/ char expedition_name[1]; // variable length, null terminated, max 0x80 (128)
/*000*/ uint32 seconds_remaining;
/*000*/ int32 event_type; // seen -1 (0xffffffff) for replay timers and 1 for event timers
/*000*/ char event_name[1]; // variable length, null terminated, max 0x100 (256)
};
struct ExpeditionLockoutTimers_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
};
struct ExpeditionSetLeaderName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ char leader_name[64];
};
struct ExpeditionCommand_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004;
/*008*/ char name[64];
};
struct ExpeditionCommandSwap_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004;
/*008*/ char add_player_name[64]; // swap to (player must confirm)
/*072*/ char rem_player_name[64]; // swap from
/*008*/ char player_name[64];
/*072*/ char expedition_name[64];
};
struct ExpeditionExpireWarning
{
/*000*/ uint32 client_id;
/*000*/ uint32 clientid;
/*004*/ uint32 unknown004;
/*008*/ uint32 minutes_remaining;
};
struct DynamicZoneCompassEntry_Struct
struct ExpeditionInfo_Struct
{
/*000*/ uint16 dz_zone_id; // target dz id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
/*000*/ uint32 clientid;
/*004*/ uint32 unknown004;
/*008*/ uint32 unknown008;
/*012*/ uint32 max_players;
/*016*/ char expedition_name[128];
/*142*/ char leader_name[64];
};
struct ExpeditionCompassEntry_Struct
{
/*000*/ float unknown000; //seen *((uint32*)) = 1584791871
/*004*/ uint32 enabled; //guess
/*008*/ uint32 unknown008; //seen 1019
/*012*/ float y;
/*016*/ float x;
/*020*/ float z;
};
struct DynamicZoneCompass_Struct
struct ExpeditionCompass_Struct
{
/*000*/ uint32 client_id;
/*000*/ uint32 clientid;
/*004*/ uint32 count;
/*008*/ DynamicZoneCompassEntry_Struct entries[0];
};
struct DynamicZoneChooseZoneEntry_Struct
{
/*000*/ uint16 dz_zone_id; // dz_id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 unknown_id1; // sent back in reply
/*008*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest -- sent back in reply
/*012*/ uint32 unknown_id2; // possibly an id based on dz type, for expeditions this was same as dz_id (zone|instance) but task dz was different
/*016*/ char description[1]; // variable length, null terminated, max 0x80 (128)
/*000*/ char leader_name[1]; // variable length, null terminated, max 0x40 (64)
};
struct DynamicZoneChooseZone_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ DynamicZoneChooseZoneEntry_Struct choices[0];
};
struct DynamicZoneChooseZoneReply_Struct
{
/*000*/ uint32 unknown000; // ff ff ff ff
/*004*/ uint32 unknown004; // seen 69 00 00 00
/*008*/ uint32 unknown008; // ff ff ff ff
/*012*/ uint32 unknown_id1; // from choose zone entry message
/*016*/ uint16 dz_zone_id; // dz_id pair
/*018*/ uint16 dz_instance_id;
/*020*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest
/*024*/ uint32 unknown_id2; // from choose zone entry message
/*028*/ uint32 unknown028; // 00 00 00 00
/*032*/ uint32 unknown032; // always same as unknown044
/*036*/ uint32 unknown036;
/*040*/ uint32 unknown040;
/*044*/ uint32 unknown044; // always same as unknown032
/*048*/ uint32 unknown048; // seen 01 00 00 00 and 02 00 00 00
/*008*/ ExpeditionCompassEntry_Struct entries[0];
};
struct AltCurrencySelectItem_Struct {
+71 -180
View File
@@ -471,48 +471,14 @@ namespace SoF
FINISH_ENCODE();
}
ENCODE(OP_DzChooseZone)
{
SETUP_VAR_ENCODE(DynamicZoneChooseZone_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->count);
for (uint32 i = 0; i < emu->count; ++i)
{
buf.WriteUInt16(emu->choices[i].dz_zone_id);
buf.WriteUInt16(emu->choices[i].dz_instance_id);
buf.WriteUInt32(emu->choices[i].unknown_id1);
buf.WriteUInt32(emu->choices[i].dz_type);
buf.WriteUInt32(emu->choices[i].unknown_id2);
buf.WriteString(emu->choices[i].description);
buf.WriteString(emu->choices[i].leader_name);
}
__packet->size = buf.size();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzCompass)
{
SETUP_VAR_ENCODE(DynamicZoneCompass_Struct);
ALLOC_VAR_ENCODE(structs::DynamicZoneCompass_Struct,
sizeof(structs::DynamicZoneCompass_Struct) +
sizeof(structs::DynamicZoneCompassEntry_Struct) * emu->count
);
OUT(client_id);
SETUP_VAR_ENCODE(ExpeditionCompass_Struct);
ALLOC_VAR_ENCODE(structs::ExpeditionCompass_Struct, sizeof(structs::ExpeditionInfo_Struct) + sizeof(structs::ExpeditionCompassEntry_Struct) * emu->count);
OUT(count);
for (uint32 i = 0; i < emu->count; ++i)
{
OUT(entries[i].dz_zone_id);
OUT(entries[i].dz_instance_id);
OUT(entries[i].dz_type);
OUT(entries[i].x);
OUT(entries[i].y);
OUT(entries[i].z);
@@ -536,60 +502,80 @@ namespace SoF
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
OUT(client_id);
OUT(assigned);
OUT(max_players);
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
eq->enabled_max = 1;
strcpy(eq->expedition_name, emu->expedition_name);
strcpy(eq->leader_name, emu->leader_name);
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionInvite)
ENCODE(OP_DzExpeditionList)
{
ENCODE_LENGTH_EXACT(ExpeditionInvite_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInvite_Struct, structs::ExpeditionInvite_Struct);
SETUP_VAR_ENCODE(ExpeditionLockoutList_Struct);
OUT(client_id);
strn0cpy(eq->inviter_name, emu->inviter_name, sizeof(eq->inviter_name));
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
OUT(swapping);
strn0cpy(eq->swap_name, emu->swap_name, sizeof(eq->swap_name));
OUT(dz_zone_id);
OUT(dz_instance_id);
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionLockoutTimers)
{
SETUP_VAR_ENCODE(ExpeditionLockoutTimers_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->count);
for (uint32 i = 0; i < emu->count; ++i)
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&emu->count, sizeof(uint32));
for (int i = 0; i < emu->count; ++i)
{
buf.WriteString(emu->timers[i].expedition_name);
buf.WriteUInt32(emu->timers[i].seconds_remaining);
buf.WriteInt32(emu->timers[i].event_type);
buf.WriteString(emu->timers[i].event_name);
ss.write(emu->entries[i].expedition, strlen(emu->entries[i].expedition));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&emu->entries[i].time_left, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write(emu->entries[i].expedition_event, strlen(emu->entries[i].expedition_event));
ss.write((const char*)&null_term, sizeof(char));
}
__packet->size = buf.size();
__packet->size = ss.str().length();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzSetLeaderName)
ENCODE(OP_DzJoinExpeditionConfirm)
{
ENCODE_LENGTH_EXACT(ExpeditionSetLeaderName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionSetLeaderName_Struct, structs::ExpeditionSetLeaderName_Struct);
ENCODE_LENGTH_EXACT(ExpeditionJoinPrompt_Struct);
SETUP_DIRECT_ENCODE(ExpeditionJoinPrompt_Struct, structs::ExpeditionJoinPrompt_Struct);
OUT(client_id);
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
strcpy(eq->expedition_name, emu->expedition_name);
strcpy(eq->player_name, emu->player_name);
FINISH_ENCODE();
}
ENCODE(OP_DzLeaderStatus)
{
SETUP_VAR_ENCODE(ExpeditionLeaderSet_Struct);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
//ss.write((const char*)&client_id, sizeof(uint32));
ss.write(emu->leader_name, strlen(emu->leader_name));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));//0xffffffff
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));//1
ss.write((const char*)&client_id, sizeof(uint32));
__packet->size = ss.str().length();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
FINISH_ENCODE();
}
@@ -598,43 +584,26 @@ namespace SoF
{
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->member_count);
for (uint32 i = 0; i < emu->member_count; ++i)
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&emu->count, sizeof(uint32));
for (uint32 i = 0; i < emu->count; ++i)
{
buf.WriteString(emu->members[i].name);
buf.WriteUInt8(emu->members[i].expedition_status);
ss.write(emu->entries[i].name, strlen(emu->entries[i].name));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&emu->entries[i].status, sizeof(char));
}
__packet->size = buf.size();
__packet->size = ss.str().length();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzMemberListName)
{
ENCODE_LENGTH_EXACT(ExpeditionMemberListName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionMemberListName_Struct, structs::ExpeditionMemberListName_Struct);
OUT(client_id);
OUT(add_name);
strn0cpy(eq->name, emu->name, sizeof(eq->name));
FINISH_ENCODE();
}
ENCODE(OP_DzMemberListStatus)
{
auto emu = reinterpret_cast<ExpeditionMemberList_Struct*>((*p)->pBuffer);
if (emu->member_count == 1)
{
ENCODE_FORWARD(OP_DzMemberList);
}
}
ENCODE(OP_Emote)
{
EQApplicationPacket *in = *p;
@@ -1061,7 +1030,6 @@ namespace SoF
OUT(FastRegenHP);
OUT(FastRegenMana);
OUT(FastRegenEndurance);
OUT(underworld_teleport_index);
/*fill in some unknowns with observed values, hopefully it will help */
eq->unknown796 = -1;
@@ -2466,83 +2434,6 @@ namespace SoF
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzAddPlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzChooseZoneReply)
{
DECODE_LENGTH_EXACT(structs::DynamicZoneChooseZoneReply_Struct);
SETUP_DIRECT_DECODE(DynamicZoneChooseZoneReply_Struct, structs::DynamicZoneChooseZoneReply_Struct);
emu->unknown000 = eq->unknown000;
emu->unknown008 = eq->unknown004;
IN(unknown_id1);
IN(dz_zone_id);
IN(dz_instance_id);
IN(dz_type);
IN(unknown_id2);
emu->unknown028 = eq->unknown024;
emu->unknown032 = eq->unknown028;
emu->unknown036 = eq->unknown032;
emu->unknown040 = eq->unknown036;
emu->unknown044 = eq->unknown040;
emu->unknown048 = eq->unknown044;
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzExpeditionInviteResponse)
{
DECODE_LENGTH_EXACT(structs::ExpeditionInviteResponse_Struct);
SETUP_DIRECT_DECODE(ExpeditionInviteResponse_Struct, structs::ExpeditionInviteResponse_Struct);
IN(dz_zone_id);
IN(dz_instance_id);
IN(accepted);
IN(swapping);
strn0cpy(emu->swap_name, eq->swap_name, sizeof(emu->swap_name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzMakeLeader)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzRemovePlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzSwapPlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommandSwap_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommandSwap_Struct, structs::ExpeditionCommandSwap_Struct);
strn0cpy(emu->add_player_name, eq->add_player_name, sizeof(emu->add_player_name));
strn0cpy(emu->rem_player_name, eq->rem_player_name, sizeof(emu->rem_player_name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_Emote)
{
unsigned char *__eq_buffer = __packet->pBuffer;
+3 -12
View File
@@ -36,16 +36,13 @@ E(OP_Damage)
E(OP_DeleteCharge)
E(OP_DeleteItem)
E(OP_DeleteSpawn)
E(OP_DzChooseZone)
E(OP_DzCompass)
E(OP_DzExpeditionEndsWarning)
E(OP_DzExpeditionInfo)
E(OP_DzExpeditionInvite)
E(OP_DzExpeditionLockoutTimers)
E(OP_DzExpeditionList)
E(OP_DzJoinExpeditionConfirm)
E(OP_DzLeaderStatus)
E(OP_DzMemberList)
E(OP_DzMemberListName)
E(OP_DzMemberListStatus)
E(OP_DzSetLeaderName)
E(OP_Emote)
E(OP_ExpansionInfo)
E(OP_FormattedMessage)
@@ -106,12 +103,6 @@ D(OP_Consider)
D(OP_ConsiderCorpse)
D(OP_Consume)
D(OP_DeleteItem)
D(OP_DzAddPlayer)
D(OP_DzChooseZoneReply)
D(OP_DzExpeditionInviteResponse)
D(OP_DzMakeLeader)
D(OP_DzRemovePlayer)
D(OP_DzSwapPlayer)
D(OP_Emote)
D(OP_FaceChange)
D(OP_FindPersonRequest)
+18 -129
View File
@@ -448,11 +448,7 @@ struct NewZone_Struct {
/*0844*/ int32 unknown844;
/*0848*/ uint16 zone_id;
/*0850*/ uint16 zone_instance;
/*0852*/ uint32 scriptNPCReceivedanItem;
/*0856*/ uint32 bCheck; // padded bool
/*0860*/ uint32 scriptIDSomething;
/*0864*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
/*0868*/ uint32 scriptIDSomething3;
/*0852*/ char unknown852[20];
/*0872*/ uint32 SuspendBuffs;
/*0876*/ uint32 unknown876; //seen 50
/*0880*/ uint32 unknown880; //seen 10
@@ -4088,150 +4084,43 @@ struct VeteranReward
/*012*/ VeteranRewardItem items[8];
};
struct ExpeditionInvite_Struct
{
/*000*/ uint32 client_id;
/*004*/ char inviter_name[64];
/*068*/ char expedition_name[128];
/*196*/ uint8 swapping; // 0: adding 1: swapping
/*197*/ char swap_name[64]; // if swapping, swap name being removed
/*261*/ uint8 padding[3];
/*264*/ uint16 dz_zone_id; // dz_id zone/instance pair, sent back in reply
/*268*/ uint16 dz_instance_id;
};
struct ExpeditionInviteResponse_Struct
struct ExpeditionExpireWarning
{
/*000*/ uint32 unknown000;
/*004*/ uint16 dz_zone_id; // dz_id pair sent in invite
/*006*/ uint16 dz_instance_id;
/*008*/ uint8 accepted; // 0: declined 1: accepted
/*009*/ uint8 swapping; // 0: adding 1: swapping (sent in invite)
/*010*/ char swap_name[64]; // swap name sent in invite
/*074*/ uint8 unknown078; // padding/garbage?
/*075*/ uint8 unknown079; // padding/garbage?
/*004*/ uint32 minutes_remaining;
};
struct ExpeditionInfo_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 assigned; // padded bool
/*000*/ uint32 clientid;
/*004*/ uint32 enabled_max;
/*008*/ uint32 max_players;
/*012*/ char expedition_name[128];
/*140*/ char leader_name[64];
/*012*/ char expedition_name[128];
/*142*/ char leader_name[64];
};
struct ExpeditionMemberEntry_Struct
struct ExpeditionCompassEntry_Struct
{
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
/*000*/ uint8 expedition_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
};
struct ExpeditionMemberList_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 member_count;
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
};
struct ExpeditionMemberListName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 add_name; // padded bool, 0: remove name, 1: add name with unknown status
/*008*/ char name[64];
};
struct ExpeditionLockoutTimerEntry_Struct
{
/*000*/ char expedition_name[1]; // variable length, null terminated, max 0x80 (128)
/*000*/ uint32 seconds_remaining;
/*000*/ int32 event_type; // seen -1 (0xffffffff) for replay timers and 1 for event timers
/*000*/ char event_name[1]; // variable length, null terminated, max 0x100 (256)
};
struct ExpeditionLockoutTimers_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
};
struct ExpeditionSetLeaderName_Struct
{
/*000*/ uint32 client_id;
/*004*/ char leader_name[64];
};
struct ExpeditionCommand_Struct
{
/*000*/ uint32 unknown000;
/*004*/ char name[64];
};
struct ExpeditionCommandSwap_Struct
{
/*000*/ uint32 unknown000;
/*004*/ char add_player_name[64]; // swap to (player must confirm)
/*068*/ char rem_player_name[64]; // swap from
};
struct ExpeditionExpireWarning
{
/*000*/ uint32 client_id;
/*004*/ uint32 minutes_remaining;
};
struct DynamicZoneCompassEntry_Struct
{
/*000*/ uint16 dz_zone_id; // target dz id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
/*008*/ uint32 unknown008;
/*000*/ float unknown000; //seen *((uint32*)) = 1584791871
/*004*/ uint32 enabled; //guess
/*008*/ uint32 unknown008; //seen 1019
/*012*/ float y;
/*016*/ float x;
/*020*/ float z;
};
struct DynamicZoneCompass_Struct
struct ExpeditionCompass_Struct
{
/*000*/ uint32 client_id;
/*000*/ uint32 clientid;
/*004*/ uint32 count;
/*008*/ DynamicZoneCompassEntry_Struct entries[0];
/*008*/ ExpeditionCompassEntry_Struct entries[0];
};
struct DynamicZoneChooseZoneEntry_Struct
struct ExpeditionJoinPrompt_Struct
{
/*000*/ uint16 dz_zone_id; // dz_id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 unknown_id1; // sent back in reply
/*008*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest -- sent back in reply
/*012*/ uint32 unknown_id2; // possibly an id based on dz type, for expeditions this was same as dz_id (zone|instance) but task dz was different
/*016*/ char description[1]; // variable length, null terminated, max 0x80 (128)
/*000*/ char leader_name[1]; // variable length, null terminated, max 0x40 (64)
};
struct DynamicZoneChooseZone_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ DynamicZoneChooseZoneEntry_Struct choices[0];
};
struct DynamicZoneChooseZoneReply_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004;
/*008*/ uint32 unknown_id1;
/*012*/ uint16 dz_zone_id;
/*014*/ uint16 dz_instance_id;
/*016*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest
/*020*/ uint32 unknown_id2;
/*024*/ uint32 unknown024;
/*028*/ uint32 unknown028; // always same as unknown040
/*032*/ uint32 unknown032;
/*036*/ uint32 unknown036;
/*040*/ uint32 unknown040; // always same as unknown028
/*044*/ uint32 unknown044;
/*000*/ uint32 clientid;
/*004*/ char player_name[64];
/*068*/ char expedition_name[64];
};
struct AltCurrencySelectItem_Struct {
+70 -177
View File
@@ -414,48 +414,15 @@ namespace Titanium
FINISH_ENCODE();
}
ENCODE(OP_DzChooseZone)
{
SETUP_VAR_ENCODE(DynamicZoneChooseZone_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->count);
for (uint32 i = 0; i < emu->count; ++i)
{
buf.WriteUInt16(emu->choices[i].dz_zone_id);
buf.WriteUInt16(emu->choices[i].dz_instance_id);
buf.WriteUInt32(emu->choices[i].unknown_id1);
buf.WriteUInt32(emu->choices[i].dz_type);
buf.WriteUInt32(emu->choices[i].unknown_id2);
buf.WriteString(emu->choices[i].description);
buf.WriteString(emu->choices[i].leader_name);
}
__packet->size = buf.size();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzCompass)
{
SETUP_VAR_ENCODE(DynamicZoneCompass_Struct);
ALLOC_VAR_ENCODE(structs::DynamicZoneCompass_Struct,
sizeof(structs::DynamicZoneCompass_Struct) +
sizeof(structs::DynamicZoneCompassEntry_Struct) * emu->count
);
SETUP_VAR_ENCODE(ExpeditionCompass_Struct);
ALLOC_VAR_ENCODE(structs::ExpeditionCompass_Struct, sizeof(structs::ExpeditionInfo_Struct) + sizeof(structs::ExpeditionCompassEntry_Struct) * emu->count);
OUT(client_id);
OUT(count);
for (uint32 i = 0; i < emu->count; ++i)
{
OUT(entries[i].dz_zone_id);
OUT(entries[i].dz_instance_id);
OUT(entries[i].dz_type);
OUT(entries[i].x);
OUT(entries[i].y);
OUT(entries[i].z);
@@ -479,60 +446,80 @@ namespace Titanium
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
OUT(client_id);
OUT(assigned);
OUT(max_players);
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
eq->enabled_max = 1;
strcpy(eq->expedition_name, emu->expedition_name);
strcpy(eq->leader_name, emu->leader_name);
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionInvite)
ENCODE(OP_DzExpeditionList)
{
ENCODE_LENGTH_EXACT(ExpeditionInvite_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInvite_Struct, structs::ExpeditionInvite_Struct);
SETUP_VAR_ENCODE(ExpeditionLockoutList_Struct);
OUT(client_id);
strn0cpy(eq->inviter_name, emu->inviter_name, sizeof(eq->inviter_name));
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
OUT(swapping);
strn0cpy(eq->swap_name, emu->swap_name, sizeof(eq->swap_name));
OUT(dz_zone_id);
OUT(dz_instance_id);
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionLockoutTimers)
{
SETUP_VAR_ENCODE(ExpeditionLockoutTimers_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->count);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&emu->count, sizeof(uint32));
for (uint32 i = 0; i < emu->count; ++i)
{
buf.WriteString(emu->timers[i].expedition_name);
buf.WriteUInt32(emu->timers[i].seconds_remaining);
buf.WriteInt32(emu->timers[i].event_type);
buf.WriteString(emu->timers[i].event_name);
ss.write(emu->entries[i].expedition, strlen(emu->entries[i].expedition));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&emu->entries[i].time_left, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write(emu->entries[i].expedition_event, strlen(emu->entries[i].expedition_event));
ss.write((const char*)&null_term, sizeof(char));
}
__packet->size = buf.size();
__packet->size = ss.str().length();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzSetLeaderName)
ENCODE(OP_DzJoinExpeditionConfirm)
{
ENCODE_LENGTH_EXACT(ExpeditionSetLeaderName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionSetLeaderName_Struct, structs::ExpeditionSetLeaderName_Struct);
ENCODE_LENGTH_EXACT(ExpeditionJoinPrompt_Struct);
SETUP_DIRECT_ENCODE(ExpeditionJoinPrompt_Struct, structs::ExpeditionJoinPrompt_Struct);
OUT(client_id);
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
strcpy(eq->expedition_name, emu->expedition_name);
strcpy(eq->player_name, emu->player_name);
FINISH_ENCODE();
}
ENCODE(OP_DzLeaderStatus)
{
SETUP_VAR_ENCODE(ExpeditionLeaderSet_Struct);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
//ss.write((const char*)&client_id, sizeof(uint32));
ss.write(emu->leader_name, strlen(emu->leader_name));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));//0xffffffff
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));//1
ss.write((const char*)&client_id, sizeof(uint32));
__packet->size = ss.str().length();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
FINISH_ENCODE();
}
@@ -541,43 +528,26 @@ namespace Titanium
{
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->member_count);
for (uint32 i = 0; i < emu->member_count; ++i)
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&emu->count, sizeof(uint32));
for (uint32 i = 0; i < emu->count; ++i)
{
buf.WriteString(emu->members[i].name);
buf.WriteUInt8(emu->members[i].expedition_status);
ss.write(emu->entries[i].name, strlen(emu->entries[i].name));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&emu->entries[i].status, sizeof(char));
}
__packet->size = buf.size();
__packet->size = ss.str().length();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzMemberListName)
{
ENCODE_LENGTH_EXACT(ExpeditionMemberListName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionMemberListName_Struct, structs::ExpeditionMemberListName_Struct);
OUT(client_id);
OUT(add_name);
strn0cpy(eq->name, emu->name, sizeof(eq->name));
FINISH_ENCODE();
}
ENCODE(OP_DzMemberListStatus)
{
auto emu = reinterpret_cast<ExpeditionMemberList_Struct*>((*p)->pBuffer);
if (emu->member_count == 1)
{
ENCODE_FORWARD(OP_DzMemberList);
}
}
ENCODE(OP_Emote)
{
EQApplicationPacket *in = *p;
@@ -1973,83 +1943,6 @@ namespace Titanium
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzAddPlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzChooseZoneReply)
{
DECODE_LENGTH_EXACT(structs::DynamicZoneChooseZoneReply_Struct);
SETUP_DIRECT_DECODE(DynamicZoneChooseZoneReply_Struct, structs::DynamicZoneChooseZoneReply_Struct);
emu->unknown000 = eq->unknown000;
emu->unknown008 = eq->unknown004;
IN(unknown_id1);
IN(dz_zone_id);
IN(dz_instance_id);
IN(dz_type);
IN(unknown_id2);
emu->unknown028 = eq->unknown024;
emu->unknown032 = eq->unknown028;
emu->unknown036 = eq->unknown032;
emu->unknown040 = eq->unknown036;
emu->unknown044 = eq->unknown040;
emu->unknown048 = eq->unknown044;
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzExpeditionInviteResponse)
{
DECODE_LENGTH_EXACT(structs::ExpeditionInviteResponse_Struct);
SETUP_DIRECT_DECODE(ExpeditionInviteResponse_Struct, structs::ExpeditionInviteResponse_Struct);
IN(dz_zone_id);
IN(dz_instance_id);
IN(accepted);
IN(swapping);
strn0cpy(emu->swap_name, eq->swap_name, sizeof(emu->swap_name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzMakeLeader)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzRemovePlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzSwapPlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommandSwap_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommandSwap_Struct, structs::ExpeditionCommandSwap_Struct);
strn0cpy(emu->add_player_name, eq->add_player_name, sizeof(emu->add_player_name));
strn0cpy(emu->rem_player_name, eq->rem_player_name, sizeof(emu->rem_player_name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_Emote)
{
unsigned char *__eq_buffer = __packet->pBuffer;
+3 -12
View File
@@ -32,16 +32,13 @@ E(OP_Damage)
E(OP_DeleteCharge)
E(OP_DeleteItem)
E(OP_DeleteSpawn)
E(OP_DzChooseZone)
E(OP_DzCompass)
E(OP_DzExpeditionEndsWarning)
E(OP_DzExpeditionInfo)
E(OP_DzExpeditionInvite)
E(OP_DzExpeditionLockoutTimers)
E(OP_DzExpeditionList)
E(OP_DzJoinExpeditionConfirm)
E(OP_DzLeaderStatus)
E(OP_DzMemberList)
E(OP_DzMemberListName)
E(OP_DzMemberListStatus)
E(OP_DzSetLeaderName)
E(OP_Emote)
E(OP_FormattedMessage)
E(OP_GroundSpawn)
@@ -89,12 +86,6 @@ D(OP_CharacterCreate)
D(OP_ClientUpdate)
D(OP_Consume)
D(OP_DeleteItem)
D(OP_DzAddPlayer)
D(OP_DzChooseZoneReply)
D(OP_DzExpeditionInviteResponse)
D(OP_DzMakeLeader)
D(OP_DzRemovePlayer)
D(OP_DzSwapPlayer)
D(OP_Emote)
D(OP_FaceChange)
D(OP_InspectAnswer)
+17 -124
View File
@@ -3299,150 +3299,43 @@ struct VeteranReward
/*004*/ VeteranRewardItem item;
};
struct ExpeditionInvite_Struct
{
/*000*/ uint32 client_id;
/*004*/ char inviter_name[64];
/*068*/ char expedition_name[128];
/*196*/ uint8 swapping; // 0: adding 1: swapping
/*197*/ char swap_name[64]; // if swapping, swap name being removed
/*261*/ uint8 padding[3];
/*264*/ uint16 dz_zone_id; // dz_id zone/instance pair, sent back in reply
/*268*/ uint16 dz_instance_id;
};
struct ExpeditionInviteResponse_Struct
struct ExpeditionExpireWarning
{
/*000*/ uint32 unknown000;
/*004*/ uint16 dz_zone_id; // dz_id pair sent in invite
/*006*/ uint16 dz_instance_id;
/*008*/ uint8 accepted; // 0: declined 1: accepted
/*009*/ uint8 swapping; // 0: adding 1: swapping (sent in invite)
/*010*/ char swap_name[64]; // swap name sent in invite
/*074*/ uint8 unknown078; // padding/garbage?
/*075*/ uint8 unknown079; // padding/garbage?
/*004*/ uint32 minutes_remaining;
};
struct ExpeditionInfo_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 assigned; // padded bool
/*000*/ uint32 clientid;
/*004*/ uint32 enabled_max;
/*008*/ uint32 max_players;
/*012*/ char expedition_name[128];
/*140*/ char leader_name[64];
/*012*/ char expedition_name[128];
/*142*/ char leader_name[64];
};
struct ExpeditionMemberEntry_Struct
struct ExpeditionCompassEntry_Struct
{
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
/*000*/ uint8 expedition_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
};
struct ExpeditionMemberList_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 member_count;
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
};
struct ExpeditionMemberListName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 add_name; // padded bool, 0: remove name, 1: add name with unknown status
/*008*/ char name[64];
};
struct ExpeditionLockoutTimerEntry_Struct
{
/*000*/ char expedition_name[1]; // variable length, null terminated, max 0x80 (128)
/*000*/ uint32 seconds_remaining;
/*000*/ int32 event_type; // seen -1 (0xffffffff) for replay timers and 1 for event timers
/*000*/ char event_name[1]; // variable length, null terminated, max 0x100 (256)
};
struct ExpeditionLockoutTimers_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
};
struct ExpeditionSetLeaderName_Struct
{
/*000*/ uint32 client_id;
/*004*/ char leader_name[64];
};
struct ExpeditionCommand_Struct
{
/*000*/ uint32 unknown000;
/*004*/ char name[64];
};
struct ExpeditionCommandSwap_Struct
{
/*000*/ uint32 unknown000;
/*004*/ char add_player_name[64]; // swap to (player must confirm)
/*068*/ char rem_player_name[64]; // swap from
};
struct ExpeditionExpireWarning
{
/*000*/ uint32 client_id;
/*004*/ uint32 minutes_remaining;
};
struct DynamicZoneCompassEntry_Struct
{
/*000*/ uint16 dz_zone_id; // target dz id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
/*008*/ uint32 unknown008;
/*000*/ float unknown000; //seen *((uint32*)) = 1584791871
/*004*/ uint32 enabled; //guess
/*008*/ uint32 unknown008; //seen 1019
/*012*/ float y;
/*016*/ float x;
/*020*/ float z;
};
struct DynamicZoneCompass_Struct
struct ExpeditionCompass_Struct
{
/*000*/ uint32 client_id;
/*000*/ uint32 clientid;
/*004*/ uint32 count;
/*008*/ DynamicZoneCompassEntry_Struct entries[0];
/*008*/ ExpeditionCompassEntry_Struct entries[0];
};
struct DynamicZoneChooseZoneEntry_Struct
struct ExpeditionJoinPrompt_Struct
{
/*000*/ uint16 dz_zone_id; // dz_id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 unknown_id1; // sent back in reply
/*008*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest -- sent back in reply
/*012*/ uint32 unknown_id2; // possibly an id based on dz type, for expeditions this was same as dz_id (zone|instance) but task dz was different
/*016*/ char description[1]; // variable length, null terminated, max 0x80 (128)
/*000*/ char leader_name[1]; // variable length, null terminated, max 0x40 (64)
};
struct DynamicZoneChooseZone_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ DynamicZoneChooseZoneEntry_Struct choices[0];
};
struct DynamicZoneChooseZoneReply_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004;
/*008*/ uint32 unknown_id1;
/*012*/ uint16 dz_zone_id;
/*014*/ uint16 dz_instance_id;
/*016*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest
/*020*/ uint32 unknown_id2;
/*024*/ uint32 unknown024;
/*028*/ uint32 unknown028; // always same as unknown040
/*032*/ uint32 unknown032;
/*036*/ uint32 unknown036;
/*040*/ uint32 unknown040; // always same as unknown028
/*044*/ uint32 unknown044;
/*000*/ uint32 clientid;
/*004*/ char player_name[64];
/*068*/ char expedition_name[64];
};
struct LFGuild_SearchPlayer_Struct
+71 -180
View File
@@ -613,48 +613,14 @@ namespace UF
FINISH_ENCODE();
}
ENCODE(OP_DzChooseZone)
{
SETUP_VAR_ENCODE(DynamicZoneChooseZone_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->count);
for (uint32 i = 0; i < emu->count; ++i)
{
buf.WriteUInt16(emu->choices[i].dz_zone_id);
buf.WriteUInt16(emu->choices[i].dz_instance_id);
buf.WriteUInt32(emu->choices[i].unknown_id1);
buf.WriteUInt32(emu->choices[i].dz_type);
buf.WriteUInt32(emu->choices[i].unknown_id2);
buf.WriteString(emu->choices[i].description);
buf.WriteString(emu->choices[i].leader_name);
}
__packet->size = buf.size();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzCompass)
{
SETUP_VAR_ENCODE(DynamicZoneCompass_Struct);
ALLOC_VAR_ENCODE(structs::DynamicZoneCompass_Struct,
sizeof(structs::DynamicZoneCompass_Struct) +
sizeof(structs::DynamicZoneCompassEntry_Struct) * emu->count
);
OUT(client_id);
SETUP_VAR_ENCODE(ExpeditionCompass_Struct);
ALLOC_VAR_ENCODE(structs::ExpeditionCompass_Struct, sizeof(structs::ExpeditionInfo_Struct) + sizeof(structs::ExpeditionCompassEntry_Struct) * emu->count);
OUT(count);
for (uint32 i = 0; i < emu->count; ++i)
{
OUT(entries[i].dz_zone_id);
OUT(entries[i].dz_instance_id);
OUT(entries[i].dz_type);
OUT(entries[i].x);
OUT(entries[i].y);
OUT(entries[i].z);
@@ -678,60 +644,81 @@ namespace UF
ENCODE_LENGTH_EXACT(ExpeditionInfo_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInfo_Struct, structs::ExpeditionInfo_Struct);
OUT(client_id);
OUT(assigned);
OUT(max_players);
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
eq->unknown004 = 785316192;
eq->unknown008 = 435601;
strcpy(eq->expedition_name, emu->expedition_name);
strcpy(eq->leader_name, emu->leader_name);
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionInvite)
ENCODE(OP_DzExpeditionList)
{
ENCODE_LENGTH_EXACT(ExpeditionInvite_Struct);
SETUP_DIRECT_ENCODE(ExpeditionInvite_Struct, structs::ExpeditionInvite_Struct);
SETUP_VAR_ENCODE(ExpeditionLockoutList_Struct);
OUT(client_id);
strn0cpy(eq->inviter_name, emu->inviter_name, sizeof(eq->inviter_name));
strn0cpy(eq->expedition_name, emu->expedition_name, sizeof(eq->expedition_name));
OUT(swapping);
strn0cpy(eq->swap_name, emu->swap_name, sizeof(eq->swap_name));
OUT(dz_zone_id);
OUT(dz_instance_id);
FINISH_ENCODE();
}
ENCODE(OP_DzExpeditionLockoutTimers)
{
SETUP_VAR_ENCODE(ExpeditionLockoutTimers_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->count);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&emu->count, sizeof(uint32));
for (uint32 i = 0; i < emu->count; ++i)
{
buf.WriteString(emu->timers[i].expedition_name);
buf.WriteUInt32(emu->timers[i].seconds_remaining);
buf.WriteInt32(emu->timers[i].event_type);
buf.WriteString(emu->timers[i].event_name);
ss.write(emu->entries[i].expedition, strlen(emu->entries[i].expedition));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&emu->entries[i].time_left, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write(emu->entries[i].expedition_event, strlen(emu->entries[i].expedition_event));
ss.write((const char*)&null_term, sizeof(char));
}
__packet->size = buf.size();
__packet->size = ss.str().length();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzSetLeaderName)
ENCODE(OP_DzJoinExpeditionConfirm)
{
ENCODE_LENGTH_EXACT(ExpeditionSetLeaderName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionSetLeaderName_Struct, structs::ExpeditionSetLeaderName_Struct);
ENCODE_LENGTH_EXACT(ExpeditionJoinPrompt_Struct);
SETUP_DIRECT_ENCODE(ExpeditionJoinPrompt_Struct, structs::ExpeditionJoinPrompt_Struct);
OUT(client_id);
strn0cpy(eq->leader_name, emu->leader_name, sizeof(eq->leader_name));
strcpy(eq->expedition_name, emu->expedition_name);
strcpy(eq->player_name, emu->player_name);
FINISH_ENCODE();
}
ENCODE(OP_DzLeaderStatus)
{
SETUP_VAR_ENCODE(ExpeditionLeaderSet_Struct);
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write(emu->leader_name, strlen(emu->leader_name));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));//0xffffffff
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&client_id, sizeof(uint32));//1
ss.write((const char*)&client_id, sizeof(uint32));
__packet->size = ss.str().length();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
FINISH_ENCODE();
}
@@ -740,43 +727,26 @@ namespace UF
{
SETUP_VAR_ENCODE(ExpeditionMemberList_Struct);
SerializeBuffer buf;
buf.WriteUInt32(emu->client_id);
buf.WriteUInt32(emu->member_count);
for (uint32 i = 0; i < emu->member_count; ++i)
std::stringstream ss(std::stringstream::in | std::stringstream::out | std::stringstream::binary);
uint32 client_id = 0;
uint8 null_term = 0;
ss.write((const char*)&client_id, sizeof(uint32));
ss.write((const char*)&emu->count, sizeof(uint32));
for (uint32 i = 0; i < emu->count; ++i)
{
buf.WriteString(emu->members[i].name);
buf.WriteUInt8(emu->members[i].expedition_status);
ss.write(emu->entries[i].name, strlen(emu->entries[i].name));
ss.write((const char*)&null_term, sizeof(char));
ss.write((const char*)&emu->entries[i].status, sizeof(char));
}
__packet->size = buf.size();
__packet->size = ss.str().length();
__packet->pBuffer = new unsigned char[__packet->size];
memcpy(__packet->pBuffer, buf.buffer(), __packet->size);
memcpy(__packet->pBuffer, ss.str().c_str(), __packet->size);
FINISH_ENCODE();
}
ENCODE(OP_DzMemberListName)
{
ENCODE_LENGTH_EXACT(ExpeditionMemberListName_Struct);
SETUP_DIRECT_ENCODE(ExpeditionMemberListName_Struct, structs::ExpeditionMemberListName_Struct);
OUT(client_id);
OUT(add_name);
strn0cpy(eq->name, emu->name, sizeof(eq->name));
FINISH_ENCODE();
}
ENCODE(OP_DzMemberListStatus)
{
auto emu = reinterpret_cast<ExpeditionMemberList_Struct*>((*p)->pBuffer);
if (emu->member_count == 1)
{
ENCODE_FORWARD(OP_DzMemberList);
}
}
ENCODE(OP_Emote)
{
EQApplicationPacket *in = *p;
@@ -1607,7 +1577,6 @@ namespace UF
OUT(FastRegenHP);
OUT(FastRegenMana);
OUT(FastRegenEndurance);
OUT(underworld_teleport_index);
eq->FogDensity = emu->fog_density;
@@ -3345,84 +3314,6 @@ namespace UF
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzAddPlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzChooseZoneReply)
{
DECODE_LENGTH_EXACT(structs::DynamicZoneChooseZoneReply_Struct);
SETUP_DIRECT_DECODE(DynamicZoneChooseZoneReply_Struct, structs::DynamicZoneChooseZoneReply_Struct);
IN(unknown000);
IN(unknown004);
IN(unknown008);
IN(unknown_id1);
IN(dz_zone_id);
IN(dz_instance_id);
IN(dz_type);
IN(unknown_id2);
IN(unknown028);
IN(unknown032);
IN(unknown036);
IN(unknown040);
IN(unknown044);
IN(unknown048);
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzExpeditionInviteResponse)
{
DECODE_LENGTH_EXACT(structs::ExpeditionInviteResponse_Struct);
SETUP_DIRECT_DECODE(ExpeditionInviteResponse_Struct, structs::ExpeditionInviteResponse_Struct);
IN(dz_zone_id);
IN(dz_instance_id);
IN(accepted);
IN(swapping);
strn0cpy(emu->swap_name, eq->swap_name, sizeof(emu->swap_name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzMakeLeader)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzRemovePlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommand_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommand_Struct, structs::ExpeditionCommand_Struct);
strn0cpy(emu->name, eq->name, sizeof(emu->name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_DzSwapPlayer)
{
DECODE_LENGTH_EXACT(structs::ExpeditionCommandSwap_Struct);
SETUP_DIRECT_DECODE(ExpeditionCommandSwap_Struct, structs::ExpeditionCommandSwap_Struct);
strn0cpy(emu->add_player_name, eq->add_player_name, sizeof(emu->add_player_name));
strn0cpy(emu->rem_player_name, eq->rem_player_name, sizeof(emu->rem_player_name));
FINISH_DIRECT_DECODE();
}
DECODE(OP_Emote)
{
unsigned char *__eq_buffer = __packet->pBuffer;
+3 -12
View File
@@ -38,16 +38,13 @@ E(OP_Damage)
E(OP_DeleteCharge)
E(OP_DeleteItem)
E(OP_DisciplineUpdate)
E(OP_DzChooseZone)
E(OP_DzCompass)
E(OP_DzExpeditionEndsWarning)
E(OP_DzExpeditionInfo)
E(OP_DzExpeditionInvite)
E(OP_DzExpeditionLockoutTimers)
E(OP_DzExpeditionList)
E(OP_DzJoinExpeditionConfirm)
E(OP_DzLeaderStatus)
E(OP_DzMemberList)
E(OP_DzMemberListName)
E(OP_DzMemberListStatus)
E(OP_DzSetLeaderName)
E(OP_Emote)
E(OP_ExpansionInfo)
E(OP_FormattedMessage)
@@ -123,12 +120,6 @@ D(OP_ConsiderCorpse)
D(OP_Consume)
D(OP_Damage)
D(OP_DeleteItem)
D(OP_DzAddPlayer)
D(OP_DzChooseZoneReply)
D(OP_DzExpeditionInviteResponse)
D(OP_DzMakeLeader)
D(OP_DzRemovePlayer)
D(OP_DzSwapPlayer)
D(OP_Emote)
D(OP_EnvDamage)
D(OP_FaceChange)
+27 -139
View File
@@ -444,11 +444,7 @@ struct NewZone_Struct {
/*0848*/ int32 unknown848;
/*0852*/ uint16 zone_id;
/*0854*/ uint16 zone_instance;
/*0856*/ uint32 scriptNPCReceivedanItem;
/*0860*/ uint32 bCheck; // padded bool
/*0864*/ uint32 scriptIDSomething;
/*0868*/ uint32 underworld_teleport_index; // > 0 teleports w/ zone point index, invalid succors, -1 affects some collisions
/*0872*/ uint32 scriptIDSomething3;
/*0856*/ char unknown856[20];
/*0876*/ uint32 SuspendBuffs;
/*0880*/ uint32 unknown880; //seen 50
/*0884*/ uint32 unknown884; //seen 10
@@ -4250,160 +4246,52 @@ struct VeteranReward
/*012*/ VeteranRewardItem items[8];
};
struct ExpeditionInvite_Struct
{
/*000*/ uint32 client_id; // unique character id
/*004*/ uint32 unknown004;
/*008*/ char inviter_name[64];
/*072*/ char expedition_name[128];
/*200*/ uint8 swapping; // 0: adding 1: swapping
/*201*/ char swap_name[64]; // if swapping, swap name being removed
/*265*/ uint8 padding[3];
/*268*/ uint16 dz_zone_id; // dz_id zone/instance pair, sent back in reply
/*270*/ uint16 dz_instance_id;
};
struct ExpeditionInviteResponse_Struct
struct ExpeditionEntryHeader_Struct
{
/*000*/ uint32 unknown000;
/*000*/ uint32 number_of_entries;
};
struct ExpeditionJoinPrompt_Struct
{
/*000*/ uint32 clientid;
/*004*/ uint32 unknown004;
/*008*/ uint16 dz_zone_id; // dz_id pair sent in invite
/*010*/ uint16 dz_instance_id;
/*012*/ uint8 accepted; // 0: declined 1: accepted
/*013*/ uint8 swapping; // 0: adding 1: swapping (sent in invite)
/*014*/ char swap_name[64]; // swap name sent in invite
/*078*/ uint8 unknown078; // padding garbage?
/*079*/ uint8 unknown079; // padding garbage?
};
struct ExpeditionInfo_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ uint32 assigned; // padded bool
/*012*/ uint32 max_players;
/*016*/ char expedition_name[128];
/*144*/ char leader_name[64];
};
struct ExpeditionMemberEntry_Struct
{
/*000*/ char name[1]; // variable length, null terminated, max 0x40 (64)
/*000*/ uint8 expedition_status; // 0: unknown 1: Online, 2: Offline, 3: In Dynamic Zone, 4: Link Dead
};
struct ExpeditionMemberList_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 member_count; // number of players in window
/*008*/ ExpeditionMemberEntry_Struct members[0]; // variable length
};
struct ExpeditionMemberListName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ uint32 add_name; // padded bool, 0: remove name, 1: add name with unknown status
/*012*/ char name[64];
};
struct ExpeditionLockoutTimerEntry_Struct
{
/*000*/ char expedition_name[1]; // variable length, null terminated, max 0x80 (128)
/*000*/ uint32 seconds_remaining;
/*000*/ int32 event_type; // seen -1 (0xffffffff) for replay timers and 1 for event timers
/*000*/ char event_name[1]; // variable length, null terminated, max 0x100 (256)
};
struct ExpeditionLockoutTimers_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ ExpeditionLockoutTimerEntry_Struct timers[0];
};
struct ExpeditionSetLeaderName_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 unknown004;
/*008*/ char leader_name[64];
};
struct ExpeditionCommand_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004;
/*008*/ char name[64];
};
struct ExpeditionCommandSwap_Struct
{
/*000*/ uint32 unknown000;
/*004*/ uint32 unknown004;
/*008*/ char add_player_name[64]; // swap to (player must confirm)
/*072*/ char rem_player_name[64]; // swap from
/*008*/ char player_name[64];
/*072*/ char expedition_name[64];
};
struct ExpeditionExpireWarning
{
/*000*/ uint32 client_id;
/*000*/ uint32 clientid;
/*004*/ uint32 unknown004;
/*008*/ uint32 minutes_remaining;
};
struct DynamicZoneCompassEntry_Struct
struct ExpeditionInfo_Struct
{
/*000*/ uint16 dz_zone_id; // target dz id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 dz_type; // 1: Expedition, 2: Tutorial (purple), 3: Task, 4: Mission, 5: Quest (green)
/*000*/ uint32 clientid;
/*004*/ uint32 unknown004;
/*008*/ uint32 unknown008;
/*012*/ uint32 max_players;
/*016*/ char expedition_name[128];
/*142*/ char leader_name[64];
};
struct ExpeditionCompassEntry_Struct
{
/*000*/ float unknown000; //seen *((uint32*)) = 1584791871
/*004*/ uint32 enabled; //guess
/*008*/ uint32 unknown008; //seen 1019
/*012*/ float y;
/*016*/ float x;
/*020*/ float z;
};
struct DynamicZoneCompass_Struct
struct ExpeditionCompass_Struct
{
/*000*/ uint32 client_id;
/*000*/ uint32 clientid;
/*004*/ uint32 count;
/*008*/ DynamicZoneCompassEntry_Struct entries[0];
};
struct DynamicZoneChooseZoneEntry_Struct
{
/*000*/ uint16 dz_zone_id; // dz_id pair
/*002*/ uint16 dz_instance_id;
/*004*/ uint32 unknown_id1; // sent back in reply
/*008*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest -- sent back in reply
/*012*/ uint32 unknown_id2; // possibly an id based on dz type, for expeditions this was same as dz_id (zone|instance) but task dz was different
/*016*/ char description[1]; // variable length, null terminated, max 0x80 (128)
/*000*/ char leader_name[1]; // variable length, null terminated, max 0x40 (64)
};
struct DynamicZoneChooseZone_Struct
{
/*000*/ uint32 client_id;
/*004*/ uint32 count;
/*008*/ DynamicZoneChooseZoneEntry_Struct choices[0];
};
struct DynamicZoneChooseZoneReply_Struct
{
/*000*/ uint32 unknown000; // ff ff ff ff
/*004*/ uint32 unknown004; // seen 69 00 00 00
/*008*/ uint32 unknown008; // ff ff ff ff
/*012*/ uint32 unknown_id1; // from choose zone entry message
/*016*/ uint16 dz_zone_id; // dz_id pair
/*018*/ uint16 dz_instance_id;
/*020*/ uint32 dz_type; // 1: Expedition, 2: Tutorial, 3: Task, 4: Mission, 5: Quest
/*024*/ uint32 unknown_id2; // from choose zone entry message
/*028*/ uint32 unknown028; // 00 00 00 00
/*032*/ uint32 unknown032; // always same as unknown044
/*036*/ uint32 unknown036;
/*040*/ uint32 unknown040;
/*044*/ uint32 unknown044; // always same as unknown032
/*048*/ uint32 unknown048; // seen 01 00 00 00 and 02 00 00 00
/*008*/ ExpeditionCompassEntry_Struct entries[0];
};
struct AltCurrencySelectItem_Struct {
@@ -1,70 +0,0 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_AA_ABILITY_REPOSITORY_H
#define EQEMU_AA_ABILITY_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_aa_ability_repository.h"
class AaAbilityRepository: public BaseAaAbilityRepository {
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
*
* AaAbilityRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AaAbilityRepository::GetWhereNeverExpires()
* AaAbilityRepository::GetWhereXAndY()
* AaAbilityRepository::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_AA_ABILITY_REPOSITORY_H
@@ -1,70 +0,0 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_AA_RANK_EFFECTS_REPOSITORY_H
#define EQEMU_AA_RANK_EFFECTS_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_aa_rank_effects_repository.h"
class AaRankEffectsRepository: public BaseAaRankEffectsRepository {
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
*
* AaRankEffectsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AaRankEffectsRepository::GetWhereNeverExpires()
* AaRankEffectsRepository::GetWhereXAndY()
* AaRankEffectsRepository::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_AA_RANK_EFFECTS_REPOSITORY_H
@@ -1,70 +0,0 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_AA_RANK_PREREQS_REPOSITORY_H
#define EQEMU_AA_RANK_PREREQS_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_aa_rank_prereqs_repository.h"
class AaRankPrereqsRepository: public BaseAaRankPrereqsRepository {
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
*
* AaRankPrereqsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AaRankPrereqsRepository::GetWhereNeverExpires()
* AaRankPrereqsRepository::GetWhereXAndY()
* AaRankPrereqsRepository::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_AA_RANK_PREREQS_REPOSITORY_H
-70
View File
@@ -1,70 +0,0 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_AA_RANKS_REPOSITORY_H
#define EQEMU_AA_RANKS_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_aa_ranks_repository.h"
class AaRanksRepository: public BaseAaRanksRepository {
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
*
* AaRanksRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AaRanksRepository::GetWhereNeverExpires()
* AaRanksRepository::GetWhereXAndY()
* AaRanksRepository::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_AA_RANKS_REPOSITORY_H
@@ -1,70 +0,0 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_ACCOUNT_FLAGS_REPOSITORY_H
#define EQEMU_ACCOUNT_FLAGS_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_account_flags_repository.h"
class AccountFlagsRepository: public BaseAccountFlagsRepository {
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
*
* AccountFlagsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AccountFlagsRepository::GetWhereNeverExpires()
* AccountFlagsRepository::GetWhereXAndY()
* AccountFlagsRepository::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_ACCOUNT_FLAGS_REPOSITORY_H
@@ -1,70 +0,0 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_ACCOUNT_IP_REPOSITORY_H
#define EQEMU_ACCOUNT_IP_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_account_ip_repository.h"
class AccountIpRepository: public BaseAccountIpRepository {
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
*
* AccountIpRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AccountIpRepository::GetWhereNeverExpires()
* AccountIpRepository::GetWhereXAndY()
* AccountIpRepository::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_ACCOUNT_IP_REPOSITORY_H
-70
View File
@@ -1,70 +0,0 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_ACCOUNT_REPOSITORY_H
#define EQEMU_ACCOUNT_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_account_repository.h"
class AccountRepository: public BaseAccountRepository {
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
*
* AccountRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AccountRepository::GetWhereNeverExpires()
* AccountRepository::GetWhereXAndY()
* AccountRepository::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_ACCOUNT_REPOSITORY_H
@@ -1,70 +0,0 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_ACCOUNT_REWARDS_REPOSITORY_H
#define EQEMU_ACCOUNT_REWARDS_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_account_rewards_repository.h"
class AccountRewardsRepository: public BaseAccountRewardsRepository {
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
*
* AccountRewardsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AccountRewardsRepository::GetWhereNeverExpires()
* AccountRewardsRepository::GetWhereXAndY()
* AccountRewardsRepository::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_ACCOUNT_REWARDS_REPOSITORY_H
@@ -1,70 +0,0 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_ADVENTURE_DETAILS_REPOSITORY_H
#define EQEMU_ADVENTURE_DETAILS_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_adventure_details_repository.h"
class AdventureDetailsRepository: public BaseAdventureDetailsRepository {
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
*
* AdventureDetailsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AdventureDetailsRepository::GetWhereNeverExpires()
* AdventureDetailsRepository::GetWhereXAndY()
* AdventureDetailsRepository::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_ADVENTURE_DETAILS_REPOSITORY_H
@@ -1,70 +0,0 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_ADVENTURE_MEMBERS_REPOSITORY_H
#define EQEMU_ADVENTURE_MEMBERS_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_adventure_members_repository.h"
class AdventureMembersRepository: public BaseAdventureMembersRepository {
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
*
* AdventureMembersRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AdventureMembersRepository::GetWhereNeverExpires()
* AdventureMembersRepository::GetWhereXAndY()
* AdventureMembersRepository::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_ADVENTURE_MEMBERS_REPOSITORY_H
@@ -1,70 +0,0 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_ADVENTURE_STATS_REPOSITORY_H
#define EQEMU_ADVENTURE_STATS_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_adventure_stats_repository.h"
class AdventureStatsRepository: public BaseAdventureStatsRepository {
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
*
* AdventureStatsRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AdventureStatsRepository::GetWhereNeverExpires()
* AdventureStatsRepository::GetWhereXAndY()
* AdventureStatsRepository::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_ADVENTURE_STATS_REPOSITORY_H
@@ -1,70 +0,0 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_ADVENTURE_TEMPLATE_ENTRY_FLAVOR_REPOSITORY_H
#define EQEMU_ADVENTURE_TEMPLATE_ENTRY_FLAVOR_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_adventure_template_entry_flavor_repository.h"
class AdventureTemplateEntryFlavorRepository: public BaseAdventureTemplateEntryFlavorRepository {
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
*
* AdventureTemplateEntryFlavorRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AdventureTemplateEntryFlavorRepository::GetWhereNeverExpires()
* AdventureTemplateEntryFlavorRepository::GetWhereXAndY()
* AdventureTemplateEntryFlavorRepository::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_ADVENTURE_TEMPLATE_ENTRY_FLAVOR_REPOSITORY_H
@@ -1,70 +0,0 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_ADVENTURE_TEMPLATE_ENTRY_REPOSITORY_H
#define EQEMU_ADVENTURE_TEMPLATE_ENTRY_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_adventure_template_entry_repository.h"
class AdventureTemplateEntryRepository: public BaseAdventureTemplateEntryRepository {
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
*
* AdventureTemplateEntryRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AdventureTemplateEntryRepository::GetWhereNeverExpires()
* AdventureTemplateEntryRepository::GetWhereXAndY()
* AdventureTemplateEntryRepository::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_ADVENTURE_TEMPLATE_ENTRY_REPOSITORY_H
@@ -1,70 +0,0 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_ADVENTURE_TEMPLATE_REPOSITORY_H
#define EQEMU_ADVENTURE_TEMPLATE_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_adventure_template_repository.h"
class AdventureTemplateRepository: public BaseAdventureTemplateRepository {
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
*
* AdventureTemplateRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AdventureTemplateRepository::GetWhereNeverExpires()
* AdventureTemplateRepository::GetWhereXAndY()
* AdventureTemplateRepository::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_ADVENTURE_TEMPLATE_REPOSITORY_H
@@ -1,70 +0,0 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_ALTERNATE_CURRENCY_REPOSITORY_H
#define EQEMU_ALTERNATE_CURRENCY_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_alternate_currency_repository.h"
class AlternateCurrencyRepository: public BaseAlternateCurrencyRepository {
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
*
* AlternateCurrencyRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AlternateCurrencyRepository::GetWhereNeverExpires()
* AlternateCurrencyRepository::GetWhereXAndY()
* AlternateCurrencyRepository::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_ALTERNATE_CURRENCY_REPOSITORY_H
-70
View File
@@ -1,70 +0,0 @@
/**
* EQEmulator: Everquest Server Emulator
* Copyright (C) 2001-2020 EQEmulator Development Team (https://github.com/EQEmu/Server)
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY except by those people which sell it, which
* are required to give you total support for your newly bought product;
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
#ifndef EQEMU_AURAS_REPOSITORY_H
#define EQEMU_AURAS_REPOSITORY_H
#include "../database.h"
#include "../string_util.h"
#include "base/base_auras_repository.h"
class AurasRepository: public BaseAurasRepository {
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
*
* AurasRepository::GetByZoneAndVersion(int zone_id, int zone_version)
* AurasRepository::GetWhereNeverExpires()
* AurasRepository::GetWhereXAndY()
* AurasRepository::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_AURAS_REPOSITORY_H
@@ -1,401 +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_AA_ABILITY_REPOSITORY_H
#define EQEMU_BASE_AA_ABILITY_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAaAbilityRepository {
public:
struct AaAbility {
int id;
std::string name;
int category;
int classes;
int races;
int drakkin_heritage;
int deities;
int status;
int type;
int charges;
int grant_only;
int first_rank_id;
int enabled;
int reset_on_death;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"name",
"category",
"classes",
"races",
"drakkin_heritage",
"deities",
"status",
"type",
"charges",
"grant_only",
"first_rank_id",
"enabled",
"reset_on_death",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("aa_ability");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static AaAbility NewEntity()
{
AaAbility entry{};
entry.id = 0;
entry.name = "";
entry.category = -1;
entry.classes = 131070;
entry.races = 65535;
entry.drakkin_heritage = 127;
entry.deities = 131071;
entry.status = 0;
entry.type = 0;
entry.charges = 0;
entry.grant_only = 0;
entry.first_rank_id = -1;
entry.enabled = 1;
entry.reset_on_death = 0;
return entry;
}
static AaAbility GetAaAbilityEntry(
const std::vector<AaAbility> &aa_abilitys,
int aa_ability_id
)
{
for (auto &aa_ability : aa_abilitys) {
if (aa_ability.id == aa_ability_id) {
return aa_ability;
}
}
return NewEntity();
}
static AaAbility FindOne(
Database& db,
int aa_ability_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
aa_ability_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AaAbility entry{};
entry.id = atoi(row[0]);
entry.name = row[1] ? row[1] : "";
entry.category = atoi(row[2]);
entry.classes = atoi(row[3]);
entry.races = atoi(row[4]);
entry.drakkin_heritage = atoi(row[5]);
entry.deities = atoi(row[6]);
entry.status = atoi(row[7]);
entry.type = atoi(row[8]);
entry.charges = atoi(row[9]);
entry.grant_only = atoi(row[10]);
entry.first_rank_id = atoi(row[11]);
entry.enabled = atoi(row[12]);
entry.reset_on_death = atoi(row[13]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int aa_ability_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
aa_ability_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
AaAbility aa_ability_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(aa_ability_entry.id));
update_values.push_back(columns[1] + " = '" + EscapeString(aa_ability_entry.name) + "'");
update_values.push_back(columns[2] + " = " + std::to_string(aa_ability_entry.category));
update_values.push_back(columns[3] + " = " + std::to_string(aa_ability_entry.classes));
update_values.push_back(columns[4] + " = " + std::to_string(aa_ability_entry.races));
update_values.push_back(columns[5] + " = " + std::to_string(aa_ability_entry.drakkin_heritage));
update_values.push_back(columns[6] + " = " + std::to_string(aa_ability_entry.deities));
update_values.push_back(columns[7] + " = " + std::to_string(aa_ability_entry.status));
update_values.push_back(columns[8] + " = " + std::to_string(aa_ability_entry.type));
update_values.push_back(columns[9] + " = " + std::to_string(aa_ability_entry.charges));
update_values.push_back(columns[10] + " = " + std::to_string(aa_ability_entry.grant_only));
update_values.push_back(columns[11] + " = " + std::to_string(aa_ability_entry.first_rank_id));
update_values.push_back(columns[12] + " = " + std::to_string(aa_ability_entry.enabled));
update_values.push_back(columns[13] + " = " + std::to_string(aa_ability_entry.reset_on_death));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
aa_ability_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AaAbility InsertOne(
Database& db,
AaAbility aa_ability_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(aa_ability_entry.id));
insert_values.push_back("'" + EscapeString(aa_ability_entry.name) + "'");
insert_values.push_back(std::to_string(aa_ability_entry.category));
insert_values.push_back(std::to_string(aa_ability_entry.classes));
insert_values.push_back(std::to_string(aa_ability_entry.races));
insert_values.push_back(std::to_string(aa_ability_entry.drakkin_heritage));
insert_values.push_back(std::to_string(aa_ability_entry.deities));
insert_values.push_back(std::to_string(aa_ability_entry.status));
insert_values.push_back(std::to_string(aa_ability_entry.type));
insert_values.push_back(std::to_string(aa_ability_entry.charges));
insert_values.push_back(std::to_string(aa_ability_entry.grant_only));
insert_values.push_back(std::to_string(aa_ability_entry.first_rank_id));
insert_values.push_back(std::to_string(aa_ability_entry.enabled));
insert_values.push_back(std::to_string(aa_ability_entry.reset_on_death));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
aa_ability_entry.id = results.LastInsertedID();
return aa_ability_entry;
}
aa_ability_entry = NewEntity();
return aa_ability_entry;
}
static int InsertMany(
Database& db,
std::vector<AaAbility> aa_ability_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &aa_ability_entry: aa_ability_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(aa_ability_entry.id));
insert_values.push_back("'" + EscapeString(aa_ability_entry.name) + "'");
insert_values.push_back(std::to_string(aa_ability_entry.category));
insert_values.push_back(std::to_string(aa_ability_entry.classes));
insert_values.push_back(std::to_string(aa_ability_entry.races));
insert_values.push_back(std::to_string(aa_ability_entry.drakkin_heritage));
insert_values.push_back(std::to_string(aa_ability_entry.deities));
insert_values.push_back(std::to_string(aa_ability_entry.status));
insert_values.push_back(std::to_string(aa_ability_entry.type));
insert_values.push_back(std::to_string(aa_ability_entry.charges));
insert_values.push_back(std::to_string(aa_ability_entry.grant_only));
insert_values.push_back(std::to_string(aa_ability_entry.first_rank_id));
insert_values.push_back(std::to_string(aa_ability_entry.enabled));
insert_values.push_back(std::to_string(aa_ability_entry.reset_on_death));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AaAbility> All(Database& db)
{
std::vector<AaAbility> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AaAbility entry{};
entry.id = atoi(row[0]);
entry.name = row[1] ? row[1] : "";
entry.category = atoi(row[2]);
entry.classes = atoi(row[3]);
entry.races = atoi(row[4]);
entry.drakkin_heritage = atoi(row[5]);
entry.deities = atoi(row[6]);
entry.status = atoi(row[7]);
entry.type = atoi(row[8]);
entry.charges = atoi(row[9]);
entry.grant_only = atoi(row[10]);
entry.first_rank_id = atoi(row[11]);
entry.enabled = atoi(row[12]);
entry.reset_on_death = atoi(row[13]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AaAbility> GetWhere(Database& db, std::string where_filter)
{
std::vector<AaAbility> 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) {
AaAbility entry{};
entry.id = atoi(row[0]);
entry.name = row[1] ? row[1] : "";
entry.category = atoi(row[2]);
entry.classes = atoi(row[3]);
entry.races = atoi(row[4]);
entry.drakkin_heritage = atoi(row[5]);
entry.deities = atoi(row[6]);
entry.status = atoi(row[7]);
entry.type = atoi(row[8]);
entry.charges = atoi(row[9]);
entry.grant_only = atoi(row[10]);
entry.first_rank_id = atoi(row[11]);
entry.enabled = atoi(row[12]);
entry.reset_on_death = atoi(row[13]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_AA_ABILITY_REPOSITORY_H
@@ -1,320 +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_AA_RANK_EFFECTS_REPOSITORY_H
#define EQEMU_BASE_AA_RANK_EFFECTS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAaRankEffectsRepository {
public:
struct AaRankEffects {
int rank_id;
int slot;
int effect_id;
int base1;
int base2;
};
static std::string PrimaryKey()
{
return std::string("rank_id");
}
static std::vector<std::string> Columns()
{
return {
"rank_id",
"slot",
"effect_id",
"base1",
"base2",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("aa_rank_effects");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static AaRankEffects NewEntity()
{
AaRankEffects entry{};
entry.rank_id = 0;
entry.slot = 1;
entry.effect_id = 0;
entry.base1 = 0;
entry.base2 = 0;
return entry;
}
static AaRankEffects GetAaRankEffectsEntry(
const std::vector<AaRankEffects> &aa_rank_effectss,
int aa_rank_effects_id
)
{
for (auto &aa_rank_effects : aa_rank_effectss) {
if (aa_rank_effects.rank_id == aa_rank_effects_id) {
return aa_rank_effects;
}
}
return NewEntity();
}
static AaRankEffects FindOne(
Database& db,
int aa_rank_effects_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
aa_rank_effects_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AaRankEffects entry{};
entry.rank_id = atoi(row[0]);
entry.slot = atoi(row[1]);
entry.effect_id = atoi(row[2]);
entry.base1 = atoi(row[3]);
entry.base2 = atoi(row[4]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int aa_rank_effects_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
aa_rank_effects_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
AaRankEffects aa_rank_effects_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(aa_rank_effects_entry.rank_id));
update_values.push_back(columns[1] + " = " + std::to_string(aa_rank_effects_entry.slot));
update_values.push_back(columns[2] + " = " + std::to_string(aa_rank_effects_entry.effect_id));
update_values.push_back(columns[3] + " = " + std::to_string(aa_rank_effects_entry.base1));
update_values.push_back(columns[4] + " = " + std::to_string(aa_rank_effects_entry.base2));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
aa_rank_effects_entry.rank_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AaRankEffects InsertOne(
Database& db,
AaRankEffects aa_rank_effects_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(aa_rank_effects_entry.rank_id));
insert_values.push_back(std::to_string(aa_rank_effects_entry.slot));
insert_values.push_back(std::to_string(aa_rank_effects_entry.effect_id));
insert_values.push_back(std::to_string(aa_rank_effects_entry.base1));
insert_values.push_back(std::to_string(aa_rank_effects_entry.base2));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
aa_rank_effects_entry.rank_id = results.LastInsertedID();
return aa_rank_effects_entry;
}
aa_rank_effects_entry = NewEntity();
return aa_rank_effects_entry;
}
static int InsertMany(
Database& db,
std::vector<AaRankEffects> aa_rank_effects_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &aa_rank_effects_entry: aa_rank_effects_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(aa_rank_effects_entry.rank_id));
insert_values.push_back(std::to_string(aa_rank_effects_entry.slot));
insert_values.push_back(std::to_string(aa_rank_effects_entry.effect_id));
insert_values.push_back(std::to_string(aa_rank_effects_entry.base1));
insert_values.push_back(std::to_string(aa_rank_effects_entry.base2));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AaRankEffects> All(Database& db)
{
std::vector<AaRankEffects> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AaRankEffects entry{};
entry.rank_id = atoi(row[0]);
entry.slot = atoi(row[1]);
entry.effect_id = atoi(row[2]);
entry.base1 = atoi(row[3]);
entry.base2 = atoi(row[4]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AaRankEffects> GetWhere(Database& db, std::string where_filter)
{
std::vector<AaRankEffects> 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) {
AaRankEffects entry{};
entry.rank_id = atoi(row[0]);
entry.slot = atoi(row[1]);
entry.effect_id = atoi(row[2]);
entry.base1 = atoi(row[3]);
entry.base2 = atoi(row[4]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_AA_RANK_EFFECTS_REPOSITORY_H
@@ -1,302 +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_AA_RANK_PREREQS_REPOSITORY_H
#define EQEMU_BASE_AA_RANK_PREREQS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAaRankPrereqsRepository {
public:
struct AaRankPrereqs {
int rank_id;
int aa_id;
int points;
};
static std::string PrimaryKey()
{
return std::string("rank_id");
}
static std::vector<std::string> Columns()
{
return {
"rank_id",
"aa_id",
"points",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("aa_rank_prereqs");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static AaRankPrereqs NewEntity()
{
AaRankPrereqs entry{};
entry.rank_id = 0;
entry.aa_id = 0;
entry.points = 0;
return entry;
}
static AaRankPrereqs GetAaRankPrereqsEntry(
const std::vector<AaRankPrereqs> &aa_rank_prereqss,
int aa_rank_prereqs_id
)
{
for (auto &aa_rank_prereqs : aa_rank_prereqss) {
if (aa_rank_prereqs.rank_id == aa_rank_prereqs_id) {
return aa_rank_prereqs;
}
}
return NewEntity();
}
static AaRankPrereqs FindOne(
Database& db,
int aa_rank_prereqs_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
aa_rank_prereqs_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AaRankPrereqs entry{};
entry.rank_id = atoi(row[0]);
entry.aa_id = atoi(row[1]);
entry.points = atoi(row[2]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int aa_rank_prereqs_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
aa_rank_prereqs_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
AaRankPrereqs aa_rank_prereqs_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(aa_rank_prereqs_entry.rank_id));
update_values.push_back(columns[1] + " = " + std::to_string(aa_rank_prereqs_entry.aa_id));
update_values.push_back(columns[2] + " = " + std::to_string(aa_rank_prereqs_entry.points));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
aa_rank_prereqs_entry.rank_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AaRankPrereqs InsertOne(
Database& db,
AaRankPrereqs aa_rank_prereqs_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(aa_rank_prereqs_entry.rank_id));
insert_values.push_back(std::to_string(aa_rank_prereqs_entry.aa_id));
insert_values.push_back(std::to_string(aa_rank_prereqs_entry.points));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
aa_rank_prereqs_entry.rank_id = results.LastInsertedID();
return aa_rank_prereqs_entry;
}
aa_rank_prereqs_entry = NewEntity();
return aa_rank_prereqs_entry;
}
static int InsertMany(
Database& db,
std::vector<AaRankPrereqs> aa_rank_prereqs_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &aa_rank_prereqs_entry: aa_rank_prereqs_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(aa_rank_prereqs_entry.rank_id));
insert_values.push_back(std::to_string(aa_rank_prereqs_entry.aa_id));
insert_values.push_back(std::to_string(aa_rank_prereqs_entry.points));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AaRankPrereqs> All(Database& db)
{
std::vector<AaRankPrereqs> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AaRankPrereqs entry{};
entry.rank_id = atoi(row[0]);
entry.aa_id = atoi(row[1]);
entry.points = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AaRankPrereqs> GetWhere(Database& db, std::string where_filter)
{
std::vector<AaRankPrereqs> 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) {
AaRankPrereqs entry{};
entry.rank_id = atoi(row[0]);
entry.aa_id = atoi(row[1]);
entry.points = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_AA_RANK_PREREQS_REPOSITORY_H
@@ -1,392 +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_AA_RANKS_REPOSITORY_H
#define EQEMU_BASE_AA_RANKS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAaRanksRepository {
public:
struct AaRanks {
int id;
int upper_hotkey_sid;
int lower_hotkey_sid;
int title_sid;
int desc_sid;
int cost;
int level_req;
int spell;
int spell_type;
int recast_time;
int expansion;
int prev_id;
int next_id;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"upper_hotkey_sid",
"lower_hotkey_sid",
"title_sid",
"desc_sid",
"cost",
"level_req",
"spell",
"spell_type",
"recast_time",
"expansion",
"prev_id",
"next_id",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("aa_ranks");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static AaRanks NewEntity()
{
AaRanks entry{};
entry.id = 0;
entry.upper_hotkey_sid = -1;
entry.lower_hotkey_sid = -1;
entry.title_sid = -1;
entry.desc_sid = -1;
entry.cost = 1;
entry.level_req = 51;
entry.spell = -1;
entry.spell_type = 0;
entry.recast_time = 0;
entry.expansion = 0;
entry.prev_id = -1;
entry.next_id = -1;
return entry;
}
static AaRanks GetAaRanksEntry(
const std::vector<AaRanks> &aa_rankss,
int aa_ranks_id
)
{
for (auto &aa_ranks : aa_rankss) {
if (aa_ranks.id == aa_ranks_id) {
return aa_ranks;
}
}
return NewEntity();
}
static AaRanks FindOne(
Database& db,
int aa_ranks_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
aa_ranks_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AaRanks entry{};
entry.id = atoi(row[0]);
entry.upper_hotkey_sid = atoi(row[1]);
entry.lower_hotkey_sid = atoi(row[2]);
entry.title_sid = atoi(row[3]);
entry.desc_sid = atoi(row[4]);
entry.cost = atoi(row[5]);
entry.level_req = atoi(row[6]);
entry.spell = atoi(row[7]);
entry.spell_type = atoi(row[8]);
entry.recast_time = atoi(row[9]);
entry.expansion = atoi(row[10]);
entry.prev_id = atoi(row[11]);
entry.next_id = atoi(row[12]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int aa_ranks_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
aa_ranks_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
AaRanks aa_ranks_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(aa_ranks_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(aa_ranks_entry.upper_hotkey_sid));
update_values.push_back(columns[2] + " = " + std::to_string(aa_ranks_entry.lower_hotkey_sid));
update_values.push_back(columns[3] + " = " + std::to_string(aa_ranks_entry.title_sid));
update_values.push_back(columns[4] + " = " + std::to_string(aa_ranks_entry.desc_sid));
update_values.push_back(columns[5] + " = " + std::to_string(aa_ranks_entry.cost));
update_values.push_back(columns[6] + " = " + std::to_string(aa_ranks_entry.level_req));
update_values.push_back(columns[7] + " = " + std::to_string(aa_ranks_entry.spell));
update_values.push_back(columns[8] + " = " + std::to_string(aa_ranks_entry.spell_type));
update_values.push_back(columns[9] + " = " + std::to_string(aa_ranks_entry.recast_time));
update_values.push_back(columns[10] + " = " + std::to_string(aa_ranks_entry.expansion));
update_values.push_back(columns[11] + " = " + std::to_string(aa_ranks_entry.prev_id));
update_values.push_back(columns[12] + " = " + std::to_string(aa_ranks_entry.next_id));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
aa_ranks_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AaRanks InsertOne(
Database& db,
AaRanks aa_ranks_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(aa_ranks_entry.id));
insert_values.push_back(std::to_string(aa_ranks_entry.upper_hotkey_sid));
insert_values.push_back(std::to_string(aa_ranks_entry.lower_hotkey_sid));
insert_values.push_back(std::to_string(aa_ranks_entry.title_sid));
insert_values.push_back(std::to_string(aa_ranks_entry.desc_sid));
insert_values.push_back(std::to_string(aa_ranks_entry.cost));
insert_values.push_back(std::to_string(aa_ranks_entry.level_req));
insert_values.push_back(std::to_string(aa_ranks_entry.spell));
insert_values.push_back(std::to_string(aa_ranks_entry.spell_type));
insert_values.push_back(std::to_string(aa_ranks_entry.recast_time));
insert_values.push_back(std::to_string(aa_ranks_entry.expansion));
insert_values.push_back(std::to_string(aa_ranks_entry.prev_id));
insert_values.push_back(std::to_string(aa_ranks_entry.next_id));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
aa_ranks_entry.id = results.LastInsertedID();
return aa_ranks_entry;
}
aa_ranks_entry = NewEntity();
return aa_ranks_entry;
}
static int InsertMany(
Database& db,
std::vector<AaRanks> aa_ranks_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &aa_ranks_entry: aa_ranks_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(aa_ranks_entry.id));
insert_values.push_back(std::to_string(aa_ranks_entry.upper_hotkey_sid));
insert_values.push_back(std::to_string(aa_ranks_entry.lower_hotkey_sid));
insert_values.push_back(std::to_string(aa_ranks_entry.title_sid));
insert_values.push_back(std::to_string(aa_ranks_entry.desc_sid));
insert_values.push_back(std::to_string(aa_ranks_entry.cost));
insert_values.push_back(std::to_string(aa_ranks_entry.level_req));
insert_values.push_back(std::to_string(aa_ranks_entry.spell));
insert_values.push_back(std::to_string(aa_ranks_entry.spell_type));
insert_values.push_back(std::to_string(aa_ranks_entry.recast_time));
insert_values.push_back(std::to_string(aa_ranks_entry.expansion));
insert_values.push_back(std::to_string(aa_ranks_entry.prev_id));
insert_values.push_back(std::to_string(aa_ranks_entry.next_id));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AaRanks> All(Database& db)
{
std::vector<AaRanks> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AaRanks entry{};
entry.id = atoi(row[0]);
entry.upper_hotkey_sid = atoi(row[1]);
entry.lower_hotkey_sid = atoi(row[2]);
entry.title_sid = atoi(row[3]);
entry.desc_sid = atoi(row[4]);
entry.cost = atoi(row[5]);
entry.level_req = atoi(row[6]);
entry.spell = atoi(row[7]);
entry.spell_type = atoi(row[8]);
entry.recast_time = atoi(row[9]);
entry.expansion = atoi(row[10]);
entry.prev_id = atoi(row[11]);
entry.next_id = atoi(row[12]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AaRanks> GetWhere(Database& db, std::string where_filter)
{
std::vector<AaRanks> 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) {
AaRanks entry{};
entry.id = atoi(row[0]);
entry.upper_hotkey_sid = atoi(row[1]);
entry.lower_hotkey_sid = atoi(row[2]);
entry.title_sid = atoi(row[3]);
entry.desc_sid = atoi(row[4]);
entry.cost = atoi(row[5]);
entry.level_req = atoi(row[6]);
entry.spell = atoi(row[7]);
entry.spell_type = atoi(row[8]);
entry.recast_time = atoi(row[9]);
entry.expansion = atoi(row[10]);
entry.prev_id = atoi(row[11]);
entry.next_id = atoi(row[12]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_AA_RANKS_REPOSITORY_H
@@ -1,302 +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_ACCOUNT_FLAGS_REPOSITORY_H
#define EQEMU_BASE_ACCOUNT_FLAGS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAccountFlagsRepository {
public:
struct AccountFlags {
int p_accid;
std::string p_flag;
std::string p_value;
};
static std::string PrimaryKey()
{
return std::string("p_accid");
}
static std::vector<std::string> Columns()
{
return {
"p_accid",
"p_flag",
"p_value",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("account_flags");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static AccountFlags NewEntity()
{
AccountFlags entry{};
entry.p_accid = 0;
entry.p_flag = "";
entry.p_value = "";
return entry;
}
static AccountFlags GetAccountFlagsEntry(
const std::vector<AccountFlags> &account_flagss,
int account_flags_id
)
{
for (auto &account_flags : account_flagss) {
if (account_flags.p_accid == account_flags_id) {
return account_flags;
}
}
return NewEntity();
}
static AccountFlags FindOne(
Database& db,
int account_flags_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
account_flags_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AccountFlags entry{};
entry.p_accid = atoi(row[0]);
entry.p_flag = row[1] ? row[1] : "";
entry.p_value = row[2] ? row[2] : "";
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int account_flags_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
account_flags_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
AccountFlags account_flags_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(account_flags_entry.p_accid));
update_values.push_back(columns[1] + " = '" + EscapeString(account_flags_entry.p_flag) + "'");
update_values.push_back(columns[2] + " = '" + EscapeString(account_flags_entry.p_value) + "'");
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
account_flags_entry.p_accid
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AccountFlags InsertOne(
Database& db,
AccountFlags account_flags_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(account_flags_entry.p_accid));
insert_values.push_back("'" + EscapeString(account_flags_entry.p_flag) + "'");
insert_values.push_back("'" + EscapeString(account_flags_entry.p_value) + "'");
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
account_flags_entry.p_accid = results.LastInsertedID();
return account_flags_entry;
}
account_flags_entry = NewEntity();
return account_flags_entry;
}
static int InsertMany(
Database& db,
std::vector<AccountFlags> account_flags_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &account_flags_entry: account_flags_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(account_flags_entry.p_accid));
insert_values.push_back("'" + EscapeString(account_flags_entry.p_flag) + "'");
insert_values.push_back("'" + EscapeString(account_flags_entry.p_value) + "'");
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AccountFlags> All(Database& db)
{
std::vector<AccountFlags> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AccountFlags entry{};
entry.p_accid = atoi(row[0]);
entry.p_flag = row[1] ? row[1] : "";
entry.p_value = row[2] ? row[2] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AccountFlags> GetWhere(Database& db, std::string where_filter)
{
std::vector<AccountFlags> 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) {
AccountFlags entry{};
entry.p_accid = atoi(row[0]);
entry.p_flag = row[1] ? row[1] : "";
entry.p_value = row[2] ? row[2] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_ACCOUNT_FLAGS_REPOSITORY_H
@@ -1,311 +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_ACCOUNT_IP_REPOSITORY_H
#define EQEMU_BASE_ACCOUNT_IP_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAccountIpRepository {
public:
struct AccountIp {
int accid;
std::string ip;
int count;
std::string lastused;
};
static std::string PrimaryKey()
{
return std::string("accid");
}
static std::vector<std::string> Columns()
{
return {
"accid",
"ip",
"count",
"lastused",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("account_ip");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static AccountIp NewEntity()
{
AccountIp entry{};
entry.accid = 0;
entry.ip = "";
entry.count = 1;
entry.lastused = current_timestamp();
return entry;
}
static AccountIp GetAccountIpEntry(
const std::vector<AccountIp> &account_ips,
int account_ip_id
)
{
for (auto &account_ip : account_ips) {
if (account_ip.accid == account_ip_id) {
return account_ip;
}
}
return NewEntity();
}
static AccountIp FindOne(
Database& db,
int account_ip_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
account_ip_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AccountIp entry{};
entry.accid = atoi(row[0]);
entry.ip = row[1] ? row[1] : "";
entry.count = atoi(row[2]);
entry.lastused = row[3] ? row[3] : "";
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int account_ip_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
account_ip_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
AccountIp account_ip_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(account_ip_entry.accid));
update_values.push_back(columns[1] + " = '" + EscapeString(account_ip_entry.ip) + "'");
update_values.push_back(columns[2] + " = " + std::to_string(account_ip_entry.count));
update_values.push_back(columns[3] + " = '" + EscapeString(account_ip_entry.lastused) + "'");
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
account_ip_entry.accid
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AccountIp InsertOne(
Database& db,
AccountIp account_ip_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(account_ip_entry.accid));
insert_values.push_back("'" + EscapeString(account_ip_entry.ip) + "'");
insert_values.push_back(std::to_string(account_ip_entry.count));
insert_values.push_back("'" + EscapeString(account_ip_entry.lastused) + "'");
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
account_ip_entry.accid = results.LastInsertedID();
return account_ip_entry;
}
account_ip_entry = NewEntity();
return account_ip_entry;
}
static int InsertMany(
Database& db,
std::vector<AccountIp> account_ip_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &account_ip_entry: account_ip_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(account_ip_entry.accid));
insert_values.push_back("'" + EscapeString(account_ip_entry.ip) + "'");
insert_values.push_back(std::to_string(account_ip_entry.count));
insert_values.push_back("'" + EscapeString(account_ip_entry.lastused) + "'");
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AccountIp> All(Database& db)
{
std::vector<AccountIp> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AccountIp entry{};
entry.accid = atoi(row[0]);
entry.ip = row[1] ? row[1] : "";
entry.count = atoi(row[2]);
entry.lastused = row[3] ? row[3] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AccountIp> GetWhere(Database& db, std::string where_filter)
{
std::vector<AccountIp> 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) {
AccountIp entry{};
entry.accid = atoi(row[0]);
entry.ip = row[1] ? row[1] : "";
entry.count = atoi(row[2]);
entry.lastused = row[3] ? row[3] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_ACCOUNT_IP_REPOSITORY_H
@@ -1,445 +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_ACCOUNT_REPOSITORY_H
#define EQEMU_BASE_ACCOUNT_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAccountRepository {
public:
struct Account {
int id;
std::string name;
std::string charname;
int sharedplat;
std::string password;
int status;
std::string ls_id;
int lsaccount_id;
int gmspeed;
int revoked;
int karma;
std::string minilogin_ip;
int hideme;
int rulesflag;
std::string suspendeduntil;
int time_creation;
int expansion;
std::string ban_reason;
std::string suspend_reason;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"name",
"charname",
"sharedplat",
"password",
"status",
"ls_id",
"lsaccount_id",
"gmspeed",
"revoked",
"karma",
"minilogin_ip",
"hideme",
"rulesflag",
"suspendeduntil",
"time_creation",
"expansion",
"ban_reason",
"suspend_reason",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("account");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static Account NewEntity()
{
Account entry{};
entry.id = 0;
entry.name = "";
entry.charname = "";
entry.sharedplat = 0;
entry.password = "";
entry.status = 0;
entry.ls_id = "eqemu";
entry.lsaccount_id = 0;
entry.gmspeed = 0;
entry.revoked = 0;
entry.karma = 0;
entry.minilogin_ip = "";
entry.hideme = 0;
entry.rulesflag = 0;
entry.suspendeduntil = "0000-00-00 00:00:00";
entry.time_creation = 0;
entry.expansion = 0;
entry.ban_reason = "";
entry.suspend_reason = "";
return entry;
}
static Account GetAccountEntry(
const std::vector<Account> &accounts,
int account_id
)
{
for (auto &account : accounts) {
if (account.id == account_id) {
return account;
}
}
return NewEntity();
}
static Account FindOne(
Database& db,
int account_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
account_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
Account entry{};
entry.id = atoi(row[0]);
entry.name = row[1] ? row[1] : "";
entry.charname = row[2] ? row[2] : "";
entry.sharedplat = atoi(row[3]);
entry.password = row[4] ? row[4] : "";
entry.status = atoi(row[5]);
entry.ls_id = row[6] ? row[6] : "";
entry.lsaccount_id = atoi(row[7]);
entry.gmspeed = atoi(row[8]);
entry.revoked = atoi(row[9]);
entry.karma = atoi(row[10]);
entry.minilogin_ip = row[11] ? row[11] : "";
entry.hideme = atoi(row[12]);
entry.rulesflag = atoi(row[13]);
entry.suspendeduntil = row[14] ? row[14] : "";
entry.time_creation = atoi(row[15]);
entry.expansion = atoi(row[16]);
entry.ban_reason = row[17] ? row[17] : "";
entry.suspend_reason = row[18] ? row[18] : "";
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int account_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
account_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
Account account_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[1] + " = '" + EscapeString(account_entry.name) + "'");
update_values.push_back(columns[2] + " = '" + EscapeString(account_entry.charname) + "'");
update_values.push_back(columns[3] + " = " + std::to_string(account_entry.sharedplat));
update_values.push_back(columns[4] + " = '" + EscapeString(account_entry.password) + "'");
update_values.push_back(columns[5] + " = " + std::to_string(account_entry.status));
update_values.push_back(columns[6] + " = '" + EscapeString(account_entry.ls_id) + "'");
update_values.push_back(columns[7] + " = " + std::to_string(account_entry.lsaccount_id));
update_values.push_back(columns[8] + " = " + std::to_string(account_entry.gmspeed));
update_values.push_back(columns[9] + " = " + std::to_string(account_entry.revoked));
update_values.push_back(columns[10] + " = " + std::to_string(account_entry.karma));
update_values.push_back(columns[11] + " = '" + EscapeString(account_entry.minilogin_ip) + "'");
update_values.push_back(columns[12] + " = " + std::to_string(account_entry.hideme));
update_values.push_back(columns[13] + " = " + std::to_string(account_entry.rulesflag));
update_values.push_back(columns[14] + " = '" + EscapeString(account_entry.suspendeduntil) + "'");
update_values.push_back(columns[15] + " = " + std::to_string(account_entry.time_creation));
update_values.push_back(columns[16] + " = " + std::to_string(account_entry.expansion));
update_values.push_back(columns[17] + " = '" + EscapeString(account_entry.ban_reason) + "'");
update_values.push_back(columns[18] + " = '" + EscapeString(account_entry.suspend_reason) + "'");
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
account_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static Account InsertOne(
Database& db,
Account account_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(account_entry.id));
insert_values.push_back("'" + EscapeString(account_entry.name) + "'");
insert_values.push_back("'" + EscapeString(account_entry.charname) + "'");
insert_values.push_back(std::to_string(account_entry.sharedplat));
insert_values.push_back("'" + EscapeString(account_entry.password) + "'");
insert_values.push_back(std::to_string(account_entry.status));
insert_values.push_back("'" + EscapeString(account_entry.ls_id) + "'");
insert_values.push_back(std::to_string(account_entry.lsaccount_id));
insert_values.push_back(std::to_string(account_entry.gmspeed));
insert_values.push_back(std::to_string(account_entry.revoked));
insert_values.push_back(std::to_string(account_entry.karma));
insert_values.push_back("'" + EscapeString(account_entry.minilogin_ip) + "'");
insert_values.push_back(std::to_string(account_entry.hideme));
insert_values.push_back(std::to_string(account_entry.rulesflag));
insert_values.push_back("'" + EscapeString(account_entry.suspendeduntil) + "'");
insert_values.push_back(std::to_string(account_entry.time_creation));
insert_values.push_back(std::to_string(account_entry.expansion));
insert_values.push_back("'" + EscapeString(account_entry.ban_reason) + "'");
insert_values.push_back("'" + EscapeString(account_entry.suspend_reason) + "'");
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
account_entry.id = results.LastInsertedID();
return account_entry;
}
account_entry = NewEntity();
return account_entry;
}
static int InsertMany(
Database& db,
std::vector<Account> account_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &account_entry: account_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(account_entry.id));
insert_values.push_back("'" + EscapeString(account_entry.name) + "'");
insert_values.push_back("'" + EscapeString(account_entry.charname) + "'");
insert_values.push_back(std::to_string(account_entry.sharedplat));
insert_values.push_back("'" + EscapeString(account_entry.password) + "'");
insert_values.push_back(std::to_string(account_entry.status));
insert_values.push_back("'" + EscapeString(account_entry.ls_id) + "'");
insert_values.push_back(std::to_string(account_entry.lsaccount_id));
insert_values.push_back(std::to_string(account_entry.gmspeed));
insert_values.push_back(std::to_string(account_entry.revoked));
insert_values.push_back(std::to_string(account_entry.karma));
insert_values.push_back("'" + EscapeString(account_entry.minilogin_ip) + "'");
insert_values.push_back(std::to_string(account_entry.hideme));
insert_values.push_back(std::to_string(account_entry.rulesflag));
insert_values.push_back("'" + EscapeString(account_entry.suspendeduntil) + "'");
insert_values.push_back(std::to_string(account_entry.time_creation));
insert_values.push_back(std::to_string(account_entry.expansion));
insert_values.push_back("'" + EscapeString(account_entry.ban_reason) + "'");
insert_values.push_back("'" + EscapeString(account_entry.suspend_reason) + "'");
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<Account> All(Database& db)
{
std::vector<Account> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
Account entry{};
entry.id = atoi(row[0]);
entry.name = row[1] ? row[1] : "";
entry.charname = row[2] ? row[2] : "";
entry.sharedplat = atoi(row[3]);
entry.password = row[4] ? row[4] : "";
entry.status = atoi(row[5]);
entry.ls_id = row[6] ? row[6] : "";
entry.lsaccount_id = atoi(row[7]);
entry.gmspeed = atoi(row[8]);
entry.revoked = atoi(row[9]);
entry.karma = atoi(row[10]);
entry.minilogin_ip = row[11] ? row[11] : "";
entry.hideme = atoi(row[12]);
entry.rulesflag = atoi(row[13]);
entry.suspendeduntil = row[14] ? row[14] : "";
entry.time_creation = atoi(row[15]);
entry.expansion = atoi(row[16]);
entry.ban_reason = row[17] ? row[17] : "";
entry.suspend_reason = row[18] ? row[18] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<Account> GetWhere(Database& db, std::string where_filter)
{
std::vector<Account> 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) {
Account entry{};
entry.id = atoi(row[0]);
entry.name = row[1] ? row[1] : "";
entry.charname = row[2] ? row[2] : "";
entry.sharedplat = atoi(row[3]);
entry.password = row[4] ? row[4] : "";
entry.status = atoi(row[5]);
entry.ls_id = row[6] ? row[6] : "";
entry.lsaccount_id = atoi(row[7]);
entry.gmspeed = atoi(row[8]);
entry.revoked = atoi(row[9]);
entry.karma = atoi(row[10]);
entry.minilogin_ip = row[11] ? row[11] : "";
entry.hideme = atoi(row[12]);
entry.rulesflag = atoi(row[13]);
entry.suspendeduntil = row[14] ? row[14] : "";
entry.time_creation = atoi(row[15]);
entry.expansion = atoi(row[16]);
entry.ban_reason = row[17] ? row[17] : "";
entry.suspend_reason = row[18] ? row[18] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_ACCOUNT_REPOSITORY_H
@@ -1,302 +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_ACCOUNT_REWARDS_REPOSITORY_H
#define EQEMU_BASE_ACCOUNT_REWARDS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAccountRewardsRepository {
public:
struct AccountRewards {
int account_id;
int reward_id;
int amount;
};
static std::string PrimaryKey()
{
return std::string("account_id");
}
static std::vector<std::string> Columns()
{
return {
"account_id",
"reward_id",
"amount",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("account_rewards");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static AccountRewards NewEntity()
{
AccountRewards entry{};
entry.account_id = 0;
entry.reward_id = 0;
entry.amount = 0;
return entry;
}
static AccountRewards GetAccountRewardsEntry(
const std::vector<AccountRewards> &account_rewardss,
int account_rewards_id
)
{
for (auto &account_rewards : account_rewardss) {
if (account_rewards.account_id == account_rewards_id) {
return account_rewards;
}
}
return NewEntity();
}
static AccountRewards FindOne(
Database& db,
int account_rewards_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
account_rewards_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AccountRewards entry{};
entry.account_id = atoi(row[0]);
entry.reward_id = atoi(row[1]);
entry.amount = atoi(row[2]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int account_rewards_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
account_rewards_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
AccountRewards account_rewards_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(account_rewards_entry.account_id));
update_values.push_back(columns[1] + " = " + std::to_string(account_rewards_entry.reward_id));
update_values.push_back(columns[2] + " = " + std::to_string(account_rewards_entry.amount));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
account_rewards_entry.account_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AccountRewards InsertOne(
Database& db,
AccountRewards account_rewards_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(account_rewards_entry.account_id));
insert_values.push_back(std::to_string(account_rewards_entry.reward_id));
insert_values.push_back(std::to_string(account_rewards_entry.amount));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
account_rewards_entry.account_id = results.LastInsertedID();
return account_rewards_entry;
}
account_rewards_entry = NewEntity();
return account_rewards_entry;
}
static int InsertMany(
Database& db,
std::vector<AccountRewards> account_rewards_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &account_rewards_entry: account_rewards_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(account_rewards_entry.account_id));
insert_values.push_back(std::to_string(account_rewards_entry.reward_id));
insert_values.push_back(std::to_string(account_rewards_entry.amount));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AccountRewards> All(Database& db)
{
std::vector<AccountRewards> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AccountRewards entry{};
entry.account_id = atoi(row[0]);
entry.reward_id = atoi(row[1]);
entry.amount = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AccountRewards> GetWhere(Database& db, std::string where_filter)
{
std::vector<AccountRewards> 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) {
AccountRewards entry{};
entry.account_id = atoi(row[0]);
entry.reward_id = atoi(row[1]);
entry.amount = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_ACCOUNT_REWARDS_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_ADVENTURE_DETAILS_REPOSITORY_H
#define EQEMU_BASE_ADVENTURE_DETAILS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAdventureDetailsRepository {
public:
struct AdventureDetails {
int id;
int adventure_id;
int instance_id;
int count;
int assassinate_count;
int status;
int time_created;
int time_zoned;
int time_completed;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"adventure_id",
"instance_id",
"count",
"assassinate_count",
"status",
"time_created",
"time_zoned",
"time_completed",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("adventure_details");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static AdventureDetails NewEntity()
{
AdventureDetails entry{};
entry.id = 0;
entry.adventure_id = 0;
entry.instance_id = -1;
entry.count = 0;
entry.assassinate_count = 0;
entry.status = 0;
entry.time_created = 0;
entry.time_zoned = 0;
entry.time_completed = 0;
return entry;
}
static AdventureDetails GetAdventureDetailsEntry(
const std::vector<AdventureDetails> &adventure_detailss,
int adventure_details_id
)
{
for (auto &adventure_details : adventure_detailss) {
if (adventure_details.id == adventure_details_id) {
return adventure_details;
}
}
return NewEntity();
}
static AdventureDetails FindOne(
Database& db,
int adventure_details_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
adventure_details_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AdventureDetails entry{};
entry.id = atoi(row[0]);
entry.adventure_id = atoi(row[1]);
entry.instance_id = atoi(row[2]);
entry.count = atoi(row[3]);
entry.assassinate_count = atoi(row[4]);
entry.status = atoi(row[5]);
entry.time_created = atoi(row[6]);
entry.time_zoned = atoi(row[7]);
entry.time_completed = atoi(row[8]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int adventure_details_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
adventure_details_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
AdventureDetails adventure_details_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[1] + " = " + std::to_string(adventure_details_entry.adventure_id));
update_values.push_back(columns[2] + " = " + std::to_string(adventure_details_entry.instance_id));
update_values.push_back(columns[3] + " = " + std::to_string(adventure_details_entry.count));
update_values.push_back(columns[4] + " = " + std::to_string(adventure_details_entry.assassinate_count));
update_values.push_back(columns[5] + " = " + std::to_string(adventure_details_entry.status));
update_values.push_back(columns[6] + " = " + std::to_string(adventure_details_entry.time_created));
update_values.push_back(columns[7] + " = " + std::to_string(adventure_details_entry.time_zoned));
update_values.push_back(columns[8] + " = " + std::to_string(adventure_details_entry.time_completed));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
adventure_details_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AdventureDetails InsertOne(
Database& db,
AdventureDetails adventure_details_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(adventure_details_entry.id));
insert_values.push_back(std::to_string(adventure_details_entry.adventure_id));
insert_values.push_back(std::to_string(adventure_details_entry.instance_id));
insert_values.push_back(std::to_string(adventure_details_entry.count));
insert_values.push_back(std::to_string(adventure_details_entry.assassinate_count));
insert_values.push_back(std::to_string(adventure_details_entry.status));
insert_values.push_back(std::to_string(adventure_details_entry.time_created));
insert_values.push_back(std::to_string(adventure_details_entry.time_zoned));
insert_values.push_back(std::to_string(adventure_details_entry.time_completed));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
adventure_details_entry.id = results.LastInsertedID();
return adventure_details_entry;
}
adventure_details_entry = NewEntity();
return adventure_details_entry;
}
static int InsertMany(
Database& db,
std::vector<AdventureDetails> adventure_details_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &adventure_details_entry: adventure_details_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(adventure_details_entry.id));
insert_values.push_back(std::to_string(adventure_details_entry.adventure_id));
insert_values.push_back(std::to_string(adventure_details_entry.instance_id));
insert_values.push_back(std::to_string(adventure_details_entry.count));
insert_values.push_back(std::to_string(adventure_details_entry.assassinate_count));
insert_values.push_back(std::to_string(adventure_details_entry.status));
insert_values.push_back(std::to_string(adventure_details_entry.time_created));
insert_values.push_back(std::to_string(adventure_details_entry.time_zoned));
insert_values.push_back(std::to_string(adventure_details_entry.time_completed));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AdventureDetails> All(Database& db)
{
std::vector<AdventureDetails> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AdventureDetails entry{};
entry.id = atoi(row[0]);
entry.adventure_id = atoi(row[1]);
entry.instance_id = atoi(row[2]);
entry.count = atoi(row[3]);
entry.assassinate_count = atoi(row[4]);
entry.status = atoi(row[5]);
entry.time_created = atoi(row[6]);
entry.time_zoned = atoi(row[7]);
entry.time_completed = atoi(row[8]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AdventureDetails> GetWhere(Database& db, std::string where_filter)
{
std::vector<AdventureDetails> 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) {
AdventureDetails entry{};
entry.id = atoi(row[0]);
entry.adventure_id = atoi(row[1]);
entry.instance_id = atoi(row[2]);
entry.count = atoi(row[3]);
entry.assassinate_count = atoi(row[4]);
entry.status = atoi(row[5]);
entry.time_created = atoi(row[6]);
entry.time_zoned = atoi(row[7]);
entry.time_completed = atoi(row[8]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_ADVENTURE_DETAILS_REPOSITORY_H
@@ -1,293 +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_ADVENTURE_MEMBERS_REPOSITORY_H
#define EQEMU_BASE_ADVENTURE_MEMBERS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAdventureMembersRepository {
public:
struct AdventureMembers {
int id;
int charid;
};
static std::string PrimaryKey()
{
return std::string("charid");
}
static std::vector<std::string> Columns()
{
return {
"id",
"charid",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("adventure_members");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static AdventureMembers NewEntity()
{
AdventureMembers entry{};
entry.id = 0;
entry.charid = 0;
return entry;
}
static AdventureMembers GetAdventureMembersEntry(
const std::vector<AdventureMembers> &adventure_memberss,
int adventure_members_id
)
{
for (auto &adventure_members : adventure_memberss) {
if (adventure_members.charid == adventure_members_id) {
return adventure_members;
}
}
return NewEntity();
}
static AdventureMembers FindOne(
Database& db,
int adventure_members_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
adventure_members_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AdventureMembers entry{};
entry.id = atoi(row[0]);
entry.charid = atoi(row[1]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int adventure_members_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
adventure_members_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
AdventureMembers adventure_members_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(adventure_members_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(adventure_members_entry.charid));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
adventure_members_entry.charid
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AdventureMembers InsertOne(
Database& db,
AdventureMembers adventure_members_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(adventure_members_entry.id));
insert_values.push_back(std::to_string(adventure_members_entry.charid));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
adventure_members_entry.charid = results.LastInsertedID();
return adventure_members_entry;
}
adventure_members_entry = NewEntity();
return adventure_members_entry;
}
static int InsertMany(
Database& db,
std::vector<AdventureMembers> adventure_members_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &adventure_members_entry: adventure_members_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(adventure_members_entry.id));
insert_values.push_back(std::to_string(adventure_members_entry.charid));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AdventureMembers> All(Database& db)
{
std::vector<AdventureMembers> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AdventureMembers entry{};
entry.id = atoi(row[0]);
entry.charid = atoi(row[1]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AdventureMembers> GetWhere(Database& db, std::string where_filter)
{
std::vector<AdventureMembers> 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) {
AdventureMembers entry{};
entry.id = atoi(row[0]);
entry.charid = atoi(row[1]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_ADVENTURE_MEMBERS_REPOSITORY_H
@@ -1,374 +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_ADVENTURE_STATS_REPOSITORY_H
#define EQEMU_BASE_ADVENTURE_STATS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAdventureStatsRepository {
public:
struct AdventureStats {
int player_id;
int guk_wins;
int mir_wins;
int mmc_wins;
int ruj_wins;
int tak_wins;
int guk_losses;
int mir_losses;
int mmc_losses;
int ruj_losses;
int tak_losses;
};
static std::string PrimaryKey()
{
return std::string("player_id");
}
static std::vector<std::string> Columns()
{
return {
"player_id",
"guk_wins",
"mir_wins",
"mmc_wins",
"ruj_wins",
"tak_wins",
"guk_losses",
"mir_losses",
"mmc_losses",
"ruj_losses",
"tak_losses",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("adventure_stats");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static AdventureStats NewEntity()
{
AdventureStats entry{};
entry.player_id = 0;
entry.guk_wins = 0;
entry.mir_wins = 0;
entry.mmc_wins = 0;
entry.ruj_wins = 0;
entry.tak_wins = 0;
entry.guk_losses = 0;
entry.mir_losses = 0;
entry.mmc_losses = 0;
entry.ruj_losses = 0;
entry.tak_losses = 0;
return entry;
}
static AdventureStats GetAdventureStatsEntry(
const std::vector<AdventureStats> &adventure_statss,
int adventure_stats_id
)
{
for (auto &adventure_stats : adventure_statss) {
if (adventure_stats.player_id == adventure_stats_id) {
return adventure_stats;
}
}
return NewEntity();
}
static AdventureStats FindOne(
Database& db,
int adventure_stats_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
adventure_stats_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AdventureStats entry{};
entry.player_id = atoi(row[0]);
entry.guk_wins = atoi(row[1]);
entry.mir_wins = atoi(row[2]);
entry.mmc_wins = atoi(row[3]);
entry.ruj_wins = atoi(row[4]);
entry.tak_wins = atoi(row[5]);
entry.guk_losses = atoi(row[6]);
entry.mir_losses = atoi(row[7]);
entry.mmc_losses = atoi(row[8]);
entry.ruj_losses = atoi(row[9]);
entry.tak_losses = atoi(row[10]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int adventure_stats_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
adventure_stats_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
AdventureStats adventure_stats_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(adventure_stats_entry.player_id));
update_values.push_back(columns[1] + " = " + std::to_string(adventure_stats_entry.guk_wins));
update_values.push_back(columns[2] + " = " + std::to_string(adventure_stats_entry.mir_wins));
update_values.push_back(columns[3] + " = " + std::to_string(adventure_stats_entry.mmc_wins));
update_values.push_back(columns[4] + " = " + std::to_string(adventure_stats_entry.ruj_wins));
update_values.push_back(columns[5] + " = " + std::to_string(adventure_stats_entry.tak_wins));
update_values.push_back(columns[6] + " = " + std::to_string(adventure_stats_entry.guk_losses));
update_values.push_back(columns[7] + " = " + std::to_string(adventure_stats_entry.mir_losses));
update_values.push_back(columns[8] + " = " + std::to_string(adventure_stats_entry.mmc_losses));
update_values.push_back(columns[9] + " = " + std::to_string(adventure_stats_entry.ruj_losses));
update_values.push_back(columns[10] + " = " + std::to_string(adventure_stats_entry.tak_losses));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
adventure_stats_entry.player_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AdventureStats InsertOne(
Database& db,
AdventureStats adventure_stats_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(adventure_stats_entry.player_id));
insert_values.push_back(std::to_string(adventure_stats_entry.guk_wins));
insert_values.push_back(std::to_string(adventure_stats_entry.mir_wins));
insert_values.push_back(std::to_string(adventure_stats_entry.mmc_wins));
insert_values.push_back(std::to_string(adventure_stats_entry.ruj_wins));
insert_values.push_back(std::to_string(adventure_stats_entry.tak_wins));
insert_values.push_back(std::to_string(adventure_stats_entry.guk_losses));
insert_values.push_back(std::to_string(adventure_stats_entry.mir_losses));
insert_values.push_back(std::to_string(adventure_stats_entry.mmc_losses));
insert_values.push_back(std::to_string(adventure_stats_entry.ruj_losses));
insert_values.push_back(std::to_string(adventure_stats_entry.tak_losses));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
adventure_stats_entry.player_id = results.LastInsertedID();
return adventure_stats_entry;
}
adventure_stats_entry = NewEntity();
return adventure_stats_entry;
}
static int InsertMany(
Database& db,
std::vector<AdventureStats> adventure_stats_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &adventure_stats_entry: adventure_stats_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(adventure_stats_entry.player_id));
insert_values.push_back(std::to_string(adventure_stats_entry.guk_wins));
insert_values.push_back(std::to_string(adventure_stats_entry.mir_wins));
insert_values.push_back(std::to_string(adventure_stats_entry.mmc_wins));
insert_values.push_back(std::to_string(adventure_stats_entry.ruj_wins));
insert_values.push_back(std::to_string(adventure_stats_entry.tak_wins));
insert_values.push_back(std::to_string(adventure_stats_entry.guk_losses));
insert_values.push_back(std::to_string(adventure_stats_entry.mir_losses));
insert_values.push_back(std::to_string(adventure_stats_entry.mmc_losses));
insert_values.push_back(std::to_string(adventure_stats_entry.ruj_losses));
insert_values.push_back(std::to_string(adventure_stats_entry.tak_losses));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AdventureStats> All(Database& db)
{
std::vector<AdventureStats> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AdventureStats entry{};
entry.player_id = atoi(row[0]);
entry.guk_wins = atoi(row[1]);
entry.mir_wins = atoi(row[2]);
entry.mmc_wins = atoi(row[3]);
entry.ruj_wins = atoi(row[4]);
entry.tak_wins = atoi(row[5]);
entry.guk_losses = atoi(row[6]);
entry.mir_losses = atoi(row[7]);
entry.mmc_losses = atoi(row[8]);
entry.ruj_losses = atoi(row[9]);
entry.tak_losses = atoi(row[10]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AdventureStats> GetWhere(Database& db, std::string where_filter)
{
std::vector<AdventureStats> 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) {
AdventureStats entry{};
entry.player_id = atoi(row[0]);
entry.guk_wins = atoi(row[1]);
entry.mir_wins = atoi(row[2]);
entry.mmc_wins = atoi(row[3]);
entry.ruj_wins = atoi(row[4]);
entry.tak_wins = atoi(row[5]);
entry.guk_losses = atoi(row[6]);
entry.mir_losses = atoi(row[7]);
entry.mmc_losses = atoi(row[8]);
entry.ruj_losses = atoi(row[9]);
entry.tak_losses = atoi(row[10]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_ADVENTURE_STATS_REPOSITORY_H
@@ -1,293 +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_ADVENTURE_TEMPLATE_ENTRY_FLAVOR_REPOSITORY_H
#define EQEMU_BASE_ADVENTURE_TEMPLATE_ENTRY_FLAVOR_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAdventureTemplateEntryFlavorRepository {
public:
struct AdventureTemplateEntryFlavor {
int id;
std::string text;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"text",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("adventure_template_entry_flavor");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static AdventureTemplateEntryFlavor NewEntity()
{
AdventureTemplateEntryFlavor entry{};
entry.id = 0;
entry.text = "";
return entry;
}
static AdventureTemplateEntryFlavor GetAdventureTemplateEntryFlavorEntry(
const std::vector<AdventureTemplateEntryFlavor> &adventure_template_entry_flavors,
int adventure_template_entry_flavor_id
)
{
for (auto &adventure_template_entry_flavor : adventure_template_entry_flavors) {
if (adventure_template_entry_flavor.id == adventure_template_entry_flavor_id) {
return adventure_template_entry_flavor;
}
}
return NewEntity();
}
static AdventureTemplateEntryFlavor FindOne(
Database& db,
int adventure_template_entry_flavor_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
adventure_template_entry_flavor_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AdventureTemplateEntryFlavor entry{};
entry.id = atoi(row[0]);
entry.text = row[1] ? row[1] : "";
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int adventure_template_entry_flavor_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
adventure_template_entry_flavor_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
AdventureTemplateEntryFlavor adventure_template_entry_flavor_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(adventure_template_entry_flavor_entry.id));
update_values.push_back(columns[1] + " = '" + EscapeString(adventure_template_entry_flavor_entry.text) + "'");
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
adventure_template_entry_flavor_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AdventureTemplateEntryFlavor InsertOne(
Database& db,
AdventureTemplateEntryFlavor adventure_template_entry_flavor_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(adventure_template_entry_flavor_entry.id));
insert_values.push_back("'" + EscapeString(adventure_template_entry_flavor_entry.text) + "'");
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
adventure_template_entry_flavor_entry.id = results.LastInsertedID();
return adventure_template_entry_flavor_entry;
}
adventure_template_entry_flavor_entry = NewEntity();
return adventure_template_entry_flavor_entry;
}
static int InsertMany(
Database& db,
std::vector<AdventureTemplateEntryFlavor> adventure_template_entry_flavor_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &adventure_template_entry_flavor_entry: adventure_template_entry_flavor_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(adventure_template_entry_flavor_entry.id));
insert_values.push_back("'" + EscapeString(adventure_template_entry_flavor_entry.text) + "'");
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AdventureTemplateEntryFlavor> All(Database& db)
{
std::vector<AdventureTemplateEntryFlavor> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AdventureTemplateEntryFlavor entry{};
entry.id = atoi(row[0]);
entry.text = row[1] ? row[1] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AdventureTemplateEntryFlavor> GetWhere(Database& db, std::string where_filter)
{
std::vector<AdventureTemplateEntryFlavor> 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) {
AdventureTemplateEntryFlavor entry{};
entry.id = atoi(row[0]);
entry.text = row[1] ? row[1] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_ADVENTURE_TEMPLATE_ENTRY_FLAVOR_REPOSITORY_H
@@ -1,293 +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_ADVENTURE_TEMPLATE_ENTRY_REPOSITORY_H
#define EQEMU_BASE_ADVENTURE_TEMPLATE_ENTRY_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAdventureTemplateEntryRepository {
public:
struct AdventureTemplateEntry {
int id;
int template_id;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"template_id",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("adventure_template_entry");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static AdventureTemplateEntry NewEntity()
{
AdventureTemplateEntry entry{};
entry.id = 0;
entry.template_id = 0;
return entry;
}
static AdventureTemplateEntry GetAdventureTemplateEntryEntry(
const std::vector<AdventureTemplateEntry> &adventure_template_entrys,
int adventure_template_entry_id
)
{
for (auto &adventure_template_entry : adventure_template_entrys) {
if (adventure_template_entry.id == adventure_template_entry_id) {
return adventure_template_entry;
}
}
return NewEntity();
}
static AdventureTemplateEntry FindOne(
Database& db,
int adventure_template_entry_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
adventure_template_entry_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AdventureTemplateEntry entry{};
entry.id = atoi(row[0]);
entry.template_id = atoi(row[1]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int adventure_template_entry_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
adventure_template_entry_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
AdventureTemplateEntry adventure_template_entry_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(adventure_template_entry_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(adventure_template_entry_entry.template_id));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
adventure_template_entry_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AdventureTemplateEntry InsertOne(
Database& db,
AdventureTemplateEntry adventure_template_entry_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(adventure_template_entry_entry.id));
insert_values.push_back(std::to_string(adventure_template_entry_entry.template_id));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
adventure_template_entry_entry.id = results.LastInsertedID();
return adventure_template_entry_entry;
}
adventure_template_entry_entry = NewEntity();
return adventure_template_entry_entry;
}
static int InsertMany(
Database& db,
std::vector<AdventureTemplateEntry> adventure_template_entry_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &adventure_template_entry_entry: adventure_template_entry_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(adventure_template_entry_entry.id));
insert_values.push_back(std::to_string(adventure_template_entry_entry.template_id));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AdventureTemplateEntry> All(Database& db)
{
std::vector<AdventureTemplateEntry> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AdventureTemplateEntry entry{};
entry.id = atoi(row[0]);
entry.template_id = atoi(row[1]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AdventureTemplateEntry> GetWhere(Database& db, std::string where_filter)
{
std::vector<AdventureTemplateEntry> 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) {
AdventureTemplateEntry entry{};
entry.id = atoi(row[0]);
entry.template_id = atoi(row[1]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_ADVENTURE_TEMPLATE_ENTRY_REPOSITORY_H
@@ -1,572 +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_ADVENTURE_TEMPLATE_REPOSITORY_H
#define EQEMU_BASE_ADVENTURE_TEMPLATE_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAdventureTemplateRepository {
public:
struct AdventureTemplate {
int id;
std::string zone;
int zone_version;
int is_hard;
int is_raid;
int min_level;
int max_level;
int type;
int type_data;
int type_count;
float assa_x;
float assa_y;
float assa_z;
float assa_h;
std::string text;
int duration;
int zone_in_time;
int win_points;
int lose_points;
int theme;
int zone_in_zone_id;
float zone_in_x;
float zone_in_y;
int zone_in_object_id;
float dest_x;
float dest_y;
float dest_z;
float dest_h;
int graveyard_zone_id;
float graveyard_x;
float graveyard_y;
float graveyard_z;
float graveyard_radius;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"zone",
"zone_version",
"is_hard",
"is_raid",
"min_level",
"max_level",
"type",
"type_data",
"type_count",
"assa_x",
"assa_y",
"assa_z",
"assa_h",
"text",
"duration",
"zone_in_time",
"win_points",
"lose_points",
"theme",
"zone_in_zone_id",
"zone_in_x",
"zone_in_y",
"zone_in_object_id",
"dest_x",
"dest_y",
"dest_z",
"dest_h",
"graveyard_zone_id",
"graveyard_x",
"graveyard_y",
"graveyard_z",
"graveyard_radius",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("adventure_template");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static AdventureTemplate NewEntity()
{
AdventureTemplate entry{};
entry.id = 0;
entry.zone = "";
entry.zone_version = 0;
entry.is_hard = 0;
entry.is_raid = 0;
entry.min_level = 1;
entry.max_level = 65;
entry.type = 0;
entry.type_data = 0;
entry.type_count = 0;
entry.assa_x = 0;
entry.assa_y = 0;
entry.assa_z = 0;
entry.assa_h = 0;
entry.text = "";
entry.duration = 7200;
entry.zone_in_time = 1800;
entry.win_points = 0;
entry.lose_points = 0;
entry.theme = 1;
entry.zone_in_zone_id = 0;
entry.zone_in_x = 0;
entry.zone_in_y = 0;
entry.zone_in_object_id = 0;
entry.dest_x = 0;
entry.dest_y = 0;
entry.dest_z = 0;
entry.dest_h = 0;
entry.graveyard_zone_id = 0;
entry.graveyard_x = 0;
entry.graveyard_y = 0;
entry.graveyard_z = 0;
entry.graveyard_radius = 0;
return entry;
}
static AdventureTemplate GetAdventureTemplateEntry(
const std::vector<AdventureTemplate> &adventure_templates,
int adventure_template_id
)
{
for (auto &adventure_template : adventure_templates) {
if (adventure_template.id == adventure_template_id) {
return adventure_template;
}
}
return NewEntity();
}
static AdventureTemplate FindOne(
Database& db,
int adventure_template_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
adventure_template_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AdventureTemplate entry{};
entry.id = atoi(row[0]);
entry.zone = row[1] ? row[1] : "";
entry.zone_version = atoi(row[2]);
entry.is_hard = atoi(row[3]);
entry.is_raid = atoi(row[4]);
entry.min_level = atoi(row[5]);
entry.max_level = atoi(row[6]);
entry.type = atoi(row[7]);
entry.type_data = atoi(row[8]);
entry.type_count = atoi(row[9]);
entry.assa_x = static_cast<float>(atof(row[10]));
entry.assa_y = static_cast<float>(atof(row[11]));
entry.assa_z = static_cast<float>(atof(row[12]));
entry.assa_h = static_cast<float>(atof(row[13]));
entry.text = row[14] ? row[14] : "";
entry.duration = atoi(row[15]);
entry.zone_in_time = atoi(row[16]);
entry.win_points = atoi(row[17]);
entry.lose_points = atoi(row[18]);
entry.theme = atoi(row[19]);
entry.zone_in_zone_id = atoi(row[20]);
entry.zone_in_x = static_cast<float>(atof(row[21]));
entry.zone_in_y = static_cast<float>(atof(row[22]));
entry.zone_in_object_id = atoi(row[23]);
entry.dest_x = static_cast<float>(atof(row[24]));
entry.dest_y = static_cast<float>(atof(row[25]));
entry.dest_z = static_cast<float>(atof(row[26]));
entry.dest_h = static_cast<float>(atof(row[27]));
entry.graveyard_zone_id = atoi(row[28]);
entry.graveyard_x = static_cast<float>(atof(row[29]));
entry.graveyard_y = static_cast<float>(atof(row[30]));
entry.graveyard_z = static_cast<float>(atof(row[31]));
entry.graveyard_radius = static_cast<float>(atof(row[32]));
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int adventure_template_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
adventure_template_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
AdventureTemplate adventure_template_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(adventure_template_entry.id));
update_values.push_back(columns[1] + " = '" + EscapeString(adventure_template_entry.zone) + "'");
update_values.push_back(columns[2] + " = " + std::to_string(adventure_template_entry.zone_version));
update_values.push_back(columns[3] + " = " + std::to_string(adventure_template_entry.is_hard));
update_values.push_back(columns[4] + " = " + std::to_string(adventure_template_entry.is_raid));
update_values.push_back(columns[5] + " = " + std::to_string(adventure_template_entry.min_level));
update_values.push_back(columns[6] + " = " + std::to_string(adventure_template_entry.max_level));
update_values.push_back(columns[7] + " = " + std::to_string(adventure_template_entry.type));
update_values.push_back(columns[8] + " = " + std::to_string(adventure_template_entry.type_data));
update_values.push_back(columns[9] + " = " + std::to_string(adventure_template_entry.type_count));
update_values.push_back(columns[10] + " = " + std::to_string(adventure_template_entry.assa_x));
update_values.push_back(columns[11] + " = " + std::to_string(adventure_template_entry.assa_y));
update_values.push_back(columns[12] + " = " + std::to_string(adventure_template_entry.assa_z));
update_values.push_back(columns[13] + " = " + std::to_string(adventure_template_entry.assa_h));
update_values.push_back(columns[14] + " = '" + EscapeString(adventure_template_entry.text) + "'");
update_values.push_back(columns[15] + " = " + std::to_string(adventure_template_entry.duration));
update_values.push_back(columns[16] + " = " + std::to_string(adventure_template_entry.zone_in_time));
update_values.push_back(columns[17] + " = " + std::to_string(adventure_template_entry.win_points));
update_values.push_back(columns[18] + " = " + std::to_string(adventure_template_entry.lose_points));
update_values.push_back(columns[19] + " = " + std::to_string(adventure_template_entry.theme));
update_values.push_back(columns[20] + " = " + std::to_string(adventure_template_entry.zone_in_zone_id));
update_values.push_back(columns[21] + " = " + std::to_string(adventure_template_entry.zone_in_x));
update_values.push_back(columns[22] + " = " + std::to_string(adventure_template_entry.zone_in_y));
update_values.push_back(columns[23] + " = " + std::to_string(adventure_template_entry.zone_in_object_id));
update_values.push_back(columns[24] + " = " + std::to_string(adventure_template_entry.dest_x));
update_values.push_back(columns[25] + " = " + std::to_string(adventure_template_entry.dest_y));
update_values.push_back(columns[26] + " = " + std::to_string(adventure_template_entry.dest_z));
update_values.push_back(columns[27] + " = " + std::to_string(adventure_template_entry.dest_h));
update_values.push_back(columns[28] + " = " + std::to_string(adventure_template_entry.graveyard_zone_id));
update_values.push_back(columns[29] + " = " + std::to_string(adventure_template_entry.graveyard_x));
update_values.push_back(columns[30] + " = " + std::to_string(adventure_template_entry.graveyard_y));
update_values.push_back(columns[31] + " = " + std::to_string(adventure_template_entry.graveyard_z));
update_values.push_back(columns[32] + " = " + std::to_string(adventure_template_entry.graveyard_radius));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
adventure_template_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AdventureTemplate InsertOne(
Database& db,
AdventureTemplate adventure_template_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(adventure_template_entry.id));
insert_values.push_back("'" + EscapeString(adventure_template_entry.zone) + "'");
insert_values.push_back(std::to_string(adventure_template_entry.zone_version));
insert_values.push_back(std::to_string(adventure_template_entry.is_hard));
insert_values.push_back(std::to_string(adventure_template_entry.is_raid));
insert_values.push_back(std::to_string(adventure_template_entry.min_level));
insert_values.push_back(std::to_string(adventure_template_entry.max_level));
insert_values.push_back(std::to_string(adventure_template_entry.type));
insert_values.push_back(std::to_string(adventure_template_entry.type_data));
insert_values.push_back(std::to_string(adventure_template_entry.type_count));
insert_values.push_back(std::to_string(adventure_template_entry.assa_x));
insert_values.push_back(std::to_string(adventure_template_entry.assa_y));
insert_values.push_back(std::to_string(adventure_template_entry.assa_z));
insert_values.push_back(std::to_string(adventure_template_entry.assa_h));
insert_values.push_back("'" + EscapeString(adventure_template_entry.text) + "'");
insert_values.push_back(std::to_string(adventure_template_entry.duration));
insert_values.push_back(std::to_string(adventure_template_entry.zone_in_time));
insert_values.push_back(std::to_string(adventure_template_entry.win_points));
insert_values.push_back(std::to_string(adventure_template_entry.lose_points));
insert_values.push_back(std::to_string(adventure_template_entry.theme));
insert_values.push_back(std::to_string(adventure_template_entry.zone_in_zone_id));
insert_values.push_back(std::to_string(adventure_template_entry.zone_in_x));
insert_values.push_back(std::to_string(adventure_template_entry.zone_in_y));
insert_values.push_back(std::to_string(adventure_template_entry.zone_in_object_id));
insert_values.push_back(std::to_string(adventure_template_entry.dest_x));
insert_values.push_back(std::to_string(adventure_template_entry.dest_y));
insert_values.push_back(std::to_string(adventure_template_entry.dest_z));
insert_values.push_back(std::to_string(adventure_template_entry.dest_h));
insert_values.push_back(std::to_string(adventure_template_entry.graveyard_zone_id));
insert_values.push_back(std::to_string(adventure_template_entry.graveyard_x));
insert_values.push_back(std::to_string(adventure_template_entry.graveyard_y));
insert_values.push_back(std::to_string(adventure_template_entry.graveyard_z));
insert_values.push_back(std::to_string(adventure_template_entry.graveyard_radius));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
adventure_template_entry.id = results.LastInsertedID();
return adventure_template_entry;
}
adventure_template_entry = NewEntity();
return adventure_template_entry;
}
static int InsertMany(
Database& db,
std::vector<AdventureTemplate> adventure_template_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &adventure_template_entry: adventure_template_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(adventure_template_entry.id));
insert_values.push_back("'" + EscapeString(adventure_template_entry.zone) + "'");
insert_values.push_back(std::to_string(adventure_template_entry.zone_version));
insert_values.push_back(std::to_string(adventure_template_entry.is_hard));
insert_values.push_back(std::to_string(adventure_template_entry.is_raid));
insert_values.push_back(std::to_string(adventure_template_entry.min_level));
insert_values.push_back(std::to_string(adventure_template_entry.max_level));
insert_values.push_back(std::to_string(adventure_template_entry.type));
insert_values.push_back(std::to_string(adventure_template_entry.type_data));
insert_values.push_back(std::to_string(adventure_template_entry.type_count));
insert_values.push_back(std::to_string(adventure_template_entry.assa_x));
insert_values.push_back(std::to_string(adventure_template_entry.assa_y));
insert_values.push_back(std::to_string(adventure_template_entry.assa_z));
insert_values.push_back(std::to_string(adventure_template_entry.assa_h));
insert_values.push_back("'" + EscapeString(adventure_template_entry.text) + "'");
insert_values.push_back(std::to_string(adventure_template_entry.duration));
insert_values.push_back(std::to_string(adventure_template_entry.zone_in_time));
insert_values.push_back(std::to_string(adventure_template_entry.win_points));
insert_values.push_back(std::to_string(adventure_template_entry.lose_points));
insert_values.push_back(std::to_string(adventure_template_entry.theme));
insert_values.push_back(std::to_string(adventure_template_entry.zone_in_zone_id));
insert_values.push_back(std::to_string(adventure_template_entry.zone_in_x));
insert_values.push_back(std::to_string(adventure_template_entry.zone_in_y));
insert_values.push_back(std::to_string(adventure_template_entry.zone_in_object_id));
insert_values.push_back(std::to_string(adventure_template_entry.dest_x));
insert_values.push_back(std::to_string(adventure_template_entry.dest_y));
insert_values.push_back(std::to_string(adventure_template_entry.dest_z));
insert_values.push_back(std::to_string(adventure_template_entry.dest_h));
insert_values.push_back(std::to_string(adventure_template_entry.graveyard_zone_id));
insert_values.push_back(std::to_string(adventure_template_entry.graveyard_x));
insert_values.push_back(std::to_string(adventure_template_entry.graveyard_y));
insert_values.push_back(std::to_string(adventure_template_entry.graveyard_z));
insert_values.push_back(std::to_string(adventure_template_entry.graveyard_radius));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AdventureTemplate> All(Database& db)
{
std::vector<AdventureTemplate> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AdventureTemplate entry{};
entry.id = atoi(row[0]);
entry.zone = row[1] ? row[1] : "";
entry.zone_version = atoi(row[2]);
entry.is_hard = atoi(row[3]);
entry.is_raid = atoi(row[4]);
entry.min_level = atoi(row[5]);
entry.max_level = atoi(row[6]);
entry.type = atoi(row[7]);
entry.type_data = atoi(row[8]);
entry.type_count = atoi(row[9]);
entry.assa_x = static_cast<float>(atof(row[10]));
entry.assa_y = static_cast<float>(atof(row[11]));
entry.assa_z = static_cast<float>(atof(row[12]));
entry.assa_h = static_cast<float>(atof(row[13]));
entry.text = row[14] ? row[14] : "";
entry.duration = atoi(row[15]);
entry.zone_in_time = atoi(row[16]);
entry.win_points = atoi(row[17]);
entry.lose_points = atoi(row[18]);
entry.theme = atoi(row[19]);
entry.zone_in_zone_id = atoi(row[20]);
entry.zone_in_x = static_cast<float>(atof(row[21]));
entry.zone_in_y = static_cast<float>(atof(row[22]));
entry.zone_in_object_id = atoi(row[23]);
entry.dest_x = static_cast<float>(atof(row[24]));
entry.dest_y = static_cast<float>(atof(row[25]));
entry.dest_z = static_cast<float>(atof(row[26]));
entry.dest_h = static_cast<float>(atof(row[27]));
entry.graveyard_zone_id = atoi(row[28]);
entry.graveyard_x = static_cast<float>(atof(row[29]));
entry.graveyard_y = static_cast<float>(atof(row[30]));
entry.graveyard_z = static_cast<float>(atof(row[31]));
entry.graveyard_radius = static_cast<float>(atof(row[32]));
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AdventureTemplate> GetWhere(Database& db, std::string where_filter)
{
std::vector<AdventureTemplate> 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) {
AdventureTemplate entry{};
entry.id = atoi(row[0]);
entry.zone = row[1] ? row[1] : "";
entry.zone_version = atoi(row[2]);
entry.is_hard = atoi(row[3]);
entry.is_raid = atoi(row[4]);
entry.min_level = atoi(row[5]);
entry.max_level = atoi(row[6]);
entry.type = atoi(row[7]);
entry.type_data = atoi(row[8]);
entry.type_count = atoi(row[9]);
entry.assa_x = static_cast<float>(atof(row[10]));
entry.assa_y = static_cast<float>(atof(row[11]));
entry.assa_z = static_cast<float>(atof(row[12]));
entry.assa_h = static_cast<float>(atof(row[13]));
entry.text = row[14] ? row[14] : "";
entry.duration = atoi(row[15]);
entry.zone_in_time = atoi(row[16]);
entry.win_points = atoi(row[17]);
entry.lose_points = atoi(row[18]);
entry.theme = atoi(row[19]);
entry.zone_in_zone_id = atoi(row[20]);
entry.zone_in_x = static_cast<float>(atof(row[21]));
entry.zone_in_y = static_cast<float>(atof(row[22]));
entry.zone_in_object_id = atoi(row[23]);
entry.dest_x = static_cast<float>(atof(row[24]));
entry.dest_y = static_cast<float>(atof(row[25]));
entry.dest_z = static_cast<float>(atof(row[26]));
entry.dest_h = static_cast<float>(atof(row[27]));
entry.graveyard_zone_id = atoi(row[28]);
entry.graveyard_x = static_cast<float>(atof(row[29]));
entry.graveyard_y = static_cast<float>(atof(row[30]));
entry.graveyard_z = static_cast<float>(atof(row[31]));
entry.graveyard_radius = static_cast<float>(atof(row[32]));
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_ADVENTURE_TEMPLATE_REPOSITORY_H
@@ -1,293 +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_ALTERNATE_CURRENCY_REPOSITORY_H
#define EQEMU_BASE_ALTERNATE_CURRENCY_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAlternateCurrencyRepository {
public:
struct AlternateCurrency {
int id;
int item_id;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"item_id",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("alternate_currency");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static AlternateCurrency NewEntity()
{
AlternateCurrency entry{};
entry.id = 0;
entry.item_id = 0;
return entry;
}
static AlternateCurrency GetAlternateCurrencyEntry(
const std::vector<AlternateCurrency> &alternate_currencys,
int alternate_currency_id
)
{
for (auto &alternate_currency : alternate_currencys) {
if (alternate_currency.id == alternate_currency_id) {
return alternate_currency;
}
}
return NewEntity();
}
static AlternateCurrency FindOne(
Database& db,
int alternate_currency_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
alternate_currency_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
AlternateCurrency entry{};
entry.id = atoi(row[0]);
entry.item_id = atoi(row[1]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int alternate_currency_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
alternate_currency_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
AlternateCurrency alternate_currency_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(alternate_currency_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(alternate_currency_entry.item_id));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
alternate_currency_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static AlternateCurrency InsertOne(
Database& db,
AlternateCurrency alternate_currency_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(alternate_currency_entry.id));
insert_values.push_back(std::to_string(alternate_currency_entry.item_id));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
alternate_currency_entry.id = results.LastInsertedID();
return alternate_currency_entry;
}
alternate_currency_entry = NewEntity();
return alternate_currency_entry;
}
static int InsertMany(
Database& db,
std::vector<AlternateCurrency> alternate_currency_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &alternate_currency_entry: alternate_currency_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(alternate_currency_entry.id));
insert_values.push_back(std::to_string(alternate_currency_entry.item_id));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<AlternateCurrency> All(Database& db)
{
std::vector<AlternateCurrency> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
AlternateCurrency entry{};
entry.id = atoi(row[0]);
entry.item_id = atoi(row[1]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<AlternateCurrency> GetWhere(Database& db, std::string where_filter)
{
std::vector<AlternateCurrency> 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) {
AlternateCurrency entry{};
entry.id = atoi(row[0]);
entry.item_id = atoi(row[1]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_ALTERNATE_CURRENCY_REPOSITORY_H
@@ -1,374 +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_AURAS_REPOSITORY_H
#define EQEMU_BASE_AURAS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseAurasRepository {
public:
struct Auras {
int type;
int npc_type;
std::string name;
int spell_id;
int distance;
int aura_type;
int spawn_type;
int movement;
int duration;
int icon;
int cast_time;
};
static std::string PrimaryKey()
{
return std::string("type");
}
static std::vector<std::string> Columns()
{
return {
"type",
"npc_type",
"name",
"spell_id",
"distance",
"aura_type",
"spawn_type",
"movement",
"duration",
"icon",
"cast_time",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("auras");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static Auras NewEntity()
{
Auras entry{};
entry.type = 0;
entry.npc_type = 0;
entry.name = "";
entry.spell_id = 0;
entry.distance = 60;
entry.aura_type = 1;
entry.spawn_type = 0;
entry.movement = 0;
entry.duration = 5400;
entry.icon = -1;
entry.cast_time = 0;
return entry;
}
static Auras GetAurasEntry(
const std::vector<Auras> &aurass,
int auras_id
)
{
for (auto &auras : aurass) {
if (auras.type == auras_id) {
return auras;
}
}
return NewEntity();
}
static Auras FindOne(
Database& db,
int auras_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
auras_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
Auras entry{};
entry.type = atoi(row[0]);
entry.npc_type = atoi(row[1]);
entry.name = row[2] ? row[2] : "";
entry.spell_id = atoi(row[3]);
entry.distance = atoi(row[4]);
entry.aura_type = atoi(row[5]);
entry.spawn_type = atoi(row[6]);
entry.movement = atoi(row[7]);
entry.duration = atoi(row[8]);
entry.icon = atoi(row[9]);
entry.cast_time = atoi(row[10]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int auras_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
auras_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
Auras auras_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(auras_entry.type));
update_values.push_back(columns[1] + " = " + std::to_string(auras_entry.npc_type));
update_values.push_back(columns[2] + " = '" + EscapeString(auras_entry.name) + "'");
update_values.push_back(columns[3] + " = " + std::to_string(auras_entry.spell_id));
update_values.push_back(columns[4] + " = " + std::to_string(auras_entry.distance));
update_values.push_back(columns[5] + " = " + std::to_string(auras_entry.aura_type));
update_values.push_back(columns[6] + " = " + std::to_string(auras_entry.spawn_type));
update_values.push_back(columns[7] + " = " + std::to_string(auras_entry.movement));
update_values.push_back(columns[8] + " = " + std::to_string(auras_entry.duration));
update_values.push_back(columns[9] + " = " + std::to_string(auras_entry.icon));
update_values.push_back(columns[10] + " = " + std::to_string(auras_entry.cast_time));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
auras_entry.type
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static Auras InsertOne(
Database& db,
Auras auras_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(auras_entry.type));
insert_values.push_back(std::to_string(auras_entry.npc_type));
insert_values.push_back("'" + EscapeString(auras_entry.name) + "'");
insert_values.push_back(std::to_string(auras_entry.spell_id));
insert_values.push_back(std::to_string(auras_entry.distance));
insert_values.push_back(std::to_string(auras_entry.aura_type));
insert_values.push_back(std::to_string(auras_entry.spawn_type));
insert_values.push_back(std::to_string(auras_entry.movement));
insert_values.push_back(std::to_string(auras_entry.duration));
insert_values.push_back(std::to_string(auras_entry.icon));
insert_values.push_back(std::to_string(auras_entry.cast_time));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
auras_entry.type = results.LastInsertedID();
return auras_entry;
}
auras_entry = NewEntity();
return auras_entry;
}
static int InsertMany(
Database& db,
std::vector<Auras> auras_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &auras_entry: auras_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(auras_entry.type));
insert_values.push_back(std::to_string(auras_entry.npc_type));
insert_values.push_back("'" + EscapeString(auras_entry.name) + "'");
insert_values.push_back(std::to_string(auras_entry.spell_id));
insert_values.push_back(std::to_string(auras_entry.distance));
insert_values.push_back(std::to_string(auras_entry.aura_type));
insert_values.push_back(std::to_string(auras_entry.spawn_type));
insert_values.push_back(std::to_string(auras_entry.movement));
insert_values.push_back(std::to_string(auras_entry.duration));
insert_values.push_back(std::to_string(auras_entry.icon));
insert_values.push_back(std::to_string(auras_entry.cast_time));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<Auras> All(Database& db)
{
std::vector<Auras> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
Auras entry{};
entry.type = atoi(row[0]);
entry.npc_type = atoi(row[1]);
entry.name = row[2] ? row[2] : "";
entry.spell_id = atoi(row[3]);
entry.distance = atoi(row[4]);
entry.aura_type = atoi(row[5]);
entry.spawn_type = atoi(row[6]);
entry.movement = atoi(row[7]);
entry.duration = atoi(row[8]);
entry.icon = atoi(row[9]);
entry.cast_time = atoi(row[10]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<Auras> GetWhere(Database& db, std::string where_filter)
{
std::vector<Auras> 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) {
Auras entry{};
entry.type = atoi(row[0]);
entry.npc_type = atoi(row[1]);
entry.name = row[2] ? row[2] : "";
entry.spell_id = atoi(row[3]);
entry.distance = atoi(row[4]);
entry.aura_type = atoi(row[5]);
entry.spawn_type = atoi(row[6]);
entry.movement = atoi(row[7]);
entry.duration = atoi(row[8]);
entry.icon = atoi(row[9]);
entry.cast_time = atoi(row[10]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_AURAS_REPOSITORY_H
@@ -1,365 +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_BASE_DATA_REPOSITORY_H
#define EQEMU_BASE_BASE_DATA_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseBaseDataRepository {
public:
struct BaseData {
int level;
int class;
float hp;
float mana;
float end;
float unk1;
float unk2;
float hp_fac;
float mana_fac;
float end_fac;
};
static std::string PrimaryKey()
{
return std::string("level");
}
static std::vector<std::string> Columns()
{
return {
"level",
"class",
"hp",
"mana",
"end",
"unk1",
"unk2",
"hp_fac",
"mana_fac",
"end_fac",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("base_data");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static BaseData NewEntity()
{
BaseData entry{};
entry.level = 0;
entry.class = 0;
entry.hp = 0;
entry.mana = 0;
entry.end = 0;
entry.unk1 = 0;
entry.unk2 = 0;
entry.hp_fac = 0;
entry.mana_fac = 0;
entry.end_fac = 0;
return entry;
}
static BaseData GetBaseDataEntry(
const std::vector<BaseData> &base_datas,
int base_data_id
)
{
for (auto &base_data : base_datas) {
if (base_data.level == base_data_id) {
return base_data;
}
}
return NewEntity();
}
static BaseData FindOne(
Database& db,
int base_data_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
base_data_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
BaseData entry{};
entry.level = atoi(row[0]);
entry.class = atoi(row[1]);
entry.hp = static_cast<float>(atof(row[2]));
entry.mana = static_cast<float>(atof(row[3]));
entry.end = static_cast<float>(atof(row[4]));
entry.unk1 = static_cast<float>(atof(row[5]));
entry.unk2 = static_cast<float>(atof(row[6]));
entry.hp_fac = static_cast<float>(atof(row[7]));
entry.mana_fac = static_cast<float>(atof(row[8]));
entry.end_fac = static_cast<float>(atof(row[9]));
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int base_data_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
base_data_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
BaseData base_data_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(base_data_entry.level));
update_values.push_back(columns[1] + " = " + std::to_string(base_data_entry.class));
update_values.push_back(columns[2] + " = " + std::to_string(base_data_entry.hp));
update_values.push_back(columns[3] + " = " + std::to_string(base_data_entry.mana));
update_values.push_back(columns[4] + " = " + std::to_string(base_data_entry.end));
update_values.push_back(columns[5] + " = " + std::to_string(base_data_entry.unk1));
update_values.push_back(columns[6] + " = " + std::to_string(base_data_entry.unk2));
update_values.push_back(columns[7] + " = " + std::to_string(base_data_entry.hp_fac));
update_values.push_back(columns[8] + " = " + std::to_string(base_data_entry.mana_fac));
update_values.push_back(columns[9] + " = " + std::to_string(base_data_entry.end_fac));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
base_data_entry.level
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static BaseData InsertOne(
Database& db,
BaseData base_data_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(base_data_entry.level));
insert_values.push_back(std::to_string(base_data_entry.class));
insert_values.push_back(std::to_string(base_data_entry.hp));
insert_values.push_back(std::to_string(base_data_entry.mana));
insert_values.push_back(std::to_string(base_data_entry.end));
insert_values.push_back(std::to_string(base_data_entry.unk1));
insert_values.push_back(std::to_string(base_data_entry.unk2));
insert_values.push_back(std::to_string(base_data_entry.hp_fac));
insert_values.push_back(std::to_string(base_data_entry.mana_fac));
insert_values.push_back(std::to_string(base_data_entry.end_fac));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
base_data_entry.level = results.LastInsertedID();
return base_data_entry;
}
base_data_entry = NewEntity();
return base_data_entry;
}
static int InsertMany(
Database& db,
std::vector<BaseData> base_data_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &base_data_entry: base_data_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(base_data_entry.level));
insert_values.push_back(std::to_string(base_data_entry.class));
insert_values.push_back(std::to_string(base_data_entry.hp));
insert_values.push_back(std::to_string(base_data_entry.mana));
insert_values.push_back(std::to_string(base_data_entry.end));
insert_values.push_back(std::to_string(base_data_entry.unk1));
insert_values.push_back(std::to_string(base_data_entry.unk2));
insert_values.push_back(std::to_string(base_data_entry.hp_fac));
insert_values.push_back(std::to_string(base_data_entry.mana_fac));
insert_values.push_back(std::to_string(base_data_entry.end_fac));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<BaseData> All(Database& db)
{
std::vector<BaseData> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
BaseData entry{};
entry.level = atoi(row[0]);
entry.class = atoi(row[1]);
entry.hp = static_cast<float>(atof(row[2]));
entry.mana = static_cast<float>(atof(row[3]));
entry.end = static_cast<float>(atof(row[4]));
entry.unk1 = static_cast<float>(atof(row[5]));
entry.unk2 = static_cast<float>(atof(row[6]));
entry.hp_fac = static_cast<float>(atof(row[7]));
entry.mana_fac = static_cast<float>(atof(row[8]));
entry.end_fac = static_cast<float>(atof(row[9]));
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<BaseData> GetWhere(Database& db, std::string where_filter)
{
std::vector<BaseData> 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) {
BaseData entry{};
entry.level = atoi(row[0]);
entry.class = atoi(row[1]);
entry.hp = static_cast<float>(atof(row[2]));
entry.mana = static_cast<float>(atof(row[3]));
entry.end = static_cast<float>(atof(row[4]));
entry.unk1 = static_cast<float>(atof(row[5]));
entry.unk2 = static_cast<float>(atof(row[6]));
entry.hp_fac = static_cast<float>(atof(row[7]));
entry.mana_fac = static_cast<float>(atof(row[8]));
entry.end_fac = static_cast<float>(atof(row[9]));
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_BASE_DATA_REPOSITORY_H
@@ -1,382 +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_BLOCKED_SPELLS_REPOSITORY_H
#define EQEMU_BASE_BLOCKED_SPELLS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseBlockedSpellsRepository {
public:
struct BlockedSpells {
int id;
int spellid;
int type;
int zoneid;
float x;
float y;
float z;
float x_diff;
float y_diff;
float z_diff;
std::string message;
std::string description;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"spellid",
"type",
"zoneid",
"x",
"y",
"z",
"x_diff",
"y_diff",
"z_diff",
"message",
"description",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("blocked_spells");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static BlockedSpells NewEntity()
{
BlockedSpells entry{};
entry.id = 0;
entry.spellid = 0;
entry.type = 0;
entry.zoneid = 0;
entry.x = 0;
entry.y = 0;
entry.z = 0;
entry.x_diff = 0;
entry.y_diff = 0;
entry.z_diff = 0;
entry.message = "";
entry.description = "";
return entry;
}
static BlockedSpells GetBlockedSpellsEntry(
const std::vector<BlockedSpells> &blocked_spellss,
int blocked_spells_id
)
{
for (auto &blocked_spells : blocked_spellss) {
if (blocked_spells.id == blocked_spells_id) {
return blocked_spells;
}
}
return NewEntity();
}
static BlockedSpells FindOne(
Database& db,
int blocked_spells_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
blocked_spells_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
BlockedSpells entry{};
entry.id = atoi(row[0]);
entry.spellid = atoi(row[1]);
entry.type = atoi(row[2]);
entry.zoneid = atoi(row[3]);
entry.x = static_cast<float>(atof(row[4]));
entry.y = static_cast<float>(atof(row[5]));
entry.z = static_cast<float>(atof(row[6]));
entry.x_diff = static_cast<float>(atof(row[7]));
entry.y_diff = static_cast<float>(atof(row[8]));
entry.z_diff = static_cast<float>(atof(row[9]));
entry.message = row[10] ? row[10] : "";
entry.description = row[11] ? row[11] : "";
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int blocked_spells_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
blocked_spells_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
BlockedSpells blocked_spells_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[1] + " = " + std::to_string(blocked_spells_entry.spellid));
update_values.push_back(columns[2] + " = " + std::to_string(blocked_spells_entry.type));
update_values.push_back(columns[3] + " = " + std::to_string(blocked_spells_entry.zoneid));
update_values.push_back(columns[4] + " = " + std::to_string(blocked_spells_entry.x));
update_values.push_back(columns[5] + " = " + std::to_string(blocked_spells_entry.y));
update_values.push_back(columns[6] + " = " + std::to_string(blocked_spells_entry.z));
update_values.push_back(columns[7] + " = " + std::to_string(blocked_spells_entry.x_diff));
update_values.push_back(columns[8] + " = " + std::to_string(blocked_spells_entry.y_diff));
update_values.push_back(columns[9] + " = " + std::to_string(blocked_spells_entry.z_diff));
update_values.push_back(columns[10] + " = '" + EscapeString(blocked_spells_entry.message) + "'");
update_values.push_back(columns[11] + " = '" + EscapeString(blocked_spells_entry.description) + "'");
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
blocked_spells_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static BlockedSpells InsertOne(
Database& db,
BlockedSpells blocked_spells_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(blocked_spells_entry.id));
insert_values.push_back(std::to_string(blocked_spells_entry.spellid));
insert_values.push_back(std::to_string(blocked_spells_entry.type));
insert_values.push_back(std::to_string(blocked_spells_entry.zoneid));
insert_values.push_back(std::to_string(blocked_spells_entry.x));
insert_values.push_back(std::to_string(blocked_spells_entry.y));
insert_values.push_back(std::to_string(blocked_spells_entry.z));
insert_values.push_back(std::to_string(blocked_spells_entry.x_diff));
insert_values.push_back(std::to_string(blocked_spells_entry.y_diff));
insert_values.push_back(std::to_string(blocked_spells_entry.z_diff));
insert_values.push_back("'" + EscapeString(blocked_spells_entry.message) + "'");
insert_values.push_back("'" + EscapeString(blocked_spells_entry.description) + "'");
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
blocked_spells_entry.id = results.LastInsertedID();
return blocked_spells_entry;
}
blocked_spells_entry = NewEntity();
return blocked_spells_entry;
}
static int InsertMany(
Database& db,
std::vector<BlockedSpells> blocked_spells_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &blocked_spells_entry: blocked_spells_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(blocked_spells_entry.id));
insert_values.push_back(std::to_string(blocked_spells_entry.spellid));
insert_values.push_back(std::to_string(blocked_spells_entry.type));
insert_values.push_back(std::to_string(blocked_spells_entry.zoneid));
insert_values.push_back(std::to_string(blocked_spells_entry.x));
insert_values.push_back(std::to_string(blocked_spells_entry.y));
insert_values.push_back(std::to_string(blocked_spells_entry.z));
insert_values.push_back(std::to_string(blocked_spells_entry.x_diff));
insert_values.push_back(std::to_string(blocked_spells_entry.y_diff));
insert_values.push_back(std::to_string(blocked_spells_entry.z_diff));
insert_values.push_back("'" + EscapeString(blocked_spells_entry.message) + "'");
insert_values.push_back("'" + EscapeString(blocked_spells_entry.description) + "'");
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<BlockedSpells> All(Database& db)
{
std::vector<BlockedSpells> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
BlockedSpells entry{};
entry.id = atoi(row[0]);
entry.spellid = atoi(row[1]);
entry.type = atoi(row[2]);
entry.zoneid = atoi(row[3]);
entry.x = static_cast<float>(atof(row[4]));
entry.y = static_cast<float>(atof(row[5]));
entry.z = static_cast<float>(atof(row[6]));
entry.x_diff = static_cast<float>(atof(row[7]));
entry.y_diff = static_cast<float>(atof(row[8]));
entry.z_diff = static_cast<float>(atof(row[9]));
entry.message = row[10] ? row[10] : "";
entry.description = row[11] ? row[11] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<BlockedSpells> GetWhere(Database& db, std::string where_filter)
{
std::vector<BlockedSpells> 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) {
BlockedSpells entry{};
entry.id = atoi(row[0]);
entry.spellid = atoi(row[1]);
entry.type = atoi(row[2]);
entry.zoneid = atoi(row[3]);
entry.x = static_cast<float>(atof(row[4]));
entry.y = static_cast<float>(atof(row[5]));
entry.z = static_cast<float>(atof(row[6]));
entry.x_diff = static_cast<float>(atof(row[7]));
entry.y_diff = static_cast<float>(atof(row[8]));
entry.z_diff = static_cast<float>(atof(row[9]));
entry.message = row[10] ? row[10] : "";
entry.description = row[11] ? row[11] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_BLOCKED_SPELLS_REPOSITORY_H
@@ -1,562 +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_BUG_REPORTS_REPOSITORY_H
#define EQEMU_BASE_BUG_REPORTS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseBugReportsRepository {
public:
struct BugReports {
int id;
std::string zone;
int client_version_id;
std::string client_version_name;
int account_id;
int character_id;
std::string character_name;
int reporter_spoof;
int category_id;
std::string category_name;
std::string reporter_name;
std::string ui_path;
float pos_x;
float pos_y;
float pos_z;
int heading;
int time_played;
int target_id;
std::string target_name;
int optional_info_mask;
int _can_duplicate;
int _crash_bug;
int _target_info;
int _character_flags;
int _unknown_value;
std::string bug_report;
std::string system_info;
std::string report_datetime;
int bug_status;
std::string last_review;
std::string last_reviewer;
std::string reviewer_notes;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"zone",
"client_version_id",
"client_version_name",
"account_id",
"character_id",
"character_name",
"reporter_spoof",
"category_id",
"category_name",
"reporter_name",
"ui_path",
"pos_x",
"pos_y",
"pos_z",
"heading",
"time_played",
"target_id",
"target_name",
"optional_info_mask",
"_can_duplicate",
"_crash_bug",
"_target_info",
"_character_flags",
"_unknown_value",
"bug_report",
"system_info",
"report_datetime",
"bug_status",
"last_review",
"last_reviewer",
"reviewer_notes",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("bug_reports");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static BugReports NewEntity()
{
BugReports entry{};
entry.id = 0;
entry.zone = "Unknown";
entry.client_version_id = 0;
entry.client_version_name = "Unknown";
entry.account_id = 0;
entry.character_id = 0;
entry.character_name = "Unknown";
entry.reporter_spoof = 1;
entry.category_id = 0;
entry.category_name = "Other";
entry.reporter_name = "Unknown";
entry.ui_path = "Unknown";
entry.pos_x = 0;
entry.pos_y = 0;
entry.pos_z = 0;
entry.heading = 0;
entry.time_played = 0;
entry.target_id = 0;
entry.target_name = "Unknown";
entry.optional_info_mask = 0;
entry._can_duplicate = 0;
entry._crash_bug = 0;
entry._target_info = 0;
entry._character_flags = 0;
entry._unknown_value = 0;
entry.bug_report = "";
entry.system_info = "";
entry.report_datetime = current_timestamp();
entry.bug_status = 0;
entry.last_review = current_timestamp();
entry.last_reviewer = "None";
entry.reviewer_notes = "";
return entry;
}
static BugReports GetBugReportsEntry(
const std::vector<BugReports> &bug_reportss,
int bug_reports_id
)
{
for (auto &bug_reports : bug_reportss) {
if (bug_reports.id == bug_reports_id) {
return bug_reports;
}
}
return NewEntity();
}
static BugReports FindOne(
Database& db,
int bug_reports_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
bug_reports_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
BugReports entry{};
entry.id = atoi(row[0]);
entry.zone = row[1] ? row[1] : "";
entry.client_version_id = atoi(row[2]);
entry.client_version_name = row[3] ? row[3] : "";
entry.account_id = atoi(row[4]);
entry.character_id = atoi(row[5]);
entry.character_name = row[6] ? row[6] : "";
entry.reporter_spoof = atoi(row[7]);
entry.category_id = atoi(row[8]);
entry.category_name = row[9] ? row[9] : "";
entry.reporter_name = row[10] ? row[10] : "";
entry.ui_path = row[11] ? row[11] : "";
entry.pos_x = static_cast<float>(atof(row[12]));
entry.pos_y = static_cast<float>(atof(row[13]));
entry.pos_z = static_cast<float>(atof(row[14]));
entry.heading = atoi(row[15]);
entry.time_played = atoi(row[16]);
entry.target_id = atoi(row[17]);
entry.target_name = row[18] ? row[18] : "";
entry.optional_info_mask = atoi(row[19]);
entry._can_duplicate = atoi(row[20]);
entry._crash_bug = atoi(row[21]);
entry._target_info = atoi(row[22]);
entry._character_flags = atoi(row[23]);
entry._unknown_value = atoi(row[24]);
entry.bug_report = row[25] ? row[25] : "";
entry.system_info = row[26] ? row[26] : "";
entry.report_datetime = row[27] ? row[27] : "";
entry.bug_status = atoi(row[28]);
entry.last_review = row[29] ? row[29] : "";
entry.last_reviewer = row[30] ? row[30] : "";
entry.reviewer_notes = row[31] ? row[31] : "";
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int bug_reports_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
bug_reports_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
BugReports bug_reports_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[1] + " = '" + EscapeString(bug_reports_entry.zone) + "'");
update_values.push_back(columns[2] + " = " + std::to_string(bug_reports_entry.client_version_id));
update_values.push_back(columns[3] + " = '" + EscapeString(bug_reports_entry.client_version_name) + "'");
update_values.push_back(columns[4] + " = " + std::to_string(bug_reports_entry.account_id));
update_values.push_back(columns[5] + " = " + std::to_string(bug_reports_entry.character_id));
update_values.push_back(columns[6] + " = '" + EscapeString(bug_reports_entry.character_name) + "'");
update_values.push_back(columns[7] + " = " + std::to_string(bug_reports_entry.reporter_spoof));
update_values.push_back(columns[8] + " = " + std::to_string(bug_reports_entry.category_id));
update_values.push_back(columns[9] + " = '" + EscapeString(bug_reports_entry.category_name) + "'");
update_values.push_back(columns[10] + " = '" + EscapeString(bug_reports_entry.reporter_name) + "'");
update_values.push_back(columns[11] + " = '" + EscapeString(bug_reports_entry.ui_path) + "'");
update_values.push_back(columns[12] + " = " + std::to_string(bug_reports_entry.pos_x));
update_values.push_back(columns[13] + " = " + std::to_string(bug_reports_entry.pos_y));
update_values.push_back(columns[14] + " = " + std::to_string(bug_reports_entry.pos_z));
update_values.push_back(columns[15] + " = " + std::to_string(bug_reports_entry.heading));
update_values.push_back(columns[16] + " = " + std::to_string(bug_reports_entry.time_played));
update_values.push_back(columns[17] + " = " + std::to_string(bug_reports_entry.target_id));
update_values.push_back(columns[18] + " = '" + EscapeString(bug_reports_entry.target_name) + "'");
update_values.push_back(columns[19] + " = " + std::to_string(bug_reports_entry.optional_info_mask));
update_values.push_back(columns[20] + " = " + std::to_string(bug_reports_entry._can_duplicate));
update_values.push_back(columns[21] + " = " + std::to_string(bug_reports_entry._crash_bug));
update_values.push_back(columns[22] + " = " + std::to_string(bug_reports_entry._target_info));
update_values.push_back(columns[23] + " = " + std::to_string(bug_reports_entry._character_flags));
update_values.push_back(columns[24] + " = " + std::to_string(bug_reports_entry._unknown_value));
update_values.push_back(columns[25] + " = '" + EscapeString(bug_reports_entry.bug_report) + "'");
update_values.push_back(columns[26] + " = '" + EscapeString(bug_reports_entry.system_info) + "'");
update_values.push_back(columns[27] + " = '" + EscapeString(bug_reports_entry.report_datetime) + "'");
update_values.push_back(columns[28] + " = " + std::to_string(bug_reports_entry.bug_status));
update_values.push_back(columns[29] + " = '" + EscapeString(bug_reports_entry.last_review) + "'");
update_values.push_back(columns[30] + " = '" + EscapeString(bug_reports_entry.last_reviewer) + "'");
update_values.push_back(columns[31] + " = '" + EscapeString(bug_reports_entry.reviewer_notes) + "'");
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
bug_reports_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static BugReports InsertOne(
Database& db,
BugReports bug_reports_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(bug_reports_entry.id));
insert_values.push_back("'" + EscapeString(bug_reports_entry.zone) + "'");
insert_values.push_back(std::to_string(bug_reports_entry.client_version_id));
insert_values.push_back("'" + EscapeString(bug_reports_entry.client_version_name) + "'");
insert_values.push_back(std::to_string(bug_reports_entry.account_id));
insert_values.push_back(std::to_string(bug_reports_entry.character_id));
insert_values.push_back("'" + EscapeString(bug_reports_entry.character_name) + "'");
insert_values.push_back(std::to_string(bug_reports_entry.reporter_spoof));
insert_values.push_back(std::to_string(bug_reports_entry.category_id));
insert_values.push_back("'" + EscapeString(bug_reports_entry.category_name) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.reporter_name) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.ui_path) + "'");
insert_values.push_back(std::to_string(bug_reports_entry.pos_x));
insert_values.push_back(std::to_string(bug_reports_entry.pos_y));
insert_values.push_back(std::to_string(bug_reports_entry.pos_z));
insert_values.push_back(std::to_string(bug_reports_entry.heading));
insert_values.push_back(std::to_string(bug_reports_entry.time_played));
insert_values.push_back(std::to_string(bug_reports_entry.target_id));
insert_values.push_back("'" + EscapeString(bug_reports_entry.target_name) + "'");
insert_values.push_back(std::to_string(bug_reports_entry.optional_info_mask));
insert_values.push_back(std::to_string(bug_reports_entry._can_duplicate));
insert_values.push_back(std::to_string(bug_reports_entry._crash_bug));
insert_values.push_back(std::to_string(bug_reports_entry._target_info));
insert_values.push_back(std::to_string(bug_reports_entry._character_flags));
insert_values.push_back(std::to_string(bug_reports_entry._unknown_value));
insert_values.push_back("'" + EscapeString(bug_reports_entry.bug_report) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.system_info) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.report_datetime) + "'");
insert_values.push_back(std::to_string(bug_reports_entry.bug_status));
insert_values.push_back("'" + EscapeString(bug_reports_entry.last_review) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.last_reviewer) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.reviewer_notes) + "'");
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
bug_reports_entry.id = results.LastInsertedID();
return bug_reports_entry;
}
bug_reports_entry = NewEntity();
return bug_reports_entry;
}
static int InsertMany(
Database& db,
std::vector<BugReports> bug_reports_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &bug_reports_entry: bug_reports_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(bug_reports_entry.id));
insert_values.push_back("'" + EscapeString(bug_reports_entry.zone) + "'");
insert_values.push_back(std::to_string(bug_reports_entry.client_version_id));
insert_values.push_back("'" + EscapeString(bug_reports_entry.client_version_name) + "'");
insert_values.push_back(std::to_string(bug_reports_entry.account_id));
insert_values.push_back(std::to_string(bug_reports_entry.character_id));
insert_values.push_back("'" + EscapeString(bug_reports_entry.character_name) + "'");
insert_values.push_back(std::to_string(bug_reports_entry.reporter_spoof));
insert_values.push_back(std::to_string(bug_reports_entry.category_id));
insert_values.push_back("'" + EscapeString(bug_reports_entry.category_name) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.reporter_name) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.ui_path) + "'");
insert_values.push_back(std::to_string(bug_reports_entry.pos_x));
insert_values.push_back(std::to_string(bug_reports_entry.pos_y));
insert_values.push_back(std::to_string(bug_reports_entry.pos_z));
insert_values.push_back(std::to_string(bug_reports_entry.heading));
insert_values.push_back(std::to_string(bug_reports_entry.time_played));
insert_values.push_back(std::to_string(bug_reports_entry.target_id));
insert_values.push_back("'" + EscapeString(bug_reports_entry.target_name) + "'");
insert_values.push_back(std::to_string(bug_reports_entry.optional_info_mask));
insert_values.push_back(std::to_string(bug_reports_entry._can_duplicate));
insert_values.push_back(std::to_string(bug_reports_entry._crash_bug));
insert_values.push_back(std::to_string(bug_reports_entry._target_info));
insert_values.push_back(std::to_string(bug_reports_entry._character_flags));
insert_values.push_back(std::to_string(bug_reports_entry._unknown_value));
insert_values.push_back("'" + EscapeString(bug_reports_entry.bug_report) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.system_info) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.report_datetime) + "'");
insert_values.push_back(std::to_string(bug_reports_entry.bug_status));
insert_values.push_back("'" + EscapeString(bug_reports_entry.last_review) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.last_reviewer) + "'");
insert_values.push_back("'" + EscapeString(bug_reports_entry.reviewer_notes) + "'");
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<BugReports> All(Database& db)
{
std::vector<BugReports> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
BugReports entry{};
entry.id = atoi(row[0]);
entry.zone = row[1] ? row[1] : "";
entry.client_version_id = atoi(row[2]);
entry.client_version_name = row[3] ? row[3] : "";
entry.account_id = atoi(row[4]);
entry.character_id = atoi(row[5]);
entry.character_name = row[6] ? row[6] : "";
entry.reporter_spoof = atoi(row[7]);
entry.category_id = atoi(row[8]);
entry.category_name = row[9] ? row[9] : "";
entry.reporter_name = row[10] ? row[10] : "";
entry.ui_path = row[11] ? row[11] : "";
entry.pos_x = static_cast<float>(atof(row[12]));
entry.pos_y = static_cast<float>(atof(row[13]));
entry.pos_z = static_cast<float>(atof(row[14]));
entry.heading = atoi(row[15]);
entry.time_played = atoi(row[16]);
entry.target_id = atoi(row[17]);
entry.target_name = row[18] ? row[18] : "";
entry.optional_info_mask = atoi(row[19]);
entry._can_duplicate = atoi(row[20]);
entry._crash_bug = atoi(row[21]);
entry._target_info = atoi(row[22]);
entry._character_flags = atoi(row[23]);
entry._unknown_value = atoi(row[24]);
entry.bug_report = row[25] ? row[25] : "";
entry.system_info = row[26] ? row[26] : "";
entry.report_datetime = row[27] ? row[27] : "";
entry.bug_status = atoi(row[28]);
entry.last_review = row[29] ? row[29] : "";
entry.last_reviewer = row[30] ? row[30] : "";
entry.reviewer_notes = row[31] ? row[31] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<BugReports> GetWhere(Database& db, std::string where_filter)
{
std::vector<BugReports> 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) {
BugReports entry{};
entry.id = atoi(row[0]);
entry.zone = row[1] ? row[1] : "";
entry.client_version_id = atoi(row[2]);
entry.client_version_name = row[3] ? row[3] : "";
entry.account_id = atoi(row[4]);
entry.character_id = atoi(row[5]);
entry.character_name = row[6] ? row[6] : "";
entry.reporter_spoof = atoi(row[7]);
entry.category_id = atoi(row[8]);
entry.category_name = row[9] ? row[9] : "";
entry.reporter_name = row[10] ? row[10] : "";
entry.ui_path = row[11] ? row[11] : "";
entry.pos_x = static_cast<float>(atof(row[12]));
entry.pos_y = static_cast<float>(atof(row[13]));
entry.pos_z = static_cast<float>(atof(row[14]));
entry.heading = atoi(row[15]);
entry.time_played = atoi(row[16]);
entry.target_id = atoi(row[17]);
entry.target_name = row[18] ? row[18] : "";
entry.optional_info_mask = atoi(row[19]);
entry._can_duplicate = atoi(row[20]);
entry._crash_bug = atoi(row[21]);
entry._target_info = atoi(row[22]);
entry._character_flags = atoi(row[23]);
entry._unknown_value = atoi(row[24]);
entry.bug_report = row[25] ? row[25] : "";
entry.system_info = row[26] ? row[26] : "";
entry.report_datetime = row[27] ? row[27] : "";
entry.bug_status = atoi(row[28]);
entry.last_review = row[29] ? row[29] : "";
entry.last_reviewer = row[30] ? row[30] : "";
entry.reviewer_notes = row[31] ? row[31] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_BUG_REPORTS_REPOSITORY_H
@@ -1,391 +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_BUGS_REPOSITORY_H
#define EQEMU_BASE_BUGS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseBugsRepository {
public:
struct Bugs {
int id;
std::string zone;
std::string name;
std::string ui;
float x;
float y;
float z;
std::string type;
int flag;
std::string target;
std::string bug;
std::string date;
int status;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"zone",
"name",
"ui",
"x",
"y",
"z",
"type",
"flag",
"target",
"bug",
"date",
"status",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("bugs");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static Bugs NewEntity()
{
Bugs entry{};
entry.id = 0;
entry.zone = "";
entry.name = "";
entry.ui = "";
entry.x = 0;
entry.y = 0;
entry.z = 0;
entry.type = "";
entry.flag = 0;
entry.target = "";
entry.bug = "";
entry.date = 0;
entry.status = 0;
return entry;
}
static Bugs GetBugsEntry(
const std::vector<Bugs> &bugss,
int bugs_id
)
{
for (auto &bugs : bugss) {
if (bugs.id == bugs_id) {
return bugs;
}
}
return NewEntity();
}
static Bugs FindOne(
Database& db,
int bugs_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
bugs_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
Bugs entry{};
entry.id = atoi(row[0]);
entry.zone = row[1] ? row[1] : "";
entry.name = row[2] ? row[2] : "";
entry.ui = row[3] ? row[3] : "";
entry.x = static_cast<float>(atof(row[4]));
entry.y = static_cast<float>(atof(row[5]));
entry.z = static_cast<float>(atof(row[6]));
entry.type = row[7] ? row[7] : "";
entry.flag = atoi(row[8]);
entry.target = row[9] ? row[9] : "";
entry.bug = row[10] ? row[10] : "";
entry.date = row[11] ? row[11] : "";
entry.status = atoi(row[12]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int bugs_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
bugs_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
Bugs bugs_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[1] + " = '" + EscapeString(bugs_entry.zone) + "'");
update_values.push_back(columns[2] + " = '" + EscapeString(bugs_entry.name) + "'");
update_values.push_back(columns[3] + " = '" + EscapeString(bugs_entry.ui) + "'");
update_values.push_back(columns[4] + " = " + std::to_string(bugs_entry.x));
update_values.push_back(columns[5] + " = " + std::to_string(bugs_entry.y));
update_values.push_back(columns[6] + " = " + std::to_string(bugs_entry.z));
update_values.push_back(columns[7] + " = '" + EscapeString(bugs_entry.type) + "'");
update_values.push_back(columns[8] + " = " + std::to_string(bugs_entry.flag));
update_values.push_back(columns[9] + " = '" + EscapeString(bugs_entry.target) + "'");
update_values.push_back(columns[10] + " = '" + EscapeString(bugs_entry.bug) + "'");
update_values.push_back(columns[11] + " = '" + EscapeString(bugs_entry.date) + "'");
update_values.push_back(columns[12] + " = " + std::to_string(bugs_entry.status));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
bugs_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static Bugs InsertOne(
Database& db,
Bugs bugs_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(bugs_entry.id));
insert_values.push_back("'" + EscapeString(bugs_entry.zone) + "'");
insert_values.push_back("'" + EscapeString(bugs_entry.name) + "'");
insert_values.push_back("'" + EscapeString(bugs_entry.ui) + "'");
insert_values.push_back(std::to_string(bugs_entry.x));
insert_values.push_back(std::to_string(bugs_entry.y));
insert_values.push_back(std::to_string(bugs_entry.z));
insert_values.push_back("'" + EscapeString(bugs_entry.type) + "'");
insert_values.push_back(std::to_string(bugs_entry.flag));
insert_values.push_back("'" + EscapeString(bugs_entry.target) + "'");
insert_values.push_back("'" + EscapeString(bugs_entry.bug) + "'");
insert_values.push_back("'" + EscapeString(bugs_entry.date) + "'");
insert_values.push_back(std::to_string(bugs_entry.status));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
bugs_entry.id = results.LastInsertedID();
return bugs_entry;
}
bugs_entry = NewEntity();
return bugs_entry;
}
static int InsertMany(
Database& db,
std::vector<Bugs> bugs_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &bugs_entry: bugs_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(bugs_entry.id));
insert_values.push_back("'" + EscapeString(bugs_entry.zone) + "'");
insert_values.push_back("'" + EscapeString(bugs_entry.name) + "'");
insert_values.push_back("'" + EscapeString(bugs_entry.ui) + "'");
insert_values.push_back(std::to_string(bugs_entry.x));
insert_values.push_back(std::to_string(bugs_entry.y));
insert_values.push_back(std::to_string(bugs_entry.z));
insert_values.push_back("'" + EscapeString(bugs_entry.type) + "'");
insert_values.push_back(std::to_string(bugs_entry.flag));
insert_values.push_back("'" + EscapeString(bugs_entry.target) + "'");
insert_values.push_back("'" + EscapeString(bugs_entry.bug) + "'");
insert_values.push_back("'" + EscapeString(bugs_entry.date) + "'");
insert_values.push_back(std::to_string(bugs_entry.status));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<Bugs> All(Database& db)
{
std::vector<Bugs> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
Bugs entry{};
entry.id = atoi(row[0]);
entry.zone = row[1] ? row[1] : "";
entry.name = row[2] ? row[2] : "";
entry.ui = row[3] ? row[3] : "";
entry.x = static_cast<float>(atof(row[4]));
entry.y = static_cast<float>(atof(row[5]));
entry.z = static_cast<float>(atof(row[6]));
entry.type = row[7] ? row[7] : "";
entry.flag = atoi(row[8]);
entry.target = row[9] ? row[9] : "";
entry.bug = row[10] ? row[10] : "";
entry.date = row[11] ? row[11] : "";
entry.status = atoi(row[12]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<Bugs> GetWhere(Database& db, std::string where_filter)
{
std::vector<Bugs> 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) {
Bugs entry{};
entry.id = atoi(row[0]);
entry.zone = row[1] ? row[1] : "";
entry.name = row[2] ? row[2] : "";
entry.ui = row[3] ? row[3] : "";
entry.x = static_cast<float>(atof(row[4]));
entry.y = static_cast<float>(atof(row[5]));
entry.z = static_cast<float>(atof(row[6]));
entry.type = row[7] ? row[7] : "";
entry.flag = atoi(row[8]);
entry.target = row[9] ? row[9] : "";
entry.bug = row[10] ? row[10] : "";
entry.date = row[11] ? row[11] : "";
entry.status = atoi(row[12]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_BUGS_REPOSITORY_H
@@ -1,329 +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_BUYER_REPOSITORY_H
#define EQEMU_BASE_BUYER_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseBuyerRepository {
public:
struct Buyer {
int charid;
int buyslot;
int itemid;
std::string itemname;
int quantity;
int price;
};
static std::string PrimaryKey()
{
return std::string("charid");
}
static std::vector<std::string> Columns()
{
return {
"charid",
"buyslot",
"itemid",
"itemname",
"quantity",
"price",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("buyer");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static Buyer NewEntity()
{
Buyer entry{};
entry.charid = 0;
entry.buyslot = 0;
entry.itemid = 0;
entry.itemname = "";
entry.quantity = 0;
entry.price = 0;
return entry;
}
static Buyer GetBuyerEntry(
const std::vector<Buyer> &buyers,
int buyer_id
)
{
for (auto &buyer : buyers) {
if (buyer.charid == buyer_id) {
return buyer;
}
}
return NewEntity();
}
static Buyer FindOne(
Database& db,
int buyer_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
buyer_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
Buyer entry{};
entry.charid = atoi(row[0]);
entry.buyslot = atoi(row[1]);
entry.itemid = atoi(row[2]);
entry.itemname = row[3] ? row[3] : "";
entry.quantity = atoi(row[4]);
entry.price = atoi(row[5]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int buyer_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
buyer_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
Buyer buyer_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(buyer_entry.charid));
update_values.push_back(columns[1] + " = " + std::to_string(buyer_entry.buyslot));
update_values.push_back(columns[2] + " = " + std::to_string(buyer_entry.itemid));
update_values.push_back(columns[3] + " = '" + EscapeString(buyer_entry.itemname) + "'");
update_values.push_back(columns[4] + " = " + std::to_string(buyer_entry.quantity));
update_values.push_back(columns[5] + " = " + std::to_string(buyer_entry.price));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
buyer_entry.charid
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static Buyer InsertOne(
Database& db,
Buyer buyer_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(buyer_entry.charid));
insert_values.push_back(std::to_string(buyer_entry.buyslot));
insert_values.push_back(std::to_string(buyer_entry.itemid));
insert_values.push_back("'" + EscapeString(buyer_entry.itemname) + "'");
insert_values.push_back(std::to_string(buyer_entry.quantity));
insert_values.push_back(std::to_string(buyer_entry.price));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
buyer_entry.charid = results.LastInsertedID();
return buyer_entry;
}
buyer_entry = NewEntity();
return buyer_entry;
}
static int InsertMany(
Database& db,
std::vector<Buyer> buyer_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &buyer_entry: buyer_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(buyer_entry.charid));
insert_values.push_back(std::to_string(buyer_entry.buyslot));
insert_values.push_back(std::to_string(buyer_entry.itemid));
insert_values.push_back("'" + EscapeString(buyer_entry.itemname) + "'");
insert_values.push_back(std::to_string(buyer_entry.quantity));
insert_values.push_back(std::to_string(buyer_entry.price));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<Buyer> All(Database& db)
{
std::vector<Buyer> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
Buyer entry{};
entry.charid = atoi(row[0]);
entry.buyslot = atoi(row[1]);
entry.itemid = atoi(row[2]);
entry.itemname = row[3] ? row[3] : "";
entry.quantity = atoi(row[4]);
entry.price = atoi(row[5]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<Buyer> GetWhere(Database& db, std::string where_filter)
{
std::vector<Buyer> 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) {
Buyer entry{};
entry.charid = atoi(row[0]);
entry.buyslot = atoi(row[1]);
entry.itemid = atoi(row[2]);
entry.itemname = row[3] ? row[3] : "";
entry.quantity = atoi(row[4]);
entry.price = atoi(row[5]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_BUYER_REPOSITORY_H
@@ -1,329 +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_CHAR_CREATE_COMBINATIONS_REPOSITORY_H
#define EQEMU_BASE_CHAR_CREATE_COMBINATIONS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharCreateCombinationsRepository {
public:
struct CharCreateCombinations {
int allocation_id;
int race;
int class;
int deity;
int start_zone;
int expansions_req;
};
static std::string PrimaryKey()
{
return std::string("race");
}
static std::vector<std::string> Columns()
{
return {
"allocation_id",
"race",
"class",
"deity",
"start_zone",
"expansions_req",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("char_create_combinations");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static CharCreateCombinations NewEntity()
{
CharCreateCombinations entry{};
entry.allocation_id = 0;
entry.race = 0;
entry.class = 0;
entry.deity = 0;
entry.start_zone = 0;
entry.expansions_req = 0;
return entry;
}
static CharCreateCombinations GetCharCreateCombinationsEntry(
const std::vector<CharCreateCombinations> &char_create_combinationss,
int char_create_combinations_id
)
{
for (auto &char_create_combinations : char_create_combinationss) {
if (char_create_combinations.race == char_create_combinations_id) {
return char_create_combinations;
}
}
return NewEntity();
}
static CharCreateCombinations FindOne(
Database& db,
int char_create_combinations_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
char_create_combinations_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharCreateCombinations entry{};
entry.allocation_id = atoi(row[0]);
entry.race = atoi(row[1]);
entry.class = atoi(row[2]);
entry.deity = atoi(row[3]);
entry.start_zone = atoi(row[4]);
entry.expansions_req = atoi(row[5]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int char_create_combinations_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
char_create_combinations_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
CharCreateCombinations char_create_combinations_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(char_create_combinations_entry.allocation_id));
update_values.push_back(columns[1] + " = " + std::to_string(char_create_combinations_entry.race));
update_values.push_back(columns[2] + " = " + std::to_string(char_create_combinations_entry.class));
update_values.push_back(columns[3] + " = " + std::to_string(char_create_combinations_entry.deity));
update_values.push_back(columns[4] + " = " + std::to_string(char_create_combinations_entry.start_zone));
update_values.push_back(columns[5] + " = " + std::to_string(char_create_combinations_entry.expansions_req));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
char_create_combinations_entry.race
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharCreateCombinations InsertOne(
Database& db,
CharCreateCombinations char_create_combinations_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(char_create_combinations_entry.allocation_id));
insert_values.push_back(std::to_string(char_create_combinations_entry.race));
insert_values.push_back(std::to_string(char_create_combinations_entry.class));
insert_values.push_back(std::to_string(char_create_combinations_entry.deity));
insert_values.push_back(std::to_string(char_create_combinations_entry.start_zone));
insert_values.push_back(std::to_string(char_create_combinations_entry.expansions_req));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
char_create_combinations_entry.race = results.LastInsertedID();
return char_create_combinations_entry;
}
char_create_combinations_entry = NewEntity();
return char_create_combinations_entry;
}
static int InsertMany(
Database& db,
std::vector<CharCreateCombinations> char_create_combinations_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &char_create_combinations_entry: char_create_combinations_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(char_create_combinations_entry.allocation_id));
insert_values.push_back(std::to_string(char_create_combinations_entry.race));
insert_values.push_back(std::to_string(char_create_combinations_entry.class));
insert_values.push_back(std::to_string(char_create_combinations_entry.deity));
insert_values.push_back(std::to_string(char_create_combinations_entry.start_zone));
insert_values.push_back(std::to_string(char_create_combinations_entry.expansions_req));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharCreateCombinations> All(Database& db)
{
std::vector<CharCreateCombinations> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharCreateCombinations entry{};
entry.allocation_id = atoi(row[0]);
entry.race = atoi(row[1]);
entry.class = atoi(row[2]);
entry.deity = atoi(row[3]);
entry.start_zone = atoi(row[4]);
entry.expansions_req = atoi(row[5]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharCreateCombinations> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharCreateCombinations> 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) {
CharCreateCombinations entry{};
entry.allocation_id = atoi(row[0]);
entry.race = atoi(row[1]);
entry.class = atoi(row[2]);
entry.deity = atoi(row[3]);
entry.start_zone = atoi(row[4]);
entry.expansions_req = atoi(row[5]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_CHAR_CREATE_COMBINATIONS_REPOSITORY_H
@@ -1,410 +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_CHAR_CREATE_POINT_ALLOCATIONS_REPOSITORY_H
#define EQEMU_BASE_CHAR_CREATE_POINT_ALLOCATIONS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharCreatePointAllocationsRepository {
public:
struct CharCreatePointAllocations {
int id;
int base_str;
int base_sta;
int base_dex;
int base_agi;
int base_int;
int base_wis;
int base_cha;
int alloc_str;
int alloc_sta;
int alloc_dex;
int alloc_agi;
int alloc_int;
int alloc_wis;
int alloc_cha;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"base_str",
"base_sta",
"base_dex",
"base_agi",
"base_int",
"base_wis",
"base_cha",
"alloc_str",
"alloc_sta",
"alloc_dex",
"alloc_agi",
"alloc_int",
"alloc_wis",
"alloc_cha",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("char_create_point_allocations");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static CharCreatePointAllocations NewEntity()
{
CharCreatePointAllocations entry{};
entry.id = 0;
entry.base_str = 0;
entry.base_sta = 0;
entry.base_dex = 0;
entry.base_agi = 0;
entry.base_int = 0;
entry.base_wis = 0;
entry.base_cha = 0;
entry.alloc_str = 0;
entry.alloc_sta = 0;
entry.alloc_dex = 0;
entry.alloc_agi = 0;
entry.alloc_int = 0;
entry.alloc_wis = 0;
entry.alloc_cha = 0;
return entry;
}
static CharCreatePointAllocations GetCharCreatePointAllocationsEntry(
const std::vector<CharCreatePointAllocations> &char_create_point_allocationss,
int char_create_point_allocations_id
)
{
for (auto &char_create_point_allocations : char_create_point_allocationss) {
if (char_create_point_allocations.id == char_create_point_allocations_id) {
return char_create_point_allocations;
}
}
return NewEntity();
}
static CharCreatePointAllocations FindOne(
Database& db,
int char_create_point_allocations_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
char_create_point_allocations_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharCreatePointAllocations entry{};
entry.id = atoi(row[0]);
entry.base_str = atoi(row[1]);
entry.base_sta = atoi(row[2]);
entry.base_dex = atoi(row[3]);
entry.base_agi = atoi(row[4]);
entry.base_int = atoi(row[5]);
entry.base_wis = atoi(row[6]);
entry.base_cha = atoi(row[7]);
entry.alloc_str = atoi(row[8]);
entry.alloc_sta = atoi(row[9]);
entry.alloc_dex = atoi(row[10]);
entry.alloc_agi = atoi(row[11]);
entry.alloc_int = atoi(row[12]);
entry.alloc_wis = atoi(row[13]);
entry.alloc_cha = atoi(row[14]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int char_create_point_allocations_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
char_create_point_allocations_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
CharCreatePointAllocations char_create_point_allocations_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(char_create_point_allocations_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(char_create_point_allocations_entry.base_str));
update_values.push_back(columns[2] + " = " + std::to_string(char_create_point_allocations_entry.base_sta));
update_values.push_back(columns[3] + " = " + std::to_string(char_create_point_allocations_entry.base_dex));
update_values.push_back(columns[4] + " = " + std::to_string(char_create_point_allocations_entry.base_agi));
update_values.push_back(columns[5] + " = " + std::to_string(char_create_point_allocations_entry.base_int));
update_values.push_back(columns[6] + " = " + std::to_string(char_create_point_allocations_entry.base_wis));
update_values.push_back(columns[7] + " = " + std::to_string(char_create_point_allocations_entry.base_cha));
update_values.push_back(columns[8] + " = " + std::to_string(char_create_point_allocations_entry.alloc_str));
update_values.push_back(columns[9] + " = " + std::to_string(char_create_point_allocations_entry.alloc_sta));
update_values.push_back(columns[10] + " = " + std::to_string(char_create_point_allocations_entry.alloc_dex));
update_values.push_back(columns[11] + " = " + std::to_string(char_create_point_allocations_entry.alloc_agi));
update_values.push_back(columns[12] + " = " + std::to_string(char_create_point_allocations_entry.alloc_int));
update_values.push_back(columns[13] + " = " + std::to_string(char_create_point_allocations_entry.alloc_wis));
update_values.push_back(columns[14] + " = " + std::to_string(char_create_point_allocations_entry.alloc_cha));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
char_create_point_allocations_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharCreatePointAllocations InsertOne(
Database& db,
CharCreatePointAllocations char_create_point_allocations_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(char_create_point_allocations_entry.id));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_str));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_sta));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_dex));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_agi));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_int));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_wis));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_cha));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_str));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_sta));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_dex));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_agi));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_int));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_wis));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_cha));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
char_create_point_allocations_entry.id = results.LastInsertedID();
return char_create_point_allocations_entry;
}
char_create_point_allocations_entry = NewEntity();
return char_create_point_allocations_entry;
}
static int InsertMany(
Database& db,
std::vector<CharCreatePointAllocations> char_create_point_allocations_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &char_create_point_allocations_entry: char_create_point_allocations_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(char_create_point_allocations_entry.id));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_str));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_sta));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_dex));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_agi));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_int));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_wis));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.base_cha));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_str));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_sta));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_dex));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_agi));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_int));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_wis));
insert_values.push_back(std::to_string(char_create_point_allocations_entry.alloc_cha));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharCreatePointAllocations> All(Database& db)
{
std::vector<CharCreatePointAllocations> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharCreatePointAllocations entry{};
entry.id = atoi(row[0]);
entry.base_str = atoi(row[1]);
entry.base_sta = atoi(row[2]);
entry.base_dex = atoi(row[3]);
entry.base_agi = atoi(row[4]);
entry.base_int = atoi(row[5]);
entry.base_wis = atoi(row[6]);
entry.base_cha = atoi(row[7]);
entry.alloc_str = atoi(row[8]);
entry.alloc_sta = atoi(row[9]);
entry.alloc_dex = atoi(row[10]);
entry.alloc_agi = atoi(row[11]);
entry.alloc_int = atoi(row[12]);
entry.alloc_wis = atoi(row[13]);
entry.alloc_cha = atoi(row[14]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharCreatePointAllocations> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharCreatePointAllocations> 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) {
CharCreatePointAllocations entry{};
entry.id = atoi(row[0]);
entry.base_str = atoi(row[1]);
entry.base_sta = atoi(row[2]);
entry.base_dex = atoi(row[3]);
entry.base_agi = atoi(row[4]);
entry.base_int = atoi(row[5]);
entry.base_wis = atoi(row[6]);
entry.base_cha = atoi(row[7]);
entry.alloc_str = atoi(row[8]);
entry.alloc_sta = atoi(row[9]);
entry.alloc_dex = atoi(row[10]);
entry.alloc_agi = atoi(row[11]);
entry.alloc_int = atoi(row[12]);
entry.alloc_wis = atoi(row[13]);
entry.alloc_cha = atoi(row[14]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_CHAR_CREATE_POINT_ALLOCATIONS_REPOSITORY_H
@@ -1,302 +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_CHAR_RECIPE_LIST_REPOSITORY_H
#define EQEMU_BASE_CHAR_RECIPE_LIST_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharRecipeListRepository {
public:
struct CharRecipeList {
int char_id;
int recipe_id;
int madecount;
};
static std::string PrimaryKey()
{
return std::string("char_id");
}
static std::vector<std::string> Columns()
{
return {
"char_id",
"recipe_id",
"madecount",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("char_recipe_list");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static CharRecipeList NewEntity()
{
CharRecipeList entry{};
entry.char_id = 0;
entry.recipe_id = 0;
entry.madecount = 0;
return entry;
}
static CharRecipeList GetCharRecipeListEntry(
const std::vector<CharRecipeList> &char_recipe_lists,
int char_recipe_list_id
)
{
for (auto &char_recipe_list : char_recipe_lists) {
if (char_recipe_list.char_id == char_recipe_list_id) {
return char_recipe_list;
}
}
return NewEntity();
}
static CharRecipeList FindOne(
Database& db,
int char_recipe_list_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
char_recipe_list_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharRecipeList entry{};
entry.char_id = atoi(row[0]);
entry.recipe_id = atoi(row[1]);
entry.madecount = atoi(row[2]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int char_recipe_list_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
char_recipe_list_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
CharRecipeList char_recipe_list_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(char_recipe_list_entry.char_id));
update_values.push_back(columns[1] + " = " + std::to_string(char_recipe_list_entry.recipe_id));
update_values.push_back(columns[2] + " = " + std::to_string(char_recipe_list_entry.madecount));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
char_recipe_list_entry.char_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharRecipeList InsertOne(
Database& db,
CharRecipeList char_recipe_list_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(char_recipe_list_entry.char_id));
insert_values.push_back(std::to_string(char_recipe_list_entry.recipe_id));
insert_values.push_back(std::to_string(char_recipe_list_entry.madecount));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
char_recipe_list_entry.char_id = results.LastInsertedID();
return char_recipe_list_entry;
}
char_recipe_list_entry = NewEntity();
return char_recipe_list_entry;
}
static int InsertMany(
Database& db,
std::vector<CharRecipeList> char_recipe_list_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &char_recipe_list_entry: char_recipe_list_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(char_recipe_list_entry.char_id));
insert_values.push_back(std::to_string(char_recipe_list_entry.recipe_id));
insert_values.push_back(std::to_string(char_recipe_list_entry.madecount));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharRecipeList> All(Database& db)
{
std::vector<CharRecipeList> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharRecipeList entry{};
entry.char_id = atoi(row[0]);
entry.recipe_id = atoi(row[1]);
entry.madecount = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharRecipeList> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharRecipeList> 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) {
CharRecipeList entry{};
entry.char_id = atoi(row[0]);
entry.recipe_id = atoi(row[1]);
entry.madecount = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_CHAR_RECIPE_LIST_REPOSITORY_H
@@ -1,320 +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_CHARACTER_ACTIVITIES_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_ACTIVITIES_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharacterActivitiesRepository {
public:
struct CharacterActivities {
int charid;
int taskid;
int activityid;
int donecount;
int completed;
};
static std::string PrimaryKey()
{
return std::string("charid");
}
static std::vector<std::string> Columns()
{
return {
"charid",
"taskid",
"activityid",
"donecount",
"completed",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("character_activities");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static CharacterActivities NewEntity()
{
CharacterActivities entry{};
entry.charid = 0;
entry.taskid = 0;
entry.activityid = 0;
entry.donecount = 0;
entry.completed = 0;
return entry;
}
static CharacterActivities GetCharacterActivitiesEntry(
const std::vector<CharacterActivities> &character_activitiess,
int character_activities_id
)
{
for (auto &character_activities : character_activitiess) {
if (character_activities.charid == character_activities_id) {
return character_activities;
}
}
return NewEntity();
}
static CharacterActivities FindOne(
Database& db,
int character_activities_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_activities_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterActivities entry{};
entry.charid = atoi(row[0]);
entry.taskid = atoi(row[1]);
entry.activityid = atoi(row[2]);
entry.donecount = atoi(row[3]);
entry.completed = atoi(row[4]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int character_activities_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_activities_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
CharacterActivities character_activities_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(character_activities_entry.charid));
update_values.push_back(columns[1] + " = " + std::to_string(character_activities_entry.taskid));
update_values.push_back(columns[2] + " = " + std::to_string(character_activities_entry.activityid));
update_values.push_back(columns[3] + " = " + std::to_string(character_activities_entry.donecount));
update_values.push_back(columns[4] + " = " + std::to_string(character_activities_entry.completed));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_activities_entry.charid
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterActivities InsertOne(
Database& db,
CharacterActivities character_activities_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_activities_entry.charid));
insert_values.push_back(std::to_string(character_activities_entry.taskid));
insert_values.push_back(std::to_string(character_activities_entry.activityid));
insert_values.push_back(std::to_string(character_activities_entry.donecount));
insert_values.push_back(std::to_string(character_activities_entry.completed));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_activities_entry.charid = results.LastInsertedID();
return character_activities_entry;
}
character_activities_entry = NewEntity();
return character_activities_entry;
}
static int InsertMany(
Database& db,
std::vector<CharacterActivities> character_activities_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_activities_entry: character_activities_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_activities_entry.charid));
insert_values.push_back(std::to_string(character_activities_entry.taskid));
insert_values.push_back(std::to_string(character_activities_entry.activityid));
insert_values.push_back(std::to_string(character_activities_entry.donecount));
insert_values.push_back(std::to_string(character_activities_entry.completed));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterActivities> All(Database& db)
{
std::vector<CharacterActivities> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterActivities entry{};
entry.charid = atoi(row[0]);
entry.taskid = atoi(row[1]);
entry.activityid = atoi(row[2]);
entry.donecount = atoi(row[3]);
entry.completed = atoi(row[4]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterActivities> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterActivities> 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) {
CharacterActivities entry{};
entry.charid = atoi(row[0]);
entry.taskid = atoi(row[1]);
entry.activityid = atoi(row[2]);
entry.donecount = atoi(row[3]);
entry.completed = atoi(row[4]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_CHARACTER_ACTIVITIES_REPOSITORY_H
@@ -1,302 +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_CHARACTER_ALT_CURRENCY_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_ALT_CURRENCY_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharacterAltCurrencyRepository {
public:
struct CharacterAltCurrency {
int char_id;
int currency_id;
int amount;
};
static std::string PrimaryKey()
{
return std::string("char_id");
}
static std::vector<std::string> Columns()
{
return {
"char_id",
"currency_id",
"amount",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("character_alt_currency");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static CharacterAltCurrency NewEntity()
{
CharacterAltCurrency entry{};
entry.char_id = 0;
entry.currency_id = 0;
entry.amount = 0;
return entry;
}
static CharacterAltCurrency GetCharacterAltCurrencyEntry(
const std::vector<CharacterAltCurrency> &character_alt_currencys,
int character_alt_currency_id
)
{
for (auto &character_alt_currency : character_alt_currencys) {
if (character_alt_currency.char_id == character_alt_currency_id) {
return character_alt_currency;
}
}
return NewEntity();
}
static CharacterAltCurrency FindOne(
Database& db,
int character_alt_currency_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_alt_currency_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterAltCurrency entry{};
entry.char_id = atoi(row[0]);
entry.currency_id = atoi(row[1]);
entry.amount = atoi(row[2]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int character_alt_currency_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_alt_currency_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
CharacterAltCurrency character_alt_currency_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(character_alt_currency_entry.char_id));
update_values.push_back(columns[1] + " = " + std::to_string(character_alt_currency_entry.currency_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_alt_currency_entry.amount));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_alt_currency_entry.char_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterAltCurrency InsertOne(
Database& db,
CharacterAltCurrency character_alt_currency_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_alt_currency_entry.char_id));
insert_values.push_back(std::to_string(character_alt_currency_entry.currency_id));
insert_values.push_back(std::to_string(character_alt_currency_entry.amount));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_alt_currency_entry.char_id = results.LastInsertedID();
return character_alt_currency_entry;
}
character_alt_currency_entry = NewEntity();
return character_alt_currency_entry;
}
static int InsertMany(
Database& db,
std::vector<CharacterAltCurrency> character_alt_currency_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_alt_currency_entry: character_alt_currency_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_alt_currency_entry.char_id));
insert_values.push_back(std::to_string(character_alt_currency_entry.currency_id));
insert_values.push_back(std::to_string(character_alt_currency_entry.amount));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterAltCurrency> All(Database& db)
{
std::vector<CharacterAltCurrency> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterAltCurrency entry{};
entry.char_id = atoi(row[0]);
entry.currency_id = atoi(row[1]);
entry.amount = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterAltCurrency> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterAltCurrency> 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) {
CharacterAltCurrency entry{};
entry.char_id = atoi(row[0]);
entry.currency_id = atoi(row[1]);
entry.amount = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_CHARACTER_ALT_CURRENCY_REPOSITORY_H
@@ -1,311 +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_CHARACTER_ALTERNATE_ABILITIES_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_ALTERNATE_ABILITIES_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharacterAlternateAbilitiesRepository {
public:
struct CharacterAlternateAbilities {
int id;
int aa_id;
int aa_value;
int charges;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"aa_id",
"aa_value",
"charges",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("character_alternate_abilities");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static CharacterAlternateAbilities NewEntity()
{
CharacterAlternateAbilities entry{};
entry.id = 0;
entry.aa_id = 0;
entry.aa_value = 0;
entry.charges = 0;
return entry;
}
static CharacterAlternateAbilities GetCharacterAlternateAbilitiesEntry(
const std::vector<CharacterAlternateAbilities> &character_alternate_abilitiess,
int character_alternate_abilities_id
)
{
for (auto &character_alternate_abilities : character_alternate_abilitiess) {
if (character_alternate_abilities.id == character_alternate_abilities_id) {
return character_alternate_abilities;
}
}
return NewEntity();
}
static CharacterAlternateAbilities FindOne(
Database& db,
int character_alternate_abilities_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_alternate_abilities_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterAlternateAbilities entry{};
entry.id = atoi(row[0]);
entry.aa_id = atoi(row[1]);
entry.aa_value = atoi(row[2]);
entry.charges = atoi(row[3]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int character_alternate_abilities_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_alternate_abilities_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
CharacterAlternateAbilities character_alternate_abilities_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(character_alternate_abilities_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(character_alternate_abilities_entry.aa_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_alternate_abilities_entry.aa_value));
update_values.push_back(columns[3] + " = " + std::to_string(character_alternate_abilities_entry.charges));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_alternate_abilities_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterAlternateAbilities InsertOne(
Database& db,
CharacterAlternateAbilities character_alternate_abilities_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_alternate_abilities_entry.id));
insert_values.push_back(std::to_string(character_alternate_abilities_entry.aa_id));
insert_values.push_back(std::to_string(character_alternate_abilities_entry.aa_value));
insert_values.push_back(std::to_string(character_alternate_abilities_entry.charges));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_alternate_abilities_entry.id = results.LastInsertedID();
return character_alternate_abilities_entry;
}
character_alternate_abilities_entry = NewEntity();
return character_alternate_abilities_entry;
}
static int InsertMany(
Database& db,
std::vector<CharacterAlternateAbilities> character_alternate_abilities_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_alternate_abilities_entry: character_alternate_abilities_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_alternate_abilities_entry.id));
insert_values.push_back(std::to_string(character_alternate_abilities_entry.aa_id));
insert_values.push_back(std::to_string(character_alternate_abilities_entry.aa_value));
insert_values.push_back(std::to_string(character_alternate_abilities_entry.charges));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterAlternateAbilities> All(Database& db)
{
std::vector<CharacterAlternateAbilities> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterAlternateAbilities entry{};
entry.id = atoi(row[0]);
entry.aa_id = atoi(row[1]);
entry.aa_value = atoi(row[2]);
entry.charges = atoi(row[3]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterAlternateAbilities> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterAlternateAbilities> 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) {
CharacterAlternateAbilities entry{};
entry.id = atoi(row[0]);
entry.aa_id = atoi(row[1]);
entry.aa_value = atoi(row[2]);
entry.charges = atoi(row[3]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_CHARACTER_ALTERNATE_ABILITIES_REPOSITORY_H
@@ -1,302 +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_CHARACTER_AURAS_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_AURAS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharacterAurasRepository {
public:
struct CharacterAuras {
int id;
int slot;
int spell_id;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"slot",
"spell_id",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("character_auras");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static CharacterAuras NewEntity()
{
CharacterAuras entry{};
entry.id = 0;
entry.slot = 0;
entry.spell_id = 0;
return entry;
}
static CharacterAuras GetCharacterAurasEntry(
const std::vector<CharacterAuras> &character_aurass,
int character_auras_id
)
{
for (auto &character_auras : character_aurass) {
if (character_auras.id == character_auras_id) {
return character_auras;
}
}
return NewEntity();
}
static CharacterAuras FindOne(
Database& db,
int character_auras_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_auras_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterAuras entry{};
entry.id = atoi(row[0]);
entry.slot = atoi(row[1]);
entry.spell_id = atoi(row[2]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int character_auras_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_auras_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
CharacterAuras character_auras_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(character_auras_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(character_auras_entry.slot));
update_values.push_back(columns[2] + " = " + std::to_string(character_auras_entry.spell_id));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_auras_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterAuras InsertOne(
Database& db,
CharacterAuras character_auras_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_auras_entry.id));
insert_values.push_back(std::to_string(character_auras_entry.slot));
insert_values.push_back(std::to_string(character_auras_entry.spell_id));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_auras_entry.id = results.LastInsertedID();
return character_auras_entry;
}
character_auras_entry = NewEntity();
return character_auras_entry;
}
static int InsertMany(
Database& db,
std::vector<CharacterAuras> character_auras_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_auras_entry: character_auras_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_auras_entry.id));
insert_values.push_back(std::to_string(character_auras_entry.slot));
insert_values.push_back(std::to_string(character_auras_entry.spell_id));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterAuras> All(Database& db)
{
std::vector<CharacterAuras> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterAuras entry{};
entry.id = atoi(row[0]);
entry.slot = atoi(row[1]);
entry.spell_id = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterAuras> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterAuras> 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) {
CharacterAuras entry{};
entry.id = atoi(row[0]);
entry.slot = atoi(row[1]);
entry.spell_id = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_CHARACTER_AURAS_REPOSITORY_H
@@ -1,329 +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_CHARACTER_BANDOLIER_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_BANDOLIER_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharacterBandolierRepository {
public:
struct CharacterBandolier {
int id;
int bandolier_id;
int bandolier_slot;
int item_id;
int icon;
std::string bandolier_name;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"bandolier_id",
"bandolier_slot",
"item_id",
"icon",
"bandolier_name",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("character_bandolier");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static CharacterBandolier NewEntity()
{
CharacterBandolier entry{};
entry.id = 0;
entry.bandolier_id = 0;
entry.bandolier_slot = 0;
entry.item_id = 0;
entry.icon = 0;
entry.bandolier_name = "0";
return entry;
}
static CharacterBandolier GetCharacterBandolierEntry(
const std::vector<CharacterBandolier> &character_bandoliers,
int character_bandolier_id
)
{
for (auto &character_bandolier : character_bandoliers) {
if (character_bandolier.id == character_bandolier_id) {
return character_bandolier;
}
}
return NewEntity();
}
static CharacterBandolier FindOne(
Database& db,
int character_bandolier_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_bandolier_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterBandolier entry{};
entry.id = atoi(row[0]);
entry.bandolier_id = atoi(row[1]);
entry.bandolier_slot = atoi(row[2]);
entry.item_id = atoi(row[3]);
entry.icon = atoi(row[4]);
entry.bandolier_name = row[5] ? row[5] : "";
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int character_bandolier_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_bandolier_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
CharacterBandolier character_bandolier_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(character_bandolier_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(character_bandolier_entry.bandolier_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_bandolier_entry.bandolier_slot));
update_values.push_back(columns[3] + " = " + std::to_string(character_bandolier_entry.item_id));
update_values.push_back(columns[4] + " = " + std::to_string(character_bandolier_entry.icon));
update_values.push_back(columns[5] + " = '" + EscapeString(character_bandolier_entry.bandolier_name) + "'");
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_bandolier_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterBandolier InsertOne(
Database& db,
CharacterBandolier character_bandolier_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_bandolier_entry.id));
insert_values.push_back(std::to_string(character_bandolier_entry.bandolier_id));
insert_values.push_back(std::to_string(character_bandolier_entry.bandolier_slot));
insert_values.push_back(std::to_string(character_bandolier_entry.item_id));
insert_values.push_back(std::to_string(character_bandolier_entry.icon));
insert_values.push_back("'" + EscapeString(character_bandolier_entry.bandolier_name) + "'");
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_bandolier_entry.id = results.LastInsertedID();
return character_bandolier_entry;
}
character_bandolier_entry = NewEntity();
return character_bandolier_entry;
}
static int InsertMany(
Database& db,
std::vector<CharacterBandolier> character_bandolier_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_bandolier_entry: character_bandolier_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_bandolier_entry.id));
insert_values.push_back(std::to_string(character_bandolier_entry.bandolier_id));
insert_values.push_back(std::to_string(character_bandolier_entry.bandolier_slot));
insert_values.push_back(std::to_string(character_bandolier_entry.item_id));
insert_values.push_back(std::to_string(character_bandolier_entry.icon));
insert_values.push_back("'" + EscapeString(character_bandolier_entry.bandolier_name) + "'");
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterBandolier> All(Database& db)
{
std::vector<CharacterBandolier> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterBandolier entry{};
entry.id = atoi(row[0]);
entry.bandolier_id = atoi(row[1]);
entry.bandolier_slot = atoi(row[2]);
entry.item_id = atoi(row[3]);
entry.icon = atoi(row[4]);
entry.bandolier_name = row[5] ? row[5] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterBandolier> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterBandolier> 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) {
CharacterBandolier entry{};
entry.id = atoi(row[0]);
entry.bandolier_id = atoi(row[1]);
entry.bandolier_slot = atoi(row[2]);
entry.item_id = atoi(row[3]);
entry.icon = atoi(row[4]);
entry.bandolier_name = row[5] ? row[5] : "";
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_CHARACTER_BANDOLIER_REPOSITORY_H
@@ -1,346 +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_CHARACTER_BIND_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_BIND_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharacterBindRepository {
public:
struct CharacterBind {
int id;
int slot;
int zone_id;
int instance_id;
float x;
float y;
float z;
float heading;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"slot",
"zone_id",
"instance_id",
"x",
"y",
"z",
"heading",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("character_bind");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static CharacterBind NewEntity()
{
CharacterBind entry{};
entry.id = 0;
entry.slot = 0;
entry.zone_id = 0;
entry.instance_id = 0;
entry.x = 0;
entry.y = 0;
entry.z = 0;
entry.heading = 0;
return entry;
}
static CharacterBind GetCharacterBindEntry(
const std::vector<CharacterBind> &character_binds,
int character_bind_id
)
{
for (auto &character_bind : character_binds) {
if (character_bind.id == character_bind_id) {
return character_bind;
}
}
return NewEntity();
}
static CharacterBind FindOne(
Database& db,
int character_bind_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_bind_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterBind entry{};
entry.id = atoi(row[0]);
entry.slot = atoi(row[1]);
entry.zone_id = atoi(row[2]);
entry.instance_id = atoi(row[3]);
entry.x = static_cast<float>(atof(row[4]));
entry.y = static_cast<float>(atof(row[5]));
entry.z = static_cast<float>(atof(row[6]));
entry.heading = static_cast<float>(atof(row[7]));
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int character_bind_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_bind_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
CharacterBind character_bind_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[1] + " = " + std::to_string(character_bind_entry.slot));
update_values.push_back(columns[2] + " = " + std::to_string(character_bind_entry.zone_id));
update_values.push_back(columns[3] + " = " + std::to_string(character_bind_entry.instance_id));
update_values.push_back(columns[4] + " = " + std::to_string(character_bind_entry.x));
update_values.push_back(columns[5] + " = " + std::to_string(character_bind_entry.y));
update_values.push_back(columns[6] + " = " + std::to_string(character_bind_entry.z));
update_values.push_back(columns[7] + " = " + std::to_string(character_bind_entry.heading));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_bind_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterBind InsertOne(
Database& db,
CharacterBind character_bind_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_bind_entry.id));
insert_values.push_back(std::to_string(character_bind_entry.slot));
insert_values.push_back(std::to_string(character_bind_entry.zone_id));
insert_values.push_back(std::to_string(character_bind_entry.instance_id));
insert_values.push_back(std::to_string(character_bind_entry.x));
insert_values.push_back(std::to_string(character_bind_entry.y));
insert_values.push_back(std::to_string(character_bind_entry.z));
insert_values.push_back(std::to_string(character_bind_entry.heading));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_bind_entry.id = results.LastInsertedID();
return character_bind_entry;
}
character_bind_entry = NewEntity();
return character_bind_entry;
}
static int InsertMany(
Database& db,
std::vector<CharacterBind> character_bind_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_bind_entry: character_bind_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_bind_entry.id));
insert_values.push_back(std::to_string(character_bind_entry.slot));
insert_values.push_back(std::to_string(character_bind_entry.zone_id));
insert_values.push_back(std::to_string(character_bind_entry.instance_id));
insert_values.push_back(std::to_string(character_bind_entry.x));
insert_values.push_back(std::to_string(character_bind_entry.y));
insert_values.push_back(std::to_string(character_bind_entry.z));
insert_values.push_back(std::to_string(character_bind_entry.heading));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterBind> All(Database& db)
{
std::vector<CharacterBind> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterBind entry{};
entry.id = atoi(row[0]);
entry.slot = atoi(row[1]);
entry.zone_id = atoi(row[2]);
entry.instance_id = atoi(row[3]);
entry.x = static_cast<float>(atof(row[4]));
entry.y = static_cast<float>(atof(row[5]));
entry.z = static_cast<float>(atof(row[6]));
entry.heading = static_cast<float>(atof(row[7]));
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterBind> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterBind> 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) {
CharacterBind entry{};
entry.id = atoi(row[0]);
entry.slot = atoi(row[1]);
entry.zone_id = atoi(row[2]);
entry.instance_id = atoi(row[3]);
entry.x = static_cast<float>(atof(row[4]));
entry.y = static_cast<float>(atof(row[5]));
entry.z = static_cast<float>(atof(row[6]));
entry.heading = static_cast<float>(atof(row[7]));
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_CHARACTER_BIND_REPOSITORY_H
@@ -1,428 +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_CHARACTER_BUFFS_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_BUFFS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharacterBuffsRepository {
public:
struct CharacterBuffs {
int character_id;
int slot_id;
int spell_id;
int caster_level;
std::string caster_name;
int ticsremaining;
int counters;
int numhits;
int melee_rune;
int magic_rune;
int persistent;
int dot_rune;
int caston_x;
int caston_y;
int caston_z;
int ExtraDIChance;
int instrument_mod;
};
static std::string PrimaryKey()
{
return std::string("character_id");
}
static std::vector<std::string> Columns()
{
return {
"character_id",
"slot_id",
"spell_id",
"caster_level",
"caster_name",
"ticsremaining",
"counters",
"numhits",
"melee_rune",
"magic_rune",
"persistent",
"dot_rune",
"caston_x",
"caston_y",
"caston_z",
"ExtraDIChance",
"instrument_mod",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("character_buffs");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static CharacterBuffs NewEntity()
{
CharacterBuffs entry{};
entry.character_id = 0;
entry.slot_id = 0;
entry.spell_id = 0;
entry.caster_level = 0;
entry.caster_name = "";
entry.ticsremaining = 0;
entry.counters = 0;
entry.numhits = 0;
entry.melee_rune = 0;
entry.magic_rune = 0;
entry.persistent = 0;
entry.dot_rune = 0;
entry.caston_x = 0;
entry.caston_y = 0;
entry.caston_z = 0;
entry.ExtraDIChance = 0;
entry.instrument_mod = 10;
return entry;
}
static CharacterBuffs GetCharacterBuffsEntry(
const std::vector<CharacterBuffs> &character_buffss,
int character_buffs_id
)
{
for (auto &character_buffs : character_buffss) {
if (character_buffs.character_id == character_buffs_id) {
return character_buffs;
}
}
return NewEntity();
}
static CharacterBuffs FindOne(
Database& db,
int character_buffs_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_buffs_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterBuffs entry{};
entry.character_id = atoi(row[0]);
entry.slot_id = atoi(row[1]);
entry.spell_id = atoi(row[2]);
entry.caster_level = atoi(row[3]);
entry.caster_name = row[4] ? row[4] : "";
entry.ticsremaining = atoi(row[5]);
entry.counters = atoi(row[6]);
entry.numhits = atoi(row[7]);
entry.melee_rune = atoi(row[8]);
entry.magic_rune = atoi(row[9]);
entry.persistent = atoi(row[10]);
entry.dot_rune = atoi(row[11]);
entry.caston_x = atoi(row[12]);
entry.caston_y = atoi(row[13]);
entry.caston_z = atoi(row[14]);
entry.ExtraDIChance = atoi(row[15]);
entry.instrument_mod = atoi(row[16]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int character_buffs_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_buffs_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
CharacterBuffs character_buffs_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(character_buffs_entry.character_id));
update_values.push_back(columns[1] + " = " + std::to_string(character_buffs_entry.slot_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_buffs_entry.spell_id));
update_values.push_back(columns[3] + " = " + std::to_string(character_buffs_entry.caster_level));
update_values.push_back(columns[4] + " = '" + EscapeString(character_buffs_entry.caster_name) + "'");
update_values.push_back(columns[5] + " = " + std::to_string(character_buffs_entry.ticsremaining));
update_values.push_back(columns[6] + " = " + std::to_string(character_buffs_entry.counters));
update_values.push_back(columns[7] + " = " + std::to_string(character_buffs_entry.numhits));
update_values.push_back(columns[8] + " = " + std::to_string(character_buffs_entry.melee_rune));
update_values.push_back(columns[9] + " = " + std::to_string(character_buffs_entry.magic_rune));
update_values.push_back(columns[10] + " = " + std::to_string(character_buffs_entry.persistent));
update_values.push_back(columns[11] + " = " + std::to_string(character_buffs_entry.dot_rune));
update_values.push_back(columns[12] + " = " + std::to_string(character_buffs_entry.caston_x));
update_values.push_back(columns[13] + " = " + std::to_string(character_buffs_entry.caston_y));
update_values.push_back(columns[14] + " = " + std::to_string(character_buffs_entry.caston_z));
update_values.push_back(columns[15] + " = " + std::to_string(character_buffs_entry.ExtraDIChance));
update_values.push_back(columns[16] + " = " + std::to_string(character_buffs_entry.instrument_mod));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_buffs_entry.character_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterBuffs InsertOne(
Database& db,
CharacterBuffs character_buffs_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_buffs_entry.character_id));
insert_values.push_back(std::to_string(character_buffs_entry.slot_id));
insert_values.push_back(std::to_string(character_buffs_entry.spell_id));
insert_values.push_back(std::to_string(character_buffs_entry.caster_level));
insert_values.push_back("'" + EscapeString(character_buffs_entry.caster_name) + "'");
insert_values.push_back(std::to_string(character_buffs_entry.ticsremaining));
insert_values.push_back(std::to_string(character_buffs_entry.counters));
insert_values.push_back(std::to_string(character_buffs_entry.numhits));
insert_values.push_back(std::to_string(character_buffs_entry.melee_rune));
insert_values.push_back(std::to_string(character_buffs_entry.magic_rune));
insert_values.push_back(std::to_string(character_buffs_entry.persistent));
insert_values.push_back(std::to_string(character_buffs_entry.dot_rune));
insert_values.push_back(std::to_string(character_buffs_entry.caston_x));
insert_values.push_back(std::to_string(character_buffs_entry.caston_y));
insert_values.push_back(std::to_string(character_buffs_entry.caston_z));
insert_values.push_back(std::to_string(character_buffs_entry.ExtraDIChance));
insert_values.push_back(std::to_string(character_buffs_entry.instrument_mod));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_buffs_entry.character_id = results.LastInsertedID();
return character_buffs_entry;
}
character_buffs_entry = NewEntity();
return character_buffs_entry;
}
static int InsertMany(
Database& db,
std::vector<CharacterBuffs> character_buffs_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_buffs_entry: character_buffs_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_buffs_entry.character_id));
insert_values.push_back(std::to_string(character_buffs_entry.slot_id));
insert_values.push_back(std::to_string(character_buffs_entry.spell_id));
insert_values.push_back(std::to_string(character_buffs_entry.caster_level));
insert_values.push_back("'" + EscapeString(character_buffs_entry.caster_name) + "'");
insert_values.push_back(std::to_string(character_buffs_entry.ticsremaining));
insert_values.push_back(std::to_string(character_buffs_entry.counters));
insert_values.push_back(std::to_string(character_buffs_entry.numhits));
insert_values.push_back(std::to_string(character_buffs_entry.melee_rune));
insert_values.push_back(std::to_string(character_buffs_entry.magic_rune));
insert_values.push_back(std::to_string(character_buffs_entry.persistent));
insert_values.push_back(std::to_string(character_buffs_entry.dot_rune));
insert_values.push_back(std::to_string(character_buffs_entry.caston_x));
insert_values.push_back(std::to_string(character_buffs_entry.caston_y));
insert_values.push_back(std::to_string(character_buffs_entry.caston_z));
insert_values.push_back(std::to_string(character_buffs_entry.ExtraDIChance));
insert_values.push_back(std::to_string(character_buffs_entry.instrument_mod));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterBuffs> All(Database& db)
{
std::vector<CharacterBuffs> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterBuffs entry{};
entry.character_id = atoi(row[0]);
entry.slot_id = atoi(row[1]);
entry.spell_id = atoi(row[2]);
entry.caster_level = atoi(row[3]);
entry.caster_name = row[4] ? row[4] : "";
entry.ticsremaining = atoi(row[5]);
entry.counters = atoi(row[6]);
entry.numhits = atoi(row[7]);
entry.melee_rune = atoi(row[8]);
entry.magic_rune = atoi(row[9]);
entry.persistent = atoi(row[10]);
entry.dot_rune = atoi(row[11]);
entry.caston_x = atoi(row[12]);
entry.caston_y = atoi(row[13]);
entry.caston_z = atoi(row[14]);
entry.ExtraDIChance = atoi(row[15]);
entry.instrument_mod = atoi(row[16]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterBuffs> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterBuffs> 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) {
CharacterBuffs entry{};
entry.character_id = atoi(row[0]);
entry.slot_id = atoi(row[1]);
entry.spell_id = atoi(row[2]);
entry.caster_level = atoi(row[3]);
entry.caster_name = row[4] ? row[4] : "";
entry.ticsremaining = atoi(row[5]);
entry.counters = atoi(row[6]);
entry.numhits = atoi(row[7]);
entry.melee_rune = atoi(row[8]);
entry.magic_rune = atoi(row[9]);
entry.persistent = atoi(row[10]);
entry.dot_rune = atoi(row[11]);
entry.caston_x = atoi(row[12]);
entry.caston_y = atoi(row[13]);
entry.caston_z = atoi(row[14]);
entry.ExtraDIChance = atoi(row[15]);
entry.instrument_mod = atoi(row[16]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_CHARACTER_BUFFS_REPOSITORY_H
@@ -1,374 +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_CHARACTER_CORPSE_ITEMS_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_CORPSE_ITEMS_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharacterCorpseItemsRepository {
public:
struct CharacterCorpseItems {
int corpse_id;
int equip_slot;
int item_id;
int charges;
int aug_1;
int aug_2;
int aug_3;
int aug_4;
int aug_5;
int aug_6;
int attuned;
};
static std::string PrimaryKey()
{
return std::string("corpse_id");
}
static std::vector<std::string> Columns()
{
return {
"corpse_id",
"equip_slot",
"item_id",
"charges",
"aug_1",
"aug_2",
"aug_3",
"aug_4",
"aug_5",
"aug_6",
"attuned",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("character_corpse_items");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static CharacterCorpseItems NewEntity()
{
CharacterCorpseItems entry{};
entry.corpse_id = 0;
entry.equip_slot = 0;
entry.item_id = 0;
entry.charges = 0;
entry.aug_1 = 0;
entry.aug_2 = 0;
entry.aug_3 = 0;
entry.aug_4 = 0;
entry.aug_5 = 0;
entry.aug_6 = 0;
entry.attuned = 0;
return entry;
}
static CharacterCorpseItems GetCharacterCorpseItemsEntry(
const std::vector<CharacterCorpseItems> &character_corpse_itemss,
int character_corpse_items_id
)
{
for (auto &character_corpse_items : character_corpse_itemss) {
if (character_corpse_items.corpse_id == character_corpse_items_id) {
return character_corpse_items;
}
}
return NewEntity();
}
static CharacterCorpseItems FindOne(
Database& db,
int character_corpse_items_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_corpse_items_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterCorpseItems entry{};
entry.corpse_id = atoi(row[0]);
entry.equip_slot = atoi(row[1]);
entry.item_id = atoi(row[2]);
entry.charges = atoi(row[3]);
entry.aug_1 = atoi(row[4]);
entry.aug_2 = atoi(row[5]);
entry.aug_3 = atoi(row[6]);
entry.aug_4 = atoi(row[7]);
entry.aug_5 = atoi(row[8]);
entry.aug_6 = atoi(row[9]);
entry.attuned = atoi(row[10]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int character_corpse_items_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_corpse_items_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
CharacterCorpseItems character_corpse_items_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(character_corpse_items_entry.corpse_id));
update_values.push_back(columns[1] + " = " + std::to_string(character_corpse_items_entry.equip_slot));
update_values.push_back(columns[2] + " = " + std::to_string(character_corpse_items_entry.item_id));
update_values.push_back(columns[3] + " = " + std::to_string(character_corpse_items_entry.charges));
update_values.push_back(columns[4] + " = " + std::to_string(character_corpse_items_entry.aug_1));
update_values.push_back(columns[5] + " = " + std::to_string(character_corpse_items_entry.aug_2));
update_values.push_back(columns[6] + " = " + std::to_string(character_corpse_items_entry.aug_3));
update_values.push_back(columns[7] + " = " + std::to_string(character_corpse_items_entry.aug_4));
update_values.push_back(columns[8] + " = " + std::to_string(character_corpse_items_entry.aug_5));
update_values.push_back(columns[9] + " = " + std::to_string(character_corpse_items_entry.aug_6));
update_values.push_back(columns[10] + " = " + std::to_string(character_corpse_items_entry.attuned));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_corpse_items_entry.corpse_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterCorpseItems InsertOne(
Database& db,
CharacterCorpseItems character_corpse_items_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_corpse_items_entry.corpse_id));
insert_values.push_back(std::to_string(character_corpse_items_entry.equip_slot));
insert_values.push_back(std::to_string(character_corpse_items_entry.item_id));
insert_values.push_back(std::to_string(character_corpse_items_entry.charges));
insert_values.push_back(std::to_string(character_corpse_items_entry.aug_1));
insert_values.push_back(std::to_string(character_corpse_items_entry.aug_2));
insert_values.push_back(std::to_string(character_corpse_items_entry.aug_3));
insert_values.push_back(std::to_string(character_corpse_items_entry.aug_4));
insert_values.push_back(std::to_string(character_corpse_items_entry.aug_5));
insert_values.push_back(std::to_string(character_corpse_items_entry.aug_6));
insert_values.push_back(std::to_string(character_corpse_items_entry.attuned));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_corpse_items_entry.corpse_id = results.LastInsertedID();
return character_corpse_items_entry;
}
character_corpse_items_entry = NewEntity();
return character_corpse_items_entry;
}
static int InsertMany(
Database& db,
std::vector<CharacterCorpseItems> character_corpse_items_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_corpse_items_entry: character_corpse_items_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_corpse_items_entry.corpse_id));
insert_values.push_back(std::to_string(character_corpse_items_entry.equip_slot));
insert_values.push_back(std::to_string(character_corpse_items_entry.item_id));
insert_values.push_back(std::to_string(character_corpse_items_entry.charges));
insert_values.push_back(std::to_string(character_corpse_items_entry.aug_1));
insert_values.push_back(std::to_string(character_corpse_items_entry.aug_2));
insert_values.push_back(std::to_string(character_corpse_items_entry.aug_3));
insert_values.push_back(std::to_string(character_corpse_items_entry.aug_4));
insert_values.push_back(std::to_string(character_corpse_items_entry.aug_5));
insert_values.push_back(std::to_string(character_corpse_items_entry.aug_6));
insert_values.push_back(std::to_string(character_corpse_items_entry.attuned));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterCorpseItems> All(Database& db)
{
std::vector<CharacterCorpseItems> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterCorpseItems entry{};
entry.corpse_id = atoi(row[0]);
entry.equip_slot = atoi(row[1]);
entry.item_id = atoi(row[2]);
entry.charges = atoi(row[3]);
entry.aug_1 = atoi(row[4]);
entry.aug_2 = atoi(row[5]);
entry.aug_3 = atoi(row[6]);
entry.aug_4 = atoi(row[7]);
entry.aug_5 = atoi(row[8]);
entry.aug_6 = atoi(row[9]);
entry.attuned = atoi(row[10]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterCorpseItems> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterCorpseItems> 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) {
CharacterCorpseItems entry{};
entry.corpse_id = atoi(row[0]);
entry.equip_slot = atoi(row[1]);
entry.item_id = atoi(row[2]);
entry.charges = atoi(row[3]);
entry.aug_1 = atoi(row[4]);
entry.aug_2 = atoi(row[5]);
entry.aug_3 = atoi(row[6]);
entry.aug_4 = atoi(row[7]);
entry.aug_5 = atoi(row[8]);
entry.aug_6 = atoi(row[9]);
entry.attuned = atoi(row[10]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_CHARACTER_CORPSE_ITEMS_REPOSITORY_H
@@ -1,697 +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_CHARACTER_CORPSES_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_CORPSES_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharacterCorpsesRepository {
public:
struct CharacterCorpses {
int id;
int charid;
std::string charname;
int zone_id;
int instance_id;
float x;
float y;
float z;
float heading;
std::string time_of_death;
int guild_consent_id;
int is_rezzed;
int is_buried;
int was_at_graveyard;
int is_locked;
int exp;
int size;
int level;
int race;
int gender;
int class;
int deity;
int texture;
int helm_texture;
int copper;
int silver;
int gold;
int platinum;
int hair_color;
int beard_color;
int eye_color_1;
int eye_color_2;
int hair_style;
int face;
int beard;
int drakkin_heritage;
int drakkin_tattoo;
int drakkin_details;
int wc_1;
int wc_2;
int wc_3;
int wc_4;
int wc_5;
int wc_6;
int wc_7;
int wc_8;
int wc_9;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"charid",
"charname",
"zone_id",
"instance_id",
"x",
"y",
"z",
"heading",
"time_of_death",
"guild_consent_id",
"is_rezzed",
"is_buried",
"was_at_graveyard",
"is_locked",
"exp",
"size",
"level",
"race",
"gender",
"class",
"deity",
"texture",
"helm_texture",
"copper",
"silver",
"gold",
"platinum",
"hair_color",
"beard_color",
"eye_color_1",
"eye_color_2",
"hair_style",
"face",
"beard",
"drakkin_heritage",
"drakkin_tattoo",
"drakkin_details",
"wc_1",
"wc_2",
"wc_3",
"wc_4",
"wc_5",
"wc_6",
"wc_7",
"wc_8",
"wc_9",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("character_corpses");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static CharacterCorpses NewEntity()
{
CharacterCorpses entry{};
entry.id = 0;
entry.charid = 0;
entry.charname = "";
entry.zone_id = 0;
entry.instance_id = 0;
entry.x = 0;
entry.y = 0;
entry.z = 0;
entry.heading = 0;
entry.time_of_death = "0000-00-00 00:00:00";
entry.guild_consent_id = 0;
entry.is_rezzed = 0;
entry.is_buried = 0;
entry.was_at_graveyard = 0;
entry.is_locked = 0;
entry.exp = 0;
entry.size = 0;
entry.level = 0;
entry.race = 0;
entry.gender = 0;
entry.class = 0;
entry.deity = 0;
entry.texture = 0;
entry.helm_texture = 0;
entry.copper = 0;
entry.silver = 0;
entry.gold = 0;
entry.platinum = 0;
entry.hair_color = 0;
entry.beard_color = 0;
entry.eye_color_1 = 0;
entry.eye_color_2 = 0;
entry.hair_style = 0;
entry.face = 0;
entry.beard = 0;
entry.drakkin_heritage = 0;
entry.drakkin_tattoo = 0;
entry.drakkin_details = 0;
entry.wc_1 = 0;
entry.wc_2 = 0;
entry.wc_3 = 0;
entry.wc_4 = 0;
entry.wc_5 = 0;
entry.wc_6 = 0;
entry.wc_7 = 0;
entry.wc_8 = 0;
entry.wc_9 = 0;
return entry;
}
static CharacterCorpses GetCharacterCorpsesEntry(
const std::vector<CharacterCorpses> &character_corpsess,
int character_corpses_id
)
{
for (auto &character_corpses : character_corpsess) {
if (character_corpses.id == character_corpses_id) {
return character_corpses;
}
}
return NewEntity();
}
static CharacterCorpses FindOne(
Database& db,
int character_corpses_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_corpses_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterCorpses entry{};
entry.id = atoi(row[0]);
entry.charid = atoi(row[1]);
entry.charname = row[2] ? row[2] : "";
entry.zone_id = atoi(row[3]);
entry.instance_id = atoi(row[4]);
entry.x = static_cast<float>(atof(row[5]));
entry.y = static_cast<float>(atof(row[6]));
entry.z = static_cast<float>(atof(row[7]));
entry.heading = static_cast<float>(atof(row[8]));
entry.time_of_death = row[9] ? row[9] : "";
entry.guild_consent_id = atoi(row[10]);
entry.is_rezzed = atoi(row[11]);
entry.is_buried = atoi(row[12]);
entry.was_at_graveyard = atoi(row[13]);
entry.is_locked = atoi(row[14]);
entry.exp = atoi(row[15]);
entry.size = atoi(row[16]);
entry.level = atoi(row[17]);
entry.race = atoi(row[18]);
entry.gender = atoi(row[19]);
entry.class = atoi(row[20]);
entry.deity = atoi(row[21]);
entry.texture = atoi(row[22]);
entry.helm_texture = atoi(row[23]);
entry.copper = atoi(row[24]);
entry.silver = atoi(row[25]);
entry.gold = atoi(row[26]);
entry.platinum = atoi(row[27]);
entry.hair_color = atoi(row[28]);
entry.beard_color = atoi(row[29]);
entry.eye_color_1 = atoi(row[30]);
entry.eye_color_2 = atoi(row[31]);
entry.hair_style = atoi(row[32]);
entry.face = atoi(row[33]);
entry.beard = atoi(row[34]);
entry.drakkin_heritage = atoi(row[35]);
entry.drakkin_tattoo = atoi(row[36]);
entry.drakkin_details = atoi(row[37]);
entry.wc_1 = atoi(row[38]);
entry.wc_2 = atoi(row[39]);
entry.wc_3 = atoi(row[40]);
entry.wc_4 = atoi(row[41]);
entry.wc_5 = atoi(row[42]);
entry.wc_6 = atoi(row[43]);
entry.wc_7 = atoi(row[44]);
entry.wc_8 = atoi(row[45]);
entry.wc_9 = atoi(row[46]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int character_corpses_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_corpses_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
CharacterCorpses character_corpses_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[1] + " = " + std::to_string(character_corpses_entry.charid));
update_values.push_back(columns[2] + " = '" + EscapeString(character_corpses_entry.charname) + "'");
update_values.push_back(columns[3] + " = " + std::to_string(character_corpses_entry.zone_id));
update_values.push_back(columns[4] + " = " + std::to_string(character_corpses_entry.instance_id));
update_values.push_back(columns[5] + " = " + std::to_string(character_corpses_entry.x));
update_values.push_back(columns[6] + " = " + std::to_string(character_corpses_entry.y));
update_values.push_back(columns[7] + " = " + std::to_string(character_corpses_entry.z));
update_values.push_back(columns[8] + " = " + std::to_string(character_corpses_entry.heading));
update_values.push_back(columns[9] + " = '" + EscapeString(character_corpses_entry.time_of_death) + "'");
update_values.push_back(columns[10] + " = " + std::to_string(character_corpses_entry.guild_consent_id));
update_values.push_back(columns[11] + " = " + std::to_string(character_corpses_entry.is_rezzed));
update_values.push_back(columns[12] + " = " + std::to_string(character_corpses_entry.is_buried));
update_values.push_back(columns[13] + " = " + std::to_string(character_corpses_entry.was_at_graveyard));
update_values.push_back(columns[14] + " = " + std::to_string(character_corpses_entry.is_locked));
update_values.push_back(columns[15] + " = " + std::to_string(character_corpses_entry.exp));
update_values.push_back(columns[16] + " = " + std::to_string(character_corpses_entry.size));
update_values.push_back(columns[17] + " = " + std::to_string(character_corpses_entry.level));
update_values.push_back(columns[18] + " = " + std::to_string(character_corpses_entry.race));
update_values.push_back(columns[19] + " = " + std::to_string(character_corpses_entry.gender));
update_values.push_back(columns[20] + " = " + std::to_string(character_corpses_entry.class));
update_values.push_back(columns[21] + " = " + std::to_string(character_corpses_entry.deity));
update_values.push_back(columns[22] + " = " + std::to_string(character_corpses_entry.texture));
update_values.push_back(columns[23] + " = " + std::to_string(character_corpses_entry.helm_texture));
update_values.push_back(columns[24] + " = " + std::to_string(character_corpses_entry.copper));
update_values.push_back(columns[25] + " = " + std::to_string(character_corpses_entry.silver));
update_values.push_back(columns[26] + " = " + std::to_string(character_corpses_entry.gold));
update_values.push_back(columns[27] + " = " + std::to_string(character_corpses_entry.platinum));
update_values.push_back(columns[28] + " = " + std::to_string(character_corpses_entry.hair_color));
update_values.push_back(columns[29] + " = " + std::to_string(character_corpses_entry.beard_color));
update_values.push_back(columns[30] + " = " + std::to_string(character_corpses_entry.eye_color_1));
update_values.push_back(columns[31] + " = " + std::to_string(character_corpses_entry.eye_color_2));
update_values.push_back(columns[32] + " = " + std::to_string(character_corpses_entry.hair_style));
update_values.push_back(columns[33] + " = " + std::to_string(character_corpses_entry.face));
update_values.push_back(columns[34] + " = " + std::to_string(character_corpses_entry.beard));
update_values.push_back(columns[35] + " = " + std::to_string(character_corpses_entry.drakkin_heritage));
update_values.push_back(columns[36] + " = " + std::to_string(character_corpses_entry.drakkin_tattoo));
update_values.push_back(columns[37] + " = " + std::to_string(character_corpses_entry.drakkin_details));
update_values.push_back(columns[38] + " = " + std::to_string(character_corpses_entry.wc_1));
update_values.push_back(columns[39] + " = " + std::to_string(character_corpses_entry.wc_2));
update_values.push_back(columns[40] + " = " + std::to_string(character_corpses_entry.wc_3));
update_values.push_back(columns[41] + " = " + std::to_string(character_corpses_entry.wc_4));
update_values.push_back(columns[42] + " = " + std::to_string(character_corpses_entry.wc_5));
update_values.push_back(columns[43] + " = " + std::to_string(character_corpses_entry.wc_6));
update_values.push_back(columns[44] + " = " + std::to_string(character_corpses_entry.wc_7));
update_values.push_back(columns[45] + " = " + std::to_string(character_corpses_entry.wc_8));
update_values.push_back(columns[46] + " = " + std::to_string(character_corpses_entry.wc_9));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_corpses_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterCorpses InsertOne(
Database& db,
CharacterCorpses character_corpses_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_corpses_entry.id));
insert_values.push_back(std::to_string(character_corpses_entry.charid));
insert_values.push_back("'" + EscapeString(character_corpses_entry.charname) + "'");
insert_values.push_back(std::to_string(character_corpses_entry.zone_id));
insert_values.push_back(std::to_string(character_corpses_entry.instance_id));
insert_values.push_back(std::to_string(character_corpses_entry.x));
insert_values.push_back(std::to_string(character_corpses_entry.y));
insert_values.push_back(std::to_string(character_corpses_entry.z));
insert_values.push_back(std::to_string(character_corpses_entry.heading));
insert_values.push_back("'" + EscapeString(character_corpses_entry.time_of_death) + "'");
insert_values.push_back(std::to_string(character_corpses_entry.guild_consent_id));
insert_values.push_back(std::to_string(character_corpses_entry.is_rezzed));
insert_values.push_back(std::to_string(character_corpses_entry.is_buried));
insert_values.push_back(std::to_string(character_corpses_entry.was_at_graveyard));
insert_values.push_back(std::to_string(character_corpses_entry.is_locked));
insert_values.push_back(std::to_string(character_corpses_entry.exp));
insert_values.push_back(std::to_string(character_corpses_entry.size));
insert_values.push_back(std::to_string(character_corpses_entry.level));
insert_values.push_back(std::to_string(character_corpses_entry.race));
insert_values.push_back(std::to_string(character_corpses_entry.gender));
insert_values.push_back(std::to_string(character_corpses_entry.class));
insert_values.push_back(std::to_string(character_corpses_entry.deity));
insert_values.push_back(std::to_string(character_corpses_entry.texture));
insert_values.push_back(std::to_string(character_corpses_entry.helm_texture));
insert_values.push_back(std::to_string(character_corpses_entry.copper));
insert_values.push_back(std::to_string(character_corpses_entry.silver));
insert_values.push_back(std::to_string(character_corpses_entry.gold));
insert_values.push_back(std::to_string(character_corpses_entry.platinum));
insert_values.push_back(std::to_string(character_corpses_entry.hair_color));
insert_values.push_back(std::to_string(character_corpses_entry.beard_color));
insert_values.push_back(std::to_string(character_corpses_entry.eye_color_1));
insert_values.push_back(std::to_string(character_corpses_entry.eye_color_2));
insert_values.push_back(std::to_string(character_corpses_entry.hair_style));
insert_values.push_back(std::to_string(character_corpses_entry.face));
insert_values.push_back(std::to_string(character_corpses_entry.beard));
insert_values.push_back(std::to_string(character_corpses_entry.drakkin_heritage));
insert_values.push_back(std::to_string(character_corpses_entry.drakkin_tattoo));
insert_values.push_back(std::to_string(character_corpses_entry.drakkin_details));
insert_values.push_back(std::to_string(character_corpses_entry.wc_1));
insert_values.push_back(std::to_string(character_corpses_entry.wc_2));
insert_values.push_back(std::to_string(character_corpses_entry.wc_3));
insert_values.push_back(std::to_string(character_corpses_entry.wc_4));
insert_values.push_back(std::to_string(character_corpses_entry.wc_5));
insert_values.push_back(std::to_string(character_corpses_entry.wc_6));
insert_values.push_back(std::to_string(character_corpses_entry.wc_7));
insert_values.push_back(std::to_string(character_corpses_entry.wc_8));
insert_values.push_back(std::to_string(character_corpses_entry.wc_9));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_corpses_entry.id = results.LastInsertedID();
return character_corpses_entry;
}
character_corpses_entry = NewEntity();
return character_corpses_entry;
}
static int InsertMany(
Database& db,
std::vector<CharacterCorpses> character_corpses_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_corpses_entry: character_corpses_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_corpses_entry.id));
insert_values.push_back(std::to_string(character_corpses_entry.charid));
insert_values.push_back("'" + EscapeString(character_corpses_entry.charname) + "'");
insert_values.push_back(std::to_string(character_corpses_entry.zone_id));
insert_values.push_back(std::to_string(character_corpses_entry.instance_id));
insert_values.push_back(std::to_string(character_corpses_entry.x));
insert_values.push_back(std::to_string(character_corpses_entry.y));
insert_values.push_back(std::to_string(character_corpses_entry.z));
insert_values.push_back(std::to_string(character_corpses_entry.heading));
insert_values.push_back("'" + EscapeString(character_corpses_entry.time_of_death) + "'");
insert_values.push_back(std::to_string(character_corpses_entry.guild_consent_id));
insert_values.push_back(std::to_string(character_corpses_entry.is_rezzed));
insert_values.push_back(std::to_string(character_corpses_entry.is_buried));
insert_values.push_back(std::to_string(character_corpses_entry.was_at_graveyard));
insert_values.push_back(std::to_string(character_corpses_entry.is_locked));
insert_values.push_back(std::to_string(character_corpses_entry.exp));
insert_values.push_back(std::to_string(character_corpses_entry.size));
insert_values.push_back(std::to_string(character_corpses_entry.level));
insert_values.push_back(std::to_string(character_corpses_entry.race));
insert_values.push_back(std::to_string(character_corpses_entry.gender));
insert_values.push_back(std::to_string(character_corpses_entry.class));
insert_values.push_back(std::to_string(character_corpses_entry.deity));
insert_values.push_back(std::to_string(character_corpses_entry.texture));
insert_values.push_back(std::to_string(character_corpses_entry.helm_texture));
insert_values.push_back(std::to_string(character_corpses_entry.copper));
insert_values.push_back(std::to_string(character_corpses_entry.silver));
insert_values.push_back(std::to_string(character_corpses_entry.gold));
insert_values.push_back(std::to_string(character_corpses_entry.platinum));
insert_values.push_back(std::to_string(character_corpses_entry.hair_color));
insert_values.push_back(std::to_string(character_corpses_entry.beard_color));
insert_values.push_back(std::to_string(character_corpses_entry.eye_color_1));
insert_values.push_back(std::to_string(character_corpses_entry.eye_color_2));
insert_values.push_back(std::to_string(character_corpses_entry.hair_style));
insert_values.push_back(std::to_string(character_corpses_entry.face));
insert_values.push_back(std::to_string(character_corpses_entry.beard));
insert_values.push_back(std::to_string(character_corpses_entry.drakkin_heritage));
insert_values.push_back(std::to_string(character_corpses_entry.drakkin_tattoo));
insert_values.push_back(std::to_string(character_corpses_entry.drakkin_details));
insert_values.push_back(std::to_string(character_corpses_entry.wc_1));
insert_values.push_back(std::to_string(character_corpses_entry.wc_2));
insert_values.push_back(std::to_string(character_corpses_entry.wc_3));
insert_values.push_back(std::to_string(character_corpses_entry.wc_4));
insert_values.push_back(std::to_string(character_corpses_entry.wc_5));
insert_values.push_back(std::to_string(character_corpses_entry.wc_6));
insert_values.push_back(std::to_string(character_corpses_entry.wc_7));
insert_values.push_back(std::to_string(character_corpses_entry.wc_8));
insert_values.push_back(std::to_string(character_corpses_entry.wc_9));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterCorpses> All(Database& db)
{
std::vector<CharacterCorpses> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterCorpses entry{};
entry.id = atoi(row[0]);
entry.charid = atoi(row[1]);
entry.charname = row[2] ? row[2] : "";
entry.zone_id = atoi(row[3]);
entry.instance_id = atoi(row[4]);
entry.x = static_cast<float>(atof(row[5]));
entry.y = static_cast<float>(atof(row[6]));
entry.z = static_cast<float>(atof(row[7]));
entry.heading = static_cast<float>(atof(row[8]));
entry.time_of_death = row[9] ? row[9] : "";
entry.guild_consent_id = atoi(row[10]);
entry.is_rezzed = atoi(row[11]);
entry.is_buried = atoi(row[12]);
entry.was_at_graveyard = atoi(row[13]);
entry.is_locked = atoi(row[14]);
entry.exp = atoi(row[15]);
entry.size = atoi(row[16]);
entry.level = atoi(row[17]);
entry.race = atoi(row[18]);
entry.gender = atoi(row[19]);
entry.class = atoi(row[20]);
entry.deity = atoi(row[21]);
entry.texture = atoi(row[22]);
entry.helm_texture = atoi(row[23]);
entry.copper = atoi(row[24]);
entry.silver = atoi(row[25]);
entry.gold = atoi(row[26]);
entry.platinum = atoi(row[27]);
entry.hair_color = atoi(row[28]);
entry.beard_color = atoi(row[29]);
entry.eye_color_1 = atoi(row[30]);
entry.eye_color_2 = atoi(row[31]);
entry.hair_style = atoi(row[32]);
entry.face = atoi(row[33]);
entry.beard = atoi(row[34]);
entry.drakkin_heritage = atoi(row[35]);
entry.drakkin_tattoo = atoi(row[36]);
entry.drakkin_details = atoi(row[37]);
entry.wc_1 = atoi(row[38]);
entry.wc_2 = atoi(row[39]);
entry.wc_3 = atoi(row[40]);
entry.wc_4 = atoi(row[41]);
entry.wc_5 = atoi(row[42]);
entry.wc_6 = atoi(row[43]);
entry.wc_7 = atoi(row[44]);
entry.wc_8 = atoi(row[45]);
entry.wc_9 = atoi(row[46]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterCorpses> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterCorpses> 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) {
CharacterCorpses entry{};
entry.id = atoi(row[0]);
entry.charid = atoi(row[1]);
entry.charname = row[2] ? row[2] : "";
entry.zone_id = atoi(row[3]);
entry.instance_id = atoi(row[4]);
entry.x = static_cast<float>(atof(row[5]));
entry.y = static_cast<float>(atof(row[6]));
entry.z = static_cast<float>(atof(row[7]));
entry.heading = static_cast<float>(atof(row[8]));
entry.time_of_death = row[9] ? row[9] : "";
entry.guild_consent_id = atoi(row[10]);
entry.is_rezzed = atoi(row[11]);
entry.is_buried = atoi(row[12]);
entry.was_at_graveyard = atoi(row[13]);
entry.is_locked = atoi(row[14]);
entry.exp = atoi(row[15]);
entry.size = atoi(row[16]);
entry.level = atoi(row[17]);
entry.race = atoi(row[18]);
entry.gender = atoi(row[19]);
entry.class = atoi(row[20]);
entry.deity = atoi(row[21]);
entry.texture = atoi(row[22]);
entry.helm_texture = atoi(row[23]);
entry.copper = atoi(row[24]);
entry.silver = atoi(row[25]);
entry.gold = atoi(row[26]);
entry.platinum = atoi(row[27]);
entry.hair_color = atoi(row[28]);
entry.beard_color = atoi(row[29]);
entry.eye_color_1 = atoi(row[30]);
entry.eye_color_2 = atoi(row[31]);
entry.hair_style = atoi(row[32]);
entry.face = atoi(row[33]);
entry.beard = atoi(row[34]);
entry.drakkin_heritage = atoi(row[35]);
entry.drakkin_tattoo = atoi(row[36]);
entry.drakkin_details = atoi(row[37]);
entry.wc_1 = atoi(row[38]);
entry.wc_2 = atoi(row[39]);
entry.wc_3 = atoi(row[40]);
entry.wc_4 = atoi(row[41]);
entry.wc_5 = atoi(row[42]);
entry.wc_6 = atoi(row[43]);
entry.wc_7 = atoi(row[44]);
entry.wc_8 = atoi(row[45]);
entry.wc_9 = atoi(row[46]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_CHARACTER_CORPSES_REPOSITORY_H
@@ -1,428 +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_CHARACTER_CURRENCY_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_CURRENCY_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharacterCurrencyRepository {
public:
struct CharacterCurrency {
int id;
int platinum;
int gold;
int silver;
int copper;
int platinum_bank;
int gold_bank;
int silver_bank;
int copper_bank;
int platinum_cursor;
int gold_cursor;
int silver_cursor;
int copper_cursor;
int radiant_crystals;
int career_radiant_crystals;
int ebon_crystals;
int career_ebon_crystals;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"platinum",
"gold",
"silver",
"copper",
"platinum_bank",
"gold_bank",
"silver_bank",
"copper_bank",
"platinum_cursor",
"gold_cursor",
"silver_cursor",
"copper_cursor",
"radiant_crystals",
"career_radiant_crystals",
"ebon_crystals",
"career_ebon_crystals",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("character_currency");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static CharacterCurrency NewEntity()
{
CharacterCurrency entry{};
entry.id = 0;
entry.platinum = 0;
entry.gold = 0;
entry.silver = 0;
entry.copper = 0;
entry.platinum_bank = 0;
entry.gold_bank = 0;
entry.silver_bank = 0;
entry.copper_bank = 0;
entry.platinum_cursor = 0;
entry.gold_cursor = 0;
entry.silver_cursor = 0;
entry.copper_cursor = 0;
entry.radiant_crystals = 0;
entry.career_radiant_crystals = 0;
entry.ebon_crystals = 0;
entry.career_ebon_crystals = 0;
return entry;
}
static CharacterCurrency GetCharacterCurrencyEntry(
const std::vector<CharacterCurrency> &character_currencys,
int character_currency_id
)
{
for (auto &character_currency : character_currencys) {
if (character_currency.id == character_currency_id) {
return character_currency;
}
}
return NewEntity();
}
static CharacterCurrency FindOne(
Database& db,
int character_currency_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_currency_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterCurrency entry{};
entry.id = atoi(row[0]);
entry.platinum = atoi(row[1]);
entry.gold = atoi(row[2]);
entry.silver = atoi(row[3]);
entry.copper = atoi(row[4]);
entry.platinum_bank = atoi(row[5]);
entry.gold_bank = atoi(row[6]);
entry.silver_bank = atoi(row[7]);
entry.copper_bank = atoi(row[8]);
entry.platinum_cursor = atoi(row[9]);
entry.gold_cursor = atoi(row[10]);
entry.silver_cursor = atoi(row[11]);
entry.copper_cursor = atoi(row[12]);
entry.radiant_crystals = atoi(row[13]);
entry.career_radiant_crystals = atoi(row[14]);
entry.ebon_crystals = atoi(row[15]);
entry.career_ebon_crystals = atoi(row[16]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int character_currency_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_currency_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
CharacterCurrency character_currency_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(character_currency_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(character_currency_entry.platinum));
update_values.push_back(columns[2] + " = " + std::to_string(character_currency_entry.gold));
update_values.push_back(columns[3] + " = " + std::to_string(character_currency_entry.silver));
update_values.push_back(columns[4] + " = " + std::to_string(character_currency_entry.copper));
update_values.push_back(columns[5] + " = " + std::to_string(character_currency_entry.platinum_bank));
update_values.push_back(columns[6] + " = " + std::to_string(character_currency_entry.gold_bank));
update_values.push_back(columns[7] + " = " + std::to_string(character_currency_entry.silver_bank));
update_values.push_back(columns[8] + " = " + std::to_string(character_currency_entry.copper_bank));
update_values.push_back(columns[9] + " = " + std::to_string(character_currency_entry.platinum_cursor));
update_values.push_back(columns[10] + " = " + std::to_string(character_currency_entry.gold_cursor));
update_values.push_back(columns[11] + " = " + std::to_string(character_currency_entry.silver_cursor));
update_values.push_back(columns[12] + " = " + std::to_string(character_currency_entry.copper_cursor));
update_values.push_back(columns[13] + " = " + std::to_string(character_currency_entry.radiant_crystals));
update_values.push_back(columns[14] + " = " + std::to_string(character_currency_entry.career_radiant_crystals));
update_values.push_back(columns[15] + " = " + std::to_string(character_currency_entry.ebon_crystals));
update_values.push_back(columns[16] + " = " + std::to_string(character_currency_entry.career_ebon_crystals));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_currency_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterCurrency InsertOne(
Database& db,
CharacterCurrency character_currency_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_currency_entry.id));
insert_values.push_back(std::to_string(character_currency_entry.platinum));
insert_values.push_back(std::to_string(character_currency_entry.gold));
insert_values.push_back(std::to_string(character_currency_entry.silver));
insert_values.push_back(std::to_string(character_currency_entry.copper));
insert_values.push_back(std::to_string(character_currency_entry.platinum_bank));
insert_values.push_back(std::to_string(character_currency_entry.gold_bank));
insert_values.push_back(std::to_string(character_currency_entry.silver_bank));
insert_values.push_back(std::to_string(character_currency_entry.copper_bank));
insert_values.push_back(std::to_string(character_currency_entry.platinum_cursor));
insert_values.push_back(std::to_string(character_currency_entry.gold_cursor));
insert_values.push_back(std::to_string(character_currency_entry.silver_cursor));
insert_values.push_back(std::to_string(character_currency_entry.copper_cursor));
insert_values.push_back(std::to_string(character_currency_entry.radiant_crystals));
insert_values.push_back(std::to_string(character_currency_entry.career_radiant_crystals));
insert_values.push_back(std::to_string(character_currency_entry.ebon_crystals));
insert_values.push_back(std::to_string(character_currency_entry.career_ebon_crystals));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_currency_entry.id = results.LastInsertedID();
return character_currency_entry;
}
character_currency_entry = NewEntity();
return character_currency_entry;
}
static int InsertMany(
Database& db,
std::vector<CharacterCurrency> character_currency_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_currency_entry: character_currency_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_currency_entry.id));
insert_values.push_back(std::to_string(character_currency_entry.platinum));
insert_values.push_back(std::to_string(character_currency_entry.gold));
insert_values.push_back(std::to_string(character_currency_entry.silver));
insert_values.push_back(std::to_string(character_currency_entry.copper));
insert_values.push_back(std::to_string(character_currency_entry.platinum_bank));
insert_values.push_back(std::to_string(character_currency_entry.gold_bank));
insert_values.push_back(std::to_string(character_currency_entry.silver_bank));
insert_values.push_back(std::to_string(character_currency_entry.copper_bank));
insert_values.push_back(std::to_string(character_currency_entry.platinum_cursor));
insert_values.push_back(std::to_string(character_currency_entry.gold_cursor));
insert_values.push_back(std::to_string(character_currency_entry.silver_cursor));
insert_values.push_back(std::to_string(character_currency_entry.copper_cursor));
insert_values.push_back(std::to_string(character_currency_entry.radiant_crystals));
insert_values.push_back(std::to_string(character_currency_entry.career_radiant_crystals));
insert_values.push_back(std::to_string(character_currency_entry.ebon_crystals));
insert_values.push_back(std::to_string(character_currency_entry.career_ebon_crystals));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterCurrency> All(Database& db)
{
std::vector<CharacterCurrency> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterCurrency entry{};
entry.id = atoi(row[0]);
entry.platinum = atoi(row[1]);
entry.gold = atoi(row[2]);
entry.silver = atoi(row[3]);
entry.copper = atoi(row[4]);
entry.platinum_bank = atoi(row[5]);
entry.gold_bank = atoi(row[6]);
entry.silver_bank = atoi(row[7]);
entry.copper_bank = atoi(row[8]);
entry.platinum_cursor = atoi(row[9]);
entry.gold_cursor = atoi(row[10]);
entry.silver_cursor = atoi(row[11]);
entry.copper_cursor = atoi(row[12]);
entry.radiant_crystals = atoi(row[13]);
entry.career_radiant_crystals = atoi(row[14]);
entry.ebon_crystals = atoi(row[15]);
entry.career_ebon_crystals = atoi(row[16]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterCurrency> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterCurrency> 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) {
CharacterCurrency entry{};
entry.id = atoi(row[0]);
entry.platinum = atoi(row[1]);
entry.gold = atoi(row[2]);
entry.silver = atoi(row[3]);
entry.copper = atoi(row[4]);
entry.platinum_bank = atoi(row[5]);
entry.gold_bank = atoi(row[6]);
entry.silver_bank = atoi(row[7]);
entry.copper_bank = atoi(row[8]);
entry.platinum_cursor = atoi(row[9]);
entry.gold_cursor = atoi(row[10]);
entry.silver_cursor = atoi(row[11]);
entry.copper_cursor = atoi(row[12]);
entry.radiant_crystals = atoi(row[13]);
entry.career_radiant_crystals = atoi(row[14]);
entry.ebon_crystals = atoi(row[15]);
entry.career_ebon_crystals = atoi(row[16]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_CHARACTER_CURRENCY_REPOSITORY_H
File diff suppressed because it is too large Load Diff
@@ -1,302 +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_CHARACTER_DISCIPLINES_REPOSITORY_H
#define EQEMU_BASE_CHARACTER_DISCIPLINES_REPOSITORY_H
#include "../../database.h"
#include "../../string_util.h"
class BaseCharacterDisciplinesRepository {
public:
struct CharacterDisciplines {
int id;
int slot_id;
int disc_id;
};
static std::string PrimaryKey()
{
return std::string("id");
}
static std::vector<std::string> Columns()
{
return {
"id",
"slot_id",
"disc_id",
};
}
static std::string ColumnsRaw()
{
return std::string(implode(", ", Columns()));
}
static std::string TableName()
{
return std::string("character_disciplines");
}
static std::string BaseSelect()
{
return fmt::format(
"SELECT {} FROM {}",
ColumnsRaw(),
TableName()
);
}
static std::string BaseInsert()
{
return fmt::format(
"INSERT INTO {} ({}) ",
TableName(),
ColumnsRaw()
);
}
static CharacterDisciplines NewEntity()
{
CharacterDisciplines entry{};
entry.id = 0;
entry.slot_id = 0;
entry.disc_id = 0;
return entry;
}
static CharacterDisciplines GetCharacterDisciplinesEntry(
const std::vector<CharacterDisciplines> &character_discipliness,
int character_disciplines_id
)
{
for (auto &character_disciplines : character_discipliness) {
if (character_disciplines.id == character_disciplines_id) {
return character_disciplines;
}
}
return NewEntity();
}
static CharacterDisciplines FindOne(
Database& db,
int character_disciplines_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"{} WHERE id = {} LIMIT 1",
BaseSelect(),
character_disciplines_id
)
);
auto row = results.begin();
if (results.RowCount() == 1) {
CharacterDisciplines entry{};
entry.id = atoi(row[0]);
entry.slot_id = atoi(row[1]);
entry.disc_id = atoi(row[2]);
return entry;
}
return NewEntity();
}
static int DeleteOne(
Database& db,
int character_disciplines_id
)
{
auto results = db.QueryDatabase(
fmt::format(
"DELETE FROM {} WHERE {} = {}",
TableName(),
PrimaryKey(),
character_disciplines_id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static int UpdateOne(
Database& db,
CharacterDisciplines character_disciplines_entry
)
{
std::vector<std::string> update_values;
auto columns = Columns();
update_values.push_back(columns[0] + " = " + std::to_string(character_disciplines_entry.id));
update_values.push_back(columns[1] + " = " + std::to_string(character_disciplines_entry.slot_id));
update_values.push_back(columns[2] + " = " + std::to_string(character_disciplines_entry.disc_id));
auto results = db.QueryDatabase(
fmt::format(
"UPDATE {} SET {} WHERE {} = {}",
TableName(),
implode(", ", update_values),
PrimaryKey(),
character_disciplines_entry.id
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static CharacterDisciplines InsertOne(
Database& db,
CharacterDisciplines character_disciplines_entry
)
{
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_disciplines_entry.id));
insert_values.push_back(std::to_string(character_disciplines_entry.slot_id));
insert_values.push_back(std::to_string(character_disciplines_entry.disc_id));
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES ({})",
BaseInsert(),
implode(",", insert_values)
)
);
if (results.Success()) {
character_disciplines_entry.id = results.LastInsertedID();
return character_disciplines_entry;
}
character_disciplines_entry = NewEntity();
return character_disciplines_entry;
}
static int InsertMany(
Database& db,
std::vector<CharacterDisciplines> character_disciplines_entries
)
{
std::vector<std::string> insert_chunks;
for (auto &character_disciplines_entry: character_disciplines_entries) {
std::vector<std::string> insert_values;
insert_values.push_back(std::to_string(character_disciplines_entry.id));
insert_values.push_back(std::to_string(character_disciplines_entry.slot_id));
insert_values.push_back(std::to_string(character_disciplines_entry.disc_id));
insert_chunks.push_back("(" + implode(",", insert_values) + ")");
}
std::vector<std::string> insert_values;
auto results = db.QueryDatabase(
fmt::format(
"{} VALUES {}",
BaseInsert(),
implode(",", insert_chunks)
)
);
return (results.Success() ? results.RowsAffected() : 0);
}
static std::vector<CharacterDisciplines> All(Database& db)
{
std::vector<CharacterDisciplines> all_entries;
auto results = db.QueryDatabase(
fmt::format(
"{}",
BaseSelect()
)
);
all_entries.reserve(results.RowCount());
for (auto row = results.begin(); row != results.end(); ++row) {
CharacterDisciplines entry{};
entry.id = atoi(row[0]);
entry.slot_id = atoi(row[1]);
entry.disc_id = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static std::vector<CharacterDisciplines> GetWhere(Database& db, std::string where_filter)
{
std::vector<CharacterDisciplines> 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) {
CharacterDisciplines entry{};
entry.id = atoi(row[0]);
entry.slot_id = atoi(row[1]);
entry.disc_id = atoi(row[2]);
all_entries.push_back(entry);
}
return all_entries;
}
static int DeleteWhere(Database& db, 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);
}
};
#endif //EQEMU_BASE_CHARACTER_DISCIPLINES_REPOSITORY_H

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